From e79eaf255b382dcbf35dce9b8748f54290573207 Mon Sep 17 00:00:00 2001 From: marco-link <31407440+marco-link@users.noreply.github.com> Date: Wed, 20 Oct 2021 09:35:00 +0200 Subject: [PATCH] fetch upstream (#4) * Change to the new method writeOneIOV in PPSTimingCalibrationPCLHarvester * Fix 'U' mode is deprecated * Make the printouts a bit more concise * HLT migration to CMSSW_12_1_0_pre4 template * Replace unaligned pointer dereference with bitwise read operations * Remove unnecessary initialization * Update autoDQM.py @L1TMon needes by @hcal in @allForPrompt and it has been dropped from @common * fix issue with SiPixelBadModule_ may be used uninitialized in TSAN builds * Removing ECAL delete statements to revert to known working version. Added a single character in ECALTPG log output * Try to avoid the extended cell search * Code check * Better handling of strings in ExternalgeneratorFilter Now handle case where strings have embedded \n which must be properly propagated to the external workers. * Fix out of bounds error * Change to new method writeOneIOV * update hcal FED list for crate 3-FED readout * Add shim producers and example configs to allow refitting of muon tracks from AOD or MINIAOD using standard TrackRefitter * code formatting * code checks * modernize TrackExtraRekeyer * modernize TrackProducerFromPatMuons * modernize test muon track refitting configurations * add unit test for refitting from analysis data-tiers * Complete the extended check * Fix for o2o parameters from config database * Added test for ExternalGeneratorFilter and EvtGen together * correct Eid FED boolean assignment * Improve HGCAL geometry rendering in Fireworks * Remove double loop on detIds while selecting HGCAL components. This makes the HGCAL geometry rendering much much faster than before. * Use the newly introduced parameters/topology information to gather information about a specific HGCAL detId. Avoid detId unpacking. * Remove ad-hoc magic numbers while offsetting layers in the hadronic section. * Color coding for the Silicon sensor is now bound to their thickness, with the following color coding: * red is 120 um sensor * blue is 200 um sensor * green is 300 um sensor * Improve Trackster{Layer,Hits} Proxies * Position lines (centres of LayerClusters) [and seed lines for the `Hits` Proxy] are now registered to a single `TEveStraightLineSet`. They are, as a consequence, a single entity in the GUI, and the selection will highlight them all for each trackster, individually. * Edges are now partitioned in two `TEveStraightLineSet`: non-adjacent edges (spans more than one layer) and adjacent edges (between sibling layers). Non-adjacent edges are rendered in red, while adjacent edges in yellow. * Add transparency support for the `Layer` proxy. Still not fully automated, but working. * Keep color memory between consecutive switches between `heat map` and full color rendering. * Code format * Use assertEqual in testDelete() * Replace/delete a Path/EndPath/Task in Schedule too when replacing/deleting one in Process This should make the replacement behavior with respect to Schedule more consistent with the replacement of Sequences/Tasks/Modules in Paths/SequencesTasks. * Make printing of function parameters consistent * Fix bug the prevented anonymous namespace file path from being added * Add mote top level classes and functions * Include realistic CSCBadChambers in Run-3 MC GTs * Minor cleanup of the fishbone code * add stub of SiPixelLorentzAnglePCLWorker * add stub of SiPixelLorentzAnglePCLHarvester * fixed collection of tracks passed to track refitter * push code to write out payload, improve functionality, follow-up to review * clone instead of copy * update parseFwkJobReport to include SiPixelLA * modify writing logic post PR #35556 * more clean-up * Add a protection for quasi-empty events Do not call the fishbone for quasi-empty events, with pixel hits only in the innermost layer. * add onlineBeamSpotESProducer to BeamSpot_cfi: fix general Online BS swap case * re-inroduce unit tests for visualization * Fix empty histograms in CSC L1T DQM * remove python2 contructs * Added unit test for edmPickEvents and dmCopyPickMerge * Update names of (two) parameters in mkFit README * Set beamspot in mkFit eventOfHits * Cleanup and code-format * Add a switch to L1THLTTauMatching to produce either PFTaus with a minimal contet or will fully filled datamembers Switch to CMSSW_11_3_X * Updates to deepTauID producer and PFTauSelector towards to enbling deepTauID at HLT * Address review comments * Keep just one customisation file for deepTauID at HLT * remove obsolete commands * Removed unused ObjectSelectorLegacy.h * Use mkfit::BeamSpot constructor * Fix for UBSAN crash As pointed out in: https://github.com/cms-sw/cmssw/pull/35605#issuecomment-942393073 * set equivalence of first/last bx labels used by different subsystems * Enable mkFit by default in 4+2 tracking iterations (initialStepPreSplitting, initialStep, highPtTripletStep, detachedQuadStep + detachedTripletStep, pixelLessStep) * formatting * Override beamspot parameter in customizeHLTIter0ToMkFit.py * Update SiPixelLorentzAnglePCLHarvester.cc * Update ALCARECOPromptCalibProdSiPixelLorentzAngle_cff.py * Update AlcaSiPixelLorentzAngleHarvester_cff.py * Remove unnecessary class members * Removed deprecated usages in PhysicsTools/CondLiteIO - made modules edm::one::EDAnalyzer - converted to use esConsumes * Use SimProducer+Analyzer to estimate material budget for HCAL * Code check * Remved unnecessary include * Modernize pythia6 related modules - moved away from legacy module - added consumes and esConsumes * Moved TauSpinnerFilter to be a stream module * Switch to @allForPrompt * adding safe for denominator=0 situation * Apply code cleanup Co-authored-by: Andrea Perrotta * Apply code format * Change default value of plotOffline flag * Change to the new method of using writeOneIOV * introduce unit tests for CondTools/SiPhase2Tracker * Added ConsumesCollector usage to ExternalDecayDriver Only Tauola needed it. * PPS bug fix of Run2 pixel topology * decouple writing legacy and HLT payloads on same sqlite file * Removed CMS deprecation warnings from MagneticField/Engine - converted legacy modules to one:: - added needed esConsumes calls * Remove CMS deprecation warnings in DetectorDescription/DDCMS - added esConsumes - changes simple modules to global:: * Added esConsumes to module in SimG4Core/DD4hepGeometry * Adding DNN variables for PFID for electrons in the dataformats * Evaluation of the PFID DNN also for photons * Added switch to disable the DNN PFID loading in Photon and Electron producers * Added switch to disable the DNN PFID loading in Photon and Electron producers Added expections for missing values in the DNN estimators Added switch to disable the DNN PFID loading in Photon and Electron producers Added expections for missing values in the DNN estimators * PF cluster isolations Added Pfiso variables for Photons Added PFiso electron variables for DNN * Added minmax scaler to DNN estimator * Moved PFcluster based isolation for electrons in GsfElectronAlgo * Added protection for HovEn and changed name of Photons variables Changed eta limits for photons also * Added default models and configurations for Run3 PFid Improved naming of parameters in PFEgammaFilters * Added initial values for PFEgammaFilters DNN thresholds * Added new scaler option for Photon PFID DNN Activate the PFID DNN by default * edm::FileInPath for model and scalers files * Disable PFiso computation if the DNN is disabled Code improvements * Added new DNN info in the PFCandidate dataformat * Improvements for TF sessions and fixes - Disabled missing PFCluster iso computation when DNN is not requested - Added Era modifier to activate the PFid DNN only in Run3_common era - Moved TF sessions in the DNNEstimator, so in the GlobalCache * Code improvements * Improved code for DNN estimator The duplicated code has been moved in EgammaTools/interface/EgammaDNNHelper.h. ElectronDNNEstimator and PhotonDNNestimator are now just used to create the correct list of variables and provide a function to select the model to be used for each candidate. * Removed logLevel from EgammaDNNHelper * Fixed bug in storing of DNN outputs in GsfElectronProducer * Added getters in PFCandidate, fixed missing scaling mode in EgammaDNNHelper * Disabled by default DNN Egamma PFID for pre4 * Enabled back Egm PFid by default; endRun -> endStream for sessions closing * Fixed code-checks, added const to PFCandidate getters * From atomic to unique_ptr for Tensorflow GraphDef * Intro unit test for PPSAssociationCuts * Made LeptonVertexSignificance independent of Event and EventSetup The constructor of the class would never be able to be called properly from cmsRun. * Add esConsumes calls to modules in PhysicsTools/PatUtils -Also switched to using std::unique_ptr * Use edm::ESGetToken when getting JME::JetResolution* - modules using the object were also moved away from inheriting from legacy modules * Fix CMS deprecation warnings in JetMETCorrections/Modules - moved modules away from inheriting from legacy modules - added esConsumes - switched to using edm::unique_ptr * Fix a crash caused by the missing luminosityBlockAuxiliary. A race can happen because local lock is unlocked when lsToStart is determined, and since this involves checking for marker files locally, another competing process can create EoL file since lock was released (and cause lsToStart to be increased above LS of the newly opened file). In case lsToStart is larger than ls, source would skip opening a lumisection before ending up processing events and this results in the lumi block related assertion. * Use correct record * load the onlineBeamSpotESProducer only if the modifier is called * Added new parameters from PPSAlignmentConfiguration to README. * Updated the worker and the harvester. - Replaced obsolete PPSAlignmentConfig and PPSAlignmentConfigESSource with PPSAlignmentConfiguration and PPSAlignmentConfigurationESSource, respectively. - Added support for new parameters in PPSAlignmentConfiguration, including: * min_RP_tracks_size, max_RP_tracks_size, * overwrite_sh_x, * new binning parameters. - Added merged results in the harvester, which can be saved to an SQLite file. - Huge refactor - Added fillDescriptions. - Shift ranges are now taken from the test config. - Added saving nice-looking cut plots. - Deleted redundant parameters for x relative alignment. * code-format * Updated the test folder. * Deleted unused cfi files. * Added RetrieveCTPPSRPAlignmentCorrectionsData. * p_x_diffFN_vs_x_N is now rebooked in the harvester. * Mode graph is now a TH1D. * Updated the AlignmentGlobal test (README and run_distributions_cfg.py). * Included PPS alignment in the PCL and added new matrix test. * Replaced writeOne with writeOneIOV in PPSAlignmentHarvester. * Clean up and avoid possible misuse of the numOfBins variable * Take Andrea's comments * Code format * Fixed typos * provide a reconstruction scenario for the commissioning_run type introduced in #34832 * Improvements to LeptonVertexSignificance Changes suggested by @slava77 * Rearrange the code to enable future implementation of SimProducer class * adding ALCARECOTkAlCosmicsCosmicTF0T track collection in Millepede code * fix typo in _loadOnlineBeamSpotESProducer * removed unnecessary includes * Added esConsumes calls to Muon related code - Also updated some modules to no longer be legacy * switched to using std::unique_ptr for memory management * Avoid use of uninitalized values in GBRForestTools Calls to XMLElement::Query*Attribute do not set the passed in variable if there was a problem. So we either need to initialize the variable before hand or check for errors. * Flip the byte order * Apply code-format * updating hltDumpStream to work in python3 * Remove unnecessary type specifiers and clean * squashing migrate remaining DT calib code esConsumes migration Few corrections to make dtTTrigConstantShiftCorrection_cfg run fixes & more migration to esConsumes some more fix migrate test/DBTools to esConsumes Few additional fixes after testing code format review comments * Updated run3 hlt, express and prompt GTs in autoCond.py. * Made DQMHelper consistent with DQMEDAnalyzer - make sure typedefs will always be consistent - removed unnecessary copying of std::string * Use esConsumes for modules in Validation/EventGenerator * Use ESGetToken in getting objects from EventSetup * Code format * Take Amtti's suggestions * Adding SiPixelLorentzAngleRcd PCL tags * Adding CTPPS PCL tags * Code format * Converted the raw pointers that required delete to smart pointers. * Change config file to create a tag incl SiPixelLA and CTPPS * change bx constant to centrally defined value defined in DataFormats/uminosity/interface/LumiConstants.h * Add multiprocess support into compareHistograms Comparing full blown DQM files is painfully slow. This PR adds the possibility to run the comparisons over the histograms in parallel via a configurable parameter: `-j`, or the longer version `--num-processes`. The default behaviour is unchanged: using one process will run the current implementation. Selecting more than one process will trigger multiprocessing. The final sorting on the output lists is mandatory to keep a sane ordering within the saved ROOT files. It is useless for the DQMGUI, which does that already internally, but it's mandatory in the exploration of the base ROOT files. Usually the price to pay should be negligible compared to the speed-up gain thanks to the parallelism. Co-authored-by: cmsbuild Co-authored-by: Tamas Co-authored-by: Martin Grunewald Co-authored-by: Christopher Co-authored-by: jfernan2 Co-authored-by: mmusich Co-authored-by: Abe Tishelman-Charny Co-authored-by: Sunanda Co-authored-by: Christopher Jones Co-authored-by: Abhirami Harilal Co-authored-by: Shahzad Malik Muzaffar Co-authored-by: Long Co-authored-by: Josh Bendavid Co-authored-by: Giacomo Govi Co-authored-by: Marco Rovere Co-authored-by: Matti Kortelainen Co-authored-by: Patrick Gartung Co-authored-by: Andrea Bocci Co-authored-by: Sven Dildick Co-authored-by: David Co-authored-by: Mario Masciovecchio Co-authored-by: Liam Co-authored-by: Michal Bluj Co-authored-by: Norraphat Co-authored-by: Alejandro Sanchez Co-authored-by: wweiphy <67766900+wweiphy@users.noreply.github.com> Co-authored-by: Christopher <52073715+ChrisMisan@users.noreply.github.com> Co-authored-by: Andrea Perrotta Co-authored-by: Fabrizio Ferro Co-authored-by: Davide Valsecchi Co-authored-by: Shilpi Co-authored-by: Srecko Morovic Co-authored-by: Mateusz Co-authored-by: Byeonghak Ko Co-authored-by: Antonio Vagnerini Co-authored-by: Sam Harper Co-authored-by: swmukher --- .../python/tools/trackselectionRefitting.py | 3 +- .../AlignmentMonitorMuonSystemMap1D.cc | 5 +- .../AlignmentMonitorMuonVsCurvature.cc | 5 +- .../AlignmentMonitorSegmentDifferences.cc | 5 +- .../plugins/TrackerToMuonPropagator.cc | 4 +- .../interface/AlignmentTrackSelector.h | 8 +- .../AlignmentCSCBeamHaloSelectorModule.cc | 4 +- .../AlignmentCSCOverlapSelectorModule.cc | 4 +- .../AlignmentCSCTrackSelectorModule.cc | 4 +- .../AlignmentMuonHIPTrajectorySelector.cc | 4 +- .../plugins/AlignmentMuonSelectorModule.cc | 4 +- .../plugins/AlignmentTrackSelectorModule.cc | 4 +- ...AlignmentTracksFromVertexSelectorModule.cc | 6 +- .../plugins/GlobalTrackerMuonAlignment.cc | 47 +- .../src/AlignmentTrackSelector.cc | 12 +- .../test/LaserSimulation_cfg.py | 2 +- .../test/make_SVGtemplates_cfg.py | 2 +- .../test/test_sanityCheck_cfg.py | 2 +- .../interface/MuonResidualsFromTrack.h | 5 +- .../plugins/CSCOverlapsAlignmentAlgorithm.cc | 2 +- .../plugins/MuonAlignmentFromReference.cc | 5 +- .../src/MuonResidualsFromTrack.cc | 8 +- .../test/StandAloneTest.cc | 52 +- .../macros/PlotAlignmentValidation.C | 2179 ++++--- .../OfflineValidation/macros/trackSplitPlot.h | 377 +- .../OfflineValidation/plugins/BuildFile.xml | 1 + .../OfflineValidation/plugins/DMRChecker.cc | 20 +- .../plugins/GeneralPurposeTrackAnalyzer.cc | 61 +- .../TrackerOfflineValidationSummary.cc | 63 +- .../scripts/GeometryComparisonPlotter.cc | 2906 ++++----- .../plugins/AlignmentPrescaler.cc | 146 +- .../plugins/AlignmentPrescaler.h | 48 - .../TrackerAlignment/plugins/BuildFile.xml | 1 + .../plugins/CreateTrackerAlignmentRcds.cc | 6 +- .../plugins/MCMisalignmentScaler.cc | 2 +- .../plugins/TkAlCaOverlapTagger.cc | 79 +- .../plugins/TkAlCaSkimTreeMerger.cc | 75 +- ...CaRecoPrescaling.ALCARECOTkAlCosmics0T.tpl | 2 +- ...AlCaRecoPrescaling.ALCARECOTkAlMinBias.tpl | 2 +- ...AlCaRecoSkimming.ALCARECOTkAlCosmics0T.tpl | 2 +- ...TkAlCaRecoSkimming.ALCARECOTkAlMinBias.tpl | 2 +- .../interface/TrackInfoProducer.h | 41 - .../TrackInfoProducer/src/SealModules.cc | 5 - .../src/TrackInfoProducer.cc | 58 +- .../HGCUncalibRecHitsToRecHitsConstants.h | 1 + .../interface/SiPixelClustersCUDA.h | 7 +- .../interface/gpuClusteringConstants.h | 1 + .../interface/TrackingRecHit2DHeterogeneous.h | 6 +- .../test/TrackingRecHit2DCUDA_t.cpp | 4 +- .../interface/CaloMiscalibMapEcal.h | 1 - .../interface/CaloMiscalibMapHcal.h | 1 - .../interface/CaloMiscalibTools.h | 1 - .../interface/CaloMiscalibToolsMC.h | 1 - .../interface/EcalRecHitRecalib.h | 27 +- .../interface/HcalRecHitRecalib.h | 24 +- .../interface/WriteEcalMiscalibConstants.h | 9 +- .../interface/WriteEcalMiscalibConstantsMC.h | 9 +- .../plugins/CaloMiscalibTools.cc | 7 +- .../plugins/CaloMiscalibToolsMC.cc | 7 +- .../plugins/EcalRecHitRecalib.cc | 54 +- .../plugins/HcalRecHitRecalib.cc | 116 +- .../plugins/WriteEcalMiscalibConstants.cc | 42 +- .../plugins/WriteEcalMiscalibConstantsMC.cc | 43 +- .../test/writeXMLinSqlite.py | 2 +- .../test/writeXMLinSqliteMC.py | 6 +- .../CastorCalib/interface/CastorLedAnalysis.h | 1 - .../interface/CastorPedestalAnalysis.h | 1 - .../interface/CastorPedestalsAnalysis.h | 113 - .../CastorCalib/plugins/BuildFile.xml | 1 + .../plugins/CastorHardcodeCalibrations.cc | 41 +- .../plugins/CastorHardcodeCalibrations.h | 45 - .../plugins/CastorPedestalsAnalysis.cc | 134 +- .../plugins/CastorTextCalibrations.cc | 36 +- .../plugins/CastorTextCalibrations.h | 57 - .../CastorCalib/plugins/SealModule.cc | 8 - .../test/castor_localrun_pedestals_cfg.py | 3 + .../interface/TEcnaRun.h | 2 +- .../src/TEcnaRun.cc | 70 +- .../src/TEcnaWrite.cc | 4 +- .../plugins/EcalABAnalyzer.cc | 93 +- .../plugins/EcalABAnalyzer.h | 71 +- .../plugins/EcalLaserAnalyzer.cc | 147 +- .../plugins/EcalLaserAnalyzer.h | 87 +- .../plugins/EcalLaserAnalyzer2.cc | 198 +- .../plugins/EcalLaserAnalyzer2.h | 89 +- .../plugins/EcalPerEvtLaserAnalyzer.cc | 113 +- .../plugins/EcalPerEvtLaserAnalyzer.h | 80 +- .../plugins/EcalTestPulseAnalyzer.cc | 105 +- .../plugins/EcalTestPulseAnalyzer.h | 72 +- .../interface/EcalPedOffset.h | 32 +- .../EcalPedestalOffsets/src/EcalPedOffset.cc | 28 +- .../interface/EcalDccWeightBuilder.h | 24 +- .../EcalSRTools/src/EcalDccWeightBuilder.cc | 138 +- .../EcalSRTools/test/produceDccWeights.py | 8 +- .../EcalTPGTools/plugins/EcalTPGDBCopy.cc | 159 +- .../EcalTPGTools/plugins/EcalTPGDBCopy.h | 74 +- .../plugins/EcalTPGParamBuilder.cc | 16 +- .../plugins/EcalTPGParamBuilder.h | 7 +- .../interface/EcalLaserCondTools.h | 10 +- .../interface/EcalTrivialObjectAnalyzer.h | 91 +- .../src/EcalLaserCondTools.cc | 15 +- .../src/EcalTrivialObjectAnalyzer.cc | 243 +- .../src/HcalHardcodeCalibrations.cc | 4 + .../HcalTPGAlgos/interface/HcaluLUTTPGCoder.h | 3 + .../HcalTPGAlgos/src/HcaluLUTTPGCoder.cc | 47 +- .../HcalTPGEventSetup/src/HcalTPGCoderULUT.cc | 4 + CalibFormats/CaloObjects/src/CaloSamples.cc | 34 +- .../plugins/CSCL1TPLookupTableEP.cc | 289 + .../python/CSCL1TPLookupTableEP_cff.py | 122 + .../test/testNewCalibConstants_global_cfg.py | 2 +- .../test/testNewCalibConstants_sim_cfg.py | 2 +- .../interface/DTSegmentSelector.h | 3 + .../interface/DTT0CorrectionFactory.h | 7 +- .../interface/DTTTrigCorrectionFactory.h | 7 +- .../interface/DTVDriftPluginFactory.h | 7 +- .../plugins/DTFakeT0ESProducer.cc | 13 +- .../plugins/DTFakeT0ESProducer.h | 9 + .../plugins/DTNoiseCalibration.cc | 12 +- .../plugins/DTNoiseCalibration.h | 6 +- .../plugins/DTNoiseComputation.cc | 4 +- .../plugins/DTNoiseComputation.h | 2 + .../plugins/DTResidualCalibration.cc | 5 +- .../plugins/DTResidualCalibration.h | 3 + .../DTT0AbsoluteReferenceCorrection.cc | 8 +- .../plugins/DTT0AbsoluteReferenceCorrection.h | 8 +- .../DTCalibration/plugins/DTT0Calibration.cc | 7 +- .../DTCalibration/plugins/DTT0Calibration.h | 2 + .../plugins/DTT0CalibrationRMS.cc | 4 +- .../plugins/DTT0CalibrationRMS.h | 2 + .../plugins/DTT0ChamberReferenceCorrection.cc | 9 +- .../plugins/DTT0ChamberReferenceCorrection.h | 7 +- .../DTCalibration/plugins/DTT0Correction.cc | 12 +- .../DTCalibration/plugins/DTT0Correction.h | 10 +- .../plugins/DTT0FEBPathCorrection.cc | 9 +- .../plugins/DTT0FEBPathCorrection.h | 7 +- .../plugins/DTT0FillChamberFromDB.cc | 13 +- .../plugins/DTT0FillChamberFromDB.h | 8 +- .../plugins/DTT0FillDefaultFromDB.cc | 12 +- .../plugins/DTT0FillDefaultFromDB.h | 11 +- .../DTT0WireInChamberReferenceCorrection.cc | 13 +- .../DTT0WireInChamberReferenceCorrection.h | 11 +- .../DTCalibration/plugins/DTTPAnalyzer.cc | 38 +- .../DTCalibration/plugins/DTTPDeadWriter.cc | 9 +- .../DTCalibration/plugins/DTTPDeadWriter.h | 5 + .../plugins/DTTTrigCalibration.cc | 10 +- .../plugins/DTTTrigCalibration.h | 7 +- .../plugins/DTTTrigConstantShift.cc | 12 +- .../plugins/DTTTrigConstantShift.h | 6 +- .../plugins/DTTTrigCorrection.cc | 16 +- .../DTCalibration/plugins/DTTTrigCorrection.h | 9 +- .../plugins/DTTTrigCorrectionFirst.cc | 14 +- .../plugins/DTTTrigCorrectionFirst.h | 7 +- .../plugins/DTTTrigFillWithAverage.cc | 11 +- .../plugins/DTTTrigFillWithAverage.h | 8 +- .../DTCalibration/plugins/DTTTrigMatchRPhi.cc | 8 +- .../DTCalibration/plugins/DTTTrigMatchRPhi.h | 7 +- .../plugins/DTTTrigOffsetCalibration.cc | 10 +- .../plugins/DTTTrigOffsetCalibration.h | 7 +- .../plugins/DTTTrigResidualCorrection.cc | 16 +- .../plugins/DTTTrigResidualCorrection.h | 11 +- .../plugins/DTTTrigT0SegCorrection.cc | 8 +- .../plugins/DTTTrigT0SegCorrection.h | 10 +- .../DTCalibration/plugins/DTTTrigWriter.cc | 5 +- .../DTCalibration/plugins/DTTTrigWriter.h | 7 + .../plugins/DTVDriftCalibration.cc | 16 +- .../plugins/DTVDriftCalibration.h | 8 +- .../plugins/DTVDriftMeanTimer.cc | 2 +- .../DTCalibration/plugins/DTVDriftMeanTimer.h | 3 +- .../DTCalibration/plugins/DTVDriftSegment.cc | 17 +- .../DTCalibration/plugins/DTVDriftSegment.h | 11 +- .../plugins/DTVDriftSegmentCalibration.cc | 5 +- .../plugins/DTVDriftSegmentCalibration.h | 4 + .../DTCalibration/plugins/DTVDriftWriter.cc | 19 +- .../DTCalibration/plugins/DTVDriftWriter.h | 10 +- CalibMuon/DTCalibration/plugins/SealModule.cc | 2 + .../dtT0AbsoluteReferenceCorrection_cfg.py | 3 - .../dtT0FillChamberFromDBCorrection_cfg.py | 1 + .../dtT0FillDefaultFromDBCorrection_cfg.py | 1 + .../python/dtTTrigCorrection_cfi.py | 1 + .../DTCalibration/src/DTSegmentSelector.cc | 3 +- .../test/DBTools/DTT0Analyzer.cc | 7 +- .../DTCalibration/test/DBTools/DTT0Analyzer.h | 7 + .../test/DBTools/DTTTrigAnalyzer.cc | 6 +- .../test/DBTools/DTTTrigAnalyzer.h | 5 +- .../test/DBTools/DTVDriftAnalyzer.cc | 8 +- .../test/DBTools/DTVDriftAnalyzer.h | 5 + .../test/DBTools/DumpDBToFile.cc | 135 +- .../DTCalibration/test/DBTools/DumpDBToFile.h | 50 +- .../test/DBTools/DumpFileToDB.cc | 61 +- .../DTCalibration/test/DBTools/DumpFileToDB.h | 18 +- .../DTCalibration/test/DBTools/FakeTTrig.cc | 9 +- .../DTCalibration/test/DBTools/FakeTTrig.h | 9 +- .../test/DBTools/ShiftTTrigDB.cc | 11 +- .../DTCalibration/test/DBTools/ShiftTTrigDB.h | 8 +- .../DTCalibration/test/DumpDBToFile_cfg.py | 62 +- .../DTCalibration/test/DumpFileToDB_cfg.py | 4 +- CalibMuon/DTDigiSync/BuildFile.xml | 1 - .../DTDigiSync/interface/DTTTrigSyncFactory.h | 4 +- .../DTDigiSync/plugins/DTTTrigSyncFromDB.cc | 57 +- .../DTDigiSync/plugins/DTTTrigSyncT0Only.cc | 47 +- .../DTDigiSync/plugins/DTTTrigSyncTOFCorr.cc | 25 +- CalibPPS/AlignmentGlobal/README.md | 196 +- .../AlignmentGlobal/plugins/BuildFile.xml | 4 +- .../plugins/PPSAlignmentHarvester.cc | 811 ++- .../plugins/PPSAlignmentWorker.cc | 335 +- .../python/ALCARECOPPSAlignment_Output_cff.py | 13 + .../python/ALCARECOPPSAlignment_cff.py | 16 + .../python/PPSAlignmentHarvester_cff.py | 6 + .../python/ppsAlignmentHarvester_cfi.py | 7 - .../python/ppsAlignmentWorker_cfi.py | 9 - CalibPPS/AlignmentGlobal/test/README.md | 75 +- CalibPPS/AlignmentGlobal/test/config_cff.py | 22 +- .../test/config_reference_cff.py | 2 +- .../AlignmentGlobal/test/run_analysis_cfg.py | 111 + .../test/run_analysis_manual_cfg.py | 58 - .../test/run_distributions_cfg.py | 56 +- .../test/run_distributions_reference_cfg.py | 59 +- .../AlignmentRelative/src/AlignmentTask.cc | 6 +- .../PPSAlignmentConfigurationESSource.cc | 702 +++ .../plugins/PPSAssociationCutsESSource.cc | 130 + .../plugins/PPSPixelTopologyESSource.cc | 6 + .../ctppsOpticalFunctions_non_DB_cff.py | 142 + .../python/ppsAssociationCuts_non_DB_cff.py | 118 + .../ESProducers/python/ppsTopology_cff.py | 2 +- .../TimingCalibration/plugins/BuildFile.xml | 1 + ...mondSampicTimingCalibrationPCLHarvester.cc | 290 + ...DiamondSampicTimingCalibrationPCLWorker.cc | 155 + .../PPSTimingCalibrationPCLHarvester.cc | 2 +- .../ALCARECOPPSCalTrackBasedSel_Output_cff.py | 5 +- .../python/ALCARECOPPSCalTrackBasedSel_cff.py | 16 +- ...PSDiamondSampicTimingCalibHarvester_cff.py | 13 + ...OPPSDiamondSampicTimingCalib_Output_cff.py | 13 + ...ALCARECOPPSDiamondSampicTimingCalib_cff.py | 18 + .../DiamondSampicCalibrationHarvester_cfg.py | 68 + .../DiamondSampicCalibrationWorker_cfg.py | 83 + .../test/runDiamondSampicCalibration | 7 + ...pendentRecords_forGlobalTag_nofakes_cff.py | 3 + .../test/SiPixelFedCablingMapWriter_cfg.py | 1 - .../SiPixelCPEGenericDBErrorParametrization.h | 71 - .../interface/SiPixelDetInfoFileWriter.h | 5 +- .../SiPixelFakeCPEGenericErrorParmESSource.h | 28 - .../SiPixelESProducers/plugins/SealModules.cc | 2 - .../SiPixelFakeCPEGenericErrorParmESSource.cc | 30 - .../SiPixelGenErrorDBObjectESProducer.cc | 11 +- .../SiPixelTemplateDBObjectESProducer.cc | 11 +- ...ixelFakeCPEGenericErrorParmESSource_cfi.py | 8 - ...SiPixelCPEGenericDBErrorParametrization.cc | 186 - .../test/SiPixelFakeGainForHLTReader.cc | 2 + .../test/SiPixelFakeGainForHLTReader.h | 12 +- .../test/SiPixelFakeGainOfflineReader.cc | 3 +- .../test/SiPixelFakeGainOfflineReader.h | 12 +- .../test/SiPixelFakeGainReader.cc | 3 +- .../test/SiPixelFakeGainReader.h | 12 +- .../interface/SiPixelErrorEstimation.h | 5 +- .../SiPixelLorentzAngle/BuildFile.xml | 4 + .../SiPixelLorentzAngleCalibrationStruct.h | 35 + .../SiPixelLorentzAnglePCLHarvester_cfi.py | 11 + .../SiPixelLorentzAnglePCLWorker_cfi.py | 27 + .../src/SiPixelLorentzAngle.cc | 2 +- .../src/SiPixelLorentzAngle.h | 5 +- .../src/SiPixelLorentzAnglePCLHarvester.cc | 474 ++ .../src/SiPixelLorentzAnglePCLWorker.cc | 798 +++ .../test/SiPixelLorentzAngleCosmic_cfg.py | 2 +- .../test/SiPixelLorentzAngle_cfg.py | 2 +- .../plugins/SiPixelStatusHarvester.cc | 12 +- .../SiPixelOfflineCalibAnalysisBase.h | 6 +- .../plugins/SiPixelCalibDigiFilter.cc | 17 +- .../plugins/SiPixelCalibDigiFilter.h | 6 +- .../plugins/SiPixelDQMRocLevelAnalyzer.cc | 20 +- .../plugins/SiPixelDQMRocLevelAnalyzer.h | 4 +- .../plugins/SiPixelErrorsDigisToCalibDigis.cc | 3 - .../plugins/SiPixelErrorsDigisToCalibDigis.h | 5 +- .../SiPixelFedFillerWordEventNumber.cc | 5 - .../plugins/SiPixelFedFillerWordEventNumber.h | 6 +- .../src/SiPixelOfflineCalibAnalysisBase.cc | 3 + .../test/SSTGain_PCL_Config_cfg.py | 2 +- CalibTracker/SiStripCommon/BuildFile.xml | 4 + .../SiStripOnTrackClusterTableProducerBase.h | 56 + .../SiStripCommon/plugins/BuildFile.xml | 1 + .../SiStripCommon/plugins/SealModules.cc | 8 +- .../plugins/SiStripDetInfoFileWriter.cc | 54 +- .../plugins/SiStripDetInfoFileWriter.h | 44 - ...SiStripLorentzAngleRunInfoTableProducer.cc | 107 + ...SiStripPositionCorrectionsTableProducer.cc | 75 + .../SiStripCommon/python/customiseAlCaNano.py | 15 + .../SiStripOnTrackClusterTableProducerBase.cc | 68 + .../produceCalibrationTree_CosmicsLABP_cfg.py | 173 + .../SiStripDCS/plugins/FilterTrackerOn.cc | 67 +- .../SiStripDCS/plugins/FilterTrackerOn.h | 45 - .../SiStripDCS/plugins/SealModules.cc | 4 - .../plugins/SiStripDetVOffHandler.cc | 6 +- .../plugins/SiStripDetVOffPrinter.cc | 2 +- .../plugins/SiStripDetVOffTkMapPlotter.cc | 9 +- .../plugins/SiStripDetVOffTrendPlotter.cc | 7 +- .../SiStripDCS/plugins/TkVoltageMapCreator.cc | 9 +- .../plugins/DBWriter/DummyCondDBWriter.h | 8 +- .../plugins/DBWriter/DummyCondObjPrinter.h | 4 +- .../DBWriter/SiStripFedCablingManipulator.cc | 4 +- .../DBWriter/SiStripFedCablingManipulator.h | 6 +- .../fake/SiStripApvGainBuilderFromTag.h | 2 +- ...SiStripNoiseNormalizedWithApvGainBuilder.h | 3 +- .../SiStripHitEfficiency/interface/HitEff.h | 4 +- .../interface/SiStripLAProfileBooker.h | 6 +- .../plugins/EnsembleCalibrationLA.cc | 7 +- .../plugins/EnsembleCalibrationLA.h | 7 +- .../SiStripLorentzAngle/plugins/MeasureLA.cc | 3 +- .../plugins/SiStripLAProfileBooker.cc | 2 + .../SiStripLorentzAngle/src/LA_Results.cc | 5 +- .../SelectedElectronFEDListProducer.cc | 57 +- .../plugins/SelectedElectronFEDListProducer.h | 36 +- .../test/AlCaDoubleElectrons_cfg.py | 2 +- .../interface/ECALpedestalPCLHarvester.h | 34 +- .../interface/ECALpedestalPCLworker.h | 3 + .../interface/EcalEleCalibLooper.h | 59 +- .../interface/ElectronCalibrationUniv.h | 71 +- .../EcalCalibAlgos/interface/InvRingCalib.h | 53 +- .../interface/PhiSymmetryCalibration.h | 39 +- .../interface/Pi0FixedMassWindowCalibration.h | 20 +- .../EcalCalibAlgos/interface/ZeeCalibration.h | 53 +- .../src/ECALpedestalPCLHarvester.cc | 44 +- .../src/ECALpedestalPCLworker.cc | 14 +- .../EcalCalibAlgos/src/EcalEleCalibLooper.cc | 20 +- .../src/ElectronCalibrationUniv.cc | 96 +- .../EcalCalibAlgos/src/InvRingCalib.cc | 33 +- .../src/PhiSymmetryCalibration.cc | 48 +- .../src/PhiSymmetryCalibration_step2.cc | 32 +- .../src/PhiSymmetryCalibration_step2.h | 25 +- .../src/PhiSymmetryCalibration_step2_SM.cc | 32 +- .../src/PhiSymmetryCalibration_step2_SM.h | 25 +- .../src/Pi0FixedMassWindowCalibration.cc | 43 +- .../EcalCalibAlgos/src/ZeeCalibration.cc | 103 +- .../HcalAlCaRecoProducers/BuildFile.xml | 30 - .../interface/AlCaEcalHcalReadoutsProducer.h | 51 - .../interface/AlCaHcalNoiseProducer.h | 72 - .../{src => plugins}/AlCaDiJetsProducer.cc | 81 +- .../plugins/AlCaEcalHcalReadoutsProducer.cc | 96 + .../{src => plugins}/AlCaGammaJetProducer.cc | 75 +- .../plugins/AlCaGammaJetSelector.cc | 13 +- .../plugins/AlCaHBHEMuonFilter.cc | 39 +- .../{src => plugins}/AlCaHBHEMuonProducer.cc | 34 +- .../plugins/AlCaHEMuonFilter.cc | 14 +- .../{src => plugins}/AlCaHOCalibProducer.cc | 92 +- .../plugins/AlCaHcalHBHEMuonFilter.cc | 136 + .../plugins/AlCaHcalHBHEMuonProducer.cc | 1131 ++++ .../plugins/AlCaHcalHEMuonFilter.cc | 141 + .../plugins/AlCaHcalIsotrkFilter.cc | 164 + .../plugins/AlCaHcalIsotrkProducer.cc | 1405 +++++ .../{src => plugins}/AlCaHcalNoiseProducer.cc | 138 +- .../plugins/AlCaIsoTracksFilter.cc | 66 +- .../{src => plugins}/AlCaIsoTracksProducer.cc | 32 +- .../plugins/AlCaIsoTracksProducerFilter.cc | 11 +- .../plugins/AlCaIsolatedBunchFilter.cc | 3 +- .../plugins/AlCaIsolatedBunchSelector.cc | 3 +- .../plugins/AlCaLowPUHBHEMuonFilter.cc | 13 +- .../plugins/BuildFile.xml | 27 +- .../plugins/PrescalerFHN.cc | 3 +- .../{src => plugins}/ProducerAnalyzer.cc | 159 +- ...calCalHBHEMuonProducerFilter_Output_cff.py | 19 + ...CARECOHcalCalHBHEMuonProducerFilter_cff.py | 14 + ...OHcalCalHEMuonProducerFilter_Output_cff.py | 19 + ...ALCARECOHcalCalHEMuonProducerFilter_cff.py | 14 + ...RECOHcalCalIsoTrkFilterNoHLT_Output_cff.py | 27 + ...OHcalCalIsoTrkProducerFilter_Output_cff.py | 20 + ...ALCARECOHcalCalIsoTrkProducerFilter_cff.py | 14 + .../python/alcadijets_cfi.py | 14 +- .../python/alcagammajet_cfi.py | 29 +- .../python/alcahbhemuon_cfi.py | 11 +- .../python/alcahcalnoise_cfi.py | 19 +- .../python/alcahomuon_cfi.py | 22 +- .../python/alcahomuoncosmics_cfi.py | 23 +- .../python/alcaiterphisym_cfi.py | 8 +- .../python/alcaminbias_cfi.py | 7 +- .../src/AlCaEcalHcalReadoutsProducer.cc | 44 - .../src/ProducerAnalyzer.h | 82 - .../HcalAlCaRecoProducers/src/SealModule.cc | 9 - .../test/AlCaHBHEMuonFilterProducer_cfg.py | 20 +- .../test/AlCaHBHEMuonProducerFilter_cfg.py | 52 + .../test/AlCaHEMuonProducerFilter_cfg.py | 52 + .../test/AlCaHcalIsoTrk_cfg.py | 65 + .../test/AlCaIsoTrackFilterNoHLT_cfg.py | 11 +- .../HcalAlCaRecoProducers/test/di_cfg.py | 2 +- .../HcalAlCaRecoProducers/test/phi_sym_cfg.py | 2 +- .../HcalCalibAlgos/{src => interface}/TCell.h | 0 .../HcalCalibAlgos/interface/hcalCalib.h | 97 +- .../{src => interface}/hcalCalibUtils.h | 2 +- .../HcalCalibAlgos/macros/hocalib_pl18.C | 4005 ++++++++++++ .../HcalCalibAlgos/macros/hocalib_tmpfit.C | 943 +++ .../HcalCalibAlgos/plugins/HOCalibAnalyzer.cc | 3091 ++------- .../HcalCalibAlgos/plugins/HcalCalibrator.cc | 79 +- .../HcalCalibAlgos/plugins/HcalCalibrator.h | 83 - .../plugins/HcalHBHEMuonAnalyzer.cc | 4 +- .../plugins/HcalHBHENewMuonAnalyzer.cc | 330 + .../plugins/HcalIsoTrackAnalyzer.cc | 313 + .../plugins/HcalIsoTrkAnalyzer.cc | 49 +- .../HcalCalibAlgos/plugins/HitReCalibrator.cc | 52 +- .../HcalCalibAlgos/plugins/HitReCalibrator.h | 57 - Calibration/HcalCalibAlgos/src/classes.h | 2 +- Calibration/HcalCalibAlgos/src/hcalCalib.cc | 94 +- .../HcalCalibAlgos/src/hcalCalibUtils.cc | 2 +- .../HcalCalibAlgos/test/HcalIsoTrackStudy.cc | 56 +- .../test/batchjob_analisotrk.csh | 2 +- .../test/batchjob_calib_valid.csh | 2 +- .../HcalCalibAlgos/test/batchjob_pf_corrs.csh | 2 +- .../test/python/hcalHBHEMuonAnalysis_cfg.py | 33 + .../test/python/hcalHBHEMuon_cfg.py | 19 +- .../test/python/isoTrackAlCaAnalysis_cfg.py | 47 + .../python/isoTrackAlCaRecoAnalysis_cfg.py | 9 +- .../test/python/isoTrackAnalysis_cfg.py | 36 + .../interface/ECALRegFEDSelector.h | 47 - .../EcalIsolatedParticleCandidateProducer.h | 47 - .../interface/IPTCorrector.h | 34 - .../IsolatedEcalPixelTrackCandidateProducer.h | 48 - .../IsolatedPixelTrackCandidateL1TProducer.h | 95 - .../IsolatedPixelTrackCandidateProducer.h | 92 - .../interface/SiStripRegFEDSelector.h | 40 - .../interface/SubdetFEDSelector.h | 41 - .../{ => plugins}/BuildFile.xml | 4 +- .../{src => plugins}/ECALRegFEDSelector.cc | 57 +- .../EcalIsolatedParticleCandidateProducer.cc | 65 +- .../HITRegionalPixelSeedGenerator.cc} | 57 +- .../{src => plugins}/IPTCorrector.cc | 43 +- ...IsolatedEcalPixelTrackCandidateProducer.cc | 51 +- .../IsolatedPixelTrackCandidateL1TProducer.cc | 90 +- .../IsolatedPixelTrackCandidateProducer.cc | 88 +- .../{src => plugins}/SiStripRegFEDSelector.cc | 49 +- .../{src => plugins}/SubdetFEDSelector.cc | 57 +- .../python/ecalFED_cfi.py | 9 - .../python/ecalIsolPartProd_cfi.py | 14 - .../python/stripFED_cfi.py | 9 - .../python/subdetFED_cfi.py | 13 - .../HcalIsolatedTrackReco/src/SealModule.cc | 24 - .../plugins/CorrPCCProducer.cc | 2 - .../plugins/CalibrationTrackSelectorModule.cc | 4 +- ...CalibProdSiPixelLorentzAngle_Output_cff.py | 13 + ...OPromptCalibProdSiPixelLorentzAngle_cff.py | 70 + .../python/ALCARECOSiPixelCalCosmics_cff.py | 6 +- ...LCARECOSiStripCalCosmicsNano_Output_cff.py | 17 + .../ALCARECOSiStripCalCosmicsNano_cff.py | 63 + .../AlcaSiPixelLorentzAngleHarvester_cff.py | 18 + .../AlcaSiPixelLorentzAngleHarvester_cfi.py | 4 + .../test/Alca_BeamFit_Workflow.py | 2 +- .../test/parseFwkJobReport.py | 7 +- .../test/testPCLAlCaHarvesting.py | 7 +- Calibration/Tools/interface/TrackAssociator.h | 191 - .../Tools/plugins/ElectronSqPtTkIsolation.cc | 60 - .../Tools/plugins/ElectronSqPtTkIsolation.h | 39 - .../ElectronSqPtTkIsolationProducer.cc | 62 - .../plugins/ElectronSqPtTkIsolationProducer.h | 33 - Calibration/Tools/plugins/SealModule.cc | 9 - .../Tools/plugins/SingleEleCalibSelector.cc | 168 - .../Tools/plugins/SingleEleCalibSelector.h | 52 - Calibration/Tools/src/TrackAssociator.cc | 588 -- .../EcalTools/plugins/EcalCosmicsHists.cc | 121 +- .../EcalTools/plugins/EcalCosmicsHists.h | 51 +- .../EcalTools/plugins/EcalDigiDisplay.cc | 63 +- .../EcalTools/plugins/EcalDigiDisplay.h | 19 +- .../EcalTools/plugins/EcalDisplaysByEvent.cc | 37 +- .../EcalTools/plugins/EcalDisplaysByEvent.h | 51 +- .../EcalTools/plugins/EcalMipGraphs.cc | 42 +- .../EcalTools/plugins/EcalMipGraphs.h | 35 +- .../EcalTools/plugins/EcalPedHists.cc | 27 +- .../EcalTools/plugins/EcalPedHists.h | 22 +- .../EcalTools/plugins/EcalTPGAnalyzer.cc | 84 +- .../EcalTools/plugins/EcalTPGAnalyzer.h | 47 +- .../EcalTools/plugins/EcalURecHitHists.cc | 17 +- .../EcalTools/plugins/EcalURecHitHists.h | 24 +- .../HcalOnlineDb/interface/HcalLutGenerator.h | 11 +- .../HcalOnlineDb/src/HcalLutGenerator.cc | 13 +- CommonTools/CandAlgos/interface/CandMatcher.h | 17 +- .../CandAlgos/interface/NewCandMatcher.h | 15 +- .../SingleObjectShallowCloneSelector.h | 5 +- ...AssociatedVariableMaxCutCandSelectorNew.cc | 2 +- .../interface/ConditionDBWriter.h | 7 +- CommonTools/MVAUtils/src/GBRForestTools.cc | 23 +- .../ParticleFlow/plugins/DeltaBetaWeights.cc | 39 +- .../ParticleFlow/plugins/DeltaBetaWeights.h | 41 - .../plugins/GenericPFCandidateSelector.cc | 4 +- .../plugins/IPCutPFCandidateSelector.cc | 4 +- .../plugins/PFCandIsolatorFromDeposit.cc | 71 +- .../plugins/PFCandIsolatorFromDeposit.h | 68 - ...cer.h => PFCandidateFromFwdPtrProducer.cc} | 6 + ...h => PFCandidateFwdPtrCollectionFilter.cc} | 4 + ...wdPtrProducer.h => PFJetFwdPtrProducer.cc} | 3 + CommonTools/ParticleFlow/plugins/PFMET.cc | 42 +- CommonTools/ParticleFlow/plugins/PFMET.h | 45 - .../ParticleFlow/plugins/PFNoPileUpPacked.cc | 91 + CommonTools/ParticleFlow/plugins/PFPileUp.cc | 97 +- CommonTools/ParticleFlow/plugins/PFPileUp.h | 64 - ...wdPtrProducer.h => PFTauFwdPtrProducer.cc} | 3 + .../ParticleFlow/plugins/SealModule.cc | 23 - .../ParticleFlow/plugins/TopProjector.cc | 253 +- .../ParticleFlow/plugins/TopProjector.h | 252 - CommonTools/ParticleFlow/python/pfCHS_cff.py | 15 + .../ParticleFlow/python/pfNoPileUpJME_cff.py | 28 +- .../ParticleFlow/python/pfPileUp_cfi.py | 5 +- .../PileupAlgos/plugins/PuppiPhoton.cc | 76 +- CommonTools/PileupAlgos/plugins/PuppiPhoton.h | 53 - .../PileupAlgos/plugins/PuppiProducer.cc | 141 +- .../PileupAlgos/plugins/PuppiProducer.h | 82 - CommonTools/PileupAlgos/python/Puppi_cff.py | 13 +- .../test/recomputePuppiOnMiniAOD.py | 141 + .../RecoAlgos/interface/GsfElectronSelector.h | 23 +- .../interface/PrimaryVertexAssignment.h | 53 +- .../plugins/CaloJetShallowCloneProducer.cc | 8 - .../plugins/CaloMETShallowCloneProducer.cc | 10 - .../plugins/ElectronShallowCloneProducer.cc | 9 - .../EtaPtMinGsfElectronFullCloneSelector.cc | 2 +- ...nPixelMatchGsfElectronFullCloneSelector.cc | 2 +- .../plugins/GenJetShallowCloneProducer.cc | 8 - .../plugins/GenMETShallowCloneProducer.cc | 9 - .../GsfElectronShallowCloneProducer.cc | 9 - .../plugins/LargestEtCaloJetSelector.cc | 4 +- .../plugins/LargestEtPFJetSelector.cc | 5 +- .../plugins/MuonShallowCloneProducer.cc | 9 - .../RecoAlgos/plugins/PrimaryVertexSorter.cc | 2 + .../RecoAlgos/plugins/PrimaryVertexSorter.h | 21 + .../plugins/ShallowCloneProducer.cc} | 36 +- .../python}/primaryVertexAssociation_cfi.py | 0 .../python/sortedPFPrimaryVertices_cfi.py | 11 +- .../python/sortedPackedPrimaryVertices_cfi.py | 15 + .../python/sortedPrimaryVertices_cfi.py | 8 + .../RecoAlgos/src/PrimaryVertexAssignment.cc | 81 +- .../UtilAlgos/interface/NullPostProcessor.h | 6 +- .../UtilAlgos/interface/ObjectCountFilter.h | 4 - .../UtilAlgos/interface/ObjectSelector.h | 68 +- .../UtilAlgos/interface/ObjectSelectorBase.h | 81 + .../interface/ObjectSelectorStream.h | 41 - .../interface/ObjectSelectorStreamProducer.h | 2 +- .../interface/SingleObjectRefSelector.h | 6 +- .../interface/SingleObjectSelector.h | 36 +- .../UtilAlgos/interface/StoreManagerTrait.h | 2 +- CommonTools/Utils/test/testDynArray.cpp | 4 +- .../TrackerAlignment_PayloadInspector.cc | 8 +- .../testTrackerAlignmentPayloadInspector.cpp | 4 +- .../BeamSpotPayloadInspectorHelper.h | 47 +- .../BeamSpotOnline_PayloadInspector.cc | 131 +- .../test/testBeamSpotPayloadInspector.cpp | 6 +- CondCore/CTPPSPlugins/src/plugin.cc | 6 + CondCore/CondDB/interface/ConnectionPool.h | 2 + CondCore/CondDB/python/CondDB_cfi.py | 1 + CondCore/CondDB/src/ConnectionPool.cc | 4 + .../interface/OnlineDBOutputService.h | 13 +- .../interface/PoolDBOutputService.h | 108 +- .../src/OnlineDBOutputService.cc | 4 +- .../src/PoolDBOutputService.cc | 2 - .../test/stubs/IOVPayloadEndOfJob.cc | 4 +- .../test/stubs/LumiBasedUpdateAnalyzer.cc | 2 +- .../DBOutputService/test/stubs/Timestamp.cc | 2 +- .../interface/DTCompactMapPluginHandler.h | 1 - .../interface/DTConfigPluginHandler.h | 1 - .../AlCaRecoTriggerBits_PayloadInspector.cc | 64 +- CondCore/HLTPlugins/test/test.sh | 15 +- ...estAlCaRecoTriggerBitsPayloadInspector.cpp | 4 +- CondCore/PopCon/interface/PopCon.h | 61 +- CondCore/PopCon/interface/PopConAnalyzer.h | 4 +- .../PopCon/interface/PopConSourceHandler.h | 85 +- .../test/testRunInfoPayloadInspector.cpp | 4 +- .../interface/SiPixelGainCalibHelper.h | 4 +- .../interface/SiPixelTemplateHelper.h | 5 +- ...xelFEDChannelContainer_PayloadInspector.cc | 2 +- .../test/testSiPixelPayloadInspector.cpp | 34 +- .../SiStripApvGain_PayloadInspector.cc | 4 +- .../plugins/SiStripNoises_PayloadInspector.cc | 6 +- .../SiStripPedestals_PayloadInspector.cc | 4 +- .../test/testSiStripPayloadInspector.cpp | 25 +- CondCore/Utilities/bin/conddb_test_read.cpp | 2 +- .../Utilities/interface/Payload2XMLModule.h | 11 + CondCore/Utilities/plugins/Module_2XML.cc | 3 + .../Utilities/python/CondDBFW/command_line.py | 6 +- .../Utilities/python/CondDBFW/data_formats.py | 17 +- .../Utilities/python/CondDBFW/data_sources.py | 28 +- CondCore/Utilities/python/CondDBFW/models.py | 119 +- .../Utilities/python/CondDBFW/querying.py | 827 +-- CondCore/Utilities/python/CondDBFW/shell.py | 2 - .../python/CondDBFW/uploadConditions.py | 484 +- CondCore/Utilities/python/CondDBFW/uploads.py | 155 +- .../Utilities/python/CondDBFW/url_query.py | 37 +- CondCore/Utilities/python/CondDBFW/utils.py | 4 +- CondCore/Utilities/python/cond2xml.py | 4 + CondCore/Utilities/python/o2olib.py | 4 +- CondCore/Utilities/scripts/conddb | 37 +- CondCore/Utilities/src/CondDBFetch.cc | 6 +- CondCore/Utilities/src/CondDBImport.cc | 2 + CondCore/Utilities/src/CondFormats.h | 2 + CondCore/Utilities/test/testPngHistograms.cpp | 2 +- .../interface/BeamSpotOnlineObjects.h | 76 +- .../src/BeamSpotOnlineObjects.cc | 82 + .../interface/CSCL1TPLookupTableCCLUT.h | 30 + .../interface/CSCL1TPLookupTableME11ILT.h | 156 + .../interface/CSCL1TPLookupTableME21ILT.h | 85 + .../CSCObjects/src/CSCL1TPLookupTableCCLUT.cc | 18 + .../src/CSCL1TPLookupTableME11ILT.cc | 321 + .../src/CSCL1TPLookupTableME21ILT.cc | 143 + .../T_EventSetup_CSCL1TPLookupTableCCLUT.cc | 4 + .../T_EventSetup_CSCL1TPLookupTableME11ILT.cc | 4 + .../T_EventSetup_CSCL1TPLookupTableME21ILT.cc | 4 + CondFormats/CSCObjects/src/classes_def.xml | 13 +- CondFormats/CSCObjects/src/headers.h | 3 + .../test/testSerializationCSCObjects.cpp | 3 + .../CastorObjects/interface/AllClasses.h | 16 - CondFormats/Common/interface/Constants.h | 16 - ...PPSRPAlignmentCorrectionsDataRcd_prep.json | 9 + ...PPSRPAlignmentCorrectionsDataRcd_prod.json | 9 + .../PPSTimingCalibrationRcd_Sampic_prep.json | 9 + .../PPSTimingCalibrationRcd_Sampic_prod.json | 9 + .../test/PPSTimingCalibrationRcd_prep.json | 9 + .../test/PPSTimingCalibrationRcd_prod.json | 9 + .../Common/test/ProduceDropBoxMetadata.py | 52 +- .../SiPixelLorentzAngleRcd_multirun_prep.json | 9 + .../SiPixelLorentzAngleRcd_multirun_prod.json | 9 + .../test/SiPixelLorentzAngleRcd_prep.json | 9 + .../test/SiPixelLorentzAngleRcd_prod.json | 9 + .../interface/CSCL1TPLookupTableCCLUTRcd.h | 6 + .../interface/CSCL1TPLookupTableME11ILTRcd.h | 6 + .../interface/CSCL1TPLookupTableME21ILTRcd.h | 6 + .../interface/PPSAlignmentConfigurationRcd.h | 15 + .../interface/PPSAssociationCutsRcd.h | 8 + .../interface/SiStripBadChannelRcd.h | 1 - .../DataRecord/interface/SiStripBadFiberRcd.h | 1 - .../interface/SiStripBadModuleRcd.h | 1 - .../DataRecord/interface/SiStripModuleHVRcd.h | 1 - .../interface/SiStripPerformanceSummaryRcd.h | 1 - .../interface/SiStripRunSummaryRcd.h | 1 - .../src/CSCL1TPLookupTableCCLUTRcd.cc | 4 + .../src/CSCL1TPLookupTableME11ILTRcd.cc | 4 + .../src/CSCL1TPLookupTableME21ILTRcd.cc | 4 + .../src/PPSAlignmentConfigurationRcd.cc | 10 + .../DataRecord/src/PPSAssociationCutsRcd.cc | 4 + CondFormats/EcalObjects/src/EcalTPGTPMode.cc | 1 - .../interface/HcalChannelQualityGPU.h | 37 + .../HcalObjects/interface/HcalItemArrayColl.h | 101 - .../interface/HcalItemArrayCollById.h | 161 - .../HcalObjects/src/HcalChannelQualityGPU.cc | 39 + .../interface/L1TMuonOverlapParams.h | 18 +- CondFormats/MFObjects/src/MagFieldConfig.cc | 5 +- .../MFObjects/test/MagFieldConfigDBWriter.cc | 4 +- .../interface/PPSAlignmentConfiguration.h | 199 + .../PPSObjects/interface/PPSAssociationCuts.h | 85 + .../src/PPSAlignmentConfiguration.cc | 263 + .../PPSObjects/src/PPSAssociationCuts.cc | 130 + .../PPSObjects/src/PPSPixelTopology.cc | 11 +- .../T_EventSetup_PPSAlignmentConfiguration.cc | 4 + .../src/T_EventSetup_PPSAssociationCuts.cc | 4 + CondFormats/PPSObjects/src/classes_def.xml | 19 +- CondFormats/PPSObjects/src/headers.h | 2 + CondFormats/PPSObjects/test/BuildFile.xml | 8 + ...tSerializationPPSAlignmentConfiguration.cc | 17 + .../testSerializationPPSAssociationCuts.cc | 10 + .../test/SiStripDeDx2DBuilder.cc | 2 +- .../test/SiStripDeDx3DBuilder.cc | 2 +- .../test/SiStripDeDxMipBuilder.h | 2 +- .../eos/polymorphic_portable_archive.hpp | 35 - .../interface/eos/portable_archive.hpp | 35 - .../eos/portable_archive_exception.hpp | 3 +- .../interface/MapPathTodetUnit.h | 0 CondFormats/SiPixelObjects/src/SiPixelVCal.cc | 2 + .../SiPixelTransient/interface/SiPixelUtils.h | 24 +- .../SiPixelTransient/src/SiPixelUtils.cc | 85 +- .../SiStripObjects/src/SiStripDetSummary.cc | 1 - .../plugins/BeamSpotOnlineHLTRcdReader.cc | 202 - .../plugins/BeamSpotOnlineHLTRcdWriter.cc | 234 - .../plugins/BeamSpotOnlineLegacyRcdWriter.cc | 234 - ...ader.cc => BeamSpotOnlineRecordsReader.cc} | 116 +- .../plugins/BeamSpotOnlineRecordsWriter.cc | 237 + .../BeamSpot/plugins/BeamSpotRcdReader.cc | 27 +- CondTools/BeamSpot/plugins/BuildFile.xml | 3 +- .../test/BeamSpotOnlineHLTRcdReader_cfg.py | 68 - .../test/BeamSpotOnlineHLTRcdWriter_cfg.py | 44 - .../test/BeamSpotOnlineLegacyRcdWriter_cfg.py | 44 - ....py => BeamSpotOnlineRecordsReader_cfg.py} | 58 +- .../test/BeamSpotOnlineRecordsWriter_cfg.py | 77 + .../BeamSpot/test/BeamSpotRcdPrinter_cfg.py | 31 +- CondTools/BeamSpot/test/BuildFile.xml | 6 + .../test/testReadWriteOnlineBSFromDB.cpp | 2 + .../test/testReadWriteOnlineBSFromDB.sh | 34 + ...RetrieveCTPPSRPAlignmentCorrectionsData.cc | 43 + .../RetrievePPSAlignmentConfiguration.cc | 43 + .../plugins/RetrievePPSAssociationCuts.cc | 42 + .../plugins/WritePPSAlignmentConfiguration.cc | 51 + .../CTPPS/plugins/WritePPSAssociationCuts.cc | 51 + CondTools/CTPPS/test/BuildFile.xml | 1 + .../retrieve_PPSAlignmentConfiguration_cfg.py | 52 + .../test/retrieve_PPSAssociationCuts_cfg.py | 53 + CondTools/CTPPS/test/test_CondToolsCTPPS.sh | 5 + .../write_PPSAlignmentConfiguration_cfg.py | 90 + .../test/write_PPSAssociationCuts_cfg.py | 67 + ...MReferenceHistogramRootFileSourceHandler.h | 27 - CondTools/DQM/plugins/BuildFile.xml | 13 - ...enceHistogramRootFileEventSetupAnalyzer.cc | 98 - ...eferenceHistogramRootFilePopConAnalyzer.cc | 8 - ...otFileEventSetupAnalyzer_OrcoffOnly_cfi.py | 22 - ...otFileEventSetupAnalyzer_SQLiteOnly_cfi.py | 22 - ...HistogramRootFileEventSetupAnalyzer_cfi.py | 24 - ...ReferenceHistogramRootFileSourceHandler.cc | 76 - ...otFileEventSetupAnalyzer_OrcoffOnly_cfg.py | 24 - ...otFileEventSetupAnalyzer_SQLiteOnly_cfg.py | 24 - ...HistogramRootFileEventSetupAnalyzer_cfg.py | 26 - .../test/DQMReferenceHistogramRootFileTest.py | 47 - ...QMReferenceHistogramRootFile_PopCon_cfg.py | 48 - .../test/DQMXMLFileEventSetupAnalyzer_cfg.py | 21 - CondTools/DT/plugins/DTKeyedConfigDBDump.cc | 66 +- CondTools/DT/plugins/DTKeyedConfigDBDump.h | 54 - CondTools/DT/plugins/DTKeyedConfigDBInit.h | 4 +- .../DT/plugins/DTKeyedConfigPopConAnalyzer.cc | 16 +- .../DTUserKeyedConfigPopConAnalyzer.cc | 14 +- CondTools/DT/test/stubs/DTGeometryDump.cc | 8 +- CondTools/DT/test/stubs/DTGeometryDump.h | 3 + CondTools/DT/test/stubs/DTHVDump.cc | 8 +- CondTools/DT/test/stubs/DTHVDump.h | 4 +- .../validate/DTCCBConfigValidateDBRead.cc | 9 +- .../test/validate/DTCCBConfigValidateDBRead.h | 6 +- .../test/validate/DTCompMapValidateDBRead.cc | 9 +- .../test/validate/DTCompMapValidateDBRead.h | 3 + .../test/validate/DTDeadFlagValidateDBRead.cc | 9 +- .../test/validate/DTDeadFlagValidateDBRead.h | 4 +- .../test/validate/DTHVStatusValidateDBRead.cc | 9 +- .../test/validate/DTHVStatusValidateDBRead.h | 4 +- .../test/validate/DTLVStatusValidateDBRead.cc | 9 +- .../test/validate/DTLVStatusValidateDBRead.h | 3 + .../DT/test/validate/DTMtimeValidateDBRead.cc | 15 +- .../DT/test/validate/DTMtimeValidateDBRead.h | 6 + .../validate/DTPerformanceValidateDBRead.cc | 9 +- .../validate/DTPerformanceValidateDBRead.h | 3 + .../DT/test/validate/DTROMapValidateDBRead.cc | 9 +- .../DT/test/validate/DTROMapValidateDBRead.h | 4 + .../test/validate/DTRangeT0ValidateDBRead.cc | 9 +- .../test/validate/DTRangeT0ValidateDBRead.h | 4 + .../validate/DTStatusFlagValidateDBRead.cc | 9 +- .../validate/DTStatusFlagValidateDBRead.h | 3 + .../DT/test/validate/DTT0ValidateDBRead.cc | 9 +- .../DT/test/validate/DTT0ValidateDBRead.h | 3 + .../validate/DTTPGParametersValidateDBRead.cc | 9 +- .../validate/DTTPGParametersValidateDBRead.h | 3 + .../DT/test/validate/DTTtrigValidateDBRead.cc | 9 +- .../DT/test/validate/DTTtrigValidateDBRead.h | 3 + CondTools/Ecal/interface/ESDBCopy.h | 32 +- CondTools/Ecal/interface/EcalDBCopy.h | 118 +- CondTools/Ecal/interface/EcalGetLaserData.h | 28 +- .../EcalIntercalibConstantsHandler.h | 17 - .../EcalIntercalibConstantsMCHandler.h | 18 - .../interface/EcalIntercalibErrorsHandler.h | 23 - .../EcalIntercalibErrorsXMLTranslator.h | 17 - .../interface/EcalPFRecHitThresholdsMaker.h | 18 +- .../EcalPFRecHitThresholdsXMLTranslator.h | 17 - .../interface/EcalTimeCalibConstantsHandler.h | 18 - .../EcalTimeCalibConstantsXMLTranslator.h | 19 - .../interface/EcalTimeCalibErrorsHandler.h | 18 - .../EcalTimeCalibErrorsXMLTranslator.h | 19 - .../plugins/TestEcalChannelStatusAnalyzer.cc | 8 +- CondTools/Ecal/src/ESDBCopy.cc | 94 +- CondTools/Ecal/src/EcalDBCopy.cc | 298 +- CondTools/Ecal/src/EcalGetLaserData.cc | 126 +- .../Ecal/src/EcalPFRecHitThresholdsMaker.cc | 118 +- .../Ecal/src/EcalTPGOddWeightIdMapHandler.cc | 120 +- CondTools/Ecal/src/EcalTPGTPModeHandler.cc | 139 +- .../test/EcalIntercalibConstants_O2O_test.sh | 2 +- CondTools/Ecal/test/testXMLTranslators.cc | 472 -- .../Geometry/plugins/CSCRecoIdealDBLoader.cc | 16 +- .../Geometry/plugins/DTRecoIdealDBLoader.cc | 16 +- .../Geometry/plugins/GEMRecoIdealDBLoader.cc | 17 +- .../plugins/HcalParametersDBBuilder.cc | 10 +- .../Geometry/plugins/ME0RecoIdealDBLoader.cc | 16 +- .../Geometry/plugins/PCaloGeometryBuilder.cc | 65 +- .../Geometry/plugins/PGeometricDetBuilder.cc | 16 +- .../plugins/PHGCalParametersDBBuilder.cc | 11 +- .../plugins/PTrackerParametersDBBuilder.cc | 10 +- .../Geometry/plugins/RPCRecoIdealDBLoader.cc | 16 +- .../Geometry/plugins/XMLGeometryReader.cc | 5 +- CondTools/L1Trigger/interface/Interval.h | 104 - .../interface/L1ConfigOnlineProdBase.h | 22 +- .../interface/L1ObjectKeysOnlineProdBase.h | 1 + .../L1Trigger/plugins/L1CondDBIOVWriter.cc | 5 +- .../L1Trigger/plugins/L1CondDBIOVWriter.h | 9 +- .../plugins/L1CondDBPayloadWriter.cc | 7 +- .../L1Trigger/plugins/L1CondDBPayloadWriter.h | 8 +- .../plugins/L1GtRunSettingsViewer.cc | 4 +- .../L1Trigger/plugins/L1O2OTestAnalyzer.cc | 75 +- .../plugins/L1TriggerKeyOnlineProd.cc | 14 +- .../plugins/L1TriggerKeyOnlineProd.h | 4 + .../src/L1ObjectKeysOnlineProdBase.cc | 5 +- .../plugins/L1CondDBIOVWriterExt.cc | 4 +- .../plugins/L1CondDBIOVWriterExt.h | 9 +- .../plugins/L1CondDBPayloadWriterExt.h | 4 +- .../plugins/L1O2OTestAnalyzerExt.cc | 51 +- .../RPC/interface/L1RPCHwConfigDBWriter.h | 18 - CondTools/RPC/interface/RPCEMapDBWriter.h | 18 - .../RunInfo/interface/BTransitionAnalyzer.h | 22 +- .../interface/LHCInfoPopConSourceHandler.h | 1 - .../RunInfo/plugins/FillInfoESAnalyzer.cc | 41 +- .../RunInfo/plugins/LHCInfoESAnalyzer.cc | 39 +- .../RunInfo/plugins/RunInfoESAnalyzer.cc | 69 +- .../RunInfo/plugins/RunSummaryESAnalyzer.cc | 64 +- .../RunInfo/plugins/XangleBetaStarFilter.cc | 5 +- .../src/FillInfoPopConSourceHandler.cc | 3 +- .../RunInfo/src/LHCInfoPopConSourceHandler.cc | 27 +- CondTools/RunInfo/src/RunInfoRead.cc | 30 +- CondTools/RunInfo/src/RunSummaryHandler.cc | 1 - CondTools/SiPhase2Tracker/test/BuildFile.xml | 1 + .../test/DTCCablingMapProducer_write.py | 2 +- .../test/test_CondToolsSiPhase2Tracker.sh | 15 + CondTools/SiPixel/plugins/BuildFile.xml | 10 + .../SiPixel/plugins/PixelDCSObjectReader.cc | 6 + .../{test => plugins}/PixelDCSObjectReader.h | 20 +- .../plugins/PixelPopConCalibChecker.cc | 159 + .../PixelPopConCalibChecker.h | 20 +- .../SiPixel2DTemplateDBObjectReader.cc | 177 +- .../SiPixel2DTemplateDBObjectUploader.cc | 128 +- .../SiPixelBadModuleByHandBuilder.cc | 10 +- .../SiPixelBadModuleByHandBuilder.h | 16 +- .../SiPixelBadModuleReader.cc | 51 +- .../SiPixel/plugins/SiPixelBadModuleReader.h | 56 + .../SiPixelCalibConfigurationObjectMaker.cc | 16 +- .../SiPixelCalibConfigurationReadDb.cc | 69 +- .../SiPixelCondObjAllPayloadsReader.cc | 13 +- .../SiPixelCondObjAllPayloadsReader.h | 9 +- .../SiPixelCondObjBuilder.cc | 27 +- .../{test => plugins}/SiPixelCondObjBuilder.h | 12 +- .../SiPixelCondObjForHLTBuilder.cc | 34 +- .../SiPixelCondObjForHLTBuilder.h | 21 +- .../SiPixelCondObjForHLTReader.cc | 49 +- .../SiPixelCondObjForHLTReader.h | 9 +- .../SiPixelCondObjOfflineBuilder.cc | 28 +- .../SiPixelCondObjOfflineBuilder.h | 9 +- .../SiPixelCondObjOfflineReader.cc | 54 +- .../SiPixelCondObjOfflineReader.h | 10 +- .../{test => plugins}/SiPixelCondObjReader.cc | 56 +- .../{test => plugins}/SiPixelCondObjReader.h | 12 +- .../SiPixelDynamicInefficiencyDB.cc | 64 +- .../SiPixelDynamicInefficiencyDB.h | 23 +- .../SiPixelDynamicInefficiencyReader.cc | 61 +- .../SiPixelDynamicInefficiencyReader.h | 19 +- .../SiPixelFakeGenErrorDBSourceReader.cc | 48 + .../SiPixelFakeTemplateDBSourceReader.cc | 48 + .../SiPixelGainCalibScaler.cc | 18 +- .../SiPixelGainCalibrationReadDQMFile.cc | 189 +- .../SiPixelGainCalibrationReadDQMFile.h | 0 ...iPixelGainCalibrationRejectNoisyAndDead.cc | 101 +- ...SiPixelGainCalibrationRejectNoisyAndDead.h | 8 +- .../SiPixelGenErrorDBObjectReader.cc | 190 +- .../SiPixelGenErrorDBObjectUploader.cc | 131 +- .../SiPixelLorentzAngleDB.cc | 55 +- .../{test => plugins}/SiPixelLorentzAngleDB.h | 23 +- .../SiPixelLorentzAngleReader.cc | 30 +- .../SiPixelLorentzAngleReader.h | 16 +- .../SiPixelPerformanceSummaryBuilder.cc | 15 +- .../SiPixelPerformanceSummaryBuilder.h | 13 +- .../SiPixelPerformanceSummaryReader.cc | 14 +- .../plugins/SiPixelPerformanceSummaryReader.h | 28 + .../SiPixelTemplateDBObjectReader.cc | 150 +- .../SiPixelTemplateDBObjectUploader.cc | 140 +- .../{test => plugins}/SiPixelVCalDB.cc | 36 +- .../SiPixel/{test => plugins}/SiPixelVCalDB.h | 21 +- .../{test => plugins}/SiPixelVCalReader.cc | 49 +- .../{test => plugins}/SiPixelVCalReader.h | 35 +- CondTools/SiPixel/test/BuildFile.xml | 14 - .../SiPixel/test/PixelPopConCalibChecker.cc | 173 - CondTools/SiPixel/test/SealModules.cc | 88 - .../test/SiPixel2DTemplateDBObjectReader.h | 41 - .../test/SiPixel2DTemplateDBObjectUploader.h | 41 - ...el2DTemplateDBObjectUploader_Phase2_cfg.py | 2 +- .../SiPixel2DTemplateDBObjectUploader_cfg.py | 140 +- .../SiPixel/test/SiPixelBadModuleReader.h | 41 - .../test/SiPixelBadModuleReader_cfg.py | 15 +- .../test/SiPixelCPEGenericErrorParmReader.cc | 38 - .../test/SiPixelCPEGenericErrorParmReader.h | 29 - .../SiPixelCPEGenericErrorParmReader_cfg.py | 37 - .../SiPixelCPEGenericErrorParmUploader.cc | 39 - .../test/SiPixelCPEGenericErrorParmUploader.h | 27 - .../SiPixelCPEGenericErrorParmUploader_cfg.py | 41 - .../test/SiPixelCondObjForHLTBuilder_cfg.py | 2 +- .../test/SiPixelCondObjForHLTReader_cfg.py | 2 +- .../test/SiPixelCondObjOfflineBuilder_cfg.py | 2 +- .../test/SiPixelCondObjOfflineReader_cfg.py | 2 +- .../SiPixel/test/SiPixelCondObjReader_cfg.py | 2 +- .../test/SiPixelDynamicInefficiencyDB_cfg.py | 5 +- ...ixelFakeCPEGenericErrorParmSourceReader.cc | 25 - ...PixelFakeCPEGenericErrorParmSourceReader.h | 30 - ...FakeCPEGenericErrorParmSourceReader_cfg.py | 22 - .../test/SiPixelFakeGenErrorDBSourceReader.cc | 23 - .../test/SiPixelFakeGenErrorDBSourceReader.h | 30 - .../test/SiPixelFakeTemplateDBSourceReader.cc | 23 - .../test/SiPixelFakeTemplateDBSourceReader.h | 30 - .../test/SiPixelGainCalibScaler_cfg.py | 3 +- .../SiPixelGainCalibrationReadDQMFile_cfg.py | 2 +- ...elGainCalibrationRejectNoisyAndDead_cfg.py | 2 +- .../test/SiPixelGenErrorDBObjectReader.h | 39 - .../test/SiPixelGenErrorDBObjectUploader.h | 41 - ...ixelGenErrorDBObjectUploader_Phase2_cfg.py | 2 +- .../SiPixelGenErrorDBObjectUploader_cfg.py | 2 +- .../SiPixel/test/SiPixelLorentzAngleDB_cfg.py | 30 +- .../test/SiPixelPerformanceSummaryReader.h | 25 - .../test/SiPixelTemplateDBObjectReader.h | 41 - .../test/SiPixelTemplateDBObjectUploader.h | 41 - ...ixelTemplateDBObjectUploader_Phase2_cfg.py | 2 +- .../SiPixelTemplateDBObjectUploader_cfg.py | 2 +- CondTools/SiPixel/test/createTestDBObjects.sh | 37 + .../interface/SiStripCondObjBuilderBase.h | 30 - .../interface/SiStripDepCondObjBuilderBase.h | 30 - .../SiStrip/plugins/SiStripApvGainBuilder.h | 2 +- .../SiStrip/plugins/SiStripApvGainReader.cc | 4 +- .../SiStrip/plugins/SiStripApvGainReader.h | 6 +- .../SiStripApvSimulationParametersBuilder.cc | 8 +- .../plugins/SiStripBadChannelBuilder.cc | 6 +- .../SiStrip/plugins/SiStripBadStripReader.cc | 6 +- .../plugins/SiStripCablingTrackerMap.cc | 7 +- .../plugins/SiStripCablingTrackerMap.h | 12 +- .../plugins/SiStripDetVOffFakeBuilder.h | 4 +- .../SiStrip/plugins/SiStripDetVOffReader.cc | 2 - .../SiStrip/plugins/SiStripDetVOffReader.h | 6 +- .../plugins/SiStripFedCablingBuilder.h | 10 +- .../SiStrip/plugins/SiStripFedCablingReader.h | 11 +- .../plugins/SiStripLorentzAngleReader.cc | 1 - .../plugins/SiStripLorentzAngleReader.h | 6 +- .../SiStrip/plugins/SiStripNoisesBuilder.h | 2 +- .../SiStrip/plugins/SiStripNoisesReader.h | 4 +- .../SiStrip/plugins/SiStripPedestalsBuilder.h | 2 +- .../SiStrip/plugins/SiStripPedestalsReader.cc | 2 - .../SiStrip/plugins/SiStripPedestalsReader.h | 6 +- .../SiStrip/plugins/SiStripSummaryBuilder.h | 2 +- .../SiStrip/plugins/SiStripSummaryReader.cc | 2 - .../SiStrip/plugins/SiStripSummaryReader.h | 6 +- .../SiStrip/plugins/SiStripThresholdBuilder.h | 2 +- .../SiStrip/plugins/SiStripThresholdReader.cc | 2 - .../SiStrip/plugins/SiStripThresholdReader.h | 6 +- .../test/SiStripDetVOffFakeBuilder_cfg.py | 2 +- .../test/SiStripFedCablingBuilder_cfg.py | 2 +- .../test/SiStripFedCablingReader_cfg.py | 2 +- Configuration/AlCa/python/autoAlca.py | 10 +- Configuration/AlCa/python/autoCond.py | 80 +- .../AlCa/python/autoCondModifiers.py | 41 + Configuration/AlCa/python/autoPCL.py | 9 +- .../Applications/python/ConfigBuilder.py | 22 +- Configuration/Applications/python/Options.py | 3 +- .../Applications/python/cmsDriverOptions.py | 7 - .../DataProcessing/python/RecoTLR.py | 5 + .../DataProcessing/test/run_CfgTest.sh | 6 + .../Eras/python/Era_Phase2C11I13T27M9_cff.py | 7 + Configuration/Eras/python/Era_Phase2_cff.py | 4 +- .../Eras/python/Era_Run2_2017_cff.py | 3 +- .../Eras/python/Era_Run2_2017_ppRef_cff.py | 3 +- .../python/Era_Run2_2017_pp_on_XeXe_cff.py | 3 +- .../Eras/python/Era_Run2_2018_pp_on_AA_cff.py | 3 +- .../Eras/python/Era_Run3_noMkFit_cff.py | 6 + .../Eras/python/Era_Run3_pp_on_PbPb_cff.py | 4 +- ...rChain_run2_2017_noTrackingModifier_cff.py | 3 +- .../ModifierChain_trackingMkFitProd_cff.py | 20 + .../Modifier_phase2_brickedPixels_cff.py | 3 + .../python/Modifier_run3_nanoAOD_devel_cff.py | 3 + .../EventContent/python/AlCaRecoOutput_cff.py | 9 +- ..._mN1-150_HT60_TuneCP5_13TeV_pythia8_cfi.py | 276 + .../python/concurrentLumisDisable.py | 17 + ...tbar_2j_MENLOPS_13TeV_MASTER_ExtGen_cff.py | 6 +- Configuration/Geometry/README.md | 57 +- ...pExtended2021FlatMinus05PercentReco_cff.py | 1 - ...pExtended2021FlatMinus10PercentReco_cff.py | 1 - ...epExtended2021FlatPlus05PercentReco_cff.py | 1 - ...epExtended2021FlatPlus10PercentReco_cff.py | 1 - .../GeometryDD4hepExtended2021Reco_cff.py | 1 - ...yDD4hepExtended2021ZeroMaterialReco_cff.py | 1 - .../Geometry/python/GeometryDDDSimDB_cff.py | 10 +- ...yExtended2021FlatMinus05PercentReco_cff.py | 1 - ...yExtended2021FlatMinus10PercentReco_cff.py | 1 - ...ryExtended2021FlatPlus05PercentReco_cff.py | 1 - ...ryExtended2021FlatPlus10PercentReco_cff.py | 1 - .../python/GeometryExtended2021Reco_cff.py | 1 - ...eometryExtended2021ZeroMaterialReco_cff.py | 1 - .../Geometry/python/dict2021Geometry.py | 1132 +--- .../Geometry/python/dict2026Geometry.py | 4 +- Configuration/HLT/python/addOnTestsHLT.py | 14 +- Configuration/PyReleaseValidation/README.md | 16 +- .../python/MatrixInjector.py | 38 +- .../PyReleaseValidation/python/relval_2017.py | 11 +- .../PyReleaseValidation/python/relval_gpu.py | 8 + .../python/relval_pileup.py | 2 +- .../python/relval_production.py | 3 +- .../python/relval_standard.py | 7 +- .../python/relval_steps.py | 100 +- .../python/relval_upgrade.py | 8 +- .../python/upgradeWorkflowComponents.py | 189 +- .../scripts/runTheMatrix.py | 481 +- .../Skimming/interface/LeptonRecoSkim.h | 32 +- Configuration/Skimming/src/LeptonRecoSkim.cc | 82 +- Configuration/Skimming/src/LeptonSkimming.cc | 4 +- .../python/AlCaHarvesting_cff.py | 28 +- .../python/AlCaRecoStreams_cff.py | 81 +- .../StandardSequences/python/Eras.py | 10 +- .../python/L1TrackTrigger_cff.py | 2 - .../StandardSequences/python/Mixing.py | 1 + .../python/Reconstruction_cff.py | 2 +- .../StandardSequences/python/Services_cff.py | 4 +- .../HcalTools/interface/CMTRawAnalyzer.h | 487 -- .../HcalTools/{ => plugins}/BuildFile.xml | 3 + .../{src => plugins}/CMTRawAnalyzer.cc | 5552 +++++++---------- .../remoteMonitoring_LED_eraTEST2019_cfg.py | 4 + DPGAnalysis/Skims/interface/BeamSplash.h | 4 +- DPGAnalysis/Skims/interface/CSCSkim.h | 7 +- DPGAnalysis/Skims/interface/ECALActivity.h | 4 +- DPGAnalysis/Skims/interface/EcalSkim.h | 4 +- .../Skims/interface/EcalTangentFilter.h | 14 +- .../Skims/interface/FilterOutScraping.h | 4 +- .../FilterScrapingPixelProbability.h | 4 +- DPGAnalysis/Skims/interface/HLTInspect.h | 4 +- .../Skims/interface/MatchedProbeMaker.h | 4 +- DPGAnalysis/Skims/interface/MuonPtFilter.h | 4 +- DPGAnalysis/Skims/interface/PhysDecl.h | 4 +- DPGAnalysis/Skims/interface/SelectHFMinBias.h | 7 +- .../Skims/interface/TagProbeMassEDMFilter.h | 4 +- .../Skims/interface/TagProbeMassProducer.h | 6 +- DPGAnalysis/Skims/src/CSCSkim.cc | 5 +- DPGAnalysis/Skims/src/DetStatus.cc | 15 +- DPGAnalysis/Skims/src/EcalTangentFilter.cc | 6 - DPGAnalysis/Skims/src/HCALHighEnergyFilter.cc | 12 +- DPGAnalysis/Skims/src/HcalHPDFilter.cc | 20 +- DPGAnalysis/Skims/src/NMaxPerLumi.cc | 12 +- DPGAnalysis/Skims/src/PickEvents.cc | 4 +- DPGAnalysis/Skims/src/RPCNoise.cc | 4 +- DPGAnalysis/Skims/src/RPCRecHitFilter.cc | 32 +- DPGAnalysis/Skims/src/RPCRecHitFilter.h | 14 +- DPGAnalysis/Skims/src/RecHitEnergyFilter.cc | 12 +- .../Skims/src/SecondaryVertexFilter.cc | 4 +- DPGAnalysis/Skims/src/SelectHFMinBias.cc | 2 - DPGAnalysis/Skims/src/SimpleJetFilter.cc | 20 +- DPGAnalysis/Skims/src/TagProbeMassProducer.cc | 6 - .../Skims/src/WZInterestingEventSelector.cc | 4 +- DQM/BeamMonitor/plugins/BeamMonitor.cc | 40 +- DQM/BeamMonitor/plugins/BeamMonitor.h | 2 + DQM/BeamMonitor/plugins/BeamSpotDipServer.cc | 775 +++ DQM/BeamMonitor/plugins/BeamSpotDipServer.h | 151 + DQM/BeamMonitor/plugins/BuildFile.xml | 9 + DQM/BeamMonitor/plugins/FakeBeamMonitor.cc | 49 +- DQM/BeamMonitor/plugins/FakeBeamMonitor.h | 1 + .../python/AlcaBeamMonitorHeavyIons_cff.py | 5 + DQM/BeamMonitor/python/AlcaBeamMonitor_cff.py | 5 + .../python/BeamSpotDipServer_cff.py | 25 + .../beamspotdip_dqm_sourceclient-file_cfg.py | 58 + DQM/BeamMonitor/test/log4cplus.properties | 14 + DQM/CTPPS/plugins/BuildFile.xml | 2 + DQM/CTPPS/plugins/CTPPSCommonDQMSource.cc | 151 +- DQM/CTPPS/plugins/CTPPSDiamondDQMSource.cc | 1136 ++-- .../DiamondSampicCalibrationDQMSource.cc | 300 + DQM/CTPPS/plugins/DiamondSampicDQMSource.cc | 759 +++ DQM/CTPPS/python/ctppsDQM_cff.py | 25 +- DQM/CTPPS/python/ctppsDiamondDQMSource_cfi.py | 49 +- .../python/diamondSampicDQMSource_cfi.py | 28 + DQM/CTPPS/test/diamond_dqm_test_cfg.py | 48 +- .../src/DTLocalTriggerSynchTask.cc | 4 +- DQM/EcalCommon/data/readEcalDQMStatus.py | 43 - DQM/EcalCommon/data/writeEcalDQMStatus.py | 30 +- DQM/EcalCommon/python/CommonParams_cfi.py | 8 +- .../interface/EcalDQMStatusWriter.h | 13 +- .../plugins/EcalDQMStatusWriter.cc | 17 +- .../interface/OccupancyTask.h | 1 - DQM/EcalMonitorTasks/src/OccupancyTask.cc | 4 +- DQM/EcalMonitorTasks/src/RawDataTask.cc | 9 + DQM/GEM/plugins/GEMDAQStatusSource.cc | 6 +- DQM/HcalCommon/interface/Constants.h | 22 +- DQM/HcalCommon/interface/DQModule.h | 3 +- DQM/HcalCommon/interface/DQTask.h | 1 + DQM/HcalCommon/interface/HcalCommonHeaders.h | 1 - DQM/HcalCommon/src/DQClient.cc | 1 + DQM/HcalCommon/src/DQModule.cc | 9 +- DQM/HcalCommon/src/DQTask.cc | 7 + DQM/HcalCommon/src/HashFunctions.cc | 11 +- DQM/HcalCommon/src/Utilities.cc | 39 +- DQM/HcalTasks/interface/QIE11Task.h | 11 +- DQM/HcalTasks/plugins/PedestalTask.cc | 4 +- DQM/HcalTasks/plugins/QIE11Task.cc | 20 + DQM/HcalTasks/plugins/RawTask.cc | 4 +- DQM/HcalTasks/python/QIE10Task.py | 3 + DQM/HcalTasks/python/QIE11Task.py | 3 + .../clients/beam_dqm_sourceclient-live_cfg.py | 2 +- .../beamfake_dqm_sourceclient-live_cfg.py | 5 + .../beamhlt_dqm_sourceclient-live_cfg.py | 2 +- .../beamhltfake_dqm_sourceclient-live_cfg.py | 5 + .../beampixel_dqm_sourceclient-live_cfg.py | 2 +- .../beamspotdip_dqm_sourceclient-live_cfg.py | 34 + .../castor_dqm_sourceclient-live_cfg.py | 3 + .../clients/csc_dqm_sourceclient-live_cfg.py | 2 + .../ctpps_dqm_sourceclient-live_cfg.py | 5 +- .../dt4ml_dqm_sourceclient-live_cfg.py | 1 + .../clients/dt_dqm_sourceclient-live_cfg.py | 1 + .../clients/ecal_dqm_sourceclient-live_cfg.py | 1 + .../ecalcalib_dqm_sourceclient-live_cfg.py | 1 + .../clients/es_dqm_sourceclient-live_cfg.py | 1 + .../clients/fed_dqm_sourceclient-live_cfg.py | 1 + .../clients/gem_dqm_sourceclient-live_cfg.py | 1 + .../clients/hcal_dqm_sourceclient-live_cfg.py | 6 +- .../hcalcalib_dqm_sourceclient-live_cfg.py | 4 +- .../hcalreco_dqm_sourceclient-live_cfg.py | 8 +- .../clients/hlt_dqm_clientPB-live_cfg.py | 4 +- .../clients/hlt_dqm_sourceclient-live_cfg.py | 1 + .../clients/info_dqm_sourceclient-live_cfg.py | 1 + .../l1tstage2_dqm_sourceclient-live_cfg.py | 2 +- ...tage2emulator_dqm_sourceclient-live_cfg.py | 1 + .../mutracking_dqm_sourceclient-live_cfg.py | 3 +- ...nebeammonitor_dqm_sourceclient-live_cfg.py | 2 +- .../pixel_dqm_sourceclient-live_cfg.py | 4 + .../pixellumi_dqm_sourceclient-live_cfg.py | 3 +- .../clients/rpc_dqm_sourceclient-live_cfg.py | 3 + .../clients/scal_dqm_sourceclient-live_cfg.py | 1 + .../sistrip_dqm_sourceclient-live_cfg.py | 12 +- .../visualization-live-secondInstance_cfg.py | 12 +- .../python/clients/visualization-live_cfg.py | 12 +- .../python/config/inputsource_cfi.py | 22 +- DQM/Integration/python/config/pbsource_cfi.py | 17 +- .../python/config/unittestinputsource_cfi.py | 6 +- .../scripts/filecollector/commonAnTS.py | 4 +- .../scripts/filecollector/fileCollector.py | 4 +- .../filecollector/producerFileCleanner.py | 2 +- .../scripts/filecollector/visDQMSyncDaemon | 12 +- .../scripts/harvesting_tools/cmsHarvester.py | 35 - DQM/Integration/scripts/igfilemgr/igmerge | 12 +- DQM/Integration/scripts/igfilemgr/zipmerge | 4 +- DQM/Integration/test/BuildFile.xml | 5 +- DQM/L1TMonitor/interface/L1ExtraDQM.h | 1 - DQM/L1TMonitor/interface/L1TdeCSCTPG.h | 7 +- .../python/L1TStage2Emulator_cff.py | 8 +- DQM/L1TMonitor/python/L1TdeCSCTPG_cfi.py | 4 +- DQM/L1TMonitor/src/L1TdeCSCTPG.cc | 120 +- .../interface/L1TdeCSCTPGClient.h | 5 +- DQM/L1TMonitorClient/src/L1TdeCSCTPGClient.cc | 37 +- DQM/Physics/BuildFile.xml | 1 - .../python/SiPixelOfflineDQM_client_cff.py | 2 +- .../python/SiPixelOfflineDQM_source_cff.py | 13 +- .../python/RefitterForPixelDQM.py | 7 +- .../python/HistogramManager_cfi.py | 20 +- .../SiPixelPhase1OfflineDQM_harvesting_cff.py | 4 +- .../SiPixelPhase1OfflineDQM_source_cff.py | 55 +- .../SiPixelPhase1OnlineDQM_Timing_cff.py | 52 +- .../python/SiPixelPhase1OnlineDQM_cff.py | 38 +- .../plugins/SiPixelPhase1EfficiencyExtras.cc | 238 + .../SiPixelPhase1EfficiencyExtras_cfi.py | 9 + .../python/SiPixelPhase1RecHits_cfi.py | 3 +- .../python/SiPixelPhase1TrackClusters_cfi.py | 3 +- .../SiPixelPhase1TrackEfficiency_cfi.py | 21 +- .../python/SiPixelPhase1TrackResiduals_cfi.py | 3 +- .../python/SiStripOfflineCRack_cfg.py | 7 +- .../python/SiStripOfflineP5_cfg.py | 7 +- .../python/SiStripOnlineCRack_cfg.py | 7 +- .../python/SiStripOnlineP5NoOutput_cfg.py | 7 +- .../python/SiStripOnlineP5_cfg.py | 7 +- .../src/PedsFullNoiseTask.cc | 2 - DQM/SiStripMonitorClient/bin/ls_cert.cc | 4 +- .../plugins/SiStripOfflineDQM.cc | 9 +- .../SiStripClientConfigP5_Cosmic_cff.py | 10 +- .../SiStripClientConfigP5_HeavyIons_cff.py | 10 +- .../python/SiStripClientConfigP5_cff.py | 11 +- .../SiStripClientConfig_Tier0_Cosmic_cff.py | 12 +- ...SiStripClientConfig_Tier0_HeavyIons_cff.py | 11 +- .../python/SiStripClientConfig_Tier0_cff.py | 11 +- .../python/SiStripClientConfig_cff.py | 10 +- ...ripDQMRecoConfigOfflineGlobalRunCAF_cfi.py | 21 +- ...pDQMSourceConfigOfflineGlobalRunCAF_cfi.py | 81 +- .../python/SiStripSourceConfigHVOff_cff.py | 179 +- .../python/SiStripSourceConfigP5_cff.py | 155 +- .../SiStripSourceConfigTier0_Cosmic_cff.py | 58 +- .../SiStripSourceConfigTier0_HeavyIons_cff.py | 18 +- .../python/SiStripSourceConfigTier0_cff.py | 135 +- .../python/SiStripSourceConfig_cff.py | 105 +- .../src/SiStripQualityChecker.cc | 2 +- .../src/SiStripTrackerMapCreator.cc | 3 + DQM/SiStripMonitorClient/test/BuildFile.xml | 4 + DQM/SiStripMonitorClient/test/TestDriver.cpp | 2 + .../test/test_SiStripDQM_OfflineTkMap.sh | 14 + .../python/SiStripMonitorClusterAlca_cfi.py | 467 +- .../python/SiStripMonitorCluster_cfi.py | 18 +- .../python/OnDemandMonitoring_cfi.py | 15 +- .../python/SiStripMonitorCommon_cfi.py | 14 + .../SiStripMonitorCondDataOffline_cfi.py | 22 +- ...StripMonitorCondDataOnDemandExample_cfi.py | 18 +- .../python/SiStripMonitorCondData_cfi.py | 22 +- .../scripts/TemplateCfg21X_PedNoise_cfg.py | 62 +- .../scripts/TemplateCfg21X_Quality_cfg.py | 62 +- .../src/SiStripClassToMonitorCondData.cc | 20 +- .../python/Phase2TrackerMonitorDigi_cff.py | 178 +- .../python/MonitorTrackResiduals_cff.py | 25 +- .../test/monitortrackresiduals_cfg.py | 26 +- .../interface/Phase1PixelMaps.h | 2 +- DQM/TrackerRemapper/src/Phase1PixelMaps.cc | 8 +- DQM/TrackerRemapper/src/Phase1PixelROCMaps.cc | 4 + .../src/Phase1PixelSummaryMap.cc | 3 +- ...ClientTrackEfficiencySTACosmicMuons_cff.py | 9 +- .../ClientTrackEfficiencyTkTracks_cff.py | 9 +- .../python/LogMessageMonitor_cff.py | 187 +- ...onitorTrackEfficiencySTACosmicMuons_cff.py | 14 +- .../MonitorTrackEfficiencyTkTracks_cff.py | 13 +- .../python/MonitorTrackGLBCosmicMuons_cfi.py | 23 +- .../python/MonitorTrackGLBMuons_cfi.py | 41 +- .../python/MonitorTrackInnerTrackMuons_cff.py | 84 +- .../MonitorTrackSTACosmicMuonsHLT_cff.py | 18 +- .../python/MonitorTrackSTACosmicMuons_cff.py | 56 +- .../python/MonitorTrackSTACosmicMuons_cfi.py | 10 +- .../python/MonitorTrackSTAMuons_cfi.py | 652 +- .../python/MonitorTrackTKCosmicMuons_cfi.py | 24 +- .../python/TrackFoldedOccupancyClient_cfi.py | 18 +- .../TrackerCollisionTrackingMonitor_cfi.py | 159 +- .../TrackerCosmicsTrackingMonitor_cfi.py | 58 +- .../TrackerHeavyIonTrackingMonitor_cfi.py | 74 +- ...TrackingMonitorAllTrackingSequences_cff.py | 130 +- .../python/TrackingMonitorSeedNumber_cff.py | 219 +- .../python/TrackingMonitorSeed_cfi.py | 60 +- DQM/TrackingMonitor/python/V0Monitor_cff.py | 195 +- .../python/dEdxAnalyzer_cff.py | 28 +- .../src/TrackingRecoMaterialAnalyser.cc | 1 - .../TrackingClientConfig_Tier0_Cosmic_cff.py | 12 +- .../python/TrackingClientConfig_Tier0_cff.py | 11 +- .../python/TrackingDQMClientHeavyIons_cfi.py | 6 +- ...fFromHitPatternClientConfigZeroBias_cff.py | 8 +- .../python/V0MonitoringClient_cff.py | 22 +- .../python/V0MonitoringClient_cfi.py | 19 +- .../python/LogMessageMonitor_cff.py | 12 +- .../python/TrackCollections2monitor_cff.py | 111 +- .../TrackerCollisionTrackingMonitor_cff.py | 37 +- .../python/TrackingSourceConfigP5_cff.py | 128 +- .../TrackingSourceConfig_Tier0_Cosmic_cff.py | 105 +- ...rackingSourceConfig_Tier0_HeavyIons_cff.py | 11 +- .../python/dEdxAnalyzer_cff.py | 50 +- .../python/dedxHarmonic2monitor_cfi.py | 19 +- .../python/pixelTracksMonitoring_cff.py | 43 +- .../src/TrackToTrackComparisonHists.cc | 2 +- .../SiStripBadComponentsDQMServiceReader.cc | 6 +- DQMOffline/Configuration/python/autoDQM.py | 16 +- DQMOffline/L1Trigger/src/L1TTauOffline.cc | 13 + DQMOffline/Muon/interface/CSCOfflineMonitor.h | 3 + DQMOffline/Muon/src/CSCOfflineMonitor.cc | 87 +- .../Muon/test/DQMOffline_SecondStep_cff.py | 10 +- .../Trigger/plugins/HLTFiltersDQMonitor.cc | 11 +- DQMServices/Components/plugins/DQMProvInfo.cc | 8 +- DQMServices/Components/plugins/DQMProvInfo.h | 14 +- .../Components/scripts/dqmiodatasetharvest.py | 2 +- DQMServices/Components/scripts/root2sqlite.py | 2 +- DQMServices/Core/interface/LegacyIOHelper.h | 30 +- DQMServices/Core/src/LegacyIOHelper.cc | 102 + .../FileIO/scripts/compareHistograms.py | 100 +- .../StreamerIO/plugins/DQMStreamerReader.cc | 18 +- .../StreamerIO/scripts/esMonitoring.py | 3 +- DQMServices/StreamerIO/scripts/ztee.py | 2 +- .../BTauReco/interface/PFCombinedTauTagInfo.h | 192 - .../BTauReco/interface/PFIsolatedTauTagInfo.h | 147 - .../TemplatedSecondaryVertexTagInfo.h | 14 +- DataFormats/BTauReco/interface/TrackIPData.h | 23 - DataFormats/BTauReco/src/classes_def.xml | 3 +- .../CTPPSReco/interface/CTPPSPixelRecHit.h | 16 +- DataFormats/CaloTowers/interface/CaloTower.h | 4 +- DataFormats/Common/interface/IDVectorMap.h | 1 + DataFormats/Common/interface/NewPolicy.h | 13 - DataFormats/Common/interface/OwnArray.h | 506 -- .../Common/interface/TransientDataFrame.h | 51 - .../Common/interface/debugging_allocator.h | 80 - .../interface/getThinned_implementation.h | 1 + DataFormats/Common/test/OwnArray_t.cpp | 188 - DataFormats/Common/test/testOwnArray.cc | 139 - .../EcalDigi/interface/EcalMatacqDigi.h | 9 +- DataFormats/EcalDigi/src/classes_def.xml | 3 +- .../EgammaCandidates/interface/GsfElectron.h | 27 +- .../EgammaCandidates/interface/Photon.h | 12 +- .../EgammaCandidates/src/classes_def.xml | 6 +- DataFormats/FEDRawData/src/FEDHeader.cc | 4 +- .../interface/private/extTkRotation.h | 368 +- .../interface/private/newTkRotation.h | 366 -- .../GeometryVector/interface/OnePiRange.h | 133 - .../interface/private/extBasic2DVector.h | 178 +- DataFormats/HGCalReco/interface/Trackster.h | 1 - .../interface/HcalHBHEMuonVariables.h | 97 + .../interface/HcalIsoTrkCalibVariables.h | 58 + .../interface/HcalIsoTrkEventVariables.h | 28 + DataFormats/HcalCalibObjects/src/classes.h | 4 +- .../HcalCalibObjects/src/classes_def.xml | 19 + DataFormats/L1THGCal/BuildFile.xml | 1 - DataFormats/L1TrackTrigger/BuildFile.xml | 1 + .../L1TrackTrigger/interface/TTTrack.h | 25 +- .../interface/TTTrack_TrackWord.h | 88 +- .../L1TrackTrigger/src/TTTrack_TrackWord.cc | 50 +- DataFormats/L1TrackTrigger/test/BuildFile.xml | 10 + .../test/TestDataFormatsTTTrackTrackWord.cc | 31 + .../testDataFormatsTTTrackTrackWord_cfg.py | 14 + .../interface/PFClusterMETCollection.h | 23 - DataFormats/Math/interface/SSEArray.h | 111 - DataFormats/Math/interface/libminifloat.h | 107 +- DataFormats/Math/interface/private/AVXVec.h | 156 +- DataFormats/OnlineMetaData/src/DCSRecord.cc | 2 +- .../interface/PFCandidate.h | 45 +- .../ParticleFlowCandidate/src/PFCandidate.cc | 50 +- .../ParticleFlowCandidate/src/classes_def.xml | 9 +- .../interface/PFBlockElementFwd.h | 15 - .../interface/PFBlockElementSuperClusterFwd.h | 11 - .../interface/PFClusterShapeAssociation.h | 31 - .../interface/PFParticleFwd.h | 27 - .../interface/PFSuperClusterFwd.h | 27 - .../interface/PFTrajectoryPointFwd.h | 27 - .../PatCandidates/src/classes_def_objects.xml | 3 +- .../interface/BranchDescriptionIndex.h | 31 - .../Provenance/interface/TypeInBranchType.h | 62 - .../RPCDigi/interface/RPCDigiL1Linkfwd.h | 4 - DataFormats/SiPixelDetId/README.md | 23 +- .../interface/PixelChannelIdentifier.h | 29 +- .../interface/PixelDigiCollectionfwd.h | 4 - .../interface/ConstantsForSummaryPlots.h | 10 - .../SiStripDigi/interface/SiStripDigifwd.h | 4 - DataFormats/TrackReco/interface/HitPattern.h | 25 +- DataFormats/TrackReco/src/HitPattern.cc | 22 +- .../interface/SiPixelRecHitfwd.h | 4 - .../interface/BasicTrajectorySeed.h | 9 - .../DDCMS/plugins/DDCMSDetector.cc | 13 +- .../DDCMS/plugins/DDDetectorESProducer.cc | 3 + .../DDCMS/plugins/test/DDTestCompactView.cc | 7 +- .../DDCMS/plugins/test/DDTestDumpFile.cc | 7 +- .../DDCMS/plugins/test/DDTestDumpGeometry.cc | 6 +- .../DDCMS/plugins/test/DDTestFilteredView.cc | 7 +- .../DDCMS/plugins/test/DDTestSpecPars.cc | 19 +- .../plugins/test/DDTestSpecParsFilter.cc | 5 +- .../DDCMS/plugins/test/DDTestVectors.cc | 19 +- DetectorDescription/DDCMS/src/DDNamespace.cc | 33 +- .../src/DDCoreToDDXMLOutput.cc | 80 +- .../CalibratedElectronProducersRun2.cc | 8 +- .../plugins/EGammaCutBasedEleIdAnalyzer.cc | 11 +- .../plugins/ElectronIdMVAProducer.cc | 12 +- .../ElectronIsolatorFromEffectiveArea.cc | 4 +- .../plugins/ElectronPATIdMVAProducer.cc | 4 +- .../ElectronRegressionEnergyProducer.cc | 21 +- .../plugins/GBRForestGetterFromDB.cc | 13 +- .../PatElectronEAIsoCorrectionProducer.cc | 4 +- .../plugins/PhotonIsoProducer.cc | 23 +- .../RegressionEnergyPatElectronProducer.cc | 35 +- .../RegressionEnergyPatElectronProducer.h | 9 +- .../CSCTFRawToDigi/interface/CSCTFAnalyzer.h | 44 - .../CSCTFRawToDigi/interface/CSCTFPacker.h | 44 - .../CSCTFRawToDigi/interface/CSCTFUnpacker.h | 47 - .../CSCTFRawToDigi/plugins/CSCTFAnalyzer.cc | 48 +- .../CSCTFRawToDigi/plugins/CSCTFPacker.cc | 44 +- .../CSCTFRawToDigi/plugins/CSCTFUnpacker.cc | 46 +- .../CSCTFRawToDigi/plugins/SealModule.cc | 8 - .../interface/CTPPSPixelDataFormatter.h | 10 +- .../interface/CTPPSPixelRawToDigi.h | 1 + .../interface/TotemSampicFrame.h | 86 +- .../plugins/CTPPSPixelDigiToRaw.cc | 21 +- .../plugins/CTPPSPixelRawToDigi.cc | 4 +- .../python/ctppsRawToDigi_cff.py | 5 + .../src/CTPPSPixelDataFormatter.cc | 65 +- .../test/test_pixels_only_cfg_eraRun3_562.py | 82 + .../DTRawToDigi/interface/DTROS25Data.h | 61 - .../ESRawToDigi/interface/ESCrcKchipFast.h | 50 - .../EcalRawToDigi/interface/DCCEBSRPBlock.h | 2 - .../EcalRawToDigi/interface/DCCEESRPBlock.h | 2 - .../EcalRawToDigi/interface/DCCTCCBlock.h | 1 - .../interface/ECALUnpackerException.h | 32 - .../interface/EcalElectronicsMapper.h | 4 +- .../EcalRawToDigi/interface/MatacqProducer.h | 319 - .../EcalRawToDigi/interface/MyWatcher.h | 43 - .../plugins/EcalCPUDigisProducer.cc | 1 - .../EcalRawToDigi/plugins/EcalDumpRaw.cc | 3 + .../EcalRawToDigi/plugins/EcalRawToDigi.cc | 110 +- .../EcalRawToDigi/plugins/EcalRawToDigi.h | 107 - .../plugins/EcalRegionCablingESProducer.cc | 47 +- .../plugins/EcalRegionCablingESProducer.h | 46 - .../EcalRawToDigi/plugins/MatacqProducer.cc | 321 +- .../EcalRawToDigi/plugins/SealModules.cc | 14 - .../EcalRawToDigi/src/DCCEESRPBlock.cc | 2 +- .../EcalRawToDigi/src/MatacqDataFormatter.cc | 1 - .../plugins/GEMRawToDigiModule.cc | 8 +- .../BMTFPackerOutput.cc | 2 +- .../BMTFUnpackerOutput.cc | 2 +- .../implementations_stage2/EMTFBlockGEM.cc | 11 +- .../implementations_stage2/GMTSetup.cc | 10 +- .../RegionalMuonGMTPacker.cc | 2 +- .../RegionalMuonGMTPacker.h | 6 +- .../RegionalMuonGMTUnpacker.cc | 2 +- .../RegionalMuonGMTUnpacker.h | 6 +- .../L1TRawToDigi/python/gmtStage2Raw_cfi.py | 4 +- EventFilter/L1TRawToDigi/src/MP7FileReader.cc | 9 +- EventFilter/L1TXRawToDigi/test/BuildFile.xml | 1 + .../RPCRawToDigi/interface/RPCRawSynchro.h | 1 - .../plugins/RPCUnpackingModule.cc | 6 +- .../RPCRawToDigi/plugins/RPCUnpackingModule.h | 2 + .../python/RPCCPPFRawToDigi_cfi.py | 14 +- .../Utilities/interface/AuxiliaryMakers.h | 3 +- .../Utilities/interface/EvFDaqDirector.h | 3 +- .../interface/FedRawDataInputSource.h | 2 +- EventFilter/Utilities/interface/ModuleWeb.h | 51 - EventFilter/Utilities/interface/config_json.h | 43 - .../Utilities/plugins/DaqFakeReader.cc | 33 + EventFilter/Utilities/plugins/DaqFakeReader.h | 4 + EventFilter/Utilities/src/AuxiliaryMakers.cc | 5 +- EventFilter/Utilities/src/EvFDaqDirector.cc | 95 +- .../Utilities/src/FedRawDataInputSource.cc | 24 +- EventFilter/Utilities/test/LocalRunBUFU.sh | 2 +- EventFilter/Utilities/test/startBU.py | 1 + EventFilter/Utilities/test/unittest_FU.py | 2 +- .../test/streamGrapher_stallMonitor_cfg.py | 5 +- FWCore/Framework/interface/Callback.h | 7 +- FWCore/Framework/interface/EDAnalyzer.h | 3 +- FWCore/Framework/interface/EDFilter.h | 3 +- FWCore/Framework/interface/EDProducer.h | 3 +- FWCore/Framework/interface/EventProcessor.h | 2 +- FWCore/Framework/interface/EventSetup.h | 10 +- FWCore/Framework/interface/EventSetupRecord.h | 50 +- FWCore/Framework/interface/maker/Worker.h | 4 +- FWCore/Framework/src/EventProcessor.cc | 68 +- FWCore/Framework/src/EventSelector.cc | 8 +- FWCore/Framework/src/NoRecordException.cc | 4 +- FWCore/Framework/src/Worker.cc | 56 +- FWCore/Framework/src/exceptionContext.cc | 30 + FWCore/Framework/test/BuildFile.xml | 1 + .../test/run_module_synch_lumiboundary.sh | 9 + .../test/stubs/DeleteEarlyModules.cc | 18 +- .../Framework/test/stubs/HistoryAnalyzer.cc | 4 +- .../test/stubs/RunLumiEventAnalyzer.h | 4 +- .../Framework/test/stubs/TestMergeResults.cc | 87 +- FWCore/Framework/test/stubs/TestMod.cc | 8 +- .../test/stubs/TestSchedulerModule1.cc | 8 +- .../test/stubs/TestSchedulerModule2.cc | 8 +- FWCore/Framework/test/stubs/ToyAnalyzers.cc | 29 +- .../test/stubs/ToyDoubleProducers.cc | 9 +- .../Framework/test/stubs/ToyIntProducers.cc | 2 +- .../Framework/test/stubs/ToySTLProducers.cc | 40 +- .../test/test_mayConsumes_deadlocking_cfg.py | 9 +- .../test_module_synch_lumiboundary_cfg.py | 10 + .../test/test_no_concurrent_module_cfg.py | 9 +- FWCore/Framework/test/test_one_modules_cfg.py | 12 +- FWCore/Integration/test/ESTestAnalyzers.cc | 75 +- FWCore/Integration/test/HistProducer.cc | 5 +- FWCore/Integration/test/HistProducer.h | 8 +- .../Integration/test/ManyProductProducer.cc | 24 +- FWCore/Integration/test/PathAnalyzer.cc | 14 +- .../Integration/test/ProducerWithPSetDesc.cc | 22 +- .../Integration/test/ProducerWithPSetDesc.h | 8 +- .../Integration/test/TestGetterOfProducts.cc | 15 +- FWCore/Integration/test/TestHistoryKeeping.cc | 13 +- FWCore/Integration/test/TestPSetAnalyzer.cc | 23 +- FWCore/Integration/test/TestParentage.cc | 19 +- .../Integration/test/ThinningThingProducer.cc | 6 +- .../test/UseValueExampleAnalyzer.cc | 16 +- FWCore/Integration/test/WhatsItAnalyzer.cc | 39 +- .../test/WhatsItWatcherAnalyzer.cc | 23 +- .../test/testRunMergeMERGE2_cfg.py | 13 +- .../test/testRunMergeMERGE4_cfg.py | 12 +- .../Integration/test/testRunMergeMERGE_cfg.py | 16 +- .../test/testSubProcessEventSetup_cfg.py | 12 +- .../unit_test_outputs/testConsumesInfo_1.log | 5 - .../test/unit_test_outputs/testGetBy1.log | 13 - .../test/unit_test_outputs/testGetBy2.log | 13 - .../testProducerWithPsetDesc_briefdoc.txt | 31 +- .../testProducerWithPsetDesc_cfi.py | 11 + .../testProducerWithPsetDesc_doc.txt | 76 +- .../testSubProcessEventSetup1.grep.txt | 98 +- .../MessageLogger/python/MessageLogger_cfi.py | 4 +- .../python/MessageLogger_cfi.py | 92 +- .../MessageService/test/MLexampleModule_1.cc | 5 +- .../MessageService/test/MLexampleModule_1.h | 8 +- .../MessageService/test/MemoryTestClient_A.cc | 1 + .../MessageService/test/MemoryTestClient_A.h | 4 +- .../test/MessageLoggerClient.cc | 5 +- .../MessageService/test/MessageLoggerClient.h | 8 +- .../MessageService/test/PSetTestClient_A.cc | 5 +- FWCore/MessageService/test/PSetTestClient_A.h | 7 +- .../test/ProblemTestClient_t1.cc | 5 +- .../test/ProblemTestClient_t1.h | 8 +- .../test/UnitTestClient_SLumi.h | 23 +- .../MessageService/test/fmt_test.cppunit.cpp | 6 +- FWCore/MessageService/test/makeSignals.cc | 4 +- FWCore/MessageService/test/makeSignals.h | 8 +- FWCore/Modules/src/AbortOnEventIDAnalyzer.cc | 10 +- FWCore/Modules/src/EventContentAnalyzer.cc | 4 +- .../src/EventSetupCacheIdentifierChecker.cc | 9 +- .../interface/PluginDescription.h | 30 +- FWCore/ParameterSet/python/Config.py | 172 +- FWCore/ParameterSet/python/MessageLogger.py | 93 + FWCore/ParameterSet/python/SequenceTypes.py | 20 + FWCore/ParameterSet/python/Types.py | 4 +- FWCore/PluginManager/src/PluginFactoryBase.cc | 7 +- .../test/makeprocess_t.cppunit.cc | 58 +- .../interface/ActivityRegistry.h | 226 - .../interface/ModuleCallingContext.h | 4 + .../interface/TypeInfoHolder.h | 45 - .../src/ModuleCallingContext.cc | 54 + .../Services/plugins/CondorStatusUpdater.cc | 1 + FWCore/Services/plugins/InitRootHandlers.cc | 18 +- FWCore/Services/plugins/StallMonitor.cc | 2 +- .../test/SiteLocalConfigServiceTester.cc | 8 +- FWCore/Utilities/interface/bit_cast.h | 36 + FWCore/Utilities/interface/deprecated_macro.h | 8 + FWCore/Utilities/interface/getAnyPtr.h | 14 +- .../CaloGeometryTools/src/CaloPoint.cc | 2 + .../interface/CalorimetryManager.h | 9 +- .../Calorimetry/src/CalorimetryManager.cc | 9 +- FastSimulation/EventProducer/BuildFile.xml | 20 - .../EventProducer/interface/FamosManager.h | 68 - .../EventProducer/interface/FamosProducer.h | 33 - .../EventProducer/python/FamosSimHits_cff.py | 51 - .../EventProducer/src/FamosManager.cc | 159 - .../EventProducer/src/FamosProducer.cc | 118 - .../test/CastorTowerProducerTest_cfg.py | 80 - .../plugins/MuonSimHitProducer.cc | 38 +- .../Muons/plugins/FastTSGFromL2Muon.cc | 9 +- .../Muons/plugins/FastTSGFromL2Muon.h | 3 +- .../Muons/plugins/FastTSGFromPropagation.cc | 33 +- .../Muons/plugins/FastTSGFromPropagation.h | 15 +- .../interface/FastHFShowerLibrary.h | 14 +- .../src/FastHFShowerLibrary.cc | 21 +- .../interface/Geometry.h | 19 +- .../plugins/FastSimProducer.cc | 37 +- .../plugins/FastTrackDeDxProducer.cc | 23 +- .../src/Geometry.cc | 27 +- .../Tracking/interface/SeedFinderSelector.h | 29 +- .../Tracking/plugins/PixelTracksProducer.cc | 13 +- .../Tracking/plugins/PixelTracksProducer.h | 11 +- .../plugins/TrackCandidateProducer.cc | 44 +- .../plugins/TrajectorySeedProducer.cc | 14 +- .../Tracking/src/SeedFinderSelector.cc | 47 +- .../interface/TrackerDetIdSelector.h | 42 +- .../interface/TrackingRecHitAlgorithm.h | 15 +- .../plugins/FastTrackerRecHitMatcher.cc | 12 +- .../plugins/TrackingRecHitProducer.cc | 32 +- .../src/TrackerDetIdSelector.cc | 58 +- .../src/TrackingRecHitAlgorithm.cc | 21 +- .../interface/LocalMagneticField.h | 2 +- .../src/LocalMagneticField.cc | 2 +- FastSimulation/Utilities/BuildFile.xml | 1 - Fireworks/Calo/plugins/BuildFile.xml | 1 + .../plugins/FWTracksterHitsProxyBuilder.cc | 291 +- .../plugins/FWTracksterLayersProxyBuilder.cc | 191 +- Fireworks/Core/src/FW3DViewBase.cc | 6 +- Fireworks/Core/src/FW3DViewGeometry.cc | 34 +- Fireworks/Core/src/FWGeometry.cc | 18 +- .../Core/src/FWGeometryTableManagerBase.cc | 7 +- Fireworks/Eve/plugins/DummyEvelyser.cc | 12 +- Fireworks/FWInterface/interface/FWFFLooper.h | 9 + Fireworks/FWInterface/interface/FWFFService.h | 81 - Fireworks/FWInterface/plugins/FullFWPlugin.cc | 2 - Fireworks/FWInterface/src/FWFFLooper.cc | 20 +- Fireworks/FWInterface/src/FWFFService.cc | 300 - Fireworks/Geometry/BuildFile.xml | 1 + .../Geometry/interface/DisplayPluginFactory.h | 3 +- .../Geometry/interface/TGeoFromDddService.h | 85 - Fireworks/Geometry/plugins/DisplayGeom.cc | 26 +- .../Geometry/plugins/DumpFWRecoGeometry.cc | 11 +- .../plugins/DumpFWTGeoRecoGeometry.cc | 13 +- Fireworks/Geometry/plugins/DumpSimGeometry.cc | 10 +- .../Geometry/plugins/EveDisplayPlugin.cc | 10 +- Fireworks/Geometry/plugins/MFProducer.cc | 9 +- .../Geometry/plugins/ValidateGeometry.cc | 32 +- .../Geometry/src/FWRecoGeometryESProducer.cc | 19 + Fireworks/Geometry/src/TGeoFromDddService.cc | 492 -- .../AMPTInterface/src/AMPTHadronizer.cc | 2 - .../Core/bin/externalGenerator.cc | 54 +- .../Core/interface/GeneratorFilter.h | 3 +- .../Core/interface/HadronizerFilter.h | 3 +- .../interface/PythiaHepMCFilterGammaGamma.h | 1 - .../Core/plugins/ExternalGeneratorFilter.cc | 9 +- .../Core/python/ExternalGeneratorFilter.py | 2 +- GeneratorInterface/Core/test/BuildFile.xml | 9 + .../Core/test/FailingGeneratorFilter.cc | 128 + .../Core/test/test_FailingGeneratorFilter.sh | 47 + .../test/test_FailingGeneratorFilter_cfg.py | 27 + .../EvtGenInterface/test/BuildFile.xml | 2 + .../test/external_Py8_bplus_evtgen1_cfg.py | 179 + .../interface/ExternalDecayDriver.h | 3 +- .../ExternalDecays/src/ExternalDecayDriver.cc | 5 +- .../plugins/BetaBoostEvtVtxGenerator.cc | 137 +- .../HiGenCommon/plugins/GenHIEventProducer.cc | 70 +- .../HijingInterface/src/HijingHadronizer.cc | 2 - .../Hydjet2Interface/src/Hydjet2Hadronizer.cc | 1 - .../HydjetInterface/src/HydjetHadronizer.cc | 2 - .../LHEInterface/src/LHEReader.cc | 1 + .../LHEInterface/src/XMLUtils.cc | 1 + .../LHEInterface/src/XMLUtils.h | 6 +- .../Pythia6Interface/plugins/Pythia6EGun.cc | 1 - .../Pythia6Interface/plugins/Pythia6Gun.cc | 4 +- .../Pythia6Interface/plugins/Pythia6Gun.h | 6 +- .../Pythia6Interface/plugins/Pythia6JetGun.cc | 1 - .../plugins/Pythia6PartonEGun.cc | 1 - .../plugins/Pythia6PartonPtGun.cc | 1 - .../Pythia6Interface/plugins/Pythia6PtGun.cc | 1 - .../plugins/Pythia6PtYDistGun.cc | 1 - .../Pythia6Interface/test/BasicGenTester.cc | 10 +- .../Pythia6Interface/test/TauPhotonTester.cc | 23 +- ...compare_external_generators_streams_cfg.py | 1 + .../SherpaInterface/src/SherpaHadronizer.cc | 15 +- .../interface/TauSpinnerFilter.h | 4 +- .../TauolaInterface/interface/TauolaFactory.h | 4 +- .../TauolaInterface/interface/TauolaWrapper.h | 105 - .../interface/TauolappInterface.h | 4 +- .../plugins/Tauolapp/TauolappInterface.cc | 8 +- .../data/dd4hep/cmsExtendedGeometry2021.xml | 20 +- ...ExtendedGeometry2021FlatMinus05Percent.xml | 20 +- ...ExtendedGeometry2021FlatMinus10Percent.xml | 20 +- ...sExtendedGeometry2021FlatPlus05Percent.xml | 20 +- ...sExtendedGeometry2021FlatPlus10Percent.xml | 20 +- .../cmsExtendedGeometry2021ZeroMaterial.xml | 20 +- .../dd4hep/cmsExtendedGeometry2026D86.xml | 2 +- ...edGeometry2021FlatMinus05PercentXML_cfi.py | 20 +- ...edGeometry2021FlatMinus10PercentXML_cfi.py | 20 +- ...dedGeometry2021FlatPlus05PercentXML_cfi.py | 20 +- ...dedGeometry2021FlatPlus10PercentXML_cfi.py | 20 +- .../python/cmsExtendedGeometry2021XML_cfi.py | 20 +- ...ExtendedGeometry2021ZeroMaterialXML_cfi.py | 20 +- .../cmsExtendedGeometry2026D86XML_cfi.py | 2 +- .../CommonTopologies/test/ValidateRadial.cc | 1 - .../ectkcablemat/2026/v2/ectkcablemat.xml | 154 + .../plugins/dd4hep/DDEcalEndcapAlgo.cc | 65 +- .../interface/HGCalDDDConstants.h | 12 +- .../HGCalCommonData/src/HGCalDDDConstants.cc | 179 +- .../src/HGCalParametersFromDD.cc | 1 + .../HGCalGeometry/interface/HGCalGeometry.h | 1 + Geometry/HGCalGeometry/src/HGCalGeometry.cc | 61 +- .../HGCalGeometry/src/HGCalGeometryLoader.cc | 2 +- .../test/HGCalGeometryRotCheck.cc | 87 + .../test/HGCalGeometryRotTest.cc | 90 + .../test/HGCalWaferInFileCheck.cc | 46 +- .../test/HGCalWaferInFileOrientation.cc | 132 + .../test/HGCalWaferInFileTest.cc | 88 +- .../python/testHGCalGeometryRotCheck_cfg.py | 39 + .../python/testHGCalGeometryRotTest_cfg.py | 39 + .../python/testHGCalWaferInFileCheck_cfg.py | 10 +- .../testHGCalWaferInFileOrientation_cfg.py | 37 + .../python/hcalDDDSimConstants_cff.py | 2 +- .../python/hcalSimDBConstants_cff.py | 2 - .../HcalCommonData/src/HcalDDDRecConstants.cc | 1 + .../HcalSimData/python/HFParameters_cff.py | 2 +- .../2021/v2/tibmaterial.xml | 326 + .../2021/v2/tibtidcommonmaterial.xml | 486 ++ .../2021/v2/tidmaterial.xml | 259 + .../2021/v2/tobmaterial.xml | 1648 +++++ .../2021/v2/trackermaterial.xml | 582 ++ .../2021/v2/tibmaterial.xml | 326 + .../2021/v2/tibtidcommonmaterial.xml | 486 ++ .../2021/v2/tidmaterial.xml | 259 + .../2021/v2/tobmaterial.xml | 1648 +++++ .../2021/v2/trackermaterial.xml | 582 ++ .../FlatPlus05Percent/2021/v2/tibmaterial.xml | 326 + .../2021/v2/tibtidcommonmaterial.xml | 486 ++ .../FlatPlus05Percent/2021/v2/tidmaterial.xml | 259 + .../FlatPlus05Percent/2021/v2/tobmaterial.xml | 1648 +++++ .../2021/v2/trackermaterial.xml | 582 ++ .../FlatPlus10Percent/2021/v2/tibmaterial.xml | 326 + .../2021/v2/tibtidcommonmaterial.xml | 486 ++ .../FlatPlus10Percent/2021/v2/tidmaterial.xml | 259 + .../FlatPlus10Percent/2021/v2/tobmaterial.xml | 1648 +++++ .../2021/v2/trackermaterial.xml | 582 ++ .../data/tibmaterial/2021/v2/tibmaterial.xml | 326 + .../2021/v2/tibtidcommonmaterial.xml | 486 ++ .../data/tidmaterial/2021/v2/tidmaterial.xml | 259 + .../data/tobmaterial/2021/v2/tobmaterial.xml | 1648 +++++ .../2021/v2/trackermaterial.xml | 582 ++ .../2026/v1/trackermaterial.xml | 563 ++ .../data/zeroMaterial/2021/v2/tibmaterial.xml | 326 + .../2021/v2/tibtidcommonmaterial.xml | 486 ++ .../data/zeroMaterial/2021/v2/tidmaterial.xml | 259 + .../data/zeroMaterial/2021/v2/tobmaterial.xml | 1648 +++++ .../zeroMaterial/2021/v2/trackermaterial.xml | 582 ++ .../plugins/dd4hep/DDCutTubsFromPoints.cc | 3 + .../plugins/dd4hep/DDPixBarLayerAlgo.cc | 95 +- .../dd4hep/DDPixBarLayerUpgradeAlgo.cc | 83 +- .../plugins/dd4hep/DDPixFwdDiskAlgo.cc | 58 +- .../plugins/dd4hep/DDPixPhase1FwdDiskAlgo.cc | 15 +- .../plugins/dd4hep/DDTECCoolAlgo.cc | 17 +- .../plugins/dd4hep/DDTECModuleAlgo.cc | 40 +- .../plugins/dd4hep/DDTECOptoHybAlgo.cc | 18 +- .../plugins/dd4hep/DDTECPhiAlgo.cc | 17 +- .../plugins/dd4hep/DDTECPhiAltAlgo.cc | 17 +- .../plugins/dd4hep/DDTIBLayerAlgo.cc | 165 +- .../plugins/dd4hep/DDTIDAxialCableAlgo.cc | 6 +- .../plugins/dd4hep/DDTIDModuleAlgo.cc | 179 +- .../plugins/dd4hep/DDTIDModulePosAlgo.cc | 64 +- .../plugins/dd4hep/DDTIDRingAlgo.cc | 20 +- .../plugins/dd4hep/DDTOBAxCableAlgo.cc | 66 +- .../plugins/dd4hep/DDTOBRadCableAlgo.cc | 129 +- .../plugins/dd4hep/DDTOBRodAlgo.cc | 138 +- .../plugins/dd4hep/DDTrackerLinear.cc | 15 +- .../plugins/dd4hep/DDTrackerPhiAlgo.cc | 26 +- .../plugins/dd4hep/DDTrackerPhiAltAlgo.cc | 16 +- .../plugins/dd4hep/DDTrackerRingAlgo.cc | 44 +- .../plugins/dd4hep/DDTrackerXYZPosAlgo.cc | 14 +- .../plugins/dd4hep/DDTrackerZPosAlgo.cc | 12 +- ...edGeometry2021FlatMinus05PercentXML_cfi.py | 161 +- ...edGeometry2021FlatMinus10PercentXML_cfi.py | 378 ++ ...dedGeometry2021FlatPlus05PercentXML_cfi.py | 378 ++ ...dedGeometry2021FlatPlus10PercentXML_cfi.py | 381 ++ .../python/cmsExtendedGeometry2021XML_cfi.py | 164 +- ...ExtendedGeometry2021ZeroMaterialXML_cfi.py | 161 +- .../cmsExtendedGeometry2026D77XML_cfi.py | 127 + .../test/python/dd4hepRun3_cfg.py | 171 + .../TrackerCommonData/test/python/run21.py | 53 +- .../test/python/run21Zero.py | 59 +- .../test/python/run21flat.py | 142 + .../interface/phase1PixelTopology.h | 4 + .../test/python/testTrackerHierarchy_cfg.py | 3 + .../python/testTrackerModuleInfoDDD_cfg.py | 2 + .../test/python/testTracker_cfg.py | 3 + .../Stations/Reco/v2/RP_210_Left_Station.xml | 221 + .../Stations/Reco/v2/RP_210_Right_Station.xml | 219 + .../Stations/Reco/v2/RP_220_Left_Station.xml | 154 + .../Stations/Reco/v2/RP_220_Right_Station.xml | 152 + .../v2/CTPPS_Pixel_Assembly_Box_Real_003.xml | 104 + .../v2/CTPPS_Pixel_Assembly_Box_Real_023.xml | 104 + .../v2/CTPPS_Pixel_Assembly_Box_Real_103.xml | 104 + .../v2/CTPPS_Pixel_Assembly_Box_Real_123.xml | 104 + .../Modules/v3/PPS_Pixel_Module_2x2_Run3.xml | 248 + .../v1/CTPPS_Timing_Negative_Station.xml | 64 + .../v1/CTPPS_Timing_Positive_Station.xml | 58 + .../2021/Reco/v2/RP_Horizontal_Device.xml | 53 + .../2021/Reco/v2/RP_Vertical_Device.xml | 48 + .../data/dd4hep/cmsExtendedGeometry2021.xml | 10 +- .../python/cmsExtendedGeometry2021XML_cfi.py | 10 +- .../data/dd4hep/v3/geometryRPFromDD_2021.xml | 127 + .../dd4hep/v3/geometryRPFromDD_2021_cfi.py | 18 + .../python/geometryRPFromDD_2021_cfi.py | 143 +- .../python/geometryRPFromDD_2022_cfi.py | 1 + .../python/v1/geometryRPFromDD_2021_cfi.py | 142 + .../python/v1/geometryRPFromDD_2022_cfi.py | 142 + .../plugins/CTPPSGeometryESModule.cc | 33 +- .../Configuration/python/HLT_FULL_cff.py | 444 +- .../Configuration/python/HLT_Fake1_cff.py | 8 +- .../Configuration/python/HLT_Fake2_cff.py | 8 +- .../Configuration/python/HLT_Fake_cff.py | 8 +- .../Configuration/python/HLT_GRun_cff.py | 406 +- .../Configuration/python/HLT_HIon_cff.py | 394 +- .../Configuration/python/HLT_PIon_cff.py | 355 +- .../Configuration/python/HLT_PRef_cff.py | 374 +- .../python/HLTrigger_Datasets_GRun_cff.py | 2 +- .../python/HLTrigger_Datasets_HIon_cff.py | 2 +- .../python/HLTrigger_Datasets_PIon_cff.py | 2 +- .../python/HLTrigger_Datasets_PRef_cff.py | 2 +- .../Configuration/python/Tools/confdb.py | 22 +- .../python/Tools/confdbOfflineConverter.py | 69 +- .../Configuration/python/Tools/options.py | 20 +- .../python/customizeHLTforCMSSW.py | 32 +- .../python/customizeHLTforPatatrack.py | 101 +- HLTrigger/Configuration/scripts/hltDumpStream | 25 +- .../Configuration/scripts/hltGetConfiguration | 4 +- .../Configuration/scripts/hltIntegrationTests | 11 +- HLTrigger/Configuration/scripts/hltListPaths | 2 +- HLTrigger/Configuration/tables/makeCRAFT | 2 +- HLTrigger/Configuration/tables/makeCRUZET | 2 +- HLTrigger/Configuration/tables/makeOnline0T | 2 +- HLTrigger/Configuration/tables/makeOnlineGRun | 2 +- HLTrigger/Configuration/tables/makeOnlineHIon | 2 +- HLTrigger/Configuration/tables/makeOnlinePIon | 2 +- HLTrigger/Configuration/tables/makeOnlinePRef | 2 +- HLTrigger/Configuration/tables/makeSubTables | 6 +- HLTrigger/Configuration/tables/makeTest | 2 +- HLTrigger/Configuration/tables/subtables.sh | 9 +- .../Configuration/test/OnLine_HLT_FULL.py | 446 +- .../Configuration/test/OnLine_HLT_Fake.py | 8 +- .../Configuration/test/OnLine_HLT_Fake1.py | 8 +- .../Configuration/test/OnLine_HLT_Fake2.py | 8 +- .../Configuration/test/OnLine_HLT_GRun.py | 408 +- .../Configuration/test/OnLine_HLT_HIon.py | 396 +- .../Configuration/test/OnLine_HLT_PIon.py | 357 +- .../Configuration/test/OnLine_HLT_PRef.py | 376 +- HLTrigger/Configuration/test/cmsDriver.csh | 2 +- HLTrigger/Configuration/test/getFrozenHLT.sh | 6 +- HLTrigger/Configuration/test/getHLT.sh | 4 +- .../plugins/TriggerResultsFilter.cc | 11 +- .../HLTfilters/test/triggerResultsFilter.py | 2 +- .../test/triggerResultsFilter_producer.py | 4 +- HLTrigger/Timer/interface/ProcessCallGraph.h | 2 +- HLTrigger/btau/plugins/L3MumuTrackingRegion.h | 21 +- .../special/plugins/HLTHcalCalibTypeFilter.cc | 103 +- .../special/plugins/HLTHcalCalibTypeFilter.h | 59 - .../plugins/HLTRegionalEcalResonanceFilter.cc | 2 + HLTriggerOffline/Egamma/interface/EmDQM.h | 1 - HLTriggerOffline/Egamma/src/EmDQM.cc | 2 +- .../interface/BPHMuonChargeSelect.h | 54 - .../interface/BPHParticleChargeSelect.h | 73 - HeterogeneousCore/CUDAServices/BuildFile.xml | 1 + .../CUDAServices/interface/CUDAService.h | 1 + .../CUDAServices/src/CUDAService.cc | 256 +- .../CUDAServices/test/testCUDAService.py | 9 +- HeterogeneousCore/CUDAUtilities/BuildFile.xml | 1 + .../CUDAUtilities/interface/nvmlCheck.h | 54 + .../SonicTriton/interface/TritonService.h | 9 +- .../SonicTriton/scripts/cmsTriton | 125 +- .../SonicTriton/src/TritonService.cc | 7 +- .../SonicTriton/test/tritonTest_cfg.py | 3 + .../SonicTriton/test/unittest.sh | 28 +- .../src/BeamProfile2DB.cc | 3 +- .../interface/BaseFlatGunProducer.h | 2 + .../interface/BaseRandomtXiGunProducer.h | 2 + .../interface/FlatBaseThetaGunProducer.h | 2 + IOMC/ParticleGuns/src/BaseFlatGunProducer.cc | 5 +- .../src/BaseRandomtXiGunProducer.cc | 5 +- .../src/FlatBaseThetaGunProducer.cc | 7 +- IOPool/Common/bin/EdmCopyUtil.cpp | 4 +- IOPool/Common/interface/CustomStreamer.h | 58 - IOPool/Input/src/RootPrimaryFileSequence.cc | 2 +- IOPool/Input/src/RootSecondaryFileSequence.cc | 2 +- .../SecondaryInput/test/SecondaryProducer.h | 10 +- IOPool/Streamer/interface/StreamerInputFile.h | 6 +- IOPool/Streamer/src/StreamerInputFile.cc | 15 +- IOPool/Streamer/test/StreamThingAnalyzer.h | 4 +- IOPool/Streamer/test/StreamThingProducer.cc | 2 +- IOPool/Streamer/test/StreamThingProducer.h | 6 +- .../interface/TStorageFactoryFile.h | 6 +- IOPool/TFileAdaptor/src/ReadRepacker.cc | 2 +- IOPool/TFileAdaptor/src/ReadRepacker.h | 8 +- IOPool/TFileAdaptor/src/TFileAdaptor.cc | 5 +- .../TFileAdaptor/src/TStorageFactoryFile.cc | 2 + .../TFileAdaptor/src/TStorageFactorySystem.cc | 2 + .../CSCCommissioning/src/CSCFileDumper.cc | 2 +- .../CSCCommissioning/src/CSCFileDumper.h | 12 +- .../CSCCommissioning/src/CSCFileReader.h | 4 +- IORawData/CSCCommissioning/test/dumpTest.py | 2 +- .../test/readFile_b904_Run3.py | 52 +- .../interface/PixelSLinkDataInputSource.h | 2 +- .../src/PixelSLinkDataInputSource.cc | 3 +- .../interface/BoxNDScanner.h | 172 - .../interface/MultivariateFunctorScanner.h | 77 - .../interface/rescanArray.h | 122 - .../Modules/interface/JetCorrectionProducer.h | 13 +- .../Modules/interface/JetResolution.h | 10 +- .../plugins/FactorizedJetCorrectorDemo.cc | 9 +- .../Modules/plugins/JetCorrectorDBReader.cc | 19 +- .../Modules/plugins/JetCorrectorDBWriter.cc | 4 +- .../Modules/plugins/JetCorrectorDemo.cc | 20 +- .../Modules/plugins/JetCorrectorOnTheFly.cc | 6 +- .../Modules/plugins/JetResolutionDBReader.cc | 16 +- .../Modules/plugins/JetResolutionDBWriter.cc | 4 +- .../Modules/plugins/JetResolutionDemo.cc | 18 +- .../Modules/plugins/METCorrectorDBReader.cc | 5 +- .../Modules/plugins/QGLikelihoodDBReader.cc | 10 +- .../Modules/plugins/QGLikelihoodDBWriter.cc | 51 +- .../QGLikelihoodSystematicsDBReader.cc | 10 +- .../QGLikelihoodSystematicsDBWriter.cc | 4 +- .../Modules/src/JetResolution.cc | 14 +- .../interface/CorrectedMETProducerT.h | 110 - L1Trigger/CSCTriggerPrimitives/README.md | 102 +- .../interface/CSCALCTCrossCLCT.h | 39 +- .../interface/CSCBaseboard.h | 3 +- .../interface/CSCCathodeLCTProcessor.h | 3 +- .../interface/CSCGEMMatcher.h | 52 +- .../interface/CSCGEMMotherboard.h | 2 - .../interface/CSCLUTReader.h | 67 - .../interface/CSCMotherboard.h | 15 + .../interface/CSCTriggerPrimitivesBuilder.h | 6 + .../interface/ComparatorCodeLUT.h | 16 +- .../interface/GEMClusterProcessor.h | 56 +- .../plugins/CSCTriggerPrimitivesProducer.cc | 156 +- .../plugins/CSCTriggerPrimitivesProducer.h | 95 - .../plugins/SealModule.cc | 5 - .../python/cscTriggerPrimitiveDigis_cfi.py | 4 - .../python/params/cclutParams.py | 26 - .../python/params/gemcscParams.py | 108 - .../python/params/tmbParams.py | 29 +- .../src/CSCALCTCrossCLCT.cc | 87 +- .../src/CSCCathodeLCTProcessor.cc | 8 +- .../CSCTriggerPrimitives/src/CSCGEMMatcher.cc | 100 +- .../src/CSCGEMMotherboard.cc | 15 + .../CSCTriggerPrimitives/src/CSCLUTReader.cc | 171 - .../src/CSCMotherboard.cc | 28 +- .../src/CSCTriggerPrimitivesBuilder.cc | 48 + .../src/ComparatorCodeLUT.cc | 16 +- .../src/GEMClusterProcessor.cc | 182 +- .../test/CSCTriggerPrimitivesAnalyzer.cc | 26 +- .../test/runCSCL1TDQMClient_cfg.py | 17 +- .../runCSCTriggerPrimitiveAnalyzer_cfg.py | 34 +- .../runCSCTriggerPrimitiveProducer_cfg.py | 68 +- .../runL1CSCTPEmulatorConfigAnalyzer_cfg.py | 1 + .../python/L1MuonEmulator_cff.py | 2 +- .../Configuration/python/ValL1Emulator_cff.py | 19 +- .../Configuration/python/customiseReEmul.py | 4 +- .../DTSectorCollector/interface/DTSCCand.h | 123 - .../interface/L1AbstractProcessor.h | 48 - .../{src => interface}/L1MuDTAddressArray.h | 0 .../{src => interface}/L1MuDTSecProcId.h | 0 .../DTTrackFinder/interface/L1MuDTTrack.h | 10 +- .../{src => interface}/L1MuDTTrackAssParam.h | 0 .../{src => interface}/L1MuDTTrackSegEta.h | 2 +- .../{src => interface}/L1MuDTTrackSegLoc.h | 0 .../{src => interface}/L1MuDTTrackSegPhi.h | 2 +- .../DTTrackFinder/src/L1MuDTAddressArray.cc | 2 +- .../DTTrackFinder/src/L1MuDTAssignmentUnit.cc | 22 +- .../DTTrackFinder/src/L1MuDTAssignmentUnit.h | 23 +- .../DTTrackFinder/src/L1MuDTDataBuffer.cc | 4 +- L1Trigger/DTTrackFinder/src/L1MuDTERS.cc | 2 +- L1Trigger/DTTrackFinder/src/L1MuDTERS.h | 10 +- L1Trigger/DTTrackFinder/src/L1MuDTEUX.cc | 29 +- L1Trigger/DTTrackFinder/src/L1MuDTEUX.h | 23 +- .../DTTrackFinder/src/L1MuDTEtaProcessor.cc | 15 +- .../DTTrackFinder/src/L1MuDTEtaProcessor.h | 10 +- .../src/L1MuDTExtrapolationUnit.cc | 20 +- .../src/L1MuDTExtrapolationUnit.h | 25 +- .../DTTrackFinder/src/L1MuDTMuonSorter.cc | 2 +- .../DTTrackFinder/src/L1MuDTMuonSorter.h | 10 +- L1Trigger/DTTrackFinder/src/L1MuDTSEU.cc | 8 +- L1Trigger/DTTrackFinder/src/L1MuDTSEU.h | 14 +- .../DTTrackFinder/src/L1MuDTSecProcId.cc | 2 +- .../DTTrackFinder/src/L1MuDTSecProcMap.cc | 2 +- .../DTTrackFinder/src/L1MuDTSecProcMap.h | 2 +- .../src/L1MuDTSectorProcessor.cc | 252 +- .../DTTrackFinder/src/L1MuDTSectorProcessor.h | 49 +- .../DTTrackFinder/src/L1MuDTSectorReceiver.cc | 14 +- .../DTTrackFinder/src/L1MuDTSectorReceiver.h | 6 +- L1Trigger/DTTrackFinder/src/L1MuDTTrack.cc | 6 +- .../DTTrackFinder/src/L1MuDTTrackAssParam.cc | 2 +- .../DTTrackFinder/src/L1MuDTTrackAssembler.h | 14 +- .../DTTrackFinder/src/L1MuDTTrackFinder.cc | 2 +- .../DTTrackFinder/src/L1MuDTTrackSegEta.cc | 4 +- .../DTTrackFinder/src/L1MuDTTrackSegLoc.cc | 2 +- .../DTTrackFinder/src/L1MuDTTrackSegPhi.cc | 4 +- .../DTTrackFinder/src/L1MuDTWedgeSorter.cc | 2 +- .../DTTrackFinder/src/L1MuDTWedgeSorter.h | 10 +- .../plugins/CalibratedDigis.cc | 4 +- .../interface/L1GctHfBitCountsLut.h | 2 +- .../interface/L1GctHfEtSumsLut.h | 2 +- .../interface/L1GctHtMissLut.h | 2 +- .../{src => interface}/L1GctJetCount.h | 4 +- .../interface/L1GctJetEtCalibrationLut.h | 2 +- .../interface/L1GctJetFinderBase.h | 4 +- .../interface/L1GctJetLeafCard.h | 4 +- .../{src => interface}/L1GctLut.h | 0 .../interface/L1GctSimpleJetFinder.h | 54 - .../{src => interface}/L1GctTwosComplement.h | 0 .../{src => interface}/L1GctUnsignedInt.h | 0 .../interface/L1GctWheelEnergyFpga.h | 4 +- .../interface/L1GctWheelJetFpga.h | 2 +- .../interface/L1GlobalCaloTrigger.h | 2 +- .../GlobalCaloTrigger/src/L1GctJetCount.cc | 2 +- L1Trigger/GlobalCaloTrigger/src/L1GctLut.cc | 2 +- .../src/L1GctTwosComplement.cc | 2 +- .../GlobalCaloTrigger/src/L1GctUnsignedInt.cc | 2 +- .../GlobalCaloTrigger/test/L1GctLutFromFile.h | 2 +- .../GlobalCaloTrigger/test/testEtTypes.cpp | 6 +- .../GlobalTrigger/plugins/L1GTPrescaler.cc | 12 +- .../src/L1GtTrigReport.cc | 4 +- .../src/L1RetrieveL1Extra.cc | 2 - L1Trigger/L1TCalorimeter/interface/classes.h | 19 - L1Trigger/L1TCommon/interface/Mask.h | 3 - L1Trigger/L1TCommon/src/Mask.cc | 4 +- .../L1TGlobal/plugins/L1TGlobalPrescaler.cc | 49 +- L1Trigger/L1THGCal/BuildFile.xml | 2 +- .../interface/HGCalCoarseTriggerCellMapping.h | 2 +- .../L1THGCal/interface/HGCalProcessorBaseT.h | 13 +- .../interface/HGCalTriggerCellCalibration.h | 2 +- .../L1THGCal/interface/HGCalTriggerTools.h | 6 +- .../HGCalTriggerTowerGeometryHelper.h | 2 +- .../backend/HGCalClusteringDummyImpl.h | 2 +- .../interface/backend/HGCalClusteringImpl.h | 2 +- .../backend/HGCalHistoClusteringImpl.h | 6 +- .../interface/backend/HGCalHistoSeedingImpl.h | 2 +- .../backend/HGCalMulticlusteringImpl.h | 6 +- .../interface/backend/HGCalShowerShape.h | 2 +- .../interface/backend/HGCalTowerMap2DImpl.h | 7 +- .../HGCalTriggerClusterInterpreterBase.h | 3 +- .../HGCalConcentratorAutoEncoderImpl.h | 2 +- .../HGCalConcentratorBestChoiceImpl.h | 2 +- .../HGCalConcentratorCoarsenerImpl.h | 8 +- .../HGCalConcentratorProcessorSelection.h | 3 +- .../HGCalConcentratorSuperTriggerCellImpl.h | 16 +- .../HGCalConcentratorThresholdImpl.h | 2 +- .../HGCalConcentratorTrigSumImpl.h | 2 +- .../veryfrontend/HGCalVFEProcessorSums.h | 4 +- .../veryfrontend/HGCalVFESummationImpl.h | 2 +- .../L1THGCal/plugins/HFNoseVFEProducer.cc | 8 +- .../plugins/HGCalBackendLayer1Producer.cc | 2 +- .../plugins/HGCalBackendLayer2Producer.cc | 2 +- .../plugins/HGCalConcentratorProducer.cc | 3 +- .../L1THGCal/plugins/HGCalTowerMapProducer.cc | 2 +- .../L1THGCal/plugins/HGCalTowerProducer.cc | 3 +- .../L1THGCal/plugins/HGCalVFEProducer.cc | 6 +- ...HGCalBackendLayer1Processor2DClustering.cc | 14 +- ...HGCalBackendLayer2Processor3DClustering.cc | 20 +- .../plugins/backend/HGCalTowerMapProcessor.cc | 8 +- .../plugins/backend/HGCalTowerProcessor.cc | 11 +- .../HGCalTriggerClusterInterpretationEM.cc | 6 +- .../HGCalConcentratorProcessorSelection.cc | 35 +- .../veryfrontend/HGCalVFEProcessorSums.cc | 23 +- L1Trigger/L1THGCal/src/HGCalTriggerTools.cc | 10 +- L1Trigger/L1THGCal/test/BuildFile.xml | 2 - .../interface/HGCalTriggerNtupleBase.h | 36 +- .../plugins/CaloTruthCellsProducer.cc | 18 +- .../ntuples/HGCalTriggerNtupleEvent.cc | 8 +- .../plugins/ntuples/HGCalTriggerNtupleGen.cc | 31 +- .../ntuples/HGCalTriggerNtupleGenJet.cc | 8 +- .../ntuples/HGCalTriggerNtupleGenTau.cc | 8 +- .../ntuples/HGCalTriggerNtupleHGCClusters.cc | 15 +- .../HGCalTriggerNtupleHGCConcentratorData.cc | 14 +- .../ntuples/HGCalTriggerNtupleHGCDigis.cc | 23 +- .../HGCalTriggerNtupleHGCMulticlusters.cc | 16 +- .../HGCalTriggerNtupleHGCTriggerCells.cc | 23 +- .../HGCalTriggerNtupleHGCTriggerSums.cc | 10 +- .../ntuples/HGCalTriggerNtupleManager.cc | 31 +- .../ntuples/HGCalTriggerNtupleTowers.cc | 15 +- .../interface/RegionalMuonRawDigiTranslator.h | 15 +- L1Trigger/L1TMuon/python/simDigis_cff.py | 6 +- .../src/RegionalMuonRawDigiTranslator.cc | 39 +- .../interface/L1AbstractProcessor.h | 48 - .../L1TMuonBarrel/src/L1MuBMAssignmentUnit.cc | 18 +- .../L1TMuonBarrel/src/L1MuBMAssignmentUnit.h | 18 +- L1Trigger/L1TMuonBarrel/src/L1MuBMERS.h | 10 +- L1Trigger/L1TMuonBarrel/src/L1MuBMEUX.cc | 9 +- L1Trigger/L1TMuonBarrel/src/L1MuBMEUX.h | 14 +- .../L1TMuonBarrel/src/L1MuBMEtaProcessor.cc | 27 +- .../L1TMuonBarrel/src/L1MuBMEtaProcessor.h | 20 +- .../src/L1MuBMExtrapolationUnit.cc | 10 +- .../src/L1MuBMExtrapolationUnit.h | 18 +- .../L1TMuonBarrel/src/L1MuBMMuonSorter.h | 10 +- L1Trigger/L1TMuonBarrel/src/L1MuBMSEU.cc | 4 +- L1Trigger/L1TMuonBarrel/src/L1MuBMSEU.h | 12 +- .../src/L1MuBMSectorProcessor.cc | 9 +- .../L1TMuonBarrel/src/L1MuBMSectorProcessor.h | 3 + .../L1TMuonBarrel/src/L1MuBMSectorReceiver.cc | 15 +- .../L1TMuonBarrel/src/L1MuBMSectorReceiver.h | 7 +- .../L1TMuonBarrel/src/L1MuBMTrackAssembler.h | 10 +- .../L1TMuonBarrel/src/L1MuBMWedgeSorter.h | 10 +- .../interface/OMTFConfigurator.h | 25 - .../interface/OMTFPatternMaker.h | 32 - L1Trigger/L1TMuonOverlap/src/GhostBuster.cc | 1 + .../src/GhostBusterPreferRefDt.cc | 1 + L1Trigger/L1TMuonOverlapPhase1/.gitignore | 7 + L1Trigger/L1TMuonOverlapPhase1/BuildFile.xml | 45 + .../interface/AlgoMuonBase.h | 59 + .../interface/AngleConverterBase.h | 119 + .../L1TMuonOverlapPhase1/interface/MuonStub.h | 68 + .../interface/MuonStubMakerBase.h | 180 + .../interface/MuonStubsInput.h | 42 + .../interface/Omtf/AlgoMuon.h | 104 + .../interface/Omtf/GhostBuster.h | 25 + .../interface/Omtf/GhostBusterPreferRefDt.h | 26 + .../interface/Omtf/GoldenPattern.h | 133 + .../interface/Omtf/GoldenPatternBase.h | 130 + .../interface/Omtf/GoldenPatternResult.h | 139 + .../interface/Omtf/GoldenPatternWithStat.h | 48 + .../interface/Omtf/IGhostBuster.h | 20 + .../interface/Omtf/IOMTFEmulationObserver.h | 46 + .../interface/Omtf/IProcessorEmulator.h | 48 + .../interface/Omtf/OMTFConfiguration.h | 319 + .../interface/Omtf/OMTFProcessor.h | 107 + .../interface/Omtf/OMTFReconstruction.h | 84 + .../interface/Omtf/OMTFSorter.h | 27 + .../interface/Omtf/OMTFinput.h | 48 + .../interface/Omtf/OMTFinputMaker.h | 141 + .../interface/Omtf/OmtfAngleConverter.h | 33 + .../interface/Omtf/OmtfName.h | 59 + .../interface/Omtf/ProcessorBase.h | 69 + .../interface/Omtf/PtAssignmentBase.h | 28 + .../interface/Omtf/SorterBase.h | 46 + .../interface/Omtf/XMLConfigReader.h | 82 + .../interface/Omtf/XMLConfigWriter.h | 75 + .../interface/Omtf/XMLEventWriter.h | 53 + .../interface/ProcConfigurationBase.h | 99 + .../interface/RpcClusterization.h | 59 + .../interface/StubResult.h | 56 + .../interface/Tools/CandidateSimMuonMatcher.h | 185 + .../interface/Tools/DataROOTDumper2.h | 87 + .../interface/Tools/EmulationObserverBase.h | 56 + .../interface/Tools/EventCapture.h | 63 + .../interface/Tools/OMTFConfigMaker.h | 61 + .../interface/Tools/PatternGenerator.h | 47 + .../interface/Tools/PatternOptimizerBase.h | 60 + .../interface/Tools/StubsSimHitsMatcher.h | 103 + .../plugins/BuildFile.xml | 13 + .../L1MuonOverlapPhase1ParamsDBProducer.cc | 40 + .../L1MuonOverlapPhase1ParamsDBProducer.h | 32 + .../L1TMuonOverlapPhase1ParamsESProducer.cc | 96 + .../L1TMuonOverlapPhase1ParamsESProducer.h | 41 + .../L1TMuonOverlapPhase1TrackProducer.cc | 92 + .../L1TMuonOverlapPhase1TrackProducer.h | 59 + .../python/fakeOmtfParams_cff.py | 23 + .../python/simOmtfDigis_cfi.py | 33 + .../L1TMuonOverlapPhase1/src/AlgoMuonBase.cc | 13 + .../src/AngleConverterBase.cc | 451 ++ .../L1TMuonOverlapPhase1/src/MuonStub.cc | 60 + .../src/MuonStubMakerBase.cc | 153 + .../src/MuonStubsInput.cc | 36 + .../L1TMuonOverlapPhase1/src/Omtf/AlgoMuon.cc | 34 + .../src/Omtf/GhostBuster.cc | 62 + .../src/Omtf/GhostBusterPreferRefDt.cc | 166 + .../src/Omtf/GoldenPattern.cc | 98 + .../src/Omtf/GoldenPatternBase.cc | 141 + .../src/Omtf/GoldenPatternResult.cc | 368 ++ .../src/Omtf/GoldenPatternWithStat.cc | 38 + .../src/Omtf/IOMTFEmulationObserver.cc | 12 + .../src/Omtf/OMTFConfiguration.cc | 405 ++ .../src/Omtf/OMTFProcessor.cc | 430 ++ .../src/Omtf/OMTFReconstruction.cc | 272 + .../src/Omtf/OMTFSorter.cc | 72 + .../src/Omtf/OMTFinput.cc | 86 + .../src/Omtf/OMTFinputMaker.cc | 435 ++ .../src/Omtf/OmtfAngleConverter.cc | 263 + .../L1TMuonOverlapPhase1/src/Omtf/OmtfName.cc | 95 + .../src/Omtf/ProcessorBase.cc | 240 + .../src/Omtf/PtAssignmentBase.cc | 10 + .../src/Omtf/SorterBase.cpp | 8 + .../src/Omtf/XMLConfigReader.cc | 792 +++ .../src/Omtf/XMLConfigWriter.cc | 714 +++ .../src/Omtf/XMLEventWriter.cc | 74 + .../src/ProcConfigurationBase.cc | 64 + .../src/RpcClusterization.cc | 70 + .../src/Tools/CandidateSimMuonMatcher.cc | 671 ++ .../src/Tools/DataROOTDumper2.cc | 178 + .../src/Tools/EmulationObserverBase.cc | 93 + .../src/Tools/EventCapture.cc | 300 + .../src/Tools/OMTFConfigMaker.cc | 134 + .../src/Tools/PatternGenerator.cc | 697 +++ .../src/Tools/PatternOptimizerBase.cc | 234 + .../src/Tools/StubsSimHitsMatching.cc | 451 ++ .../L1TMuonOverlapPhase1/test/.gitignore | 1 + .../test/expert/omtf/.gitignore | 5 + .../expert/omtf/runMuonOverlapDataDump.py | 233 + .../omtf/runMuonOverlapPatternGenerator.py | 209 + ...runMuonOverlapPatternGeneratorClassProb.py | 217 + .../test/expert/omtf/write_sqlite.py | 32 + .../test/runMuonOverlap_run2_data.py | 156 + .../test/runMuonOverlap_run3_data.py | 159 + .../test/runMuonOverlap_run3_mc.py | 189 + .../interface/L1AnalysisRecoTrackBase.h | 17 - L1Trigger/L1TTrackMatch/plugins/BuildFile.xml | 2 +- .../test/L1TrackObjectNtupleMaker.cc | 12 + .../L1GtTriggerMenuConfigOnlineProd.h | 3 +- .../src/L1GtParametersConfigOnlineProd.cc | 29 +- ...PrescaleFactorsAlgoTrigConfigOnlineProd.cc | 2 - ...PrescaleFactorsTechTrigConfigOnlineProd.cc | 2 - .../src/L1GtPsbSetupConfigOnlineProd.cc | 1 - ...L1GtTriggerMaskAlgoTrigConfigOnlineProd.cc | 2 - ...L1GtTriggerMaskTechTrigConfigOnlineProd.cc | 1 - ...TriggerMaskVetoTechTrigConfigOnlineProd.cc | 3 - .../src/L1GtTriggerMenuConfigOnlineProd.cc | 2 - .../L1Analyzer/interface/L1PromptAnalysis.h | 288 - .../Engine/interface/MagneticField.h | 23 +- .../Engine/interface/MagneticFieldHelpers.h | 42 - MagneticField/Engine/src/MagneticField.cc | 32 +- MagneticField/Engine/test/queryField.cc | 21 +- .../Engine/test/testMagneticField.cc | 22 +- MagneticField/GeomBuilder/src/volumeHandle.cc | 3 +- .../src/OAEParametrizedMagneticField.cc | 8 +- .../src/OAEParametrizedMagneticField.h | 2 +- .../src/ParabolicParametrizedMagneticField.cc | 8 +- .../src/ParabolicParametrizedMagneticField.h | 2 +- .../src/PolyFit2DParametrizedMagneticField.cc | 2 + .../src/PolyFit2DParametrizedMagneticField.h | 2 +- .../interface/UniformMagneticField.h | 4 +- .../interface/VolumeBasedMagneticField.h | 2 +- .../src/VolumeBasedMagneticField.cc | 5 +- .../VolumeGeometry/interface/MagCylinder.h | 2 +- .../interface/MagVolume6Faces.h | 2 +- .../interface/RectangularVolumeBounds.h | 8 - .../VolumeGeometry/src/MagCylinder.cc | 1 + .../VolumeGeometry/src/MagVolume6Faces.cc | 4 +- Mixing/Base/interface/BMixingModule.h | 1 + Mixing/Base/interface/FixedPUGenerator.h | 25 - Mixing/Base/interface/PUGenerator.h | 22 - Mixing/Base/interface/PileUp.h | 11 +- Mixing/Base/src/BMixingModule.cc | 12 +- Mixing/Base/src/PileUp.cc | 14 +- .../test/Macros/CompareRecoGenPt.C | 139 +- OnlineDB/CSCCondDB/interface/AutoCorrMat.h | 112 - .../CSCCondDB/interface/CSCCableReadTest.h | 27 - OnlineDB/CSCCondDB/interface/CSCxTalk.h | 162 - OnlineDB/CSCCondDB/interface/SaturationFcn.h | 65 - OnlineDB/EcalCondDB/interface/IConfig.h | 14 - OnlineDB/EcalCondDB/interface/IRunIOV.h | 23 - OnlineDB/EcalCondDB/interface/ITimeIOV.h | 21 - .../EcalCondDB/interface/all_cali_types.h | 7 - OnlineDB/EcalCondDB/interface/all_dcu_types.h | 11 - OnlineDB/EcalCondDB/interface/all_mod_types.h | 21 - OnlineDB/EcalCondDB/src/FEConfigCokeDat.cc | 9 +- OnlineDB/EcalCondDB/src/FEConfigCokeInfo.cc | 15 +- OnlineDB/EcalCondDB/src/FEConfigMainInfo.cc | 20 +- .../EcalCondDB/src/FEConfigOddWeightDat.cc | 9 +- .../src/FEConfigOddWeightGroupDat.cc | 9 +- .../EcalCondDB/src/FEConfigOddWeightInfo.cc | 15 +- .../src/FEConfigOddWeightModeDat.cc | 7 +- .../EcalCondDB/src/RunCrystalErrorsDat.cc | 3 +- OnlineDB/EcalCondDB/src/RunMemChErrorsDat.cc | 3 +- OnlineDB/EcalCondDB/src/RunMemTTErrorsDat.cc | 3 +- OnlineDB/EcalCondDB/src/RunPNErrorsDat.cc | 3 +- OnlineDB/EcalCondDB/src/RunTTErrorsDat.cc | 3 +- .../EcalCondDB/test/InsertDCUIdarkPed.cpp | 354 -- OnlineDB/EcalCondDB/test/TestChannelView.cpp | 125 - OnlineDB/EcalCondDB/test/TestDCU.cpp | 315 - OnlineDB/EcalCondDB/test/TestMOD.cpp | 265 - .../plugins/FWLiteESRecordWriterAnalyzer.cc | 294 +- .../test/EventSetupIntProductAnalyzer.cc | 17 +- PhysicsTools/FWLite/interface/WSelectorFast.h | 87 - .../plugins/GenParticleProducer.cc | 2 +- .../plugins/GenParticlePruner.cc | 1 + .../plugins/CandIsoDepositProducer.cc | 49 +- .../plugins/CandIsoDepositProducer.h | 42 - .../plugins/CandIsolatorFromDeposits.cc | 67 +- .../plugins/CandIsolatorFromDeposits.h | 62 - .../plugins/CandViewExtractor.cc | 101 +- .../plugins/CandViewExtractor.h | 67 - .../plugins/CandViewExtractor.icc | 34 - .../IsolationAlgos/plugins/PFTauExtractor.cc | 51 +- .../IsolationAlgos/plugins/PFTauExtractor.h | 53 - .../MVAComputer/interface/MVAModuleHelper.h | 160 - PhysicsTools/NanoAOD/python/electrons_cff.py | 32 + PhysicsTools/NanoAOD/python/jets_cff.py | 39 +- PhysicsTools/NanoAOD/python/met_cff.py | 12 +- PhysicsTools/NanoAOD/python/nanoDQM_cff.py | 3 + PhysicsTools/NanoAOD/python/nano_cff.py | 103 +- PhysicsTools/NanoAOD/python/nano_eras_cff.py | 1 + PhysicsTools/NanoAOD/python/photons_cff.py | 21 + PhysicsTools/NanoAOD/test/inspectNanoFile.py | 337 +- .../PatAlgos/interface/KinResolutionsLoader.h | 13 +- .../interface/KinematicResolutionProvider.h | 6 - .../PatAlgos/interface/PATUserDataHelper.h | 1 - .../PatAlgos/interface/PATUserDataMerger.h | 1 - .../PatAlgos/interface/VertexingHelper.h | 2 + .../plugins/PATCompositeCandidateProducer.cc | 3 +- .../PatAlgos/plugins/PATElectronProducer.cc | 3 +- .../plugins/PATGenericParticleProducer.cc | 3 +- .../plugins/PATIsolatedTrackProducer.cc | 19 +- .../PatAlgos/plugins/PATJetProducer.cc | 3 +- .../PatAlgos/plugins/PATJetSlimmer.cc | 9 +- .../PatAlgos/plugins/PATMETProducer.cc | 26 +- .../PatAlgos/plugins/PATMuonProducer.cc | 3 +- .../PatAlgos/plugins/PATMuonSlimmer.cc | 9 +- .../PatAlgos/plugins/PATObjectSelector.cc | 1 - .../PatAlgos/plugins/PATPFParticleProducer.cc | 3 +- .../PatAlgos/plugins/PATPhotonProducer.cc | 3 +- .../PatAlgos/plugins/PATTauProducer.cc | 3 +- .../PatAlgos/plugins/PATTauSlimmer.cc | 9 +- .../PatAlgos/plugins/PATTriggerProducer.cc | 28 +- .../plugins/TauJetCorrFactorsProducer.cc | 16 +- .../python/producersLayer1/jetProducer_cfi.py | 124 +- .../python/producersLayer1/jetUpdater_cfi.py | 31 +- .../python/recoLayer0/jetCorrFactors_cfi.py | 25 +- .../slimming/genParticleAssociation_cff.py | 11 +- .../python/slimming/lostTracks_cfi.py | 2 +- .../PatAlgos/python/slimming/miniAOD_tools.py | 17 +- .../python/slimming/puppiForMET_cff.py | 9 +- .../PatAlgos/python/slimming/slimming_cff.py | 2 +- .../python/tools/jetCollectionTools.py | 9 +- .../PatAlgos/src/KinResolutionsLoader.cc | 15 +- PhysicsTools/PatAlgos/src/VertexingHelper.cc | 5 +- .../PatAlgos/test/miniAOD/example_addJet.py | 4 +- .../PatAlgos/test/miniAOD/example_ei.py | 2 +- .../test/miniAOD/example_jet_and_met.py | 6 +- .../interface/WPlusJetsEventSelector.h | 2 - PhysicsTools/PatUtils/interface/JetSelector.h | 67 - .../PatUtils/interface/JetSelector.icc | 63 - .../interface/LeptonVertexSignificance.h | 28 +- .../PatUtils/interface/PatSelectorByFlags.h | 19 - PhysicsTools/PatUtils/interface/RefHelper.h | 130 - .../PatUtils/interface/ShiftedJetProducerT.h | 23 +- .../PatUtils/interface/SmearedJetProducerT.h | 8 +- .../PackedCandidatesTrackLiteModifier.cc | 1 - ...ftedPFCandidateProducerForNoPileUpPFMEt.cc | 24 +- .../ShiftedPFCandidateProducerForPFNoPUMEt.cc | 35 +- .../python/patPFMETCorrections_cff.py | 32 +- .../PatUtils/python/tools/pfforTrkMET_cff.py | 6 + .../runMETCorrectionsAndUncertainties.py | 55 +- .../PatUtils/src/LeptonVertexSignificance.cc | 43 +- .../PythonAnalysis/test/BuildFile.xml | 7 +- .../bin/testSelection_wplusjets.C | 2 - .../SelectorUtils/interface/Variables.h | 16 - .../ElectronMatchedCandidateProducer.h | 34 - .../ElectronMatchedCandidateProducer.cc | 30 +- .../UtilAlgos/interface/DummyMatchSelector.h | 26 - .../UtilAlgos/interface/EventSelector.h | 1 - .../UtilAlgos/interface/MCMatchSelector.h | 43 - .../UtilAlgos/interface/NtpProducer.h | 74 - .../interface/SelectedOutputCollectionTrait.h | 49 - .../UtilAlgos/interface/SelectionAdderTrait.h | 147 - .../UtilAlgos/interface/StoreContainerTrait.h | 39 - .../UtilAlgos/interface/TwoObjectCalculator.h | 16 - .../Utilities/interface/GammaPropagator.h | 16 - .../Utilities/interface/GammaZInterference.h | 30 - PhysicsTools/Utilities/interface/Number.h | 15 - PhysicsTools/Utilities/interface/ZLineShape.h | 29 - .../Utilities/scripts/edmPickEvents.py | 6 +- PhysicsTools/Utilities/test/BuildFile.xml | 5 +- PhysicsTools/Utilities/test/corrections.json | 60 + .../Utilities/test/test_correctionlib.cc | 27 + .../Utilities/test/test_edmPickEvents.sh | 6 + .../python/pfDeepBoostedJet_cff.py | 2 +- .../ONNXRuntime/python/pfDeepFlavour_cff.py | 2 +- .../python/pfParticleNetAK4_cff.py | 2 +- .../ONNXRuntime/python/pfParticleNet_cff.py | 2 +- .../plugins/PixelClusterTagInfoProducer.cc | 13 +- .../TemplatedSecondaryVertexProducer.cc | 6 +- RecoBTag/SoftLepton/plugins/SoftLepton.cc | 188 +- RecoBTag/SoftLepton/plugins/SoftLepton.h | 116 - .../plugins/SoftPFElectronTagInfoProducer.cc | 153 +- .../plugins/SoftPFElectronTagInfoProducer.h | 50 - .../plugins/SoftPFMuonTagInfoProducer.cc | 116 +- .../plugins/SoftPFMuonTagInfoProducer.h | 44 - RecoBTag/SoftLepton/plugins/module.cc | 8 - .../JetTagComputer/plugins/JetTagProducer.cc | 86 +- .../JetTagComputer/plugins/JetTagProducer.h | 37 - .../src/EgammaSCCorrectionMaker.cc | 11 +- .../interface/EcalClusterFunctionBaseClass.h | 1 + .../interface/EcalClusterFunctionFactory.h | 3 +- .../interface/EcalClusterLazyTools.h | 2 +- .../interface/EcalClusterPUCleaningTools.h | 24 +- .../plugins/EcalClusterCrackCorrection.cc | 22 +- .../plugins/EcalClusterEnergyCorrection.cc | 12 +- ...alClusterEnergyCorrectionObjectSpecific.cc | 15 +- .../plugins/EcalClusterEnergyUncertainty.cc | 12 +- .../src/EcalClusterPUCleaningTools.cc | 46 +- .../test/testEcalClusterFunctions.cc | 3 +- .../interface/GsfElectronAlgo.h | 39 + .../src/GsfElectronAlgo.cc | 72 +- .../interface/LowPtGsfElectronFeatures.h | 7 +- .../plugins/BuildFile.xml | 1 + .../plugins/GsfElectronProducer.cc | 153 +- .../plugins/LowPtGsfElectronIDProducer.cc | 247 +- .../plugins/LowPtGsfElectronSeedProducer.cc | 4 +- ...rackingRegionsFromSuperClustersProducer.cc | 30 +- .../python/gedGsfElectrons_cfi.py | 22 + .../python/gsfElectronProducer_cfi.py | 34 +- .../python/lowPtGsfElectronCores_cff.py | 3 - .../python/lowPtGsfElectronID_cfi.py | 8 + .../lowPtGsfElectronsPreRegression_cfi.py | 3 - .../src/LowPtGsfElectronFeatures.cc | 21 +- .../plugins/EgammaHLTClusterShapeProducer.cc | 55 +- .../EgammaHLTHcalVarProducerFromRecHit.cc | 229 + .../plugins/HLTCaloObjInRegionsProducer.cc | 2 +- .../interface/EcalPFClusterIsolation.h | 2 + .../interface/HcalPFClusterIsolation.h | 1 + .../src/EcalPFClusterIsolation.cc | 66 +- .../src/HcalPFClusterIsolation.cc | 23 +- .../interface/ConversionSeedFinder.h | 11 +- .../interface/ConversionTrackFinder.h | 10 +- .../EnergyUncertaintyPhotonSpecific.h | 2 + .../interface/InOutConversionTrackFinder.h | 4 +- .../interface/OutInConversionTrackFinder.h | 4 +- .../interface/PhotonEnergyCorrector.h | 3 + .../src/ConversionSeedFinder.cc | 23 +- .../src/ConversionTrackFinder.cc | 23 +- .../src/EnergyUncertaintyPhotonSpecific.cc | 460 +- .../src/InOutConversionTrackFinder.cc | 5 +- .../src/OutInConversionTrackFinder.cc | 5 +- .../src/PhotonEnergyCorrector.cc | 34 +- .../EgammaPhotonProducers/BuildFile.xml | 1 + .../python/gedPhotonSequence_cff.py | 30 +- .../python/gedPhotons_cfi.py | 49 +- .../python/photons_cfi.py | 48 +- .../src/ConversionTrackCandidateProducer.cc | 22 +- .../src/GEDPhotonProducer.cc | 180 +- .../src/PhotonProducer.cc | 33 +- .../src/TrackProducerWithSCAssociation.cc | 22 +- RecoEgamma/EgammaTools/BuildFile.xml | 1 + .../EgammaTools/interface/ConversionTools.h | 1 - .../EgammaTools/interface/EGEnergyCorrector.h | 24 +- .../EGEnergyCorrectorFactoryFromEventSetup.h | 51 + .../EgammaTools/interface/EffectiveAreas.h | 1 - .../EgammaTools/interface/EgammaDNNHelper.h | 74 + .../egEnergyCorrectorFactoryFromRootFile.h | 31 + .../EgammaTools/plugins/EGEnergyAnalyzer.cc | 21 +- .../plugins/EGRegressionModifierV3.cc | 9 +- .../EgammaTools/src/EGEnergyCorrector.cc | 81 +- .../EGEnergyCorrectorFactoryFromEventSetup.cc | 56 + RecoEgamma/EgammaTools/src/EgammaDNNHelper.cc | 182 + .../egEnergyCorrectorFactoryFromRootFile.cc | 33 + .../ElectronIdentification/BuildFile.xml | 1 + .../interface/ElectronDNNEstimator.h | 41 + .../src/ElectronDNNEstimator.cc | 110 + RecoEgamma/PhotonIdentification/BuildFile.xml | 2 + .../interface/PhotonDNNEstimator.h | 41 + .../interface/PhotonIsolationCalculator.h | 4 + .../src/PhotonDNNEstimator.cc | 78 + .../src/PhotonIsolationCalculator.cc | 8 +- RecoHGCal/TICL/plugins/HGCGraph.cc | 11 +- ...rsProducer.cc => SimTrackstersProducer.cc} | 78 +- .../TrackstersFromCaloParticlesProducer.cc | 123 - RecoHGCal/TICL/python/SimTracksters_cff.py | 12 +- .../interface/EcalClusterIsoCalculator.h | 15 +- .../interface/HcalRechitIsoCalculator.h | 3 +- .../plugins/photonIsolationHIProducer.cc | 12 +- .../src/EcalClusterIsoCalculator.cc | 16 +- .../src/HcalRechitIsoCalculator.cc | 12 +- RecoHI/HiJetAlgos/interface/UECalibration.h | 162 - RecoHI/HiJetAlgos/plugins/UETableProducer.cc | 10 +- .../HiJetAlgos/src/ParametrizedSubtractor.cc | 30 +- .../plugins/HIMuonTrackingRegionProducer.h | 2 +- .../HiRegitMuonDetachedTripletStep_cff.py | 4 +- .../python/HiRegitMuonInitialStep_cff.py | 5 +- .../python/HiRegitMuonMixedTripletStep_cff.py | 5 +- .../python/HiRegitMuonPixelLessStep_cff.py | 5 +- .../python/HiRegitMuonPixelPairStep_cff.py | 5 +- .../plugins/HIBestVertexSelector.cc | 4 +- .../plugins/HIMultiTrackSelector.cc | 7 +- .../HiTracking/plugins/HIMultiTrackSelector.h | 3 + .../plugins/HIProtoTrackSelector.cc | 4 +- .../HITrackingRegionForPrimaryVtxProducer.h | 38 +- .../plugins/HITrackingRegionProducer.h | 46 +- .../python/hiMixedTripletStep_cff.py | 5 +- .../HiTracking/python/hiPixelLessStep_cff.py | 5 +- .../python/hiRegitDetachedTripletStep_cff.py | 4 +- .../python/hiRegitInitialStep_cff.py | 5 +- .../python/hiRegitLowPtTripletStep_cff.py | 4 +- .../python/hiRegitMixedTripletStep_cff.py | 5 +- .../python/hiRegitPixelPairStep_cff.py | 5 +- RecoHI/HiTracking/python/hiTobTecStep_cff.py | 5 +- .../FFTJetProducers/plugins/FFTJetProducer.cc | 15 +- .../FFTJetProducers/plugins/FFTJetProducer.h | 8 + RecoJets/JetAnalyzers/doc/myJetAna.html | 90 - .../interface/CaloTowerBoundries.h | 139 - RecoJets/JetAnalyzers/interface/MyCluster.h | 68 - RecoJets/JetAnalyzers/interface/myFilter.h | 64 - RecoJets/JetAnalyzers/interface/myJetAna.h | 487 -- RecoJets/JetAnalyzers/test/myFilter.cc | 1024 --- RecoJets/JetAnalyzers/test/myJetAna.cc | 2736 -------- RecoJets/JetProducers/interface/JetSpecific.h | 18 +- .../JetProducers/interface/PileUpSubtractor.h | 9 +- .../plugins/CompoundJetProducer.cc | 15 +- .../plugins/FastjetJetProducer.cc | 3 +- .../plugins/SubEventGenJetProducer.cc | 2 +- .../plugins/SubjetFilterJetProducer.cc | 15 +- .../plugins/VirtualJetProducer.cc | 51 +- .../JetProducers/plugins/VirtualJetProducer.h | 11 + .../python/PileupJetIDCutParams_cfi.py | 20 +- .../JetProducers/python/hepTopTaggerV2_cff.py | 3 +- RecoJets/JetProducers/src/JetSpecific.cc | 29 +- RecoJets/JetProducers/src/PileUpSubtractor.cc | 5 +- .../src/CaloTowerCandidateCreator.cc | 49 +- .../src/CaloTowerCandidateCreator.h | 40 - .../src/CaloTowersCreationAlgo.cc | 4 +- .../CaloTowersCreationAlgo.h | 0 .../src/CaloTowersCreator.cc | 92 +- .../CaloTowersCreator/src/CaloTowersCreator.h | 87 - .../CaloTowersCreator/src/CaloTowersMerger.cc | 14 +- .../src/CaloTowersReCreator.cc | 39 +- .../src/CaloTowersReCreator.h | 41 - .../{interface => src}/EScales.h | 0 .../CaloTowersCreator/src/HcalMaterials.cc | 4 +- .../{interface => src}/HcalMaterials.h | 0 .../CaloTowersCreator/src/SealModule.cc | 11 - RecoLocalCalo/Castor/src/RecHitCorrector.cc | 20 +- .../plugins/CastorSimpleReconstructor.cc | 54 +- .../plugins/CastorSimpleReconstructor.h | 45 - .../CastorReco/plugins/SealModule.cc | 7 - .../EcalUncalibRecHitLeadingEdgeAlgo.h | 71 - .../plugins/EcalUncalibRecHitWorkerGlobal.cc | 4 +- .../plugins/EcalUncalibRecHitWorkerGlobal.h | 2 +- .../plugins/EcalUncalibRecHitWorkerWeights.cc | 4 +- .../plugins/EcalUncalibRecHitWorkerWeights.h | 2 +- .../src/HBHEIsolatedNoiseAlgos.cc | 1 - .../HcalRecAlgos/test/HcalRecHitReflagger.cc | 29 +- .../HcalRecAlgos/test/HcalSevLvlAnalyzer.cc | 32 +- .../HcalRecAlgos/test/MahiDebugger.cc | 8 +- .../python/hbheRecHitProducerGPUTask_cff.py | 2 + .../HcalRecProducers/src/DeclsForKernels.h | 4 + .../src/HBHERecHitProducerGPU.cc | 119 +- .../src/HcalESProducersGPUDefs.cc | 7 + RecoLocalCalo/HcalRecProducers/src/MahiGPU.cu | 16 +- RecoLocalMuon/DTRecHit/BuildFile.xml | 1 + .../DTRecHit/interface/DTRecHitAlgoFactory.h | 4 +- .../DTRecHit/interface/DTRecHitBaseAlgo.h | 3 +- .../DTRecHit/plugins/DTLinearDriftAlgo.cc | 5 +- .../DTRecHit/plugins/DTLinearDriftAlgo.h | 3 +- .../plugins/DTLinearDriftFromDBAlgo.cc | 33 +- .../plugins/DTLinearDriftFromDBAlgo.h | 11 +- .../DTRecHit/plugins/DTNoDriftAlgo.cc | 5 +- .../DTRecHit/plugins/DTNoDriftAlgo.h | 2 +- .../plugins/DTParametrizedDriftAlgo.cc | 13 +- .../plugins/DTParametrizedDriftAlgo.h | 5 +- .../DTRecHit/plugins/DTRecHitProducer.cc | 10 +- .../DTRecHit/plugins/DTRecHitProducer.h | 3 + .../DTRecHit/src/DTRecHitBaseAlgo.cc | 7 +- .../src/DTCombinatorialExtendedPatternReco.cc | 11 +- .../src/DTCombinatorialExtendedPatternReco.h | 7 +- .../src/DTCombinatorialPatternReco.cc | 9 +- .../src/DTCombinatorialPatternReco.h | 6 +- .../src/DTCombinatorialPatternReco4D.cc | 10 +- .../src/DTCombinatorialPatternReco4D.h | 6 +- .../DTSegment/src/DTMeantimerPatternReco.cc | 12 +- .../DTSegment/src/DTMeantimerPatternReco.h | 6 +- .../DTSegment/src/DTMeantimerPatternReco4D.cc | 11 +- .../DTSegment/src/DTMeantimerPatternReco4D.h | 6 +- .../DTSegment/src/DTRecSegment2DAlgoFactory.h | 4 +- .../src/DTRecSegment2DExtendedProducer.cc | 12 +- .../src/DTRecSegment2DExtendedProducer.h | 7 +- .../DTSegment/src/DTRecSegment2DProducer.cc | 9 +- .../DTSegment/src/DTRecSegment2DProducer.h | 4 +- .../DTSegment/src/DTRecSegment4DAlgoFactory.h | 4 +- .../DTSegment/src/DTRecSegment4DProducer.cc | 7 +- .../DTSegment/src/DTRefitAndCombineReco4D.cc | 9 +- .../DTSegment/src/DTRefitAndCombineReco4D.h | 6 +- .../DTSegment/src/DTSegment4DT0Corrector.cc | 6 +- .../DTSegment/src/DTSegmentUpdator.cc | 9 +- .../DTSegment/src/DTSegmentUpdator.h | 6 +- .../DTSegment/test/DTAnalyzerDetailed.cc | 19 +- .../DTSegment/test/DTAnalyzerDetailed.h | 3 + RecoLocalMuon/DTSegment/test/DTMeanTimer.cc | 16 +- RecoLocalMuon/DTSegment/test/DTMeanTimer.h | 10 +- RecoLocalMuon/DTSegment/test/DTSegAnalyzer.cc | 19 +- RecoLocalMuon/DTSegment/test/DTSegAnalyzer.h | 3 + .../Records/interface/TkPixelCPERecord.h | 1 - .../plugins/PixelThresholdClusterizer.cc | 20 +- .../plugins/PixelThresholdClusterizer.h | 4 +- .../PixelThresholdClusterizerForBricked.cc | 228 + .../PixelThresholdClusterizerForBricked.h | 80 + .../plugins/SiPixelClusterProducer.cc | 4 + .../plugins/SiPixelDigisClustersFromSoA.cc | 14 +- .../plugins/SiPixelRawToClusterGPUKernel.cu | 39 +- .../plugins/SiPixelRawToClusterGPUKernel.h | 59 +- .../plugins/gpuCalibPixel.h | 2 +- .../plugins/gpuClusterChargeCut.h | 2 +- .../plugins/gpuClustering.h | 2 +- .../python/SiPixelClusterizer_cfi.py | 9 +- .../python/siPixelClustersPreSplitting_cff.py | 9 +- .../plugins/BuildFile.xml | 5 +- .../SiPixelRecHits/interface/PixelCPEBase.h | 4 +- .../SiPixelRecHits/interface/PixelCPEFast.h | 1 - .../interface/PixelCPEGeneric.h | 6 +- .../interface/PixelCPEGenericForBricked.h | 77 + .../SiPixelRecHits/interface/pixelCPEforGPU.h | 33 +- .../plugins/PixelCPEGenericESProducer.cc | 29 +- .../plugins/PixelRecHitGPUKernel.cu | 2 +- .../plugins/SiPixelRecHitSoAFromLegacy.cc | 4 +- .../python/PixelCPEGeneric_cfi.py | 11 +- .../python/SiPixelRecHits_cfi.py | 6 + .../SiPixelRecHits/src/PixelCPEBase.cc | 2 +- .../SiPixelRecHits/src/PixelCPEFast.cc | 40 +- .../SiPixelRecHits/src/PixelCPEGeneric.cc | 49 +- .../src/PixelCPEGenericForBricked.cc | 449 ++ .../SiPixelRecHits/test/SiPixelDBTest_cfg.py | 88 - .../plugins/ExpressLumiProducer.cc | 22 +- RecoMET/Configuration/python/RecoPFMET_cff.py | 3 +- .../plugins/EcalDeadCellDeltaRFilter.cc | 123 +- .../interface/METSignificanceProducer.h | 3 + .../src/METSignificanceProducer.cc | 9 +- .../plugins/TrackExtenderWithMTD.cc | 9 +- .../GlobalMuonProducer/src/TevMuonProducer.cc | 1 - .../GlobalMuonProducer/test/BuildFile.xml | 2 - .../interface/DynamicTruncation.h | 27 +- .../interface/GlobalMuonRefitter.h | 7 +- .../interface/GlobalTrajectoryBuilderBase.h | 8 + .../interface/MuonTrackingRegionBuilder.h | 22 +- .../interface/ThrParameters.h | 4 +- .../src/DynamicTruncation.cc | 42 +- .../src/GlobalMuonRefitter.cc | 7 +- .../src/GlobalTrajectoryBuilderBase.cc | 11 +- .../src/MuonTrackingRegionBuilder.cc | 40 +- .../GlobalTrackingTools/src/ThrParameters.cc | 29 +- .../interface/MuonCkfTrajectoryBuilder.h | 2 + .../src/MuonCkfTrajectoryBuilder.cc | 5 +- .../interface/CSCTimingExtractor.h | 3 + .../interface/DTTimingExtractor.h | 6 + .../interface/MuonIdTruthInfo.h | 4 +- .../interface/MuonShowerDigiFiller.h | 1 + .../plugins/MuonIdProducer.cc | 16 +- .../plugins/MuonIdProducer.h | 1 + .../src/CSCTimingExtractor.cc | 7 +- .../src/DTTimingExtractor.cc | 13 +- .../MuonIdentification/src/MuonIdTruthInfo.cc | 16 +- .../src/StandAloneMuonProducer.cc | 3 +- .../interface/StandAloneTrajectoryBuilder.h | 14 +- .../src/StandAloneTrajectoryBuilder.cc | 17 +- .../interface/L1MuonRegionProducer.h | 20 +- .../interface/TrackerSeedCleaner.h | 3 + .../plugins/BuildFile.xml | 1 + .../plugins/TSGForOIDNN.cc | 1014 +++ .../plugins/TSGForOIFromL2.cc | 37 +- .../plugins/TSGForOIFromL2.h | 12 +- .../plugins/TSGForRoadSearch.cc | 11 +- .../plugins/TSGForRoadSearch.h | 5 +- .../plugins/TSGFromL1Muon.cc | 12 +- .../plugins/TSGFromL1Muon.h | 3 +- .../plugins/TSGFromL2Muon.cc | 10 +- .../plugins/TSGFromL2Muon.h | 2 + .../plugins/TSGFromOrderedHits.cc | 4 +- .../plugins/TSGFromOrderedHits.h | 3 +- .../plugins/TSGFromPropagation.cc | 25 +- .../plugins/TSGFromPropagation.h | 7 +- .../TrackerSeedGenerator/plugins/TSGSmart.cc | 7 +- .../TrackerSeedGenerator/plugins/TSGSmart.h | 1 + .../python/customizeOIseeding.py | 34 + .../src/L1MuonPixelTrackFitter.cc | 5 +- .../src/L1MuonRegionProducer.cc | 22 +- .../src/TrackerSeedCleaner.cc | 5 +- .../interface/DirectMuonTrajectoryBuilder.h | 5 +- .../interface/MuonSeedDetLayer.h | 72 - .../TrackingTools/interface/MuonTrackLoader.h | 6 +- .../src/DirectMuonTrajectoryBuilder.cc | 7 +- RecoMuon/TrackingTools/src/MuonTrackLoader.cc | 32 +- .../python/RecoCTPPS_EventContent_cff.py | 3 + RecoPPS/Configuration/python/recoCTPPS_cff.py | 17 +- .../totemTiming_digiConverter_reco_cfg.py | 45 +- .../plugins/BuildFile.xml | 1 + .../plugins/CTPPSProtonProducer.cc | 101 +- .../python/ctppsProtons_cff.py | 85 +- .../PFProducer/interface/PFEGammaFilters.h | 13 + .../PFProducer/python/particleFlow_cff.py | 22 + RecoParticleFlow/PFProducer/src/PFAlgo.cc | 8 + .../PFProducer/src/PFEGammaFilters.cc | 189 +- .../interface/ClusterShapeTrajectoryFilter.h | 1 + .../LowPtClusterShapeSeedComparitor.h | 20 +- .../interface/PixelTripletLowPtGenerator.h | 11 +- .../interface/ThirdHitPrediction.h | 10 +- .../interface/TrackFitter.h | 4 +- .../plugins/ClusterShapeSeedComparitor.cc | 20 +- .../src/ClusterShapeTrajectoryFilter.cc | 12 +- .../src/LowPtClusterShapeSeedComparitor.cc | 22 +- .../src/PixelTripletLowPtGenerator.cc | 19 +- .../src/ThirdHitPrediction.cc | 21 +- .../PixelLowPtUtilities/src/TrackFitter.cc | 5 +- .../PixelTrackFitting/interface/BrokenLine.h | 27 +- .../interface/KFBasedPixelFitter.h | 6 +- .../PixelTrackFitting/interface/PixelFitter.h | 6 +- .../interface/PixelFitterBase.h | 6 +- .../PixelFitterByConformalMappingAndLine.h | 4 +- .../interface/PixelFitterByHelixProjections.h | 8 +- .../interface/PixelNtupletsFitter.h | 4 +- .../interface/PixelTrackReconstruction.h | 14 +- .../plugins/KFBasedPixelFitterProducer.cc | 47 +- ...FitterByConformalMappingAndLineProducer.cc | 32 +- .../PixelFitterByHelixProjectionsProducer.cc | 27 +- .../plugins/PixelNtupletsFitterProducer.cc | 3 +- ...PixelTrackCleanerBySharedHitsESProducer.cc | 2 - .../plugins/PixelTrackDumpCUDA.cc | 1 - .../plugins/PixelTrackProducer.cc | 1 - .../plugins/PixelTrackProducerFromSoA.cc | 1 - .../plugins/PixelTrackSoAFromCUDA.cc | 1 - .../PixelTrackFitting/plugins/storeTracks.h | 1 - .../src/KFBasedPixelFitter.cc | 5 +- .../PixelFitterByConformalMappingAndLine.cc | 12 +- .../src/PixelFitterByHelixProjections.cc | 17 +- .../src/PixelNtupletsFitter.cc | 4 +- .../src/PixelTrackReconstruction.cc | 17 +- .../PixelTrackFitting/test/PixelTrackTest.cc | 1 - .../interface/CAHitQuadrupletGenerator.h | 11 +- .../interface/CAHitTripletGenerator.h | 11 +- .../interface/CosmicHitTripletGenerator.h | 7 +- ...osmicHitTripletGeneratorFromLayerTriplet.h | 5 +- .../interface/CosmicLayerTriplets.h | 22 +- .../plugins/BrokenLineFitOnGPU.h | 14 +- .../PixelTriplets/plugins/CAConstants.h | 14 +- .../PixelTriplets/plugins/CAHitNtupletCUDA.cc | 6 +- .../plugins/CAHitNtupletEDProducerT.cc | 2 +- .../plugins/CAHitNtupletGeneratorKernels.cc | 19 +- .../plugins/CAHitNtupletGeneratorKernels.cu | 33 +- .../plugins/CAHitNtupletGeneratorKernels.h | 3 +- .../CAHitNtupletGeneratorKernelsImpl.h | 13 +- .../plugins/CombinedHitTripletGenerator.cc | 2 +- .../PixelTriplets/plugins/GPUCACell.h | 22 +- .../plugins/PixelTripletHLTGenerator.cc | 26 +- .../plugins/PixelTripletHLTGenerator.h | 5 + .../plugins/PixelTripletLargeTipGenerator.cc | 42 +- .../plugins/PixelTripletLargeTipGenerator.h | 13 +- .../plugins/PixelTripletNoTipGenerator.cc | 18 +- .../plugins/PixelTripletNoTipGenerator.h | 12 +- .../plugins/ThirdHitCorrection.cc | 28 +- .../plugins/ThirdHitCorrection.h | 32 +- .../PixelTriplets/plugins/gpuFishbone.h | 19 +- .../PixelTriplets/plugins/gpuPixelDoublets.h | 10 +- .../plugins/gpuPixelDoubletsAlgos.h | 2 +- .../src/CAHitQuadrupletGenerator.cc | 11 +- .../src/CAHitTripletGenerator.cc | 14 +- .../src/CosmicHitTripletGenerator.cc | 14 +- ...smicHitTripletGeneratorFromLayerTriplet.cc | 23 +- .../PixelTriplets/src/CosmicLayerTriplets.cc | 19 +- .../PixelTriplets/test/CAsizes_t.cpp | 2 +- .../interface/EcalSimple2007H4TBAnalyzer.h | 41 +- .../src/EcalSimple2007H4TBAnalyzer.cc | 113 +- .../EcalTBWeightUncalibRecHitProducer.h | 44 +- .../src/EcalTBWeightUncalibRecHitProducer.cc | 127 +- .../interface/L1THLTTauMatching.h | 2 + .../HLTProducers/python/deepTauAtHLT.py | 140 +- .../HLTProducers/src/L1THLTTauMatching.cc | 25 +- .../src/TauRegionalPixelSeedGenerator.h | 20 +- .../src/TrackingRegionsFromBeamSpotAndL2Tau.h | 16 +- RecoTauTag/RecoTau/plugins/DeepTauId.cc | 9 + RecoTauTag/RecoTau/plugins/PFTauSelector.cc | 6 +- .../RecoTau/plugins/PFTauSelectorDefinition.h | 20 +- .../TauDiscriminationAgainstCaloMuon.cc | 14 +- RecoTauTag/RecoTau/src/DeepTauBase.cc | 9 +- .../interface/BaseCkfTrajectoryBuilder.h | 14 +- .../interface/CkfTrackCandidateMakerBase.h | 14 +- .../interface/CkfTrajectoryBuilder.h | 7 +- .../TransientInitialStateEstimator.h | 7 +- .../plugins/CkfTrackCandidateMaker.h | 1 - .../CkfPattern/plugins/CkfTrajectoryMaker.h | 1 - .../plugins/GroupedCkfTrajectoryBuilder.cc | 1 + .../plugins/GroupedCkfTrajectoryBuilder.h | 1 - .../src/BaseCkfTrajectoryBuilder.cc | 35 +- .../src/CkfTrackCandidateMakerBase.cc | 47 +- .../CkfPattern/src/CkfTrajectoryBuilder.cc | 9 +- .../src/TransientInitialStateEstimator.cc | 19 +- ...inedHitPairGeneratorForPhotonConversion.cc | 2 +- ...tQuadrupletGeneratorForPhotonConversion.cc | 2 +- ...neratorFromLayerPairForPhotonConversion.cc | 34 +- ...eneratorFromLayerPairForPhotonConversion.h | 16 +- ...neratorFromLayerPairForPhotonConversion.cc | 17 +- ...eneratorFromLayerPairForPhotonConversion.h | 6 +- ...TrajectorySeedProducerFromSingleLegAlgo.cc | 12 +- ...nTrajectorySeedProducerFromSingleLegAlgo.h | 1 + .../plugins/SeedForPhotonConversion1Leg.cc | 28 +- .../plugins/SeedForPhotonConversion1Leg.h | 24 +- .../SeedForPhotonConversionFromQuadruplets.cc | 67 +- .../SeedForPhotonConversionFromQuadruplets.h | 13 +- .../python/ConversionStep2_cff.py | 48 +- .../python/ConversionStep_cff.py | 34 +- .../plugins/CkfDebugTrajectoryBuilder.h | 4 +- .../python/DetachedTripletStep_cff.py | 4 +- .../python/ElectronSeeds_cff.py | 68 +- .../python/InitialStepPreSplitting_cff.py | 2 +- .../python/InitialStep_cff.py | 4 +- .../python/JetCoreRegionalStep_cff.py | 33 +- .../python/LowPtTripletStep_cff.py | 4 +- .../python/MixedTripletStep_cff.py | 25 +- .../python/PixelLessStep_cff.py | 47 +- .../python/PixelPairStep_cff.py | 27 +- .../python/TobTecStep_cff.py | 79 +- .../MeasurementTrackerESProducer_cfi.py | 4 + RecoTracker/MkFit/README.md | 5 +- RecoTracker/MkFit/interface/MkFitGeometry.h | 6 +- RecoTracker/MkFit/plugins/BuildFile.xml | 3 + .../MkFit/plugins/MkFitEventOfHitsProducer.cc | 137 +- .../MkFit/plugins/MkFitGeometryESProducer.cc | 10 +- .../plugins/MkFitIterationConfigESProducer.cc | 92 +- .../MkFit/plugins/MkFitOutputConverter.cc | 4 +- RecoTracker/MkFit/plugins/MkFitProducer.cc | 28 +- .../plugins/createPhase1TrackerGeometry.cc | 202 +- .../plugins/createPhase1TrackerGeometry.h | 3 +- .../createPhase1TrackerGeometryAutoGen.acc | 296 +- .../MkFit/python/customizeHLTIter0ToMkFit.py | 1 + RecoTracker/MkFit/src/MkFitGeometry.cc | 7 +- .../TrackerMultipleScatteringRecord.h | 16 + .../src/TrackerMultipleScatteringRecord.cc | 4 + .../interface/CRackSeedGenerator.h | 5 +- .../interface/CosmicRegionalSeedGenerator.h | 25 +- .../interface/CosmicSeedCreator.h | 11 +- .../interface/CosmicTrackingRegion.h | 22 +- .../interface/CtfSpecialSeedGenerator.h | 8 + .../interface/EtaPhiMeasurementEstimator.h | 1 - .../interface/SeedGeneratorForCRack.h | 15 +- .../interface/SeedGeneratorForCosmics.h | 25 +- .../interface/SimpleCosmicBONSeeder.h | 9 +- ...binatorialSeedGeneratorForCosmicsP5_cff.py | 4 +- .../src/BeamHaloPairGenerator.cc | 4 +- .../src/CRackSeedGenerator.cc | 9 +- .../src/CosmicRegionalSeedGenerator.cc | 65 +- .../src/CosmicSeedCreator.cc | 10 +- .../src/CosmicSeedGenerator.cc | 6 +- .../src/CosmicTrackingRegion.cc | 18 +- .../src/CtfSpecialSeedGenerator.cc | 25 +- .../src/GenericPairGenerator.cc | 4 +- .../src/GenericTripletGenerator.cc | 6 +- .../src/SeedGeneratorForCRack.cc | 35 +- .../src/SeedGeneratorForCosmics.cc | 54 +- .../src/SimpleCosmicBONSeeder.cc | 32 +- .../interface/CombinedHitPairGenerator.h | 2 - .../interface/CosmicHitPairGenerator.h | 6 +- .../CosmicHitPairGeneratorFromLayerPair.h | 30 +- .../TkHitPairs/interface/CosmicLayerPairs.h | 23 +- .../interface/HitPairGeneratorFromLayerPair.h | 13 +- .../TkHitPairs/interface/LayerHitMapCache.h | 8 +- .../TkHitPairs/plugins/HitPairEDProducer.cc | 23 +- .../src/CombinedHitPairGenerator.cc | 9 +- .../TkHitPairs/src/CosmicHitPairGenerator.cc | 14 +- .../CosmicHitPairGeneratorFromLayerPair.cc | 71 +- .../TkHitPairs/src/CosmicLayerPairs.cc | 23 +- .../src/HitPairGeneratorFromLayerPair.cc | 41 +- RecoTracker/TkHitPairs/src/InnerDeltaPhi.cc | 10 +- RecoTracker/TkHitPairs/src/InnerDeltaPhi.h | 6 +- .../interface/LongitudinalBendingCorrection.h | 8 +- .../MultipleScatteringParametrisation.h | 13 +- .../MultipleScatteringParametrisationMaker.h | 26 + .../interface/PixelRecoUtilities.h | 37 +- .../interface/rangesIntersect.h | 25 - .../TkMSParametrization/plugins/BuildFile.xml | 10 + ...catteringParametrisationMakerESProducer.cc | 44 + ..._MultipleScatteringParametrisationMaker.cc | 4 + .../TkMSParametrization/src/MSLayersKeeper.h | 1 - .../src/MSLayersKeeperX0AtEta.cc | 16 +- .../src/MSLayersKeeperX0AtEta.h | 13 +- .../src/MSLayersKeeperX0Averaged.cc | 14 +- .../src/MSLayersKeeperX0Averaged.h | 12 +- .../src/MSLayersKeeperX0DetLayer.cc | 5 +- .../src/MSLayersKeeperX0DetLayer.h | 6 +- .../src/MultipleScatteringGeometry.cc | 28 +- .../src/MultipleScatteringGeometry.h | 13 +- .../src/MultipleScatteringParametrisation.cc | 51 +- .../MultipleScatteringParametrisationMaker.cc | 28 + .../src/PixelRecoUtilities.cc | 15 - .../TkMSParametrization/test/TestMS.cc | 25 +- .../MultiHitGeneratorFromPairAndLayers.h | 1 - ...ultiHitGeneratorFromPairAndLayersFactory.h | 4 +- .../TkSeedGenerator/interface/SeedCreator.h | 1 - .../interface/SeedCreatorFactory.h | 4 +- .../SeedCreatorFromRegionHitsEDProducerT.h | 2 +- .../interface/SeedFromProtoTrack.h | 25 +- .../plugins/CombinedMultiHitGenerator.cc | 4 +- .../plugins/MultiHitFromChi2EDProducer.cc | 5 +- .../plugins/MultiHitGeneratorFromChi2.cc | 48 +- .../plugins/MultiHitGeneratorFromChi2.h | 19 +- .../plugins/SeedFromConsecutiveHitsCreator.cc | 53 +- .../plugins/SeedFromConsecutiveHitsCreator.h | 36 +- ...dFromConsecutiveHitsStraightLineCreator.cc | 2 +- ...edFromConsecutiveHitsStraightLineCreator.h | 4 +- ...edFromConsecutiveHitsTripletOnlyCreator.cc | 12 +- ...eedFromConsecutiveHitsTripletOnlyCreator.h | 4 +- .../SeedGeneratorFromProtoTracksEDProducer.cc | 24 +- .../SeedGeneratorFromProtoTracksEDProducer.h | 13 +- .../SeedGeneratorFromRegionHitsEDProducer.cc | 2 +- .../TkSeedGenerator/src/SeedFromProtoTrack.cc | 36 +- .../DisplacedGeneralLayerTriplet_cfi.py | 20 +- .../python/MixedLayerPairs_cfi.py | 6 +- .../python/MixedLayerTriplets_cfi.py | 10 +- .../python/PixelAndStripLayerPairs_cfi.py | 10 +- .../python/PixelLayerPairs_cfi.py | 4 +- .../python/PixelLayerTriplets_cfi.py | 39 +- ...xelLessLayerPairs4PixelLessTracking_cfi.py | 2 +- .../python/PixelLessLayerPairs_cfi.py | 6 +- .../python/TobTecLayerPairs_cfi.py | 10 +- .../interface/GlobalTrackingRegion.h | 11 +- ...GlobalTrackingRegionProducerFromBeamSpot.h | 19 +- .../RectangularEtaPhiTrackingRegion.h | 51 +- .../interface/TrackingRegion.h | 6 +- .../AreaSeededTrackingRegionsBuilder.cc | 23 +- .../AreaSeededTrackingRegionsBuilder.h | 17 +- .../AreaSeededTrackingRegionsProducer.h | 2 +- ...didatePointSeededTrackingRegionsProducer.h | 28 +- .../CandidateSeededTrackingRegionsProducer.h | 24 +- ...GlobalTrackingRegionWithVerticesProducer.h | 23 +- ...reaTrackingRegionsSeedingLayersProducer.cc | 2 +- .../PointSeededTrackingRegionsProducer.h | 23 +- .../src/GlobalTrackingRegion.cc | 8 +- .../TkTrackingRegions/src/OuterEstimator.h | 6 +- .../src/RectangularEtaPhiTrackingRegion.cc | 59 +- .../interface/GsfTrackProducerAlgorithm.h | 71 - .../interface/KfTrackProducerBase.h | 12 +- .../interface/TrackProducerBase.h | 40 +- .../interface/TrackProducerBase.icc | 94 +- .../TrackProducer/plugins/DAFTrackProducer.cc | 6 +- .../TrackProducer/plugins/GsfTrackProducer.cc | 16 +- .../TrackProducer/plugins/GsfTrackRefitter.cc | 6 +- .../plugins/TrackExtraRekeyer.cc | 61 + .../TrackProducer/plugins/TrackProducer.cc | 14 +- .../TrackProducer/plugins/TrackProducer.h | 1 + .../plugins/TrackProducerFromPatMuons.cc | 55 + .../TrackProducer/plugins/TrackRefitter.cc | 14 +- .../TrackProducer/plugins/TrackRefitter.h | 2 + RecoTracker/TrackProducer/test/BuildFile.xml | 7 + .../TrackProducer/test/refitFromAOD.py | 84 + .../TrackProducer/test/refitFromMINIAOD.py | 83 + .../test/testMuonTrackRefitting.cpp | 2 + .../test/testMuonTrackRefitting.sh | 13 + .../interface/GSTransientTrackingRecHit.h | 8 - .../python/TTRHBuilderWithTemplate_cfi.py | 4 + .../TransientTrackingRecHitBuilder_cfi.py | 3 + .../interface/BeamSpotAnalyzer.h | 57 - .../interface/BeamSpotFromDB.h | 38 - .../interface/BeamSpotWrite2DB.h | 43 - .../plugins/BeamSpotAnalyzer.cc | 143 +- .../plugins/BeamSpotFromDB.cc | 52 +- .../plugins/BeamSpotOnlineProducer.cc | 16 +- .../plugins/BeamSpotWrite2DB.cc | 97 +- .../plugins/OnlineBeamSpotESProducer.cc | 112 +- .../python/BeamSpotOnline_cff.py | 10 +- .../python/BeamSpotOnline_cfi.py | 16 +- .../BeamSpotProducer/python/BeamSpot_cfi.py | 8 + ...rs.py => test_onlineBeamSpotESProducer.py} | 41 +- .../interface/ReconstructorFromLinPtFinder.h | 26 - .../interface/CombinedKinematicConstraintT.h | 218 - .../test/KinematicState_t.cpp | 6 +- .../MonteCarloLinearizationPointFinder.h | 33 - .../src/MonteCarloLinearizationPointFinder.cc | 28 - .../CaloSimAlgos/interface/CaloHitResponse.h | 20 +- .../CaloSimAlgos/interface/CaloVNoisifier.h | 19 - .../CaloSimAlgos/src/CaloHitResponse.cc | 60 +- .../{ => plugins}/BuildFile.xml | 5 +- .../{src => plugins}/CastorTTRecord.cc | 49 +- .../src/CastorTTRecord.h | 47 - .../CastorTechTrigProducer/src/SealModule.cc | 5 - .../src/EcalEBTrigPrimTestAlgo.cc | 6 +- .../interface/EcalFEtoDigi.h | 17 +- .../src/EcalFEtoDigi.cc | 27 +- .../EcalSelectiveReadoutSuppressor.h | 9 +- .../src/EcalSelectiveReadoutSuppressor.cc | 56 +- .../interface/EcalSRCondTools.h | 11 +- .../interface/EcalSelectiveReadoutProducer.h | 5 +- .../src/EcalSRCondTools.cc | 35 +- .../src/EcalSelectiveReadoutProducer.cc | 36 +- .../EcalSimAlgos/interface/APDShape.h | 13 +- .../EcalSimAlgos/interface/EBShape.h | 13 +- .../EcalSimAlgos/interface/EEShape.h | 13 +- .../interface/EcalSignalGenerator.h | 128 +- SimCalorimetry/EcalSimAlgos/src/APDShape.cc | 9 +- SimCalorimetry/EcalSimAlgos/src/EBShape.cc | 9 +- SimCalorimetry/EcalSimAlgos/src/EEShape.cc | 9 +- .../EcalSimAlgos/test/testEcalShape.cpp | 9 +- .../interface/EcalDigiProducer.h | 1 - .../interface/EcalDigiProducer_Ph2.h | 1 - .../plugins/PreMixingEcalWorker.cc | 13 +- .../EcalSimProducers/src/EcalDigiProducer.cc | 20 +- .../src/EcalDigiProducer_Ph2.cc | 13 +- .../interface/EcalTrigPrimFunctionalAlgo.h | 14 +- .../src/EcalFenixAmplitudeFilter.cc | 36 +- .../src/EcalFenixOddAmplitudeFilter.cc | 33 +- .../EcalTrigPrimAlgos/src/EcalFenixStrip.cc | 127 +- .../EcalTrigPrimAlgos/src/EcalFenixTcp.cc | 66 +- .../interface/ESZeroSuppressionProducer.h | 13 +- .../interface/EcalZeroSuppressionProducer.h | 23 +- .../src/ESZeroSuppressionProducer.cc | 26 +- .../src/EcalZeroSuppressionProducer.cc | 56 +- .../LCToCPAssociatorByEnergyScoreImpl.cc | 29 +- .../LCToCPAssociatorByEnergyScoreImpl.h | 32 +- .../LCToSCAssociatorByEnergyScoreImpl.cc | 40 +- .../LCToSCAssociatorByEnergyScoreImpl.h | 29 +- .../TSToSimTSAssociatorByEnergyScoreImpl.cc | 12 +- .../TSToSimTSAssociatorByEnergyScoreImpl.h | 26 + .../test/HGCHEbackSignalScalerAnalyzer.cc | 349 +- .../test/hgchebacksignalscaler_cfg.py | 10 +- .../test/hgcsiNoiseMapTester_cfg.py | 10 +- .../data/doseParams_3000fb_fluka-6.2.0.1.txt | 61 + .../data/sipmParams_geom-10.txt | 1 + .../HcalSimAlgos/interface/HFSimParameters.h | 2 + .../interface/HcalSignalGenerator.h | 19 +- .../HcalSimAlgos/interface/HcalTDC.h | 4 + .../interface/HcalTDCParameters.h | 1 + .../HcalSimAlgos/src/HFSimParameters.cc | 5 +- .../HcalSimAlgos/src/HcalElectronicsSim.cc | 7 + SimCalorimetry/HcalSimAlgos/src/HcalShapes.cc | 2 - SimCalorimetry/HcalSimAlgos/src/HcalTDC.cc | 27 +- .../HcalSimAlgos/test/CaloSamplesAnalyzer.cc | 26 +- .../HcalSimAlgos/test/HcalDigitizerTest.cc | 17 +- .../test/HcalSignalGeneratorTest.cpp | 20 +- .../plugins/PreMixingHcalWorker.cc | 15 +- .../python/hcalSimParameters_cfi.py | 10 +- .../HcalSimProducers/src/HcalDigitizer.cc | 8 +- .../interface/HcalFinegrainBit.h | 4 +- .../HcalTrigPrimAlgos/src/HcalFinegrainBit.cc | 51 +- .../src/HcalTriggerPrimitiveAlgo.cc | 9 +- .../{ => plugins}/BuildFile.xml | 4 +- .../{src => plugins}/HcalTTPDigiProducer.cc | 47 +- .../{src => plugins}/HcalTTPTriggerRecord.cc | 25 +- .../HcalTrigPrimDigiProducer.cc | 170 +- .../python/hcaltpdigi_cff.py | 2 + .../src/HcalTTPDigiProducer.h | 42 - .../src/HcalTTPTriggerRecord.h | 23 - .../src/HcalTrigPrimDigiProducer.h | 75 - .../HcalTrigPrimProducers/src/SealModule.cc | 9 - .../BuildFile.xml | 3 - .../DigiSimLinks/src/DTDigiSimLink.cc | 3 + .../GEMDigiSimLink/interface/GEMDigiSimLink.h | 63 +- .../GEMDigiSimLink/src/classes_def.xml | 6 +- .../interface/RPCDigiSimLinkfwd.h | 4 - .../interface/PixelDigiSimLinkfwd.h | 4 - .../interface/StripCompactDigiSimLinksfwd.h | 4 - .../interface/StripDigiSimLinkfwd.h | 4 - .../interface/MaterialAccountingCalo.h | 27 + .../ValidationFormats/src/classes.h | 1 + .../ValidationFormats/src/classes_def.xml | 7 + SimG4CMS/Calo/interface/HcalTestHistoClass.h | 1 - SimG4CMS/Calo/src/HFShowerLibrary.cc | 3 +- SimG4CMS/Calo/src/HGCalNumberingScheme.cc | 4 +- .../data/SingleDREAMDD4Hep.xml | 1 + SimG4CMS/CherenkovAnalysis/data/cms.xml | 35 + .../CherenkovAnalysis/data/singleDREAM.xml | 30 - .../plugins/DreamSensitiveDetectorBuilder.cc | 4 +- .../python/SingleDREAMXML_cfi.py | 3 +- SimG4CMS/CherenkovAnalysis/src/DreamSD.cc | 23 +- .../test/runSingleDREAMDD4Hep_cfg.py | 2 + SimG4CMS/EcalTestBeam/BuildFile.xml | 6 - SimG4CMS/EcalTestBeam/plugins/BuildFile.xml | 6 + SimG4CMS/FP420/BuildFile.xml | 1 - SimG4CMS/FP420/plugins/BuildFile.xml | 1 + SimG4CMS/Forward/BuildFile.xml | 2 - SimG4CMS/Forward/plugins/BuildFile.xml | 1 + SimG4CMS/ShowerLibraryProducer/BuildFile.xml | 2 - .../interface/HcalForwardLibWriter.h | 2 + .../plugins/BuildFile.xml | 2 + .../plugins/HcalForwardLibWriter.cc | 20 +- .../test/README_SL_production_recipe.txt | 40 + .../Application/interface/DDDWorldObserver.h | 21 - .../Application/interface/ExceptionHandler.h | 5 +- .../Application/interface/RunManagerMT.h | 2 - SimG4Core/Application/python/g4SimHits_cfi.py | 3 +- SimG4Core/Application/src/ExceptionHandler.cc | 37 +- SimG4Core/Application/src/RunManagerMT.cc | 12 +- .../Application/src/RunManagerMTWorker.cc | 3 +- .../test/plugins/DD4hepTestDDDWorld.cc | 21 +- .../test/plugins/DD4hepTestG4Geometry.cc | 15 +- SimG4Core/GFlash/TB/TreeProducerCalibSimul.h | 70 +- .../interface/GeometryProducer.h | 12 + .../GeometryProducer/src/GeometryProducer.cc | 30 +- SimG4Core/MagneticField/src/FieldBuilder.cc | 1 - .../Notification/interface/ComponentBuilder.h | 14 - .../interface/ComponentFactoryByName.h | 42 - .../interface/DispatchableG4Step.h | 8 - SimG4Core/Notification/interface/OwnIt.h | 23 - .../interface/PrintGeomInfoAction.h | 64 - .../interface/PrintGeomSummary.h | 51 - .../interface/PrintMaterialBudgetInfo.h | 68 - .../PrintGeomInfo/interface/PrintSensitive.h | 32 - .../PrintGeomInfo/{ => plugins}/BuildFile.xml | 4 +- .../{src => plugins}/PrintGeomInfoAction.cc | 107 +- .../PrintGeomInfo/plugins/PrintGeomSolids.cc | 93 + .../{src => plugins}/PrintGeomSummary.cc | 45 +- .../PrintMaterialBudgetInfo.cc | 107 +- .../{src => plugins}/PrintSensitive.cc | 37 +- .../python/printGeomSolids_cff.py | 9 + SimG4Core/PrintGeomInfo/src/module.cc | 11 - .../PrintGeomInfo/test/SimFileCompare.cpp | 29 +- .../test/python/g4OverlapCheckBigXML_cfg.py | 56 + .../python/g4OverlapCheckBigXMLdd4hep_cfg.py | 58 + .../test/python/g4OverlapCheck_cfg.py | 14 +- .../test/python/g4OverlapCheck_dd4hep_cfg.py | 13 +- ...nfo_cfg.py => runMaterialBudgeInfo_cfg.py} | 18 +- .../test/python/runPrintSolid_cfg.py | 51 + .../PrintGeomInfo/test/python/runSens_cfg.py | 20 +- .../test/python/runSummary_cfg.py | 11 +- .../plugins/DataMixingHcalDigiWorkerProd.cc | 17 +- .../plugins/DataMixingHcalDigiWorkerProd.h | 6 +- .../plugins/DataMixingModule.cc | 3 +- .../plugins/DataMixingModule.h | 2 + .../MixingModule/plugins/MixingModule.cc | 15 +- .../MixingModule/plugins/MixingModule.h | 1 + .../MixingModule/plugins/MixingWorker.h | 16 +- .../MixingModule/plugins/MixingWorkerBase.h | 2 +- .../MixingModule/plugins/SecSourceAnalyzer.cc | 3 +- .../MixingModule/plugins/SecSourceAnalyzer.h | 2 +- ..._2017_5TeV_UltraLegacy_PoissonOOTPU_cfi.py | 17 + SimGeneral/TrackingAnalysis/BuildFile.xml | 1 - .../TrackingAnalysis/plugins/BuildFile.xml | 1 + SimMuon/DTDigitizer/src/DTDigitizer.cc | 6 +- .../GEMDigitizer/interface/GEMSignalModel.h | 1 + .../GEMDigitizer/plugins/GEMDigiProducer.cc | 1 + .../GEMDigitizer/python/muonGEMDigis_cfi.py | 6 +- SimMuon/GEMDigitizer/src/GEMDigiModule.cc | 11 +- SimMuon/GEMDigitizer/src/GEMSignalModel.cc | 3 + SimMuon/GEMDigitizer/src/ME0DigiModel.cc | 11 +- SimMuon/GEMDigitizer/test/BuildFile.xml | 8 - .../GEMDigitizer/test/GEMDigiSimLinkReader.cc | 447 -- .../GEMDigitizer/test/ME0DigiSimLinkReader.cc | 208 - SimMuon/MCTruth/interface/CSCHitAssociator.h | 21 +- SimMuon/MCTruth/interface/DTHitAssociator.h | 45 +- SimMuon/MCTruth/interface/GEMHitAssociator.h | 41 +- .../MCTruth/interface/MuonAssociatorByHits.h | 12 +- .../interface/MuonAssociatorByHitsHelper.h | 15 + SimMuon/MCTruth/interface/RPCHitAssociator.h | 38 +- .../interface/TrackerMuonHitExtractor.h | 2 +- ...nToTrackingParticleAssociatorByHitsImpl.cc | 19 +- ...onToTrackingParticleAssociatorByHitsImpl.h | 23 +- ...nToTrackingParticleAssociatorEDProducer.cc | 70 +- .../MCTruth/plugins/SeedToTrackProducer.cc | 33 +- SimMuon/MCTruth/plugins/SeedToTrackProducer.h | 18 +- SimMuon/MCTruth/src/CSCHitAssociator.cc | 24 +- SimMuon/MCTruth/src/DTHitAssociator.cc | 112 +- SimMuon/MCTruth/src/GEMHitAssociator.cc | 52 +- SimMuon/MCTruth/src/MuonAssociatorByHits.cc | 36 +- SimMuon/MCTruth/src/RPCHitAssociator.cc | 45 +- .../MCTruth/src/TrackerMuonHitExtractor.cc | 2 +- SimMuon/MCTruth/test/BuildFile.xml | 1 - .../plugins/PPSSimTrackProducer.cc | 36 +- .../plugins/DeadChannelsManager.cc | 2 +- .../plugins/DeadChannelsManager.h | 6 +- .../RPDigiProducer/plugins/RPDigiProducer.cc | 16 +- .../plugins/Phase2TrackerDigitizer.cc | 25 +- .../plugins/Phase2TrackerDigitizer.h | 2 +- .../Phase2TrackerDigitizerAlgorithm.cc | 41 +- .../plugins/Phase2TrackerDigitizerAlgorithm.h | 1 + .../plugins/PixelBrickedDigitizerAlgorithm.cc | 228 + .../plugins/PixelBrickedDigitizerAlgorithm.h | 26 + .../plugins/PixelDigitizerAlgorithm.h | 8 +- .../python/phase2TrackerDigitizer_cfi.py | 3 +- .../SiPixelChargeReweightingAlgorithm.cc | 21 +- SimTracker/TrackAssociation/BuildFile.xml | 1 - .../python/digiSimLinkPruner_cfi.py | 15 +- .../python/trackingParticlePrunerByGen_cfi.py | 7 +- .../TrackHistory/interface/VertexClassifier.h | 3 +- .../TrackHistory/interface/VertexHistory.h | 2 +- .../TrackHistory/src/VertexClassifier.cc | 9 +- SimTracker/TrackHistory/src/VertexHistory.cc | 2 +- .../plugins/TrackingMaterialProducer.cc | 24 +- .../trackingMaterialProducerHGCal_cfi.py | 23 +- ...alProducer10GeVNeutrino_ForHGCalPhaseII.py | 2 +- .../interface/OpticalFunctionsTransport.h | 15 +- .../interface/ProtonTransport.h | 11 +- .../src/OpticalFunctionsTransport.cc | 13 +- .../PPSProtonTransport/src/ProtonTransport.cc | 8 +- .../src/PseudoTopProducer.cc | 4 +- TopQuarkAnalysis/TopHitFit/src/Resolution.cc | 1 + .../TopTools/interface/TopologyWorker.h | 1718 ----- .../interface/defaultRKPropagator.h | 4 +- TrackPropagation/RungeKutta/test/RKTest.cc | 3 +- .../interface/CurvilinearJacobian.h | 25 - .../GsfTools/interface/GaussianSumUtilities.h | 154 - .../interface/GaussianSumUtilities.icc | 573 -- ...icc => CloseComponentsMergerESProducer.cc} | 38 +- .../plugins/CloseComponentsMergerESProducer.h | 30 - ...=> DistanceBetweenComponentsESProducer.cc} | 38 +- .../DistanceBetweenComponentsESProducer.h | 29 - TrackingTools/GsfTools/plugins/module.cc | 15 - TrackingTools/GsfTracking/BuildFile.xml | 1 - .../interface/GsfConstraintAtVertex.h | 11 +- .../python/CkfElectronCandidateMaker_cff.py | 2 + .../python/GsfElectronFittingSmoother_cfi.py | 4 +- .../GsfTracking/src/GsfConstraintAtVertex.cc | 28 +- .../KalmanUpdators/test/KFUpdator_t.cpp | 5 +- .../PatternTools/interface/MediumProperties.h | 7 - .../test/ClosestApproachInRPhi_t.cpp | 5 +- TrackingTools/Records/interface/Records.h | 5 - .../TrackFitters/interface/DebugHelpers.h | 13 +- .../plugins/KFFittingSmootherESProducer.cc | 41 +- .../TrackRefitter/interface/SeedTransformer.h | 30 +- .../interface/TrackTransformer.h | 3 - .../TrackRefitter/src/SeedTransformer.cc | 24 +- .../TrackRefitter/src/TrackTransformer.cc | 52 +- .../interface/MinHitsTrajectoryFilter.h | 32 +- .../python/TrajectoryFilter_cff.py | 6 +- .../TrajectoryState/test/testTSOS.cpp | 5 +- .../DCacheAdaptor/interface/DCacheFile.h | 69 +- .../plugins/DCacheStorageMaker.cc | 123 +- Utilities/DCacheAdaptor/src/DCacheFile.cc | 2 + Utilities/DavixAdaptor/interface/DavixFile.h | 73 +- .../DavixAdaptor/plugins/DavixStorageMaker.cc | 71 +- Utilities/DavixAdaptor/src/DavixFile.cc | 1 + Utilities/DavixAdaptor/test/davixcheck.cpp | 1 + Utilities/DavixAdaptor/test/davixread.cpp | 1 + .../test/davixreadfilenotfound.cpp | 1 + Utilities/DavixAdaptor/test/davixreadv.cpp | 1 + .../DavixAdaptor/test/davixreadwrongurl.cpp | 1 + Utilities/DavixAdaptor/test/http.cpp | 1 + Utilities/DavixAdaptor/test/http2.cpp | 1 + Utilities/DavixAdaptor/test/http3.cpp | 1 + Utilities/DavixAdaptor/test/http4.cpp | 1 + .../LStoreAdaptor/interface/LStoreFile.h | 101 +- .../plugins/LStoreStorageMaker.cc | 52 +- Utilities/LStoreAdaptor/src/LStoreFile.cc | 2 + .../scripts/CMSSWReleaseDependency.rules | 1 - .../ReleaseScripts/scripts/addOnTests.py | 6 +- .../StaticAnalyzers/scripts/callgraph.py | 70 +- Utilities/StaticAnalyzers/src/CmsSupport.cpp | 7 +- .../StaticAnalyzers/src/FunctionDumper.cpp | 2 +- Utilities/StorageFactory/README.md | 42 + Utilities/StorageFactory/bin/anycp.cpp | 2 + Utilities/StorageFactory/interface/File.h | 97 +- Utilities/StorageFactory/interface/IOBuffer.h | 46 +- .../StorageFactory/interface/IOChannel.h | 41 - Utilities/StorageFactory/interface/IOFlags.h | 34 +- Utilities/StorageFactory/interface/IOInput.h | 24 - Utilities/StorageFactory/interface/IOOutput.h | 24 - .../StorageFactory/interface/IOPosBuffer.h | 76 +- Utilities/StorageFactory/interface/IOTypes.h | 49 +- .../StorageFactory/interface/LocalCacheFile.h | 73 +- .../interface/LocalFileSystem.h | 41 +- .../StorageFactory/interface/RemoteFile.h | 29 +- Utilities/StorageFactory/interface/Storage.h | 75 +- .../StorageFactory/interface/StorageAccount.h | 221 +- .../interface/StorageAccountProxy.h | 75 +- .../StorageFactory/interface/StorageFactory.h | 131 +- .../StorageFactory/interface/StorageMaker.h | 61 +- .../interface/StorageMakerFactory.h | 7 +- .../plugins/GsiFTPStorageMaker.cc | 34 +- .../plugins/HttpStorageMaker.cc | 31 +- .../plugins/LocalStorageMaker.cc | 59 +- .../plugins/StormLCGStorageMaker.cc | 117 +- .../plugins/StormStorageMaker.cc | 119 +- Utilities/StorageFactory/src/File.cc | 50 +- Utilities/StorageFactory/src/IOChannel.cc | 93 - Utilities/StorageFactory/src/IOInput.cc | 231 - Utilities/StorageFactory/src/IOOutput.cc | 211 - .../StorageFactory/src/LocalCacheFile.cc | 4 +- .../StorageFactory/src/LocalFileSystem.cc | 10 +- Utilities/StorageFactory/src/RemoteFile.cc | 2 + .../src/StatisticsSenderService.cc | 18 +- Utilities/StorageFactory/src/Storage.cc | 448 +- .../StorageFactory/src/StorageAccount.cc | 3 +- .../StorageFactory/src/StorageAccountProxy.cc | 7 +- .../StorageFactory/src/StorageFactory.cc | 2 + Utilities/StorageFactory/src/StorageMaker.cc | 2 + .../StorageFactory/src/StorageMakerFactory.cc | 2 + Utilities/StorageFactory/src/SysFile.h | 2 + Utilities/StorageFactory/src/SysIOChannel.h | 10 - Utilities/StorageFactory/src/UnixFile.cc | 97 +- Utilities/StorageFactory/src/UnixIOChannel.cc | 132 - Utilities/StorageFactory/test/Test.h | 2 +- Utilities/StorageFactory/test/any.cpp | 1 + Utilities/StorageFactory/test/ftp.cpp | 1 + Utilities/StorageFactory/test/ftp2.cpp | 1 + Utilities/StorageFactory/test/local.cpp | 1 + Utilities/StorageFactory/test/local2.cpp | 1 + Utilities/StorageFactory/test/local3.cpp | 2 + Utilities/StorageFactory/test/randomread.cpp | 1 + Utilities/StorageFactory/test/rfio2.cpp | 2 + Utilities/StorageFactory/test/rfio3.cpp | 2 + Utilities/StorageFactory/test/t0Repack.cpp | 2 + Utilities/StorageFactory/test/write.cpp | 2 + .../XrdAdaptor/plugins/XrdStorageMaker.cc | 282 +- Utilities/XrdAdaptor/src/XrdFile.cc | 16 +- Utilities/XrdAdaptor/src/XrdFile.h | 76 +- Utilities/XrdAdaptor/src/XrdRequest.h | 18 +- Utilities/XrdAdaptor/src/XrdRequestManager.cc | 19 +- Utilities/XrdAdaptor/src/XrdRequestManager.h | 4 + Utilities/XrdAdaptor/src/XrdStatistics.cc | 2 + Utilities/XrdAdaptor/src/XrdStatistics.h | 4 +- .../python/cscRecHitValidation_cfi.py | 2 + Validation/CTPPS/alignment/2021.xml | 8 +- Validation/CTPPS/alignment/alignment_2022.xml | 13 + .../CTPPSProtonReconstructionPlotter.cc | 28 +- .../plugins/CTPPSTrackDistributionPlotter.cc | 55 +- .../simu_config/profile_2016_postTS2_cff.py | 15 +- .../simu_config/profile_2016_preTS2_cff.py | 15 +- .../simu_config/profile_2022_default_cff.py | 24 + .../CTPPS/python/simu_config/year_2016_cff.py | 2 + .../CTPPS/python/simu_config/year_2017_cff.py | 22 +- .../CTPPS/python/simu_config/year_2018_cff.py | 22 +- .../CTPPS/python/simu_config/year_2021_cff.py | 23 +- .../CTPPS/python/simu_config/year_2022_cff.py | 54 + Validation/CTPPS/test/simu/run_multiple | 2 + Validation/CTPPS/test/simu/template_cfg.py | 3 - .../Configuration/python/mtdSimValid_cff.py | 4 +- .../python/postValidation_cff.py | 3 +- .../DTValidation_RelVal_fromRECO_local_cfg.py | 4 +- .../plugins/EcalMixingModuleValidation.cc | 42 +- .../plugins/EcalMixingModuleValidation.h | 14 +- .../plugins/EcalSelectiveReadoutValidation.cc | 111 +- .../plugins/EcalSelectiveReadoutValidation.h | 15 +- .../EcalHits/src/EcalSimHitsValidProducer.cc | 4 +- .../interface/BasicHepMCValidation.h | 1 + .../EventGenerator/interface/DQMHelper.h | 21 +- .../interface/DrellYanValidation.h | 1 + .../interface/HiggsValidation.h | 1 + .../EventGenerator/interface/TauValidation.h | 1 + .../EventGenerator/interface/WValidation.h | 1 + .../plugins/BasicHepMCValidation.cc | 5 +- .../plugins/DrellYanValidation.cc | 5 +- .../EventGenerator/plugins/HiggsValidation.cc | 5 +- .../plugins/MBUEandQCDValidation.cc | 5 +- .../plugins/MBUEandQCDValidation.h | 1 + .../EventGenerator/plugins/TauValidation.cc | 5 +- .../EventGenerator/plugins/WValidation.cc | 3 +- Validation/EventGenerator/src/DQMHelper.cc | 17 +- Validation/Geometry/macros/MatBudgetVolume.C | 15 +- Validation/Geometry/plugins/BuildFile.xml | 17 + .../plugins/MaterialBudgetHcalAnalysis.cc | 339 + .../plugins/MaterialBudgetHcalProducer.cc | 504 ++ .../Geometry/python/plot_hgcal_utils.py | 15 +- ...FromVertexUpToInFrontOfMuonStations_cfg.py | 42 +- Validation/Geometry/test/runP_HCALP_cfg.py | 59 + .../python/HGCalValidator_cfi.py | 2 +- Validation/HGCalValidation/python/html.py | 2 +- .../scripts/hgcalPerformanceValidation.py | 28 +- .../HcalHits/interface/HcalSimHitStudy.h | 84 - .../HcalHits/interface/SimG4HcalValidation.h | 106 - .../HcalHits/interface/ZdcSimHitStudy.h | 130 - Validation/HcalHits/plugins/BuildFile.xml | 1 + .../{src => plugins}/HcalSimHitStudy.cc | 86 +- .../{src => plugins}/ZdcSimHitStudy.cc | 102 +- .../HcalHits/src/SimG4HcalValidation.cc | 96 +- Validation/HcalHits/src/module.cc | 12 - .../MtdValidation/plugins/BuildFile.xml | 33 +- .../plugins/Primary4DVertexValidation.cc | 1472 +++++ .../MtdValidation/test/mtdValidation_cfg.py | 4 +- .../interface/CSCALCTDigiValidation.h | 14 +- .../interface/CSCBaseValidation.h | 7 + .../interface/CSCCLCTDigiValidation.h | 17 +- .../CSCCLCTPreTriggerDigiValidation.h | 37 + .../interface/CSCComparatorDigiValidation.h | 3 +- .../CSCCorrelatedLCTDigiValidation.h | 39 + .../interface/CSCStripDigiValidation.h | 3 - .../interface/CSCStubEfficiencyValidation.h | 32 +- .../MuonCSCDigis/interface/CSCStubMatcher.h | 6 + .../interface/CSCStubResolutionValidation.h | 38 + .../interface/CSCWireDigiValidation.h | 1 - .../MuonCSCDigis/plugins/CSCDigiValidation.cc | 53 +- .../MuonCSCDigis/plugins/CSCDigiValidation.h | 10 +- .../plugins/MuonCSCDigisHarvestor.cc | 22 +- .../python/cscDigiValidation_cfi.py | 55 +- .../MuonCSCDigis/python/muonCSCStubPSet.py | 8 + .../MuonCSCDigis/src/CSCALCTDigiValidation.cc | 45 +- .../MuonCSCDigis/src/CSCBaseValidation.cc | 26 +- .../MuonCSCDigis/src/CSCCLCTDigiValidation.cc | 69 +- .../src/CSCCLCTPreTriggerDigiValidation.cc | 70 + .../src/CSCComparatorDigiValidation.cc | 32 + .../src/CSCCorrelatedLCTDigiValidation.cc | 118 + .../src/CSCStripDigiValidation.cc | 31 +- .../src/CSCStubEfficiencyValidation.cc | 79 +- Validation/MuonCSCDigis/src/CSCStubMatcher.cc | 40 +- .../src/CSCStubResolutionValidation.cc | 148 + .../MuonCSCDigis/src/CSCWireDigiValidation.cc | 11 +- .../test/runCSCDigiHarvesting_cfg.py | 25 +- .../test/runCSCDigiValidation_cfg.py | 13 +- Validation/MuonGEMDigis/src/GEMDigiMatcher.cc | 13 +- Validation/MuonHits/BuildFile.xml | 1 + Validation/MuonHits/src/CSCSimHitMatcher.cc | 13 +- .../plugins/ElectronMcFakeValidator.cc | 334 +- .../plugins/ElectronMcFakeValidator.h | 14 +- .../ElectronMcMiniAODSignalValidator.cc | 121 +- .../ElectronMcMiniAODSignalValidator.h | 8 +- .../plugins/ElectronMcSignalValidator.cc | 586 +- .../plugins/ElectronMcSignalValidator.h | 8 +- .../python/ElectronIsolation_cfi.py | 50 +- ...tronMcFakeValidator_gedGsfElectrons_cfi.py | 20 +- .../ElectronMcSignalValidatorMiniAOD_cfi.py | 49 +- ...gnalValidatorPt1000_gedGsfElectrons_cfi.py | 23 +- ...onMcSignalValidator_gedGsfElectrons_cfi.py | 35 +- .../plugins/HitPixelLayersTPSelector.cc | 4 +- Validation/RecoParticleFlow/Makefile | 4 +- Validation/RecoParticleFlow/README.md | 27 +- Validation/RecoParticleFlow/test/compare.py | 73 +- .../test/{MinBias.jdl => condor_NuGunPU.jdl} | 24 +- .../test/{QCD.jdl => condor_QCD.jdl} | 20 +- .../test/{QCDPU.jdl => condor_QCDPU.jdl} | 15 +- .../RecoParticleFlow/test/condor_TenTauPU.jdl | 37 + .../test/{ZMM.jdl => condor_ZEEPU.jdl} | 24 +- .../RecoParticleFlow/test/condor_ZMMPU.jdl | 37 + .../RecoParticleFlow/test/crab/multicrab.py | 14 +- Validation/RecoParticleFlow/test/datasets.py | 15 +- .../RecoParticleFlow/test/run_relval.sh | 11 +- .../RecoTrack/plugins/MultiTrackValidator.cc | 6 + .../RecoTrack/python/plotting/plotting.py | 9 +- .../RecoTrack/python/plotting/validation.py | 82 +- .../RecoVertex/python/pvRecoSequence_cff.py | 141 +- 3301 files changed, 110948 insertions(+), 67173 deletions(-) delete mode 100644 Alignment/TrackerAlignment/plugins/AlignmentPrescaler.h delete mode 100644 AnalysisAlgos/TrackInfoProducer/interface/TrackInfoProducer.h delete mode 100644 AnalysisAlgos/TrackInfoProducer/src/SealModules.cc delete mode 100644 CalibCalorimetry/CastorCalib/interface/CastorPedestalsAnalysis.h delete mode 100644 CalibCalorimetry/CastorCalib/plugins/CastorHardcodeCalibrations.h delete mode 100644 CalibCalorimetry/CastorCalib/plugins/CastorTextCalibrations.h delete mode 100644 CalibCalorimetry/CastorCalib/plugins/SealModule.cc create mode 100644 CalibMuon/CSCCalibration/plugins/CSCL1TPLookupTableEP.cc create mode 100644 CalibMuon/CSCCalibration/python/CSCL1TPLookupTableEP_cff.py create mode 100644 CalibPPS/AlignmentGlobal/python/ALCARECOPPSAlignment_Output_cff.py create mode 100644 CalibPPS/AlignmentGlobal/python/ALCARECOPPSAlignment_cff.py create mode 100644 CalibPPS/AlignmentGlobal/python/PPSAlignmentHarvester_cff.py delete mode 100644 CalibPPS/AlignmentGlobal/python/ppsAlignmentHarvester_cfi.py delete mode 100644 CalibPPS/AlignmentGlobal/python/ppsAlignmentWorker_cfi.py create mode 100644 CalibPPS/AlignmentGlobal/test/run_analysis_cfg.py delete mode 100644 CalibPPS/AlignmentGlobal/test/run_analysis_manual_cfg.py create mode 100644 CalibPPS/ESProducers/plugins/PPSAlignmentConfigurationESSource.cc create mode 100644 CalibPPS/ESProducers/plugins/PPSAssociationCutsESSource.cc create mode 100644 CalibPPS/ESProducers/python/ctppsOpticalFunctions_non_DB_cff.py create mode 100644 CalibPPS/ESProducers/python/ppsAssociationCuts_non_DB_cff.py create mode 100644 CalibPPS/TimingCalibration/plugins/PPSDiamondSampicTimingCalibrationPCLHarvester.cc create mode 100644 CalibPPS/TimingCalibration/plugins/PPSDiamondSampicTimingCalibrationPCLWorker.cc create mode 100644 CalibPPS/TimingCalibration/python/ALCARECOPPSDiamondSampicTimingCalibHarvester_cff.py create mode 100644 CalibPPS/TimingCalibration/python/ALCARECOPPSDiamondSampicTimingCalib_Output_cff.py create mode 100644 CalibPPS/TimingCalibration/python/ALCARECOPPSDiamondSampicTimingCalib_cff.py create mode 100644 CalibPPS/TimingCalibration/test/DiamondSampicCalibrationHarvester_cfg.py create mode 100644 CalibPPS/TimingCalibration/test/DiamondSampicCalibrationWorker_cfg.py create mode 100755 CalibPPS/TimingCalibration/test/runDiamondSampicCalibration delete mode 100644 CalibTracker/SiPixelESProducers/interface/SiPixelCPEGenericDBErrorParametrization.h delete mode 100644 CalibTracker/SiPixelESProducers/interface/SiPixelFakeCPEGenericErrorParmESSource.h delete mode 100644 CalibTracker/SiPixelESProducers/plugins/SiPixelFakeCPEGenericErrorParmESSource.cc delete mode 100644 CalibTracker/SiPixelESProducers/python/SiPixelFakeCPEGenericErrorParmESSource_cfi.py delete mode 100644 CalibTracker/SiPixelESProducers/src/SiPixelCPEGenericDBErrorParametrization.cc create mode 100644 CalibTracker/SiPixelLorentzAngle/interface/SiPixelLorentzAngleCalibrationStruct.h create mode 100644 CalibTracker/SiPixelLorentzAngle/python/SiPixelLorentzAnglePCLHarvester_cfi.py create mode 100644 CalibTracker/SiPixelLorentzAngle/python/SiPixelLorentzAnglePCLWorker_cfi.py create mode 100644 CalibTracker/SiPixelLorentzAngle/src/SiPixelLorentzAnglePCLHarvester.cc create mode 100644 CalibTracker/SiPixelLorentzAngle/src/SiPixelLorentzAnglePCLWorker.cc create mode 100644 CalibTracker/SiStripCommon/interface/SiStripOnTrackClusterTableProducerBase.h delete mode 100644 CalibTracker/SiStripCommon/plugins/SiStripDetInfoFileWriter.h create mode 100644 CalibTracker/SiStripCommon/plugins/SiStripLorentzAngleRunInfoTableProducer.cc create mode 100644 CalibTracker/SiStripCommon/plugins/SiStripPositionCorrectionsTableProducer.cc create mode 100644 CalibTracker/SiStripCommon/python/customiseAlCaNano.py create mode 100644 CalibTracker/SiStripCommon/src/SiStripOnTrackClusterTableProducerBase.cc create mode 100644 CalibTracker/SiStripCommon/test/MakeCalibrationTrees/produceCalibrationTree_CosmicsLABP_cfg.py delete mode 100644 CalibTracker/SiStripDCS/plugins/FilterTrackerOn.h delete mode 100644 Calibration/HcalAlCaRecoProducers/BuildFile.xml delete mode 100644 Calibration/HcalAlCaRecoProducers/interface/AlCaEcalHcalReadoutsProducer.h delete mode 100644 Calibration/HcalAlCaRecoProducers/interface/AlCaHcalNoiseProducer.h rename Calibration/HcalAlCaRecoProducers/{src => plugins}/AlCaDiJetsProducer.cc (76%) create mode 100644 Calibration/HcalAlCaRecoProducers/plugins/AlCaEcalHcalReadoutsProducer.cc rename Calibration/HcalAlCaRecoProducers/{src => plugins}/AlCaGammaJetProducer.cc (85%) rename Calibration/HcalAlCaRecoProducers/{src => plugins}/AlCaHBHEMuonProducer.cc (87%) rename Calibration/HcalAlCaRecoProducers/{src => plugins}/AlCaHOCalibProducer.cc (95%) create mode 100644 Calibration/HcalAlCaRecoProducers/plugins/AlCaHcalHBHEMuonFilter.cc create mode 100644 Calibration/HcalAlCaRecoProducers/plugins/AlCaHcalHBHEMuonProducer.cc create mode 100644 Calibration/HcalAlCaRecoProducers/plugins/AlCaHcalHEMuonFilter.cc create mode 100644 Calibration/HcalAlCaRecoProducers/plugins/AlCaHcalIsotrkFilter.cc create mode 100644 Calibration/HcalAlCaRecoProducers/plugins/AlCaHcalIsotrkProducer.cc rename Calibration/HcalAlCaRecoProducers/{src => plugins}/AlCaHcalNoiseProducer.cc (64%) rename Calibration/HcalAlCaRecoProducers/{src => plugins}/AlCaIsoTracksProducer.cc (96%) rename Calibration/HcalAlCaRecoProducers/{src => plugins}/ProducerAnalyzer.cc (62%) create mode 100644 Calibration/HcalAlCaRecoProducers/python/ALCARECOHcalCalHBHEMuonProducerFilter_Output_cff.py create mode 100644 Calibration/HcalAlCaRecoProducers/python/ALCARECOHcalCalHBHEMuonProducerFilter_cff.py create mode 100644 Calibration/HcalAlCaRecoProducers/python/ALCARECOHcalCalHEMuonProducerFilter_Output_cff.py create mode 100644 Calibration/HcalAlCaRecoProducers/python/ALCARECOHcalCalHEMuonProducerFilter_cff.py create mode 100644 Calibration/HcalAlCaRecoProducers/python/ALCARECOHcalCalIsoTrkFilterNoHLT_Output_cff.py create mode 100644 Calibration/HcalAlCaRecoProducers/python/ALCARECOHcalCalIsoTrkProducerFilter_Output_cff.py create mode 100644 Calibration/HcalAlCaRecoProducers/python/ALCARECOHcalCalIsoTrkProducerFilter_cff.py delete mode 100644 Calibration/HcalAlCaRecoProducers/src/AlCaEcalHcalReadoutsProducer.cc delete mode 100644 Calibration/HcalAlCaRecoProducers/src/ProducerAnalyzer.h delete mode 100644 Calibration/HcalAlCaRecoProducers/src/SealModule.cc create mode 100644 Calibration/HcalAlCaRecoProducers/test/AlCaHBHEMuonProducerFilter_cfg.py create mode 100644 Calibration/HcalAlCaRecoProducers/test/AlCaHEMuonProducerFilter_cfg.py create mode 100644 Calibration/HcalAlCaRecoProducers/test/AlCaHcalIsoTrk_cfg.py rename Calibration/HcalCalibAlgos/{src => interface}/TCell.h (100%) rename Calibration/HcalCalibAlgos/{src => interface}/hcalCalibUtils.h (96%) create mode 100644 Calibration/HcalCalibAlgos/macros/hocalib_pl18.C create mode 100644 Calibration/HcalCalibAlgos/macros/hocalib_tmpfit.C delete mode 100644 Calibration/HcalCalibAlgos/plugins/HcalCalibrator.h create mode 100644 Calibration/HcalCalibAlgos/plugins/HcalHBHENewMuonAnalyzer.cc create mode 100644 Calibration/HcalCalibAlgos/plugins/HcalIsoTrackAnalyzer.cc delete mode 100644 Calibration/HcalCalibAlgos/plugins/HitReCalibrator.h create mode 100644 Calibration/HcalCalibAlgos/test/python/hcalHBHEMuonAnalysis_cfg.py create mode 100644 Calibration/HcalCalibAlgos/test/python/isoTrackAlCaAnalysis_cfg.py create mode 100644 Calibration/HcalCalibAlgos/test/python/isoTrackAnalysis_cfg.py delete mode 100644 Calibration/HcalIsolatedTrackReco/interface/ECALRegFEDSelector.h delete mode 100644 Calibration/HcalIsolatedTrackReco/interface/EcalIsolatedParticleCandidateProducer.h delete mode 100644 Calibration/HcalIsolatedTrackReco/interface/IPTCorrector.h delete mode 100644 Calibration/HcalIsolatedTrackReco/interface/IsolatedEcalPixelTrackCandidateProducer.h delete mode 100644 Calibration/HcalIsolatedTrackReco/interface/IsolatedPixelTrackCandidateL1TProducer.h delete mode 100644 Calibration/HcalIsolatedTrackReco/interface/IsolatedPixelTrackCandidateProducer.h delete mode 100644 Calibration/HcalIsolatedTrackReco/interface/SiStripRegFEDSelector.h delete mode 100644 Calibration/HcalIsolatedTrackReco/interface/SubdetFEDSelector.h rename Calibration/HcalIsolatedTrackReco/{ => plugins}/BuildFile.xml (89%) rename Calibration/HcalIsolatedTrackReco/{src => plugins}/ECALRegFEDSelector.cc (62%) rename Calibration/HcalIsolatedTrackReco/{src => plugins}/EcalIsolatedParticleCandidateProducer.cc (73%) rename Calibration/HcalIsolatedTrackReco/{src/HITRegionalPixelSeedGenerator.h => plugins/HITRegionalPixelSeedGenerator.cc} (72%) rename Calibration/HcalIsolatedTrackReco/{src => plugins}/IPTCorrector.cc (74%) rename Calibration/HcalIsolatedTrackReco/{src => plugins}/IsolatedEcalPixelTrackCandidateProducer.cc (82%) rename Calibration/HcalIsolatedTrackReco/{src => plugins}/IsolatedPixelTrackCandidateL1TProducer.cc (81%) rename Calibration/HcalIsolatedTrackReco/{src => plugins}/IsolatedPixelTrackCandidateProducer.cc (79%) rename Calibration/HcalIsolatedTrackReco/{src => plugins}/SiStripRegFEDSelector.cc (69%) rename Calibration/HcalIsolatedTrackReco/{src => plugins}/SubdetFEDSelector.cc (75%) delete mode 100644 Calibration/HcalIsolatedTrackReco/python/ecalFED_cfi.py delete mode 100644 Calibration/HcalIsolatedTrackReco/python/ecalIsolPartProd_cfi.py delete mode 100644 Calibration/HcalIsolatedTrackReco/python/stripFED_cfi.py delete mode 100644 Calibration/HcalIsolatedTrackReco/python/subdetFED_cfi.py delete mode 100644 Calibration/HcalIsolatedTrackReco/src/SealModule.cc create mode 100644 Calibration/TkAlCaRecoProducers/python/ALCARECOPromptCalibProdSiPixelLorentzAngle_Output_cff.py create mode 100644 Calibration/TkAlCaRecoProducers/python/ALCARECOPromptCalibProdSiPixelLorentzAngle_cff.py create mode 100644 Calibration/TkAlCaRecoProducers/python/ALCARECOSiStripCalCosmicsNano_Output_cff.py create mode 100644 Calibration/TkAlCaRecoProducers/python/ALCARECOSiStripCalCosmicsNano_cff.py create mode 100644 Calibration/TkAlCaRecoProducers/python/AlcaSiPixelLorentzAngleHarvester_cff.py create mode 100644 Calibration/TkAlCaRecoProducers/python/AlcaSiPixelLorentzAngleHarvester_cfi.py delete mode 100644 Calibration/Tools/interface/TrackAssociator.h delete mode 100644 Calibration/Tools/plugins/ElectronSqPtTkIsolation.cc delete mode 100644 Calibration/Tools/plugins/ElectronSqPtTkIsolation.h delete mode 100644 Calibration/Tools/plugins/ElectronSqPtTkIsolationProducer.cc delete mode 100644 Calibration/Tools/plugins/ElectronSqPtTkIsolationProducer.h delete mode 100644 Calibration/Tools/plugins/SingleEleCalibSelector.cc delete mode 100644 Calibration/Tools/plugins/SingleEleCalibSelector.h delete mode 100644 Calibration/Tools/src/TrackAssociator.cc delete mode 100644 CommonTools/ParticleFlow/plugins/DeltaBetaWeights.h delete mode 100644 CommonTools/ParticleFlow/plugins/PFCandIsolatorFromDeposit.h rename CommonTools/ParticleFlow/plugins/{PFCandidateFromFwdPtrProducer.h => PFCandidateFromFwdPtrProducer.cc} (60%) rename CommonTools/ParticleFlow/plugins/{PFCandidateFwdPtrCollectionFilter.h => PFCandidateFwdPtrCollectionFilter.cc} (83%) rename CommonTools/ParticleFlow/plugins/{PFJetFwdPtrProducer.h => PFJetFwdPtrProducer.cc} (71%) delete mode 100644 CommonTools/ParticleFlow/plugins/PFMET.h create mode 100644 CommonTools/ParticleFlow/plugins/PFNoPileUpPacked.cc delete mode 100644 CommonTools/ParticleFlow/plugins/PFPileUp.h rename CommonTools/ParticleFlow/plugins/{PFTauFwdPtrProducer.h => PFTauFwdPtrProducer.cc} (70%) delete mode 100644 CommonTools/ParticleFlow/plugins/SealModule.cc delete mode 100644 CommonTools/ParticleFlow/plugins/TopProjector.h create mode 100644 CommonTools/ParticleFlow/python/pfCHS_cff.py delete mode 100644 CommonTools/PileupAlgos/plugins/PuppiPhoton.h delete mode 100644 CommonTools/PileupAlgos/plugins/PuppiProducer.h create mode 100644 CommonTools/PileupAlgos/test/recomputePuppiOnMiniAOD.py delete mode 100644 CommonTools/RecoAlgos/plugins/CaloJetShallowCloneProducer.cc delete mode 100644 CommonTools/RecoAlgos/plugins/CaloMETShallowCloneProducer.cc delete mode 100644 CommonTools/RecoAlgos/plugins/ElectronShallowCloneProducer.cc delete mode 100644 CommonTools/RecoAlgos/plugins/GenJetShallowCloneProducer.cc delete mode 100644 CommonTools/RecoAlgos/plugins/GenMETShallowCloneProducer.cc delete mode 100644 CommonTools/RecoAlgos/plugins/GsfElectronShallowCloneProducer.cc delete mode 100644 CommonTools/RecoAlgos/plugins/MuonShallowCloneProducer.cc rename CommonTools/{CandAlgos/interface/ShallowCloneProducer.h => RecoAlgos/plugins/ShallowCloneProducer.cc} (51%) rename {PhysicsTools/PatAlgos/python/slimming => CommonTools/RecoAlgos/python}/primaryVertexAssociation_cfi.py (100%) create mode 100644 CommonTools/RecoAlgos/python/sortedPackedPrimaryVertices_cfi.py create mode 100644 CommonTools/UtilAlgos/interface/ObjectSelectorBase.h delete mode 100644 CommonTools/UtilAlgos/interface/ObjectSelectorStream.h delete mode 100644 CondCore/DTPlugins/interface/DTCompactMapPluginHandler.h delete mode 100644 CondCore/DTPlugins/interface/DTConfigPluginHandler.h create mode 100644 CondFormats/CSCObjects/interface/CSCL1TPLookupTableCCLUT.h create mode 100644 CondFormats/CSCObjects/interface/CSCL1TPLookupTableME11ILT.h create mode 100644 CondFormats/CSCObjects/interface/CSCL1TPLookupTableME21ILT.h create mode 100644 CondFormats/CSCObjects/src/CSCL1TPLookupTableCCLUT.cc create mode 100644 CondFormats/CSCObjects/src/CSCL1TPLookupTableME11ILT.cc create mode 100644 CondFormats/CSCObjects/src/CSCL1TPLookupTableME21ILT.cc create mode 100644 CondFormats/CSCObjects/src/T_EventSetup_CSCL1TPLookupTableCCLUT.cc create mode 100644 CondFormats/CSCObjects/src/T_EventSetup_CSCL1TPLookupTableME11ILT.cc create mode 100644 CondFormats/CSCObjects/src/T_EventSetup_CSCL1TPLookupTableME21ILT.cc delete mode 100644 CondFormats/CastorObjects/interface/AllClasses.h delete mode 100644 CondFormats/Common/interface/Constants.h create mode 100644 CondFormats/Common/test/CTPPSRPAlignmentCorrectionsDataRcd_prep.json create mode 100644 CondFormats/Common/test/CTPPSRPAlignmentCorrectionsDataRcd_prod.json create mode 100644 CondFormats/Common/test/PPSTimingCalibrationRcd_Sampic_prep.json create mode 100644 CondFormats/Common/test/PPSTimingCalibrationRcd_Sampic_prod.json create mode 100644 CondFormats/Common/test/PPSTimingCalibrationRcd_prep.json create mode 100644 CondFormats/Common/test/PPSTimingCalibrationRcd_prod.json create mode 100644 CondFormats/Common/test/SiPixelLorentzAngleRcd_multirun_prep.json create mode 100644 CondFormats/Common/test/SiPixelLorentzAngleRcd_multirun_prod.json create mode 100644 CondFormats/Common/test/SiPixelLorentzAngleRcd_prep.json create mode 100644 CondFormats/Common/test/SiPixelLorentzAngleRcd_prod.json create mode 100644 CondFormats/DataRecord/interface/CSCL1TPLookupTableCCLUTRcd.h create mode 100644 CondFormats/DataRecord/interface/CSCL1TPLookupTableME11ILTRcd.h create mode 100644 CondFormats/DataRecord/interface/CSCL1TPLookupTableME21ILTRcd.h create mode 100644 CondFormats/DataRecord/interface/PPSAlignmentConfigurationRcd.h create mode 100644 CondFormats/DataRecord/interface/PPSAssociationCutsRcd.h delete mode 100644 CondFormats/DataRecord/interface/SiStripBadChannelRcd.h delete mode 100644 CondFormats/DataRecord/interface/SiStripBadFiberRcd.h delete mode 100644 CondFormats/DataRecord/interface/SiStripBadModuleRcd.h delete mode 100644 CondFormats/DataRecord/interface/SiStripModuleHVRcd.h delete mode 100644 CondFormats/DataRecord/interface/SiStripPerformanceSummaryRcd.h delete mode 100644 CondFormats/DataRecord/interface/SiStripRunSummaryRcd.h create mode 100644 CondFormats/DataRecord/src/CSCL1TPLookupTableCCLUTRcd.cc create mode 100644 CondFormats/DataRecord/src/CSCL1TPLookupTableME11ILTRcd.cc create mode 100644 CondFormats/DataRecord/src/CSCL1TPLookupTableME21ILTRcd.cc create mode 100644 CondFormats/DataRecord/src/PPSAlignmentConfigurationRcd.cc create mode 100644 CondFormats/DataRecord/src/PPSAssociationCutsRcd.cc create mode 100644 CondFormats/HcalObjects/interface/HcalChannelQualityGPU.h delete mode 100644 CondFormats/HcalObjects/interface/HcalItemArrayColl.h delete mode 100644 CondFormats/HcalObjects/interface/HcalItemArrayCollById.h create mode 100644 CondFormats/HcalObjects/src/HcalChannelQualityGPU.cc create mode 100644 CondFormats/PPSObjects/interface/PPSAlignmentConfiguration.h create mode 100644 CondFormats/PPSObjects/interface/PPSAssociationCuts.h create mode 100644 CondFormats/PPSObjects/src/PPSAlignmentConfiguration.cc create mode 100644 CondFormats/PPSObjects/src/PPSAssociationCuts.cc create mode 100644 CondFormats/PPSObjects/src/T_EventSetup_PPSAlignmentConfiguration.cc create mode 100644 CondFormats/PPSObjects/src/T_EventSetup_PPSAssociationCuts.cc create mode 100644 CondFormats/PPSObjects/test/testSerializationPPSAlignmentConfiguration.cc create mode 100644 CondFormats/PPSObjects/test/testSerializationPPSAssociationCuts.cc delete mode 100644 CondFormats/Serialization/interface/eos/polymorphic_portable_archive.hpp delete mode 100644 CondFormats/Serialization/interface/eos/portable_archive.hpp delete mode 100644 CondFormats/SiPixelObjects/interface/MapPathTodetUnit.h delete mode 100644 CondTools/BeamSpot/plugins/BeamSpotOnlineHLTRcdReader.cc delete mode 100644 CondTools/BeamSpot/plugins/BeamSpotOnlineHLTRcdWriter.cc delete mode 100644 CondTools/BeamSpot/plugins/BeamSpotOnlineLegacyRcdWriter.cc rename CondTools/BeamSpot/plugins/{BeamSpotOnlineLegacyRcdReader.cc => BeamSpotOnlineRecordsReader.cc} (54%) create mode 100644 CondTools/BeamSpot/plugins/BeamSpotOnlineRecordsWriter.cc delete mode 100644 CondTools/BeamSpot/test/BeamSpotOnlineHLTRcdReader_cfg.py delete mode 100644 CondTools/BeamSpot/test/BeamSpotOnlineHLTRcdWriter_cfg.py delete mode 100644 CondTools/BeamSpot/test/BeamSpotOnlineLegacyRcdWriter_cfg.py rename CondTools/BeamSpot/test/{BeamSpotOnlineLegacyRcdReader_cfg.py => BeamSpotOnlineRecordsReader_cfg.py} (51%) create mode 100644 CondTools/BeamSpot/test/BeamSpotOnlineRecordsWriter_cfg.py create mode 100644 CondTools/BeamSpot/test/BuildFile.xml create mode 100644 CondTools/BeamSpot/test/testReadWriteOnlineBSFromDB.cpp create mode 100755 CondTools/BeamSpot/test/testReadWriteOnlineBSFromDB.sh create mode 100644 CondTools/CTPPS/plugins/RetrieveCTPPSRPAlignmentCorrectionsData.cc create mode 100644 CondTools/CTPPS/plugins/RetrievePPSAlignmentConfiguration.cc create mode 100644 CondTools/CTPPS/plugins/RetrievePPSAssociationCuts.cc create mode 100644 CondTools/CTPPS/plugins/WritePPSAlignmentConfiguration.cc create mode 100644 CondTools/CTPPS/plugins/WritePPSAssociationCuts.cc create mode 100644 CondTools/CTPPS/test/BuildFile.xml create mode 100644 CondTools/CTPPS/test/retrieve_PPSAlignmentConfiguration_cfg.py create mode 100644 CondTools/CTPPS/test/retrieve_PPSAssociationCuts_cfg.py create mode 100755 CondTools/CTPPS/test/test_CondToolsCTPPS.sh create mode 100644 CondTools/CTPPS/test/write_PPSAlignmentConfiguration_cfg.py create mode 100644 CondTools/CTPPS/test/write_PPSAssociationCuts_cfg.py delete mode 100644 CondTools/DQM/interface/DQMReferenceHistogramRootFileSourceHandler.h delete mode 100644 CondTools/DQM/plugins/DQMReferenceHistogramRootFileEventSetupAnalyzer.cc delete mode 100644 CondTools/DQM/plugins/DQMReferenceHistogramRootFilePopConAnalyzer.cc delete mode 100644 CondTools/DQM/python/DQMReferenceHistogramRootFileEventSetupAnalyzer_OrcoffOnly_cfi.py delete mode 100644 CondTools/DQM/python/DQMReferenceHistogramRootFileEventSetupAnalyzer_SQLiteOnly_cfi.py delete mode 100644 CondTools/DQM/python/DQMReferenceHistogramRootFileEventSetupAnalyzer_cfi.py delete mode 100644 CondTools/DQM/src/DQMReferenceHistogramRootFileSourceHandler.cc delete mode 100644 CondTools/DQM/test/DQMReferenceHistogramRootFileEventSetupAnalyzer_OrcoffOnly_cfg.py delete mode 100644 CondTools/DQM/test/DQMReferenceHistogramRootFileEventSetupAnalyzer_SQLiteOnly_cfg.py delete mode 100644 CondTools/DQM/test/DQMReferenceHistogramRootFileEventSetupAnalyzer_cfg.py delete mode 100644 CondTools/DQM/test/DQMReferenceHistogramRootFileTest.py delete mode 100644 CondTools/DQM/test/DQMReferenceHistogramRootFile_PopCon_cfg.py delete mode 100644 CondTools/DT/plugins/DTKeyedConfigDBDump.h delete mode 100644 CondTools/Ecal/interface/EcalIntercalibConstantsHandler.h delete mode 100644 CondTools/Ecal/interface/EcalIntercalibConstantsMCHandler.h delete mode 100644 CondTools/Ecal/interface/EcalIntercalibErrorsHandler.h delete mode 100644 CondTools/Ecal/interface/EcalIntercalibErrorsXMLTranslator.h delete mode 100644 CondTools/Ecal/interface/EcalPFRecHitThresholdsXMLTranslator.h delete mode 100644 CondTools/Ecal/interface/EcalTimeCalibConstantsHandler.h delete mode 100644 CondTools/Ecal/interface/EcalTimeCalibConstantsXMLTranslator.h delete mode 100644 CondTools/Ecal/interface/EcalTimeCalibErrorsHandler.h delete mode 100644 CondTools/Ecal/interface/EcalTimeCalibErrorsXMLTranslator.h delete mode 100644 CondTools/Ecal/test/testXMLTranslators.cc delete mode 100644 CondTools/L1Trigger/interface/Interval.h delete mode 100644 CondTools/RPC/interface/L1RPCHwConfigDBWriter.h delete mode 100644 CondTools/RPC/interface/RPCEMapDBWriter.h create mode 100644 CondTools/SiPhase2Tracker/test/BuildFile.xml create mode 100755 CondTools/SiPhase2Tracker/test/test_CondToolsSiPhase2Tracker.sh create mode 100644 CondTools/SiPixel/plugins/PixelDCSObjectReader.cc rename CondTools/SiPixel/{test => plugins}/PixelDCSObjectReader.h (66%) create mode 100644 CondTools/SiPixel/plugins/PixelPopConCalibChecker.cc rename CondTools/SiPixel/{test => plugins}/PixelPopConCalibChecker.h (68%) rename CondTools/SiPixel/{test => plugins}/SiPixel2DTemplateDBObjectReader.cc (60%) rename CondTools/SiPixel/{test => plugins}/SiPixel2DTemplateDBObjectUploader.cc (73%) rename CondTools/SiPixel/{test => plugins}/SiPixelBadModuleByHandBuilder.cc (93%) rename CondTools/SiPixel/{test => plugins}/SiPixelBadModuleByHandBuilder.h (73%) rename CondTools/SiPixel/{test => plugins}/SiPixelBadModuleReader.cc (88%) create mode 100644 CondTools/SiPixel/plugins/SiPixelBadModuleReader.h rename CondTools/SiPixel/{test => plugins}/SiPixelCalibConfigurationObjectMaker.cc (87%) rename CondTools/SiPixel/{test => plugins}/SiPixelCalibConfigurationReadDb.cc (54%) rename CondTools/SiPixel/{test => plugins}/SiPixelCondObjAllPayloadsReader.cc (91%) rename CondTools/SiPixel/{test => plugins}/SiPixelCondObjAllPayloadsReader.h (88%) rename CondTools/SiPixel/{test => plugins}/SiPixelCondObjBuilder.cc (89%) rename CondTools/SiPixel/{test => plugins}/SiPixelCondObjBuilder.h (86%) rename CondTools/SiPixel/{test => plugins}/SiPixelCondObjForHLTBuilder.cc (90%) rename CondTools/SiPixel/{test => plugins}/SiPixelCondObjForHLTBuilder.h (79%) rename CondTools/SiPixel/{test => plugins}/SiPixelCondObjForHLTReader.cc (76%) rename CondTools/SiPixel/{test => plugins}/SiPixelCondObjForHLTReader.h (88%) rename CondTools/SiPixel/{test => plugins}/SiPixelCondObjOfflineBuilder.cc (87%) rename CondTools/SiPixel/{test => plugins}/SiPixelCondObjOfflineBuilder.h (89%) rename CondTools/SiPixel/{test => plugins}/SiPixelCondObjOfflineReader.cc (75%) rename CondTools/SiPixel/{test => plugins}/SiPixelCondObjOfflineReader.h (88%) rename CondTools/SiPixel/{test => plugins}/SiPixelCondObjReader.cc (75%) rename CondTools/SiPixel/{test => plugins}/SiPixelCondObjReader.h (86%) rename CondTools/SiPixel/{test => plugins}/SiPixelDynamicInefficiencyDB.cc (80%) rename CondTools/SiPixel/{test => plugins}/SiPixelDynamicInefficiencyDB.h (63%) rename CondTools/SiPixel/{test => plugins}/SiPixelDynamicInefficiencyReader.cc (85%) rename CondTools/SiPixel/{test => plugins}/SiPixelDynamicInefficiencyReader.h (58%) create mode 100644 CondTools/SiPixel/plugins/SiPixelFakeGenErrorDBSourceReader.cc create mode 100644 CondTools/SiPixel/plugins/SiPixelFakeTemplateDBSourceReader.cc rename CondTools/SiPixel/{test => plugins}/SiPixelGainCalibScaler.cc (96%) rename CondTools/SiPixel/{test => plugins}/SiPixelGainCalibrationReadDQMFile.cc (72%) rename CondTools/SiPixel/{test => plugins}/SiPixelGainCalibrationReadDQMFile.h (100%) rename CondTools/SiPixel/{test => plugins}/SiPixelGainCalibrationRejectNoisyAndDead.cc (75%) rename CondTools/SiPixel/{test => plugins}/SiPixelGainCalibrationRejectNoisyAndDead.h (90%) rename CondTools/SiPixel/{test => plugins}/SiPixelGenErrorDBObjectReader.cc (59%) rename CondTools/SiPixel/{test => plugins}/SiPixelGenErrorDBObjectUploader.cc (72%) rename CondTools/SiPixel/{test => plugins}/SiPixelLorentzAngleDB.cc (77%) rename CondTools/SiPixel/{test => plugins}/SiPixelLorentzAngleDB.h (64%) rename CondTools/SiPixel/{test => plugins}/SiPixelLorentzAngleReader.cc (71%) rename CondTools/SiPixel/{test => plugins}/SiPixelLorentzAngleReader.h (51%) rename CondTools/SiPixel/{test => plugins}/SiPixelPerformanceSummaryBuilder.cc (91%) rename CondTools/SiPixel/{test => plugins}/SiPixelPerformanceSummaryBuilder.h (60%) rename CondTools/SiPixel/{test => plugins}/SiPixelPerformanceSummaryReader.cc (65%) create mode 100644 CondTools/SiPixel/plugins/SiPixelPerformanceSummaryReader.h rename CondTools/SiPixel/{test => plugins}/SiPixelTemplateDBObjectReader.cc (64%) rename CondTools/SiPixel/{test => plugins}/SiPixelTemplateDBObjectUploader.cc (69%) rename CondTools/SiPixel/{test => plugins}/SiPixelVCalDB.cc (76%) rename CondTools/SiPixel/{test => plugins}/SiPixelVCalDB.h (71%) rename CondTools/SiPixel/{test => plugins}/SiPixelVCalReader.cc (64%) rename CondTools/SiPixel/{test => plugins}/SiPixelVCalReader.h (59%) delete mode 100644 CondTools/SiPixel/test/PixelPopConCalibChecker.cc delete mode 100644 CondTools/SiPixel/test/SealModules.cc delete mode 100644 CondTools/SiPixel/test/SiPixel2DTemplateDBObjectReader.h delete mode 100644 CondTools/SiPixel/test/SiPixel2DTemplateDBObjectUploader.h delete mode 100644 CondTools/SiPixel/test/SiPixelBadModuleReader.h delete mode 100644 CondTools/SiPixel/test/SiPixelCPEGenericErrorParmReader.cc delete mode 100644 CondTools/SiPixel/test/SiPixelCPEGenericErrorParmReader.h delete mode 100644 CondTools/SiPixel/test/SiPixelCPEGenericErrorParmReader_cfg.py delete mode 100644 CondTools/SiPixel/test/SiPixelCPEGenericErrorParmUploader.cc delete mode 100644 CondTools/SiPixel/test/SiPixelCPEGenericErrorParmUploader.h delete mode 100644 CondTools/SiPixel/test/SiPixelCPEGenericErrorParmUploader_cfg.py delete mode 100644 CondTools/SiPixel/test/SiPixelFakeCPEGenericErrorParmSourceReader.cc delete mode 100644 CondTools/SiPixel/test/SiPixelFakeCPEGenericErrorParmSourceReader.h delete mode 100644 CondTools/SiPixel/test/SiPixelFakeCPEGenericErrorParmSourceReader_cfg.py delete mode 100644 CondTools/SiPixel/test/SiPixelFakeGenErrorDBSourceReader.cc delete mode 100644 CondTools/SiPixel/test/SiPixelFakeGenErrorDBSourceReader.h delete mode 100644 CondTools/SiPixel/test/SiPixelFakeTemplateDBSourceReader.cc delete mode 100644 CondTools/SiPixel/test/SiPixelFakeTemplateDBSourceReader.h delete mode 100644 CondTools/SiPixel/test/SiPixelGenErrorDBObjectReader.h delete mode 100644 CondTools/SiPixel/test/SiPixelGenErrorDBObjectUploader.h delete mode 100644 CondTools/SiPixel/test/SiPixelPerformanceSummaryReader.h delete mode 100644 CondTools/SiPixel/test/SiPixelTemplateDBObjectReader.h delete mode 100644 CondTools/SiPixel/test/SiPixelTemplateDBObjectUploader.h delete mode 100644 CondTools/SiStrip/interface/SiStripCondObjBuilderBase.h delete mode 100644 CondTools/SiStrip/interface/SiStripDepCondObjBuilderBase.h create mode 100644 Configuration/Eras/python/Era_Phase2C11I13T27M9_cff.py create mode 100644 Configuration/Eras/python/Era_Run3_noMkFit_cff.py create mode 100644 Configuration/Eras/python/ModifierChain_trackingMkFitProd_cff.py create mode 100644 Configuration/Eras/python/Modifier_phase2_brickedPixels_cff.py create mode 100644 Configuration/Eras/python/Modifier_run3_nanoAOD_devel_cff.py create mode 100644 Configuration/Generator/python/SMS-Higgsino_mN2-170_mC1-160_mN1-150_HT60_TuneCP5_13TeV_pythia8_cfi.py create mode 100644 Configuration/Generator/python/concurrentLumisDisable.py delete mode 100644 DPGAnalysis/HcalTools/interface/CMTRawAnalyzer.h rename DPGAnalysis/HcalTools/{ => plugins}/BuildFile.xml (79%) rename DPGAnalysis/HcalTools/{src => plugins}/CMTRawAnalyzer.cc (72%) create mode 100644 DQM/BeamMonitor/plugins/BeamSpotDipServer.cc create mode 100644 DQM/BeamMonitor/plugins/BeamSpotDipServer.h create mode 100644 DQM/BeamMonitor/python/BeamSpotDipServer_cff.py create mode 100644 DQM/BeamMonitor/test/beamspotdip_dqm_sourceclient-file_cfg.py create mode 100644 DQM/BeamMonitor/test/log4cplus.properties create mode 100644 DQM/CTPPS/plugins/DiamondSampicCalibrationDQMSource.cc create mode 100644 DQM/CTPPS/plugins/DiamondSampicDQMSource.cc create mode 100644 DQM/CTPPS/python/diamondSampicDQMSource_cfi.py delete mode 100644 DQM/EcalCommon/data/readEcalDQMStatus.py create mode 100644 DQM/Integration/python/clients/beamspotdip_dqm_sourceclient-live_cfg.py create mode 100644 DQM/SiPixelPhase1Track/plugins/SiPixelPhase1EfficiencyExtras.cc create mode 100644 DQM/SiPixelPhase1Track/python/SiPixelPhase1EfficiencyExtras_cfi.py create mode 100644 DQM/SiStripMonitorClient/test/BuildFile.xml create mode 100644 DQM/SiStripMonitorClient/test/TestDriver.cpp create mode 100755 DQM/SiStripMonitorClient/test/test_SiStripDQM_OfflineTkMap.sh create mode 100644 DQM/SiStripMonitorSummary/python/SiStripMonitorCommon_cfi.py delete mode 100644 DataFormats/BTauReco/interface/PFCombinedTauTagInfo.h delete mode 100644 DataFormats/BTauReco/interface/PFIsolatedTauTagInfo.h delete mode 100644 DataFormats/BTauReco/interface/TrackIPData.h delete mode 100644 DataFormats/Common/interface/NewPolicy.h delete mode 100644 DataFormats/Common/interface/OwnArray.h delete mode 100644 DataFormats/Common/interface/TransientDataFrame.h delete mode 100644 DataFormats/Common/interface/debugging_allocator.h delete mode 100644 DataFormats/Common/test/OwnArray_t.cpp delete mode 100644 DataFormats/Common/test/testOwnArray.cc delete mode 100644 DataFormats/GeometrySurface/interface/private/newTkRotation.h delete mode 100644 DataFormats/GeometryVector/interface/OnePiRange.h create mode 100644 DataFormats/HcalCalibObjects/interface/HcalHBHEMuonVariables.h create mode 100644 DataFormats/HcalCalibObjects/interface/HcalIsoTrkCalibVariables.h create mode 100644 DataFormats/HcalCalibObjects/interface/HcalIsoTrkEventVariables.h create mode 100644 DataFormats/L1TrackTrigger/test/BuildFile.xml create mode 100644 DataFormats/L1TrackTrigger/test/TestDataFormatsTTTrackTrackWord.cc create mode 100644 DataFormats/L1TrackTrigger/test/testDataFormatsTTTrackTrackWord_cfg.py delete mode 100644 DataFormats/METReco/interface/PFClusterMETCollection.h delete mode 100644 DataFormats/Math/interface/SSEArray.h delete mode 100644 DataFormats/ParticleFlowReco/interface/PFBlockElementFwd.h delete mode 100644 DataFormats/ParticleFlowReco/interface/PFBlockElementSuperClusterFwd.h delete mode 100644 DataFormats/ParticleFlowReco/interface/PFClusterShapeAssociation.h delete mode 100644 DataFormats/ParticleFlowReco/interface/PFParticleFwd.h delete mode 100644 DataFormats/ParticleFlowReco/interface/PFSuperClusterFwd.h delete mode 100644 DataFormats/ParticleFlowReco/interface/PFTrajectoryPointFwd.h delete mode 100644 DataFormats/Provenance/interface/BranchDescriptionIndex.h delete mode 100644 DataFormats/Provenance/interface/TypeInBranchType.h delete mode 100644 DataFormats/RPCDigi/interface/RPCDigiL1Linkfwd.h delete mode 100644 DataFormats/SiPixelDigi/interface/PixelDigiCollectionfwd.h delete mode 100644 DataFormats/SiStripCommon/interface/ConstantsForSummaryPlots.h delete mode 100644 DataFormats/SiStripDigi/interface/SiStripDigifwd.h delete mode 100644 DataFormats/TrackerRecHit2D/interface/SiPixelRecHitfwd.h delete mode 100644 DataFormats/TrajectorySeed/interface/BasicTrajectorySeed.h delete mode 100644 EventFilter/CSCTFRawToDigi/interface/CSCTFAnalyzer.h delete mode 100644 EventFilter/CSCTFRawToDigi/interface/CSCTFPacker.h delete mode 100644 EventFilter/CSCTFRawToDigi/interface/CSCTFUnpacker.h delete mode 100644 EventFilter/CSCTFRawToDigi/plugins/SealModule.cc create mode 100644 EventFilter/CTPPSRawToDigi/test/test_pixels_only_cfg_eraRun3_562.py delete mode 100644 EventFilter/DTRawToDigi/interface/DTROS25Data.h delete mode 100644 EventFilter/ESRawToDigi/interface/ESCrcKchipFast.h delete mode 100644 EventFilter/EcalRawToDigi/interface/ECALUnpackerException.h delete mode 100644 EventFilter/EcalRawToDigi/interface/MatacqProducer.h delete mode 100644 EventFilter/EcalRawToDigi/interface/MyWatcher.h delete mode 100644 EventFilter/EcalRawToDigi/plugins/EcalRawToDigi.h delete mode 100644 EventFilter/EcalRawToDigi/plugins/EcalRegionCablingESProducer.h delete mode 100644 EventFilter/EcalRawToDigi/plugins/SealModules.cc delete mode 100644 EventFilter/RPCRawToDigi/interface/RPCRawSynchro.h delete mode 100644 EventFilter/Utilities/interface/ModuleWeb.h delete mode 100644 EventFilter/Utilities/interface/config_json.h create mode 100644 FWCore/Framework/src/exceptionContext.cc create mode 100755 FWCore/Framework/test/run_module_synch_lumiboundary.sh create mode 100644 FWCore/Framework/test/test_module_synch_lumiboundary_cfg.py create mode 100644 FWCore/ParameterSet/python/MessageLogger.py delete mode 100644 FWCore/ServiceRegistry/interface/TypeInfoHolder.h create mode 100644 FWCore/Utilities/interface/bit_cast.h create mode 100644 FWCore/Utilities/interface/deprecated_macro.h delete mode 100644 FastSimulation/EventProducer/BuildFile.xml delete mode 100644 FastSimulation/EventProducer/interface/FamosManager.h delete mode 100644 FastSimulation/EventProducer/interface/FamosProducer.h delete mode 100644 FastSimulation/EventProducer/python/FamosSimHits_cff.py delete mode 100644 FastSimulation/EventProducer/src/FamosManager.cc delete mode 100644 FastSimulation/EventProducer/src/FamosProducer.cc delete mode 100644 FastSimulation/ForwardDetectors/test/CastorTowerProducerTest_cfg.py delete mode 100644 Fireworks/FWInterface/interface/FWFFService.h delete mode 100644 Fireworks/FWInterface/src/FWFFService.cc delete mode 100644 Fireworks/Geometry/interface/TGeoFromDddService.h delete mode 100644 Fireworks/Geometry/src/TGeoFromDddService.cc create mode 100644 GeneratorInterface/Core/test/BuildFile.xml create mode 100644 GeneratorInterface/Core/test/FailingGeneratorFilter.cc create mode 100755 GeneratorInterface/Core/test/test_FailingGeneratorFilter.sh create mode 100644 GeneratorInterface/Core/test/test_FailingGeneratorFilter_cfg.py create mode 100644 GeneratorInterface/EvtGenInterface/test/external_Py8_bplus_evtgen1_cfg.py delete mode 100644 GeneratorInterface/TauolaInterface/interface/TauolaWrapper.h create mode 100644 Geometry/EcalCommonData/data/ectkcablemat/2026/v2/ectkcablemat.xml create mode 100644 Geometry/HGCalGeometry/test/HGCalGeometryRotCheck.cc create mode 100644 Geometry/HGCalGeometry/test/HGCalGeometryRotTest.cc create mode 100644 Geometry/HGCalGeometry/test/HGCalWaferInFileOrientation.cc create mode 100644 Geometry/HGCalGeometry/test/python/testHGCalGeometryRotCheck_cfg.py create mode 100644 Geometry/HGCalGeometry/test/python/testHGCalGeometryRotTest_cfg.py create mode 100644 Geometry/HGCalGeometry/test/python/testHGCalWaferInFileOrientation_cfg.py create mode 100644 Geometry/TrackerCommonData/data/FlatMinus05Percent/2021/v2/tibmaterial.xml create mode 100644 Geometry/TrackerCommonData/data/FlatMinus05Percent/2021/v2/tibtidcommonmaterial.xml create mode 100644 Geometry/TrackerCommonData/data/FlatMinus05Percent/2021/v2/tidmaterial.xml create mode 100644 Geometry/TrackerCommonData/data/FlatMinus05Percent/2021/v2/tobmaterial.xml create mode 100644 Geometry/TrackerCommonData/data/FlatMinus05Percent/2021/v2/trackermaterial.xml create mode 100644 Geometry/TrackerCommonData/data/FlatMinus10Percent/2021/v2/tibmaterial.xml create mode 100644 Geometry/TrackerCommonData/data/FlatMinus10Percent/2021/v2/tibtidcommonmaterial.xml create mode 100644 Geometry/TrackerCommonData/data/FlatMinus10Percent/2021/v2/tidmaterial.xml create mode 100644 Geometry/TrackerCommonData/data/FlatMinus10Percent/2021/v2/tobmaterial.xml create mode 100644 Geometry/TrackerCommonData/data/FlatMinus10Percent/2021/v2/trackermaterial.xml create mode 100644 Geometry/TrackerCommonData/data/FlatPlus05Percent/2021/v2/tibmaterial.xml create mode 100644 Geometry/TrackerCommonData/data/FlatPlus05Percent/2021/v2/tibtidcommonmaterial.xml create mode 100644 Geometry/TrackerCommonData/data/FlatPlus05Percent/2021/v2/tidmaterial.xml create mode 100644 Geometry/TrackerCommonData/data/FlatPlus05Percent/2021/v2/tobmaterial.xml create mode 100644 Geometry/TrackerCommonData/data/FlatPlus05Percent/2021/v2/trackermaterial.xml create mode 100644 Geometry/TrackerCommonData/data/FlatPlus10Percent/2021/v2/tibmaterial.xml create mode 100644 Geometry/TrackerCommonData/data/FlatPlus10Percent/2021/v2/tibtidcommonmaterial.xml create mode 100644 Geometry/TrackerCommonData/data/FlatPlus10Percent/2021/v2/tidmaterial.xml create mode 100644 Geometry/TrackerCommonData/data/FlatPlus10Percent/2021/v2/tobmaterial.xml create mode 100644 Geometry/TrackerCommonData/data/FlatPlus10Percent/2021/v2/trackermaterial.xml create mode 100644 Geometry/TrackerCommonData/data/tibmaterial/2021/v2/tibmaterial.xml create mode 100644 Geometry/TrackerCommonData/data/tibtidcommonmaterial/2021/v2/tibtidcommonmaterial.xml create mode 100644 Geometry/TrackerCommonData/data/tidmaterial/2021/v2/tidmaterial.xml create mode 100644 Geometry/TrackerCommonData/data/tobmaterial/2021/v2/tobmaterial.xml create mode 100644 Geometry/TrackerCommonData/data/trackermaterial/2021/v2/trackermaterial.xml create mode 100644 Geometry/TrackerCommonData/data/trackermaterial/2026/v1/trackermaterial.xml create mode 100644 Geometry/TrackerCommonData/data/zeroMaterial/2021/v2/tibmaterial.xml create mode 100644 Geometry/TrackerCommonData/data/zeroMaterial/2021/v2/tibtidcommonmaterial.xml create mode 100644 Geometry/TrackerCommonData/data/zeroMaterial/2021/v2/tidmaterial.xml create mode 100644 Geometry/TrackerCommonData/data/zeroMaterial/2021/v2/tobmaterial.xml create mode 100644 Geometry/TrackerCommonData/data/zeroMaterial/2021/v2/trackermaterial.xml create mode 100644 Geometry/TrackerCommonData/python/cmsExtendedGeometry2021FlatMinus10PercentXML_cfi.py create mode 100644 Geometry/TrackerCommonData/python/cmsExtendedGeometry2021FlatPlus05PercentXML_cfi.py create mode 100644 Geometry/TrackerCommonData/python/cmsExtendedGeometry2021FlatPlus10PercentXML_cfi.py create mode 100644 Geometry/TrackerCommonData/python/cmsExtendedGeometry2026D77XML_cfi.py create mode 100644 Geometry/TrackerCommonData/test/python/dd4hepRun3_cfg.py create mode 100644 Geometry/TrackerCommonData/test/python/run21flat.py create mode 100644 Geometry/VeryForwardData/data/CTPPS_2021/Stations/Reco/v2/RP_210_Left_Station.xml create mode 100644 Geometry/VeryForwardData/data/CTPPS_2021/Stations/Reco/v2/RP_210_Right_Station.xml create mode 100644 Geometry/VeryForwardData/data/CTPPS_2021/Stations/Reco/v2/RP_220_Left_Station.xml create mode 100644 Geometry/VeryForwardData/data/CTPPS_2021/Stations/Reco/v2/RP_220_Right_Station.xml create mode 100644 Geometry/VeryForwardData/data/CTPPS_Pixel_2021/Assembly/v2/CTPPS_Pixel_Assembly_Box_Real_003.xml create mode 100644 Geometry/VeryForwardData/data/CTPPS_Pixel_2021/Assembly/v2/CTPPS_Pixel_Assembly_Box_Real_023.xml create mode 100644 Geometry/VeryForwardData/data/CTPPS_Pixel_2021/Assembly/v2/CTPPS_Pixel_Assembly_Box_Real_103.xml create mode 100644 Geometry/VeryForwardData/data/CTPPS_Pixel_2021/Assembly/v2/CTPPS_Pixel_Assembly_Box_Real_123.xml create mode 100644 Geometry/VeryForwardData/data/CTPPS_Pixel_2021/Modules/v3/PPS_Pixel_Module_2x2_Run3.xml create mode 100644 Geometry/VeryForwardData/data/CTPPS_Timing_Negative_Station/v1/CTPPS_Timing_Negative_Station.xml create mode 100644 Geometry/VeryForwardData/data/CTPPS_Timing_Positive_Station/v1/CTPPS_Timing_Positive_Station.xml create mode 100644 Geometry/VeryForwardData/data/RP_Horizontal_Device/2021/Reco/v2/RP_Horizontal_Device.xml create mode 100644 Geometry/VeryForwardData/data/RP_Vertical_Device/2021/Reco/v2/RP_Vertical_Device.xml create mode 100644 Geometry/VeryForwardGeometry/data/dd4hep/v3/geometryRPFromDD_2021.xml create mode 100644 Geometry/VeryForwardGeometry/python/dd4hep/v3/geometryRPFromDD_2021_cfi.py create mode 100644 Geometry/VeryForwardGeometry/python/geometryRPFromDD_2022_cfi.py create mode 100644 Geometry/VeryForwardGeometry/python/v1/geometryRPFromDD_2021_cfi.py create mode 100644 Geometry/VeryForwardGeometry/python/v1/geometryRPFromDD_2022_cfi.py delete mode 100644 HLTrigger/special/plugins/HLTHcalCalibTypeFilter.h delete mode 100644 HeavyFlavorAnalysis/SpecificDecay/interface/BPHMuonChargeSelect.h delete mode 100644 HeavyFlavorAnalysis/SpecificDecay/interface/BPHParticleChargeSelect.h create mode 100644 HeterogeneousCore/CUDAUtilities/interface/nvmlCheck.h delete mode 100644 IOPool/Common/interface/CustomStreamer.h delete mode 100644 JetMETCorrections/InterpolationTables/interface/BoxNDScanner.h delete mode 100644 JetMETCorrections/InterpolationTables/interface/MultivariateFunctorScanner.h delete mode 100644 JetMETCorrections/InterpolationTables/interface/rescanArray.h delete mode 100644 JetMETCorrections/Type1MET/interface/CorrectedMETProducerT.h delete mode 100644 L1Trigger/CSCTriggerPrimitives/interface/CSCLUTReader.h delete mode 100644 L1Trigger/CSCTriggerPrimitives/plugins/CSCTriggerPrimitivesProducer.h delete mode 100644 L1Trigger/CSCTriggerPrimitives/plugins/SealModule.cc delete mode 100644 L1Trigger/CSCTriggerPrimitives/python/params/cclutParams.py delete mode 100644 L1Trigger/CSCTriggerPrimitives/src/CSCLUTReader.cc delete mode 100644 L1Trigger/DTSectorCollector/interface/DTSCCand.h delete mode 100644 L1Trigger/DTTrackFinder/interface/L1AbstractProcessor.h rename L1Trigger/DTTrackFinder/{src => interface}/L1MuDTAddressArray.h (100%) rename L1Trigger/DTTrackFinder/{src => interface}/L1MuDTSecProcId.h (100%) rename L1Trigger/DTTrackFinder/{src => interface}/L1MuDTTrackAssParam.h (100%) rename L1Trigger/DTTrackFinder/{src => interface}/L1MuDTTrackSegEta.h (97%) rename L1Trigger/DTTrackFinder/{src => interface}/L1MuDTTrackSegLoc.h (100%) rename L1Trigger/DTTrackFinder/{src => interface}/L1MuDTTrackSegPhi.h (98%) rename L1Trigger/GlobalCaloTrigger/{src => interface}/L1GctJetCount.h (96%) rename L1Trigger/GlobalCaloTrigger/{src => interface}/L1GctLut.h (100%) delete mode 100644 L1Trigger/GlobalCaloTrigger/interface/L1GctSimpleJetFinder.h rename L1Trigger/GlobalCaloTrigger/{src => interface}/L1GctTwosComplement.h (100%) rename L1Trigger/GlobalCaloTrigger/{src => interface}/L1GctUnsignedInt.h (100%) delete mode 100644 L1Trigger/L1TCalorimeter/interface/classes.h delete mode 100644 L1Trigger/L1TMuonBarrel/interface/L1AbstractProcessor.h delete mode 100644 L1Trigger/L1TMuonOverlap/interface/OMTFConfigurator.h delete mode 100644 L1Trigger/L1TMuonOverlap/interface/OMTFPatternMaker.h create mode 100644 L1Trigger/L1TMuonOverlapPhase1/.gitignore create mode 100644 L1Trigger/L1TMuonOverlapPhase1/BuildFile.xml create mode 100644 L1Trigger/L1TMuonOverlapPhase1/interface/AlgoMuonBase.h create mode 100644 L1Trigger/L1TMuonOverlapPhase1/interface/AngleConverterBase.h create mode 100644 L1Trigger/L1TMuonOverlapPhase1/interface/MuonStub.h create mode 100644 L1Trigger/L1TMuonOverlapPhase1/interface/MuonStubMakerBase.h create mode 100644 L1Trigger/L1TMuonOverlapPhase1/interface/MuonStubsInput.h create mode 100644 L1Trigger/L1TMuonOverlapPhase1/interface/Omtf/AlgoMuon.h create mode 100644 L1Trigger/L1TMuonOverlapPhase1/interface/Omtf/GhostBuster.h create mode 100644 L1Trigger/L1TMuonOverlapPhase1/interface/Omtf/GhostBusterPreferRefDt.h create mode 100644 L1Trigger/L1TMuonOverlapPhase1/interface/Omtf/GoldenPattern.h create mode 100644 L1Trigger/L1TMuonOverlapPhase1/interface/Omtf/GoldenPatternBase.h create mode 100644 L1Trigger/L1TMuonOverlapPhase1/interface/Omtf/GoldenPatternResult.h create mode 100644 L1Trigger/L1TMuonOverlapPhase1/interface/Omtf/GoldenPatternWithStat.h create mode 100644 L1Trigger/L1TMuonOverlapPhase1/interface/Omtf/IGhostBuster.h create mode 100644 L1Trigger/L1TMuonOverlapPhase1/interface/Omtf/IOMTFEmulationObserver.h create mode 100644 L1Trigger/L1TMuonOverlapPhase1/interface/Omtf/IProcessorEmulator.h create mode 100644 L1Trigger/L1TMuonOverlapPhase1/interface/Omtf/OMTFConfiguration.h create mode 100644 L1Trigger/L1TMuonOverlapPhase1/interface/Omtf/OMTFProcessor.h create mode 100644 L1Trigger/L1TMuonOverlapPhase1/interface/Omtf/OMTFReconstruction.h create mode 100644 L1Trigger/L1TMuonOverlapPhase1/interface/Omtf/OMTFSorter.h create mode 100644 L1Trigger/L1TMuonOverlapPhase1/interface/Omtf/OMTFinput.h create mode 100644 L1Trigger/L1TMuonOverlapPhase1/interface/Omtf/OMTFinputMaker.h create mode 100644 L1Trigger/L1TMuonOverlapPhase1/interface/Omtf/OmtfAngleConverter.h create mode 100644 L1Trigger/L1TMuonOverlapPhase1/interface/Omtf/OmtfName.h create mode 100644 L1Trigger/L1TMuonOverlapPhase1/interface/Omtf/ProcessorBase.h create mode 100644 L1Trigger/L1TMuonOverlapPhase1/interface/Omtf/PtAssignmentBase.h create mode 100644 L1Trigger/L1TMuonOverlapPhase1/interface/Omtf/SorterBase.h create mode 100644 L1Trigger/L1TMuonOverlapPhase1/interface/Omtf/XMLConfigReader.h create mode 100644 L1Trigger/L1TMuonOverlapPhase1/interface/Omtf/XMLConfigWriter.h create mode 100644 L1Trigger/L1TMuonOverlapPhase1/interface/Omtf/XMLEventWriter.h create mode 100644 L1Trigger/L1TMuonOverlapPhase1/interface/ProcConfigurationBase.h create mode 100644 L1Trigger/L1TMuonOverlapPhase1/interface/RpcClusterization.h create mode 100644 L1Trigger/L1TMuonOverlapPhase1/interface/StubResult.h create mode 100644 L1Trigger/L1TMuonOverlapPhase1/interface/Tools/CandidateSimMuonMatcher.h create mode 100644 L1Trigger/L1TMuonOverlapPhase1/interface/Tools/DataROOTDumper2.h create mode 100644 L1Trigger/L1TMuonOverlapPhase1/interface/Tools/EmulationObserverBase.h create mode 100644 L1Trigger/L1TMuonOverlapPhase1/interface/Tools/EventCapture.h create mode 100644 L1Trigger/L1TMuonOverlapPhase1/interface/Tools/OMTFConfigMaker.h create mode 100644 L1Trigger/L1TMuonOverlapPhase1/interface/Tools/PatternGenerator.h create mode 100644 L1Trigger/L1TMuonOverlapPhase1/interface/Tools/PatternOptimizerBase.h create mode 100644 L1Trigger/L1TMuonOverlapPhase1/interface/Tools/StubsSimHitsMatcher.h create mode 100644 L1Trigger/L1TMuonOverlapPhase1/plugins/BuildFile.xml create mode 100644 L1Trigger/L1TMuonOverlapPhase1/plugins/L1MuonOverlapPhase1ParamsDBProducer.cc create mode 100644 L1Trigger/L1TMuonOverlapPhase1/plugins/L1MuonOverlapPhase1ParamsDBProducer.h create mode 100644 L1Trigger/L1TMuonOverlapPhase1/plugins/L1TMuonOverlapPhase1ParamsESProducer.cc create mode 100644 L1Trigger/L1TMuonOverlapPhase1/plugins/L1TMuonOverlapPhase1ParamsESProducer.h create mode 100644 L1Trigger/L1TMuonOverlapPhase1/plugins/L1TMuonOverlapPhase1TrackProducer.cc create mode 100644 L1Trigger/L1TMuonOverlapPhase1/plugins/L1TMuonOverlapPhase1TrackProducer.h create mode 100644 L1Trigger/L1TMuonOverlapPhase1/python/fakeOmtfParams_cff.py create mode 100644 L1Trigger/L1TMuonOverlapPhase1/python/simOmtfDigis_cfi.py create mode 100644 L1Trigger/L1TMuonOverlapPhase1/src/AlgoMuonBase.cc create mode 100644 L1Trigger/L1TMuonOverlapPhase1/src/AngleConverterBase.cc create mode 100644 L1Trigger/L1TMuonOverlapPhase1/src/MuonStub.cc create mode 100644 L1Trigger/L1TMuonOverlapPhase1/src/MuonStubMakerBase.cc create mode 100644 L1Trigger/L1TMuonOverlapPhase1/src/MuonStubsInput.cc create mode 100644 L1Trigger/L1TMuonOverlapPhase1/src/Omtf/AlgoMuon.cc create mode 100644 L1Trigger/L1TMuonOverlapPhase1/src/Omtf/GhostBuster.cc create mode 100644 L1Trigger/L1TMuonOverlapPhase1/src/Omtf/GhostBusterPreferRefDt.cc create mode 100644 L1Trigger/L1TMuonOverlapPhase1/src/Omtf/GoldenPattern.cc create mode 100644 L1Trigger/L1TMuonOverlapPhase1/src/Omtf/GoldenPatternBase.cc create mode 100644 L1Trigger/L1TMuonOverlapPhase1/src/Omtf/GoldenPatternResult.cc create mode 100644 L1Trigger/L1TMuonOverlapPhase1/src/Omtf/GoldenPatternWithStat.cc create mode 100644 L1Trigger/L1TMuonOverlapPhase1/src/Omtf/IOMTFEmulationObserver.cc create mode 100644 L1Trigger/L1TMuonOverlapPhase1/src/Omtf/OMTFConfiguration.cc create mode 100644 L1Trigger/L1TMuonOverlapPhase1/src/Omtf/OMTFProcessor.cc create mode 100644 L1Trigger/L1TMuonOverlapPhase1/src/Omtf/OMTFReconstruction.cc create mode 100644 L1Trigger/L1TMuonOverlapPhase1/src/Omtf/OMTFSorter.cc create mode 100644 L1Trigger/L1TMuonOverlapPhase1/src/Omtf/OMTFinput.cc create mode 100644 L1Trigger/L1TMuonOverlapPhase1/src/Omtf/OMTFinputMaker.cc create mode 100644 L1Trigger/L1TMuonOverlapPhase1/src/Omtf/OmtfAngleConverter.cc create mode 100644 L1Trigger/L1TMuonOverlapPhase1/src/Omtf/OmtfName.cc create mode 100644 L1Trigger/L1TMuonOverlapPhase1/src/Omtf/ProcessorBase.cc create mode 100644 L1Trigger/L1TMuonOverlapPhase1/src/Omtf/PtAssignmentBase.cc create mode 100644 L1Trigger/L1TMuonOverlapPhase1/src/Omtf/SorterBase.cpp create mode 100644 L1Trigger/L1TMuonOverlapPhase1/src/Omtf/XMLConfigReader.cc create mode 100644 L1Trigger/L1TMuonOverlapPhase1/src/Omtf/XMLConfigWriter.cc create mode 100644 L1Trigger/L1TMuonOverlapPhase1/src/Omtf/XMLEventWriter.cc create mode 100644 L1Trigger/L1TMuonOverlapPhase1/src/ProcConfigurationBase.cc create mode 100644 L1Trigger/L1TMuonOverlapPhase1/src/RpcClusterization.cc create mode 100644 L1Trigger/L1TMuonOverlapPhase1/src/Tools/CandidateSimMuonMatcher.cc create mode 100644 L1Trigger/L1TMuonOverlapPhase1/src/Tools/DataROOTDumper2.cc create mode 100644 L1Trigger/L1TMuonOverlapPhase1/src/Tools/EmulationObserverBase.cc create mode 100644 L1Trigger/L1TMuonOverlapPhase1/src/Tools/EventCapture.cc create mode 100644 L1Trigger/L1TMuonOverlapPhase1/src/Tools/OMTFConfigMaker.cc create mode 100644 L1Trigger/L1TMuonOverlapPhase1/src/Tools/PatternGenerator.cc create mode 100644 L1Trigger/L1TMuonOverlapPhase1/src/Tools/PatternOptimizerBase.cc create mode 100644 L1Trigger/L1TMuonOverlapPhase1/src/Tools/StubsSimHitsMatching.cc create mode 100644 L1Trigger/L1TMuonOverlapPhase1/test/.gitignore create mode 100644 L1Trigger/L1TMuonOverlapPhase1/test/expert/omtf/.gitignore create mode 100644 L1Trigger/L1TMuonOverlapPhase1/test/expert/omtf/runMuonOverlapDataDump.py create mode 100644 L1Trigger/L1TMuonOverlapPhase1/test/expert/omtf/runMuonOverlapPatternGenerator.py create mode 100644 L1Trigger/L1TMuonOverlapPhase1/test/expert/omtf/runMuonOverlapPatternGeneratorClassProb.py create mode 100644 L1Trigger/L1TMuonOverlapPhase1/test/expert/omtf/write_sqlite.py create mode 100644 L1Trigger/L1TMuonOverlapPhase1/test/runMuonOverlap_run2_data.py create mode 100644 L1Trigger/L1TMuonOverlapPhase1/test/runMuonOverlap_run3_data.py create mode 100644 L1Trigger/L1TMuonOverlapPhase1/test/runMuonOverlap_run3_mc.py delete mode 100644 L1Trigger/L1TNtuples/interface/L1AnalysisRecoTrackBase.h delete mode 100644 L1TriggerOffline/L1Analyzer/interface/L1PromptAnalysis.h delete mode 100644 MagneticField/Engine/interface/MagneticFieldHelpers.h delete mode 100644 MagneticField/VolumeGeometry/interface/RectangularVolumeBounds.h delete mode 100644 Mixing/Base/interface/FixedPUGenerator.h delete mode 100644 Mixing/Base/interface/PUGenerator.h delete mode 100644 OnlineDB/CSCCondDB/interface/AutoCorrMat.h delete mode 100644 OnlineDB/CSCCondDB/interface/CSCCableReadTest.h delete mode 100644 OnlineDB/CSCCondDB/interface/CSCxTalk.h delete mode 100644 OnlineDB/CSCCondDB/interface/SaturationFcn.h delete mode 100644 OnlineDB/EcalCondDB/interface/IConfig.h delete mode 100644 OnlineDB/EcalCondDB/interface/IRunIOV.h delete mode 100644 OnlineDB/EcalCondDB/interface/ITimeIOV.h delete mode 100644 OnlineDB/EcalCondDB/interface/all_cali_types.h delete mode 100644 OnlineDB/EcalCondDB/interface/all_dcu_types.h delete mode 100644 OnlineDB/EcalCondDB/interface/all_mod_types.h delete mode 100644 OnlineDB/EcalCondDB/test/InsertDCUIdarkPed.cpp delete mode 100644 OnlineDB/EcalCondDB/test/TestChannelView.cpp delete mode 100644 OnlineDB/EcalCondDB/test/TestDCU.cpp delete mode 100644 OnlineDB/EcalCondDB/test/TestMOD.cpp delete mode 100644 PhysicsTools/FWLite/interface/WSelectorFast.h delete mode 100644 PhysicsTools/IsolationAlgos/plugins/CandIsoDepositProducer.h delete mode 100644 PhysicsTools/IsolationAlgos/plugins/CandIsolatorFromDeposits.h delete mode 100644 PhysicsTools/IsolationAlgos/plugins/CandViewExtractor.h delete mode 100644 PhysicsTools/IsolationAlgos/plugins/CandViewExtractor.icc delete mode 100644 PhysicsTools/IsolationAlgos/plugins/PFTauExtractor.h delete mode 100644 PhysicsTools/MVAComputer/interface/MVAModuleHelper.h delete mode 100644 PhysicsTools/PatExamples/interface/WPlusJetsEventSelector.h delete mode 100644 PhysicsTools/PatUtils/interface/JetSelector.h delete mode 100644 PhysicsTools/PatUtils/interface/JetSelector.icc delete mode 100644 PhysicsTools/PatUtils/interface/PatSelectorByFlags.h delete mode 100644 PhysicsTools/PatUtils/interface/RefHelper.h create mode 100644 PhysicsTools/PatUtils/python/tools/pfforTrkMET_cff.py delete mode 100644 PhysicsTools/SelectorUtils/interface/Variables.h delete mode 100644 PhysicsTools/TagAndProbe/interface/ElectronMatchedCandidateProducer.h delete mode 100644 PhysicsTools/UtilAlgos/interface/DummyMatchSelector.h delete mode 100644 PhysicsTools/UtilAlgos/interface/EventSelector.h delete mode 100644 PhysicsTools/UtilAlgos/interface/MCMatchSelector.h delete mode 100755 PhysicsTools/UtilAlgos/interface/NtpProducer.h delete mode 100755 PhysicsTools/UtilAlgos/interface/SelectedOutputCollectionTrait.h delete mode 100755 PhysicsTools/UtilAlgos/interface/SelectionAdderTrait.h delete mode 100755 PhysicsTools/UtilAlgos/interface/StoreContainerTrait.h delete mode 100644 PhysicsTools/UtilAlgos/interface/TwoObjectCalculator.h delete mode 100644 PhysicsTools/Utilities/interface/GammaPropagator.h delete mode 100644 PhysicsTools/Utilities/interface/GammaZInterference.h delete mode 100644 PhysicsTools/Utilities/interface/Number.h delete mode 100644 PhysicsTools/Utilities/interface/ZLineShape.h create mode 100644 PhysicsTools/Utilities/test/corrections.json create mode 100644 PhysicsTools/Utilities/test/test_correctionlib.cc create mode 100755 PhysicsTools/Utilities/test/test_edmPickEvents.sh delete mode 100644 RecoBTag/SoftLepton/plugins/SoftLepton.h delete mode 100644 RecoBTag/SoftLepton/plugins/SoftPFElectronTagInfoProducer.h delete mode 100644 RecoBTag/SoftLepton/plugins/SoftPFMuonTagInfoProducer.h delete mode 100644 RecoBTau/JetTagComputer/plugins/JetTagProducer.h create mode 100644 RecoEgamma/EgammaHLTProducers/plugins/EgammaHLTHcalVarProducerFromRecHit.cc delete mode 100644 RecoEgamma/EgammaTools/interface/ConversionTools.h create mode 100644 RecoEgamma/EgammaTools/interface/EGEnergyCorrectorFactoryFromEventSetup.h delete mode 100644 RecoEgamma/EgammaTools/interface/EffectiveAreas.h create mode 100644 RecoEgamma/EgammaTools/interface/EgammaDNNHelper.h create mode 100644 RecoEgamma/EgammaTools/interface/egEnergyCorrectorFactoryFromRootFile.h create mode 100644 RecoEgamma/EgammaTools/src/EGEnergyCorrectorFactoryFromEventSetup.cc create mode 100644 RecoEgamma/EgammaTools/src/EgammaDNNHelper.cc create mode 100644 RecoEgamma/EgammaTools/src/egEnergyCorrectorFactoryFromRootFile.cc create mode 100644 RecoEgamma/ElectronIdentification/interface/ElectronDNNEstimator.h create mode 100644 RecoEgamma/ElectronIdentification/src/ElectronDNNEstimator.cc create mode 100644 RecoEgamma/PhotonIdentification/interface/PhotonDNNEstimator.h create mode 100644 RecoEgamma/PhotonIdentification/src/PhotonDNNEstimator.cc rename RecoHGCal/TICL/plugins/{TrackstersFromSimClustersProducer.cc => SimTrackstersProducer.cc} (68%) delete mode 100644 RecoHGCal/TICL/plugins/TrackstersFromCaloParticlesProducer.cc delete mode 100644 RecoHI/HiJetAlgos/interface/UECalibration.h delete mode 100644 RecoJets/JetAnalyzers/doc/myJetAna.html delete mode 100644 RecoJets/JetAnalyzers/interface/CaloTowerBoundries.h delete mode 100644 RecoJets/JetAnalyzers/interface/MyCluster.h delete mode 100644 RecoJets/JetAnalyzers/interface/myFilter.h delete mode 100755 RecoJets/JetAnalyzers/interface/myJetAna.h delete mode 100644 RecoJets/JetAnalyzers/test/myFilter.cc delete mode 100644 RecoJets/JetAnalyzers/test/myJetAna.cc delete mode 100644 RecoLocalCalo/CaloTowersCreator/src/CaloTowerCandidateCreator.h rename RecoLocalCalo/CaloTowersCreator/{interface => src}/CaloTowersCreationAlgo.h (100%) delete mode 100644 RecoLocalCalo/CaloTowersCreator/src/CaloTowersCreator.h delete mode 100644 RecoLocalCalo/CaloTowersCreator/src/CaloTowersReCreator.h rename RecoLocalCalo/CaloTowersCreator/{interface => src}/EScales.h (100%) rename RecoLocalCalo/CaloTowersCreator/{interface => src}/HcalMaterials.h (100%) delete mode 100644 RecoLocalCalo/CaloTowersCreator/src/SealModule.cc delete mode 100644 RecoLocalCalo/CastorReco/plugins/CastorSimpleReconstructor.h delete mode 100644 RecoLocalCalo/CastorReco/plugins/SealModule.cc delete mode 100644 RecoLocalCalo/EcalRecAlgos/interface/EcalUncalibRecHitLeadingEdgeAlgo.h create mode 100644 RecoLocalTracker/SiPixelClusterizer/plugins/PixelThresholdClusterizerForBricked.cc create mode 100644 RecoLocalTracker/SiPixelClusterizer/plugins/PixelThresholdClusterizerForBricked.h create mode 100644 RecoLocalTracker/SiPixelRecHits/interface/PixelCPEGenericForBricked.h create mode 100644 RecoLocalTracker/SiPixelRecHits/src/PixelCPEGenericForBricked.cc delete mode 100644 RecoLocalTracker/SiPixelRecHits/test/SiPixelDBTest_cfg.py create mode 100644 RecoMuon/TrackerSeedGenerator/plugins/TSGForOIDNN.cc create mode 100644 RecoMuon/TrackerSeedGenerator/python/customizeOIseeding.py delete mode 100644 RecoMuon/TrackingTools/interface/MuonSeedDetLayer.h create mode 100644 RecoTracker/Record/interface/TrackerMultipleScatteringRecord.h create mode 100644 RecoTracker/Record/src/TrackerMultipleScatteringRecord.cc delete mode 100755 RecoTracker/SpecialSeedGenerators/interface/EtaPhiMeasurementEstimator.h create mode 100644 RecoTracker/TkMSParametrization/interface/MultipleScatteringParametrisationMaker.h delete mode 100644 RecoTracker/TkMSParametrization/interface/rangesIntersect.h create mode 100644 RecoTracker/TkMSParametrization/plugins/BuildFile.xml create mode 100644 RecoTracker/TkMSParametrization/plugins/MultipleScatteringParametrisationMakerESProducer.cc create mode 100644 RecoTracker/TkMSParametrization/src/ES_MultipleScatteringParametrisationMaker.cc create mode 100644 RecoTracker/TkMSParametrization/src/MultipleScatteringParametrisationMaker.cc delete mode 100644 RecoTracker/TkMSParametrization/src/PixelRecoUtilities.cc delete mode 100644 RecoTracker/TrackProducer/interface/GsfTrackProducerAlgorithm.h create mode 100644 RecoTracker/TrackProducer/plugins/TrackExtraRekeyer.cc create mode 100644 RecoTracker/TrackProducer/plugins/TrackProducerFromPatMuons.cc create mode 100644 RecoTracker/TrackProducer/test/refitFromAOD.py create mode 100644 RecoTracker/TrackProducer/test/refitFromMINIAOD.py create mode 100644 RecoTracker/TrackProducer/test/testMuonTrackRefitting.cpp create mode 100755 RecoTracker/TrackProducer/test/testMuonTrackRefitting.sh delete mode 100644 RecoTracker/TransientTrackingRecHit/interface/GSTransientTrackingRecHit.h delete mode 100644 RecoVertex/BeamSpotProducer/interface/BeamSpotAnalyzer.h rename RecoVertex/BeamSpotProducer/test/{test_scalars.py => test_onlineBeamSpotESProducer.py} (50%) delete mode 100644 RecoVertex/ConfigurableVertexReco/interface/ReconstructorFromLinPtFinder.h delete mode 100644 RecoVertex/KinematicFit/interface/CombinedKinematicConstraintT.h delete mode 100644 RecoVertex/LinearizationPointFinders/interface/MonteCarloLinearizationPointFinder.h delete mode 100644 RecoVertex/LinearizationPointFinders/src/MonteCarloLinearizationPointFinder.cc delete mode 100644 SimCalorimetry/CaloSimAlgos/interface/CaloVNoisifier.h rename SimCalorimetry/CastorTechTrigProducer/{ => plugins}/BuildFile.xml (72%) rename SimCalorimetry/CastorTechTrigProducer/{src => plugins}/CastorTTRecord.cc (83%) delete mode 100644 SimCalorimetry/CastorTechTrigProducer/src/CastorTTRecord.h delete mode 100644 SimCalorimetry/CastorTechTrigProducer/src/SealModule.cc create mode 100644 SimCalorimetry/HGCalSimProducers/data/doseParams_3000fb_fluka-6.2.0.1.txt rename SimCalorimetry/HcalTrigPrimProducers/{ => plugins}/BuildFile.xml (58%) rename SimCalorimetry/HcalTrigPrimProducers/{src => plugins}/HcalTTPDigiProducer.cc (83%) rename SimCalorimetry/HcalTrigPrimProducers/{src => plugins}/HcalTTPTriggerRecord.cc (68%) rename SimCalorimetry/HcalTrigPrimProducers/{src => plugins}/HcalTrigPrimDigiProducer.cc (73%) delete mode 100644 SimCalorimetry/HcalTrigPrimProducers/src/HcalTTPDigiProducer.h delete mode 100644 SimCalorimetry/HcalTrigPrimProducers/src/HcalTTPTriggerRecord.h delete mode 100644 SimCalorimetry/HcalTrigPrimProducers/src/HcalTrigPrimDigiProducer.h delete mode 100644 SimCalorimetry/HcalTrigPrimProducers/src/SealModule.cc delete mode 100644 SimDataFormats/RPCDigiSimLink/interface/RPCDigiSimLinkfwd.h delete mode 100644 SimDataFormats/TrackerDigiSimLink/interface/PixelDigiSimLinkfwd.h delete mode 100644 SimDataFormats/TrackerDigiSimLink/interface/StripCompactDigiSimLinksfwd.h delete mode 100644 SimDataFormats/TrackerDigiSimLink/interface/StripDigiSimLinkfwd.h create mode 100644 SimDataFormats/ValidationFormats/interface/MaterialAccountingCalo.h delete mode 100644 SimG4CMS/Calo/interface/HcalTestHistoClass.h create mode 100644 SimG4CMS/CherenkovAnalysis/data/cms.xml create mode 100644 SimG4CMS/ShowerLibraryProducer/test/README_SL_production_recipe.txt delete mode 100644 SimG4Core/Application/interface/DDDWorldObserver.h delete mode 100644 SimG4Core/Notification/interface/ComponentBuilder.h delete mode 100644 SimG4Core/Notification/interface/ComponentFactoryByName.h delete mode 100644 SimG4Core/Notification/interface/DispatchableG4Step.h delete mode 100644 SimG4Core/Notification/interface/OwnIt.h delete mode 100644 SimG4Core/PrintGeomInfo/interface/PrintGeomInfoAction.h delete mode 100644 SimG4Core/PrintGeomInfo/interface/PrintGeomSummary.h delete mode 100644 SimG4Core/PrintGeomInfo/interface/PrintMaterialBudgetInfo.h delete mode 100644 SimG4Core/PrintGeomInfo/interface/PrintSensitive.h rename SimG4Core/PrintGeomInfo/{ => plugins}/BuildFile.xml (74%) rename SimG4Core/PrintGeomInfo/{src => plugins}/PrintGeomInfoAction.cc (86%) create mode 100644 SimG4Core/PrintGeomInfo/plugins/PrintGeomSolids.cc rename SimG4Core/PrintGeomInfo/{src => plugins}/PrintGeomSummary.cc (85%) rename SimG4Core/PrintGeomInfo/{src => plugins}/PrintMaterialBudgetInfo.cc (73%) rename SimG4Core/PrintGeomInfo/{src => plugins}/PrintSensitive.cc (63%) create mode 100644 SimG4Core/PrintGeomInfo/python/printGeomSolids_cff.py delete mode 100644 SimG4Core/PrintGeomInfo/src/module.cc create mode 100644 SimG4Core/PrintGeomInfo/test/python/g4OverlapCheckBigXML_cfg.py create mode 100644 SimG4Core/PrintGeomInfo/test/python/g4OverlapCheckBigXMLdd4hep_cfg.py rename SimG4Core/PrintGeomInfo/test/python/{run_MaterialBudgeInfo_cfg.py => runMaterialBudgeInfo_cfg.py} (77%) create mode 100644 SimG4Core/PrintGeomInfo/test/python/runPrintSolid_cfg.py create mode 100644 SimGeneral/MixingModule/python/mix_2017_5TeV_UltraLegacy_PoissonOOTPU_cfi.py delete mode 100644 SimMuon/GEMDigitizer/test/GEMDigiSimLinkReader.cc delete mode 100644 SimMuon/GEMDigitizer/test/ME0DigiSimLinkReader.cc create mode 100644 SimTracker/SiPhase2Digitizer/plugins/PixelBrickedDigitizerAlgorithm.cc create mode 100644 SimTracker/SiPhase2Digitizer/plugins/PixelBrickedDigitizerAlgorithm.h delete mode 100644 TopQuarkAnalysis/TopTools/interface/TopologyWorker.h delete mode 100644 TrackingTools/AnalyticalJacobians/interface/CurvilinearJacobian.h delete mode 100644 TrackingTools/GsfTools/interface/GaussianSumUtilities.h delete mode 100644 TrackingTools/GsfTools/interface/GaussianSumUtilities.icc rename TrackingTools/GsfTools/plugins/{CloseComponentsMergerESProducer.icc => CloseComponentsMergerESProducer.cc} (70%) delete mode 100644 TrackingTools/GsfTools/plugins/CloseComponentsMergerESProducer.h rename TrackingTools/GsfTools/plugins/{DistanceBetweenComponentsESProducer.icc => DistanceBetweenComponentsESProducer.cc} (60%) delete mode 100644 TrackingTools/GsfTools/plugins/DistanceBetweenComponentsESProducer.h delete mode 100644 TrackingTools/GsfTools/plugins/module.cc delete mode 100644 TrackingTools/PatternTools/interface/MediumProperties.h delete mode 100644 TrackingTools/Records/interface/Records.h create mode 100644 Utilities/StorageFactory/README.md delete mode 100644 Utilities/StorageFactory/interface/IOChannel.h delete mode 100644 Utilities/StorageFactory/interface/IOInput.h delete mode 100644 Utilities/StorageFactory/interface/IOOutput.h delete mode 100644 Utilities/StorageFactory/src/IOChannel.cc delete mode 100644 Utilities/StorageFactory/src/IOInput.cc delete mode 100644 Utilities/StorageFactory/src/IOOutput.cc delete mode 100644 Utilities/StorageFactory/src/SysIOChannel.h delete mode 100644 Utilities/StorageFactory/src/UnixIOChannel.cc create mode 100644 Validation/CTPPS/alignment/alignment_2022.xml create mode 100644 Validation/CTPPS/python/simu_config/profile_2022_default_cff.py create mode 100644 Validation/CTPPS/python/simu_config/year_2022_cff.py create mode 100644 Validation/Geometry/plugins/BuildFile.xml create mode 100644 Validation/Geometry/plugins/MaterialBudgetHcalAnalysis.cc create mode 100644 Validation/Geometry/plugins/MaterialBudgetHcalProducer.cc create mode 100644 Validation/Geometry/test/runP_HCALP_cfg.py delete mode 100644 Validation/HcalHits/interface/HcalSimHitStudy.h delete mode 100644 Validation/HcalHits/interface/SimG4HcalValidation.h delete mode 100644 Validation/HcalHits/interface/ZdcSimHitStudy.h rename Validation/HcalHits/{src => plugins}/HcalSimHitStudy.cc (85%) rename Validation/HcalHits/{src => plugins}/ZdcSimHitStudy.cc (91%) delete mode 100644 Validation/HcalHits/src/module.cc create mode 100644 Validation/MtdValidation/plugins/Primary4DVertexValidation.cc create mode 100644 Validation/MuonCSCDigis/interface/CSCCLCTPreTriggerDigiValidation.h create mode 100644 Validation/MuonCSCDigis/interface/CSCCorrelatedLCTDigiValidation.h create mode 100644 Validation/MuonCSCDigis/interface/CSCStubResolutionValidation.h create mode 100644 Validation/MuonCSCDigis/src/CSCCLCTPreTriggerDigiValidation.cc create mode 100644 Validation/MuonCSCDigis/src/CSCCorrelatedLCTDigiValidation.cc create mode 100644 Validation/MuonCSCDigis/src/CSCStubResolutionValidation.cc rename Validation/RecoParticleFlow/test/{MinBias.jdl => condor_NuGunPU.jdl} (55%) rename Validation/RecoParticleFlow/test/{QCD.jdl => condor_QCD.jdl} (64%) rename Validation/RecoParticleFlow/test/{QCDPU.jdl => condor_QCDPU.jdl} (68%) create mode 100644 Validation/RecoParticleFlow/test/condor_TenTauPU.jdl rename Validation/RecoParticleFlow/test/{ZMM.jdl => condor_ZEEPU.jdl} (55%) create mode 100644 Validation/RecoParticleFlow/test/condor_ZMMPU.jdl diff --git a/Alignment/CommonAlignment/python/tools/trackselectionRefitting.py b/Alignment/CommonAlignment/python/tools/trackselectionRefitting.py index b8c7d65f08d68..8391e9156adf0 100644 --- a/Alignment/CommonAlignment/python/tools/trackselectionRefitting.py +++ b/Alignment/CommonAlignment/python/tools/trackselectionRefitting.py @@ -130,6 +130,7 @@ def getSequence(process, collection, "minimumHits": 10, }) elif collection in ("ALCARECOTkAlCosmicsCTF0T", + "ALCARECOTkAlCosmicsCosmicTF0T", "ALCARECOTkAlCosmicsInCollisions"): isCosmics = True options["TrackSelector"]["HighPurity"] = {} # drop high purity cut @@ -336,7 +337,7 @@ def getSequence(process, collection, **(mod[2])), src modules.append(getattr(process, src)) else: - if mods[-1][-1]["method"] is "load" and \ + if mods[-1][-1]["method"] == "load" and \ not mods[-1][-1].get("clone", False): print("Name of the last module needs to be modifiable.") sys.exit(1) diff --git a/Alignment/CommonAlignmentMonitor/plugins/AlignmentMonitorMuonSystemMap1D.cc b/Alignment/CommonAlignmentMonitor/plugins/AlignmentMonitorMuonSystemMap1D.cc index 644c76b724fc4..76996cb3d005b 100644 --- a/Alignment/CommonAlignmentMonitor/plugins/AlignmentMonitorMuonSystemMap1D.cc +++ b/Alignment/CommonAlignmentMonitor/plugins/AlignmentMonitorMuonSystemMap1D.cc @@ -51,6 +51,7 @@ class AlignmentMonitorMuonSystemMap1D : public AlignmentMonitorBase { const edm::ESGetToken m_esTokenDetId; const edm::ESGetToken m_esTokenProp; const edm::ESGetToken m_esTokenMF; + const MuonResidualsFromTrack::BuilderToken m_esTokenBuilder; // parameters edm::InputTag m_muonCollectionTag; @@ -155,6 +156,7 @@ AlignmentMonitorMuonSystemMap1D::AlignmentMonitorMuonSystemMap1D(const edm::Para m_esTokenDetId(iC.esConsumes(edm::ESInputTag("", "MuonDetIdAssociator"))), m_esTokenProp(iC.esConsumes(edm::ESInputTag("", "SteppingHelixPropagatorAny"))), m_esTokenMF(iC.esConsumes()), + m_esTokenBuilder(iC.esConsumes(MuonResidualsFromTrack::builderESInputTag())), m_muonCollectionTag(cfg.getParameter("muonCollectionTag")), m_minTrackPt(cfg.getParameter("minTrackPt")), m_maxTrackPt(cfg.getParameter("maxTrackPt")), @@ -271,6 +273,7 @@ void AlignmentMonitorMuonSystemMap1D::event(const edm::Event &iEvent, const DetIdAssociator *muonDetIdAssociator_ = &iSetup.getData(m_esTokenDetId); const Propagator *prop = &iSetup.getData(m_esTokenProp); const MagneticField *magneticField = &iSetup.getData(m_esTokenMF); + auto builder = iSetup.getHandle(m_esTokenBuilder); if (m_muonCollectionTag.label().empty()) // use trajectories { @@ -287,7 +290,7 @@ void AlignmentMonitorMuonSystemMap1D::event(const edm::Event &iEvent, m_counter_trackdxy++; MuonResidualsFromTrack muonResidualsFromTrack( - iSetup, magneticField, globalGeometry, muonDetIdAssociator_, prop, traj, track, pNavigator(), 1000.); + builder, magneticField, globalGeometry, muonDetIdAssociator_, prop, traj, track, pNavigator(), 1000.); processMuonResidualsFromTrack(muonResidualsFromTrack, iEvent); } } // end if track has acceptable momentum diff --git a/Alignment/CommonAlignmentMonitor/plugins/AlignmentMonitorMuonVsCurvature.cc b/Alignment/CommonAlignmentMonitor/plugins/AlignmentMonitorMuonVsCurvature.cc index 33b6b1f12afa4..c674bc5e7639f 100644 --- a/Alignment/CommonAlignmentMonitor/plugins/AlignmentMonitorMuonVsCurvature.cc +++ b/Alignment/CommonAlignmentMonitor/plugins/AlignmentMonitorMuonVsCurvature.cc @@ -49,6 +49,7 @@ class AlignmentMonitorMuonVsCurvature : public AlignmentMonitorBase { const edm::ESGetToken m_esTokenDetId; const edm::ESGetToken m_esTokenProp; const edm::ESGetToken m_esTokenMF; + const MuonResidualsFromTrack::BuilderToken m_esTokenBuilder; // parameters edm::InputTag m_muonCollectionTag; @@ -88,6 +89,7 @@ AlignmentMonitorMuonVsCurvature::AlignmentMonitorMuonVsCurvature(const edm::Para m_esTokenDetId(iC.esConsumes(edm::ESInputTag("", "MuonDetIdAssociator"))), m_esTokenProp(iC.esConsumes(edm::ESInputTag("", "SteppingHelixPropagatorAny"))), m_esTokenMF(iC.esConsumes()), + m_esTokenBuilder(iC.esConsumes(MuonResidualsFromTrack::builderESInputTag())), m_muonCollectionTag(cfg.getParameter("muonCollectionTag")), m_minTrackPt(cfg.getParameter("minTrackPt")), m_minTrackP(cfg.getParameter("minTrackP")), @@ -201,6 +203,7 @@ void AlignmentMonitorMuonVsCurvature::event(const edm::Event &iEvent, const DetIdAssociator *muonDetIdAssociator_ = &iSetup.getData(m_esTokenDetId); const Propagator *prop = &iSetup.getData(m_esTokenProp); const MagneticField *magneticField = &iSetup.getData(m_esTokenMF); + auto builder = iSetup.getHandle(m_esTokenBuilder); if (m_muonCollectionTag.label().empty()) // use trajectories { @@ -211,7 +214,7 @@ void AlignmentMonitorMuonVsCurvature::event(const edm::Event &iEvent, if (track->pt() > m_minTrackPt && track->p() > m_minTrackP && fabs(track->dxy(beamSpot->position())) < m_maxDxy) { MuonResidualsFromTrack muonResidualsFromTrack( - iSetup, magneticField, globalGeometry, muonDetIdAssociator_, prop, traj, track, pNavigator(), 1000.); + builder, magneticField, globalGeometry, muonDetIdAssociator_, prop, traj, track, pNavigator(), 1000.); processMuonResidualsFromTrack(muonResidualsFromTrack, traj); } // end if track pT is within range } // end loop over tracks diff --git a/Alignment/CommonAlignmentMonitor/plugins/AlignmentMonitorSegmentDifferences.cc b/Alignment/CommonAlignmentMonitor/plugins/AlignmentMonitorSegmentDifferences.cc index 185bf2bc5b79e..55234490d0000 100644 --- a/Alignment/CommonAlignmentMonitor/plugins/AlignmentMonitorSegmentDifferences.cc +++ b/Alignment/CommonAlignmentMonitor/plugins/AlignmentMonitorSegmentDifferences.cc @@ -49,6 +49,7 @@ class AlignmentMonitorSegmentDifferences : public AlignmentMonitorBase { const edm::ESGetToken m_esTokenDetId; const edm::ESGetToken m_esTokenProp; const edm::ESGetToken m_esTokenMF; + const MuonResidualsFromTrack::BuilderToken m_esTokenBuilder; // parameters edm::InputTag m_muonCollectionTag; @@ -121,6 +122,7 @@ AlignmentMonitorSegmentDifferences::AlignmentMonitorSegmentDifferences(const edm m_esTokenDetId(iC.esConsumes(edm::ESInputTag("", "MuonDetIdAssociator"))), m_esTokenProp(iC.esConsumes(edm::ESInputTag("", "SteppingHelixPropagatorAny"))), m_esTokenMF(iC.esConsumes()), + m_esTokenBuilder(iC.esConsumes(MuonResidualsFromTrack::builderESInputTag())), m_muonCollectionTag(cfg.getParameter("muonCollectionTag")), m_minTrackPt(cfg.getParameter("minTrackPt")), m_minTrackP(cfg.getParameter("minTrackP")), @@ -376,6 +378,7 @@ void AlignmentMonitorSegmentDifferences::event(const edm::Event &iEvent, const DetIdAssociator *muonDetIdAssociator_ = &iSetup.getData(m_esTokenDetId); const Propagator *prop = &iSetup.getData(m_esTokenProp); const MagneticField *magneticField = &iSetup.getData(m_esTokenMF); + auto builder = iSetup.getHandle(m_esTokenBuilder); if (m_muonCollectionTag.label().empty()) // use trajectories { @@ -386,7 +389,7 @@ void AlignmentMonitorSegmentDifferences::event(const edm::Event &iEvent, if (track->pt() > m_minTrackPt && track->p() > m_minTrackP && fabs(track->dxy(beamSpot->position())) < m_maxDxy) { MuonResidualsFromTrack muonResidualsFromTrack( - iSetup, magneticField, globalGeometry, muonDetIdAssociator_, prop, traj, track, pNavigator(), 1000.); + builder, magneticField, globalGeometry, muonDetIdAssociator_, prop, traj, track, pNavigator(), 1000.); processMuonResidualsFromTrack(muonResidualsFromTrack); } } // end loop over tracks diff --git a/Alignment/CommonAlignmentMonitor/plugins/TrackerToMuonPropagator.cc b/Alignment/CommonAlignmentMonitor/plugins/TrackerToMuonPropagator.cc index c2dcd5a0ce7a6..0100ad24a85a7 100644 --- a/Alignment/CommonAlignmentMonitor/plugins/TrackerToMuonPropagator.cc +++ b/Alignment/CommonAlignmentMonitor/plugins/TrackerToMuonPropagator.cc @@ -26,6 +26,7 @@ #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" // products @@ -105,7 +106,8 @@ TrackerToMuonPropagator::TrackerToMuonPropagator(const edm::ParameterSet& iConfi m_globalMuonTracks = iConfig.getParameter("globalMuonTracks"); m_refitTracker = iConfig.getParameter("refitTrackerTrack"); if (m_refitTracker) { - m_trackTransformer = new TrackTransformer(iConfig.getParameter("trackerTrackTransformer")); + m_trackTransformer = + new TrackTransformer(iConfig.getParameter("trackerTrackTransformer"), consumesCollector()); } else m_trackTransformer = nullptr; diff --git a/Alignment/CommonAlignmentProducer/interface/AlignmentTrackSelector.h b/Alignment/CommonAlignmentProducer/interface/AlignmentTrackSelector.h index 1b215eb534cdd..9aa337f5d6f5e 100644 --- a/Alignment/CommonAlignmentProducer/interface/AlignmentTrackSelector.h +++ b/Alignment/CommonAlignmentProducer/interface/AlignmentTrackSelector.h @@ -2,12 +2,14 @@ #define Alignment_CommonAlignmentAlgorithm_AlignmentTrackSelector_h #include "DataFormats/Alignment/interface/AliClusterValueMapFwd.h" +#include "DataFormats/TrackReco/interface/Track.h" +#include "DataFormats/TrackerCommon/interface/TrackerTopology.h" #include "DataFormats/TrackerRecHit2D/interface/SiStripMatchedRecHit2DCollection.h" #include "DataFormats/TrackerRecHit2D/interface/SiStripRecHit2DCollection.h" -#include "DataFormats/TrackReco/interface/Track.h" -#include "FWCore/Utilities/interface/InputTag.h" #include "FWCore/Framework/interface/ConsumesCollector.h" #include "FWCore/Utilities/interface/EDGetToken.h" +#include "FWCore/Utilities/interface/InputTag.h" +#include "Geometry/Records/interface/TrackerTopologyRcd.h" #include namespace edm { @@ -60,6 +62,8 @@ class AlignmentTrackSelector { }; ComparePt ptComparator; + edm::ESGetToken tTopoToken_; + const bool applyBasicCuts_, applyNHighestPt_, applyMultiplicityFilter_; const int seedOnlyFromAbove_; const bool applyIsolation_, chargeCheck_; diff --git a/Alignment/CommonAlignmentProducer/plugins/AlignmentCSCBeamHaloSelectorModule.cc b/Alignment/CommonAlignmentProducer/plugins/AlignmentCSCBeamHaloSelectorModule.cc index e0d6620a1fa45..fae025f32e051 100644 --- a/Alignment/CommonAlignmentProducer/plugins/AlignmentCSCBeamHaloSelectorModule.cc +++ b/Alignment/CommonAlignmentProducer/plugins/AlignmentCSCBeamHaloSelectorModule.cc @@ -1,7 +1,7 @@ #include "FWCore/Framework/interface/ConsumesCollector.h" #include "FWCore/Framework/interface/MakerMacros.h" -#include "CommonTools/UtilAlgos/interface/ObjectSelectorStream.h" +#include "CommonTools/UtilAlgos/interface/ObjectSelector.h" #include "Alignment/CommonAlignmentProducer/interface/AlignmentCSCBeamHaloSelector.h" // the following include is necessary to clone all track branches @@ -37,6 +37,6 @@ struct CSCBeamHaloConfigSelector { AlignmentCSCBeamHaloSelector theSelector; }; -typedef ObjectSelectorStream AlignmentCSCBeamHaloSelectorModule; +typedef ObjectSelector AlignmentCSCBeamHaloSelectorModule; DEFINE_FWK_MODULE(AlignmentCSCBeamHaloSelectorModule); diff --git a/Alignment/CommonAlignmentProducer/plugins/AlignmentCSCOverlapSelectorModule.cc b/Alignment/CommonAlignmentProducer/plugins/AlignmentCSCOverlapSelectorModule.cc index f58f48af954e7..b47b36b358a56 100644 --- a/Alignment/CommonAlignmentProducer/plugins/AlignmentCSCOverlapSelectorModule.cc +++ b/Alignment/CommonAlignmentProducer/plugins/AlignmentCSCOverlapSelectorModule.cc @@ -1,7 +1,7 @@ #include "FWCore/Framework/interface/ConsumesCollector.h" #include "FWCore/Framework/interface/MakerMacros.h" -#include "CommonTools/UtilAlgos/interface/ObjectSelectorStream.h" +#include "CommonTools/UtilAlgos/interface/ObjectSelector.h" #include "Alignment/CommonAlignmentProducer/interface/AlignmentCSCOverlapSelector.h" // the following include is necessary to clone all track branches @@ -35,6 +35,6 @@ struct CSCOverlapConfigSelector { AlignmentCSCOverlapSelector theSelector; }; -typedef ObjectSelectorStream AlignmentCSCOverlapSelectorModule; +typedef ObjectSelector AlignmentCSCOverlapSelectorModule; DEFINE_FWK_MODULE(AlignmentCSCOverlapSelectorModule); diff --git a/Alignment/CommonAlignmentProducer/plugins/AlignmentCSCTrackSelectorModule.cc b/Alignment/CommonAlignmentProducer/plugins/AlignmentCSCTrackSelectorModule.cc index d03ae59a79453..9d783b9ea4a98 100644 --- a/Alignment/CommonAlignmentProducer/plugins/AlignmentCSCTrackSelectorModule.cc +++ b/Alignment/CommonAlignmentProducer/plugins/AlignmentCSCTrackSelectorModule.cc @@ -1,7 +1,7 @@ #include "FWCore/Framework/interface/ConsumesCollector.h" #include "FWCore/Framework/interface/MakerMacros.h" -#include "CommonTools/UtilAlgos/interface/ObjectSelectorStream.h" +#include "CommonTools/UtilAlgos/interface/ObjectSelector.h" //the selectores used to select the tracks #include "Alignment/CommonAlignmentProducer/interface/AlignmentCSCTrackSelector.h" @@ -39,6 +39,6 @@ struct CSCTrackConfigSelector { AlignmentCSCTrackSelector theBaseSelector; }; -typedef ObjectSelectorStream AlignmentCSCTrackSelectorModule; +typedef ObjectSelector AlignmentCSCTrackSelectorModule; DEFINE_FWK_MODULE(AlignmentCSCTrackSelectorModule); diff --git a/Alignment/CommonAlignmentProducer/plugins/AlignmentMuonHIPTrajectorySelector.cc b/Alignment/CommonAlignmentProducer/plugins/AlignmentMuonHIPTrajectorySelector.cc index 417ed047241a4..60298e34112bf 100644 --- a/Alignment/CommonAlignmentProducer/plugins/AlignmentMuonHIPTrajectorySelector.cc +++ b/Alignment/CommonAlignmentProducer/plugins/AlignmentMuonHIPTrajectorySelector.cc @@ -24,7 +24,7 @@ // user include files #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDProducer.h" +#include "FWCore/Framework/interface/stream/EDProducer.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" @@ -51,7 +51,7 @@ // class decleration // -class AlignmentMuonHIPTrajectorySelector : public edm::EDProducer { +class AlignmentMuonHIPTrajectorySelector : public edm::stream::EDProducer<> { public: explicit AlignmentMuonHIPTrajectorySelector(const edm::ParameterSet&); ~AlignmentMuonHIPTrajectorySelector() override; diff --git a/Alignment/CommonAlignmentProducer/plugins/AlignmentMuonSelectorModule.cc b/Alignment/CommonAlignmentProducer/plugins/AlignmentMuonSelectorModule.cc index 57292b1f0e837..a808e285e263a 100644 --- a/Alignment/CommonAlignmentProducer/plugins/AlignmentMuonSelectorModule.cc +++ b/Alignment/CommonAlignmentProducer/plugins/AlignmentMuonSelectorModule.cc @@ -14,7 +14,7 @@ #include "FWCore/Framework/interface/ConsumesCollector.h" #include "FWCore/Framework/interface/MakerMacros.h" -#include "CommonTools/UtilAlgos/interface/ObjectSelectorStream.h" +#include "CommonTools/UtilAlgos/interface/ObjectSelector.h" #include "Alignment/CommonAlignmentProducer/interface/AlignmentMuonSelector.h" #include "DataFormats/MuonReco/interface/MuonFwd.h" @@ -48,6 +48,6 @@ struct MuonConfigSelector { AlignmentMuonSelector theSelector; }; -typedef ObjectSelectorStream AlignmentMuonSelectorModule; +typedef ObjectSelector AlignmentMuonSelectorModule; DEFINE_FWK_MODULE(AlignmentMuonSelectorModule); diff --git a/Alignment/CommonAlignmentProducer/plugins/AlignmentTrackSelectorModule.cc b/Alignment/CommonAlignmentProducer/plugins/AlignmentTrackSelectorModule.cc index 8500dad60bcee..3d22416e00abd 100644 --- a/Alignment/CommonAlignmentProducer/plugins/AlignmentTrackSelectorModule.cc +++ b/Alignment/CommonAlignmentProducer/plugins/AlignmentTrackSelectorModule.cc @@ -1,7 +1,7 @@ #include "FWCore/Framework/interface/ConsumesCollector.h" #include "FWCore/Framework/interface/MakerMacros.h" -#include "CommonTools/UtilAlgos/interface/ObjectSelectorStream.h" +#include "CommonTools/UtilAlgos/interface/ObjectSelector.h" //the selectores used to select the tracks #include "Alignment/CommonAlignmentProducer/interface/AlignmentTrackSelector.h" @@ -60,6 +60,6 @@ struct TrackConfigSelector { AlignmentTwoBodyDecayTrackSelector theTwoBodyDecaySelector; }; -typedef ObjectSelectorStream AlignmentTrackSelectorModule; +typedef ObjectSelector AlignmentTrackSelectorModule; DEFINE_FWK_MODULE(AlignmentTrackSelectorModule); diff --git a/Alignment/CommonAlignmentProducer/plugins/AlignmentTracksFromVertexSelectorModule.cc b/Alignment/CommonAlignmentProducer/plugins/AlignmentTracksFromVertexSelectorModule.cc index 1096b514dadd4..8f28c0c3bd874 100644 --- a/Alignment/CommonAlignmentProducer/plugins/AlignmentTracksFromVertexSelectorModule.cc +++ b/Alignment/CommonAlignmentProducer/plugins/AlignmentTracksFromVertexSelectorModule.cc @@ -1,6 +1,6 @@ #include "FWCore/Framework/interface/ConsumesCollector.h" #include "FWCore/Framework/interface/MakerMacros.h" -#include "CommonTools/UtilAlgos/interface/ObjectSelectorStream.h" +#include "CommonTools/UtilAlgos/interface/ObjectSelector.h" //the selectores used to select the tracks #include "Alignment/CommonAlignmentProducer/interface/AlignmentTracksFromVertexSelector.h" @@ -32,10 +32,10 @@ struct TrackFromVertexConfigSelector { AlignmentTrackFromVertexSelector theBaseSelector; }; -class AlignmentTrackFromVertexSelectorModule : public ObjectSelectorStream { +class AlignmentTrackFromVertexSelectorModule : public ObjectSelector { public: AlignmentTrackFromVertexSelectorModule(const edm::ParameterSet &ps) - : ObjectSelectorStream(ps) {} + : ObjectSelector(ps) {} static void fillDescriptions(edm::ConfigurationDescriptions &descriptions) { edm::ParameterSetDescription desc; desc.setComment("Alignment Tracks Selector from Vertices"); diff --git a/Alignment/CommonAlignmentProducer/plugins/GlobalTrackerMuonAlignment.cc b/Alignment/CommonAlignmentProducer/plugins/GlobalTrackerMuonAlignment.cc index b72d7b31cd1c7..6f566743fbbb8 100644 --- a/Alignment/CommonAlignmentProducer/plugins/GlobalTrackerMuonAlignment.cc +++ b/Alignment/CommonAlignmentProducer/plugins/GlobalTrackerMuonAlignment.cc @@ -31,7 +31,7 @@ // Framework #include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "FWCore/Framework/interface/ESWatcher.h" #include "FWCore/Framework/interface/Frameworkfwd.h" //#include "FWCore/Framework/interface/EDProducer.h" @@ -106,7 +106,7 @@ using namespace reco; // class declaration // -class GlobalTrackerMuonAlignment : public edm::EDAnalyzer { +class GlobalTrackerMuonAlignment : public edm::one::EDAnalyzer<> { public: explicit GlobalTrackerMuonAlignment(const edm::ParameterSet&); ~GlobalTrackerMuonAlignment() override; @@ -155,6 +155,11 @@ class GlobalTrackerMuonAlignment : public edm::EDAnalyzer { void endJob() override; // ----------member data --------------------------- + edm::ESGetToken m_TkGeometryToken; + edm::ESGetToken m_MagFieldToken; + edm::ESGetToken m_globalPosToken; + edm::ESGetToken m_propToken; + edm::ESGetToken m_ttrhBuilderToken; edm::InputTag trackTags_; // used to select what tracks to read from configuration file edm::InputTag muonTags_; // used to select what standalone muons @@ -270,18 +275,19 @@ class GlobalTrackerMuonAlignment : public edm::EDAnalyzer { // constructors and destructor // GlobalTrackerMuonAlignment::GlobalTrackerMuonAlignment(const edm::ParameterSet& iConfig) - : trackTags_(iConfig.getParameter("tracks")), + : m_TkGeometryToken(esConsumes()), + m_MagFieldToken(esConsumes()), + m_globalPosToken(esConsumes()), + m_propToken(esConsumes(edm::ESInputTag("", iConfig.getParameter("Propagator")))), + m_ttrhBuilderToken(esConsumes(edm::ESInputTag("", "witTrackAngle"))), + trackTags_(iConfig.getParameter("tracks")), muonTags_(iConfig.getParameter("muons")), gmuonTags_(iConfig.getParameter("gmuons")), smuonTags_(iConfig.getParameter("smuons")), - propagator_(iConfig.getParameter("Propagator")), - cosmicMuonMode_(iConfig.getParameter("cosmics")), isolatedMuonMode_(iConfig.getParameter("isolated")), - refitMuon_(iConfig.getParameter("refitmuon")), refitTrack_(iConfig.getParameter("refittrack")), - rootOutFile_(iConfig.getUntrackedParameter("rootOutFile")), txtOutFile_(iConfig.getUntrackedParameter("txtOutFile")), writeDB_(iConfig.getUntrackedParameter("writeDB")), @@ -660,20 +666,17 @@ void GlobalTrackerMuonAlignment::analyzeTrackTrack(const edm::Event& iEvent, con //iSetup.get().get(cscGeometry); if (watchTrackingGeometry_.check(iSetup) || !trackingGeometry_) { - edm::ESHandle trackingGeometry; - iSetup.get().get(trackingGeometry); + edm::ESHandle trackingGeometry = iSetup.getHandle(m_TkGeometryToken); trackingGeometry_ = &*trackingGeometry; } if (watchMagneticFieldRecord_.check(iSetup) || !magneticField_) { - edm::ESHandle magneticField; - iSetup.get().get(magneticField); + edm::ESHandle magneticField = iSetup.getHandle(m_MagFieldToken); magneticField_ = &*magneticField; } if (watchGlobalPositionRcd_.check(iSetup) || !globalPositionRcd_) { - edm::ESHandle globalPositionRcd; - iSetup.get().get(globalPositionRcd); + edm::ESHandle globalPositionRcd = iSetup.getHandle(m_globalPosToken); globalPositionRcd_ = &*globalPositionRcd; for (std::vector::const_iterator i = globalPositionRcd_->m_align.begin(); i != globalPositionRcd_->m_align.end(); @@ -695,8 +698,7 @@ void GlobalTrackerMuonAlignment::analyzeTrackTrack(const edm::Event& iEvent, con } } // end of GlobalPositionRcd - ESHandle propagator; - iSetup.get().get(propagator_, propagator); + edm::ESHandle propagator = iSetup.getHandle(m_propToken); SteppingHelixPropagator alongStHePr = SteppingHelixPropagator(magneticField_, alongMomentum); SteppingHelixPropagator oppositeStHePr = SteppingHelixPropagator(magneticField_, oppositeToMomentum); @@ -1339,21 +1341,18 @@ void GlobalTrackerMuonAlignment::analyzeTrackTrajectory(const edm::Event& iEvent //iSetup.get().get(cscGeometry); if (watchTrackingGeometry_.check(iSetup) || !trackingGeometry_) { - edm::ESHandle trackingGeometry; - iSetup.get().get(trackingGeometry); + edm::ESHandle trackingGeometry = iSetup.getHandle(m_TkGeometryToken); trackingGeometry_ = &*trackingGeometry; theTrackingGeometry = trackingGeometry; } if (watchMagneticFieldRecord_.check(iSetup) || !magneticField_) { - edm::ESHandle magneticField; - iSetup.get().get(magneticField); + edm::ESHandle magneticField = iSetup.getHandle(m_MagFieldToken); magneticField_ = &*magneticField; } if (watchGlobalPositionRcd_.check(iSetup) || !globalPositionRcd_) { - edm::ESHandle globalPositionRcd; - iSetup.get().get(globalPositionRcd); + edm::ESHandle globalPositionRcd = iSetup.getHandle(m_globalPosToken); globalPositionRcd_ = &*globalPositionRcd; for (std::vector::const_iterator i = globalPositionRcd_->m_align.begin(); i != globalPositionRcd_->m_align.end(); @@ -1379,8 +1378,7 @@ void GlobalTrackerMuonAlignment::analyzeTrackTrajectory(const edm::Event& iEvent } } // end of GlobalPositionRcd - ESHandle propagator; - iSetup.get().get(propagator_, propagator); + edm::ESHandle propagator = iSetup.getHandle(m_propToken); SteppingHelixPropagator alongStHePr = SteppingHelixPropagator(magneticField_, alongMomentum); SteppingHelixPropagator oppositeStHePr = SteppingHelixPropagator(magneticField_, oppositeToMomentum); @@ -1407,8 +1405,7 @@ void GlobalTrackerMuonAlignment::analyzeTrackTrajectory(const edm::Event& iEvent theFitterOp = new KFTrajectoryFitter(oppositeSmPr, *theUpdator, *theEstimator); theSmootherOp = new KFTrajectorySmoother(oppositeSmPr, *theUpdator, *theEstimator); - edm::ESHandle builder; - iSetup.get().get("WithTrackAngle", builder); + edm::ESHandle builder = iSetup.getHandle(m_ttrhBuilderToken); this->TTRHBuilder = &(*builder); this->MuRHBuilder = new MuonTransientTrackingRecHitBuilder(theTrackingGeometry); if (debug_) { diff --git a/Alignment/CommonAlignmentProducer/src/AlignmentTrackSelector.cc b/Alignment/CommonAlignmentProducer/src/AlignmentTrackSelector.cc index 59cfb81b812d1..35b1b72f26acc 100644 --- a/Alignment/CommonAlignmentProducer/src/AlignmentTrackSelector.cc +++ b/Alignment/CommonAlignmentProducer/src/AlignmentTrackSelector.cc @@ -16,12 +16,9 @@ #include "DataFormats/SiStripCluster/interface/SiStripCluster.h" #include "DataFormats/Alignment/interface/AlignmentClusterFlag.h" #include "DataFormats/Alignment/interface/AliClusterValueMap.h" - #include "DataFormats/DetId/interface/DetId.h" #include "DataFormats/SiStripDetId/interface/SiStripDetId.h" #include "DataFormats/SiPixelDetId/interface/PixelSubdetector.h" -#include "DataFormats/TrackerCommon/interface/TrackerTopology.h" -#include "Geometry/Records/interface/TrackerTopologyRcd.h" #include @@ -31,7 +28,8 @@ const int kFPIX = PixelSubdetector::PixelEndcap; // constructor ---------------------------------------------------------------- AlignmentTrackSelector::AlignmentTrackSelector(const edm::ParameterSet& cfg, edm::ConsumesCollector& iC) - : applyBasicCuts_(cfg.getParameter("applyBasicCuts")), + : tTopoToken_(iC.esConsumes()), + applyBasicCuts_(cfg.getParameter("applyBasicCuts")), applyNHighestPt_(cfg.getParameter("applyNHighestPt")), applyMultiplicityFilter_(cfg.getParameter("applyMultiplicityFilter")), seedOnlyFromAbove_(cfg.getParameter("seedOnlyFrom")), @@ -222,7 +220,7 @@ AlignmentTrackSelector::AlignmentTrackSelector(const edm::ParameterSet& cfg, edm // destructor ----------------------------------------------------------------- -AlignmentTrackSelector::~AlignmentTrackSelector() {} +AlignmentTrackSelector::~AlignmentTrackSelector() = default; // do selection --------------------------------------------------------------- @@ -321,9 +319,7 @@ bool AlignmentTrackSelector::detailedHitsCheck(const reco::Track* trackp, const edm::Event& evt, const edm::EventSetup& eSetup) const { //Retrieve tracker topology from geometry - edm::ESHandle tTopoHandle; - eSetup.get().get(tTopoHandle); - const TrackerTopology* const tTopo = tTopoHandle.product(); + const TrackerTopology* const tTopo = &eSetup.getData(tTopoToken_); // checking hit requirements beyond simple number of valid hits diff --git a/Alignment/LaserAlignmentSimulation/test/LaserSimulation_cfg.py b/Alignment/LaserAlignmentSimulation/test/LaserSimulation_cfg.py index a16db8aba4d6a..fd55fb96fea33 100644 --- a/Alignment/LaserAlignmentSimulation/test/LaserSimulation_cfg.py +++ b/Alignment/LaserAlignmentSimulation/test/LaserSimulation_cfg.py @@ -9,7 +9,7 @@ # include default services, like RandomNumberGenerator process.load("Configuration.StandardSequences.Services_cff") -process.load("Configuration.StandardSequences.Geometry_cff") +process.load("Configuration.StandardSequences.GeometryDB_cff") process.load("Configuration.StandardSequences.MagneticField_cff") diff --git a/Alignment/MuonAlignment/test/make_SVGtemplates_cfg.py b/Alignment/MuonAlignment/test/make_SVGtemplates_cfg.py index 1648c91913181..330fcf7c86b98 100644 --- a/Alignment/MuonAlignment/test/make_SVGtemplates_cfg.py +++ b/Alignment/MuonAlignment/test/make_SVGtemplates_cfg.py @@ -4,7 +4,7 @@ process.source = cms.Source("EmptySource") process.maxEvents = cms.untracked.PSet(input = cms.untracked.int32(1)) -process.load("Configuration.StandardSequences.Geometry_cff") +process.load("Configuration.StandardSequences.GeometryDB_cff") process.MuonGeometrySVGTemplate = cms.EDAnalyzer("MuonGeometrySVGTemplate", wheelTemplateName = cms.string("wheel_template.svg")) diff --git a/Alignment/MuonAlignment/test/test_sanityCheck_cfg.py b/Alignment/MuonAlignment/test/test_sanityCheck_cfg.py index 5ca932fe0cb7d..8556076b92212 100644 --- a/Alignment/MuonAlignment/test/test_sanityCheck_cfg.py +++ b/Alignment/MuonAlignment/test/test_sanityCheck_cfg.py @@ -6,7 +6,7 @@ process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff") process.GlobalTag.globaltag = "MC_36Y_V10::All" -process.load("Configuration.StandardSequences.Geometry_cff") +process.load("Configuration.StandardSequences.GeometryDB_cff") from Alignment.MuonAlignment.MuonGeometrySanityCheck_cfi import * process.MuonGeometrySanityCheck = MuonGeometrySanityCheck.clone() diff --git a/Alignment/MuonAlignmentAlgorithms/interface/MuonResidualsFromTrack.h b/Alignment/MuonAlignmentAlgorithms/interface/MuonResidualsFromTrack.h index 686e6341ba1d5..d3461ac33a3b7 100644 --- a/Alignment/MuonAlignmentAlgorithms/interface/MuonResidualsFromTrack.h +++ b/Alignment/MuonAlignmentAlgorithms/interface/MuonResidualsFromTrack.h @@ -51,8 +51,11 @@ class MuonResidualsFromTrack { public: + using BuilderToken = edm::ESGetToken; + static edm::ESInputTag builderESInputTag(); + // residuals from global muon trajectories - MuonResidualsFromTrack(const edm::EventSetup &iSetup, + MuonResidualsFromTrack(edm::ESHandle builder, edm::ESHandle magneticField, edm::ESHandle globalGeometry, edm::ESHandle muonDetIdAssociator_, diff --git a/Alignment/MuonAlignmentAlgorithms/plugins/CSCOverlapsAlignmentAlgorithm.cc b/Alignment/MuonAlignmentAlgorithms/plugins/CSCOverlapsAlignmentAlgorithm.cc index 0667893937ac8..3b7c793ada5ba 100644 --- a/Alignment/MuonAlignmentAlgorithms/plugins/CSCOverlapsAlignmentAlgorithm.cc +++ b/Alignment/MuonAlignmentAlgorithms/plugins/CSCOverlapsAlignmentAlgorithm.cc @@ -55,7 +55,7 @@ CSCOverlapsAlignmentAlgorithm::CSCOverlapsAlignmentAlgorithm(const edm::Paramete } if (m_slopeFromTrackRefit) { - m_trackTransformer = new TrackTransformer(iConfig.getParameter("TrackTransformer")); + m_trackTransformer = new TrackTransformer(iConfig.getParameter("TrackTransformer"), iC); } else { m_trackTransformer = nullptr; } diff --git a/Alignment/MuonAlignmentAlgorithms/plugins/MuonAlignmentFromReference.cc b/Alignment/MuonAlignmentAlgorithms/plugins/MuonAlignmentFromReference.cc index 1aa072191e10d..55e8b092b9fe4 100644 --- a/Alignment/MuonAlignmentAlgorithms/plugins/MuonAlignmentFromReference.cc +++ b/Alignment/MuonAlignmentAlgorithms/plugins/MuonAlignmentFromReference.cc @@ -116,6 +116,7 @@ class MuonAlignmentFromReference : public AlignmentAlgorithmBase { const edm::ESGetToken m_MagFieldToken; const edm::ESGetToken m_propToken; const edm::ESGetToken m_DetIdToken; + const MuonResidualsFromTrack::BuilderToken m_builderToken; // configutarion paramenters: edm::InputTag m_muonCollectionTag; @@ -199,6 +200,7 @@ MuonAlignmentFromReference::MuonAlignmentFromReference(const edm::ParameterSet& m_MagFieldToken(iC.esConsumes()), m_propToken(iC.esConsumes(edm::ESInputTag("", "SteppingHelixPropagatorAny"))), m_DetIdToken(iC.esConsumes(edm::ESInputTag("", "MuonDetIdAssociator"))), + m_builderToken(iC.esConsumes(MuonResidualsFromTrack::builderESInputTag())), m_muonCollectionTag(cfg.getParameter("muonCollectionTag")), m_reference(cfg.getParameter >("reference")), m_minTrackPt(cfg.getParameter("minTrackPt")), @@ -445,6 +447,7 @@ void MuonAlignmentFromReference::run(const edm::EventSetup& iSetup, const EventI const MagneticField* magneticField = &iSetup.getData(m_MagFieldToken); const Propagator* prop = &iSetup.getData(m_propToken); const DetIdAssociator* muonDetIdAssociator = &iSetup.getData(m_DetIdToken); + auto builder = iSetup.getHandle(m_builderToken); if (m_muonCollectionTag.label().empty()) // use trajectories { @@ -468,7 +471,7 @@ void MuonAlignmentFromReference::run(const edm::EventSetup& iSetup, const EventI m_counter_trackdxy++; if (m_debug) std::cout << "JUST BEFORE muonResidualsFromTrack" << std::endl; - MuonResidualsFromTrack muonResidualsFromTrack(iSetup, + MuonResidualsFromTrack muonResidualsFromTrack(builder, magneticField, globalGeometry, muonDetIdAssociator, diff --git a/Alignment/MuonAlignmentAlgorithms/src/MuonResidualsFromTrack.cc b/Alignment/MuonAlignmentAlgorithms/src/MuonResidualsFromTrack.cc index d845e80d2f81a..ea2d098795c1e 100644 --- a/Alignment/MuonAlignmentAlgorithms/src/MuonResidualsFromTrack.cc +++ b/Alignment/MuonAlignmentAlgorithms/src/MuonResidualsFromTrack.cc @@ -19,7 +19,9 @@ #include "TDecompChol.h" #include -MuonResidualsFromTrack::MuonResidualsFromTrack(const edm::EventSetup& iSetup, +edm::ESInputTag MuonResidualsFromTrack::builderESInputTag() { return edm::ESInputTag("", "WithTrackAngle"); } + +MuonResidualsFromTrack::MuonResidualsFromTrack(edm::ESHandle trackerRecHitBuilder, edm::ESHandle magneticField, edm::ESHandle globalGeometry, edm::ESHandle muonDetIdAssociator_, @@ -39,8 +41,6 @@ MuonResidualsFromTrack::MuonResidualsFromTrack(const edm::EventSetup& iSetup, clear(); - edm::ESHandle theTrackerRecHitBuilder; - iSetup.get().get("WithTrackAngle", theTrackerRecHitBuilder); reco::TransientTrack track(*m_recoTrack, &*magneticField, globalGeometry); TransientTrackingRecHit::ConstRecHitContainer recHitsForRefit; int iT = 0, iM = 0; @@ -52,7 +52,7 @@ MuonResidualsFromTrack::MuonResidualsFromTrack(const edm::EventSetup& iSetup, if (m_debug) std::cout << "Tracker Hit " << iT << " is found. Add to refit. Dimension: " << hit->dimension() << std::endl; - recHitsForRefit.push_back(theTrackerRecHitBuilder->build(&*hit)); + recHitsForRefit.push_back(trackerRecHitBuilder->build(&*hit)); } else if (hitId.det() == DetId::Muon) { // if ( hit->geographicalId().subdetId() == 3 && !theRPCInTheFit ) { // LogTrace("Reco|TrackingTools|TrackTransformer") << "RPC Rec Hit discarged"; diff --git a/Alignment/MuonAlignmentAlgorithms/test/StandAloneTest.cc b/Alignment/MuonAlignmentAlgorithms/test/StandAloneTest.cc index 33b988ead96a9..c7780c2c9b4b1 100644 --- a/Alignment/MuonAlignmentAlgorithms/test/StandAloneTest.cc +++ b/Alignment/MuonAlignmentAlgorithms/test/StandAloneTest.cc @@ -22,7 +22,7 @@ // user include files #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" @@ -57,7 +57,7 @@ // class decleration // -class StandAloneTest : public edm::EDAnalyzer { +class StandAloneTest : public edm::one::EDAnalyzer { public: explicit StandAloneTest(const edm::ParameterSet &); ~StandAloneTest(); @@ -69,7 +69,16 @@ class StandAloneTest : public edm::EDAnalyzer { // ----------member data --------------------------- - edm::InputTag m_Tracks; + const edm::InputTag m_Tracks; + const edm::EDGetTokenT m_tracksToken; + const edm::EDGetTokenT m_trajtracksmapToken; + + const MuonResidualsFromTrack::BuilderToken m_builderToken; + const edm::ESGetToken m_globalGeometryToken; + const edm::ESGetToken m_cscGeometryToken; + const edm::ESGetToken m_propToken; + const edm::ESGetToken m_magneticFieldToken; + const edm::ESGetToken m_muonDetIdAssociatorToken; // declare the TTree TTree *m_ttree; @@ -95,8 +104,17 @@ class StandAloneTest : public edm::EDAnalyzer { // constructors and destructor // StandAloneTest::StandAloneTest(const edm::ParameterSet &iConfig) - : m_Tracks(iConfig.getParameter("Tracks")) { + : m_Tracks(iConfig.getParameter("Tracks")), + m_tracksToken(consumes(m_Tracks)), + m_trajtracksmapToken(consumes(edm::InputTag("TrackRefitter", "Refitted"))), + m_builderToken(esConsumes(MuonResidualsFromTrack::builderESInputTag())), + m_globalGeometryToken(esConsumes()), + m_cscGeometryToken(esConsumes()), + m_propToken(esConsumes(edm::ESInputTag("", "SteppingHelixPropagatorAny"))), + m_magneticFieldToken(esConsumes()), + m_muonDetIdAssociatorToken(esConsumes(edm::ESInputTag("", "MuonDetIdAssociator"))) { edm::Service tFileService; + usesResource(TFileService::kSharedResource); // book the TTree m_ttree = tFileService->make("ttree", "ttree"); @@ -127,23 +145,17 @@ void StandAloneTest::analyze(const edm::Event &iEvent, const edm::EventSetup &iS } // get tracks and refitted from the Event - edm::Handle tracks; - iEvent.getByLabel(m_Tracks, tracks); - edm::Handle trajtracksmap; - iEvent.getByLabel("TrackRefitter", "Refitted", trajtracksmap); + edm::Handle tracks = iEvent.getHandle(m_tracksToken); + edm::Handle trajtracksmap = iEvent.getHandle(m_trajtracksmapToken); // get all tracking and CSC geometries from the EventSetup - edm::ESHandle globalGeometry; - iSetup.get().get(globalGeometry); - edm::ESHandle cscGeometry; - iSetup.get().get(cscGeometry); - - edm::ESHandle prop; - iSetup.get().get("SteppingHelixPropagatorAny", prop); - edm::ESHandle magneticField; - iSetup.get().get(magneticField); - edm::ESHandle muonDetIdAssociator_; - iSetup.get().get("MuonDetIdAssociator", muonDetIdAssociator_); + edm::ESHandle globalGeometry = iSetup.getHandle(m_globalGeometryToken); + edm::ESHandle cscGeometry = iSetup.getHandle(m_cscGeometryToken); + + auto builder = iSetup.getHandle(m_builderToken); + edm::ESHandle prop = iSetup.getHandle(m_propToken); + edm::ESHandle magneticField = iSetup.getHandle(m_magneticFieldToken); + edm::ESHandle muonDetIdAssociator_ = iSetup.getHandle(m_muonDetIdAssociatorToken); // loop over tracks for (reco::TrackCollection::const_iterator track = tracks->begin(); track != tracks->end(); ++track) { @@ -159,7 +171,7 @@ void StandAloneTest::analyze(const edm::Event &iEvent, const edm::EventSetup &iS // if good track, good trajectory if (track->pt() > 20. && traj != NULL && traj->isValid()) { // calculate all residuals on this track - MuonResidualsFromTrack muonResidualsFromTrack(iSetup, + MuonResidualsFromTrack muonResidualsFromTrack(builder, magneticField, globalGeometry, muonDetIdAssociator_, diff --git a/Alignment/OfflineValidation/macros/PlotAlignmentValidation.C b/Alignment/OfflineValidation/macros/PlotAlignmentValidation.C index ac26ba7ea0a88..db8e05dae9419 100644 --- a/Alignment/OfflineValidation/macros/PlotAlignmentValidation.C +++ b/Alignment/OfflineValidation/macros/PlotAlignmentValidation.C @@ -42,26 +42,23 @@ #include #include - /*! \class PlotAlignmentValidation * \brief Class PlotAlignmentValidation * Class used as the last step for Offline Track Validation tool. * The main goal of this class is creating the plots regarding DMRs and Surface Deformations for modules and substructures. */ - //------------------------------------------------------------------------------ /*! \fn PlotAlignmentValidation * \brief Constructor for the class */ -PlotAlignmentValidation::PlotAlignmentValidation(bool bigtext) : bigtext_(bigtext) -{ +PlotAlignmentValidation::PlotAlignmentValidation(bool bigtext) : bigtext_(bigtext) { setOutputDir("."); setTreeBaseDir(); sourcelist = NULL; - - moreThanOneSource=false; + + moreThanOneSource = false; useFit_ = false; // Force ROOT to use scientific notation even with smaller datasets @@ -81,8 +78,9 @@ PlotAlignmentValidation::PlotAlignmentValidation(bool bigtext) : bigtext_(bigtex /*! \fn PlotAlignmentValidation * \brief Constructor for the class. This function also retrieves the list of root files used to produce DMRs and Surface Deformations */ -PlotAlignmentValidation::PlotAlignmentValidation(const char *inputFile,std::string legendName, int lineColor, int lineStyle, bool bigtext) : PlotAlignmentValidation(bigtext) -{ +PlotAlignmentValidation::PlotAlignmentValidation( + const char* inputFile, std::string legendName, int lineColor, int lineStyle, bool bigtext) + : PlotAlignmentValidation(bigtext) { loadFileList(inputFile, legendName, lineColor, lineStyle); } @@ -90,16 +88,12 @@ PlotAlignmentValidation::PlotAlignmentValidation(const char *inputFile,std::stri /*! \fn ~PlotAlignmentValidation * \brief Default destructor */ -PlotAlignmentValidation::~PlotAlignmentValidation() -{ - - for(std::vector::iterator it = sourceList.begin(); - it != sourceList.end(); ++it){ +PlotAlignmentValidation::~PlotAlignmentValidation() { + for (std::vector::iterator it = sourceList.begin(); it != sourceList.end(); ++it) { delete (*it); } delete sourcelist; - } //------------------------------------------------------------------------------ @@ -108,23 +102,21 @@ PlotAlignmentValidation::~PlotAlignmentValidation() * \brief Create/open the root and txt summary files, where the DMR histograms and the associtated mean/sigma are stored respectively */ - -void PlotAlignmentValidation::openSummaryFile() -{ +void PlotAlignmentValidation::openSummaryFile() { if (!openedsummaryfile) { openedsummaryfile = true; - summaryfile.open(outputDir+"/"+summaryfilename+".txt"); + summaryfile.open(TString(outputDir + "/") + summaryfilename + ".txt"); //Rootfile introduced to store the DMR histograms - rootsummaryfile= new TFile(outputDir+"/"+summaryfilename+".root","RECREATE"); + rootsummaryfile = new TFile(TString(outputDir + "/") + summaryfilename + ".root", "RECREATE"); for (auto vars : sourceList) { summaryfile << "\t" << vars->getName(); } summaryfile << "\tformat={}\n"; - }else{ + } else { //Check for the rootfile to be open, and open it in case it is not already. - if (!rootsummaryfile->IsOpen()) rootsummaryfile->Open(outputDir+"/"+summaryfilename+".root","UPDATE"); - + if (!rootsummaryfile->IsOpen()) + rootsummaryfile->Open(TString(outputDir + "/") + summaryfilename + ".root", "UPDATE"); } } @@ -132,27 +124,19 @@ void PlotAlignmentValidation::openSummaryFile() /*! \fn loadFileList * \brief Add to the list of sources the rootfile associated to a particular geometry */ -void PlotAlignmentValidation::loadFileList(const char *inputFile, std::string legendName, int lineColor, int lineStyle) -{ - +void PlotAlignmentValidation::loadFileList(const char* inputFile, std::string legendName, int lineColor, int lineStyle) { if (openedsummaryfile) { std::cout << "Can't load a root file after opening the summary file!" << std::endl; assert(0); } - sourceList.push_back( new TkOfflineVariables( inputFile, treeBaseDir, legendName, lineColor, lineStyle ) ); - + sourceList.push_back(new TkOfflineVariables(inputFile, treeBaseDir, legendName, lineColor, lineStyle)); } //------------------------------------------------------------------------------ /*! \fn useFitForDMRplots * \brief Store the selected boolean in one of the private members of the class */ -void PlotAlignmentValidation::useFitForDMRplots(bool usefit) -{ - - useFit_ = usefit; - -} +void PlotAlignmentValidation::useFitForDMRplots(bool usefit) { useFit_ = usefit; } //------------------------------------------------------------------------------ /*! \fn numberOfLayers @@ -161,27 +145,42 @@ void PlotAlignmentValidation::useFitForDMRplots(bool usefit) //TODO Possible improvement: reduce the number of switches in the code by implementing a map int PlotAlignmentValidation::numberOfLayers(int phase, int subdetector) { switch (phase) { - case 0: - switch (subdetector) { - case 1: return 3; - case 2: return 2; - case 3: return 4; - case 4: return 3; - case 5: return 6; - case 6: return 9; - default: assert(false); - } - case 1: - switch (subdetector) { - case 1: return 4; - case 2: return 3; - case 3: return 4; - case 4: return 3; - case 5: return 6; - case 6: return 9; - default: assert(false); - } - default: assert(false); + case 0: + switch (subdetector) { + case 1: + return 3; + case 2: + return 2; + case 3: + return 4; + case 4: + return 3; + case 5: + return 6; + case 6: + return 9; + default: + assert(false); + } + case 1: + switch (subdetector) { + case 1: + return 4; + case 2: + return 3; + case 3: + return 4; + case 4: + return 3; + case 5: + return 6; + case 6: + return 9; + default: + assert(false); + } + default: + assert(false); } return 0; } @@ -202,16 +201,14 @@ int PlotAlignmentValidation::maxNumberOfLayers(int subdetector) { /*! \fn legendOptions * \brief Assign legend options to members of the class */ -void PlotAlignmentValidation::legendOptions(TString options) -{ - +void PlotAlignmentValidation::legendOptions(TString options) { showMean_ = false; showRMS_ = false; showMeanError_ = false; showRMSError_ = false; showModules_ = false; showUnderOverFlow_ = false; - options.ReplaceAll(" ","").ToLower(); + options.ReplaceAll(" ", "").ToLower(); if (options.Contains("mean") || options.Contains("all")) showMean_ = true; if (options.Contains("meanerror") || options.Contains("all")) @@ -232,8 +229,7 @@ void PlotAlignmentValidation::legendOptions(TString options) /*! \fn setOutputDir * \brief Set the output direcotry */ -void PlotAlignmentValidation::setOutputDir( std::string dir ) -{ +void PlotAlignmentValidation::setOutputDir(std::string dir) { if (openedsummaryfile) { std::cout << "Can't set the output dir after opening the summary file!" << std::endl; assert(0); @@ -246,64 +242,81 @@ void PlotAlignmentValidation::setOutputDir( std::string dir ) /*! \fn plotSubDetResiduals * \brief Function used to plot residuals for a subdetector */ -void PlotAlignmentValidation::plotSubDetResiduals(bool plotNormHisto,unsigned int subDetId) -{ +void PlotAlignmentValidation::plotSubDetResiduals(bool plotNormHisto, unsigned int subDetId) { gStyle->SetOptStat(11111); gStyle->SetOptFit(0000); - TCanvas *c = new TCanvas("c", "c"); + TCanvas* c = new TCanvas("c", "c"); c->SetTopMargin(0.15); - TString histoName= ""; - if (plotNormHisto) {histoName= "h_NormXprime";} - else histoName= "h_Xprime_"; - switch (subDetId){ - case 1 : histoName+="TPBBarrel_0";break; - case 2 : histoName+="TPEendcap_1";break; - case 3 : histoName+="TPEendcap_2";break; - case 4 : histoName+="TIBBarrel_0";break; - case 5 : histoName+="TIDEndcap_1";break; - case 6 : histoName+="TIDEndcap_2";break; - case 7 : histoName+="TOBBarrel_3";break; - case 8 : histoName+="TECEndcap_4";break; - case 9 : histoName+="TECEndcap_5";break; + TString histoName = ""; + if (plotNormHisto) { + histoName = "h_NormXprime"; + } else + histoName = "h_Xprime_"; + switch (subDetId) { + case 1: + histoName += "TPBBarrel_0"; + break; + case 2: + histoName += "TPEendcap_1"; + break; + case 3: + histoName += "TPEendcap_2"; + break; + case 4: + histoName += "TIBBarrel_0"; + break; + case 5: + histoName += "TIDEndcap_1"; + break; + case 6: + histoName += "TIDEndcap_2"; + break; + case 7: + histoName += "TOBBarrel_3"; + break; + case 8: + histoName += "TECEndcap_4"; + break; + case 9: + histoName += "TECEndcap_5"; + break; } int tmpcounter = 0; - TH1 *sumHisto = 0; - for(std::vector::iterator it = sourceList.begin(); - it != sourceList.end(); ++it) { - if (tmpcounter == 0 ) { - TFile *f= (*it)->getFile(); - sumHisto =(TH1*) f->FindKeyAny(histoName)->ReadObj();//FindObjectAny(histoName.Data()); - sumHisto->SetLineColor(tmpcounter+1); - sumHisto->SetLineStyle(tmpcounter+1); + TH1* sumHisto = 0; + for (std::vector::iterator it = sourceList.begin(); it != sourceList.end(); ++it) { + if (tmpcounter == 0) { + TFile* f = (*it)->getFile(); + sumHisto = (TH1*)f->FindKeyAny(histoName)->ReadObj(); //FindObjectAny(histoName.Data()); + sumHisto->SetLineColor(tmpcounter + 1); + sumHisto->SetLineStyle(tmpcounter + 1); sumHisto->GetFunction("tmp")->SetBit(TF1::kNotDraw); sumHisto->Draw(); - + //get statistic box coordinate to plot all boxes one below the other //gStyle->SetStatY(0.91); //gStyle->SetStatW(0.15); //gStyle->SetStatBorderSize(1); //gStyle->SetStatH(0.10); - - + tmpcounter++; } else { - sumHisto = (TH1*) (*it)->getFile()->FindObjectAny(histoName); - sumHisto->SetLineColor(tmpcounter+1); - sumHisto->SetLineStyle(tmpcounter+1); + sumHisto = (TH1*)(*it)->getFile()->FindObjectAny(histoName); + sumHisto->SetLineColor(tmpcounter + 1); + sumHisto->SetLineStyle(tmpcounter + 1); sumHisto->GetFunction("tmp")->SetBit(TF1::kNotDraw); //hstack->Add(sumHisto); - + c->Update(); - tmpcounter++; + tmpcounter++; } - TObject *statObj = sumHisto->GetListOfFunctions()->FindObject("stats"); + TObject* statObj = sumHisto->GetListOfFunctions()->FindObject("stats"); if (statObj && statObj->InheritsFrom(TPaveStats::Class())) { - TPaveStats *stats = static_cast(statObj); - stats->SetLineColor(tmpcounter+1); - stats->SetTextColor(tmpcounter+1); + TPaveStats* stats = static_cast(statObj); + stats->SetLineColor(tmpcounter + 1); + stats->SetTextColor(tmpcounter + 1); stats->SetFillColor(10); - stats->SetX1NDC(0.91-tmpcounter*0.1); + stats->SetX1NDC(0.91 - tmpcounter * 0.1); stats->SetX2NDC(0.15); stats->SetY1NDC(1); stats->SetY2NDC(0.10); @@ -312,200 +325,191 @@ void PlotAlignmentValidation::plotSubDetResiduals(bool plotNormHisto,unsigned in } //hstack->Draw("nostack"); char PlotName[1000]; - sprintf( PlotName, "%s/%s.png", outputDir.c_str(), histoName.Data() ); + sprintf(PlotName, "%s/%s.png", outputDir.c_str(), histoName.Data()); c->Print(PlotName); - sprintf( PlotName, "%s/%s.eps", outputDir.c_str(), histoName.Data() ); + sprintf(PlotName, "%s/%s.eps", outputDir.c_str(), histoName.Data()); c->Print(PlotName); - sprintf( PlotName, "%s/%s.pdf", outputDir.c_str(), histoName.Data() ); + sprintf(PlotName, "%s/%s.pdf", outputDir.c_str(), histoName.Data()); c->Print(PlotName); - sprintf( PlotName, "%s/%s.root", outputDir.c_str(), histoName.Data() ); + sprintf(PlotName, "%s/%s.root", outputDir.c_str(), histoName.Data()); c->Print(PlotName); //delete c; //c=0; - } //------------------------------------------------------------------------------ -void PlotAlignmentValidation::plotHitMaps() -{ - +void PlotAlignmentValidation::plotHitMaps() { //gStyle->SetOptStat(0); - - TCanvas *c = new TCanvas("c", "c", 1200,400); - c->Divide(3,1); + + TCanvas* c = new TCanvas("c", "c", 1200, 400); + c->Divide(3, 1); //ps->NewPage(); //------------------------------------------------- //plot Hit map //------------------------------------------------- - std::string histName_="Entriesprofile"; + std::string histName_ = "Entriesprofile"; c->cd(1); - TTree *tree= (*sourceList.begin())->getTree(); - tree->Draw("entries:posR:posZ","","COLZ2Prof"); + TTree* tree = (*sourceList.begin())->getTree(); + tree->Draw("entries:posR:posZ", "", "COLZ2Prof"); c->cd(2); - tree->Draw("entries:posY:posX","","COLZ2Prof"); + tree->Draw("entries:posY:posX", "", "COLZ2Prof"); c->cd(3); - tree->Draw("entries:posR:posPhi","","COLZ2Prof"); - + tree->Draw("entries:posR:posPhi", "", "COLZ2Prof"); + char PlotName[1000]; - sprintf( PlotName, "%s/%s.png", outputDir.c_str(), histName_.c_str() ); + sprintf(PlotName, "%s/%s.png", outputDir.c_str(), histName_.c_str()); c->Print(PlotName); - sprintf( PlotName, "%s/%s.eps", outputDir.c_str(), histName_.c_str() ); + sprintf(PlotName, "%s/%s.eps", outputDir.c_str(), histName_.c_str()); c->Print(PlotName); - sprintf( PlotName, "%s/%s.pdf", outputDir.c_str(), histName_.c_str() ); + sprintf(PlotName, "%s/%s.pdf", outputDir.c_str(), histName_.c_str()); c->Print(PlotName); - sprintf( PlotName, "%s/%s.root", outputDir.c_str(), histName_.c_str() ); + sprintf(PlotName, "%s/%s.root", outputDir.c_str(), histName_.c_str()); c->Print(PlotName); // //c->Update(); - c->Close(); + c->Close(); //---------------------------------------------------- - } //------------------------------------------------------------------------------ -void PlotAlignmentValidation::plotOutlierModules(const char *outputFileName, std::string plotVariable, - float plotVariable_cut ,int unsigned minHits) -{ - - Int_t counter=0; - +void PlotAlignmentValidation::plotOutlierModules(const char* outputFileName, + std::string plotVariable, + float plotVariable_cut, + int unsigned minHits) { + Int_t counter = 0; + gStyle->SetOptStat(111111); gStyle->SetStatY(0.9); //TList* treelist=getTreeList(); - - TCanvas *c1 = new TCanvas("canv", "canv", 800, 500); - outputFile = outputDir +'/'+ outputFileName; - c1->Print( (outputFile+'[').Data() ); - - - c1->Divide(2,1); - - TTree *tree= (*sourceList.begin())->getTree(); - TkOffTreeVariables *treeMem = 0; // ROOT will initilise + + TCanvas* c1 = new TCanvas("canv", "canv", 800, 500); + outputFile = outputDir + '/' + outputFileName; + c1->Print((outputFile + '[').Data()); + + c1->Divide(2, 1); + + TTree* tree = (*sourceList.begin())->getTree(); + TkOffTreeVariables* treeMem = 0; // ROOT will initilise tree->SetBranchAddress("TkOffTreeVariables", &treeMem); - - - Long64_t nentries = tree->GetEntriesFast(); - - for (Long64_t i = 0; i < nentries; i++){ - + + Long64_t nentries = tree->GetEntriesFast(); + + for (Long64_t i = 0; i < nentries; i++) { tree->GetEntry(i); float var = 0; - if (plotVariable == "chi2PerDofX") var =treeMem->chi2PerDofX; - else if(plotVariable == "chi2PerDofY") var =treeMem->chi2PerDofY; - else if(plotVariable == "fitMeanX") var =treeMem->fitMeanX; - else if(plotVariable == "fitMeanY") var =treeMem->fitMeanY; - else if(plotVariable == "fitSigmaX") var =treeMem->fitSigmaX; - else if(plotVariable == "fitSigmaY") var =treeMem->fitSigmaY; + if (plotVariable == "chi2PerDofX") + var = treeMem->chi2PerDofX; + else if (plotVariable == "chi2PerDofY") + var = treeMem->chi2PerDofY; + else if (plotVariable == "fitMeanX") + var = treeMem->fitMeanX; + else if (plotVariable == "fitMeanY") + var = treeMem->fitMeanY; + else if (plotVariable == "fitSigmaX") + var = treeMem->fitSigmaX; + else if (plotVariable == "fitSigmaY") + var = treeMem->fitSigmaY; else { - cout<<"There is no variable "<entries "<entries< plotVariable_cut && treeMem->entries > minHits) - { - - TFile *f=(*sourceList.begin())->getFile();//(TFile*)sourcelist->First(); - - if(f->FindKeyAny(treeMem->histNameX.c_str())!=0){ - TH1 *h = (TH1*) f->FindKeyAny(treeMem->histNameX.c_str())->ReadObj();//f->FindObjectAny(treeMem->histNameX.c_str()); - gStyle->SetOptFit(0111); - cout<<"hist name "<GetName()<GetPath(), "TrackerOfflineValidation" ); - //cout<<"hist path "<GetEntries()<cd(0); - TPaveText * text=new TPaveText(0,0.95,0.99,0.99); - text->AddText(path); - text->SetFillColor(0); - text->SetShadowColor(0); - text->SetBorderSize( 0 ); - text->Draw(); - - //residual histogram - c1->cd(1); - TPad *subpad = (TPad*)c1->GetPad(1); - subpad->SetPad(0,0,0.5,0.94); - h->Draw(); - - //norm. residual histogram - h = (TH1*) f->FindObjectAny(treeMem->histNameNormX.c_str()); - if(h) cout<GetEntries()<cd(2); - TPad *subpad2 = (TPad*)c1->GetPad(2); - subpad2->SetPad(0.5,0,0.99,0.94); - h->Draw(); - - c1->Print(outputFile); - counter++; - } - else{ - cout<<"There are no residual histograms on module level stored!"<entries "<entries< plotVariable_cut && treeMem->entries > minHits) { + TFile* f = (*sourceList.begin())->getFile(); //(TFile*)sourcelist->First(); + + if (f->FindKeyAny(treeMem->histNameX.c_str()) != 0) { + TH1* h = + (TH1*)f->FindKeyAny(treeMem->histNameX.c_str())->ReadObj(); //f->FindObjectAny(treeMem->histNameX.c_str()); + gStyle->SetOptFit(0111); + cout << "hist name " << h->GetName() << endl; + + TString path = (char*)strstr(gDirectory->GetPath(), "TrackerOfflineValidation"); + //cout<<"hist path "<GetEntries() << endl; + + //modules' location as title + c1->cd(0); + TPaveText* text = new TPaveText(0, 0.95, 0.99, 0.99); + text->AddText(path); + text->SetFillColor(0); + text->SetShadowColor(0); + text->SetBorderSize(0); + text->Draw(); + + //residual histogram + c1->cd(1); + TPad* subpad = (TPad*)c1->GetPad(1); + subpad->SetPad(0, 0, 0.5, 0.94); + h->Draw(); + + //norm. residual histogram + h = (TH1*)f->FindObjectAny(treeMem->histNameNormX.c_str()); + if (h) + cout << h->GetEntries() << endl; + c1->cd(2); + TPad* subpad2 = (TPad*)c1->GetPad(2); + subpad2->SetPad(0.5, 0, 0.99, 0.94); + h->Draw(); + + c1->Print(outputFile); + counter++; + } else { + cout << "There are no residual histograms on module level stored!" << endl; + cout << "Please make sure that moduleLevelHistsTransient = cms.bool(False) in the validation job!" << endl; + break; } - + } } - c1->Print( (outputFile+"]").Data() ); - if (counter == 0) cout<<"no bad modules found"<Print((outputFile + "]").Data()); + if (counter == 0) + cout << "no bad modules found" << endl; + //read the number of entries in the t3 //TTree* tree=0; //tree=(TTree*)treeList->At(0); - - + //c1->Close(); - } //------------------------------------------------------------------------------ /*! \fn getTreeList * \brief Extract from the rootfiles stored in the sourcelist the corresponding trees. */ -TList* PlotAlignmentValidation::getTreeList() -{ - TList *treeList = new TList(); - TFile *first_source = (TFile*)sourcelist->First(); - std::cout<GetName()<Get( treeBaseDir.c_str() ); - treeList->Add( (TTree*)(*d).Get("TkOffVal") ); - - if( moreThanOneSource ==true ){ - TFile *nextsource = (TFile*)sourcelist->After( first_source ); - while ( nextsource ) { - std::cout<GetName()<Get("TrackerOfflineValidation"); - +TList* PlotAlignmentValidation::getTreeList() { + TList* treeList = new TList(); + TFile* first_source = (TFile*)sourcelist->First(); + std::cout << first_source->GetName() << std::endl; + TDirectoryFile* d = (TDirectoryFile*)first_source->Get(treeBaseDir.c_str()); + treeList->Add((TTree*)(*d).Get("TkOffVal")); + + if (moreThanOneSource == true) { + TFile* nextsource = (TFile*)sourcelist->After(first_source); + while (nextsource) { + std::cout << nextsource->GetName() << std::endl; + d = (TDirectoryFile*)nextsource->Get("TrackerOfflineValidation"); + treeList->Add((TTree*)(*d).Get("TkOffVal")); - - nextsource = (TFile*)sourcelist->After( nextsource ); + + nextsource = (TFile*)sourcelist->After(nextsource); } } return treeList; } //------------------------------------------------------------------------------ -void PlotAlignmentValidation::setTreeBaseDir( std::string dir ) -{ - treeBaseDir = dir; -} +void PlotAlignmentValidation::setTreeBaseDir(std::string dir) { treeBaseDir = dir; } //------------------------------------------------------------------------------ -void PlotAlignmentValidation::plotSurfaceShapes( const std::string& options, const std::string& residType ) -{ +void PlotAlignmentValidation::plotSurfaceShapes(const std::string& options, const std::string& residType) { cout << "-------- plotSurfaceShapes called with " << options << endl; if (options == "none") return; - else if (options == "coarse"){ + else if (options == "coarse") { plotSS("subdet=1"); plotSS("subdet=2"); plotSS("subdet=3"); @@ -514,23 +518,22 @@ void PlotAlignmentValidation::plotSurfaceShapes( const std::string& options, con plotSS("subdet=6"); } // else if (options == "fine") ... - else - plotSS( options, residType ); + else + plotSS(options, residType); return; } //------------------------------------------------------------------------------ -void PlotAlignmentValidation::plotSS( const std::string& options, const std::string& residType ) -{ +void PlotAlignmentValidation::plotSS(const std::string& options, const std::string& residType) { if (residType == "") { - plotSS( options, "ResXvsXProfile"); - plotSS( options, "ResXvsYProfile"); + plotSS(options, "ResXvsXProfile"); + plotSS(options, "ResXvsYProfile"); return; } int bkperrorx = gStyle->GetErrorX(); - gStyle->SetErrorX(1); //regardless of style settings, we want x error bars here + gStyle->SetErrorX(1); //regardless of style settings, we want x error bars here int plotLayerN = 0; // int plotRingN = 0; @@ -538,41 +541,44 @@ void PlotAlignmentValidation::plotSS( const std::string& options, const std::str bool plotLayers = false; // overrides plotLayerN // bool plotRings = false; // Todo: implement this? bool plotSplits = false; - int plotSubDetN = 0; // if zero, plot all + int plotSubDetN = 0; // if zero, plot all TRegexp layer_re("layer=[0-9]+"); Ssiz_t index, len; - if (options.find("split") != std::string::npos) { plotSplits = true; } - if (options.find("layers") != std::string::npos) { plotLayers = true; } + if (options.find("split") != std::string::npos) { + plotSplits = true; + } + if (options.find("layers") != std::string::npos) { + plotLayers = true; + } if ((index = layer_re.Index(options, &len)) != -1) { if (plotLayers) { std::cerr << "Warning: option 'layers' overrides 'layer=N'" << std::endl; } else { - std::string substr = options.substr(index+6, len-6); + std::string substr = options.substr(index + 6, len - 6); plotLayerN = atoi(substr.c_str()); } } TRegexp subdet_re("subdet=[1-6]+"); if ((index = subdet_re.Index(options, &len)) != -1) { - std::string substr = options.substr(index+7, len-7); + std::string substr = options.substr(index + 7, len - 7); plotSubDetN = atoi(substr.c_str()); } gStyle->SetOptStat(0); - + TCanvas c("canv", "canv"); // todo: title, min/max, nbins? // Loop over detectors - for (int iSubDet=1; iSubDet<=6; ++iSubDet) { - + for (int iSubDet = 1; iSubDet <= 6; ++iSubDet) { // TEC requires special care since rings 1-4 and 5-7 are plotted separately - bool isTEC = (iSubDet==6); + bool isTEC = (iSubDet == 6); // if subdet is specified, skip other subdets - if (plotSubDetN!=0 && iSubDet!=plotSubDetN) + if (plotSubDetN != 0 && iSubDet != plotSubDetN) continue; // Skips plotting too high layers @@ -586,120 +592,131 @@ void PlotAlignmentValidation::plotSS( const std::string& options, const std::str int maxlayer = plotLayers ? maxNumberOfLayers(iSubDet) : plotLayerN; // see later where this is used int maxlayerphase0 = plotLayers ? numberOfLayers(0, iSubDet) : plotLayerN; - + for (int layer = minlayer; layer <= maxlayer; layer++) { + // two plots for TEC, skip first + for (int iTEC = 0; iTEC < 2; iTEC++) { + if (!isTEC && iTEC == 0) + continue; + + char selection[1000]; + if (!isTEC) { + if (layer == 0) + sprintf(selection, "subDetId==%d", iSubDet); + else + sprintf(selection, "subDetId==%d && layer == %d", iSubDet, layer); + } else { // TEC + if (iTEC == 0) // rings + sprintf(selection, "subDetId==%d && ring <= 4", iSubDet); + else + sprintf(selection, "subDetId==%d && ring > 4", iSubDet); + } - // two plots for TEC, skip first - for (int iTEC = 0; iTEC<2; iTEC++) { - if (!isTEC && iTEC==0) continue; - - char selection[1000]; - if (!isTEC){ - if (layer==0) - sprintf(selection,"subDetId==%d",iSubDet); - else - sprintf(selection,"subDetId==%d && layer == %d",iSubDet,layer); - } - else{ // TEC - if (iTEC==0) // rings - sprintf(selection,"subDetId==%d && ring <= 4",iSubDet); - else - sprintf(selection,"subDetId==%d && ring > 4",iSubDet); - } - - - // Title for plot and name for the file - - TString subDetName; - switch (iSubDet) { - case 1: subDetName = "BPIX"; break; - case 2: subDetName = "FPIX"; break; - case 3: subDetName = "TIB"; break; - case 4: subDetName = "TID"; break; - case 5: subDetName = "TOB"; break; - case 6: subDetName = "TEC"; break; - } + // Title for plot and name for the file + + TString subDetName; + switch (iSubDet) { + case 1: + subDetName = "BPIX"; + break; + case 2: + subDetName = "FPIX"; + break; + case 3: + subDetName = "TIB"; + break; + case 4: + subDetName = "TID"; + break; + case 5: + subDetName = "TOB"; + break; + case 6: + subDetName = "TEC"; + break; + } TString secondline = ""; - if (layer!=0) { - // TEC and TID have discs, the rest have layers - if (iSubDet==4 || iSubDet==6) - secondline = "disc "; - else { - secondline = "layer "; - } - secondline += Form("%d",layer); - secondline += " "; - } - if (isTEC && iTEC==0) - secondline += TString("R1-4"); - if (isTEC && iTEC>0) - secondline += TString("R5-7"); - - // Generate histograms with selection - TLegend* legend = 0; + if (layer != 0) { + // TEC and TID have discs, the rest have layers + if (iSubDet == 4 || iSubDet == 6) + secondline = "disc "; + else { + secondline = "layer "; + } + secondline += Form("%d", layer); + secondline += " "; + } + if (isTEC && iTEC == 0) + secondline += TString("R1-4"); + if (isTEC && iTEC > 0) + secondline += TString("R5-7"); + + // Generate histograms with selection + TLegend* legend = 0; // Any file from phase 0 will be skipped if the last argument is false - THStack *hs = addHists(selection, residType, &legend, false, /*validforphase0 = */layer <= maxlayerphase0); - if (!hs || hs->GetHists()==0 || hs->GetHists()->GetSize()==0) { - std::cout << "No histogram for " << subDetName << - ", perhaps not enough data? Creating default histogram." << std::endl; - if(hs == 0) - hs = new THStack("hstack", ""); - - TProfile* defhist = new TProfile("defhist", "Empty default histogram", 100, -1, 1, -1, 1); - hs->Add(defhist); - hs->Draw(); - } - else { - hs->Draw("nostack PE"); - modifySSHistAndLegend(hs, legend); - legend->Draw(); - setTitleStyle(*hs, "", "", iSubDet, true, secondline); - - // Adjust Labels - TH1* firstHisto = (TH1*) hs->GetHists()->First(); - TString xName = firstHisto->GetXaxis()->GetTitle(); - TString yName = firstHisto->GetYaxis()->GetTitle(); - hs->GetHistogram()->GetXaxis()->SetTitleColor( kBlack ); - hs->GetHistogram()->GetXaxis()->SetTitle( xName ); - hs->GetHistogram()->GetYaxis()->SetTitleColor( kBlack ); - // micrometers: - yName.ReplaceAll("cm", "#mum"); - hs->GetHistogram()->GetYaxis()->SetTitle( yName ); - } - - // Save plot to file - std::ostringstream plotName; - plotName << outputDir << "/SurfaceShape_" << subDetName << "_"; - plotName << residType; - if (layer!=0) { - plotName << "_"; - // TEC and TID have discs, the rest have layers - if (iSubDet==4 || iSubDet==6) - plotName << "disc"; - else { - plotName << "layer"; - } - plotName << layer; - } - if (isTEC && iTEC==0) - plotName << "_" << "R1-4"; - if (isTEC && iTEC>0) - plotName << "_" << "R5-7"; - - // PNG,EPS,PDF files - c.Update(); - c.Print((plotName.str() + ".png").c_str()); - c.Print((plotName.str() + ".eps").c_str()); - c.Print((plotName.str() + ".pdf").c_str()); - - // ROOT file - TFile f((plotName.str() + ".root").c_str(), "recreate"); - c.Write(); - f.Close(); - - delete legend; - delete hs; + THStack* hs = addHists(selection, residType, &legend, false, /*validforphase0 = */ layer <= maxlayerphase0); + if (!hs || hs->GetHists() == 0 || hs->GetHists()->GetSize() == 0) { + std::cout << "No histogram for " << subDetName << ", perhaps not enough data? Creating default histogram." + << std::endl; + if (hs == 0) + hs = new THStack("hstack", ""); + + TProfile* defhist = new TProfile("defhist", "Empty default histogram", 100, -1, 1, -1, 1); + hs->Add(defhist); + hs->Draw(); + } else { + hs->Draw("nostack PE"); + modifySSHistAndLegend(hs, legend); + legend->Draw(); + setTitleStyle(*hs, "", "", iSubDet, true, secondline); + + // Adjust Labels + TH1* firstHisto = (TH1*)hs->GetHists()->First(); + TString xName = firstHisto->GetXaxis()->GetTitle(); + TString yName = firstHisto->GetYaxis()->GetTitle(); + hs->GetHistogram()->GetXaxis()->SetTitleColor(kBlack); + hs->GetHistogram()->GetXaxis()->SetTitle(xName); + hs->GetHistogram()->GetYaxis()->SetTitleColor(kBlack); + // micrometers: + yName.ReplaceAll("cm", "#mum"); + hs->GetHistogram()->GetYaxis()->SetTitle(yName); + } + + // Save plot to file + std::ostringstream plotName; + plotName << outputDir << "/SurfaceShape_" << subDetName << "_"; + plotName << residType; + if (layer != 0) { + plotName << "_"; + // TEC and TID have discs, the rest have layers + if (iSubDet == 4 || iSubDet == 6) + plotName << "disc"; + else { + plotName << "layer"; + } + plotName << layer; + } + if (isTEC && iTEC == 0) + plotName << "_" + << "R1-4"; + if (isTEC && iTEC > 0) + plotName << "_" + << "R5-7"; + + // PNG,EPS,PDF files + c.Update(); + c.Print((plotName.str() + ".png").c_str()); + c.Print((plotName.str() + ".eps").c_str()); + c.Print((plotName.str() + ".pdf").c_str()); + + // ROOT file + TFile f((plotName.str() + ".root").c_str(), "recreate"); + c.Write(); + f.Close(); + + delete legend; + delete hs; } } } @@ -708,36 +725,34 @@ void PlotAlignmentValidation::plotSS( const std::string& options, const std::str return; } - //------------------------------------------------------------------------------ /*! \fn plotDMR * \brief Main function used to plot DMRs for a single IOV printing the canvases in the output directory and saving histograms and fit funtions in a root file. */ -void PlotAlignmentValidation::plotDMR(const std::string& variable, Int_t minHits, const std::string& options) -{ +void PlotAlignmentValidation::plotDMR(const std::string& variable, Int_t minHits, const std::string& options) { // If several, comma-separated values are given in 'variable', // call plotDMR with each value separately. // If a comma is found, the string is divided to two. // (no space allowed) std::size_t findres = variable.find(","); - if ( findres != std::string::npos) { - std::string substring1 = variable.substr(0, findres); - std::string substring2 = variable.substr(findres+1, std::string::npos); + if (findres != std::string::npos) { + std::string substring1 = variable.substr(0, findres); + std::string substring2 = variable.substr(findres + 1, std::string::npos); plotDMR(substring1, minHits, options); plotDMR(substring2, minHits, options); return; - } + } // Variable name should end with X or Y. If it doesn't, recursively calls plotDMR twice with // X and Y added, respectively - if (variable == "mean" || variable == "median" || variable == "meanNorm" || - variable == "rms" || variable == "rmsNorm") { - plotDMR(variable+"X", minHits, options); - plotDMR(variable+"Y", minHits, options); + if (variable == "mean" || variable == "median" || variable == "meanNorm" || variable == "rms" || + variable == "rmsNorm") { + plotDMR(variable + "X", minHits, options); + plotDMR(variable + "Y", minHits, options); return; } - // options: + // options: // -plain (default, the whole distribution) // -split (distribution splitted to two) // -layers (plain db for each layer/disc superimposed in one plot) @@ -749,30 +764,38 @@ void PlotAlignmentValidation::plotDMR(const std::string& variable, Int_t minHits bool plotPlain = false, plotSplits = false, plotLayers = false; int plotLayerN = 0; Ssiz_t index, len; - if (options.find("plain") != std::string::npos) { plotPlain = true; } - if (options.find("split") != std::string::npos) { plotSplits = true; } - if (options.find("layers") != std::string::npos) { plotLayers = true; } + if (options.find("plain") != std::string::npos) { + plotPlain = true; + } + if (options.find("split") != std::string::npos) { + plotSplits = true; + } + if (options.find("layers") != std::string::npos) { + plotLayers = true; + } if ((index = layer_re.Index(options, &len)) != -1) { if (plotLayers) { std::cerr << "Warning: option 'layers' overrides 'layer=N'" << std::endl; } else { - std::string substr = options.substr(index+6, len-6); + std::string substr = options.substr(index + 6, len - 6); plotLayerN = atoi(substr.c_str()); } } // Defaults to plotting only plain plot if empty (or invalid) // option string is given - if (!plotPlain && !plotSplits) { plotPlain = true; } + if (!plotPlain && !plotSplits) { + plotPlain = true; + } // This boolean array tells for which detector modules to plot split DMR plots // They are plotted for BPIX, FPIX, TIB and TOB - static bool plotSplitsFor[6] = { true, true, true, false, true, false }; + static bool plotSplitsFor[6] = {true, true, true, false, true, false}; DMRPlotInfo plotinfo; gStyle->SetOptStat(0); - + TCanvas c("canv", "canv"); plotinfo.variable = variable; @@ -783,38 +806,77 @@ void PlotAlignmentValidation::plotDMR(const std::string& variable, Int_t minHits // width in cm // for DMRS, use 100 bins in range +-10 um, bin width 0.2um // if modified, check also TrackerOfflineValidationSummary_cfi.py and TrackerOfflineValidation_Standalone_cff.py - if (variable == "meanX") { plotinfo.nbins = 50; plotinfo.min = -0.001; plotinfo.max = 0.001; } - else if (variable == "meanY") { plotinfo.nbins = 50; plotinfo.min = -0.005; plotinfo.max = 0.005; } - else if (variable == "medianX") - if (plotSplits) { plotinfo.nbins = 50; plotinfo.min = -0.0005; plotinfo.max = 0.0005;} - else { plotinfo.nbins = 100; plotinfo.min = -0.001; plotinfo.max = 0.001; } + if (variable == "meanX") { + plotinfo.nbins = 50; + plotinfo.min = -0.001; + plotinfo.max = 0.001; + } else if (variable == "meanY") { + plotinfo.nbins = 50; + plotinfo.min = -0.005; + plotinfo.max = 0.005; + } else if (variable == "medianX") + if (plotSplits) { + plotinfo.nbins = 50; + plotinfo.min = -0.0005; + plotinfo.max = 0.0005; + } else { + plotinfo.nbins = 100; + plotinfo.min = -0.001; + plotinfo.max = 0.001; + } else if (variable == "medianY") - if (plotSplits) { plotinfo.nbins = 50; plotinfo.min = -0.0005; plotinfo.max = 0.0005;} - else { plotinfo.nbins = 100; plotinfo.min = -0.001; plotinfo.max = 0.001; } - else if (variable == "meanNormX") { plotinfo.nbins = 100; plotinfo.min = -2.0; plotinfo.max = 2.0; } - else if (variable == "meanNormY") { plotinfo.nbins = 100; plotinfo.min = -2.0; plotinfo.max = 2.0; } - else if (variable == "rmsX") { plotinfo.nbins = 100; plotinfo.min = 0.0; plotinfo.max = 0.1; } - else if (variable == "rmsY") { plotinfo.nbins = 100; plotinfo.min = 0.0; plotinfo.max = 0.1; } - else if (variable == "rmsNormX") { plotinfo.nbins = 100; plotinfo.min = 0.3; plotinfo.max = 1.8; } - else if (variable == "rmsNormY") { plotinfo.nbins = 100; plotinfo.min = 0.3; plotinfo.max = 1.8; } - else { + if (plotSplits) { + plotinfo.nbins = 50; + plotinfo.min = -0.0005; + plotinfo.max = 0.0005; + } else { + plotinfo.nbins = 100; + plotinfo.min = -0.001; + plotinfo.max = 0.001; + } + else if (variable == "meanNormX") { + plotinfo.nbins = 100; + plotinfo.min = -2.0; + plotinfo.max = 2.0; + } else if (variable == "meanNormY") { + plotinfo.nbins = 100; + plotinfo.min = -2.0; + plotinfo.max = 2.0; + } else if (variable == "rmsX") { + plotinfo.nbins = 100; + plotinfo.min = 0.0; + plotinfo.max = 0.1; + } else if (variable == "rmsY") { + plotinfo.nbins = 100; + plotinfo.min = 0.0; + plotinfo.max = 0.1; + } else if (variable == "rmsNormX") { + plotinfo.nbins = 100; + plotinfo.min = 0.3; + plotinfo.max = 1.8; + } else if (variable == "rmsNormY") { + plotinfo.nbins = 100; + plotinfo.min = 0.3; + plotinfo.max = 1.8; + } else { std::cerr << "Unknown variable " << variable << std::endl; - plotinfo.nbins = 100; plotinfo.min = -0.1; plotinfo.max = 0.1; + plotinfo.nbins = 100; + plotinfo.min = -0.1; + plotinfo.max = 0.1; } //Begin loop on structures - for (int i=1; i<=6; ++i) { - + for (int i = 1; i <= 6; ++i) { // Skip strip detectors if plotting any "Y" variable - if (i != 1 && i != 2 && variable.length() > 0 && variable[variable.length()-1] == 'Y') { + if (i != 1 && i != 2 && variable.length() > 0 && variable[variable.length() - 1] == 'Y') { continue; } - + // Skips plotting too high layers if (plotLayerN > maxNumberOfLayers(i)) { continue; } - plotinfo.plotSplits = plotSplits && plotSplitsFor[i-1]; + plotinfo.plotSplits = plotSplits && plotSplitsFor[i - 1]; if (!plotinfo.plotPlain && !plotinfo.plotSplits) { continue; } @@ -824,17 +886,27 @@ void PlotAlignmentValidation::plotDMR(const std::string& variable, Int_t minHits bool hasheader = (TkAlStyle::legendheader != ""); int nPlots = 1; - if (plotinfo.plotSplits) { nPlots = 3; } + if (plotinfo.plotSplits) { + nPlots = 3; + } // This will make the legend a bit bigger than necessary if there is a mixture of phase 0 and phase 1. // Not worth it to implement more complicated logic. - if (plotinfo.plotLayers) { nPlots *= maxNumberOfLayers(i); } + if (plotinfo.plotLayers) { + nPlots *= maxNumberOfLayers(i); + } nPlots *= sourceList.size(); - if (twolines_) { nPlots *= 2; } + if (twolines_) { + nPlots *= 2; + } nPlots += hasheader; double legendY = 0.80; - if (nPlots > 3) { legendY -= 0.01 * (nPlots - 3); } - if (bigtext_) { legendY -= 0.05; } + if (nPlots > 3) { + legendY -= 0.01 * (nPlots - 3); + } + if (bigtext_) { + legendY -= 0.05; + } if (legendY < 0.6) { std::cerr << "Warning: Huge legend!" << std::endl; legendY = 0.6; @@ -845,53 +917,72 @@ void PlotAlignmentValidation::plotDMR(const std::string& variable, Int_t minHits plotinfo.subDetId = i; plotinfo.legend = new TLegend(0.17, legendY, 0.85, 0.88); plotinfo.legend->SetNColumns(2); - if (hasheader) plotinfo.legend->SetHeader(TkAlStyle::legendheader); - if (bigtext_) plotinfo.legend->SetTextSize(TkAlStyle::textSize); + if (hasheader) + plotinfo.legend->SetHeader(TkAlStyle::legendheader); + if (bigtext_) + plotinfo.legend->SetTextSize(TkAlStyle::textSize); plotinfo.legend->SetFillStyle(0); plotinfo.hstack = &hstack; plotinfo.h = plotinfo.h1 = plotinfo.h2 = 0; plotinfo.firsthisto = true; openSummaryFile(); - vmean.clear(); vrms.clear(); vdeltamean.clear(); vmeanerror.clear(); vPValueEqualSplitMeans.clear(), vAlignmentUncertainty.clear(); vPValueMeanEqualIdeal.clear(); vPValueRMSEqualIdeal.clear(); + vmean.clear(); + vrms.clear(); + vdeltamean.clear(); + vmeanerror.clear(); + vPValueEqualSplitMeans.clear(), vAlignmentUncertainty.clear(); + vPValueMeanEqualIdeal.clear(); + vPValueRMSEqualIdeal.clear(); std::string stringsubdet; switch (i) { - case 1: stringsubdet = "BPIX"; break; - case 2: stringsubdet = "FPIX"; break; - case 3: stringsubdet = "TIB"; break; - case 4: stringsubdet = "TID"; break; - case 5: stringsubdet = "TOB"; break; - case 6: stringsubdet = "TEC"; break; + case 1: + stringsubdet = "BPIX"; + break; + case 2: + stringsubdet = "FPIX"; + break; + case 3: + stringsubdet = "TIB"; + break; + case 4: + stringsubdet = "TID"; + break; + case 5: + stringsubdet = "TOB"; + break; + case 6: + stringsubdet = "TEC"; + break; } - for(std::vector::iterator it = sourceList.begin(); - it != sourceList.end(); ++it) { - + for (std::vector::iterator it = sourceList.begin(); it != sourceList.end(); ++it) { plotinfo.vars = *it; plotinfo.h1 = plotinfo.h2 = plotinfo.h = 0; int minlayer = plotLayers ? 1 : plotLayerN; //Layer 0 is associated to the entire structure, this check ensures that even when both the plotLayers and the plotPlain options are active, also the histogram for the entire structure is made. - if(plotinfo.plotPlain) minlayer=0; + if (plotinfo.plotPlain) + minlayer = 0; int maxlayer = plotLayers ? numberOfLayers(plotinfo.vars->getPhase(), plotinfo.subDetId) : plotLayerN; for (int layer = minlayer; layer <= maxlayer; layer++) { + if (plotinfo.plotPlain) { + plotDMRHistogram(plotinfo, 0, layer, stringsubdet); + } - if (plotinfo.plotPlain) { - plotDMRHistogram(plotinfo, 0, layer, stringsubdet); - } - - if (plotinfo.plotSplits) { - plotDMRHistogram(plotinfo, -1, layer, stringsubdet); - plotDMRHistogram(plotinfo, 1, layer, stringsubdet); - } + if (plotinfo.plotSplits) { + plotDMRHistogram(plotinfo, -1, layer, stringsubdet); + plotDMRHistogram(plotinfo, 1, layer, stringsubdet); + } - if (plotinfo.plotPlain) { - if (plotinfo.h) { + if (plotinfo.plotPlain) { + if (plotinfo.h) { setDMRHistStyleAndLegend(plotinfo.h, plotinfo, 0, layer); } else { - if ((plotinfo.variable == "medianX" || plotinfo.variable == "medianY") && /*!plotinfo.plotLayers && */layer==0) { + if ((plotinfo.variable == "medianX" || plotinfo.variable == "medianY") && + /*!plotinfo.plotLayers && */ layer == 0) { vmean.push_back(nan("")); vrms.push_back(nan("")); vmeanerror.push_back(nan("")); @@ -904,57 +995,58 @@ void PlotAlignmentValidation::plotDMR(const std::string& variable, Int_t minHits } } } - } - - if (plotinfo.plotSplits) { - // Add delta mu to the histogram - if (plotinfo.h1 != 0 && plotinfo.h2 != 0 && !plotinfo.plotPlain) { - std::ostringstream legend; - std::string unit = " #mum"; - legend.precision(3); - legend << fixed; // to always show 3 decimals - float factor = 10000.0f; - if (plotinfo.variable == "meanNormX" || plotinfo.variable == "meanNormY" || - plotinfo.variable == "rmsNormX" || plotinfo.variable == "rmsNormY") { - factor = 1.0f; - unit = ""; - } - float deltamu = factor*(plotinfo.h2->GetMean(1) - plotinfo.h1->GetMean(1)); - legend << plotinfo.vars->getName(); - if (layer > 0) { - // TEC and TID have discs, the rest have layers - if (i==4 || i==6) - legend << ", disc "; - else - legend << ", layer "; - legend << layer; - } - plotinfo.legend->AddEntry(static_cast(0), legend.str().c_str(), ""); - legend.str(""); - legend << "#Delta#mu = " << deltamu << unit; - plotinfo.legend->AddEntry(static_cast(0), legend.str().c_str(), ""); - - if ((plotinfo.variable == "medianX" || plotinfo.variable == "medianY") && !plotLayers && layer==0) { - vdeltamean.push_back(deltamu); + } + + if (plotinfo.plotSplits) { + // Add delta mu to the histogram + if (plotinfo.h1 != 0 && plotinfo.h2 != 0 && !plotinfo.plotPlain) { + std::ostringstream legend; + std::string unit = " #mum"; + legend.precision(3); + legend << fixed; // to always show 3 decimals + float factor = 10000.0f; + if (plotinfo.variable == "meanNormX" || plotinfo.variable == "meanNormY" || + plotinfo.variable == "rmsNormX" || plotinfo.variable == "rmsNormY") { + factor = 1.0f; + unit = ""; + } + float deltamu = factor * (plotinfo.h2->GetMean(1) - plotinfo.h1->GetMean(1)); + legend << plotinfo.vars->getName(); + if (layer > 0) { + // TEC and TID have discs, the rest have layers + if (i == 4 || i == 6) + legend << ", disc "; + else + legend << ", layer "; + legend << layer; } - } - if (plotinfo.h1) { setDMRHistStyleAndLegend(plotinfo.h1, plotinfo, -1, layer); } - if (plotinfo.h2) { setDMRHistStyleAndLegend(plotinfo.h2, plotinfo, 1, layer); } - } + plotinfo.legend->AddEntry(static_cast(0), legend.str().c_str(), ""); + legend.str(""); + legend << "#Delta#mu = " << deltamu << unit; + plotinfo.legend->AddEntry(static_cast(0), legend.str().c_str(), ""); + if ((plotinfo.variable == "medianX" || plotinfo.variable == "medianY") && !plotLayers && layer == 0) { + vdeltamean.push_back(deltamu); + } + } + if (plotinfo.h1) { + setDMRHistStyleAndLegend(plotinfo.h1, plotinfo, -1, layer); + } + if (plotinfo.h2) { + setDMRHistStyleAndLegend(plotinfo.h2, plotinfo, 1, layer); + } + } } - } - if (hstack.GetHists()!=0 && hstack.GetHists()->GetSize()!=0) { + if (hstack.GetHists() != 0 && hstack.GetHists()->GetSize() != 0) { hstack.Draw("nostack"); - hstack.SetMaximum(plotinfo.maxY*1.3); + hstack.SetMaximum(plotinfo.maxY * 1.3); setTitleStyle(hstack, variable.c_str(), "#modules", plotinfo.subDetId); setHistStyle(*hstack.GetHistogram(), variable.c_str(), "#modules", 1); - plotinfo.legend->Draw(); - } - else { + plotinfo.legend->Draw(); + } else { // Draw an empty default histogram plotinfo.h = new TH1F("defhist", "Empty default histogram", plotinfo.nbins, plotinfo.min, plotinfo.max); plotinfo.h->SetMaximum(10); @@ -968,42 +1060,66 @@ void PlotAlignmentValidation::plotDMR(const std::string& variable, Int_t minHits std::ostringstream plotName; plotName << outputDir << "/D"; - if (variable=="medianX") plotName << "medianR_"; - else if (variable=="medianY") plotName << "medianYR_"; - else if (variable=="meanX") plotName << "meanR_"; - else if (variable=="meanY") plotName << "meanYR_"; - else if (variable=="meanNormX") plotName << "meanNR_"; - else if (variable=="meanNormY") plotName << "meanNYR_"; - else if (variable=="rmsX") plotName << "rmsR_"; - else if (variable=="rmsY") plotName << "rmsYR_"; - else if (variable=="rmsNormX") plotName << "rmsNR_"; - else if (variable=="rmsNormY") plotName << "rmsNYR_"; - + if (variable == "medianX") + plotName << "medianR_"; + else if (variable == "medianY") + plotName << "medianYR_"; + else if (variable == "meanX") + plotName << "meanR_"; + else if (variable == "meanY") + plotName << "meanYR_"; + else if (variable == "meanNormX") + plotName << "meanNR_"; + else if (variable == "meanNormY") + plotName << "meanNYR_"; + else if (variable == "rmsX") + plotName << "rmsR_"; + else if (variable == "rmsY") + plotName << "rmsYR_"; + else if (variable == "rmsNormX") + plotName << "rmsNR_"; + else if (variable == "rmsNormY") + plotName << "rmsNYR_"; TString subdet; switch (i) { - case 1: subdet = "BPIX"; break; - case 2: subdet = "FPIX"; break; - case 3: subdet = "TIB"; break; - case 4: subdet = "TID"; break; - case 5: subdet = "TOB"; break; - case 6: subdet = "TEC"; break; + case 1: + subdet = "BPIX"; + break; + case 2: + subdet = "FPIX"; + break; + case 3: + subdet = "TIB"; + break; + case 4: + subdet = "TID"; + break; + case 5: + subdet = "TOB"; + break; + case 6: + subdet = "TEC"; + break; } plotName << subdet; - if (plotPlain && !plotSplits) { plotName << "_plain"; } - else if (!plotPlain && plotSplits) { plotName << "_split"; } + if (plotPlain && !plotSplits) { + plotName << "_plain"; + } else if (!plotPlain && plotSplits) { + plotName << "_split"; + } if (plotLayers) { // TEC and TID have discs, the rest have layers - if (i==4 || i==6) + if (i == 4 || i == 6) plotName << "_discs"; else plotName << "_layers"; } if (plotLayerN > 0) { // TEC and TID have discs, the rest have layers - if (i==4 || i==6) + if (i == 4 || i == 6) plotName << "_disc"; else plotName << "_layer"; @@ -1011,7 +1127,7 @@ void PlotAlignmentValidation::plotDMR(const std::string& variable, Int_t minHits } // PNG,EPS,PDF files - c.Update(); + c.Update(); c.Print((plotName.str() + ".png").c_str()); c.Print((plotName.str() + ".eps").c_str()); c.Print((plotName.str() + ".pdf").c_str()); @@ -1020,7 +1136,7 @@ void PlotAlignmentValidation::plotDMR(const std::string& variable, Int_t minHits TFile f((plotName.str() + ".root").c_str(), "recreate"); c.Write(); f.Close(); - + // Free allocated memory. delete plotinfo.h; delete plotinfo.h1; @@ -1028,120 +1144,143 @@ void PlotAlignmentValidation::plotDMR(const std::string& variable, Int_t minHits if (vmean.size()) { summaryfile << " mu_" << subdet; - if (plotinfo.variable == "medianY") summaryfile << "_y"; + if (plotinfo.variable == "medianY") + summaryfile << "_y"; summaryfile << " (um)\t" << "latexname=$\\mu_\\text{" << subdet << "}"; - if (plotinfo.variable == "medianY") summaryfile << "^{y}"; + if (plotinfo.variable == "medianY") + summaryfile << "^{y}"; summaryfile << "$ ($\\mu$m)\t" << "format={:.3g}\t" << "latexformat=${:.3g}$"; - for (auto mu : vmean) summaryfile << "\t" << mu; + for (auto mu : vmean) + summaryfile << "\t" << mu; summaryfile << "\n"; } if (vrms.size()) { summaryfile << "sigma_" << subdet; - if (plotinfo.variable == "medianY") summaryfile << "_y"; + if (plotinfo.variable == "medianY") + summaryfile << "_y"; summaryfile << " (um)\t" << "latexname=$\\sigma_\\text{" << subdet << "}"; - if (plotinfo.variable == "medianY") summaryfile << "^{y}"; + if (plotinfo.variable == "medianY") + summaryfile << "^{y}"; summaryfile << "$ ($\\mu$m)\t" << "format={:.3g}\t" << "latexformat=${:.3g}$"; - for (auto sigma : vrms) summaryfile << "\t" << sigma; + for (auto sigma : vrms) + summaryfile << "\t" << sigma; summaryfile << "\n"; } if (vdeltamean.size()) { - summaryfile << " dmu_" << subdet ; - if (plotinfo.variable == "medianY") summaryfile << "_y"; + summaryfile << " dmu_" << subdet; + if (plotinfo.variable == "medianY") + summaryfile << "_y"; summaryfile << " (um)\t" << "latexname=$\\Delta\\mu_\\text{" << subdet << "}"; - if (plotinfo.variable == "medianY") summaryfile << "^{y}"; + if (plotinfo.variable == "medianY") + summaryfile << "^{y}"; summaryfile << "$ ($\\mu$m)\t" << "format={:.3g}\t" << "latexformat=${:.3g}$"; - for (auto dmu : vdeltamean) summaryfile << "\t" << dmu; + for (auto dmu : vdeltamean) + summaryfile << "\t" << dmu; summaryfile << "\n"; } if (vmeanerror.size()) { - summaryfile << " sigma_mu_" << subdet ; - if (plotinfo.variable == "medianY") summaryfile << "_y"; + summaryfile << " sigma_mu_" << subdet; + if (plotinfo.variable == "medianY") + summaryfile << "_y"; summaryfile << " (um)\t" << "latexname=$\\sigma\\mu_\\text{" << subdet << "}"; - if (plotinfo.variable == "medianY") summaryfile << "^{y}"; + if (plotinfo.variable == "medianY") + summaryfile << "^{y}"; summaryfile << "$ ($\\mu$m)\t" << "format={:.3g}\t" << "latexformat=${:.3g}$"; - for (auto dmu : vmeanerror) summaryfile << "\t" << dmu; + for (auto dmu : vmeanerror) + summaryfile << "\t" << dmu; summaryfile << "\n"; } if (vPValueEqualSplitMeans.size()) { - summaryfile << " p_delta_mu_equal_zero_" << subdet ; - if (plotinfo.variable == "medianY") summaryfile << "_y"; + summaryfile << " p_delta_mu_equal_zero_" << subdet; + if (plotinfo.variable == "medianY") + summaryfile << "_y"; summaryfile << "\t" << "latexname=$P(\\delta\\mu_\\text{" << subdet << "}=0)"; - if (plotinfo.variable == "medianY") summaryfile << "^{y}"; + if (plotinfo.variable == "medianY") + summaryfile << "^{y}"; summaryfile << "$\t" << "format={:.3g}\t" << "latexformat=${:.3g}$"; - for (auto dmu : vPValueEqualSplitMeans) summaryfile << "\t" << dmu; + for (auto dmu : vPValueEqualSplitMeans) + summaryfile << "\t" << dmu; summaryfile << "\n"; } if (vAlignmentUncertainty.size()) { - summaryfile << " alignment_uncertainty_" << subdet ; - if (plotinfo.variable == "medianY") summaryfile << "_y"; + summaryfile << " alignment_uncertainty_" << subdet; + if (plotinfo.variable == "medianY") + summaryfile << "_y"; summaryfile << " (um)\t" << "latexname=$\\sigma_\\text{align}_\\text{" << subdet << "}"; - if (plotinfo.variable == "medianY") summaryfile << "^{y}"; + if (plotinfo.variable == "medianY") + summaryfile << "^{y}"; summaryfile << "$ ($\\mu$m)\t" << "format={:.3g}\t" << "latexformat=${:.3g}$"; - for (auto dmu : vAlignmentUncertainty) summaryfile << "\t" << dmu; + for (auto dmu : vAlignmentUncertainty) + summaryfile << "\t" << dmu; summaryfile << "\n"; } if (vPValueMeanEqualIdeal.size()) { - summaryfile << " p_mean_equals_ideal_" << subdet ; - if (plotinfo.variable == "medianY") summaryfile << "_y"; + summaryfile << " p_mean_equals_ideal_" << subdet; + if (plotinfo.variable == "medianY") + summaryfile << "_y"; summaryfile << "\t" << "latexname=$P(\\mu_\\text{" << subdet << "}=\\mu_\\text{ideal})"; - if (plotinfo.variable == "medianY") summaryfile << "^{y}"; + if (plotinfo.variable == "medianY") + summaryfile << "^{y}"; summaryfile << "$\t" << "format={:.3g}\t" << "latexformat=${:.3g}$"; - for (auto dmu : vPValueMeanEqualIdeal) summaryfile << "\t" << dmu; + for (auto dmu : vPValueMeanEqualIdeal) + summaryfile << "\t" << dmu; summaryfile << "\n"; } if (vPValueRMSEqualIdeal.size()) { - summaryfile << " p_RMS_equals_ideal_" << subdet ; - if (plotinfo.variable == "medianY") summaryfile << "_y"; + summaryfile << " p_RMS_equals_ideal_" << subdet; + if (plotinfo.variable == "medianY") + summaryfile << "_y"; summaryfile << "\t" << "latexname=$P(\\sigma_\\text{" << subdet << "}=\\sigma_\\text{ideal})"; - if (plotinfo.variable == "medianY") summaryfile << "^{y}"; + if (plotinfo.variable == "medianY") + summaryfile << "^{y}"; summaryfile << "$\t" << "format={:.3g}\t" << "latexformat=${:.3g}$"; - for (auto dmu : vPValueRMSEqualIdeal) summaryfile << "\t" << dmu; + for (auto dmu : vPValueRMSEqualIdeal) + summaryfile << "\t" << dmu; summaryfile << "\n"; } } } //------------------------------------------------------------------------------ -void PlotAlignmentValidation::plotChi2(const char *inputFile) -{ +void PlotAlignmentValidation::plotChi2(const char* inputFile) { // Opens the file (it should be OfflineValidation(Parallel)_result.root) // and reads and plots the norm_chi^2 and h_chi2Prob -distributions. Bool_t errorflag = kTRUE; - TFile* fi1 = TFile::Open(inputFile,"read"); + TFile* fi1 = TFile::Open(inputFile, "read"); TDirectoryFile* mta1 = NULL; TDirectoryFile* mtb1 = NULL; TCanvas* normchi = NULL; TCanvas* chiprob = NULL; if (fi1 != NULL) { - mta1 = (TDirectoryFile*) fi1->Get("TrackerOfflineValidationStandalone"); - if(mta1 != NULL) { - mtb1 = (TDirectoryFile*) mta1->Get("GlobalTrackVariables"); - if(mtb1 != NULL) { + mta1 = (TDirectoryFile*)fi1->Get("TrackerOfflineValidationStandalone"); + if (mta1 != NULL) { + mtb1 = (TDirectoryFile*)mta1->Get("GlobalTrackVariables"); + if (mtb1 != NULL) { normchi = dynamic_cast(mtb1->Get("h_normchi2")); chiprob = dynamic_cast(mtb1->Get("h_chi2Prob")); if (normchi != NULL && chiprob != NULL) { @@ -1150,17 +1289,17 @@ void PlotAlignmentValidation::plotChi2(const char *inputFile) } } } - if(errorflag) - { + if (errorflag) { std::cout << "PlotAlignmentValidation::plotChi2: Can't find data from given file," << " no chi^2-plots produced" << std::endl; return; } - TLegend *legend = 0; + TLegend* legend = 0; for (auto primitive : *normchi->GetListOfPrimitives()) { legend = dynamic_cast(primitive); - if (legend) break; + if (legend) + break; } if (legend) { openSummaryFile(); @@ -1172,10 +1311,11 @@ void PlotAlignmentValidation::plotChi2(const char *inputFile) int style = alignment->getLineStyle(); bool foundit = false; for (auto entry : *legend->GetListOfPrimitives()) { - TLegendEntry *legendentry = dynamic_cast(entry); + TLegendEntry* legendentry = dynamic_cast(entry); assert(legendentry); - TH1 *h = dynamic_cast(legendentry->GetObject()); - if (!h) continue; + TH1* h = dynamic_cast(legendentry->GetObject()); + if (!h) + continue; if (legendentry->GetLabel() == title && h->GetLineColor() == color && h->GetLineStyle() == style) { foundit = true; summaryfile << h->GetEntries(); @@ -1210,56 +1350,72 @@ void PlotAlignmentValidation::plotChi2(const char *inputFile) fi3.Close(); delete fi1; - } //------------------------------------------------------------------------------ -THStack* PlotAlignmentValidation::addHists(const TString& selection, const TString &residType, - TLegend **myLegend, bool printModuleIds, bool validforphase0) -{ +THStack* PlotAlignmentValidation::addHists( + const TString& selection, const TString& residType, TLegend** myLegend, bool printModuleIds, bool validforphase0) { enum ResidType { - xPrimeRes, yPrimeRes, xPrimeNormRes, yPrimeNormRes, xRes, yRes, xNormRes, /*yResNorm*/ - ResXvsXProfile, ResXvsYProfile, ResYvsXProfile, ResYvsYProfile + xPrimeRes, + yPrimeRes, + xPrimeNormRes, + yPrimeNormRes, + xRes, + yRes, + xNormRes, /*yResNorm*/ + ResXvsXProfile, + ResXvsYProfile, + ResYvsXProfile, + ResYvsYProfile }; ResidType rType = xPrimeRes; - if (residType == "xPrime") rType = xPrimeRes; - else if (residType == "yPrime") rType = yPrimeRes; - else if (residType == "xPrimeNorm") rType = xPrimeNormRes; - else if (residType == "yPrimeNorm") rType = yPrimeNormRes; - else if (residType == "x") rType = xRes; - else if (residType == "y") rType = yRes; - else if (residType == "xNorm") rType = xNormRes; + if (residType == "xPrime") + rType = xPrimeRes; + else if (residType == "yPrime") + rType = yPrimeRes; + else if (residType == "xPrimeNorm") + rType = xPrimeNormRes; + else if (residType == "yPrimeNorm") + rType = yPrimeNormRes; + else if (residType == "x") + rType = xRes; + else if (residType == "y") + rType = yRes; + else if (residType == "xNorm") + rType = xNormRes; // else if (residType == "yNorm") rType = yResNorm; - else if (residType == "ResXvsXProfile") rType = ResXvsXProfile; - else if (residType == "ResYvsXProfile") rType = ResYvsXProfile; - else if (residType == "ResXvsYProfile") rType = ResXvsYProfile; - else if (residType == "ResYvsYProfile") rType = ResYvsYProfile; + else if (residType == "ResXvsXProfile") + rType = ResXvsXProfile; + else if (residType == "ResYvsXProfile") + rType = ResYvsXProfile; + else if (residType == "ResXvsYProfile") + rType = ResXvsYProfile; + else if (residType == "ResYvsYProfile") + rType = ResYvsYProfile; else { - std::cout << "PlotAlignmentValidation::addHists: Unknown residual type " - << residType << std::endl; + std::cout << "PlotAlignmentValidation::addHists: Unknown residual type " << residType << std::endl; return 0; } cout << "PlotAlignmentValidation::addHists: using selection " << selection << endl; - THStack * retHistoStack = new THStack("hstack", ""); + THStack* retHistoStack = new THStack("hstack", ""); if (myLegend != 0) if (*myLegend == 0) { *myLegend = new TLegend(0.17, 0.80, 0.85, 0.88); } - for(std::vector::iterator itSourceFile = sourceList.begin(); - itSourceFile != sourceList.end(); ++itSourceFile) { - + for (std::vector::iterator itSourceFile = sourceList.begin(); itSourceFile != sourceList.end(); + ++itSourceFile) { std::vector histnames; - TFile *f = (*itSourceFile)->getFile(); - TTree *tree= (*itSourceFile)->getTree(); + TFile* f = (*itSourceFile)->getFile(); + TTree* tree = (*itSourceFile)->getTree(); int myLineColor = (*itSourceFile)->getLineColor(); int myLineStyle = (*itSourceFile)->getLineStyle(); TString myLegendName = (*itSourceFile)->getName(); - TH1 *h = 0; // becomes result - UInt_t nEmpty = 0;// selected, but empty hists - Long64_t nentries = tree->GetEntriesFast(); + TH1* h = 0; // becomes result + UInt_t nEmpty = 0; // selected, but empty hists + Long64_t nentries = tree->GetEntriesFast(); if (!f || !tree) { std::cout << "PlotAlignmentValidation::addHists: no tree or no file" << std::endl; return 0; @@ -1267,19 +1423,19 @@ THStack* PlotAlignmentValidation::addHists(const TString& selection, const TStri bool histnamesfilled = false; int phase = (bool)(f->Get("TrackerOfflineValidationStandalone/Pixel/P1PXBBarrel_1")); - if (residType.Contains("Res") && residType.Contains("Profile")) - { - TString basename = TString(residType).ReplaceAll("Res","p_res") - .ReplaceAll("vs","") - .ReplaceAll("Profile","_"); //gives e.g.: p_resXX_ + if (residType.Contains("Res") && residType.Contains("Profile")) { + TString basename = TString(residType) + .ReplaceAll("Res", "p_res") + .ReplaceAll("vs", "") + .ReplaceAll("Profile", "_"); //gives e.g.: p_resXX_ if (selection == "subDetId==1") { - if (phase==1) + if (phase == 1) histnames.push_back(TString(basename) += "P1PXBBarrel_1"); else histnames.push_back(TString(basename) += "TPBBarrel_1"); histnamesfilled = true; } else if (selection == "subDetId==2") { - if (phase==1) { + if (phase == 1) { histnames.push_back(TString(basename) += "P1PXECEndcap_2"); histnames.push_back(TString(basename) += "P1PXECEndcap_3"); } else { @@ -1297,7 +1453,7 @@ THStack* PlotAlignmentValidation::addHists(const TString& selection, const TStri } else if (selection == "subDetId==5") { histnames.push_back(TString(basename) += "TOBBarrel_4"); histnamesfilled = true; - } else if (selection == "subDetId==6") { //whole TEC - doesn't happen by default but easy enough to account for + } else if (selection == "subDetId==6") { //whole TEC - doesn't happen by default but easy enough to account for histnames.push_back(TString(basename) += "TECEndcap_5"); histnames.push_back(TString(basename) += "TECEndcap_6"); histnamesfilled = true; @@ -1307,16 +1463,13 @@ THStack* PlotAlignmentValidation::addHists(const TString& selection, const TStri for (int iDisk = 1; iDisk <= 9; iDisk++) for (int iSide = 1; iSide <= 2; iSide++) for (int iPetal = 1; iPetal <= 8; iPetal++) - for (int iRing = 1; iRing <= 4 - (iDisk>=4) - (iDisk>=7) - (iDisk>=9); iRing++) + for (int iRing = 1; iRing <= 4 - (iDisk >= 4) - (iDisk >= 7) - (iDisk >= 9); iRing++) //in the higher disks, the inner rings go away. But the numbering in the file structure removes the higher numbers // so the numbers there do not correspond to the actual ring numbers { stringstream s; - s << "TrackerOfflineValidationStandalone/Strip/TECEndcap_" << iEndcap - << "/TECDisk_" << iDisk - << "/TECSide_" << iSide - << "/TECPetal_" << iPetal - << "/" << basename << "TECRing_" << iRing; + s << "TrackerOfflineValidationStandalone/Strip/TECEndcap_" << iEndcap << "/TECDisk_" << iDisk + << "/TECSide_" << iSide << "/TECPetal_" << iPetal << "/" << basename << "TECRing_" << iRing; histnames.push_back(TString(s.str())); } histnamesfilled = true; @@ -1326,23 +1479,21 @@ THStack* PlotAlignmentValidation::addHists(const TString& selection, const TStri for (int iDisk = 1; iDisk <= 9; iDisk++) for (int iSide = 1; iSide <= 2; iSide++) for (int iPetal = 1; iPetal <= 8; iPetal++) - for (int iRing = 5 - (iDisk>=4) - (iDisk>=7) - (iDisk>=9); iRing <= 7 - (iDisk>=4) - (iDisk>=7) - (iDisk>=9); iRing++) + for (int iRing = 5 - (iDisk >= 4) - (iDisk >= 7) - (iDisk >= 9); + iRing <= 7 - (iDisk >= 4) - (iDisk >= 7) - (iDisk >= 9); + iRing++) //in the higher disks, the inner rings go away. But the numbering in the file structure removes the higher numbers // so the numbers there do not correspond to the actual ring numbers { stringstream s; - s << "TrackerOfflineValidationStandalone/Strip/TECEndcap_" << iEndcap - << "/TECDisk_" << iDisk - << "/TECSide_" << iSide - << "/TECPetal_" << iPetal - << "/" << basename << "TECRing_" << iRing; + s << "TrackerOfflineValidationStandalone/Strip/TECEndcap_" << iEndcap << "/TECDisk_" << iDisk + << "/TECSide_" << iSide << "/TECPetal_" << iPetal << "/" << basename << "TECRing_" << iRing; histnames.push_back(TString(s.str())); } histnamesfilled = true; } } - Long64_t nSel = 0; if (histnamesfilled && histnames.size() > 0) { nSel = (Long64_t)histnames.size(); @@ -1351,7 +1502,8 @@ THStack* PlotAlignmentValidation::addHists(const TString& selection, const TStri // first loop on tree to find out which entries (i.e. modules) fulfill the selection // 'Entry$' gives the entry number in the tree nSel = tree->Draw("Entry$", selection, "goff"); - if (nSel == -1) return 0; // error in selection + if (nSel == -1) + return 0; // error in selection if (nSel == 0) { std::cout << "PlotAlignmentValidation::addHists: no selected module." << std::endl; return 0; @@ -1363,56 +1515,79 @@ THStack* PlotAlignmentValidation::addHists(const TString& selection, const TStri // second loop on tree: // for each selected entry get the hist from the file and merge - TkOffTreeVariables *treeMem = 0; // ROOT will initialise + TkOffTreeVariables* treeMem = 0; // ROOT will initialise tree->SetBranchAddress("TkOffTreeVariables", &treeMem); - for (Long64_t i = 0; i < nentries; i++){ - if (i < *iterEnt - 0.1 // smaller index (with tolerance): skip - || iterEnt == selected.end()) { // at the end: skip - continue; + for (Long64_t i = 0; i < nentries; i++) { + if (i < *iterEnt - 0.1 // smaller index (with tolerance): skip + || iterEnt == selected.end()) { // at the end: skip + continue; } else if (TMath::Abs(i - *iterEnt) < 0.11) { - ++iterEnt; // take this entry! - } else std::cout << "Must not happen: " << i << " " << *iterEnt << std::endl; + ++iterEnt; // take this entry! + } else + std::cout << "Must not happen: " << i << " " << *iterEnt << std::endl; tree->GetEntry(i); if (printModuleIds) { - std::cout << treeMem->moduleId << ": " << treeMem->entries << " entries" << std::endl; + std::cout << treeMem->moduleId << ": " << treeMem->entries << " entries" << std::endl; } if (treeMem->entries <= 0) { // little speed up: skip empty hists - ++nEmpty; - continue; + ++nEmpty; + continue; } TString hName; - switch(rType) { - case xPrimeRes: hName = treeMem->histNameX.c_str(); break; - case yPrimeRes: hName = treeMem->histNameY.c_str(); break; - case xPrimeNormRes: hName = treeMem->histNameNormX.c_str(); break; - case yPrimeNormRes: hName = treeMem->histNameNormY.c_str(); break; - case xRes: hName = treeMem->histNameLocalX.c_str(); break; - case yRes: hName = treeMem->histNameLocalY.c_str(); break; - case xNormRes: hName = treeMem->histNameNormLocalX.c_str(); break; - /*case yResNorm: hName = treeMem->histNameNormLocalY.c_str(); break;*/ - case ResXvsXProfile: hName = treeMem->profileNameResXvsX.c_str(); break; - case ResXvsYProfile: hName = treeMem->profileNameResXvsY.c_str(); break; - case ResYvsXProfile: hName = treeMem->profileNameResYvsX.c_str(); break; - case ResYvsYProfile: hName = treeMem->profileNameResYvsY.c_str(); break; + switch (rType) { + case xPrimeRes: + hName = treeMem->histNameX.c_str(); + break; + case yPrimeRes: + hName = treeMem->histNameY.c_str(); + break; + case xPrimeNormRes: + hName = treeMem->histNameNormX.c_str(); + break; + case yPrimeNormRes: + hName = treeMem->histNameNormY.c_str(); + break; + case xRes: + hName = treeMem->histNameLocalX.c_str(); + break; + case yRes: + hName = treeMem->histNameLocalY.c_str(); + break; + case xNormRes: + hName = treeMem->histNameNormLocalX.c_str(); + break; + /*case yResNorm: hName = treeMem->histNameNormLocalY.c_str(); break;*/ + case ResXvsXProfile: + hName = treeMem->profileNameResXvsX.c_str(); + break; + case ResXvsYProfile: + hName = treeMem->profileNameResXvsY.c_str(); + break; + case ResYvsXProfile: + hName = treeMem->profileNameResYvsX.c_str(); + break; + case ResYvsYProfile: + hName = treeMem->profileNameResYvsY.c_str(); + break; } histnames.push_back(hName); } } - for (std::vector::iterator ithistname = histnames.begin(); - ithistname != histnames.end(); ++ithistname) { - if (phase == 0 && !validforphase0) break; - TH1 *newHist; + for (std::vector::iterator ithistname = histnames.begin(); ithistname != histnames.end(); ++ithistname) { + if (phase == 0 && !validforphase0) + break; + TH1* newHist; if (ithistname->Contains("/")) { newHist = (TH1*)f->Get(*ithistname); } else { - TKey *histKey = f->FindKeyAny(*ithistname); + TKey* histKey = f->FindKeyAny(*ithistname); newHist = (histKey ? static_cast(histKey->ReadObj()) : 0); } if (!newHist) { - std::cout << "Hist " << *ithistname << " not found in file, break loop." << std::endl; - break; + std::cout << "Hist " << *ithistname << " not found in file, break loop." << std::endl; + break; } if (newHist->GetEntries() == 0) { nEmpty++; @@ -1420,24 +1595,26 @@ THStack* PlotAlignmentValidation::addHists(const TString& selection, const TStri } newHist->SetLineColor(myLineColor); newHist->SetLineStyle(myLineStyle); - if (!h) { // first hist: clone, but rename keeping only first part of name - TString name(newHist->GetName()); - Ssiz_t pos_ = 0; - for (UInt_t i2 = 0; i2 < 3; ++i2) pos_ = name.Index("_", pos_+1); - name = name(0, pos_); // only up to three '_' - h = static_cast(newHist->Clone("summed_"+name)); - // TString myTitle = Form("%s: %lld modules", selection, nSel); - // h->SetTitle( myTitle ); - } else { // otherwise just add - h->Add(newHist); + if (!h) { // first hist: clone, but rename keeping only first part of name + TString name(newHist->GetName()); + Ssiz_t pos_ = 0; + for (UInt_t i2 = 0; i2 < 3; ++i2) + pos_ = name.Index("_", pos_ + 1); + name = name(0, pos_); // only up to three '_' + h = static_cast(newHist->Clone("summed_" + name)); + // TString myTitle = Form("%s: %lld modules", selection, nSel); + // h->SetTitle( myTitle ); + } else { // otherwise just add + h->Add(newHist); } delete newHist; } - std::cout << "PlotAlignmentValidation::addHists" << "Result is merged from " << nSel-nEmpty - << " hists, " << nEmpty << " hists were empty." << std::endl; + std::cout << "PlotAlignmentValidation::addHists" + << "Result is merged from " << nSel - nEmpty << " hists, " << nEmpty << " hists were empty." << std::endl; - if (nSel-nEmpty == 0) continue; + if (nSel - nEmpty == 0) + continue; if (myLegend != 0) (*myLegend)->AddEntry(h, myLegendName, "L"); @@ -1452,56 +1629,52 @@ THStack* PlotAlignmentValidation::addHists(const TString& selection, const TStri /*! \fn fitGauss * \brief Operate a Gaussian fit to the given histogram */ -TF1 * -PlotAlignmentValidation::fitGauss(TH1 *hist,int color) -{ +TF1* PlotAlignmentValidation::fitGauss(TH1* hist, int color) { //1. fits a Gauss function to the inner range of abs(2 rms) //2. repeates the Gauss fit in a 2 sigma range around mean of first fit //returns mean and sigma from fit in micron - if (!hist || hist->GetEntries() < 20) return 0; + if (!hist || hist->GetEntries() < 20) + return 0; - float mean = hist->GetMean(); + float mean = hist->GetMean(); float sigma = hist->GetRMS(); - string functionname="gaussian_"; - functionname+=hist->GetName(); - TF1 *func = new TF1(functionname.c_str(), "gaus", mean - 2.*sigma, mean + 2.*sigma); - + string functionname = "gaussian_"; + functionname += hist->GetName(); + TF1* func = new TF1(functionname.c_str(), "gaus", mean - 2. * sigma, mean + 2. * sigma); + func->SetLineColor(color); func->SetLineStyle(2); - if (0 == hist->Fit(func,"QNR")) { // N: do not blow up file by storing fit! - mean = func->GetParameter(1); + if (0 == hist->Fit(func, "QNR")) { // N: do not blow up file by storing fit! + mean = func->GetParameter(1); sigma = func->GetParameter(2); // second fit: three sigma of first fit around mean of first fit - func->SetRange(mean - 3.*sigma, mean + 3.*sigma); + func->SetRange(mean - 3. * sigma, mean + 3. * sigma); // I: integral gives more correct results if binning is too wide // L: Likelihood can treat empty bins correctly (if hist not weighted...) if (0 == hist->Fit(func, "Q0ILR")) { - if (hist->GetFunction(func->GetName())) { // Take care that it is later on drawn: - //hist->GetFunction(func->GetName())->ResetBit(TF1::kNotDraw); + if (hist->GetFunction(func->GetName())) { // Take care that it is later on drawn: + //hist->GetFunction(func->GetName())->ResetBit(TF1::kNotDraw); } } } return func; } - //------------------------------------------------------------------------------ /*! \fn storeHistogramInRootfile * \brief Store the histogram and the gaussian function resulting from the fitGauss function into a root file */ -void PlotAlignmentValidation::storeHistogramInRootfile(TH1* hist) -{ +void PlotAlignmentValidation::storeHistogramInRootfile(TH1* hist) { //Store histogram and fit function in the root summary file rootsummaryfile->cd(); hist->Write(); } //------------------------------------------------------------------------------ -void PlotAlignmentValidation::scaleXaxis(TH1* hist, Int_t scale) -{ +void PlotAlignmentValidation::scaleXaxis(TH1* hist, Int_t scale) { Double_t xmin = hist->GetXaxis()->GetXmin(); Double_t xmax = hist->GetXaxis()->GetXmax(); - hist->GetXaxis()->SetLimits(xmin*scale, xmax*scale); + hist->GetXaxis()->SetLimits(xmin * scale, xmax * scale); } //------------------------------------------------------------------------------ @@ -1511,7 +1684,7 @@ TObject* PlotAlignmentValidation::findObjectFromCanvas(TCanvas* canv, const char TObject* obj = 0; Int_t found = 0; while ((obj = next())) { - if(strncmp(obj->ClassName(), className, 10) == 0) { + if (strncmp(obj->ClassName(), className, 10) == 0) { if (++found == n) return obj; } @@ -1521,30 +1694,42 @@ TObject* PlotAlignmentValidation::findObjectFromCanvas(TCanvas* canv, const char } //------------------------------------------------------------------------------ -void PlotAlignmentValidation::setTitleStyle( TNamed &hist,const char* titleX, const char* titleY,int subDetId, bool isSurfaceDeformation, TString secondline) -{ +void PlotAlignmentValidation::setTitleStyle( + TNamed& hist, const char* titleX, const char* titleY, int subDetId, bool isSurfaceDeformation, TString secondline) { std::stringstream title_Xaxis; std::stringstream title_Yaxis; - TString titleXAxis=titleX; - TString titleYAxis=titleY; + TString titleXAxis = titleX; + TString titleYAxis = titleY; if (titleXAxis != "" && titleYAxis != "") - cout<<"plot "<SetFillStyle(0); text2->SetBorderSize(0); text2->SetMargin(0.01); - text2->SetTextAlign(12); // align left - text2->AddText(0.01,0.75,subD); + text2->SetTextAlign(12); // align left + text2->AddText(0.01, 0.75, subD); if (secondline != "") { text2->AddText(0.01, 0.25, secondline); } text2->Draw(); } - //------------------------------------------------------------------------------ /*! \fn * \brief */ -void PlotAlignmentValidation::setHistStyle( TH1& hist,const char* titleX, const char* titleY, int color) -{ +void PlotAlignmentValidation::setHistStyle(TH1& hist, const char* titleX, const char* titleY, int color) { std::stringstream title_Xaxis; std::stringstream title_Yaxis; - TString titleXAxis=titleX; - TString titleYAxis=titleY; - - if ( titleXAxis.Contains("Phi") )title_Xaxis<InheritsFrom( TH1F::Class() ) )hist.SetLineColor(color); - if (hist.IsA()->InheritsFrom( TProfile::Class() ) ) { + TString titleXAxis = titleX; + TString titleYAxis = titleY; + + if (titleXAxis.Contains("Phi")) + title_Xaxis << titleX << "[rad]"; + else if (titleXAxis.Contains("meanX")) + title_Xaxis << "#LTx'_{pred}-x'_{hit}#GT[#mum]"; + else if (titleXAxis.Contains("meanY")) + title_Xaxis << "#LTy'_{pred}-y'_{hit}#GT[#mum]"; + else if (titleXAxis.Contains("rmsX")) + title_Xaxis << "RMS(x'_{pred}-x'_{hit})[#mum]"; + else if (titleXAxis.Contains("rmsY")) + title_Xaxis << "RMS(y'_{pred}-y'_{hit})[#mum]"; + else if (titleXAxis.Contains("meanNormX")) + title_Xaxis << "#LTx'_{pred}-x'_{hit}/#sigma#GT"; + else if (titleXAxis.Contains("meanNormY")) + title_Xaxis << "#LTy'_{pred}-y'_{hit}/#sigma#GT"; + else if (titleXAxis.Contains("rmsNormX")) + title_Xaxis << "RMS(x'_{pred}-x'_{hit}/#sigma)"; + else if (titleXAxis.Contains("rmsNormY")) + title_Xaxis << "RMS(y'_{pred}-y'_{hit}/#sigma)"; + else if (titleXAxis.Contains("meanLocalX")) + title_Xaxis << "#LTx_{pred}-x_{hit}#GT[#mum]"; + else if (titleXAxis.Contains("rmsLocalX")) + title_Xaxis << "RMS(x_{pred}-x_{hit})[#mum]"; + else if (titleXAxis.Contains("meanNormLocalX")) + title_Xaxis << "#LTx_{pred}-x_{hit}/#sigma#GT[#mum]"; + else if (titleXAxis.Contains("rmsNormLocalX")) + title_Xaxis << "RMS(x_{pred}-x_{hit}/#sigma)[#mum]"; + else if (titleXAxis.Contains("medianX")) + title_Xaxis << "median(x'_{pred}-x'_{hit})[#mum]"; + else if (titleXAxis.Contains("medianY")) + title_Xaxis << "median(y'_{pred}-y'_{hit})[#mum]"; + else + title_Xaxis << titleX << "[cm]"; + + if (hist.IsA()->InheritsFrom(TH1F::Class())) + hist.SetLineColor(color); + if (hist.IsA()->InheritsFrom(TProfile::Class())) { hist.SetMarkerStyle(20); hist.SetMarkerSize(0.8); hist.SetMarkerColor(color); } - - hist.GetXaxis()->SetTitle( (title_Xaxis.str()).c_str() ); + + hist.GetXaxis()->SetTitle((title_Xaxis.str()).c_str()); double binning = (hist.GetXaxis()->GetXmax() - hist.GetXaxis()->GetXmin()) / hist.GetNbinsX(); title_Yaxis.precision(2); - if ( ((titleYAxis.Contains("layer") || titleYAxis.Contains("ring")) - && titleYAxis.Contains("subDetId")) - || titleYAxis.Contains("#modules")) { - title_Yaxis<<"number of modules"; + if (((titleYAxis.Contains("layer") || titleYAxis.Contains("ring")) && titleYAxis.Contains("subDetId")) || + titleYAxis.Contains("#modules")) { + title_Yaxis << "number of modules"; if (TString(title_Xaxis.str()).Contains("[#mum]")) title_Yaxis << " / " << binning << " #mum"; else if (TString(title_Xaxis.str()).Contains("[cm]")) title_Yaxis << " / " << binning << " cm"; else title_Yaxis << " / " << binning; - } - else title_Yaxis<SetTitle( (title_Yaxis.str()).c_str() ); + hist.GetYaxis()->SetTitle((title_Yaxis.str()).c_str()); hist.GetXaxis()->SetTitleFont(42); hist.GetYaxis()->SetTitleFont(42); } //------------------------------------------------------------------------------ -std::string PlotAlignmentValidation:: -getSelectionForDMRPlot(int minHits, int subDetId, int direction, int layer) -{ +std::string PlotAlignmentValidation::getSelectionForDMRPlot(int minHits, int subDetId, int direction, int layer) { std::ostringstream builder; builder << "entries >= " << minHits; builder << " && subDetId == " << subDetId; if (direction != 0) { - if (subDetId == 2) { // FPIX is split by zDirection + if (subDetId == 2) { // FPIX is split by zDirection builder << " && zDirection == " << direction; } else { builder << " && rDirection == " << direction; @@ -1644,21 +1841,19 @@ getSelectionForDMRPlot(int minHits, int subDetId, int direction, int layer) return builder.str(); } -std::string PlotAlignmentValidation:: -getVariableForDMRPlot(const std::string& histoname, const std::string& variable, int nbins, double min, - double max) -{ +std::string PlotAlignmentValidation::getVariableForDMRPlot( + const std::string& histoname, const std::string& variable, int nbins, double min, double max) { std::ostringstream builder; - builder << variable << ">>" << histoname << "(" << nbins << "," << min << - "," << max << ")"; + builder << variable << ">>" << histoname << "(" << nbins << "," << min << "," << max << ")"; return builder.str(); } //------------------------------------------------------------------------------ -void PlotAlignmentValidation:: -setDMRHistStyleAndLegend(TH1F* h, PlotAlignmentValidation::DMRPlotInfo& plotinfo, int direction, int layer) -{ - TF1 *fitResults = 0; +void PlotAlignmentValidation::setDMRHistStyleAndLegend(TH1F* h, + PlotAlignmentValidation::DMRPlotInfo& plotinfo, + int direction, + int layer) { + TF1* fitResults = 0; h->SetDirectory(0); @@ -1671,47 +1866,60 @@ setDMRHistStyleAndLegend(TH1F* h, PlotAlignmentValidation::DMRPlotInfo& plotinfo // -However if only direction split plots are to be plotted, the additions should be 0 and +1 respectively // -Modulo 4 arithmetic, because the styles run from 1..4 int linestyle = plotinfo.vars->getLineStyle() - 1, linestyleplus = 0; - if (direction == 1) { linestyleplus = 1; } - if (direction == -1) { linestyleplus = 2; } - if (direction != 0 && plotinfo.plotSplits && !plotinfo.plotPlain) { linestyleplus--; } + if (direction == 1) { + linestyleplus = 1; + } + if (direction == -1) { + linestyleplus = 2; + } + if (direction != 0 && plotinfo.plotSplits && !plotinfo.plotPlain) { + linestyleplus--; + } linestyle = (linestyle + linestyleplus) % 4 + 1; int linecolor = plotinfo.vars->getLineColor(); - if (plotinfo.plotLayers && layer > 0) { linecolor += layer - 1; } + if (plotinfo.plotLayers && layer > 0) { + linecolor += layer - 1; + } if (plotinfo.firsthisto) { - setHistStyle(*h, plotinfo.variable.c_str(), "#modules", 1); //set color later + setHistStyle(*h, plotinfo.variable.c_str(), "#modules", 1); //set color later plotinfo.firsthisto = false; } - h->SetLineColor( linecolor ); - h->SetLineStyle( linestyle ); - - if (plotinfo.maxYGetMaximum()){ - plotinfo.maxY=h->GetMaximum(); + h->SetLineColor(linecolor); + h->SetLineStyle(linestyle); + + if (plotinfo.maxY < h->GetMaximum()) { + plotinfo.maxY = h->GetMaximum(); } - + //fit histogram for median and mean - if (plotinfo.variable == "medianX" || plotinfo.variable == "meanX" || plotinfo.variable == "medianY" || plotinfo.variable == "meanY") { - fitResults = fitGauss(h, linecolor ); + if (plotinfo.variable == "medianX" || plotinfo.variable == "meanX" || plotinfo.variable == "medianY" || + plotinfo.variable == "meanY") { + fitResults = fitGauss(h, linecolor); } - + plotinfo.hstack->Add(h); std::ostringstream legend; legend.precision(3); - legend << fixed; // to always show 3 decimals + legend << fixed; // to always show 3 decimals // Legend: header part - if (direction == -1 && plotinfo.subDetId != 2) { legend << "rDirection < 0"; } - else if (direction == 1 && plotinfo.subDetId != 2) { legend << "rDirection > 0"; } - else if (direction == -1 && plotinfo.subDetId == 2) { legend << "zDirection < 0"; } - else if (direction == 1 && plotinfo.subDetId == 2) { legend << "zDirection > 0"; } - else { - legend << plotinfo.vars->getName(); + if (direction == -1 && plotinfo.subDetId != 2) { + legend << "rDirection < 0"; + } else if (direction == 1 && plotinfo.subDetId != 2) { + legend << "rDirection > 0"; + } else if (direction == -1 && plotinfo.subDetId == 2) { + legend << "zDirection < 0"; + } else if (direction == 1 && plotinfo.subDetId == 2) { + legend << "zDirection > 0"; + } else { + legend << plotinfo.vars->getName(); if (layer > 0) { // TEC and TID have discs, the rest have layers - if (plotinfo.subDetId==4 || plotinfo.subDetId==6) + if (plotinfo.subDetId == 4 || plotinfo.subDetId == 6) legend << ", disc "; else legend << ", layer "; @@ -1725,27 +1933,27 @@ setDMRHistStyleAndLegend(TH1F* h, PlotAlignmentValidation::DMRPlotInfo& plotinfo // Legend: Statistics double mean, meanerror, rms, rmserror; TString rmsname, units; - bool showdeltamu = (plotinfo.h1 != 0 && plotinfo.h2 != 0 && plotinfo.plotSplits && plotinfo.plotPlain && direction == 0); - if (plotinfo.variable == "medianX" || plotinfo.variable == "meanX" || - plotinfo.variable == "medianY" || plotinfo.variable == "meanY" || - plotinfo.variable == "rmsX" || plotinfo.variable == "rmsY") { + bool showdeltamu = + (plotinfo.h1 != 0 && plotinfo.h2 != 0 && plotinfo.plotSplits && plotinfo.plotPlain && direction == 0); + if (plotinfo.variable == "medianX" || plotinfo.variable == "meanX" || plotinfo.variable == "medianY" || + plotinfo.variable == "meanY" || plotinfo.variable == "rmsX" || plotinfo.variable == "rmsY") { if (useFit_ && fitResults) { - mean = fitResults->GetParameter(1)*10000; - meanerror = fitResults->GetParError(1)*10000; - rms = fitResults->GetParameter(2)*10000; - rmserror = fitResults->GetParError(2)*10000; + mean = fitResults->GetParameter(1) * 10000; + meanerror = fitResults->GetParError(1) * 10000; + rms = fitResults->GetParameter(2) * 10000; + rmserror = fitResults->GetParError(2) * 10000; rmsname = "#sigma"; delete fitResults; } else { - mean = h->GetMean(1)*10000; - meanerror = h->GetMeanError(1)*10000; - rms = h->GetRMS(1)*10000; - rmserror = h->GetRMSError(1)*10000; + mean = h->GetMean(1) * 10000; + meanerror = h->GetMeanError(1) * 10000; + rms = h->GetRMS(1) * 10000; + rmserror = h->GetRMSError(1) * 10000; rmsname = "rms"; } units = " #mum"; - } else if (plotinfo.variable == "meanNormX" || plotinfo.variable == "meanNormY" || - plotinfo.variable == "rmsNormX" || plotinfo.variable == "rmsNormY") { + } else if (plotinfo.variable == "meanNormX" || plotinfo.variable == "meanNormY" || plotinfo.variable == "rmsNormX" || + plotinfo.variable == "rmsNormY") { mean = h->GetMean(1); meanerror = h->GetMeanError(1); rms = h->GetRMS(1); @@ -1753,8 +1961,7 @@ setDMRHistStyleAndLegend(TH1F* h, PlotAlignmentValidation::DMRPlotInfo& plotinfo rmsname = "rms"; units = ""; } - if (showMean_) - { + if (showMean_) { legend << " #mu = " << mean; if (showMeanError_) legend << " #pm " << meanerror; @@ -1762,8 +1969,7 @@ setDMRHistStyleAndLegend(TH1F* h, PlotAlignmentValidation::DMRPlotInfo& plotinfo if (showRMS_ || showdeltamu || ((showModules_ || showUnderOverFlow_) && !twolines_)) legend << ", "; } - if (showRMS_) - { + if (showRMS_) { legend << " " << rmsname << " = " << rms; if (showRMSError_) legend << " #pm " << rmserror; @@ -1772,44 +1978,42 @@ setDMRHistStyleAndLegend(TH1F* h, PlotAlignmentValidation::DMRPlotInfo& plotinfo legend << ", "; } - if ((plotinfo.variable == "medianX" || plotinfo.variable == "medianY") && /*!plotinfo.plotLayers && */layer==0 && direction==0) { + if ((plotinfo.variable == "medianX" || plotinfo.variable == "medianY") && /*!plotinfo.plotLayers && */ layer == 0 && + direction == 0) { vmean.push_back(mean); vrms.push_back(rms); vmeanerror.push_back(meanerror); - TH1F* ideal = (TH1F*)plotinfo.hstack->GetHists()->At(0); - TH1F* h = plotinfo.h; - if(h->GetRMS() >= ideal->GetRMS()) - { - vAlignmentUncertainty.push_back(sqrt(pow(h->GetRMS(),2)-pow(ideal->GetRMS(),2))); - } - else{ - vAlignmentUncertainty.push_back(nan("")); - } - float p = (float)resampleTestOfEqualMeans(ideal, h, 10000); - vPValueMeanEqualIdeal.push_back(p); - p=resampleTestOfEqualRMS(ideal, h, 10000); - vPValueRMSEqualIdeal.push_back(p); - + TH1F* ideal = (TH1F*)plotinfo.hstack->GetHists()->At(0); + TH1F* h = plotinfo.h; + if (h->GetRMS() >= ideal->GetRMS()) { + vAlignmentUncertainty.push_back(sqrt(pow(h->GetRMS(), 2) - pow(ideal->GetRMS(), 2))); + } else { + vAlignmentUncertainty.push_back(nan("")); + } + float p = (float)resampleTestOfEqualMeans(ideal, h, 10000); + vPValueMeanEqualIdeal.push_back(p); + p = resampleTestOfEqualRMS(ideal, h, 10000); + vPValueRMSEqualIdeal.push_back(p); } // Legend: Delta mu for split plots if (showdeltamu) { float factor = 10000.0f; - if (plotinfo.variable == "meanNormX" || plotinfo.variable == "meanNormY" || - plotinfo.variable == "rmsNormX" || plotinfo.variable == "rmsNormY") { + if (plotinfo.variable == "meanNormX" || plotinfo.variable == "meanNormY" || plotinfo.variable == "rmsNormX" || + plotinfo.variable == "rmsNormY") { factor = 1.0f; } - float deltamu = factor*(plotinfo.h2->GetMean(1) - plotinfo.h1->GetMean(1)); + float deltamu = factor * (plotinfo.h2->GetMean(1) - plotinfo.h1->GetMean(1)); legend << "#Delta#mu = " << deltamu << units; if ((showModules_ || showUnderOverFlow_) && !twolines_) legend << ", "; - if ((plotinfo.variable == "medianX" || plotinfo.variable == "medianY") && /*!plotinfo.plotLayers && */layer==0 && direction==0) { + if ((plotinfo.variable == "medianX" || plotinfo.variable == "medianY") && /*!plotinfo.plotLayers && */ layer == 0 && + direction == 0) { vdeltamean.push_back(deltamu); - if(plotinfo.h1->GetEntries()&&plotinfo.h2->GetEntries()){ - float p = (float)resampleTestOfEqualMeans(plotinfo.h1,plotinfo.h2, 10000); - vPValueEqualSplitMeans.push_back(p); - + if (plotinfo.h1->GetEntries() && plotinfo.h2->GetEntries()) { + float p = (float)resampleTestOfEqualMeans(plotinfo.h1, plotinfo.h2, 10000); + vPValueEqualSplitMeans.push_back(p); } } } @@ -1821,13 +2025,14 @@ setDMRHistStyleAndLegend(TH1F* h, PlotAlignmentValidation::DMRPlotInfo& plotinfo } if (!showUnderOverFlow_ && showModules_) { - legend << (int) h->GetEntries() << " modules"; + legend << (int)h->GetEntries() << " modules"; } if (showUnderOverFlow_) { if (showModules_) { - legend << (int) h->GetEntries() << " modules (" << (int) h->GetBinContent(0) + (int)h->GetBinContent(h->GetNbinsX()+1) << " outside range)"; + legend << (int)h->GetEntries() << " modules (" + << (int)h->GetBinContent(0) + (int)h->GetBinContent(h->GetNbinsX() + 1) << " outside range)"; } else { - legend << (int) h->GetBinContent(0) + (int)h->GetBinContent(h->GetNbinsX()+1) << " modules outside range"; + legend << (int)h->GetBinContent(0) + (int)h->GetBinContent(h->GetNbinsX() + 1) << " modules outside range"; } } plotinfo.legend->AddEntry((TObject*)0, legend.str().c_str(), ""); @@ -1835,7 +2040,6 @@ setDMRHistStyleAndLegend(TH1F* h, PlotAlignmentValidation::DMRPlotInfo& plotinfo // Scale the x-axis (cm to um), if needed if (plotinfo.variable.find("Norm") == std::string::npos) scaleXaxis(h, 10000); - } /*! @@ -1843,60 +2047,81 @@ setDMRHistStyleAndLegend(TH1F* h, PlotAlignmentValidation::DMRPlotInfo& plotinfo * \brief Create the DMR histrogram using data stored in trees and store them in the plotinfo structure. */ -void PlotAlignmentValidation:: -plotDMRHistogram(PlotAlignmentValidation::DMRPlotInfo& plotinfo, int direction, int layer, std::string subdet) -{ +void PlotAlignmentValidation::plotDMRHistogram(PlotAlignmentValidation::DMRPlotInfo& plotinfo, + int direction, + int layer, + std::string subdet) { TH1F* h = 0; //Create a name for the histogram that summarize all relevant information: name of the geometry, variable plotted, structure, layer, and whether the modules considered point inward or outward. - TString histoname=""; - if(plotinfo.variable == "medianX" || plotinfo.variable == "medianY" )histoname="median"; - else if(plotinfo.variable == "rmsNormX" || plotinfo.variable == "rmsNormY")histoname="DrmsNR"; - histoname+="_"; histoname+=plotinfo.vars->getName(); - histoname.ReplaceAll(" ","_"); - histoname+="_"; histoname+=subdet.c_str(); - if (plotinfo.variable == "medianY" || plotinfo.variable == "rmsNormY")histoname+="_y"; - if(layer!=0){ - if(subdet=="TID"||subdet=="TEC")histoname+="_disc"; - else histoname+="_layer"; - histoname+=to_string(layer); - } - if (direction == -1) { histoname += "_minus"; } - else if (direction == 1) { histoname += "_plus"; } - else { histoname += ""; } - std::string plotVariable = getVariableForDMRPlot(histoname.Data(), plotinfo.variable, plotinfo.nbins, plotinfo.min, plotinfo.max); + TString histoname = ""; + if (plotinfo.variable == "medianX" || plotinfo.variable == "medianY") + histoname = "median"; + else if (plotinfo.variable == "rmsNormX" || plotinfo.variable == "rmsNormY") + histoname = "DrmsNR"; + histoname += "_"; + histoname += plotinfo.vars->getName(); + histoname.ReplaceAll(" ", "_"); + histoname += "_"; + histoname += subdet.c_str(); + if (plotinfo.variable == "medianY" || plotinfo.variable == "rmsNormY") + histoname += "_y"; + if (layer != 0) { + if (subdet == "TID" || subdet == "TEC") + histoname += "_disc"; + else + histoname += "_layer"; + histoname += to_string(layer); + } + if (direction == -1) { + histoname += "_minus"; + } else if (direction == 1) { + histoname += "_plus"; + } else { + histoname += ""; + } + std::string plotVariable = + getVariableForDMRPlot(histoname.Data(), plotinfo.variable, plotinfo.nbins, plotinfo.min, plotinfo.max); std::string selection = getSelectionForDMRPlot(plotinfo.minHits, plotinfo.subDetId, direction, layer); plotinfo.vars->getTree()->Draw(plotVariable.c_str(), selection.c_str(), "goff"); - if (gDirectory) gDirectory->GetObject(histoname.Data(), h); + if (gDirectory) + gDirectory->GetObject(histoname.Data(), h); if (h && h->GetEntries() > 0) { - if (direction == -1) { plotinfo.h1 = h; } - else if (direction == 1) { plotinfo.h2 = h; } - else { plotinfo.h = h; } + if (direction == -1) { + plotinfo.h1 = h; + } else if (direction == 1) { + plotinfo.h2 = h; + } else { + plotinfo.h = h; + } } - if(plotinfo.variable == "medianX" || plotinfo.variable == "medianY" || plotinfo.variable == "rmsNormX" || plotinfo.variable == "rmsNormY") + if (plotinfo.variable == "medianX" || plotinfo.variable == "medianY" || plotinfo.variable == "rmsNormX" || + plotinfo.variable == "rmsNormY") storeHistogramInRootfile(h); - } -void PlotAlignmentValidation::modifySSHistAndLegend(THStack* hs, TLegend* legend) -{ +void PlotAlignmentValidation::modifySSHistAndLegend(THStack* hs, TLegend* legend) { // Add mean-y-values to the legend and scale the histograms. Double_t legendY = 0.80; bool hasheader = (TkAlStyle::legendheader != ""); - if (hasheader) legend->SetHeader(TkAlStyle::legendheader); + if (hasheader) + legend->SetHeader(TkAlStyle::legendheader); legend->SetFillStyle(0); int legendsize = hs->GetHists()->GetSize() + hasheader; if (legendsize > 3) legendY -= 0.01 * (legendsize - 3); - if (bigtext_) { legendY -= 0.05; } + if (bigtext_) { + legendY -= 0.05; + } if (legendY < 0.6) { std::cerr << "Warning: Huge legend!" << std::endl; legendY = 0.6; } legend->SetY1(legendY); - if (bigtext_) legend->SetTextSize(TkAlStyle::textSize); + if (bigtext_) + legend->SetTextSize(TkAlStyle::textSize); // Loop over all profiles TProfile* prof = 0; @@ -1912,8 +2137,8 @@ void PlotAlignmentValidation::modifySSHistAndLegend(THStack* hs, TLegend* legend std::ostringstream legendtext; legendtext.precision(3); - legendtext << fixed; // to always show 3 decimals - legendtext << ": y mean = " << stats[4]/stats[0]*scale << " #mum"; + legendtext << fixed; // to always show 3 decimals + legendtext << ": y mean = " << stats[4] / stats[0] * scale << " #mum"; TLegendEntry* entry = (TLegendEntry*)legend->GetListOfPrimitives()->At(index); if (entry == 0) @@ -1924,58 +2149,55 @@ void PlotAlignmentValidation::modifySSHistAndLegend(THStack* hs, TLegend* legend } // Make some room for the legend - hs->SetMaximum(hs->GetMaximum("nostack PE")*1.3); + hs->SetMaximum(hs->GetMaximum("nostack PE") * 1.3); } - //random variable: \sigma_{X_1}-\sigma_{X_2}-\delta_{RMS} //is centered approx around 0 //null hypothesis: \delta_{RMS}=0 //so \delta_\sigma is a realization of this random variable //how probable is it to get our value of \delta_\sigma? //->p-value -double PlotAlignmentValidation::resampleTestOfEqualRMS(TH1F* h1, TH1F* h2, int numSamples){ -//vector to store realizations of random variable - vector diff; - diff.clear(); -//"true" (in bootstrap terms) difference of the samples' RMS - double rmsdiff = abs(h1->GetRMS()-h2->GetRMS()); -//means of the samples to calculate RMS - double m1 = h1->GetMean(); - double m2 = h2->GetMean(); -//realization of random variable - double d1 = 0; - double d2 = 0; -//mean of random variable - double test_mean=0; - for(int i=0;iGetEntries();i++){ - d1+=h1->GetRandom()-m1; - } - for(int i=0;iGetEntries();i++){ - d2+=h2->GetRandom()+m2; - } - d1/=h1->GetEntries(); - d2/=h2->GetEntries(); - diff.push_back(abs(d1-d2-rmsdiff)); - test_mean+=abs(d1-d2-rmsdiff); +double PlotAlignmentValidation::resampleTestOfEqualRMS(TH1F* h1, TH1F* h2, int numSamples) { + //vector to store realizations of random variable + vector diff; + diff.clear(); + //"true" (in bootstrap terms) difference of the samples' RMS + double rmsdiff = abs(h1->GetRMS() - h2->GetRMS()); + //means of the samples to calculate RMS + double m1 = h1->GetMean(); + double m2 = h2->GetMean(); + //realization of random variable + double d1 = 0; + double d2 = 0; + //mean of random variable + double test_mean = 0; + for (int i = 0; i < numSamples; i++) { + d1 = 0; + d2 = 0; + for (int i = 0; i < h1->GetEntries(); i++) { + d1 += h1->GetRandom() - m1; } - test_mean/=numSamples; -//p value - double p=0; - for(double d:diff){ - if(d>rmsdiff){ - p+=1; - } + for (int i = 0; i < h2->GetEntries(); i++) { + d2 += h2->GetRandom() + m2; } - - p/=numSamples; - return p; -} - + d1 /= h1->GetEntries(); + d2 /= h2->GetEntries(); + diff.push_back(abs(d1 - d2 - rmsdiff)); + test_mean += abs(d1 - d2 - rmsdiff); + } + test_mean /= numSamples; + //p value + double p = 0; + for (double d : diff) { + if (d > rmsdiff) { + p += 1; + } + } + p /= numSamples; + return p; +} //random variable: (\overline{X_1}-\mu_1)-(\overline{X_2}-\mu_2) //is centered approx around 0 @@ -1983,150 +2205,137 @@ double PlotAlignmentValidation::resampleTestOfEqualRMS(TH1F* h1, TH1F* h2, int n //so \delta_\mu is a realization of this random variable //how probable is it to get our value of \delta_\mu? //->p-value -double PlotAlignmentValidation::resampleTestOfEqualMeans(TH1F* h1, TH1F* h2, int numSamples){ -//vector to store realization of random variable - vector diff; - diff.clear(); -//"true" (in bootstrap terms) difference of the samples' means - double meandiff = abs(h1->GetMean()-h2->GetMean()); -//realization of random variable - double d1 = 0; - double d2=0; -//mean of random variable - double test_mean=0; - for(int i=0;iGetEntries();i++){ - d1+=h1->GetRandom(); - } - for(int i=0;iGetEntries();i++){ - d2+=h2->GetRandom(); - } - d1/=h1->GetEntries(); - d2/=h2->GetEntries(); - diff.push_back(abs(d1-d2-meandiff)); - test_mean+=abs(d1-d2-meandiff); +double PlotAlignmentValidation::resampleTestOfEqualMeans(TH1F* h1, TH1F* h2, int numSamples) { + //vector to store realization of random variable + vector diff; + diff.clear(); + //"true" (in bootstrap terms) difference of the samples' means + double meandiff = abs(h1->GetMean() - h2->GetMean()); + //realization of random variable + double d1 = 0; + double d2 = 0; + //mean of random variable + double test_mean = 0; + for (int i = 0; i < numSamples; i++) { + d1 = 0; + d2 = 0; + for (int i = 0; i < h1->GetEntries(); i++) { + d1 += h1->GetRandom(); } - test_mean/=numSamples; -//p-value - double p=0; - for(double d:diff){ - if(d>meandiff){ - p+=1; - } + for (int i = 0; i < h2->GetEntries(); i++) { + d2 += h2->GetRandom(); } - - p/=numSamples; - return p; -} - + d1 /= h1->GetEntries(); + d2 /= h2->GetEntries(); + diff.push_back(abs(d1 - d2 - meandiff)); + test_mean += abs(d1 - d2 - meandiff); + } + test_mean /= numSamples; + //p-value + double p = 0; + for (double d : diff) { + if (d > meandiff) { + p += 1; + } + } + p /= numSamples; + return p; +} -float PlotAlignmentValidation::twotailedStudentTTestEqualMean(float t, float v){ -return 2*(1-ROOT::Math::tdistribution_cdf(abs(t),v)); +float PlotAlignmentValidation::twotailedStudentTTestEqualMean(float t, float v) { + return 2 * (1 - ROOT::Math::tdistribution_cdf(abs(t), v)); } const TString PlotAlignmentValidation::summaryfilename = "OfflineValidationSummary"; +vector PlotAlignmentValidation::findmodule(TFile* f, unsigned int moduleid) { + //TFile *f = TFile::Open(filename, "READ"); + TString histnamex; + TString histnamey; + //read necessary branch/folder + auto t = (TTree*)f->Get("TrackerOfflineValidationStandalone/TkOffVal"); + + TkOffTreeVariables* variables = 0; + t->SetBranchAddress("TkOffTreeVariables", &variables); + unsigned int number_of_entries = t->GetEntries(); + for (unsigned int i = 0; i < number_of_entries; i++) { + t->GetEntry(i); + if (variables->moduleId == moduleid) { + histnamex = variables->histNameX; + histnamey = variables->histNameY; + break; + } + } + vector h; -vector PlotAlignmentValidation::findmodule (TFile* f, unsigned int moduleid){ - - - //TFile *f = TFile::Open(filename, "READ"); - TString histnamex; - TString histnamey; - //read necessary branch/folder - auto t = (TTree*)f->Get("TrackerOfflineValidationStandalone/TkOffVal"); - - TkOffTreeVariables *variables=0; - t->SetBranchAddress("TkOffTreeVariables", &variables); - unsigned int number_of_entries=t->GetEntries(); - for (unsigned int i=0;iGetEntry(i); - if (variables->moduleId==moduleid){ - histnamex=variables->histNameX; - histnamey=variables->histNameY; - break; - } - } - - vector h; - - auto h1 = (TH1*)f->FindObjectAny(histnamex); - auto h2 = (TH1*)f->FindObjectAny(histnamey); - - h1->SetDirectory(0); - h2->SetDirectory(0); - - h.push_back(h1); - h.push_back(h2); - - return h; - } - -void PlotAlignmentValidation::residual_by_moduleID( unsigned int moduleid){ - TCanvas *cx = new TCanvas("x_residual"); - TCanvas *cy = new TCanvas("y_residual"); - TLegend *legendx =new TLegend(0.55, 0.7, 1, 0.9); - TLegend *legendy =new TLegend(0.55, 0.7, 1, 0.9); - - legendx->SetTextSize(0.016); - legendx->SetTextAlign(12); - legendy->SetTextSize(0.016); - legendy->SetTextAlign(12); - - - - - for (auto it : sourceList) { - TFile* file = it->getFile(); - int color = it->getLineColor(); - int linestyle = it->getLineStyle(); //this you set by doing h->SetLineStyle(linestyle) - TString legendname = it->getName(); //this goes in the legend - vector hist = findmodule(file, moduleid); - - TString histnamex = legendname+" NEntries: "+to_string(int(hist[0]->GetEntries())); - hist[0]->SetTitle(histnamex); - hist[0]->SetStats(0); - hist[0]->Rebin(50); - hist[0]->SetBit(TH1::kNoTitle); - hist[0]->SetLineColor(color); - hist[0]->SetLineStyle(linestyle); - cx->cd(); - hist[0]->Draw("Same"); - legendx->AddEntry(hist[0], histnamex, "l"); - - - TString histnamey = legendname+" NEntries: "+to_string(int(hist[1]->GetEntries())); - hist[1]->SetTitle(histnamey); - hist[1]->SetStats(0); - hist[1]->Rebin(50); - hist[1]->SetBit(TH1::kNoTitle); - hist[1]->SetLineColor(color); - hist[1]->SetLineStyle(linestyle); - cy->cd(); - hist[1]->Draw("Same"); - legendy->AddEntry(hist[1], histnamey, "l"); - - } - - TString filenamex = "x_residual_"+to_string(moduleid); - TString filenamey = "y_residual_"+to_string(moduleid); - cx->cd(); - legendx->Draw(); - cx->SaveAs(outputDir + "/" +filenamex+".root"); - cx->SaveAs(outputDir + "/" +filenamex+".pdf"); - cx->SaveAs(outputDir + "/" +filenamex+".png"); - cx->SaveAs(outputDir + "/" +filenamex+".eps"); - - cy->cd(); - legendy->Draw(); - cy->SaveAs(outputDir + "/" +filenamey+".root"); - cy->SaveAs(outputDir + "/" +filenamey+".pdf"); - cy->SaveAs(outputDir + "/" +filenamey+".png"); - cy->SaveAs(outputDir + "/" +filenamey+".eps"); - + auto h1 = (TH1*)f->FindObjectAny(histnamex); + auto h2 = (TH1*)f->FindObjectAny(histnamey); + + h1->SetDirectory(0); + h2->SetDirectory(0); + + h.push_back(h1); + h.push_back(h2); + + return h; +} + +void PlotAlignmentValidation::residual_by_moduleID(unsigned int moduleid) { + TCanvas* cx = new TCanvas("x_residual"); + TCanvas* cy = new TCanvas("y_residual"); + TLegend* legendx = new TLegend(0.55, 0.7, 1, 0.9); + TLegend* legendy = new TLegend(0.55, 0.7, 1, 0.9); + + legendx->SetTextSize(0.016); + legendx->SetTextAlign(12); + legendy->SetTextSize(0.016); + legendy->SetTextAlign(12); + + for (auto it : sourceList) { + TFile* file = it->getFile(); + int color = it->getLineColor(); + int linestyle = it->getLineStyle(); //this you set by doing h->SetLineStyle(linestyle) + TString legendname = it->getName(); //this goes in the legend + vector hist = findmodule(file, moduleid); + + TString histnamex = legendname + " NEntries: " + TString(to_string(int(hist[0]->GetEntries()))); + hist[0]->SetTitle(histnamex); + hist[0]->SetStats(0); + hist[0]->Rebin(50); + hist[0]->SetBit(TH1::kNoTitle); + hist[0]->SetLineColor(color); + hist[0]->SetLineStyle(linestyle); + cx->cd(); + hist[0]->Draw("Same"); + legendx->AddEntry(hist[0], histnamex, "l"); + + TString histnamey = legendname + " NEntries: " + TString(to_string(int(hist[1]->GetEntries()))); + hist[1]->SetTitle(histnamey); + hist[1]->SetStats(0); + hist[1]->Rebin(50); + hist[1]->SetBit(TH1::kNoTitle); + hist[1]->SetLineColor(color); + hist[1]->SetLineStyle(linestyle); + cy->cd(); + hist[1]->Draw("Same"); + legendy->AddEntry(hist[1], histnamey, "l"); + } + TString filenamex = "x_residual_" + to_string(moduleid); + TString filenamey = "y_residual_" + to_string(moduleid); + cx->cd(); + legendx->Draw(); + cx->SaveAs(TString(outputDir + "/") + filenamex + ".root"); + cx->SaveAs(TString(outputDir + "/") + filenamex + ".pdf"); + cx->SaveAs(TString(outputDir + "/") + filenamex + ".png"); + cx->SaveAs(TString(outputDir + "/") + filenamex + ".eps"); + + cy->cd(); + legendy->Draw(); + cy->SaveAs(TString(outputDir + "/") + filenamey + ".root"); + cy->SaveAs(TString(outputDir + "/") + filenamey + ".pdf"); + cy->SaveAs(TString(outputDir + "/") + filenamey + ".png"); + cy->SaveAs(TString(outputDir + "/") + filenamey + ".eps"); } diff --git a/Alignment/OfflineValidation/macros/trackSplitPlot.h b/Alignment/OfflineValidation/macros/trackSplitPlot.h index 123208cc73b90..a75958e2f6592 100644 --- a/Alignment/OfflineValidation/macros/trackSplitPlot.h +++ b/Alignment/OfflineValidation/macros/trackSplitPlot.h @@ -9,6 +9,7 @@ #include "TClass.h" #include "TColor.h" #include "TFile.h" +#include "TF1.h" #include "TGaxis.h" #include "TGraph2DErrors.h" #include "TGraphErrors.h" @@ -29,9 +30,8 @@ #include "TText.h" #include "TTree.h" - -enum PlotType {ScatterPlot,Profile,Histogram,OrgHistogram,Resolution}; -enum Statistic {Minimum, Maximum, Average, RMS}; +enum PlotType { ScatterPlot, Profile, Histogram, OrgHistogram, Resolution }; +enum Statistic { Minimum, Maximum, Average, RMS }; const Double_t pi = TMath::Pi(); vector colors; @@ -45,15 +45,15 @@ Int_t legendGrid = 100; Double_t margin = .1; Double_t increaseby = .1; -TString xvariables[xsize] = {"", "pt", "eta", "phi", "dz", "dxy", "theta", "qoverpt"}; -TString yvariables[ysize] = {"pt", "pt", "eta", "phi", "dz", "dxy", "theta", "qoverpt", ""}; -Bool_t relativearray[ysize] = {true, false, false, false, false, false, false, false, false}; +TString xvariables[xsize] = {"", "pt", "eta", "phi", "dz", "dxy", "theta", "qoverpt"}; +TString yvariables[ysize] = {"pt", "pt", "eta", "phi", "dz", "dxy", "theta", "qoverpt", ""}; +Bool_t relativearray[ysize] = {true, false, false, false, false, false, false, false, false}; TList *stufftodelete = new TList(); TString subdetector = "PIXEL"; -double outliercut = 0.99; //use the middle 99% of tracks to find the mean and RMS - //(a few tracks are fit badly and skew them otherwise) +double outliercut = 0.99; //use the middle 99% of tracks to find the mean and RMS + //(a few tracks are fit badly and skew them otherwise) /*********************************** Table Of Contents @@ -68,136 +68,335 @@ Table Of Contents #include "trackSplitPlot.h" ofstream devnull("/dev/null"); -template T identity(T t) {return t;} +template +T identity(T t) { + return t; +} //=================== //0. Track Split Plot //=================== -TCanvas *trackSplitPlot(Int_t nFiles,TString *files,TString *names,TString xvar,TString yvar, - Bool_t relative = false,Bool_t resolution = false,Bool_t pull = false, - TString saveas = "", ostream& summaryfile=devnull); -TCanvas *trackSplitPlot(Int_t nFiles,TString *files,TString *names,TString var, - Bool_t relative = false,Bool_t pull = false,TString saveas = "", ostream& summaryfile=devnull); -TCanvas *trackSplitPlot(TString file,TString xvar,TString yvar,Bool_t profile = false, - Bool_t relative = false,Bool_t resolution = false,Bool_t pull = false, - TString saveas = "", ostream& summaryfile=devnull); -TCanvas *trackSplitPlot(TString file,TString var, - Bool_t relative = false,Bool_t pull = false, - TString saveas = "", ostream& summaryfile=devnull); -void placeholder(TString saveas = "",Bool_t wide = false); -void saveplot(TCanvas *c1,TString saveas); +TCanvas *trackSplitPlot(Int_t nFiles, + TString *files, + TString *names, + TString xvar, + TString yvar, + Bool_t relative = false, + Bool_t resolution = false, + Bool_t pull = false, + TString saveas = "", + ostream &summaryfile = devnull); +TCanvas *trackSplitPlot(Int_t nFiles, + TString *files, + TString *names, + TString var, + Bool_t relative = false, + Bool_t pull = false, + TString saveas = "", + ostream &summaryfile = devnull); +TCanvas *trackSplitPlot(TString file, + TString xvar, + TString yvar, + Bool_t profile = false, + Bool_t relative = false, + Bool_t resolution = false, + Bool_t pull = false, + TString saveas = "", + ostream &summaryfile = devnull); +TCanvas *trackSplitPlot(TString file, + TString var, + Bool_t relative = false, + Bool_t pull = false, + TString saveas = "", + ostream &summaryfile = devnull); +void placeholder(TString saveas = "", Bool_t wide = false); +void saveplot(TCanvas *c1, TString saveas); void deleteCanvas(TObject *canvas); void setupcolors(); -void runNumberZoomed(Int_t nFiles,TString *files,TString *names,TString yvar, - Bool_t relative = false,Bool_t resolution = false,Bool_t pull = false, - Int_t firstRun = -1,Int_t lastRun = -1,TString saveas = ""); +void runNumberZoomed(Int_t nFiles, + TString *files, + TString *names, + TString yvar, + Bool_t relative = false, + Bool_t resolution = false, + Bool_t pull = false, + Int_t firstRun = -1, + Int_t lastRun = -1, + TString saveas = ""); //========================== //1. Misalignment Dependence //========================== void misalignmentDependence(TCanvas *c1old, - Int_t nFiles,TString *names,TString misalignment,Double_t *values,Double_t *phases,TString xvar,TString yvar, - TF1 *function,Int_t parameter,TString parametername = "",TString functionname = "", - Bool_t relative = false,Bool_t resolution = false,Bool_t pull = false, + Int_t nFiles, + TString *names, + TString misalignment, + Double_t *values, + Double_t *phases, + TString xvar, + TString yvar, + TF1 *function, + Int_t parameter, + TString parametername = "", + TString functionname = "", + Bool_t relative = false, + Bool_t resolution = false, + Bool_t pull = false, TString saveas = ""); void misalignmentDependence(TCanvas *c1old, - Int_t nFiles,TString *names,TString misalignment,Double_t *values,Double_t *phases,TString xvar,TString yvar, - TF1 *function,Int_t nParameters,Int_t *parameters,TString *parameternames,TString functionname = "", - Bool_t relative = false,Bool_t resolution = false,Bool_t pull = false, + Int_t nFiles, + TString *names, + TString misalignment, + Double_t *values, + Double_t *phases, + TString xvar, + TString yvar, + TF1 *function, + Int_t nParameters, + Int_t *parameters, + TString *parameternames, + TString functionname = "", + Bool_t relative = false, + Bool_t resolution = false, + Bool_t pull = false, TString saveas = ""); -void misalignmentDependence(Int_t nFiles,TString *files,TString *names,TString misalignment,Double_t *values,Double_t *phases,TString xvar,TString yvar, - TF1 *function,Int_t parameter,TString parametername = "",TString functionname = "", - Bool_t relative = false,Bool_t resolution = false,Bool_t pull = false, +void misalignmentDependence(Int_t nFiles, + TString *files, + TString *names, + TString misalignment, + Double_t *values, + Double_t *phases, + TString xvar, + TString yvar, + TF1 *function, + Int_t parameter, + TString parametername = "", + TString functionname = "", + Bool_t relative = false, + Bool_t resolution = false, + Bool_t pull = false, TString saveas = ""); -void misalignmentDependence(Int_t nFiles,TString *files,TString *names,TString misalignment,Double_t *values,Double_t *phases,TString xvar,TString yvar, - TF1 *function,Int_t nParameters,Int_t *parameters,TString *parameternames,TString functionname = "", - Bool_t relative = false,Bool_t resolution = false,Bool_t pull = false, +void misalignmentDependence(Int_t nFiles, + TString *files, + TString *names, + TString misalignment, + Double_t *values, + Double_t *phases, + TString xvar, + TString yvar, + TF1 *function, + Int_t nParameters, + Int_t *parameters, + TString *parameternames, + TString functionname = "", + Bool_t relative = false, + Bool_t resolution = false, + Bool_t pull = false, TString saveas = ""); void misalignmentDependence(TCanvas *c1old, - Int_t nFiles,TString *names,TString misalignment,Double_t *values,Double_t *phases,TString xvar,TString yvar, - TString function,Int_t parameter,TString parametername = "",TString functionname = "", - Bool_t relative = false,Bool_t resolution = false,Bool_t pull = false, + Int_t nFiles, + TString *names, + TString misalignment, + Double_t *values, + Double_t *phases, + TString xvar, + TString yvar, + TString function, + Int_t parameter, + TString parametername = "", + TString functionname = "", + Bool_t relative = false, + Bool_t resolution = false, + Bool_t pull = false, TString saveas = ""); void misalignmentDependence(TCanvas *c1old, - Int_t nFiles,TString *names,TString misalignment,Double_t *values,Double_t *phases,TString xvar,TString yvar, - TString function,Int_t nParameters,Int_t *parameters,TString *parameternames,TString functionname = "", - Bool_t relative = false,Bool_t resolution = false,Bool_t pull = false, + Int_t nFiles, + TString *names, + TString misalignment, + Double_t *values, + Double_t *phases, + TString xvar, + TString yvar, + TString function, + Int_t nParameters, + Int_t *parameters, + TString *parameternames, + TString functionname = "", + Bool_t relative = false, + Bool_t resolution = false, + Bool_t pull = false, TString saveas = ""); -void misalignmentDependence(Int_t nFiles,TString *files,TString *names,TString misalignment,Double_t *values,Double_t *phases,TString xvar,TString yvar, - TString function,Int_t parameter,TString parametername = "",TString functionname = "", - Bool_t relative = false,Bool_t resolution = false,Bool_t pull = false, +void misalignmentDependence(Int_t nFiles, + TString *files, + TString *names, + TString misalignment, + Double_t *values, + Double_t *phases, + TString xvar, + TString yvar, + TString function, + Int_t parameter, + TString parametername = "", + TString functionname = "", + Bool_t relative = false, + Bool_t resolution = false, + Bool_t pull = false, TString saveas = ""); -void misalignmentDependence(Int_t nFiles,TString *files,TString *names,TString misalignment,Double_t *values,Double_t *phases,TString xvar,TString yvar, - TString function,Int_t nParameters,Int_t *parameters,TString *parameternames,TString functionname = "", - Bool_t relative = false,Bool_t resolution = false,Bool_t pull = false, +void misalignmentDependence(Int_t nFiles, + TString *files, + TString *names, + TString misalignment, + Double_t *values, + Double_t *phases, + TString xvar, + TString yvar, + TString function, + Int_t nParameters, + Int_t *parameters, + TString *parameternames, + TString functionname = "", + Bool_t relative = false, + Bool_t resolution = false, + Bool_t pull = false, TString saveas = ""); Bool_t misalignmentDependence(TCanvas *c1old, - Int_t nFiles,TString *names,TString misalignment,Double_t *values,Double_t *phases,TString xvar,TString yvar, + Int_t nFiles, + TString *names, + TString misalignment, + Double_t *values, + Double_t *phases, + TString xvar, + TString yvar, Bool_t drawfits = true, - Bool_t relative = false,Bool_t resolution = false,Bool_t pull = false, + Bool_t relative = false, + Bool_t resolution = false, + Bool_t pull = false, TString saveas = ""); -Bool_t misalignmentDependence(Int_t nFiles,TString *files,TString *names,TString misalignment,Double_t *values,Double_t *phases,TString xvar,TString yvar, +Bool_t misalignmentDependence(Int_t nFiles, + TString *files, + TString *names, + TString misalignment, + Double_t *values, + Double_t *phases, + TString xvar, + TString yvar, Bool_t drawfits = true, - Bool_t relative = false,Bool_t resolution = false,Bool_t pull = false, + Bool_t relative = false, + Bool_t resolution = false, + Bool_t pull = false, TString saveas = ""); -Bool_t hasFit(TString misalignment,TString xvar,TString yvar,Bool_t relative = false,Bool_t resolution = false,Bool_t pull = false); - +Bool_t hasFit(TString misalignment, + TString xvar, + TString yvar, + Bool_t relative = false, + Bool_t resolution = false, + Bool_t pull = false); //============= //2. Make Plots //============= -void makePlots(Int_t nFiles,TString *files,TString *names,TString misalignment,Double_t *values,Double_t *phases,TString directory,Bool_t matrix[xsize][ysize]); -void makePlots(Int_t nFiles,TString *files,TString *names,TString directory, Bool_t matrix[xsize][ysize]); -void makePlots(TString file,TString misalignment,Double_t *values,Double_t *phases,TString directory,Bool_t matrix[xsize][ysize]); -void makePlots(TString file,TString directory,Bool_t matrix[xsize][ysize]); -void makePlots(Int_t nFiles,TString *files,TString *names,TString misalignment,Double_t *values,Double_t *phases,TString directory,TString xvar,TString yvar); -void makePlots(Int_t nFiles,TString *files,TString *names,TString directory,TString xvar,TString yvar); -void makePlots(TString file,TString misalignment,Double_t *values,Double_t *phases,TString directory, - TString xvar,TString yvar); -void makePlots(TString file,TString directory,TString xvar,TString yvar); -void makePlots(Int_t nFiles,TString *files,TString *names,TString misalignment,Double_t *values,Double_t *phases,TString directory); -void makePlots(Int_t nFiles,TString *files,TString *names,TString directory); -void makePlots(TString file,TString misalignment,Double_t *values,Double_t *phases,TString directory); -void makePlots(TString file,TString directory); +void makePlots(Int_t nFiles, + TString *files, + TString *names, + TString misalignment, + Double_t *values, + Double_t *phases, + TString directory, + Bool_t matrix[xsize][ysize]); +void makePlots(Int_t nFiles, TString *files, TString *names, TString directory, Bool_t matrix[xsize][ysize]); +void makePlots(TString file, + TString misalignment, + Double_t *values, + Double_t *phases, + TString directory, + Bool_t matrix[xsize][ysize]); +void makePlots(TString file, TString directory, Bool_t matrix[xsize][ysize]); +void makePlots(Int_t nFiles, + TString *files, + TString *names, + TString misalignment, + Double_t *values, + Double_t *phases, + TString directory, + TString xvar, + TString yvar); +void makePlots(Int_t nFiles, TString *files, TString *names, TString directory, TString xvar, TString yvar); +void makePlots(TString file, + TString misalignment, + Double_t *values, + Double_t *phases, + TString directory, + TString xvar, + TString yvar); +void makePlots(TString file, TString directory, TString xvar, TString yvar); +void makePlots(Int_t nFiles, + TString *files, + TString *names, + TString misalignment, + Double_t *values, + Double_t *phases, + TString directory); +void makePlots(Int_t nFiles, TString *files, TString *names, TString directory); +void makePlots(TString file, TString misalignment, Double_t *values, Double_t *phases, TString directory); +void makePlots(TString file, TString directory); //============= //3. Axis Label //============= TString fancyname(TString variable); -TString units(TString variable,Char_t axis); -TString plainunits(TString variable,Char_t axis); -TString latexunits(TString variable,Char_t axis); -TString axislabel(TString variable, Char_t axis, Bool_t relative = false, Bool_t resolution = false, Bool_t pull = false); -TString latexlabel(TString variable, Char_t axis, Bool_t relative = false, Bool_t resolution = false, Bool_t pull = false); -void setAxisLabels(TH1 *p, PlotType type,TString xvar,TString yvar,Bool_t relative,Bool_t pull); -void setAxisLabels(TMultiGraph *p, PlotType type,TString xvar,TString yvar,Bool_t relative,Bool_t pull); -TString nPart(Int_t part,TString string,TString delimit = ";",Bool_t removerest = true); +TString units(TString variable, Char_t axis); +TString plainunits(TString variable, Char_t axis); +TString latexunits(TString variable, Char_t axis); +TString axislabel( + TString variable, Char_t axis, Bool_t relative = false, Bool_t resolution = false, Bool_t pull = false); +TString latexlabel( + TString variable, Char_t axis, Bool_t relative = false, Bool_t resolution = false, Bool_t pull = false); +void setAxisLabels(TH1 *p, PlotType type, TString xvar, TString yvar, Bool_t relative, Bool_t pull); +void setAxisLabels(TMultiGraph *p, PlotType type, TString xvar, TString yvar, Bool_t relative, Bool_t pull); +TString nPart(Int_t part, TString string, TString delimit = ";", Bool_t removerest = true); //============== //4. Axis Limits //============== -Double_t findStatistic(Statistic what,Int_t nFiles,TString *files,TString var,Char_t axis,Bool_t relative = false,Bool_t pull = false); -Double_t findAverage(Int_t nFiles,TString *files,TString var,Char_t axis,Bool_t relative = false,Bool_t pull = false); -Double_t findMin(Int_t nFiles,TString *files,TString var,Char_t axis,Bool_t relative = false,Bool_t pull = false); -Double_t findMax(Int_t nFiles,TString *files,TString var,Char_t axis,Bool_t relative = false,Bool_t pull = false); -Double_t findRMS(Int_t nFiles,TString *files,TString var,Char_t axis,Bool_t relative = false,Bool_t pull = false); -Double_t findStatistic(Statistic what,TString file,TString var,Char_t axis,Bool_t relative = false,Bool_t pull = false); -Double_t findAverage(TString file,TString var,Char_t axis,Bool_t relative = false,Bool_t pull = false); -Double_t findMin(TString file,TString var,Char_t axis,Bool_t relative = false,Bool_t pull = false); -Double_t findMax(TString file,TString var,Char_t axis,Bool_t relative = false,Bool_t pull = false); -Double_t findRMS(TString file,TString var,Char_t axis,Bool_t relative = false,Bool_t pull = false); -void axislimits(Int_t nFiles,TString *files,TString var,Char_t axis,Bool_t relative,Bool_t pull,Double_t &min,Double_t &max,Double_t &bins); +Double_t findStatistic(Statistic what, + Int_t nFiles, + TString *files, + TString var, + Char_t axis, + Bool_t relative = false, + Bool_t pull = false); +Double_t findAverage( + Int_t nFiles, TString *files, TString var, Char_t axis, Bool_t relative = false, Bool_t pull = false); +Double_t findMin(Int_t nFiles, TString *files, TString var, Char_t axis, Bool_t relative = false, Bool_t pull = false); +Double_t findMax(Int_t nFiles, TString *files, TString var, Char_t axis, Bool_t relative = false, Bool_t pull = false); +Double_t findRMS(Int_t nFiles, TString *files, TString var, Char_t axis, Bool_t relative = false, Bool_t pull = false); +Double_t findStatistic( + Statistic what, TString file, TString var, Char_t axis, Bool_t relative = false, Bool_t pull = false); +Double_t findAverage(TString file, TString var, Char_t axis, Bool_t relative = false, Bool_t pull = false); +Double_t findMin(TString file, TString var, Char_t axis, Bool_t relative = false, Bool_t pull = false); +Double_t findMax(TString file, TString var, Char_t axis, Bool_t relative = false, Bool_t pull = false); +Double_t findRMS(TString file, TString var, Char_t axis, Bool_t relative = false, Bool_t pull = false); +void axislimits(Int_t nFiles, + TString *files, + TString var, + Char_t axis, + Bool_t relative, + Bool_t pull, + Double_t &min, + Double_t &max, + Double_t &bins); //=============== //5. Place Legend //=============== -Double_t placeLegend(TLegend *l, Double_t width, Double_t height, Double_t x1min, Double_t y1min, Double_t x2max, Double_t y2max); -Bool_t fitsHere(TLegend *l,Double_t x1, Double_t y1, Double_t x2, Double_t y2); +Double_t placeLegend( + TLegend *l, Double_t width, Double_t height, Double_t x1min, Double_t y1min, Double_t x2max, Double_t y2max); +Bool_t fitsHere(TLegend *l, Double_t x1, Double_t y1, Double_t x2, Double_t y2); #endif diff --git a/Alignment/OfflineValidation/plugins/BuildFile.xml b/Alignment/OfflineValidation/plugins/BuildFile.xml index 9a516c4315241..5f837ecee49c1 100644 --- a/Alignment/OfflineValidation/plugins/BuildFile.xml +++ b/Alignment/OfflineValidation/plugins/BuildFile.xml @@ -12,6 +12,7 @@ + diff --git a/Alignment/OfflineValidation/plugins/DMRChecker.cc b/Alignment/OfflineValidation/plugins/DMRChecker.cc index cd68af995f2e3..2d4bc4b3fe7d2 100644 --- a/Alignment/OfflineValidation/plugins/DMRChecker.cc +++ b/Alignment/OfflineValidation/plugins/DMRChecker.cc @@ -149,11 +149,11 @@ namespace running { class DMRChecker : public edm::one::EDAnalyzer { public: DMRChecker(const edm::ParameterSet &pset) - : geomToken_(esConsumes()), - runInfoToken_(esConsumes()), - magFieldToken_(esConsumes()), - topoToken_(esConsumes()), - latencyToken_(esConsumes()), + : geomToken_(esConsumes()), + runInfoToken_(esConsumes()), + magFieldToken_(esConsumes()), + topoToken_(esConsumes()), + latencyToken_(esConsumes()), isCosmics_(pset.getParameter("isCosmics")) { usesResource(TFileService::kSharedResource); @@ -195,7 +195,7 @@ class DMRChecker : public edm::one::EDAnalyzer { static void fillDescriptions(edm::ConfigurationDescriptions &); - ~DMRChecker() override {} + ~DMRChecker() override = default; /*_______________________________________________________ // @@ -620,7 +620,7 @@ class DMRChecker : public edm::one::EDAnalyzer { resDetailsTIB_[detid_db].rOrZDirection = resDetailsTIB_[detid_db].rDirection; // barrel (split in r) } - hTIBResXPrime->Fill(uOrientation * resX * 10000); + hTIBResXPrime->Fill(uOrientation * resX * cmToUm); hTIBResXPull->Fill(pullX); // update residuals @@ -630,7 +630,7 @@ class DMRChecker : public edm::one::EDAnalyzer { uOrientation = deltaPhi(gUDirection.barePhi(), gPModule.barePhi()) >= 0. ? +1.F : -1.F; //vOrientation = gVDirection.z() - gPModule.z() >= 0 ? +1.F : -1.F; // not used for Strips - hTOBResXPrime->Fill(uOrientation * resX * 10000); + hTOBResXPrime->Fill(uOrientation * resX * cmToUm); hTOBResXPull->Fill(pullX); // if the detid has never occcurred yet, set the local orientations @@ -647,7 +647,7 @@ class DMRChecker : public edm::one::EDAnalyzer { uOrientation = deltaPhi(gUDirection.barePhi(), gPModule.barePhi()) >= 0. ? +1.F : -1.F; //vOrientation = gVDirection.perp() - gPModule.perp() >= 0. ? +1.F : -1.F; // not used for Strips - hTIDResXPrime->Fill(uOrientation * resX * 10000); + hTIDResXPrime->Fill(uOrientation * resX * cmToUm); hTIDResXPull->Fill(pullX); // update residuals @@ -657,7 +657,7 @@ class DMRChecker : public edm::one::EDAnalyzer { uOrientation = deltaPhi(gUDirection.barePhi(), gPModule.barePhi()) >= 0. ? +1.F : -1.F; //vOrientation = gVDirection.perp() - gPModule.perp() >= 0. ? +1.F : -1.F; // not used for Strips - hTECResXPrime->Fill(uOrientation * resX * 10000); + hTECResXPrime->Fill(uOrientation * resX * cmToUm); hTECResXPull->Fill(pullX); // update residuals diff --git a/Alignment/OfflineValidation/plugins/GeneralPurposeTrackAnalyzer.cc b/Alignment/OfflineValidation/plugins/GeneralPurposeTrackAnalyzer.cc index 1574d3f914846..eb080b217c6fa 100644 --- a/Alignment/OfflineValidation/plugins/GeneralPurposeTrackAnalyzer.cc +++ b/Alignment/OfflineValidation/plugins/GeneralPurposeTrackAnalyzer.cc @@ -32,13 +32,16 @@ #include // user include files - #include "CommonTools/TrackerMap/interface/TrackerMap.h" #include "CommonTools/UtilAlgos/interface/TFileService.h" #include "CondFormats/AlignmentRecord/interface/GlobalPositionRcd.h" +#include "CondFormats/DataRecord/interface/SiPixelFedCablingMapRcd.h" #include "CondFormats/DataRecord/interface/SiStripCondDataRecords.h" +#include "CondFormats/SiPixelObjects/interface/SiPixelFedCablingMap.h" #include "CondFormats/SiStripObjects/interface/SiStripLatency.h" +#include "DQM/SiPixelPhase1Common/interface/SiPixelCoordinates.h" #include "DQM/TrackerRemapper/interface/Phase1PixelMaps.h" +#include "DQM/TrackerRemapper/interface/Phase1PixelROCMaps.h" #include "DataFormats/BeamSpot/interface/BeamSpot.h" #include "DataFormats/Common/interface/TriggerResults.h" #include "DataFormats/DetId/interface/DetId.h" @@ -60,11 +63,11 @@ #include "DataFormats/VertexReco/interface/Vertex.h" #include "DataFormats/VertexReco/interface/VertexFwd.h" #include "FWCore/Common/interface/TriggerNames.h" -#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/Framework/interface/Frameworkfwd.h" #include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/ServiceRegistry/interface/Service.h" @@ -85,9 +88,12 @@ const int kFPIX = PixelSubdetector::PixelEndcap; class GeneralPurposeTrackAnalyzer : public edm::one::EDAnalyzer { public: GeneralPurposeTrackAnalyzer(const edm::ParameterSet &pset) - : geomToken_(esConsumes()), - magFieldToken_(esConsumes()), - latencyToken_(esConsumes()) { + : geomToken_(esConsumes()), + magFieldToken_(esConsumes()), + latencyToken_(esConsumes()), + geomTokenBR_(esConsumes()), + trackerTopologyTokenBR_(esConsumes()), + siPixelFedCablingMapTokenBR_(esConsumes()) { usesResource(TFileService::kSharedResource); TkTag_ = pset.getParameter("TkTag"); @@ -116,9 +122,11 @@ class GeneralPurposeTrackAnalyzer : public edm::one::EDAnalyzer("COLZ0 L"); pixelmap->bookBarrelHistograms("entriesBarrel", "# hits", "# pixel hits"); pixelmap->bookForwardHistograms("entriesForward", "# hits", "# pixel hits"); + + pixelrocsmap_ = std::make_unique(""); } - ~GeneralPurposeTrackAnalyzer() override {} + ~GeneralPurposeTrackAnalyzer() override = default; static void fillDescriptions(edm::ConfigurationDescriptions &); @@ -140,14 +148,21 @@ class GeneralPurposeTrackAnalyzer : public edm::one::EDAnalyzer magFieldToken_; const edm::ESGetToken latencyToken_; + const edm::ESGetToken geomTokenBR_; + const edm::ESGetToken trackerTopologyTokenBR_; + const edm::ESGetToken siPixelFedCablingMapTokenBR_; + edm::ESHandle magneticField_; + SiPixelCoordinates coord_; + edm::Service fs; std::unique_ptr tmap; std::unique_ptr pmap; std::unique_ptr pixelmap; + std::unique_ptr pixelrocsmap_; TH1D *hchi2ndof; TH1D *hNtrk; @@ -343,11 +358,13 @@ class GeneralPurposeTrackAnalyzer : public edm::one::EDAnalyzer rocsToMask; for (auto iHit = track->recHitsBegin(); iHit != track->recHitsEnd(); ++iHit) { if (this->isHit2D(**iHit)) { ++nHit2D; } - + // rest the ROCs for the map + rocsToMask.reset(); const DetId &detId = (*iHit)->geographicalId(); const GeomDet *geomDet(theGeometry->idToDet(detId)); @@ -358,6 +375,18 @@ class GeneralPurposeTrackAnalyzer : public edm::one::EDAnalyzercluster(); + + if (clustp.isNull()) + continue; + auto const &cluster = *clustp; + int row = cluster.x() - 0.5, col = cluster.y() - 0.5; + int rocId = coord_.roc(detId, std::make_pair(row, col)); + + rocsToMask.set(rocId); + pixelrocsmap_->fillSelectedRocs(detid_db, rocsToMask, 1); + if (!isPhase1_) { pmap->fill(detid_db, 1); } else { @@ -695,6 +724,14 @@ class GeneralPurposeTrackAnalyzer : public edm::one::EDAnalyzerGetXaxis()->SetBinLabel((the_r - theRuns_.front()) + 1, std::to_string(the_r).c_str()); } - pmap->save(true, 0, 0, "PixelHitMap.pdf", 600, 800); - pmap->save(true, 0, 0, "PixelHitMap.png", 500, 750); + if (!isPhase1_) { + pmap->save(true, 0, 0, "PixelHitMap.pdf", 600, 800); + pmap->save(true, 0, 0, "PixelHitMap.png", 500, 750); + } tmap->save(true, 0, 0, "StripHitMap.pdf"); tmap->save(true, 0, 0, "StripHitMap.png"); @@ -1139,6 +1178,10 @@ class GeneralPurposeTrackAnalyzer : public edm::one::EDAnalyzerdrawForwardMaps("entriesForward", cF); cF.SaveAs("pixelForwardEntries.png"); + + TCanvas cRocs = TCanvas("cRocs", "cRocs", 1200, 1600); + pixelrocsmap_->drawMaps(cRocs, "Pixel on-track clusters occupancy"); + cRocs.SaveAs("Phase1PixelROCMaps_fullROCs.png"); } //************************************************************* diff --git a/Alignment/OfflineValidation/plugins/TrackerOfflineValidationSummary.cc b/Alignment/OfflineValidation/plugins/TrackerOfflineValidationSummary.cc index 72182c759dbf6..51f7e40025717 100644 --- a/Alignment/OfflineValidation/plugins/TrackerOfflineValidationSummary.cc +++ b/Alignment/OfflineValidation/plugins/TrackerOfflineValidationSummary.cc @@ -55,7 +55,7 @@ // class decleration // -class TrackerOfflineValidationSummary : public edm::one::EDAnalyzer<> { +class TrackerOfflineValidationSummary : public edm::one::EDAnalyzer { public: typedef dqm::legacy::DQMStore DQMStore; explicit TrackerOfflineValidationSummary(const edm::ParameterSet&); @@ -63,7 +63,7 @@ class TrackerOfflineValidationSummary : public edm::one::EDAnalyzer<> { private: const edm::ESGetToken geomToken_; - const edm::ESGetToken topoToken_; + const edm::ESGetToken tTopoToken_; struct ModuleHistos { ModuleHistos() @@ -96,7 +96,9 @@ class TrackerOfflineValidationSummary : public edm::one::EDAnalyzer<> { HarvestingHistos harvestingHistos; }; + void beginRun(const edm::Run&, const edm::EventSetup& iSetup) override{}; void analyze(const edm::Event& evt, const edm::EventSetup&) override; + void endRun(const edm::Run&, const edm::EventSetup& iSetup) override; void endJob() override; void fillTree(TTree& tree, @@ -123,6 +125,7 @@ class TrackerOfflineValidationSummary : public edm::one::EDAnalyzer<> { const edm::ParameterSet parSet_; edm::ESHandle tkGeom_; + std::unique_ptr tTopo_; // parameters from cfg to steer const std::string moduleDirectory_; @@ -140,47 +143,31 @@ class TrackerOfflineValidationSummary : public edm::one::EDAnalyzer<> { std::map mTecResiduals_; std::vector vHarvestingHierarchy_; - - const edm::EventSetup* lastSetup_; }; -// -// constants, enums and typedefs -// - -// -// static data member definitions -// - // // constructors and destructor // TrackerOfflineValidationSummary::TrackerOfflineValidationSummary(const edm::ParameterSet& iConfig) - : //geomToken_(esConsumes()), # this does not work - topoToken_(esConsumes()), + : geomToken_(esConsumes()), + tTopoToken_(esConsumes()), parSet_(iConfig), + tTopo_(nullptr), moduleDirectory_(parSet_.getParameter("moduleDirectoryInOutput")), useFit_(parSet_.getParameter("useFit")), dbe_(nullptr), - moduleMapsInitialized(false), - lastSetup_(nullptr) { + moduleMapsInitialized(false) { //now do what ever initialization is needed dbe_ = edm::Service().operator->(); } -TrackerOfflineValidationSummary::~TrackerOfflineValidationSummary() { - // do anything here that needs to be done at desctruction time - // (e.g. close files, deallocate resources etc.) -} - +TrackerOfflineValidationSummary::~TrackerOfflineValidationSummary() = default; // // member functions // // ------------ method called to for each event ------------ void TrackerOfflineValidationSummary::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { - lastSetup_ = &iSetup; - // Access of EventSetup is needed to get the list of silicon-modules and their IDs // Since they do not change, it is accessed only once if (moduleMapsInitialized) @@ -215,18 +202,16 @@ void TrackerOfflineValidationSummary::analyze(const edm::Event& iEvent, const ed moduleMapsInitialized = true; } +// ------------ method called at each end of Run ------------ +void TrackerOfflineValidationSummary::endRun(const edm::Run&, const edm::EventSetup& iSetup) { + if (!tTopo_) { + tTopo_ = std::make_unique(iSetup.getData(tTopoToken_)); + } +} + // ------------ method called once each job just after ending the event loop ------------ void TrackerOfflineValidationSummary::endJob() { - //Retrieve tracker topology from geometry - edm::ESHandle tTopoHandle; - lastSetup_->get().get(tTopoHandle); - const TrackerTopology* const tTopo = tTopoHandle.product(); - - // do not know how to set the transition - //edm::ESHandle tTopoHandle = lastSetup_->getHandle(topoToken_); - //const TrackerTopology *const tTopo = tTopoHandle.product(); - - AlignableTracker aliTracker(&(*tkGeom_), tTopo); + AlignableTracker aliTracker(&(*tkGeom_), tTopo_.get()); TTree* tree = new TTree("TkOffVal", "TkOffVal"); @@ -239,12 +224,12 @@ void TrackerOfflineValidationSummary::endJob() { std::map* substructureName = new std::map; tree->Branch("SubstructureName", &substructureName, 32000, 00); // SplitLevel must be set to zero - this->fillTree(*tree, mPxbResiduals_, *treeMemPtr, *tkGeom_, *substructureName, tTopo); - this->fillTree(*tree, mPxeResiduals_, *treeMemPtr, *tkGeom_, *substructureName, tTopo); - this->fillTree(*tree, mTibResiduals_, *treeMemPtr, *tkGeom_, *substructureName, tTopo); - this->fillTree(*tree, mTidResiduals_, *treeMemPtr, *tkGeom_, *substructureName, tTopo); - this->fillTree(*tree, mTobResiduals_, *treeMemPtr, *tkGeom_, *substructureName, tTopo); - this->fillTree(*tree, mTecResiduals_, *treeMemPtr, *tkGeom_, *substructureName, tTopo); + this->fillTree(*tree, mPxbResiduals_, *treeMemPtr, *tkGeom_, *substructureName, tTopo_.get()); + this->fillTree(*tree, mPxeResiduals_, *treeMemPtr, *tkGeom_, *substructureName, tTopo_.get()); + this->fillTree(*tree, mTibResiduals_, *treeMemPtr, *tkGeom_, *substructureName, tTopo_.get()); + this->fillTree(*tree, mTidResiduals_, *treeMemPtr, *tkGeom_, *substructureName, tTopo_.get()); + this->fillTree(*tree, mTobResiduals_, *treeMemPtr, *tkGeom_, *substructureName, tTopo_.get()); + this->fillTree(*tree, mTecResiduals_, *treeMemPtr, *tkGeom_, *substructureName, tTopo_.get()); //dbe_->save("dqmOut.root"); diff --git a/Alignment/OfflineValidation/scripts/GeometryComparisonPlotter.cc b/Alignment/OfflineValidation/scripts/GeometryComparisonPlotter.cc index 9a2c86493da08..4110c34dfafaa 100644 --- a/Alignment/OfflineValidation/scripts/GeometryComparisonPlotter.cc +++ b/Alignment/OfflineValidation/scripts/GeometryComparisonPlotter.cc @@ -8,1543 +8,1649 @@ /* Thanks a million <3 */ /***********************************************************************************/ -// NOTE: look for "TO DO" as a keyword to now what should be upgraded in later versions.... - +// NOTE: look for "TO DO" as a keyword to now what should be upgraded in later versions.... // modes -#define TALKATIVE // get some comments while processing +#define TALKATIVE // get some comments while processing //#define DEBUG // get a lot of comments while processing + canvases -> resource-consuming! // MACROS -#define INSIDE_VECTOR(vector) \ - cout << #vector << "={"; for (unsigned int i = 0 ; i < vector.size()-1 ; i++) cout << vector[i] << ","; cout << vector.back() << "}"; -#define CHECK_MAP_CONTENT(m,type) \ - for (map::iterator it = m.begin() ; it != m.end() ; it++) \ - cout << __FILE__ << ":" << __LINE__ << ":Info: " << #m << "[" << it->first << "]=" << it->second << endl; +#define INSIDE_VECTOR(vector) \ + cout << #vector << "={"; \ + for (unsigned int i = 0; i < vector.size() - 1; i++) \ + cout << vector[i] << ","; \ + cout << vector.back() << "}"; +#define CHECK_MAP_CONTENT(m, type) \ + for (map::iterator it = m.begin(); it != m.end(); it++) \ + cout << __FILE__ << ":" << __LINE__ << ":Info: " << #m << "[" << it->first << "]=" << it->second << endl; // CONSTRUCTOR AND DESTRUCTOR -GeometryComparisonPlotter::GeometryComparisonPlotter (TString tree_file_name, - TString output_directory, - TString modulesToPlot, - TString alignmentName, - TString referenceName, - bool printOnlyGlobal, - bool makeProfilePlots - ) : - _output_directory(output_directory + TString(output_directory.EndsWith("/") ? "" : "/")), - _output_filename("comparison.root"), - _print_option("pdf"), - _module_plot_option(modulesToPlot), - _alignment_name(alignmentName), - _reference_name(referenceName), - _print_only_global(printOnlyGlobal), - _make_profile_plots(makeProfilePlots), - _print(true), // print the graphs in a file (e.g. pdf) - _legend(true), // print the graphs in a file (e.g. pdf) - _write(true), // write the graphs in a root file - _batchMode( +GeometryComparisonPlotter::GeometryComparisonPlotter(TString tree_file_name, + TString output_directory, + TString modulesToPlot, + TString alignmentName, + TString referenceName, + bool printOnlyGlobal, + bool makeProfilePlots) + : _output_directory(output_directory + TString(output_directory.EndsWith("/") ? "" : "/")), + _output_filename("comparison.root"), + _print_option("pdf"), + _module_plot_option(modulesToPlot), + _alignment_name(alignmentName), + _reference_name(referenceName), + _print_only_global(printOnlyGlobal), + _make_profile_plots(makeProfilePlots), + _print(true), // print the graphs in a file (e.g. pdf) + _legend(true), // print the graphs in a file (e.g. pdf) + _write(true), // write the graphs in a root file + _batchMode( #ifdef DEBUG - false // false = display canvases (very time- and resource-consuming) + false // false = display canvases (very time- and resource-consuming) #else - true // true = no canvases + true // true = no canvases #endif - ), - _1dModule(true), // cut on 1d modules - _2dModule(true), // cut on 2d modules - _levelCut (DEFAULT_LEVEL), // module level (see branch of same name) - _grid_x(0), // by default no display the grid in the canvases - _grid_y(0), // by default no display the grid in the canvases - _window_width(DEFAULT_WINDOW_WIDTH), - _window_height(DEFAULT_WINDOW_HEIGHT) -{ + ), + _1dModule(true), // cut on 1d modules + _2dModule(true), // cut on 2d modules + _levelCut(DEFAULT_LEVEL), // module level (see branch of same name) + _grid_x(0), // by default no display the grid in the canvases + _grid_y(0), // by default no display the grid in the canvases + _window_width(DEFAULT_WINDOW_WIDTH), + _window_height(DEFAULT_WINDOW_HEIGHT) { #ifdef TALKATIVE - cout << ">>> TALKATIVE MODE ACTIVATED <<<" << endl; + cout << ">>> TALKATIVE MODE ACTIVATED <<<" << endl; #endif #ifdef DEBUG - cout << ">>> DEBUG MODE ACTIVATED <<<" << endl; - cout << __FILE__ << ":"<< __LINE__ << ":Info: inside constructor of GeometryComparisonPlotter utility"<< endl; + cout << ">>> DEBUG MODE ACTIVATED <<<" << endl; + cout << __FILE__ << ":" << __LINE__ << ":Info: inside constructor of GeometryComparisonPlotter utility" << endl; #endif - //_sublevel_names = {"PXB", "PXF", "TIB", "TID", "TOB", "TEC"}; // C++11 - _sublevel_names[0] = TString("PXB"); - _sublevel_names[1] = TString("PXF"); - _sublevel_names[2] = TString("TIB"); - _sublevel_names[3] = TString("TID"); - _sublevel_names[4] = TString("TOB"); - _sublevel_names[5] = TString("TEC"); - // TO DO: handle other structures - - // read tree - tree_file = new TFile(tree_file_name, "UPDATE"); - data = (TTree*) tree_file->Get("alignTree"); - // int branches - data->SetBranchAddress("id" ,&branch_i["id"]); - data->SetBranchAddress("inModuleList" ,&branch_i["inModuleList"]); - data->SetBranchAddress("badModuleQuality" ,&branch_i["badModuleQuality"]); - data->SetBranchAddress("mid" ,&branch_i["mid"]); - data->SetBranchAddress("level" ,&branch_i["level"]); - data->SetBranchAddress("mlevel" ,&branch_i["mlevel"]); - data->SetBranchAddress("sublevel" ,&branch_i["sublevel"]); - data->SetBranchAddress("useDetId" ,&branch_i["useDetId"]); - data->SetBranchAddress("detDim" ,&branch_i["detDim"]); - // float branches - data->SetBranchAddress("x" ,&branch_f["x"]); - data->SetBranchAddress("y" ,&branch_f["y"]); - data->SetBranchAddress("z" ,&branch_f["z"]); - data->SetBranchAddress("alpha" ,&branch_f["alpha"]); - data->SetBranchAddress("beta" ,&branch_f["beta"]); - data->SetBranchAddress("gamma" ,&branch_f["gamma"]); - data->SetBranchAddress("phi" ,&branch_f["phi"]); - data->SetBranchAddress("eta" ,&branch_f["eta"]); - data->SetBranchAddress("r" ,&branch_f["r"]); - data->SetBranchAddress("dx" ,&branch_f["dx"]); - data->SetBranchAddress("dy" ,&branch_f["dy"]); - data->SetBranchAddress("dz" ,&branch_f["dz"]); - data->SetBranchAddress("dphi" ,&branch_f["dphi"]); - data->SetBranchAddress("dr" ,&branch_f["dr"]); - data->SetBranchAddress("dalpha" ,&branch_f["dalpha"]); - data->SetBranchAddress("dbeta" ,&branch_f["dbeta"]); - data->SetBranchAddress("dgamma" ,&branch_f["dgamma"]); - if (data->GetBranch("rdphi") == 0x0) // in the case of rdphi branch not existing, it is created from r and dphi branches - { + //_sublevel_names = {"PXB", "PXF", "TIB", "TID", "TOB", "TEC"}; // C++11 + _sublevel_names[0] = TString("PXB"); + _sublevel_names[1] = TString("PXF"); + _sublevel_names[2] = TString("TIB"); + _sublevel_names[3] = TString("TID"); + _sublevel_names[4] = TString("TOB"); + _sublevel_names[5] = TString("TEC"); + // TO DO: handle other structures + + // read tree + tree_file = new TFile(tree_file_name, "UPDATE"); + data = (TTree *)tree_file->Get("alignTree"); + // int branches + data->SetBranchAddress("id", &branch_i["id"]); + data->SetBranchAddress("inModuleList", &branch_i["inModuleList"]); + data->SetBranchAddress("badModuleQuality", &branch_i["badModuleQuality"]); + data->SetBranchAddress("mid", &branch_i["mid"]); + data->SetBranchAddress("level", &branch_i["level"]); + data->SetBranchAddress("mlevel", &branch_i["mlevel"]); + data->SetBranchAddress("sublevel", &branch_i["sublevel"]); + data->SetBranchAddress("useDetId", &branch_i["useDetId"]); + data->SetBranchAddress("detDim", &branch_i["detDim"]); + // float branches + data->SetBranchAddress("x", &branch_f["x"]); + data->SetBranchAddress("y", &branch_f["y"]); + data->SetBranchAddress("z", &branch_f["z"]); + data->SetBranchAddress("alpha", &branch_f["alpha"]); + data->SetBranchAddress("beta", &branch_f["beta"]); + data->SetBranchAddress("gamma", &branch_f["gamma"]); + data->SetBranchAddress("phi", &branch_f["phi"]); + data->SetBranchAddress("eta", &branch_f["eta"]); + data->SetBranchAddress("r", &branch_f["r"]); + data->SetBranchAddress("dx", &branch_f["dx"]); + data->SetBranchAddress("dy", &branch_f["dy"]); + data->SetBranchAddress("dz", &branch_f["dz"]); + data->SetBranchAddress("dphi", &branch_f["dphi"]); + data->SetBranchAddress("dr", &branch_f["dr"]); + data->SetBranchAddress("dalpha", &branch_f["dalpha"]); + data->SetBranchAddress("dbeta", &branch_f["dbeta"]); + data->SetBranchAddress("dgamma", &branch_f["dgamma"]); + if (data->GetBranch("rdphi") == + 0x0) // in the case of rdphi branch not existing, it is created from r and dphi branches + { #ifdef TALKATIVE - cout << __FILE__ << ":" << __LINE__ << ":Info: computing the rdphi branch from r and dphi branches (assuming they exist...)" << endl; + cout << __FILE__ << ":" << __LINE__ + << ":Info: computing the rdphi branch from r and dphi branches (assuming they exist...)" << endl; #endif - TBranch * br_rdphi = data->Branch("rdphi", &branch_f["rdphi"], "rdphi/F"); - for (unsigned int ientry = 0 ; ientry < data->GetEntries() ; ientry++) - { - data->GetEntry(ientry); - branch_f["rdphi"] = branch_f["r"]*branch_f["dphi"]; - br_rdphi->Fill(); - } + TBranch *br_rdphi = data->Branch("rdphi", &branch_f["rdphi"], "rdphi/F"); + for (unsigned int ientry = 0; ientry < data->GetEntries(); ientry++) { + data->GetEntry(ientry); + branch_f["rdphi"] = branch_f["r"] * branch_f["dphi"]; + br_rdphi->Fill(); } - else - data->SetBranchAddress("rdphi",&branch_f["rdphi"]); + } else + data->SetBranchAddress("rdphi", &branch_f["rdphi"]); #ifdef DEBUG - cout << __FILE__ << ":" << __LINE__ << ":Info: branch addresses set" << endl; + cout << __FILE__ << ":" << __LINE__ << ":Info: branch addresses set" << endl; #endif - // style - gROOT->Reset(); - - data->SetMarkerSize(0.5); - data->SetMarkerStyle(6); - - gStyle->SetOptStat("emr"); - gStyle->SetTitleAlign(22); - gStyle->SetTitleX(0.5); - gStyle->SetTitleY(0.97); - gStyle->SetTitleFont(62); - //gStyle->SetOptTitle(0); - - gStyle->SetTextFont(132); - gStyle->SetTextSize(0.08); - gStyle->SetLabelFont(132,"x"); - gStyle->SetLabelFont(132,"y"); - gStyle->SetLabelFont(132,"z"); - gStyle->SetTitleSize(0.08,"x"); - gStyle->SetTitleSize(0.08,"y"); - gStyle->SetTitleSize(0.08,"z"); - gStyle->SetLabelSize(0.08,"x"); - gStyle->SetLabelSize(0.08,"y"); - gStyle->SetLabelSize(0.08,"z"); - - gStyle->SetMarkerStyle(8); - gStyle->SetHistLineWidth(2); - gStyle->SetLineStyleString(2,"[12 12]"); // postscript dashes - - gStyle->SetFrameBorderMode(0); - gStyle->SetCanvasBorderMode(0); - gStyle->SetPadBorderMode(0); - gStyle->SetPadColor(0); - gStyle->SetCanvasColor(0); - gStyle->SetTitleColor(1); - gStyle->SetStatColor(0); - gStyle->SetStatBorderSize(1); - gStyle->SetFrameFillColor(0); - - gStyle->SetPadTickX(1); - gStyle->SetPadTickY(1); - - gStyle->SetPadTopMargin(0.1); - gStyle->SetPadRightMargin(0.05); - gStyle->SetPadBottomMargin(0.16); - gStyle->SetPadLeftMargin(0.18); + // style + gROOT->Reset(); + + data->SetMarkerSize(0.5); + data->SetMarkerStyle(6); + + gStyle->SetOptStat("emr"); + gStyle->SetTitleAlign(22); + gStyle->SetTitleX(0.5); + gStyle->SetTitleY(0.97); + gStyle->SetTitleFont(62); + //gStyle->SetOptTitle(0); + + gStyle->SetTextFont(132); + gStyle->SetTextSize(0.08); + gStyle->SetLabelFont(132, "x"); + gStyle->SetLabelFont(132, "y"); + gStyle->SetLabelFont(132, "z"); + gStyle->SetTitleSize(0.08, "x"); + gStyle->SetTitleSize(0.08, "y"); + gStyle->SetTitleSize(0.08, "z"); + gStyle->SetLabelSize(0.08, "x"); + gStyle->SetLabelSize(0.08, "y"); + gStyle->SetLabelSize(0.08, "z"); + + gStyle->SetMarkerStyle(8); + gStyle->SetHistLineWidth(2); + gStyle->SetLineStyleString(2, "[12 12]"); // postscript dashes + + gStyle->SetFrameBorderMode(0); + gStyle->SetCanvasBorderMode(0); + gStyle->SetPadBorderMode(0); + gStyle->SetPadColor(0); + gStyle->SetCanvasColor(0); + gStyle->SetTitleColor(1); + gStyle->SetStatColor(0); + gStyle->SetStatBorderSize(1); + gStyle->SetFrameFillColor(0); + + gStyle->SetPadTickX(1); + gStyle->SetPadTickY(1); + + gStyle->SetPadTopMargin(0.1); + gStyle->SetPadRightMargin(0.05); + gStyle->SetPadBottomMargin(0.16); + gStyle->SetPadLeftMargin(0.18); #ifdef DEBUG - cout << __FILE__ << ":" << __LINE__ << ":Info: end of constructor" << endl; + cout << __FILE__ << ":" << __LINE__ << ":Info: end of constructor" << endl; #endif } -GeometryComparisonPlotter::~GeometryComparisonPlotter () -{ +GeometryComparisonPlotter::~GeometryComparisonPlotter() { #ifdef DEBUG - cout << __FILE__ << ":" << __LINE__ << ":Info: in destructor of the GeometryComparisonPlotter utility" << endl; + cout << __FILE__ << ":" << __LINE__ << ":Info: in destructor of the GeometryComparisonPlotter utility" << endl; #endif - tree_file->Close(); + tree_file->Close(); #ifdef DEBUG - cout << __FILE__ << ":" << __LINE__ << ":Info: ending." << endl; + cout << __FILE__ << ":" << __LINE__ << ":Info: ending." << endl; #endif } // MAIN METHOD -void GeometryComparisonPlotter::MakePlots (vector x, // axes to combine to plot - vector y, // every combination (except the ones such that x=y) will be perfomed - vector dyMin, // Minimum of y-variable to enable fixed ranges of the histogram - vector dyMax) // Minimum of y-variable +void GeometryComparisonPlotter::MakePlots( + vector x, // axes to combine to plot + vector y, // every combination (except the ones such that x=y) will be perfomed + vector dyMin, // Minimum of y-variable to enable fixed ranges of the histogram + vector dyMax) // Minimum of y-variable { - /// -1) check that only existing branches are called - // (we use a macro to avoid copy/paste) -#define CHECK_BRANCHES(branchname_vector) \ - for (unsigned int i = 0 ; i < branchname_vector.size() ; i++) \ - { \ - if (branch_f.find(branchname_vector[i]) == branch_f.end()) \ - { \ - cout << __FILE__ << ":" << __LINE__ << ":Error: The branch " << branchname_vector[i] << " is not recognised." << endl; \ - return; \ - } \ - } - CHECK_BRANCHES(x); - CHECK_BRANCHES(y); - - const unsigned int nentries = data->GetEntries(); + /// -1) check that only existing branches are called + // (we use a macro to avoid copy/paste) +#define CHECK_BRANCHES(branchname_vector) \ + for (unsigned int i = 0; i < branchname_vector.size(); i++) { \ + if (branch_f.find(branchname_vector[i]) == branch_f.end()) { \ + cout << __FILE__ << ":" << __LINE__ << ":Error: The branch " << branchname_vector[i] << " is not recognised." \ + << endl; \ + return; \ + } \ + } + CHECK_BRANCHES(x); + CHECK_BRANCHES(y); + + const unsigned int nentries = data->GetEntries(); #ifdef TALKATIVE - cout << __FILE__ << ":" << __LINE__ << ":Info: "; INSIDE_VECTOR(x); cout << endl - << __FILE__ << ":" << __LINE__ << ":Info: "; INSIDE_VECTOR(y); cout << endl; + cout << __FILE__ << ":" << __LINE__ << ":Info: "; + INSIDE_VECTOR(x); + cout << endl << __FILE__ << ":" << __LINE__ << ":Info: "; + INSIDE_VECTOR(y); + cout << endl; #endif - /// 0) min and max values - // the max and min of the graphs are computed from the tree if they have not been manually input yet - // (we use a macro to avoid copy/paste) -#define LIMITS(axes_vector) \ - for (unsigned int i = 0 ; i < axes_vector.size() ; i++) \ - { \ - if ( _SF.find(axes_vector[i]) == _SF.end()) _SF[axes_vector[i]] = 1.; \ - if (_min.find(axes_vector[i]) == _min.end()) _min[axes_vector[i]] = _SF[axes_vector[i]]*data->GetMinimum(axes_vector[i]); \ - if (_max.find(axes_vector[i]) == _max.end()) _max[axes_vector[i]] = _SF[axes_vector[i]]*data->GetMaximum(axes_vector[i]); \ - } - LIMITS(x); - LIMITS(y); + /// 0) min and max values + // the max and min of the graphs are computed from the tree if they have not been manually input yet + // (we use a macro to avoid copy/paste) +#define LIMITS(axes_vector) \ + for (unsigned int i = 0; i < axes_vector.size(); i++) { \ + if (_SF.find(axes_vector[i]) == _SF.end()) \ + _SF[axes_vector[i]] = 1.; \ + if (_min.find(axes_vector[i]) == _min.end()) \ + _min[axes_vector[i]] = _SF[axes_vector[i]] * data->GetMinimum(axes_vector[i]); \ + if (_max.find(axes_vector[i]) == _max.end()) \ + _max[axes_vector[i]] = _SF[axes_vector[i]] * data->GetMaximum(axes_vector[i]); \ + } + LIMITS(x); + LIMITS(y); -#ifdef TALKATIVE - CHECK_MAP_CONTENT(_min,float); - CHECK_MAP_CONTENT(_max,float); - CHECK_MAP_CONTENT(_SF ,float); +#ifdef TALKATIVE + CHECK_MAP_CONTENT(_min, float); + CHECK_MAP_CONTENT(_max, float); + CHECK_MAP_CONTENT(_SF, float); #endif - /// 1) declare TGraphs and Histograms for profile plots if these are to be plotted - // the idea is to produce at the end a table of 8 TMultiGraphs and histograms: - // - 0=Tracker, with color code for the different sublevels - // - 1..6=different sublevels, with color code for z < or > 0 - // - 7=only pixel with color code for BPIX and FPIX - - // (convention: the six first (resp. last) correspond to z>0 (resp. z<0)) - // Modules with bad quality and in a list of modules that is given - // by the user (e.g. list of bad/untouched modules, default: empty list) - // are stored in seperate graphs and might be plotted (depends on the module - // plot option, default: all modules plotted) - // This means that 3*2*6 TGraphs will be filled during the loop on the TTree, - // and will be arranged differently with different color codes in the TMultiGraphs - - // For the profile plots - // Either all modules, only good modules or good modules + those in a given list will be plotted - // This means that 2*6 TH2F will be filled during the loop on the TTree, - // and will be arranged differently with different color codes in the Histograms + /// 1) declare TGraphs and Histograms for profile plots if these are to be plotted + // the idea is to produce at the end a table of 8 TMultiGraphs and histograms: + // - 0=Tracker, with color code for the different sublevels + // - 1..6=different sublevels, with color code for z < or > 0 + // - 7=only pixel with color code for BPIX and FPIX + + // (convention: the six first (resp. last) correspond to z>0 (resp. z<0)) + // Modules with bad quality and in a list of modules that is given + // by the user (e.g. list of bad/untouched modules, default: empty list) + // are stored in seperate graphs and might be plotted (depends on the module + // plot option, default: all modules plotted) + // This means that 3*2*6 TGraphs will be filled during the loop on the TTree, + // and will be arranged differently with different color codes in the TMultiGraphs + + // For the profile plots + // Either all modules, only good modules or good modules + those in a given list will be plotted + // This means that 2*6 TH2F will be filled during the loop on the TTree, + // and will be arranged differently with different color codes in the Histograms #ifndef NB_SUBLEVELS #define NB_SUBLEVELS 6 #endif #define NB_Z_SLICES 2 #define NB_MODULE_QUALITY 3 -#define COLOR_CODE(icolor) int(icolor/4)+icolor+1 - - TGraph * graphs[x.size()][y.size()][NB_SUBLEVELS*NB_Z_SLICES*NB_MODULE_QUALITY]; - long int ipoint[x.size()][y.size()][NB_SUBLEVELS*NB_Z_SLICES*NB_MODULE_QUALITY]; - - TMultiGraph * mgraphs[x.size()][y.size()][2+NB_SUBLEVELS]; // the 0th is for global plots, the 1..6th for sublevel plots, 7th for pixel only - TCanvas * c[x.size()][y.size()][2+NB_SUBLEVELS], - * c_global[2+NB_SUBLEVELS]; - canvas_index++; // this static index is a safety used in case the MakePlots method is used several times to avoid overloading - - // histograms for profile plots, - // 2D-hists to store the data - // 1D-hists to calculate mean and sigma of y-values for each x-bin of the 2D-hists and for the final profile hist - TH2F * histos2D[x.size()][y.size()][NB_SUBLEVELS*NB_Z_SLICES]; - TH1F * histos[x.size()][y.size()][NB_SUBLEVELS*NB_Z_SLICES]; - TH1F * histosYValues[x.size()][y.size()][NB_SUBLEVELS*NB_Z_SLICES]; // Used to calculate the mean and RMS for each x-bin of the 2D-hist - TH1F * histosTracker[x.size()][y.size()][NB_SUBLEVELS*NB_Z_SLICES]; // for the tracker plots all histos are copied to avoid using the same hists in different canvas - - TCanvas * c_hist[x.size()][y.size()][2+NB_SUBLEVELS], * c_global_hist[2+NB_SUBLEVELS]; - - unsigned int nXBins; // Sensible number of x-bins differs depending on the variable - - - - - for (unsigned int ic = 0 ; ic <= NB_SUBLEVELS+1 ; ic++) - { - c_global[ic] = new TCanvas (TString::Format("global_%s_%d", ic==0 ? "tracker" : ( ic==7 ? "pixel" : _sublevel_names[ic-1].Data() ), - canvas_index), - TString::Format("Global overview of the %s variables", ic==0 ? "tracker" : ( ic==7 ? "pixel" : _sublevel_names[ic-1].Data() ) ), - _window_width, - _window_height); - c_global[ic]->Divide(x.size(),y.size()); - - if (_make_profile_plots) { - c_global_hist[ic] = new TCanvas (TString::Format("global_profile_plots_%s_%d", ic==0 ? "tracker" : ( ic==7 ? "pixel" : _sublevel_names[ic-1].Data() ), - canvas_index), - TString::Format("Global overview profile plots of the %s variables", ic==0 ? "tracker" : ( ic==7 ? "pixel" : _sublevel_names[ic-1].Data() ) ), - _window_width, - _window_height); - c_global_hist[ic]->Divide(x.size(),y.size()); - } - - } +#define COLOR_CODE(icolor) int(icolor / 4) + icolor + 1 + + TGraph *graphs[x.size()][y.size()][NB_SUBLEVELS * NB_Z_SLICES * NB_MODULE_QUALITY]; + long int ipoint[x.size()][y.size()][NB_SUBLEVELS * NB_Z_SLICES * NB_MODULE_QUALITY]; + + TMultiGraph + *mgraphs[x.size()][y.size()] + [2 + NB_SUBLEVELS]; // the 0th is for global plots, the 1..6th for sublevel plots, 7th for pixel only + TCanvas *c[x.size()][y.size()][2 + NB_SUBLEVELS], *c_global[2 + NB_SUBLEVELS]; + canvas_index++; // this static index is a safety used in case the MakePlots method is used several times to avoid overloading + + // histograms for profile plots, + // 2D-hists to store the data + // 1D-hists to calculate mean and sigma of y-values for each x-bin of the 2D-hists and for the final profile hist + TH2F *histos2D[x.size()][y.size()][NB_SUBLEVELS * NB_Z_SLICES]; + TH1F *histos[x.size()][y.size()][NB_SUBLEVELS * NB_Z_SLICES]; + TH1F *histosYValues[x.size()][y.size()] + [NB_SUBLEVELS * NB_Z_SLICES]; // Used to calculate the mean and RMS for each x-bin of the 2D-hist + TH1F *histosTracker + [x.size()][y.size()] + [NB_SUBLEVELS * + NB_Z_SLICES]; // for the tracker plots all histos are copied to avoid using the same hists in different canvas + + TCanvas *c_hist[x.size()][y.size()][2 + NB_SUBLEVELS], *c_global_hist[2 + NB_SUBLEVELS]; + + unsigned int nXBins; // Sensible number of x-bins differs depending on the variable + + for (unsigned int ic = 0; ic <= NB_SUBLEVELS + 1; ic++) { + c_global[ic] = new TCanvas( + TString::Format( + "global_%s_%d", ic == 0 ? "tracker" : (ic == 7 ? "pixel" : _sublevel_names[ic - 1].Data()), canvas_index), + TString::Format("Global overview of the %s variables", + ic == 0 ? "tracker" : (ic == 7 ? "pixel" : _sublevel_names[ic - 1].Data())), + _window_width, + _window_height); + c_global[ic]->Divide(x.size(), y.size()); - - for (unsigned int ix = 0 ; ix < x.size() ; ix++) - { - for (unsigned int iy = 0 ; iy < y.size() ; iy++) - { - //if (x[ix] == y[iy]) continue; // do not plot graphs like (r,r) or (phi,phi) - for (unsigned int igraph = 0 ; igraph < NB_SUBLEVELS*NB_Z_SLICES*NB_MODULE_QUALITY ; igraph++) - { - // declaring - ipoint[ix][iy][igraph] = 0; // the purpose of an index for every graph is to avoid thousands of points at the origin of each - graphs[ix][iy][igraph] = new TGraph (); - - graphs[ix][iy][igraph]->SetMarkerColor(COLOR_CODE(igraph)); - graphs[ix][iy][igraph]->SetMarkerStyle(6); - // pimping - graphs[ix][iy][igraph]->SetName (x[ix]+y[iy]+_sublevel_names[igraph%NB_SUBLEVELS] - +TString(igraph%(NB_SUBLEVELS*NB_Z_SLICES)>=NB_SUBLEVELS ? "n" : "p" ) // graphs for negative/positive z - +TString(igraph >= NB_SUBLEVELS*NB_Z_SLICES ? - ( igraph >= 2*NB_SUBLEVELS*NB_Z_SLICES ? "bad" : "list") : "good" ));// graphs for good, bad modules and from a list - graphs[ix][iy][igraph]->SetTitle( _sublevel_names[igraph%NB_SUBLEVELS] - +TString(igraph%(NB_SUBLEVELS*NB_Z_SLICES)>=NB_SUBLEVELS ? " at z<0": " at z>=0") - +TString(igraph >= NB_SUBLEVELS*NB_Z_SLICES ? - ( igraph >= 2*NB_SUBLEVELS*NB_Z_SLICES ? " bad modules" : " in list") : " good modules" ) - + TString (";") + LateXstyle(x[ix]) + " /" + _units[x[ix]] - + TString (";") + LateXstyle(y[iy]) + " /" + _units[y[iy]]); - graphs[ix][iy][igraph]->SetMarkerStyle(igraph >= NB_SUBLEVELS*NB_Z_SLICES ? - ( igraph >= 2*NB_SUBLEVELS*NB_Z_SLICES ? 4 : 5) : 6); // empty circle for bad modules, X for those in list, dot for good ones - } + if (_make_profile_plots) { + c_global_hist[ic] = + new TCanvas(TString::Format("global_profile_plots_%s_%d", + ic == 0 ? "tracker" : (ic == 7 ? "pixel" : _sublevel_names[ic - 1].Data()), + canvas_index), + TString::Format("Global overview profile plots of the %s variables", + ic == 0 ? "tracker" : (ic == 7 ? "pixel" : _sublevel_names[ic - 1].Data())), + _window_width, + _window_height); + c_global_hist[ic]->Divide(x.size(), y.size()); + } + } + + for (unsigned int ix = 0; ix < x.size(); ix++) { + for (unsigned int iy = 0; iy < y.size(); iy++) { + //if (x[ix] == y[iy]) continue; // do not plot graphs like (r,r) or (phi,phi) + for (unsigned int igraph = 0; igraph < NB_SUBLEVELS * NB_Z_SLICES * NB_MODULE_QUALITY; igraph++) { + // declaring + ipoint[ix][iy][igraph] = + 0; // the purpose of an index for every graph is to avoid thousands of points at the origin of each + graphs[ix][iy][igraph] = new TGraph(); + + graphs[ix][iy][igraph]->SetMarkerColor(COLOR_CODE(igraph)); + graphs[ix][iy][igraph]->SetMarkerStyle(6); + // pimping + graphs[ix][iy][igraph]->SetName( + x[ix] + y[iy] + _sublevel_names[igraph % NB_SUBLEVELS] + + TString(igraph % (NB_SUBLEVELS * NB_Z_SLICES) >= NB_SUBLEVELS ? "n" + : "p") // graphs for negative/positive z + + TString(igraph >= NB_SUBLEVELS * NB_Z_SLICES ? (igraph >= 2 * NB_SUBLEVELS * NB_Z_SLICES ? "bad" : "list") + : "good")); // graphs for good, bad modules and from a list + graphs[ix][iy][igraph]->SetTitle( + _sublevel_names[igraph % NB_SUBLEVELS] + + TString(igraph % (NB_SUBLEVELS * NB_Z_SLICES) >= NB_SUBLEVELS ? " at z<0" : " at z>=0") + + TString(igraph >= NB_SUBLEVELS * NB_Z_SLICES + ? (igraph >= 2 * NB_SUBLEVELS * NB_Z_SLICES ? " bad modules" : " in list") + : " good modules") + + TString(";") + LateXstyle(x[ix]) + " /" + _units[x[ix]] + TString(";") + LateXstyle(y[iy]) + " /" + + _units[y[iy]]); + graphs[ix][iy][igraph]->SetMarkerStyle( + igraph >= NB_SUBLEVELS * NB_Z_SLICES + ? (igraph >= 2 * NB_SUBLEVELS * NB_Z_SLICES ? 4 : 5) + : 6); // empty circle for bad modules, X for those in list, dot for good ones + } + } + } + + // Use seperate loop for the profile histograms since we do not produce histograms for the different module qualities + if (_make_profile_plots) { + for (unsigned int ix = 0; ix < x.size(); ix++) { + if (x[ix] == "phi") + nXBins = 10; + else + nXBins = 40; + + for (unsigned int iy = 0; iy < y.size(); iy++) { + for (unsigned int igraph = 0; igraph < NB_SUBLEVELS * NB_Z_SLICES; igraph++) { + // declaring + histos2D[ix][iy][igraph] = + new TH2F("2Dhist" + x[ix] + y[iy] + _sublevel_names[igraph % NB_SUBLEVELS] + + TString(igraph % (NB_SUBLEVELS * NB_Z_SLICES) >= NB_SUBLEVELS ? "n" : "p") + + TString(std::to_string(canvas_index)), + "", + nXBins, + _min[x[ix]], + _max[x[ix]], + 1000, + _min[y[iy]], + _max[y[iy]] + 1.); } + } } - - // Use seperate loop for the profile histograms since we do not produce histograms for the different module qualities - if (_make_profile_plots) { - for (unsigned int ix = 0 ; ix < x.size() ; ix++) - { - if ( x[ix] == "phi") nXBins = 10; - else nXBins = 40; - - for (unsigned int iy = 0 ; iy < y.size() ; iy++) - { - for (unsigned int igraph = 0 ; igraph < NB_SUBLEVELS*NB_Z_SLICES ; igraph++) - { - // declaring - histos2D[ix][iy][igraph] = new TH2F ("2Dhist"+x[ix]+y[iy]+_sublevel_names[igraph%NB_SUBLEVELS] - +TString(igraph%(NB_SUBLEVELS*NB_Z_SLICES)>=NB_SUBLEVELS ? "n" : "p" ) - +std::to_string(canvas_index), - "",nXBins,_min[x[ix]],_max[x[ix]], - 1000,_min[y[iy]],_max[y[iy]]+1.); - } - } - } - } - + } + #ifdef DEBUG - cout << __FILE__ << ":" << __LINE__ << ":Info: Creation of the TGraph[" << x.size() << "][" << y.size() << "][" << NB_SUBLEVELS*NB_Z_SLICES*NB_MODULE_QUALITY << "] ended." << endl; + cout << __FILE__ << ":" << __LINE__ << ":Info: Creation of the TGraph[" << x.size() << "][" << y.size() << "][" + << NB_SUBLEVELS * NB_Z_SLICES * NB_MODULE_QUALITY << "] ended." << endl; #endif - /// 2) loop on the TTree data + /// 2) loop on the TTree data #ifdef DEBUG - cout << __FILE__ << ":" << __LINE__ << ":Info: Looping on the TTree" << endl; + cout << __FILE__ << ":" << __LINE__ << ":Info: Looping on the TTree" << endl; #endif #ifdef TALKATIVE - unsigned int progress = 0; - cout << __FILE__ << ":" << __LINE__ << ":Info: 0%" << endl; + unsigned int progress = 0; + cout << __FILE__ << ":" << __LINE__ << ":Info: 0%" << endl; #endif - for (unsigned int ientry = 0 ; ientry < nentries ; ientry++) - { -#ifdef TALKATIVE - if (10*ientry/nentries != progress) - { - progress = 10*ientry/nentries; - cout << __FILE__ << ":" << __LINE__ << ":Info: " << 10*progress << "%" << endl; - } + for (unsigned int ientry = 0; ientry < nentries; ientry++) { +#ifdef TALKATIVE + if (10 * ientry / nentries != progress) { + progress = 10 * ientry / nentries; + cout << __FILE__ << ":" << __LINE__ << ":Info: " << 10 * progress << "%" << endl; + } #endif - // load current tree entry - data->GetEntry(ientry); - - // CUTS on entry - if (branch_i["level"] != _levelCut) continue; - if (!_1dModule && branch_i["detDim"] == 1) continue; - if (!_2dModule && branch_i["detDim"] == 2) continue; - - // loop on the different couples of variables to plot in a graph - for (unsigned int ix = 0 ; ix < x.size() ; ix++) - { - // CUTS on x[ix] - if (_SF[x[ix]]*branch_f[x[ix]] > _max[x[ix]] || _SF[x[ix]]*branch_f[x[ix]] < _min[x[ix]]) - { -//#ifdef DEBUG -// cout << "branch_f[x[ix]]=" << branch_f[x[ix]] << endl; -//#endif - continue; - } + // load current tree entry + data->GetEntry(ientry); + + // CUTS on entry + if (branch_i["level"] != _levelCut) + continue; + if (!_1dModule && branch_i["detDim"] == 1) + continue; + if (!_2dModule && branch_i["detDim"] == 2) + continue; + + // loop on the different couples of variables to plot in a graph + for (unsigned int ix = 0; ix < x.size(); ix++) { + // CUTS on x[ix] + if (_SF[x[ix]] * branch_f[x[ix]] > _max[x[ix]] || _SF[x[ix]] * branch_f[x[ix]] < _min[x[ix]]) { + //#ifdef DEBUG + // cout << "branch_f[x[ix]]=" << branch_f[x[ix]] << endl; + //#endif + continue; + } + + for (unsigned int iy = 0; iy < y.size(); iy++) { + // CUTS on y[iy] + //if (x[ix] == y[iy]) continue; // TO DO: handle display when such a case occurs + if (branch_i["sublevel"] < 1 || branch_i["sublevel"] > NB_SUBLEVELS) + continue; + + // FILLING histograms take even those outside the plotted range into account + if (_make_profile_plots) { + if (_module_plot_option == "all") { + const short int igraph = (branch_i["sublevel"] - 1) + (branch_f["z"] >= 0 ? 0 : NB_SUBLEVELS); + histos2D[ix][iy][igraph]->Fill(_SF[x[ix]] * branch_f[x[ix]], _SF[y[iy]] * branch_f[y[iy]]); + } else if (_module_plot_option == "good" && branch_i["badModuleQuality"] == 0) { + const short int igraph = (branch_i["sublevel"] - 1) + (branch_f["z"] >= 0 ? 0 : NB_SUBLEVELS); + histos2D[ix][iy][igraph]->Fill(_SF[x[ix]] * branch_f[x[ix]], _SF[y[iy]] * branch_f[y[iy]]); + } else if (_module_plot_option == "list" && + (branch_i["inModuleList"] == 1 || branch_i["badModuleQuality"] == 0)) { + const short int igraph = (branch_i["sublevel"] - 1) + (branch_f["z"] >= 0 ? 0 : NB_SUBLEVELS); + histos2D[ix][iy][igraph]->Fill(_SF[x[ix]] * branch_f[x[ix]], _SF[y[iy]] * branch_f[y[iy]]); + } + } - for (unsigned int iy = 0 ; iy < y.size() ; iy++) - { - // CUTS on y[iy] - //if (x[ix] == y[iy]) continue; // TO DO: handle display when such a case occurs - if (branch_i["sublevel"] < 1 || branch_i["sublevel"] > NB_SUBLEVELS) continue; - - // FILLING histograms take even those outside the plotted range into account - if (_make_profile_plots) { - if (_module_plot_option == "all"){ - const short int igraph = (branch_i["sublevel"]-1) - + (branch_f["z"]>=0?0:NB_SUBLEVELS); - histos2D[ix][iy][igraph]->Fill(_SF[x[ix]]*branch_f[x[ix]], - _SF[y[iy]]*branch_f[y[iy]]); - } - else if (_module_plot_option == "good" && branch_i["badModuleQuality"]==0 ){ - const short int igraph = (branch_i["sublevel"]-1) - + (branch_f["z"]>=0?0:NB_SUBLEVELS); - histos2D[ix][iy][igraph]->Fill(_SF[x[ix]]*branch_f[x[ix]], - _SF[y[iy]]*branch_f[y[iy]]); - } - else if (_module_plot_option == "list" && (branch_i["inModuleList"]==1 || branch_i["badModuleQuality"]==0) ){ - const short int igraph = (branch_i["sublevel"]-1) - + (branch_f["z"]>=0?0:NB_SUBLEVELS); - histos2D[ix][iy][igraph]->Fill(_SF[x[ix]]*branch_f[x[ix]], - _SF[y[iy]]*branch_f[y[iy]]); - } - } - - // restrict scatter plots to chosen range - if (_SF[y[iy]]*branch_f[y[iy]] > _max[y[iy]] || _SF[y[iy]]*branch_f[y[iy]] < _min[y[iy]]) - { -//#ifdef DEBUG -// cout << "branch_f[y[iy]]=" << branch_f[y[iy]] << endl; -//#endif - continue; - } - - // FILLING GRAPH - if (y.size() >= x.size()){ - if (branch_i["inModuleList"]==0 && branch_i["badModuleQuality"]==0 ){ - const short int igraph = (branch_i["sublevel"]-1) - + (branch_f["z"]>=0?0:NB_SUBLEVELS); - graphs[ix][iy][igraph]->SetPoint(ipoint[ix][iy][igraph], - _SF[x[ix]]*branch_f[x[ix]], - _SF[y[iy]]*branch_f[y[iy]]); - ipoint[ix][iy][igraph]++; - } - if (branch_i["inModuleList"]>0){ - const short int igraph = (branch_i["sublevel"]-1) - + (branch_f["z"]>=0?0:NB_SUBLEVELS) - + NB_SUBLEVELS*NB_Z_SLICES; - graphs[ix][iy][igraph]->SetPoint(ipoint[ix][iy][igraph], - _SF[x[ix]]*branch_f[x[ix]], - _SF[y[iy]]*branch_f[y[iy]]); - ipoint[ix][iy][igraph]++; - } - if (branch_i["badModuleQuality"]>0){ - const short int igraph = (branch_i["sublevel"]-1) - + (branch_f["z"]>=0?0:NB_SUBLEVELS) - + 2*NB_SUBLEVELS*NB_Z_SLICES; - graphs[ix][iy][igraph]->SetPoint(ipoint[ix][iy][igraph], - _SF[x[ix]]*branch_f[x[ix]], - _SF[y[iy]]*branch_f[y[iy]]); - ipoint[ix][iy][igraph]++; - } - } - else{ - if (branch_i["inModuleList"]==0 && branch_i["badModuleQuality"]==0 ){ - const short int igraph = (branch_i["sublevel"]-1) - + (branch_f["z"]>=0?0:NB_SUBLEVELS); - graphs[iy][ix][igraph]->SetPoint(ipoint[iy][ix][igraph], - _SF[x[ix]]*branch_f[x[ix]], - _SF[y[iy]]*branch_f[y[iy]]); - ipoint[iy][ix][igraph]++; - } - if (branch_i["inModuleList"]>0){ - const short int igraph = (branch_i["sublevel"]-1) - + (branch_f["z"]>=0?0:NB_SUBLEVELS) - + NB_SUBLEVELS*NB_Z_SLICES; - graphs[iy][ix][igraph]->SetPoint(ipoint[iy][ix][igraph], - _SF[x[ix]]*branch_f[x[ix]], - _SF[y[iy]]*branch_f[y[iy]]); - ipoint[iy][ix][igraph]++; - } - if (branch_i["badModuleQuality"]>0){ - const short int igraph = (branch_i["sublevel"]-1) - + (branch_f["z"]>=0?0:NB_SUBLEVELS) - + 2*NB_SUBLEVELS*NB_Z_SLICES; - graphs[iy][ix][igraph]->SetPoint(ipoint[ix][iy][igraph], - _SF[x[ix]]*branch_f[x[ix]], - _SF[y[iy]]*branch_f[y[iy]]); - ipoint[iy][ix][igraph]++; - } - } - } + // restrict scatter plots to chosen range + if (_SF[y[iy]] * branch_f[y[iy]] > _max[y[iy]] || _SF[y[iy]] * branch_f[y[iy]] < _min[y[iy]]) { + //#ifdef DEBUG + // cout << "branch_f[y[iy]]=" << branch_f[y[iy]] << endl; + //#endif + continue; } + + // FILLING GRAPH + if (y.size() >= x.size()) { + if (branch_i["inModuleList"] == 0 && branch_i["badModuleQuality"] == 0) { + const short int igraph = (branch_i["sublevel"] - 1) + (branch_f["z"] >= 0 ? 0 : NB_SUBLEVELS); + graphs[ix][iy][igraph]->SetPoint( + ipoint[ix][iy][igraph], _SF[x[ix]] * branch_f[x[ix]], _SF[y[iy]] * branch_f[y[iy]]); + ipoint[ix][iy][igraph]++; + } + if (branch_i["inModuleList"] > 0) { + const short int igraph = + (branch_i["sublevel"] - 1) + (branch_f["z"] >= 0 ? 0 : NB_SUBLEVELS) + NB_SUBLEVELS * NB_Z_SLICES; + graphs[ix][iy][igraph]->SetPoint( + ipoint[ix][iy][igraph], _SF[x[ix]] * branch_f[x[ix]], _SF[y[iy]] * branch_f[y[iy]]); + ipoint[ix][iy][igraph]++; + } + if (branch_i["badModuleQuality"] > 0) { + const short int igraph = + (branch_i["sublevel"] - 1) + (branch_f["z"] >= 0 ? 0 : NB_SUBLEVELS) + 2 * NB_SUBLEVELS * NB_Z_SLICES; + graphs[ix][iy][igraph]->SetPoint( + ipoint[ix][iy][igraph], _SF[x[ix]] * branch_f[x[ix]], _SF[y[iy]] * branch_f[y[iy]]); + ipoint[ix][iy][igraph]++; + } + } else { + if (branch_i["inModuleList"] == 0 && branch_i["badModuleQuality"] == 0) { + const short int igraph = (branch_i["sublevel"] - 1) + (branch_f["z"] >= 0 ? 0 : NB_SUBLEVELS); + graphs[iy][ix][igraph]->SetPoint( + ipoint[iy][ix][igraph], _SF[x[ix]] * branch_f[x[ix]], _SF[y[iy]] * branch_f[y[iy]]); + ipoint[iy][ix][igraph]++; + } + if (branch_i["inModuleList"] > 0) { + const short int igraph = + (branch_i["sublevel"] - 1) + (branch_f["z"] >= 0 ? 0 : NB_SUBLEVELS) + NB_SUBLEVELS * NB_Z_SLICES; + graphs[iy][ix][igraph]->SetPoint( + ipoint[iy][ix][igraph], _SF[x[ix]] * branch_f[x[ix]], _SF[y[iy]] * branch_f[y[iy]]); + ipoint[iy][ix][igraph]++; + } + if (branch_i["badModuleQuality"] > 0) { + const short int igraph = + (branch_i["sublevel"] - 1) + (branch_f["z"] >= 0 ? 0 : NB_SUBLEVELS) + 2 * NB_SUBLEVELS * NB_Z_SLICES; + graphs[iy][ix][igraph]->SetPoint( + ipoint[ix][iy][igraph], _SF[x[ix]] * branch_f[x[ix]], _SF[y[iy]] * branch_f[y[iy]]); + ipoint[iy][ix][igraph]++; + } + } + } } + } #ifdef TALKATIVE - cout << __FILE__ << ":" << __LINE__ << ":Info: 100%\tLoop ended" << endl; + cout << __FILE__ << ":" << __LINE__ << ":Info: 100%\tLoop ended" << endl; #endif - /// 3) merge TGraph objects into TMultiGraph objects, then draw, print and write (according to the options _batchMode, _print and _write respectively) - gROOT->SetBatch(_batchMode); // if true, then equivalent to "root -b", i.e. no canvas - if (_write) - { // opening the file to write the graphs - output = new TFile(_output_directory+TString(_output_filename), "UPDATE"); // possibly existing file will be updated, otherwise created - if (output->IsZombie()) - { - cout << __FILE__ << ":" << __LINE__ << ":Error: Opening of " << _output_directory+TString(_output_filename) << " failed" << endl; - exit(-1); - } + /// 3) merge TGraph objects into TMultiGraph objects, then draw, print and write (according to the options _batchMode, _print and _write respectively) + gROOT->SetBatch(_batchMode); // if true, then equivalent to "root -b", i.e. no canvas + if (_write) { // opening the file to write the graphs + output = new TFile(_output_directory + TString(_output_filename), + "UPDATE"); // possibly existing file will be updated, otherwise created + if (output->IsZombie()) { + cout << __FILE__ << ":" << __LINE__ << ":Error: Opening of " << _output_directory + TString(_output_filename) + << " failed" << endl; + exit(-1); + } #ifdef TALKATIVE - cout << __FILE__ << ":"<< __LINE__ << ":Info: output file is " << _output_directory+TString(_output_filename) << endl; + cout << __FILE__ << ":" << __LINE__ << ":Info: output file is " << _output_directory + TString(_output_filename) + << endl; #endif - } - // declaring TMultiGraphs and TCanvas - // Usually more y variables than x variables - // creating TLegend - TLegend * legend = MakeLegend(.1,.92,.9,1.,NB_SUBLEVELS); - if (_write) legend->Write(); - - // check which modules are supposed to be plotted - unsigned int n_module_types = 1; - if (_module_plot_option == "all"){ - n_module_types = 3; //plot all modules (good, list and bad ) - } - else if (_module_plot_option == "list"){ - n_module_types = 2; // plot good modules and those in the list - } - else if (_module_plot_option == "good"){ - n_module_types = 1; // only plot the modules that are neither bad or in the list - } - - -#define INDEX_IN_GLOBAL_CANVAS(i1,i2) 1 + i1 + i2*x.size() - // running on the TGraphs to produce the TMultiGraph and draw/print them - for (unsigned int ix = 0 ; ix < x.size() ; ix++) - { + } + // declaring TMultiGraphs and TCanvas + // Usually more y variables than x variables + // creating TLegend + TLegend *legend = MakeLegend(.1, .92, .9, 1., NB_SUBLEVELS); + if (_write) + legend->Write(); + + // check which modules are supposed to be plotted + unsigned int n_module_types = 1; + if (_module_plot_option == "all") { + n_module_types = 3; //plot all modules (good, list and bad ) + } else if (_module_plot_option == "list") { + n_module_types = 2; // plot good modules and those in the list + } else if (_module_plot_option == "good") { + n_module_types = 1; // only plot the modules that are neither bad or in the list + } + +#define INDEX_IN_GLOBAL_CANVAS(i1, i2) 1 + i1 + i2 *x.size() + // running on the TGraphs to produce the TMultiGraph and draw/print them + for (unsigned int ix = 0; ix < x.size(); ix++) { #ifdef DEBUG - cout << __FILE__ << ":" << __LINE__ << ":Info: x[" << ix << "]="<< x[ix] << endl; + cout << __FILE__ << ":" << __LINE__ << ":Info: x[" << ix << "]=" << x[ix] << endl; #endif - // looping on Y axes - for (unsigned int iy = 0 ; iy < y.size() ; iy++) - { - - + // looping on Y axes + for (unsigned int iy = 0; iy < y.size(); iy++) { #ifdef DEBUG - cout << __FILE__ << ":" << __LINE__ << ":Info: x[" << ix << "]=" << x[ix] - << " and y[" << iy << "]=" << y[iy] - << "\t-> creating TMultiGraph" << endl; + cout << __FILE__ << ":" << __LINE__ << ":Info: x[" << ix << "]=" << x[ix] << " and y[" << iy << "]=" << y[iy] + << "\t-> creating TMultiGraph" << endl; #endif - mgraphs[ix][iy][0] = new TMultiGraph (TString::Format("mgr_%s_vs_%s_tracker_%d", x[ix].Data(), - y[iy].Data(), - canvas_index), // name - //LateXstyle(x[ix]) + TString(" vs. ") + LateXstyle(y[iy]) + TString(" for Tracker") // graph title - TString (";") + LateXstyle(x[ix]) + " /" + _units[x[ix]] // x axis title - + TString (";") + LateXstyle(y[iy]) + " /" + _units[y[iy]]); // y axis title - - mgraphs[ix][iy][7] = new TMultiGraph (TString::Format("mgr_%s_vs_%s_pixel_%d", x[ix].Data(), - y[iy].Data(), - canvas_index), // name - //LateXstyle(x[ix]) + TString(" vs. ") + LateXstyle(y[iy]) + TString(" for Tracker") // graph title - TString (";") + LateXstyle(x[ix]) + " /" + _units[x[ix]] // x axis title - + TString (";") + LateXstyle(y[iy]) + " /" + _units[y[iy]]); // y axis title - - /// TRACKER and PIXEL - // fixing ranges and filling TMultiGraph - // for (unsigned short int jgraph = NB_SUBLEVELS*NB_Z_SLICES-1 ; jgraph >= 0 ; --jgraph) - for (unsigned short int jgraph = 0 ; jgraph < NB_SUBLEVELS*NB_Z_SLICES*n_module_types ; jgraph++) - { - unsigned short int igraph = NB_SUBLEVELS*NB_Z_SLICES*n_module_types - jgraph - 1; // reverse counting for humane readability (one of the sublevel takes much more place than the others) + mgraphs[ix][iy][0] = new TMultiGraph( + TString::Format("mgr_%s_vs_%s_tracker_%d", + x[ix].Data(), + y[iy].Data(), + canvas_index), // name + //LateXstyle(x[ix]) + TString(" vs. ") + LateXstyle(y[iy]) + TString(" for Tracker") // graph title + TString(";") + LateXstyle(x[ix]) + " /" + _units[x[ix]] // x axis title + + TString(";") + LateXstyle(y[iy]) + " /" + _units[y[iy]]); // y axis title + + mgraphs[ix][iy][7] = new TMultiGraph( + TString::Format("mgr_%s_vs_%s_pixel_%d", + x[ix].Data(), + y[iy].Data(), + canvas_index), // name + //LateXstyle(x[ix]) + TString(" vs. ") + LateXstyle(y[iy]) + TString(" for Tracker") // graph title + TString(";") + LateXstyle(x[ix]) + " /" + _units[x[ix]] // x axis title + + TString(";") + LateXstyle(y[iy]) + " /" + _units[y[iy]]); // y axis title + + /// TRACKER and PIXEL + // fixing ranges and filling TMultiGraph + // for (unsigned short int jgraph = NB_SUBLEVELS*NB_Z_SLICES-1 ; jgraph >= 0 ; --jgraph) + for (unsigned short int jgraph = 0; jgraph < NB_SUBLEVELS * NB_Z_SLICES * n_module_types; jgraph++) { + unsigned short int igraph = + NB_SUBLEVELS * NB_Z_SLICES * n_module_types - jgraph - + 1; // reverse counting for humane readability (one of the sublevel takes much more place than the others) #ifdef DEBUG - cout << __FILE__ << ":" << __LINE__ << ":Info: writing TGraph to file" << endl; + cout << __FILE__ << ":" << __LINE__ << ":Info: writing TGraph to file" << endl; #endif - // write into root file - if (_write) graphs[ix][iy][igraph]->Write(); - if (graphs[ix][iy][igraph]->GetN() == 0) - { + // write into root file + if (_write) + graphs[ix][iy][igraph]->Write(); + if (graphs[ix][iy][igraph]->GetN() == 0) { #ifdef TALKATIVE - cout << __FILE__ << ":" << __LINE__ << ":Info: " << graphs[ix][iy][igraph]->GetName() << " is empty." << endl; + cout << __FILE__ << ":" << __LINE__ << ":Info: " << graphs[ix][iy][igraph]->GetName() << " is empty." << endl; #endif - continue; - } + continue; + } #ifdef DEBUG - cout << __FILE__ << ":" << __LINE__ << ":Info: cloning, coloring and adding TGraph " - << _sublevel_names[igraph%NB_SUBLEVELS] - << (igraph >= NB_SUBLEVELS ? "(z<0)" : "(z>0)") - << " to global TMultiGraph" << endl; + cout << __FILE__ << ":" << __LINE__ << ":Info: cloning, coloring and adding TGraph " + << _sublevel_names[igraph % NB_SUBLEVELS] << (igraph >= NB_SUBLEVELS ? "(z<0)" : "(z>0)") + << " to global TMultiGraph" << endl; #endif - // clone to prevent any injure on the graph - TGraph * gr = (TGraph *) graphs[ix][iy][igraph]->Clone(); - // color - gr->SetMarkerColor(COLOR_CODE(igraph%NB_SUBLEVELS)); - mgraphs[ix][iy][0]->Add(gr, "P");//, (mgraphs[ix][iy][0]->GetListOfGraphs()==0?"AP":"P")); - - if (igraph%NB_SUBLEVELS == 0 || igraph%NB_SUBLEVELS == 1) mgraphs[ix][iy][7]->Add(gr, "P"); // Add BPIX (0) and FPIX (1) to pixel plot - - } - - /// SUBLEVELS (1..6) - for (unsigned int isublevel = 1 ; isublevel <= NB_SUBLEVELS ; isublevel++) - { + // clone to prevent any injure on the graph + TGraph *gr = (TGraph *)graphs[ix][iy][igraph]->Clone(); + // color + gr->SetMarkerColor(COLOR_CODE(igraph % NB_SUBLEVELS)); + mgraphs[ix][iy][0]->Add(gr, "P"); //, (mgraphs[ix][iy][0]->GetListOfGraphs()==0?"AP":"P")); + + if (igraph % NB_SUBLEVELS == 0 || igraph % NB_SUBLEVELS == 1) + mgraphs[ix][iy][7]->Add(gr, "P"); // Add BPIX (0) and FPIX (1) to pixel plot + } + + /// SUBLEVELS (1..6) + for (unsigned int isublevel = 1; isublevel <= NB_SUBLEVELS; isublevel++) { #ifdef DEBUG - cout << __FILE__ << ":" << __LINE__ << ":Info: cloning, coloring and adding TGraph " - << _sublevel_names[isublevel-1] << " to sublevel TMultiGraph" << endl; + cout << __FILE__ << ":" << __LINE__ << ":Info: cloning, coloring and adding TGraph " + << _sublevel_names[isublevel - 1] << " to sublevel TMultiGraph" << endl; #endif - mgraphs[ix][iy][isublevel] = new TMultiGraph (TString::Format("%s_vs_%s_%s_%d", x[ix].Data(), - y[iy].Data(), - _sublevel_names[isublevel-1].Data(), - canvas_index), // name - //LateXstyle(x[ix]) + TString(" vs. ") + LateXstyle(y[iy]) + TString(" for ") + - _sublevel_names[isublevel-1] // graph title - + TString (";") + LateXstyle(x[ix]) + " /" + _units[x[ix]] // x axis title - + TString (";") + LateXstyle(y[iy]) + " /" + _units[y[iy]]); // y axis title - - graphs[ix][iy][ isublevel-1]->SetMarkerColor(kBlack); - graphs[ix][iy][NB_SUBLEVELS+isublevel-1]->SetMarkerColor(kRed); - graphs[ix][iy][2*NB_SUBLEVELS+isublevel-1]->SetMarkerColor(kGray+1); - graphs[ix][iy][3*NB_SUBLEVELS+isublevel-1]->SetMarkerColor(kRed-7); - graphs[ix][iy][4*NB_SUBLEVELS+isublevel-1]->SetMarkerColor(kGray+1); - graphs[ix][iy][5*NB_SUBLEVELS+isublevel-1]->SetMarkerColor(kRed-7); - if (graphs[ix][iy][ isublevel-1]->GetN() > 0) mgraphs[ix][iy][isublevel]->Add(graphs[ix][iy][ isublevel-1], "P"); //(mgraphs[ix][iy][isublevel-1]->GetListOfGraphs()==0?"AP":"P")); // z>0 + mgraphs[ix][iy][isublevel] = + new TMultiGraph(TString::Format("%s_vs_%s_%s_%d", + x[ix].Data(), + y[iy].Data(), + _sublevel_names[isublevel - 1].Data(), + canvas_index), // name + //LateXstyle(x[ix]) + TString(" vs. ") + LateXstyle(y[iy]) + TString(" for ") + + _sublevel_names[isublevel - 1] // graph title + + TString(";") + LateXstyle(x[ix]) + " /" + _units[x[ix]] // x axis title + + TString(";") + LateXstyle(y[iy]) + " /" + _units[y[iy]]); // y axis title + + graphs[ix][iy][isublevel - 1]->SetMarkerColor(kBlack); + graphs[ix][iy][NB_SUBLEVELS + isublevel - 1]->SetMarkerColor(kRed); + graphs[ix][iy][2 * NB_SUBLEVELS + isublevel - 1]->SetMarkerColor(kGray + 1); + graphs[ix][iy][3 * NB_SUBLEVELS + isublevel - 1]->SetMarkerColor(kRed - 7); + graphs[ix][iy][4 * NB_SUBLEVELS + isublevel - 1]->SetMarkerColor(kGray + 1); + graphs[ix][iy][5 * NB_SUBLEVELS + isublevel - 1]->SetMarkerColor(kRed - 7); + if (graphs[ix][iy][isublevel - 1]->GetN() > 0) + mgraphs[ix][iy][isublevel]->Add( + graphs[ix][iy][isublevel - 1], + "P"); //(mgraphs[ix][iy][isublevel-1]->GetListOfGraphs()==0?"AP":"P")); // z>0 #ifdef TALKATIVE - else cout << __FILE__ << ":" << __LINE__ << ":Info: graphs[ix][iy][isublevel-1]=" << graphs[ix][iy][isublevel-1]->GetName() << " is empty -> not added into " << mgraphs[ix][iy][isublevel]->GetName() << endl; + else + cout << __FILE__ << ":" << __LINE__ + << ":Info: graphs[ix][iy][isublevel-1]=" << graphs[ix][iy][isublevel - 1]->GetName() + << " is empty -> not added into " << mgraphs[ix][iy][isublevel]->GetName() << endl; #endif - if (graphs[ix][iy][NB_SUBLEVELS+isublevel-1]->GetN() > 0) mgraphs[ix][iy][isublevel]->Add(graphs[ix][iy][NB_SUBLEVELS+isublevel-1], "P"); //(mgraphs[ix][iy][isublevel-1]->GetListOfGraphs()==0?"AP":"P")); // z<0 + if (graphs[ix][iy][NB_SUBLEVELS + isublevel - 1]->GetN() > 0) + mgraphs[ix][iy][isublevel]->Add( + graphs[ix][iy][NB_SUBLEVELS + isublevel - 1], + "P"); //(mgraphs[ix][iy][isublevel-1]->GetListOfGraphs()==0?"AP":"P")); // z<0 #ifdef TALKATIVE - else cout << __FILE__ << ":" << __LINE__ << ":Info: graphs[ix][iy][NB_SUBLEVEL+isublevel-1]=" << graphs[ix][iy][NB_Z_SLICES+isublevel-1]->GetName() << " is empty -> not added into " << mgraphs[ix][iy][isublevel]->GetName() << endl; + else + cout << __FILE__ << ":" << __LINE__ << ":Info: graphs[ix][iy][NB_SUBLEVEL+isublevel-1]=" + << graphs[ix][iy][NB_Z_SLICES + isublevel - 1]->GetName() << " is empty -> not added into " + << mgraphs[ix][iy][isublevel]->GetName() << endl; #endif -#if NB_Z_SLICES!=2 - cout << __FILE__ << ":" << __LINE__ << ":Error: color code incomplete for Z slices..." << endl; +#if NB_Z_SLICES != 2 + cout << __FILE__ << ":" << __LINE__ << ":Error: color code incomplete for Z slices..." << endl; #endif - if (_module_plot_option == "all"){ - if (graphs[ix][iy][2*NB_SUBLEVELS+isublevel-1]->GetN() > 0) mgraphs[ix][iy][isublevel]->Add(graphs[ix][iy][2*NB_SUBLEVELS+isublevel-1], "P"); - if (graphs[ix][iy][3*NB_SUBLEVELS+isublevel-1]->GetN() > 0) mgraphs[ix][iy][isublevel]->Add(graphs[ix][iy][3*NB_SUBLEVELS+isublevel-1], "P"); - if (graphs[ix][iy][4*NB_SUBLEVELS+isublevel-1]->GetN() > 0) mgraphs[ix][iy][isublevel]->Add(graphs[ix][iy][4*NB_SUBLEVELS+isublevel-1], "P"); - if (graphs[ix][iy][5*NB_SUBLEVELS+isublevel-1]->GetN() > 0) mgraphs[ix][iy][isublevel]->Add(graphs[ix][iy][5*NB_SUBLEVELS+isublevel-1], "P"); - } - if (_module_plot_option == "list"){ - if (graphs[ix][iy][2*NB_SUBLEVELS+isublevel-1]->GetN() > 0) mgraphs[ix][iy][isublevel]->Add(graphs[ix][iy][2*NB_SUBLEVELS+isublevel-1], "P"); - if (graphs[ix][iy][3*NB_SUBLEVELS+isublevel-1]->GetN() > 0) mgraphs[ix][iy][isublevel]->Add(graphs[ix][iy][3*NB_SUBLEVELS+isublevel-1], "P"); - } - } - + if (_module_plot_option == "all") { + if (graphs[ix][iy][2 * NB_SUBLEVELS + isublevel - 1]->GetN() > 0) + mgraphs[ix][iy][isublevel]->Add(graphs[ix][iy][2 * NB_SUBLEVELS + isublevel - 1], "P"); + if (graphs[ix][iy][3 * NB_SUBLEVELS + isublevel - 1]->GetN() > 0) + mgraphs[ix][iy][isublevel]->Add(graphs[ix][iy][3 * NB_SUBLEVELS + isublevel - 1], "P"); + if (graphs[ix][iy][4 * NB_SUBLEVELS + isublevel - 1]->GetN() > 0) + mgraphs[ix][iy][isublevel]->Add(graphs[ix][iy][4 * NB_SUBLEVELS + isublevel - 1], "P"); + if (graphs[ix][iy][5 * NB_SUBLEVELS + isublevel - 1]->GetN() > 0) + mgraphs[ix][iy][isublevel]->Add(graphs[ix][iy][5 * NB_SUBLEVELS + isublevel - 1], "P"); + } + if (_module_plot_option == "list") { + if (graphs[ix][iy][2 * NB_SUBLEVELS + isublevel - 1]->GetN() > 0) + mgraphs[ix][iy][isublevel]->Add(graphs[ix][iy][2 * NB_SUBLEVELS + isublevel - 1], "P"); + if (graphs[ix][iy][3 * NB_SUBLEVELS + isublevel - 1]->GetN() > 0) + mgraphs[ix][iy][isublevel]->Add(graphs[ix][iy][3 * NB_SUBLEVELS + isublevel - 1], "P"); + } + } - // fixing ranges, saving, and drawing of TMultiGraph (tracker AND sublevels AND pixel, i.e. 2+NB_SUBLEVELS objects) - // the individual canvases are saved, but the global are just drawn and will be saved later - for (unsigned short int imgr = 0 ; imgr <= NB_SUBLEVELS+1 ; imgr++) - { + // fixing ranges, saving, and drawing of TMultiGraph (tracker AND sublevels AND pixel, i.e. 2+NB_SUBLEVELS objects) + // the individual canvases are saved, but the global are just drawn and will be saved later + for (unsigned short int imgr = 0; imgr <= NB_SUBLEVELS + 1; imgr++) { #ifdef DEBUG - cout << __FILE__ << ":" << __LINE__ << ":Info: treating individual canvases." << endl; + cout << __FILE__ << ":" << __LINE__ << ":Info: treating individual canvases." << endl; #endif - // drawing into individual canvas and printing it (including a legend for the tracker canvas) - c[ix][iy][imgr] = new TCanvas (TString::Format("c_%s_vs_%s_%s_%d", x[ix].Data(), - y[iy].Data(), - imgr==0 ? "tracker" : ( imgr==7 ? "pixel" : _sublevel_names[imgr-1].Data() ), - canvas_index), - TString::Format("%s vs. %s at %s level", x[ix].Data(), - y[iy].Data(), - imgr==0 ? "tracker" : ( imgr==7 ? "pixel" : _sublevel_names[imgr-1].Data() ) ), - _window_width, - _window_height); - c[ix][iy][imgr]->SetGrid(_grid_x,_grid_y); // grid - - if (mgraphs[ix][iy][imgr]->GetListOfGraphs() != 0) { - if (dyMin[iy] != -99999) { - mgraphs[ix][iy][imgr]->SetMinimum(dyMin[iy]); - } - if (dyMax[iy] != -99999) { - mgraphs[ix][iy][imgr]->SetMaximum(dyMax[iy]); - } - mgraphs[ix][iy][imgr]->Draw("A"); - } - if (imgr == 0 && _legend) legend->Draw(); // only for the tracker - if (_print && !_print_only_global) c[ix][iy][imgr]->Print(_output_directory + mgraphs[ix][iy][imgr]->GetName() + ExtensionFromPrintOption(_print_option), _print_option); - - // writing into root file - if (_write) mgraphs[ix][iy][imgr]->Write(); - - // drawing into global canvas - c_global[imgr]->cd(INDEX_IN_GLOBAL_CANVAS(ix,iy)); - c_global[imgr]->GetPad(INDEX_IN_GLOBAL_CANVAS(ix,iy))->SetFillStyle(4000); // make the pad transparent - c_global[imgr]->GetPad(INDEX_IN_GLOBAL_CANVAS(ix,iy))->SetGrid(_grid_x,_grid_y); // grid - if (mgraphs[ix][iy][imgr]->GetListOfGraphs() != 0) { - if (dyMin[iy] != -99999) { - mgraphs[ix][iy][imgr]->SetMinimum(dyMin[iy]); - } - if (dyMax[iy] != -99999) { - mgraphs[ix][iy][imgr]->SetMaximum(dyMax[iy]); - } - mgraphs[ix][iy][imgr]->Draw("A"); - } - // printing will be performed after customisation (e.g. legend or title) just after the loops on ix and iy + // drawing into individual canvas and printing it (including a legend for the tracker canvas) + c[ix][iy][imgr] = new TCanvas( + TString::Format("c_%s_vs_%s_%s_%d", + x[ix].Data(), + y[iy].Data(), + imgr == 0 ? "tracker" : (imgr == 7 ? "pixel" : _sublevel_names[imgr - 1].Data()), + canvas_index), + TString::Format("%s vs. %s at %s level", + x[ix].Data(), + y[iy].Data(), + imgr == 0 ? "tracker" : (imgr == 7 ? "pixel" : _sublevel_names[imgr - 1].Data())), + _window_width, + _window_height); + c[ix][iy][imgr]->SetGrid(_grid_x, _grid_y); // grid + + if (mgraphs[ix][iy][imgr]->GetListOfGraphs() != 0) { + if (dyMin[iy] != -99999) { + mgraphs[ix][iy][imgr]->SetMinimum(dyMin[iy]); + } + if (dyMax[iy] != -99999) { + mgraphs[ix][iy][imgr]->SetMaximum(dyMax[iy]); + } + mgraphs[ix][iy][imgr]->Draw("A"); + } + if (imgr == 0 && _legend) + legend->Draw(); // only for the tracker + if (_print && !_print_only_global) + c[ix][iy][imgr]->Print( + _output_directory + mgraphs[ix][iy][imgr]->GetName() + ExtensionFromPrintOption(_print_option), + _print_option); + + // writing into root file + if (_write) + mgraphs[ix][iy][imgr]->Write(); + + // drawing into global canvas + c_global[imgr]->cd(INDEX_IN_GLOBAL_CANVAS(ix, iy)); + c_global[imgr]->GetPad(INDEX_IN_GLOBAL_CANVAS(ix, iy))->SetFillStyle(4000); // make the pad transparent + c_global[imgr]->GetPad(INDEX_IN_GLOBAL_CANVAS(ix, iy))->SetGrid(_grid_x, _grid_y); // grid + if (mgraphs[ix][iy][imgr]->GetListOfGraphs() != 0) { + if (dyMin[iy] != -99999) { + mgraphs[ix][iy][imgr]->SetMinimum(dyMin[iy]); + } + if (dyMax[iy] != -99999) { + mgraphs[ix][iy][imgr]->SetMaximum(dyMax[iy]); + } + mgraphs[ix][iy][imgr]->Draw("A"); + } + // printing will be performed after customisation (e.g. legend or title) just after the loops on ix and iy + } + } // end of loop on y + } // end of loop on x + + // CUSTOMISATION + gStyle->SetOptTitle(0); // otherwise, the title is repeated in every pad of the global canvases + // -> instead, we will write it in the upper part in a TPaveText or in a TLegend + for (unsigned int ic = 0; ic <= NB_SUBLEVELS + 1; ic++) { + c_global[ic]->Draw(); + + // setting legend to tracker canvases + if (!_legend) + break; + TCanvas *c_temp = (TCanvas *)c_global[ic]->Clone(c_global[ic]->GetTitle() + TString("_sub")); + c_temp->Draw(); + c_global[ic] = new TCanvas( + c_temp->GetName() + TString("_final"), c_temp->GetTitle(), c_temp->GetWindowWidth(), c_temp->GetWindowHeight()); + c_global[ic]->Draw(); + TPad *p_up = new TPad(TString("legend_") + c_temp->GetName(), + "", + 0., + 0.9, + 1., + 1., // relative position + -1, + 0, + 0), // display options + *p_down = new TPad(TString("main_") + c_temp->GetName(), "", 0., 0., 1., 0.9, -1, 0, 0); + // in the lower part, draw the plots + p_down->Draw(); + p_down->cd(); + c_temp->DrawClonePad(); + c_global[ic]->cd(); + // in the upper part, pimp the canvas :p + p_up->Draw(); + p_up->cd(); + if (ic == 0) // tracker + { + TLegend *global_legend = MakeLegend(.05, .1, .7, .8, NB_SUBLEVELS); //, "brNDC"); + global_legend->Draw(); + TPaveText *pt_geom = new TPaveText(.75, .1, .95, .8, "NB"); + pt_geom->SetFillColor(0); + pt_geom->SetTextSize(0.25); + pt_geom->AddText(TString("x: ") + _reference_name); + pt_geom->AddText(TString("y: ") + _alignment_name + TString(" - ") + _reference_name); + pt_geom->Draw(); + } else if (ic == 7) // pixel + { + TLegend *global_legend = MakeLegend(.05, .1, .7, .8, 2); //, "brNDC"); + global_legend->Draw(); + TPaveText *pt_geom = new TPaveText(.75, .1, .95, .8, "NB"); + pt_geom->SetFillColor(0); + pt_geom->SetTextSize(0.25); + pt_geom->AddText(TString("x: ") + _reference_name); + pt_geom->AddText(TString("y: ") + _alignment_name + TString(" - ") + _reference_name); + pt_geom->Draw(); + } else // sublevels + { + TPaveText *pt = new TPaveText(.05, .1, .7, .8, "NB"); + pt->SetFillColor(0); + pt->AddText(_sublevel_names[ic - 1]); + pt->Draw(); + TPaveText *pt_geom = new TPaveText(.6, .1, .95, .8, "NB"); + pt_geom->SetFillColor(0); + pt_geom->SetTextSize(0.3); + pt_geom->AddText(TString("x: ") + _reference_name); + pt_geom->AddText(TString("y: ") + _alignment_name + TString(" - ") + _reference_name); + pt_geom->Draw(); + } + // printing + if (_print) + c_global[ic]->Print(_output_directory + c_global[ic]->GetName() + ExtensionFromPrintOption(_print_option), + _print_option); + if (_write) + c_global[ic]->Write(); + } + + // printing global canvases + if (_write) + output->Close(); + + // Now produce the profile plots if the option is chosen + // Use seperate loops since no seperate plots are produced for different module qualities + if (_make_profile_plots) { + // Fill Content of 2D-hists into 1D-hists for the profile plots + // Loop over all y-bins for a certain x-bin, calculate mean and RMS as entries of the 1D-hists + bool entries = false; + for (unsigned int ix = 0; ix < x.size(); ix++) { + for (unsigned int iy = 0; iy < y.size(); iy++) { + for (unsigned int igraph = 0; igraph < NB_SUBLEVELS * NB_Z_SLICES; igraph++) { + // Declare hists which will be plotted for the profile plots + histos[ix][iy][igraph] = + new TH1F("1Dhist" + x[ix] + y[iy] + _sublevel_names[igraph % NB_SUBLEVELS] + + TString(igraph % (NB_SUBLEVELS * NB_Z_SLICES) >= NB_SUBLEVELS ? "n" : "p") + + TString(std::to_string(canvas_index)), + "", + histos2D[ix][iy][igraph]->GetXaxis()->GetNbins(), + _min[x[ix]], + _max[x[ix]]); + histos[ix][iy][igraph]->SetMarkerColor(COLOR_CODE(igraph)); + histos[ix][iy][igraph]->SetLineColor(COLOR_CODE(igraph)); + histos[ix][iy][igraph]->StatOverflows(kTRUE); + + // Loop over x bins + for (int binx = 0; binx <= histos2D[ix][iy][igraph]->GetXaxis()->GetNbins(); binx++) { + entries = false; + // Declare y-histogram for each x bin + histosYValues[ix][iy][igraph] = + new TH1F("1Dhist_Y-Values" + x[ix] + y[iy] + _sublevel_names[igraph % NB_SUBLEVELS] + + TString(igraph % (NB_SUBLEVELS * NB_Z_SLICES) >= NB_SUBLEVELS ? "n" : "p") + + TString(std::to_string(canvas_index)) + TString(std::to_string(binx)), + "", + histos2D[ix][iy][igraph]->GetYaxis()->GetNbins(), + _min[y[iy]], + _max[y[iy]] + 1.); + histosYValues[ix][iy][igraph]->StatOverflows(kTRUE); + // Loop over y-bins for each x-bin of the 2D histogram and put it into the 1-d y histograms + // Take overflow bin into account + for (int biny = 0; biny <= histos2D[ix][iy][igraph]->GetYaxis()->GetNbins() + 1; biny++) { + if (histos2D[ix][iy][igraph]->GetBinContent(binx, biny) > 1.) { + histosYValues[ix][iy][igraph]->SetBinContent(biny, histos2D[ix][iy][igraph]->GetBinContent(binx, biny)); + entries = true; + } } - } // end of loop on y - } // end of loop on x - - + if (entries) { + histos[ix][iy][igraph]->SetBinContent(binx, histosYValues[ix][iy][igraph]->GetMean()); + histos[ix][iy][igraph]->SetBinError(binx, histosYValues[ix][iy][igraph]->GetRMS()); + } else + histos[ix][iy][igraph]->SetBinContent(binx, -999999.); + } + } - // CUSTOMISATION - gStyle->SetOptTitle(0); // otherwise, the title is repeated in every pad of the global canvases - // -> instead, we will write it in the upper part in a TPaveText or in a TLegend - for (unsigned int ic = 0 ; ic <= NB_SUBLEVELS+1 ; ic++) - { - c_global[ic]->Draw(); - - // setting legend to tracker canvases - if (!_legend) break; - TCanvas * c_temp = (TCanvas *) c_global[ic]->Clone(c_global[ic]->GetTitle() + TString("_sub")); - c_temp->Draw(); - c_global[ic] = new TCanvas (c_temp->GetName() + TString("_final"), c_temp->GetTitle(), c_temp->GetWindowWidth(), c_temp->GetWindowHeight()); - c_global[ic]->Draw(); - TPad * p_up = new TPad (TString("legend_") + c_temp->GetName(), "", - 0., 0.9, 1., 1., // relative position - -1, 0, 0), // display options - * p_down = new TPad (TString("main_") + c_temp->GetName(), "", - 0., 0., 1., 0.9, - -1, 0, 0); - // in the lower part, draw the plots - p_down->Draw(); - p_down->cd(); - c_temp->DrawClonePad(); - c_global[ic]->cd(); - // in the upper part, pimp the canvas :p - p_up->Draw(); - p_up->cd(); - if (ic == 0) // tracker - { - TLegend * global_legend = MakeLegend(.05,.1,.7,.8,NB_SUBLEVELS);//, "brNDC"); - global_legend->Draw(); - TPaveText * pt_geom = new TPaveText(.75,.1,.95,.8, "NB"); - pt_geom->SetFillColor(0); - pt_geom->SetTextSize(0.25); - pt_geom->AddText(TString("x: ")+_reference_name); - pt_geom->AddText(TString("y: ")+_alignment_name+TString(" - ")+_reference_name); - pt_geom->Draw(); + // Customize and print the histograms + + /// TRACKER + // fixing ranges and draw profile plot histos + + c_hist[ix][iy][0] = + new TCanvas(TString::Format("c_hist_%s_vs_%s_tracker_%d", x[ix].Data(), y[iy].Data(), canvas_index), + TString::Format("Profile plot %s vs. %s at tracker level", x[ix].Data(), y[iy].Data()), + _window_width, + _window_height); + c_hist[ix][iy][0]->SetGrid(_grid_x, _grid_y); // grid + // Draw the frame that will contain the histograms + // One needs to specify the binning and title + c_hist[ix][iy][0]->GetPad(0)->DrawFrame(_min[x[ix]], + dyMin[iy] != -99999 ? dyMin[iy] : _min[y[iy]], + _max[x[ix]], + dyMax[iy] != -99999 ? dyMax[iy] : _max[y[iy]], + TString(";") + LateXstyle(x[ix]) + " /" + _units[x[ix]] + TString(";") + + LateXstyle(y[iy]) + " /" + _units[y[iy]]); + if (_legend) + legend->Draw("same"); + + for (unsigned short int jgraph = 0; jgraph < NB_SUBLEVELS * NB_Z_SLICES; jgraph++) { + unsigned short int igraph = + NB_SUBLEVELS * NB_Z_SLICES - jgraph - + 1; // reverse counting for humane readability (one of the sublevel takes much more place than the others) + + // clone to prevent any injure on the graph + histosTracker[ix][iy][igraph] = (TH1F *)histos[ix][iy][igraph]->Clone(); + // color + histosTracker[ix][iy][igraph]->SetMarkerColor(COLOR_CODE(igraph % NB_SUBLEVELS)); + histosTracker[ix][iy][igraph]->SetLineColor(COLOR_CODE(igraph % NB_SUBLEVELS)); + histosTracker[ix][iy][igraph]->SetMarkerStyle(6); + histosTracker[ix][iy][igraph]->Draw("same pe0"); + } + + if (_print && !_print_only_global) + c_hist[ix][iy][0]->Print( + _output_directory + + TString::Format("Profile_plot_%s_vs_%s_tracker_%d", x[ix].Data(), y[iy].Data(), canvas_index) + + ExtensionFromPrintOption(_print_option), + _print_option); + + //Draw into profile hists global tracker canvas + c_global_hist[0]->cd(INDEX_IN_GLOBAL_CANVAS(ix, iy)); + c_global_hist[0]->GetPad(INDEX_IN_GLOBAL_CANVAS(ix, iy))->SetFillStyle(4000); // make the pad transparent + c_global_hist[0]->GetPad(INDEX_IN_GLOBAL_CANVAS(ix, iy))->SetGrid(_grid_x, _grid_y); // grid + c_global_hist[0] + ->GetPad(INDEX_IN_GLOBAL_CANVAS(ix, iy)) + ->DrawFrame(_min[x[ix]], + dyMin[iy] != -99999 ? dyMin[iy] : _min[y[iy]], + _max[x[ix]], + dyMax[iy] != -99999 ? dyMax[iy] : _max[y[iy]], + TString(";") + LateXstyle(x[ix]) + " /" + _units[x[ix]] + TString(";") + LateXstyle(y[iy]) + + " /" + _units[y[iy]]); + + for (unsigned short int jgraph = 0; jgraph < NB_SUBLEVELS * NB_Z_SLICES; jgraph++) { + unsigned short int igraph = + NB_SUBLEVELS * NB_Z_SLICES - jgraph - + 1; // reverse counting for humane readability (one of the sublevel takes much more place than the others) + histosTracker[ix][iy][igraph]->Draw("same pe0"); + } + + /// PIXEL + // fixing ranges and draw profile plot histos + + c_hist[ix][iy][7] = + new TCanvas(TString::Format("c_hist_%s_vs_%s_pixel_%d", x[ix].Data(), y[iy].Data(), canvas_index), + TString::Format("Profile plot %s vs. %s at pixel level", x[ix].Data(), y[iy].Data()), + _window_width, + _window_height); + c_hist[ix][iy][7]->SetGrid(_grid_x, _grid_y); // grid + // Draw the frame that will contain the histograms + // One needs to specify the binning and title + c_hist[ix][iy][7]->GetPad(0)->DrawFrame(_min[x[ix]], + dyMin[iy] != -99999 ? dyMin[iy] : _min[y[iy]], + _max[x[ix]], + dyMax[iy] != -99999 ? dyMax[iy] : _max[y[iy]], + TString(";") + LateXstyle(x[ix]) + " /" + _units[x[ix]] + TString(";") + + LateXstyle(y[iy]) + " /" + _units[y[iy]]); + if (_legend) + legend->Draw("same"); + + for (unsigned short int jgraph = 0; jgraph < NB_SUBLEVELS * NB_Z_SLICES; jgraph++) { + unsigned short int igraph = + NB_SUBLEVELS * NB_Z_SLICES - jgraph - + 1; // reverse counting for humane readability (one of the sublevel takes much more place than the others) + + if (igraph % NB_SUBLEVELS == 0 || igraph % NB_SUBLEVELS == 1) //Only BPIX and FPIX + { + // clone to prevent any injure on the graph + histosTracker[ix][iy][igraph] = (TH1F *)histos[ix][iy][igraph]->Clone(); + // color + histosTracker[ix][iy][igraph]->SetMarkerColor(COLOR_CODE(igraph % NB_SUBLEVELS)); + histosTracker[ix][iy][igraph]->SetLineColor(COLOR_CODE(igraph % NB_SUBLEVELS)); + histosTracker[ix][iy][igraph]->SetMarkerStyle(6); + histosTracker[ix][iy][igraph]->Draw("same pe0"); + } } - else if (ic == 7) // pixel - { - TLegend * global_legend = MakeLegend(.05,.1,.7,.8,2);//, "brNDC"); - global_legend->Draw(); - TPaveText * pt_geom = new TPaveText(.75,.1,.95,.8, "NB"); - pt_geom->SetFillColor(0); - pt_geom->SetTextSize(0.25); - pt_geom->AddText(TString("x: ")+_reference_name); - pt_geom->AddText(TString("y: ")+_alignment_name+TString(" - ")+_reference_name); - pt_geom->Draw(); + + if (_print && !_print_only_global) + c_hist[ix][iy][7]->Print( + _output_directory + + TString::Format("Profile_plot_%s_vs_%s_pixel_%d", x[ix].Data(), y[iy].Data(), canvas_index) + + ExtensionFromPrintOption(_print_option), + _print_option); + + //Draw into profile hists global tracker canvas + c_global_hist[7]->cd(INDEX_IN_GLOBAL_CANVAS(ix, iy)); + c_global_hist[7]->GetPad(INDEX_IN_GLOBAL_CANVAS(ix, iy))->SetFillStyle(4000); // make the pad transparent + c_global_hist[7]->GetPad(INDEX_IN_GLOBAL_CANVAS(ix, iy))->SetGrid(_grid_x, _grid_y); // grid + c_global_hist[7] + ->GetPad(INDEX_IN_GLOBAL_CANVAS(ix, iy)) + ->DrawFrame(_min[x[ix]], + dyMin[iy] != -99999 ? dyMin[iy] : _min[y[iy]], + _max[x[ix]], + dyMax[iy] != -99999 ? dyMax[iy] : _max[y[iy]], + TString(";") + LateXstyle(x[ix]) + " /" + _units[x[ix]] + TString(";") + LateXstyle(y[iy]) + + " /" + _units[y[iy]]); + + for (unsigned short int jgraph = 0; jgraph < NB_SUBLEVELS * NB_Z_SLICES; jgraph++) { + unsigned short int igraph = + NB_SUBLEVELS * NB_Z_SLICES - jgraph - + 1; // reverse counting for humane readability (one of the sublevel takes much more place than the others) + histosTracker[ix][iy][igraph]->Draw("same pe0"); } - else // sublevels - { - TPaveText * pt = new TPaveText(.05,.1,.7,.8, "NB"); - pt->SetFillColor(0); - pt->AddText(_sublevel_names[ic-1]); - pt->Draw(); - TPaveText * pt_geom = new TPaveText(.6,.1,.95,.8, "NB"); - pt_geom->SetFillColor(0); - pt_geom->SetTextSize(0.3); - pt_geom->AddText(TString("x: ")+_reference_name); - pt_geom->AddText(TString("y: ")+_alignment_name+TString(" - ")+_reference_name); - pt_geom->Draw(); + // printing will be performed after customisation (e.g. legend or title) just after the loops on ix and iy + /// SUBLEVELS (1..6) + for (unsigned int isublevel = 1; isublevel <= NB_SUBLEVELS; isublevel++) { + // Draw and print profile histograms + c_hist[ix][iy][isublevel] = + new TCanvas(TString::Format("c_hist_%s_vs_%s_%s_%d", + x[ix].Data(), + y[iy].Data(), + isublevel == 0 ? "tracker" : _sublevel_names[isublevel - 1].Data(), + canvas_index), + TString::Format("Profile plot %s vs. %s at %s level", + x[ix].Data(), + y[iy].Data(), + isublevel == 0 ? "tracker" : _sublevel_names[isublevel - 1].Data()), + _window_width, + _window_height); + c_hist[ix][iy][isublevel]->SetGrid(_grid_x, _grid_y); // grid + c_hist[ix][iy][isublevel]->GetPad(0)->DrawFrame(_min[x[ix]], + dyMin[iy] != -99999 ? dyMin[iy] : _min[y[iy]], + _max[x[ix]], + dyMax[iy] != -99999 ? dyMax[iy] : _max[y[iy]], + TString(";") + LateXstyle(x[ix]) + " /" + _units[x[ix]] + + TString(";") + LateXstyle(y[iy]) + " /" + _units[y[iy]]); + + histos[ix][iy][isublevel - 1]->SetMarkerColor(kBlack); + histos[ix][iy][isublevel - 1]->SetLineColor(kBlack); + histos[ix][iy][NB_SUBLEVELS + isublevel - 1]->SetMarkerColor(kRed); + histos[ix][iy][NB_SUBLEVELS + isublevel - 1]->SetLineColor(kRed); + + histos[ix][iy][isublevel - 1]->Draw("same pe0"); + histos[ix][iy][NB_SUBLEVELS + isublevel - 1]->Draw("same pe0"); + + if (_print && !_print_only_global) + c_hist[ix][iy][isublevel]->Print(_output_directory + + TString::Format("Profile_plot_%s_vs_%s_%s_%d", + x[ix].Data(), + y[iy].Data(), + _sublevel_names[isublevel - 1].Data(), + canvas_index) + + ExtensionFromPrintOption(_print_option), + _print_option); + + // draw into global canvas + // printing will be performed after customisation (e.g. legend or title) just after the loops on ix and iy + c_global_hist[isublevel]->cd(INDEX_IN_GLOBAL_CANVAS(ix, iy)); + c_global_hist[isublevel] + ->GetPad(INDEX_IN_GLOBAL_CANVAS(ix, iy)) + ->SetFillStyle(4000); // make the pad transparent + c_global_hist[isublevel]->GetPad(INDEX_IN_GLOBAL_CANVAS(ix, iy))->SetGrid(_grid_x, _grid_y); // grid + c_global_hist[isublevel] + ->GetPad(INDEX_IN_GLOBAL_CANVAS(ix, iy)) + ->DrawFrame(_min[x[ix]], + dyMin[iy] != -99999 ? dyMin[iy] : _min[y[iy]], + _max[x[ix]], + dyMax[iy] != -99999 ? dyMax[iy] : _max[y[iy]], + TString(";") + LateXstyle(x[ix]) + " /" + _units[x[ix]] + TString(";") + LateXstyle(y[iy]) + + " /" + _units[y[iy]]); + + histos[ix][iy][isublevel - 1]->Draw("same pe0"); + histos[ix][iy][NB_SUBLEVELS + isublevel - 1]->Draw("same pe0"); } - // printing - if (_print) c_global[ic]->Print(_output_directory + c_global[ic]->GetName() + ExtensionFromPrintOption(_print_option), _print_option); - if (_write) c_global[ic]->Write(); + + } // end of loop on y + } // end of loop on x + + // CUSTOMISATION + gStyle->SetOptTitle(0); // otherwise, the title is repeated in every pad of the global canvases + // -> instead, we will write it in the upper part in a TPaveText or in a TLegend + for (unsigned int ic = 0; ic <= NB_SUBLEVELS; ic++) { + // setting legend to tracker canvases + if (!_legend) + break; + + // setting legend to tracker canvases + if (!_legend) + break; + TCanvas *c_temp_hist = (TCanvas *)c_global_hist[ic]->Clone(c_global_hist[ic]->GetTitle() + TString("_sub")); + c_temp_hist->Draw(); + c_global_hist[ic] = new TCanvas(c_temp_hist->GetName() + TString("_final"), + c_temp_hist->GetTitle(), + c_temp_hist->GetWindowWidth(), + c_temp_hist->GetWindowHeight()); + c_global_hist[ic]->Draw(); + TPad *p_up = new TPad(TString("legend_") + c_temp_hist->GetName(), + "", + 0., + 0.9, + 1., + 1., // relative position + -1, + 0, + 0), // display options + *p_down = new TPad(TString("main_") + c_temp_hist->GetName(), "", 0., 0., 1., 0.9, -1, 0, 0); + // in the lower part, draw the plots + p_down->Draw(); + p_down->cd(); + c_temp_hist->DrawClonePad(); + c_global_hist[ic]->cd(); + // in the upper part, pimp the canvas :p + p_up->Draw(); + p_up->cd(); + if (ic == 0) // tracker + { + TLegend *global_legend = MakeLegend(.05, .1, .7, .8, NB_SUBLEVELS); //, "brNDC"); + global_legend->Draw(); + TPaveText *pt_geom = new TPaveText(.75, .1, .95, .8, "NB"); + pt_geom->SetFillColor(0); + pt_geom->SetTextSize(0.25); + pt_geom->AddText(TString("x: ") + _reference_name); + pt_geom->AddText(TString("y: ") + _alignment_name + TString(" - ") + _reference_name); + pt_geom->Draw(); + } else if (ic == 7) // pixel + { + TLegend *global_legend = MakeLegend(.05, .1, .7, .8, 2); //, "brNDC"); + global_legend->Draw(); + TPaveText *pt_geom = new TPaveText(.75, .1, .95, .8, "NB"); + pt_geom->SetFillColor(0); + pt_geom->SetTextSize(0.25); + pt_geom->AddText(TString("x: ") + _reference_name); + pt_geom->AddText(TString("y: ") + _alignment_name + TString(" - ") + _reference_name); + pt_geom->Draw(); + } else // sublevels + { + TPaveText *pt = new TPaveText(.05, .1, .7, .8, "NB"); + pt->SetFillColor(0); + pt->AddText(_sublevel_names[ic - 1]); + pt->Draw(); + TPaveText *pt_geom = new TPaveText(.6, .1, .95, .8, "NB"); + pt_geom->SetFillColor(0); + pt_geom->SetTextSize(0.3); + pt_geom->AddText(TString("x: ") + _reference_name); + pt_geom->AddText(TString("y: ") + _alignment_name + TString(" - ") + _reference_name); + pt_geom->Draw(); + } + // printing + if (_print) + c_global_hist[ic]->Print( + _output_directory + c_global_hist[ic]->GetName() + ExtensionFromPrintOption(_print_option), _print_option); } - - // printing global canvases - if (_write) output->Close(); - - - // Now produce the profile plots if the option is chosen - // Use seperate loops since no seperate plots are produced for different module qualities - if (_make_profile_plots) { - - // Fill Content of 2D-hists into 1D-hists for the profile plots - // Loop over all y-bins for a certain x-bin, calculate mean and RMS as entries of the 1D-hists - bool entries = false; - for (unsigned int ix = 0 ; ix < x.size() ; ix++) - { - for (unsigned int iy = 0 ; iy < y.size() ; iy++) - { - for (unsigned int igraph = 0 ; igraph < NB_SUBLEVELS*NB_Z_SLICES ; igraph++) - { - - // Declare hists which will be plotted for the profile plots - histos[ix][iy][igraph] = new TH1F ("1Dhist"+x[ix]+y[iy]+_sublevel_names[igraph%NB_SUBLEVELS] - +TString(igraph%(NB_SUBLEVELS*NB_Z_SLICES)>=NB_SUBLEVELS ? "n" : "p" ) - +std::to_string(canvas_index), - "",histos2D[ix][iy][igraph]->GetXaxis()->GetNbins(),_min[x[ix]],_max[x[ix]]); - histos[ix][iy][igraph]->SetMarkerColor(COLOR_CODE(igraph)); - histos[ix][iy][igraph]->SetLineColor(COLOR_CODE(igraph)); - histos[ix][iy][igraph]->StatOverflows(kTRUE); - - - // Loop over x bins - for (int binx = 0 ; binx <= histos2D[ix][iy][igraph]->GetXaxis()->GetNbins() ; binx++) - { - entries = false; - // Declare y-histogram for each x bin - histosYValues[ix][iy][igraph] = new TH1F ("1Dhist_Y-Values"+x[ix]+y[iy]+_sublevel_names[igraph%NB_SUBLEVELS] - +TString(igraph%(NB_SUBLEVELS*NB_Z_SLICES)>=NB_SUBLEVELS ? "n" : "p" ) - +std::to_string(canvas_index) - +std::to_string(binx), - "",histos2D[ix][iy][igraph]->GetYaxis()->GetNbins(), - _min[y[iy]], - _max[y[iy]]+1.); - histosYValues[ix][iy][igraph]->StatOverflows(kTRUE); - // Loop over y-bins for each x-bin of the 2D histogram and put it into the 1-d y histograms - // Take overflow bin into account - for (int biny = 0 ; biny <= histos2D[ix][iy][igraph]->GetYaxis()->GetNbins()+1 ; biny++) - { - if (histos2D[ix][iy][igraph]->GetBinContent(binx,biny) > 1.) - { - histosYValues[ix][iy][igraph]->SetBinContent(biny,histos2D[ix][iy][igraph]->GetBinContent(binx,biny)); - entries = true; - } - } - if (entries) - { - histos[ix][iy][igraph]->SetBinContent(binx,histosYValues[ix][iy][igraph]->GetMean()); - histos[ix][iy][igraph]->SetBinError(binx,histosYValues[ix][iy][igraph]->GetRMS()); - } - else histos[ix][iy][igraph]->SetBinContent(binx,-999999.); - - } - - } - - // Customize and print the histograms - - /// TRACKER - // fixing ranges and draw profile plot histos - - c_hist[ix][iy][0] = new TCanvas (TString::Format("c_hist_%s_vs_%s_tracker_%d", x[ix].Data(), - y[iy].Data(), - canvas_index), - TString::Format("Profile plot %s vs. %s at tracker level", x[ix].Data(), - y[iy].Data()), - _window_width, - _window_height); - c_hist[ix][iy][0]->SetGrid(_grid_x,_grid_y); // grid - // Draw the frame that will contain the histograms - // One needs to specify the binning and title - c_hist[ix][iy][0]->GetPad(0)->DrawFrame(_min[x[ix]], - dyMin[iy] != -99999 ? dyMin[iy] : _min[y[iy]], - _max[x[ix]], - dyMax[iy] != -99999 ? dyMax[iy] : _max[y[iy]], - TString (";") + LateXstyle(x[ix]) + " /" + _units[x[ix]] - + TString (";") + LateXstyle(y[iy]) + " /" + _units[y[iy]]); - if (_legend) legend->Draw("same"); - - for (unsigned short int jgraph = 0 ; jgraph < NB_SUBLEVELS*NB_Z_SLICES ; jgraph++) - { - unsigned short int igraph = NB_SUBLEVELS*NB_Z_SLICES - jgraph - 1; // reverse counting for humane readability (one of the sublevel takes much more place than the others) - - // clone to prevent any injure on the graph - histosTracker[ix][iy][igraph] = (TH1F *) histos[ix][iy][igraph]->Clone(); - // color - histosTracker[ix][iy][igraph]->SetMarkerColor(COLOR_CODE(igraph%NB_SUBLEVELS)); - histosTracker[ix][iy][igraph]->SetLineColor(COLOR_CODE(igraph%NB_SUBLEVELS)); - histosTracker[ix][iy][igraph]->SetMarkerStyle(6); - histosTracker[ix][iy][igraph]->Draw("same pe0"); - - } - - if (_print && !_print_only_global) c_hist[ix][iy][0]->Print(_output_directory - + TString::Format("Profile_plot_%s_vs_%s_tracker_%d", x[ix].Data(), y[iy].Data(), canvas_index) - + ExtensionFromPrintOption(_print_option), - _print_option); - - //Draw into profile hists global tracker canvas - c_global_hist[0]->cd(INDEX_IN_GLOBAL_CANVAS(ix,iy)); - c_global_hist[0]->GetPad(INDEX_IN_GLOBAL_CANVAS(ix,iy))->SetFillStyle(4000); // make the pad transparent - c_global_hist[0]->GetPad(INDEX_IN_GLOBAL_CANVAS(ix,iy))->SetGrid(_grid_x,_grid_y); // grid - c_global_hist[0]->GetPad(INDEX_IN_GLOBAL_CANVAS(ix,iy))->DrawFrame(_min[x[ix]], - dyMin[iy] != -99999 ? dyMin[iy] : _min[y[iy]], - _max[x[ix]], - dyMax[iy] != -99999 ? dyMax[iy] : _max[y[iy]], - TString (";") + LateXstyle(x[ix]) + " /" + _units[x[ix]] - + TString (";") + LateXstyle(y[iy]) + " /" + _units[y[iy]]); - - for (unsigned short int jgraph = 0 ; jgraph < NB_SUBLEVELS*NB_Z_SLICES ; jgraph++) - { - unsigned short int igraph = NB_SUBLEVELS*NB_Z_SLICES - jgraph - 1; // reverse counting for humane readability (one of the sublevel takes much more place than the others) - histosTracker[ix][iy][igraph]->Draw("same pe0"); - } - - /// PIXEL - // fixing ranges and draw profile plot histos - - c_hist[ix][iy][7] = new TCanvas (TString::Format("c_hist_%s_vs_%s_pixel_%d", x[ix].Data(), - y[iy].Data(), - canvas_index), - TString::Format("Profile plot %s vs. %s at pixel level", x[ix].Data(), - y[iy].Data()), - _window_width, - _window_height); - c_hist[ix][iy][7]->SetGrid(_grid_x,_grid_y); // grid - // Draw the frame that will contain the histograms - // One needs to specify the binning and title - c_hist[ix][iy][7]->GetPad(0)->DrawFrame(_min[x[ix]], - dyMin[iy] != -99999 ? dyMin[iy] : _min[y[iy]], - _max[x[ix]], - dyMax[iy] != -99999 ? dyMax[iy] : _max[y[iy]], - TString (";") + LateXstyle(x[ix]) + " /" + _units[x[ix]] - + TString (";") + LateXstyle(y[iy]) + " /" + _units[y[iy]]); - if (_legend) legend->Draw("same"); - - for (unsigned short int jgraph = 0 ; jgraph < NB_SUBLEVELS*NB_Z_SLICES ; jgraph++) - { - unsigned short int igraph = NB_SUBLEVELS*NB_Z_SLICES - jgraph - 1; // reverse counting for humane readability (one of the sublevel takes much more place than the others) - - if (igraph%NB_SUBLEVELS == 0 || igraph%NB_SUBLEVELS == 1) //Only BPIX and FPIX - { - // clone to prevent any injure on the graph - histosTracker[ix][iy][igraph] = (TH1F *) histos[ix][iy][igraph]->Clone(); - // color - histosTracker[ix][iy][igraph]->SetMarkerColor(COLOR_CODE(igraph%NB_SUBLEVELS)); - histosTracker[ix][iy][igraph]->SetLineColor(COLOR_CODE(igraph%NB_SUBLEVELS)); - histosTracker[ix][iy][igraph]->SetMarkerStyle(6); - histosTracker[ix][iy][igraph]->Draw("same pe0"); - } - - } - - if (_print && !_print_only_global) c_hist[ix][iy][7]->Print(_output_directory - + TString::Format("Profile_plot_%s_vs_%s_pixel_%d", x[ix].Data(), y[iy].Data(), canvas_index) - + ExtensionFromPrintOption(_print_option), - _print_option); - - //Draw into profile hists global tracker canvas - c_global_hist[7]->cd(INDEX_IN_GLOBAL_CANVAS(ix,iy)); - c_global_hist[7]->GetPad(INDEX_IN_GLOBAL_CANVAS(ix,iy))->SetFillStyle(4000); // make the pad transparent - c_global_hist[7]->GetPad(INDEX_IN_GLOBAL_CANVAS(ix,iy))->SetGrid(_grid_x,_grid_y); // grid - c_global_hist[7]->GetPad(INDEX_IN_GLOBAL_CANVAS(ix,iy))->DrawFrame(_min[x[ix]], - dyMin[iy] != -99999 ? dyMin[iy] : _min[y[iy]], - _max[x[ix]], - dyMax[iy] != -99999 ? dyMax[iy] : _max[y[iy]], - TString (";") + LateXstyle(x[ix]) + " /" + _units[x[ix]] - + TString (";") + LateXstyle(y[iy]) + " /" + _units[y[iy]]); - - for (unsigned short int jgraph = 0 ; jgraph < NB_SUBLEVELS*NB_Z_SLICES ; jgraph++) - { - unsigned short int igraph = NB_SUBLEVELS*NB_Z_SLICES - jgraph - 1; // reverse counting for humane readability (one of the sublevel takes much more place than the others) - histosTracker[ix][iy][igraph]->Draw("same pe0"); - } - // printing will be performed after customisation (e.g. legend or title) just after the loops on ix and iy - /// SUBLEVELS (1..6) - for (unsigned int isublevel = 1 ; isublevel <= NB_SUBLEVELS ; isublevel++) - { - - // Draw and print profile histograms - c_hist[ix][iy][isublevel] = new TCanvas (TString::Format("c_hist_%s_vs_%s_%s_%d", x[ix].Data(), - y[iy].Data(), - isublevel==0?"tracker":_sublevel_names[isublevel-1].Data(), - canvas_index), - TString::Format("Profile plot %s vs. %s at %s level", x[ix].Data(), - y[iy].Data(), - isublevel==0?"tracker":_sublevel_names[isublevel-1].Data()), - _window_width, - _window_height); - c_hist[ix][iy][isublevel]->SetGrid(_grid_x,_grid_y); // grid - c_hist[ix][iy][isublevel]->GetPad(0)->DrawFrame(_min[x[ix]], - dyMin[iy] != -99999 ? dyMin[iy] : _min[y[iy]], - _max[x[ix]], - dyMax[iy] != -99999 ? dyMax[iy] : _max[y[iy]], - TString (";") + LateXstyle(x[ix]) + " /" + _units[x[ix]] - + TString (";") + LateXstyle(y[iy]) + " /" + _units[y[iy]]); - - histos[ix][iy][ isublevel-1]->SetMarkerColor(kBlack); - histos[ix][iy][ isublevel-1]->SetLineColor(kBlack); - histos[ix][iy][NB_SUBLEVELS+isublevel-1]->SetMarkerColor(kRed); - histos[ix][iy][NB_SUBLEVELS+isublevel-1]->SetLineColor(kRed); - - - histos[ix][iy][ isublevel-1]->Draw("same pe0"); - histos[ix][iy][NB_SUBLEVELS+isublevel-1]->Draw("same pe0"); - - if (_print && !_print_only_global) c_hist[ix][iy][isublevel]->Print(_output_directory - + TString::Format("Profile_plot_%s_vs_%s_%s_%d", x[ix].Data(), y[iy].Data(),_sublevel_names[isublevel-1].Data(), canvas_index) - + ExtensionFromPrintOption(_print_option), - _print_option); - - // draw into global canvas - // printing will be performed after customisation (e.g. legend or title) just after the loops on ix and iy - c_global_hist[isublevel]->cd(INDEX_IN_GLOBAL_CANVAS(ix,iy)); - c_global_hist[isublevel]->GetPad(INDEX_IN_GLOBAL_CANVAS(ix,iy))->SetFillStyle(4000); // make the pad transparent - c_global_hist[isublevel]->GetPad(INDEX_IN_GLOBAL_CANVAS(ix,iy))->SetGrid(_grid_x,_grid_y); // grid - c_global_hist[isublevel]->GetPad(INDEX_IN_GLOBAL_CANVAS(ix,iy))->DrawFrame(_min[x[ix]], - dyMin[iy] != -99999 ? dyMin[iy] : _min[y[iy]], - _max[x[ix]], - dyMax[iy] != -99999 ? dyMax[iy] : _max[y[iy]], - TString (";") + LateXstyle(x[ix]) + " /" + _units[x[ix]] - + TString (";") + LateXstyle(y[iy]) + " /" + _units[y[iy]]); - - - histos[ix][iy][ isublevel-1]->Draw("same pe0"); - histos[ix][iy][NB_SUBLEVELS+isublevel-1]->Draw("same pe0"); - } - - } // end of loop on y - } // end of loop on x - - - - // CUSTOMISATION - gStyle->SetOptTitle(0); // otherwise, the title is repeated in every pad of the global canvases - // -> instead, we will write it in the upper part in a TPaveText or in a TLegend - for (unsigned int ic = 0 ; ic <= NB_SUBLEVELS ; ic++) - { - // setting legend to tracker canvases - if (!_legend) break; - - // setting legend to tracker canvases - if (!_legend) break; - TCanvas * c_temp_hist = (TCanvas *) c_global_hist[ic]->Clone(c_global_hist[ic]->GetTitle() + TString("_sub")); - c_temp_hist->Draw(); - c_global_hist[ic] = new TCanvas (c_temp_hist->GetName() + TString("_final"), c_temp_hist->GetTitle(), c_temp_hist->GetWindowWidth(), c_temp_hist->GetWindowHeight()); - c_global_hist[ic]->Draw(); - TPad * p_up = new TPad (TString("legend_") + c_temp_hist->GetName(), "", - 0., 0.9, 1., 1., // relative position - -1, 0, 0), // display options - * p_down = new TPad (TString("main_") + c_temp_hist->GetName(), "", - 0., 0., 1., 0.9, - -1, 0, 0); - // in the lower part, draw the plots - p_down->Draw(); - p_down->cd(); - c_temp_hist->DrawClonePad(); - c_global_hist[ic]->cd(); - // in the upper part, pimp the canvas :p - p_up->Draw(); - p_up->cd(); - if (ic == 0) // tracker - { - TLegend * global_legend = MakeLegend(.05,.1,.7,.8,NB_SUBLEVELS);//, "brNDC"); - global_legend->Draw(); - TPaveText * pt_geom = new TPaveText(.75,.1,.95,.8, "NB"); - pt_geom->SetFillColor(0); - pt_geom->SetTextSize(0.25); - pt_geom->AddText(TString("x: ")+_reference_name); - pt_geom->AddText(TString("y: ")+_alignment_name+TString(" - ")+_reference_name); - pt_geom->Draw(); - } - else if (ic == 7) // pixel - { - TLegend * global_legend = MakeLegend(.05,.1,.7,.8,2);//, "brNDC"); - global_legend->Draw(); - TPaveText * pt_geom = new TPaveText(.75,.1,.95,.8, "NB"); - pt_geom->SetFillColor(0); - pt_geom->SetTextSize(0.25); - pt_geom->AddText(TString("x: ")+_reference_name); - pt_geom->AddText(TString("y: ")+_alignment_name+TString(" - ")+_reference_name); - pt_geom->Draw(); - } - else // sublevels - { - TPaveText * pt = new TPaveText(.05,.1,.7,.8, "NB"); - pt->SetFillColor(0); - pt->AddText(_sublevel_names[ic-1]); - pt->Draw(); - TPaveText * pt_geom = new TPaveText(.6,.1,.95,.8, "NB"); - pt_geom->SetFillColor(0); - pt_geom->SetTextSize(0.3); - pt_geom->AddText(TString("x: ")+_reference_name); - pt_geom->AddText(TString("y: ")+_alignment_name+TString(" - ")+_reference_name); - pt_geom->Draw(); - } - // printing - if (_print) c_global_hist[ic]->Print(_output_directory + c_global_hist[ic]->GetName() + ExtensionFromPrintOption(_print_option), _print_option); - } - - } - + } + #ifdef TALKATIVE - cout << __FILE__ << ":" << __LINE__ << ":Info: End of MakePlots method" << endl; + cout << __FILE__ << ":" << __LINE__ << ":Info: End of MakePlots method" << endl; #endif - } - // Make additional table for the mean/RMS values of differences -void GeometryComparisonPlotter::MakeTables (vector x, // axes to combine to plot - vector y, // only requires the differences (y values in the plots) and ranges - vector dyMin, // Minimum of y-variable to enable fixed ranges of the histogram - vector dyMax) // Maximum of y-variable to enable fixed ranges of the histogram +void GeometryComparisonPlotter::MakeTables( + vector x, // axes to combine to plot + vector y, // only requires the differences (y values in the plots) and ranges + vector dyMin, // Minimum of y-variable to enable fixed ranges of the histogram + vector dyMax) // Maximum of y-variable to enable fixed ranges of the histogram { - - /// -1) check that only existing branches are called - // (we use a macro to avoid copy/paste) -#define CHECK_BRANCHES(branchname_vector) \ - for (unsigned int i = 0 ; i < branchname_vector.size() ; i++) \ - { \ - if (branch_f.find(branchname_vector[i]) == branch_f.end()) \ - { \ - cout << __FILE__ << ":" << __LINE__ << ":Error: The branch " << branchname_vector[i] << " is not recognised." << endl; \ - return; \ - } \ - } - CHECK_BRANCHES(x); - CHECK_BRANCHES(y); - - const unsigned int nentries = data->GetEntries(); + /// -1) check that only existing branches are called + // (we use a macro to avoid copy/paste) +#define CHECK_BRANCHES(branchname_vector) \ + for (unsigned int i = 0; i < branchname_vector.size(); i++) { \ + if (branch_f.find(branchname_vector[i]) == branch_f.end()) { \ + cout << __FILE__ << ":" << __LINE__ << ":Error: The branch " << branchname_vector[i] << " is not recognised." \ + << endl; \ + return; \ + } \ + } + CHECK_BRANCHES(x); + CHECK_BRANCHES(y); + + const unsigned int nentries = data->GetEntries(); #ifdef TALKATIVE - cout << __FILE__ << ":" << __LINE__ << ":Info: "; INSIDE_VECTOR(x); cout << endl; - cout << __FILE__ << ":" << __LINE__ << ":Info: "; INSIDE_VECTOR(y); cout << endl; + cout << __FILE__ << ":" << __LINE__ << ":Info: "; + INSIDE_VECTOR(x); + cout << endl; + cout << __FILE__ << ":" << __LINE__ << ":Info: "; + INSIDE_VECTOR(y); + cout << endl; #endif + /// 0) min and max values + // the max and min of the graphs are computed from the tree if they have not been manually input yet + // (we use a macro to avoid copy/paste) +#define LIMITS(axes_vector) \ + for (unsigned int i = 0; i < axes_vector.size(); i++) { \ + if (_SF.find(axes_vector[i]) == _SF.end()) \ + _SF[axes_vector[i]] = 1.; \ + if (_min.find(axes_vector[i]) == _min.end()) \ + _min[axes_vector[i]] = _SF[axes_vector[i]] * data->GetMinimum(axes_vector[i]); \ + if (_max.find(axes_vector[i]) == _max.end()) \ + _max[axes_vector[i]] = _SF[axes_vector[i]] * data->GetMaximum(axes_vector[i]); \ + } + LIMITS(x); + LIMITS(y); - /// 0) min and max values - // the max and min of the graphs are computed from the tree if they have not been manually input yet - // (we use a macro to avoid copy/paste) -#define LIMITS(axes_vector) \ - for (unsigned int i = 0 ; i < axes_vector.size() ; i++) \ - { \ - if ( _SF.find(axes_vector[i]) == _SF.end()) _SF[axes_vector[i]] = 1.; \ - if (_min.find(axes_vector[i]) == _min.end()) _min[axes_vector[i]] = _SF[axes_vector[i]]*data->GetMinimum(axes_vector[i]); \ - if (_max.find(axes_vector[i]) == _max.end()) _max[axes_vector[i]] = _SF[axes_vector[i]]*data->GetMaximum(axes_vector[i]); \ - } - LIMITS(x); - LIMITS(y); - -#ifdef TALKATIVE - CHECK_MAP_CONTENT(_min,float); - CHECK_MAP_CONTENT(_max,float); - CHECK_MAP_CONTENT(_SF ,float); +#ifdef TALKATIVE + CHECK_MAP_CONTENT(_min, float); + CHECK_MAP_CONTENT(_max, float); + CHECK_MAP_CONTENT(_SF, float); #endif - /// 1) declare histograms - // the idea is to produce tables of the differences and the absolute positions containing mean and RMS values - // for the different subdetectors - 0..5=different sublevels. - // Values for each endcap detector are to be split in +/-z, for the barrel detectors in +/- x (half barrels) - // Since it is easier to handle in the loops, all subdetectors will be split in - // 4 parts at first: (+/-x)X(+/-z) - // This means that 2*2*6 histograms will be filled during the loop on the TTree - // Pairs of histograms need to be combined afterwards again - // Histograms 0-5 are at +x and +z, 6-11 at +x and -z, 12-17 at -x and +z, and 18-23 at -x and -z - // - // Two version of the table containing the differences are produced. Once using Gaussian fits (more stable - // vs single outliers but perform poorly if the distributions are non-Gaussian) and once using - // the mean and RMS of the histograms (more stable but outliers have a strong impact on the RMS). - // For the absolute positions, only mean+RMS are used since the detector layout is not Gaussian - // (structures due to layers/rings etc) + /// 1) declare histograms + // the idea is to produce tables of the differences and the absolute positions containing mean and RMS values + // for the different subdetectors - 0..5=different sublevels. + // Values for each endcap detector are to be split in +/-z, for the barrel detectors in +/- x (half barrels) + // Since it is easier to handle in the loops, all subdetectors will be split in + // 4 parts at first: (+/-x)X(+/-z) + // This means that 2*2*6 histograms will be filled during the loop on the TTree + // Pairs of histograms need to be combined afterwards again + // Histograms 0-5 are at +x and +z, 6-11 at +x and -z, 12-17 at -x and +z, and 18-23 at -x and -z + // + // Two version of the table containing the differences are produced. Once using Gaussian fits (more stable + // vs single outliers but perform poorly if the distributions are non-Gaussian) and once using + // the mean and RMS of the histograms (more stable but outliers have a strong impact on the RMS). + // For the absolute positions, only mean+RMS are used since the detector layout is not Gaussian + // (structures due to layers/rings etc) #ifndef NB_SUBLEVELS #define NB_SUBLEVELS 6 #endif #define NB_Z_SLICES 2 #define NB_X_SLICES 2 - - TH1F * histosx[x.size()][NB_SUBLEVELS*NB_Z_SLICES*NB_X_SLICES]; - float meanValuex[x.size()][NB_SUBLEVELS*NB_Z_SLICES*NB_X_SLICES]; - float RMSx[x.size()][NB_SUBLEVELS*NB_Z_SLICES*NB_X_SLICES]; - - TH1F * histos[y.size()][NB_SUBLEVELS*NB_Z_SLICES*NB_X_SLICES]; - TF1 * gausFit[y.size()][NB_SUBLEVELS*NB_Z_SLICES*NB_X_SLICES]; - float meanValue[y.size()][NB_SUBLEVELS*NB_Z_SLICES*NB_X_SLICES]; - float meanValueGaussian[y.size()][NB_SUBLEVELS*NB_Z_SLICES*NB_X_SLICES]; - float RMS[y.size()][NB_SUBLEVELS*NB_Z_SLICES*NB_X_SLICES]; - float RMSGaussian[y.size()][NB_SUBLEVELS*NB_Z_SLICES*NB_X_SLICES]; - - for (unsigned int iy = 0 ; iy < y.size() ; iy++) - { - for (unsigned int ihist = 0 ; ihist < NB_SUBLEVELS*NB_Z_SLICES*NB_X_SLICES ; ihist++) - { - - // Create and correctly name a histogram for each subdetector*Z_Slice*X_Slice - histos[iy][ihist] = new TH1F ("hist"+y[iy]+_sublevel_names[ihist%NB_SUBLEVELS] - +TString(ihist%(NB_SUBLEVELS*NB_Z_SLICES)>=NB_SUBLEVELS ? "zn" : "zp" ) - +TString(ihist>=NB_SUBLEVELS*NB_Z_SLICES ? "xn" : "xp" ), - "",1000, - _min[y[iy]], - _max[y[iy]]+1.); - histos[iy][ihist]->StatOverflows(kTRUE); - - } - } - - for (unsigned int ix = 0 ; ix < x.size() ; ix++) - { - for (unsigned int ihist = 0 ; ihist < NB_SUBLEVELS*NB_Z_SLICES*NB_X_SLICES ; ihist++) - { - - // Create and correctly name a histogram for each subdetector*Z_Slice*ModuleType - histosx[ix][ihist] = new TH1F ("histx"+x[ix]+_sublevel_names[ihist%NB_SUBLEVELS] - +TString(ihist%(NB_SUBLEVELS*NB_Z_SLICES)>=NB_SUBLEVELS ? "zn" : "zp" ) - +TString(ihist>=NB_SUBLEVELS*NB_Z_SLICES ? "xn" : "xp" ), - "",1000, - _min[x[ix]], - _max[x[ix]]+1.); - histosx[ix][ihist]->StatOverflows(kTRUE); - - } - } + + TH1F *histosx[x.size()][NB_SUBLEVELS * NB_Z_SLICES * NB_X_SLICES]; + float meanValuex[x.size()][NB_SUBLEVELS * NB_Z_SLICES * NB_X_SLICES]; + float RMSx[x.size()][NB_SUBLEVELS * NB_Z_SLICES * NB_X_SLICES]; + + TH1F *histos[y.size()][NB_SUBLEVELS * NB_Z_SLICES * NB_X_SLICES]; + TF1 *gausFit[y.size()][NB_SUBLEVELS * NB_Z_SLICES * NB_X_SLICES]; + float meanValue[y.size()][NB_SUBLEVELS * NB_Z_SLICES * NB_X_SLICES]; + float meanValueGaussian[y.size()][NB_SUBLEVELS * NB_Z_SLICES * NB_X_SLICES]; + float RMS[y.size()][NB_SUBLEVELS * NB_Z_SLICES * NB_X_SLICES]; + float RMSGaussian[y.size()][NB_SUBLEVELS * NB_Z_SLICES * NB_X_SLICES]; + + for (unsigned int iy = 0; iy < y.size(); iy++) { + for (unsigned int ihist = 0; ihist < NB_SUBLEVELS * NB_Z_SLICES * NB_X_SLICES; ihist++) { + // Create and correctly name a histogram for each subdetector*Z_Slice*X_Slice + histos[iy][ihist] = new TH1F("hist" + y[iy] + _sublevel_names[ihist % NB_SUBLEVELS] + + TString(ihist % (NB_SUBLEVELS * NB_Z_SLICES) >= NB_SUBLEVELS ? "zn" : "zp") + + TString(ihist >= NB_SUBLEVELS * NB_Z_SLICES ? "xn" : "xp"), + "", + 1000, + _min[y[iy]], + _max[y[iy]] + 1.); + histos[iy][ihist]->StatOverflows(kTRUE); + } + } + + for (unsigned int ix = 0; ix < x.size(); ix++) { + for (unsigned int ihist = 0; ihist < NB_SUBLEVELS * NB_Z_SLICES * NB_X_SLICES; ihist++) { + // Create and correctly name a histogram for each subdetector*Z_Slice*ModuleType + histosx[ix][ihist] = new TH1F("histx" + x[ix] + _sublevel_names[ihist % NB_SUBLEVELS] + + TString(ihist % (NB_SUBLEVELS * NB_Z_SLICES) >= NB_SUBLEVELS ? "zn" : "zp") + + TString(ihist >= NB_SUBLEVELS * NB_Z_SLICES ? "xn" : "xp"), + "", + 1000, + _min[x[ix]], + _max[x[ix]] + 1.); + histosx[ix][ihist]->StatOverflows(kTRUE); + } + } #ifdef DEBUG - cout << __FILE__ << ":" << __LINE__ << ":Info: Creation of the TH1F[" << y.size() << "][" << NB_SUBLEVELS*NB_Z_SLICES*NB_X_SLICES << "] ended." << endl; + cout << __FILE__ << ":" << __LINE__ << ":Info: Creation of the TH1F[" << y.size() << "][" + << NB_SUBLEVELS * NB_Z_SLICES * NB_X_SLICES << "] ended." << endl; #endif - /// 2) loop on the TTree data + /// 2) loop on the TTree data #ifdef DEBUG - cout << __FILE__ << ":" << __LINE__ << ":Info: Looping on the TTree" << endl; + cout << __FILE__ << ":" << __LINE__ << ":Info: Looping on the TTree" << endl; #endif #ifdef TALKATIVE - unsigned int progress = 0; - cout << __FILE__ << ":" << __LINE__ << ":Info: 0%" << endl; + unsigned int progress = 0; + cout << __FILE__ << ":" << __LINE__ << ":Info: 0%" << endl; #endif - for (unsigned int ientry = 0 ; ientry < nentries ; ientry++) - { -#ifdef TALKATIVE - if (10*ientry/nentries != progress) - { - progress = 10*ientry/nentries; - cout << __FILE__ << ":" << __LINE__ << ":Info: " << 10*progress << "%" << endl; - } + for (unsigned int ientry = 0; ientry < nentries; ientry++) { +#ifdef TALKATIVE + if (10 * ientry / nentries != progress) { + progress = 10 * ientry / nentries; + cout << __FILE__ << ":" << __LINE__ << ":Info: " << 10 * progress << "%" << endl; + } #endif - // load current tree entry - data->GetEntry(ientry); - - // CUTS on entry - if (branch_i["level"] != _levelCut) continue; - if (!_1dModule && branch_i["detDim"] == 1) continue; - if (!_2dModule && branch_i["detDim"] == 2) continue; - - - for (unsigned int iy = 0 ; iy < y.size() ; iy++) - { - if (branch_i["sublevel"] < 1 || branch_i["sublevel"] > NB_SUBLEVELS) continue; - if (_SF[y[iy]]*branch_f[y[iy]] > _max[y[iy]] || _SF[y[iy]]*branch_f[y[iy]] < _min[y[iy]]) - { -//#ifdef DEBUG -// cout << "branch_f[y[iy]]=" << branch_f[y[iy]] << endl; -//#endif - continue; - } - - // FILLING HISTOGRAMS - - // histogram for all modules - const short int ihisto = (branch_i["sublevel"]-1) + (branch_f["z"]>=0?0:NB_SUBLEVELS) + (branch_f["x"]>=0?0:NB_SUBLEVELS*NB_Z_SLICES); - - if (_module_plot_option == "all") histos[iy][ihisto]->Fill( _SF[y[iy]]*branch_f[y[iy]]); - - // Only good modules - else if (_module_plot_option == "good" && branch_i["badModuleQuality"]==0) histos[iy][ihisto]->Fill( _SF[y[iy]]*branch_f[y[iy]]); - - // Only good modules and those in the list - else if (_module_plot_option == "list" && (branch_i["inModuleList"]==1 || branch_i["badModuleQuality"]==0)) histos[iy][ihisto]->Fill( _SF[y[iy]]*branch_f[y[iy]]); - - } - - for (unsigned int ix = 0 ; ix < x.size() ; ix++) - { - if (branch_i["sublevel"] < 1 || branch_i["sublevel"] > NB_SUBLEVELS) continue; - if (_SF[x[ix]]*branch_f[x[ix]] > _max[x[ix]] || _SF[x[ix]]*branch_f[x[ix]] < _min[x[ix]]) - { -//#ifdef DEBUG -// cout << "branch_f[y[iy]]=" << branch_f[y[iy]] << endl; -//#endif - continue; - } - - // FILLING HISTOGRAMS - - // histogram for all modules - const short int ihistosx = (branch_i["sublevel"]-1) + (branch_f["z"]>=0?0:NB_SUBLEVELS) + (branch_f["x"]>=0?0:NB_SUBLEVELS*NB_Z_SLICES); - - if (_module_plot_option == "all") histosx[ix][ihistosx]->Fill( _SF[x[ix]]*branch_f[x[ix]]); - - // Only good modules - else if (_module_plot_option == "good" && branch_i["badModuleQuality"]==0) histosx[ix][ihistosx]->Fill( _SF[x[ix]]*branch_f[x[ix]]); - - // Only good modules and those in the list - else if (_module_plot_option == "list" && (branch_i["inModuleList"]==1 || branch_i["badModuleQuality"]==0)) histosx[ix][ihistosx]->Fill( _SF[x[ix]]*branch_f[x[ix]]); - - } + // load current tree entry + data->GetEntry(ientry); + + // CUTS on entry + if (branch_i["level"] != _levelCut) + continue; + if (!_1dModule && branch_i["detDim"] == 1) + continue; + if (!_2dModule && branch_i["detDim"] == 2) + continue; + + for (unsigned int iy = 0; iy < y.size(); iy++) { + if (branch_i["sublevel"] < 1 || branch_i["sublevel"] > NB_SUBLEVELS) + continue; + if (_SF[y[iy]] * branch_f[y[iy]] > _max[y[iy]] || _SF[y[iy]] * branch_f[y[iy]] < _min[y[iy]]) { + //#ifdef DEBUG + // cout << "branch_f[y[iy]]=" << branch_f[y[iy]] << endl; + //#endif + continue; + } + + // FILLING HISTOGRAMS + + // histogram for all modules + const short int ihisto = (branch_i["sublevel"] - 1) + (branch_f["z"] >= 0 ? 0 : NB_SUBLEVELS) + + (branch_f["x"] >= 0 ? 0 : NB_SUBLEVELS * NB_Z_SLICES); + + if (_module_plot_option == "all") + histos[iy][ihisto]->Fill(_SF[y[iy]] * branch_f[y[iy]]); + + // Only good modules + else if (_module_plot_option == "good" && branch_i["badModuleQuality"] == 0) + histos[iy][ihisto]->Fill(_SF[y[iy]] * branch_f[y[iy]]); + + // Only good modules and those in the list + else if (_module_plot_option == "list" && (branch_i["inModuleList"] == 1 || branch_i["badModuleQuality"] == 0)) + histos[iy][ihisto]->Fill(_SF[y[iy]] * branch_f[y[iy]]); + } + + for (unsigned int ix = 0; ix < x.size(); ix++) { + if (branch_i["sublevel"] < 1 || branch_i["sublevel"] > NB_SUBLEVELS) + continue; + if (_SF[x[ix]] * branch_f[x[ix]] > _max[x[ix]] || _SF[x[ix]] * branch_f[x[ix]] < _min[x[ix]]) { + //#ifdef DEBUG + // cout << "branch_f[y[iy]]=" << branch_f[y[iy]] << endl; + //#endif + continue; + } + + // FILLING HISTOGRAMS + + // histogram for all modules + const short int ihistosx = (branch_i["sublevel"] - 1) + (branch_f["z"] >= 0 ? 0 : NB_SUBLEVELS) + + (branch_f["x"] >= 0 ? 0 : NB_SUBLEVELS * NB_Z_SLICES); + + if (_module_plot_option == "all") + histosx[ix][ihistosx]->Fill(_SF[x[ix]] * branch_f[x[ix]]); + + // Only good modules + else if (_module_plot_option == "good" && branch_i["badModuleQuality"] == 0) + histosx[ix][ihistosx]->Fill(_SF[x[ix]] * branch_f[x[ix]]); + + // Only good modules and those in the list + else if (_module_plot_option == "list" && (branch_i["inModuleList"] == 1 || branch_i["badModuleQuality"] == 0)) + histosx[ix][ihistosx]->Fill(_SF[x[ix]] * branch_f[x[ix]]); } + } #ifdef TALKATIVE - cout << __FILE__ << ":" << __LINE__ << ":Info: 100%\tLoop ended" << endl; + cout << __FILE__ << ":" << __LINE__ << ":Info: 100%\tLoop ended" << endl; #endif - //~ TString rangeLabel = ""; - // Calculate mean and standard deviation for each histogram - for (unsigned int iy = 0 ; iy < y.size() ; iy++) - { - - for (unsigned int ihist = 0 ; ihist < NB_SUBLEVELS*NB_Z_SLICES*NB_X_SLICES ; ihist++) - { - // combine +/-z histograms for barrel detectors - if (ihist%(NB_SUBLEVELS*NB_Z_SLICES) == 0 || ihist%(NB_SUBLEVELS*NB_Z_SLICES) == 2 || ihist%(NB_SUBLEVELS*NB_Z_SLICES) == 4) { - histos[iy][ihist]->Add(histos[iy][ihist+NB_SUBLEVELS]); - } - // combine +/-x histograms for endcap detectors (only used for half shells in barrel) - if (ihist < NB_SUBLEVELS*NB_Z_SLICES && ( ihist%NB_SUBLEVELS == 1 || ihist%NB_SUBLEVELS == 3 || ihist%NB_SUBLEVELS == 5)) { - histos[iy][ihist]->Add(histos[iy][ihist+NB_SUBLEVELS*NB_Z_SLICES]); - } - meanValue[iy][ihist] = histos[iy][ihist]->GetMean(); - RMS[iy][ihist] = histos[iy][ihist]->GetRMS(); - - histos[iy][ihist]->Fit("gaus"); - gausFit[iy][ihist] = histos[iy][ihist]->GetFunction("gaus"); - meanValueGaussian[iy][ihist] = gausFit[iy][ihist]->GetParameter(1); - RMSGaussian[iy][ihist] = gausFit[iy][ihist]->GetParameter(2); - - - - } - } - - for (unsigned int ix = 0 ; ix < x.size() ; ix++) - { - - for (unsigned int ihist = 0 ; ihist < NB_SUBLEVELS*NB_Z_SLICES*NB_X_SLICES ; ihist++) - { - // combine +/-z histograms for barrel detectors - if (ihist%(NB_SUBLEVELS*NB_Z_SLICES) == 0 || ihist%(NB_SUBLEVELS*NB_Z_SLICES) == 2 || ihist%(NB_SUBLEVELS*NB_Z_SLICES) == 4) { - histosx[ix][ihist]->Add(histosx[ix][ihist+NB_SUBLEVELS]); - } - // combine +/-x histograms for endcap detectors (only used for half shells in barrel) - if (ihist < NB_SUBLEVELS*NB_Z_SLICES && ( ihist%NB_SUBLEVELS == 1 || ihist%NB_SUBLEVELS == 3 || ihist%NB_SUBLEVELS == 5) ) { - histosx[ix][ihist]->Add(histosx[ix][ihist+NB_SUBLEVELS*NB_Z_SLICES]); - } - meanValuex[ix][ihist] = histosx[ix][ihist]->GetMean(); - RMSx[ix][ihist] = histosx[ix][ihist]->GetRMS(); - - } - } - - TString tableFileName,tableCaption,tableAlign,tableHeadline; - TString PXBpLine,PXBmLine,PXFpLine,PXFmLine,TIBpLine,TIBmLine,TOBpLine,TOBmLine,TIDpLine,TIDmLine,TECpLine,TECmLine; - - - // table using mean and RMS, round to integers in µm etc. - tableFileName = "table_differences.tex"; - if (_module_plot_option == "all") tableCaption = "Means and standard deviations of "+_alignment_name+" - "+_reference_name+" for each subdetector, all modules used."; - else if (_module_plot_option == "good") tableCaption = "Means and standard deviations of "+_alignment_name+" - "+_reference_name+" for each subdetector, only good modules used."; - else if (_module_plot_option == "list") tableCaption = "Means and standard deviations of "+_alignment_name+" - "+_reference_name+" for each subdetector, good modules and those in given list used."; - - WriteTable(y,NB_SUBLEVELS*NB_Z_SLICES*NB_X_SLICES,meanValue,RMS,"0",tableCaption,tableFileName); - - - //~ // table using Gaussian fit, round to integers in µm etc. - tableFileName = "table_differences_Gaussian.tex"; - if (_module_plot_option == "all") tableCaption = "Means and standard deviations for Gaussian fit of "+_alignment_name+" - "+_reference_name+" for each subdetector, all modules used."; - else if (_module_plot_option == "good") tableCaption = "Means and standard deviations for Gaussian fit of "+_alignment_name+" - "+_reference_name+" for each subdetector, only good modules used."; - else if (_module_plot_option == "list") tableCaption = "Means and standard deviations for Gaussian fit of "+_alignment_name+" - "+_reference_name+" for each subdetector, good modules and those in given list used."; - - - WriteTable(y,NB_SUBLEVELS*NB_Z_SLICES*NB_X_SLICES,meanValueGaussian,RMSGaussian,"0",tableCaption,tableFileName); - - - - // Table for the mean positions on the x-axis, round to 3 digits in cm etc. - tableFileName = "table_meanPos.tex"; - - if (_module_plot_option == "all") tableCaption = "Mean positions and standard deviations in "+_reference_name+" geometry for each subdetector, all modules used."; - else if (_module_plot_option == "good") tableCaption = "Mean positions and standard deviations in "+_reference_name+" geometry for each subdetector, only good modules used."; - else if (_module_plot_option == "list") tableCaption = "Mean positions and standard deviations in "+_reference_name+" geometry for each subdetector, good modules and those in given list used."; - - WriteTable(x,NB_SUBLEVELS*NB_Z_SLICES*NB_X_SLICES,meanValuex,RMSx,"3",tableCaption,tableFileName); - - + //~ TString rangeLabel = ""; + // Calculate mean and standard deviation for each histogram + for (unsigned int iy = 0; iy < y.size(); iy++) { + for (unsigned int ihist = 0; ihist < NB_SUBLEVELS * NB_Z_SLICES * NB_X_SLICES; ihist++) { + // combine +/-z histograms for barrel detectors + if (ihist % (NB_SUBLEVELS * NB_Z_SLICES) == 0 || ihist % (NB_SUBLEVELS * NB_Z_SLICES) == 2 || + ihist % (NB_SUBLEVELS * NB_Z_SLICES) == 4) { + histos[iy][ihist]->Add(histos[iy][ihist + NB_SUBLEVELS]); + } + // combine +/-x histograms for endcap detectors (only used for half shells in barrel) + if (ihist < NB_SUBLEVELS * NB_Z_SLICES && + (ihist % NB_SUBLEVELS == 1 || ihist % NB_SUBLEVELS == 3 || ihist % NB_SUBLEVELS == 5)) { + histos[iy][ihist]->Add(histos[iy][ihist + NB_SUBLEVELS * NB_Z_SLICES]); + } + meanValue[iy][ihist] = histos[iy][ihist]->GetMean(); + RMS[iy][ihist] = histos[iy][ihist]->GetRMS(); + + histos[iy][ihist]->Fit("gaus"); + gausFit[iy][ihist] = histos[iy][ihist]->GetFunction("gaus"); + meanValueGaussian[iy][ihist] = gausFit[iy][ihist]->GetParameter(1); + RMSGaussian[iy][ihist] = gausFit[iy][ihist]->GetParameter(2); + } + } + + for (unsigned int ix = 0; ix < x.size(); ix++) { + for (unsigned int ihist = 0; ihist < NB_SUBLEVELS * NB_Z_SLICES * NB_X_SLICES; ihist++) { + // combine +/-z histograms for barrel detectors + if (ihist % (NB_SUBLEVELS * NB_Z_SLICES) == 0 || ihist % (NB_SUBLEVELS * NB_Z_SLICES) == 2 || + ihist % (NB_SUBLEVELS * NB_Z_SLICES) == 4) { + histosx[ix][ihist]->Add(histosx[ix][ihist + NB_SUBLEVELS]); + } + // combine +/-x histograms for endcap detectors (only used for half shells in barrel) + if (ihist < NB_SUBLEVELS * NB_Z_SLICES && + (ihist % NB_SUBLEVELS == 1 || ihist % NB_SUBLEVELS == 3 || ihist % NB_SUBLEVELS == 5)) { + histosx[ix][ihist]->Add(histosx[ix][ihist + NB_SUBLEVELS * NB_Z_SLICES]); + } + meanValuex[ix][ihist] = histosx[ix][ihist]->GetMean(); + RMSx[ix][ihist] = histosx[ix][ihist]->GetRMS(); + } + } + + TString tableFileName, tableCaption, tableAlign, tableHeadline; + TString PXBpLine, PXBmLine, PXFpLine, PXFmLine, TIBpLine, TIBmLine, TOBpLine, TOBmLine, TIDpLine, TIDmLine, TECpLine, + TECmLine; + + // table using mean and RMS, round to integers in µm etc. + tableFileName = "table_differences.tex"; + if (_module_plot_option == "all") + tableCaption = "Means and standard deviations of " + _alignment_name + " - " + _reference_name + + " for each subdetector, all modules used."; + else if (_module_plot_option == "good") + tableCaption = "Means and standard deviations of " + _alignment_name + " - " + _reference_name + + " for each subdetector, only good modules used."; + else if (_module_plot_option == "list") + tableCaption = "Means and standard deviations of " + _alignment_name + " - " + _reference_name + + " for each subdetector, good modules and those in given list used."; + + WriteTable(y, NB_SUBLEVELS * NB_Z_SLICES * NB_X_SLICES, meanValue, RMS, "0", tableCaption, tableFileName); + + //~ // table using Gaussian fit, round to integers in µm etc. + tableFileName = "table_differences_Gaussian.tex"; + if (_module_plot_option == "all") + tableCaption = "Means and standard deviations for Gaussian fit of " + _alignment_name + " - " + _reference_name + + " for each subdetector, all modules used."; + else if (_module_plot_option == "good") + tableCaption = "Means and standard deviations for Gaussian fit of " + _alignment_name + " - " + _reference_name + + " for each subdetector, only good modules used."; + else if (_module_plot_option == "list") + tableCaption = "Means and standard deviations for Gaussian fit of " + _alignment_name + " - " + _reference_name + + " for each subdetector, good modules and those in given list used."; + + WriteTable( + y, NB_SUBLEVELS * NB_Z_SLICES * NB_X_SLICES, meanValueGaussian, RMSGaussian, "0", tableCaption, tableFileName); + + // Table for the mean positions on the x-axis, round to 3 digits in cm etc. + tableFileName = "table_meanPos.tex"; + + if (_module_plot_option == "all") + tableCaption = "Mean positions and standard deviations in " + _reference_name + + " geometry for each subdetector, all modules used."; + else if (_module_plot_option == "good") + tableCaption = "Mean positions and standard deviations in " + _reference_name + + " geometry for each subdetector, only good modules used."; + else if (_module_plot_option == "list") + tableCaption = "Mean positions and standard deviations in " + _reference_name + + " geometry for each subdetector, good modules and those in given list used."; + + WriteTable(x, NB_SUBLEVELS * NB_Z_SLICES * NB_X_SLICES, meanValuex, RMSx, "3", tableCaption, tableFileName); + #ifdef TALKATIVE - cout << __FILE__ << ":" << __LINE__ << ":Info: End of MakeLegends method" << endl; + cout << __FILE__ << ":" << __LINE__ << ":Info: End of MakeLegends method" << endl; #endif - } // OPTION METHODS -void GeometryComparisonPlotter::SetPrint (const bool kPrint) { _print = kPrint ; } -void GeometryComparisonPlotter::SetLegend (const bool kLegend) { _legend = kLegend ; } -void GeometryComparisonPlotter::SetWrite (const bool kWrite) { _write = kWrite ; } -void GeometryComparisonPlotter::Set1dModule (const bool k1dModule) { _1dModule = k1dModule ; } -void GeometryComparisonPlotter::Set2dModule (const bool k2dModule) { _2dModule = k2dModule ; } -void GeometryComparisonPlotter::SetLevelCut (const int kLevelCut) { _levelCut = kLevelCut ; } -void GeometryComparisonPlotter::SetBatchMode (const bool kBatchMode) { _batchMode = kBatchMode ; } -void GeometryComparisonPlotter::SetGrid (const int kGridX, - const int kGridY) { _grid_x = kGridX ; - _grid_y = kGridY ; } -void GeometryComparisonPlotter::SetBranchMax (const TString branchname, - const float max) { _max[branchname] = max ; } -void GeometryComparisonPlotter::SetBranchMin (const TString branchname, - const float min) { _min[branchname] = min ; } -void GeometryComparisonPlotter::SetBranchSF (const TString branchname, - const float SF) { _SF[branchname] = SF ; } -void GeometryComparisonPlotter::SetBranchUnits (const TString branchname, - const TString units) { _units[branchname] = units ; } -void GeometryComparisonPlotter::SetPrintOption (const Option_t * print_option) { _print_option = print_option ; } -void GeometryComparisonPlotter::SetCanvasSize (const int window_width, - const int window_height) { _window_width = window_width ; - _window_height = window_height ; } -void GeometryComparisonPlotter::SetOutputFileName (const TString name) { _output_filename = name ; } -void GeometryComparisonPlotter::SetOutputDirectoryName (const TString name) { _output_directory = name - + TString(name.EndsWith("/") ? "" : "/") ; } +void GeometryComparisonPlotter::SetPrint(const bool kPrint) { _print = kPrint; } +void GeometryComparisonPlotter::SetLegend(const bool kLegend) { _legend = kLegend; } +void GeometryComparisonPlotter::SetWrite(const bool kWrite) { _write = kWrite; } +void GeometryComparisonPlotter::Set1dModule(const bool k1dModule) { _1dModule = k1dModule; } +void GeometryComparisonPlotter::Set2dModule(const bool k2dModule) { _2dModule = k2dModule; } +void GeometryComparisonPlotter::SetLevelCut(const int kLevelCut) { _levelCut = kLevelCut; } +void GeometryComparisonPlotter::SetBatchMode(const bool kBatchMode) { _batchMode = kBatchMode; } +void GeometryComparisonPlotter::SetGrid(const int kGridX, const int kGridY) { + _grid_x = kGridX; + _grid_y = kGridY; +} +void GeometryComparisonPlotter::SetBranchMax(const TString branchname, const float max) { _max[branchname] = max; } +void GeometryComparisonPlotter::SetBranchMin(const TString branchname, const float min) { _min[branchname] = min; } +void GeometryComparisonPlotter::SetBranchSF(const TString branchname, const float SF) { _SF[branchname] = SF; } +void GeometryComparisonPlotter::SetBranchUnits(const TString branchname, const TString units) { + _units[branchname] = units; +} +void GeometryComparisonPlotter::SetPrintOption(const Option_t *print_option) { _print_option = print_option; } +void GeometryComparisonPlotter::SetCanvasSize(const int window_width, const int window_height) { + _window_width = window_width; + _window_height = window_height; +} +void GeometryComparisonPlotter::SetOutputFileName(const TString name) { _output_filename = name; } +void GeometryComparisonPlotter::SetOutputDirectoryName(const TString name) { + _output_directory = name + TString(name.EndsWith("/") ? "" : "/"); +} // PRIVATE METHODS -TString GeometryComparisonPlotter::LateXstyle (TString word) -{ - word.ToLower(); - if (word.BeginsWith("d")) word.ReplaceAll("d", "#Delta"); - if (word == TString("rdphi")) word = "r#Delta#phi"; // TO DO: find something less ad hoc... - else if (word.EndsWith("phi")) word.ReplaceAll("phi", "#phi"); - else if (word.EndsWith("alpha")) word.ReplaceAll("alpha", "#alpha"); - else if (word.EndsWith("beta")) word.ReplaceAll("beta" , "#beta"); - else if (word.EndsWith("gamma")) word.ReplaceAll("gamma", "#gamma"); - else if (word.EndsWith("eta")) word.ReplaceAll("eta", "#eta"); - return word; +TString GeometryComparisonPlotter::LateXstyle(TString word) { + word.ToLower(); + if (word.BeginsWith("d")) + word.ReplaceAll("d", "#Delta"); + if (word == TString("rdphi")) + word = "r#Delta#phi"; // TO DO: find something less ad hoc... + else if (word.EndsWith("phi")) + word.ReplaceAll("phi", "#phi"); + else if (word.EndsWith("alpha")) + word.ReplaceAll("alpha", "#alpha"); + else if (word.EndsWith("beta")) + word.ReplaceAll("beta", "#beta"); + else if (word.EndsWith("gamma")) + word.ReplaceAll("gamma", "#gamma"); + else if (word.EndsWith("eta")) + word.ReplaceAll("eta", "#eta"); + return word; } -TString GeometryComparisonPlotter::LateXstyleTable (TString word) -{ - word.ToLower(); - if (word.BeginsWith("d")) word.ReplaceAll("d", "$\\Delta$"); - if (word == TString("rdphi")) word = "r$\\Delta\\phi$"; // TO DO: find something less ad hoc... - else if (word.EndsWith("phi")) word.ReplaceAll("phi", "$\\phi$"); - else if (word.EndsWith("alpha")) word.ReplaceAll("alpha", "$\\alpha$"); - else if (word.EndsWith("beta")) word.ReplaceAll("beta" , "$\\beta$"); - else if (word.EndsWith("gamma")) word.ReplaceAll("gamma", "#$\\gamma$"); - else if (word.EndsWith("eta")) word.ReplaceAll("eta", "$\\eta$"); - return word; +TString GeometryComparisonPlotter::LateXstyleTable(TString word) { + word.ToLower(); + if (word.BeginsWith("d")) + word.ReplaceAll("d", "$\\Delta$"); + if (word == TString("rdphi")) + word = "r$\\Delta\\phi$"; // TO DO: find something less ad hoc... + else if (word.EndsWith("phi")) + word.ReplaceAll("phi", "$\\phi$"); + else if (word.EndsWith("alpha")) + word.ReplaceAll("alpha", "$\\alpha$"); + else if (word.EndsWith("beta")) + word.ReplaceAll("beta", "$\\beta$"); + else if (word.EndsWith("gamma")) + word.ReplaceAll("gamma", "#$\\gamma$"); + else if (word.EndsWith("eta")) + word.ReplaceAll("eta", "$\\eta$"); + return word; } -TString GeometryComparisonPlotter::ExtensionFromPrintOption (TString print_option) -{ - if (print_option.Contains("pdf" )) return TString(".pdf" ); - else if (print_option.Contains("eps" )) return TString(".eps" ); - else if (print_option.Contains("ps" )) return TString(".ps" ); - else if (print_option.Contains("svg" )) return TString(".svg" ); - else if (print_option.Contains("tex" )) return TString(".tex" ); - else if (print_option.Contains("gif" )) return TString(".gif" ); - else if (print_option.Contains("xpm" )) return TString(".xpm" ); - else if (print_option.Contains("png" )) return TString(".png" ); - else if (print_option.Contains("jpg" )) return TString(".jpg" ); - else if (print_option.Contains("tiff")) return TString(".tiff"); - else if (print_option.Contains("cxx" )) return TString(".cxx" ); - else if (print_option.Contains("xml" )) return TString(".xml" ); - else if (print_option.Contains("root")) return TString(".root"); - else - { - cout << __FILE__ << ":" << __LINE__ << ":Warning: unknown format. Returning .pdf, but possibly wrong..." << endl; - return TString(".pdf"); - } +TString GeometryComparisonPlotter::ExtensionFromPrintOption(TString print_option) { + if (print_option.Contains("pdf")) + return TString(".pdf"); + else if (print_option.Contains("eps")) + return TString(".eps"); + else if (print_option.Contains("ps")) + return TString(".ps"); + else if (print_option.Contains("svg")) + return TString(".svg"); + else if (print_option.Contains("tex")) + return TString(".tex"); + else if (print_option.Contains("gif")) + return TString(".gif"); + else if (print_option.Contains("xpm")) + return TString(".xpm"); + else if (print_option.Contains("png")) + return TString(".png"); + else if (print_option.Contains("jpg")) + return TString(".jpg"); + else if (print_option.Contains("tiff")) + return TString(".tiff"); + else if (print_option.Contains("cxx")) + return TString(".cxx"); + else if (print_option.Contains("xml")) + return TString(".xml"); + else if (print_option.Contains("root")) + return TString(".root"); + else { + cout << __FILE__ << ":" << __LINE__ << ":Warning: unknown format. Returning .pdf, but possibly wrong..." << endl; + return TString(".pdf"); + } } -TLegend * GeometryComparisonPlotter::MakeLegend (double x1, - double y1, - double x2, - double y2, - int nPlottedSublevels, - const TString title) -{ - TLegend * legend = new TLegend (x1, y1, x2, y2, title.Data(), "NBNDC"); - legend->SetNColumns(nPlottedSublevels); - legend->SetFillColor(0); - legend->SetLineColor(0); // redundant with option - legend->SetLineWidth(0); // redundant with option - for (int isublevel = 0 ; isublevel < nPlottedSublevels ; isublevel++) // nPlottedSublevels is either NB_SUBLEVELS for the tracker or 2 for the pixel - { - TGraph * g = new TGraph (0); - g->SetMarkerColor(COLOR_CODE(isublevel)); - g->SetFillColor(COLOR_CODE(isublevel)); - g->SetMarkerStyle(kFullSquare); - g->SetMarkerSize(10); - legend->AddEntry(g,_sublevel_names[isublevel], "p"); - } - return legend; +TLegend *GeometryComparisonPlotter::MakeLegend( + double x1, double y1, double x2, double y2, int nPlottedSublevels, const TString title) { + TLegend *legend = new TLegend(x1, y1, x2, y2, title.Data(), "NBNDC"); + legend->SetNColumns(nPlottedSublevels); + legend->SetFillColor(0); + legend->SetLineColor(0); // redundant with option + legend->SetLineWidth(0); // redundant with option + for (int isublevel = 0; isublevel < nPlottedSublevels; + isublevel++) // nPlottedSublevels is either NB_SUBLEVELS for the tracker or 2 for the pixel + { + TGraph *g = new TGraph(0); + g->SetMarkerColor(COLOR_CODE(isublevel)); + g->SetFillColor(COLOR_CODE(isublevel)); + g->SetMarkerStyle(kFullSquare); + g->SetMarkerSize(10); + legend->AddEntry(g, _sublevel_names[isublevel], "p"); + } + return legend; } - - -void GeometryComparisonPlotter::WriteTable (vector x, - unsigned int nLevelsTimesSlices, - float meanValue[10][24], - float RMS[10][24], - const TString nDigits, - const TString tableCaption, - const TString tableFileName) -{ - std::ofstream output(_output_directory+tableFileName); - - TString tableAlign,tableHeadline; - TString PXBpLine,PXBmLine,PXFpLine,PXFmLine,TIBpLine,TIBmLine,TOBpLine,TOBmLine,TIDpLine,TIDmLine,TECpLine,TECmLine; - char meanChar[x.size()][nLevelsTimesSlices][10]; - char RMSChar[x.size()][nLevelsTimesSlices][10]; - - tableAlign = "l"; - tableHeadline = ""; - PXBpLine = "PXB x$+$"; - PXBmLine = "PXB x$-$"; - PXFpLine = "PXF z$+$"; - PXFmLine = "PXF z$-$"; - TIBpLine = "TIB x$+$"; - TIBmLine = "TIB x$-$"; - TIDpLine = "TID z$+$"; - TIDmLine = "TID z$-$"; - TOBpLine = "TOB x$+$"; - TOBmLine = "TOB x$-$"; - TECpLine = "TEC z$+$"; - TECmLine = "TEC z$-$"; - - - - for (unsigned int ix = 0 ; ix < x.size() ; ix++) - { - for (unsigned int isubDet = 0 ; isubDet < nLevelsTimesSlices; isubDet++) - { - - sprintf(meanChar[ix][isubDet],"%."+nDigits+"f",meanValue[ix][isubDet]); - sprintf(RMSChar[ix][isubDet],"%."+nDigits+"f",RMS[ix][isubDet]); - } - tableAlign += "|c"; - tableHeadline += " & " + LateXstyleTable(x[ix]) + " / " + _units[x[ix]].ReplaceAll("#mum", "$\\mu$m"); - - PXBpLine += " & $"; PXBpLine += meanChar[ix][0]; PXBpLine += "\\pm"; PXBpLine += RMSChar[ix][0]; PXBpLine += " $"; - PXBmLine += " & $"; PXBmLine += meanChar[ix][12]; PXBmLine += "\\pm"; PXBmLine += RMSChar[ix][12]; PXBmLine += " $"; - PXFpLine += " & $"; PXFpLine += meanChar[ix][1]; PXFpLine += "\\pm"; PXFpLine += RMSChar[ix][1]; PXFpLine += " $"; - PXFmLine += " & $"; PXFmLine += meanChar[ix][7]; PXFmLine += "\\pm"; PXFmLine += RMSChar[ix][7]; PXFmLine += " $"; - TIBpLine += " & $"; TIBpLine += meanChar[ix][2]; TIBpLine += "\\pm"; TIBpLine += RMSChar[ix][2]; TIBpLine += " $"; - TIBmLine += " & $"; TIBmLine += meanChar[ix][14]; TIBmLine += "\\pm"; TIBmLine += RMSChar[ix][14]; TIBmLine += " $"; - TIDpLine += " & $"; TIDpLine += meanChar[ix][3]; TIDpLine += "\\pm"; TIDpLine += RMSChar[ix][3]; TIDpLine += " $"; - TIDmLine += " & $"; TIDmLine += meanChar[ix][9]; TIDmLine += "\\pm"; TIDmLine += RMSChar[ix][9]; TIDmLine += " $"; - TOBpLine += " & $"; TOBpLine += meanChar[ix][4]; TOBpLine += "\\pm"; TOBpLine += RMSChar[ix][4]; TOBpLine += " $"; - TOBmLine += " & $"; TOBmLine += meanChar[ix][16]; TOBmLine += "\\pm"; TOBmLine += RMSChar[ix][16]; TOBmLine += " $"; - TECpLine += " & $"; TECpLine += meanChar[ix][5]; TECpLine += "\\pm"; TECpLine += RMSChar[ix][5]; TECpLine += " $"; - TECmLine += " & $"; TECmLine += meanChar[ix][11]; TECmLine += "\\pm"; TECmLine += RMSChar[ix][11]; TECmLine += " $"; - } - - // Write the table to the tex file - output << "\\begin{table}" << std::endl; - output << "\\caption{" << tableCaption << "}" << std::endl; - output << "\\begin{tabular}{"<< tableAlign <<"}" << std::endl; - output << "\\hline" << std::endl; - output << tableHeadline << " \\\\" << std::endl; - output << "\\hline" << std::endl; - output << PXBpLine << " \\\\"<< std::endl; - output << PXBmLine << " \\\\"<< std::endl; - output << PXFpLine << " \\\\"<< std::endl; - output << PXFmLine << " \\\\"<< std::endl; - output << TIBpLine << " \\\\"<< std::endl; - output << TIBmLine << " \\\\"<< std::endl; - output << TIDpLine << " \\\\"<< std::endl; - output << TIDmLine << " \\\\"<< std::endl; - output << TOBpLine << " \\\\"<< std::endl; - output << TOBmLine << " \\\\"<< std::endl; - output << TECpLine << " \\\\"<< std::endl; - output << TECmLine << " \\\\"<< std::endl; - output << "\\hline" << std::endl; - output << "\\end{tabular}" << std::endl; - output << "\\end{table}" << std::endl; - + +void GeometryComparisonPlotter::WriteTable(vector x, + unsigned int nLevelsTimesSlices, + float meanValue[10][24], + float RMS[10][24], + const TString nDigits, + const TString tableCaption, + const TString tableFileName) { + std::ofstream output(_output_directory + tableFileName); + + TString tableAlign, tableHeadline; + TString PXBpLine, PXBmLine, PXFpLine, PXFmLine, TIBpLine, TIBmLine, TOBpLine, TOBmLine, TIDpLine, TIDmLine, TECpLine, + TECmLine; + char meanChar[x.size()][nLevelsTimesSlices][10]; + char RMSChar[x.size()][nLevelsTimesSlices][10]; + + tableAlign = "l"; + tableHeadline = ""; + PXBpLine = "PXB x$+$"; + PXBmLine = "PXB x$-$"; + PXFpLine = "PXF z$+$"; + PXFmLine = "PXF z$-$"; + TIBpLine = "TIB x$+$"; + TIBmLine = "TIB x$-$"; + TIDpLine = "TID z$+$"; + TIDmLine = "TID z$-$"; + TOBpLine = "TOB x$+$"; + TOBmLine = "TOB x$-$"; + TECpLine = "TEC z$+$"; + TECmLine = "TEC z$-$"; + + for (unsigned int ix = 0; ix < x.size(); ix++) { + for (unsigned int isubDet = 0; isubDet < nLevelsTimesSlices; isubDet++) { + sprintf(meanChar[ix][isubDet], "%." + nDigits + "f", meanValue[ix][isubDet]); + sprintf(RMSChar[ix][isubDet], "%." + nDigits + "f", RMS[ix][isubDet]); + } + tableAlign += "|c"; + tableHeadline += " & " + LateXstyleTable(x[ix]) + " / " + _units[x[ix]].ReplaceAll("#mum", "$\\mu$m"); + + PXBpLine += " & $"; + PXBpLine += meanChar[ix][0]; + PXBpLine += "\\pm"; + PXBpLine += RMSChar[ix][0]; + PXBpLine += " $"; + PXBmLine += " & $"; + PXBmLine += meanChar[ix][12]; + PXBmLine += "\\pm"; + PXBmLine += RMSChar[ix][12]; + PXBmLine += " $"; + PXFpLine += " & $"; + PXFpLine += meanChar[ix][1]; + PXFpLine += "\\pm"; + PXFpLine += RMSChar[ix][1]; + PXFpLine += " $"; + PXFmLine += " & $"; + PXFmLine += meanChar[ix][7]; + PXFmLine += "\\pm"; + PXFmLine += RMSChar[ix][7]; + PXFmLine += " $"; + TIBpLine += " & $"; + TIBpLine += meanChar[ix][2]; + TIBpLine += "\\pm"; + TIBpLine += RMSChar[ix][2]; + TIBpLine += " $"; + TIBmLine += " & $"; + TIBmLine += meanChar[ix][14]; + TIBmLine += "\\pm"; + TIBmLine += RMSChar[ix][14]; + TIBmLine += " $"; + TIDpLine += " & $"; + TIDpLine += meanChar[ix][3]; + TIDpLine += "\\pm"; + TIDpLine += RMSChar[ix][3]; + TIDpLine += " $"; + TIDmLine += " & $"; + TIDmLine += meanChar[ix][9]; + TIDmLine += "\\pm"; + TIDmLine += RMSChar[ix][9]; + TIDmLine += " $"; + TOBpLine += " & $"; + TOBpLine += meanChar[ix][4]; + TOBpLine += "\\pm"; + TOBpLine += RMSChar[ix][4]; + TOBpLine += " $"; + TOBmLine += " & $"; + TOBmLine += meanChar[ix][16]; + TOBmLine += "\\pm"; + TOBmLine += RMSChar[ix][16]; + TOBmLine += " $"; + TECpLine += " & $"; + TECpLine += meanChar[ix][5]; + TECpLine += "\\pm"; + TECpLine += RMSChar[ix][5]; + TECpLine += " $"; + TECmLine += " & $"; + TECmLine += meanChar[ix][11]; + TECmLine += "\\pm"; + TECmLine += RMSChar[ix][11]; + TECmLine += " $"; + } + + // Write the table to the tex file + output << "\\begin{table}" << std::endl; + output << "\\caption{" << tableCaption << "}" << std::endl; + output << "\\begin{tabular}{" << tableAlign << "}" << std::endl; + output << "\\hline" << std::endl; + output << tableHeadline << " \\\\" << std::endl; + output << "\\hline" << std::endl; + output << PXBpLine << " \\\\" << std::endl; + output << PXBmLine << " \\\\" << std::endl; + output << PXFpLine << " \\\\" << std::endl; + output << PXFmLine << " \\\\" << std::endl; + output << TIBpLine << " \\\\" << std::endl; + output << TIBmLine << " \\\\" << std::endl; + output << TIDpLine << " \\\\" << std::endl; + output << TIDmLine << " \\\\" << std::endl; + output << TOBpLine << " \\\\" << std::endl; + output << TOBmLine << " \\\\" << std::endl; + output << TECpLine << " \\\\" << std::endl; + output << TECmLine << " \\\\" << std::endl; + output << "\\hline" << std::endl; + output << "\\end{tabular}" << std::endl; + output << "\\end{table}" << std::endl; } diff --git a/Alignment/TrackerAlignment/plugins/AlignmentPrescaler.cc b/Alignment/TrackerAlignment/plugins/AlignmentPrescaler.cc index a62eec5546a0e..029a0b5146727 100644 --- a/Alignment/TrackerAlignment/plugins/AlignmentPrescaler.cc +++ b/Alignment/TrackerAlignment/plugins/AlignmentPrescaler.cc @@ -1,33 +1,73 @@ -#include "Alignment/TrackerAlignment/plugins/AlignmentPrescaler.h" - -#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "Alignment/CommonAlignment/interface/Alignable.h" +#include "Alignment/CommonAlignment/interface/Utilities.h" +#include "Alignment/TrackerAlignment/interface/AlignableTracker.h" +#include "AnalysisDataFormats/TrackInfo/interface/TrackInfo.h" +#include "DataFormats/Alignment/interface/AliClusterValueMap.h" +#include "DataFormats/Alignment/interface/AlignmentClusterFlag.h" #include "DataFormats/Common/interface/View.h" +#include "DataFormats/DetId/interface/DetId.h" +#include "DataFormats/TrackReco/interface/Track.h" #include "DataFormats/TrackerCommon/interface/TrackerTopology.h" +#include "DataFormats/TrackerRecHit2D/interface/SiPixelRecHit.h" +#include "DataFormats/TrackerRecHit2D/interface/SiStripRecHit1D.h" +#include "DataFormats/TrackerRecHit2D/interface/SiStripRecHit2D.h" +#include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/EventPrincipal.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Framework/interface/one/EDProducer.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" +#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" +#include "FWCore/Utilities/interface/InputTag.h" #include "Geometry/Records/interface/IdealGeometryRecord.h" #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" -#include "Alignment/TrackerAlignment/interface/AlignableTracker.h" -#include "Alignment/CommonAlignment/interface/Alignable.h" -#include "Alignment/CommonAlignment/interface/Utilities.h" +#include "RecoTracker/TransientTrackingRecHit/interface/TSiPixelRecHit.h" +#include "RecoTracker/TransientTrackingRecHit/interface/TSiStripRecHit2DLocalPos.h" #include "Utilities/General/interface/ClassName.h" -#include "DataFormats/TrackReco/interface/Track.h" -#include "AnalysisDataFormats/TrackInfo/interface/TrackInfo.h" +#include "TFile.h" +#include "TTree.h" +#include "TRandom3.h" +#include "TH1F.h" +#include -#include "DataFormats/TrackerRecHit2D/interface/SiStripRecHit1D.h" -#include "DataFormats/TrackerRecHit2D/interface/SiStripRecHit2D.h" -#include "DataFormats/TrackerRecHit2D/interface/SiPixelRecHit.h" -#include "RecoTracker/TransientTrackingRecHit/interface/TSiStripRecHit2DLocalPos.h" -#include "RecoTracker/TransientTrackingRecHit/interface/TSiPixelRecHit.h" -#include "DataFormats/Alignment/interface/AlignmentClusterFlag.h" -#include "DataFormats/Alignment/interface/AliClusterValueMap.h" +class TrackerTopology; + +class AlignmentPrescaler : public edm::one::EDProducer<> { +public: + AlignmentPrescaler(const edm::ParameterSet& iConfig); + ~AlignmentPrescaler() override; + void beginJob() override; + void endJob() override; + void produce(edm::Event& iEvent, const edm::EventSetup& iSetup) override; + static void fillDescriptions(edm::ConfigurationDescriptions&); + +private: + // tokens + edm::EDGetTokenT tracksToken_; //tracks in input + edm::EDGetTokenT aliClusterToken_; //Hit-quality association map -// #include "Riostream.h" + std::string prescfilename_; //name of the file containing the TTree with the prescaling factors + std::string presctreename_; //name of the TTree with the prescaling factors + + TFile* fpresc_; + TTree* tpresc_; + TRandom3* myrand_; + + int layerFromId(const DetId& id, const TrackerTopology* tTopo) const; + + unsigned int detid_; + float hitPrescFactor_, overlapPrescFactor_; + int totnhitspxl_; +}; using namespace std; AlignmentPrescaler::AlignmentPrescaler(const edm::ParameterSet& iConfig) - : src_(iConfig.getParameter("src")), - srcQualityMap_(iConfig.getParameter("assomap")), + : tracksToken_(consumes(iConfig.getParameter("src"))), + aliClusterToken_(consumes(iConfig.getParameter("assomap"))), prescfilename_(iConfig.getParameter("PrescFileName")), presctreename_(iConfig.getParameter("PrescTreeName")) { // issue the produce<> @@ -35,13 +75,11 @@ AlignmentPrescaler::AlignmentPrescaler(const edm::ParameterSet& iConfig) produces(); } -AlignmentPrescaler::~AlignmentPrescaler() { - // -} +AlignmentPrescaler::~AlignmentPrescaler() = default; void AlignmentPrescaler::beginJob() { // - std::cout << "in AlignmentPrescaler::beginJob" << std::flush; + edm::LogPrint("AlignmentPrescaler") << "in AlignmentPrescaler::beginJob" << std::flush; fpresc_ = new TFile(prescfilename_.c_str(), "READ"); tpresc_ = (TTree*)fpresc_->Get(presctreename_.c_str()); tpresc_->BuildIndex("DetId"); @@ -49,7 +87,7 @@ void AlignmentPrescaler::beginJob() { tpresc_->SetBranchStatus("DetId", true); tpresc_->SetBranchStatus("PrescaleFactor", true); tpresc_->SetBranchStatus("PrescaleFactorOverlap", true); - cout << " Branches activated " << std::flush; + edm::LogPrint("AlignmentPrescaler") << " Branches activated " << std::flush; detid_ = 0; hitPrescFactor_ = 99.0; overlapPrescFactor_ = 88.0; @@ -57,10 +95,10 @@ void AlignmentPrescaler::beginJob() { tpresc_->SetBranchAddress("DetId", &detid_); tpresc_->SetBranchAddress("PrescaleFactor", &hitPrescFactor_); tpresc_->SetBranchAddress("PrescaleFactorOverlap", &overlapPrescFactor_); - cout << " addressed " << std::flush; + edm::LogPrint("AlignmentPrescaler") << " addressed " << std::flush; myrand_ = new TRandom3(); // myrand_->SetSeed(); - cout << " ok " << std::endl; + edm::LogPrint("AlignmentPrescaler") << " ok "; } void AlignmentPrescaler::endJob() { @@ -71,25 +109,25 @@ void AlignmentPrescaler::endJob() { } void AlignmentPrescaler::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { - // std::cout<<"\n\n#################\n### Starting the AlignmentPrescaler::produce ; Event: "< Tracks; - iEvent.getByLabel(src_, Tracks); + iEvent.getByToken(tracksToken_, Tracks); //take HitAssomap - edm::Handle hMap; - iEvent.getByLabel(srcQualityMap_, hMap); - AliClusterValueMap InValMap = *hMap; + AliClusterValueMap InValMap = iEvent.get(aliClusterToken_); //prepare the output of the ValueMap flagging tracks std::vector trackflags(Tracks->size(), 0); - //int npxlhits=0; + int npxlhits = 0; //loop on tracks for (std::vector::const_iterator ittrk = Tracks->begin(), edtrk = Tracks->end(); ittrk != edtrk; ++ittrk) { //loop on tracking rechits - // std::cout << "Loop on hits of track #" << (ittrk - Tracks->begin()) << std::endl; + LogDebug("AlignmentPrescaler") << "Loop on hits of track #" << (ittrk - Tracks->begin()) << std::endl; int nhit = 0; int ntakenhits = 0; bool firstTakenHit = false; @@ -135,10 +173,11 @@ void AlignmentPrescaler::produce(edm::Event& iEvent, const edm::EventSetup& iSet tmpflag.SetDetId(hit->geographicalId()); if (tmpflag.isOverlap()) isOverlapHit = true; - // std::cout<<"~*~*~* Prescale (1D) for module "<(hit); @@ -148,17 +187,18 @@ void AlignmentPrescaler::produce(edm::Event& iEvent, const edm::EventSetup& iSet tmpflag.SetDetId(hit->geographicalId()); if (tmpflag.isOverlap()) isOverlapHit = true; - // std::cout<<"~*~*~* Prescale (2D) for module "<(hit); if (pixelhit != nullptr) { - //npxlhits++; + npxlhits++; SiPixelClusterRefNew pixclust(pixelhit->cluster()); tmpflag = InValMap[pixclust]; tmpflag.SetDetId(hit->geographicalId()); @@ -169,7 +209,7 @@ void AlignmentPrescaler::produce(edm::Event& iEvent, const edm::EventSetup& iSet // tmpflag.SetDetId(hit->geographicalId()); if (isOverlapHit) { - //cout<<" DetId="<Rndm()) <= overlapPrescFactor_); } if (!takeit) { @@ -177,7 +217,7 @@ void AlignmentPrescaler::produce(edm::Event& iEvent, const edm::EventSetup& iSet takeit = (rr <= hitPrescFactor_); } if (takeit) { //HIT TAKEN ! - //cout<<" DetId="< 2) { @@ -196,22 +236,15 @@ void AlignmentPrescaler::produce(edm::Event& iEvent, const edm::EventSetup& iSet if (!firstTakenHit) { firstTakenHit = true; - //std::cout<<"Index of the track iterator is "<< ittrk-Tracks->begin() <begin(); } ntakenhits++; } //end if take this hit - //cout<begin()] = ntakenhits; - } //end loop on tracks - // totnhitspxl_+=ntakenhits; - //cout<<"AlignmentPrescaler::produce says that in this event "<(); @@ -242,9 +275,18 @@ int AlignmentPrescaler::layerFromId(const DetId& id, const TrackerTopology* tTop return tTopo->tidWheel(id) + (3 * (tTopo->tidSide(id) - 1)); } return -1; - } //end layerfromId +void AlignmentPrescaler::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + desc.setComment("Prescale Tracker Alignment hits for alignment procedures"); + desc.add("src", edm::InputTag("generalTracks")); + desc.add("assomap", edm::InputTag("OverlapAssoMap")); + desc.add("PrescFileName", "PrescaleFactors.root"); + desc.add("PrescTreeName", "AlignmentHitMap"); + descriptions.addWithDefaultLabel(desc); +} + // ========= MODULE DEF ============== #include "FWCore/PluginManager/interface/ModuleDef.h" #include "FWCore/Framework/interface/MakerMacros.h" diff --git a/Alignment/TrackerAlignment/plugins/AlignmentPrescaler.h b/Alignment/TrackerAlignment/plugins/AlignmentPrescaler.h deleted file mode 100644 index dc143c2220dab..0000000000000 --- a/Alignment/TrackerAlignment/plugins/AlignmentPrescaler.h +++ /dev/null @@ -1,48 +0,0 @@ -#ifndef TrackerAlignment_AlignmentPrescaler_H -#define TrackerAlignment_AlignmentPrescaler_H - -#include "FWCore/Framework/interface/EDProducer.h" -#include "FWCore/Framework/interface/EventPrincipal.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/Framework/interface/ESHandle.h" - -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/Utilities/interface/InputTag.h" - -#include "DataFormats/DetId/interface/DetId.h" - -#include -#include "TFile.h" -#include "TTree.h" -#include "TRandom3.h" -#include "TH1F.h" - -class TrackerTopology; - -class AlignmentPrescaler : public edm::EDProducer { -public: - AlignmentPrescaler(const edm::ParameterSet &iConfig); - ~AlignmentPrescaler() override; - void beginJob() override; - void endJob() override; - void produce(edm::Event &iEvent, const edm::EventSetup &iSetup) override; - -private: - edm::InputTag src_; //tracks in input - edm::InputTag srcQualityMap_; //Hit-quality association map - - std::string prescfilename_; //name of the file containing the TTree with the prescaling factors - std::string presctreename_; //name of the TTree with the prescaling factors - - TFile *fpresc_; - TTree *tpresc_; - TRandom3 *myrand_; - - int layerFromId(const DetId &id, const TrackerTopology *tTopo) const; - - unsigned int detid_; - float hitPrescFactor_, overlapPrescFactor_; - int totnhitspxl_; -}; -#endif diff --git a/Alignment/TrackerAlignment/plugins/BuildFile.xml b/Alignment/TrackerAlignment/plugins/BuildFile.xml index 1ba9005254f6d..80f283bd6dd47 100644 --- a/Alignment/TrackerAlignment/plugins/BuildFile.xml +++ b/Alignment/TrackerAlignment/plugins/BuildFile.xml @@ -18,6 +18,7 @@ + diff --git a/Alignment/TrackerAlignment/plugins/CreateTrackerAlignmentRcds.cc b/Alignment/TrackerAlignment/plugins/CreateTrackerAlignmentRcds.cc index e0c1d6fd127cb..62375d44c1ac2 100644 --- a/Alignment/TrackerAlignment/plugins/CreateTrackerAlignmentRcds.cc +++ b/Alignment/TrackerAlignment/plugins/CreateTrackerAlignmentRcds.cc @@ -386,9 +386,9 @@ void CreateIdealTkAlRecords::writeToDB() { } edm::LogInfo("Alignment") << "Writing ideal tracker-alignment records."; - poolDb->writeOne(&alignments_, since, "TrackerAlignmentRcd"); - poolDb->writeOne(&alignmentErrors_, since, "TrackerAlignmentErrorExtendedRcd"); - poolDb->writeOne(&alignmentSurfaceDeformations_, since, "TrackerSurfaceDeformationRcd"); + poolDb->writeOneIOV(alignments_, since, "TrackerAlignmentRcd"); + poolDb->writeOneIOV(alignmentErrors_, since, "TrackerAlignmentErrorExtendedRcd"); + poolDb->writeOneIOV(alignmentSurfaceDeformations_, since, "TrackerSurfaceDeformationRcd"); } // ------------ method fills 'descriptions' with the allowed parameters for the module ------------ diff --git a/Alignment/TrackerAlignment/plugins/MCMisalignmentScaler.cc b/Alignment/TrackerAlignment/plugins/MCMisalignmentScaler.cc index f83072cf70c84..d5565b8366cd2 100644 --- a/Alignment/TrackerAlignment/plugins/MCMisalignmentScaler.cc +++ b/Alignment/TrackerAlignment/plugins/MCMisalignmentScaler.cc @@ -226,7 +226,7 @@ void MCMisalignmentScaler::analyze(const edm::Event&, const edm::EventSetup& iSe } edm::LogInfo("Alignment") << "Writing rescaled tracker-alignment record."; const auto& since = cond::timeTypeSpecs[cond::runnumber].beginValue; - poolDb->writeOne(&rescaledAlignments, since, "TrackerAlignmentRcd"); + poolDb->writeOneIOV(rescaledAlignments, since, "TrackerAlignmentRcd"); } MCMisalignmentScaler::ScalerMap MCMisalignmentScaler::decodeSubDetectors(const edm::VParameterSet& psets) { diff --git a/Alignment/TrackerAlignment/plugins/TkAlCaOverlapTagger.cc b/Alignment/TrackerAlignment/plugins/TkAlCaOverlapTagger.cc index 28cd34eebd324..1aa11fff757fd 100644 --- a/Alignment/TrackerAlignment/plugins/TkAlCaOverlapTagger.cc +++ b/Alignment/TrackerAlignment/plugins/TkAlCaOverlapTagger.cc @@ -1,10 +1,12 @@ -#include "FWCore/Framework/interface/EDProducer.h" +#include "FWCore/Framework/interface/stream/EDProducer.h" #include "FWCore/Framework/interface/EventPrincipal.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" +#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" #include "FWCore/Utilities/interface/InputTag.h" #include "DataFormats/Common/interface/View.h" @@ -25,16 +27,19 @@ #include "DataFormats/Alignment/interface/AlignmentClusterFlag.h" #include "DataFormats/Alignment/interface/AliClusterValueMap.h" -//#include -class TkAlCaOverlapTagger : public edm::EDProducer { +class TkAlCaOverlapTagger : public edm::stream::EDProducer<> { public: TkAlCaOverlapTagger(const edm::ParameterSet& iConfig); ~TkAlCaOverlapTagger() override; void produce(edm::Event& iEvent, const edm::EventSetup& iSetup) override; + static void fillDescriptions(edm::ConfigurationDescriptions&); private: const edm::ESGetToken topoToken_; + edm::EDGetTokenT trajTrackToken_; + edm::EDGetTokenT siPixelClustersToken_; + edm::EDGetTokenT siStripClustersToken_; edm::InputTag src_; edm::InputTag srcClust_; bool rejectBadMods_; @@ -45,31 +50,33 @@ class TkAlCaOverlapTagger : public edm::EDProducer { TkAlCaOverlapTagger::TkAlCaOverlapTagger(const edm::ParameterSet& iConfig) : topoToken_(esConsumes()), - src_(iConfig.getParameter("src")), - srcClust_(iConfig.getParameter("Clustersrc")), + trajTrackToken_(consumes((iConfig.getParameter("src")))), + siPixelClustersToken_(consumes((iConfig.getParameter("Clustersrc")))), + siStripClustersToken_(consumes((iConfig.getParameter("Clustersrc")))), rejectBadMods_(iConfig.getParameter("rejectBadMods")), - BadModsList_(iConfig.getParameter >("BadMods")) { + BadModsList_(iConfig.getParameter>("BadMods")) { produces(); //produces the ValueMap (VM) to be stored in the Event at the end } -TkAlCaOverlapTagger::~TkAlCaOverlapTagger() {} +TkAlCaOverlapTagger::~TkAlCaOverlapTagger() = default; void TkAlCaOverlapTagger::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { //Retrieve tracker topology from geometry const TrackerTopology* tTopo = &iSetup.getData(topoToken_); edm::Handle assoMap; - iEvent.getByLabel(src_, assoMap); - // cout<<"\n\n############################\n### Starting a new TkAlCaOverlapTagger - Ev "< > pixelclusters; - iEvent.getByLabel(srcClust_, pixelclusters); //same label as tracks + edm::Handle> pixelclusters; + iEvent.getByToken(siPixelClustersToken_, pixelclusters); //same label as tracks std::vector pixelvalues(pixelclusters->dataSize(), iniflag); //vector where to store value to be fileld in the VM - edm::Handle > stripclusters; - iEvent.getByLabel(srcClust_, stripclusters); //same label as tracks + edm::Handle> stripclusters; + iEvent.getByToken(siStripClustersToken_, stripclusters); //same label as tracks std::vector stripvalues(stripclusters->dataSize(), iniflag); //vector where to store value to be fileld in the VM @@ -78,7 +85,7 @@ void TkAlCaOverlapTagger::produce(edm::Event& iEvent, const edm::EventSetup& iSe //loop over trajectories for (TrajTrackAssociationCollection::const_iterator itass = assoMap->begin(); itass != assoMap->end(); ++itass) { int nOverlaps = 0; - const edm::Ref > traj = itass->key; //trajectory in the collection + const edm::Ref> traj = itass->key; //trajectory in the collection const Trajectory* myTrajectory = &(*traj); std::vector tmColl = myTrajectory->measurements(); @@ -95,14 +102,17 @@ void TkAlCaOverlapTagger::produce(edm::Event& iEvent, const edm::EventSetup& iSe hitcnt++; if (previousTM != nullptr) { - // std::cout<<"Checking TrajMeas ("<recHit()->isValid()) { - //std::cout<<"Previous RecHit invalid !"<recHit()->geographicalId().rawId() + << "\t Local x of hit: " << previousTM->recHit()->localPosition().x(); } - //else std::cout<<"\nDetId: "<recHit()->geographicalId().rawId()<<"\t Local x of hit: "<recHit()->localPosition().x()<recHit(); @@ -110,7 +120,6 @@ void TkAlCaOverlapTagger::produce(edm::Event& iEvent, const edm::EventSetup& iSe if (!hit->isValid()) continue; - //std::cout << " hit number " << (ith - itt->recHits().begin()) << std::endl; DetId detid = hit->geographicalId(); int layer(layerFromId(detid, tTopo)); //layer 1-4=TIB, layer 5-10=TOB int subDet = detid.subdetId(); @@ -133,12 +142,12 @@ void TkAlCaOverlapTagger::produce(edm::Event& iEvent, const edm::EventSetup& iSe // AlignmentClusterFlag hitflag(hit->geographicalId()); hitflag.SetOverlapFlag(); - // cout<<"Overlap found in SubDet "<(hit); const SiStripRecHit1D* transstriphit1D = dynamic_cast(hit); @@ -177,14 +186,17 @@ void TkAlCaOverlapTagger::produce(edm::Event& iEvent, const edm::EventSetup& iSe .id()) { //ensure that the stripclust is really present in the original cluster collection!!! stripvalues[stripclust.key()] = hitflag; - //cout<<">>> Storing in the ValueMap a StripClusterRef with Cluster.Key: "<cluster().key() <<"), Cluster.Id: "<geographicalId().rawId()<<")"<>> Storing in the ValueMap a StripClusterRef with Cluster.Key: " << stripclust.key() + << " (" << striphit->cluster().key() << "), Cluster.Id: " << stripclust.id() << " (DetId is " + << hit->geographicalId().rawId() << ")"; } else { edm::LogError("TkAlCaOverlapTagger") << "ERROR in : ProdId of Strip clusters mismatched: " << stripclust.id() << " vs " << stripclusters.id(); } - // cout<<"Cluster baricentre: "<barycenter()<barycenter(); } else { edm::LogError("TkAlCaOverlapTagger") << "ERROR in : Dynamic cast of " "Strip RecHit failed! TypeId of the RecHit: " @@ -206,7 +218,9 @@ void TkAlCaOverlapTagger::produce(edm::Event& iEvent, const edm::EventSetup& iSe if (pixclust.id() == pixelclusters.id()) { pixelvalues[pixclust.key()] = hitflag; - //cout<<">>> Storing in the ValueMap a PixelClusterRef with ProdID: "<geographicalId().rawId()<<")" <>> Storing in the ValueMap a PixelClusterRef with ProdID: " << pixclust.id() + << " (DetId is " << hit->geographicalId().rawId() << ")"; //" and a Val with ID: "<: ProdId of Pixel clusters mismatched: " @@ -228,18 +242,17 @@ void TkAlCaOverlapTagger::produce(edm::Event& iEvent, const edm::EventSetup& iSe previousTM = &(*itTrajMeas); previousId = detid; } //end loop over traj meas - //std::cout<<"Found "<(); AliClusterValueMap::Filler mapfiller(*hitvalmap); - edm::TestHandle > fakePixelHandle(&pixelvalues, pixelclusters.id()); + edm::TestHandle> fakePixelHandle(&pixelvalues, pixelclusters.id()); mapfiller.insert(fakePixelHandle, pixelvalues.begin(), pixelvalues.end()); - edm::TestHandle > fakeStripHandle(&stripvalues, stripclusters.id()); + edm::TestHandle> fakeStripHandle(&stripvalues, stripclusters.id()); mapfiller.insert(fakeStripHandle, stripvalues.begin(), stripvalues.end()); mapfiller.fill(); @@ -264,6 +277,16 @@ int TkAlCaOverlapTagger::layerFromId(const DetId& id, const TrackerTopology* tTo } //end layerfromId +void TkAlCaOverlapTagger::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + desc.setComment("Tagger of overlaps for tracker alignment"); + desc.add("src", edm::InputTag("generalTracks")); + desc.add("Clustersrc", edm::InputTag("ALCARECOTkAlCosmicsCTF0T")); + desc.add("rejectBadMods", false); + desc.add>("BadMods", {}); + descriptions.addWithDefaultLabel(desc); +} + // ========= MODULE DEF ============== #include "FWCore/PluginManager/interface/ModuleDef.h" #include "FWCore/Framework/interface/MakerMacros.h" diff --git a/Alignment/TrackerAlignment/plugins/TkAlCaSkimTreeMerger.cc b/Alignment/TrackerAlignment/plugins/TkAlCaSkimTreeMerger.cc index 458babf469b2f..4c11866e91217 100644 --- a/Alignment/TrackerAlignment/plugins/TkAlCaSkimTreeMerger.cc +++ b/Alignment/TrackerAlignment/plugins/TkAlCaSkimTreeMerger.cc @@ -1,19 +1,17 @@ - -#ifndef TrackerAlignment_TkAlCaSkimTreeMerger_H -#define TrackerAlignment_TkAlCaSkimTreeMerger_H - -#include #include #include #include +#include -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "FWCore/Framework/interface/EventPrincipal.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" +#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" #include "FWCore/Utilities/interface/InputTag.h" #include "TFile.h" @@ -21,13 +19,14 @@ #include "TChain.h" #include "TStopwatch.h" -class TkAlCaSkimTreeMerger : public edm::EDAnalyzer { +class TkAlCaSkimTreeMerger : public edm::one::EDAnalyzer<> { public: TkAlCaSkimTreeMerger(const edm::ParameterSet &iConfig); ~TkAlCaSkimTreeMerger() override; void beginJob() override; void endJob() override; void analyze(const edm::Event &, const edm::EventSetup &) override; + static void fillDescriptions(edm::ConfigurationDescriptions &); private: TTree *out_; //TTree containing the merged result @@ -49,13 +48,10 @@ class TkAlCaSkimTreeMerger : public edm::EDAnalyzer { TStopwatch myclock; }; -#endif - TkAlCaSkimTreeMerger::TkAlCaSkimTreeMerger(const edm::ParameterSet &iConfig) : filelist_(iConfig.getParameter("FileList")), treename_(iConfig.getParameter("TreeName")), outfilename_(iConfig.getParameter("OutputFile")), - // maxhits_(iConfig.getParameter("NhitsMaxLimit")) maxhits_(iConfig.getParameter("NhitsMaxLimit")), maxhitsSet_(iConfig.getParameter("NhitsMaxSet")) { maxPXBhits_ = maxhitsSet_.getParameter("PXBmaxhits"); @@ -65,19 +61,15 @@ TkAlCaSkimTreeMerger::TkAlCaSkimTreeMerger(const edm::ParameterSet &iConfig) maxTOBhits_ = maxhitsSet_.getParameter("TOBmaxhits"); maxTEChits_ = maxhitsSet_.getParameter("TECmaxhits"); //anything you want to do for initializing - std::cout << "\n\n*** MAX N HITS = " << maxhits_ << std::endl << std::endl; + LogDebug("TkAlCaSkimTreeMerger") << "\n\n*** MAX N HITS = " << maxhits_ << std::endl << std::endl; out_ = nullptr; firsttree_ = nullptr; ch_ = nullptr; } TkAlCaSkimTreeMerger::~TkAlCaSkimTreeMerger() { - //default destructor - // delete out_; - // delete firsttree_; - delete ch_; - std::cout << "finished." << std::endl; + LogDebug("TkAlCaSkimTreeMerger") << "finished." << std::endl; } // ------------ method called before analyzing the first event ------------ @@ -86,7 +78,7 @@ void TkAlCaSkimTreeMerger::beginJob() { //prepare the chain ch_ = new TChain(treename_.c_str()); - std::cout << "The chain contains " << ch_->GetNtrees() << " trees" << std::endl; + LogDebug("TkAlCaSkimTreeMerger") << "The chain contains " << ch_->GetNtrees() << " trees" << std::endl; //load the trees into the chain std::ifstream flist(filelist_.c_str(), std::ios::in); @@ -98,15 +90,15 @@ void TkAlCaSkimTreeMerger::beginJob() { flist >> filename; if (filename.empty()) continue; - //std::cout<<"Adding "<Add(filename.c_str()); if (first) { firstfilename_ = filename; first = false; } } - std::cout << "Now the chain contains " << ch_->GetNtrees() << " trees (" << ch_->GetEntries() << " entries)" - << std::endl; + LogDebug("TkAlCaSkimTreeMerger") << "Now the chain contains " << ch_->GetNtrees() << " trees (" << ch_->GetEntries() + << " entries)" << std::endl; unsigned int id_ch = 0; uint32_t nhits_ch = 0, noverlaps_ch = 0; @@ -153,18 +145,18 @@ void TkAlCaSkimTreeMerger::beginJob() { } //end loop on ent - entries in the chain - std::cout << "Nhits in the chain: " << totnhits << std::endl; - std::cout << "NOverlaps in the chain: " << totnoverlaps << std::endl; + LogDebug("TkAlCaSkimTreeMerger") << "Nhits in the chain: " << totnhits << std::endl; + LogDebug("TkAlCaSkimTreeMerger") << "NOverlaps in the chain: " << totnoverlaps << std::endl; myclock.Stop(); - std::cout << "Finished beginJob after " << myclock.RealTime() << " s (real time) / " << myclock.CpuTime() - << " s (cpu time)" << std::endl; + LogDebug("TkAlCaSkimTreeMerger") << "Finished beginJob after " << myclock.RealTime() << " s (real time) / " + << myclock.CpuTime() << " s (cpu time)" << std::endl; myclock.Continue(); } //end beginJob // ------------ method called to for each event ------------ void TkAlCaSkimTreeMerger::analyze(const edm::Event &, const edm::EventSetup &) { - // std::cout<GetEntries()<GetEntries() << std::endl; } //end analyze // ------------ method called after having analyzed all the events ------------ @@ -172,7 +164,7 @@ void TkAlCaSkimTreeMerger::endJob() { //address variables in the first tree and in the chain TFile *firstfile = new TFile(firstfilename_.c_str(), "READ"); firsttree_ = (TTree *)firstfile->Get(treename_.c_str()); - std::cout << "the first tree has " << firsttree_->GetEntries() << " entries" << std::endl; + LogDebug("TkAlCaSkimTreeMerger") << "the first tree has " << firsttree_->GetEntries() << " entries" << std::endl; unsigned int id = 0; uint32_t nhits = 0, noverlaps = 0; float posX(-99999.0), posY(-77777.0), posZ(-88888.0); @@ -235,7 +227,7 @@ void TkAlCaSkimTreeMerger::endJob() { firsttree_->GetEntry(mod); nhits_out = hitmap_[id]; noverlaps_out = overlapmap_[id]; - // if(mod<25)std::cout<<"Nhits 1st tree: "<Write(); - std::cout << "Deleting..." << std::flush; + LogDebug("TkAlCaSkimTreeMerger") << "Deleting..." << std::flush; delete firstfile; delete outfile; - } //end endJob +void TkAlCaSkimTreeMerger::fillDescriptions(edm::ConfigurationDescriptions &descriptions) { + edm::ParameterSetDescription desc; + desc.setComment("Merger of TkAlCaSkim Trees"); + desc.add("FileList", "DQMHitMapsList.txt"); + desc.add("TreeName", "AlignmentHitMaps"); + desc.add("OutputFile", "AlignmentHitMapsMerged.root"); + desc.add("NhitsMaxLimit", 0); + + edm::ParameterSetDescription tkAlCaSkimTreeParamsDesc; + std::vector tkAlCaSkimDefaults(1); + tkAlCaSkimDefaults[0].addParameter("PXBmaxhits", -1); + tkAlCaSkimDefaults[0].addParameter("PXFmaxhits", -1); + tkAlCaSkimDefaults[0].addParameter("TIBmaxhits", -1); + tkAlCaSkimDefaults[0].addParameter("TIDmaxhits", -1); + tkAlCaSkimDefaults[0].addParameter("TOBmaxhits", -1); + tkAlCaSkimDefaults[0].addParameter("TECmaxhits", -1); + desc.addVPSet("NhitsMaxSet", tkAlCaSkimTreeParamsDesc, tkAlCaSkimDefaults); + descriptions.addWithDefaultLabel(desc); +} + // ========= MODULE DEF ============== #include "FWCore/PluginManager/interface/ModuleDef.h" #include "FWCore/Framework/interface/MakerMacros.h" diff --git a/Alignment/TrackerAlignment/scripts/TkAlCaRecoPrescaling.ALCARECOTkAlCosmics0T.tpl b/Alignment/TrackerAlignment/scripts/TkAlCaRecoPrescaling.ALCARECOTkAlCosmics0T.tpl index e3e8616fadd48..6f1443cbe25cd 100644 --- a/Alignment/TrackerAlignment/scripts/TkAlCaRecoPrescaling.ALCARECOTkAlCosmics0T.tpl +++ b/Alignment/TrackerAlignment/scripts/TkAlCaRecoPrescaling.ALCARECOTkAlCosmics0T.tpl @@ -34,7 +34,7 @@ process.source = cms.Source("PoolSource", from CondCore.DBCommon.CondDBSetup_cfi import * process.load('Configuration.EventContent.EventContent_cff') -process.load("Configuration.StandardSequences.Geometry_cff") +process.load("Configuration.StandardSequences.GeometryDB_cff") process.load("Geometry.CMSCommonData.cmsIdealGeometryXML_cfi") process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff") diff --git a/Alignment/TrackerAlignment/scripts/TkAlCaRecoPrescaling.ALCARECOTkAlMinBias.tpl b/Alignment/TrackerAlignment/scripts/TkAlCaRecoPrescaling.ALCARECOTkAlMinBias.tpl index 2f1765fc34c7c..8b5562aeefa9b 100644 --- a/Alignment/TrackerAlignment/scripts/TkAlCaRecoPrescaling.ALCARECOTkAlMinBias.tpl +++ b/Alignment/TrackerAlignment/scripts/TkAlCaRecoPrescaling.ALCARECOTkAlMinBias.tpl @@ -33,7 +33,7 @@ process.source = cms.Source("PoolSource", from CondCore.DBCommon.CondDBSetup_cfi import * process.load('Configuration.EventContent.EventContent_cff') -process.load("Configuration.StandardSequences.Geometry_cff") +process.load("Configuration.StandardSequences.GeometryDB_cff") process.load("Geometry.CMSCommonData.cmsIdealGeometryXML_cfi") process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff") diff --git a/Alignment/TrackerAlignment/scripts/TkAlCaRecoSkimming.ALCARECOTkAlCosmics0T.tpl b/Alignment/TrackerAlignment/scripts/TkAlCaRecoSkimming.ALCARECOTkAlCosmics0T.tpl index 9376ae38c35ef..ed1cc857e7676 100644 --- a/Alignment/TrackerAlignment/scripts/TkAlCaRecoSkimming.ALCARECOTkAlCosmics0T.tpl +++ b/Alignment/TrackerAlignment/scripts/TkAlCaRecoSkimming.ALCARECOTkAlCosmics0T.tpl @@ -35,7 +35,7 @@ process.source = cms.Source("PoolSource", from CondCore.DBCommon.CondDBSetup_cfi import * process.load('Configuration.EventContent.EventContent_cff') -process.load("Configuration.StandardSequences.Geometry_cff") +process.load("Configuration.StandardSequences.GeometryDB_cff") process.load("Geometry.CMSCommonData.cmsIdealGeometryXML_cfi") process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff") diff --git a/Alignment/TrackerAlignment/scripts/TkAlCaRecoSkimming.ALCARECOTkAlMinBias.tpl b/Alignment/TrackerAlignment/scripts/TkAlCaRecoSkimming.ALCARECOTkAlMinBias.tpl index e157808836d61..eef73c524aa22 100644 --- a/Alignment/TrackerAlignment/scripts/TkAlCaRecoSkimming.ALCARECOTkAlMinBias.tpl +++ b/Alignment/TrackerAlignment/scripts/TkAlCaRecoSkimming.ALCARECOTkAlMinBias.tpl @@ -34,7 +34,7 @@ process.source = cms.Source("PoolSource", from CondCore.DBCommon.CondDBSetup_cfi import * process.load('Configuration.EventContent.EventContent_cff') -process.load("Configuration.StandardSequences.Geometry_cff") +process.load("Configuration.StandardSequences.GeometryDB_cff") process.load("Geometry.CMSCommonData.cmsIdealGeometryXML_cfi") process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff") diff --git a/AnalysisAlgos/TrackInfoProducer/interface/TrackInfoProducer.h b/AnalysisAlgos/TrackInfoProducer/interface/TrackInfoProducer.h deleted file mode 100644 index 428c7e380976e..0000000000000 --- a/AnalysisAlgos/TrackInfoProducer/interface/TrackInfoProducer.h +++ /dev/null @@ -1,41 +0,0 @@ -#ifndef TrackInfoProducer_h -#define TrackInfoProducer_h - -// -// Package: RecoTracker/TrackInfoProducer -// Class: TrackInfoProducer -// -// -// Description: Produce TrackInfo from Trajectory -// -// -// Original Author: Chiara Genta -// Created: -// - -#include "AnalysisAlgos/TrackInfoProducer/interface/TrackInfoProducerAlgorithm.h" -#include "FWCore/Framework/interface/EDProducer.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "DataFormats/TrackReco/interface/TrackFwd.h" -#include "TrackingTools/PatternTools/interface/Trajectory.h" -#include "TrackingTools/PatternTools/interface/TrajTrackAssociation.h" - -class TrackInfoProducer : public edm::EDProducer { -public: - // TrackInfoProducer(){} - explicit TrackInfoProducer(const edm::ParameterSet& iConfig); - - ~TrackInfoProducer() override{}; - - void produce(edm::Event&, const edm::EventSetup&) override; - -private: - TrackInfoProducerAlgorithm theAlgo_; - edm::EDGetTokenT > TrajectoryToken_; - edm::EDGetTokenT trackCollectionToken_; - edm::EDGetTokenT assoMapToken_; - std::string forwardPredictedStateTag_, backwardPredictedStateTag_, updatedStateTag_, combinedStateTag_; -}; -#endif diff --git a/AnalysisAlgos/TrackInfoProducer/src/SealModules.cc b/AnalysisAlgos/TrackInfoProducer/src/SealModules.cc deleted file mode 100644 index a1b7ae25133a4..0000000000000 --- a/AnalysisAlgos/TrackInfoProducer/src/SealModules.cc +++ /dev/null @@ -1,5 +0,0 @@ -#include "FWCore/Framework/interface/MakerMacros.h" - -#include "AnalysisAlgos/TrackInfoProducer/interface/TrackInfoProducer.h" - -DEFINE_FWK_MODULE(TrackInfoProducer); diff --git a/AnalysisAlgos/TrackInfoProducer/src/TrackInfoProducer.cc b/AnalysisAlgos/TrackInfoProducer/src/TrackInfoProducer.cc index 8f6830c779f8a..fe9a1917484f1 100644 --- a/AnalysisAlgos/TrackInfoProducer/src/TrackInfoProducer.cc +++ b/AnalysisAlgos/TrackInfoProducer/src/TrackInfoProducer.cc @@ -1,15 +1,54 @@ -#include "AnalysisAlgos/TrackInfoProducer/interface/TrackInfoProducer.h" +// +// Package: RecoTracker/TrackInfoProducer +// Class: TrackInfoProducer +// +// +// Description: Produce TrackInfo from Trajectory +// +// +// Original Author: Chiara Genta +// Created: +// + // system include files #include + // user include files -#include "DataFormats/Common/interface/Handle.h" -#include "FWCore/Framework/interface/ESHandle.h" -#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "AnalysisAlgos/TrackInfoProducer/interface/TrackInfoProducerAlgorithm.h" #include "AnalysisDataFormats/TrackInfo/interface/TrackInfo.h" #include "AnalysisDataFormats/TrackInfo/interface/TrackInfoTrackAssociation.h" +#include "DataFormats/Common/interface/Handle.h" +#include "DataFormats/TrackReco/interface/TrackFwd.h" +#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Framework/interface/stream/EDProducer.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" #include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" +#include "TrackingTools/PatternTools/interface/TrajTrackAssociation.h" +#include "TrackingTools/PatternTools/interface/Trajectory.h" + +class TrackInfoProducer : public edm::stream::EDProducer<> { +public: + explicit TrackInfoProducer(const edm::ParameterSet& iConfig); + + ~TrackInfoProducer() override{}; + + void produce(edm::Event&, const edm::EventSetup&) override; + +private: + edm::ESGetToken tkGeomToken_; + TrackInfoProducerAlgorithm theAlgo_; + edm::EDGetTokenT > TrajectoryToken_; + edm::EDGetTokenT trackCollectionToken_; + edm::EDGetTokenT assoMapToken_; + std::string forwardPredictedStateTag_, backwardPredictedStateTag_, updatedStateTag_, combinedStateTag_; +}; + TrackInfoProducer::TrackInfoProducer(const edm::ParameterSet& iConfig) - : theAlgo_(iConfig), + : tkGeomToken_(esConsumes()), + theAlgo_(iConfig), TrajectoryToken_(consumes >(iConfig.getParameter("cosmicTracks"))), trackCollectionToken_(consumes(iConfig.getParameter("cosmicTracks"))), assoMapToken_(consumes(iConfig.getParameter("cosmicTracks"))) { @@ -21,17 +60,14 @@ void TrackInfoProducer::produce(edm::Event& theEvent, const edm::EventSetup& set // // create empty output collections // - std::unique_ptr outputColl(new reco::TrackInfoCollection); + const TrackerGeometry* tracker = &setup.getData(tkGeomToken_); + edm::Handle > TrajectoryCollection; edm::Handle trackCollection; edm::Handle assoMap; - edm::ESHandle tkgeom; - setup.get().get(tkgeom); - const TrackerGeometry* tracker = &(*tkgeom); - theEvent.getByToken(TrajectoryToken_, TrajectoryCollection); theEvent.getByToken(trackCollectionToken_, trackCollection); theEvent.getByToken(assoMapToken_, assoMap); @@ -72,3 +108,5 @@ void TrackInfoProducer::produce(edm::Event& theEvent, const edm::EventSetup& set theEvent.put(std::move(TIassociationColl)); } + +DEFINE_FWK_MODULE(TrackInfoProducer); diff --git a/CUDADataFormats/HGCal/interface/HGCUncalibRecHitsToRecHitsConstants.h b/CUDADataFormats/HGCal/interface/HGCUncalibRecHitsToRecHitsConstants.h index 72e7b718fd4ea..b47649673347e 100644 --- a/CUDADataFormats/HGCal/interface/HGCUncalibRecHitsToRecHitsConstants.h +++ b/CUDADataFormats/HGCal/interface/HGCUncalibRecHitsToRecHitsConstants.h @@ -2,6 +2,7 @@ #define CUDADataFormats_HGCal_HGCUncalibRecHitsToRecHitsConstants_h #include +#include #include class HGCConstantVectorData { diff --git a/CUDADataFormats/SiPixelCluster/interface/SiPixelClustersCUDA.h b/CUDADataFormats/SiPixelCluster/interface/SiPixelClustersCUDA.h index acdf1b34a6d79..12c166f82020b 100644 --- a/CUDADataFormats/SiPixelCluster/interface/SiPixelClustersCUDA.h +++ b/CUDADataFormats/SiPixelCluster/interface/SiPixelClustersCUDA.h @@ -18,9 +18,13 @@ class SiPixelClustersCUDA { SiPixelClustersCUDA(SiPixelClustersCUDA &&) = default; SiPixelClustersCUDA &operator=(SiPixelClustersCUDA &&) = default; - void setNClusters(uint32_t nClusters) { nClusters_h = nClusters; } + void setNClusters(uint32_t nClusters, int32_t offsetBPIX2) { + nClusters_h = nClusters; + offsetBPIX2_h = offsetBPIX2; + } uint32_t nClusters() const { return nClusters_h; } + int32_t offsetBPIX2() const { return offsetBPIX2_h; } uint32_t *moduleStart() { return moduleStart_d.get(); } uint32_t *clusInModule() { return clusInModule_d.get(); } @@ -58,6 +62,7 @@ class SiPixelClustersCUDA { cms::cuda::device::unique_ptr view_d; // "me" pointer uint32_t nClusters_h = 0; + int32_t offsetBPIX2_h = 0; }; #endif // CUDADataFormats_SiPixelCluster_interface_SiPixelClustersCUDA_h diff --git a/CUDADataFormats/SiPixelCluster/interface/gpuClusteringConstants.h b/CUDADataFormats/SiPixelCluster/interface/gpuClusteringConstants.h index 77cf567dca681..c0df6cad9bf39 100644 --- a/CUDADataFormats/SiPixelCluster/interface/gpuClusteringConstants.h +++ b/CUDADataFormats/SiPixelCluster/interface/gpuClusteringConstants.h @@ -18,6 +18,7 @@ namespace gpuClustering { constexpr uint16_t maxNumModules = 2000; constexpr int32_t maxNumClustersPerModules = maxHitsInModule(); constexpr uint16_t invalidModuleId = std::numeric_limits::max() - 1; + constexpr int invalidClusterId = -9999; static_assert(invalidModuleId > maxNumModules); // invalidModuleId must be > maxNumModules } // namespace gpuClustering diff --git a/CUDADataFormats/TrackingRecHit/interface/TrackingRecHit2DHeterogeneous.h b/CUDADataFormats/TrackingRecHit/interface/TrackingRecHit2DHeterogeneous.h index 40f8cd96b21e1..21de2b005079d 100644 --- a/CUDADataFormats/TrackingRecHit/interface/TrackingRecHit2DHeterogeneous.h +++ b/CUDADataFormats/TrackingRecHit/interface/TrackingRecHit2DHeterogeneous.h @@ -16,6 +16,7 @@ class TrackingRecHit2DHeterogeneous { explicit TrackingRecHit2DHeterogeneous( uint32_t nHits, + int32_t offsetBPIX2, pixelCPEforGPU::ParamsOnGPU const* cpeParams, uint32_t const* hitsModuleStart, cudaStream_t stream, @@ -32,6 +33,7 @@ class TrackingRecHit2DHeterogeneous { TrackingRecHit2DSOAView const* view() const { return m_view.get(); } auto nHits() const { return m_nHits; } + auto offsetBPIX2() const { return m_offsetBPIX2; } auto hitsModuleStart() const { return m_hitsModuleStart; } auto hitsLayerStart() { return m_hitsLayerStart; } @@ -60,6 +62,7 @@ class TrackingRecHit2DHeterogeneous { unique_ptr m_view; //! uint32_t m_nHits; + int32_t m_offsetBPIX2; uint32_t const* m_hitsModuleStart; // needed for legacy, this is on GPU! @@ -80,11 +83,12 @@ using TrackingRecHit2DHost = TrackingRecHit2DHeterogeneous TrackingRecHit2DHeterogeneous::TrackingRecHit2DHeterogeneous( uint32_t nHits, + int32_t offsetBPIX2, pixelCPEforGPU::ParamsOnGPU const* cpeParams, uint32_t const* hitsModuleStart, cudaStream_t stream, TrackingRecHit2DHeterogeneous const* input) - : m_nHits(nHits), m_hitsModuleStart(hitsModuleStart) { + : m_nHits(nHits), m_offsetBPIX2(offsetBPIX2), m_hitsModuleStart(hitsModuleStart) { auto view = Traits::template make_host_unique(stream); view->m_nHits = nHits; diff --git a/CUDADataFormats/TrackingRecHit/test/TrackingRecHit2DCUDA_t.cpp b/CUDADataFormats/TrackingRecHit/test/TrackingRecHit2DCUDA_t.cpp index 57db9583bfafb..cc1a708f24267 100644 --- a/CUDADataFormats/TrackingRecHit/test/TrackingRecHit2DCUDA_t.cpp +++ b/CUDADataFormats/TrackingRecHit/test/TrackingRecHit2DCUDA_t.cpp @@ -18,11 +18,11 @@ int main() { auto nHits = 200; // inner scope to deallocate memory before destroying the stream { - TrackingRecHit2DGPU tkhit(nHits, nullptr, nullptr, stream); + TrackingRecHit2DGPU tkhit(nHits, 0, nullptr, nullptr, stream); testTrackingRecHit2D::runKernels(tkhit.view()); - TrackingRecHit2DHost tkhitH(nHits, nullptr, nullptr, stream, &tkhit); + TrackingRecHit2DHost tkhitH(nHits, 0, nullptr, nullptr, stream, &tkhit); cudaStreamSynchronize(stream); assert(tkhitH.view()); assert(tkhitH.view()->nHits() == unsigned(nHits)); diff --git a/CalibCalorimetry/CaloMiscalibTools/interface/CaloMiscalibMapEcal.h b/CalibCalorimetry/CaloMiscalibTools/interface/CaloMiscalibMapEcal.h index 9ddfdc473c6cf..0ffd75d042e99 100644 --- a/CalibCalorimetry/CaloMiscalibTools/interface/CaloMiscalibMapEcal.h +++ b/CalibCalorimetry/CaloMiscalibTools/interface/CaloMiscalibMapEcal.h @@ -5,7 +5,6 @@ #include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h" #include "Geometry/Records/interface/IdealGeometryRecord.h" #include "Geometry/CaloGeometry/interface/CaloGeometry.h" -#include "FWCore/Framework/interface/EDProducer.h" #include "DataFormats/EcalDetId/interface/EBDetId.h" #include "DataFormats/EcalDetId/interface/EEDetId.h" #include diff --git a/CalibCalorimetry/CaloMiscalibTools/interface/CaloMiscalibMapHcal.h b/CalibCalorimetry/CaloMiscalibTools/interface/CaloMiscalibMapHcal.h index e70c7038d491f..4e549db20337b 100644 --- a/CalibCalorimetry/CaloMiscalibTools/interface/CaloMiscalibMapHcal.h +++ b/CalibCalorimetry/CaloMiscalibTools/interface/CaloMiscalibMapHcal.h @@ -4,7 +4,6 @@ #include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h" #include "Geometry/Records/interface/IdealGeometryRecord.h" #include "Geometry/CaloGeometry/interface/CaloGeometry.h" -#include "FWCore/Framework/interface/EDProducer.h" #include "DataFormats/HcalDetId/interface/HcalDetId.h" #include "DataFormats/HcalDetId/interface/HcalSubdetector.h" #include "Geometry/CaloTopology/interface/HcalTopology.h" diff --git a/CalibCalorimetry/CaloMiscalibTools/interface/CaloMiscalibTools.h b/CalibCalorimetry/CaloMiscalibTools/interface/CaloMiscalibTools.h index 05b35da8b158b..6f4c36f36074e 100644 --- a/CalibCalorimetry/CaloMiscalibTools/interface/CaloMiscalibTools.h +++ b/CalibCalorimetry/CaloMiscalibTools/interface/CaloMiscalibTools.h @@ -36,7 +36,6 @@ #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/Framework/interface/EventSetupRecordIntervalFinder.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/EventSetup.h" #include "CondFormats/EcalObjects/interface/EcalIntercalibConstants.h" #include "CondFormats/DataRecord/interface/EcalIntercalibConstantsRcd.h" diff --git a/CalibCalorimetry/CaloMiscalibTools/interface/CaloMiscalibToolsMC.h b/CalibCalorimetry/CaloMiscalibTools/interface/CaloMiscalibToolsMC.h index da451d3c98cd6..d68efe81f4b57 100644 --- a/CalibCalorimetry/CaloMiscalibTools/interface/CaloMiscalibToolsMC.h +++ b/CalibCalorimetry/CaloMiscalibTools/interface/CaloMiscalibToolsMC.h @@ -36,7 +36,6 @@ #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/Framework/interface/EventSetupRecordIntervalFinder.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/EventSetup.h" #include "CondFormats/EcalObjects/interface/EcalIntercalibConstantsMC.h" #include "CondFormats/DataRecord/interface/EcalIntercalibConstantsMCRcd.h" diff --git a/CalibCalorimetry/CaloMiscalibTools/interface/EcalRecHitRecalib.h b/CalibCalorimetry/CaloMiscalibTools/interface/EcalRecHitRecalib.h index b2cc951b731d7..7ea8d207decaa 100644 --- a/CalibCalorimetry/CaloMiscalibTools/interface/EcalRecHitRecalib.h +++ b/CalibCalorimetry/CaloMiscalibTools/interface/EcalRecHitRecalib.h @@ -23,18 +23,21 @@ // user include files #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDProducer.h" +#include "FWCore/Framework/interface/stream/EDProducer.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" +#include "CondFormats/EcalObjects/interface/EcalIntercalibConstants.h" +#include "CondFormats/DataRecord/interface/EcalIntercalibConstantsRcd.h" // // class decleration // -class EcalRecHitRecalib : public edm::EDProducer { +class EcalRecHitRecalib : public edm::stream::EDProducer<> { public: explicit EcalRecHitRecalib(const edm::ParameterSet &); ~EcalRecHitRecalib() override; @@ -44,13 +47,19 @@ class EcalRecHitRecalib : public edm::EDProducer { private: // ----------member data --------------------------- - std::string ecalHitsProducer_; - std::string barrelHits_; - std::string endcapHits_; - std::string RecalibBarrelHits_; - std::string RecalibEndcapHits_; - double refactor_; - double refactor_mean_; + const std::string ecalHitsProducer_; + const std::string barrelHits_; + const std::string endcapHits_; + const std::string recalibBarrelHits_; + const std::string recalibEndcapHits_; + const double refactor_; + const double refactor_mean_; + + const edm::EDGetTokenT ebRecHitToken_; + const edm::EDGetTokenT eeRecHitToken_; + const edm::ESGetToken intercalibConstsToken_; + const edm::EDPutTokenT barrelHitsToken_; + const edm::EDPutTokenT endcapHitsToken_; }; #endif diff --git a/CalibCalorimetry/CaloMiscalibTools/interface/HcalRecHitRecalib.h b/CalibCalorimetry/CaloMiscalibTools/interface/HcalRecHitRecalib.h index 57874afc9f098..963b370327575 100644 --- a/CalibCalorimetry/CaloMiscalibTools/interface/HcalRecHitRecalib.h +++ b/CalibCalorimetry/CaloMiscalibTools/interface/HcalRecHitRecalib.h @@ -23,7 +23,7 @@ // user include files #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDProducer.h" +#include "FWCore/Framework/interface/stream/EDProducer.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" @@ -32,8 +32,9 @@ #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "CalibCalorimetry/CaloMiscalibTools/interface/CaloMiscalibMapHcal.h" #include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h" +#include "Geometry/Records/interface/HcalRecNumberingRecord.h" -class HcalRecHitRecalib : public edm::EDProducer { +class HcalRecHitRecalib : public edm::stream::EDProducer<> { public: explicit HcalRecHitRecalib(const edm::ParameterSet &); ~HcalRecHitRecalib() override; @@ -42,18 +43,19 @@ class HcalRecHitRecalib : public edm::EDProducer { void produce(edm::Event &, const edm::EventSetup &) override; private: - edm::EDGetTokenT tok_hbhe_; - edm::EDGetTokenT tok_ho_; - edm::EDGetTokenT tok_hf_; - std::string RecalibHBHEHits_; - std::string RecalibHFHits_; - std::string RecalibHOHits_; + const edm::EDGetTokenT tok_hbhe_; + const edm::EDGetTokenT tok_ho_; + const edm::EDGetTokenT tok_hf_; + const edm::ESGetToken topologyToken_; + const std::string recalibHBHEHits_; + const std::string recalibHFHits_; + const std::string recalibHOHits_; std::string hcalfile_; - std::string hcalfileinpath_; + const std::string hcalfileinpath_; CaloMiscalibMapHcal mapHcal_; - double refactor_; - double refactor_mean_; + const double refactor_; + const double refactor_mean_; }; #endif diff --git a/CalibCalorimetry/CaloMiscalibTools/interface/WriteEcalMiscalibConstants.h b/CalibCalorimetry/CaloMiscalibTools/interface/WriteEcalMiscalibConstants.h index a275dcce6c143..1bc733a246728 100644 --- a/CalibCalorimetry/CaloMiscalibTools/interface/WriteEcalMiscalibConstants.h +++ b/CalibCalorimetry/CaloMiscalibTools/interface/WriteEcalMiscalibConstants.h @@ -11,17 +11,20 @@ // user include files #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" + +#include "CondFormats/EcalObjects/interface/EcalIntercalibConstants.h" +#include "CondFormats/DataRecord/interface/EcalIntercalibConstantsRcd.h" // // class decleration // -class WriteEcalMiscalibConstants : public edm::EDAnalyzer { +class WriteEcalMiscalibConstants : public edm::one::EDAnalyzer<> { public: explicit WriteEcalMiscalibConstants(const edm::ParameterSet&); ~WriteEcalMiscalibConstants() override; @@ -33,4 +36,6 @@ class WriteEcalMiscalibConstants : public edm::EDAnalyzer { // ----------member data --------------------------- std::string newTagRequest_; + + const edm::ESGetToken intercalibConstsToken_; }; diff --git a/CalibCalorimetry/CaloMiscalibTools/interface/WriteEcalMiscalibConstantsMC.h b/CalibCalorimetry/CaloMiscalibTools/interface/WriteEcalMiscalibConstantsMC.h index 9b4577cdd1053..64eeafacc6011 100644 --- a/CalibCalorimetry/CaloMiscalibTools/interface/WriteEcalMiscalibConstantsMC.h +++ b/CalibCalorimetry/CaloMiscalibTools/interface/WriteEcalMiscalibConstantsMC.h @@ -11,17 +11,20 @@ // user include files #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" + +#include "CondFormats/EcalObjects/interface/EcalIntercalibConstantsMC.h" +#include "CondFormats/DataRecord/interface/EcalIntercalibConstantsMCRcd.h" // // class decleration // -class WriteEcalMiscalibConstantsMC : public edm::EDAnalyzer { +class WriteEcalMiscalibConstantsMC : public edm::one::EDAnalyzer<> { public: explicit WriteEcalMiscalibConstantsMC(const edm::ParameterSet&); ~WriteEcalMiscalibConstantsMC() override; @@ -33,4 +36,6 @@ class WriteEcalMiscalibConstantsMC : public edm::EDAnalyzer { // ----------member data --------------------------- std::string newTagRequest_; + + const edm::ESGetToken intercalibConstsToken_; }; diff --git a/CalibCalorimetry/CaloMiscalibTools/plugins/CaloMiscalibTools.cc b/CalibCalorimetry/CaloMiscalibTools/plugins/CaloMiscalibTools.cc index 77c34d8532ee3..0ba0639b1e844 100644 --- a/CalibCalorimetry/CaloMiscalibTools/plugins/CaloMiscalibTools.cc +++ b/CalibCalorimetry/CaloMiscalibTools/plugins/CaloMiscalibTools.cc @@ -25,6 +25,7 @@ // user include files #include "CalibCalorimetry/CaloMiscalibTools/interface/CaloMiscalibTools.h" #include "FWCore/ParameterSet/interface/FileInPath.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" #include "CalibCalorimetry/CaloMiscalibTools/interface/MiscalibReaderFromXMLEcalBarrel.h" #include "CalibCalorimetry/CaloMiscalibTools/interface/MiscalibReaderFromXMLEcalEndcap.h" @@ -45,8 +46,8 @@ CaloMiscalibTools::CaloMiscalibTools(const edm::ParameterSet& iConfig) { barrelfile_ = barrelfiletmp.fullPath(); endcapfile_ = endcapfiletmp.fullPath(); - std::cout << "Barrel file is:" << barrelfile_ << std::endl; - std::cout << "endcap file is:" << endcapfile_ << std::endl; + edm::LogVerbatim("CaloMiscalibTools") << "Barrel file is:" << barrelfile_; + edm::LogVerbatim("CaloMiscalibTools") << "endcap file is:" << endcapfile_; // added by Zhen (changed since 1_2_0) setWhatProduced(this, &CaloMiscalibTools::produce); @@ -75,9 +76,7 @@ CaloMiscalibTools::ReturnType CaloMiscalibTools::produce(const EcalIntercalibCon endcapreader_.parseXMLMiscalibFile(endcapfile_); map.print(); // Added by Zhen, need a new object so to not be deleted at exit - // std::cout<<"about to copy"<(map.get()); - // std::cout<<"mydata "<(map.get()); - // std::cout<<"mydata "<("ecalRecHitsProducer"); - barrelHits_ = iConfig.getParameter("barrelHitCollection"); - endcapHits_ = iConfig.getParameter("endcapHitCollection"); - RecalibBarrelHits_ = iConfig.getParameter("RecalibBarrelHitCollection"); - RecalibEndcapHits_ = iConfig.getParameter("RecalibEndcapHitCollection"); - refactor_ = iConfig.getUntrackedParameter("Refactor", (double)1); - refactor_mean_ = iConfig.getUntrackedParameter("Refactor_mean", (double)1); - - //register your products - produces(RecalibBarrelHits_); - produces(RecalibEndcapHits_); -} +EcalRecHitRecalib::EcalRecHitRecalib(const edm::ParameterSet& iConfig) + : ecalHitsProducer_(iConfig.getParameter("ecalRecHitsProducer")), + barrelHits_(iConfig.getParameter("barrelHitCollection")), + endcapHits_(iConfig.getParameter("endcapHitCollection")), + recalibBarrelHits_(iConfig.getParameter("RecalibBarrelHitCollection")), + recalibEndcapHits_(iConfig.getParameter("RecalibEndcapHitCollection")), + refactor_(iConfig.getUntrackedParameter("Refactor", (double)1)), + refactor_mean_(iConfig.getUntrackedParameter("Refactor_mean", (double)1)), + ebRecHitToken_(consumes(edm::InputTag(ecalHitsProducer_, barrelHits_))), + eeRecHitToken_(consumes(edm::InputTag(ecalHitsProducer_, endcapHits_))), + intercalibConstsToken_(esConsumes()), + barrelHitsToken_(produces(recalibBarrelHits_)), + endcapHitsToken_(produces(recalibEndcapHits_)) {} EcalRecHitRecalib::~EcalRecHitRecalib() {} @@ -39,14 +33,14 @@ void EcalRecHitRecalib::produce(edm::Event& iEvent, const edm::EventSetup& iSetu const EBRecHitCollection* EBRecHits = nullptr; const EERecHitCollection* EERecHits = nullptr; - iEvent.getByLabel(ecalHitsProducer_, barrelHits_, barrelRecHitsHandle); + iEvent.getByToken(ebRecHitToken_, barrelRecHitsHandle); if (!barrelRecHitsHandle.isValid()) { LogDebug("") << "EcalREcHitMiscalib: Error! can't get product!" << std::endl; } else { EBRecHits = barrelRecHitsHandle.product(); // get a ptr to the product } - iEvent.getByLabel(ecalHitsProducer_, endcapHits_, endcapRecHitsHandle); + iEvent.getByToken(eeRecHitToken_, endcapRecHitsHandle); if (!endcapRecHitsHandle.isValid()) { LogDebug("") << "EcalREcHitMiscalib: Error! can't get product!" << std::endl; } else { @@ -58,21 +52,18 @@ void EcalRecHitRecalib::produce(edm::Event& iEvent, const edm::EventSetup& iSetu auto RecalibEERecHitCollection = std::make_unique(); // Intercalib constants - edm::ESHandle pIcal; - iSetup.get().get(pIcal); - const EcalIntercalibConstants* ical = pIcal.product(); + const EcalIntercalibConstants& ical = iSetup.getData(intercalibConstsToken_); if (EBRecHits) { //loop on all EcalRecHits (barrel) EBRecHitCollection::const_iterator itb; for (itb = EBRecHits->begin(); itb != EBRecHits->end(); ++itb) { // find intercalib constant for this xtal - EcalIntercalibConstantMap::const_iterator icalit = ical->getMap().find(itb->id().rawId()); + EcalIntercalibConstantMap::const_iterator icalit = ical.getMap().find(itb->id().rawId()); EcalIntercalibConstant icalconst = -1; - if (icalit != ical->getMap().end()) { + if (icalit != ical.getMap().end()) { icalconst = (*icalit); - // edm::LogDebug("EcalRecHitRecalib") << "Found intercalib for xtal " << EBDetId(itb->id()) << " " << icalconst ; } else { edm::LogError("EcalRecHitRecalib") << "No intercalib const found for xtal " << EBDetId(itb->id()) @@ -93,12 +84,11 @@ void EcalRecHitRecalib::produce(edm::Event& iEvent, const edm::EventSetup& iSetu EERecHitCollection::const_iterator ite; for (ite = EERecHits->begin(); ite != EERecHits->end(); ++ite) { // find intercalib constant for this xtal - EcalIntercalibConstantMap::const_iterator icalit = ical->getMap().find(ite->id().rawId()); + EcalIntercalibConstantMap::const_iterator icalit = ical.getMap().find(ite->id().rawId()); EcalIntercalibConstant icalconst = -1; - if (icalit != ical->getMap().end()) { + if (icalit != ical.getMap().end()) { icalconst = (*icalit); - // edm:: LogDebug("EcalRecHitRecalib") << "Found intercalib for xtal " << EEDetId(ite->id()) << " " << icalconst ; } else { edm::LogError("EcalRecHitRecalib") << "No intercalib const found for xtal " << EEDetId(ite->id()) << "! something wrong with EcalIntercalibConstants in your DB? "; @@ -115,6 +105,6 @@ void EcalRecHitRecalib::produce(edm::Event& iEvent, const edm::EventSetup& iSetu } //Put Recalibrated rechit in the event - iEvent.put(std::move(RecalibEBRecHitCollection), RecalibBarrelHits_); - iEvent.put(std::move(RecalibEERecHitCollection), RecalibEndcapHits_); + iEvent.put(barrelHitsToken_, std::move(RecalibEBRecHitCollection)); + iEvent.put(endcapHitsToken_, std::move(RecalibEERecHitCollection)); } diff --git a/CalibCalorimetry/CaloMiscalibTools/plugins/HcalRecHitRecalib.cc b/CalibCalorimetry/CaloMiscalibTools/plugins/HcalRecHitRecalib.cc index 9c1dd235f249a..3db40e4805270 100644 --- a/CalibCalorimetry/CaloMiscalibTools/plugins/HcalRecHitRecalib.cc +++ b/CalibCalorimetry/CaloMiscalibTools/plugins/HcalRecHitRecalib.cc @@ -2,52 +2,38 @@ #include "DataFormats/Common/interface/Handle.h" #include "DataFormats/HcalDetId/interface/HcalDetId.h" -#include "Geometry/Records/interface/HcalRecNumberingRecord.h" #include "FWCore/ParameterSet/interface/FileInPath.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "CalibCalorimetry/CaloMiscalibTools/interface/MiscalibReaderFromXMLHcal.h" -HcalRecHitRecalib::HcalRecHitRecalib(const edm::ParameterSet& iConfig) { - tok_hbhe_ = consumes(iConfig.getParameter("hbheInput")); - tok_ho_ = consumes(iConfig.getParameter("hoInput")); - tok_hf_ = consumes(iConfig.getParameter("hfInput")); - - // HBHEHitsProducer_ = iConfig.getParameter< std::string > ("HBHERecHitsProducer"); - // HOHitsProducer_ = iConfig.getParameter< std::string > ("HERecHitsProducer"); - // HFHitsProducer_ = iConfig.getParameter< std::string > ("HERecHitsProducer"); - // HBHEHits_ = iConfig.getParameter< std::string > ("HBHEHitCollection"); - // HFHits_ = iConfig.getParameter< std::string > ("HFHitCollection"); - // HOHits_ = iConfig.getParameter< std::string > ("HOHitCollection"); - - RecalibHBHEHits_ = iConfig.getParameter("RecalibHBHEHitCollection"); - RecalibHFHits_ = iConfig.getParameter("RecalibHFHitCollection"); - RecalibHOHits_ = iConfig.getParameter("RecalibHOHitCollection"); - - refactor_ = iConfig.getUntrackedParameter("Refactor", (double)1); - refactor_mean_ = iConfig.getUntrackedParameter("Refactor_mean", (double)1); - +HcalRecHitRecalib::HcalRecHitRecalib(const edm::ParameterSet& iConfig) + : tok_hbhe_(consumes(iConfig.getParameter("hbheInput"))), + tok_ho_(consumes(iConfig.getParameter("hoInput"))), + tok_hf_(consumes(iConfig.getParameter("hfInput"))), + topologyToken_(esConsumes()), + recalibHBHEHits_(iConfig.getParameter("RecalibHBHEHitCollection")), + recalibHFHits_(iConfig.getParameter("RecalibHFHitCollection")), + recalibHOHits_(iConfig.getParameter("RecalibHOHitCollection")), + hcalfileinpath_(iConfig.getUntrackedParameter("fileNameHcal", "")), + refactor_(iConfig.getUntrackedParameter("Refactor", (double)1)), + refactor_mean_(iConfig.getUntrackedParameter("Refactor_mean", (double)1)) { //register your products - produces(RecalibHBHEHits_); - produces(RecalibHFHits_); - produces(RecalibHOHits_); + produces(recalibHBHEHits_); + produces(recalibHFHits_); + produces(recalibHOHits_); // here read them from xml (particular to HCAL) - - hcalfileinpath_ = iConfig.getUntrackedParameter("fileNameHcal", ""); edm::FileInPath hcalfiletmp("CalibCalorimetry/CaloMiscalibTools/data/" + hcalfileinpath_); - hcalfile_ = hcalfiletmp.fullPath(); } HcalRecHitRecalib::~HcalRecHitRecalib() {} void HcalRecHitRecalib::beginRun(const edm::Run&, const edm::EventSetup& iSetup) { - edm::ESHandle topology; - iSetup.get().get(topology); + const HcalTopology& topology = iSetup.getData(topologyToken_); - mapHcal_.prefillMap(*topology); + mapHcal_.prefillMap(topology); MiscalibReaderFromXMLHcal hcalreader_(mapHcal_); if (!hcalfile_.empty()) @@ -89,46 +75,16 @@ void HcalRecHitRecalib::produce(edm::Event& iEvent, const edm::EventSetup& iSetu HFRecHits = HFRecHitsHandle.product(); // get a ptr to the product } - // iEvent.getByLabel(HBHEHitsProducer_,HBHEHits_,HBHERecHitsHandle); - // HBHERecHits = HBHERecHitsHandle.product(); // get a ptr to the product - - // iEvent.getByLabel(HFHitsProducer_,HFHits_,HFRecHitsHandle); - // HFRecHits = HFRecHitsHandle.product(); // get a ptr to the product - - // iEvent.getByLabel(HOHitsProducer_,HOHits_,HORecHitsHandle); - // HORecHits = HORecHitsHandle.product(); // get a ptr to the product - //Create empty output collections auto RecalibHBHERecHitCollection = std::make_unique(); auto RecalibHFRecHitCollection = std::make_unique(); auto RecalibHORecHitCollection = std::make_unique(); - // Intercalib constants - // edm::ESHandle pIcal; - // iSetup.get().get(pIcal); - // const EcalIntercalibConstants* ical = pIcal.product(); - if (HBHERecHits) { - //loop on all EcalRecHits (barrel) HBHERecHitCollection::const_iterator itHBHE; for (itHBHE = HBHERecHits->begin(); itHBHE != HBHERecHits->end(); ++itHBHE) { - // find intercalib constant for this cell - - // EcalIntercalibConstants::EcalIntercalibConstantMap::const_iterator icalit=ical->getMap().find(itb->id().rawId()); - // EcalIntercalibConstants::EcalIntercalibConstant icalconst; - - // if( icalit!=ical->getMap().end() ){ - // icalconst = icalit->second; - // edm::LogDebug("EcalRecHitMiscalib") << "Found intercalib for xtal " << EBDetId(itb->id()) << " " << icalconst ; - - // } else { - // edm::LogError("EcalRecHitMiscalib") << "No intercalib const found for xtal " << EBDetId(itb->id()) << "! something wrong with EcalIntercalibConstants in your DB? " - // ; - // } - - float icalconst = (mapHcal_.get().find(itHBHE->id().rawId()))->second; // make the rechit with rescaled energy and put in the output collection - + float icalconst = (mapHcal_.get().find(itHBHE->id().rawId()))->second; icalconst = refactor_mean_ + (icalconst - refactor_mean_) * refactor_; //apply additional scaling factor (works if gaussian) HBHERecHit aHit(itHBHE->id(), itHBHE->energy() * icalconst, itHBHE->time()); @@ -138,25 +94,9 @@ void HcalRecHitRecalib::produce(edm::Event& iEvent, const edm::EventSetup& iSetu } if (HFRecHits) { - //loop on all EcalRecHits (barrel) HFRecHitCollection::const_iterator itHF; for (itHF = HFRecHits->begin(); itHF != HFRecHits->end(); ++itHF) { - // find intercalib constant for this cell - - // EcalIntercalibConstants::EcalIntercalibConstantMap::const_iterator icalit=ical->getMap().find(itb->id().rawId()); - // EcalIntercalibConstants::EcalIntercalibConstant icalconst; - - // if( icalit!=ical->getMap().end() ){ - // icalconst = icalit->second; - // edm::LogDebug("EcalRecHitMiscalib") << "Found intercalib for xtal " << EBDetId(itb->id()) << " " << icalconst ; - - // } else { - // edm::LogError("EcalRecHitMiscalib") << "No intercalib const found for xtal " << EBDetId(itb->id()) << "! something wrong with EcalIntercalibConstants in your DB? " - // ; - // } - // make the rechit with rescaled energy and put in the output collection - float icalconst = (mapHcal_.get().find(itHF->id().rawId()))->second; icalconst = refactor_mean_ + (icalconst - refactor_mean_) * refactor_; //apply additional scaling factor (works if gaussian) @@ -167,25 +107,9 @@ void HcalRecHitRecalib::produce(edm::Event& iEvent, const edm::EventSetup& iSetu } if (HORecHits) { - //loop on all EcalRecHits (barrel) HORecHitCollection::const_iterator itHO; for (itHO = HORecHits->begin(); itHO != HORecHits->end(); ++itHO) { - // find intercalib constant for this cell - - // EcalIntercalibConstants::EcalIntercalibConstantMap::const_iterator icalit=ical->getMap().find(itb->id().rawId()); - // EcalIntercalibConstants::EcalIntercalibConstant icalconst; - - // if( icalit!=ical->getMap().end() ){ - // icalconst = icalit->second; - // edm::LogDebug("EcalRecHitMiscalib") << "Found intercalib for xtal " << EBDetId(itb->id()) << " " << icalconst ; - - // } else { - // edm::LogError("EcalRecHitMiscalib") << "No intercalib const found for xtal " << EBDetId(itb->id()) << "! something wrong with EcalIntercalibConstants in your DB? " - // ; - // } - // make the rechit with rescaled energy and put in the output collection - float icalconst = (mapHcal_.get().find(itHO->id().rawId()))->second; icalconst = refactor_mean_ + (icalconst - refactor_mean_) * refactor_; //apply additional scaling factor (works if gaussian) @@ -196,7 +120,7 @@ void HcalRecHitRecalib::produce(edm::Event& iEvent, const edm::EventSetup& iSetu } //Put Recalibrated rechit in the event - iEvent.put(std::move(RecalibHBHERecHitCollection), RecalibHBHEHits_); - iEvent.put(std::move(RecalibHFRecHitCollection), RecalibHFHits_); - iEvent.put(std::move(RecalibHORecHitCollection), RecalibHOHits_); + iEvent.put(std::move(RecalibHBHERecHitCollection), recalibHBHEHits_); + iEvent.put(std::move(RecalibHFRecHitCollection), recalibHFHits_); + iEvent.put(std::move(RecalibHORecHitCollection), recalibHOHits_); } diff --git a/CalibCalorimetry/CaloMiscalibTools/plugins/WriteEcalMiscalibConstants.cc b/CalibCalorimetry/CaloMiscalibTools/plugins/WriteEcalMiscalibConstants.cc index 0847724a04d78..9261bdb7ab3fb 100644 --- a/CalibCalorimetry/CaloMiscalibTools/plugins/WriteEcalMiscalibConstants.cc +++ b/CalibCalorimetry/CaloMiscalibTools/plugins/WriteEcalMiscalibConstants.cc @@ -16,23 +16,15 @@ // // -// system include files -#include - // user include files - -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" // DB includes #include "FWCore/ServiceRegistry/interface/Service.h" #include "CondCore/DBOutputService/interface/PoolDBOutputService.h" // user include files -#include "CondFormats/EcalObjects/interface/EcalIntercalibConstants.h" -#include "CondFormats/DataRecord/interface/EcalIntercalibConstantsRcd.h" -//For Checks - //this one #include "CalibCalorimetry/CaloMiscalibTools/interface/WriteEcalMiscalibConstants.h" @@ -43,15 +35,10 @@ // // constructors and destructor // -WriteEcalMiscalibConstants::WriteEcalMiscalibConstants(const edm::ParameterSet& iConfig) { - //now do what ever initialization is needed - newTagRequest_ = iConfig.getParameter("NewTagRequest"); -} +WriteEcalMiscalibConstants::WriteEcalMiscalibConstants(const edm::ParameterSet& iConfig) + : newTagRequest_(iConfig.getParameter("NewTagRequest")), intercalibConstsToken_(esConsumes()) {} -WriteEcalMiscalibConstants::~WriteEcalMiscalibConstants() { - // do anything here that needs to be done at desctruction time - // (e.g. close files, deallocate resources etc.) -} +WriteEcalMiscalibConstants::~WriteEcalMiscalibConstants() {} // // member functions @@ -61,20 +48,17 @@ WriteEcalMiscalibConstants::~WriteEcalMiscalibConstants() { void WriteEcalMiscalibConstants::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { using namespace edm; // Intercalib constants - edm::ESHandle pIcal; - iSetup.get().get(pIcal); - const EcalIntercalibConstants* Mcal = pIcal.product(); + const EcalIntercalibConstants* Mcal = &iSetup.getData(intercalibConstsToken_); edm::Service poolDbService; if (poolDbService.isAvailable()) { if (poolDbService->isNewTagRequest(newTagRequest_)) { - std::cout << " Creating a new one " << std::endl; - poolDbService->createNewIOV( - Mcal, poolDbService->beginOfTime(), poolDbService->endOfTime(), newTagRequest_); - std::cout << "Done" << std::endl; + edm::LogVerbatim("WriteEcalMiscalibConstants") << "Creating a new IOV"; + poolDbService->createOneIOV(*Mcal, poolDbService->beginOfTime(), newTagRequest_); + edm::LogVerbatim("WriteEcalMiscalibConstants") << "Done"; } else { - std::cout << "Old One " << std::endl; - poolDbService->appendSinceTime(Mcal, poolDbService->currentTime(), newTagRequest_); + edm::LogVerbatim("WriteEcalMiscalibConstants") << "Old IOV"; + poolDbService->appendOneIOV(*Mcal, poolDbService->currentTime(), newTagRequest_); } } } @@ -83,8 +67,4 @@ void WriteEcalMiscalibConstants::analyze(const edm::Event& iEvent, const edm::Ev void WriteEcalMiscalibConstants::beginJob() {} // ------------ method called once each job just after ending the event loop ------------ -void - -WriteEcalMiscalibConstants::endJob() { - std::cout << "Here is the end" << std::endl; -} +void WriteEcalMiscalibConstants::endJob() { edm::LogVerbatim("WriteEcalMiscalibConstants") << "Here is the end"; } diff --git a/CalibCalorimetry/CaloMiscalibTools/plugins/WriteEcalMiscalibConstantsMC.cc b/CalibCalorimetry/CaloMiscalibTools/plugins/WriteEcalMiscalibConstantsMC.cc index f43abd36c1b1c..3e37d5f5ac947 100644 --- a/CalibCalorimetry/CaloMiscalibTools/plugins/WriteEcalMiscalibConstantsMC.cc +++ b/CalibCalorimetry/CaloMiscalibTools/plugins/WriteEcalMiscalibConstantsMC.cc @@ -16,23 +16,15 @@ // // -// system include files -#include - // user include files - -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" // DB includes #include "FWCore/ServiceRegistry/interface/Service.h" #include "CondCore/DBOutputService/interface/PoolDBOutputService.h" // user include files -#include "CondFormats/EcalObjects/interface/EcalIntercalibConstantsMC.h" -#include "CondFormats/DataRecord/interface/EcalIntercalibConstantsMCRcd.h" -//For Checks - //this one #include "CalibCalorimetry/CaloMiscalibTools/interface/WriteEcalMiscalibConstantsMC.h" @@ -43,15 +35,10 @@ // // constructors and destructor // -WriteEcalMiscalibConstantsMC::WriteEcalMiscalibConstantsMC(const edm::ParameterSet& iConfig) { - //now do what ever initialization is needed - newTagRequest_ = iConfig.getParameter("NewTagRequest"); -} +WriteEcalMiscalibConstantsMC::WriteEcalMiscalibConstantsMC(const edm::ParameterSet& iConfig) + : newTagRequest_(iConfig.getParameter("NewTagRequest")), intercalibConstsToken_(esConsumes()) {} -WriteEcalMiscalibConstantsMC::~WriteEcalMiscalibConstantsMC() { - // do anything here that needs to be done at desctruction time - // (e.g. close files, deallocate resources etc.) -} +WriteEcalMiscalibConstantsMC::~WriteEcalMiscalibConstantsMC() {} // // member functions @@ -61,21 +48,17 @@ WriteEcalMiscalibConstantsMC::~WriteEcalMiscalibConstantsMC() { void WriteEcalMiscalibConstantsMC::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { using namespace edm; // Intercalib constants - edm::ESHandle pIcal; - iSetup.get().get(pIcal); - const EcalIntercalibConstantsMC* Mcal = pIcal.product(); + const EcalIntercalibConstantsMC* Mcal = &iSetup.getData(intercalibConstsToken_); edm::Service poolDbService; if (poolDbService.isAvailable()) { if (poolDbService->isNewTagRequest(newTagRequest_)) { - std::cout << " Creating a new one " << std::endl; - poolDbService->createNewIOV( - Mcal, poolDbService->beginOfTime(), poolDbService->endOfTime(), newTagRequest_); - std::cout << "Done" << std::endl; + edm::LogVerbatim("WriteEcalMiscalibConstantsMC") << "Creating a new IOV"; + poolDbService->createOneIOV(*Mcal, poolDbService->beginOfTime(), newTagRequest_); + edm::LogVerbatim("WriteEcalMiscalibConstantsMC") << "Done"; } else { - std::cout << "Old One " << std::endl; - poolDbService->appendSinceTime( - Mcal, poolDbService->currentTime(), newTagRequest_); + edm::LogVerbatim("WriteEcalMiscalibConstantsMC") << "Old IOV"; + poolDbService->appendOneIOV(*Mcal, poolDbService->currentTime(), newTagRequest_); } } } @@ -84,8 +67,4 @@ void WriteEcalMiscalibConstantsMC::analyze(const edm::Event& iEvent, const edm:: void WriteEcalMiscalibConstantsMC::beginJob() {} // ------------ method called once each job just after ending the event loop ------------ -void - -WriteEcalMiscalibConstantsMC::endJob() { - std::cout << "Here is the end" << std::endl; -} +void WriteEcalMiscalibConstantsMC::endJob() { edm::LogVerbatim("WriteEcalMiscalibConstantsMC") << "Here is the end"; } diff --git a/CalibCalorimetry/CaloMiscalibTools/test/writeXMLinSqlite.py b/CalibCalorimetry/CaloMiscalibTools/test/writeXMLinSqlite.py index 0c8590990e645..7e670304126ce 100644 --- a/CalibCalorimetry/CaloMiscalibTools/test/writeXMLinSqlite.py +++ b/CalibCalorimetry/CaloMiscalibTools/test/writeXMLinSqlite.py @@ -36,7 +36,7 @@ ) process.prefer("CaloMiscalibTools") -process.WriteInDB = cms.EDFilter("WriteEcalMiscalibConstants", +process.WriteInDB = cms.EDAnalyzer("WriteEcalMiscalibConstants", NewTagRequest = cms.string('EcalIntercalibConstantsRcd') ) diff --git a/CalibCalorimetry/CaloMiscalibTools/test/writeXMLinSqliteMC.py b/CalibCalorimetry/CaloMiscalibTools/test/writeXMLinSqliteMC.py index 7b15c2c40562f..ec3b9b78cbd6d 100644 --- a/CalibCalorimetry/CaloMiscalibTools/test/writeXMLinSqliteMC.py +++ b/CalibCalorimetry/CaloMiscalibTools/test/writeXMLinSqliteMC.py @@ -31,12 +31,12 @@ ) process.CaloMiscalibToolsMC = cms.ESSource("CaloMiscalibToolsMC", - fileNameBarrel = cms.untracked.string('inv_EcalIntercalibConstants_EB_startup.xml'), - fileNameEndcap = cms.untracked.string('inv_EcalIntercalibConstants_EE_startup.xml') + fileNameBarrel = cms.untracked.string('EcalIntercalibConstants_EB_startup.xml'), + fileNameEndcap = cms.untracked.string('EcalIntercalibConstants_EE_startup.xml') ) process.prefer("CaloMiscalibToolsMC") -process.WriteInDB = cms.EDFilter("WriteEcalMiscalibConstantsMC", +process.WriteInDB = cms.EDAnalyzer("WriteEcalMiscalibConstantsMC", NewTagRequest = cms.string('EcalIntercalibConstantsMCRcd') ) diff --git a/CalibCalorimetry/CastorCalib/interface/CastorLedAnalysis.h b/CalibCalorimetry/CastorCalib/interface/CastorLedAnalysis.h index 8171f971a3809..1c679a2b37890 100644 --- a/CalibCalorimetry/CastorCalib/interface/CastorLedAnalysis.h +++ b/CalibCalorimetry/CastorCalib/interface/CastorLedAnalysis.h @@ -2,7 +2,6 @@ #define CastorLedAnalysis_H #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" diff --git a/CalibCalorimetry/CastorCalib/interface/CastorPedestalAnalysis.h b/CalibCalorimetry/CastorCalib/interface/CastorPedestalAnalysis.h index 23e7d055ef289..b26a660041eba 100644 --- a/CalibCalorimetry/CastorCalib/interface/CastorPedestalAnalysis.h +++ b/CalibCalorimetry/CastorCalib/interface/CastorPedestalAnalysis.h @@ -2,7 +2,6 @@ #define CastorPedestalAnalysis_H #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" diff --git a/CalibCalorimetry/CastorCalib/interface/CastorPedestalsAnalysis.h b/CalibCalorimetry/CastorCalib/interface/CastorPedestalsAnalysis.h deleted file mode 100644 index c2273879efb80..0000000000000 --- a/CalibCalorimetry/CastorCalib/interface/CastorPedestalsAnalysis.h +++ /dev/null @@ -1,113 +0,0 @@ -#ifndef CastorPedestalsAnalysis_H -#define CastorPedestalsAnalysis_H - -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/MakerMacros.h" -#include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/ServiceRegistry/interface/Service.h" -#include "FWCore/Utilities/interface/InputTag.h" - -#include "DataFormats/Common/interface/Handle.h" -#include "DataFormats/HcalDetId/interface/HcalGenericDetId.h" -#include "DataFormats/HcalDetId/interface/HcalElectronicsId.h" -#include "DataFormats/HcalDetId/interface/HcalDetId.h" -#include "DataFormats/HcalDigi/interface/HcalDigiCollections.h" -#include "DataFormats/DetId/interface/DetId.h" -#include "CondFormats/CastorObjects/interface/CastorPedestals.h" -#include "CondFormats/CastorObjects/interface/CastorPedestalWidths.h" -#include "CondFormats/CastorObjects/interface/CastorQIECoder.h" -#include "CondFormats/CastorObjects/interface/CastorQIEData.h" -#include "CondFormats/CastorObjects/interface/CastorQIEShape.h" -#include "CondFormats/CastorObjects/interface/CastorElectronicsMap.h" -#include "CondFormats/CastorObjects/interface/AllObjects.h" - -#include "CalibFormats/CastorObjects/interface/CastorDbRecord.h" -#include "CalibFormats/CastorObjects/interface/CastorDbService.h" -#include "CalibFormats/CastorObjects/interface/CastorCalibrations.h" -#include "CalibFormats/CastorObjects/interface/CastorCalibrationWidths.h" - -// #include "CondTools/Hcal/interface/HcalDbOnline.h" - -#include "CalibCalorimetry/CastorCalib/interface/CastorDbASCIIIO.h" -// #include "CalibCalorimetry/CastorCalib/interface/CastorCondXML.h" -#include "TBDataFormats/HcalTBObjects/interface/HcalTBTriggerData.h" - -#include "TFile.h" -#include "TProfile.h" -#include "TH1.h" -#include "TH2.h" -#include "TCanvas.h" -#include "TStyle.h" - -#include -#include -#include -#include -#include -#include -#include - -namespace edm { - class ParameterSet; - class Event; - class EventSetup; -} // namespace edm - -struct NewPedBunch { - HcalCastorDetId detid; - bool usedflag; - float cap[4]; - float capfc[4]; - float sig[4][4]; - float sigfc[4][4]; - float prod[4][4]; - float prodfc[4][4]; - int num[4][4]; -}; - -class CastorPedestalsAnalysis : public edm::EDAnalyzer { -public: - //Constructor - CastorPedestalsAnalysis(const edm::ParameterSet &ps); - //Destructor - ~CastorPedestalsAnalysis() override; - //Analysis - void analyze(const edm::Event &event, const edm::EventSetup &eventSetup) override; - -private: - //Container for data, 1 per channel - std::vector Bunches; - //Flag for saving histos - bool hiSaveFlag; - bool dumpXML; - bool verboseflag; - int runnum; - int firstTS; - int lastTS; - std::string ROOTfilename; - std::string pedsADCfilename; - std::string pedsfCfilename; - std::string widthsADCfilename; - std::string widthsfCfilename; - std::string XMLfilename; - std::string XMLtag; - std::string ZSfilename; - - edm::ESGetToken tok_cond_; - edm::ESGetToken tok_map_; - - TH1F *CASTORMeans; - TH1F *CASTORWidths; - - // TH2F *dephist[4]; - TH2F *dephist; - - TFile *theFile; - bool firsttime; - - edm::InputTag castorDigiCollectionTag; -}; -#endif diff --git a/CalibCalorimetry/CastorCalib/plugins/BuildFile.xml b/CalibCalorimetry/CastorCalib/plugins/BuildFile.xml index ecd05778404ef..b7f3976ba0c8f 100644 --- a/CalibCalorimetry/CastorCalib/plugins/BuildFile.xml +++ b/CalibCalorimetry/CastorCalib/plugins/BuildFile.xml @@ -1,5 +1,6 @@ + diff --git a/CalibCalorimetry/CastorCalib/plugins/CastorHardcodeCalibrations.cc b/CalibCalorimetry/CastorCalib/plugins/CastorHardcodeCalibrations.cc index ef7426c62de47..0f97bb2751411 100644 --- a/CalibCalorimetry/CastorCalib/plugins/CastorHardcodeCalibrations.cc +++ b/CalibCalorimetry/CastorCalib/plugins/CastorHardcodeCalibrations.cc @@ -1,10 +1,14 @@ // -*- C++ -*- +// ESSource to generate default HCAL/CASTOR calibration objects +// // Original Author: Fedor Ratnikov // Adapted for CASTOR by L. Mundim // -#include #include +#include +#include +#include #include "FWCore/Framework/interface/ValidityInterval.h" #include "DataFormats/HcalDetId/interface/HcalCastorDetId.h" @@ -26,7 +30,35 @@ #include "Geometry/CaloTopology/interface/HcalTopology.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "CastorHardcodeCalibrations.h" +#include "FWCore/Framework/interface/ESProducer.h" +#include "FWCore/Framework/interface/EventSetupRecordIntervalFinder.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" + +#include "CondFormats/CastorObjects/interface/AllObjects.h" + +class CastorHardcodeCalibrations : public edm::ESProducer, public edm::EventSetupRecordIntervalFinder { +public: + CastorHardcodeCalibrations(const edm::ParameterSet&); + ~CastorHardcodeCalibrations() override; + + void produce(){}; + +protected: + void setIntervalFor(const edm::eventsetup::EventSetupRecordKey&, + const edm::IOVSyncValue&, + edm::ValidityInterval&) override; + + std::unique_ptr producePedestals(const CastorPedestalsRcd& rcd); + std::unique_ptr producePedestalWidths(const CastorPedestalWidthsRcd& rcd); + std::unique_ptr produceGains(const CastorGainsRcd& rcd); + std::unique_ptr produceGainWidths(const CastorGainWidthsRcd& rcd); + std::unique_ptr produceQIEData(const CastorQIEDataRcd& rcd); + std::unique_ptr produceChannelQuality(const CastorChannelQualityRcd& rcd); + std::unique_ptr produceElectronicsMap(const CastorElectronicsMapRcd& rcd); + std::unique_ptr produceRecoParams(const CastorRecoParamsRcd& rcd); + std::unique_ptr produceSaturationCorrs(const CastorSaturationCorrsRcd& rcd); + bool h2mode_; +}; // class declaration // @@ -229,3 +261,8 @@ std::unique_ptr CastorHardcodeCalibrations::produceSatura } return result; } + +#include "FWCore/PluginManager/interface/ModuleDef.h" +#include "FWCore/Framework/interface/SourceFactory.h" + +DEFINE_FWK_EVENTSETUP_SOURCE(CastorHardcodeCalibrations); diff --git a/CalibCalorimetry/CastorCalib/plugins/CastorHardcodeCalibrations.h b/CalibCalorimetry/CastorCalib/plugins/CastorHardcodeCalibrations.h deleted file mode 100644 index c7f2e9aff2779..0000000000000 --- a/CalibCalorimetry/CastorCalib/plugins/CastorHardcodeCalibrations.h +++ /dev/null @@ -1,45 +0,0 @@ -// ESSource to generate default HCAL/CASTOR calibration objects -// -#include -#include - -#include "FWCore/Framework/interface/ESProducer.h" -#include "FWCore/Framework/interface/EventSetupRecordIntervalFinder.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" - -#include "CondFormats/CastorObjects/interface/AllObjects.h" -class ParameterSet; - -class CastorPedestalsRcd; -class CastorPedestalWidthsRcd; -class CastorGainsRcd; -class CastorGainWidthsRcd; -class CastorQIEDataRcd; -class CastorChannelQualityRcd; -class CastorElectronicsMapRcd; -class CastorRecoParamsRcd; -class CastorSaturationCorrsRcd; - -class CastorHardcodeCalibrations : public edm::ESProducer, public edm::EventSetupRecordIntervalFinder { -public: - CastorHardcodeCalibrations(const edm::ParameterSet&); - ~CastorHardcodeCalibrations() override; - - void produce(){}; - -protected: - void setIntervalFor(const edm::eventsetup::EventSetupRecordKey&, - const edm::IOVSyncValue&, - edm::ValidityInterval&) override; - - std::unique_ptr producePedestals(const CastorPedestalsRcd& rcd); - std::unique_ptr producePedestalWidths(const CastorPedestalWidthsRcd& rcd); - std::unique_ptr produceGains(const CastorGainsRcd& rcd); - std::unique_ptr produceGainWidths(const CastorGainWidthsRcd& rcd); - std::unique_ptr produceQIEData(const CastorQIEDataRcd& rcd); - std::unique_ptr produceChannelQuality(const CastorChannelQualityRcd& rcd); - std::unique_ptr produceElectronicsMap(const CastorElectronicsMapRcd& rcd); - std::unique_ptr produceRecoParams(const CastorRecoParamsRcd& rcd); - std::unique_ptr produceSaturationCorrs(const CastorSaturationCorrsRcd& rcd); - bool h2mode_; -}; diff --git a/CalibCalorimetry/CastorCalib/plugins/CastorPedestalsAnalysis.cc b/CalibCalorimetry/CastorCalib/plugins/CastorPedestalsAnalysis.cc index 05d5fdf0c9b04..9494e7af17f4e 100644 --- a/CalibCalorimetry/CastorCalib/plugins/CastorPedestalsAnalysis.cc +++ b/CalibCalorimetry/CastorCalib/plugins/CastorPedestalsAnalysis.cc @@ -5,11 +5,118 @@ // This code runs 1000x faster and produces all outputs from a single run // (ADC, fC in .txt plus an .xml file) // + +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ServiceRegistry/interface/Service.h" +#include "FWCore/Utilities/interface/InputTag.h" + +#include "CommonTools/UtilAlgos/interface/TFileService.h" +#include "DataFormats/Common/interface/Handle.h" +#include "DataFormats/HcalDetId/interface/HcalGenericDetId.h" +#include "DataFormats/HcalDetId/interface/HcalElectronicsId.h" +#include "DataFormats/HcalDetId/interface/HcalDetId.h" +#include "DataFormats/HcalDigi/interface/HcalDigiCollections.h" +#include "DataFormats/DetId/interface/DetId.h" +#include "CondFormats/CastorObjects/interface/CastorPedestals.h" +#include "CondFormats/CastorObjects/interface/CastorPedestalWidths.h" +#include "CondFormats/CastorObjects/interface/CastorQIECoder.h" +#include "CondFormats/CastorObjects/interface/CastorQIEData.h" +#include "CondFormats/CastorObjects/interface/CastorQIEShape.h" +#include "CondFormats/CastorObjects/interface/CastorElectronicsMap.h" +#include "CondFormats/CastorObjects/interface/AllObjects.h" + +#include "CalibFormats/CastorObjects/interface/CastorDbRecord.h" +#include "CalibFormats/CastorObjects/interface/CastorDbService.h" +#include "CalibFormats/CastorObjects/interface/CastorCalibrations.h" +#include "CalibFormats/CastorObjects/interface/CastorCalibrationWidths.h" + +#include "CalibCalorimetry/CastorCalib/interface/CastorDbASCIIIO.h" +#include "TBDataFormats/HcalTBObjects/interface/HcalTBTriggerData.h" + +#include "TProfile.h" +#include "TH1.h" +#include "TH2.h" +#include "TCanvas.h" +#include "TStyle.h" + +#include +#include +#include #include -#include "CalibCalorimetry/CastorCalib/interface/CastorPedestalsAnalysis.h" +#include +#include +#include +#include + +namespace edm { + class ParameterSet; + class Event; + class EventSetup; +} // namespace edm + +struct NewPedBunch { + HcalCastorDetId detid; + bool usedflag; + float cap[4]; + float capfc[4]; + float sig[4][4]; + float sigfc[4][4]; + float prod[4][4]; + float prodfc[4][4]; + int num[4][4]; +}; + +class CastorPedestalsAnalysis : public edm::one::EDAnalyzer { +public: + //Constructor + CastorPedestalsAnalysis(const edm::ParameterSet& ps); + //Destructor + ~CastorPedestalsAnalysis() override; + //Analysis + void analyze(const edm::Event& event, const edm::EventSetup& eventSetup) override; + +private: + //Container for data, 1 per channel + std::vector Bunches; + //Flag for saving histos + bool hiSaveFlag; + bool dumpXML; + bool verboseflag; + int runnum; + int firstTS; + int lastTS; + std::string ROOTfilename; + std::string pedsADCfilename; + std::string pedsfCfilename; + std::string widthsADCfilename; + std::string widthsfCfilename; + std::string XMLfilename; + std::string XMLtag; + std::string ZSfilename; + + edm::ESGetToken tok_cond_; + edm::ESGetToken tok_map_; + + TH1F* CASTORMeans; + TH1F* CASTORWidths; + + // TH2F *dephist[4]; + TH2F* dephist; + + bool firsttime; + + edm::InputTag castorDigiCollectionTag; +}; CastorPedestalsAnalysis::CastorPedestalsAnalysis(const edm::ParameterSet& ps) : castorDigiCollectionTag(ps.getParameter("castorDigiCollectionTag")) { + usesResource(TFileService::kSharedResource); + hiSaveFlag = ps.getUntrackedParameter("hiSaveFlag", false); dumpXML = ps.getUntrackedParameter("dumpXML", false); verboseflag = ps.getUntrackedParameter("verbose", false); @@ -187,6 +294,7 @@ CastorPedestalsAnalysis::~CastorPedestalsAnalysis() { // CastorCondXML::dumpObject (outStream5, runnum, runnum, runnum, XMLtag, 1, (*rawPedsItem), (*rawWidthsItem)); } + /* if (hiSaveFlag) { theFile->Write(); } else { @@ -197,6 +305,7 @@ CastorPedestalsAnalysis::~CastorPedestalsAnalysis() { } theFile->cd(); dephist->Write(); + */ dephist->SetDrawOption("colz"); dephist->GetXaxis()->SetTitle("module"); dephist->GetYaxis()->SetTitle("sector"); @@ -246,9 +355,11 @@ CastorPedestalsAnalysis::~CastorPedestalsAnalysis() { //dephist[3]->SetDrawOption("colz"); c2->SaveAs(name2.c_str()); */ + /* std::cout << "Writing ROOT file... "; theFile->Close(); std::cout << "ROOT file closed.\n"; + */ } // ------------ method called to for each event ------------ @@ -273,20 +384,23 @@ void CastorPedestalsAnalysis::analyze(const edm::Event& e, const edm::EventSetup XMLfilename = runnum_string + "-peds_ADC_complete.xml"; XMLtag = "Castor_pedestals_" + runnum_string; + edm::Service fs; + fs->mkdir("CASTOR"); + /* theFile = new TFile(ROOTfilename.c_str(), "RECREATE"); theFile->cd(); // Create sub-directories theFile->mkdir("CASTOR"); theFile->cd(); - - CASTORMeans = new TH1F("All Ped Means CASTOR", "All Ped Means CASTOR", 100, 0, 9); - CASTORWidths = new TH1F("All Ped Widths CASTOR", "All Ped Widths CASTOR", 100, 0, 3); - - dephist = new TH2F("Pedestals (ADC)", "All Castor", 14, 0., 14.5, 16, .5, 16.5); - // dephist[0] = new TH2F("Pedestals (ADC)","Depth 1",89, -44, 44, 72, .5, 72.5); - // dephist[1] = new TH2F("Pedestals (ADC)","Depth 2",89, -44, 44, 72, .5, 72.5); - // dephist[2] = new TH2F("Pedestals (ADC)","Depth 3",89, -44, 44, 72, .5, 72.5); - // dephist[3] = new TH2F("Pedestals (ADC)","Depth 4",89, -44, 44, 72, .5, 72.5); + */ + CASTORMeans = fs->make("All Ped Means CASTOR", "All Ped Means CASTOR", 100, 0, 9); + CASTORWidths = fs->make("All Ped Widths CASTOR", "All Ped Widths CASTOR", 100, 0, 3); + + dephist = fs->make("Pedestals (ADC)", "All Castor", 14, 0., 14.5, 16, .5, 16.5); + // dephist[0] = fs->make("Pedestals (ADC)","Depth 1",89, -44, 44, 72, .5, 72.5); + // dephist[1] = fs->make("Pedestals (ADC)","Depth 2",89, -44, 44, 72, .5, 72.5); + // dephist[2] = fs->make("Pedestals (ADC)","Depth 3",89, -44, 44, 72, .5, 72.5); + // dephist[3] = fs->make("Pedestals (ADC)","Depth 4",89, -44, 44, 72, .5, 72.5); const CastorElectronicsMap* myRefEMap = &iSetup.getData(tok_map_); std::vector listEMap = myRefEMap->allPrecisionId(); diff --git a/CalibCalorimetry/CastorCalib/plugins/CastorTextCalibrations.cc b/CalibCalorimetry/CastorCalib/plugins/CastorTextCalibrations.cc index e6dcdab50acbb..cf6b8e1651a8b 100644 --- a/CalibCalorimetry/CastorCalib/plugins/CastorTextCalibrations.cc +++ b/CalibCalorimetry/CastorCalib/plugins/CastorTextCalibrations.cc @@ -1,9 +1,14 @@ +#include #include #include #include +#include #include "FWCore/Utilities/interface/Exception.h" +#include "FWCore/Framework/interface/ESProducer.h" +#include "FWCore/Framework/interface/EventSetupRecordIntervalFinder.h" #include "FWCore/ParameterSet/interface/FileInPath.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/Framework/interface/ValidityInterval.h" @@ -27,7 +32,31 @@ #include "CondFormats/DataRecord/interface/CastorRecoParamsRcd.h" #include "CondFormats/DataRecord/interface/CastorSaturationCorrsRcd.h" -#include "CastorTextCalibrations.h" +class CastorTextCalibrations : public edm::ESProducer, public edm::EventSetupRecordIntervalFinder { +public: + CastorTextCalibrations(const edm::ParameterSet&); + ~CastorTextCalibrations() override; + + void produce(){}; + +protected: + void setIntervalFor(const edm::eventsetup::EventSetupRecordKey&, + const edm::IOVSyncValue&, + edm::ValidityInterval&) override; + + std::unique_ptr producePedestals(const CastorPedestalsRcd& rcd); + std::unique_ptr producePedestalWidths(const CastorPedestalWidthsRcd& rcd); + std::unique_ptr produceGains(const CastorGainsRcd& rcd); + std::unique_ptr produceGainWidths(const CastorGainWidthsRcd& rcd); + std::unique_ptr produceQIEData(const CastorQIEDataRcd& rcd); + std::unique_ptr produceChannelQuality(const CastorChannelQualityRcd& rcd); + std::unique_ptr produceElectronicsMap(const CastorElectronicsMapRcd& rcd); + std::unique_ptr produceRecoParams(const CastorRecoParamsRcd& rcd); + std::unique_ptr produceSaturationCorrs(const CastorSaturationCorrsRcd& rcd); + +private: + std::map mInputs; +}; // // class decleration // @@ -144,3 +173,8 @@ std::unique_ptr CastorTextCalibrations::produceSaturation const CastorSaturationCorrsRcd& rcd) { return produce_impl(mInputs["SaturationCorrs"]); } + +#include "FWCore/PluginManager/interface/ModuleDef.h" +#include "FWCore/Framework/interface/SourceFactory.h" + +DEFINE_FWK_EVENTSETUP_SOURCE(CastorTextCalibrations); diff --git a/CalibCalorimetry/CastorCalib/plugins/CastorTextCalibrations.h b/CalibCalorimetry/CastorCalib/plugins/CastorTextCalibrations.h deleted file mode 100644 index a8206fcb7cefb..0000000000000 --- a/CalibCalorimetry/CastorCalib/plugins/CastorTextCalibrations.h +++ /dev/null @@ -1,57 +0,0 @@ -#include -#include - -#include "FWCore/Framework/interface/ESProducer.h" -#include "FWCore/Framework/interface/EventSetupRecordIntervalFinder.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" - -class ParameterSet; - -class CastorPedestals; -class CastorPedestalWidths; -//class CastorGains; -//class CastorGainWidths; -class CastorQIEData; -//class CastorChannelQuality; -class CastorElectronicsMap; - -class CastorPedestalsRcd; -class CastorPedestalWidthsRcd; -class CastorGainsRcd; -class CastorGainWidthsRcd; -class CastorQIEDataRcd; -class CastorChannelQualityRcd; -class CastorElectronicsMapRcd; -class CastorRecoParamsRcd; -class CastorSaturationCorrsRcd; -class CastorGains; -class CastorGainWidths; -class CastorChannelQuality; -class CastorRecoParams; -class CastorSaturationCorrs; - -class CastorTextCalibrations : public edm::ESProducer, public edm::EventSetupRecordIntervalFinder { -public: - CastorTextCalibrations(const edm::ParameterSet&); - ~CastorTextCalibrations() override; - - void produce(){}; - -protected: - void setIntervalFor(const edm::eventsetup::EventSetupRecordKey&, - const edm::IOVSyncValue&, - edm::ValidityInterval&) override; - - std::unique_ptr producePedestals(const CastorPedestalsRcd& rcd); - std::unique_ptr producePedestalWidths(const CastorPedestalWidthsRcd& rcd); - std::unique_ptr produceGains(const CastorGainsRcd& rcd); - std::unique_ptr produceGainWidths(const CastorGainWidthsRcd& rcd); - std::unique_ptr produceQIEData(const CastorQIEDataRcd& rcd); - std::unique_ptr produceChannelQuality(const CastorChannelQualityRcd& rcd); - std::unique_ptr produceElectronicsMap(const CastorElectronicsMapRcd& rcd); - std::unique_ptr produceRecoParams(const CastorRecoParamsRcd& rcd); - std::unique_ptr produceSaturationCorrs(const CastorSaturationCorrsRcd& rcd); - -private: - std::map mInputs; -}; diff --git a/CalibCalorimetry/CastorCalib/plugins/SealModule.cc b/CalibCalorimetry/CastorCalib/plugins/SealModule.cc deleted file mode 100644 index db06b3a5e80a6..0000000000000 --- a/CalibCalorimetry/CastorCalib/plugins/SealModule.cc +++ /dev/null @@ -1,8 +0,0 @@ -#include "FWCore/PluginManager/interface/ModuleDef.h" -#include "FWCore/Framework/interface/SourceFactory.h" - -#include "CastorHardcodeCalibrations.h" -#include "CastorTextCalibrations.h" - -DEFINE_FWK_EVENTSETUP_SOURCE(CastorHardcodeCalibrations); -DEFINE_FWK_EVENTSETUP_SOURCE(CastorTextCalibrations); diff --git a/CalibCalorimetry/CastorCalib/test/castor_localrun_pedestals_cfg.py b/CalibCalorimetry/CastorCalib/test/castor_localrun_pedestals_cfg.py index bf1ad1c0716f3..05d64a21c50b9 100644 --- a/CalibCalorimetry/CastorCalib/test/castor_localrun_pedestals_cfg.py +++ b/CalibCalorimetry/CastorCalib/test/castor_localrun_pedestals_cfg.py @@ -115,6 +115,9 @@ castorDigiCollectionTag = cms.InputTag('castorDigis') ) +process.TFileService = cms.Service("TFileService", + fileName = cms.string('castorDigis.root') +) process.load("FWCore.MessageService.MessageLogger_cfi") process.MessageLogger.cerr.enable = False diff --git a/CalibCalorimetry/EcalCorrelatedNoiseAnalysisAlgos/interface/TEcnaRun.h b/CalibCalorimetry/EcalCorrelatedNoiseAnalysisAlgos/interface/TEcnaRun.h index 09a9e8e6337a9..3ae064d9cb7ad 100644 --- a/CalibCalorimetry/EcalCorrelatedNoiseAnalysisAlgos/interface/TEcnaRun.h +++ b/CalibCalorimetry/EcalCorrelatedNoiseAnalysisAlgos/interface/TEcnaRun.h @@ -530,7 +530,7 @@ class TEcnaRun : public TObject { //...................................................... methods that will (should) be private - void Init(); + void Init(TEcnaObject*); void SetEcalSubDetector(const TString&); diff --git a/CalibCalorimetry/EcalCorrelatedNoiseAnalysisAlgos/src/TEcnaRun.cc b/CalibCalorimetry/EcalCorrelatedNoiseAnalysisAlgos/src/TEcnaRun.cc index e34b0c5bde90a..6a01070bcfb06 100644 --- a/CalibCalorimetry/EcalCorrelatedNoiseAnalysisAlgos/src/TEcnaRun.cc +++ b/CalibCalorimetry/EcalCorrelatedNoiseAnalysisAlgos/src/TEcnaRun.cc @@ -27,28 +27,7 @@ TEcnaRun::TEcnaRun(TEcnaObject* pObjectManager, const TString& SubDet) { // std::cout << "[Info Management] CLASS: TEcnaRun. CREATE OBJECT: this = " << this << std::endl; - Init(); - fObjectManager = (TEcnaObject*)pObjectManager; - Long_t i_this = (Long_t)this; - pObjectManager->RegisterPointer("TEcnaRun", i_this); - - //............................ fCnaParCout - fCnaParCout = nullptr; - Long_t iCnaParCout = pObjectManager->GetPointerValue("TEcnaParCout"); - if (iCnaParCout == 0) { - fCnaParCout = new TEcnaParCout(pObjectManager); /*fCnew++*/ - } else { - fCnaParCout = (TEcnaParCout*)iCnaParCout; - } - - //............................ fCnaParPaths - fCnaParPaths = nullptr; - Long_t iCnaParPaths = pObjectManager->GetPointerValue("TEcnaParPaths"); - if (iCnaParPaths == 0) { - fCnaParPaths = new TEcnaParPaths(pObjectManager); /*fCnew++*/ - } else { - fCnaParPaths = (TEcnaParPaths*)iCnaParPaths; - } + Init(pObjectManager); //fCfgResultsRootFilePath = fCnaParPaths->ResultsRootFilePath(); //fCfgHistoryRunListFilePath = fCnaParPaths->HistoryRunListFilePath(); @@ -76,31 +55,7 @@ TEcnaRun::TEcnaRun(TEcnaObject* pObjectManager, const TString& SubDet) { } TEcnaRun::TEcnaRun(TEcnaObject* pObjectManager, const TString& SubDet, const Int_t& NbOfSamples) { - //fCnaParPaths = 0; fCnaParPaths = new TEcnaParPaths(); //fCnew++; - //fCnaParCout = 0; fCnaParCout = new TEcnaParCout(); //fCnew++; - - Init(); - fObjectManager = (TEcnaObject*)pObjectManager; - Long_t i_this = (Long_t)this; - pObjectManager->RegisterPointer("TEcnaRun", i_this); - - //............................ fCnaParCout - fCnaParCout = nullptr; - Long_t iCnaParCout = pObjectManager->GetPointerValue("TEcnaParCout"); - if (iCnaParCout == 0) { - fCnaParCout = new TEcnaParCout(pObjectManager); /*fCnew++*/ - } else { - fCnaParCout = (TEcnaParCout*)iCnaParCout; - } - - //............................ fCnaParPaths - fCnaParPaths = nullptr; - Long_t iCnaParPaths = pObjectManager->GetPointerValue("TEcnaParPaths"); - if (iCnaParPaths == 0) { - fCnaParPaths = new TEcnaParPaths(pObjectManager); /*fCnew++*/ - } else { - fCnaParPaths = (TEcnaParPaths*)iCnaParPaths; - } + Init(pObjectManager); //fCfgResultsRootFilePath = fCnaParPaths->ResultsRootFilePath(); //fCfgHistoryRunListFilePath = fCnaParPaths->HistoryRunListFilePath(); @@ -131,7 +86,7 @@ TEcnaRun::TEcnaRun(TEcnaObject* pObjectManager, const TString& SubDet, const Int //.... return true or false according to the existence of the path. The path itself is in an attribute of fCnaParPaths. Bool_t TEcnaRun::GetPathForResults() { return fCnaParPaths->GetPathForResultsRootFiles(); } -void TEcnaRun::Init() { +void TEcnaRun::Init(TEcnaObject* pObjectManager) { //Initialisation fCnew = 0; @@ -245,6 +200,25 @@ void TEcnaRun::Init() { fTagAvMeanCorss = nullptr; fTagAvSigCorss = nullptr; + fObjectManager = (TEcnaObject*)pObjectManager; + pObjectManager->RegisterPointer("TEcnaRun", (Long_t)this); + + //............................ fCnaParCout + Long_t iCnaParCout = pObjectManager->GetPointerValue("TEcnaParCout"); + if (iCnaParCout == 0) { + fCnaParCout = new TEcnaParCout(pObjectManager); /*fCnew++*/ + } else { + fCnaParCout = (TEcnaParCout*)iCnaParCout; + } + + //............................ fCnaParPaths + Long_t iCnaParPaths = pObjectManager->GetPointerValue("TEcnaParPaths"); + if (iCnaParPaths == 0) { + fCnaParPaths = new TEcnaParPaths(pObjectManager); /*fCnew++*/ + } else { + fCnaParPaths = (TEcnaParPaths*)iCnaParPaths; + } + //................................................... Code Print ( Init() ) fCodePrintNoComment = fCnaParCout->GetCodePrint("NoComment"); fCodePrintWarnings = fCnaParCout->GetCodePrint("Warnings "); // => default value diff --git a/CalibCalorimetry/EcalCorrelatedNoiseAnalysisAlgos/src/TEcnaWrite.cc b/CalibCalorimetry/EcalCorrelatedNoiseAnalysisAlgos/src/TEcnaWrite.cc index a81efeac7b9bd..f47e96b627663 100644 --- a/CalibCalorimetry/EcalCorrelatedNoiseAnalysisAlgos/src/TEcnaWrite.cc +++ b/CalibCalorimetry/EcalCorrelatedNoiseAnalysisAlgos/src/TEcnaWrite.cc @@ -51,6 +51,7 @@ TEcnaWrite::TEcnaWrite(TEcnaObject* pObjectManager, const TString& SubDet) { } else { fCnaParCout = (TEcnaParCout*)iCnaParCout; } + fCodePrintAllComments = fCnaParCout->GetCodePrint("AllComments"); //............................ fCnaParPaths fCnaParPaths = nullptr; @@ -118,6 +119,7 @@ TEcnaWrite::TEcnaWrite(const TString& SubDet, } else { fCnaParCout = (TEcnaParCout*)pCnaParCout; } + fCodePrintAllComments = fCnaParCout->GetCodePrint("AllComments"); fEcal = nullptr; if (pEcal == nullptr) { @@ -194,8 +196,6 @@ void TEcnaWrite::Init() { fjustap_2d_ss = nullptr; fjustap_1d_ss = nullptr; - - fCodePrintAllComments = fCnaParCout->GetCodePrint("AllComments"); } // end of Init() diff --git a/CalibCalorimetry/EcalLaserAnalyzer/plugins/EcalABAnalyzer.cc b/CalibCalorimetry/EcalLaserAnalyzer/plugins/EcalABAnalyzer.cc index f376d10524991..dca17f7b11474 100644 --- a/CalibCalorimetry/EcalLaserAnalyzer/plugins/EcalABAnalyzer.cc +++ b/CalibCalorimetry/EcalLaserAnalyzer/plugins/EcalABAnalyzer.cc @@ -16,27 +16,16 @@ #include "CalibCalorimetry/EcalLaserAnalyzer/plugins/EcalABAnalyzer.h" #include -#include #include #include -#include #include -#include - -#include #include - -#include -#include - #include #include #include -#include #include #include -#include #include #include @@ -52,7 +41,12 @@ using namespace std; EcalABAnalyzer::EcalABAnalyzer(const edm::ParameterSet& iConfig) //======================================================================== : iEvent(0), - + eventHeaderCollection_(iConfig.getParameter("eventHeaderCollection")), + eventHeaderProducer_(iConfig.getParameter("eventHeaderProducer")), + digiCollection_(iConfig.getParameter("digiCollection")), + digiProducer_(iConfig.getParameter("digiProducer")), + rawDataToken_(consumes(edm::InputTag(eventHeaderProducer_, eventHeaderCollection_))), + mappingToken_(esConsumes()), // framework parameters with default values _nsamples(iConfig.getUntrackedParameter("nSamples", 10)), _presample(iConfig.getUntrackedParameter("nPresamples", 2)), @@ -73,8 +67,10 @@ EcalABAnalyzer::EcalABAnalyzer(const edm::ParameterSet& iConfig) _noise(iConfig.getUntrackedParameter("noise", 2.0)), _chi2cut(iConfig.getUntrackedParameter("chi2cut", 100.0)), _ecalPart(iConfig.getUntrackedParameter("ecalPart", "EB")), + _fedid(iConfig.getUntrackedParameter("fedId", -999)), _qualpercent(iConfig.getUntrackedParameter("qualPercent", 0.2)), _debug(iConfig.getUntrackedParameter("debug", 0)), + resdir_(iConfig.getUntrackedParameter("resDir")), nCrys(NCRYSEB), runType(-1), runNum(0), @@ -92,15 +88,11 @@ EcalABAnalyzer::EcalABAnalyzer(const edm::ParameterSet& iConfig) //======================================================================== { - // Initialization from cfg file - - resdir_ = iConfig.getUntrackedParameter("resDir"); - - digiCollection_ = iConfig.getParameter("digiCollection"); - digiProducer_ = iConfig.getParameter("digiProducer"); - - eventHeaderCollection_ = iConfig.getParameter("eventHeaderCollection"); - eventHeaderProducer_ = iConfig.getParameter("eventHeaderProducer"); + if (_ecalPart == "EB") { + ebDigiToken_ = consumes(edm::InputTag(digiProducer_, digiCollection_)); + } else if (_ecalPart == "EE") { + eeDigiToken_ = consumes(edm::InputTag(digiProducer_, digiCollection_)); + } // Geometrical constants initialization @@ -236,12 +228,12 @@ void EcalABAnalyzer::analyze(const edm::Event& e, const edm::EventSetup& c) { // retrieving DCC header edm::Handle pDCCHeader; const EcalRawDataCollection* DCCHeader = nullptr; - try { - e.getByLabel(eventHeaderProducer_, eventHeaderCollection_, pDCCHeader); + e.getByToken(rawDataToken_, pDCCHeader); + if (!pDCCHeader.isValid()) { + edm::LogError("nodata") << "Error! can't get the product retrieving DCC header" << eventHeaderCollection_.c_str() + << " " << eventHeaderProducer_.c_str(); + } else { DCCHeader = pDCCHeader.product(); - } catch (std::exception& ex) { - std::cerr << "Error! can't get the product retrieving DCC header" << eventHeaderCollection_.c_str() << " " - << eventHeaderProducer_.c_str() << std::endl; } //retrieving crystal data from Event @@ -250,33 +242,26 @@ void EcalABAnalyzer::analyze(const edm::Event& e, const edm::EventSetup& c) { edm::Handle pEEDigi; const EEDigiCollection* EEDigi = nullptr; if (_ecalPart == "EB") { - try { - e.getByLabel(digiProducer_, digiCollection_, pEBDigi); + e.getByToken(ebDigiToken_, pEBDigi); + if (!pEBDigi.isValid()) { + edm::LogError("nodata") << "Error! can't get the product retrieving EB crystal data " << digiCollection_.c_str(); + } else { EBDigi = pEBDigi.product(); - } catch (std::exception& ex) { - std::cerr << "Error! can't get the product retrieving EB crystal data " << digiCollection_.c_str() << std::endl; } } else if (_ecalPart == "EE") { - try { - e.getByLabel(digiProducer_, digiCollection_, pEEDigi); + e.getByToken(eeDigiToken_, pEEDigi); + if (!pEEDigi.isValid()) { + edm::LogError("nodata") << "Error! can't get the product retrieving EE crystal data " << digiCollection_.c_str(); + } else { EEDigi = pEEDigi.product(); - } catch (std::exception& ex) { - std::cerr << "Error! can't get the product retrieving EE crystal data " << digiCollection_.c_str() << std::endl; } } else { - std::cout << " Wrong ecalPart in cfg file " << std::endl; + edm::LogError("cfg_error") << " Wrong ecalPart in cfg file"; return; } // retrieving electronics mapping - edm::ESHandle ecalmapping; - const EcalElectronicsMapping* TheMapping = nullptr; - try { - c.get().get(ecalmapping); - TheMapping = ecalmapping.product(); - } catch (std::exception& ex) { - std::cerr << "Error! can't get the product EcalMappingRcd" << std::endl; - } + const auto& TheMapping = c.getData(mappingToken_); // ============================= // Decode DCCHeader Information @@ -363,7 +348,7 @@ void EcalABAnalyzer::analyze(const edm::Event& e, const edm::EventSetup& c) { // Recover the TT id and the electronic crystal numbering from EcalElectronicsMapping - EcalElectronicsId elecid_crystal = TheMapping->getElectronicsId(id_crystal); + EcalElectronicsId elecid_crystal = TheMapping.getElectronicsId(id_crystal); int towerID = elecid_crystal.towerId(); int strip = elecid_crystal.stripId(); @@ -445,7 +430,7 @@ void EcalABAnalyzer::analyze(const edm::Event& e, const edm::EventSetup& c) { int iY = (eta - 1) / 5 + 1; side = MEEEGeom::side(iX, iY, iZ); - EcalElectronicsId elecid_crystal = TheMapping->getElectronicsId(id_crystal); + EcalElectronicsId elecid_crystal = TheMapping.getElectronicsId(id_crystal); int towerID = elecid_crystal.towerId(); int channelID = elecid_crystal.channelId() - 1; @@ -472,7 +457,7 @@ void EcalABAnalyzer::analyze(const edm::Event& e, const edm::EventSetup& c) { //=========== if ((*digiItr).size() > 10) - std::cout << "SAMPLES SIZE > 10!" << (*digiItr).size() << std::endl; + edm::LogVerbatim("EcalABAnalyzer") << "SAMPLES SIZE > 10!" << (*digiItr).size(); // Loop on adc samples @@ -522,8 +507,8 @@ void EcalABAnalyzer::analyze(const edm::Event& e, const edm::EventSetup& c) { void EcalABAnalyzer::endJob() { //======================================================================== - std::cout << "\n\t+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+" << std::endl; - std::cout << "\t+=+ Analyzing data: getting (alpha, beta) +=+" << std::endl; + edm::LogVerbatim("EcalABAnalyzer") << "\n\t+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+"; + edm::LogVerbatim("EcalABAnalyzer") << "\t+=+ Analyzing data: getting (alpha, beta) +=+"; // Adjust channel numbers for EE //=============================== @@ -551,8 +536,8 @@ void EcalABAnalyzer::endJob() { //====================== if (_fitab) { - std::cout << "\n\t+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+" << std::endl; - std::cout << "\t+=+ Analyzing data: getting (alpha, beta) +=+" << std::endl; + edm::LogVerbatim("EcalABAnalyzer") << "\n\t+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+"; + edm::LogVerbatim("EcalABAnalyzer") << "\t+=+ Analyzing data: getting (alpha, beta) +=+"; TFile* fAB = nullptr; TTree* ABInit = nullptr; if (doesABTreeExist) { @@ -595,12 +580,12 @@ void EcalABAnalyzer::endJob() { isTimingOK = false; if (!isGainOK) - std::cout << "\t+=+ ............................ WARNING! APD GAIN WAS NOT 1 +=+" << std::endl; + edm::LogVerbatim("EcalABAnalyzer") << "\t+=+ ............................ WARNING! APD GAIN WAS NOT 1 +=+"; if (!isTimingOK) - std::cout << "\t+=+ ............................ WARNING! TIMING WAS BAD +=+" << std::endl; + edm::LogVerbatim("EcalABAnalyzer") << "\t+=+ ............................ WARNING! TIMING WAS BAD +=+"; - std::cout << "\t+=+ .................................... done +=+" << std::endl; - std::cout << "\t+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+" << std::endl; + edm::LogVerbatim("EcalABAnalyzer") << "\t+=+ .................................... done +=+"; + edm::LogVerbatim("EcalABAnalyzer") << "\t+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+"; } } diff --git a/CalibCalorimetry/EcalLaserAnalyzer/plugins/EcalABAnalyzer.h b/CalibCalorimetry/EcalLaserAnalyzer/plugins/EcalABAnalyzer.h index 219082aa12653..8cc3b857fe180 100644 --- a/CalibCalorimetry/EcalLaserAnalyzer/plugins/EcalABAnalyzer.h +++ b/CalibCalorimetry/EcalLaserAnalyzer/plugins/EcalABAnalyzer.h @@ -1,5 +1,5 @@ -#ifndef EcalABAnalyzer_h_ -#define EcalABAnalyzer_h_ +#ifndef CalibCalorimetry_EcalLaserAnalyzer_EcalABAnalyzer_h +#define CalibCalorimetry_EcalLaserAnalyzer_EcalABAnalyzer_h // $Id: EcalABAnalyzer.h @@ -7,7 +7,12 @@ #include #include -#include +#include + +#include +#include +#include +#include class TShapeAnalysis; class TAPDPulse; @@ -32,7 +37,7 @@ class TMom; // "EE" geometry #define NCRYSEE 830 // Number of crystals per EE supermodule -class EcalABAnalyzer : public edm::EDAnalyzer { +class EcalABAnalyzer : public edm::one::EDAnalyzer<> { public: explicit EcalABAnalyzer(const edm::ParameterSet &iConfig); ~EcalABAnalyzer() override; @@ -46,40 +51,46 @@ class EcalABAnalyzer : public edm::EDAnalyzer { private: int iEvent; + const std::string eventHeaderCollection_; + const std::string eventHeaderProducer_; + const std::string digiCollection_; + const std::string digiProducer_; + + const edm::EDGetTokenT rawDataToken_; + edm::EDGetTokenT ebDigiToken_; + edm::EDGetTokenT eeDigiToken_; + const edm::ESGetToken mappingToken_; + // Framework parameters - unsigned int _nsamples; + const unsigned int _nsamples; unsigned int _presample; - unsigned int _firstsample; - unsigned int _lastsample; - unsigned int _timingcutlow; - unsigned int _timingcuthigh; - unsigned int _timingquallow; - unsigned int _timingqualhigh; - double _ratiomincutlow; - double _ratiomincuthigh; - double _ratiomaxcutlow; - double _presamplecut; - unsigned int _niter; - double _alpha; - double _beta; - unsigned int _nevtmax; - double _noise; - double _chi2cut; - std::string _ecalPart; - int _fedid; - double _qualpercent; - int _debug; + const unsigned int _firstsample; + const unsigned int _lastsample; + const unsigned int _timingcutlow; + const unsigned int _timingcuthigh; + const unsigned int _timingquallow; + const unsigned int _timingqualhigh; + const double _ratiomincutlow; + const double _ratiomincuthigh; + const double _ratiomaxcutlow; + const double _presamplecut; + const unsigned int _niter; + const double _alpha; + const double _beta; + const unsigned int _nevtmax; + const double _noise; + const double _chi2cut; + const std::string _ecalPart; + const int _fedid; + const double _qualpercent; + const int _debug; TAPDPulse *APDPulse; TMom *Delta01; TMom *Delta12; - std::string resdir_; - std::string digiCollection_; - std::string digiProducer_; - std::string eventHeaderCollection_; - std::string eventHeaderProducer_; + const std::string resdir_; // Output file names diff --git a/CalibCalorimetry/EcalLaserAnalyzer/plugins/EcalLaserAnalyzer.cc b/CalibCalorimetry/EcalLaserAnalyzer/plugins/EcalLaserAnalyzer.cc index 12042a2be2c0f..78f9ea713a32d 100644 --- a/CalibCalorimetry/EcalLaserAnalyzer/plugins/EcalLaserAnalyzer.cc +++ b/CalibCalorimetry/EcalLaserAnalyzer/plugins/EcalLaserAnalyzer.cc @@ -16,28 +16,18 @@ #include "CalibCalorimetry/EcalLaserAnalyzer/plugins/EcalLaserAnalyzer.h" #include -#include #include #include #include -#include -#include #include -#include -#include - #include #include #include -#include #include #include -#include - -#include #include #include @@ -56,9 +46,15 @@ EcalLaserAnalyzer::EcalLaserAnalyzer(const edm::ParameterSet& iConfig) //======================================================================== : iEvent(0), - + eventHeaderCollection_(iConfig.getParameter("eventHeaderCollection")), + eventHeaderProducer_(iConfig.getParameter("eventHeaderProducer")), + digiCollection_(iConfig.getParameter("digiCollection")), + digiProducer_(iConfig.getParameter("digiProducer")), + digiPNCollection_(iConfig.getParameter("digiPNCollection")), + rawDataToken_(consumes(edm::InputTag(eventHeaderProducer_, eventHeaderCollection_))), + pnDiodeDigiToken_(consumes(edm::InputTag(digiProducer_))), + mappingToken_(esConsumes()), // Framework parameters with default values - _nsamples(iConfig.getUntrackedParameter("nSamples", 10)), _presample(iConfig.getUntrackedParameter("nPresamples", 2)), _firstsample(iConfig.getUntrackedParameter("firstSample", 1)), @@ -88,6 +84,8 @@ EcalLaserAnalyzer::EcalLaserAnalyzer(const edm::ParameterSet& iConfig) _saveallevents(iConfig.getUntrackedParameter("saveAllEvents", false)), _qualpercent(iConfig.getUntrackedParameter("qualPercent", 0.2)), _debug(iConfig.getUntrackedParameter("debug", 0)), + resdir_(iConfig.getUntrackedParameter("resDir")), + pncorfile_(iConfig.getUntrackedParameter("pnCorFile")), nCrys(NCRYSEB), nPNPerMod(NPNPERMOD), nMod(NMODEE), @@ -117,17 +115,11 @@ EcalLaserAnalyzer::EcalLaserAnalyzer(const edm::ParameterSet& iConfig) //======================================================================== { - // Initialization from cfg file - - resdir_ = iConfig.getUntrackedParameter("resDir"); - pncorfile_ = iConfig.getUntrackedParameter("pnCorFile"); - - digiCollection_ = iConfig.getParameter("digiCollection"); - digiPNCollection_ = iConfig.getParameter("digiPNCollection"); - digiProducer_ = iConfig.getParameter("digiProducer"); - - eventHeaderCollection_ = iConfig.getParameter("eventHeaderCollection"); - eventHeaderProducer_ = iConfig.getParameter("eventHeaderProducer"); + if (_ecalPart == "EB") { + ebDigiToken_ = consumes(edm::InputTag(digiProducer_, digiCollection_)); + } else if (_ecalPart == "EE") { + eeDigiToken_ = consumes(edm::InputTag(digiProducer_, digiCollection_)); + } // Geometrical constants initialization @@ -318,64 +310,52 @@ void EcalLaserAnalyzer::analyze(const edm::Event& e, const edm::EventSetup& c) { ++iEvent; // retrieving DCC header - edm::Handle pDCCHeader; const EcalRawDataCollection* DCCHeader = nullptr; - try { - e.getByLabel(eventHeaderProducer_, eventHeaderCollection_, pDCCHeader); + e.getByToken(rawDataToken_, pDCCHeader); + if (!pDCCHeader.isValid()) { + edm::LogError("nodata") << "Error! can't get the product retrieving DCC header" << eventHeaderCollection_.c_str() + << " " << eventHeaderProducer_.c_str(); + } else { DCCHeader = pDCCHeader.product(); - } catch (std::exception& ex) { - std::cerr << "Error! can't get the product retrieving DCC header" << eventHeaderCollection_.c_str() << " " - << eventHeaderProducer_.c_str() << std::endl; } //retrieving crystal data from Event - edm::Handle pEBDigi; const EBDigiCollection* EBDigi = nullptr; edm::Handle pEEDigi; const EEDigiCollection* EEDigi = nullptr; - if (_ecalPart == "EB") { - try { - e.getByLabel(digiProducer_, digiCollection_, pEBDigi); + e.getByToken(ebDigiToken_, pEBDigi); + if (!pEBDigi.isValid()) { + edm::LogError("nodata") << "Error! can't get the product retrieving EB crystal data " << digiCollection_.c_str(); + } else { EBDigi = pEBDigi.product(); - } catch (std::exception& ex) { - std::cerr << "Error! can't get the product retrieving EB crystal data " << digiCollection_.c_str() << std::endl; } } else if (_ecalPart == "EE") { - try { - e.getByLabel(digiProducer_, digiCollection_, pEEDigi); + e.getByToken(eeDigiToken_, pEEDigi); + if (!pEEDigi.isValid()) { + edm::LogError("nodata") << "Error! can't get the product retrieving EE crystal data " << digiCollection_.c_str(); + } else { EEDigi = pEEDigi.product(); - } catch (std::exception& ex) { - std::cerr << "Error! can't get the product retrieving EE crystal data " << digiCollection_.c_str() << std::endl; } } else { - std::cout << " Wrong ecalPart in cfg file " << std::endl; + edm::LogError("cfg_error") << " Wrong ecalPart in cfg file "; return; } // retrieving crystal PN diodes from Event - edm::Handle pPNDigi; const EcalPnDiodeDigiCollection* PNDigi = nullptr; - try { - e.getByLabel(digiProducer_, pPNDigi); + e.getByToken(pnDiodeDigiToken_, pPNDigi); + if (!pPNDigi.isValid()) { + edm::LogError("nodata") << "Error! can't get the product " << digiPNCollection_.c_str(); + } else { PNDigi = pPNDigi.product(); - } catch (std::exception& ex) { - std::cerr << "Error! can't get the product " << digiPNCollection_.c_str() << std::endl; } // retrieving electronics mapping - - edm::ESHandle ecalmapping; - const EcalElectronicsMapping* TheMapping = nullptr; - try { - c.get().get(ecalmapping); - TheMapping = ecalmapping.product(); - } catch (std::exception& ex) { - std::cerr << "Error! can't get the product EcalMappingRcd" << std::endl; - } + const auto& TheMapping = c.getData(mappingToken_); // ============================ // Decode DCCHeader Information @@ -418,7 +398,7 @@ void EcalLaserAnalyzer::analyze(const edm::Event& e, const edm::EventSetup& c) { std::vector::iterator iter = find(colors.begin(), colors.end(), color); if (iter == colors.end()) { colors.push_back(color); - std::cout << " new color found " << color << " " << colors.size() << std::endl; + edm::LogVerbatim("EcalLaserAnalyzer") << " new color found " << color << " " << colors.size(); } } @@ -451,8 +431,8 @@ void EcalLaserAnalyzer::analyze(const edm::Event& e, const edm::EventSetup& c) { EcalPnDiodeDetId pnDetId = EcalPnDiodeDetId((*pnItr).id()); if (_debug == 1) - std::cout << "-- debug -- Inside PNDigi - pnID=" << pnDetId.iPnId() << ", dccID=" << pnDetId.iDCCId() - << std::endl; + edm::LogVerbatim("EcalLaserAnalyzer") + << "-- debug -- Inside PNDigi - pnID=" << pnDetId.iPnId() << ", dccID=" << pnDetId.iDCCId(); // Skip MEM DCC without relevant data @@ -472,7 +452,7 @@ void EcalLaserAnalyzer::analyze(const edm::Event& e, const edm::EventSetup& c) { } if (pnGain != 1) - std::cout << "PN gain different from 1" << std::endl; + edm::LogVerbatim("EcalLaserAnalyzer") << "PN gain different from 1"; // Calculate amplitude from pulse @@ -497,7 +477,7 @@ void EcalLaserAnalyzer::analyze(const edm::Event& e, const edm::EventSetup& c) { allPNAmpl[pnDetId.iDCCId()].push_back(pnAmpl); if (_debug == 1) - std::cout << "-- debug -- Inside PNDigi - PNampl=" << pnAmpl << ", PNgain=" << pnGain << std::endl; + edm::LogVerbatim("EcalLaserAnalyzer") << "-- debug -- Inside PNDigi - PNampl=" << pnAmpl << ", PNgain=" << pnGain; } // =========================== @@ -516,7 +496,7 @@ void EcalLaserAnalyzer::analyze(const edm::Event& e, const edm::EventSetup& c) { EBDetId id_crystal(digiItr->id()); EBDataFrame df(*digiItr); - EcalElectronicsId elecid_crystal = TheMapping->getElectronicsId(id_crystal); + EcalElectronicsId elecid_crystal = TheMapping.getElectronicsId(id_crystal); int etaG = id_crystal.ieta(); // global int phiG = id_crystal.iphi(); // global @@ -545,8 +525,9 @@ void EcalLaserAnalyzer::analyze(const edm::Event& e, const edm::EventSetup& c) { setGeomEB(etaG, phiG, module, tower, strip, xtal, apdRefTT, channel, lmr); if (_debug == 1) - std::cout << "-- debug -- Inside EBDigi - towerID:" << towerID << " channelID:" << channelID - << " module:" << module << " modules:" << modules.size() << std::endl; + edm::LogVerbatim("EcalLaserAnalyzer") + << "-- debug -- Inside EBDigi - towerID:" << towerID << " channelID:" << channelID << " module:" << module + << " modules:" << modules.size(); // APD Pulse //=========== @@ -619,7 +600,7 @@ void EcalLaserAnalyzer::analyze(const edm::Event& e, const edm::EventSetup& c) { EEDetId id_crystal(digiItr->id()); EEDataFrame df(*digiItr); - EcalElectronicsId elecid_crystal = TheMapping->getElectronicsId(id_crystal); + EcalElectronicsId elecid_crystal = TheMapping.getElectronicsId(id_crystal); int etaG = id_crystal.iy(); int phiG = id_crystal.ix(); @@ -652,14 +633,15 @@ void EcalLaserAnalyzer::analyze(const edm::Event& e, const edm::EventSetup& c) { setGeomEE(etaG, phiG, iX, iY, iZ, module, tower, ch, apdRefTT, channel, lmr); if (_debug == 1) - std::cout << "-- debug -- Inside EEDigi - towerID:" << towerID << " channelID:" << channelID - << " module:" << module << " modules:" << modules.size() << std::endl; + edm::LogVerbatim("EcalLaserAnalyzer") + << "-- debug -- Inside EEDigi - towerID:" << towerID << " channelID:" << channelID << " module:" << module + << " modules:" << modules.size(); // APD Pulse //=========== if ((*digiItr).size() > 10) - std::cout << "SAMPLES SIZE > 10!" << (*digiItr).size() << std::endl; + edm::LogVerbatim("EcalLaserAnalyzer") << "SAMPLES SIZE > 10!" << (*digiItr).size(); // Loop on adc samples @@ -753,8 +735,8 @@ void EcalLaserAnalyzer::endJob() { //====================== if (_fitab) { - std::cout << "\n\t+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+" << std::endl; - std::cout << "\t+=+ Analyzing data: getting (alpha, beta) +=+" << std::endl; + edm::LogVerbatim("EcalLaserAnalyzer") << "\n\t+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+"; + edm::LogVerbatim("EcalLaserAnalyzer") << "\t+=+ Analyzing data: getting (alpha, beta) +=+"; TFile* fAB = nullptr; TTree* ABInit = nullptr; if (doesABTreeExist) { @@ -764,8 +746,8 @@ void EcalLaserAnalyzer::endJob() { ABInit = (TTree*)fAB->Get("ABCol0"); } shapana->computeShape(alphafile, ABInit); - std::cout << "\t+=+ .................................... done +=+" << std::endl; - std::cout << "\t+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+" << std::endl; + edm::LogVerbatim("EcalLaserAnalyzer") << "\t+=+ .................................... done +=+"; + edm::LogVerbatim("EcalLaserAnalyzer") << "\t+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+"; } // Don't do anything if there is no events @@ -776,7 +758,7 @@ void EcalLaserAnalyzer::endJob() { std::stringstream del; del << "rm " << ADCfile; system(del.str().c_str()); - std::cout << " No Laser Events " << std::endl; + edm::LogVerbatim("EcalLaserAnalyzer") << " No Laser Events "; return; } @@ -815,13 +797,13 @@ void EcalLaserAnalyzer::endJob() { // Analyze adc samples to get amplitudes //======================================= - std::cout << "\n\t+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+" << std::endl; - std::cout << "\t+=+ Analyzing laser data: getting APD, PN, APD/PN, PN/PN +=+" << std::endl; + edm::LogVerbatim("EcalLaserAnalyzer") << "\n\t+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+"; + edm::LogVerbatim("EcalLaserAnalyzer") << "\t+=+ Analyzing laser data: getting APD, PN, APD/PN, PN/PN +=+"; if (!isGainOK) - std::cout << "\t+=+ ............................ WARNING! APD GAIN WAS NOT 1 +=+" << std::endl; + edm::LogVerbatim("EcalLaserAnalyzer") << "\t+=+ ............................ WARNING! APD GAIN WAS NOT 1 +=+"; if (!isTimingOK) - std::cout << "\t+=+ ............................ WARNING! TIMING WAS BAD +=+" << std::endl; + edm::LogVerbatim("EcalLaserAnalyzer") << "\t+=+ ............................ WARNING! TIMING WAS BAD +=+"; APDFile = new TFile(APDfile.c_str(), "RECREATE"); @@ -993,7 +975,7 @@ void EcalLaserAnalyzer::endJob() { } if (_debug == 1) - std::cout << "-- debug test -- apdAmpl=" << apdAmpl << ", apdTime=" << apdTime << std::endl; + edm::LogVerbatim("EcalLaserAnalyzer") << "-- debug test -- apdAmpl=" << apdAmpl << ", apdTime=" << apdTime; double pnmean; if (pn0 < 10 && pn1 > 10) { pnmean = pn1; @@ -1003,7 +985,7 @@ void EcalLaserAnalyzer::endJob() { pnmean = 0.5 * (pn0 + pn1); if (_debug == 1) - std::cout << "-- debug test -- pn0=" << pn0 << ", pn1=" << pn1 << std::endl; + edm::LogVerbatim("EcalLaserAnalyzer") << "-- debug test -- pn0=" << pn0 << ", pn1=" << pn1; // Fill PN stuff //=============== @@ -1224,7 +1206,7 @@ void EcalLaserAnalyzer::endJob() { //=================== if (_debug == 1) - std::cout << "-- debug test -- Last Loop event:" << event << " apdAmpl:" << apdAmpl << std::endl; + edm::LogVerbatim("EcalLaserAnalyzer") << "-- debug test -- Last Loop event:" << event << " apdAmpl:" << apdAmpl; apdAmplA = 0.0; apdAmplB = 0.0; @@ -1233,8 +1215,9 @@ void EcalLaserAnalyzer::endJob() { } if (_debug == 1) - std::cout << "-- debug test -- Last Loop apdAmplA:" << apdAmplA << " apdAmplB:" << apdAmplB - << ", event:" << event << ", eventref:" << eventref << std::endl; + edm::LogVerbatim("EcalLaserAnalyzer") + << "-- debug test -- Last Loop apdAmplA:" << apdAmplA << " apdAmplB:" << apdAmplB << ", event:" << event + << ", eventref:" << eventref; // Fill APD stuff //=============== @@ -1350,8 +1333,8 @@ void EcalLaserAnalyzer::endJob() { resFile->Close(); - std::cout << "\t+=+ .................................................. done +=+" << std::endl; - std::cout << "\t+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+" << std::endl; + edm::LogVerbatim("EcalLaserAnalyzer") << "\t+=+ .................................................. done +=+"; + edm::LogVerbatim("EcalLaserAnalyzer") << "\t+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+"; } void EcalLaserAnalyzer::setGeomEB( diff --git a/CalibCalorimetry/EcalLaserAnalyzer/plugins/EcalLaserAnalyzer.h b/CalibCalorimetry/EcalLaserAnalyzer/plugins/EcalLaserAnalyzer.h index 259897fd07bb1..5f17cbca450bd 100644 --- a/CalibCalorimetry/EcalLaserAnalyzer/plugins/EcalLaserAnalyzer.h +++ b/CalibCalorimetry/EcalLaserAnalyzer/plugins/EcalLaserAnalyzer.h @@ -1,3 +1,5 @@ +#ifndef CalibCalorimetry_EcalLaserAnalyzer_EcalLaserAnalyzer_h +#define CalibCalorimetry_EcalLaserAnalyzer_EcalLaserAnalyzer_h // $Id: EcalLaserAnalyzer.h #include @@ -5,7 +7,12 @@ #include #include -#include +#include + +#include +#include +#include +#include class TFile; class TTree; @@ -44,7 +51,7 @@ class TMem; #define NSIDES 2 // Number of sides #define NREFCHAN 2 // Ref number for APDB -class EcalLaserAnalyzer : public edm::EDAnalyzer { +class EcalLaserAnalyzer : public edm::one::EDAnalyzer<> { public: explicit EcalLaserAnalyzer(const edm::ParameterSet &iConfig); ~EcalLaserAnalyzer() override; @@ -62,37 +69,49 @@ class EcalLaserAnalyzer : public edm::EDAnalyzer { private: int iEvent; + const std::string eventHeaderCollection_; + const std::string eventHeaderProducer_; + const std::string digiCollection_; + const std::string digiProducer_; + const std::string digiPNCollection_; + + const edm::EDGetTokenT rawDataToken_; + edm::EDGetTokenT ebDigiToken_; + edm::EDGetTokenT eeDigiToken_; + const edm::EDGetTokenT pnDiodeDigiToken_; + const edm::ESGetToken mappingToken_; + // Framework parameters - unsigned int _nsamples; + const unsigned int _nsamples; unsigned int _presample; - unsigned int _firstsample; - unsigned int _lastsample; - unsigned int _nsamplesPN; - unsigned int _presamplePN; - unsigned int _firstsamplePN; - unsigned int _lastsamplePN; - unsigned int _timingcutlow; - unsigned int _timingcuthigh; - unsigned int _timingquallow; - unsigned int _timingqualhigh; - double _ratiomincutlow; - double _ratiomincuthigh; - double _ratiomaxcutlow; - double _presamplecut; - unsigned int _niter; + const unsigned int _firstsample; + const unsigned int _lastsample; + const unsigned int _nsamplesPN; + const unsigned int _presamplePN; + const unsigned int _firstsamplePN; + const unsigned int _lastsamplePN; + const unsigned int _timingcutlow; + const unsigned int _timingcuthigh; + const unsigned int _timingquallow; + const unsigned int _timingqualhigh; + const double _ratiomincutlow; + const double _ratiomincuthigh; + const double _ratiomaxcutlow; + const double _presamplecut; + const unsigned int _niter; bool _fitab; - double _alpha; - double _beta; - unsigned int _nevtmax; - double _noise; - double _chi2cut; - std::string _ecalPart; - bool _docorpn; - int _fedid; - bool _saveallevents; - double _qualpercent; - int _debug; + const double _alpha; + const double _beta; + const unsigned int _nevtmax; + const double _noise; + const double _chi2cut; + const std::string _ecalPart; + const bool _docorpn; + const int _fedid; + const bool _saveallevents; + const double _qualpercent; + const int _debug; TAPDPulse *APDPulse; TPNPulse *PNPulse; @@ -102,13 +121,8 @@ class EcalLaserAnalyzer : public edm::EDAnalyzer { bool doesABTreeExist; - std::string resdir_; - std::string pncorfile_; - std::string digiCollection_; - std::string digiPNCollection_; - std::string digiProducer_; - std::string eventHeaderCollection_; - std::string eventHeaderProducer_; + const std::string resdir_; + const std::string pncorfile_; // Output file names @@ -232,3 +246,4 @@ class EcalLaserAnalyzer : public edm::EDAnalyzer { bool isGainOK; bool isTimingOK; }; +#endif diff --git a/CalibCalorimetry/EcalLaserAnalyzer/plugins/EcalLaserAnalyzer2.cc b/CalibCalorimetry/EcalLaserAnalyzer/plugins/EcalLaserAnalyzer2.cc index cd5a6ce560a3e..b3f78c55771c0 100644 --- a/CalibCalorimetry/EcalLaserAnalyzer/plugins/EcalLaserAnalyzer2.cc +++ b/CalibCalorimetry/EcalLaserAnalyzer/plugins/EcalLaserAnalyzer2.cc @@ -1,5 +1,6 @@ /* * \class EcalLaserAnalyzer2 + * * primary author: Julie Malcles - CEA/Saclay * author: Gautier Hamel De Monchenault - CEA/Saclay */ @@ -15,28 +16,18 @@ #include "CalibCalorimetry/EcalLaserAnalyzer/plugins/EcalLaserAnalyzer2.h" #include -#include -#include #include +#include #include -#include -#include #include -#include -#include - #include #include #include -#include #include #include -#include - -#include #include #include @@ -56,8 +47,15 @@ using namespace std; EcalLaserAnalyzer2::EcalLaserAnalyzer2(const edm::ParameterSet& iConfig) //======================================================================== : iEvent(0), - - // framework parameters with default values + eventHeaderCollection_(iConfig.getParameter("eventHeaderCollection")), + eventHeaderProducer_(iConfig.getParameter("eventHeaderProducer")), + digiCollection_(iConfig.getParameter("digiCollection")), + digiProducer_(iConfig.getParameter("digiProducer")), + digiPNCollection_(iConfig.getParameter("digiPNCollection")), + rawDataToken_(consumes(edm::InputTag(eventHeaderProducer_, eventHeaderCollection_))), + pnDiodeDigiToken_(consumes(edm::InputTag(digiProducer_, digiPNCollection_))), + mappingToken_(esConsumes()), + // Framework parameters with default values _nsamples(iConfig.getUntrackedParameter("nSamples", 10)), _presample(iConfig.getUntrackedParameter("nPresamples", 2)), _firstsample(iConfig.getUntrackedParameter("firstSample", 1)), @@ -83,6 +81,9 @@ EcalLaserAnalyzer2::EcalLaserAnalyzer2(const edm::ParameterSet& iConfig) _saveallevents(iConfig.getUntrackedParameter("saveAllEvents", false)), _qualpercent(iConfig.getUntrackedParameter("qualPercent", 0.2)), _debug(iConfig.getUntrackedParameter("debug", 0)), + resdir_(iConfig.getUntrackedParameter("resDir")), + elecfile_(iConfig.getUntrackedParameter("elecFile")), + pncorfile_(iConfig.getUntrackedParameter("pnCorFile")), nCrys(NCRYSEB), nPNPerMod(NPNPERMOD), nMod(NMODEB), @@ -116,18 +117,11 @@ EcalLaserAnalyzer2::EcalLaserAnalyzer2(const edm::ParameterSet& iConfig) //======================================================================== { - // Initialization from cfg file - - resdir_ = iConfig.getUntrackedParameter("resDir"); - elecfile_ = iConfig.getUntrackedParameter("elecFile"); - pncorfile_ = iConfig.getUntrackedParameter("pnCorFile"); - - digiCollection_ = iConfig.getParameter("digiCollection"); - digiPNCollection_ = iConfig.getParameter("digiPNCollection"); - digiProducer_ = iConfig.getParameter("digiProducer"); - - eventHeaderCollection_ = iConfig.getParameter("eventHeaderCollection"); - eventHeaderProducer_ = iConfig.getParameter("eventHeaderProducer"); + if (_ecalPart == "EB") { + ebDigiToken_ = consumes(edm::InputTag(digiProducer_, digiCollection_)); + } else if (_ecalPart == "EE") { + eeDigiToken_ = consumes(edm::InputTag(digiProducer_, digiCollection_)); + } // Geometrical constants initialization if (_ecalPart == "EB") { @@ -198,7 +192,7 @@ EcalLaserAnalyzer2::EcalLaserAnalyzer2(const edm::ParameterSet& iConfig) EcalLaserAnalyzer2::~EcalLaserAnalyzer2() { //======================================================================== - // do anything here that needs to be done at desctruction time + // do anything here that needs to be done at destruction time // (e.g. close files, deallocate resources etc.) } @@ -267,7 +261,7 @@ void EcalLaserAnalyzer2::beginJob() { IsMatacqOK = getShapes(); if (!IsMatacqOK) { - cout << " ERROR! No matacq shape available: analysis aborted !" << endl; + edm::LogError("noshape") << " ERROR! No matacq shape available: analysis aborted !"; return; } @@ -285,11 +279,11 @@ void EcalLaserAnalyzer2::analyze(const edm::Event& e, const edm::EventSetup& c) // retrieving DCC header edm::Handle pDCCHeader; const EcalRawDataCollection* DCCHeader = nullptr; - try { - e.getByLabel(eventHeaderProducer_, eventHeaderCollection_, pDCCHeader); + e.getByToken(rawDataToken_, pDCCHeader); + if (!pDCCHeader.isValid()) { + edm::LogError("nodata") << "Error! can't get the product retrieving DCC header" << eventHeaderCollection_.c_str(); + } else { DCCHeader = pDCCHeader.product(); - } catch (std::exception& ex) { - std::cerr << "Error! can't get the product retrieving DCC header" << eventHeaderCollection_.c_str() << std::endl; } //retrieving crystal data from Event @@ -297,46 +291,37 @@ void EcalLaserAnalyzer2::analyze(const edm::Event& e, const edm::EventSetup& c) const EBDigiCollection* EBDigi = nullptr; edm::Handle pEEDigi; const EEDigiCollection* EEDigi = nullptr; - if (_ecalPart == "EB") { - try { - e.getByLabel(digiProducer_, digiCollection_, pEBDigi); + e.getByToken(ebDigiToken_, pEBDigi); + if (!pEBDigi.isValid()) { + edm::LogError("nodata") << "Error! can't get the product retrieving EB crystal data " << digiCollection_.c_str(); + } else { EBDigi = pEBDigi.product(); - } catch (std::exception& ex) { - std::cerr << "Error! can't get the product retrieving EB crystal data " << digiCollection_.c_str() << std::endl; } } else if (_ecalPart == "EE") { - try { - e.getByLabel(digiProducer_, digiCollection_, pEEDigi); + e.getByToken(eeDigiToken_, pEEDigi); + if (!pEEDigi.isValid()) { + edm::LogError("nodata") << "Error! can't get the product retrieving EE crystal data " << digiCollection_.c_str(); + } else { EEDigi = pEEDigi.product(); - } catch (std::exception& ex) { - std::cerr << "Error! can't get the product retrieving EE crystal data " << digiCollection_.c_str() << std::endl; } } else { - cout << " Wrong ecalPart in cfg file " << endl; + edm::LogError("cfg_error") << " Wrong ecalPart in cfg file "; return; } // retrieving crystal PN diodes from Event - edm::Handle pPNDigi; const EcalPnDiodeDigiCollection* PNDigi = nullptr; - try { - e.getByLabel(digiProducer_, digiPNCollection_, pPNDigi); + e.getByToken(pnDiodeDigiToken_, pPNDigi); + if (!pPNDigi.isValid()) { + edm::LogError("nodata") << "Error! can't get the product " << digiPNCollection_.c_str(); + } else { PNDigi = pPNDigi.product(); - } catch (std::exception& ex) { - std::cerr << "Error! can't get the product " << digiPNCollection_.c_str() << std::endl; } // retrieving electronics mapping - edm::ESHandle ecalmapping; - const EcalElectronicsMapping* TheMapping = nullptr; - try { - c.get().get(ecalmapping); - TheMapping = ecalmapping.product(); - } catch (std::exception& ex) { - std::cerr << "Error! can't get the product EcalMappingRcd" << std::endl; - } + const auto& TheMapping = c.getData(mappingToken_); // ==================================== // Decode Basic DCCHeader Information @@ -379,7 +364,7 @@ void EcalLaserAnalyzer2::analyze(const edm::Event& e, const edm::EventSetup& c) vector::iterator iter = find(colors.begin(), colors.end(), color); if (iter == colors.end()) { colors.push_back(color); - cout << " new color found " << color << " " << colors.size() << endl; + edm::LogVerbatim("EcalLaserAnalyzer2") << " new color found " << color << " " << colors.size(); } } @@ -417,7 +402,8 @@ void EcalLaserAnalyzer2::analyze(const edm::Event& e, const edm::EventSetup& c) EcalPnDiodeDetId pnDetId = EcalPnDiodeDetId((*pnItr).id()); if (_debug == 1) - cout << "-- debug test -- Inside PNDigi - pnID=" << pnDetId.iPnId() << ", dccID=" << pnDetId.iDCCId() << endl; + edm::LogVerbatim("EcalLaserAnalyzer2") + << "-- debug test -- Inside PNDigi - pnID=" << pnDetId.iPnId() << ", dccID=" << pnDetId.iDCCId(); // Skip MEM DCC without relevant data @@ -437,7 +423,7 @@ void EcalLaserAnalyzer2::analyze(const edm::Event& e, const edm::EventSetup& c) } if (pnGain != 1) - cout << "PN gain different from 1" << endl; + edm::LogVerbatim("EcalLaserAnalyzer2") << "PN gain different from 1"; // Calculate amplitude from pulse @@ -462,7 +448,8 @@ void EcalLaserAnalyzer2::analyze(const edm::Event& e, const edm::EventSetup& c) allPNAmpl[pnDetId.iDCCId()].push_back(pnAmpl); if (_debug == 1) - cout << "-- debug -- Inside PNDigi - PNampl=" << pnAmpl << ", PNgain=" << pnGain << endl; + edm::LogVerbatim("EcalLaserAnalyzer2") + << "-- debug -- Inside PNDigi - PNampl=" << pnAmpl << ", PNgain=" << pnGain; } // =========================== @@ -483,7 +470,7 @@ void EcalLaserAnalyzer2::analyze(const edm::Event& e, const edm::EventSetup& c) EBDetId id_crystal(digiItr->id()); EBDataFrame df(*digiItr); - EcalElectronicsId elecid_crystal = TheMapping->getElectronicsId(id_crystal); + EcalElectronicsId elecid_crystal = TheMapping.getElectronicsId(id_crystal); int etaG = id_crystal.ieta(); // global int phiG = id_crystal.iphi(); // global @@ -512,8 +499,9 @@ void EcalLaserAnalyzer2::analyze(const edm::Event& e, const edm::EventSetup& c) setGeomEB(etaG, phiG, module, tower, strip, xtal, apdRefTT, channel, lmr); if (_debug == 1) - cout << "-- debug -- Inside EBDigi - towerID:" << towerID << " channelID:" << channelID << " module:" << module - << " modules:" << modules.size() << endl; + edm::LogVerbatim("EcalLaserAnalyzer2") + << "-- debug -- Inside EBDigi - towerID:" << towerID << " channelID:" << channelID << " module:" << module + << " modules:" << modules.size(); // APD Pulse //=========== @@ -567,6 +555,7 @@ void EcalLaserAnalyzer2::analyze(const edm::Event& e, const edm::EventSetup& c) Delta12->addEntry(APDPulse->getDelta(1, 2)); } } + } else if (EEDigi) { // Loop on crystals //=================== @@ -577,7 +566,7 @@ void EcalLaserAnalyzer2::analyze(const edm::Event& e, const edm::EventSetup& c) EEDetId id_crystal(digiItr->id()); EEDataFrame df(*digiItr); - EcalElectronicsId elecid_crystal = TheMapping->getElectronicsId(id_crystal); + EcalElectronicsId elecid_crystal = TheMapping.getElectronicsId(id_crystal); int etaG = id_crystal.iy(); int phiG = id_crystal.ix(); @@ -610,14 +599,15 @@ void EcalLaserAnalyzer2::analyze(const edm::Event& e, const edm::EventSetup& c) setGeomEE(etaG, phiG, iX, iY, iZ, module, tower, ch, apdRefTT, channel, lmr); if (_debug == 1) - cout << "-- debug -- Inside EEDigi - towerID:" << towerID << " channelID:" << channelID << " module:" << module - << " modules:" << modules.size() << endl; + edm::LogVerbatim("EcalLaserAnalyzer2") + << "-- debug -- Inside EEDigi - towerID:" << towerID << " channelID:" << channelID << " module:" << module + << " modules:" << modules.size(); // APD Pulse //=========== if ((*digiItr).size() > 10) - cout << "SAMPLES SIZE > 10!" << (*digiItr).size() << endl; + edm::LogVerbatim("EcalLaserAnalyzer2") << "SAMPLES SIZE > 10!" << (*digiItr).size(); // Loop on adc samples @@ -678,9 +668,9 @@ void EcalLaserAnalyzer2::endJob() { //======================================================================== if (!IsMatacqOK) { - cout << "\n\t+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+" << endl; - cout << "\t+=+ WARNING! NO MATACQ +=+" << endl; - cout << "\t+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+" << endl; + edm::LogVerbatim("EcalLaserAnalyzer2") << "\n\t+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+"; + edm::LogVerbatim("EcalLaserAnalyzer2") << "\t+=+ WARNING! NO MATACQ +=+"; + edm::LogVerbatim("EcalLaserAnalyzer2") << "\t+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+"; return; } @@ -712,7 +702,7 @@ void EcalLaserAnalyzer2::endJob() { stringstream del; del << "rm " << ADCfile; system(del.str().c_str()); - cout << " No Laser Events " << endl; + edm::LogVerbatim("EcalLaserAnalyzer2") << " No Laser Events "; return; } @@ -751,13 +741,13 @@ void EcalLaserAnalyzer2::endJob() { // Analyze adc samples to get amplitudes //======================================= - cout << "\n\t+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+" << endl; - cout << "\t+=+ Analyzing laser data: getting APD, PN, APD/PN, PN/PN +=+" << endl; + edm::LogVerbatim("EcalLaserAnalyzer2") << "\n\t+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+"; + edm::LogVerbatim("EcalLaserAnalyzer2") << "\t+=+ Analyzing laser data: getting APD, PN, APD/PN, PN/PN +=+"; if (!isGainOK) - cout << "\t+=+ ............................ WARNING! APD GAIN WAS NOT 1 +=+" << endl; + edm::LogVerbatim("EcalLaserAnalyzer2") << "\t+=+ ............................ WARNING! APD GAIN WAS NOT 1 +=+"; if (!isTimingOK) - cout << "\t+=+ ............................ WARNING! TIMING WAS BAD +=+" << endl; + edm::LogVerbatim("EcalLaserAnalyzer2") << "\t+=+ ............................ WARNING! TIMING WAS BAD +=+"; APDFile = new TFile(APDfile.c_str(), "RECREATE"); @@ -838,6 +828,7 @@ void EcalLaserAnalyzer2::endJob() { for (unsigned int iM = 0; iM < nMod; iM++) { unsigned int iMod = modules[iM] - 1; + for (unsigned int ich = 0; ich < nPNPerMod; ich++) { for (unsigned int icol = 0; icol < nCol; icol++) { PNFirstAnal[iMod][ich][icol] = new TPN(ich); @@ -911,8 +902,8 @@ void EcalLaserAnalyzer2::endJob() { } if (_debug >= 1) - cout << "-- debug test -- endJob -- apdAmpl:" << apdAmpl << " apdTime:" << apdTime << endl; - + edm::LogVerbatim("EcalLaserAnalyzer2") + << "-- debug test -- endJob -- apdAmpl:" << apdAmpl << " apdTime:" << apdTime; double pnmean; if (pn0 < 10 && pn1 > 10) { pnmean = pn1; @@ -922,7 +913,7 @@ void EcalLaserAnalyzer2::endJob() { pnmean = 0.5 * (pn0 + pn1); if (_debug >= 1) - cout << "-- debug test -- endJob -- pnMean:" << pnmean << endl; + edm::LogVerbatim("EcalLaserAnalyzer2") << "-- debug test -- endJob -- pnMean:" << pnmean; // Fill PN stuff //=============== @@ -939,7 +930,7 @@ void EcalLaserAnalyzer2::endJob() { if (apdAmpl != 0.0) APDFirstAnal[iCry][iCol]->addEntry(apdAmpl, pnmean, pn0, pn1, apdTime); if (_debug >= 1) - cout << "-- debug test -- endJob -- filling APDTree" << endl; + edm::LogVerbatim("EcalLaserAnalyzer2") << "-- debug test -- endJob -- filling APDTree"; APDtrees[iCry]->Fill(); @@ -954,28 +945,28 @@ void EcalLaserAnalyzer2::endJob() { for (unsigned int ir = 0; ir < nRefChan; ir++) { if (_debug >= 1) - cout << "-- debug test -- ir:" << ir << " tt:" << towerID << " refmap:" << apdRefMap[ir][iMod + 1] - << " iCry:" << iCry << endl; + edm::LogVerbatim("EcalLaserAnalyzer2") << "-- debug test -- ir:" << ir << " tt:" << towerID + << " refmap:" << apdRefMap[ir][iMod + 1] << " iCry:" << iCry; if (apdRefMap[ir][iMod + 1] == iCry) { if (_debug >= 1) - cout << "-- debug test -- cut passed " << endl; + edm::LogVerbatim("EcalLaserAnalyzer2") << "-- debug test -- cut passed "; if (ir == 0) apdAmplA = apdAmpl; else if (ir == 1) apdAmplB = apdAmpl; if (_debug >= 1) - cout << "-- debug test -- apdAmplA=" << apdAmplA << endl; + edm::LogVerbatim("EcalLaserAnalyzer2") << "-- debug test -- apdAmplA=" << apdAmplA; if (_debug >= 1) - cout << "-- debug test -- apdAmplB=" << apdAmplB << endl; + edm::LogVerbatim("EcalLaserAnalyzer2") << "-- debug test -- apdAmplB=" << apdAmplB; if (_debug >= 1) - cout << "-- debug test -- color=" << color << ", event:" << event << ", ir:" << ir - << " tt-1:" << towerID - 1 << endl; + edm::LogVerbatim("EcalLaserAnalyzer2") << "-- debug test -- color=" << color << ", event:" << event + << ", ir:" << ir << " tt-1:" << towerID - 1; RefAPDtrees[ir][iMod + 1]->Fill(); if (_debug >= 1) - cout << "-- debug test -- tree filled" << event << endl; + edm::LogVerbatim("EcalLaserAnalyzer2") << "-- debug test -- tree filled" << event; } } } @@ -987,11 +978,10 @@ void EcalLaserAnalyzer2::endJob() { ADCFile->Close(); if (_debug == 1) - cout << "-- debug test -- endJob -- after apdAmpl Loop" << endl; + edm::LogVerbatim("EcalLaserAnalyzer2") << "-- debug test -- endJob -- after apdAmpl Loop"; // Remove temporary file //======================= - stringstream del; del << "rm " << ADCfile; system(del.str().c_str()); @@ -1074,7 +1064,6 @@ void EcalLaserAnalyzer2::endJob() { // Build ref trees indexes //======================== - for (unsigned int imod = 0; imod < nMod; imod++) { int jmod = modules[imod]; if (RefAPDtrees[0][jmod]->GetEntries() != 0 && RefAPDtrees[1][jmod]->GetEntries() != 0) { @@ -1122,7 +1111,6 @@ void EcalLaserAnalyzer2::endJob() { APDFirstAnal[iCry][iCol]->getAPDoPN1().at(1)); APDAnal[iCry][iCol]->setTimeCut(APDFirstAnal[iCry][iCol]->getTime().at(0), APDFirstAnal[iCry][iCol]->getTime().at(1)); - APDAnal[iCry][iCol]->set2DAPDoAPD0Cut(lowcut, highcut); APDAnal[iCry][iCol]->set2DAPDoAPD1Cut(lowcut, highcut); } @@ -1144,7 +1132,7 @@ void EcalLaserAnalyzer2::endJob() { pnmean = 0.5 * (pn0 + pn1); // Get back color - //=============== + //================ unsigned int iCol = 0; for (unsigned int i = 0; i < nCol; i++) { @@ -1167,7 +1155,7 @@ void EcalLaserAnalyzer2::endJob() { //=================== if (_debug >= 1) - cout << "-- debug test -- LastLoop event:" << event << " apdAmpl:" << apdAmpl << endl; + edm::LogVerbatim("EcalLaserAnalyzer2") << "-- debug test -- LastLoop event:" << event << " apdAmpl:" << apdAmpl; apdAmplA = 0.0; apdAmplB = 0.0; @@ -1176,8 +1164,9 @@ void EcalLaserAnalyzer2::endJob() { } if (_debug == 1) - cout << "-- debug test -- LastLoop apdAmplA:" << apdAmplA << " apdAmplB:" << apdAmplB << ", event:" << event - << ", eventref:" << eventref << endl; + edm::LogVerbatim("EcalLaserAnalyzer2") + << "-- debug test -- LastLoop apdAmplA:" << apdAmplA << " apdAmplB:" << apdAmplB << ", event:" << event + << ", eventref:" << eventref; // Fill APD stuff //=============== @@ -1229,8 +1218,8 @@ void EcalLaserAnalyzer2::endJob() { flag = 0; if (_debug >= 1) - cout << "-- debug test -- endJob -- APD[0]" << APD[0] << " APDoPN[0] " << APDoPN[0] << " APDoAPDA[0] " - << APDoAPDA[0] << " flag " << flag << endl; + edm::LogVerbatim("EcalLaserAnalyzer2") << "-- debug test -- endJob -- APD[0]" << APD[0] << " APDoPN[0] " + << APDoPN[0] << " APDoAPDA[0] " << APDoAPDA[0] << " flag " << flag; restrees[iColor]->Fill(); } } @@ -1264,8 +1253,9 @@ void EcalLaserAnalyzer2::endJob() { } if (_debug >= 1) - cout << "-- debug test -- endJob -- filling pn results'tree: PN[0]:" << PN[0] << " iModule:" << iMod - << " iColor:" << iColor << " ch:" << ch << endl; + edm::LogVerbatim("EcalLaserAnalyzer2") + << "-- debug test -- endJob -- filling pn results'tree: PN[0]:" << PN[0] << " iModule:" << iMod + << " iColor:" << iColor << " ch:" << ch; // Fill PN results trees //======================== @@ -1277,7 +1267,6 @@ void EcalLaserAnalyzer2::endJob() { // Remove temporary files //======================== - if (!_saveallevents) { APDFile->Close(); stringstream del2; @@ -1287,6 +1276,7 @@ void EcalLaserAnalyzer2::endJob() { } else { APDFile->cd(); APDtrees[0]->Write(); + APDFile->Close(); resFile->cd(); } @@ -1301,8 +1291,8 @@ void EcalLaserAnalyzer2::endJob() { resFile->Close(); - cout << "\t+=+ .................................................. done +=+" << endl; - cout << "\t+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+" << endl; + edm::LogVerbatim("EcalLaserAnalyzer2") << "\t+=+ .................................................. done +=+"; + edm::LogVerbatim("EcalLaserAnalyzer2") << "\t+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+"; } //======================================================================== @@ -1333,7 +1323,7 @@ bool EcalLaserAnalyzer2::getShapes() { laserShape->Scale(1.0 / y); } } else { - cout << " ERROR! Matacq shape file not found !" << endl; + edm::LogError("file_not_found") << " ERROR! Matacq shape file not found !"; } if (doesMatShapeExist) IsMatacqOK = true; @@ -1365,7 +1355,7 @@ bool EcalLaserAnalyzer2::getShapes() { } } else { - cout << " ERROR! Elec shape file not found !" << endl; + edm::LogError("file_not_found") << " ERROR! Elec shape file not found !"; } if (IsMatacqOK) { @@ -1380,7 +1370,8 @@ bool EcalLaserAnalyzer2::getShapes() { unsigned int nBins2 = int(elecShape->GetNbinsX()); if (nBins2 < nBins) { - cout << "EcalLaserAnalyzer2::getShapes: wrong configuration of the shapes' number of bins" << std::endl; + edm::LogError("cfg_error") + << "EcalLaserAnalyzer2::getShapes: wrong configuration of the shapes' number of bins"; isSPRFine = false; } assert(nSamplesShapes == nBins2); @@ -1498,4 +1489,5 @@ void EcalLaserAnalyzer2::setGeomEE( idccID[channel] = dccID; iside[channel] = side; } + DEFINE_FWK_MODULE(EcalLaserAnalyzer2); diff --git a/CalibCalorimetry/EcalLaserAnalyzer/plugins/EcalLaserAnalyzer2.h b/CalibCalorimetry/EcalLaserAnalyzer/plugins/EcalLaserAnalyzer2.h index 55cdaa7d81ec1..23b2320ed6d31 100644 --- a/CalibCalorimetry/EcalLaserAnalyzer/plugins/EcalLaserAnalyzer2.h +++ b/CalibCalorimetry/EcalLaserAnalyzer/plugins/EcalLaserAnalyzer2.h @@ -1,7 +1,18 @@ +#ifndef CalibCalorimetry_EcalLaserAnalyzer_EcalLaserAnalyzer2_h +#define CalibCalorimetry_EcalLaserAnalyzer_EcalLaserAnalyzer2_h // $Id: EcalLaserAnalyzer2.h #include -#include + +#include +#include + +#include + +#include +#include +#include +#include class TFile; class TTree; @@ -40,7 +51,7 @@ class TMem; #define NREFCHAN 2 // Ref number for APDB #define NSAMPSHAPES 250 -class EcalLaserAnalyzer2 : public edm::EDAnalyzer { +class EcalLaserAnalyzer2 : public edm::one::EDAnalyzer<> { public: explicit EcalLaserAnalyzer2(const edm::ParameterSet &iConfig); ~EcalLaserAnalyzer2() override; @@ -58,35 +69,45 @@ class EcalLaserAnalyzer2 : public edm::EDAnalyzer { private: int iEvent; + const std::string eventHeaderCollection_; + const std::string eventHeaderProducer_; + const std::string digiCollection_; + const std::string digiProducer_; + const std::string digiPNCollection_; + + const edm::EDGetTokenT rawDataToken_; + edm::EDGetTokenT ebDigiToken_; + edm::EDGetTokenT eeDigiToken_; + const edm::EDGetTokenT pnDiodeDigiToken_; + const edm::ESGetToken mappingToken_; + // Framework parameters - unsigned int _nsamples; + const unsigned int _nsamples; unsigned int _presample; - unsigned int _firstsample; - unsigned int _lastsample; - unsigned int _samplemin; - unsigned int _samplemax; - unsigned int _nsamplesPN; - unsigned int _presamplePN; - unsigned int _firstsamplePN; - unsigned int _lastsamplePN; - unsigned int _timingcutlow; - unsigned int _timingcuthigh; - unsigned int _timingquallow; - unsigned int _timingqualhigh; - double _ratiomincutlow; - double _ratiomincuthigh; - double _ratiomaxcutlow; - double _presamplecut; - unsigned int _niter; - double _noise; - std::string _ecalPart; - bool _saveshapes; - bool _docorpn; - int _fedid; - bool _saveallevents; - double _qualpercent; - int _debug; + const unsigned int _firstsample; + const unsigned int _lastsample; + const unsigned int _nsamplesPN; + const unsigned int _presamplePN; + const unsigned int _firstsamplePN; + const unsigned int _lastsamplePN; + const unsigned int _timingcutlow; + const unsigned int _timingcuthigh; + const unsigned int _timingquallow; + const unsigned int _timingqualhigh; + const double _ratiomincutlow; + const double _ratiomincuthigh; + const double _ratiomaxcutlow; + const double _presamplecut; + const unsigned int _niter; + const double _noise; + const std::string _ecalPart; + const bool _saveshapes; + const bool _docorpn; + const int _fedid; + const bool _saveallevents; + const double _qualpercent; + const int _debug; TAPDPulse *APDPulse; TPNPulse *PNPulse; @@ -94,14 +115,9 @@ class EcalLaserAnalyzer2 : public edm::EDAnalyzer { TMom *Delta01; TMom *Delta12; - std::string resdir_; - std::string digiCollection_; - std::string elecfile_; - std::string pncorfile_; - std::string digiPNCollection_; - std::string digiProducer_; - std::string eventHeaderCollection_; - std::string eventHeaderProducer_; + const std::string resdir_; + const std::string elecfile_; + const std::string pncorfile_; // Output file names @@ -243,3 +259,4 @@ class EcalLaserAnalyzer2 : public edm::EDAnalyzer { bool isGainOK; bool isTimingOK; }; +#endif diff --git a/CalibCalorimetry/EcalLaserAnalyzer/plugins/EcalPerEvtLaserAnalyzer.cc b/CalibCalorimetry/EcalLaserAnalyzer/plugins/EcalPerEvtLaserAnalyzer.cc index 7feaa380bc004..53654b6ad07f5 100644 --- a/CalibCalorimetry/EcalLaserAnalyzer/plugins/EcalPerEvtLaserAnalyzer.cc +++ b/CalibCalorimetry/EcalLaserAnalyzer/plugins/EcalPerEvtLaserAnalyzer.cc @@ -11,12 +11,10 @@ #include "EcalPerEvtLaserAnalyzer.h" #include -#include #include #include #include -#include #include #include @@ -25,17 +23,9 @@ #include #include #include -#include -#include -#include - -#include #include #include -#include - -#include #include #include @@ -46,14 +36,19 @@ using namespace std; EcalPerEvtLaserAnalyzer::EcalPerEvtLaserAnalyzer(const edm::ParameterSet& iConfig) //======================================================================== : iEvent(0), - + eventHeaderCollection_(iConfig.getParameter("eventHeaderCollection")), + eventHeaderProducer_(iConfig.getParameter("eventHeaderProducer")), + digiCollection_(iConfig.getParameter("digiCollection")), + digiProducer_(iConfig.getParameter("digiProducer")), + digiPNCollection_(iConfig.getParameter("digiPNCollection")), + rawDataToken_(consumes(edm::InputTag(eventHeaderProducer_, eventHeaderCollection_))), + pnDiodeDigiToken_(consumes(edm::InputTag(digiProducer_, digiPNCollection_))), + mappingToken_(esConsumes()), // framework parameters with default values _nsamples(iConfig.getUntrackedParameter("nSamples", 10)), _presample(iConfig.getUntrackedParameter("nPresamples", 3)), _firstsample(iConfig.getUntrackedParameter("firstSample", 1)), _lastsample(iConfig.getUntrackedParameter("lastSample", 2)), - _samplemin(iConfig.getUntrackedParameter("sampleMin", 3)), - _samplemax(iConfig.getUntrackedParameter("sampleMax", 9)), _nsamplesPN(iConfig.getUntrackedParameter("nSamplesPN", 50)), _presamplePN(iConfig.getUntrackedParameter("nPresamplesPN", 6)), _firstsamplePN(iConfig.getUntrackedParameter("firstSamplePN", 7)), @@ -65,11 +60,10 @@ EcalPerEvtLaserAnalyzer::EcalPerEvtLaserAnalyzer(const edm::ParameterSet& iConfi _tower(iConfig.getUntrackedParameter("tower", 1)), _channel(iConfig.getUntrackedParameter("channel", 1)), _ecalPart(iConfig.getUntrackedParameter("ecalPart", "EB")), + resdir_(iConfig.getUntrackedParameter("resDir")), + refalphabeta_(iConfig.getUntrackedParameter("refAlphaBeta")), nCrys(NCRYSEB), - nTT(NTTEB), - nSides(NSIDES), IsFileCreated(0), - nCh(0), runType(-1), runNum(0), dccID(-1), @@ -83,26 +77,18 @@ EcalPerEvtLaserAnalyzer::EcalPerEvtLaserAnalyzer(const edm::ParameterSet& iConfi //======================================================================== { - //now do what ever initialization is needed - - resdir_ = iConfig.getUntrackedParameter("resDir"); - refalphabeta_ = iConfig.getUntrackedParameter("refAlphaBeta"); - - digiCollection_ = iConfig.getParameter("digiCollection"); - digiPNCollection_ = iConfig.getParameter("digiPNCollection"); - digiProducer_ = iConfig.getParameter("digiProducer"); - - eventHeaderCollection_ = iConfig.getParameter("eventHeaderCollection"); - eventHeaderProducer_ = iConfig.getParameter("eventHeaderProducer"); + if (_ecalPart == "EB") { + ebDigiToken_ = consumes(edm::InputTag(digiProducer_, digiCollection_)); + } else if (_ecalPart == "EE") { + eeDigiToken_ = consumes(edm::InputTag(digiProducer_, digiCollection_)); + } // Define geometrical constants - + // if (_ecalPart == "EB") { nCrys = NCRYSEB; - nTT = NTTEB; } else { nCrys = NCRYSEE; - nTT = NTTEE; } } @@ -157,7 +143,6 @@ void EcalPerEvtLaserAnalyzer::beginJob() { ADCtrees->SetBranchAddress("pn1", &pn1); IsFileCreated = 0; - nCh = nCrys; } //======================================================================== @@ -169,11 +154,11 @@ void EcalPerEvtLaserAnalyzer::analyze(const edm::Event& e, const edm::EventSetup // retrieving DCC header edm::Handle pDCCHeader; const EcalRawDataCollection* DCCHeader = nullptr; - try { - e.getByLabel(eventHeaderProducer_, eventHeaderCollection_, pDCCHeader); + e.getByToken(rawDataToken_, pDCCHeader); + if (!pDCCHeader.isValid()) { + edm::LogError("nodata") << "Error! can't get the product retrieving DCC header" << eventHeaderCollection_.c_str(); + } else { DCCHeader = pDCCHeader.product(); - } catch (std::exception& ex) { - std::cerr << "Error! can't get the product retrieving DCC header" << eventHeaderCollection_.c_str() << std::endl; } // retrieving crystal data from Event @@ -181,42 +166,34 @@ void EcalPerEvtLaserAnalyzer::analyze(const edm::Event& e, const edm::EventSetup const EBDigiCollection* EBDigi = nullptr; edm::Handle pEEDigi; const EEDigiCollection* EEDigi = nullptr; - if (_ecalPart == "EB") { - try { - e.getByLabel(digiProducer_, digiCollection_, pEBDigi); + e.getByToken(ebDigiToken_, pEBDigi); + if (!pEBDigi.isValid()) { + edm::LogError("nodata") << "Error! can't get the product retrieving EB crystal data " << digiCollection_.c_str(); + } else { EBDigi = pEBDigi.product(); - } catch (std::exception& ex) { - std::cerr << "Error! can't get the product retrieving EB crystal data " << digiCollection_.c_str() << std::endl; } } else { - try { - e.getByLabel(digiProducer_, digiCollection_, pEEDigi); + e.getByToken(eeDigiToken_, pEEDigi); + if (!pEEDigi.isValid()) { + edm::LogError("nodata") << "Error! can't get the product retrieving EE crystal data " << digiCollection_.c_str(); + } else { EEDigi = pEEDigi.product(); - } catch (std::exception& ex) { - std::cerr << "Error! can't get the product retrieving EE crystal data " << digiCollection_.c_str() << std::endl; } } // retrieving crystal PN diodes from Event edm::Handle pPNDigi; const EcalPnDiodeDigiCollection* PNDigi = nullptr; - try { - e.getByLabel(digiProducer_, digiPNCollection_, pPNDigi); + e.getByToken(pnDiodeDigiToken_, pPNDigi); + if (!pPNDigi.isValid()) { + edm::LogError("nodata") << "Error! can't get the product " << digiPNCollection_.c_str(); + } else { PNDigi = pPNDigi.product(); - } catch (std::exception& ex) { - std::cerr << "Error! can't get the product " << digiPNCollection_.c_str() << std::endl; } // retrieving electronics mapping - edm::ESHandle ecalmapping; - const EcalElectronicsMapping* TheMapping = nullptr; - try { - c.get().get(ecalmapping); - TheMapping = ecalmapping.product(); - } catch (std::exception& ex) { - std::cerr << "Error! can't get the product EcalMappingRcd" << std::endl; - } + const auto& TheMapping = c.getData(mappingToken_); // ==================================== // Decode Basic DCCHeader Information @@ -285,7 +262,7 @@ void EcalPerEvtLaserAnalyzer::analyze(const edm::Event& e, const edm::EventSetup vector::iterator iter = find(colors.begin(), colors.end(), color); if (iter == colors.end()) { colors.push_back(color); - cout << " new color found " << color << " " << colors.size() << endl; + edm::LogVerbatim("EcalPerEvtLaserAnalyzer") << " new color found " << color << " " << colors.size(); } } @@ -391,7 +368,7 @@ void EcalPerEvtLaserAnalyzer::analyze(const edm::Event& e, const edm::EventSetup side = MEEBGeom::side(etaG, phiG); - EcalElectronicsId elecid_crystal = TheMapping->getElectronicsId(id_crystal); + EcalElectronicsId elecid_crystal = TheMapping.getElectronicsId(id_crystal); int towerID = elecid_crystal.towerId(); // int channelID=elecid_crystal.channelId()-1; // FIXME so far for endcap only @@ -479,7 +456,7 @@ void EcalPerEvtLaserAnalyzer::analyze(const edm::Event& e, const edm::EventSetup // Recover the TT id and the electronic crystal numbering from EcalElectronicsMapping - EcalElectronicsId elecid_crystal = TheMapping->getElectronicsId(id_crystal); + EcalElectronicsId elecid_crystal = TheMapping.getElectronicsId(id_crystal); int towerID = elecid_crystal.towerId(); int channelID = elecid_crystal.channelId() - 1; @@ -563,10 +540,14 @@ void EcalPerEvtLaserAnalyzer::endJob() { ADCtrees->Write(); - cout << "\n\t+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+" << endl; - cout << "\t+=+ Analyzing laser data: getting per event +=+" << endl; - cout << "\t+=+ APD Amplitudes and ADC samples +=+" << endl; - cout << "\t+=+ for fed:" << _fedid << ", tower:" << _tower << ", and channel:" << _channel << endl; + edm::LogVerbatim("EcalPerEvtLaserAnalyzer") + << "\n\t+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+"; + edm::LogVerbatim("EcalPerEvtLaserAnalyzer") + << "\t+=+ Analyzing laser data: getting per event +=+"; + edm::LogVerbatim("EcalPerEvtLaserAnalyzer") + << "\t+=+ APD Amplitudes and ADC samples +=+"; + edm::LogVerbatim("EcalPerEvtLaserAnalyzer") + << "\t+=+ for fed:" << _fedid << ", tower:" << _tower << ", and channel:" << _channel; // Define temporary tree to save APD amplitudes @@ -739,8 +720,10 @@ void EcalPerEvtLaserAnalyzer::endJob() { del << "rm " << ADCfile; system(del.str().c_str()); - cout << "\t+=+ .................................................. done +=+" << endl; - cout << "\t+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+" << endl; + edm::LogVerbatim("EcalPerEvtLaserAnalyzer") + << "\t+=+ .................................................. done +=+"; + edm::LogVerbatim("EcalPerEvtLaserAnalyzer") + << "\t+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+"; } DEFINE_FWK_MODULE(EcalPerEvtLaserAnalyzer); diff --git a/CalibCalorimetry/EcalLaserAnalyzer/plugins/EcalPerEvtLaserAnalyzer.h b/CalibCalorimetry/EcalLaserAnalyzer/plugins/EcalPerEvtLaserAnalyzer.h index 8828ad23a67ea..511edb95df466 100644 --- a/CalibCalorimetry/EcalLaserAnalyzer/plugins/EcalPerEvtLaserAnalyzer.h +++ b/CalibCalorimetry/EcalLaserAnalyzer/plugins/EcalPerEvtLaserAnalyzer.h @@ -1,10 +1,20 @@ +#ifndef CalibCalorimetry_EcalLaserAnalyzer_EcalPerEvtLaserAnalyzer_h +#define CalibCalorimetry_EcalLaserAnalyzer_EcalPerEvtLaserAnalyzer_h // $Id: EcalPerEvtLaserAnalyzer.h #include -#include -class TTree; +#include + +#include + +#include +#include +#include +#include + class TFile; +class TTree; // Define geometrical constants // NOT the same for "EB" and "EE" @@ -30,7 +40,7 @@ class TFile; #define NTTEE 33 // Number of EE Trigger Towers #define NPNEE 4 // Number of PN per EE supermodule -class EcalPerEvtLaserAnalyzer : public edm::EDAnalyzer { +class EcalPerEvtLaserAnalyzer : public edm::one::EDAnalyzer<> { public: explicit EcalPerEvtLaserAnalyzer(const edm::ParameterSet &iConfig); ~EcalPerEvtLaserAnalyzer() override; @@ -44,54 +54,51 @@ class EcalPerEvtLaserAnalyzer : public edm::EDAnalyzer { private: int iEvent; + const std::string eventHeaderCollection_; + const std::string eventHeaderProducer_; + const std::string digiCollection_; + const std::string digiProducer_; + const std::string digiPNCollection_; + + const edm::EDGetTokenT rawDataToken_; + edm::EDGetTokenT ebDigiToken_; + edm::EDGetTokenT eeDigiToken_; + const edm::EDGetTokenT pnDiodeDigiToken_; + const edm::ESGetToken mappingToken_; + // Framework parameters - unsigned int _nsamples; - unsigned int _presample; - unsigned int _firstsample; - unsigned int _lastsample; - unsigned int _samplemin; - unsigned int _samplemax; - unsigned int _nsamplesPN; - unsigned int _presamplePN; - unsigned int _firstsamplePN; - unsigned int _lastsamplePN; - unsigned int _timingcutlow; - unsigned int _timingcuthigh; - unsigned int _niter; - int _fedid; - unsigned int _tower; - unsigned int _channel; - std::string _ecalPart; - - std::string resdir_; - std::string refalphabeta_; - std::string digiCollection_; - std::string digiPNCollection_; - std::string digiProducer_; - std::string eventHeaderCollection_; - std::string eventHeaderProducer_; + const unsigned int _nsamples; + const unsigned int _presample; + const unsigned int _firstsample; + const unsigned int _lastsample; + const unsigned int _nsamplesPN; + const unsigned int _presamplePN; + const unsigned int _firstsamplePN; + const unsigned int _lastsamplePN; + const unsigned int _timingcutlow; + const unsigned int _timingcuthigh; + const unsigned int _niter; + const int _fedid; + const unsigned int _tower; + const unsigned int _channel; + const std::string _ecalPart; + + const std::string resdir_; + const std::string refalphabeta_; // Output file names - std::string alphafile; std::string ADCfile; - std::string APDfile; std::string resfile; // Define geometrical constants // Default values correspond to "EB" geometry (1700 crystals) unsigned int nCrys; - unsigned int nTT; - unsigned int nSides; int IsFileCreated; - // Define number of channels (68 or 1700) for alpha and beta calculation - - unsigned int nCh; - // Identify run type int runType; @@ -137,3 +144,4 @@ class EcalPerEvtLaserAnalyzer : public edm::EDAnalyzer { double apdTime; double pnAmpl; }; +#endif diff --git a/CalibCalorimetry/EcalLaserAnalyzer/plugins/EcalTestPulseAnalyzer.cc b/CalibCalorimetry/EcalLaserAnalyzer/plugins/EcalTestPulseAnalyzer.cc index 94f5dbf20a8fe..2a6b03dce1946 100644 --- a/CalibCalorimetry/EcalLaserAnalyzer/plugins/EcalTestPulseAnalyzer.cc +++ b/CalibCalorimetry/EcalLaserAnalyzer/plugins/EcalTestPulseAnalyzer.cc @@ -8,29 +8,20 @@ #include #include -using namespace std; #include "EcalTestPulseAnalyzer.h" #include -#include #include #include -#include #include #include -#include #include #include -#include -#include -#include - -#include -#include #include +#include #include #include @@ -45,9 +36,15 @@ using namespace std; EcalTestPulseAnalyzer::EcalTestPulseAnalyzer(const edm::ParameterSet& iConfig) //======================================================================== : iEvent(0), - + eventHeaderCollection_(iConfig.getParameter("eventHeaderCollection")), + eventHeaderProducer_(iConfig.getParameter("eventHeaderProducer")), + digiCollection_(iConfig.getParameter("digiCollection")), + digiProducer_(iConfig.getParameter("digiProducer")), + digiPNCollection_(iConfig.getParameter("digiPNCollection")), + rawDataToken_(consumes(edm::InputTag(eventHeaderProducer_, eventHeaderCollection_))), + pnDiodeDigiToken_(consumes(edm::InputTag(digiProducer_, digiPNCollection_))), + mappingToken_(esConsumes()), // framework parameters with default values - _nsamples(iConfig.getUntrackedParameter("nSamples", 10)), _presample(iConfig.getUntrackedParameter("nPresamples", 3)), _firstsample(iConfig.getUntrackedParameter("firstSample", 1)), @@ -63,8 +60,8 @@ EcalTestPulseAnalyzer::EcalTestPulseAnalyzer(const edm::ParameterSet& iConfig) _timeofmax(iConfig.getUntrackedParameter("timeOfMax", 4.5)), _ecalPart(iConfig.getUntrackedParameter("ecalPart", "EB")), _fedid(iConfig.getUntrackedParameter("fedID", -999)), + resdir_(iConfig.getUntrackedParameter("resDir")), nCrys(NCRYSEB), - nTT(NTTEB), nMod(NMODEB), nGainPN(NGAINPN), nGainAPD(NGAINAPD), @@ -89,25 +86,18 @@ EcalTestPulseAnalyzer::EcalTestPulseAnalyzer(const edm::ParameterSet& iConfig) //======================================================================== { - //now do what ever initialization is needed - - resdir_ = iConfig.getUntrackedParameter("resDir"); - - digiCollection_ = iConfig.getParameter("digiCollection"); - digiPNCollection_ = iConfig.getParameter("digiPNCollection"); - digiProducer_ = iConfig.getParameter("digiProducer"); - - eventHeaderCollection_ = iConfig.getParameter("eventHeaderCollection"); - eventHeaderProducer_ = iConfig.getParameter("eventHeaderProducer"); + if (_ecalPart == "EB") { + ebDigiToken_ = consumes(edm::InputTag(digiProducer_, digiCollection_)); + } else if (_ecalPart == "EE") { + eeDigiToken_ = consumes(edm::InputTag(digiProducer_, digiCollection_)); + } // Define geometrical constants if (_ecalPart == "EB") { nCrys = NCRYSEB; - nTT = NTTEB; } else { nCrys = NCRYSEE; - nTT = NTTEE; } iZ = 1; @@ -209,56 +199,47 @@ void EcalTestPulseAnalyzer::analyze(const edm::Event& e, const edm::EventSetup& // Retrieve DCC header edm::Handle pDCCHeader; const EcalRawDataCollection* DCCHeader = nullptr; - try { - e.getByLabel(eventHeaderProducer_, eventHeaderCollection_, pDCCHeader); + e.getByToken(rawDataToken_, pDCCHeader); + if (!pDCCHeader.isValid()) { + edm::LogError("nodata") << "Error! can't get the product retrieving DCC header" << eventHeaderCollection_.c_str(); + } else { DCCHeader = pDCCHeader.product(); - } catch (std::exception& ex) { - std::cerr << "Error! can't get the product retrieving DCC header" << eventHeaderCollection_.c_str() << std::endl; } - // retrieving crystal EB data from Event + // retrieving crystal data from Event edm::Handle pEBDigi; const EBDigiCollection* EBDigi = nullptr; - - // retrieving crystal EE data from Event edm::Handle pEEDigi; const EEDigiCollection* EEDigi = nullptr; - if (_ecalPart == "EB") { - try { - e.getByLabel(digiProducer_, digiCollection_, pEBDigi); + e.getByToken(ebDigiToken_, pEBDigi); + if (!pEBDigi.isValid()) { + edm::LogError("nodata") << "Error! can't get the product retrieving EB crystal data " << digiCollection_.c_str(); + } else { EBDigi = pEBDigi.product(); - } catch (std::exception& ex) { - std::cerr << "Error! can't get the product retrieving EB crystal data " << digiCollection_.c_str() << std::endl; } } else { - try { - e.getByLabel(digiProducer_, digiCollection_, pEEDigi); + e.getByToken(eeDigiToken_, pEEDigi); + if (!pEEDigi.isValid()) { + edm::LogError("nodata") << "Error! can't get the product retrieving EE crystal data " << digiCollection_.c_str(); + } else { EEDigi = pEEDigi.product(); - } catch (std::exception& ex) { - std::cerr << "Error! can't get the product retrieving EE crystal data " << digiCollection_.c_str() << std::endl; } } // Retrieve crystal PN diodes from Event edm::Handle pPNDigi; const EcalPnDiodeDigiCollection* PNDigi = nullptr; - try { - e.getByLabel(digiProducer_, digiPNCollection_, pPNDigi); + e.getByToken(pnDiodeDigiToken_, pPNDigi); + if (!pPNDigi.isValid()) { + edm::LogError("nodata") << "Error! can't get the product " << digiCollection_.c_str(); + } else { PNDigi = pPNDigi.product(); - } catch (std::exception& ex) { - std::cerr << "Error! can't get the product " << digiCollection_.c_str() << std::endl; } // retrieving electronics mapping - edm::ESHandle ecalmapping; - const EcalElectronicsMapping* TheMapping = nullptr; - try { - c.get().get(ecalmapping); - TheMapping = ecalmapping.product(); - } catch (std::exception& ex) { - std::cerr << "Error! can't get the product EcalMappingRcd" << std::endl; - } + const auto& TheMapping = c.getData(mappingToken_); + ; // ==================================== // Decode Basic DCCHeader Information @@ -338,7 +319,7 @@ void EcalTestPulseAnalyzer::analyze(const edm::Event& e, const edm::EventSetup& pnG[samId] = (*pnItr).sample(samId).gainId(); if (pnG[samId] != 1) - std::cout << "PN gain different from 1 for sample " << samId << std::endl; + edm::LogVerbatim("EcalTestPulseAnalyzer") << "PN gain different from 1 for sample " << samId; if (samId == 0) pngain = pnG[samId]; if (samId > 0) @@ -406,7 +387,7 @@ void EcalTestPulseAnalyzer::analyze(const edm::Event& e, const edm::EventSetup& side = MEEBGeom::side(etaG, phiG); - EcalElectronicsId elecid_crystal = TheMapping->getElectronicsId(id_crystal); + EcalElectronicsId elecid_crystal = TheMapping.getElectronicsId(id_crystal); towerID = elecid_crystal.towerId(); int strip = elecid_crystal.stripId(); @@ -522,7 +503,7 @@ void EcalTestPulseAnalyzer::analyze(const edm::Event& e, const edm::EventSetup& // Recover the TT id and the electronic crystal numbering from EcalElectronicsMapping - EcalElectronicsId elecid_crystal = TheMapping->getElectronicsId(id_crystal); + EcalElectronicsId elecid_crystal = TheMapping.getElectronicsId(id_crystal); towerID = elecid_crystal.towerId(); channelID = elecid_crystal.channelId() - 1; @@ -652,16 +633,16 @@ void EcalTestPulseAnalyzer::endJob() { del << "rm " << rootfile; system(del.str().c_str()); - std::cout << " No TP Events " << std::endl; + edm::LogVerbatim("EcalTestPulseAnalyzer") << " No TP Events "; return; } - std::cout << "\n\t+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+" << std::endl; - std::cout << "\t+=+ Analyzing test pulse data: getting APD, PN +=+" << std::endl; + edm::LogVerbatim("EcalTestPulseAnalyzer") << "\n\t+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+"; + edm::LogVerbatim("EcalTestPulseAnalyzer") << "\t+=+ Analyzing test pulse data: getting APD, PN +=+"; // Create output ntuples: - //std::cout<< "TP Test Name File "<< resfile.c_str() << std::endl; + //edm::LogVerbatim("EcalTestPulseAnalyzer")<< "TP Test Name File "<< resfile.c_str(); resFile = new TFile(resfile.c_str(), "RECREATE"); @@ -810,8 +791,8 @@ void EcalTestPulseAnalyzer::endJob() { respntrees->Write(); resFile->Close(); - std::cout << "\t+=+ ...................................... done +=+" << std::endl; - std::cout << "\t+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+" << std::endl; + edm::LogVerbatim("EcalTestPulseAnalyzer") << "\t+=+ ...................................... done +=+"; + edm::LogVerbatim("EcalTestPulseAnalyzer") << "\t+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+"; } DEFINE_FWK_MODULE(EcalTestPulseAnalyzer); diff --git a/CalibCalorimetry/EcalLaserAnalyzer/plugins/EcalTestPulseAnalyzer.h b/CalibCalorimetry/EcalLaserAnalyzer/plugins/EcalTestPulseAnalyzer.h index e21c2eee7ca2b..9e27a5e8ccb78 100644 --- a/CalibCalorimetry/EcalLaserAnalyzer/plugins/EcalTestPulseAnalyzer.h +++ b/CalibCalorimetry/EcalLaserAnalyzer/plugins/EcalTestPulseAnalyzer.h @@ -1,6 +1,17 @@ +#ifndef CalibCalorimetry_EcalLaserAnalyzer_EcalTestPulseAnalyzer_h +#define CalibCalorimetry_EcalLaserAnalyzer_EcalTestPulseAnalyzer_h #include -#include + +#include +#include + +#include + +#include +#include +#include +#include class TFile; class TTree; @@ -17,22 +28,20 @@ class TTree; // 7 8 // // -// "EB" geometry + // "EB" geometry #define NCRYSEB 1700 // Number of crystals per EB supermodule -#define NTTEB 68 // Number of EB Trigger Towers #define NMODEB 9 // Number of EB submodules #define NPNPERMOD 2 // Number of PN per module // "EE" geometry #define NCRYSEE 830 // Number of crystals per EE supermodule -#define NTTEE 68 // Number of EE Trigger Towers #define NMODEE 21 // Number of EE submodules #define NGAINPN 2 // Number of gains #define NGAINAPD 4 // Number of gains -class EcalTestPulseAnalyzer : public edm::EDAnalyzer { +class EcalTestPulseAnalyzer : public edm::one::EDAnalyzer<> { public: explicit EcalTestPulseAnalyzer(const edm::ParameterSet &iConfig); ~EcalTestPulseAnalyzer() override; @@ -44,30 +53,37 @@ class EcalTestPulseAnalyzer : public edm::EDAnalyzer { private: int iEvent; + const std::string eventHeaderCollection_; + const std::string eventHeaderProducer_; + const std::string digiCollection_; + const std::string digiProducer_; + const std::string digiPNCollection_; + + const edm::EDGetTokenT rawDataToken_; + edm::EDGetTokenT ebDigiToken_; + edm::EDGetTokenT eeDigiToken_; + const edm::EDGetTokenT pnDiodeDigiToken_; + const edm::ESGetToken mappingToken_; + // Framework parameters - unsigned int _nsamples; - unsigned int _presample; - unsigned int _firstsample; - unsigned int _lastsample; - unsigned int _samplemin; - unsigned int _samplemax; - unsigned int _nsamplesPN; - unsigned int _presamplePN; - unsigned int _firstsamplePN; - unsigned int _lastsamplePN; - unsigned int _niter; - double _chi2max; - double _timeofmax; - std::string _ecalPart; - int _fedid; - - std::string resdir_; - std::string digiCollection_; - std::string digiPNCollection_; - std::string digiProducer_; - std::string eventHeaderCollection_; - std::string eventHeaderProducer_; + const unsigned int _nsamples; + const unsigned int _presample; + const unsigned int _firstsample; + const unsigned int _lastsample; + const unsigned int _samplemin; + const unsigned int _samplemax; + const unsigned int _nsamplesPN; + const unsigned int _presamplePN; + const unsigned int _firstsamplePN; + const unsigned int _lastsamplePN; + const unsigned int _niter; + const double _chi2max; + const double _timeofmax; + const std::string _ecalPart; + const int _fedid; + + const std::string resdir_; // Output file names @@ -78,7 +94,6 @@ class EcalTestPulseAnalyzer : public edm::EDAnalyzer { // Default values correspond to "EB" geometry (1700 crystals) unsigned int nCrys; - unsigned int nTT; unsigned int nMod; unsigned int nGainPN; unsigned int nGainAPD; @@ -148,3 +163,4 @@ class EcalTestPulseAnalyzer : public edm::EDAnalyzer { unsigned int firstChanMod[NMODEB]; unsigned int isFirstChanModFilled[NMODEB]; }; +#endif diff --git a/CalibCalorimetry/EcalPedestalOffsets/interface/EcalPedOffset.h b/CalibCalorimetry/EcalPedestalOffsets/interface/EcalPedOffset.h index 1d381dfcfcd48..d8800a0bf7756 100644 --- a/CalibCalorimetry/EcalPedestalOffsets/interface/EcalPedOffset.h +++ b/CalibCalorimetry/EcalPedestalOffsets/interface/EcalPedOffset.h @@ -1,5 +1,5 @@ -#ifndef EcalPedOffset_H -#define EcalPedOffset_H +#ifndef CalibCalorimetry_EcalPedestalOffsets_EcalPedOffset_H +#define CalibCalorimetry_EcalPedestalOffsets_EcalPedOffset_H /** * \file EcalPedOffset.h @@ -12,20 +12,20 @@ #include #include -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" +#include +#include +#include +#include + #include "CalibCalorimetry/EcalPedestalOffsets/interface/TPedResult.h" #include "CalibCalorimetry/EcalPedestalOffsets/interface/TPedValues.h" -class EBDigiCollection; -class EEDigiCollection; - -class EcalElectronicsMapping; - -class EcalPedOffset : public edm::EDAnalyzer { +class EcalPedOffset : public edm::one::EDAnalyzer { public: //! Constructor EcalPedOffset(const edm::ParameterSet &ps); @@ -39,6 +39,9 @@ class EcalPedOffset : public edm::EDAnalyzer { //! BeginRun void beginRun(edm::Run const &, edm::EventSetup const &eventSetup) override; + //! EndRun + void endRun(edm::Run const &, edm::EventSetup const &) override; + //! EndJob void endJob(void) override; @@ -58,9 +61,14 @@ class EcalPedOffset : public edm::EDAnalyzer { void readDACs(const edm::Handle &pDigis, const std::map &DACvalues); void readDACs(const edm::Handle &pDigis, const std::map &DACvalues); - edm::InputTag m_barrelDigiCollection; //!< secondary name given to collection of digis - edm::InputTag m_endcapDigiCollection; //!< secondary name given to collection of digis - edm::InputTag m_headerCollection; //!< name of module/plugin/producer making headers + const edm::InputTag m_barrelDigiCollection; //!< secondary name given to collection of digis + const edm::InputTag m_endcapDigiCollection; //!< secondary name given to collection of digis + const edm::InputTag m_headerCollection; //!< name of module/plugin/producer making headers + + const edm::EDGetTokenT m_rawDataToken; + const edm::EDGetTokenT m_ebDigiToken; + const edm::EDGetTokenT m_eeDigiToken; + const edm::ESGetToken m_mappingToken; std::string m_xmlFile; //!< name of the xml file to be saved diff --git a/CalibCalorimetry/EcalPedestalOffsets/src/EcalPedOffset.cc b/CalibCalorimetry/EcalPedestalOffsets/src/EcalPedOffset.cc index 398c70eafa0b2..318024986dcf4 100644 --- a/CalibCalorimetry/EcalPedestalOffsets/src/EcalPedOffset.cc +++ b/CalibCalorimetry/EcalPedestalOffsets/src/EcalPedOffset.cc @@ -22,14 +22,7 @@ #include "OnlineDB/EcalCondDB/interface/RunIOV.h" #include "OnlineDB/EcalCondDB/interface/RunTag.h" -#include "DataFormats/EcalDigi/interface/EcalDigiCollections.h" - #include "DataFormats/EcalRawData/interface/EcalDCCHeaderBlock.h" -#include "DataFormats/EcalRawData/interface/EcalRawDataCollections.h" - -#include "FWCore/Framework/interface/ESHandle.h" -#include "Geometry/EcalMapping/interface/EcalElectronicsMapping.h" -#include "Geometry/EcalMapping/interface/EcalMappingRcd.h" using namespace cms; using namespace edm; @@ -39,6 +32,10 @@ EcalPedOffset::EcalPedOffset(const ParameterSet ¶mSet) : m_barrelDigiCollection(paramSet.getParameter("EBdigiCollection")), m_endcapDigiCollection(paramSet.getParameter("EEdigiCollection")), m_headerCollection(paramSet.getParameter("headerCollection")), + m_rawDataToken(consumes(m_headerCollection)), + m_ebDigiToken(consumes(m_barrelDigiCollection)), + m_eeDigiToken(consumes(m_endcapDigiCollection)), + m_mappingToken(esConsumes()), m_xmlFile(paramSet.getParameter("xmlFile")), m_DACmin(paramSet.getUntrackedParameter("DACmin", 0)), m_DACmax(paramSet.getUntrackedParameter("DACmax", 256)), @@ -77,13 +74,18 @@ EcalPedOffset::~EcalPedOffset() { void EcalPedOffset::beginRun(Run const &, EventSetup const &eventSetup) { LogDebug("EcalPedOffset") << "entering beginRun..."; - edm::ESHandle handle; - eventSetup.get().get(handle); - ecalElectronicsMap_ = handle.product(); + // get the electronics map + const auto mappingHandle = eventSetup.getHandle(m_mappingToken); + ecalElectronicsMap_ = mappingHandle.product(); } // ----------------------------------------------------------------------------- +//! end the run +void EcalPedOffset::endRun(Run const &, EventSetup const &eventSetup) {} + +// ----------------------------------------------------------------------------- + //! perform the analysis void EcalPedOffset::analyze(Event const &event, EventSetup const &eventSetup) { LogDebug("EcalPedOffset") << "entering analyze ..."; @@ -91,7 +93,7 @@ void EcalPedOffset::analyze(Event const &event, EventSetup const &eventSetup) { // get the headers // (one header for each supermodule) edm::Handle DCCHeaders; - event.getByLabel(m_headerCollection, DCCHeaders); + event.getByToken(m_rawDataToken, DCCHeaders); std::map DACvalues; @@ -112,7 +114,7 @@ void EcalPedOffset::analyze(Event const &event, EventSetup const &eventSetup) { // get the barrel digis // (one digi for each crystal) Handle barrelDigis; - event.getByLabel(m_barrelDigiCollection, barrelDigis); + event.getByToken(m_ebDigiToken, barrelDigis); if (!barrelDigis.isValid()) { edm::LogError("EcalPedOffset") << "Error! can't get the product " << m_barrelDigiCollection << "; not reading barrel digis"; @@ -128,7 +130,7 @@ void EcalPedOffset::analyze(Event const &event, EventSetup const &eventSetup) { // get the endcap digis // (one digi for each crystal) Handle endcapDigis; - event.getByLabel(m_endcapDigiCollection, endcapDigis); + event.getByToken(m_eeDigiToken, endcapDigis); if (!endcapDigis.isValid()) { edm::LogError("EcalPedOffset") << "Error! can't get the product " << m_endcapDigiCollection << "; not reading endcap digis"; diff --git a/CalibCalorimetry/EcalSRTools/interface/EcalDccWeightBuilder.h b/CalibCalorimetry/EcalSRTools/interface/EcalDccWeightBuilder.h index d5078129be939..b90a2407fb64b 100644 --- a/CalibCalorimetry/EcalSRTools/interface/EcalDccWeightBuilder.h +++ b/CalibCalorimetry/EcalSRTools/interface/EcalDccWeightBuilder.h @@ -1,15 +1,16 @@ -/* - */ - -#ifndef ECALDCCWEIGHTBUILDER_CC -#define ECALDCCWEIGHTBUILDER_CC +#ifndef CalibCalorimetry_EcalSRTools_EcalDccWeightBuilder_h +#define CalibCalorimetry_EcalSRTools_EcalDccWeightBuilder_h -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "SimCalorimetry/EcalSimAlgos/interface/EBShape.h" #include "SimCalorimetry/EcalSimAlgos/interface/EEShape.h" #include "DataFormats/EcalDetId/interface/EBDetId.h" #include "DataFormats/EcalDetId/interface/EEDetId.h" #include "CondFormats/EcalObjects/interface/EcalIntercalibConstants.h" +#include "CondFormats/DataRecord/interface/EcalIntercalibConstantsRcd.h" +#include "Geometry/EcalMapping/interface/EcalElectronicsMapping.h" +#include "Geometry/EcalMapping/interface/EcalMappingRcd.h" +#include "Geometry/Records/interface/CaloGeometryRecord.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/Framework/interface/ESHandle.h" #include "Geometry/CaloGeometry/interface/CaloGeometry.h" @@ -23,7 +24,7 @@ class EcalElectronicsMapping; /** */ -class EcalDccWeightBuilder : public edm::EDAnalyzer { +class EcalDccWeightBuilder : public edm::one::EDAnalyzer<> { private: enum mode_t { WEIGHTS_FROM_CONFIG, COMPUTE_WEIGHTS }; @@ -122,12 +123,19 @@ class EcalDccWeightBuilder : public edm::EDAnalyzer { int dbVersion_; bool sqlMode_; + const edm::ESGetToken geometryToken_; + const edm::ESGetToken mappingToken_; + const edm::ESGetToken intercalibConstToken_; + edm::ESHandle geom_; EcalIntercalibConstantMap& calibMap_; EcalIntercalibConstantMap emptyCalibMap_; std::map > encodedWeights_; + EBShape ebShape_; + EEShape eeShape_; + static const double weightScale_; const EcalElectronicsMapping* ecalElectronicsMap_; @@ -136,4 +144,4 @@ class EcalDccWeightBuilder : public edm::EDAnalyzer { static const int nDccs = ecalDccFedIdMax - ecalDccFedIdMin + 1; }; -#endif //ECALDCCWEIGHTBUILDER_CC not defined +#endif //CalibCalorimetry_EcalSRTools_EcalDccWeightBuilder_h not defined diff --git a/CalibCalorimetry/EcalSRTools/src/EcalDccWeightBuilder.cc b/CalibCalorimetry/EcalSRTools/src/EcalDccWeightBuilder.cc index c27a662b64eb2..5c353e98836a3 100644 --- a/CalibCalorimetry/EcalSRTools/src/EcalDccWeightBuilder.cc +++ b/CalibCalorimetry/EcalSRTools/src/EcalDccWeightBuilder.cc @@ -16,16 +16,10 @@ #include #include -#include "CondFormats/EcalObjects/interface/EcalIntercalibConstants.h" -#include "CondFormats/DataRecord/interface/EcalIntercalibConstantsRcd.h" +#include #include "SimCalorimetry/EcalSimAlgos/interface/EcalSimParameterMap.h" -#include "Geometry/Records/interface/CaloGeometryRecord.h" -#include "Geometry/EcalMapping/interface/EcalElectronicsMapping.h" -#include "Geometry/EcalMapping/interface/EcalMappingRcd.h" #include "DataFormats/EcalDetId/interface/EcalSubdetector.h" -#include "DataFormats/EcalDetId/interface/EBDetId.h" -#include "DataFormats/EcalDetId/interface/EEDetId.h" #ifdef DB_WRITE_SUPPORT #include "OnlineDB/EcalCondDB/interface/EcalCondDBInterface.h" @@ -59,7 +53,12 @@ EcalDccWeightBuilder::EcalDccWeightBuilder(edm::ParameterSet const& ps) dbTag_(ps.getParameter("dbTag")), dbVersion_(ps.getParameter("dbVersion")), sqlMode_(ps.getParameter("sqlMode")), - calibMap_(emptyCalibMap_) { + geometryToken_(esConsumes()), + mappingToken_(esConsumes()), + intercalibConstToken_(esConsumes()), + calibMap_(emptyCalibMap_), + ebShape_(consumesCollector()), + eeShape_(consumesCollector()) { if (mode_ == "weightsFromConfig") { imode_ = WEIGHTS_FROM_CONFIG; if (inputWeights_.size() != (unsigned)nDccWeights_) { @@ -76,20 +75,17 @@ EcalDccWeightBuilder::EcalDccWeightBuilder(edm::ParameterSet const& ps) } void EcalDccWeightBuilder::analyze(const edm::Event& event, const edm::EventSetup& es) { - edm::ESHandle handle; - es.get().get(handle); - ecalElectronicsMap_ = handle.product(); + const auto mappingHandle = es.getHandle(mappingToken_); + ecalElectronicsMap_ = mappingHandle.product(); // Retrieval of intercalib constants if (dccWeightsWithIntercalib_) { - ESHandle hIntercalib; - es.get().get(hIntercalib); - const EcalIntercalibConstants* intercalib = hIntercalib.product(); - calibMap_ = intercalib->getMap(); + const auto& intercalibConst = es.getData(intercalibConstToken_); + calibMap_ = intercalibConst.getMap(); } //gets geometry - es.get().get(geom_); + geom_ = es.getHandle(geometryToken_); //computes the weights: computeAllWeights(dccWeightsWithIntercalib_, es); @@ -109,15 +105,8 @@ void EcalDccWeightBuilder::computeAllWeights(bool withIntercalib, const edm::Eve EcalSimParameterMap parameterMap; const vector& ebDetIds = geom_->getValidDetIds(DetId::Ecal, EcalBarrel); - - // cout << __FILE__ << ":" << __LINE__ << ": " - // << "Number of EB det IDs: " << ebDetIds.size() << "\n"; - const vector& eeDetIds = geom_->getValidDetIds(DetId::Ecal, EcalEndcap); - // cout << __FILE__ << ":" << __LINE__ << ": " - // << "Number of EE det IDs: " << eeDetIds.size() << "\n"; - vector detIds(ebDetIds.size() + eeDetIds.size()); copy(ebDetIds.begin(), ebDetIds.end(), detIds.begin()); copy(eeDetIds.begin(), eeDetIds.end(), detIds.begin() + ebDetIds.size()); @@ -138,12 +127,12 @@ void EcalDccWeightBuilder::computeAllWeights(bool withIntercalib, const edm::Eve #if 0 //for debugging... - cout << __FILE__ << ":" << __LINE__ << ": "; + edm::LogVerbatim("EcalDccWeightBuilder") << __FILE__ << ":" << __LINE__ << ": "; if(it->subdetId()==EcalBarrel){ - cout << "ieta = " << setw(4) << ((EBDetId)(*it)).ieta() + edm::LogVerbatim("EcalDccWeightBuilder") << "ieta = " << setw(4) << ((EBDetId)(*it)).ieta() << " iphi = " << setw(4) << ((EBDetId)(*it)).iphi() << " "; } else if(it->subdetId()==EcalEndcap){ - cout << "ix = " << setw(3) << ((EEDetId)(*it)).ix() + edm::LogVerbatim("EcalDccWeightBuilder") << "ix = " << setw(3) << ((EEDetId)(*it)).ix() << " iy = " << setw(3) << ((EEDetId)(*it)).iy() << " iz = " << setw(1) << ((EEDetId)(*it)).iy() << " "; } else{ @@ -152,20 +141,17 @@ void EcalDccWeightBuilder::computeAllWeights(bool withIntercalib, const edm::Eve << "Got a detId which is neither tagged as ECAL Barrel " << "not ECAL endcap while looping on ECAL cell detIds\n"; } - cout << " -> phase: " << phase << "\n"; - cout << " -> binOfMax: " << binOfMax << "\n"; + edm::LogVerbatim("EcalDccWeightBuilder") << " -> phase: " << phase << "\n"; + edm::LogVerbatim("EcalDccWeightBuilder") << " -> binOfMax: " << binOfMax << "\n"; #endif try { - bool useDBShape = true; - EBShape ebShape(useDBShape); - EEShape eeShape(useDBShape); EcalShapeBase* pShape; if (it->subdetId() == EcalBarrel) { - pShape = &ebShape; + pShape = &ebShape_; } else if (it->subdetId() == EcalEndcap) { - pShape = &eeShape; + pShape = &eeShape_; } else { throw cms::Exception("EcalDccWeightBuilder") << "Bug found in " << __FILE__ << ":" << __LINE__ << ": " << "Got a detId which is neither tagged as ECAL Barrel " @@ -188,17 +174,18 @@ void EcalDccWeightBuilder::computeAllWeights(bool withIntercalib, const edm::Eve unbiasWeights(w, &W); encodedWeights_[*it] = W; } catch (std::exception& e) { - cout << __FILE__ << ":" << __LINE__ << ": "; + edm::LogVerbatim("EcalDccWeightBuilder") << __FILE__ << ":" << __LINE__ << ": "; if (it->subdetId() == EcalBarrel) { - cout << "ieta = " << setw(4) << ((EBDetId)(*it)).ieta() << " iphi = " << setw(4) << ((EBDetId)(*it)).iphi() - << " "; + edm::LogVerbatim("EcalDccWeightBuilder") << "ieta = " << setw(4) << ((EBDetId)(*it)).ieta() + << " iphi = " << setw(4) << ((EBDetId)(*it)).iphi() << " "; } else if (it->subdetId() == EcalEndcap) { - cout << "ix = " << setw(3) << ((EEDetId)(*it)).ix() << " iy = " << setw(3) << ((EEDetId)(*it)).iy() - << " iz = " << setw(1) << ((EEDetId)(*it)).iy() << " "; + edm::LogVerbatim("EcalDccWeightBuilder") + << "ix = " << setw(3) << ((EEDetId)(*it)).ix() << " iy = " << setw(3) << ((EEDetId)(*it)).iy() + << " iz = " << setw(1) << ((EEDetId)(*it)).iy() << " "; } else { - cout << "DetId " << (uint32_t)(*it); + edm::LogVerbatim("EcalDccWeightBuilder") << "DetId " << (uint32_t)(*it); } - cout << "phase: " << phase << "\n"; + edm::LogVerbatim("EcalDccWeightBuilder") << "phase: " << phase << "\n"; throw; } } @@ -245,13 +232,6 @@ double EcalDccWeightBuilder::decodeWeight(int W) { return ((double)W) / weightSc template void EcalDccWeightBuilder::sort(const std::vector& a, std::vector& s, bool decreasingOrder) { - // cout << __FILE__ << ":" << __LINE__ << ": " - // << "sort input array:" ; - // for(unsigned i=0; i& a, std::vector& s, bo } } } while (changed); - - // cout << __FILE__ << ":" << __LINE__ << ": " - // << "sorted list of indices:" ; - // for(unsigned i=0; i < s.size(); ++i){ - // cout << "\t" << s[i]; - // } - // cout << "\n"; } void EcalDccWeightBuilder::unbiasWeights(std::vector& weights, std::vector* encodedWeights) { @@ -293,14 +266,6 @@ void EcalDccWeightBuilder::unbiasWeights(std::vector& weights, std::vect wsum += W[i]; } - // cout << __FILE__ << ":" << __LINE__ << ": " - // << "weights before bias correction: "; - // for(unsigned i=0; i iw(nw); sort(dw, iw, true); @@ -330,14 +295,6 @@ void EcalDccWeightBuilder::unbiasWeights(std::vector& weights, std::vect i = 0; } - // cout << __FILE__ << ":" << __LINE__ << ": " - // << "weights after bias correction: "; - // for(unsigned i=0; iresize(nw); @@ -356,19 +313,19 @@ double EcalDccWeightBuilder::intercalib(const DetId& detId) { coef = (*itCalib); } else { coef = 1.; - std::cout << (uint32_t)detId << " not found in EcalIntercalibConstantMap" << std::endl; + edm::LogVerbatim("EcalDccWeightBuilder") << (uint32_t)detId << " not found in EcalIntercalibConstantMap"; } #if 0 - cout << __FILE__ << ":" << __LINE__ << ": "; + edm::LogVerbatim("EcalDccWeightBuilder") << __FILE__ << ":" << __LINE__ << ": "; if(detId.subdetId()==EcalBarrel){ - cout << "ieta = " << ((EBDetId)detId).ieta() + edm::LogVerbatim("EcalDccWeightBuilder") << "ieta = " << ((EBDetId)detId).ieta() << " iphi = " << ((EBDetId)detId).iphi(); } else{ - cout << "ix = " << ((EEDetId)detId).ix() + edm::LogVerbatim("EcalDccWeightBuilder") << "ix = " << ((EEDetId)detId).ix() << " iy = " << ((EEDetId)detId).iy() << " iz = " << ((EEDetId)detId).zside(); } - cout << " coef = " << coef << "\n"; + edm::LogVerbatim("EcalDccWeightBuilder") << " coef = " << coef << "\n"; #endif return coef; } @@ -511,12 +468,12 @@ void EcalDccWeightBuilder::writeWeightToDB() { } #else //DB_WRITE_SUPPORT defined void EcalDccWeightBuilder::writeWeightToDB() { - cout << "going to write to the online DB " << dbSid_ << " user " << dbUser_ << endl; + edm::LogVerbatim("EcalDccWeightBuilder") << "going to write to the online DB " << dbSid_ << " user " << dbUser_; ; EcalCondDBInterface* econn; try { - cout << "Making connection..." << flush; + edm::LogVerbatim("EcalDccWeightBuilder") << "Making connection..." << flush; const string& filePrefix = string("file:"); if (dbPassword_.find(filePrefix) == 0) { //password must be read for a file string fileName = dbPassword_.substr(filePrefix.size()); @@ -525,25 +482,22 @@ void EcalDccWeightBuilder::writeWeightToDB() { pr.readPassword(fileName, dbUser_, dbPassword_); } - // cout << __FILE__ << ":" << __LINE__ << ": " - // << "Password: " << dbPassword_ << "\n"; - econn = new EcalCondDBInterface(dbSid_, dbUser_, dbPassword_); - cout << "Done." << endl; + edm::LogVerbatim("EcalDccWeightBuilder") << "Done."; } catch (runtime_error& e) { - cerr << e.what() << endl; + edm::LogError("dbconnection") << e.what(); exit(-1); } ODFEWeightsInfo weight_info; weight_info.setConfigTag(dbTag_); weight_info.setVersion(dbVersion_); - cout << "Inserting in DB..." << endl; + edm::LogVerbatim("EcalDccWeightBuilder") << "Inserting in DB..."; econn->insertConfigSet(&weight_info); int weight_id = weight_info.getId(); - cout << "WeightInfo inserted with ID " << weight_id << endl; + edm::LogVerbatim("EcalDccWeightBuilder") << "WeightInfo inserted with ID " << weight_id; vector datadel; datadel.reserve(encodedWeights_.size()); @@ -596,9 +550,9 @@ void EcalDccWeightBuilder::writeWeightToDB() { datadel.push_back(one_dat); } econn->insertConfigDataArraySet(datadel, &weight_info); - std::cout << " .. done insertion in DB " << endl; + edm::LogVerbatim("EcalDccWeightBuilder") << " .. done insertion in DB "; delete econn; - cout << "closed DB connection ... done" << endl; + edm::LogVerbatim("EcalDccWeightBuilder") << "closed DB connection ... done"; } #endif //DB_WRITE_SUPPORT not defined @@ -618,22 +572,22 @@ void EcalDccWeightBuilder::dbId(const DetId& detId, int& fedId, int& smId, int& xtalId = (elecId.stripId() - 1) * stripLength + elecId.xtalId(); #if 0 - cout << __FILE__ << ":" << __LINE__ << ": FED ID " + edm::LogVerbatim("EcalDccWeightBuilder") << __FILE__ << ":" << __LINE__ << ": FED ID " << fedId << "\n"; - cout << __FILE__ << ":" << __LINE__ << ": SM logical ID " + edm::LogVerbatim("EcalDccWeightBuilder") << __FILE__ << ":" << __LINE__ << ": SM logical ID " << smId << "\n"; - cout << __FILE__ << ":" << __LINE__ << ": RU ID (TT or SC): " + edm::LogVerbatim("EcalDccWeightBuilder") << __FILE__ << ":" << __LINE__ << ": RU ID (TT or SC): " << ruId << "\n"; - cout << __FILE__ << ":" << __LINE__ << ": strip:" + edm::LogVerbatim("EcalDccWeightBuilder") << __FILE__ << ":" << __LINE__ << ": strip:" << elecId.stripId() << "\n"; - cout << __FILE__ << ":" << __LINE__ << ": xtal in strip: " + edm::LogVerbatim("EcalDccWeightBuilder") << __FILE__ << ":" << __LINE__ << ": xtal in strip: " << elecId.xtalId() << "\n"; - cout << __FILE__ << ":" << __LINE__ << ": xtalId in RU: " + edm::LogVerbatim("EcalDccWeightBuilder") << __FILE__ << ":" << __LINE__ << ": xtalId in RU: " << xtalId << "\n"; #endif } diff --git a/CalibCalorimetry/EcalSRTools/test/produceDccWeights.py b/CalibCalorimetry/EcalSRTools/test/produceDccWeights.py index 69d57d9e5786b..28fef346901d7 100644 --- a/CalibCalorimetry/EcalSRTools/test/produceDccWeights.py +++ b/CalibCalorimetry/EcalSRTools/test/produceDccWeights.py @@ -15,14 +15,18 @@ firstValid = cms.vuint32(1) ) +process.load("Geometry.HcalCommonData.hcalDDDSimConstants_cff") +process.load("Geometry.HcalCommonData.hcalDDDRecConstants_cfi") + # Conditions: # # a) Getting hardcoded conditions the same used for standard digitization: #process.load("CalibCalorimetry.EcalTrivialCondModules.EcalTrivialCondRetriever_cfi") #process.EcalTrivialConditionRetriever.producedEcalIntercalibConstants = True # b) Getting conditions through frontier interface: -process.load('Configuration/StandardSequences/FrontierConditions_GlobalTag_cff') -process.GlobalTag.globaltag = "CRAFT09_R_V4::All" +process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff') +from Configuration.AlCa.GlobalTag import GlobalTag +process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:run2_data', '') # c) Getting conditions through oracle interface: #process.load("RecoLocalCalo.EcalRecProducers.getEcalConditions_orcoffint2r_cff") diff --git a/CalibCalorimetry/EcalTPGTools/plugins/EcalTPGDBCopy.cc b/CalibCalorimetry/EcalTPGTools/plugins/EcalTPGDBCopy.cc index 836148ae531dc..7a9acc35ed156 100644 --- a/CalibCalorimetry/EcalTPGTools/plugins/EcalTPGDBCopy.cc +++ b/CalibCalorimetry/EcalTPGTools/plugins/EcalTPGDBCopy.cc @@ -1,57 +1,18 @@ #include "FWCore/ServiceRegistry/interface/Service.h" #include "CondCore/DBOutputService/interface/PoolDBOutputService.h" +#include #include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/EventSetup.h" -#include "CondFormats/EcalObjects/interface/EcalTPGPedestals.h" -#include "CondFormats/EcalObjects/interface/EcalTPGLinearizationConst.h" -#include "CondFormats/EcalObjects/interface/EcalTPGSlidingWindow.h" -#include "CondFormats/EcalObjects/interface/EcalTPGFineGrainEBIdMap.h" -#include "CondFormats/EcalObjects/interface/EcalTPGFineGrainStripEE.h" -#include "CondFormats/EcalObjects/interface/EcalTPGFineGrainTowerEE.h" -#include "CondFormats/EcalObjects/interface/EcalTPGLutIdMap.h" -#include "CondFormats/EcalObjects/interface/EcalTPGWeightIdMap.h" -#include "CondFormats/EcalObjects/interface/EcalTPGWeightGroup.h" -#include "CondFormats/EcalObjects/interface/EcalTPGOddWeightIdMap.h" -#include "CondFormats/EcalObjects/interface/EcalTPGOddWeightGroup.h" -#include "CondFormats/EcalObjects/interface/EcalTPGTPMode.h" -#include "CondFormats/EcalObjects/interface/EcalTPGLutGroup.h" -#include "CondFormats/EcalObjects/interface/EcalTPGFineGrainEBGroup.h" -#include "CondFormats/EcalObjects/interface/EcalTPGPhysicsConst.h" -#include "CondFormats/EcalObjects/interface/EcalTPGCrystalStatus.h" -#include "CondFormats/EcalObjects/interface/EcalTPGSpike.h" -#include "CondFormats/EcalObjects/interface/EcalTPGTowerStatus.h" -#include "CondFormats/EcalObjects/interface/EcalTPGStripStatus.h" - -#include "CondFormats/DataRecord/interface/EcalTPGPedestalsRcd.h" -#include "CondFormats/DataRecord/interface/EcalTPGLinearizationConstRcd.h" -#include "CondFormats/DataRecord/interface/EcalTPGSlidingWindowRcd.h" -#include "CondFormats/DataRecord/interface/EcalTPGFineGrainEBIdMapRcd.h" -#include "CondFormats/DataRecord/interface/EcalTPGFineGrainStripEERcd.h" -#include "CondFormats/DataRecord/interface/EcalTPGFineGrainTowerEERcd.h" -#include "CondFormats/DataRecord/interface/EcalTPGLutIdMapRcd.h" -#include "CondFormats/DataRecord/interface/EcalTPGWeightIdMapRcd.h" -#include "CondFormats/DataRecord/interface/EcalTPGWeightGroupRcd.h" -#include "CondFormats/DataRecord/interface/EcalTPGOddWeightIdMapRcd.h" -#include "CondFormats/DataRecord/interface/EcalTPGOddWeightGroupRcd.h" -#include "CondFormats/DataRecord/interface/EcalTPGTPModeRcd.h" -#include "CondFormats/DataRecord/interface/EcalTPGLutGroupRcd.h" -#include "CondFormats/DataRecord/interface/EcalTPGFineGrainEBGroupRcd.h" -#include "CondFormats/DataRecord/interface/EcalTPGPhysicsConstRcd.h" -#include "CondFormats/DataRecord/interface/EcalTPGCrystalStatusRcd.h" -#include "CondFormats/DataRecord/interface/EcalTPGTowerStatusRcd.h" -#include "CondFormats/DataRecord/interface/EcalTPGSpikeRcd.h" -#include "CondFormats/DataRecord/interface/EcalTPGStripStatusRcd.h" - #include "EcalTPGDBCopy.h" #include EcalTPGDBCopy::EcalTPGDBCopy(const edm::ParameterSet& iConfig) : m_timetype(iConfig.getParameter("timetype")), m_cacheIDs(), m_records() { + auto cc = consumesCollector(); std::string container; std::string tag; std::string record; @@ -62,6 +23,7 @@ EcalTPGDBCopy::EcalTPGDBCopy(const edm::ParameterSet& iConfig) record = i->getParameter("record"); m_cacheIDs.insert(std::make_pair(container, 0)); m_records.insert(std::make_pair(container, record)); + setConsumes(cc, container); } } @@ -80,7 +42,51 @@ void EcalTPGDBCopy::analyze(const edm::Event& evt, const edm::EventSetup& evtSet } } -bool EcalTPGDBCopy::shouldCopy(const edm::EventSetup& evtSetup, std::string container) { +void EcalTPGDBCopy::setConsumes(edm::ConsumesCollector& cc, const std::string& container) { + if (container == "EcalTPGPedestals") { + pedestalsToken_ = cc.esConsumes(); + } else if (container == "EcalTPGLinearizationConst") { + linearizationConstToken_ = cc.esConsumes(); + } else if (container == "EcalTPGSlidingWindow") { + slidingWindowToken_ = cc.esConsumes(); + } else if (container == "EcalTPGFineGrainEBIdMap") { + fineGrainEBIdMapToken_ = cc.esConsumes(); + } else if (container == "EcalTPGFineGrainStripEE") { + fineGrainStripEEToken_ = cc.esConsumes(); + } else if (container == "EcalTPGFineGrainTowerEE") { + fineGrainTowerEEToken_ = cc.esConsumes(); + } else if (container == "EcalTPGLutIdMap") { + lutIdMapToken_ = cc.esConsumes(); + } else if (container == "EcalTPGWeightIdMap") { + weightIdMapToken_ = cc.esConsumes(); + } else if (container == "EcalTPGWeightGroup") { + weightGroupToken_ = cc.esConsumes(); + } else if (container == "EcalTPGOddWeightIdMap") { + oddWeightIdMapToken_ = cc.esConsumes(); + } else if (container == "EcalTPGOddWeightGroup") { + oddWeightGroupToken_ = cc.esConsumes(); + } else if (container == "EcalTPGTPMode") { + tpModeToken_ = cc.esConsumes(); + } else if (container == "EcalTPGLutGroup") { + lutGroupToken_ = cc.esConsumes(); + } else if (container == "EcalTPGFineGrainEBGroup") { + fineGrainEBGroupToken_ = cc.esConsumes(); + } else if (container == "EcalTPGPhysicsConst") { + physicsConstToken_ = cc.esConsumes(); + } else if (container == "EcalTPGCrystalStatus") { + crystalStatusToken_ = cc.esConsumes(); + } else if (container == "EcalTPGTowerStatus") { + towerStatusToken_ = cc.esConsumes(); + } else if (container == "EcalTPGSpike") { + spikeToken_ = cc.esConsumes(); + } else if (container == "EcalTPGStripStatus") { + stripStatusToken_ = cc.esConsumes(); + } else { + throw cms::Exception("Unknown container"); + } +} + +bool EcalTPGDBCopy::shouldCopy(const edm::EventSetup& evtSetup, const std::string& container) { unsigned long long cacheID = 0; if (container == "EcalTPGPedestals") { @@ -133,7 +139,7 @@ bool EcalTPGDBCopy::shouldCopy(const edm::EventSetup& evtSetup, std::string cont } } -void EcalTPGDBCopy::copyToDB(const edm::EventSetup& evtSetup, std::string container) { +void EcalTPGDBCopy::copyToDB(const edm::EventSetup& evtSetup, const std::string& container) { edm::Service dbOutput; if (!dbOutput.isAvailable()) { throw cms::Exception("PoolDBOutputService is not available"); @@ -142,148 +148,123 @@ void EcalTPGDBCopy::copyToDB(const edm::EventSetup& evtSetup, std::string contai std::string recordName = m_records[container]; if (container == "EcalTPGPedestals") { - edm::ESHandle handle; - evtSetup.get().get(handle); + const auto handle = evtSetup.getHandle(pedestalsToken_); const EcalTPGPedestals* obj = handle.product(); dbOutput->createNewIOV( new EcalTPGPedestals(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); } else if (container == "EcalTPGLinearizationConst") { - edm::ESHandle handle; - evtSetup.get().get(handle); + const auto handle = evtSetup.getHandle(linearizationConstToken_); const EcalTPGLinearizationConst* obj = handle.product(); - dbOutput->createNewIOV( new EcalTPGLinearizationConst(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); } else if (container == "EcalTPGSlidingWindow") { - edm::ESHandle handle; - evtSetup.get().get(handle); + const auto handle = evtSetup.getHandle(slidingWindowToken_); const EcalTPGSlidingWindow* obj = handle.product(); - dbOutput->createNewIOV( new EcalTPGSlidingWindow(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); } else if (container == "EcalTPGFineGrainEBIdMap") { - edm::ESHandle handle; - evtSetup.get().get(handle); + const auto handle = evtSetup.getHandle(fineGrainEBIdMapToken_); const EcalTPGFineGrainEBIdMap* obj = handle.product(); dbOutput->createNewIOV( new EcalTPGFineGrainEBIdMap(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); } else if (container == "EcalTPGFineGrainStripEE") { - edm::ESHandle handle; - evtSetup.get().get(handle); + const auto handle = evtSetup.getHandle(fineGrainStripEEToken_); const EcalTPGFineGrainStripEE* obj = handle.product(); dbOutput->createNewIOV( new EcalTPGFineGrainStripEE(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); } else if (container == "EcalTPGFineGrainTowerEE") { - edm::ESHandle handle; - evtSetup.get().get(handle); + const auto handle = evtSetup.getHandle(fineGrainTowerEEToken_); const EcalTPGFineGrainTowerEE* obj = handle.product(); dbOutput->createNewIOV( new EcalTPGFineGrainTowerEE(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); } else if (container == "EcalTPGLutIdMap") { - edm::ESHandle handle; - evtSetup.get().get(handle); + const auto handle = evtSetup.getHandle(lutIdMapToken_); const EcalTPGLutIdMap* obj = handle.product(); dbOutput->createNewIOV( new EcalTPGLutIdMap(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); } else if (container == "EcalTPGWeightIdMap") { - edm::ESHandle handle; - evtSetup.get().get(handle); + const auto handle = evtSetup.getHandle(weightIdMapToken_); const EcalTPGWeightIdMap* obj = handle.product(); dbOutput->createNewIOV( new EcalTPGWeightIdMap(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); } else if (container == "EcalTPGWeightGroup") { - edm::ESHandle handle; - evtSetup.get().get(handle); + const auto handle = evtSetup.getHandle(weightGroupToken_); const EcalTPGWeightGroup* obj = handle.product(); dbOutput->createNewIOV( new EcalTPGWeightGroup(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); } else if (container == "EcalTPGOddWeightIdMap") { - edm::ESHandle handle; - evtSetup.get().get(handle); + const auto handle = evtSetup.getHandle(oddWeightIdMapToken_); const EcalTPGOddWeightIdMap* obj = handle.product(); dbOutput->createNewIOV( new EcalTPGOddWeightIdMap(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); } else if (container == "EcalTPGOddWeightGroup") { - edm::ESHandle handle; - evtSetup.get().get(handle); + const auto handle = evtSetup.getHandle(oddWeightGroupToken_); const EcalTPGOddWeightGroup* obj = handle.product(); dbOutput->createNewIOV( new EcalTPGOddWeightGroup(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); } else if (container == "EcalTPGTPMode") { - edm::ESHandle handle; - evtSetup.get().get(handle); + const auto handle = evtSetup.getHandle(tpModeToken_); const EcalTPGTPMode* obj = handle.product(); dbOutput->createNewIOV( new EcalTPGTPMode(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); } else if (container == "EcalTPGLutGroup") { - edm::ESHandle handle; - evtSetup.get().get(handle); + const auto handle = evtSetup.getHandle(lutGroupToken_); const EcalTPGLutGroup* obj = handle.product(); dbOutput->createNewIOV( new EcalTPGLutGroup(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); } else if (container == "EcalTPGFineGrainEBGroup") { - edm::ESHandle handle; - evtSetup.get().get(handle); - + const auto handle = evtSetup.getHandle(fineGrainEBGroupToken_); const EcalTPGFineGrainEBGroup* obj = handle.product(); - dbOutput->createNewIOV( new EcalTPGFineGrainEBGroup(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); } else if (container == "EcalTPGPhysicsConst") { - edm::ESHandle handle; - evtSetup.get().get(handle); + const auto handle = evtSetup.getHandle(physicsConstToken_); const EcalTPGPhysicsConst* obj = handle.product(); dbOutput->createNewIOV( new EcalTPGPhysicsConst(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); } else if (container == "EcalTPGCrystalStatus") { - edm::ESHandle handle; - evtSetup.get().get(handle); + const auto handle = evtSetup.getHandle(crystalStatusToken_); const EcalTPGCrystalStatus* obj = handle.product(); dbOutput->createNewIOV( new EcalTPGCrystalStatus(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); } else if (container == "EcalTPGTowerStatus") { - edm::ESHandle handle; - evtSetup.get().get(handle); + const auto handle = evtSetup.getHandle(towerStatusToken_); const EcalTPGTowerStatus* obj = handle.product(); dbOutput->createNewIOV( new EcalTPGTowerStatus(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); } else if (container == "EcalTPGSpike") { - edm::ESHandle handle; - evtSetup.get().get(handle); + const auto handle = evtSetup.getHandle(spikeToken_); const EcalTPGSpike* obj = handle.product(); dbOutput->createNewIOV( new EcalTPGSpike(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); } else if (container == "EcalTPGStripStatus") { - edm::ESHandle handle; - evtSetup.get().get(handle); + const auto handle = evtSetup.getHandle(stripStatusToken_); const EcalTPGStripStatus* obj = handle.product(); dbOutput->createNewIOV( new EcalTPGStripStatus(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); - } - - else { + } else { throw cms::Exception("Unknown container"); } - std::cout << "EcalTPGDBCopy wrote " << recordName << std::endl; + edm::LogInfo("EcalTPGDBCopy") << "EcalTPGDBCopy wrote " << recordName; } diff --git a/CalibCalorimetry/EcalTPGTools/plugins/EcalTPGDBCopy.h b/CalibCalorimetry/EcalTPGTools/plugins/EcalTPGDBCopy.h index 469cfd7266bc5..faa5bde5f72d5 100644 --- a/CalibCalorimetry/EcalTPGTools/plugins/EcalTPGDBCopy.h +++ b/CalibCalorimetry/EcalTPGTools/plugins/EcalTPGDBCopy.h @@ -1,11 +1,52 @@ -#ifndef ECALTPGDBCOPY_H -#define ECALTPGDBCOPY_H +#ifndef CalibCalorimetry_EcalTPGTools_EcalTPGDBCopy_h +#define CalibCalorimetry_EcalTPGTools_EcalTPGDBCopy_h -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "CondCore/CondDB/interface/Exception.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" #include "FWCore/Framework/interface/IOVSyncValue.h" +#include "CondFormats/EcalObjects/interface/EcalTPGPedestals.h" +#include "CondFormats/EcalObjects/interface/EcalTPGLinearizationConst.h" +#include "CondFormats/EcalObjects/interface/EcalTPGSlidingWindow.h" +#include "CondFormats/EcalObjects/interface/EcalTPGFineGrainEBIdMap.h" +#include "CondFormats/EcalObjects/interface/EcalTPGFineGrainStripEE.h" +#include "CondFormats/EcalObjects/interface/EcalTPGFineGrainTowerEE.h" +#include "CondFormats/EcalObjects/interface/EcalTPGLutIdMap.h" +#include "CondFormats/EcalObjects/interface/EcalTPGWeightIdMap.h" +#include "CondFormats/EcalObjects/interface/EcalTPGWeightGroup.h" +#include "CondFormats/EcalObjects/interface/EcalTPGOddWeightIdMap.h" +#include "CondFormats/EcalObjects/interface/EcalTPGOddWeightGroup.h" +#include "CondFormats/EcalObjects/interface/EcalTPGTPMode.h" +#include "CondFormats/EcalObjects/interface/EcalTPGLutGroup.h" +#include "CondFormats/EcalObjects/interface/EcalTPGFineGrainEBGroup.h" +#include "CondFormats/EcalObjects/interface/EcalTPGPhysicsConst.h" +#include "CondFormats/EcalObjects/interface/EcalTPGCrystalStatus.h" +#include "CondFormats/EcalObjects/interface/EcalTPGSpike.h" +#include "CondFormats/EcalObjects/interface/EcalTPGTowerStatus.h" +#include "CondFormats/EcalObjects/interface/EcalTPGStripStatus.h" + +#include "CondFormats/DataRecord/interface/EcalTPGPedestalsRcd.h" +#include "CondFormats/DataRecord/interface/EcalTPGLinearizationConstRcd.h" +#include "CondFormats/DataRecord/interface/EcalTPGSlidingWindowRcd.h" +#include "CondFormats/DataRecord/interface/EcalTPGFineGrainEBIdMapRcd.h" +#include "CondFormats/DataRecord/interface/EcalTPGFineGrainStripEERcd.h" +#include "CondFormats/DataRecord/interface/EcalTPGFineGrainTowerEERcd.h" +#include "CondFormats/DataRecord/interface/EcalTPGLutIdMapRcd.h" +#include "CondFormats/DataRecord/interface/EcalTPGWeightIdMapRcd.h" +#include "CondFormats/DataRecord/interface/EcalTPGWeightGroupRcd.h" +#include "CondFormats/DataRecord/interface/EcalTPGOddWeightIdMapRcd.h" +#include "CondFormats/DataRecord/interface/EcalTPGOddWeightGroupRcd.h" +#include "CondFormats/DataRecord/interface/EcalTPGTPModeRcd.h" +#include "CondFormats/DataRecord/interface/EcalTPGLutGroupRcd.h" +#include "CondFormats/DataRecord/interface/EcalTPGFineGrainEBGroupRcd.h" +#include "CondFormats/DataRecord/interface/EcalTPGPhysicsConstRcd.h" +#include "CondFormats/DataRecord/interface/EcalTPGCrystalStatusRcd.h" +#include "CondFormats/DataRecord/interface/EcalTPGTowerStatusRcd.h" +#include "CondFormats/DataRecord/interface/EcalTPGSpikeRcd.h" +#include "CondFormats/DataRecord/interface/EcalTPGStripStatusRcd.h" + #include #include @@ -15,7 +56,7 @@ namespace edm { class EventSetup; } // namespace edm -class EcalTPGDBCopy : public edm::EDAnalyzer { +class EcalTPGDBCopy : public edm::one::EDAnalyzer<> { public: explicit EcalTPGDBCopy(const edm::ParameterSet& iConfig); ~EcalTPGDBCopy() override; @@ -23,12 +64,33 @@ class EcalTPGDBCopy : public edm::EDAnalyzer { void analyze(const edm::Event& evt, const edm::EventSetup& evtSetup) override; private: - bool shouldCopy(const edm::EventSetup& evtSetup, std::string container); - void copyToDB(const edm::EventSetup& evtSetup, std::string container); + void setConsumes(edm::ConsumesCollector& cc, const std::string& container); + bool shouldCopy(const edm::EventSetup& evtSetup, const std::string& container); + void copyToDB(const edm::EventSetup& evtSetup, const std::string& container); std::string m_timetype; std::map m_cacheIDs; std::map m_records; + + edm::ESGetToken pedestalsToken_; + edm::ESGetToken linearizationConstToken_; + edm::ESGetToken slidingWindowToken_; + edm::ESGetToken fineGrainEBIdMapToken_; + edm::ESGetToken fineGrainStripEEToken_; + edm::ESGetToken fineGrainTowerEEToken_; + edm::ESGetToken lutIdMapToken_; + edm::ESGetToken weightIdMapToken_; + edm::ESGetToken weightGroupToken_; + edm::ESGetToken oddWeightIdMapToken_; + edm::ESGetToken oddWeightGroupToken_; + edm::ESGetToken tpModeToken_; + edm::ESGetToken lutGroupToken_; + edm::ESGetToken fineGrainEBGroupToken_; + edm::ESGetToken physicsConstToken_; + edm::ESGetToken crystalStatusToken_; + edm::ESGetToken towerStatusToken_; + edm::ESGetToken spikeToken_; + edm::ESGetToken stripStatusToken_; }; #endif diff --git a/CalibCalorimetry/EcalTPGTools/plugins/EcalTPGParamBuilder.cc b/CalibCalorimetry/EcalTPGTools/plugins/EcalTPGParamBuilder.cc index a71e02e4214d1..dc8fba95a36fc 100644 --- a/CalibCalorimetry/EcalTPGTools/plugins/EcalTPGParamBuilder.cc +++ b/CalibCalorimetry/EcalTPGTools/plugins/EcalTPGParamBuilder.cc @@ -14,8 +14,6 @@ #include "CalibCalorimetry/EcalLaserCorrection/interface/EcalLaserDbRecord.h" #include "SimCalorimetry/EcalSimAlgos/interface/EcalSimParameterMap.h" -#include "SimCalorimetry/EcalSimAlgos/interface/EBShape.h" -#include "SimCalorimetry/EcalSimAlgos/interface/EEShape.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include @@ -53,7 +51,8 @@ EcalTPGParamBuilder::EcalTPGParamBuilder(edm::ParameterSet const& pSet) xtal_LSB_EE_(0), nSample_(5), complement2_(7), - useDBShape_(true) { + shapeEB_(consumesCollector()), // EBShape, EEShape are fetched now from DB (2018.05.22 K. Theofilatos) + shapeEE_(consumesCollector()) { ped_conf_id_ = 0; lin_conf_id_ = 0; lut_conf_id_ = 0; @@ -1610,13 +1609,10 @@ void EcalTPGParamBuilder::analyze(const edm::Event& evt, const edm::EventSetup& const int NWEIGROUPS = 2; std::vector weights[NWEIGROUPS]; - bool useDBShape = useDBShape_; - EBShape shapeEB(useDBShape); - shapeEB.setEventSetup(evtSetup); // EBShape, EEShape are fetched now from DB (2018.05.22 K. Theofilatos) - EEShape shapeEE(useDBShape); - shapeEE.setEventSetup(evtSetup); // - weights[0] = computeWeights(shapeEB, hshapeEB); - weights[1] = computeWeights(shapeEE, hshapeEE); + shapeEB_.setEventSetup(evtSetup); + shapeEE_.setEventSetup(evtSetup); + weights[0] = computeWeights(shapeEB_, hshapeEB); + weights[1] = computeWeights(shapeEE_, hshapeEE); map dataset; diff --git a/CalibCalorimetry/EcalTPGTools/plugins/EcalTPGParamBuilder.h b/CalibCalorimetry/EcalTPGTools/plugins/EcalTPGParamBuilder.h index 0484a330031f5..856ed9e91458d 100644 --- a/CalibCalorimetry/EcalTPGTools/plugins/EcalTPGParamBuilder.h +++ b/CalibCalorimetry/EcalTPGTools/plugins/EcalTPGParamBuilder.h @@ -41,6 +41,8 @@ #include "CondFormats/EcalObjects/interface/EcalLaserAlphas.h" #include "SimCalorimetry/EcalSimAlgos/interface/EcalShapeBase.h" +#include "SimCalorimetry/EcalSimAlgos/interface/EBShape.h" +#include "SimCalorimetry/EcalSimAlgos/interface/EEShape.h" #include @@ -162,6 +164,9 @@ class EcalTPGParamBuilder : public edm::one::EDAnalyzer<> { //modif-alex 30/01/2012 std::map Transparency_Correction_; + EBShape shapeEB_; + EEShape shapeEE_; + std::ofstream* out_file_; std::ofstream* geomFile_; EcalTPGDBApp* db_; @@ -198,7 +203,5 @@ class EcalTPGParamBuilder : public edm::one::EDAnalyzer<> { Int_t* ntupleInts_; Char_t ntupleDet_[10]; Char_t ntupleCrate_[10]; - - bool useDBShape_; }; #endif diff --git a/CalibCalorimetry/EcalTrivialCondModules/interface/EcalLaserCondTools.h b/CalibCalorimetry/EcalTrivialCondModules/interface/EcalLaserCondTools.h index 767c91a27d448..9f179bfd709cf 100644 --- a/CalibCalorimetry/EcalTrivialCondModules/interface/EcalLaserCondTools.h +++ b/CalibCalorimetry/EcalTrivialCondModules/interface/EcalLaserCondTools.h @@ -1,16 +1,17 @@ -#ifndef EcaLaserCondTools_h -#define EcaLaserCondTools_h +#ifndef CalibCalorimetry_EcalTrivialCondModules_EcaLaserCondTools_h +#define CalibCalorimetry_EcalTrivialCondModules_EcaLaserCondTools_h /* * $Id: EcalLaserCondTools.h,v 1.2 2010/06/14 10:45:16 pgras Exp $ */ #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/ServiceRegistry/interface/Service.h" #include "CondCore/DBOutputService/interface/PoolDBOutputService.h" #include "CondFormats/EcalObjects/interface/EcalLaserAPDPNRatios.h" +#include "CondFormats/DataRecord/interface/EcalLaserAPDPNRatiosRcd.h" #include "DataFormats/DetId/interface/DetId.h" @@ -20,7 +21,7 @@ #include /** */ -class EcalLaserCondTools : public edm::EDAnalyzer { +class EcalLaserCondTools : public edm::one::EDAnalyzer<> { //static fields /** Number of extended laser monitoring regions @@ -83,6 +84,7 @@ class EcalLaserCondTools : public edm::EDAnalyzer { //fields private: + edm::ESGetToken laserAPDPNRatiosToken_; FILE* fout_; FILE* eventList_; std::string eventListFileName_; diff --git a/CalibCalorimetry/EcalTrivialCondModules/interface/EcalTrivialObjectAnalyzer.h b/CalibCalorimetry/EcalTrivialCondModules/interface/EcalTrivialObjectAnalyzer.h index e3308173f5691..cef90d783dc02 100644 --- a/CalibCalorimetry/EcalTrivialCondModules/interface/EcalTrivialObjectAnalyzer.h +++ b/CalibCalorimetry/EcalTrivialCondModules/interface/EcalTrivialObjectAnalyzer.h @@ -1,18 +1,101 @@ +#ifndef CalibCalorimetry_EcalTrivialCondModules_EcalTrivialObjectAnalyzer_h +#define CalibCalorimetry_EcalTrivialCondModules_EcalTrivialObjectAnalyzer_h // // Created: 2 Mar 2006 // Shahram Rahatlou, University of Rome & INFN // -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" -class EcalTrivialObjectAnalyzer : public edm::EDAnalyzer { +#include "CondFormats/EcalObjects/interface/EcalPedestals.h" +#include "CondFormats/DataRecord/interface/EcalPedestalsRcd.h" + +#include "CondFormats/EcalObjects/interface/EcalWeightXtalGroups.h" +#include "CondFormats/DataRecord/interface/EcalWeightXtalGroupsRcd.h" + +#include "CondFormats/EcalObjects/interface/EcalTBWeights.h" +#include "CondFormats/DataRecord/interface/EcalTBWeightsRcd.h" + +#include "CondFormats/EcalObjects/interface/EcalIntercalibConstants.h" +#include "CondFormats/DataRecord/interface/EcalIntercalibConstantsRcd.h" + +#include "CondFormats/EcalObjects/interface/EcalIntercalibErrors.h" +#include "CondFormats/DataRecord/interface/EcalIntercalibErrorsRcd.h" + +#include "CondFormats/EcalObjects/interface/EcalTimeCalibConstants.h" +#include "CondFormats/DataRecord/interface/EcalTimeCalibConstantsRcd.h" + +#include "CondFormats/EcalObjects/interface/EcalTimeCalibErrors.h" +#include "CondFormats/DataRecord/interface/EcalTimeCalibErrorsRcd.h" + +#include "CondFormats/EcalObjects/interface/EcalTimeOffsetConstant.h" +#include "CondFormats/DataRecord/interface/EcalTimeOffsetConstantRcd.h" + +#include "CondFormats/EcalObjects/interface/EcalGainRatios.h" +#include "CondFormats/DataRecord/interface/EcalGainRatiosRcd.h" + +#include "CondFormats/EcalObjects/interface/EcalADCToGeVConstant.h" +#include "CondFormats/DataRecord/interface/EcalADCToGeVConstantRcd.h" + +#include "CondFormats/EcalObjects/interface/EcalLaserAlphas.h" +#include "CondFormats/DataRecord/interface/EcalLaserAlphasRcd.h" + +#include "CondFormats/EcalObjects/interface/EcalLaserAPDPNRatiosRef.h" +#include "CondFormats/DataRecord/interface/EcalLaserAPDPNRatiosRefRcd.h" + +#include "CondFormats/EcalObjects/interface/EcalLaserAPDPNRatios.h" +#include "CondFormats/DataRecord/interface/EcalLaserAPDPNRatiosRcd.h" + +#include "CondFormats/EcalObjects/interface/EcalClusterLocalContCorrParameters.h" +#include "CondFormats/DataRecord/interface/EcalClusterLocalContCorrParametersRcd.h" +#include "CondFormats/EcalObjects/interface/EcalClusterCrackCorrParameters.h" +#include "CondFormats/DataRecord/interface/EcalClusterCrackCorrParametersRcd.h" +#include "CondFormats/EcalObjects/interface/EcalClusterEnergyCorrectionParameters.h" +#include "CondFormats/DataRecord/interface/EcalClusterEnergyCorrectionParametersRcd.h" +#include "CondFormats/EcalObjects/interface/EcalClusterEnergyUncertaintyParameters.h" +#include "CondFormats/DataRecord/interface/EcalClusterEnergyUncertaintyParametersRcd.h" +#include "CondFormats/EcalObjects/interface/EcalClusterEnergyCorrectionObjectSpecificParameters.h" +#include "CondFormats/DataRecord/interface/EcalClusterEnergyCorrectionObjectSpecificParametersRcd.h" + +#include "CondFormats/EcalObjects/interface/EcalChannelStatus.h" +#include "CondFormats/DataRecord/interface/EcalChannelStatusRcd.h" + +#include "CondFormats/EcalObjects/interface/EcalSampleMask.h" +#include "CondFormats/DataRecord/interface/EcalSampleMaskRcd.h" + +class EcalTrivialObjectAnalyzer : public edm::one::EDAnalyzer<> { public: - explicit EcalTrivialObjectAnalyzer(edm::ParameterSet const& p) {} - explicit EcalTrivialObjectAnalyzer(int i) {} + explicit EcalTrivialObjectAnalyzer(edm::ParameterSet const& p); ~EcalTrivialObjectAnalyzer() override {} void analyze(const edm::Event& e, const edm::EventSetup& c) override; private: + const edm::ESGetToken pedestalsToken_; + const edm::ESGetToken adcToGevConstantToken_; + const edm::ESGetToken weightXtalGroupsToken_; + const edm::ESGetToken gainRatiosToken_; + const edm::ESGetToken intercalibConstantsToken_; + const edm::ESGetToken intercalibErrorsToken_; + const edm::ESGetToken timeCalibConstantsToken_; + const edm::ESGetToken timeCalibErrorsToken_; + const edm::ESGetToken timeOffsetConstantToken_; + const edm::ESGetToken tbWeightsToken_; + const edm::ESGetToken + clusterLocalContCorrToken_; + const edm::ESGetToken clusterCrackCorrToken_; + const edm::ESGetToken + clusterEnergyCorrectionToken_; + const edm::ESGetToken + clusterEnergyUncertaintyToken_; + const edm::ESGetToken + clusterEnergyCorrectionObjectSpecificToken_; + const edm::ESGetToken laserAlphasToken_; + const edm::ESGetToken laserAPDPNRatiosRefToken_; + const edm::ESGetToken laserAPDPNRatiosToken_; + const edm::ESGetToken channelStatusToken_; + const edm::ESGetToken sampleMaskToken_; }; +#endif diff --git a/CalibCalorimetry/EcalTrivialCondModules/src/EcalLaserCondTools.cc b/CalibCalorimetry/EcalTrivialCondModules/src/EcalLaserCondTools.cc index eb836e3c4a5f7..7a6c64d1f22de 100644 --- a/CalibCalorimetry/EcalTrivialCondModules/src/EcalLaserCondTools.cc +++ b/CalibCalorimetry/EcalTrivialCondModules/src/EcalLaserCondTools.cc @@ -7,12 +7,10 @@ #include "CalibCalorimetry/EcalTrivialCondModules/interface/EcalLaserCondTools.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "CondFormats/DataRecord/interface/EcalLaserAPDPNRatiosRcd.h" #include "DataFormats/EcalDetId/interface/EBDetId.h" #include "DataFormats/EcalDetId/interface/EEDetId.h" @@ -36,6 +34,10 @@ EcalLaserCondTools::EcalLaserCondTools(const edm::ParameterSet& ps) toTime_(ps.getParameter("toTime")), minP_(ps.getParameter("transparencyMin")), maxP_(ps.getParameter("transparencyMax")) { + if (mode_ == "db_to_ascii_file") { + laserAPDPNRatiosToken_ = esConsumes(); + } + ferr_ = fopen("corr_errors.txt", "w"); fprintf(ferr_, "#t1\tdetid\tp1\tp2\tp3"); @@ -618,13 +620,10 @@ std::string EcalLaserCondTools::timeToString(time_t t) { } void EcalLaserCondTools::dbToAscii(const edm::EventSetup& es) { - edm::ESHandle hCorr; - es.get().get(hCorr); - - const EcalLaserAPDPNRatios* corr = hCorr.product(); + const auto& laserAPDPNRatios = es.getData(laserAPDPNRatiosToken_); - const EcalLaserAPDPNRatios::EcalLaserAPDPNRatiosMap& p = corr->getLaserMap(); - const EcalLaserAPDPNRatios::EcalLaserTimeStampMap& t = corr->getTimeMap(); + const EcalLaserAPDPNRatios::EcalLaserAPDPNRatiosMap& p = laserAPDPNRatios.getLaserMap(); + const EcalLaserAPDPNRatios::EcalLaserTimeStampMap& t = laserAPDPNRatios.getTimeMap(); if (t.size() != EcalLaserCondTools::nLmes) throw cms::Exception("LasCor") << "Unexpected number time parameter triplets\n"; diff --git a/CalibCalorimetry/EcalTrivialCondModules/src/EcalTrivialObjectAnalyzer.cc b/CalibCalorimetry/EcalTrivialCondModules/src/EcalTrivialObjectAnalyzer.cc index b1613f496bc7a..3b6b52ff96aae 100644 --- a/CalibCalorimetry/EcalTrivialCondModules/src/EcalTrivialObjectAnalyzer.cc +++ b/CalibCalorimetry/EcalTrivialCondModules/src/EcalTrivialObjectAnalyzer.cc @@ -10,90 +10,50 @@ #include #include #include -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "DataFormats/EcalDetId/interface/EBDetId.h" - -#include "CondFormats/EcalObjects/interface/EcalPedestals.h" -#include "CondFormats/DataRecord/interface/EcalPedestalsRcd.h" - #include "CondFormats/EcalObjects/interface/EcalXtalGroupId.h" -#include "CondFormats/EcalObjects/interface/EcalWeightXtalGroups.h" -#include "CondFormats/DataRecord/interface/EcalWeightXtalGroupsRcd.h" - #include "CondFormats/EcalObjects/interface/EcalWeightSet.h" -#include "CondFormats/EcalObjects/interface/EcalTBWeights.h" -#include "CondFormats/DataRecord/interface/EcalTBWeightsRcd.h" - -#include "CondFormats/EcalObjects/interface/EcalIntercalibConstants.h" -#include "CondFormats/DataRecord/interface/EcalIntercalibConstantsRcd.h" - -#include "CondFormats/EcalObjects/interface/EcalIntercalibErrors.h" -#include "CondFormats/DataRecord/interface/EcalIntercalibErrorsRcd.h" - -#include "CondFormats/EcalObjects/interface/EcalTimeCalibConstants.h" -#include "CondFormats/DataRecord/interface/EcalTimeCalibConstantsRcd.h" - -#include "CondFormats/EcalObjects/interface/EcalTimeCalibErrors.h" -#include "CondFormats/DataRecord/interface/EcalTimeCalibErrorsRcd.h" - -#include "CondFormats/EcalObjects/interface/EcalTimeOffsetConstant.h" -#include "CondFormats/DataRecord/interface/EcalTimeOffsetConstantRcd.h" - +#include "DataFormats/EcalDetId/interface/EBDetId.h" #include "CondFormats/EcalObjects/interface/EcalMGPAGainRatio.h" -#include "CondFormats/EcalObjects/interface/EcalGainRatios.h" -#include "CondFormats/DataRecord/interface/EcalGainRatiosRcd.h" - -#include "CondFormats/EcalObjects/interface/EcalADCToGeVConstant.h" -#include "CondFormats/DataRecord/interface/EcalADCToGeVConstantRcd.h" - -#include "CondFormats/EcalObjects/interface/EcalLaserAlphas.h" -#include "CondFormats/DataRecord/interface/EcalLaserAlphasRcd.h" - -#include "CondFormats/EcalObjects/interface/EcalLaserAPDPNRatiosRef.h" -#include "CondFormats/DataRecord/interface/EcalLaserAPDPNRatiosRefRcd.h" - -#include "CondFormats/EcalObjects/interface/EcalLaserAPDPNRatios.h" -#include "CondFormats/DataRecord/interface/EcalLaserAPDPNRatiosRcd.h" - -#include "CondFormats/EcalObjects/interface/EcalClusterLocalContCorrParameters.h" -#include "CondFormats/DataRecord/interface/EcalClusterLocalContCorrParametersRcd.h" -#include "CondFormats/EcalObjects/interface/EcalClusterCrackCorrParameters.h" -#include "CondFormats/DataRecord/interface/EcalClusterCrackCorrParametersRcd.h" -#include "CondFormats/EcalObjects/interface/EcalClusterEnergyCorrectionParameters.h" -#include "CondFormats/DataRecord/interface/EcalClusterEnergyCorrectionParametersRcd.h" -#include "CondFormats/EcalObjects/interface/EcalClusterEnergyUncertaintyParameters.h" -#include "CondFormats/DataRecord/interface/EcalClusterEnergyUncertaintyParametersRcd.h" -#include "CondFormats/EcalObjects/interface/EcalClusterEnergyCorrectionObjectSpecificParameters.h" -#include "CondFormats/DataRecord/interface/EcalClusterEnergyCorrectionObjectSpecificParametersRcd.h" - -#include "CondFormats/EcalObjects/interface/EcalChannelStatus.h" -#include "CondFormats/DataRecord/interface/EcalChannelStatusRcd.h" - -#include "CondFormats/EcalObjects/interface/EcalSampleMask.h" -#include "CondFormats/DataRecord/interface/EcalSampleMaskRcd.h" #include "CLHEP/Matrix/Matrix.h" using namespace std; +EcalTrivialObjectAnalyzer::EcalTrivialObjectAnalyzer(edm::ParameterSet const& p) + : pedestalsToken_(esConsumes()), + adcToGevConstantToken_(esConsumes()), + weightXtalGroupsToken_(esConsumes()), + gainRatiosToken_(esConsumes()), + intercalibConstantsToken_(esConsumes()), + intercalibErrorsToken_(esConsumes()), + timeCalibConstantsToken_(esConsumes()), + timeCalibErrorsToken_(esConsumes()), + timeOffsetConstantToken_(esConsumes()), + tbWeightsToken_(esConsumes()), + clusterLocalContCorrToken_(esConsumes()), + clusterCrackCorrToken_(esConsumes()), + clusterEnergyCorrectionToken_(esConsumes()), + clusterEnergyUncertaintyToken_(esConsumes()), + clusterEnergyCorrectionObjectSpecificToken_(esConsumes()), + laserAlphasToken_(esConsumes()), + laserAPDPNRatiosRefToken_(esConsumes()), + laserAPDPNRatiosToken_(esConsumes()), + channelStatusToken_(esConsumes()), + sampleMaskToken_(esConsumes()) {} + void EcalTrivialObjectAnalyzer::analyze(const edm::Event& e, const edm::EventSetup& context) { using namespace edm::eventsetup; // Context is not used. edm::LogInfo(">>> EcalTrivialObjectAnalyzer: processing run ") << e.id().run() << " event: " << e.id().event(); - edm::ESHandle pPeds; - context.get().get(pPeds); - // ADC -> GeV Scale - edm::ESHandle pAgc; - context.get().get(pAgc); - const EcalADCToGeVConstant* agc = pAgc.product(); - edm::LogInfo("Global ADC->GeV scale: EB ") << std::setprecision(6) << agc->getEBValue() + const auto& agc = context.getData(adcToGevConstantToken_); + edm::LogInfo("Global ADC->GeV scale: EB ") << std::setprecision(6) << agc.getEBValue() << " GeV/ADC count" " EE " - << std::setprecision(6) << agc->getEEValue() << " GeV/ADC count"; + << std::setprecision(6) << agc.getEEValue() << " GeV/ADC count"; // use a channel to fetch values from DB double r1 = (double)std::rand() / (double(RAND_MAX) + double(1)); @@ -104,9 +64,9 @@ void EcalTrivialObjectAnalyzer::analyze(const edm::Event& e, const edm::EventSet EBDetId ebid(ieta, iphi); //eta,phi edm::LogInfo("EcalTrivialObjectAnalyzer: using EBDetId: ") << ebid; - const EcalPedestals* myped = pPeds.product(); - EcalPedestals::const_iterator it = myped->find(ebid.rawId()); - if (it != myped->end()) { + const auto& myped = context.getData(pedestalsToken_); + EcalPedestals::const_iterator it = myped.find(ebid.rawId()); + if (it != myped.end()) { edm::LogInfo("EcalPedestal: ") << " mean_x1: " << std::setprecision(8) << (*it).mean_x1 << " rms_x1: " << (*it).rms_x1 << " mean_x6: " << (*it).mean_x6 << " rms_x6: " << (*it).rms_x6 << " mean_x12: " << (*it).mean_x12 @@ -116,13 +76,11 @@ void EcalTrivialObjectAnalyzer::analyze(const edm::Event& e, const edm::EventSet } // fetch map of groups of xtals - edm::ESHandle pGrp; - context.get().get(pGrp); - const EcalWeightXtalGroups* grp = pGrp.product(); + const auto& grp = context.getData(weightXtalGroupsToken_); - EcalXtalGroupsMap::const_iterator git = grp->getMap().find(ebid.rawId()); + EcalXtalGroupsMap::const_iterator git = grp.getMap().find(ebid.rawId()); EcalXtalGroupId gid; - if (git != grp->getMap().end()) { + if (git != grp.getMap().end()) { edm::LogInfo("XtalGroupId.id() = ") << std::setprecision(3) << (*git).id(); gid = (*git); } else { @@ -130,13 +88,11 @@ void EcalTrivialObjectAnalyzer::analyze(const edm::Event& e, const edm::EventSet } // Gain Ratios - edm::ESHandle pRatio; - context.get().get(pRatio); - const EcalGainRatios* gr = pRatio.product(); + const auto& gr = context.getData(gainRatiosToken_); - EcalGainRatioMap::const_iterator grit = gr->getMap().find(ebid.rawId()); + EcalGainRatioMap::const_iterator grit = gr.getMap().find(ebid.rawId()); EcalMGPAGainRatio mgpa; - if (grit != gr->getMap().end()) { + if (grit != gr.getMap().end()) { mgpa = (*grit); edm::LogInfo("EcalMGPAGainRatio: ") << "gain 12/6 : " << std::setprecision(4) << mgpa.gain12Over6() @@ -146,13 +102,11 @@ void EcalTrivialObjectAnalyzer::analyze(const edm::Event& e, const edm::EventSet } // Intercalib constants - edm::ESHandle pIcal; - context.get().get(pIcal); - const EcalIntercalibConstants* ical = pIcal.product(); + const auto& ical = context.getData(intercalibConstantsToken_); - EcalIntercalibConstantMap::const_iterator icalit = ical->getMap().find(ebid.rawId()); + EcalIntercalibConstantMap::const_iterator icalit = ical.getMap().find(ebid.rawId()); EcalIntercalibConstant icalconst; - if (icalit != ical->getMap().end()) { + if (icalit != ical.getMap().end()) { icalconst = (*icalit); edm::LogInfo("EcalIntercalibConstant: ") << std::setprecision(6) << icalconst; @@ -161,13 +115,11 @@ void EcalTrivialObjectAnalyzer::analyze(const edm::Event& e, const edm::EventSet } // Intercalib errors - edm::ESHandle pIcalErr; - context.get().get(pIcalErr); - const EcalIntercalibErrors* icalErr = pIcalErr.product(); + const auto& icalErr = context.getData(intercalibErrorsToken_); - EcalIntercalibErrorMap::const_iterator icalitErr = icalErr->getMap().find(ebid.rawId()); + EcalIntercalibErrorMap::const_iterator icalitErr = icalErr.getMap().find(ebid.rawId()); EcalIntercalibError icalconstErr; - if (icalitErr != icalErr->getMap().end()) { + if (icalitErr != icalErr.getMap().end()) { icalconstErr = (*icalitErr); edm::LogInfo("EcalIntercalibError: ") << std::setprecision(6) << icalconstErr; @@ -177,13 +129,11 @@ void EcalTrivialObjectAnalyzer::analyze(const edm::Event& e, const edm::EventSet { // quick and dirty for cut and paste ;) it is a test program... // TimeCalib constants - edm::ESHandle pIcal; - context.get().get(pIcal); - const EcalTimeCalibConstants* ical = pIcal.product(); + const auto& ical = context.getData(timeCalibConstantsToken_); - EcalTimeCalibConstantMap::const_iterator icalit = ical->getMap().find(ebid.rawId()); + EcalTimeCalibConstantMap::const_iterator icalit = ical.getMap().find(ebid.rawId()); EcalTimeCalibConstant icalconst; - if (icalit != ical->getMap().end()) { + if (icalit != ical.getMap().end()) { icalconst = (*icalit); edm::LogInfo("EcalTimeCalibConstant: ") << std::setprecision(6) << icalconst; @@ -192,13 +142,11 @@ void EcalTrivialObjectAnalyzer::analyze(const edm::Event& e, const edm::EventSet } // TimeCalib errors - edm::ESHandle pIcalErr; - context.get().get(pIcalErr); - const EcalTimeCalibErrors* icalErr = pIcalErr.product(); + const auto& icalErr = context.getData(timeCalibErrorsToken_); - EcalTimeCalibErrorMap::const_iterator icalitErr = icalErr->getMap().find(ebid.rawId()); + EcalTimeCalibErrorMap::const_iterator icalitErr = icalErr.getMap().find(ebid.rawId()); EcalTimeCalibError icalconstErr; - if (icalitErr != icalErr->getMap().end()) { + if (icalitErr != icalErr.getMap().end()) { icalconstErr = (*icalitErr); edm::LogInfo("EcalTimeCalibError: ") << std::setprecision(6) << icalconstErr; @@ -211,27 +159,23 @@ void EcalTrivialObjectAnalyzer::analyze(const edm::Event& e, const edm::EventSet //std::cout <<"Fetching TimeOffsetConstant from DB " << std::endl; // Time Offset constants - edm::ESHandle pTOff; - context.get().get(pTOff); - const EcalTimeOffsetConstant* TOff = pTOff.product(); + const auto& TOff = context.getData(timeOffsetConstantToken_); - edm::LogInfo("EcalTimeOffsetConstant: ") << " EB " << TOff->getEBValue() << " EE " << TOff->getEEValue(); + edm::LogInfo("EcalTimeOffsetConstant: ") << " EB " << TOff.getEBValue() << " EE " << TOff.getEEValue(); // fetch TB weights edm::LogInfo("Fetching EcalTBWeights from DB "); - edm::ESHandle pWgts; - context.get().get(pWgts); - const EcalTBWeights* wgts = pWgts.product(); - edm::LogInfo("EcalTBWeightMap.size(): ") << std::setprecision(3) << wgts->getMap().size(); + const auto& wgts = context.getData(tbWeightsToken_); + edm::LogInfo("EcalTBWeightMap.size(): ") << std::setprecision(3) << wgts.getMap().size(); // look up the correct weights for this xtal //EcalXtalGroupId gid( (*git) ); EcalTBWeights::EcalTDCId tdcid(1); edm::LogInfo("Lookup EcalWeightSet for groupid: ") << std::setprecision(3) << gid.id() << " and TDC id " << tdcid; - EcalTBWeights::EcalTBWeightMap::const_iterator wit = wgts->getMap().find(std::make_pair(gid, tdcid)); + EcalTBWeights::EcalTBWeightMap::const_iterator wit = wgts.getMap().find(std::make_pair(gid, tdcid)); EcalWeightSet wset; - if (wit != wgts->getMap().end()) { + if (wit != wgts.getMap().end()) { wset = wit->second; edm::LogInfo("check size of data members in EcalWeightSet"); //wit->second.print(std::cout); @@ -259,52 +203,39 @@ void EcalTrivialObjectAnalyzer::analyze(const edm::Event& e, const edm::EventSet } // cluster functions/corrections - edm::ESHandle pLocalCont; - context.get().get(pLocalCont); - const EcalClusterLocalContCorrParameters* paramLocalCont = pLocalCont.product(); + const auto& paramLocalCont = context.getData(clusterLocalContCorrToken_); edm::LogInfo("LocalContCorrParameters:"); - for (EcalFunctionParameters::const_iterator it = paramLocalCont->params().begin(); - it != paramLocalCont->params().end(); + for (EcalFunctionParameters::const_iterator it = paramLocalCont.params().begin(); it != paramLocalCont.params().end(); ++it) { // edm::LogInfo(" ") << *it; } // std::cout << "\n"; - edm::ESHandle pCrack; - context.get().get(pCrack); - const EcalClusterCrackCorrParameters* paramCrack = pCrack.product(); + const auto& paramCrack = context.getData(clusterCrackCorrToken_); edm::LogInfo("CrackCorrParameters:"); - for (EcalFunctionParameters::const_iterator it = paramCrack->params().begin(); it != paramCrack->params().end(); - ++it) { + for (EcalFunctionParameters::const_iterator it = paramCrack.params().begin(); it != paramCrack.params().end(); ++it) { // edm::LogInfo(" ") << *it; } // std::cout << "\n"; - edm::ESHandle pEnergyCorrection; - context.get().get(pEnergyCorrection); - const EcalClusterEnergyCorrectionParameters* paramEnergyCorrection = pEnergyCorrection.product(); + const auto& paramEnergyCorrection = context.getData(clusterEnergyCorrectionToken_); edm::LogInfo("EnergyCorrectionParameters:"); - for (EcalFunctionParameters::const_iterator it = paramEnergyCorrection->params().begin(); - it != paramEnergyCorrection->params().end(); + for (EcalFunctionParameters::const_iterator it = paramEnergyCorrection.params().begin(); + it != paramEnergyCorrection.params().end(); ++it) { // edm::LogInfo(" ") << *it; } // std::cout << "\n"; - edm::ESHandle pEnergyUncertainty; - context.get().get(pEnergyUncertainty); - const EcalClusterEnergyUncertaintyParameters* paramEnergyUncertainty = pEnergyUncertainty.product(); + const auto& paramEnergyUncertainty = context.getData(clusterEnergyUncertaintyToken_); edm::LogInfo("EnergyCorrectionParameters:"); - for (EcalFunctionParameters::const_iterator it = paramEnergyUncertainty->params().begin(); - it != paramEnergyUncertainty->params().end(); + for (EcalFunctionParameters::const_iterator it = paramEnergyUncertainty.params().begin(); + it != paramEnergyUncertainty.params().end(); ++it) { // edm::LogInfo(" ") << *it; } // std::cout << "\n"; - edm::ESHandle pEnergyCorrectionObjectSpecific; - context.get().get(pEnergyCorrectionObjectSpecific); - const EcalClusterEnergyCorrectionObjectSpecificParameters* paramEnergyCorrectionObjectSpecific = - pEnergyCorrectionObjectSpecific.product(); + const auto& paramEnergyCorrectionObjectSpecific = context.getData(clusterEnergyCorrectionObjectSpecificToken_); edm::LogInfo("EnergyCorrectionObjectSpecificParameters:"); - for (EcalFunctionParameters::const_iterator it = paramEnergyCorrectionObjectSpecific->params().begin(); - it != paramEnergyCorrectionObjectSpecific->params().end(); + for (EcalFunctionParameters::const_iterator it = paramEnergyCorrectionObjectSpecific.params().begin(); + it != paramEnergyCorrectionObjectSpecific.params().end(); ++it) { // edm::LogInfo(" ") << *it; } @@ -313,26 +244,22 @@ void EcalTrivialObjectAnalyzer::analyze(const edm::Event& e, const edm::EventSet // laser correction // laser alphas - edm::ESHandle pAlpha; - context.get().get(pAlpha); - const EcalLaserAlphas* lalpha = pAlpha.product(); + const auto& lalpha = context.getData(laserAlphasToken_); EcalLaserAlphaMap::const_iterator lalphait; - lalphait = lalpha->getMap().find(ebid.rawId()); - if (lalphait != lalpha->getMap().end()) { + lalphait = lalpha.getMap().find(ebid.rawId()); + if (lalphait != lalpha.getMap().end()) { edm::LogInfo("EcalLaserAlpha: ") << std::setprecision(6) << (*lalphait); } else { edm::LogInfo("No laser alpha found for this xtal! something wrong with EcalLaserAlphas in your DB? "); } // laser apdpnref - edm::ESHandle pAPDPNRatiosRef; - context.get().get(pAPDPNRatiosRef); - const EcalLaserAPDPNRatiosRef* lref = pAPDPNRatiosRef.product(); + const auto& lref = context.getData(laserAPDPNRatiosRefToken_); EcalLaserAPDPNRatiosRef::const_iterator lrefit; - lrefit = lref->getMap().find(ebid.rawId()); - if (lrefit != lref->getMap().end()) { + lrefit = lref.getMap().find(ebid.rawId()); + if (lrefit != lref.getMap().end()) { // edm::LogInfo("EcalLaserAPDPNRatiosRef: ") // < pAPDPNRatios; - context.get().get(pAPDPNRatios); - const EcalLaserAPDPNRatios* lratio = pAPDPNRatios.product(); + const auto& lratio = context.getData(laserAPDPNRatiosToken_); EcalLaserAPDPNRatios::EcalLaserAPDPNRatiosMap::const_iterator lratioit; - lratioit = lratio->getLaserMap().find(ebid.rawId()); + lratioit = lratio.getLaserMap().find(ebid.rawId()); EcalLaserAPDPNRatios::EcalLaserAPDPNpair lratioconst; - if (lratioit != lratio->getLaserMap().end()) { + if (lratioit != lratio.getLaserMap().end()) { lratioconst = (*lratioit); // edm::LogInfo("EcalLaserAPDPNRatios: ") @@ -366,20 +291,18 @@ void EcalTrivialObjectAnalyzer::analyze(const edm::Event& e, const edm::EventSet EcalLaserAPDPNRatios::EcalLaserTimeStamp ltimestamp; // EcalLaserAPDPNRatios::EcalLaserTimeStampMap::const_iterator ltimeit; for (int i = 1; i <= 92; i++) { - ltimestamp = lratio->getTimeMap()[i]; + ltimestamp = lratio.getTimeMap()[i]; // edm::LogInfo("i = ") << std::setprecision(6) << i // << ltimestamp.t1.value() << " " << ltimestamp.t2.value() << " : " ; } // edm::LogInfo("Tests finished."); // channel status - edm::ESHandle pChannelStatus; - context.get().get(pChannelStatus); - const EcalChannelStatus* ch_status = pChannelStatus.product(); + const auto& ch_status = context.getData(channelStatusToken_); EcalChannelStatusMap::const_iterator chit; - chit = ch_status->getMap().find(ebid.rawId()); - if (chit != ch_status->getMap().end()) { + chit = ch_status.getMap().find(ebid.rawId()); + if (chit != ch_status.getMap().end()) { EcalChannelStatusCode ch_code = (*chit); edm::LogInfo("EcalChannelStatus: ") << std::setprecision(6) << ch_code.getStatusCode(); } else { @@ -389,11 +312,9 @@ void EcalTrivialObjectAnalyzer::analyze(const edm::Event& e, const edm::EventSet // laser transparency correction // Mask to ignore sample - edm::ESHandle pSMask; - context.get().get(pSMask); - const EcalSampleMask* smask = pSMask.product(); - edm::LogInfo("Sample Mask EB ") << std::hex << smask->getEcalSampleMaskRecordEB() << " EE " << std::hex - << smask->getEcalSampleMaskRecordEE(); + const auto& smask = context.getData(sampleMaskToken_); + edm::LogInfo("Sample Mask EB ") << std::hex << smask.getEcalSampleMaskRecordEB() << " EE " << std::hex + << smask.getEcalSampleMaskRecordEE(); /* std::cout << "make CLHEP matrices from vector>" << std::endl; diff --git a/CalibCalorimetry/HcalPlugins/src/HcalHardcodeCalibrations.cc b/CalibCalorimetry/HcalPlugins/src/HcalHardcodeCalibrations.cc index 7ec9989e7f8d4..43941d9d13cc4 100644 --- a/CalibCalorimetry/HcalPlugins/src/HcalHardcodeCalibrations.cc +++ b/CalibCalorimetry/HcalPlugins/src/HcalHardcodeCalibrations.cc @@ -834,6 +834,10 @@ std::unique_ptr HcalHardcodeCalibrations::produceTPChan auto result = std::make_unique(&topo); const std::vector& cells = allCells(topo, dbHardcode.killHE()); for (auto cell : cells) { + // Thinking about Phase2 and the new FIR filter, + // for now, don't put TT in TPChannelParams + if (cell.subdetId() == HcalTriggerTower) + continue; HcalTPChannelParameter item = dbHardcode.makeHardcodeTPChannelParameter(cell); result->addValues(item); } diff --git a/CalibCalorimetry/HcalTPGAlgos/interface/HcaluLUTTPGCoder.h b/CalibCalorimetry/HcalTPGAlgos/interface/HcaluLUTTPGCoder.h index 99133ebc7d479..385592e576f47 100644 --- a/CalibCalorimetry/HcalTPGAlgos/interface/HcaluLUTTPGCoder.h +++ b/CalibCalorimetry/HcalTPGAlgos/interface/HcaluLUTTPGCoder.h @@ -43,6 +43,7 @@ class HcaluLUTTPGCoder : public HcalTPGCoder { void adc2Linear(const HFDataFrame& df, IntegerCaloSamples& ics) const override; void adc2Linear(const QIE10DataFrame& df, IntegerCaloSamples& ics) const override; void adc2Linear(const QIE11DataFrame& df, IntegerCaloSamples& ics) const override; + std::vector group0FGbits(const QIE11DataFrame& df) const; void compress(const IntegerCaloSamples& ics, const std::vector& featureBits, HcalTriggerPrimitiveDigi& tp) const override; @@ -69,6 +70,7 @@ class HcaluLUTTPGCoder : public HcalTPGCoder { void set1TSContainHE(bool contain1TSHE) { contain1TSHE_ = contain1TSHE; } void setContainPhaseHB(double containPhaseNSHB) { containPhaseNSHB_ = containPhaseNSHB; } void setContainPhaseHE(double containPhaseNSHE) { containPhaseNSHE_ = containPhaseNSHE; } + void setApplyFixPCC(double applyFixPCC) { applyFixPCC_ = applyFixPCC; } void setOverrideDBweightsAndFilterHB(bool overrideDBweightsAndFilterHB) { overrideDBweightsAndFilterHB_ = overrideDBweightsAndFilterHB; } @@ -122,6 +124,7 @@ class HcaluLUTTPGCoder : public HcalTPGCoder { bool contain1TSHB_, contain1TSHE_; double containPhaseNSHB_ = 6.0; double containPhaseNSHE_ = 6.0; + bool applyFixPCC_; double linearLSB_QIE8_, linearLSB_QIE11_, linearLSB_QIE11Overlap_; std::unique_ptr pulseCorr_; bool overrideDBweightsAndFilterHB_ = false; diff --git a/CalibCalorimetry/HcalTPGAlgos/src/HcaluLUTTPGCoder.cc b/CalibCalorimetry/HcalTPGAlgos/src/HcaluLUTTPGCoder.cc index 3009cc3b1d9a8..48f1029a4596e 100644 --- a/CalibCalorimetry/HcalTPGAlgos/src/HcaluLUTTPGCoder.cc +++ b/CalibCalorimetry/HcalTPGAlgos/src/HcaluLUTTPGCoder.cc @@ -63,6 +63,7 @@ HcaluLUTTPGCoder::HcaluLUTTPGCoder() allLinear_{}, contain1TSHB_{}, contain1TSHE_{}, + applyFixPCC_{}, linearLSB_QIE8_{}, linearLSB_QIE11_{}, linearLSB_QIE11Overlap_{} {} @@ -78,6 +79,7 @@ void HcaluLUTTPGCoder::init(const HcalTopology* top, const HcalTimeSlew* delay) allLinear_ = false; contain1TSHB_ = false; contain1TSHE_ = false; + applyFixPCC_ = false; linearLSB_QIE8_ = 1.; linearLSB_QIE11_ = 1.; linearLSB_QIE11Overlap_ = 1.; @@ -333,6 +335,7 @@ void HcaluLUTTPGCoder::update(const HcalDbService& conditions) { assert(metadata != nullptr); float nominalgain_ = metadata->getNominalGain(); + pulseCorr_ = std::make_unique(MaximumFractionalError, applyFixPCC_); pulseCorr_->beginRun(&conditions, delay_); make_cosh_ieta_map(); @@ -361,15 +364,21 @@ void HcaluLUTTPGCoder::update(const HcalDbService& conditions) { continue; int aieta = abs(hcalTTDetId.ieta()); - int tp_version = hcalTTDetId.version(); + + // The absence of TT channels in the HcalTPChannelParameters + // is intepreted as to not use the new filter + int weight = -1.0; + auto tpParam = conditions.getHcalTPChannelParameter(hcalTTDetId, false); + if (tpParam) + weight = tpParam->getauxi1(); if (aieta <= lastHBRing) { foundHB = true; - if (tp_version > 1) + if (weight != -1.0) newHBtp = true; } else if (aieta > lastHBRing and aieta < lastHERing) { foundHE = true; - if (tp_version > 1) + if (weight != -1.0) newHEtp = true; } } @@ -391,6 +400,11 @@ void HcaluLUTTPGCoder::update(const HcalDbService& conditions) { unsigned int mipMax = 0; unsigned int mipMin = 0; + unsigned int bit12_energy = + 0; // defaults for energy requirement for bits 12-15 are high / low to avoid FG bit 0-4 being set when not intended + unsigned int bit13_energy = 0; + unsigned int bit14_energy = 999; + unsigned int bit15_energy = 999; bool is2018OrLater = topo_->triggerMode() >= HcalTopologyMode::TriggerMode_2018 or topo_->triggerMode() == HcalTopologyMode::TriggerMode_2018legacy; @@ -398,6 +412,10 @@ void HcaluLUTTPGCoder::update(const HcalDbService& conditions) { const HcalTPChannelParameter* channelParameters = conditions.getHcalTPChannelParameter(cell); mipMax = channelParameters->getFGBitInfo() >> 16; mipMin = channelParameters->getFGBitInfo() & 0xFFFF; + bit12_energy = 16; // depths 1,2 max energy + bit13_energy = 80; // depths 3+ min energy + bit14_energy = 64; // prompt min energy + bit15_energy = 64; // delayed min energy } int lutId = getLUTId(cell); @@ -509,7 +527,18 @@ void HcaluLUTTPGCoder::update(const HcalDbService& conditions) { containmentCorrection / nominalgain_ / granularity)), MASK); + unsigned int linearizedADC = + lut[adc]; // used for bits 12, 13, 14, 15 for Group 0 LUT for LLP time and depth bits that rely on linearized energies + if (qieType == QIE11) { + if ((linearizedADC < bit12_energy and cell.depth() <= 2) or (cell.depth() >= 3)) + lut[adc] |= 1 << 12; + if (linearizedADC >= bit13_energy and cell.depth() >= 3) + lut[adc] |= 1 << 13; + if (linearizedADC >= bit14_energy) + lut[adc] |= 1 << 14; + if (linearizedADC >= bit15_energy) + lut[adc] |= 1 << 15; if (adc >= mipMin and adc < mipMax) lut[adc] |= QIE11_LUT_MSB0; else if (adc >= mipMax) @@ -571,6 +600,18 @@ unsigned short HcaluLUTTPGCoder::adc2Linear(HcalQIESample sample, HcalDetId id) return ((inputLUT_.at(lutId)).at(sample.adc()) & QIE8_LUT_BITMASK); } +std::vector HcaluLUTTPGCoder::group0FGbits(const QIE11DataFrame& df) const { + int lutId = getLUTId(HcalDetId(df.id())); + const Lut& lut = inputLUT_.at(lutId); + std::vector group0LLPbits; + group0LLPbits.reserve(df.samples()); + for (int i = 0; i < df.samples(); i++) { + group0LLPbits.push_back((lut.at(df[i].adc()) >> 12) & + 0xF); // four bits (12-15) of LUT used to set 6 finegrain bits from uHTR + } + return group0LLPbits; +} + float HcaluLUTTPGCoder::getLUTPedestal(HcalDetId id) const { int lutId = getLUTId(id); return ped_.at(lutId); diff --git a/CalibCalorimetry/HcalTPGEventSetup/src/HcalTPGCoderULUT.cc b/CalibCalorimetry/HcalTPGEventSetup/src/HcalTPGCoderULUT.cc index 8a3b32aab8d4a..d81cff7163dcf 100644 --- a/CalibCalorimetry/HcalTPGEventSetup/src/HcalTPGCoderULUT.cc +++ b/CalibCalorimetry/HcalTPGEventSetup/src/HcalTPGCoderULUT.cc @@ -59,6 +59,7 @@ class HcalTPGCoderULUT : public edm::ESProducer { bool read_FGLut_, read_Ascii_, read_XML_, LUTGenerationMode_, linearLUTs_; bool contain1TSHB_, contain1TSHE_; double containPhaseNSHB_, containPhaseNSHE_; + bool applyFixPCC_; bool overrideDBweightsAndFilterHB_, overrideDBweightsAndFilterHE_; double linearLSB_QIE8_, linearLSB_QIE11Overlap_, linearLSB_QIE11_; int maskBit_; @@ -86,6 +87,7 @@ HcalTPGCoderULUT::HcalTPGCoderULUT(const edm::ParameterSet& iConfig) { contain1TSHE_ = iConfig.getParameter("contain1TSHE"); containPhaseNSHB_ = iConfig.getParameter("containPhaseNSHB"); containPhaseNSHE_ = iConfig.getParameter("containPhaseNSHE"); + applyFixPCC_ = iConfig.getParameter("applyFixPCC"); overrideDBweightsAndFilterHB_ = iConfig.getParameter("overrideDBweightsAndFilterHB"); overrideDBweightsAndFilterHE_ = iConfig.getParameter("overrideDBweightsAndFilterHE"); @@ -123,6 +125,8 @@ void HcalTPGCoderULUT::buildCoder(const HcalTopology* topo, const HcalTimeSlew* theCoder->setContainPhaseHB(containPhaseNSHB_); theCoder->setContainPhaseHE(containPhaseNSHE_); + theCoder->setApplyFixPCC(applyFixPCC_); + if (read_Ascii_ || read_XML_) { edm::LogInfo("HCAL") << "Using ASCII/XML LUTs" << ifilename_.fullPath() << " for HcalTPGCoderULUT initialization"; if (read_Ascii_) { diff --git a/CalibFormats/CaloObjects/src/CaloSamples.cc b/CalibFormats/CaloObjects/src/CaloSamples.cc index e8e9eb4f4d5c5..65155fb170966 100644 --- a/CalibFormats/CaloObjects/src/CaloSamples.cc +++ b/CalibFormats/CaloObjects/src/CaloSamples.cc @@ -49,18 +49,32 @@ CaloSamples &CaloSamples::operator+=(double value) { } CaloSamples &CaloSamples::operator+=(const CaloSamples &other) { + bool addHighFidelityPreMix = false; if (size_ != other.size_ || presamples_ != other.presamples_ || preciseSize_ != other.preciseSize_) { - edm::LogError("CaloHitResponse") << "Mismatched calo signals "; - } - int i; - for (i = 0; i < size_; ++i) { - data_[i] += other.data_[i]; + if (presamples_ == other.presamples_ && preciseSize_ == other.size_) { + addHighFidelityPreMix = true; + } else { + edm::LogError("CaloHitResponse") << "Mismatched calo signals "; + } } - if (preciseData_.empty() && !other.preciseData_.empty()) - resetPrecise(); - if (!other.preciseData_.empty()) { - for (i = 0; i < preciseSize_; ++i) { - preciseData_[i] += other.preciseData_[i]; + if (addHighFidelityPreMix) { + int sampleBin(0); + for (int i = 0; i < preciseSize_; ++i) { + sampleBin = floor(i * deltaTprecise_ / 25); + data_[sampleBin] += other.data_[i]; + preciseData_[i] += other.data_[i]; + } + } else { + int i; + for (i = 0; i < size_; ++i) { + data_[i] += other.data_[i]; + } + if (preciseData_.empty() && !other.preciseData_.empty()) + resetPrecise(); + if (!other.preciseData_.empty()) { + for (i = 0; i < preciseSize_; ++i) { + preciseData_[i] += other.preciseData_[i]; + } } } return *this; diff --git a/CalibMuon/CSCCalibration/plugins/CSCL1TPLookupTableEP.cc b/CalibMuon/CSCCalibration/plugins/CSCL1TPLookupTableEP.cc new file mode 100644 index 0000000000000..5b904cb010978 --- /dev/null +++ b/CalibMuon/CSCCalibration/plugins/CSCL1TPLookupTableEP.cc @@ -0,0 +1,289 @@ +// system include files +#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" +#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" +#include "FWCore/ParameterSet/interface/FileInPath.h" +#include "FWCore/Framework/interface/SourceFactory.h" +#include "FWCore/Framework/interface/ModuleFactory.h" +#include "FWCore/Framework/interface/ESProducer.h" +#include "FWCore/Framework/interface/EventSetupRecordIntervalFinder.h" + +#include "CondFormats/DataRecord/interface/CSCL1TPLookupTableCCLUTRcd.h" +#include "CondFormats/DataRecord/interface/CSCL1TPLookupTableME11ILTRcd.h" +#include "CondFormats/DataRecord/interface/CSCL1TPLookupTableME21ILTRcd.h" +#include "CondFormats/CSCObjects/interface/CSCL1TPLookupTableCCLUT.h" +#include "CondFormats/CSCObjects/interface/CSCL1TPLookupTableME11ILT.h" +#include "CondFormats/CSCObjects/interface/CSCL1TPLookupTableME21ILT.h" + +// user include files +#include +#include +#include +#include + +class CSCL1TPLookupTableEP : public edm::ESProducer, public edm::EventSetupRecordIntervalFinder { +public: + CSCL1TPLookupTableEP(const edm::ParameterSet&); + ~CSCL1TPLookupTableEP() override {} + + std::unique_ptr produceCCLUT(const CSCL1TPLookupTableCCLUTRcd&); + std::unique_ptr produceME11ILT(const CSCL1TPLookupTableME11ILTRcd&); + std::unique_ptr produceME21ILT(const CSCL1TPLookupTableME21ILTRcd&); + +protected: + void setIntervalFor(const edm::eventsetup::EventSetupRecordKey&, + const edm::IOVSyncValue&, + edm::ValidityInterval&) override; + +private: + std::vector load(std::string fileName) const; + const edm::ParameterSet pset_; +}; + +CSCL1TPLookupTableEP::CSCL1TPLookupTableEP(const edm::ParameterSet& pset) : pset_(pset) { + setWhatProduced(this, &CSCL1TPLookupTableEP::produceCCLUT); + setWhatProduced(this, &CSCL1TPLookupTableEP::produceME11ILT); + setWhatProduced(this, &CSCL1TPLookupTableEP::produceME21ILT); + findingRecord(); + findingRecord(); + findingRecord(); +} + +void CSCL1TPLookupTableEP::setIntervalFor(const edm::eventsetup::EventSetupRecordKey& iKey, + const edm::IOVSyncValue& iosv, + edm::ValidityInterval& oValidity) { + edm::ValidityInterval infinity(iosv.beginOfTime(), iosv.endOfTime()); + oValidity = infinity; +} + +std::unique_ptr CSCL1TPLookupTableEP::produceCCLUT(const CSCL1TPLookupTableCCLUTRcd&) { + // make the LUT object + std::unique_ptr lut = std::make_unique(); + + // get the text files + std::vector positionLUTFiles_ = pset_.getParameter>("positionLUTFiles"); + std::vector slopeLUTFiles_ = pset_.getParameter>("slopeLUTFiles"); + + std::unordered_map> cclutPosition; + std::unordered_map> cclutSlope; + + // read the text files and extract the data + for (int i = 0; i < 5; ++i) { + cclutPosition[i] = load(positionLUTFiles_[i]); + cclutSlope[i] = load(slopeLUTFiles_[i]); + } + + // set the data in the LUT object + lut->set_cclutPosition(std::move(cclutPosition)); + lut->set_cclutSlope(std::move(cclutSlope)); + + return lut; +} + +std::unique_ptr CSCL1TPLookupTableEP::produceME11ILT(const CSCL1TPLookupTableME11ILTRcd&) { + // make the LUT object + std::unique_ptr lut = std::make_unique(); + + // get the text files + std::vector padToHsME1aFiles_ = pset_.getParameter>("padToHsME1aFiles"); + std::vector padToHsME1bFiles_ = pset_.getParameter>("padToHsME1bFiles"); + + std::vector padToEsME1aFiles_ = pset_.getParameter>("padToEsME1aFiles"); + std::vector padToEsME1bFiles_ = pset_.getParameter>("padToEsME1bFiles"); + + std::vector rollToMaxWgME11Files_ = pset_.getParameter>("rollToMaxWgME11Files"); + std::vector rollToMinWgME11Files_ = pset_.getParameter>("rollToMinWgME11Files"); + + std::vector gemCscSlopeCosiFiles_ = pset_.getParameter>("gemCscSlopeCosiFiles"); + std::vector gemCscSlopeCosiCorrectionFiles_ = + pset_.getParameter>("gemCscSlopeCosiCorrectionFiles"); + std::vector gemCscSlopeCorrectionFiles_ = + pset_.getParameter>("gemCscSlopeCorrectionFiles"); + + std::vector esDiffToSlopeME1aFiles_ = + pset_.getParameter>("esDiffToSlopeME1aFiles"); + std::vector esDiffToSlopeME1bFiles_ = + pset_.getParameter>("esDiffToSlopeME1bFiles"); + + // read the text files and extract the data + auto GEM_pad_CSC_hs_ME1a_even_ = load(padToHsME1aFiles_[0]); + auto GEM_pad_CSC_hs_ME1a_odd_ = load(padToHsME1aFiles_[1]); + auto GEM_pad_CSC_hs_ME1b_even_ = load(padToHsME1bFiles_[0]); + auto GEM_pad_CSC_hs_ME1b_odd_ = load(padToHsME1bFiles_[1]); + + auto GEM_pad_CSC_es_ME1a_even_ = load(padToEsME1aFiles_[0]); + auto GEM_pad_CSC_es_ME1a_odd_ = load(padToEsME1aFiles_[1]); + auto GEM_pad_CSC_es_ME1b_even_ = load(padToEsME1bFiles_[0]); + auto GEM_pad_CSC_es_ME1b_odd_ = load(padToEsME1bFiles_[1]); + + auto GEM_roll_L1_CSC_min_wg_ME11_even_ = load(rollToMinWgME11Files_[0]); + auto GEM_roll_L1_CSC_min_wg_ME11_odd_ = load(rollToMinWgME11Files_[1]); + auto GEM_roll_L2_CSC_min_wg_ME11_even_ = load(rollToMinWgME11Files_[2]); + auto GEM_roll_L2_CSC_min_wg_ME11_odd_ = load(rollToMinWgME11Files_[3]); + + auto GEM_roll_L1_CSC_max_wg_ME11_even_ = load(rollToMaxWgME11Files_[0]); + auto GEM_roll_L1_CSC_max_wg_ME11_odd_ = load(rollToMaxWgME11Files_[1]); + auto GEM_roll_L2_CSC_max_wg_ME11_even_ = load(rollToMaxWgME11Files_[2]); + auto GEM_roll_L2_CSC_max_wg_ME11_odd_ = load(rollToMaxWgME11Files_[3]); + + auto CSC_slope_cosi_2to1_L1_ME11_even_ = load(gemCscSlopeCosiFiles_[0]); + auto CSC_slope_cosi_2to1_L1_ME11_odd_ = load(gemCscSlopeCosiFiles_[1]); + auto CSC_slope_cosi_3to1_L1_ME11_even_ = load(gemCscSlopeCosiFiles_[2]); + auto CSC_slope_cosi_3to1_L1_ME11_odd_ = load(gemCscSlopeCosiFiles_[3]); + + auto CSC_slope_cosi_corr_L1_ME11_even_ = load(gemCscSlopeCosiCorrectionFiles_[0]); + auto CSC_slope_cosi_corr_L2_ME11_even_ = load(gemCscSlopeCosiCorrectionFiles_[1]); + auto CSC_slope_cosi_corr_L1_ME11_odd_ = load(gemCscSlopeCosiCorrectionFiles_[2]); + auto CSC_slope_cosi_corr_L2_ME11_odd_ = load(gemCscSlopeCosiCorrectionFiles_[3]); + + auto CSC_slope_corr_L1_ME11_even_ = load(gemCscSlopeCorrectionFiles_[0]); + auto CSC_slope_corr_L2_ME11_even_ = load(gemCscSlopeCorrectionFiles_[1]); + auto CSC_slope_corr_L1_ME11_odd_ = load(gemCscSlopeCorrectionFiles_[2]); + auto CSC_slope_corr_L2_ME11_odd_ = load(gemCscSlopeCorrectionFiles_[3]); + + auto es_diff_slope_L1_ME1a_even_ = load(esDiffToSlopeME1aFiles_[0]); + auto es_diff_slope_L1_ME1a_odd_ = load(esDiffToSlopeME1aFiles_[1]); + auto es_diff_slope_L2_ME1a_even_ = load(esDiffToSlopeME1aFiles_[2]); + auto es_diff_slope_L2_ME1a_odd_ = load(esDiffToSlopeME1aFiles_[3]); + + auto es_diff_slope_L1_ME1b_even_ = load(esDiffToSlopeME1bFiles_[0]); + auto es_diff_slope_L1_ME1b_odd_ = load(esDiffToSlopeME1bFiles_[1]); + auto es_diff_slope_L2_ME1b_even_ = load(esDiffToSlopeME1bFiles_[2]); + auto es_diff_slope_L2_ME1b_odd_ = load(esDiffToSlopeME1bFiles_[3]); + + // set the data in the LUT object + lut->set_GEM_pad_CSC_hs_ME1b_even(std::move(GEM_pad_CSC_hs_ME1b_even_)); + lut->set_GEM_pad_CSC_hs_ME1a_even(std::move(GEM_pad_CSC_hs_ME1a_even_)); + lut->set_GEM_pad_CSC_hs_ME1b_odd(std::move(GEM_pad_CSC_hs_ME1b_odd_)); + lut->set_GEM_pad_CSC_hs_ME1a_odd(std::move(GEM_pad_CSC_hs_ME1a_odd_)); + + lut->set_GEM_pad_CSC_es_ME1b_even(std::move(GEM_pad_CSC_es_ME1b_even_)); + lut->set_GEM_pad_CSC_es_ME1a_even(std::move(GEM_pad_CSC_es_ME1a_even_)); + lut->set_GEM_pad_CSC_es_ME1b_odd(std::move(GEM_pad_CSC_es_ME1b_odd_)); + lut->set_GEM_pad_CSC_es_ME1a_odd(std::move(GEM_pad_CSC_es_ME1a_odd_)); + + lut->set_GEM_roll_L1_CSC_min_wg_ME11_even(std::move(GEM_roll_L1_CSC_min_wg_ME11_even_)); + lut->set_GEM_roll_L1_CSC_max_wg_ME11_even(std::move(GEM_roll_L1_CSC_max_wg_ME11_even_)); + lut->set_GEM_roll_L1_CSC_min_wg_ME11_odd(std::move(GEM_roll_L1_CSC_min_wg_ME11_odd_)); + lut->set_GEM_roll_L1_CSC_max_wg_ME11_odd(std::move(GEM_roll_L1_CSC_max_wg_ME11_odd_)); + + lut->set_GEM_roll_L2_CSC_min_wg_ME11_even(std::move(GEM_roll_L2_CSC_min_wg_ME11_even_)); + lut->set_GEM_roll_L2_CSC_max_wg_ME11_even(std::move(GEM_roll_L2_CSC_max_wg_ME11_even_)); + lut->set_GEM_roll_L2_CSC_min_wg_ME11_odd(std::move(GEM_roll_L2_CSC_min_wg_ME11_odd_)); + lut->set_GEM_roll_L2_CSC_max_wg_ME11_odd(std::move(GEM_roll_L2_CSC_max_wg_ME11_odd_)); + + // GEM-CSC trigger: slope correction + lut->set_CSC_slope_cosi_2to1_L1_ME11_even(std::move(CSC_slope_cosi_2to1_L1_ME11_even_)); + lut->set_CSC_slope_cosi_2to1_L1_ME11_odd(std::move(CSC_slope_cosi_2to1_L1_ME11_odd_)); + lut->set_CSC_slope_cosi_3to1_L1_ME11_even(std::move(CSC_slope_cosi_3to1_L1_ME11_even_)); + lut->set_CSC_slope_cosi_3to1_L1_ME11_odd(std::move(CSC_slope_cosi_3to1_L1_ME11_odd_)); + + lut->set_CSC_slope_cosi_corr_L1_ME11_even(std::move(CSC_slope_cosi_corr_L1_ME11_even_)); + lut->set_CSC_slope_cosi_corr_L1_ME11_odd(std::move(CSC_slope_cosi_corr_L1_ME11_odd_)); + lut->set_CSC_slope_cosi_corr_L2_ME11_even(std::move(CSC_slope_cosi_corr_L2_ME11_even_)); + lut->set_CSC_slope_cosi_corr_L2_ME11_odd(std::move(CSC_slope_cosi_corr_L2_ME11_odd_)); + + lut->set_CSC_slope_corr_L1_ME11_even(std::move(CSC_slope_corr_L1_ME11_even_)); + lut->set_CSC_slope_corr_L1_ME11_odd(std::move(CSC_slope_corr_L1_ME11_odd_)); + lut->set_CSC_slope_corr_L2_ME11_even(std::move(CSC_slope_corr_L2_ME11_even_)); + lut->set_CSC_slope_corr_L2_ME11_odd(std::move(CSC_slope_corr_L2_ME11_odd_)); + + // GEM-CSC trigger: 1/8-strip difference to slope + lut->set_es_diff_slope_L1_ME1a_even(std::move(es_diff_slope_L1_ME1a_even_)); + lut->set_es_diff_slope_L2_ME1a_even(std::move(es_diff_slope_L2_ME1a_even_)); + lut->set_es_diff_slope_L1_ME1a_odd(std::move(es_diff_slope_L1_ME1a_odd_)); + lut->set_es_diff_slope_L2_ME1a_odd(std::move(es_diff_slope_L2_ME1a_odd_)); + + lut->set_es_diff_slope_L1_ME1b_even(std::move(es_diff_slope_L1_ME1b_even_)); + lut->set_es_diff_slope_L2_ME1b_even(std::move(es_diff_slope_L2_ME1b_even_)); + lut->set_es_diff_slope_L1_ME1b_odd(std::move(es_diff_slope_L1_ME1b_odd_)); + lut->set_es_diff_slope_L2_ME1b_odd(std::move(es_diff_slope_L2_ME1b_odd_)); + + return lut; +} + +std::unique_ptr CSCL1TPLookupTableEP::produceME21ILT(const CSCL1TPLookupTableME21ILTRcd&) { + // make the LUT object + std::unique_ptr lut = std::make_unique(); + + // get the text files + std::vector padToHsME21Files_ = pset_.getParameter>("padToHsME21Files"); + std::vector padToEsME21Files_ = pset_.getParameter>("padToEsME21Files"); + + std::vector rollToMaxWgME21Files_ = pset_.getParameter>("rollToMaxWgME21Files"); + std::vector rollToMinWgME21Files_ = pset_.getParameter>("rollToMinWgME21Files"); + + std::vector esDiffToSlopeME21Files_ = + pset_.getParameter>("esDiffToSlopeME21Files"); + + // read the text files and extract the data + auto GEM_pad_CSC_hs_ME21_even_ = load(padToHsME21Files_[0]); + auto GEM_pad_CSC_hs_ME21_odd_ = load(padToHsME21Files_[1]); + + auto GEM_pad_CSC_es_ME21_even_ = load(padToEsME21Files_[0]); + auto GEM_pad_CSC_es_ME21_odd_ = load(padToEsME21Files_[1]); + + auto GEM_roll_L1_CSC_min_wg_ME21_even_ = load(rollToMinWgME21Files_[0]); + auto GEM_roll_L1_CSC_min_wg_ME21_odd_ = load(rollToMinWgME21Files_[1]); + auto GEM_roll_L2_CSC_min_wg_ME21_even_ = load(rollToMinWgME21Files_[2]); + auto GEM_roll_L2_CSC_min_wg_ME21_odd_ = load(rollToMinWgME21Files_[3]); + + auto GEM_roll_L1_CSC_max_wg_ME21_even_ = load(rollToMaxWgME21Files_[0]); + auto GEM_roll_L1_CSC_max_wg_ME21_odd_ = load(rollToMaxWgME21Files_[1]); + auto GEM_roll_L2_CSC_max_wg_ME21_even_ = load(rollToMaxWgME21Files_[2]); + auto GEM_roll_L2_CSC_max_wg_ME21_odd_ = load(rollToMaxWgME21Files_[3]); + + auto es_diff_slope_L1_ME21_even_ = load(esDiffToSlopeME21Files_[0]); + auto es_diff_slope_L1_ME21_odd_ = load(esDiffToSlopeME21Files_[1]); + auto es_diff_slope_L2_ME21_even_ = load(esDiffToSlopeME21Files_[2]); + auto es_diff_slope_L2_ME21_odd_ = load(esDiffToSlopeME21Files_[3]); + + // set the data in the LUT object + lut->set_GEM_pad_CSC_hs_ME21_even(std::move(GEM_pad_CSC_hs_ME21_even_)); + lut->set_GEM_pad_CSC_hs_ME21_odd(std::move(GEM_pad_CSC_hs_ME21_odd_)); + + lut->set_GEM_pad_CSC_es_ME21_even(std::move(GEM_pad_CSC_es_ME21_even_)); + lut->set_GEM_pad_CSC_es_ME21_odd(std::move(GEM_pad_CSC_es_ME21_odd_)); + + lut->set_GEM_roll_L1_CSC_min_wg_ME21_even(std::move(GEM_roll_L1_CSC_min_wg_ME21_even_)); + lut->set_GEM_roll_L1_CSC_max_wg_ME21_even(std::move(GEM_roll_L1_CSC_max_wg_ME21_even_)); + lut->set_GEM_roll_L1_CSC_min_wg_ME21_odd(std::move(GEM_roll_L1_CSC_min_wg_ME21_odd_)); + lut->set_GEM_roll_L1_CSC_max_wg_ME21_odd(std::move(GEM_roll_L1_CSC_max_wg_ME21_odd_)); + + lut->set_GEM_roll_L2_CSC_min_wg_ME21_even(std::move(GEM_roll_L2_CSC_min_wg_ME21_even_)); + lut->set_GEM_roll_L2_CSC_max_wg_ME21_even(std::move(GEM_roll_L2_CSC_max_wg_ME21_even_)); + lut->set_GEM_roll_L2_CSC_min_wg_ME21_odd(std::move(GEM_roll_L2_CSC_min_wg_ME21_odd_)); + lut->set_GEM_roll_L2_CSC_max_wg_ME21_odd(std::move(GEM_roll_L2_CSC_max_wg_ME21_odd_)); + + lut->set_es_diff_slope_L1_ME21_even(std::move(es_diff_slope_L1_ME21_even_)); + lut->set_es_diff_slope_L2_ME21_even(std::move(es_diff_slope_L2_ME21_even_)); + lut->set_es_diff_slope_L1_ME21_odd(std::move(es_diff_slope_L1_ME21_odd_)); + lut->set_es_diff_slope_L2_ME21_odd(std::move(es_diff_slope_L2_ME21_odd_)); + + return lut; +} + +std::vector CSCL1TPLookupTableEP::load(std::string fileName) const { + std::vector returnV; + std::ifstream fstream; + fstream.open(edm::FileInPath(fileName.c_str()).fullPath()); + // empty file, return empty lut + if (!fstream.good()) { + fstream.close(); + return returnV; + } + + std::string line; + + while (std::getline(fstream, line)) { + //ignore comments + line.erase(std::find(line.begin(), line.end(), '#'), line.end()); + std::istringstream lineStream(line); + std::pair entry; + while (lineStream >> entry.first >> entry.second) { + returnV.push_back(entry.second); + } + } + return returnV; +} + +DEFINE_FWK_EVENTSETUP_SOURCE(CSCL1TPLookupTableEP); diff --git a/CalibMuon/CSCCalibration/python/CSCL1TPLookupTableEP_cff.py b/CalibMuon/CSCCalibration/python/CSCL1TPLookupTableEP_cff.py new file mode 100644 index 0000000000000..0b9b4625c4072 --- /dev/null +++ b/CalibMuon/CSCCalibration/python/CSCL1TPLookupTableEP_cff.py @@ -0,0 +1,122 @@ +import FWCore.ParameterSet.Config as cms + +CSCL1TPLookupTableEP = cms.ESSource( + "CSCL1TPLookupTableEP", + ## CCLUT + positionLUTFiles = cms.vstring( + "L1Trigger/CSCTriggerPrimitives/data/CCLUT/CSCComparatorCodePosOffsetLUT_pat0_v1.txt", + "L1Trigger/CSCTriggerPrimitives/data/CCLUT/CSCComparatorCodePosOffsetLUT_pat1_v1.txt", + "L1Trigger/CSCTriggerPrimitives/data/CCLUT/CSCComparatorCodePosOffsetLUT_pat2_v1.txt", + "L1Trigger/CSCTriggerPrimitives/data/CCLUT/CSCComparatorCodePosOffsetLUT_pat3_v1.txt", + "L1Trigger/CSCTriggerPrimitives/data/CCLUT/CSCComparatorCodePosOffsetLUT_pat4_v1.txt" + ), + slopeLUTFiles = cms.vstring( + "L1Trigger/CSCTriggerPrimitives/data/CCLUT/CSCComparatorCodeSlopeLUT_pat0_v1.txt", + "L1Trigger/CSCTriggerPrimitives/data/CCLUT/CSCComparatorCodeSlopeLUT_pat1_v1.txt", + "L1Trigger/CSCTriggerPrimitives/data/CCLUT/CSCComparatorCodeSlopeLUT_pat2_v1.txt", + "L1Trigger/CSCTriggerPrimitives/data/CCLUT/CSCComparatorCodeSlopeLUT_pat3_v1.txt", + "L1Trigger/CSCTriggerPrimitives/data/CCLUT/CSCComparatorCodeSlopeLUT_pat4_v1.txt" + ), + ## convert pad number to 1/2-strip in ME1a + padToHsME1aFiles = cms.vstring( + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_pad_hs_ME1a_even.txt", + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_pad_hs_ME1a_odd.txt", + ), + ## convert pad number to 1/2-strip in ME1b + padToHsME1bFiles = cms.vstring( + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_pad_hs_ME1b_even.txt", + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_pad_hs_ME1b_odd.txt", + ), + ## convert pad number to 1/2-strip in ME21 + padToHsME21Files = cms.vstring( + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_pad_hs_ME21_even.txt", + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_pad_hs_ME21_odd.txt", + ), + ## convert pad number to 1/8-strip in ME1a + padToEsME1aFiles = cms.vstring( + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_pad_es_ME1a_even.txt", + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_pad_es_ME1a_odd.txt", + ), + ## convert pad number to 1/8-strip in ME1b + padToEsME1bFiles = cms.vstring( + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_pad_es_ME1b_even.txt", + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_pad_es_ME1b_odd.txt", + ), + ## convert pad number to 1/8-strip in ME21 + padToEsME21Files = cms.vstring( + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_pad_es_ME21_even.txt", + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_pad_es_ME21_odd.txt", + ), + ## convert eta partition to minimum wiregroup in ME11 + rollToMinWgME11Files = cms.vstring( + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_roll_l1_min_wg_ME11_even.txt", + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_roll_l1_min_wg_ME11_odd.txt", + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_roll_l2_min_wg_ME11_even.txt", + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_roll_l2_min_wg_ME11_odd.txt", + ), + ## convert eta partition to maximum wiregroup in ME11 + rollToMaxWgME11Files = cms.vstring( + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_roll_l1_max_wg_ME11_even.txt", + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_roll_l1_max_wg_ME11_odd.txt", + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_roll_l2_max_wg_ME11_even.txt", + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_roll_l2_max_wg_ME11_odd.txt", + ), + ## convert eta partition to minimum wiregroup in ME21 + rollToMinWgME21Files = cms.vstring( + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_roll_l1_min_wg_ME21_even.txt", + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_roll_l1_min_wg_ME21_odd.txt", + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_roll_l2_min_wg_ME21_even.txt", + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_roll_l2_min_wg_ME21_odd.txt", + ), + ## convert eta partition to maximum wiregroup in ME21 + rollToMaxWgME21Files = cms.vstring( + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_roll_l1_max_wg_ME21_even.txt", + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_roll_l1_max_wg_ME21_odd.txt", + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_roll_l2_max_wg_ME21_even.txt", + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_roll_l2_max_wg_ME21_odd.txt", + ), + # lookup tables for the GEM-CSC slope correction + gemCscSlopeCorrectionFiles = cms.vstring( + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/SlopeCorrection/FacingChambers/GEMCSCSlopeCorr_ME11_even_GE11_layer1.txt", + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/SlopeCorrection/FacingChambers/GEMCSCSlopeCorr_ME11_even_GE11_layer2.txt", + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/SlopeCorrection/FacingChambers/GEMCSCSlopeCorr_ME11_odd_GE11_layer1.txt", + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/SlopeCorrection/FacingChambers/GEMCSCSlopeCorr_ME11_odd_GE11_layer2.txt", + ), + # lookup tables for the GEM-CSC slope correction + gemCscSlopeCosiFiles = cms.vstring( + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/SlopeCorrection/FacingChambers/CSCconsistency_2to1_SlopeShift_ME11_even_GE11_layer1.txt", + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/SlopeCorrection/FacingChambers/CSCconsistency_2to1_SlopeShift_ME11_odd_GE11_layer1.txt", + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/SlopeCorrection/FacingChambers/CSCconsistency_3to1_SlopeShift_ME11_even_GE11_layer1.txt", + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/SlopeCorrection/FacingChambers/CSCconsistency_3to1_SlopeShift_ME11_odd_GE11_layer1.txt", + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/SlopeCorrection/FacingChambers/CSCconsistency_2to1_SlopeShift_ME11_even_GE11_layer2.txt", + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/SlopeCorrection/FacingChambers/CSCconsistency_2to1_SlopeShift_ME11_odd_GE11_layer2.txt", + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/SlopeCorrection/FacingChambers/CSCconsistency_3to1_SlopeShift_ME11_even_GE11_layer2.txt", + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/SlopeCorrection/FacingChambers/CSCconsistency_3to1_SlopeShift_ME11_odd_GE11_layer2.txt", + ), + # lookup tables for the GEM-CSC slope correction + gemCscSlopeCosiCorrectionFiles = cms.vstring( + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/SlopeCorrection/FacingChambers/GEMCSCconsistentSlopeCorr_ME11_even_GE11_layer1.txt", + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/SlopeCorrection/FacingChambers/GEMCSCconsistentSlopeCorr_ME11_even_GE11_layer2.txt", + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/SlopeCorrection/FacingChambers/GEMCSCconsistentSlopeCorr_ME11_odd_GE11_layer1.txt", + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/SlopeCorrection/FacingChambers/GEMCSCconsistentSlopeCorr_ME11_odd_GE11_layer2.txt", + ), + # convert differences in 1/8-strip numbers between GEM and CSC to Run-3 slopes + esDiffToSlopeME1aFiles = cms.vstring( + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/BendingAngle/GEMCSCLUT_es_diff_slope_L1_ME1a_even.txt", + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/BendingAngle/GEMCSCLUT_es_diff_slope_L1_ME1a_odd.txt", + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/BendingAngle/GEMCSCLUT_es_diff_slope_L2_ME1a_even.txt", + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/BendingAngle/GEMCSCLUT_es_diff_slope_L2_ME1a_odd.txt", + ), + esDiffToSlopeME1bFiles = cms.vstring( + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/BendingAngle/GEMCSCLUT_es_diff_slope_L1_ME1b_even.txt", + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/BendingAngle/GEMCSCLUT_es_diff_slope_L1_ME1b_odd.txt", + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/BendingAngle/GEMCSCLUT_es_diff_slope_L2_ME1b_even.txt", + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/BendingAngle/GEMCSCLUT_es_diff_slope_L2_ME1b_odd.txt", + ), + esDiffToSlopeME21Files = cms.vstring( + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/BendingAngle/GEMCSCLUT_es_diff_slope_L1_ME21_even.txt", + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/BendingAngle/GEMCSCLUT_es_diff_slope_L1_ME21_odd.txt", + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/BendingAngle/GEMCSCLUT_es_diff_slope_L2_ME21_even.txt", + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/BendingAngle/GEMCSCLUT_es_diff_slope_L2_ME21_odd.txt", + ), + ) diff --git a/CalibMuon/CSCCalibration/test/testNewCalibConstants_global_cfg.py b/CalibMuon/CSCCalibration/test/testNewCalibConstants_global_cfg.py index 131b5c034f37f..0ebe197348b06 100644 --- a/CalibMuon/CSCCalibration/test/testNewCalibConstants_global_cfg.py +++ b/CalibMuon/CSCCalibration/test/testNewCalibConstants_global_cfg.py @@ -3,7 +3,7 @@ process = cms.Process("TEST") # Standard stuff needed for the unpacking and local reco -process.load("Configuration/StandardSequences/Geometry_cff") +process.load("Configuration.StandardSequences.GeometryDB_cff") process.load("Configuration/StandardSequences/MagneticField_cff") process.load("Configuration/StandardSequences/FrontierConditions_GlobalTag_cff") process.load("Configuration/StandardSequences/RawToDigi_Data_cff") diff --git a/CalibMuon/CSCCalibration/test/testNewCalibConstants_sim_cfg.py b/CalibMuon/CSCCalibration/test/testNewCalibConstants_sim_cfg.py index 5890e7fa8b821..bc1f7d57e186d 100644 --- a/CalibMuon/CSCCalibration/test/testNewCalibConstants_sim_cfg.py +++ b/CalibMuon/CSCCalibration/test/testNewCalibConstants_sim_cfg.py @@ -2,7 +2,7 @@ process = cms.Process("TEST") -process.load("Configuration/StandardSequences/Geometry_cff") +process.load("Configuration.StandardSequences.GeometryDB_cff") process.load("Configuration/StandardSequences/MagneticField_cff") process.load("Configuration/StandardSequences/FrontierConditions_GlobalTag_cff") # for Beam diff --git a/CalibMuon/DTCalibration/interface/DTSegmentSelector.h b/CalibMuon/DTCalibration/interface/DTSegmentSelector.h index e9e9a5e93da9a..2dfba3be754d4 100644 --- a/CalibMuon/DTCalibration/interface/DTSegmentSelector.h +++ b/CalibMuon/DTCalibration/interface/DTSegmentSelector.h @@ -14,6 +14,8 @@ #include "FWCore/Utilities/interface/InputTag.h" #include "DataFormats/MuonReco/interface/Muon.h" #include "DataFormats/MuonReco/interface/MuonFwd.h" +#include "CondFormats/DataRecord/interface/DTStatusFlagRcd.h" +#include "CondFormats/DTObjects/interface/DTStatusFlag.h" #include @@ -38,6 +40,7 @@ class DTSegmentSelector { double maxChi2_; double maxAnglePhi_; double maxAngleZ_; + edm::ESGetToken theStatusMapToken_; }; #endif diff --git a/CalibMuon/DTCalibration/interface/DTT0CorrectionFactory.h b/CalibMuon/DTCalibration/interface/DTT0CorrectionFactory.h index 7045c644910c9..b78b4af508fc3 100644 --- a/CalibMuon/DTCalibration/interface/DTT0CorrectionFactory.h +++ b/CalibMuon/DTCalibration/interface/DTT0CorrectionFactory.h @@ -7,13 +7,16 @@ * */ #include "FWCore/PluginManager/interface/PluginFactory.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" namespace edm { class ParameterSet; -} + class ConsumesCollector; +} // namespace edm namespace dtCalibration { class DTT0BaseCorrection; } -typedef edmplugin::PluginFactory DTT0CorrectionFactory; +typedef edmplugin::PluginFactory + DTT0CorrectionFactory; #endif diff --git a/CalibMuon/DTCalibration/interface/DTTTrigCorrectionFactory.h b/CalibMuon/DTCalibration/interface/DTTTrigCorrectionFactory.h index 3afe21e8a5c0f..f6d3af57a74d9 100644 --- a/CalibMuon/DTCalibration/interface/DTTTrigCorrectionFactory.h +++ b/CalibMuon/DTCalibration/interface/DTTTrigCorrectionFactory.h @@ -8,14 +8,17 @@ * \author A. Vilela Pereira */ #include "FWCore/PluginManager/interface/PluginFactory.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" namespace edm { class ParameterSet; -} + class ConsumesCollector; +} // namespace edm namespace dtCalibration { class DTTTrigBaseCorrection; } -typedef edmplugin::PluginFactory +typedef edmplugin::PluginFactory DTTTrigCorrectionFactory; #endif diff --git a/CalibMuon/DTCalibration/interface/DTVDriftPluginFactory.h b/CalibMuon/DTCalibration/interface/DTVDriftPluginFactory.h index 29a238a9f2910..dd5f7155b3f6c 100644 --- a/CalibMuon/DTCalibration/interface/DTVDriftPluginFactory.h +++ b/CalibMuon/DTCalibration/interface/DTVDriftPluginFactory.h @@ -9,13 +9,16 @@ */ #include "FWCore/PluginManager/interface/PluginFactory.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" namespace edm { class ParameterSet; -} + class ConsumesCollector; +} // namespace edm namespace dtCalibration { class DTVDriftBaseAlgo; } -typedef edmplugin::PluginFactory DTVDriftPluginFactory; +typedef edmplugin::PluginFactory + DTVDriftPluginFactory; #endif diff --git a/CalibMuon/DTCalibration/plugins/DTFakeT0ESProducer.cc b/CalibMuon/DTCalibration/plugins/DTFakeT0ESProducer.cc index d74f7da4ec950..59cddf564e779 100644 --- a/CalibMuon/DTCalibration/plugins/DTFakeT0ESProducer.cc +++ b/CalibMuon/DTCalibration/plugins/DTFakeT0ESProducer.cc @@ -27,13 +27,15 @@ using namespace std; DTFakeT0ESProducer::DTFakeT0ESProducer(const edm::ParameterSet& pset) { //framework - setWhatProduced(this, &DTFakeT0ESProducer::produce); + auto cc = setWhatProduced(this, &DTFakeT0ESProducer::produce); // setWhatProduced(this,dependsOn(& DTGeometryESModule::parseDDD())); findingRecord(); //read constant value for t0 from cfg t0Mean = pset.getParameter("t0Mean"); t0Sigma = pset.getParameter("t0Sigma"); + cpvTokenDDD_ = cc.consumesFrom(edm::ESInputTag()); + mdcToken_ = cc.consumes(); } DTFakeT0ESProducer::~DTFakeT0ESProducer() {} @@ -59,13 +61,10 @@ std::unique_ptr DTFakeT0ESProducer::produce(const DTT0Rcd& iRecord) { } void DTFakeT0ESProducer::parseDDD(const DTT0Rcd& iRecord) { - edm::ESTransientHandle cpv; - edm::ESHandle mdc; + edm::ESTransientHandle cpv = iRecord.getTransientHandle(cpvTokenDDD_); + const auto& mdc = iRecord.get(mdcToken_); - iRecord.getRecord().get(cpv); - iRecord.getRecord().get(mdc); - - DTGeometryParserFromDDD parser(&(*cpv), *mdc, theLayerIdWiresMap); + DTGeometryParserFromDDD parser(&(*cpv), mdc, theLayerIdWiresMap); } void DTFakeT0ESProducer::setIntervalFor(const edm::eventsetup::EventSetupRecordKey&, diff --git a/CalibMuon/DTCalibration/plugins/DTFakeT0ESProducer.h b/CalibMuon/DTCalibration/plugins/DTFakeT0ESProducer.h index 7b69578bc49e6..3ca80375ce1e7 100644 --- a/CalibMuon/DTCalibration/plugins/DTFakeT0ESProducer.h +++ b/CalibMuon/DTCalibration/plugins/DTFakeT0ESProducer.h @@ -21,6 +21,12 @@ #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" + +#include "DetectorDescription/Core/interface/DDCompactView.h" +#include "DetectorDescription/DDCMS/interface/DDCompactView.h" +#include "Geometry/Records/interface/IdealGeometryRecord.h" +#include "Geometry/MuonNumbering/interface/MuonGeometryConstants.h" + //#include #include @@ -48,5 +54,8 @@ class DTFakeT0ESProducer : public edm::ESProducer, public edm::EventSetupRecordI //t0 mean and sigma values read from cfg double t0Mean; double t0Sigma; + + edm::ESGetToken cpvTokenDDD_; + edm::ESGetToken mdcToken_; }; #endif diff --git a/CalibMuon/DTCalibration/plugins/DTNoiseCalibration.cc b/CalibMuon/DTCalibration/plugins/DTNoiseCalibration.cc index 5aca6ce1837fb..d725e6a2526da 100644 --- a/CalibMuon/DTCalibration/plugins/DTNoiseCalibration.cc +++ b/CalibMuon/DTCalibration/plugins/DTNoiseCalibration.cc @@ -48,10 +48,12 @@ DTNoiseCalibration::DTNoiseCalibration(const edm::ParameterSet& pset) useAbsoluteRate_(pset.getParameter("useAbsoluteRate")), readDB_(true), defaultTtrig_(0), - dbLabel_(pset.getUntrackedParameter("dbLabel", "")), //fastAnalysis_( pset.getParameter("fastAnalysis", true) ), wireIdWithHisto_(std::vector()), - lumiMax_(3000) { + lumiMax_(3000), + dtGeomToken_(esConsumes()), + ttrigToken_( + esConsumes(edm::ESInputTag("", pset.getUntrackedParameter("dbLabel")))) { // Get the debug parameter for verbose output //debug = ps.getUntrackedParameter("debug"); /*// The analysis type @@ -96,12 +98,10 @@ void DTNoiseCalibration::beginJob() { void DTNoiseCalibration::beginRun(const edm::Run& run, const edm::EventSetup& setup) { // Get the DT Geometry - setup.get().get(dtGeom_); - + dtGeom_ = setup.getHandle(dtGeomToken_); // tTrig if (readDB_) - setup.get().get(dbLabel_, tTrigMap_); - + tTrigMap_ = &setup.getData(ttrigToken_); runBeginTime_ = time_t(run.beginTime().value() >> 32); runEndTime_ = time_t(run.endTime().value() >> 32); /* diff --git a/CalibMuon/DTCalibration/plugins/DTNoiseCalibration.h b/CalibMuon/DTCalibration/plugins/DTNoiseCalibration.h index ef846f0c6c23c..5cb49f566ddd1 100644 --- a/CalibMuon/DTCalibration/plugins/DTNoiseCalibration.h +++ b/CalibMuon/DTCalibration/plugins/DTNoiseCalibration.h @@ -12,6 +12,8 @@ #include "FWCore/Framework/interface/EDAnalyzer.h" #include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Utilities/interface/InputTag.h" +#include "Geometry/Records/interface/MuonGeometryRecord.h" +#include "CondFormats/DataRecord/interface/DTTtrigRcd.h" #include #include @@ -62,7 +64,6 @@ class DTNoiseCalibration : public edm::EDAnalyzer { bool readDB_; int defaultTtrig_; - std::string dbLabel_; std::vector wireIdWithHisto_; unsigned int lumiMax_; @@ -74,8 +75,11 @@ class DTNoiseCalibration : public edm::EDAnalyzer { // Get the DT Geometry edm::ESHandle dtGeom_; + const edm::ESGetToken dtGeomToken_; + // tTrig map edm::ESHandle tTrigMap_; + const edm::ESGetToken ttrigToken_; TFile* rootFile_; // TDC digi distribution diff --git a/CalibMuon/DTCalibration/plugins/DTNoiseComputation.cc b/CalibMuon/DTCalibration/plugins/DTNoiseComputation.cc index b41cf3e8d59bc..e9be264db4b63 100644 --- a/CalibMuon/DTCalibration/plugins/DTNoiseComputation.cc +++ b/CalibMuon/DTCalibration/plugins/DTNoiseComputation.cc @@ -38,7 +38,7 @@ using namespace edm; using namespace std; -DTNoiseComputation::DTNoiseComputation(const edm::ParameterSet &ps) { +DTNoiseComputation::DTNoiseComputation(const edm::ParameterSet &ps) : dtGeomToken_(esConsumes()) { cout << "[DTNoiseComputation]: Constructor" << endl; // Get the debug parameter for verbose output @@ -61,7 +61,7 @@ DTNoiseComputation::DTNoiseComputation(const edm::ParameterSet &ps) { void DTNoiseComputation::beginRun(const edm::Run &, const EventSetup &setup) { // Get the DT Geometry - setup.get().get(dtGeom); + dtGeom = setup.getHandle(dtGeomToken_); static int count = 0; diff --git a/CalibMuon/DTCalibration/plugins/DTNoiseComputation.h b/CalibMuon/DTCalibration/plugins/DTNoiseComputation.h index 1e74be9b61297..de24a0853f9aa 100644 --- a/CalibMuon/DTCalibration/plugins/DTNoiseComputation.h +++ b/CalibMuon/DTCalibration/plugins/DTNoiseComputation.h @@ -14,6 +14,7 @@ #include "DataFormats/MuonDetId/interface/DTWireId.h" #include "DataFormats/MuonDetId/interface/DTChamberId.h" #include "FWCore/Framework/interface/ESHandle.h" +#include "Geometry/Records/interface/MuonGeometryRecord.h" #include #include @@ -57,6 +58,7 @@ class DTNoiseComputation : public edm::EDAnalyzer { // Get the DT Geometry edm::ESHandle dtGeom; + const edm::ESGetToken dtGeomToken_; // The file which contain the occupancy plot and the digi event plot TFile* theFile; diff --git a/CalibMuon/DTCalibration/plugins/DTResidualCalibration.cc b/CalibMuon/DTCalibration/plugins/DTResidualCalibration.cc index af764e74b77ae..768f461701a85 100644 --- a/CalibMuon/DTCalibration/plugins/DTResidualCalibration.cc +++ b/CalibMuon/DTCalibration/plugins/DTResidualCalibration.cc @@ -35,7 +35,8 @@ DTResidualCalibration::DTResidualCalibration(const edm::ParameterSet& pset) : histRange_(pset.getParameter("histogramRange")), segment4DLabel_(pset.getParameter("segment4DLabel")), rootBaseDir_(pset.getUntrackedParameter("rootBaseDir", "DT/Residuals")), - detailedAnalysis_(pset.getUntrackedParameter("detailedAnalysis", false)) { + detailedAnalysis_(pset.getUntrackedParameter("detailedAnalysis", false)), + dtGeomToken_(esConsumes()) { edm::ConsumesCollector collector(consumesCollector()); select_ = new DTSegmentSelector(pset, collector); @@ -63,7 +64,7 @@ void DTResidualCalibration::beginJob() { TH1::SetDefaultSumw2(true); } void DTResidualCalibration::beginRun(const edm::Run& run, const edm::EventSetup& setup) { // get the geometry edm::ESHandle dtGeomH; - setup.get().get(dtGeomH); + dtGeomH = setup.getHandle(dtGeomToken_); dtGeom_ = dtGeomH.product(); // Loop over all the chambers diff --git a/CalibMuon/DTCalibration/plugins/DTResidualCalibration.h b/CalibMuon/DTCalibration/plugins/DTResidualCalibration.h index 1b6c5f328d0cd..cce4721877c0a 100644 --- a/CalibMuon/DTCalibration/plugins/DTResidualCalibration.h +++ b/CalibMuon/DTCalibration/plugins/DTResidualCalibration.h @@ -13,6 +13,7 @@ #include "FWCore/Framework/interface/ESHandle.h" #include "CalibMuon/DTCalibration/interface/DTSegmentSelector.h" +#include "Geometry/Records/interface/MuonGeometryRecord.h" #include #include @@ -59,6 +60,8 @@ class DTResidualCalibration : public edm::EDAnalyzer { TFile* rootFile_; // Geometry const DTGeometry* dtGeom_; + const edm::ESGetToken dtGeomToken_; + // Histograms per super-layer std::map histoMapTH1F_; std::map histoMapTH2F_; diff --git a/CalibMuon/DTCalibration/plugins/DTT0AbsoluteReferenceCorrection.cc b/CalibMuon/DTCalibration/plugins/DTT0AbsoluteReferenceCorrection.cc index bff27dd1aa3ab..252b7f9fb964a 100644 --- a/CalibMuon/DTCalibration/plugins/DTT0AbsoluteReferenceCorrection.cc +++ b/CalibMuon/DTCalibration/plugins/DTT0AbsoluteReferenceCorrection.cc @@ -24,8 +24,10 @@ using namespace edm; namespace dtCalibration { - DTT0AbsoluteReferenceCorrection::DTT0AbsoluteReferenceCorrection(const ParameterSet& pset) - : calibChamber_(pset.getParameter("calibChamber")), reference_(pset.getParameter("reference")) { + DTT0AbsoluteReferenceCorrection::DTT0AbsoluteReferenceCorrection(const ParameterSet& pset, edm::ConsumesCollector cc) + : calibChamber_(pset.getParameter("calibChamber")), + reference_(pset.getParameter("reference")), + t0Token_(cc.esConsumes()) { //DTChamberId chosenChamberId; if (!calibChamber_.empty() && calibChamber_ != "None" && calibChamber_ != "All") { stringstream linestr; @@ -43,7 +45,7 @@ namespace dtCalibration { void DTT0AbsoluteReferenceCorrection::setES(const EventSetup& setup) { // Get t0 record from DB ESHandle t0H; - setup.get().get(t0H); + t0H = setup.getHandle(t0Token_); t0Map_ = &*t0H; LogVerbatim("Calibration") << "[DTT0AbsoluteReferenceCorrection] T0 version: " << t0H->version(); } diff --git a/CalibMuon/DTCalibration/plugins/DTT0AbsoluteReferenceCorrection.h b/CalibMuon/DTCalibration/plugins/DTT0AbsoluteReferenceCorrection.h index 88ebad24bba25..481e1fde64bb8 100644 --- a/CalibMuon/DTCalibration/plugins/DTT0AbsoluteReferenceCorrection.h +++ b/CalibMuon/DTCalibration/plugins/DTT0AbsoluteReferenceCorrection.h @@ -11,7 +11,10 @@ #include "CalibMuon/DTCalibration/interface/DTT0BaseCorrection.h" #include "DataFormats/MuonDetId/interface/DTChamberId.h" - +#include "FWCore/Framework/interface/ConsumesCollector.h" +#include "FWCore/Utilities/interface/ESGetToken.h" +#include "CondFormats/DataRecord/interface/DTT0Rcd.h" +#include "CondFormats/DTObjects/interface/DTT0.h" #include namespace edm { @@ -25,7 +28,7 @@ namespace dtCalibration { class DTT0AbsoluteReferenceCorrection : public DTT0BaseCorrection { public: // Constructor - DTT0AbsoluteReferenceCorrection(const edm::ParameterSet&); + DTT0AbsoluteReferenceCorrection(const edm::ParameterSet&, edm::ConsumesCollector); // Destructor ~DTT0AbsoluteReferenceCorrection() override; @@ -41,6 +44,7 @@ namespace dtCalibration { DTChamberId chosenChamberId_; const DTT0* t0Map_; + edm::ESGetToken t0Token_; }; } // namespace dtCalibration diff --git a/CalibMuon/DTCalibration/plugins/DTT0Calibration.cc b/CalibMuon/DTCalibration/plugins/DTT0Calibration.cc index 4ac67cd7cbbce..ee9d5055e90b9 100644 --- a/CalibMuon/DTCalibration/plugins/DTT0Calibration.cc +++ b/CalibMuon/DTCalibration/plugins/DTT0Calibration.cc @@ -42,9 +42,8 @@ DTT0Calibration::DTT0Calibration(const edm::ParameterSet& pset) tpPeakWidthPerLayer(pset.getParameter("tpPeakWidthPerLayer")), rejectDigiFromPeak(pset.getParameter("rejectDigiFromPeak")), hLayerPeaks("hLayerPeaks", "", 3000, 0, 3000), - spectrum(20) - -{ + spectrum(20), + dtGeomToken_(esConsumes()) { // Get the debug parameter for verbose output if (debug) cout << "[DTT0Calibration]Constructor called!" << endl; @@ -99,7 +98,7 @@ void DTT0Calibration::analyze(const edm::Event& event, const edm::EventSetup& ev // Get the DT Geometry if (nevents == 1) - eventSetup.get().get(dtGeom); + dtGeom = eventSetup.getHandle(dtGeomToken_); // Iterate through all digi collections ordered by LayerId for (const auto& digis_per_layer : *digis) { diff --git a/CalibMuon/DTCalibration/plugins/DTT0Calibration.h b/CalibMuon/DTCalibration/plugins/DTT0Calibration.h index a0d0ac56f994d..459cafe9908b0 100644 --- a/CalibMuon/DTCalibration/plugins/DTT0Calibration.h +++ b/CalibMuon/DTCalibration/plugins/DTT0Calibration.h @@ -17,6 +17,7 @@ #include "DataFormats/MuonDetId/interface/DTWireId.h" #include "DataFormats/DTDigi/interface/DTDigiCollection.h" #include "FWCore/Framework/interface/ESHandle.h" +#include "Geometry/Records/interface/MuonGeometryRecord.h" #include #include @@ -122,5 +123,6 @@ class DTT0Calibration : public edm::one::EDAnalyzer<> { //DTGeometry used to loop on the SL in the endJob edm::ESHandle dtGeom; + const edm::ESGetToken dtGeomToken_; }; #endif diff --git a/CalibMuon/DTCalibration/plugins/DTT0CalibrationRMS.cc b/CalibMuon/DTCalibration/plugins/DTT0CalibrationRMS.cc index 9e82947100e13..395e74d8197f1 100644 --- a/CalibMuon/DTCalibration/plugins/DTT0CalibrationRMS.cc +++ b/CalibMuon/DTCalibration/plugins/DTT0CalibrationRMS.cc @@ -24,7 +24,7 @@ using namespace edm; // using namespace cond; // Constructor -DTT0CalibrationRMS::DTT0CalibrationRMS(const edm::ParameterSet& pset) { +DTT0CalibrationRMS::DTT0CalibrationRMS(const edm::ParameterSet& pset) : dtGeomToken_(esConsumes()) { // Get the debug parameter for verbose output debug = pset.getUntrackedParameter("debug"); if (debug) @@ -102,7 +102,7 @@ void DTT0CalibrationRMS::analyze(const edm::Event& event, const edm::EventSetup& event.getByLabel(digiLabel, digis); // Get the DT Geometry - eventSetup.get().get(dtGeom); + dtGeom = eventSetup.getHandle(dtGeomToken_); // Iterate through all digi collections ordered by LayerId DTDigiCollection::DigiRangeIterator dtLayerIt; diff --git a/CalibMuon/DTCalibration/plugins/DTT0CalibrationRMS.h b/CalibMuon/DTCalibration/plugins/DTT0CalibrationRMS.h index f0145820c40c9..ee97801d2774d 100644 --- a/CalibMuon/DTCalibration/plugins/DTT0CalibrationRMS.h +++ b/CalibMuon/DTCalibration/plugins/DTT0CalibrationRMS.h @@ -13,6 +13,7 @@ #include "Geometry/DTGeometry/interface/DTGeometry.h" #include "DataFormats/MuonDetId/interface/DTWireId.h" #include "FWCore/Framework/interface/ESHandle.h" +#include "Geometry/Records/interface/MuonGeometryRecord.h" #include #include @@ -105,5 +106,6 @@ class DTT0CalibrationRMS : public edm::EDAnalyzer { //DTGeometry used to loop on the SL in the endJob edm::ESHandle dtGeom; + const edm::ESGetToken dtGeomToken_; }; #endif diff --git a/CalibMuon/DTCalibration/plugins/DTT0ChamberReferenceCorrection.cc b/CalibMuon/DTCalibration/plugins/DTT0ChamberReferenceCorrection.cc index f5455d038d8e4..bc164699a37dd 100644 --- a/CalibMuon/DTCalibration/plugins/DTT0ChamberReferenceCorrection.cc +++ b/CalibMuon/DTCalibration/plugins/DTT0ChamberReferenceCorrection.cc @@ -8,6 +8,7 @@ #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" #include "DataFormats/MuonDetId/interface/DTWireId.h" #include "CondFormats/DTObjects/interface/DTT0.h" @@ -21,8 +22,8 @@ using namespace edm; namespace dtCalibration { - DTT0ChamberReferenceCorrection::DTT0ChamberReferenceCorrection(const ParameterSet& pset) - : calibChamber_(pset.getParameter("calibChamber")) { + DTT0ChamberReferenceCorrection::DTT0ChamberReferenceCorrection(const ParameterSet& pset, edm::ConsumesCollector cc) + : calibChamber_(pset.getParameter("calibChamber")), t0Token_(cc.esConsumes()) { //DTChamberId chosenChamberId; if (!calibChamber_.empty() && calibChamber_ != "None" && calibChamber_ != "All") { stringstream linestr; @@ -40,8 +41,8 @@ namespace dtCalibration { void DTT0ChamberReferenceCorrection::setES(const EventSetup& setup) { // Get t0 record from DB ESHandle t0H; - setup.get().get(t0H); - t0Map_ = &*t0H; + t0H = setup.getHandle(t0Token_); + t0Map_ = &setup.getData(t0Token_); LogVerbatim("Calibration") << "[DTT0ChamberReferenceCorrection] T0 version: " << t0H->version(); } diff --git a/CalibMuon/DTCalibration/plugins/DTT0ChamberReferenceCorrection.h b/CalibMuon/DTCalibration/plugins/DTT0ChamberReferenceCorrection.h index 3fa4e5bb715c5..723a3b4d9ad20 100644 --- a/CalibMuon/DTCalibration/plugins/DTT0ChamberReferenceCorrection.h +++ b/CalibMuon/DTCalibration/plugins/DTT0ChamberReferenceCorrection.h @@ -11,6 +11,10 @@ #include "CalibMuon/DTCalibration/interface/DTT0BaseCorrection.h" #include "DataFormats/MuonDetId/interface/DTChamberId.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" +#include "FWCore/Utilities/interface/ESGetToken.h" +#include "CondFormats/DataRecord/interface/DTT0Rcd.h" +#include "CondFormats/DTObjects/interface/DTT0.h" #include @@ -25,7 +29,7 @@ namespace dtCalibration { class DTT0ChamberReferenceCorrection : public DTT0BaseCorrection { public: // Constructor - DTT0ChamberReferenceCorrection(const edm::ParameterSet&); + DTT0ChamberReferenceCorrection(const edm::ParameterSet&, edm::ConsumesCollector); // Destructor ~DTT0ChamberReferenceCorrection() override; @@ -40,6 +44,7 @@ namespace dtCalibration { DTChamberId chosenChamberId_; const DTT0* t0Map_; + edm::ESGetToken t0Token_; }; } // namespace dtCalibration diff --git a/CalibMuon/DTCalibration/plugins/DTT0Correction.cc b/CalibMuon/DTCalibration/plugins/DTT0Correction.cc index dcbda683426ef..48d48d46bde1a 100644 --- a/CalibMuon/DTCalibration/plugins/DTT0Correction.cc +++ b/CalibMuon/DTCalibration/plugins/DTT0Correction.cc @@ -20,6 +20,7 @@ #include "CalibMuon/DTCalibration/interface/DTT0CorrectionFactory.h" #include "CalibMuon/DTCalibration/interface/DTT0BaseCorrection.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" #include #include @@ -29,7 +30,10 @@ using namespace std; DTT0Correction::DTT0Correction(const ParameterSet& pset) : correctionAlgo_{DTT0CorrectionFactory::get()->create(pset.getParameter("correctionAlgo"), - pset.getParameter("correctionAlgoConfig"))} { + pset.getParameter("correctionAlgoConfig"), + consumesCollector())}, + dtGeomToken_(esConsumes()), + t0Token_(esConsumes()) { LogVerbatim("Calibration") << "[DTT0Correction] Constructor called" << endl; } @@ -38,12 +42,12 @@ DTT0Correction::~DTT0Correction() { LogVerbatim("Calibration") << "[DTT0Correcti void DTT0Correction::beginRun(const edm::Run& run, const edm::EventSetup& setup) { // Get t0 record from DB ESHandle t0H; - setup.get().get(t0H); - t0Map_ = &*t0H; + t0H = setup.getHandle(t0Token_); + t0Map_ = &setup.getData(t0Token_); LogVerbatim("Calibration") << "[DTT0Correction]: T0 version: " << t0H->version() << endl; // Get geometry from Event Setup - setup.get().get(muonGeom_); + muonGeom_ = setup.getHandle(dtGeomToken_); // Pass EventSetup to correction Algo correctionAlgo_->setES(setup); diff --git a/CalibMuon/DTCalibration/plugins/DTT0Correction.h b/CalibMuon/DTCalibration/plugins/DTT0Correction.h index 703243093bffd..dda53305e403d 100644 --- a/CalibMuon/DTCalibration/plugins/DTT0Correction.h +++ b/CalibMuon/DTCalibration/plugins/DTT0Correction.h @@ -8,6 +8,9 @@ #include "FWCore/Framework/interface/Frameworkfwd.h" #include "FWCore/Framework/interface/EDAnalyzer.h" #include "FWCore/Framework/interface/ESHandle.h" +#include "Geometry/Records/interface/MuonGeometryRecord.h" +#include "CondFormats/DTObjects/interface/DTT0.h" +#include "CondFormats/DataRecord/interface/DTT0Rcd.h" #include @@ -34,9 +37,12 @@ class DTT0Correction : public edm::EDAnalyzer { protected: private: - const DTT0* t0Map_; + std::unique_ptr correctionAlgo_; + edm::ESHandle muonGeom_; + const edm::ESGetToken dtGeomToken_; - std::unique_ptr correctionAlgo_; + const DTT0* t0Map_; + edm::ESGetToken t0Token_; }; #endif diff --git a/CalibMuon/DTCalibration/plugins/DTT0FEBPathCorrection.cc b/CalibMuon/DTCalibration/plugins/DTT0FEBPathCorrection.cc index 7eea1c9701777..a6c21c66c7f68 100644 --- a/CalibMuon/DTCalibration/plugins/DTT0FEBPathCorrection.cc +++ b/CalibMuon/DTCalibration/plugins/DTT0FEBPathCorrection.cc @@ -15,6 +15,7 @@ #include "DataFormats/MuonDetId/interface/DTWireId.h" #include "CondFormats/DTObjects/interface/DTT0.h" #include "CondFormats/DataRecord/interface/DTT0Rcd.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" #include #include @@ -24,8 +25,8 @@ using namespace edm; namespace dtCalibration { - DTT0FEBPathCorrection::DTT0FEBPathCorrection(const ParameterSet& pset) - : calibChamber_(pset.getParameter("calibChamber")) { + DTT0FEBPathCorrection::DTT0FEBPathCorrection(const ParameterSet& pset, edm::ConsumesCollector cc) + : calibChamber_(pset.getParameter("calibChamber")), t0Token_(cc.esConsumes()) { //DTChamberId chosenChamberId; if (!calibChamber_.empty() && calibChamber_ != "None" && calibChamber_ != "All") { stringstream linestr; @@ -43,8 +44,8 @@ namespace dtCalibration { void DTT0FEBPathCorrection::setES(const EventSetup& setup) { // Get t0 record from DB ESHandle t0H; - setup.get().get(t0H); - t0Map_ = &*t0H; + t0H = setup.getHandle(t0Token_); + t0Map_ = &setup.getData(t0Token_); LogVerbatim("Calibration") << "[DTT0FEBPathCorrection] T0 version: " << t0H->version(); } diff --git a/CalibMuon/DTCalibration/plugins/DTT0FEBPathCorrection.h b/CalibMuon/DTCalibration/plugins/DTT0FEBPathCorrection.h index 39c1234766657..8a3204a61b1ae 100644 --- a/CalibMuon/DTCalibration/plugins/DTT0FEBPathCorrection.h +++ b/CalibMuon/DTCalibration/plugins/DTT0FEBPathCorrection.h @@ -11,6 +11,10 @@ #include "CalibMuon/DTCalibration/interface/DTT0BaseCorrection.h" #include "DataFormats/MuonDetId/interface/DTChamberId.h" +#include "FWCore/Utilities/interface/ESGetToken.h" +#include "CondFormats/DataRecord/interface/DTT0Rcd.h" +#include "CondFormats/DTObjects/interface/DTT0.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" #include @@ -25,7 +29,7 @@ namespace dtCalibration { class DTT0FEBPathCorrection : public DTT0BaseCorrection { public: // Constructor - DTT0FEBPathCorrection(const edm::ParameterSet&); + DTT0FEBPathCorrection(const edm::ParameterSet&, edm::ConsumesCollector); // Destructor ~DTT0FEBPathCorrection() override; @@ -42,6 +46,7 @@ namespace dtCalibration { DTChamberId chosenChamberId_; const DTT0* t0Map_; + edm::ESGetToken t0Token_; }; } // namespace dtCalibration diff --git a/CalibMuon/DTCalibration/plugins/DTT0FillChamberFromDB.cc b/CalibMuon/DTCalibration/plugins/DTT0FillChamberFromDB.cc index ed23b73c9c4ac..002b079303168 100644 --- a/CalibMuon/DTCalibration/plugins/DTT0FillChamberFromDB.cc +++ b/CalibMuon/DTCalibration/plugins/DTT0FillChamberFromDB.cc @@ -24,8 +24,11 @@ using namespace edm; namespace dtCalibration { - DTT0FillChamberFromDB::DTT0FillChamberFromDB(const ParameterSet& pset) - : dbLabelRef_(pset.getParameter("dbLabelRef")), chamberRef_(pset.getParameter("chamberId")) { + DTT0FillChamberFromDB::DTT0FillChamberFromDB(const ParameterSet& pset, edm::ConsumesCollector cc) + : chamberRef_(pset.getParameter("chamberId")), + t0Token_(cc.esConsumes()), + t0RefToken_( + cc.esConsumes(edm::ESInputTag("", pset.getParameter("dbLabelRef")))) { //DTChamberId chosenChamberId; if (!chamberRef_.empty() && chamberRef_ != "None") { stringstream linestr; @@ -42,14 +45,12 @@ namespace dtCalibration { void DTT0FillChamberFromDB::setES(const EventSetup& setup) { // Get t0 record from DB - ESHandle t0H; - setup.get().get(t0H); + ESHandle t0H = setup.getHandle(t0Token_); t0Map_ = &*t0H; LogVerbatim("Calibration") << "[DTT0FillChamberFromDB] T0 version: " << t0H->version(); // Get reference t0 DB - ESHandle t0RefH; - setup.get().get(dbLabelRef_, t0RefH); + ESHandle t0RefH = setup.getHandle(t0RefToken_); t0MapRef_ = &*t0RefH; LogVerbatim("Calibration") << "[DTT0FillChamberFromDB] Reference T0 version: " << t0RefH->version(); } diff --git a/CalibMuon/DTCalibration/plugins/DTT0FillChamberFromDB.h b/CalibMuon/DTCalibration/plugins/DTT0FillChamberFromDB.h index e213816cb991a..dd08787246630 100644 --- a/CalibMuon/DTCalibration/plugins/DTT0FillChamberFromDB.h +++ b/CalibMuon/DTCalibration/plugins/DTT0FillChamberFromDB.h @@ -11,6 +11,9 @@ #include "CalibMuon/DTCalibration/interface/DTT0BaseCorrection.h" #include "DataFormats/MuonDetId/interface/DTChamberId.h" +#include "CondFormats/DataRecord/interface/DTT0Rcd.h" +#include "CondFormats/DTObjects/interface/DTT0.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" #include @@ -25,7 +28,7 @@ namespace dtCalibration { class DTT0FillChamberFromDB : public DTT0BaseCorrection { public: // Constructor - DTT0FillChamberFromDB(const edm::ParameterSet &); + DTT0FillChamberFromDB(const edm::ParameterSet &, edm::ConsumesCollector cc); // Destructor ~DTT0FillChamberFromDB() override; @@ -34,13 +37,14 @@ namespace dtCalibration { DTT0Data correction(const DTWireId &) override; private: - std::string dbLabelRef_; std::string chamberRef_; DTChamberId chosenChamberId_; const DTT0 *t0MapRef_; const DTT0 *t0Map_; + edm::ESGetToken t0Token_; + edm::ESGetToken t0RefToken_; }; } // namespace dtCalibration diff --git a/CalibMuon/DTCalibration/plugins/DTT0FillDefaultFromDB.cc b/CalibMuon/DTCalibration/plugins/DTT0FillDefaultFromDB.cc index a244cc86a7eec..d35469099797d 100644 --- a/CalibMuon/DTCalibration/plugins/DTT0FillDefaultFromDB.cc +++ b/CalibMuon/DTCalibration/plugins/DTT0FillDefaultFromDB.cc @@ -19,21 +19,21 @@ using namespace edm; namespace dtCalibration { - DTT0FillDefaultFromDB::DTT0FillDefaultFromDB(const ParameterSet& pset) - : dbLabelRef_(pset.getParameter("dbLabelRef")) {} + DTT0FillDefaultFromDB::DTT0FillDefaultFromDB(const ParameterSet& pset, edm::ConsumesCollector cc) + : t0Token_(cc.esConsumes()), + t0RefToken_( + cc.esConsumes(edm::ESInputTag("", pset.getParameter("dbLabelRef")))) {} DTT0FillDefaultFromDB::~DTT0FillDefaultFromDB() {} void DTT0FillDefaultFromDB::setES(const EventSetup& setup) { // Get t0 record from DB - ESHandle t0H; - setup.get().get(t0H); + ESHandle t0H = setup.getHandle(t0Token_); t0Map_ = &*t0H; LogVerbatim("Calibration") << "[DTT0FillDefaultFromDB] T0 version: " << t0H->version(); // Get reference t0 DB - ESHandle t0RefH; - setup.get().get(dbLabelRef_, t0RefH); + ESHandle t0RefH = setup.getHandle(t0RefToken_); t0MapRef_ = &*t0RefH; LogVerbatim("Calibration") << "[DTT0FillDefaultFromDB] Reference T0 version: " << t0RefH->version(); } diff --git a/CalibMuon/DTCalibration/plugins/DTT0FillDefaultFromDB.h b/CalibMuon/DTCalibration/plugins/DTT0FillDefaultFromDB.h index 46410d03497e2..2e75a34cc71a6 100644 --- a/CalibMuon/DTCalibration/plugins/DTT0FillDefaultFromDB.h +++ b/CalibMuon/DTCalibration/plugins/DTT0FillDefaultFromDB.h @@ -10,6 +10,10 @@ */ #include "CalibMuon/DTCalibration/interface/DTT0BaseCorrection.h" +#include "DataFormats/MuonDetId/interface/DTChamberId.h" +#include "CondFormats/DataRecord/interface/DTT0Rcd.h" +#include "CondFormats/DTObjects/interface/DTT0.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" #include @@ -24,7 +28,7 @@ namespace dtCalibration { class DTT0FillDefaultFromDB : public DTT0BaseCorrection { public: // Constructor - DTT0FillDefaultFromDB(const edm::ParameterSet &); + DTT0FillDefaultFromDB(const edm::ParameterSet &, edm::ConsumesCollector cc); // Destructor ~DTT0FillDefaultFromDB() override; @@ -33,10 +37,11 @@ namespace dtCalibration { DTT0Data correction(const DTWireId &) override; private: - std::string dbLabelRef_; - const DTT0 *t0MapRef_; const DTT0 *t0Map_; + + edm::ESGetToken t0Token_; + edm::ESGetToken t0RefToken_; }; } // namespace dtCalibration diff --git a/CalibMuon/DTCalibration/plugins/DTT0WireInChamberReferenceCorrection.cc b/CalibMuon/DTCalibration/plugins/DTT0WireInChamberReferenceCorrection.cc index a54ee88af8ce0..3445680fe7baa 100644 --- a/CalibMuon/DTCalibration/plugins/DTT0WireInChamberReferenceCorrection.cc +++ b/CalibMuon/DTCalibration/plugins/DTT0WireInChamberReferenceCorrection.cc @@ -16,6 +16,7 @@ #include "DataFormats/MuonDetId/interface/DTWireId.h" #include "CondFormats/DTObjects/interface/DTT0.h" #include "CondFormats/DataRecord/interface/DTT0Rcd.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" #include #include @@ -25,8 +26,11 @@ using namespace edm; namespace dtCalibration { - DTT0WireInChamberReferenceCorrection::DTT0WireInChamberReferenceCorrection(const ParameterSet& pset) - : calibChamber_(pset.getParameter("calibChamber")) { + DTT0WireInChamberReferenceCorrection::DTT0WireInChamberReferenceCorrection(const ParameterSet& pset, + edm::ConsumesCollector cc) + : calibChamber_(pset.getParameter("calibChamber")), + t0Token_(cc.esConsumes()), + dtGeomToken_(cc.esConsumes()) { //DTChamberId chosenChamberId; if (!calibChamber_.empty() && calibChamber_ != "None" && calibChamber_ != "All") { stringstream linestr; @@ -44,13 +48,12 @@ namespace dtCalibration { void DTT0WireInChamberReferenceCorrection::setES(const EventSetup& setup) { // Get t0 record from DB - ESHandle t0H; - setup.get().get(t0H); + ESHandle t0H = setup.getHandle(t0Token_); t0Map_ = &*t0H; LogVerbatim("Calibration") << "[DTT0WireInChamberReferenceCorrection] T0 version: " << t0H->version(); // Get geometry from Event Setup - setup.get().get(dtGeom_); + dtGeom_ = setup.getHandle(dtGeomToken_); } DTT0Data DTT0WireInChamberReferenceCorrection::correction(const DTWireId& wireId) { diff --git a/CalibMuon/DTCalibration/plugins/DTT0WireInChamberReferenceCorrection.h b/CalibMuon/DTCalibration/plugins/DTT0WireInChamberReferenceCorrection.h index 75d51a1cf74b1..da63a46b7d6bb 100644 --- a/CalibMuon/DTCalibration/plugins/DTT0WireInChamberReferenceCorrection.h +++ b/CalibMuon/DTCalibration/plugins/DTT0WireInChamberReferenceCorrection.h @@ -12,7 +12,11 @@ #include "CalibMuon/DTCalibration/interface/DTT0BaseCorrection.h" #include "DataFormats/MuonDetId/interface/DTChamberId.h" #include "FWCore/Framework/interface/ESHandle.h" - +#include "CondFormats/DataRecord/interface/DTT0Rcd.h" +#include "CondFormats/DTObjects/interface/DTT0.h" +#include "Geometry/Records/interface/MuonGeometryRecord.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" +#include "FWCore/Utilities/interface/ESGetToken.h" #include namespace edm { @@ -27,7 +31,7 @@ namespace dtCalibration { class DTT0WireInChamberReferenceCorrection : public DTT0BaseCorrection { public: // Constructor - DTT0WireInChamberReferenceCorrection(const edm::ParameterSet&); + DTT0WireInChamberReferenceCorrection(const edm::ParameterSet&, edm::ConsumesCollector); // Destructor ~DTT0WireInChamberReferenceCorrection() override; @@ -43,6 +47,9 @@ namespace dtCalibration { DTChamberId chosenChamberId_; const DTT0* t0Map_; edm::ESHandle dtGeom_; + + edm::ESGetToken t0Token_; + edm::ESGetToken dtGeomToken_; }; } // namespace dtCalibration diff --git a/CalibMuon/DTCalibration/plugins/DTTPAnalyzer.cc b/CalibMuon/DTCalibration/plugins/DTTPAnalyzer.cc index 971ca3500a4e2..3356d9f06cd8a 100644 --- a/CalibMuon/DTCalibration/plugins/DTTPAnalyzer.cc +++ b/CalibMuon/DTCalibration/plugins/DTTPAnalyzer.cc @@ -3,9 +3,11 @@ * \author A. Vilela Pereira */ -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" #include "FWCore/Utilities/interface/InputTag.h" #include "FWCore/Framework/interface/ESHandle.h" +#include "Geometry/Records/interface/MuonGeometryRecord.h" #include #include @@ -17,13 +19,11 @@ class DTGeometry; class DTTTrigBaseSync; class TFile; -class DTTPAnalyzer : public edm::EDAnalyzer { +class DTTPAnalyzer : public edm::one::EDAnalyzer<> { public: DTTPAnalyzer(const edm::ParameterSet&); ~DTTPAnalyzer() override; - //void beginJob(); - void beginRun(const edm::Run&, const edm::EventSetup&) override; void analyze(const edm::Event&, const edm::EventSetup&) override; void endJob() override; @@ -34,16 +34,14 @@ class DTTPAnalyzer : public edm::EDAnalyzer { edm::InputTag digiLabel_; TFile* rootFile_; - //const DTT0* tZeroMap_; edm::ESHandle dtGeom_; + const edm::ESGetToken dtGeomToken_; std::unique_ptr tTrigSync_; // Map of the t0 and sigma histos by layer std::map nDigisPerWire_; std::map sumWPerWire_; std::map sumW2PerWire_; - //std::map meanHistoMap_; - //std::map sigmaHistoMap_; }; #include "FWCore/Framework/interface/Event.h" @@ -53,7 +51,6 @@ class DTTPAnalyzer : public edm::EDAnalyzer { #include "CalibMuon/DTDigiSync/interface/DTTTrigSyncFactory.h" #include "CalibMuon/DTDigiSync/interface/DTTTrigBaseSync.h" -#include "Geometry/Records/interface/MuonGeometryRecord.h" #include "Geometry/Records/interface/MuonNumberingRecord.h" #include "Geometry/DTGeometry/interface/DTGeometry.h" @@ -66,35 +63,32 @@ class DTTPAnalyzer : public edm::EDAnalyzer { #include "TFile.h" DTTPAnalyzer::DTTPAnalyzer(const edm::ParameterSet& pset) - : subtractT0_(pset.getParameter("subtractT0")), digiLabel_(pset.getParameter("digiLabel")) { + : subtractT0_(pset.getParameter("subtractT0")), + digiLabel_(pset.getParameter("digiLabel")), + dtGeomToken_(esConsumes()) { std::string rootFileName = pset.getUntrackedParameter("rootFileName"); rootFile_ = new TFile(rootFileName.c_str(), "RECREATE"); rootFile_->cd(); if (subtractT0_) tTrigSync_ = DTTTrigSyncFactory::get()->create(pset.getParameter("tTrigMode"), - pset.getParameter("tTrigModeConfig")); + pset.getParameter("tTrigModeConfig"), + consumesCollector()); } DTTPAnalyzer::~DTTPAnalyzer() { rootFile_->Close(); } -void DTTPAnalyzer::beginRun(const edm::Run& run, const edm::EventSetup& setup) { - // Get the t0 map from the DB - if (subtractT0_) { - /*ESHandle t0; - setup.get().get(t0); - tZeroMap_ = &*t0;*/ - tTrigSync_->setES(setup); - } - // Get the DT Geometry - setup.get().get(dtGeom_); -} - void DTTPAnalyzer::analyze(const edm::Event& event, const edm::EventSetup& setup) { // Get the digis from the event edm::Handle digis; event.getByLabel(digiLabel_, digis); + if (subtractT0_) { + tTrigSync_->setES(setup); + } + // Get the DT Geometry + dtGeom_ = setup.getHandle(dtGeomToken_); + // Iterate through all digi collections ordered by LayerId DTDigiCollection::DigiRangeIterator dtLayerIt; for (dtLayerIt = digis->begin(); dtLayerIt != digis->end(); ++dtLayerIt) { diff --git a/CalibMuon/DTCalibration/plugins/DTTPDeadWriter.cc b/CalibMuon/DTCalibration/plugins/DTTPDeadWriter.cc index 867ae6336bb88..5ccbe21132750 100644 --- a/CalibMuon/DTCalibration/plugins/DTTPDeadWriter.cc +++ b/CalibMuon/DTCalibration/plugins/DTTPDeadWriter.cc @@ -33,9 +33,10 @@ using namespace std; using namespace edm; // Constructor -DTTPDeadWriter::DTTPDeadWriter(const ParameterSet& pset) { +DTTPDeadWriter::DTTPDeadWriter(const ParameterSet& pset) : dtGeomToken_(esConsumes()) { // get selected debug option debug = pset.getUntrackedParameter("debug", false); + t0Token_ = esConsumes(edm::ESInputTag("", pset.getParameter("debug"))); // Create the object to be written to DB tpDeadList = new DTDeadFlag(); @@ -52,12 +53,10 @@ DTTPDeadWriter::~DTTPDeadWriter() { void DTTPDeadWriter::beginRun(const edm::Run&, const EventSetup& setup) { // Get the t0 map - ESHandle t0; - setup.get().get(t0); - tZeroMap = &*t0; + tZeroMap = &setup.getData(t0Token_); // Get the muon Geometry - setup.get().get(muonGeom); + muonGeom = setup.getHandle(dtGeomToken_); } // Do the job diff --git a/CalibMuon/DTCalibration/plugins/DTTPDeadWriter.h b/CalibMuon/DTCalibration/plugins/DTTPDeadWriter.h index 0a005ae97fe04..0288bcb8a932c 100644 --- a/CalibMuon/DTCalibration/plugins/DTTPDeadWriter.h +++ b/CalibMuon/DTCalibration/plugins/DTTPDeadWriter.h @@ -10,6 +10,9 @@ #include "FWCore/Framework/interface/EDAnalyzer.h" #include "Geometry/DTGeometry/interface/DTGeometry.h" #include "FWCore/Framework/interface/ESHandle.h" +#include "Geometry/Records/interface/MuonGeometryRecord.h" +#include "CondFormats/DTObjects/interface/DTT0.h" +#include "CondFormats/DataRecord/interface/DTT0Rcd.h" #include @@ -48,11 +51,13 @@ class DTTPDeadWriter : public edm::EDAnalyzer { //The map of t0 to be read from event const DTT0* tZeroMap; + edm::ESGetToken t0Token_; // The object to be written to DB DTDeadFlag* tpDeadList; //The DTGeometry edm::ESHandle muonGeom; + const edm::ESGetToken dtGeomToken_; }; #endif diff --git a/CalibMuon/DTCalibration/plugins/DTTTrigCalibration.cc b/CalibMuon/DTCalibration/plugins/DTTTrigCalibration.cc index 4db5c33df0a9e..106af25a38b2c 100644 --- a/CalibMuon/DTCalibration/plugins/DTTTrigCalibration.cc +++ b/CalibMuon/DTCalibration/plugins/DTTTrigCalibration.cc @@ -10,6 +10,7 @@ #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/Framework/interface/ESHandle.h" @@ -67,7 +68,8 @@ DTTTrigCalibration::DTTTrigCalibration(const edm::ParameterSet& pset) { // Get the synchronizer if (doSubtractT0) { theSync = DTTTrigSyncFactory::get()->create(pset.getUntrackedParameter("tTrigMode"), - pset.getUntrackedParameter("tTrigModeConfig")); + pset.getUntrackedParameter("tTrigModeConfig"), + consumesCollector()); } checkNoisyChannels = pset.getUntrackedParameter("checkNoisyChannels", "false"); @@ -77,6 +79,10 @@ DTTTrigCalibration::DTTTrigCalibration(const edm::ParameterSet& pset) { if (debug) cout << "[DTTTrigCalibration]Constructor called!" << endl; + + if (checkNoisyChannels) { + theStatusMapToken = esConsumes(); + } } // Destructor @@ -106,7 +112,7 @@ void DTTTrigCalibration::analyze(const edm::Event& event, const edm::EventSetup& ESHandle statusMap; if (checkNoisyChannels) { // Get the map of noisy channels - eventSetup.get().get(statusMap); + statusMap = eventSetup.getHandle(theStatusMapToken); } if (doSubtractT0) diff --git a/CalibMuon/DTCalibration/plugins/DTTTrigCalibration.h b/CalibMuon/DTCalibration/plugins/DTTTrigCalibration.h index c45d290ef6da3..b3ebea14e5145 100644 --- a/CalibMuon/DTCalibration/plugins/DTTTrigCalibration.h +++ b/CalibMuon/DTCalibration/plugins/DTTTrigCalibration.h @@ -9,7 +9,7 @@ * \author G. Cerminara - INFN Torino */ -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "DataFormats/MuonDetId/interface/DTSuperLayerId.h" #include "DataFormats/MuonDetId/interface/DTLayerId.h" @@ -27,8 +27,10 @@ class TH1F; class DTTimeBoxFitter; class DTTTrigBaseSync; class DTTtrig; +class DTStatusFlag; +class DTStatusFlagRcd; -class DTTTrigCalibration : public edm::EDAnalyzer { +class DTTTrigCalibration : public edm::one::EDAnalyzer<> { public: /// Constructor DTTTrigCalibration(const edm::ParameterSet& pset); @@ -88,5 +90,6 @@ class DTTTrigCalibration : public edm::EDAnalyzer { std::unique_ptr theFitter; // The module for t0 subtraction std::unique_ptr theSync; //FIXME: should be const + edm::ESGetToken theStatusMapToken; }; #endif diff --git a/CalibMuon/DTCalibration/plugins/DTTTrigConstantShift.cc b/CalibMuon/DTCalibration/plugins/DTTTrigConstantShift.cc index 0e421c2b2bc45..04e6cf074e49b 100644 --- a/CalibMuon/DTCalibration/plugins/DTTTrigConstantShift.cc +++ b/CalibMuon/DTCalibration/plugins/DTTTrigConstantShift.cc @@ -12,6 +12,7 @@ #include "DataFormats/MuonDetId/interface/DTSuperLayerId.h" #include "CondFormats/DTObjects/interface/DTTtrig.h" #include "CondFormats/DataRecord/interface/DTTtrigRcd.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" #include @@ -20,10 +21,10 @@ using namespace edm; namespace dtCalibration { - DTTTrigConstantShift::DTTTrigConstantShift(const ParameterSet& pset) - : dbLabel_(pset.getUntrackedParameter("dbLabel", "")), - calibChamber_(pset.getParameter("calibChamber")), - value_(pset.getParameter("value")) { + DTTTrigConstantShift::DTTTrigConstantShift(const ParameterSet& pset, edm::ConsumesCollector cc) + : calibChamber_(pset.getParameter("calibChamber")), value_(pset.getParameter("value")) { + ttrigToken_ = + cc.esConsumes(edm::ESInputTag("", pset.getUntrackedParameter("dbLabel"))); LogVerbatim("Calibration") << "[DTTTrigConstantShift] Applying constant correction value: " << value_ << endl; if (!calibChamber_.empty() && calibChamber_ != "None" && calibChamber_ != "All") { @@ -41,8 +42,7 @@ namespace dtCalibration { void DTTTrigConstantShift::setES(const EventSetup& setup) { // Get tTrig record from DB - ESHandle tTrig; - setup.get().get(dbLabel_, tTrig); + ESHandle tTrig = setup.getHandle(ttrigToken_); tTrigMap_ = &*tTrig; } diff --git a/CalibMuon/DTCalibration/plugins/DTTTrigConstantShift.h b/CalibMuon/DTCalibration/plugins/DTTTrigConstantShift.h index f9d9b66e8dc84..c1eb078a1d25b 100644 --- a/CalibMuon/DTCalibration/plugins/DTTTrigConstantShift.h +++ b/CalibMuon/DTCalibration/plugins/DTTTrigConstantShift.h @@ -11,6 +11,8 @@ #include "CalibMuon/DTCalibration/interface/DTTTrigBaseCorrection.h" #include "DataFormats/MuonDetId/interface/DTChamberId.h" +#include "CondFormats/DataRecord/interface/DTTtrigRcd.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" #include @@ -25,7 +27,7 @@ namespace dtCalibration { class DTTTrigConstantShift : public DTTTrigBaseCorrection { public: // Constructor - DTTTrigConstantShift(const edm::ParameterSet&); + DTTTrigConstantShift(const edm::ParameterSet&, edm::ConsumesCollector); // Destructor ~DTTTrigConstantShift() override; @@ -34,12 +36,12 @@ namespace dtCalibration { DTTTrigData correction(const DTSuperLayerId&) override; private: - std::string dbLabel_; std::string calibChamber_; double value_; const DTTtrig* tTrigMap_; DTChamberId chosenChamberId_; + edm::ESGetToken ttrigToken_; }; } // namespace dtCalibration diff --git a/CalibMuon/DTCalibration/plugins/DTTTrigCorrection.cc b/CalibMuon/DTCalibration/plugins/DTTTrigCorrection.cc index 04889fb1a0e7e..d212be5bcf114 100644 --- a/CalibMuon/DTCalibration/plugins/DTTTrigCorrection.cc +++ b/CalibMuon/DTCalibration/plugins/DTTTrigCorrection.cc @@ -25,6 +25,8 @@ #include "CalibMuon/DTCalibration/interface/DTTTrigCorrectionFactory.h" #include "CalibMuon/DTCalibration/interface/DTTTrigBaseCorrection.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" +#include "FWCore/Framework/interface/EDAnalyzer.h" #include #include @@ -33,9 +35,12 @@ using namespace edm; using namespace std; DTTTrigCorrection::DTTTrigCorrection(const ParameterSet& pset) - : dbLabel_(pset.getUntrackedParameter("dbLabel", "")), - correctionAlgo_{DTTTrigCorrectionFactory::get()->create( - pset.getParameter("correctionAlgo"), pset.getParameter("correctionAlgoConfig"))} { + : correctionAlgo_{DTTTrigCorrectionFactory::get()->create(pset.getParameter("correctionAlgo"), + pset.getParameter("correctionAlgoConfig"), + consumesCollector())} { + ttrigToken_ = + esConsumes(edm::ESInputTag("", pset.getUntrackedParameter("dbLabel"))); + dtGeomToken_ = esConsumes(); LogVerbatim("Calibration") << "[DTTTrigCorrection] Constructor called" << endl; } @@ -45,13 +50,12 @@ DTTTrigCorrection::~DTTTrigCorrection() { void DTTTrigCorrection::beginRun(const edm::Run& run, const edm::EventSetup& setup) { // Get tTrig record from DB - ESHandle tTrig; - setup.get().get(dbLabel_, tTrig); + ESHandle tTrig = setup.getHandle(ttrigToken_); tTrigMap_ = &*tTrig; LogVerbatim("Calibration") << "[DTTTrigCorrection]: TTrig version: " << tTrig->version() << endl; // Get geometry from Event Setup - setup.get().get(muonGeom_); + muonGeom_ = setup.getHandle(dtGeomToken_); // Pass EventSetup to correction Algo correctionAlgo_->setES(setup); diff --git a/CalibMuon/DTCalibration/plugins/DTTTrigCorrection.h b/CalibMuon/DTCalibration/plugins/DTTTrigCorrection.h index 89f63f4774e48..f518d1e787723 100644 --- a/CalibMuon/DTCalibration/plugins/DTTTrigCorrection.h +++ b/CalibMuon/DTCalibration/plugins/DTTTrigCorrection.h @@ -11,6 +11,10 @@ #include "FWCore/Framework/interface/Frameworkfwd.h" #include "FWCore/Framework/interface/EDAnalyzer.h" #include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" +#include "Geometry/Records/interface/MuonGeometryRecord.h" +#include "Geometry/DTGeometry/interface/DTGeometry.h" +#include "CondFormats/DataRecord/interface/DTTtrigRcd.h" #include @@ -37,11 +41,12 @@ class DTTTrigCorrection : public edm::EDAnalyzer { protected: private: - std::string dbLabel_; - const DTTtrig* tTrigMap_; edm::ESHandle muonGeom_; + edm::ESGetToken ttrigToken_; + edm::ESGetToken dtGeomToken_; + std::unique_ptr correctionAlgo_; }; #endif diff --git a/CalibMuon/DTCalibration/plugins/DTTTrigCorrectionFirst.cc b/CalibMuon/DTCalibration/plugins/DTTTrigCorrectionFirst.cc index 44b0203583001..5dd80b0ab82b8 100644 --- a/CalibMuon/DTCalibration/plugins/DTTTrigCorrectionFirst.cc +++ b/CalibMuon/DTCalibration/plugins/DTTTrigCorrectionFirst.cc @@ -25,24 +25,24 @@ using namespace edm; using namespace std; -DTTTrigCorrectionFirst::DTTTrigCorrectionFirst(const ParameterSet& pset) { +DTTTrigCorrectionFirst::DTTTrigCorrectionFirst(const ParameterSet& pset) + : dtGeomToken_(esConsumes()), + ttrigToken_( + esConsumes(edm::ESInputTag("", pset.getUntrackedParameter("dbLabel")))) { debug = pset.getUntrackedParameter("debug", false); ttrigMin = pset.getUntrackedParameter("ttrigMin", 0); ttrigMax = pset.getUntrackedParameter("ttrigMax", 5000); rmsLimit = pset.getUntrackedParameter("rmsLimit", 5.); - - dbLabel = pset.getUntrackedParameter("dbLabel", ""); } DTTTrigCorrectionFirst::~DTTTrigCorrectionFirst() {} void DTTTrigCorrectionFirst::beginRun(const edm::Run& run, const edm::EventSetup& setup) { ESHandle tTrig; - setup.get().get(dbLabel, tTrig); - tTrigMap = &*tTrig; + tTrig = setup.getHandle(ttrigToken_); + tTrigMap = &setup.getData(ttrigToken_); cout << "[DTTTrigCorrection]: TTrig version: " << tTrig->version() << endl; - - setup.get().get(muonGeom); + muonGeom = setup.getHandle(dtGeomToken_); } void DTTTrigCorrectionFirst::endJob() { diff --git a/CalibMuon/DTCalibration/plugins/DTTTrigCorrectionFirst.h b/CalibMuon/DTCalibration/plugins/DTTTrigCorrectionFirst.h index 5b0c496e3398a..4de93c25ba5e5 100644 --- a/CalibMuon/DTCalibration/plugins/DTTTrigCorrectionFirst.h +++ b/CalibMuon/DTCalibration/plugins/DTTTrigCorrectionFirst.h @@ -11,6 +11,8 @@ #include "FWCore/Framework/interface/Frameworkfwd.h" #include "FWCore/Framework/interface/EDAnalyzer.h" #include "FWCore/Framework/interface/ESHandle.h" +#include "Geometry/Records/interface/MuonGeometryRecord.h" +#include "CondFormats/DataRecord/interface/DTTtrigRcd.h" #include @@ -35,10 +37,11 @@ class DTTTrigCorrectionFirst : public edm::EDAnalyzer { protected: private: - const DTTtrig* tTrigMap; edm::ESHandle muonGeom; + const edm::ESGetToken dtGeomToken_; - std::string dbLabel; + const DTTtrig* tTrigMap; + const edm::ESGetToken ttrigToken_; bool debug; double ttrigMin, ttrigMax, rmsLimit; diff --git a/CalibMuon/DTCalibration/plugins/DTTTrigFillWithAverage.cc b/CalibMuon/DTCalibration/plugins/DTTTrigFillWithAverage.cc index 7bd083d3026dc..9386f412e8fb0 100644 --- a/CalibMuon/DTCalibration/plugins/DTTTrigFillWithAverage.cc +++ b/CalibMuon/DTCalibration/plugins/DTTTrigFillWithAverage.cc @@ -18,8 +18,11 @@ using namespace edm; namespace dtCalibration { - DTTTrigFillWithAverage::DTTTrigFillWithAverage(const ParameterSet& pset) : foundAverage_(false) { - dbLabel = pset.getUntrackedParameter("dbLabel", ""); + DTTTrigFillWithAverage::DTTTrigFillWithAverage(const ParameterSet& pset, edm::ConsumesCollector cc) + : foundAverage_(false) { + ttrigToken_ = + cc.esConsumes(edm::ESInputTag("", pset.getUntrackedParameter("dbLabel"))); + dtGeomToken_ = cc.esConsumes(); } DTTTrigFillWithAverage::~DTTTrigFillWithAverage() {} @@ -27,11 +30,11 @@ namespace dtCalibration { void DTTTrigFillWithAverage::setES(const EventSetup& setup) { // Get tTrig record from DB ESHandle tTrig; - setup.get().get(dbLabel, tTrig); + tTrig = setup.getHandle(ttrigToken_); tTrigMap_ = &*tTrig; // Get geometry from Event Setup - setup.get().get(muonGeom_); + muonGeom_ = setup.getHandle(dtGeomToken_); } DTTTrigData DTTTrigFillWithAverage::correction(const DTSuperLayerId& slId) { diff --git a/CalibMuon/DTCalibration/plugins/DTTTrigFillWithAverage.h b/CalibMuon/DTCalibration/plugins/DTTTrigFillWithAverage.h index fcc8b10e417cf..2f66d250daed1 100644 --- a/CalibMuon/DTCalibration/plugins/DTTTrigFillWithAverage.h +++ b/CalibMuon/DTCalibration/plugins/DTTTrigFillWithAverage.h @@ -10,6 +10,9 @@ #include "CalibMuon/DTCalibration/interface/DTTTrigBaseCorrection.h" #include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" +#include "Geometry/Records/interface/MuonGeometryRecord.h" +#include "CondFormats/DataRecord/interface/DTTtrigRcd.h" namespace edm { class ParameterSet; @@ -23,7 +26,7 @@ namespace dtCalibration { class DTTTrigFillWithAverage : public DTTTrigBaseCorrection { public: // Constructor - DTTTrigFillWithAverage(const edm::ParameterSet&); + DTTTrigFillWithAverage(const edm::ParameterSet&, edm::ConsumesCollector); // Destructor ~DTTTrigFillWithAverage() override; @@ -37,7 +40,8 @@ namespace dtCalibration { const DTTtrig* tTrigMap_; edm::ESHandle muonGeom_; - std::string dbLabel; + edm::ESGetToken ttrigToken_; + edm::ESGetToken dtGeomToken_; struct { float aveMean; diff --git a/CalibMuon/DTCalibration/plugins/DTTTrigMatchRPhi.cc b/CalibMuon/DTCalibration/plugins/DTTTrigMatchRPhi.cc index 4c4dc86f0e5f1..6f61a7ba133b5 100644 --- a/CalibMuon/DTCalibration/plugins/DTTTrigMatchRPhi.cc +++ b/CalibMuon/DTCalibration/plugins/DTTTrigMatchRPhi.cc @@ -19,16 +19,16 @@ using namespace edm; namespace dtCalibration { - DTTTrigMatchRPhi::DTTTrigMatchRPhi(const ParameterSet& pset) { - dbLabel = pset.getUntrackedParameter("dbLabel", ""); + DTTTrigMatchRPhi::DTTTrigMatchRPhi(const ParameterSet& pset, edm::ConsumesCollector cc) { + ttrigToken_ = + cc.esConsumes(edm::ESInputTag("", pset.getUntrackedParameter("dbLabel"))); } DTTTrigMatchRPhi::~DTTTrigMatchRPhi() {} void DTTTrigMatchRPhi::setES(const EventSetup& setup) { // Get tTrig record from DB - ESHandle tTrig; - setup.get().get(dbLabel, tTrig); + ESHandle tTrig = setup.getHandle(ttrigToken_); tTrigMap_ = &*tTrig; } diff --git a/CalibMuon/DTCalibration/plugins/DTTTrigMatchRPhi.h b/CalibMuon/DTCalibration/plugins/DTTTrigMatchRPhi.h index 340b647cdd4bb..77b4bcf7025e0 100644 --- a/CalibMuon/DTCalibration/plugins/DTTTrigMatchRPhi.h +++ b/CalibMuon/DTCalibration/plugins/DTTTrigMatchRPhi.h @@ -9,6 +9,8 @@ */ #include "CalibMuon/DTCalibration/interface/DTTTrigBaseCorrection.h" +#include "CondFormats/DataRecord/interface/DTTtrigRcd.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" #include @@ -23,7 +25,7 @@ namespace dtCalibration { class DTTTrigMatchRPhi : public DTTTrigBaseCorrection { public: // Constructor - DTTTrigMatchRPhi(const edm::ParameterSet&); + DTTTrigMatchRPhi(const edm::ParameterSet&, edm::ConsumesCollector); // Destructor ~DTTTrigMatchRPhi() override; @@ -33,8 +35,7 @@ namespace dtCalibration { private: const DTTtrig* tTrigMap_; - - std::string dbLabel; + edm::ESGetToken ttrigToken_; }; } // namespace dtCalibration diff --git a/CalibMuon/DTCalibration/plugins/DTTTrigOffsetCalibration.cc b/CalibMuon/DTCalibration/plugins/DTTTrigOffsetCalibration.cc index 4ea933cd41001..b36b872865276 100644 --- a/CalibMuon/DTCalibration/plugins/DTTTrigOffsetCalibration.cc +++ b/CalibMuon/DTCalibration/plugins/DTTTrigOffsetCalibration.cc @@ -38,7 +38,9 @@ DTTTrigOffsetCalibration::DTTTrigOffsetCalibration(const ParameterSet& pset) : theRecHits4DLabel_(pset.getParameter("recHits4DLabel")), doTTrigCorrection_(pset.getUntrackedParameter("doT0SegCorrection", false)), theCalibChamber_(pset.getUntrackedParameter("calibChamber", "All")), - dbLabel_(pset.getUntrackedParameter("dbLabel", "")) { + ttrigToken_( + esConsumes(edm::ESInputTag("", pset.getUntrackedParameter("dbLabel")))), + dtGeomToken_(esConsumes()) { LogVerbatim("Calibration") << "[DTTTrigOffsetCalibration] Constructor called!"; edm::ConsumesCollector collector(consumesCollector()); @@ -53,8 +55,8 @@ DTTTrigOffsetCalibration::DTTTrigOffsetCalibration(const ParameterSet& pset) void DTTTrigOffsetCalibration::beginRun(const edm::Run& run, const edm::EventSetup& setup) { if (doTTrigCorrection_) { ESHandle tTrig; - setup.get().get(dbLabel_, tTrig); - tTrigMap_ = &*tTrig; + tTrig = setup.getHandle(ttrigToken_); + tTrigMap_ = &setup.getData(ttrigToken_); LogVerbatim("Calibration") << "[DTTTrigOffsetCalibration]: TTrig version: " << tTrig->version() << endl; } } @@ -79,7 +81,7 @@ void DTTTrigOffsetCalibration::analyze(const Event& event, const EventSetup& eve // Get the DT Geometry ESHandle dtGeom; - eventSetup.get().get(dtGeom); + dtGeom = eventSetup.getHandle(dtGeomToken_); // Get the rechit collection from the event Handle all4DSegments; diff --git a/CalibMuon/DTCalibration/plugins/DTTTrigOffsetCalibration.h b/CalibMuon/DTCalibration/plugins/DTTTrigOffsetCalibration.h index d6a0825bfe17b..8cf74428eb13c 100644 --- a/CalibMuon/DTCalibration/plugins/DTTTrigOffsetCalibration.h +++ b/CalibMuon/DTCalibration/plugins/DTTTrigOffsetCalibration.h @@ -10,6 +10,9 @@ #include "FWCore/Framework/interface/EDAnalyzer.h" #include "FWCore/Utilities/interface/InputTag.h" #include "CalibMuon/DTCalibration/interface/DTSegmentSelector.h" +#include "Geometry/Records/interface/MuonGeometryRecord.h" +#include "CondFormats/DataRecord/interface/DTTtrigRcd.h" +#include "Geometry/DTGeometry/interface/DTGeometry.h" #include @@ -44,10 +47,12 @@ class DTTTrigOffsetCalibration : public edm::EDAnalyzer { edm::InputTag theRecHits4DLabel_; bool doTTrigCorrection_; std::string theCalibChamber_; - std::string dbLabel_; TFile* rootFile_; const DTTtrig* tTrigMap_; ChamberHistosMap theT0SegHistoMap_; + + const edm::ESGetToken ttrigToken_; + const edm::ESGetToken dtGeomToken_; }; #endif diff --git a/CalibMuon/DTCalibration/plugins/DTTTrigResidualCorrection.cc b/CalibMuon/DTCalibration/plugins/DTTTrigResidualCorrection.cc index ac8f7cebfa63b..69eb3a8035763 100644 --- a/CalibMuon/DTCalibration/plugins/DTTTrigResidualCorrection.cc +++ b/CalibMuon/DTCalibration/plugins/DTTTrigResidualCorrection.cc @@ -42,15 +42,18 @@ using namespace edm; namespace dtCalibration { - DTTTrigResidualCorrection::DTTTrigResidualCorrection(const ParameterSet& pset) { + DTTTrigResidualCorrection::DTTTrigResidualCorrection(const ParameterSet& pset, edm::ConsumesCollector cc) { string residualsRootFile = pset.getParameter("residualsRootFile"); rootFile_ = new TFile(residualsRootFile.c_str(), "READ"); rootBaseDir_ = pset.getUntrackedParameter("rootBaseDir", "/DQMData/DT/DTCalibValidation"); useFit_ = pset.getParameter("useFitToResiduals"); //useConstantvDrift_ = pset.getParameter("useConstantDriftVelocity"); - dbLabel_ = pset.getUntrackedParameter("dbLabel", ""); useSlopesCalib_ = pset.getUntrackedParameter("useSlopesCalib", false); readLegacyVDriftDB = pset.getParameter("readLegacyVDriftDB"); + ttrigToken_ = + cc.esConsumes(edm::ESInputTag("", pset.getUntrackedParameter("dbLabel"))); + mTimeMapToken_ = cc.esConsumes(); + vDriftMapToken_ = cc.esConsumes(); // Load external slopes if (useSlopesCalib_) { @@ -81,20 +84,17 @@ namespace dtCalibration { void DTTTrigResidualCorrection::setES(const EventSetup& setup) { // Get tTrig record from DB ESHandle tTrig; - //setup.get().get(tTrig); - setup.get().get(dbLabel_, tTrig); + tTrig = setup.getHandle(ttrigToken_); tTrigMap_ = &*tTrig; // Get vDrift record if (readLegacyVDriftDB) { ESHandle mTimeHandle; - setup.get().get(mTimeHandle); - mTimeMap_ = &*mTimeHandle; + mTimeMap_ = &setup.getData(mTimeMapToken_); vDriftMap_ = nullptr; } else { ESHandle hVdrift; - setup.get().get(hVdrift); - vDriftMap_ = &*hVdrift; + vDriftMap_ = &setup.getData(vDriftMapToken_); mTimeMap_ = nullptr; // Consistency check: no parametrization is implemented for the time being int version = vDriftMap_->version(); diff --git a/CalibMuon/DTCalibration/plugins/DTTTrigResidualCorrection.h b/CalibMuon/DTCalibration/plugins/DTTTrigResidualCorrection.h index e13806bce3253..a37e75e2eb549 100644 --- a/CalibMuon/DTCalibration/plugins/DTTTrigResidualCorrection.h +++ b/CalibMuon/DTCalibration/plugins/DTTTrigResidualCorrection.h @@ -9,6 +9,10 @@ */ #include "CalibMuon/DTCalibration/interface/DTTTrigBaseCorrection.h" +#include "CondFormats/DataRecord/interface/DTTtrigRcd.h" +#include "CondFormats/DataRecord/interface/DTMtimeRcd.h" +#include "CondFormats/DataRecord/interface/DTRecoConditionsVdriftRcd.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" #include @@ -29,7 +33,7 @@ namespace dtCalibration { class DTTTrigResidualCorrection : public DTTTrigBaseCorrection { public: // Constructor - DTTTrigResidualCorrection(const edm::ParameterSet&); + DTTTrigResidualCorrection(const edm::ParameterSet&, edm::ConsumesCollector cc); // Destructor ~DTTTrigResidualCorrection() override; @@ -45,7 +49,6 @@ namespace dtCalibration { std::string rootBaseDir_; bool useFit_; - std::string dbLabel_; bool useSlopesCalib_; double vDriftEff_[5][14][4][3]; @@ -56,6 +59,10 @@ namespace dtCalibration { bool readLegacyVDriftDB; // which one to use DTResidualFitter* fitter_; + + edm::ESGetToken ttrigToken_; + edm::ESGetToken mTimeMapToken_; + edm::ESGetToken vDriftMapToken_; }; } // namespace dtCalibration diff --git a/CalibMuon/DTCalibration/plugins/DTTTrigT0SegCorrection.cc b/CalibMuon/DTCalibration/plugins/DTTTrigT0SegCorrection.cc index 0a06ad51ec987..02630aaeb78b4 100644 --- a/CalibMuon/DTCalibration/plugins/DTTTrigT0SegCorrection.cc +++ b/CalibMuon/DTCalibration/plugins/DTTTrigT0SegCorrection.cc @@ -23,18 +23,18 @@ using namespace edm; namespace dtCalibration { - DTTTrigT0SegCorrection::DTTTrigT0SegCorrection(const ParameterSet& pset) { + DTTTrigT0SegCorrection::DTTTrigT0SegCorrection(const ParameterSet& pset, edm::ConsumesCollector cc) { string t0SegRootFile = pset.getParameter("t0SegRootFile"); rootFile_ = new TFile(t0SegRootFile.c_str(), "READ"); - dbLabel = pset.getUntrackedParameter("dbLabel", ""); + ttrigToken_ = + cc.esConsumes(edm::ESInputTag("", pset.getUntrackedParameter("dbLabel"))); } DTTTrigT0SegCorrection::~DTTTrigT0SegCorrection() { delete rootFile_; } void DTTTrigT0SegCorrection::setES(const EventSetup& setup) { // Get tTrig record from DB - ESHandle tTrig; - setup.get().get(dbLabel, tTrig); + ESHandle tTrig = setup.getHandle(ttrigToken_); tTrigMap_ = &*tTrig; } diff --git a/CalibMuon/DTCalibration/plugins/DTTTrigT0SegCorrection.h b/CalibMuon/DTCalibration/plugins/DTTTrigT0SegCorrection.h index 594f1b61bdaf7..7c8d758567f46 100644 --- a/CalibMuon/DTCalibration/plugins/DTTTrigT0SegCorrection.h +++ b/CalibMuon/DTCalibration/plugins/DTTTrigT0SegCorrection.h @@ -9,12 +9,15 @@ */ #include "CalibMuon/DTCalibration/interface/DTTTrigBaseCorrection.h" +#include "CondFormats/DataRecord/interface/DTTtrigRcd.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" #include namespace edm { class ParameterSet; -} + class ConsumesCollector; +} // namespace edm class DTTtrig; @@ -26,7 +29,7 @@ namespace dtCalibration { class DTTTrigT0SegCorrection : public DTTTrigBaseCorrection { public: // Constructor - DTTTrigT0SegCorrection(const edm::ParameterSet&); + DTTTrigT0SegCorrection(const edm::ParameterSet&, edm::ConsumesCollector); // Destructor ~DTTTrigT0SegCorrection() override; @@ -40,9 +43,8 @@ namespace dtCalibration { TFile* rootFile_; - std::string dbLabel; - const DTTtrig* tTrigMap_; + edm::ESGetToken ttrigToken_; }; } // namespace dtCalibration diff --git a/CalibMuon/DTCalibration/plugins/DTTTrigWriter.cc b/CalibMuon/DTCalibration/plugins/DTTTrigWriter.cc index fa85f6a6f69a3..d790e8dcad5f5 100644 --- a/CalibMuon/DTCalibration/plugins/DTTTrigWriter.cc +++ b/CalibMuon/DTCalibration/plugins/DTTTrigWriter.cc @@ -33,7 +33,7 @@ using namespace std; using namespace edm; // Constructor -DTTTrigWriter::DTTTrigWriter(const ParameterSet& pset) { +DTTTrigWriter::DTTTrigWriter(const ParameterSet& pset) : dtGeomToken_(esConsumes()) { // get selected debug option debug = pset.getUntrackedParameter("debug", false); @@ -72,8 +72,7 @@ void DTTTrigWriter::analyze(const Event& event, const EventSetup& eventSetup) { cout << "[DTTTrigWriter]Analyzer called!" << endl; // Get the DT Geometry - ESHandle dtGeom; - eventSetup.get().get(dtGeom); + dtGeom = eventSetup.getHandle(dtGeomToken_); // Get all the sls from the setup const vector superLayers = dtGeom->superLayers(); diff --git a/CalibMuon/DTCalibration/plugins/DTTTrigWriter.h b/CalibMuon/DTCalibration/plugins/DTTTrigWriter.h index 47cf1a4518179..f008f0d4ea0c8 100644 --- a/CalibMuon/DTCalibration/plugins/DTTTrigWriter.h +++ b/CalibMuon/DTCalibration/plugins/DTTTrigWriter.h @@ -8,7 +8,10 @@ */ #include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/ESHandle.h" // #include "DataFormats/MuonDetId/interface/DTSuperLayerId.h" +#include "Geometry/Records/interface/MuonGeometryRecord.h" +#include "Geometry/DTGeometry/interface/DTGeometry.h" #include @@ -60,5 +63,9 @@ class DTTTrigWriter : public edm::EDAnalyzer { // The object to be written to DB DTTtrig* tTrig; + + //geom + edm::ESHandle dtGeom; + const edm::ESGetToken dtGeomToken_; }; #endif diff --git a/CalibMuon/DTCalibration/plugins/DTVDriftCalibration.cc b/CalibMuon/DTCalibration/plugins/DTVDriftCalibration.cc index 69f4e9e5434e4..fbe90e32a9589 100644 --- a/CalibMuon/DTCalibration/plugins/DTVDriftCalibration.cc +++ b/CalibMuon/DTCalibration/plugins/DTVDriftCalibration.cc @@ -11,6 +11,7 @@ #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "Geometry/DTGeometry/interface/DTGeometry.h" @@ -42,8 +43,10 @@ using namespace dttmaxenums; DTVDriftCalibration::DTVDriftCalibration(const ParameterSet& pset) : // Get the synchronizer + theDTGeomToken{esConsumes()}, theSync{DTTTrigSyncFactory::get()->create(pset.getParameter("tTrigMode"), - pset.getParameter("tTrigModeConfig"))} + pset.getParameter("tTrigModeConfig"), + consumesCollector())} { edm::ConsumesCollector collector(consumesCollector()); @@ -125,19 +128,12 @@ void DTVDriftCalibration::analyze(const Event& event, const EventSetup& eventSet } // Get the DT Geometry - ESHandle dtGeom; - eventSetup.get().get(dtGeom); + const DTGeometry& dtGeom = eventSetup.getData(theDTGeomToken); // Get the rechit collection from the event Handle all4DSegments; event.getByToken(theRecHits4DToken, all4DSegments); - // Get the map of noisy channels - /*ESHandle statusMap; - if(checkNoisyChannels) { - eventSetup.get().get(statusMap); - }*/ - // Set the event setup in the Synchronizer theSync->setES(eventSetup); @@ -145,7 +141,7 @@ void DTVDriftCalibration::analyze(const Event& event, const EventSetup& eventSet DTRecSegment4DCollection::id_iterator chamberIdIt; for (chamberIdIt = all4DSegments->id_begin(); chamberIdIt != all4DSegments->id_end(); ++chamberIdIt) { // Get the chamber from the setup - const DTChamber* chamber = dtGeom->chamber(*chamberIdIt); + const DTChamber* chamber = dtGeom.chamber(*chamberIdIt); LogTrace("Calibration") << "Chamber Id: " << *chamberIdIt; // Calibrate just the chosen chamber/s diff --git a/CalibMuon/DTCalibration/plugins/DTVDriftCalibration.h b/CalibMuon/DTCalibration/plugins/DTVDriftCalibration.h index 0bd6dbed47396..361365868827d 100644 --- a/CalibMuon/DTCalibration/plugins/DTVDriftCalibration.h +++ b/CalibMuon/DTCalibration/plugins/DTVDriftCalibration.h @@ -7,7 +7,7 @@ * \author M. Giunta */ -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "FWCore/Utilities/interface/InputTag.h" #include "DataFormats/MuonDetId/interface/DTWireId.h" #include "DataFormats/DTRecHit/interface/DTRecSegment4DCollection.h" @@ -29,8 +29,10 @@ namespace edm { class TFile; class DTMeanTimerFitter; +class DTGeometry; +class MuonGeometryRecord; -class DTVDriftCalibration : public edm::EDAnalyzer { +class DTVDriftCalibration : public edm::one::EDAnalyzer<> { public: /// Constructor DTVDriftCalibration(const edm::ParameterSet& pset); @@ -87,6 +89,8 @@ class DTVDriftCalibration : public edm::EDAnalyzer { // The label used to retrieve 4D segments from the event edm::EDGetTokenT theRecHits4DToken; + const edm::ESGetToken theDTGeomToken; + // Debug flag bool debug; diff --git a/CalibMuon/DTCalibration/plugins/DTVDriftMeanTimer.cc b/CalibMuon/DTCalibration/plugins/DTVDriftMeanTimer.cc index 8f0e7fe061ed8..99b54cb3f458b 100644 --- a/CalibMuon/DTCalibration/plugins/DTVDriftMeanTimer.cc +++ b/CalibMuon/DTCalibration/plugins/DTVDriftMeanTimer.cc @@ -29,7 +29,7 @@ using namespace edm; namespace dtCalibration { - DTVDriftMeanTimer::DTVDriftMeanTimer(const ParameterSet& pset) { + DTVDriftMeanTimer::DTVDriftMeanTimer(const ParameterSet& pset, edm::ConsumesCollector cc) { string rootFileName = pset.getParameter("rootFileName"); rootFile_ = new TFile(rootFileName.c_str(), "READ"); fitter_ = new DTMeanTimerFitter(rootFile_); diff --git a/CalibMuon/DTCalibration/plugins/DTVDriftMeanTimer.h b/CalibMuon/DTCalibration/plugins/DTVDriftMeanTimer.h index f980f1b61f778..66879a7cd3015 100644 --- a/CalibMuon/DTCalibration/plugins/DTVDriftMeanTimer.h +++ b/CalibMuon/DTCalibration/plugins/DTVDriftMeanTimer.h @@ -10,6 +10,7 @@ #include "CalibMuon/DTCalibration/interface/DTVDriftBaseAlgo.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" class TFile; class DTMeanTimerFitter; @@ -18,7 +19,7 @@ namespace dtCalibration { class DTVDriftMeanTimer : public DTVDriftBaseAlgo { public: - DTVDriftMeanTimer(edm::ParameterSet const&); + DTVDriftMeanTimer(edm::ParameterSet const&, edm::ConsumesCollector); ~DTVDriftMeanTimer() override; void setES(const edm::EventSetup& setup) override; diff --git a/CalibMuon/DTCalibration/plugins/DTVDriftSegment.cc b/CalibMuon/DTCalibration/plugins/DTVDriftSegment.cc index 514f947e54c74..2aecd8c26bd7f 100644 --- a/CalibMuon/DTCalibration/plugins/DTVDriftSegment.cc +++ b/CalibMuon/DTCalibration/plugins/DTVDriftSegment.cc @@ -21,7 +21,7 @@ #include "CalibMuon/DTCalibration/interface/DTResidualFitter.h" #include "CalibMuon/DTCalibration/interface/DTCalibDBUtils.h" - +#include "FWCore/Framework/interface/ConsumesCollector.h" #include #include @@ -33,7 +33,7 @@ using namespace edm; namespace dtCalibration { - DTVDriftSegment::DTVDriftSegment(const ParameterSet& pset) + DTVDriftSegment::DTVDriftSegment(const ParameterSet& pset, edm::ConsumesCollector cc) : nSigmas_(pset.getUntrackedParameter("nSigmasFitRange", 1)), mTimeMap_(nullptr), vDriftMap_(nullptr) { @@ -45,6 +45,11 @@ namespace dtCalibration { //if(debug) fitter_->setVerbosity(1); readLegacyVDriftDB = pset.getParameter("readLegacyVDriftDB"); + if (readLegacyVDriftDB) { + mTimeMapToken_ = cc.esConsumes(); + } else { + vDriftMapToken_ = cc.esConsumes(); + } } DTVDriftSegment::~DTVDriftSegment() { @@ -55,13 +60,9 @@ namespace dtCalibration { void DTVDriftSegment::setES(const edm::EventSetup& setup) { // Get the map of vdrift from the setup if (readLegacyVDriftDB) { - ESHandle mTime; - setup.get().get(mTime); - mTimeMap_ = &*mTime; + mTimeMap_ = &setup.getData(mTimeMapToken_); } else { - ESHandle hVdrift; - setup.get().get(hVdrift); - vDriftMap_ = &*hVdrift; + vDriftMap_ = &setup.getData(vDriftMapToken_); // Consistency check: no parametrization is implemented for the time being int version = vDriftMap_->version(); if (version != 1) { diff --git a/CalibMuon/DTCalibration/plugins/DTVDriftSegment.h b/CalibMuon/DTCalibration/plugins/DTVDriftSegment.h index f1e42e452a086..a7fb70b4bc8cd 100644 --- a/CalibMuon/DTCalibration/plugins/DTVDriftSegment.h +++ b/CalibMuon/DTCalibration/plugins/DTVDriftSegment.h @@ -10,6 +10,12 @@ #include "CalibMuon/DTCalibration/interface/DTVDriftBaseAlgo.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Framework/interface/ESHandle.h" +#include "CondFormats/DataRecord/interface/DTMtimeRcd.h" +#include "CondFormats/DataRecord/interface/DTRecoConditionsVdriftRcd.h" +#include "Geometry/Records/interface/MuonGeometryRecord.h" #include @@ -23,7 +29,7 @@ namespace dtCalibration { class DTVDriftSegment : public DTVDriftBaseAlgo { public: - DTVDriftSegment(edm::ParameterSet const&); + DTVDriftSegment(edm::ParameterSet const&, edm::ConsumesCollector); ~DTVDriftSegment() override; void setES(const edm::EventSetup& setup) override; @@ -40,6 +46,9 @@ namespace dtCalibration { bool readLegacyVDriftDB; // which one to use TFile* rootFile_; DTResidualFitter* fitter_; + + edm::ESGetToken mTimeMapToken_; + edm::ESGetToken vDriftMapToken_; }; } // namespace dtCalibration diff --git a/CalibMuon/DTCalibration/plugins/DTVDriftSegmentCalibration.cc b/CalibMuon/DTCalibration/plugins/DTVDriftSegmentCalibration.cc index 17297347a421a..d851f5735ad64 100644 --- a/CalibMuon/DTCalibration/plugins/DTVDriftSegmentCalibration.cc +++ b/CalibMuon/DTCalibration/plugins/DTVDriftSegmentCalibration.cc @@ -33,7 +33,8 @@ using namespace edm; DTVDriftSegmentCalibration::DTVDriftSegmentCalibration(const ParameterSet& pset) : theRecHits4DLabel_(pset.getParameter("recHits4DLabel")), //writeVDriftDB_(pset.getUntrackedParameter("writeVDriftDB", false)), - theCalibChamber_(pset.getUntrackedParameter("calibChamber", "All")) { + theCalibChamber_(pset.getUntrackedParameter("calibChamber", "All")), + dtGeomToken_(esConsumes()) { LogVerbatim("Calibration") << "[DTVDriftSegmentCalibration] Constructor called!"; edm::ConsumesCollector collector(consumesCollector()); @@ -59,7 +60,7 @@ void DTVDriftSegmentCalibration::analyze(const Event& event, const EventSetup& e // Get the DT Geometry ESHandle dtGeom; - eventSetup.get().get(dtGeom); + dtGeom = eventSetup.getHandle(dtGeomToken_); // Get the rechit collection from the event Handle all4DSegments; diff --git a/CalibMuon/DTCalibration/plugins/DTVDriftSegmentCalibration.h b/CalibMuon/DTCalibration/plugins/DTVDriftSegmentCalibration.h index 398535a960acf..6361953a6552f 100644 --- a/CalibMuon/DTCalibration/plugins/DTVDriftSegmentCalibration.h +++ b/CalibMuon/DTCalibration/plugins/DTVDriftSegmentCalibration.h @@ -11,6 +11,8 @@ #include "FWCore/Framework/interface/EDAnalyzer.h" #include "FWCore/Utilities/interface/InputTag.h" #include "CalibMuon/DTCalibration/interface/DTSegmentSelector.h" +#include "Geometry/Records/interface/MuonGeometryRecord.h" +#include "Geometry/DTGeometry/interface/DTGeometry.h" #include @@ -45,5 +47,7 @@ class DTVDriftSegmentCalibration : public edm::EDAnalyzer { TFile* rootFile_; ChamberHistosMapTH1F theVDriftHistoMapTH1F_; ChamberHistosMapTH2F theVDriftHistoMapTH2F_; + + const edm::ESGetToken dtGeomToken_; }; #endif diff --git a/CalibMuon/DTCalibration/plugins/DTVDriftWriter.cc b/CalibMuon/DTCalibration/plugins/DTVDriftWriter.cc index 363cab5cf2cf3..380241d479518 100644 --- a/CalibMuon/DTCalibration/plugins/DTVDriftWriter.cc +++ b/CalibMuon/DTCalibration/plugins/DTVDriftWriter.cc @@ -33,11 +33,15 @@ using namespace std; using namespace edm; DTVDriftWriter::DTVDriftWriter(const ParameterSet& pset) - : granularity_(pset.getUntrackedParameter("calibGranularity", "bySL")), + : mTimeMapToken_(esConsumes()), + vDriftMapToken_(esConsumes()), + dtGeomToken_(esConsumes()), + granularity_(pset.getUntrackedParameter("calibGranularity", "bySL")), mTimeMap_(nullptr), vDriftMap_(nullptr), vDriftAlgo_{DTVDriftPluginFactory::get()->create(pset.getParameter("vDriftAlgo"), - pset.getParameter("vDriftAlgoConfig"))} { + pset.getParameter("vDriftAlgoConfig"), + consumesCollector())} { LogVerbatim("Calibration") << "[DTVDriftWriter]Constructor called!"; if (granularity_ != "bySL") @@ -53,13 +57,9 @@ DTVDriftWriter::~DTVDriftWriter() { LogVerbatim("Calibration") << "[DTVDriftWrit void DTVDriftWriter::beginRun(const edm::Run& run, const edm::EventSetup& setup) { // Get the map of vdrift from the Setup if (readLegacyVDriftDB) { - ESHandle mTime; - setup.get().get(mTime); - mTimeMap_ = &*mTime; + mTimeMap_ = &setup.getData(mTimeMapToken_); } else { - ESHandle hVdrift; - setup.get().get(hVdrift); - vDriftMap_ = &*hVdrift; + vDriftMap_ = &setup.getData(vDriftMapToken_); // Consistency check: no parametrization is implemented for the time being int version = vDriftMap_->version(); if (version != 1) { @@ -68,7 +68,8 @@ void DTVDriftWriter::beginRun(const edm::Run& run, const edm::EventSetup& setup) } // Get geometry from Event Setup - setup.get().get(dtGeom_); + dtGeom_ = setup.getHandle(dtGeomToken_); + // Pass EventSetup to concrete implementation vDriftAlgo_->setES(setup); } diff --git a/CalibMuon/DTCalibration/plugins/DTVDriftWriter.h b/CalibMuon/DTCalibration/plugins/DTVDriftWriter.h index a95c30059fcc9..c956f79f3b00d 100644 --- a/CalibMuon/DTCalibration/plugins/DTVDriftWriter.h +++ b/CalibMuon/DTCalibration/plugins/DTVDriftWriter.h @@ -12,6 +12,10 @@ #include "FWCore/Framework/interface/EDAnalyzer.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/Framework/interface/ESHandle.h" +#include "CondFormats/DataRecord/interface/DTMtimeRcd.h" +#include "CondFormats/DataRecord/interface/DTRecoConditionsVdriftRcd.h" +#include "Geometry/Records/interface/MuonGeometryRecord.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" #include @@ -33,8 +37,10 @@ class DTVDriftWriter : public edm::EDAnalyzer { void endJob() override; private: - std::string granularity_; // enforced by SL - + const edm::ESGetToken mTimeMapToken_; + const edm::ESGetToken vDriftMapToken_; + const edm::ESGetToken dtGeomToken_; + std::string granularity_; // enforced by SL const DTMtime* mTimeMap_; // legacy DB object const DTRecoConditions* vDriftMap_; // DB object in new format bool readLegacyVDriftDB; // which format to use to read old values diff --git a/CalibMuon/DTCalibration/plugins/SealModule.cc b/CalibMuon/DTCalibration/plugins/SealModule.cc index d82c14b088add..97f149efc0ccb 100644 --- a/CalibMuon/DTCalibration/plugins/SealModule.cc +++ b/CalibMuon/DTCalibration/plugins/SealModule.cc @@ -37,6 +37,7 @@ #include "CalibMuon/DTCalibration/plugins/DTT0FillChamberFromDB.h" #include "CalibMuon/DTCalibration/plugins/DTT0WireInChamberReferenceCorrection.h" #include "CalibMuon/DTCalibration/plugins/DTT0AbsoluteReferenceCorrection.h" +#include "CalibMuon/DTCalibration/plugins/DTT0FEBPathCorrection.h" #include "CalibMuon/DTCalibration/interface/DTVDriftPluginFactory.h" #include "CalibMuon/DTCalibration/plugins/DTVDriftMeanTimer.h" @@ -78,6 +79,7 @@ DEFINE_EDM_PLUGIN(DTT0CorrectionFactory, DEFINE_EDM_PLUGIN(DTT0CorrectionFactory, dtCalibration::DTT0AbsoluteReferenceCorrection, "DTT0AbsoluteReferenceCorrection"); +DEFINE_EDM_PLUGIN(DTT0CorrectionFactory, dtCalibration::DTT0FEBPathCorrection, "DTT0FEBPathCorrection"); DEFINE_EDM_PLUGIN(DTVDriftPluginFactory, dtCalibration::DTVDriftMeanTimer, "DTVDriftMeanTimer"); DEFINE_EDM_PLUGIN(DTVDriftPluginFactory, dtCalibration::DTVDriftSegment, "DTVDriftSegment"); diff --git a/CalibMuon/DTCalibration/python/dtT0AbsoluteReferenceCorrection_cfg.py b/CalibMuon/DTCalibration/python/dtT0AbsoluteReferenceCorrection_cfg.py index df27749ccbf8f..7b895cc5665f9 100644 --- a/CalibMuon/DTCalibration/python/dtT0AbsoluteReferenceCorrection_cfg.py +++ b/CalibMuon/DTCalibration/python/dtT0AbsoluteReferenceCorrection_cfg.py @@ -8,9 +8,6 @@ process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff") process.GlobalTag.globaltag = '' -#process.load("Configuration.StandardSequences.GeometryDB_cff") -#process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff") -#process.GlobalTag.globaltag = '' process.load("Configuration.StandardSequences.GeometryDB_cff") process.load("Configuration.StandardSequences.MagneticField_AutoFromDBCurrent_cff") process.load("Geometry.DTGeometry.dtGeometry_cfi") diff --git a/CalibMuon/DTCalibration/python/dtT0FillChamberFromDBCorrection_cfg.py b/CalibMuon/DTCalibration/python/dtT0FillChamberFromDBCorrection_cfg.py index 46c06cdab40c5..bb8ecfd76c566 100644 --- a/CalibMuon/DTCalibration/python/dtT0FillChamberFromDBCorrection_cfg.py +++ b/CalibMuon/DTCalibration/python/dtT0FillChamberFromDBCorrection_cfg.py @@ -7,6 +7,7 @@ process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff") process.GlobalTag.globaltag = '' + process.load("Configuration.StandardSequences.GeometryDB_cff") process.load("Configuration.StandardSequences.MagneticField_AutoFromDBCurrent_cff") process.load("Geometry.DTGeometry.dtGeometry_cfi") diff --git a/CalibMuon/DTCalibration/python/dtT0FillDefaultFromDBCorrection_cfg.py b/CalibMuon/DTCalibration/python/dtT0FillDefaultFromDBCorrection_cfg.py index 8c5e4b35c2069..82df6f51266b1 100644 --- a/CalibMuon/DTCalibration/python/dtT0FillDefaultFromDBCorrection_cfg.py +++ b/CalibMuon/DTCalibration/python/dtT0FillDefaultFromDBCorrection_cfg.py @@ -7,6 +7,7 @@ process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff") process.GlobalTag.globaltag = '' + process.load("Configuration.StandardSequences.GeometryDB_cff") process.load("Configuration.StandardSequences.MagneticField_AutoFromDBCurrent_cff") process.load("Geometry.DTGeometry.dtGeometry_cfi") diff --git a/CalibMuon/DTCalibration/python/dtTTrigCorrection_cfi.py b/CalibMuon/DTCalibration/python/dtTTrigCorrection_cfi.py index c056f91bba812..1730761d79a85 100644 --- a/CalibMuon/DTCalibration/python/dtTTrigCorrection_cfi.py +++ b/CalibMuon/DTCalibration/python/dtTTrigCorrection_cfi.py @@ -2,6 +2,7 @@ dtTTrigCorrection = cms.EDAnalyzer("DTTTrigCorrectionFirst", debug = cms.untracked.bool(False), + dbLabel = cms.untracked.string(''), ttrigMax = cms.untracked.double(700.0), ttrigMin = cms.untracked.double(200.0), rmsLimit = cms.untracked.double(8.) diff --git a/CalibMuon/DTCalibration/src/DTSegmentSelector.cc b/CalibMuon/DTCalibration/src/DTSegmentSelector.cc index a532bf07f30f2..708d0b1dd22ce 100644 --- a/CalibMuon/DTCalibration/src/DTSegmentSelector.cc +++ b/CalibMuon/DTCalibration/src/DTSegmentSelector.cc @@ -22,6 +22,7 @@ DTSegmentSelector::DTSegmentSelector(edm::ParameterSet const& pset, edm::Consume maxAnglePhi_(pset.getParameter("maxAnglePhi")), maxAngleZ_(pset.getParameter("maxAngleZ")) { muonToken_ = iC.consumes(muonTags_); + theStatusMapToken_ = iC.esConsumes(); } bool DTSegmentSelector::operator()(DTRecSegment4D const& segment, @@ -68,7 +69,7 @@ bool DTSegmentSelector::operator()(DTRecSegment4D const& segment, edm::ESHandle statusMap; if (checkNoisyChannels_) - setup.get().get(statusMap); + statusMap = setup.getHandle(theStatusMapToken_); // Get the Phi 2D segment int nPhiHits = -1; diff --git a/CalibMuon/DTCalibration/test/DBTools/DTT0Analyzer.cc b/CalibMuon/DTCalibration/test/DBTools/DTT0Analyzer.cc index a3549865b8592..5a3f5a3920a80 100644 --- a/CalibMuon/DTCalibration/test/DBTools/DTT0Analyzer.cc +++ b/CalibMuon/DTCalibration/test/DBTools/DTT0Analyzer.cc @@ -25,18 +25,19 @@ DTT0Analyzer::DTT0Analyzer(const ParameterSet& pset) { string rootFileName = pset.getUntrackedParameter("rootFileName"); theFile = new TFile(rootFileName.c_str(), "RECREATE"); theFile->cd(); + t0Token_ = esConsumes(); + dtGeomToken_ = esConsumes(); } DTT0Analyzer::~DTT0Analyzer() { theFile->Close(); } void DTT0Analyzer::beginRun(const edm::Run&, const edm::EventSetup& eventSetup) { //Get the t0 map from the DB - ESHandle t0; - eventSetup.get().get(t0); + ESHandle t0 = eventSetup.getHandle(t0Token_); tZeroMap = &*t0; // Get the DT Geometry - eventSetup.get().get(dtGeom); + dtGeom = eventSetup.getHandle(dtGeomToken_); } void DTT0Analyzer::endJob() { diff --git a/CalibMuon/DTCalibration/test/DBTools/DTT0Analyzer.h b/CalibMuon/DTCalibration/test/DBTools/DTT0Analyzer.h index aa1571534fc2e..a1bd8d8fbe835 100644 --- a/CalibMuon/DTCalibration/test/DBTools/DTT0Analyzer.h +++ b/CalibMuon/DTCalibration/test/DBTools/DTT0Analyzer.h @@ -10,9 +10,13 @@ #include "FWCore/Framework/interface/Frameworkfwd.h" #include "FWCore/Framework/interface/EDAnalyzer.h" #include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/Utilities/interface/ESGetToken.h" #include "DataFormats/MuonDetId/interface/DTLayerId.h" #include "DataFormats/MuonDetId/interface/DTWireId.h" #include "Geometry/DTGeometry/interface/DTGeometry.h" +#include "CondFormats/DataRecord/interface/DTT0Rcd.h" +#include "CondFormats/DTObjects/interface/DTT0.h" +#include "Geometry/Records/interface/MuonGeometryRecord.h" #include #include @@ -53,5 +57,8 @@ class DTT0Analyzer : public edm::EDAnalyzer { // Map of the t0 and sigma histos by layer std::map theMeanHistoMap; std::map theSigmaHistoMap; + + edm::ESGetToken t0Token_; + edm::ESGetToken dtGeomToken_; }; #endif diff --git a/CalibMuon/DTCalibration/test/DBTools/DTTTrigAnalyzer.cc b/CalibMuon/DTCalibration/test/DBTools/DTTTrigAnalyzer.cc index 510215c6e3ef8..94233b3457101 100644 --- a/CalibMuon/DTCalibration/test/DBTools/DTTTrigAnalyzer.cc +++ b/CalibMuon/DTCalibration/test/DBTools/DTTTrigAnalyzer.cc @@ -26,14 +26,14 @@ DTTTrigAnalyzer::DTTTrigAnalyzer(const ParameterSet &pset) { theFile->cd(); //The k factor to compute ttrig //kfactor = pset.getUntrackedParameter("kfactor",0); - dbLabel = pset.getUntrackedParameter("dbLabel", ""); + ttrigToken_ = + esConsumes(edm::ESInputTag("", pset.getUntrackedParameter("dbLabel"))); } DTTTrigAnalyzer::~DTTTrigAnalyzer() { theFile->Close(); } void DTTTrigAnalyzer::beginRun(const edm::Run &, const edm::EventSetup &eventSetup) { - ESHandle tTrig; - eventSetup.get().get(dbLabel, tTrig); + ESHandle tTrig = eventSetup.getHandle(ttrigToken_); tTrigMap = &*tTrig; cout << "[DTTTrigAnalyzer] TTrig version: " << tTrig->version() << endl; } diff --git a/CalibMuon/DTCalibration/test/DBTools/DTTTrigAnalyzer.h b/CalibMuon/DTCalibration/test/DBTools/DTTTrigAnalyzer.h index 518afcf3b9283..7ae652f207f43 100644 --- a/CalibMuon/DTCalibration/test/DBTools/DTTTrigAnalyzer.h +++ b/CalibMuon/DTCalibration/test/DBTools/DTTTrigAnalyzer.h @@ -11,6 +11,7 @@ #include "FWCore/Framework/interface/EDAnalyzer.h" #include "FWCore/Framework/interface/ESHandle.h" #include "DataFormats/MuonDetId/interface/DTWireId.h" +#include "CondFormats/DataRecord/interface/DTTtrigRcd.h" #include #include @@ -47,8 +48,6 @@ class DTTTrigAnalyzer : public edm::EDAnalyzer { //The t0 map const DTTtrig* tTrigMap; - std::string dbLabel; - //The k factor //double kfactor; @@ -62,5 +61,7 @@ class DTTTrigAnalyzer : public edm::EDAnalyzer { std::map, TH1D*> theTMeanDistribMap; std::map, TH1D*> theSigmaDistribMap; std::map, TH1D*> theKFactorDistribMap; + + edm::ESGetToken ttrigToken_; }; #endif diff --git a/CalibMuon/DTCalibration/test/DBTools/DTVDriftAnalyzer.cc b/CalibMuon/DTCalibration/test/DBTools/DTVDriftAnalyzer.cc index 6bd906fb2cb6d..91b191112198e 100644 --- a/CalibMuon/DTCalibration/test/DBTools/DTVDriftAnalyzer.cc +++ b/CalibMuon/DTCalibration/test/DBTools/DTVDriftAnalyzer.cc @@ -28,20 +28,20 @@ DTVDriftAnalyzer::DTVDriftAnalyzer(const ParameterSet& pset) string rootFileName = pset.getUntrackedParameter("rootFileName"); theFile = new TFile(rootFileName.c_str(), "RECREATE"); theFile->cd(); + mTimeMapToken_ = esConsumes(); + vDriftMapToken_ = esConsumes(); } DTVDriftAnalyzer::~DTVDriftAnalyzer() { theFile->Close(); } void DTVDriftAnalyzer::beginRun(const edm::Run& run, const edm::EventSetup& eventSetup) { if (readLegacyVDriftDB) { - ESHandle mTime; - eventSetup.get().get(mTime); + ESHandle mTime = eventSetup.getHandle(mTimeMapToken_); mTimeMap = &*mTime; vDriftMap_ = nullptr; edm::LogVerbatim("DTVDriftAnalyzer") << "[DTVDriftAnalyzer] MTime version: " << mTime->version() << endl; } else { - ESHandle hVdrift; - eventSetup.get().get(hVdrift); + ESHandle hVdrift = eventSetup.getHandle(vDriftMapToken_); vDriftMap_ = &*hVdrift; mTimeMap = nullptr; // Consistency check: no parametrization is implemented for the time being diff --git a/CalibMuon/DTCalibration/test/DBTools/DTVDriftAnalyzer.h b/CalibMuon/DTCalibration/test/DBTools/DTVDriftAnalyzer.h index e6c85041f5c78..bb48ee5c9ce5a 100644 --- a/CalibMuon/DTCalibration/test/DBTools/DTVDriftAnalyzer.h +++ b/CalibMuon/DTCalibration/test/DBTools/DTVDriftAnalyzer.h @@ -11,6 +11,8 @@ #include "FWCore/Framework/interface/EDAnalyzer.h" #include "FWCore/Framework/interface/ESHandle.h" #include "DataFormats/MuonDetId/interface/DTWireId.h" +#include "CondFormats/DataRecord/interface/DTMtimeRcd.h" +#include "CondFormats/DataRecord/interface/DTRecoConditionsVdriftRcd.h" #include #include @@ -56,5 +58,8 @@ class DTVDriftAnalyzer : public edm::EDAnalyzer { // Map of the vdrift, reso distributions by wheel/station/SL std::map, TH1D*> theVDriftDistribMap; std::map, TH1D*> theResoDistribMap; + + edm::ESGetToken mTimeMapToken_; + edm::ESGetToken vDriftMapToken_; }; #endif diff --git a/CalibMuon/DTCalibration/test/DBTools/DumpDBToFile.cc b/CalibMuon/DTCalibration/test/DBTools/DumpDBToFile.cc index 11bd0ff22ad49..aba5fa193fde8 100644 --- a/CalibMuon/DTCalibration/test/DBTools/DumpDBToFile.cc +++ b/CalibMuon/DTCalibration/test/DBTools/DumpDBToFile.cc @@ -15,24 +15,6 @@ #include "FWCore/Utilities/interface/Exception.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "CondFormats/DTObjects/interface/DTMtime.h" -#include "CondFormats/DataRecord/interface/DTMtimeRcd.h" -#include "CondFormats/DTObjects/interface/DTTtrig.h" -#include "CondFormats/DataRecord/interface/DTTtrigRcd.h" -#include "CondFormats/DTObjects/interface/DTT0.h" -#include "CondFormats/DataRecord/interface/DTT0Rcd.h" -#include "CondFormats/DataRecord/interface/DTStatusFlagRcd.h" -#include "CondFormats/DTObjects/interface/DTStatusFlag.h" -#include "CondFormats/DataRecord/interface/DTDeadFlagRcd.h" -#include "CondFormats/DTObjects/interface/DTDeadFlag.h" -#include "CondFormats/DataRecord/interface/DTReadOutMappingRcd.h" -#include "CondFormats/DTObjects/interface/DTReadOutMapping.h" -#include "CondFormats/DataRecord/interface/DTRecoUncertaintiesRcd.h" -#include "CondFormats/DTObjects/interface/DTRecoUncertainties.h" -#include "CondFormats/DTObjects/interface/DTRecoConditions.h" -#include "CondFormats/DataRecord/interface/DTRecoConditionsTtrigRcd.h" -#include "CondFormats/DataRecord/interface/DTRecoConditionsVdriftRcd.h" -#include "CondFormats/DataRecord/interface/DTRecoConditionsUncertRcd.h" #include #include #include @@ -55,6 +37,30 @@ DumpDBToFile::DumpDBToFile(const ParameterSet& pset) { if (format != "Legacy" && format != "DTRecoConditions") throw cms::Exception("IncorrectSetup") << "Parameter format is not valid, check the cfg file" << endl; + + if (dbToDump == "VDriftDB") { + if (format == "Legacy") { + mTimeMapToken_ = esConsumes(); + } else { + vDriftToken_ = esConsumes(); + } + } else if (dbToDump == "TTrigDB") { + if (format == "Legacy") { + tTrigMapToken_ = esConsumes(); + } else { + tTrigToken_ = esConsumes(); + } + } else if (dbToDump == "TZeroDB") { + t0MapToken_ = esConsumes(); + } else if (dbToDump == "NoiseDB") { + statusMapToken_ = esConsumes(); + } else if (dbToDump == "DeadDB") { + deadMapToken_ = esConsumes(); + } else if (dbToDump == "ChannelsDB") { + readOutMapToken_ = esConsumes(); + } else if (dbToDump == "RecoUncertDB") { + uncertToken_ = esConsumes(); + } } DumpDBToFile::~DumpDBToFile() {} @@ -63,50 +69,26 @@ void DumpDBToFile::beginRun(const edm::Run&, const EventSetup& setup) { // Read the right DB accordingly to the parameter dbToDump if (dbToDump == "VDriftDB") { if (format == "Legacy") { - ESHandle mTime; - setup.get().get(mTime); - mTimeMap = &*mTime; + mTimeMap = &setup.getData(mTimeMapToken_); } else if (format == "DTRecoConditions") { - ESHandle h_rconds; - setup.get().get(h_rconds); - rconds = &*h_rconds; + rconds = &setup.getData(vDriftToken_); } } else if (dbToDump == "TTrigDB") { if (format == "Legacy") { - ESHandle tTrig; - setup.get().get(dbLabel, tTrig); - tTrigMap = &*tTrig; + tTrigMap = &setup.getData(tTrigMapToken_); } else if (format == "DTRecoConditions") { - ESHandle h_rconds; - setup.get().get(h_rconds); - rconds = &*h_rconds; + rconds = &setup.getData(tTrigToken_); } } else if (dbToDump == "TZeroDB") { - ESHandle t0; - setup.get().get(t0); - tZeroMap = &*t0; + tZeroMap = &setup.getData(t0MapToken_); } else if (dbToDump == "NoiseDB") { - ESHandle status; - setup.get().get(status); - statusMap = &*status; + statusMap = &setup.getData(statusMapToken_); } else if (dbToDump == "DeadDB") { - ESHandle dead; - setup.get().get(dead); - deadMap = &*dead; + deadMap = &setup.getData(deadMapToken_); } else if (dbToDump == "ChannelsDB") { - ESHandle channels; - setup.get().get(channels); - channelsMap = &*channels; + channelsMap = &setup.getData(readOutMapToken_); } else if (dbToDump == "RecoUncertDB") { - if (format == "Legacy") { - ESHandle uncerts; - setup.get().get(uncerts); - uncertMap = &*uncerts; - } else if (format == "DTRecoConditions") { - ESHandle h_rconds; - setup.get().get(h_rconds); - rconds = &*h_rconds; - } + rconds = &setup.getData(uncertToken_); } } @@ -245,7 +227,7 @@ void DumpDBToFile::endJob() { float t0rms; // t0s and rms are TDC counts tZeroMap->get(wireId, t0mean, t0rms, DTTimeUnits::counts); - cout << wireId << " TZero mean (TDC counts): " << t0mean << " TZero RMS (TDC counts): " << t0rms << endl; + // cout << wireId << " TZero mean (TDC counts): " << t0mean << " TZero RMS (TDC counts): " << t0rms << endl; vector consts; consts.push_back(-1); consts.push_back(-1); @@ -302,42 +284,23 @@ void DumpDBToFile::endJob() { //---------- Uncertainties } else if (dbToDump == "RecoUncertDB") { - if (format == "Legacy") { - int version = 1; - int type = 2; // par[step] - cout << "RecoUncertDB version: " << uncertMap->version() << endl; - for (DTRecoUncertainties::const_iterator wireAndUncerts = uncertMap->begin(); - wireAndUncerts != uncertMap->end(); - ++wireAndUncerts) { - DTWireId wireId((*wireAndUncerts).first); - vector values = (*wireAndUncerts).second; - // cout << wireId; - // copy(values.begin(), values.end(), ostream_iterator(cout, " cm, ")); - // cout << endl; - int nfields = values.size(); - vector consts = {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, float(version * 1000 + type * 100 + nfields)}; - consts.insert(consts.end(), values.begin(), values.end()); - theCalibFile->addCell(wireId, consts); - } - } else if (format == "DTRecoConditions") { - int version = rconds->version(); - string expr = rconds->getFormulaExpr(); - int type = 2; // par[step] - if (version != 1 || expr != "par[step]") - throw cms::Exception("Configuration") << "only version 1, type 2 is presently supported for RecoUncertDB"; + int version = rconds->version(); + string expr = rconds->getFormulaExpr(); + int type = 2; // par[step] + if (version != 1 || expr != "par[step]") + throw cms::Exception("Configuration") << "only version 1, type 2 is presently supported for RecoUncertDB"; - cout << "[DumpDBToFile] DTRecoConditions (uncerts) version: " << rconds->version() << " expression: " << expr - << endl; + cout << "[DumpDBToFile] DTRecoConditions (uncerts) version: " << rconds->version() << " expression: " << expr + << endl; - for (DTRecoConditions::const_iterator irc = rconds->begin(); irc != rconds->end(); ++irc) { - DTWireId wireId(irc->first); - const vector& data = irc->second; - int nfields = data.size(); - vector consts(11 + nfields, -1); - consts[10] = float(version * 1000 + type * 100 + nfields); - std::copy(data.begin(), data.end(), consts.begin() + 11); - theCalibFile->addCell(wireId, consts); - } + for (DTRecoConditions::const_iterator irc = rconds->begin(); irc != rconds->end(); ++irc) { + DTWireId wireId(irc->first); + const vector& data = irc->second; + int nfields = data.size(); + vector consts(11 + nfields, -1); + consts[10] = float(version * 1000 + type * 100 + nfields); + std::copy(data.begin(), data.end(), consts.begin() + 11); + theCalibFile->addCell(wireId, consts); } } //Write constants into file diff --git a/CalibMuon/DTCalibration/test/DBTools/DumpDBToFile.h b/CalibMuon/DTCalibration/test/DBTools/DumpDBToFile.h index 21ca867d6a64c..c71f3088c4671 100644 --- a/CalibMuon/DTCalibration/test/DBTools/DumpDBToFile.h +++ b/CalibMuon/DTCalibration/test/DBTools/DumpDBToFile.h @@ -10,44 +10,64 @@ */ #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" + +#include "CondFormats/DTObjects/interface/DTMtime.h" +#include "CondFormats/DataRecord/interface/DTMtimeRcd.h" +#include "CondFormats/DTObjects/interface/DTTtrig.h" +#include "CondFormats/DataRecord/interface/DTTtrigRcd.h" +#include "CondFormats/DTObjects/interface/DTT0.h" +#include "CondFormats/DataRecord/interface/DTT0Rcd.h" +#include "CondFormats/DataRecord/interface/DTStatusFlagRcd.h" +#include "CondFormats/DTObjects/interface/DTStatusFlag.h" +#include "CondFormats/DataRecord/interface/DTDeadFlagRcd.h" +#include "CondFormats/DTObjects/interface/DTDeadFlag.h" +#include "CondFormats/DataRecord/interface/DTReadOutMappingRcd.h" +#include "CondFormats/DTObjects/interface/DTReadOutMapping.h" +#include "CondFormats/DTObjects/interface/DTRecoConditions.h" +#include "CondFormats/DataRecord/interface/DTRecoConditionsTtrigRcd.h" +#include "CondFormats/DataRecord/interface/DTRecoConditionsVdriftRcd.h" +#include "CondFormats/DataRecord/interface/DTRecoConditionsUncertRcd.h" #include -class DTMtime; -class DTTtrig; -class DTT0; -class DTStatusFlag; -class DTDeadFlag; class DTCalibrationMap; -class DTReadOutMapping; -class DTRecoUncertainties; -class DTRecoConditions; -class DumpDBToFile : public edm::EDAnalyzer { +class DumpDBToFile : public edm::one::EDAnalyzer { public: /// Constructor DumpDBToFile(const edm::ParameterSet &pset); /// Destructor - virtual ~DumpDBToFile(); + ~DumpDBToFile() override; // Operations - virtual void beginRun(const edm::Run &run, const edm::EventSetup &setup); + void beginRun(const edm::Run &run, const edm::EventSetup &setup) override; + + void endRun(const edm::Run &run, const edm::EventSetup &setup) override {} - virtual void analyze(const edm::Event &event, const edm::EventSetup &setup) {} + void analyze(const edm::Event &event, const edm::EventSetup &setup) override {} - virtual void endJob(); + void endJob() override; protected: private: + edm::ESGetToken mTimeMapToken_; + edm::ESGetToken tTrigMapToken_; + edm::ESGetToken t0MapToken_; + edm::ESGetToken statusMapToken_; + edm::ESGetToken deadMapToken_; + edm::ESGetToken readOutMapToken_; + edm::ESGetToken tTrigToken_; + edm::ESGetToken vDriftToken_; + edm::ESGetToken uncertToken_; + const DTMtime *mTimeMap; const DTTtrig *tTrigMap; const DTT0 *tZeroMap; const DTStatusFlag *statusMap; const DTDeadFlag *deadMap; const DTReadOutMapping *channelsMap; - const DTRecoUncertainties *uncertMap; const DTRecoConditions *rconds; DTCalibrationMap *theCalibFile; diff --git a/CalibMuon/DTCalibration/test/DBTools/DumpFileToDB.cc b/CalibMuon/DTCalibration/test/DBTools/DumpFileToDB.cc index 9a031b469f312..f148f18aa09d9 100644 --- a/CalibMuon/DTCalibration/test/DBTools/DumpFileToDB.cc +++ b/CalibMuon/DTCalibration/test/DBTools/DumpFileToDB.cc @@ -24,7 +24,6 @@ #include "CondFormats/DTObjects/interface/DTStatusFlag.h" #include "CondFormats/DTObjects/interface/DTDeadFlag.h" #include "CondFormats/DTObjects/interface/DTReadOutMapping.h" -#include "CondFormats/DTObjects/interface/DTRecoUncertainties.h" #include "CondFormats/DTObjects/interface/DTRecoConditions.h" #include "CondFormats/DataRecord/interface/DTRecoConditionsTtrigRcd.h" #include "CondFormats/DataRecord/interface/DTRecoConditionsVdriftRcd.h" @@ -37,6 +36,7 @@ using namespace std; DumpFileToDB::DumpFileToDB(const ParameterSet& pset) { dbToDump = pset.getUntrackedParameter("dbToDump", "TTrigDB"); format = pset.getUntrackedParameter("dbFormat", "Legacy"); + ttrigToken_ = esConsumes(); cout << "Writing DB: " << dbToDump << " with format: " << format << endl; @@ -268,43 +268,27 @@ void DumpFileToDB::endJob() { //---------- Uncertainties } else if (dbToDump == "RecoUncertDB") { // Write the Uncertainties - if (format == "Legacy") { - DTRecoUncertainties* uncert = new DTRecoUncertainties(); - int version = 1; // Uniform uncertainties per SL and step; parameters 0-3 are for steps 1-4. - uncert->setVersion(version); - // Loop over file entries - for (DTCalibrationMap::const_iterator keyAndCalibs = theCalibFile->keyAndConsts_begin(); - keyAndCalibs != theCalibFile->keyAndConsts_end(); - ++keyAndCalibs) { - vector values = (*keyAndCalibs).second; - vector uncerts(values.begin() + 11, values.end()); - uncert->set((*keyAndCalibs).first, uncerts); - } - DTCalibDBUtils::writeToDB("DTRecoUncertaintiesRcd", uncert); - - } else if (format == "DTRecoConditions") { - DTRecoConditions* conds = new DTRecoConditions(); - conds->setFormulaExpr("par[step]"); - int version = 1; // Uniform uncertainties per SL and step; parameters 0-3 are for steps 1-4. - conds->setVersion(version); - - for (DTCalibrationMap::const_iterator keyAndCalibs = theCalibFile->keyAndConsts_begin(); - keyAndCalibs != theCalibFile->keyAndConsts_end(); - ++keyAndCalibs) { - vector values = (*keyAndCalibs).second; - int fversion = int(values[10] / 1000); - int type = (int(values[10]) % 1000) / 100; - int nfields = int(values[10]) % 100; - if (type != 2) - throw cms::Exception("IncorrectSetup") << "Only type==2 supported for uncertainties DB"; - if (values.size() != unsigned(nfields + 11)) - throw cms::Exception("IncorrectSetup") << "Inconsistent number of fields"; - if (fversion != version) - throw cms::Exception("IncorrectSetup") << "Inconsistent version of file"; + DTRecoConditions* conds = new DTRecoConditions(); + conds->setFormulaExpr("par[step]"); + int version = 1; // Uniform uncertainties per SL and step; parameters 0-3 are for steps 1-4. + conds->setVersion(version); - vector params(values.begin() + 11, values.begin() + 11 + nfields); - conds->set((*keyAndCalibs).first, params); - } + for (DTCalibrationMap::const_iterator keyAndCalibs = theCalibFile->keyAndConsts_begin(); + keyAndCalibs != theCalibFile->keyAndConsts_end(); + ++keyAndCalibs) { + vector values = (*keyAndCalibs).second; + int fversion = int(values[10] / 1000); + int type = (int(values[10]) % 1000) / 100; + int nfields = int(values[10]) % 100; + if (type != 2) + throw cms::Exception("IncorrectSetup") << "Only type==2 supported for uncertainties DB"; + if (values.size() != unsigned(nfields + 11)) + throw cms::Exception("IncorrectSetup") << "Inconsistent number of fields"; + if (fversion != version) + throw cms::Exception("IncorrectSetup") << "Inconsistent version of file"; + + vector params(values.begin() + 11, values.begin() + 11 + nfields); + conds->set((*keyAndCalibs).first, params); DTCalibDBUtils::writeToDB("DTRecoConditionsUncertRcd", conds); } } @@ -346,8 +330,7 @@ vector DumpFileToDB::readChannelsMap(stringstream& linestr) { void DumpFileToDB::beginRun(const edm::Run& run, const edm::EventSetup& setup) { if (diffMode) { if (dbToDump == "TTrigDB") { // read the original DB - ESHandle tTrig; - setup.get().get(tTrig); + ESHandle tTrig = setup.getHandle(ttrigToken_); tTrigMapOrig = &*tTrig; cout << "[DumpDBToFile] TTrig version: " << tTrig->version() << endl; } diff --git a/CalibMuon/DTCalibration/test/DBTools/DumpFileToDB.h b/CalibMuon/DTCalibration/test/DBTools/DumpFileToDB.h index 82dc157111db3..ff655b5effc05 100644 --- a/CalibMuon/DTCalibration/test/DBTools/DumpFileToDB.h +++ b/CalibMuon/DTCalibration/test/DBTools/DumpFileToDB.h @@ -10,7 +10,8 @@ */ #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" +#include "CondFormats/DataRecord/interface/DTTtrigRcd.h" #include #include @@ -19,21 +20,22 @@ class DTCalibrationMap; class DTTtrig; -class DumpFileToDB : public edm::EDAnalyzer { +class DumpFileToDB : public edm::one::EDAnalyzer { public: /// Constructor DumpFileToDB(const edm::ParameterSet& pset); /// Destructor - virtual ~DumpFileToDB(); + ~DumpFileToDB() override; // Operations - // Operations - virtual void beginRun(const edm::Run& run, const edm::EventSetup& setup); + void beginRun(const edm::Run& run, const edm::EventSetup& setup) override; + + void endRun(const edm::Run& run, const edm::EventSetup& setup) override {} - virtual void analyze(const edm::Event& event, const edm::EventSetup& setup) {} + void analyze(const edm::Event& event, const edm::EventSetup& setup) override {} - virtual void endJob(); + void endJob() override; protected: private: @@ -48,5 +50,7 @@ class DumpFileToDB : public edm::EDAnalyzer { // sum the correction in the txt file (for the mean value) to what is input DB bool diffMode; const DTTtrig* tTrigMapOrig; + + edm::ESGetToken ttrigToken_; }; #endif diff --git a/CalibMuon/DTCalibration/test/DBTools/FakeTTrig.cc b/CalibMuon/DTCalibration/test/DBTools/FakeTTrig.cc index 003584fc7d5c3..943de2b2fdf23 100644 --- a/CalibMuon/DTCalibration/test/DBTools/FakeTTrig.cc +++ b/CalibMuon/DTCalibration/test/DBTools/FakeTTrig.cc @@ -44,8 +44,9 @@ FakeTTrig::FakeTTrig(const ParameterSet& pset) : dataBaseWriteWasDone(false) { // further configurable smearing smearing = pset.getUntrackedParameter("smearing"); - dbLabel = pset.getUntrackedParameter("dbLabel", ""); - + ttrigToken_ = + esConsumes(edm::ESInputTag("", pset.getUntrackedParameter("dbLabel"))); + dtGeomToken_ = esConsumes(); // get random engine edm::Service rng; if (!rng.isAvailable()) { @@ -58,11 +59,11 @@ FakeTTrig::~FakeTTrig() { cout << "[FakeTTrig] Destructor called! " << endl; } void FakeTTrig::beginRun(const edm::Run&, const EventSetup& setup) { cout << "[FakeTTrig] entered into beginRun! " << endl; - setup.get().get(muonGeom); + muonGeom = setup.getHandle(dtGeomToken_); // Get the tTrig reference map if (ps.getUntrackedParameter("readDB", true)) - setup.get().get(dbLabel, tTrigMapRef); + tTrigMapRef = setup.getHandle(ttrigToken_); } void FakeTTrig::beginLuminosityBlock(edm::LuminosityBlock const& lumi, edm::EventSetup const&) { diff --git a/CalibMuon/DTCalibration/test/DBTools/FakeTTrig.h b/CalibMuon/DTCalibration/test/DBTools/FakeTTrig.h index 696d60753b4c1..828e7d471b537 100644 --- a/CalibMuon/DTCalibration/test/DBTools/FakeTTrig.h +++ b/CalibMuon/DTCalibration/test/DBTools/FakeTTrig.h @@ -15,7 +15,9 @@ #include "FWCore/Framework/interface/EDAnalyzer.h" #include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" - +#include "Geometry/Records/interface/MuonGeometryRecord.h" +#include "Geometry/DTGeometry/interface/DTGeometry.h" +#include "CondFormats/DataRecord/interface/DTTtrigRcd.h" #include class DTGeometry; class DTSuperLayer; @@ -47,8 +49,6 @@ class FakeTTrig : public edm::EDAnalyzer { double smearing; - std::string dbLabel; - /// tTrig from the DB float tTrigRef; float tTrigRMSRef; @@ -58,5 +58,8 @@ class FakeTTrig : public edm::EDAnalyzer { edm::ESHandle tTrigMapRef; bool dataBaseWriteWasDone; + + edm::ESGetToken ttrigToken_; + edm::ESGetToken dtGeomToken_; }; #endif diff --git a/CalibMuon/DTCalibration/test/DBTools/ShiftTTrigDB.cc b/CalibMuon/DTCalibration/test/DBTools/ShiftTTrigDB.cc index 3b19e774bcc94..eb6d1c588861f 100644 --- a/CalibMuon/DTCalibration/test/DBTools/ShiftTTrigDB.cc +++ b/CalibMuon/DTCalibration/test/DBTools/ShiftTTrigDB.cc @@ -30,7 +30,10 @@ ShiftTTrigDB::ShiftTTrigDB(const ParameterSet& pset) { shifts = pset.getParameter >("shifts"); //Read the chambers to be shifted vector parameters = pset.getParameter >("chambers"); - dbLabel = pset.getUntrackedParameter("dbLabel", ""); + + ttrigToken_ = + esConsumes(edm::ESInputTag("", pset.getUntrackedParameter("dbLabel"))); + dtGeomToken_ = esConsumes(); int counter = 0; for (vector::iterator parameter = parameters.begin(); parameter != parameters.end(); ++parameter) { @@ -55,12 +58,10 @@ ShiftTTrigDB::ShiftTTrigDB(const ParameterSet& pset) { ShiftTTrigDB::~ShiftTTrigDB() {} void ShiftTTrigDB::beginRun(const edm::Run&, const EventSetup& setup) { - ESHandle tTrig; - setup.get().get(dbLabel, tTrig); + ESHandle tTrig = setup.getHandle(ttrigToken_); tTrigMap = &*tTrig; cout << "[ShiftTTrigDB]: TTrig version: " << tTrig->version() << endl; - - setup.get().get(muonGeom); + muonGeom = setup.getHandle(dtGeomToken_); } void ShiftTTrigDB::endJob() { diff --git a/CalibMuon/DTCalibration/test/DBTools/ShiftTTrigDB.h b/CalibMuon/DTCalibration/test/DBTools/ShiftTTrigDB.h index ba1a15b779432..a6429e231b057 100644 --- a/CalibMuon/DTCalibration/test/DBTools/ShiftTTrigDB.h +++ b/CalibMuon/DTCalibration/test/DBTools/ShiftTTrigDB.h @@ -11,6 +11,9 @@ #include "FWCore/Framework/interface/Frameworkfwd.h" #include "FWCore/Framework/interface/EDAnalyzer.h" #include "FWCore/Framework/interface/ESHandle.h" +#include "Geometry/Records/interface/MuonGeometryRecord.h" +#include "Geometry/DTGeometry/interface/DTGeometry.h" +#include "CondFormats/DataRecord/interface/DTTtrigRcd.h" #include #include @@ -40,11 +43,12 @@ class ShiftTTrigDB : public edm::EDAnalyzer { const DTTtrig* tTrigMap; edm::ESHandle muonGeom; - std::string dbLabel; - std::vector > chambers; std::vector shifts; std::map, double> mapShiftsByChamber; bool debug; + + edm::ESGetToken ttrigToken_; + edm::ESGetToken dtGeomToken_; }; #endif diff --git a/CalibMuon/DTCalibration/test/DumpDBToFile_cfg.py b/CalibMuon/DTCalibration/test/DumpDBToFile_cfg.py index 609564a561761..fa3076bb38774 100644 --- a/CalibMuon/DTCalibration/test/DumpDBToFile_cfg.py +++ b/CalibMuon/DTCalibration/test/DumpDBToFile_cfg.py @@ -14,7 +14,7 @@ 'TTrigDB', #default value VarParsing.VarParsing.multiplicity.singleton, VarParsing.VarParsing.varType.string, - "Database to read: 'TZeroDB', 'TTrigDB', 'VDriftDB', or 'UncertDB'") + "Database to read: 'TZeroDB', 'TTrigDB', 'VDriftDB', 'UncertDB', 'NoiseDB', 'DeadDB', 'ChannelsDB'") options.register('GT', 'auto:run2_data', #default value @@ -58,7 +58,7 @@ print('\nERROR: invalid value for dbformat: ', DBFORMAT,'\n') exit() -if TYPE not in ['TZeroDB', 'TTrigDB', 'VDriftDB', 'UncertDB'] : +if TYPE not in ['TZeroDB', 'TTrigDB', 'VDriftDB', 'UncertDB', 'NoiseDB', 'DeadDB', 'ChannelsDB'] : print('\nERROR: invalid value for type: ', TYPE,'\n') exit() @@ -73,7 +73,10 @@ ofExt = {'TZeroDB' : '_t0.txt', 'TTrigDB' : '_ttrig.txt', 'VDriftDB' : '_vdrift.txt', - 'UncertDB' : '_uncert.txt'} + 'UncertDB' : '_uncert.txt', + 'NoiseDB' : '_noise.txt', + 'DeadDB' : '_dead.txt', + 'ChannelsDB' : '_channels.txt'} if INPUTFILE!="": @@ -94,14 +97,18 @@ if TYPE=="TTrigDB" : RECORD = "DTTtrigRcd" if TYPE=="VDriftDB" : RECORD = "DTMtimeRcd" if TYPE=="UncertDB" : - RECORD = "DTRecoUncertaintiesRcd" - print('\nWARNING, Legacy RecoUncertDB is deprecated, as it is no longer used in reconstruction code') + RECORD = "" + print('\nERROR, Legacy RecoUncertDB is no longer supported') elif DBFORMAT=="DTRecoConditions" : if TYPE=="TTrigDB" : RECORD = "DTRecoConditionsTtrigRcd" if TYPE=="VDriftDB" : RECORD = "DTRecoConditionsVdriftRcd" if TYPE=="UncertDB" : RECORD = "DTRecoConditionsUncertRcd" +if TYPE == 'NoiseDB' : RECORD = 'DTStatusFlagRcd' +elif TYPE == 'DeadDB' : RECORD = 'DTDeadFlagRcd' +elif TYPE == 'ChannelsDB' : RECORD = 'DTReadOutMappingRcd' + process = cms.Process("DumpDBToFile") process.load("CondCore.CondDB.CondDB_cfi") @@ -203,10 +210,47 @@ outputFileName = cms.untracked.string(OUTPUTFILE) ) +process.dumpNoiseToFile = cms.EDAnalyzer("DumpDBToFile", + dbToDump = cms.untracked.string('NoiseDB'), + dbLabel = cms.untracked.string(''), + dbFormat = cms.untracked.string(DBFORMAT), + calibFileConfig = cms.untracked.PSet( + nFields = cms.untracked.int32(8), + calibConstGranularity = cms.untracked.string('byWire') + ), + outputFileName = cms.untracked.string(OUTPUTFILE) +) + +process.dumpDeadToFile = cms.EDAnalyzer("DumpDBToFile", + dbToDump = cms.untracked.string('DeadDB'), + dbLabel = cms.untracked.string(''), + dbFormat = cms.untracked.string(DBFORMAT), + calibFileConfig = cms.untracked.PSet( + nFields = cms.untracked.int32(8), + calibConstGranularity = cms.untracked.string('byWire') + ), + outputFileName = cms.untracked.string(OUTPUTFILE) +) + +process.dumpChannelsToFile = cms.EDAnalyzer("DumpDBToFile", + dbToDump = cms.untracked.string('ChannelsDB'), + dbLabel = cms.untracked.string(''), + dbFormat = cms.untracked.string(DBFORMAT), + calibFileConfig = cms.untracked.PSet( + nFields = cms.untracked.int32(8), + calibConstGranularity = cms.untracked.string('byWire') + ), + outputFileName = cms.untracked.string(OUTPUTFILE) +) + + -if TYPE=="TZeroDB" : process.p2 = cms.Path(process.dumpT0ToFile) -if TYPE=="TTrigDB" : process.p2 = cms.Path(process.dumpTTrigToFile) -if TYPE=="VDriftDB" : process.p2 = cms.Path(process.dumpVdToFile) -if TYPE=="UncertDB": process.p2 = cms.Path(process.dumpUncertToFile) +if TYPE=="TZeroDB" : process.p2 = cms.Path(process.dumpT0ToFile) +elif TYPE=="TTrigDB" : process.p2 = cms.Path(process.dumpTTrigToFile) +elif TYPE=="VDriftDB" : process.p2 = cms.Path(process.dumpVdToFile) +elif TYPE=="UncertDB": process.p2 = cms.Path(process.dumpUncertToFile) +elif TYPE=='NoiseDB' : process.p2 = cms.Path(process.dumpNoiseToFile) +elif TYPE=='DeadDB' : process.p2 = cms.Path(process.dumpDeadToFile) +elif TYPE=='ChannelsDB' : process.p2 = cms.Path(process.dumpChannelsToFile) diff --git a/CalibMuon/DTCalibration/test/DumpFileToDB_cfg.py b/CalibMuon/DTCalibration/test/DumpFileToDB_cfg.py index 6a77188143f28..c1303f43c207f 100644 --- a/CalibMuon/DTCalibration/test/DumpFileToDB_cfg.py +++ b/CalibMuon/DTCalibration/test/DumpFileToDB_cfg.py @@ -74,8 +74,8 @@ if TYPE=="TTrigDB" : RECORD = "DTTtrigRcd" if TYPE=="VDriftDB" : RECORD = "DTMtimeRcd" if TYPE=="UncertDB" : - RECORD = "DTRecoUncertaintiesRcd" - print('\nWARNING, Legacy RecoUncertDB is deprecated, as it is no longer used in reconstruction code') + RECORD = "" + print('\nERROR, Legacy RecoUncertDB is no longer supported') elif DBFORMAT=="DTRecoConditions" : if TYPE=="TTrigDB" : RECORD = "DTRecoConditionsTtrigRcd" if TYPE=="VDriftDB" : RECORD = "DTRecoConditionsVdriftRcd" diff --git a/CalibMuon/DTDigiSync/BuildFile.xml b/CalibMuon/DTDigiSync/BuildFile.xml index 6a6a31a2e8e80..930081092d6b5 100644 --- a/CalibMuon/DTDigiSync/BuildFile.xml +++ b/CalibMuon/DTDigiSync/BuildFile.xml @@ -1,5 +1,4 @@ - diff --git a/CalibMuon/DTDigiSync/interface/DTTTrigSyncFactory.h b/CalibMuon/DTDigiSync/interface/DTTTrigSyncFactory.h index d356b2923531c..b7f6caa5898d0 100644 --- a/CalibMuon/DTDigiSync/interface/DTTTrigSyncFactory.h +++ b/CalibMuon/DTDigiSync/interface/DTTTrigSyncFactory.h @@ -8,11 +8,13 @@ * \author G. Cerminara - INFN Torino */ #include "FWCore/PluginManager/interface/PluginFactory.h" +#include "FWCore/Framework/interface/FrameworkfwdMostUsed.h" namespace edm { class ParameterSet; } class DTTTrigBaseSync; -typedef edmplugin::PluginFactory DTTTrigSyncFactory; +typedef edmplugin::PluginFactory + DTTTrigSyncFactory; #endif diff --git a/CalibMuon/DTDigiSync/plugins/DTTTrigSyncFromDB.cc b/CalibMuon/DTDigiSync/plugins/DTTTrigSyncFromDB.cc index 3c73027eeed0b..807fcd98c4c4f 100644 --- a/CalibMuon/DTDigiSync/plugins/DTTTrigSyncFromDB.cc +++ b/CalibMuon/DTDigiSync/plugins/DTTTrigSyncFromDB.cc @@ -36,11 +36,19 @@ */ #include "CalibMuon/DTDigiSync/interface/DTTTrigBaseSync.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Framework/interface/ESHandle.h" +#include "Geometry/DTGeometry/interface/DTLayer.h" +#include "Geometry/DTGeometry/interface/DTSuperLayer.h" +#include "DataFormats/MuonDetId/interface/DTWireId.h" +#include "CondFormats/DTObjects/interface/DTT0.h" +#include "CondFormats/DataRecord/interface/DTT0Rcd.h" +#include "CondFormats/DTObjects/interface/DTTtrig.h" +#include "CondFormats/DataRecord/interface/DTTtrigRcd.h" -class DTLayer; -class DTWireId; -class DTT0; -class DTTtrig; +#include namespace edm { class ParameterSet; @@ -49,7 +57,7 @@ namespace edm { class DTTTrigSyncFromDB : public DTTTrigBaseSync { public: /// Constructor - DTTTrigSyncFromDB(const edm::ParameterSet& config); + DTTTrigSyncFromDB(const edm::ParameterSet& config, edm::ConsumesCollector); /// Destructor ~DTTTrigSyncFromDB() override; @@ -82,6 +90,8 @@ class DTTTrigSyncFromDB : public DTTTrigBaseSync { double emulatorOffset(const DTWireId& wireId, double& tTrig, double& t0cell) const override; private: + edm::ESGetToken t0Token_; + const edm::ESGetToken ttrigToken_; const DTT0* tZeroMap; const DTTtrig* tTrigMap; // Set the verbosity level @@ -98,29 +108,14 @@ class DTTTrigSyncFromDB : public DTTTrigBaseSync { int theWirePropCorrType; // spacing of BX in ns double theBXspace; - - std::string thetTrigLabel; - std::string thet0Label; }; -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/Framework/interface/ESHandle.h" -#include "Geometry/DTGeometry/interface/DTLayer.h" -#include "Geometry/DTGeometry/interface/DTSuperLayer.h" -#include "DataFormats/MuonDetId/interface/DTWireId.h" -#include "CondFormats/DTObjects/interface/DTT0.h" -#include "CondFormats/DataRecord/interface/DTT0Rcd.h" -#include "CondFormats/DTObjects/interface/DTTtrig.h" -#include "CondFormats/DataRecord/interface/DTTtrigRcd.h" - -#include - using namespace std; using namespace edm; -DTTTrigSyncFromDB::DTTTrigSyncFromDB(const ParameterSet& config) - : debug(config.getUntrackedParameter("debug")), +DTTTrigSyncFromDB::DTTTrigSyncFromDB(const ParameterSet& config, edm::ConsumesCollector cc) + : ttrigToken_(cc.esConsumes(edm::ESInputTag("", config.getParameter("tTrigLabel")))), + debug(config.getUntrackedParameter("debug")), // The velocity of signal propagation along the wire (cm/ns) theVPropWire(config.getParameter("vPropWire")), // Switch on/off the T0 correction from pulses @@ -132,27 +127,25 @@ DTTTrigSyncFromDB::DTTTrigSyncFromDB(const ParameterSet& config) doWirePropCorrection(config.getParameter("doWirePropCorrection")), theWirePropCorrType(config.getParameter("wirePropCorrType")), // spacing of BX in ns - theBXspace(config.getUntrackedParameter("bxSpace", 25.)), - thetTrigLabel(config.getParameter("tTrigLabel")), - thet0Label(config.getParameter("t0Label")) {} + theBXspace(config.getUntrackedParameter("bxSpace", 25.)) { + if (doT0Correction) { + t0Token_ = cc.esConsumes(edm::ESInputTag("", config.getParameter("t0Label"))); + } +} DTTTrigSyncFromDB::~DTTTrigSyncFromDB() {} void DTTTrigSyncFromDB::setES(const EventSetup& setup) { if (doT0Correction) { // Get the map of t0 from pulses from the Setup - ESHandle t0Handle; - setup.get().get(thet0Label, t0Handle); - tZeroMap = &*t0Handle; + tZeroMap = &setup.getData(t0Token_); if (debug) { cout << "[DTTTrigSyncFromDB] t0 version: " << tZeroMap->version() << endl; } } // Get the map of ttrig from the Setup - ESHandle ttrigHandle; - setup.get().get(thetTrigLabel, ttrigHandle); - tTrigMap = &*ttrigHandle; + tTrigMap = &setup.getData(ttrigToken_); if (debug) { cout << "[DTTTrigSyncFromDB] ttrig version: " << tTrigMap->version() << endl; } diff --git a/CalibMuon/DTDigiSync/plugins/DTTTrigSyncT0Only.cc b/CalibMuon/DTDigiSync/plugins/DTTTrigSyncT0Only.cc index 770714ed6f659..ad70418b72bf5 100644 --- a/CalibMuon/DTDigiSync/plugins/DTTTrigSyncT0Only.cc +++ b/CalibMuon/DTDigiSync/plugins/DTTTrigSyncT0Only.cc @@ -7,10 +7,16 @@ */ #include "CalibMuon/DTDigiSync/interface/DTTTrigBaseSync.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "DataFormats/MuonDetId/interface/DTWireId.h" +#include "CondFormats/DTObjects/interface/DTT0.h" +#include "CondFormats/DataRecord/interface/DTT0Rcd.h" -class DTLayer; -class DTWireId; -class DTT0; +#include namespace edm { class ParameterSet; @@ -19,7 +25,7 @@ namespace edm { class DTTTrigSyncT0Only : public DTTTrigBaseSync { public: /// Constructor - DTTTrigSyncT0Only(const edm::ParameterSet& config); + DTTTrigSyncT0Only(const edm::ParameterSet& config, edm::ConsumesCollector); /// Destructor ~DTTTrigSyncT0Only() override; @@ -48,34 +54,25 @@ class DTTTrigSyncT0Only : public DTTTrigBaseSync { private: const DTT0* tZeroMap; + edm::ESGetToken t0Token_; // Set the verbosity level const bool debug; }; -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/Framework/interface/ESHandle.h" -#include "DataFormats/MuonDetId/interface/DTWireId.h" -#include "CondFormats/DTObjects/interface/DTT0.h" -#include "CondFormats/DataRecord/interface/DTT0Rcd.h" - -#include - using namespace std; using namespace edm; -DTTTrigSyncT0Only::DTTTrigSyncT0Only(const ParameterSet& config) : debug(config.getUntrackedParameter("debug")) {} +DTTTrigSyncT0Only::DTTTrigSyncT0Only(const ParameterSet& config, edm::ConsumesCollector cc) + : t0Token_(cc.esConsumes()), debug(config.getUntrackedParameter("debug")) {} DTTTrigSyncT0Only::~DTTTrigSyncT0Only() {} void DTTTrigSyncT0Only::setES(const EventSetup& setup) { - ESHandle t0; - setup.get().get(t0); - tZeroMap = &*t0; + tZeroMap = &setup.getData(t0Token_); if (debug) { - cout << "[DTTTrigSyncT0Only] T0 version: " << t0->version() << endl; + edm::LogPrint("[DTTTrigSyncT0Only]") << "T0 version: " << tZeroMap->version() << endl; } } @@ -90,13 +87,13 @@ double DTTTrigSyncT0Only::offset(const DTLayer* layer, tofCorr = 0; if (debug) { - cout << "[DTTTrigSyncT0Only] Offset (ns): " << tTrig + wirePropCorr - tofCorr << endl - << " various contributions are: " - << endl - //<< " tZero (ns): " << t0 << endl - << " Propagation along wire delay (ns): " << wirePropCorr << endl - << " TOF correction (ns): " << tofCorr << endl - << endl; + edm::LogPrint("[DTTTrigSyncT0Only]") << "Offset (ns): " << tTrig + wirePropCorr - tofCorr << endl + << " various contributions are: " + << endl + //<< " tZero (ns): " << t0 << endl + << " Propagation along wire delay (ns): " << wirePropCorr << endl + << " TOF correction (ns): " << tofCorr << endl + << endl; } //The global offset is the sum of various contributions return tTrig + wirePropCorr - tofCorr; diff --git a/CalibMuon/DTDigiSync/plugins/DTTTrigSyncTOFCorr.cc b/CalibMuon/DTDigiSync/plugins/DTTTrigSyncTOFCorr.cc index 3d2f6d53d8d6f..b1c8430a79710 100644 --- a/CalibMuon/DTDigiSync/plugins/DTTTrigSyncTOFCorr.cc +++ b/CalibMuon/DTDigiSync/plugins/DTTTrigSyncTOFCorr.cc @@ -34,18 +34,18 @@ */ #include "CalibMuon/DTDigiSync/interface/DTTTrigBaseSync.h" - -class DTLayer; -class DTWireId; - -namespace edm { - class ParameterSet; -} +#include "FWCore/Framework/interface/ConsumesCollector.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/Utilities/interface/Exception.h" +#include "Geometry/DTGeometry/interface/DTLayer.h" +#include "Geometry/DTGeometry/interface/DTChamber.h" +#include "DataFormats/MuonDetId/interface/DTWireId.h" +#include class DTTTrigSyncTOFCorr : public DTTTrigBaseSync { public: /// Constructor - DTTTrigSyncTOFCorr(const edm::ParameterSet& config); + DTTTrigSyncTOFCorr(const edm::ParameterSet& config, edm::ConsumesCollector); /// Destructor ~DTTTrigSyncTOFCorr() override; @@ -102,16 +102,9 @@ class DTTTrigSyncTOFCorr : public DTTTrigBaseSync { double theBXspace; }; -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/Utilities/interface/Exception.h" -#include "Geometry/DTGeometry/interface/DTLayer.h" -#include "Geometry/DTGeometry/interface/DTChamber.h" -#include "DataFormats/MuonDetId/interface/DTWireId.h" -#include - using namespace std; -DTTTrigSyncTOFCorr::DTTTrigSyncTOFCorr(const edm::ParameterSet& config) +DTTTrigSyncTOFCorr::DTTTrigSyncTOFCorr(const edm::ParameterSet& config, edm::ConsumesCollector) : // The fixed t0 (or t_trig) to be subtracted to digi time (ns) theTTrig(config.getParameter("tTrig")), // FIXME: Default was 500 ns // Velocity of signal propagation along the wire (cm/ns) diff --git a/CalibPPS/AlignmentGlobal/README.md b/CalibPPS/AlignmentGlobal/README.md index 74f93ad42810a..2ed157af113b5 100644 --- a/CalibPPS/AlignmentGlobal/README.md +++ b/CalibPPS/AlignmentGlobal/README.md @@ -1,125 +1,133 @@ # PPSAlignmentWorker -## Config example: -[`ppsAlignmentWorker_cfi.py`](python/ppsAlignmentWorker_cfi.py) ## Parameters: | Name | Type | Description | |-------------|----------------|--------------------------------------------------------------------------| -| `tagTracks` | `cms.InputTag` | Should be set to `"ctppsLocalTrackLiteProducer"`. | +| `tagTracks` | `cms.InputTag` | Should be set to `"ctppsLocalTrackLiteProducer"`. | | `folder` | `cms.string` | Should be the same as the `folder` parameter in DQM configuration. | | `label` | `cms.string` | Label for EventSetup | | `debug` | `cms.bool` | When set to `True`, the worker will produce some extra debug histograms. | # PPSAlignmentHarvester -## Config example: -[`ppsAlignmentHarvester_cfi.py`](python/ppsAlignmentHarvester_cfi.py) ## Parameters: -| Name | Type | Description | -|----------|--------------|---------------------------------------------------------------------------------------| -| `folder` | `cms.string` | Should be the same as the `folder` parameter in DQM configuration. | -| `debug` | `cms.bool` | When set to `True`, the harvester will produce an extra ROOT file with debug plots. | +| Name | Type | Description | +|-------------------------------|---------------|---------------------------------------------------------------------------------------------------------------------------------------------------------| +| `folder` | `cms.string` | Should be the same as the `folder` parameter in DQM configuration. | +| `sequence` | `cms.vstring` | Determines order of the alignment methods: `"x_alignemnt"`, `"x_alignment_relative"`, `"y_alignment"`. | +| `overwrite_sh_x` | `cms.bool` | If set to `True`, `x alignment` will overwrite horizontal shift passed in the configuration. | +| `test_results_path` | `cms.string` | Path of a file with the results. If empty (`""`), the file will not be created. | +| `write_sqlite_results` | `cms.bool` | When set to `True`, the harvester will try to use PoolDBOutputService to save the final results. | +| `x_ali_rel_final_slope_fixed` | `cms.bool` | `True`: the harvester will use the x relative alignment results with fixed slope to prepare final merged results. `False`: results without fixed slope. | +| `y_ali_final_slope_fixed` | `cms.bool` | `True`: the harvester will use the y alignment results with fixed slope to prepare final merged results. `False`: results without fixed slope. | +| `debug` | `cms.bool` | When set to `True`, the harvester will produce an extra ROOT file with debug plots. | # Event Setup Default values come from the `fillDescriptions` method in `CalibPPS/ESProducers/plugins/PPSAlignmentConfigESSource.cc`.
NB: Parameters here are written in snake_case. Many of them are in camelCase in the code (as PPSAlignmentConfig getters). -| Name | Type | Default | Description | -|------------------------|---------------|----------------------------------------|--------------------------------------------------------------------------------------------------------------| -| `debug` | `cms.bool` | `False` | When set to `True`, the ESProducer will produce an extra ROOT file with debug plots (from reference run). | -| `label` | `cms.string` | `""` | label to distinguish reference and test fill configs. Should be set either to `""` (test) or `"reference"` | -| `sequence` | `cms.vstring` | empty vector | Determines order of the alignment methods: `"x_alignemnt"`, `"x_alignment_relative"`, `"y_alignment"`. | -| `results_dir` | `cms.string` | `"./alignment_results.txt"` | Directory of a file with the results. If empty (`""`), the file will not be created. | -| `sector_45` | `cms.PSet` | [details below](#Sector-config) | Configuration of sector 45. [Details below](#Sector-config) | -| `sector_56` | `cms.PSet` | [details below](#Sector-config) | Configuration of sector 56. [Details below](#Sector-config) | -| `x_ali_sh_step` | `cms.double` | `0.01` | Step for x alignment algorithm | -| `y_mode_sys_unc` | `cms.double` | `0.03` | Squared is an element of y mode uncertainty in y alignment. | -| `chiSqThreshold` | `cms.double` | `50.` | Chi-square threshold of y mode | -| `y_mode_unc_max_valid` | `cms.double` | `5.` | Maximal valid y mode uncertainty | -| `y_mode_max_valid` | `cms.double` | `20.` | Maximal valid y mode | -| `max_RP_tracks_size` | `cms.uint32` | `2.` | Maximal tracksUp or tracksDw size to avoid crowded events | -| `n_si` | `cms.double` | `4.` | Element of checking whether the cuts passed | -| `matching` | `cms.PSet` | [details below](#matching) | Reference dataset parameters. [Details below](#matching) | -| `x_alignment_meth_o` | `cms.PSet` | [details below](#x_alignment_meth_o) | X alignment parameters. (Details below)[#x_alignment_meth_o] | -| `x_alignment_relative` | `cms.PSet` | [details below](#x_alignment_relative) | Relative x alignment parameters. [Details below](#x_aligmment_relative) | -| `y_alignment` | `cms.PSet` | [details below](#y_alignment) | Y alignment parameters. [Details below](#y_alignment) | -| `binning` | `cms.PSet` | [details below](#binning) | Binning parameters for worker. [Details below](#binning) | +| Name | Type | Default | Description | +|------------------------|---------------|----------------------------------------|------------------------------------------------------------------------------------------------------------| +| `debug` | `cms.bool` | `False` | When set to `True`, the ESProducer will produce an extra ROOT file with debug plots (from reference run). | +| `label` | `cms.string` | `""` | label to distinguish reference and test fill configs. Should be set either to `""` (test) or `"reference"` | +| `sector_45` | `cms.PSet` | [details below](#Sector-config) | Configuration of sector 45. [Details below](#Sector-config) | +| `sector_56` | `cms.PSet` | [details below](#Sector-config) | Configuration of sector 56. [Details below](#Sector-config) | +| `x_ali_sh_step` | `cms.double` | `0.01` | Step for x alignment algorithm [mm] | +| `y_mode_sys_unc` | `cms.double` | `0.03` | Squared is an element of y mode uncertainty in y alignment. | +| `chiSqThreshold` | `cms.double` | `50.` | Chi-square threshold of y mode | +| `y_mode_unc_max_valid` | `cms.double` | `5.` | Maximum valid y mode uncertainty | +| `y_mode_max_valid` | `cms.double` | `20.` | Maximum valid y mode | +| `min_RP_tracks_size` | `cms.uint32` | `1` | Minimum number of tracks in each RP | +| `max_RP_tracks_size` | `cms.uint32` | `1` | Maximum number of tracks in each RP | +| `n_si` | `cms.double` | `4.` | Element of checking whether the cuts passed | +| `matching` | `cms.PSet` | [details below](#matching) | Reference dataset parameters. [Details below](#matching) | +| `x_alignment_meth_o` | `cms.PSet` | [details below](#x_alignment_meth_o) | X alignment parameters. [Details below](#x_alignment_meth_o) | +| `x_alignment_relative` | `cms.PSet` | [details below](#x_alignment_relative) | Relative x alignment parameters. [Details below](#x_aligmment_relative) | +| `y_alignment` | `cms.PSet` | [details below](#y_alignment) | Y alignment parameters. [Details below](#y_alignment) | +| `binning` | `cms.PSet` | [details below](#binning) | Binning parameters for worker. [Details below](#binning) | +| `extraParams` | `cms.vdouble` | empty vector | Extra vector of doubles added in case new parameters need to be added in the future | ## Sector config -| Name | Type | Default (s_45) | Default (s_56) | Description | -|---------------|--------------|-------------------------------|-------------------------------|------------------------------------------------------| -| `rp_N` | `cms.PSet` | [details below](#RP-config) | [details below](#RP-config) | Near RP configuration. [Details below](#RP-config) | -| `rp_F` | `cms.PSet` | [details below](#RP-config) | [details below](#RP-config) | Far RP configuration. [Details below](#RP-config) | -| `slope` | `cms.double` | `0.006` | `-0.015` | Base slope value | -| `cut_h_apply` | `cms.bool` | `True` | `True` | If set to `True`, cut_h is applied | -| `cut_h_a` | `cms.double` | `-1.` | `-1.` | cut_h parameter | -| `cut_h_c` | `cms.double` | `-38.55` | `-39.26` | cut_h parameter | -| `cut_h_si` | `cms.double` | `0.2` | `0.2` | cut_h parameter | -| `cut_v_apply` | `cms.bool` | `True` | `True` | If set to `True`, cut_v is applied | -| `cut_v_a` | `cms.double` | `-1.07` | `-1.07` | cut_v parameter | -| `cut_v_c` | `cms.double` | `1.63` | `1.49` | cut_v parameter | -| `cut_v_si` | `cms.double` | `0.15` | `0.15` | cut_v parameter | +| Name | Type | Default (s_45) | Default (s_56) | Description | +|---------------|--------------|-----------------------------|-----------------------------|----------------------------------------------------| +| `rp_N` | `cms.PSet` | [details below](#RP-config) | [details below](#RP-config) | Near RP configuration. [Details below](#RP-config) | +| `rp_F` | `cms.PSet` | [details below](#RP-config) | [details below](#RP-config) | Far RP configuration. [Details below](#RP-config) | +| `slope` | `cms.double` | `0.006` | `-0.015` | Base slope value | +| `cut_h_apply` | `cms.bool` | `True` | `True` | If set to `True`, cut_h is applied | +| `cut_h_a` | `cms.double` | `-1.` | `-1.` | cut_h parameter | +| `cut_h_c` | `cms.double` | `-38.55` | `-39.26` | cut_h parameter | +| `cut_h_si` | `cms.double` | `0.2` | `0.2` | cut_h parameter | +| `cut_v_apply` | `cms.bool` | `True` | `True` | If set to `True`, cut_v is applied | +| `cut_v_a` | `cms.double` | `-1.07` | `-1.07` | cut_v parameter | +| `cut_v_c` | `cms.double` | `1.63` | `1.49` | cut_v parameter | +| `cut_v_si` | `cms.double` | `0.15` | `0.15` | cut_v parameter | ### RP config -| Name | Type | Default (s_45, rp_N) | Default (s_45, rp_F) | Default (s_56, rp_N) | Default (s_56, rp_F) | Description | -|------------------|--------------|----------------------|----------------------|----------------------|----------------------|---------------------------------------------------------------------------------------------------------------------------------| -| `name` | `cms.string` | `"L_1_F"` | `"L_2_F"` | `"R_1_F"` | `"R_2_F"` | Name of the RP | -| `id` | `cms.int32` | `3` | `23` | `103` | `123` | ID of the RP | -| `slope` | `cms.double` | `0.19` | `0.19` | `0.40` | `0.39` | Base slope value | -| `sh_x` | `cms.double` | `-3.6` | `-42.` | `-2.8` | `-41.9` | Base sh_x value. X alignment method overwrites it. | +| Name | Type | Default (s_45, rp_N) | Default (s_45, rp_F) | Default (s_56, rp_N) | Default (s_56, rp_F) | Description | +|------------------|--------------|----------------------|----------------------|----------------------|----------------------|-------------------------------------------------------------------------------------------------------------------------------| +| `name` | `cms.string` | `"L_1_F"` | `"L_2_F"` | `"R_1_F"` | `"R_2_F"` | Name of the RP | +| `id` | `cms.int32` | `3` | `23` | `103` | `123` | ID of the RP | +| `slope` | `cms.double` | `0.19` | `0.19` | `0.40` | `0.39` | Base slope value | +| `sh_x` | `cms.double` | `-3.6` | `-42.` | `-2.8` | `-41.9` | Base sh_x value [mm]. X alignment method overwrites it. | | `x_min_fit_mode` | `cms.double` | `2.` | `2.` | `2.` | `2.` | Mode graph parameter. See [buildModeGraph](plugins/PPSAlignmentHarvester.cc#L648). | | `x_max_fit_mode` | `cms.double` | `7.` | `7.5` | `7.4` | `8.` | Mode graph parameter. See [buildModeGraph](plugins/PPSAlignmentHarvester.cc#L648). | | `y_max_fit_mode` | `cms.double` | `7.` | `7.5` | `7.4` | `8.` | Mode graph parameter (in 2018 the same value as x_max_fit_mode). See [buildModeGraph](plugins/PPSAlignmentHarvester.cc#L654). | -| `y_cen_add` | `cms.double` | `-0.3` | `-0.3` | `-0.8` | `-0.8` | The value is added to y_cen (mean of y) while constructing a graph in x alignment. | -| `y_width_mult` | `cms.double` | `1.1` | `1.1` | `1.0` | `1.` | y_width (RMS of y) is multiplied by the value when constructing a graph in x alignment. | -| `x_slice_min` | `cms.double` | `7.` | `46.` | `6.` | `45.` | Min x for slice plots (x alignment) | -| `x_slice_max` | `cms.double` | `19.` | `58.` | `17.` | `57.` | Max x for slice plots (x alignment) | -| `x_slice_w` | `cms.double` | `0.2` | `0.2` | `0.2` | `0.2` | X width for slice plots (x alignment) | +| `y_cen_add` | `cms.double` | `-0.3` | `-0.3` | `-0.8` | `-0.8` | The value is added to y_cen (mean of y) while constructing a graph in x alignment. | +| `y_width_mult` | `cms.double` | `1.1` | `1.1` | `1.0` | `1.` | y_width (RMS of y) is multiplied by the value when constructing a graph in x alignment. | +| `x_slice_min` | `cms.double` | `7.` | `46.` | `6.` | `45.` | Min x for slice plots (x alignment) | +| `x_slice_max` | `cms.double` | `19.` | `58.` | `17.` | `57.` | Max x for slice plots (x alignment) | +| `x_slice_w` | `cms.double` | `0.2` | `0.2` | `0.2` | `0.2` | X width for slice plots (x alignment) | ## matching -Should be set in the reference config! -| Name | Type | Default | Description | -|---------------------|--------------|-------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| `reference_dataset` | `cms.string` | `""` | Directory of the file with reference dataset histograms. Should be empty when running the worker for the reference dataset. After that, should be set to the name of the created ROOT file. | -| `rp_L_F` | `cms.PSet` | `-43.` - `-41.` | Left far RP. Contains two parameters of type `cms.double`: `sh_min` and `sh_max` - shift range for x alignment | -| `rp_L_N` | `cms.PSet` | `-4.2` - `-2.4` | Left near RP. Contains two parameters of type `cms.double`: `sh_min` and `sh_max` - shift range for x alignment | -| `rp_R_N` | `cms.PSet` | `-3.6` - `-1.8` | Right near RP. Contains two parameters of type `cms.double`: `sh_min` and `sh_max` - shift range for x alignment | -| `rp_R_F` | `cms.PSet` | `-43.2` - `-41.2` | Right far RP. Contains two parameters of type `cms.double`: `sh_min` and `sh_max` - shift range for x alignment | +| Name | Type | Default | Description | +|---------------------|--------------|-------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `reference_dataset` | `cms.string` | `""` | Directory of the file with reference dataset histograms. Should be empty when running the worker for the reference dataset. After that, should be set to the name of the created ROOT file (in the reference config). | +| `rp_L_F` | `cms.PSet` | `-43.` - `-41.` | Left far RP. Contains two parameters of type `cms.double`: `sh_min` and `sh_max` - shift range for x alignment [mm] | +| `rp_L_N` | `cms.PSet` | `-4.2` - `-2.4` | Left near RP. Contains two parameters of type `cms.double`: `sh_min` and `sh_max` - shift range for x alignment [mm] | +| `rp_R_N` | `cms.PSet` | `-3.6` - `-1.8` | Right near RP. Contains two parameters of type `cms.double`: `sh_min` and `sh_max` - shift range for x alignment [mm] | +| `rp_R_F` | `cms.PSet` | `-43.2` - `-41.2` | Right far RP. Contains two parameters of type `cms.double`: `sh_min` and `sh_max` - shift range for x alignment [mm] | ## x_alignment_meth_o -| Name | Type | Default | Description | -|--------------------------------|--------------|----------------|--------------------------------------------------------------------------------------------------------------| -| `rp_L_F` | `cms.PSet` | `47.` - `56.5` | Left far RP. Contains two parameters of type `cms.double`: `x_min` and `x_max` - x range for x alignment | -| `rp_L_N` | `cms.PSet` | `9.` - `18.5` | Left near RP. Contains two parameters of type `cms.double`: `x_min` and `x_max` - x range for x alignment | -| `rp_R_N` | `cms.PSet` | `7.` - `15.` | Right near RP. Contains two parameters of type `cms.double`: `x_min` and `x_max` - x range for x alignment | -| `rp_R_F` | `cms.PSet` | `46.` - `54.` | Right far RP. Contains two parameters of type `cms.double`: `x_min` and `x_max` - x range for x alignment | -| `fit_profile_min_bin_entries` | `cms.uint32` | `5` | Minimal number of entries in each bin in fitProfile method | -| `fit_profile_min_N_reasonable` | `cms.uint32` | `10` | Minimal number of valid bins in fitProfile method | -| `meth_o_graph_min_N` | `cms.uint32` | `5` | Minimal number of points in each of reference and test graph | -| `meth_o_unc_fit_range` | `cms.double` | `0.5` | Fit range for chi-square graph. | +| Name | Type | Default | Description | +|--------------------------------|--------------|----------------|------------------------------------------------------------------------------------------------------------| +| `rp_L_F` | `cms.PSet` | `47.` - `56.5` | Left far RP. Contains two parameters of type `cms.double`: `x_min` and `x_max` - x range for x alignment | +| `rp_L_N` | `cms.PSet` | `9.` - `18.5` | Left near RP. Contains two parameters of type `cms.double`: `x_min` and `x_max` - x range for x alignment | +| `rp_R_N` | `cms.PSet` | `7.` - `15.` | Right near RP. Contains two parameters of type `cms.double`: `x_min` and `x_max` - x range for x alignment | +| `rp_R_F` | `cms.PSet` | `46.` - `54.` | Right far RP. Contains two parameters of type `cms.double`: `x_min` and `x_max` - x range for x alignment | +| `fit_profile_min_bin_entries` | `cms.uint32` | `5` | Minimum number of entries in each bin in fitProfile method | +| `fit_profile_min_N_reasonable` | `cms.uint32` | `10` | Minimum number of valid bins in fitProfile method | +| `meth_o_graph_min_N` | `cms.uint32` | `5` | Minimum number of points in each of reference and test graph | +| `meth_o_unc_fit_range` | `cms.double` | `0.5` | Fit range for chi-square graph. | ## x_alignment_relative -| Name | Type | Default | Description | -|------------------------|--------------|---------------|-----------------------------------------------------------------------------------------------------------------------| -| `rp_L_F` | `cms.PSet` | `0.` - `0.` | Left far RP. Contains two parameters of type `cms.double`: `x_min` and `x_max` - x range for relative x alignment | -| `rp_L_N` | `cms.PSet` | `7.5` - `12.` | Left near RP. Contains two parameters of type `cms.double`: `x_min` and `x_max` - x range for relative x alignment | -| `rp_R_N` | `cms.PSet` | `6.` - `10.` | Right near RP. Contains two parameters of type `cms.double`: `x_min` and `x_max` - x range for relative x alignment | -| `rp_R_F` | `cms.PSet` | `0.` - `0.` | Right far RP. Contains two parameters of type `cms.double`: `x_min` and `x_max` - x range for relative x alignment | -| `near_far_min_entries` | `cms.uint32` | `100` | Minimal number of entries in near_far histograms | +| Name | Type | Default | Description | +|------------------------|--------------|---------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------| +| `rp_L_N` | `cms.PSet` | `7.5` - `12.` | Sector 45 alignment x relative ranges configuration. Contains two parameters of type `cms.double`: `x_min` and `x_max` - x range for relative x alignment | +| `rp_R_N` | `cms.PSet` | `6.` - `10.` | Sector 56 alignment x relative ranges configuration. Contains two parameters of type `cms.double`: `x_min` and `x_max` - x range for relative x alignment | +| `near_far_min_entries` | `cms.uint32` | `100` | Minimum number of entries in n+A97:D100ear_far histograms | ## y_alignment -| Name | Type | Default | Description | -|-------------------------------|--------------|----------------|--------------------------------------------------------------------------------------------------------------| -| `rp_L_F` | `cms.PSet` | `44.5` - `49.` | Left far RP. Contains two parameters of type `cms.double`: `x_min` and `x_max` - x range for y alignment | -| `rp_L_N` | `cms.PSet` | `6.7` - `11.` | Left near RP. Contains two parameters of type `cms.double`: `x_min` and `x_max` - x range for y alignment | -| `rp_R_N` | `cms.PSet` | `5.9` - `10.` | Right near RP. Contains two parameters of type `cms.double`: `x_min` and `x_max` - x range for y alignment | -| `rp_R_F` | `cms.PSet` | `44.5` - `49.` | Right far RP. Contains two parameters of type `cms.double`: `x_min` and `x_max` - x range for y alignment | -| `mode_graph_min_N` | `cms.uint32` | `5` | Minimal number of points in mode graph | -| `mult_sel_proj_y_min_entries` | `cms.uint32` | `300` | Minimal number of entries in y projection of multiplicity selection histograms | +| Name | Type | Default | Description | +|-------------------------------|--------------|----------------|------------------------------------------------------------------------------------------------------------| +| `rp_L_F` | `cms.PSet` | `44.5` - `49.` | Left far RP. Contains two parameters of type `cms.double`: `x_min` and `x_max` - x range for y alignment | +| `rp_L_N` | `cms.PSet` | `6.7` - `11.` | Left near RP. Contains two parameters of type `cms.double`: `x_min` and `x_max` - x range for y alignment | +| `rp_R_N` | `cms.PSet` | `5.9` - `10.` | Right near RP. Contains two parameters of type `cms.double`: `x_min` and `x_max` - x range for y alignment | +| `rp_R_F` | `cms.PSet` | `44.5` - `49.` | Right far RP. Contains two parameters of type `cms.double`: `x_min` and `x_max` - x range for y alignment | +| `mode_graph_min_N` | `cms.uint32` | `5` | Minimum number of points in mode graph | +| `mult_sel_proj_y_min_entries` | `cms.uint32` | `300` | Minimum number of entries in y projection of multiplicity selection histograms | ## binning -| Name | Type | Default | Description | -|------------------|--------------|---------------|-----------------------------------| -| `bin_size_x` | `cms.double` | `142.3314E-3` | X bin size | -| `n_bins_x` | `cms.uint32` | `210` | Number of bins in many histograms | -| `pixel_x_offset` | `cms.double` | `40.` | Pixel x offset | -| `n_bins_y` | `cms.uint32` | `400` | Number of bins in many histograms | -| `y_min` | `cms.double` | `-20.` | Min y for 2D histograms | -| `y_max` | `cms.double` | `20.` | Min y for 2D histograms | \ No newline at end of file +| Name | Type | Default | Description | +|-------------------|--------------|---------------|------------------------------------------| +| `bin_size_x` | `cms.double` | `142.3314E-3` | X bin size | +| `n_bins_x` | `cms.uint32` | `210` | Number of bins in many histograms | +| `pixel_x_offset` | `cms.double` | `40.` | Pixel x offset | +| `n_bins_y` | `cms.uint32` | `400` | Number of bins in many histograms | +| `y_min` | `cms.double` | `-20.` | Min y for 2D histograms | +| `y_max` | `cms.double` | `20.` | Max y for 2D histograms | +| `diffFN_n_bins_x` | `cms.uint32` | `100` | Number of bins in near-far profiles | +| `diffFN_x_min` | `cms.double` | `0.` | X axis min for near-far profiles | +| `diffFN_x_max` | `cms.double` | `20.` | X axis max for near-far profiles | +| `slice_n_bins_x` | `cms.uint32` | `100` | Number of bins in x axis for slice plots | +| `slice_x_min` | `cms.double` | `-10.` | X axis min for slice plots | +| `slice_x_max` | `cms.double` | `10.` | X axis max for slice plots | +| `slice_n_bins_y` | `cms.uint32` | `100` | Number of bins in y axis for slice plots | +| `slice_y_min` | `cms.double` | `-2.` | Y axis min for slice plots | +| `slice_y_max` | `cms.double` | `2.` | Y axis max for slice plots | \ No newline at end of file diff --git a/CalibPPS/AlignmentGlobal/plugins/BuildFile.xml b/CalibPPS/AlignmentGlobal/plugins/BuildFile.xml index 7c6e8f93db3ab..aa1c70dbc725d 100644 --- a/CalibPPS/AlignmentGlobal/plugins/BuildFile.xml +++ b/CalibPPS/AlignmentGlobal/plugins/BuildFile.xml @@ -4,10 +4,12 @@ + + -
\ No newline at end of file + diff --git a/CalibPPS/AlignmentGlobal/plugins/PPSAlignmentHarvester.cc b/CalibPPS/AlignmentGlobal/plugins/PPSAlignmentHarvester.cc index 3d86df5cc99ea..1abb7cdd09ecf 100644 --- a/CalibPPS/AlignmentGlobal/plugins/PPSAlignmentHarvester.cc +++ b/CalibPPS/AlignmentGlobal/plugins/PPSAlignmentHarvester.cc @@ -1,14 +1,8 @@ /**************************************************************************** - * - * CalibPPS/AlignmentGlobal/plugins/PPSAlignmentHarvester.cc - * - * Description : PPS Alignment DQM harvester - * - * Authors: - * - Jan KaÅ¡par - * - Mateusz Kocot - * - ****************************************************************************/ +* Authors: +* Jan KaÅ¡par (jan.kaspar@gmail.com) +* Mateusz Kocot (mateuszkocot99@gmail.com) +****************************************************************************/ #include "DQMServices/Core/interface/DQMEDHarvester.h" #include "DQMServices/Core/interface/DQMStore.h" @@ -18,13 +12,18 @@ #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ServiceRegistry/interface/Service.h" + +#include "CondCore/DBOutputService/interface/PoolDBOutputService.h" #include "CondFormats/PPSObjects/interface/CTPPSRPAlignmentCorrectionData.h" #include "CondFormats/PPSObjects/interface/CTPPSRPAlignmentCorrectionsData.h" +#include "CondFormats/DataRecord/interface/CTPPSRPAlignmentCorrectionsDataRcd.h" -#include "CondFormats/PPSObjects/interface/PPSAlignmentConfig.h" -#include "CondFormats/DataRecord/interface/PPSAlignmentConfigRcd.h" +#include "CondFormats/PPSObjects/interface/PPSAlignmentConfiguration.h" +#include "CondFormats/DataRecord/interface/PPSAlignmentConfigurationRcd.h" +#include #include #include #include @@ -49,90 +48,292 @@ class PPSAlignmentHarvester : public DQMEDHarvester { public: - PPSAlignmentHarvester(const edm::ParameterSet &iConfig); + PPSAlignmentHarvester(const edm::ParameterSet& iConfig); + ~PPSAlignmentHarvester() override; + + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); private: - void dqmEndJob(DQMStore::IBooker &iBooker, DQMStore::IGetter &iGetter) override; - void dqmEndRun(DQMStore::IBooker &iBooker, - DQMStore::IGetter &iGetter, - edm::Run const &iRun, - edm::EventSetup const &iSetup) override; + void dqmEndJob(DQMStore::IBooker& iBooker, DQMStore::IGetter& iGetter) override; + void dqmEndRun(DQMStore::IBooker& iBooker, + DQMStore::IGetter& iGetter, + edm::Run const& iRun, + edm::EventSetup const& iSetup) override; // ------------ x alignment ------------ - static int fitProfile(TProfile *p, + static int fitProfile(TProfile* p, double x_mean, double x_rms, unsigned int fitProfileMinBinEntries, unsigned int fitProfileMinNReasonable, - double &sl, - double &sl_unc); - TGraphErrors *buildGraphFromVector(const std::vector &pv); - TGraphErrors *buildGraphFromMonitorElements(DQMStore::IGetter &iGetter, - const RPConfig &rpd, - const std::vector &mes, - unsigned int fitProfileMinBinEntries, - unsigned int fitProfileMinNReasonable); - void doMatch(DQMStore::IBooker &iBooker, - const PPSAlignmentConfig &cfg, - const RPConfig &rpd, - TGraphErrors *g_ref, - TGraphErrors *g_test, - const SelectionRange &range_ref, + double& sl, + double& sl_unc); + std::unique_ptr buildGraphFromVector(const std::vector& pv); + std::unique_ptr buildGraphFromMonitorElements(DQMStore::IGetter& iGetter, + const PPSAlignmentConfiguration::RPConfig& rpc, + const std::vector& mes, + unsigned int fitProfileMinBinEntries, + unsigned int fitProfileMinNReasonable); + void doMatch(DQMStore::IBooker& iBooker, + const PPSAlignmentConfiguration& cfg, + const PPSAlignmentConfiguration::RPConfig& rpc, + TGraphErrors* g_ref, + TGraphErrors* g_test, + const PPSAlignmentConfiguration::SelectionRange& range_ref, double sh_min, double sh_max, - double &sh_best, - double &sh_best_unc); + double& sh_best, + double& sh_best_unc); - void xAlignment(DQMStore::IBooker &iBooker, - DQMStore::IGetter &iGetter, - const PPSAlignmentConfig &cfg, - const PPSAlignmentConfig &cfg_ref, + void xAlignment(DQMStore::IBooker& iBooker, + DQMStore::IGetter& iGetter, + const PPSAlignmentConfiguration& cfg, + const PPSAlignmentConfiguration& cfg_ref, int seqPos); - std::map sh_x_map; + std::map sh_x_map_; // ------------ x alignment relative ------------ - void xAlignmentRelative(DQMStore::IBooker &iBooker, - DQMStore::IGetter &iGetter, - const PPSAlignmentConfig &cfg, + void xAlignmentRelative(DQMStore::IBooker& iBooker, + DQMStore::IGetter& iGetter, + const PPSAlignmentConfiguration& cfg, int seqPos); // ------------ y alignment ------------ - static double findMax(TF1 *ff_fit); - TGraphErrors *buildModeGraph(DQMStore::IBooker &iBooker, - MonitorElement *h2_y_vs_x, - const PPSAlignmentConfig &cfg, - const RPConfig &rpd); - - void yAlignment(DQMStore::IBooker &iBooker, DQMStore::IGetter &iGetter, const PPSAlignmentConfig &cfg, int seqPos); + static double findMax(TF1* ff_fit); + TH1D* buildModeGraph(DQMStore::IBooker& iBooker, + MonitorElement* h2_y_vs_x, + const PPSAlignmentConfiguration& cfg, + const PPSAlignmentConfiguration::RPConfig& rpc); + + void yAlignment(DQMStore::IBooker& iBooker, + DQMStore::IGetter& iGetter, + const PPSAlignmentConfiguration& cfg, + int seqPos); // ------------ other member data and methods ------------ - static TH1D *getTH1DFromTGraphErrors(TGraphErrors *graph, - std::string title = "", - std::string labels = "", - int n = -1, - double binWidth = -1., - double min = -1.); - - edm::ESGetToken esTokenTest_; - edm::ESGetToken esTokenReference_; - + static void writeCutPlot(TH2D* h, double a, double c, double si, double n_si, const std::string& label); + static std::unique_ptr getTH1DFromTGraphErrors(TGraphErrors* graph, + std::string title = "", + std::string labels = "", + int n = -1, + double binWidth = -1., + double min = -1.); + + edm::ESGetToken esTokenTest_; + edm::ESGetToken esTokenReference_; + + // variables from parameters const std::string folder_; + const std::vector sequence_; + bool overwriteShX_; + const bool writeSQLiteResults_; + const bool xAliRelFinalSlopeFixed_; + const bool yAliFinalSlopeFixed_; const bool debug_; - TFile *debugFile_; - std::ofstream resultsFile_; + + // other class variables + std::unique_ptr debugFile_; + std::ofstream textResultsFile_; + + CTPPSRPAlignmentCorrectionsData xAliResults_; + + CTPPSRPAlignmentCorrectionsData xAliRelResults_; + CTPPSRPAlignmentCorrectionsData xAliRelResultsSlopeFixed_; + + CTPPSRPAlignmentCorrectionsData yAliResults_; + CTPPSRPAlignmentCorrectionsData yAliResultsSlopeFixed_; }; +// -------------------------------- DQMEDHarvester methods -------------------------------- + +PPSAlignmentHarvester::PPSAlignmentHarvester(const edm::ParameterSet& iConfig) + : esTokenTest_(esConsumes( + edm::ESInputTag("", ""))), + esTokenReference_(esConsumes( + edm::ESInputTag("", "reference"))), + folder_(iConfig.getParameter("folder")), + sequence_(iConfig.getParameter>("sequence")), + overwriteShX_(iConfig.getParameter("overwrite_sh_x")), + writeSQLiteResults_(iConfig.getParameter("write_sqlite_results")), + xAliRelFinalSlopeFixed_(iConfig.getParameter("x_ali_rel_final_slope_fixed")), + yAliFinalSlopeFixed_(iConfig.getParameter("y_ali_final_slope_fixed")), + debug_(iConfig.getParameter("debug")) { + auto textResultsPath = iConfig.getParameter("text_results_path"); + if (!textResultsPath.empty()) { + textResultsFile_.open(textResultsPath, std::ios::out | std::ios::trunc); + } + if (debug_) { + debugFile_ = std::make_unique("debug_harvester.root", "recreate"); + } + + edm::LogInfo("PPS").log([&](auto& li) { + li << "[harvester] parameters:\n"; + li << "* folder: " << folder_ << "\n"; + li << "* sequence:\n"; + for (unsigned int i = 0; i < sequence_.size(); i++) { + li << " " << i + 1 << ": " << sequence_[i] << "\n"; + } + li << "* overwrite_sh_x: " << std::boolalpha << overwriteShX_ << "\n"; + li << "* text_results_path: " << textResultsPath << "\n"; + li << "* write_sqlite_results: " << std::boolalpha << writeSQLiteResults_ << "\n"; + li << "* x_ali_rel_final_slope_fixed: " << std::boolalpha << xAliRelFinalSlopeFixed_ << "\n"; + li << "* y_ali_final_slope_fixed: " << std::boolalpha << yAliFinalSlopeFixed_ << "\n"; + li << "* debug: " << std::boolalpha << debug_; + }); +} + +PPSAlignmentHarvester::~PPSAlignmentHarvester() { + if (textResultsFile_.is_open()) { + textResultsFile_.close(); + } +} + +void PPSAlignmentHarvester::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + + desc.add("folder", "CalibPPS/Common"); + desc.add>("sequence", {"x_alignment", "x_alignment_relative", "y_alignment"}); + desc.add("overwrite_sh_x", true); + desc.add("text_results_path", "./alignment_results.txt"); + desc.add("write_sqlite_results", false); + desc.add("x_ali_rel_final_slope_fixed", true); + desc.add("y_ali_final_slope_fixed", true); + desc.add("debug", false); + + descriptions.addWithDefaultLabel(desc); +} + +void PPSAlignmentHarvester::dqmEndJob(DQMStore::IBooker& iBooker, DQMStore::IGetter& iGetter) {} + +void PPSAlignmentHarvester::dqmEndRun(DQMStore::IBooker& iBooker, + DQMStore::IGetter& iGetter, + edm::Run const& iRun, + edm::EventSetup const& iSetup) { + const auto& cfg = iSetup.getData(esTokenTest_); + + const auto& cfg_ref = iSetup.getData(esTokenReference_); + + // setting default sh_x values from config + for (const auto& sc : {cfg.sectorConfig45(), cfg.sectorConfig56()}) { + for (const auto& rpc : {sc.rp_N_, sc.rp_F_}) { + sh_x_map_[rpc.id_] = rpc.sh_x_; + } + } + edm::LogInfo("PPS").log([&](auto& li) { + li << "[harvester] Setting sh_x from config of:\n"; + for (const auto& sc : {cfg.sectorConfig45(), cfg.sectorConfig56()}) { + for (const auto& rpc : {sc.rp_N_, sc.rp_F_}) { + li << " " << rpc.name_ << " to " << std::fixed << std::setprecision(3) << rpc.sh_x_; + if (rpc.name_ != "R_2_F") + li << "\n"; + } + } + }); + + bool doXAli = false, doXAliRel = false, doYAli = false; + for (unsigned int i = 0; i < sequence_.size(); i++) { + if (sequence_[i] == "x_alignment") { + xAlignment(iBooker, iGetter, cfg, cfg_ref, i); + doXAli = true; + } else if (sequence_[i] == "x_alignment_relative") { + xAlignmentRelative(iBooker, iGetter, cfg, i); + doXAliRel = true; + } else if (sequence_[i] == "y_alignment") { + yAlignment(iBooker, iGetter, cfg, i); + doYAli = true; + } else + edm::LogError("PPS") << "[harvester] " << sequence_[i] << " is a wrong method name."; + } + + // merge results from all the specified methods + CTPPSRPAlignmentCorrectionsData finalResults; + if (doXAli) { // x alignment + finalResults.addCorrections(xAliResults_); + if (doXAliRel) { // merge with x alignment relative + for (const auto& sc : {cfg.sectorConfig45(), cfg.sectorConfig56()}) { + // extract shifts + double d_x_N = xAliResults_.getRPCorrection(sc.rp_N_.id_).getShX(); + double d_x_F = xAliResults_.getRPCorrection(sc.rp_F_.id_).getShX(); + + double d_x_rel_N, d_x_rel_F; + if (xAliRelFinalSlopeFixed_) { + d_x_rel_N = xAliRelResultsSlopeFixed_.getRPCorrection(sc.rp_N_.id_).getShX(); + d_x_rel_F = xAliRelResultsSlopeFixed_.getRPCorrection(sc.rp_F_.id_).getShX(); + } else { + d_x_rel_N = xAliRelResults_.getRPCorrection(sc.rp_N_.id_).getShX(); + d_x_rel_F = xAliRelResults_.getRPCorrection(sc.rp_F_.id_).getShX(); + } + + // merge the results + double b = d_x_rel_N - d_x_rel_F; + double xCorrRel = b + d_x_F - d_x_N; + + CTPPSRPAlignmentCorrectionData corrRelN(xCorrRel / 2., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.); + finalResults.addRPCorrection(sc.rp_N_.id_, corrRelN); + CTPPSRPAlignmentCorrectionData corrRelF(-xCorrRel / 2., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.); + finalResults.addRPCorrection(sc.rp_F_.id_, corrRelF); + } + } + } + if (doYAli) { // y alignment + if (yAliFinalSlopeFixed_) { + finalResults.addCorrections(yAliResultsSlopeFixed_); + } else { + finalResults.addCorrections(yAliResults_); + } + } + + // print the text results + edm::LogInfo("PPS") << "final merged results:\n" << finalResults; + + if (textResultsFile_.is_open()) { + textResultsFile_ << "final merged results:\n" << finalResults; + } + + // if requested, store the results in a DB object + if (writeSQLiteResults_) { + edm::Service poolDbService; + if (poolDbService.isAvailable()) { + poolDbService->writeOneIOV(finalResults, poolDbService->currentTime(), "CTPPSRPAlignmentCorrectionsDataRcd"); + } else { + edm::LogWarning("PPS") << "Could not store the results in a DB object. PoolDBService not available."; + } + } + + // if debug_, save nice-looking cut plots with the worker data in the debug ROOT file + if (debug_) { + TDirectory* cutsDir = debugFile_->mkdir("cuts"); + for (const auto& sc : {cfg.sectorConfig45(), cfg.sectorConfig56()}) { + TDirectory* sectorDir = cutsDir->mkdir(sc.name_.c_str()); + + gDirectory = sectorDir->mkdir("cut_h"); + auto* h2_cut_h_bef_monitor = iGetter.get(folder_ + "/worker/" + sc.name_ + "/cuts/cut_h/h2_cut_h_bef"); + auto* h2_cut_h_aft_monitor = iGetter.get(folder_ + "/worker/" + sc.name_ + "/cuts/cut_h/h2_cut_h_aft"); + writeCutPlot( + h2_cut_h_bef_monitor->getTH2D(), sc.cut_h_a_, sc.cut_h_c_, cfg.n_si(), sc.cut_h_si_, "canvas_before"); + writeCutPlot(h2_cut_h_aft_monitor->getTH2D(), sc.cut_h_a_, sc.cut_h_c_, cfg.n_si(), sc.cut_h_si_, "canvas_after"); + + gDirectory = sectorDir->mkdir("cut_v"); + auto* h2_cut_v_bef_monitor = iGetter.get(folder_ + "/worker/" + sc.name_ + "/cuts/cut_v/h2_cut_v_bef"); + auto* h2_cut_v_aft_monitor = iGetter.get(folder_ + "/worker/" + sc.name_ + "/cuts/cut_v/h2_cut_v_aft"); + writeCutPlot( + h2_cut_v_bef_monitor->getTH2D(), sc.cut_v_a_, sc.cut_v_c_, cfg.n_si(), sc.cut_v_si_, "canvas_before"); + writeCutPlot(h2_cut_v_aft_monitor->getTH2D(), sc.cut_v_a_, sc.cut_v_c_, cfg.n_si(), sc.cut_v_si_, "canvas_after"); + } + } +} + // -------------------------------- x alignment methods -------------------------------- -// Fits a linear function to a TProfile (similar method in PPSAlignmentConfigESSource). -int PPSAlignmentHarvester::fitProfile(TProfile *p, +// Fits a linear function to a TProfile (similar method in PPSAlignmentConfigurationESSource). +int PPSAlignmentHarvester::fitProfile(TProfile* p, double x_mean, double x_rms, unsigned int fitProfileMinBinEntries, unsigned int fitProfileMinNReasonable, - double &sl, - double &sl_unc) { + double& sl, + double& sl_unc) { unsigned int n_reasonable = 0; for (int bi = 1; bi <= p->GetNbinsX(); bi++) { if (p->GetBinEntries(bi) < fitProfileMinBinEntries) { @@ -146,12 +347,12 @@ int PPSAlignmentHarvester::fitProfile(TProfile *p, if (n_reasonable < fitProfileMinNReasonable) return 1; - double xMin = x_mean - x_rms, xMax = x_mean + x_rms; + double x_min = x_mean - x_rms, x_max = x_mean + x_rms; - TF1 *ff_pol1 = new TF1("ff_pol1", "[0] + [1]*x"); + auto ff_pol1 = std::make_unique("ff_pol1", "[0] + [1]*x"); ff_pol1->SetParameter(0., 0.); - p->Fit(ff_pol1, "Q", "", xMin, xMax); + p->Fit(ff_pol1.get(), "Q", "", x_min, x_max); sl = ff_pol1->GetParameter(1); sl_unc = ff_pol1->GetParError(1); @@ -160,11 +361,12 @@ int PPSAlignmentHarvester::fitProfile(TProfile *p, } // Builds graph from a vector of points (with errors). -TGraphErrors *PPSAlignmentHarvester::buildGraphFromVector(const std::vector &pv) { - TGraphErrors *g = new TGraphErrors(); +std::unique_ptr PPSAlignmentHarvester::buildGraphFromVector( + const std::vector& pv) { + auto g = std::make_unique(); for (unsigned int i = 0; i < pv.size(); i++) { - const auto &p = pv[i]; + const auto& p = pv[i]; g->SetPoint(i, p.x_, p.y_); g->SetPointError(i, p.ex_, p.ey_); } @@ -174,14 +376,15 @@ TGraphErrors *PPSAlignmentHarvester::buildGraphFromVector(const std::vector &mes, - unsigned int fitProfileMinBinEntries, - unsigned int fitProfileMinNReasonable) { - TGraphErrors *g = new TGraphErrors(); - - for (auto *me : mes) { +std::unique_ptr PPSAlignmentHarvester::buildGraphFromMonitorElements( + DQMStore::IGetter& iGetter, + const PPSAlignmentConfiguration::RPConfig& rpc, + const std::vector& mes, + unsigned int fitProfileMinBinEntries, + unsigned int fitProfileMinNReasonable) { + auto g = std::make_unique(); + + for (auto* me : mes) { if (me->getName() == "h_y") // find "h_y" { // retrieve parent directory @@ -189,24 +392,24 @@ TGraphErrors *PPSAlignmentHarvester::buildGraphFromMonitorElements(DQMStore::IGe size_t parentPos = parentPath.substr(0, parentPath.size() - 1).find_last_of('/') + 1; std::string parentName = parentPath.substr(parentPos); size_t d = parentName.find('-'); - const double xMin = std::stod(parentName.substr(0, d)); - const double xMax = std::stod(parentName.substr(d + 1)); + const double x_min = std::stod(parentName.substr(0, d)); + const double x_max = std::stod(parentName.substr(d + 1)); - TH1D *h_y = me->getTH1D(); + TH1D* h_y = me->getTH1D(); // collect "p_y_diffFN_vs_y" corresponding to found "h_y" - auto *p_y_diffFN_vs_y_monitor = iGetter.get(parentPath + "p_y_diffFN_vs_y"); + auto* p_y_diffFN_vs_y_monitor = iGetter.get(parentPath + "p_y_diffFN_vs_y"); if (p_y_diffFN_vs_y_monitor == nullptr) { edm::LogWarning("PPS") << "[x_alignment] could not find p_y_diffFN_vs_y in: " << parentPath; continue; } - TProfile *p_y_diffFN_vs_y = p_y_diffFN_vs_y_monitor->getTProfile(); + TProfile* p_y_diffFN_vs_y = p_y_diffFN_vs_y_monitor->getTProfile(); double y_cen = h_y->GetMean(); double y_width = h_y->GetRMS(); - y_cen += rpd.y_cen_add_; - y_width *= rpd.y_width_mult_; + y_cen += rpc.y_cen_add_; + y_width *= rpc.y_width_mult_; double sl = 0., sl_unc = 0.; int fr = @@ -218,8 +421,8 @@ TGraphErrors *PPSAlignmentHarvester::buildGraphFromMonitorElements(DQMStore::IGe p_y_diffFN_vs_y->Write(parentName.c_str()); int idx = g->GetN(); - g->SetPoint(idx, (xMax + xMin) / 2., sl); - g->SetPointError(idx, (xMax - xMin) / 2., sl_unc); + g->SetPoint(idx, (x_max + x_min) / 2., sl); + g->SetPointError(idx, (x_max - x_min) / 2., sl_unc); } } g->Sort(); @@ -228,17 +431,17 @@ TGraphErrors *PPSAlignmentHarvester::buildGraphFromMonitorElements(DQMStore::IGe } // Matches reference data with test data. -void PPSAlignmentHarvester::doMatch(DQMStore::IBooker &iBooker, - const PPSAlignmentConfig &cfg, - const RPConfig &rpd, - TGraphErrors *g_ref, - TGraphErrors *g_test, - const SelectionRange &range_ref, +void PPSAlignmentHarvester::doMatch(DQMStore::IBooker& iBooker, + const PPSAlignmentConfiguration& cfg, + const PPSAlignmentConfiguration::RPConfig& rpc, + TGraphErrors* g_ref, + TGraphErrors* g_test, + const PPSAlignmentConfiguration::SelectionRange& range_ref, double sh_min, double sh_max, - double &sh_best, - double &sh_best_unc) { - const auto range_test = cfg.alignment_x_meth_o_ranges().at(rpd.id_); + double& sh_best, + double& sh_best_unc) { + const auto range_test = cfg.alignment_x_meth_o_ranges().at(rpc.id_); // print config edm::LogInfo("PPS") << std::fixed << std::setprecision(3) << "[x_alignment] " @@ -246,16 +449,16 @@ void PPSAlignmentHarvester::doMatch(DQMStore::IBooker &iBooker, << "test: x_min = " << range_test.x_min_ << ", x_max = " << range_test.x_max_; // make spline from g_ref - TSpline3 *s_ref = new TSpline3("s_ref", g_ref->GetX(), g_ref->GetY(), g_ref->GetN()); + auto s_ref = std::make_unique("s_ref", g_ref->GetX(), g_ref->GetY(), g_ref->GetN()); // book match-quality graphs - TGraph *g_n_points = new TGraph(); + auto g_n_points = std::make_unique(); g_n_points->SetName("g_n_points"); g_n_points->SetTitle(";sh;N"); - TGraph *g_chi_sq = new TGraph(); + auto g_chi_sq = std::make_unique(); g_chi_sq->SetName("g_chi_sq"); g_chi_sq->SetTitle(";sh;S2"); - TGraph *g_chi_sq_norm = new TGraph(); + auto g_chi_sq_norm = std::make_unique(); g_chi_sq_norm->SetName("g_chi_sq_norm"); g_chi_sq_norm->SetTitle(";sh;S2 / N"); @@ -318,26 +521,25 @@ void PPSAlignmentHarvester::doMatch(DQMStore::IBooker &iBooker, g_chi_sq_norm->SetPoint(idx, sh, S2_norm); } - TF1 *ff_pol2 = new TF1("ff_pol2", "[0] + [1]*x + [2]*x*x"); + auto ff_pol2 = std::make_unique("ff_pol2", "[0] + [1]*x + [2]*x*x"); // determine uncertainty double fit_range = cfg.methOUncFitRange(); - g_chi_sq->Fit(ff_pol2, "Q", "", sh_best - fit_range, sh_best + fit_range); + g_chi_sq->Fit(ff_pol2.get(), "Q", "", sh_best - fit_range, sh_best + fit_range); sh_best_unc = 1. / sqrt(ff_pol2->GetParameter(2)); // print results edm::LogInfo("PPS") << std::fixed << std::setprecision(3) << "[x_alignment] " << "sh_best = (" << sh_best << " +- " << sh_best_unc << ") mm"; - TGraphErrors *g_test_shifted = new TGraphErrors(*g_test); + auto g_test_shifted = std::make_unique(*g_test); for (int i = 0; i < g_test_shifted->GetN(); ++i) { g_test_shifted->GetX()[i] += sh_best; } - iBooker.book1DD( - "h_test_shifted", - getTH1DFromTGraphErrors( - g_test_shifted, "test_shifted", ";x (mm);S", rpd.x_slice_n_, rpd.x_slice_w_, rpd.x_slice_min_ + sh_best)); + std::unique_ptr histPtr = getTH1DFromTGraphErrors( + g_test_shifted.get(), "test_shifted", ";x (mm);S", rpc.x_slice_n_, rpc.x_slice_w_, rpc.x_slice_min_ + sh_best); + iBooker.book1DD("h_test_shifted", histPtr.get()); if (debug_) { // save graphs @@ -348,7 +550,7 @@ void PPSAlignmentHarvester::doMatch(DQMStore::IBooker &iBooker, g_test_shifted->Write("g_test_shifted"); // save results - TGraph *g_results = new TGraph(); + auto g_results = std::make_unique(); g_results->SetName("g_results"); g_results->SetPoint(0, sh_best, sh_best_unc); g_results->SetPoint(1, range_ref.x_min_, range_ref.x_max_); @@ -356,7 +558,7 @@ void PPSAlignmentHarvester::doMatch(DQMStore::IBooker &iBooker, g_results->Write(); // save debug canvas - TCanvas *c_cmp = new TCanvas("c_cmp"); + auto c_cmp = std::make_unique("c_cmp"); g_ref->SetLineColor(1); g_ref->SetName("g_ref"); g_ref->Draw("apl"); @@ -370,72 +572,68 @@ void PPSAlignmentHarvester::doMatch(DQMStore::IBooker &iBooker, g_test_shifted->Draw("pl"); c_cmp->Write(); - - delete c_cmp; } - - // clean up - delete s_ref; } // method o -void PPSAlignmentHarvester::xAlignment(DQMStore::IBooker &iBooker, - DQMStore::IGetter &iGetter, - const PPSAlignmentConfig &cfg, - const PPSAlignmentConfig &cfg_ref, +void PPSAlignmentHarvester::xAlignment(DQMStore::IBooker& iBooker, + DQMStore::IGetter& iGetter, + const PPSAlignmentConfiguration& cfg, + const PPSAlignmentConfiguration& cfg_ref, int seqPos) { - TDirectory *xAliDir = nullptr; + TDirectory* xAliDir = nullptr; if (debug_) xAliDir = debugFile_->mkdir((std::to_string(seqPos + 1) + ": x alignment").c_str()); - // prepare results - CTPPSRPAlignmentCorrectionsData results; + for (const auto& scPair : {std::make_pair(cfg.sectorConfig45(), cfg_ref.sectorConfig45()), + std::make_pair(cfg.sectorConfig56(), cfg_ref.sectorConfig56())}) { + const auto& sc = scPair.first; + const auto& sc_ref = scPair.second; - for (const auto &sdp : {std::make_pair(cfg.sectorConfig45(), cfg_ref.sectorConfig45()), - std::make_pair(cfg.sectorConfig56(), cfg_ref.sectorConfig56())}) { - const auto &sd = sdp.first; - for (const auto &rpdp : {std::make_pair(sd.rp_F_, sdp.second.rp_F_), std::make_pair(sd.rp_N_, sdp.second.rp_N_)}) { - const auto &rpd = rpdp.first; + for (const auto& rpcPair : {std::make_pair(sc.rp_F_, sc_ref.rp_F_), std::make_pair(sc.rp_N_, sc_ref.rp_N_)}) { + const auto& rpc = rpcPair.first; + const auto& rpc_ref = rpcPair.second; - auto mes_test = iGetter.getAllContents(folder_ + "/worker/" + sd.name_ + "/near_far/x slices, " + rpd.position_); + auto mes_test = iGetter.getAllContents(folder_ + "/worker/" + sc.name_ + "/near_far/x slices, " + rpc.position_); if (mes_test.empty()) { - edm::LogWarning("PPS") << "[x_alignment] " << rpd.name_ << ": could not load mes_test"; + edm::LogWarning("PPS") << "[x_alignment] " << rpc.name_ << ": could not load mes_test"; continue; } - TDirectory *rpDir = nullptr; + TDirectory* rpDir = nullptr; if (debug_) - rpDir = xAliDir->mkdir(rpd.name_.c_str()); + rpDir = xAliDir->mkdir(rpc.name_.c_str()); - auto vec_ref = cfg_ref.matchingReferencePoints().at(rpd.id_); + auto vec_ref = cfg_ref.matchingReferencePoints().at(rpc.id_); if (vec_ref.empty()) { - edm::LogInfo("PPS") << "[x_alignment] " << rpd.name_ << ": reference points vector is empty"; + edm::LogInfo("PPS") << "[x_alignment] " << rpc.name_ << ": reference points vector is empty"; continue; } - TGraphErrors *g_ref = buildGraphFromVector(vec_ref); + std::unique_ptr g_ref = buildGraphFromVector(vec_ref); if (debug_) gDirectory = rpDir->mkdir("fits_test"); - TGraphErrors *g_test = buildGraphFromMonitorElements( - iGetter, rpd, mes_test, cfg.fitProfileMinBinEntries(), cfg.fitProfileMinNReasonable()); + std::unique_ptr g_test = buildGraphFromMonitorElements( + iGetter, rpc, mes_test, cfg.fitProfileMinBinEntries(), cfg.fitProfileMinNReasonable()); // require minimal number of points if (g_ref->GetN() < (int)cfg.methOGraphMinN() || g_test->GetN() < (int)cfg.methOGraphMinN()) { - edm::LogWarning("PPS") << "[x_alignment] " << rpd.name_ << ": insufficient data, skipping (g_ref " + edm::LogWarning("PPS") << "[x_alignment] " << rpc.name_ << ": insufficient data, skipping (g_ref " << g_ref->GetN() << "/" << cfg.methOGraphMinN() << ", g_test " << g_test->GetN() << "/" << cfg.methOGraphMinN() << ")"; continue; } - iBooker.setCurrentFolder(folder_ + "/harvester/x alignment/" + rpd.name_); - iBooker.book1DD( - "h_ref", - getTH1DFromTGraphErrors( - g_ref, "ref", ";x (mm);S", rpdp.second.x_slice_n_, rpdp.second.x_slice_w_, rpdp.second.x_slice_min_)); - iBooker.book1DD( - "h_test", - getTH1DFromTGraphErrors(g_test, "test", ";x (mm);S", rpd.x_slice_n_, rpd.x_slice_w_, rpd.x_slice_min_)); + iBooker.setCurrentFolder(folder_ + "/harvester/x alignment/" + rpc.name_); + + std::unique_ptr histPtr = getTH1DFromTGraphErrors( + g_ref.get(), "ref", ";x (mm);S", rpc_ref.x_slice_n_, rpc_ref.x_slice_w_, rpc_ref.x_slice_min_); + iBooker.book1DD("h_ref", histPtr.get()); + + histPtr = + getTH1DFromTGraphErrors(g_test.get(), "test", ";x (mm);S", rpc.x_slice_n_, rpc.x_slice_w_, rpc.x_slice_min_); + iBooker.book1DD("h_test", histPtr.get()); if (debug_) { gDirectory = rpDir; @@ -445,116 +643,124 @@ void PPSAlignmentHarvester::xAlignment(DQMStore::IBooker &iBooker, g_test->Write("g_test"); } - const auto &shiftRange = cfg_ref.matchingShiftRanges().at(rpd.id_); + const auto& shiftRange = cfg.matchingShiftRanges().at(rpc.id_); double sh = 0., sh_unc = 0.; + + // matching doMatch(iBooker, cfg, - rpd, - g_ref, - g_test, - cfg_ref.alignment_x_meth_o_ranges().at(rpd.id_), + rpc, + g_ref.get(), + g_test.get(), + cfg_ref.alignment_x_meth_o_ranges().at(rpc.id_), shiftRange.x_min_, shiftRange.x_max_, sh, sh_unc); + // save the results CTPPSRPAlignmentCorrectionData rpResult(sh, sh_unc, 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.); - results.setRPCorrection(rpd.id_, rpResult); + xAliResults_.setRPCorrection(rpc.id_, rpResult); edm::LogInfo("PPS") << std::fixed << std::setprecision(3) << "[x_alignment] " - << "Setting sh_x of " << rpd.name_ << " to " << sh; - sh_x_map[rpd.id_] = sh; + << "Setting sh_x of " << rpc.name_ << " to " << sh; + + // update the shift + if (overwriteShX_) { + sh_x_map_[rpc.id_] = sh; + } } } - edm::LogInfo("PPS") << seqPos + 1 << ": x_alignment:\n" << results; + edm::LogInfo("PPS") << seqPos + 1 << ": x_alignment:\n" << xAliResults_; - if (resultsFile_.is_open()) - resultsFile_ << seqPos + 1 << ": x_alignment:\n" << results << "\n\n"; + if (textResultsFile_.is_open()) + textResultsFile_ << seqPos + 1 << ": x_alignment:\n" << xAliResults_ << "\n\n"; } // -------------------------------- x alignment relative methods -------------------------------- -void PPSAlignmentHarvester::xAlignmentRelative(DQMStore::IBooker &iBooker, - DQMStore::IGetter &iGetter, - const PPSAlignmentConfig &cfg, +void PPSAlignmentHarvester::xAlignmentRelative(DQMStore::IBooker& iBooker, + DQMStore::IGetter& iGetter, + const PPSAlignmentConfiguration& cfg, int seqPos) { - TDirectory *xAliRelDir = nullptr; + TDirectory* xAliRelDir = nullptr; if (debug_) xAliRelDir = debugFile_->mkdir((std::to_string(seqPos + 1) + ": x_alignment_relative").c_str()); - // prepare results - CTPPSRPAlignmentCorrectionsData results; - CTPPSRPAlignmentCorrectionsData results_sl_fix; - - TF1 *ff = new TF1("ff", "[0] + [1]*(x - [2])"); - TF1 *ff_sl_fix = new TF1("ff_sl_fix", "[0] + [1]*(x - [2])"); + auto ff = std::make_unique("ff", "[0] + [1]*(x - [2])"); + auto ff_sl_fix = std::make_unique("ff_sl_fix", "[0] + [1]*(x - [2])"); // processing - for (const auto &sd : {cfg.sectorConfig45(), cfg.sectorConfig56()}) { - TDirectory *sectorDir = nullptr; + for (const auto& sc : {cfg.sectorConfig45(), cfg.sectorConfig56()}) { + TDirectory* sectorDir = nullptr; if (debug_) { - sectorDir = xAliRelDir->mkdir(sd.name_.c_str()); + sectorDir = xAliRelDir->mkdir(sc.name_.c_str()); gDirectory = sectorDir; } - auto *p_x_diffFN_vs_x_N_monitor = iGetter.get(folder_ + "/worker/" + sd.name_ + "/near_far/p_x_diffFN_vs_x_N"); + auto* p_x_diffFN_vs_x_N_monitor = iGetter.get(folder_ + "/worker/" + sc.name_ + "/near_far/p_x_diffFN_vs_x_N"); if (p_x_diffFN_vs_x_N_monitor == nullptr) { - edm::LogWarning("PPS") << "[x_alignment_relative] " << sd.name_ << ": cannot load data, skipping"; + edm::LogWarning("PPS") << "[x_alignment_relative] " << sc.name_ << ": cannot load data, skipping"; continue; } - TProfile *p_x_diffFN_vs_x_N = p_x_diffFN_vs_x_N_monitor->getTProfile(); + TProfile* p_x_diffFN_vs_x_N = p_x_diffFN_vs_x_N_monitor->getTProfile(); if (p_x_diffFN_vs_x_N->GetEntries() < cfg.nearFarMinEntries()) { - edm::LogWarning("PPS") << "[x_alignment_relative] " << sd.name_ << ": insufficient data, skipping (near_far " + edm::LogWarning("PPS") << "[x_alignment_relative] " << sc.name_ << ": insufficient data, skipping (near_far " << p_x_diffFN_vs_x_N->GetEntries() << "/" << cfg.nearFarMinEntries() << ")"; continue; } - const double xMin = cfg.alignment_x_relative_ranges().at(sd.rp_N_.id_).x_min_; - const double xMax = cfg.alignment_x_relative_ranges().at(sd.rp_N_.id_).x_max_; + const double x_min = cfg.alignment_x_relative_ranges().at(sc.rp_N_.id_).x_min_; + const double x_max = cfg.alignment_x_relative_ranges().at(sc.rp_N_.id_).x_max_; - const double sh_x_N = sh_x_map[sd.rp_N_.id_]; - double slope = sd.slope_; + const double sh_x_N = sh_x_map_[sc.rp_N_.id_]; + double slope = sc.slope_; ff->SetParameters(0., slope, 0.); ff->FixParameter(2, -sh_x_N); ff->SetLineColor(2); - p_x_diffFN_vs_x_N->Fit(ff, "Q", "", xMin, xMax); + p_x_diffFN_vs_x_N->Fit(ff.get(), "Q", "", x_min, x_max); const double a = ff->GetParameter(1), a_unc = ff->GetParError(1); const double b = ff->GetParameter(0), b_unc = ff->GetParError(0); - edm::LogInfo("PPS") << "[x_alignment_relative] " << sd.name_ << ":\n" - << std::fixed << std::setprecision(3) << " x_min = " << xMin << ", x_max = " << xMax << "\n" + edm::LogInfo("PPS") << "[x_alignment_relative] " << sc.name_ << ":\n" + << std::fixed << std::setprecision(3) << " x_min = " << x_min << ", x_max = " << x_max + << "\n" << " sh_x_N = " << sh_x_N << ", slope (fix) = " << slope << ", slope (fitted) = " << a; CTPPSRPAlignmentCorrectionData rpResult_N(+b / 2., b_unc / 2., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.); - results.setRPCorrection(sd.rp_N_.id_, rpResult_N); + xAliRelResults_.setRPCorrection(sc.rp_N_.id_, rpResult_N); CTPPSRPAlignmentCorrectionData rpResult_F(-b / 2., b_unc / 2., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.); - results.setRPCorrection(sd.rp_F_.id_, rpResult_F); + xAliRelResults_.setRPCorrection(sc.rp_F_.id_, rpResult_F); ff_sl_fix->SetParameters(0., slope, 0.); ff_sl_fix->FixParameter(1, slope); ff_sl_fix->FixParameter(2, -sh_x_N); ff_sl_fix->SetLineColor(4); - p_x_diffFN_vs_x_N->Fit(ff_sl_fix, "Q+", "", xMin, xMax); + p_x_diffFN_vs_x_N->Fit(ff_sl_fix.get(), "Q+", "", x_min, x_max); const double b_fs = ff_sl_fix->GetParameter(0), b_fs_unc = ff_sl_fix->GetParError(0); CTPPSRPAlignmentCorrectionData rpResult_sl_fix_N(+b_fs / 2., b_fs_unc / 2., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.); - results_sl_fix.setRPCorrection(sd.rp_N_.id_, rpResult_sl_fix_N); + xAliRelResultsSlopeFixed_.setRPCorrection(sc.rp_N_.id_, rpResult_sl_fix_N); CTPPSRPAlignmentCorrectionData rpResult_sl_fix_F(-b_fs / 2., b_fs_unc / 2., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.); - results_sl_fix.setRPCorrection(sd.rp_F_.id_, rpResult_sl_fix_F); + xAliRelResultsSlopeFixed_.setRPCorrection(sc.rp_F_.id_, rpResult_sl_fix_F); edm::LogInfo("PPS") << "[x_alignment_relative] " << std::fixed << std::setprecision(3) << "ff: " << ff->GetParameter(0) << " + " << ff->GetParameter(1) << " * (x - " << ff->GetParameter(2) << "), ff_sl_fix: " << ff_sl_fix->GetParameter(0) << " + " << ff_sl_fix->GetParameter(1) << " * (x - " << ff_sl_fix->GetParameter(2) << ")"; + // rebook the diffFN plot in the harvester + iBooker.setCurrentFolder(folder_ + "/harvester/x_alignment_relative/" + sc.name_); + iBooker.bookProfile("p_x_diffFN_vs_x_N", p_x_diffFN_vs_x_N); + if (debug_) { p_x_diffFN_vs_x_N->Write("p_x_diffFN_vs_x_N"); - TGraph *g_results = new TGraph(); + auto g_results = std::make_unique(); g_results->SetPoint(0, sh_x_N, 0.); g_results->SetPoint(1, a, a_unc); g_results->SetPoint(2, b, b_unc); @@ -565,18 +771,18 @@ void PPSAlignmentHarvester::xAlignmentRelative(DQMStore::IBooker &iBooker, // write results edm::LogInfo("PPS") << seqPos + 1 << ": x_alignment_relative:\n" - << results << seqPos + 1 << ": x_alignment_relative_sl_fix:\n" - << results_sl_fix; + << xAliRelResults_ << seqPos + 1 << ": x_alignment_relative_sl_fix:\n" + << xAliRelResultsSlopeFixed_; - if (resultsFile_.is_open()) { - resultsFile_ << seqPos + 1 << ": x_alignment_relative:\n" << results << "\n"; - resultsFile_ << seqPos + 1 << ": x_alignment_relative_sl_fix:\n" << results_sl_fix << "\n\n"; + if (textResultsFile_.is_open()) { + textResultsFile_ << seqPos + 1 << ": x_alignment_relative:\n" << xAliRelResults_ << "\n"; + textResultsFile_ << seqPos + 1 << ": x_alignment_relative_sl_fix:\n" << xAliRelResultsSlopeFixed_ << "\n\n"; } } // -------------------------------- y alignment methods -------------------------------- -double PPSAlignmentHarvester::findMax(TF1 *ff_fit) { +double PPSAlignmentHarvester::findMax(TF1* ff_fit) { const double mu = ff_fit->GetParameter(1); const double si = ff_fit->GetParameter(2); @@ -584,30 +790,28 @@ double PPSAlignmentHarvester::findMax(TF1 *ff_fit) { if (si > 25. || std::fabs(mu) > 100.) return 1E100; - double xMax = 1E100; - double yMax = -1E100; + double x_max = 1E100; + double y_max = -1E100; for (double x = mu - si; x <= mu + si; x += 0.001) { double y = ff_fit->Eval(x); - if (y > yMax) { - xMax = x; - yMax = y; + if (y > y_max) { + x_max = x; + y_max = y; } } - return xMax; + return x_max; } -TGraphErrors *PPSAlignmentHarvester::buildModeGraph(DQMStore::IBooker &iBooker, - MonitorElement *h2_y_vs_x, - const PPSAlignmentConfig &cfg, - const RPConfig &rpd) { - TDirectory *d_top = nullptr; +TH1D* PPSAlignmentHarvester::buildModeGraph(DQMStore::IBooker& iBooker, + MonitorElement* h2_y_vs_x, + const PPSAlignmentConfiguration& cfg, + const PPSAlignmentConfiguration::RPConfig& rpc) { + TDirectory* d_top = nullptr; if (debug_) d_top = gDirectory; - TF1 *ff_fit = new TF1("ff_fit", "[0] * exp(-(x-[1])*(x-[1])/2./[2]/[2]) + [3] + [4]*x"); - - TGraphErrors *g_y_mode_vs_x = new TGraphErrors(); + auto ff_fit = std::make_unique("ff_fit", "[0] * exp(-(x-[1])*(x-[1])/2./[2]/[2]) + [3] + [4]*x"); int h_n = h2_y_vs_x->getNbinsX(); double diff = h2_y_vs_x->getTH2D()->GetXaxis()->GetBinWidth(1) / 2.; @@ -619,11 +823,10 @@ TGraphErrors *PPSAlignmentHarvester::buildModeGraph(DQMStore::IBooker &iBooker, for (int bix = 1; bix <= h_n; bix++) { const double x = h2_y_vs_x->getTH2D()->GetXaxis()->GetBinCenter(bix); - const double x_unc = h2_y_vs_x->getTH2D()->GetXaxis()->GetBinWidth(bix) / 2.; char buf[100]; sprintf(buf, "h_y_x=%.3f", x); - TH1D *h_y = h2_y_vs_x->getTH2D()->ProjectionY(buf, bix, bix); + TH1D* h_y = h2_y_vs_x->getTH2D()->ProjectionY(buf, bix, bix); if (h_y->GetEntries() < cfg.multSelProjYMinEntries()) continue; @@ -645,20 +848,20 @@ TGraphErrors *PPSAlignmentHarvester::buildModeGraph(DQMStore::IBooker &iBooker, ff_fit->SetParameters(conMax, conMax_x, h_y->GetRMS() * 0.75, 0., 0.); ff_fit->FixParameter(4, 0.); - double xMin = rpd.x_min_fit_mode_, xMax = rpd.x_max_fit_mode_; - h_y->Fit(ff_fit, "Q", "", xMin, xMax); + double x_min = rpc.x_min_fit_mode_, x_max = rpc.x_max_fit_mode_; + h_y->Fit(ff_fit.get(), "Q", "", x_min, x_max); ff_fit->ReleaseParameter(4); double w = std::min(4., 2. * ff_fit->GetParameter(2)); - xMin = ff_fit->GetParameter(1) - w; - xMax = std::min(rpd.y_max_fit_mode_, ff_fit->GetParameter(1) + w); + x_min = ff_fit->GetParameter(1) - w; + x_max = std::min(rpc.y_max_fit_mode_, ff_fit->GetParameter(1) + w); - h_y->Fit(ff_fit, "Q", "", xMin, xMax); + h_y->Fit(ff_fit.get(), "Q", "", x_min, x_max); if (debug_) h_y->Write("h_y"); - double y_mode = findMax(ff_fit); + double y_mode = findMax(ff_fit.get()); const double y_mode_fit_unc = ff_fit->GetParameter(2) / 10; const double y_mode_sys_unc = cfg.y_mode_sys_unc(); double y_mode_unc = std::sqrt(y_mode_fit_unc * y_mode_fit_unc + y_mode_sys_unc * y_mode_sys_unc); @@ -670,7 +873,7 @@ TGraphErrors *PPSAlignmentHarvester::buildModeGraph(DQMStore::IBooker &iBooker, ff_fit->GetChisquare() / ff_fit->GetNDF() > chiSqThreshold); if (debug_) { - TGraph *g_data = new TGraph(); + auto g_data = std::make_unique(); g_data->SetPoint(0, y_mode, y_mode_unc); g_data->SetPoint(1, ff_fit->GetChisquare(), ff_fit->GetNDF()); g_data->SetPoint(2, valid, 0.); @@ -680,90 +883,82 @@ TGraphErrors *PPSAlignmentHarvester::buildModeGraph(DQMStore::IBooker &iBooker, if (!valid) continue; - int idx = g_y_mode_vs_x->GetN(); - g_y_mode_vs_x->SetPoint(idx, x, y_mode); - g_y_mode_vs_x->SetPointError(idx, x_unc, y_mode_unc); - h_mode->Fill(x, y_mode); h_mode->setBinError(bix, y_mode_unc); } - return g_y_mode_vs_x; + return h_mode->getTH1D(); } -void PPSAlignmentHarvester::yAlignment(DQMStore::IBooker &iBooker, - DQMStore::IGetter &iGetter, - const PPSAlignmentConfig &cfg, +void PPSAlignmentHarvester::yAlignment(DQMStore::IBooker& iBooker, + DQMStore::IGetter& iGetter, + const PPSAlignmentConfiguration& cfg, int seqPos) { - TDirectory *yAliDir = nullptr; + TDirectory* yAliDir = nullptr; if (debug_) yAliDir = debugFile_->mkdir((std::to_string(seqPos + 1) + ": y_alignment").c_str()); - // prepare results - CTPPSRPAlignmentCorrectionsData results; - CTPPSRPAlignmentCorrectionsData results_sl_fix; - - TF1 *ff = new TF1("ff", "[0] + [1]*(x - [2])"); - TF1 *ff_sl_fix = new TF1("ff_sl_fix", "[0] + [1]*(x - [2])"); + auto ff = std::make_unique("ff", "[0] + [1]*(x - [2])"); + auto ff_sl_fix = std::make_unique("ff_sl_fix", "[0] + [1]*(x - [2])"); // processing - for (const auto &sd : {cfg.sectorConfig45(), cfg.sectorConfig56()}) { - for (const auto &rpd : {sd.rp_F_, sd.rp_N_}) { - TDirectory *rpDir = nullptr; + for (const auto& sc : {cfg.sectorConfig45(), cfg.sectorConfig56()}) { + for (const auto& rpc : {sc.rp_F_, sc.rp_N_}) { + TDirectory* rpDir = nullptr; if (debug_) { - rpDir = yAliDir->mkdir(rpd.name_.c_str()); + rpDir = yAliDir->mkdir(rpc.name_.c_str()); gDirectory = rpDir->mkdir("x"); } - auto *h2_y_vs_x = - iGetter.get(folder_ + "/worker/" + sd.name_ + "/multiplicity selection/" + rpd.name_ + "/h2_y_vs_x"); + auto* h2_y_vs_x = + iGetter.get(folder_ + "/worker/" + sc.name_ + "/multiplicity selection/" + rpc.name_ + "/h2_y_vs_x"); if (h2_y_vs_x == nullptr) { - edm::LogWarning("PPS") << "[y_alignment] " << rpd.name_ << ": cannot load data, skipping"; + edm::LogWarning("PPS") << "[y_alignment] " << rpc.name_ << ": cannot load data, skipping"; continue; } - iBooker.setCurrentFolder(folder_ + "/harvester/y alignment/" + rpd.name_); - auto *g_y_cen_vs_x = buildModeGraph(iBooker, h2_y_vs_x, cfg, rpd); + iBooker.setCurrentFolder(folder_ + "/harvester/y alignment/" + rpc.name_); + auto* h_y_cen_vs_x = buildModeGraph(iBooker, h2_y_vs_x, cfg, rpc); - if ((unsigned int)g_y_cen_vs_x->GetN() < cfg.modeGraphMinN()) { - edm::LogWarning("PPS") << "[y_alignment] " << rpd.name_ << ": insufficient data, skipping (mode graph " - << g_y_cen_vs_x->GetN() << "/" << cfg.modeGraphMinN() << ")"; + if ((unsigned int)h_y_cen_vs_x->GetEntries() < cfg.modeGraphMinN()) { + edm::LogWarning("PPS") << "[y_alignment] " << rpc.name_ << ": insufficient data, skipping (mode graph " + << h_y_cen_vs_x->GetEntries() << "/" << cfg.modeGraphMinN() << ")"; continue; } - const double xMin = cfg.alignment_y_ranges().at(rpd.id_).x_min_; - const double xMax = cfg.alignment_y_ranges().at(rpd.id_).x_max_; + const double x_min = cfg.alignment_y_ranges().at(rpc.id_).x_min_; + const double x_max = cfg.alignment_y_ranges().at(rpc.id_).x_max_; - const double sh_x = sh_x_map[rpd.id_]; - double slope = rpd.slope_; + const double sh_x = sh_x_map_[rpc.id_]; + double slope = rpc.slope_; ff->SetParameters(0., 0., 0.); ff->FixParameter(2, -sh_x); ff->SetLineColor(2); - g_y_cen_vs_x->Fit(ff, "Q", "", xMin, xMax); + h_y_cen_vs_x->Fit(ff.get(), "Q", "", x_min, x_max); const double a = ff->GetParameter(1), a_unc = ff->GetParError(1); const double b = ff->GetParameter(0), b_unc = ff->GetParError(0); - edm::LogInfo("PPS") << "[y_alignment] " << rpd.name_ << ":\n" - << std::fixed << std::setprecision(3) << " x_min = " << xMin << ", x_max = " << xMax + edm::LogInfo("PPS") << "[y_alignment] " << rpc.name_ << ":\n" + << std::fixed << std::setprecision(3) << " x_min = " << x_min << ", x_max = " << x_max << "\n" << " sh_x = " << sh_x << ", slope (fix) = " << slope << ", slope (fitted) = " << a; CTPPSRPAlignmentCorrectionData rpResult(0., 0., b, b_unc, 0., 0., 0., 0., 0., 0., 0., 0.); - results.setRPCorrection(rpd.id_, rpResult); + yAliResults_.setRPCorrection(rpc.id_, rpResult); ff_sl_fix->SetParameters(0., 0., 0.); ff_sl_fix->FixParameter(1, slope); ff_sl_fix->FixParameter(2, -sh_x); ff_sl_fix->SetLineColor(4); - g_y_cen_vs_x->Fit(ff_sl_fix, "Q+", "", xMin, xMax); + h_y_cen_vs_x->Fit(ff_sl_fix.get(), "Q+", "", x_min, x_max); const double b_fs = ff_sl_fix->GetParameter(0), b_fs_unc = ff_sl_fix->GetParError(0); CTPPSRPAlignmentCorrectionData rpResult_sl_fix(0., 0., b_fs, b_fs_unc, 0., 0., 0., 0., 0., 0., 0., 0.); - results_sl_fix.setRPCorrection(rpd.id_, rpResult_sl_fix); + yAliResultsSlopeFixed_.setRPCorrection(rpc.id_, rpResult_sl_fix); edm::LogInfo("PPS") << "[y_alignment] " << std::fixed << std::setprecision(3) << "ff: " << ff->GetParameter(0) << " + " << ff->GetParameter(1) << " * (x - " << ff->GetParameter(2) @@ -773,10 +968,10 @@ void PPSAlignmentHarvester::yAlignment(DQMStore::IBooker &iBooker, if (debug_) { gDirectory = rpDir; - g_y_cen_vs_x->SetTitle(";x (mm); mode of y (mm)"); - g_y_cen_vs_x->Write("g_y_cen_vs_x"); + h_y_cen_vs_x->SetTitle(";x (mm); mode of y (mm)"); + h_y_cen_vs_x->Write("h_y_cen_vs_x"); - TGraph *g_results = new TGraph(); + auto g_results = std::make_unique(); g_results->SetPoint(0, sh_x, 0.); g_results->SetPoint(1, a, a_unc); g_results->SetPoint(2, b, b_unc); @@ -788,33 +983,60 @@ void PPSAlignmentHarvester::yAlignment(DQMStore::IBooker &iBooker, // write results edm::LogInfo("PPS") << seqPos + 1 << ": y_alignment:\n" - << results << seqPos + 1 << ": y_alignment_sl_fix:\n" - << results_sl_fix; + << yAliResults_ << seqPos + 1 << ": y_alignment_sl_fix:\n" + << yAliResultsSlopeFixed_; - if (resultsFile_.is_open()) { - resultsFile_ << seqPos + 1 << ": y_alignment:\n" << results << "\n"; - resultsFile_ << seqPos + 1 << ": y_alignment_sl_fix:\n" << results_sl_fix << "\n\n"; + if (textResultsFile_.is_open()) { + textResultsFile_ << seqPos + 1 << ": y_alignment:\n" << yAliResults_ << "\n"; + textResultsFile_ << seqPos + 1 << ": y_alignment_sl_fix:\n" << yAliResultsSlopeFixed_ << "\n\n"; } } -// -------------------------------- PPSAlignmentHarvester methods -------------------------------- +// -------------------------------- other methods -------------------------------- + +void PPSAlignmentHarvester::writeCutPlot(TH2D* h, double a, double c, double n_si, double si, const std::string& label) { + auto canvas = std::make_unique(); + canvas->SetName(label.c_str()); + canvas->SetLogz(1); + + h->Draw("colz"); + + double x_min = -30.; + double x_max = 30.; + + auto g_up = std::make_unique(); + g_up->SetName("g_up"); + g_up->SetPoint(0, x_min, -a * x_min - c + n_si * si); + g_up->SetPoint(1, x_max, -a * x_max - c + n_si * si); + g_up->SetLineColor(1); + g_up->Draw("l"); + + auto g_down = std::make_unique(); + g_down->SetName("g_down"); + g_down->SetPoint(0, x_min, -a * x_min - c - n_si * si); + g_down->SetPoint(1, x_max, -a * x_max - c - n_si * si); + g_down->SetLineColor(1); + g_down->Draw("l"); + + canvas->Write(); +} // Points in TGraph should be sorted (TGraph::Sort()) // if n, binWidth, or min is set to -1, method will find it on its own -TH1D *PPSAlignmentHarvester::getTH1DFromTGraphErrors( - TGraphErrors *graph, std::string title, std::string labels, int n, double binWidth, double min) { - TH1D *hist; +std::unique_ptr PPSAlignmentHarvester::getTH1DFromTGraphErrors( + TGraphErrors* graph, std::string title, std::string labels, int n, double binWidth, double min) { + std::unique_ptr hist; if (n == 0) { - hist = new TH1D(title.c_str(), labels.c_str(), 0, -10., 10.); + hist = std::make_unique(title.c_str(), labels.c_str(), 0, -10., 10.); } else if (n == 1) { - hist = new TH1D(title.c_str(), labels.c_str(), 1, graph->GetPointX(0) - 5., graph->GetPointX(0) + 5.); + hist = std::make_unique(title.c_str(), labels.c_str(), 1, graph->GetPointX(0) - 5., graph->GetPointX(0) + 5.); } else { n = n == -1 ? graph->GetN() : n; binWidth = binWidth == -1 ? graph->GetPointX(1) - graph->GetPointX(0) : binWidth; double diff = binWidth / 2.; min = min == -1 ? graph->GetPointX(0) - diff : min; double max = min + n * binWidth; - hist = new TH1D(title.c_str(), labels.c_str(), n, min, max); + hist = std::make_unique(title.c_str(), labels.c_str(), n, min, max); } for (int i = 0; i < graph->GetN(); i++) { @@ -826,55 +1048,4 @@ TH1D *PPSAlignmentHarvester::getTH1DFromTGraphErrors( return hist; } -PPSAlignmentHarvester::PPSAlignmentHarvester(const edm::ParameterSet &iConfig) - : esTokenTest_( - esConsumes(edm::ESInputTag("", ""))), - esTokenReference_(esConsumes( - edm::ESInputTag("", "reference"))), - folder_(iConfig.getParameter("folder")), - debug_(iConfig.getParameter("debug")) {} - -void PPSAlignmentHarvester::dqmEndJob(DQMStore::IBooker &iBooker, DQMStore::IGetter &iGetter) {} - -void PPSAlignmentHarvester::dqmEndRun(DQMStore::IBooker &iBooker, - DQMStore::IGetter &iGetter, - edm::Run const &iRun, - edm::EventSetup const &iSetup) { - const auto &cfg = iSetup.getData(esTokenTest_); - - const auto &cfg_ref = iSetup.getData(esTokenReference_); - - if (debug_) - debugFile_ = new TFile("debug_harvester.root", "recreate"); - - if (!cfg.resultsDir().empty()) - resultsFile_.open(cfg.resultsDir(), std::ios::out | std::ios::trunc); - - // setting default sh_x values from config - for (const auto &sd : {cfg.sectorConfig45(), cfg.sectorConfig56()}) { - for (const auto &rpd : {sd.rp_N_, sd.rp_F_}) { - edm::LogInfo("PPS") << "[harvester] " << std::fixed << std::setprecision(3) << "Setting sh_x of " << rpd.name_ - << " to " << rpd.sh_x_; - sh_x_map[rpd.id_] = rpd.sh_x_; - } - } - - for (unsigned int i = 0; i < cfg.sequence().size(); i++) { - if (cfg.sequence()[i] == "x_alignment") - xAlignment(iBooker, iGetter, cfg, cfg_ref, i); - else if (cfg.sequence()[i] == "x_alignment_relative") - xAlignmentRelative(iBooker, iGetter, cfg, i); - else if (cfg.sequence()[i] == "y_alignment") - yAlignment(iBooker, iGetter, cfg, i); - else - edm::LogError("PPS") << "[harvester] " << cfg.sequence()[i] << " is a wrong method name."; - } - - if (debug_) - delete debugFile_; - - if (resultsFile_.is_open()) - resultsFile_.close(); -} - -DEFINE_FWK_MODULE(PPSAlignmentHarvester); \ No newline at end of file +DEFINE_FWK_MODULE(PPSAlignmentHarvester); diff --git a/CalibPPS/AlignmentGlobal/plugins/PPSAlignmentWorker.cc b/CalibPPS/AlignmentGlobal/plugins/PPSAlignmentWorker.cc index 00844dbeb85d8..0c4c29f063091 100644 --- a/CalibPPS/AlignmentGlobal/plugins/PPSAlignmentWorker.cc +++ b/CalibPPS/AlignmentGlobal/plugins/PPSAlignmentWorker.cc @@ -1,14 +1,8 @@ /**************************************************************************** - * - * CalibPPS/AlignmentGlobal/plugins/PPSAlignmentWorker.cc - * - * Description : PPS Alignment DQM worker - * - * Authors: - * - Jan KaÅ¡par - * - Mateusz Kocot - * - ****************************************************************************/ +* Authors: +* Jan KaÅ¡par (jan.kaspar@gmail.com) +* Mateusz Kocot (mateuszkocot99@gmail.com) +****************************************************************************/ #include "DQMServices/Core/interface/DQMEDAnalyzer.h" #include "DQMServices/Core/interface/DQMStore.h" @@ -25,12 +19,13 @@ #include "DataFormats/CTPPSReco/interface/CTPPSLocalTrackLite.h" #include "DataFormats/CTPPSReco/interface/CTPPSLocalTrackLiteFwd.h" -#include "CondFormats/PPSObjects/interface/PPSAlignmentConfig.h" -#include "CondFormats/DataRecord/interface/PPSAlignmentConfigRcd.h" +#include "CondFormats/PPSObjects/interface/PPSAlignmentConfiguration.h" +#include "CondFormats/DataRecord/interface/PPSAlignmentConfigurationRcd.h" #include #include #include +#include #include "TH2D.h" #include "TGraph.h" @@ -39,86 +34,151 @@ class PPSAlignmentWorker : public DQMEDAnalyzer { public: - PPSAlignmentWorker(const edm::ParameterSet &iConfig); + PPSAlignmentWorker(const edm::ParameterSet& iConfig); + + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); private: - void bookHistograms(DQMStore::IBooker &iBooker, edm::Run const &, edm::EventSetup const &iSetup) override; - void analyze(const edm::Event &iEvent, const edm::EventSetup &iSetup) override; + void bookHistograms(DQMStore::IBooker& iBooker, edm::Run const&, edm::EventSetup const& iSetup) override; + void analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) override; // ------------ structures ------------ struct SectorData { - SectorConfig scfg; + PPSAlignmentConfiguration::SectorConfig scfg_; // hit distributions - std::map m_h2_y_vs_x_bef_sel; + std::map m_h2_y_vs_x_bef_sel; - std::map m_h2_y_vs_x_mlt_sel; + std::map m_h2_y_vs_x_mlt_sel; - std::map m_h2_y_vs_x_aft_sel; + std::map m_h2_y_vs_x_aft_sel; // cut plots - MonitorElement *h_q_cut_h_bef, *h_q_cut_h_aft; - MonitorElement *h2_cut_h_bef, *h2_cut_h_aft; + MonitorElement* h_q_cut_h_bef; + MonitorElement* h_q_cut_h_aft; + MonitorElement* h2_cut_h_bef; + MonitorElement* h2_cut_h_aft; - MonitorElement *h_q_cut_v_bef, *h_q_cut_v_aft; - MonitorElement *h2_cut_v_bef, *h2_cut_v_aft; + MonitorElement* h_q_cut_v_bef; + MonitorElement* h_q_cut_v_aft; + MonitorElement* h2_cut_v_bef; + MonitorElement* h2_cut_v_aft; // near-far plots - MonitorElement *p_x_diffFN_vs_x_N; - MonitorElement *p_y_diffFN_vs_y_F; + MonitorElement* p_x_diffFN_vs_x_N; + MonitorElement* p_y_diffFN_vs_y_F; struct SlicePlots { - MonitorElement *h_y; - MonitorElement *h2_y_diffFN_vs_y; - MonitorElement *p_y_diffFN_vs_y; + MonitorElement* h_y; + MonitorElement* h2_y_diffFN_vs_y; + MonitorElement* p_y_diffFN_vs_y; SlicePlots(); - SlicePlots(DQMStore::IBooker &iBooker, bool debug); + SlicePlots(DQMStore::IBooker& iBooker, const PPSAlignmentConfiguration& cfg, bool debug); }; std::map x_slice_plots_N, x_slice_plots_F; - void init(DQMStore::IBooker &iBooker, - const PPSAlignmentConfig &cfg, - const SectorConfig &_scfg, - const std::string &folder, + void init(DQMStore::IBooker& iBooker, + const PPSAlignmentConfiguration& cfg, + const PPSAlignmentConfiguration::SectorConfig& scfg, + const std::string& folder, bool debug); - unsigned int process(const CTPPSLocalTrackLiteCollection &tracks, const PPSAlignmentConfig &cfg, bool debug); + unsigned int process(const CTPPSLocalTrackLiteCollection& tracks, const PPSAlignmentConfiguration& cfg, bool debug); }; // ------------ member data ------------ - edm::ESGetToken esTokenBookHistograms_; - edm::ESGetToken esTokenAnalyze_; + edm::ESGetToken esTokenBookHistograms_; + edm::ESGetToken esTokenAnalyze_; edm::EDGetTokenT tracksToken_; - SectorData sectorData45; - SectorData sectorData56; + SectorData sectorData45_; + SectorData sectorData56_; std::string folder_; bool debug_; }; +// -------------------------------- DQMEDAnalyzer methods -------------------------------- + +PPSAlignmentWorker::PPSAlignmentWorker(const edm::ParameterSet& iConfig) + : esTokenBookHistograms_( + esConsumes( + edm::ESInputTag("", iConfig.getParameter("label")))), + esTokenAnalyze_(esConsumes( + edm::ESInputTag("", iConfig.getParameter("label")))), + tracksToken_(consumes(iConfig.getParameter("tagTracks"))), + folder_(iConfig.getParameter("folder")), + debug_(iConfig.getParameter("debug")) { + edm::LogInfo("PPS").log([&](auto& li) { + li << "[worker] parameters:\n"; + li << "* label: " << iConfig.getParameter("label") << "\n"; + li << "* tagTracks: " << iConfig.getParameter("tagTracks") << "\n"; + li << "* folder: " << folder_ << "\n"; + li << "* debug: " << std::boolalpha << debug_; + }); +} + +void PPSAlignmentWorker::bookHistograms(DQMStore::IBooker& iBooker, edm::Run const&, edm::EventSetup const& iSetup) { + const auto& cfg = iSetup.getData(esTokenBookHistograms_); + + sectorData45_.init(iBooker, cfg, cfg.sectorConfig45(), folder_ + "/worker", debug_); + sectorData56_.init(iBooker, cfg, cfg.sectorConfig56(), folder_ + "/worker", debug_); +} + +void PPSAlignmentWorker::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { + const auto& tracks = iEvent.get(tracksToken_); + + const auto& cfg = iSetup.getData(esTokenAnalyze_); + + sectorData45_.process(tracks, cfg, debug_); + sectorData56_.process(tracks, cfg, debug_); +} + +void PPSAlignmentWorker::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + + desc.add("label", ""); + desc.add("tagTracks", edm::InputTag("ctppsLocalTrackLiteProducer")); + desc.add("folder", "CalibPPS/Common"); + desc.add("debug", false); + + descriptions.addWithDefaultLabel(desc); +} + // -------------------------------- SectorData and SlicePlots methods -------------------------------- PPSAlignmentWorker::SectorData::SlicePlots::SlicePlots() {} -PPSAlignmentWorker::SectorData::SlicePlots::SlicePlots(DQMStore::IBooker &iBooker, bool debug) { - h_y = iBooker.book1DD("h_y", ";y", 100, -10., 10.); - auto *tmp = new TProfile("", ";y;x_{F} - y_{N}", 100, -10., 10.); - p_y_diffFN_vs_y = iBooker.bookProfile("p_y_diffFN_vs_y", tmp); +PPSAlignmentWorker::SectorData::SlicePlots::SlicePlots(DQMStore::IBooker& iBooker, + const PPSAlignmentConfiguration& cfg, + bool debug) { + h_y = iBooker.book1DD( + "h_y", ";y", cfg.binning().slice_n_bins_x_, cfg.binning().slice_x_min_, cfg.binning().slice_x_max_); + + auto profilePtr = std::make_unique( + "", ";y;y_{F} - y_{N}", cfg.binning().slice_n_bins_x_, cfg.binning().slice_x_min_, cfg.binning().slice_x_max_); + p_y_diffFN_vs_y = iBooker.bookProfile("p_y_diffFN_vs_y", profilePtr.get()); if (debug) - h2_y_diffFN_vs_y = iBooker.book2DD("h2_y_diffFN_vs_y", ";y;x_{F} - y_{N}", 100, -10., 10., 100, -2., 2.); + h2_y_diffFN_vs_y = iBooker.book2DD("h2_y_diffFN_vs_y", + ";y;y_{F} - y_{N}", + cfg.binning().slice_n_bins_x_, + cfg.binning().slice_x_min_, + cfg.binning().slice_x_max_, + cfg.binning().slice_n_bins_y_, + cfg.binning().slice_y_min_, + cfg.binning().slice_y_max_); } -void PPSAlignmentWorker::SectorData::init(DQMStore::IBooker &iBooker, - const PPSAlignmentConfig &cfg, - const SectorConfig &_scfg, - const std::string &folder, +void PPSAlignmentWorker::SectorData::init(DQMStore::IBooker& iBooker, + const PPSAlignmentConfiguration& cfg, + const PPSAlignmentConfiguration::SectorConfig& scfg, + const std::string& folder, bool debug) { - scfg = _scfg; + scfg_ = scfg; // binning const double bin_size_x = cfg.binning().bin_size_x_; @@ -133,29 +193,29 @@ void PPSAlignmentWorker::SectorData::init(DQMStore::IBooker &iBooker, const double y_min = cfg.binning().y_min_, y_max = cfg.binning().y_max_; // hit distributions - iBooker.setCurrentFolder(folder + "/" + scfg.name_ + "/before selection/" + scfg.rp_N_.name_); - m_h2_y_vs_x_bef_sel[scfg.rp_N_.id_] = + iBooker.setCurrentFolder(folder + "/" + scfg_.name_ + "/before selection/" + scfg_.rp_N_.name_); + m_h2_y_vs_x_bef_sel[scfg_.rp_N_.id_] = iBooker.book2DD("h2_y_vs_x", ";x;y", n_bins_x, x_min_str, x_max_str, n_bins_y, y_min, y_max); - iBooker.setCurrentFolder(folder + "/" + scfg.name_ + "/before selection/" + scfg.rp_F_.name_); - m_h2_y_vs_x_bef_sel[scfg.rp_F_.id_] = + iBooker.setCurrentFolder(folder + "/" + scfg_.name_ + "/before selection/" + scfg_.rp_F_.name_); + m_h2_y_vs_x_bef_sel[scfg_.rp_F_.id_] = iBooker.book2DD("h2_y_vs_x", ";x;y", n_bins_x, x_min_pix, x_max_pix, n_bins_y, y_min, y_max); - iBooker.setCurrentFolder(folder + "/" + scfg.name_ + "/multiplicity selection/" + scfg.rp_N_.name_); - m_h2_y_vs_x_mlt_sel[scfg.rp_N_.id_] = + iBooker.setCurrentFolder(folder + "/" + scfg_.name_ + "/multiplicity selection/" + scfg_.rp_N_.name_); + m_h2_y_vs_x_mlt_sel[scfg_.rp_N_.id_] = iBooker.book2DD("h2_y_vs_x", ";x;y", n_bins_x, x_min_str, x_max_str, n_bins_y, y_min, y_max); - iBooker.setCurrentFolder(folder + "/" + scfg.name_ + "/multiplicity selection/" + scfg.rp_F_.name_); - m_h2_y_vs_x_mlt_sel[scfg.rp_F_.id_] = + iBooker.setCurrentFolder(folder + "/" + scfg_.name_ + "/multiplicity selection/" + scfg_.rp_F_.name_); + m_h2_y_vs_x_mlt_sel[scfg_.rp_F_.id_] = iBooker.book2DD("h2_y_vs_x", ";x;y", n_bins_x, x_min_pix, x_max_pix, n_bins_y, y_min, y_max); - iBooker.setCurrentFolder(folder + "/" + scfg.name_ + "/after selection/" + scfg.rp_N_.name_); - m_h2_y_vs_x_aft_sel[scfg.rp_N_.id_] = + iBooker.setCurrentFolder(folder + "/" + scfg_.name_ + "/after selection/" + scfg_.rp_N_.name_); + m_h2_y_vs_x_aft_sel[scfg_.rp_N_.id_] = iBooker.book2DD("h2_y_vs_x", ";x;y", n_bins_x, x_min_str, x_max_str, n_bins_y, y_min, y_max); - iBooker.setCurrentFolder(folder + "/" + scfg.name_ + "/after selection/" + scfg.rp_F_.name_); - m_h2_y_vs_x_aft_sel[scfg.rp_F_.id_] = + iBooker.setCurrentFolder(folder + "/" + scfg_.name_ + "/after selection/" + scfg_.rp_F_.name_); + m_h2_y_vs_x_aft_sel[scfg_.rp_F_.id_] = iBooker.book2DD("h2_y_vs_x", ";x;y", n_bins_x, x_min_pix, x_max_pix, n_bins_y, y_min, y_max); // cut plots - iBooker.setCurrentFolder(folder + "/" + scfg.name_ + "/cuts/cut_h"); + iBooker.setCurrentFolder(folder + "/" + scfg_.name_ + "/cuts/cut_h"); h_q_cut_h_bef = iBooker.book1DD("h_q_cut_h_bef", ";cq_h", 400, -2., 2.); h_q_cut_h_aft = iBooker.book1DD("h_q_cut_h_aft", ";cq_h", 400, -2., 2.); h2_cut_h_bef = @@ -163,119 +223,105 @@ void PPSAlignmentWorker::SectorData::init(DQMStore::IBooker &iBooker, h2_cut_h_aft = iBooker.book2DD("h2_cut_h_aft", ";x_up;x_dw", n_bins_x, x_min_str, x_max_str, n_bins_x, x_min_pix, x_max_pix); - iBooker.setCurrentFolder(folder + "/" + scfg.name_ + "/cuts/cut_v"); + iBooker.setCurrentFolder(folder + "/" + scfg_.name_ + "/cuts/cut_v"); h_q_cut_v_bef = iBooker.book1DD("h_q_cut_v_bef", ";cq_v", 400, -2., 2.); h_q_cut_v_aft = iBooker.book1DD("h_q_cut_v_aft", ";cq_v", 400, -2., 2.); h2_cut_v_bef = iBooker.book2DD("h2_cut_v_bef", ";y_up;y_dw", n_bins_y, y_min, y_max, n_bins_y, y_min, y_max); h2_cut_v_aft = iBooker.book2DD("h2_cut_v_aft", ";y_up;y_dw", n_bins_y, y_min, y_max, n_bins_y, y_min, y_max); // near-far plots - iBooker.setCurrentFolder(folder + "/" + scfg.name_ + "/near_far"); - auto *tmp = new TProfile("", ";x_{N};x_{F} - x_{N}", 100, 0., 20.); - p_x_diffFN_vs_x_N = iBooker.bookProfile("p_x_diffFN_vs_x_N", tmp); + iBooker.setCurrentFolder(folder + "/" + scfg_.name_ + "/near_far"); - for (int i = 0; i < scfg.rp_N_.x_slice_n_; i++) { - const double xMin = scfg.rp_N_.x_slice_min_ + i * scfg.rp_N_.x_slice_w_; - const double xMax = scfg.rp_N_.x_slice_min_ + (i + 1) * scfg.rp_N_.x_slice_w_; + auto profilePtr = std::make_unique("", + ";x_{N};x_{F} - x_{N}", + cfg.binning().diffFN_n_bins_x_, + cfg.binning().diffFN_x_min_, + cfg.binning().diffFN_x_max_); + p_x_diffFN_vs_x_N = iBooker.bookProfile("p_x_diffFN_vs_x_N", profilePtr.get()); + + for (int i = 0; i < scfg_.rp_N_.x_slice_n_; i++) { + const double x_min = scfg_.rp_N_.x_slice_min_ + i * scfg_.rp_N_.x_slice_w_; + const double x_max = scfg_.rp_N_.x_slice_min_ + (i + 1) * scfg_.rp_N_.x_slice_w_; char buf[100]; - sprintf(buf, "%.1f-%.1f", xMin, xMax); + sprintf(buf, "%.1f-%.1f", x_min, x_max); - iBooker.setCurrentFolder(folder + "/" + scfg.name_ + "/near_far/x slices, N/" + buf); - x_slice_plots_N.insert({i, SlicePlots(iBooker, debug)}); + iBooker.setCurrentFolder(folder + "/" + scfg_.name_ + "/near_far/x slices, N/" + buf); + x_slice_plots_N.insert({i, SlicePlots(iBooker, cfg, debug)}); } - for (int i = 0; i < scfg.rp_F_.x_slice_n_; i++) { - const double xMin = scfg.rp_F_.x_slice_min_ + i * scfg.rp_F_.x_slice_w_; - const double xMax = scfg.rp_F_.x_slice_min_ + (i + 1) * scfg.rp_F_.x_slice_w_; + for (int i = 0; i < scfg_.rp_F_.x_slice_n_; i++) { + const double x_min = scfg_.rp_F_.x_slice_min_ + i * scfg_.rp_F_.x_slice_w_; + const double x_max = scfg_.rp_F_.x_slice_min_ + (i + 1) * scfg_.rp_F_.x_slice_w_; char buf[100]; - sprintf(buf, "%.1f-%.1f", xMin, xMax); + sprintf(buf, "%.1f-%.1f", x_min, x_max); - iBooker.setCurrentFolder(folder + "/" + scfg.name_ + "/near_far/x slices, F/" + buf); - x_slice_plots_F.insert({i, SlicePlots(iBooker, debug)}); + iBooker.setCurrentFolder(folder + "/" + scfg_.name_ + "/near_far/x slices, F/" + buf); + x_slice_plots_F.insert({i, SlicePlots(iBooker, cfg, debug)}); } } -unsigned int PPSAlignmentWorker::SectorData::process(const CTPPSLocalTrackLiteCollection &tracks, - const PPSAlignmentConfig &cfg, +unsigned int PPSAlignmentWorker::SectorData::process(const CTPPSLocalTrackLiteCollection& tracks, + const PPSAlignmentConfiguration& cfg, bool debug) { CTPPSLocalTrackLiteCollection tracksUp, tracksDw; - for (const auto &tr : tracks) { + for (const auto& tr : tracks) { CTPPSDetId rpId(tr.rpId()); unsigned int rpDecId = rpId.arm() * 100 + rpId.station() * 10 + rpId.rp(); - if (rpDecId != scfg.rp_N_.id_ && rpDecId != scfg.rp_F_.id_) + if (rpDecId != scfg_.rp_N_.id_ && rpDecId != scfg_.rp_F_.id_) continue; - double x = tr.x(); - double y = tr.y(); - - // re-build track object - CTPPSLocalTrackLite trCorr(tr.rpId(), - x, - 0., - y, - 0., - tr.tx(), - tr.txUnc(), - tr.ty(), - tr.tyUnc(), - tr.chiSquaredOverNDF(), - tr.pixelTrackRecoInfo(), - tr.numberOfPointsUsedForFit(), - tr.time(), - tr.timeUnc()); - - // store corrected track into the right collection - if (rpDecId == scfg.rp_N_.id_) - tracksUp.push_back(trCorr); - if (rpDecId == scfg.rp_F_.id_) - tracksDw.push_back(trCorr); + // store the track in the right collection + if (rpDecId == scfg_.rp_N_.id_) + tracksUp.push_back(tr); + if (rpDecId == scfg_.rp_F_.id_) + tracksDw.push_back(tr); } // update plots before selection - for (const auto &tr : tracksUp) - m_h2_y_vs_x_bef_sel[scfg.rp_N_.id_]->Fill(tr.x(), tr.y()); + for (const auto& tr : tracksUp) + m_h2_y_vs_x_bef_sel[scfg_.rp_N_.id_]->Fill(tr.x(), tr.y()); - for (const auto &tr : tracksDw) - m_h2_y_vs_x_bef_sel[scfg.rp_F_.id_]->Fill(tr.x(), tr.y()); + for (const auto& tr : tracksDw) + m_h2_y_vs_x_bef_sel[scfg_.rp_F_.id_]->Fill(tr.x(), tr.y()); - // skip crowded events - if (tracksUp.size() > cfg.maxRPTracksSize()) + // skip crowded events (multiplicity selection) + if (tracksUp.size() < cfg.minRPTracksSize() || tracksUp.size() > cfg.maxRPTracksSize()) return 0; - if (tracksDw.size() > cfg.maxRPTracksSize()) + if (tracksDw.size() < cfg.minRPTracksSize() || tracksDw.size() > cfg.maxRPTracksSize()) return 0; // update plots with multiplicity selection - for (const auto &tr : tracksUp) - m_h2_y_vs_x_mlt_sel[scfg.rp_N_.id_]->Fill(tr.x(), tr.y()); + for (const auto& tr : tracksUp) + m_h2_y_vs_x_mlt_sel[scfg_.rp_N_.id_]->Fill(tr.x(), tr.y()); - for (const auto &tr : tracksDw) - m_h2_y_vs_x_mlt_sel[scfg.rp_F_.id_]->Fill(tr.x(), tr.y()); + for (const auto& tr : tracksDw) + m_h2_y_vs_x_mlt_sel[scfg_.rp_F_.id_]->Fill(tr.x(), tr.y()); // do the selection unsigned int pairsSelected = 0; - for (const auto &trUp : tracksUp) { - for (const auto &trDw : tracksDw) { + for (const auto& trUp : tracksUp) { + for (const auto& trDw : tracksDw) { h2_cut_h_bef->Fill(trUp.x(), trDw.x()); h2_cut_v_bef->Fill(trUp.y(), trDw.y()); - const double cq_h = trDw.x() + scfg.cut_h_a_ * trUp.x() + scfg.cut_h_c_; + const double cq_h = trDw.x() + scfg_.cut_h_a_ * trUp.x() + scfg_.cut_h_c_; h_q_cut_h_bef->Fill(cq_h); - const bool cv_h = (std::fabs(cq_h) < cfg.n_si() * scfg.cut_h_si_); + const bool cv_h = (std::fabs(cq_h) < cfg.n_si() * scfg_.cut_h_si_); - const double cq_v = trDw.y() + scfg.cut_v_a_ * trUp.y() + scfg.cut_v_c_; + const double cq_v = trDw.y() + scfg_.cut_v_a_ * trUp.y() + scfg_.cut_v_c_; h_q_cut_v_bef->Fill(cq_v); - const bool cv_v = (std::fabs(cq_v) < cfg.n_si() * scfg.cut_v_si_); + const bool cv_v = (std::fabs(cq_v) < cfg.n_si() * scfg_.cut_v_si_); bool cutsPassed = true; - if (scfg.cut_h_apply_) + if (scfg_.cut_h_apply_) cutsPassed &= cv_h; - if (scfg.cut_v_apply_) + if (scfg_.cut_v_apply_) cutsPassed &= cv_v; if (cutsPassed) { @@ -287,21 +333,21 @@ unsigned int PPSAlignmentWorker::SectorData::process(const CTPPSLocalTrackLiteCo h2_cut_h_aft->Fill(trUp.x(), trDw.x()); h2_cut_v_aft->Fill(trUp.y(), trDw.y()); - m_h2_y_vs_x_aft_sel[scfg.rp_N_.id_]->Fill(trUp.x(), trUp.y()); - m_h2_y_vs_x_aft_sel[scfg.rp_F_.id_]->Fill(trDw.x(), trDw.y()); + m_h2_y_vs_x_aft_sel[scfg_.rp_N_.id_]->Fill(trUp.x(), trUp.y()); + m_h2_y_vs_x_aft_sel[scfg_.rp_F_.id_]->Fill(trDw.x(), trDw.y()); p_x_diffFN_vs_x_N->Fill(trUp.x(), trDw.x() - trUp.x()); - int idx = (trUp.x() - scfg.rp_N_.x_slice_min_) / scfg.rp_N_.x_slice_w_; - if (idx >= 0 && idx < scfg.rp_N_.x_slice_n_) { + int idx = (trUp.x() - scfg_.rp_N_.x_slice_min_) / scfg_.rp_N_.x_slice_w_; + if (idx >= 0 && idx < scfg_.rp_N_.x_slice_n_) { x_slice_plots_N[idx].h_y->Fill(trUp.y()); x_slice_plots_N[idx].p_y_diffFN_vs_y->Fill(trUp.y(), trDw.y() - trUp.y()); if (debug) x_slice_plots_N[idx].h2_y_diffFN_vs_y->Fill(trUp.y(), trDw.y() - trUp.y()); } - idx = (trDw.x() - scfg.rp_F_.x_slice_min_) / scfg.rp_F_.x_slice_w_; - if (idx >= 0 && idx < scfg.rp_F_.x_slice_n_) { + idx = (trDw.x() - scfg_.rp_F_.x_slice_min_) / scfg_.rp_F_.x_slice_w_; + if (idx >= 0 && idx < scfg_.rp_F_.x_slice_n_) { x_slice_plots_F[idx].h_y->Fill(trDw.y()); x_slice_plots_F[idx].p_y_diffFN_vs_y->Fill(trDw.y(), trDw.y() - trUp.y()); if (debug) @@ -314,31 +360,4 @@ unsigned int PPSAlignmentWorker::SectorData::process(const CTPPSLocalTrackLiteCo return pairsSelected; } -// -------------------------------- PPSAlignmentWorker methods -------------------------------- - -PPSAlignmentWorker::PPSAlignmentWorker(const edm::ParameterSet &iConfig) - : esTokenBookHistograms_(esConsumes( - edm::ESInputTag("", iConfig.getParameter("label")))), - esTokenAnalyze_(esConsumes( - edm::ESInputTag("", iConfig.getParameter("label")))), - tracksToken_(consumes(iConfig.getParameter("tagTracks"))), - folder_(iConfig.getParameter("folder")), - debug_(iConfig.getParameter("debug")) {} - -void PPSAlignmentWorker::bookHistograms(DQMStore::IBooker &iBooker, edm::Run const &, edm::EventSetup const &iSetup) { - const auto &cfg = iSetup.getData(esTokenBookHistograms_); - - sectorData45.init(iBooker, cfg, cfg.sectorConfig45(), folder_ + "/worker", debug_); - sectorData56.init(iBooker, cfg, cfg.sectorConfig56(), folder_ + "/worker", debug_); -} - -void PPSAlignmentWorker::analyze(const edm::Event &iEvent, const edm::EventSetup &iSetup) { - const auto &tracks = iEvent.get(tracksToken_); - - const auto &cfg = iSetup.getData(esTokenAnalyze_); - - sectorData45.process(tracks, cfg, debug_); - sectorData56.process(tracks, cfg, debug_); -} - -DEFINE_FWK_MODULE(PPSAlignmentWorker); \ No newline at end of file +DEFINE_FWK_MODULE(PPSAlignmentWorker); diff --git a/CalibPPS/AlignmentGlobal/python/ALCARECOPPSAlignment_Output_cff.py b/CalibPPS/AlignmentGlobal/python/ALCARECOPPSAlignment_Output_cff.py new file mode 100644 index 0000000000000..8ff556699bdaf --- /dev/null +++ b/CalibPPS/AlignmentGlobal/python/ALCARECOPPSAlignment_Output_cff.py @@ -0,0 +1,13 @@ +import FWCore.ParameterSet.Config as cms + +OutALCARECOPPSAlignment_noDrop = cms.PSet( + SelectEvents = cms.untracked.PSet( + SelectEvents = cms.vstring('pathALCARECOPPSAlignment') + ), + outputCommands = cms.untracked.vstring( + 'keep *_MEtoEDMConvertPPSAlignment_*_*', + ) +) + +OutALCARECOPPSAlignment = OutALCARECOPPSAlignment_noDrop.clone() +OutALCARECOPPSAlignment.outputCommands.insert(0, 'drop *') diff --git a/CalibPPS/AlignmentGlobal/python/ALCARECOPPSAlignment_cff.py b/CalibPPS/AlignmentGlobal/python/ALCARECOPPSAlignment_cff.py new file mode 100644 index 0000000000000..3b01706270500 --- /dev/null +++ b/CalibPPS/AlignmentGlobal/python/ALCARECOPPSAlignment_cff.py @@ -0,0 +1,16 @@ +import FWCore.ParameterSet.Config as cms + +from CalibPPS.AlignmentGlobal.ppsAlignmentWorker_cfi import ppsAlignmentWorker + +MEtoEDMConvertPPSAlignment = cms.EDProducer('MEtoEDMConverter', + Name=cms.untracked.string('MEtoEDMConverter'), + Verbosity=cms.untracked.int32(0), + Frequency=cms.untracked.int32(50), + MEPathToSave=cms.untracked.string('AlCaReco/PPSAlignment'), + deleteAfterCopy=cms.untracked.bool(True) +) + +taskALCARECOPPSAlignment = cms.Task( + ppsAlignmentWorker, + MEtoEDMConvertPPSAlignment +) diff --git a/CalibPPS/AlignmentGlobal/python/PPSAlignmentHarvester_cff.py b/CalibPPS/AlignmentGlobal/python/PPSAlignmentHarvester_cff.py new file mode 100644 index 0000000000000..8a18d949c8b1d --- /dev/null +++ b/CalibPPS/AlignmentGlobal/python/PPSAlignmentHarvester_cff.py @@ -0,0 +1,6 @@ +from CalibPPS.AlignmentGlobal.ppsAlignmentHarvester_cfi import * + +ppsAlignmentHarvester.text_results_path = cms.string("") +ppsAlignmentHarvester.write_sqlite_results = cms.bool(True) +ppsAlignmentHarvester.x_ali_rel_final_slope_fixed = cms.bool(False) +ppsAlignmentHarvester.y_ali_final_slope_fixed = cms.bool(False) diff --git a/CalibPPS/AlignmentGlobal/python/ppsAlignmentHarvester_cfi.py b/CalibPPS/AlignmentGlobal/python/ppsAlignmentHarvester_cfi.py deleted file mode 100644 index 35214114e8d3d..0000000000000 --- a/CalibPPS/AlignmentGlobal/python/ppsAlignmentHarvester_cfi.py +++ /dev/null @@ -1,7 +0,0 @@ -import FWCore.ParameterSet.Config as cms -from DQMServices.Core.DQMEDHarvester import DQMEDHarvester - -ppsAlignmentHarvester = DQMEDHarvester("PPSAlignmentHarvester", - folder = cms.string("CalibPPS/Common"), - debug = cms.bool(True) -) \ No newline at end of file diff --git a/CalibPPS/AlignmentGlobal/python/ppsAlignmentWorker_cfi.py b/CalibPPS/AlignmentGlobal/python/ppsAlignmentWorker_cfi.py deleted file mode 100644 index 163a7f943f498..0000000000000 --- a/CalibPPS/AlignmentGlobal/python/ppsAlignmentWorker_cfi.py +++ /dev/null @@ -1,9 +0,0 @@ -import FWCore.ParameterSet.Config as cms -from DQMServices.Core.DQMEDAnalyzer import DQMEDAnalyzer - -ppsAlignmentWorker = DQMEDAnalyzer("PPSAlignmentWorker", - tagTracks = cms.InputTag("ctppsLocalTrackLiteProducer"), - folder = cms.string("CalibPPS/Common"), - label = cms.string(""), - debug = cms.bool(False) -) \ No newline at end of file diff --git a/CalibPPS/AlignmentGlobal/test/README.md b/CalibPPS/AlignmentGlobal/test/README.md index abbfe07f85ada..85392e1bc019a 100644 --- a/CalibPPS/AlignmentGlobal/test/README.md +++ b/CalibPPS/AlignmentGlobal/test/README.md @@ -13,38 +13,47 @@ ## Running instructions ``` -cmsRun run_distributions_reference_cfg.py -cmsRun run_distributions_cfg.py -cmsRun run_analysis_manual_cfg.py +cmsRun run_distributions_reference_cfg.py && cmsRun run_distributions_cfg.py && cmsRun run_analysis_cfg.py ``` -## Expected results -### x_alignment - - RP 3: x = -3690.0 +- 17.9 um - - RP 23: x = -41690.0 +- 17.2 um - - RP 103: x = -2700.0 +- 16.9 um - - RP 123: x = -41830.0 +- 16.0 um - -### x_alignment_relative: - - RP 3: x = 18985.6 +- 1.0 um - - RP 23: x = -18985.6 +- 1.0 um - - RP 103: x = 19484.1 +- 1.2 um - - RP 123: x = -19484.1 +- 1.2 um - -### x_alignment_relative_sl_fix: - - RP 3: x = 18983.7 +- 0.2 um - - RP 23: x = -18983.7 +- 0.2 um - - RP 103: x = 19486.6 +- 0.3 um - - RP 123: x = -19486.6 +- 0.3 um - -### y_alignment: - - RP 3: y = 3468.8 +- 44.1 um - - RP 23: y = 4097.6 +- 44.8 um - - RP 103: y = 3025.5 +- 77.8 um - - RP 123: y = 3344.0 +- 66.1 um - -### y_alignment_sl_fix: - - RP 3: y = 3491.7 +- 10.7 um - - RP 23: y = 4167.4 +- 11.6 um - - RP 103: y = 2753.5 +- 18.2 um - - RP 123: y = 3390.2 +- 17.3 um \ No newline at end of file +## Expected results (alignment_results.txt) +``` +1: x_alignment: +RP 3: shift (um) x = -3670.0 +- 19.8, y = 0.0 +- 0.0, z = 0.0 +- 0.0, rotation (mrad) x = 0.0 +- 0.0, y = 0.0 +- 0.0, z = 0.0 +- 0.0 +RP 23: shift (um) x = -41710.0 +- 20.6, y = 0.0 +- 0.0, z = 0.0 +- 0.0, rotation (mrad) x = 0.0 +- 0.0, y = 0.0 +- 0.0, z = 0.0 +- 0.0 +RP 103: shift (um) x = -2700.0 +- 18.8, y = 0.0 +- 0.0, z = 0.0 +- 0.0, rotation (mrad) x = 0.0 +- 0.0, y = 0.0 +- 0.0, z = 0.0 +- 0.0 +RP 123: shift (um) x = -41840.0 +- 19.5, y = 0.0 +- 0.0, z = 0.0 +- 0.0, rotation (mrad) x = 0.0 +- 0.0, y = 0.0 +- 0.0, z = 0.0 +- 0.0 + + +2: x_alignment_relative: +RP 3: shift (um) x = 18984.6 +- 1.2, y = 0.0 +- 0.0, z = 0.0 +- 0.0, rotation (mrad) x = 0.0 +- 0.0, y = 0.0 +- 0.0, z = 0.0 +- 0.0 +RP 23: shift (um) x = -18984.6 +- 1.2, y = 0.0 +- 0.0, z = 0.0 +- 0.0, rotation (mrad) x = 0.0 +- 0.0, y = 0.0 +- 0.0, z = 0.0 +- 0.0 +RP 103: shift (um) x = 19485.3 +- 1.5, y = 0.0 +- 0.0, z = 0.0 +- 0.0, rotation (mrad) x = 0.0 +- 0.0, y = 0.0 +- 0.0, z = 0.0 +- 0.0 +RP 123: shift (um) x = -19485.3 +- 1.5, y = 0.0 +- 0.0, z = 0.0 +- 0.0, rotation (mrad) x = 0.0 +- 0.0, y = 0.0 +- 0.0, z = 0.0 +- 0.0 + +2: x_alignment_relative_sl_fix: +RP 3: shift (um) x = 18983.8 +- 0.3, y = 0.0 +- 0.0, z = 0.0 +- 0.0, rotation (mrad) x = 0.0 +- 0.0, y = 0.0 +- 0.0, z = 0.0 +- 0.0 +RP 23: shift (um) x = -18983.8 +- 0.3, y = 0.0 +- 0.0, z = 0.0 +- 0.0, rotation (mrad) x = 0.0 +- 0.0, y = 0.0 +- 0.0, z = 0.0 +- 0.0 +RP 103: shift (um) x = 19486.8 +- 0.3, y = 0.0 +- 0.0, z = 0.0 +- 0.0, rotation (mrad) x = 0.0 +- 0.0, y = 0.0 +- 0.0, z = 0.0 +- 0.0 +RP 123: shift (um) x = -19486.8 +- 0.3, y = 0.0 +- 0.0, z = 0.0 +- 0.0, rotation (mrad) x = 0.0 +- 0.0, y = 0.0 +- 0.0, z = 0.0 +- 0.0 + + +3: y_alignment: +RP 3: shift (um) x = 0.0 +- 0.0, y = 3443.3 +- 101.7, z = 0.0 +- 0.0, rotation (mrad) x = 0.0 +- 0.0, y = 0.0 +- 0.0, z = 0.0 +- 0.0 +RP 23: shift (um) x = 0.0 +- 0.0, y = 4190.3 +- 87.0, z = 0.0 +- 0.0, rotation (mrad) x = 0.0 +- 0.0, y = 0.0 +- 0.0, z = 0.0 +- 0.0 +RP 103: shift (um) x = 0.0 +- 0.0, y = 2885.9 +- 66.2, z = 0.0 +- 0.0, rotation (mrad) x = 0.0 +- 0.0, y = 0.0 +- 0.0, z = 0.0 +- 0.0 +RP 123: shift (um) x = 0.0 +- 0.0, y = 3491.8 +- 129.5, z = 0.0 +- 0.0, rotation (mrad) x = 0.0 +- 0.0, y = 0.0 +- 0.0, z = 0.0 +- 0.0 + +3: y_alignment_sl_fix: +RP 3: shift (um) x = 0.0 +- 0.0, y = 3490.3 +- 16.0, z = 0.0 +- 0.0, rotation (mrad) x = 0.0 +- 0.0, y = 0.0 +- 0.0, z = 0.0 +- 0.0 +RP 23: shift (um) x = 0.0 +- 0.0, y = 4209.1 +- 15.8, z = 0.0 +- 0.0, rotation (mrad) x = 0.0 +- 0.0, y = 0.0 +- 0.0, z = 0.0 +- 0.0 +RP 103: shift (um) x = 0.0 +- 0.0, y = 2751.2 +- 16.1, z = 0.0 +- 0.0, rotation (mrad) x = 0.0 +- 0.0, y = 0.0 +- 0.0, z = 0.0 +- 0.0 +RP 123: shift (um) x = 0.0 +- 0.0, y = 3417.9 +- 23.9, z = 0.0 +- 0.0, rotation (mrad) x = 0.0 +- 0.0, y = 0.0 +- 0.0, z = 0.0 +- 0.0 + + +final merged results: +RP 3: shift (um) x = -3706.2 +- 19.8, y = 3490.3 +- 16.0, z = 0.0 +- 0.0, rotation (mrad) x = 0.0 +- 0.0, y = 0.0 +- 0.0, z = 0.0 +- 0.0 +RP 23: shift (um) x = -41673.8 +- 20.6, y = 4209.1 +- 15.8, z = 0.0 +- 0.0, rotation (mrad) x = 0.0 +- 0.0, y = 0.0 +- 0.0, z = 0.0 +- 0.0 +RP 103: shift (um) x = -2783.2 +- 18.8, y = 2751.2 +- 16.1, z = 0.0 +- 0.0, rotation (mrad) x = 0.0 +- 0.0, y = 0.0 +- 0.0, z = 0.0 +- 0.0 +RP 123: shift (um) x = -41756.8 +- 19.5, y = 3417.9 +- 23.9, z = 0.0 +- 0.0, rotation (mrad) x = 0.0 +- 0.0, y = 0.0 +- 0.0, z = 0.0 +- 0.0 +``` diff --git a/CalibPPS/AlignmentGlobal/test/config_cff.py b/CalibPPS/AlignmentGlobal/test/config_cff.py index 4c8130f8f16ad..50e7763fdf1f4 100644 --- a/CalibPPS/AlignmentGlobal/test/config_cff.py +++ b/CalibPPS/AlignmentGlobal/test/config_cff.py @@ -1,12 +1,6 @@ import FWCore.ParameterSet.Config as cms -ppsAlignmentConfigESSource = cms.ESSource("PPSAlignmentConfigESSource", - sequence = cms.vstring( - "x_alignment", - "x_alignment_relative", - "y_alignment" - ), - +ppsAlignmentConfigESSource = cms.ESSource("PPSAlignmentConfigurationESSource", sector_45 = cms.PSet( rp_N = cms.PSet( x_max_fit_mode = cms.double(7.0), @@ -39,5 +33,17 @@ cut_h_c = cms.double(-39.26 + 0.33), cut_v_c = cms.double(1.49 - 1.80) + ), + + y_alignment = cms.PSet( + rp_L_F = cms.PSet( + x_min = cms.double(45.5) + ), + rp_L_N = cms.PSet( + x_min = cms.double(7.8) + ), + rp_R_F = cms.PSet( + x_min = cms.double(45.5) + ) ) -) \ No newline at end of file +) diff --git a/CalibPPS/AlignmentGlobal/test/config_reference_cff.py b/CalibPPS/AlignmentGlobal/test/config_reference_cff.py index f925b48787127..f2ee40ad3a18b 100644 --- a/CalibPPS/AlignmentGlobal/test/config_reference_cff.py +++ b/CalibPPS/AlignmentGlobal/test/config_reference_cff.py @@ -1,6 +1,6 @@ import FWCore.ParameterSet.Config as cms -ppsAlignmentConfigESSource = cms.ESSource("PPSAlignmentConfigESSource", +ppsAlignmentConfigESSource = cms.ESSource("PPSAlignmentConfigurationESSource", label = cms.string('reference'), sector_45 = cms.PSet( diff --git a/CalibPPS/AlignmentGlobal/test/run_analysis_cfg.py b/CalibPPS/AlignmentGlobal/test/run_analysis_cfg.py new file mode 100644 index 0000000000000..fceb4d3fab1c1 --- /dev/null +++ b/CalibPPS/AlignmentGlobal/test/run_analysis_cfg.py @@ -0,0 +1,111 @@ +########## Configuration ########## +# if set to True, a file with logs will be produced. +produce_logs = True + +# if set to True, the harvester will produce an extra ROOT file with some debug plots. +# Works only for one-run input. +harvester_debug = True + +# Path for a ROOT file with the histograms. +input_distributions = 'file:dqm_run_distributions_test.root' + +# Reference dataset path. +reference_dataset_path = 'DQM_V0001_CalibPPS_R000314273.root' + +# If set to True, the results will be also written to an SQLite file. +write_sqlite_results = False + +# Output database. Used only if write_sqlite_results is set to True. +output_conditions = 'sqlite_file:alignment_results.db' + +# Database tag. Used only if write_sqlite_results is set to True. +output_db_tag = 'CTPPSRPAlignmentCorrectionsData_test' +################################### + +import sys +import os +import FWCore.ParameterSet.Config as cms + +process = cms.Process('testDistributions') + +process.load('FWCore.MessageService.MessageLogger_cfi') +process.load("DQMServices.Core.DQMStore_cfi") +process.load("CalibPPS.AlignmentGlobal.ppsAlignmentHarvester_cfi") + +if harvester_debug: + process.ppsAlignmentHarvester.debug = cms.bool(True) + +# Message Logger +if produce_logs: + process.MessageLogger = cms.Service("MessageLogger", + destinations = cms.untracked.vstring('run_analysis', + 'cout' + ), + run_analysis = cms.untracked.PSet( + threshold = cms.untracked.string("INFO") + ), + cout = cms.untracked.PSet( + threshold = cms.untracked.string('WARNING') + ) + ) +else: + process.MessageLogger = cms.Service("MessageLogger", + destinations = cms.untracked.vstring('cout'), + cout = cms.untracked.PSet( + threshold = cms.untracked.string('WARNING') + ) + ) + +# load DQM framework +process.load("DQMServices.Components.DQMEnvironment_cfi") +process.dqmEnv.subSystemFolder = "CalibPPS" +process.dqmSaver.convention = 'Offline' +process.dqmSaver.workflow = "/CalibPPS/AlignmentGlobal/CMSSW_12_1_0_pre1" +process.dqmSaver.saveByRun = -1 +process.dqmSaver.saveAtJobEnd = True +process.dqmSaver.forceRunNumber = 999999 + +# Source (histograms) +process.source = cms.Source("DQMRootSource", + fileNames = cms.untracked.vstring(input_distributions), +) + +# Event Setup (test) +from config_cff import ppsAlignmentConfigESSource as ppsAlignmentConfigESSourceTest +process.ppsAlignmentConfigESSourceTest = ppsAlignmentConfigESSourceTest + +# Event Setup (reference) +from config_reference_cff import ppsAlignmentConfigESSource as ppsAlignmentConfigESSourceReference +ppsAlignmentConfigESSourceReference.matching = cms.PSet( + reference_dataset = cms.string(reference_dataset_path) +) +process.ppsAlignmentConfigESSourceReference = ppsAlignmentConfigESSourceReference + +# SQLite results +if write_sqlite_results: + process.load("CondCore.CondDB.CondDB_cfi") + process.CondDB.connect = output_conditions + process.PoolDBOutputService = cms.Service("PoolDBOutputService", + process.CondDB, + timetype = cms.untracked.string('runnumber'), + toPut = cms.VPSet(cms.PSet( + record = cms.string('CTPPSRPAlignmentCorrectionsDataRcd'), + tag = cms.string(output_db_tag) + )) + ) + + # DB object maker parameters + process.ppsAlignmentHarvester.write_sqlite_results = cms.bool(True) + +process.path = cms.Path( + process.ppsAlignmentHarvester +) + +process.end_path = cms.EndPath( + process.dqmSaver +) + +process.schedule = cms.Schedule( + process.path, + process.end_path +) diff --git a/CalibPPS/AlignmentGlobal/test/run_analysis_manual_cfg.py b/CalibPPS/AlignmentGlobal/test/run_analysis_manual_cfg.py deleted file mode 100644 index a2537d6d3ea04..0000000000000 --- a/CalibPPS/AlignmentGlobal/test/run_analysis_manual_cfg.py +++ /dev/null @@ -1,58 +0,0 @@ -import sys -import os -import FWCore.ParameterSet.Config as cms - -from config_cff import ppsAlignmentConfigESSource as ppsAlignmentConfigESSourceTest -from config_reference_cff import ppsAlignmentConfigESSource as ppsAlignmentConfigESSourceReference -ppsAlignmentConfigESSourceReference.matching = cms.PSet( - reference_dataset = cms.string("DQM_V0001_CalibPPS_R000314273.root") -) - -process = cms.Process('testDistributions') - -process.load('FWCore.MessageService.MessageLogger_cfi') -process.load("DQMServices.Core.DQMStore_cfi") -process.load("CalibPPS.AlignmentGlobal.ppsAlignmentHarvester_cfi") - -process.MessageLogger = cms.Service("MessageLogger", - destinations = cms.untracked.vstring(# 'run_analysis_manual', - 'cout' - ), - # run_analysis_manual = cms.untracked.PSet( - # threshold = cms.untracked.string("INFO") - # ), - cout = cms.untracked.PSet( - threshold = cms.untracked.string('WARNING') - ) -) - -# load DQM framework -process.load("DQMServices.Components.DQMEnvironment_cfi") -process.dqmEnv.subSystemFolder = "CalibPPS" -process.dqmSaver.convention = 'Offline' -process.dqmSaver.workflow = "/CalibPPS/AlignmentGlobal/CMSSW_11_2_0_pre6" -process.dqmSaver.saveByRun = -1 -process.dqmSaver.saveAtJobEnd = True -process.dqmSaver.forceRunNumber = 999999 - -process.source = cms.Source("DQMRootSource", - fileNames = cms.untracked.vstring( - "file:dqm_run_distributions_test.root" - ), -) - -process.ppsAlignmentConfigESSourceReference = ppsAlignmentConfigESSourceReference -process.ppsAlignmentConfigESSourceTest = ppsAlignmentConfigESSourceTest - -process.path = cms.Path( - process.ppsAlignmentHarvester -) - -process.end_path = cms.EndPath( - process.dqmSaver -) - -process.schedule = cms.Schedule( - process.path, - process.end_path -) \ No newline at end of file diff --git a/CalibPPS/AlignmentGlobal/test/run_distributions_cfg.py b/CalibPPS/AlignmentGlobal/test/run_distributions_cfg.py index 3a029259a1fbe..3b841ed477084 100644 --- a/CalibPPS/AlignmentGlobal/test/run_distributions_cfg.py +++ b/CalibPPS/AlignmentGlobal/test/run_distributions_cfg.py @@ -1,7 +1,14 @@ +########## Configuration ########## +# if set to True, a file with logs will be produced. +produce_logs = False + +# Path for a ROOT file with the histograms +output_distributions = 'dqm_run_distributions_test.root' +################################### + import FWCore.ParameterSet.Config as cms from input_files_cff import input_files -from config_cff import ppsAlignmentConfigESSource process = cms.Process('testDistributions') @@ -10,39 +17,50 @@ process.load("DQMServices.Core.DQMStore_cfi") # Message Logger -process.MessageLogger = cms.Service("MessageLogger", - destinations = cms.untracked.vstring(# 'run_distributions', - 'cout' - ), - # run_distributions = cms.untracked.PSet( - # threshold = cms.untracked.string("INFO") - # ), - cout = cms.untracked.PSet( - threshold = cms.untracked.string('WARNING') - ) -) +if produce_logs: + process.MessageLogger = cms.Service("MessageLogger", + destinations = cms.untracked.vstring('run_distributions', + 'cout' + ), + run_distributions = cms.untracked.PSet( + threshold = cms.untracked.string("INFO") + ), + cout = cms.untracked.PSet( + threshold = cms.untracked.string('WARNING') + ) + ) +else: + process.MessageLogger = cms.Service("MessageLogger", + destinations = cms.untracked.vstring('cout'), + cout = cms.untracked.PSet( + threshold = cms.untracked.string('WARNING') + ) + ) +# Source process.source = cms.Source("PoolSource", - fileNames = input_files + fileNames = input_files ) process.maxEvents = cms.untracked.PSet(input = cms.untracked.int32(-1)) # Event Setup +from config_cff import ppsAlignmentConfigESSource process.ppsAlignmentConfigESSource = ppsAlignmentConfigESSource +# Output for the histograms process.dqmOutput = cms.OutputModule("DQMRootOutputModule", - fileName = cms.untracked.string("dqm_run_distributions_test.root") + fileName = cms.untracked.string(output_distributions) ) process.path = cms.Path( - process.ppsAlignmentWorker + process.ppsAlignmentWorker ) process.end_path = cms.EndPath( - process.dqmOutput + process.dqmOutput ) process.schedule = cms.Schedule( - process.path, - process.end_path -) \ No newline at end of file + process.path, + process.end_path +) diff --git a/CalibPPS/AlignmentGlobal/test/run_distributions_reference_cfg.py b/CalibPPS/AlignmentGlobal/test/run_distributions_reference_cfg.py index 7d15ba881b38d..d691ada99a77d 100644 --- a/CalibPPS/AlignmentGlobal/test/run_distributions_reference_cfg.py +++ b/CalibPPS/AlignmentGlobal/test/run_distributions_reference_cfg.py @@ -1,7 +1,14 @@ +########## Configuration ########## +# if set to True, a file with logs will be produced. +produce_logs = False + +# Source max processed events +max_events = 1000000 +################################### + import FWCore.ParameterSet.Config as cms from input_files_reference_cff import input_files -from config_reference_cff import ppsAlignmentConfigESSource process = cms.Process('referenceDistributions') @@ -10,33 +17,43 @@ process.load("DQMServices.Core.DQMStore_cfi") # Message Logger -process.MessageLogger = cms.Service("MessageLogger", - destinations = cms.untracked.vstring(# 'run_distributions', - 'cout' - ), - # run_distributions = cms.untracked.PSet( - # threshold = cms.untracked.string("INFO") - # ), - cout = cms.untracked.PSet( - threshold = cms.untracked.string('WARNING') - ) -) - -# load DQM framework -process.load("DQM.Integration.config.environment_cfi") -process.dqmEnv.subSystemFolder = "CalibPPS" -process.dqmSaver.path = "" -process.dqmSaver.tag = "CalibPPS" +if produce_logs: + process.MessageLogger = cms.Service("MessageLogger", + destinations = cms.untracked.vstring('run_distributions', + 'cout' + ), + run_distributions = cms.untracked.PSet( + threshold = cms.untracked.string("INFO") + ), + cout = cms.untracked.PSet( + threshold = cms.untracked.string('WARNING') + ) + ) +else: + process.MessageLogger = cms.Service("MessageLogger", + destinations = cms.untracked.vstring('cout'), + cout = cms.untracked.PSet( + threshold = cms.untracked.string('WARNING') + ) + ) +# Source process.source = cms.Source("PoolSource", fileNames = input_files ) -process.maxEvents = cms.untracked.PSet(input = cms.untracked.int32(2000000)) +process.maxEvents = cms.untracked.PSet(input = cms.untracked.int32(max_events)) # Event Setup +from config_reference_cff import ppsAlignmentConfigESSource process.ppsAlignmentConfigESSource = ppsAlignmentConfigESSource -# Worker config label +# load DQM framework +process.load("DQM.Integration.config.environment_cfi") +process.dqmEnv.subSystemFolder = "CalibPPS" +process.dqmSaver.path = "" +process.dqmSaver.tag = "CalibPPS" + +# Worker config label (for ES product label) process.ppsAlignmentWorker.label = cms.string("reference") process.path = cms.Path( @@ -50,4 +67,4 @@ process.schedule = cms.Schedule( process.path, process.end_path -) \ No newline at end of file +) diff --git a/CalibPPS/AlignmentRelative/src/AlignmentTask.cc b/CalibPPS/AlignmentRelative/src/AlignmentTask.cc index 85dbe488d302e..963105120b4b4 100644 --- a/CalibPPS/AlignmentRelative/src/AlignmentTask.cc +++ b/CalibPPS/AlignmentRelative/src/AlignmentTask.cc @@ -530,9 +530,9 @@ void AlignmentTask::buildEqualMeanUMeanVRotZConstraints(vector +#include +#include +#include +#include + +#include "TF1.h" +#include "TProfile.h" +#include "TFile.h" +#include "TKey.h" +#include "TSystemFile.h" + +//--------------------------------------------------------------------------------------------- + +class PPSAlignmentConfigurationESSource : public edm::ESProducer, public edm::EventSetupRecordIntervalFinder { +public: + PPSAlignmentConfigurationESSource(const edm::ParameterSet& iConfig); + + std::unique_ptr produce(const PPSAlignmentConfigurationRcd&); + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + +private: + int fitProfile(TProfile* p, double x_mean, double x_rms, double& sl, double& sl_unc); + TDirectory* findDirectoryWithName(TDirectory* dir, std::string searchName); + std::vector buildVectorFromDirectory( + TDirectory* dir, const PPSAlignmentConfiguration::RPConfig& rpd); + + void setIntervalFor(const edm::eventsetup::EventSetupRecordKey& key, + const edm::IOVSyncValue& iosv, + edm::ValidityInterval& oValidity) override; + + bool debug; + + PPSAlignmentConfiguration::SectorConfig sectorConfig45, sectorConfig56; + + double x_ali_sh_step; + + double y_mode_sys_unc; + double chiSqThreshold; + double y_mode_unc_max_valid; + double y_mode_max_valid; + + unsigned int minRPTracksSize; + unsigned int maxRPTracksSize; + double n_si; + + std::map> matchingReferencePoints; + std::map matchingShiftRanges; + + std::map alignment_x_meth_o_ranges; + unsigned int fitProfileMinBinEntries; + unsigned int fitProfileMinNReasonable; + unsigned int methOGraphMinN; + double methOUncFitRange; + + std::map alignment_x_relative_ranges; + unsigned int nearFarMinEntries; + + std::map alignment_y_ranges; + unsigned int modeGraphMinN; + unsigned int multSelProjYMinEntries; + + PPSAlignmentConfiguration::Binning binning; + + std::vector extraParams; + + std::string label; +}; + +//--------------------------------------------------------------------------------------------- + +PPSAlignmentConfigurationESSource::PPSAlignmentConfigurationESSource(const edm::ParameterSet& iConfig) { + label = iConfig.getParameter("label"); + + debug = iConfig.getParameter("debug"); + TFile* debugFile = nullptr; + if (debug) { + debugFile = new TFile(("debug_producer_" + (label.empty() ? "test" : label) + ".root").c_str(), "recreate"); + } + + sectorConfig45.name_ = "sector 45"; + + sectorConfig45.rp_N_.position_ = "N"; + sectorConfig45.rp_F_.position_ = "F"; + + sectorConfig56.name_ = "sector 56"; + + sectorConfig56.rp_N_.position_ = "N"; + sectorConfig56.rp_F_.position_ = "F"; + + for (std::string sectorName : {"sector_45", "sector_56"}) { + const auto& sps = iConfig.getParameter(sectorName); + PPSAlignmentConfiguration::SectorConfig* sc; + if (sectorName == "sector_45") + sc = §orConfig45; + else + sc = §orConfig56; + + for (std::string rpName : {"rp_N", "rp_F"}) { + const auto& rpps = sps.getParameter(rpName); + PPSAlignmentConfiguration::RPConfig* rc; + if (rpName == "rp_N") + rc = &sc->rp_N_; + else + rc = &sc->rp_F_; + + rc->name_ = rpps.getParameter("name"); + rc->id_ = rpps.getParameter("id"); + + rc->slope_ = rpps.getParameter("slope"); + rc->sh_x_ = rpps.getParameter("sh_x"); + + rc->x_min_fit_mode_ = rpps.getParameter("x_min_fit_mode"); + rc->x_max_fit_mode_ = rpps.getParameter("x_max_fit_mode"); + rc->y_max_fit_mode_ = rpps.getParameter("y_max_fit_mode"); + rc->y_cen_add_ = rpps.getParameter("y_cen_add"); + rc->y_width_mult_ = rpps.getParameter("y_width_mult"); + + rc->x_slice_min_ = rpps.getParameter("x_slice_min"); + rc->x_slice_w_ = rpps.getParameter("x_slice_w"); + rc->x_slice_n_ = std::ceil((rpps.getParameter("x_slice_max") - rc->x_slice_min_) / rc->x_slice_w_); + } + + sc->slope_ = sps.getParameter("slope"); + + sc->cut_h_apply_ = sps.getParameter("cut_h_apply"); + sc->cut_h_a_ = sps.getParameter("cut_h_a"); + sc->cut_h_c_ = sps.getParameter("cut_h_c"); + sc->cut_h_si_ = sps.getParameter("cut_h_si"); + + sc->cut_v_apply_ = sps.getParameter("cut_v_apply"); + sc->cut_v_a_ = sps.getParameter("cut_v_a"); + sc->cut_v_c_ = sps.getParameter("cut_v_c"); + sc->cut_v_si_ = sps.getParameter("cut_v_si"); + } + + std::map rpTags = {{sectorConfig45.rp_F_.id_, "rp_L_F"}, + {sectorConfig45.rp_N_.id_, "rp_L_N"}, + {sectorConfig56.rp_N_.id_, "rp_R_N"}, + {sectorConfig56.rp_F_.id_, "rp_R_F"}}; + + std::map sectorNames = {{sectorConfig45.rp_F_.id_, sectorConfig45.name_}, + {sectorConfig45.rp_N_.id_, sectorConfig45.name_}, + {sectorConfig56.rp_N_.id_, sectorConfig56.name_}, + {sectorConfig56.rp_F_.id_, sectorConfig56.name_}}; + + std::map rpConfigs = { + {sectorConfig45.rp_F_.id_, §orConfig45.rp_F_}, + {sectorConfig45.rp_N_.id_, §orConfig45.rp_N_}, + {sectorConfig56.rp_N_.id_, §orConfig56.rp_N_}, + {sectorConfig56.rp_F_.id_, §orConfig56.rp_F_}}; + + x_ali_sh_step = iConfig.getParameter("x_ali_sh_step"); + + y_mode_sys_unc = iConfig.getParameter("y_mode_sys_unc"); + chiSqThreshold = iConfig.getParameter("chiSqThreshold"); + y_mode_unc_max_valid = iConfig.getParameter("y_mode_unc_max_valid"); + y_mode_max_valid = iConfig.getParameter("y_mode_max_valid"); + + minRPTracksSize = iConfig.getParameter("min_RP_tracks_size"); + maxRPTracksSize = iConfig.getParameter("max_RP_tracks_size"); + n_si = iConfig.getParameter("n_si"); + + const auto& c_axo = iConfig.getParameter("x_alignment_meth_o"); + for (const auto& p : rpTags) { + const auto& ps = c_axo.getParameter(p.second); + alignment_x_meth_o_ranges[p.first] = {ps.getParameter("x_min"), ps.getParameter("x_max")}; + } + fitProfileMinBinEntries = c_axo.getParameter("fit_profile_min_bin_entries"); + fitProfileMinNReasonable = c_axo.getParameter("fit_profile_min_N_reasonable"); + methOGraphMinN = c_axo.getParameter("meth_o_graph_min_N"); + methOUncFitRange = c_axo.getParameter("meth_o_unc_fit_range"); + + const auto& c_m = iConfig.getParameter("matching"); + const auto& referenceDataset = c_m.getParameter("reference_dataset"); + + // constructing vectors with reference data + if (!referenceDataset.empty()) { + TFile* f_ref = TFile::Open(referenceDataset.c_str()); + if (!f_ref->IsOpen()) { + edm::LogWarning("PPS") << "[ESSource] could not find reference dataset file: " << referenceDataset; + } else { + TDirectory* ad_ref = findDirectoryWithName((TDirectory*)f_ref, sectorConfig45.name_); + if (ad_ref == nullptr) { + edm::LogWarning("PPS") << "[ESSource] could not find reference dataset in " << referenceDataset; + } else { + edm::LogInfo("PPS") << "[ESSource] loading reference dataset from " << ad_ref->GetPath(); + + for (const auto& p : rpTags) { + if (debug) + gDirectory = debugFile->mkdir(rpConfigs[p.first]->name_.c_str())->mkdir("fits_ref"); + + auto* d_ref = (TDirectory*)ad_ref->Get( + (sectorNames[p.first] + "/near_far/x slices, " + rpConfigs[p.first]->position_).c_str()); + if (d_ref == nullptr) { + edm::LogWarning("PPS") << "[ESSource] could not load d_ref"; + } else { + matchingReferencePoints[p.first] = buildVectorFromDirectory(d_ref, *rpConfigs[p.first]); + } + } + } + } + delete f_ref; + } + + for (const auto& p : rpTags) { + const auto& ps = c_m.getParameter(p.second); + matchingShiftRanges[p.first] = {ps.getParameter("sh_min"), ps.getParameter("sh_max")}; + } + + const auto& c_axr = iConfig.getParameter("x_alignment_relative"); + for (const auto& p : rpTags) { + if (p.second.back() == 'N') { // only near RPs + const auto& ps = c_axr.getParameter(p.second); + alignment_x_relative_ranges[p.first] = {ps.getParameter("x_min"), ps.getParameter("x_max")}; + } + } + nearFarMinEntries = c_axr.getParameter("near_far_min_entries"); + + const auto& c_ay = iConfig.getParameter("y_alignment"); + for (const auto& p : rpTags) { + const auto& ps = c_ay.getParameter(p.second); + alignment_y_ranges[p.first] = {ps.getParameter("x_min"), ps.getParameter("x_max")}; + } + modeGraphMinN = c_ay.getParameter("mode_graph_min_N"); + multSelProjYMinEntries = c_ay.getParameter("mult_sel_proj_y_min_entries"); + + const auto& bps = iConfig.getParameter("binning"); + binning.bin_size_x_ = bps.getParameter("bin_size_x"); + binning.n_bins_x_ = bps.getParameter("n_bins_x"); + binning.pixel_x_offset_ = bps.getParameter("pixel_x_offset"); + binning.n_bins_y_ = bps.getParameter("n_bins_y"); + binning.y_min_ = bps.getParameter("y_min"); + binning.y_max_ = bps.getParameter("y_max"); + + binning.diffFN_n_bins_x_ = bps.getParameter("diffFN_n_bins_x"); + binning.diffFN_x_min_ = bps.getParameter("diffFN_x_min"); + binning.diffFN_x_max_ = bps.getParameter("diffFN_x_max"); + + binning.slice_n_bins_x_ = bps.getParameter("slice_n_bins_x"); + binning.slice_x_min_ = bps.getParameter("slice_x_min"); + binning.slice_x_max_ = bps.getParameter("slice_x_max"); + binning.slice_n_bins_y_ = bps.getParameter("slice_n_bins_y"); + binning.slice_y_min_ = bps.getParameter("slice_y_min"); + binning.slice_y_max_ = bps.getParameter("slice_y_max"); + + extraParams = iConfig.getParameter>("extra_params"); + + setWhatProduced(this, label); + findingRecord(); + + if (debug) + delete debugFile; +} + +//--------------------------------------------------------------------------------------------- + +std::unique_ptr PPSAlignmentConfigurationESSource::produce( + const PPSAlignmentConfigurationRcd&) { + auto p = std::make_unique(); + + p->setSectorConfig45(sectorConfig45); + p->setSectorConfig56(sectorConfig56); + + p->setX_ali_sh_step(x_ali_sh_step); + + p->setY_mode_sys_unc(y_mode_sys_unc); + p->setChiSqThreshold(chiSqThreshold); + p->setY_mode_unc_max_valid(y_mode_unc_max_valid); + p->setY_mode_max_valid(y_mode_max_valid); + + p->setMinRPTracksSize(minRPTracksSize); + p->setMaxRPTracksSize(maxRPTracksSize); + p->setN_si(n_si); + + p->setMatchingReferencePoints(matchingReferencePoints); + p->setMatchingShiftRanges(matchingShiftRanges); + + p->setAlignment_x_meth_o_ranges(alignment_x_meth_o_ranges); + p->setFitProfileMinBinEntries(fitProfileMinBinEntries); + p->setFitProfileMinNReasonable(fitProfileMinNReasonable); + p->setMethOGraphMinN(methOGraphMinN); + p->setMethOUncFitRange(methOUncFitRange); + + p->setAlignment_x_relative_ranges(alignment_x_relative_ranges); + p->setNearFarMinEntries(nearFarMinEntries); + + p->setAlignment_y_ranges(alignment_y_ranges); + p->setModeGraphMinN(modeGraphMinN); + p->setMultSelProjYMinEntries(multSelProjYMinEntries); + + p->setBinning(binning); + + p->setExtraParams(extraParams); + + edm::LogInfo("PPS") << "\n" + << "[ESSource] " << (label.empty() ? "empty label" : "label = " + label) << ":\n\n" + << (*p); + + return p; +} + +//--------------------------------------------------------------------------------------------- + +// most default values come from 2018 period +void PPSAlignmentConfigurationESSource::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + + desc.add("debug", false); + + desc.add("label", ""); + + // sector_45 + { + edm::ParameterSetDescription sector45; + + edm::ParameterSetDescription rp_N; + rp_N.add("name", "L_1_F"); + rp_N.add("id", 3); + + rp_N.add("slope", 0.19); + rp_N.add("sh_x", -3.6); + + rp_N.add("x_min_fit_mode", 2.); + rp_N.add("x_max_fit_mode", 7.0); + rp_N.add("y_max_fit_mode", 7.0); + rp_N.add("y_cen_add", -0.3); + rp_N.add("y_width_mult", 1.1); + + rp_N.add("x_slice_min", 7.); + rp_N.add("x_slice_max", 19.); + rp_N.add("x_slice_w", 0.2); + sector45.add("rp_N", rp_N); + + edm::ParameterSetDescription rp_F; + rp_F.add("name", "L_2_F"); + rp_F.add("id", 23); + + rp_F.add("slope", 0.19); + rp_F.add("sh_x", -42.); + + rp_F.add("x_min_fit_mode", 2.); + rp_F.add("x_max_fit_mode", 7.5); + rp_F.add("y_max_fit_mode", 7.5); + rp_F.add("y_cen_add", -0.3); + rp_F.add("y_width_mult", 1.1); + + rp_F.add("x_slice_min", 46.); + rp_F.add("x_slice_max", 58.); + rp_F.add("x_slice_w", 0.2); + sector45.add("rp_F", rp_F); + + sector45.add("slope", 0.006); + sector45.add("cut_h_apply", true); + sector45.add("cut_h_a", -1.); + sector45.add("cut_h_c", -38.55); + sector45.add("cut_h_si", 0.2); + sector45.add("cut_v_apply", true); + sector45.add("cut_v_a", -1.07); + sector45.add("cut_v_c", 1.63); + sector45.add("cut_v_si", 0.15); + + desc.add("sector_45", sector45); + } + + // sector_56 + { + edm::ParameterSetDescription sector56; + + edm::ParameterSetDescription rp_N; + rp_N.add("name", "R_1_F"); + rp_N.add("id", 103); + + rp_N.add("slope", 0.40); + rp_N.add("sh_x", -2.8); + + rp_N.add("x_min_fit_mode", 2.); + rp_N.add("x_max_fit_mode", 7.4); + rp_N.add("y_max_fit_mode", 7.4); + rp_N.add("y_cen_add", -0.8); + rp_N.add("y_width_mult", 1.0); + + rp_N.add("x_slice_min", 6.); + rp_N.add("x_slice_max", 17.); + rp_N.add("x_slice_w", 0.2); + sector56.add("rp_N", rp_N); + + edm::ParameterSetDescription rp_F; + rp_F.add("name", "R_2_F"); + rp_F.add("id", 123); + + rp_F.add("slope", 0.39); + rp_F.add("sh_x", -41.9); + + rp_F.add("x_min_fit_mode", 2.); + rp_F.add("x_max_fit_mode", 8.0); + rp_F.add("y_max_fit_mode", 8.0); + rp_F.add("y_cen_add", -0.8); + rp_F.add("y_width_mult", 1.0); + + rp_F.add("x_slice_min", 45.); + rp_F.add("x_slice_max", 57.); + rp_F.add("x_slice_w", 0.2); + sector56.add("rp_F", rp_F); + + sector56.add("slope", -0.015); + sector56.add("cut_h_apply", true); + sector56.add("cut_h_a", -1.); + sector56.add("cut_h_c", -39.26); + sector56.add("cut_h_si", 0.2); + sector56.add("cut_v_apply", true); + sector56.add("cut_v_a", -1.07); + sector56.add("cut_v_c", 1.49); + sector56.add("cut_v_si", 0.15); + + desc.add("sector_56", sector56); + } + + desc.add("x_ali_sh_step", 0.01); + + desc.add("y_mode_sys_unc", 0.03); + desc.add("chiSqThreshold", 50.); + desc.add("y_mode_unc_max_valid", 5.); + desc.add("y_mode_max_valid", 20.); + + desc.add("min_RP_tracks_size", 1); + desc.add("max_RP_tracks_size", 1); + desc.add("n_si", 4.); + + // matching + { + edm::ParameterSetDescription matching; + matching.add("reference_dataset", ""); + + edm::ParameterSetDescription rpLF; + rpLF.add("sh_min", -43.); + rpLF.add("sh_max", -41.); + matching.add("rp_L_F", rpLF); + + edm::ParameterSetDescription rpLN; + rpLN.add("sh_min", -4.2); + rpLN.add("sh_max", -2.4); + matching.add("rp_L_N", rpLN); + + edm::ParameterSetDescription rpRN; + rpRN.add("sh_min", -3.6); + rpRN.add("sh_max", -1.8); + matching.add("rp_R_N", rpRN); + + edm::ParameterSetDescription rpRF; + rpRF.add("sh_min", -43.2); + rpRF.add("sh_max", -41.2); + matching.add("rp_R_F", rpRF); + + desc.add("matching", matching); + } + + // x alignment meth o + { + edm::ParameterSetDescription x_alignment_meth_o; + + edm::ParameterSetDescription rpLF; + rpLF.add("x_min", 47.); + rpLF.add("x_max", 56.5); + x_alignment_meth_o.add("rp_L_F", rpLF); + + edm::ParameterSetDescription rpLN; + rpLN.add("x_min", 9.); + rpLN.add("x_max", 18.5); + x_alignment_meth_o.add("rp_L_N", rpLN); + + edm::ParameterSetDescription rpRN; + rpRN.add("x_min", 7.); + rpRN.add("x_max", 15.); + x_alignment_meth_o.add("rp_R_N", rpRN); + + edm::ParameterSetDescription rpRF; + rpRF.add("x_min", 46.); + rpRF.add("x_max", 54.); + x_alignment_meth_o.add("rp_R_F", rpRF); + + x_alignment_meth_o.add("fit_profile_min_bin_entries", 5); + x_alignment_meth_o.add("fit_profile_min_N_reasonable", 10); + x_alignment_meth_o.add("meth_o_graph_min_N", 5); + x_alignment_meth_o.add("meth_o_unc_fit_range", 0.5); + + desc.add("x_alignment_meth_o", x_alignment_meth_o); + } + + // x alignment relative + { + edm::ParameterSetDescription x_alignment_relative; + + edm::ParameterSetDescription rpLN; + rpLN.add("x_min", 7.5); + rpLN.add("x_max", 12.); + x_alignment_relative.add("rp_L_N", rpLN); + + edm::ParameterSetDescription rpRN; + rpRN.add("x_min", 6.); + rpRN.add("x_max", 10.); + x_alignment_relative.add("rp_R_N", rpRN); + + x_alignment_relative.add("near_far_min_entries", 100); + + desc.add("x_alignment_relative", x_alignment_relative); + } + + // y alignment + { + edm::ParameterSetDescription y_alignment; + + edm::ParameterSetDescription rpLF; + rpLF.add("x_min", 44.5); + rpLF.add("x_max", 49.); + y_alignment.add("rp_L_F", rpLF); + + edm::ParameterSetDescription rpLN; + rpLN.add("x_min", 6.7); + rpLN.add("x_max", 11.); + y_alignment.add("rp_L_N", rpLN); + + edm::ParameterSetDescription rpRN; + rpRN.add("x_min", 5.9); + rpRN.add("x_max", 10.); + y_alignment.add("rp_R_N", rpRN); + + edm::ParameterSetDescription rpRF; + rpRF.add("x_min", 44.5); + rpRF.add("x_max", 49.); + y_alignment.add("rp_R_F", rpRF); + + y_alignment.add("mode_graph_min_N", 5); + y_alignment.add("mult_sel_proj_y_min_entries", 300); + + desc.add("y_alignment", y_alignment); + } + + // binning + { + edm::ParameterSetDescription binning; + + binning.add("bin_size_x", 142.3314E-3); + binning.add("n_bins_x", 210); + binning.add("pixel_x_offset", 40.); + binning.add("n_bins_y", 400); + binning.add("y_min", -20.); + binning.add("y_max", 20.); + + binning.add("diffFN_n_bins_x", 100); + binning.add("diffFN_x_min", 0.); + binning.add("diffFN_x_max", 20.); + + binning.add("slice_n_bins_x", 100); + binning.add("slice_x_min", -10.); + binning.add("slice_x_max", 10.); + binning.add("slice_n_bins_y", 100); + binning.add("slice_y_min", -2.); + binning.add("slice_y_max", 2.); + + desc.add("binning", binning); + } + + desc.add>("extra_params", {}); + + descriptions.add("ppsAlignmentConfigurationESSource", desc); +} + +//--------------------------------------------------------------------------------------------- + +// Fits a linear function to a TProfile (similar method in PPSAlignmentHarvester). +int PPSAlignmentConfigurationESSource::fitProfile(TProfile* p, double x_mean, double x_rms, double& sl, double& sl_unc) { + unsigned int n_reasonable = 0; + for (int bi = 1; bi <= p->GetNbinsX(); bi++) { + if (p->GetBinEntries(bi) < fitProfileMinBinEntries) { + p->SetBinContent(bi, 0.); + p->SetBinError(bi, 0.); + } else { + n_reasonable++; + } + } + + if (n_reasonable < fitProfileMinNReasonable) + return 1; + + double x_min = x_mean - x_rms, x_max = x_mean + x_rms; + + TF1* ff_pol1 = new TF1("ff_pol1", "[0] + [1]*x"); + + ff_pol1->SetParameter(0., 0.); + p->Fit(ff_pol1, "Q", "", x_min, x_max); + + sl = ff_pol1->GetParameter(1); + sl_unc = ff_pol1->GetParError(1); + + return 0; +} + +//--------------------------------------------------------------------------------------------- + +// Performs a breadth first search on dir. If found, returns the directory with object +// named searchName inside. Otherwise, returns nullptr. +TDirectory* PPSAlignmentConfigurationESSource::findDirectoryWithName(TDirectory* dir, std::string searchName) { + TIter next(dir->GetListOfKeys()); + std::queue dirQueue; + TObject* o; + while ((o = next())) { + TKey* k = (TKey*)o; + + std::string name = k->GetName(); + if (name == searchName) + return dir; + + if (((TSystemFile*)k)->IsDirectory()) + dirQueue.push((TDirectory*)k->ReadObj()); + } + + while (!dirQueue.empty()) { + TDirectory* resultDir = findDirectoryWithName(dirQueue.front(), searchName); + dirQueue.pop(); + if (resultDir != nullptr) + return resultDir; + } + + return nullptr; +} + +//--------------------------------------------------------------------------------------------- + +// Builds vector of PointErrors instances from slice plots in dir. +std::vector PPSAlignmentConfigurationESSource::buildVectorFromDirectory( + TDirectory* dir, const PPSAlignmentConfiguration::RPConfig& rpd) { + std::vector pv; + + TIter next(dir->GetListOfKeys()); + TObject* o; + while ((o = next())) { + TKey* k = (TKey*)o; + + std::string name = k->GetName(); + size_t d = name.find('-'); + const double x_min = std::stod(name.substr(0, d)); + const double x_max = std::stod(name.substr(d + 1)); + + TDirectory* d_slice = (TDirectory*)k->ReadObj(); + + TH1D* h_y = (TH1D*)d_slice->Get("h_y"); + TProfile* p_y_diffFN_vs_y = (TProfile*)d_slice->Get("p_y_diffFN_vs_y"); + + double y_cen = h_y->GetMean(); + double y_width = h_y->GetRMS(); + + y_cen += rpd.y_cen_add_; + y_width *= rpd.y_width_mult_; + + double sl = 0., sl_unc = 0.; + int fr = fitProfile(p_y_diffFN_vs_y, y_cen, y_width, sl, sl_unc); + if (fr != 0) + continue; + + if (debug) + p_y_diffFN_vs_y->Write(name.c_str()); + + pv.push_back({(x_max + x_min) / 2., sl, (x_max - x_min) / 2., sl_unc}); + } + + return pv; +} + +//--------------------------------------------------------------------------------------------- + +void PPSAlignmentConfigurationESSource::setIntervalFor(const edm::eventsetup::EventSetupRecordKey& key, + const edm::IOVSyncValue& iosv, + edm::ValidityInterval& oValidity) { + edm::LogInfo("PPS") << ">> PPSAlignmentConfigurationESSource::setIntervalFor(" << key.name() << ")\n" + << " run=" << iosv.eventID().run() << ", event=" << iosv.eventID().event(); + + edm::ValidityInterval infinity(iosv.beginOfTime(), iosv.endOfTime()); + oValidity = infinity; +} + +DEFINE_FWK_EVENTSETUP_SOURCE(PPSAlignmentConfigurationESSource); diff --git a/CalibPPS/ESProducers/plugins/PPSAssociationCutsESSource.cc b/CalibPPS/ESProducers/plugins/PPSAssociationCutsESSource.cc new file mode 100644 index 0000000000000..eccbabdf5720d --- /dev/null +++ b/CalibPPS/ESProducers/plugins/PPSAssociationCutsESSource.cc @@ -0,0 +1,130 @@ +/**************************************************************************** + * Authors: + * Jan KaÅ¡par + * Grzegorz Sroka + ****************************************************************************/ + +#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/Framework/interface/SourceFactory.h" +#include "FWCore/Framework/interface/ModuleFactory.h" + +#include "FWCore/Framework/interface/ESProducer.h" +#include "FWCore/Framework/interface/EventSetupRecordIntervalFinder.h" +#include "FWCore/Framework/interface/ESProducts.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" +#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" + +#include "CondFormats/PPSObjects/interface/PPSAssociationCuts.h" +#include "CondFormats/DataRecord/interface/PPSAssociationCutsRcd.h" +#include + +using namespace std; + +class PPSAssociationCutsESSource : public edm::ESProducer, public edm::EventSetupRecordIntervalFinder { +public: + PPSAssociationCutsESSource(const edm::ParameterSet &); + + ~PPSAssociationCutsESSource() override = default; + + std::shared_ptr produce(const PPSAssociationCutsRcd &); + + static void fillDescriptions(edm::ConfigurationDescriptions &); + +protected: + void setIntervalFor(const edm::eventsetup::EventSetupRecordKey &, + const edm::IOVSyncValue &, + edm::ValidityInterval &) override; + +private: + static edm::ParameterSetDescription getIOVDefaultParameters(); + bool currentAssociationCutValid_; + unsigned int currentAssociationCutIdx_; + std::vector> ppsAssociationCuts_; + std::vector validityRanges_; +}; + +//---------------------------------------------------------------------------------------------------- + +PPSAssociationCutsESSource::PPSAssociationCutsESSource(const edm::ParameterSet &iConfig) { + for (const auto &interval : iConfig.getParameter>("configuration")) { + ppsAssociationCuts_.push_back(make_shared(interval)); + validityRanges_.push_back(interval.getParameter("validityRange")); + } + + setWhatProduced(this); + findingRecord(); +} + +//---------------------------------------------------------------------------------------------------- + +void PPSAssociationCutsESSource::setIntervalFor(const edm::eventsetup::EventSetupRecordKey &key, + const edm::IOVSyncValue &iosv, + edm::ValidityInterval &oValidity) { + for (unsigned int idx = 0; idx < ppsAssociationCuts_.size(); ++idx) { + // is within an entry ? + if (edm::contains(validityRanges_[idx], iosv.eventID())) { + currentAssociationCutValid_ = true; + currentAssociationCutIdx_ = idx; + oValidity = edm::ValidityInterval(edm::IOVSyncValue(validityRanges_[idx].startEventID()), + edm::IOVSyncValue(validityRanges_[idx].endEventID())); + return; + } + } + + currentAssociationCutValid_ = false; + currentAssociationCutIdx_ = 0; + + edm::LogInfo("PPSAssociationCutsESSource") + << ">> PPSAssociationCutsESSource::setIntervalFor(" << key.name() << ")\n" + << " run=" << iosv.eventID().run() << ", event=" << iosv.eventID().event(); + + const edm::EventID start(iosv.eventID().run(), iosv.eventID().luminosityBlock(), iosv.eventID().event()); + const edm::EventID end(iosv.eventID().run(), iosv.eventID().luminosityBlock(), iosv.eventID().event()); + oValidity = edm::ValidityInterval(edm::IOVSyncValue(start), edm::IOVSyncValue(end)); +} + +//---------------------------------------------------------------------------------------------------- + +std::shared_ptr PPSAssociationCutsESSource::produce(const PPSAssociationCutsRcd &) { + auto output = std::make_shared(); + + if (currentAssociationCutValid_) { + const auto &associationCut = ppsAssociationCuts_[currentAssociationCutIdx_]; + output = associationCut; + } + + return output; +} + +//---------------------------------------------------------------------------------------------------- + +void PPSAssociationCutsESSource::fillDescriptions(edm::ConfigurationDescriptions &descriptions) { + edm::ParameterSetDescription desc; + desc.add("ppsAssociationCutsLabel", ""); + + edm::ParameterSetDescription validator = PPSAssociationCutsESSource::getIOVDefaultParameters(); + + std::vector vDefaults; + desc.addVPSet("configuration", validator, vDefaults); + + descriptions.add("ppsAssociationCutsESSource", desc); +} + +edm::ParameterSetDescription PPSAssociationCutsESSource::getIOVDefaultParameters() { + edm::ParameterSetDescription desc; + desc.add("validityRange", edm::EventRange())->setComment("interval of validity"); + + for (auto §or : {"45", "56"}) { + desc.add("association_cuts_" + std::string(sector), + PPSAssociationCuts::getDefaultParameters()) + ->setComment("track-association cuts for sector " + std::string(sector)); + } + + return desc; +} + +//---------------------------------------------------------------------------------------------------- + +DEFINE_FWK_EVENTSETUP_SOURCE(PPSAssociationCutsESSource); diff --git a/CalibPPS/ESProducers/plugins/PPSPixelTopologyESSource.cc b/CalibPPS/ESProducers/plugins/PPSPixelTopologyESSource.cc index 034065c1caef0..00a98f1279cc0 100644 --- a/CalibPPS/ESProducers/plugins/PPSPixelTopologyESSource.cc +++ b/CalibPPS/ESProducers/plugins/PPSPixelTopologyESSource.cc @@ -24,6 +24,7 @@ #include "CondFormats/PPSObjects/interface/PPSPixelTopology.h" #include "CondFormats/DataRecord/interface/PPSPixelTopologyRcd.h" +#include "FWCore/Utilities/interface/Exception.h" #include @@ -82,6 +83,11 @@ PPSPixelTopologyESSource::PPSPixelTopologyESSource(const edm::ParameterSet& iCon active_edge_sigma_(0.), phys_active_edge_dist_(0.) { setPPSPixelTopology(iConfig); + + // validate input + if (runType_ != "Run2" && runType_ != "Run3") + throw cms::Exception("PPS") << runType_ << " is not valid runType."; + setWhatProduced(this); findingRecord(); } diff --git a/CalibPPS/ESProducers/python/ctppsOpticalFunctions_non_DB_cff.py b/CalibPPS/ESProducers/python/ctppsOpticalFunctions_non_DB_cff.py new file mode 100644 index 0000000000000..b8683b5675ea4 --- /dev/null +++ b/CalibPPS/ESProducers/python/ctppsOpticalFunctions_non_DB_cff.py @@ -0,0 +1,142 @@ +import FWCore.ParameterSet.Config as cms + +from CalibPPS.ESProducers.ctppsLHCInfo_cff import * + +# (source) optical functions sampled at few xangles +from CalibPPS.ESProducers.ctppsOpticalFunctionsESSource_cfi import * + +optics_2016_preTS2 = cms.PSet( + validityRange = cms.EventRange("273725:min - 280385:max"), + + opticalFunctions = cms.VPSet( + cms.PSet( xangle = cms.double(185), fileName = cms.FileInPath("CalibPPS/ESProducers/data/optical_functions/2016_preTS2/version2/185urad.root") ) + ), + + scoringPlanes = cms.VPSet( + # z in cm + cms.PSet( rpId = cms.uint32(0x76100000), dirName = cms.string("XRPH_C6L5_B2"), z = cms.double(-20382.7) ), # RP 002, strip + cms.PSet( rpId = cms.uint32(0x76180000), dirName = cms.string("XRPH_D6L5_B2"), z = cms.double(-21255.0) ), # RP 003, strip + + cms.PSet( rpId = cms.uint32(0x77100000), dirName = cms.string("XRPH_C6R5_B1"), z = cms.double(+20382.7) ), # RP 102, strip + cms.PSet( rpId = cms.uint32(0x77180000), dirName = cms.string("XRPH_D6R5_B1"), z = cms.double(+21255.0) ), # RP 103, strip + ) +) + +ctppsOpticalFunctionsESSource.configuration.append(optics_2016_preTS2) + +optics_2016_postTS2 = cms.PSet( + validityRange = cms.EventRange("282730:min - 284044:max"), + + opticalFunctions = cms.VPSet( + cms.PSet( xangle = cms.double(140), fileName = cms.FileInPath("CalibPPS/ESProducers/data/optical_functions/2016_postTS2/version2/140urad.root") ) + ), + + scoringPlanes = cms.VPSet( + # z in cm + cms.PSet( rpId = cms.uint32(0x76100000), dirName = cms.string("XRPH_C6L5_B2"), z = cms.double(-20382.7) ), # RP 002, strip + cms.PSet( rpId = cms.uint32(0x76180000), dirName = cms.string("XRPH_D6L5_B2"), z = cms.double(-21255.0) ), # RP 003, strip + + cms.PSet( rpId = cms.uint32(0x77100000), dirName = cms.string("XRPH_C6R5_B1"), z = cms.double(+20382.7) ), # RP 102, strip + cms.PSet( rpId = cms.uint32(0x77180000), dirName = cms.string("XRPH_D6R5_B1"), z = cms.double(+21255.0) ), # RP 103, strip + ) +) + +ctppsOpticalFunctionsESSource.configuration.append(optics_2016_postTS2) + +optics_2017 = cms.PSet( + validityRange = cms.EventRange("297046:min - 307082:max"), + + opticalFunctions = cms.VPSet( + cms.PSet( xangle = cms.double(120), fileName = cms.FileInPath("CalibPPS/ESProducers/data/optical_functions/2017/version5tim/120urad.root") ), + cms.PSet( xangle = cms.double(130), fileName = cms.FileInPath("CalibPPS/ESProducers/data/optical_functions/2017/version5tim/130urad.root") ), + cms.PSet( xangle = cms.double(140), fileName = cms.FileInPath("CalibPPS/ESProducers/data/optical_functions/2017/version5tim/140urad.root") ) + ), + + scoringPlanes = cms.VPSet( + # z in cm + cms.PSet( rpId = cms.uint32(0x76180000), dirName = cms.string("XRPH_D6L5_B2"), z = cms.double(-21255.0) ), # RP 003, strip + cms.PSet( rpId = cms.uint32(2054160384), dirName = cms.string("XRPH_E6L5_B2"), z = cms.double(-21570.0) ), # RP 016, diamond + cms.PSet( rpId = cms.uint32(2023227392), dirName = cms.string("XRPH_B6L5_B2"), z = cms.double(-21955.0) ), # RP 023, pixel + + cms.PSet( rpId = cms.uint32(0x77180000), dirName = cms.string("XRPH_D6R5_B1"), z = cms.double(+21255.0) ), # RP 103, strip + cms.PSet( rpId = cms.uint32(2070937600), dirName = cms.string("XRPH_E6R5_B1"), z = cms.double(+21570.0) ), # RP 116, diamond + cms.PSet( rpId = cms.uint32(2040004608), dirName = cms.string("XRPH_B6R5_B1"), z = cms.double(+21955.0) ), # RP 123, pixel + ) +) + +ctppsOpticalFunctionsESSource.configuration.append(optics_2017) + +optics_2018 = cms.PSet( + validityRange = cms.EventRange("314747:min - 325175:max"), + + opticalFunctions = cms.VPSet( + cms.PSet( xangle = cms.double(120), fileName = cms.FileInPath("CalibPPS/ESProducers/data/optical_functions/2018/version6/120urad.root") ), + cms.PSet( xangle = cms.double(130), fileName = cms.FileInPath("CalibPPS/ESProducers/data/optical_functions/2018/version6/130urad.root") ), + cms.PSet( xangle = cms.double(140), fileName = cms.FileInPath("CalibPPS/ESProducers/data/optical_functions/2018/version6/140urad.root") ) + ), + + scoringPlanes = cms.VPSet( + # z in cm + cms.PSet( rpId = cms.uint32(2014838784), dirName = cms.string("XRPH_D6L5_B2"), z = cms.double(-21255.0) ), # RP 003, pixel + cms.PSet( rpId = cms.uint32(2054160384), dirName = cms.string("XRPH_E6L5_B2"), z = cms.double(-21570.0) ), # RP 016, diamond + cms.PSet( rpId = cms.uint32(2023227392), dirName = cms.string("XRPH_B6L5_B2"), z = cms.double(-21955.0) ), # RP 023, pixel + + cms.PSet( rpId = cms.uint32(2031616000), dirName = cms.string("XRPH_D6R5_B1"), z = cms.double(+21255.0) ), # RP 103, pixel + cms.PSet( rpId = cms.uint32(2070937600), dirName = cms.string("XRPH_E6R5_B1"), z = cms.double(+21570.0) ), # RP 116, diamond + cms.PSet( rpId = cms.uint32(2040004608), dirName = cms.string("XRPH_B6R5_B1"), z = cms.double(+21955.0) ), # RP 123, pixel + ) +) + +ctppsOpticalFunctionsESSource.configuration.append(optics_2018) + +optics_2021 = cms.PSet( + validityRange = cms.EventRange("1234:1 - 1234:max"), # NB: a fake IOV, this optics was never used for LHC + + 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") ) + ), + + scoringPlanes = cms.VPSet( + # z in cm + cms.PSet( rpId = cms.uint32(2014838784), dirName = cms.string("XRPH_D6L5_B2"), z = cms.double(-21255.0) ), # RP 003, pixel + cms.PSet( rpId = cms.uint32(2056257536), dirName = cms.string("XRPH_A6L5_B2"), z = cms.double(-21507.8) ), # RP 022, diamond + cms.PSet( rpId = cms.uint32(2054160384), dirName = cms.string("XRPH_E6L5_B2"), z = cms.double(-21570.0) ), # RP 016, diamond + cms.PSet( rpId = cms.uint32(2023227392), dirName = cms.string("XRPH_B6L5_B2"), z = cms.double(-21955.0) ), # RP 023, pixel + + cms.PSet( rpId = cms.uint32(2031616000), dirName = cms.string("XRPH_D6R5_B1"), z = cms.double(+21255.0) ), # RP 103, pixel + cms.PSet( rpId = cms.uint32(2073034752), dirName = cms.string("XRPH_A6R5_B1"), z = cms.double(+21507.8) ), # RP 122, diamond + cms.PSet( rpId = cms.uint32(2070937600), dirName = cms.string("XRPH_E6R5_B1"), z = cms.double(+21570.0) ), # RP 116, diamond + cms.PSet( rpId = cms.uint32(2040004608), dirName = cms.string("XRPH_B6R5_B1"), z = cms.double(+21955.0) ), # RP 123, pixel + ) +) + +# NB: do not append the 2021 config - not used for any LHC data + +optics_2022 = cms.PSet( + validityRange = cms.EventRange("343890:min - 999999:max"), + + opticalFunctions = cms.VPSet( + cms.PSet( xangle = cms.double(144.974), fileName = cms.FileInPath("CalibPPS/ESProducers/data/optical_functions/2022/version_pre1/144.974urad.root") ), + cms.PSet( xangle = cms.double(160.000), fileName = cms.FileInPath("CalibPPS/ESProducers/data/optical_functions/2022/version_pre1/160.000urad.root") ) + ), + + scoringPlanes = cms.VPSet( + # z in cm + cms.PSet( rpId = cms.uint32(2014838784), dirName = cms.string("XRPH_D6L5_B2"), z = cms.double(-21255.0) ), # RP 003, pixel + cms.PSet( rpId = cms.uint32(2056257536), dirName = cms.string("XRPH_A6L5_B2"), z = cms.double(-21507.8) ), # RP 022, diamond + cms.PSet( rpId = cms.uint32(2054160384), dirName = cms.string("XRPH_E6L5_B2"), z = cms.double(-21570.0) ), # RP 016, diamond + cms.PSet( rpId = cms.uint32(2023227392), dirName = cms.string("XRPH_B6L5_B2"), z = cms.double(-21955.0) ), # RP 023, pixel + + cms.PSet( rpId = cms.uint32(2031616000), dirName = cms.string("XRPH_D6R5_B1"), z = cms.double(+21255.0) ), # RP 103, pixel + cms.PSet( rpId = cms.uint32(2073034752), dirName = cms.string("XRPH_A6R5_B1"), z = cms.double(+21507.8) ), # RP 122, diamond + cms.PSet( rpId = cms.uint32(2070937600), dirName = cms.string("XRPH_E6R5_B1"), z = cms.double(+21570.0) ), # RP 116, diamond + cms.PSet( rpId = cms.uint32(2040004608), dirName = cms.string("XRPH_B6R5_B1"), z = cms.double(+21955.0) ), # RP 123, pixel + ) +) + +ctppsOpticalFunctionsESSource.configuration.append(optics_2022) + +# optics interpolation between crossing angles +from CalibPPS.ESProducers.ctppsInterpolatedOpticalFunctionsESSource_cfi import * +ctppsInterpolatedOpticalFunctionsESSource.lhcInfoLabel = ctppsLHCInfoLabel diff --git a/CalibPPS/ESProducers/python/ppsAssociationCuts_non_DB_cff.py b/CalibPPS/ESProducers/python/ppsAssociationCuts_non_DB_cff.py new file mode 100644 index 0000000000000..145a1de631460 --- /dev/null +++ b/CalibPPS/ESProducers/python/ppsAssociationCuts_non_DB_cff.py @@ -0,0 +1,118 @@ +import FWCore.ParameterSet.Config as cms + +from CalibPPS.ESProducers.ppsAssociationCutsESSource_cfi import * + +p2016 = cms.PSet( + validityRange=cms.EventRange("273725:min - 284044:max"), + association_cuts_45=cms.PSet( + xi_cut_mean =cms.string("0."), + xi_cut_threshold=cms.string("0.010"), + + ti_tr_min=cms.double(-1.5), + ti_tr_max=cms.double(2.0) + ), + association_cuts_56=cms.PSet( + xi_cut_mean= cms.string("0."), + xi_cut_threshold=cms.string("0.015"), + + ti_tr_min=cms.double(-1.5), + ti_tr_max=cms.double(2.0) + ), +) +ppsAssociationCutsESSource.configuration.append(p2016) + +p2017 = cms.PSet( + validityRange=cms.EventRange("297046:min - 307082:max"), + association_cuts_45=cms.PSet( + xi_cut_mean=cms.string("+6.0695e-5"), + xi_cut_threshold=cms.string("5. * 0.00121"), + ti_tr_min=cms.double(-1.5), + ti_tr_max=cms.double(2.0) + ), + association_cuts_56=cms.PSet( + y_cut_mean=cms.string("-0.022612"), + y_cut_threshold=cms.string("5. * 0.14777"), + xi_cut_mean=cms.string("+8.012857e-5"), + xi_cut_threshold=cms.string("5. * 0.0020627"), + ti_tr_min=cms.double(-1.5), + ti_tr_max=cms.double(2.0) + ), +) +ppsAssociationCutsESSource.configuration.append(p2017) + +p2018 = cms.PSet( + validityRange=cms.EventRange("314747:min - 325175:max"), + association_cuts_45=cms.PSet( + x_cut_mean=cms.string("-0.065194856"), + x_cut_threshold=cms.string("4. * 0.16008188"), + y_cut_mean=cms.string("+0.10973631"), + y_cut_threshold=cms.string("4. * 0.1407986"), + xi_cut_mean=cms.string("+3.113062e-5"), + xi_cut_threshold=cms.string("4. * 0.0012403586"), + ti_tr_min=cms.double(-1.5), + ti_tr_max=cms.double(2.0) + ), + association_cuts_56=cms.PSet( + x_cut_mean=cms.string("+0.073016431"), + x_cut_threshold=cms.string("5. * 0.18126434"), + y_cut_mean=cms.string("+0.064261029"), + y_cut_threshold=cms.string("5. * 0.14990802"), + xi_cut_mean=cms.string("-1.1852528e-5"), + xi_cut_threshold=cms.string("5. * 0.002046409"), + ti_tr_min=cms.double(-1.5), + ti_tr_max=cms.double(2.0) + ), +) +ppsAssociationCutsESSource.configuration.append(p2018) + +p2021 = cms.PSet( + validityRange=cms.EventRange("1234:1 - 1234:max"), # NB: a fake IOV, there are no LHC data from 2021 - keep it just for MC + association_cuts_45=cms.PSet( + x_cut_mean = cms.string("- ( (-0.530895+0.112595*[x_near]+-0.006785*[x_near]*[x_near]) - (0.046487+0.179333/[x_near])*abs([y_near]) )"), + x_cut_threshold = cms.string("4 * ( (0.091692+0.009316*[x_near]) + (-0.000727)*[y_near]*[y_near] )"), + y_cut_mean = cms.string("- ( (0.672525+-0.619398/[x_near])*TMath::Erf([y_near]/(0.968499+0.597136*[x_near])) )"), + y_cut_threshold = cms.string("4 * ( (0.015202+0.962944/[x_near]/[x_near]) + (0.009804+-7.710241/pow([x_near],5))*abs([y_near]) )"), + + ti_tr_min=cms.double(-1.5), + ti_tr_max=cms.double(2.0) + ), + association_cuts_56=cms.PSet( + x_cut_mean = cms.string("- ( (-0.530895+0.112595*[x_near]+-0.006785*[x_near]*[x_near]) - (0.046487+0.179333/[x_near])*abs([y_near]) )"), + x_cut_threshold = cms.string("4 * ( (0.091692+0.009316*[x_near]) + (-0.000727)*[y_near]*[y_near] )"), + y_cut_mean = cms.string("- ( (0.672525+-0.619398/[x_near])*TMath::Erf([y_near]/(0.968499+0.597136*[x_near])) )"), + y_cut_threshold = cms.string("4 * ( (0.015202+0.962944/[x_near]/[x_near]) + (0.009804+-7.710241/pow([x_near],5))*abs([y_near]) )"), + + ti_tr_min=cms.double(-1.5), + ti_tr_max=cms.double(2.0) + ), +) + +# NB: do not append the 2021 config - not used for any LHC data + +p2022 = cms.PSet( + validityRange=cms.EventRange("343890:min - 999999:max"), + association_cuts_45=cms.PSet( + x_cut_mean = cms.string("- ( (-0.530895+0.112595*[x_near]+-0.006785*[x_near]*[x_near]) - (0.046487+0.179333/[x_near])*abs([y_near]) )"), + x_cut_threshold = cms.string("4 * ( (0.091692+0.009316*[x_near]) + (-0.000727)*[y_near]*[y_near] )"), + y_cut_mean = cms.string("- ( (0.672525+-0.619398/[x_near])*TMath::Erf([y_near]/(0.968499+0.597136*[x_near])) )"), + y_cut_threshold = cms.string("4 * ( (0.015202+0.962944/[x_near]/[x_near]) + (0.009804+-7.710241/pow([x_near],5))*abs([y_near]) )"), + + ti_tr_min=cms.double(-1.5), + ti_tr_max=cms.double(2.0) + ), + association_cuts_56=cms.PSet( + x_cut_mean = cms.string("- ( (-0.530895+0.112595*[x_near]+-0.006785*[x_near]*[x_near]) - (0.046487+0.179333/[x_near])*abs([y_near]) )"), + x_cut_threshold = cms.string("4 * ( (0.091692+0.009316*[x_near]) + (-0.000727)*[y_near]*[y_near] )"), + y_cut_mean = cms.string("- ( (0.672525+-0.619398/[x_near])*TMath::Erf([y_near]/(0.968499+0.597136*[x_near])) )"), + y_cut_threshold = cms.string("4 * ( (0.015202+0.962944/[x_near]/[x_near]) + (0.009804+-7.710241/pow([x_near],5))*abs([y_near]) )"), + + ti_tr_min=cms.double(-1.5), + ti_tr_max=cms.double(2.0) + ), +) +ppsAssociationCutsESSource.configuration.append(p2022) + +def use_single_infinite_iov_entry(ppsAssociationCutsESSource, iov): + ppsAssociationCutsESSource.configuration = cms.VPSet() + iov.validityRange = cms.EventRange("0:min - 999999:max") + ppsAssociationCutsESSource.configuration.append(iov) diff --git a/CalibPPS/ESProducers/python/ppsTopology_cff.py b/CalibPPS/ESProducers/python/ppsTopology_cff.py index 6e63e2b4a7a5d..aca95af3fccac 100644 --- a/CalibPPS/ESProducers/python/ppsTopology_cff.py +++ b/CalibPPS/ESProducers/python/ppsTopology_cff.py @@ -6,4 +6,4 @@ from Configuration.Eras.Modifier_ctpps_2017_cff import ctpps_2017 from Configuration.Eras.Modifier_ctpps_2018_cff import ctpps_2018 -(ctpps_2016 | ctpps_2017 | ctpps_2018).toModify(ppsPixelTopologyESSource, RunType = cms.string('Run2'), simYWidth = cms.double(24.4) ) +(ctpps_2016 | ctpps_2017 | ctpps_2018).toModify(ppsPixelTopologyESSource, RunType = cms.string('Run2'), simYWidth = cms.double(24.4), noOfPixelSimY = cms.int32(156), noOfPixels = cms.int32(24960)) diff --git a/CalibPPS/TimingCalibration/plugins/BuildFile.xml b/CalibPPS/TimingCalibration/plugins/BuildFile.xml index b67b7d23683d5..83f19f4dc0ff3 100644 --- a/CalibPPS/TimingCalibration/plugins/BuildFile.xml +++ b/CalibPPS/TimingCalibration/plugins/BuildFile.xml @@ -6,4 +6,5 @@ + diff --git a/CalibPPS/TimingCalibration/plugins/PPSDiamondSampicTimingCalibrationPCLHarvester.cc b/CalibPPS/TimingCalibration/plugins/PPSDiamondSampicTimingCalibrationPCLHarvester.cc new file mode 100644 index 0000000000000..ed66659cc760a --- /dev/null +++ b/CalibPPS/TimingCalibration/plugins/PPSDiamondSampicTimingCalibrationPCLHarvester.cc @@ -0,0 +1,290 @@ +// -*- C++ -*- +// +// Package: CalibPPS/TimingCalibration/PPSDiamondSampicTimingCalibrationPCLHarvester +// Class: PPSDiamondSampicTimingCalibrationPCLHarvester +// +/**\class PPSDiamondSampicTimingCalibrationPCLHarvester PPSDiamondSampicTimingCalibrationPCLHarvester.cc CalibPPS/TimingCalibration/PPSDiamondSampicTimingCalibrationPCLHarvester/plugins/PPSDiamondSampicTimingCalibrationPCLHarvester.cc + + Description: Harvester of the DiamondSampic calibration which produces sqlite file with a new channel alignment + + Implementation: + [Notes on implementation] +*/ +// +// Original Author: Christopher Misan +// Created: Mon, 26 Jul 2021 16:36:13 GMT +// +// +#include "TAxis.h" +#include "TH1.h" +#include "TArrayD.h" +#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 +#include + +#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" +#include "CondFormats/DataRecord/interface/PPSTimingCalibrationRcd.h" + +namespace pt = boost::property_tree; + +class PPSDiamondSampicTimingCalibrationPCLHarvester : public DQMEDHarvester { +public: + PPSDiamondSampicTimingCalibrationPCLHarvester(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; + void calibJson(DQMStore::IGetter& iGetter); + void calibDb(DQMStore::IGetter& iGetter); + bool getDbSampicChannel( + DQMStore::IGetter& iGetter, int& db, int& sampic, int& channel, std::string ch_name, CTPPSDiamondDetId detid); + edm::ESGetToken geomEsToken_; + edm::ESGetToken timingCalibrationToken_; + edm::ESHandle hTimingCalib_; + std::vector detids_; + const std::string dqmDir_; + const unsigned int min_entries_; + const std::string jsonCalibFile_, jsonOutputPath_; +}; + +//------------------------------------------------------------------------------ + +PPSDiamondSampicTimingCalibrationPCLHarvester::PPSDiamondSampicTimingCalibrationPCLHarvester( + const edm::ParameterSet& iConfig) + : geomEsToken_(esConsumes()), + dqmDir_(iConfig.getParameter("dqmDir")), + min_entries_(iConfig.getParameter("minEntries")), + jsonCalibFile_(iConfig.getParameter("jsonCalibFile")), + jsonOutputPath_(iConfig.getParameter("jsonOutputPath")) { + if (jsonCalibFile_.empty()) + timingCalibrationToken_ = esConsumes( + edm::ESInputTag(iConfig.getParameter("timingCalibrationTag"))); +} + +//------------------------------------------------------------------------------ + +void PPSDiamondSampicTimingCalibrationPCLHarvester::beginRun(const edm::Run& iRun, const edm::EventSetup& iSetup) { + if (jsonCalibFile_.empty()) + hTimingCalib_ = iSetup.getHandle(timingCalibrationToken_); + 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); + detids_.emplace_back(detid); + } +} + +//------------------------------------------------------------------------------ + +bool PPSDiamondSampicTimingCalibrationPCLHarvester::getDbSampicChannel( + DQMStore::IGetter& iGetter, int& db, int& sampic, int& channel, std::string path, CTPPSDiamondDetId detid) { + auto histDb = iGetter.get(path + "db"); + auto histSampic = iGetter.get(path + "sampic"); + auto histChannel = iGetter.get(path + "channel"); + + if (histDb == nullptr) { + edm::LogWarning("PPSDiamondSampicTimingCalibrationPCLHarvester:dqmEndJob") + << "Failed to retrieve db for detid: " << detid; + return false; + } + + if (histSampic == nullptr) { + edm::LogWarning("PPSDiamondSampicTimingCalibrationPCLHarvester:dqmEndJob") + << "Failed to retrieve sampic for detid: " << detid; + return false; + } + + if (histChannel == nullptr) { + edm::LogWarning("PPSDiamondSampicTimingCalibrationPCLHarvester:dqmEndJob") + << "Failed to retrieve channel hwId for detid: " << detid; + return false; + } + + db = histDb->getIntValue(); + sampic = histSampic->getIntValue(); + channel = histChannel->getIntValue(); + + return true; +} +//------------------------------------------------------------------------------ + +void PPSDiamondSampicTimingCalibrationPCLHarvester::calibJson(DQMStore::IGetter& iGetter) { + std::unordered_map timeHisto; + std::string ch_name, path; + + pt::ptree node; + pt::read_json(jsonCalibFile_, node); + const std::string formula = node.get("formula"); + + for (const auto& detid : detids_) { + detid.channelName(path, CTPPSDiamondDetId::nPath); + detid.channelName(ch_name); + path = dqmDir_ + "/" + path + "/" + ch_name; + const auto chid = detid.rawId(); + + int db, sampic, channel; + if (!getDbSampicChannel(iGetter, db, sampic, channel, path, detid)) + continue; + + int ct = 0; + for (pt::ptree::value_type& par : node.get_child("parameters." + std::to_string(db))) { + double new_time_offset; + if (ct == 16 * (1 - sampic) + channel) { //flip the calibration - sampic 1 is first in json + double old_time_offset = par.second.get("time_offset"); + + timeHisto[chid] = iGetter.get(path); + + if (timeHisto[chid] == nullptr) { + edm::LogWarning("PPSDiamondSampicTimingCalibrationPCLHarvester:dqmEndJob") + << "Failed to retrieve time monitor for detid" << detid; + par.second.put("time_offset", old_time_offset); + continue; + } + + if (min_entries_ > 0 && timeHisto[chid]->getEntries() < min_entries_) { + edm::LogWarning("PPSDiamondSampicTimingCalibrationPCLHarvester:dqmEndJob") + << "Not enough entries for channel (" << detid << "): " << timeHisto[chid]->getEntries() << " < " + << min_entries_ << ". Skipping calibration."; + par.second.put("time_offset", old_time_offset); + continue; + } + new_time_offset = old_time_offset - timeHisto[chid]->getMean(); + //scale x axis of the plots by calculated offset + timeHisto[chid]->getTH1F()->GetXaxis()->Set( + timeHisto[chid]->getTH1F()->GetXaxis()->GetNbins(), + timeHisto[chid]->getTH1F()->GetXaxis()->GetXmin() + new_time_offset, // new Xmin + timeHisto[chid]->getTH1F()->GetXaxis()->GetXmax() + new_time_offset); // new Xmax + timeHisto[chid]->getTH1F()->ResetStats(); + + par.second.put("time_offset", new_time_offset); + break; + } + ct++; + } + } + pt::write_json(jsonOutputPath_, node); +} + +//------------------------------------------------------------------------------ + +void PPSDiamondSampicTimingCalibrationPCLHarvester::calibDb(DQMStore::IGetter& iGetter) { + PPSTimingCalibration calib = *hTimingCalib_; + + // book the parameters containers + PPSTimingCalibration::ParametersMap params; + PPSTimingCalibration::TimingMap time_info; + + std::unordered_map timeHisto; + std::string rp_name, plane_name, ch_name, path; + const std::string& formula = calib.formula(); + + for (const auto& detid : detids_) { + detid.channelName(path, CTPPSDiamondDetId::nPath); + detid.channelName(ch_name); + path = dqmDir_ + "/" + path + "/" + ch_name; + const auto chid = detid.rawId(); + + int db, sampic, channel; + if (!getDbSampicChannel(iGetter, db, sampic, channel, path, detid)) + continue; + + PPSTimingCalibration::Key key; + key.db = db; + key.sampic = sampic; + key.channel = channel; + + double timeOffset = calib.timeOffset(db, sampic, channel); + double timePrecision = calib.timePrecision(db, sampic, channel); + if (timeOffset == 0 && timePrecision == 0) { + edm::LogWarning("PPSDiamondSampicTimingCalibrationPCLHarvester:dqmEndJob") + << "No calibration found for db: " << db << " sampic: " << sampic << " channel: " << channel; + continue; + } + + int cell_ct = 0; + while (!calib.parameters(db, sampic, channel, cell_ct).empty()) { + auto parameters = calib.parameters(db, sampic, channel, cell_ct); + key.cell = cell_ct; + params[key] = parameters; + cell_ct++; + } + + key.cell = -1; + + time_info[key] = {timeOffset, timePrecision}; + timeHisto[chid] = iGetter.get(path); + if (timeHisto[chid] == nullptr) { + edm::LogWarning("PPSDiamondSampicTimingCalibrationPCLHarvester:dqmEndJob") + << "Failed to retrieve time monitor for detid: " << detid; + continue; + } + + if (min_entries_ > 0 && timeHisto[chid]->getEntries() < min_entries_) { + edm::LogInfo("PPSDiamondSampicTimingCalibrationPCLHarvester:dqmEndJob") + << "Not enough entries (" << detid << "): " << timeHisto[chid]->getEntries() << " < " << min_entries_ + << ". Skipping calibration."; + continue; + } + + double new_time_offset = timeOffset - timeHisto[chid]->getMean(); + //scale x axis of the plots by calculated offset + timeHisto[chid]->getTH1F()->GetXaxis()->Set( + timeHisto[chid]->getTH1F()->GetXaxis()->GetNbins(), + timeHisto[chid]->getTH1F()->GetXaxis()->GetXmin() + new_time_offset, // new Xmin + timeHisto[chid]->getTH1F()->GetXaxis()->GetXmax() + new_time_offset); // new Xmax + timeHisto[chid]->getTH1F()->ResetStats(); + + time_info[key] = {new_time_offset, timePrecision}; + } + + auto calibPPS = PPSTimingCalibration(formula, params, time_info); + // write the object + edm::Service poolDbService; + poolDbService->writeOne(&calibPPS, poolDbService->currentTime(), "PPSTimingCalibrationRcd"); +} + +//------------------------------------------------------------------------------ + +void PPSDiamondSampicTimingCalibrationPCLHarvester::dqmEndJob(DQMStore::IBooker& iBooker, DQMStore::IGetter& iGetter) { + iBooker.cd(); + iBooker.setCurrentFolder(dqmDir_); + if (jsonCalibFile_.empty()) + calibDb(iGetter); + else + calibJson(iGetter); +} + +//------------------------------------------------------------------------------ + +void PPSDiamondSampicTimingCalibrationPCLHarvester::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + desc.add("timingCalibrationTag", "GlobalTag:DiamondSampicCalibration") + ->setComment("input tag for timing calibration retrieval"); + desc.add("dqmDir", "AlCaReco/PPSDiamondSampicTimingCalibrationPCL") + ->setComment("input path for the various DQM plots"); + desc.add("minEntries", 1)->setComment("minimal number of hits to extract calibration"); + desc.add("jsonCalibFile", "") + ->setComment( + "input path for json file containing calibration, if none, calibration will be obtained from db instead"); + desc.add("jsonOutputPath", "offset_cal.json")->setComment("output path for the new json calibration"); + descriptions.add("PPSDiamondSampicTimingCalibrationPCLHarvester", desc); +} + +DEFINE_FWK_MODULE(PPSDiamondSampicTimingCalibrationPCLHarvester); \ No newline at end of file diff --git a/CalibPPS/TimingCalibration/plugins/PPSDiamondSampicTimingCalibrationPCLWorker.cc b/CalibPPS/TimingCalibration/plugins/PPSDiamondSampicTimingCalibrationPCLWorker.cc new file mode 100644 index 0000000000000..71c3b20357778 --- /dev/null +++ b/CalibPPS/TimingCalibration/plugins/PPSDiamondSampicTimingCalibrationPCLWorker.cc @@ -0,0 +1,155 @@ +// -*- C++ -*- +// +// Package: CalibPPS/TimingCalibration/PPSDiamondSampicTimingCalibrationPCLWorker +// Class: PPSDiamondSampicTimingCalibrationPCLWorker +// +/**\class PPSDiamondSampicTimingCalibrationPCLWorker PPSDiamondSampicTimingCalibrationPCLWorker.cc CalibPPS/TimingCalibration/PPSDiamondSampicTimingCalibrationPCLWorker/plugins/PPSDiamondSampicTimingCalibrationPCLWorker.cc + + Description: Worker of DiamondSampic calibration which produces RecHitsTime histograms and id mapping for the Harvester + + Implementation: + [Notes on implementation] +*/ +// +// Original Author: Christopher Misan +// Created: Mon, 26 Jul 2021 07:37:13 GMT +// +// + +#include + +#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 "Geometry/VeryForwardGeometryBuilder/interface/CTPPSGeometry.h" +#include "Geometry/Records/interface/VeryForwardRealGeometryRecord.h" + +#include "DataFormats/CTPPSDetId/interface/TotemTimingDetId.h" +#include "DataFormats/CTPPSDetId/interface/CTPPSDiamondDetId.h" +#include "DataFormats/CTPPSDigi/interface/TotemTimingDigi.h" +#include "DataFormats/CTPPSReco/interface/TotemTimingRecHit.h" +#include "DataFormats/Common/interface/DetSetVector.h" + +//------------------------------------------------------------------------------ + +struct Histograms_PPSDiamondSampicTimingCalibrationPCLWorker { + std::unordered_map timeHisto; + std::unordered_map db; + std::unordered_map sampic; + std::unordered_map channel; +}; + +class PPSDiamondSampicTimingCalibrationPCLWorker + : public DQMGlobalEDAnalyzer { +public: + explicit PPSDiamondSampicTimingCalibrationPCLWorker(const edm::ParameterSet&); + ~PPSDiamondSampicTimingCalibrationPCLWorker() override; + + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + +private: + void bookHistograms(DQMStore::IBooker&, + edm::Run const&, + edm::EventSetup const&, + Histograms_PPSDiamondSampicTimingCalibrationPCLWorker&) const override; + + void dqmAnalyze(edm::Event const&, + edm::EventSetup const&, + Histograms_PPSDiamondSampicTimingCalibrationPCLWorker const&) const override; + + // ------------ member data ------------ + edm::EDGetTokenT> totemTimingDigiToken_; + edm::EDGetTokenT> totemTimingRecHitToken_; + edm::ESGetToken geomEsToken_; + std::string folder_; +}; + +//------------------------------------------------------------------------------ + +PPSDiamondSampicTimingCalibrationPCLWorker::PPSDiamondSampicTimingCalibrationPCLWorker(const edm::ParameterSet& iConfig) + : totemTimingDigiToken_( + consumes>(iConfig.getParameter("totemTimingDigiTag"))), + totemTimingRecHitToken_( + consumes>(iConfig.getParameter("totemTimingRecHitTag"))), + geomEsToken_(esConsumes()), + folder_(iConfig.getParameter("folder")) {} + +PPSDiamondSampicTimingCalibrationPCLWorker::~PPSDiamondSampicTimingCalibrationPCLWorker() {} + +//------------------------------------------------------------------------------ + +void PPSDiamondSampicTimingCalibrationPCLWorker::dqmAnalyze( + edm::Event const& iEvent, + edm::EventSetup const& iSetup, + Histograms_PPSDiamondSampicTimingCalibrationPCLWorker const& histos) const { + edm::Handle> timingDigi; + edm::Handle> timingRecHit; + iEvent.getByToken(totemTimingRecHitToken_, timingRecHit); + iEvent.getByToken(totemTimingDigiToken_, timingDigi); + + if (timingRecHit->empty()) { + edm::LogWarning("PPSDiamondSampicTimingCalibrationPCLWorker:dqmAnalyze") + << "No rechits retrieved from the event content."; + return; + } + + for (const auto& digis : *timingDigi) { + const CTPPSDiamondDetId detId(digis.detId()); + for (const auto& digi : digis) { + histos.db.at(detId.rawId())->Fill(digi.hardwareBoardId()); + histos.sampic.at(detId.rawId())->Fill(digi.hardwareSampicId()); + histos.channel.at(detId.rawId())->Fill(digi.hardwareChannelId()); + } + } + + for (const auto& recHits : *timingRecHit) { + const CTPPSDiamondDetId detId(recHits.detId()); + for (const auto& recHit : recHits) + histos.timeHisto.at(detId.rawId())->Fill(recHit.time()); + } +} + +//------------------------------------------------------------------------------ + +void PPSDiamondSampicTimingCalibrationPCLWorker::bookHistograms( + DQMStore::IBooker& ibook, + edm::Run const& run, + edm::EventSetup const& iSetup, + Histograms_PPSDiamondSampicTimingCalibrationPCLWorker& histos) const { + ibook.setCurrentFolder(folder_); + 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); + + std::string path; + detid.channelName(path, CTPPSDiamondDetId::nPath); + detid.channelName(ch_name); + histos.timeHisto[detid.rawId()] = ibook.book1D(path + "/" + ch_name, ch_name, 500, -25, 25); + histos.db[detid.rawId()] = ibook.bookInt(path + "/" + ch_name + "db"); + histos.sampic[detid.rawId()] = ibook.bookInt(path + "/" + ch_name + "sampic"); + histos.channel[detid.rawId()] = ibook.bookInt(path + "/" + ch_name + "channel"); + } +} + +//------------------------------------------------------------------------------ + +void PPSDiamondSampicTimingCalibrationPCLWorker::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + desc.add("totemTimingDigiTag", edm::InputTag("totemTimingRawToDigi", "TotemTiming")) + ->setComment("input tag for the PPS diamond detectors digi"); + desc.add("totemTimingRecHitTag", edm::InputTag("totemTimingRecHits")) + ->setComment("input tag for the PPS diamond detectors rechits"); + desc.add("folder", "AlCaReco/PPSDiamondSampicTimingCalibrationPCL") + ->setComment("output path for the various DQM plots"); + descriptions.add("PPSDiamondSampicTimingCalibrationPCLWorker", desc); +} + +DEFINE_FWK_MODULE(PPSDiamondSampicTimingCalibrationPCLWorker); diff --git a/CalibPPS/TimingCalibration/plugins/PPSTimingCalibrationPCLHarvester.cc b/CalibPPS/TimingCalibration/plugins/PPSTimingCalibrationPCLHarvester.cc index 9e2a43cdbb3fd..6ab16830f6c35 100644 --- a/CalibPPS/TimingCalibration/plugins/PPSTimingCalibrationPCLHarvester.cc +++ b/CalibPPS/TimingCalibration/plugins/PPSTimingCalibrationPCLHarvester.cc @@ -142,7 +142,7 @@ void PPSTimingCalibrationPCLHarvester::dqmEndJob(DQMStore::IBooker& iBooker, DQM // write the object edm::Service poolDbService; - poolDbService->writeOne(&calib, poolDbService->currentTime(), "PPSTimingCalibrationRcd"); + poolDbService->writeOneIOV(calib, poolDbService->currentTime(), "PPSTimingCalibrationRcd"); } //------------------------------------------------------------------------------ diff --git a/CalibPPS/TimingCalibration/python/ALCARECOPPSCalTrackBasedSel_Output_cff.py b/CalibPPS/TimingCalibration/python/ALCARECOPPSCalTrackBasedSel_Output_cff.py index 1415b8c708f01..6a4171db20554 100644 --- a/CalibPPS/TimingCalibration/python/ALCARECOPPSCalTrackBasedSel_Output_cff.py +++ b/CalibPPS/TimingCalibration/python/ALCARECOPPSCalTrackBasedSel_Output_cff.py @@ -6,8 +6,9 @@ ), outputCommands = cms.untracked.vstring( 'keep *_ALCARECOPPSCalTrackBasedSel_*_*', - 'keep *_ctppsDiamondRawToDigi_*_*' - # will be updated to add the spatial alignment required collections + 'keep *_ctppsDiamondRawToDigi_*_*', + 'keep *_totemTimingRawToDigi_*_*', + 'keep *_ctppsLocalTrackLiteProducer_*_*' ) ) diff --git a/CalibPPS/TimingCalibration/python/ALCARECOPPSCalTrackBasedSel_cff.py b/CalibPPS/TimingCalibration/python/ALCARECOPPSCalTrackBasedSel_cff.py index 27ad42bb7d8db..f92dda0ee8030 100644 --- a/CalibPPS/TimingCalibration/python/ALCARECOPPSCalTrackBasedSel_cff.py +++ b/CalibPPS/TimingCalibration/python/ALCARECOPPSCalTrackBasedSel_cff.py @@ -15,27 +15,31 @@ # select events passing the filter on pixel tracks from HLTrigger.special.hltPPSPerPotTrackFilter_cfi import hltPPSPerPotTrackFilter as _filter -hltPPSPerPotTrackFilter = _filter.clone( +hltPPSPerPotTrackFilter_45 = _filter.clone( pixelFilter = cms.VPSet( cms.PSet( # sector 45, near pot detid = cms.uint32(2022703104), minTracks = cms.int32(1), - maxTracks = cms.int32(6), + maxTracks = cms.int32(1), ), cms.PSet( # sector 45, far pot detid = cms.uint32(2023227392), minTracks = cms.int32(1), - maxTracks = cms.int32(6), + maxTracks = cms.int32(1), ), + ) +) +hltPPSPerPotTrackFilter_56 = _filter.clone( + pixelFilter = cms.VPSet( cms.PSet( # sector 56, near pot detid = cms.uint32(2039480320), minTracks = cms.int32(1), - maxTracks = cms.int32(6), + maxTracks = cms.int32(1), ), cms.PSet( # sector 56, far pot detid = cms.uint32(2040004608), minTracks = cms.int32(1), - maxTracks = cms.int32(6), + maxTracks = cms.int32(1), ), ) ) @@ -44,5 +48,5 @@ ctppsRawToDigi * recoCTPPS * ALCARECOPPSCalTrackBasedSelHLT * - hltPPSPerPotTrackFilter + (hltPPSPerPotTrackFilter_45 + hltPPSPerPotTrackFilter_56) ) diff --git a/CalibPPS/TimingCalibration/python/ALCARECOPPSDiamondSampicTimingCalibHarvester_cff.py b/CalibPPS/TimingCalibration/python/ALCARECOPPSDiamondSampicTimingCalibHarvester_cff.py new file mode 100644 index 0000000000000..1c6ecf70c86a7 --- /dev/null +++ b/CalibPPS/TimingCalibration/python/ALCARECOPPSDiamondSampicTimingCalibHarvester_cff.py @@ -0,0 +1,13 @@ +import FWCore.ParameterSet.Config as cms + +from Geometry.VeryForwardGeometry.geometryRPFromDB_cfi import * +from CalibPPS.TimingCalibration.PPSDiamondSampicTimingCalibrationPCLHarvester_cfi import * + + +DQMStore = cms.Service("DQMStore") + +from DQMServices.Core.DQMEDHarvester import DQMEDHarvester +dqmEnv = DQMEDHarvester('DQMHarvestingMetadata', + subSystemFolder=cms.untracked.string('AlCaReco/PPSDiamondSampicTimingCalibrationPCL/AlignedChannels')) + +ALCAHARVESTPPSDiamondSampicTimingCalibration = cms.Sequence(PPSDiamondSampicTimingCalibrationPCLHarvester + dqmEnv) diff --git a/CalibPPS/TimingCalibration/python/ALCARECOPPSDiamondSampicTimingCalib_Output_cff.py b/CalibPPS/TimingCalibration/python/ALCARECOPPSDiamondSampicTimingCalib_Output_cff.py new file mode 100644 index 0000000000000..d86911e241cde --- /dev/null +++ b/CalibPPS/TimingCalibration/python/ALCARECOPPSDiamondSampicTimingCalib_Output_cff.py @@ -0,0 +1,13 @@ +import FWCore.ParameterSet.Config as cms + +OutALCARECOPPSDiamondSampicTimingCalib_noDrop = cms.PSet( + SelectEvents = cms.untracked.PSet( + SelectEvents = cms.vstring('pathALCARECOPPSDiamondSampicTimingCalib') + ), + outputCommands = cms.untracked.vstring( + 'keep *_MEtoEDMConvertPPSDiamondSampicTimingCalib_*_*', + ) +) + +OutALCARECOPPSDiamondSampicTimingCalib = OutALCARECOPPSDiamondSampicTimingCalib_noDrop.clone() +OutALCARECOPPSDiamondSampicTimingCalib.outputCommands.insert(0, 'drop *') diff --git a/CalibPPS/TimingCalibration/python/ALCARECOPPSDiamondSampicTimingCalib_cff.py b/CalibPPS/TimingCalibration/python/ALCARECOPPSDiamondSampicTimingCalib_cff.py new file mode 100644 index 0000000000000..060a364dced8e --- /dev/null +++ b/CalibPPS/TimingCalibration/python/ALCARECOPPSDiamondSampicTimingCalib_cff.py @@ -0,0 +1,18 @@ +import FWCore.ParameterSet.Config as cms + +from RecoPPS.Configuration.recoCTPPS_cff import diamondSampicLocalReconstructionTask +from CalibPPS.TimingCalibration.PPSDiamondSampicTimingCalibrationPCLWorker_cfi import PPSDiamondSampicTimingCalibrationPCLWorker +from DQMServices.Core.DQMEDAnalyzer import DQMEDAnalyzer + +MEtoEDMConvertPPSDiamondSampicTimingCalib = cms.EDProducer('MEtoEDMConverter', + Name = cms.untracked.string('MEtoEDMConverter'), + Verbosity = cms.untracked.int32(0), + Frequency = cms.untracked.int32(50), + MEPathToSave = cms.untracked.string('AlCaReco/PPSDiamondSampicTimingCalibrationPCL') +) + +taskALCARECOPPSDiamondSampicTimingCalib = cms.Task( + diamondSampicLocalReconstructionTask, + PPSDiamondSampicTimingCalibrationPCLWorker, + MEtoEDMConvertPPSDiamondSampicTimingCalib +) diff --git a/CalibPPS/TimingCalibration/test/DiamondSampicCalibrationHarvester_cfg.py b/CalibPPS/TimingCalibration/test/DiamondSampicCalibrationHarvester_cfg.py new file mode 100644 index 0000000000000..62477a79dae75 --- /dev/null +++ b/CalibPPS/TimingCalibration/test/DiamondSampicCalibrationHarvester_cfg.py @@ -0,0 +1,68 @@ +import FWCore.ParameterSet.Config as cms + +process = cms.Process("harvester") + +process.load("FWCore.MessageService.MessageLogger_cfi") + +process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(-1) ) + +process.load('Configuration.StandardSequences.Services_cff') +process.load('Configuration.EventContent.EventContent_cff') +process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff') +from Configuration.AlCa.GlobalTag import GlobalTag +process.GlobalTag = GlobalTag(process.GlobalTag, '113X_dataRun3_Prompt_PPStestSampicPCL_v1') + +# Source (histograms) +process.source = cms.Source("DQMRootSource", + fileNames = cms.untracked.vstring("file:worker_output.root"), +) + +# output service for database +process.load('CondCore.CondDB.CondDB_cfi') +process.CondDB.connect = 'sqlite_file:ppsDiamondSampicTiming_calibration.sqlite' # SQLite output + +process.PoolDBOutputService = cms.Service('PoolDBOutputService', + process.CondDB, + timetype = cms.untracked.string('runnumber'), + toPut = cms.VPSet( + cms.PSet( + record = cms.string('PPSTimingCalibrationRcd'), + tag = cms.string('DiamondSampicCalibration'), + ) + ) +) + +################ +#geometry +################ +process.load('Geometry.VeryForwardGeometry.geometryRPFromDD_2021_cfi') + +process.load("CalibPPS.TimingCalibration.PPSDiamondSampicTimingCalibrationPCLHarvester_cfi") +#process.PPSDiamondSampicTimingCalibrationPCLHarvester.jsonCalibFile=cms.string("initial.cal.json") + +# load DQM framework +process.load("DQMServices.Core.DQMStore_cfi") +process.load("DQMServices.Components.DQMEnvironment_cfi") +process.dqmEnv.subSystemFolder = "CalibPPS" +process.dqmSaver.convention = 'Offline' +process.dqmSaver.workflow = "/CalibPPS/TimingCalibration/CMSSW_12_0_0_pre2" +process.dqmSaver.saveByRun = -1 +process.dqmSaver.saveAtJobEnd = True +process.dqmSaver.forceRunNumber = 999999 + +process.p = cms.Path( + process.PPSDiamondSampicTimingCalibrationPCLHarvester +) + +process.end_path = cms.EndPath( + process.dqmEnv + + process.dqmSaver +) + +process.schedule = cms.Schedule( + process.p, + process.end_path +) + + + diff --git a/CalibPPS/TimingCalibration/test/DiamondSampicCalibrationWorker_cfg.py b/CalibPPS/TimingCalibration/test/DiamondSampicCalibrationWorker_cfg.py new file mode 100644 index 0000000000000..b1b58bb878e33 --- /dev/null +++ b/CalibPPS/TimingCalibration/test/DiamondSampicCalibrationWorker_cfg.py @@ -0,0 +1,83 @@ +import FWCore.ParameterSet.Config as cms + +process = cms.Process("worker") + +process.load("FWCore.MessageService.MessageLogger_cfi") +process.load('RecoPPS.Local.totemTimingLocalReconstruction_cff') +process.source = cms.Source("EmptySource") +process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(10000) ) + +process.load('Configuration.StandardSequences.Services_cff') +process.load('Configuration.EventContent.EventContent_cff') +process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff') +from Configuration.AlCa.GlobalTag import GlobalTag +process.GlobalTag = GlobalTag(process.GlobalTag, '113X_dataRun3_Prompt_PPStestSampicPCL_v1') + +################ +#digi converter +################ +process.totemTimingRawToDigi = cms.EDProducer('DiamondSampicDigiProducer', + #input path of the testbeam data + sampicFilesVec=cms.vstring("/eos/cms/store/group/dpg_ctpps/comm_ctpps/201905_DesyTestbeam/MergedDev/Ntuple_runsampic_159_runtelescope_636.root"), + ################ + #channel mapping + ################ + idsMapping = cms.VPSet( + cms.PSet(detId = cms.vuint32(2054160384,2054553600,2056257536,2056650752), treeChId = cms.uint32(8)), + cms.PSet(detId = cms.vuint32(2054164480,2054557696,2056261632,2056654848), treeChId = cms.uint32(9)), + cms.PSet(detId = cms.vuint32(2054168576,2054561792,2056265728,2056658944), treeChId = cms.uint32(10)), + cms.PSet(detId = cms.vuint32(2054172672,2054565888,2056269824,2056663040), treeChId = cms.uint32(11)), + cms.PSet(detId = cms.vuint32(2054176768,2054569984,2056273920,2056667136), treeChId = cms.uint32(12)), + cms.PSet(detId = cms.vuint32(2054180864,2054574080,2056278016,2056671232), treeChId = cms.uint32(13)), + cms.PSet(detId = cms.vuint32(2054184960,2054578176,2056282112,2056675328), treeChId = cms.uint32(14)), + cms.PSet(detId = cms.vuint32(2054189056,2054582272,2056286208,2056679424), treeChId = cms.uint32(15)), + cms.PSet(detId = cms.vuint32(2054193152,2054586368,2056290304,2056683520), treeChId = cms.uint32(16)), + cms.PSet(detId = cms.vuint32(2054197248,2054590464,2056294400,2056687616), treeChId = cms.uint32(17)), + cms.PSet(detId = cms.vuint32(2054201344,2054594560,2056298496,2056691712), treeChId = cms.uint32(18)), + cms.PSet(detId = cms.vuint32(2054205440,2054598656,2056302592,2056695808), treeChId = cms.uint32(19)), + + cms.PSet(detId = cms.vuint32(2054291456,2054422528,2056388608,2056519680), treeChId = cms.uint32(20)), + cms.PSet(detId = cms.vuint32(2054295552,2054426624,2056392704,2056523776), treeChId = cms.uint32(21)), + cms.PSet(detId = cms.vuint32(2054299648,2054430720,2056396800,2056527872), treeChId = cms.uint32(22)), + cms.PSet(detId = cms.vuint32(2054303744,2054434816,2056400896,2056531968), treeChId = cms.uint32(23)), + cms.PSet(detId = cms.vuint32(2054307840,2054438912,2056404992,2056536064), treeChId = cms.uint32(24)), + cms.PSet(detId = cms.vuint32(2054311936,2054443008,2056409088,2056540160), treeChId = cms.uint32(25)), + cms.PSet(detId = cms.vuint32(2054316032,2054447104,2056413184,2056544256), treeChId = cms.uint32(26)), + cms.PSet(detId = cms.vuint32(2054320128,2054451200,2056417280,2056548352), treeChId = cms.uint32(27)), + cms.PSet(detId = cms.vuint32(2054324224,2054455296,2056421376,2056552448), treeChId = cms.uint32(28)), + cms.PSet(detId = cms.vuint32(2054328320,2054459392,2056425472,2056556544), treeChId = cms.uint32(29)), + cms.PSet(detId = cms.vuint32(2054332416,2054463488,2056429568,2056560640), treeChId = cms.uint32(30)), + cms.PSet(detId = cms.vuint32(2054336512,2054467584,2056433664,2056564736), treeChId = cms.uint32(31)) + + ) +) + +process.totemTimingRecHits.mergeTimePeaks= cms.bool(False) +process.totemTimingRecHits.timingCalibrationTag= cms.string('GlobalTag:DiamondSampicCalibration') +################ +#geometry +################ +process.load('Geometry.VeryForwardGeometry.geometryRPFromDD_2021_cfi') + +process.load("CalibPPS.TimingCalibration.PPSDiamondSampicTimingCalibrationPCLWorker_cfi") +process.DQMStore = cms.Service("DQMStore") + +process.dqmOutput = cms.OutputModule("DQMRootOutputModule", + fileName = cms.untracked.string("worker_output.root") +) + + +process.path = cms.Path( + process.totemTimingRawToDigi* + process.diamondSampicLocalReconstruction* + process.PPSDiamondSampicTimingCalibrationPCLWorker +) + +process.end_path = cms.EndPath( + process.dqmOutput +) + +process.schedule = cms.Schedule( + process.path, + process.end_path +) diff --git a/CalibPPS/TimingCalibration/test/runDiamondSampicCalibration b/CalibPPS/TimingCalibration/test/runDiamondSampicCalibration new file mode 100755 index 0000000000000..3c8c617d6009a --- /dev/null +++ b/CalibPPS/TimingCalibration/test/runDiamondSampicCalibration @@ -0,0 +1,7 @@ +#!/bin/bash + +#---------------------------------------------------------------------------------------------------- + +cmsRun DiamondSampicCalibrationWorker_cfg.py &> log_DiamondSampicCalibrationWorker.log & +wait +cmsRun DiamondSampicCalibrationHarvester_cfg.py &> log_DiamondSampicCalibrationHarvester.log & diff --git a/CalibTracker/Configuration/python/Tracker_DependentRecords_forGlobalTag_nofakes_cff.py b/CalibTracker/Configuration/python/Tracker_DependentRecords_forGlobalTag_nofakes_cff.py index 90cef7dd880b8..51f4de06462d5 100644 --- a/CalibTracker/Configuration/python/Tracker_DependentRecords_forGlobalTag_nofakes_cff.py +++ b/CalibTracker/Configuration/python/Tracker_DependentRecords_forGlobalTag_nofakes_cff.py @@ -45,3 +45,6 @@ tag = cms.string("") ) ) + +# Multiple scattering parametrisation +from RecoTracker.TkMSParametrization.multipleScatteringParametrisationMakerESProducer_cfi import * diff --git a/CalibTracker/SiPixelConnectivity/test/SiPixelFedCablingMapWriter_cfg.py b/CalibTracker/SiPixelConnectivity/test/SiPixelFedCablingMapWriter_cfg.py index 2720fb38a2c02..0be7eb390f9f9 100644 --- a/CalibTracker/SiPixelConnectivity/test/SiPixelFedCablingMapWriter_cfg.py +++ b/CalibTracker/SiPixelConnectivity/test/SiPixelFedCablingMapWriter_cfg.py @@ -3,7 +3,6 @@ process = cms.Process("MapWriter") process.load("CondCore.DBCommon.CondDBCommon_cfi") -#process.load("Configuration.StandardSequences.Geometry_cff") process.load("Configuration.StandardSequences.GeometryDB_cff") process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff") diff --git a/CalibTracker/SiPixelESProducers/interface/SiPixelCPEGenericDBErrorParametrization.h b/CalibTracker/SiPixelESProducers/interface/SiPixelCPEGenericDBErrorParametrization.h deleted file mode 100644 index d23f85ef7d52b..0000000000000 --- a/CalibTracker/SiPixelESProducers/interface/SiPixelCPEGenericDBErrorParametrization.h +++ /dev/null @@ -1,71 +0,0 @@ -#ifndef CalibTracker_SiPixelESProducers_SiPixelDBErrorParametrization_h -#define CalibTracker_SiPixelESProducers_SiPixelDBErrorParametrization_h - -#include -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/Framework/interface/ESHandle.h" -#include "Geometry/CommonDetUnit/interface/GeomDetType.h" -#include "CondFormats/SiPixelObjects/interface/SiPixelCPEGenericErrorParm.h" - -class SiPixelCPEGenericDBErrorParametrization { -public: - SiPixelCPEGenericDBErrorParametrization(); - ~SiPixelCPEGenericDBErrorParametrization(); - - void setDBAccess(const edm::EventSetup& es); - - std::pair getError(const SiPixelCPEGenericErrorParm* parmErrors, - GeomDetType::SubDetector pixelPart, - int sizex, - int sizey, - float alpha, - float beta, - bool bigInX = false, - bool bigInY = false); - - std::pair getError(GeomDetType::SubDetector pixelPart, - int sizex, - int sizey, - float alpha, - float beta, - bool bigInX = false, - bool bigInY = false); - - float index(int ind_subpart, int size, float alpha, float beta, bool big); - -private: - edm::ESHandle errorsH; - - static const float bx_a_min[3]; - static const float bx_a_max[3]; - - static const float fx_a_min[2]; - static const float fx_a_max[2]; - static const float fx_b_min[2]; - static const float fx_b_max[2]; - - static const float by_a_min[6]; - static const float by_a_max[6]; - static const float by_b_min[6]; - static const float by_b_max[6]; - - static const float fy_a_min[2]; - static const float fy_a_max[2]; - static const float fy_b_min[2]; - static const float fy_b_max[2]; - - static const float errors_big_pix[4]; - static const int size_max[4]; - - static const int part_bin_size[4]; - static const int size_bin_size[4]; - static const int alpha_bin_size[4]; - static const int beta_bin_size[4]; - - static const float* a_min[4]; - static const float* a_max[4]; - static const float* b_min[4]; - static const float* b_max[4]; -}; -#endif diff --git a/CalibTracker/SiPixelESProducers/interface/SiPixelDetInfoFileWriter.h b/CalibTracker/SiPixelESProducers/interface/SiPixelDetInfoFileWriter.h index fb44a80d783ea..9bc6284489a67 100644 --- a/CalibTracker/SiPixelESProducers/interface/SiPixelDetInfoFileWriter.h +++ b/CalibTracker/SiPixelESProducers/interface/SiPixelDetInfoFileWriter.h @@ -18,14 +18,14 @@ // // -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" #include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" #include #include #include -class SiPixelDetInfoFileWriter : public edm::EDAnalyzer { +class SiPixelDetInfoFileWriter : public edm::one::EDAnalyzer { public: explicit SiPixelDetInfoFileWriter(const edm::ParameterSet &); ~SiPixelDetInfoFileWriter() override; @@ -34,6 +34,7 @@ class SiPixelDetInfoFileWriter : public edm::EDAnalyzer { void beginJob() override; void beginRun(const edm::Run &, const edm::EventSetup &) override; void analyze(const edm::Event &, const edm::EventSetup &) override; + void endRun(const edm::Run &, const edm::EventSetup &) override{}; private: edm::ESGetToken trackerGeomTokenBeginRun_; diff --git a/CalibTracker/SiPixelESProducers/interface/SiPixelFakeCPEGenericErrorParmESSource.h b/CalibTracker/SiPixelESProducers/interface/SiPixelFakeCPEGenericErrorParmESSource.h deleted file mode 100644 index abe5ebbaee2e1..0000000000000 --- a/CalibTracker/SiPixelESProducers/interface/SiPixelFakeCPEGenericErrorParmESSource.h +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef CalibTracker_SiPixelESProducers_SiPixelFakeCPEGenericErrorParmESSource_h -#define CalibTracker_SiPixelESProducers_SiPixelFakeCPEGenericErrorParmESSource_h - -#include - -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/Framework/interface/ESProducer.h" -#include "FWCore/Framework/interface/EventSetupRecordIntervalFinder.h" -#include "CondFormats/SiPixelObjects/interface/SiPixelCPEGenericErrorParm.h" -#include "CondFormats/DataRecord/interface/SiPixelCPEGenericErrorParmRcd.h" - -class SiPixelFakeCPEGenericErrorParmESSource : public edm::ESProducer, public edm::EventSetupRecordIntervalFinder { -public: - SiPixelFakeCPEGenericErrorParmESSource(const edm::ParameterSet &); - ~SiPixelFakeCPEGenericErrorParmESSource() override; - - virtual std::unique_ptr produce(const SiPixelCPEGenericErrorParmRcd &); - -protected: - void setIntervalFor(const edm::eventsetup::EventSetupRecordKey &, - const edm::IOVSyncValue &, - edm::ValidityInterval &) override; - -private: - edm::FileInPath fp_; - double version_; -}; -#endif diff --git a/CalibTracker/SiPixelESProducers/plugins/SealModules.cc b/CalibTracker/SiPixelESProducers/plugins/SealModules.cc index c826151ef9f7d..1bb76c57745e0 100644 --- a/CalibTracker/SiPixelESProducers/plugins/SealModules.cc +++ b/CalibTracker/SiPixelESProducers/plugins/SealModules.cc @@ -10,7 +10,6 @@ #include "CalibTracker/SiPixelESProducers/interface/SiPixelFakeGainOfflineESSource.h" #include "CalibTracker/SiPixelESProducers/interface/SiPixelFakeLorentzAngleESSource.h" #include "CalibTracker/SiPixelESProducers/interface/SiPixelDetInfoFileWriter.h" -#include "CalibTracker/SiPixelESProducers/interface/SiPixelFakeCPEGenericErrorParmESSource.h" #include "CalibTracker/SiPixelESProducers/interface/SiPixelFakeTemplateDBObjectESSource.h" #include "CalibTracker/SiPixelESProducers/interface/SiPixelFakeQualityESSource.h" @@ -19,6 +18,5 @@ DEFINE_FWK_EVENTSETUP_SOURCE(SiPixelFakeGainForHLTESSource); DEFINE_FWK_EVENTSETUP_SOURCE(SiPixelFakeGainOfflineESSource); DEFINE_FWK_EVENTSETUP_SOURCE(SiPixelFakeLorentzAngleESSource); DEFINE_FWK_EVENTSETUP_SOURCE(SiPixelFakeQualityESSource); -DEFINE_FWK_EVENTSETUP_SOURCE(SiPixelFakeCPEGenericErrorParmESSource); DEFINE_FWK_EVENTSETUP_SOURCE(SiPixelFakeTemplateDBObjectESSource); DEFINE_FWK_MODULE(SiPixelDetInfoFileWriter); diff --git a/CalibTracker/SiPixelESProducers/plugins/SiPixelFakeCPEGenericErrorParmESSource.cc b/CalibTracker/SiPixelESProducers/plugins/SiPixelFakeCPEGenericErrorParmESSource.cc deleted file mode 100644 index 7f0b7b58ba901..0000000000000 --- a/CalibTracker/SiPixelESProducers/plugins/SiPixelFakeCPEGenericErrorParmESSource.cc +++ /dev/null @@ -1,30 +0,0 @@ -#include "CalibTracker/SiPixelESProducers/interface/SiPixelFakeCPEGenericErrorParmESSource.h" -#include "FWCore/MessageLogger/interface/MessageLogger.h" - -SiPixelFakeCPEGenericErrorParmESSource::SiPixelFakeCPEGenericErrorParmESSource(const edm::ParameterSet& conf_) - : fp_(conf_.getParameter("file")), version_(conf_.getParameter("version")) { - edm::LogInfo("SiPixelFakeCPEGenericErrorParmESSource::SiPixelFakeCPEGenericErrorParmESSource"); - //the following line is needed to tell the framework what - // data is being produced - setWhatProduced(this); - findingRecord(); -} - -SiPixelFakeCPEGenericErrorParmESSource::~SiPixelFakeCPEGenericErrorParmESSource() {} - -std::unique_ptr SiPixelFakeCPEGenericErrorParmESSource::produce( - const SiPixelCPEGenericErrorParmRcd&) { - using namespace edm::es; - SiPixelCPEGenericErrorParm* obj = new SiPixelCPEGenericErrorParm(); - obj->fillCPEGenericErrorParm(version_, fp_.fullPath()); - //std::cout << *obj << std::endl; - - return std::unique_ptr(obj); -} - -void SiPixelFakeCPEGenericErrorParmESSource::setIntervalFor(const edm::eventsetup::EventSetupRecordKey&, - const edm::IOVSyncValue& iosv, - edm::ValidityInterval& oValidity) { - edm::ValidityInterval infinity(iosv.beginOfTime(), iosv.endOfTime()); - oValidity = infinity; -} diff --git a/CalibTracker/SiPixelESProducers/plugins/SiPixelGenErrorDBObjectESProducer.cc b/CalibTracker/SiPixelESProducers/plugins/SiPixelGenErrorDBObjectESProducer.cc index 4f3303c817ed1..ddaf98f31268f 100644 --- a/CalibTracker/SiPixelESProducers/plugins/SiPixelGenErrorDBObjectESProducer.cc +++ b/CalibTracker/SiPixelESProducers/plugins/SiPixelGenErrorDBObjectESProducer.cc @@ -48,18 +48,9 @@ SiPixelGenErrorDBObjectESProducer::SiPixelGenErrorDBObjectESProducer(const edm:: const float theMagField = iMagfield->inTesla(center).mag(); if (theMagField >= -0.1 && theMagField < 1.0) return get("", "0T"); - else if (theMagField >= 1.0 && theMagField < 2.5) - return get("", "2T"); - else if (theMagField >= 2.5 && theMagField < 3.25) - return get("", "3T"); - else if (theMagField >= 3.25 && theMagField < 3.65) - return get("", "35T"); - else if (theMagField >= 3.9 && theMagField < 4.1) - return get("", "4T"); else { - if (theMagField >= 4.1 || theMagField < -0.1) + if (theMagField >= 3.9 || theMagField < 3.65) edm::LogWarning("UnexpectedMagneticFieldUsingDefaultPixelGenError") << "Magnetic field is " << theMagField; - //return get("", "3.8T"); return get("", ""); } }, diff --git a/CalibTracker/SiPixelESProducers/plugins/SiPixelTemplateDBObjectESProducer.cc b/CalibTracker/SiPixelESProducers/plugins/SiPixelTemplateDBObjectESProducer.cc index 6680121239cf7..5586ec5840149 100644 --- a/CalibTracker/SiPixelESProducers/plugins/SiPixelTemplateDBObjectESProducer.cc +++ b/CalibTracker/SiPixelESProducers/plugins/SiPixelTemplateDBObjectESProducer.cc @@ -49,18 +49,9 @@ SiPixelTemplateDBObjectESProducer::SiPixelTemplateDBObjectESProducer(const edm:: const float theMagField = iMagfield->inTesla(center).mag(); if (theMagField >= -0.1 && theMagField < 1.0) return get("", "0T"); - else if (theMagField >= 1.0 && theMagField < 2.5) - return get("", "2T"); - else if (theMagField >= 2.5 && theMagField < 3.25) - return get("", "3T"); - else if (theMagField >= 3.25 && theMagField < 3.65) - return get("", "35T"); - else if (theMagField >= 3.9 && theMagField < 4.1) - return get("", "4T"); else { - if (theMagField >= 4.1 || theMagField < -0.1) + if (theMagField >= 3.9 || theMagField < 3.65) edm::LogWarning("UnexpectedMagneticFieldUsingDefaultPixelTemplate") << "Magnetic field is " << theMagField; - //return get("", "3.8T"); return get("", ""); } }, diff --git a/CalibTracker/SiPixelESProducers/python/SiPixelFakeCPEGenericErrorParmESSource_cfi.py b/CalibTracker/SiPixelESProducers/python/SiPixelFakeCPEGenericErrorParmESSource_cfi.py deleted file mode 100644 index 2298651c0978d..0000000000000 --- a/CalibTracker/SiPixelESProducers/python/SiPixelFakeCPEGenericErrorParmESSource_cfi.py +++ /dev/null @@ -1,8 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -SiPixelFakeCPEGenericErrorParmESSource = cms.ESSource("SiPixelFakeCPEGenericErrorParmESSource", - file = cms.FileInPath('RecoLocalTracker/SiPixelRecHits/data/residuals.dat'), - version = cms.double(1) -) - - diff --git a/CalibTracker/SiPixelESProducers/src/SiPixelCPEGenericDBErrorParametrization.cc b/CalibTracker/SiPixelESProducers/src/SiPixelCPEGenericDBErrorParametrization.cc deleted file mode 100644 index d4006bb7c2fb3..0000000000000 --- a/CalibTracker/SiPixelESProducers/src/SiPixelCPEGenericDBErrorParametrization.cc +++ /dev/null @@ -1,186 +0,0 @@ -#include "CalibTracker/SiPixelESProducers/interface/SiPixelCPEGenericDBErrorParametrization.h" -#include "CondFormats/DataRecord/interface/SiPixelCPEGenericErrorParmRcd.h" -#include -#include - -const float math_pi = 3.14159265; - -//These are the bin parameters -- they determine the width of the bins -//998, 999 refer to bins where the 0 should always be returned -const float SiPixelCPEGenericDBErrorParametrization::bx_a_min[3] = {1.525, 1.475, 1.425}; -const float SiPixelCPEGenericDBErrorParametrization::bx_a_max[3] = {1.725, 1.675, 1.625}; - -const float SiPixelCPEGenericDBErrorParametrization::fx_a_min[2] = {0.165, 0.185}; -const float SiPixelCPEGenericDBErrorParametrization::fx_a_max[2] = {0.285, 0.465}; -const float SiPixelCPEGenericDBErrorParametrization::fx_b_min[2] = {998, 998}; -const float SiPixelCPEGenericDBErrorParametrization::fx_b_max[2] = {999, 999}; - -const float SiPixelCPEGenericDBErrorParametrization::by_a_min[6] = { - 1.47078, 1.47078, 1.47078, 1.47078, 1.47078, 1.47078}; -const float SiPixelCPEGenericDBErrorParametrization::by_a_max[6] = { - 1.67078, 1.67078, 1.67078, 1.67078, 1.67078, 1.67078}; -const float SiPixelCPEGenericDBErrorParametrization::by_b_min[6] = {0.05, 0.15, 0.70, 0.95, 1.15, 1.20}; -const float SiPixelCPEGenericDBErrorParametrization::by_b_max[6] = {0.50, 0.90, 1.05, 1.15, 1.20, 1.40}; - -const float SiPixelCPEGenericDBErrorParametrization::fy_a_min[2] = {998, 998}; -const float SiPixelCPEGenericDBErrorParametrization::fy_a_max[2] = {999, 999}; -const float SiPixelCPEGenericDBErrorParametrization::fy_b_min[2] = {0.31, 0.31}; -const float SiPixelCPEGenericDBErrorParametrization::fy_b_max[2] = {0.39, 0.39}; - -//Constants based on subpart -const float SiPixelCPEGenericDBErrorParametrization::errors_big_pix[4] = {0.0070, 0.0030, 0.0068, 0.0040}; -const int SiPixelCPEGenericDBErrorParametrization::size_max[4] = {5, 2, 0, 0}; - -//Garbage is set to hold a place for bx_b, though we don't parametrize it the same way -const float garbage[1] = {-9999.99}; - -const float* SiPixelCPEGenericDBErrorParametrization::a_min[4] = {by_a_min, bx_a_min, fy_a_min, fx_a_min}; -const float* SiPixelCPEGenericDBErrorParametrization::a_max[4] = {by_a_max, bx_a_max, fy_a_max, fx_a_max}; -const float* SiPixelCPEGenericDBErrorParametrization::b_min[4] = {by_b_min, garbage, fy_b_min, fx_b_min}; -const float* SiPixelCPEGenericDBErrorParametrization::b_max[4] = {by_b_max, garbage, fy_b_max, fx_b_max}; - -//Bin Sizes -const int SiPixelCPEGenericDBErrorParametrization::part_bin_size[4] = {0, 240, 360, 380}; -const int SiPixelCPEGenericDBErrorParametrization::size_bin_size[4] = {40, 40, 40, 40}; -const int SiPixelCPEGenericDBErrorParametrization::alpha_bin_size[4] = {10, 1, 10, 1}; -const int SiPixelCPEGenericDBErrorParametrization::beta_bin_size[4] = {1, 10, 1, 10}; - -SiPixelCPEGenericDBErrorParametrization::SiPixelCPEGenericDBErrorParametrization() {} - -SiPixelCPEGenericDBErrorParametrization::~SiPixelCPEGenericDBErrorParametrization() {} - -void SiPixelCPEGenericDBErrorParametrization::setDBAccess(const edm::EventSetup& es) { - es.get().get(errorsH); -} - -//The function which is called to return errX and errY. Used in CPEs. -std::pair SiPixelCPEGenericDBErrorParametrization::getError(const SiPixelCPEGenericErrorParm* parmErrors, - GeomDetType::SubDetector pixelPart, - int sizex, - int sizey, - float alpha, - float beta, - bool bigInX, - bool bigInY) { - std::pair element; - std::pair errors; - - if (!GeomDetEnumerators::isTrackerPixel(pixelPart)) - throw cms::Exception("PixelCPEGenericDBErrorParametrization::getError") << "Non-pixel detector type !!!"; - if (GeomDetEnumerators::isBarrel(pixelPart)) { - element = std::pair(index(1, sizex, alpha, beta, bigInX), //1 -- Bx - index(0, sizey, alpha, beta, bigInY)); //0 -- By - } else { - element = std::pair(index(3, sizex, alpha, beta, bigInX), //3 -- Fx - index(2, sizey, alpha, beta, bigInY)); //2 -- Fy - } - - if (bigInX && sizex == 1) - errors.first = element.first; - else - errors.first = parmErrors->errors()[(int)element.first].sigma; - if (bigInY && sizey == 1) - errors.second = element.second; - else - errors.second = parmErrors->errors()[(int)element.second].sigma; - - return errors; -} - -//The function which is called to return errX and errY. Used outside CPEs with access to ES. -std::pair SiPixelCPEGenericDBErrorParametrization::getError( - GeomDetType::SubDetector pixelPart, int sizex, int sizey, float alpha, float beta, bool bigInX, bool bigInY) { - std::pair element; - std::pair errors; - - if (!GeomDetEnumerators::isTrackerPixel(pixelPart)) - throw cms::Exception("PixelCPEGenericDBErrorParametrization::getError") << "Non-pixel detector type !!!"; - if (GeomDetEnumerators::isBarrel(pixelPart)) { - element = std::pair(index(1, sizex, alpha, beta, bigInX), //1 -- Bx - index(0, sizey, alpha, beta, bigInY)); //0 -- By - } else { - element = std::pair(index(3, sizex, alpha, beta, bigInX), //3 -- Fx - index(2, sizey, alpha, beta, bigInY)); //2 -- Fy - } - - if (bigInX && sizex == 1) - errors.first = element.first; - else - errors.first = errorsH->errors()[(int)element.first].sigma; - if (bigInY && sizey == 1) - errors.second = element.second; - else - errors.second = errorsH->errors()[(int)element.second].sigma; - - return errors; -} - -float SiPixelCPEGenericDBErrorParametrization::index(int ind_subpart, int size, float alpha, float beta, bool big) { - //This is a check for big pixels. If it passes, the code returns a given error and the function ends. - if (big && size == 1) - return errors_big_pix[ind_subpart]; - - int ind_size = std::min(size - 1, size_max[ind_subpart]); - - float alpha_rad = -999.9; - float betap_rad = -999.9; - - int ind_alpha = -99; - int ind_beta = -99; - - float binw_a = -999.9; - float binw_b = -999.9; - int maxbin_a = -99; - int maxbin_b = -99; - - betap_rad = fabs(math_pi / 2.0 - beta); - //We must take into account that Fx(subpart=3) has different alpha parametrization - if (ind_subpart == 3) - alpha_rad = fabs(math_pi / 2.0 - alpha); - else - alpha_rad = fabs(alpha); - - //Sets the correct binning for alpha and beta based on whether in x or y - if (ind_subpart == 0 || ind_subpart == 2) { - binw_a = (a_max[ind_subpart][ind_size] - a_min[ind_subpart][ind_size]) / 2.0; - binw_b = (b_max[ind_subpart][ind_size] - b_min[ind_subpart][ind_size]) / 8.0; - maxbin_a = 3; - maxbin_b = 9; - } else { - binw_a = (a_max[ind_subpart][ind_size] - a_min[ind_subpart][ind_size]) / 8.0; - binw_b = (b_max[ind_subpart][ind_size] - b_min[ind_subpart][ind_size]) / 2.0; - maxbin_a = 3; - maxbin_b = 9; - } - - //Binning for alpha - if (alpha_rad < a_min[ind_subpart][ind_size]) - ind_alpha = 0; - else if (alpha_rad >= a_max[ind_subpart][ind_size]) - ind_alpha = maxbin_a; - else - ind_alpha = 1 + (int)((alpha_rad - a_min[ind_subpart][ind_size]) / binw_a); - - //Binning for beta -- we need to account for Bx(subpart=1) having uneven binning - if (ind_subpart == 1) { - if (betap_rad <= 0.7) - ind_beta = 0; - else if (0.7 < betap_rad && betap_rad <= 1.0) - ind_beta = 1; - else if (1.0 < betap_rad && betap_rad <= 1.2) - ind_beta = 2; - else if (1.2 <= betap_rad) - ind_beta = 3; - } else if (betap_rad < b_min[ind_subpart][ind_size]) - ind_beta = 0; - else if (betap_rad >= b_max[ind_subpart][ind_size]) - ind_beta = maxbin_b; - else - ind_beta = 1 + (int)((betap_rad - b_min[ind_subpart][ind_size]) / binw_b); - - //Index to be used to find error in database - int index = part_bin_size[ind_subpart] + size_bin_size[ind_subpart] * ind_size + - alpha_bin_size[ind_subpart] * ind_alpha + beta_bin_size[ind_subpart] * ind_beta; - - return index; -} diff --git a/CalibTracker/SiPixelESProducers/test/SiPixelFakeGainForHLTReader.cc b/CalibTracker/SiPixelESProducers/test/SiPixelFakeGainForHLTReader.cc index fe4faf22ab232..3cf452db8019e 100644 --- a/CalibTracker/SiPixelESProducers/test/SiPixelFakeGainForHLTReader.cc +++ b/CalibTracker/SiPixelESProducers/test/SiPixelFakeGainForHLTReader.cc @@ -67,6 +67,8 @@ namespace cms { fFile->Close(); } + void SiPixelFakeGainForHLTReader::endRun(const edm::Run& run, const edm::EventSetup& iSetup) {} + // ---------------------------------------------------------------------- void SiPixelFakeGainForHLTReader::beginRun(const edm::Run& run, const edm::EventSetup& iSetup) { static int first(1); diff --git a/CalibTracker/SiPixelESProducers/test/SiPixelFakeGainForHLTReader.h b/CalibTracker/SiPixelESProducers/test/SiPixelFakeGainForHLTReader.h index d448ea799ac96..17f06edc7d653 100644 --- a/CalibTracker/SiPixelESProducers/test/SiPixelFakeGainForHLTReader.h +++ b/CalibTracker/SiPixelESProducers/test/SiPixelFakeGainForHLTReader.h @@ -18,7 +18,7 @@ // // #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" #include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" @@ -31,15 +31,15 @@ #include "TH1F.h" namespace cms { - class SiPixelFakeGainForHLTReader : public edm::EDAnalyzer { + class SiPixelFakeGainForHLTReader : public edm::one::EDAnalyzer { public: explicit SiPixelFakeGainForHLTReader(const edm::ParameterSet& iConfig); ~SiPixelFakeGainForHLTReader(){}; - virtual void beginJob() { ; } - virtual void beginRun(const edm::Run&, const edm::EventSetup&); - virtual void analyze(const edm::Event&, const edm::EventSetup&); - virtual void endJob(); + virtual void beginRun(const edm::Run&, const edm::EventSetup&) override; + virtual void endRun(const edm::Run&, const edm::EventSetup&) override; + virtual void analyze(const edm::Event&, const edm::EventSetup&) override; + virtual void endJob() override; private: edm::ParameterSet conf_; diff --git a/CalibTracker/SiPixelESProducers/test/SiPixelFakeGainOfflineReader.cc b/CalibTracker/SiPixelESProducers/test/SiPixelFakeGainOfflineReader.cc index 3355ee420c123..657ce5e426b38 100644 --- a/CalibTracker/SiPixelESProducers/test/SiPixelFakeGainOfflineReader.cc +++ b/CalibTracker/SiPixelESProducers/test/SiPixelFakeGainOfflineReader.cc @@ -70,8 +70,7 @@ namespace cms { fFile->Close(); } - // ------------ method called once each job just before starting event loop ------------ - void SiPixelFakeGainOfflineReader::beginJob() {} + void SiPixelFakeGainOfflineReader::endRun(const edm::Run& run, const edm::EventSetup& iSetup) {} // ------------ method called once each job just before starting event loop ------------ void SiPixelFakeGainOfflineReader::beginRun(const edm::Run& run, const edm::EventSetup& iSetup) { diff --git a/CalibTracker/SiPixelESProducers/test/SiPixelFakeGainOfflineReader.h b/CalibTracker/SiPixelESProducers/test/SiPixelFakeGainOfflineReader.h index 4a8f1753bef09..4f5e3a3732c0c 100644 --- a/CalibTracker/SiPixelESProducers/test/SiPixelFakeGainOfflineReader.h +++ b/CalibTracker/SiPixelESProducers/test/SiPixelFakeGainOfflineReader.h @@ -18,7 +18,7 @@ // // #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" #include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" @@ -31,15 +31,15 @@ #include "TH1F.h" namespace cms { - class SiPixelFakeGainOfflineReader : public edm::EDAnalyzer { + class SiPixelFakeGainOfflineReader : public edm::one::EDAnalyzer { public: explicit SiPixelFakeGainOfflineReader(const edm::ParameterSet& iConfig); ~SiPixelFakeGainOfflineReader(){}; - virtual void beginJob(); - virtual void beginRun(const edm::Run&, const edm::EventSetup&); - virtual void analyze(const edm::Event&, const edm::EventSetup&); - virtual void endJob(); + virtual void beginRun(const edm::Run&, const edm::EventSetup&) override; + virtual void endRun(const edm::Run&, const edm::EventSetup&) override; + virtual void analyze(const edm::Event&, const edm::EventSetup&) override; + virtual void endJob() override; private: edm::ParameterSet conf_; diff --git a/CalibTracker/SiPixelESProducers/test/SiPixelFakeGainReader.cc b/CalibTracker/SiPixelESProducers/test/SiPixelFakeGainReader.cc index 0b03f4d89f011..ef9f4d28c7c02 100644 --- a/CalibTracker/SiPixelESProducers/test/SiPixelFakeGainReader.cc +++ b/CalibTracker/SiPixelESProducers/test/SiPixelFakeGainReader.cc @@ -71,8 +71,7 @@ namespace cms { fFile->Close(); } - // ------------ method called once each job just before starting event loop ------------ - void SiPixelFakeGainReader::beginJob() {} + void SiPixelFakeGainReader::endRun(const edm::Run& run, const edm::EventSetup& iSetup) {} // ------------ method called once each job just before starting event loop ------------ void SiPixelFakeGainReader::beginRun(const edm::Run& run, const edm::EventSetup& iSetup) { diff --git a/CalibTracker/SiPixelESProducers/test/SiPixelFakeGainReader.h b/CalibTracker/SiPixelESProducers/test/SiPixelFakeGainReader.h index 3b72d11eca08c..6a08b1cbb555d 100644 --- a/CalibTracker/SiPixelESProducers/test/SiPixelFakeGainReader.h +++ b/CalibTracker/SiPixelESProducers/test/SiPixelFakeGainReader.h @@ -18,7 +18,7 @@ // // #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" #include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" @@ -31,15 +31,15 @@ #include "TH1F.h" namespace cms { - class SiPixelFakeGainReader : public edm::EDAnalyzer { + class SiPixelFakeGainReader : public edm::one::EDAnalyzer { public: explicit SiPixelFakeGainReader(const edm::ParameterSet& iConfig); ~SiPixelFakeGainReader(){}; - virtual void beginJob(); - virtual void beginRun(const edm::Run&, const edm::EventSetup&); - virtual void analyze(const edm::Event&, const edm::EventSetup&); - virtual void endJob(); + virtual void beginRun(const edm::Run&, const edm::EventSetup&) override; + virtual void endRun(const edm::Run&, const edm::EventSetup&) override; + virtual void analyze(const edm::Event&, const edm::EventSetup&) override; + virtual void endJob() override; private: edm::ParameterSet conf_; diff --git a/CalibTracker/SiPixelErrorEstimation/interface/SiPixelErrorEstimation.h b/CalibTracker/SiPixelErrorEstimation/interface/SiPixelErrorEstimation.h index 2dee8aceba9a3..90eea1b17e323 100644 --- a/CalibTracker/SiPixelErrorEstimation/interface/SiPixelErrorEstimation.h +++ b/CalibTracker/SiPixelErrorEstimation/interface/SiPixelErrorEstimation.h @@ -1,4 +1,3 @@ - #ifndef CalibTracker_SiPixelerrorEstimation_SiPixelErrorEstimation_h #define CalibTracker_SiPixelerrorEstimation_SiPixelErrorEstimation_h @@ -6,7 +5,7 @@ // user include files #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" @@ -60,7 +59,7 @@ class TTree; class TFile; -class SiPixelErrorEstimation : public edm::EDAnalyzer { +class SiPixelErrorEstimation : public edm::one::EDAnalyzer<> { public: explicit SiPixelErrorEstimation(const edm::ParameterSet&); ~SiPixelErrorEstimation() override; diff --git a/CalibTracker/SiPixelLorentzAngle/BuildFile.xml b/CalibTracker/SiPixelLorentzAngle/BuildFile.xml index 28ad08af08f7b..d01ba32f1258e 100644 --- a/CalibTracker/SiPixelLorentzAngle/BuildFile.xml +++ b/CalibTracker/SiPixelLorentzAngle/BuildFile.xml @@ -8,5 +8,9 @@ + + + + diff --git a/CalibTracker/SiPixelLorentzAngle/interface/SiPixelLorentzAngleCalibrationStruct.h b/CalibTracker/SiPixelLorentzAngle/interface/SiPixelLorentzAngleCalibrationStruct.h new file mode 100644 index 0000000000000..9f9be5aca4604 --- /dev/null +++ b/CalibTracker/SiPixelLorentzAngle/interface/SiPixelLorentzAngleCalibrationStruct.h @@ -0,0 +1,35 @@ +#ifndef CalibTracker_SiPixelLorentzAngle_SiPixelLorentzAngleCalibrationStruct_h +#define CalibTracker_SiPixelLorentzAngle_SiPixelLorentzAngleCalibrationStruct_h + +#include "DQMServices/Core/interface/DQMStore.h" +#include + +struct SiPixelLorentzAngleCalibrationHistograms { +public: + SiPixelLorentzAngleCalibrationHistograms() = default; + + using MonitorMap = std::unordered_map; + + int nlay; + std::vector nModules_; + std::vector BPixnewmodulename_; + std::vector BPixnewDetIds_; + std::vector BPixnewModule_; + std::vector BPixnewLayer_; + + std::vector FPixnewmodulename_; + std::vector FPixnewDetIds_; + std::vector FPixnewDisk_; + std::vector FPixnewBlade_; + std::unordered_map > detIdsList; + + MonitorMap h_drift_depth_adc_; + MonitorMap h_drift_depth_adc2_; + MonitorMap h_drift_depth_noadc_; + MonitorMap h_drift_depth_; + MonitorMap h_mean_; + + dqm::reco::MonitorElement* h_tracks_; +}; + +#endif diff --git a/CalibTracker/SiPixelLorentzAngle/python/SiPixelLorentzAnglePCLHarvester_cfi.py b/CalibTracker/SiPixelLorentzAngle/python/SiPixelLorentzAnglePCLHarvester_cfi.py new file mode 100644 index 0000000000000..2e38b6cda3282 --- /dev/null +++ b/CalibTracker/SiPixelLorentzAngle/python/SiPixelLorentzAnglePCLHarvester_cfi.py @@ -0,0 +1,11 @@ +import FWCore.ParameterSet.Config as cms +from DQMServices.Core.DQMEDHarvester import DQMEDHarvester +from CalibTracker.SiPixelLorentzAngle.SiPixelLorentzAnglePCLWorker_cfi import SiPixelLorentzAnglePCLWorker as worker + +SiPixelLorentzAnglePCLHarvester = DQMEDHarvester( + "SiPixelLorentzAnglePCLHarvester", + newmodulelist = cms.vstring(worker.newmodulelist.value()), # taken from worker configuration, need to stay in synch + dqmDir = cms.string(worker.folder.value()), # taken from worker configuration, need to stay in synch + record = cms.string("SiPixelLorentzAngleRcd"), + fitProbCut = cms.double(0.5) +) diff --git a/CalibTracker/SiPixelLorentzAngle/python/SiPixelLorentzAnglePCLWorker_cfi.py b/CalibTracker/SiPixelLorentzAngle/python/SiPixelLorentzAnglePCLWorker_cfi.py new file mode 100644 index 0000000000000..8e6bc0611eaac --- /dev/null +++ b/CalibTracker/SiPixelLorentzAngle/python/SiPixelLorentzAnglePCLWorker_cfi.py @@ -0,0 +1,27 @@ +import FWCore.ParameterSet.Config as cms + +from DQMServices.Core.DQMEDAnalyzer import DQMEDAnalyzer +SiPixelLorentzAnglePCLWorker = DQMEDAnalyzer( + "SiPixelLorentzAnglePCLWorker", + folder = cms.string('AlCaReco/SiPixelLorentzAngle'), + notInPCL = cms.bool(False), + fileName = cms.string('testrun.root'), + newmodulelist = cms.vstring("BPix_BmI_SEC7_LYR2_LDR12F_MOD1", + "BPix_BmI_SEC8_LYR2_LDR14F_MOD1", + "BPix_BmO_SEC3_LYR2_LDR5F_MOD1", + "BPix_BmO_SEC3_LYR2_LDR5F_MOD2", + "BPix_BmO_SEC3_LYR2_LDR5F_MOD3", + "BPix_BpO_SEC1_LYR2_LDR1F_MOD1", + "BPix_BpO_SEC1_LYR2_LDR1F_MOD2", + "BPix_BpO_SEC1_LYR2_LDR1F_MOD3"), + src = cms.InputTag("TrackRefitter"), + binsDepth = cms.int32(50), + binsDrift = cms.int32(200), + ptMin = cms.double(3), + normChi2Max = cms.double(2), + clustSizeYMin = cms.int32(4), + clustSizeYMinL4 = cms.int32(3), + clustSizeXMax = cms.int32(5), + residualMax = cms.double(0.005), + clustChargeMaxPerLength = cms.double(50000) +) diff --git a/CalibTracker/SiPixelLorentzAngle/src/SiPixelLorentzAngle.cc b/CalibTracker/SiPixelLorentzAngle/src/SiPixelLorentzAngle.cc index 91711f8cfb253..02b1823fd6549 100644 --- a/CalibTracker/SiPixelLorentzAngle/src/SiPixelLorentzAngle.cc +++ b/CalibTracker/SiPixelLorentzAngle/src/SiPixelLorentzAngle.cc @@ -67,7 +67,7 @@ SiPixelLorentzAngle::SiPixelLorentzAngle(edm::ParameterSet const& conf) } // Virtual destructor needed. -SiPixelLorentzAngle::~SiPixelLorentzAngle() {} +SiPixelLorentzAngle::~SiPixelLorentzAngle() = default; void SiPixelLorentzAngle::beginJob() { // cout << "started SiPixelLorentzAngle" << endl; diff --git a/CalibTracker/SiPixelLorentzAngle/src/SiPixelLorentzAngle.h b/CalibTracker/SiPixelLorentzAngle/src/SiPixelLorentzAngle.h index 790e30588f5b4..f8982504b17a7 100644 --- a/CalibTracker/SiPixelLorentzAngle/src/SiPixelLorentzAngle.h +++ b/CalibTracker/SiPixelLorentzAngle/src/SiPixelLorentzAngle.h @@ -1,7 +1,7 @@ #ifndef CalibTracker_SiPixelLorentzAngle_SiPixelLorentzAngle_h #define CalibTracker_SiPixelLorentzAngle_SiPixelLorentzAngle_h -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "FWCore/Framework/interface/Event.h" #include "DataFormats/Common/interface/Handle.h" #include "FWCore/Framework/interface/EventSetup.h" @@ -80,12 +80,11 @@ struct Rechit { //SiPixelLorentzAngle is already the name of a data product namespace analyzer { - class SiPixelLorentzAngle : public edm::EDAnalyzer { + class SiPixelLorentzAngle : public edm::one::EDAnalyzer<> { public: explicit SiPixelLorentzAngle(const edm::ParameterSet &conf); ~SiPixelLorentzAngle() override; - //virtual void beginJob(const edm::EventSetup& c); void beginJob() override; void endJob() override; void analyze(const edm::Event &e, const edm::EventSetup &c) override; diff --git a/CalibTracker/SiPixelLorentzAngle/src/SiPixelLorentzAnglePCLHarvester.cc b/CalibTracker/SiPixelLorentzAngle/src/SiPixelLorentzAnglePCLHarvester.cc new file mode 100644 index 0000000000000..a4ee5adcf7cfc --- /dev/null +++ b/CalibTracker/SiPixelLorentzAngle/src/SiPixelLorentzAnglePCLHarvester.cc @@ -0,0 +1,474 @@ +#include +#include +#include + +#include "CalibTracker/SiPixelLorentzAngle/interface/SiPixelLorentzAngleCalibrationStruct.h" +#include "CondCore/DBOutputService/interface/PoolDBOutputService.h" +#include "CondFormats/DataRecord/interface/SiPixelLorentzAngleRcd.h" +#include "CondFormats/SiPixelObjects/interface/SiPixelLorentzAngle.h" +#include "DQMServices/Core/interface/DQMEDHarvester.h" +#include "DataFormats/TrackerCommon/interface/PixelBarrelName.h" +#include "DataFormats/TrackerCommon/interface/PixelEndcapName.h" +#include "FWCore/Framework/interface/EventSetup.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 "Geometry/Records/interface/TrackerDigiGeometryRecord.h" +#include "Geometry/TrackerGeometryBuilder/interface/PixelTopologyMap.h" +#include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" +#include "MagneticField/Engine/interface/MagneticField.h" +#include "MagneticField/Records/interface/IdealMagneticFieldRecord.h" + +//------------------------------------------------------------------------------ +class SiPixelLorentzAnglePCLHarvester : public DQMEDHarvester { +public: + SiPixelLorentzAnglePCLHarvester(const edm::ParameterSet&); + ~SiPixelLorentzAnglePCLHarvester() override = default; + void beginRun(const edm::Run&, const edm::EventSetup&) override; + + static void fillDescriptions(edm::ConfigurationDescriptions&); + +private: + void dqmEndJob(DQMStore::IBooker&, DQMStore::IGetter&) override; + void findMean(MonitorElement* h_drift_depth_adc_slice_, int i, int i_ring); + + // es tokens + edm::ESGetToken geomEsToken_; + edm::ESGetToken topoEsToken_; + edm::ESGetToken siPixelLAEsToken_; + edm::ESGetToken magneticFieldToken_; + + std::vector newmodulelist_; + const std::string dqmDir_; + const double fitProbCut_; + const std::string recordName_; + std::unique_ptr f1; + + SiPixelLorentzAngleCalibrationHistograms hists; + const SiPixelLorentzAngle* currentLorentzAngle; + const MagneticField* magField; +}; + +//------------------------------------------------------------------------------ +SiPixelLorentzAnglePCLHarvester::SiPixelLorentzAnglePCLHarvester(const edm::ParameterSet& iConfig) + : geomEsToken_(esConsumes()), + topoEsToken_(esConsumes()), + siPixelLAEsToken_(esConsumes()), + magneticFieldToken_(esConsumes()), + newmodulelist_(iConfig.getParameter>("newmodulelist")), + dqmDir_(iConfig.getParameter("dqmDir")), + fitProbCut_(iConfig.getParameter("fitProbCut")), + recordName_(iConfig.getParameter("record")) { + // first ensure DB output service is available + edm::Service poolDbService; + if (!poolDbService.isAvailable()) + throw cms::Exception("SiPixelLorentzAnglePCLHarvester") << "PoolDBService required"; +} + +//------------------------------------------------------------------------------ +void SiPixelLorentzAnglePCLHarvester::beginRun(const edm::Run& iRun, const edm::EventSetup& iSetup) { + // geometry + const TrackerGeometry* geom = &iSetup.getData(geomEsToken_); + const TrackerTopology* tTopo = &iSetup.getData(topoEsToken_); + + magField = &iSetup.getData(magneticFieldToken_); + currentLorentzAngle = &iSetup.getData(siPixelLAEsToken_); + + PixelTopologyMap map = PixelTopologyMap(geom, tTopo); + hists.nlay = geom->numberOfLayers(PixelSubdetector::PixelBarrel); + hists.nModules_.resize(hists.nlay); + for (int i = 0; i < hists.nlay; i++) { + hists.nModules_[i] = map.getPXBModules(i + 1); + } + + if (!newmodulelist_.empty()) { + for (auto const& modulename : newmodulelist_) { + if (modulename.find("BPix_") != std::string::npos) { + PixelBarrelName bn(modulename, true); + const auto& detId = bn.getDetId(tTopo); + hists.BPixnewmodulename_.push_back(modulename); + hists.BPixnewDetIds_.push_back(detId.rawId()); + hists.BPixnewModule_.push_back(bn.moduleName()); + hists.BPixnewLayer_.push_back(bn.layerName()); + } else if (modulename.find("FPix_") != std::string::npos) { + PixelEndcapName en(modulename, true); + const auto& detId = en.getDetId(tTopo); + hists.FPixnewmodulename_.push_back(modulename); + hists.FPixnewDetIds_.push_back(detId.rawId()); + hists.FPixnewDisk_.push_back(en.diskName()); + hists.FPixnewBlade_.push_back(en.bladeName()); + } + } + } + + std::vector treatedIndices; + + for (auto det : geom->detsPXB()) { + const PixelGeomDetUnit* pixelDet = dynamic_cast(det); + const auto& layer = tTopo->pxbLayer(pixelDet->geographicalId()); + const auto& module = tTopo->pxbModule(pixelDet->geographicalId()); + int i_index = module + (layer - 1) * hists.nModules_[layer - 1]; + + uint32_t rawId = pixelDet->geographicalId().rawId(); + + if (std::find(treatedIndices.begin(), treatedIndices.end(), i_index) != treatedIndices.end()) { + hists.detIdsList.at(i_index).push_back(rawId); + } else { + hists.detIdsList.insert(std::pair>(i_index, {rawId})); + treatedIndices.push_back(i_index); + } + } +} + +//------------------------------------------------------------------------------ +void SiPixelLorentzAnglePCLHarvester::dqmEndJob(DQMStore::IBooker& iBooker, DQMStore::IGetter& iGetter) { + // go in the right directory + iGetter.cd(); + iGetter.setCurrentFolder(dqmDir_); + + for (int i_layer = 1; i_layer <= hists.nlay; i_layer++) { + for (int i_module = 1; i_module <= hists.nModules_[i_layer - 1]; i_module++) { + int i_index = i_module + (i_layer - 1) * hists.nModules_[i_layer - 1]; + + hists.h_drift_depth_[i_index] = + iGetter.get(fmt::format("{}/h_drift_depth_layer{}_module{}", dqmDir_, i_layer, i_module)); + + if (hists.h_drift_depth_[i_index] == nullptr) { + edm::LogError("SiPixelLorentzAnglePCLHarvester::dqmEndJob") + << "Failed to retrieve electron drift over depth for layer " << i_layer << ", module " << i_module << "."; + continue; + } + + hists.h_drift_depth_adc_[i_index] = + iGetter.get(fmt::format("{}/h_drift_depth_adc_layer{}_module{}", dqmDir_, i_layer, i_module)); + + hists.h_drift_depth_adc2_[i_index] = + iGetter.get(fmt::format("{}/h_drift_depth_adc2_layer{}_module{}", dqmDir_, i_layer, i_module)); + + hists.h_drift_depth_noadc_[i_index] = + iGetter.get(fmt::format("{}/h_drift_depth_noadc_layer{}_module{}", dqmDir_, i_layer, i_module)); + + hists.h_mean_[i_index] = iGetter.get(fmt::format("{}/h_mean_layer{}_module{}", dqmDir_, i_layer, i_module)); + + hists.h_drift_depth_[i_index]->divide( + hists.h_drift_depth_adc_[i_index], hists.h_drift_depth_noadc_[i_index], 1., 1., ""); + } + } + + for (int i = 0; i < (int)hists.BPixnewDetIds_.size(); i++) { + int new_index = i + 1 + hists.nModules_[hists.nlay - 1] + (hists.nlay - 1) * hists.nModules_[hists.nlay - 1]; + + hists.h_drift_depth_adc_[new_index] = + iGetter.get(fmt::format("{}/h_BPixnew_drift_depth_{}", dqmDir_, hists.BPixnewmodulename_[i])); + + if (hists.h_drift_depth_adc_[new_index] == nullptr) { + edm::LogError("SiPixelLorentzAnglePCLHarvester::dqmEndJob") + << "Failed to retrieve electron drift over depth for new module " << hists.BPixnewmodulename_[i] << "."; + continue; + } + + hists.h_drift_depth_adc2_[new_index] = + iGetter.get(fmt::format("{}/h_BPixnew_drift_depth_adc_{}", dqmDir_, hists.BPixnewmodulename_[i])); + + hists.h_drift_depth_noadc_[new_index] = + iGetter.get(fmt::format("{}/h_BPixnew_drift_depth_adc2_{}", dqmDir_, hists.BPixnewmodulename_[i])); + + hists.h_drift_depth_[new_index] = + iGetter.get(fmt::format("{}/h_BPixnew_drift_depth_noadc_{}", dqmDir_, hists.BPixnewmodulename_[i])); + + hists.h_mean_[new_index] = iGetter.get(fmt::format("{}/h_BPixnew_mean_{}", dqmDir_, hists.BPixnewmodulename_[i])); + + hists.h_drift_depth_[new_index]->divide( + hists.h_drift_depth_adc_[new_index], hists.h_drift_depth_noadc_[new_index], 1., 1., ""); + } + + int hist_drift_; + int hist_depth_; + double min_drift_; + double max_drift_; + + if (hists.h_drift_depth_adc_[1] != nullptr) { + hist_drift_ = hists.h_drift_depth_adc_[1]->getNbinsX(); + hist_depth_ = hists.h_drift_depth_adc_[1]->getNbinsY(); + min_drift_ = hists.h_drift_depth_adc_[1]->getAxisMin(1); + max_drift_ = hists.h_drift_depth_adc_[1]->getAxisMax(1); + } else { + hist_drift_ = 200; + hist_depth_ = 50; + min_drift_ = -1000.; + max_drift_ = 1000.; + } + + iBooker.setCurrentFolder("AlCaReco/SiPixelLorentzAngleHarvesting/"); + MonitorElement* h_drift_depth_adc_slice_ = + iBooker.book1D("h_drift_depth_adc_slice", "slice of adc histogram", hist_drift_, min_drift_, max_drift_); + + // clang-format off + edm::LogPrint("LorentzAngle") << "module" << "\t" << "layer" << "\t" + << "offset" << "\t" << "e0" << "\t" + << "slope" << "\t" << "e1" << "\t" + << "rel.err" << "\t" << "pull" << "\t" + << "p2" << "\t" << "e2" << "\t" + << "p3" << "\t" << "e3" << "\t" + << "p4" << "\t" << "e4" << "\t" + << "p5" << "\t" << "e5" << "\t" + << "chi2" << "\t" << "prob" << "\t" + << "newDetId" << std::endl; + // clang-format on + + std::unique_ptr LorentzAngle = std::make_unique(); + + f1 = std::make_unique("f1", "[0] + [1]*x + [2]*x*x + [3]*x*x*x + [4]*x*x*x*x + [5]*x*x*x*x*x", 5., 280.); + f1->SetParName(0, "offset"); + f1->SetParName(1, "tan#theta_{LA}"); + f1->SetParName(2, "quad term"); + f1->SetParName(3, "cubic term"); + f1->SetParName(4, "quartic term"); + f1->SetParName(5, "quintic term"); + + double p1_simul_newmodule = 0.294044; + + for (int j = 0; j < (int)hists.BPixnewDetIds_.size(); j++) { + int new_index = j + 1 + hists.nModules_[hists.nlay - 1] + (hists.nlay - 1) * hists.nModules_[hists.nlay - 1]; + if (hists.h_drift_depth_adc_[new_index] == nullptr) + continue; + for (int i = 1; i <= hist_depth_; i++) { + findMean(h_drift_depth_adc_slice_, i, new_index); + } + + f1->SetParameter(0, 0); + f1->SetParError(0, 0); + f1->SetParameter(1, 0.4); + f1->SetParError(1, 0); + f1->SetParameter(2, 0.0); + f1->SetParError(2, 0); + f1->SetParameter(3, 0.0); + f1->SetParError(3, 0); + f1->SetParameter(4, 0.0); + f1->SetParError(4, 0); + f1->SetParameter(5, 0.0); + f1->SetParError(5, 0); + f1->SetChisquare(0); + + hists.h_mean_[new_index]->getTH1()->Fit(f1.get(), "ERQ"); + + double p0 = f1->GetParameter(0); + double e0 = f1->GetParError(0); + double p1 = f1->GetParameter(1); + double e1 = f1->GetParError(1); + double p2 = f1->GetParameter(2); + double e2 = f1->GetParError(2); + double p3 = f1->GetParameter(3); + double e3 = f1->GetParError(3); + double p4 = f1->GetParameter(4); + double e4 = f1->GetParError(4); + double p5 = f1->GetParameter(5); + double e5 = f1->GetParError(5); + double chi2 = f1->GetChisquare(); + double prob = f1->GetProb(); + + edm::LogPrint("LorentzAngle") << std::setprecision(4) << hists.BPixnewModule_[j] << "\t" << hists.BPixnewLayer_[j] + << "\t" << p0 << "\t" << e0 << "\t" << p1 << std::setprecision(3) << "\t" << e1 + << "\t" << e1 / p1 * 100. << "\t" << (p1 - p1_simul_newmodule) / e1 << "\t" << p2 + << "\t" << e2 << "\t" << p3 << "\t" << e3 << "\t" << p4 << "\t" << e4 << "\t" << p5 + << "\t" << e5 << "\t" << chi2 << "\t" << prob << "\t" << hists.BPixnewDetIds_[j] + << std::endl; + } + + double p1_simul[hists.nlay][hists.nModules_[hists.nlay - 1]]; + for (int i_layer = 1; i_layer <= hists.nlay; i_layer++) { + for (int i_module = 1; i_module <= hists.nModules_[i_layer - 1]; i_module++) { + if (i_layer == 1) + p1_simul[i_layer - 1][i_module - 1] = 0.436848; + else if (i_layer == 2) + p1_simul[i_layer - 1][i_module - 1] = 0.25802; + else if (i_layer == 3 && i_module <= 4) + p1_simul[i_layer - 1][i_module - 1] = 0.29374; + else if (i_layer == 3 && i_module >= 5) + p1_simul[i_layer - 1][i_module - 1] = 0.31084; + else if (i_layer == 4 && i_module <= 4) + p1_simul[i_layer - 1][i_module - 1] = 0.29944; + else + p1_simul[i_layer - 1][i_module - 1] = 0.31426; + } + } + + //loop over modlues and layers to fit the lorentz angle + for (int i_layer = 1; i_layer <= hists.nlay; i_layer++) { + for (int i_module = 1; i_module <= hists.nModules_[i_layer - 1]; i_module++) { + int i_index = i_module + (i_layer - 1) * hists.nModules_[i_layer - 1]; + if (hists.h_drift_depth_adc_[i_index] == nullptr) + continue; + //loop over bins in depth (z-local-coordinate) (in order to fit slices) + for (int i = 1; i <= hist_depth_; i++) { + findMean(h_drift_depth_adc_slice_, i, i_index); + } // end loop over bins in depth + + f1->SetParameter(0, 0); + f1->SetParError(0, 0); + f1->SetParameter(1, 0.4); + f1->SetParError(1, 0); + f1->SetParameter(2, 0.0); + f1->SetParError(2, 0); + f1->SetParameter(3, 0.0); + f1->SetParError(3, 0); + f1->SetParameter(4, 0.0); + f1->SetParError(4, 0); + f1->SetParameter(5, 0.0); + f1->SetParError(5, 0); + f1->SetChisquare(0); + + hists.h_mean_[i_index]->getTH1()->Fit(f1.get(), "ERQ"); + double p0 = f1->GetParameter(0); + double e0 = f1->GetParError(0); + double p1 = f1->GetParameter(1); + double e1 = f1->GetParError(1); + double p2 = f1->GetParameter(2); + double e2 = f1->GetParError(2); + double p3 = f1->GetParameter(3); + double e3 = f1->GetParError(3); + double p4 = f1->GetParameter(4); + double e4 = f1->GetParError(4); + double p5 = f1->GetParameter(5); + double e5 = f1->GetParError(5); + double chi2 = f1->GetChisquare(); + double prob = f1->GetProb(); + + edm::LogPrint("LorentzAngle") << std::setprecision(4) << i_module << "\t" << i_layer << "\t" << p0 << "\t" << e0 + << "\t" << p1 << std::setprecision(3) << "\t" << e1 << "\t" << e1 / p1 * 100. + << "\t" << (p1 - p1_simul[i_layer - 1][i_module - 1]) / e1 << "\t" << p2 << "\t" + << e2 << "\t" << p3 << "\t" << e3 << "\t" << p4 << "\t" << e4 << "\t" << p5 << "\t" + << e5 << "\t" << chi2 << "\t" << prob << "\t" + << "null" << std::endl; + + const auto& detIdsToFill = hists.detIdsList.at(i_index); + + GlobalPoint center(0.0, 0.0, 0.0); + float theMagField = magField->inTesla(center).mag(); + + float bPixLorentzAnglePerTesla_; + // if the fit quality is OK + if (prob > fitProbCut_) { + for (const auto& id : detIdsToFill) { + bPixLorentzAnglePerTesla_ = p1 / theMagField; + if (!LorentzAngle->putLorentzAngle(id, bPixLorentzAnglePerTesla_)) { + edm::LogError("SiPixelLorentzAnglePCLHarvester") + << "[SiPixelLorentzAnglePCLHarvester::dqmEndRun] detid already exists" << std::endl; + } + } + } else { + // just copy the values from the existing payload + for (const auto& id : detIdsToFill) { + bPixLorentzAnglePerTesla_ = currentLorentzAngle->getLorentzAngle(id); + if (!LorentzAngle->putLorentzAngle(id, bPixLorentzAnglePerTesla_)) { + edm::LogError("SiPixelLorentzAnglePCLHarvester") + << "[SiPixelLorentzAnglePCLHarvester::dqmEndRun] detid already exists" << std::endl; + } + } + } + } + } // end loop over modules and layers + + // fill the rest of DetIds not filled above (for the moment FPix) + const auto& currentLAMap = currentLorentzAngle->getLorentzAngles(); + const auto& newLAMap = LorentzAngle->getLorentzAngles(); + std::vector currentLADets; + std::vector newLADets; + + std::transform(currentLAMap.begin(), + currentLAMap.end(), + std::back_inserter(currentLADets), + [](const std::map::value_type& pair) { return pair.first; }); + + std::transform(newLAMap.begin(), + newLAMap.end(), + std::back_inserter(newLADets), + [](const std::map::value_type& pair) { return pair.first; }); + + std::vector notCommon; + std::set_symmetric_difference( + currentLADets.begin(), currentLADets.end(), newLADets.begin(), newLADets.end(), std::back_inserter(notCommon)); + + for (const auto& id : notCommon) { + float fPixLorentzAnglePerTesla_ = currentLorentzAngle->getLorentzAngle(id); + if (!LorentzAngle->putLorentzAngle(id, fPixLorentzAnglePerTesla_)) { + edm::LogError("SiPixelLorentzAnglePCLHarvester") + << "[SiPixelLorentzAnglePCLHarvester::dqmEndRun] detid already exists" << std::endl; + } + } + + // book histogram of differences + MonitorElement* h_diffLA = iBooker.book1D( + "h_diffLA", "difference in #mu_{H}; #Delta #mu_{H}/#mu_{H} (old-new)/old [%];n. modules", 100, -10, 10); + + for (const auto& id : newLADets) { + float deltaMuHoverMuH = (currentLorentzAngle->getLorentzAngle(id) - LorentzAngle->getLorentzAngle(id)) / + currentLorentzAngle->getLorentzAngle(id); + h_diffLA->Fill(deltaMuHoverMuH); + } + + // fill the DB object record + edm::Service mydbservice; + if (mydbservice.isAvailable()) { + try { + mydbservice->writeOneIOV(LorentzAngle.get(), mydbservice->currentTime(), recordName_); + } catch (const cond::Exception& er) { + edm::LogError("SiPixelLorentzAngleDB") << er.what() << std::endl; + } catch (const std::exception& er) { + edm::LogError("SiPixelLorentzAngleDB") << "caught std::exception " << er.what() << std::endl; + } + } else { + edm::LogError("SiPixelLorentzAngleDB") << "Service is unavailable" << std::endl; + } +} + +//------------------------------------------------------------------------------ +void SiPixelLorentzAnglePCLHarvester::findMean(MonitorElement* h_drift_depth_adc_slice_, int i, int i_ring) { + double nentries = 0; + h_drift_depth_adc_slice_->Reset(); + int hist_drift_ = h_drift_depth_adc_slice_->getNbinsX(); + + // determine sigma and sigma^2 of the adc counts and average adc counts + //loop over bins in drift width + for (int j = 1; j <= hist_drift_; j++) { + if (hists.h_drift_depth_noadc_[i_ring]->getBinContent(j, i) >= 1) { + double adc_error2 = (hists.h_drift_depth_adc2_[i_ring]->getBinContent(j, i) - + hists.h_drift_depth_adc_[i_ring]->getBinContent(j, i) * + hists.h_drift_depth_adc_[i_ring]->getBinContent(j, i) / + hists.h_drift_depth_noadc_[i_ring]->getBinContent(j, i)) / + hists.h_drift_depth_noadc_[i_ring]->getBinContent(j, i); + + hists.h_drift_depth_adc_[i_ring]->setBinError(j, i, sqrt(adc_error2)); + double error2 = adc_error2 / (hists.h_drift_depth_noadc_[i_ring]->getBinContent(j, i) - 1.); + hists.h_drift_depth_[i_ring]->setBinError(j, i, sqrt(error2)); + } else { + hists.h_drift_depth_[i_ring]->setBinError(j, i, 0); + hists.h_drift_depth_adc_[i_ring]->setBinError(j, i, 0); + } + h_drift_depth_adc_slice_->setBinContent(j, hists.h_drift_depth_adc_[i_ring]->getBinContent(j, i)); + h_drift_depth_adc_slice_->setBinError(j, hists.h_drift_depth_adc_[i_ring]->getBinError(j, i)); + nentries += hists.h_drift_depth_noadc_[i_ring]->getBinContent(j, i); + } // end loop over bins in drift width + + double mean = h_drift_depth_adc_slice_->getMean(1); + double error = 0; + if (nentries != 0) { + error = h_drift_depth_adc_slice_->getRMS(1) / std::sqrt(nentries); + } + hists.h_mean_[i_ring]->setBinContent(i, mean); + hists.h_mean_[i_ring]->setBinError(i, error); +} + +//------------------------------------------------------------------------------ +void SiPixelLorentzAnglePCLHarvester::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + desc.setComment("Harvester module of the SiPixel Lorentz Angle PCL monitoring workflow"); + desc.add>("newmodulelist", {})->setComment("the list of DetIds for new sensors"); + desc.add("dqmDir", "AlCaReco/SiPixelLorentzAngle")->setComment("the directory of PCL Worker output"); + desc.add("fitProbCut", 0.5)->setComment("cut on fit chi2 probabiblity to accept measurement"); + desc.add("record", "SiPixelLorentzAngleRcd")->setComment("target DB record"); + descriptions.addWithDefaultLabel(desc); +} + +DEFINE_FWK_MODULE(SiPixelLorentzAnglePCLHarvester); diff --git a/CalibTracker/SiPixelLorentzAngle/src/SiPixelLorentzAnglePCLWorker.cc b/CalibTracker/SiPixelLorentzAngle/src/SiPixelLorentzAnglePCLWorker.cc new file mode 100644 index 0000000000000..9e2c352e21333 --- /dev/null +++ b/CalibTracker/SiPixelLorentzAngle/src/SiPixelLorentzAnglePCLWorker.cc @@ -0,0 +1,798 @@ +// -*- C++ -*- +// +// Package: CalibTracker/SiPixelLorentzAnglePCLWorker +// Class: SiPixelLorentzAnglePCLWorker +// +/**\class SiPixelLorentzAnglePCLWorker SiPixelLorentzAnglePCLWorker.cc CalibTracker/SiPixelLorentzAnglePCLWorker/plugins/SiPixelLorentzAnglePCLWorker.cc + Description: [one line class summary] + Implementation: + [Notes on implementation] +*/ +// +// Original Author: mmusich +// Created: Sat, 29 May 2021 14:46:19 GMT +// +// + +#include + +// user include files +#include "CalibTracker/Records/interface/SiPixelTemplateDBObjectESProducerRcd.h" +#include "CalibTracker/SiPixelLorentzAngle/interface/SiPixelLorentzAngleCalibrationStruct.h" +#include "CondFormats/SiPixelObjects/interface/SiPixelTemplateDBObject.h" +#include "CondFormats/SiPixelTransient/interface/SiPixelTemplate.h" +#include "CondFormats/SiPixelTransient/interface/SiPixelTemplateDefs.h" +#include "DQMServices/Core/interface/DQMEDAnalyzer.h" +#include "DQMServices/Core/interface/DQMStore.h" +#include "DataFormats/GeometryVector/interface/GlobalVector.h" +#include "DataFormats/GeometryVector/interface/LocalVector.h" +#include "DataFormats/SiStripDetId/interface/StripSubdetector.h" +#include "DataFormats/TrackReco/interface/TrackExtra.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 "DataFormats/TrackerRecHit2D/interface/SiStripMatchedRecHit2D.h" +#include "DataFormats/TrajectorySeed/interface/TrajectorySeedCollection.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 "Geometry/CommonDetUnit/interface/GeomDetType.h" +#include "Geometry/CommonTopologies/interface/StripTopology.h" +#include "Geometry/Records/interface/IdealGeometryRecord.h" +#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" +#include "Geometry/TrackerGeometryBuilder/interface/PixelTopologyMap.h" +#include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" +#include "Geometry/TrackerGeometryBuilder/interface/phase1PixelTopology.h" +#include "RecoTracker/TransientTrackingRecHit/interface/TkTransientTrackingRecHitBuilder.h" +#include "TrackingTools/PatternTools/interface/TrajTrackAssociation.h" +#include "TrackingTools/Records/interface/TransientRecHitRecord.h" +#include "TrackingTools/TrackFitters/interface/TrajectoryStateCombiner.h" +#include "TrackingTools/TransientTrack/interface/TransientTrack.h" +#include +#include +#include +// +// class declaration +// + +static const int maxpix = 1000; +struct Pixinfo { + int npix; + float row[maxpix]; + float col[maxpix]; + float adc[maxpix]; + float x[maxpix]; + float y[maxpix]; +}; + +struct Hit { + float x; + float y; + double alpha; + double beta; + double gamma; +}; +struct Clust { + float x; + float y; + float charge; + int size_x; + int size_y; + int maxPixelCol; + int maxPixelRow; + int minPixelCol; + int minPixelRow; +}; +struct Rechit { + float x; + float y; +}; + +class SiPixelLorentzAnglePCLWorker : public DQMEDAnalyzer { +public: + explicit SiPixelLorentzAnglePCLWorker(const edm::ParameterSet&); + ~SiPixelLorentzAnglePCLWorker() override = default; + + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + +private: + void bookHistograms(DQMStore::IBooker&, edm::Run const&, edm::EventSetup const&) override; + + void analyze(edm::Event const&, edm::EventSetup const&) override; + + void dqmBeginRun(edm::Run const&, edm::EventSetup const&) override; + + void dqmEndRun(edm::Run const&, edm::EventSetup const&); + + const Pixinfo fillPix(const SiPixelCluster& LocPix, const PixelTopology* topol) const; + const std::pair surface_deformation(const PixelTopology* topol, + TrajectoryStateOnSurface& tsos, + const SiPixelRecHit* recHitPix) const; + // ------------ member data ------------ + SiPixelLorentzAngleCalibrationHistograms iHists; + + std::string folder_; + bool notInPCL_; + std::string filename_; + std::vector newmodulelist_; + + // tree branches barrel + int run_; + long int event_; + int lumiblock_; + int bx_; + int orbit_; + int module_; + int ladder_; + int layer_; + int isflipped_; + float pt_; + float eta_; + float phi_; + double chi2_; + double ndof_; + Pixinfo pixinfo_; + Hit simhit_, trackhit_; + Clust clust_; + Rechit rechit_; + Rechit rechitCorr_; + float trackhitCorrX_; + float trackhitCorrY_; + float qScale_; + float rQmQt_; + + // tree branches forward + int sideF_; + int diskF_; + int bladeF_; + int panelF_; + int moduleF_; + Pixinfo pixinfoF_; + Hit simhitF_, trackhitF_; + Clust clustF_; + Rechit rechitF_; + Rechit rechitCorrF_; + float trackhitCorrXF_; + float trackhitCorrYF_; + float qScaleF_; + float rQmQtF_; + + // parameters from config file + double ptmin_; + double normChi2Max_; + int clustSizeYMin_; + int clustSizeYMinL4_; + int clustSizeXMax_; + double residualMax_; + double clustChargeMaxPerLength_; + int hist_depth_; + int hist_drift_; + + std::unique_ptr hFile_; + std::unique_ptr SiPixelLorentzAngleTreeBarrel_; + std::unique_ptr SiPixelLorentzAngleTreeForward_; + + // es consumes + edm::ESGetToken geomEsToken_; + edm::ESGetToken topoEsToken_; + edm::ESGetToken siPixelTemplateEsToken_; + edm::ESGetToken topoPerEventEsToken_; + edm::ESGetToken geomPerEventEsToken_; + + // event consumes + edm::EDGetTokenT t_trajTrack; +}; + +// +// constructors and destructor +// +SiPixelLorentzAnglePCLWorker::SiPixelLorentzAnglePCLWorker(const edm::ParameterSet& iConfig) + : folder_(iConfig.getParameter("folder")), + notInPCL_(iConfig.getParameter("notInPCL")), + filename_(iConfig.getParameter("fileName")), + newmodulelist_(iConfig.getParameter>("newmodulelist")), + ptmin_(iConfig.getParameter("ptMin")), + normChi2Max_(iConfig.getParameter("normChi2Max")), + clustSizeYMin_(iConfig.getParameter("clustSizeYMin")), + clustSizeYMinL4_(iConfig.getParameter("clustSizeYMinL4")), + clustSizeXMax_(iConfig.getParameter("clustSizeXMax")), + residualMax_(iConfig.getParameter("residualMax")), + clustChargeMaxPerLength_(iConfig.getParameter("clustChargeMaxPerLength")), + hist_depth_(iConfig.getParameter("binsDepth")), + hist_drift_(iConfig.getParameter("binsDrift")), + geomEsToken_(esConsumes()), + topoEsToken_(esConsumes()), + siPixelTemplateEsToken_(esConsumes()), + topoPerEventEsToken_(esConsumes()), + geomPerEventEsToken_(esConsumes()) { + t_trajTrack = consumes(iConfig.getParameter("src")); + + // now do what ever initialization is needed + int bufsize = 64000; + + // create tree structure + // Barrel pixel + if (notInPCL_) { + hFile_ = std::make_unique(filename_.c_str(), "RECREATE"); + SiPixelLorentzAngleTreeBarrel_ = + std::make_unique("SiPixelLorentzAngleTreeBarrel_", "SiPixel LorentzAngle tree barrel", bufsize); + SiPixelLorentzAngleTreeBarrel_->Branch("run", &run_, "run/I", bufsize); + SiPixelLorentzAngleTreeBarrel_->Branch("event", &event_, "event/l", bufsize); + SiPixelLorentzAngleTreeBarrel_->Branch("lumiblock", &lumiblock_, "lumiblock/I", bufsize); + SiPixelLorentzAngleTreeBarrel_->Branch("bx", &bx_, "bx/I", bufsize); + SiPixelLorentzAngleTreeBarrel_->Branch("orbit", &orbit_, "orbit/I", bufsize); + SiPixelLorentzAngleTreeBarrel_->Branch("module", &module_, "module/I", bufsize); + SiPixelLorentzAngleTreeBarrel_->Branch("ladder", &ladder_, "ladder/I", bufsize); + SiPixelLorentzAngleTreeBarrel_->Branch("layer", &layer_, "layer/I", bufsize); + SiPixelLorentzAngleTreeBarrel_->Branch("isflipped", &isflipped_, "isflipped/I", bufsize); + SiPixelLorentzAngleTreeBarrel_->Branch("pt", &pt_, "pt/F", bufsize); + SiPixelLorentzAngleTreeBarrel_->Branch("eta", &eta_, "eta/F", bufsize); + SiPixelLorentzAngleTreeBarrel_->Branch("phi", &phi_, "phi/F", bufsize); + SiPixelLorentzAngleTreeBarrel_->Branch("chi2", &chi2_, "chi2/D", bufsize); + SiPixelLorentzAngleTreeBarrel_->Branch("ndof", &ndof_, "ndof/D", bufsize); + SiPixelLorentzAngleTreeBarrel_->Branch("trackhit", &trackhit_, "x/F:y/F:alpha/D:beta/D:gamma_/D", bufsize); + SiPixelLorentzAngleTreeBarrel_->Branch("npix", &pixinfo_.npix, "npix/I", bufsize); + SiPixelLorentzAngleTreeBarrel_->Branch("rowpix", pixinfo_.row, "row[npix]/F", bufsize); + SiPixelLorentzAngleTreeBarrel_->Branch("colpix", pixinfo_.col, "col[npix]/F", bufsize); + SiPixelLorentzAngleTreeBarrel_->Branch("adc", pixinfo_.adc, "adc[npix]/F", bufsize); + SiPixelLorentzAngleTreeBarrel_->Branch("xpix", pixinfo_.x, "x[npix]/F", bufsize); + SiPixelLorentzAngleTreeBarrel_->Branch("ypix", pixinfo_.y, "y[npix]/F", bufsize); + + SiPixelLorentzAngleTreeBarrel_->Branch( + "clust", + &clust_, + "x/F:y/F:charge/F:size_x/I:size_y/I:maxPixelCol/I:maxPixelRow:minPixelCol/I:minPixelRow/I", + bufsize); + SiPixelLorentzAngleTreeBarrel_->Branch("rechit", &rechit_, "x/F:y/F", bufsize); + SiPixelLorentzAngleTreeBarrel_->Branch("rechit_corr", &rechitCorr_, "x/F:y/F", bufsize); + SiPixelLorentzAngleTreeBarrel_->Branch("trackhitcorr_x", &trackhitCorrX_, "trackhitcorr_x/F", bufsize); + SiPixelLorentzAngleTreeBarrel_->Branch("trackhitcorr_y", &trackhitCorrY_, "trackhitcorr_y/F", bufsize); + SiPixelLorentzAngleTreeBarrel_->Branch("qScale", &qScale_, "qScale/F", bufsize); + SiPixelLorentzAngleTreeBarrel_->Branch("rQmQt", &rQmQt_, "rQmQt/F", bufsize); + // Forward pixel + + SiPixelLorentzAngleTreeForward_ = + std::make_unique("SiPixelLorentzAngleTreeForward_", "SiPixel LorentzAngle tree forward", bufsize); + SiPixelLorentzAngleTreeForward_->Branch("run", &run_, "run/I", bufsize); + SiPixelLorentzAngleTreeForward_->Branch("event", &event_, "event/l", bufsize); + SiPixelLorentzAngleTreeForward_->Branch("lumiblock", &lumiblock_, "lumiblock/I", bufsize); + SiPixelLorentzAngleTreeForward_->Branch("bx", &bx_, "bx/I", bufsize); + SiPixelLorentzAngleTreeForward_->Branch("orbit", &orbit_, "orbit/I", bufsize); + SiPixelLorentzAngleTreeForward_->Branch("side", &sideF_, "side/I", bufsize); + SiPixelLorentzAngleTreeForward_->Branch("disk", &diskF_, "disk/I", bufsize); + SiPixelLorentzAngleTreeForward_->Branch("blade", &bladeF_, "blade/I", bufsize); + SiPixelLorentzAngleTreeForward_->Branch("panel", &panelF_, "panel/I", bufsize); + SiPixelLorentzAngleTreeForward_->Branch("module", &moduleF_, "module/I", bufsize); + SiPixelLorentzAngleTreeForward_->Branch("pt", &pt_, "pt/F", bufsize); + SiPixelLorentzAngleTreeForward_->Branch("eta", &eta_, "eta/F", bufsize); + SiPixelLorentzAngleTreeForward_->Branch("phi", &phi_, "phi/F", bufsize); + SiPixelLorentzAngleTreeForward_->Branch("chi2", &chi2_, "chi2/D", bufsize); + SiPixelLorentzAngleTreeForward_->Branch("ndof", &ndof_, "ndof/D", bufsize); + SiPixelLorentzAngleTreeForward_->Branch("trackhit", &trackhitF_, "x/F:y/F:alpha/D:beta/D:gamma_/D", bufsize); + SiPixelLorentzAngleTreeForward_->Branch("npix", &pixinfoF_.npix, "npix/I", bufsize); + SiPixelLorentzAngleTreeForward_->Branch("rowpix", pixinfoF_.row, "row[npix]/F", bufsize); + SiPixelLorentzAngleTreeForward_->Branch("colpix", pixinfoF_.col, "col[npix]/F", bufsize); + SiPixelLorentzAngleTreeForward_->Branch("adc", pixinfoF_.adc, "adc[npix]/F", bufsize); + SiPixelLorentzAngleTreeForward_->Branch("xpix", pixinfoF_.x, "x[npix]/F", bufsize); + SiPixelLorentzAngleTreeForward_->Branch("ypix", pixinfoF_.y, "y[npix]/F", bufsize); + + SiPixelLorentzAngleTreeForward_->Branch( + "clust", + &clustF_, + "x/F:y/F:charge/F:size_x/I:size_y/I:maxPixelCol/I:maxPixelRow:minPixelCol/I:minPixelRow/I", + bufsize); + SiPixelLorentzAngleTreeForward_->Branch("rechit", &rechitF_, "x/F:y/F", bufsize); + SiPixelLorentzAngleTreeForward_->Branch("rechit_corr", &rechitCorrF_, "x/F:y/F", bufsize); + SiPixelLorentzAngleTreeForward_->Branch("trackhitcorr_x", &trackhitCorrXF_, "trackhitcorr_x/F", bufsize); + SiPixelLorentzAngleTreeForward_->Branch("trackhitcorr_y", &trackhitCorrYF_, "trackhitcorr_y/F", bufsize); + SiPixelLorentzAngleTreeForward_->Branch("qScale", &qScaleF_, "qScale/F", bufsize); + SiPixelLorentzAngleTreeForward_->Branch("rQmQt", &rQmQtF_, "rQmQt/F", bufsize); + } +} + +// +// member functions +// + +// ------------ method called for each event ------------ + +void SiPixelLorentzAnglePCLWorker::analyze(edm::Event const& iEvent, edm::EventSetup const& iSetup) { + // Retrieve template stuff + const SiPixelTemplateDBObject* templateDBobject_ = &iSetup.getData(siPixelTemplateEsToken_); + std::vector thePixelTemp_; + SiPixelTemplate templ(thePixelTemp_); + if (!SiPixelTemplate::pushfile(*templateDBobject_, thePixelTemp_)) { + edm::LogError("SiPixelLorentzAnglePCLWorker") + << "\nERROR: Templates not filled correctly. Check the sqlite file." + << "Using SiPixelTemplateDBObject version " << (*templateDBobject_).version() << "\n\n"; + } + + // Retrieve tracker topology from geometry + const TrackerTopology* const tTopo = &iSetup.getData(topoPerEventEsToken_); + + // Retrieve track geometry + const TrackerGeometry* tracker = &iSetup.getData(geomPerEventEsToken_); + + // get the association map between tracks and trajectories + edm::Handle trajTrackCollectionHandle; + iEvent.getByToken(t_trajTrack, trajTrackCollectionHandle); + + module_ = -1; + layer_ = -1; + ladder_ = -1; + isflipped_ = -1; + pt_ = -999; + eta_ = 999; + phi_ = 999; + pixinfo_.npix = 0; + + run_ = iEvent.id().run(); + event_ = iEvent.id().event(); + lumiblock_ = iEvent.luminosityBlock(); + bx_ = iEvent.bunchCrossing(); + orbit_ = iEvent.orbitNumber(); + + if (!trajTrackCollectionHandle->empty()) { + for (TrajTrackAssociationCollection::const_iterator it = trajTrackCollectionHandle->begin(); + it != trajTrackCollectionHandle->end(); + ++it) { + const reco::Track& track = *it->val; + const Trajectory& traj = *it->key; + + // get the trajectory measurements + std::vector tmColl = traj.measurements(); + pt_ = track.pt(); + eta_ = track.eta(); + phi_ = track.phi(); + chi2_ = traj.chiSquared(); + ndof_ = traj.ndof(); + + if (pt_ < ptmin_) + continue; + // iterate over trajectory measurements + iHists.h_tracks_->Fill(0); + bool pixeltrack = false; + for (std::vector::const_iterator itTraj = tmColl.begin(); itTraj != tmColl.end(); + itTraj++) { + if (!itTraj->updatedState().isValid()) + continue; + TransientTrackingRecHit::ConstRecHitPointer recHit = itTraj->recHit(); + if (!recHit->isValid() || recHit->geographicalId().det() != DetId::Tracker) + continue; + unsigned int subDetID = (recHit->geographicalId().subdetId()); + if (subDetID == PixelSubdetector::PixelBarrel || subDetID == PixelSubdetector::PixelEndcap) { + if (!pixeltrack) { + iHists.h_tracks_->Fill(1); + } + pixeltrack = true; + } + + if (subDetID == PixelSubdetector::PixelBarrel) { + DetId detIdObj = recHit->geographicalId(); + const PixelGeomDetUnit* theGeomDet = dynamic_cast(tracker->idToDet(detIdObj)); + if (!theGeomDet) + continue; + + const PixelTopology* topol = &(theGeomDet->specificTopology()); + + float ypitch_ = topol->pitch().second; + float width_ = 0.0285; + + if (!topol) + continue; + + layer_ = tTopo->pxbLayer(detIdObj); + ladder_ = tTopo->pxbLadder(detIdObj); + module_ = tTopo->pxbModule(detIdObj); + + float tmp1 = theGeomDet->surface().toGlobal(Local3DPoint(0., 0., 0.)).perp(); + float tmp2 = theGeomDet->surface().toGlobal(Local3DPoint(0., 0., 1.)).perp(); + + isflipped_ = (tmp2 < tmp1) ? 1 : 0; + + const SiPixelRecHit* recHitPix = dynamic_cast((*recHit).hit()); + if (!recHitPix) + continue; + rechit_.x = recHitPix->localPosition().x(); + rechit_.y = recHitPix->localPosition().y(); + SiPixelRecHit::ClusterRef const& cluster = recHitPix->cluster(); + + pixinfo_ = fillPix(*cluster, topol); + + // fill entries in clust_ + + clust_.x = (cluster)->x(); + clust_.y = (cluster)->y(); + clust_.charge = (cluster->charge()) / 1000.; // clust_.charge: in the unit of 1000e + clust_.size_x = cluster->sizeX(); + clust_.size_y = cluster->sizeY(); + clust_.maxPixelCol = cluster->maxPixelCol(); + clust_.maxPixelRow = cluster->maxPixelRow(); + clust_.minPixelCol = cluster->minPixelCol(); + clust_.minPixelRow = cluster->minPixelRow(); + + // fill the trackhit info + TrajectoryStateOnSurface tsos = itTraj->updatedState(); + if (!tsos.isValid()) { + edm::LogWarning("SiPixelLorentzAnglePCLWorker") << "tsos not valid" << std::endl; + continue; + } + LocalVector trackdirection = tsos.localDirection(); + LocalPoint trackposition = tsos.localPosition(); + + if (trackdirection.z() == 0) + continue; + // the local position and direction + trackhit_.alpha = atan2(trackdirection.z(), trackdirection.x()); + trackhit_.beta = atan2(trackdirection.z(), trackdirection.y()); + trackhit_.gamma = atan2(trackdirection.x(), trackdirection.y()); + trackhit_.x = trackposition.x(); + trackhit_.y = trackposition.y(); + + // get qScale_ = templ.qscale() and templ.r_qMeas_qTrue(); + + float cotalpha = trackdirection.x() / trackdirection.z(); + float cotbeta = trackdirection.y() / trackdirection.z(); + float cotbeta_min = clustSizeYMin_ * ypitch_ / width_; + if (fabs(cotbeta) <= cotbeta_min) + continue; + double drdz = sqrt(1. + cotalpha * cotalpha + cotbeta * cotbeta); + double clusterCharge_cut = clustChargeMaxPerLength_ * drdz; + + float locBx = 1.; + if (cotbeta < 0.) + locBx = -1.; + float locBz = locBx; + if (cotalpha < 0.) + locBz = -locBx; + + auto detId = detIdObj.rawId(); + bool Isnew = false; + int DetId_index = -1; + for (int i = 0; i < (int)iHists.BPixnewDetIds_.size(); i++) { + if (detId == (unsigned int)iHists.BPixnewDetIds_[i]) + Isnew = true; + DetId_index = i; + } + + int TemplID = templateDBobject_->getTemplateID(detId); + templ.interpolate(TemplID, cotalpha, cotbeta, locBz, locBx); + qScale_ = templ.qscale(); + rQmQt_ = templ.r_qMeas_qTrue(); + + // Surface deformation + + const auto& lp_pair = surface_deformation(topol, tsos, recHitPix); + + LocalPoint lp_track = lp_pair.first; + LocalPoint lp_rechit = lp_pair.second; + + rechitCorr_.x = lp_rechit.x(); + rechitCorr_.y = lp_rechit.y(); + trackhitCorrX_ = lp_track.x(); + trackhitCorrY_ = lp_track.y(); + + if (notInPCL_) { + SiPixelLorentzAngleTreeBarrel_->Fill(); + } + + // is one pixel in cluster a large pixel ? (hit will be excluded) + bool large_pix = false; + for (int j = 0; j < pixinfo_.npix; j++) { + int colpos = static_cast(pixinfo_.col[j]); + if (pixinfo_.row[j] == 0 || pixinfo_.row[j] == 79 || pixinfo_.row[j] == 80 || pixinfo_.row[j] == 159 || + colpos % 52 == 0 || colpos % 52 == 51) { + large_pix = true; + } + } + + double residualsq = (trackhitCorrX_ - rechitCorr_.x) * (trackhitCorrX_ - rechitCorr_.x) + + (trackhitCorrY_ - rechitCorr_.y) * (trackhitCorrY_ - rechitCorr_.y); + + double xlim1 = trackhitCorrX_ - width_ * cotalpha / 2.; + double hypitch_ = ypitch_ / 2.; + double ylim1 = trackhitCorrY_ - width_ * cotbeta / 2.; + double ylim2 = trackhitCorrY_ + width_ * cotbeta / 2.; + + int clustSizeY_cut = layer_ < 4 ? clustSizeYMin_ : clustSizeYMinL4_; + + if (!large_pix && (chi2_ / ndof_) < normChi2Max_ && cluster->sizeY() >= clustSizeY_cut && + residualsq < residualMax_ * residualMax_ && cluster->charge() < clusterCharge_cut && + cluster->sizeX() < clustSizeXMax_) { + // iterate over pixels in hit + for (int j = 0; j < pixinfo_.npix; j++) { + // use trackhits and include bowing correction + float ypixlow = pixinfo_.y[j] - hypitch_; + float ypixhigh = pixinfo_.y[j] + hypitch_; + if (cotbeta > 0.) { + if (ylim1 > ypixlow) + ypixlow = ylim1; + if (ylim2 < ypixhigh) + ypixhigh = ylim2; + } else { + if (ylim2 > ypixlow) + ypixlow = ylim2; + if (ylim1 < ypixhigh) + ypixhigh = ylim1; + } + float ypixavg = 0.5 * (ypixlow + ypixhigh); + + float changeUnit = 10000.; + float dx = (pixinfo_.x[j] - xlim1) * changeUnit; // dx: in the unit of micrometer + float dy = (ypixavg - ylim1) * changeUnit; // dy: in the unit of micrometer + float depth = dy * tan(trackhit_.beta); + float drift = dx - dy * tan(trackhit_.gamma); + + if (Isnew == false) { + int i_index = module_ + (layer_ - 1) * iHists.nModules_[layer_ - 1]; + iHists.h_drift_depth_adc_.at(i_index)->Fill(drift, depth, pixinfo_.adc[j]); + iHists.h_drift_depth_adc2_.at(i_index)->Fill(drift, depth, pixinfo_.adc[j] * pixinfo_.adc[j]); + iHists.h_drift_depth_noadc_.at(i_index)->Fill(drift, depth); + } else { + int new_index = iHists.nModules_[iHists.nlay - 1] + + (iHists.nlay - 1) * iHists.nModules_[iHists.nlay - 1] + 1 + DetId_index; + iHists.h_drift_depth_adc_.at(new_index)->Fill(drift, depth, pixinfo_.adc[j]); + iHists.h_drift_depth_adc2_.at(new_index)->Fill(drift, depth, pixinfo_.adc[j] * pixinfo_.adc[j]); + iHists.h_drift_depth_noadc_.at(new_index)->Fill(drift, depth); + } + } + } + } else if (subDetID == PixelSubdetector::PixelEndcap) { + DetId detIdObj = recHit->geographicalId(); + const PixelGeomDetUnit* theGeomDet = dynamic_cast(tracker->idToDet(detIdObj)); + if (!theGeomDet) + continue; + + const PixelTopology* topol = &(theGeomDet->specificTopology()); + + if (!topol) + continue; + + sideF_ = tTopo->pxfSide(detIdObj); + diskF_ = tTopo->pxfDisk(detIdObj); + bladeF_ = tTopo->pxfBlade(detIdObj); + panelF_ = tTopo->pxfPanel(detIdObj); + moduleF_ = tTopo->pxfModule(detIdObj); + + const SiPixelRecHit* recHitPix = dynamic_cast((*recHit).hit()); + if (!recHitPix) + continue; + rechitF_.x = recHitPix->localPosition().x(); + rechitF_.y = recHitPix->localPosition().y(); + SiPixelRecHit::ClusterRef const& cluster = recHitPix->cluster(); + + pixinfoF_ = fillPix(*cluster, topol); + + // fill entries in clust_ + + clustF_.x = (cluster)->x(); + clustF_.y = (cluster)->y(); + clustF_.charge = (cluster->charge()) / 1000.; // clustF_.charge: in the unit of 1000e + clustF_.size_x = cluster->sizeX(); + clustF_.size_y = cluster->sizeY(); + clustF_.maxPixelCol = cluster->maxPixelCol(); + clustF_.maxPixelRow = cluster->maxPixelRow(); + clustF_.minPixelCol = cluster->minPixelCol(); + clustF_.minPixelRow = cluster->minPixelRow(); + + // fill the trackhit info + TrajectoryStateOnSurface tsos = itTraj->updatedState(); + if (!tsos.isValid()) { + edm::LogWarning("SiPixelLorentzAnglePCLWorker") << "tsos not valid" << std::endl; + continue; + } + LocalVector trackdirection = tsos.localDirection(); + LocalPoint trackposition = tsos.localPosition(); + + if (trackdirection.z() == 0) + continue; + // the local position and direction + trackhitF_.alpha = atan2(trackdirection.z(), trackdirection.x()); + trackhitF_.beta = atan2(trackdirection.z(), trackdirection.y()); + trackhitF_.gamma = atan2(trackdirection.x(), trackdirection.y()); + trackhitF_.x = trackposition.x(); + trackhitF_.y = trackposition.y(); + + float cotalpha = trackdirection.x() / trackdirection.z(); + float cotbeta = trackdirection.y() / trackdirection.z(); + + float locBx = 1.; + if (cotbeta < 0.) + locBx = -1.; + float locBz = locBx; + if (cotalpha < 0.) + locBz = -locBx; + + auto detId = detIdObj.rawId(); + + int TemplID = templateDBobject_->getTemplateID(detId); + templ.interpolate(TemplID, cotalpha, cotbeta, locBz, locBx); + qScaleF_ = templ.qscale(); + rQmQtF_ = templ.r_qMeas_qTrue(); + + // Surface deformation + + const auto& lp_pair = surface_deformation(topol, tsos, recHitPix); + + LocalPoint lp_track = lp_pair.first; + LocalPoint lp_rechit = lp_pair.second; + + rechitCorrF_.x = lp_rechit.x(); + rechitCorrF_.y = lp_rechit.y(); + trackhitCorrXF_ = lp_track.x(); + trackhitCorrYF_ = lp_track.y(); + if (notInPCL_) { + SiPixelLorentzAngleTreeForward_->Fill(); + } + } + } //end iteration over trajectory measurements + } //end iteration over trajectories + } +} + +void SiPixelLorentzAnglePCLWorker::dqmBeginRun(edm::Run const& run, edm::EventSetup const& iSetup) { + // geometry + const TrackerGeometry* geom = &iSetup.getData(geomEsToken_); + const TrackerTopology* tTopo = &iSetup.getData(topoEsToken_); + + PixelTopologyMap map = PixelTopologyMap(geom, tTopo); + iHists.nlay = geom->numberOfLayers(PixelSubdetector::PixelBarrel); + iHists.nModules_.resize(iHists.nlay); + for (int i = 0; i < iHists.nlay; i++) { + iHists.nModules_[i] = map.getPXBModules(i + 1); + } + + if (!newmodulelist_.empty()) { + for (auto const& modulename : newmodulelist_) { + if (modulename.find("BPix_") != std::string::npos) { + PixelBarrelName bn(modulename, true); + const auto& detId = bn.getDetId(tTopo); + iHists.BPixnewmodulename_.push_back(modulename); + iHists.BPixnewDetIds_.push_back(detId.rawId()); + iHists.BPixnewModule_.push_back(bn.moduleName()); + iHists.BPixnewLayer_.push_back(bn.layerName()); + } else if (modulename.find("FPix_") != std::string::npos) { + PixelEndcapName en(modulename, true); + const auto& detId = en.getDetId(tTopo); + iHists.FPixnewmodulename_.push_back(modulename); + iHists.FPixnewDetIds_.push_back(detId.rawId()); + iHists.FPixnewDisk_.push_back(en.diskName()); + iHists.FPixnewBlade_.push_back(en.bladeName()); + } + } + } +} + +void SiPixelLorentzAnglePCLWorker::bookHistograms(DQMStore::IBooker& iBooker, + edm::Run const& run, + edm::EventSetup const& iSetup) { + iBooker.setCurrentFolder(folder_); + iHists.h_tracks_ = iBooker.book1D("h_tracks", "h_tracks", 2, 0., 2.); + + double min_depth_ = -100.; + double max_depth_ = 400.; + double min_drift_ = -1000.; + double max_drift_ = 1000.; + + //book histograms + char name[128]; + for (int i_layer = 1; i_layer <= iHists.nlay; i_layer++) { + for (int i_module = 1; i_module <= iHists.nModules_[i_layer - 1]; i_module++) { + unsigned int i_index = i_module + (i_layer - 1) * iHists.nModules_[i_layer - 1]; + + sprintf(name, "h_drift_depth_adc_layer%i_module%i", i_layer, i_module); + iHists.h_drift_depth_adc_[i_index] = + iBooker.book2D(name, name, hist_drift_, min_drift_, max_drift_, hist_depth_, min_depth_, max_depth_); + + sprintf(name, "h_drift_depth_adc2_layer%i_module%i", i_layer, i_module); + iHists.h_drift_depth_adc2_[i_index] = + iBooker.book2D(name, name, hist_drift_, min_drift_, max_drift_, hist_depth_, min_depth_, max_depth_); + + sprintf(name, "h_drift_depth_noadc_layer%i_module%i", i_layer, i_module); + iHists.h_drift_depth_noadc_[i_index] = + iBooker.book2D(name, name, hist_drift_, min_drift_, max_drift_, hist_depth_, min_depth_, max_depth_); + + sprintf(name, "h_drift_depth_layer%i_module%i", i_layer, i_module); + iHists.h_drift_depth_[i_index] = + iBooker.book2D(name, name, hist_drift_, min_drift_, max_drift_, hist_depth_, min_depth_, max_depth_); + + sprintf(name, "h_mean_layer%i_module%i", i_layer, i_module); + iHists.h_mean_[i_index] = iBooker.book1D(name, name, hist_depth_, min_depth_, max_depth_); + } + } + + for (int i = 0; i < (int)iHists.BPixnewDetIds_.size(); i++) { + int new_index = iHists.nModules_[iHists.nlay - 1] + (iHists.nlay - 1) * iHists.nModules_[iHists.nlay - 1] + 1 + i; + + sprintf(name, "h_BPixnew_drift_depth_adc_%s", iHists.BPixnewmodulename_[i].c_str()); + iHists.h_drift_depth_adc_[new_index] = + iBooker.book2D(name, name, hist_drift_, min_drift_, max_drift_, hist_depth_, min_depth_, max_depth_); + + sprintf(name, "h_BPixnew_drift_depth_adc2_%s", iHists.BPixnewmodulename_[i].c_str()); + iHists.h_drift_depth_adc2_[new_index] = + iBooker.book2D(name, name, hist_drift_, min_drift_, max_drift_, hist_depth_, min_depth_, max_depth_); + + sprintf(name, "h_BPixnew_drift_depth_noadc_%s", iHists.BPixnewmodulename_[i].c_str()); + iHists.h_drift_depth_noadc_[new_index] = + iBooker.book2D(name, name, hist_drift_, min_drift_, max_drift_, hist_depth_, min_depth_, max_depth_); + + sprintf(name, "h_BPixnew_drift_depth_%s", iHists.BPixnewmodulename_[i].c_str()); + iHists.h_drift_depth_[new_index] = + iBooker.book2D(name, name, hist_drift_, min_drift_, max_drift_, hist_depth_, min_depth_, max_depth_); + + sprintf(name, "h_BPixnew_mean_%s", iHists.BPixnewmodulename_[i].c_str()); + iHists.h_mean_[new_index] = iBooker.book1D(name, name, hist_depth_, min_depth_, max_depth_); + } +} + +void SiPixelLorentzAnglePCLWorker::dqmEndRun(edm::Run const& run, edm::EventSetup const& iSetup) { + if (notInPCL_) { + hFile_->cd(); + hFile_->Write(); + hFile_->Close(); + } +} + +// method used to fill per pixel info +const Pixinfo SiPixelLorentzAnglePCLWorker::fillPix(const SiPixelCluster& LocPix, const PixelTopology* topol) const { + Pixinfo pixinfo; + const std::vector& pixvector = LocPix.pixels(); + pixinfo.npix = 0; + for (std::vector::const_iterator itPix = pixvector.begin(); itPix != pixvector.end(); + itPix++) { + pixinfo.row[pixinfo.npix] = itPix->x; + pixinfo.col[pixinfo.npix] = itPix->y; + pixinfo.adc[pixinfo.npix] = itPix->adc; + LocalPoint lp = topol->localPosition(MeasurementPoint(itPix->x + 0.5, itPix->y + 0.5)); + pixinfo.x[pixinfo.npix] = lp.x(); + pixinfo.y[pixinfo.npix] = lp.y(); + pixinfo.npix++; + } + return pixinfo; +} + +// method used to correct for the surface deformation +const std::pair SiPixelLorentzAnglePCLWorker::surface_deformation( + const PixelTopology* topol, TrajectoryStateOnSurface& tsos, const SiPixelRecHit* recHitPix) const { + LocalPoint trackposition = tsos.localPosition(); + const LocalTrajectoryParameters& ltp = tsos.localParameters(); + const Topology::LocalTrackAngles localTrackAngles(ltp.dxdz(), ltp.dydz()); + + std::pair pixels_track = topol->pixel(trackposition, localTrackAngles); + std::pair pixels_rechit = topol->pixel(recHitPix->localPosition(), localTrackAngles); + + LocalPoint lp_track = topol->localPosition(MeasurementPoint(pixels_track.first, pixels_track.second)); + + LocalPoint lp_rechit = topol->localPosition(MeasurementPoint(pixels_rechit.first, pixels_rechit.second)); + + std::pair lps = std::make_pair(lp_track, lp_rechit); + return lps; +} + +// ------------ method fills 'descriptions' with the allowed parameters for the module ------------ +void SiPixelLorentzAnglePCLWorker::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + desc.setComment("Worker module of the SiPixel Lorentz Angle PCL monitoring workflow"); + desc.add("folder", "AlCaReco/SiPixelLorentzAngle")->setComment("directory of PCL Worker output"); + desc.add("notInPCL", false)->setComment("create TTree (true) or not (false)"); + desc.add("fileName", "testrun.root")->setComment("name of the TTree file if notInPCL = true"); + desc.add>("newmodulelist", {})->setComment("the list of DetIds for new sensors"); + desc.add("src", edm::InputTag("TrackRefitter"))->setComment("input track collections"); + desc.add("ptMin", 3.)->setComment("minimum pt on tracks"); + desc.add("normChi2Max", 2.)->setComment("maximum reduced chi squared"); + desc.add("clustSizeYMin", 4)->setComment("minimum cluster size on Y axis for Layer 1-3"); + desc.add("clustSizeYMinL4", 3)->setComment("minimum cluster size on Y axis for Layer 4"); + desc.add("clustSizeXMax", 5)->setComment("maximum cluster size on X axis"); + desc.add("residualMax", 0.005)->setComment("maximum residual"); + desc.add("clustChargeMaxPerLength", 50000) + ->setComment("maximum cluster charge per unit length of pixel depth (z)"); + desc.add("binsDepth", 50)->setComment("# bins for electron production depth axis"); + desc.add("binsDrift", 200)->setComment("# bins for electron drift axis"); + descriptions.addWithDefaultLabel(desc); +} + +// define this as a plug-in +DEFINE_FWK_MODULE(SiPixelLorentzAnglePCLWorker); diff --git a/CalibTracker/SiPixelLorentzAngle/test/SiPixelLorentzAngleCosmic_cfg.py b/CalibTracker/SiPixelLorentzAngle/test/SiPixelLorentzAngleCosmic_cfg.py index 02327a0895e6f..e42aa66e1e3a4 100644 --- a/CalibTracker/SiPixelLorentzAngle/test/SiPixelLorentzAngleCosmic_cfg.py +++ b/CalibTracker/SiPixelLorentzAngle/test/SiPixelLorentzAngleCosmic_cfg.py @@ -4,7 +4,7 @@ process.load("Configuration.StandardSequences.Services_cff") -process.load("Configuration.StandardSequences.Geometry_cff") +process.load("Configuration.StandardSequences.GeometryDB_cff") process.load("Configuration.StandardSequences.MagneticField_38T_cff") process.load("Configuration.StandardSequences.ReconstructionCosmics_cff") diff --git a/CalibTracker/SiPixelLorentzAngle/test/SiPixelLorentzAngle_cfg.py b/CalibTracker/SiPixelLorentzAngle/test/SiPixelLorentzAngle_cfg.py index 3f40eab89988f..016b2f17c6e2b 100644 --- a/CalibTracker/SiPixelLorentzAngle/test/SiPixelLorentzAngle_cfg.py +++ b/CalibTracker/SiPixelLorentzAngle/test/SiPixelLorentzAngle_cfg.py @@ -4,7 +4,7 @@ process.load("Configuration.StandardSequences.Services_cff") -#process.load("Configuration.StandardSequences.Geometry_cff") +#process.load("Configuration.StandardSequences.GeometryDB_cff") process.load('Configuration/StandardSequences/GeometryExtended_cff') process.load('Configuration.StandardSequences.MagneticField_cff') diff --git a/CalibTracker/SiPixelQuality/plugins/SiPixelStatusHarvester.cc b/CalibTracker/SiPixelQuality/plugins/SiPixelStatusHarvester.cc index 48ea04ec37fa0..b4dc6f87d6684 100644 --- a/CalibTracker/SiPixelQuality/plugins/SiPixelStatusHarvester.cc +++ b/CalibTracker/SiPixelQuality/plugins/SiPixelStatusHarvester.cc @@ -194,7 +194,7 @@ void SiPixelStatusHarvester::dqmEndRun(const edm::Run& iRun, const edm::EventSet } if (debug_ == true) { // only produced for debugging reason cond::Time_t thisIOV = (cond::Time_t)iRun.id().run(); - poolDbService->writeOne(siPixelQualityPermBad, thisIOV, recordName_ + "_permanentBad"); + poolDbService->writeOneIOV(*siPixelQualityPermBad, thisIOV, recordName_ + "_permanentBad"); } // IOV for final payloads. FEDerror25 and pcl @@ -298,7 +298,7 @@ void SiPixelStatusHarvester::dqmEndRun(const edm::Run& iRun, const edm::EventSet fedError25IOV[it->first] = it->first; if (debug_ == true) // only produced for debugging reason - poolDbService->writeOne(siPixelQuality_FEDerror25, thisIOV, recordName_ + "_FEDerror25"); + poolDbService->writeOneIOV(*siPixelQuality_FEDerror25, thisIOV, recordName_ + "_FEDerror25"); delete siPixelQuality_FEDerror25; } @@ -556,12 +556,12 @@ void SiPixelStatusHarvester::dqmEndRun(const edm::Run& iRun, const edm::EventSet edm::LuminosityBlockID lu(iRun.id().run(), endLumiBlock_ + 1); cond::Time_t thisIOV = (cond::Time_t)(lu.value()); if (!SiPixelStatusHarvester::equal(lastPrompt, siPixelQualityPermBad)) - poolDbService->writeOne(siPixelQualityPermBad, thisIOV, recordName_ + "_prompt"); + poolDbService->writeOneIOV(*siPixelQualityPermBad, thisIOV, recordName_ + "_prompt"); // add empty bad components to last lumi+1 IF AND ONLY IF the last payload of other is not equal to empty SiPixelQuality* siPixelQualityDummy = new SiPixelQuality(); if (!SiPixelStatusHarvester::equal(lastOther, siPixelQualityDummy)) - poolDbService->writeOne(siPixelQualityDummy, thisIOV, recordName_ + "_other"); + poolDbService->writeOneIOV(*siPixelQualityDummy, thisIOV, recordName_ + "_other"); delete siPixelQualityDummy; } @@ -657,12 +657,12 @@ void SiPixelStatusHarvester::constructTag(std::map siPixel SiPixelQuality* thisPayload = qIt->second; if (qIt == siPixelQualityTag.begin()) - poolDbService->writeOne(thisPayload, thisIOV, recordName_ + "_" + tagName); + poolDbService->writeOneIOV(*thisPayload, thisIOV, recordName_ + "_" + tagName); else { SiPixelQuality* prevPayload = (std::prev(qIt))->second; if (!SiPixelStatusHarvester::equal(thisPayload, prevPayload)) // only append newIOV if this payload differs wrt last - poolDbService->writeOne(thisPayload, thisIOV, recordName_ + "_" + tagName); + poolDbService->writeOneIOV(*thisPayload, thisIOV, recordName_ + "_" + tagName); } } } diff --git a/CalibTracker/SiPixelTools/interface/SiPixelOfflineCalibAnalysisBase.h b/CalibTracker/SiPixelTools/interface/SiPixelOfflineCalibAnalysisBase.h index d1f6a42240602..921e28b8af7ad 100644 --- a/CalibTracker/SiPixelTools/interface/SiPixelOfflineCalibAnalysisBase.h +++ b/CalibTracker/SiPixelTools/interface/SiPixelOfflineCalibAnalysisBase.h @@ -22,7 +22,7 @@ // user include files #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/ServiceRegistry/interface/Service.h" @@ -57,7 +57,7 @@ // class decleration // -class SiPixelOfflineCalibAnalysisBase : public edm::EDAnalyzer { +class SiPixelOfflineCalibAnalysisBase : public edm::one::EDAnalyzer { public: typedef dqm::legacy::MonitorElement MonitorElement; typedef dqm::legacy::DQMStore DQMStore; @@ -141,7 +141,7 @@ class SiPixelOfflineCalibAnalysisBase : public edm::EDAnalyzer { //the beginJob is used to load the calib database. It then calls the pure //virtual calibrationSetup() function. Derived classes should put beginJob functionality there. void beginRun(const edm::Run&, const edm::EventSetup&) override; - void beginRun(const edm::EventSetup& iSetup); + void endRun(const edm::Run&, const edm::EventSetup&) override; void beginJob() override; //calibrationSetup will be used by derived classes diff --git a/CalibTracker/SiPixelTools/plugins/SiPixelCalibDigiFilter.cc b/CalibTracker/SiPixelTools/plugins/SiPixelCalibDigiFilter.cc index 378fd3632f35b..f81bcf16f5486 100644 --- a/CalibTracker/SiPixelTools/plugins/SiPixelCalibDigiFilter.cc +++ b/CalibTracker/SiPixelTools/plugins/SiPixelCalibDigiFilter.cc @@ -48,11 +48,7 @@ SiPixelCalibDigiFilter::SiPixelCalibDigiFilter(const edm::ParameterSet& iConfig) tPixelCalibDigi = consumes>(edm::InputTag("SiPixelCalibDigiProducer")); } -SiPixelCalibDigiFilter::~SiPixelCalibDigiFilter() { - // do anything here that needs to be done at desctruction time - // (e.g. close files, deallocate resources etc.) -} - +SiPixelCalibDigiFilter::~SiPixelCalibDigiFilter() = default; // // member functions // @@ -63,17 +59,12 @@ bool SiPixelCalibDigiFilter::filter(edm::Event& iEvent, const edm::EventSetup& i Handle> listOfDetIds; iEvent.getByToken(tPixelCalibDigi, listOfDetIds); - if (listOfDetIds->empty()) + if (listOfDetIds->empty()) { return false; - else + } else { return true; + } } -// ------------ method called once each job just before starting event loop ------------ -void SiPixelCalibDigiFilter::beginJob() {} - -// ------------ method called once each job just after ending the event loop ------------ -void SiPixelCalibDigiFilter::endJob() {} - // -- define this as a plug-in DEFINE_FWK_MODULE(SiPixelCalibDigiFilter); diff --git a/CalibTracker/SiPixelTools/plugins/SiPixelCalibDigiFilter.h b/CalibTracker/SiPixelTools/plugins/SiPixelCalibDigiFilter.h index 4b8cef92414d9..91fbcfbf24881 100644 --- a/CalibTracker/SiPixelTools/plugins/SiPixelCalibDigiFilter.h +++ b/CalibTracker/SiPixelTools/plugins/SiPixelCalibDigiFilter.h @@ -21,7 +21,7 @@ // user include files #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDFilter.h" +#include "FWCore/Framework/interface/stream/EDFilter.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/MakerMacros.h" @@ -34,15 +34,13 @@ // class declaration // -class SiPixelCalibDigiFilter : public edm::EDFilter { +class SiPixelCalibDigiFilter : public edm::stream::EDFilter<> { public: explicit SiPixelCalibDigiFilter(const edm::ParameterSet&); ~SiPixelCalibDigiFilter() override; private: - void beginJob() override; bool filter(edm::Event&, const edm::EventSetup&) override; - void endJob() override; // ----------member data --------------------------- edm::EDGetTokenT> tPixelCalibDigi; diff --git a/CalibTracker/SiPixelTools/plugins/SiPixelDQMRocLevelAnalyzer.cc b/CalibTracker/SiPixelTools/plugins/SiPixelDQMRocLevelAnalyzer.cc index 2d4aab41c45b3..704d239f0abc3 100644 --- a/CalibTracker/SiPixelTools/plugins/SiPixelDQMRocLevelAnalyzer.cc +++ b/CalibTracker/SiPixelTools/plugins/SiPixelDQMRocLevelAnalyzer.cc @@ -1,23 +1,13 @@ #include "SiPixelDQMRocLevelAnalyzer.h" -SiPixelDQMRocLevelAnalyzer::SiPixelDQMRocLevelAnalyzer(const edm::ParameterSet &iConfig) : conf_(iConfig) {} +SiPixelDQMRocLevelAnalyzer::SiPixelDQMRocLevelAnalyzer(const edm::ParameterSet &iConfig) : conf_(iConfig) { + usesResource(TFileService::kSharedResource); +} -SiPixelDQMRocLevelAnalyzer::~SiPixelDQMRocLevelAnalyzer() {} +SiPixelDQMRocLevelAnalyzer::~SiPixelDQMRocLevelAnalyzer() = default; // ------------ method called to for each event ------------ -void SiPixelDQMRocLevelAnalyzer::analyze(const edm::Event &iEvent, const edm::EventSetup &iSetup) { - using namespace edm; - -#ifdef THIS_IS_AN_EVENT_EXAMPLE - Handle pIn; - iEvent.getByLabel("example", pIn); -#endif - -#ifdef THIS_IS_AN_EVENTSETUP_EXAMPLE - ESHandle pSetup; - iSetup.get().get(pSetup); -#endif -} +void SiPixelDQMRocLevelAnalyzer::analyze(const edm::Event &iEvent, const edm::EventSetup &iSetup) {} // ------------ method called once each job just before starting event loop ------------ void SiPixelDQMRocLevelAnalyzer::beginJob() { diff --git a/CalibTracker/SiPixelTools/plugins/SiPixelDQMRocLevelAnalyzer.h b/CalibTracker/SiPixelTools/plugins/SiPixelDQMRocLevelAnalyzer.h index 26ab645ed8e45..a89c32b47be59 100644 --- a/CalibTracker/SiPixelTools/plugins/SiPixelDQMRocLevelAnalyzer.h +++ b/CalibTracker/SiPixelTools/plugins/SiPixelDQMRocLevelAnalyzer.h @@ -24,7 +24,7 @@ // user include files #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/MakerMacros.h" @@ -41,7 +41,7 @@ // class decleration // -class SiPixelDQMRocLevelAnalyzer : public edm::EDAnalyzer { +class SiPixelDQMRocLevelAnalyzer : public edm::one::EDAnalyzer { public: typedef dqm::legacy::MonitorElement MonitorElement; typedef dqm::legacy::DQMStore DQMStore; diff --git a/CalibTracker/SiPixelTools/plugins/SiPixelErrorsDigisToCalibDigis.cc b/CalibTracker/SiPixelTools/plugins/SiPixelErrorsDigisToCalibDigis.cc index 299c34e55848e..27494904e8c8d 100644 --- a/CalibTracker/SiPixelTools/plugins/SiPixelErrorsDigisToCalibDigis.cc +++ b/CalibTracker/SiPixelTools/plugins/SiPixelErrorsDigisToCalibDigis.cc @@ -111,9 +111,6 @@ void SiPixelErrorsDigisToCalibDigis::analyze(const edm::Event& iEvent, const edm } // end of the for loop that goes through all plaquettes } -// ------------ method called once each job just before starting event loop ------------ -void SiPixelErrorsDigisToCalibDigis::beginJob() {} - // ------------ method called once each job just after ending the event loop ------------ void SiPixelErrorsDigisToCalibDigis::endJob() { if (!outputFilename_.empty() && createOutputFile_) { diff --git a/CalibTracker/SiPixelTools/plugins/SiPixelErrorsDigisToCalibDigis.h b/CalibTracker/SiPixelTools/plugins/SiPixelErrorsDigisToCalibDigis.h index ec2bee729a42e..15df93f3a6c23 100644 --- a/CalibTracker/SiPixelTools/plugins/SiPixelErrorsDigisToCalibDigis.h +++ b/CalibTracker/SiPixelTools/plugins/SiPixelErrorsDigisToCalibDigis.h @@ -14,7 +14,7 @@ Description: Create monitorElements for the Errors in created in the reduction o // user include files #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/ServiceRegistry/interface/Service.h" @@ -41,7 +41,7 @@ Description: Create monitorElements for the Errors in created in the reduction o // class declaration // -class SiPixelErrorsDigisToCalibDigis : public edm::EDAnalyzer { +class SiPixelErrorsDigisToCalibDigis : public edm::one::EDAnalyzer<> { public: typedef dqm::legacy::MonitorElement MonitorElement; typedef dqm::legacy::DQMStore DQMStore; @@ -71,7 +71,6 @@ class SiPixelErrorsDigisToCalibDigis : public edm::EDAnalyzer { edm::ESGetToken trackerGeomToken_; private: - void beginJob() override; void analyze(const edm::Event&, const edm::EventSetup&) override; void endJob() override; diff --git a/CalibTracker/SiPixelTools/plugins/SiPixelFedFillerWordEventNumber.cc b/CalibTracker/SiPixelTools/plugins/SiPixelFedFillerWordEventNumber.cc index 6d2f45f3eb8de..5c77407fdc2d9 100644 --- a/CalibTracker/SiPixelTools/plugins/SiPixelFedFillerWordEventNumber.cc +++ b/CalibTracker/SiPixelTools/plugins/SiPixelFedFillerWordEventNumber.cc @@ -441,10 +441,5 @@ void SiPixelFedFillerWordEventNumber ::produce(edm::Event& iEvent, const edm::Ev vecFillerWordsEventNumber1.erase(vecFillerWordsEventNumber1.begin(), vecFillerWordsEventNumber1.end()); } -// ------------ method called once each job just before starting event loop ------------ -void SiPixelFedFillerWordEventNumber ::beginJob() {} - -// ------------ method called once each job just after ending the event loop ------------ -void SiPixelFedFillerWordEventNumber ::endJob() {} //===== define this as a plug-in DEFINE_FWK_MODULE(SiPixelFedFillerWordEventNumber); diff --git a/CalibTracker/SiPixelTools/plugins/SiPixelFedFillerWordEventNumber.h b/CalibTracker/SiPixelTools/plugins/SiPixelFedFillerWordEventNumber.h index 5ee9af8d86ccf..2fba45766c22d 100644 --- a/CalibTracker/SiPixelTools/plugins/SiPixelFedFillerWordEventNumber.h +++ b/CalibTracker/SiPixelTools/plugins/SiPixelFedFillerWordEventNumber.h @@ -6,7 +6,7 @@ #include #include #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDProducer.h" +#include "FWCore/Framework/interface/stream/EDProducer.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/MakerMacros.h" @@ -19,7 +19,7 @@ #include "DataFormats/FEDRawData/interface/FEDTrailer.h" //===== class decleration -class SiPixelFedFillerWordEventNumber : public edm::EDProducer { +class SiPixelFedFillerWordEventNumber : public edm::stream::EDProducer<> { public: explicit SiPixelFedFillerWordEventNumber(const edm::ParameterSet &); ~SiPixelFedFillerWordEventNumber() override; @@ -28,9 +28,7 @@ class SiPixelFedFillerWordEventNumber : public edm::EDProducer { bool SaveFillerWordsbool; private: - void beginJob() override; void produce(edm::Event &, const edm::EventSetup &) override; - void endJob() override; edm::ParameterSet config_; int status; unsigned int EventNum; diff --git a/CalibTracker/SiPixelTools/src/SiPixelOfflineCalibAnalysisBase.cc b/CalibTracker/SiPixelTools/src/SiPixelOfflineCalibAnalysisBase.cc index 2d96f81d7fa41..c3fa27c669c1a 100644 --- a/CalibTracker/SiPixelTools/src/SiPixelOfflineCalibAnalysisBase.cc +++ b/CalibTracker/SiPixelTools/src/SiPixelOfflineCalibAnalysisBase.cc @@ -131,6 +131,9 @@ void SiPixelOfflineCalibAnalysisBase::beginRun(const edm::Run&, const edm::Event this->calibrationSetup(iSetup); theHistogramIdWorker_ = new SiPixelHistogramId(siPixelCalibDigiProducer_.label()); } + +void SiPixelOfflineCalibAnalysisBase::endRun(const edm::Run&, const edm::EventSetup& iSetup) {} + void SiPixelOfflineCalibAnalysisBase::beginJob() {} // ------------ method called once each job just before starting event loop ------------ diff --git a/CalibTracker/SiStripChannelGain/test/SSTGain_PCL_Config_cfg.py b/CalibTracker/SiStripChannelGain/test/SSTGain_PCL_Config_cfg.py index d67f208006f2d..a39d3607cfb1d 100644 --- a/CalibTracker/SiStripChannelGain/test/SSTGain_PCL_Config_cfg.py +++ b/CalibTracker/SiStripChannelGain/test/SSTGain_PCL_Config_cfg.py @@ -2,7 +2,7 @@ process = cms.Process("APVGAIN") -process.load('Configuration.StandardSequences.Geometry_cff') +process.load('Configuration.StandardSequences.GeometryDB_cff') process.load('Configuration.StandardSequences.MagneticField_cff') process.load("Geometry.CMSCommonData.cmsIdealGeometryXML_cfi") process.load("Geometry.TrackerGeometryBuilder.trackerGeometry_cfi") diff --git a/CalibTracker/SiStripCommon/BuildFile.xml b/CalibTracker/SiStripCommon/BuildFile.xml index 17b87a3ad87ae..48d76ab54c886 100644 --- a/CalibTracker/SiStripCommon/BuildFile.xml +++ b/CalibTracker/SiStripCommon/BuildFile.xml @@ -2,14 +2,18 @@ + + + + diff --git a/CalibTracker/SiStripCommon/interface/SiStripOnTrackClusterTableProducerBase.h b/CalibTracker/SiStripCommon/interface/SiStripOnTrackClusterTableProducerBase.h new file mode 100644 index 0000000000000..4dec2d9591a6c --- /dev/null +++ b/CalibTracker/SiStripCommon/interface/SiStripOnTrackClusterTableProducerBase.h @@ -0,0 +1,56 @@ +#include "FWCore/Framework/interface/stream/EDProducer.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" + +#include "DataFormats/NanoAOD/interface/FlatTable.h" +#include "DataFormats/SiStripCluster/interface/SiStripCluster.h" +#include "DataFormats/TrackReco/interface/Track.h" +#include "TrackingTools/PatternTools/interface/TrajTrackAssociation.h" + +class SiStripOnTrackClusterTableProducerBase : public edm::stream::EDProducer<> { +public: + explicit SiStripOnTrackClusterTableProducerBase(const edm::ParameterSet& params) + : m_name(params.getParameter("name")), + m_doc(params.existsAs("doc") ? params.getParameter("doc") : ""), + m_extension(params.existsAs("extension") ? params.getParameter("extension") : true), + m_tracks_token(consumes>(params.getParameter("Tracks"))), + m_association_token(consumes(params.getParameter("Tracks"))) { + produces(); + } + ~SiStripOnTrackClusterTableProducerBase() override; + + void produce(edm::Event& iEvent, const edm::EventSetup& iSetup) final; + + struct OnTrackCluster { + uint32_t det; + const SiStripCluster* cluster; + const Trajectory* traj; + const reco::Track* track; + const TrajectoryMeasurement& measurement; + OnTrackCluster(uint32_t detId, + const SiStripCluster* stripCluster, + const Trajectory* trajectory, + const reco::Track* track_, + const TrajectoryMeasurement& measurement_) + : det{detId}, cluster{stripCluster}, traj{trajectory}, track{track_}, measurement{measurement_} {} + }; + + virtual void fillTable(const std::vector& clusters, + const edm::View& tracks, + nanoaod::FlatTable* table, + const edm::EventSetup& iSetup) = 0; + + template + static void addColumn(nanoaod::FlatTable* table, const std::string& name, VALUES&& values, const std::string& doc) { + using value_type = typename std::remove_reference::type::value_type; + table->template addColumn(name, values, doc); + } + +private: + const std::string m_name; + const std::string m_doc; + bool m_extension; + + const edm::EDGetTokenT> m_tracks_token; + const edm::EDGetTokenT m_association_token; +}; diff --git a/CalibTracker/SiStripCommon/plugins/BuildFile.xml b/CalibTracker/SiStripCommon/plugins/BuildFile.xml index 039a07453e59c..64a3dcae11884 100644 --- a/CalibTracker/SiStripCommon/plugins/BuildFile.xml +++ b/CalibTracker/SiStripCommon/plugins/BuildFile.xml @@ -9,6 +9,7 @@ + diff --git a/CalibTracker/SiStripCommon/plugins/SealModules.cc b/CalibTracker/SiStripCommon/plugins/SealModules.cc index 6613d45b91294..1bafc65ef6f88 100644 --- a/CalibTracker/SiStripCommon/plugins/SealModules.cc +++ b/CalibTracker/SiStripCommon/plugins/SealModules.cc @@ -1,10 +1,6 @@ #include "FWCore/PluginManager/interface/ModuleDef.h" #include "FWCore/Framework/interface/MakerMacros.h" -#include "CalibTracker/SiStripCommon/plugins/SiStripDetInfoFileWriter.h" - -DEFINE_FWK_MODULE(SiStripDetInfoFileWriter); - #include "ShallowTree.h" #include "ShallowEventDataProducer.h" #include "ShallowDigisProducer.h" @@ -24,3 +20,7 @@ DEFINE_FWK_MODULE(ShallowSimhitClustersProducer); DEFINE_FWK_MODULE(ShallowTracksProducer); DEFINE_FWK_MODULE(ShallowSimTracksProducer); DEFINE_FWK_MODULE(ShallowGainCalibration); + +#include "PhysicsTools/NanoAOD/interface/SimpleFlatTableProducer.h" +typedef SimpleFlatTableProducer SimpleTrackFlatTableProducer; +DEFINE_FWK_MODULE(SimpleTrackFlatTableProducer); diff --git a/CalibTracker/SiStripCommon/plugins/SiStripDetInfoFileWriter.cc b/CalibTracker/SiStripCommon/plugins/SiStripDetInfoFileWriter.cc index 9aa18d1401659..e85d85cf9a99c 100644 --- a/CalibTracker/SiStripCommon/plugins/SiStripDetInfoFileWriter.cc +++ b/CalibTracker/SiStripCommon/plugins/SiStripDetInfoFileWriter.cc @@ -1,16 +1,52 @@ // -*- C++ -*- -// Package: SiStripCommon +// +// Package: SiStripDetInfoFileWriter // Class: SiStripDetInfoFileWriter -// Original Author: G. Bruno -// Created: Mon May 20 10:04:31 CET 2007 +// +/**\class SiStripDetInfoFileWriter SiStripDetInfoFileWriter.cc CalibTracker/SiStripCommon/src/SiStripDetInfoFileWriter.cc + + Description: -#include "CalibTracker/SiStripCommon/plugins/SiStripDetInfoFileWriter.h" + Implementation: + +*/ +// +// Original Author: G. Bruno +// Created: Mon Nov 20 10:04:31 CET 2006 +// +// + +// C++ includes +#include +#include +#include + +// User includes +#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" - #include "Geometry/CommonDetUnit/interface/GeomDet.h" #include "Geometry/CommonTopologies/interface/StripTopology.h" +#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" #include "Geometry/TrackerGeometryBuilder/interface/StripGeomDetUnit.h" +#include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" + +class SiStripDetInfoFileWriter : public edm::one::EDAnalyzer { +public: + explicit SiStripDetInfoFileWriter(const edm::ParameterSet&); + ~SiStripDetInfoFileWriter() override; + +private: + void beginRun(const edm::Run&, const edm::EventSetup& iSetup) override; + void analyze(const edm::Event&, const edm::EventSetup&) override{}; + void endRun(const edm::Run&, const edm::EventSetup& iSetup) override{}; + +private: + std::ofstream outputFile_; + std::string filePath_; + edm::ESGetToken tkGeomToken_; +}; using namespace cms; using namespace std; @@ -55,13 +91,11 @@ void SiStripDetInfoFileWriter::beginRun(const edm::Run&, const edm::EventSetup& outputFile_ << detid << " " << numberOfAPVs << " " << stripLength << " " << thickness << "\n"; } } - outputFile_.close(); - - } - - else { + } else { edm::LogError("SiStripDetInfoFileWriter::beginRun - Unable to open file") << endl; return; } } + +DEFINE_FWK_MODULE(SiStripDetInfoFileWriter); diff --git a/CalibTracker/SiStripCommon/plugins/SiStripDetInfoFileWriter.h b/CalibTracker/SiStripCommon/plugins/SiStripDetInfoFileWriter.h deleted file mode 100644 index fd3d1353abc43..0000000000000 --- a/CalibTracker/SiStripCommon/plugins/SiStripDetInfoFileWriter.h +++ /dev/null @@ -1,44 +0,0 @@ -#ifndef CalibTracker_SiStripChannelGain_SiStripDetInfoFileWriter_h -#define CalibTracker_SiStripChannelGain_SiStripDetInfoFileWriter_h -// -*- C++ -*- -// -// Package: SiStripDetInfoFileWriter -// Class: SiStripDetInfoFileWriter -// -/**\class SiStripDetInfoFileWriter SiStripDetInfoFileWriter.cc CalibTracker/SiStripCommon/src/SiStripDetInfoFileWriter.cc - - Description: - - Implementation: - -*/ -// -// Original Author: G. Bruno -// Created: Mon Nov 20 10:04:31 CET 2006 -// -// - -#include "FWCore/Framework/interface/EDAnalyzer.h" -#include -#include -#include - -#include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" -#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" - -class SiStripDetInfoFileWriter : public edm::EDAnalyzer { -public: - explicit SiStripDetInfoFileWriter(const edm::ParameterSet&); - ~SiStripDetInfoFileWriter() override; - -private: - void beginRun(const edm::Run&, const edm::EventSetup& iSetup) override; - - void analyze(const edm::Event&, const edm::EventSetup&) override{}; - -private: - std::ofstream outputFile_; - std::string filePath_; - edm::ESGetToken tkGeomToken_; -}; -#endif diff --git a/CalibTracker/SiStripCommon/plugins/SiStripLorentzAngleRunInfoTableProducer.cc b/CalibTracker/SiStripCommon/plugins/SiStripLorentzAngleRunInfoTableProducer.cc new file mode 100644 index 0000000000000..7e09ef4f58a7a --- /dev/null +++ b/CalibTracker/SiStripCommon/plugins/SiStripLorentzAngleRunInfoTableProducer.cc @@ -0,0 +1,107 @@ +#include "FWCore/Framework/interface/global/EDProducer.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" +#include "DataFormats/NanoAOD/interface/FlatTable.h" + +#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" +#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" + +#include "MagneticField/Engine/interface/MagneticField.h" +#include "MagneticField/Records/interface/IdealMagneticFieldRecord.h" +#include "CondFormats/SiStripObjects/interface/SiStripLorentzAngle.h" +#include "CalibTracker/Records/interface/SiStripDependentRecords.h" +#include "Geometry/TrackerGeometryBuilder/interface/StripGeomDetUnit.h" +#include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" +#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" + +#include "CalibTracker/SiStripCommon/interface/ShallowTools.h" + +class SiStripLorentzAngleRunInfoTableProducer : public edm::global::EDProducer { +public: + explicit SiStripLorentzAngleRunInfoTableProducer(const edm::ParameterSet& params) + : m_name{params.getParameter("name")}, + m_magFieldName{params.getParameter("magFieldName")}, + m_doc{params.existsAs("doc") ? params.getParameter("doc") : ""}, + m_tkGeomToken{esConsumes()}, + m_magFieldToken{esConsumes()}, + m_lorentzAngleToken{esConsumes()} { + produces(); + produces("magField"); + } + + void produce(edm::StreamID, edm::Event&, edm::EventSetup const&) const override {} + + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + desc.add("name", "Det"); + desc.add("magFieldName", "magField"); + desc.add("doc", "Run info for the Lorentz angle measurement"); + descriptions.add("siStripLorentzAngleRunInfoTable", desc); + } + + void globalBeginRunProduce(edm::Run& iRun, edm::EventSetup const& iSetup) const override; + +private: + const std::string m_name, m_magFieldName; + const std::string m_doc; + edm::ESGetToken m_tkGeomToken; + edm::ESGetToken m_magFieldToken; + edm::ESGetToken m_lorentzAngleToken; +}; + +namespace { + template + void addColumn(nanoaod::FlatTable* table, const std::string& name, VALUES&& values, const std::string& doc) { + using value_type = typename std::remove_reference::type::value_type; + table->template addColumn(name, values, doc); + } +} // namespace + +void SiStripLorentzAngleRunInfoTableProducer::globalBeginRunProduce(edm::Run& iRun, + edm::EventSetup const& iSetup) const { + const auto& tkGeom = iSetup.getData(m_tkGeomToken); + const auto& magField = iSetup.getData(m_magFieldToken); + const auto& lorentzAngle = iSetup.getData(m_lorentzAngleToken); + std::vector c_rawid; + std::vector c_globalZofunitlocalY, c_localB, c_BdotY, c_driftx, c_drifty, c_driftz, c_lorentzAngle; + + auto dets = tkGeom.detsTIB(); + dets.insert(dets.end(), tkGeom.detsTID().begin(), tkGeom.detsTID().end()); + dets.insert(dets.end(), tkGeom.detsTOB().begin(), tkGeom.detsTOB().end()); + dets.insert(dets.end(), tkGeom.detsTEC().begin(), tkGeom.detsTEC().end()); + for (auto det : dets) { + auto detid = det->geographicalId().rawId(); + const StripGeomDetUnit* stripDet = dynamic_cast(tkGeom.idToDet(det->geographicalId())); + if (stripDet) { + c_rawid.push_back(detid); + c_globalZofunitlocalY.push_back(stripDet->toGlobal(LocalVector(0, 1, 0)).z()); + const auto locB = magField.inTesla(stripDet->surface().position()); + c_localB.push_back(locB.mag()); + c_BdotY.push_back(stripDet->surface().toLocal(locB).y()); + const auto drift = shallow::drift(stripDet, magField, lorentzAngle); + c_driftx.push_back(drift.x()); + c_drifty.push_back(drift.y()); + c_driftz.push_back(drift.z()); + c_lorentzAngle.push_back(lorentzAngle.getLorentzAngle(detid)); + } + } + auto out = std::make_unique(c_rawid.size(), m_name, false, false); + addColumn(out.get(), "rawid", c_rawid, "DetId"); + addColumn(out.get(), "globalZofunitlocalY", c_globalZofunitlocalY, "z component of a local unit vector along y"); + addColumn(out.get(), "localB", c_localB, "Local magnitude of the magnetic field"); + addColumn(out.get(), "BdotY", c_BdotY, "Magnetic field projection on the local y axis"); + addColumn(out.get(), "driftx", c_driftx, "x component of the drift vector"); + addColumn(out.get(), "drifty", c_drifty, "y component of the drift vector"); + addColumn(out.get(), "driftz", c_driftz, "z component of the drift vector"); + addColumn(out.get(), "lorentzAngle", c_lorentzAngle, "Lorentz angle from database"); + iRun.put(std::move(out)); + + auto out2 = std::make_unique(1, m_magFieldName, true, false); + out2->addColumnValue( + "origin", magField.inTesla(GlobalPoint(0, 0, 0)).z(), "z-component of the magnetic field at (0,0,0) in Tesla"); + iRun.put(std::move(out2), "magField"); +} + +#include "FWCore/PluginManager/interface/ModuleDef.h" +#include "FWCore/Framework/interface/MakerMacros.h" +DEFINE_FWK_MODULE(SiStripLorentzAngleRunInfoTableProducer); diff --git a/CalibTracker/SiStripCommon/plugins/SiStripPositionCorrectionsTableProducer.cc b/CalibTracker/SiStripCommon/plugins/SiStripPositionCorrectionsTableProducer.cc new file mode 100644 index 0000000000000..1f7d93008807f --- /dev/null +++ b/CalibTracker/SiStripCommon/plugins/SiStripPositionCorrectionsTableProducer.cc @@ -0,0 +1,75 @@ +#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" +#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" + +#include "Geometry/TrackerGeometryBuilder/interface/StripGeomDetUnit.h" +#include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" +#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" + +#include "RecoLocalTracker/SiStripClusterizer/interface/SiStripClusterInfo.h" + +#include "CalibTracker/SiStripCommon/interface/SiStripOnTrackClusterTableProducerBase.h" + +class SiStripPositionCorrectionsTableProducer : public SiStripOnTrackClusterTableProducerBase { +public: + explicit SiStripPositionCorrectionsTableProducer(const edm::ParameterSet& params) + : SiStripOnTrackClusterTableProducerBase(params), + m_clusterInfo(consumesCollector()), + m_tkGeomToken{esConsumes<>()} {} + + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + desc.add("name", "cluster"); + desc.add("doc", "On-track cluster properties for Lorentz angle and backplane correction measurement"); + desc.add("extension", false); + desc.add("Tracks", edm::InputTag{"generalTracks"}); + descriptions.add("siStripPositionCorrectionsTable", desc); + } + + void fillTable(const std::vector& clusters, + const edm::View& tracks, + nanoaod::FlatTable* table, + const edm::EventSetup& iSetup) final; + +private: + SiStripClusterInfo m_clusterInfo; + edm::ESGetToken m_tkGeomToken; +}; + +void SiStripPositionCorrectionsTableProducer::fillTable(const std::vector& clusters, + const edm::View& tracks, + nanoaod::FlatTable* table, + const edm::EventSetup& iSetup) { + const auto& tkGeom = iSetup.getData(m_tkGeomToken); + std::vector c_nstrips; + std::vector c_barycenter, c_variance, c_localdirx, c_localdiry, c_localdirz, c_localx, c_rhlocalx, + c_rhlocalxerr; + for (const auto clus : clusters) { + c_nstrips.push_back(clus.cluster->amplitudes().size()); + m_clusterInfo.setCluster(*clus.cluster, clus.det); + c_variance.push_back(m_clusterInfo.variance()); + const auto& trajState = clus.measurement.updatedState(); + const auto trackDir = trajState.localDirection(); + c_localdirx.push_back(trackDir.x()); + c_localdiry.push_back(trackDir.y()); + c_localdirz.push_back(trackDir.z()); + const auto hit = clus.measurement.recHit()->hit(); + const auto stripDet = dynamic_cast(tkGeom.idToDet(hit->geographicalId())); + c_barycenter.push_back(stripDet->specificTopology().localPosition(clus.cluster->barycenter()).x()); + c_localx.push_back(stripDet->toLocal(trajState.globalPosition()).x()); + c_rhlocalx.push_back(hit->localPosition().x()); + c_rhlocalxerr.push_back(hit->localPositionError().xx()); + } + addColumn(table, "nstrips", c_nstrips, "cluster width"); + addColumn(table, "variance", c_variance, "Cluster variance"); + addColumn(table, "localdirx", c_localdirx, "x component of the local track direction"); + addColumn(table, "localdiry", c_localdiry, "y component of the local track direction"); + addColumn(table, "localdirz", c_localdirz, "z component of the local track direction"); + addColumn(table, "barycenter", c_barycenter, "Cluster barycenter (local x without corrections)"); + addColumn(table, "localx", c_localx, "Track local x"); + addColumn(table, "rhlocalx", c_rhlocalx, "RecHit local x"); + addColumn(table, "rhlocalxerr", c_rhlocalxerr, "RecHit local x uncertainty"); +} + +#include "FWCore/PluginManager/interface/ModuleDef.h" +#include "FWCore/Framework/interface/MakerMacros.h" +DEFINE_FWK_MODULE(SiStripPositionCorrectionsTableProducer); diff --git a/CalibTracker/SiStripCommon/python/customiseAlCaNano.py b/CalibTracker/SiStripCommon/python/customiseAlCaNano.py new file mode 100644 index 0000000000000..be3b05384ae5f --- /dev/null +++ b/CalibTracker/SiStripCommon/python/customiseAlCaNano.py @@ -0,0 +1,15 @@ +import FWCore.ParameterSet.Config as cms + +def outputToFlat(process, outputName): + """ Replace PoolOutputModule by NanoAODOutputModule to get NanoAOD-like (flat tree) output without merging step """ + orig = getattr(process, outputName) + setattr(process, outputName, + cms.OutputModule("NanoAODOutputModule", **{ + pn: orig.getParameter(pn) for pn in orig.parameterNames_() + if pn != "eventAutoFlushCompressedSize" + }) + ) + return process + +def flatSiStripCalCosmicsNano(process): + return outputToFlat(process, "ALCARECOStreamSiStripCalCosmicsNano") diff --git a/CalibTracker/SiStripCommon/src/SiStripOnTrackClusterTableProducerBase.cc b/CalibTracker/SiStripCommon/src/SiStripOnTrackClusterTableProducerBase.cc new file mode 100644 index 0000000000000..36e8804a3e88e --- /dev/null +++ b/CalibTracker/SiStripCommon/src/SiStripOnTrackClusterTableProducerBase.cc @@ -0,0 +1,68 @@ +#include "DataFormats/TrackerRecHit2D/interface/SiStripMatchedRecHit2D.h" +#include "DataFormats/TrackerRecHit2D/interface/SiStripRecHit2D.h" +#include "DataFormats/TrackerRecHit2D/interface/SiStripRecHit1D.h" + +#include "CalibTracker/SiStripCommon/interface/SiStripOnTrackClusterTableProducerBase.h" + +SiStripOnTrackClusterTableProducerBase::~SiStripOnTrackClusterTableProducerBase() {} + +namespace { + int findTrackIndex(const edm::View& tracks, const reco::Track* track) { + for (auto iTr = tracks.begin(); iTr != tracks.end(); ++iTr) { + if (&(*iTr) == track) { + return iTr - tracks.begin(); + } + } + return -2; + } +} // namespace + +void SiStripOnTrackClusterTableProducerBase::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { + edm::Handle> tracks; + iEvent.getByToken(m_tracks_token, tracks); + edm::Handle trajTrackAssociations; + iEvent.getByToken(m_association_token, trajTrackAssociations); + + std::vector clusters{}; + + for (const auto& assoc : *trajTrackAssociations) { + const auto traj = assoc.key.get(); + const auto track = assoc.val.get(); + + for (const auto& meas : traj->measurements()) { + const auto& trajState = meas.updatedState(); + if (!trajState.isValid()) + continue; + + // there can be 2 (stereo module), 1 (no stereo module), or 0 (no strip hit) clusters per measurement + const auto trechit = meas.recHit()->hit(); + const auto simple1d = dynamic_cast(trechit); + const auto simple = dynamic_cast(trechit); + const auto matched = dynamic_cast(trechit); + if (matched) { + clusters.emplace_back(matched->monoId(), &matched->monoCluster(), traj, track, meas); + clusters.emplace_back(matched->stereoId(), &matched->stereoCluster(), traj, track, meas); + } else if (simple) { + clusters.emplace_back(simple->geographicalId().rawId(), simple->cluster().get(), traj, track, meas); + } else if (simple1d) { + clusters.emplace_back(simple1d->geographicalId().rawId(), simple1d->cluster().get(), traj, track, meas); + } + } + } + + auto out = std::make_unique(clusters.size(), m_name, false, m_extension); + if (!m_extension) { + std::vector c_trackindex; + c_trackindex.reserve(clusters.size()); + std::vector c_rawid; + c_rawid.reserve(clusters.size()); + for (const auto clus : clusters) { + c_trackindex.push_back(findTrackIndex(*tracks, clus.track)); + c_rawid.push_back(clus.det); + } + addColumn(out.get(), "trackindex", c_trackindex, "Track index"); + addColumn(out.get(), "rawid", c_rawid, "DetId"); + } + fillTable(clusters, *tracks, out.get(), iSetup); + iEvent.put(std::move(out)); +} diff --git a/CalibTracker/SiStripCommon/test/MakeCalibrationTrees/produceCalibrationTree_CosmicsLABP_cfg.py b/CalibTracker/SiStripCommon/test/MakeCalibrationTrees/produceCalibrationTree_CosmicsLABP_cfg.py new file mode 100644 index 0000000000000..bc5062a7a833b --- /dev/null +++ b/CalibTracker/SiStripCommon/test/MakeCalibrationTrees/produceCalibrationTree_CosmicsLABP_cfg.py @@ -0,0 +1,173 @@ +from __future__ import print_function +import FWCore.ParameterSet.Config as cms +from FWCore.ParameterSet.VarParsing import VarParsing + +################################################################### +# Setup 'standard' options +################################################################### +options = VarParsing() + +options.register('conditionGT', + "auto:run2_data", + VarParsing.multiplicity.singleton, + VarParsing.varType.string, + "condition global tag for the job (\"auto:run2_data\" is default)") + +options.register('conditionOverwrite', + "", + VarParsing.multiplicity.singleton, + VarParsing.varType.string, + "configuration to overwrite the condition into the GT (\"\" is default)") + +options.register('inputCollection', + "ALCARECOSiStripCalMinBias", + VarParsing.multiplicity.singleton, + VarParsing.varType.string, + "collections to be used for input (\"ALCARECOSiStripCalMinBias\" is default, use 'generalTracks' for prompt reco and 'ctfWithMaterialTracksP5' for cosmic reco)") + +options.register('outputFile', + "calibTreeTest.root", + VarParsing.multiplicity.singleton, + VarParsing.varType.string, + "name for the output root file (\"calibTreeTest.root\" is default)") + +options.register('inputFiles', + '/store/data/Run2018D/Cosmics/ALCARECO/SiStripCalCosmics-UL18-v1/40000/0346DCE4-0C70-1344-A7EB-D488B627208C.root', + VarParsing.multiplicity.list, + VarParsing.varType.string, + "file to process") + +options.register('maxEvents', + -1, + VarParsing.multiplicity.singleton, + VarParsing.varType.int, + "number of events to process (\"-1\" for all)") + +options.register('runNumber', + -1, + VarParsing.multiplicity.singleton, + VarParsing.varType.int, + "run number to process (\"-1\" for all)") + +options.register('cosmicTriggers', '', + VarParsing.multiplicity.list, + VarParsing.varType.string, + 'cosmic triggers') + +options.parseArguments() +################################################################### +# To use the prompt reco dataset please use 'generalTracks' as inputCollection +# To use the cosmic reco dataset please use 'ctfWithMaterialTracksP5' as inputCollection + + +process = cms.Process('CALIB') +process.load('Configuration/StandardSequences/MagneticField_cff') +process.load('Configuration.Geometry.GeometryRecoDB_cff') +process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff') + +from Configuration.AlCa.GlobalTag import GlobalTag +process.GlobalTag = GlobalTag(process.GlobalTag, options.conditionGT, options.conditionOverwrite) + +process.load('FWCore.MessageService.MessageLogger_cfi') +process.load('Configuration.StandardSequences.Services_cff') + +process.maxEvents = cms.untracked.PSet(input=cms.untracked.int32(options.maxEvents)) + +process.source = cms.Source("PoolSource", fileNames=cms.untracked.vstring(options.inputFiles)) +if options.runNumber != -1: + if 'Cosmics' not in options.inputCollection: + print("Restricting to the following events :") + print('%s:1-%s:MAX'%(options.runNumber,options.runNumber)) + process.source.eventsToProcess = cms.untracked.VEventRange('%s:1-%s:MAX'%(options.runNumber,options.runNumber)) + else: + print("Restricting to the following lumis for Cosmic runs only:") + print('%s:1-%s:MAX'%(options.runNumber,options.runNumber)) + process.source.lumisToProcess = cms.untracked.VLuminosityBlockRange('%s:1-%s:MAX'%(options.runNumber,options.runNumber)) + +process.options = cms.untracked.PSet( + wantSummary = cms.untracked.bool(True) + ) +process.MessageLogger.cerr.FwkReport.reportEvery = 10000 + +inTracks = cms.InputTag(options.inputCollection) + +process.load('CalibTracker.SiStripCommon.prescaleEvent_cfi') +process.load('CalibTracker.Configuration.Filter_Refit_cff') +## use CalibrationTracks (for clusters) and CalibrationTracksRefit (for tracks) +process.CalibrationTracks.src = inTracks +tracksForCalib = cms.InputTag("CalibrationTracksRefit") + +process.prescaleEvent.prescale = 1 +process.load("CalibTracker.SiStripCommon.SiStripBFieldFilter_cfi") + +from HLTrigger.HLTfilters.triggerResultsFilter_cfi import triggerResultsFilter + +process.IsolatedMuonFilter = triggerResultsFilter.clone( + triggerConditions = cms.vstring("HLT_IsoMu20_*"), + hltResults = cms.InputTag("TriggerResults", "", "HLT"), + l1tResults = cms.InputTag(""), + throw = cms.bool(False) + ) +if len(options.cosmicTriggers) > 0: + print("Cosmic triggers: {0}".format(", ".join(options.cosmicTriggers))) + process.IsolatedMuonFilter.triggerConditions = cms.vstring(options.cosmicTriggers) +else: + print("Cosmic triggers: {0} (default)".format(", ".join(process.IsolatedMuonFilter.triggerConditions))) + print("Argument passed: {0}".format(options.cosmicTriggers)) + +process.TkCalSeq = cms.Sequence( + process.prescaleEvent* + process.IsolatedMuonFilter* + process.siStripBFieldOnFilter* + process.CalibrationTracks, + cms.Task(process.MeasurementTrackerEvent), + cms.Task(process.offlineBeamSpot), + cms.Task(process.CalibrationTracksRefit) + ) + +process.load("PhysicsTools.NanoAOD.nano_cff") +process.load("PhysicsTools.NanoAOD.NanoAODEDMEventContent_cff") + +## as a test: it should be possible to add tracks fully at configuration level (+ declaring the plugin) +from PhysicsTools.NanoAOD.common_cff import * +## this is equivalent to ShallowTrackProducer as configured for the gain calibration +process.tracksTable = cms.EDProducer("SimpleTrackFlatTableProducer", + src=tracksForCalib, + cut=cms.string(""), + name=cms.string("track"), + doc=cms.string("SiStripCalMinBias ALCARECO tracks"), + singleton=cms.bool(False), + extension=cms.bool(False), + variables=cms.PSet( + chi2ndof=Var("chi2()/ndof", float), + pt=Var("pt()", float), + hitsvalid=Var("numberOfValidHits()", int), ## unsigned? + phi=Var("phi()", float), + eta=Var("eta()", float), + ) + ) +process.load("CalibTracker.SiStripCommon.siStripPositionCorrectionsTable_cfi") +process.siStripPositionCorrectionsTable.Tracks = tracksForCalib +process.load("CalibTracker.SiStripCommon.siStripLorentzAngleRunInfoTable_cfi") + +siStripCalCosmicsNanoTables = cms.Task( + process.nanoMetadata, + process.tracksTable, + process.siStripPositionCorrectionsTable, + process.siStripLorentzAngleRunInfoTable + ) + +process.nanoCTPath = cms.Path(process.TkCalSeq, siStripCalCosmicsNanoTables) + +process.out = cms.OutputModule("NanoAODOutputModule", + fileName=cms.untracked.string(options.outputFile), + outputCommands=process.NANOAODEventContent.outputCommands+[ + "drop edmTriggerResults_*_*_*" + ], + SelectEvents=cms.untracked.PSet( + SelectEvents=cms.vstring("nanoCTPath") + ) + ) +process.end = cms.EndPath(process.out) + +process.schedule = cms.Schedule(process.nanoCTPath, process.end) diff --git a/CalibTracker/SiStripDCS/plugins/FilterTrackerOn.cc b/CalibTracker/SiStripDCS/plugins/FilterTrackerOn.cc index 7f490897bdf12..7c8d1ed6c6cb3 100644 --- a/CalibTracker/SiStripDCS/plugins/FilterTrackerOn.cc +++ b/CalibTracker/SiStripDCS/plugins/FilterTrackerOn.cc @@ -1,31 +1,74 @@ -#include "CalibTracker/SiStripDCS/plugins/FilterTrackerOn.h" +// -*- C++ -*- +// +// Package: CalibTracker/SiStripDCS/plugins +// Class: FilterTrackerOn +// +/**\class FilterTrackerOn FilterTrackerOn.cc -#include "FWCore/Framework/interface/EventSetup.h" + Description: EDFilter returning true when the number of modules with HV on in the Tracker is + above a given threshold. + +*/ +// +// Original Author: Marco DE MATTIA +// Created: 2010/03/10 10:51:00 +// +// +// system include files +#include #include #include +// user include files +#include "CondFormats/DataRecord/interface/SiStripCondDataRecords.h" +#include "CondFormats/SiStripObjects/interface/SiStripDetVOff.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/Framework/interface/stream/EDFilter.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" + +class FilterTrackerOn : public edm::stream::EDFilter<> { +public: + explicit FilterTrackerOn(const edm::ParameterSet&); + static void fillDescriptions(edm::ConfigurationDescriptions&); + ~FilterTrackerOn() override; + +private: + bool filter(edm::Event&, const edm::EventSetup&) override; + + int minModulesWithHVoff_; + edm::ESGetToken detVOffToken_; +}; + FilterTrackerOn::FilterTrackerOn(const edm::ParameterSet& iConfig) : minModulesWithHVoff_(iConfig.getParameter("MinModulesWithHVoff")), detVOffToken_(esConsumes()) {} -FilterTrackerOn::~FilterTrackerOn() {} +FilterTrackerOn::~FilterTrackerOn() = default; + +void FilterTrackerOn::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + desc.setComment("Filters out events in which at least a fraction of Tracker is DCS ON"); + desc.addUntracked("MinModulesWithHVoff", 0); + descriptions.addWithDefaultLabel(desc); +} bool FilterTrackerOn::filter(edm::Event& iEvent, const edm::EventSetup& iSetup) { using namespace edm; - const auto& detVOff = iSetup.getData(detVOffToken_); - // std::cout << "detVOff.getHVoffCounts() = " << detVOff.getHVoffCounts() << " < " << minModulesWithHVoff_; + LogDebug("FilterTrackerOn") << "detVOff.getHVoffCounts() = " << detVOff.getHVoffCounts() << " < " + << minModulesWithHVoff_; if (detVOff.getHVoffCounts() > minModulesWithHVoff_) { - // std::cout << " skipping event" << std::endl; + LogDebug("FilterTrackerOn") << " skipping event"; return false; } - // cout << " keeping event" << endl; + LogDebug("FilterTrackerOn") << " keeping event"; return true; } -// ------------ method called once each job just before starting event loop ------------ -void FilterTrackerOn::beginJob() {} - -// ------------ method called once each job just after ending the event loop ------------ -void FilterTrackerOn::endJob() {} +// EDFilter on the max number of modules with HV off +DEFINE_FWK_MODULE(FilterTrackerOn); diff --git a/CalibTracker/SiStripDCS/plugins/FilterTrackerOn.h b/CalibTracker/SiStripDCS/plugins/FilterTrackerOn.h deleted file mode 100644 index 8dec5dd9d7269..0000000000000 --- a/CalibTracker/SiStripDCS/plugins/FilterTrackerOn.h +++ /dev/null @@ -1,45 +0,0 @@ -// -*- C++ -*- -// -// Package: CalibTracker/SiStripDCS/plugins -// Class: SyncDCSO2O -// -/**\class FilterTrackerOn FilterTrackerOn.cc - - Description: EDFilter returning true when the number of modules with HV on in the Tracker is - above a given threshold. - -*/ -// -// Original Author: Marco DE MATTIA -// Created: 2010/03/10 10:51:00 -// -// - -// system include files -#include - -// user include files -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDFilter.h" - -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/MakerMacros.h" - -#include "FWCore/ParameterSet/interface/ParameterSet.h" - -#include "CondFormats/SiStripObjects/interface/SiStripDetVOff.h" -#include "CondFormats/DataRecord/interface/SiStripCondDataRecords.h" - -class FilterTrackerOn : public edm::EDFilter { -public: - explicit FilterTrackerOn(const edm::ParameterSet&); - ~FilterTrackerOn() override; - -private: - void beginJob() override; - bool filter(edm::Event&, const edm::EventSetup&) override; - void endJob() override; - - int minModulesWithHVoff_; - edm::ESGetToken detVOffToken_; -}; diff --git a/CalibTracker/SiStripDCS/plugins/SealModules.cc b/CalibTracker/SiStripDCS/plugins/SealModules.cc index b1a302e87c57b..8affcebcffd82 100644 --- a/CalibTracker/SiStripDCS/plugins/SealModules.cc +++ b/CalibTracker/SiStripDCS/plugins/SealModules.cc @@ -4,7 +4,3 @@ #include "FWCore/ServiceRegistry/interface/ServiceMaker.h" #include "CalibTracker/SiStripDCS/interface/SiStripDetVOffBuilder.h" DEFINE_FWK_SERVICE(SiStripDetVOffBuilder); - -// EDFilter on the max number of modules with HV off -#include "CalibTracker/SiStripDCS/plugins/FilterTrackerOn.h" -DEFINE_FWK_MODULE(FilterTrackerOn); diff --git a/CalibTracker/SiStripDCS/plugins/SiStripDetVOffHandler.cc b/CalibTracker/SiStripDCS/plugins/SiStripDetVOffHandler.cc index 226ff86079b6f..2c5079f695aa2 100644 --- a/CalibTracker/SiStripDCS/plugins/SiStripDetVOffHandler.cc +++ b/CalibTracker/SiStripDCS/plugins/SiStripDetVOffHandler.cc @@ -1,5 +1,5 @@ #include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/ServiceRegistry/interface/Service.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" @@ -11,7 +11,7 @@ #include "CalibTracker/SiStripDCS/interface/SiStripDetVOffBuilder.h" -class SiStripDetVOffHandler : public edm::EDAnalyzer { +class SiStripDetVOffHandler : public edm::one::EDAnalyzer<> { public: explicit SiStripDetVOffHandler(const edm::ParameterSet& iConfig); ~SiStripDetVOffHandler() override; @@ -43,7 +43,7 @@ SiStripDetVOffHandler::SiStripDetVOffHandler(const edm::ParameterSet& iConfig) m_condDb = m_localCondDbFile; } -SiStripDetVOffHandler::~SiStripDetVOffHandler() {} +SiStripDetVOffHandler::~SiStripDetVOffHandler() = default; void SiStripDetVOffHandler::analyze(const edm::Event& evt, const edm::EventSetup& evtSetup) { // get last payload from condDb diff --git a/CalibTracker/SiStripDCS/plugins/SiStripDetVOffPrinter.cc b/CalibTracker/SiStripDCS/plugins/SiStripDetVOffPrinter.cc index cc80302fa0594..86a17d6c149db 100644 --- a/CalibTracker/SiStripDCS/plugins/SiStripDetVOffPrinter.cc +++ b/CalibTracker/SiStripDCS/plugins/SiStripDetVOffPrinter.cc @@ -60,7 +60,7 @@ SiStripDetVOffPrinter::SiStripDetVOffPrinter(const edm::ParameterSet& iConfig) m_connectionPool.configure(); } -SiStripDetVOffPrinter::~SiStripDetVOffPrinter() {} +SiStripDetVOffPrinter::~SiStripDetVOffPrinter() = default; void SiStripDetVOffPrinter::analyze(const edm::Event& evt, const edm::EventSetup& evtSetup) { // use start and end time from config file diff --git a/CalibTracker/SiStripDCS/plugins/SiStripDetVOffTkMapPlotter.cc b/CalibTracker/SiStripDCS/plugins/SiStripDetVOffTkMapPlotter.cc index 52ccc3ac514ea..bfaa543608797 100644 --- a/CalibTracker/SiStripDCS/plugins/SiStripDetVOffTkMapPlotter.cc +++ b/CalibTracker/SiStripDCS/plugins/SiStripDetVOffTkMapPlotter.cc @@ -1,5 +1,5 @@ #include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/ServiceRegistry/interface/Service.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" @@ -19,12 +19,11 @@ #include "DQM/SiStripCommon/interface/TkHistoMap.h" #include "CommonTools/TrackerMap/interface/TrackerMap.h" -class SiStripDetVOffTkMapPlotter : public edm::EDAnalyzer { +class SiStripDetVOffTkMapPlotter : public edm::one::EDAnalyzer<> { public: explicit SiStripDetVOffTkMapPlotter(const edm::ParameterSet& iConfig); ~SiStripDetVOffTkMapPlotter() override; void analyze(const edm::Event& evt, const edm::EventSetup& evtSetup) override; - void endJob() override; private: std::string formatIOV(cond::Time_t iov, std::string format = "%Y-%m-%d__%H_%M_%S"); @@ -60,7 +59,7 @@ SiStripDetVOffTkMapPlotter::SiStripDetVOffTkMapPlotter(const edm::ParameterSet& m_connectionPool.configure(); } -SiStripDetVOffTkMapPlotter::~SiStripDetVOffTkMapPlotter() {} +SiStripDetVOffTkMapPlotter::~SiStripDetVOffTkMapPlotter() = default; void SiStripDetVOffTkMapPlotter::analyze(const edm::Event& evt, const edm::EventSetup& evtSetup) { cond::Time_t theIov = 0; @@ -121,8 +120,6 @@ void SiStripDetVOffTkMapPlotter::analyze(const edm::Event& evt, const edm::Event } } -void SiStripDetVOffTkMapPlotter::endJob() {} - std::string SiStripDetVOffTkMapPlotter::formatIOV(cond::Time_t iov, std::string format) { auto facet = new boost::posix_time::time_facet(format.c_str()); std::ostringstream stream; diff --git a/CalibTracker/SiStripDCS/plugins/SiStripDetVOffTrendPlotter.cc b/CalibTracker/SiStripDCS/plugins/SiStripDetVOffTrendPlotter.cc index 5565d22c58fd3..e55053925de2c 100644 --- a/CalibTracker/SiStripDCS/plugins/SiStripDetVOffTrendPlotter.cc +++ b/CalibTracker/SiStripDCS/plugins/SiStripDetVOffTrendPlotter.cc @@ -1,5 +1,5 @@ #include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/ServiceRegistry/interface/Service.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" @@ -26,14 +26,13 @@ #include #include -class SiStripDetVOffTrendPlotter : public edm::EDAnalyzer { +class SiStripDetVOffTrendPlotter : public edm::one::EDAnalyzer<> { public: const std::vector PLOT_COLORS{kRed, kBlue, kBlack, kOrange, kMagenta}; explicit SiStripDetVOffTrendPlotter(const edm::ParameterSet &iConfig); ~SiStripDetVOffTrendPlotter() override; void analyze(const edm::Event &evt, const edm::EventSetup &evtSetup) override; - void endJob() override; private: std::string formatIOV(cond::Time_t iov, std::string format = "%Y-%m-%d__%H_%M_%S"); @@ -212,8 +211,6 @@ void SiStripDetVOffTrendPlotter::analyze(const edm::Event &evt, const edm::Event } } -void SiStripDetVOffTrendPlotter::endJob() {} - std::string SiStripDetVOffTrendPlotter::formatIOV(cond::Time_t iov, std::string format) { auto facet = new boost::posix_time::time_facet(format.c_str()); std::ostringstream stream; diff --git a/CalibTracker/SiStripDCS/plugins/TkVoltageMapCreator.cc b/CalibTracker/SiStripDCS/plugins/TkVoltageMapCreator.cc index 1b79296cbe9e7..c479acc1b5231 100644 --- a/CalibTracker/SiStripDCS/plugins/TkVoltageMapCreator.cc +++ b/CalibTracker/SiStripDCS/plugins/TkVoltageMapCreator.cc @@ -11,7 +11,7 @@ #include #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/MakerMacros.h" @@ -29,7 +29,7 @@ // class decleration // -class TkVoltageMapCreator : public edm::EDAnalyzer { +class TkVoltageMapCreator : public edm::one::EDAnalyzer { public: explicit TkVoltageMapCreator(const edm::ParameterSet&); ~TkVoltageMapCreator() override; @@ -73,10 +73,7 @@ TkVoltageMapCreator::TkVoltageMapCreator(const edm::ParameterSet& iConfig) //now do what ever initialization is needed } -TkVoltageMapCreator::~TkVoltageMapCreator() { - // do anything here that needs to be done at desctruction time - // (e.g. close files, deallocate resources etc.) -} +TkVoltageMapCreator::~TkVoltageMapCreator() = default; // // member functions diff --git a/CalibTracker/SiStripESProducers/plugins/DBWriter/DummyCondDBWriter.h b/CalibTracker/SiStripESProducers/plugins/DBWriter/DummyCondDBWriter.h index 3e948958f0517..265538fafcd1b 100644 --- a/CalibTracker/SiStripESProducers/plugins/DBWriter/DummyCondDBWriter.h +++ b/CalibTracker/SiStripESProducers/plugins/DBWriter/DummyCondDBWriter.h @@ -2,7 +2,7 @@ #define CalibTracker_SiStripESProducer_DummyCondDBWriter_h // user include files -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "FWCore/Framework/interface/ESWatcher.h" #include "FWCore/Framework/interface/Run.h" #include "FWCore/Framework/interface/EventSetup.h" @@ -16,12 +16,12 @@ #include template -class DummyCondDBWriter : public edm::EDAnalyzer { +class DummyCondDBWriter : public edm::one::EDAnalyzer { public: explicit DummyCondDBWriter(const edm::ParameterSet& iConfig); ~DummyCondDBWriter() override; void analyze(const edm::Event& e, const edm::EventSetup& es) override{}; - + void beginRun(const edm::Run& run, const edm::EventSetup& es) override{}; void endRun(const edm::Run& run, const edm::EventSetup& es) override; private: @@ -68,7 +68,7 @@ void DummyCondDBWriter::endRun(const edm::Run& run, else Time_ = iConfig_.getUntrackedParameter("OpenIovAtTime", 1); - dbservice->writeOne(obj.release(), Time_, rcdName); + dbservice->writeOneIOV(*obj, Time_, rcdName); } else { edm::LogError("SiStripFedCablingBuilder") << "Service is unavailable" << std::endl; } diff --git a/CalibTracker/SiStripESProducers/plugins/DBWriter/DummyCondObjPrinter.h b/CalibTracker/SiStripESProducers/plugins/DBWriter/DummyCondObjPrinter.h index 8d9a1d577243e..44ef9398b36d9 100644 --- a/CalibTracker/SiStripESProducers/plugins/DBWriter/DummyCondObjPrinter.h +++ b/CalibTracker/SiStripESProducers/plugins/DBWriter/DummyCondObjPrinter.h @@ -2,7 +2,7 @@ #define CalibTracker_SiStripESProducer_DummyCondObjPrinter_h // user include files -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "FWCore/Framework/interface/ESWatcher.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" @@ -14,7 +14,7 @@ #include template -class DummyCondObjPrinter : public edm::EDAnalyzer { +class DummyCondObjPrinter : public edm::one::EDAnalyzer<> { public: explicit DummyCondObjPrinter(const edm::ParameterSet& iConfig); ~DummyCondObjPrinter() override; diff --git a/CalibTracker/SiStripESProducers/plugins/DBWriter/SiStripFedCablingManipulator.cc b/CalibTracker/SiStripESProducers/plugins/DBWriter/SiStripFedCablingManipulator.cc index 4d4432bdca850..eb0fd67e5f8e8 100644 --- a/CalibTracker/SiStripESProducers/plugins/DBWriter/SiStripFedCablingManipulator.cc +++ b/CalibTracker/SiStripESProducers/plugins/DBWriter/SiStripFedCablingManipulator.cc @@ -41,12 +41,12 @@ void SiStripFedCablingManipulator::endRun(const edm::Run& run, const edm::EventS edm::LogInfo("SiStripFedCablingManipulator") << "first request for storing objects with Record " << "SiStripFedCablingRcd" << " at time " << Time_ << std::endl; - dbservice->createNewIOV(obj.release(), Time_, dbservice->endOfTime(), "SiStripFedCablingRcd"); + dbservice->createOneIOV(*obj, Time_, "SiStripFedCablingRcd"); } else { edm::LogInfo("SiStripFedCablingManipulator") << "appending a new object to existing tag " << "SiStripFedCablingRcd" << " in since mode " << std::endl; - dbservice->appendSinceTime(obj.release(), Time_, "SiStripFedCablingRcd"); + dbservice->appendOneIOV(*obj, Time_, "SiStripFedCablingRcd"); } } else { edm::LogError("SiStripFedCablingManipulator") << "Service is unavailable" << std::endl; diff --git a/CalibTracker/SiStripESProducers/plugins/DBWriter/SiStripFedCablingManipulator.h b/CalibTracker/SiStripESProducers/plugins/DBWriter/SiStripFedCablingManipulator.h index 4f78184574d4f..ba55b497c624d 100644 --- a/CalibTracker/SiStripESProducers/plugins/DBWriter/SiStripFedCablingManipulator.h +++ b/CalibTracker/SiStripESProducers/plugins/DBWriter/SiStripFedCablingManipulator.h @@ -2,7 +2,7 @@ #define CalibTracker_SiStripESProducer_SiStripFedCablingManipulator_h // user include files -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/ServiceRegistry/interface/Service.h" @@ -15,12 +15,12 @@ #include -class SiStripFedCablingManipulator : public edm::EDAnalyzer { +class SiStripFedCablingManipulator : public edm::one::EDAnalyzer { public: explicit SiStripFedCablingManipulator(const edm::ParameterSet& iConfig); ~SiStripFedCablingManipulator() override; void analyze(const edm::Event& e, const edm::EventSetup& es) override{}; - + void beginRun(const edm::Run& run, const edm::EventSetup& es) override{}; void endRun(const edm::Run& run, const edm::EventSetup& es) override; private: diff --git a/CalibTracker/SiStripESProducers/plugins/fake/SiStripApvGainBuilderFromTag.h b/CalibTracker/SiStripESProducers/plugins/fake/SiStripApvGainBuilderFromTag.h index ca049e2299c15..7e3108a187de2 100644 --- a/CalibTracker/SiStripESProducers/plugins/fake/SiStripApvGainBuilderFromTag.h +++ b/CalibTracker/SiStripESProducers/plugins/fake/SiStripApvGainBuilderFromTag.h @@ -31,7 +31,7 @@ class TrackerGeometry; * several changes to the base classes used together with it. */ -class SiStripApvGainBuilderFromTag : public edm::EDAnalyzer { +class SiStripApvGainBuilderFromTag : public edm::one::EDAnalyzer<> { public: explicit SiStripApvGainBuilderFromTag(const edm::ParameterSet& iConfig); diff --git a/CalibTracker/SiStripESProducers/plugins/fake/SiStripNoiseNormalizedWithApvGainBuilder.h b/CalibTracker/SiStripESProducers/plugins/fake/SiStripNoiseNormalizedWithApvGainBuilder.h index ade9c53db714a..6af837ba8a0a8 100644 --- a/CalibTracker/SiStripESProducers/plugins/fake/SiStripNoiseNormalizedWithApvGainBuilder.h +++ b/CalibTracker/SiStripESProducers/plugins/fake/SiStripNoiseNormalizedWithApvGainBuilder.h @@ -8,6 +8,7 @@ #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/Utilities/interface/Exception.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "CommonTools/ConditionDBWriter/interface/ConditionDBWriter.h" #include "FWCore/ParameterSet/interface/FileInPath.h" #include "Geometry/Records/interface/TrackerTopologyRcd.h" @@ -28,7 +29,7 @@ class TrackerGeometry; * rescale the noise (per strip). */ -class SiStripNoiseNormalizedWithApvGainBuilder : public edm::EDAnalyzer { +class SiStripNoiseNormalizedWithApvGainBuilder : public edm::one::EDAnalyzer<> { public: explicit SiStripNoiseNormalizedWithApvGainBuilder(const edm::ParameterSet& iConfig); diff --git a/CalibTracker/SiStripHitEfficiency/interface/HitEff.h b/CalibTracker/SiStripHitEfficiency/interface/HitEff.h index 78e7dbb1fbe0f..ad2251c0f5873 100644 --- a/CalibTracker/SiStripHitEfficiency/interface/HitEff.h +++ b/CalibTracker/SiStripHitEfficiency/interface/HitEff.h @@ -1,5 +1,5 @@ #include "FWCore/Framework/interface/ESHandle.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "FWCore/Framework/interface/Event.h" #include "DataFormats/Common/interface/Handle.h" #include "FWCore/Framework/interface/EventSetup.h" @@ -48,7 +48,7 @@ class TrackerTopology; -class HitEff : public edm::EDAnalyzer { +class HitEff : public edm::one::EDAnalyzer<> { public: explicit HitEff(const edm::ParameterSet& conf); double checkConsistency(const StripClusterParameterEstimator::LocalValues& parameters, double xx, double xerr); diff --git a/CalibTracker/SiStripLorentzAngle/interface/SiStripLAProfileBooker.h b/CalibTracker/SiStripLorentzAngle/interface/SiStripLAProfileBooker.h index 4ca90c18f8235..ee72005afe896 100644 --- a/CalibTracker/SiStripLorentzAngle/interface/SiStripLAProfileBooker.h +++ b/CalibTracker/SiStripLorentzAngle/interface/SiStripLAProfileBooker.h @@ -3,7 +3,7 @@ #include -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" @@ -30,7 +30,7 @@ class TrackerTopology; -class SiStripLAProfileBooker : public edm::EDAnalyzer { +class SiStripLAProfileBooker : public edm::one::EDAnalyzer { public: typedef dqm::legacy::MonitorElement MonitorElement; typedef dqm::legacy::DQMStore DQMStore; @@ -40,6 +40,8 @@ class SiStripLAProfileBooker : public edm::EDAnalyzer { void beginRun(edm::Run const&, const edm::EventSetup& c) override; + void endRun(edm::Run const&, const edm::EventSetup& c) override; + void endJob() override; void analyze(const edm::Event& e, const edm::EventSetup& c) override; diff --git a/CalibTracker/SiStripLorentzAngle/plugins/EnsembleCalibrationLA.cc b/CalibTracker/SiStripLorentzAngle/plugins/EnsembleCalibrationLA.cc index 48a1576d89a40..9f2bafdb5dc26 100644 --- a/CalibTracker/SiStripLorentzAngle/plugins/EnsembleCalibrationLA.cc +++ b/CalibTracker/SiStripLorentzAngle/plugins/EnsembleCalibrationLA.cc @@ -3,7 +3,6 @@ #include "FWCore/ParameterSet/interface/ParameterSet.h" #include #include -#include #include #include @@ -21,6 +20,8 @@ namespace sistrip { vMethods(conf.getParameter >("Methods")), tTopoToken_(esConsumes()) {} + EnsembleCalibrationLA::~EnsembleCalibrationLA(){}; + void EnsembleCalibrationLA::endJob() { Book book("la_ensemble"); TChain* const chain = new TChain("la_ensemble"); @@ -42,6 +43,8 @@ namespace sistrip { write_calibrations(); } + void EnsembleCalibrationLA::beginRun(const edm::Run&, const edm::EventSetup& eSetup) {} + void EnsembleCalibrationLA::endRun(const edm::Run&, const edm::EventSetup& eSetup) { tTopo_ = &eSetup.getData(tTopoToken_); } @@ -64,7 +67,7 @@ namespace sistrip { if (std::regex_match(ensemble.first, format)) { const bool TIB = "TIB" == std::regex_replace(ensemble.first, format, "\\1"); const bool stereo = "s" == std::regex_replace(ensemble.first, format, "\\3"); - const unsigned layer = boost::lexical_cast(std::regex_replace(ensemble.first, format, "\\2")); + const unsigned layer = std::stoul(std::regex_replace(ensemble.first, format, "\\2")); label = std::regex_replace(ensemble.first, format, "\\4"); index = LA_Filler_Fitter::layer_index(TIB, stereo, layer); diff --git a/CalibTracker/SiStripLorentzAngle/plugins/EnsembleCalibrationLA.h b/CalibTracker/SiStripLorentzAngle/plugins/EnsembleCalibrationLA.h index 584a711c89933..6b7d4b9a6b018 100644 --- a/CalibTracker/SiStripLorentzAngle/plugins/EnsembleCalibrationLA.h +++ b/CalibTracker/SiStripLorentzAngle/plugins/EnsembleCalibrationLA.h @@ -2,18 +2,21 @@ #define CalibTracker_SiStripLorentzAngle_EnsembleCalibrationLA_h #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "CalibTracker/SiStripLorentzAngle/interface/LA_Filler_Fitter.h" #include "Geometry/Records/interface/TrackerTopologyRcd.h" namespace sistrip { - class EnsembleCalibrationLA : public edm::EDAnalyzer { + class EnsembleCalibrationLA : public edm::one::EDAnalyzer { public: explicit EnsembleCalibrationLA(const edm::ParameterSet&); void analyze(const edm::Event&, const edm::EventSetup&) override {} + void beginRun(const edm::Run&, const edm::EventSetup&) override; void endRun(const edm::Run&, const edm::EventSetup&) override; void endJob() override; + ~EnsembleCalibrationLA() override; + private: void write_ensembles_text(const Book&); void write_ensembles_plots(const Book&) const; diff --git a/CalibTracker/SiStripLorentzAngle/plugins/MeasureLA.cc b/CalibTracker/SiStripLorentzAngle/plugins/MeasureLA.cc index 2e6bd68da8909..cf1f860066349 100644 --- a/CalibTracker/SiStripLorentzAngle/plugins/MeasureLA.cc +++ b/CalibTracker/SiStripLorentzAngle/plugins/MeasureLA.cc @@ -3,7 +3,6 @@ #include "CalibTracker/SiStripCommon/interface/SiStripDetInfoFileReader.h" #include "CalibTracker/StandaloneTrackerTopology/interface/StandaloneTrackerTopology.h" -#include #include #include #include @@ -184,7 +183,7 @@ namespace sistrip { std::regex format(".*(T[IO]B)_layer(\\d)([as]).*"); const bool isTIB = "TIB" == std::regex_replace(layer, format, "\\1"); const bool stereo = "s" == std::regex_replace(layer, format, "\\3"); - const unsigned layerNum = boost::lexical_cast(std::regex_replace(layer, format, "\\2")); + const unsigned layerNum = std::stoul(std::regex_replace(layer, format, "\\2")); return std::make_pair(LA_Filler_Fitter::layer_index(isTIB, stereo, layerNum), method); } diff --git a/CalibTracker/SiStripLorentzAngle/plugins/SiStripLAProfileBooker.cc b/CalibTracker/SiStripLorentzAngle/plugins/SiStripLAProfileBooker.cc index a0596808db304..c4a87b1562b0f 100644 --- a/CalibTracker/SiStripLorentzAngle/plugins/SiStripLAProfileBooker.cc +++ b/CalibTracker/SiStripLorentzAngle/plugins/SiStripLAProfileBooker.cc @@ -237,6 +237,8 @@ void SiStripLAProfileBooker::beginRun(const edm::Run&, const edm::EventSetup& c) TrackCounter = 1; } +void SiStripLAProfileBooker::endRun(const edm::Run&, const edm::EventSetup& c) {} + SiStripLAProfileBooker::~SiStripLAProfileBooker() { detparmap::iterator detpariter; for (detpariter = detmap.begin(); detpariter != detmap.end(); ++detpariter) diff --git a/CalibTracker/SiStripLorentzAngle/src/LA_Results.cc b/CalibTracker/SiStripLorentzAngle/src/LA_Results.cc index ebdff1c20c389..b9ce21ae6e018 100644 --- a/CalibTracker/SiStripLorentzAngle/src/LA_Results.cc +++ b/CalibTracker/SiStripLorentzAngle/src/LA_Results.cc @@ -3,7 +3,6 @@ #include #include -#include #include #include #include @@ -60,8 +59,8 @@ LA_Filler_Fitter::Result LA_Filler_Fitter::result(Method m, const std::string na std::map LA_Filler_Fitter::module_results(const Book& book, const Method m) { std::map results; for (Book::const_iterator it = book.begin(".*_module\\d*" + method(m)); it != book.end(); ++it) { - const uint32_t detid = boost::lexical_cast( - std::regex_replace(it->first, std::regex(".*_module(\\d*)_.*"), std::string("\\1"))); + const uint32_t detid = + std::stoul(std::regex_replace(it->first, std::regex(".*_module(\\d*)_.*"), std::string("\\1"))); results[detid] = result(m, it->first, book); } return results; diff --git a/Calibration/EcalAlCaRecoProducers/plugins/SelectedElectronFEDListProducer.cc b/Calibration/EcalAlCaRecoProducers/plugins/SelectedElectronFEDListProducer.cc index c020bc7a498c9..71e552878eb9a 100644 --- a/Calibration/EcalAlCaRecoProducers/plugins/SelectedElectronFEDListProducer.cc +++ b/Calibration/EcalAlCaRecoProducers/plugins/SelectedElectronFEDListProducer.cc @@ -8,21 +8,13 @@ #include "FWCore/ParameterSet/interface/ParameterSetDescription.h" #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" -//#include "DataFormats/Common/interface/Handle.h" - #include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h" #include "FWCore/Utilities/interface/InputTag.h" // raw data #include "DataFormats/FEDRawData/interface/FEDRawData.h" -//#include "DataFormats/FEDRawData/interface/FEDNumbering.h" // Geometry -#include "Geometry/CaloGeometry/interface/CaloGeometry.h" #include "Geometry/HcalTowerAlgo/interface/HcalGeometry.h" -#include "Geometry/EcalMapping/interface/EcalElectronicsMapping.h" -// strip geometry -#include "CalibFormats/SiStripObjects/interface/SiStripRegionCabling.h" -#include "CalibTracker/Records/interface/SiStripRegionCablingRcd.h" // egamma objects #include "DataFormats/EgammaReco/interface/SuperCluster.h" @@ -37,7 +29,6 @@ // Strip and pixel #include "CondFormats/SiStripObjects/interface/SiStripFedCabling.h" -#include "CondFormats/SiPixelObjects/interface/SiPixelFedCablingMap.h" // detector id #include "DataFormats/HcalDetId/interface/HcalDetId.h" @@ -47,30 +38,26 @@ #include "DataFormats/TrackingRecHit/interface/TrackingRecHitFwd.h" // Geometry #include "Geometry/Records/interface/CaloTopologyRecord.h" -#include "Geometry/EcalMapping/interface/EcalMappingRcd.h" #include "Geometry/EcalAlgo/interface/EcalPreshowerGeometry.h" -#include "Geometry/Records/interface/CaloGeometryRecord.h" -#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" -#include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" // strip geometry #include "CalibFormats/SiStripObjects/interface/SiStripDetCabling.h" -#include "CalibTracker/Records/interface/SiStripDetCablingRcd.h" // Message logger #include "FWCore/MessageLogger/interface/MessageLogger.h" // Strip and pixel #include "CondFormats/SiStripObjects/interface/FedChannelConnection.h" -#include "CondFormats/DataRecord/interface/SiPixelFedCablingMapRcd.h" #include "CondFormats/SiPixelObjects/interface/SiPixelFedCablingTree.h" -// Hcal objects -#include "CalibFormats/HcalObjects/interface/HcalDbService.h" -#include "CalibFormats/HcalObjects/interface/HcalDbRecord.h" - using namespace std; /// Producer constructor template -SelectedElectronFEDListProducer::SelectedElectronFEDListProducer(const edm::ParameterSet& iConfig) { +SelectedElectronFEDListProducer::SelectedElectronFEDListProducer(const edm::ParameterSet& iConfig) + : hcalDbToken_(esConsumes()), + ecalMappingToken_(esConsumes()), + caloGeometryToken_(esConsumes()), + siPixelFedCablingMapToken_(esConsumes()), + trackerGeometryToken_(esConsumes()), + siStripRegionCablingToken_(esConsumes()) { // input electron collection Tag if (iConfig.existsAs>("electronTags")) { electronTags_ = iConfig.getParameter>("electronTags"); @@ -309,36 +296,30 @@ void SelectedElectronFEDListProducer::beginJob() { template void SelectedElectronFEDListProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { // get the hcal electronics map - edm::ESHandle pSetup; - iSetup.get().get(pSetup); - HcalReadoutMap_ = pSetup->getHcalMapping(); + const auto& pSetup = iSetup.getData(hcalDbToken_); + HcalReadoutMap_ = pSetup.getHcalMapping(); // get the ecal electronics map - edm::ESHandle ecalmapping; - iSetup.get().get(ecalmapping); - EcalMapping_ = ecalmapping.product(); + EcalMapping_ = &iSetup.getData(ecalMappingToken_); // get the calo geometry - edm::ESHandle caloGeometry; - iSetup.get().get(caloGeometry); - GeometryCalo_ = caloGeometry.product(); + const auto& caloGeometry = iSetup.getData(caloGeometryToken_); + GeometryCalo_ = &caloGeometry; //ES geometry - GeometryES_ = caloGeometry->getSubdetectorGeometry(DetId::Ecal, EcalPreshower); + GeometryES_ = caloGeometry.getSubdetectorGeometry(DetId::Ecal, EcalPreshower); // pixel tracker cabling map - edm::ESTransientHandle pixelCablingMap; - iSetup.get().get(pixelCablingMap); + const auto pixelCablingMap = iSetup.getTransientHandle(siPixelFedCablingMapToken_); PixelCabling_.reset(); PixelCabling_ = pixelCablingMap->cablingTree(); - edm::ESHandle trackerGeometry; - iSetup.get().get(trackerGeometry); + const auto& trackerGeometry = iSetup.getData(trackerGeometryToken_); if (pixelModuleVector_.empty()) { // build the tracker pixel module map - std::vector::const_iterator itTracker = trackerGeometry->dets().begin(); - for (; itTracker != trackerGeometry->dets().end(); ++itTracker) { + std::vector::const_iterator itTracker = trackerGeometry.dets().begin(); + for (; itTracker != trackerGeometry.dets().end(); ++itTracker) { int subdet = (*itTracker)->geographicalId().subdetId(); if (!(subdet == PixelSubdetector::PixelBarrel || subdet == PixelSubdetector::PixelEndcap)) continue; @@ -357,9 +338,7 @@ void SelectedElectronFEDListProducer::produce(edm::Event& iEvent, c std::sort(pixelModuleVector_.begin(), pixelModuleVector_.end()); } - edm::ESHandle SiStripCablingHandle; - iSetup.get().get(SiStripCablingHandle); - StripRegionCabling_ = SiStripCablingHandle.product(); + StripRegionCabling_ = &iSetup.getData(siStripRegionCablingToken_); SiStripRegionCabling::Cabling SiStripCabling; SiStripCabling = StripRegionCabling_->getRegionCabling(); diff --git a/Calibration/EcalAlCaRecoProducers/plugins/SelectedElectronFEDListProducer.h b/Calibration/EcalAlCaRecoProducers/plugins/SelectedElectronFEDListProducer.h index 006b01cf69721..16157c5d0e6ec 100644 --- a/Calibration/EcalAlCaRecoProducers/plugins/SelectedElectronFEDListProducer.h +++ b/Calibration/EcalAlCaRecoProducers/plugins/SelectedElectronFEDListProducer.h @@ -1,17 +1,33 @@ -#ifndef SelectedElectronFEDListProducer_h -#define SelectedElectronFEDListProducer_h +#ifndef Calibration_EcalAlCaRecoProducers_SelectedElectronFEDListProducer_h +#define Calibration_EcalAlCaRecoProducers_SelectedElectronFEDListProducer_h #include "DataFormats/BeamSpot/interface/BeamSpot.h" // egamma objects #include "DataFormats/HLTReco/interface/TriggerFilterObjectWithRefs.h" +#include "Geometry/EcalMapping/interface/EcalElectronicsMapping.h" +// Geometry +#include "Geometry/CaloGeometry/interface/CaloGeometry.h" +#include "Geometry/EcalMapping/interface/EcalMappingRcd.h" +#include "Geometry/Records/interface/CaloGeometryRecord.h" +#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" +#include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" +// strip geometry +#include "CalibFormats/SiStripObjects/interface/SiStripRegionCabling.h" +#include "CalibTracker/Records/interface/SiStripDetCablingRcd.h" +#include "CalibTracker/Records/interface/SiStripRegionCablingRcd.h" +// Strip and pixel +#include "CondFormats/DataRecord/interface/SiPixelFedCablingMapRcd.h" +#include "CondFormats/SiPixelObjects/interface/SiPixelFedCablingMap.h" +// Hcal objects +#include "CalibFormats/HcalObjects/interface/HcalDbService.h" +#include "CalibFormats/HcalObjects/interface/HcalDbRecord.h" + // Math #include "DataFormats/Math/interface/normalizedPhi.h" #include "FWCore/Framework/interface/stream/EDProducer.h" -// #include "FWCore/Framework/interface/EDProducer.h" #include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/Framework/interface/ESHandle.h" // Message logger #include "FWCore/ServiceRegistry/interface/Service.h" @@ -19,14 +35,10 @@ class InputTag; class FEDRawDataCollection; -class SiPixelFedCablingMap; class SiPixelFedCablingTree; class SiStripFedCabling; -class SiStripRegionCabling; -class CaloGeometry; class CaloSubdetectorGeometry; -class EcalElectronicsMapping; class HcalElectronicsMap; // Hcal rec hit: this is a Fwd file defining typedefs @@ -131,6 +143,14 @@ class SelectedElectronFEDListProducer : public edm::stream::EDProducer<> { std::vector > recoEcalCandidateToken_; std::vector > electronToken_; + // Token for the input collection + const edm::ESGetToken hcalDbToken_; + const edm::ESGetToken ecalMappingToken_; + const edm::ESGetToken caloGeometryToken_; + const edm::ESGetToken siPixelFedCablingMapToken_; + const edm::ESGetToken trackerGeometryToken_; + const edm::ESGetToken siStripRegionCablingToken_; + // used inside the producer math::XYZVector beamSpotPosition_; diff --git a/Calibration/EcalAlCaRecoProducers/test/AlCaDoubleElectrons_cfg.py b/Calibration/EcalAlCaRecoProducers/test/AlCaDoubleElectrons_cfg.py index fc99782e80542..3a10b2e7867c3 100644 --- a/Calibration/EcalAlCaRecoProducers/test/AlCaDoubleElectrons_cfg.py +++ b/Calibration/EcalAlCaRecoProducers/test/AlCaDoubleElectrons_cfg.py @@ -3,7 +3,7 @@ process = cms.Process("AlCaElectronsProduction") process.load("FWCore.MessageLogger.MessageLogger_cfi") -process.load("Configuration.StandardSequences.Geometry_cff") +process.load("Configuration.StandardSequences.GeometryDB_cff") process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff") process.GlobalTag.globaltag = cms.string('GR_R_52_V7::All') process.load("Configuration.StandardSequences.MagneticField_cff") diff --git a/Calibration/EcalCalibAlgos/interface/ECALpedestalPCLHarvester.h b/Calibration/EcalCalibAlgos/interface/ECALpedestalPCLHarvester.h index 388ccf14639be..bb607057da860 100644 --- a/Calibration/EcalCalibAlgos/interface/ECALpedestalPCLHarvester.h +++ b/Calibration/EcalCalibAlgos/interface/ECALpedestalPCLHarvester.h @@ -29,6 +29,8 @@ #include "DataFormats/EcalDetId/interface/EEDetId.h" #include "CondFormats/EcalObjects/interface/EcalPedestals.h" #include "CondFormats/EcalObjects/interface/EcalChannelStatus.h" +#include "CondFormats/DataRecord/interface/EcalPedestalsRcd.h" +#include "CondFormats/DataRecord/interface/EcalChannelStatusRcd.h" class ECALpedestalPCLHarvester : public DQMEDHarvester { public: @@ -41,24 +43,30 @@ class ECALpedestalPCLHarvester : public DQMEDHarvester { void dqmPlots(const EcalPedestals& newpeds, DQMStore::IBooker& ibooker); - const EcalPedestals* currentPedestals_; - const EcalPedestals* g6g1Pedestals_; - const EcalChannelStatus* channelStatus_; + bool checkVariation(const EcalPedestalsMap& oldPedestals, const EcalPedestalsMap& newPedestals); bool checkStatusCode(const DetId& id); bool isGood(const DetId& id); - bool checkVariation(const EcalPedestalsMap& oldPedestals, const EcalPedestalsMap& newPedestals); std::vector chStatusToExclude_; - int minEntries_; + const int minEntries_; int entriesEB_[EBDetId::kSizeForDenseIndexing]; int entriesEE_[EEDetId::kSizeForDenseIndexing]; - bool checkAnomalies_; // whether or not to avoid creating sqlite file in case of many changed pedestals - double nSigma_; // threshold in sigmas to define a pedestal as changed - double thresholdAnomalies_; // threshold (fraction of changed pedestals) to avoid creation of sqlite file - std::string dqmDir_; // DQM directory where histograms are stored - std::string labelG6G1_; // DB label from which pedestals for G6 and G1 are to be copied - float threshDiffEB_; // if the new pedestals differs more than this from old, keep old - float threshDiffEE_; // same as above for EE. Stray channel protection - float threshChannelsAnalyzed_; // threshold for minimum percentage of channels analized to produce DQM plots + const bool checkAnomalies_; // whether or not to avoid creating sqlite file in case of many changed pedestals + const double nSigma_; // threshold in sigmas to define a pedestal as changed + const double thresholdAnomalies_; // threshold (fraction of changed pedestals) to avoid creation of sqlite file + const std::string dqmDir_; // DQM directory where histograms are stored + const std::string labelG6G1_; // DB label from which pedestals for G6 and G1 are to be copied + const float threshDiffEB_; // if the new pedestals differs more than this from old, keep old + const float threshDiffEE_; // same as above for EE. Stray channel protection + const float threshChannelsAnalyzed_; // threshold for minimum percentage of channels analized to produce DQM plots + + // ES token + const edm::ESGetToken channelsStatusToken_; + const edm::ESGetToken pedestalsToken_; + const edm::ESGetToken g6g1PedestalsToken_; + + const EcalPedestals* currentPedestals_; + const EcalPedestals* g6g1Pedestals_; + const EcalChannelStatus* channelStatus_; }; diff --git a/Calibration/EcalCalibAlgos/interface/ECALpedestalPCLworker.h b/Calibration/EcalCalibAlgos/interface/ECALpedestalPCLworker.h index 8c5014c873740..2dc10a29a8577 100644 --- a/Calibration/EcalCalibAlgos/interface/ECALpedestalPCLworker.h +++ b/Calibration/EcalCalibAlgos/interface/ECALpedestalPCLworker.h @@ -23,6 +23,8 @@ #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "CondFormats/EcalObjects/interface/EcalPedestals.h" +#include "CondFormats/DataRecord/interface/EcalPedestalsRcd.h" #include "DataFormats/EcalDigi/interface/EcalDigiCollections.h" #include "DataFormats/TCDS/interface/BSTRecord.h" #include "DataFormats/TCDS/interface/TCDSRecord.h" @@ -43,6 +45,7 @@ class ECALpedestalPCLworker : public DQMEDAnalyzer { edm::EDGetTokenT digiTokenEB_; edm::EDGetTokenT digiTokenEE_; edm::EDGetTokenT tcdsToken_; + const edm::ESGetToken pedestalToken_; std::vector meEB_; std::vector meEE_; diff --git a/Calibration/EcalCalibAlgos/interface/EcalEleCalibLooper.h b/Calibration/EcalCalibAlgos/interface/EcalEleCalibLooper.h index 4508b89ebd4a0..856124fc12240 100644 --- a/Calibration/EcalCalibAlgos/interface/EcalEleCalibLooper.h +++ b/Calibration/EcalCalibAlgos/interface/EcalEleCalibLooper.h @@ -25,6 +25,8 @@ #include "DataFormats/EgammaCandidates/interface/Electron.h" #include "DataFormats/EgammaCandidates/interface/GsfElectron.h" #include "DataFormats/EgammaCandidates/interface/GsfElectronFwd.h" +#include "Geometry/CaloGeometry/interface/CaloGeometry.h" +#include "Geometry/Records/interface/CaloGeometryRecord.h" #include "CLHEP/Matrix/GenMatrix.h" #include "CLHEP/Matrix/Matrix.h" @@ -60,64 +62,64 @@ class EcalEleCalibLooper : public edm::EDLooper { private: //! EcalBarrel Input Collection name - edm::InputTag m_barrelAlCa; + const edm::InputTag m_barrelAlCa; //! EcalEndcap Input Collection name - edm::InputTag m_endcapAlCa; + const edm::InputTag m_endcapAlCa; + //! To take the electrons + edm::InputTag m_ElectronLabel; //! reconstruction window size - int m_recoWindowSidex; - int m_recoWindowSidey; + const int m_recoWindowSidex; + const int m_recoWindowSidey; //! eta size of the sub-matrix - int m_etaWidth; //PG sub matrix size and borders + const int m_etaWidth; //PG sub matrix size and borders //! eta size of the additive border to the sub-matrix // int m_etaBorder ; //FIXME //! phi size of the sub-matrix - int m_phiWidthEB; + const int m_phiWidthEB; //! phi size of the additive border to the sub-matrix // int m_phiBorderEB //FIXME; //! eta start of the region of interest - int m_etaStart; //PG ECAL region to be calibrated + const int m_etaStart; //PG ECAL region to be calibrated //! eta end of the region of interest - int m_etaEnd; + const int m_etaEnd; //! phi start of the region of interest - int m_phiStartEB; + const int m_phiStartEB; //! phi end of the region of interest - int m_phiEndEB; + const int m_phiEndEB; //!DS For the EE - int m_radStart; - int m_radEnd; - int m_radWidth; + const int m_radStart; + const int m_radEnd; + const int m_radWidth; //FIXME int m_radBorder ; - int m_phiStartEE; - int m_phiEndEE; - int m_phiWidthEE; + const int m_phiStartEE; + const int m_phiEndEE; + const int m_phiWidthEE; //! maximum number of events per crystal - int m_maxSelectedNumPerXtal; + const int m_maxSelectedNumPerXtal; //! single blocks calibrators std::vector m_EcalCalibBlocks; //! minimum energy per crystal cut - double m_minEnergyPerCrystal; + const double m_minEnergyPerCrystal; //! maximum energy per crystal cut - double m_maxEnergyPerCrystal; + const double m_maxEnergyPerCrystal; //! minimum coefficient accepted (RAW) - double m_minCoeff; + const double m_minCoeff; //! maximum coefficient accepted (RAW) - double m_maxCoeff; + const double m_maxCoeff; //! to exclude the blocksolver - int m_usingBlockSolver; + const int m_usingBlockSolver; //!the maps of recalib coeffs EcalIntercalibConstantMap m_barrelMap; EcalIntercalibConstantMap m_endcapMap; //! DS sets the number of loops to do - unsigned int m_loops; - //! To take the electrons - edm::InputTag m_ElectronLabel; + const unsigned int m_loops; //The map Filler VFillMap *m_MapFiller; @@ -136,6 +138,13 @@ class EcalEleCalibLooper : public edm::EDLooper { std::map m_xtalNumOfHits; bool isfirstcall_; + + //! ED token + const edm::EDGetTokenT m_ebRecHitToken; + const edm::EDGetTokenT m_eeRecHitToken; + const edm::EDGetTokenT m_gsfElectronToken; + //! ES token + const edm::ESGetToken m_geometryToken; }; #endif #endif diff --git a/Calibration/EcalCalibAlgos/interface/ElectronCalibrationUniv.h b/Calibration/EcalCalibAlgos/interface/ElectronCalibrationUniv.h index d5d2d4d9d215c..a602561587602 100644 --- a/Calibration/EcalCalibAlgos/interface/ElectronCalibrationUniv.h +++ b/Calibration/EcalCalibAlgos/interface/ElectronCalibrationUniv.h @@ -24,9 +24,8 @@ // user include files #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" // Geometry @@ -40,6 +39,9 @@ #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/Framework/interface/ESHandle.h" #include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" +#include "DataFormats/EgammaCandidates/interface/Electron.h" +#include "DataFormats/EgammaCandidates/interface/GsfElectron.h" +#include "DataFormats/EgammaCandidates/interface/GsfElectronFwd.h" #include "Calibration/Tools/interface/HouseholderDecomposition.h" #include "Calibration/Tools/interface/MinL3Algorithm.h" #include "Calibration/Tools/interface/CalibrationCluster.h" @@ -53,7 +55,7 @@ // class decleration // -class ElectronCalibrationUniv : public edm::EDAnalyzer { +class ElectronCalibrationUniv : public edm::one::EDAnalyzer { public: explicit ElectronCalibrationUniv(const edm::ParameterSet &); ~ElectronCalibrationUniv() override; @@ -61,6 +63,7 @@ class ElectronCalibrationUniv : public edm::EDAnalyzer { void analyze(const edm::Event &, const edm::EventSetup &) override; void beginJob() override; void beginRun(edm::Run const &, edm::EventSetup const &) override; + void endRun(edm::Run const &, edm::EventSetup const &) override; void endJob() override; private: @@ -69,35 +72,32 @@ class ElectronCalibrationUniv : public edm::EDAnalyzer { // ----------member data --------------------------- - std::string rootfile_; - edm::InputTag EBrecHitLabel_; - edm::InputTag EErecHitLabel_; - edm::InputTag electronLabel_; - edm::InputTag trackLabel_; - std::string calibAlgo_; - std::string miscalibfile_; - std::string miscalibfileEndCap_; - int keventweight_; - double ElePt_; - int maxeta_; - int mineta_; - int maxphi_; - int minphi_; - double cut1_; - double cut2_; - double cut3_; - double cutEPCalo1_; - double cutEPCalo2_; - double cutEPin1_; - double cutEPin2_; - double cutCalo1_; - double cutCalo2_; - double cutESeed_; - int ClusterSize_; - int elecclass_; - int theMaxLoops; - - bool FirstIteration; + const edm::InputTag ebRecHitLabel_; + const edm::InputTag eeRecHitLabel_; + const edm::InputTag electronLabel_; + const std::string rootfile_; + const std::string calibAlgo_; + const std::string miscalibfile_; + const std::string miscalibfileEndCap_; + const int keventweight_; + const double elePt_; + const int maxeta_; + const int mineta_; + const int maxphi_; + const int minphi_; + const double cut1_; + const double cut2_; + const double cut3_; + const int numevent_; + const double cutEPCalo1_; + const double cutEPCalo2_; + const double cutEPin1_; + const double cutEPin2_; + const double cutCalo1_; + const double cutCalo2_; + const double cutESeed_; + const int clusterSize_; + const int elecclass_; int read_events; @@ -116,7 +116,11 @@ class ElectronCalibrationUniv : public edm::EDAnalyzer { MinL3Algorithm *MyL3Algo1; MinL3AlgoUniv *UnivL3; - edm::ESHandle theCaloTopology; + const edm::EDGetTokenT ebRecHitToken_; + const edm::EDGetTokenT eeRecHitToken_; + const edm::EDGetTokenT gsfElectronToken_; + const edm::ESGetToken topologyToken_; + const CaloTopology *theCaloTopology_; std::vector solution; std::vector solutionNoCuts; @@ -126,7 +130,6 @@ class ElectronCalibrationUniv : public edm::EDAnalyzer { std::map Univsolution; // int eventcrystal[25][25]; - int numevent_; TFile *f; diff --git a/Calibration/EcalCalibAlgos/interface/InvRingCalib.h b/Calibration/EcalCalibAlgos/interface/InvRingCalib.h index 822ca0c490944..8e0b4623b9980 100644 --- a/Calibration/EcalCalibAlgos/interface/InvRingCalib.h +++ b/Calibration/EcalCalibAlgos/interface/InvRingCalib.h @@ -13,13 +13,17 @@ #include "FWCore/Framework/interface/Event.h" #include "DataFormats/GeometryVector/interface/GlobalPoint.h" #include "DataFormats/DetId/interface/DetId.h" +#include "DataFormats/CaloRecHit/interface/CaloRecHit.h" +#include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" +#include "DataFormats/EgammaCandidates/interface/GsfElectron.h" +#include "DataFormats/EgammaCandidates/interface/GsfElectronFwd.h" #include "FWCore/Framework/interface/EventSetup.h" #include "CondFormats/EcalObjects/interface/EcalIntercalibConstants.h" +#include "Geometry/CaloGeometry/interface/CaloGeometry.h" +#include "Geometry/Records/interface/CaloGeometryRecord.h" #include #include -//#include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" -#include "DataFormats/CaloRecHit/interface/CaloRecHit.h" #include "Calibration/EcalCalibAlgos/interface/VFillMap.h" @@ -60,37 +64,37 @@ class InvRingCalib : public edm::EDLooper { private: //! EcalBarrel Input Collection name - edm::InputTag m_barrelAlCa; + const edm::InputTag m_barrelAlCa; //! EcalEndcap Input Collection name - edm::InputTag m_endcapAlCa; + const edm::InputTag m_endcapAlCa; //! To take the electrons - edm::InputTag m_ElectronLabel; + const edm::InputTag m_ElectronLabel; //! reconstruction window size - int m_recoWindowSidex; - int m_recoWindowSidey; + const int m_recoWindowSidex; + const int m_recoWindowSidey; //! minimum energy per crystal cut - double m_minEnergyPerCrystal; + const double m_minEnergyPerCrystal; //! maximum energy per crystal cut - double m_maxEnergyPerCrystal; + const double m_maxEnergyPerCrystal; //! eta start of the zone of interest - int m_etaStart; + const int m_etaStart; //! eta end of the zone of interest - int m_etaEnd; + const int m_etaEnd; //! eta size of the regions - int m_etaWidth; + const int m_etaWidth; // std::map m_eta; //! maximum number of events per Ring - int m_maxSelectedNumPerRing; + const int m_maxSelectedNumPerRing; //! number of events already read per Ring std::map m_RingNumOfHits; //! single blocks calibrators std::vector m_IMACalibBlocks; //! minimum coefficient accepted (RAW) - double m_minCoeff; + const double m_minCoeff; //! maximum coefficient accepted (RAW) - double m_maxCoeff; + const double m_maxCoeff; //! to exclude the blocksolver - int m_usingBlockSolver; + const int m_usingBlockSolver; //!position of the cell, borders, coords etc... std::map m_cellPos; std::map m_cellPhi; @@ -101,8 +105,8 @@ class InvRingCalib : public edm::EDLooper { //! LP sets the number of loops to do unsigned int m_loops; //! LP define the EE region to calibrate - int m_startRing; - int m_endRing; + const int m_startRing; + const int m_endRing; //!association map between Raw detIds and Rings std::map m_xtalRing; //!association map between raw detIds and Region @@ -114,14 +118,21 @@ class InvRingCalib : public edm::EDLooper { std::vector m_barrelCells; std::vector m_endcapCells; //!coeffs filenames - std::string m_EBcoeffFile; - std::string m_EEcoeffFile; + const std::string m_EBcoeffFile; + const std::string m_EEcoeffFile; //!endcap zone to be calibrated - int m_EEZone; + const int m_EEZone; //!EB regions vs. eta index std::map m_Reg; std::string m_mapFillerType; bool isfirstcall_; + + //! ED token + const edm::EDGetTokenT m_ebRecHitToken; + const edm::EDGetTokenT m_eeRecHitToken; + const edm::EDGetTokenT m_gsfElectronToken; + //! ES token + const edm::ESGetToken m_geometryToken; }; #endif #endif diff --git a/Calibration/EcalCalibAlgos/interface/PhiSymmetryCalibration.h b/Calibration/EcalCalibAlgos/interface/PhiSymmetryCalibration.h index 00033a1c2e5c9..ec976ea70b01a 100644 --- a/Calibration/EcalCalibAlgos/interface/PhiSymmetryCalibration.h +++ b/Calibration/EcalCalibAlgos/interface/PhiSymmetryCalibration.h @@ -19,19 +19,25 @@ #include "Calibration/EcalCalibAlgos/interface/EcalGeomPhiSymHelper.h" // Framework -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/Framework/interface/ProducerBase.h" #include "FWCore/Framework/interface/Frameworkfwd.h" #include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "CondFormats/EcalObjects/interface/EcalIntercalibConstants.h" +#include "CondFormats/DataRecord/interface/EcalIntercalibConstantsRcd.h" +#include "CondFormats/EcalObjects/interface/EcalChannelStatus.h" +#include "CondFormats/DataRecord/interface/EcalChannelStatusRcd.h" +#include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" #include "DataFormats/DetId/interface/DetId.h" +#include "Geometry/CaloGeometry/interface/CaloGeometry.h" +#include "Geometry/Records/interface/CaloGeometryRecord.h" class TH1F; -class PhiSymmetryCalibration : public edm::EDAnalyzer { +class PhiSymmetryCalibration + : public edm::one::EDAnalyzer { public: /// Constructor PhiSymmetryCalibration(const edm::ParameterSet& iConfig); @@ -41,7 +47,9 @@ class PhiSymmetryCalibration : public edm::EDAnalyzer { /// Called at beginning of job void beginJob() override; + void beginRun(edm::Run const&, const edm::EventSetup&) override; void endRun(edm::Run const&, const edm::EventSetup&) override; + void beginLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) override; void endLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) override; /// Called at end of job @@ -111,27 +119,32 @@ class PhiSymmetryCalibration : public edm::EDAnalyzer { // steering parameters - std::string ecalHitsProducer_; - std::string barrelHits_; - std::string endcapHits_; + const std::string ecalHitsProducer_; + const std::string barrelHits_; + const std::string endcapHits_; + + const edm::EDGetTokenT ebRecHitToken_; + const edm::EDGetTokenT eeRecHitToken_; + const edm::ESGetToken channelStatusToken_; + const edm::ESGetToken geometryToken_; // energy cut in the barrel - double eCut_barl_; + const double eCut_barl_; // parametrized energy cut EE : e_cut = ap + eta_ring*b - double ap_; - double b_; + const double ap_; + const double b_; - int eventSet_; + const int eventSet_; /// threshold in channel status beyond which channel is marked bad - int statusThreshold_; + const int statusThreshold_; static const int kMaxEndciPhi = 360; float phi_endc[kMaxEndciPhi][kEndcEtaRings]; - bool reiteration_; - std::string oldcalibfile_; //searched for in Calibration/EcalCalibAlgos/data + const bool reiteration_; + const std::string oldcalibfile_; //searched for in Calibration/EcalCalibAlgos/data /// the old calibration constants (when reiterating, the last ones derived) EcalIntercalibConstants oldCalibs_; diff --git a/Calibration/EcalCalibAlgos/interface/Pi0FixedMassWindowCalibration.h b/Calibration/EcalCalibAlgos/interface/Pi0FixedMassWindowCalibration.h index 1d462def498a3..b39ceb82c72e3 100644 --- a/Calibration/EcalCalibAlgos/interface/Pi0FixedMassWindowCalibration.h +++ b/Calibration/EcalCalibAlgos/interface/Pi0FixedMassWindowCalibration.h @@ -11,16 +11,15 @@ // Framework #include "FWCore/Framework/interface/LooperFactory.h" #include "FWCore/Framework/interface/ESProducerLooper.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/Frameworkfwd.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" #include "FWCore/Framework/interface/EDProducer.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "CondFormats/EcalObjects/interface/EcalIntercalibConstants.h" +#include "CondFormats/DataRecord/interface/EcalIntercalibConstantsRcd.h" #include "DataFormats/DetId/interface/DetId.h" #include "DataFormats/EcalRecHit/interface/EcalRecHit.h" @@ -34,13 +33,10 @@ #include "DataFormats/EcalDetId/interface/ESDetId.h" #include "DataFormats/DetId/interface/DetId.h" -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDProducer.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/EventSetup.h" +#include "Geometry/CaloGeometry/interface/CaloGeometry.h" +#include "Geometry/Records/interface/CaloGeometryRecord.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" #include "RecoEcal/EgammaClusterAlgos/interface/IslandClusterAlgo.h" #include "RecoEcal/EgammaCoreTools/interface/PositionCalc.h" #include "RecoEcal/EgammaCoreTools/interface/ClusterShapeAlgo.h" @@ -87,9 +83,9 @@ class Pi0FixedMassWindowCalibration : public edm::ESProducerLooper { int nevent; - unsigned int theMaxLoops; - std::string ecalHitsProducer_; - std::string barrelHits_; + const unsigned int theMaxLoops; + const std::string ecalHitsProducer_; + const std::string barrelHits_; IslandClusterAlgo::VerbosityLevel verbosity; @@ -140,6 +136,10 @@ class Pi0FixedMassWindowCalibration : public edm::ESProducerLooper { const EcalRecHitCollection* ecalRecHitBarrelCollection; const EcalRecHitCollection* recalibEcalRecHitCollection; + const edm::EDGetTokenT recHitToken_; + const edm::ESGetToken intercalibConstantsToken_; + const edm::ESGetToken geometryToken_; + // root tree TFile* theFile; diff --git a/Calibration/EcalCalibAlgos/interface/ZeeCalibration.h b/Calibration/EcalCalibAlgos/interface/ZeeCalibration.h index b10e543e039df..9e78f35854233 100644 --- a/Calibration/EcalCalibAlgos/interface/ZeeCalibration.h +++ b/Calibration/EcalCalibAlgos/interface/ZeeCalibration.h @@ -21,17 +21,16 @@ #include #include #include +#include // user include files #include "FWCore/Framework/interface/LooperFactory.h" #include "FWCore/Framework/interface/ESProducerLooper.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/Frameworkfwd.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "FWCore/Framework/interface/EDProducer.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" #include "Calibration/Tools/interface/ZIterativeAlgorithmWithFit.h" #include "Calibration/Tools/interface/CalibElectron.h" @@ -42,9 +41,13 @@ #include "CondFormats/EcalObjects/interface/EcalIntercalibConstants.h" #include "CondFormats/DataRecord/interface/EcalIntercalibConstantsRcd.h" +#include "DataFormats/Common/interface/TriggerResults.h" #include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" #include "DataFormats/DetId/interface/DetId.h" +#include "Geometry/CaloGeometry/interface/CaloGeometry.h" +#include "Geometry/Records/interface/CaloGeometryRecord.h" + #include "TTree.h" #include "TFile.h" #include "TGraph.h" @@ -53,18 +56,12 @@ #include "TH2.h" #include "SimDataFormats/GeneratorProducts/interface/HepMCProduct.h" +#include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" #include "DataFormats/EgammaCandidates/interface/ElectronFwd.h" #include "DataFormats/EgammaCandidates/interface/Electron.h" #include "DataFormats/EgammaCandidates/interface/GsfElectron.h" #include "DataFormats/EgammaCandidates/interface/GsfElectronFwd.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" - -#include -#include - // class declaration // @@ -145,23 +142,33 @@ class ZeeCalibration : public edm::ESProducerLooper { std::string outputFileName_; - std::string rechitProducer_; - std::string rechitCollection_; - std::string erechitProducer_; - std::string erechitCollection_; - std::string scProducer_; - std::string scCollection_; + const edm::InputTag hlTriggerResults_; - std::string scIslandProducer_; - std::string scIslandCollection_; + const std::string mcProducer_; + const std::string rechitProducer_; + const std::string rechitCollection_; + const std::string erechitProducer_; + const std::string erechitCollection_; + const std::string scProducer_; + const std::string scCollection_; + + const std::string scIslandProducer_; + const std::string scIslandCollection_; + + const std::string electronProducer_; + const std::string electronCollection_; - std::string mcProducer_; std::string calibMode_; - std::string electronProducer_; - std::string electronCollection_; + const edm::EDGetTokenT trigResultsToken_; + const edm::EDGetTokenT hepMCToken_; + const edm::EDGetTokenT ebRecHitToken_; + const edm::EDGetTokenT eeRecHitToken_; + const edm::EDGetTokenT scToken_; + const edm::EDGetTokenT islandSCToken_; + const edm::EDGetTokenT gsfElectronToken_; - std::string RecalibBarrelHits_; + const edm::ESGetToken geometryToken_; unsigned int etaBins_; unsigned int etBins_; @@ -338,8 +345,6 @@ class ZeeCalibration : public edm::ESProducerLooper { int CRACK_ELECTRONS_IN_BARREL; int CRACK_ELECTRONS_IN_ENDCAP; - edm::InputTag hlTriggerResults_; - unsigned int nEvents_; // number of events processed unsigned int nWasRun_; // # where at least one HLT was run diff --git a/Calibration/EcalCalibAlgos/src/ECALpedestalPCLHarvester.cc b/Calibration/EcalCalibAlgos/src/ECALpedestalPCLHarvester.cc index 1b2d111e3006f..1876ff44fd6ba 100644 --- a/Calibration/EcalCalibAlgos/src/ECALpedestalPCLHarvester.cc +++ b/Calibration/EcalCalibAlgos/src/ECALpedestalPCLHarvester.cc @@ -5,29 +5,29 @@ // user include files #include "Calibration/EcalCalibAlgos/interface/ECALpedestalPCLHarvester.h" #include "CondCore/DBOutputService/interface/PoolDBOutputService.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/EventSetup.h" -#include "CondFormats/EcalObjects/interface/EcalChannelStatus.h" #include "CondFormats/EcalObjects/interface/EcalChannelStatusCode.h" -#include "CondFormats/DataRecord/interface/EcalPedestalsRcd.h" -#include "CondFormats/DataRecord/interface/EcalChannelStatusRcd.h" #include "CommonTools/Utils/interface/StringToEnumValue.h" -#include #include ECALpedestalPCLHarvester::ECALpedestalPCLHarvester(const edm::ParameterSet& ps) - : currentPedestals_(nullptr), channelStatus_(nullptr) { + : minEntries_(ps.getParameter("MinEntries")), + checkAnomalies_(ps.getParameter("checkAnomalies")), + nSigma_(ps.getParameter("nSigma")), + thresholdAnomalies_(ps.getParameter("thresholdAnomalies")), + dqmDir_(ps.getParameter("dqmDir")), + labelG6G1_(ps.getParameter("labelG6G1")), + threshDiffEB_(ps.getParameter("threshDiffEB")), + threshDiffEE_(ps.getParameter("threshDiffEE")), + threshChannelsAnalyzed_(ps.getParameter("threshChannelsAnalyzed")), + channelsStatusToken_(esConsumes()), + pedestalsToken_(esConsumes()), + g6g1PedestalsToken_(esConsumes(edm::ESInputTag("", labelG6G1_))), + currentPedestals_(nullptr), + g6g1Pedestals_(nullptr), + channelStatus_(nullptr) { chStatusToExclude_ = StringToEnumValue( ps.getParameter >("ChannelStatusToExclude")); - minEntries_ = ps.getParameter("MinEntries"); - checkAnomalies_ = ps.getParameter("checkAnomalies"); - nSigma_ = ps.getParameter("nSigma"); - thresholdAnomalies_ = ps.getParameter("thresholdAnomalies"); - dqmDir_ = ps.getParameter("dqmDir"); - labelG6G1_ = ps.getParameter("labelG6G1"); - threshDiffEB_ = ps.getParameter("threshDiffEB"); - threshDiffEE_ = ps.getParameter("threshDiffEE"); - threshChannelsAnalyzed_ = ps.getParameter("threshChannelsAnalyzed"); } void ECALpedestalPCLHarvester::dqmEndJob(DQMStore::IBooker& ibooker_, DQMStore::IGetter& igetter_) { @@ -155,17 +155,9 @@ void ECALpedestalPCLHarvester::fillDescriptions(edm::ConfigurationDescriptions& } void ECALpedestalPCLHarvester::endRun(edm::Run const& run, edm::EventSetup const& isetup) { - edm::ESHandle chStatus; - isetup.get().get(chStatus); - channelStatus_ = chStatus.product(); - - edm::ESHandle peds; - isetup.get().get(peds); - currentPedestals_ = peds.product(); - - edm::ESHandle g6g1peds; - isetup.get().get(labelG6G1_, g6g1peds); - g6g1Pedestals_ = g6g1peds.product(); + channelStatus_ = &isetup.getData(channelsStatusToken_); + currentPedestals_ = &isetup.getData(pedestalsToken_); + g6g1Pedestals_ = &isetup.getData(g6g1PedestalsToken_); } bool ECALpedestalPCLHarvester::checkStatusCode(const DetId& id) { diff --git a/Calibration/EcalCalibAlgos/src/ECALpedestalPCLworker.cc b/Calibration/EcalCalibAlgos/src/ECALpedestalPCLworker.cc index 90296dc37b65c..e90fcfbbf8427 100644 --- a/Calibration/EcalCalibAlgos/src/ECALpedestalPCLworker.cc +++ b/Calibration/EcalCalibAlgos/src/ECALpedestalPCLworker.cc @@ -2,16 +2,11 @@ #include "Calibration/EcalCalibAlgos/interface/ECALpedestalPCLworker.h" #include "DataFormats/EcalDetId/interface/EBDetId.h" #include "DataFormats/EcalDetId/interface/EEDetId.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/EventSetup.h" -#include "CondFormats/EcalObjects/interface/EcalPedestals.h" -#include "CondFormats/DataRecord/interface/EcalPedestalsRcd.h" -#include #include ECALpedestalPCLworker::ECALpedestalPCLworker(const edm::ParameterSet& iConfig) - -{ + : pedestalToken_(esConsumes()) { edm::InputTag digiTagEB = iConfig.getParameter("BarrelDigis"); edm::InputTag digiTagEE = iConfig.getParameter("EndcapDigis"); @@ -106,8 +101,7 @@ void ECALpedestalPCLworker::bookHistograms(DQMStore::IBooker& ibooker, edm::Run ibooker.cd(); ibooker.setCurrentFolder(dqmDir_); - edm::ESHandle peds; - es.get().get(peds); + const auto& peds = es.getData(pedestalToken_); for (uint32_t i = 0; i < EBDetId::kSizeForDenseIndexing; ++i) { ibooker.setCurrentFolder(dqmDir_ + "/EB/" + std::to_string(int(i / 100))); @@ -117,7 +111,7 @@ void ECALpedestalPCLworker::bookHistograms(DQMStore::IBooker& ibooker, edm::Run int centralBin = fixedBookingCenterBin_; if (dynamicBooking_) { - centralBin = int((peds->find(id))->mean_x12); + centralBin = int((peds.find(id))->mean_x12); } int min = centralBin - nBins_ / 2; @@ -135,7 +129,7 @@ void ECALpedestalPCLworker::bookHistograms(DQMStore::IBooker& ibooker, edm::Run int centralBin = fixedBookingCenterBin_; if (dynamicBooking_) { - centralBin = int((peds->find(id))->mean_x12); + centralBin = int((peds.find(id))->mean_x12); } int min = centralBin - nBins_ / 2; diff --git a/Calibration/EcalCalibAlgos/src/EcalEleCalibLooper.cc b/Calibration/EcalCalibAlgos/src/EcalEleCalibLooper.cc index 137c8cd0c5719..f6b3c73d5b09b 100644 --- a/Calibration/EcalCalibAlgos/src/EcalEleCalibLooper.cc +++ b/Calibration/EcalCalibAlgos/src/EcalEleCalibLooper.cc @@ -1,6 +1,5 @@ #include #include -#include #include "FWCore/Framework/interface/Frameworkfwd.h" #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" @@ -9,11 +8,8 @@ #include "Calibration/EcalCalibAlgos/interface/EcalEleCalibLooper.h" #include "DataFormats/Common/interface/Handle.h" #include "DataFormats/EgammaReco/interface/ClusterShape.h" -#include "Geometry/Records/interface/CaloGeometryRecord.h" #include "Geometry/CaloGeometry/interface/CaloCellGeometry.h" -#include "Geometry/CaloGeometry/interface/CaloGeometry.h" #include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h" -#include "CondFormats/DataRecord/interface/EcalIntercalibConstantsRcd.h" #include "Calibration/Tools/interface/calibXMLwriter.h" #include "CalibCalorimetry/CaloMiscalibTools/interface/CaloMiscalibTools.h" #include "RecoEcal/EgammaCoreTools/interface/EcalClusterTools.h" @@ -33,6 +29,7 @@ EcalEleCalibLooper::EcalEleCalibLooper(const edm::ParameterSet& iConfig) : m_barrelAlCa(iConfig.getParameter("alcaBarrelHitCollection")), m_endcapAlCa(iConfig.getParameter("alcaEndcapHitCollection")), + m_ElectronLabel(iConfig.getParameter("electronLabel")), m_recoWindowSidex(iConfig.getParameter("recoWindowSidex")), m_recoWindowSidey(iConfig.getParameter("recoWindowSidey")), m_etaWidth(iConfig.getParameter("etaWidth")), @@ -54,7 +51,10 @@ EcalEleCalibLooper::EcalEleCalibLooper(const edm::ParameterSet& iConfig) m_maxCoeff(iConfig.getParameter("maxCoeff")), m_usingBlockSolver(iConfig.getParameter("usingBlockSolver")), m_loops(iConfig.getParameter("loops")), - m_ElectronLabel(iConfig.getParameter("electronLabel")) { + m_ebRecHitToken(consumes(m_barrelAlCa)), + m_eeRecHitToken(consumes(m_endcapAlCa)), + m_gsfElectronToken(consumes(m_ElectronLabel)), + m_geometryToken(esConsumes()) { edm::LogInfo("IML") << "[EcalEleCalibLooper][ctor] asserts"; assert(!((m_etaEnd - m_etaStart) % m_etaWidth)); @@ -168,9 +168,7 @@ edm::EDLooper::Status EcalEleCalibLooper::duringLoop(const edm::Event& iEvent, c // with the beginJob without arguments migration if (isfirstcall_) { - edm::ESHandle geoHandle; - iSetup.get().get(geoHandle); - const CaloGeometry& geometry = *geoHandle; + const auto& geometry = iSetup.getData(m_geometryToken); m_barrelCells = geometry.getValidDetIds(DetId::Ecal, EcalBarrel); m_endcapCells = geometry.getValidDetIds(DetId::Ecal, EcalEndcap); for (std::vector::const_iterator barrelIt = m_barrelCells.begin(); barrelIt != m_barrelCells.end(); @@ -190,7 +188,7 @@ edm::EDLooper::Status EcalEleCalibLooper::duringLoop(const edm::Event& iEvent, c //take the collection of recHits in the barrel const EBRecHitCollection* barrelHitsCollection = nullptr; edm::Handle barrelRecHitsHandle; - iEvent.getByLabel(m_barrelAlCa, barrelRecHitsHandle); + iEvent.getByToken(m_ebRecHitToken, barrelRecHitsHandle); barrelHitsCollection = barrelRecHitsHandle.product(); if (!barrelRecHitsHandle.isValid()) { edm::LogError("reading") << "[EcalEleCalibLooper] barrel rec hits not found"; @@ -200,7 +198,7 @@ edm::EDLooper::Status EcalEleCalibLooper::duringLoop(const edm::Event& iEvent, c //take the collection of rechis in the endcap const EERecHitCollection* endcapHitsCollection = nullptr; edm::Handle endcapRecHitsHandle; - iEvent.getByLabel(m_endcapAlCa, endcapRecHitsHandle); + iEvent.getByToken(m_eeRecHitToken, endcapRecHitsHandle); endcapHitsCollection = endcapRecHitsHandle.product(); if (!endcapRecHitsHandle.isValid()) { edm::LogError("reading") << "[EcalEleCalibLooper] endcap rec hits not found"; @@ -209,7 +207,7 @@ edm::EDLooper::Status EcalEleCalibLooper::duringLoop(const edm::Event& iEvent, c //Takes the electron collection of the pixel detector edm::Handle pElectrons; - iEvent.getByLabel(m_ElectronLabel, pElectrons); + iEvent.getByToken(m_gsfElectronToken, pElectrons); if (!pElectrons.isValid()) { edm::LogError("reading") << "[EcalEleCalibLooper] electrons not found"; return kContinue; diff --git a/Calibration/EcalCalibAlgos/src/ElectronCalibrationUniv.cc b/Calibration/EcalCalibAlgos/src/ElectronCalibrationUniv.cc index fe6aefb4eba96..4b49ad3749602 100644 --- a/Calibration/EcalCalibAlgos/src/ElectronCalibrationUniv.cc +++ b/Calibration/EcalCalibAlgos/src/ElectronCalibrationUniv.cc @@ -1,25 +1,14 @@ #include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" #include "DataFormats/EcalDetId/interface/EBDetId.h" #include "DataFormats/DetId/interface/DetId.h" -#include "CondFormats/EcalObjects/interface/EcalIntercalibConstants.h" -#include "CondFormats/DataRecord/interface/EcalIntercalibConstantsRcd.h" #include "Calibration/Tools/interface/calibXMLwriter.h" #include "Calibration/Tools/interface/CalibrationCluster.h" #include "Calibration/Tools/interface/HouseholderDecomposition.h" #include "Calibration/Tools/interface/MinL3Algorithm.h" #include "Calibration/EcalCalibAlgos/interface/ElectronCalibrationUniv.h" -#include "DataFormats/EgammaCandidates/interface/Electron.h" -#include "DataFormats/EgammaReco/interface/SuperCluster.h" -#include "DataFormats/TrackReco/interface/Track.h" -#include "DataFormats/TrackReco/interface/TrackFwd.h" -#include "DataFormats/TrackReco/interface/TrackExtraFwd.h" #include "FWCore/Utilities/interface/isFinite.h" -#include "TFile.h" -#include "TH1.h" -#include "TH2.h" #include "TF1.h" #include "TRandom.h" @@ -28,40 +17,37 @@ #include #include -#include "DataFormats/EgammaCandidates/interface/GsfElectron.h" -#include "DataFormats/EgammaCandidates/interface/GsfElectronFwd.h" - -ElectronCalibrationUniv::ElectronCalibrationUniv(const edm::ParameterSet& iConfig) { - rootfile_ = iConfig.getParameter("rootfile"); - EBrecHitLabel_ = iConfig.getParameter("ebRecHitsLabel"); - EErecHitLabel_ = iConfig.getParameter("eeRecHitsLabel"); - electronLabel_ = iConfig.getParameter("electronLabel"); - trackLabel_ = iConfig.getParameter("trackLabel"); - calibAlgo_ = iConfig.getParameter("CALIBRATION_ALGO"); - keventweight_ = iConfig.getParameter("keventweight"); - ClusterSize_ = iConfig.getParameter("Clustersize"); - ElePt_ = iConfig.getParameter("ElePt"); - maxeta_ = iConfig.getParameter("maxeta"); - mineta_ = iConfig.getParameter("mineta"); - maxphi_ = iConfig.getParameter("maxphi"); - minphi_ = iConfig.getParameter("minphi"); - cut1_ = iConfig.getParameter("cut1"); - cut2_ = iConfig.getParameter("cut2"); - cut3_ = iConfig.getParameter("cut3"); - elecclass_ = iConfig.getParameter("elecclass"); - numevent_ = iConfig.getParameter("numevent"); - miscalibfile_ = iConfig.getParameter("miscalibfile"); - miscalibfileEndCap_ = iConfig.getParameter("miscalibfileEndCap"); - - cutEPCalo1_ = iConfig.getParameter("cutEPCaloMin"); - cutEPCalo2_ = iConfig.getParameter("cutEPCaloMax"); - cutEPin1_ = iConfig.getParameter("cutEPinMin"); - cutEPin2_ = iConfig.getParameter("cutEPinMax"); - cutCalo1_ = iConfig.getParameter("cutCaloMin"); - cutCalo2_ = iConfig.getParameter("cutCaloMax"); - - cutESeed_ = iConfig.getParameter("cutESeed"); -} +ElectronCalibrationUniv::ElectronCalibrationUniv(const edm::ParameterSet& iConfig) + : ebRecHitLabel_(iConfig.getParameter("ebRecHitsLabel")), + eeRecHitLabel_(iConfig.getParameter("eeRecHitsLabel")), + electronLabel_(iConfig.getParameter("electronLabel")), + rootfile_(iConfig.getParameter("rootfile")), + calibAlgo_(iConfig.getParameter("CALIBRATION_ALGO")), + miscalibfile_(iConfig.getParameter("miscalibfile")), + miscalibfileEndCap_(iConfig.getParameter("miscalibfileEndCap")), + keventweight_(iConfig.getParameter("keventweight")), + elePt_(iConfig.getParameter("ElePt")), + maxeta_(iConfig.getParameter("maxeta")), + mineta_(iConfig.getParameter("mineta")), + maxphi_(iConfig.getParameter("maxphi")), + minphi_(iConfig.getParameter("minphi")), + cut1_(iConfig.getParameter("cut1")), + cut2_(iConfig.getParameter("cut2")), + cut3_(iConfig.getParameter("cut3")), + numevent_(iConfig.getParameter("numevent")), + cutEPCalo1_(iConfig.getParameter("cutEPCaloMin")), + cutEPCalo2_(iConfig.getParameter("cutEPCaloMax")), + cutEPin1_(iConfig.getParameter("cutEPinMin")), + cutEPin2_(iConfig.getParameter("cutEPinMax")), + cutCalo1_(iConfig.getParameter("cutCaloMin")), + cutCalo2_(iConfig.getParameter("cutCaloMax")), + cutESeed_(iConfig.getParameter("cutESeed")), + clusterSize_(iConfig.getParameter("Clustersize")), + elecclass_(iConfig.getParameter("elecclass")), + ebRecHitToken_(consumes(ebRecHitLabel_)), + eeRecHitToken_(consumes(eeRecHitLabel_)), + gsfElectronToken_(consumes(electronLabel_)), + topologyToken_(esConsumes()) {} ElectronCalibrationUniv::~ElectronCalibrationUniv() {} @@ -223,7 +209,7 @@ void ElectronCalibrationUniv::beginJob() { GeneralMapEndCapPlusBeforePt = new TH2F("GeneralMapEndCapPlusBeforePt", "Map without any cuts", 100, 0, 100, 100, 0, 100); - calibClusterSize = ClusterSize_; + calibClusterSize = clusterSize_; etaMin = int(mineta_); etaMax = int(maxeta_); phiMin = int(minphi_); @@ -250,9 +236,13 @@ void ElectronCalibrationUniv::beginRun(edm::Run const&, edm::EventSetup const& i //======================================================================== //To Deal with Geometry: - iSetup.get().get(theCaloTopology); + theCaloTopology_ = &iSetup.getData(topologyToken_); } +//======================================================================== +void ElectronCalibrationUniv::endRun(edm::Run const&, edm::EventSetup const& iSetup) {} +//======================================================================== + //======================================================================== void ElectronCalibrationUniv::endJob() { @@ -622,7 +612,7 @@ void ElectronCalibrationUniv::analyze(const edm::Event& iEvent, const edm::Event // Get EBRecHits edm::Handle EBphits; - iEvent.getByLabel(EBrecHitLabel_, EBphits); + iEvent.getByToken(ebRecHitToken_, EBphits); if (!EBphits.isValid()) { std::cerr << "Error! can't get the product EBRecHitCollection: " << std::endl; } @@ -631,7 +621,7 @@ void ElectronCalibrationUniv::analyze(const edm::Event& iEvent, const edm::Event // Get EERecHits edm::Handle EEphits; - iEvent.getByLabel(EErecHitLabel_, EEphits); + iEvent.getByToken(eeRecHitToken_, EEphits); if (!EEphits.isValid()) { std::cerr << "Error! can't get the product EERecHitCollection: " << std::endl; } @@ -639,7 +629,7 @@ void ElectronCalibrationUniv::analyze(const edm::Event& iEvent, const edm::Event // Get pixelElectrons edm::Handle pElectrons; - iEvent.getByLabel(electronLabel_, pElectrons); + iEvent.getByToken(gsfElectronToken_, pElectrons); if (!pElectrons.isValid()) { std::cerr << "Error! can't get the product ElectronCollection: " << std::endl; } @@ -737,9 +727,9 @@ void ElectronCalibrationUniv::analyze(const edm::Event& iEvent, const edm::Event float energy3x3 = 0.; float energy5x5 = 0.; //Should be moved to cfg file! - int ClusterSize = ClusterSize_; + int ClusterSize = clusterSize_; - const CaloSubdetectorTopology* topology = theCaloTopology->getSubdetectorTopology(DetId::Ecal, maxHitId.subdetId()); + const CaloSubdetectorTopology* topology = theCaloTopology_->getSubdetectorTopology(DetId::Ecal, maxHitId.subdetId()); std::vector NxNaroundMax = topology->getWindow(maxHitId, ClusterSize, ClusterSize); //ToCompute 3x3 std::vector S9aroundMax = topology->getWindow(maxHitId, 3, 3); @@ -822,7 +812,7 @@ void ElectronCalibrationUniv::analyze(const edm::Event& iEvent, const edm::Event } EventsAfterCuts->Fill(11); - if (highestElePt < ElePt_) + if (highestElePt < elePt_) return; if (maxHitId.subdetId() == EcalBarrel) { diff --git a/Calibration/EcalCalibAlgos/src/InvRingCalib.cc b/Calibration/EcalCalibAlgos/src/InvRingCalib.cc index 0d0f78d9ae3bd..e476a262457af 100644 --- a/Calibration/EcalCalibAlgos/src/InvRingCalib.cc +++ b/Calibration/EcalCalibAlgos/src/InvRingCalib.cc @@ -1,8 +1,6 @@ #include #include #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "Geometry/Records/interface/CaloGeometryRecord.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "Calibration/EcalCalibAlgos/interface/InvRingCalib.h" @@ -12,7 +10,6 @@ #include "Calibration/Tools/interface/calibXMLwriter.h" #include "CalibCalorimetry/CaloMiscalibTools/interface/MiscalibReaderFromXMLEcalBarrel.h" #include "CalibCalorimetry/CaloMiscalibTools/interface/MiscalibReaderFromXMLEcalEndcap.h" -#include "DataFormats/EgammaCandidates/interface/GsfElectronFwd.h" #include "DataFormats/EgammaReco/interface/SuperCluster.h" #include "DataFormats/EgammaReco/interface/BasicCluster.h" #include "RecoEcal/EgammaCoreTools/interface/EcalClusterTools.h" @@ -23,7 +20,6 @@ //Not to remain in the final version #include "TH2.h" #include "TFile.h" -#include //---------------------------------------------------------------- //ctor @@ -46,7 +42,11 @@ InvRingCalib::InvRingCalib(const edm::ParameterSet& iConfig) m_endRing(iConfig.getParameter("endRing")), m_EBcoeffFile(iConfig.getParameter("EBcoeffs")), m_EEcoeffFile(iConfig.getParameter("EEcoeffs")), - m_EEZone(iConfig.getParameter("EEZone")) { + m_EEZone(iConfig.getParameter("EEZone")), + m_ebRecHitToken(consumes(m_barrelAlCa)), + m_eeRecHitToken(consumes(m_endcapAlCa)), + m_gsfElectronToken(consumes(m_ElectronLabel)), + m_geometryToken(esConsumes()) { //controls if the parameters inputed are correct if ((m_etaEnd * m_etaStart) > 0) assert(!((m_etaEnd - m_etaStart) % m_etaWidth)); @@ -130,13 +130,11 @@ edm::EDLooper::Status InvRingCalib::duringLoop(const edm::Event& iEvent, const e if (isfirstcall_) { edm::LogInfo("IML") << "[InvRingCalib][beginOfJob]"; //gets the geometry from the event setup - edm::ESHandle geoHandle; - iSetup.get().get(geoHandle); - const CaloGeometry* geometry = geoHandle.product(); + const auto& geometry = iSetup.getData(m_geometryToken); edm::LogInfo("IML") << "[InvRingCalib] Event Setup read"; //fills a vector with all the cells - m_barrelCells = geometry->getValidDetIds(DetId::Ecal, EcalBarrel); - m_endcapCells = geometry->getValidDetIds(DetId::Ecal, EcalEndcap); + m_barrelCells = geometry.getValidDetIds(DetId::Ecal, EcalBarrel); + m_endcapCells = geometry.getValidDetIds(DetId::Ecal, EcalEndcap); //Defines the EB regions edm::LogInfo("IML") << "[InvRingCalib] Defining Barrel Regions"; EBRegionDef(); @@ -234,17 +232,18 @@ edm::EDLooper::Status InvRingCalib::duringLoop(const edm::Event& iEvent, const e double pTk = 0.; const EcalRecHitCollection* barrelHitsCollection = nullptr; edm::Handle barrelRecHitsHandle; - iEvent.getByLabel(m_barrelAlCa, barrelRecHitsHandle); + iEvent.getByToken(m_ebRecHitToken, barrelRecHitsHandle); barrelHitsCollection = barrelRecHitsHandle.product(); if (!barrelRecHitsHandle.isValid()) { edm::LogError("IML") << "[EcalEleCalibLooper] barrel rec hits not found"; return kContinue; } + //gets the endcap recHits const EcalRecHitCollection* endcapHitsCollection = nullptr; edm::Handle endcapRecHitsHandle; - iEvent.getByLabel(m_endcapAlCa, endcapRecHitsHandle); + iEvent.getByToken(m_eeRecHitToken, endcapRecHitsHandle); endcapHitsCollection = endcapRecHitsHandle.product(); if (!endcapRecHitsHandle.isValid()) { @@ -254,7 +253,7 @@ edm::EDLooper::Status InvRingCalib::duringLoop(const edm::Event& iEvent, const e //gets the electrons edm::Handle pElectrons; - iEvent.getByLabel(m_ElectronLabel, pElectrons); + iEvent.getByToken(m_gsfElectronToken, pElectrons); if (!pElectrons.isValid()) { edm::LogError("IML") << "[EcalEleCalibLooper] electrons not found"; @@ -382,13 +381,9 @@ void InvRingCalib::endOfJob() { //!EE ring definition void InvRingCalib::EERingDef(const edm::EventSetup& iSetup) { - //Gets the Handle for the geometry from the eventSetup - edm::ESHandle geoHandle; - iSetup.get().get(geoHandle); //Gets the geometry of the endcap - const CaloGeometry* geometry = geoHandle.product(); - const CaloSubdetectorGeometry* endcapGeometry = geometry->getSubdetectorGeometry(DetId::Ecal, EcalEndcap); - // const CaloSubdetectorGeometry *barrelGeometry = geometry->getSubdetectorGeometry(DetId::Ecal, EcalBarrel); + const auto& geometry = iSetup.getData(m_geometryToken); + const CaloSubdetectorGeometry* endcapGeometry = geometry.getSubdetectorGeometry(DetId::Ecal, EcalEndcap); //for every xtal gets the position Vector and the phi position // for (std::vector::const_iterator barrelIt = m_barrelCells.begin(); diff --git a/Calibration/EcalCalibAlgos/src/PhiSymmetryCalibration.cc b/Calibration/EcalCalibAlgos/src/PhiSymmetryCalibration.cc index d0f5d8f8e449a..65aef4d2e594c 100644 --- a/Calibration/EcalCalibAlgos/src/PhiSymmetryCalibration.cc +++ b/Calibration/EcalCalibAlgos/src/PhiSymmetryCalibration.cc @@ -5,26 +5,19 @@ // Framework #include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" #include "DataFormats/EcalDetId/interface/EBDetId.h" #include "DataFormats/EcalDetId/interface/EEDetId.h" -#include "CondFormats/DataRecord/interface/EcalIntercalibConstantsRcd.h" #include "CondFormats/EcalObjects/interface/EcalIntercalibErrors.h" #include "CondTools/Ecal/interface/EcalIntercalibConstantsXMLTranslator.h" #include "FWCore/Framework/interface/LuminosityBlock.h" // Geometry -#include "Geometry/Records/interface/CaloGeometryRecord.h" #include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h" #include "Geometry/CaloGeometry/interface/CaloCellGeometry.h" -#include "Geometry/CaloGeometry/interface/CaloGeometry.h" //Channel status -#include "CondFormats/EcalObjects/interface/EcalChannelStatus.h" -#include "CondFormats/DataRecord/interface/EcalChannelStatusRcd.h" #include "CondFormats/EcalObjects/interface/EcalChannelStatusCode.h" #include "FWCore/Framework/interface/Run.h" @@ -47,11 +40,13 @@ const float PhiSymmetryCalibration::kMiscalRangeEE = .10; // Class constructor PhiSymmetryCalibration::PhiSymmetryCalibration(const edm::ParameterSet& iConfig) - : - - ecalHitsProducer_(iConfig.getParameter("ecalRecHitsProducer")), + : ecalHitsProducer_(iConfig.getParameter("ecalRecHitsProducer")), barrelHits_(iConfig.getParameter("barrelHitCollection")), endcapHits_(iConfig.getParameter("endcapHitCollection")), + ebRecHitToken_(consumes(edm::InputTag(ecalHitsProducer_, barrelHits_))), + eeRecHitToken_(consumes(edm::InputTag(ecalHitsProducer_, endcapHits_))), + channelStatusToken_(esConsumes()), + geometryToken_(esConsumes()), eCut_barl_(iConfig.getParameter("eCut_barrel")), ap_(iConfig.getParameter("ap")), b_(iConfig.getParameter("b")), @@ -71,6 +66,9 @@ PhiSymmetryCalibration::PhiSymmetryCalibration(const edm::ParameterSet& iConfig) nevents_ = 0; eventsinrun_ = 0; eventsinlb_ = 0; + + // because ROOT draws something + usesResource(); } //_____________________________________________________________________________ @@ -239,21 +237,20 @@ void PhiSymmetryCalibration::analyze(const edm::Event& event, const edm::EventSe Handle barrelRecHitsHandle; Handle endcapRecHitsHandle; - event.getByLabel(ecalHitsProducer_, barrelHits_, barrelRecHitsHandle); + event.getByToken(ebRecHitToken_, barrelRecHitsHandle); if (!barrelRecHitsHandle.isValid()) { LogError("") << "[PhiSymmetryCalibration] Error! Can't get product!" << std::endl; } - event.getByLabel(ecalHitsProducer_, endcapHits_, endcapRecHitsHandle); + event.getByToken(ebRecHitToken_, endcapRecHitsHandle); if (!endcapRecHitsHandle.isValid()) { LogError("") << "[PhiSymmetryCalibration] Error! Can't get product!" << std::endl; } // get the ecal geometry - edm::ESHandle geoHandle; - setup.get().get(geoHandle); - const CaloSubdetectorGeometry* barrelGeometry = geoHandle->getSubdetectorGeometry(DetId::Ecal, EcalBarrel); - const CaloSubdetectorGeometry* endcapGeometry = geoHandle->getSubdetectorGeometry(DetId::Ecal, EcalEndcap); + const auto& geometry = setup.getData(geometryToken_); + const auto* barrelGeometry = geometry.getSubdetectorGeometry(DetId::Ecal, EcalBarrel); + const auto* endcapGeometry = geometry.getSubdetectorGeometry(DetId::Ecal, EcalEndcap); bool pass = false; // select interesting EcalRecHits (barrel) @@ -377,6 +374,8 @@ void PhiSymmetryCalibration::analyze(const edm::Event& event, const edm::EventSe } } +void PhiSymmetryCalibration::beginRun(edm::Run const&, const edm::EventSetup&) {} + void PhiSymmetryCalibration::endRun(edm::Run const& run, const edm::EventSetup&) { std::cout << "PHIREPRT : run " << run.run() << " start " << (run.beginTime().value() >> 32) << " end " << (run.endTime().value() >> 32) << " dur " @@ -478,13 +477,11 @@ void PhiSymmetryCalibration::getKfactors() { //_____________________________________________________________________________ void PhiSymmetryCalibration::setUp(const edm::EventSetup& setup) { - edm::ESHandle chStatus; - setup.get().get(chStatus); + const auto& chStatus = setup.getData(channelStatusToken_); - edm::ESHandle geoHandle; - setup.get().get(geoHandle); + const auto& geometry = setup.getData(geometryToken_); - e_.setup(&(*geoHandle), &(*chStatus), statusThreshold_); + e_.setup(&geometry, &chStatus, statusThreshold_); if (reiteration_) { EcalCondHeader h; @@ -498,16 +495,11 @@ void PhiSymmetryCalibration::setUp(const edm::EventSetup& setup) { int ret = EcalIntercalibConstantsXMLTranslator::readXML(fip.fullPath(), h, oldCalibs_); if (ret) edm::LogError("PhiSym") << "Error reading XML files" << endl; - ; - - } else { - // in fact if not reiterating, oldCalibs_ will never be used - edm::ESHandle pIcal; - setup.get().get(pIcal); - oldCalibs_ = *pIcal; } } +void PhiSymmetryCalibration::beginLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) {} + void PhiSymmetryCalibration::endLuminosityBlock(edm::LuminosityBlock const& lb, edm::EventSetup const&) { if ((lb.endTime().value() >> 32) - (lb.beginTime().value() >> 32) < 60) return; diff --git a/Calibration/EcalCalibAlgos/src/PhiSymmetryCalibration_step2.cc b/Calibration/EcalCalibAlgos/src/PhiSymmetryCalibration_step2.cc index b0a3b2cbb9883..525c8a40c77ea 100644 --- a/Calibration/EcalCalibAlgos/src/PhiSymmetryCalibration_step2.cc +++ b/Calibration/EcalCalibAlgos/src/PhiSymmetryCalibration_step2.cc @@ -4,9 +4,6 @@ #include "CondFormats/EcalObjects/interface/EcalIntercalibConstants.h" #include "CondTools/Ecal/interface/EcalIntercalibConstantsXMLTranslator.h" #include "CondFormats/DataRecord/interface/EcalIntercalibConstantsRcd.h" -#include "CondFormats/DataRecord/interface/EcalChannelStatusRcd.h" -#include "Geometry/Records/interface/CaloGeometryRecord.h" -#include "Geometry/CaloGeometry/interface/CaloGeometry.h" #include "TH2F.h" @@ -20,14 +17,15 @@ using namespace std; PhiSymmetryCalibration_step2::~PhiSymmetryCalibration_step2() {} -PhiSymmetryCalibration_step2::PhiSymmetryCalibration_step2(const edm::ParameterSet& iConfig) { - statusThreshold_ = iConfig.getUntrackedParameter("statusThreshold", 0); - have_initial_miscalib_ = iConfig.getUntrackedParameter("haveInitialMiscalib", false); - initialmiscalibfile_ = iConfig.getUntrackedParameter("initialmiscalibfile", "InitialMiscalib.xml"); - oldcalibfile_ = iConfig.getUntrackedParameter("oldcalibfile", "EcalIntercalibConstants.xml"); - reiteration_ = iConfig.getUntrackedParameter("reiteration", false); - firstpass_ = true; -} +PhiSymmetryCalibration_step2::PhiSymmetryCalibration_step2(const edm::ParameterSet& iConfig) + : channelStatusToken_(esConsumes()), + geometryToken_(esConsumes()), + firstpass_(true), + statusThreshold_(iConfig.getUntrackedParameter("statusThreshold", 0)), + reiteration_(iConfig.getUntrackedParameter("reiteration", false)), + oldcalibfile_(iConfig.getUntrackedParameter("oldcalibfile", "EcalIntercalibConstants.xml")), + have_initial_miscalib_(iConfig.getUntrackedParameter("haveInitialMiscalib", false)), + initialmiscalibfile_(iConfig.getUntrackedParameter("initialmiscalibfile", "InitialMiscalib.xml")) {} void PhiSymmetryCalibration_step2::analyze(const edm::Event& ev, const edm::EventSetup& se) { if (firstpass_) { @@ -37,16 +35,14 @@ void PhiSymmetryCalibration_step2::analyze(const edm::Event& ev, const edm::Even } void PhiSymmetryCalibration_step2::setUp(const edm::EventSetup& se) { - edm::ESHandle chStatus; - se.get().get(chStatus); + const auto& chStatus = se.getData(channelStatusToken_); - edm::ESHandle geoHandle; - se.get().get(geoHandle); + const auto& geometry = se.getData(geometryToken_); - barrelCells = geoHandle->getValidDetIds(DetId::Ecal, EcalBarrel); - endcapCells = geoHandle->getValidDetIds(DetId::Ecal, EcalEndcap); + barrelCells = geometry.getValidDetIds(DetId::Ecal, EcalBarrel); + endcapCells = geometry.getValidDetIds(DetId::Ecal, EcalEndcap); - e_.setup(&(*geoHandle), &(*chStatus), statusThreshold_); + e_.setup(&geometry, &chStatus, statusThreshold_); /// if a miscalibration was applied, load it, if not put it to 1 if (have_initial_miscalib_) { diff --git a/Calibration/EcalCalibAlgos/src/PhiSymmetryCalibration_step2.h b/Calibration/EcalCalibAlgos/src/PhiSymmetryCalibration_step2.h index 99bb7044b2611..bc6de209ed439 100644 --- a/Calibration/EcalCalibAlgos/src/PhiSymmetryCalibration_step2.h +++ b/Calibration/EcalCalibAlgos/src/PhiSymmetryCalibration_step2.h @@ -1,15 +1,20 @@ +#ifndef Calibration_EcalCalibAlgos_PhiSymmetryCalibration_step2_h +#define Calibration_EcalCalibAlgos_PhiSymmetryCalibration_step2_h + #include "Calibration/EcalCalibAlgos/interface/EcalGeomPhiSymHelper.h" +#include "CondFormats/DataRecord/interface/EcalChannelStatusRcd.h" #include "CondFormats/EcalObjects/interface/EcalIntercalibConstants.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "Geometry/Records/interface/CaloGeometryRecord.h" +#include "Geometry/CaloGeometry/interface/CaloGeometry.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/Framework/interface/ProducerBase.h" #include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/ESHandle.h" class TH1F; class TH2F; -class PhiSymmetryCalibration_step2 : public edm::EDAnalyzer { +class PhiSymmetryCalibration_step2 : public edm::one::EDAnalyzer<> { public: PhiSymmetryCalibration_step2(const edm::ParameterSet& iConfig); ~PhiSymmetryCalibration_step2() override; @@ -29,6 +34,9 @@ class PhiSymmetryCalibration_step2 : public edm::EDAnalyzer { void readEtSums(); private: + const edm::ESGetToken channelStatusToken_; + const edm::ESGetToken geometryToken_; + // Transverse energy sum arrays double etsum_barl_[kBarlRings][kBarlWedges][kSides]; double etsum_endc_[kEndcWedgesX][kEndcWedgesX][kSides]; @@ -62,10 +70,10 @@ class PhiSymmetryCalibration_step2 : public edm::EDAnalyzer { std::vector endcapCells; bool firstpass_; - int statusThreshold_; + const int statusThreshold_; - bool reiteration_; - std::string oldcalibfile_; + const bool reiteration_; + const std::string oldcalibfile_; /// the old calibration constants (when reiterating, the last ones derived) EcalIntercalibConstants oldCalibs_; @@ -77,8 +85,8 @@ class PhiSymmetryCalibration_step2 : public edm::EDAnalyzer { EcalIntercalibConstants miscalib_; /// - bool have_initial_miscalib_; - std::string initialmiscalibfile_; + const bool have_initial_miscalib_; + const std::string initialmiscalibfile_; /// res miscalib histos std::vector miscal_resid_barl_histos; @@ -87,3 +95,4 @@ class PhiSymmetryCalibration_step2 : public edm::EDAnalyzer { std::vector miscal_resid_endc_histos; std::vector correl_endc_histos; }; +#endif diff --git a/Calibration/EcalCalibAlgos/src/PhiSymmetryCalibration_step2_SM.cc b/Calibration/EcalCalibAlgos/src/PhiSymmetryCalibration_step2_SM.cc index 26920ad29267f..412de801b7bf1 100644 --- a/Calibration/EcalCalibAlgos/src/PhiSymmetryCalibration_step2_SM.cc +++ b/Calibration/EcalCalibAlgos/src/PhiSymmetryCalibration_step2_SM.cc @@ -4,9 +4,6 @@ #include "CondFormats/EcalObjects/interface/EcalIntercalibConstants.h" #include "CondTools/Ecal/interface/EcalIntercalibConstantsXMLTranslator.h" #include "CondFormats/DataRecord/interface/EcalIntercalibConstantsRcd.h" -#include "CondFormats/DataRecord/interface/EcalChannelStatusRcd.h" -#include "Geometry/Records/interface/CaloGeometryRecord.h" -#include "Geometry/CaloGeometry/interface/CaloGeometry.h" #include "TH2F.h" @@ -20,14 +17,15 @@ using namespace std; PhiSymmetryCalibration_step2_SM::~PhiSymmetryCalibration_step2_SM() {} -PhiSymmetryCalibration_step2_SM::PhiSymmetryCalibration_step2_SM(const edm::ParameterSet& iConfig) { - statusThreshold_ = iConfig.getUntrackedParameter("statusThreshold", 0); - have_initial_miscalib_ = iConfig.getUntrackedParameter("haveInitialMiscalib", false); - initialmiscalibfile_ = iConfig.getUntrackedParameter("initialmiscalibfile", "InitialMiscalib.xml"); - oldcalibfile_ = iConfig.getUntrackedParameter("oldcalibfile", "EcalIntercalibConstants.xml"); - reiteration_ = iConfig.getUntrackedParameter("reiteration", false); - firstpass_ = true; -} +PhiSymmetryCalibration_step2_SM::PhiSymmetryCalibration_step2_SM(const edm::ParameterSet& iConfig) + : channelStatusToken_(esConsumes()), + geometryToken_(esConsumes()), + firstpass_(true), + statusThreshold_(iConfig.getUntrackedParameter("statusThreshold", 0)), + reiteration_(iConfig.getUntrackedParameter("reiteration", false)), + oldcalibfile_(iConfig.getUntrackedParameter("oldcalibfile", "EcalIntercalibConstants.xml")), + have_initial_miscalib_(iConfig.getUntrackedParameter("haveInitialMiscalib", false)), + initialmiscalibfile_(iConfig.getUntrackedParameter("initialmiscalibfile", "InitialMiscalib.xml")) {} void PhiSymmetryCalibration_step2_SM::analyze(const edm::Event& ev, const edm::EventSetup& se) { if (firstpass_) { @@ -37,16 +35,14 @@ void PhiSymmetryCalibration_step2_SM::analyze(const edm::Event& ev, const edm::E } void PhiSymmetryCalibration_step2_SM::setUp(const edm::EventSetup& se) { - edm::ESHandle chStatus; - se.get().get(chStatus); + const auto& chStatus = se.getData(channelStatusToken_); - edm::ESHandle geoHandle; - se.get().get(geoHandle); + const auto& geometry = se.getData(geometryToken_); - barrelCells = geoHandle->getValidDetIds(DetId::Ecal, EcalBarrel); - endcapCells = geoHandle->getValidDetIds(DetId::Ecal, EcalEndcap); + barrelCells = geometry.getValidDetIds(DetId::Ecal, EcalBarrel); + endcapCells = geometry.getValidDetIds(DetId::Ecal, EcalEndcap); - e_.setup(&(*geoHandle), &(*chStatus), statusThreshold_); + e_.setup(&geometry, &chStatus, statusThreshold_); for (int sign = 0; sign < kSides; sign++) { for (int ieta = 0; ieta < kBarlRings; ieta++) { diff --git a/Calibration/EcalCalibAlgos/src/PhiSymmetryCalibration_step2_SM.h b/Calibration/EcalCalibAlgos/src/PhiSymmetryCalibration_step2_SM.h index 9e6fb71e8d9ea..a042821b6c560 100644 --- a/Calibration/EcalCalibAlgos/src/PhiSymmetryCalibration_step2_SM.h +++ b/Calibration/EcalCalibAlgos/src/PhiSymmetryCalibration_step2_SM.h @@ -1,15 +1,20 @@ +#ifndef Calibration_EcalCalibAlgos_PhiSymmetryCalibration_step2_SM_h +#define Calibration_EcalCalibAlgos_PhiSymmetryCalibration_step2_SM_h + #include "Calibration/EcalCalibAlgos/interface/EcalGeomPhiSymHelper.h" +#include "CondFormats/DataRecord/interface/EcalChannelStatusRcd.h" #include "CondFormats/EcalObjects/interface/EcalIntercalibConstants.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "Geometry/Records/interface/CaloGeometryRecord.h" +#include "Geometry/CaloGeometry/interface/CaloGeometry.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/Framework/interface/ProducerBase.h" #include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/ESHandle.h" class TH1F; class TH2F; -class PhiSymmetryCalibration_step2_SM : public edm::EDAnalyzer { +class PhiSymmetryCalibration_step2_SM : public edm::one::EDAnalyzer<> { public: PhiSymmetryCalibration_step2_SM(const edm::ParameterSet& iConfig); ~PhiSymmetryCalibration_step2_SM() override; @@ -29,6 +34,9 @@ class PhiSymmetryCalibration_step2_SM : public edm::EDAnalyzer { void readEtSums(); private: + const edm::ESGetToken channelStatusToken_; + const edm::ESGetToken geometryToken_; + // Transverse energy sum arrays double etsum_barl_[kBarlRings][kBarlWedges][kSides]; @@ -71,10 +79,10 @@ class PhiSymmetryCalibration_step2_SM : public edm::EDAnalyzer { std::vector endcapCells; bool firstpass_; - int statusThreshold_; + const int statusThreshold_; - bool reiteration_; - std::string oldcalibfile_; + const bool reiteration_; + const std::string oldcalibfile_; /// the old calibration constants (when reiterating, the last ones derived) EcalIntercalibConstants oldCalibs_; @@ -86,8 +94,8 @@ class PhiSymmetryCalibration_step2_SM : public edm::EDAnalyzer { EcalIntercalibConstants miscalib_; /// - bool have_initial_miscalib_; - std::string initialmiscalibfile_; + const bool have_initial_miscalib_; + const std::string initialmiscalibfile_; /// res miscalib histos std::vector miscal_resid_barl_histos; @@ -96,3 +104,4 @@ class PhiSymmetryCalibration_step2_SM : public edm::EDAnalyzer { std::vector miscal_resid_endc_histos; std::vector correl_endc_histos; }; +#endif diff --git a/Calibration/EcalCalibAlgos/src/Pi0FixedMassWindowCalibration.cc b/Calibration/EcalCalibAlgos/src/Pi0FixedMassWindowCalibration.cc index 3a7c38e93878c..dc0f53472473e 100644 --- a/Calibration/EcalCalibAlgos/src/Pi0FixedMassWindowCalibration.cc +++ b/Calibration/EcalCalibAlgos/src/Pi0FixedMassWindowCalibration.cc @@ -6,17 +6,14 @@ // Conditions database -#include "CondFormats/DataRecord/interface/EcalIntercalibConstantsRcd.h" #include "Calibration/Tools/interface/Pi0CalibXMLwriter.h" // Reconstruction Classes #include "DataFormats/EgammaReco/interface/BasicCluster.h" #include "DataFormats/EgammaReco/interface/BasicClusterFwd.h" // Geometry -#include "Geometry/Records/interface/CaloGeometryRecord.h" #include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h" #include "Geometry/CaloGeometry/interface/CaloCellGeometry.h" -#include "Geometry/CaloGeometry/interface/CaloGeometry.h" #include "Geometry/CaloTopology/interface/EcalEndcapTopology.h" #include "Geometry/CaloTopology/interface/EcalBarrelTopology.h" @@ -35,7 +32,10 @@ using namespace std; Pi0FixedMassWindowCalibration::Pi0FixedMassWindowCalibration(const edm::ParameterSet& iConfig) : theMaxLoops(iConfig.getUntrackedParameter("maxLoops", 0)), ecalHitsProducer_(iConfig.getParameter("ecalRecHitsProducer")), - barrelHits_(iConfig.getParameter("barrelHitCollection")) { + barrelHits_(iConfig.getParameter("barrelHitCollection")), + recHitToken_(consumes(edm::InputTag(ecalHitsProducer_, barrelHits_))), + intercalibConstantsToken_(esConsumes()), + geometryToken_(esConsumes()) { std::cout << "[Pi0FixedMassWindowCalibration] Constructor " << std::endl; // The verbosity level std::string verbosityString = iConfig.getParameter("VerbosityLevel"); @@ -272,6 +272,9 @@ edm::EDLooper::Status Pi0FixedMassWindowCalibration::duringLoop(const edm::Event // this chunk used to belong to beginJob(isetup). Moved here // with the beginJob without arguments migration + // get the ecal geometry: + const auto& geometry = setup.getData(geometryToken_); + if (isfirstcall_) { // initialize arrays @@ -288,23 +291,9 @@ edm::EDLooper::Status Pi0FixedMassWindowCalibration::duringLoop(const edm::Event // get initial constants out of DB - edm::ESHandle pIcal; - EcalIntercalibConstantMap imap; - - try { - setup.get().get(pIcal); - std::cout << "Taken EcalIntercalibConstants" << std::endl; - imap = pIcal.product()->getMap(); - std::cout << "imap.size() = " << imap.size() << std::endl; - } catch (std::exception& ex) { - std::cerr << "Error! can't get EcalIntercalibConstants " << std::endl; - } - - // get the ecal geometry: - edm::ESHandle geoHandle; - setup.get().get(geoHandle); - const CaloGeometry& geometry = *geoHandle; - //const CaloSubdetectorGeometry *barrelGeometry = geometry.getSubdetectorGeometry(DetId::Ecal, EcalBarrel); + const auto& pIcal = setup.getData(intercalibConstantsToken_); + const auto& imap = pIcal.getMap(); + std::cout << "imap.size() = " << imap.size() << std::endl; // loop over all barrel crystals barrelCells = geometry.getValidDetIds(DetId::Ecal, EcalBarrel); @@ -340,7 +329,7 @@ edm::EDLooper::Status Pi0FixedMassWindowCalibration::duringLoop(const edm::Event int nRecHitsEB = 0; Handle pEcalRecHitBarrelCollection; - event.getByLabel(ecalHitsProducer_, barrelHits_, pEcalRecHitBarrelCollection); + event.getByToken(recHitToken_, pEcalRecHitBarrelCollection); const EcalRecHitCollection* ecalRecHitBarrelCollection = pEcalRecHitBarrelCollection.product(); cout << " ECAL Barrel RecHits # " << ecalRecHitBarrelCollection->size() << endl; for (EcalRecHitCollection::const_iterator aRecHitEB = ecalRecHitBarrelCollection->begin(); @@ -380,18 +369,14 @@ edm::EDLooper::Status Pi0FixedMassWindowCalibration::duringLoop(const edm::Event irecalib++; } - // get the geometry and topology from the event setup: - edm::ESHandle geoHandle; - setup.get().get(geoHandle); - const CaloSubdetectorGeometry* geometry_p; std::string clustershapetag; - geometry_p = geoHandle->getSubdetectorGeometry(DetId::Ecal, EcalBarrel); - EcalBarrelTopology topology{*geoHandle}; + geometry_p = geometry.getSubdetectorGeometry(DetId::Ecal, EcalBarrel); + EcalBarrelTopology topology{geometry}; const CaloSubdetectorGeometry* geometryES_p; - geometryES_p = geoHandle->getSubdetectorGeometry(DetId::Ecal, EcalPreshower); + geometryES_p = geometry.getSubdetectorGeometry(DetId::Ecal, EcalPreshower); /* reco::BasicClusterCollection clusters; diff --git a/Calibration/EcalCalibAlgos/src/ZeeCalibration.cc b/Calibration/EcalCalibAlgos/src/ZeeCalibration.cc index 7d483783b7514..316830af6c303 100644 --- a/Calibration/EcalCalibAlgos/src/ZeeCalibration.cc +++ b/Calibration/EcalCalibAlgos/src/ZeeCalibration.cc @@ -1,22 +1,12 @@ #include #include -#include -#include -#include #include -#include #include #include #include -#include -#include -#include -#include -#include #include #include -#include #include @@ -35,36 +25,39 @@ #include "CondFormats/EcalObjects/interface/EcalIntercalibConstants.h" #include "DataFormats/CaloRecHit/interface/CaloRecHit.h" #include "DataFormats/Common/interface/Handle.h" -#include "DataFormats/Common/interface/TriggerResults.h" -#include "DataFormats/DetId/interface/DetId.h" #include "DataFormats/EcalDetId/interface/EBDetId.h" #include "DataFormats/EcalDetId/interface/EEDetId.h" -#include "DataFormats/EcalRecHit/interface/EcalRecHit.h" -#include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" -#include "DataFormats/EgammaCandidates/interface/Electron.h" -#include "DataFormats/EgammaCandidates/interface/GsfElectron.h" -#include "DataFormats/EgammaCandidates/interface/GsfElectronFwd.h" #include "DataFormats/EgammaReco/interface/BasicCluster.h" #include "DataFormats/EgammaReco/interface/SuperCluster.h" -#include "DataFormats/TrackReco/interface/Track.h" -#include "DataFormats/TrackReco/interface/TrackExtraFwd.h" -#include "DataFormats/TrackReco/interface/TrackFwd.h" -#include "FWCore/Framework/interface/ESHandle.h" -#include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/Framework/interface/TriggerNamesService.h" -#include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/ServiceRegistry/interface/Service.h" -#include "Geometry/CaloGeometry/interface/CaloGeometry.h" #include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h" -#include "Geometry/Records/interface/CaloGeometryRecord.h" -#include "SimDataFormats/GeneratorProducts/interface/HepMCProduct.h" #define MZ 91.1876 #define DEBUG 1 -ZeeCalibration::ZeeCalibration(const edm::ParameterSet& iConfig) { +ZeeCalibration::ZeeCalibration(const edm::ParameterSet& iConfig) + : hlTriggerResults_(iConfig.getParameter("HLTriggerResults")), + mcProducer_(iConfig.getUntrackedParameter("mcProducer", "")), + rechitProducer_(iConfig.getParameter("rechitProducer")), + rechitCollection_(iConfig.getParameter("rechitCollection")), + erechitProducer_(iConfig.getParameter("erechitProducer")), + erechitCollection_(iConfig.getParameter("erechitCollection")), + scProducer_(iConfig.getParameter("scProducer")), + scCollection_(iConfig.getParameter("scCollection")), + scIslandProducer_(iConfig.getParameter("scIslandProducer")), + scIslandCollection_(iConfig.getParameter("scIslandCollection")), + electronProducer_(iConfig.getParameter("electronProducer")), + electronCollection_(iConfig.getParameter("electronCollection")), + trigResultsToken_(consumes(hlTriggerResults_)), + hepMCToken_(consumes(edm::InputTag(mcProducer_))), + ebRecHitToken_(consumes(edm::InputTag(rechitProducer_, rechitCollection_))), + eeRecHitToken_(consumes(edm::InputTag(erechitProducer_, erechitCollection_))), + scToken_(consumes(edm::InputTag(scProducer_, scCollection_))), + islandSCToken_(consumes(edm::InputTag(scIslandProducer_, scIslandCollection_))), + gsfElectronToken_(consumes(edm::InputTag(electronProducer_, electronCollection_))), + geometryToken_(esConsumes()) { #ifdef DEBUG std::cout << "[ZeeCalibration] Starting the ctor" << std::endl; #endif @@ -78,25 +71,8 @@ ZeeCalibration::ZeeCalibration(const edm::ParameterSet& iConfig) { minInvMassCut_ = iConfig.getUntrackedParameter("minInvMassCut", 70.); maxInvMassCut_ = iConfig.getUntrackedParameter("maxInvMassCut", 110.); - rechitProducer_ = iConfig.getParameter("rechitProducer"); - rechitCollection_ = iConfig.getParameter("rechitCollection"); - - erechitProducer_ = iConfig.getParameter("erechitProducer"); - erechitCollection_ = iConfig.getParameter("erechitCollection"); - - scProducer_ = iConfig.getParameter("scProducer"); - scCollection_ = iConfig.getParameter("scCollection"); - - scIslandProducer_ = iConfig.getParameter("scIslandProducer"); - scIslandCollection_ = iConfig.getParameter("scIslandCollection"); - calibMode_ = iConfig.getUntrackedParameter("ZCalib_CalibType"); - mcProducer_ = iConfig.getUntrackedParameter("mcProducer", ""); - - electronProducer_ = iConfig.getParameter("electronProducer"); - electronCollection_ = iConfig.getParameter("electronCollection"); - outputFile_ = TFile::Open(outputFileName_.c_str(), "RECREATE"); // open output file to store histograms myTree = new TTree("myTree", "myTree"); @@ -124,8 +100,6 @@ ZeeCalibration::ZeeCalibration(const edm::ParameterSet& iConfig) { //ZeeCalibrationPLots("zeeCalibPlots"); //ZeecaPlots->bookHistos(maxsIter); - hlTriggerResults_ = iConfig.getParameter("HLTriggerResults"); - theParameterSet = iConfig; EcalIndexingTools* myIndexTool = nullptr; @@ -585,9 +559,8 @@ edm::EDLooper::Status ZeeCalibration::duringLoop(const edm::Event& iEvent, const // code that used to be in beginJob if (isfirstcall_) { //inizializzare la geometria di ecal - edm::ESHandle pG; - iSetup.get().get(pG); - EcalRingCalibrationTools::setCaloGeometry(&(*pG)); + const auto& geometry = iSetup.getData(geometryToken_); + EcalRingCalibrationTools::setCaloGeometry(&geometry); myZeePlots_ = new ZeePlots("zeePlots.root"); // myZeeRescaleFactorPlots_ = new ZeeRescaleFactorPlots("zeeRescaleFactorPlots.root"); @@ -717,7 +690,7 @@ edm::EDLooper::Status ZeeCalibration::duringLoop(const edm::Event& iEvent, const #endif edm::Handle hltTriggerResultHandle; - iEvent.getByLabel(hlTriggerResults_, hltTriggerResultHandle); + iEvent.getByToken(trigResultsToken_, hltTriggerResultHandle); if (!hltTriggerResultHandle.isValid()) { //std::cout << "invalid handle for HLT TriggerResults" << std::endl; @@ -757,8 +730,7 @@ edm::EDLooper::Status ZeeCalibration::duringLoop(const edm::Event& iEvent, const if (!mcProducer_.empty()) { //DUMP GENERATED Z MASS - BEGIN Handle hepProd; - // iEvent.getByLabel( "source", hepProd ) ; - iEvent.getByLabel(mcProducer_, hepProd); + iEvent.getByToken(hepMCToken_, hepProd); const HepMC::GenEvent* myGenEvent = hepProd->GetEvent(); @@ -809,27 +781,24 @@ edm::EDLooper::Status ZeeCalibration::duringLoop(const edm::Event& iEvent, const // Get EBRecHits Handle phits; - try { - iEvent.getByLabel(rechitProducer_, rechitCollection_, phits); - } catch (std::exception& ex) { + iEvent.getByToken(ebRecHitToken_, phits); + if (!phits.isValid()) { std::cerr << "Error! can't get the product EBRecHitCollection " << std::endl; } const EBRecHitCollection* hits = phits.product(); // get a ptr to the product // Get EERecHits Handle ephits; - try { - iEvent.getByLabel(erechitProducer_, erechitCollection_, ephits); - } catch (std::exception& ex) { + iEvent.getByToken(eeRecHitToken_, ephits); + if (!ephits.isValid()) { std::cerr << "Error! can't get the product EERecHitCollection " << std::endl; } const EERecHitCollection* ehits = ephits.product(); // get a ptr to the product //Get Hybrid SuperClusters Handle pSuperClusters; - try { - iEvent.getByLabel(scProducer_, scCollection_, pSuperClusters); - } catch (std::exception& ex) { + iEvent.getByToken(scToken_, pSuperClusters); + if (!pSuperClusters.isValid()) { std::cerr << "Error! can't get the product SuperClusterCollection " << std::endl; } const reco::SuperClusterCollection* scCollection = pSuperClusters.product(); @@ -843,9 +812,8 @@ edm::EDLooper::Status ZeeCalibration::duringLoop(const edm::Event& iEvent, const //Get Island SuperClusters Handle pIslandSuperClusters; - try { - iEvent.getByLabel(scIslandProducer_, scIslandCollection_, pIslandSuperClusters); - } catch (std::exception& ex) { + iEvent.getByToken(islandSCToken_, pIslandSuperClusters); + if (!pIslandSuperClusters.isValid()) { std::cerr << "Error! can't get the product IslandSuperClusterCollection " << std::endl; } const reco::SuperClusterCollection* scIslandCollection = pIslandSuperClusters.product(); @@ -859,9 +827,8 @@ edm::EDLooper::Status ZeeCalibration::duringLoop(const edm::Event& iEvent, const // Get Electrons Handle pElectrons; - try { - iEvent.getByLabel(electronProducer_, electronCollection_, pElectrons); - } catch (std::exception& ex) { + iEvent.getByToken(gsfElectronToken_, pElectrons); + if (!pElectrons.isValid()) { std::cerr << "Error! can't get the product ElectronCollection " << std::endl; } const reco::GsfElectronCollection* electronCollection = pElectrons.product(); diff --git a/Calibration/HcalAlCaRecoProducers/BuildFile.xml b/Calibration/HcalAlCaRecoProducers/BuildFile.xml deleted file mode 100644 index 70a45f24766ba..0000000000000 --- a/Calibration/HcalAlCaRecoProducers/BuildFile.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Calibration/HcalAlCaRecoProducers/interface/AlCaEcalHcalReadoutsProducer.h b/Calibration/HcalAlCaRecoProducers/interface/AlCaEcalHcalReadoutsProducer.h deleted file mode 100644 index 71980b641a95c..0000000000000 --- a/Calibration/HcalAlCaRecoProducers/interface/AlCaEcalHcalReadoutsProducer.h +++ /dev/null @@ -1,51 +0,0 @@ -// -*- C++ -*- - -// system include files -#include -#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/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/MakerMacros.h" -#include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" - -#include "DataFormats/Common/interface/Ref.h" -#include "DataFormats/CaloTowers/interface/CaloTowerCollection.h" -#include "DataFormats/DetId/interface/DetId.h" - -#include "Geometry/Records/interface/IdealGeometryRecord.h" -#include "Geometry/CaloGeometry/interface/CaloGeometry.h" -#include "DataFormats/GeometryVector/interface/GlobalPoint.h" -#include "DataFormats/CaloTowers/interface/CaloTowerDetId.h" -#include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h" -#include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" - -// -// class decleration -// - -class AlCaEcalHcalReadoutsProducer : public edm::global::EDProducer<> { -public: - explicit AlCaEcalHcalReadoutsProducer(const edm::ParameterSet &); - - void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override; - -private: - // ----------member data --------------------------- - - edm::EDGetTokenT tok_hbhe_; - edm::EDGetTokenT tok_ho_; - edm::EDGetTokenT tok_hf_; - - edm::EDPutTokenT put_hbhe_; - edm::EDPutTokenT put_ho_; - edm::EDPutTokenT put_hf_; -}; diff --git a/Calibration/HcalAlCaRecoProducers/interface/AlCaHcalNoiseProducer.h b/Calibration/HcalAlCaRecoProducers/interface/AlCaHcalNoiseProducer.h deleted file mode 100644 index f1c5d19926916..0000000000000 --- a/Calibration/HcalAlCaRecoProducers/interface/AlCaHcalNoiseProducer.h +++ /dev/null @@ -1,72 +0,0 @@ -// -*- C++ -*- - -// system include files -#include -#include -// user include files -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDProducer.h" - -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/MakerMacros.h" - -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/MakerMacros.h" -#include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" - -#include "DataFormats/Common/interface/Ref.h" -#include "DataFormats/CaloTowers/interface/CaloTowerCollection.h" -#include "DataFormats/DetId/interface/DetId.h" - -#include "Geometry/Records/interface/IdealGeometryRecord.h" -#include "Geometry/CaloGeometry/interface/CaloGeometry.h" -#include "DataFormats/GeometryVector/interface/GlobalPoint.h" -#include "DataFormats/CaloTowers/interface/CaloTowerDetId.h" -#include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h" -#include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" - -#include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h" -#include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" -#include "DataFormats/METReco/interface/CaloMETCollection.h" -#include "DataFormats/JetReco/interface/CaloJetCollection.h" -#include "DataFormats/CaloTowers/interface/CaloTowerCollection.h" - -// -// class decleration -// - -class AlCaHcalNoiseProducer : public edm::EDProducer { -public: - explicit AlCaHcalNoiseProducer(const edm::ParameterSet &); - ~AlCaHcalNoiseProducer() override; - - void produce(edm::Event &, const edm::EventSetup &) override; - -private: - // ----------member data --------------------------- - - bool useMet_; - bool useJet_; - double MetCut_; - double JetMinE_; - double JetHCALminEnergyFraction_; - int nAnomalousEvents; - int nEvents; - - std::vector ecalLabels_; - - edm::EDGetTokenT tok_jets_; - edm::EDGetTokenT tok_met_; - edm::EDGetTokenT tok_tower_; - - edm::EDGetTokenT tok_hbhe_; - edm::EDGetTokenT tok_ho_; - edm::EDGetTokenT tok_hf_; - - edm::EDGetTokenT tok_ps_; - edm::EDGetTokenT tok_raw_; - std::vector > toks_ecal_; -}; diff --git a/Calibration/HcalAlCaRecoProducers/src/AlCaDiJetsProducer.cc b/Calibration/HcalAlCaRecoProducers/plugins/AlCaDiJetsProducer.cc similarity index 76% rename from Calibration/HcalAlCaRecoProducers/src/AlCaDiJetsProducer.cc rename to Calibration/HcalAlCaRecoProducers/plugins/AlCaDiJetsProducer.cc index 4672ab10cbb50..a46b0d79ed310 100644 --- a/Calibration/HcalAlCaRecoProducers/src/AlCaDiJetsProducer.cc +++ b/Calibration/HcalAlCaRecoProducers/plugins/AlCaDiJetsProducer.cc @@ -3,12 +3,13 @@ #include // user include files #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDProducer.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/Framework/interface/EventSetup.h" +#include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" #include "DataFormats/DetId/interface/DetId.h" #include "DataFormats/EgammaCandidates/interface/Photon.h" @@ -32,26 +33,36 @@ #include "Geometry/Records/interface/CaloGeometryRecord.h" #include +namespace alcaHcalDiJet { + struct Counters { + Counters() : nAll_(0), nSelect_(0) {} + mutable std::atomic nAll_, nSelect_; + }; +} // namespace alcaHcalDiJet + // // class declaration // -class AlCaDiJetsProducer : public edm::EDProducer { +class AlCaDiJetsProducer : public edm::global::EDProducer> { public: explicit AlCaDiJetsProducer(const edm::ParameterSet&); - ~AlCaDiJetsProducer() override; - void beginJob() override; - void produce(edm::Event&, const edm::EventSetup&) override; - void endJob() override; + ~AlCaDiJetsProducer() override = default; + + std::shared_ptr globalBeginRun(edm::Run const&, edm::EventSetup const&) const override { + return std::make_shared(); + } + void produce(edm::StreamID, edm::Event&, const edm::EventSetup&) const override; + void globalEndRun(edm::Run const& iRun, edm::EventSetup const&) const override; + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); private: - bool select(reco::PFJetCollection); + bool select(reco::PFJetCollection) const; // ----------member data --------------------------- edm::InputTag labelPFJet_, labelHBHE_, labelHF_, labelHO_, labelPFCandidate_, labelVertex_; //labelTrigger_, double minPtJet_; - int nAll_, nSelect_; edm::EDGetTokenT tok_PFJet_; edm::EDGetTokenT>> tok_HBHE_; @@ -62,7 +73,7 @@ class AlCaDiJetsProducer : public edm::EDProducer { edm::EDGetTokenT tok_Vertex_; }; -AlCaDiJetsProducer::AlCaDiJetsProducer(const edm::ParameterSet& iConfig) : nAll_(0), nSelect_(0) { +AlCaDiJetsProducer::AlCaDiJetsProducer(const edm::ParameterSet& iConfig) { // Take input labelPFJet_ = iConfig.getParameter("PFjetInput"); labelHBHE_ = iConfig.getParameter("HBHEInput"); @@ -91,68 +102,60 @@ AlCaDiJetsProducer::AlCaDiJetsProducer(const edm::ParameterSet& iConfig) : nAll_ produces(labelVertex_.encode()); } -AlCaDiJetsProducer::~AlCaDiJetsProducer() {} - -void AlCaDiJetsProducer::beginJob() {} - -void AlCaDiJetsProducer::endJob() { - edm::LogVerbatim("AlcaDiJets") << "Accepts " << nSelect_ << " events from a total of " << nAll_ << " events"; +void AlCaDiJetsProducer::globalEndRun(edm::Run const& iRun, edm::EventSetup const&) const { + edm::LogVerbatim("AlcaDiJets") << "Accepts " << runCache(iRun.index())->nSelect_ << " events from a total of " + << runCache(iRun.index())->nAll_ << " events"; } -bool AlCaDiJetsProducer::select(reco::PFJetCollection jt) { +bool AlCaDiJetsProducer::select(reco::PFJetCollection jt) const { if (jt.size() < 2) return false; if (((jt.at(0)).pt()) < minPtJet_) return false; return true; } + // ------------ method called to produce the data ------------ -void AlCaDiJetsProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { - nAll_++; +void AlCaDiJetsProducer::produce(edm::StreamID, edm::Event& iEvent, const edm::EventSetup& iSetup) const { + ++(runCache(iEvent.getRun().index())->nAll_); // Access the collections from iEvent - edm::Handle pfjet; - iEvent.getByToken(tok_PFJet_, pfjet); + edm::Handle pfjet = iEvent.getHandle(tok_PFJet_); if (!pfjet.isValid()) { edm::LogWarning("AlCaDiJets") << "AlCaDiJetsProducer: Error! can't get product " << labelPFJet_; return; } const reco::PFJetCollection pfjets = *(pfjet.product()); - edm::Handle pfc; - iEvent.getByToken(tok_PFCand_, pfc); + edm::Handle pfc = iEvent.getHandle(tok_PFCand_); if (!pfc.isValid()) { edm::LogWarning("AlCaDiJets") << "AlCaDiJetsProducer: Error! can't get product " << labelPFCandidate_; return; } const reco::PFCandidateCollection pfcand = *(pfc.product()); - edm::Handle vt; - iEvent.getByToken(tok_Vertex_, vt); + edm::Handle vt = iEvent.getHandle(tok_Vertex_); if (!vt.isValid()) { edm::LogWarning("AlCaDiJets") << "AlCaDiJetsProducer: Error! can't get product " << labelVertex_; return; } const reco::VertexCollection vtx = *(vt.product()); - edm::Handle>> hbhe; - iEvent.getByToken(tok_HBHE_, hbhe); + auto hbhe = iEvent.getHandle(tok_HBHE_); if (!hbhe.isValid()) { edm::LogWarning("AlCaDiJets") << "AlCaDiJetsProducer: Error! can't get product " << labelHBHE_; return; } const edm::SortedCollection> Hithbhe = *(hbhe.product()); - edm::Handle>> ho; - iEvent.getByToken(tok_HO_, ho); + auto ho = iEvent.getHandle(tok_HO_); if (!ho.isValid()) { edm::LogWarning("AlCaDiJets") << "AlCaDiJetsProducer: Error! can't get product " << labelHO_; return; } const edm::SortedCollection> Hitho = *(ho.product()); - edm::Handle>> hf; - iEvent.getByToken(tok_HF_, hf); + auto hf = iEvent.getHandle(tok_HF_); if (!hf.isValid()) { edm::LogWarning("AlCaDiJets") << "AlCaDiJetsProducer: Error! can't get product " << labelHF_; return; @@ -162,7 +165,7 @@ void AlCaDiJetsProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSet // See if this event is useful bool accept = select(pfjets); if (accept) { - nSelect_++; + ++(runCache(iEvent.getRun().index())->nSelect_); //Copy from standard place auto miniPFjetCollection = std::make_unique(); @@ -215,4 +218,16 @@ void AlCaDiJetsProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSet return; } +void AlCaDiJetsProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + desc.add("PFjetInput", edm::InputTag("ak4PFJetsCHS")), + desc.add("HBHEInput", edm::InputTag("hbhereco")); + desc.add("HFInput", edm::InputTag("hfreco")); + desc.add("HOInput", edm::InputTag("horeco")); + desc.add("particleFlowInput", edm::InputTag("particleFlow")); + desc.add("VertexInput", edm::InputTag("offlinePrimaryVertices")); + desc.add("MinPtJet", 20.0); + descriptions.add("alcaDiJetsProducer", desc); +} + DEFINE_FWK_MODULE(AlCaDiJetsProducer); diff --git a/Calibration/HcalAlCaRecoProducers/plugins/AlCaEcalHcalReadoutsProducer.cc b/Calibration/HcalAlCaRecoProducers/plugins/AlCaEcalHcalReadoutsProducer.cc new file mode 100644 index 0000000000000..c078afa761f2d --- /dev/null +++ b/Calibration/HcalAlCaRecoProducers/plugins/AlCaEcalHcalReadoutsProducer.cc @@ -0,0 +1,96 @@ +// -*- C++ -*- + +// system include files +#include +#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/EventSetup.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" + +#include "DataFormats/Common/interface/Ref.h" +#include "DataFormats/CaloTowers/interface/CaloTowerCollection.h" +#include "DataFormats/DetId/interface/DetId.h" + +#include "Geometry/Records/interface/IdealGeometryRecord.h" +#include "Geometry/CaloGeometry/interface/CaloGeometry.h" +#include "DataFormats/GeometryVector/interface/GlobalPoint.h" +#include "DataFormats/CaloTowers/interface/CaloTowerDetId.h" +#include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h" +#include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" + +// +// class decleration +// + +class AlCaEcalHcalReadoutsProducer : public edm::global::EDProducer<> { +public: + explicit AlCaEcalHcalReadoutsProducer(const edm::ParameterSet&); + ~AlCaEcalHcalReadoutsProducer() override = default; + + void produce(edm::StreamID, edm::Event&, const edm::EventSetup&) const override; + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + +private: + // ----------member data --------------------------- + + edm::EDGetTokenT tok_hbhe_; + edm::EDGetTokenT tok_ho_; + edm::EDGetTokenT tok_hf_; + + edm::EDPutTokenT put_hbhe_; + edm::EDPutTokenT put_ho_; + edm::EDPutTokenT put_hf_; +}; + +AlCaEcalHcalReadoutsProducer::AlCaEcalHcalReadoutsProducer(const edm::ParameterSet& iConfig) { + tok_ho_ = consumes(iConfig.getParameter("hoInput")); + tok_hf_ = consumes(iConfig.getParameter("hfInput")); + tok_hbhe_ = consumes(iConfig.getParameter("hbheInput")); + + //register your products + put_hbhe_ = produces("HBHERecHitCollection"); + put_ho_ = produces("HORecHitCollection"); + put_hf_ = produces("HFRecHitCollection"); +} + +// ------------ method called to produce the data ------------ +void AlCaEcalHcalReadoutsProducer::produce(edm::StreamID, edm::Event& iEvent, const edm::EventSetup& iSetup) const { + edm::Handle hbhe = iEvent.getHandle(tok_hbhe_); + if (!hbhe.isValid()) { + edm::LogVerbatim("AlCaEcalHcal") << "AlCaEcalHcalReadoutProducer: Error! can't get hbhe product!"; + return; + } + + edm::Handle ho = iEvent.getHandle(tok_ho_); + if (!ho.isValid()) { + edm::LogVerbatim("AlCaEcalHcal") << "AlCaEcalHcalReadoutProducer: Error! can't get ho product!"; + } + + edm::Handle hf = iEvent.getHandle(tok_hf_); + if (!hf.isValid()) { + edm::LogVerbatim("AlCaEcalHcal") << "AlCaEcalHcalReadoutProducer: Error! can't get hf product!"; + } + + //Put selected information in the event + iEvent.emplace(put_hbhe_, *hbhe); + iEvent.emplace(put_ho_, *ho); + iEvent.emplace(put_hf_, *hf); +} + +void AlCaEcalHcalReadoutsProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + desc.add("hbheInput", edm::InputTag("hbhereco")); + desc.add("hfInput", edm::InputTag("hfreco")); + desc.add("hoInput", edm::InputTag("horeco")); + descriptions.add("alcaEcalHcalReadoutsProducer", desc); +} + +#include "FWCore/PluginManager/interface/ModuleDef.h" +#include "FWCore/Framework/interface/MakerMacros.h" + +DEFINE_FWK_MODULE(AlCaEcalHcalReadoutsProducer); diff --git a/Calibration/HcalAlCaRecoProducers/src/AlCaGammaJetProducer.cc b/Calibration/HcalAlCaRecoProducers/plugins/AlCaGammaJetProducer.cc similarity index 85% rename from Calibration/HcalAlCaRecoProducers/src/AlCaGammaJetProducer.cc rename to Calibration/HcalAlCaRecoProducers/plugins/AlCaGammaJetProducer.cc index 944a3564b1b7c..5ada273df77a7 100644 --- a/Calibration/HcalAlCaRecoProducers/src/AlCaGammaJetProducer.cc +++ b/Calibration/HcalAlCaRecoProducers/plugins/AlCaGammaJetProducer.cc @@ -5,10 +5,11 @@ #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/Framework/interface/EventSetup.h" +#include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" #include "DataFormats/DetId/interface/DetId.h" #include "DataFormats/EgammaCandidates/interface/Photon.h" @@ -39,7 +40,9 @@ class AlCaGammaJetProducer : public edm::global::EDProducer<> { public: explicit AlCaGammaJetProducer(const edm::ParameterSet&); + ~AlCaGammaJetProducer() override = default; void produce(edm::StreamID, edm::Event&, const edm::EventSetup&) const override; + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); private: bool select(const reco::PhotonCollection&, const reco::PFJetCollection&) const; @@ -156,107 +159,95 @@ bool AlCaGammaJetProducer::select(const reco::PhotonCollection& ph, const reco:: } return false; } + // ------------ method called to produce the data ------------ void AlCaGammaJetProducer::produce(edm::StreamID, edm::Event& iEvent, const edm::EventSetup&) const { // Access the collections from iEvent - edm::Handle phoHandle; - iEvent.getByToken(tok_Photon_, phoHandle); + auto const& phoHandle = iEvent.getHandle(tok_Photon_); if (!phoHandle.isValid()) { edm::LogWarning("AlCaGammaJet") << "AlCaGammaJetProducer: Error! can't get the product " << labelPhoton_; return; } const reco::PhotonCollection& photon = *(phoHandle.product()); - edm::Handle pfjet; - iEvent.getByToken(tok_PFJet_, pfjet); + auto const& pfjet = iEvent.getHandle(tok_PFJet_); if (!pfjet.isValid()) { edm::LogWarning("AlCaGammaJet") << "AlCaGammaJetProducer: Error! can't get product " << labelPFJet_; return; } const reco::PFJetCollection& pfjets = *(pfjet.product()); - edm::Handle pfc; - iEvent.getByToken(tok_PFCand_, pfc); + auto const& pfc = iEvent.getHandle(tok_PFCand_); if (!pfc.isValid()) { edm::LogWarning("AlCaGammaJet") << "AlCaGammaJetProducer: Error! can't get product " << labelPFCandidate_; return; } const reco::PFCandidateCollection& pfcand = *(pfc.product()); - edm::Handle vt; - iEvent.getByToken(tok_Vertex_, vt); + auto const& vt = iEvent.getHandle(tok_Vertex_); if (!vt.isValid()) { edm::LogWarning("AlCaGammaJet") << "AlCaGammaJetProducer: Error! can't get product " << labelVertex_; return; } const reco::VertexCollection& vtx = *(vt.product()); - edm::Handle pfmt; - iEvent.getByToken(tok_PFMET_, pfmt); + auto const& pfmt = iEvent.getHandle(tok_PFMET_); if (!pfmt.isValid()) { edm::LogWarning("AlCaGammaJet") << "AlCaGammaJetProducer: Error! can't get product " << labelPFMET_; return; } const reco::PFMETCollection& pfmet = *(pfmt.product()); - edm::Handle>> hbhe; - iEvent.getByToken(tok_HBHE_, hbhe); + auto const& hbhe = iEvent.getHandle(tok_HBHE_); if (!hbhe.isValid()) { edm::LogWarning("AlCaGammaJet") << "AlCaGammaJetProducer: Error! can't get product " << labelHBHE_; return; } const edm::SortedCollection>& Hithbhe = *(hbhe.product()); - edm::Handle>> ho; - iEvent.getByToken(tok_HO_, ho); + auto const& ho = iEvent.getHandle(tok_HO_); if (!ho.isValid()) { edm::LogWarning("AlCaGammaJet") << "AlCaGammaJetProducer: Error! can't get product " << labelHO_; return; } const edm::SortedCollection>& Hitho = *(ho.product()); - edm::Handle>> hf; - iEvent.getByToken(tok_HF_, hf); + auto const& hf = iEvent.getHandle(tok_HF_); if (!hf.isValid()) { edm::LogWarning("AlCaGammaJet") << "AlCaGammaJetProducer: Error! can't get product " << labelHF_; return; } const edm::SortedCollection>& Hithf = *(hf.product()); - edm::Handle trig; - iEvent.getByToken(tok_TrigRes_, trig); + auto const& trig = iEvent.getHandle(tok_TrigRes_); if (!trig.isValid()) { edm::LogWarning("AlCaGammaJet") << "AlCaGammaJetProducer: Error! can't get product " << labelTrigger_; return; } const edm::TriggerResults& trigres = *(trig.product()); - edm::Handle rh; - iEvent.getByToken(tok_Rho_, rh); + auto const& rh = iEvent.getHandle(tok_Rho_); if (!rh.isValid()) { edm::LogWarning("AlCaGammaJet") << "AlCaGammaJetProducer: Error! can't get product " << labelRho_; return; } const double rho_val = *(rh.product()); - edm::Handle gsf; - iEvent.getByToken(tok_GsfElec_, gsf); + auto const& gsf = iEvent.getHandle(tok_GsfElec_); if (!gsf.isValid()) { edm::LogWarning("AlCaGammaJet") << "AlCaGammaJetProducer: Error! can't get product " << labelGsfEle_; return; } const reco::GsfElectronCollection& gsfele = *(gsf.product()); - edm::Handle con; - iEvent.getByToken(tok_Conv_, con); + auto const& con = iEvent.getHandle(tok_Conv_); if (!con.isValid()) { edm::LogWarning("AlCaGammaJet") << "AlCaGammaJetProducer: Error! can't get product " << labelConv_; return; } const reco::ConversionCollection& conv = *(con.product()); - edm::Handle bs; - iEvent.getByToken(tok_BS_, bs); + auto const& bs = iEvent.getHandle(tok_BS_); if (!bs.isValid()) { edm::LogWarning("AlCaGammaJet") << "AlCaGammaJetProducer: Error! can't get product " << labelBeamSpot_; return; @@ -287,10 +278,8 @@ void AlCaGammaJetProducer::produce(edm::StreamID, edm::Event& iEvent, const edm: iEvent.emplace(put_rho_, rho_val); iEvent.emplace(put_conv_, conv); - edm::Handle> loosePhotonQual; - iEvent.getByToken(tok_loosePhoton_, loosePhotonQual); - edm::Handle> tightPhotonQual; - iEvent.getByToken(tok_tightPhoton_, tightPhotonQual); + auto const& loosePhotonQual = iEvent.getHandle(tok_loosePhoton_); + auto const& tightPhotonQual = iEvent.getHandle(tok_tightPhoton_); if (loosePhotonQual.isValid() && tightPhotonQual.isValid()) { miniLoosePhoton.reserve(photon.size()); miniTightPhoton.reserve(photon.size()); @@ -329,4 +318,26 @@ void AlCaGammaJetProducer::produce(edm::StreamID, edm::Event& iEvent, const edm: return; } +void AlCaGammaJetProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + desc.add("PhoInput", edm::InputTag("gedPhotons")); + desc.add("PFjetInput", edm::InputTag("ak4PFJetsCHS")); + desc.add("HBHEInput", edm::InputTag("hbhereco")); + desc.add("HFInput", edm::InputTag("hfreco")); + desc.add("HOInput", edm::InputTag("horeco")); + desc.add("METInput", edm::InputTag("pfMet")); + desc.add("TriggerResults", edm::InputTag("TriggerResults::HLT")); + desc.add("gsfeleInput", edm::InputTag("gedGsfElectrons")); + desc.add("particleFlowInput", edm::InputTag("particleFlow")); + desc.add("VertexInput", edm::InputTag("offlinePrimaryVertices")); + desc.add("ConversionsInput", edm::InputTag("allConversions")); + desc.add("rhoInput", edm::InputTag("fixedGridRhoFastjetAll")); + desc.add("BeamSpotInput", edm::InputTag("offlineBeamSpot")); + desc.add("PhoLoose", edm::InputTag("PhotonIDProdGED", "PhotonCutBasedIDLoose")); + desc.add("PhoTight", edm::InputTag("PhotonIDProdGED", "PhotonCutBasedIDTight")); + desc.add("MinPtJet", 10.0); + desc.add("MinPtPhoton", 10.0); + descriptions.add("alcaGammaJetProducer", desc); +} + DEFINE_FWK_MODULE(AlCaGammaJetProducer); diff --git a/Calibration/HcalAlCaRecoProducers/plugins/AlCaGammaJetSelector.cc b/Calibration/HcalAlCaRecoProducers/plugins/AlCaGammaJetSelector.cc index 6312302cfde2f..d0554c4728ac2 100644 --- a/Calibration/HcalAlCaRecoProducers/plugins/AlCaGammaJetSelector.cc +++ b/Calibration/HcalAlCaRecoProducers/plugins/AlCaGammaJetSelector.cc @@ -27,6 +27,7 @@ #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" #include "DataFormats/EgammaCandidates/interface/Photon.h" #include "DataFormats/EgammaCandidates/interface/PhotonFwd.h" @@ -47,7 +48,7 @@ namespace AlCaGammaJet { class AlCaGammaJetSelector : public edm::stream::EDFilter > { public: explicit AlCaGammaJetSelector(const edm::ParameterSet&, const AlCaGammaJet::Counters* count); - ~AlCaGammaJetSelector() override; + ~AlCaGammaJetSelector() override = default; static std::unique_ptr initializeGlobalCache(edm::ParameterSet const&) { return std::make_unique(); @@ -101,8 +102,6 @@ AlCaGammaJetSelector::AlCaGammaJetSelector(const edm::ParameterSet& iConfig, con tok_PFJet_ = consumes(labelPFJet_); } -AlCaGammaJetSelector::~AlCaGammaJetSelector() {} - // // member functions // @@ -116,7 +115,7 @@ void AlCaGammaJetSelector::fillDescriptions(edm::ConfigurationDescriptions& desc desc.add("PFjetInput", edm::InputTag("ak4PFJetsCHS")); desc.add("MinPtJet", 10.0); desc.add("MinPtPhoton", 10.0); - descriptions.addDefault(desc); + descriptions.add("alcaGammaJetSelector", desc); } // ------------ method called on each new Event ------------ @@ -124,16 +123,14 @@ bool AlCaGammaJetSelector::filter(edm::Event& iEvent, const edm::EventSetup& iSe nProcessed_++; // Access the collections from iEvent - edm::Handle phoHandle; - iEvent.getByToken(tok_Photon_, phoHandle); + auto const& phoHandle = iEvent.getHandle(tok_Photon_); if (!phoHandle.isValid()) { edm::LogWarning("AlCaGammaJet") << "AlCaGammaJetProducer: Error! can't get the product " << labelPhoton_; return false; // do not filter } const reco::PhotonCollection photons = *(phoHandle.product()); - edm::Handle pfjetHandle; - iEvent.getByToken(tok_PFJet_, pfjetHandle); + auto const& pfjetHandle = iEvent.getHandle(tok_PFJet_); if (!pfjetHandle.isValid()) { edm::LogWarning("AlCaGammaJet") << "AlCaGammaJetProducer: Error! can't get product " << labelPFJet_; return false; // do not filter diff --git a/Calibration/HcalAlCaRecoProducers/plugins/AlCaHBHEMuonFilter.cc b/Calibration/HcalAlCaRecoProducers/plugins/AlCaHBHEMuonFilter.cc index d641028461442..693dfc9418540 100644 --- a/Calibration/HcalAlCaRecoProducers/plugins/AlCaHBHEMuonFilter.cc +++ b/Calibration/HcalAlCaRecoProducers/plugins/AlCaHBHEMuonFilter.cc @@ -70,6 +70,7 @@ class AlCaHBHEMuonFilter : public edm::stream::EDFilter tok_trigEvt; @@ -104,6 +105,7 @@ AlCaHBHEMuonFilter::AlCaHBHEMuonFilter(edm::ParameterSet const& iConfig, const A preScale_ = iConfig.getParameter("PreScale"); if (preScale_ < 1) preScale_ = 1; + onlyOuterTrack_ = iConfig.getParameter("OnlyOuterTrack"); // define tokens for access tok_trigRes_ = consumes(triggerResults_); @@ -112,9 +114,11 @@ AlCaHBHEMuonFilter::AlCaHBHEMuonFilter(edm::ParameterSet const& iConfig, const A tok_geom_ = esConsumes(); tok_magField_ = esConsumes(); - edm::LogVerbatim("HBHEMuon") << "Parameters read from config file \n" - << "Process " << processName_ << " Prescale " << preScale_ << " Isolation Cuts " - << trackIsoCut_ << ":" << caloIsoCut_ << "\n"; + edm::LogVerbatim("HBHEMuon") << "Parameters read from config file \nProcess " << processName_ << " Prescale " + << preScale_ << " Isolation Cuts " << pfCut_ << ":" << pfIsoCut_ << ":" << trackIsoCut_ + << ":" << caloIsoCut_ << " OnlyOuterTrack " << onlyOuterTrack_ << "\nInput tags " + << labelMuon_ << " and " << triggerResults_ << "\nStudy " << trigNames_.size() + << " triggers: "; for (unsigned int k = 0; k < trigNames_.size(); ++k) edm::LogVerbatim("HBHEMuon") << "Trigger[" << k << "] " << trigNames_[k] << "\n"; } // AlCaHBHEMuonFilter::AlCaHBHEMuonFilter constructor @@ -140,8 +144,7 @@ bool AlCaHBHEMuonFilter::filter(edm::Event& iEvent, edm::EventSetup const& iSetu if (trigNames_.empty()) { ok = true; } else { - edm::Handle triggerResults; - iEvent.getByToken(tok_trigRes_, triggerResults); + auto const& triggerResults = iEvent.getHandle(tok_trigRes_); if (triggerResults.isValid()) { std::vector modules; const edm::TriggerNames& triggerNames = iEvent.triggerNames(*triggerResults); @@ -168,22 +171,27 @@ bool AlCaHBHEMuonFilter::filter(edm::Event& iEvent, edm::EventSetup const& iSetu const CaloGeometry* geo = &(iSetup.getData(tok_geom_)); // Relevant blocks from iEvent - edm::Handle _Muon; - iEvent.getByToken(tok_Muon_, _Muon); + auto muonHandle = iEvent.getHandle(tok_Muon_); #ifdef EDM_ML_DEBUG - edm::LogVerbatim("HBHEMuon") << "AlCaHBHEMuonFilter::Muon Handle " << _Muon.isValid() << std::endl; + edm::LogVerbatim("HBHEMuon") << "AlCaHBHEMuonFilter::Muon Handle " << muonHandle.isValid(); #endif - if (_Muon.isValid()) { - for (reco::MuonCollection::const_iterator RecMuon = _Muon->begin(); RecMuon != _Muon->end(); ++RecMuon) { + if (muonHandle.isValid()) { +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("HBHEMuon") << "AlCaHBHEMuonFilter::Size of collection " << muonHandle->size(); +#endif + for (reco::MuonCollection::const_iterator RecMuon = muonHandle->begin(); RecMuon != muonHandle->end(); + ++RecMuon) { #ifdef EDM_ML_DEBUG edm::LogVerbatim("HBHEMuon") << "AlCaHBHEMuonFilter::Muon:Track " << RecMuon->track().isNonnull() << " innerTrack " << RecMuon->innerTrack().isNonnull() << " outerTrack " << RecMuon->outerTrack().isNonnull() << " globalTrack " << RecMuon->globalTrack().isNonnull() << std::endl; #endif - if ((RecMuon->track().isNonnull()) && (RecMuon->innerTrack().isNonnull()) && - (RecMuon->outerTrack().isNonnull()) && (RecMuon->globalTrack().isNonnull())) { - const reco::Track* pTrack = (RecMuon->innerTrack()).get(); + bool check = (onlyOuterTrack_) ? (RecMuon->outerTrack().isNonnull()) + : ((RecMuon->track().isNonnull()) && (RecMuon->innerTrack().isNonnull()) && + (RecMuon->outerTrack().isNonnull()) && (RecMuon->globalTrack().isNonnull())); + if (check) { + const reco::Track* pTrack = (onlyOuterTrack_) ? (RecMuon->outerTrack()).get() : (RecMuon->innerTrack()).get(); spr::propagatedTrackID trackID = spr::propagateCALO(pTrack, geo, bField, false); #ifdef EDM_ML_DEBUG edm::LogVerbatim("HBHEMuon") << "AlCaHBHEMuonFilter::Propagate: ECAL " << trackID.okECAL << " to HCAL " @@ -198,6 +206,10 @@ bool AlCaHBHEMuonFilter::filter(edm::Event& iEvent, edm::EventSetup const& iSetu (0.5 * RecMuon->pfIsolationR04().sumPUPt))) / RecMuon->pt()); bool isoCut = (pfCut_) ? (isolR04 < pfIsoCut_) : ((trackIso < trackIsoCut_) && (caloIso < caloIsoCut_)); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("HBHEMuon") << "AlCaHBHEMuonFilter::Isolation: " << trackIso << ":" << caloIso << ":" + << isolR04 << " --> " << isoCut; +#endif if ((trackID.okECAL) && (trackID.okHCAL) && isoCut) { accept = true; break; @@ -260,6 +272,7 @@ void AlCaHBHEMuonFilter::fillDescriptions(edm::ConfigurationDescriptions& descri desc.add("TrackIsolationCut", 3.0); desc.add("CaloIsolationCut", 5.0); desc.add("PreScale", 2); + desc.add("OnlyOuterTrack", false); descriptions.add("AlcaHBHEMuonFilter", desc); } diff --git a/Calibration/HcalAlCaRecoProducers/src/AlCaHBHEMuonProducer.cc b/Calibration/HcalAlCaRecoProducers/plugins/AlCaHBHEMuonProducer.cc similarity index 87% rename from Calibration/HcalAlCaRecoProducers/src/AlCaHBHEMuonProducer.cc rename to Calibration/HcalAlCaRecoProducers/plugins/AlCaHBHEMuonProducer.cc index 9a556e426f578..fd08466285f29 100644 --- a/Calibration/HcalAlCaRecoProducers/src/AlCaHBHEMuonProducer.cc +++ b/Calibration/HcalAlCaRecoProducers/plugins/AlCaHBHEMuonProducer.cc @@ -33,6 +33,7 @@ #include "DataFormats/VertexReco/interface/VertexFwd.h" #include "DataFormats/VertexReco/interface/Vertex.h" +//#define EDM_ML_DEBUG // // class declaration // @@ -56,6 +57,7 @@ class AlCaHBHEMuonProducer : public edm::stream::EDProducer bmspot; - iEvent.getByToken(tok_BS_, bmspot); + auto bmspot = iEvent.getHandle(tok_BS_); if (!bmspot.isValid()) { edm::LogWarning("HcalHBHEMuon") << "AlCaHBHEMuonProducer: Error! can't get product " << labelBS_; valid = false; } - edm::Handle vt; - iEvent.getByToken(tok_Vtx_, vt); + auto vt = iEvent.getHandle(tok_Vtx_); if (!vt.isValid()) { edm::LogWarning("HcalHBHEMuon") << "AlCaHBHEMuonProducer: Error! can't get product " << labelVtx_; valid = false; } - edm::Handle barrelRecHitsHandle; - iEvent.getByToken(tok_EB_, barrelRecHitsHandle); + auto barrelRecHitsHandle = iEvent.getHandle(tok_EB_); if (!barrelRecHitsHandle.isValid()) { edm::LogWarning("HcalHBHEMuon") << "AlCaHBHEMuonProducer: Error! can't get product " << labelEB_; valid = false; } - edm::Handle endcapRecHitsHandle; - iEvent.getByToken(tok_EE_, endcapRecHitsHandle); + auto endcapRecHitsHandle = iEvent.getHandle(tok_EE_); if (!endcapRecHitsHandle.isValid()) { edm::LogWarning("HcalHBHEMuon") << "AlCaHBHEMuonProducer: Error! can't get product " << labelEE_; valid = false; } - edm::Handle hbhe; - iEvent.getByToken(tok_HBHE_, hbhe); + auto hbhe = iEvent.getHandle(tok_HBHE_); if (!hbhe.isValid()) { edm::LogWarning("HcalHBHEMuon") << "AlCaHBHEMuonProducer: Error! can't get product " << labelHBHE_; valid = false; } - edm::Handle muonhandle; - iEvent.getByToken(tok_Muon_, muonhandle); + auto muonhandle = iEvent.getHandle(tok_Muon_); if (!muonhandle.isValid()) { edm::LogWarning("HcalHBHEMuon") << "AlCaHBHEMuonProducer: Error! can't get product " << labelMuon_; valid = false; @@ -224,6 +220,20 @@ void AlCaHBHEMuonProducer::globalEndJob(const AlCaHBHEMuons::Counters* count) { edm::LogVerbatim("HcalHBHEMuon") << "Finds " << count->nGood_ << " good tracks in " << count->nAll_ << " events"; } +void AlCaHBHEMuonProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + //The following says we do not know what parameters are allowed so do no validation + // Please change this to state exactly what you do use, even if it is no parameters + edm::ParameterSetDescription desc; + desc.add("BeamSpotLabel", edm::InputTag("offlineBeamSpot")); + desc.add("VertexLabel", edm::InputTag("offlinePrimaryVertices")); + desc.add("EBRecHitLabel", edm::InputTag("ecalRecHit", "EcalRecHitsEB")); + desc.add("EERecHitLabel", edm::InputTag("ecalRecHit", "EcalRecHitsEE")); + desc.add("HBHERecHitLabel", edm::InputTag("hbhereco")); + desc.add("MuonLabel", edm::InputTag("muons")); + desc.add("MinimumMuonP", 10.0); + descriptions.add("alcaHBHEMuonProducer", desc); +} + void AlCaHBHEMuonProducer::beginRun(edm::Run const& iRun, edm::EventSetup const& iSetup) { edm::LogVerbatim("HcalHBHEMuon") << "Run[" << nRun_ << "] " << iRun.run(); } diff --git a/Calibration/HcalAlCaRecoProducers/plugins/AlCaHEMuonFilter.cc b/Calibration/HcalAlCaRecoProducers/plugins/AlCaHEMuonFilter.cc index f2b81201adf6f..865f2eb61c69e 100644 --- a/Calibration/HcalAlCaRecoProducers/plugins/AlCaHEMuonFilter.cc +++ b/Calibration/HcalAlCaRecoProducers/plugins/AlCaHEMuonFilter.cc @@ -138,8 +138,7 @@ bool AlCaHEMuonFilter::filter(edm::Event& iEvent, edm::EventSetup const& iSetup) #endif //Step1: Find if the event passes one of the chosen triggers /////////////////////////////TriggerResults - edm::Handle triggerResults; - iEvent.getByToken(tok_trigRes_, triggerResults); + edm::Handle triggerResults = iEvent.getHandle(tok_trigRes_); if (triggerResults.isValid()) { bool ok(false); std::vector modules; @@ -166,13 +165,13 @@ bool AlCaHEMuonFilter::filter(edm::Event& iEvent, edm::EventSetup const& iSetup) const CaloGeometry* geo = &(iSetup.getData(tok_geom_)); // Relevant blocks from iEvent - edm::Handle _Muon; - iEvent.getByToken(tok_Muon_, _Muon); + edm::Handle muonHandle = iEvent.getHandle(tok_Muon_); #ifdef EDM_ML_DEBUG - edm::LogVerbatim("HEMuon") << "AlCaHEMuonFilter::Muon Handle " << _Muon.isValid() << std::endl; + edm::LogVerbatim("HEMuon") << "AlCaHEMuonFilter::Muon Handle " << muonHandle.isValid(); #endif - if (_Muon.isValid()) { - for (reco::MuonCollection::const_iterator RecMuon = _Muon->begin(); RecMuon != _Muon->end(); ++RecMuon) { + if (muonHandle.isValid()) { + for (reco::MuonCollection::const_iterator RecMuon = muonHandle->begin(); RecMuon != muonHandle->end(); + ++RecMuon) { #ifdef EDM_ML_DEBUG edm::LogVerbatim("HEMuon") << "AlCaHEMuonFilter::Muon:Track " << RecMuon->track().isNonnull() << " innerTrack " << RecMuon->innerTrack().isNonnull() << " outerTrack " @@ -257,7 +256,6 @@ void AlCaHEMuonFilter::fillDescriptions(edm::ConfigurationDescriptions& descript desc.add("processName", "HLT"); desc.add("triggerResultLabel", edm::InputTag("TriggerResults", "", "HLT")); desc.add("muonLabel", edm::InputTag("muons")); - desc.add("minimumMuonP", 10.0); desc.add >("triggers", triggers); desc.add("muonPtCut", 20.0); desc.add("muonEtaCut", 1.305); diff --git a/Calibration/HcalAlCaRecoProducers/src/AlCaHOCalibProducer.cc b/Calibration/HcalAlCaRecoProducers/plugins/AlCaHOCalibProducer.cc similarity index 95% rename from Calibration/HcalAlCaRecoProducers/src/AlCaHOCalibProducer.cc rename to Calibration/HcalAlCaRecoProducers/plugins/AlCaHOCalibProducer.cc index 2f9bf7975ccc3..1e5290d2ad57c 100644 --- a/Calibration/HcalAlCaRecoProducers/src/AlCaHOCalibProducer.cc +++ b/Calibration/HcalAlCaRecoProducers/plugins/AlCaHOCalibProducer.cc @@ -77,55 +77,47 @@ Ring 0 L0 : Width Tray 6:266.6, 5&4:325.6, 3:330.6, 2:341.6, 1:272.6 // user include files #include "FWCore/Framework/interface/Frameworkfwd.h" #include "FWCore/Framework/interface/one/EDProducer.h" - #include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" - +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" #include "FWCore/Utilities/interface/InputTag.h" + +#include "DataFormats/CaloTowers/interface/CaloTowerCollection.h" +#include "DataFormats/HcalCalibObjects/interface/HOCalibVariables.h" +#include "DataFormats/HcalDetId/interface/HcalDetId.h" +#include "DataFormats/HcalDetId/interface/HcalSubdetector.h" +#include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h" +#include "DataFormats/GeometrySurface/interface/PlaneBuilder.h" +#include "DataFormats/Luminosity/interface/LumiDetails.h" +#include "DataFormats/Math/interface/Error.h" +#include "DataFormats/MuonReco/interface/Muon.h" +#include "DataFormats/RecoCandidate/interface/IsoDeposit.h" +#include "DataFormats/Scalers/interface/LumiScalers.h" #include "DataFormats/TrackReco/interface/Track.h" #include "DataFormats/TrackReco/interface/TrackFwd.h" +#include "DataFormats/TrajectorySeed/interface/PropagationDirection.h" +#include "DataFormats/TrajectorySeed/interface/TrajectorySeedCollection.h" +#include "DataFormats/VertexReco/interface/Vertex.h" +#include "DataFormats/VertexReco/interface/VertexFwd.h" -#include "Geometry/Records/interface/IdealGeometryRecord.h" #include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h" +#include "Geometry/CaloGeometry/interface/CaloCellGeometry.h" #include "Geometry/CaloGeometry/interface/CaloGeometry.h" #include "Geometry/Records/interface/CaloGeometryRecord.h" - -#include "Geometry/CaloGeometry/interface/CaloCellGeometry.h" -#include "DataFormats/HcalDetId/interface/HcalDetId.h" -#include "DataFormats/HcalDetId/interface/HcalSubdetector.h" - +#include "Geometry/Records/interface/IdealGeometryRecord.h" #include "Geometry/Records/interface/MuonGeometryRecord.h" -#include "DataFormats/TrajectorySeed/interface/PropagationDirection.h" -#include "DataFormats/GeometrySurface/interface/PlaneBuilder.h" - #include "MagneticField/Engine/interface/MagneticField.h" #include "MagneticField/Records/interface/IdealMagneticFieldRecord.h" -#include "DataFormats/MuonReco/interface/Muon.h" -#include "DataFormats/RecoCandidate/interface/IsoDeposit.h" - -#include "DataFormats/HcalCalibObjects/interface/HOCalibVariables.h" -#include "DataFormats/Math/interface/Error.h" -#include "CLHEP/Vector/LorentzVector.h" - -#include "DataFormats/TrajectorySeed/interface/TrajectorySeedCollection.h" -#include "DataFormats/CaloTowers/interface/CaloTowerCollection.h" - -#include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h" -#include "DataFormats/Math/interface/Error.h" #include "TrackingTools/TrajectoryState/interface/FreeTrajectoryState.h" #include "TrackPropagation/SteppingHelixPropagator/interface/SteppingHelixPropagator.h" #include "FWCore/ServiceRegistry/interface/Service.h" #include "CommonTools/UtilAlgos/interface/TFileService.h" -#include "DataFormats/Luminosity/interface/LumiDetails.h" -#include "DataFormats/VertexReco/interface/Vertex.h" -#include "DataFormats/VertexReco/interface/VertexFwd.h" -#include "DataFormats/Scalers/interface/LumiScalers.h" // Necessary includes for identify severity of flagged problems in HO rechits //#include "RecoLocalCalo/HcalRecAlgos/interface/HcalCaloFlagLabels.h" @@ -133,6 +125,7 @@ Ring 0 L0 : Width Tray 6:266.6, 5&4:325.6, 3:330.6, 2:341.6, 1:272.6 #include "RecoLocalCalo/HcalRecAlgos/interface/HcalSeverityLevelComputerRcd.h" #include "CondFormats/HcalObjects/interface/HcalChannelQuality.h" #include "CondFormats/DataRecord/interface/HcalChannelQualityRcd.h" +#include "CLHEP/Vector/LorentzVector.h" #include "CLHEP/Units/GlobalPhysicalConstants.h" #include "CLHEP/Units/GlobalSystemOfUnits.h" @@ -150,7 +143,9 @@ Ring 0 L0 : Width Tray 6:266.6, 5&4:325.6, 3:330.6, 2:341.6, 1:272.6 class AlCaHOCalibProducer : public edm::one::EDProducer { public: explicit AlCaHOCalibProducer(const edm::ParameterSet&); + ~AlCaHOCalibProducer() override = default; + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); typedef Basic3DVector PositionType; typedef Basic3DVector DirectionType; typedef Basic3DVector RotationType; @@ -290,6 +285,25 @@ AlCaHOCalibProducer::AlCaHOCalibProducer(const edm::ParameterSet& iConfig) { // member functions // +void AlCaHOCalibProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + desc.add("hbheInput", edm::InputTag("hbhereco")); + desc.addUntracked("hotime", false); + desc.addUntracked("hbinfo", false); + desc.addUntracked("sigma", 1.0); + desc.addUntracked("plotOccupancy", false); + desc.addUntracked("CosmicData", false); + desc.add("hoInput", edm::InputTag("horeco")); + desc.add("towerInput", edm::InputTag("towerMaker")); + desc.addUntracked("RootFileName", "test.root"); + desc.addUntracked("m_scale", 4.0); + desc.addUntracked("debug", false); + desc.addUntracked("muons", edm::InputTag("muons")); + desc.add("vertexTags", edm::InputTag("offlinePrimaryVertices")); + desc.add("lumiTags", edm::InputTag("scalersRawToDigi")); + descriptions.add("alcaHOCalibProducer", desc); +} + // ------------ method called to produce the data ------------ void AlCaHOCalibProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { int irun = iEvent.id().run(); @@ -314,23 +328,21 @@ void AlCaHOCalibProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSe tmpHOCalib.inslumi = -1.; if (m_cosmic) { - iEvent.getByToken(tok_muonsCosmic_, cosmicmuon); + cosmicmuon = iEvent.getHandle(tok_muonsCosmic_); muonOK = (cosmicmuon.isValid() && !cosmicmuon->empty()); } else { - iEvent.getByToken(tok_muons_, collisionmuon); + collisionmuon = iEvent.getHandle(tok_muons_); muonOK = (collisionmuon.isValid() && !collisionmuon->empty()); if (iEvent.isRealData()) { - edm::Handle primaryVertices; - iEvent.getByToken(tok_vertex_, primaryVertices); + auto const& primaryVertices = iEvent.getHandle(tok_vertex_); if (primaryVertices.isValid()) { tmpHOCalib.nprim = primaryVertices->size(); } tmpHOCalib.inslumi = 0.; - edm::Handle lumiScale; - iEvent.getByToken(tok_lumi_, lumiScale); + auto const& lumiScale = iEvent.getHandle(tok_lumi_); if (lumiScale.isValid()) { if (lumiScale->empty()) { @@ -496,8 +508,7 @@ void AlCaHOCalibProducer::fillHOStore(const reco::TrackRef& ncosm, } } else { // if (muonTags_.label() =="muons") { - edm::Handle calotower; - iEvent.getByToken(tok_tower_, calotower); + auto const& calotower = iEvent.getHandle(tok_tower_); for (CaloTowerCollection::const_iterator calt = calotower->begin(); calt != calotower->end(); calt++) { //CMSSW_2_1_x const math::XYZVector towermom = (*calt).momentum(); @@ -748,9 +759,7 @@ void AlCaHOCalibProducer::fillHOStore(const reco::TrackRef& ncosm, tmpHOCalib.hbhesig[ij] = -100.0; } - edm::Handle hbheht; // iEvent.getByType(hbheht); - iEvent.getByToken(tok_hbhe_, hbheht); - + auto const& hbheht = iEvent.getHandle(tok_hbhe_); // iEvent.getByType(hbheht); if (!(*hbheht).empty()) { if ((*hbheht).empty()) throw(int)(*hbheht).size(); @@ -806,8 +815,7 @@ void AlCaHOCalibProducer::fillHOStore(const reco::TrackRef& ncosm, } } //m_hbinfo #endif - edm::Handle hoht; - iEvent.getByToken(tok_ho_, hoht); + auto const& hoht = iEvent.getHandle(tok_ho_); if (!(*hoht).empty()) { for (HORecHitCollection::const_iterator jk = (*hoht).begin(); jk != (*hoht).end(); jk++) { diff --git a/Calibration/HcalAlCaRecoProducers/plugins/AlCaHcalHBHEMuonFilter.cc b/Calibration/HcalAlCaRecoProducers/plugins/AlCaHcalHBHEMuonFilter.cc new file mode 100644 index 0000000000000..c1e8c0bc8ab41 --- /dev/null +++ b/Calibration/HcalAlCaRecoProducers/plugins/AlCaHcalHBHEMuonFilter.cc @@ -0,0 +1,136 @@ +// system include files +#include +#include +#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/EventSetup.h" +#include "FWCore/Framework/interface/Run.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" + +#include "DataFormats/Common/interface/Handle.h" +#include "DataFormats/Common/interface/Ref.h" +#include "DataFormats/HcalCalibObjects/interface/HcalHBHEMuonVariables.h" + +//#define EDM_ML_DEBUG +// +// class declaration +// + +namespace alcaHcalHBHEMuon { + struct Counters { + Counters() : nAll_(0), nGood_(0), nFinal_(0) {} + mutable std::atomic nAll_, nGood_, nFinal_; + }; +} // namespace alcaHcalHBHEMuon + +class AlCaHcalHBHEMuonFilter : public edm::global::EDFilter > { +public: + AlCaHcalHBHEMuonFilter(edm::ParameterSet const&); + ~AlCaHcalHBHEMuonFilter() override = default; + + std::shared_ptr globalBeginRun(edm::Run const&, edm::EventSetup const&) const override; + + bool filter(edm::StreamID, edm::Event&, edm::EventSetup const&) const override; + void globalEndRun(edm::Run const& iRun, edm::EventSetup const&) const override; + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + +private: + // ----------member data --------------------------- + int prescale_; + double minimumMuonP_; + edm::InputTag labelHBHEMuonVar_; + edm::EDGetTokenT tokHBHEMuonVar_; +}; + +// +// constructors and destructor +// +AlCaHcalHBHEMuonFilter::AlCaHcalHBHEMuonFilter(edm::ParameterSet const& iConfig) + : prescale_(iConfig.getParameter("prescale")), + minimumMuonP_(iConfig.getParameter("minimumMuonP")), + labelHBHEMuonVar_(iConfig.getParameter("hbheMuonLabel")), + tokHBHEMuonVar_(consumes(labelHBHEMuonVar_)) { + edm::LogVerbatim("HBHEMuon") << "Parameters read from config file \n\t prescale_ " << prescale_ << "\t minimumMuonP_ " + << minimumMuonP_ << "\n\t Labels " << labelHBHEMuonVar_; +} // AlCaHcalHBHEMuonFilter::AlCaHcalHBHEMuonFilter constructor + +// +// member functions +// + +// ------------ method called on each new Event ------------ +bool AlCaHcalHBHEMuonFilter::filter(edm::StreamID, edm::Event& iEvent, edm::EventSetup const&) const { + bool accept(false); + ++(runCache(iEvent.getRun().index())->nAll_); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("HBHEMuon") << "AlCaHcalHBHEMuonFilter::Run " << iEvent.id().run() << " Event " + << iEvent.id().event() << " Luminosity " << iEvent.luminosityBlock() << " Bunch " + << iEvent.bunchCrossing(); +#endif + + auto const& hbheMuonColl = iEvent.getHandle(tokHBHEMuonVar_); + if (hbheMuonColl.isValid()) { + auto hbheMuon = hbheMuonColl.product(); + if (!hbheMuon->empty()) { + bool ok(false); + for (auto const& muon : *hbheMuon) + if (muon.pMuon_ >= minimumMuonP_) + ok = true; + if (ok) { + ++(runCache(iEvent.getRun().index())->nGood_); + if (prescale_ <= 1) + accept = true; + else if (runCache(iEvent.getRun().index())->nGood_ % prescale_ == 1) + accept = true; + } + } + } else { + edm::LogVerbatim("HBHEMuon") << "AlCaHcalHBHEMuonFilter::Cannot find the collection for HcalHBHEMuonVariables"; + } + + // Return the acceptance flag + if (accept) + ++(runCache(iEvent.getRun().index())->nFinal_); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("HBHEMuon") << "AlCaHcalHBHEMuonFilter::Accept flag " << accept << " All " + << runCache(iEvent.getRun().index())->nAll_ << " Good " + << runCache(iEvent.getRun().index())->nGood_ << " Final " + << runCache(iEvent.getRun().index())->nFinal_; +#endif + return accept; + +} // AlCaHcalHBHEMuonFilter::filter + +// ------------ method called when starting to processes a run ------------ +std::shared_ptr AlCaHcalHBHEMuonFilter::globalBeginRun(edm::Run const& iRun, + edm::EventSetup const&) const { + edm::LogVerbatim("HBHEMuon") << "Start the Run " << iRun.run(); + return std::make_shared(); +} + +// ------------ method called when ending the processing of a run ------------ +void AlCaHcalHBHEMuonFilter::globalEndRun(edm::Run const& iRun, edm::EventSetup const&) const { + edm::LogVerbatim("HBHEMuon") << "Select " << runCache(iRun.index())->nFinal_ << " out of " + << runCache(iRun.index())->nGood_ << " good and " << runCache(iRun.index())->nAll_ + << " total events"; +} + +// ------------ method fills 'descriptions' with the allowed parameters for the module ------------ +void AlCaHcalHBHEMuonFilter::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + desc.add("prescale", 1); + desc.add("minimumMuonP", 10.0); + desc.add("hbheMuonLabel", edm::InputTag("alcaHcalHBHEMuonProducer", "hbheMuon")); + descriptions.add("alcaHcalHBHEMuonFilter", desc); +} + +//define this as a plug-in +#include "FWCore/Framework/interface/MakerMacros.h" + +DEFINE_FWK_MODULE(AlCaHcalHBHEMuonFilter); diff --git a/Calibration/HcalAlCaRecoProducers/plugins/AlCaHcalHBHEMuonProducer.cc b/Calibration/HcalAlCaRecoProducers/plugins/AlCaHcalHBHEMuonProducer.cc new file mode 100644 index 0000000000000..f59f824887bf0 --- /dev/null +++ b/Calibration/HcalAlCaRecoProducers/plugins/AlCaHcalHBHEMuonProducer.cc @@ -0,0 +1,1131 @@ +#include +#include +#include +#include +#include +#include +#include "TPRegexp.h" + +// user include files +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/stream/EDProducer.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" +#include "FWCore/ServiceRegistry/interface/Service.h" +#include "FWCore/Common/interface/TriggerNames.h" + +#include "DataFormats/HcalCalibObjects/interface/HcalHBHEMuonVariables.h" +#include "DataFormats/HcalDetId/interface/HcalDetId.h" +#include "DataFormats/MuonReco/interface/Muon.h" +#include "DataFormats/MuonReco/interface/MuonFwd.h" +#include "DataFormats/MuonReco/interface/MuonSelectors.h" +#include "DataFormats/VertexReco/interface/Vertex.h" +#include "DataFormats/VertexReco/interface/VertexFwd.h" +#include "DataFormats/TrackReco/interface/Track.h" + +//////////////trigger info//////////////////////////////////// + +#include "DataFormats/Common/interface/TriggerResults.h" +#include "DataFormats/HLTReco/interface/TriggerObject.h" +#include "DataFormats/HLTReco/interface/TriggerEvent.h" +#include "DataFormats/EcalDetId/interface/EcalSubdetector.h" +#include "DataFormats/EcalDetId/interface/EBDetId.h" +#include "DataFormats/EcalDetId/interface/EEDetId.h" +#include "DataFormats/HcalDetId/interface/HcalDetId.h" +#include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" +#include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h" + +#include "HLTrigger/HLTcore/interface/HLTConfigProvider.h" +#include "HLTrigger/HLTcore/interface/HLTConfigData.h" + +#include "CondFormats/HcalObjects/interface/HcalRespCorrs.h" +#include "CondFormats/DataRecord/interface/HcalRespCorrsRcd.h" + +#include "CondFormats/DataRecord/interface/EcalChannelStatusRcd.h" +#include "RecoLocalCalo/EcalRecAlgos/interface/EcalSeverityLevelAlgo.h" +#include "RecoLocalCalo/EcalRecAlgos/interface/EcalSeverityLevelAlgoRcd.h" + +#include "CalibFormats/HcalObjects/interface/HcalCalibrations.h" +#include "CalibFormats/HcalObjects/interface/HcalDbService.h" +#include "CalibFormats/HcalObjects/interface/HcalDbRecord.h" + +#include "Calibration/IsolatedParticles/interface/CaloPropagateTrack.h" +#include "Calibration/IsolatedParticles/interface/eECALMatrix.h" +#include "Calibration/IsolatedParticles/interface/eHCALMatrix.h" + +#include "Geometry/CaloGeometry/interface/CaloGeometry.h" +#include "Geometry/Records/interface/CaloGeometryRecord.h" +#include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h" +#include "Geometry/Records/interface/CaloTopologyRecord.h" +#include "Geometry/CaloTopology/interface/CaloSubdetectorTopology.h" +#include "Geometry/CaloTopology/interface/HcalTopology.h" +#include "Geometry/CaloTopology/interface/CaloTopology.h" +#include "Geometry/HcalCommonData/interface/HcalDDDRecConstants.h" +#include "Geometry/HcalTowerAlgo/interface/HcalGeometry.h" +#include "MagneticField/Engine/interface/MagneticField.h" +#include "MagneticField/Records/interface/IdealMagneticFieldRecord.h" + +//#define EDM_ML_DEBUG + +namespace alcaHcalHBHEMuon { + struct Counters { + Counters() : nAll_(0), nGood_(0) {} + mutable std::atomic nAll_, nGood_; + }; +} // namespace alcaHcalHBHEMuon + +class AlCaHcalHBHEMuonProducer : public edm::stream::EDProducer> { +public: + explicit AlCaHcalHBHEMuonProducer(const edm::ParameterSet&, const alcaHcalHBHEMuon::Counters*); + ~AlCaHcalHBHEMuonProducer() override = default; + + static std::unique_ptr initializeGlobalCache(edm::ParameterSet const&) { + return std::make_unique(); + } + + void produce(edm::Event&, const edm::EventSetup&) override; + + void endStream() override; + + static void globalEndJob(const alcaHcalHBHEMuon::Counters* counters); + + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + +private: + void beginRun(edm::Run const&, edm::EventSetup const&) override; + void endRun(edm::Run const&, edm::EventSetup const&) override; + int matchId(const HcalDetId&, const HcalDetId&); + double activeLength(const DetId&); + bool isGoodVertex(const reco::Vertex& vtx); + double respCorr(const DetId& id); + double gainFactor(const HcalDbService* dbserv, const HcalDetId& id); + int depth16HE(int ieta, int iphi); + bool goodCell(const HcalDetId& hcid, const reco::Track* pTrack, const CaloGeometry* geo, const MagneticField* bField); + + // ----------member data --------------------------- + HLTConfigProvider hltConfig_; + const std::vector trigNames_; + const std::string processName_; + const edm::InputTag triggerResults_; + const edm::InputTag labelEBRecHit_, labelEERecHit_, labelHBHERecHit_; + const std::string labelVtx_, labelMuon_, labelHBHEMuon_; + const bool collapseDepth_, isItPlan1_; + const int verbosity_; + const bool isItPreRecHit_, writeRespCorr_; + const std::string fileInCorr_; + bool mergedDepth_, useMyCorr_; + int nRun_, nAll_, nGood_, maxDepth_; + + const HcalDDDRecConstants* hdc_; + const HcalTopology* theHBHETopology_; + const CaloGeometry* geo_; + const HcalRespCorrs* respCorrs_; + + edm::EDGetTokenT tok_trigRes_; + edm::EDGetTokenT tok_Vtx_; + edm::EDGetTokenT tok_EB_; + edm::EDGetTokenT tok_EE_; + edm::EDGetTokenT tok_HBHE_; + edm::EDGetTokenT tok_Muon_; + + edm::ESGetToken tok_ddrec_; + edm::ESGetToken tok_htopo_; + edm::ESGetToken tok_respcorr_; + edm::ESGetToken tok_geom_; + edm::ESGetToken tok_magField_; + edm::ESGetToken tok_chan_; + edm::ESGetToken tok_sevlv_; + edm::ESGetToken tok_topo_; + edm::ESGetToken tok_dbservice_; + + ////////////////////////////////////////////////////// + static const int depthMax_ = 7; + std::vector all_triggers_; + std::vector hltresults_; + + std::vector actHB, actHE; + std::map corrValue_; + //////////////////////////////////////////////////////////// +}; + +AlCaHcalHBHEMuonProducer::AlCaHcalHBHEMuonProducer(const edm::ParameterSet& iConfig, const alcaHcalHBHEMuon::Counters*) + : trigNames_(iConfig.getParameter>("triggers")), + processName_(iConfig.getParameter("processName")), + triggerResults_(iConfig.getParameter("triggerResults")), + labelEBRecHit_(iConfig.getParameter("labelEBRecHit")), + labelEERecHit_(iConfig.getParameter("labelEERecHit")), + labelHBHERecHit_(iConfig.getParameter("labelHBHERecHit")), + labelVtx_(iConfig.getParameter("labelVertex")), + labelMuon_(iConfig.getParameter("labelMuon")), + labelHBHEMuon_(iConfig.getParameter("labelHBHEMuon")), + collapseDepth_(iConfig.getParameter("collapseDepth")), + isItPlan1_(iConfig.getParameter("isItPlan1")), + verbosity_(iConfig.getUntrackedParameter("verbosity", 0)), + isItPreRecHit_(iConfig.getUntrackedParameter("isItPreRecHit", false)), + writeRespCorr_(iConfig.getUntrackedParameter("writeRespCorr", false)), + fileInCorr_(iConfig.getUntrackedParameter("fileInCorr", "")), + nRun_(0), + nAll_(0), + nGood_(0), + hdc_(nullptr), + theHBHETopology_(nullptr), + respCorrs_(nullptr) { + //now do what ever initialization is needed + maxDepth_ = iConfig.getUntrackedParameter("maxDepth", 4); + if (maxDepth_ > depthMax_) + maxDepth_ = depthMax_; + else if (maxDepth_ < 1) + maxDepth_ = 4; + + mergedDepth_ = (!isItPreRecHit_) || (collapseDepth_); + tok_trigRes_ = consumes(triggerResults_); + tok_EB_ = consumes(labelEBRecHit_); + tok_EE_ = consumes(labelEERecHit_); + tok_HBHE_ = consumes(labelHBHERecHit_); + tok_Vtx_ = consumes(labelVtx_); + tok_Muon_ = consumes(labelMuon_); + edm::LogVerbatim("HBHEMuon") << "Labels used: Trig " << triggerResults_ << " Vtx " << labelVtx_ << " EB " + << labelEBRecHit_ << " EE " << labelEERecHit_ << " HBHE " << labelHBHERecHit_ << " MU " + << labelMuon_; + + tok_ddrec_ = esConsumes(); + tok_htopo_ = esConsumes(); + tok_respcorr_ = esConsumes(); + tok_geom_ = esConsumes(); + tok_magField_ = esConsumes(); + tok_chan_ = esConsumes(); + tok_sevlv_ = esConsumes(); + tok_topo_ = esConsumes(); + tok_dbservice_ = esConsumes(); + + if (!fileInCorr_.empty()) { + std::ifstream infile(fileInCorr_.c_str()); + if (infile.is_open()) { + while (true) { + unsigned int id; + double cfac; + infile >> id >> cfac; + if (!infile.good()) + break; + corrValue_[DetId(id)] = cfac; + } + infile.close(); + } + } + useMyCorr_ = (!corrValue_.empty()); + edm::LogVerbatim("HBHEMuon") << "Flags used: ollapseDepth " << collapseDepth_ << ":" << mergedDepth_ << " IsItPlan1 " + << isItPlan1_ << " IsItPreRecHit " << isItPreRecHit_ << " UseMyCorr " << useMyCorr_; + + //create the objects for HcalHBHEMuonVariables which has information of isolated muons + produces(labelHBHEMuon_); + edm::LogVerbatim("HcalIsoTrack") << " Expected to produce the collections:\n" + << "HcalHBHEMuonVariablesCollection with label " << labelHBHEMuon_; +} + +// +// member functions +// + +// ------------ method called for each event ------------ +void AlCaHcalHBHEMuonProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { + ++nAll_; + auto outputHcalHBHEMuonColl = std::make_unique(); + + unsigned int runNumber = iEvent.id().run(); + unsigned int eventNumber = iEvent.id().event(); + unsigned int lumiNumber = iEvent.id().luminosityBlock(); + unsigned int bxNumber = iEvent.bunchCrossing(); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("HBHEMuon") << "Run " << runNumber << " Event " << eventNumber << " Lumi " << lumiNumber << " BX " + << bxNumber << std::endl; +#endif + + //Step1: Find if the event passes one of the chosen triggers + bool ok(false); + /////////////////////////////TriggerResults + if (trigNames_.empty()) { + ok = true; + } else { + auto const& triggerResults = iEvent.getHandle(tok_trigRes_); + if (triggerResults.isValid()) { + std::vector modules; + const edm::TriggerNames& triggerNames = iEvent.triggerNames(*triggerResults); + const std::vector& triggerNames_ = triggerNames.triggerNames(); + for (unsigned int iHLT = 0; iHLT < triggerResults->size(); iHLT++) { + int hlt = triggerResults->accept(iHLT); + for (unsigned int i = 0; i < trigNames_.size(); ++i) { + if (triggerNames_[iHLT].find(trigNames_[i]) != std::string::npos) { + if (hlt > 0) { + ok = true; + } +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("HBHEMuon") << "AlCaHcalHBHEMuonFilter::Trigger " << triggerNames_[iHLT] << " Flag " << hlt + << ":" << ok << std::endl; +#endif + } + } + } + } + } + + // get handles to calogeometry and calotopology + const MagneticField* bField = &iSetup.getData(tok_magField_); + const EcalChannelStatus* theEcalChStatus = &iSetup.getData(tok_chan_); + const EcalSeverityLevelAlgo* sevlv = &iSetup.getData(tok_sevlv_); + const CaloTopology* caloTopology = &iSetup.getData(tok_topo_); + const HcalDbService* conditions = &iSetup.getData(tok_dbservice_); + + // Relevant blocks from iEvent + auto const& vtx = iEvent.getHandle(tok_Vtx_); + auto barrelRecHitsHandle = iEvent.getHandle(tok_EB_); + auto endcapRecHitsHandle = iEvent.getHandle(tok_EE_); + auto hbhe = iEvent.getHandle(tok_HBHE_); + auto const& muons = iEvent.getHandle(tok_Muon_); + + // require a good vertex + math::XYZPoint pvx; + unsigned int goodVertex = 0; + reco::VertexCollection::const_iterator firstGoodVertex; + if (!vtx.isValid()) { +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("HBHEMuon") << "No Good Vertex found == Reject"; +#endif + } else { + firstGoodVertex = vtx->end(); + for (reco::VertexCollection::const_iterator it = vtx->begin(); it != vtx->end(); it++) { + if (isGoodVertex(*it)) { + if (firstGoodVertex == vtx->end()) + firstGoodVertex = it; + ++goodVertex; + } + } + if (firstGoodVertex != vtx->end()) + pvx = firstGoodVertex->position(); + } + + if (ok && (goodVertex > 0) && muons.isValid() && barrelRecHitsHandle.isValid() && endcapRecHitsHandle.isValid() && + hbhe.isValid()) { + for (reco::MuonCollection::const_iterator recMuon = muons->begin(); recMuon != muons->end(); ++recMuon) { + HcalHBHEMuonVariables hbheMuon; + hbheMuon.runNumber_ = runNumber; + hbheMuon.eventNumber_ = eventNumber; + hbheMuon.lumiNumber_ = lumiNumber; + hbheMuon.bxNumber_ = bxNumber; + hbheMuon.goodVertex_ = goodVertex; + hbheMuon.muonGood_ = (recMuon->isPFMuon()); + hbheMuon.muonGlobal_ = (recMuon->isGlobalMuon()); + hbheMuon.muonTracker_ = (recMuon->isTrackerMuon()); + hbheMuon.ptGlob_ = ((recMuon)->pt()); + hbheMuon.etaGlob_ = (recMuon->eta()); + hbheMuon.phiGlob_ = (recMuon->phi()); + hbheMuon.energyMuon_ = (recMuon->energy()); + hbheMuon.pMuon_ = (recMuon->p()); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("HBHEMuon") << "Energy:" << recMuon->energy() << " P:" << recMuon->p(); +#endif + hbheMuon.muonTight_ = (muon::isTightMuon(*recMuon, *firstGoodVertex)); + hbheMuon.muonMedium_ = (muon::isMediumMuon(*recMuon)); + hbheMuon.muonTrkKink_ = (recMuon->combinedQuality().trkKink); + hbheMuon.muonChi2LocalPosition_ = (recMuon->combinedQuality().chi2LocalPosition); + hbheMuon.muonSegComp_ = (muon::segmentCompatibility(*recMuon)); + // acessing tracker hits info + if (recMuon->track().isNonnull()) { + hbheMuon.trackerLayer_ = (recMuon->track()->hitPattern().trackerLayersWithMeasurement()); + } else { + hbheMuon.trackerLayer_ = -1; + } + if (recMuon->innerTrack().isNonnull()) { + hbheMuon.innerTrack_ = true; + hbheMuon.numPixelLayers_ = (recMuon->innerTrack()->hitPattern().pixelLayersWithMeasurement()); + hbheMuon.chiTracker_ = (recMuon->innerTrack()->normalizedChi2()); + hbheMuon.dxyTracker_ = (fabs(recMuon->innerTrack()->dxy(pvx))); + hbheMuon.dzTracker_ = (fabs(recMuon->innerTrack()->dz(pvx))); + hbheMuon.innerTrackPt_ = (recMuon->innerTrack()->pt()); + hbheMuon.innerTrackEta_ = (recMuon->innerTrack()->eta()); + hbheMuon.innerTrackPhi_ = (recMuon->innerTrack()->phi()); + hbheMuon.tightPixelHits_ = (recMuon->innerTrack()->hitPattern().numberOfValidPixelHits()); + hbheMuon.tightValidFraction_ = (recMuon->innerTrack()->validFraction()); + } + // outer track info + if (recMuon->outerTrack().isNonnull()) { + hbheMuon.outerTrack_ = true; + hbheMuon.outerTrackPt_ = (recMuon->outerTrack()->pt()); + hbheMuon.outerTrackEta_ = (recMuon->outerTrack()->eta()); + hbheMuon.outerTrackPhi_ = (recMuon->outerTrack()->phi()); + hbheMuon.outerTrackChi_ = (recMuon->outerTrack()->normalizedChi2()); + hbheMuon.outerTrackHits_ = (recMuon->outerTrack()->numberOfValidHits()); + hbheMuon.outerTrackRHits_ = (recMuon->outerTrack()->recHitsSize()); + } + // Tight Muon cuts + if (recMuon->globalTrack().isNonnull()) { + hbheMuon.globalTrack_ = true; + hbheMuon.chiGlobal_ = (recMuon->globalTrack()->normalizedChi2()); + hbheMuon.globalMuonHits_ = (recMuon->globalTrack()->hitPattern().numberOfValidMuonHits()); + hbheMuon.matchedStat_ = (recMuon->numberOfMatchedStations()); + hbheMuon.globalTrackPt_ = (recMuon->globalTrack()->pt()); + hbheMuon.globalTrackEta_ = (recMuon->globalTrack()->eta()); + hbheMuon.globalTrackPhi_ = (recMuon->globalTrack()->phi()); + hbheMuon.tightTransImpara_ = (fabs(recMuon->muonBestTrack()->dxy(pvx))); + hbheMuon.tightLongPara_ = (fabs(recMuon->muonBestTrack()->dz(pvx))); + } + + hbheMuon.isolationR04_ = + ((recMuon->pfIsolationR04().sumChargedHadronPt + + std::max(0., + recMuon->pfIsolationR04().sumNeutralHadronEt + recMuon->pfIsolationR04().sumPhotonEt - + (0.5 * recMuon->pfIsolationR04().sumPUPt))) / + recMuon->pt()); + + hbheMuon.isolationR03_ = + ((recMuon->pfIsolationR03().sumChargedHadronPt + + std::max(0., + recMuon->pfIsolationR03().sumNeutralHadronEt + recMuon->pfIsolationR03().sumPhotonEt - + (0.5 * recMuon->pfIsolationR03().sumPUPt))) / + recMuon->pt()); + + hbheMuon.ecalEnergy_ = (recMuon->calEnergy().emS9); + hbheMuon.hcalEnergy_ = (recMuon->calEnergy().hadS9); + hbheMuon.hoEnergy_ = (recMuon->calEnergy().hoS9); + + if (recMuon->innerTrack().isNonnull()) { + const reco::Track* pTrack = (recMuon->innerTrack()).get(); + spr::propagatedTrackID trackID = spr::propagateCALO(pTrack, geo_, bField, (((verbosity_ / 100) % 10 > 0))); + + double activeLengthTot(0), activeLengthHotTot(0); + double eHcalDepth[depthMax_], eHcalDepthHot[depthMax_]; + double eHcalDepthC[depthMax_], eHcalDepthHotC[depthMax_]; + double cHcalDepthHot[depthMax_], cHcalDepthHotBG[depthMax_]; + double eHcalDepthRaw[depthMax_], eHcalDepthHotRaw[depthMax_]; + double eHcalDepthCRaw[depthMax_], eHcalDepthHotCRaw[depthMax_]; + double cHcalDepthHotRaw[depthMax_], cHcalDepthHotBGRaw[depthMax_]; + double eHcalDepthAux[depthMax_], eHcalDepthHotAux[depthMax_]; + double eHcalDepthCAux[depthMax_], eHcalDepthHotCAux[depthMax_]; + double cHcalDepthHotAux[depthMax_], cHcalDepthHotBGAux[depthMax_]; + double activeL[depthMax_], activeHotL[depthMax_]; + bool matchDepth[depthMax_], matchDepthHot[depthMax_]; + HcalDetId eHcalDetId[depthMax_]; + unsigned int isHot(0); + int ieta(-1000), iphi(-1000); + for (int i = 0; i < depthMax_; ++i) { + eHcalDepth[i] = eHcalDepthHot[i] = 0; + eHcalDepthC[i] = eHcalDepthHotC[i] = 0; + cHcalDepthHot[i] = cHcalDepthHotBG[i] = 0; + eHcalDepthRaw[i] = eHcalDepthHotRaw[i] = 0; + eHcalDepthCRaw[i] = eHcalDepthHotCRaw[i] = 0; + cHcalDepthHotRaw[i] = cHcalDepthHotBGRaw[i] = 0; + eHcalDepthAux[i] = eHcalDepthHotAux[i] = 0; + eHcalDepthCAux[i] = eHcalDepthHotCAux[i] = 0; + cHcalDepthHotAux[i] = cHcalDepthHotBGAux[i] = 0; + activeL[i] = activeHotL[i] = 0; + matchDepth[i] = matchDepthHot[i] = true; + } +#ifdef EDM_ML_DEBUG + double eHcal(0); +#endif + + hbheMuon.ecalDetId_ = ((trackID.detIdECAL)()); + hbheMuon.hcalDetId_ = ((trackID.detIdHCAL)()); + hbheMuon.ehcalDetId_ = ((trackID.detIdEHCAL)()); + + HcalDetId check(false); + std::pair info = spr::propagateHCALBack(pTrack, geo_, bField, (((verbosity_ / 100) % 10 > 0))); + if (info.first) { + check = info.second; + } + + bool okE = trackID.okECAL; + if (okE) { + const DetId isoCell(trackID.detIdECAL); + std::pair e3x3 = spr::eECALmatrix(isoCell, + barrelRecHitsHandle, + endcapRecHitsHandle, + *theEcalChStatus, + geo_, + caloTopology, + sevlv, + 1, + 1, + -100.0, + -100.0, + -500.0, + 500.0, + false); + hbheMuon.ecal3x3Energy_ = e3x3.first; + okE = e3x3.second; + } +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("HBHEMuon") << "Propagate Track to ECAL: " << okE << ":" << trackID.okECAL << " E " + << hbheMuon.ecal3x3Energy_; +#endif + + if (trackID.okHCAL) { + DetId closestCell(trackID.detIdHCAL); + HcalDetId hcidt(closestCell.rawId()); + if ((hcidt.ieta() == check.ieta()) && (hcidt.iphi() == check.iphi())) + hbheMuon.matchedId_ = true; +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("HBHEMuon") << "Front " << hcidt << " Back " << info.first << ":" << check << " Match " + << hbheMuon.matchedId_; +#endif + HcalSubdetector subdet = hcidt.subdet(); + ieta = hcidt.ieta(); + iphi = hcidt.iphi(); + bool hborhe = (std::abs(ieta) == 16); + + hbheMuon.hcal1x1Energy_ = spr::eHCALmatrix( + theHBHETopology_, closestCell, hbhe, 0, 0, false, true, -100.0, -100.0, -100.0, -100.0, -500., 500., 0); + hbheMuon.hcal1x1EnergyAux_ = spr::eHCALmatrix( + theHBHETopology_, closestCell, hbhe, 0, 0, false, true, -100.0, -100.0, -100.0, -100.0, -500., 500., 1); + hbheMuon.hcal1x1EnergyRaw_ = spr::eHCALmatrix( + theHBHETopology_, closestCell, hbhe, 0, 0, false, true, -100.0, -100.0, -100.0, -100.0, -500., 500., 2); + std::vector> ehdepth, ehdepthAux, ehdepthRaw; + spr::energyHCALCell((HcalDetId)closestCell, + hbhe, + ehdepth, + maxDepth_, + -100.0, + -100.0, + -100.0, + -100.0, + -500.0, + 500.0, + 0, + depth16HE(ieta, iphi), + (((verbosity_ / 1000) % 10) > 0)); + for (int i = 0; i < depthMax_; ++i) + eHcalDetId[i] = HcalDetId(); + spr::energyHCALCell((HcalDetId)closestCell, + hbhe, + ehdepthAux, + maxDepth_, + -100.0, + -100.0, + -100.0, + -100.0, + -500.0, + 500.0, + 1, + depth16HE(ieta, iphi), + (((verbosity_ / 1000) % 10) > 0)); + spr::energyHCALCell((HcalDetId)closestCell, + hbhe, + ehdepthRaw, + maxDepth_, + -100.0, + -100.0, + -100.0, + -100.0, + -500.0, + 500.0, + 2, + depth16HE(ieta, iphi), + (((verbosity_ / 1000) % 10) > 0)); + for (unsigned int i = 0; i < ehdepth.size(); ++i) { + HcalSubdetector subdet0 = + (hborhe) ? ((ehdepth[i].second >= depth16HE(ieta, iphi)) ? HcalEndcap : HcalBarrel) : subdet; + HcalDetId hcid0(subdet0, ieta, iphi, ehdepth[i].second); + double actL = activeLength(DetId(hcid0)); + double ene = ehdepth[i].first; + double eneAux = ehdepthAux[i].first; + double eneRaw = ehdepthRaw[i].first; + bool tmpC(false); + if (ene > 0.0) { + if (!(theHBHETopology_->validHcal(hcid0))) { + edm::LogWarning("HBHEMuon") << "(1) Invalid ID " << hcid0 << " with E = " << ene; + edm::LogWarning("HBHEMuon") << HcalDetId(closestCell) << " with " << ehdepth.size() << " depths:"; + for (const auto& ehd : ehdepth) + edm::LogWarning("HBHEMuon") << " " << ehd.second << ":" << ehd.first; + } else { + tmpC = goodCell(hcid0, pTrack, geo_, bField); + double enec(ene); + double corr = respCorr(DetId(hcid0)); + if (corr != 0) + ene /= corr; +#ifdef EDM_ML_DEBUG + HcalDetId id = (isItPlan1_ && isItPreRecHit_) ? hdc_->mergedDepthDetId(hcid0) : hcid0; + edm::LogVerbatim("HBHEMuon") << hcid0 << ":" << id << " Corr " << corr; +#endif + int depth = ehdepth[i].second - 1; + if (collapseDepth_) { + HcalDetId id = hdc_->mergedDepthDetId(hcid0); + depth = id.depth() - 1; + } + eHcalDepth[depth] += ene; + eHcalDepthC[depth] += enec; + activeL[depth] += actL; + activeLengthTot += actL; + matchDepth[depth] = (matchDepth[depth] && tmpC); +#ifdef EDM_ML_DEBUG + if ((verbosity_ % 10) > 0) + edm::LogVerbatim("HBHEMuon") + << hcid0 << " E " << ene << ":" << enec << " L " << actL << " Match " << tmpC; +#endif + } + } + if (eneAux > 0.0) { + if (theHBHETopology_->validHcal(hcid0)) { + double enecAux(eneAux); + double corr = respCorr(DetId(hcid0)); + if (corr != 0) + eneAux /= corr; + int depth = ehdepthAux[i].second - 1; + if (collapseDepth_) { + HcalDetId id = hdc_->mergedDepthDetId(hcid0); + depth = id.depth() - 1; + } + eHcalDepthAux[depth] += eneAux; + eHcalDepthCAux[depth] += enecAux; +#ifdef EDM_ML_DEBUG + if ((verbosity_ % 10) > 0) + edm::LogVerbatim("HBHEMuon") + << hcid0 << " E " << eneAux << ":" << enecAux << " L " << actL << " Match " << tmpC; +#endif + } + } + if (eneRaw > 0.0) { + if (theHBHETopology_->validHcal(hcid0)) { + double enecRaw(eneRaw); + double corr = respCorr(DetId(hcid0)); + if (corr != 0) + eneRaw /= corr; + int depth = ehdepthRaw[i].second - 1; + if (collapseDepth_) { + HcalDetId id = hdc_->mergedDepthDetId(hcid0); + depth = id.depth() - 1; + } + eHcalDepthRaw[depth] += eneRaw; + eHcalDepthCRaw[depth] += enecRaw; +#ifdef EDM_ML_DEBUG + if ((verbosity_ % 10) > 0) + edm::LogVerbatim("HBHEMuon") + << hcid0 << " E " << eneRaw << ":" << enecRaw << " L " << actL << " Match " << tmpC; +#endif + } + } + } +#ifdef EDM_ML_DEBUG + if ((verbosity_ % 10) > 0) { + edm::LogVerbatim("HBHEMuon") << hcidt << " Match " << hbheMuon.matchedId_ << " Depths " << ehdepth.size(); + for (unsigned int k = 0; k < ehdepth.size(); ++k) + edm::LogVerbatim("HBHEMuon") << " [" << k << ":" << ehdepth[k].second << "] " << matchDepth[k]; + } +#endif + HcalDetId hotCell; + spr::eHCALmatrix(geo_, theHBHETopology_, closestCell, hbhe, 1, 1, hotCell, false, 0, false); + isHot = matchId(closestCell, hotCell); + if (hotCell != HcalDetId()) { + subdet = HcalDetId(hotCell).subdet(); + ieta = HcalDetId(hotCell).ieta(); + iphi = HcalDetId(hotCell).iphi(); + hborhe = (std::abs(ieta) == 16); + std::vector> ehdepth, ehdepthAux, ehdepthRaw; + spr::energyHCALCell(hotCell, + hbhe, + ehdepth, + maxDepth_, + -100.0, + -100.0, + -100.0, + -100.0, + -500.0, + 500.0, + 0, + depth16HE(ieta, iphi), + false); + spr::energyHCALCell(hotCell, + hbhe, + ehdepthAux, + maxDepth_, + -100.0, + -100.0, + -100.0, + -100.0, + -500.0, + 500.0, + 1, + depth16HE(ieta, iphi), + false); + spr::energyHCALCell(hotCell, + hbhe, + ehdepthRaw, + maxDepth_, + -100.0, + -100.0, + -100.0, + -100.0, + -500.0, + 500.0, + 2, + depth16HE(ieta, iphi), + false); + for (int i = 0; i < depthMax_; ++i) + eHcalDetId[i] = HcalDetId(); + for (unsigned int i = 0; i < ehdepth.size(); ++i) { + HcalSubdetector subdet0 = + (hborhe) ? ((ehdepth[i].second >= depth16HE(ieta, iphi)) ? HcalEndcap : HcalBarrel) : subdet; + HcalDetId hcid0(subdet0, ieta, iphi, ehdepth[i].second); + double actL = activeLength(DetId(hcid0)); + double ene = ehdepth[i].first; + bool tmpC(false); + if (ene > 0.0) { + if (!(theHBHETopology_->validHcal(hcid0))) { + edm::LogWarning("HBHEMuon") << "(2) Invalid ID " << hcid0 << " with E = " << ene; + edm::LogWarning("HBHEMuon") << HcalDetId(hotCell) << " with " << ehdepth.size() << " depths:"; + for (const auto& ehd : ehdepth) + edm::LogWarning("HBHEMuon") << " " << ehd.second << ":" << ehd.first; + } else { + tmpC = goodCell(hcid0, pTrack, geo_, bField); + double chg(ene), enec(ene); + double corr = respCorr(DetId(hcid0)); + if (corr != 0) + ene /= corr; +#ifdef EDM_ML_DEBUG + HcalDetId id = (isItPlan1_ && isItPreRecHit_) ? hdc_->mergedDepthDetId(hcid0) : hcid0; + edm::LogVerbatim("HBHEMuon") << hcid0 << ":" << id << " Corr " << corr << " E " << ene << ":" << enec; +#endif + double gain = gainFactor(conditions, hcid0); + if (gain != 0) + chg /= gain; +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("HBHEMuon") << hcid0 << " Gain " << gain << " C " << chg; +#endif + int depth = ehdepth[i].second - 1; + if (collapseDepth_) { + HcalDetId id = hdc_->mergedDepthDetId(hcid0); + depth = id.depth() - 1; + } + eHcalDepthHot[depth] += ene; + eHcalDepthHotC[depth] += enec; + cHcalDepthHot[depth] += chg; + activeHotL[depth] += actL; + activeLengthHotTot += actL; + matchDepthHot[depth] = (matchDepthHot[depth] && tmpC); +#ifdef EDM_ML_DEBUG + eHcal += ene; + if ((verbosity_ % 10) > 0) + edm::LogVerbatim("HBHEMuon") << hcid0 << " depth " << depth << " E " << ene << ":" << enec << " C " + << chg << " L " << actL << " Match " << tmpC; +#endif + } + } + double eneAux = ehdepthAux[i].first; + if (eneAux > 0.0) { + if (theHBHETopology_->validHcal(hcid0)) { + double chgAux(eneAux), enecAux(eneAux); + double corr = respCorr(DetId(hcid0)); + if (corr != 0) + eneAux /= corr; + double gain = gainFactor(conditions, hcid0); + if (gain != 0) + chgAux /= gain; + int depth = ehdepthAux[i].second - 1; + if (collapseDepth_) { + HcalDetId id = hdc_->mergedDepthDetId(hcid0); + depth = id.depth() - 1; + } + eHcalDepthHotAux[depth] += eneAux; + eHcalDepthHotCAux[depth] += enecAux; + cHcalDepthHotAux[depth] += chgAux; +#ifdef EDM_ML_DEBUG + if ((verbosity_ % 10) > 0) + edm::LogVerbatim("HBHEMuon") << hcid0 << " depth " << depth << " E " << eneAux << ":" << enecAux + << " C " << chgAux << " L " << actL << " Match " << tmpC; +#endif + } + } + double eneRaw = ehdepthRaw[i].first; + if (eneRaw > 0.0) { + if (theHBHETopology_->validHcal(hcid0)) { + double chgRaw(eneRaw), enecRaw(eneRaw); + double corr = respCorr(DetId(hcid0)); + if (corr != 0) + eneRaw /= corr; + double gain = gainFactor(conditions, hcid0); + if (gain != 0) + chgRaw /= gain; + int depth = ehdepthRaw[i].second - 1; + if (collapseDepth_) { + HcalDetId id = hdc_->mergedDepthDetId(hcid0); + depth = id.depth() - 1; + } + eHcalDepthHotRaw[depth] += eneRaw; + eHcalDepthHotCRaw[depth] += enecRaw; + cHcalDepthHotRaw[depth] += chgRaw; +#ifdef EDM_ML_DEBUG + if ((verbosity_ % 10) > 0) + edm::LogVerbatim("HBHEMuon") << hcid0 << " depth " << depth << " E " << eneRaw << ":" << enecRaw + << " C " << chgRaw << " L " << actL << " Match " << tmpC; +#endif + } + } + } + + HcalDetId oppCell(subdet, -ieta, iphi, HcalDetId(hotCell).depth()); + std::vector> ehdeptho, ehdepthoAux, ehdepthoRaw; + spr::energyHCALCell(oppCell, + hbhe, + ehdeptho, + maxDepth_, + -100.0, + -100.0, + -100.0, + -100.0, + -500.0, + 500.0, + 0, + depth16HE(-ieta, iphi), + false); + spr::energyHCALCell(oppCell, + hbhe, + ehdepthoAux, + maxDepth_, + -100.0, + -100.0, + -100.0, + -100.0, + -500.0, + 500.0, + 1, + depth16HE(-ieta, iphi), + false); + spr::energyHCALCell(oppCell, + hbhe, + ehdepthoRaw, + maxDepth_, + -100.0, + -100.0, + -100.0, + -100.0, + -500.0, + 500.0, + 2, + depth16HE(-ieta, iphi), + false); + for (unsigned int i = 0; i < ehdeptho.size(); ++i) { + HcalSubdetector subdet0 = + (hborhe) ? ((ehdeptho[i].second >= depth16HE(-ieta, iphi)) ? HcalEndcap : HcalBarrel) : subdet; + HcalDetId hcid0(subdet0, -ieta, iphi, ehdeptho[i].second); + double ene = ehdeptho[i].first; + if (ene > 0.0) { + if (!(theHBHETopology_->validHcal(hcid0))) { + edm::LogWarning("HBHEMuon") << "(3) Invalid ID " << hcid0 << " with E = " << ene; + edm::LogWarning("HBHEMuon") << oppCell << " with " << ehdeptho.size() << " depths:"; + for (const auto& ehd : ehdeptho) + edm::LogWarning("HBHEMuon") << " " << ehd.second << ":" << ehd.first; + } else { + double chg(ene); + double corr = respCorr(DetId(hcid0)); + if (corr != 0) + ene /= corr; +#ifdef EDM_ML_DEBUG + HcalDetId id = (isItPlan1_ && isItPreRecHit_) ? hdc_->mergedDepthDetId(hcid0) : hcid0; + edm::LogVerbatim("HBHEMuon") + << hcid0 << ":" << id << " Corr " << corr << " E " << ene << ":" << ehdeptho[i].first; +#endif + double gain = gainFactor(conditions, hcid0); + if (gain != 0) + chg /= gain; +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("HBHEMuon") << hcid0 << " Gain " << gain << " C " << chg; +#endif + int depth = ehdeptho[i].second - 1; + if (collapseDepth_) { + HcalDetId id = hdc_->mergedDepthDetId(hcid0); + depth = id.depth() - 1; + } + cHcalDepthHotBG[depth] += chg; +#ifdef EDM_ML_DEBUG + if ((verbosity_ % 10) > 0) + edm::LogVerbatim("HBHEMuon") << hcid0 << " Depth " << depth << " E " << ene << " C " << chg; +#endif + } + } + double eneAux = ehdepthoAux[i].first; + if (eneAux > 0.0) { + if (theHBHETopology_->validHcal(hcid0)) { + double chgAux(eneAux); + double corr = respCorr(DetId(hcid0)); + if (corr != 0) + eneAux /= corr; + double gain = gainFactor(conditions, hcid0); + if (gain != 0) + chgAux /= gain; + int depth = ehdepthoAux[i].second - 1; + if (collapseDepth_) { + HcalDetId id = hdc_->mergedDepthDetId(hcid0); + depth = id.depth() - 1; + } + cHcalDepthHotBGAux[depth] += chgAux; +#ifdef EDM_ML_DEBUG + if ((verbosity_ % 10) > 0) + edm::LogVerbatim("HBHEMuon") << hcid0 << " Depth " << depth << " E " << eneAux << " C " << chgAux; +#endif + } + } + double eneRaw = ehdepthoRaw[i].first; + if (eneRaw > 0.0) { + if (theHBHETopology_->validHcal(hcid0)) { + double chgRaw(eneRaw); + double corr = respCorr(DetId(hcid0)); + if (corr != 0) + eneRaw /= corr; + double gain = gainFactor(conditions, hcid0); + if (gain != 0) + chgRaw /= gain; + int depth = ehdepthoRaw[i].second - 1; + if (collapseDepth_) { + HcalDetId id = hdc_->mergedDepthDetId(hcid0); + depth = id.depth() - 1; + } + cHcalDepthHotBGRaw[depth] += chgRaw; +#ifdef EDM_ML_DEBUG + if ((verbosity_ % 10) > 0) + edm::LogVerbatim("HBHEMuon") << hcid0 << " Depth " << depth << " E " << eneRaw << " C " << chgRaw; +#endif + } + } + } + } + } +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("HBHEMuon") << "Propagate Track to HCAL: " << trackID.okHCAL << " Match " + << hbheMuon.matchedId_ << " Hot " << isHot << " Energy " << eHcal; +#endif + hbheMuon.hcalIeta_ = ieta; + hbheMuon.hcalIphi_ = iphi; + for (int i = 0; i < depthMax_; ++i) { + hbheMuon.hcalDepthEnergy_.push_back(eHcalDepth[i]); + hbheMuon.hcalDepthActiveLength_.push_back(activeL[i]); + hbheMuon.hcalDepthEnergyHot_.push_back(eHcalDepthHot[i]); + hbheMuon.hcalDepthActiveLengthHot_.push_back(activeHotL[i]); + hbheMuon.hcalDepthEnergyCorr_.push_back(eHcalDepthC[i]); + hbheMuon.hcalDepthEnergyHotCorr_.push_back(eHcalDepthHotC[i]); + hbheMuon.hcalDepthChargeHot_.push_back(cHcalDepthHot[i]); + hbheMuon.hcalDepthChargeHotBG_.push_back(cHcalDepthHotBG[i]); + hbheMuon.hcalDepthMatch_.push_back(matchDepth[i]); + hbheMuon.hcalDepthMatchHot_.push_back(matchDepthHot[i]); + hbheMuon.hcalDepthEnergyAux_.push_back(eHcalDepthAux[i]); + hbheMuon.hcalDepthEnergyHotAux_.push_back(eHcalDepthHotAux[i]); + hbheMuon.hcalDepthEnergyCorrAux_.push_back(eHcalDepthCAux[i]); + hbheMuon.hcalDepthEnergyHotCorrAux_.push_back(eHcalDepthHotCAux[i]); + hbheMuon.hcalDepthChargeHotAux_.push_back(cHcalDepthHotAux[i]); + hbheMuon.hcalDepthChargeHotBGAux_.push_back(cHcalDepthHotBGAux[i]); + hbheMuon.hcalDepthEnergyRaw_.push_back(eHcalDepthRaw[i]); + hbheMuon.hcalDepthEnergyHotRaw_.push_back(eHcalDepthHotRaw[i]); + hbheMuon.hcalDepthEnergyCorrRaw_.push_back(eHcalDepthCRaw[i]); + hbheMuon.hcalDepthEnergyHotCorrRaw_.push_back(eHcalDepthHotCRaw[i]); + hbheMuon.hcalDepthChargeHotRaw_.push_back(cHcalDepthHotRaw[i]); + hbheMuon.hcalDepthChargeHotBGRaw_.push_back(cHcalDepthHotBGRaw[i]); + } + hbheMuon.hcalActiveLength_ = activeLengthTot; + hbheMuon.hcalHot_ = isHot; + hbheMuon.hcalActiveLengthHot_ = activeLengthHotTot; + + if ((recMuon->p() > 10.0) && (trackID.okHCAL)) + outputHcalHBHEMuonColl->emplace_back(hbheMuon); + } + } + } + if (!outputHcalHBHEMuonColl->empty()) + ++nGood_; + iEvent.put(std::move(outputHcalHBHEMuonColl), labelHBHEMuon_); +} + +// ------------ method fills 'descriptions' with the allowed parameters for the module ------------ +void AlCaHcalHBHEMuonProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + std::vector triggers = {"HLT_IsoMu", "HLT_Mu"}; + desc.add>("triggers", triggers); + desc.add("processName", "HLT"); + desc.add("triggerResults", edm::InputTag("TriggerResults", "", "HLT")); + desc.add("labelEBRecHit", edm::InputTag("ecalRecHit", "EcalRecHitsEB")); + desc.add("labelEERecHit", edm::InputTag("ecalRecHit", "EcalRecHitsEE")); + desc.add("labelHBHERecHit", edm::InputTag("hbhereco")); + desc.add("labelVertex", "offlinePrimaryVertices"); + desc.add("labelMuon", "muons"); + desc.add("labelHBHEMuon", "hbheMuon"); + desc.add("collapseDepth", false); + desc.add("isItPlan1", false); + desc.addUntracked("verbosity", 0); + desc.addUntracked("isItPreRecHit", false); + desc.addUntracked("writeRespCorr", false); + desc.addUntracked("fileInCorr", ""); + desc.addUntracked("maxDepth", 4); + descriptions.add("alcaHcalHBHEMuonProducer", desc); +} + +// ------------ method called once each job just after ending the event loop ------------ +void AlCaHcalHBHEMuonProducer::endStream() { + globalCache()->nAll_ += nAll_; + globalCache()->nGood_ += nGood_; +} + +void AlCaHcalHBHEMuonProducer::globalEndJob(const alcaHcalHBHEMuon::Counters* count) { + edm::LogVerbatim("HBHEMuon") << "Selects " << count->nGood_ << " out of " << count->nAll_ << " total # of events\n"; +} + +// ------------ method called when starting or ending a run ------------ +void AlCaHcalHBHEMuonProducer::beginRun(edm::Run const& iRun, edm::EventSetup const& iSetup) { + hdc_ = &iSetup.getData(tok_ddrec_); + actHB.clear(); + actHE.clear(); + actHB = hdc_->getThickActive(0); + actHE = hdc_->getThickActive(1); +#ifdef EDM_ML_DEBUG + unsigned int k1(0), k2(0); + edm::LogVerbatim("HBHEMuon") << actHB.size() << " Active Length for HB"; + for (const auto& act : actHB) { + edm::LogVerbatim("HBHEMuon") << "[" << k1 << "] ieta " << act.ieta << " depth " << act.depth << " zside " + << act.zside << " type " << act.stype << " phi " << act.iphis.size() << ":" + << act.iphis[0] << " L " << act.thick; + HcalDetId hcid1(HcalBarrel, (act.ieta) * (act.zside), act.iphis[0], act.depth); + HcalDetId hcid2 = mergedDepth_ ? hdc_->mergedDepthDetId(hcid1) : hcid1; + edm::LogVerbatim("HBHEMuon") << hcid1 << " | " << hcid2 << " L " << activeLength(DetId(hcid2)); + ++k1; + } + edm::LogVerbatim("HBHEMuon") << actHE.size() << " Active Length for HE"; + for (const auto& act : actHE) { + edm::LogVerbatim("HBHEMuon") << "[" << k2 << "] ieta " << act.ieta << " depth " << act.depth << " zside " + << act.zside << " type " << act.stype << " phi " << act.iphis.size() << ":" + << act.iphis[0] << " L " << act.thick; + HcalDetId hcid1(HcalEndcap, (act.ieta) * (act.zside), act.iphis[0], act.depth); + HcalDetId hcid2 = mergedDepth_ ? hdc_->mergedDepthDetId(hcid1) : hcid1; + edm::LogVerbatim("HBHEMuon") << hcid1 << " | " << hcid2 << " L " << activeLength(DetId(hcid2)); + ++k2; + } +#endif + + bool changed = true; + bool flag = hltConfig_.init(iRun, iSetup, processName_, changed); + edm::LogVerbatim("HBHEMuon") << "Run[" << nRun_ << "] " << iRun.run() << " hltconfig.init " << flag << std::endl; + + theHBHETopology_ = &iSetup.getData(tok_htopo_); + respCorrs_ = &iSetup.getData(tok_respcorr_); + geo_ = &iSetup.getData(tok_geom_); + + // Write correction factors for all HB/HE events + if (writeRespCorr_) { + const HcalGeometry* gHcal = static_cast(geo_->getSubdetectorGeometry(DetId::Hcal, HcalBarrel)); + const std::vector& ids = gHcal->getValidDetIds(DetId::Hcal, 0); + edm::LogVerbatim("HBHEMuon") << "\nTable of Correction Factors for Run " << iRun.run() << "\n"; + for (auto const& id : ids) { + if ((id.det() == DetId::Hcal) && ((id.subdetId() == HcalBarrel) || (id.subdetId() == HcalEndcap))) { + edm::LogVerbatim("HBHEMuon") << HcalDetId(id) << " " << id.rawId() << " " + << (respCorrs_->getValues(id))->getValue(); + } + } + } +} + +void AlCaHcalHBHEMuonProducer::endRun(edm::Run const& iRun, edm::EventSetup const&) { + edm::LogVerbatim("HBHEMuon") << "endRun[" << nRun_ << "] " << iRun.run() << "\n"; + ++nRun_; +} + +// ------------ methods called by produce() ------------ + +int AlCaHcalHBHEMuonProducer::matchId(const HcalDetId& id1, const HcalDetId& id2) { + HcalDetId kd1(id1.subdet(), id1.ieta(), id1.iphi(), 1); + HcalDetId kd2(id1.subdet(), id2.ieta(), id2.iphi(), 1); + int match = ((kd1 == kd2) ? 1 : 0); + return match; +} + +double AlCaHcalHBHEMuonProducer::activeLength(const DetId& id_) { + HcalDetId id(id_); + int ieta = id.ietaAbs(); + int zside = id.zside(); + int iphi = id.iphi(); + std::vector dpths; + if (mergedDepth_) { + std::vector ids; + hdc_->unmergeDepthDetId(id, ids); + for (auto idh : ids) + dpths.emplace_back(idh.depth()); + } else { + dpths.emplace_back(id.depth()); + } + double lx(0); + if (id.subdet() == HcalBarrel) { + for (unsigned int i = 0; i < actHB.size(); ++i) { + if ((ieta == actHB[i].ieta) && (zside == actHB[i].zside) && + (std::find(dpths.begin(), dpths.end(), actHB[i].depth) != dpths.end()) && + (std::find(actHB[i].iphis.begin(), actHB[i].iphis.end(), iphi) != actHB[i].iphis.end())) { + lx += actHB[i].thick; + } + } + } else { + for (unsigned int i = 0; i < actHE.size(); ++i) { + if ((ieta == actHE[i].ieta) && (zside == actHE[i].zside) && + (std::find(dpths.begin(), dpths.end(), actHE[i].depth) != dpths.end()) && + (std::find(actHE[i].iphis.begin(), actHE[i].iphis.end(), iphi) != actHE[i].iphis.end())) { + lx += actHE[i].thick; + } + } + } + return lx; +} + +bool AlCaHcalHBHEMuonProducer::isGoodVertex(const reco::Vertex& vtx) { + if (vtx.isFake()) + return false; + if (vtx.ndof() < 4) + return false; + if (vtx.position().Rho() > 2.) + return false; + if (fabs(vtx.position().Z()) > 24.) + return false; + return true; +} + +double AlCaHcalHBHEMuonProducer::respCorr(const DetId& id) { + double cfac(1.0); + if (useMyCorr_) { + auto itr = corrValue_.find(id); + if (itr != corrValue_.end()) + cfac = itr->second; + } else if (respCorrs_ != nullptr) { + cfac = (respCorrs_->getValues(id))->getValue(); + } + return cfac; +} + +double AlCaHcalHBHEMuonProducer::gainFactor(const HcalDbService* conditions, const HcalDetId& id) { + double gain(0.0); + const HcalCalibrations& calibs = conditions->getHcalCalibrations(id); + for (int capid = 0; capid < 4; ++capid) + gain += (0.25 * calibs.respcorrgain(capid)); + return gain; +} + +int AlCaHcalHBHEMuonProducer::depth16HE(int ieta, int iphi) { + // Transition between HB/HE is special + // For Run 1 or for Plan1 standard reconstruction it is 3 + // For runs beyond 2018 or in Plan1 for HEP17 it is 4 + int zside = (ieta > 0) ? 1 : -1; + int depth = theHBHETopology_->dddConstants()->getMinDepth(1, 16, iphi, zside); + if (isItPlan1_ && (!isItPreRecHit_)) + depth = 3; +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("HBHEMuon") << "Plan1 " << isItPlan1_ << " PreRecHit " << isItPreRecHit_ << " phi " << iphi + << " depth " << depth; +#endif + return depth; +} + +bool AlCaHcalHBHEMuonProducer::goodCell(const HcalDetId& hcid, + const reco::Track* pTrack, + const CaloGeometry* geo, + const MagneticField* bField) { + std::pair rz = hdc_->getRZ(hcid); + bool typeRZ = (hcid.subdet() == HcalEndcap) ? false : true; + bool match = spr::propagateHCAL(pTrack, geo, bField, typeRZ, rz, (((verbosity_ / 10000) % 10) > 0)); + return match; +} + +//define this as a plug-in +#include "FWCore/Framework/interface/MakerMacros.h" + +DEFINE_FWK_MODULE(AlCaHcalHBHEMuonProducer); diff --git a/Calibration/HcalAlCaRecoProducers/plugins/AlCaHcalHEMuonFilter.cc b/Calibration/HcalAlCaRecoProducers/plugins/AlCaHcalHEMuonFilter.cc new file mode 100644 index 0000000000000..4dc2863d0cbc7 --- /dev/null +++ b/Calibration/HcalAlCaRecoProducers/plugins/AlCaHcalHEMuonFilter.cc @@ -0,0 +1,141 @@ +// system include files +#include +#include +#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/EventSetup.h" +#include "FWCore/Framework/interface/Run.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" + +#include "DataFormats/Common/interface/Handle.h" +#include "DataFormats/Common/interface/Ref.h" +#include "DataFormats/HcalCalibObjects/interface/HcalHBHEMuonVariables.h" + +//#define EDM_ML_DEBUG +// +// class declaration +// + +namespace alcaHcalHBHEMuon { + struct Counters { + Counters() : nAll_(0), nGood_(0), nFinal_(0) {} + mutable std::atomic nAll_, nGood_, nFinal_; + }; +} // namespace alcaHcalHBHEMuon + +class AlCaHcalHEMuonFilter : public edm::global::EDFilter > { +public: + AlCaHcalHEMuonFilter(edm::ParameterSet const&); + ~AlCaHcalHEMuonFilter() override = default; + + std::shared_ptr globalBeginRun(edm::Run const&, edm::EventSetup const&) const override; + + bool filter(edm::StreamID, edm::Event&, edm::EventSetup const&) const override; + void globalEndRun(edm::Run const& iRun, edm::EventSetup const&) const override; + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + +private: + // ----------member data --------------------------- + const int prescale_; + const double muonptCut_, muonetaCut_; + const edm::InputTag labelHBHEMuonVar_; + const edm::EDGetTokenT tokHBHEMuonVar_; +}; + +// +// constructors and destructor +// +AlCaHcalHEMuonFilter::AlCaHcalHEMuonFilter(edm::ParameterSet const& iConfig) + : prescale_(iConfig.getParameter("prescale")), + muonptCut_(iConfig.getParameter("muonPtCut")), + muonetaCut_(iConfig.getParameter("muonEtaCut")), + labelHBHEMuonVar_(iConfig.getParameter("hbheMuonLabel")), + tokHBHEMuonVar_(consumes(labelHBHEMuonVar_)) { + edm::LogVerbatim("HBHEMuon") << "Parameters read from config file \n\t prescale_ " << prescale_ << "\n\t Labels " + << labelHBHEMuonVar_; +} // AlCaHcalHEMuonFilter::AlCaHcalHEMuonFilter constructor + +// +// member functions +// + +// ------------ method called on each new Event ------------ +bool AlCaHcalHEMuonFilter::filter(edm::StreamID, edm::Event& iEvent, edm::EventSetup const&) const { + bool accept(false); + ++(runCache(iEvent.getRun().index())->nAll_); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("HBHEMuon") << "AlCaHcalHEMuonFilter::Run " << iEvent.id().run() << " Event " << iEvent.id().event() + << " Luminosity " << iEvent.luminosityBlock() << " Bunch " << iEvent.bunchCrossing(); +#endif + + auto const& hbheMuonColl = iEvent.getHandle(tokHBHEMuonVar_); + if (hbheMuonColl.isValid()) { + auto hbheMuon = hbheMuonColl.product(); + if (!hbheMuon->empty()) { + bool ok(false); + for (auto const& muon : *hbheMuon) + if ((muon.ptGlob_ >= muonptCut_) && (std::abs(muon.etaGlob_) > muonetaCut_)) + ok = true; +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("HBHEMuon") << "AlCaHcalHEMuonFilter::Flag for finding a muon with pt > " << muonptCut_ + << " and |eta| > " << muonetaCut_ << " is " << ok; +#endif + if (ok) { + ++(runCache(iEvent.getRun().index())->nGood_); + if (prescale_ <= 1) + accept = true; + else if (runCache(iEvent.getRun().index())->nGood_ % prescale_ == 1) + accept = true; + } + } + } else { + edm::LogVerbatim("HBHEMuon") << "AlCaHcalHEMuonFilter::Cannot find the collection for HcalHBHEMuonVariables"; + } + + // Return the acceptance flag + if (accept) + ++(runCache(iEvent.getRun().index())->nFinal_); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("HBHEMuon") << "AlCaHcalHEMuonFilter::Accept flag " << accept << " All " + << runCache(iEvent.getRun().index())->nAll_ << " Good " + << runCache(iEvent.getRun().index())->nGood_ << " Final " + << runCache(iEvent.getRun().index())->nFinal_; +#endif + return accept; + +} // AlCaHcalHEMuonFilter::filter + +// ------------ method called when starting to processes a run ------------ +std::shared_ptr AlCaHcalHEMuonFilter::globalBeginRun(edm::Run const& iRun, + edm::EventSetup const&) const { + edm::LogVerbatim("HBHEMuon") << "Start the Run " << iRun.run(); + return std::make_shared(); +} + +// ------------ method called when ending the processing of a run ------------ +void AlCaHcalHEMuonFilter::globalEndRun(edm::Run const& iRun, edm::EventSetup const&) const { + edm::LogVerbatim("HBHEMuon") << "Select " << runCache(iRun.index())->nFinal_ << " out of " + << runCache(iRun.index())->nGood_ << " good and " << runCache(iRun.index())->nAll_ + << " total events"; +} + +// ------------ method fills 'descriptions' with the allowed parameters for the module ------------ +void AlCaHcalHEMuonFilter::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + desc.add("prescale", 1); + desc.add("muonPtCut", 20.0); + desc.add("muonEtaCut", 1.305); + desc.add("hbheMuonLabel", edm::InputTag("alcaHcalHBHEMuonProducer", "hbheMuon")); + descriptions.add("alcaHcalHEMuonFilter", desc); +} + +//define this as a plug-in +#include "FWCore/Framework/interface/MakerMacros.h" + +DEFINE_FWK_MODULE(AlCaHcalHEMuonFilter); diff --git a/Calibration/HcalAlCaRecoProducers/plugins/AlCaHcalIsotrkFilter.cc b/Calibration/HcalAlCaRecoProducers/plugins/AlCaHcalIsotrkFilter.cc new file mode 100644 index 0000000000000..9d7cc3d4557b5 --- /dev/null +++ b/Calibration/HcalAlCaRecoProducers/plugins/AlCaHcalIsotrkFilter.cc @@ -0,0 +1,164 @@ +// system include files +#include +#include +#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/EventSetup.h" +#include "FWCore/Framework/interface/Run.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" + +#include "DataFormats/Common/interface/Handle.h" +#include "DataFormats/Common/interface/Ref.h" +#include "DataFormats/HcalCalibObjects/interface/HcalIsoTrkCalibVariables.h" + +//#define EDM_ML_DEBUG +// +// class declaration +// + +namespace alcaHcalIsoTrk { + struct Counters { + Counters() : nAll_(0), nGood_(0), nLow_(0), nHigh_(0) {} + mutable std::atomic nAll_, nGood_, nLow_, nHigh_; + }; +} // namespace alcaHcalIsoTrk + +class AlCaHcalIsotrkFilter : public edm::global::EDFilter > { +public: + AlCaHcalIsotrkFilter(edm::ParameterSet const&); + + std::shared_ptr globalBeginRun(edm::Run const&, edm::EventSetup const&) const override; + + bool filter(edm::StreamID, edm::Event&, edm::EventSetup const&) const override; + void globalEndRun(edm::Run const& iRun, edm::EventSetup const&) const override; + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + +private: + // ----------member data --------------------------- + double pTrackLow_, pTrackHigh_; + int prescaleLow_, prescaleHigh_; + edm::InputTag labelIsoTkVar_; + edm::EDGetTokenT tokIsoTrkVar_; +}; + +// +// constructors and destructor +// +AlCaHcalIsotrkFilter::AlCaHcalIsotrkFilter(edm::ParameterSet const& iConfig) + : pTrackLow_(iConfig.getParameter("momentumLow")), + pTrackHigh_(iConfig.getParameter("momentumHigh")), + prescaleLow_(iConfig.getParameter("prescaleLow")), + prescaleHigh_(iConfig.getParameter("prescaleHigh")), + labelIsoTkVar_(iConfig.getParameter("isoTrackLabel")), + tokIsoTrkVar_(consumes(labelIsoTkVar_)) { + edm::LogVerbatim("HcalIsoTrack") << "Parameters read from config file \n\t momentumLow_ " << pTrackLow_ + << "\t prescaleLow_ " << prescaleLow_ << "\t momentumHigh_ " << pTrackHigh_ + << "\t prescaleHigh_ " << prescaleHigh_ << "\n\t Labels " << labelIsoTkVar_; +} // AlCaHcalIsotrkFilter::AlCaHcalIsotrkFilter constructor + +// +// member functions +// + +// ------------ method called on each new Event ------------ +bool AlCaHcalIsotrkFilter::filter(edm::StreamID, edm::Event& iEvent, edm::EventSetup const&) const { + bool accept(false); + ++(runCache(iEvent.getRun().index())->nAll_); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("HcalIsoTrack") << "AlCaHcalIsotrkFilter::Run " << iEvent.id().run() << " Event " + << iEvent.id().event() << " Luminosity " << iEvent.luminosityBlock() << " Bunch " + << iEvent.bunchCrossing(); +#endif + + auto const& isotrkCalibColl = iEvent.getHandle(tokIsoTrkVar_); + if (isotrkCalibColl.isValid()) { + auto isotrkCalib = isotrkCalibColl.product(); + bool low(false), high(false), inRange(false); + for (auto itr = isotrkCalib->begin(); itr != isotrkCalib->end(); ++itr) { + if (itr->p_ < pTrackLow_) { + low = true; + } else if (itr->p_ > pTrackHigh_) { + high = true; + } else { + inRange = true; + } + } +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("HcalIsoTrack") << "AlCaHcalIsotrkFilter::Finds " << isotrkCalib->size() + << " entries in HcalIsoTrkCalibVariables collection with inRange " << inRange + << " low " << low << " high " << high; +#endif + if (low) + ++(runCache(iEvent.getRun().index())->nLow_); + if (high) + ++(runCache(iEvent.getRun().index())->nHigh_); + if (inRange) { + accept = true; + } else { + if (low) { + if (prescaleLow_ <= 1) + accept = true; + else if (runCache(iEvent.getRun().index())->nLow_ % prescaleLow_ == 1) + accept = true; + } + if (high) { + if (prescaleHigh_ <= 1) + accept = true; + else if (runCache(iEvent.getRun().index())->nHigh_ % prescaleHigh_ == 1) + accept = true; + } + } + } else { + edm::LogVerbatim("HcalIsoTrack") << "AlCaHcalIsotrkFilter::Cannot find the collection for HcalIsoTrkCalibVariables"; + } + + // Return the acceptance flag + if (accept) + ++(runCache(iEvent.getRun().index())->nGood_); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("HcalIsoTrack") << "AlCaHcalIsotrkFilter::Accept flag " << accept << " All " + << runCache(iEvent.getRun().index())->nAll_ << " Good " + << runCache(iEvent.getRun().index())->nGood_ << " Low " + << runCache(iEvent.getRun().index())->nLow_ << " High " + << runCache(iEvent.getRun().index())->nHigh_; +#endif + return accept; + +} // AlCaHcalIsotrkFilter::filter + +// ------------ method called when starting to processes a run ------------ +std::shared_ptr AlCaHcalIsotrkFilter::globalBeginRun(edm::Run const& iRun, + edm::EventSetup const&) const { + edm::LogVerbatim("HcalIsoTrack") << "Start the Run " << iRun.run(); + return std::make_shared(); +} + +// ------------ method called when ending the processing of a run ------------ +void AlCaHcalIsotrkFilter::globalEndRun(edm::Run const& iRun, edm::EventSetup const&) const { + edm::LogVerbatim("HcalIsoTrack") << "Select " << runCache(iRun.index())->nGood_ << " good events out of " + << runCache(iRun.index())->nAll_ << " total # of events with " + << runCache(iRun.index())->nLow_ << ":" << runCache(iRun.index())->nHigh_ + << " events below and above the required range"; +} + +// ------------ method fills 'descriptions' with the allowed parameters for the module ------------ +void AlCaHcalIsotrkFilter::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + desc.add("momentumLow", 40.0); + desc.add("momentumHigh", 60.0); + desc.add("prescaleLow", 1); + desc.add("prescaleHigh", 1); + desc.add("isoTrackLabel", edm::InputTag("alcaHcalIsotrkProducer", "HcalIsoTrack")); + descriptions.add("alcaHcalIsotrkFilter", desc); +} + +//define this as a plug-in +#include "FWCore/Framework/interface/MakerMacros.h" + +DEFINE_FWK_MODULE(AlCaHcalIsotrkFilter); diff --git a/Calibration/HcalAlCaRecoProducers/plugins/AlCaHcalIsotrkProducer.cc b/Calibration/HcalAlCaRecoProducers/plugins/AlCaHcalIsotrkProducer.cc new file mode 100644 index 0000000000000..67cd96c4c1d9b --- /dev/null +++ b/Calibration/HcalAlCaRecoProducers/plugins/AlCaHcalIsotrkProducer.cc @@ -0,0 +1,1405 @@ +// -*- C++ -*- + +// system include files +#include +#include +#include +#include +#include +#include +#include +#include + +// user include files +#include "Calibration/IsolatedParticles/interface/CaloPropagateTrack.h" +#include "Calibration/IsolatedParticles/interface/ChargeIsolation.h" +#include "Calibration/IsolatedParticles/interface/eCone.h" +#include "Calibration/IsolatedParticles/interface/eECALMatrix.h" +#include "Calibration/IsolatedParticles/interface/eHCALMatrix.h" +#include "Calibration/IsolatedParticles/interface/TrackSelection.h" + +#include "CondFormats/DataRecord/interface/EcalChannelStatusRcd.h" +#include "CondFormats/DataRecord/interface/HcalRespCorrsRcd.h" +#include "CondFormats/HcalObjects/interface/HcalRespCorrs.h" + +#include "DataFormats/BeamSpot/interface/BeamSpot.h" +#include "DataFormats/CaloTowers/interface/CaloTowerCollection.h" +#include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" +#include "DataFormats/HcalCalibObjects/interface/HcalIsoTrkCalibVariables.h" +#include "DataFormats/HcalCalibObjects/interface/HcalIsoTrkEventVariables.h" +#include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h" +#include "DataFormats/Math/interface/LorentzVector.h" +#include "DataFormats/Math/interface/deltaR.h" +#include "DataFormats/MuonReco/interface/Muon.h" +#include "DataFormats/MuonReco/interface/MuonFwd.h" +#include "DataFormats/MuonReco/interface/MuonSelectors.h" +#include "DataFormats/TrackReco/interface/Track.h" +#include "DataFormats/TrackReco/interface/TrackFwd.h" +#include "DataFormats/TrackReco/interface/HitPattern.h" +#include "DataFormats/TrackReco/interface/TrackBase.h" +#include "DataFormats/VertexReco/interface/VertexFwd.h" +#include "DataFormats/VertexReco/interface/Vertex.h" +#include "DataFormats/Common/interface/TriggerResults.h" +#include "DataFormats/HLTReco/interface/TriggerEvent.h" +#include "DataFormats/HLTReco/interface/TriggerObject.h" +#include "DataFormats/Luminosity/interface/LumiDetails.h" +#include "DataFormats/L1TGlobal/interface/GlobalAlgBlk.h" +#include "DataFormats/L1TGlobal/interface/GlobalExtBlk.h" +#include "DataFormats/L1Trigger/interface/BXVector.h" +#include "L1Trigger/L1TGlobal/interface/L1TGlobalUtil.h" +#include "HLTrigger/HLTcore/interface/HLTConfigProvider.h" +#include "DataFormats/HepMCCandidate/interface/GenParticle.h" +#include "DataFormats/HepMCCandidate/interface/GenParticleFwd.h" +#include "SimDataFormats/GeneratorProducts/interface/GenEventInfoProduct.h" + +#include "FWCore/Common/interface/TriggerNames.h" +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/stream/EDProducer.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" + +#include "Geometry/CaloGeometry/interface/CaloGeometry.h" +#include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h" +#include "Geometry/Records/interface/CaloTopologyRecord.h" +#include "Geometry/CaloTopology/interface/CaloSubdetectorTopology.h" +#include "Geometry/CaloTopology/interface/HcalTopology.h" +#include "Geometry/CaloTopology/interface/CaloTopology.h" +#include "Geometry/HcalCommonData/interface/HcalDDDRecConstants.h" +#include "Geometry/CaloTopology/interface/EcalTrigTowerConstituentsMap.h" + +#include "MagneticField/Engine/interface/MagneticField.h" +#include "MagneticField/Records/interface/IdealMagneticFieldRecord.h" +#include "RecoLocalCalo/EcalRecAlgos/interface/EcalSeverityLevelAlgo.h" +#include "RecoLocalCalo/EcalRecAlgos/interface/EcalSeverityLevelAlgoRcd.h" + +//#define EDM_ML_DEBUG +// +// class declaration +// + +namespace alcaHcalIsoTracks { + struct Counters { + Counters() : nAll_(0), nGood_(0), nRange_(0) {} + mutable std::atomic nAll_, nGood_, nRange_; + }; +} // namespace alcaHcalIsoTracks + +class AlCaHcalIsotrkProducer : public edm::stream::EDProducer > { +public: + explicit AlCaHcalIsotrkProducer(edm::ParameterSet const&, const alcaHcalIsoTracks::Counters*); + ~AlCaHcalIsotrkProducer() override = default; + + static std::unique_ptr initializeGlobalCache(edm::ParameterSet const&) { + return std::make_unique(); + } + + void produce(edm::Event&, edm::EventSetup const&) override; + void endStream() override; + static void globalEndJob(const alcaHcalIsoTracks::Counters* counters); + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + +private: + void beginRun(edm::Run const&, edm::EventSetup const&) override; + void endRun(edm::Run const&, edm::EventSetup const&) override; + std::array getProducts(int goodPV, + double eventWeight, + std::vector& vecL1, + std::vector& vecL3, + math::XYZPoint& leadPV, + std::vector& trkCaloDirections, + std::vector& trkCaloDets, + const CaloGeometry* geo, + const CaloTopology* topo, + const HcalTopology* theHBHETopology, + const EcalChannelStatus* theEcalChStatus, + const EcalSeverityLevelAlgo* theEcalSevlv, + edm::Handle& barrelRecHitsHandle, + edm::Handle& endcapRecHitsHandle, + edm::Handle& hbhe, + edm::Handle& towerHandle, + const edm::Handle& genParticles, + const HcalRespCorrs* respCorrs, + const edm::Handle& muonh, + std::vector& hocalib, + HcalIsoTrkEventVariables& hocalibEvent); + double dR(math::XYZTLorentzVector&, math::XYZTLorentzVector&); + double trackP(const reco::Track*, const edm::Handle&); + double rhoh(const edm::Handle&); + double eThreshold(const DetId& id, const CaloGeometry* geo) const; + DetId newId(const DetId&); + void storeEnergy(const HcalRespCorrs* respCorrs, + const std::vector& ids, + std::vector& edet, + double& eHcal, + std::vector& detIds, + std::vector& hitEnergies); + std::pair storeEnergy(const HcalRespCorrs* respCorrs, + edm::Handle& hbhe, + const std::vector& ids, + std::vector& hitEnergy1, + std::vector& hitEnergy2); + bool notaMuon(const reco::Track* pTrack0, const edm::Handle& muonh); + + // ----------member data --------------------------- + l1t::L1TGlobalUtil* l1GtUtils_; + HLTConfigProvider hltConfig_; + unsigned int nRun_, nAll_, nGood_, nRange_; + const std::vector trigNames_; + spr::trackSelectionParameters selectionParameter_; + const std::string theTrackQuality_; + const std::string processName_, l1Filter_; + const std::string l2Filter_, l3Filter_; + const double a_coneR_, a_mipR_, a_mipR2_, a_mipR3_; + const double a_mipR4_, a_mipR5_, pTrackMin_, eEcalMax_; + const double maxRestrictionP_, slopeRestrictionP_; + const double hcalScale_, eIsolate1_, eIsolate2_; + const double pTrackLow_, pTrackHigh_; + const bool ignoreTrigger_, useL1Trigger_; + const bool unCorrect_, collapseDepth_; + const double hitEthrEB_, hitEthrEE0_, hitEthrEE1_; + const double hitEthrEE2_, hitEthrEE3_; + const double hitEthrEELo_, hitEthrEEHi_; + const edm::InputTag triggerEvent_, theTriggerResultsLabel_; + const std::string labelGenTrack_, labelRecVtx_, labelEB_; + const std::string labelEE_, labelHBHE_, labelTower_, l1TrigName_; + const std::vector oldID_, newDepth_; + const bool hep17_; + const std::string labelIsoTkVar_, labelIsoTkEvtVar_; + + double a_charIsoR_, a_coneR1_, a_coneR2_; + const HcalDDDRecConstants* hdc_; + std::vector etabins_, phibins_; + std::vector oldDet_, oldEta_, oldDepth_; + double etadist_, phidist_, etahalfdist_, phihalfdist_; + + edm::EDGetTokenT tok_trigEvt_; + edm::EDGetTokenT tok_trigRes_; + edm::EDGetTokenT tok_parts_; + edm::EDGetTokenT tok_genTrack_; + edm::EDGetTokenT tok_recVtx_; + edm::EDGetTokenT tok_bs_; + edm::EDGetTokenT tok_EB_; + edm::EDGetTokenT tok_EE_; + edm::EDGetTokenT tok_hbhe_; + edm::EDGetTokenT tok_cala_; + edm::EDGetTokenT tok_ew_; + edm::EDGetTokenT > tok_alg_; + edm::EDGetTokenT tok_Muon_; + + 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_; +}; + +AlCaHcalIsotrkProducer::AlCaHcalIsotrkProducer(edm::ParameterSet const& iConfig, + const alcaHcalIsoTracks::Counters* counters) + : nRun_(0), + nAll_(0), + nGood_(0), + nRange_(0), + trigNames_(iConfig.getParameter >("triggers")), + theTrackQuality_(iConfig.getParameter("trackQuality")), + processName_(iConfig.getParameter("processName")), + l1Filter_(iConfig.getParameter("l1Filter")), + l2Filter_(iConfig.getParameter("l2Filter")), + l3Filter_(iConfig.getParameter("l3Filter")), + a_coneR_(iConfig.getParameter("coneRadius")), + a_mipR_(iConfig.getParameter("coneRadiusMIP")), + a_mipR2_(iConfig.getParameter("coneRadiusMIP2")), + a_mipR3_(iConfig.getParameter("coneRadiusMIP3")), + a_mipR4_(iConfig.getParameter("coneRadiusMIP4")), + a_mipR5_(iConfig.getParameter("coneRadiusMIP5")), + pTrackMin_(iConfig.getParameter("minimumTrackP")), + eEcalMax_(iConfig.getParameter("maximumEcalEnergy")), + maxRestrictionP_(iConfig.getParameter("maxTrackP")), + slopeRestrictionP_(iConfig.getParameter("slopeTrackP")), + hcalScale_(iConfig.getUntrackedParameter("hHcalScale", 1.0)), + eIsolate1_(iConfig.getParameter("isolationEnergyTight")), + eIsolate2_(iConfig.getParameter("isolationEnergyLoose")), + pTrackLow_(iConfig.getParameter("momentumLow")), + pTrackHigh_(iConfig.getParameter("momentumHigh")), + ignoreTrigger_(iConfig.getUntrackedParameter("ignoreTriggers", false)), + useL1Trigger_(iConfig.getUntrackedParameter("useL1Trigger", false)), + unCorrect_(iConfig.getUntrackedParameter("unCorrect", false)), + collapseDepth_(iConfig.getUntrackedParameter("collapseDepth", false)), + hitEthrEB_(iConfig.getParameter("EBHitEnergyThreshold")), + hitEthrEE0_(iConfig.getParameter("EEHitEnergyThreshold0")), + hitEthrEE1_(iConfig.getParameter("EEHitEnergyThreshold1")), + hitEthrEE2_(iConfig.getParameter("EEHitEnergyThreshold2")), + hitEthrEE3_(iConfig.getParameter("EEHitEnergyThreshold3")), + hitEthrEELo_(iConfig.getParameter("EEHitEnergyThresholdLow")), + hitEthrEEHi_(iConfig.getParameter("EEHitEnergyThresholdHigh")), + triggerEvent_(iConfig.getParameter("labelTriggerEvent")), + theTriggerResultsLabel_(iConfig.getParameter("labelTriggerResult")), + labelGenTrack_(iConfig.getParameter("labelTrack")), + labelRecVtx_(iConfig.getParameter("labelVertex")), + labelEB_(iConfig.getParameter("labelEBRecHit")), + labelEE_(iConfig.getParameter("labelEERecHit")), + labelHBHE_(iConfig.getParameter("labelHBHERecHit")), + labelTower_(iConfig.getParameter("labelCaloTower")), + l1TrigName_(iConfig.getUntrackedParameter("l1TrigName", "L1_SingleJet60")), + oldID_(iConfig.getUntrackedParameter >("oldID")), + newDepth_(iConfig.getUntrackedParameter >("newDepth")), + hep17_(iConfig.getUntrackedParameter("hep17")), + labelIsoTkVar_(iConfig.getParameter("isoTrackLabel")), + labelIsoTkEvtVar_(iConfig.getParameter("isoTrackEventLabel")) { + // Get the run parameters + const double isolationRadius(28.9), innerR(10.0), outerR(30.0); + reco::TrackBase::TrackQuality trackQuality_ = reco::TrackBase::qualityByName(theTrackQuality_); + selectionParameter_.minPt = iConfig.getParameter("minTrackPt"); + selectionParameter_.maxChi2 = iConfig.getParameter("maxChi2"); + selectionParameter_.maxDpOverP = iConfig.getParameter("maxDpOverP"); + selectionParameter_.minOuterHit = iConfig.getParameter("minOuterHit"); + selectionParameter_.minLayerCrossed = iConfig.getParameter("minLayerCrossed"); + selectionParameter_.maxInMiss = iConfig.getParameter("maxInMiss"); + selectionParameter_.minQuality = trackQuality_; + selectionParameter_.maxDxyPV = iConfig.getParameter("maxDxyPV"); + selectionParameter_.maxDzPV = iConfig.getParameter("maxDzPV"); + selectionParameter_.maxChi2 = iConfig.getParameter("maxChi2"); + selectionParameter_.maxDpOverP = iConfig.getParameter("maxDpOverP"); + selectionParameter_.minOuterHit = iConfig.getParameter("minOuterHit"); + selectionParameter_.minLayerCrossed = iConfig.getParameter("minLayerCrossed"); + selectionParameter_.maxInMiss = iConfig.getParameter("maxInMiss"); + selectionParameter_.maxOutMiss = iConfig.getParameter("maxOutMiss"); + a_charIsoR_ = a_coneR_ + isolationRadius; + a_coneR1_ = a_coneR_ + innerR; + a_coneR2_ = a_coneR_ + outerR; + // Different isolation cuts are described in DN-2016/029 + // Tight cut uses 2 GeV; Loose cut uses 10 GeV + // Eta dependent cut uses (maxRestrictionP_ * exp(|ieta|*log(2.5)/18)) + // with the factor for exponential slopeRestrictionP_ = log(2.5)/18 + // maxRestrictionP_ = 8 GeV as came from a study + std::string labelBS = iConfig.getParameter("labelBeamSpot"); + edm::InputTag algTag = iConfig.getParameter("algInputTag"); + edm::InputTag extTag = iConfig.getParameter("extInputTag"); + std::string labelMuon = iConfig.getParameter("labelMuon"); + + for (unsigned int k = 0; k < oldID_.size(); ++k) { + oldDet_.emplace_back((oldID_[k] / 10000) % 10); + oldEta_.emplace_back((oldID_[k] / 100) % 100); + oldDepth_.emplace_back(oldID_[k] % 100); + } + l1GtUtils_ = new l1t::L1TGlobalUtil(iConfig, consumesCollector(), *this, algTag, extTag, l1t::UseEventSetupIn::Event); + // define tokens for access + tok_trigEvt_ = consumes(triggerEvent_); + tok_trigRes_ = consumes(theTriggerResultsLabel_); + tok_bs_ = consumes(labelBS); + tok_genTrack_ = consumes(labelGenTrack_); + tok_ew_ = consumes(edm::InputTag("generator")); + tok_parts_ = consumes(edm::InputTag("genParticles")); + tok_cala_ = consumes(labelTower_); + tok_alg_ = consumes >(algTag); + tok_Muon_ = consumes(labelMuon); + tok_recVtx_ = consumes(labelRecVtx_); + tok_EB_ = consumes(edm::InputTag("ecalRecHit", labelEB_)); + tok_EE_ = consumes(edm::InputTag("ecalRecHit", labelEE_)); + tok_hbhe_ = consumes(labelHBHE_); + edm::LogVerbatim("HcalIsoTrack") << "Labels used " << triggerEvent_ << " " << theTriggerResultsLabel_ << " " + << labelBS << " " << labelRecVtx_ << " " << labelGenTrack_ << " " + << edm::InputTag("ecalRecHit", labelEB_) << " " + << edm::InputTag("ecalRecHit", labelEE_) << " " << labelHBHE_ << " " << labelTower_ + << " " << labelMuon; + + tok_ddrec_ = esConsumes(); + tok_bFieldH_ = esConsumes(); + tok_ecalChStatus_ = esConsumes(); + tok_sevlv_ = esConsumes(); + tok_geom_ = esConsumes(); + tok_caloTopology_ = esConsumes(); + tok_htopo_ = esConsumes(); + tok_resp_ = esConsumes(); + + 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_ + << "\t a_mipR2 " << a_mipR2_ << "\t a_mipR3 " << a_mipR3_ << "\t a_mipR4 " + << a_mipR4_ << "\t a_mipR5 " << a_mipR5_ << "\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 momentumHigh_ " << pTrackHigh_ + << "\n\t ignoreTrigger_ " << ignoreTrigger_ << "\n\t useL1Trigger_ " << useL1Trigger_ + << "\t unCorrect_ " << unCorrect_ << "\t collapseDepth_ " << collapseDepth_ + << "\t L1TrigName_ " << l1TrigName_ << "\nThreshold for EB " << hitEthrEB_ + << " EE " << hitEthrEE0_ << ":" << hitEthrEE1_ << ":" << hitEthrEE2_ << ":" + << hitEthrEE3_ << ":" << hitEthrEELo_ << ":" << hitEthrEEHi_; + 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]; + } + edm::LogVerbatim("HcalIsoTrack") << oldID_.size() << " DetIDs to be corrected with HEP17 flag:" << hep17_; + for (unsigned int k = 0; k < oldID_.size(); ++k) + edm::LogVerbatim("HcalIsoTrack") << "[" << k << "] Det " << oldDet_[k] << " EtaAbs " << oldEta_[k] << " Depth " + << oldDepth_[k] << ":" << newDepth_[k]; + + 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) + etabins_.push_back(-2.1 + 0.6 * i); + etadist_ = etabins_[1] - etabins_[0]; + phidist_ = phibins_[1] - phibins_[0]; + etahalfdist_ = 0.5 * etadist_; + phihalfdist_ = 0.5 * phidist_; + edm::LogVerbatim("HcalIsoTrack") << "EtaDist " << etadist_ << " " << etahalfdist_ << " PhiDist " << phidist_ << " " + << phihalfdist_; + //create also IsolatedPixelTrackCandidateCollection which contains isolation info and reference to primary track + produces(labelIsoTkVar_); + produces(labelIsoTkEvtVar_); + edm::LogVerbatim("HcalIsoTrack") << " Expected to produce the collections:\n" + << "HcalIsoTrkCalibVariablesCollection with label " << labelIsoTkVar_ + << "\nand HcalIsoTrkEventVariablesCollection with label " << labelIsoTkEvtVar_; +} + +void AlCaHcalIsotrkProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + desc.add("processName", "HLT"); + std::vector trig; + desc.add >("triggers", trig); + desc.add("l1Filter", ""); + desc.add("l2Filter", "L2Filter"); + desc.add("l3Filter", "Filter"); + // following 10 parameters are parameters to select good tracks + desc.add("trackQuality", "highPurity"); + desc.add("minTrackPt", 1.0); + desc.add("maxDxyPV", 0.02); + desc.add("maxDzPV", 0.02); + desc.add("maxChi2", 5.0); + desc.add("maxDpOverP", 0.1); + desc.add("minOuterHit", 4); + desc.add("minLayerCrossed", 8); + desc.add("maxInMiss", 0); + desc.add("maxOutMiss", 0); + // Minimum momentum of selected isolated track and signal zone + desc.add("minimumTrackP", 10.0); + desc.add("coneRadius", 34.98); + // signal zone in ECAL and MIP energy cutoff + desc.add("coneRadiusMIP", 14.0); + desc.add("coneRadiusMIP2", 18.0); + desc.add("coneRadiusMIP3", 20.0); + desc.add("coneRadiusMIP4", 22.0); + desc.add("coneRadiusMIP5", 24.0); + desc.add("maximumEcalEnergy", 2.0); + // following 4 parameters are for isolation cuts and described in the code + desc.add("maxTrackP", 8.0); + desc.add("slopeTrackP", 0.05090504066); + desc.add("isolationEnergyTight", 2.0); + desc.add("isolationEnergyLoose", 10.0); + // energy thershold for ECAL (from Egamma group) + desc.add("EBHitEnergyThreshold", 0.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("EEHitEnergyThresholdHigh", 0.30); + // prescale factors + desc.add("momentumLow", 40.0); + desc.add("momentumHigh", 60.0); + desc.add("prescaleLow", 1); + desc.add("prescaleHigh", 1); + // various labels for collections used in the code + desc.add("labelTriggerEvent", edm::InputTag("hltTriggerSummaryAOD", "", "HLT")); + desc.add("labelTriggerResult", edm::InputTag("TriggerResults", "", "HLT")); + desc.add("labelTrack", "generalTracks"); + desc.add("labelVertex", "offlinePrimaryVertices"); + desc.add("labelEBRecHit", "EcalRecHitsEB"); + desc.add("labelEERecHit", "EcalRecHitsEE"); + desc.add("labelHBHERecHit", "hbhereco"); + desc.add("labelBeamSpot", "offlineBeamSpot"); + desc.add("labelCaloTower", "towerMaker"); + desc.add("labelMuon", "muons"); + desc.add("algInputTag", edm::InputTag("gtStage2Digis")); + desc.add("extInputTag", edm::InputTag("gtStage2Digis")); + desc.add("isoTrackLabel", "HcalIsoTrack"); + desc.add("isoTrackEventLabel", "HcalIsoTrackEvent"); + // Various flags used for selecting tracks, choice of energy Method2/0 + // Data type 0/1 for single jet trigger or others + desc.addUntracked("ignoreTriggers", false); + desc.addUntracked("useL1Trigger", false); + desc.addUntracked("hcalScale", 1.0); + desc.addUntracked("unCorrect", false); + desc.addUntracked("collapseDepth", false); + desc.addUntracked("l1TrigName", "L1_SingleJet60"); + std::vector dummy; + desc.addUntracked >("oldID", dummy); + desc.addUntracked >("newDepth", dummy); + desc.addUntracked("hep17", false); + descriptions.add("alcaHcalIsotrkProducer", desc); +} + +void AlCaHcalIsotrkProducer::produce(edm::Event& iEvent, edm::EventSetup const& iSetup) { + nAll_++; +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("HcalIsoTrack") << "Run " << iEvent.id().run() << " Event " << iEvent.id().event() << " Luminosity " + << iEvent.luminosityBlock() << " Bunch " << iEvent.bunchCrossing(); +#endif + + HcalIsoTrkEventVariables isoTrkEvent; + //Step1: Get all the relevant containers + const MagneticField* bField = &iSetup.getData(tok_bFieldH_); + const EcalChannelStatus* theEcalChStatus = &iSetup.getData(tok_ecalChStatus_); + const EcalSeverityLevelAlgo* theEcalSevlv = &iSetup.getData(tok_sevlv_); + + // 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* respCorrs = &iSetup.getData(tok_resp_); + bool okC(true); + //Get track collection + auto trkCollection = iEvent.getHandle(tok_genTrack_); + if (!trkCollection.isValid()) { + edm::LogWarning("HcalIsoTrack") << "Cannot access the collection " << labelGenTrack_; + okC = false; + } + + //Get muon collection + auto const& muonh = iEvent.getHandle(tok_Muon_); + + //Define the best vertex and the beamspot + auto const& recVtxs = iEvent.getHandle(tok_recVtx_); + auto const& beamSpotH = iEvent.getHandle(tok_bs_); + math::XYZPoint leadPV(0, 0, 0); + int goodPV(0); + if (recVtxs.isValid() && !(recVtxs->empty())) { + isoTrkEvent.allvertex_ = recVtxs->size(); + for (unsigned int k = 0; k < recVtxs->size(); ++k) { + if (!((*recVtxs)[k].isFake()) && ((*recVtxs)[k].ndof() > 4)) { + if (goodPV == 0) + leadPV = math::XYZPoint((*recVtxs)[k].x(), (*recVtxs)[k].y(), (*recVtxs)[k].z()); + goodPV++; + } + } + } + if (goodPV == 0 && beamSpotH.isValid()) { + leadPV = beamSpotH->position(); + } +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("HcalIsoTrack") << "Primary Vertex " << leadPV << " out of " << goodPV << " vertex"; + if (beamSpotH.isValid()) { + edm::LogVerbatim("HcalIsoTrack") << " Beam Spot " << beamSpotH->position(); + } +#endif + + // RecHits + auto barrelRecHitsHandle = iEvent.getHandle(tok_EB_); + if (!barrelRecHitsHandle.isValid()) { + edm::LogWarning("HcalIsoTrack") << "Cannot access the collection " << labelEB_; + okC = false; + } + auto endcapRecHitsHandle = iEvent.getHandle(tok_EE_); + if (!endcapRecHitsHandle.isValid()) { + edm::LogWarning("HcalIsoTrack") << "Cannot access the collection " << labelEE_; + okC = false; + } + auto hbhe = iEvent.getHandle(tok_hbhe_); + if (!hbhe.isValid()) { + edm::LogWarning("HcalIsoTrack") << "Cannot access the collection " << labelHBHE_; + okC = false; + } + auto caloTower = iEvent.getHandle(tok_cala_); + + //=== genParticle information + auto const& genParticles = iEvent.getHandle(tok_parts_); + auto const& genEventInfo = iEvent.getHandle(tok_ew_); + double eventWeight = (genEventInfo.isValid()) ? genEventInfo->weight() : 1.0; + + //Propagate tracks to calorimeter surface) + std::vector trkCaloDirections; + spr::propagateCALO(trkCollection, geo, bField, theTrackQuality_, trkCaloDirections, false); + std::vector trkCaloDets; + spr::propagateCALO(trkCollection, geo, bField, theTrackQuality_, trkCaloDets, false); + std::vector vecL1, vecL3; + isoTrkEvent.tracks_ = trkCollection->size(); + isoTrkEvent.tracksProp_ = trkCaloDirections.size(); + isoTrkEvent.hltbits_.assign(trigNames_.size(), false); + + if (!ignoreTrigger_) { + //L1 + l1GtUtils_->retrieveL1(iEvent, iSetup, tok_alg_); + const std::vector >& finalDecisions = l1GtUtils_->decisionsFinal(); + for (const auto& decision : finalDecisions) { + if (decision.first.find(l1TrigName_) != std::string::npos) { + isoTrkEvent.l1Bit_ = decision.second; + break; + } + } +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("HcalIsoTrack") << "Trigger Information for " << l1TrigName_ << " is " << isoTrkEvent.l1Bit_ + << " from a list of " << finalDecisions.size() << " decisions"; +#endif + + //HLT + auto const& triggerResults = iEvent.getHandle(tok_trigRes_); + if (triggerResults.isValid()) { + const edm::TriggerNames& triggerNames = iEvent.triggerNames(*triggerResults); + const std::vector& names = triggerNames.triggerNames(); + if (!trigNames_.empty()) { + for (unsigned int iHLT = 0; iHLT < triggerResults->size(); iHLT++) { + int hlt = triggerResults->accept(iHLT); + for (unsigned int i = 0; i < trigNames_.size(); ++i) { + if (names[iHLT].find(trigNames_[i]) != std::string::npos) { + isoTrkEvent.hltbits_[i] = (hlt > 0); + if (hlt > 0) + isoTrkEvent.trigPass_ = true; +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("HcalIsoTrack") + << "This trigger " << names[iHLT] << " Flag " << hlt << ":" << isoTrkEvent.hltbits_[i]; +#endif + } + } + } + } + } +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("HcalIsoTrack") << "HLT Information shows " << isoTrkEvent.trigPass_ << ":" << trigNames_.empty() + << ":" << okC; +#endif + } + + auto outputHcalIsoTrackColl = std::make_unique(); + std::array ntksave{{0, 0, 0}}; + if (ignoreTrigger_ || useL1Trigger_) { + if (ignoreTrigger_ || isoTrkEvent.l1Bit_) + ntksave = getProducts(goodPV, + eventWeight, + vecL1, + vecL3, + leadPV, + trkCaloDirections, + trkCaloDets, + geo, + caloTopology, + theHBHETopology, + theEcalChStatus, + theEcalSevlv, + barrelRecHitsHandle, + endcapRecHitsHandle, + hbhe, + caloTower, + genParticles, + respCorrs, + muonh, + *outputHcalIsoTrackColl, + isoTrkEvent); + isoTrkEvent.tracksSaved_ = ntksave[0]; + isoTrkEvent.tracksLoose_ = ntksave[1]; + isoTrkEvent.tracksTight_ = ntksave[2]; + } else { + trigger::TriggerEvent triggerEvent; + auto const& triggerEventHandle = iEvent.getHandle(tok_trigEvt_); + if (!triggerEventHandle.isValid()) { + edm::LogWarning("HcalIsoTrack") << "Error! Can't get the product " << triggerEvent_.label(); + } else if (okC) { + triggerEvent = *(triggerEventHandle.product()); + const trigger::TriggerObjectCollection& TOC(triggerEvent.getObjects()); + bool done(false); + auto const& triggerResults = iEvent.getHandle(tok_trigRes_); + if (triggerResults.isValid()) { + std::vector modules; + const edm::TriggerNames& triggerNames = iEvent.triggerNames(*triggerResults); + const std::vector& names = triggerNames.triggerNames(); + for (unsigned int iHLT = 0; iHLT < triggerResults->size(); iHLT++) { + bool ok = (isoTrkEvent.trigPass_) || (trigNames_.empty()); + if (ok) { + unsigned int triggerindx = hltConfig_.triggerIndex(names[iHLT]); + const std::vector& moduleLabels(hltConfig_.moduleLabels(triggerindx)); + std::vector vecL2; + vecL1.clear(); + vecL3.clear(); + //loop over all trigger filters in event (i.e. filters passed) + for (unsigned int ifilter = 0; ifilter < triggerEvent.sizeFilters(); ++ifilter) { + std::vector Keys; + std::string label = triggerEvent.filterTag(ifilter).label(); + //loop over keys to objects passing this filter + for (unsigned int imodule = 0; imodule < moduleLabels.size(); imodule++) { + if (label.find(moduleLabels[imodule]) != std::string::npos) { +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("HcalIsoTrack") << "FilterName " << label; +#endif + for (unsigned int ifiltrKey = 0; ifiltrKey < triggerEvent.filterKeys(ifilter).size(); ++ifiltrKey) { + Keys.push_back(triggerEvent.filterKeys(ifilter)[ifiltrKey]); + const trigger::TriggerObject& TO(TOC[Keys[ifiltrKey]]); + math::XYZTLorentzVector v4(TO.px(), TO.py(), TO.pz(), TO.energy()); + if (label.find(l2Filter_) != std::string::npos) { + vecL2.push_back(v4); + } else if (label.find(l3Filter_) != std::string::npos) { + vecL3.push_back(v4); + } else if ((label.find(l1Filter_) != std::string::npos) || (l1Filter_.empty())) { + vecL1.push_back(v4); + } +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("HcalIsoTrack") + << "key " << ifiltrKey << " : pt " << TO.pt() << " eta " << TO.eta() << " phi " << TO.phi() + << " mass " << TO.mass() << " Id " << TO.id(); +#endif + } +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("HcalIsoTrack") + << "sizes " << vecL1.size() << ":" << vecL2.size() << ":" << vecL3.size(); +#endif + } + } + } + + // Now Make the products for all selected tracks + if (!done) { + ntksave = getProducts(goodPV, + eventWeight, + vecL1, + vecL3, + leadPV, + trkCaloDirections, + trkCaloDets, + geo, + caloTopology, + theHBHETopology, + theEcalChStatus, + theEcalSevlv, + barrelRecHitsHandle, + endcapRecHitsHandle, + hbhe, + caloTower, + genParticles, + respCorrs, + muonh, + *outputHcalIsoTrackColl, + isoTrkEvent); + isoTrkEvent.tracksSaved_ += ntksave[0]; + isoTrkEvent.tracksLoose_ += ntksave[1]; + isoTrkEvent.tracksTight_ += ntksave[2]; + done = true; + } + } + } + } + } + } + isoTrkEvent.trigPassSel_ = (isoTrkEvent.tracksSaved_ > 0); + if (isoTrkEvent.trigPassSel_) { + ++nGood_; + for (auto itr = outputHcalIsoTrackColl->begin(); itr != outputHcalIsoTrackColl->end(); ++itr) { + if (itr->p_ > pTrackLow_ && itr->p_ < pTrackHigh_) + ++nRange_; + } + } + + auto outputEventcol = std::make_unique(); + outputEventcol->emplace_back(isoTrkEvent); + iEvent.put(std::move(outputEventcol), labelIsoTkEvtVar_); + iEvent.put(std::move(outputHcalIsoTrackColl), labelIsoTkVar_); +} + +void AlCaHcalIsotrkProducer::endStream() { + globalCache()->nAll_ += nAll_; + globalCache()->nGood_ += nGood_; + globalCache()->nRange_ += nRange_; +} + +void AlCaHcalIsotrkProducer::globalEndJob(const alcaHcalIsoTracks::Counters* count) { + edm::LogVerbatim("HcalIsoTrack") << "Finds " << count->nGood_ << " good tracks in " << count->nAll_ << " events and " + << count->nRange_ << " events in the momentum range"; +} + +void AlCaHcalIsotrkProducer::beginRun(edm::Run const& iRun, edm::EventSetup const& iSetup) { + hdc_ = &iSetup.getData(tok_ddrec_); + if (!ignoreTrigger_) { + bool changed(false); + edm::LogVerbatim("HcalIsoTrack") << "Run[" << nRun_ << "] " << iRun.run() << " hltconfig.init " + << hltConfig_.init(iRun, iSetup, processName_, changed); + } +} + +void AlCaHcalIsotrkProducer::endRun(edm::Run const& iRun, edm::EventSetup const&) { + edm::LogVerbatim("HcalIsoTrack") << "endRun [" << nRun_ << "] " << iRun.run(); + ++nRun_; +} + +std::array AlCaHcalIsotrkProducer::getProducts(int goodPV, + double eventWeight, + std::vector& vecL1, + std::vector& vecL3, + math::XYZPoint& leadPV, + std::vector& trkCaloDirections, + std::vector& trkCaloDets, + const CaloGeometry* geo, + const CaloTopology* caloTopology, + const HcalTopology* theHBHETopology, + const EcalChannelStatus* theEcalChStatus, + const EcalSeverityLevelAlgo* theEcalSevlv, + edm::Handle& barrelRecHitsHandle, + edm::Handle& endcapRecHitsHandle, + edm::Handle& hbhe, + edm::Handle& tower, + const edm::Handle& genParticles, + const HcalRespCorrs* respCorrs, + const edm::Handle& muonh, + std::vector& hocalib, + HcalIsoTrkEventVariables& hocalibEvent) { + int nSave(0), nLoose(0), nTight(0); + unsigned int nTracks(0), nselTracks(0); + double rhohEV = (tower.isValid()) ? rhoh(tower) : 0; + + //Loop over tracks + std::vector::const_iterator trkDetItr; + for (trkDetItr = trkCaloDirections.begin(), nTracks = 0; trkDetItr != trkCaloDirections.end(); + trkDetItr++, nTracks++) { + const reco::Track* pTrack = &(*(trkDetItr->trkItr)); + math::XYZTLorentzVector v4(pTrack->px(), pTrack->py(), pTrack->pz(), pTrack->p()); + bool accept(false); + HcalIsoTrkCalibVariables isoTk; + isoTk.eventWeight_ = eventWeight; + isoTk.goodPV_ = goodPV; + isoTk.nVtx_ = hocalibEvent.allvertex_; + isoTk.nTrk_ = trkCaloDirections.size(); + isoTk.rhoh_ = rhohEV; + for (const auto& trig : hocalibEvent.hltbits_) + isoTk.trgbits_.emplace_back(trig); + if (!vecL1.empty()) { + isoTk.l1pt_ = vecL1[0].pt(); + isoTk.l1eta_ = vecL1[0].eta(); + isoTk.l1phi_ = vecL1[0].phi(); + } + if (!vecL3.empty()) { + isoTk.l3pt_ = vecL3[0].pt(); + isoTk.l3eta_ = vecL3[0].eta(); + isoTk.l3phi_ = vecL3[0].phi(); + } + + isoTk.p_ = pTrack->p(); + isoTk.pt_ = pTrack->pt(); + isoTk.phi_ = pTrack->phi(); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("HcalIsoTrack") << "This track : " << nTracks << " (pt|eta|phi|p) :" << isoTk.pt_ << "|" + << pTrack->eta() << "|" << isoTk.phi_ << "|" << isoTk.p_; + int flag(0); +#endif + isoTk.mindR2_ = 999; + for (unsigned int k = 0; k < vecL3.size(); ++k) { + double dr = dR(vecL3[k], v4); + if (dr < isoTk.mindR2_) { + isoTk.mindR2_ = dr; + } + } + isoTk.mindR1_ = (!vecL1.empty()) ? dR(vecL1[0], v4) : 999; +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("HcalIsoTrack") << "Closest L3 object at dr :" << isoTk.mindR2_ << " and from L1 " + << isoTk.mindR1_; +#endif + isoTk.ieta_ = isoTk.iphi_ = 0; + if (trkDetItr->okHCAL) { + HcalDetId detId = (HcalDetId)(trkDetItr->detIdHCAL); + isoTk.ieta_ = detId.ieta(); + isoTk.iphi_ = detId.iphi(); + if (isoTk.p_ > 40.0 && isoTk.p_ <= 60.0) + hocalibEvent.ietaAll_.emplace_back(isoTk.ieta_); + } + //Selection of good track + isoTk.selectTk_ = spr::goodTrack(pTrack, leadPV, selectionParameter_, false); + spr::trackSelectionParameters oneCutParameters = selectionParameter_; + oneCutParameters.maxDxyPV = 10; + oneCutParameters.maxDzPV = 100; + oneCutParameters.maxInMiss = 2; + oneCutParameters.maxOutMiss = 2; + bool qltyFlag = spr::goodTrack(pTrack, leadPV, oneCutParameters, false); + oneCutParameters = selectionParameter_; + oneCutParameters.maxDxyPV = 10; + oneCutParameters.maxDzPV = 100; + isoTk.qltyMissFlag_ = spr::goodTrack(pTrack, leadPV, oneCutParameters, false); + oneCutParameters = selectionParameter_; + oneCutParameters.maxInMiss = 2; + oneCutParameters.maxOutMiss = 2; + isoTk.qltyPVFlag_ = spr::goodTrack(pTrack, leadPV, oneCutParameters, false); + double eIsolation = maxRestrictionP_ * exp(slopeRestrictionP_ * std::abs((double)isoTk.ieta_)); + if (eIsolation < eIsolate1_) + eIsolation = eIsolate1_; + if (eIsolation < eIsolate2_) + eIsolation = eIsolate2_; +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("HcalIsoTrack") << "qltyFlag|okECAL|okHCAL : " << qltyFlag << "|" << trkDetItr->okECAL << "|" + << trkDetItr->okHCAL << " eIsolation " << eIsolation; + if (qltyFlag) + flag += 1; + if (trkDetItr->okECAL) + flag += 2; + if (trkDetItr->okHCAL) + flag += 4; +#endif + isoTk.qltyFlag_ = (qltyFlag && trkDetItr->okECAL && trkDetItr->okHCAL); + bool notMuon = (muonh.isValid()) ? notaMuon(pTrack, muonh) : true; +#ifdef EDM_ML_DEBUG + if (notMuon) + flag += 8; +#endif + if (isoTk.qltyFlag_ && notMuon) { + nselTracks++; + int nNearTRKs(0); + ////////////////////////////////-MIP STUFF-////////////////////////////// + std::vector eIds; + std::vector eHit; +#ifdef EDM_ML_DEBUG + double eMipDR = +#endif + spr::eCone_ecal(geo, + barrelRecHitsHandle, + endcapRecHitsHandle, + trkDetItr->pointHCAL, + trkDetItr->pointECAL, + a_mipR_, + trkDetItr->directionECAL, + eIds, + eHit); + double eEcal(0); + for (unsigned int k = 0; k < eIds.size(); ++k) { + if (eHit[k] > eThreshold(eIds[k], geo)) + eEcal += eHit[k]; + } +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("HcalIsoTrack") << "eMIP before and after: " << eMipDR << ":" << eEcal; +#endif + isoTk.eMipDR_.emplace_back(eEcal); + ////////////////////////////////-MIP STUFF-/////////////////////////////// + ////////////////////////////////-MIP STUFF-2////////////////////////////// + std::vector eIds2; + std::vector eHit2; +#ifdef EDM_ML_DEBUG + double eMipDR2 = +#endif + spr::eCone_ecal(geo, + barrelRecHitsHandle, + endcapRecHitsHandle, + trkDetItr->pointHCAL, + trkDetItr->pointECAL, + a_mipR2_, + trkDetItr->directionECAL, + eIds2, + eHit2); + double eEcal2(0); + for (unsigned int k = 0; k < eIds2.size(); ++k) { + if (eHit2[k] > eThreshold(eIds2[k], geo)) + eEcal2 += eHit2[k]; + } +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("HcalIsoTrack") << "eMIP before and after: " << eMipDR2 << ":" << eEcal2; +#endif + isoTk.eMipDR_.emplace_back(eEcal2); + ////////////////////////////////-MIP STUFF-2///////////////////////////// + ////////////////////////////////-MIP STUFF-3///////////////////////////// + std::vector eIds3; + std::vector eHit3; +#ifdef EDM_ML_DEBUG + double eMipDR3 = +#endif + spr::eCone_ecal(geo, + barrelRecHitsHandle, + endcapRecHitsHandle, + trkDetItr->pointHCAL, + trkDetItr->pointECAL, + a_mipR3_, + trkDetItr->directionECAL, + eIds3, + eHit3); + double eEcal3(0); + for (unsigned int k = 0; k < eIds3.size(); ++k) { + if (eHit3[k] > eThreshold(eIds3[k], geo)) + eEcal3 += eHit3[k]; + } +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("HcalIsoTrack") << "eMIP before and after: " << eMipDR3 << ":" << eEcal3; +#endif + isoTk.eMipDR_.emplace_back(eEcal3); + ////////////////////////////////-MIP STUFF-3///////////////////////////// + ////////////////////////////////-MIP STUFF-4///////////////////////////// + std::vector eIds4; + std::vector eHit4; +#ifdef EDM_ML_DEBUG + double eMipDR4 = +#endif + spr::eCone_ecal(geo, + barrelRecHitsHandle, + endcapRecHitsHandle, + trkDetItr->pointHCAL, + trkDetItr->pointECAL, + a_mipR4_, + trkDetItr->directionECAL, + eIds4, + eHit4); + double eEcal4(0); + for (unsigned int k = 0; k < eIds4.size(); ++k) { + if (eHit4[k] > eThreshold(eIds4[k], geo)) + eEcal4 += eHit4[k]; + } +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("HcalIsoTrack") << "eMIP before and after: " << eMipDR4 << ":" << eEcal4; +#endif + isoTk.eMipDR_.emplace_back(eEcal4); + ////////////////////////////////-MIP STUFF-4///////////////////////////// + ////////////////////////////////-MIP STUFF-5///////////////////////////// + std::vector eIds5; + std::vector eHit5; +#ifdef EDM_ML_DEBUG + double eMipDR5 = +#endif + spr::eCone_ecal(geo, + barrelRecHitsHandle, + endcapRecHitsHandle, + trkDetItr->pointHCAL, + trkDetItr->pointECAL, + a_mipR5_, + trkDetItr->directionECAL, + eIds5, + eHit5); + double eEcal5(0); + for (unsigned int k = 0; k < eIds5.size(); ++k) { + if (eHit5[k] > eThreshold(eIds5[k], geo)) + eEcal5 += eHit5[k]; + } +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("HcalIsoTrack") << "eMIP before and after: " << eMipDR5 << ":" << eEcal5; +#endif + isoTk.eMipDR_.emplace_back(eEcal5); + ////////////////////////////////-MIP STUFF-5///////////////////////////// + + isoTk.emaxNearP_ = spr::chargeIsolationEcal(nTracks, trkCaloDets, geo, caloTopology, 15, 15); + const DetId cellE(trkDetItr->detIdECAL); + std::pair e11x11P = spr::eECALmatrix(cellE, + barrelRecHitsHandle, + endcapRecHitsHandle, + *theEcalChStatus, + geo, + caloTopology, + theEcalSevlv, + 5, + 5, + -100.0, + -100.0, + -100.0, + 100.0); + std::pair e15x15P = spr::eECALmatrix(cellE, + barrelRecHitsHandle, + endcapRecHitsHandle, + *theEcalChStatus, + geo, + caloTopology, + theEcalSevlv, + 7, + 7, + -100.0, + -100.0, + -100.0, + 100.0); + if (e11x11P.second && e15x15P.second) { + isoTk.eAnnular_ = (e15x15P.first - e11x11P.first); + } else { + isoTk.eAnnular_ = -(e15x15P.first - e11x11P.first); + } + isoTk.hmaxNearP_ = spr::chargeIsolationCone(nTracks, trkCaloDirections, a_charIsoR_, nNearTRKs, false); + const DetId cellH(trkDetItr->detIdHCAL); + double h5x5 = spr::eHCALmatrix( + theHBHETopology, cellH, hbhe, 2, 2, false, true, -100.0, -100.0, -100.0, -100.0, -100.0, 100.0); + double h7x7 = spr::eHCALmatrix( + theHBHETopology, cellH, hbhe, 3, 3, false, true, -100.0, -100.0, -100.0, -100.0, -100.0, 100.0); + isoTk.hAnnular_ = h7x7 - h5x5; +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("HcalIsoTrack") << "max p Near (Ecal) " << isoTk.emaxNearP_ << " (Hcal) " << isoTk.hmaxNearP_ + << " Annular E (Ecal) " << e11x11P.first << ":" << e15x15P.first << ":" + << isoTk.eAnnular_ << " (Hcal) " << h5x5 << ":" << h7x7 << ":" + << isoTk.hAnnular_; + if (isoTk.eMipDR_[0] < eEcalMax_) + flag += 16; + if (isoTk.hmaxNearP_ < eIsolation) + flag += 32; +#endif + isoTk.gentrackP_ = trackP(pTrack, genParticles); + if (isoTk.eMipDR_[0] < eEcalMax_ && isoTk.hmaxNearP_ < eIsolation) { + int nRecHits(-999), nRecHits1(-999), nRecHits3(-999); + std::vector ids, ids1, ids3; + std::vector edet0, edet1, edet3; + isoTk.eHcal_ = spr::eCone_hcal(geo, + hbhe, + trkDetItr->pointHCAL, + trkDetItr->pointECAL, + a_coneR_, + trkDetItr->directionHCAL, + nRecHits, + ids, + edet0, + 0); + if (!oldID_.empty()) { + for (unsigned k = 0; k < ids.size(); ++k) + ids[k] = newId(ids[k]); + } + storeEnergy(respCorrs, ids, edet0, isoTk.eHcal_, isoTk.detIds_, isoTk.hitEnergies_); + std::pair ehcal0 = + storeEnergy(respCorrs, hbhe, ids, isoTk.hitEnergiesRaw_, isoTk.hitEnergiesAux_); + isoTk.eHcalRaw_ = ehcal0.first; + isoTk.eHcalAux_ = ehcal0.second; + + //----- hcal energy in the extended cone 1 (a_coneR+10) -------------- + isoTk.eHcal10_ = spr::eCone_hcal(geo, + hbhe, + trkDetItr->pointHCAL, + trkDetItr->pointECAL, + a_coneR1_, + trkDetItr->directionHCAL, + nRecHits1, + ids1, + edet1, + 0); + if (!oldID_.empty()) { + for (unsigned k = 0; k < ids1.size(); ++k) + ids1[k] = newId(ids1[k]); + } + storeEnergy(respCorrs, ids1, edet1, isoTk.eHcal10_, isoTk.detIds1_, isoTk.hitEnergies1_); + std::pair ehcal1 = + storeEnergy(respCorrs, hbhe, ids1, isoTk.hitEnergies1Raw_, isoTk.hitEnergies1Aux_); + isoTk.eHcal10Raw_ = ehcal1.first; + isoTk.eHcal10Aux_ = ehcal1.second; + + //----- hcal energy in the extended cone 3 (a_coneR+30) -------------- + isoTk.eHcal30_ = spr::eCone_hcal(geo, + hbhe, + trkDetItr->pointHCAL, + trkDetItr->pointECAL, + a_coneR2_, + trkDetItr->directionHCAL, + nRecHits3, + ids3, + edet3, + 0); + if (!oldID_.empty()) { + for (unsigned k = 0; k < ids3.size(); ++k) + ids3[k] = newId(ids3[k]); + } + storeEnergy(respCorrs, ids3, edet3, isoTk.eHcal30_, isoTk.detIds3_, isoTk.hitEnergies3_); + std::pair ehcal3 = + storeEnergy(respCorrs, hbhe, ids3, isoTk.hitEnergies3Raw_, isoTk.hitEnergies3Aux_); + isoTk.eHcal30Raw_ = ehcal3.first; + isoTk.eHcal30Aux_ = ehcal3.second; + +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("HcalIsoTrack") << "This track : " << nTracks << " (pt|eta|phi|p) :" << isoTk.pt_ << "|" + << pTrack->eta() << "|" << isoTk.phi_ << "|" << isoTk.p_ + << " Generator Level p " << isoTk.gentrackP_; + edm::LogVerbatim("HcalIsoTrack") << "e_MIP " << isoTk.eMipDR_[0] << " Chg Isolation " << isoTk.hmaxNearP_ + << " eHcal" << isoTk.eHcal_ << ":" << isoTk.eHcalRaw_ << ":" << isoTk.eHcalAux_ + << " ieta " << isoTk.ieta_ << " Quality " << isoTk.qltyMissFlag_ << ":" + << isoTk.qltyPVFlag_ << ":" << isoTk.selectTk_; + for (unsigned int ll = 0; ll < isoTk.detIds_.size(); ll++) { + edm::LogVerbatim("HcalIsoTrack") + << "det id is = " << HcalDetId(isoTk.detIds_[ll]) << " hit enery is = " << isoTk.hitEnergies_[ll] + << " : " << isoTk.hitEnergiesRaw_[ll] << " : " << isoTk.hitEnergiesAux_[ll]; + } + for (unsigned int ll = 0; ll < isoTk.detIds1_.size(); ll++) { + edm::LogVerbatim("HcalIsoTrack") + << "det id is = " << HcalDetId(isoTk.detIds1_[ll]) << " hit enery is = " << isoTk.hitEnergies1_[ll] + << " : " << isoTk.hitEnergies1Raw_[ll] << " : " << isoTk.hitEnergies1Aux_[ll]; + ; + } + for (unsigned int ll = 0; ll < isoTk.detIds3_.size(); ll++) { + edm::LogVerbatim("HcalIsoTrack") + << "det id is = " << HcalDetId(isoTk.detIds3_[ll]) << " hit enery is = " << isoTk.hitEnergies3_[ll] + << " : " << isoTk.hitEnergies3Raw_[ll] << " : " << isoTk.hitEnergies3Aux_[ll]; + ; + } + if (isoTk.p_ > pTrackMin_) + flag += 64; +#endif + if (isoTk.p_ > pTrackMin_) + accept = true; + if (accept) { + hocalib.emplace_back(isoTk); + nSave++; + int type(0); + if (isoTk.eMipDR_[0] < 1.0) { + if (isoTk.hmaxNearP_ < eIsolate2_) { + ++nLoose; + type = 1; + } + if (isoTk.hmaxNearP_ < eIsolate1_) { + ++nTight; + type = 2; + } + } + if (isoTk.p_ > 40.0 && isoTk.p_ <= 60.0 && isoTk.selectTk_) { + hocalibEvent.ietaGood_.emplace_back(isoTk.ieta_); + hocalibEvent.trackType_.emplace_back(type); + } +#ifdef EDM_ML_DEBUG + for (unsigned int k = 0; k < isoTk.trgbits_.size(); k++) { + edm::LogVerbatim("HcalIsoTrack") << "trigger bit is = " << isoTk.trgbits_[k]; + } +#endif + } + } + } +#ifdef EDM_ML_DEBUG + if (isoTk.eMipDR_.empty()) + edm::LogVerbatim("HcalIsoTrack") << "Track " << nTracks << " Selection Flag " << std::hex << flag << std::dec + << " Accept " << accept << " Momentum " << isoTk.p_ << ":" << pTrackMin_; + else + edm::LogVerbatim("HcalIsoTrack") << "Track " << nTracks << " Selection Flag " << std::hex << flag << std::dec + << " Accept " << accept << " Momentum " << isoTk.p_ << ":" << pTrackMin_ + << " Ecal Energy " << isoTk.eMipDR_[0] << ":" << eEcalMax_ + << " Charge Isolation " << isoTk.hmaxNearP_ << ":" << eIsolation; +#endif + } + std::array i3{{nSave, nLoose, nTight}}; + return i3; +} + +double AlCaHcalIsotrkProducer::dR(math::XYZTLorentzVector& vec1, math::XYZTLorentzVector& vec2) { + return reco::deltaR(vec1.eta(), vec1.phi(), vec2.eta(), vec2.phi()); +} + +double AlCaHcalIsotrkProducer::trackP(const reco::Track* pTrack, + const edm::Handle& genParticles) { + double pmom = -1.0; + if (genParticles.isValid()) { + double mindR(999.9); + for (const auto& p : (*genParticles)) { + double dR = reco::deltaR(pTrack->eta(), pTrack->phi(), p.momentum().Eta(), p.momentum().Phi()); + if (dR < mindR) { + mindR = dR; + pmom = p.momentum().R(); + } + } + } + return pmom; +} + +double AlCaHcalIsotrkProducer::rhoh(const edm::Handle& tower) { + std::vector sumPFNallSMDQH2; + sumPFNallSMDQH2.reserve(phibins_.size() * etabins_.size()); + for (auto eta : etabins_) { + for (auto phi : phibins_) { + double hadder = 0; + for (const auto& pf_it : (*tower)) { + if (fabs(eta - pf_it.eta()) > etahalfdist_) + continue; + if (fabs(reco::deltaPhi(phi, pf_it.phi())) > phihalfdist_) + continue; + hadder += pf_it.hadEt(); + } + sumPFNallSMDQH2.emplace_back(hadder); + } + } + + double evt_smdq(0); + std::sort(sumPFNallSMDQH2.begin(), sumPFNallSMDQH2.end()); + if (sumPFNallSMDQH2.size() % 2) + evt_smdq = sumPFNallSMDQH2[(sumPFNallSMDQH2.size() - 1) / 2]; + else + evt_smdq = (sumPFNallSMDQH2[sumPFNallSMDQH2.size() / 2] + sumPFNallSMDQH2[(sumPFNallSMDQH2.size() - 2) / 2]) / 2.; + double rhoh = evt_smdq / (etadist_ * phidist_); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("HcalIsoTrack") << "Rho " << evt_smdq << ":" << rhoh; +#endif + return rhoh; +} + +double AlCaHcalIsotrkProducer::eThreshold(const DetId& id, const CaloGeometry* geo) const { + const GlobalPoint& pos = geo->getPosition(id); + double eta = std::abs(pos.eta()); + 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; +} + +DetId AlCaHcalIsotrkProducer::newId(const DetId& id) { + HcalDetId hid(id); + if (hep17_ && ((hid.iphi() < 63) || (hid.iphi() > 66) || (hid.zside() < 0))) + return id; + for (unsigned int k = 0; k < oldID_.size(); ++k) { + if ((hid.subdetId() == oldDet_[k]) && (hid.ietaAbs() == oldEta_[k]) && (hid.depth() == oldDepth_[k])) { + return static_cast(HcalDetId(hid.subdet(), hid.ieta(), hid.iphi(), newDepth_[k])); + } + } + return id; +} + +void AlCaHcalIsotrkProducer::storeEnergy(const HcalRespCorrs* respCorrs, + const std::vector& ids, + std::vector& edet, + double& eHcal, + std::vector& detIds, + std::vector& hitEnergies) { + double ehcal(0); + if (unCorrect_) { + for (unsigned int k = 0; k < ids.size(); ++k) { + double corr = (respCorrs->getValues(ids[k]))->getValue(); + if (corr != 0) + edet[k] /= corr; + ehcal += edet[k]; + } + } else { + for (const auto& en : edet) + ehcal += en; + } + if ((std::abs(ehcal - eHcal) > 0.001) && (!unCorrect_)) + edm::LogWarning("HcalIsoTrack") << "Check inconsistent energies: " << eHcal << ":" << ehcal << " from " + << ids.size() << " cells"; + eHcal = hcalScale_ * ehcal; + + if (collapseDepth_) { + std::map hitMap; + for (unsigned int k = 0; k < ids.size(); ++k) { + HcalDetId id = hdc_->mergedDepthDetId(HcalDetId(ids[k])); + auto itr = hitMap.find(id); + if (itr == hitMap.end()) { + hitMap[id] = edet[k]; + } else { + (itr->second) += edet[k]; + } + } + detIds.reserve(hitMap.size()); + hitEnergies.reserve(hitMap.size()); + for (const auto& hit : hitMap) { + detIds.emplace_back(hit.first.rawId()); + hitEnergies.emplace_back(hit.second); + } + } else { + detIds.reserve(ids.size()); + hitEnergies.reserve(ids.size()); + for (unsigned int k = 0; k < ids.size(); ++k) { + detIds.emplace_back(ids[k].rawId()); + hitEnergies.emplace_back(edet[k]); + } + } +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("HcalIsoTrack") << "StoreEnergy1::Input to storeEnergy with " << ids.size() << " cells"; + for (unsigned int k = 0; k < ids.size(); ++k) + edm::LogVerbatim("HcalIsoTrack") << "Hit [" << k << "] " << HcalDetId(ids[k]) << " E " << edet[k]; + edm::LogVerbatim("HcalIsoTrack") << "StoreEnergy1::Output of storeEnergy with " << detIds.size() << " cells and Etot " + << eHcal; + for (unsigned int k = 0; k < detIds.size(); ++k) + edm::LogVerbatim("HcalIsoTrack") << "Hit [" << k << "] " << HcalDetId(detIds[k]) << " E " << hitEnergies[k]; +#endif +} + +std::pair AlCaHcalIsotrkProducer::storeEnergy(const HcalRespCorrs* respCorrs, + edm::Handle& hbhe, + const std::vector& ids, + std::vector& hitEnergy1, + std::vector& hitEnergy2) { + double ehcal1(0), ehcal2(0); + std::vector edet1, edet2; + for (unsigned int k = 0; k < ids.size(); ++k) { + double e1(0), e2(0); + for (auto itr = hbhe->begin(); itr != hbhe->end(); ++itr) { + if (itr->id() == ids[k]) { + e1 = itr->eraw(); + e2 = itr->eaux(); + break; + } + } + if (e1 < 1.e-10) + e1 = 0; + if (e2 < 1.e-10) + e2 = 0; + edet1.emplace_back(e1); + edet2.emplace_back(e2); + } + if (unCorrect_) { + for (unsigned int k = 0; k < ids.size(); ++k) { + double corr = (respCorrs->getValues(ids[k]))->getValue(); + if (corr != 0) { + edet1[k] /= corr; + edet2[k] /= corr; + } + } + } + for (unsigned int k = 0; k < ids.size(); ++k) { + ehcal1 += edet1[k]; + ehcal2 += edet2[k]; + } + ehcal1 *= hcalScale_; + ehcal2 *= hcalScale_; + + if (collapseDepth_) { + std::map > hitMap; + for (unsigned int k = 0; k < ids.size(); ++k) { + HcalDetId id = hdc_->mergedDepthDetId(HcalDetId(ids[k])); + auto itr = hitMap.find(id); + if (itr == hitMap.end()) { + hitMap[id] = std::make_pair(edet1[k], edet2[k]); + } else { + (itr->second).first += edet1[k]; + (itr->second).second += edet2[k]; + } + } + hitEnergy1.reserve(hitMap.size()); + hitEnergy2.reserve(hitMap.size()); + for (const auto& hit : hitMap) { + hitEnergy1.emplace_back(hit.second.first); + hitEnergy2.emplace_back(hit.second.second); + } + } else { + hitEnergy1.reserve(ids.size()); + hitEnergy2.reserve(ids.size()); + for (unsigned int k = 0; k < ids.size(); ++k) { + hitEnergy1.emplace_back(edet1[k]); + hitEnergy2.emplace_back(edet2[k]); + } + } +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("HcalIsoTrack") << "StoreEnergy2::Input to storeEnergy with " << ids.size() << " cells"; + edm::LogVerbatim("HcalIsoTrack") << "StoreEnergy2::Output of storeEnergy with " << hitEnergy1.size() + << " cells and Etot " << ehcal1 << ":" << ehcal2; + for (unsigned int k = 0; k < hitEnergy1.size(); ++k) + edm::LogVerbatim("HcalIsoTrack") << "Hit [" << k << "] " << hitEnergy1[k] << " : " << hitEnergy2[k]; +#endif + return std::make_pair(ehcal1, ehcal2); +} + +bool AlCaHcalIsotrkProducer::notaMuon(const reco::Track* pTrack0, const edm::Handle& muonh) { + bool flag(true); + for (reco::MuonCollection::const_iterator recMuon = muonh->begin(); recMuon != muonh->end(); ++recMuon) { + if (recMuon->innerTrack().isNonnull()) { + const reco::Track* pTrack = (recMuon->innerTrack()).get(); + bool mediumMuon = (((recMuon->isPFMuon()) && (recMuon->isGlobalMuon() || recMuon->isTrackerMuon())) && + (recMuon->innerTrack()->validFraction() > 0.49)); + if (mediumMuon) { + double chiGlobal = ((recMuon->globalTrack().isNonnull()) ? recMuon->globalTrack()->normalizedChi2() : 999); + bool goodGlob = (recMuon->isGlobalMuon() && chiGlobal < 3 && + recMuon->combinedQuality().chi2LocalPosition < 12 && recMuon->combinedQuality().trkKink < 20); + mediumMuon = muon::segmentCompatibility(*recMuon) > (goodGlob ? 0.303 : 0.451); + } + if (mediumMuon) { + double dR = reco::deltaR(pTrack->eta(), pTrack->phi(), pTrack0->eta(), pTrack0->phi()); + if (dR < 0.1) { + flag = false; + break; + } + } + } + } + return flag; +} + +#include "FWCore/Framework/interface/MakerMacros.h" + +DEFINE_FWK_MODULE(AlCaHcalIsotrkProducer); diff --git a/Calibration/HcalAlCaRecoProducers/src/AlCaHcalNoiseProducer.cc b/Calibration/HcalAlCaRecoProducers/plugins/AlCaHcalNoiseProducer.cc similarity index 64% rename from Calibration/HcalAlCaRecoProducers/src/AlCaHcalNoiseProducer.cc rename to Calibration/HcalAlCaRecoProducers/plugins/AlCaHcalNoiseProducer.cc index 294aa251650f3..90fffde806289 100644 --- a/Calibration/HcalAlCaRecoProducers/src/AlCaHcalNoiseProducer.cc +++ b/Calibration/HcalAlCaRecoProducers/plugins/AlCaHcalNoiseProducer.cc @@ -8,19 +8,85 @@ Calibration/HcalIsolatedTrackReco/src/SubdetFEDSelector.cc */ -#include "Calibration/HcalAlCaRecoProducers/interface/AlCaHcalNoiseProducer.h" +// -*- C++ -*- + +// system include files +#include +#include +// user include files + +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/one/EDProducer.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" -#include "DataFormats/FEDRawData/interface/FEDRawData.h" -#include "DataFormats/FEDRawData/interface/FEDNumbering.h" +#include "DataFormats/Common/interface/Ref.h" +#include "DataFormats/CaloTowers/interface/CaloTowerCollection.h" +#include "DataFormats/DetId/interface/DetId.h" -#include "EventFilter/RawDataCollector/interface/RawDataFEDSelector.h" +#include "DataFormats/GeometryVector/interface/GlobalPoint.h" +#include "DataFormats/CaloTowers/interface/CaloTowerDetId.h" +#include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h" +#include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" #include "DataFormats/CaloTowers/interface/CaloTower.h" +#include "DataFormats/CaloTowers/interface/CaloTowerCollection.h" +#include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" #include "DataFormats/JetReco/interface/CaloJet.h" -#include "DataFormats/METReco/interface/CaloMET.h" +#include "DataFormats/JetReco/interface/CaloJetCollection.h" #include "DataFormats/Math/interface/deltaR.h" +#include "DataFormats/METReco/interface/CaloMET.h" +#include "DataFormats/METReco/interface/CaloMETCollection.h" -#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "DataFormats/FEDRawData/interface/FEDRawData.h" +#include "DataFormats/FEDRawData/interface/FEDNumbering.h" +#include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h" + +#include "EventFilter/RawDataCollector/interface/RawDataFEDSelector.h" +#include "Geometry/Records/interface/IdealGeometryRecord.h" +#include "Geometry/CaloGeometry/interface/CaloGeometry.h" + +// +// class decleration +// + +class AlCaHcalNoiseProducer : public edm::one::EDProducer<> { +public: + explicit AlCaHcalNoiseProducer(const edm::ParameterSet&); + ~AlCaHcalNoiseProducer() override = default; + + void produce(edm::Event&, const edm::EventSetup&) override; + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + +private: + // ----------member data --------------------------- + + bool useMet_; + bool useJet_; + double MetCut_; + double JetMinE_; + double JetHCALminEnergyFraction_; + int nAnomalousEvents; + int nEvents; + + std::vector ecalLabels_; + + edm::EDGetTokenT tok_jets_; + edm::EDGetTokenT tok_met_; + edm::EDGetTokenT tok_tower_; + + edm::EDGetTokenT tok_hbhe_; + edm::EDGetTokenT tok_ho_; + edm::EDGetTokenT tok_hf_; + + edm::EDGetTokenT tok_ps_; + edm::EDGetTokenT tok_raw_; + std::vector> toks_ecal_; +}; AlCaHcalNoiseProducer::AlCaHcalNoiseProducer(const edm::ParameterSet& iConfig) { tok_jets_ = consumes(iConfig.getParameter("JetSource")); @@ -35,7 +101,7 @@ AlCaHcalNoiseProducer::AlCaHcalNoiseProducer(const edm::ParameterSet& iConfig) { tok_ho_ = consumes(iConfig.getParameter("hoInput")); tok_hf_ = consumes(iConfig.getParameter("hfInput")); tok_hbhe_ = consumes(iConfig.getParameter("hbheInput")); - ecalLabels_ = iConfig.getParameter >("ecalInputs"); + ecalLabels_ = iConfig.getParameter>("ecalInputs"); tok_ps_ = consumes(iConfig.getParameter("ecalPSInput")); tok_raw_ = consumes(iConfig.getParameter("rawInput")); @@ -54,8 +120,6 @@ AlCaHcalNoiseProducer::AlCaHcalNoiseProducer(const edm::ParameterSet& iConfig) { produces("HcalFEDsFHN"); } -AlCaHcalNoiseProducer::~AlCaHcalNoiseProducer() {} - // ------------ method called to produce the data ------------ void AlCaHcalNoiseProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { bool acceptEvent = false; @@ -66,8 +130,7 @@ void AlCaHcalNoiseProducer::produce(edm::Event& iEvent, const edm::EventSetup& i bool isAnomalous_BasedOnEnergyFraction = false; if (useMet_) { - edm::Handle metHandle; - iEvent.getByToken(tok_met_, metHandle); + edm::Handle metHandle = iEvent.getHandle(tok_met_); const reco::CaloMETCollection* metCol = metHandle.product(); const reco::CaloMET met = metCol->front(); @@ -76,11 +139,8 @@ void AlCaHcalNoiseProducer::produce(edm::Event& iEvent, const edm::EventSetup& i } if (useJet_) { - edm::Handle calojetHandle; - iEvent.getByToken(tok_jets_, calojetHandle); - - edm::Handle towerHandle; - iEvent.getByToken(tok_tower_, towerHandle); + edm::Handle calojetHandle = iEvent.getHandle(tok_jets_); + edm::Handle towerHandle = iEvent.getHandle(tok_tower_); std::vector TowerContainer; std::vector JetContainer; @@ -128,25 +188,19 @@ void AlCaHcalNoiseProducer::produce(edm::Event& iEvent, const edm::EventSetup& i // if good event get and save all colletions if (acceptEvent) { - edm::Handle hbhe; - edm::Handle ho; - edm::Handle hf; - - iEvent.getByToken(tok_hbhe_, hbhe); - iEvent.getByToken(tok_ho_, ho); - iEvent.getByToken(tok_hf_, hf); + edm::Handle hbhe = iEvent.getHandle(tok_hbhe_); + edm::Handle ho = iEvent.getHandle(tok_ho_); + edm::Handle hf = iEvent.getHandle(tok_hf_); - edm::Handle pRecHits; - iEvent.getByToken(tok_ps_, pRecHits); + edm::Handle pRecHits = iEvent.getHandle(tok_ps_); // temporary collection of EB+EE recHits auto tmpEcalRecHitCollection = std::make_unique(); - std::vector >::const_iterator i; + std::vector>::const_iterator i; for (i = toks_ecal_.begin(); i != toks_ecal_.end(); i++) { - edm::Handle ec; - iEvent.getByToken(*i, ec); + edm::Handle ec = iEvent.getHandle(*i); for (EcalRecHitCollection::const_iterator recHit = (*ec).begin(); recHit != (*ec).end(); ++recHit) { tmpEcalRecHitCollection->push_back(*recHit); } @@ -186,8 +240,7 @@ void AlCaHcalNoiseProducer::produce(edm::Event& iEvent, const edm::EventSetup& i } // get HCAL FEDs - edm::Handle rawIn; - iEvent.getByToken(tok_raw_, rawIn); + edm::Handle rawIn = iEvent.getHandle(tok_raw_); std::vector selFEDs; for (int i = FEDNumbering::MINHCALFEDID; i <= FEDNumbering::MAXHCALFEDID; i++) { @@ -240,3 +293,28 @@ void AlCaHcalNoiseProducer::produce(edm::Event& iEvent, const edm::EventSetup& i iEvent.put(std::move(outputESColl), "PSEcalRecHitCollectionFHN"); iEvent.put(std::move(outputFEDs), "HcalFEDsFHN"); } + +void AlCaHcalNoiseProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + desc.add("JetSource", edm::InputTag("iterativeCone5CaloJets")); + desc.add("MetSource", edm::InputTag("met")); + desc.add("TowerSource", edm::InputTag("towerMaker")); + desc.add("UseJet", true); + desc.add("UseMET", false); + desc.add("MetCut", 0); + desc.add("JetMinE", 20); + desc.add("JetHCALminEnergyFraction", 0.98); + desc.add("hbheInput", edm::InputTag("hbhereco")); + desc.add("hfInput", edm::InputTag("hfreco")); + desc.add("hoInput", edm::InputTag("horeco")); + std::vector inputs = {edm::InputTag("ecalRecHit", "EcalRecHitsEB"), + edm::InputTag("ecalRecHit", "EcalRecHitsEE")}; + desc.add>("ecalInputs", inputs); + desc.add("ecalPSInput", edm::InputTag("ecalPreshowerRecHit", "EcalRecHitsES")); + desc.add("rawInput", edm::InputTag("rawDataCollector")); + descriptions.add("alcaHcalNoiseProducer", desc); +} + +#include "FWCore/Framework/interface/MakerMacros.h" + +DEFINE_FWK_MODULE(AlCaHcalNoiseProducer); diff --git a/Calibration/HcalAlCaRecoProducers/plugins/AlCaIsoTracksFilter.cc b/Calibration/HcalAlCaRecoProducers/plugins/AlCaIsoTracksFilter.cc index c3a8ea75e6c5f..40764d9d2aec2 100644 --- a/Calibration/HcalAlCaRecoProducers/plugins/AlCaIsoTracksFilter.cc +++ b/Calibration/HcalAlCaRecoProducers/plugins/AlCaIsoTracksFilter.cc @@ -53,6 +53,7 @@ #include "RecoLocalCalo/EcalRecAlgos/interface/EcalSeverityLevelAlgo.h" #include "RecoLocalCalo/EcalRecAlgos/interface/EcalSeverityLevelAlgoRcd.h" +//#define EDM_ML_DEBUG // // class declaration // @@ -236,16 +237,14 @@ bool AlCaIsoTracksFilter::filter(edm::Event& iEvent, edm::EventSetup const& iSet triggerSatisfied = true; } else { trigger::TriggerEvent triggerEvent; - edm::Handle triggerEventHandle; - iEvent.getByToken(tok_trigEvt_, triggerEventHandle); + auto const& triggerEventHandle = iEvent.getHandle(tok_trigEvt_); if (!triggerEventHandle.isValid()) { edm::LogWarning("HcalIsoTrack") << "Error! Can't get the product " << triggerEvent_.label(); } else { triggerEvent = *(triggerEventHandle.product()); /////////////////////////////TriggerResults - edm::Handle triggerResults; - iEvent.getByToken(tok_trigRes_, triggerResults); + auto const& triggerResults = iEvent.getHandle(tok_trigRes_); if (triggerResults.isValid()) { std::vector modules; const edm::TriggerNames& triggerNames = iEvent.triggerNames(*triggerResults); @@ -266,6 +265,9 @@ bool AlCaIsoTracksFilter::filter(edm::Event& iEvent, edm::EventSetup const& iSet } } } +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("HcalIsoTrack") << "AlCaIsoTracksFilter:: triggerSatisfied: " << triggerSatisfied; +#endif //Step2: Get geometry/B-field information if (triggerSatisfied) { @@ -276,18 +278,15 @@ bool AlCaIsoTracksFilter::filter(edm::Event& iEvent, edm::EventSetup const& iSet //Also relevant information to extrapolate tracks to Hcal surface bool foundCollections(true); //Get track collection - edm::Handle trkCollection; - iEvent.getByToken(tok_genTrack_, trkCollection); + auto trkCollection = iEvent.getHandle(tok_genTrack_); if (!trkCollection.isValid()) { edm::LogWarning("HcalIsoTrack") << "Cannot access the collection " << labelGenTrack_; foundCollections = false; } //Define the best vertex and the beamspot - edm::Handle recVtxs; - iEvent.getByToken(tok_recVtx_, recVtxs); - edm::Handle beamSpotH; - iEvent.getByToken(tok_bs_, beamSpotH); + auto const& recVtxs = iEvent.getHandle(tok_recVtx_); + auto const& beamSpotH = iEvent.getHandle(tok_bs_); math::XYZPoint leadPV(0, 0, 0); if (!recVtxs->empty() && !((*recVtxs)[0].isFake())) { leadPV = math::XYZPoint((*recVtxs)[0].x(), (*recVtxs)[0].y(), (*recVtxs)[0].z()); @@ -297,24 +296,24 @@ bool AlCaIsoTracksFilter::filter(edm::Event& iEvent, edm::EventSetup const& iSet edm::LogVerbatim("HcalIsoTrack") << "Primary Vertex " << leadPV; // RecHits - edm::Handle barrelRecHitsHandle; - iEvent.getByToken(tok_EB_, barrelRecHitsHandle); + auto barrelRecHitsHandle = iEvent.getHandle(tok_EB_); if (!barrelRecHitsHandle.isValid()) { edm::LogWarning("HcalIsoTrack") << "Cannot access the collection " << labelEB_; foundCollections = false; } - edm::Handle endcapRecHitsHandle; - iEvent.getByToken(tok_EE_, endcapRecHitsHandle); + auto endcapRecHitsHandle = iEvent.getHandle(tok_EE_); if (!endcapRecHitsHandle.isValid()) { edm::LogWarning("HcalIsoTrack") << "Cannot access the collection " << labelEE_; foundCollections = false; } - edm::Handle hbhe; - iEvent.getByToken(tok_hbhe_, hbhe); + auto hbhe = iEvent.getHandle(tok_hbhe_); if (!hbhe.isValid()) { edm::LogWarning("HcalIsoTrack") << "Cannot access the collection " << labelHBHE_; foundCollections = false; } +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("HcalIsoTrack") << "AlCaIsoTracksFilter:: foundCollections: " << foundCollections; +#endif //Step3 propagate the tracks to calorimeter surface and find // candidates for isolated tracks @@ -324,14 +323,20 @@ bool AlCaIsoTracksFilter::filter(edm::Event& iEvent, edm::EventSetup const& iSet spr::propagateCALO(trkCollection, geo, bField, theTrackQuality_, trkCaloDirections, false); std::vector::const_iterator trkDetItr; +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("HcalIsoTrack") << "AlCaIsoTracksFilter:: Has " << trkCaloDirections.size() + << " propagated tracks from a total of " << trkCollection->size(); +#endif unsigned int nTracks(0), nselTracks(0), ntrin(0), ntrout(0), ntrH(0); for (trkDetItr = trkCaloDirections.begin(), nTracks = 0; trkDetItr != trkCaloDirections.end(); trkDetItr++, nTracks++) { const reco::Track* pTrack = &(*(trkDetItr->trkItr)); math::XYZTLorentzVector v4(pTrack->px(), pTrack->py(), pTrack->pz(), pTrack->p()); +#ifdef EDM_ML_DEBUG edm::LogVerbatim("HcalIsoTrack") << "This track : " << nTracks << " (pt|eta|phi|p) :" << pTrack->pt() << "|" - << pTrack->eta() << "|" << pTrack->phi() << "|" << pTrack->p(); - + << pTrack->eta() << "|" << pTrack->phi() << "|" << pTrack->p() << " OK HCAL " + << trkDetItr->okHCAL; +#endif //Selection of good track int ieta(0); if (trkDetItr->okHCAL) { @@ -339,23 +344,28 @@ bool AlCaIsoTracksFilter::filter(edm::Event& iEvent, edm::EventSetup const& iSet ieta = detId.ietaAbs(); } bool qltyFlag = spr::goodTrack(pTrack, leadPV, selectionParameter_, false); +#ifdef EDM_ML_DEBUG edm::LogVerbatim("HcalIsoTrack") << "qltyFlag|okECAL|okHCAL : " << qltyFlag << "|" << trkDetItr->okECAL << "|" << trkDetItr->okHCAL; +#endif if (qltyFlag && trkDetItr->okECAL && trkDetItr->okHCAL) { double t_p = pTrack->p(); nselTracks++; int nNearTRKs(0); std::vector eIds; std::vector eHit; - double eEcal = spr::eCone_ecal(geo, - barrelRecHitsHandle, - endcapRecHitsHandle, - trkDetItr->pointHCAL, - trkDetItr->pointECAL, - a_mipR_, - trkDetItr->directionECAL, - eIds, - eHit); +#ifdef EDM_ML_DEBUG + double eEcal = +#endif + spr::eCone_ecal(geo, + barrelRecHitsHandle, + endcapRecHitsHandle, + trkDetItr->pointHCAL, + trkDetItr->pointECAL, + a_mipR_, + trkDetItr->directionECAL, + eIds, + eHit); double eMipDR(0); for (unsigned int k = 0; k < eIds.size(); ++k) { const GlobalPoint& pos = geo->getPosition(eIds[k]); @@ -375,9 +385,11 @@ bool AlCaIsoTracksFilter::filter(edm::Event& iEvent, edm::EventSetup const& iSet double eIsolation = (maxRestrictionP_ * exp(slopeRestrictionP_ * ((double)(ieta)))); if (eIsolation < eIsolate_) eIsolation = eIsolate_; +#ifdef EDM_ML_DEBUG edm::LogVerbatim("HcalIsoTrack") << "This track : " << nTracks << " (pt|eta|phi|p) :" << pTrack->pt() << "|" << pTrack->eta() << "|" << pTrack->phi() << "|" << t_p << "e_MIP " << eMipDR << ":" << eEcal << " Chg Isolation " << hmaxNearP << ":" << eIsolation; +#endif if (t_p > pTrackMin_ && eMipDR < eEcalMax_ && hmaxNearP < eIsolation) { if (t_p > pTrackLow_ && t_p < pTrackHigh_) ntrin++; diff --git a/Calibration/HcalAlCaRecoProducers/src/AlCaIsoTracksProducer.cc b/Calibration/HcalAlCaRecoProducers/plugins/AlCaIsoTracksProducer.cc similarity index 96% rename from Calibration/HcalAlCaRecoProducers/src/AlCaIsoTracksProducer.cc rename to Calibration/HcalAlCaRecoProducers/plugins/AlCaIsoTracksProducer.cc index 1bf027d6c1cfc..32c86fbd9cf33 100644 --- a/Calibration/HcalAlCaRecoProducers/src/AlCaIsoTracksProducer.cc +++ b/Calibration/HcalAlCaRecoProducers/plugins/AlCaIsoTracksProducer.cc @@ -71,6 +71,7 @@ #include "RecoLocalCalo/EcalRecAlgos/interface/EcalSeverityLevelAlgo.h" #include "RecoLocalCalo/EcalRecAlgos/interface/EcalSeverityLevelAlgoRcd.h" +//#define EDM_ML_DEBUG // // class declaration // @@ -99,7 +100,7 @@ class AlCaIsoTracksProducer : public edm::stream::EDProducer& triggerResults, + reco::HcalIsolatedTrackCandidateCollection* select(edm::Handle const& triggerResults, const std::vector& triggerNames_, edm::Handle& trkCollection, math::XYZPoint& leadPV, @@ -299,35 +300,30 @@ void AlCaIsoTracksProducer::produce(edm::Event& iEvent, edm::EventSetup const& i bool valid(true); //Step1: Get all the relevant containers trigger::TriggerEvent triggerEvent; - edm::Handle triggerEventHandle; - iEvent.getByToken(tok_trigEvt_, triggerEventHandle); + auto const& triggerEventHandle = iEvent.getHandle(tok_trigEvt_); if (!triggerEventHandle.isValid()) { edm::LogWarning("HcalIsoTrack") << "Cannot access the collection " << labelTriggerEvent_; valid = false; } - edm::Handle triggerResults; - iEvent.getByToken(tok_trigRes_, triggerResults); + auto const& triggerResults = iEvent.getHandle(tok_trigRes_); if (!triggerResults.isValid()) { edm::LogWarning("HcalIsoTrack") << "Cannot access the collection " << labelTriggerResults_; valid = false; } - edm::Handle trkCollection; - iEvent.getByToken(tok_genTrack_, trkCollection); + auto trkCollection = iEvent.getHandle(tok_genTrack_); if (!trkCollection.isValid()) { edm::LogWarning("HcalIsoTrack") << "Cannot access the collection " << labelGenTrack_; valid = false; } - edm::Handle recVtxs; - iEvent.getByToken(tok_recVtx_, recVtxs); + auto const& recVtxs = iEvent.getHandle(tok_recVtx_); if (!recVtxs.isValid()) { edm::LogWarning("HcalIsoTrack") << "Cannot access the collection " << labelGenTrack_; valid = false; } - edm::Handle beamSpotH; - iEvent.getByToken(tok_bs_, beamSpotH); + auto const& beamSpotH = iEvent.getHandle(tok_bs_); math::XYZPoint leadPV(0, 0, 0); if (valid) { if (!recVtxs->empty() && !((*recVtxs)[0].isFake())) { @@ -340,20 +336,17 @@ void AlCaIsoTracksProducer::produce(edm::Event& iEvent, edm::EventSetup const& i edm::LogVerbatim("HcalIsoTrack") << "Primary Vertex " << leadPV; #endif - edm::Handle barrelRecHitsHandle; - iEvent.getByToken(tok_EB_, barrelRecHitsHandle); + auto barrelRecHitsHandle = iEvent.getHandle(tok_EB_); if (!barrelRecHitsHandle.isValid()) { edm::LogWarning("HcalIsoTrack") << "Cannot access the collection " << labelEB_; valid = false; } - edm::Handle endcapRecHitsHandle; - iEvent.getByToken(tok_EE_, endcapRecHitsHandle); + auto endcapRecHitsHandle = iEvent.getHandle(tok_EE_); if (!endcapRecHitsHandle.isValid()) { edm::LogWarning("HcalIsoTrack") << "Cannot access the collection " << labelEE_; valid = false; } - edm::Handle hbhe; - iEvent.getByToken(tok_hbhe_, hbhe); + auto hbhe = iEvent.getHandle(tok_hbhe_); if (!hbhe.isValid()) { edm::LogWarning("HcalIsoTrack") << "Cannot access the collection " << labelHBHE_; valid = false; @@ -361,8 +354,7 @@ void AlCaIsoTracksProducer::produce(edm::Event& iEvent, edm::EventSetup const& i //Get L1 trigger object double ptL1(0), etaL1(0), phiL1(0); - edm::Handle l1trigobj; - iEvent.getByToken(tok_hltGT_, l1trigobj); + auto const& l1trigobj = iEvent.getHandle(tok_hltGT_); if (l1trigobj.isValid()) { std::vector > l1tauobjref; @@ -484,7 +476,7 @@ void AlCaIsoTracksProducer::endRun(edm::Run const& iRun, edm::EventSetup const&) } reco::HcalIsolatedTrackCandidateCollection* AlCaIsoTracksProducer::select( - edm::Handle& triggerResults, + edm::Handle const& triggerResults, const std::vector& triggerNames_, edm::Handle& trkCollection, math::XYZPoint& leadPV, diff --git a/Calibration/HcalAlCaRecoProducers/plugins/AlCaIsoTracksProducerFilter.cc b/Calibration/HcalAlCaRecoProducers/plugins/AlCaIsoTracksProducerFilter.cc index a0521f4d4f885..85220ad1f017c 100644 --- a/Calibration/HcalAlCaRecoProducers/plugins/AlCaIsoTracksProducerFilter.cc +++ b/Calibration/HcalAlCaRecoProducers/plugins/AlCaIsoTracksProducerFilter.cc @@ -23,6 +23,7 @@ #include "DataFormats/Common/interface/TriggerResults.h" #include "HLTrigger/HLTcore/interface/HLTConfigProvider.h" +//#define EDM_ML_DEBUG // // class declaration // @@ -91,8 +92,7 @@ bool AlCaIsoTracksProducerFilter::filter(edm::Event& iEvent, edm::EventSetup con if (trigNames_.empty()) { triggerSatisfied = true; } else { - edm::Handle triggerResults; - iEvent.getByToken(tok_trigRes_, triggerResults); + auto const& triggerResults = iEvent.getHandle(tok_trigRes_); if (triggerResults.isValid()) { std::vector modules; const edm::TriggerNames& triggerNames = iEvent.triggerNames(*triggerResults); @@ -101,8 +101,10 @@ bool AlCaIsoTracksProducerFilter::filter(edm::Event& iEvent, edm::EventSetup con int hlt = triggerResults->accept(iHLT); for (unsigned int i = 0; i < trigNames_.size(); ++i) { if (triggerNames_[iHLT].find(trigNames_[i]) != std::string::npos) { +#ifdef EDM_ML_DEBUG edm::LogVerbatim("HcalIsoTrack") - << triggerNames_[iHLT] << " has got HLT flag " << hlt << ":" << triggerSatisfied << std::endl; + << triggerNames_[iHLT] << " has got HLT flag " << hlt << ":" << triggerSatisfied; +#endif if (hlt > 0) { triggerSatisfied = true; break; @@ -114,6 +116,9 @@ bool AlCaIsoTracksProducerFilter::filter(edm::Event& iEvent, edm::EventSetup con } } } +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("HcalIsoTrack") << "AlCaIsoTracksProducerFilter:: triggerSatisfied: " << triggerSatisfied; +#endif if (triggerSatisfied) ++nGood_; return triggerSatisfied; diff --git a/Calibration/HcalAlCaRecoProducers/plugins/AlCaIsolatedBunchFilter.cc b/Calibration/HcalAlCaRecoProducers/plugins/AlCaIsolatedBunchFilter.cc index fbfafc19e220c..944f202eb7155 100644 --- a/Calibration/HcalAlCaRecoProducers/plugins/AlCaIsolatedBunchFilter.cc +++ b/Calibration/HcalAlCaRecoProducers/plugins/AlCaIsolatedBunchFilter.cc @@ -104,8 +104,7 @@ bool AlCaIsolatedBunchFilter::filter(edm::Event& iEvent, edm::EventSetup const& accept = true; } else { /////////////////////////////TriggerResults - edm::Handle triggerResults; - iEvent.getByToken(tok_trigRes_, triggerResults); + auto const& triggerResults = iEvent.getHandle(tok_trigRes_); if (triggerResults.isValid()) { const edm::TriggerNames& triggerNames = iEvent.triggerNames(*triggerResults); const std::vector& triggerNames_ = triggerNames.triggerNames(); diff --git a/Calibration/HcalAlCaRecoProducers/plugins/AlCaIsolatedBunchSelector.cc b/Calibration/HcalAlCaRecoProducers/plugins/AlCaIsolatedBunchSelector.cc index dba47efd6f027..6d778ebc24b7a 100644 --- a/Calibration/HcalAlCaRecoProducers/plugins/AlCaIsolatedBunchSelector.cc +++ b/Calibration/HcalAlCaRecoProducers/plugins/AlCaIsolatedBunchSelector.cc @@ -95,8 +95,7 @@ bool AlCaIsolatedBunchSelector::filter(edm::Event& iEvent, edm::EventSetup const << iEvent.luminosityBlock() << " Bunch " << iEvent.bunchCrossing() << std::endl; #endif //Step1: Find if the event passes the chosen trigger - edm::Handle triggerResults; - iEvent.getByToken(tok_trigRes_, triggerResults); + auto const& triggerResults = iEvent.getHandle(tok_trigRes_); if (triggerResults.isValid()) { const edm::TriggerNames& triggerNames = iEvent.triggerNames(*triggerResults); const std::vector& triggerNames_ = triggerNames.triggerNames(); diff --git a/Calibration/HcalAlCaRecoProducers/plugins/AlCaLowPUHBHEMuonFilter.cc b/Calibration/HcalAlCaRecoProducers/plugins/AlCaLowPUHBHEMuonFilter.cc index 560da35fa1362..4d0a80172548d 100644 --- a/Calibration/HcalAlCaRecoProducers/plugins/AlCaLowPUHBHEMuonFilter.cc +++ b/Calibration/HcalAlCaRecoProducers/plugins/AlCaLowPUHBHEMuonFilter.cc @@ -134,8 +134,7 @@ bool AlCaLowPUHBHEMuonFilter::filter(edm::Event& iEvent, edm::EventSetup const& #endif //Step1: Find if the event passes one of the chosen triggers /////////////////////////////TriggerResults - edm::Handle triggerResults; - iEvent.getByToken(tok_trigRes_, triggerResults); + auto const& triggerResults = iEvent.getHandle(tok_trigRes_); if (triggerResults.isValid()) { bool ok(false); std::vector modules; @@ -166,13 +165,13 @@ bool AlCaLowPUHBHEMuonFilter::filter(edm::Event& iEvent, edm::EventSetup const& const CaloGeometry* geo = &(iSetup.getData(tok_geom_)); // Relevant blocks from iEvent - edm::Handle _Muon; - iEvent.getByToken(tok_Muon_, _Muon); + auto muonHandle = iEvent.getHandle(tok_Muon_); #ifdef EDM_ML_DEBUG - edm::LogVerbatim("LowPUHBHEMuon") << "AlCaLowPUHBHEMuonFilter::Muon Handle " << _Muon.isValid(); + edm::LogVerbatim("LowPUHBHEMuon") << "AlCaLowPUHBHEMuonFilter::Muon Handle " << muonHandle.isValid(); #endif - if (_Muon.isValid()) { - for (reco::MuonCollection::const_iterator RecMuon = _Muon->begin(); RecMuon != _Muon->end(); ++RecMuon) { + if (muonHandle.isValid()) { + for (reco::MuonCollection::const_iterator RecMuon = muonHandle->begin(); RecMuon != muonHandle->end(); + ++RecMuon) { #ifdef EDM_ML_DEBUG edm::LogVerbatim("LowPUHBHEMuon") << "AlCaLowPUHBHEMuonFilter::Muon:Track " << RecMuon->track().isNonnull() << " innerTrack " diff --git a/Calibration/HcalAlCaRecoProducers/plugins/BuildFile.xml b/Calibration/HcalAlCaRecoProducers/plugins/BuildFile.xml index 32d601e1f18a7..fff6c2671b4ce 100644 --- a/Calibration/HcalAlCaRecoProducers/plugins/BuildFile.xml +++ b/Calibration/HcalAlCaRecoProducers/plugins/BuildFile.xml @@ -1,10 +1,33 @@ + + + + + + + + + + + + + + + + + + - - + + + + + + + diff --git a/Calibration/HcalAlCaRecoProducers/plugins/PrescalerFHN.cc b/Calibration/HcalAlCaRecoProducers/plugins/PrescalerFHN.cc index 6e74be577813e..c794a66632a2b 100644 --- a/Calibration/HcalAlCaRecoProducers/plugins/PrescalerFHN.cc +++ b/Calibration/HcalAlCaRecoProducers/plugins/PrescalerFHN.cc @@ -120,8 +120,7 @@ bool PrescalerFHN::filter(edm::Event& iEvent, const edm::EventSetup& iSetup) { // Trying to mirror HLTrigger/HLTfilters/src/HLTHighLevel.cc where possible - Handle trh; - iEvent.getByToken(tok_trigger, trh); + auto const& trh = iEvent.getHandle(tok_trigger); if (trh.isValid()) { LogDebug("") << "TriggerResults found, number of HLT paths: " << trh->size(); diff --git a/Calibration/HcalAlCaRecoProducers/src/ProducerAnalyzer.cc b/Calibration/HcalAlCaRecoProducers/plugins/ProducerAnalyzer.cc similarity index 62% rename from Calibration/HcalAlCaRecoProducers/src/ProducerAnalyzer.cc rename to Calibration/HcalAlCaRecoProducers/plugins/ProducerAnalyzer.cc index fadac8bf6beb7..48156256b2491 100644 --- a/Calibration/HcalAlCaRecoProducers/src/ProducerAnalyzer.cc +++ b/Calibration/HcalAlCaRecoProducers/plugins/ProducerAnalyzer.cc @@ -1,20 +1,89 @@ // system include files +#include +#include +#include // user include files -#include "Calibration/HcalAlCaRecoProducers/src/ProducerAnalyzer.h" #include "DataFormats/Provenance/interface/StableProvenance.h" #include "DataFormats/MuonReco/interface/Muon.h" -#include "TrackingTools/TransientTrack/interface/TransientTrack.h" -#include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "Geometry/Records/interface/CaloGeometryRecord.h" -#include "Geometry/CaloGeometry/interface/CaloGeometry.h" -#include "Geometry/HcalTowerAlgo/interface/HcalGeometry.h" #include "DataFormats/GeometryVector/interface/GlobalPoint.h" #include "DataFormats/HcalCalibObjects/interface/HOCalibVariables.h" #include "DataFormats/TrackReco/interface/TrackExtra.h" #include "DataFormats/TrackReco/interface/TrackExtraFwd.h" +// collections +#include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h" +#include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" +#include "DataFormats/JetReco/interface/CaloJetCollection.h" +#include "DataFormats/HcalCalibObjects/interface/HOCalibVariableCollection.h" +#include "DataFormats/EgammaReco/interface/SuperCluster.h" +#include "DataFormats/EgammaReco/interface/SuperClusterFwd.h" +#include "DataFormats/TrackReco/interface/Track.h" +#include "DataFormats/TrackReco/interface/TrackFwd.h" +#include "DataFormats/MuonReco/interface/MuonFwd.h" + +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" + +#include "Geometry/Records/interface/CaloGeometryRecord.h" +#include "Geometry/CaloGeometry/interface/CaloGeometry.h" +#include "Geometry/HcalTowerAlgo/interface/HcalGeometry.h" + #include "RecoTracker/TrackProducer/interface/TrackProducerBase.h" +#include "TrackingTools/TransientTrack/interface/TransientTrack.h" + +namespace cms { + + // + // class declaration + // + + class ProducerAnalyzer : public edm::one::EDAnalyzer<> { + public: + explicit ProducerAnalyzer(const edm::ParameterSet&); + ~ProducerAnalyzer() override = default; + + void analyze(const edm::Event&, const edm::EventSetup&) override; + void beginJob() override {} + void endJob() override {} + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + + private: + // ----------member data --------------------------- + std::string nameProd_; + std::string jetCalo_; + std::string gammaClus_; + std::string ecalInput_; + std::string hbheInput_; + std::string hoInput_; + std::string hfInput_; + std::string tracks_; + + edm::EDGetTokenT tok_hovar_; + edm::EDGetTokenT tok_horeco_; + edm::EDGetTokenT tok_ho_; + edm::EDGetTokenT tok_hoProd_; + + edm::EDGetTokenT tok_hf_; + + edm::EDGetTokenT tok_jets_; + edm::EDGetTokenT tok_gamma_; + edm::EDGetTokenT tok_muons_; + edm::EDGetTokenT tok_ecal_; + edm::EDGetTokenT tok_tracks_; + + edm::EDGetTokenT tok_hbhe_; + edm::EDGetTokenT tok_hbheProd_; + + edm::ESGetToken tok_geom_; + }; +} // end namespace cms using namespace reco; @@ -28,12 +97,12 @@ namespace cms { nameProd_ = iConfig.getUntrackedParameter("nameProd"); jetCalo_ = iConfig.getUntrackedParameter("jetCalo", "GammaJetJetBackToBackCollection"); - gammaClus_ = iConfig.getUntrackedParameter("gammaClus", "GammaJetGammaBackToBackCollection"); - ecalInput_ = iConfig.getUntrackedParameter("ecalInput", "GammaJetEcalRecHitCollection"); + gammaClus_ = iConfig.getUntrackedParameter("gammaClus"); + ecalInput_ = iConfig.getUntrackedParameter("ecalInput"); hbheInput_ = iConfig.getUntrackedParameter("hbheInput"); hoInput_ = iConfig.getUntrackedParameter("hoInput"); hfInput_ = iConfig.getUntrackedParameter("hfInput"); - Tracks_ = iConfig.getUntrackedParameter("Tracks", "GammaJetTracksCollection"); + tracks_ = iConfig.getUntrackedParameter("Tracks"); tok_hovar_ = consumes(edm::InputTag(nameProd_, hoInput_)); tok_horeco_ = consumes(edm::InputTag("horeco")); @@ -46,7 +115,7 @@ namespace cms { tok_gamma_ = consumes(edm::InputTag(nameProd_, gammaClus_)); tok_muons_ = consumes(edm::InputTag(nameProd_, "SelectedMuons")); tok_ecal_ = consumes(edm::InputTag(nameProd_, ecalInput_)); - tok_tracks_ = consumes(edm::InputTag(nameProd_, Tracks_)); + tok_tracks_ = consumes(edm::InputTag(nameProd_, tracks_)); tok_hbheProd_ = consumes(edm::InputTag(nameProd_, hbheInput_)); tok_hbhe_ = consumes(edm::InputTag(hbheInput_)); @@ -54,15 +123,6 @@ namespace cms { tok_geom_ = esConsumes(); } - ProducerAnalyzer::~ProducerAnalyzer() { - // do anything here that needs to be done at desctruction time - // (e.g. close files, deallocate resources etc.) - } - - void ProducerAnalyzer::beginJob() {} - - void ProducerAnalyzer::endJob() {} - // // member functions // @@ -81,19 +141,16 @@ namespace cms { } if (nameProd_ == "hoCalibProducer") { - edm::Handle ho; - iEvent.getByToken(tok_hovar_, ho); + auto const& ho = iEvent.getHandle(tok_hovar_); const HOCalibVariableCollection Hitho = *(ho.product()); edm::LogVerbatim("HcalAlCa") << " Size of HO " << (Hitho).size(); } if (nameProd_ == "ALCARECOMuAlZMuMu") { - edm::Handle ho; - iEvent.getByToken(tok_horeco_, ho); + auto const& ho = iEvent.getHandle(tok_horeco_); const HORecHitCollection Hitho = *(ho.product()); edm::LogVerbatim("HcalAlCa") << " Size of HO " << (Hitho).size(); - edm::Handle mucand; - iEvent.getByToken(tok_muons_, mucand); + auto const& mucand = iEvent.getHandle(tok_muons_); edm::LogVerbatim("HcalAlCa") << " Size of muon collection " << mucand->size(); for (const auto& it : *(mucand.product())) { TrackRef mu = it.combinedMuon(); @@ -102,25 +159,21 @@ namespace cms { } if (nameProd_ != "IsoProd" && nameProd_ != "ALCARECOMuAlZMuMu" && nameProd_ != "hoCalibProducer") { - edm::Handle hbhe; - iEvent.getByToken(tok_hbhe_, hbhe); + auto const& hbhe = iEvent.getHandle(tok_hbhe_); const HBHERecHitCollection Hithbhe = *(hbhe.product()); edm::LogVerbatim("HcalAlCa") << " Size of HBHE " << (Hithbhe).size(); - edm::Handle ho; - iEvent.getByToken(tok_ho_, ho); + auto const& ho = iEvent.getHandle(tok_ho_); const HORecHitCollection Hitho = *(ho.product()); edm::LogVerbatim("HcalAlCa") << " Size of HO " << (Hitho).size(); - edm::Handle hf; - iEvent.getByToken(tok_hf_, hf); + auto const& hf = iEvent.getHandle(tok_hf_); const HFRecHitCollection Hithf = *(hf.product()); edm::LogVerbatim("HcalAlCa") << " Size of HF " << (Hithf).size(); } if (nameProd_ == "IsoProd") { edm::LogVerbatim("HcalAlCa") << " We are here "; - edm::Handle tracks; - iEvent.getByToken(tok_tracks_, tracks); + auto const& tracks = iEvent.getHandle(tok_tracks_); edm::LogVerbatim("HcalAlCa") << " Tracks size " << (*tracks).size(); for (const auto& track : *(tracks.product())) { @@ -130,8 +183,7 @@ namespace cms { edm::LogVerbatim("HcalAlCa") << " Track extra " << myextra->outerMomentum() << " " << myextra->outerPosition(); } - edm::Handle ecal; - iEvent.getByToken(tok_ecal_, ecal); + auto const& ecal = iEvent.getHandle(tok_ecal_); const EcalRecHitCollection Hitecal = *(ecal.product()); edm::LogVerbatim("HcalAlCa") << " Size of Ecal " << (Hitecal).size(); @@ -147,8 +199,7 @@ namespace cms { energyECAL = energyECAL + hite.energy(); } - edm::Handle hbhe; - iEvent.getByToken(tok_hbheProd_, hbhe); + auto const& hbhe = iEvent.getHandle(tok_hbheProd_); const HBHERecHitCollection Hithbhe = *(hbhe.product()); edm::LogVerbatim("HcalAlCa") << " Size of HBHE " << (Hithbhe).size(); @@ -167,25 +218,21 @@ namespace cms { if (nameProd_ == "GammaJetProd" || nameProd_ == "DiJProd") { edm::LogVerbatim("HcalAlCa") << " we are in GammaJetProd area "; - edm::Handle ecal; - iEvent.getByToken(tok_ecal_, ecal); + auto const& ecal = iEvent.getHandle(tok_ecal_); edm::LogVerbatim("HcalAlCa") << " Size of ECAL " << (*ecal).size(); - edm::Handle jets; - iEvent.getByToken(tok_jets_, jets); + auto const& jets = iEvent.getHandle(tok_jets_); edm::LogVerbatim("HcalAlCa") << " Jet size " << (*jets).size(); for (const auto& jet : *(jets.product())) { edm::LogVerbatim("HcalAlCa") << " Et jet " << jet.et() << " eta " << jet.eta() << " phi " << jet.phi(); } - edm::Handle tracks; - iEvent.getByToken(tok_tracks_, tracks); + auto const& tracks = iEvent.getHandle(tok_tracks_); edm::LogVerbatim("HcalAlCa") << " Tracks size " << (*tracks).size(); } if (nameProd_ == "GammaJetProd") { - edm::Handle eclus; - iEvent.getByToken(tok_gamma_, eclus); + auto const& eclus = iEvent.getHandle(tok_gamma_); edm::LogVerbatim("HcalAlCa") << " GammaClus size " << (*eclus).size(); for (const auto& iclus : *(eclus.product())) { edm::LogVerbatim("HcalAlCa") << " Et gamma " << iclus.energy() / cosh(iclus.eta()) << " eta " << iclus.eta() @@ -193,6 +240,24 @@ namespace cms { } } } - //define this as a plug-in - //DEFINE_FWK_MODULE(ProducerAnalyzer) + + void ProducerAnalyzer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + desc.addUntracked("nameProd", "hoCalibProducer"); + desc.addUntracked("jetCalo", "GammaJetJetBackToBackCollection"); + desc.addUntracked("gammaClus", "GammaJetGammaBackToBackCollection"); + desc.addUntracked("ecalInput", "GammaJetEcalRecHitCollection"); + desc.addUntracked("hbheInput", "hbhereco"); + desc.addUntracked("hoInput", "horeco"); + desc.addUntracked("hfInput", "hfreco"); + desc.addUntracked("Tracks", "GammaJetTracksCollection"); + descriptions.add("alcaHcalProducerAnalyzer", desc); + } + } // namespace cms + +#include "FWCore/PluginManager/interface/ModuleDef.h" +#include "FWCore/Framework/interface/MakerMacros.h" + +using cms::ProducerAnalyzer; +DEFINE_FWK_MODULE(ProducerAnalyzer); diff --git a/Calibration/HcalAlCaRecoProducers/python/ALCARECOHcalCalHBHEMuonProducerFilter_Output_cff.py b/Calibration/HcalAlCaRecoProducers/python/ALCARECOHcalCalHBHEMuonProducerFilter_Output_cff.py new file mode 100644 index 0000000000000..d4181c3320a66 --- /dev/null +++ b/Calibration/HcalAlCaRecoProducers/python/ALCARECOHcalCalHBHEMuonProducerFilter_Output_cff.py @@ -0,0 +1,19 @@ +import FWCore.ParameterSet.Config as cms + +# output block for alcastream HCAL HBHEMuon +# output module +# module alcastreamHcalHBHEMuonOutput = PoolOutputModule +OutALCARECOHcalCalHBHEMuonProducerFilter_noDrop = cms.PSet( + # use this in case of filter available + SelectEvents = cms.untracked.PSet( + SelectEvents = cms.vstring('pathALCARECOHcalCalHBHEMuonProducerFilter') + ), + outputCommands = cms.untracked.vstring( + 'keep *_alcaHcalHBHEMuonProducer_hbheMuon_*', + ) +) + + +import copy +OutALCARECOHcalCalHBHEMuonProducerFilter=copy.deepcopy(OutALCARECOHcalCalHBHEMuonProducerFilter_noDrop) +OutALCARECOHcalCalHBHEMuonProducerFilter.outputCommands.insert(0, "drop *") diff --git a/Calibration/HcalAlCaRecoProducers/python/ALCARECOHcalCalHBHEMuonProducerFilter_cff.py b/Calibration/HcalAlCaRecoProducers/python/ALCARECOHcalCalHBHEMuonProducerFilter_cff.py new file mode 100644 index 0000000000000..c5b8687fd333c --- /dev/null +++ b/Calibration/HcalAlCaRecoProducers/python/ALCARECOHcalCalHBHEMuonProducerFilter_cff.py @@ -0,0 +1,14 @@ +import FWCore.ParameterSet.Config as cms + +#------------------------------------------------ +#AlCaReco filtering for HCAL isotrk: +#------------------------------------------------ + +from Calibration.HcalAlCaRecoProducers.alcaHcalHBHEMuonProducer_cfi import * +from Calibration.HcalAlCaRecoProducers.alcaHcalHBHEMuonFilter_cfi import * + +seqALCARECOHcalCalHBHEMuonProducerFilter = cms.Sequence(alcaHcalHBHEMuonProducer * alcaHcalHBHEMuonFilter) + + + + diff --git a/Calibration/HcalAlCaRecoProducers/python/ALCARECOHcalCalHEMuonProducerFilter_Output_cff.py b/Calibration/HcalAlCaRecoProducers/python/ALCARECOHcalCalHEMuonProducerFilter_Output_cff.py new file mode 100644 index 0000000000000..ae09a2a524db1 --- /dev/null +++ b/Calibration/HcalAlCaRecoProducers/python/ALCARECOHcalCalHEMuonProducerFilter_Output_cff.py @@ -0,0 +1,19 @@ +import FWCore.ParameterSet.Config as cms + +# output block for alcastream HCAL HEMuon +# output module +# module alcastreamHcalHEMuonOutput = PoolOutputModule +OutALCARECOHcalCalHEMuonProducerFilter_noDrop = cms.PSet( + # use this in case of filter available + SelectEvents = cms.untracked.PSet( + SelectEvents = cms.vstring('pathALCARECOHcalCalHEMuonProducerFilter') + ), + outputCommands = cms.untracked.vstring( + 'keep *_alcaHcalHBHEMuonProducer_hbheMuon_*', + ) +) + + +import copy +OutALCARECOHcalCalHEMuonProducerFilter=copy.deepcopy(OutALCARECOHcalCalHEMuonProducerFilter_noDrop) +OutALCARECOHcalCalHEMuonProducerFilter.outputCommands.insert(0, "drop *") diff --git a/Calibration/HcalAlCaRecoProducers/python/ALCARECOHcalCalHEMuonProducerFilter_cff.py b/Calibration/HcalAlCaRecoProducers/python/ALCARECOHcalCalHEMuonProducerFilter_cff.py new file mode 100644 index 0000000000000..9459268e648f6 --- /dev/null +++ b/Calibration/HcalAlCaRecoProducers/python/ALCARECOHcalCalHEMuonProducerFilter_cff.py @@ -0,0 +1,14 @@ +import FWCore.ParameterSet.Config as cms + +#------------------------------------------------ +#AlCaReco filtering for HCAL isotrk: +#------------------------------------------------ + +from Calibration.HcalAlCaRecoProducers.alcaHcalHBHEMuonProducer_cfi import * +from Calibration.HcalAlCaRecoProducers.alcaHcalHEMuonFilter_cfi import * + +seqALCARECOHcalCalHEMuonProducerFilter = cms.Sequence(alcaHcalHBHEMuonProducer * alcaHcalHEMuonFilter) + + + + diff --git a/Calibration/HcalAlCaRecoProducers/python/ALCARECOHcalCalIsoTrkFilterNoHLT_Output_cff.py b/Calibration/HcalAlCaRecoProducers/python/ALCARECOHcalCalIsoTrkFilterNoHLT_Output_cff.py new file mode 100644 index 0000000000000..a74e55db96a0a --- /dev/null +++ b/Calibration/HcalAlCaRecoProducers/python/ALCARECOHcalCalIsoTrkFilterNoHLT_Output_cff.py @@ -0,0 +1,27 @@ +import FWCore.ParameterSet.Config as cms + +# output block for alcastream HCAL Isotrk +# output module +# module alcastreamHcalIsotrkNoHLTOutput = PoolOutputModule +OutALCARECOHcalCalIsoTrkFilterNoHLT_noDrop = cms.PSet( + # use this in case of filter available + SelectEvents = cms.untracked.PSet( + SelectEvents = cms.vstring('pathALCARECOHcalCalIsoTrkFilterNoHLT') + ), + outputCommands = cms.untracked.vstring( + 'keep HcalNoiseSummary_hcalnoise_*_*', + 'keep *_hbhereco_*_*', + 'keep *_ecalRecHit_*_*', + 'keep *_towerMaker_*_*', + 'keep *_offlineBeamSpot_*_*', + 'keep *_generalTracks_*_*', + 'keep *_generalTracksExtra_*_*', + 'keep *_offlinePrimaryVertices_*_*', + 'keep *_TkAlIsoProdFilter_*_*', + ) +) + + +import copy +OutALCARECOHcalCalIsoTrkFilterNoHLT=copy.deepcopy(OutALCARECOHcalCalIsoTrkFilterNoHLT_noDrop) +OutALCARECOHcalCalIsoTrkFilterNoHLT.outputCommands.insert(0, "drop *") diff --git a/Calibration/HcalAlCaRecoProducers/python/ALCARECOHcalCalIsoTrkProducerFilter_Output_cff.py b/Calibration/HcalAlCaRecoProducers/python/ALCARECOHcalCalIsoTrkProducerFilter_Output_cff.py new file mode 100644 index 0000000000000..bc8cc438bd64d --- /dev/null +++ b/Calibration/HcalAlCaRecoProducers/python/ALCARECOHcalCalIsoTrkProducerFilter_Output_cff.py @@ -0,0 +1,20 @@ +import FWCore.ParameterSet.Config as cms + +# output block for alcastream HCAL Isotrk +# output module +# module alcastreamHcalIsotrkOutput = PoolOutputModule +OutALCARECOHcalCalIsoTrkProducerFilter_noDrop = cms.PSet( + # use this in case of filter available + SelectEvents = cms.untracked.PSet( + SelectEvents = cms.vstring('pathALCARECOHcalCalIsoTrkProducerFilter') + ), + outputCommands = cms.untracked.vstring( + 'keep *_alcaHcalIsotrkProducer_HcalIsoTrack_*', + 'keep *_alcaHcalIsotrkProducer_HcalIsoTrackEvent_*', + ) +) + + +import copy +OutALCARECOHcalCalIsoTrkProducerFilter=copy.deepcopy(OutALCARECOHcalCalIsoTrkProducerFilter_noDrop) +OutALCARECOHcalCalIsoTrkProducerFilter.outputCommands.insert(0, "drop *") diff --git a/Calibration/HcalAlCaRecoProducers/python/ALCARECOHcalCalIsoTrkProducerFilter_cff.py b/Calibration/HcalAlCaRecoProducers/python/ALCARECOHcalCalIsoTrkProducerFilter_cff.py new file mode 100644 index 0000000000000..061621a1e4bae --- /dev/null +++ b/Calibration/HcalAlCaRecoProducers/python/ALCARECOHcalCalIsoTrkProducerFilter_cff.py @@ -0,0 +1,14 @@ +import FWCore.ParameterSet.Config as cms + +#------------------------------------------------ +#AlCaReco filtering for HCAL isotrk: +#------------------------------------------------ + +from Calibration.HcalAlCaRecoProducers.alcaHcalIsotrkProducer_cfi import * +from Calibration.HcalAlCaRecoProducers.alcaHcalIsotrkFilter_cfi import * + +seqALCARECOHcalCalIsoTrkProducerFilter = cms.Sequence(alcaHcalIsotrkProducer * alcaHcalIsotrkFilter) + + + + diff --git a/Calibration/HcalAlCaRecoProducers/python/alcadijets_cfi.py b/Calibration/HcalAlCaRecoProducers/python/alcadijets_cfi.py index e9b4ac2402887..ce5640b7d4eb5 100644 --- a/Calibration/HcalAlCaRecoProducers/python/alcadijets_cfi.py +++ b/Calibration/HcalAlCaRecoProducers/python/alcadijets_cfi.py @@ -1,15 +1,5 @@ import FWCore.ParameterSet.Config as cms # producer for alcadijet (HCAL dijet) -DiJetsProd = cms.EDProducer("AlCaDiJetsProducer", - PFjetInput = cms.InputTag("ak4PFJetsCHS"), - HBHEInput = cms.InputTag("hbhereco"), - HFInput = cms.InputTag("hfreco"), - HOInput = cms.InputTag("horeco"), - #TriggerResults = cms.InputTag("TriggerResults::HLT"), - particleFlowInput = cms.InputTag("particleFlow"), - VertexInput = cms.InputTag("offlinePrimaryVertices"), - MinPtJet = cms.double(20.0) - ) - - +import Calibration.HcalAlCaRecoProducers.alcaDiJetsProducer_cfi +DiJetsProd = Calibration.HcalAlCaRecoProducers.alcaDiJetsProducer_cfi.alcaDiJetsProducer.clone() diff --git a/Calibration/HcalAlCaRecoProducers/python/alcagammajet_cfi.py b/Calibration/HcalAlCaRecoProducers/python/alcagammajet_cfi.py index 14dc850e7b7c4..6afff74e0f025 100644 --- a/Calibration/HcalAlCaRecoProducers/python/alcagammajet_cfi.py +++ b/Calibration/HcalAlCaRecoProducers/python/alcagammajet_cfi.py @@ -1,32 +1,11 @@ import FWCore.ParameterSet.Config as cms # producer for alcadijets (HCAL gamma-jet) -GammaJetProd = cms.EDProducer("AlCaGammaJetProducer", - PhoInput = cms.InputTag("gedPhotons"), - PFjetInput = cms.InputTag("ak4PFJetsCHS"), - HBHEInput = cms.InputTag("hbhereco"), - HFInput = cms.InputTag("hfreco"), - HOInput = cms.InputTag("horeco"), - METInput = cms.InputTag("pfMet"), - TriggerResults = cms.InputTag("TriggerResults::HLT"), - gsfeleInput = cms.InputTag("gedGsfElectrons"), - particleFlowInput = cms.InputTag("particleFlow"), - VertexInput = cms.InputTag("offlinePrimaryVertices"), - ConversionsInput = cms.InputTag("allConversions"), - rhoInput = cms.InputTag("fixedGridRhoFastjetAll"), - BeamSpotInput = cms.InputTag("offlineBeamSpot"), - PhoLoose = cms.InputTag("PhotonIDProdGED", "PhotonCutBasedIDLoose"), - PhoTight = cms.InputTag("PhotonIDProdGED", "PhotonCutBasedIDTight"), - MinPtJet = cms.double(10.0), - MinPtPhoton = cms.double(10.0) - ) +import Calibration.HcalAlCaRecoProducers.alcaGammaJetProducer_cfi +GammaJetProd = Calibration.HcalAlCaRecoProducers.alcaGammaJetProducer_cfi.alcaGammaJetProducer.clone() -GammaJetFilter = cms.EDFilter("AlCaGammaJetSelector", - PhoInput = cms.InputTag("gedPhotons"), - PFjetInput = cms.InputTag("ak4PFJetsCHS"), - MinPtJet = cms.double(10.0), - MinPtPhoton = cms.double(10.0) - ) +import Calibration.HcalAlCaRecoProducers.alcaGammaJetSelector_cfi +GammaJetFilter = Calibration.HcalAlCaRecoProducers.alcaGammaJetSelector_cfi.alcaGammaJetSelector.clone() diff --git a/Calibration/HcalAlCaRecoProducers/python/alcahbhemuon_cfi.py b/Calibration/HcalAlCaRecoProducers/python/alcahbhemuon_cfi.py index 408ffa33dbadf..2f95b2dcd0ff0 100644 --- a/Calibration/HcalAlCaRecoProducers/python/alcahbhemuon_cfi.py +++ b/Calibration/HcalAlCaRecoProducers/python/alcahbhemuon_cfi.py @@ -1,13 +1,6 @@ import FWCore.ParameterSet.Config as cms # producer for alcahbhemuon (HCAL with muons) -HBHEMuonProd = cms.EDProducer("AlCaHBHEMuonProducer", - BeamSpotLabel = cms.InputTag("offlineBeamSpot"), - VertexLabel = cms.InputTag("offlinePrimaryVertices"), - EBRecHitLabel = cms.InputTag("ecalRecHit","EcalRecHitsEB"), - EERecHitLabel = cms.InputTag("ecalRecHit","EcalRecHitsEE"), - HBHERecHitLabel = cms.InputTag("hbhereco"), - MuonLabel = cms.InputTag("muons"), - MinimumMuonP = cms.double(10.0), - ) +import Calibration.HcalAlCaRecoProducers.alcaHBHEMuonProducer_cfi +HBHEMuonProd = Calibration.HcalAlCaRecoProducers.alcaHBHEMuonProducer_cfi.alcaHBHEMuonProducer.clone() diff --git a/Calibration/HcalAlCaRecoProducers/python/alcahcalnoise_cfi.py b/Calibration/HcalAlCaRecoProducers/python/alcahcalnoise_cfi.py index ed5b594abbc8b..82de05830d0e0 100644 --- a/Calibration/HcalAlCaRecoProducers/python/alcahcalnoise_cfi.py +++ b/Calibration/HcalAlCaRecoProducers/python/alcahcalnoise_cfi.py @@ -2,22 +2,7 @@ # producer for alcaminbisas (HCAL minimum bias) -HcalNoiseProd = cms.EDProducer("AlCaEcalHcalReadoutsProducer", - JetSource = cms.InputTag("iterativeCone5CaloJets"), - MetSource = cms.InputTag("met"), - TowerSource = cms.InputTag("towerMaker"), - UseJet = cms.bool(True), - UseMET = cms.bool(False), - MetCut = cms.double(0), - JetMinE = cms.double(20), - JetHCALminEnergyFraction = cms.double(0.98), - - hbheInput = cms.InputTag("hbhereco"), - hfInput = cms.InputTag("hfreco"), - hoInput = cms.InputTag("horeco"), - ecalInputs = cms.VInputTag(cms.InputTag("ecalRecHit","EcalRecHitsEB"), cms.InputTag("ecalRecHit","EcalRecHitsEE")), - ecalPSInput = cms.InputTag("ecalPreshowerRecHit","EcalRecHitsES"), - rawInput = cms.InputTag("rawDataCollector") -) +import Calibration.HcalAlCaRecoProducers.alcaEcalHcalReadoutsProducer_cfi +HcalNoiseProd = Calibration.HcalAlCaRecoProducers.alcaEcalHcalReadoutsProducer_cfi.alcaEcalHcalReadoutsProducer.clone() diff --git a/Calibration/HcalAlCaRecoProducers/python/alcahomuon_cfi.py b/Calibration/HcalAlCaRecoProducers/python/alcahomuon_cfi.py index c20cae7eca51f..0df06170aead0 100644 --- a/Calibration/HcalAlCaRecoProducers/python/alcahomuon_cfi.py +++ b/Calibration/HcalAlCaRecoProducers/python/alcahomuon_cfi.py @@ -6,24 +6,8 @@ #process.load('Configuration.StandardSequences.Reconstruction_Data_cff') #from Configuration.StandardSequences.Reconstruction_Data_cff import * from RecoLocalCalo.HcalRecAlgos.hcalRecAlgoESProd_cfi import * -hoCalibProducer = cms.EDProducer("AlCaHOCalibProducer", - hbheInput = cms.InputTag("hbhereco"), - hotime = cms.untracked.bool(False), - hbinfo = cms.untracked.bool(False), - sigma = cms.untracked.double(1.0), - plotOccupancy = cms.untracked.bool(False), - CosmicData = cms.untracked.bool(False), - hoInput = cms.InputTag("horeco"), - towerInput = cms.InputTag("towerMaker"), - RootFileName = cms.untracked.string('test.root'), - m_scale = cms.untracked.double(4.0), - debug = cms.untracked.bool(False), - muons = cms.untracked.InputTag("muons"), - #muons = cms.untracked.InputTag("cosmicMuons"), - #muons = cms.untracked.InputTag("standAloneMuons"), - vertexTags = cms.InputTag("offlinePrimaryVertices"), - lumiTags = cms.InputTag("scalersRawToDigi") - #lumiTags = cms.InputTag("lumiProducer") -) + +import Calibration.HcalAlCaRecoProducers.alcaHOCalibProducer_cfi +hoCalibProducer = Calibration.HcalAlCaRecoProducers.alcaHOCalibProducer_cfi.alcaHOCalibProducer.clone() diff --git a/Calibration/HcalAlCaRecoProducers/python/alcahomuoncosmics_cfi.py b/Calibration/HcalAlCaRecoProducers/python/alcahomuoncosmics_cfi.py index 1ff126a493549..e0e7d452375bb 100644 --- a/Calibration/HcalAlCaRecoProducers/python/alcahomuoncosmics_cfi.py +++ b/Calibration/HcalAlCaRecoProducers/python/alcahomuoncosmics_cfi.py @@ -7,24 +7,9 @@ #from Configuration.StandardSequences.Reconstruction_Data_cff import * from RecoLocalCalo.HcalRecAlgos.hcalRecAlgoESProd_cfi import * -hoCalibCosmicsProducer = cms.EDProducer("AlCaHOCalibProducer", - hbheInput = cms.InputTag("hbhereco"), - hotime = cms.untracked.bool(False), - hbinfo = cms.untracked.bool(False), - sigma = cms.untracked.double(1.0), - plotOccupancy = cms.untracked.bool(False), - CosmicData = cms.untracked.bool(True), - hoInput = cms.InputTag("horeco"), - towerInput = cms.InputTag("towerMaker"), - digiInput = cms.untracked.bool(False), - RootFileName = cms.untracked.string('test.root'), - m_scale = cms.untracked.double(4.0), - debug = cms.untracked.bool(False), - muons = cms.untracked.InputTag("cosmicMuons"), - vertexTags = cms.InputTag("offlinePrimaryVertices"), - lumiTags = cms.InputTag("scalersRawToDigi") - #lumiTags = cms.InputTag("lumiProducer") - +import Calibration.HcalAlCaRecoProducers.alcaHOCalibProducer_cfi +hoCalibCosmicsProducer = Calibration.HcalAlCaRecoProducers.alcaHOCalibProducer_cfi.alcaHOCalibProducer.clone( + CosmicData = True, + muons = cms.untracked.InputTag("cosmicMuons") ) - diff --git a/Calibration/HcalAlCaRecoProducers/python/alcaiterphisym_cfi.py b/Calibration/HcalAlCaRecoProducers/python/alcaiterphisym_cfi.py index 22e8a8b2963bb..c8959bb59f9da 100644 --- a/Calibration/HcalAlCaRecoProducers/python/alcaiterphisym_cfi.py +++ b/Calibration/HcalAlCaRecoProducers/python/alcaiterphisym_cfi.py @@ -2,12 +2,8 @@ # producer for alcaiterativephisym (HCAL Iterative Phi Symmetry) - -IterativePhiSymProd = cms.EDProducer("AlCaEcalHcalReadoutsProducer", - hbheInput = cms.InputTag("hbhereco"), - hoInput = cms.InputTag("horeco"), - hfInput = cms.InputTag("hfreco") -) +import Calibration.HcalAlCaRecoProducers.alcaEcalHcalReadoutsProducer_cfi +IterativePhiSymProd = Calibration.HcalAlCaRecoProducers.alcaEcalHcalReadoutsProducer_cfi.alcaEcalHcalReadoutsProducer.clone() diff --git a/Calibration/HcalAlCaRecoProducers/python/alcaminbias_cfi.py b/Calibration/HcalAlCaRecoProducers/python/alcaminbias_cfi.py index af80f60c4d5b6..562601a194954 100644 --- a/Calibration/HcalAlCaRecoProducers/python/alcaminbias_cfi.py +++ b/Calibration/HcalAlCaRecoProducers/python/alcaminbias_cfi.py @@ -2,10 +2,7 @@ # producer for alcaminbisas (HCAL minimum bias) -MinProd = cms.EDProducer("AlCaEcalHcalReadoutsProducer", - hbheInput = cms.InputTag("hbherecoMB"), - hfInput = cms.InputTag("hfrecoMB"), - hoInput = cms.InputTag("horecoMB") -) +import Calibration.HcalAlCaRecoProducers.alcaEcalHcalReadoutsProducer_cfi +MinProd = Calibration.HcalAlCaRecoProducers.alcaEcalHcalReadoutsProducer_cfi.alcaEcalHcalReadoutsProducer.clone() diff --git a/Calibration/HcalAlCaRecoProducers/src/AlCaEcalHcalReadoutsProducer.cc b/Calibration/HcalAlCaRecoProducers/src/AlCaEcalHcalReadoutsProducer.cc deleted file mode 100644 index f2792c3ee36d9..0000000000000 --- a/Calibration/HcalAlCaRecoProducers/src/AlCaEcalHcalReadoutsProducer.cc +++ /dev/null @@ -1,44 +0,0 @@ -#include "Calibration/HcalAlCaRecoProducers/interface/AlCaEcalHcalReadoutsProducer.h" -#include "FWCore/MessageLogger/interface/MessageLogger.h" - -AlCaEcalHcalReadoutsProducer::AlCaEcalHcalReadoutsProducer(const edm::ParameterSet& iConfig) { - tok_ho_ = consumes(iConfig.getParameter("hoInput")); - tok_hf_ = consumes(iConfig.getParameter("hfInput")); - tok_hbhe_ = consumes(iConfig.getParameter("hbheInput")); - - //register your products - put_hbhe_ = produces("HBHERecHitCollection"); - put_ho_ = produces("HORecHitCollection"); - put_hf_ = produces("HFRecHitCollection"); -} - -// ------------ method called to produce the data ------------ -void AlCaEcalHcalReadoutsProducer::produce(edm::StreamID, edm::Event& iEvent, const edm::EventSetup& iSetup) const { - using namespace edm; - using namespace std; - - edm::Handle hbhe; - edm::Handle ho; - edm::Handle hf; - - iEvent.getByToken(tok_hbhe_, hbhe); - if (!hbhe.isValid()) { - LogDebug("") << "AlCaEcalHcalReadoutProducer: Error! can't get hbhe product!" << std::endl; - return; - } - - iEvent.getByToken(tok_ho_, ho); - if (!ho.isValid()) { - LogDebug("") << "AlCaEcalHcalReadoutProducer: Error! can't get ho product!" << std::endl; - } - - iEvent.getByToken(tok_hf_, hf); - if (!hf.isValid()) { - LogDebug("") << "AlCaEcalHcalReadoutProducer: Error! can't get hf product!" << std::endl; - } - - //Put selected information in the event - iEvent.emplace(put_hbhe_, *hbhe); - iEvent.emplace(put_ho_, *ho); - iEvent.emplace(put_hf_, *hf); -} diff --git a/Calibration/HcalAlCaRecoProducers/src/ProducerAnalyzer.h b/Calibration/HcalAlCaRecoProducers/src/ProducerAnalyzer.h deleted file mode 100644 index 05cb0dfc7966a..0000000000000 --- a/Calibration/HcalAlCaRecoProducers/src/ProducerAnalyzer.h +++ /dev/null @@ -1,82 +0,0 @@ -#ifndef CalibrationHcalAlCaRecoProducersProducerAnalyzer_h -#define CalibrationHcalAlCaRecoProducersProducerAnalyzer_h - -// system include files -#include -#include -#include - -// user include files -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/MakerMacros.h" -#include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" - -// collections -#include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h" -#include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" -#include "DataFormats/JetReco/interface/CaloJetCollection.h" -#include "DataFormats/HcalCalibObjects/interface/HOCalibVariableCollection.h" -#include "DataFormats/EgammaReco/interface/SuperCluster.h" -#include "DataFormats/EgammaReco/interface/SuperClusterFwd.h" -#include "DataFormats/TrackReco/interface/Track.h" -#include "DataFormats/TrackReco/interface/TrackFwd.h" -#include "DataFormats/MuonReco/interface/MuonFwd.h" - -#include "Geometry/CaloGeometry/interface/CaloGeometry.h" -#include "Geometry/Records/interface/CaloGeometryRecord.h" - -namespace edm { - class ParameterSet; - class Event; - class EventSetup; -} // namespace edm - -namespace cms { - - // - // class declaration - // - - class ProducerAnalyzer : public edm::EDAnalyzer { - public: - explicit ProducerAnalyzer(const edm::ParameterSet&); - ~ProducerAnalyzer() override; - - void analyze(const edm::Event&, const edm::EventSetup&) override; - void beginJob() override; - void endJob() override; - - private: - // ----------member data --------------------------- - std::string nameProd_; - std::string jetCalo_; - std::string gammaClus_; - std::string ecalInput_; - std::string hbheInput_; - std::string hoInput_; - std::string hfInput_; - std::string Tracks_; - - edm::EDGetTokenT tok_hovar_; - edm::EDGetTokenT tok_horeco_; - edm::EDGetTokenT tok_ho_; - edm::EDGetTokenT tok_hoProd_; - - edm::EDGetTokenT tok_hf_; - - edm::EDGetTokenT tok_jets_; - edm::EDGetTokenT tok_gamma_; - edm::EDGetTokenT tok_muons_; - edm::EDGetTokenT tok_ecal_; - edm::EDGetTokenT tok_tracks_; - - edm::EDGetTokenT tok_hbhe_; - edm::EDGetTokenT tok_hbheProd_; - - edm::ESGetToken tok_geom_; - }; -} // end namespace cms -#endif diff --git a/Calibration/HcalAlCaRecoProducers/src/SealModule.cc b/Calibration/HcalAlCaRecoProducers/src/SealModule.cc deleted file mode 100644 index ced88749c125e..0000000000000 --- a/Calibration/HcalAlCaRecoProducers/src/SealModule.cc +++ /dev/null @@ -1,9 +0,0 @@ -#include "FWCore/PluginManager/interface/ModuleDef.h" -#include "FWCore/Framework/interface/MakerMacros.h" -#include "Calibration/HcalAlCaRecoProducers/interface/AlCaEcalHcalReadoutsProducer.h" -#include "Calibration/HcalAlCaRecoProducers/src/ProducerAnalyzer.h" - -using cms::ProducerAnalyzer; - -DEFINE_FWK_MODULE(AlCaEcalHcalReadoutsProducer); -DEFINE_FWK_MODULE(ProducerAnalyzer); diff --git a/Calibration/HcalAlCaRecoProducers/test/AlCaHBHEMuonFilterProducer_cfg.py b/Calibration/HcalAlCaRecoProducers/test/AlCaHBHEMuonFilterProducer_cfg.py index dc4b65bf402db..f9f9c9ac90439 100644 --- a/Calibration/HcalAlCaRecoProducers/test/AlCaHBHEMuonFilterProducer_cfg.py +++ b/Calibration/HcalAlCaRecoProducers/test/AlCaHBHEMuonFilterProducer_cfg.py @@ -1,6 +1,7 @@ import FWCore.ParameterSet.Config as cms -process = cms.Process("AlCaHBHEMuon") +from Configuration.Eras.Era_Run2_2018_cff import Run2_2018 +process = cms.Process("AlCaHBHEMuon",Run2_2018) process.load('Configuration.StandardSequences.Services_cff') process.load('FWCore.MessageService.MessageLogger_cfi') @@ -10,16 +11,21 @@ process.load('Configuration.StandardSequences.EndOfProcess_cff') process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff') from Configuration.AlCa.autoCond import autoCond -process.GlobalTag.globaltag=autoCond['run2_mc'] +process.GlobalTag.globaltag=autoCond['run2_data'] process.load("RecoLocalCalo.EcalRecAlgos.EcalSeverityLevelESProducer_cfi") +if hasattr(process,'MessageLogger'): + process.MessageLogger.HBHEMuon=dict() + +process.maxEvents = cms.untracked.PSet( + input = cms.untracked.int32(-1) +) -process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(10) ) process.source = cms.Source("PoolSource", fileNames = cms.untracked.vstring( - 'file:/afs/cern.ch/user/a/amkalsi/public/RecoFileForAlcaProducer.root' -# 'root://xrootd.unl.edu//store/mc/Phys14DR/DYToMuMu_M-50_Tune4C_13TeV-pythia8/GEN-SIM-RECO/PU20bx25_tsg_castor_PHYS14_25_V1-v1/10000/184C1AC9-A775-E411-9196-002590200824.root' + 'file:/eos/cms/store/group/dpg_hcal/comm_hcal/AmanKaur/HLTPhysics/RawtoReco_HLTPhysics/210910_053130/0000/RECO_RAW2DIGI_L1Reco_RECO_ALCA_1.root', + 'file:/eos/cms/store/group/dpg_hcal/comm_hcal/AmanKaur/HLTPhysics/RawtoReco_HLTPhysics/210910_053130/0000/RECO_RAW2DIGI_L1Reco_RECO_ALCA_2.root', ) ) @@ -33,9 +39,11 @@ ), eventAutoFlushCompressedSize = cms.untracked.int32(5242880), outputCommands = process.OutALCARECOHcalCalHBHEMuonFilter.outputCommands, - fileName = cms.untracked.string('PoolOutput.root'), + fileName = cms.untracked.string('OutputHBHEMuon.root'), ) +process.AlcaHBHEMuonFilter.Triggers = [] + # Path and EndPath definitions process.endjob_step = cms.EndPath(process.endOfProcess) process.ALCARECOStreamHcalCalHBHEMuonOutPath = cms.EndPath(process.ALCARECOStreamHcalCalHBHEMuon) diff --git a/Calibration/HcalAlCaRecoProducers/test/AlCaHBHEMuonProducerFilter_cfg.py b/Calibration/HcalAlCaRecoProducers/test/AlCaHBHEMuonProducerFilter_cfg.py new file mode 100644 index 0000000000000..729623d609051 --- /dev/null +++ b/Calibration/HcalAlCaRecoProducers/test/AlCaHBHEMuonProducerFilter_cfg.py @@ -0,0 +1,52 @@ +import FWCore.ParameterSet.Config as cms + +from Configuration.Eras.Era_Run2_2018_cff import Run2_2018 +process = cms.Process("AlCaHBHEMuon",Run2_2018) + +process.load('Configuration.StandardSequences.Services_cff') +process.load('FWCore.MessageService.MessageLogger_cfi') +process.load("Configuration.StandardSequences.GeometryRecoDB_cff") +process.load("Configuration.StandardSequences.MagneticField_cff") +process.load('Configuration.StandardSequences.AlCaRecoStreams_cff') +process.load('Configuration.StandardSequences.EndOfProcess_cff') +process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff') +from Configuration.AlCa.autoCond import autoCond +process.GlobalTag.globaltag=autoCond['run2_data'] + +process.load("RecoLocalCalo.EcalRecAlgos.EcalSeverityLevelESProducer_cfi") + +if hasattr(process,'MessageLogger'): + process.MessageLogger.HBHEMuon=dict() + +process.maxEvents = cms.untracked.PSet( + input = cms.untracked.int32(-1) +) + +process.source = cms.Source("PoolSource", + fileNames = cms.untracked.vstring( + 'file:/eos/cms/store/group/dpg_hcal/comm_hcal/AmanKaur/HLTPhysics/RawtoReco_HLTPhysics/210910_053130/0000/RECO_RAW2DIGI_L1Reco_RECO_ALCA_1.root', + 'file:/eos/cms/store/group/dpg_hcal/comm_hcal/AmanKaur/HLTPhysics/RawtoReco_HLTPhysics/210910_053130/0000/RECO_RAW2DIGI_L1Reco_RECO_ALCA_2.root', + ) +) + +process.ALCARECOStreamHcalCalHBHEMuon = cms.OutputModule("PoolOutputModule", + SelectEvents = cms.untracked.PSet( + SelectEvents = cms.vstring('pathALCARECOHcalCalHBHEMuonProducerFilter') + ), + dataset = cms.untracked.PSet( + dataTier = cms.untracked.string('ALCARECO'), + filterName = cms.untracked.string('ALCARECOHcalCalHBHEMuonProducerFilter') + ), + eventAutoFlushCompressedSize = cms.untracked.int32(5242880), + outputCommands = process.OutALCARECOHcalCalHBHEMuonProducerFilter.outputCommands, + fileName = cms.untracked.string('OutputHBHEMuonProducerFilter.root'), + ) + +process.alcaHcalHBHEMuonProducer.triggers = [] + +# Path and EndPath definitions +process.endjob_step = cms.EndPath(process.endOfProcess) +process.ALCARECOStreamHcalCalHBHEMuonProducerFilterOutPath = cms.EndPath(process.ALCARECOStreamHcalCalHBHEMuon) + +# Schedule definition +process.schedule = cms.Schedule(process.pathALCARECOHcalCalHBHEMuonProducerFilter,process.endjob_step,process.ALCARECOStreamHcalCalHBHEMuonProducerFilterOutPath) diff --git a/Calibration/HcalAlCaRecoProducers/test/AlCaHEMuonProducerFilter_cfg.py b/Calibration/HcalAlCaRecoProducers/test/AlCaHEMuonProducerFilter_cfg.py new file mode 100644 index 0000000000000..0239d66cde21d --- /dev/null +++ b/Calibration/HcalAlCaRecoProducers/test/AlCaHEMuonProducerFilter_cfg.py @@ -0,0 +1,52 @@ +import FWCore.ParameterSet.Config as cms + +from Configuration.Eras.Era_Run2_2018_cff import Run2_2018 +process = cms.Process("AlCaHEMuon",Run2_2018) + +process.load('Configuration.StandardSequences.Services_cff') +process.load('FWCore.MessageService.MessageLogger_cfi') +process.load("Configuration.StandardSequences.GeometryRecoDB_cff") +process.load("Configuration.StandardSequences.MagneticField_cff") +process.load('Configuration.StandardSequences.AlCaRecoStreams_cff') +process.load('Configuration.StandardSequences.EndOfProcess_cff') +process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff') +from Configuration.AlCa.autoCond import autoCond +process.GlobalTag.globaltag=autoCond['run2_data'] + +process.load("RecoLocalCalo.EcalRecAlgos.EcalSeverityLevelESProducer_cfi") + +if hasattr(process,'MessageLogger'): + process.MessageLogger.HBHEMuon=dict() + +process.maxEvents = cms.untracked.PSet( + input = cms.untracked.int32(-1) +) + +process.source = cms.Source("PoolSource", + fileNames = cms.untracked.vstring( + 'file:/eos/cms/store/group/dpg_hcal/comm_hcal/AmanKaur/HLTPhysics/RawtoReco_HLTPhysics/210910_053130/0000/RECO_RAW2DIGI_L1Reco_RECO_ALCA_1.root', + 'file:/eos/cms/store/group/dpg_hcal/comm_hcal/AmanKaur/HLTPhysics/RawtoReco_HLTPhysics/210910_053130/0000/RECO_RAW2DIGI_L1Reco_RECO_ALCA_2.root', + ) +) + +process.ALCARECOStreamHcalCalHEMuon = cms.OutputModule("PoolOutputModule", + SelectEvents = cms.untracked.PSet( + SelectEvents = cms.vstring('pathALCARECOHcalCalHEMuonProducerFilter') + ), + dataset = cms.untracked.PSet( + dataTier = cms.untracked.string('ALCARECO'), + filterName = cms.untracked.string('ALCARECOHcalCalHEMuonProducerFilter') + ), + eventAutoFlushCompressedSize = cms.untracked.int32(5242880), + outputCommands = process.OutALCARECOHcalCalHEMuonProducerFilter.outputCommands, + fileName = cms.untracked.string('OutputHEMuonProducerFilter.root'), + ) + +process.alcaHcalHBHEMuonProducer.triggers = [] + +# Path and EndPath definitions +process.endjob_step = cms.EndPath(process.endOfProcess) +process.ALCARECOStreamHcalCalHEMuonProducerFilterOutPath = cms.EndPath(process.ALCARECOStreamHcalCalHEMuon) + +# Schedule definition +process.schedule = cms.Schedule(process.pathALCARECOHcalCalHEMuonProducerFilter,process.endjob_step,process.ALCARECOStreamHcalCalHEMuonProducerFilterOutPath) diff --git a/Calibration/HcalAlCaRecoProducers/test/AlCaHcalIsoTrk_cfg.py b/Calibration/HcalAlCaRecoProducers/test/AlCaHcalIsoTrk_cfg.py new file mode 100644 index 0000000000000..519aaf83573c2 --- /dev/null +++ b/Calibration/HcalAlCaRecoProducers/test/AlCaHcalIsoTrk_cfg.py @@ -0,0 +1,65 @@ +import FWCore.ParameterSet.Config as cms + +from Configuration.Eras.Era_Run2_2018_cff import Run2_2018 +process = cms.Process("ALCAISOTRACK",Run2_2018) + +process.load('Configuration.StandardSequences.Services_cff') +process.load('FWCore.MessageService.MessageLogger_cfi') +process.load("Configuration.StandardSequences.GeometryRecoDB_cff") +process.load("Configuration.StandardSequences.MagneticField_cff") +process.load('Configuration.StandardSequences.AlCaRecoStreams_cff') +process.load('Configuration.StandardSequences.EndOfProcess_cff') +process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff') +from Configuration.AlCa.autoCond import autoCond +process.GlobalTag.globaltag=autoCond['run2_mc'] +process.load("RecoLocalCalo.EcalRecAlgos.EcalSeverityLevelESProducer_cfi") + +if hasattr(process,'MessageLogger'): + process.MessageLogger.HcalIsoTrack=dict() + +process.options = cms.untracked.PSet( + wantSummary = cms.untracked.bool(True) +) + +process.maxEvents = cms.untracked.PSet( + input = cms.untracked.int32(-1) +) + +process.source = cms.Source("PoolSource", + fileNames = cms.untracked.vstring( + 'file:/afs/cern.ch/user/h/huwang/work/public/for_Sunanda/RECO_data.root', + ) +) + +process.load('RecoLocalCalo.CaloTowersCreator.calotowermaker_cfi') +process.towerMakerAll = process.calotowermaker.clone() +process.towerMakerAll.hbheInput = cms.InputTag("hbhereco") +process.towerMakerAll.hoInput = cms.InputTag("none") +process.towerMakerAll.hfInput = cms.InputTag("none") +process.towerMakerAll.ecalInputs = cms.VInputTag(cms.InputTag("ecalRecHit","EcalRecHitsEB"), cms.InputTag("ecalRecHit","EcalRecHitsEE")) +process.towerMakerAll.AllowMissingInputs = True + +process.ALCARECOStreamHcalCalIsoTrkProducerFilter = cms.OutputModule("PoolOutputModule", + SelectEvents = cms.untracked.PSet( + SelectEvents = cms.vstring('pathALCARECOHcalCalIsoTrkProducerFilter') + ), + dataset = cms.untracked.PSet( + dataTier = cms.untracked.string('ALCARECO'), + filterName = cms.untracked.string('ALCARECOHcalCalIsoTrkProducerFilter') + ), + eventAutoFlushCompressedSize = cms.untracked.int32(5242880), + outputCommands = process.OutALCARECOHcalCalIsoTrkProducerFilter.outputCommands, +# outputCommands = cms.untracked.vstring( +# 'keep *', +# ), + fileName = cms.untracked.string('newPoolOutput.root'), + ) + +process.alcaHcalIsotrkProducer.ignoreTriggers = True + +# Path and EndPath definitions +process.endjob_step = cms.EndPath(process.endOfProcess) +process.ALCARECOStreamHcalCalIsoTrkProducerFilterOutPath = cms.EndPath(process.ALCARECOStreamHcalCalIsoTrkProducerFilter) + +# Schedule definition +process.schedule = cms.Schedule(process.pathALCARECOHcalCalIsoTrkProducerFilter,process.endjob_step,process.ALCARECOStreamHcalCalIsoTrkProducerFilterOutPath) diff --git a/Calibration/HcalAlCaRecoProducers/test/AlCaIsoTrackFilterNoHLT_cfg.py b/Calibration/HcalAlCaRecoProducers/test/AlCaIsoTrackFilterNoHLT_cfg.py index 59b8090941980..a3a0754a2b8ff 100644 --- a/Calibration/HcalAlCaRecoProducers/test/AlCaIsoTrackFilterNoHLT_cfg.py +++ b/Calibration/HcalAlCaRecoProducers/test/AlCaIsoTrackFilterNoHLT_cfg.py @@ -2,7 +2,7 @@ from Configuration.Eras.Era_Run2_2018_cff import Run2_2018 -process = cms.Process('RECO',Run2_2018) +process = cms.Process('ALCARECO',Run2_2018) # import of standard configurations process.load('Configuration.StandardSequences.Services_cff') @@ -19,13 +19,14 @@ process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff') process.maxEvents = cms.untracked.PSet( - input = cms.untracked.int32(10) + input = cms.untracked.int32(-1) ) # Input source process.source = cms.Source("PoolSource", fileNames = cms.untracked.vstring( - 'file:/afs/cern.ch/user/h/huwang/work/public/for_Sunanda/UL_1TeV_pion_gun_RAW_0_0.root', + 'file:/afs/cern.ch/user/h/huwang/work/public/for_Sunanda/RECO_data.root', +# 'file:/afs/cern.ch/user/h/huwang/work/public/for_Sunanda/UL_1TeV_pion_gun_RAW_0_0.root', # "root://cmseos.fnal.gov//eos/uscms/store/user/lpcrutgers/huiwang/HCAL/UL_DoublePion_E-50_RAW_noPU-2020-12-25/UL_1TeV_pion_gun_RAW_0_0.root" ), #skipEvents = cms.untracked.uint32(516), @@ -54,7 +55,7 @@ ), eventAutoFlushCompressedSize = cms.untracked.int32(5242880), outputCommands = process.OutALCARECOHcalCalIsoTrkFilter.outputCommands, - fileName = cms.untracked.string('PoolOutput.root'), + fileName = cms.untracked.string('oldPoolOutput.root'), ) # Additional output definition @@ -70,7 +71,7 @@ process.ALCARECOStreamHcalCalIsoTrkFilterOutPath = cms.EndPath(process.ALCARECOStreamHcalCalIsoTrkFilter) # Schedule definition -process.schedule = cms.Schedule(process.raw2digi_step,process.reconstruction_step,process.pathALCARECOHcalCalIsoTrkFilterNoHLT,process.endjob_step,process.ALCARECOStreamHcalCalIsoTrkFilterOutPath) +process.schedule = cms.Schedule(process.pathALCARECOHcalCalIsoTrkFilterNoHLT,process.endjob_step,process.ALCARECOStreamHcalCalIsoTrkFilterOutPath) from PhysicsTools.PatAlgos.tools.helpers import associatePatAlgosToolsTask associatePatAlgosToolsTask(process) diff --git a/Calibration/HcalAlCaRecoProducers/test/di_cfg.py b/Calibration/HcalAlCaRecoProducers/test/di_cfg.py index 0c1ad62b0fac9..4a65cc9b38ce3 100644 --- a/Calibration/HcalAlCaRecoProducers/test/di_cfg.py +++ b/Calibration/HcalAlCaRecoProducers/test/di_cfg.py @@ -3,7 +3,7 @@ process = cms.Process("DIJETS") -process.load("Configuration.StandardSequences.Geometry_cff") +process.load("Configuration.StandardSequences.GeometryDB_cff") process.load("Configuration.StandardSequences.MagneticField_cff") process.maxEvents = cms.untracked.PSet( diff --git a/Calibration/HcalAlCaRecoProducers/test/phi_sym_cfg.py b/Calibration/HcalAlCaRecoProducers/test/phi_sym_cfg.py index a27e15e08809c..e3df22946ff96 100644 --- a/Calibration/HcalAlCaRecoProducers/test/phi_sym_cfg.py +++ b/Calibration/HcalAlCaRecoProducers/test/phi_sym_cfg.py @@ -3,7 +3,7 @@ process = cms.Process("PHISYM") -process.load("Configuration.StandardSequences.Geometry_cff") +process.load("Configuration.StandardSequences.GeometryDB_cff") process.load("Configuration.StandardSequences.MagneticField_cff") process.maxEvents = cms.untracked.PSet( diff --git a/Calibration/HcalCalibAlgos/src/TCell.h b/Calibration/HcalCalibAlgos/interface/TCell.h similarity index 100% rename from Calibration/HcalCalibAlgos/src/TCell.h rename to Calibration/HcalCalibAlgos/interface/TCell.h diff --git a/Calibration/HcalCalibAlgos/interface/hcalCalib.h b/Calibration/HcalCalibAlgos/interface/hcalCalib.h index c2311f816ac9f..c59db703b3ed9 100644 --- a/Calibration/HcalCalibAlgos/interface/hcalCalib.h +++ b/Calibration/HcalCalibAlgos/interface/hcalCalib.h @@ -27,9 +27,17 @@ #include #include -#include "TLorentzVector.h" -#include "TClonesArray.h" -#include "TRefArray.h" +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include // needed to get cell coordinates #include "Geometry/CaloGeometry/interface/CaloGeometry.h" @@ -84,6 +92,32 @@ class hcalCalib : public TSelector { TBranch *b_tagJetP4; //! TBranch *b_probeJetP4; //! + UInt_t nEvents; + + TFile *histoFile; + + // sanity check histograms + TH1F *h1_trkP; + TH1F *h1_allTrkP; + + TH1F *h1_selTrkP_iEta10; + + TH1F *h1_rawSumE; + TH1F *h1_rawResp; + TH1F *h1_corResp; + TH1F *h1_rawRespBarrel; + TH1F *h1_corRespBarrel; + TH1F *h1_rawRespEndcap; + TH1F *h1_corRespEndcap; + TH1F *h1_numEventsTwrIEta; + + TH2F *h2_dHitRefBarrel; + TH2F *h2_dHitRefEndcap; + + // histograms based on iEta, iPhi of refPosition forthe cluster (at the moment: hottest tower) + // expect range |iEta|<=24 (to do: add flexibility for arbitrary range) + TH1F *h1_corRespIEta[48]; + hcalCalib(TTree * /*tree*/ = nullptr) {} ~hcalCalib() override {} Int_t Version() const override { return 2; } @@ -204,60 +238,3 @@ class hcalCalib : public TSelector { }; #endif - -#ifdef hcalCalib_cxx -inline void hcalCalib::Init(TTree *tree) { - // The Init() function is called when the selector needs to initialize - // a new tree or chain. Typically here the branch addresses and branch - // pointers of the tree will be set. - // It is normaly not necessary to make changes to the generated - // code, but the routine can be extended by the user if needed. - // Init() will be called many times when running on PROOF - // (once per file to be processed). - - // Set object pointer - cells = nullptr; - tagJetP4 = nullptr; - probeJetP4 = nullptr; - - // Set branch addresses and branch pointers - if (!tree) - return; - fChain = tree; - - // fChain->SetMakeClass(1); - - fChain->SetBranchAddress("eventNumber", &eventNumber, &b_eventNumber); - fChain->SetBranchAddress("runNumber", &runNumber, &b_runNumber); - fChain->SetBranchAddress("iEtaHit", &iEtaHit, &b_iEtaHit); - fChain->SetBranchAddress("iPhiHit", &iPhiHit, &b_iPhiHit); - fChain->SetBranchAddress("cells", &cells, &b_cells); - fChain->SetBranchAddress("emEnergy", &emEnergy, &b_emEnergy); - fChain->SetBranchAddress("targetE", &targetE, &b_targetE); - fChain->SetBranchAddress("etVetoJet", &etVetoJet, &b_etVetoJet); - - fChain->SetBranchAddress("xTrkHcal", &xTrkHcal, &b_xTrkHcal); - fChain->SetBranchAddress("yTrkHcal", &yTrkHcal, &b_yTrkHcal); - fChain->SetBranchAddress("zTrkHcal", &zTrkHcal, &b_zTrkHcal); - fChain->SetBranchAddress("xTrkEcal", &xTrkEcal, &b_xTrkEcal); - fChain->SetBranchAddress("yTrkEcal", &yTrkEcal, &b_yTrkEcal); - fChain->SetBranchAddress("zTrkEcal", &zTrkEcal, &b_zTrkEcal); - - fChain->SetBranchAddress("tagJetEmFrac", &tagJetEmFrac, &b_tagJetEmFrac); - fChain->SetBranchAddress("probeJetEmFrac", &probeJetEmFrac, &b_probeJetEmFrac); - - fChain->SetBranchAddress("tagJetP4", &tagJetP4, &b_tagJetP4); - fChain->SetBranchAddress("probeJetP4", &probeJetP4, &b_probeJetP4); -} - -inline Bool_t hcalCalib::Notify() { - // The Notify() function is called when a new file is opened. This - // can be either for a new TTree in a TChain or when when a new TTree - // is started when using PROOF. It is normaly not necessary to make changes - // to the generated code, but the routine can be extended by the - // user if needed. The return value is currently not used. - - return kTRUE; -} - -#endif // #ifdef hcalCalib_cxx diff --git a/Calibration/HcalCalibAlgos/src/hcalCalibUtils.h b/Calibration/HcalCalibAlgos/interface/hcalCalibUtils.h similarity index 96% rename from Calibration/HcalCalibAlgos/src/hcalCalibUtils.h rename to Calibration/HcalCalibAlgos/interface/hcalCalibUtils.h index 088d7ea7e5d1c..106a843b0753e 100644 --- a/Calibration/HcalCalibAlgos/src/hcalCalibUtils.h +++ b/Calibration/HcalCalibAlgos/interface/hcalCalibUtils.h @@ -8,7 +8,7 @@ #include "DataFormats/DetId/interface/DetId.h" #include "DataFormats/HcalDetId/interface/HcalDetId.h" -#include "Calibration/HcalCalibAlgos/src/TCell.h" +#include "Calibration/HcalCalibAlgos/interface/TCell.h" #include "DataFormats/GeometryVector/interface/GlobalPoint.h" #include "DataFormats/GeometryVector/interface/GlobalVector.h" diff --git a/Calibration/HcalCalibAlgos/macros/hocalib_pl18.C b/Calibration/HcalCalibAlgos/macros/hocalib_pl18.C new file mode 100644 index 0000000000000..4b383859b1ff7 --- /dev/null +++ b/Calibration/HcalCalibAlgos/macros/hocalib_pl18.C @@ -0,0 +1,4005 @@ +/* +Identify digi and other correlaions +Increase range of Digi plots +Swap digi reco option +Noise : Second TS has sharp fall +Previous postion of SiPM : Problematic + + +hadd hist_hoprompt_r2017ae.root hist_r2017a_hoprompt_v2a_1.root hist_r2017a_hoprompt_v3a_1.root hist_hoprompt_r2017b_v1.root hist_r2017b_hoprompt_v2a_1.root hist_r2017c_hoprompt_v1a_1.root hist_hoprompt_r2017c_v2.root hist_hoprompt_r2017c_v3.root hist_hoprompt_r2017d_v1.root hist_hoprompt_r2017e_v1.root + + +*/ +const int netamx = 30; +const int nphimx = 72; +int getieta(int ij) { return (ij < netamx / 2) ? -netamx / 2 + ij : -netamx / 2 + ij + 1; } +int invert_ieta(int ieta) { return (ieta < 0) ? netamx / 2 + ieta : netamx / 2 + ieta - 1; } + +const int ncut = 14; +const int ringmx = 5; +const int nchnmx = 10; +const int routmx = 36; +const int rout12mx = 24; + +const int rbxmx = 12; // HO readout box in Ring 0 +const int rbx12mx = 6; //HO readout box in Ring+-1/2 +const int nprojtype = 5; // Varities due to types of muon projection +const char* projname[nprojtype] = {"Noise", "In RM", "3x3", "Proj", "Signal"}; +const int nprojmx = 4; +const int nseltype = 4; //Different crit for muon selection +const int nadmx = 18; +const int shapemx = 10; //checking shape + +static const int nhothresh = 10; // set threshold for noise filter + +TH2F* totalmuon; +TH2F* totalproj[9]; +TH2F* totalhpd[18]; + +TH2F* totalprojsig[9]; +TH2F* totalhpdsig[18]; + +TH2F* total2muon; +TH2F* total2proj[9]; +TH2F* total2hpd[18]; + +TH2F* total2projsig[9]; +TH2F* total2hpdsig[18]; + +Double_t gausX(Double_t* x, Double_t* par) { return par[0] * (TMath::Gaus(x[0], par[1], par[2], kTRUE)); } + +Double_t landX(Double_t* x, Double_t* par) { return par[0] * (TMath::Landau(x[0], par[1], par[2])); } + +Double_t completefit(Double_t* x, Double_t* par) { return gausX(x, par) + landX(x, &par[3]); } + +Double_t langaufun(Double_t* x, Double_t* par) { + //Fit parameters: + //par[0]*par[1]=Width (scale) parameter of Landau density + //par[1]=Most Probable (MP, location) parameter of Landau density + //par[2]=Total area (integral -inf to inf, normalization constant) + //par[3]=Width (sigma) of convoluted Gaussian function + // + //In the Landau distribution (represented by the CERNLIB approximation), + //the maximum is located at x=-0.22278298 with the location parameter=0. + //This shift is corrected within this function, so that the actual + //maximum is identical to the MP parameter. + // /* + // Numeric constants + Double_t invsq2pi = 0.3989422804014; // (2 pi)^(-1/2) + Double_t mpshift = -0.22278298; // Landau maximum location + + // Control constants + Double_t np = 100.0; // number of convolution steps + Double_t sc = 5.0; // convolution extends to +-sc Gaussian sigmas + + // Variables + Double_t xx; + Double_t mpc; + Double_t fland; + Double_t sum = 0.0; + Double_t xlow, xupp; + Double_t step; + + // MP shift correction + mpc = par[1] - mpshift * par[0] * par[1]; + double scale = 1; // par[1]; + double scale2 = 1; //anormglb; // for notmalisation this is one, otehrwise use the normalisation; + if (scale2 < .1) + scale2 = 0.1; + // double scale=par[1]; + // Range of convolution integral + xlow = x[0] - sc * scale * par[3]; + xupp = x[0] + sc * scale * par[3]; + + step = (xupp - xlow) / np; + + // Convolution integral of Landau and Gaussian by sum + for (double ij = 1.0; ij <= np / 2; ij++) { + xx = xlow + (ij - .5) * step; + fland = TMath::Landau(xx, mpc, par[0] * par[1], kTRUE); // / par[0]; + if (xx > par[1]) { + fland *= exp(-(xx - par[1]) / par[4]); + } + sum += fland * TMath::Gaus(x[0], xx, scale * par[3]); + xx = xupp - (ij - .5) * step; + fland = TMath::Landau(xx, mpc, par[0] * par[1], kTRUE); // / par[0]; + if (xx > par[1]) { + fland *= exp(-(xx - par[1]) / par[4]); + } + sum += fland * TMath::Gaus(x[0], xx, scale * par[3]); + } + return (par[2] * step * sum * invsq2pi / (scale2 * par[3])); +} + +Double_t totalfunc(Double_t* x, Double_t* par) { + return gausX(x, par) + langaufun(x, &par[3]); // /max(.001,anormglb); +} +// binroot hocalib_r2017e_hoprompt_v1a_1.root hocalib_r2017g_hoprompt_v1a_1.root hocalib_r2017h_hoprompt_v1a_1.root +void momentum() { + gStyle->SetOptStat(1110); + const int nfile = 3; + TH1F* histx[nfile]; + TTree* T1x; + char name[100]; + TCanvas* c1 = new TCanvas("c1", "runfile", 700, 300); + c1->Divide(3, 1); + + for (int ij = 0; ij < nfile; ij++) { + c1->cd(ij + 1); + sprintf(name, "hist_%i", ij); + histx[ij] = new TH1F(name, name, 120, -150., 150.); + if (ij == 0) { + // _file2->cd(); // T1x = (TTree*)_file0->Get("T1"); + } else if (ij == 1) { + // _file0->cd(); // T1x = (TTree*)_file1->Get("T1"); + } else { + // _file2->cd();// T1x = (TTree*)_file2->Get("T1"); + } + switch (ij) { + case 0: + _file0->cd(); + break; + case 1: + _file1->cd(); + break; + case 2: + _file2->cd(); + break; + } + + T1x = (TTree*)gDirectory->Get("T1"); + T1x->Project(name, "trkmm"); + // histx[ij]->Scale(1./TMath::Max(1.,histx[ij]->Integral())); + histx[ij]->Draw(); + // T1x->Draw("trkmm"); + } +} + +/* +binroot histalla_hcalcalho_2016btog.root + .L tdrstyle.C +setTDRStyle() +.L hocalib_pl16.C +plot_fitres(23, 42); + + +*/ + +void plot_fitres(int ieta = 13, int iphi = 70) { + gStyle->SetOptTitle(0); + gStyle->SetOptLogy(1); + // gStyle->SetOptStat(0); //1110); + // gStyle->SetLabelSize(0.095,"XYZ"); + // gStyle->SetLabelOffset(0.01,"XYZ"); + // gStyle->SetHistLineColor(1); + // gStyle->SetHistLineWidth(3); + // gStyle->SetPadTopMargin(0.02); + // gStyle->SetPadBottomMargin(0.12); + // gStyle->SetPadLeftMargin(0.14); + // gStyle->SetPadRightMargin(0.04); + // gStyle->SetPadGridX(3); + // gStyle->SetPadGridY(3); + // gStyle->SetGridStyle(2); + // gStyle->SetMarkerColor(1); + // gStyle->SetMarkerStyle(20); + // gStyle->SetMarkerSize(0.95); + // gStyle->SetNdivisions(506,"XY"); + // gStyle->SetLabelSize(0.095,"XYZ"); + // gStyle->SetLabelOffset(0.01,"XYZ"); + // gStyle->SetStatH(.1); + // gStyle->SetStatW(.4); + + // -14, 1 plot_fitres(1,0); + // double par[8]={139.1, 0.0327856, 0.070529, 0.137647, 1.69858, 79549.1, 0.307275, 5.71755}; + + // -8, 1 plot_fitres(7,0); + // double par[8]={31.5185, 0.0342954, 0.0599271, 0.151538, 1.10591, 91530.5, 0.22909, 8.65218}; + // -1, 1 plot_fitres(14,0); + double par[8] = {23.6947, 0.0178834, 0.0318413, 0.160218, 0.985584, 77652.5, 0.15613, 10.0053}; + + //-15, 1 + // double par[8]={89.055, 0.0277592, 0.057265, 0.106515, 1.80511, 36326, 0.36995, 6.04276}; + // 9, 43 plot_fitres(23,42) + // double par[8]={ 29.3954, 0.0339121, 0.0644736, 0.160249, 1.15268, 94723.6, 0.239194, 10.5442}; + // 10, 43 plot_fitres(24,42) + // double par[8]={0.100621, 0.0413684, 0.077322, 0.154082, 1.22422, 80333, 0.315477, 12.1145}; + // 11, 43 plot_fitres(25,42) + // double par[8]={0.91, 0.0523604, 0.1, 0.25, 1.24822, 71042.8, 0.373684, 5.42163}; + // 12, 43 plot_fitres(26,42) + // double par[8]={0.550151, 0.0584881, 0.1, 0.246599, 1.38702, 84966.5, 0.35758, 4.92687}; + + par[0] /= 18.0; + par[5] /= 18.0; + + const char title[100]; + TH1F* histx[2]; + TH1F* histy[2]; + + TF1* ped0fun; + TF1* pedfun; + TF1* sigfun; + TF1* signalx; + double xmn = -15.; + double xmx = 20.; + + TCanvas* c1 = new TCanvas("c1", "runfile", 600, 600); + // c1->Divide(2,1); + for (int i = 1; i < 2; i++) { + // c1->cd(i+1); + switch (i) { + case 0: + sprintf(title, "hoCalibc/ped_eta%i_phi%i", ieta, iphi); + break; + case 1: + sprintf(title, "hoCalibc/sig_eta%i_phi%i", ieta, iphi); + break; + } + + histy[i] = (TH1F*)gDirectory->Get(title); + histx[i] = (TH1F*)histy[i]->Clone(); + cout << "name " << title << " " << histx[i]->GetBinWidth(100) << " " << histx[i]->GetTitle() << endl; + // histx[i]->GetXaxis()->SetRangeUser(xmn, (i+1)*xmx); + histx[i]->SetLineColor(2 * (i + 1)); + histx[i]->SetLineWidth(2); + histx[i]->Rebin(10); + + histx[i]->SetMaximum(1.52 * histx[i]->GetMaximum()); + + // histx[i]->SetNdivisions(506,"XY"); + + // histx[i]->GetXaxis()->SetLabelSize(.055); + // histx[i]->GetYaxis()->SetLabelSize(.055); + // histx[i]->GetYaxis()->SetTitleOffset(1.4); + + switch (i) { + case 0: + histx[i]->GetXaxis()->SetRangeUser(-16., 16.); + histx[i]->GetXaxis()->SetTitle("HO Pedestal (GeV)"); + break; + case 1: + histx[i]->GetXaxis()->SetRangeUser(-20., 40.); + histx[i]->GetXaxis()->SetTitle("HO Signal (GeV)"); + break; + } + // histx[i]->GetXaxis()->SetTitleSize(.055); + // // histx[i]->GetXaxis()->CenterTitle(); + histx[i]->GetYaxis()->SetTitle("Nevents"); + // histx[i]->GetYaxis()->SetTitleSize(.055); + // if (i==0) histx[i]->GetXaxis()->SetRangeUser(-5., 5.); + histx[i]->Draw(); + } + + // c1->cd(1); + // TPaveText *ptst1 = new TPaveText(.85,0.9,.90,.95,"brNDC"); + // ptst1->SetFillColor(10); + // TText* text1 = ptst1->AddText("(a)"); + // text1->SetTextSize(0.062); + // ptst1->SetBorderSize(0); + // ptst1->Draw(); + + // ped0fun = new TF1("temp", gausX, xmn, xmx, 3); + // ped0fun->SetParameters(gaupr); + // ped0fun->SetLineColor(3); + // ped0fun->SetLineWidth(2); + // ped0fun->Draw("same"); + + // c1->cd(2); + + // TPaveText *ptst = new TPaveText(0.85,0.9,0.90,.95,"brNDC"); + // ptst->SetFillColor(10); + // TText* text = ptst->AddText("(b)"); + // text->SetTextSize(0.062); + // ptst->SetBorderSize(0); + // ptst->Draw(); + + pedfun = new TF1("ped0", gausX, xmn, 4 * xmx, 3); + pedfun->SetParameters(par); + pedfun->SetLineWidth(2); + pedfun->SetLineColor(3); + pedfun->Draw("same"); + + sigfun = new TF1("signalfun", langaufun, xmn, 4 * xmx, 5); + sigfun->SetParameters(&par[3]); + sigfun->SetLineWidth(2); + sigfun->SetLineColor(4); + sigfun->Draw("same"); + + signalx = new TF1("total", totalfunc, xmn, 4 * xmx, 8); + signalx->SetParameters(par); + signalx->SetLineWidth(2); + signalx->SetLineWidth(1); + signalx->Draw("same"); + + cmsPrel(.55, .75, .55, .75, 0.045, 35); +} + +/* + binroot fit_2016btog_ar1_float_par8_rng30.root + .L tdrstyle.C +setTDRStyle() +.L hocalib_pl16.C +const_term_1dx("const_eta_phi") +const_term_2d() +*/ + +/* +binroot fit_r2017a_v2_ar1_float_par8_rng25.root fit_r2017a_v3_ar1_float_par8_rng25.root fit_r2017b_v1_ar1_float_par8_rng25.root fit_r2017b_v2_ar1_float_par8_rng25.root fit_r2017c_v1_ar1_float_par8_rng25.root fit_r2017c_v2_ar1_float_par8_rng25.root fit_r2017c_v3_ar1_float_par8_rng25.root fit_r2017d_v1_ar1_float_par8_rng25.root fit_r2017e_v1_ar1_float_par8_rng25.root fit_r2017f_v1_ar1_float_par8_rng25.root fit_r2017g_v1_ar1_float_par8_rng25.root fit_r2017h_v1_ar1_float_par8_rng25.root fit_r2017ae_ar1_float_par8_rng25.root fit_r2017af_ar1_float_par8_rng25.root + + + + +*/ + +void all_1d4x() { + TCanvas* c1 = new TCanvas("c1", "c1", 700, 500); + c1->Divide(2, 2); + + _file0->cd(); + const_term_1d4x(); + _file1->cd(); + const_term_1d4x(); + _file2->cd(); + const_term_1d4x(); + _file3->cd(); + const_term_1d4x(); + _file4->cd(); + const_term_1d4x(); + _file5->cd(); + const_term_1d4x(); + _file6->cd(); + const_term_1d4x(); + _file7->cd(); + const_term_1d4x(); + _file8->cd(); + const_term_1d4x(); + _file9->cd(); + const_term_1d4x(); + _file10->cd(); + const_term_1d4x(); + _file11->cd(); + const_term_1d4x(); + _file12->cd(); + const_term_1d4x(); + _file13->cd(); + const_term_1d4x(); + + /* +fit_r2017a_v2_a +val 0.363+- 0.294 0.211+- 0.173 0.468+- 0.184 0.282+- 0.11 +err 5.461+- 0.27 4.622+- 0.155 4.444+- 0.177 4.765+- 0.092 +fit_r2017a_v3_a +val 0.554+- 0.105 -0.372+- 0.073 -0.165+- 0.08 -0.063+- 0.047 +err 2.205+- 0.096 2.039+- 0.06 2.029+- 0.066 2.159+- 0.037 +fit_r2017b_v1_a +val 1.577+- 0.043 0.964+- 0.032 1.234+- 0.035 1.208+- 0.021 +err 0.944+- 0.036 0.9+- 0.027 0.934+- 0.028 0.974+- 0.018 +fit_r2017b_v2_a +val 2.209+- 0.072 1.826+- 0.05 2.038+- 0.055 1.969+- 0.032 +err 1.54+- 0.073 1.37+- 0.039 1.397+- 0.047 1.485+- 0.026 +fit_r2017c_v1_a +val 2.439+- 0.056 1.933+- 0.04 2.125+- 0.046 2.118+- 0.027 +err 1.208+- 0.05 1.12+- 0.032 1.225+- 0.038 1.22+- 0.022 +fit_r2017c_v2_a +val 2.569+- 0.045 1.996+- 0.032 2.289+- 0.038 2.247+- 0.022 +err 0.969+- 0.035 0.93+- 0.028 0.97+- 0.034 0.995+- 0.018 +fit_r2017c_v3_a +val 2.657+- 0.044 2.128+- 0.033 2.349+- 0.036 2.332+- 0.021 +err 0.909+- 0.034 0.952+- 0.03 0.955+- 0.03 0.985+- 0.019 +fit_r2017d_v1_a +val 2.852+- 0.044 2.287+- 0.037 2.512+- 0.037 2.512+- 0.023 +err 0.925+- 0.042 1.019+- 0.032 0.925+- 0.031 1.018+- 0.02 +fit_r2017e_v1_a +val 3.04+- 0.042 2.448+- 0.034 2.836+- 0.036 2.742+- 0.021 +err 0.872+- 0.034 0.856+- 0.028 0.9+- 0.03 0.932+- 0.017 +fit_r2017f_v1_a +val 3.18+- 0.048 2.541+- 0.037 2.868+- 0.039 2.817+- 0.024 +err 1.036+- 0.037 1.038+- 0.033 1.038+- 0.035 1.092+- 0.021 +fit_r2017g_v1_a +val 0.035+- 0.155 -2.666+- 0.116 -4.415+- 0.099 -2.728+- 0.084 +err 3.17+- 0.141 3.098+- 0.102 2.42+- 0.087 3.351+- 0.062 +fit_r2017h_v1_a +val 0.116+- 0.079 -2.594+- 0.057 -4.639+- 0.055 -2.684+- 0.061 +err 1.705+- 0.077 1.531+- 0.052 1.43+- 0.041 2.384+- 0.041 +fit_r2017ae_ar1 +val 2.569+- 0.032 1.989+- 0.027 2.265+- 0.029 2.238+- 0.017 +err 0.711+- 0.027 0.738+- 0.023 0.761+- 0.026 0.795+- 0.015 +fit_r2017af_ar1 +val 2.68+- 0.032 2.064+- 0.027 2.36+- 0.029 2.328+- 0.018 +err 0.694+- 0.025 0.748+- 0.023 0.76+- 0.025 0.804+- 0.014 + + + + + */ +} + +void all_2d() { + TCanvas* c1 = new TCanvas("c1", "c1", 700, 400); + // c1->Divide(2,2); + + _file0->cd(); + const_term_2d(); + _file1->cd(); + const_term_2d(); + _file2->cd(); + const_term_2d(); + _file3->cd(); + const_term_2d(); + _file4->cd(); + const_term_2d(); + _file5->cd(); + const_term_2d(); + _file6->cd(); + const_term_2d(); + _file7->cd(); + const_term_2d(); + _file8->cd(); + const_term_2d(); + _file9->cd(); + const_term_2d(); + _file10->cd(); + const_term_2d(); + _file11->cd(); + const_term_2d(); + _file12->cd(); + const_term_2d(); + _file13->cd(); + const_term_2d(); +} + +void const_term_1d4x(const char* varname = "const_eta_phi") { + gStyle->SetOptTitle(0); + gStyle->SetOptFit(111); + gStyle->SetOptStat(1110); + gStyle->SetOptLogy(1); + gStyle->SetPadTopMargin(0.01); + gStyle->SetPadBottomMargin(0.13); + gStyle->SetPadLeftMargin(0.12); + gStyle->SetPadRightMargin(0.01); + gStyle->SetStatY(.99); //89); + gStyle->SetStatX(.99); //94); + gStyle->SetStatH(.22); + gStyle->SetStatW(.27); + + TLatex latex; + latex.SetNDC(); + latex.SetTextSize(0.075); + latex.SetTextFont(42); + latex.SetTextAlign(31); // align right + + TCanvas* c1 = new TCanvas("c1", "c1", 700, 400); + c1->Divide(2, 2); + + // for (int ixj=0; ixj<14; ixj++) { + // switch(ixj) { + // case 0 : _file0->cd(); break; + // case 1 : _file1->cd(); break; + // case 2 : _file2->cd(); break; + // case 3 : _file3->cd(); break; + // case 4 : _file4->cd(); break; + // case 5 : _file5->cd(); break; + // case 6 : _file6->cd(); break; + // case 7 : _file7->cd(); break; + // case 8 : _file8->cd(); break; + // case 9 : _file9->cd(); break; + // case 10 : _file10->cd(); break; + // case 11 : _file11->cd(); break; + // case 12 : _file12->cd(); break; + // case 13 : _file13->cd(); break; + // default : _file0->cd(); break; + // } + + TH2F* hist2d = (TH2F*)gDirectory->Get(varname); + TH1F* histx[4]; + histx[0] = new TH1F("histx0", "Correction factor - 1 (R0)", 120, -0.11, 0.29); //.9, 1.3); + histx[1] = new TH1F("histx1", "Correction factor - 1 (R#pm1)", 120, -0.11, 0.29); //.9, 1.3); + histx[2] = new TH1F("histx2", "Correction factor - 1 (R#pm2)", 120, -0.11, 0.29); //.9, 1.3); + histx[3] = new TH1F("histx3", "Correction factor - 1 (All)", 120, -0.11, 0.29); //.9, 1.3); + + char name[100] = gDirectory->GetName(); + char namex[20]; + char namey[50]; + strncpy(namex, name, 15); + char* pchy = strchr(namex, '_'); + int len = pchy - namex; + strncpy(namey, namex, len); + + cout << namex << " " << namey << endl; + float value[2][4] = {0}; + float error[2][4] = {0}; + + for (int ij = 0; ij < hist2d->GetNbinsX(); ij++) { + int ieta = getieta(ij); + for (int jk = 0; jk < hist2d->GetNbinsY(); jk++) { + double xx = hist2d->GetBinContent(ij + 1, jk + 1) - 1.0; + if (xx > -0.5) { + if (abs(ieta) <= 4) { + histx[0]->Fill(xx); + } else if (abs(ieta) <= 10) { + histx[1]->Fill(xx); + } else if (abs(ieta) <= 15) { + histx[2]->Fill(xx); + } + histx[3]->Fill(xx); + } + } + } + for (int ij = 0; ij < 4; ij++) { + c1->cd(ij + 1); + histx[ij]->GetXaxis()->SetTitle(histx[ij]->GetTitle()); + histx[ij]->GetXaxis()->SetLabelOffset(.001); + histx[ij]->GetXaxis()->SetLabelSize(0.0645); + histx[ij]->GetXaxis()->SetTitleSize(0.065); + histx[ij]->GetXaxis()->SetTitleOffset(0.99); + + histx[ij]->GetYaxis()->SetTitle("Entries/0.005"); + histx[ij]->GetYaxis()->SetLabelOffset(.001); + histx[ij]->GetYaxis()->SetLabelSize(0.0645); + histx[ij]->GetYaxis()->SetTitleSize(0.065); + histx[ij]->GetYaxis()->SetTitleOffset(0.85); + + histx[ij]->SetLineWidth(1); + TFitResultPtr ptr = histx[ij]->Fit("gaus", "QS"); + Int_t fitStatus = ptr; + if (fitStatus == 0) { + value[0][ij] = int(100000 * ptr->Parameter(1)) / 1000.; + value[1][ij] = int(100000 * ptr->Parameter(2)) / 1000.; + error[0][ij] = int(100000 * ptr->ParError(1)) / 1000.; + error[1][ij] = int(100000 * ptr->ParError(2)) / 1000.; + + // cout<Parameter(1))/1000.<<"+-"<< int(100000*ptr->ParError(1))/1000.<<" "<Parameter(2))/1000.<<"+-"<< int(100000*ptr->ParError(2))/1000.<SaveAs(namey); + + cout << "val "; + for (int ij = 0; ij < 4; ij++) { + cout << " " << setw(6) << value[0][ij] << "+-" << setw(6) << error[0][ij]; + } + cout << endl; + cout << "err "; + for (int ij = 0; ij < 4; ij++) { + cout << " " << setw(6) << value[1][ij] << "+-" << setw(6) << error[1][ij]; + } + cout << endl; + for (int ij = 0; ij < 4; ij++) { + if (histx[ij]) { + delete histx[ij]; + histx[ij] = 0; + } + } + // } +} + +void const_term_1dx(const char* varname = "const_eta_phi") { + ofstream file_out("test_output.log"); + gStyle->SetOptFit(101); + gStyle->SetOptStat(0); + gStyle->SetOptLogy(1); + gStyle->SetPadTopMargin(0.1); + gStyle->SetPadBottomMargin(0.11); + gStyle->SetPadLeftMargin(0.14); + gStyle->SetPadRightMargin(0.03); + gStyle->SetStatY(.93); //89); + gStyle->SetStatX(.98); //94); + gStyle->SetStatH(.16); + gStyle->SetStatW(.19); + + TH2F* hist2d[3]; + + hist2d[0] = (TH2F*)gDirectory->Get(varname); + hist2d[1] = (TH2F*)gDirectory->Get("const_eta_phisum"); + TH1F* histx[3]; + histx[0] = new TH1F("histx0", "const_eta_phi", 120, .7, 1.3); + histx[1] = new TH1F("histx1", "const_eta_phisum", 120, .7, 1.3); + histx[2] = new TH1F("histx2", "Correction term", 120, -.2, .2); + hist2d[2] = new TH2F("hist2d2", "hist2d2", 120, .9, 1.1, 120, .9, 1.1); + for (int ij = 0; ij < hist2d[0]->GetNbinsX(); ij++) { + // if (hist2d[0]->GetBinCenter(ij+1)==0) continue; + for (int jk = 0; jk < hist2d[0]->GetNbinsY(); jk++) { + double xx = hist2d[0]->GetBinContent(ij + 1, jk + 1); + if (xx > 0.5) { + histx[0]->Fill(xx); + } + if (ij != 15) + file_out << hist2d[0]->GetXaxis()->GetBinCenter(ij + 1) << "\t" << jk + 1 << "\t " << xx << endl; + + double yy = hist2d[1]->GetBinContent(ij + 1, jk + 1); + if (yy > 0.5) { + histx[1]->Fill(yy); + } + if (xx > .5 && yy > .5) { + histx[2]->Fill(yy - xx); + hist2d[2]->Fill(xx, yy); + } + } + } + TCanvas* c1 = new TCanvas("c1", "c1", 500, 500); + // c1->Divide(2,2); + /* c1->cd(1); histx[0]->Fit("gaus"); + c1->cd(2); histx[1]->Fit("gaus"); + c1->cd(3); histx[2]->Fit("gaus"); + */ + + histx[0]->GetXaxis()->SetTitle("Correction factor"); + histx[0]->GetXaxis()->SetLabelOffset(.001); + histx[0]->GetXaxis()->SetLabelSize(0.0645); + histx[0]->GetXaxis()->SetTitleSize(0.065); + histx[0]->GetXaxis()->SetTitleOffset(0.75); + + histx[0]->GetYaxis()->SetTitle("Entries/0.005"); + histx[0]->GetYaxis()->SetLabelOffset(.001); + histx[0]->GetYaxis()->SetLabelSize(0.0645); + histx[0]->GetYaxis()->SetTitleSize(0.065); + histx[0]->GetYaxis()->SetTitleOffset(1.05); + + histx[0]->SetLineWidth(1); + histx[0]->Fit("gaus"); + // c1->cd(4); gPad->SetLogy(0); hist2d[2]->Draw("colz"); + // cmsPrel(.25, .45, .85, .62, 0.04, 35); + file_out.close(); +} + +void const_term_2dx(const char* varname = "const_eta_phi") { + gStyle->SetOptStat(0); + gStyle->SetOptTitle(0); + gStyle->SetOptLogy(0); + + gStyle->SetPalette(1, 0); + gStyle->SetPadTopMargin(0.12); + gStyle->SetPadBottomMargin(0.12); + gStyle->SetPadLeftMargin(0.08); + gStyle->SetPadRightMargin(0.15); + + TH2F* hist2d = (TH2F*)gDirectory->Get(varname); + + hist2d->SetMaximum(1.5); + hist2d->SetMinimum(0.7); + hist2d->GetXaxis()->SetTitle("i#eta"); + hist2d->GetYaxis()->SetTitle("i#phi"); + + hist2d->Draw("colz"); + + cmsPrel2(.75, .5, .15, .92, 0.025, 35); +} + +double hothreshs[nhothresh + 1] = {0.15, 0.25, 0.5, 1.0, 2.0, 5.0, 10.0, 20., 50, 100., 10000.}; +void def_setting() { + gStyle->SetPadTopMargin(0.02); + gStyle->SetPadBottomMargin(0.15); + gStyle->SetPadLeftMargin(0.08); + gStyle->SetPadRightMargin(0.16); + gStyle->SetOptStat(0); + // gStyle->SetPadGridX(1); + // gStyle->SetPadGridY(1); + // gStyle->SetGridStyle(3); + gStyle->SetGridWidth(1); + gStyle->SetTitleFontSize(0.09); + gStyle->SetTitleOffset(-0.09); + gStyle->SetTitleBorderSize(1); + gStyle->SetLabelSize(0.095, "XY"); + gStyle->SetOptTitle(0); + gStyle->SetOptStat(0); + gStyle->SetNdivisions(404, "XYZ"); + + gStyle->SetStatTextColor(1); + gStyle->SetStatX(.99); + gStyle->SetStatY(.99); + gStyle->SetStatW(.3); + gStyle->SetStatH(.2); + + gStyle->SetOptLogy(0); +} + +void const_term(const char* varname = "const_eta_phi") { + ofstream file_out("test_output.log"); + gStyle->SetOptFit(101); + gStyle->SetOptStat(0); + gStyle->SetOptLogy(1); + gStyle->SetLabelSize(.065, "XY"); + + TH2F* hist2d[3]; + + hist2d[0] = (TH2F*)gDirectory->Get("const_eta_phi"); + hist2d[1] = (TH2F*)gDirectory->Get("const_eta_phisum"); + + TH1F* histx[3]; + histx[0] = new TH1F("histx0", "const_eta_phi", 120, .7, 1.3); + histx[1] = new TH1F("histx1", "const_eta_phisum", 120, .7, 1.3); + histx[2] = new TH1F("histx2", "diff", 120, -.2, .2); + hist2d[2] = new TH2F("hist2d2", "hist2d2", 120, .9, 1.1, 120, .9, 1.1); + + for (int ij = 0; ij < hist2d[0]->GetNbinsX(); ij++) { + // if (hist2d[0]->GetBinCenter(ij+1)==0) continue; + for (int jk = 0; jk < hist2d[0]->GetNbinsY(); jk++) { + double xx = hist2d[0]->GetBinContent(ij + 1, jk + 1); + if (xx > 0.5) { + histx[0]->Fill(xx); + } + if (ij != 15) + file_out << hist2d[0]->GetXaxis()->GetBinCenter(ij + 1) << "\t" << jk + 1 << "\t " << xx << endl; + + double yy = hist2d[1]->GetBinContent(ij + 1, jk + 1); + if (yy > 0.5) { + histx[1]->Fill(yy); + } + if (xx > .5 && yy > .5) { + histx[2]->Fill(yy - xx); + hist2d[2]->Fill(xx, yy); + } + } + } + TCanvas* c1 = new TCanvas("c1", "c1", 700, 900); + c1->Divide(2, 2); + c1->cd(1); + histx[0]->Fit("gaus"); + c1->cd(2); + histx[1]->Fit("gaus"); + c1->cd(3); + histx[2]->Fit("gaus"); + c1->cd(4); + gPad->SetLogy(0); + hist2d[2]->Draw("colz"); + file_out.close(); +} + +void const_term_2d(const char* varname = "const_eta_phi") { + gStyle->SetOptStat(0); + gStyle->SetOptTitle(0); + gStyle->SetPalette(1, 0); + gStyle->SetPadTopMargin(0.09); + gStyle->SetPadBottomMargin(0.11); + gStyle->SetPadLeftMargin(0.11); + gStyle->SetPadRightMargin(0.15); + + TLatex latex; + latex.SetNDC(); + latex.SetTextSize(0.065); + latex.SetTextFont(42); + latex.SetTextAlign(31); // align right + + TH2F* hist2d = (TH2F*)gDirectory->Get(varname); + + hist2d->GetXaxis()->SetLabelOffset(.001); + hist2d->GetXaxis()->SetLabelSize(0.064); + hist2d->GetXaxis()->SetTitle("i#eta"); + hist2d->GetXaxis()->SetTitleSize(0.065); + hist2d->GetXaxis()->SetTitleOffset(0.75); + hist2d->GetXaxis()->SetTitleColor(1); + hist2d->GetXaxis()->CenterTitle(); + + hist2d->GetYaxis()->SetLabelOffset(.001); + hist2d->GetYaxis()->SetLabelSize(0.064); + hist2d->GetYaxis()->SetTitleSize(0.065); + hist2d->GetYaxis()->SetTitle("i#phi"); + hist2d->GetYaxis()->SetTitleOffset(0.68); + hist2d->GetYaxis()->CenterTitle(); + + hist2d->GetZaxis()->SetLabelSize(0.045); + + // hist2d->SetMaximum(1.2); + hist2d->SetMinimum(0.7); + hist2d->Draw("colz"); //"colz"); + // //c1->SaveAs("test.png"); + // cout <<"XX "<SetLabelColor(1); + // palette->SetLabelFont(22); + // palette->SetLabelOffset(0.005); + // palette->SetLabelSize(0.0436); + // palette->SetTitleOffset(1); + // palette->SetTitleSize(0.08); + // palette->SetFillColor(100); + // palette->SetFillStyle(1001); + // hist2d->GetListOfFunctions()->Add(palette,"br"); + // hist2d->Draw("colz"); + // // cmsPrel2(.75, .5, .15, .92, 0.03, 35); + + char name[100] = gDirectory->GetName(); + char namex[20]; + char namey[50]; + strncpy(namex, name, 15); + cout << namex << endl; + latex.DrawLatex(0.65, 0.92, namex); + sprintf(namey, "statistics_2d_%s.png", namex); + c1->SaveAs(namey); +} + +void signal4(int ival = 0, int ndvy = 3) { + gStyle->SetOptStat(0); + gStyle->SetPadTopMargin(0.11); + gStyle->SetPadBottomMargin(0.08); + gStyle->SetPadLeftMargin(0.08); + gStyle->SetPadRightMargin(0.20); + TCanvas* c1 = new TCanvas("c1", "c1", 700, 900); + + char name[100]; + + c1->Divide(3, ndvy); + + TH2F* histx[100]; + for (int ij = 0; ij < 3 * ndvy; ij++) { + // sprintf(name, "hoCalibc/%s_%i", varnam, ij); + histx[ij] = (TH2F*)gDirectory->Get(name); + switch (ival) { + case 0: + histx[ij] = (TH2F*)totalproj[ij]->Clone(); + break; + case 1: + histx[ij] = (TH2F*)total2proj[ij]->Clone(); + break; + case 2: + histx[ij] = (TH2F*)totalprojsig[ij]->Clone(); + break; + case 3: + histx[ij] = (TH2F*)total2projsig[ij]->Clone(); + break; + case 4: + histx[ij] = (TH2F*)totalhpd[ij]->Clone(); + break; + case 5: + histx[ij] = (TH2F*)total2hpd[ij]->Clone(); + break; + case 6: + histx[ij] = (TH2F*)totalhpdsig[ij]->Clone(); + break; + case 7: + histx[ij] = (TH2F*)total2hpdsig[ij]->Clone(); + break; + default: + break; + } + c1->cd(ij + 1); + if (strstr(histx[ij]->GetName(), "sig")) { + histx[ij]->SetMaximum(TMath::Min(3., histx[ij]->GetMaximum())); + } + histx[ij]->GetXaxis()->SetLabelSize(0.075); + histx[ij]->GetYaxis()->SetLabelSize(0.075); + histx[ij]->GetZaxis()->SetLabelSize(0.065); + histx[ij]->GetXaxis()->SetNdivisions(404); + histx[ij]->GetYaxis()->SetNdivisions(404); + histx[ij]->Draw("colz"); + } + c1->Update(); +} + +// plot_var("sigvsacc") +void plot_var(int icut) { + const int nvar = 15; + gStyle->SetTitleFontSize(0.075); + gStyle->SetTitleBorderSize(1); + gStyle->SetPadTopMargin(0.10); + gStyle->SetPadBottomMargin(0.10); + char title[100]; + TCanvas* c1 = new TCanvas("c1", "runfile", 700., 900.); + c1->Divide(5, 3, 1.e-5, 1.e-5, 0); + + TH2F* fprofx[nvar]; + for (int ij = 0; ij < nvar; ij++) { + c1->cd(ij + 1); + sprintf(title, "hoCalibc/sigring_%i_%i", icut, ij); + + fprofx[ij] = (TH2F*)gDirectory->Get(title); + fprofx[ij]->GetXaxis()->SetLabelOffset(-0.03); + fprofx[ij]->GetXaxis()->SetLabelSize(0.085); + fprofx[ij]->GetYaxis()->SetLabelSize(0.075); + fprofx[ij]->GetZaxis()->SetLabelSize(0.065); + fprofx[ij]->GetYaxis()->SetNdivisions(404); + fprofx[ij]->GetXaxis()->SetNdivisions(404); + fprofx[ij]->SetLineColor(2); + fprofx[ij]->SetLineWidth(2); + + fprofx[ij]->Draw("colz"); + fprofx[ij]->ProfileX()->Draw("same"); + + // if (ij==7) { + // TPaveStats *ptst = new TPaveStats(0.5,0.5,0.7,0.6,"brNDC"); + // ptst->SetFillColor(10); + // TText* text = ptst->AddText(var); + // text->SetTextSize(0.092); + // ptst->SetBorderSize(1); + // // ptst->AddText(name); + // ptst->Draw(); + // } + } + c1->Update(); +} + +// plot_var("sigvsacc") +void plot_varprof(int icut) { + const int nvar = 15; + gStyle->SetTitleFontSize(0.075); + gStyle->SetTitleBorderSize(1); + gStyle->SetPadTopMargin(0.12); + gStyle->SetPadBottomMargin(0.10); + char title[100]; + TCanvas* c1 = new TCanvas("c1", "runfile", 700., 900.); + c1->Divide(5, 3, 1.e-5, 1.e-5, 0); + + TProfile* fprofx[nvar]; + for (int ij = 0; ij < nvar; ij++) { + c1->cd(ij + 1); + sprintf(title, "hoCalibc/sigring_%i_%i", icut, ij); + + fprofx[ij] = (TProfile*)(((TH2F*)gDirectory->Get(title))->ProfileX()); + fprofx[ij]->GetXaxis()->SetLabelOffset(-0.03); + fprofx[ij]->GetXaxis()->SetLabelSize(0.085); + fprofx[ij]->GetYaxis()->SetLabelSize(0.075); + fprofx[ij]->GetYaxis()->SetNdivisions(404); + fprofx[ij]->GetXaxis()->SetNdivisions(404); + fprofx[ij]->SetLineColor(2); + fprofx[ij]->SetLineWidth(2); + + fprofx[ij]->Draw(); + + // if (ij==7) { + // TPaveStats *ptst = new TPaveStats(0.5,0.5,0.7,0.6,"brNDC"); + // ptst->SetFillColor(10); + // TText* text = ptst->AddText(var); + // text->SetTextSize(0.092); + // ptst->SetBorderSize(1); + // // ptst->AddText(name); + // ptst->Draw(); + // } + } + c1->Update(); +} + +void plot_var_tray(int id = 0, int icut = 0) { + //plot_var_tray(0,1) + + char title[100]; + TCanvas* c1 = new TCanvas("c1", "runfile", 700., 900.); + c1->Divide(5, 6, 1.e-5, 1.e-5, 0); + + TH2F* fprofx[30]; + int itag = 0; + for (int jk = 0; jk < 6; jk++) { + for (int ij = 0; ij < 5; ij++) { + c1->cd(itag + 1); + sprintf(title, "hoCalibc/sigtray_%i_%i_%i", icut, 5 * id + ij, jk); + + fprofx[itag] = (TH2F*)gDirectory->Get(title); + fprofx[itag]->GetXaxis()->SetLabelOffset(-.001); + fprofx[itag]->GetXaxis()->SetLabelSize(0.085); + fprofx[itag]->GetYaxis()->SetLabelSize(0.085); + fprofx[itag]->GetZaxis()->SetLabelSize(0.065); + fprofx[itag]->GetYaxis()->SetNdivisions(404); + fprofx[itag]->GetXaxis()->SetNdivisions(404); + fprofx[itag]->SetLineColor(2); + fprofx[itag]->SetLineWidth(2); + + fprofx[itag]->Draw("colz"); + fprofx[itag]->ProfileX()->Draw("same"); + // if (itag==7) { + // TPaveStats *ptst = new TPaveStats(0.5,0.5,0.7,0.6,"brNDC"); + // ptst->SetFillColor(10); + // TText* text = ptst->AddText(var); + // text->SetTextSize(0.092); + // ptst->SetBorderSize(1); + // // ptst->AddText(name); + // ptst->Draw(); + // } + + itag++; + } + } + c1->Update(); +} + +void plot_var_trayprof(int id = 0, int icut = 0) { + //plot_var_tray(0,1) + + char title[100]; + TCanvas* c1 = new TCanvas("c1", "runfile", 700., 900.); + c1->Divide(5, 6, 1.e-5, 1.e-5, 0); + + TProfile* fprofx[30]; + int itag = 0; + for (int jk = 0; jk < 6; jk++) { + for (int ij = 0; ij < 5; ij++) { + c1->cd(itag + 1); + sprintf(title, "hoCalibc/sigtray_%i_%i_%i", icut, 5 * id + ij, jk); + + fprofx[itag] = (TProfile*)(((TH2F*)gDirectory->Get(title))->ProfileX()); + fprofx[itag]->GetXaxis()->SetLabelOffset(-.001); + fprofx[itag]->GetXaxis()->SetLabelSize(0.085); + fprofx[itag]->GetYaxis()->SetLabelSize(0.085); + fprofx[itag]->GetYaxis()->SetNdivisions(404); + fprofx[itag]->GetXaxis()->SetNdivisions(404); + fprofx[itag]->SetLineColor(2); + fprofx[itag]->SetLineWidth(2); + + fprofx[itag]->Draw(); + // if (itag==7) { + // TPaveStats *ptst = new TPaveStats(0.5,0.5,0.7,0.6,"brNDC"); + // ptst->SetFillColor(10); + // TText* text = ptst->AddText(var); + // text->SetTextSize(0.092); + // ptst->SetBorderSize(1); + // // ptst->AddText(name); + // ptst->Draw(); + // } + + itag++; + } + } + c1->Update(); +} + +void plot_var_eta(int id = 0, int icut = 0) { + //plot_var_eta(0,1) + + const int netamx = 30; + + char title[100]; + TCanvas* c1 = new TCanvas("c1", "runfile", 700., 900.); + c1->Divide(5, 6, 1.e-5, 1.e-5, 0); + + TH2F* fprofx[netamx]; + for (int ij = 0; ij < netamx; ij++) { + c1->cd(ij + 1); + sprintf(title, "hoCalibc/sigeta_%i_%i_%i", icut, id, ij); + fprofx[ij] = (TH2F*)gDirectory->Get(title); + fprofx[ij]->GetXaxis()->SetLabelOffset(-0.001); + fprofx[ij]->GetXaxis()->SetLabelSize(0.085); + fprofx[ij]->GetYaxis()->SetLabelSize(0.085); + fprofx[ij]->GetZaxis()->SetLabelSize(0.065); + fprofx[ij]->GetYaxis()->SetNdivisions(404); + fprofx[ij]->GetXaxis()->SetNdivisions(404); + fprofx[ij]->SetLineColor(2); + fprofx[ij]->SetLineWidth(2); + + fprofx[ij]->Draw("colz"); + fprofx[ij]->ProfileX()->Draw("same"); + + // if (ij==7) { + // TPaveStats *ptst = new TPaveStats(0.5,0.5,0.7,0.6,"brNDC"); + // ptst->SetFillColor(10); + // TText* text = ptst->AddText(var); + // text->SetTextSize(0.092); + // ptst->SetBorderSize(1); + // // ptst->AddText(name); + // ptst->Draw(); + // } + } + c1->Update(); +} + +void plot_var_etaprof(int id = 0, int icut = 0) { + //plot_var_eta(0,1) + + const int netamx = 30; + + char title[100]; + TCanvas* c1 = new TCanvas("c1", "runfile", 700., 900.); + c1->Divide(5, 6, 1.e-5, 1.e-5, 0); + + TProfile* fprofx[netamx]; + for (int ij = 0; ij < netamx; ij++) { + c1->cd(ij + 1); + sprintf(title, "hoCalibc/sigeta_%i_%i_%i", icut, id, ij); + fprofx[ij] = (TProfile*)(((TH2F*)gDirectory->Get(title))->ProfileX()); + fprofx[ij]->GetXaxis()->SetLabelOffset(-0.001); + fprofx[ij]->GetXaxis()->SetLabelSize(0.085); + fprofx[ij]->GetYaxis()->SetLabelSize(0.085); + fprofx[ij]->GetYaxis()->SetNdivisions(404); + fprofx[ij]->GetXaxis()->SetNdivisions(404); + fprofx[ij]->SetLineColor(2); + fprofx[ij]->SetLineWidth(2); + + fprofx[ij]->Draw(); + } + c1->Update(); +} + +void plotyx() { + // // sprintf (outfile,"%s.ps",outfilx); + // TPostScript ps("test.ps",111); + // ps.Range(20,28); + TCanvas* c1 = new TCanvas("c1", "runfile", 700., 900.); + + for (int kl = 0; kl < ncut; kl++) { + // ps.NewPage(); + plot_var(kl); + } + // ps.Close(); +} + +void plotallx() { + // // gDirectory->DeleteAll(); + // gStyle->Reset(); + gStyle->SetTitleFontSize(0.075); + gStyle->SetTitleBorderSize(1); + gStyle->SetPadTopMargin(0.12); + gStyle->SetPadBottomMargin(0.10); + gStyle->SetPadGridX(1); + gStyle->SetPadGridY(1); + gStyle->SetGridStyle(3); + gStyle->SetOptStat(0); + gStyle->SetTitleBorderSize(1); + + TCanvas* c1 = new TCanvas("c1", "runfile", 700., 900.); + int ips = 111; + // // sprintf (outfile,"%s.ps",outfilx); + TPostScript ps("test_2016e.ps", ips); + ps.Range(20, 28); + bool m_select_plot = true; + // cout<<"1xx "<SetTitleFontSize(0.095); + for (int ix = 0; ix < 3; ix++) { + for (int iy = 0; iy < ncut; iy++) { + ps.NewPage(); + plot_var_eta(ix, iy); + ps.NewPage(); + plot_var_etaprof(ix, iy); + } + } + + for (int ix = 0; ix < 3; ix++) { + for (int iy = 0; iy < ncut; iy++) { + ps.NewPage(); + plot_var_tray(ix, iy); + ps.NewPage(); + plot_var_trayprof(ix, iy); + } + } + } + + char name[100]; + totalmuon = (TH2F*)gDirectory->Get("hoCalibc/totalmuon"); + total2muon = (TH2F*)gDirectory->Get("hoCalibc/total2muon"); + + for (int ij = 0; ij < 9; ij++) { + sprintf(name, "hoCalibc/totalproj_%i", ij); + totalproj[ij] = (TH2F*)gDirectory->Get(name); + + sprintf(name, "hoCalibc/totalprojsig_%i", ij); + totalprojsig[ij] = (TH2F*)gDirectory->Get(name); + + sprintf(name, "hoCalibc/total2proj_%i", ij); + total2proj[ij] = (TH2F*)gDirectory->Get(name); + + sprintf(name, "hoCalibc/total2projsig_%i", ij); + total2projsig[ij] = (TH2F*)gDirectory->Get(name); + + total2projsig[ij]->Divide(total2proj[ij]); + totalprojsig[ij]->Divide(totalproj[ij]); + + total2proj[ij]->Divide(total2muon); + totalproj[ij]->Divide(totalmuon); + } + + for (int ij = 0; ij < 18; ij++) { + sprintf(name, "hoCalibc/totalhpd_%i", ij); + totalhpd[ij] = (TH2F*)gDirectory->Get(name); + + sprintf(name, "hoCalibc/totalhpdsig_%i", ij); + totalhpdsig[ij] = (TH2F*)gDirectory->Get(name); + + sprintf(name, "hoCalibc/total2hpd_%i", ij); + total2hpd[ij] = (TH2F*)gDirectory->Get(name); + + sprintf(name, "hoCalibc/total2hpdsig_%i", ij); + total2hpdsig[ij] = (TH2F*)gDirectory->Get(name); + + total2hpdsig[ij]->Divide(total2hpd[ij]); + totalhpdsig[ij]->Divide(totalhpd[ij]); + + total2hpd[ij]->Divide(total2muon); + totalhpd[ij]->Divide(totalmuon); + } + for (int ij = 0; ij < 8; ij++) { + ps.NewPage(); + signal4(ij, (ij <= 3) ? 3 : 6); + } + // cout<<"8xx "<Divide(4, 2); + c1->cd(1); + totalmuon->Draw("colz"); + c1->cd(2); + totalproj_3->Draw("colz"); + c1->cd(3); + totalproj_4->Draw("colz"); + c1->cd(4); + totalproj_5->Draw("colz"); + c1->cd(5); + total2muon->Draw("colz"); + c1->cd(6); + total2proj_3->Draw("colz"); + c1->cd(7); + total2proj_4->Draw("colz"); + c1->cd(8); + total2proj_5->Draw("colz"); +} + +void signal2() { + TCanvas* c1 = new TCanvas("c1", "c1", 800., 600.); + c1->Divide(4, 2); + c1->cd(1); + totalmuon->Draw("colz"); + c1->cd(2); + totalproj_3->Draw("colz"); + c1->cd(3); + totalproj_4->Draw("colz"); + c1->cd(4); + totalproj_5->Draw("colz"); + + c1->cd(6); + totalprojsig_3->Draw("colz"); + c1->cd(7); + totalprojsig_4->Draw("colz"); + c1->cd(8); + totalprojsig_5->Draw("colz"); +} +void signal3() { + TCanvas* c1 = new TCanvas("c1", "c1", 800., 600.); + c1->Divide(4, 2); + c1->cd(1); + total2muon->Draw("colz"); + c1->cd(2); + total2proj_3->Draw("colz"); + c1->cd(3); + total2proj_4->Draw("colz"); + c1->cd(4); + total2proj_5->Draw("colz"); + + c1->cd(6); + total2projsig_3->Draw("colz"); + c1->cd(7); + total2projsig_4->Draw("colz"); + c1->cd(8); + total2projsig_5->Draw("colz"); +} + +//signal4("totalproj",3); +//signal4("total2proj",3); +//signal4("totalprojsig",3); +//signal4("total2projsig",3); + +//signal4("totalhpd",6); +//signal4("total2hpd",6); +//signal4("totalhpdsig",6); +//signal4("total2hpdsig",6); + +// void signal4(const char* varnam="total2proj", int ndvy=3) { +// gStyle->SetOptStat(0); + +// TCanvas* c1 = new TCanvas("c1", "c1", 1200., 600.); + +// char name[100]; +// TH2F* histx[100]; +// c1->Divide(ndvy, 3); +// for (int ij=0; ij <3*ndvy; ij++) { +// sprintf(name, "%s_%i", varnam, ij); +// histx[ij] = (TH2F*)gDirectory->Get(name); +// c1->cd(ij+1); +// histx[ij]->Draw("colz"); +// } +// } + +void testplotx2(int thmn = 2, int thmx = 6) { + gStyle->SetPadTopMargin(0.11); + gStyle->SetPadBottomMargin(0.04); + gStyle->SetPadLeftMargin(0.06); + gStyle->SetPadRightMargin(0.02); + gStyle->SetOptStat(0); + gStyle->SetOptTitle(); + gStyle->SetPadGridX(1); + gStyle->SetPadGridY(1); + gStyle->SetGridStyle(3); + gStyle->SetGridWidth(1); + gStyle->SetTitleColor(10); + gStyle->SetTitleFontSize(0.09); + gStyle->SetTitleOffset(-0.09); + gStyle->SetTitleBorderSize(1); + gStyle->SetLabelSize(0.095, "XY"); + + // const int nfile=3; + // char* indexx[nfile]={"1_27", "28_122", "123_181"}; + + const int nringmx = 5; + + const int routmx = 36; + const int rout12mx = 24; + + const int rbxmx = 12; // HO readout box in Ring 0 + const int rbx12mx = 6; //HO readout box in Ring+-1/2 + + const int nprojmx = 4; + const int nseltype = 4; //Different crit for muon selection + const int nadmx = 18; + const int shapemx = 10; //checking shape + + char* projname[nprojmx] = {"totalproj", "totalprojsig", "totalhpd", "totalhpdsig"}; + + // TH2F* total2muon; + + TH2F* totalmuon[nseltype]; + TH2F* totalproj[nseltype][nprojmx][nadmx]; + + const int nprojtype = 5; // Varities due to types of muon projection + TH2F* histent[nprojtype + 3]; + TH2F* histen[nprojtype + 3]; + TH2F* histen2[nprojtype + 3]; + TH2F* histerr[nprojtype]; + + const int nhothresh = 10; + TH2F* h_allmucorrel[nhothresh]; + TH2F* hnorm_allmucorrel[nhothresh]; + + TH1F* endigicnt[nprojtype + 1][nhothresh]; + TH1F* endigisig[nprojtype + 1][nhothresh]; + + TH2F* rmdigicnt[nprojtype + 1][nhothresh]; + TH2F* rmdigisig[nprojtype + 1][nhothresh]; + + TH2F* ringdigicnt[nprojtype + 1][nhothresh]; + TH2F* ringdigisig[nprojtype + 1][nhothresh]; + + TH2F* inddigicnt[nprojtype + 1][nhothresh]; + TH2F* inddigisig[nprojtype + 1][nhothresh]; + + TH2F* indrecocnt[nprojtype + 1][nhothresh]; + TH2F* indrecosig[nprojtype + 1][nhothresh]; + + TH1F* rout_mult[nhothresh][nringmx][routmx + 1]; + TH1F* rbx_mult[nhothresh][nringmx][rbxmx + 1]; + + TH1F* rout_ind_energy[nringmx][routmx + 1]; + + TH2F* h_correlht[nhothresh]; + TH2F* h_correlsig[nringmx][nhothresh]; + TH2F* h_rmoccu[nhothresh]; + TH2F* h_rmcorrel[nhothresh]; + + TH2F* h_allcorrelsig[nhothresh]; + + TH2F* rbx_shape[shapemx][nringmx][routmx + 1]; + + char name[100]; + + int ips = 111; + TPostScript ps("allmuho.ps", ips); + ps.Range(20, 28); + + TFile* fx = new TFile("histall_apr14b_cosmic_csa14_cosmic.root", "read"); + // TFile* fx = new TFile("hist_apr14c_cosmic_csa14_cosmic.root", "read"); + // TFile* fx = new TFile("histall_cosmic_csa14_cosmic_set.root", "read"); + // TFile* fx = new TFile("apr14/apr14b/hist_cosmic_csa14_cosmic_set52.root", "read"); + for (int isel = 0; isel < nseltype; isel++) { + sprintf(name, "hoCalibc/totalmuon_%i", isel); + totalmuon[isel] = (TH2F*)fx->Get(name); + } + // total2muon = (TH2F*) fx->Get("hoCalibc/total2muon"); + + TCanvas* c0 = new TCanvas("c0", "mean rms", 600, 800); + c0->Divide(2, 2); + + TCanvas* c3 = new TCanvas("c3", "mean rms", 600, 800); + + TCanvas* c1 = new TCanvas("c1", "c1", 600, 900); + c1->Divide(3, 3); + + TCanvas* c2 = new TCanvas("c2", "c2", 600, 900); + c2->Divide(3, 6); + + TCanvas* c4x = new TCanvas("c4x", "c4x", 600., 800.); + c4x->Divide(2, 6); + + TCanvas* c4 = new TCanvas("c4", "c4", 600., 800.); + c4->Divide(2, 6); + + TCanvas* c5 = new TCanvas("c5", "c5", 600., 800.); + c5->Divide(6, 6); + + TCanvas* c6 = new TCanvas("c6", "c6", 600., 800.); + c6->Divide(2, 5); + + TH2F* h2d_nhocapid[nprojtype]; + TH2F* h2d_hocapidsig[nprojtype]; + TH2F* h2d_hocapidsigwo[nprojtype]; + + for (int ij = 0; ij < nprojtype; ij++) { + sprintf(name, "hoCalibc/nhocapid_%i", ij); + h2d_nhocapid[ij] = (TH2F*)fx->Get(name); + + sprintf(name, "hoCalibc/hocapidsig_%i", ij); + h2d_hocapidsig[ij] = (TH2F*)fx->Get(name); + + sprintf(name, "hoCalibc/hocapidsigwo_%i", ij); + h2d_hocapidsigwo[ij] = (TH2F*)fx->Get(name); + + h2d_hocapidsig[ij]->Divide(h2d_nhocapid[ij]); + h2d_hocapidsigwo[ij]->Divide(h2d_nhocapid[ij]); + + ps.NewPage(); + c3->cd(); + h2d_hocapidsig[ij]->Draw("colz"); + c3->Update(); + + ps.NewPage(); + c3->cd(); + h2d_hocapidsigwo[ij]->Draw("colz"); + c3->Update(); + } + + for (int ij = 0; ij < nprojtype; ij++) { + sprintf(name, "hoCalibc/hbentry_d%i", ij + 3); + cout << "ij " << name << endl; + histent[ij] = (TH2F*)fx->Get(name); + // histent[ij]->Draw(); + sprintf(name, "hoCalibc/hbsig_d%i", ij + 3); + histen[ij] = (TH2F*)fx->Get(name); + sprintf(name, "hoCalibc/hbsig2_d%i", ij + 3); + histen2[ij] = (TH2F*)fx->Get(name); + + int nentry = TMath::Max(1., histent[ij]->GetBinContent(0, 0)); + cout << "ij " << nentry << endl; + + histen[ij]->Divide(histent[ij]); + histen2[ij]->Divide(histent[ij]); + + histent[ij]->Scale(1. / nentry); + + int xbin = histen[ij]->GetNbinsX(); + int ybin = histen[ij]->GetNbinsY(); + sprintf(name, "histerr_%i", ij); //, indexx[ij]); + histerr[ij] = new TH2F(name, + name, + xbin, + histent[ij]->GetXaxis()->GetXmin(), + histent[ij]->GetXaxis()->GetXmax(), + ybin, + histent[ij]->GetYaxis()->GetXmin(), + histent[ij]->GetYaxis()->GetXmax()); + + for (int jk = 1; jk <= xbin; jk++) { + for (int kl = 1; kl <= ybin; kl++) { + double err = sqrt(histen2[ij]->GetBinContent(jk, kl) - + histen[ij]->GetBinContent(jk, kl) * histen[ij]->GetBinContent(jk, kl)); + + histerr[ij]->Fill(histent[ij]->GetXaxis()->GetBinCenter(jk), histent[ij]->GetYaxis()->GetBinCenter(kl), err); + } + } + + ps.NewPage(); + cout << "ij11 " << ij << " " << histent[ij]->GetBinContent(22, 22) << endl; + c0->cd(1); /*histent[ij]->GetXaxis()->SetRangeUser(-15.49,15.49);*/ + histent[ij]->Draw("colz"); + cout << "ij12 " << ij << " " << histen[ij]->GetBinContent(22, 22) << endl; + c0->cd(2); + histen[ij]->GetXaxis()->SetRangeUser(-15.49, 15.49); + histen[ij]->Draw("colz"); + cout << "ij13 " << ij << endl; + c0->cd(3); + histen2[ij]->GetXaxis()->SetRangeUser(-15.49, 15.49); + histen2[ij]->Draw("colz"); + cout << "ij14 " << ij << endl; + c0->cd(4); + histerr[ij]->GetXaxis()->SetRangeUser(-15.49, 15.49); + histerr[ij]->Draw("colz"); + cout << "ij15 " << ij << endl; + c0->Update(); + cout << "ij16 " << ij << endl; + } + + for (int jk = 0; jk < nringmx; jk++) { + for (int kl = 0; kl <= rbxmx; kl++) { + if (jk != 2 && kl > rbx12mx) + continue; + ps.NewPage(); + for (int lm = 0; lm < shapemx; lm++) { + if (kl == 0) { + sprintf(name, "hoCalibc/rbx_shape_%i_r%i_allrbx", lm, jk); + } else { + sprintf(name, "hoCalibc/rbx_shape_%i_r%i_%i", lm, jk, kl); + } + rbx_shape[lm][jk][kl] = (TH2F*)fx->Get(name); + c6->cd(int(lm / 5) + 2 * (lm % 5) + 1); + + rbx_shape[lm][jk][kl]->Draw("colz"); + } + c6->Update(); + } + } + + //Correlations + for (int ij = thmn; ij < thmx; ij++) { + sprintf(name, "hoCalibc/hocorrelht_%i", ij); + h_correlht[ij] = (TH2F*)fx->Get(name); + + h_correlht[ij]->Scale(1. / nentry); + + sprintf(name, "hoCalibc/hormoccu_%i", ij); + h_rmoccu[ij] = (TH2F*)fx->Get(name); + h_rmoccu[ij]->Scale(1. / nentry); + + sprintf(name, "hoCalibc/hormcorrel_%i", ij); + h_rmcorrel[ij] = (TH2F*)fx->Get(name); + h_rmcorrel[ij]->Scale(1. / nentry); + + for (int jk = 0; jk < nringmx; jk++) { + sprintf(name, "hoCalibc/hocorrelsig_%i_%i", jk, ij); + h_correlsig[jk][ij] = (TH2F*)fx->Get(name); + h_correlsig[jk][ij]->Scale(1. / nentry); + } + + cout << "ij2 " << ij << endl; + ps.NewPage(); + + c1->cd(1); + h_correlht[ij]->Draw("colz"); + // c1->cd(2); h_correlhten[ij][ij]->Draw("colz"); + c1->cd(2); + h_rmoccu[ij]->Draw("colz"); + c1->cd(3); + h_rmcorrel[ij]->Draw("colz"); + cout << "ij23 " << ij << endl; + for (int jk = 0; jk < nringmx; jk++) { + cout << "ij22 " << ij << endl; + c1->cd(jk + 4); + h_correlsig[jk][ij]->Draw("colz"); + } + cout << "ij21 " << ij << endl; + c1->Update(); + + sprintf(name, "hoCalibc/hoallcorrelsig_%i", ij); + cout << "ij24 " << ij << " " << name << endl; + h_allcorrelsig[ij] = (TH2F*)fx->Get(name); + h_allcorrelsig[ij]->Scale(1. / nentry); + cout << "ij25 " << ij << endl; + ps.NewPage(); + c3->cd(); + h_allcorrelsig[ij]->Draw("colz"); + c3->Update(); + cout << "ij2 " << ij << endl; + } + + for (int jk = 0; jk < nringmx; jk++) { + ps.NewPage(); + for (int kl = 1; kl <= routmx; kl++) { + if (jk != 2 && kl > rout12mx) + continue; + c5->cd(kl); + gPad->SetLogy(1); + if (kl == 0) { + sprintf(name, "hoCalibc/rout_ind_energy_r%i_allrout", jk); + } else { + sprintf(name, "hoCalibc/rout_ind_energy_r%i_%i", jk, kl); + } + rout_ind_energy[jk][kl] = (TH1F*)fx->Get(name); + rout_ind_energy[jk][kl]->Draw(); + } + c5->Update(); + } + + for (int ij = thmn; ij < thmx; ij++) { + // int klx=0; + for (int jk = 0; jk < nringmx; jk++) { + ps.NewPage(); + for (int kl = 1; kl <= routmx; kl++) { + if (jk != 2 && kl > rout12mx) + continue; + c5->cd(kl); + gPad->SetLogy(1); + if (kl == 0) { + sprintf(name, "hoCalibc/rout_mult_%i_r%i_allrout", ij, jk); + } else { + sprintf(name, "hoCalibc/rout_mult_%i_r%i_%i", ij, jk, kl); + } + rout_mult[ij][jk][kl] = (TH1F*)fx->Get(name); + rout_mult[ij][jk][kl]->Draw(); + } + c5->Update(); + } + } + + for (int ij = thmn; ij < thmx; ij++) { + int klx = 0; + for (int jk = 0; jk < nringmx; jk++) { + if (klx % 12 == 0) + ps.NewPage(); + for (int kl = 1; kl <= rbxmx; kl++) { + if (jk != 2 && kl > rbx12mx) + continue; + c4x->cd(klx % 12 + 1); + klx++; + gPad->SetLogy(1); + if (kl == 0) { + sprintf(name, "hoCalibc/rbx_mult_%i_r%i_allrbx", ij, jk); + } else { + sprintf(name, "hoCalibc/rbx_mult_%i_r%i_%i", ij, jk, kl); + } + rbx_mult[ij][jk][kl] = (TH1F*)fx->Get(name); + rbx_mult[ij][jk][kl]->Draw(); + } + if (klx % 12 == 0) + c4x->Update(); + } + } + + for (int ij = thmn; ij < thmx; ij++) { + for (int jk = 0; jk < nprojtype + 1; jk++) { + sprintf(name, "hoCalibc/endigisig_%i_%i", jk, ij); + cout << "name " << name << endl; + endigisig[jk][ij] = (TH1F*)fx->Get(name); + sprintf(name, "hoCalibc/endigicnt_%i_%i", jk, ij); + endigicnt[jk][ij] = (TH1F*)fx->Get(name); + + sprintf(name, "hoCalibc/rmdigisig_%i_%i", jk, ij); + rmdigisig[jk][ij] = (TH2F*)fx->Get(name); + sprintf(name, "hoCalibc/rmdigicnt_%i_%i", jk, ij); + rmdigicnt[jk][ij] = (TH2F*)fx->Get(name); + + sprintf(name, "hoCalibc/ringdigisig_%i_%i", jk, ij); + ringdigisig[jk][ij] = (TH2F*)fx->Get(name); + sprintf(name, "hoCalibc/ringdigicnt_%i_%i", jk, ij); + ringdigicnt[jk][ij] = (TH2F*)fx->Get(name); + + sprintf(name, "hoCalibc/inddigisig_%i_%i", jk, ij); + inddigisig[jk][ij] = (TH2F*)fx->Get(name); + sprintf(name, "hoCalibc/inddigicnt_%i_%i", jk, ij); + inddigicnt[jk][ij] = (TH2F*)fx->Get(name); + + sprintf(name, "hoCalibc/indrecosig_%i_%i", jk, ij); + indrecosig[jk][ij] = (TH2F*)fx->Get(name); + sprintf(name, "hoCalibc/indrecocnt_%i_%i", jk, ij); + indrecocnt[jk][ij] = (TH2F*)fx->Get(name); + + endigisig[jk][ij]->Divide(endigicnt[jk][ij]); + rmdigisig[jk][ij]->Divide(rmdigicnt[jk][ij]); + ringdigisig[jk][ij]->Divide(ringdigicnt[jk][ij]); + inddigisig[jk][ij]->Divide(inddigicnt[jk][ij]); + indrecosig[jk][ij]->Divide(indrecocnt[jk][ij]); + } + } + + ps.NewPage(); + + for (int ij = thmn; ij < thmx; ij++) { + ps.NewPage(); + for (int jk = 0; jk < nprojtype + 1; jk++) { + c4->cd(2 * jk + 1); + endigicnt[jk][ij]->Draw(); + c4->cd(2 * jk + 2); + endigisig[jk][ij]->Draw(); + } + c4->Update(); + } + + for (int ij = thmn; ij < thmx; ij++) { + ps.NewPage(); + for (int jk = 0; jk < nprojtype + 1; jk++) { + c4->cd(2 * jk + 1); + rmdigicnt[jk][ij]->Draw("colz"); + c4->cd(2 * jk + 2); + rmdigisig[jk][ij]->Draw("colz"); + } + c4->Update(); + } + + for (int ij = thmn; ij < thmx; ij++) { + ps.NewPage(); + for (int jk = 0; jk < nprojtype + 1; jk++) { + c4->cd(2 * jk + 1); + ringdigicnt[jk][ij]->Draw("colz"); + c4->cd(2 * jk + 2); + ringdigisig[jk][ij]->Draw("colz"); + } + c4->Update(); + } + + for (int ij = thmn; ij < thmx; ij++) { + ps.NewPage(); + for (int jk = 0; jk < nprojtype + 1; jk++) { + c4->cd(2 * jk + 1); + inddigicnt[jk][ij]->Draw("colz"); + c4->cd(2 * jk + 2); + inddigisig[jk][ij]->Draw("colz"); + } + c4->Update(); + } + + for (int ij = thmn; ij < thmx; ij++) { + ps.NewPage(); + for (int jk = 0; jk < nprojtype + 1; jk++) { + c4->cd(2 * jk + 1); + indrecocnt[jk][ij]->Draw("colz"); + c4->cd(2 * jk + 2); + indrecosig[jk][ij]->Draw("colz"); + } + c4->Update(); + } + + for (int ij = thmn; ij < thmx; ij++) { + sprintf(name, "hoCalibc/hoallmucorrel_%i", ij); + + double total = 0; + h_allmucorrel[ij] = (TH2F*)fx->Get(name); + hnorm_allmucorrel[ij] = (TH2F*)h_allmucorrel[ij]->Clone(); + for (int ix = 1; ix <= h_allmucorrel[ij]->GetNbinsX(); ix++) { + float anent = h_allmucorrel[ij]->GetBinContent(ix, 0); + total += anent; + cout << "ix " << ij << " " << ix << " " << anent << " " << total << endl; + if (anent < 1.) + anent = 1.; + for (int iy = 1; iy <= h_allmucorrel[ij]->GetNbinsY(); iy++) { + hnorm_allmucorrel[ij]->SetBinContent(ix, iy, h_allmucorrel[ij]->GetBinContent(ix, iy) / anent); + } + } + ps.NewPage(); + c3->cd(); + hnorm_allmucorrel[ij]->Draw("colz"); + c3->Update(); + } + + cout << "ij116 " << endl; + + for (int isel = 0; isel < nseltype; isel++) { + for (int ij = 0; ij < nprojmx / 2; ij++) { + ps.NewPage(); + for (int jk = 0; jk < nadmx / 2; jk++) { + sprintf(name, "hoCalibc/%s_%i_%i", projname[ij], isel, jk); + cout << "name " << name << endl; + totalproj[isel][ij][jk] = (TH2F*)fx->Get(name); + } + } + cout << "1ij116 " << endl; + for (int jk = 0; jk < nadmx / 2; jk++) { + totalproj[isel][1][jk]->Divide(totalproj[isel][0][jk]); + totalproj[isel][0][jk]->Divide(totalmuon[isel]); + } + + for (int ij = 0; ij < nprojmx / 2; ij++) { + ps.NewPage(); + for (int jk = 0; jk < nadmx / 2; jk++) { + c1->cd(jk + 1); + totalproj[isel][ij][jk]->Draw("colz"); + } + c1->Update(); + } + + cout << "2ij116 " << endl; + for (int ij = 2; ij < nprojmx; ij++) { + for (int jk = 0; jk < nadmx; jk++) { + sprintf(name, "hoCalibc/%s_%i_%i", projname[ij], isel, jk); + cout << "ij2 " << ij << " " << jk << " " << name << endl; + totalproj[isel][ij][jk] = (TH2F*)fx->Get(name); + } + } + cout << "3ij116 " << endl; + for (int jk = 0; jk < nadmx / 2; jk++) { + totalproj[isel][3][jk]->Divide(totalproj[isel][2][jk]); + totalproj[isel][2][jk]->Divide(totalmuon[isel]); + } + cout << "4ij116 " << endl; + + for (int ij = 2; ij < nprojmx; ij++) { + ps.NewPage(); + for (int jk = 0; jk < nadmx; jk++) { + c2->cd(jk + 1); + totalproj[isel][ij][jk]->Draw("colz"); + } + c2->Update(); + } + + cout << "5ij116 " << endl; + } + + ps.Close(); +} + +void testxx(int nproj = 1) { + def_setting(); + const int nprojtype = 5; // Varities due to types of muon projection + TH2F* histent[nprojtype + 3]; + TH2F* histen[nprojtype + 3]; + TH2F* histen2[nprojtype + 3]; + TH2F* histerr[nprojtype]; + gStyle->SetOptStat(0); + gStyle->SetPadTopMargin(0.06); + gStyle->SetPadBottomMargin(0.13); + gStyle->SetPadLeftMargin(0.10); + gStyle->SetPadRightMargin(0.12); + gStyle->SetLabelSize(0.065, "XY"); + + TLatex latex; + latex.SetNDC(); + latex.SetTextSize(0.07); + latex.SetTextFont(42); + latex.SetTextAlign(1); //(31); // align right + + cout << "testxxxx1 " << endl; + TCanvas* c1 = new TCanvas("c1", "c1", 800, 550); + cout << "testxxxx2 " << endl; + c1->Divide(2, 2); + // TFile* fx = new TFile("histall_apr14b_cosmic_csa14_cosmic.root", "read"); + char name[100]; + + for (int ij = 0; ij < nproj; ij++) { + sprintf(name, "hoCalibc/hbentry_d%i", ij + 3); + cout << "ij " << name << endl; + histent[ij] = (TH2F*)gDirectory->Get(name); + sprintf(name, "hoCalibc/hbsig_d%i", ij + 3); + histen[ij] = (TH2F*)gDirectory->Get(name); + sprintf(name, "hoCalibc/hbsig2_d%i", ij + 3); + histen2[ij] = (TH2F*)gDirectory->Get(name); + + int nentry = TMath::Max(1., histent[ij]->GetBinContent(0, 0)); + histen[ij]->Divide(histent[ij]); + histen2[ij]->Divide(histent[ij]); + + histent[ij]->Scale(1. / nentry); + + histen[ij]->GetXaxis()->SetLabelSize(0.065); + histen[ij]->GetYaxis()->SetLabelSize(0.065); + histen2[ij]->GetXaxis()->SetLabelSize(0.065); + histen2[ij]->GetYaxis()->SetLabelSize(0.065); + histent[ij]->GetXaxis()->SetLabelSize(0.065); + histent[ij]->GetYaxis()->SetLabelSize(0.065); + + int xbin = histen[ij]->GetNbinsX(); + int ybin = histen[ij]->GetNbinsY(); + sprintf(name, "histerr_%i", ij); //, indexx[ij]); + histerr[ij] = new TH2F(name, + name, + xbin, + histent[ij]->GetXaxis()->GetXmin(), + histent[ij]->GetXaxis()->GetXmax(), + ybin, + histent[ij]->GetYaxis()->GetXmin(), + histent[ij]->GetYaxis()->GetXmax()); + + for (int jk = 1; jk <= xbin; jk++) { + for (int kl = 1; kl <= ybin; kl++) { + double err = sqrt(histen2[ij]->GetBinContent(jk, kl) - + histen[ij]->GetBinContent(jk, kl) * histen[ij]->GetBinContent(jk, kl)); + + histerr[ij]->Fill(histent[ij]->GetXaxis()->GetBinCenter(jk), histent[ij]->GetYaxis()->GetBinCenter(kl), err); + } + } + + cout << "ij11 " << ij << " " << histent[ij]->GetBinContent(22, 22) << endl; + histent[ij]->GetXaxis()->SetTitle("i#eta"); + histent[ij]->GetXaxis()->SetTitleSize(0.075); + histent[ij]->GetXaxis()->SetTitleOffset(0.8); + histent[ij]->GetXaxis()->CenterTitle(); + histent[ij]->GetYaxis()->SetTitle("i#phi"); + histent[ij]->GetYaxis()->SetTitleSize(0.075); + histent[ij]->GetYaxis()->SetTitleOffset(0.6); + histent[ij]->GetYaxis()->CenterTitle(); + + c1->cd(1); + histent[ij]->Draw("colz"); + latex.DrawLatex(0.5, 0.95, "Occupancy"); + cout << "ij12 " << ij << " " << histen[ij]->GetBinContent(22, 22) << endl; + histen[ij]->GetXaxis()->SetTitle("i#eta"); + histen[ij]->GetXaxis()->SetTitleSize(0.075); + histen[ij]->GetXaxis()->SetTitleOffset(0.8); + histen[ij]->GetXaxis()->CenterTitle(); + histen[ij]->GetYaxis()->SetTitle("i#phi"); + histen[ij]->GetYaxis()->SetTitleSize(0.075); + histen[ij]->GetYaxis()->SetTitleOffset(0.6); + histen[ij]->GetYaxis()->CenterTitle(); + + c1->cd(2); + histen[ij]->Draw("colz"); + latex.DrawLatex(0.5, 0.95, "Mean"); + histen2[ij]->GetXaxis()->SetTitle("i#eta"); + histen2[ij]->GetXaxis()->SetTitleSize(0.075); + histen2[ij]->GetXaxis()->SetTitleOffset(0.8); + histen2[ij]->GetXaxis()->CenterTitle(); + histen2[ij]->GetYaxis()->SetTitle("i#phi"); + histen2[ij]->GetYaxis()->SetTitleSize(0.075); + histen2[ij]->GetYaxis()->SetTitleOffset(0.6); + histen2[ij]->GetYaxis()->CenterTitle(); + + c1->cd(3); + histen2[ij]->Draw("colz"); + latex.DrawLatex(0.5, 0.95, "(Mean^{2})"); + cout << "ij14 " << ij << endl; + histerr[ij]->GetXaxis()->SetTitle("i#eta"); + histerr[ij]->GetXaxis()->SetTitleSize(0.075); + histerr[ij]->GetXaxis()->SetTitleOffset(0.8); + histerr[ij]->GetXaxis()->CenterTitle(); + histerr[ij]->GetYaxis()->SetTitle("i#phi"); + histerr[ij]->GetYaxis()->SetTitleSize(0.075); + histerr[ij]->GetYaxis()->SetTitleOffset(0.6); + histerr[ij]->GetYaxis()->CenterTitle(); + + c1->cd(4); + histerr[ij]->Draw("colz"); + latex.DrawLatex(0.5, 0.95, "RMS"); + + cout << "ij15 " << ij << endl; + c1->Update(); + cout << "ij16 " << ij << endl; + + int nentry = TMath::Max(1., histent[ij]->GetBinContent(0, 0)); + cout << "ij " << nentry << endl; + } +} + +// plot000(-1,6,7,5) +// plot000(0,6,7,5) +// plot000(2,12,13,5) +// plot000(2,1,2,5) +// plot000(-1,1,2,5) +// plot000(3) +// plot000(2,5,10,5) + +void plot000(int irng = -1, int isect = 0, int isect2 = 5, int ntype = 1, const char* tag = "", int extcol = 0) { + def_setting(); + gStyle->SetOptLogy(1); + gStyle->SetOptStat(0); + gStyle->SetStatTextColor(3); + gStyle->SetStatY(.99); + gStyle->SetPadLeftMargin(0.12); + gStyle->SetPadRightMargin(0.02); + gStyle->SetPadTopMargin(0.02); + gStyle->SetPadBottomMargin(0.12); + TLatex latex; + latex.SetNDC(); + latex.SetTextSize(0.07); + // latex.SetTextColor(extcol+1); + latex.SetTextFont(42); + latex.SetTextAlign(1); //(31); // align right + /* + char pch1[200]; + cout<<" namec "<GetName()<GetName(); + int len =strstr(namex, "."); + int len1 =strstr(namex, "\\"); + int len2=strlen(namex); + + strncpy (pch1, namex+17, len2-22); + cout <<"name "<< namex<<" "<SetFillColor(10); + tleg->SetBorderSize(0); + tleg->SetTextFont(42); + + char name[100]; + if (!strstr(tag, "same")) { + TCanvas* c1 = new TCanvas("c1", "c1", 1000, 600); + if (irng >= 0 && isect2 - isect < 2) { + c1->Divide(5, 2, 1.e-6, 1.e-6); + tleg->SetTextSize(0.06); + } else { + if (irng < 0) { + c1->Divide(nchnmx, ringmx, 1.e-6, 1.e-6); + } else { + c1->Divide(nchnmx, ringmx + 1, 1.e-6, 1.e-6); + } + tleg->SetTextSize(0.10); + } + } + + TH1F* histx[nprojtype][ringmx][nchnmx]; + TH1F* histy[nprojtype][ringmx][nchnmx]; + + int nloop = (irng < 0) ? ringmx : isect2 - isect + 1; + cout << "nloop " << nloop << endl; + bool iscomb = false; //For combined sect + // for (int kl=0; kl= 5) + icol++; + if (icol >= 10) + icol++; + if (extcol > 0) + latex.SetTextColor(icol); + for (int ij = 0; ij < nloop; ij++) { + for (int jk = 0; jk < nchnmx; jk++) { + if (irng < 0) { + sprintf(name, "hoCalibc/ringavedigi_%i_%i_%i_%i", kl, ij, (ij == 2) ? rbxmx : rbx12mx, jk); + iscomb = true; + } else { + sprintf(name, "hoCalibc/ringavedigi_%i_%i_%i_%i", kl, irng, isect + ij, jk); + if ((irng == 2 && isect + ij == rbxmx) || (irng != 2 && isect + ij == rbx12mx)) + iscomb = true; + } + // cout<<"ij "<Get(name); + histx[kl][ij][jk] = (TH1F*)histy[kl][ij][jk]->Clone(); + histx[kl][ij][jk]->Rebin(3); + histx[kl][ij][jk]->Scale(1. / TMath::Max(1., histx[kl][ij][jk]->Integral())); + c1->cd(++ipad); + histx[kl][ij][jk]->GetXaxis()->SetTitle("HO digi"); + histx[kl][ij][jk]->GetXaxis()->SetTitleSize(0.075); + histx[kl][ij][jk]->GetXaxis()->SetTitleOffset(0.7); //0.85 + histx[kl][ij][jk]->GetXaxis()->CenterTitle(); + histx[kl][ij][jk]->GetXaxis()->SetLabelSize(0.075); + histx[kl][ij][jk]->GetXaxis()->SetLabelOffset(-0.005); + + histx[kl][ij][jk]->GetYaxis()->SetTitle(); + histx[kl][ij][jk]->GetYaxis()->SetTitleSize(0.085); + histx[kl][ij][jk]->GetYaxis()->SetTitleOffset(0.9); + histx[kl][ij][jk]->GetYaxis()->CenterTitle(); + histx[kl][ij][jk]->GetYaxis()->SetLabelSize(0.065); + histx[kl][ij][jk]->GetYaxis()->SetLabelOffset(0.01); + + histx[kl][ij][jk]->GetXaxis()->SetNdivisions(404); + histx[kl][ij][jk]->GetYaxis()->SetNdivisions(404); + + histx[kl][ij][jk]->SetLineColor(icol); + if (kl == 0) { + // histx[kl][ij][jk]->GetXaxis()->SetRangeUser(-1,300); + histx[kl][ij][jk]->Draw(tag); + if (jk == 0) { + if (irng < 0) { + latex.DrawLatex(0.65, 0.62, Form("Ring %i", ij - 2)); + } else { + if (iscomb) { + latex.DrawLatex(0.65, 0.85 - 0.08 * extcol, Form("R %i", irng - 2)); + } else { + latex.DrawLatex(0.65, 0.90 - 0.045 * extcol, Form("R%i Rbx%i", irng - 2, isect + ij)); + } + } + } + if (ij == 0 && (!strstr(tag, "same"))) + latex.DrawLatex(0.45, 0.88, Form("TS %i", jk)); + } else { + histx[kl][ij][jk]->Draw("same"); + } + + if (ij == 0 && jk == 0 && (!strstr(tag, "same"))) { + tleg->AddEntry(histx[kl][ij][jk], projname[kl], "lpfe"); + } + + cout << "kl " << kl << "" << ij << "" << jk << " " << histx[kl][ij][jk]->Integral() << " " + << histx[kl][ij][jk]->GetTitle() << endl; + } + } + } + if (!strstr(tag, "same")) { + tleg->Draw(); + } + if (strstr(tag, "sames")) { + c1->Update(); + } +} + +void plot000r(int irng = -1, int isup = 0, double xup = 200) { + def_setting(); + gStyle->SetOptLogy(1); + gStyle->SetOptStat(0); + gStyle->SetStatTextColor(3); + gStyle->SetStatY(.99); + gStyle->SetPadLeftMargin(0.14); + gStyle->SetPadRightMargin(0.02); + gStyle->SetPadTopMargin(0.02); + gStyle->SetPadBottomMargin(0.12); + TLatex latex; + latex.SetNDC(); + if (irng < 0) { + latex.SetTextSize(0.08); + } else { + latex.SetTextSize(0.075); + } + // latex.SetTextColor(extcol+1); + latex.SetTextFont(42); + latex.SetTextAlign(1); //(31); // align right + + TLegend* tleg = new TLegend(.5, 0.3, 0.8, 0.9, "", "brNDC"); + tleg->SetFillColor(10); + tleg->SetBorderSize(0); + tleg->SetTextFont(42); + + cout << "xx1x " << endl; + char name[100]; + int ysiz = (irng < 0) ? 350 : 450; + TCanvas* c1 = new TCanvas("c1", "c1", 900., ysiz); + tleg->SetTextSize(0.035); + if (irng < 0) { + tleg->SetTextSize(0.045); + c1->Divide(5, 1, 1.e-6, 1.e-6); + } else if (irng == 2) { + c1->Divide(4, 3, 1.e-6, 1.e-6); + } else { + c1->Divide(3, 2, 1.e-6, 1.e-6); + } + + cout << "xxx " << endl; + TH1F* histx[ringmx][routmx + 1]; + TH1F* histy[ringmx][routmx + 1]; + + int nloop11 = (irng < 0) ? 0 : irng; + int nloop12 = (irng < 0) ? ringmx : irng + 1; + int nloop2 = (irng < 0 && isup == 0) ? 1 : ((irng == 2 || isup > 0) ? 36 : 24); //12 : 6); + + bool iscomb = false; //For combined sect + cout << "xxx2 " << nloop11 << " " << nloop12 << " " << nloop2 << endl; + int ipad = 0; + for (int ij = nloop11; ij < nloop12; ij++) { + if (isup > 0) + c1->cd(++ipad); + for (int jk = 0; jk < nloop2; jk++) { + if (ij != 2 && jk >= 24) + continue; + cout << "xxx3 " << ij << " " << jk << endl; + if (irng < 0 && isup == 0) { + sprintf(name, "hoCalibc/rout_ind_energy_r%i_0", ij); + iscomb = true; + } else { + sprintf(name, "hoCalibc/rout_ind_energy_r%i_%i", ij, jk + 1); + } + + cout << "name " << name << endl; + histy[ij][jk] = (TH1F*)gDirectory->Get(name); + histx[ij][jk] = (TH1F*)histy[ij][jk]->Clone(); + // histx[ij][jk]->Rebin(2); + histx[ij][jk]->Scale(1. / TMath::Max(1., histx[ij][jk]->Integral())); + if (isup <= 0) + c1->cd(++ipad); + histx[ij][jk]->GetXaxis()->SetTitle("HO RECO (GeV)"); + histx[ij][jk]->GetXaxis()->SetTitleSize(0.065); + histx[ij][jk]->GetXaxis()->SetTitleOffset(0.85); //0.85 + histx[ij][jk]->GetXaxis()->CenterTitle(); + histx[ij][jk]->GetXaxis()->SetLabelSize(0.07); + histx[ij][jk]->GetXaxis()->SetLabelOffset(-0.003); + + histx[ij][jk]->GetYaxis()->SetTitle(); + histx[ij][jk]->GetYaxis()->SetTitleSize(0.085); + histx[ij][jk]->GetYaxis()->SetTitleOffset(0.9); + histx[ij][jk]->GetYaxis()->CenterTitle(); + histx[ij][jk]->GetYaxis()->SetLabelSize(0.07); + histx[ij][jk]->GetYaxis()->SetLabelOffset(0.01); + + histx[ij][jk]->GetXaxis()->SetNdivisions(404); + histx[ij][jk]->GetYaxis()->SetNdivisions(404); + histx[ij][jk]->GetXaxis()->SetRangeUser(0., xup); + // histx[ij][jk]->SetMinimum(1.e-8); + if (isup > 0) + histx[ij][jk]->SetLineColor(jk + 1); + histx[ij][jk]->Draw((jk > 0 && isup > 0) ? "same" : ""); + + if (isup > 0 && ij == 2) { + cout << "jk " << jk << endl; + tleg->AddEntry(histx[ij][jk], Form("RM %i", jk), "lpfe"); + } + + if (irng < 0) { + latex.DrawLatex(0.55, 0.92, Form("Ring %i", ij - 2)); + } else { + latex.DrawLatex(0.55, 0.92, Form("Ring %i Sec%i", ij - 2, jk)); + } + } + if (isup > 0 && ij == 2) + tleg->Draw(); + } + // if (!strstr(tag,"same")) tleg->Draw(); + c1->Update(); +} + +void plot00(int ityp = 0, int isect = 0) { + def_setting(); + gStyle->SetOptLogy(1); + gStyle->SetOptStat(1100); + gStyle->SetStatTextColor(3); + gStyle->SetStatY(.99); + gStyle->SetPadLeftMargin(0.09); + gStyle->SetPadRightMargin(0.02); + gStyle->SetPadTopMargin(0.02); + gStyle->SetPadBottomMargin(0.07); + TLatex latex; + latex.SetNDC(); + latex.SetTextSize(0.11); + latex.SetTextFont(42); + latex.SetTextAlign(1); //(31); // align right + + char name[100]; + TCanvas* c1 = new TCanvas("c1", "c1", 1000., 600.); + c1->Divide(nchnmx, ringmx, 1.e-6, 1.e-6); + + TH1F* histx[ringmx][nchnmx]; + int icol = 0; + for (int ij = 0; ij < ringmx; ij++) { + for (int jk = 0; jk < nchnmx; jk++) { + // sprintf(name, "hoCalibc/ringavedigi_%i_%i", ij, jk); + sprintf(name, "hoCalibc/ringavedigi_%i_%i_%i_%i", ityp, ij, isect, jk); + // cout<<"ij "<Get(name); + + c1->cd(++icol); + histx[ij][jk]->GetXaxis()->SetTitle("HO digi"); + histx[ij][jk]->GetXaxis()->SetTitleSize(0.095); + histx[ij][jk]->GetXaxis()->SetTitleOffset(0.75); //0.85 + histx[ij][jk]->GetXaxis()->CenterTitle(); + histx[ij][jk]->GetXaxis()->SetLabelSize(0.085); + histx[ij][jk]->GetXaxis()->SetLabelOffset(0.001); + + histx[ij][jk]->GetYaxis()->SetTitle(); + histx[ij][jk]->GetYaxis()->SetTitleSize(0.085); + histx[ij][jk]->GetYaxis()->SetTitleOffset(0.9); + histx[ij][jk]->GetYaxis()->CenterTitle(); + histx[ij][jk]->GetYaxis()->SetLabelSize(0.07); + histx[ij][jk]->GetYaxis()->SetLabelOffset(0.01); + + histx[ij][jk]->SetLineColor(3); + histx[ij][jk]->Draw(); + if (jk == 0) + latex.DrawLatex(0.65, 0.62, Form("Ring %i", ij - 2)); + if (ij == 0) + latex.DrawLatex(0.65, 0.42, Form("TS %i", jk)); + } + } + c1->Update(); +} + +//root hocalib_cosmic_csa14_cosmic_set50_59.root +// root apr14/apr14b/hocalib_apr14b_cosmic_csa14_cosmic.root +// plot01(0) : //signal refion +// plot01(1) : //noise region +// plot01(2) : //total region +void plot01(int ityp = 0, int islocal = 1) { + def_setting(); + gStyle->SetOptLogy(1); + gStyle->SetOptStat(0); + gStyle->SetStatTextColor(3); + gStyle->SetStatY(.99); + gStyle->SetPadRightMargin(0.02); + + gStyle->SetPadTopMargin(0.02); + TLatex latex; + latex.SetNDC(); + latex.SetTextSize(0.08); + latex.SetTextFont(42); + latex.SetTextAlign(1); //(31); // align right + + char name[100]; + TCanvas* c1 = new TCanvas("c1", "c1", 800., 400.); + c1->Divide(5, 1); + + TH1F* histx[ringmx][nprojtype]; + TH1F* histy[ringmx][nprojtype]; + + int nloop = (islocal == 1) ? 1 : nprojtype; + for (int jk = 0; jk < nloop; jk++) { + for (int ij = 0; ij < ringmx; ij++) { + sprintf(name, "hoCalibc/hoindringen_%i_%i", ij, jk); + + cout << "name " << name << endl; + histy[ij][jk] = (TH1F*)gDirectory->Get(name); + histx[ij][jk] = (TH1F*)histy[ij][jk]->Clone(); + histx[ij][jk]->Rebin(4); + histx[ij][jk]->Scale(1. / histx[ij][jk]->Integral()); + } + } + for (int jk = 0; jk < nloop; jk++) { + for (int ij = 0; ij < ringmx; ij++) { + c1->cd(ij + 1); + histx[ij][jk]->GetXaxis()->SetTitle((islocal) ? "Noise (GeV)" : "HO signal/noise (GeV)"); + histx[ij][jk]->GetXaxis()->SetTitleSize(0.075); + histx[ij][jk]->GetXaxis()->SetTitleOffset(0.65); //0.85 + histx[ij][jk]->GetXaxis()->CenterTitle(); + histx[ij][jk]->GetXaxis()->SetLabelSize(0.065); + histx[ij][jk]->GetXaxis()->SetLabelOffset(-0.001); + + histx[ij][jk]->GetYaxis()->SetTitle(); + histx[ij][jk]->GetYaxis()->SetTitleSize(0.075); + histx[ij][jk]->GetYaxis()->SetTitleOffset(0.9); + histx[ij][jk]->GetYaxis()->CenterTitle(); + histx[ij][jk]->GetYaxis()->SetLabelSize(0.05); + histx[ij][jk]->GetYaxis()->SetLabelOffset(0.01); + + histx[ij][jk]->SetLineColor(jk + 1); + if (jk == 0) { + double xmn = histx[ij][jk]->GetXaxis()->GetXmin(); + double xmx = histx[ij][jk]->GetXaxis()->GetXmax(); + if (ityp == 0) { + histx[ij][jk]->GetXaxis()->SetRangeUser(xmn, 5.); + } else if (ityp == 1) { + histx[ij][jk]->GetXaxis()->SetRangeUser(2, xmx); + } else { + histx[ij][jk]->GetXaxis()->SetRangeUser(xmn, xmx); + } + // histx[ij][jk]->Scale(1./histx[ij][jk]->GetEntries()); + histx[ij][jk]->Draw(); + latex.DrawLatex(0.25, 0.82, Form("Ring %i", ij - 2)); + } else { + histx[ij][jk]->Draw("same"); + } + // cout<<"ijjk "<< ij<<" "<GetEntries()<<" " <Integral()<<" "<GetTitle()<Update(); +} + +//root hocalib_cosmic_csa14_cosmic_set50_59.root +// root apr14/apr14b/hocalib_apr14b_cosmic_csa14_cosmic.root +void plot1() { + def_setting(); + gStyle->SetOptStat(1100); + gStyle->SetStatTextColor(3); + gStyle->SetStatY(.99); + gStyle->SetPadRightMargin(0.02); + + gStyle->SetPadTopMargin(0.05); + TLatex latex; + latex.SetNDC(); + latex.SetTextSize(0.08); + latex.SetTextFont(42); + latex.SetTextAlign(1); //(31); // align right + + char name[100]; + TCanvas* c1 = new TCanvas("c1", "c1", 800., 600.); + c1->Divide(2, 2); + + TH1F* histx[8]; + for (int ij = 0; ij < 8; ij++) { + sprintf(name, "signal_%i", ij); + histx[ij] = new TH1F(name, name, 100, -0.2, 5.8); + // histx[1] = new TH1F("noise", "noise", 100, -.2, 5.8); + + // TTree Ttree = gDirectory->Get("T1"); + switch (ij) { + case 0: + T1->Project(name, "hosig[4]", "isect>0&&(int(isect/100)-50)<-10&&abs(hodx)>1&&abs(hody)>1&&ndof>20"); + break; + case 1: + T1->Project(name, + "hosig[4]", + "isect>0&&(int(isect/100)-50)>=-10&&(int(isect/100)-50)<-5&&abs(hodx)>1&&abs(hody)>1&&ndof>20"); + break; + case 2: + T1->Project(name, + "hosig[4]", + "isect>0&&(int(isect/100)-50)>=-4&&(int(isect/100)-50)<5&&abs(hodx)>1&&abs(hody)>1&&ndof>20"); + break; + case 3: + T1->Project(name, + "hosig[4]", + "isect>0&&(int(isect/100)-50)>=4&&(int(isect/100)-50)<11&&abs(hodx)>1&&abs(hody)>1&&ndof>20"); + break; + case 4: + T1->Project(name, "hocro", "isect>0&&(int(isect/100)-50)<-10&&abs(hodx)>1&&abs(hody)>1&&ndof>20"); + break; + case 5: + T1->Project(name, + "hocro", + "isect>0&&(int(isect/100)-50)>=-10&&(int(isect/100)-50)<-5&&abs(hodx)>1&&abs(hody)>1&&ndof>20"); + break; + case 6: + T1->Project(name, + "hocro", + "isect>0&&(int(isect/100)-50)>=-4&&(int(isect/100)-50)<5&&abs(hodx)>1&&abs(hody)>1&&ndof>20"); + break; + case 7: + T1->Project(name, + "hocro", + "isect>0&&(int(isect/100)-50)>=4&&(int(isect/100)-50)<11&&abs(hodx)>1&&abs(hody)>1&&ndof>20"); + break; + } + } + for (int ij = 0; ij < 8; ij++) { + c1->cd(ij % 4 + 1); + histx[ij]->GetXaxis()->SetTitle("HO signal/noise (GeV)"); + histx[ij]->GetXaxis()->SetTitleSize(0.075); + histx[ij]->GetXaxis()->SetTitleOffset(0.75); //0.85 + histx[ij]->GetXaxis()->CenterTitle(); + histx[ij]->GetXaxis()->SetLabelSize(0.065); + histx[ij]->GetXaxis()->SetLabelOffset(0.001); + + histx[ij]->GetYaxis()->SetTitle(); + histx[ij]->GetYaxis()->SetTitleSize(0.075); + histx[ij]->GetYaxis()->SetTitleOffset(0.9); + histx[ij]->GetYaxis()->CenterTitle(); + histx[ij]->GetYaxis()->SetLabelSize(0.05); + histx[ij]->GetYaxis()->SetLabelOffset(0.01); + + if (ij < 4) { + histx[ij]->SetLineColor(3); + histx[ij]->SetMaximum(1.1 * histx[ij + 4]->GetMaximum()); + histx[ij]->Draw(); + latex.DrawLatex(0.25, 0.82, Form("Ring %i", ij - 2)); + } else { + if (ij == 4) { + c1->Update(); + gStyle->SetStatTextColor(2); + gStyle->SetStatY(.79); + } + histx[ij]->SetLineColor(2); + histx[ij]->Draw("sames"); + } + // histx[1]->Draw("sames"); + } + c1->Update(); +} + +//root hocalib_cosmic_csa14_cosmic_set50_59.root +// root apr14/apr14b/hocalib_apr14b_cosmic_csa14_cosmic.root +void plot1a() { + def_setting(); + gStyle->SetOptStat(1100); + gStyle->SetOptLogy(1); + gStyle->SetStatTextColor(3); + gStyle->SetStatY(.99); + gStyle->SetPadRightMargin(0.02); + TLatex latex; + latex.SetNDC(); + latex.SetTextSize(0.08); + latex.SetTextFont(42); + latex.SetTextAlign(1); //(31); // align right + + char name[100]; + TCanvas* c1 = new TCanvas("c1", "c1", 800., 600.); + c1->Divide(2, 2); + + TH1F* histx[8]; + for (int ij = 0; ij < 8; ij++) { + sprintf(name, "signal_%i", ij); + histx[ij] = new TH1F(name, name, 100, 0.5, 19.5); + // histx[1] = new TH1F("noise", "noise", 100, -.2, 5.8); + + // TTree Ttree = gDirectory->Get("Tcor1"); + switch (ij) { + case 0: + Tcor1->Project(name, "hocellen", "hocomu>0&&(int(hocomu/100)-50)<-10&&int(icapid/10.)==4"); + break; + case 1: + Tcor1->Project( + name, "hocellen", "hocomu>0&&(int(hocomu/100)-50)>=-10&&(int(hocomu/100)-50)<-5&&int(icapid/10.)==4"); + break; + case 2: + Tcor1->Project( + name, "hocellen", "hocomu>0&&(int(hocomu/100)-50)>=-4&&(int(hocomu/100)-50)<5&&int(icapid/10.)==4"); + break; + case 3: + Tcor1->Project( + name, "hocellen", "hocomu>0&&(int(hocomu/100)-50)>=4&&(int(hocomu/100)-50)<11&&int(icapid/10.)==4"); + break; + case 4: + Tcor1->Project(name, "hocellen", "hocomu>0&&(int(hocomu/100)-50)<-10&&int(icapid/10.)==0"); + break; + case 5: + Tcor1->Project( + name, "hocellen", "hocomu>0&&(int(hocomu/100)-50)>=-10&&(int(hocomu/100)-50)<-5&&int(icapid/10.)==0"); + break; + case 6: + Tcor1->Project( + name, "hocellen", "hocomu>0&&(int(hocomu/100)-50)>=-4&&(int(hocomu/100)-50)<5&&int(icapid/10.)==0"); + break; + case 7: + Tcor1->Project( + name, "hocellen", "hocomu>0&&(int(hocomu/100)-50)>=4&&(int(hocomu/100)-50)<11&&int(icapid/10.)==0"); + break; + } + + c1->cd(ij % 4 + 1); + histx[ij]->GetXaxis()->SetTitle("HO signal/noise (GeV)"); + histx[ij]->GetXaxis()->SetTitleSize(0.075); + histx[ij]->GetXaxis()->SetTitleOffset(0.75); //0.85 + histx[ij]->GetXaxis()->CenterTitle(); + histx[ij]->GetXaxis()->SetLabelSize(0.065); + histx[ij]->GetXaxis()->SetLabelOffset(0.001); + + histx[ij]->GetYaxis()->SetTitle(); + histx[ij]->GetYaxis()->SetTitleSize(0.075); + histx[ij]->GetYaxis()->SetTitleOffset(0.9); + histx[ij]->GetYaxis()->CenterTitle(); + histx[ij]->GetYaxis()->SetLabelSize(0.055); + histx[ij]->GetYaxis()->SetLabelOffset(0.01); + + if (ij < 4) { + histx[ij]->SetLineColor(3); + + histx[ij]->Draw(); + latex.DrawLatex(0.25, 0.82, Form("Ring %i", ij - 2)); + + } else { + if (ij == 4) { + c1->Update(); + gStyle->SetStatTextColor(2); + gStyle->SetStatY(.79); + } + + histx[ij]->SetLineColor(2); + histx[ij]->Draw("sames"); + } + // histx[1]->Draw("sames"); + } + c1->Update(); +} + +// root histall_apr14b_cosmic_csa14_cosmic.root +//plot2(1,4,0) + +void plot2(int ith1 = 1, int ith2 = 4, int iproj = 0) { + def_setting(); + gStyle->SetOptStat(0); + gStyle->SetPadTopMargin(0.07); + gStyle->SetPadBottomMargin(0.12); + gStyle->SetPadLeftMargin(0.11); + gStyle->SetPadRightMargin(0.14); + + TLatex latex; + latex.SetNDC(); + latex.SetTextSize(0.06); + latex.SetTextFont(42); + latex.SetTextAlign(1); //(31); // align right + + char name[100]; + TH2F* histx[10]; + TH2F* histy[10]; + TCanvas* c1 = new TCanvas("c1", "c1", 800., 600.); + c1->Divide(2, 2); + TH2F* histz = (TH2F*)gDirectory->Get("hoCalibc/hbentry_d3"); + int nentry = histz->GetBinContent(0, 0); + + icnt = 0; + cout << "nentry = " << nentry << endl; + for (int ij = ith1; ij <= ith2; ij++) { + // sprintf(name, "hoCalibc/indrecosig_%i_%i", iproj, ij); + // indrecosig[jk][ij] = (TH2F*)fx->Get(name); + sprintf(name, "hoCalibc/indrecocnt_%i_%i", iproj, ij); + histy[icnt] = (TH2F*)gDirectory->Get(name); + histx[icnt] = (TH2F*)histy[icnt]->Clone(); + + c1->cd(icnt + 1); + cout << "icnt " << icnt << " " << histx[icnt]->GetTitle() << endl; + histx[icnt]->Scale(1. / nentry); + histx[icnt]->GetXaxis()->SetTitle("i#eta"); + histx[icnt]->GetXaxis()->SetTitleSize(0.075); + histx[icnt]->GetXaxis()->SetTitleOffset(0.75); //0.85 + histx[icnt]->GetXaxis()->CenterTitle(); + histx[icnt]->GetXaxis()->SetLabelSize(0.065); + histx[icnt]->GetXaxis()->SetLabelOffset(0.001); + + histx[icnt]->GetYaxis()->SetTitle("i#phi"); + histx[icnt]->GetYaxis()->SetTitleSize(0.075); + histx[icnt]->GetYaxis()->SetTitleOffset(0.7); + histx[icnt]->GetYaxis()->CenterTitle(); + histx[icnt]->GetYaxis()->SetLabelSize(0.065); + histx[icnt]->GetYaxis()->SetLabelOffset(0.01); + + histx[icnt]->GetZaxis()->SetLabelSize(0.048); + histx[icnt]->GetZaxis()->SetLabelOffset(0.01); + histx[icnt]->GetZaxis()->SetNdivisions(406); + + histx[icnt]->Draw("colz"); + latex.DrawLatex(.4, .95, Form("%g Update(); +} +// root histall_apr14b_cosmic_csa14_cosmic.root +//xx plot3(0) +//xx plot3(1) +//xx plot3(2) +//xx plot3(3) + +void plot3(int isel = 0) { + def_setting(); + gStyle->SetOptStat(0); + gStyle->SetPadTopMargin(0.05); + gStyle->SetPadBottomMargin(0.1); + gStyle->SetPadLeftMargin(0.08); + gStyle->SetPadRightMargin(0.14); + char name[100]; + TH2F* histx[9]; + TH2F* histy[9]; + + TLatex latex; + latex.SetNDC(); + latex.SetTextSize(0.08); + latex.SetTextFont(42); + latex.SetTextAlign(1); //(31); // align right + + sprintf(name, "hoCalibc/totalmuon_%i", isel); + TH2F* totalmuon = (TH2F*)gDirectory->Get(name); + + TCanvas* c1 = new TCanvas("c1", "c1", 800., 600.); + c1->Divide(3, 3, 1.e-6, 1.e-6); + for (int ij = 0; ij < 9; ij++) { + sprintf(name, "hoCalibc/totalproj_%i_%i", isel, ij); + histy[ij] = (TH2F*)gDirectory->Get(name); + histx[ij] = (TH2F*)histy[ij]->Clone(); + + histx[ij]->Divide(totalmuon); + + c1->cd(ij + 1); + // histx[ij]->GetXaxis()->SetTitle("i#eta"); + histx[ij]->GetXaxis()->SetTitleSize(0.075); + histx[ij]->GetXaxis()->SetTitleOffset(0.75); //0.85 + histx[ij]->GetXaxis()->CenterTitle(); + histx[ij]->GetXaxis()->SetLabelSize(0.065); + histx[ij]->GetXaxis()->SetLabelOffset(0.001); + + // histx[ij]->GetYaxis()->SetTitle("i#phi"); + histx[ij]->GetYaxis()->SetTitleSize(0.075); + histx[ij]->GetYaxis()->SetTitleOffset(0.7); + histx[ij]->GetYaxis()->CenterTitle(); + histx[ij]->GetYaxis()->SetLabelSize(0.055); + histx[ij]->GetYaxis()->SetLabelOffset(0.01); + + histx[ij]->GetZaxis()->SetLabelSize(0.055); + histx[ij]->GetZaxis()->SetLabelOffset(0.01); + histx[ij]->GetZaxis()->SetNdivisions(406); + histx[ij]->Draw("colz"); + } + c1->Update(); +} +// root histall_apr14b_cosmic_csa14_cosmic.root +// plot4(1,3,0,0) +void plot4(int ith1 = 0, int ith2 = 8, int isel1 = 0, int isel2 = 0) { + def_setting(); + gStyle->SetOptStat(0); + gStyle->SetPadTopMargin(0.02); + gStyle->SetPadBottomMargin(0.15); + gStyle->SetPadLeftMargin(0.15); + gStyle->SetPadRightMargin(0.02); + char name[100]; + TH1F* histx[10][9]; + TH1F* histy[10][9]; + TH1F* histz[10][9]; + + TLatex latex; + latex.SetNDC(); + latex.SetTextSize(0.055); + latex.SetTextFont(42); + latex.SetTextAlign(3); //(31); // align right + + int nydiv = (isel2 == isel1) ? 1 : 2; + // TCanvas* c1 = new TCanvas("c1", "c1", 800., (nydiv==1) ? 350 : 600.); + // c1->Divide(3,nydiv,1.e-6,1.e-6); + TCanvas* c1 = new TCanvas("c1", "c1", 800., 600.); + c1->Divide(3, 3, 1.e-6, 1.e-6); + + const int nbin = 5; + TString labels[nbin] = {"Ring-2", "Ring-1", "Ring0", "Ring+1", "Ring+2"}; + + for (int ij = ith1; ij <= ith2; ij++) { + sprintf(name, "hoCalibc/endigisig_%i_%i", isel1, ij); + histz[0][ij] = (TH1F*)gDirectory->Get(name); + + sprintf(name, "hoCalibc/endigisig_%i_%i", isel2, ij); + histz[1][ij] = (TH1F*)gDirectory->Get(name); + + sprintf(name, "hoCalibc/endigicnt_%i_%i", isel1, ij); + histy[0][ij] = (TH1F*)gDirectory->Get(name); + + sprintf(name, "hoCalibc/endigicnt_%i_%i", isel2, ij); + histy[1][ij] = (TH1F*)gDirectory->Get(name); + } + + int icol = 0; + for (int jk = 0; jk < nydiv; jk++) { + for (int ij = ith1; ij <= ith2; ij++) { + histx[jk][ij] = (TH1F*)histz[jk][ij]->Clone(); + histx[jk][ij]->Divide(histy[jk][ij]); + c1->cd(++icol); + cout << "ij " << icol << " " << ij << " " << jk << " " << histy[jk][ij]->GetTitle() << endl; + + histx[jk][ij]->GetXaxis()->SetLabelSize(0.05); + histx[jk][ij]->GetXaxis()->SetLabelOffset(0.001); + + histx[jk][ij]->GetYaxis()->SetLabelSize(0.045); + histx[jk][ij]->GetYaxis()->SetLabelOffset(0.01); + + histx[jk][ij]->GetXaxis()->SetTitle("Time slice in Five rings"); + histx[jk][ij]->GetXaxis()->SetTitleSize(0.055); + histx[jk][ij]->GetXaxis()->SetTitleOffset(1.2); //0.85 + histx[jk][ij]->GetXaxis()->CenterTitle(); + histx[jk][ij]->GetXaxis()->SetLabelSize(0.075); + histx[jk][ij]->GetXaxis()->SetLabelOffset(0.01); + + histx[jk][ij]->GetYaxis()->SetTitle("Signal (fC/GeV)"); + histx[jk][ij]->GetYaxis()->SetTitleSize(0.055); + histx[jk][ij]->GetYaxis()->SetTitleOffset(1.3); + histx[jk][ij]->GetYaxis()->CenterTitle(); + histx[jk][ij]->GetYaxis()->SetLabelSize(0.065); + histx[jk][ij]->GetYaxis()->SetLabelOffset(0.01); + + histx[jk][ij]->GetXaxis()->SetNdivisions(406); + histx[jk][ij]->GetYaxis()->SetNdivisions(406); + + for (int kl = 0; kl < nbin; kl++) { + histx[jk][ij]->GetXaxis()->SetBinLabel(10 * kl + 6, labels[kl]); + } + histx[jk][ij]->GetXaxis()->LabelsOption("h"); + histx[jk][ij]->Draw(); + + latex.DrawLatex(0.40, 0.93, Form("%g Update(); +} + +// root histall_apr14b_cosmic_csa14_cosmic.root +// plot5(1,3,0,0) +void plot5(int ith1 = 1, int ith2 = 3, int isel1 = 0, int isel2 = 4, double amx = -1.0) { + def_setting(); + gStyle->SetOptStat(0); + gStyle->SetPadTopMargin(0.02); + gStyle->SetPadBottomMargin(0.15); + gStyle->SetPadLeftMargin(0.15); + gStyle->SetPadRightMargin(0.14); + + char name[100]; + TH2F* histx[5][9]; + TH2F* histy[5][9]; + TH2F* histz[5][9]; + + const int nbin = 5; + TString labels[nbin] = {"Ring-2", "Ring-1", "Ring0", "Ring+1", "Ring+2"}; + + int nydiv = (isel1 == isel2) ? 1 : 2; + TCanvas* c1 = new TCanvas("c1", "c1", 800., (nydiv == 1) ? 350 : 600.); + c1->Divide(3, nydiv, 1.e-6, 1.e-6); + + for (int ij = ith1; ij <= ith2; ij++) { + sprintf(name, "hoCalibc/rmdigisig_%i_%i", isel1, ij); + histz[0][ij] = (TH2F*)gDirectory->Get(name); + + sprintf(name, "hoCalibc/rmdigisig_%i_%i", isel2, ij); + histz[1][ij] = (TH2F*)gDirectory->Get(name); + + sprintf(name, "hoCalibc/rmdigicnt_%i_%i", isel1, ij); + histy[0][ij] = (TH2F*)gDirectory->Get(name); + + sprintf(name, "hoCalibc/rmdigicnt_%i_%i", isel2, ij); + histy[1][ij] = (TH2F*)gDirectory->Get(name); + } + + int icol = 0; + for (int jk = 0; jk < nydiv; jk++) { + for (int ij = ith1; ij <= ith2; ij++) { + histx[jk][ij] = (TH2F*)histz[jk][ij]->Clone(); + histx[jk][ij]->Divide(histy[jk][ij]); + c1->cd(++icol); + cout << "ij " << icol << " " << ij << " " << jk << " " << histy[jk][ij]->GetTitle() << endl; + + histx[jk][ij]->GetXaxis()->SetTitle("Time slice in Five rings"); + histx[jk][ij]->GetXaxis()->SetTitleSize(0.055); + histx[jk][ij]->GetXaxis()->SetTitleOffset(1.2); //0.85 + histx[jk][ij]->GetXaxis()->CenterTitle(); + histx[jk][ij]->GetXaxis()->SetLabelSize(0.065); + histx[jk][ij]->GetXaxis()->SetLabelOffset(0.01); + + histx[jk][ij]->GetYaxis()->SetTitle("RM#"); + histx[jk][ij]->GetYaxis()->SetTitleSize(0.055); + histx[jk][ij]->GetYaxis()->SetTitleOffset(1.3); + histx[jk][ij]->GetYaxis()->CenterTitle(); + histx[jk][ij]->GetYaxis()->SetLabelSize(0.065); + histx[jk][ij]->GetYaxis()->SetLabelOffset(0.01); + + histx[jk][ij]->GetZaxis()->SetLabelSize(0.048); + histx[jk][ij]->GetZaxis()->SetLabelOffset(0.01); + + histx[jk][ij]->GetXaxis()->SetNdivisions(202); + // histx[jk][ij]->GetYaxis()->SetNdivisions(406); + // histx[jk][ij]->GetZaxis()->SetNdivisions(406); + if (amx > 0) + histx[jk][ij]->SetMaximum(amx); + // for (int kl=0; klGetXaxis()->SetBinLabel(10*kl+6, labels[kl]); + // } + // histx[jk][ij]->GetXaxis()->LabelsOption("h"); + histx[jk][ij]->GetXaxis()->SetNdivisions(810); + histx[jk][ij]->Draw("colz"); + } + } + c1->Update(); +} + +// root histall_apr14b_cosmic_csa14_cosmic.root +// plot6(-2,3) +void plot6(int iring = -2, int irbx = 3) { + def_setting(); + gStyle->SetOptStat(0); + gStyle->SetPadTopMargin(0.10); + gStyle->SetPadBottomMargin(0.08); + gStyle->SetPadLeftMargin(0.20); + gStyle->SetPadRightMargin(0.20); + char name[100]; + const int shapemx = 10; + TH2F* histx[shapemx]; + // const char* shape_name[shapemx]={"N:T3/T34", "N:T34/Sum2-5", "N:T3/Sum2-5", "N:T4/Sum2-5", "N:Oth/Sum2-5", + // "S:T3/T34", "S:T34/Sum2-5", "S:T3/Sum2-5", "S:T4/Sum2-5", "S:Oth/Sum2-5"}; + + const char* shape_name[shapemx] = { + "T3/T4", "T4/Sum45", "T45/Sum4-7", "T4-7/All", "T0-3/T4-7", "T0-3/All", "T0-3/T4-7", "T67/T45", "xx", "xx"}; + + TCanvas* c1 = new TCanvas("c1", "c1", 800., 500.); + c1->Divide(4, 2, 1.e-6, 1.e-6); + + for (int ij = 0; ij < shapemx - 2; ij++) { + c1->cd(ij + 1); + sprintf(name, "hoCalibc/rbx_shape_%i_r%i_%i", ij, iring + 2, irbx); + histx[ij] = (TH2F*)gDirectory->Get(name); + cout << "ij " << ij << " " << histx[ij]->GetTitle() << endl; + + if (ij == 0 || ij == 5) { + // histx[ij]->GetXaxis()->SetTitle("T2+T3"); + } else { + // histx[ij]->GetXaxis()->SetTitle("Sum T2-5"); + } + histx[ij]->GetXaxis()->SetTitleSize(0.065); + histx[ij]->GetXaxis()->SetTitleOffset(0.65); //0.85 + histx[ij]->GetXaxis()->CenterTitle(); + histx[ij]->GetXaxis()->SetLabelSize(0.065); + histx[ij]->GetXaxis()->SetLabelOffset(-0.01); + + histx[ij]->GetYaxis()->SetTitle(shape_name[ij]); + histx[ij]->GetYaxis()->SetTitleSize(0.065); + histx[ij]->GetYaxis()->SetTitleOffset(1.3); + histx[ij]->GetYaxis()->CenterTitle(); + histx[ij]->GetYaxis()->SetLabelSize(0.065); + histx[ij]->GetYaxis()->SetLabelOffset(0.01); + + histx[ij]->GetZaxis()->SetLabelSize(0.07); + histx[ij]->GetZaxis()->SetLabelOffset(0.01); + + histx[ij]->GetXaxis()->SetNdivisions(406); + histx[ij]->GetYaxis()->SetNdivisions(406); + histx[ij]->GetZaxis()->SetNdivisions(406); + + histx[ij]->Draw("colz"); + } + c1->Update(); +} + +// root histall_apr14b_cosmic_csa14_cosmic.root +// plot7(2,0) +void plot7(int ith = 2, int irbx = 0) { + def_setting(); + + TLatex latex; + latex.SetNDC(); + latex.SetTextSize(0.08); + latex.SetTextFont(42); + latex.SetTextAlign(1); //(31); // align right + + const int nringmx = 5; + gStyle->SetOptLogy(1); + gStyle->SetOptStat(0); + gStyle->SetPadTopMargin(0.02); + gStyle->SetPadBottomMargin(0.13); + gStyle->SetPadLeftMargin(0.14); + gStyle->SetPadRightMargin(0.02); + char name[100]; + TCanvas* c1 = new TCanvas("c1", "c1", 800., 500.); + c1->Divide(5, 2, 1.e-6, 1.e-6); + + TH1F* histx[2][nringmx]; + + int icol = 0; + + for (int ij = 0; ij < 2; ij++) { + for (int jk = 0; jk < nringmx; jk++) { + if (ij == 0) { + sprintf(name, "hoCalibc/rbx_mult_%i_r%i_%i", ith, jk, irbx); + } else { + sprintf(name, "hoCalibc/rout_mult_%i_r%i_%i", ith, jk, irbx); + } + + histx[ij][jk] = (TH1F*)gDirectory->Get(name); + cout << "name " << name << endl; + c1->cd(++icol); + + if (ij == 0) { + histx[ij][jk]->GetXaxis()->SetTitle("# in RBX"); + } else { + histx[ij][jk]->GetXaxis()->SetTitle("# in RM"); + } + histx[ij][jk]->GetXaxis()->SetTitleSize(0.085); + histx[ij][jk]->GetXaxis()->SetTitleOffset(0.7); //0.85 + histx[ij][jk]->GetXaxis()->CenterTitle(); + histx[ij][jk]->GetXaxis()->SetLabelSize(0.085); + histx[ij][jk]->GetXaxis()->SetLabelOffset(-0.01); + + histx[ij][jk]->GetYaxis()->SetTitle(); //shape_name[ij][jk]); + histx[ij][jk]->GetYaxis()->SetTitleSize(0.075); + histx[ij][jk]->GetYaxis()->SetTitleOffset(1.3); + histx[ij][jk]->GetYaxis()->CenterTitle(); + histx[ij][jk]->GetYaxis()->SetLabelSize(0.085); + histx[ij][jk]->GetYaxis()->SetLabelOffset(0.01); + + histx[ij][jk]->GetXaxis()->SetNdivisions(404); + histx[ij][jk]->GetYaxis()->SetNdivisions(404); + + histx[ij][jk]->Draw(); + cout << "ijjk " << ij << " " << jk << " " << histx[ij][jk]->GetTitle() << endl; + latex.DrawLatex(0.35, 0.8, Form("Ring %i", jk - 2)); + } + } + c1->Update(); +} + +void plot7a(int irng = -1, int ith = 2, int isrm = 0) { + def_setting(); + + TLatex latex; + latex.SetNDC(); + latex.SetTextSize(0.08); + latex.SetTextFont(42); + latex.SetTextAlign(1); //(31); // align right + + const int nringmx = 5; + gStyle->SetOptLogy(1); + gStyle->SetOptStat(0); + gStyle->SetPadTopMargin(0.02); + gStyle->SetPadBottomMargin(0.13); + gStyle->SetPadLeftMargin(0.14); + gStyle->SetPadRightMargin(0.02); + char name[100]; + TCanvas* c1 = new TCanvas("c1", "c1", 800., 500.); + if (irng < 0) { + c1->Divide(5, 2, 1.e-6, 1.e-6); + } else if (isrm) { + if (irng == 2) { + c1->Divide(6, 6, 1.e-6, 1.e-6); + } else { + c1->Divide(6, 4, 1.e-6, 1.e-6); + } + } else { + if (irng == 2) { + c1->Divide(4, 3, 1.e-6, 1.e-6); + } else { + c1->Divide(3, 2, 1.e-6, 1.e-6); + } + } + TH1F* histx[routmx + 1][routmx + 1]; + + int icol = 0; + + int nloop1 = 2; + int nloop2 = nringmx; + if (irng >= 0) { + nloop1 = 1; + if (isrm) { + nloop2 = (irng == 2) ? 36 : 24; + } else { + nloop2 = (irng == 2) ? 12 : 6; + } + } + + for (int ij = 0; ij < nloop1; ij++) { //ij<2 + for (int jk = 0; jk < nloop2; jk++) { //ijGet(name); + cout << "name " << name << endl; + c1->cd(++icol); + if (irng < 0) { + if (ij == 0) { + histx[ij][jk]->GetXaxis()->SetTitle("# in RBX"); + } else { + histx[ij][jk]->GetXaxis()->SetTitle("# in RM"); + } + } else if (isrm) { + histx[ij][jk]->GetXaxis()->SetTitle("# in RM"); + } else { + histx[ij][jk]->GetXaxis()->SetTitle("# in RBX"); + } + + histx[ij][jk]->GetXaxis()->SetTitleSize(0.085); + histx[ij][jk]->GetXaxis()->SetTitleOffset(0.7); //0.85 + histx[ij][jk]->GetXaxis()->CenterTitle(); + histx[ij][jk]->GetXaxis()->SetLabelSize(0.085); + histx[ij][jk]->GetXaxis()->SetLabelOffset(-0.01); + + histx[ij][jk]->GetYaxis()->SetTitle(); //shape_name[ij][jk]); + histx[ij][jk]->GetYaxis()->SetTitleSize(0.075); + histx[ij][jk]->GetYaxis()->SetTitleOffset(1.3); + histx[ij][jk]->GetYaxis()->CenterTitle(); + histx[ij][jk]->GetYaxis()->SetLabelSize(0.085); + histx[ij][jk]->GetYaxis()->SetLabelOffset(0.01); + + histx[ij][jk]->GetXaxis()->SetNdivisions(404); + histx[ij][jk]->GetYaxis()->SetNdivisions(404); + + histx[ij][jk]->Draw(); + cout << "ijjk " << ij << " " << jk << " " << histx[ij][jk]->GetTitle() << endl; + if (irng < 0) { + latex.DrawLatex(0.35, 0.8, Form("Ring %i E>%g", jk - 2, hothreshs[ith])); + } else if (isrm) { + latex.DrawLatex(0.35, 0.8, Form("Ring %i RM%i E>%g", irng, jk, hothreshs[ith])); + } else { + latex.DrawLatex(0.35, 0.8, Form("Ring %i RBX%i E>%g", irng, jk, hothreshs[ith])); + } + } + } + c1->Update(); +} + +void plot7b(int irng = -1, int th1 = 2, int th2 = 5, int isrm = 0) { + def_setting(); + + TLatex latex; + latex.SetNDC(); + latex.SetTextSize(0.065); + latex.SetTextFont(42); + latex.SetTextAlign(1); //(31); // align right + + TLegend* tleg = new TLegend(.75, 0.35, 0.95, 0.9, "", "brNDC"); + tleg->SetFillColor(10); + tleg->SetBorderSize(0); + tleg->SetTextFont(42); + tleg->SetTextSize(0.07); + + const int nringmx = 5; + gStyle->SetOptLogy(1); + gStyle->SetOptStat(0); + gStyle->SetPadTopMargin(0.02); + gStyle->SetPadBottomMargin(0.13); + gStyle->SetPadLeftMargin(0.14); + gStyle->SetPadRightMargin(0.02); + char name[100]; + TCanvas* c1 = new TCanvas("c1", "c1", 800., 500.); + if (irng < 0) { + c1->Divide(5, 2, 1.e-6, 1.e-6); + } else if (isrm) { + if (irng == 2) { + c1->Divide(6, 6, 1.e-6, 1.e-6); + } else { + c1->Divide(6, 4, 1.e-6, 1.e-6); + } + } else { + if (irng == 2) { + c1->Divide(4, 3, 1.e-6, 1.e-6); + } else { + c1->Divide(3, 2, 1.e-6, 1.e-6); + } + } + TH1F* histx[routmx + 1][routmx + 1][nhothresh]; + + int icol = 0; + + int nloop1 = 2; + int nloop2 = nringmx; + if (irng >= 0) { + nloop1 = 1; + if (isrm) { + nloop2 = (irng == 2) ? 36 : 24; + } else { + nloop2 = (irng == 2) ? 12 : 6; + } + } + + for (int ij = 0; ij < nloop1; ij++) { //ij<2 + for (int jk = 0; jk < nloop2; jk++) { //ijGet(name); + cout << "name " << name << endl; + if (kl == th1) + c1->cd(++icol); + if (irng < 0) { + if (ij == 0) { + histx[ij][jk][kl]->GetXaxis()->SetTitle("# in RBX"); + } else { + histx[ij][jk][kl]->GetXaxis()->SetTitle("# in RM"); + } + } else if (isrm) { + histx[ij][jk][kl]->GetXaxis()->SetTitle("# in RM"); + } else { + histx[ij][jk][kl]->GetXaxis()->SetTitle("# in RBX"); + } + + histx[ij][jk][kl]->GetXaxis()->SetTitleSize(0.065); + histx[ij][jk][kl]->GetXaxis()->SetTitleOffset(0.75); //0.85 + histx[ij][jk][kl]->GetXaxis()->CenterTitle(); + histx[ij][jk][kl]->GetXaxis()->SetLabelSize(0.075); + histx[ij][jk][kl]->GetXaxis()->SetLabelOffset(-0.01); + + histx[ij][jk][kl]->GetYaxis()->SetTitle(); //shape_name[ij][jk][kl]); + histx[ij][jk][kl]->GetYaxis()->SetTitleSize(0.065); + histx[ij][jk][kl]->GetYaxis()->SetTitleOffset(1.3); + histx[ij][jk][kl]->GetYaxis()->CenterTitle(); + histx[ij][jk][kl]->GetYaxis()->SetLabelSize(0.075); + histx[ij][jk][kl]->GetYaxis()->SetLabelOffset(0.01); + + histx[ij][jk][kl]->GetXaxis()->SetNdivisions(404); + histx[ij][jk][kl]->GetYaxis()->SetNdivisions(404); + + histx[ij][jk][kl]->SetLineColor(kl - th1 + 1); + histx[ij][jk][kl]->Draw((kl == th1) ? "" : "same"); + cout << "ijjk " << ij << " " << jk << " " << kl - th1 + 1 << " " << histx[ij][jk][kl]->GetTitle() << endl; + if (kl == th1) { + if (irng < 0) { + latex.DrawLatex(0.35, 0.85, Form("R%i", jk - 2)); + } else if (isrm) { + latex.DrawLatex(0.35, 0.85, Form("R%i RM%i", irng - 2, jk)); + } else { + latex.DrawLatex(0.35, 0.85, Form("R%i RBX%i", irng - 2, jk)); + } + } + if (ij == 0 && jk == 0) { + tleg->AddEntry(histx[ij][jk][kl], Form("th>%g", hothreshs[kl]), "lpfe"); + } + } + } + } + tleg->Draw(); + c1->Update(); +} + +// root histall_apr14b_cosmic_csa14_cosmic.root +// plot8(0,5,0) +// plot8(0,5,1) +void plot8(int ith1 = 1, int ith2 = 8, int ityp = 1) { + def_setting(); + + gStyle->SetPadGridX(0); + gStyle->SetPadGridY(0); + + TLatex latex; + latex.SetNDC(); + latex.SetTextSize(0.06); + latex.SetTextFont(42); + latex.SetTextAlign(1); //(31); // align right + + const int nringmx = 5; + gStyle->SetOptStat(0); + gStyle->SetPadTopMargin(0.06); + gStyle->SetPadBottomMargin(0.16); + gStyle->SetPadLeftMargin(0.16); + gStyle->SetPadRightMargin(0.16); + + char name[100]; + TCanvas* c1 = new TCanvas("c1", "c1", 800., 500.); + c1->Divide(4, 2, 1.e-6, 1.e-6); + // sprintf(name, "hoCalibc/hbentry_d%i", ij+3); + int nentry = ((TH1F*)gDirectory->Get("hoCalibc/hbentry_d3"))->GetBinContent(0, 0); + TH2F* histx[11]; + TH2F* histy[11]; + + int icol = 0; + for (int ij = ith1; ij <= ith2; ij++) { + // histx[1] = (TH2F*)gDirectory->Get(name); + if (ityp == 0) { + sprintf(name, "hoCalibc/hormoccu_%i", ij); + } else { + sprintf(name, "hoCalibc/hocorrelht_%i", ij); + } + cout << "nentry " << nentry << endl; + histy[ij] = (TH2F*)gDirectory->Get(name); + histx[ij] = (TH2F*)histy[ij]->Clone(); + histx[ij]->Scale(1. / nentry); + histx[ij]->GetXaxis()->SetTitle((ityp == 0) ? "iRing" : "i#eta"); + histx[ij]->GetXaxis()->SetTitleSize(0.075); + histx[ij]->GetXaxis()->SetTitleOffset(0.85); //0.85 + histx[ij]->GetXaxis()->CenterTitle(); + histx[ij]->GetXaxis()->SetLabelSize(0.075); + histx[ij]->GetXaxis()->SetLabelOffset(0.01); + + histx[ij]->GetYaxis()->SetTitle((ityp == 0) ? "RM" : "i#phi"); + histx[ij]->GetYaxis()->SetTitleSize(0.065); + histx[ij]->GetYaxis()->SetTitleOffset(1.1); + histx[ij]->GetYaxis()->CenterTitle(); + histx[ij]->GetYaxis()->SetLabelSize(0.065); + histx[ij]->GetYaxis()->SetLabelOffset(0.01); + + histx[ij]->GetZaxis()->SetLabelSize(0.055); + histx[ij]->GetZaxis()->SetLabelOffset(0.01); + + histx[ij]->GetXaxis()->SetNdivisions(202); + histx[ij]->GetYaxis()->SetNdivisions(202); + histx[ij]->GetZaxis()->SetNdivisions(202); + + c1->cd(++icol); + histx[ij]->Draw("colz"); + latex.DrawLatex(0.58, 0.85, Form("E_{th}=%g GeV", hothreshs[ij])); + } + c1->Update(); +} + +// root histall_apr14b_cosmic_csa14_cosmic.root +// plot9(2,0) +// plot9(2,1) +void plot9(int ith = 2, int ityp = 0) { + def_setting(); + + TLatex latex; + latex.SetNDC(); + latex.SetTextSize(0.075); + latex.SetTextFont(42); + latex.SetTextAlign(1); //(31); // align right + + const int nringmx = 5; + gStyle->SetOptStat(0); + gStyle->SetPadTopMargin(0.07); + gStyle->SetPadBottomMargin(0.13); + gStyle->SetPadLeftMargin(0.20); + gStyle->SetPadRightMargin(0.17); + char name[100]; + TCanvas* c1 = new TCanvas("c1", "c1", 800., 500.); + c1->Divide(3, 2, 1.e-6, 1.e-6); + + int nentry = ((TH2F*)gDirectory->Get("hoCalibc/hbentry_d3"))->GetBinContent(0, 0); + TH2F* histx[6]; + TH2F* histy[6]; + + sprintf(name, "hoCalibc/hormcorrel_%i", ith); + + histy[0] = (TH2F*)gDirectory->Get(name); + for (int jk = 0; jk < nringmx; jk++) { + if (ityp == 0) { + sprintf(name, "hoCalibc/hocorrelsig_%i_%i", jk, ith); + } else { + sprintf(name, "hoCalibc/hocorrel2sig_%i_%i", jk, ith); + } + histy[1 + jk] = (TH2F*)gDirectory->Get(name); + } + + for (int ij = 0; ij < 6; ij++) { + histx[ij] = (TH2F*)histy[ij]->Clone(); + histx[ij]->Scale(1. / nentry); + + if (ij == 0) { + histx[ij]->GetXaxis()->SetTitle("# of RM in Rings"); + histx[ij]->GetYaxis()->SetTitle("# of RM in Rings"); + } else { + if (ityp == 0) { + histx[ij]->GetXaxis()->SetTitle("72 #times i#eta + i#phi"); + histx[ij]->GetYaxis()->SetTitle("72 #times i#eta + i#phi"); + } else { + sprintf(name, "%i #times i#phi + i#eta", (ij == 1 || ij == 5) ? 5 : ((ij == 3) ? 8 : 6)); + histx[ij]->GetXaxis()->SetTitle(name); + histx[ij]->GetYaxis()->SetTitle(name); + } + } + + histx[ij]->GetXaxis()->SetTitleSize(0.065); + histx[ij]->GetXaxis()->SetTitleOffset(0.90); //0.85 + histx[ij]->GetXaxis()->CenterTitle(); + histx[ij]->GetXaxis()->SetLabelSize(0.065); + histx[ij]->GetXaxis()->SetLabelOffset(0.001); + + histx[ij]->GetYaxis()->SetTitleSize(0.065); + histx[ij]->GetYaxis()->SetTitleOffset(1.3); + histx[ij]->GetYaxis()->CenterTitle(); + histx[ij]->GetYaxis()->SetLabelSize(0.065); + histx[ij]->GetYaxis()->SetLabelOffset(0.01); + + histx[ij]->GetZaxis()->SetLabelSize(0.055); + histx[ij]->GetZaxis()->SetLabelOffset(0.01); + + histx[ij]->GetXaxis()->SetNdivisions(404); + histx[ij]->GetYaxis()->SetNdivisions(404); + histx[ij]->GetZaxis()->SetNdivisions(406); + + c1->cd(ij + 1); + histx[ij]->Draw("colz"); + if (ij == 0) + latex.DrawLatex(0.24, 0.85, Form("E_{th}=%g GeV", hothreshs[ith])); + cout << "ij " << ij << " " << histx[ij]->GetTitle() << endl; + } + c1->Update(); +} + +// root histall_apr14b_cosmic_csa14_cosmic.root +// plot10(4,5) +void plot10(int ith1 = 2, int ith2 = 3) { + def_setting(); + TLatex latex; + latex.SetNDC(); + latex.SetTextSize(0.05); + latex.SetTextFont(42); + latex.SetTextAlign(1); //(31); // align right + const int nringmx = 5; + gStyle->SetOptStat(0); + gStyle->SetPadTopMargin(0.06); + gStyle->SetPadBottomMargin(0.10); + gStyle->SetPadLeftMargin(0.16); + gStyle->SetPadRightMargin(0.16); + char name[100]; + TCanvas* c1 = new TCanvas("c1", "c1", 800., 500.); + c1->Divide(2, 1, 1.e-6, 1.e-6); + int nentry = ((TH2F*)gDirectory->Get("hoCalibc/hbentry_d3"))->GetBinContent(0, 0); + TH2F* histx[2]; + TH2F* histy[2]; + + sprintf(name, "hoCalibc/hoallcorrelsig_%i", ith1); + histy[0] = (TH2F*)gDirectory->Get(name); + + sprintf(name, "hoCalibc/hoallcorrelsig_%i", ith2); + histy[1] = (TH2F*)gDirectory->Get(name); + + for (int ij = 0; ij < 2; ij++) { + histx[ij] = (TH2F*)histy[ij]->Clone(); + histx[ij]->Scale(1. / nentry); + + histx[ij]->GetXaxis()->SetTitle("72 #times i#eta+i#phi"); + histx[ij]->GetYaxis()->SetTitle("72 #times i#eta+i#phi"); + + histx[ij]->GetXaxis()->SetTitleSize(0.045); + histx[ij]->GetXaxis()->SetTitleOffset(0.90); //0.85 + histx[ij]->GetXaxis()->CenterTitle(); + histx[ij]->GetXaxis()->SetLabelSize(0.045); + histx[ij]->GetXaxis()->SetLabelOffset(0.001); + + histx[ij]->GetYaxis()->SetTitleSize(0.045); + histx[ij]->GetYaxis()->SetTitleOffset(1.65); + histx[ij]->GetYaxis()->CenterTitle(); + histx[ij]->GetYaxis()->SetLabelSize(0.045); + histx[ij]->GetYaxis()->SetLabelOffset(0.01); + + histx[ij]->GetZaxis()->SetLabelSize(0.045); + histx[ij]->GetZaxis()->SetLabelOffset(0.01); + + histx[ij]->GetXaxis()->SetNdivisions(406); + histx[ij]->GetYaxis()->SetNdivisions(406); + histx[ij]->GetZaxis()->SetNdivisions(406); + if (ij == 0) + histx[ij]->SetMaximum(0.000001); + // if (ij==1) histx[ij]->SetMaximum(0.0000005); + c1->cd(ij + 1); + histx[ij]->Draw("colz"); + latex.DrawLatex(0.28, 0.85, Form("E_{th}=%g GeV", hothreshs[(ij == 0) ? ith1 : ith2])); + + cout << "ij " << histx[ij]->GetTitle() << endl; + } + c1->Update(); +} + +// root histall_apr14b_cosmic_csa14_cosmic.root +//NO plot11(2,3) +void plot11(int ith1 = 2, int ith2 = 3) { + def_setting(); + + TLatex latex; + latex.SetNDC(); + latex.SetTextSize(0.05); + latex.SetTextFont(42); + latex.SetTextAlign(1); //(31); // align right + const int nringmx = 5; + gStyle->SetOptStat(0); + gStyle->SetPadTopMargin(0.06); + gStyle->SetPadBottomMargin(0.10); + gStyle->SetPadLeftMargin(0.16); + gStyle->SetPadRightMargin(0.16); + + char name[100]; + TCanvas* c1 = new TCanvas("c1", "c1", 800., 500.); + c1->Divide(2, 1, 1.e-6, 1.e-6); + int nentry = ((TH2F*)gDirectory->Get("hoCalibc/hbentry_d3"))->GetBinContent(0, 0); + TH2F* histx[2]; + TH2F* histy[2]; + + sprintf(name, "hoCalibc/hoallmucorrel_%i", ith1); + histy[0] = (TH2F*)gDirectory->Get(name); + + sprintf(name, "hoCalibc/hoallmucorrel_%i", ith2); + histy[1] = (TH2F*)gDirectory->Get(name); + + for (int ij = 0; ij < 2; ij++) { + double total = 0; + histx[ij] = (TH2F*)histy[ij]->Clone(); + for (int ix = 1; ix <= histy[ij]->GetNbinsX(); ix++) { + float anent = histy[ij]->GetBinContent(ix, 0); + total += anent; + // cout<<"ix "<< ij<<" "<GetNbinsY(); iy++) { + histx[ij]->SetBinContent(ix, iy, histy[ij]->GetBinContent(ix, iy) / anent); + } + } + + histx[ij]->GetXaxis()->SetTitle("Projected muon (72 #times i#eta+i#phi)"); + histx[ij]->GetYaxis()->SetTitle("Signal in HO tower (72 #times i#eta+i#phi)"); + + histx[ij]->GetXaxis()->SetTitleSize(0.045); + histx[ij]->GetXaxis()->SetTitleOffset(0.90); //0.85 + histx[ij]->GetXaxis()->CenterTitle(); + histx[ij]->GetXaxis()->SetLabelSize(0.04); + histx[ij]->GetXaxis()->SetLabelOffset(0.001); + + histx[ij]->GetYaxis()->SetTitleSize(0.045); + histx[ij]->GetYaxis()->SetTitleOffset(1.65); + histx[ij]->GetYaxis()->CenterTitle(); + histx[ij]->GetYaxis()->SetLabelSize(0.04); + histx[ij]->GetYaxis()->SetLabelOffset(0.01); + + histx[ij]->GetZaxis()->SetLabelSize(0.04); + histx[ij]->GetZaxis()->SetLabelOffset(0.01); + + histx[ij]->GetXaxis()->SetNdivisions(406); + histx[ij]->GetYaxis()->SetNdivisions(406); + histx[ij]->GetZaxis()->SetNdivisions(406); + // if (ij==0) histx[ij]->SetMaximum(0.002); + // if (ij==1) histx[ij]->SetMaximum(0.001); + c1->cd(ij + 1); + histx[ij]->Draw("colz"); + latex.DrawLatex(0.28, 0.85, Form("E_{th}=%g GeV", hothreshs[(ij == 0) ? ith1 : ith2])); + cout << "ij " << histx[ij]->GetTitle() << endl; + } + c1->Update(); +} + +/* + +root ../local/loc2014/hist_local_*_Cosmics.root + .L anal_csa14_pl.C +alllocal(6); +root ../local/loc2014/hist_local_*_40fC.root + .L anal_csa14_pl.C +alllocal(6); +root ../local/loc2014/hist_local_*_50fC.root + .L anal_csa14_pl.C +alllocal(3); +root ../local/loc2014/hist_local_*_60fC.root + .L anal_csa14_pl.C +alllocal(9); +root ../local/loc2014/hist_local_*_peds.root + .L anal_csa14_pl.C +alllocal(3); +*/ + +void alllocal(int nfile = 9) { + char pch1[200]; + for (int ij = 0; ij < nfile; ij++) { + switch (ij) { + case 0: + _file0->cd(); + break; + case 1: + _file1->cd(); + break; + case 2: + _file2->cd(); + break; + case 3: + _file3->cd(); + break; + case 4: + _file4->cd(); + break; + case 5: + _file5->cd(); + break; + case 6: + _file6->cd(); + break; + case 7: + _file7->cd(); + break; + case 8: + _file8->cd(); + break; + case 9: + _file9->cd(); + break; + default: + _file0->cd(); + break; + } + + cout << "xx1 " << endl; + char* namex = gDirectory->GetName(); + int len2 = strlen(namex); + strncpy(pch1, namex + 17, len2 - 22); + pch1[len2 - 22] = '\0'; + sprintf(pch1, "%s.ps", pch1); + TPostScript pss(pch1, 112); + pss.Range(28, 20); //pss.Range(20,28); + cout << "xx2 " << endl; + pss.NewPage(); + pss.NewPage(); + testxx(); + pss.NewPage(); + /* + pss.NewPage(); plot000(-1,6,6,1); + pss.NewPage(); plot000(0,6,6,1); + pss.NewPage(); plot000(1,6,6,1); + pss.NewPage(); plot000(2,12,12,1); + pss.NewPage(); plot000(3,6,6,1); + pss.NewPage(); plot000(4,6,6,1); + */ + + pss.NewPage(); + plot000(0, 6, 6, 1); + plot000(1, 6, 6, 1, "same", 1); + plot000(2, 12, 12, 1, "same", 2); + plot000(3, 6, 6, 1, "same", 3); + plot000(4, 6, 6, 1, "sames", 4); + + for (int jk = 0; jk < 5; jk++) { + pss.NewPage(); + plot000(jk, 0, 0, 1); + for (int kl = 1; kl < 12; kl++) { + if (jk != 2 && kl > 5) + continue; + cout << "jk " << jk << " " << kl << endl; + if ((jk == 2 && kl == 11) || (jk != 2 && kl == 5)) { + plot000(jk, kl, kl, 1, "sames", kl); + } else { + plot000(jk, kl, kl, 1, "same", kl); + } + } + } + + // // pss.NewPage(); plot000(1,0,0,1); + // // plot000(1,1,1,1, "same",1); + // // plot000(1,2,2,1, "same",2); + // // plot000(1,3,3,1, "same",3); + // // plot000(1,4,4,1, "same",4); + // // plot000(1,5,5,1, "sames",5); + + // // /* + // // pss.NewPage(); plot000(0,0,5,1); + // // pss.NewPage(); plot000(1,0,5,1); + // // pss.NewPage(); plot000(2,0,5,1); + // // pss.NewPage(); plot000(2,6,11,1); + // // pss.NewPage(); plot000(3,0,5,1); + // // pss.NewPage(); plot000(4,0,5,1); + // // */ + + pss.NewPage(); + plot000r(-1); + pss.NewPage(); + plot000r(0); + pss.NewPage(); + plot000r(1); + pss.NewPage(); + plot000r(2); + pss.NewPage(); + plot000r(3); + pss.NewPage(); + plot000r(4); + + // // /* + // // pss.NewPage(); plot01(0,1); + // // pss.NewPage(); plot01(1,1); + // // */ + pss.NewPage(); + plot01(2, 1); + + pss.NewPage(); + plot2(0, 4, 0); + pss.NewPage(); + plot2(4, 8, 0); + + // // pss.NewPage(); plot4(0,8,0,0); + // // // pss.NewPage(); plot4(3,5,0,0); + // // // pss.NewPage(); plot4(6,8,0,0); + + // // // pss.NewPage(); plot5(0,2,0,0); + // // // pss.NewPage(); plot5(3,5,0,0); + // // // pss.NewPage(); plot5(6,8,0,0); + + pss.NewPage(); + plot6(-2, 0); + pss.NewPage(); + plot6(-1, 0); + pss.NewPage(); + plot6(0, 0); + pss.NewPage(); + plot6(1, 0); + pss.NewPage(); + plot6(2, 0); + + // // // pss.NewPage(); plot7(0,0); + // // // pss.NewPage(); plot7(1,0); + // // // pss.NewPage(); plot7(2,0); + // // // pss.NewPage(); plot7(3,0); + // // // pss.NewPage(); plot7(4,0); + // // // pss.NewPage(); plot7(2,2); + + pss.NewPage(); + plot7b(-1, 3); + pss.NewPage(); + plot7b(0, 2, 8, 0); + pss.NewPage(); + plot7b(1, 2, 8, 0); + pss.NewPage(); + plot7b(2, 2, 8, 0); + pss.NewPage(); + plot7b(3, 2, 8, 0); + pss.NewPage(); + plot7b(4, 2, 8, 0); + pss.NewPage(); + plot7b(0, 2, 8, 1); + pss.NewPage(); + plot7b(1, 2, 8, 1); + pss.NewPage(); + plot7b(2, 2, 8, 1); + pss.NewPage(); + plot7b(3, 2, 8, 1); + pss.NewPage(); + plot7b(4, 2, 8, 1); + + pss.NewPage(); + plot8(1, 8, 0); + pss.NewPage(); + plot8(1, 8, 1); + + pss.NewPage(); + plot9(2, 0); + pss.NewPage(); + plot9(2, 1); + + // pss.NewPage(); plot10(4,5); + + pss.Close(); + } +} +/* +hadd histall_local_peds.root hist_local_*_peds.root +hadd histall_local_40fc.root hist_local_22*_40fC.root +hadd histall_local_50fc.root hist_local_22*_50fC.root +hadd histall_local_60fc.root hist_local_221848_60fC.root hist_local_221945_60fC.root hist_local_222770_60fC.root +hadd histall_local_cosmics.root hist_local_220619_Cosmics.root hist_local_220620_Cosmics.root hist_local_220625_Cosmics.root +*/ + +void alllocalx(int nfile = 9) { + char pch1[200]; + for (int ij = 0; ij < nfile; ij++) { + switch (ij) { + case 0: + _file0->cd(); + break; + case 1: + _file1->cd(); + break; + case 2: + _file2->cd(); + break; + case 3: + _file3->cd(); + break; + case 4: + _file4->cd(); + break; + case 5: + _file5->cd(); + break; + case 6: + _file6->cd(); + break; + case 7: + _file7->cd(); + break; + case 8: + _file8->cd(); + break; + case 9: + _file9->cd(); + break; + case 10: + _file10->cd(); + break; + case 11: + _file11->cd(); + break; + case 12: + _file12->cd(); + break; + case 13: + _file13->cd(); + break; + case 14: + _file14->cd(); + break; + case 15: + _file15->cd(); + break; + case 16: + _file16->cd(); + break; + case 17: + _file17->cd(); + break; + case 18: + _file18->cd(); + break; + case 19: + _file19->cd(); + break; + case 20: + _file20->cd(); + break; + case 21: + _file21->cd(); + break; + case 22: + _file22->cd(); + break; + case 23: + _file23->cd(); + break; + case 24: + _file24->cd(); + break; + case 25: + _file25->cd(); + break; + case 26: + _file26->cd(); + break; + case 27: + _file27->cd(); + break; + case 28: + _file28->cd(); + break; + case 29: + _file29->cd(); + break; + + default: + _file0->cd(); + break; + } + + char* namex = gDirectory->GetName(); + int len2 = strlen(namex); + strncpy(pch1, namex + 17, len2 - 22); + pch1[len2 - 22] = '\0'; + sprintf(pch1, "xx_%s.ps", pch1); + TPostScript pss(pch1, 112); + pss.Range(28, 20); //pss.Range(20,28); + + pss.NewPage(); + pss.NewPage(); + testxx(); + pss.NewPage(); + testxx(); + + pss.NewPage(); + plot000r(-1, 0, 140); + pss.NewPage(); + plot000r(-1, 1, 140); + + // pss.NewPage(); plot000r(0); + // pss.NewPage(); plot000r(1); + // pss.NewPage(); plot000r(2); + // pss.NewPage(); plot000r(3); + // pss.NewPage(); plot000r(4); + + pss.NewPage(); + plot2(0, 4, 0); + pss.NewPage(); + plot2(4, 8, 0); + + // pss.NewPage(); plot000r(0); + // pss.NewPage(); plot000r(1); + // pss.NewPage(); plot000r(2); + // pss.NewPage(); plot000r(3); + // pss.NewPage(); plot000r(4); + + pss.NewPage(); + plot01(2, 1); + + pss.NewPage(); + plot7b(-1, 2, 8); + pss.NewPage(); + plot7b(0, 2, 8, 0); + pss.NewPage(); + plot7b(1, 2, 8, 0); + pss.NewPage(); + plot7b(2, 2, 8, 0); + pss.NewPage(); + plot7b(3, 2, 8, 0); + pss.NewPage(); + plot7b(4, 2, 8, 0); + pss.NewPage(); + plot7b(0, 2, 8, 1); + pss.NewPage(); + plot7b(1, 2, 8, 1); + pss.NewPage(); + plot7b(2, 2, 8, 1); + pss.NewPage(); + plot7b(3, 2, 8, 1); + pss.NewPage(); + plot7b(4, 2, 8, 1); + + pss.NewPage(); + plot8(1, 8, 0); + pss.NewPage(); + plot8(1, 8, 1); + + pss.NewPage(); + plot9(2, 0); + // pss.NewPage(); plot9(2,1); + + // pss.NewPage(); plot10(4,5); + + pss.NewPage(); + plot4(0, 8, 0, 0); + + // // // pss.NewPage(); plot5(0,2,0,0); + // // // pss.NewPage(); plot5(3,5,0,0); + // // // pss.NewPage(); plot5(6,8,0,0); + + pss.NewPage(); + plot000(0, 6, 6, 1); + plot000(1, 6, 6, 1, "same", 1); + plot000(2, 12, 12, 1, "same", 2); + plot000(3, 6, 6, 1, "same", 3); + plot000(4, 6, 6, 1, "sames", 4); + + for (int jk = 0; jk < 5; jk++) { + pss.NewPage(); + plot000(jk, 0, 0, 1); + for (int kl = 1; kl < 12; kl++) { + if (jk != 2 && kl > 5) + continue; + cout << "jk " << jk << " " << kl << endl; + if ((jk == 2 && kl == 11) || (jk != 2 && kl == 5)) { + plot000(jk, kl, kl, 1, "sames", kl); + } else { + plot000(jk, kl, kl, 1, "same", kl); + } + } + } + + pss.NewPage(); + plot6(-2, 0); + pss.NewPage(); + plot6(-1, 0); + pss.NewPage(); + plot6(0, 0); + pss.NewPage(); + plot6(1, 0); + pss.NewPage(); + plot6(2, 0); + + pss.Close(); + } +} + +// scp hcal_local_*_peds.root hcal_local_*_40fC.root hcal_local_*_50fC.root hcal_local_*_60fC.root hist_local_*_peds.root hist_local_*_40fC.root hist_local_*_50fC.root hist_local_*_60fC.root gobinda@158.144.54.116:/data/gobinda/anal/hcal/local/loc2014/ + +void test1x() { + for (int ij = 1; ij < 14; ij++) { + cout << "INR " << 6200 * ij + 4000 << " (for " << ij << " nights)" << endl; + } +} + +void sigpedrun(int nrn = 100) { + TPostScript ps("testxx.ps", 111); + ps.Range(20, 28); + TCanvas* c0x = new TCanvas("c0x", " Pedestal and signal", 900, 1200); + c0x->Divide(5, 4, 1.e-5, 1.e-5, 0); + + TH1F* signal_run[5][3000]; + char name[100]; + + for (int ix = 0; ix < nrn; ix++) { + int ixxy = ix % 4; + if (ixxy == 0) { + ps.NewPage(); + } + for (int iy = 0; iy < ringmx; iy++) { + sprintf(name, "noise_ring_%i_run%i", iy, ix); + signal_run[iy][ix] = (TH1F*)gDirectory->Get(name); + double mean = signal_run[iy][ix]->GetMean(); + double rms = signal_run[iy][ix]->GetRMS(); + if (iy == 0) + cout << ix << " " << signal_run[iy][ix]->GetTitle() << " "; + // cout <<" "<GetEntries()<<" "<cd(ringmx * ixxy + iy + 1); + signal_run[iy][ix]->SetLineColor(3); + signal_run[iy][ix]->GetXaxis()->SetLabelSize(0.095); + signal_run[iy][ix]->GetXaxis()->SetNdivisions(404); + signal_run[iy][ix]->GetYaxis()->SetLabelSize(0.095); + signal_run[iy][ix]->GetXaxis()->SetLabelOffset(-0.02); + signal_run[iy][ix]->Draw(); + if (ixxy == 3) { + c0x->Update(); + } + } + cout << endl; + } + + ps.Close(); +} +/* + Run # 297180 Evt # 102392070 1 7024424 + +All 94.67 92.49 95.35 92.7 94.71 + +ndof 93.37 92 94.58 92.21 93.3 +chisq 93.34 91.96 94.53 92.16 93.27 +angle 93.33 91.96 94.53 92.16 93.27 +pt 92.13 90.45 92.22 90.63 92.01 +isol 62.28 56 55.51 56.17 62.68 +phi 56.27 50.7 47.38 50.85 56.58 +eta 52.41 46.51 36.64 46.69 52.7 +Time 52.24 46.4 36.63 46.54 52.54 + + +hodx 99.31 97.74 99.62 98.03 99.32 +iso 96.61 94.44 97 94.67 96.68 +pt 96.4 94.17 96.81 94.4 96.48 + + + + 1 Constant 8.56917e+01 2.42013e+00 7.85930e-03 3.06102e-06 + 2 Mean 1.00342e+00 1.07020e-03 4.43892e-06 3.20972e-03 + 3 Sigma 4.79270e-02 8.60831e-04 1.86192e-05 -5.88994e-03 + + 1 Constant 1.92784e+02 5.34817e+00 1.63458e-02 -1.85787e-06 + 2 Mean 9.99574e-01 4.75653e-04 1.82064e-06 2.98504e-02 + 3 Sigma 2.14641e-02 3.63935e-04 1.51944e-05 -3.40005e-03 + + 1 Constant 4.23168e+02 1.23598e+01 3.79784e-02 -4.19190e-05 + 2 Mean 1.01199e+00 2.17199e-04 8.81854e-07 -3.90635e-01 + 3 Sigma 9.80276e-03 1.89893e-04 1.59833e-05 -2.89784e-02 + + 1 Constant 2.73388e+02 7.95311e+00 2.29623e-02 1.00544e-07 + 2 Mean 1.01965e+00 3.34716e-04 1.28072e-06 1.32401e-01 + 3 Sigma 1.52308e-02 2.92214e-04 1.60562e-05 -4.93738e-03 + + 1 Constant 3.33148e+02 9.67580e+00 2.88215e-02 -1.45420e-05 + 2 Mean 1.02102e+00 2.74804e-04 1.08052e-06 -2.43768e+00 + 3 Sigma 1.24753e-02 2.37824e-04 1.60597e-05 3.78574e-02 + + 1 Constant 4.11514e+02 1.19379e+01 3.34777e-02 -1.48396e-07 + 2 Mean 1.02247e+00 2.23653e-04 8.24581e-07 3.21928e-03 + 3 Sigma 1.01355e-02 1.93182e-04 1.45150e-05 -2.31771e-04 + + 1 Constant 4.17155e+02 1.22384e+01 3.67076e-02 -3.41070e-05 + 2 Mean 1.02334e+00 2.19820e-04 8.75434e-07 -4.30174e+00 + 3 Sigma 9.95279e-03 1.94035e-04 1.57779e-05 1.98571e-02 + + 1 Constant 3.99846e+02 1.20076e+01 4.10521e-02 1.64058e-06 + 2 Mean 1.02511e+00 2.34554e-04 1.05387e-06 4.74777e-02 + 3 Sigma 1.02668e-02 2.09319e-04 1.83947e-05 1.76225e-02 + + +CRO_pulse->Draw("c2PeakTime_1[0]","c1PeakTime_1[0]>-100&&c2PeakTime_1[0]>-100&&") + +CRO_pulse->Draw("c4PeakTime_1[1]","c3PeakTime_1[1]>-100&&c4PeakTime_1[1]>-100&&c3PeakTime_1[1]>1.e-6&&c4PeakTime_1[1]>1.e-6") + + +*/ diff --git a/Calibration/HcalCalibAlgos/macros/hocalib_tmpfit.C b/Calibration/HcalCalibAlgos/macros/hocalib_tmpfit.C new file mode 100644 index 0000000000000..25dcfd5ab353c --- /dev/null +++ b/Calibration/HcalCalibAlgos/macros/hocalib_tmpfit.C @@ -0,0 +1,943 @@ +#include "TFile.h" +#include "TH1F.h" +#include "TH2F.h" +#include "TTree.h" +#include "TProfile.h" +#include "TPostScript.h" +#include "TCanvas.h" +#include "TF1.h" +#include "TStyle.h" +#include "TLatex.h" +#include "TLegend.h" +#include "TPaveStats.h" + +#include "TRandom.h" + +#include + +#include +#include +#include +#include +#include "TMinuit.h" +#include "TMath.h" + +const char* prehist = "hoCalibc/"; + +using namespace std; +static unsigned int mypow_2[32]; + +int irunold = 1000; +const int nmxbin = 40000; +float yvalft[nmxbin]; +float xvalft[nmxbin]; +int nvalft = 0; + +float alowx = -1.0; +float ahighx = 29.0; +int auprange = 25; + +double fitchisq; +int fitndof; +double anormglb = -1; +Double_t gausX(Double_t* x, Double_t* par) { return par[0] * (TMath::Gaus(x[0], par[1], par[2], kTRUE)); } + +// Double_t landX(Double_t* x, Double_t* par) { +// return par[0]*(TMath::Landau(x[0], par[1], par[2])); +// } + +// Double_t completefit(Double_t* x, Double_t* par) { +// return gausX(x, par) + landX(x, &par[3]); +// } + +Double_t langaufun(Double_t* x, Double_t* par) { + //Fit parameters: + //par[0]*par[1]=Width (scale) parameter of Landau density + //par[1]=Most Probable (MP, location) parameter of Landau density + //par[2]=Total area (integral -inf to inf, normalization constant) + //par[3]=Width (sigma) of convoluted Gaussian function + // + //In the Landau distribution (represented by the CERNLIB approximation), + //the maximum is located at x=-0.22278298 with the location parameter=0. + //This shift is corrected within this function, so that the actual + //maximum is identical to the MP parameter. + // /* + // Numeric constants + Double_t invsq2pi = 0.3989422804014; // (2 pi)^(-1/2) + Double_t mpshift = -0.22278298; // Landau maximum location + + // Control constants + Double_t np = 100.0; // number of convolution steps + Double_t sc = 5.0; // convolution extends to +-sc Gaussian sigmas + + // Variables + Double_t xx; + Double_t mpc; + Double_t fland; + Double_t sum = 0.0; + Double_t xlow, xupp; + Double_t step; + + // MP shift correction + mpc = par[1] - mpshift * par[0] * par[1]; + double scale = 1; // par[1]; + double scale2 = anormglb; // for notmalisation this is one, otehrwise use the normalisation; + if (scale2 < .1) + scale2 = 0.1; + // double scale=par[1]; + // Range of convolution integral + xlow = x[0] - sc * scale * par[3]; + xupp = x[0] + sc * scale * par[3]; + + step = (xupp - xlow) / np; + + // Convolution integral of Landau and Gaussian by sum + for (double ij = 1.0; ij <= np / 2; ij++) { + xx = xlow + (ij - .5) * step; + fland = TMath::Landau(xx, mpc, par[0] * par[1], kTRUE); // / par[0]; + if (xx > par[1]) { + fland *= exp(-(xx - par[1]) / par[4]); + } + sum += fland * TMath::Gaus(x[0], xx, scale * par[3]); + xx = xupp - (ij - .5) * step; + fland = TMath::Landau(xx, mpc, par[0] * par[1], kTRUE); // / par[0]; + if (xx > par[1]) { + fland *= exp(-(xx - par[1]) / par[4]); + } + sum += fland * TMath::Gaus(x[0], xx, scale * par[3]); + } + return (par[2] * step * sum * invsq2pi / (scale2 * par[3])); +} + +Double_t totalfunc(Double_t* x, Double_t* par) { + return gausX(x, par) + langaufun(x, &par[3]); // /max(.001,anormglb); +} + +const int netamx = 30; +const int nphimx = 72; + +int getHOieta(int ij) { return (ij < netamx / 2) ? -netamx / 2 + ij : -netamx / 2 + ij + 1; } +int invert_HOieta(int ieta) { return (ieta < 0) ? netamx / 2 + ieta : netamx / 2 + ieta - 1; } + +int ietafit; +int iphifit; + +void fcnsg(Int_t& npar, Double_t* gin, Double_t& f, Double_t* par, Int_t flag) { + double xval[2]; + + anormglb = 1; + double tmpnorm = 0; + for (int ij = 0; ij < 600; ij++) { + xval[0] = -5 + (ij + 0.5) * .1; + tmpnorm += 0.1 * langaufun(xval, &par[3]) / par[5]; + } + anormglb = tmpnorm; + + double fval = -(par[0] + par[5]); + for (int ij = 0; ij < nvalft; ij++) { + if (yvalft[ij] < 1 || xvalft[ij] > auprange) + continue; + xval[0] = xvalft[ij]; + fval += yvalft[ij] * log(max(1.e-30, totalfunc(xval, par))); + } + f = -fval; +} + +int main() { + int icol = 0; + int ntotal = 0; + int irebin = 1; + int ifile = 0; + for (int ij = 0; ij < 32; ij++) { + mypow_2[ij] = (int)pow(float(2), ij); + } + + int max_nEvents = 300000000; + int ityp = 1; + bool m_cosmic = false; + bool m_histFill = true; + bool m_treeFill = false; + bool m_zeroField = false; + float pival = acos(-1.); + + int nsize; + char outfile[100]; + char outfilx[100]; + char nametag[100]; + char nametag2[100]; + char infile[200]; + char datafile[100]; + char histname[100]; + char name[100]; + char title[100]; + + cout << "Give the value of rebinning: a nonzero positive integer" << endl; + cin >> irebin; + if (irebin < 1) { + irebin = 1; + } + cout << "Give the upper range of signal for fit [5 - 29]" << endl; + cin >> auprange; + + cout << "Give the histname, e.g., 2017b_v2 2018a_v3a" << endl; + cin >> nametag2; + + int len = strlen(nametag2); + nametag2[len] = '\0'; + + sprintf(outfilx, "hist_hoprompt_%s.root", nametag2); + len = strlen(outfilx); + outfilx[len] = '\0'; + + // TFile* fileIn = new TFile("histalla_hcalcalho_2016bcde_v2a.root", "read"); + + TFile* fileIn = new TFile(outfilx, "read"); + // const char* nametag="2016e_ar1"; + // sprintf(nametag, "2016b_ar%i", irebin); + + unsigned ievt, hoflag; + int irun, ilumi, nprim, isect, isect2, ndof, nmuon; + + float inslumi, trkdr, trkdz, trkvx, trkvy, trkvz, trkmm, trkth, trkph, chisq, therr, pherr, hodx, hody, hoang, htime, + hosig[9], hocorsig[18], hocro, hbhesig[9], caloen[3]; + float momatho, tkpt03, ecal03, hcal03; + float tmphoang; + + TTree* Tin; + if (m_treeFill) { + Tin = (TTree*)fileIn->Get("T1"); + + Tin->SetBranchAddress("irun", &irun); + Tin->SetBranchAddress("ievt", &ievt); + + Tin->SetBranchAddress("isect", &isect); + Tin->SetBranchAddress("isect2", &isect2); + Tin->SetBranchAddress("ndof", &ndof); + Tin->SetBranchAddress("nmuon", &nmuon); + + Tin->SetBranchAddress("ilumi", &ilumi); + if (!m_cosmic) { + Tin->SetBranchAddress("inslumi", &inslumi); + Tin->SetBranchAddress("nprim", &nprim); + Tin->SetBranchAddress("tkpt03", &tkpt03); + Tin->SetBranchAddress("ecal03", &ecal03); + Tin->SetBranchAddress("hcal03", &hcal03); + } + + Tin->SetBranchAddress("trkdr", &trkdr); + Tin->SetBranchAddress("trkdz", &trkdz); + + Tin->SetBranchAddress("trkvx", &trkvx); + Tin->SetBranchAddress("trkvy", &trkvy); + Tin->SetBranchAddress("trkvz", &trkvz); + Tin->SetBranchAddress("trkmm", &trkmm); + Tin->SetBranchAddress("trkth", &trkth); + Tin->SetBranchAddress("trkph", &trkph); + + Tin->SetBranchAddress("chisq", &chisq); + Tin->SetBranchAddress("therr", &therr); + Tin->SetBranchAddress("pherr", &pherr); + Tin->SetBranchAddress("hodx", &hodx); + Tin->SetBranchAddress("hody", &hody); + Tin->SetBranchAddress("hoang", &hoang); + + Tin->SetBranchAddress("momatho", &momatho); + Tin->SetBranchAddress("hoflag", &hoflag); + Tin->SetBranchAddress("htime", &htime); + Tin->SetBranchAddress("hosig", hosig); + Tin->SetBranchAddress("hocro", &hocro); + Tin->SetBranchAddress("hocorsig", hocorsig); + Tin->SetBranchAddress("caloen", caloen); + } + + sprintf(nametag, "%s_ar%i_float_par8_rng%i", nametag2, irebin, auprange); + + TLatex latex; + latex.SetNDC(); + latex.SetTextSize(0.06); + latex.SetTextFont(22); + latex.SetTextAlign(11); // 11 left; // 21 centre, // (31); // align right, 22, 23, shift bottom + + //Related fitting, not for storing + const int nsample = 16; //# of signal plots in the .ps page + TF1* pedfun[nsample] = {0}; + TF1* sigfun[nsample] = {0}; + TF1* signalx[nsample] = {0}; + + TH1F* signall[nsample] = {0}; + + TH1F* signallunb[nsample] = {0}; + + const int nbgpr = 3; + const int nsgpr = 8; + double fitprm[nsgpr][netamx]; + double xmn = -1.0; + double xmx = 29.0; + + sprintf(outfilx, "fit_%s", nametag); + len = strlen(outfilx); + outfilx[len] = '\0'; + + sprintf(outfile, "%s.txt", outfilx); + ofstream file_out(outfile); + + sprintf(outfile, "%s.root", outfilx); + + TFile* fileOut = new TFile(outfile, "recreate"); + + TTree* Tout; + + TH1F* sigrsg[netamx][nphimx]; + + TH1F* fit_chi; + TH1F* sig_evt; + TH1F* fit_sigevt; + TH1F* fit_bkgevt; + TH1F* sig_mean; + TH1F* sig_diff; + TH1F* sig_width; + TH1F* sig_sigma; + TH1F* sig_expo; + TH1F* sig_meanerr; + TH1F* sig_meanerrp; + TH1F* sig_signf; + + TH1F* sig_statmean; + TH1F* sig_rms; + + TH2F* ped2d_evt; + TH2F* ped2d_mean; + TH2F* ped2d_width; + TH2F* fit2d_chi; + TH2F* sig2d_evt; + TH2F* fit2d_sigevt; + TH2F* fit2d_bkgevt; + TH2F* sig2d_mean; + TH2F* sig2d_diff; + TH2F* sig2d_width; + TH2F* sig2d_sigma; + TH2F* sig2d_expo; + TH2F* sig2d_meanerr; + TH2F* sig2d_meanerrp; + TH2F* sig2d_signf; + TH2F* sig2d_rms; + TH2F* sig2d_statmean; + + fit_chi = new TH1F("fit_chi", "fit_chi", netamx * nphimx, -0.5, netamx * nphimx - 0.5); + sig_evt = new TH1F("sig_evt", "sig_evt", netamx * nphimx, -0.5, netamx * nphimx - 0.5); + fit_sigevt = new TH1F("fit_sigevt", "fit_sigevt", netamx * nphimx, -0.5, netamx * nphimx - 0.5); + fit_bkgevt = new TH1F("fit_bkgevt", "fit_bkgevt", netamx * nphimx, -0.5, netamx * nphimx - 0.5); + sig_mean = new TH1F("sig_mean", "sig_mean", netamx * nphimx, -0.5, netamx * nphimx - 0.5); + sig_diff = new TH1F("sig_diff", "sig_diff", netamx * nphimx, -0.5, netamx * nphimx - 0.5); + sig_width = new TH1F("sig_width", "sig_width", netamx * nphimx, -0.5, netamx * nphimx - 0.5); + sig_sigma = new TH1F("sig_sigma", "sig_sigma", netamx * nphimx, -0.5, netamx * nphimx - 0.5); + sig_expo = new TH1F("sig_expo", "sig_expo", netamx * nphimx, -0.5, netamx * nphimx - 0.5); + + sig_meanerr = new TH1F("sig_meanerr", "sig_meanerr", netamx * nphimx, -0.5, netamx * nphimx - 0.5); + sig_meanerrp = new TH1F("sig_meanerrp", "sig_meanerrp", netamx * nphimx, -0.5, netamx * nphimx - 0.5); + sig_signf = new TH1F("sig_signf", "sig_signf", netamx * nphimx, -0.5, netamx * nphimx - 0.5); + + sig_statmean = new TH1F("sig_statmean", "sig_statmean", netamx * nphimx, -0.5, netamx * nphimx - 0.5); + sig_rms = new TH1F("sig_rms", "sig_rms", netamx * nphimx, -0.5, netamx * nphimx - 0.5); + + fit2d_chi = + new TH2F("fit2d_chi", "fit2d_chi", netamx + 1, -netamx / 2. - 0.5, netamx / 2. + 0.5, nphimx, 0.5, nphimx + 0.5); + sig2d_evt = + new TH2F("sig2d_evt", "sig2d_evt", netamx + 1, -netamx / 2. - 0.5, netamx / 2. + 0.5, nphimx, 0.5, nphimx + 0.5); + fit2d_sigevt = new TH2F( + "fit2d_sigevt", "fit2d_sigevt", netamx + 1, -netamx / 2. - 0.5, netamx / 2. + 0.5, nphimx, 0.5, nphimx + 0.5); + fit2d_bkgevt = new TH2F( + "fit2d_bkgevt", "fit2d_bkgevt", netamx + 1, -netamx / 2. - 0.5, netamx / 2. + 0.5, nphimx, 0.5, nphimx + 0.5); + sig2d_mean = new TH2F( + "sig2d_mean", "sig2d_mean", netamx + 1, -netamx / 2. - 0.5, netamx / 2. + 0.5, nphimx, 0.5, nphimx + 0.5); + sig2d_diff = new TH2F( + "sig2d_diff", "sig2d_diff", netamx + 1, -netamx / 2. - 0.5, netamx / 2. + 0.5, nphimx, 0.5, nphimx + 0.5); + sig2d_width = new TH2F( + "sig2d_width", "sig2d_width", netamx + 1, -netamx / 2. - 0.5, netamx / 2. + 0.5, nphimx, 0.5, nphimx + 0.5); + sig2d_sigma = new TH2F( + "sig2d_sigma", "sig2d_sigma", netamx + 1, -netamx / 2. - 0.5, netamx / 2. + 0.5, nphimx, 0.5, nphimx + 0.5); + sig2d_expo = new TH2F( + "sig2d_expo", "sig2d_expo", netamx + 1, -netamx / 2. - 0.5, netamx / 2. + 0.5, nphimx, 0.5, nphimx + 0.5); + + sig2d_statmean = new TH2F( + "sig2d_statmean", "sig2d_statmean", netamx + 1, -netamx / 2. - 0.5, netamx / 2. + 0.5, nphimx, 0.5, nphimx + 0.5); + sig2d_rms = + new TH2F("sig2d_rms", "sig2d_rms", netamx + 1, -netamx / 2. - 0.5, netamx / 2. + 0.5, nphimx, 0.5, nphimx + 0.5); + + sig2d_meanerr = new TH2F( + "sig2d_meanerr", "sig2d_meanerr", netamx + 1, -netamx / 2. - 0.5, netamx / 2. + 0.5, nphimx, 0.5, nphimx + 0.5); + sig2d_meanerrp = new TH2F( + "sig2d_meanerrp", "sig2d_meanerrp", netamx + 1, -netamx / 2. - 0.5, netamx / 2. + 0.5, nphimx, 0.5, nphimx + 0.5); + sig2d_signf = new TH2F( + "sig2d_signf", "sig2d_signf", netamx + 1, -netamx / 2. - 0.5, netamx / 2. + 0.5, nphimx, 0.5, nphimx + 0.5); + + if (m_histFill) { + for (int jk = 0; jk < netamx; jk++) { + for (int ij = 0; ij < nphimx; ij++) { + // sprintf(name, "%sho_indenergy_%i_%i", prehist, jk, ij); + sprintf(name, "%ssig_eta%i_phi%i", prehist, jk, ij); + sigrsg[jk][ij] = (TH1F*)fileIn->Get(name); + cout << "jkij " << jk << " " << ij << " " << name << endl; + } + } + } else if (m_treeFill) { + for (int jk = 0; jk < netamx; jk++) { + int ieta = getHOieta(jk); + for (int ij = 0; ij < nphimx; ij++) { + sprintf(name, "ho_indenergy_%i_%i", jk, ij); + sprintf(title, "signal (i#eta=%i - i#phi=%i", ieta, ij + 1); + sigrsg[jk][ij] = new TH1F(name, name, 120, -1.0, 14.0); //1200, -1.0, 29.0); + } + } + + int nentries = Tin->GetEntries(); + for (int iev = 0; iev < nentries; iev++) { + fileIn->cd(); + Tin->GetEntry(iev); + fileOut->cd(); + int ieta = int((abs(isect) % 10000) / 100.) - 50; + int iphi = abs(isect) % 100; + int tmpxet = invert_HOieta(ieta); + + //event selection + if (hosig[4] > -90) { + sigrsg[tmpxet][iphi - 1]->Fill(hosig[4]); + } + } + } else { + cout << " You must read either histogramme or tree " << endl; + return 1; + } + + gStyle->SetTitleFontSize(0.075); + gStyle->SetTitleBorderSize(1); + gStyle->SetPadTopMargin(0.12); + gStyle->SetPadBottomMargin(0.10); + gStyle->SetPadLeftMargin(0.15); + gStyle->SetPadRightMargin(0.03); + + gStyle->SetOptStat(1110); + gStyle->SetLabelSize(0.095, "XYZ"); + gStyle->SetLabelOffset(-0.01, "XYZ"); + gStyle->SetHistLineColor(1); + gStyle->SetHistLineWidth(2); + gStyle->SetPadGridX(0); + gStyle->SetPadGridY(0); + gStyle->SetGridStyle(0); + gStyle->SetOptLogy(1); + + int ips = 111; + sprintf(outfile, "%s.ps", outfilx); + TPostScript ps(outfile, ips); + ps.Range(20, 28); + gStyle->SetOptLogy(0); + gStyle->SetPadLeftMargin(0.17); + + gStyle->SetPadGridX(3); + gStyle->SetPadGridY(3); + gStyle->SetGridStyle(2); + gStyle->SetPadRightMargin(0.17); + gStyle->SetPadLeftMargin(0.10); + + gStyle->SetTitleFontSize(0.045); + gStyle->SetPadTopMargin(0.10); //.12 + gStyle->SetPadBottomMargin(0.12); //.14 + gStyle->SetPadLeftMargin(0.17); + gStyle->SetPadRightMargin(0.03); + + gStyle->SetOptStat(0); //GMA (1110); + + gStyle->SetOptFit(101); + gStyle->SetCanvasBorderMode(0); + gStyle->SetPadBorderMode(0); + gStyle->SetStatBorderSize(1); + gStyle->SetStatStyle(1001); + gStyle->SetTitleColor(10); + gStyle->SetTitleFontSize(0.09); + gStyle->SetTitleOffset(-0.05); + gStyle->SetTitleFillColor(10); + gStyle->SetTitleBorderSize(1); + + gStyle->SetCanvasColor(10); + gStyle->SetPadColor(10); + gStyle->SetStatColor(10); + // gStyle->SetStatFontSize(.07); + gStyle->SetStatX(0.99); + gStyle->SetStatY(0.99); + gStyle->SetStatW(0.44); + gStyle->SetStatH(0.16); + gStyle->SetTitleSize(0.065, "XYZ"); + gStyle->SetLabelSize(0.075, "XYZ"); + gStyle->SetLabelOffset(0.012, "XYZ"); + gStyle->SetPadGridX(0); //(1) + gStyle->SetPadGridY(0); //(1) + gStyle->SetGridStyle(3); + gStyle->SetNdivisions(101, "XY"); + gStyle->SetOptLogy(1); //0); //GMA 1 + int iiter = 0; + + ps.NewPage(); + + int xsiz = 900; //900; + int ysiz = 1200; //600; + TCanvas* c0 = new TCanvas("c0", " Pedestal vs signal", xsiz, ysiz); + c0->Divide(4, 4); + fileOut->cd(); + for (int ij = 0; ij < nphimx; ij++) { + int iphi = ij + 1; + // for (int jk=0; jkClone("hnew"); + if (irebin > 1) { + signall[izone]->Rebin(irebin); + } + + signallunb[izone] = (TH1F*)signall[izone]->Clone("hnew"); + signall[izone]->Rebin(10 / irebin); + + if (izone == 0) { //iiter%8 ==0) { + ps.NewPage(); + } + c0->cd(izone + 1); + if (signall[izone]->GetEntries() / 2. > 5) { + double binwid = signall[izone]->GetBinWidth(1); + + Double_t parall[nsgpr]; + double parserr[nsgpr]; + double fitres[nsgpr]; + double pedht = 0; + + char temp[20]; + xmn = signall[izone]->GetXaxis()->GetXmin(); + xmx = signall[izone]->GetXaxis()->GetXmax(); + int nbn = signall[izone]->FindBin(0); + + cout << "bincenter ===================================== " << signall[izone]->GetBinCenter(nbn) << endl; + pedht = (signall[izone]->GetBinContent(nbn - 1) + signall[izone]->GetBinContent(nbn) + + signall[izone]->GetBinContent(nbn + 1)) / + 3.; + + parall[0] = max(1.0, 0.9 * pedht); //Pedestal peak + parall[1] = 0.00; //pedestal mean + parall[2] = 0.03; //pedestal width + parall[3] = 0.135; //Gaussian smearing of Landau function + parall[4] = 0.7 * signallunb[izone]->GetMean(); //fitprm[4][jk]; //from 2015 cosmic data + parall[5] = signallunb[izone]->GetEntries() / 2.; + parall[6] = 0.2238; // from 2015 cosmic data + parall[7] = 5.0; + + nvalft = min(nmxbin, signallunb[izone]->GetNbinsX()); + + for (int lm = 0; lm < nvalft; lm++) { + xvalft[lm] = signallunb[izone]->GetBinCenter(lm + 1); + yvalft[lm] = signallunb[izone]->GetBinContent(lm + 1); + } + + TMinuit* gMinuit = new TMinuit(nsgpr); + TString namex[nsgpr] = {"const", "mean", "sigma", "Width", "MP", "Area", "GSigma", "Exp"}; + double strt[nsgpr] = {parall[0], parall[1], parall[2], parall[3], parall[4], parall[5], parall[6], parall[7]}; + double alx = max(0.0, 0.1 * parall[0] - 1.1); + double alowmn[nsgpr] = { + alx, -0.1, -0.1, 0.06, 0.5 * strt[4] - 0.5, 0.1 * strt[5], 0.1 * strt[6], 0.5 * parall[7]}; + double ahighmn[nsgpr] = { + 5.0 * parall[0] + 10.1, 0.1, 0.1, 0.25, 1.5 * strt[4] + 0.5, 1.5 * strt[5], 3.2 * strt[6], 10.0 * parall[7]}; + + double step[nsgpr] = {0.1, 0.01, 0.01, 0.001, 0.001, 1.0, 0.001, 0.01}; + + gMinuit->SetFCN(fcnsg); + + double arglist[10]; + int ierflg = 0; + arglist[0] = 0.5; + gMinuit->mnexcm("SET ERR", arglist, 1, ierflg); + + for (int lm = 0; lm < nsgpr; lm++) { + gMinuit->mnparm(lm, namex[lm], strt[lm], step[lm], alowmn[lm], ahighmn[lm], ierflg); + } + + arglist[0] = 0; + gMinuit->mnexcm("MINIMIZE", arglist, 0, ierflg); + + arglist[0] = 0; + gMinuit->mnexcm("IMPROVE", arglist, 0, ierflg); + + TString chnam; + double parv, err, xlo, xup, plerr, mierr, eparab, gcc; + int iuit; + + for (int lm = 0; lm < nsgpr; lm++) { + gMinuit->mnpout(lm, chnam, parv, err, xlo, xup, iuit); + gMinuit->mnerrs(lm, plerr, mierr, eparab, gcc); + fitres[lm] = fitprm[lm][jk] = parv; + parserr[lm] = err; + } + + fitres[0] *= binwid; + fitres[5] *= binwid; + + double fedm, errdef; + int nparx, istat; + gMinuit->mnstat(fitchisq, fedm, errdef, fitndof, nparx, istat); + + delete gMinuit; + + anormglb = 1; + double tmpnorm = 0; + for (int ix = 0; ix < 600; ix++) { + double xval[2]; + xval[0] = -5 + (ix + 0.5) * .1; + tmpnorm += 0.1 * langaufun(xval, &fitres[3]) / fitres[5]; + } + anormglb = tmpnorm; + + double stp = 30 * fitres[3] * fitres[4] / 1000.; + double str = fitres[4] * (1. - 5. * fitres[3]); + double xx[2]; + double sum1 = 0; + double sum2 = 0; + + for (int lm = 0; lm < 1000; lm++) { + xx[0] = str + (lm + 0.5) * stp; + double landf = langaufun(xx, &fitres[3]); //No need of normalisation + sum1 += landf; + sum2 += xx[0] * landf; + } + + sum2 /= TMath::Max(0.1, sum1); + // signall[izone]->GetXaxis()->SetRangeUser(-0.25, 4.75); + signall[izone]->Draw("hist"); + + sprintf(temp, "pedfun_%i", izone); + pedfun[izone] = new TF1(temp, gausX, xmn, xmx, nbgpr); + pedfun[izone]->SetParameters(fitres); + pedfun[izone]->SetLineColor(3); + pedfun[izone]->SetLineWidth(1); + pedfun[izone]->Draw("same"); + + sprintf(temp, "signalfun_%i", izone); + + sigfun[izone] = new TF1(temp, langaufun, xmn, xmx, nsgpr - nbgpr); + sigfun[izone]->SetParameters(&fitres[3]); + sigfun[izone]->SetLineWidth(1); + sigfun[izone]->SetLineColor(4); + sigfun[izone]->Draw("same"); + + cout << "sum2 " << sum2 << " " << sigfun[izone]->Integral(fitres[4] * (1. - 5. * fitres[3]), str + 1000.5 * stp) + << " " << binwid << endl; + + sprintf(temp, "total_%i", izone); + signalx[izone] = new TF1(temp, totalfunc, xmn, xmx, nsgpr); + signalx[izone]->SetParameters(fitres); + signalx[izone]->SetLineWidth(1); + signalx[izone]->Draw("same"); + + latex.DrawLatex( + 0.60, 0.83, Form("#mu: %g#pm%g", int(1000 * fitres[4]) / 1000., int(1000 * parserr[4]) / 1000.)); + latex.DrawLatex(0.60, + 0.765, + Form("#Gamma: %g#pm%g", + int(1000 * fitres[3] * fitres[4]) / 1000., + int(1000 * (sqrt((fitres[3] * parserr[4]) * (fitres[3] * parserr[4]) + + (fitres[4] * parserr[3]) * (fitres[4] * parserr[3])))) / + 1000.)); + latex.DrawLatex( + 0.60, 0.70, Form("#sigma: %g#pm%g", int(1000 * fitres[6]) / 1000., int(1000 * parserr[6]) / 1000.)); + latex.DrawLatex(0.65, 0.64, Form("A: %g#pm%g", int(1 * fitres[5]) / 1., int(10 * parserr[5]) / 10.)); + latex.DrawLatex(0.67, 0.58, Form("Ex: %g#pm%g", int(10 * fitres[7]) / 10., int(10 * parserr[7]) / 10.)); + + latex.DrawLatex(0.67, 0.52, Form("Mean: %g ", int(100 * sum2) / 100.)); + + cout << "histinfo fit " << std::setw(3) << ieta << " " << std::setw(3) << ij + 1 << " " << std::setw(5) + << signallunb[izone]->GetEntries() / 2. << " " << std::setw(6) << signallunb[izone]->GetMean() << " " + << std::setw(6) << signallunb[izone]->GetRMS() << " " << std::setw(6) << fitchisq << " " << std::setw(3) + << fitndof << endl; + + file_out << "histinfo fit " << std::setw(3) << ieta << " " << std::setw(3) << ij + 1 << " " << std::setw(5) + << signallunb[izone]->GetEntries() / 2. << " " << std::setw(6) << signallunb[izone]->GetMean() << " " + << std::setw(6) << signallunb[izone]->GetRMS() << endl; + + file_out << "fitresx " << ieta << " " << ij + 1 << " " << fitres[0] / binwid << " " << fitres[1] << " " + << fitres[2] << " " << fitres[3] << " " << fitres[4] << " " << fitres[5] / binwid << " " << fitres[6] + << " " << signallunb[izone]->GetEntries() / 2. << " " << fitchisq << " " << fitndof << " " << binwid + << " " << sum2 << " " << fitres[7] << endl; + file_out << "parserr " << ieta << " " << ij + 1 << " " << parserr[0] << " " << parserr[1] << " " << parserr[2] + << " " << parserr[3] << " " << parserr[4] << " " << parserr[5] << " " << parserr[6] << " " + << parserr[7] << endl; + + double diff = fitres[4] - fitres[1]; + if (diff <= 0) + diff = 0.000001; + + int ifl = nphimx * jk + ij; + + fit_chi->Fill(ifl, fitchisq); //signal[izone]->GetChisquare()); + sig_evt->Fill(ifl, signallunb[izone]->GetEntries() / 2.); + fit_sigevt->Fill(ifl, fitres[5] / binwid); + fit_bkgevt->Fill(ifl, fitres[0] / binwid); + + sig_mean->Fill(ifl, fitres[4]); + sig_diff->Fill(ifl, fitres[4] - fitres[1]); + sig_width->Fill(ifl, fitres[3]); + sig_sigma->Fill(ifl, fitres[6]); + sig_expo->Fill(ifl, fitres[7]); + sig_meanerr->Fill(ifl, parserr[4]); + if (fitres[4] - fitres[1] > 1.e-4) + sig_meanerrp->Fill(ifl, 100 * parserr[4] / (fitres[4] - fitres[1])); + if (fitres[2] > 1.e-4) + sig_signf->Fill(ifl, (fitres[4] - fitres[1]) / fitres[2]); + + sig_statmean->Fill(ifl, signallunb[izone]->GetMean()); + sig_rms->Fill(ifl, signallunb[izone]->GetRMS()); + + fit2d_chi->Fill(ieta, iphi, fitchisq); //signal[izone]->GetChisquare()); + sig2d_evt->Fill(ieta, iphi, signallunb[izone]->GetEntries() / 2.); + fit2d_sigevt->Fill(ieta, iphi, fitres[5] / binwid); + fit2d_bkgevt->Fill(ieta, iphi, fitres[0] / binwid); + + sig2d_mean->Fill(ieta, iphi, fitres[4]); + sig2d_diff->Fill(ieta, iphi, fitres[4] - fitres[1]); + sig2d_width->Fill(ieta, iphi, fitres[3]); + sig2d_sigma->Fill(ieta, iphi, fitres[6]); + sig2d_expo->Fill(ieta, iphi, fitres[7]); + + sig2d_meanerr->Fill(ieta, iphi, parserr[4]); + if (fitres[4] - fitres[1] > 1.e-4) + sig2d_meanerrp->Fill(ieta, iphi, 100 * parserr[4] / (fitres[4] - fitres[1])); + if (fitres[2] > 1.e-4) + sig2d_signf->Fill(ieta, iphi, (fitres[4] - fitres[1]) / fitres[2]); + + sig2d_statmean->Fill(ieta, iphi, signallunb[izone]->GetMean()); + sig2d_rms->Fill(ieta, iphi, signallunb[izone]->GetRMS()); + } else { //if (signallunb[izone]->GetEntries()/2. >10) { + signall[izone]->Draw(); + float varx = 0.000; + + file_out << "histinfo nof " << std::setw(3) << ieta << " " << std::setw(3) << ij + 1 << " " << std::setw(5) + << signallunb[izone]->GetEntries() / 2. << " " << std::setw(6) << signallunb[izone]->GetMean() << " " + << std::setw(6) << signallunb[izone]->GetRMS() << endl; + + file_out << "fitresx " << ieta << " " << ij + 1 << " " << varx << " " << varx << " " << varx << " " << varx + << " " << varx << " " << varx << " " << varx << " " << varx << " " << varx << " " << varx << " " + << varx << " " << varx << " " << varx << endl; + file_out << "parserr " << ieta << " " << ij + 1 << " " << varx << " " << varx << " " << varx << " " << varx + << " " << varx << " " << varx << " " << varx << " " << varx << " " << varx << endl; + } + iiter++; + if (iiter % nsample == 0) { + c0->Update(); + + for (int lm = 0; lm < nsample; lm++) { + if (pedfun[lm]) { + delete pedfun[lm]; + pedfun[lm] = 0; + } + if (sigfun[lm]) { + delete sigfun[lm]; + sigfun[lm] = 0; + } + if (signalx[lm]) { + delete signalx[lm]; + signalx[lm] = 0; + } + if (signall[lm]) { + delete signall[lm]; + signall[lm] = 0; + } + if (signallunb[lm]) { + delete signallunb[lm]; + signallunb[lm] = 0; + } + } + } + } //for (int jk=0; jkUpdate(); + for (int lm = 0; lm < nsample; lm++) { + if (pedfun[lm]) { + delete pedfun[lm]; + pedfun[lm] = 0; + } + if (sigfun[lm]) { + delete sigfun[lm]; + sigfun[lm] = 0; + } + if (signalx[lm]) { + delete signalx[lm]; + signalx[lm] = 0; + } + if (signall[lm]) { + delete signall[lm]; + signall[lm] = 0; + } + if (signallunb[lm]) { + delete signallunb[lm]; + signallunb[lm] = 0; + } + } + } + + if (c0) { + delete c0; + c0 = 0; + } + + xsiz = 600; //int xsiz = 600; + ysiz = 800; //int ysiz = 800; + + ps.NewPage(); + gStyle->SetOptLogy(0); + gStyle->SetTitleFontSize(0.05); + gStyle->SetTitleSize(0.025, "XYZ"); + gStyle->SetLabelSize(0.025, "XYZ"); + gStyle->SetStatFontSize(.045); + + gStyle->SetPadGridX(1); //bool input yes/no, must give an input + gStyle->SetPadGridY(1); + gStyle->SetGridStyle(3); + + gStyle->SetOptStat(0); + gStyle->SetPadTopMargin(.07); + gStyle->SetPadLeftMargin(0.07); + + ps.NewPage(); + TCanvas* c1 = new TCanvas("c1", " Pedestal vs signal", xsiz, ysiz); + sig_evt->Draw("hist"); + c1->Update(); + + ps.NewPage(); + sig_statmean->Draw("hist"); + c1->Update(); + + ps.NewPage(); + sig_rms->Draw("hist"); + c1->Update(); + + ps.NewPage(); + fit_chi->Draw("hist"); + c1->Update(); + + ps.NewPage(); + fit_sigevt->Draw("hist"); + c1->Update(); + + ps.NewPage(); + fit_bkgevt->Draw("hist"); + c1->Update(); + + ps.NewPage(); + sig_mean->Draw("hist"); + c1->Update(); + + ps.NewPage(); + sig_width->Draw("hist"); + c1->Update(); + + ps.NewPage(); + sig_sigma->Draw("hist"); + c1->Update(); + + ps.NewPage(); + sig_expo->Draw("hist"); + c1->Update(); + + ps.NewPage(); + sig_meanerr->Draw("hist"); + c1->Update(); + + ps.NewPage(); + sig_meanerrp->Draw("hist"); + c1->Update(); + + ps.NewPage(); + sig_signf->Draw("hist"); + c1->Update(); + + gStyle->SetPadLeftMargin(0.06); + gStyle->SetPadRightMargin(0.15); + + ps.NewPage(); + TCanvas* c2y = new TCanvas("c2y", " Pedestal vs Signal", xsiz, ysiz); + + sig2d_evt->Draw("colz"); + c2y->Update(); + + ps.NewPage(); + sig2d_statmean->SetMaximum(min(3.0, sig2d_statmean->GetMaximum())); + sig2d_statmean->SetMinimum(max(-2.0, sig2d_statmean->GetMinimum())); + sig2d_statmean->Draw("colz"); + c2y->Update(); + + ps.NewPage(); + sig2d_rms->SetMaximum(min(3.0, sig2d_rms->GetMaximum())); + sig2d_rms->SetMinimum(max(0.0, sig2d_rms->GetMinimum())); + sig2d_rms->Draw("colz"); + c2y->Update(); + + ps.NewPage(); + + fit2d_chi->Draw("colz"); + c2y->Update(); + + ps.NewPage(); + fit2d_sigevt->Draw("colz"); + c2y->Update(); + + ps.NewPage(); + fit2d_bkgevt->Draw("colz"); + c2y->Update(); + + ps.NewPage(); + sig2d_mean->SetMaximum(min(2.0, sig2d_mean->GetMaximum())); + sig2d_mean->SetMinimum(max(0.1, sig2d_mean->GetMinimum())); + sig2d_mean->Draw("colz"); + c2y->Update(); + + ps.NewPage(); + sig2d_width->SetMaximum(min(0.5, sig2d_width->GetMaximum())); + sig2d_width->SetMinimum(max(0.01, sig2d_width->GetMinimum())); + sig2d_width->Draw("colz"); + c2y->Update(); + + ps.NewPage(); + sig2d_sigma->SetMaximum(min(0.5, sig2d_sigma->GetMaximum())); + sig2d_sigma->SetMinimum(max(0.01, sig2d_sigma->GetMinimum())); + sig2d_sigma->Draw("colz"); + c2y->Update(); + + ps.NewPage(); + sig2d_expo->SetMaximum(min(20., sig2d_expo->GetMaximum())); + sig2d_expo->SetMinimum(max(2.0, sig2d_expo->GetMinimum())); + sig2d_expo->Draw("colz"); + c2y->Update(); + + ps.NewPage(); + sig2d_meanerr->Draw("colz"); + c2y->Update(); + + ps.NewPage(); + sig2d_meanerrp->Draw("colz"); + c2y->Update(); + + ps.NewPage(); + sig2d_signf->Draw("colz"); + c2y->Update(); + + ps.Close(); + + delete c1; + delete c2y; + + file_out.close(); + + fileOut->cd(); + fileOut->Write(); + fileOut->Close(); + + fileIn->cd(); + fileIn->Close(); +} diff --git a/Calibration/HcalCalibAlgos/plugins/HOCalibAnalyzer.cc b/Calibration/HcalCalibAlgos/plugins/HOCalibAnalyzer.cc index 16b01a3e24890..a96cdc6cfecb2 100644 --- a/Calibration/HcalCalibAlgos/plugins/HOCalibAnalyzer.cc +++ b/Calibration/HcalCalibAlgos/plugins/HOCalibAnalyzer.cc @@ -31,27 +31,20 @@ April 2015 #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/MakerMacros.h" - -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "DataFormats/HcalCalibObjects/interface/HOCalibVariables.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" + #include "FWCore/ServiceRegistry/interface/Service.h" #include "FWCore/Utilities/interface/InputTag.h" #include "CommonTools/UtilAlgos/interface/TFileService.h" +#include "DataFormats/HcalCalibObjects/interface/HOCalibVariables.h" #include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h" -#include "TMath.h" #include "TFile.h" #include "TH1F.h" #include "TH2F.h" #include "TTree.h" #include "TProfile.h" -#include "TPostScript.h" -#include "TCanvas.h" -#include "TF1.h" -#include "TStyle.h" -#include "TMinuit.h" -#include "TMath.h" #include @@ -59,190 +52,50 @@ April 2015 #include #include -// -// Look for nearby pixel through eta, phi informations for pixel cross-talk -// 1. Look PIXEL code from (eta,phi) -// 2. Go to nearby pixel code -// 3. Come back to (eta,phi) from pixel code -// Though it works, it is a very ugly/crude way to get cross talk, need better algorithms -// - -static const int mapx1[6][3] = {{1, 4, 8}, {12, 7, 3}, {5, 9, 13}, {11, 6, 2}, {16, 15, 14}, {19, 18, 17}}; - -static const int mapx2[6][3] = {{1, 4, 8}, {12, 7, 3}, {5, 9, 13}, {11, 6, 2}, {16, 15, 14}, {-1, -1, -1}}; - -static const int mapx0p[9][2] = {{3, 1}, {7, 4}, {6, 5}, {12, 8}, {0, 0}, {11, 9}, {16, 13}, {15, 14}, {19, 17}}; -static const int mapx0m[9][2] = {{17, 19}, {14, 15}, {13, 16}, {9, 11}, {0, 0}, {8, 12}, {5, 6}, {4, 7}, {1, 3}}; - -static const int etamap[4][21] = {{-1, 0, 3, 1, 0, 2, 3, 1, 0, 2, -1, 3, 1, 2, 4, 4, 4, -1, -1, -1, -1}, //etamap2 - {-1, 0, 3, 1, 0, 2, 3, 1, 0, 2, -1, 3, 1, 2, 4, 4, 4, 5, 5, 5, -1}, //etamap1 - {-1, 0, -1, 0, 1, 2, 2, 1, 3, 5, -1, 5, 3, 6, 7, 7, 6, 8, -1, 8, -1}, //etamap0p - {-1, 8, -1, 8, 7, 6, 6, 7, 5, 3, -1, 3, 5, 2, 1, 1, 2, 0, -1, 0, -1}}; //etamap0m - -static const int phimap[4][21] = {{-1, 0, 2, 2, 1, 0, 1, 1, 2, 1, -1, 0, 0, 2, 2, 1, 0, 2, 1, 0, -1}, //phimap2 - {-1, 0, 2, 2, 1, 0, 1, 1, 2, 1, -1, 0, 0, 2, 2, 1, 0, 2, 1, 0, -1}, //phimap1 - {-1, 1, -1, 0, 1, 1, 0, 0, 1, 1, -1, 0, 0, 1, 1, 0, 0, 1, -1, 0, -1}, //phimap0p - {-1, 0, -1, 1, 0, 0, 1, 1, 0, 0, -1, 1, 1, 0, 0, 1, 1, 0, -1, 1, -1}}; //phimap0m -//swapped phi map for R0+/R0- (15/03/07) - -static const int npixleft[21] = {0, 0, 1, 2, 0, 4, 5, 6, 0, 8, 0, 0, 11, 0, 13, 14, 15, 0, 17, 18, 0}; -static const int npixrigh[21] = {0, 2, 3, 0, 5, 6, 7, 0, 9, 0, 0, 12, 0, 14, 15, 16, 0, 18, 19, 0, 0}; -static const int npixlebt[21] = {0, 0, 0, 0, 0, 1, 2, 3, 0, 4, 0, 6, 7, 8, 9, 0, 11, 13, 14, 15, 0}; -static const int npixribt[21] = {0, 0, 0, 0, 1, 2, 3, 0, 4, 5, 0, 7, 0, 9, 0, 11, 12, 14, 15, 16, 0}; -static const int npixleup[21] = {0, 4, 5, 6, 8, 9, 0, 11, 0, 13, 0, 15, 16, 0, 17, 18, 19, 0, 0, 0, 0}; -static const int npixriup[21] = {0, 5, 6, 7, 9, 0, 11, 12, 13, 14, 0, 16, 0, 17, 18, 19, 0, 0, 0, 0, 0}; - -static const int netamx = 30; -static const int nphimx = 72; -static const int nbgpr = 3; -static const int nsgpr = 7; - -int ietafit; -int iphifit; -std::vector sig_reg[netamx][nphimx + 1]; -std::vector cro_ssg[netamx][nphimx + 1]; +using namespace std; +using namespace edm; -//#define CORREL +//#define EDM_ML_DEBUG // // class decleration // -Double_t gausX(Double_t* x, Double_t* par) { return par[0] * (TMath::Gaus(x[0], par[1], par[2], kTRUE)); } - -Double_t langaufun(Double_t* x, Double_t* par) { - //Fit parameters: - //par[0]*par[1]=Width (scale) parameter of Landau density - //par[1]=Most Probable (MP, location) parameter of Landau density - //par[2]=Total area (integral -inf to inf, normalization constant) - //par[3]=Width (sigma) of convoluted Gaussian function - // - //In the Landau distribution (represented by the CERNLIB approximation), - //the maximum is located at x=-0.22278298 with the location parameter=0. - //This shift is corrected within this function, so that the actual - //maximum is identical to the MP parameter. - // /* - // Numeric constants - Double_t invsq2pi = 0.3989422804014; // (2 pi)^(-1/2) - Double_t mpshift = -0.22278298; // Landau maximum location - - // Control constants - Double_t np = 100.0; // number of convolution steps - Double_t sc = 5.0; // convolution extends to +-sc Gaussian sigmas - - // Variables - Double_t xx; - Double_t mpc; - Double_t fland; - Double_t sum = 0.0; - Double_t xlow, xupp; - Double_t step; - - // MP shift correction - mpc = par[1] - mpshift * par[0] * par[1]; - - // Range of convolution integral - xlow = x[0] - sc * par[3]; - xupp = x[0] + sc * par[3]; - - step = (xupp - xlow) / np; - - // Convolution integral of Landau and Gaussian by sum - for (double ij = 1.0; ij <= np / 2; ij++) { - xx = xlow + (ij - .5) * step; - fland = TMath::Landau(xx, mpc, par[0] * par[1], kTRUE); // / par[0]; - sum += fland * TMath::Gaus(x[0], xx, par[3]); - xx = xupp - (ij - .5) * step; - fland = TMath::Landau(xx, mpc, par[0] * par[1], kTRUE); // / par[0]; - sum += fland * TMath::Gaus(x[0], xx, par[3]); - } - - return (par[2] * step * sum * invsq2pi / par[3]); -} - -Double_t totalfunc(Double_t* x, Double_t* par) { return gausX(x, par) + langaufun(x, &par[3]); } - -void fcnbg(Int_t& npar, Double_t* gin, Double_t& f, Double_t* par, Int_t flag) { - double fval = -par[0]; - for (unsigned ij = 0; ij < cro_ssg[ietafit][iphifit].size(); ij++) { - double xval = (double)cro_ssg[ietafit][iphifit][ij]; - fval += std::log(std::max(1.e-30, par[0] * TMath::Gaus(xval, par[1], par[2], true))); - } - f = -fval; -} - -void fcnsg(Int_t& npar, Double_t* gin, Double_t& f, Double_t* par, Int_t flag) { - double xval[2]; - double fval = -(par[0] + par[5]); - for (unsigned ij = 0; ij < sig_reg[ietafit][iphifit].size(); ij++) { - xval[0] = (double)sig_reg[ietafit][iphifit][ij]; - fval += std::log(totalfunc(xval, par)); - } - f = -fval; -} - -void set_mean(double& x, bool mdigi) { - if (mdigi) { - x = std::min(x, 0.5); - x = std::max(x, -0.5); - } else { - x = std::min(x, 0.1); - x = std::max(x, -0.1); - } -} - -void set_sigma(double& x, bool mdigi) { - if (mdigi) { - x = std::min(x, 1.2); - x = std::max(x, -1.2); - } else { - x = std::min(x, 0.24); - x = std::max(x, 0.03); - } -} - class HOCalibAnalyzer : public edm::one::EDAnalyzer { public: explicit HOCalibAnalyzer(const edm::ParameterSet&); ~HOCalibAnalyzer() override; private: - void beginJob() override; + void beginJob() override {} void analyze(const edm::Event&, const edm::EventSetup&) override; - void endJob() override; + void endJob() override {} + + static constexpr int netamx = 30; + static constexpr int nphimx = 72; + static constexpr int ringmx = 5; + static constexpr int ncut = 14; + + const char* varcrit[3] = {"All", "steps", "n-1"}; // or opposite + + const double elosfact = (14.9 + 0.96 * fabs(log(8 * 2.8)) + 0.033 * 8 * (1.0 - pow(8, -0.33))); int getHOieta(int ij) { return (ij < netamx / 2) ? -netamx / 2 + ij : -netamx / 2 + ij + 1; } int invert_HOieta(int ieta) { return (ieta < 0) ? netamx / 2 + ieta : netamx / 2 + ieta - 1; } - TFile* theFile; - std::string theRootFileName; - std::string theoutputtxtFile; - std::string theoutputpsFile; - - bool m_allHOsignal; - bool m_hotime; - bool m_hbtime; - bool m_correl; - bool m_checkmap; - bool m_hbinfo; - bool m_combined; - bool m_constant; - bool m_figure; - bool m_cosmic; - bool m_histfit; - bool m_pedsuppr; - double m_sigma; + int mypow_2[31]; - static const int ncut = 13; - static const int mypow_2_ncut = 8192; // 2^13, should be changed to match ncut + bool m_cosmic; + bool m_zeroField; + int m_bins; + double m_low; + double m_ahigh; + bool m_histFill; //Stored signals of individual HO towers with default selection criteria + bool m_treeFill; //Store rootuple without almost any selection criteria except a quality on muon int ipass; TTree* T1; - TH2F* ho_entry; - TH2F* ho_energy; - TH2F* ho_energy2; - TH2F* ho_rms; TH1F* ho_indenergy[netamx][nphimx]; TH1F* muonnm; @@ -257,138 +110,12 @@ class HOCalibAnalyzer : public edm::one::EDAnalyzer { TH1F* sel_muonph; TH1F* sel_muonch; - TProfile* hotime[netamx][nphimx]; - TProfile* hopedtime[netamx][nphimx]; - TProfile* hbtime[netamx][nphimx]; - - TH1F* corrsglb[netamx][nphimx]; - TH1F* corrsgrb[netamx][nphimx]; - TH1F* corrsglu[netamx][nphimx]; - TH1F* corrsgru[netamx][nphimx]; - TH1F* corrsgall[netamx][nphimx]; - - TH1F* corrsgl[netamx][nphimx]; - TH1F* corrsgr[netamx][nphimx]; - - TH1F* mncorrsglb; - TH1F* mncorrsgrb; - TH1F* mncorrsglu; - TH1F* mncorrsgru; - TH1F* mncorrsgall; - - TH1F* mncorrsgl; - TH1F* mncorrsgr; - - TH1F* rmscorrsglb; - TH1F* rmscorrsgrb; - TH1F* rmscorrsglu; - TH1F* rmscorrsgru; - TH1F* rmscorrsgall; - - TH1F* rmscorrsgl; - TH1F* rmscorrsgr; - - TH1F* nevcorrsglb; - TH1F* nevcorrsgrb; - TH1F* nevcorrsglu; - TH1F* nevcorrsgru; - TH1F* nevcorrsgall; - - TH1F* nevcorrsgl; - TH1F* nevcorrsgr; - - TH1F* corrsgc[netamx][nphimx]; - TH1F* mncorrsgc; - TH1F* rmscorrsgc; - TH1F* nevcorrsgc; - - TH1F* sigrsg[netamx][nphimx + 1]; - TH1F* crossg[netamx][nphimx + 1]; - float invang[netamx][nphimx + 1]; - - TH1F* mnsigrsg; - TH1F* mncrossg; - - TH1F* rmssigrsg; - TH1F* rmscrossg; - - TH1F* nevsigrsg; - TH1F* nevcrossg; - - TH1F* ho_sig2p[9]; - TH1F* ho_sig1p[9]; - TH1F* ho_sig00[9]; - TH1F* ho_sig1m[9]; - TH1F* ho_sig2m[9]; - - TH1F* hbhe_sig[9]; + // TProfile* sigvsevt[15][ncut]; + TH2F* sig_eta_evt[3 * netamx][ncut]; //For individual eta + TH2F* sigvsevt[3 * netamx][ncut]; + TH1F* variab[3 * netamx][ncut]; - static const int ringmx = 5; - static const int sectmx = 12; - static const int routmx = 36; - static const int rout12mx = 24; - static const int neffip = 6; - - TProfile* com_hotime[ringmx][sectmx]; - TProfile* com_hopedtime[ringmx][sectmx]; - - TProfile* com_hbtime[ringmx][sectmx]; - - TH1F* com_corrsglb[ringmx][sectmx]; - TH1F* com_corrsgrb[ringmx][sectmx]; - TH1F* com_corrsglu[ringmx][sectmx]; - TH1F* com_corrsgru[ringmx][sectmx]; - TH1F* com_corrsgall[ringmx][sectmx]; - - TH1F* com_corrsgl[ringmx][sectmx]; - TH1F* com_corrsgr[ringmx][sectmx]; - - TH1F* com_corrsgc[ringmx][sectmx]; - - TH1F* com_sigrsg[ringmx][routmx + 1]; - TH1F* com_crossg[ringmx][routmx + 1]; - float com_invang[ringmx][routmx + 1]; - - TH1F* ped_evt; - TH1F* ped_mean; - TH1F* ped_width; - TH1F* fit_chi; - TH1F* sig_evt; - TH1F* fit_sigevt; - TH1F* fit_bkgevt; - TH1F* sig_mean; - TH1F* sig_diff; - TH1F* sig_width; - TH1F* sig_sigma; - TH1F* sig_meanerr; - TH1F* sig_meanerrp; - TH1F* sig_signf; - - TH1F* ped_statmean; - TH1F* sig_statmean; - TH1F* ped_rms; - TH1F* sig_rms; - - TH2F* const_eta_phi; - - TH1F* const_eta[netamx]; - TH1F* stat_eta[netamx]; - TH1F* statmn_eta[netamx]; - TH1F* peak_eta[netamx]; - - TH1F* const_hpdrm[ringmx]; - TH1F* peak_hpdrm[ringmx]; - - TH1F* mean_eta_ave; - TH1F* mean_phi_ave; - TH1F* mean_phi_hst; - - TH2F* sig_effi[neffip]; - TH2F* mean_energy; - - double fitprm[nsgpr][netamx]; - - TProfile* sigvsevt[15][ncut]; + TH2F* mu_projection[ncut + 1]; unsigned ievt, hoflag; int irun, ilumi, nprim, isect, isect2, ndof, nmuon; @@ -396,13 +123,11 @@ class HOCalibAnalyzer : public edm::one::EDAnalyzer { float inslumi, trkdr, trkdz, trkvx, trkvy, trkvz, trkmm, trkth, trkph, chisq, therr, pherr, hodx, hody, hoang, htime, hosig[9], hocorsig[18], hocro, hbhesig[9], caloen[3]; float momatho, tkpt03, ecal03, hcal03; + float tmphoang; + + int nevents[10]; - int Nevents; - int nbn; - float alow; - float ahigh; - float binwid; - int irunold; + float ncount[ringmx][ncut + 10]; edm::InputTag hoCalibVariableCollectionTag; edm::EDGetTokenT tok_ho_; @@ -410,12 +135,6 @@ class HOCalibAnalyzer : public edm::one::EDAnalyzer { // ----------member data --------------------------- }; -const int HOCalibAnalyzer::ringmx; -const int HOCalibAnalyzer::sectmx; -const int HOCalibAnalyzer::routmx; -const int HOCalibAnalyzer::rout12mx; -const int HOCalibAnalyzer::neffip; - // // constants, enums and typedefs // @@ -431,37 +150,30 @@ const int HOCalibAnalyzer::neffip; HOCalibAnalyzer::HOCalibAnalyzer(const edm::ParameterSet& iConfig) { // It is very likely you want the following in your configuration // hoCalibVariableCollectionTag = cms.InputTag('hoCalibProducer', 'HOCalibVariableCollection') + usesResource(TFileService::kSharedResource); + tok_ho_ = consumes(iConfig.getParameter("hoCalibVariableCollectionTag")); tok_allho_ = consumes(iConfig.getParameter("hoInputTag")); //now do what ever initialization is needed ipass = 0; - Nevents = 0; - - theRootFileName = iConfig.getUntrackedParameter("RootFileName", "test.root"); - theoutputtxtFile = iConfig.getUntrackedParameter("txtFileName", "test.txt"); - theoutputpsFile = iConfig.getUntrackedParameter("psFileName", "test.ps"); - - m_allHOsignal = iConfig.getUntrackedParameter("allsignal", false); - m_hbinfo = iConfig.getUntrackedParameter("hbinfo", false); - m_hbtime = iConfig.getUntrackedParameter("hbtime", false); - m_hotime = iConfig.getUntrackedParameter("hotime", false); - m_correl = iConfig.getUntrackedParameter("correl", false); - m_checkmap = iConfig.getUntrackedParameter("checkmap", false); - m_combined = iConfig.getUntrackedParameter("combined", false); - m_constant = iConfig.getUntrackedParameter("get_constant", false); - m_figure = iConfig.getUntrackedParameter("get_figure", true); - m_histfit = iConfig.getUntrackedParameter("histFit", true); - m_pedsuppr = iConfig.getUntrackedParameter("pedSuppr", true); + for (int ij = 0; ij < 10; ij++) { + nevents[ij] = 0; + } + m_cosmic = iConfig.getUntrackedParameter("cosmic", true); - m_sigma = iConfig.getUntrackedParameter("sigma", 0.05); + m_zeroField = iConfig.getUntrackedParameter("zeroField", false); - edm::Service fs; + m_bins = iConfig.getUntrackedParameter("HOSignalBins", 120); + m_low = iConfig.getUntrackedParameter("lowerRange", -1.0); + m_ahigh = iConfig.getUntrackedParameter("upperRange", 29.0); - theFile = new TFile(theRootFileName.c_str(), "RECREATE"); - theFile->cd(); + m_histFill = iConfig.getUntrackedParameter("histFill", true); + m_treeFill = iConfig.getUntrackedParameter("treeFill", false); + + edm::Service fs; - T1 = fs->make("T1", "DT+CSC+HO"); + T1 = fs->make("T1", "HOSignal"); T1->Branch("irun", &irun, "irun/I"); T1->Branch("ievt", &ievt, "ievt/i"); @@ -505,38 +217,16 @@ HOCalibAnalyzer::HOCalibAnalyzer(const edm::ParameterSet& iConfig) { T1->Branch("hocorsig", hocorsig, "hocorsig[18]/F"); T1->Branch("caloen", caloen, "caloen[3]/F"); - if (m_hbinfo) { - T1->Branch("hbhesig", hbhesig, "hbhesig[9]/F"); - } - char name[200]; char title[200]; - if (m_allHOsignal) { - ho_entry = fs->make( - "ho_entry", "ho entry", netamx + 1, -netamx / 2 - 0.5, netamx / 2 + 0.5, nphimx, 0.5, nphimx + 0.5); - - ho_energy = fs->make( - "ho_energy", "ho energy (GeV)", netamx + 1, -netamx / 2 - 0.5, netamx / 2 + 0.5, nphimx, 0.5, nphimx + 0.5); - - ho_energy2 = fs->make("ho_energy2", - "ho energy2 (GeV*GeV)", - netamx + 1, - -netamx / 2 - 0.5, - netamx / 2 + 0.5, - nphimx, - 0.5, - nphimx + 0.5); - - ho_rms = fs->make( - "ho_rms", "ho rms (GeV)", netamx + 1, -netamx / 2 - 0.5, netamx / 2 + 0.5, nphimx, 0.5, nphimx + 0.5); - + if (m_histFill) { for (int ij = 0; ij < netamx; ij++) { int ieta = getHOieta(ij); for (int jk = 0; jk < nphimx; jk++) { sprintf(name, "ho_indenergy_%i_%i", ij, jk); sprintf(title, "ho IndEnergy (GeV) i#eta=%i i#phi=%i", ieta, jk + 1); - ho_indenergy[ij][jk] = fs->make(name, title, 120, -5., 55.); + ho_indenergy[ij][jk] = fs->make(name, title, 1200, m_low, m_ahigh); } } } @@ -553,359 +243,75 @@ HOCalibAnalyzer::HOCalibAnalyzer(const edm::ParameterSet& iConfig) { sel_muonph = fs->make("sel_muonph", "{Phi}_{mu}(sel)", 180, -180., 180.); sel_muonch = fs->make("sel_muonch", "{chi^2}/ndf(sel)", 100, 0., 1000.); - int nbin = 50; //40;// 45; //50; //55; //60; //55; //45; //40; //50; - alow = -2.0; // -1.85; //-1.90; // -1.95; // -2.0; - ahigh = 8.0; // 8.15; // 8.10; // 8.05; // 8.0; - - float tmpwid = (ahigh - alow) / nbin; - nbn = int(-alow / tmpwid) + 1; - if (nbn < 0) - nbn = 0; - if (nbn > nbin) - nbn = nbin; - - edm::LogVerbatim("HOCalib") << "nbin " << nbin << " " << alow << " " << ahigh << " " << tmpwid << " " << nbn; - - for (int ij = 0; ij < 15; ij++) { - sprintf(title, "sigvsndof_ring%i", ij + 1); - sigvsevt[ij][0] = fs->make(title, title, 50, 0., 50., -9., 20.); - - sprintf(title, "sigvschisq_ring%i", ij + 1); - sigvsevt[ij][1] = fs->make(title, title, 50, 0., 30., -9., 20.); - - sprintf(title, "sigvsth_ring%i", ij + 1); - sigvsevt[ij][2] = fs->make(title, title, 50, .7, 2.4, -9., 20.); - - sprintf(title, "sigvsph_ring%i", ij + 1); - sigvsevt[ij][3] = fs->make(title, title, 50, -2.4, -0.7, -9., 20.); - - sprintf(title, "sigvstherr_ring%i", ij + 1); - sigvsevt[ij][4] = fs->make(title, title, 50, 0., 0.2, -9., 20.); - - sprintf(title, "sigvspherr_ring%i", ij + 1); - sigvsevt[ij][5] = fs->make(title, title, 50, 0., 0.2, -9., 20.); - - sprintf(title, "sigvsdircos_ring%i", ij + 1); - sigvsevt[ij][6] = fs->make(title, title, 50, 0.5, 1., -9., 20.); - - sprintf(title, "sigvstrkmm_ring%i", ij + 1); - sigvsevt[ij][7] = fs->make(title, title, 50, 0., 50., -9., 20.); - - sprintf(title, "sigvsnmuon_ring%i", ij + 1); - sigvsevt[ij][8] = fs->make(title, title, 5, 0.5, 5.5, -9., 20.); - - sprintf(title, "sigvserr_ring%i", ij + 1); - sigvsevt[ij][9] = fs->make(title, title, 50, 0., .3, -9., 20.); - - sprintf(title, "sigvsaccx_ring%i", ij + 1); - sigvsevt[ij][10] = fs->make(title, title, 100, -25., 25., -9., 20.); - - sprintf(title, "sigvsaccy_ring%i", ij + 1); - sigvsevt[ij][11] = fs->make(title, title, 100, -25., 25., -9., 20.); - - sprintf(title, "sigvscalo_ring%i", ij + 1); - sigvsevt[ij][12] = fs->make(title, title, 100, 0., 15., -9., 20.); - } + float pival = acos(-1.); - for (int jk = 0; jk < netamx; jk++) { - int ieta = (jk < 15) ? jk + 1 : 14 - jk; - for (int ij = 0; ij < nphimx + 1; ij++) { - if (ij == nphimx) { - sprintf(title, "sig_eta%i_allphi", ieta); - } else { - sprintf(title, "sig_eta%i_phi%i", ieta, ij + 1); - } - sigrsg[jk][ij] = fs->make(title, title, nbin, alow, ahigh); - if (ij == nphimx) { - sprintf(title, "ped_eta%i_allphi", ieta); - } else { - sprintf(title, "ped_eta%i_phi%i", ieta, ij + 1); + //if change order, change in iselect_wotime also and other efficiency numbers + const char* varnam[ncut] = {"ndof", + "chisq", + "th", + "ph", + "therr", + "pherr", + "dircos", + "trkmm", + "nmuon", + "calo", + "trkiso", + "#phi-dir", + "#eta-dir", + "time"}; + int nbinxx[ncut] = {25, 60, 60, 60, 60, 60, 60, 120, 6, 60, 60, 120, 120, 60}; + double alowxx[ncut] = {5.5, 0., 0., -pival, 0.0, 0.0, 0.0, 0., 0.5, 0.0, 0.0, -20., -32., -45.0}; + double ahghxx[ncut] = {30.5, 40., pival, pival, 0.8, 0.02, 0.5, 300., 6.5, 10.0, 24.0, 20.0, 32.0, 45.0}; + + for (int kl = 0; kl < ncut; kl++) { + for (int jk = 0; jk < 3; jk++) { + for (int ij = 0; ij < netamx; ij++) { + sprintf(name, "sigeta_%i_%i_%i", kl, jk, ij); + sprintf(title, "sigeta %s %s i#eta=%i", varnam[kl], varcrit[jk], getHOieta(ij)); + sig_eta_evt[netamx * jk + ij][kl] = + fs->make(name, title, nbinxx[kl], alowxx[kl], ahghxx[kl], m_bins, m_low, m_ahigh); } - crossg[jk][ij] = fs->make(title, title, nbin, alow, ahigh); - } - - for (int ij = 0; ij < nphimx; ij++) { - if (m_hotime) { - sprintf(title, "hotime_eta%i_phi%i", (jk <= 14) ? jk + 1 : 14 - jk, ij + 1); - hotime[jk][ij] = fs->make(title, title, 10, -0.5, 9.5, -1.0, 30.0); - - sprintf(title, "hopedtime_eta%i_phi%i", (jk <= 14) ? jk + 1 : 14 - jk, ij + 1); - hopedtime[jk][ij] = fs->make(title, title, 10, -0.5, 9.5, -1.0, 30.0); - - } //m_hotime - if (m_hbtime) { // HBTIME - sprintf(title, "hbtime_eta%i_phi%i", (jk <= 15) ? jk + 1 : 15 - jk, ij + 1); - hbtime[jk][ij] = fs->make(title, title, 10, -0.5, 9.5, -1.0, 30.0); - } //m_hbtime - - if (m_correl) { // CORREL - sprintf(title, "corrsg_eta%i_phi%i_leftbottom", ieta, ij + 1); - corrsglb[jk][ij] = fs->make(title, title, nbin, alow, ahigh); - - sprintf(title, "corrsg_eta%i_phi%i_rightbottom", ieta, ij + 1); - corrsgrb[jk][ij] = fs->make(title, title, nbin, alow, ahigh); - - sprintf(title, "corrsg_eta%i_phi%i_leftup", ieta, ij + 1); - corrsglu[jk][ij] = fs->make(title, title, nbin, alow, ahigh); - - sprintf(title, "corrsg_eta%i_phi%i_rightup", ieta, ij + 1); - corrsgru[jk][ij] = fs->make(title, title, nbin, alow, ahigh); - - sprintf(title, "corrsg_eta%i_phi%i_all", ieta, ij + 1); - corrsgall[jk][ij] = fs->make(title, title, nbin, alow, ahigh); - - sprintf(title, "corrsg_eta%i_phi%i_left", ieta, ij + 1); - corrsgl[jk][ij] = fs->make(title, title, nbin, alow, ahigh); - - sprintf(title, "corrsg_eta%i_phi%i_right", ieta, ij + 1); - corrsgr[jk][ij] = fs->make(title, title, nbin, alow, ahigh); - } //m_correl - if (m_checkmap) { // CHECKMAP - sprintf(title, "corrsg_eta%i_phi%i_centrl", ieta, ij + 1); - corrsgc[jk][ij] = fs->make(title, title, nbin, alow, ahigh); - } //m_checkmap } } - mnsigrsg = fs->make( - "mnsigrsg", "mnsigrsg", netamx * nphimx + ringmx * routmx, -0.5, netamx * nphimx + ringmx * routmx - 0.5); - rmssigrsg = fs->make( - "rmssigrsg", "rmssigrsg", netamx * nphimx + ringmx * routmx, -0.5, netamx * nphimx + ringmx * routmx - 0.5); - nevsigrsg = fs->make( - "nevsigrsg", "nevsigrsg", netamx * nphimx + ringmx * routmx, -0.5, netamx * nphimx + ringmx * routmx - 0.5); - - mncrossg = fs->make( - "mncrossg", "mncrossg", netamx * nphimx + ringmx * routmx, -0.5, netamx * nphimx + ringmx * routmx - 0.5); - rmscrossg = fs->make( - "rmscrossg", "rmscrossg", netamx * nphimx + ringmx * routmx, -0.5, netamx * nphimx + ringmx * routmx - 0.5); - nevcrossg = fs->make( - "nevcrossg", "nevcrossg", netamx * nphimx + ringmx * routmx, -0.5, netamx * nphimx + ringmx * routmx - 0.5); - - for (int ij = 0; ij < neffip; ij++) { - if (ij == 0) { - sprintf(title, "Total projected muon in tower"); - sprintf(name, "total_evt"); - } else { - sprintf(title, "Efficiency with sig >%i #sigma", ij); - sprintf(name, "Effi_with_gt%i_sig", ij); + for (int kl = 0; kl < ncut; kl++) { + for (int ij = 0; ij < ringmx * 3; ij++) { + int iring = ij % ringmx - 2; + int iset = ij / ringmx; + sprintf(name, "sigring_%i_%i", kl, ij); + sprintf(title, "Signal %s %s Ring%i", varnam[kl], varcrit[iset], iring); + sigvsevt[ij][kl] = fs->make(name, title, nbinxx[kl], alowxx[kl], ahghxx[kl], m_bins, m_low, m_ahigh); } - sig_effi[ij] = - fs->make(name, title, netamx + 1, -netamx / 2 - 0.5, netamx / 2 + 0.5, nphimx, 0.5, nphimx + 0.5); } - sprintf(title, "Mean Energy of all towers"); - sprintf(name, "mean_energy"); - mean_energy = fs->make(name, title, netamx + 1, -netamx / 2 - 0.5, netamx / 2 + 0.5, nphimx, 0.5, nphimx + 0.5); - - if (m_correl) { // CORREL - mncorrsglb = fs->make("mncorrsglb", "mncorrsglb", netamx * nphimx + 60, -0.5, netamx * nphimx + 59.5); - rmscorrsglb = fs->make("rmscorrsglb", "rmscorrsglb", netamx * nphimx + 60, -0.5, netamx * nphimx + 59.5); - nevcorrsglb = fs->make("nevcorrsglb", "nevcorrsglb", netamx * nphimx + 60, -0.5, netamx * nphimx + 59.5); - - mncorrsgrb = fs->make("mncorrsgrb", "mncorrsgrb", netamx * nphimx + 60, -0.5, netamx * nphimx + 59.5); - rmscorrsgrb = fs->make("rmscorrsgrb", "rmscorrsgrb", netamx * nphimx + 60, -0.5, netamx * nphimx + 59.5); - nevcorrsgrb = fs->make("nevcorrsgrb", "nevcorrsgrb", netamx * nphimx + 60, -0.5, netamx * nphimx + 59.5); - - mncorrsglu = fs->make("mncorrsglu", "mncorrsglu", netamx * nphimx + 60, -0.5, netamx * nphimx + 59.5); - rmscorrsglu = fs->make("rmscorrsglu", "rmscorrsglu", netamx * nphimx + 60, -0.5, netamx * nphimx + 59.5); - nevcorrsglu = fs->make("nevcorrsglu", "nevcorrsglu", netamx * nphimx + 60, -0.5, netamx * nphimx + 59.5); - - mncorrsgru = fs->make("mncorrsgru", "mncorrsgru", netamx * nphimx + 60, -0.5, netamx * nphimx + 59.5); - rmscorrsgru = fs->make("rmscorrsgru", "rmscorrsgru", netamx * nphimx + 60, -0.5, netamx * nphimx + 59.5); - nevcorrsgru = fs->make("nevcorrsgru", "nevcorrsgru", netamx * nphimx + 60, -0.5, netamx * nphimx + 59.5); - - mncorrsgall = fs->make("mncorrsgall", "mncorrsgall", netamx * nphimx + 60, -0.5, netamx * nphimx + 59.5); - rmscorrsgall = fs->make("rmscorrsgall", "rmscorrsgall", netamx * nphimx + 60, -0.5, netamx * nphimx + 59.5); - nevcorrsgall = fs->make("nevcorrsgall", "nevcorrsgall", netamx * nphimx + 60, -0.5, netamx * nphimx + 59.5); - - mncorrsgl = fs->make("mncorrsgl", "mncorrsgl", netamx * nphimx + 60, -0.5, netamx * nphimx + 59.5); - rmscorrsgl = fs->make("rmscorrsgl", "rmscorrsgl", netamx * nphimx + 60, -0.5, netamx * nphimx + 59.5); - nevcorrsgl = fs->make("nevcorrsgl", "nevcorrsgl", netamx * nphimx + 60, -0.5, netamx * nphimx + 59.5); - - mncorrsgr = fs->make("mncorrsgr", "mncorrsgr", netamx * nphimx + 60, -0.5, netamx * nphimx + 59.5); - rmscorrsgr = fs->make("rmscorrsgr", "rmscorrsgr", netamx * nphimx + 60, -0.5, netamx * nphimx + 59.5); - nevcorrsgr = fs->make("nevcorrsgr", "nevcorrsgr", netamx * nphimx + 60, -0.5, netamx * nphimx + 59.5); - } //m_correl - - if (m_checkmap) { // CHECKMAP - mncorrsgc = fs->make("mncorrsgc", "mncorrsgc", netamx * nphimx + 60, -0.5, netamx * nphimx + 59.5); - rmscorrsgc = fs->make("rmscorrsgc", "rmscorrsgc", netamx * nphimx + 60, -0.5, netamx * nphimx + 59.5); - nevcorrsgc = fs->make("nevcorrsgc", "nevcorrsgc", netamx * nphimx + 60, -0.5, netamx * nphimx + 59.5); - } //m_checkmap - - if (m_combined) { // COMBINED - for (int jk = 0; jk < ringmx; jk++) { - for (int ij = 0; ij < routmx + 1; ij++) { - if (jk != 2 && ij > rout12mx) - continue; - int phmn = 3 * ij - 1; - int phmx = 3 * ij + 1; - if (jk == 2) { - phmn = 2 * ij - 1; - phmx = 2 * ij; - } - if (phmn <= 0) - phmn = nphimx + phmn; - if (phmx <= 0) - phmx = nphimx + phmx; - - if ((jk == 2 && ij == routmx) || (jk != 2 && ij == rout12mx)) { - sprintf(title, "sig_ring%i_allrm", jk - 2); - sprintf(name, "sig_ring%i_allrm", jk - 2); - } else { - sprintf(title, "sig_ring%i_phi%i-%i", jk - 2, phmn, phmx); - sprintf(name, "sig_ring%i_rout%i", jk - 2, ij + 1); - } - com_sigrsg[jk][ij] = fs->make(name, title, nbin, alow, ahigh); - if ((jk == 2 && ij == routmx) || (jk != 2 && ij == rout12mx)) { - sprintf(title, "ped_ring%i_allrm", jk - 2); - sprintf(name, "ped_ring%i_allrm", jk - 2); - } else { - sprintf(title, "ped_ring%i_phi%i-%i", jk - 2, phmn, phmx); - sprintf(name, "ped_ring%i_rout%i", jk - 2, ij + 1); - } - com_crossg[jk][ij] = fs->make(name, title, nbin, alow, ahigh); - } - - for (int ij = 0; ij < sectmx; ij++) { - if (m_hotime) { // HOTIME - sprintf(title, "com_hotime_ring%i_sect%i", jk - 2, ij + 1); - com_hotime[jk][ij] = fs->make(title, title, 10, -0.5, 9.5, -1.0, 30.0); - - sprintf(title, "com_hopedtime_ring%i_sect%i", jk - 2, ij + 1); - com_hopedtime[jk][ij] = fs->make(title, title, 10, -0.5, 9.5, -1.0, 30.0); - } //m_hotime - if (m_hbtime) { // HBTIME - sprintf(title, "_com_hbtime_ring%i_serrct%i", jk - 2, ij + 1); - com_hbtime[jk][ij] = fs->make(title, title, 10, -0.5, 9.5, -1.0, 30.0); - } //m_hbtime - - if (m_correl) { // CORREL - sprintf(title, "com_corrsg_ring%i_sect%i_leftbottom", jk - 2, ij + 1); - com_corrsglb[jk][ij] = fs->make(title, title, nbin, alow, ahigh); - - sprintf(title, "com_corrsg_ring%i_sect%i_rightbottom", jk - 2, ij + 1); - com_corrsgrb[jk][ij] = fs->make(title, title, nbin, alow, ahigh); - - sprintf(title, "com_corrsg_ring%i_sect%i_leftup", jk - 2, ij + 1); - com_corrsglu[jk][ij] = fs->make(title, title, nbin, alow, ahigh); - - sprintf(title, "com_corrsg_ring%i_sect%i_rightup", jk - 2, ij + 1); - com_corrsgru[jk][ij] = fs->make(title, title, nbin, alow, ahigh); - - sprintf(title, "com_corrsg_ring%i_sect%i_all", jk - 2, ij + 1); - com_corrsgall[jk][ij] = fs->make(title, title, nbin, alow, ahigh); - - sprintf(title, "com_corrsg_ring%i_sect%i_left", jk - 2, ij + 1); - com_corrsgl[jk][ij] = fs->make(title, title, nbin, alow, ahigh); - - sprintf(title, "com_corrsg_ring%i_sect%i_right", jk - 2, ij + 1); - com_corrsgr[jk][ij] = fs->make(title, title, nbin, alow, ahigh); - } //m_correl - - if (m_checkmap) { // CHECKMAP - sprintf(title, "com_corrsg_ring%i_sect%i_centrl", jk - 2, ij + 1); - com_corrsgc[jk][ij] = fs->make(title, title, nbin, alow, ahigh); - } //m_checkmap - } - } - } //m_combined - - for (int ij = -1; ij <= 1; ij++) { - for (int jk = -1; jk <= 1; jk++) { - int kl = 3 * (ij + 1) + jk + 1; - - sprintf(title, "hosct2p_eta%i_phi%i", ij, jk); - ho_sig2p[kl] = fs->make(title, title, nbin, alow, ahigh); - - sprintf(title, "hosct1p_eta%i_phi%i", ij, jk); - ho_sig1p[kl] = fs->make(title, title, nbin, alow, ahigh); - - sprintf(title, "hosct00_eta%i_phi%i", ij, jk); - ho_sig00[kl] = fs->make(title, title, nbin, alow, ahigh); - - sprintf(title, "hosct1m_eta%i_phi%i", ij, jk); - ho_sig1m[kl] = fs->make(title, title, nbin, alow, ahigh); - - sprintf(title, "hosct2m_eta%i_phi%i", ij, jk); - ho_sig2m[kl] = fs->make(title, title, nbin, alow, ahigh); - - if (m_hbinfo) { // HBINFO - sprintf(title, "hbhesig_eta%i_phi%i", ij, jk); - hbhe_sig[kl] = fs->make(title, title, 51, -10.5, 40.5); - } //m_hbinfo + for (int kl = 0; kl < ncut; kl++) { + for (int ij = 0; ij < ringmx * 3; ij++) { + int iring = ij % ringmx - 2; + int iset = ij / ringmx; + sprintf(name, "varring_%i_%i", kl, ij); + sprintf(title, "%s %s Ring%i", varnam[kl], varcrit[iset], iring); + variab[ij][kl] = fs->make(name, title, nbinxx[kl], alowxx[kl], ahghxx[kl]); } } - if (m_constant) { - ped_evt = fs->make("ped_evt", "ped_evt", netamx * nphimx, -0.5, netamx * nphimx - 0.5); - ped_mean = fs->make("ped_mean", "ped_mean", netamx * nphimx, -0.5, netamx * nphimx - 0.5); - ped_width = fs->make("ped_width", "ped_width", netamx * nphimx, -0.5, netamx * nphimx - 0.5); - - fit_chi = fs->make("fit_chi", "fit_chi", netamx * nphimx, -0.5, netamx * nphimx - 0.5); - sig_evt = fs->make("sig_evt", "sig_evt", netamx * nphimx, -0.5, netamx * nphimx - 0.5); - fit_sigevt = fs->make("fit_sigevt", "fit_sigevt", netamx * nphimx, -0.5, netamx * nphimx - 0.5); - fit_bkgevt = fs->make("fit_bkgevt", "fit_bkgevt", netamx * nphimx, -0.5, netamx * nphimx - 0.5); - sig_mean = fs->make("sig_mean", "sig_mean", netamx * nphimx, -0.5, netamx * nphimx - 0.5); - sig_diff = fs->make("sig_diff", "sig_diff", netamx * nphimx, -0.5, netamx * nphimx - 0.5); - sig_width = fs->make("sig_width", "sig_width", netamx * nphimx, -0.5, netamx * nphimx - 0.5); - sig_sigma = fs->make("sig_sigma", "sig_sigma", netamx * nphimx, -0.5, netamx * nphimx - 0.5); - sig_meanerr = fs->make("sig_meanerr", "sig_meanerr", netamx * nphimx, -0.5, netamx * nphimx - 0.5); - sig_meanerrp = fs->make("sig_meanerrp", "sig_meanerrp", netamx * nphimx, -0.5, netamx * nphimx - 0.5); - sig_signf = fs->make("sig_signf", "sig_signf", netamx * nphimx, -0.5, netamx * nphimx - 0.5); - - ped_statmean = fs->make("ped_statmean", "ped_statmean", netamx * nphimx, -0.5, netamx * nphimx - 0.5); - sig_statmean = fs->make("sig_statmean", "sig_statmean", netamx * nphimx, -0.5, netamx * nphimx - 0.5); - ped_rms = fs->make("ped_rms", "ped_rms", netamx * nphimx, -0.5, netamx * nphimx - 0.5); - sig_rms = fs->make("sig_rms", "sig_rms", netamx * nphimx, -0.5, netamx * nphimx - 0.5); - - const_eta_phi = fs->make( - "const_eta_phi", "const_eta_phi", netamx + 1, -(netamx + 1) / 2., (netamx + 1) / 2., nphimx, 0.5, nphimx + 0.5); - - for (int ij = 0; ij < netamx; ij++) { - int ieta = (ij < 15) ? ij + 1 : 14 - ij; - sprintf(title, "Cont_Eta_%i", ieta); - const_eta[ij] = fs->make(title, title, nphimx, 0.5, nphimx + 0.5); - - sprintf(title, "Peak_Eta_%i", ieta); - peak_eta[ij] = fs->make(title, title, nphimx, 0.5, nphimx + 0.5); - } - - for (int ij = 0; ij < ringmx; ij++) { - int iring = ij - 2; - int iread = (ij == 2) ? routmx : rout12mx; - sprintf(title, "Cont_hpdrm_%i", iring); - const_hpdrm[ij] = fs->make(title, title, iread, 0.5, iread + 0.5); - - sprintf(title, "Peak_hpdrm_%i", iring); - peak_hpdrm[ij] = fs->make(title, title, iread, 0.5, iread + 0.5); + for (int ij = 0; ij <= ncut; ij++) { + sprintf(name, "mu_projection_%i", ij); + if (ij == 0) { + sprintf(title, "All projected muon"); + } else { + sprintf(title, "Projected muon with selection %s", varnam[ij - 1]); } - - mean_phi_hst = fs->make("mean_phi_hst", "mean_phi_hst", netamx + 1, -(netamx + 1) / 2., (netamx + 1) / 2.); - mean_phi_ave = fs->make("mean_phi_ave", "mean_phi_ave", netamx + 1, -(netamx + 1) / 2., (netamx + 1) / 2.); - - mean_eta_ave = fs->make("mean_eta_ave", "mean_eta_ave", nphimx, 0.5, nphimx + 0.5); - - } // m_constant - - for (int ij = 0; ij < netamx; ij++) { - int ieta = (ij < 15) ? ij + 1 : 14 - ij; - - sprintf(title, "Stat_Eta_%i", ieta); - stat_eta[ij] = fs->make(title, title, nphimx, 0.5, nphimx + 0.5); - - sprintf(title, "#mu(stat)_Eta_%i", ieta); - statmn_eta[ij] = fs->make(title, title, nphimx, 0.5, nphimx + 0.5); + mu_projection[ij] = + fs->make(name, title, netamx + 1, -netamx / 2 - 0.5, netamx / 2 + 0.5, nphimx, 0.5, nphimx + 0.5); } - for (int jk = 0; jk < netamx; jk++) { - for (int ij = 0; ij < nphimx; ij++) { - invang[jk][ij] = 0.0; - } + for (int ij = 0; ij < 31; ij++) { + mypow_2[ij] = pow(2, ij); } - for (int jk = 0; jk < ringmx; jk++) { - for (int ij = 0; ij < routmx + 1; ij++) { - com_invang[jk][ij] = 0.0; + for (int ij = 0; ij < ringmx; ij++) { + for (int jk = 0; jk < ncut + 10; jk++) { + ncount[ij][jk] = 0.0; } } } @@ -914,10 +320,9 @@ HOCalibAnalyzer::~HOCalibAnalyzer() { // do anything here that needs to be done at desctruction time // (e.g. close files, deallocate resources etc.) - theFile->cd(); - theFile->Write(); - theFile->Close(); - edm::LogVerbatim("HOCalib") << " Ttoal events = " << Nevents << " Selected events # is " << ipass; + edm::LogVerbatim("HOCalib") << " Total events = " << setw(7) << nevents[0] << " " << setw(7) << nevents[1] << " " + << setw(7) << nevents[2] << " " << setw(7) << nevents[3] << " " << setw(7) << nevents[4] + << " " << setw(7) << nevents[5] << " Selected events # is " << ipass; } // @@ -926,66 +331,31 @@ HOCalibAnalyzer::~HOCalibAnalyzer() { // ------------ method called to for each event ------------ void HOCalibAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { - // calcualte these once (and avoid the pow(int,int) ambiguities for c++) - int mypow_2_0 = 1; // 2^0 - int mypow_2_1 = 2; // 2^1 - int mypow_2_2 = 4; // 2^2 - - int mypow_2_3 = 8; // 2^3 - int mypow_2_4 = 16; // 2^4 - int mypow_2_5 = 32; // 2^5 - int mypow_2_6 = 64; // 2^6 - int mypow_2_7 = 128; // 2^7 - int mypow_2_8 = 256; // 2^8 - int mypow_2_9 = 512; // 2^9 - int mypow_2_10 = 1024; // 2^10 - int mypow_2_11 = 2048; // 2^11 - int mypow_2_12 = 4096; // 2^12 - - int iaxxx = 0; - int ibxxx = 0; - - Nevents++; + nevents[0]++; + + using namespace edm; float pival = acos(-1.); - irunold = irun = iEvent.id().run(); + ievt = iEvent.id().event(); ilumi = iEvent.luminosityBlock(); - if (m_allHOsignal) { - edm::Handle hoht; - iEvent.getByToken(tok_allho_, hoht); - if (hoht.isValid() && !(*hoht).empty()) { - ho_entry->Fill(-1., -1.); //Count of total number of entries - for (HORecHitCollection::const_iterator ij = (*hoht).begin(); ij != (*hoht).end(); ij++) { - HcalDetId id = (*ij).id(); - int tmpeta = id.ieta(); - int tmpphi = id.iphi(); - float signal = (*ij).energy(); - ho_entry->Fill(tmpeta, tmpphi); - ho_energy->Fill(tmpeta, tmpphi, signal); - ho_energy2->Fill(tmpeta, tmpphi, signal * signal); - - int inveta = invert_HOieta(tmpeta); - ho_indenergy[inveta][tmpphi - 1]->Fill(signal); - } - } - } - edm::Handle HOCalib; - bool isCosMu = true; - try { - iEvent.getByToken(tok_ho_, HOCalib); - } catch (cms::Exception& iEvent) { - isCosMu = false; + iEvent.getByToken(tok_ho_, HOCalib); + + if (nevents[0] % 20000 == 1) { + edm::LogVerbatim("HOCalib") << "nmuon event # " << setw(7) << nevents[0] << " " << setw(7) << nevents[1] << " " + << setw(7) << nevents[2] << " " << setw(7) << nevents[3] << " " << setw(7) << nevents[4] + << " " << setw(7) << nevents[5]; + edm::LogVerbatim("HOCalib") << " Run # " << iEvent.id().run() << " Evt # " << iEvent.id().event() << " " + << int(HOCalib.isValid()) << " " << ipass; } - if (Nevents % 5000 == 1) - edm::LogVerbatim("HOCalib") << "nmuon event # " << Nevents << " Run # " << iEvent.id().run() << " Evt # " - << iEvent.id().event() << " " << ipass; - if (isCosMu && !(*HOCalib).empty()) { + if (HOCalib.isValid()) { + nevents[1]++; nmuon = (*HOCalib).size(); + for (HOCalibVariableCollection::const_iterator hoC = (*HOCalib).begin(); hoC != (*HOCalib).end(); hoC++) { trkdr = (*hoC).trkdr; trkdz = (*hoC).trkdz; @@ -1019,27 +389,28 @@ void HOCalibAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& i hodx = (*hoC).hodx; hody = (*hoC).hody; hoang = (*hoC).hoang; + + tmphoang = sin(trkth) - hoang; + htime = (*hoC).htime; hoflag = (*hoC).hoflag; for (int ij = 0; ij < 9; ij++) { hosig[ij] = (*hoC).hosig[ij]; +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("HOCalib") << "hosig " << ij << " " << hosig[ij]; +#endif } for (int ij = 0; ij < 18; ij++) { hocorsig[ij] = (*hoC).hocorsig[ij]; +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("HOCalib") << "hocorsig " << ij << " " << hocorsig[ij]; +#endif } hocro = (*hoC).hocro; for (int ij = 0; ij < 3; ij++) { caloen[ij] = (*hoC).caloen[ij]; } - if (m_hbinfo) { - for (int ij = 0; ij < 9; ij++) { - hbhesig[ij] = (*hoC).hbhesig[ij]; - } - } - - T1->Fill(); - int ipsall = 0; int ips0 = 0; int ips1 = 0; @@ -1054,15 +425,23 @@ void HOCalibAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& i int ips10 = 0; int ips11 = 0; int ips12 = 0; + int ips13 = 0; + + nevents[2]++; + bool isZSps = (hosig[4] < -99.0) ? false : true; - if (isect < 0) - continue; //FIXGM Is it proper place ? + if ((!m_cosmic) && fabs(trkmm) < momatho) + continue; + + nevents[3]++; if (fabs(trkth - pival / 2) < 0.000001) continue; //22OCT07 + nevents[4]++; int ieta = int((abs(isect) % 10000) / 100.) - 50; //an offset to acodate -ve eta values if (abs(ieta) >= 16) continue; + nevents[5]++; int iphi = abs(isect) % 100; int tmpsect = int((iphi + 1) / 6.) + 1; @@ -1070,227 +449,475 @@ void HOCalibAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& i tmpsect = 1; int iring = 0; - int tmpeta = ieta + 4; //For pixel mapping - if (ieta >= -15 && ieta <= -11) { - iring = -2; - tmpeta = -11 - ieta; - } //abs(ieta)-11;} - if (ieta >= -10 && ieta <= -5) { - iring = -1; - tmpeta = -5 - ieta; - } // abs(ieta)-5;} - if (ieta >= 5 && ieta <= 10) { - iring = 1; - tmpeta = ieta - 5; - } - if (ieta >= 11 && ieta <= 15) { - iring = 2; - tmpeta = ieta - 11; - } int iring2 = iring + 2; - int tmprout = (iring == 0) ? int((iphi + 1) / 2.) + 1 : int((iphi + 1) / 3.) + 1; - int tmproutmx = (iring == 0) ? routmx : rout12mx; - if (tmprout > tmproutmx) - tmprout = 1; + double abshoang = (m_cosmic) ? fabs(hoang) : hoang; + + double elos = 1.0 / TMath::Max(0.1, abs(1.0 * hoang)); + + if (!m_zeroField) + elos *= ((14.9 + 0.96 * fabs(log(momatho * 2.8)) + 0.033 * momatho * (1.0 - pow(momatho, -0.33))) / elosfact); - // CRUZET1 if (m_cosmic) { - /* GMA temoparily change to increase event size at 3 & 9 O'clock position */ - if (abs(ndof) >= 20 && abs(ndof) < 40) { - ips0 = (int)mypow_2_0; + if (abs(ndof) >= 20 && abs(ndof) < 55) { + ips0 = mypow_2[0]; ipsall += ips0; } - if (chisq > 0 && chisq < 15) { - ips1 = (int)mypow_2_1; + if (chisq > 0 && chisq < 12) { + ips1 = mypow_2[1]; ipsall += ips1; } //18Jan2008 - if (fabs(trkth - pival / 2) < 21.5) { - ips2 = (int)mypow_2_2; + + if (trkth > 0.3 && trkth < pival - 0.3) { + ips2 = mypow_2[2]; ipsall += ips2; } //No nead for pp evt - if (fabs(trkph + pival / 2) < 21.5) { - ips3 = (int)mypow_2_3; + if (trkph > -pival + 0.1 && trkph < -0.1) { + ips3 = mypow_2[3]; ipsall += ips3; } //No nead for pp evt if (therr < 0.02) { - ips4 = (int)mypow_2_4; + ips4 = mypow_2[4]; ipsall += ips4; } if (pherr < 0.0002) { - ips5 = (int)mypow_2_5; + ips5 = mypow_2[5]; ipsall += ips5; } - if (fabs(hoang) > 0.30) { - ips6 = (int)mypow_2_6; + if (abshoang > 0.60 && abshoang < 1.0) { + ips6 = mypow_2[6]; ipsall += ips6; } - if (fabs(trkmm) > 0.100) { - ips7 = (int)mypow_2_7; + + if (m_zeroField || (fabs(momatho) > 5.0 && fabs(momatho) < 2000.0)) { + ips7 = mypow_2[7]; ipsall += ips7; } - if (nmuon >= 1 && nmuon <= 4) { - ips8 = (int)mypow_2_8; + + if (nmuon >= 1 && nmuon <= 3) { + ips8 = mypow_2[8]; ipsall += ips8; } + // if (hodx>0 && hody>0) { } + ips9 = mypow_2[9]; + ipsall += ips9; + + ips10 = mypow_2[10]; + ipsall += ips10; + if (iring2 == 2) { if (fabs(hodx) < 100 && fabs(hodx) > 2 && fabs(hocorsig[8]) < 40 && fabs(hocorsig[8]) > 2) { - ips10 = (int)mypow_2_10; - ipsall += ips10; + ips11 = mypow_2[11]; + ipsall += ips11; } if (fabs(hody) < 100 && fabs(hody) > 2 && fabs(hocorsig[9]) < 40 && fabs(hocorsig[9]) > 2) { - ips11 = (int)mypow_2_11; - ipsall += ips11; + ips12 = mypow_2[12]; + ipsall += ips12; } } else { if (fabs(hodx) < 100 && fabs(hodx) > 2) { - ips10 = (int)mypow_2_10; - ipsall += ips10; + ips11 = mypow_2[11]; + ipsall += ips11; } if (fabs(hody) < 100 && fabs(hody) > 2) { - ips11 = (int)mypow_2_11; - ipsall += ips11; + ips12 = mypow_2[12]; + ipsall += ips12; } } - if (caloen[0] == 0) { - ips12 = (int)mypow_2_12; - ipsall += ips12; + + if (m_zeroField) { + if (iring2 == 0) { + if (htime > -60 && htime < 60) { + ips13 = mypow_2[13]; + ipsall += ips13; + } + } + if (iring2 == 1) { + if (htime > -60 && htime < 60) { + ips13 = mypow_2[13]; + ipsall += ips13; + } + } + if (iring2 == 2) { + if (htime > -60 && htime < 60) { + ips13 = mypow_2[13]; + ipsall += ips13; + } + } + if (iring2 == 3) { + if (htime > -60 && htime < 60) { + ips13 = mypow_2[13]; + ipsall += ips13; + } + } + if (iring2 == 4) { + if (htime > -60 && htime < 60) { + ips13 = mypow_2[13]; + ipsall += ips13; + } + } + } else { + if (htime > -100 && htime < 100) { + ips13 = mypow_2[13]; + ipsall += ips13; + } } } else { - //csa08 - if (abs(ndof) >= 20 && abs(ndof) < 40) { - ips0 = (int)mypow_2_0; + if (abs(ndof) >= 10 && abs(ndof) < 25) { + ips0 = mypow_2[0]; ipsall += ips0; } - if (chisq > 0 && chisq < 15) { - ips1 = (int)mypow_2_1; + if (chisq > 0 && chisq < 10) { + ips1 = mypow_2[1]; ipsall += ips1; } //18Jan2008 + if (fabs(trkth - pival / 2) < 21.5) { - ips2 = (int)mypow_2_2; + ips2 = mypow_2[2]; ipsall += ips2; } //No nead for pp evt if (fabs(trkph + pival / 2) < 21.5) { - ips3 = (int)mypow_2_3; + ips3 = mypow_2[3]; ipsall += ips3; } //No nead for pp evt - if (therr < 0.02) { - ips4 = (int)mypow_2_4; + if (therr < 0.00002) { + ips4 = mypow_2[4]; ipsall += ips4; } - if (pherr < 0.0002) { - ips5 = (int)mypow_2_5; + if (pherr < 0.000002) { + ips5 = mypow_2[5]; ipsall += ips5; } - if (fabs(hoang) > 0.30) { - ips6 = (int)mypow_2_6; + // if (abshoang >0.40 && abshoang <1.0) {ips6 = mypow_2[6]; ipsall +=ips6;} + if (tmphoang < 0.065) { + ips6 = mypow_2[6]; ipsall += ips6; } - if (fabs(trkmm) > 4.0) { - ips7 = (int)mypow_2_7; - ipsall += ips7; + + if (fabs(momatho) < 250.0 && fabs(momatho) > 15.0) { + if (iring2 == 2) { + ips7 = mypow_2[7]; + ipsall += ips7; + } + if ((iring2 == 1 || iring2 == 3) && fabs(momatho) > 17.0) { + ips7 = mypow_2[7]; + ipsall += ips7; + } + if ((iring2 == 0 || iring2 == 4) && fabs(momatho) > 20.0) { + ips7 = mypow_2[7]; + ipsall += ips7; + } } - if (nmuon >= 1 && nmuon <= 2) { - ips8 = (int)mypow_2_8; + + if (nmuon >= 1 && nmuon <= 3) { + ips8 = mypow_2[8]; ipsall += ips8; } + if (ndof > 0 && caloen[0] < 15.0) { + ips9 = mypow_2[9]; + ipsall += ips9; + } //5.0 + if (tkpt03 < 5.0) { + ips10 = mypow_2[10]; + ipsall += ips10; + } //4.0 + if (iring2 == 2) { if (fabs(hodx) < 100 && fabs(hodx) > 2 && fabs(hocorsig[8]) < 40 && fabs(hocorsig[8]) > 2) { - ips10 = (int)mypow_2_10; - ipsall += ips10; + ips11 = mypow_2[11]; + ipsall += ips11; } if (fabs(hody) < 100 && fabs(hody) > 2 && fabs(hocorsig[9]) < 40 && fabs(hocorsig[9]) > 2) { - ips11 = (int)mypow_2_11; - ipsall += ips11; + ips12 = mypow_2[12]; + ipsall += ips12; } } else { if (fabs(hodx) < 100 && fabs(hodx) > 2) { - ips10 = (int)mypow_2_10; - ipsall += ips10; + ips11 = mypow_2[11]; + ipsall += ips11; } if (fabs(hody) < 100 && fabs(hody) > 2) { - ips11 = (int)mypow_2_11; - ipsall += ips11; + ips12 = mypow_2[12]; + ipsall += ips12; + } + } + + if (iring2 == 0) { + if (htime > -20 && htime < 20) { + ips13 = mypow_2[13]; + ipsall += ips13; } } - if (ndof > 0 && caloen[0] < 5.0) { - ips12 = (int)mypow_2_12; - ipsall += ips12; + if (iring2 == 1) { + if (htime > -20 && htime < 20) { + ips13 = mypow_2[13]; + ipsall += ips13; + } + } + if (iring2 == 2) { + if (htime > -30 && htime < 20) { + ips13 = mypow_2[13]; + ipsall += ips13; + } + } + if (iring2 == 3) { + if (htime > -20 && htime < 20) { + ips13 = mypow_2[13]; + ipsall += ips13; + } + } + if (iring2 == 4) { + if (htime > -20 && htime < 20) { + ips13 = mypow_2[13]; + ipsall += ips13; + } } - /* */ } + int tmpxet = invert_HOieta(ieta); + double nomHOSig = hosig[4] / elos; - if (htime > -40 && htime < 60) { - ips9 = (int)mypow_2_9; - ipsall += ips9; + if (ipsall - ips0 == mypow_2[ncut] - mypow_2[0] - 1) { + if (isZSps) { + sigvsevt[iring2][0]->Fill(abs(ndof), nomHOSig); + sig_eta_evt[tmpxet][0]->Fill(abs(ndof), nomHOSig); + } + variab[iring2][0]->Fill(abs(ndof)); + } + if (ipsall - ips1 == mypow_2[ncut] - mypow_2[1] - 1) { + if (isZSps) { + sigvsevt[iring2][1]->Fill(chisq, nomHOSig); + sig_eta_evt[tmpxet][1]->Fill(chisq, nomHOSig); + } + variab[iring2][1]->Fill(chisq); + } + if (ipsall - ips2 == mypow_2[ncut] - mypow_2[2] - 1) { + if (isZSps) { + sigvsevt[iring2][2]->Fill(trkth, nomHOSig); + sig_eta_evt[tmpxet][2]->Fill(trkth, nomHOSig); + } + variab[iring2][2]->Fill(trkth); + } + if (ipsall - ips3 == mypow_2[ncut] - mypow_2[3] - 1) { + if (isZSps) { + sigvsevt[iring2][3]->Fill(trkph, nomHOSig); + sig_eta_evt[tmpxet][3]->Fill(trkph, nomHOSig); + } + variab[iring2][3]->Fill(trkph); + } + if (ipsall - ips4 == mypow_2[ncut] - mypow_2[4] - 1) { + if (isZSps) { + sigvsevt[iring2][4]->Fill(1000 * therr, nomHOSig); + sig_eta_evt[tmpxet][4]->Fill(1000 * therr, nomHOSig); + } + variab[iring2][4]->Fill(1000 * therr); + } + if (ipsall - ips5 == mypow_2[ncut] - mypow_2[5] - 1) { + if (isZSps) { + sigvsevt[iring2][5]->Fill(1000 * pherr, nomHOSig); + sig_eta_evt[tmpxet][5]->Fill(1000 * pherr, nomHOSig); + } + variab[iring2][5]->Fill(1000 * pherr); + } + if (ipsall - ips6 == mypow_2[ncut] - mypow_2[6] - 1) { + if (isZSps) { + sigvsevt[iring2][6]->Fill(tmphoang, (nomHOSig)*abshoang); + sig_eta_evt[tmpxet][6]->Fill(tmphoang, (nomHOSig)*abshoang); + } + variab[iring2][6]->Fill(tmphoang); + } + if (ipsall - ips7 == mypow_2[ncut] - mypow_2[7] - 1) { + if (isZSps) { + sigvsevt[iring2][7]->Fill(fabs(trkmm), nomHOSig); + sig_eta_evt[tmpxet][7]->Fill(fabs(trkmm), nomHOSig); + } + variab[iring2][7]->Fill(fabs(trkmm)); + } + if (ipsall - ips8 == mypow_2[ncut] - mypow_2[8] - 1) { + if (isZSps) { + sigvsevt[iring2][8]->Fill(nmuon, nomHOSig); + sig_eta_evt[tmpxet][8]->Fill(nmuon, nomHOSig); + } + variab[iring2][8]->Fill(nmuon); } - - if (ipsall - ips0 == mypow_2_ncut - mypow_2_0 - 1) - sigvsevt[iring2][0]->Fill(abs(ndof), hosig[4]); - if (ipsall - ips1 == mypow_2_ncut - mypow_2_1 - 1) - sigvsevt[iring2][1]->Fill(chisq, hosig[4]); - if (ipsall - ips2 == mypow_2_ncut - mypow_2_2 - 1) - sigvsevt[iring2][2]->Fill(trkth, hosig[4]); - if (ipsall - ips3 == mypow_2_ncut - mypow_2_3 - 1) - sigvsevt[iring2][3]->Fill(trkph, hosig[4]); - if (ipsall - ips4 == mypow_2_ncut - mypow_2_4 - 1) - sigvsevt[iring2][4]->Fill(therr, hosig[4]); - if (ipsall - ips5 == mypow_2_ncut - mypow_2_5 - 1) - sigvsevt[iring2][5]->Fill(pherr, hosig[4]); - if (ipsall - ips6 == mypow_2_ncut - mypow_2_6 - 1) - sigvsevt[iring2][6]->Fill(hoang, hosig[4]); - if (ipsall - ips7 == mypow_2_ncut - mypow_2_7 - 1) - sigvsevt[iring2][7]->Fill(fabs(trkmm), hosig[4]); - if (ipsall - ips8 == mypow_2_ncut - mypow_2_8 - 1) - sigvsevt[iring2][8]->Fill(nmuon, hosig[4]); - if (ipsall - ips9 == mypow_2_ncut - mypow_2_9 - 1) - sigvsevt[iring2][9]->Fill(htime, hosig[4]); - if (ipsall - ips10 == mypow_2_ncut - mypow_2_10 - 1) - sigvsevt[iring2][10]->Fill(hodx, hosig[4]); - if (ipsall - ips11 == mypow_2_ncut - mypow_2_11 - 1) - sigvsevt[iring2][11]->Fill(hody, hosig[4]); if (!m_cosmic) { - if (ipsall - ips12 == mypow_2_ncut - mypow_2_12 - 1) - sigvsevt[iring2][12]->Fill(caloen[0], hosig[4]); + if (ipsall - ips9 == mypow_2[ncut] - mypow_2[9] - 1) { + if (isZSps) { + sigvsevt[iring2][9]->Fill(caloen[0], nomHOSig); + sig_eta_evt[tmpxet][9]->Fill(caloen[0], nomHOSig); + } + variab[iring2][9]->Fill(caloen[0]); + } + } + if (ipsall - ips10 == mypow_2[ncut] - mypow_2[10] - 1) { + if (isZSps) { + sigvsevt[iring2][10]->Fill(tkpt03, nomHOSig); + sig_eta_evt[tmpxet][10]->Fill(tkpt03, nomHOSig); + } + variab[iring2][10]->Fill(tkpt03); + } + if (ipsall - ips11 == mypow_2[ncut] - mypow_2[11] - 1) { + if (isZSps) { + sigvsevt[iring2][11]->Fill(hodx, nomHOSig); + sig_eta_evt[tmpxet][11]->Fill(hodx, nomHOSig); + } + variab[iring2][11]->Fill(hodx); + } + if (ipsall - ips12 == mypow_2[ncut] - mypow_2[12] - 1) { + if (isZSps) { + sigvsevt[iring2][12]->Fill(hody, nomHOSig); + sig_eta_evt[tmpxet][12]->Fill(hody, nomHOSig); + } + variab[iring2][12]->Fill(hody); + } + + if (ipsall - ips13 == mypow_2[ncut] - mypow_2[13] - 1) { + if (isZSps) { + sigvsevt[iring2][13]->Fill(htime, nomHOSig); + sig_eta_evt[tmpxet][13]->Fill(htime, nomHOSig); + } + variab[iring2][13]->Fill(htime); } - sigvsevt[iring2 + 5][0]->Fill(abs(ndof), hosig[4]); + if (isZSps) { + sigvsevt[iring2 + ringmx][0]->Fill(abs(ndof), nomHOSig); + sig_eta_evt[netamx + tmpxet][0]->Fill(abs(ndof), nomHOSig); + } + variab[iring2 + 5][0]->Fill(abs(ndof)); + + ncount[iring2][0]++; + if (isZSps) { + ncount[iring2][1]++; + } if (ips0 > 0) { - sigvsevt[iring2 + 5][1]->Fill(chisq, hosig[4]); + if (isZSps) { + ncount[iring2][10]++; + sigvsevt[iring2 + ringmx][1]->Fill(chisq, nomHOSig); + sig_eta_evt[netamx + tmpxet][1]->Fill(chisq, nomHOSig); + } + variab[iring2 + ringmx][1]->Fill(chisq); + mu_projection[1]->Fill(ieta, iphi); if (ips1 > 0) { - sigvsevt[iring2 + 5][2]->Fill(trkth, hosig[4]); + if (isZSps) { + ncount[iring2][11]++; + sigvsevt[iring2 + ringmx][2]->Fill(trkth, nomHOSig); + sig_eta_evt[netamx + tmpxet][2]->Fill(trkth, nomHOSig); + } + variab[iring2 + ringmx][2]->Fill(trkth); + mu_projection[2]->Fill(ieta, iphi); if (ips2 > 0) { - sigvsevt[iring2 + 5][3]->Fill(trkph, hosig[4]); + if (isZSps) { + ncount[iring2][12]++; + sigvsevt[iring2 + ringmx][3]->Fill(trkph, nomHOSig); + sig_eta_evt[netamx + tmpxet][3]->Fill(trkph, nomHOSig); + } + variab[iring2 + ringmx][3]->Fill(trkph); + mu_projection[3]->Fill(ieta, iphi); if (ips3 > 0) { - sigvsevt[iring2 + 5][4]->Fill(therr, hosig[4]); + if (isZSps) { + ncount[iring2][13]++; + sigvsevt[iring2 + ringmx][4]->Fill(1000 * therr, nomHOSig); + sig_eta_evt[netamx + tmpxet][4]->Fill(1000 * therr, nomHOSig); + } + variab[iring2 + ringmx][4]->Fill(1000 * therr); + mu_projection[4]->Fill(ieta, iphi); if (ips4 > 0) { - sigvsevt[iring2 + 5][5]->Fill(pherr, hosig[4]); + if (isZSps) { + ncount[iring2][14]++; + sigvsevt[iring2 + ringmx][5]->Fill(1000 * pherr, nomHOSig); + sig_eta_evt[netamx + tmpxet][5]->Fill(1000 * pherr, nomHOSig); + } + variab[iring2 + ringmx][5]->Fill(1000 * pherr); + mu_projection[5]->Fill(ieta, iphi); if (ips5 > 0) { - sigvsevt[iring2 + 5][6]->Fill(hoang, hosig[4]); + if (isZSps) { + ncount[iring2][15]++; + sigvsevt[iring2 + ringmx][6]->Fill(tmphoang, (nomHOSig)*abshoang); + sig_eta_evt[netamx + tmpxet][6]->Fill(tmphoang, (nomHOSig)*abshoang); + } + variab[iring2 + ringmx][6]->Fill(tmphoang); + mu_projection[6]->Fill(ieta, iphi); if (ips6 > 0) { - sigvsevt[iring2 + 5][7]->Fill(fabs(trkmm), hosig[4]); + if (isZSps) { + ncount[iring2][16]++; + sigvsevt[iring2 + ringmx][7]->Fill(fabs(trkmm), nomHOSig); + sig_eta_evt[netamx + tmpxet][7]->Fill(fabs(trkmm), nomHOSig); + } + variab[iring2 + ringmx][7]->Fill(fabs(trkmm)); + mu_projection[7]->Fill(ieta, iphi); if (ips7 > 0) { - sigvsevt[iring2 + 5][8]->Fill(nmuon, hosig[4]); + ncount[iring2][4]++; //Efficiency of Muon detection + if (isZSps) { + ncount[iring2][17]++; + sigvsevt[iring2 + ringmx][8]->Fill(nmuon, nomHOSig); + sig_eta_evt[netamx + tmpxet][8]->Fill(nmuon, nomHOSig); + } + variab[iring2 + ringmx][8]->Fill(nmuon); + mu_projection[8]->Fill(ieta, iphi); if (ips8 > 0) { - sigvsevt[iring2 + 5][9]->Fill(htime, hosig[4]); + if (!m_cosmic) { + if (isZSps) { + ncount[iring2][18]++; + sigvsevt[iring2 + ringmx][9]->Fill(caloen[0], nomHOSig); + sig_eta_evt[netamx + tmpxet][9]->Fill(caloen[0], nomHOSig); + } + variab[iring2 + ringmx][9]->Fill(caloen[0]); + mu_projection[9]->Fill(ieta, iphi); + } if (ips9 > 0) { - sigvsevt[iring2 + 5][10]->Fill(hodx, hosig[4]); + if (isZSps) { + ncount[iring2][19]++; + sigvsevt[iring2 + ringmx][10]->Fill(tkpt03, nomHOSig); + sig_eta_evt[netamx + tmpxet][10]->Fill(tkpt03, nomHOSig); + } + variab[iring2 + ringmx][10]->Fill(tkpt03); + mu_projection[10]->Fill(ieta, iphi); if (ips10 > 0) { - sigvsevt[iring2 + 5][11]->Fill(hody, hosig[4]); + ncount[iring2][3]++; //Efficiency of Muon detection + if (isZSps) { + ncount[iring2][20]++; + sigvsevt[iring2 + ringmx][11]->Fill(hodx, nomHOSig); + sig_eta_evt[netamx + tmpxet][11]->Fill(hodx, nomHOSig); + } + variab[iring2 + ringmx][11]->Fill(hodx); + mu_projection[11]->Fill(ieta, iphi); + if (ips11 > 0) { - if (!m_cosmic) - sigvsevt[iring2 + 5][12]->Fill(caloen[0], hosig[4]); + if (isZSps) { + ncount[iring2][21]++; + sigvsevt[iring2 + ringmx][12]->Fill(hody, nomHOSig); + sig_eta_evt[netamx + tmpxet][12]->Fill(hody, nomHOSig); + } + variab[iring2 + ringmx][12]->Fill(hody); + mu_projection[12]->Fill(ieta, iphi); + + if (ips12 > 0) { + ncount[iring2][2]++; //Efficiency of Muon detection + if (isZSps) { + ncount[iring2][22]++; + sigvsevt[iring2 + ringmx][13]->Fill(htime, nomHOSig); + sig_eta_evt[tmpxet + ringmx][13]->Fill(htime, nomHOSig); + } + variab[iring2 + ringmx][13]->Fill(htime); + mu_projection[13]->Fill(ieta, iphi); + + if (ips13 > 0) { + if (isZSps) { + ncount[iring2][23]++; + mu_projection[14]->Fill(ieta, iphi); + } + } + } } } } @@ -1303,26 +930,59 @@ void HOCalibAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& i } } } - - sigvsevt[iring2 + 10][0]->Fill(abs(ndof), hosig[4]); - sigvsevt[iring2 + 10][1]->Fill(chisq, hosig[4]); - sigvsevt[iring2 + 10][2]->Fill(trkth, hosig[4]); - sigvsevt[iring2 + 10][3]->Fill(trkph, hosig[4]); - sigvsevt[iring2 + 10][4]->Fill(therr, hosig[4]); - sigvsevt[iring2 + 10][5]->Fill(pherr, hosig[4]); - sigvsevt[iring2 + 10][6]->Fill(hoang, hosig[4]); - sigvsevt[iring2 + 10][7]->Fill(fabs(trkmm), hosig[4]); - sigvsevt[iring2 + 10][8]->Fill(nmuon, hosig[4]); - sigvsevt[iring2 + 10][9]->Fill(htime, hosig[4]); - sigvsevt[iring2 + 10][10]->Fill(hodx, hosig[4]); - sigvsevt[iring2 + 10][11]->Fill(hody, hosig[4]); + if (isZSps) { + sigvsevt[iring2 + 2 * ringmx][0]->Fill(abs(ndof), nomHOSig); + sigvsevt[iring2 + 2 * ringmx][1]->Fill(chisq, nomHOSig); + sigvsevt[iring2 + 2 * ringmx][2]->Fill(trkth, nomHOSig); + sigvsevt[iring2 + 2 * ringmx][3]->Fill(trkph, nomHOSig); + sigvsevt[iring2 + 2 * ringmx][4]->Fill(1000 * therr, nomHOSig); + sigvsevt[iring2 + 2 * ringmx][5]->Fill(1000 * pherr, nomHOSig); + if (abshoang > 0.01) { + sigvsevt[iring2 + 2 * ringmx][6]->Fill(tmphoang, (nomHOSig)*abshoang); + } + sigvsevt[iring2 + 2 * ringmx][7]->Fill(fabs(trkmm), nomHOSig); + sigvsevt[iring2 + 2 * ringmx][8]->Fill(nmuon, nomHOSig); + if (!m_cosmic) + sigvsevt[iring2 + 2 * ringmx][9]->Fill(caloen[0], nomHOSig); + sigvsevt[iring2 + 2 * ringmx][10]->Fill(tkpt03, nomHOSig); + sigvsevt[iring2 + 2 * ringmx][11]->Fill(hodx, nomHOSig); + sigvsevt[iring2 + 2 * ringmx][12]->Fill(hody, nomHOSig); + sigvsevt[iring2 + 2 * ringmx][13]->Fill(htime, nomHOSig); + + sig_eta_evt[2 * netamx + tmpxet][0]->Fill(abs(ndof), nomHOSig); + sig_eta_evt[2 * netamx + tmpxet][1]->Fill(chisq, nomHOSig); + sig_eta_evt[2 * netamx + tmpxet][2]->Fill(trkth, nomHOSig); + sig_eta_evt[2 * netamx + tmpxet][3]->Fill(trkph, nomHOSig); + sig_eta_evt[2 * netamx + tmpxet][4]->Fill(1000 * therr, nomHOSig); + sig_eta_evt[2 * netamx + tmpxet][5]->Fill(1000 * pherr, nomHOSig); + if (abshoang > 0.01) { + sig_eta_evt[2 * netamx + tmpxet][6]->Fill(tmphoang, (nomHOSig)*abshoang); + } + sig_eta_evt[2 * netamx + tmpxet][7]->Fill(fabs(trkmm), nomHOSig); + sig_eta_evt[2 * netamx + tmpxet][8]->Fill(nmuon, nomHOSig); + if (!m_cosmic) + sig_eta_evt[2 * netamx + tmpxet][9]->Fill(caloen[0], nomHOSig); + sig_eta_evt[2 * netamx + tmpxet][10]->Fill(tkpt03, nomHOSig); + sig_eta_evt[2 * netamx + tmpxet][11]->Fill(hodx, nomHOSig); + sig_eta_evt[2 * netamx + tmpxet][12]->Fill(hody, nomHOSig); + sig_eta_evt[2 * netamx + tmpxet][13]->Fill(htime, nomHOSig); + } + + variab[iring2 + 2 * ringmx][0]->Fill(abs(ndof)); + variab[iring2 + 2 * ringmx][1]->Fill(chisq); + variab[iring2 + 2 * ringmx][2]->Fill(trkth); + variab[iring2 + 2 * ringmx][3]->Fill(trkph); + variab[iring2 + 2 * ringmx][4]->Fill(1000 * therr); + variab[iring2 + 2 * ringmx][5]->Fill(1000 * pherr); + variab[iring2 + 2 * ringmx][6]->Fill(tmphoang); + variab[iring2 + 2 * ringmx][7]->Fill(fabs(trkmm)); + variab[iring2 + 2 * ringmx][8]->Fill(nmuon); if (!m_cosmic) - sigvsevt[iring2 + 10][12]->Fill(caloen[0], hosig[4]); - - int iselect = (ipsall == mypow_2_ncut - 1) ? 1 : 0; - - if (hocro != -100.0 && hocro < -50.0) - hocro += 100.; + variab[iring2 + 2 * ringmx][9]->Fill(caloen[0]); + variab[iring2 + 2 * ringmx][10]->Fill(tkpt03); + variab[iring2 + 2 * ringmx][11]->Fill(hodx); + variab[iring2 + 2 * ringmx][12]->Fill(hody); + variab[iring2 + 2 * ringmx][13]->Fill(htime); muonnm->Fill(nmuon); muonmm->Fill(trkmm); @@ -1330,6 +990,8 @@ void HOCalibAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& i muonph->Fill(trkph * 180 / pival); muonch->Fill(chisq); + int iselect = (ipsall == mypow_2[ncut] - 1) ? 1 : 0; + if (iselect == 1) { ipass++; sel_muonnm->Fill(nmuon); @@ -1337,1622 +999,15 @@ void HOCalibAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& i sel_muonth->Fill(trkth * 180 / pival); sel_muonph->Fill(trkph * 180 / pival); sel_muonch->Fill(chisq); - } - - int tmpphi = (iphi + 1) % 3; //pixel mapping - int npixel = 0; - int itag = -1; - int iflip = 0; - int fact = 2; - - if (iring == 0) { - tmpphi = (iphi + 1) % 2; - if (tmpsect == 2 || tmpsect == 3 || tmpsect == 6 || tmpsect == 7 || tmpsect == 10 || tmpsect == 11) { - npixel = mapx0p[tmpeta][tmpphi]; - itag = 2; - } else { - npixel = mapx0m[tmpeta][tmpphi]; - itag = 3; + if (m_histFill && tmpxet >= 0 && tmpxet < netamx && iphi >= 0 && iphi < nphimx) { + ho_indenergy[tmpxet][iphi - 1]->Fill(nomHOSig); } - } else { - fact = 3; - if (tmpsect % 2 == 1) - iflip = 1; - if (abs(iring) == 1) { - npixel = mapx1[tmpeta][(iflip == 0) ? tmpphi : abs(tmpphi - 2)]; - itag = 1; - } else { - npixel = mapx2[tmpeta][(iflip == 0) ? tmpphi : abs(tmpphi - 2)]; - itag = 0; - } - } - - int tmpeta1 = (ieta > 0) ? ieta - 1 : -ieta + 14; - - int iselect2 = 0; - if (hosig[4] != -100) { - if (m_cosmic) { - if (caloen[2] <= 0.0) - iselect2 = 1; - } else { - if (caloen[2] <= 3.0) - iselect2 = 1; - } - } - - if (iselect2 == 1) { - int tmpphi2 = (iphi + 6 <= nphimx) ? iphi + 5 : iphi + 5 - nphimx; - - int tmprout2 = (iring == 0) ? int((tmpphi2 + 2) / 2.) + 1 : int((tmpphi2 + 2) / 3.) + 1; - if (tmprout2 > tmproutmx) - tmprout2 = 1; - - if (cro_ssg[tmpeta1][tmpphi2].size() < 4000) { - if (hocro > alow && hocro < ahigh) { - if (!m_histfit) - cro_ssg[tmpeta1][tmpphi2].push_back(hocro); - crossg[tmpeta1][tmpphi2]->Fill(hocro); - } - } - - if (tmpphi2 >= 0 && tmpphi2 < nphimx) { - crossg[tmpeta1][nphimx]->Fill(hocro); - } - if (m_combined) { - com_crossg[iring2][tmprout2 - 1]->Fill(hocro); - com_crossg[iring2][tmproutmx]->Fill(hocro); + if (m_treeFill) { + T1->Fill(); } } - - if (iselect == 1) { - for (int ij = 0; ij < neffip; ij++) { - if (ij == 0) { - sig_effi[ij]->Fill(ieta, iphi, 1.); - } else { - if (hosig[4] > ij * m_sigma) { - sig_effi[ij]->Fill(ieta, iphi, 1.); - } - } - } - - //Histogram filling for noise study: phi shift according to DTChamberAnalysis - int tmpphi1 = iphi - 1; - - if (sig_reg[tmpeta1][tmpphi1].size() < 4000) { - if (hosig[4] > -50 && hosig[4] < 15) { - sigrsg[tmpeta1][tmpphi1]->Fill(hosig[4]); - if (!m_histfit && hosig[4] <= ahigh / 2.) - sig_reg[tmpeta1][tmpphi1].push_back(hosig[4]); - invang[tmpeta1][tmpphi1] += 1. / fabs(hoang); - } - } - - if (tmpphi1 >= 0 && tmpphi1 < nphimx) { //GREN - sigrsg[tmpeta1][nphimx]->Fill(hosig[4]); - invang[tmpeta1][nphimx] += 1. / fabs(hoang); - } - - if (m_combined) { // COMBINED - com_sigrsg[iring2][tmprout - 1]->Fill(hosig[4]); - com_invang[iring2][tmprout - 1] += 1. / fabs(hoang); - - com_sigrsg[iring2][tmproutmx]->Fill(hosig[4]); - com_invang[iring2][tmproutmx] += 1. / fabs(hoang); - } //m_combined - - if (m_checkmap || m_correl) { // CHECKMAP - tmpeta = etamap[itag][npixel]; - tmpphi = phimap[itag][npixel]; - if (tmpeta >= 0 && tmpphi >= 0) { - if (iflip != 0) - tmpphi = abs(tmpphi - 2); - if (int((hocorsig[fact * tmpeta + tmpphi] - hosig[4]) * 10000) / 10000. != 0) { - iaxxx++; - edm::LogVerbatim("HOCalib") - << "iring2xxx " << irun << " " << ievt << " " << isect << " " << iring << " " << tmpsect << " " - << ieta << " " << iphi << " " << npixel << " " << tmpeta << " " << tmpphi << " " << tmpeta1 << " " - << tmpphi1 << " itag " << itag << " " << iflip << " " << fact << " " - << hocorsig[fact * tmpeta + tmpphi] << " " << fact * tmpeta + tmpphi << " " << hosig[4] << " " << hodx - << " " << hody; - - for (int ij = 0; ij < 18; ij++) { - edm::LogVerbatim("HOCalib") << " " << ij << " " << hocorsig[ij]; - } - edm::LogVerbatim("HOCalib") << " ix " << iaxxx << " " << ibxxx; - } else { - ibxxx++; - } - - corrsgc[tmpeta1][tmpphi1]->Fill(hocorsig[fact * tmpeta + tmpphi]); - if (m_combined) { // COMBINED - com_corrsgc[iring2][tmpsect - 1]->Fill(hocorsig[fact * tmpeta + tmpphi]); - } //m_combined - } - } //m_checkmap - - if (m_correl) { // CORREL - float allcorsig = 0.0; - - tmpeta = etamap[itag][npixleft[npixel]]; - tmpphi = phimap[itag][npixleft[npixel]]; - - if (tmpeta >= 0 && tmpphi >= 0) { - if (iflip != 0) - tmpphi = abs(tmpphi - 2); - corrsgl[tmpeta1][tmpphi1]->Fill(hocorsig[fact * tmpeta + tmpphi]); - allcorsig += hocorsig[fact * tmpeta + tmpphi]; - if (m_combined) { // COMBINED - com_corrsgl[iring2][tmpsect - 1]->Fill(hocorsig[fact * tmpeta + tmpphi]); - } //m_combined - } - - tmpeta = etamap[itag][npixrigh[npixel]]; - tmpphi = phimap[itag][npixrigh[npixel]]; - if (tmpeta >= 0 && tmpphi >= 0) { - if (iflip != 0) - tmpphi = abs(tmpphi - 2); - corrsgr[tmpeta1][tmpphi1]->Fill(hocorsig[fact * tmpeta + tmpphi]); - allcorsig += hocorsig[fact * tmpeta + tmpphi]; - if (m_combined) { // #ifdef COMBINED - com_corrsgr[iring2][tmpsect - 1]->Fill(hocorsig[fact * tmpeta + tmpphi]); - } //m_combined #endif - } - - tmpeta = etamap[itag][npixlebt[npixel]]; - tmpphi = phimap[itag][npixlebt[npixel]]; - if (tmpeta >= 0 && tmpphi >= 0) { - if (iflip != 0) - tmpphi = abs(tmpphi - 2); - corrsglb[tmpeta1][tmpphi1]->Fill(hocorsig[fact * tmpeta + tmpphi]); - allcorsig += hocorsig[fact * tmpeta + tmpphi]; - if (m_combined) { // COMBINED - com_corrsglb[iring2][tmpsect - 1]->Fill(hocorsig[fact * tmpeta + tmpphi]); - } //m_combined - } - - tmpeta = etamap[itag][npixribt[npixel]]; - tmpphi = phimap[itag][npixribt[npixel]]; - if (tmpeta >= 0 && tmpphi >= 0) { - if (iflip != 0) - tmpphi = abs(tmpphi - 2); - corrsgrb[tmpeta1][tmpphi1]->Fill(hocorsig[fact * tmpeta + tmpphi]); - allcorsig += hocorsig[fact * tmpeta + tmpphi]; - if (m_combined) { // COMBINED - com_corrsgrb[iring2][tmpsect - 1]->Fill(hocorsig[fact * tmpeta + tmpphi]); - } //m_combined - } - - tmpeta = etamap[itag][npixleup[npixel]]; - tmpphi = phimap[itag][npixleup[npixel]]; - if (tmpeta >= 0 && tmpphi >= 0) { - if (iflip != 0) - tmpphi = abs(tmpphi - 2); - corrsglu[tmpeta1][tmpphi1]->Fill(hocorsig[fact * tmpeta + tmpphi]); - allcorsig += hocorsig[fact * tmpeta + tmpphi]; - if (m_combined) { // COMBINED - com_corrsglu[iring2][tmpsect - 1]->Fill(hocorsig[fact * tmpeta + tmpphi]); - } //m_combined - } - - tmpeta = etamap[itag][npixriup[npixel]]; - tmpphi = phimap[itag][npixriup[npixel]]; - if (tmpeta >= 0 && tmpphi >= 0) { - if (iflip != 0) - tmpphi = abs(tmpphi - 2); - corrsgru[tmpeta1][tmpphi1]->Fill(hocorsig[fact * tmpeta + tmpphi]); - allcorsig += hocorsig[fact * tmpeta + tmpphi]; - if (m_combined) { // COMBINED - com_corrsgru[iring2][tmpsect - 1]->Fill(hocorsig[fact * tmpeta + tmpphi]); - } //m_combined - } - corrsgall[tmpeta1][tmpphi1]->Fill(allcorsig); - if (m_combined) { // COMBINED - com_corrsgall[iring2][tmpsect - 1]->Fill(allcorsig); - } //m_combined - - } //m_correl - for (int k = 0; k < 9; k++) { - switch (iring) { - case 2: - ho_sig2p[k]->Fill(hosig[k]); - break; - case 1: - ho_sig1p[k]->Fill(hosig[k]); - break; - case 0: - ho_sig00[k]->Fill(hosig[k]); - break; - case -1: - ho_sig1m[k]->Fill(hosig[k]); - break; - case -2: - ho_sig2m[k]->Fill(hosig[k]); - break; - } - if (m_hbinfo) { // HBINFO - hbhe_sig[k]->Fill(hbhesig[k]); - } //m_hbinfo - } - } //if (iselect==1) - } //for (HOCalibVariableCollection::const_iterator hoC=(*HOCalib).begin(); hoC!=(*HOCalib).end(); hoC++){ - - } //if (isCosMu) -} - -// ------------ method called once each job just before starting event loop ------------ -void HOCalibAnalyzer::beginJob() {} - -// ------------ method called once each job just after ending the event loop ------------ -void HOCalibAnalyzer::endJob() { - theFile->cd(); - - if (m_allHOsignal) { - for (int jk = 0; jk < ho_energy->GetNbinsX(); jk++) { - for (int kl = 0; kl < ho_energy->GetNbinsY(); kl++) { - double entry = ho_entry->GetBinContent(jk + 1, kl + 1); - if (entry < 1.) - entry = 1.; - - double energy = ho_energy->GetBinContent(jk + 1, kl + 1) / entry; - double energy2 = ho_energy2->GetBinContent(jk + 1, kl + 1) / entry; - double rms = sqrt(energy2 - energy * energy); - - double xval = ho_energy->GetXaxis()->GetBinCenter(jk + 1); - double yval = ho_energy->GetYaxis()->GetBinCenter(kl + 1); - - ho_rms->Fill(xval, yval, rms); - } - } - } - - for (int ij = 0; ij < nphimx; ij++) { - for (int jk = 0; jk < netamx; jk++) { - nevsigrsg->Fill(netamx * ij + jk, sigrsg[jk][ij]->GetEntries()); - mnsigrsg->Fill(netamx * ij + jk, sigrsg[jk][ij]->GetMean()); - rmssigrsg->Fill(netamx * ij + jk, sigrsg[jk][ij]->GetRMS()); - - nevcrossg->Fill(netamx * ij + jk, crossg[jk][ij]->GetEntries()); - mncrossg->Fill(netamx * ij + jk, crossg[jk][ij]->GetMean()); - rmscrossg->Fill(netamx * ij + jk, crossg[jk][ij]->GetRMS()); - - if (m_correl) { // CORREL - - nevcorrsglb->Fill(netamx * ij + jk, corrsglb[jk][ij]->GetEntries()); - mncorrsglb->Fill(netamx * ij + jk, corrsglb[jk][ij]->GetMean()); - rmscorrsglb->Fill(netamx * ij + jk, corrsglb[jk][ij]->GetRMS()); - - nevcorrsgrb->Fill(netamx * ij + jk, corrsgrb[jk][ij]->GetEntries()); - mncorrsgrb->Fill(netamx * ij + jk, corrsgrb[jk][ij]->GetMean()); - rmscorrsgrb->Fill(netamx * ij + jk, corrsgrb[jk][ij]->GetRMS()); - - nevcorrsglu->Fill(netamx * ij + jk, corrsglu[jk][ij]->GetEntries()); - mncorrsglu->Fill(netamx * ij + jk, corrsglu[jk][ij]->GetMean()); - rmscorrsglu->Fill(netamx * ij + jk, corrsglu[jk][ij]->GetRMS()); - - nevcorrsgru->Fill(netamx * ij + jk, corrsgru[jk][ij]->GetEntries()); - mncorrsgru->Fill(netamx * ij + jk, corrsgru[jk][ij]->GetMean()); - rmscorrsgru->Fill(netamx * ij + jk, corrsgru[jk][ij]->GetRMS()); - - nevcorrsgall->Fill(netamx * ij + jk, corrsgall[jk][ij]->GetEntries()); - mncorrsgall->Fill(netamx * ij + jk, corrsgall[jk][ij]->GetMean()); - rmscorrsgall->Fill(netamx * ij + jk, corrsgall[jk][ij]->GetRMS()); - - nevcorrsgl->Fill(netamx * ij + jk, corrsgl[jk][ij]->GetEntries()); - mncorrsgl->Fill(netamx * ij + jk, corrsgl[jk][ij]->GetMean()); - rmscorrsgl->Fill(netamx * ij + jk, corrsgl[jk][ij]->GetRMS()); - - nevcorrsgr->Fill(netamx * ij + jk, corrsgr[jk][ij]->GetEntries()); - mncorrsgr->Fill(netamx * ij + jk, corrsgr[jk][ij]->GetMean()); - rmscorrsgr->Fill(netamx * ij + jk, corrsgr[jk][ij]->GetRMS()); - } //m_correl - if (m_checkmap) { // CHECKMAP - nevcorrsgc->Fill(netamx * ij + jk, corrsgc[jk][ij]->GetEntries()); - mncorrsgc->Fill(netamx * ij + jk, corrsgc[jk][ij]->GetMean()); - rmscorrsgc->Fill(netamx * ij + jk, corrsgc[jk][ij]->GetRMS()); - } //m_checkmap - } - } - - if (m_combined) { // COMBINED - for (int jk = 0; jk < ringmx; jk++) { - for (int ij = 0; ij < routmx; ij++) { - if (jk != 2 && ij >= rout12mx) - continue; - nevsigrsg->Fill(netamx * nphimx + ringmx * ij + jk, com_sigrsg[jk][ij]->GetEntries()); - mnsigrsg->Fill(netamx * nphimx + ringmx * ij + jk, com_sigrsg[jk][ij]->GetMean()); - rmssigrsg->Fill(netamx * nphimx + ringmx * ij + jk, com_sigrsg[jk][ij]->GetRMS()); - - nevcrossg->Fill(netamx * nphimx + ringmx * ij + jk, com_crossg[jk][ij]->GetEntries()); - mncrossg->Fill(netamx * nphimx + ringmx * ij + jk, com_crossg[jk][ij]->GetMean()); - rmscrossg->Fill(netamx * nphimx + ringmx * ij + jk, com_crossg[jk][ij]->GetRMS()); - } - } - - for (int ij = 0; ij < sectmx; ij++) { - for (int jk = 0; jk < ringmx; jk++) { - if (m_correl) { // CORREL - nevcorrsglb->Fill(netamx * nphimx + ringmx * ij + jk, com_corrsglb[jk][ij]->GetEntries()); - mncorrsglb->Fill(netamx * nphimx + ringmx * ij + jk, com_corrsglb[jk][ij]->GetMean()); - rmscorrsglb->Fill(netamx * nphimx + ringmx * ij + jk, com_corrsglb[jk][ij]->GetRMS()); - - nevcorrsgrb->Fill(netamx * nphimx + ringmx * ij + jk, com_corrsgrb[jk][ij]->GetEntries()); - mncorrsgrb->Fill(netamx * nphimx + ringmx * ij + jk, com_corrsgrb[jk][ij]->GetMean()); - rmscorrsgrb->Fill(netamx * nphimx + ringmx * ij + jk, com_corrsgrb[jk][ij]->GetRMS()); - - nevcorrsglu->Fill(netamx * nphimx + ringmx * ij + jk, com_corrsglu[jk][ij]->GetEntries()); - mncorrsglu->Fill(netamx * nphimx + ringmx * ij + jk, com_corrsglu[jk][ij]->GetMean()); - rmscorrsglu->Fill(netamx * nphimx + ringmx * ij + jk, com_corrsglu[jk][ij]->GetRMS()); - - nevcorrsgru->Fill(netamx * nphimx + ringmx * ij + jk, com_corrsgru[jk][ij]->GetEntries()); - mncorrsgru->Fill(netamx * nphimx + ringmx * ij + jk, com_corrsgru[jk][ij]->GetMean()); - rmscorrsgru->Fill(netamx * nphimx + ringmx * ij + jk, com_corrsgru[jk][ij]->GetRMS()); - - nevcorrsgall->Fill(netamx * nphimx + ringmx * ij + jk, com_corrsgall[jk][ij]->GetEntries()); - mncorrsgall->Fill(netamx * nphimx + ringmx * ij + jk, com_corrsgall[jk][ij]->GetMean()); - rmscorrsgall->Fill(netamx * nphimx + ringmx * ij + jk, com_corrsgall[jk][ij]->GetRMS()); - - nevcorrsgl->Fill(netamx * nphimx + ringmx * ij + jk, com_corrsgl[jk][ij]->GetEntries()); - mncorrsgl->Fill(netamx * nphimx + ringmx * ij + jk, com_corrsgl[jk][ij]->GetMean()); - rmscorrsgl->Fill(netamx * nphimx + ringmx * ij + jk, com_corrsgl[jk][ij]->GetRMS()); - - nevcorrsgr->Fill(netamx * nphimx + ringmx * ij + jk, com_corrsgr[jk][ij]->GetEntries()); - mncorrsgr->Fill(netamx * nphimx + ringmx * ij + jk, com_corrsgr[jk][ij]->GetMean()); - rmscorrsgr->Fill(netamx * nphimx + ringmx * ij + jk, com_corrsgr[jk][ij]->GetRMS()); - } //m_correl - if (m_checkmap) { // CHECKMAP - nevcorrsgc->Fill(netamx * nphimx + ringmx * ij + jk, com_corrsgc[jk][ij]->GetEntries()); - mncorrsgc->Fill(netamx * nphimx + ringmx * ij + jk, com_corrsgc[jk][ij]->GetMean()); - rmscorrsgc->Fill(netamx * nphimx + ringmx * ij + jk, com_corrsgc[jk][ij]->GetRMS()); - } //m_checkmap - } - } - } //m_combined - - for (int ij = 1; ij < neffip; ij++) { - sig_effi[ij]->Divide(sig_effi[0]); - } - for (int ij = 0; ij < netamx; ij++) { - for (int jk = 0; jk < nphimx; jk++) { - int ieta = (ij < 15) ? ij + 1 : 14 - ij; - int iphi = jk + 1; - double signal = sigrsg[ij][jk]->GetMean(); - mean_energy->Fill(ieta, iphi, signal); - } - } - - int irunold = irun; - - gStyle->SetOptLogy(0); - gStyle->SetTitleFillColor(10); - gStyle->SetStatColor(10); - - gStyle->SetCanvasColor(10); - gStyle->SetOptStat(0); //1110); - gStyle->SetOptTitle(1); - - gStyle->SetTitleColor(10); - gStyle->SetTitleFontSize(0.09); - gStyle->SetTitleOffset(-0.05); - gStyle->SetTitleBorderSize(1); - - gStyle->SetPadColor(10); - gStyle->SetPadBorderMode(0); - gStyle->SetStatColor(10); - gStyle->SetPadBorderMode(0); - gStyle->SetStatBorderSize(1); - gStyle->SetStatFontSize(.07); - - gStyle->SetStatStyle(1001); - gStyle->SetOptFit(101); - gStyle->SetCanvasColor(10); - gStyle->SetCanvasBorderMode(0); - - gStyle->SetStatX(.99); - gStyle->SetStatY(.99); - gStyle->SetStatW(.45); - gStyle->SetStatH(.16); - gStyle->SetLabelSize(0.075, "XY"); - gStyle->SetLabelOffset(0.21, "XYZ"); - gStyle->SetTitleSize(0.065, "XY"); - gStyle->SetTitleOffset(0.06, "XYZ"); - gStyle->SetPadTopMargin(.09); - gStyle->SetPadBottomMargin(0.11); - gStyle->SetPadLeftMargin(0.12); - gStyle->SetPadRightMargin(0.15); - gStyle->SetPadGridX(true); - gStyle->SetPadGridY(true); - gStyle->SetGridStyle(2); - gStyle->SetNdivisions(303, "XY"); - - gStyle->SetMarkerSize(0.60); - gStyle->SetMarkerColor(2); - gStyle->SetMarkerStyle(20); - gStyle->SetTitleFontSize(0.07); - - char out_file[200]; - int xsiz = 700; - int ysiz = 500; - - gStyle->SetPadBottomMargin(0.14); - gStyle->SetPadLeftMargin(0.17); - gStyle->SetPadRightMargin(0.03); - - gStyle->SetOptStat(1110); - - const int nsample = 8; - TF1* gx0[nsample] = {nullptr}; - TF1* ped0fun[nsample] = {nullptr}; - TF1* signal[nsample] = {nullptr}; - TF1* pedfun[nsample] = {nullptr}; - TF1* sigfun[nsample] = {nullptr}; - TF1* signalx[nsample] = {nullptr}; - - TH1F* signall[nsample] = {nullptr}; - TH1F* pedstll[nsample] = {nullptr}; - - if (m_constant) { - gStyle->SetOptFit(101); - gStyle->SetCanvasBorderMode(0); - gStyle->SetPadBorderMode(0); - gStyle->SetStatBorderSize(1); - gStyle->SetStatStyle(1001); - gStyle->SetTitleColor(10); - gStyle->SetTitleFontSize(0.09); - gStyle->SetTitleOffset(-0.05); - gStyle->SetTitleBorderSize(1); - - gStyle->SetCanvasColor(10); - gStyle->SetPadColor(10); - gStyle->SetStatColor(10); - gStyle->SetStatFontSize(.07); - gStyle->SetStatX(0.99); - gStyle->SetStatY(0.99); - gStyle->SetStatW(0.30); - gStyle->SetStatH(0.10); - gStyle->SetTitleSize(0.065, "XYZ"); - gStyle->SetLabelSize(0.075, "XYZ"); - gStyle->SetLabelOffset(0.012, "XYZ"); - gStyle->SetPadGridX(true); - gStyle->SetPadGridY(true); - gStyle->SetGridStyle(3); - gStyle->SetNdivisions(101, "XY"); - gStyle->SetOptLogy(0); - int iiter = 0; - - std::ofstream file_out(theoutputtxtFile.c_str()); - // TPostScript* ps=0; - int ips = 111; - TPostScript ps(theoutputpsFile.c_str(), ips); - ps.Range(20, 28); - - xsiz = 900; //900; - ysiz = 1200; //600; - TCanvas* c0 = new TCanvas("c0", " Pedestal vs signal", xsiz, ysiz); - - // Fix is done for eta-phi - - float mean_eta[netamx]; - float mean_phi[nphimx]; - float rms_eta[netamx]; - float rms_phi[nphimx]; - - for (int ij = 0; ij < nphimx; ++ij) { - mean_phi[ij] = 0; - rms_phi[ij] = 0; - } - for (int ij = 0; ij < netamx; ++ij) { - mean_eta[ij] = 0; - rms_eta[ij] = 0; - } - - int mxeta = 0; - int mxphi = 0; - int mneta = 0; - int mnphi = 0; - - //iijj = 0 : Merging all ring - // = 1 : Individual HPD - //iijj = 2 : merging all phi - // = 3 : Individual tower - - for (int iijj = 0; iijj < 4; iijj++) { - // if ((!mx_combined) && iijj==1) continue; //Use this only for combined data - if (iijj == 0) { - mxeta = ringmx; - mxphi = 1; - mneta = 0; - mnphi = 0; - } else if (iijj == 1) { - mxeta = ringmx; - mxphi = routmx; - mneta = 0; - mnphi = 0; - } else if (iijj == 2) { - mxeta = netamx; - mxphi = 1; - mneta = 0; - mnphi = 0; - } else if (iijj == 3) { - mxeta = netamx; - mxphi = nphimx; - mneta = 0; - mnphi = 0; - } - - for (int jk = mneta; jk < mxeta; jk++) { - for (int ij = mnphi; ij < mxphi; ij++) { - if (iijj == 1) - continue; - if ((iijj == 0 || iijj == 1) && jk != 2 && ij >= rout12mx) - continue; - int izone = iiter % nsample; - - if (iijj == 0) { - int iread = (jk == 2) ? routmx : rout12mx; - signall[izone] = (TH1F*)com_sigrsg[jk][iread]->Clone("hnew"); - pedstll[izone] = (TH1F*)com_crossg[jk][iread]->Clone("hnew"); - } else if (iijj == 1) { - signall[izone] = (TH1F*)com_sigrsg[jk][ij]->Clone("hnew"); - pedstll[izone] = (TH1F*)com_crossg[jk][ij]->Clone("hnew"); - } else if (iijj == 2) { - signall[izone] = (TH1F*)sigrsg[jk][nphimx]->Clone("hnew"); - pedstll[izone] = (TH1F*)crossg[jk][nphimx]->Clone("hnew"); - } else if (iijj == 3) { - signall[izone] = (TH1F*)sigrsg[jk][ij]->Clone("hnew"); - pedstll[izone] = (TH1F*)crossg[jk][ij]->Clone("hnew"); - } - - pedstll[izone]->SetLineWidth(2); - signall[izone]->SetLineWidth(2); - pedstll[izone]->SetLineColor(2); - signall[izone]->SetLineColor(4); - pedstll[izone]->SetNdivisions(506, "XY"); - signall[izone]->SetNdivisions(506, "XY"); - - signall[izone]->GetXaxis()->SetLabelSize(.065); - signall[izone]->GetYaxis()->SetLabelSize(.06); - signall[izone]->GetXaxis()->SetTitle("Signal (GeV)"); - - signall[izone]->GetXaxis()->SetTitleSize(.065); - signall[izone]->GetXaxis()->CenterTitle(); - - if (izone == 0) { //iiter%8 ==0) { - ps.NewPage(); - c0->Divide(4, 4); //c0->Divide(2,4); // c0->Divide(1,2); - } - c0->cd(2 * izone + 1); // (iiter%8)+1); //c0->cd(iiter%8+1); - - float mean = pedstll[izone]->GetMean(); - float rms = pedstll[izone]->GetRMS(); - - if (rms < 0.10) - rms = 0.10; - if (rms > 0.15) - rms = 0.15; - if (mean > 0.20) - mean = 0.20; - if (mean < -0.20) - mean = -0.20; - - float xmn = mean - 6. * rms; - float xmx = mean + 6. * rms; - - binwid = pedstll[izone]->GetBinWidth(1); - if (xmx > pedstll[izone]->GetXaxis()->GetXmax()) - xmx = pedstll[izone]->GetXaxis()->GetXmax() - 0.5 * binwid; - if (xmn < pedstll[izone]->GetXaxis()->GetXmin()) - xmn = pedstll[izone]->GetXaxis()->GetXmin() + 0.5 * binwid; - - float height = pedstll[izone]->GetEntries(); - - double par[nbgpr] = {height, mean, 0.75 * rms}; - - double gaupr[nbgpr]; - double parer[nbgpr]; - - ietafit = jk; - iphifit = ij; - pedstll[izone]->GetXaxis()->SetLabelSize(.065); - pedstll[izone]->GetYaxis()->SetLabelSize(.06); - - pedstll[izone]->GetXaxis()->SetRangeUser(xmn, xmx); - - if (iijj == 0) { - pedstll[izone]->GetXaxis()->SetTitle("Pedestal/Signal (GeV)"); - } else { - pedstll[izone]->GetXaxis()->SetTitle("Pedestal (GeV)"); - } - pedstll[izone]->GetXaxis()->SetTitleSize(.065); - pedstll[izone]->GetXaxis()->CenterTitle(); - - pedstll[izone]->Draw(); - if (m_pedsuppr) { - gaupr[0] = 0; - gaupr[1] = 0.0; // pedmean[ietafit][iphifit]; - gaupr[2] = 0.15; //GMA need from database - parer[0] = parer[1] = parer[2] = 0; - } else { - if (pedstll[izone]->GetEntries() > 5) { - if ((iijj != 3) || m_histfit) { - char temp[20]; - sprintf(temp, "gx0_%i", izone); - gx0[izone] = new TF1(temp, gausX, xmn, xmx, nbgpr); - gx0[izone]->SetParameters(par); - gx0[izone]->SetLineWidth(1); - pedstll[izone]->Fit(gx0[izone], "R+"); - - for (int k = 0; k < nbgpr; k++) { - parer[k] = gx0[izone]->GetParError(k); - gaupr[k] = gx0[izone]->GetParameter(k); - } - } else { - double strt[nbgpr] = {height, mean, 0.75 * rms}; - double step[nbgpr] = {1.0, 0.001, 0.001}; - double alowmn[nbgpr] = {0.5 * height, mean - rms, 0.3 * rms}; - double ahighmn[nbgpr] = {1.5 * height, mean + rms, 1.5 * rms}; - - TMinuit* gMinuit = new TMinuit(nbgpr); - gMinuit->SetFCN(fcnbg); - - double arglist[10]; - int ierflg = 0; - arglist[0] = 0.5; - gMinuit->mnexcm("SET ERR", arglist, 1, ierflg); - char name[100]; - for (int k = 0; k < nbgpr; k++) { - sprintf(name, "pedpar%i", k); - gMinuit->mnparm(k, name, strt[k], step[k], alowmn[k], ahighmn[k], ierflg); - } - - arglist[0] = 0; - gMinuit->mnexcm("SIMPLEX", arglist, 0, ierflg); - - arglist[0] = 0; - gMinuit->mnexcm("IMPROVE", arglist, 0, ierflg); - - TString chnam; - double parv, err, xlo, xup, plerr, mierr, eparab, gcc; - int iuit; - - for (int k = 0; k < nbgpr; k++) { - if (step[k] > -10) { - gMinuit->mnpout(k, chnam, parv, err, xlo, xup, iuit); - gMinuit->mnerrs(k, plerr, mierr, eparab, gcc); - if (k == 0) { - gaupr[k] = parv * binwid; - parer[k] = err * binwid; - } else { - gaupr[k] = parv; - parer[k] = err; - } - } - } - - char temp[20]; - sprintf(temp, "ped0fun_%i", izone); - ped0fun[izone] = new TF1(temp, gausX, xmn, xmx, nbgpr); - ped0fun[izone]->SetParameters(gaupr); - ped0fun[izone]->SetLineColor(3); - ped0fun[izone]->SetLineWidth(1); - ped0fun[izone]->Draw("same"); - - delete gMinuit; - } - } else { - for (int k = 0; k < nbgpr; k++) { - gaupr[k] = par[k]; - } - gaupr[2] = 0.15; - } - } - - c0->cd(2 * izone + 2); - if (signall[izone]->GetEntries() > 5) { - Double_t parall[nsgpr]; - double parserr[nsgpr]; - double fitres[nsgpr]; - double pedht = 0; - - char temp[20]; - sprintf(temp, "signal_%i", izone); - xmn = signall[izone]->GetXaxis()->GetXmin(); - xmx = 0.5 * signall[izone]->GetXaxis()->GetXmax(); - signal[izone] = new TF1(temp, totalfunc, xmn, xmx, nsgpr); - xmx *= 2.0; - if ((iijj != 3) || m_histfit) { - pedht = (signall[izone]->GetBinContent(nbn - 1) + signall[izone]->GetBinContent(nbn) + - signall[izone]->GetBinContent(nbn + 1)) / - 3.; - - if (m_pedsuppr) { - parall[1] = 0.0; // pedmean[ietafit][iphifit]; - parall[2] = 0.15; - } else { - for (int lm = 0; lm < nbgpr; lm++) { - parall[lm] = gaupr[lm]; - } - } - - set_mean(parall[1], false); - set_sigma(parall[2], false); - - parall[0] = 0.9 * pedht; //GM for Z-mumu, there is almost no pedestal - parall[3] = 0.14; - double area = binwid * signall[izone]->GetEntries(); - parall[5] = area; - - if (iijj == 3) { - parall[4] = fitprm[4][jk]; - parall[6] = fitprm[6][jk]; - } else { - parall[4] = signall[izone]->GetMean(); - parall[6] = parall[2]; - } - - signal[izone]->SetParameters(parall); - signal[izone]->FixParameter(1, parall[1]); - signal[izone]->FixParameter(2, parall[2]); - signal[izone]->SetParLimits(0, 0.00, 2.0 * pedht + 0.1); - signal[izone]->FixParameter(3, 0.14); - - signal[izone]->SetParLimits(5, 0.40 * area, 1.15 * area); - if (iijj == 3) { - signal[izone]->SetParLimits(4, 0.2 * fitprm[4][jk], 2.0 * fitprm[4][jk]); - signal[izone]->SetParLimits(6, 0.2 * fitprm[6][jk], 2.0 * fitprm[6][jk]); - } else { - signal[izone]->SetParLimits(4, 0.1, 1.0); - signal[izone]->SetParLimits(6, 0.035, 0.3); - } - signal[izone]->SetParNames("const", "mean", "sigma", "Width", "MP", "Area", "GSigma"); - signall[izone]->Fit(signal[izone], "0R+"); - - signall[izone]->GetXaxis()->SetRangeUser(xmn, xmx); - for (int k = 0; k < nsgpr; k++) { - fitres[k] = fitprm[k][jk] = signal[izone]->GetParameter(k); - parserr[k] = signal[izone]->GetParError(k); - } - - } else { - double pedhtx = 0; - for (unsigned i = 0; i < sig_reg[ietafit][iphifit].size(); i++) { - if (sig_reg[ietafit][iphifit][ij] > gaupr[1] - 3 * gaupr[2] && - sig_reg[ietafit][iphifit][ij] < gaupr[1] + gaupr[2]) - pedhtx++; - } - - set_mean(gaupr[1], false); - set_sigma(gaupr[2], false); - - TString name[nsgpr] = {"const", "mean", "sigma", "Width", "MP", "Area", "GSigma"}; - double strt[nsgpr] = {0.9 * pedhtx, - gaupr[1], - gaupr[2], - fitprm[3][jk], - fitprm[4][jk], - signall[izone]->GetEntries(), - fitprm[6][jk]}; - double alowmn[nsgpr] = { - 0.1 * pedhtx - 0.1, gaupr[1] - 0.1, gaupr[2] - 0.1, 0.07, 0.2 * strt[4], 0.1 * strt[5], 0.2 * strt[6]}; - double ahighmn[nsgpr] = { - 1.2 * pedhtx + 0.1, gaupr[1] + 0.1, gaupr[2] + 0.1, 0.20, 2.5 * strt[4], 1.5 * strt[5], 2.2 * strt[6]}; - double step[nsgpr] = {1.0, 0.0, 0.0, 0.0, 0.001, 1.0, 0.002}; - - TMinuit* gMinuit = new TMinuit(nsgpr); - gMinuit->SetFCN(fcnsg); - - double arglist[10]; - int ierflg = 0; - arglist[0] = 0.5; - gMinuit->mnexcm("SET ERR", arglist, 1, ierflg); - - for (int k = 0; k < nsgpr; k++) { - gMinuit->mnparm(k, name[k], strt[k], step[k], alowmn[k], ahighmn[k], ierflg); - } - - arglist[0] = 0; - gMinuit->mnexcm("SIMPLEX", arglist, 0, ierflg); - - arglist[0] = 0; - gMinuit->mnexcm("IMPROVE", arglist, 0, ierflg); - - TString chnam; - double parv, err, xlo, xup, plerr, mierr, eparab, gcc; - int iuit; - - for (int k = 0; k < nsgpr; k++) { - if (step[k] > -10) { - gMinuit->mnpout(k, chnam, parv, err, xlo, xup, iuit); - gMinuit->mnerrs(k, plerr, mierr, eparab, gcc); - if (k == 0 || k == 5) { - fitres[k] = parv * binwid; - parserr[k] = err * binwid; - } else { - fitres[k] = parv; - parserr[k] = err; - } - } - } - - delete gMinuit; - } - - signall[izone]->Draw(); - - sprintf(temp, "pedfun_%i", izone); - pedfun[izone] = new TF1(temp, gausX, xmn, xmx, nbgpr); - pedfun[izone]->SetParameters(fitres); - pedfun[izone]->SetLineColor(3); - pedfun[izone]->SetLineWidth(1); - pedfun[izone]->Draw("same"); - - sprintf(temp, "signalfun_%i", izone); - sigfun[izone] = new TF1(temp, langaufun, xmn, xmx, nsgpr - nbgpr); - sigfun[izone]->SetParameters(&fitres[3]); - sigfun[izone]->SetLineWidth(1); - sigfun[izone]->SetLineColor(4); - sigfun[izone]->Draw("same"); - - sprintf(temp, "total_%i", izone); - signalx[izone] = new TF1(temp, totalfunc, xmn, xmx, nsgpr); - signalx[izone]->SetParameters(fitres); - signalx[izone]->SetLineWidth(1); - signalx[izone]->Draw("same"); - - int kl = (jk < 15) ? jk + 1 : 14 - jk; - - edm::LogVerbatim("HOCalib") << "histinfo" << iijj << " fit " << std::setw(3) << kl << " " << std::setw(3) - << ij + 1 << " " << std::setw(5) << pedstll[izone]->GetEntries() << " " - << std::setw(6) << pedstll[izone]->GetMean() << " " << std::setw(6) - << pedstll[izone]->GetRMS() << " " << std::setw(5) - << signall[izone]->GetEntries() << " " << std::setw(6) - << signall[izone]->GetMean() << " " << std::setw(6) << signall[izone]->GetRMS() - << " " << std::setw(6) << signal[izone]->GetChisquare() << " " << std::setw(3) - << signal[izone]->GetNDF(); - - file_out << "histinfo" << iijj << " fit " << std::setw(3) << kl << " " << std::setw(3) << ij + 1 << " " - << std::setw(5) << pedstll[izone]->GetEntries() << " " << std::setw(6) << pedstll[izone]->GetMean() - << " " << std::setw(6) << pedstll[izone]->GetRMS() << " " << std::setw(5) - << signall[izone]->GetEntries() << " " << std::setw(6) << signall[izone]->GetMean() << " " - << std::setw(6) << signall[izone]->GetRMS() << " " << std::setw(6) << signal[izone]->GetChisquare() - << " " << std::setw(3) << signal[izone]->GetNDF() << std::endl; - - file_out << "fitres x" << iijj << " " << kl << " " << ij + 1 << " " << fitres[0] << " " << fitres[1] << " " - << fitres[2] << " " << fitres[3] << " " << fitres[4] << " " << fitres[5] << " " << fitres[6] - << std::endl; - file_out << "parserr" << iijj << " " << kl << " " << ij + 1 << " " << parserr[0] << " " << parserr[1] << " " - << parserr[2] << " " << parserr[3] << " " << parserr[4] << " " << parserr[5] << " " << parserr[6] - << std::endl; - - int ieta = (jk < 15) ? (15 + jk) : (29 - jk); - int ifl = nphimx * ieta + ij; - - if (iijj == 3) { - ped_evt->Fill(ifl, pedstll[izone]->GetEntries()); - ped_mean->Fill(ifl, gaupr[1]); - ped_width->Fill(ifl, gaupr[2]); - fit_chi->Fill(ifl, signal[izone]->GetChisquare()); - sig_evt->Fill(ifl, signall[izone]->GetEntries()); - fit_sigevt->Fill(ifl, fitres[5]); - fit_bkgevt->Fill(ifl, fitres[0] * sqrt(2 * acos(-1.)) * gaupr[2]); - sig_mean->Fill(ifl, fitres[4]); - sig_diff->Fill(ifl, fitres[4] - fitres[1]); - sig_width->Fill(ifl, fitres[3]); - sig_sigma->Fill(ifl, fitres[6]); - sig_meanerr->Fill(ifl, parserr[4]); - if (fitres[4] - fitres[1] != 0) - sig_meanerrp->Fill(ifl, 100 * parserr[4] / (fitres[4] - fitres[1])); - if (gaupr[2] != 0) - sig_signf->Fill(ifl, (fitres[4] - fitres[1]) / gaupr[2]); - - ped_statmean->Fill(ifl, pedstll[izone]->GetMean()); - sig_statmean->Fill(ifl, signall[izone]->GetMean()); - ped_rms->Fill(ifl, pedstll[izone]->GetRMS()); - sig_rms->Fill(ifl, signall[izone]->GetRMS()); - } - - if ((iijj == 2) || (iijj == 3) || (iijj == 1)) { - if (signall[izone]->GetEntries() > 5 && fitres[4] > 0.1) { - //GMA need to put this==1 in future - float fact = 0.812; - if (abs(kl) <= 4) - fact = 0.895; - fact *= 0.19; //conversion factor for GeV/fC - - float fact2 = 0; - if (iijj == 2) - fact2 = invang[jk][nphimx]; - if (iijj == 3) - fact2 = invang[jk][ij]; - if (iijj == 1) - fact2 = com_invang[jk][ij]; - - float calibc = fact * fact2 / (fitres[4] * signall[izone]->GetEntries()); - float caliberr = TMath::Abs(calibc * parserr[4] / std::max(0.001, fitres[4])); - - if (iijj == 2) { - int ieta = (jk < 15) ? jk + 1 : 14 - jk; - mean_phi_hst->Fill(ieta, calibc); - mean_phi_hst->SetBinError(mean_phi_hst->FindBin(ieta), caliberr); - file_out << "intieta " << jk << " " << ij << " " << ieta << " " << mean_phi_hst->FindBin(double(ieta)) - << " " << calibc << " " << caliberr << std::endl; - } else if (iijj == 3) { - const_eta[jk]->Fill(ij + 1, calibc); - const_eta[jk]->SetBinError(const_eta[jk]->FindBin(ij + 1), caliberr); - - peak_eta[jk]->Fill(ij + 1, fitres[4]); - peak_eta[jk]->SetBinError(peak_eta[jk]->FindBin(ij + 1), parserr[4]); - - int ieta = (jk < 15) ? jk + 1 : 14 - jk; - const_eta_phi->Fill(ieta, ij + 1, calibc); - file_out << "intietax " << jk << " " << ij << " " << ieta << " " - << const_eta_phi->FindBin(ieta, ij + 1) << std::endl; - if (caliberr > 0) { - const_eta_phi->SetBinError(const_eta_phi->FindBin(ieta, ij + 1), caliberr); - - mean_eta[ij] += calibc / (caliberr * caliberr); - mean_phi[jk] += calibc / (caliberr * caliberr); - - rms_eta[ij] += 1. / (caliberr * caliberr); - rms_phi[jk] += 1. / (caliberr * caliberr); - - } else { - const_eta_phi->SetBinError(const_eta_phi->FindBin(ieta, ij + 1), 0.0); - } - } else if (iijj == 1) { - const_hpdrm[jk]->Fill(ij + 1, calibc); - const_hpdrm[jk]->SetBinError(const_hpdrm[jk]->FindBin(ij + 1), caliberr); - - peak_hpdrm[jk]->Fill(ij + 1, fitres[4]); - peak_hpdrm[jk]->SetBinError(peak_hpdrm[jk]->FindBin(ij + 1), parserr[4]); - } - - file_out << "HO 4 " << iijj << " " << std::setw(3) << kl << " " << std::setw(3) << ij + 1 << " " - << std::setw(7) << calibc << " " << std::setw(7) << caliberr << std::endl; - } - } - - } else { //if (signall[izone]->GetEntries() >10) { - signall[izone]->Draw(); - float varx = 0.000; - int kl = (jk < 15) ? jk + 1 : 14 - jk; - file_out << "histinfo" << iijj << " nof " << std::setw(3) << kl << " " << std::setw(3) << ij + 1 << " " - << std::setw(5) << pedstll[izone]->GetEntries() << " " << std::setw(6) << pedstll[izone]->GetMean() - << " " << std::setw(6) << pedstll[izone]->GetRMS() << " " << std::setw(5) - << signall[izone]->GetEntries() << " " << std::setw(6) << signall[izone]->GetMean() << " " - << std::setw(6) << signall[izone]->GetRMS() << " " << std::setw(6) << varx << " " << std::setw(3) - << varx << std::endl; - - file_out << "fitres x" << iijj << " " << kl << " " << ij + 1 << " " << varx << " " << varx << " " << varx - << " " << varx << " " << varx << " " << varx << " " << varx << std::endl; - file_out << "parserr" << iijj << " " << kl << " " << ij + 1 << " " << varx << " " << varx << " " << varx - << " " << varx << " " << varx << " " << varx << " " << varx << std::endl; - } - iiter++; - if (iiter % nsample == 0) { - c0->Update(); - - for (int kl = 0; kl < nsample; kl++) { - if (gx0[kl]) { - delete gx0[kl]; - gx0[kl] = nullptr; - } - if (ped0fun[kl]) { - delete ped0fun[kl]; - ped0fun[kl] = nullptr; - } - if (signal[kl]) { - delete signal[kl]; - signal[kl] = nullptr; - } - if (pedfun[kl]) { - delete pedfun[kl]; - pedfun[kl] = nullptr; - } - if (sigfun[kl]) { - delete sigfun[kl]; - sigfun[kl] = nullptr; - } - if (signalx[kl]) { - delete signalx[kl]; - signalx[kl] = nullptr; - } - if (signall[kl]) { - delete signall[kl]; - signall[kl] = nullptr; - } - if (pedstll[kl]) { - delete pedstll[kl]; - pedstll[kl] = nullptr; - } - } - } - } //for (int jk=0; jkUpdate(); - for (int kl = 0; kl < nsample; kl++) { - if (gx0[kl]) { - delete gx0[kl]; - gx0[kl] = nullptr; - } - if (ped0fun[kl]) { - delete ped0fun[kl]; - ped0fun[kl] = nullptr; - } - if (signal[kl]) { - delete signal[kl]; - signal[kl] = nullptr; - } - if (pedfun[kl]) { - delete pedfun[kl]; - pedfun[kl] = nullptr; - } - if (sigfun[kl]) { - delete sigfun[kl]; - sigfun[kl] = nullptr; - } - if (signalx[kl]) { - delete signalx[kl]; - signalx[kl] = nullptr; - } - if (signall[kl]) { - delete signall[kl]; - signall[kl] = nullptr; - } - if (pedstll[kl]) { - delete pedstll[kl]; - pedstll[kl] = nullptr; - } - } - } - - delete c0; - - xsiz = 600; //int xsiz = 600; - ysiz = 800; //int ysiz = 800; - - gStyle->SetTitleFontSize(0.05); - gStyle->SetTitleSize(0.025, "XYZ"); - gStyle->SetLabelSize(0.025, "XYZ"); - gStyle->SetStatFontSize(.045); - - gStyle->SetOptStat(0); - ps.NewPage(); - TCanvas* c1 = new TCanvas("c1", " Pedestal vs signal", xsiz, ysiz); - ped_evt->Draw(); - c1->Update(); - - ps.NewPage(); - ped_statmean->Draw(); - c1->Update(); - - ps.NewPage(); - ped_rms->Draw(); - c1->Update(); - - ps.NewPage(); - ped_mean->Draw(); - c1->Update(); - - ps.NewPage(); - ped_width->Draw(); - c1->Update(); - - ps.NewPage(); - sig_evt->Draw(); - c1->Update(); - - ps.NewPage(); - sig_statmean->Draw(); - c1->Update(); - - ps.NewPage(); - sig_rms->Draw(); - c1->Update(); - - ps.NewPage(); - fit_chi->Draw(); - c1->Update(); - - ps.NewPage(); - fit_sigevt->Draw(); - c1->Update(); - - ps.NewPage(); - fit_bkgevt->Draw(); - c1->Update(); - - ps.NewPage(); - sig_mean->Draw(); - c1->Update(); - - ps.NewPage(); - sig_width->Draw(); - c1->Update(); - - ps.NewPage(); - sig_sigma->Draw(); - c1->Update(); - - ps.NewPage(); - sig_meanerr->Draw(); - c1->Update(); - - ps.NewPage(); - sig_meanerrp->Draw(); - c1->Update(); - - ps.NewPage(); - sig_signf->Draw(); - c1->Update(); - - ps.Close(); - delete c1; - - file_out.close(); - - if (m_figure) { - xsiz = 700; - ysiz = 450; - - gStyle->SetTitleFontSize(0.09); - gStyle->SetPadBottomMargin(0.17); - gStyle->SetPadLeftMargin(0.18); - gStyle->SetPadRightMargin(0.01); - gStyle->SetOptLogy(0); - gStyle->SetOptStat(0); - - TCanvas* c2 = new TCanvas("c2", "runfile", xsiz, ysiz); - c2->Divide(5, 3); - - for (int side = 0; side < 2; side++) { - gStyle->SetNdivisions(303, "XY"); - gStyle->SetPadRightMargin(0.01); - int nmn = 0; - int nmx = netamx / 2; - if (side == 1) { - nmn = netamx / 2; - nmx = netamx; - } - - int nzone = 0; - - for (int ij = nmn; ij < nmx; ij++) { - c2->cd(nzone + 1); - const_eta[ij]->GetXaxis()->SetTitle("#phi index"); - const_eta[ij]->GetXaxis()->SetTitleSize(.08); - const_eta[ij]->GetXaxis()->CenterTitle(); - const_eta[ij]->GetXaxis()->SetTitleOffset(0.9); - const_eta[ij]->GetXaxis()->SetLabelSize(.085); - const_eta[ij]->GetXaxis()->SetLabelOffset(.01); - - const_eta[ij]->GetYaxis()->SetLabelSize(.08); - const_eta[ij]->GetYaxis()->SetLabelOffset(.01); - const_eta[ij]->GetYaxis()->SetTitle("GeV/MIP-GeV!!"); - - const_eta[ij]->GetYaxis()->SetTitleSize(.085); - const_eta[ij]->GetYaxis()->CenterTitle(); - const_eta[ij]->GetYaxis()->SetTitleOffset(1.3); - const_eta[ij]->SetMarkerSize(0.60); - const_eta[ij]->SetMarkerColor(2); - const_eta[ij]->SetMarkerStyle(20); - - const_eta[ij]->Draw(); - nzone++; - } - - sprintf(out_file, "calibho_%i_side%i.eps", irunold, side); - c2->SaveAs(out_file); - - sprintf(out_file, "calibho_%i_side%i.jpg", irunold, side); - c2->SaveAs(out_file); - - nzone = 0; - for (int ij = nmn; ij < nmx; ij++) { - c2->cd(nzone + 1); - peak_eta[ij]->GetXaxis()->SetTitle("#phi index"); - peak_eta[ij]->GetXaxis()->SetTitleSize(.08); - peak_eta[ij]->GetXaxis()->CenterTitle(); - peak_eta[ij]->GetXaxis()->SetTitleOffset(0.90); - peak_eta[ij]->GetXaxis()->SetLabelSize(.08); - peak_eta[ij]->GetXaxis()->SetLabelOffset(.01); - - peak_eta[ij]->GetYaxis()->SetLabelSize(.08); - peak_eta[ij]->GetYaxis()->SetLabelOffset(.01); - peak_eta[ij]->GetYaxis()->SetTitle("GeV"); - - peak_eta[ij]->GetYaxis()->SetTitleSize(.085); - peak_eta[ij]->GetYaxis()->CenterTitle(); - peak_eta[ij]->GetYaxis()->SetTitleOffset(1.3); - - peak_eta[ij]->SetMarkerSize(0.60); - peak_eta[ij]->SetMarkerColor(2); - peak_eta[ij]->SetMarkerStyle(20); - - peak_eta[ij]->Draw(); - nzone++; - } - - sprintf(out_file, "peakho_%i_side%i.eps", irunold, side); - c2->SaveAs(out_file); - - sprintf(out_file, "peakho_%i_side%i.jpg", irunold, side); - c2->SaveAs(out_file); - } - delete c2; - - // if (m_combined) { - gStyle->SetTitleFontSize(0.045); - gStyle->SetPadRightMargin(0.13); - gStyle->SetPadBottomMargin(0.15); - gStyle->SetPadLeftMargin(0.1); - gStyle->SetOptStat(0); - xsiz = 700; - ysiz = 600; - TCanvas* c1 = new TCanvas("c1", "Fitted const in each tower", xsiz, ysiz); - const_eta_phi->GetXaxis()->SetTitle("#eta"); - const_eta_phi->GetXaxis()->SetTitleSize(0.065); - const_eta_phi->GetXaxis()->SetTitleOffset(0.85); //6); - const_eta_phi->GetXaxis()->CenterTitle(); - const_eta_phi->GetXaxis()->SetLabelSize(0.045); - const_eta_phi->GetXaxis()->SetLabelOffset(0.01); - - const_eta_phi->GetYaxis()->SetTitle("#phi"); - const_eta_phi->GetYaxis()->SetTitleSize(0.075); - const_eta_phi->GetYaxis()->SetTitleOffset(0.5); - const_eta_phi->GetYaxis()->CenterTitle(); - const_eta_phi->GetYaxis()->SetLabelSize(0.045); - const_eta_phi->GetYaxis()->SetLabelOffset(0.01); - - const_eta_phi->Draw("colz"); - sprintf(out_file, "high_hoconst_eta_phi_%i.jpg", irunold); - c1->SaveAs(out_file); - - delete c1; - - for (int jk = 0; jk < netamx; jk++) { - int ieta = (jk < 15) ? jk + 1 : 14 - jk; - if (rms_phi[jk] > 0) { - mean_phi_ave->Fill(ieta, mean_phi[jk] / rms_phi[jk]); - mean_phi_ave->SetBinError(mean_phi_ave->FindBin(ieta), pow(double(rms_phi[jk]), -0.5)); - } - } - - for (int ij = 0; ij < nphimx; ij++) { - if (rms_eta[ij] > 0) { - mean_eta_ave->Fill(ij + 1, mean_eta[ij] / rms_eta[ij]); - mean_eta_ave->SetBinError(mean_eta_ave->FindBin(ij + 1), pow(double(rms_eta[ij]), -0.5)); - } - } - - ysiz = 450; - gStyle->SetPadLeftMargin(0.13); - gStyle->SetPadRightMargin(0.03); - - TCanvas* c2y = new TCanvas("c2", "Avearge signal in eta and phi", xsiz, ysiz); - c2y->Divide(2, 1); - mean_eta_ave->GetXaxis()->SetTitle("#phi"); - mean_eta_ave->GetXaxis()->SetTitleSize(0.085); - mean_eta_ave->GetXaxis()->SetTitleOffset(0.65); - mean_eta_ave->GetXaxis()->CenterTitle(); - mean_eta_ave->GetXaxis()->SetLabelSize(0.05); - mean_eta_ave->GetXaxis()->SetLabelOffset(0.001); - - mean_eta_ave->GetYaxis()->SetTitle("Signal (GeV)/MIP"); - mean_eta_ave->GetYaxis()->SetTitleSize(0.055); - mean_eta_ave->GetYaxis()->SetTitleOffset(1.3); - mean_eta_ave->GetYaxis()->CenterTitle(); - mean_eta_ave->GetYaxis()->SetLabelSize(0.045); - mean_eta_ave->GetYaxis()->SetLabelOffset(0.01); - mean_eta_ave->SetMarkerSize(0.60); - mean_eta_ave->SetMarkerColor(2); - mean_eta_ave->SetMarkerStyle(20); - - c2y->cd(1); - mean_eta_ave->Draw(); - - mean_phi_ave->GetXaxis()->SetTitle("#eta"); - mean_phi_ave->GetXaxis()->SetTitleSize(0.085); - mean_phi_ave->GetXaxis()->SetTitleOffset(0.65); //55); - mean_phi_ave->GetXaxis()->CenterTitle(); - mean_phi_ave->GetXaxis()->SetLabelSize(0.05); - mean_phi_ave->GetXaxis()->SetLabelOffset(0.001); - - mean_phi_ave->GetYaxis()->SetTitle("Signal (GeV)/MIP"); - mean_phi_ave->GetYaxis()->SetTitleSize(0.055); - mean_phi_ave->GetYaxis()->SetTitleOffset(1.3); - mean_phi_ave->GetYaxis()->CenterTitle(); - mean_phi_ave->GetYaxis()->SetLabelSize(0.045); - mean_phi_ave->GetYaxis()->SetLabelOffset(0.01); - mean_phi_ave->SetMarkerSize(0.60); - mean_phi_ave->SetMarkerColor(2); - mean_phi_ave->SetMarkerStyle(20); - - c2y->cd(2); - mean_phi_ave->Draw(); - - sprintf(out_file, "high_hoaverage_eta_phi_%i.jpg", irunold); - c2y->SaveAs(out_file); - - delete c2y; - // } else { //m_combined - - xsiz = 800; - ysiz = 450; - TCanvas* c3 = new TCanvas("c3", "Avearge signal in eta and phi", xsiz, ysiz); - c3->Divide(2, 1); - mean_phi_hst->GetXaxis()->SetTitle("#eta"); - mean_phi_hst->GetXaxis()->SetTitleSize(0.065); - mean_phi_hst->GetXaxis()->SetTitleOffset(0.9); - mean_phi_hst->GetXaxis()->CenterTitle(); - mean_phi_hst->GetXaxis()->SetLabelSize(0.065); - mean_phi_hst->GetXaxis()->SetLabelOffset(0.001); - - mean_phi_hst->GetYaxis()->SetTitle("GeV/MIP"); - mean_phi_hst->GetYaxis()->SetTitleSize(0.055); - mean_phi_hst->GetYaxis()->SetTitleOffset(0.9); - mean_phi_hst->GetYaxis()->CenterTitle(); - mean_phi_hst->GetYaxis()->SetLabelSize(0.065); - mean_phi_hst->GetYaxis()->SetLabelOffset(0.01); - - mean_phi_hst->SetMarkerColor(4); - mean_phi_hst->SetMarkerSize(0.8); - mean_phi_hst->SetMarkerStyle(20); - mean_phi_hst->Draw(); - - sprintf(out_file, "low_mean_phi_hst_%i.jpg", irunold); - c3->SaveAs(out_file); - - delete c3; - - // } //m_combined - - gStyle->SetOptLogy(1); - gStyle->SetPadTopMargin(.1); - gStyle->SetPadLeftMargin(.15); - xsiz = 800; - ysiz = 500; - TCanvas* c0x = new TCanvas("c0x", "Signal in each ring", xsiz, ysiz); - - c0x->Divide(3, 2); - for (int ij = 0; ij < ringmx; ij++) { - int iread = (ij == 2) ? routmx : rout12mx; - com_sigrsg[ij][iread]->GetXaxis()->SetTitle("Signal/ped (GeV)"); - - com_sigrsg[ij][iread]->GetXaxis()->SetTitleSize(0.060); - com_sigrsg[ij][iread]->GetXaxis()->SetTitleOffset(1.05); - com_sigrsg[ij][iread]->GetXaxis()->CenterTitle(); - com_sigrsg[ij][iread]->GetXaxis()->SetLabelSize(0.065); - com_sigrsg[ij][iread]->GetXaxis()->SetLabelOffset(0.01); - - com_sigrsg[ij][iread]->GetYaxis()->SetLabelSize(0.065); - com_sigrsg[ij][iread]->GetYaxis()->SetLabelOffset(0.01); - - com_sigrsg[ij][iread]->SetLineWidth(3); - com_sigrsg[ij][iread]->SetLineColor(4); - - c0x->cd(ij + 1); - com_sigrsg[ij][iread]->Draw(); - - com_crossg[ij][iread]->SetLineWidth(2); - com_crossg[ij][iread]->SetLineColor(2); - com_crossg[ij][iread]->Draw("same"); - } - sprintf(out_file, "hosig_ring_%i.jpg", irunold); - c0x->SaveAs(out_file); - delete c0x; - - gStyle->SetTitleFontSize(0.06); - gStyle->SetOptStat(0); - gStyle->SetOptLogy(0); - - TCanvas* c0 = new TCanvas("c0", "Signal in each ring", xsiz, ysiz); - - c0->Divide(3, 2); - for (int jk = 0; jk < ringmx; jk++) { - peak_hpdrm[jk]->GetXaxis()->SetTitle("RM #"); - peak_hpdrm[jk]->GetXaxis()->SetTitleSize(0.070); - peak_hpdrm[jk]->GetXaxis()->SetTitleOffset(1.0); - peak_hpdrm[jk]->GetXaxis()->CenterTitle(); - peak_hpdrm[jk]->GetXaxis()->SetLabelSize(0.065); - peak_hpdrm[jk]->GetXaxis()->SetLabelOffset(0.01); - - peak_hpdrm[jk]->GetYaxis()->SetTitle("Peak(GeV)/MIP"); - - peak_hpdrm[jk]->GetYaxis()->SetTitleSize(0.07); - peak_hpdrm[jk]->GetYaxis()->SetTitleOffset(1.3); - peak_hpdrm[jk]->GetYaxis()->CenterTitle(); - peak_hpdrm[jk]->GetYaxis()->SetLabelSize(0.065); - peak_hpdrm[jk]->GetYaxis()->SetLabelOffset(0.01); - peak_hpdrm[jk]->SetMarkerSize(0.60); - peak_hpdrm[jk]->SetMarkerColor(2); - peak_hpdrm[jk]->SetMarkerStyle(20); - - c0->cd(jk + 1); - peak_hpdrm[jk]->Draw(); - } - sprintf(out_file, "comb_peak_hpdrm_%i.jpg", irunold); - c0->SaveAs(out_file); - - delete c0; - - TCanvas* c1y = new TCanvas("c1y", "Signal in each ring", xsiz, ysiz); - - c1y->Divide(3, 2); - for (int jk = 0; jk < ringmx; jk++) { - const_hpdrm[jk]->GetXaxis()->SetTitle("RM #"); - const_hpdrm[jk]->GetXaxis()->SetTitleSize(0.070); - const_hpdrm[jk]->GetXaxis()->SetTitleOffset(1.3); - const_hpdrm[jk]->GetXaxis()->CenterTitle(); - const_hpdrm[jk]->GetXaxis()->SetLabelSize(0.065); - const_hpdrm[jk]->GetXaxis()->SetLabelOffset(0.01); - - const_hpdrm[jk]->GetYaxis()->SetTitle("Peak(GeV)"); - const_hpdrm[jk]->GetYaxis()->SetTitleSize(0.065); - const_hpdrm[jk]->GetYaxis()->SetTitleOffset(1.0); - const_hpdrm[jk]->GetYaxis()->CenterTitle(); - const_hpdrm[jk]->GetYaxis()->SetLabelSize(0.065); - const_hpdrm[jk]->GetYaxis()->SetLabelOffset(0.01); - const_hpdrm[jk]->SetMarkerSize(0.60); - const_hpdrm[jk]->SetMarkerColor(2); - const_hpdrm[jk]->SetMarkerStyle(20); - - c1y->cd(jk + 1); - const_hpdrm[jk]->Draw(); - } - - sprintf(out_file, "comb_const_hpdrm_%i.jpg", irunold); - c1y->SaveAs(out_file); - - delete c1y; - } - - } // if (m_constant){ - - if (m_figure) { - for (int ij = 0; ij < nphimx; ij++) { - for (int jk = 0; jk < netamx; jk++) { - stat_eta[jk]->Fill(ij + 1, sigrsg[jk][ij]->GetEntries()); - statmn_eta[jk]->Fill(ij + 1, sigrsg[jk][ij]->GetMean()); - } - } - - xsiz = 700; - ysiz = 450; - gStyle->SetTitleFontSize(0.09); - gStyle->SetPadBottomMargin(0.14); - gStyle->SetPadLeftMargin(0.17); - gStyle->SetPadRightMargin(0.01); - gStyle->SetNdivisions(303, "XY"); - gStyle->SetOptLogy(1); - - TCanvas* c2x = new TCanvas("c2x", "runfile", xsiz, ysiz); - c2x->Divide(5, 3); - for (int side = 0; side < 2; side++) { - int nmn = 0; - int nmx = netamx / 2; - if (side == 1) { - nmn = netamx / 2; - nmx = netamx; - } - int nzone = 0; - char name[200]; - - for (int ij = nmn; ij < nmx; ij++) { - int ieta = (ij < 15) ? ij + 1 : 14 - ij; - c2x->cd(nzone + 1); - sprintf(name, "GeV(#eta=%i)", ieta); - sigrsg[ij][nphimx]->GetXaxis()->SetTitle(name); - sigrsg[ij][nphimx]->GetXaxis()->SetTitleSize(.08); - sigrsg[ij][nphimx]->GetXaxis()->CenterTitle(); - sigrsg[ij][nphimx]->GetXaxis()->SetTitleOffset(0.90); - sigrsg[ij][nphimx]->GetXaxis()->SetLabelSize(.08); - sigrsg[ij][nphimx]->GetXaxis()->SetLabelOffset(.01); - - sigrsg[ij][nphimx]->GetYaxis()->SetLabelSize(.08); - sigrsg[ij][nphimx]->GetYaxis()->SetLabelOffset(.01); - sigrsg[ij][nphimx]->SetLineWidth(2); - sigrsg[ij][nphimx]->SetLineColor(4); - sigrsg[ij][nphimx]->Draw(); - crossg[ij][nphimx]->SetLineWidth(2); - crossg[ij][nphimx]->SetLineColor(2); - crossg[ij][nphimx]->Draw("same"); - nzone++; - } - - sprintf(out_file, "sig_ho_%i_side%i.eps", irunold, side); - c2x->SaveAs(out_file); - - sprintf(out_file, "sig_ho_%i_side%i.jpg", irunold, side); - c2x->SaveAs(out_file); - } - - gStyle->SetOptLogy(0); - c2x = new TCanvas("c2x", "runfile", xsiz, ysiz); - c2x->Divide(5, 3); - for (int side = 0; side < 2; side++) { - int nmn = 0; - int nmx = netamx / 2; - if (side == 1) { - nmn = netamx / 2; - nmx = netamx; - } - int nzone = 0; - - nzone = 0; - for (int ij = nmn; ij < nmx; ij++) { - c2x->cd(nzone + 1); - statmn_eta[ij]->SetLineWidth(2); - statmn_eta[ij]->SetLineColor(4); - statmn_eta[ij]->GetXaxis()->SetTitle("#phi index"); - statmn_eta[ij]->GetXaxis()->SetTitleSize(.08); - statmn_eta[ij]->GetXaxis()->CenterTitle(); - statmn_eta[ij]->GetXaxis()->SetTitleOffset(0.9); - statmn_eta[ij]->GetYaxis()->SetLabelSize(.08); - statmn_eta[ij]->GetYaxis()->SetLabelOffset(.01); - statmn_eta[ij]->GetXaxis()->SetLabelSize(.08); - statmn_eta[ij]->GetXaxis()->SetLabelOffset(.01); - statmn_eta[ij]->GetYaxis()->SetTitle("GeV"); - statmn_eta[ij]->GetYaxis()->SetTitleSize(.075); - statmn_eta[ij]->GetYaxis()->CenterTitle(); - statmn_eta[ij]->GetYaxis()->SetTitleOffset(1.30); - - statmn_eta[ij]->Draw(); - nzone++; - } - - sprintf(out_file, "statmnho_%i_side%i.eps", irunold, side); - c2x->SaveAs(out_file); - - sprintf(out_file, "statmnho_%i_side%i.jpg", irunold, side); - c2x->SaveAs(out_file); - - gStyle->SetOptLogy(1); - gStyle->SetNdivisions(203, "XY"); - - nzone = 0; - for (int ij = nmn; ij < nmx; ij++) { - c2x->cd(nzone + 1); - stat_eta[ij]->SetLineWidth(2); - stat_eta[ij]->SetLineColor(4); - stat_eta[ij]->GetXaxis()->SetTitle("#phi index"); - stat_eta[ij]->GetXaxis()->SetTitleSize(.08); - stat_eta[ij]->GetXaxis()->CenterTitle(); - stat_eta[ij]->GetXaxis()->SetTitleOffset(0.80); - stat_eta[ij]->GetXaxis()->SetLabelSize(.08); - stat_eta[ij]->GetXaxis()->SetLabelOffset(.01); - stat_eta[ij]->GetYaxis()->SetLabelSize(.08); - stat_eta[ij]->GetYaxis()->SetLabelOffset(.01); - - stat_eta[ij]->Draw(); - nzone++; - } - - sprintf(out_file, "statho_%i_side%i.eps", irunold, side); - c2x->SaveAs(out_file); - - sprintf(out_file, "statho_%i_side%i.jpg", irunold, side); - c2x->SaveAs(out_file); - } - delete c2x; - - } //if (m_figure) { - - if (!m_constant) { //m_constant - for (int jk = 0; jk < netamx; jk++) { - for (int ij = 0; ij < nphimx; ij++) { - if (crossg[jk][ij]) { - delete crossg[jk][ij]; - } - if (sigrsg[jk][ij]) { - delete sigrsg[jk][ij]; - } - } - } - } + } //if (isCosMu) } //define this as a plug-in diff --git a/Calibration/HcalCalibAlgos/plugins/HcalCalibrator.cc b/Calibration/HcalCalibAlgos/plugins/HcalCalibrator.cc index fe1556c135f89..70775cffe4496 100644 --- a/Calibration/HcalCalibAlgos/plugins/HcalCalibrator.cc +++ b/Calibration/HcalCalibAlgos/plugins/HcalCalibrator.cc @@ -27,30 +27,85 @@ to the actual calibration code in "endJob()". #include #include #include +#include // user include files -#include "Calibration/HcalCalibAlgos/plugins/HcalCalibrator.h" #include "Calibration/HcalCalibAlgos/interface/hcalCalib.h" +#include "DataFormats/Common/interface/Handle.h" -#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "FWCore/Framework/interface/Event.h" - -#include "FWCore/Framework/interface/MakerMacros.h" -#include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" - -//-------------- #include "FWCore/Framework/interface/EventSetup.h" - +#include "FWCore/Framework/interface/Frameworkfwd.h" #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/ServiceRegistry/interface/Service.h" -#include "DataFormats/Common/interface/Handle.h" - -#include "TFile.h" +#include "Geometry/CaloTopology/interface/HcalTopology.h" +#include "Geometry/CaloGeometry/interface/CaloGeometry.h" +#include "Geometry/Records/interface/CaloGeometryRecord.h" +#include "Geometry/Records/interface/HcalRecNumberingRecord.h" + +class HcalCalibrator : public edm::one::EDAnalyzer<> { +public: + explicit HcalCalibrator(const edm::ParameterSet&); + ~HcalCalibrator() override; + + // Added for running the CaloTower creation algorithm + +private: + void beginJob() override; + void analyze(const edm::Event&, const edm::EventSetup&) override; + void endJob() override; + + std::string mOutputFile; + std::string mInputFileList; + + std::string mCalibType; + std::string mCalibMethod; + double mMinTargetE; + double mMaxTargetE; + double mMinCellE; + double mMinEOverP; + double mMaxEOverP; + double mMaxTrkEmE; + + double mMaxEtThirdJet; + double mMinDPhiDiJets; + bool mSumDepths; + bool mSumSmallDepths; + bool mCombinePhi; + int mHbClusterSize; + int mHeClusterSize; + + bool mUseConeClustering; + double mMaxConeDist; + + int mCalibAbsIEtaMax; + int mCalibAbsIEtaMin; + + double mMaxProbeJetEmFrac; + double mMaxTagJetEmFrac; + double mMaxTagJetAbsEta; + double mMinTagJetEt; + double mMinProbeJetAbsEta; + + std::string mPhiSymCorFileName; + bool mApplyPhiSymCorFlag; + + std::string mOutputCorCoefFileName; + std::string mHistoFileName; + + edm::ESGetToken tok_geom_; + edm::ESGetToken tok_htopo_; + + const CaloGeometry* mTheCaloGeometry; + const HcalTopology* mTheHcalTopology; + + bool allowMissingInputs_; +}; // constructor diff --git a/Calibration/HcalCalibAlgos/plugins/HcalCalibrator.h b/Calibration/HcalCalibAlgos/plugins/HcalCalibrator.h deleted file mode 100644 index 103ced9f6174a..0000000000000 --- a/Calibration/HcalCalibAlgos/plugins/HcalCalibrator.h +++ /dev/null @@ -1,83 +0,0 @@ -#ifndef HCALCALIBRATOR_H -#define HCALCALIBRATOR_H - -#include - -#include "FWCore/Framework/interface/EDAnalyzer.h" -#include "Geometry/CaloTopology/interface/HcalTopology.h" - -//------------------- -#include "TString.h" -#include "TFile.h" -#include "TTree.h" -#include "TObject.h" -#include "TObjArray.h" -#include "TClonesArray.h" -#include "TRefArray.h" -#include "TLorentzVector.h" -//--------------------- - -#include "Geometry/CaloGeometry/interface/CaloGeometry.h" -#include "Geometry/Records/interface/CaloGeometryRecord.h" -#include "Geometry/Records/interface/HcalRecNumberingRecord.h" - -class HcalCalibrator : public edm::EDAnalyzer { -public: - explicit HcalCalibrator(const edm::ParameterSet&); - ~HcalCalibrator() override; - - // Added for running the CaloTower creation algorithm - -private: - void beginJob() override; - void analyze(const edm::Event&, const edm::EventSetup&) override; - void endJob() override; - - std::string mOutputFile; - std::string mInputFileList; - - std::string mCalibType; - std::string mCalibMethod; - double mMinTargetE; - double mMaxTargetE; - double mMinCellE; - double mMinEOverP; - double mMaxEOverP; - double mMaxTrkEmE; - - double mMaxEtThirdJet; - double mMinDPhiDiJets; - bool mSumDepths; - bool mSumSmallDepths; - bool mCombinePhi; - int mHbClusterSize; - int mHeClusterSize; - - bool mUseConeClustering; - double mMaxConeDist; - - int mCalibAbsIEtaMax; - int mCalibAbsIEtaMin; - - double mMaxProbeJetEmFrac; - double mMaxTagJetEmFrac; - double mMaxTagJetAbsEta; - double mMinTagJetEt; - double mMinProbeJetAbsEta; - - std::string mPhiSymCorFileName; - bool mApplyPhiSymCorFlag; - - std::string mOutputCorCoefFileName; - std::string mHistoFileName; - - edm::ESGetToken tok_geom_; - edm::ESGetToken tok_htopo_; - - const CaloGeometry* mTheCaloGeometry; - const HcalTopology* mTheHcalTopology; - - bool allowMissingInputs_; -}; - -#endif diff --git a/Calibration/HcalCalibAlgos/plugins/HcalHBHEMuonAnalyzer.cc b/Calibration/HcalCalibAlgos/plugins/HcalHBHEMuonAnalyzer.cc index c67a36cab4b87..6c16fb5dd00b8 100644 --- a/Calibration/HcalCalibAlgos/plugins/HcalHBHEMuonAnalyzer.cc +++ b/Calibration/HcalCalibAlgos/plugins/HcalHBHEMuonAnalyzer.cc @@ -810,9 +810,9 @@ void HcalHBHEMuonAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSet } if (accept) { #ifdef EDM_ML_DEBUG - for (unsigned int i = 0; i < hcal_ieta_.size(); ++i) + for (unsigned int i = 0; i < hcal_ieta.size(); ++i) edm::LogVerbatim("HBHEMuon") << "[" << i << "] ieta/iphi for entry to " - << "HCAL has value of " << hcal_ieta_[i] << ":" << hcal_iphi_[i]; + << "HCAL has value of " << hcal_ieta[i] << ":" << hcal_iphi[i]; #endif for (unsigned int k = 0; k < muon_is_good.size(); ++k) { muon_is_good_ = muon_is_good[k]; diff --git a/Calibration/HcalCalibAlgos/plugins/HcalHBHENewMuonAnalyzer.cc b/Calibration/HcalCalibAlgos/plugins/HcalHBHENewMuonAnalyzer.cc new file mode 100644 index 0000000000000..d33138fef9d4a --- /dev/null +++ b/Calibration/HcalCalibAlgos/plugins/HcalHBHENewMuonAnalyzer.cc @@ -0,0 +1,330 @@ +#include +#include +#include +#include +#include +#include +#include "TPRegexp.h" + +// user include files +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" +#include "FWCore/ServiceRegistry/interface/Service.h" +#include "FWCore/Common/interface/TriggerNames.h" +#include "CommonTools/UtilAlgos/interface/TFileService.h" + +#include "DataFormats/HcalCalibObjects/interface/HcalHBHEMuonVariables.h" + +#define EDM_ML_DEBUG + +class HcalHBHENewMuonAnalyzer : public edm::one::EDAnalyzer { +public: + explicit HcalHBHENewMuonAnalyzer(const edm::ParameterSet&); + ~HcalHBHENewMuonAnalyzer() override = default; + + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + +private: + void beginJob() override; + void analyze(edm::Event const&, edm::EventSetup const&) override; + + // ----------member data --------------------------- + edm::Service fs; + const edm::InputTag labelHBHEMuonVar_; + const int useRaw_; + int maxDepth_, kount_; + + const edm::EDGetTokenT tokHBHEMuonVar_; + + ////////////////////////////////////////////////////// + static const int depthMax_ = 7; + TTree* tree_; + unsigned int runNumber_, eventNumber_, lumiNumber_, bxNumber_; + unsigned int goodVertex_; + bool muon_is_good_, muon_global_, muon_tracker_; + bool muon_is_tight_, muon_is_medium_; + double ptGlob_, etaGlob_, phiGlob_, energyMuon_, pMuon_; + float muon_trkKink_, muon_chi2LocalPosition_, muon_segComp_; + int trackerLayer_, numPixelLayers_, tight_PixelHits_; + bool innerTrack_, outerTrack_, globalTrack_; + double chiTracker_, dxyTracker_, dzTracker_; + double innerTrackpt_, innerTracketa_, innerTrackphi_; + double tight_validFraction_, outerTrackChi_; + double outerTrackPt_, outerTrackEta_, outerTrackPhi_; + int outerTrackHits_, outerTrackRHits_; + double globalTrckPt_, globalTrckEta_, globalTrckPhi_; + int globalMuonHits_, matchedStat_; + double chiGlobal_, tight_LongPara_, tight_TransImpara_; + double isolationR04_, isolationR03_; + double ecalEnergy_, hcalEnergy_, hoEnergy_; + bool matchedId_, hcalHot_; + double ecal3x3Energy_, hcal1x1Energy_; + unsigned int ecalDetId_, hcalDetId_, ehcalDetId_; + int hcal_ieta_, hcal_iphi_; + double hcalDepthEnergy_[depthMax_]; + double hcalDepthActiveLength_[depthMax_]; + double hcalDepthEnergyHot_[depthMax_]; + double hcalDepthActiveLengthHot_[depthMax_]; + double hcalDepthChargeHot_[depthMax_]; + double hcalDepthChargeHotBG_[depthMax_]; + double hcalDepthEnergyCorr_[depthMax_]; + double hcalDepthEnergyHotCorr_[depthMax_]; + bool hcalDepthMatch_[depthMax_]; + bool hcalDepthMatchHot_[depthMax_]; + double hcalActiveLength_, hcalActiveLengthHot_; + std::vector all_triggers_; + std::vector hltresults_; + //////////////////////////////////////////////////////////// +}; + +HcalHBHENewMuonAnalyzer::HcalHBHENewMuonAnalyzer(const edm::ParameterSet& iConfig) + : labelHBHEMuonVar_(iConfig.getParameter("hbheMuonLabel")), + useRaw_(iConfig.getParameter("useRaw")), + tokHBHEMuonVar_(consumes(labelHBHEMuonVar_)) { + usesResource(TFileService::kSharedResource); + //now do what ever initialization is needed + kount_ = 0; + maxDepth_ = iConfig.getUntrackedParameter("maxDepth", 4); + if (maxDepth_ > depthMax_) + maxDepth_ = depthMax_; + else if (maxDepth_ < 1) + maxDepth_ = 4; + + edm::LogVerbatim("HBHEMuon") << "Parameters read from config file \n\t maxDepth__ " << maxDepth_ << "\n\t Labels " + << labelHBHEMuonVar_; +} + +// +// member functions +// + +// ------------ method called for each event ------------ +void HcalHBHENewMuonAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { + ++kount_; + runNumber_ = iEvent.id().run(); + eventNumber_ = iEvent.id().event(); + lumiNumber_ = iEvent.id().luminosityBlock(); + bxNumber_ = iEvent.bunchCrossing(); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("HBHEMuon") << "Run " << runNumber_ << " Event " << eventNumber_ << " Lumi " << lumiNumber_ << " BX " + << bxNumber_ << std::endl; +#endif + + auto const& hbheMuonColl = iEvent.getHandle(tokHBHEMuonVar_); + if (hbheMuonColl.isValid()) { + auto hbheMuon = hbheMuonColl.product(); + for (auto itr = hbheMuon->begin(); itr != hbheMuon->end(); ++itr) { + goodVertex_ = itr->goodVertex_; + muon_is_good_ = itr->muonGood_; + muon_global_ = itr->muonGlobal_; + muon_tracker_ = itr->muonTracker_; + muon_is_tight_ = itr->muonTight_; + muon_is_medium_ = itr->muonMedium_; + ptGlob_ = itr->ptGlob_; + etaGlob_ = itr->etaGlob_; + phiGlob_ = itr->phiGlob_; + energyMuon_ = itr->energyMuon_; + pMuon_ = itr->pMuon_; + muon_trkKink_ = itr->muonTrkKink_; + muon_chi2LocalPosition_ = itr->muonChi2LocalPosition_; + muon_segComp_ = itr->muonSegComp_; + trackerLayer_ = itr->trackerLayer_; + numPixelLayers_ = itr->numPixelLayers_; + tight_PixelHits_ = itr->tightPixelHits_; + innerTrack_ = itr->innerTrack_; + outerTrack_ = itr->outerTrack_; + globalTrack_ = itr->globalTrack_; + chiTracker_ = itr->chiTracker_; + dxyTracker_ = itr->dxyTracker_; + dzTracker_ = itr->dzTracker_; + innerTrackpt_ = itr->innerTrackPt_; + innerTracketa_ = itr->innerTrackEta_; + innerTrackphi_ = itr->innerTrackPhi_; + tight_validFraction_ = itr->tightValidFraction_; + outerTrackChi_ = itr->outerTrackChi_; + outerTrackPt_ = itr->outerTrackPt_; + outerTrackEta_ = itr->outerTrackEta_; + outerTrackPhi_ = itr->outerTrackPhi_; + outerTrackHits_ = itr->outerTrackHits_; + outerTrackRHits_ = itr->outerTrackRHits_; + globalTrckPt_ = itr->globalTrackPt_; + globalTrckEta_ = itr->globalTrackEta_; + globalTrckPhi_ = itr->globalTrackPhi_; + globalMuonHits_ = itr->globalMuonHits_; + matchedStat_ = itr->matchedStat_; + chiGlobal_ = itr->chiGlobal_; + tight_LongPara_ = itr->tightLongPara_; + tight_TransImpara_ = itr->tightTransImpara_; + isolationR04_ = itr->isolationR04_; + isolationR03_ = itr->isolationR03_; + ecalEnergy_ = itr->ecalEnergy_; + hcalEnergy_ = itr->hcalEnergy_; + hoEnergy_ = itr->hoEnergy_; + matchedId_ = itr->matchedId_; + hcalHot_ = itr->hcalHot_; + ecal3x3Energy_ = itr->ecal3x3Energy_; + ecalDetId_ = itr->ecalDetId_; + hcalDetId_ = itr->hcalDetId_; + ehcalDetId_ = itr->ehcalDetId_; + hcal_ieta_ = itr->hcalIeta_; + hcal_iphi_ = itr->hcalIphi_; + if (useRaw_ == 1) + hcal1x1Energy_ = itr->hcal1x1EnergyAux_; + else if (useRaw_ == 2) + hcal1x1Energy_ = itr->hcal1x1EnergyRaw_; + else + hcal1x1Energy_ = itr->hcal1x1Energy_; + for (unsigned int i = 0; i < itr->hcalDepthEnergy_.size(); ++i) { + hcalDepthActiveLength_[i] = itr->hcalDepthActiveLength_[i]; + hcalDepthActiveLengthHot_[i] = itr->hcalDepthActiveLengthHot_[i]; + if (useRaw_ == 1) { + hcalDepthEnergy_[i] = itr->hcalDepthEnergyAux_[i]; + hcalDepthEnergyHot_[i] = itr->hcalDepthEnergyHotAux_[i]; + hcalDepthEnergyCorr_[i] = itr->hcalDepthEnergyCorrAux_[i]; + hcalDepthEnergyHotCorr_[i] = itr->hcalDepthEnergyHotCorrAux_[i]; + hcalDepthChargeHot_[i] = itr->hcalDepthChargeHotAux_[i]; + hcalDepthChargeHotBG_[i] = itr->hcalDepthChargeHotBGAux_[i]; + } else if (useRaw_ == 2) { + hcalDepthEnergy_[i] = itr->hcalDepthEnergyRaw_[i]; + hcalDepthEnergyHot_[i] = itr->hcalDepthEnergyHotRaw_[i]; + hcalDepthEnergyCorr_[i] = itr->hcalDepthEnergyCorrRaw_[i]; + hcalDepthEnergyHotCorr_[i] = itr->hcalDepthEnergyHotCorrRaw_[i]; + hcalDepthChargeHot_[i] = itr->hcalDepthChargeHotRaw_[i]; + hcalDepthChargeHotBG_[i] = itr->hcalDepthChargeHotBGRaw_[i]; + } else { + hcalDepthEnergy_[i] = itr->hcalDepthEnergy_[i]; + hcalDepthEnergyHot_[i] = itr->hcalDepthEnergyHot_[i]; + hcalDepthEnergyCorr_[i] = itr->hcalDepthEnergyCorr_[i]; + hcalDepthEnergyHotCorr_[i] = itr->hcalDepthEnergyHotCorr_[i]; + hcalDepthChargeHot_[i] = itr->hcalDepthChargeHot_[i]; + hcalDepthChargeHotBG_[i] = itr->hcalDepthChargeHotBG_[i]; + } + hcalDepthMatch_[i] = itr->hcalDepthMatch_[i]; + hcalDepthMatchHot_[i] = itr->hcalDepthMatchHot_[i]; + } + hcalActiveLength_ = itr->hcalActiveLength_; + hcalActiveLengthHot_ = itr->hcalActiveLengthHot_; + all_triggers_ = itr->allTriggers_; + hltresults_ = itr->hltResults_; + tree_->Fill(); + } + } +} + +// ------------ method called once each job just before starting event loop ------------ +void HcalHBHENewMuonAnalyzer::beginJob() { + tree_ = fs->make("TREE", "TREE"); + tree_->Branch("Event_No", &eventNumber_); + tree_->Branch("Run_No", &runNumber_); + tree_->Branch("LumiNumber", &lumiNumber_); + tree_->Branch("BXNumber", &bxNumber_); + tree_->Branch("GoodVertex", &goodVertex_); + tree_->Branch("PF_Muon", &muon_is_good_); + tree_->Branch("Global_Muon", &muon_global_); + tree_->Branch("Tracker_muon", &muon_tracker_); + tree_->Branch("MuonIsTight", &muon_is_tight_); + tree_->Branch("MuonIsMedium", &muon_is_medium_); + tree_->Branch("pt_of_muon", &ptGlob_); + tree_->Branch("eta_of_muon", &etaGlob_); + tree_->Branch("phi_of_muon", &phiGlob_); + tree_->Branch("energy_of_muon", &energyMuon_); + tree_->Branch("p_of_muon", &pMuon_); + tree_->Branch("muon_trkKink", &muon_trkKink_); + tree_->Branch("muon_chi2LocalPosition", &muon_chi2LocalPosition_); + tree_->Branch("muon_segComp", &muon_segComp_); + + tree_->Branch("TrackerLayer", &trackerLayer_); + tree_->Branch("NumPixelLayers", &numPixelLayers_); + tree_->Branch("InnerTrackPixelHits", &tight_PixelHits_); + tree_->Branch("innerTrack", &innerTrack_); + tree_->Branch("chiTracker", &chiTracker_); + tree_->Branch("DxyTracker", &dxyTracker_); + tree_->Branch("DzTracker", &dzTracker_); + tree_->Branch("innerTrackpt", &innerTrackpt_); + tree_->Branch("innerTracketa", &innerTracketa_); + tree_->Branch("innerTrackphi", &innerTrackphi_); + tree_->Branch("tight_validFraction", &tight_validFraction_); + + tree_->Branch("OuterTrack", &outerTrack_); + tree_->Branch("OuterTrackChi", &outerTrackChi_); + tree_->Branch("OuterTrackPt", &outerTrackPt_); + tree_->Branch("OuterTrackEta", &outerTrackEta_); + tree_->Branch("OuterTrackPhi", &outerTrackPhi_); + tree_->Branch("OuterTrackHits", &outerTrackHits_); + tree_->Branch("OuterTrackRHits", &outerTrackRHits_); + + tree_->Branch("GlobalTrack", &globalTrack_); + tree_->Branch("GlobalTrckPt", &globalTrckPt_); + tree_->Branch("GlobalTrckEta", &globalTrckEta_); + tree_->Branch("GlobalTrckPhi", &globalTrckPhi_); + tree_->Branch("Global_Muon_Hits", &globalMuonHits_); + tree_->Branch("MatchedStations", &matchedStat_); + tree_->Branch("GlobTrack_Chi", &chiGlobal_); + tree_->Branch("Tight_LongitudinalImpactparameter", &tight_LongPara_); + tree_->Branch("Tight_TransImpactparameter", &tight_TransImpara_); + + tree_->Branch("IsolationR04", &isolationR04_); + tree_->Branch("IsolationR03", &isolationR03_); + tree_->Branch("ecal_3into3", &ecalEnergy_); + tree_->Branch("hcal_3into3", &hcalEnergy_); + tree_->Branch("tracker_3into3", &hoEnergy_); + + tree_->Branch("matchedId", &matchedId_); + tree_->Branch("hcal_cellHot", &hcalHot_); + + tree_->Branch("ecal_3x3", &ecal3x3Energy_); + tree_->Branch("hcal_1x1", &hcal1x1Energy_); + tree_->Branch("ecal_detID", &ecalDetId_); + tree_->Branch("hcal_detID", &hcalDetId_); + tree_->Branch("ehcal_detID", &ehcalDetId_); + tree_->Branch("hcal_ieta", &hcal_ieta_); + tree_->Branch("hcal_iphi", &hcal_iphi_); + + char name[100]; + for (int k = 0; k < maxDepth_; ++k) { + sprintf(name, "hcal_edepth%d", (k + 1)); + tree_->Branch(name, &hcalDepthEnergy_[k]); + sprintf(name, "hcal_activeL%d", (k + 1)); + tree_->Branch(name, &hcalDepthActiveLength_[k]); + sprintf(name, "hcal_edepthHot%d", (k + 1)); + tree_->Branch(name, &hcalDepthEnergyHot_[k]); + sprintf(name, "hcal_activeHotL%d", (k + 1)); + tree_->Branch(name, &hcalDepthActiveLengthHot_[k]); + sprintf(name, "hcal_cdepthHot%d", (k + 1)); + tree_->Branch(name, &hcalDepthChargeHot_[k]); + sprintf(name, "hcal_cdepthHotBG%d", (k + 1)); + tree_->Branch(name, &hcalDepthChargeHotBG_[k]); + sprintf(name, "hcal_edepthCorrect%d", (k + 1)); + tree_->Branch(name, &hcalDepthEnergyCorr_[k]); + sprintf(name, "hcal_edepthHotCorrect%d", (k + 1)); + tree_->Branch(name, &hcalDepthEnergyHotCorr_[k]); + sprintf(name, "hcal_depthMatch%d", (k + 1)); + tree_->Branch(name, &hcalDepthMatch_[k]); + sprintf(name, "hcal_depthMatchHot%d", (k + 1)); + tree_->Branch(name, &hcalDepthMatchHot_[k]); + } + + tree_->Branch("activeLength", &hcalActiveLength_); + tree_->Branch("activeLengthHot", &hcalActiveLengthHot_); + + tree_->Branch("hltresults", &hltresults_); + tree_->Branch("all_triggers", &all_triggers_); +} + +// ------------ method fills 'descriptions' with the allowed parameters for the module ------------ +void HcalHBHENewMuonAnalyzer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + desc.add("hbheMuonLabel", edm::InputTag("alcaHcalHBHEMuonProducer", "hbheMuon")); + desc.add("useRaw", 0); + desc.addUntracked("maxDepth", 4); + descriptions.add("hcalHBHEMuonAnalysis", desc); +} + +//define this as a plug-in +#include "FWCore/Framework/interface/MakerMacros.h" + +DEFINE_FWK_MODULE(HcalHBHENewMuonAnalyzer); diff --git a/Calibration/HcalCalibAlgos/plugins/HcalIsoTrackAnalyzer.cc b/Calibration/HcalCalibAlgos/plugins/HcalIsoTrackAnalyzer.cc new file mode 100644 index 0000000000000..0867b71b6e7d1 --- /dev/null +++ b/Calibration/HcalCalibAlgos/plugins/HcalIsoTrackAnalyzer.cc @@ -0,0 +1,313 @@ +// system include files +#include +#include +#include +#include +#include + +// Root objects +#include "TROOT.h" +#include "TSystem.h" +#include "TFile.h" +#include "TProfile.h" +#include "TDirectory.h" +#include "TTree.h" +#include "TLorentzVector.h" +#include "TInterpreter.h" + +#include "DataFormats/HcalCalibObjects/interface/HcalIsoTrkCalibVariables.h" +#include "DataFormats/HcalCalibObjects/interface/HcalIsoTrkEventVariables.h" + +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" + +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/ServiceRegistry/interface/Service.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "CommonTools/UtilAlgos/interface/TFileService.h" + +//#define EDM_ML_DEBUG + +class HcalIsoTrackAnalyzer : public edm::one::EDAnalyzer { +public: + explicit HcalIsoTrackAnalyzer(edm::ParameterSet const&); + ~HcalIsoTrackAnalyzer() override {} + + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + +private: + void analyze(edm::Event const&, edm::EventSetup const&) override; + void beginJob() override; + void beginRun(edm::Run const&, edm::EventSetup const&) override {} + void endRun(edm::Run const&, edm::EventSetup const&) override; + + edm::Service fs; + const double pTrackLow_, pTrackHigh_; + const int useRaw_, dataType_; + const edm::InputTag labelIsoTkVar_, labelIsoTkEvt_; + edm::EDGetTokenT tokIsoTrkVar_; + edm::EDGetTokenT tokIsoTrkEvt_; + unsigned int nRun_, nRange_, nLow_, nHigh_; + + TTree *tree, *tree2; + int t_Run, t_Event, t_DataType, t_ieta, t_iphi; + int t_goodPV, t_nVtx, t_nTrk; + double t_EventWeight, t_p, t_pt, t_phi; + double t_l1pt, t_l1eta, t_l1phi; + double t_l3pt, t_l3eta, t_l3phi; + double t_mindR1, t_mindR2; + double t_eMipDR, t_eMipDR2, t_eMipDR3, t_eMipDR4; + double t_eMipDR5, t_hmaxNearP, t_gentrackP; + double t_emaxNearP, t_eAnnular, t_hAnnular; + double t_eHcal, t_eHcal10, t_eHcal30, t_rhoh; + bool t_selectTk, t_qltyFlag, t_qltyMissFlag, t_qltyPVFlag; + std::vector t_DetIds, t_DetIds1, t_DetIds3; + std::vector t_HitEnergies, t_HitEnergies1, t_HitEnergies3; + std::vector t_trgbits; + + unsigned int t_RunNo, t_EventNo; + bool t_TrigPass, t_TrigPassSel, t_L1Bit; + int t_Tracks, t_TracksProp, t_TracksSaved; + int t_TracksLoose, t_TracksTight, t_allvertex; + std::vector t_ietaAll, t_ietaGood, t_trackType; + std::vector t_hltbits; +}; + +HcalIsoTrackAnalyzer::HcalIsoTrackAnalyzer(const edm::ParameterSet& iConfig) + : pTrackLow_(iConfig.getParameter("momentumLow")), + pTrackHigh_(iConfig.getParameter("momentumHigh")), + useRaw_(iConfig.getUntrackedParameter("useRaw", 0)), + dataType_(iConfig.getUntrackedParameter("dataType", 0)), + labelIsoTkVar_(iConfig.getParameter("isoTrackVarLabel")), + labelIsoTkEvt_(iConfig.getParameter("isoTrackEvtLabel")), + tokIsoTrkVar_(consumes(labelIsoTkVar_)), + tokIsoTrkEvt_(consumes(labelIsoTkEvt_)), + nRun_(0), + nRange_(0), + nLow_(0), + nHigh_(0) { + usesResource(TFileService::kSharedResource); + + //now do whatever initialization is needed + edm::LogVerbatim("HcalIsoTrack") << "Labels used " << labelIsoTkVar_ << " " << labelIsoTkEvt_; + + edm::LogVerbatim("HcalIsoTrack") << "Parameters read from config file \n\t momentumLow_ " << pTrackLow_ + << "\t momentumHigh_ " << pTrackHigh_ << "\t useRaw_ " << useRaw_ + << "\t dataType_ " << dataType_; +} + +void HcalIsoTrackAnalyzer::analyze(edm::Event const& iEvent, edm::EventSetup const& iSetup) { + t_Run = iEvent.id().run(); + t_Event = iEvent.id().event(); + t_DataType = dataType_; +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("HcalIsoTrack") << "Run " << t_Run << " Event " << t_Event << " type " << t_DataType + << " Luminosity " << iEvent.luminosityBlock() << " Bunch " << iEvent.bunchCrossing(); +#endif + + // Fill from IsoTrkCalibVariables collection + auto const& isotrkCalibColl = iEvent.getHandle(tokIsoTrkVar_); + if (isotrkCalibColl.isValid()) { + auto isotrkCalib = isotrkCalibColl.product(); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("HcalIsoTrack") << "Finds HcalIsoTrkCalibVariablesCollection with " << isotrkCalib->size() + << " entries"; +#endif + for (auto itr = isotrkCalib->begin(); itr != isotrkCalib->end(); ++itr) { + t_ieta = itr->ieta_; + t_iphi = itr->iphi_; + t_goodPV = itr->goodPV_; + t_nVtx = itr->nVtx_; + t_nTrk = itr->nTrk_; + t_EventWeight = itr->eventWeight_; + t_p = itr->p_; + t_pt = itr->pt_; + t_phi = itr->phi_; + t_l1pt = itr->l1pt_; + t_l1eta = itr->l1eta_; + t_l1phi = itr->l1phi_; + t_l3pt = itr->l3pt_; + t_l3eta = itr->l3eta_; + t_l3phi = itr->l3phi_; + t_mindR1 = itr->mindR1_; + t_mindR2 = itr->mindR2_; + t_eMipDR = itr->eMipDR_[0]; + t_eMipDR2 = itr->eMipDR_[1]; + t_eMipDR3 = itr->eMipDR_[2]; + t_eMipDR4 = itr->eMipDR_[3]; + t_eMipDR5 = itr->eMipDR_[4]; + t_hmaxNearP = itr->hmaxNearP_; + t_gentrackP = itr->gentrackP_; + t_emaxNearP = itr->emaxNearP_; + t_eAnnular = itr->eAnnular_; + t_hAnnular = itr->hAnnular_; + t_rhoh = itr->rhoh_; + t_selectTk = itr->selectTk_; + t_qltyFlag = itr->qltyFlag_; + t_qltyMissFlag = itr->qltyMissFlag_; + t_qltyPVFlag = itr->qltyPVFlag_; + t_trgbits = itr->trgbits_; + t_DetIds = itr->detIds_; + t_DetIds1 = itr->detIds1_; + t_DetIds3 = itr->detIds3_; + if (useRaw_ == 1) { + t_eHcal = itr->eHcalAux_; + t_eHcal10 = itr->eHcal10Aux_; + t_eHcal30 = itr->eHcal30Aux_; + t_HitEnergies = itr->hitEnergiesAux_; + t_HitEnergies1 = itr->hitEnergies1Aux_; + t_HitEnergies3 = itr->hitEnergies3Aux_; + } else if (useRaw_ == 2) { + t_eHcal = itr->eHcalRaw_; + t_eHcal10 = itr->eHcal10Raw_; + t_eHcal30 = itr->eHcal30Raw_; + t_HitEnergies = itr->hitEnergiesRaw_; + t_HitEnergies1 = itr->hitEnergies1Raw_; + t_HitEnergies3 = itr->hitEnergies3Raw_; + } else { + t_eHcal = itr->eHcal_; + t_eHcal10 = itr->eHcal10_; + t_eHcal30 = itr->eHcal30_; + t_HitEnergies = itr->hitEnergies_; + t_HitEnergies1 = itr->hitEnergies1_; + t_HitEnergies3 = itr->hitEnergies3_; + } + tree->Fill(); + + if (t_p < pTrackLow_) { + ++nLow_; + } else if (t_p < pTrackHigh_) { + ++nHigh_; + } else { + ++nRange_; + } + } + } else { + edm::LogVerbatim("HcalIsoTrack") << "Cannot find HcalIsoTrkCalibVariablesCollection"; + } + + // Fill from IsoTrkEventVariables collection + auto const& isotrkEventColl = iEvent.getHandle(tokIsoTrkEvt_); + if (isotrkEventColl.isValid()) { + auto isotrkEvent = isotrkEventColl.product(); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("HcalIsoTrack") << "Finds HcalIsoTrkEventVariablesCollection with " << isotrkEvent->size() + << " entries"; +#endif + auto itr = isotrkEvent->begin(); + if (itr != isotrkEvent->end()) { + t_RunNo = iEvent.id().run(); + t_EventNo = iEvent.id().event(); + t_TrigPass = itr->trigPass_; + t_TrigPassSel = itr->trigPassSel_; + t_L1Bit = itr->l1Bit_; + t_Tracks = itr->tracks_; + t_TracksProp = itr->tracksProp_; + t_TracksSaved = itr->tracksSaved_; + t_TracksLoose = itr->tracksLoose_; + t_TracksTight = itr->tracksTight_; + t_allvertex = itr->allvertex_; + t_ietaAll = itr->ietaAll_; + t_ietaGood = itr->ietaGood_; + t_trackType = itr->trackType_; + t_hltbits = itr->hltbits_; + tree2->Fill(); + } + } else { + edm::LogVerbatim("HcalIsoTrack") << "Cannot find HcalIsoTrkEventVariablesCollections"; + } +} + +void HcalIsoTrackAnalyzer::beginJob() { + tree = fs->make("CalibTree", "CalibTree"); + + tree->Branch("t_Run", &t_Run, "t_Run/I"); + tree->Branch("t_Event", &t_Event, "t_Event/I"); + tree->Branch("t_DataType", &t_DataType, "t_DataType/I"); + tree->Branch("t_ieta", &t_ieta, "t_ieta/I"); + tree->Branch("t_iphi", &t_iphi, "t_iphi/I"); + tree->Branch("t_EventWeight", &t_EventWeight, "t_EventWeight/D"); + 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"); + 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"); + tree->Branch("t_mindR1", &t_mindR1, "t_mindR1/D"); + tree->Branch("t_mindR2", &t_mindR2, "t_mindR2/D"); + tree->Branch("t_eMipDR", &t_eMipDR, "t_eMipDR/D"); + tree->Branch("t_eMipDR2", &t_eMipDR2, "t_eMipDR2/D"); + tree->Branch("t_eMipDR3", &t_eMipDR3, "t_eMipDR3/D"); + tree->Branch("t_eMipDR4", &t_eMipDR4, "t_eMipDR4/D"); + tree->Branch("t_eMipDR5", &t_eMipDR5, "t_eMipDR5/D"); + tree->Branch("t_eHcal", &t_eHcal, "t_eHcal/D"); + tree->Branch("t_eHcal10", &t_eHcal10, "t_eHcal10/D"); + tree->Branch("t_eHcal30", &t_eHcal30, "t_eHcal30/D"); + tree->Branch("t_hmaxNearP", &t_hmaxNearP, "t_hmaxNearP/D"); + tree->Branch("t_emaxNearP", &t_emaxNearP, "t_emaxNearP/D"); + tree->Branch("t_eAnnular", &t_eAnnular, "t_eAnnular/D"); + tree->Branch("t_hAnnular", &t_hAnnular, "t_hAnnular/D"); + tree->Branch("t_rhoh", &t_rhoh, "t_rhoh/D"); + tree->Branch("t_selectTk", &t_selectTk, "t_selectTk/O"); + tree->Branch("t_qltyFlag", &t_qltyFlag, "t_qltyFlag/O"); + tree->Branch("t_qltyMissFlag", &t_qltyMissFlag, "t_qltyMissFlag/O"); + tree->Branch("t_qltyPVFlag", &t_qltyPVFlag, "t_qltyPVFlag/O"); + tree->Branch("t_gentrackP", &t_gentrackP, "t_gentrackP/D"); + + tree->Branch("t_DetIds", &t_DetIds); + tree->Branch("t_HitEnergies", &t_HitEnergies); + tree->Branch("t_trgbits", &t_trgbits); + tree->Branch("t_DetIds1", &t_DetIds1); + tree->Branch("t_DetIds3", &t_DetIds3); + tree->Branch("t_HitEnergies1", &t_HitEnergies1); + tree->Branch("t_HitEnergies3", &t_HitEnergies3); + + tree2 = fs->make("EventInfo", "Event Information"); + + tree2->Branch("t_RunNo", &t_RunNo, "t_RunNo/i"); + tree2->Branch("t_EventNo", &t_EventNo, "t_EventNo/i"); + tree2->Branch("t_Tracks", &t_Tracks, "t_Tracks/I"); + tree2->Branch("t_TracksProp", &t_TracksProp, "t_TracksProp/I"); + tree2->Branch("t_TracksSaved", &t_TracksSaved, "t_TracksSaved/I"); + tree2->Branch("t_TracksLoose", &t_TracksLoose, "t_TracksLoose/I"); + tree2->Branch("t_TracksTight", &t_TracksTight, "t_TracksTight/I"); + tree2->Branch("t_TrigPass", &t_TrigPass, "t_TrigPass/O"); + tree2->Branch("t_TrigPassSel", &t_TrigPassSel, "t_TrigPassSel/O"); + tree2->Branch("t_L1Bit", &t_L1Bit, "t_L1Bit/O"); + tree2->Branch("t_allvertex", &t_allvertex, "t_allvertex/I"); + tree2->Branch("t_ietaAll", &t_ietaAll); + tree2->Branch("t_ietaGood", &t_ietaGood); + tree2->Branch("t_trackType", &t_trackType); + tree2->Branch("t_hltbits", &t_hltbits); +} + +// ------------ method called when starting to processes a run ------------ + +// ------------ method called when ending the processing of a run ------------ +void HcalIsoTrackAnalyzer::endRun(edm::Run const& iRun, edm::EventSetup const&) { + nRun_++; + edm::LogVerbatim("HcalIsoTrack") << "endRun[" << nRun_ << "] " << iRun.run() << " with " << nLow_ + << " events with p < " << pTrackLow_ << ", " << nHigh_ << " events with p > " + << pTrackHigh_ << ", and " << nRange_ << " events in the right momentum range"; +} + +void HcalIsoTrackAnalyzer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + desc.add("momentumLow", 40.0); + desc.add("momentumHigh", 60.0); + desc.addUntracked("useRaw", 0); + desc.addUntracked("dataType", 0); + desc.add("isoTrackVarLabel", edm::InputTag("alcaHcalIsotrkProducer", "HcalIsoTrack")); + desc.add("isoTrackEvtLabel", edm::InputTag("alcaHcalIsotrkProducer", "HcalIsoTrackEvent")); + descriptions.add("hcalIsoTrackAnalyzer", desc); +} + +//define this as a plug-in +DEFINE_FWK_MODULE(HcalIsoTrackAnalyzer); diff --git a/Calibration/HcalCalibAlgos/plugins/HcalIsoTrkAnalyzer.cc b/Calibration/HcalCalibAlgos/plugins/HcalIsoTrkAnalyzer.cc index 8bbed91e23e8d..707d03b5c6710 100644 --- a/Calibration/HcalCalibAlgos/plugins/HcalIsoTrkAnalyzer.cc +++ b/Calibration/HcalCalibAlgos/plugins/HcalIsoTrkAnalyzer.cc @@ -411,9 +411,7 @@ void HcalIsoTrkAnalyzer::analyze(edm::Event const& iEvent, edm::EventSetup const 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); - respCorrs->setTopo(theHBHETopology); + const HcalRespCorrs* respCorrs = &iSetup.getData(tok_resp_); //=== genParticle information edm::Handle genParticles; @@ -793,25 +791,27 @@ void HcalIsoTrkAnalyzer::beginJob() { void HcalIsoTrkAnalyzer::beginRun(edm::Run const& iRun, edm::EventSetup const& iSetup) { hdc_ = &iSetup.getData(tok_ddrec_); - bool changed_(true); - bool flag = hltConfig_.init(iRun, iSetup, processName_, changed_); - edm::LogVerbatim("HcalIsoTrack") << "Run[" << nRun_ << "] " << iRun.run() << " process " << processName_ - << " init flag " << flag << " change flag " << changed_; - // check if trigger names in (new) config - if (changed_) { + if (!ignoreTrigger_) { + bool changed_(true); + bool flag = hltConfig_.init(iRun, iSetup, processName_, changed_); + edm::LogVerbatim("HcalIsoTrack") << "Run[" << nRun_ << "] " << iRun.run() << " process " << processName_ + << " init flag " << flag << " change flag " << changed_; + // check if trigger names in (new) config + if (changed_) { #ifdef EDM_ML_DEBUG - edm::LogVerbatim("HcalIsoTrack") << "New trigger menu found !!!"; + edm::LogVerbatim("HcalIsoTrack") << "New trigger menu found !!!"; #endif - const unsigned int n(hltConfig_.size()); - for (unsigned itrig = 0; itrig < trigNames_.size(); itrig++) { - unsigned int triggerindx = hltConfig_.triggerIndex(trigNames_[itrig]); - if (triggerindx >= n) { - edm::LogWarning("HcalIsoTrack") << trigNames_[itrig] << " " << triggerindx << " does not exist in " - << "the current menu"; + const unsigned int n(hltConfig_.size()); + for (unsigned itrig = 0; itrig < trigNames_.size(); itrig++) { + unsigned int triggerindx = hltConfig_.triggerIndex(trigNames_[itrig]); + if (triggerindx >= n) { + edm::LogWarning("HcalIsoTrack") << trigNames_[itrig] << " " << triggerindx << " does not exist in " + << "the current menu"; #ifdef EDM_ML_DEBUG - } else { - edm::LogVerbatim("HcalIsoTrack") << trigNames_[itrig] << " " << triggerindx << " exists"; + } else { + edm::LogVerbatim("HcalIsoTrack") << trigNames_[itrig] << " " << triggerindx << " exists"; #endif + } } } } @@ -939,9 +939,13 @@ std::array HcalIsoTrkAnalyzer::fillTree(std::vectortrkItr)); math::XYZTLorentzVector v4(pTrack->px(), pTrack->py(), pTrack->pz(), pTrack->p()); + t_p = pTrack->p(); + t_pt = pTrack->pt(); + t_phi = pTrack->phi(); + #ifdef EDM_ML_DEBUG - edm::LogVerbatim("HcalIsoTrack") << "This track : " << nTracks << " (pt|eta|phi|p) :" << pTrack->pt() << "|" - << pTrack->eta() << "|" << pTrack->phi() << "|" << pTrack->p(); + edm::LogVerbatim("HcalIsoTrack") << "This track : " << nTracks << " (pt|eta|phi|p) :" << t_pt << "|" + << pTrack->eta() << "|" << t_phi << "|" << t_p; #endif t_mindR2 = 999; for (unsigned int k = 0; k < vecL3.size(); ++k) { @@ -954,6 +958,7 @@ std::array HcalIsoTrkAnalyzer::fillTree(std::vectorokHCAL) { HcalDetId detId = (HcalDetId)(trkDetItr->detIdHCAL); @@ -1209,10 +1214,6 @@ std::array HcalIsoTrkAnalyzer::fillTree(std::vectorp(); - t_pt = pTrack->pt(); - t_phi = pTrack->phi(); - #ifdef EDM_ML_DEBUG edm::LogVerbatim("HcalIsoTrack") << "This track : " << nTracks << " (pt|eta|phi|p) :" << t_pt << "|" << pTrack->eta() << "|" << t_phi << "|" << t_p << " Generator Level p " diff --git a/Calibration/HcalCalibAlgos/plugins/HitReCalibrator.cc b/Calibration/HcalCalibAlgos/plugins/HitReCalibrator.cc index 04de1ebaf9861..325aeb5905076 100644 --- a/Calibration/HcalCalibAlgos/plugins/HitReCalibrator.cc +++ b/Calibration/HcalCalibAlgos/plugins/HitReCalibrator.cc @@ -1,13 +1,59 @@ -#include "Calibration/HcalCalibAlgos/plugins/HitReCalibrator.h" -#include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "DataFormats/GeometryVector/interface/GlobalPoint.h" +// system include files +#include +#include + +// user include files +#include "DataFormats/Common/interface/Ref.h" +#include "DataFormats/CaloTowers/interface/CaloTowerCollection.h" #include "DataFormats/CaloTowers/interface/CaloTowerDetId.h" #include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" +#include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h" +#include "DataFormats/DetId/interface/DetId.h" +#include "DataFormats/GeometryVector/interface/GlobalPoint.h" + +#include "CondFormats/HcalObjects/interface/HcalRespCorrs.h" +#include "CondFormats/DataRecord/interface/HcalRespCorrsRcd.h" + +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/one/EDProducer.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" #include "RecoTracker/TrackProducer/interface/TrackProducerBase.h" #include "TrackingTools/TransientTrack/interface/TransientTrack.h" #include "DataFormats/JetReco/interface/CaloJetCollection.h" #include "FWCore/Utilities/interface/Exception.h" +// +// class declaration +// + +namespace cms { + + class HitReCalibrator : public edm::one::EDProducer<> { + public: + explicit HitReCalibrator(const edm::ParameterSet&); + ~HitReCalibrator() override; + + void beginJob() override; + + void produce(edm::Event&, const edm::EventSetup&) override; + + private: + // ----------member data --------------------------- + + bool allowMissingInputs_; + + edm::EDGetTokenT tok_hbhe_; + edm::EDGetTokenT tok_ho_; + edm::EDGetTokenT tok_hf_; + + edm::ESGetToken tok_resp_; + }; +} // end namespace cms + namespace cms { HitReCalibrator::HitReCalibrator(const edm::ParameterSet& iConfig) { diff --git a/Calibration/HcalCalibAlgos/plugins/HitReCalibrator.h b/Calibration/HcalCalibAlgos/plugins/HitReCalibrator.h deleted file mode 100644 index e7781f71811d1..0000000000000 --- a/Calibration/HcalCalibAlgos/plugins/HitReCalibrator.h +++ /dev/null @@ -1,57 +0,0 @@ -#ifndef HitReCalibrator_h -#define HitReCalibrator_h - -// -*- C++ -*- - -// system include files -#include -#include -// user include files -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDProducer.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/MakerMacros.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/Framework/interface/EventSetup.h" - -#include "DataFormats/Common/interface/Ref.h" -#include "DataFormats/CaloTowers/interface/CaloTowerCollection.h" -#include "DataFormats/DetId/interface/DetId.h" - -#include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h" -#include "CondFormats/HcalObjects/interface/HcalRespCorrs.h" -#include "CondFormats/DataRecord/interface/HcalRespCorrsRcd.h" - -// -// class declaration -// -namespace edm { - class ParameterSet; - class Event; - class EventSetup; -} // namespace edm - -namespace cms { - - class HitReCalibrator : public edm::EDProducer { - public: - explicit HitReCalibrator(const edm::ParameterSet &); - ~HitReCalibrator() override; - - void beginJob() override; - - void produce(edm::Event &, const edm::EventSetup &) override; - - private: - // ----------member data --------------------------- - - bool allowMissingInputs_; - - edm::EDGetTokenT tok_hbhe_; - edm::EDGetTokenT tok_ho_; - edm::EDGetTokenT tok_hf_; - - edm::ESGetToken tok_resp_; - }; -} // end namespace cms -#endif diff --git a/Calibration/HcalCalibAlgos/src/classes.h b/Calibration/HcalCalibAlgos/src/classes.h index 8a8c57566aad9..a073736f97380 100644 --- a/Calibration/HcalCalibAlgos/src/classes.h +++ b/Calibration/HcalCalibAlgos/src/classes.h @@ -1,4 +1,4 @@ -#include "Calibration/HcalCalibAlgos/src/TCell.h" +#include "Calibration/HcalCalibAlgos/interface/TCell.h" namespace Calibration_HcalCalibAlgos { struct dictionary {}; diff --git a/Calibration/HcalCalibAlgos/src/hcalCalib.cc b/Calibration/HcalCalibAlgos/src/hcalCalib.cc index c14fc6f828eaf..8300138eeef0c 100644 --- a/Calibration/HcalCalibAlgos/src/hcalCalib.cc +++ b/Calibration/HcalCalibAlgos/src/hcalCalib.cc @@ -1,5 +1,3 @@ -#define hcalCalib_cxx - // TSelector-based code for getting the HCAL resp. correction // from physics events. Works for DiJet and IsoTrack calibration. // @@ -9,16 +7,11 @@ // #include "Calibration/HcalCalibAlgos/interface/hcalCalib.h" -#include "Calibration/HcalCalibAlgos/src/hcalCalibUtils.h" +#include "Calibration/HcalCalibAlgos/interface/hcalCalibUtils.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" -#include -#include -#include "TFile.h" - #include #include - #include #include @@ -29,40 +22,9 @@ #include "Calibration/Tools/interface/MinL3AlgoUniv.h" -#include "TMatrixF.h" -#include "TMatrixD.h" -#include "TDecompSVD.h" -#include "TDecompQRH.h" - #include "DataFormats/DetId/interface/DetId.h" #include "DataFormats/HcalDetId/interface/HcalDetId.h" -UInt_t nEvents; - -TFile* histoFile; - -// sanity check histograms -TH1F* h1_trkP; -TH1F* h1_allTrkP; - -TH1F* h1_selTrkP_iEta10; - -TH1F* h1_rawSumE; -TH1F* h1_rawResp; -TH1F* h1_corResp; -TH1F* h1_rawRespBarrel; -TH1F* h1_corRespBarrel; -TH1F* h1_rawRespEndcap; -TH1F* h1_corRespEndcap; -TH1F* h1_numEventsTwrIEta; - -TH2F* h2_dHitRefBarrel; -TH2F* h2_dHitRefEndcap; - -// histograms based on iEta, iPhi of refPosition forthe cluster (at the moment: hottest tower) -// expect range |iEta|<=24 (to do: add flexibility for arbitrary range) -TH1F* h1_corRespIEta[48]; - void hcalCalib::Begin(TTree* /*tree*/) { TString option = GetOption(); @@ -731,3 +693,57 @@ void hcalCalib::makeTextFile() { return; } + +inline void hcalCalib::Init(TTree* tree) { + // The Init() function is called when the selector needs to initialize + // a new tree or chain. Typically here the branch addresses and branch + // pointers of the tree will be set. + // It is normaly not necessary to make changes to the generated + // code, but the routine can be extended by the user if needed. + // Init() will be called many times when running on PROOF + // (once per file to be processed). + + // Set object pointer + cells = nullptr; + tagJetP4 = nullptr; + probeJetP4 = nullptr; + + // Set branch addresses and branch pointers + if (!tree) + return; + fChain = tree; + + // fChain->SetMakeClass(1); + + fChain->SetBranchAddress("eventNumber", &eventNumber, &b_eventNumber); + fChain->SetBranchAddress("runNumber", &runNumber, &b_runNumber); + fChain->SetBranchAddress("iEtaHit", &iEtaHit, &b_iEtaHit); + fChain->SetBranchAddress("iPhiHit", &iPhiHit, &b_iPhiHit); + fChain->SetBranchAddress("cells", &cells, &b_cells); + fChain->SetBranchAddress("emEnergy", &emEnergy, &b_emEnergy); + fChain->SetBranchAddress("targetE", &targetE, &b_targetE); + fChain->SetBranchAddress("etVetoJet", &etVetoJet, &b_etVetoJet); + + fChain->SetBranchAddress("xTrkHcal", &xTrkHcal, &b_xTrkHcal); + fChain->SetBranchAddress("yTrkHcal", &yTrkHcal, &b_yTrkHcal); + fChain->SetBranchAddress("zTrkHcal", &zTrkHcal, &b_zTrkHcal); + fChain->SetBranchAddress("xTrkEcal", &xTrkEcal, &b_xTrkEcal); + fChain->SetBranchAddress("yTrkEcal", &yTrkEcal, &b_yTrkEcal); + fChain->SetBranchAddress("zTrkEcal", &zTrkEcal, &b_zTrkEcal); + + fChain->SetBranchAddress("tagJetEmFrac", &tagJetEmFrac, &b_tagJetEmFrac); + fChain->SetBranchAddress("probeJetEmFrac", &probeJetEmFrac, &b_probeJetEmFrac); + + fChain->SetBranchAddress("tagJetP4", &tagJetP4, &b_tagJetP4); + fChain->SetBranchAddress("probeJetP4", &probeJetP4, &b_probeJetP4); +} + +inline Bool_t hcalCalib::Notify() { + // The Notify() function is called when a new file is opened. This + // can be either for a new TTree in a TChain or when when a new TTree + // is started when using PROOF. It is normaly not necessary to make changes + // to the generated code, but the routine can be extended by the + // user if needed. The return value is currently not used. + + return kTRUE; +} diff --git a/Calibration/HcalCalibAlgos/src/hcalCalibUtils.cc b/Calibration/HcalCalibAlgos/src/hcalCalibUtils.cc index 93d4a64369e81..cd0b396b53856 100644 --- a/Calibration/HcalCalibAlgos/src/hcalCalibUtils.cc +++ b/Calibration/HcalCalibAlgos/src/hcalCalibUtils.cc @@ -5,7 +5,7 @@ #include "TString.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "Calibration/HcalCalibAlgos/src/hcalCalibUtils.h" +#include "Calibration/HcalCalibAlgos/interface/hcalCalibUtils.h" //#include "Calibration/HcalCalibAlgos/plugins/CommonUsefulStuff.h" #include "Calibration/HcalCalibAlgos/interface/CommonUsefulStuff.h" diff --git a/Calibration/HcalCalibAlgos/test/HcalIsoTrackStudy.cc b/Calibration/HcalCalibAlgos/test/HcalIsoTrackStudy.cc index 46186a5a906b2..466378445aee8 100644 --- a/Calibration/HcalCalibAlgos/test/HcalIsoTrackStudy.cc +++ b/Calibration/HcalCalibAlgos/test/HcalIsoTrackStudy.cc @@ -186,6 +186,15 @@ 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; @@ -352,6 +361,15 @@ HcalIsoTrackStudy::HcalIsoTrackStudy(const edm::ParameterSet& iConfig) 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) @@ -382,35 +400,15 @@ void HcalIsoTrackStudy::analyze(edm::Event const& iEvent, edm::EventSetup const& << " Luminosity " << iEvent.luminosityBlock() << " Bunch " << iEvent.bunchCrossing(); #endif //Get magnetic field and ECAL channel status - 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(); + const MagneticField* bField = &iSetup.getData(tok_bFieldH_); + const EcalChannelStatus* theEcalChStatus = &iSetup.getData(tok_ecalChStatus_); + const EcalSeverityLevelAlgo* theEcalSevlv = &iSetup.getData(tok_sevlv_); // get handles to calogeometry and calotopology - 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); + const CaloGeometry* geo = &iSetup.getData(tok_geom_); + const CaloTopology* caloTopology = &iSetup.getData(tok_caloTopology_); + const HcalTopology* theHBHETopology = &iSetup.getData(tok_htopo_); + const HcalRespCorrs* respCorrs = &iSetup.getData(tok_resp_); //=== genParticle information edm::Handle genParticles; @@ -803,9 +801,7 @@ void HcalIsoTrackStudy::beginJob() { // ------------ method called when starting to processes a run ------------ void HcalIsoTrackStudy::beginRun(edm::Run const& iRun, edm::EventSetup const& iSetup) { - edm::ESHandle pHRNDC; - iSetup.get().get(pHRNDC); - hdc_ = pHRNDC.product(); + hdc_ = &iSetup.getData(tok_ddrec_); bool changed_(true); bool flag = hltConfig_.init(iRun, iSetup, processName_, changed_); diff --git a/Calibration/HcalCalibAlgos/test/batchjob_analisotrk.csh b/Calibration/HcalCalibAlgos/test/batchjob_analisotrk.csh index 57493a4edd130..5327c61bab855 100755 --- a/Calibration/HcalCalibAlgos/test/batchjob_analisotrk.csh +++ b/Calibration/HcalCalibAlgos/test/batchjob_analisotrk.csh @@ -24,7 +24,7 @@ process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff") process.GlobalTag.globaltag = 'MC_31X_V5::All' process.load("Configuration.StandardSequences.Reconstruction_cff") -process.load("Configuration.StandardSequences.Geometry_cff") +process.load("Configuration.StandardSequences.GeometryDB_cff") process.load("Configuration.StandardSequences.MagneticField_cff") process.load("Configuration.StandardSequences.VtxSmearedBetafuncEarlyCollision_cff") diff --git a/Calibration/HcalCalibAlgos/test/batchjob_calib_valid.csh b/Calibration/HcalCalibAlgos/test/batchjob_calib_valid.csh index 7e827ca8c006b..c3fac8d3949b2 100755 --- a/Calibration/HcalCalibAlgos/test/batchjob_calib_valid.csh +++ b/Calibration/HcalCalibAlgos/test/batchjob_calib_valid.csh @@ -33,7 +33,7 @@ process.prefer("GlobalTag") process.load("Configuration.StandardSequences.VtxSmearedBetafuncEarlyCollision_cff") process.load("Configuration.StandardSequences.Generator_cff") -process.load("Configuration.StandardSequences.Geometry_cff") +process.load("Configuration.StandardSequences.GeometryDB_cff") process.load("Configuration.StandardSequences.MagneticField_cff") process.load("Calibration.HcalAlCaRecoProducers.ALCARECOHcalCalIsoTrk_cff") process.load("Calibration.HcalAlCaRecoProducers.ALCARECOHcalCalIsoTrkNoHLT_cff") diff --git a/Calibration/HcalCalibAlgos/test/batchjob_pf_corrs.csh b/Calibration/HcalCalibAlgos/test/batchjob_pf_corrs.csh index ee0eb1d1953e4..5e718237d889d 100755 --- a/Calibration/HcalCalibAlgos/test/batchjob_pf_corrs.csh +++ b/Calibration/HcalCalibAlgos/test/batchjob_pf_corrs.csh @@ -23,7 +23,7 @@ import FWCore.ParameterSet.Config as cms process = cms.Process("HcalPFCorrsCulculation") process.load("Configuration.StandardSequences.MagneticField_cff") -process.load("Configuration.StandardSequences.Geometry_cff") +process.load("Configuration.StandardSequences.GeometryDB_cff") process.load("Configuration.StandardSequences.Services_cff") process.load("Configuration.StandardSequences.Reconstruction_cff") diff --git a/Calibration/HcalCalibAlgos/test/python/hcalHBHEMuonAnalysis_cfg.py b/Calibration/HcalCalibAlgos/test/python/hcalHBHEMuonAnalysis_cfg.py new file mode 100644 index 0000000000000..e0c020eb36b7e --- /dev/null +++ b/Calibration/HcalCalibAlgos/test/python/hcalHBHEMuonAnalysis_cfg.py @@ -0,0 +1,33 @@ +import FWCore.ParameterSet.Config as cms + +from Configuration.Eras.Era_Run2_2017_cff import Run2_2017 +process = cms.Process("RaddamMuon",Run2_2017) + +process.load("FWCore.MessageService.MessageLogger_cfi") +process.load("Configuration.StandardSequences.GeometryDB_cff") +process.load("Configuration.StandardSequences.GeometryRecoDB_cff") +process.load("Configuration.StandardSequences.MagneticField_cff") +process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff") +from Configuration.AlCa.autoCond import autoCond +process.GlobalTag.globaltag=autoCond['run2_data'] + +process.load("Calibration.HcalCalibAlgos.hcalHBHEMuonAnalysis_cfi") + +if 'MessageLogger' in process.__dict__: + process.MessageLogger.HBHEMuon=dict() + +process.maxEvents = cms.untracked.PSet( + input = cms.untracked.int32(-1) +) + +process.source = cms.Source("PoolSource", + fileNames = cms.untracked.vstring( + 'file:/afs/cern.ch/work/a/amkaur/public/ForSunandaDa/AlcaProducer_codecheck/new/OutputBHEMuonProducerFilter_new_2017.root' + ) + ) + +process.TFileService = cms.Service("TFileService", + fileName = cms.string("ValidationNew.root") +) + +process.p = cms.Path(process.hcalHBHEMuonAnalysis) diff --git a/Calibration/HcalCalibAlgos/test/python/hcalHBHEMuon_cfg.py b/Calibration/HcalCalibAlgos/test/python/hcalHBHEMuon_cfg.py index 98f2306833b0e..4a1a2fae85f5d 100644 --- a/Calibration/HcalCalibAlgos/test/python/hcalHBHEMuon_cfg.py +++ b/Calibration/HcalCalibAlgos/test/python/hcalHBHEMuon_cfg.py @@ -1,6 +1,7 @@ import FWCore.ParameterSet.Config as cms -process = cms.Process("RaddamMuon") +from Configuration.Eras.Era_Run2_2017_cff import Run2_2017 +process = cms.Process("RaddamMuon",Run2_2017) process.load("FWCore.MessageService.MessageLogger_cfi") process.load("Configuration.StandardSequences.GeometryDB_cff") @@ -8,7 +9,8 @@ process.load("Configuration.StandardSequences.MagneticField_cff") process.load("RecoJets.Configuration.CaloTowersES_cfi") process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff") -process.GlobalTag.globaltag='101X_dataRun2_Prompt_v11' +from Configuration.AlCa.autoCond import autoCond +process.GlobalTag.globaltag=autoCond['run2_data'] process.load("RecoLocalCalo.EcalRecAlgos.EcalSeverityLevelESProducer_cfi") process.load("Calibration.HcalCalibAlgos.hcalHBHEMuon_cfi") @@ -16,15 +18,18 @@ if 'MessageLogger' in process.__dict__: process.MessageLogger.HBHEMuon=dict() -process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(-1) ) +process.maxEvents = cms.untracked.PSet( + input = cms.untracked.int32(-1) +) + process.source = cms.Source("PoolSource", - fileNames = cms.untracked.vstring( - 'root://cms-xrd-global.cern.ch//store/data/Run2018C/SingleMuon/ALCARECO/HcalCalHBHEMuonFilter-PromptReco-v1/000/319/337/00000/004EC357-9184-E811-A588-FA163EFF1C10.root', - ) + fileNames = cms.untracked.vstring( + 'file:/afs/cern.ch/work/a/amkaur/public/ForSunandaDa/AlcaProducer_codecheck/old/OutputHBHEMuon_old_2017.root' ) +) process.TFileService = cms.Service("TFileService", - fileName = cms.string("Validation.root") + fileName = cms.string("ValidationOld.root") ) process.hcalHBHEMuon.useRaw = 0 diff --git a/Calibration/HcalCalibAlgos/test/python/isoTrackAlCaAnalysis_cfg.py b/Calibration/HcalCalibAlgos/test/python/isoTrackAlCaAnalysis_cfg.py new file mode 100644 index 0000000000000..abaa2c3fe6dee --- /dev/null +++ b/Calibration/HcalCalibAlgos/test/python/isoTrackAlCaAnalysis_cfg.py @@ -0,0 +1,47 @@ +import FWCore.ParameterSet.Config as cms + +from Configuration.Eras.Era_Run2_2018_cff import Run2_2018 +process = cms.Process("ANALYSIS",Run2_2018) + +process.load("FWCore.MessageService.MessageLogger_cfi") +process.load('Configuration.StandardSequences.Services_cff') +process.load("Configuration.StandardSequences.GeometryRecoDB_cff") +process.load("Configuration.StandardSequences.MagneticField_cff") +process.load("RecoLocalCalo.EcalRecAlgos.EcalSeverityLevelESProducer_cfi") +process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff') +from Configuration.AlCa.autoCond import autoCond +process.GlobalTag.globaltag=autoCond['run2_data'] + +if 'MessageLogger' in process.__dict__: + process.MessageLogger.HcalIsoTrack=dict() + +process.MessageLogger.cerr.FwkReport.reportEvery = 1 +process.options = cms.untracked.PSet( wantSummary = cms.untracked.bool(True) ) + +process.load('RecoLocalCalo.CaloTowersCreator.calotowermaker_cfi') +process.towerMakerAll = process.calotowermaker.clone() +process.towerMakerAll.hbheInput = cms.InputTag("hbhereco") +process.towerMakerAll.hoInput = cms.InputTag("none") +process.towerMakerAll.hfInput = cms.InputTag("none") +process.towerMakerAll.ecalInputs = cms.VInputTag(cms.InputTag("ecalRecHit","EcalRecHitsEB"), cms.InputTag("ecalRecHit","EcalRecHitsEE")) +process.towerMakerAll.AllowMissingInputs = True + +process.load('Calibration.HcalCalibAlgos.HcalIsoTrkAnalyzer_cff') +process.HcalIsoTrkAnalyzer.triggers = [] +process.HcalIsoTrkAnalyzer.useRaw = 0 # 2 for Raw +process.HcalIsoTrkAnalyzer.ignoreTriggers = True + +process.source = cms.Source("PoolSource", + fileNames = cms.untracked.vstring( + 'file:oldPoolOutput.root' + ) + ) + +process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(-1) ) + +process.TFileService = cms.Service("TFileService", + fileName = cms.string('output_oldalca.root') +) + +process.p = cms.Path(process.HcalIsoTrkAnalyzer) + diff --git a/Calibration/HcalCalibAlgos/test/python/isoTrackAlCaRecoAnalysis_cfg.py b/Calibration/HcalCalibAlgos/test/python/isoTrackAlCaRecoAnalysis_cfg.py index d5da71a52ddc9..cf51fd2637fe6 100644 --- a/Calibration/HcalCalibAlgos/test/python/isoTrackAlCaRecoAnalysis_cfg.py +++ b/Calibration/HcalCalibAlgos/test/python/isoTrackAlCaRecoAnalysis_cfg.py @@ -31,13 +31,14 @@ process.HcalIsoTrkAnalyzer.triggers = [] process.HcalIsoTrkAnalyzer.useRaw = 0 # 2 for Raw process.HcalIsoTrkAnalyzer.ignoreTriggers = True -process.HcalIsoTrkAnalyzer.processName = 'HLTNew1' -process.HcalIsoTrkAnalyzer.producerName = 'ALCAISOTRACK' -process.HcalIsoTrkAnalyzer.moduleName = 'IsoProd' +#process.HcalIsoTrkAnalyzer.processName = 'HLTNew1' +#process.HcalIsoTrkAnalyzer.producerName = 'ALCAISOTRACK' +#process.HcalIsoTrkAnalyzer.moduleName = 'IsoProd' process.source = cms.Source("PoolSource", fileNames = cms.untracked.vstring( - 'file:/afs/cern.ch/user/h/huwang/work/public/for_Sunanda/ALCARECO_MC.root' + 'file:PoolOutput.root' +# 'file:/afs/cern.ch/user/h/huwang/work/public/for_Sunanda/ALCARECO_MC.root' ) ) diff --git a/Calibration/HcalCalibAlgos/test/python/isoTrackAnalysis_cfg.py b/Calibration/HcalCalibAlgos/test/python/isoTrackAnalysis_cfg.py new file mode 100644 index 0000000000000..aded40fdd03f2 --- /dev/null +++ b/Calibration/HcalCalibAlgos/test/python/isoTrackAnalysis_cfg.py @@ -0,0 +1,36 @@ +import FWCore.ParameterSet.Config as cms + +from Configuration.Eras.Era_Run2_2018_cff import Run2_2018 +process = cms.Process("ANALYSIS",Run2_2018) + +process.load("FWCore.MessageService.MessageLogger_cfi") +process.load('Configuration.StandardSequences.Services_cff') +process.load("Configuration.StandardSequences.GeometryRecoDB_cff") +process.load("Configuration.StandardSequences.MagneticField_cff") +process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff') + +from Configuration.AlCa.GlobalTag import GlobalTag +process.GlobalTag = GlobalTag(process.GlobalTag,'auto:run2_data','') + +if 'MessageLogger' in process.__dict__: + process.MessageLogger.HcalIsoTrack=dict() +process.MessageLogger.cerr.FwkReport.reportEvery = 1 +process.options = cms.untracked.PSet( wantSummary = cms.untracked.bool(True) ) + +process.load('Calibration.HcalCalibAlgos.hcalIsoTrackAnalyzer_cfi') +process.source = cms.Source("PoolSource", + fileNames = cms.untracked.vstring( + 'file:newPoolOutput.root', + ) +) + +process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(-1) ) + +process.TFileService = cms.Service("TFileService", + fileName = cms.string('outputNew.root') +) + +process.hcalIsoTrackAnalyzer.useRaw = 0 # 2 for Raw + +process.p = cms.Path(process.hcalIsoTrackAnalyzer) + diff --git a/Calibration/HcalIsolatedTrackReco/interface/ECALRegFEDSelector.h b/Calibration/HcalIsolatedTrackReco/interface/ECALRegFEDSelector.h deleted file mode 100644 index 1fc7d9c814723..0000000000000 --- a/Calibration/HcalIsolatedTrackReco/interface/ECALRegFEDSelector.h +++ /dev/null @@ -1,47 +0,0 @@ -#ifndef Calibration_ECALRegFEDSelector_h -#define Calibration_ECALRegFEDSelector_h - -// system include files -#include - -// user include files -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDProducer.h" - -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/MakerMacros.h" - -#include "FWCore/ParameterSet/interface/ParameterSet.h" - -#include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h" -#include "DataFormats/FEDRawData/interface/FEDRawData.h" -#include "DataFormats/FEDRawData/interface/FEDNumbering.h" - -#include "DataFormats/EcalDetId/interface/EcalDetIdCollections.h" - -#include "DataFormats/HLTReco/interface/TriggerFilterObjectWithRefs.h" - -#include "Geometry/EcalMapping/interface/EcalElectronicsMapping.h" -#include "Geometry/EcalMapping/interface/EcalMappingRcd.h" - -#include "DataFormats/EcalRawData/interface/EcalListOfFEDS.h" - -class ECALRegFEDSelector : public edm::EDProducer { -public: - ECALRegFEDSelector(const edm::ParameterSet&); - ~ECALRegFEDSelector() override; - std::unique_ptr ec_mapping; - - double delta_; - bool fedSaved[1200]; - - edm::EDGetTokenT tok_raw_; - edm::EDGetTokenT tok_seed_; - -private: - void beginJob() override; - void produce(edm::Event&, const edm::EventSetup&) override; - void endJob() override; -}; - -#endif diff --git a/Calibration/HcalIsolatedTrackReco/interface/EcalIsolatedParticleCandidateProducer.h b/Calibration/HcalIsolatedTrackReco/interface/EcalIsolatedParticleCandidateProducer.h deleted file mode 100644 index b198b840e9cb5..0000000000000 --- a/Calibration/HcalIsolatedTrackReco/interface/EcalIsolatedParticleCandidateProducer.h +++ /dev/null @@ -1,47 +0,0 @@ -#ifndef Calibration_EcalIsolatedParticleCandidateProducer_h -#define Calibration_EcalIsolatedParticleCandidateProducer_h - -#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 "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" -#include "DataFormats/HLTReco/interface/TriggerFilterObjectWithRefs.h" -#include "DataFormats/HcalIsolatedTrack/interface/IsolatedPixelTrackCandidate.h" - -#include "Geometry/CaloGeometry/interface/CaloGeometry.h" -#include "Geometry/Records/interface/CaloGeometryRecord.h" -// -// class decleration -// - -class EcalIsolatedParticleCandidateProducer : public edm::global::EDProducer<> { -public: - explicit EcalIsolatedParticleCandidateProducer(const edm::ParameterSet&); - ~EcalIsolatedParticleCandidateProducer() override; - -private: - void produce(edm::StreamID, edm::Event&, const edm::EventSetup&) const override; - void beginJob() override; - void endJob() override; - - double InConeSize_; - double OutConeSize_; - double hitCountEthr_; - double hitEthr_; - - edm::EDGetTokenT tok_l1tau_; - edm::EDGetTokenT tok_hlt_; - edm::EDGetTokenT tok_EB_; - edm::EDGetTokenT tok_EE_; - - edm::ESGetToken tok_geom_; - - // ----------member data --------------------------- -}; - -#endif diff --git a/Calibration/HcalIsolatedTrackReco/interface/IPTCorrector.h b/Calibration/HcalIsolatedTrackReco/interface/IPTCorrector.h deleted file mode 100644 index 085724281d47d..0000000000000 --- a/Calibration/HcalIsolatedTrackReco/interface/IPTCorrector.h +++ /dev/null @@ -1,34 +0,0 @@ -#ifndef Calibration_IPTCorrector_h -#define Calibration_IPTCorrector_h - -/* \class IsolatedPixelTrackCandidateProducer - * - * - */ - -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/global/EDProducer.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 "DataFormats/Common/interface/Ref.h" -#include "DataFormats/TrackReco/interface/Track.h" -#include "DataFormats/HcalIsolatedTrack/interface/IsolatedPixelTrackCandidate.h" -#include "DataFormats/HLTReco/interface/TriggerFilterObjectWithRefs.h" - -class IPTCorrector : public edm::global::EDProducer<> { -public: - IPTCorrector(const edm::ParameterSet& ps); - - static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); - - void produce(edm::StreamID, edm::Event&, edm::EventSetup const&) const override; - -private: - const edm::EDGetTokenT tok_cor_; - const edm::EDGetTokenT tok_uncor_; - const double assocCone_; -}; - -#endif diff --git a/Calibration/HcalIsolatedTrackReco/interface/IsolatedEcalPixelTrackCandidateProducer.h b/Calibration/HcalIsolatedTrackReco/interface/IsolatedEcalPixelTrackCandidateProducer.h deleted file mode 100644 index 1a0a0068f02ad..0000000000000 --- a/Calibration/HcalIsolatedTrackReco/interface/IsolatedEcalPixelTrackCandidateProducer.h +++ /dev/null @@ -1,48 +0,0 @@ -#ifndef Calibration_IsolatedEcalPixelTrackCandidateProducer_h -#define Calibration_IsolatedEcalPixelTrackCandidateProducer_h - -#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 "DataFormats/HcalIsolatedTrack/interface/IsolatedPixelTrackCandidate.h" -#include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" -#include "DataFormats/HLTReco/interface/TriggerFilterObjectWithRefs.h" - -#include "Geometry/CaloGeometry/interface/CaloGeometry.h" -#include "Geometry/Records/interface/CaloGeometryRecord.h" - -// -// class decleration -// - -class IsolatedEcalPixelTrackCandidateProducer : public edm::global::EDProducer<> { -public: - explicit IsolatedEcalPixelTrackCandidateProducer(const edm::ParameterSet&); - ~IsolatedEcalPixelTrackCandidateProducer() override; - - static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); - -private: - void produce(edm::StreamID, edm::Event&, const edm::EventSetup&) const override; - - const edm::EDGetTokenT tok_ee; - const edm::EDGetTokenT tok_eb; - const edm::EDGetTokenT tok_trigcand; - const edm::ESGetToken tok_geom_; - const double coneSizeEta0_; - const double coneSizeEta1_; - const double hitCountEthrEB_; - const double hitEthrEB_; - const double fachitCountEE_; - const double hitEthrEE0_; - const double hitEthrEE1_; - const double hitEthrEE2_; - const double hitEthrEE3_; -}; - -#endif diff --git a/Calibration/HcalIsolatedTrackReco/interface/IsolatedPixelTrackCandidateL1TProducer.h b/Calibration/HcalIsolatedTrackReco/interface/IsolatedPixelTrackCandidateL1TProducer.h deleted file mode 100644 index b2903ea6db1f9..0000000000000 --- a/Calibration/HcalIsolatedTrackReco/interface/IsolatedPixelTrackCandidateL1TProducer.h +++ /dev/null @@ -1,95 +0,0 @@ -#ifndef Calibration_IsolatedPixelTrackCandidateL1TProducer_h -#define Calibration_IsolatedPixelTrackCandidateL1TProducer_h - -/* \class IsolatedPixelTrackCandidateL1TProducer - * - * - */ - -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/stream/EDProducer.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/EventSetup.h" - -#include "DataFormats/Common/interface/Ref.h" -#include "DataFormats/DetId/interface/DetId.h" - -//#include "DataFormats/Common/interface/Provenance.h" - -#include "DataFormats/TrackReco/interface/Track.h" -#include "DataFormats/L1Trigger/interface/L1JetParticle.h" -#include "DataFormats/HcalIsolatedTrack/interface/IsolatedPixelTrackCandidate.h" -#include "DataFormats/Common/interface/TriggerResults.h" -// L1Extra -#include "DataFormats/L1Trigger/interface/L1EmParticle.h" -#include "DataFormats/L1Trigger/interface/L1JetParticleFwd.h" -// l1t -#include "DataFormats/L1Trigger/interface/Jet.h" -#include "DataFormats/L1Trigger/interface/Tau.h" -/// -//vertices -#include "DataFormats/VertexReco/interface/Vertex.h" -#include "DataFormats/VertexReco/interface/VertexFwd.h" -#include "DataFormats/HLTReco/interface/TriggerFilterObjectWithRefs.h" - -#include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutSetupFwd.h" -#include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutRecord.h" -#include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerObjectMapRecord.h" -//#include "DataFormats/L1GlobalTrigger/interface/L1GtLogicParser.h" - -#include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerObjectMapFwd.h" -#include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerObjectMap.h" - -#include "MagneticField/Engine/interface/MagneticField.h" -#include "MagneticField/Records/interface/IdealMagneticFieldRecord.h" -#include "Geometry/CaloGeometry/interface/CaloGeometry.h" -#include "Geometry/Records/interface/CaloGeometryRecord.h" - -class IsolatedPixelTrackCandidateL1TProducer : public edm::stream::EDProducer<> { -public: - IsolatedPixelTrackCandidateL1TProducer(const edm::ParameterSet& ps); - ~IsolatedPixelTrackCandidateL1TProducer() override; - - static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); - - void beginRun(const edm::Run&, const edm::EventSetup&) override; - void produce(edm::Event& evt, const edm::EventSetup& es) override; - - double getDistInCM(double eta1, double phi1, double eta2, double phi2); - std::pair GetEtaPhiAtEcal(double etaIP, double phiIP, double pT, int charge, double vtxZ); - -private: - struct seedAtEC { - seedAtEC(unsigned int i, bool f, double et, double fi) : index(i), ok(f), eta(et), phi(fi) {} - unsigned int index; - bool ok; - double eta, phi; - }; - - const edm::EDGetTokenT tok_hlt_; - const edm::EDGetTokenT tok_l1_; - const edm::EDGetTokenT tok_vert_; - const std::vector > toks_pix_; - const edm::ESGetToken tok_bFieldH_; - const edm::ESGetToken tok_geom_; - - const std::string bfield_; - const double prelimCone_; - const double pixelIsolationConeSizeAtEC_; - const double vtxCutSeed_; - const double vtxCutIsol_; - const double tauAssocCone_; - const double tauUnbiasCone_; - const double minPTrackValue_; - const double maxPForIsolationValue_; - const double ebEtaBoundary_; - - // these are read from the EventSetup, cannot be const - double rEB_; - double zEE_; - double bfVal_; -}; - -#endif diff --git a/Calibration/HcalIsolatedTrackReco/interface/IsolatedPixelTrackCandidateProducer.h b/Calibration/HcalIsolatedTrackReco/interface/IsolatedPixelTrackCandidateProducer.h deleted file mode 100644 index 905e1daf16c80..0000000000000 --- a/Calibration/HcalIsolatedTrackReco/interface/IsolatedPixelTrackCandidateProducer.h +++ /dev/null @@ -1,92 +0,0 @@ -#ifndef Calibration_IsolatedPixelTrackCandidateProducer_h -#define Calibration_IsolatedPixelTrackCandidateProducer_h - -/* \class IsolatedPixelTrackCandidateProducer - * - * - */ - -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/stream/EDProducer.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/EventSetup.h" - -#include "DataFormats/Common/interface/Ref.h" -#include "DataFormats/DetId/interface/DetId.h" - -//#include "DataFormats/Common/interface/Provenance.h" - -#include "DataFormats/TrackReco/interface/Track.h" -#include "DataFormats/L1Trigger/interface/L1JetParticle.h" -#include "DataFormats/HcalIsolatedTrack/interface/IsolatedPixelTrackCandidate.h" -#include "DataFormats/Common/interface/TriggerResults.h" -// L1Extra -#include "DataFormats/L1Trigger/interface/L1EmParticle.h" -#include "DataFormats/L1Trigger/interface/L1JetParticleFwd.h" -/// -//vertices -#include "DataFormats/VertexReco/interface/Vertex.h" -#include "DataFormats/VertexReco/interface/VertexFwd.h" -#include "DataFormats/HLTReco/interface/TriggerFilterObjectWithRefs.h" - -#include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutSetupFwd.h" -#include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutRecord.h" -#include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerObjectMapRecord.h" -//#include "DataFormats/L1GlobalTrigger/interface/L1GtLogicParser.h" - -#include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerObjectMapFwd.h" -#include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerObjectMap.h" - -#include "MagneticField/Engine/interface/MagneticField.h" -#include "MagneticField/Records/interface/IdealMagneticFieldRecord.h" -#include "Geometry/CaloGeometry/interface/CaloGeometry.h" -#include "Geometry/Records/interface/CaloGeometryRecord.h" - -class IsolatedPixelTrackCandidateProducer : public edm::stream::EDProducer<> { -public: - IsolatedPixelTrackCandidateProducer(const edm::ParameterSet& ps); - ~IsolatedPixelTrackCandidateProducer() override; - - static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); - - void beginRun(const edm::Run&, const edm::EventSetup&) override; - void produce(edm::Event& evt, const edm::EventSetup& es) override; - - double getDistInCM(double eta1, double phi1, double eta2, double phi2); - std::pair GetEtaPhiAtEcal(double etaIP, double phiIP, double pT, int charge, double vtxZ); - -private: - struct seedAtEC { - seedAtEC(unsigned int i, bool f, double et, double fi) : index(i), ok(f), eta(et), phi(fi) {} - unsigned int index; - bool ok; - double eta, phi; - }; - - const edm::EDGetTokenT tok_hlt_; - const edm::EDGetTokenT tok_l1_; - const edm::EDGetTokenT tok_vert_; - const std::vector > toks_pix_; - const edm::ESGetToken tok_bFieldH_; - const edm::ESGetToken tok_geom_; - - const std::string bfield_; - const double prelimCone_; - const double pixelIsolationConeSizeAtEC_; - const double vtxCutSeed_; - const double vtxCutIsol_; - const double tauAssocCone_; - const double tauUnbiasCone_; - const double minPTrackValue_; - const double maxPForIsolationValue_; - const double ebEtaBoundary_; - - // these are read from the EventSetup, cannot be const - double rEB_; - double zEE_; - double bfVal_; -}; - -#endif diff --git a/Calibration/HcalIsolatedTrackReco/interface/SiStripRegFEDSelector.h b/Calibration/HcalIsolatedTrackReco/interface/SiStripRegFEDSelector.h deleted file mode 100644 index c8073dc5888b8..0000000000000 --- a/Calibration/HcalIsolatedTrackReco/interface/SiStripRegFEDSelector.h +++ /dev/null @@ -1,40 +0,0 @@ -#ifndef Calibration_SiStripRegFEDSelector_h -#define Calibration_SiStripRegFEDSelector_h - -// system include files -#include - -// user include files -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDProducer.h" - -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/MakerMacros.h" - -#include "FWCore/ParameterSet/interface/ParameterSet.h" - -#include "DataFormats/HLTReco/interface/TriggerFilterObjectWithRefs.h" -#include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h" -#include "DataFormats/FEDRawData/interface/FEDRawData.h" -#include "DataFormats/FEDRawData/interface/FEDNumbering.h" - -#include "CalibFormats/SiStripObjects/interface/SiStripRegionCabling.h" -#include "CalibTracker/Records/interface/SiStripRegionCablingRcd.h" - -class SiStripRegFEDSelector : public edm::EDProducer { -public: - SiStripRegFEDSelector(const edm::ParameterSet&); - ~SiStripRegFEDSelector() override; - -private: - void beginJob() override; - void produce(edm::Event&, const edm::EventSetup&) override; - void endJob() override; - - const edm::EDGetTokenT tok_seed_; - const edm::EDGetTokenT tok_raw_; - const edm::ESGetToken tok_strip_; - const double delta_; -}; - -#endif diff --git a/Calibration/HcalIsolatedTrackReco/interface/SubdetFEDSelector.h b/Calibration/HcalIsolatedTrackReco/interface/SubdetFEDSelector.h deleted file mode 100644 index 5e817320eed3b..0000000000000 --- a/Calibration/HcalIsolatedTrackReco/interface/SubdetFEDSelector.h +++ /dev/null @@ -1,41 +0,0 @@ -#ifndef Calibration_SubdetFEDSelector_h -#define Calibration_SubdetFEDSelector_h - -// user include files -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDProducer.h" - -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/MakerMacros.h" - -#include "FWCore/ParameterSet/interface/ParameterSet.h" - -#include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h" -#include "DataFormats/FEDRawData/interface/FEDRawData.h" -#include "DataFormats/FEDRawData/interface/FEDNumbering.h" - -#include "EventFilter/RawDataCollector/interface/RawDataFEDSelector.h" - -class SubdetFEDSelector : public edm::EDProducer { -public: - SubdetFEDSelector(const edm::ParameterSet&); - ~SubdetFEDSelector() override; - - bool getEcal_; - bool getHcal_; - bool getStrip_; - bool getPixel_; - bool getMuon_; - bool getTrigger_; - - edm::EDGetTokenT tok_raw_; - -private: - void beginJob() override; - void produce(edm::Event&, const edm::EventSetup&) override; - void endJob() override; - - // ----------member data --------------------------- -}; - -#endif diff --git a/Calibration/HcalIsolatedTrackReco/BuildFile.xml b/Calibration/HcalIsolatedTrackReco/plugins/BuildFile.xml similarity index 89% rename from Calibration/HcalIsolatedTrackReco/BuildFile.xml rename to Calibration/HcalIsolatedTrackReco/plugins/BuildFile.xml index cb6fa4600d9ba..5721f4ebf639a 100644 --- a/Calibration/HcalIsolatedTrackReco/BuildFile.xml +++ b/Calibration/HcalIsolatedTrackReco/plugins/BuildFile.xml @@ -22,4 +22,6 @@ - + + + diff --git a/Calibration/HcalIsolatedTrackReco/src/ECALRegFEDSelector.cc b/Calibration/HcalIsolatedTrackReco/plugins/ECALRegFEDSelector.cc similarity index 62% rename from Calibration/HcalIsolatedTrackReco/src/ECALRegFEDSelector.cc rename to Calibration/HcalIsolatedTrackReco/plugins/ECALRegFEDSelector.cc index 4960d213d7c22..52d120d5547d5 100644 --- a/Calibration/HcalIsolatedTrackReco/src/ECALRegFEDSelector.cc +++ b/Calibration/HcalIsolatedTrackReco/plugins/ECALRegFEDSelector.cc @@ -1,10 +1,48 @@ - -#include "Calibration/HcalIsolatedTrackReco/interface/ECALRegFEDSelector.h" -#include "EventFilter/EcalRawToDigi/interface/EcalRegionCabling.h" +// system include files +#include + +// user include files +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/one/EDProducer.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" + +#include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h" +#include "DataFormats/FEDRawData/interface/FEDRawData.h" +#include "DataFormats/FEDRawData/interface/FEDNumbering.h" +#include "DataFormats/EcalDetId/interface/EcalDetIdCollections.h" +#include "DataFormats/EcalRawData/interface/EcalListOfFEDS.h" #include "DataFormats/HcalIsolatedTrack/interface/IsolatedPixelTrackCandidateFwd.h" #include "DataFormats/HcalIsolatedTrack/interface/IsolatedPixelTrackCandidate.h" +#include "DataFormats/HLTReco/interface/TriggerFilterObjectWithRefs.h" #include "DataFormats/Math/interface/RectangularEtaPhiRegion.h" +#include "EventFilter/EcalRawToDigi/interface/EcalRegionCabling.h" +#include "Geometry/EcalMapping/interface/EcalElectronicsMapping.h" +#include "Geometry/EcalMapping/interface/EcalMappingRcd.h" + +class ECALRegFEDSelector : public edm::one::EDProducer<> { +public: + ECALRegFEDSelector(const edm::ParameterSet&); + ~ECALRegFEDSelector() override; + + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + +private: + void beginJob() override {} + void produce(edm::Event&, const edm::EventSetup&) override; + void endJob() override {} + + std::unique_ptr ec_mapping; + + double delta_; + bool fedSaved[1200]; + + edm::EDGetTokenT tok_raw_; + edm::EDGetTokenT tok_seed_; +}; + ECALRegFEDSelector::ECALRegFEDSelector(const edm::ParameterSet& iConfig) { tok_seed_ = consumes(iConfig.getParameter("regSeedLabel")); delta_ = iConfig.getParameter("delta"); @@ -95,6 +133,15 @@ void ECALRegFEDSelector::produce(edm::Event& iEvent, const edm::EventSetup& iSet iEvent.put(std::move(fedList)); } -void ECALRegFEDSelector::beginJob() {} +void ECALRegFEDSelector::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + desc.add("regSeedLabel", edm::InputTag("hltPixelIsolTrackFilter")); + desc.add("rawInputLabel", edm::InputTag("rawDataCollector")); + desc.add("delta", 1.0); + descriptions.add("ecalFED", desc); +} + +#include "FWCore/PluginManager/interface/ModuleDef.h" +#include "FWCore/Framework/interface/MakerMacros.h" -void ECALRegFEDSelector::endJob() {} +DEFINE_FWK_MODULE(ECALRegFEDSelector); diff --git a/Calibration/HcalIsolatedTrackReco/src/EcalIsolatedParticleCandidateProducer.cc b/Calibration/HcalIsolatedTrackReco/plugins/EcalIsolatedParticleCandidateProducer.cc similarity index 73% rename from Calibration/HcalIsolatedTrackReco/src/EcalIsolatedParticleCandidateProducer.cc rename to Calibration/HcalIsolatedTrackReco/plugins/EcalIsolatedParticleCandidateProducer.cc index f0d8fbad689d5..3496de76ed56f 100644 --- a/Calibration/HcalIsolatedTrackReco/src/EcalIsolatedParticleCandidateProducer.cc +++ b/Calibration/HcalIsolatedTrackReco/plugins/EcalIsolatedParticleCandidateProducer.cc @@ -22,17 +22,57 @@ // 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/EventSetup.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" #include "DataFormats/Common/interface/Ref.h" #include "DataFormats/DetId/interface/DetId.h" -#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" +#include "DataFormats/HLTReco/interface/TriggerFilterObjectWithRefs.h" +#include "DataFormats/HcalIsolatedTrack/interface/IsolatedPixelTrackCandidate.h" #include "Geometry/CaloTopology/interface/EcalBarrelTopology.h" -#include "Calibration/HcalIsolatedTrackReco/interface/EcalIsolatedParticleCandidateProducer.h" +#include "Geometry/CaloGeometry/interface/CaloGeometry.h" +#include "Geometry/Records/interface/CaloGeometryRecord.h" //#define EDM_ML_DEBUG +// +// class decleration +// + +class EcalIsolatedParticleCandidateProducer : public edm::global::EDProducer<> { +public: + explicit EcalIsolatedParticleCandidateProducer(const edm::ParameterSet&); + ~EcalIsolatedParticleCandidateProducer() override; + + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + +private: + void produce(edm::StreamID, edm::Event&, const edm::EventSetup&) const override; + void beginJob() override {} + void endJob() override {} + + double InConeSize_; + double OutConeSize_; + double hitCountEthr_; + double hitEthr_; + + edm::EDGetTokenT tok_l1tau_; + edm::EDGetTokenT tok_hlt_; + edm::EDGetTokenT tok_EB_; + edm::EDGetTokenT tok_EE_; + + edm::ESGetToken tok_geom_; + + // ----------member data --------------------------- +}; + EcalIsolatedParticleCandidateProducer::EcalIsolatedParticleCandidateProducer(const edm::ParameterSet& conf) { InConeSize_ = conf.getParameter("EcalInnerConeSize"); OutConeSize_ = conf.getParameter("EcalOuterConeSize"); @@ -199,8 +239,21 @@ void EcalIsolatedParticleCandidateProducer::produce(edm::StreamID, #endif iEvent.put(std::move(iptcCollection)); } -// ------------ method called once each job just before starting event loop ------------ -void EcalIsolatedParticleCandidateProducer::beginJob() {} -// ------------ method called once each job just after ending the event loop ------------ -void EcalIsolatedParticleCandidateProducer::endJob() {} +void EcalIsolatedParticleCandidateProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + desc.add("ECHitEnergyThreshold", 0.05); + desc.add("L1eTauJetsSource", edm::InputTag("l1extraParticles", "Tau")); + desc.add("L1GTSeedLabel", edm::InputTag("l1sIsolTrack")); + desc.add("EBrecHitCollectionLabel", edm::InputTag("ecalRecHit", "EcalRecHitsEB")); + desc.add("EErecHitCollectionLabel", edm::InputTag("ecalRecHit", "EcalRecHitsEE")); + desc.add("ECHitCountEnergyThreshold", 0.5); + desc.add("EcalInnerConeSize", 0.3); + desc.add("EcalOuterConeSize", 0.7); + descriptions.add("ecalIsolPartProd", desc); +} + +#include "FWCore/PluginManager/interface/ModuleDef.h" +#include "FWCore/Framework/interface/MakerMacros.h" + +DEFINE_FWK_MODULE(EcalIsolatedParticleCandidateProducer); diff --git a/Calibration/HcalIsolatedTrackReco/src/HITRegionalPixelSeedGenerator.h b/Calibration/HcalIsolatedTrackReco/plugins/HITRegionalPixelSeedGenerator.cc similarity index 72% rename from Calibration/HcalIsolatedTrackReco/src/HITRegionalPixelSeedGenerator.h rename to Calibration/HcalIsolatedTrackReco/plugins/HITRegionalPixelSeedGenerator.cc index b5ac83018ab28..6f3d57bc0d2b7 100644 --- a/Calibration/HcalIsolatedTrackReco/src/HITRegionalPixelSeedGenerator.h +++ b/Calibration/HcalIsolatedTrackReco/plugins/HITRegionalPixelSeedGenerator.cc @@ -1,6 +1,3 @@ -#ifndef HITRegionalPixelSeedGenerator_h -#define HITRegionalPixelSeedGenerator_h - // // Class: HITRegionalPixelSeedGenerator @@ -10,8 +7,11 @@ #include "DataFormats/Common/interface/Handle.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/Utilities/interface/InputTag.h" +#include "MagneticField/Engine/interface/MagneticField.h" +#include "MagneticField/Records/interface/IdealMagneticFieldRecord.h" +#include "RecoTracker/Record/interface/TrackerMultipleScatteringRecord.h" +#include "RecoTracker/TkMSParametrization/interface/MultipleScatteringParametrisationMaker.h" #include "RecoTracker/TkTrackingRegions/interface/TrackingRegionProducer.h" -#include "RecoTracker/TkTrackingRegions/interface/GlobalTrackingRegion.h" #include "RecoTracker/TkTrackingRegions/interface/RectangularEtaPhiTrackingRegion.h" #include "DataFormats/VertexReco/interface/Vertex.h" #include "DataFormats/VertexReco/interface/VertexFwd.h" @@ -34,10 +34,11 @@ class HITRegionalPixelSeedGenerator : public TrackingRegionProducer { public: - explicit HITRegionalPixelSeedGenerator(const edm::ParameterSet& conf_, edm::ConsumesCollector&& iC) { + explicit HITRegionalPixelSeedGenerator(const edm::ParameterSet& conf, edm::ConsumesCollector&& iC) + : token_bfield(iC.esConsumes()), token_msmaker(iC.esConsumes()) { edm::LogVerbatim("HITRegionalPixelSeedGenerator") << "Enter the HITRegionalPixelSeedGenerator"; - edm::ParameterSet regionPSet = conf_.getParameter("RegionPSet"); + edm::ParameterSet regionPSet = conf.getParameter("RegionPSet"); ptmin = regionPSet.getParameter("ptMin"); originradius = regionPSet.getParameter("originRadius"); @@ -72,6 +73,9 @@ class HITRegionalPixelSeedGenerator : public TrackingRegionProducer { double deltaZVertex = halflength; + auto const& bfield = es.getData(token_bfield); + auto const& msmaker = es.getData(token_msmaker); + if (usetracks_) { edm::Handle tracks; e.getByToken(token_trks, tracks); @@ -96,8 +100,15 @@ class HITRegionalPixelSeedGenerator : public TrackingRegionProducer { GlobalVector ptrVec((itr)->px(), (itr)->py(), (itr)->pz()); globalVector = ptrVec; - result.push_back(std::make_unique( - globalVector, GlobalPoint(0, 0, originz), ptmin, originradius, deltaZVertex, deltaTrackEta, deltaTrackPhi)); + result.push_back(std::make_unique(globalVector, + GlobalPoint(0, 0, originz), + ptmin, + originradius, + deltaZVertex, + deltaTrackEta, + deltaTrackPhi, + bfield, + &msmaker)); } } @@ -130,8 +141,15 @@ class HITRegionalPixelSeedGenerator : public TrackingRegionProducer { (isoPixTrackRefs[p]->track())->pz()); globalVector = ptrVec; - result.push_back(std::make_unique( - globalVector, GlobalPoint(0, 0, originz), ptmin, originradius, deltaZVertex, deltaTrackEta, deltaTrackPhi)); + result.push_back(std::make_unique(globalVector, + GlobalPoint(0, 0, originz), + ptmin, + originradius, + deltaZVertex, + deltaTrackEta, + deltaTrackPhi, + bfield, + &msmaker)); } } @@ -158,7 +176,7 @@ class HITRegionalPixelSeedGenerator : public TrackingRegionProducer { GlobalPoint vertex(0, 0, originz); result.push_back(std::make_unique( - jetVector, vertex, ptmin, originradius, deltaZVertex, deltaL1JetEta, deltaL1JetPhi)); + jetVector, vertex, ptmin, originradius, deltaZVertex, deltaL1JetEta, deltaL1JetPhi, bfield, &msmaker)); } } if (fixedReg_) { @@ -170,23 +188,21 @@ class HITRegionalPixelSeedGenerator : public TrackingRegionProducer { edm::Handle vertices; e.getByToken(token_vertex, vertices); const reco::VertexCollection vertCollection = *(vertices.product()); - reco::VertexCollection::const_iterator ci = vertCollection.begin(); if (!vertCollection.empty()) { - originz = ci->z(); + // reco::VertexCollection::const_iterator ci = vertCollection.begin(); + // originz = ci->z(); } else { deltaZVertex = 15.; } result.push_back(std::make_unique( - fixedVector, vertex, ptmin, originradius, deltaZVertex, deltaL1JetEta, deltaL1JetPhi)); + fixedVector, vertex, ptmin, originradius, deltaZVertex, deltaL1JetEta, deltaL1JetPhi, bfield, &msmaker)); } return result; } private: - edm::ParameterSet conf_; - float ptmin; float originradius; float halflength; @@ -204,6 +220,13 @@ class HITRegionalPixelSeedGenerator : public TrackingRegionProducer { edm::EDGetTokenT token_vertex; edm::EDGetTokenT token_isoTrack; edm::EDGetTokenT token_l1jet; + edm::ESGetToken token_bfield; + edm::ESGetToken token_msmaker; }; -#endif +#include "FWCore/PluginManager/interface/ModuleDef.h" +#include "FWCore/Framework/interface/MakerMacros.h" +#include "RecoTracker/TkTrackingRegions/interface/TrackingRegionProducerFactory.h" +#include "RecoTracker/TkTrackingRegions/interface/TrackingRegionProducer.h" +# +DEFINE_EDM_PLUGIN(TrackingRegionProducerFactory, HITRegionalPixelSeedGenerator, "HITRegionalPixelSeedGenerator"); diff --git a/Calibration/HcalIsolatedTrackReco/src/IPTCorrector.cc b/Calibration/HcalIsolatedTrackReco/plugins/IPTCorrector.cc similarity index 74% rename from Calibration/HcalIsolatedTrackReco/src/IPTCorrector.cc rename to Calibration/HcalIsolatedTrackReco/plugins/IPTCorrector.cc index 662815bb4ea80..9634fd860c38e 100644 --- a/Calibration/HcalIsolatedTrackReco/src/IPTCorrector.cc +++ b/Calibration/HcalIsolatedTrackReco/plugins/IPTCorrector.cc @@ -1,22 +1,50 @@ +/* \class IsolatedPixelTrackCorrector + * + * + */ + #include #include #include -// Class header file -#include "Calibration/HcalIsolatedTrackReco/interface/IPTCorrector.h" +#include "DataFormats/Common/interface/Handle.h" +#include "DataFormats/Common/interface/Ref.h" +#include "DataFormats/Common/interface/TriggerResults.h" +#include "DataFormats/HcalIsolatedTrack/interface/IsolatedPixelTrackCandidate.h" #include "DataFormats/HcalIsolatedTrack/interface/IsolatedPixelTrackCandidateFwd.h" +#include "DataFormats/HLTReco/interface/TriggerFilterObjectWithRefs.h" +#include "DataFormats/Math/interface/deltaR.h" +#include "DataFormats/TrackReco/interface/Track.h" + // Framework -#include "DataFormats/Common/interface/Handle.h" +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/global/EDProducer.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" #include "FWCore/ParameterSet/interface/ParameterSetDescription.h" #include "FWCore/Utilities/interface/Exception.h" // -#include "DataFormats/Common/interface/TriggerResults.h" /// // Math #include "Math/GenVector/VectorUtil.h" #include "Math/GenVector/PxPyPzE4D.h" -#include "DataFormats/Math/interface/deltaR.h" + +class IPTCorrector : public edm::global::EDProducer<> { +public: + IPTCorrector(const edm::ParameterSet& ps); + + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + + void produce(edm::StreamID, edm::Event&, edm::EventSetup const&) const override; + +private: + const edm::EDGetTokenT tok_cor_; + const edm::EDGetTokenT tok_uncor_; + const double assocCone_; +}; IPTCorrector::IPTCorrector(const edm::ParameterSet& config) : tok_cor_(consumes(config.getParameter("corTracksLabel"))), @@ -88,3 +116,8 @@ void IPTCorrector::produce(edm::StreamID, edm::Event& theEvent, edm::EventSetup // put the product in the event theEvent.put(std::move(trackCollection)); } + +#include "FWCore/PluginManager/interface/ModuleDef.h" +#include "FWCore/Framework/interface/MakerMacros.h" + +DEFINE_FWK_MODULE(IPTCorrector); diff --git a/Calibration/HcalIsolatedTrackReco/src/IsolatedEcalPixelTrackCandidateProducer.cc b/Calibration/HcalIsolatedTrackReco/plugins/IsolatedEcalPixelTrackCandidateProducer.cc similarity index 82% rename from Calibration/HcalIsolatedTrackReco/src/IsolatedEcalPixelTrackCandidateProducer.cc rename to Calibration/HcalIsolatedTrackReco/plugins/IsolatedEcalPixelTrackCandidateProducer.cc index c2268e29c5d7e..ec7389e62cef7 100644 --- a/Calibration/HcalIsolatedTrackReco/src/IsolatedEcalPixelTrackCandidateProducer.cc +++ b/Calibration/HcalIsolatedTrackReco/plugins/IsolatedEcalPixelTrackCandidateProducer.cc @@ -22,17 +22,55 @@ #include // user include files - -#include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/MessageLogger/interface/MessageLogger.h" #include "DataFormats/Common/interface/Ref.h" #include "DataFormats/DetId/interface/DetId.h" #include "DataFormats/Math/interface/deltaR.h" +#include "DataFormats/HcalIsolatedTrack/interface/IsolatedPixelTrackCandidate.h" +#include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" +#include "DataFormats/HLTReco/interface/TriggerFilterObjectWithRefs.h" + +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/global/EDProducer.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" -#include "Calibration/HcalIsolatedTrackReco/interface/IsolatedEcalPixelTrackCandidateProducer.h" +#include "Geometry/CaloGeometry/interface/CaloGeometry.h" +#include "Geometry/Records/interface/CaloGeometryRecord.h" //#define EDM_ML_DEBUG +// +// class decleration +// + +class IsolatedEcalPixelTrackCandidateProducer : public edm::global::EDProducer<> { +public: + explicit IsolatedEcalPixelTrackCandidateProducer(const edm::ParameterSet&); + ~IsolatedEcalPixelTrackCandidateProducer() override; + + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + +private: + void produce(edm::StreamID, edm::Event&, const edm::EventSetup&) const override; + + const edm::EDGetTokenT tok_ee; + const edm::EDGetTokenT tok_eb; + const edm::EDGetTokenT tok_trigcand; + const edm::ESGetToken tok_geom_; + const double coneSizeEta0_; + const double coneSizeEta1_; + const double hitCountEthrEB_; + const double hitEthrEB_; + const double fachitCountEE_; + const double hitEthrEE0_; + const double hitEthrEE1_; + const double hitEthrEE2_; + const double hitEthrEE3_; +}; + IsolatedEcalPixelTrackCandidateProducer::IsolatedEcalPixelTrackCandidateProducer(const edm::ParameterSet& conf) : tok_ee(consumes(conf.getParameter("EERecHitSource"))), tok_eb(consumes(conf.getParameter("EBRecHitSource"))), @@ -180,3 +218,8 @@ void IsolatedEcalPixelTrackCandidateProducer::produce(edm::StreamID, #endif iEvent.put(std::move(iptcCollection)); } + +#include "FWCore/PluginManager/interface/ModuleDef.h" +#include "FWCore/Framework/interface/MakerMacros.h" + +DEFINE_FWK_MODULE(IsolatedEcalPixelTrackCandidateProducer); diff --git a/Calibration/HcalIsolatedTrackReco/src/IsolatedPixelTrackCandidateL1TProducer.cc b/Calibration/HcalIsolatedTrackReco/plugins/IsolatedPixelTrackCandidateL1TProducer.cc similarity index 81% rename from Calibration/HcalIsolatedTrackReco/src/IsolatedPixelTrackCandidateL1TProducer.cc rename to Calibration/HcalIsolatedTrackReco/plugins/IsolatedPixelTrackCandidateL1TProducer.cc index bd265461722ef..e8d05998c2c80 100644 --- a/Calibration/HcalIsolatedTrackReco/src/IsolatedPixelTrackCandidateL1TProducer.cc +++ b/Calibration/HcalIsolatedTrackReco/plugins/IsolatedPixelTrackCandidateL1TProducer.cc @@ -1,14 +1,43 @@ +/* \class IsolatedPixelTrackCandidateL1TProducer + * + * + */ + #include #include #include #include -// Class header file -#include "Calibration/HcalIsolatedTrackReco/interface/IsolatedPixelTrackCandidateL1TProducer.h" -#include "DataFormats/HcalIsolatedTrack/interface/IsolatedPixelTrackCandidateFwd.h" -// Framework #include "DataFormats/Common/interface/Handle.h" +#include "DataFormats/Common/interface/Ref.h" +#include "DataFormats/DetId/interface/DetId.h" +#include "DataFormats/TrackReco/interface/Track.h" +#include "DataFormats/HcalIsolatedTrack/interface/IsolatedPixelTrackCandidate.h" +#include "DataFormats/Common/interface/TriggerResults.h" +// L1Extra +#include "DataFormats/L1Trigger/interface/L1EmParticle.h" +#include "DataFormats/L1Trigger/interface/L1JetParticle.h" +// l1t +#include "DataFormats/L1Trigger/interface/Jet.h" +#include "DataFormats/L1Trigger/interface/Tau.h" +#include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutSetupFwd.h" +#include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutRecord.h" +#include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerObjectMapRecord.h" +#include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerObjectMapFwd.h" +#include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerObjectMap.h" +#include "DataFormats/HLTReco/interface/TriggerFilterObjectWithRefs.h" +//vertices +#include "DataFormats/VertexReco/interface/Vertex.h" +#include "DataFormats/VertexReco/interface/VertexFwd.h" + +// Framework +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/stream/EDProducer.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" #include "FWCore/ParameterSet/interface/ParameterSetDescription.h" #include "FWCore/Utilities/interface/Exception.h" #include "FWCore/Utilities/interface/transform.h" @@ -20,14 +49,63 @@ //magF #include "MagneticField/VolumeBasedEngine/interface/VolumeBasedMagneticField.h" +#include "MagneticField/Engine/interface/MagneticField.h" +#include "MagneticField/Records/interface/IdealMagneticFieldRecord.h" //for ECAL geometry +#include "Geometry/CaloGeometry/interface/CaloGeometry.h" +#include "Geometry/Records/interface/CaloGeometryRecord.h" #include "Geometry/EcalAlgo/interface/EcalBarrelGeometry.h" #include "Geometry/EcalAlgo/interface/EcalEndcapGeometry.h" #include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h" //#define EDM_ML_DEBUG +class IsolatedPixelTrackCandidateL1TProducer : public edm::stream::EDProducer<> { +public: + IsolatedPixelTrackCandidateL1TProducer(const edm::ParameterSet& ps); + ~IsolatedPixelTrackCandidateL1TProducer() override; + + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + + void beginRun(const edm::Run&, const edm::EventSetup&) override; + void produce(edm::Event& evt, const edm::EventSetup& es) override; + + double getDistInCM(double eta1, double phi1, double eta2, double phi2); + std::pair GetEtaPhiAtEcal(double etaIP, double phiIP, double pT, int charge, double vtxZ); + +private: + struct seedAtEC { + seedAtEC(unsigned int i, bool f, double et, double fi) : index(i), ok(f), eta(et), phi(fi) {} + unsigned int index; + bool ok; + double eta, phi; + }; + + const edm::EDGetTokenT tok_hlt_; + const edm::EDGetTokenT tok_l1_; + const edm::EDGetTokenT tok_vert_; + const std::vector > toks_pix_; + const edm::ESGetToken tok_bFieldH_; + const edm::ESGetToken tok_geom_; + + const std::string bfield_; + const double prelimCone_; + const double pixelIsolationConeSizeAtEC_; + const double vtxCutSeed_; + const double vtxCutIsol_; + const double tauAssocCone_; + const double tauUnbiasCone_; + const double minPTrackValue_; + const double maxPForIsolationValue_; + const double ebEtaBoundary_; + + // these are read from the EventSetup, cannot be const + double rEB_; + double zEE_; + double bfVal_; +}; + IsolatedPixelTrackCandidateL1TProducer::IsolatedPixelTrackCandidateL1TProducer(const edm::ParameterSet& config) : tok_hlt_(consumes(config.getParameter("L1GTSeedLabel"))), tok_l1_(consumes(config.getParameter("L1eTauJetsSource"))), @@ -368,3 +446,7 @@ std::pair IsolatedPixelTrackCandidateL1TProducer::GetEtaPhiAtEca std::pair retVal(etaEC, phiEC); return retVal; } +#include "FWCore/PluginManager/interface/ModuleDef.h" +#include "FWCore/Framework/interface/MakerMacros.h" + +DEFINE_FWK_MODULE(IsolatedPixelTrackCandidateL1TProducer); diff --git a/Calibration/HcalIsolatedTrackReco/src/IsolatedPixelTrackCandidateProducer.cc b/Calibration/HcalIsolatedTrackReco/plugins/IsolatedPixelTrackCandidateProducer.cc similarity index 79% rename from Calibration/HcalIsolatedTrackReco/src/IsolatedPixelTrackCandidateProducer.cc rename to Calibration/HcalIsolatedTrackReco/plugins/IsolatedPixelTrackCandidateProducer.cc index b160c03ccf954..d5daf4b19a099 100644 --- a/Calibration/HcalIsolatedTrackReco/src/IsolatedPixelTrackCandidateProducer.cc +++ b/Calibration/HcalIsolatedTrackReco/plugins/IsolatedPixelTrackCandidateProducer.cc @@ -1,14 +1,42 @@ +/* \class IsolatedPixelTrackCandidateProducer + * + * + */ + #include #include #include #include -// Class header file -#include "Calibration/HcalIsolatedTrackReco/interface/IsolatedPixelTrackCandidateProducer.h" +#include "DataFormats/Common/interface/Handle.h" +#include "DataFormats/Common/interface/Ref.h" +#include "DataFormats/DetId/interface/DetId.h" #include "DataFormats/HcalIsolatedTrack/interface/IsolatedPixelTrackCandidateFwd.h" +#include "DataFormats/TrackReco/interface/Track.h" +#include "DataFormats/L1Trigger/interface/L1JetParticle.h" +#include "DataFormats/HcalIsolatedTrack/interface/IsolatedPixelTrackCandidate.h" +#include "DataFormats/Common/interface/TriggerResults.h" +// L1Extra +#include "DataFormats/L1Trigger/interface/L1EmParticle.h" +#include "DataFormats/L1Trigger/interface/L1JetParticleFwd.h" +#include "DataFormats/HLTReco/interface/TriggerFilterObjectWithRefs.h" + +#include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutSetupFwd.h" +#include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutRecord.h" +#include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerObjectMapRecord.h" +#include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerObjectMapFwd.h" +#include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerObjectMap.h" +//vertices +#include "DataFormats/VertexReco/interface/Vertex.h" +#include "DataFormats/VertexReco/interface/VertexFwd.h" // Framework -#include "DataFormats/Common/interface/Handle.h" +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/stream/EDProducer.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" #include "FWCore/ParameterSet/interface/ParameterSetDescription.h" #include "FWCore/Utilities/interface/Exception.h" #include "FWCore/Utilities/interface/transform.h" @@ -20,14 +48,63 @@ //magF #include "MagneticField/VolumeBasedEngine/interface/VolumeBasedMagneticField.h" +#include "MagneticField/Engine/interface/MagneticField.h" +#include "MagneticField/Records/interface/IdealMagneticFieldRecord.h" //for ECAL geometry #include "Geometry/EcalAlgo/interface/EcalBarrelGeometry.h" #include "Geometry/EcalAlgo/interface/EcalEndcapGeometry.h" #include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h" +#include "Geometry/CaloGeometry/interface/CaloGeometry.h" +#include "Geometry/Records/interface/CaloGeometryRecord.h" //#define EDM_ML_DEBUG +class IsolatedPixelTrackCandidateProducer : public edm::stream::EDProducer<> { +public: + IsolatedPixelTrackCandidateProducer(const edm::ParameterSet& ps); + ~IsolatedPixelTrackCandidateProducer() override; + + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + + void beginRun(const edm::Run&, const edm::EventSetup&) override; + void produce(edm::Event& evt, const edm::EventSetup& es) override; + + double getDistInCM(double eta1, double phi1, double eta2, double phi2); + std::pair GetEtaPhiAtEcal(double etaIP, double phiIP, double pT, int charge, double vtxZ); + +private: + struct seedAtEC { + seedAtEC(unsigned int i, bool f, double et, double fi) : index(i), ok(f), eta(et), phi(fi) {} + unsigned int index; + bool ok; + double eta, phi; + }; + + const edm::EDGetTokenT tok_hlt_; + const edm::EDGetTokenT tok_l1_; + const edm::EDGetTokenT tok_vert_; + const std::vector > toks_pix_; + const edm::ESGetToken tok_bFieldH_; + const edm::ESGetToken tok_geom_; + + const std::string bfield_; + const double prelimCone_; + const double pixelIsolationConeSizeAtEC_; + const double vtxCutSeed_; + const double vtxCutIsol_; + const double tauAssocCone_; + const double tauUnbiasCone_; + const double minPTrackValue_; + const double maxPForIsolationValue_; + const double ebEtaBoundary_; + + // these are read from the EventSetup, cannot be const + double rEB_; + double zEE_; + double bfVal_; +}; + IsolatedPixelTrackCandidateProducer::IsolatedPixelTrackCandidateProducer(const edm::ParameterSet& config) : tok_hlt_(consumes(config.getParameter("L1GTSeedLabel"))), tok_l1_(consumes(config.getParameter("L1eTauJetsSource"))), @@ -325,3 +402,8 @@ std::pair IsolatedPixelTrackCandidateProducer::GetEtaPhiAtEcal( std::pair retVal(etaEC, phiEC); return retVal; } + +#include "FWCore/PluginManager/interface/ModuleDef.h" +#include "FWCore/Framework/interface/MakerMacros.h" + +DEFINE_FWK_MODULE(IsolatedPixelTrackCandidateProducer); diff --git a/Calibration/HcalIsolatedTrackReco/src/SiStripRegFEDSelector.cc b/Calibration/HcalIsolatedTrackReco/plugins/SiStripRegFEDSelector.cc similarity index 69% rename from Calibration/HcalIsolatedTrackReco/src/SiStripRegFEDSelector.cc rename to Calibration/HcalIsolatedTrackReco/plugins/SiStripRegFEDSelector.cc index 55f915c08637f..bfe6f0905e202 100644 --- a/Calibration/HcalIsolatedTrackReco/src/SiStripRegFEDSelector.cc +++ b/Calibration/HcalIsolatedTrackReco/plugins/SiStripRegFEDSelector.cc @@ -1,9 +1,41 @@ +// system include files +#include -#include "Calibration/HcalIsolatedTrackReco/interface/SiStripRegFEDSelector.h" +// user include files +#include "CalibFormats/SiStripObjects/interface/SiStripRegionCabling.h" +#include "CalibTracker/Records/interface/SiStripRegionCablingRcd.h" #include "CondFormats/SiStripObjects/interface/FedChannelConnection.h" +#include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h" +#include "DataFormats/FEDRawData/interface/FEDRawData.h" +#include "DataFormats/FEDRawData/interface/FEDNumbering.h" #include "DataFormats/HcalIsolatedTrack/interface/IsolatedPixelTrackCandidate.h" #include "DataFormats/HcalIsolatedTrack/interface/IsolatedPixelTrackCandidateFwd.h" +#include "DataFormats/HLTReco/interface/TriggerFilterObjectWithRefs.h" + +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/global/EDProducer.h" +#include "FWCore/Framework/interface/Event.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" + +class SiStripRegFEDSelector : public edm::global::EDProducer<> { +public: + SiStripRegFEDSelector(const edm::ParameterSet&); + ~SiStripRegFEDSelector() override; + + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + +private: + void beginJob() override {} + void produce(edm::StreamID, edm::Event&, const edm::EventSetup&) const override; + void endJob() override {} + + const edm::EDGetTokenT tok_seed_; + const edm::EDGetTokenT tok_raw_; + const edm::ESGetToken tok_strip_; + const double delta_; +}; SiStripRegFEDSelector::SiStripRegFEDSelector(const edm::ParameterSet& iConfig) : tok_seed_(consumes(iConfig.getParameter("regSeedLabel"))), @@ -15,7 +47,7 @@ SiStripRegFEDSelector::SiStripRegFEDSelector(const edm::ParameterSet& iConfig) SiStripRegFEDSelector::~SiStripRegFEDSelector() {} -void SiStripRegFEDSelector::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { +void SiStripRegFEDSelector::produce(edm::StreamID, edm::Event& iEvent, const edm::EventSetup& iSetup) const { auto producedData = std::make_unique(); edm::Handle trigSeedTrks; @@ -120,6 +152,15 @@ void SiStripRegFEDSelector::produce(edm::Event& iEvent, const edm::EventSetup& i iEvent.put(std::move(producedData)); } -void SiStripRegFEDSelector::beginJob() {} +void SiStripRegFEDSelector::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + desc.add("regSeedLabel", edm::InputTag("hltIsolPixelTrackFilter")); + desc.add("rawInputLabel", edm::InputTag("rawDataCollector")); + desc.add("delta", 1.0); + descriptions.add("stripFED", desc); +} + +#include "FWCore/PluginManager/interface/ModuleDef.h" +#include "FWCore/Framework/interface/MakerMacros.h" -void SiStripRegFEDSelector::endJob() {} +DEFINE_FWK_MODULE(SiStripRegFEDSelector); diff --git a/Calibration/HcalIsolatedTrackReco/src/SubdetFEDSelector.cc b/Calibration/HcalIsolatedTrackReco/plugins/SubdetFEDSelector.cc similarity index 75% rename from Calibration/HcalIsolatedTrackReco/src/SubdetFEDSelector.cc rename to Calibration/HcalIsolatedTrackReco/plugins/SubdetFEDSelector.cc index 2c297312d6945..6765186ffec15 100644 --- a/Calibration/HcalIsolatedTrackReco/src/SubdetFEDSelector.cc +++ b/Calibration/HcalIsolatedTrackReco/plugins/SubdetFEDSelector.cc @@ -1,5 +1,37 @@ - -#include "Calibration/HcalIsolatedTrackReco/interface/SubdetFEDSelector.h" +// user include files +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/global/EDProducer.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" + +#include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h" +#include "DataFormats/FEDRawData/interface/FEDRawData.h" +#include "DataFormats/FEDRawData/interface/FEDNumbering.h" + +#include "EventFilter/RawDataCollector/interface/RawDataFEDSelector.h" + +class SubdetFEDSelector : public edm::global::EDProducer<> { +public: + SubdetFEDSelector(const edm::ParameterSet&); + ~SubdetFEDSelector() override; + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + +private: + void beginJob() override {} + void produce(edm::StreamID, edm::Event&, const edm::EventSetup&) const override; + void endJob() override {} + + // ----------member data --------------------------- + bool getEcal_; + bool getHcal_; + bool getStrip_; + bool getPixel_; + bool getMuon_; + bool getTrigger_; + + edm::EDGetTokenT tok_raw_; +}; SubdetFEDSelector::SubdetFEDSelector(const edm::ParameterSet& iConfig) { getEcal_ = iConfig.getParameter("getECAL"); @@ -16,7 +48,7 @@ SubdetFEDSelector::SubdetFEDSelector(const edm::ParameterSet& iConfig) { SubdetFEDSelector::~SubdetFEDSelector() {} -void SubdetFEDSelector::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { +void SubdetFEDSelector::produce(edm::StreamID, edm::Event& iEvent, const edm::EventSetup& iSetup) const { auto producedData = std::make_unique(); edm::Handle rawIn; @@ -171,8 +203,19 @@ void SubdetFEDSelector::produce(edm::Event& iEvent, const edm::EventSetup& iSetu iEvent.put(std::move(producedData)); } -// ------------ method called once each job just before starting event loop ------------ -void SubdetFEDSelector::beginJob() {} +void SubdetFEDSelector::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + desc.add("rawInputLabel", edm::InputTag("rawDataCollector")); + desc.add("getSiPixel", true); + desc.add("getHCAL", true); + desc.add("getECAL", false); + desc.add("getMuon", false); + desc.add("getTrigger", true); + desc.add("getSiStrip", false); + descriptions.add("subdetFED", desc); +} + +#include "FWCore/PluginManager/interface/ModuleDef.h" +#include "FWCore/Framework/interface/MakerMacros.h" -// ------------ method called once each job just after ending the event loop ------------ -void SubdetFEDSelector::endJob() {} +DEFINE_FWK_MODULE(SubdetFEDSelector); diff --git a/Calibration/HcalIsolatedTrackReco/python/ecalFED_cfi.py b/Calibration/HcalIsolatedTrackReco/python/ecalFED_cfi.py deleted file mode 100644 index 0ab6f02a26f33..0000000000000 --- a/Calibration/HcalIsolatedTrackReco/python/ecalFED_cfi.py +++ /dev/null @@ -1,9 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -ecalFED = cms.EDProducer("ECALRegFEDSelector", - regSeedLabel = cms.InputTag("hltPixelIsolTrackFilter"), - rawInputLabel = cms.InputTag("rawDataCollector"), - delta = cms.double(1.0) -) - - diff --git a/Calibration/HcalIsolatedTrackReco/python/ecalIsolPartProd_cfi.py b/Calibration/HcalIsolatedTrackReco/python/ecalIsolPartProd_cfi.py deleted file mode 100644 index e218cb7f8d245..0000000000000 --- a/Calibration/HcalIsolatedTrackReco/python/ecalIsolPartProd_cfi.py +++ /dev/null @@ -1,14 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -ecalIsolPartProd = cms.EDProducer("EcalIsolatedParticleCandidateProducer", - ECHitEnergyThreshold = cms.double(0.05), - L1eTauJetsSource = cms.InputTag("l1extraParticles","Tau"), - L1GTSeedLabel = cms.InputTag("l1sIsolTrack"), - EBrecHitCollectionLabel = cms.InputTag("ecalRecHit","EcalRecHitsEB"), - ECHitCountEnergyThreshold = cms.double(0.5), - EcalInnerConeSize = cms.double(0.3), - EcalOuterConeSize = cms.double(0.7), - EErecHitCollectionLabel = cms.InputTag("ecalRecHit","EcalRecHitsEE") -) - - diff --git a/Calibration/HcalIsolatedTrackReco/python/stripFED_cfi.py b/Calibration/HcalIsolatedTrackReco/python/stripFED_cfi.py deleted file mode 100644 index 4ae59c5a924bb..0000000000000 --- a/Calibration/HcalIsolatedTrackReco/python/stripFED_cfi.py +++ /dev/null @@ -1,9 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -stripFED = cms.EDProducer("SiStripRegFEDSelector", - regSeedLabel = cms.InputTag("hltIsolPixelTrackFilter"), - rawInputLabel = cms.InputTag("rawDataCollector"), - delta = cms.double(1.0) -) - - diff --git a/Calibration/HcalIsolatedTrackReco/python/subdetFED_cfi.py b/Calibration/HcalIsolatedTrackReco/python/subdetFED_cfi.py deleted file mode 100644 index c88c735118fb5..0000000000000 --- a/Calibration/HcalIsolatedTrackReco/python/subdetFED_cfi.py +++ /dev/null @@ -1,13 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -subdetFED = cms.EDProducer("SubdetFEDSelector", - rawInputLabel = cms.InputTag("rawDataCollector"), - getSiPixel = cms.bool(True), - getHCAL = cms.bool(True), - getECAL = cms.bool(False), - getMuon = cms.bool(False), - getTrigger = cms.bool(True), - getSiStrip = cms.bool(False) -) - - diff --git a/Calibration/HcalIsolatedTrackReco/src/SealModule.cc b/Calibration/HcalIsolatedTrackReco/src/SealModule.cc deleted file mode 100644 index cc0f9cb28b225..0000000000000 --- a/Calibration/HcalIsolatedTrackReco/src/SealModule.cc +++ /dev/null @@ -1,24 +0,0 @@ -#include "FWCore/PluginManager/interface/ModuleDef.h" -#include "FWCore/Framework/interface/MakerMacros.h" -#include "Calibration/HcalIsolatedTrackReco/interface/IsolatedPixelTrackCandidateProducer.h" -#include "Calibration/HcalIsolatedTrackReco/interface/IsolatedPixelTrackCandidateL1TProducer.h" -#include "Calibration/HcalIsolatedTrackReco/interface/IsolatedEcalPixelTrackCandidateProducer.h" -#include "Calibration/HcalIsolatedTrackReco/interface/EcalIsolatedParticleCandidateProducer.h" -#include "RecoTracker/TkTrackingRegions/interface/TrackingRegionProducerFactory.h" -#include "RecoTracker/TkTrackingRegions/interface/TrackingRegionProducer.h" -#include "Calibration/HcalIsolatedTrackReco/interface/SiStripRegFEDSelector.h" -#include "Calibration/HcalIsolatedTrackReco/interface/ECALRegFEDSelector.h" -#include "Calibration/HcalIsolatedTrackReco/interface/SubdetFEDSelector.h" -#include "HITRegionalPixelSeedGenerator.h" -#include "Calibration/HcalIsolatedTrackReco/interface/IPTCorrector.h" - -DEFINE_EDM_PLUGIN(TrackingRegionProducerFactory, HITRegionalPixelSeedGenerator, "HITRegionalPixelSeedGenerator"); -// -DEFINE_FWK_MODULE(IsolatedPixelTrackCandidateProducer); -DEFINE_FWK_MODULE(IsolatedPixelTrackCandidateL1TProducer); -DEFINE_FWK_MODULE(IsolatedEcalPixelTrackCandidateProducer); -DEFINE_FWK_MODULE(EcalIsolatedParticleCandidateProducer); -DEFINE_FWK_MODULE(SiStripRegFEDSelector); -DEFINE_FWK_MODULE(ECALRegFEDSelector); -DEFINE_FWK_MODULE(SubdetFEDSelector); -DEFINE_FWK_MODULE(IPTCorrector); diff --git a/Calibration/LumiAlCaRecoProducers/plugins/CorrPCCProducer.cc b/Calibration/LumiAlCaRecoProducers/plugins/CorrPCCProducer.cc index 771cf1b647fd9..7295d4ef88af8 100644 --- a/Calibration/LumiAlCaRecoProducers/plugins/CorrPCCProducer.cc +++ b/Calibration/LumiAlCaRecoProducers/plugins/CorrPCCProducer.cc @@ -580,8 +580,6 @@ void CorrPCCProducer::dqmEndRunProduce(edm::Run const& runSeg, const edm::EventS throw std::runtime_error("PoolDBService required."); } - delete pccCorrections; - histoFile->cd(); corrlumiAvg_h->Write(); scaleFactorAvg_h->Write(); diff --git a/Calibration/TkAlCaRecoProducers/plugins/CalibrationTrackSelectorModule.cc b/Calibration/TkAlCaRecoProducers/plugins/CalibrationTrackSelectorModule.cc index 0284415aec6af..28adf6f692bfa 100644 --- a/Calibration/TkAlCaRecoProducers/plugins/CalibrationTrackSelectorModule.cc +++ b/Calibration/TkAlCaRecoProducers/plugins/CalibrationTrackSelectorModule.cc @@ -1,5 +1,5 @@ -#include "CommonTools/UtilAlgos/interface/ObjectSelectorStream.h" +#include "CommonTools/UtilAlgos/interface/ObjectSelector.h" #include "FWCore/Framework/interface/ConsumesCollector.h" #include "FWCore/Framework/interface/MakerMacros.h" @@ -44,6 +44,6 @@ struct SiStripCalTrackConfigSelector { CalibrationTrackSelector theBaseSelector; }; -typedef ObjectSelectorStream CalibrationTrackSelectorModule; +typedef ObjectSelector CalibrationTrackSelectorModule; DEFINE_FWK_MODULE(CalibrationTrackSelectorModule); diff --git a/Calibration/TkAlCaRecoProducers/python/ALCARECOPromptCalibProdSiPixelLorentzAngle_Output_cff.py b/Calibration/TkAlCaRecoProducers/python/ALCARECOPromptCalibProdSiPixelLorentzAngle_Output_cff.py new file mode 100644 index 0000000000000..d1894e8c425b2 --- /dev/null +++ b/Calibration/TkAlCaRecoProducers/python/ALCARECOPromptCalibProdSiPixelLorentzAngle_Output_cff.py @@ -0,0 +1,13 @@ +import FWCore.ParameterSet.Config as cms + +OutALCARECOPromptCalibProdSiPixelLorentzAngle_noDrop = cms.PSet( + SelectEvents = cms.untracked.PSet( + SelectEvents = cms.vstring('pathALCARECOPromptCalibProdSiPixelLorentzAngle') + ), + outputCommands = cms.untracked.vstring( + 'keep *_alcaBeamSpotProducer_*_*', + 'keep *_MEtoEDMConvertSiPixelLorentzAngle_*_*', + ) +) +OutALCARECOPromptCalibProdSiPixelLorentzAngle=OutALCARECOPromptCalibProdSiPixelLorentzAngle_noDrop.clone() +OutALCARECOPromptCalibProdSiPixelLorentzAngle.outputCommands.insert(0, "drop *") diff --git a/Calibration/TkAlCaRecoProducers/python/ALCARECOPromptCalibProdSiPixelLorentzAngle_cff.py b/Calibration/TkAlCaRecoProducers/python/ALCARECOPromptCalibProdSiPixelLorentzAngle_cff.py new file mode 100644 index 0000000000000..d7de69d618d6d --- /dev/null +++ b/Calibration/TkAlCaRecoProducers/python/ALCARECOPromptCalibProdSiPixelLorentzAngle_cff.py @@ -0,0 +1,70 @@ +import FWCore.ParameterSet.Config as cms + +# ------------------------------------------------------------------------------ +# configure a filter to run only on the events selected by SiPixelCalSingleMuonLoose AlcaReco +import copy +from HLTrigger.HLTfilters.hltHighLevel_cfi import * +ALCARECOCalSignleMuonFilterForSiPixelLorentzAngle = copy.deepcopy(hltHighLevel) +ALCARECOCalSignleMuonFilterForSiPixelLorentzAngle.HLTPaths = ['pathALCARECOSiPixelCalSingleMuon'] +ALCARECOCalSignleMuonFilterForSiPixelLorentzAngle.throw = True ## dont throw on unknown path names +ALCARECOCalSignleMuonFilterForSiPixelLorentzAngle.TriggerResultsTag = cms.InputTag("TriggerResults","","RECO") + +# ------------------------------------------------------------------------------ +# This is the sequence for track refitting of the track saved by SiPixelCalSingleMuonLoose +# to have access to transient objects produced during RECO step and not saved + +from Alignment.CommonAlignmentProducer.AlignmentTrackSelector_cfi import * +ALCARECOPixelLACalibrationTracks = AlignmentTrackSelector.clone( + src = 'ALCARECOSiPixelCalSingleMuon', + filter = True, + applyBasicCuts = True, + ptMin = 3. +) + +# FIXME: the beam-spot should be kept in the AlCaReco (if not already there) and dropped from here +from RecoVertex.BeamSpotProducer.BeamSpot_cff import * + +from RecoTracker.IterativeTracking.InitialStep_cff import * +from RecoTracker.Configuration.RecoTrackerP5_cff import * +from RecoTracker.TrackProducer.TrackRefitter_cfi import * +from TrackingTools.TransientTrack.TransientTrackBuilder_cfi import * + +ALCARECOPixelLACalibrationTracksRefit = TrackRefitter.clone(src = "ALCARECOPixelLACalibrationTracks", + TrajectoryInEvent = True, + NavigationSchool = "" + ) + +# refit and BS can be dropped if done together with RECO. +# track filter can be moved in acalreco if no otehr users +ALCARECOPixelLATrackFilterRefit = cms.Sequence(ALCARECOPixelLACalibrationTracks + + offlineBeamSpot + + ALCARECOPixelLACalibrationTracksRefit) + +# ------------------------------------------------------------------------------ +# This is the module actually doing the calibration +from CalibTracker.SiPixelLorentzAngle.SiPixelLorentzAnglePCLWorker_cfi import SiPixelLorentzAnglePCLWorker +ALCARECOSiPixelLACalib = SiPixelLorentzAnglePCLWorker.clone( + folder = cms.string('AlCaReco/SiPixelLorentzAngle'), + src = cms.InputTag('ALCARECOPixelLACalibrationTracksRefit') +) +# ---------------------------------------------------------------------------- + +# **************************************************************************** +# ** Conversion for the SiPixelLorentzAngle DQM dir ** +# **************************************************************************** +MEtoEDMConvertSiPixelLorentzAngle = cms.EDProducer("MEtoEDMConverter", + Name = cms.untracked.string('MEtoEDMConverter'), + Verbosity = cms.untracked.int32(0), # 0 provides no output + # 1 provides basic output + # 2 provide more detailed output + Frequency = cms.untracked.int32(50), + MEPathToSave = cms.untracked.string('AlCaReco/SiPixelLorentzAngle'), + ) + +# The actual sequence +seqALCARECOPromptCalibProdSiPixelLorentzAngle = cms.Sequence( + ALCARECOCalSignleMuonFilterForSiPixelLorentzAngle * + ALCARECOPixelLATrackFilterRefit * + ALCARECOSiPixelLACalib * + MEtoEDMConvertSiPixelLorentzAngle + ) diff --git a/Calibration/TkAlCaRecoProducers/python/ALCARECOSiPixelCalCosmics_cff.py b/Calibration/TkAlCaRecoProducers/python/ALCARECOSiPixelCalCosmics_cff.py index 75f14f74e1483..145de98bb95d1 100644 --- a/Calibration/TkAlCaRecoProducers/python/ALCARECOSiPixelCalCosmics_cff.py +++ b/Calibration/TkAlCaRecoProducers/python/ALCARECOSiPixelCalCosmics_cff.py @@ -9,7 +9,7 @@ ALCARECOSiPixelCalCosmicsDCSFilter = DPGAnalysis.Skims.skim_detstatus_cfi.dcsstatus.clone( DetectorType = cms.vstring('BPIX','FPIX'), ApplyFilter = cms.bool(True), - AndOr = cms.bool(True), + AndOr = cms.bool(False), # if True put partitions in AND, otherwise in OR DebugOn = cms.untracked.bool(False) ) @@ -38,4 +38,6 @@ ALCARECOSiPixelCalCosmics.minHitsPerSubDet.inPIXEL = 1 # Sequence # -seqALCARECOSiPixelCalCosmics = cms.Sequence(ALCARECOSiPixelCalCosmicsDCSFilter+ALCARECOSiPixelCalCosmicsHLTFilter*ALCARECOSiPixelCalCosmics) +seqALCARECOSiPixelCalCosmics = cms.Sequence(ALCARECOSiPixelCalCosmicsDCSFilter* + ALCARECOSiPixelCalCosmicsHLTFilter* + ALCARECOSiPixelCalCosmics) diff --git a/Calibration/TkAlCaRecoProducers/python/ALCARECOSiStripCalCosmicsNano_Output_cff.py b/Calibration/TkAlCaRecoProducers/python/ALCARECOSiStripCalCosmicsNano_Output_cff.py new file mode 100644 index 0000000000000..fb9691c6feb08 --- /dev/null +++ b/Calibration/TkAlCaRecoProducers/python/ALCARECOSiStripCalCosmicsNano_Output_cff.py @@ -0,0 +1,17 @@ +import FWCore.ParameterSet.Config as cms + +# AlCaNano for track based calibration using Cosmics events +from PhysicsTools.NanoAOD.NanoAODEDMEventContent_cff import NANOAODEventContent +OutALCARECOSiStripCalCosmicsNano_noDrop = cms.PSet( + SelectEvents = cms.untracked.PSet( + SelectEvents = cms.vstring('pathALCARECOSiStripCalCosmicsNano') + ), + outputCommands=cms.untracked.vstring( + 'keep nanoaodFlatTable_*Table_*_*', + 'keep nanoaodMergeableCounterTable_*Table_*_*', + 'keep nanoaodUniqueString_nanoMetadata_*_*', + ) + ) +import copy +OutALCARECOSiStripCalCosmicsNano = copy.deepcopy(OutALCARECOSiStripCalCosmicsNano_noDrop) +OutALCARECOSiStripCalCosmicsNano.outputCommands.insert(0, "drop *") diff --git a/Calibration/TkAlCaRecoProducers/python/ALCARECOSiStripCalCosmicsNano_cff.py b/Calibration/TkAlCaRecoProducers/python/ALCARECOSiStripCalCosmicsNano_cff.py new file mode 100644 index 0000000000000..59cb4c8ac3789 --- /dev/null +++ b/Calibration/TkAlCaRecoProducers/python/ALCARECOSiStripCalCosmicsNano_cff.py @@ -0,0 +1,63 @@ +import FWCore.ParameterSet.Config as cms + +from Calibration.TkAlCaRecoProducers.ALCARECOSiStripCalCosmics_cff import ALCARECOSiStripCalCosmics +from CalibTracker.SiStripCommon.prescaleEvent_cfi import prescaleEvent +from HLTrigger.HLTfilters.triggerResultsFilter_cfi import triggerResultsFilter + +ALCARECOSiStripCalCosmicsNanoPrescale = prescaleEvent.clone(prescale=1) + +ALCARECOSiStripCalCosmicsNanoHLT = triggerResultsFilter.clone( + triggerConditions=cms.vstring("HLT_L1SingleMuCosmics_v*"), + hltResults=cms.InputTag("TriggerResults", "", "HLT"), + l1tResults=cms.InputTag(""), + throw=cms.bool(False) + ) + +from CalibTracker.Configuration.Filter_Refit_cff import CalibrationTracks, CalibrationTracksRefit, MeasurementTrackerEvent, offlineBeamSpot + +ALCARECOSiStripCalCosmicsNanoCalibTracks = CalibrationTracks.clone(src=cms.InputTag("ALCARECOSiStripCalCosmics")) +ALCARECOSiStripCalCosmicsNanoCalibTracksRefit = CalibrationTracksRefit.clone( + src=cms.InputTag("ALCARECOSiStripCalCosmicsNanoCalibTracks") + ) + +ALCARECOSiStripCalCosmicsNanoTkCalSeq = cms.Sequence( + ALCARECOSiStripCalCosmicsNanoPrescale* + ALCARECOSiStripCalCosmicsNanoHLT* + ALCARECOSiStripCalCosmicsNanoCalibTracks, + cms.Task(MeasurementTrackerEvent), + cms.Task(offlineBeamSpot), + cms.Task(ALCARECOSiStripCalCosmicsNanoCalibTracksRefit) + ) + +from PhysicsTools.NanoAOD.common_cff import * +from PhysicsTools.NanoAOD.nano_cff import nanoMetadata +from CalibTracker.SiStripCommon.siStripPositionCorrectionsTable_cfi import siStripPositionCorrectionsTable +from CalibTracker.SiStripCommon.siStripLorentzAngleRunInfoTable_cfi import siStripLorentzAngleRunInfoTable + +ALCARECOSiStripCalCosmicsNanoTracksTable = cms.EDProducer("SimpleTrackFlatTableProducer", + src=cms.InputTag("ALCARECOSiStripCalCosmicsNanoCalibTracksRefit"), + cut=cms.string(""), + name=cms.string("track"), + doc=cms.string("SiStripCalCosmics ALCARECO tracks"), + singleton=cms.bool(False), + extension=cms.bool(False), + variables=cms.PSet( + chi2ndof=Var("chi2()/ndof", float), + pt=Var("pt()", float), + hitsvalid=Var("numberOfValidHits()", int), ## unsigned? + phi=Var("phi()", float), + eta=Var("eta()", float), + ) + ) + +ALCARECOSiStripCalCosmicsNanoMeasTable = siStripPositionCorrectionsTable.clone( + Tracks=cms.InputTag("ALCARECOSiStripCalCosmicsNanoCalibTracksRefit")) + +ALCARECOSiStripCalCosmicsNanoTables = cms.Task( + nanoMetadata, + ALCARECOSiStripCalCosmicsNanoTracksTable, + ALCARECOSiStripCalCosmicsNanoMeasTable, + siStripLorentzAngleRunInfoTable + ) + +seqALCARECOSiStripCalCosmicsNano = cms.Sequence(ALCARECOSiStripCalCosmicsNanoTkCalSeq, ALCARECOSiStripCalCosmicsNanoTables) diff --git a/Calibration/TkAlCaRecoProducers/python/AlcaSiPixelLorentzAngleHarvester_cff.py b/Calibration/TkAlCaRecoProducers/python/AlcaSiPixelLorentzAngleHarvester_cff.py new file mode 100644 index 0000000000000..65e12849ff48a --- /dev/null +++ b/Calibration/TkAlCaRecoProducers/python/AlcaSiPixelLorentzAngleHarvester_cff.py @@ -0,0 +1,18 @@ +import FWCore.ParameterSet.Config as cms + +from Calibration.TkAlCaRecoProducers.AlcaSiPixelLorentzAngleHarvester_cfi import * +from DQMServices.Components.EDMtoMEConverter_cfi import * + +EDMtoMEConvertSiPixelLorentzAngle = EDMtoMEConverter.clone( + lumiInputTag = ("MEtoEDMConvertSiPixelLorentzAngle","MEtoEDMConverterLumi"), + runInputTag = ("MEtoEDMConvertSiPixelLorentzAngle","MEtoEDMConverterRun") +) + +DQMStore = cms.Service("DQMStore") + +from DQMServices.Core.DQMEDHarvester import DQMEDHarvester +dqmEnvSiPixelLorentzAngle = DQMEDHarvester('DQMHarvestingMetadata', + subSystemFolder = cms.untracked.string('AlCaReco'), + ) + +ALCAHARVESTSiPixelLorentzAngle = cms.Sequence( EDMtoMEConvertSiPixelLorentzAngle + alcaSiPixelLorentzAngleHarvester + dqmEnvSiPixelLorentzAngle ) diff --git a/Calibration/TkAlCaRecoProducers/python/AlcaSiPixelLorentzAngleHarvester_cfi.py b/Calibration/TkAlCaRecoProducers/python/AlcaSiPixelLorentzAngleHarvester_cfi.py new file mode 100644 index 0000000000000..085169f4ac0f0 --- /dev/null +++ b/Calibration/TkAlCaRecoProducers/python/AlcaSiPixelLorentzAngleHarvester_cfi.py @@ -0,0 +1,4 @@ +import FWCore.ParameterSet.Config as cms + +from CalibTracker.SiPixelLorentzAngle.SiPixelLorentzAnglePCLHarvester_cfi import SiPixelLorentzAnglePCLHarvester +alcaSiPixelLorentzAngleHarvester = SiPixelLorentzAnglePCLHarvester.clone() diff --git a/Calibration/TkAlCaRecoProducers/test/Alca_BeamFit_Workflow.py b/Calibration/TkAlCaRecoProducers/test/Alca_BeamFit_Workflow.py index 37c18def6cccf..f8c5d1b9b3ff0 100644 --- a/Calibration/TkAlCaRecoProducers/test/Alca_BeamFit_Workflow.py +++ b/Calibration/TkAlCaRecoProducers/test/Alca_BeamFit_Workflow.py @@ -52,7 +52,7 @@ process.load("Configuration.StandardSequences.MagneticField_cff") process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff") process.GlobalTag.globaltag = 'GR_R_38X_V9::All' #'GR_R_35X_V8::All' -process.load("Configuration.StandardSequences.Geometry_cff") +process.load("Configuration.StandardSequences.GeometryDB_cff") ## reco PV diff --git a/Calibration/TkAlCaRecoProducers/test/parseFwkJobReport.py b/Calibration/TkAlCaRecoProducers/test/parseFwkJobReport.py index 6d89d47f99823..6b1b78905d609 100644 --- a/Calibration/TkAlCaRecoProducers/test/parseFwkJobReport.py +++ b/Calibration/TkAlCaRecoProducers/test/parseFwkJobReport.py @@ -4,12 +4,11 @@ ## declare all constants here TARGET_LIST_OF_TAGS=['BeamSpotObject_ByLumi', 'BeamSpotObject_ByRun', 'BeamSpotObjectHP_ByLumi', 'BeamSpotObjectHP_ByRun', - 'SiPixelQualityFromDbRcd_other', 'SiPixelQualityFromDbRcd_prompt', 'SiPixelQualityFromDbRcd_stuckTBM', - 'SiStripApvGain_pcl', 'SiStripApvGainAAG_pcl', - 'SiStripBadStrip_pcl', 'SiPixelAli_pcl'] + 'SiPixelLA_pcl', 'SiPixelQualityFromDbRcd_other', 'SiPixelQualityFromDbRcd_prompt', 'SiPixelQualityFromDbRcd_stuckTBM', + 'SiStripApvGain_pcl', 'SiStripApvGainAAG_pcl', 'SiStripBadStrip_pcl', 'SiPixelAli_pcl'] TARGET_DQM_FILES=1 TARGET_DQM_FILENAME='./DQM_V0001_R000325022__Express__PCLTest__ALCAPROMPT.root' -TARGET_DB_FILES=11 +TARGET_DB_FILES=12 TARGET_DB_FILENAME='sqlite_file:promptCalibConditions.db' TOTAL_TARGET_FILES=TARGET_DQM_FILES+TARGET_DB_FILES diff --git a/Calibration/TkAlCaRecoProducers/test/testPCLAlCaHarvesting.py b/Calibration/TkAlCaRecoProducers/test/testPCLAlCaHarvesting.py index 25c4d6f6aff00..d72de7123bc39 100644 --- a/Calibration/TkAlCaRecoProducers/test/testPCLAlCaHarvesting.py +++ b/Calibration/TkAlCaRecoProducers/test/testPCLAlCaHarvesting.py @@ -81,6 +81,7 @@ def findRunStopTime(run_number): process.PoolDBOutputService.toPut.append(process.ALCAHARVESTSiStripGains_dbOutput) process.PoolDBOutputService.toPut.append(process.ALCAHARVESTSiStripGainsAAG_dbOutput ) process.PoolDBOutputService.toPut.append(process.ALCAHARVESTSiPixelAli_dbOutput) +process.PoolDBOutputService.toPut.append(process.ALCAHARVESTSiPixelLA_dbOutput) process.PoolDBOutputService.toPut.extend(process.ALCAHARVESTSiPixelQuality_dbOutput) process.PoolDBOutputService.toPut.append(process.ALCAHARVESTBeamSpotByRun_dbOutput) process.PoolDBOutputService.toPut.append(process.ALCAHARVESTBeamSpotByLumi_dbOutput) @@ -94,6 +95,7 @@ def findRunStopTime(run_number): process.pclMetadataWriter.recordsToMap.append(process.ALCAHARVESTSiStripGains_metadata ) process.pclMetadataWriter.recordsToMap.append(process.ALCAHARVESTSiStripGainsAAG_metadata) process.pclMetadataWriter.recordsToMap.append(process.ALCAHARVESTSiPixelAli_metadata) +process.pclMetadataWriter.recordsToMap.append(process.ALCAHARVESTSiPixelLA_metadata) process.pclMetadataWriter.recordsToMap.extend(process.ALCAHARVESTSiPixelQuality_metadata) process.pclMetadataWriter.recordsToMap.append(process.ALCAHARVESTBeamSpotByRun_metadata) process.pclMetadataWriter.recordsToMap.append(process.ALCAHARVESTBeamSpotByLumi_metadata) @@ -124,6 +126,8 @@ def findRunStopTime(run_number): process.SiPixelAliMilleFileExtractor.outputBinaryFile = cms.string('') process.SiPixelAliPedeAlignmentProducer.algoConfig.mergeBinaryFiles=[] +process.SiPixelLA = cms.Path(process.ALCAHARVESTSiPixelLorentzAngle) + process.SiPixelQuality = cms.Path(process.ALCAHARVESTSiPixelQuality) process.ALCAHARVESTDQMSaveAndMetadataWriter = cms.Path(process.dqmSaver+process.pclMetadataWriter) @@ -136,7 +140,8 @@ def findRunStopTime(run_number): process.schedule = cms.Schedule(process.SiStripQuality, process.SiStripGains, process.SiStripGainsAAG, - process.SiPixelAli, + process.SiPixelAli, + process.SiPixelLA, process.SiPixelQuality, process.BeamSpotByRun, process.BeamSpotByLumi, diff --git a/Calibration/Tools/interface/TrackAssociator.h b/Calibration/Tools/interface/TrackAssociator.h deleted file mode 100644 index ee51e70e70bfb..0000000000000 --- a/Calibration/Tools/interface/TrackAssociator.h +++ /dev/null @@ -1,191 +0,0 @@ -#ifndef HTrackAssociator_HTrackAssociator_h -#define HTrackAssociator_HTrackAssociator_h 1 - -// -*- C++ -*- -// -// Package: HTrackAssociator -// Class: HTrackAssociator -// -/* - - Description: - - Implementation: - -*/ -// -// Original Author: Dmytro Kovalskyi -// Modified for ECAL+HCAL by: Michal Szleper -// - -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/EventSetup.h" -#include "DataFormats/Common/interface/Handle.h" -#include "FWCore/Framework/interface/ESHandle.h" -#include "DataFormats/Common/interface/OrphanHandle.h" - -#include "DataFormats/TrackReco/interface/TrackBase.h" -#include "Geometry/CaloGeometry/interface/CaloGeometry.h" -#include "TrackingTools/GeomPropagators/interface/Propagator.h" - -#include "Calibration/Tools/interface/CaloDetIdAssociator.h" -#include "Calibration/Tools/interface/EcalDetIdAssociator.h" -#include "Calibration/Tools/interface/HcalDetIdAssociator.h" -#include "Calibration/Tools/interface/TrackDetMatchInfo.h" - -#include "DataFormats/CaloTowers/interface/CaloTower.h" -#include "DataFormats/EcalRecHit/interface/EcalRecHit.h" -#include "DataFormats/HcalRecHit/interface/HBHERecHit.h" -#include "DataFormats/TrackReco/interface/Track.h" -#include "DataFormats/Math/interface/Vector3D.h" -#include "DataFormats/Math/interface/Point3D.h" - -#include "SimDataFormats/Track/interface/SimTrack.h" -#include "SimDataFormats/Vertex/interface/SimVertex.h" - -class HTrackAssociator { -public: - HTrackAssociator(); - ~HTrackAssociator(); - - class HAssociatorParameters { - public: - HAssociatorParameters() { - // default parameters - // define match cones, dR=sqrt(dEta^2+dPhi^2) - dREcal = 0.03; - dRHcal = 0.07; - dRCalo = 0.07; - - idREcal = 1; - idRHcal = 4; - idRCalo = 4; - - // match all sub-detectors by default - useEcal = true; - useHcal = true; - useCalo = true; - } - double dREcal; - double dRHcal; - double dRCalo; - int idREcal; - int idRHcal; - int idRCalo; - - bool useEcal; - bool useHcal; - bool useCalo; - }; - - /// propagate a track across the whole detector and - /// find associated objects. Association is done in - /// two modes - /// 1) an object is associated to a track only if - /// crossed by track - /// 2) an object is associated to a track if it is - /// withing an eta-phi cone of some radius with - /// respect to a track. - /// (the cone origin is at (0,0,0)) - HTrackDetMatchInfo associate(const edm::Event&, - const edm::EventSetup&, - const FreeTrajectoryState&, - const HAssociatorParameters&); - - /// associate ECAL only and return RecHits - /// negative dR means only crossed elements - std::vector associateEcal(const edm::Event&, - const edm::EventSetup&, - const FreeTrajectoryState&, - const double dR = -1); - - /// associate ECAL only and return energy - /// negative dR means only crossed elements - double getEcalEnergy(const edm::Event&, const edm::EventSetup&, const FreeTrajectoryState&, const double dR = -1); - - /// associate ECAL only and return RecHits - /// negative dR means only crossed elements - std::vector associateHcal(const edm::Event&, - const edm::EventSetup&, - const FreeTrajectoryState&, - const double dR = -1); - - /// associate ECAL only and return energy - /// negative dR means only crossed elements - double getHcalEnergy(const edm::Event&, const edm::EventSetup&, const FreeTrajectoryState&, const double dR = -1); - /// use a user configured propagator - void setPropagator(Propagator*); - - /// use the default propagator - void useDefaultPropagator(); - - /// specify names of EDProducts to use for different input data types - void addDataLabels(const std::string className, - const std::string moduleLabel, - const std::string productInstanceLabel = ""); - - /// get FreeTrajectoryState from different track representations - FreeTrajectoryState getFreeTrajectoryState(const edm::EventSetup&, const reco::Track&); - FreeTrajectoryState getFreeTrajectoryState(const edm::EventSetup&, const SimTrack&, const SimVertex&); - -private: - void fillEcal(const edm::Event&, - const edm::EventSetup&, - HTrackDetMatchInfo&, - const FreeTrajectoryState&, - const int, - const double); - - void fillHcal(const edm::Event&, - const edm::EventSetup&, - HTrackDetMatchInfo&, - const FreeTrajectoryState&, - const int, - const double); - - void fillHcalTowers(const edm::Event&, - const edm::EventSetup&, - HTrackDetMatchInfo&, - const FreeTrajectoryState&, - const int, - const double); - - void fillCaloTowers(const edm::Event&, - const edm::EventSetup&, - HTrackDetMatchInfo&, - const FreeTrajectoryState&, - const int, - const double); - - void init(const edm::EventSetup&); - - math::XYZPoint getPoint(const GlobalPoint& point) { return math::XYZPoint(point.x(), point.y(), point.z()); } - - math::XYZPoint getPoint(const LocalPoint& point) { return math::XYZPoint(point.x(), point.y(), point.z()); } - - math::XYZVector getVector(const GlobalVector& vec) { return math::XYZVector(vec.x(), vec.y(), vec.z()); } - - math::XYZVector getVector(const LocalVector& vec) { return math::XYZVector(vec.x(), vec.y(), vec.z()); } - - Propagator* ivProp_; - Propagator* defProp_; - bool useDefaultPropagator_; - int debug_; - std::vector > >* caloTowerMap_; - - HEcalDetIdAssociator ecalDetIdAssociator_; - HHcalDetIdAssociator hcalDetIdAssociator_; - HCaloDetIdAssociator caloDetIdAssociator_; - - edm::ESHandle theCaloGeometry_; - - /// Labels of the detector EDProducts (empty by default) - /// ECAL - std::vector EBRecHitCollectionLabels; - std::vector EERecHitCollectionLabels; - /// HCAL - std::vector HBHERecHitCollectionLabels; - /// CaloTowers - std::vector CaloTowerCollectionLabels; -}; -#endif diff --git a/Calibration/Tools/plugins/ElectronSqPtTkIsolation.cc b/Calibration/Tools/plugins/ElectronSqPtTkIsolation.cc deleted file mode 100644 index 42e1943ff0302..0000000000000 --- a/Calibration/Tools/plugins/ElectronSqPtTkIsolation.cc +++ /dev/null @@ -1,60 +0,0 @@ -//C++ includes -#include -#include - -//ROOT includes -#include - -//CMSSW includes -#include "Calibration/Tools/plugins/ElectronSqPtTkIsolation.h" -#include "DataFormats/TrackReco/interface/TrackFwd.h" -#include "TrackingTools/PatternTools/interface/Trajectory.h" -#include "TrackingTools/TrajectoryState/interface/TrajectoryStateTransform.h" -#include "DataFormats/GeometryVector/interface/GlobalPoint.h" -#include "DataFormats/GeometryVector/interface/GlobalVector.h" -#include "DataFormats/GsfTrackReco/interface/GsfTrack.h" - -using namespace ROOT::Math::VectorUtil; - -ElectronSqPtTkIsolation::ElectronSqPtTkIsolation( - double extRadius, double intRadius, double ptLow, double lip, const reco::TrackCollection* trackCollection) - : extRadius_(extRadius), intRadius_(intRadius), ptLow_(ptLow), lip_(lip), trackCollection_(trackCollection) {} - -ElectronSqPtTkIsolation::~ElectronSqPtTkIsolation() {} - -// unified acces to isolations -std::pair ElectronSqPtTkIsolation::getIso(const reco::GsfElectron* electron) const { - int counter = 0; - double ptSum = 0.; - //Take the electron track - reco::GsfTrackRef tmpTrack = electron->gsfTrack(); - math::XYZVector tmpElectronMomentumAtVtx = (*tmpTrack).momentum(); - - for (reco::TrackCollection::const_iterator itrTr = (*trackCollection_).begin(); itrTr != (*trackCollection_).end(); - ++itrTr) { - math::XYZVector tmpTrackMomentumAtVtx = (*itrTr).momentum(); - double this_pt = (*itrTr).pt(); - if (this_pt < ptLow_) - continue; - if (fabs((*itrTr).dz() - (*tmpTrack).dz()) > lip_) - continue; - double dr = DeltaR(tmpTrackMomentumAtVtx, tmpElectronMomentumAtVtx); - if (fabs(dr) < extRadius_ && fabs(dr) >= intRadius_) { - ++counter; - ptSum += this_pt * this_pt; // sum of squared pT - } - } //end loop over tracks - - std::pair retval; - retval.first = counter; - retval.second = ptSum; - - return retval; -} - -int ElectronSqPtTkIsolation::getNumberTracks(const reco::GsfElectron* electron) const { - //counter for the tracks in the isolation cone - return getIso(electron).first; -} - -double ElectronSqPtTkIsolation::getPtTracks(const reco::GsfElectron* electron) const { return getIso(electron).second; } diff --git a/Calibration/Tools/plugins/ElectronSqPtTkIsolation.h b/Calibration/Tools/plugins/ElectronSqPtTkIsolation.h deleted file mode 100644 index ddf06a7ea08bd..0000000000000 --- a/Calibration/Tools/plugins/ElectronSqPtTkIsolation.h +++ /dev/null @@ -1,39 +0,0 @@ -#ifndef ElectronSqPtTkIsolation_h -#define ElectronSqPtTkIsolation_h - -//C++ includes -#include -#include - -//Root includes -#include "TObjArray.h" - -//CMSSW includes -#include "FWCore/Framework/interface/ESHandle.h" -#include "DataFormats/EgammaCandidates/interface/GsfElectron.h" -#include "DataFormats/TrackReco/interface/Track.h" - -class ElectronSqPtTkIsolation { -public: - //constructors - ElectronSqPtTkIsolation(double extRadius, double intRadius, double ptLow, double lip, const reco::TrackCollection*); - //destructor - ~ElectronSqPtTkIsolation(); - - //methods - - int getNumberTracks(const reco::GsfElectron*) const; - double getPtTracks(const reco::GsfElectron*) const; - -private: - double extRadius_; - double intRadius_; - double ptLow_; - double lip_; - - const reco::TrackCollection* trackCollection_; - - std::pair getIso(const reco::GsfElectron*) const; -}; - -#endif diff --git a/Calibration/Tools/plugins/ElectronSqPtTkIsolationProducer.cc b/Calibration/Tools/plugins/ElectronSqPtTkIsolationProducer.cc deleted file mode 100644 index 01b2131f3eb4e..0000000000000 --- a/Calibration/Tools/plugins/ElectronSqPtTkIsolationProducer.cc +++ /dev/null @@ -1,62 +0,0 @@ -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/EventSetup.h" -#include "DataFormats/Common/interface/Handle.h" -#include "FWCore/Framework/interface/ESHandle.h" -#include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "FWCore/Utilities/interface/Exception.h" - -#include "DataFormats/EgammaCandidates/interface/GsfElectronFwd.h" -#include "DataFormats/Candidate/interface/CandAssociation.h" -#include "DataFormats/Candidate/interface/CandidateFwd.h" - -#include "Calibration/Tools/plugins/ElectronSqPtTkIsolationProducer.h" -#include "Calibration/Tools/plugins/ElectronSqPtTkIsolation.h" - -ElectronSqPtTkIsolationProducer::ElectronSqPtTkIsolationProducer(const edm::ParameterSet& config) : conf_(config) { - // use configuration file to setup input/output collection names - electronProducer_ = conf_.getParameter("electronProducer"); - - trackProducer_ = conf_.getParameter("trackProducer"); - - ptMin_ = conf_.getParameter("ptMin"); - intRadius_ = conf_.getParameter("intRadius"); - extRadius_ = conf_.getParameter("extRadius"); - maxVtxDist_ = conf_.getParameter("maxVtxDist"); - - absolut_ = conf_.getParameter("absolut"); - - //register your products - produces(); -} - -ElectronSqPtTkIsolationProducer::~ElectronSqPtTkIsolationProducer() {} - -void ElectronSqPtTkIsolationProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { - // Get the filtered objects - edm::Handle electronHandle; - iEvent.getByLabel(electronProducer_, electronHandle); - - //get the tracks - edm::Handle tracks; - iEvent.getByLabel(trackProducer_, tracks); - const reco::TrackCollection* trackCollection = tracks.product(); - - reco::CandViewDoubleAssociations* isoMap = - new reco::CandViewDoubleAssociations(reco::CandidateBaseRefProd(reco::GsfElectronRefProd(electronHandle))); - - ElectronSqPtTkIsolation myTkIsolation(extRadius_, intRadius_, ptMin_, maxVtxDist_, trackCollection); - - for (unsigned int i = 0; i < electronHandle->size(); ++i) { - double isoValue = myTkIsolation.getPtTracks(&(electronHandle->at(i))); - if (absolut_ == true) { - isoMap->setValue(i, isoValue); - } else { - reco::SuperClusterRef sc = (electronHandle->at(i)).superCluster(); - double et = sc.get()->energy() * sin(2 * atan(exp(-sc.get()->eta()))); - isoMap->setValue(i, isoValue / et); - } - } - - std::unique_ptr isolMap(isoMap); - iEvent.put(std::move(isolMap)); -} diff --git a/Calibration/Tools/plugins/ElectronSqPtTkIsolationProducer.h b/Calibration/Tools/plugins/ElectronSqPtTkIsolationProducer.h deleted file mode 100644 index c4ce7c3b18376..0000000000000 --- a/Calibration/Tools/plugins/ElectronSqPtTkIsolationProducer.h +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef ElectronSqPtTkIsolationProducer_h -#define ElectronSqPtTkIsolationProducer_h - -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDProducer.h" - -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/MakerMacros.h" - -#include "FWCore/ParameterSet/interface/ParameterSet.h" - -class ElectronSqPtTkIsolationProducer : public edm::EDProducer { -public: - explicit ElectronSqPtTkIsolationProducer(const edm::ParameterSet&); - ~ElectronSqPtTkIsolationProducer() override; - - void produce(edm::Event&, const edm::EventSetup&) override; - -private: - edm::InputTag electronProducer_; - edm::InputTag trackProducer_; - - double ptMin_; - double intRadius_; - double extRadius_; - double maxVtxDist_; - - bool absolut_; - - edm::ParameterSet conf_; -}; - -#endif diff --git a/Calibration/Tools/plugins/SealModule.cc b/Calibration/Tools/plugins/SealModule.cc index 296027173aa53..33d2445e2d13a 100644 --- a/Calibration/Tools/plugins/SealModule.cc +++ b/Calibration/Tools/plugins/SealModule.cc @@ -3,7 +3,6 @@ #include "Calibration/Tools/interface/PhiRangeSelector.h" #include "Calibration/Tools/interface/IMASelector.h" -#include "Calibration/Tools/plugins/SingleEleCalibSelector.h" #include "CommonTools/UtilAlgos/interface/ObjectSelector.h" #include "CommonTools/UtilAlgos/interface/SingleObjectSelector.h" @@ -13,9 +12,6 @@ #include "DataFormats/EgammaCandidates/interface/GsfElectronFwd.h" #include "CommonTools/RecoAlgos/interface/GsfElectronSelector.h" -//#include "Calibration/Tools/plugins/SelectorWithEventSetup.h" -#include "Calibration/Tools/plugins/ElectronSqPtTkIsolationProducer.h" - namespace reco { namespace modules { typedef SingleObjectSelector PhiRangeSelector; @@ -26,8 +22,3 @@ namespace reco { } // namespace modules } // namespace reco - -DEFINE_FWK_MODULE(ElectronSqPtTkIsolationProducer); - -// typedef SelectorWithEventSetup SingleElectronCalibrationSelector; -// DEFINE_FWK_MODULE( SingleElectronCalibrationSelector ); diff --git a/Calibration/Tools/plugins/SingleEleCalibSelector.cc b/Calibration/Tools/plugins/SingleEleCalibSelector.cc deleted file mode 100644 index 2f7c7165d3b36..0000000000000 --- a/Calibration/Tools/plugins/SingleEleCalibSelector.cc +++ /dev/null @@ -1,168 +0,0 @@ -// my includes -#include "CommonTools/UtilAlgos/interface/ParameterAdapter.h" -#include "FWCore/Framework/interface/ESHandle.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/MessageLogger/interface/MessageLogger.h" - -// Geometry -#include "Geometry/Records/interface/CaloTopologyRecord.h" -#include "Geometry/CaloGeometry/interface/CaloGeometry.h" -#include "Geometry/CaloTopology/interface/CaloSubdetectorTopology.h" - -#include "DataFormats/EgammaCandidates/interface/GsfElectron.h" -#include "DataFormats/EgammaCandidates/interface/GsfElectronFwd.h" - -#include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" -#include "DataFormats/DetId/interface/DetId.h" -#include "DataFormats/EcalDetId/interface/EBDetId.h" -#include "DataFormats/EcalDetId/interface/EEDetId.h" - -#include "Calibration/Tools/plugins/SingleEleCalibSelector.h" - -//CLHEP -#include - -#include - -SingleEleCalibSelector::SingleEleCalibSelector(const edm::ParameterSet& iConfig) { - ESCOPinMin_ = iConfig.getParameter("ESCOPinMin"); - ESCOPinMax_ = iConfig.getParameter("ESCOPinMax"); - ESeedOPoutMin_ = iConfig.getParameter("ESeedOPoutMin"); - ESeedOPoutMax_ = iConfig.getParameter("ESeedOPoutMax"); - PinMPoutOPinMin_ = iConfig.getParameter("PinMPoutOPinMin"); - PinMPoutOPinMax_ = iConfig.getParameter("PinMPoutOPinMax"); - E5x5OPoutMin_ = iConfig.getParameter("E5x5OPoutMin"); - E5x5OPoutMax_ = iConfig.getParameter("E5x5OPoutMax"); - E3x3OPinMin_ = iConfig.getParameter("E3x3OPinMin"); - E3x3OPinMax_ = iConfig.getParameter("E3x3OPinMax"); - E3x3OE5x5Min_ = iConfig.getParameter("E3x3OE5x5Min"); - E3x3OE5x5Max_ = iConfig.getParameter("E3x3OE5x5Max"); - EBrecHitLabel_ = iConfig.getParameter("alcaBarrelHitCollection"); - EErecHitLabel_ = iConfig.getParameter("alcaEndcapHitCollection"); -} - -// ------------------------------------------------------------ - -void - -SingleEleCalibSelector::select (edm::Handle inputHandle, - const edm::Event& iEvent , const edm::EventSetup& iSetup) -{ - selected_.clear(); - - //Get the EB rechit collection - edm::Handle barrelRecHitsHandle; - iEvent.getByLabel(EBrecHitLabel_, barrelRecHitsHandle); - const EBRecHitCollection* EBHitsColl = barrelRecHitsHandle.product(); - - //Get the EE rechit collection - edm::Handle endcapRecHitsHandle; - iEvent.getByLabel(EErecHitLabel_, endcapRecHitsHandle); - const EERecHitCollection* EEHitsColl = endcapRecHitsHandle.product(); - - //To deal with Geometry - iSetup.get().get(theCaloTopology); - - //Loop over electrons - for (collection::const_iterator ele = (*inputHandle).begin(); ele != (*inputHandle).end(); ++ele) { - //Find DetID max hit - DetId maxHitId = findMaxHit((*ele).superCluster()->hitsAndFractions(), EBHitsColl, EEHitsColl); - - if (maxHitId.null()) { - std::cout << " Null Id" << std::endl; - continue; - } - - // Find 3x3 and 5x5 windows around xtal max and compute E3x3,E5x5 - double E5x5 = 0.; - double E3x3 = 0.; - - const CaloSubdetectorTopology* topology = theCaloTopology->getSubdetectorTopology(DetId::Ecal, maxHitId.subdetId()); - int WindowSize = 5; - std::vector m5x5aroundMax = topology->getWindow(maxHitId, WindowSize, WindowSize); - E5x5 = EnergyNxN(m5x5aroundMax, EBHitsColl, EEHitsColl); - WindowSize = 3; - std::vector m3x3aroundMax = topology->getWindow(maxHitId, WindowSize, WindowSize); - E3x3 = EnergyNxN(m3x3aroundMax, EBHitsColl, EEHitsColl); - - double pin = ele->trackMomentumAtVtx().R(); - double piMpoOpi = (pin - ele->trackMomentumOut().R()) / pin; - double E5x5OPout = E5x5 / ele->trackMomentumOut().R(); - double E3x3OPin = E3x3 / pin; - double E3x3OE5x5 = E3x3 / E5x5; - double EseedOPout = ele->eSeedClusterOverPout(); - double EoPin = ele->eSuperClusterOverP(); - - if (piMpoOpi > PinMPoutOPinMin_ && piMpoOpi < PinMPoutOPinMax_ && EseedOPout > ESeedOPoutMin_ && - EseedOPout < ESeedOPoutMax_ && EoPin > ESCOPinMin_ && EoPin < ESCOPinMax_ && E5x5OPout > E5x5OPoutMin_ && - E5x5OPout < E5x5OPoutMax_ && E3x3OPin > E3x3OPinMin_ && E3x3OPin < E3x3OPinMax_ && E3x3OE5x5 > E3x3OE5x5Min_ && - E3x3OE5x5 < E3x3OE5x5Max_) { - selected_.push_back(&(*ele)); - } - } - - return; -} - -// ------------------------------------------------------------ - -SingleEleCalibSelector::~SingleEleCalibSelector() {} - -// ------------------------------------------------------------ - -// To find Max Hit -DetId SingleEleCalibSelector::findMaxHit(const std::vector >& v1, - const EBRecHitCollection* EBhits, - const EERecHitCollection* EEhits) { - double currEnergy = 0.; - DetId maxHit; - for (std::vector >::const_iterator idsIt = v1.begin(); idsIt != v1.end(); ++idsIt) { - if (idsIt->first.subdetId() == EcalBarrel) { - EBRecHitCollection::const_iterator itrechit; - itrechit = EBhits->find((*idsIt).first); - if (itrechit == EBhits->end()) { - edm::LogInfo("reading") << "[findMaxHit] rechit not found! "; - continue; - } - //FIXME: use fraction ?? - if (itrechit->energy() > currEnergy) { - currEnergy = itrechit->energy(); - maxHit = (*idsIt).first; - } - } else { - EERecHitCollection::const_iterator itrechit; - itrechit = EEhits->find((*idsIt).first); - if (itrechit == EEhits->end()) { - edm::LogInfo("reading") << "[findMaxHit] rechit not found! "; - continue; - } - - if (itrechit->energy() > currEnergy) { - currEnergy = itrechit->energy(); - maxHit = (*idsIt).first; - } - } - } - return maxHit; -} - -// Energy in a window NxN -double SingleEleCalibSelector::EnergyNxN(const std::vector& vNxN, - const EBRecHitCollection* EBhits, - const EERecHitCollection* EEhits) { - double dummy = 0.; - int window_size = vNxN.size(); - for (int ixtal = 0; ixtal < window_size; ixtal++) { - if (vNxN[ixtal].subdetId() == EcalBarrel) { - EBRecHitCollection::const_iterator it_rechit; - it_rechit = EBhits->find(vNxN[ixtal]); - dummy += it_rechit->energy(); - } else { - EERecHitCollection::const_iterator it_rechit; - it_rechit = EEhits->find(vNxN[ixtal]); - dummy += it_rechit->energy(); - } - } - - return dummy; -} diff --git a/Calibration/Tools/plugins/SingleEleCalibSelector.h b/Calibration/Tools/plugins/SingleEleCalibSelector.h deleted file mode 100644 index a50106549fc6b..0000000000000 --- a/Calibration/Tools/plugins/SingleEleCalibSelector.h +++ /dev/null @@ -1,52 +0,0 @@ -#ifndef SingleEleCalibSelector_h -#define SingleEleCalibSelector_h - -#include "DataFormats/Common/interface/Handle.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/Framework/interface/ESHandle.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" -#include "DataFormats/EgammaCandidates/interface/GsfElectron.h" -#include "DataFormats/EgammaCandidates/interface/GsfElectronFwd.h" -#include "Geometry/CaloTopology/interface/CaloTopology.h" - -#include -#include -#include - -class SingleEleCalibSelector { -public: - typedef reco::GsfElectronCollection collection; - typedef reco::GsfElectronRef electron; - typedef std::vector container; - typedef container::const_iterator const_iterator; - - //! ctor - SingleEleCalibSelector(const edm::ParameterSet& iConfig); - //!dtor - ~SingleEleCalibSelector(); - - const_iterator begin() const { return selected_.begin(); } - const_iterator end() const { return selected_.end(); } - - void select(edm::Handle, const edm::Event&, const edm::EventSetup&); - -private: - container selected_; //! the selected collection - - edm::ESHandle theCaloTopology; - - DetId findMaxHit(const std::vector >& v1, - const EBRecHitCollection* EBhits, - const EERecHitCollection* EEhits); - - double EnergyNxN(const std::vector& vNxN, const EBRecHitCollection* EBhits, const EERecHitCollection* EEhits); - - double ESCOPinMin_, ESeedOPoutMin_, PinMPoutOPinMin_, E5x5OPoutMin_, E3x3OPinMin_, E3x3OE5x5Min_; - double ESCOPinMax_, ESeedOPoutMax_, PinMPoutOPinMax_, E5x5OPoutMax_, E3x3OPinMax_, E3x3OE5x5Max_; - edm::InputTag EBrecHitLabel_; - edm::InputTag EErecHitLabel_; -}; - -#endif diff --git a/Calibration/Tools/src/TrackAssociator.cc b/Calibration/Tools/src/TrackAssociator.cc deleted file mode 100644 index cf9280cf0ed6e..0000000000000 --- a/Calibration/Tools/src/TrackAssociator.cc +++ /dev/null @@ -1,588 +0,0 @@ -// -*- C++ -*- -// -// Package: HTrackAssociator -// Class: HTrackAssociator -// -/* - - Description: - - Implementation: - -*/ -// -// Original Author: Dmytro Kovalskyi -// Modified for ECAL+HCAL by: Michal Szleper -// Created: Fri Apr 21 10:59:41 PDT 2006 -// -// - -#include "Calibration/Tools/interface/TrackAssociator.h" - -// user include files - -#include "DataFormats/CaloTowers/interface/CaloTowerCollection.h" -#include "DataFormats/EgammaReco/interface/SuperCluster.h" -#include "DataFormats/DetId/interface/DetId.h" -#include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" - -// calorimeter info -#include "Geometry/Records/interface/CaloGeometryRecord.h" - -#include "MagneticField/Records/interface/IdealMagneticFieldRecord.h" - -#include "TrackPropagation/SteppingHelixPropagator/interface/SteppingHelixPropagator.h" -#include -#include - -// -// class declaration -// - -using namespace reco; - -HTrackAssociator::HTrackAssociator() { - ivProp_ = nullptr; - defProp_ = nullptr; - debug_ = 0; - caloTowerMap_ = nullptr; - useDefaultPropagator_ = false; -} - -HTrackAssociator::~HTrackAssociator() { - if (defProp_) - delete defProp_; -} - -//----------------------------------------------------------------------------- -void HTrackAssociator::addDataLabels(const std::string className, - const std::string moduleLabel, - const std::string productInstanceLabel) { - if (className == "EBRecHitCollection") { - EBRecHitCollectionLabels.clear(); - EBRecHitCollectionLabels.push_back(moduleLabel); - EBRecHitCollectionLabels.push_back(productInstanceLabel); - } - if (className == "EERecHitCollection") { - EERecHitCollectionLabels.clear(); - EERecHitCollectionLabels.push_back(moduleLabel); - EERecHitCollectionLabels.push_back(productInstanceLabel); - } - if (className == "HBHERecHitCollection") { - HBHERecHitCollectionLabels.clear(); - HBHERecHitCollectionLabels.push_back(moduleLabel); - HBHERecHitCollectionLabels.push_back(productInstanceLabel); - } - if (className == "CaloTowerCollection") { - CaloTowerCollectionLabels.clear(); - CaloTowerCollectionLabels.push_back(moduleLabel); - CaloTowerCollectionLabels.push_back(productInstanceLabel); - } -} - -//----------------------------------------------------------------------------- -void HTrackAssociator::setPropagator(Propagator* ptr) { - ivProp_ = ptr; - caloDetIdAssociator_.setPropagator(ivProp_); - ecalDetIdAssociator_.setPropagator(ivProp_); - hcalDetIdAssociator_.setPropagator(ivProp_); -} - -//----------------------------------------------------------------------------- -void HTrackAssociator::useDefaultPropagator() { useDefaultPropagator_ = true; } - -//----------------------------------------------------------------------------- -void HTrackAssociator::init(const edm::EventSetup& iSetup) { - // access the calorimeter geometry - iSetup.get().get(theCaloGeometry_); - if (!theCaloGeometry_.isValid()) - throw cms::Exception("FatalError") << "Unable to find IdealGeometryRecord in event!\n"; - - if (useDefaultPropagator_ && !defProp_) { - // setup propagator - edm::ESHandle bField; - iSetup.get().get(bField); - - SteppingHelixPropagator* prop = new SteppingHelixPropagator(&*bField, anyDirection); - prop->setMaterialMode(false); - prop->applyRadX0Correction(true); - // prop->setDebug(true); // tmp - defProp_ = prop; - setPropagator(defProp_); - } -} - -//----------------------------------------------------------------------------- -HTrackDetMatchInfo HTrackAssociator::associate(const edm::Event& iEvent, - const edm::EventSetup& iSetup, - const FreeTrajectoryState& trackOrigin, - const HAssociatorParameters& parameters) { - HTrackDetMatchInfo info; - using namespace edm; - - init(iSetup); - - const FreeTrajectoryState& currentPosition(trackOrigin); - - if (parameters.useEcal) - fillEcal(iEvent, iSetup, info, currentPosition, parameters.idREcal, parameters.dREcal); - if (parameters.useHcal) - fillHcal(iEvent, iSetup, info, currentPosition, parameters.idRHcal, parameters.dRHcal); - if (parameters.useCalo) - fillCaloTowers(iEvent, iSetup, info, currentPosition, parameters.idRCalo, parameters.dRCalo); - - return info; -} - -//----------------------------------------------------------------------------- -std::vector HTrackAssociator::associateEcal(const edm::Event& iEvent, - const edm::EventSetup& iSetup, - const FreeTrajectoryState& trackOrigin, - const double dR) { - HAssociatorParameters parameters; - parameters.useHcal = false; - parameters.dREcal = dR; - HTrackDetMatchInfo info(associate(iEvent, iSetup, trackOrigin, parameters)); - if (dR > 0) - return info.coneEcalRecHits; - else - return info.crossedEcalRecHits; -} - -//----------------------------------------------------------------------------- -double HTrackAssociator::getEcalEnergy(const edm::Event& iEvent, - const edm::EventSetup& iSetup, - const FreeTrajectoryState& trackOrigin, - const double dR) { - HAssociatorParameters parameters; - parameters.useHcal = false; - parameters.dREcal = dR; - HTrackDetMatchInfo info = associate(iEvent, iSetup, trackOrigin, parameters); - if (dR > 0) - return info.ecalConeEnergyFromRecHits(); - else - return info.ecalEnergyFromRecHits(); -} - -//----------------------------------------------------------------------------- -std::vector HTrackAssociator::associateHcal(const edm::Event& iEvent, - const edm::EventSetup& iSetup, - const FreeTrajectoryState& trackOrigin, - const double dR) { - HAssociatorParameters parameters; - parameters.useEcal = false; - parameters.dRHcal = dR; - HTrackDetMatchInfo info(associate(iEvent, iSetup, trackOrigin, parameters)); - if (dR > 0) - return info.coneTowers; - else - return info.crossedTowers; -} - -//----------------------------------------------------------------------------- -double HTrackAssociator::getHcalEnergy(const edm::Event& iEvent, - const edm::EventSetup& iSetup, - const FreeTrajectoryState& trackOrigin, - const double dR) { - HAssociatorParameters parameters; - parameters.useEcal = false; - parameters.dRHcal = dR; - HTrackDetMatchInfo info(associate(iEvent, iSetup, trackOrigin, parameters)); - if (dR > 0) - return info.hcalConeEnergyFromRecHits(); - else - return info.hcalEnergyFromRecHits(); -} - -//----------------------------------------------------------------------------- -void HTrackAssociator::fillEcal(const edm::Event& iEvent, - const edm::EventSetup& iSetup, - HTrackDetMatchInfo& info, - const FreeTrajectoryState& trajectoryPoint, - const int idR, - const double dR) { - ecalDetIdAssociator_.setGeometry(&*theCaloGeometry_); - - // ECAL points (EB+EE) - std::vector ecalPoints; - ecalPoints.push_back(GlobalPoint(135., 0, 310.)); - ecalPoints.push_back(GlobalPoint(150., 0, 340.)); - ecalPoints.push_back(GlobalPoint(170., 0, 370.)); - - std::vector ecalTrajectory = ecalDetIdAssociator_.getTrajectory(trajectoryPoint, ecalPoints); - // if(ecalTrajectory.empty()) throw cms::Exception("FatalError") << "Failed to propagate a track to ECAL\n"; - - if (ecalTrajectory.empty()) { - LogTrace("HTrackAssociator::fillEcal") << "Failed to propagate a track to ECAL; moving on\n"; - info.isGoodEcal = false; - return; - } - - info.isGoodEcal = true; - - info.trkGlobPosAtEcal = getPoint(ecalTrajectory[0]); - - // Find ECAL crystals - edm::Handle EBRecHits; - edm::Handle EERecHits; - // if (EBRecHitCollectionLabels.empty()) - // throw cms::Exception("FatalError") << "Module lable is not set for EBRecHitCollection.\n"; - // else - iEvent.getByLabel(EBRecHitCollectionLabels[0], EBRecHitCollectionLabels[1], EBRecHits); - // if (!EBRecHits.isValid()) throw cms::Exception("FatalError") << "Unable to find EBRecHitCollection in event!\n"; - if (EERecHitCollectionLabels[1] != EBRecHitCollectionLabels[1]) - iEvent.getByLabel(EERecHitCollectionLabels[0], EERecHitCollectionLabels[1], EERecHits); - // if (!EERecHits.isValid()) throw cms::Exception("FatalError") << "Unable to find EERecHitCollection in event!\n"; - - std::set ecalIdsInRegion = ecalDetIdAssociator_.getDetIdsCloseToAPoint(ecalTrajectory[0], idR); - std::set ecalIdsInACone = ecalDetIdAssociator_.getDetIdsInACone(ecalIdsInRegion, ecalTrajectory, dR); - std::set crossedEcalIds = ecalDetIdAssociator_.getCrossedDetIds(ecalIdsInRegion, ecalTrajectory); - - // add EcalRecHits - for (std::set::const_iterator itr = crossedEcalIds.begin(); itr != crossedEcalIds.end(); itr++) { - std::vector::const_iterator hit = (*EBRecHits).find(*itr); - if (hit != (*EBRecHits).end()) - info.crossedEcalRecHits.push_back(*hit); - else - LogTrace("HTrackAssociator::fillEcal") << "EcalRecHit is not found for DetId: " << itr->rawId() << "\n"; - } - for (std::set::const_iterator itr = ecalIdsInACone.begin(); itr != ecalIdsInACone.end(); itr++) { - std::vector::const_iterator hit = (*EBRecHits).find(*itr); - if (hit != (*EBRecHits).end()) { - info.coneEcalRecHits.push_back(*hit); - } else - LogTrace("HTrackAssociator::fillEcal") << "EcalRecHit is not found for DetId: " << itr->rawId() << "\n"; - } - if (EERecHitCollectionLabels[1] == EBRecHitCollectionLabels[1]) - return; - for (std::set::const_iterator itr = crossedEcalIds.begin(); itr != crossedEcalIds.end(); itr++) { - std::vector::const_iterator hit = (*EERecHits).find(*itr); - if (hit != (*EERecHits).end()) - info.crossedEcalRecHits.push_back(*hit); - else - LogTrace("HTrackAssociator::fillEcal") << "EcalRecHit is not found for DetId: " << itr->rawId() << "\n"; - } - for (std::set::const_iterator itr = ecalIdsInACone.begin(); itr != ecalIdsInACone.end(); itr++) { - std::vector::const_iterator hit = (*EERecHits).find(*itr); - if (hit != (*EERecHits).end()) { - info.coneEcalRecHits.push_back(*hit); - } else - LogTrace("HTrackAssociator::fillEcal") << "EcalRecHit is not found for DetId: " << itr->rawId() << "\n"; - } -} - -//----------------------------------------------------------------------------- -void HTrackAssociator::fillCaloTowers(const edm::Event& iEvent, - const edm::EventSetup& iSetup, - HTrackDetMatchInfo& info, - const FreeTrajectoryState& trajectoryPoint, - const int idR, - const double dR) { - // ECAL hits are not used for the CaloTower identification - caloDetIdAssociator_.setGeometry(&*theCaloGeometry_); - - // HCAL points (HB+HE) - std::vector hcalPoints; - hcalPoints.push_back(GlobalPoint(135., 0, 310.)); - hcalPoints.push_back(GlobalPoint(150., 0, 340.)); - hcalPoints.push_back(GlobalPoint(170., 0, 370.)); - hcalPoints.push_back(GlobalPoint(190., 0, 400.)); - hcalPoints.push_back(GlobalPoint(240., 0, 500.)); - hcalPoints.push_back(GlobalPoint(280., 0, 550.)); - - std::vector hcalTrajectory = caloDetIdAssociator_.getTrajectory(trajectoryPoint, hcalPoints); - // if(hcalTrajectory.empty()) throw cms::Exception("FatalError") << "Failed to propagate the track to HCAL\n"; - - if (hcalTrajectory.empty()) { - LogTrace("HTrackAssociator::fillEcal") << "Failed to propagate a track to ECAL; moving on\n"; - info.isGoodCalo = false; - info.isGoodEcal = false; - std::cout << " HTrackAssociator::fillCaloTowers::Failed to propagate a track to ECAL " << std::endl; - return; - } - - info.isGoodCalo = true; - info.isGoodEcal = true; - info.trkGlobPosAtEcal = getPoint(hcalTrajectory[0]); - - if (hcalTrajectory.size() < 4) { - LogTrace("HTrackAssociator::fillEcal") << "Failed to propagate a track to HCAL; moving on\n"; - info.isGoodHcal = false; - } - - info.isGoodHcal = true; - - info.trkGlobPosAtHcal = getPoint(hcalTrajectory[4]); - - // find crossed CaloTowers - edm::Handle caloTowers; - - if (CaloTowerCollectionLabels.empty()) - throw cms::Exception("FatalError") << "Module lable is not set for CaloTowers.\n"; - else - iEvent.getByLabel(CaloTowerCollectionLabels[0], CaloTowerCollectionLabels[1], caloTowers); - if (!caloTowers.isValid()) - throw cms::Exception("FatalError") << "Unable to find CaloTowers in event!\n"; - - // first get DetIds in a predefined NxN region - // std::set caloTowerIdsInBigRegion = caloDetIdAssociator_.getDetIdsCloseToAPoint(hcalTrajectory[0],idR+1); - std::set caloTowerIdsInRegion = caloDetIdAssociator_.getDetIdsCloseToAPoint(hcalTrajectory[0], idR); - - std::set caloTowerIdsInACone; - std::set crossedCaloTowerIds; - std::set caloTowerIdsInBox; - caloTowerIdsInACone = caloDetIdAssociator_.getDetIdsInACone(caloTowerIdsInRegion, hcalTrajectory, dR); - // get DetId of the most energetic tower in that region - crossedCaloTowerIds = caloDetIdAssociator_.getMaxEDetId(caloTowerIdsInRegion, caloTowers); - // get DetIds of the towers surrounding the most energetic one - caloTowerIdsInBox = caloDetIdAssociator_.getDetIdsInACone(crossedCaloTowerIds, hcalTrajectory, -1.); - - // - // Debug prints - // - // std::cout <<" Debug printout in CaloTowers "<::const_iterator itr = caloTowerIdsInACone.begin(); itr != caloTowerIdsInACone.end(); itr++) { - DetId id(*itr); - CaloTowerCollection::const_iterator tower = (*caloTowers).find(id); - if (tower != (*caloTowers).end()) { - info.coneTowers.push_back(*tower); - } else - LogTrace("HTrackAssociator::fillEcal") << "CaloTower is not found for DetId: " << id.rawId() << "\n"; - } - - for (std::set::const_iterator itr = caloTowerIdsInBox.begin(); itr != caloTowerIdsInBox.end(); itr++) { - DetId id(*itr); - CaloTowerCollection::const_iterator tower = (*caloTowers).find(id); - if (tower != (*caloTowers).end()) { - info.boxTowers.push_back(*tower); - } else - LogTrace("HTrackAssociator::fillEcal") << "CaloTower is not found for DetId: " << id.rawId() << "\n"; - } - - for (std::set::const_iterator itr = caloTowerIdsInRegion.begin(); itr != caloTowerIdsInRegion.end(); itr++) { - DetId id(*itr); - CaloTowerCollection::const_iterator tower = (*caloTowers).find(id); - if (tower != (*caloTowers).end()) { - info.regionTowers.push_back(*tower); - } else - LogTrace("HTrackAssociator::fillEcal") << "CaloTower is not found for DetId: " << id.rawId() << "\n"; - } -} - -//----------------------------------------------------------------------------- -void HTrackAssociator::fillHcal(const edm::Event& iEvent, - const edm::EventSetup& iSetup, - HTrackDetMatchInfo& info, - const FreeTrajectoryState& trajectoryPoint, - const int idR, - const double dR) { - hcalDetIdAssociator_.setGeometry(&*theCaloGeometry_); - - // HCAL points (HB+HE) - std::vector hcalPoints; - hcalPoints.push_back(GlobalPoint(190., 0, 400.)); - hcalPoints.push_back(GlobalPoint(240., 0, 500.)); - hcalPoints.push_back(GlobalPoint(280., 0, 550.)); - - std::vector hcalTrajectory = hcalDetIdAssociator_.getTrajectory(trajectoryPoint, hcalPoints); - // if(hcalTrajectory.empty()) throw cms::Exception("FatalError") << "Failed to propagate the track to HCAL\n"; - - if (hcalTrajectory.empty()) { - LogTrace("HTrackAssociator::fillHcal") << "Failed to propagate a track to HCAL; moving on\n"; - info.isGoodHcal = false; - // std::cout<<" HTrackAssociator::fillHcal::Failed to propagate a track to HCAL "< HBHERecHits; - // if (HBHERecHitCollectionLabels.empty()) - // throw cms::Exception("FatalError") << "Module label is not set for HBHERecHitCollection.\n"; - // else - iEvent.getByLabel(HBHERecHitCollectionLabels[0], HBHERecHitCollectionLabels[1], HBHERecHits); - if (!HBHERecHits.isValid()) - throw cms::Exception("FatalError") << "Unable to find HBHERecHitCollection in event!\n"; - - // first get DetIds in a predefined NxN region - // std::set hcalIdsInBigRegion = hcalDetIdAssociator_.getDetIdsCloseToAPoint(hcalTrajectory[0],idR+1); - std::set hcalIdsInRegion = hcalDetIdAssociator_.getDetIdsCloseToAPoint(hcalTrajectory[0], idR); - - std::set hcalIdsInACone; - std::set crossedHcalIds; - std::set hcalIdsInBox; - hcalIdsInACone = hcalDetIdAssociator_.getDetIdsInACone(hcalIdsInRegion, hcalTrajectory, dR); - // get DetId of the most energetic tower in that region - crossedHcalIds = hcalDetIdAssociator_.getMaxEDetId(hcalIdsInRegion, HBHERecHits); - // get DetIds of the towers surrounding the most energetic one - hcalIdsInBox = hcalDetIdAssociator_.getDetIdsInACone(crossedHcalIds, hcalTrajectory, -1.); - - // add HcalRecHits - for (std::set::const_iterator itr = crossedHcalIds.begin(); itr != crossedHcalIds.end(); itr++) { - std::vector::const_iterator hit = (*HBHERecHits).find(*itr); - if (hit != (*HBHERecHits).end()) - info.crossedHcalRecHits.push_back(*hit); - else - LogTrace("HTrackAssociator::fillHcal") << "HcalRecHit is not found for DetId: " << itr->rawId() << "\n"; - } - for (std::set::const_iterator itr = hcalIdsInACone.begin(); itr != hcalIdsInACone.end(); itr++) { - std::vector::const_iterator hit = (*HBHERecHits).find(*itr); - if (hit != (*HBHERecHits).end()) - info.coneHcalRecHits.push_back(*hit); - else - LogTrace("HTrackAssociator::fillHcal") << "HcalRecHit is not found for DetId: " << itr->rawId() << "\n"; - } - for (std::set::const_iterator itr = hcalIdsInBox.begin(); itr != hcalIdsInBox.end(); itr++) { - std::vector::const_iterator hit = (*HBHERecHits).find(*itr); - if (hit != (*HBHERecHits).end()) - info.boxHcalRecHits.push_back(*hit); - else - LogTrace("HTrackAssociator::fillHcal") << "HcalRecHit is not found for DetId: " << itr->rawId() << "\n"; - } - for (std::set::const_iterator itr = hcalIdsInRegion.begin(); itr != hcalIdsInRegion.end(); itr++) { - std::vector::const_iterator hit = (*HBHERecHits).find(*itr); - if (hit != (*HBHERecHits).end()) - info.regionHcalRecHits.push_back(*hit); - else - LogTrace("HTrackAssociator::fillHcal") << "HcalRecHit is not found for DetId: " << itr->rawId() << "\n"; - } -} - -//----------------------------------------------------------------------------- -void HTrackAssociator::fillHcalTowers(const edm::Event& iEvent, - const edm::EventSetup& iSetup, - HTrackDetMatchInfo& info, - const FreeTrajectoryState& trajectoryPoint, - const int idR, - const double dR) { - // ECAL hits are not used for the CaloTower identification - caloDetIdAssociator_.setGeometry(&*theCaloGeometry_); - - // HCAL points (HB+HE) - std::vector hcalPoints; - hcalPoints.push_back(GlobalPoint(190., 0, 400.)); - hcalPoints.push_back(GlobalPoint(240., 0, 500.)); - hcalPoints.push_back(GlobalPoint(280., 0, 550.)); - - std::vector hcalTrajectory = caloDetIdAssociator_.getTrajectory(trajectoryPoint, hcalPoints); - // if(hcalTrajectory.empty()) throw cms::Exception("FatalError") << "Failed to propagate the track to HCAL\n"; - - if (hcalTrajectory.empty()) { - LogTrace("HTrackAssociator::fillEcal") << "Failed to propagate a track to HCAL; moving on\n"; - info.isGoodCalo = false; - std::cout << " HTrackAssociator::fillCaloTowers::Failed to propagate a track to HCAL " << std::endl; - return; - } - - info.isGoodCalo = true; - - info.trkGlobPosAtHcal = getPoint(hcalTrajectory[0]); - - // find crossed CaloTowers - edm::Handle caloTowers; - - if (CaloTowerCollectionLabels.empty()) - throw cms::Exception("FatalError") << "Module lable is not set for CaloTowers.\n"; - else - iEvent.getByLabel(CaloTowerCollectionLabels[0], CaloTowerCollectionLabels[1], caloTowers); - if (!caloTowers.isValid()) - throw cms::Exception("FatalError") << "Unable to find CaloTowers in event!\n"; - - // first get DetIds in a predefined NxN region - std::set caloTowerIdsInBigRegion = caloDetIdAssociator_.getDetIdsCloseToAPoint(hcalTrajectory[0], idR + 1); - std::set caloTowerIdsInRegion = caloDetIdAssociator_.getDetIdsCloseToAPoint(hcalTrajectory[0], idR); - - std::set caloTowerIdsInACone; - std::set crossedCaloTowerIds; - std::set caloTowerIdsInBox; - caloTowerIdsInACone = caloDetIdAssociator_.getDetIdsInACone(caloTowerIdsInBigRegion, hcalTrajectory, dR); - // get DetId of the most energetic tower in that region - crossedCaloTowerIds = caloDetIdAssociator_.getMaxEDetId(caloTowerIdsInRegion, caloTowers); - // get DetIds of the towers surrounding the most energetic one - caloTowerIdsInBox = caloDetIdAssociator_.getDetIdsInACone(crossedCaloTowerIds, hcalTrajectory, -1.); - - // add CaloTowers - for (std::set::const_iterator itr = crossedCaloTowerIds.begin(); itr != crossedCaloTowerIds.end(); itr++) { - DetId id(*itr); - CaloTowerCollection::const_iterator tower = (*caloTowers).find(id); - if (tower != (*caloTowers).end()) - info.crossedTowers.push_back(*tower); - else - LogTrace("HTrackAssociator::fillEcal") << "CaloTower is not found for DetId: " << id.rawId() << "\n"; - } - - for (std::set::const_iterator itr = caloTowerIdsInACone.begin(); itr != caloTowerIdsInACone.end(); itr++) { - DetId id(*itr); - CaloTowerCollection::const_iterator tower = (*caloTowers).find(id); - if (tower != (*caloTowers).end()) - info.coneTowers.push_back(*tower); - else - LogTrace("HTrackAssociator::fillEcal") << "CaloTower is not found for DetId: " << id.rawId() << "\n"; - } -} - -//----------------------------------------------------------------------------- -FreeTrajectoryState HTrackAssociator::getFreeTrajectoryState(const edm::EventSetup& iSetup, - const SimTrack& track, - const SimVertex& vertex) { - edm::ESHandle bField; - iSetup.get().get(bField); - - GlobalVector vector(track.momentum().x(), track.momentum().y(), track.momentum().z()); - // convert mm to cm - GlobalPoint point(vertex.position().x() * .1, vertex.position().y() * .1, vertex.position().z() * .1); - int charge = track.type() > 0 ? -1 : 1; - GlobalTrajectoryParameters tPars(point, vector, charge, &*bField); - - AlgebraicSymMatrix66 covT = AlgebraicMatrixID(); - covT *= 1e-6; // initialize to sigma=1e-3 - CartesianTrajectoryError tCov(covT); - - return FreeTrajectoryState(tPars, tCov); -} - -//----------------------------------------------------------------------------- -FreeTrajectoryState HTrackAssociator::getFreeTrajectoryState(const edm::EventSetup& iSetup, const reco::Track& track) { - edm::ESHandle bField; - iSetup.get().get(bField); - - GlobalVector vector(track.momentum().x(), track.momentum().y(), track.momentum().z()); - - GlobalPoint point(track.vertex().x(), track.vertex().y(), track.vertex().z()); - - GlobalTrajectoryParameters tPars(point, vector, track.charge(), &*bField); - - // FIX THIS !!! - // need to convert from perigee to global or helix (curvilinear) frame - // for now just an arbitrary matrix. - AlgebraicSymMatrix66 covT = AlgebraicMatrixID(); - covT *= 1e-6; // initialize to sigma=1e-3 - CartesianTrajectoryError tCov(covT); - - return FreeTrajectoryState(tPars, tCov); -} diff --git a/CaloOnlineTools/EcalTools/plugins/EcalCosmicsHists.cc b/CaloOnlineTools/EcalTools/plugins/EcalCosmicsHists.cc index 0ca644721df5d..6a32a881142ee 100644 --- a/CaloOnlineTools/EcalTools/plugins/EcalCosmicsHists.cc +++ b/CaloOnlineTools/EcalTools/plugins/EcalCosmicsHists.cc @@ -15,28 +15,16 @@ #include "DataFormats/DetId/interface/DetId.h" #include "Geometry/CaloTopology/interface/CaloTopology.h" #include "Geometry/Records/interface/CaloTopologyRecord.h" -#include "Geometry/EcalMapping/interface/EcalElectronicsMapping.h" -#include "Geometry/EcalMapping/interface/EcalMappingRcd.h" #include "DataFormats/EgammaReco/interface/BasicCluster.h" #include "DataFormats/EgammaReco/interface/BasicClusterFwd.h" -#include "DataFormats/EgammaReco/interface/SuperCluster.h" -#include "DataFormats/EgammaReco/interface/SuperClusterFwd.h" #include "DataFormats/CaloRecHit/interface/CaloClusterFwd.h" #include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h" #include "DataFormats/HcalDetId/interface/HcalSubdetector.h" -#include "CondFormats/EcalObjects/interface/EcalADCToGeVConstant.h" -#include "CondFormats/L1TObjects/interface/L1GtTriggerMenu.h" -#include "CondFormats/DataRecord/interface/L1GtTriggerMenuRcd.h" #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutSetupFwd.h" #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutSetup.h" -#include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutRecord.h" -#include "CondFormats/DataRecord/interface/EcalADCToGeVConstantRcd.h" - -#include -#include "TLine.h" using namespace cms; using namespace edm; @@ -61,6 +49,22 @@ EcalCosmicsHists::EcalCosmicsHists(const edm::ParameterSet& iConfig) endcapClusterCollection_(iConfig.getParameter("endcapClusterCollection")), l1GTReadoutRecTag_(iConfig.getUntrackedParameter("L1GlobalReadoutRecord", "gtDigis")), l1GMTReadoutRecTag_(iConfig.getUntrackedParameter("L1GlobalMuonReadoutRecord", "gtDigis")), + barrelClusterToken_(consumes(barrelClusterCollection_)), + endcapClusterToken_(consumes(endcapClusterCollection_)), + ebRecHitToken_(consumes(ecalRecHitCollectionEB_)), + eeRecHitToken_(consumes(ecalRecHitCollectionEE_)), + ecalRawDataToken_(consumes(ecalRawDataColl_)), + tracksToken_(consumes(edm::InputTag("cosmicMuons"))), + tracksBarrelToken_(consumes(edm::InputTag("cosmicMuonsBarrelOnly"))), + hbheRecHitToken_(consumes(edm::InputTag("hbhereco"))), + hfRecHitToken_(consumes(edm::InputTag("hfreco"))), + hoRecHitToken_(consumes(edm::InputTag("horeco"))), + l1MuGMTToken_(consumes(l1GMTReadoutRecTag_)), + l1GTReadoutToken_(consumes(l1GTReadoutRecTag_)), + gtRecordToken_(consumes(edm::InputTag("gtDigis"))), + ecalADCToGeVConstantToken_(esConsumes()), + l1MenuToken_(esConsumes()), + ecalMappingToken_(esConsumes()), runNum_(-1), histRangeMax_(iConfig.getUntrackedParameter("histogramMaxRange", 1.8)), histRangeMin_(iConfig.getUntrackedParameter("histogramMinRange", 0.0)), @@ -115,17 +119,11 @@ void EcalCosmicsHists::analyze(edm::Event const& iEvent, edm::EventSetup const& //LogDebug("EcalCosmicsHists")<< "Timestamp: " << iEvent.id().run() << " " << iEvent.id().event() << " " << iEvent.time().value(); // check DB payload - edm::ESHandle pAgc; - iSetup.get().get(pAgc); - const EcalADCToGeVConstant* agc = pAgc.product(); + const auto& agc = iSetup.getData(ecalADCToGeVConstantToken_); if (naiveEvtNum_ <= 1) { - LogWarning("EcalCosmicsHists") << "Global EB ADC->GeV scale: " << agc->getEBValue() << " GeV/ADC count"; - LogWarning("EcalCosmicsHists") << "Global EE ADC->GeV scale: " << agc->getEEValue() << " GeV/ADC count"; + LogWarning("EcalCosmicsHists") << "Global EB ADC->GeV scale: " << agc.getEBValue() << " GeV/ADC count"; + LogWarning("EcalCosmicsHists") << "Global EE ADC->GeV scale: " << agc.getEEValue() << " GeV/ADC count"; } - //float adcEBconst = agc->getEBValue(); - //float adcEEconst = agc->getEEValue(); - - // //===================TIMESTAMP INFORMTION================================= // Code added to get the time in seconds @@ -136,14 +134,14 @@ void EcalCosmicsHists::analyze(edm::Event const& iEvent, edm::EventSetup const& //std::cout << "Event Time " << eventTime << " High " < hits; - iEvent.getByLabel(ecalRecHitCollectionEB_, hits); + iEvent.getByToken(ebRecHitToken_, hits); if (!(hits.isValid())) { LogWarning("EcalCosmicsHists") << ecalRecHitCollectionEB_ << " not available"; return; } Handle hitsEE; - iEvent.getByLabel(ecalRecHitCollectionEE_, hitsEE); + iEvent.getByToken(eeRecHitToken_, hitsEE); if (!(hitsEE.isValid())) { LogWarning("EcalCosmicsHists") << ecalRecHitCollectionEE_ << " not available"; return; } Handle DCCHeaders; - iEvent.getByLabel(ecalRawDataColl_, DCCHeaders); + iEvent.getByToken(ecalRawDataToken_, DCCHeaders); if (!DCCHeaders.isValid()) LogWarning("EcalCosmicsHists") << "DCC headers not available"; @@ -662,7 +660,7 @@ void EcalCosmicsHists::analyze(edm::Event const& iEvent, edm::EventSetup const& // << " ) " << std::endl; if (!EEDetId::validDetId(ix, iy, iz)) { - LogWarning("EcalCosmicsHists") << "INVALID EE DetId !!!" << endl; + LogWarning("EcalCosmicsHists") << "INVALID EE DetId !!!"; return; } @@ -1007,10 +1005,9 @@ void EcalCosmicsHists::analyze(edm::Event const& iEvent, edm::EventSetup const& // get reco tracks edm::Handle recoTracks; - iEvent.getByLabel("cosmicMuons", recoTracks); + iEvent.getByToken(tracksToken_, recoTracks); if (recoTracks.isValid()) { - // LogWarning("EcalCosmicsHists") << "... Valid TrackAssociator recoTracks !!! " << recoTracks.product()->size(); std::map > trackDetIdMap; int tracks = 0; for (reco::TrackCollection::const_iterator recoTrack = recoTracks->begin(); recoTrack != recoTracks->end(); @@ -1171,16 +1168,15 @@ void EcalCosmicsHists::analyze(edm::Event const& iEvent, edm::EventSetup const& numberofCosmicsWTrackHist_->Fill(numSeeds); } } else { - // LogWarning("EcalCosmicsHists") << "!!! No TrackAssociator recoTracks !!!"; + LogWarning("EcalCosmicsHists") << "!!! No TrackAssociator recoTracks !!!"; } // Study on Tracks for High Energy events edm::Handle recoTracksBarrel; - iEvent.getByLabel("cosmicMuonsBarrelOnly", recoTracksBarrel); + iEvent.getByToken(tracksBarrelToken_, recoTracksBarrel); if (!recoTracksBarrel.isValid()) { - //edm::LogWarning("EcalCosmicsHists") << "RecoTracksBarrel not valid!! " ; + edm::LogWarning("EcalCosmicsHists") << "RecoTracksBarrel not valid!! "; } else { - //edm::LogWarning("EcalCosmicsHists") << "Number of barrel reco tracks found in the event: " << recoTracksBarrel->size() ; HighEnergy_numRecoTrackBarrel->Fill(recoTracksBarrel->size()); for (reco::TrackCollection::const_iterator recoTrack = recoTracksBarrel->begin(); recoTrack != recoTracksBarrel->end(); @@ -1259,16 +1255,15 @@ void EcalCosmicsHists::analyze(edm::Event const& iEvent, edm::EventSetup const& //hcal rechits edm::Handle hbhe; - iEvent.getByLabel("hbhereco", hbhe); + iEvent.getByToken(hbheRecHitToken_, hbhe); edm::Handle hfrh; - iEvent.getByLabel("hfreco", hfrh); + iEvent.getByToken(hfRecHitToken_, hfrh); edm::Handle horh; - iEvent.getByLabel("horeco", horh); + iEvent.getByToken(hoRecHitToken_, horh); if (hbhe.isValid()) { - // LogInfo("EcalCosmicHists") << "event " << ievt << " HBHE RecHits collection size " << hbhe->size(); const HBHERecHitCollection hbheHit = *(hbhe.product()); for (HBHERecHitCollection::const_iterator hhit = hbheHit.begin(); hhit != hbheHit.end(); hhit++) { // if (hhit->energy() > 0.6){ @@ -1276,21 +1271,19 @@ void EcalCosmicsHists::analyze(edm::Event const& iEvent, edm::EventSetup const& // } } } else { - // LogWarning("EcalCosmicHists") << " HBHE RecHits **NOT** VALID!! " << endl; + LogWarning("EcalCosmicHists") << " HBHE RecHits **NOT** VALID!! "; } if (hfrh.isValid()) { - // LogInfo("EcalCosmicHists") << "event " << ievt << " HF RecHits collection size " << hfrh->size(); const HFRecHitCollection hfHit = *(hfrh.product()); for (HFRecHitCollection::const_iterator hhit = hfHit.begin(); hhit != hfHit.end(); hhit++) { hcalEnergy_HF_->Fill(hhit->energy()); } } else { - // LogWarning("EcalCosmicHists") << " HF RecHits **NOT** VALID!! " << endl; + LogWarning("EcalCosmicHists") << " HF RecHits **NOT** VALID!! "; } if (horh.isValid()) { - // LogInfo("EcalCosmicHists") << "event " << ievt << " HO RecHits collection size " << horh->size(); const HORecHitCollection hoHit = *(horh.product()); for (HORecHitCollection::const_iterator hhit = hoHit.begin(); hhit != hoHit.end(); hhit++) { // if (hhit->energy() > 0.6){ @@ -1298,7 +1291,7 @@ void EcalCosmicsHists::analyze(edm::Event const& iEvent, edm::EventSetup const& // } } } else { - // LogWarning("EcalCosmicHists") << " HO RecHits **NOT** VALID!! " << endl; + LogWarning("EcalCosmicHists") << " HO RecHits **NOT** VALID!! "; } // *** end of HCAL code *** // @@ -1313,7 +1306,7 @@ std::vector EcalCosmicsHists::determineTriggers(const edm::Event& iEvent, // get the GMTReadoutCollection Handle gmtrc_handle; - iEvent.getByLabel(l1GMTReadoutRecTag_, gmtrc_handle); + iEvent.getByToken(l1MuGMTToken_, gmtrc_handle); L1MuGMTReadoutCollection const* gmtrc = gmtrc_handle.product(); if (!(gmtrc_handle.isValid())) { LogWarning("EcalCosmicsHists") << "l1MuGMTReadoutCollection" @@ -1322,31 +1315,29 @@ std::vector EcalCosmicsHists::determineTriggers(const edm::Event& iEvent, } // get hold of L1GlobalReadoutRecord Handle L1GTRR; - iEvent.getByLabel(l1GTReadoutRecTag_, L1GTRR); + iEvent.getByToken(l1GTReadoutToken_, L1GTRR); //Ecal - edm::ESHandle menuRcd; - eventSetup.get().get(menuRcd); - const L1GtTriggerMenu* menu = menuRcd.product(); + const auto& menu = eventSetup.getData(l1MenuToken_); edm::Handle gtRecord; - iEvent.getByLabel(edm::InputTag("gtDigis"), gtRecord); + iEvent.getByToken(gtRecordToken_, gtRecord); // Get dWord after masking disabled bits const DecisionWord dWord = gtRecord->decisionWord(); - bool l1SingleEG1 = menu->gtAlgorithmResult("L1_SingleEG1", dWord); - bool l1SingleEG5 = menu->gtAlgorithmResult("L1_SingleEG5", dWord); - bool l1SingleEG8 = menu->gtAlgorithmResult("L1_SingleEG8", dWord); - bool l1SingleEG10 = menu->gtAlgorithmResult("L1_SingleEG10", dWord); - bool l1SingleEG12 = menu->gtAlgorithmResult("L1_SingleEG12", dWord); - bool l1SingleEG15 = menu->gtAlgorithmResult("L1_SingleEG15", dWord); - bool l1SingleEG20 = menu->gtAlgorithmResult("L1_SingleEG20", dWord); - bool l1SingleEG25 = menu->gtAlgorithmResult("L1_SingleEG25", dWord); - bool l1DoubleNoIsoEGBTBtight = menu->gtAlgorithmResult("L1_DoubleNoIsoEG_BTB_tight", dWord); - bool l1DoubleNoIsoEGBTBloose = menu->gtAlgorithmResult("L1_DoubleNoIsoEG_BTB_loose ", dWord); - bool l1DoubleNoIsoEGTopBottom = menu->gtAlgorithmResult("L1_DoubleNoIsoEGTopBottom", dWord); - bool l1DoubleNoIsoEGTopBottomCen = menu->gtAlgorithmResult("L1_DoubleNoIsoEGTopBottomCen", dWord); - bool l1DoubleNoIsoEGTopBottomCen2 = menu->gtAlgorithmResult("L1_DoubleNoIsoEGTopBottomCen2", dWord); - bool l1DoubleNoIsoEGTopBottomCenVert = menu->gtAlgorithmResult("L1_DoubleNoIsoEGTopBottomCenVert", dWord); + bool l1SingleEG1 = menu.gtAlgorithmResult("L1_SingleEG1", dWord); + bool l1SingleEG5 = menu.gtAlgorithmResult("L1_SingleEG5", dWord); + bool l1SingleEG8 = menu.gtAlgorithmResult("L1_SingleEG8", dWord); + bool l1SingleEG10 = menu.gtAlgorithmResult("L1_SingleEG10", dWord); + bool l1SingleEG12 = menu.gtAlgorithmResult("L1_SingleEG12", dWord); + bool l1SingleEG15 = menu.gtAlgorithmResult("L1_SingleEG15", dWord); + bool l1SingleEG20 = menu.gtAlgorithmResult("L1_SingleEG20", dWord); + bool l1SingleEG25 = menu.gtAlgorithmResult("L1_SingleEG25", dWord); + bool l1DoubleNoIsoEGBTBtight = menu.gtAlgorithmResult("L1_DoubleNoIsoEG_BTB_tight", dWord); + bool l1DoubleNoIsoEGBTBloose = menu.gtAlgorithmResult("L1_DoubleNoIsoEG_BTB_loose ", dWord); + bool l1DoubleNoIsoEGTopBottom = menu.gtAlgorithmResult("L1_DoubleNoIsoEGTopBottom", dWord); + bool l1DoubleNoIsoEGTopBottomCen = menu.gtAlgorithmResult("L1_DoubleNoIsoEGTopBottomCen", dWord); + bool l1DoubleNoIsoEGTopBottomCen2 = menu.gtAlgorithmResult("L1_DoubleNoIsoEGTopBottomCen2", dWord); + bool l1DoubleNoIsoEGTopBottomCenVert = menu.gtAlgorithmResult("L1_DoubleNoIsoEGTopBottomCenVert", dWord); l1Triggers[4] = l1SingleEG1 || l1SingleEG5 || l1SingleEG8 || l1SingleEG10 || l1SingleEG12 || l1SingleEG15 || l1SingleEG20 || l1SingleEG25 || l1DoubleNoIsoEGBTBtight || l1DoubleNoIsoEGBTBloose || @@ -1568,9 +1559,7 @@ void EcalCosmicsHists::initHists(int FED) { // ------------ method called once each job just before starting event loop ------------ void EcalCosmicsHists::beginRun(edm::Run const&, edm::EventSetup const& eventSetup) { - edm::ESHandle handle; - eventSetup.get().get(handle); - ecalElectronicsMap_ = handle.product(); + ecalElectronicsMap_ = &eventSetup.getData(ecalMappingToken_); //Here I will init some of the specific histograms int numBins = 200; //(int)round(histRangeMax_-histRangeMin_)+1; @@ -2755,6 +2744,8 @@ void EcalCosmicsHists::beginRun(edm::Run const&, edm::EventSetup const& eventSet new TH1F("NumActiveXtalsInClusterAllHist", "Number of active Xtals in Cluster EEP;NumXtals", 100, 0, 100); } +void EcalCosmicsHists::endRun(edm::Run const&, edm::EventSetup const& eventSetup) {} + // ------------ method called once each job just after ending the event loop ------------ void EcalCosmicsHists::endJob() { using namespace std; diff --git a/CaloOnlineTools/EcalTools/plugins/EcalCosmicsHists.h b/CaloOnlineTools/EcalTools/plugins/EcalCosmicsHists.h index 08873493370a3..9fb9762eda4ee 100644 --- a/CaloOnlineTools/EcalTools/plugins/EcalCosmicsHists.h +++ b/CaloOnlineTools/EcalTools/plugins/EcalCosmicsHists.h @@ -20,19 +20,24 @@ #include #include #include -#include // user include files #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/Framework/interface/ESHandle.h" + +#include "CondFormats/DataRecord/interface/EcalADCToGeVConstantRcd.h" +#include "CondFormats/EcalObjects/interface/EcalADCToGeVConstant.h" +#include "CondFormats/L1TObjects/interface/L1GtTriggerMenu.h" +#include "CondFormats/DataRecord/interface/L1GtTriggerMenuRcd.h" #include "DataFormats/EcalDigi/interface/EcalDigiCollections.h" #include "DataFormats/EcalRecHit/interface/EcalUncalibratedRecHit.h" #include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" +#include "DataFormats/EgammaReco/interface/SuperCluster.h" +#include "DataFormats/EgammaReco/interface/SuperClusterFwd.h" #include "DataFormats/DetId/interface/DetId.h" #include "DataFormats/EcalRawData/interface/EcalRawDataCollections.h" #include "DataFormats/L1GlobalMuonTrigger/interface/L1MuRegionalCand.h" @@ -41,6 +46,7 @@ #include "DataFormats/L1GlobalTrigger/interface/L1GtPsbWord.h" #include "Geometry/EcalMapping/interface/EcalElectronicsMapping.h" +#include "Geometry/EcalMapping/interface/EcalMappingRcd.h" #include "CaloOnlineTools/EcalTools/interface/EcalFedMap.h" @@ -65,13 +71,14 @@ // class declaration // -class EcalCosmicsHists : public edm::EDAnalyzer { +class EcalCosmicsHists : public edm::one::EDAnalyzer { public: explicit EcalCosmicsHists(const edm::ParameterSet&); ~EcalCosmicsHists() override; private: void beginRun(edm::Run const&, edm::EventSetup const&) override; + void endRun(edm::Run const&, edm::EventSetup const&) override; void analyze(edm::Event const&, edm::EventSetup const&) override; void endJob() override; std::string intToString(int num); @@ -88,21 +95,39 @@ class EcalCosmicsHists : public edm::EDAnalyzer { edm::InputTag l1GTReadoutRecTag_; edm::InputTag l1GMTReadoutRecTag_; + const edm::EDGetTokenT barrelClusterToken_; + const edm::EDGetTokenT endcapClusterToken_; + const edm::EDGetTokenT ebRecHitToken_; + const edm::EDGetTokenT eeRecHitToken_; + const edm::EDGetTokenT ecalRawDataToken_; + const edm::EDGetTokenT tracksToken_; + const edm::EDGetTokenT tracksBarrelToken_; + const edm::EDGetTokenT hbheRecHitToken_; + const edm::EDGetTokenT hfRecHitToken_; + const edm::EDGetTokenT hoRecHitToken_; + const edm::EDGetTokenT l1MuGMTToken_; + const edm::EDGetTokenT l1GTReadoutToken_; + const edm::EDGetTokenT gtRecordToken_; + + const edm::ESGetToken ecalADCToGeVConstantToken_; + const edm::ESGetToken l1MenuToken_; + const edm::ESGetToken ecalMappingToken_; + int runNum_; - double histRangeMax_, histRangeMin_; - double minTimingAmpEB_; - double minTimingAmpEE_; - double minRecHitAmpEB_; - double minRecHitAmpEE_; - double minHighEnergy_; + const double histRangeMax_, histRangeMin_; + const double minTimingAmpEB_; + const double minTimingAmpEE_; + const double minRecHitAmpEB_; + const double minRecHitAmpEE_; + const double minHighEnergy_; double* ttEtaBins; double* modEtaBins; std::string fileName_; - bool runInFileName_; + const bool runInFileName_; - double startTime_, runTimeLength_; - int numTimingBins_; + const double startTime_, runTimeLength_; + const int numTimingBins_; std::map FEDsAndHists_; std::map FEDsAndE2Hists_; diff --git a/CaloOnlineTools/EcalTools/plugins/EcalDigiDisplay.cc b/CaloOnlineTools/EcalTools/plugins/EcalDigiDisplay.cc index d9ba84b8ba0ef..b8f5edb30ee1c 100644 --- a/CaloOnlineTools/EcalTools/plugins/EcalDigiDisplay.cc +++ b/CaloOnlineTools/EcalTools/plugins/EcalDigiDisplay.cc @@ -8,17 +8,11 @@ * */ -#include -#include -#include -#include #include #include "CaloOnlineTools/EcalTools/plugins/EcalDigiDisplay.h" #include "CaloOnlineTools/EcalTools/interface/EcalFedMap.h" -#include "DataFormats/EcalDigi/interface/EcalDigiCollections.h" #include "DataFormats/EcalDetId/interface/EcalDetIdCollections.h" -#include "DataFormats/EcalRawData/interface/EcalRawDataCollections.h" #include "DataFormats/EcalRawData/interface/EcalDCCHeaderBlock.h" #include "DataFormats/EcalDigi/interface/EcalTriggerPrimitiveDigi.h" @@ -26,17 +20,18 @@ #include #include -#include -#include //========================================================================== -EcalDigiDisplay::EcalDigiDisplay(const edm::ParameterSet& ps) { +EcalDigiDisplay::EcalDigiDisplay(const edm::ParameterSet& ps) + : ebDigiCollection_(ps.getParameter("ebDigiCollection")), + eeDigiCollection_(ps.getParameter("eeDigiCollection")), + digiProducer_(ps.getParameter("digiProducer")), + rawDataToken_(consumes(edm::InputTag(digiProducer_))), + ebDigiToken_(consumes(edm::InputTag(digiProducer_, ebDigiCollection_))), + eeDigiToken_(consumes(edm::InputTag(digiProducer_, eeDigiCollection_))), + pnDiodeDigiToken_(consumes(edm::InputTag(digiProducer_))), + ecalMappingToken_(esConsumes()) { //========================================================================= - - ebDigiCollection_ = ps.getParameter("ebDigiCollection"); - eeDigiCollection_ = ps.getParameter("eeDigiCollection"); - digiProducer_ = ps.getParameter("digiProducer"); - requestedFeds_ = ps.getUntrackedParameter >("requestedFeds"); requestedEbs_ = ps.getUntrackedParameter >("requestedEbs"); @@ -175,11 +170,13 @@ void EcalDigiDisplay::beginRun(edm::Run const&, edm::EventSetup const& c) { //======================================================================== edm::LogInfo("EcalDigiDisplay") << "entering beginRun! "; - edm::ESHandle elecHandle; - c.get().get(elecHandle); - ecalElectronicsMap_ = elecHandle.product(); + ecalElectronicsMap_ = &c.getData(ecalMappingToken_); } +//======================================================================== +void EcalDigiDisplay::endRun(edm::Run const&, edm::EventSetup const& c) {} +//======================================================================== + //======================================================================== void EcalDigiDisplay::analyze(edm::Event const& e, edm::EventSetup const& c) { //======================================================================== @@ -189,9 +186,8 @@ void EcalDigiDisplay::analyze(edm::Event const& e, edm::EventSetup const& c) { //Get DCC headers edm::Handle dccHeader; - try { - e.getByLabel(digiProducer_, dccHeader); - } catch (cms::Exception& ex) { + e.getByToken(rawDataToken_, dccHeader); + if (!dccHeader.isValid()) { edm::LogError("EcalDigiUnpackerModule") << "Can't get DCC Headers!"; } @@ -201,33 +197,30 @@ void EcalDigiDisplay::analyze(edm::Event const& e, edm::EventSetup const& c) { bool pnDigisFound = false; // retrieving crystal data from Event edm::Handle eb_digis; - try { - e.getByLabel(digiProducer_, ebDigiCollection_, eb_digis); - if (!eb_digis->empty()) - ebDigisFound = true; - } catch (cms::Exception& ex) { + e.getByToken(ebDigiToken_, eb_digis); + if (!eb_digis.isValid()) { edm::LogError("EcalDigiUnpackerModule") << "EB Digis were not found!"; } + if (!eb_digis->empty()) + ebDigisFound = true; // edm::Handle ee_digis; - try { - e.getByLabel(digiProducer_, eeDigiCollection_, ee_digis); - if (!ee_digis->empty()) - eeDigisFound = true; - } catch (cms::Exception& ex) { + e.getByToken(eeDigiToken_, ee_digis); + if (!ee_digis.isValid()) { edm::LogError("EcalDigiUnpackerModule") << "EE Digis were not found!"; } + if (!ee_digis->empty()) + eeDigisFound = true; // retrieving crystal PN diodes from Event edm::Handle pn_digis; - try { - e.getByLabel(digiProducer_, pn_digis); - if (!pn_digis->empty()) - pnDigisFound = true; - } catch (cms::Exception& ex) { + e.getByToken(pnDiodeDigiToken_, pn_digis); + if (!pn_digis.isValid()) { edm::LogError("EcalDigiUnpackerModule") << "PNs were not found!"; } + if (!pn_digis->empty()) + pnDigisFound = true; //============================= //Call for funcitons diff --git a/CaloOnlineTools/EcalTools/plugins/EcalDigiDisplay.h b/CaloOnlineTools/EcalTools/plugins/EcalDigiDisplay.h index a7c98140496d2..d57eac7031873 100644 --- a/CaloOnlineTools/EcalTools/plugins/EcalDigiDisplay.h +++ b/CaloOnlineTools/EcalTools/plugins/EcalDigiDisplay.h @@ -5,19 +5,19 @@ #include #include -#include +#include #include #include -#include #include #include "DataFormats/EcalDigi/interface/EcalDigiCollections.h" +#include "DataFormats/EcalRawData/interface/EcalRawDataCollections.h" #include "CaloOnlineTools/EcalTools/interface/EcalFedMap.h" #include "Geometry/EcalMapping/interface/EcalMappingRcd.h" #include "Geometry/EcalMapping/interface/EcalElectronicsMapping.h" // class declaration -class EcalDigiDisplay : public edm::EDAnalyzer { +class EcalDigiDisplay : public edm::one::EDAnalyzer { public: //Constractor EcalDigiDisplay(const edm::ParameterSet& ps); @@ -27,6 +27,7 @@ class EcalDigiDisplay : public edm::EDAnalyzer { private: void analyze(edm::Event const& e, edm::EventSetup const& c) override; void beginRun(edm::Run const&, edm::EventSetup const& c) override; + void endRun(edm::Run const&, edm::EventSetup const& c) override; void endJob() override; protected: @@ -36,9 +37,15 @@ class EcalDigiDisplay : public edm::EDAnalyzer { EcalFedMap* fedMap; - std::string ebDigiCollection_; - std::string eeDigiCollection_; - std::string digiProducer_; + const std::string ebDigiCollection_; + const std::string eeDigiCollection_; + const std::string digiProducer_; + + const edm::EDGetTokenT rawDataToken_; + const edm::EDGetTokenT ebDigiToken_; + const edm::EDGetTokenT eeDigiToken_; + const edm::EDGetTokenT pnDiodeDigiToken_; + const edm::ESGetToken ecalMappingToken_; std::vector requestedFeds_; std::vector requestedEbs_; diff --git a/CaloOnlineTools/EcalTools/plugins/EcalDisplaysByEvent.cc b/CaloOnlineTools/EcalTools/plugins/EcalDisplaysByEvent.cc index 589521f9b2ab4..2cf5b72351e2b 100644 --- a/CaloOnlineTools/EcalTools/plugins/EcalDisplaysByEvent.cc +++ b/CaloOnlineTools/EcalTools/plugins/EcalDisplaysByEvent.cc @@ -22,8 +22,6 @@ #include "TLine.h" #include "TProfile2D.h" #include -#include -#include using namespace edm; using namespace std; @@ -46,6 +44,13 @@ EcalDisplaysByEvent::EcalDisplaysByEvent(const edm::ParameterSet& iConfig) EBDigis_(iConfig.getParameter("EBDigiCollection")), EEDigis_(iConfig.getParameter("EEDigiCollection")), headerProducer_(iConfig.getParameter("headerProducer")), + rawDataToken_(consumes(headerProducer_)), + ebRecHitToken_(consumes(EBRecHitCollection_)), + eeRecHitToken_(consumes(EERecHitCollection_)), + ebDigiToken_(consumes(EBDigis_)), + eeDigiToken_(consumes(EEDigis_)), + ecalMappingToken_(esConsumes()), + topologyToken_(esConsumes()), runNum_(-1), side_(iConfig.getUntrackedParameter("side", 3)), threshold_(iConfig.getUntrackedParameter("amplitudeThreshold", 0.5)), @@ -102,17 +107,17 @@ EcalDisplaysByEvent::~EcalDisplaysByEvent() {} // ------------ method called once each job just before starting event loop ------------ void EcalDisplaysByEvent::beginRun(edm::Run const&, edm::EventSetup const& c) { - edm::ESHandle handle; - c.get().get(handle); - ecalElectronicsMap_ = handle.product(); + ecalElectronicsMap_ = &c.getData(ecalMappingToken_); } +void EcalDisplaysByEvent::endRun(edm::Run const&, edm::EventSetup const& c) {} + // ------------ method called to for each event ------------ void EcalDisplaysByEvent::analyze(edm::Event const& iEvent, edm::EventSetup const& iSetup) { // get the headers // (one header for each supermodule) edm::Handle DCCHeaders; - iEvent.getByLabel(headerProducer_, DCCHeaders); + iEvent.getByToken(rawDataToken_, DCCHeaders); for (EcalRawDataCollection::const_iterator headerItr = DCCHeaders->begin(); headerItr != DCCHeaders->end(); ++headerItr) { @@ -138,14 +143,14 @@ void EcalDisplaysByEvent::analyze(edm::Event const& iEvent, edm::EventSetup cons listEEChannels.clear(); //Get hits, digis, caloTopology from event/eventSetup + caloTopo_ = &iSetup.getData(topologyToken_); + Handle EBhits; Handle EEhits; - ESHandle caloTopo; - iSetup.get().get(caloTopo); - iEvent.getByLabel(EBRecHitCollection_, EBhits); - iEvent.getByLabel(EERecHitCollection_, EEhits); - iEvent.getByLabel(EBDigis_, EBdigisHandle); - iEvent.getByLabel(EEDigis_, EEdigisHandle); + iEvent.getByToken(ebRecHitToken_, EBhits); + iEvent.getByToken(eeRecHitToken_, EEhits); + iEvent.getByToken(ebDigiToken_, EBdigisHandle); + iEvent.getByToken(eeDigiToken_, EEdigisHandle); // Initialize histos for this event initEvtByEvtHists(naiveEvtNum_, ievt); @@ -160,9 +165,9 @@ void EcalDisplaysByEvent::analyze(edm::Event const& iEvent, edm::EventSetup cons // Produce the digi graphs if (makeDigiGraphs_) { if (hasEBdigis) //if event has digis, it should have hits - selectHits(EBhits, ievt, caloTopo); + selectHits(EBhits, ievt); if (hasEEdigis) - selectHits(EEhits, ievt, caloTopo); + selectHits(EEhits, ievt); } // Produce the histos @@ -181,7 +186,7 @@ void EcalDisplaysByEvent::analyze(edm::Event const& iEvent, edm::EventSetup cons deleteEvtByEvtHists(); } -void EcalDisplaysByEvent::selectHits(Handle hits, int ievt, ESHandle caloTopo) { +void EcalDisplaysByEvent::selectHits(Handle hits, int ievt) { for (EcalRecHitCollection::const_iterator hitItr = hits->begin(); hitItr != hits->end(); ++hitItr) { EcalRecHit hit = (*hitItr); DetId det = hit.id(); @@ -230,7 +235,7 @@ void EcalDisplaysByEvent::selectHits(Handle hits, int ievt can.Divide(side_, side_); TGraph* myGraph; - CaloNavigator cursor = CaloNavigator(det, caloTopo->getSubdetectorTopology(det)); + CaloNavigator cursor = CaloNavigator(det, caloTopo_->getSubdetectorTopology(det)); //Now put each graph in one by one for (int j = side_ / 2; j >= -side_ / 2; --j) { for (int i = -side_ / 2; i <= side_ / 2; ++i) { diff --git a/CaloOnlineTools/EcalTools/plugins/EcalDisplaysByEvent.h b/CaloOnlineTools/EcalTools/plugins/EcalDisplaysByEvent.h index 6a1d576461622..f74effe3915ad 100644 --- a/CaloOnlineTools/EcalTools/plugins/EcalDisplaysByEvent.h +++ b/CaloOnlineTools/EcalTools/plugins/EcalDisplaysByEvent.h @@ -21,15 +21,15 @@ #include #include #include +#include // user include files #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/ServiceRegistry/interface/Service.h" #include "CommonTools/UtilAlgos/interface/TFileService.h" #include "Geometry/EcalMapping/interface/EcalMappingRcd.h" @@ -59,13 +59,14 @@ // class declaration // -class EcalDisplaysByEvent : public edm::EDAnalyzer { +class EcalDisplaysByEvent : public edm::one::EDAnalyzer { public: explicit EcalDisplaysByEvent(const edm::ParameterSet&); ~EcalDisplaysByEvent() override; private: void beginRun(edm::Run const&, edm::EventSetup const&) override; + void endRun(edm::Run const&, edm::EventSetup const&) override; void analyze(edm::Event const&, edm::EventSetup const&) override; void endJob() override; std::string intToString(int num); @@ -78,7 +79,7 @@ class EcalDisplaysByEvent : public edm::EDAnalyzer { TH2F* init2DEcalHist(std::string histTypeName, int subDet); TH3F* init3DEcalHist(std::string histTypeName, int dubDet); TCanvas* init2DEcalCanvas(std::string canvasName); - void selectHits(edm::Handle hits, int ievt, edm::ESHandle caloTopo); + void selectHits(edm::Handle hits, int ievt); TGraph* selectDigi(DetId det, int ievt); int getEEIndex(EcalElectronicsId elecId); void makeHistos(edm::Handle ebDigis); @@ -93,27 +94,36 @@ class EcalDisplaysByEvent : public edm::EDAnalyzer { // ----------member data --------------------------- - edm::InputTag EBRecHitCollection_; - edm::InputTag EERecHitCollection_; - edm::InputTag EBDigis_; - edm::InputTag EEDigis_; - edm::InputTag headerProducer_; + const edm::InputTag EBRecHitCollection_; + const edm::InputTag EERecHitCollection_; + const edm::InputTag EBDigis_; + const edm::InputTag EEDigis_; + const edm::InputTag headerProducer_; edm::Handle EBdigisHandle; edm::Handle EEdigisHandle; + const edm::EDGetTokenT rawDataToken_; + const edm::EDGetTokenT ebRecHitToken_; + const edm::EDGetTokenT eeRecHitToken_; + const edm::EDGetTokenT ebDigiToken_; + const edm::EDGetTokenT eeDigiToken_; + + const edm::ESGetToken ecalMappingToken_; + const edm::ESGetToken topologyToken_; + int runNum_; - int side_; - double threshold_; - double minTimingAmp_; - bool makeDigiGraphs_; - bool makeTimingHistos_; - bool makeEnergyHistos_; - bool makeOccupancyHistos_; - double histRangeMin_; - double histRangeMax_; - double minTimingEnergyEB_; - double minTimingEnergyEE_; + const int side_; + const double threshold_; + const double minTimingAmp_; + const bool makeDigiGraphs_; + const bool makeTimingHistos_; + const bool makeEnergyHistos_; + const bool makeOccupancyHistos_; + const double histRangeMin_; + const double histRangeMax_; + const double minTimingEnergyEB_; + const double minTimingEnergyEE_; std::set listEBChannels; std::set listEEChannels; @@ -224,6 +234,7 @@ class EcalDisplaysByEvent : public edm::EDAnalyzer { TTree* histoCanvasNames_; EcalFedMap* fedMap_; const EcalElectronicsMapping* ecalElectronicsMap_; + const CaloTopology* caloTopo_; int naiveEvtNum_; }; diff --git a/CaloOnlineTools/EcalTools/plugins/EcalMipGraphs.cc b/CaloOnlineTools/EcalTools/plugins/EcalMipGraphs.cc index 2ea7ddf32a69f..c44c811496e2c 100644 --- a/CaloOnlineTools/EcalTools/plugins/EcalMipGraphs.cc +++ b/CaloOnlineTools/EcalTools/plugins/EcalMipGraphs.cc @@ -20,8 +20,6 @@ #include "RecoCaloTools/Navigation/interface/CaloNavigator.h" #include "TCanvas.h" #include -#include -#include using namespace edm; using namespace std; @@ -45,6 +43,13 @@ EcalMipGraphs::EcalMipGraphs(const edm::ParameterSet& iConfig) EBDigis_(iConfig.getParameter("EBDigiCollection")), EEDigis_(iConfig.getParameter("EEDigiCollection")), headerProducer_(iConfig.getParameter("headerProducer")), + rawDataToken_(consumes(headerProducer_)), + ebRecHitToken_(consumes(EBRecHitCollection_)), + eeRecHitToken_(consumes(EERecHitCollection_)), + ebDigiToken_(consumes(EBDigis_)), + eeDigiToken_(consumes(EEDigis_)), + ecalMappingToken_(esConsumes()), + topologyToken_(esConsumes()), runNum_(-1), side_(iConfig.getUntrackedParameter("side", 3)), threshold_(iConfig.getUntrackedParameter("amplitudeThreshold", 12.0)), @@ -94,7 +99,7 @@ void EcalMipGraphs::analyze(edm::Event const& iEvent, edm::EventSetup const& iSe // get the headers // (one header for each supermodule) edm::Handle DCCHeaders; - iEvent.getByLabel(headerProducer_, DCCHeaders); + iEvent.getByToken(rawDataToken_, DCCHeaders); for (EcalRawDataCollection::const_iterator headerItr = DCCHeaders->begin(); headerItr != DCCHeaders->end(); ++headerItr) { @@ -114,21 +119,18 @@ void EcalMipGraphs::analyze(edm::Event const& iEvent, edm::EventSetup const& iSe //We only want the 3x3's for this event... listEBChannels.clear(); listEEChannels.clear(); + caloTopo_ = &iSetup.getData(topologyToken_); + Handle EBhits; Handle EEhits; - ESHandle caloTopo; - iSetup.get().get(caloTopo); - iEvent.getByLabel(EBRecHitCollection_, EBhits); - iEvent.getByLabel(EERecHitCollection_, EEhits); + iEvent.getByToken(ebRecHitToken_, EBhits); + iEvent.getByToken(eeRecHitToken_, EEhits); // Now, retrieve the crystal digi from the event - iEvent.getByLabel(EBDigis_, EBdigisHandle); - iEvent.getByLabel(EEDigis_, EEdigisHandle); - //debug - //LogWarning("EcalMipGraphs") << "event " << ievt << " EBhits collection size " << EBhits->size(); - //LogWarning("EcalMipGraphs") << "event " << ievt << " EEhits collection size " << EEhits->size(); - - selectHits(EBhits, ievt, caloTopo); - selectHits(EEhits, ievt, caloTopo); + iEvent.getByToken(ebDigiToken_, EBdigisHandle); + iEvent.getByToken(eeDigiToken_, EEdigisHandle); + + selectHits(EBhits, ievt); + selectHits(EEhits, ievt); } TGraph* EcalMipGraphs::selectDigi(DetId thisDet, int ievt) { @@ -232,7 +234,7 @@ TGraph* EcalMipGraphs::selectDigi(DetId thisDet, int ievt) { return oneGraph; } -void EcalMipGraphs::selectHits(Handle hits, int ievt, ESHandle caloTopo) { +void EcalMipGraphs::selectHits(Handle hits, int ievt) { for (EcalRecHitCollection::const_iterator hitItr = hits->begin(); hitItr != hits->end(); ++hitItr) { EcalRecHit hit = (*hitItr); DetId det = hit.id(); @@ -281,7 +283,7 @@ void EcalMipGraphs::selectHits(Handle hits, int ievt, ESHa TGraph* myGraph; int canvasNum = 1; - CaloNavigator cursor = CaloNavigator(det, caloTopo->getSubdetectorTopology(det)); + CaloNavigator cursor = CaloNavigator(det, caloTopo_->getSubdetectorTopology(det)); //Now put each graph in one by one for (int j = side_ / 2; j >= -side_ / 2; --j) { for (int i = -side_ / 2; i <= side_ / 2; ++i) { @@ -328,11 +330,11 @@ void EcalMipGraphs::initHists(int FED) { // ------------ method called once each job just before starting event loop ------------ void EcalMipGraphs::beginRun(edm::Run const&, edm::EventSetup const& c) { - edm::ESHandle handle; - c.get().get(handle); - ecalElectronicsMap_ = handle.product(); + ecalElectronicsMap_ = &c.getData(ecalMappingToken_); } +void EcalMipGraphs::endRun(edm::Run const&, edm::EventSetup const& c) {} + // ------------ method called once each job just after ending the event loop ------------ void EcalMipGraphs::endJob() { canvasNames_->Fill(); diff --git a/CaloOnlineTools/EcalTools/plugins/EcalMipGraphs.h b/CaloOnlineTools/EcalTools/plugins/EcalMipGraphs.h index 52817c0bbc1e5..db0b049a629a5 100644 --- a/CaloOnlineTools/EcalTools/plugins/EcalMipGraphs.h +++ b/CaloOnlineTools/EcalTools/plugins/EcalMipGraphs.h @@ -21,15 +21,15 @@ #include #include #include +#include // user include files #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/ServiceRegistry/interface/Service.h" #include "CommonTools/UtilAlgos/interface/TFileService.h" #include "Geometry/EcalMapping/interface/EcalMappingRcd.h" @@ -56,38 +56,48 @@ // class declaration // -class EcalMipGraphs : public edm::EDAnalyzer { +class EcalMipGraphs : public edm::one::EDAnalyzer { public: explicit EcalMipGraphs(const edm::ParameterSet&); ~EcalMipGraphs() override; private: void beginRun(edm::Run const&, edm::EventSetup const&) override; + void endRun(edm::Run const&, edm::EventSetup const&) override; void analyze(edm::Event const&, edm::EventSetup const&) override; void endJob() override; std::string intToString(int num); std::string floatToString(float num); void writeGraphs(); void initHists(int); - void selectHits(edm::Handle hits, int ievt, edm::ESHandle caloTopo); + void selectHits(edm::Handle hits, int ievt); TGraph* selectDigi(DetId det, int ievt); int getEEIndex(EcalElectronicsId elecId); // ----------member data --------------------------- - edm::InputTag EBRecHitCollection_; - edm::InputTag EERecHitCollection_; - edm::InputTag EBDigis_; - edm::InputTag EEDigis_; - edm::InputTag headerProducer_; + const edm::InputTag EBRecHitCollection_; + const edm::InputTag EERecHitCollection_; + const edm::InputTag EBDigis_; + const edm::InputTag EEDigis_; + const edm::InputTag headerProducer_; edm::Handle EBdigisHandle; edm::Handle EEdigisHandle; + const edm::EDGetTokenT rawDataToken_; + const edm::EDGetTokenT ebRecHitToken_; + const edm::EDGetTokenT eeRecHitToken_; + const edm::EDGetTokenT ebDigiToken_; + const edm::EDGetTokenT eeDigiToken_; + + const edm::ESGetToken ecalMappingToken_; + const edm::ESGetToken topologyToken_; + int runNum_; - int side_; - double threshold_; - double minTimingAmp_; + const int side_; + const double threshold_; + const double minTimingAmp_; std::set listEBChannels; std::set listEEChannels; @@ -114,6 +124,7 @@ class EcalMipGraphs : public edm::EDAnalyzer { TTree* canvasNames_; EcalFedMap* fedMap_; const EcalElectronicsMapping* ecalElectronicsMap_; + const CaloTopology* caloTopo_; int naiveEvtNum_; }; diff --git a/CaloOnlineTools/EcalTools/plugins/EcalPedHists.cc b/CaloOnlineTools/EcalTools/plugins/EcalPedHists.cc index eed22b89f5238..3e4f075287a5b 100644 --- a/CaloOnlineTools/EcalTools/plugins/EcalPedHists.cc +++ b/CaloOnlineTools/EcalTools/plugins/EcalPedHists.cc @@ -15,7 +15,11 @@ EcalPedHists::EcalPedHists(const edm::ParameterSet& ps) fileName_(ps.getUntrackedParameter("fileName", std::string("ecalPedDigiDump"))), barrelDigiCollection_(ps.getParameter("EBdigiCollection")), endcapDigiCollection_(ps.getParameter("EEdigiCollection")), - headerProducer_(ps.getParameter("headerProducer")) { + headerProducer_(ps.getParameter("headerProducer")), + rawDataToken_(consumes(headerProducer_)), + ebDigiToken_(consumes(barrelDigiCollection_)), + eeDigiToken_(consumes(endcapDigiCollection_)), + ecalMappingToken_(esConsumes()) { using namespace std; fedMap_ = new EcalFedMap(); @@ -103,11 +107,11 @@ EcalPedHists::EcalPedHists(const edm::ParameterSet& ps) EcalPedHists::~EcalPedHists() {} void EcalPedHists::beginRun(edm::Run const&, edm::EventSetup const& c) { - edm::ESHandle elecHandle; - c.get().get(elecHandle); - ecalElectronicsMap_ = elecHandle.product(); + ecalElectronicsMap_ = &c.getData(ecalMappingToken_); } +void EcalPedHists::endRun(edm::Run const&, edm::EventSetup const& c) {} + void EcalPedHists::endJob(void) { using namespace std; if (inputIsOk_) { @@ -177,9 +181,8 @@ void EcalPedHists::analyze(const edm::Event& e, const edm::EventSetup& c) { // loop over the headers, this is to detect missing FEDs if all are selected if (allFEDsSelected_) { edm::Handle DCCHeaders; - try { - e.getByLabel(headerProducer_, DCCHeaders); - } catch (std::exception& ex) { + e.getByToken(rawDataToken_, DCCHeaders); + if (!DCCHeaders.isValid()) { edm::LogError("EcalPedHists") << "Error! can't get the product " << headerProducer_; return; } @@ -206,9 +209,8 @@ void EcalPedHists::analyze(const edm::Event& e, const edm::EventSetup& c) { // (one digi for each crystal) // TODO; SIC: fix this behavior Handle barrelDigis; - try { - e.getByLabel(barrelDigiCollection_, barrelDigis); - } catch (std::exception& ex) { + e.getByToken(ebDigiToken_, barrelDigis); + if (!barrelDigis.isValid()) { edm::LogError("EcalPedOffset") << "Error! can't get the product " << barrelDigiCollection_; barrelDigisFound = false; } @@ -216,9 +218,8 @@ void EcalPedHists::analyze(const edm::Event& e, const edm::EventSetup& c) { // (one digi for each crystal) // TODO; SIC: fix this behavior Handle endcapDigis; - try { - e.getByLabel(endcapDigiCollection_, endcapDigis); - } catch (std::exception& ex) { + e.getByToken(eeDigiToken_, endcapDigis); + if (!endcapDigis.isValid()) { edm::LogError("EcalPedOffset") << "Error! can't get the product " << endcapDigiCollection_; endcapDigisFound = false; } diff --git a/CaloOnlineTools/EcalTools/plugins/EcalPedHists.h b/CaloOnlineTools/EcalTools/plugins/EcalPedHists.h index dc1ee2a45f4c0..7b2dac77ec0cf 100644 --- a/CaloOnlineTools/EcalTools/plugins/EcalPedHists.h +++ b/CaloOnlineTools/EcalTools/plugins/EcalPedHists.h @@ -1,3 +1,5 @@ +#ifndef CaloOnlineTools_EcalTools_EcalPedHists_h +#define CaloOnlineTools_EcalTools_EcalPedHists_h /** * Module which outputs a root file of ADC counts (all three gains) * of user-selected channels (defaults to channel 1) for @@ -8,11 +10,10 @@ * */ -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/Framework/interface/MakerMacros.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "DataFormats/EcalDigi/interface/EcalDigiCollections.h" #include "DataFormats/EcalDetId/interface/EcalDetIdCollections.h" #include "DataFormats/EcalDigi/interface/EcalTriggerPrimitiveDigi.h" @@ -31,7 +32,7 @@ typedef std::map stringHistMap; -class EcalPedHists : public edm::EDAnalyzer { +class EcalPedHists : public edm::one::EDAnalyzer { public: EcalPedHists(const edm::ParameterSet& ps); ~EcalPedHists() override; @@ -39,6 +40,7 @@ class EcalPedHists : public edm::EDAnalyzer { protected: void analyze(const edm::Event& e, const edm::EventSetup& c) override; void beginRun(edm::Run const&, edm::EventSetup const& c) override; + void endRun(edm::Run const&, edm::EventSetup const& c) override; void endJob(void) override; private: @@ -52,9 +54,9 @@ class EcalPedHists : public edm::EDAnalyzer { bool allFEDsSelected_; bool histsFilled_; std::string fileName_; - edm::InputTag barrelDigiCollection_; - edm::InputTag endcapDigiCollection_; - edm::InputTag headerProducer_; + const edm::InputTag barrelDigiCollection_; + const edm::InputTag endcapDigiCollection_; + const edm::InputTag headerProducer_; std::vector listChannels_; std::vector listSamples_; std::vector listFEDs_; @@ -63,5 +65,13 @@ class EcalPedHists : public edm::EDAnalyzer { std::set theRealFedSet_; EcalFedMap* fedMap_; TFile* root_file_; + + const edm::EDGetTokenT rawDataToken_; + const edm::EDGetTokenT ebDigiToken_; + const edm::EDGetTokenT eeDigiToken_; + const edm::ESGetToken ecalMappingToken_; + const EcalElectronicsMapping* ecalElectronicsMap_; }; + +#endif diff --git a/CaloOnlineTools/EcalTools/plugins/EcalTPGAnalyzer.cc b/CaloOnlineTools/EcalTools/plugins/EcalTPGAnalyzer.cc index 680c25371e7b5..cd8082f0cbee7 100644 --- a/CaloOnlineTools/EcalTools/plugins/EcalTPGAnalyzer.cc +++ b/CaloOnlineTools/EcalTools/plugins/EcalTPGAnalyzer.cc @@ -12,32 +12,9 @@ #include // user include files -#include "FWCore/Framework/interface/EDAnalyzer.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/MakerMacros.h" - #include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/Framework/interface/ESHandle.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" - -#include "DataFormats/EcalDigi/interface/EcalDigiCollections.h" -#include "DataFormats/EcalDigi/interface/EcalTriggerPrimitiveDigi.h" -#include "Geometry/CaloTopology/interface/EcalTrigTowerConstituentsMap.h" -#include "Geometry/CaloGeometry/interface/CaloGeometry.h" -#include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h" #include "Geometry/CaloGeometry/interface/CaloCellGeometry.h" -#include "Geometry/Records/interface/CaloGeometryRecord.h" - -#include "CondFormats/L1TObjects/interface/L1GtTriggerMenu.h" -#include "CondFormats/DataRecord/interface/L1GtTriggerMenuRcd.h" -#include "CondFormats/L1TObjects/interface/L1GtTriggerMask.h" -#include "CondFormats/DataRecord/interface/L1GtTriggerMaskAlgoTrigRcd.h" -#include "CondFormats/DataRecord/interface/L1GtTriggerMaskTechTrigRcd.h" -#include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutSetupFwd.h" -#include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutSetup.h" -#include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutRecord.h" -#include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerRecord.h" #include "EcalTPGAnalyzer.h" @@ -47,17 +24,24 @@ using namespace edm; class CaloSubdetectorGeometry; -EcalTPGAnalyzer::EcalTPGAnalyzer(const edm::ParameterSet& iConfig) { - tpCollection_ = iConfig.getParameter("TPCollection"); - tpEmulatorCollection_ = iConfig.getParameter("TPEmulatorCollection"); - digiCollectionEB_ = iConfig.getParameter("DigiCollectionEB"); - digiCollectionEE_ = iConfig.getParameter("DigiCollectionEE"); - gtRecordCollectionTag_ = iConfig.getParameter("GTRecordCollection"); - - allowTP_ = iConfig.getParameter("ReadTriggerPrimitives"); - useEE_ = iConfig.getParameter("UseEndCap"); - print_ = iConfig.getParameter("Print"); - +EcalTPGAnalyzer::EcalTPGAnalyzer(const edm::ParameterSet& iConfig) + : tpCollection_(iConfig.getParameter("TPCollection")), + tpEmulatorCollection_(iConfig.getParameter("TPEmulatorCollection")), + digiCollectionEB_(iConfig.getParameter("DigiCollectionEB")), + digiCollectionEE_(iConfig.getParameter("DigiCollectionEE")), + gtRecordCollectionTag_(iConfig.getParameter("GTRecordCollection")), + l1GtReadoutRecordToken_(consumes(edm::InputTag(gtRecordCollectionTag_))), + tpToken_(consumes(tpCollection_)), + tpEmulToken_(consumes(tpEmulatorCollection_)), + ebDigiToken_(consumes(digiCollectionEB_)), + eeDigiToken_(consumes(digiCollectionEE_)), + eTTMapToken_(esConsumes()), + ebGeometryToken_(esConsumes(edm::ESInputTag("", "EcalBarrel"))), + eeGeometryToken_(esConsumes(edm::ESInputTag("", "EcalEndcap"))), + l1GtMaskToken_(esConsumes()), + allowTP_(iConfig.getParameter("ReadTriggerPrimitives")), + useEE_(iConfig.getParameter("UseEndCap")), + print_(iConfig.getParameter("Print")) { // file file_ = new TFile("ECALTPGtree.root", "RECREATE"); file_->cd(); @@ -93,18 +77,13 @@ EcalTPGAnalyzer::~EcalTPGAnalyzer() { void EcalTPGAnalyzer::beginRun(edm::Run const&, edm::EventSetup const& evtSetup) { // geometry - ESHandle theGeometry; - ESHandle theEndcapGeometry_handle, theBarrelGeometry_handle; - - evtSetup.get().get(theGeometry); - evtSetup.get().get("EcalEndcap", theEndcapGeometry_handle); - evtSetup.get().get("EcalBarrel", theBarrelGeometry_handle); - - evtSetup.get().get(eTTmap_); - theEndcapGeometry_ = &(*theEndcapGeometry_handle); - theBarrelGeometry_ = &(*theBarrelGeometry_handle); + eTTmap_ = &evtSetup.getData(eTTMapToken_); + theBarrelGeometry_ = &evtSetup.getData(ebGeometryToken_); + theEndcapGeometry_ = &evtSetup.getData(eeGeometryToken_); } +void EcalTPGAnalyzer::endRun(edm::Run const&, edm::EventSetup const& evtSetup) {} + void EcalTPGAnalyzer::analyze(edm::Event const& iEvent, edm::EventSetup const& iSetup) { using namespace edm; using namespace std; @@ -129,12 +108,11 @@ void EcalTPGAnalyzer::analyze(edm::Event const& iEvent, edm::EventSetup const& i /////////////////////////// edm::Handle gtRecord; - iEvent.getByLabel(edm::InputTag(gtRecordCollectionTag_), gtRecord); + iEvent.getByToken(l1GtReadoutRecordToken_, gtRecord); DecisionWord dWord = gtRecord->decisionWord(); // this will get the decision word *before* masking disabled bits - edm::ESHandle l1GtTmAlgo; - iSetup.get().get(l1GtTmAlgo); - std::vector triggerMaskAlgoTrig = l1GtTmAlgo.product()->gtTriggerMask(); + const auto& l1GtTmAlgo = iSetup.getData(l1GtMaskToken_); + std::vector triggerMaskAlgoTrig = l1GtTmAlgo.gtTriggerMask(); // apply masks on algo int iDaq = 0; @@ -156,7 +134,7 @@ void EcalTPGAnalyzer::analyze(edm::Event const& iEvent, edm::EventSetup const& i /////////////////////////// edm::Handle tp; - iEvent.getByLabel(tpCollection_, tp); + iEvent.getByToken(tpToken_, tp); if (print_) std::cout << "TP collection size=" << tp.product()->size() << std::endl; @@ -175,7 +153,7 @@ void EcalTPGAnalyzer::analyze(edm::Event const& iEvent, edm::EventSetup const& i /////////////////////////// edm::Handle tpEmul; - iEvent.getByLabel(tpEmulatorCollection_, tpEmul); + iEvent.getByToken(tpEmulToken_, tpEmul); if (print_) std::cout << "TPEmulator collection size=" << tpEmul.product()->size() << std::endl; @@ -194,7 +172,7 @@ void EcalTPGAnalyzer::analyze(edm::Event const& iEvent, edm::EventSetup const& i // Get EB xtal digi inputs edm::Handle digiEB; - iEvent.getByLabel(digiCollectionEB_, digiEB); + iEvent.getByToken(ebDigiToken_, digiEB); for (unsigned int i = 0; i < digiEB.product()->size(); i++) { const EBDataFrame& df = (*(digiEB.product()))[i]; @@ -208,11 +186,11 @@ void EcalTPGAnalyzer::analyze(edm::Event const& iEvent, edm::EventSetup const& i if (useEE_) { // Get EE xtal digi inputs edm::Handle digiEE; - iEvent.getByLabel(digiCollectionEE_, digiEE); + iEvent.getByToken(eeDigiToken_, digiEE); for (unsigned int i = 0; i < digiEE.product()->size(); i++) { const EEDataFrame& df = (*(digiEE.product()))[i]; const EEDetId& id = df.id(); - const EcalTrigTowerDetId towid = (*eTTmap_).towerOf(id); + const EcalTrigTowerDetId towid = eTTmap_->towerOf(id); itTT = mapTower.find(towid); if (itTT != mapTower.end()) (itTT->second).nbXtal_++; diff --git a/CaloOnlineTools/EcalTools/plugins/EcalTPGAnalyzer.h b/CaloOnlineTools/EcalTools/plugins/EcalTPGAnalyzer.h index 1944085121448..642046b318a9f 100644 --- a/CaloOnlineTools/EcalTools/plugins/EcalTPGAnalyzer.h +++ b/CaloOnlineTools/EcalTools/plugins/EcalTPGAnalyzer.h @@ -1,3 +1,5 @@ +#ifndef CaloOnlineTools_EcalTools_EcalTPGAnalyzer_h +#define CaloOnlineTools_EcalTools_EcalTPGAnalyzer_h // -*- C++ -*- // // Class: EcalTPGAnalyzer @@ -5,13 +7,18 @@ // // Original Author: Pascal Paganini // -#include "FWCore/Framework/interface/ESHandle.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "CondFormats/L1TObjects/interface/L1GtTriggerMask.h" +#include "CondFormats/DataRecord/interface/L1GtTriggerMaskAlgoTrigRcd.h" +#include "DataFormats/EcalDigi/interface/EcalDigiCollections.h" +#include "DataFormats/EcalDigi/interface/EcalTriggerPrimitiveDigi.h" +#include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutRecord.h" #include "Geometry/CaloTopology/interface/EcalTrigTowerConstituentsMap.h" #include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h" +#include "Geometry/Records/interface/CaloGeometryRecord.h" #include #include #include @@ -32,12 +39,13 @@ class towerEner { } }; -class EcalTPGAnalyzer : public edm::EDAnalyzer { +class EcalTPGAnalyzer : public edm::one::EDAnalyzer { public: explicit EcalTPGAnalyzer(const edm::ParameterSet &); ~EcalTPGAnalyzer() override; void analyze(edm::Event const &, edm::EventSetup const &) override; void beginRun(edm::Run const &, edm::EventSetup const &) override; + void endRun(edm::Run const &, edm::EventSetup const &) override; private: struct EcalTPGVariables { @@ -68,17 +76,30 @@ class EcalTPGAnalyzer : public edm::EDAnalyzer { TTree *tree_; EcalTPGVariables treeVariables_; - edm::InputTag tpCollection_; - edm::InputTag tpEmulatorCollection_; - edm::InputTag digiCollectionEB_; - edm::InputTag digiCollectionEE_; - std::string gtRecordCollectionTag_; + const edm::InputTag tpCollection_; + const edm::InputTag tpEmulatorCollection_; + const edm::InputTag digiCollectionEB_; + const edm::InputTag digiCollectionEE_; + const std::string gtRecordCollectionTag_; - bool allowTP_; - bool useEE_; - bool print_; + const edm::EDGetTokenT l1GtReadoutRecordToken_; + const edm::EDGetTokenT tpToken_; + const edm::EDGetTokenT tpEmulToken_; + const edm::EDGetTokenT ebDigiToken_; + const edm::EDGetTokenT eeDigiToken_; + + const edm::ESGetToken eTTMapToken_; + const edm::ESGetToken ebGeometryToken_; + const edm::ESGetToken eeGeometryToken_; + const edm::ESGetToken l1GtMaskToken_; + + const bool allowTP_; + const bool useEE_; + const bool print_; - const CaloSubdetectorGeometry *theEndcapGeometry_; const CaloSubdetectorGeometry *theBarrelGeometry_; - edm::ESHandle eTTmap_; + const CaloSubdetectorGeometry *theEndcapGeometry_; + const EcalTrigTowerConstituentsMap *eTTmap_; }; + +#endif diff --git a/CaloOnlineTools/EcalTools/plugins/EcalURecHitHists.cc b/CaloOnlineTools/EcalTools/plugins/EcalURecHitHists.cc index 77c847ec7eb72..333d6b260cfd3 100644 --- a/CaloOnlineTools/EcalTools/plugins/EcalURecHitHists.cc +++ b/CaloOnlineTools/EcalTools/plugins/EcalURecHitHists.cc @@ -34,8 +34,11 @@ using namespace std; // constructors and destructor // EcalURecHitHists::EcalURecHitHists(const edm::ParameterSet& iConfig) - : EBUncalibratedRecHitCollection_(iConfig.getParameter("EBUncalibratedRecHitCollection")), - EEUncalibratedRecHitCollection_(iConfig.getParameter("EEUncalibratedRecHitCollection")), + : ebUncalibratedRecHitCollection_(iConfig.getParameter("EBUncalibratedRecHitCollection")), + eeUncalibratedRecHitCollection_(iConfig.getParameter("EEUncalibratedRecHitCollection")), + ebUncalibRecHitsToken_(consumes(ebUncalibratedRecHitCollection_)), + eeUncalibRecHitsToken_(consumes(eeUncalibratedRecHitCollection_)), + ecalMappingToken_(esConsumes()), runNum_(-1), histRangeMax_(iConfig.getUntrackedParameter("histogramMaxRange", 200.0)), histRangeMin_(iConfig.getUntrackedParameter("histogramMinRange", -10.0)), @@ -83,10 +86,10 @@ void EcalURecHitHists::analyze(edm::Event const& iEvent, edm::EventSetup const& Handle EBhits; Handle EEhits; - iEvent.getByLabel(EBUncalibratedRecHitCollection_, EBhits); + iEvent.getByToken(ebUncalibRecHitsToken_, EBhits); LogDebug("EcalURecHitHists") << "event " << ievt << " hits collection size " << EBhits->size(); - iEvent.getByLabel(EEUncalibratedRecHitCollection_, EEhits); + iEvent.getByToken(eeUncalibRecHitsToken_, EEhits); LogDebug("EcalURecHitHists") << "event " << ievt << " hits collection size " << EEhits->size(); for (EcalUncalibratedRecHitCollection::const_iterator hitItr = EBhits->begin(); hitItr != EBhits->end(); ++hitItr) { @@ -194,11 +197,11 @@ void EcalURecHitHists::initHists(int FED) { // ------------ method called once each job just before starting event loop ------------ void EcalURecHitHists::beginRun(edm::Run const&, edm::EventSetup const& c) { - edm::ESHandle elecHandle; - c.get().get(elecHandle); - ecalElectronicsMap_ = elecHandle.product(); + ecalElectronicsMap_ = &c.getData(ecalMappingToken_); } +void EcalURecHitHists::endRun(edm::Run const&, edm::EventSetup const& c) {} + // ------------ method called once each job just after ending the event loop ------------ void EcalURecHitHists::endJob() { using namespace std; diff --git a/CaloOnlineTools/EcalTools/plugins/EcalURecHitHists.h b/CaloOnlineTools/EcalTools/plugins/EcalURecHitHists.h index 48707e4c99df9..db3286f9b5bd5 100644 --- a/CaloOnlineTools/EcalTools/plugins/EcalURecHitHists.h +++ b/CaloOnlineTools/EcalTools/plugins/EcalURecHitHists.h @@ -1,3 +1,5 @@ +#ifndef CaloOnlineTools_EcalTools_EcalURecHitHists_h +#define CaloOnlineTools_EcalTools_EcalURecHitHists_h // -*- C++ -*- // // Package: EcalURecHitHists @@ -24,20 +26,19 @@ // user include files #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/EventSetup.h" -#include "DataFormats/EcalDigi/interface/EcalDigiCollections.h" #include "DataFormats/EcalRecHit/interface/EcalUncalibratedRecHit.h" #include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" #include "DataFormats/DetId/interface/DetId.h" #include "DataFormats/EcalRawData/interface/EcalRawDataCollections.h" #include "Geometry/EcalMapping/interface/EcalElectronicsMapping.h" +#include "Geometry/EcalMapping/interface/EcalMappingRcd.h" #include "CaloOnlineTools/EcalTools/interface/EcalFedMap.h" @@ -45,19 +46,19 @@ #include "TH1F.h" #include "TGraph.h" #include "TNtuple.h" -#include "Geometry/EcalMapping/interface/EcalMappingRcd.h" // // class declaration // -class EcalURecHitHists : public edm::EDAnalyzer { +class EcalURecHitHists : public edm::one::EDAnalyzer { public: explicit EcalURecHitHists(const edm::ParameterSet&); ~EcalURecHitHists() override; private: void beginRun(edm::Run const&, edm::EventSetup const&) override; + void endRun(edm::Run const&, edm::EventSetup const&) override; void analyze(edm::Event const&, edm::EventSetup const&) override; void endJob() override; std::string intToString(int num); @@ -65,10 +66,15 @@ class EcalURecHitHists : public edm::EDAnalyzer { // ----------member data --------------------------- - edm::InputTag EBUncalibratedRecHitCollection_; - edm::InputTag EEUncalibratedRecHitCollection_; + const edm::InputTag ebUncalibratedRecHitCollection_; + const edm::InputTag eeUncalibratedRecHitCollection_; + + const edm::EDGetTokenT ebUncalibRecHitsToken_; + const edm::EDGetTokenT eeUncalibRecHitsToken_; + const edm::ESGetToken ecalMappingToken_; + int runNum_; - double histRangeMax_, histRangeMin_; + const double histRangeMax_, histRangeMin_; std::string fileName_; std::vector maskedChannels_; @@ -84,3 +90,5 @@ class EcalURecHitHists : public edm::EDAnalyzer { EcalFedMap* fedMap_; const EcalElectronicsMapping* ecalElectronicsMap_; }; + +#endif diff --git a/CaloOnlineTools/HcalOnlineDb/interface/HcalLutGenerator.h b/CaloOnlineTools/HcalOnlineDb/interface/HcalLutGenerator.h index 7c80b402c7154..1f1f32ef95bea 100644 --- a/CaloOnlineTools/HcalOnlineDb/interface/HcalLutGenerator.h +++ b/CaloOnlineTools/HcalOnlineDb/interface/HcalLutGenerator.h @@ -1,7 +1,7 @@ #ifndef HcalLutGenerator_h #define HcalLutGenerator_h -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" @@ -10,14 +10,16 @@ #include "CalibFormats/HcalObjects/interface/HcalDbService.h" #include "CalibFormats/HcalObjects/interface/HcalDbRecord.h" #include "CondFormats/HcalObjects/interface/HcalChannelQuality.h" +#include "CalibFormats/CaloTPG/interface/CaloTPGTranscoder.h" +#include "CalibFormats/CaloTPG/interface/CaloTPGRecord.h" #include "CondFormats/DataRecord/interface/HcalChannelQualityRcd.h" -class HcalLutGenerator : public edm::EDAnalyzer { +class HcalLutGenerator : public edm::one::EDAnalyzer<> { public: explicit HcalLutGenerator(const edm::ParameterSet&); - ~HcalLutGenerator() override; + ~HcalLutGenerator() override {} void analyze(const edm::Event&, const edm::EventSetup&) override; - void endJob() override; + void endJob() override {} private: std::string _tag; @@ -26,6 +28,7 @@ class HcalLutGenerator : public edm::EDAnalyzer { edm::ESGetToken tok_inCoder_; edm::ESGetToken tok_dbservice_; edm::ESGetToken tok_hcalChStatus_; + edm::ESGetToken tok_hcalCoder_; }; #endif diff --git a/CaloOnlineTools/HcalOnlineDb/src/HcalLutGenerator.cc b/CaloOnlineTools/HcalOnlineDb/src/HcalLutGenerator.cc index 146cd6f00966a..9f7055dd8a502 100644 --- a/CaloOnlineTools/HcalOnlineDb/src/HcalLutGenerator.cc +++ b/CaloOnlineTools/HcalOnlineDb/src/HcalLutGenerator.cc @@ -4,14 +4,10 @@ #include "DataFormats/HcalDetId/interface/HcalDetId.h" #include "CondFormats/HcalObjects/interface/HcalElectronicsMap.h" #include "CaloOnlineTools/HcalOnlineDb/interface/HcalLutManager.h" -#include "CalibFormats/CaloTPG/interface/CaloTPGRecord.h" #include "CaloOnlineTools/HcalOnlineDb/interface/LMap.h" #include -using std::cerr; -using std::cout; -using std::endl; HcalLutGenerator::HcalLutGenerator(const edm::ParameterSet& iConfig) { _tag = iConfig.getParameter("tag"); @@ -20,18 +16,15 @@ HcalLutGenerator::HcalLutGenerator(const edm::ParameterSet& iConfig) { tok_inCoder_ = esConsumes(); tok_dbservice_ = esConsumes(); tok_hcalChStatus_ = esConsumes(edm::ESInputTag("", "withTopo")); + tok_hcalCoder_ = esConsumes(); } -HcalLutGenerator::~HcalLutGenerator() {} - void HcalLutGenerator::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { const HcalTPGCoder* inputCoder = &iSetup.getData(tok_inCoder_); const HcalDbService* hcalcond = &iSetup.getData(tok_dbservice_); const HcalChannelQuality* _cq = &iSetup.getData(tok_hcalChStatus_); - edm::ESHandle outTranscoder; - iSetup.get().get(outTranscoder); - + edm::ESHandle outTranscoder = iSetup.getHandle(tok_hcalCoder_); edm::ESHandle transcoder; transcoder.swap(outTranscoder); @@ -40,5 +33,3 @@ void HcalLutGenerator::analyze(const edm::Event& iEvent, const edm::EventSetup& manager.createLutXmlFiles_HBEFFromCoder_HOFromAscii_ZDC(_tag, *inputCoder, *transcoder, _lin_file, split_by_crate); } - -void HcalLutGenerator::endJob() {} diff --git a/CommonTools/CandAlgos/interface/CandMatcher.h b/CommonTools/CandAlgos/interface/CandMatcher.h index 9b1186c3ce691..26e5ca56a9e12 100644 --- a/CommonTools/CandAlgos/interface/CandMatcher.h +++ b/CommonTools/CandAlgos/interface/CandMatcher.h @@ -9,17 +9,8 @@ #include "DataFormats/Candidate/interface/Candidate.h" #include "CommonTools/CandUtils/interface/CandMapTrait.h" -namespace reco { - namespace modules { - template > - class CandMatcher - : public Matcher::type> { - public: - CandMatcher(const edm::ParameterSet& cfg) - : Matcher::type>(cfg) {} - ~CandMatcher() override {} - }; - - } // namespace modules -} // namespace reco +namespace reco::modules { + template > + using CandMatcher = Matcher::type>; +} // namespace reco::modules #endif diff --git a/CommonTools/CandAlgos/interface/NewCandMatcher.h b/CommonTools/CandAlgos/interface/NewCandMatcher.h index c087de01c1add..d709d1458dc28 100644 --- a/CommonTools/CandAlgos/interface/NewCandMatcher.h +++ b/CommonTools/CandAlgos/interface/NewCandMatcher.h @@ -8,15 +8,8 @@ #include "CommonTools/UtilAlgos/interface/NewMatcher.h" #include "DataFormats/Candidate/interface/Candidate.h" -namespace reco { - namespace modulesNew { - template > - class CandMatcher : public Matcher { - public: - CandMatcher(const edm::ParameterSet& cfg) : Matcher(cfg) {} - ~CandMatcher() override {} - }; - - } // namespace modulesNew -} // namespace reco +namespace reco::modulesNew { + template > + using CandMatcher = Matcher; +} // namespace reco::modulesNew #endif diff --git a/CommonTools/CandAlgos/interface/SingleObjectShallowCloneSelector.h b/CommonTools/CandAlgos/interface/SingleObjectShallowCloneSelector.h index f773b9482d279..797f73f5edc1f 100644 --- a/CommonTools/CandAlgos/interface/SingleObjectShallowCloneSelector.h +++ b/CommonTools/CandAlgos/interface/SingleObjectShallowCloneSelector.h @@ -13,8 +13,9 @@ template ::type, typename PostProcessor = helper::NullPostProcessor, - typename StoreManager = typename helper::StoreManagerTrait::type, - typename Base = typename helper::StoreManagerTrait::base, + typename StoreManager = + typename helper::StoreManagerTrait>::type, + typename Base = typename helper::StoreManagerTrait>::base, typename RefAdder = typename helper::SelectionAdderTrait::type> class SingleObjectShallowCloneSelector : public ObjectShallowCloneSelector< diff --git a/CommonTools/CandAlgos/plugins/AssociatedVariableMaxCutCandSelectorNew.cc b/CommonTools/CandAlgos/plugins/AssociatedVariableMaxCutCandSelectorNew.cc index 6dbfe214eddef..c6ec44253389f 100644 --- a/CommonTools/CandAlgos/plugins/AssociatedVariableMaxCutCandSelectorNew.cc +++ b/CommonTools/CandAlgos/plugins/AssociatedVariableMaxCutCandSelectorNew.cc @@ -16,7 +16,7 @@ * */ #include "FWCore/Framework/interface/MakerMacros.h" -#include "CommonTools/UtilAlgos/interface/SingleObjectSelector.h" +#include "CommonTools/UtilAlgos/interface/ObjectSelector.h" #include "CommonTools/UtilAlgos/interface/AssociatedVariableCollectionSelector.h" #include "CommonTools/UtilAlgos/interface/AndSelector.h" #include "CommonTools/UtilAlgos/interface/RefSelector.h" diff --git a/CommonTools/ConditionDBWriter/interface/ConditionDBWriter.h b/CommonTools/ConditionDBWriter/interface/ConditionDBWriter.h index 01900addce52d..9cc647a235bc7 100644 --- a/CommonTools/ConditionDBWriter/interface/ConditionDBWriter.h +++ b/CommonTools/ConditionDBWriter/interface/ConditionDBWriter.h @@ -130,7 +130,7 @@ // user include files #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "FWCore/Framework/interface/Run.h" #include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/ServiceRegistry/interface/Service.h" @@ -146,7 +146,7 @@ #include "DataFormats/Common/interface/Handle.h" template -class ConditionDBWriter : public edm::EDAnalyzer { +class ConditionDBWriter : public edm::one::EDAnalyzer { public: explicit ConditionDBWriter(const edm::ParameterSet &iConfig) : minRunRange_(1 << 31), @@ -332,8 +332,7 @@ class ConditionDBWriter : public edm::EDAnalyzer { edm::LogInfo("ConditionDBWriter") << "appending a new object to tag " << Record_ << " in since mode " << std::endl; - // The Framework will take control over the DB object now, therefore the release. - mydbservice->writeOne(objPointer.release(), since, Record_); + mydbservice->writeOneIOV(*objPointer, since, Record_); } void setTime() { diff --git a/CommonTools/MVAUtils/src/GBRForestTools.cc b/CommonTools/MVAUtils/src/GBRForestTools.cc index 71e39cd60f23e..f61390d41996c 100644 --- a/CommonTools/MVAUtils/src/GBRForestTools.cc +++ b/CommonTools/MVAUtils/src/GBRForestTools.cc @@ -80,9 +80,9 @@ namespace { } else { int thisidx = tree.CutIndices().size(); - int selector; - float cutval; - bool ctype; + int selector = 0; + float cutval = 0.; + bool ctype = false; node->QueryIntAttribute("IVar", &selector); node->QueryFloatAttribute("Cut", &cutval); @@ -158,8 +158,12 @@ namespace { e = e->NextSiblingElement("Info")) { const char* name; const char* value; - e->QueryStringAttribute("name", &name); - e->QueryStringAttribute("value", &value); + if (tinyxml2::XML_SUCCESS != e->QueryStringAttribute("name", &name)) { + throw cms::Exception("XMLERROR") << "no 'name' attribute found in 'Info' element in " << weightsFileFullPath; + } + if (tinyxml2::XML_SUCCESS != e->QueryStringAttribute("value", &value)) { + throw cms::Exception("XMLERROR") << "no 'value' attribute found in 'Info' element in " << weightsFileFullPath; + } info[name] = value; } @@ -172,7 +176,9 @@ namespace { for (tinyxml2::XMLElement* e = optionsElem->FirstChildElement("Option"); e != nullptr; e = e->NextSiblingElement("Option")) { const char* name; - e->QueryStringAttribute("name", &name); + if (tinyxml2::XML_SUCCESS != e->QueryStringAttribute("name", &name)) { + throw cms::Exception("XMLERROR") << "no 'name' attribute found in 'Option' element in " << weightsFileFullPath; + } options[name] = e->GetText(); } @@ -194,7 +200,10 @@ namespace { e = e->NextSiblingElement("BinaryTree")) { hasTrees = true; double w; - e->QueryDoubleAttribute("boostWeight", &w); + if (tinyxml2::XML_SUCCESS != e->QueryDoubleAttribute("boostWeight", &w)) { + throw cms::Exception("XMLERROR") << "problem with 'boostWeight' attribute found in 'BinaryTree' element in " + << weightsFileFullPath; + } boostWeights.push_back(w); } if (!hasTrees) { diff --git a/CommonTools/ParticleFlow/plugins/DeltaBetaWeights.cc b/CommonTools/ParticleFlow/plugins/DeltaBetaWeights.cc index b6f8165d64213..f95b194d050c1 100644 --- a/CommonTools/ParticleFlow/plugins/DeltaBetaWeights.cc +++ b/CommonTools/ParticleFlow/plugins/DeltaBetaWeights.cc @@ -1,5 +1,37 @@ -#include "CommonTools/ParticleFlow/plugins/DeltaBetaWeights.h" +// Weight for neutral particles based on distance with charged +// +// Original Author: Michail Bachtis,40 1-B08,+41227678176, +// Created: Mon Dec 9 13:18:05 CET 2013 +// +// edited by Pavel Jez +// + +#include "DataFormats/Math/interface/deltaR.h" +#include "DataFormats/ParticleFlowCandidate/interface/PFCandidate.h" +#include "DataFormats/ParticleFlowCandidate/interface/PFCandidateFwd.h" +#include "FWCore/Framework/interface/EDProducer.h" +#include "FWCore/Framework/interface/Event.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" + +#include + +class DeltaBetaWeights : public edm::EDProducer { +public: + explicit DeltaBetaWeights(const edm::ParameterSet&); + ~DeltaBetaWeights() override; + +private: + void produce(edm::Event&, const edm::EventSetup&) override; + // ----------member data --------------------------- + edm::InputTag src_; + edm::InputTag pfCharged_; + edm::InputTag pfPU_; + + edm::EDGetTokenT > pfCharged_token; + edm::EDGetTokenT > pfPU_token; + edm::EDGetTokenT > src_token; +}; DeltaBetaWeights::DeltaBetaWeights(const edm::ParameterSet& iConfig) : src_(iConfig.getParameter("src")), @@ -21,9 +53,8 @@ DeltaBetaWeights::~DeltaBetaWeights() { // (e.g. close files, deallocate resources etc.) } -// -// member functions -// +#include "FWCore/Framework/interface/MakerMacros.h" +DEFINE_FWK_MODULE(DeltaBetaWeights); // ------------ method called to produce the data ------------ void DeltaBetaWeights::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { diff --git a/CommonTools/ParticleFlow/plugins/DeltaBetaWeights.h b/CommonTools/ParticleFlow/plugins/DeltaBetaWeights.h deleted file mode 100644 index 0c92f4b9cfe9d..0000000000000 --- a/CommonTools/ParticleFlow/plugins/DeltaBetaWeights.h +++ /dev/null @@ -1,41 +0,0 @@ - -// Weight for neutral particles based on distance with charged -// -// Original Author: Michail Bachtis,40 1-B08,+41227678176, -// Created: Mon Dec 9 13:18:05 CET 2013 -// -// edited by Pavel Jez -// - -// system include files -#include - -// user include files -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDProducer.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "DataFormats/Math/interface/deltaR.h" -#include "DataFormats/ParticleFlowCandidate/interface/PFCandidate.h" -#include "DataFormats/ParticleFlowCandidate/interface/PFCandidateFwd.h" - -// -// class declaration -// - -class DeltaBetaWeights : public edm::EDProducer { -public: - explicit DeltaBetaWeights(const edm::ParameterSet&); - ~DeltaBetaWeights() override; - -private: - void produce(edm::Event&, const edm::EventSetup&) override; - // ----------member data --------------------------- - edm::InputTag src_; - edm::InputTag pfCharged_; - edm::InputTag pfPU_; - - edm::EDGetTokenT > pfCharged_token; - edm::EDGetTokenT > pfPU_token; - edm::EDGetTokenT > src_token; -}; diff --git a/CommonTools/ParticleFlow/plugins/GenericPFCandidateSelector.cc b/CommonTools/ParticleFlow/plugins/GenericPFCandidateSelector.cc index e8e023156f049..f1b788bef7003 100644 --- a/CommonTools/ParticleFlow/plugins/GenericPFCandidateSelector.cc +++ b/CommonTools/ParticleFlow/plugins/GenericPFCandidateSelector.cc @@ -4,9 +4,9 @@ #include "DataFormats/ParticleFlowCandidate/interface/PFCandidate.h" #include "DataFormats/ParticleFlowCandidate/interface/PFCandidateFwd.h" -#include "CommonTools/UtilAlgos/interface/ObjectSelectorStream.h" +#include "CommonTools/UtilAlgos/interface/ObjectSelector.h" #include "CommonTools/ParticleFlow/interface/GenericPFCandidateSelectorDefinition.h" -typedef ObjectSelectorStream GenericPFCandidateSelector; +typedef ObjectSelector GenericPFCandidateSelector; DEFINE_FWK_MODULE(GenericPFCandidateSelector); diff --git a/CommonTools/ParticleFlow/plugins/IPCutPFCandidateSelector.cc b/CommonTools/ParticleFlow/plugins/IPCutPFCandidateSelector.cc index e7a6fce81abfc..5993cc66cc5de 100644 --- a/CommonTools/ParticleFlow/plugins/IPCutPFCandidateSelector.cc +++ b/CommonTools/ParticleFlow/plugins/IPCutPFCandidateSelector.cc @@ -4,9 +4,9 @@ #include "DataFormats/ParticleFlowCandidate/interface/PFCandidate.h" #include "DataFormats/ParticleFlowCandidate/interface/PFCandidateFwd.h" -#include "CommonTools/UtilAlgos/interface/ObjectSelectorStream.h" +#include "CommonTools/UtilAlgos/interface/ObjectSelector.h" #include "CommonTools/ParticleFlow/interface/IPCutPFCandidateSelectorDefinition.h" -typedef ObjectSelectorStream IPCutPFCandidateSelector; +typedef ObjectSelector IPCutPFCandidateSelector; DEFINE_FWK_MODULE(IPCutPFCandidateSelector); diff --git a/CommonTools/ParticleFlow/plugins/PFCandIsolatorFromDeposit.cc b/CommonTools/ParticleFlow/plugins/PFCandIsolatorFromDeposit.cc index 4de7cd12c73c5..9851b3ff68c14 100644 --- a/CommonTools/ParticleFlow/plugins/PFCandIsolatorFromDeposit.cc +++ b/CommonTools/ParticleFlow/plugins/PFCandIsolatorFromDeposit.cc @@ -1,17 +1,11 @@ -#include "CommonTools/ParticleFlow/plugins/PFCandIsolatorFromDeposit.h" - -// Framework -#include "FWCore/Framework/interface/EDProducer.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/EventSetup.h" -#include "DataFormats/Common/interface/Handle.h" -#include "FWCore/Framework/interface/MakerMacros.h" - -#include "FWCore/Framework/interface/ESHandle.h" - +#include "CommonTools/Utils/interface/StringObjectFunction.h" #include "DataFormats/Candidate/interface/CandAssociation.h" +#include "DataFormats/Candidate/interface/Candidate.h" +#include "DataFormats/Common/interface/Handle.h" +#include "DataFormats/Common/interface/OwnVector.h" #include "DataFormats/EcalDetId/interface/EcalSubdetector.h" #include "DataFormats/MuonReco/interface/Muon.h" +#include "DataFormats/MuonReco/interface/MuonFwd.h" #include "DataFormats/ParticleFlowCandidate/interface/PFCandidate.h" #include "DataFormats/RecoCandidate/interface/IsoDeposit.h" #include "DataFormats/RecoCandidate/interface/IsoDepositDirection.h" @@ -19,13 +13,64 @@ #include "DataFormats/RecoCandidate/interface/IsoDepositVetos.h" #include "DataFormats/RecoCandidate/interface/RecoCandidate.h" #include "DataFormats/TrackReco/interface/Track.h" +#include "DataFormats/TrackReco/interface/TrackFwd.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" +#include "FWCore/Framework/interface/EDProducer.h" +#include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/Framework/interface/stream/EDProducer.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" -#include +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "PhysicsTools/IsolationAlgos/interface/EventDependentAbsVeto.h" +#include "PhysicsTools/IsolationAlgos/interface/IsoDepositVetoFactory.h" +#include #include #include -#include "PhysicsTools/IsolationAlgos/interface/IsoDepositVetoFactory.h" +class PFCandIsolatorFromDeposits : public edm::stream::EDProducer<> { +public: + typedef edm::ValueMap CandDoubleMap; + + enum Mode { Sum, SumRelative, Sum2, Sum2Relative, Max, MaxRelative, Count, NearestDR }; + PFCandIsolatorFromDeposits(const edm::ParameterSet &); + + ~PFCandIsolatorFromDeposits() override; + + void produce(edm::Event &, const edm::EventSetup &) override; + +private: + class SingleDeposit { + public: + SingleDeposit(const edm::ParameterSet &, edm::ConsumesCollector &&iC); + void cleanup(); + void open(const edm::Event &iEvent, const edm::EventSetup &iSetup); + double compute(const reco::CandidateBaseRef &cand); + const reco::IsoDepositMap &map() { return *hDeps_; } + + private: + Mode mode_; + edm::EDGetTokenT srcToken_; + double deltaR_; + bool usesFunction_; + double weight_; + + StringObjectFunction weightExpr_; + reco::isodeposit::AbsVetos barrelVetos_; + reco::isodeposit::AbsVetos endcapVetos_; + reco::isodeposit::EventDependentAbsVetos evdepVetos_; // note: these are a subset of the above. Don't delete twice! + bool skipDefaultVeto_; + bool usePivotForBarrelEndcaps_; + edm::Handle hDeps_; // transient + + bool isNumber(const std::string &str) const; + double toNumber(const std::string &str) const; + }; + // datamembers + std::vector sources_; +}; using namespace edm; using namespace reco; diff --git a/CommonTools/ParticleFlow/plugins/PFCandIsolatorFromDeposit.h b/CommonTools/ParticleFlow/plugins/PFCandIsolatorFromDeposit.h deleted file mode 100644 index 77bbc20bde3de..0000000000000 --- a/CommonTools/ParticleFlow/plugins/PFCandIsolatorFromDeposit.h +++ /dev/null @@ -1,68 +0,0 @@ -#ifndef PFCandIsolatorFromDeposits_H -#define PFCandIsolatorFromDeposits_H - -#include "FWCore/Framework/interface/stream/EDProducer.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/Framework/interface/ConsumesCollector.h" - -#include "DataFormats/TrackReco/interface/TrackFwd.h" -#include "DataFormats/MuonReco/interface/MuonFwd.h" -#include "DataFormats/RecoCandidate/interface/IsoDepositFwd.h" -#include "DataFormats/RecoCandidate/interface/IsoDeposit.h" -#include "PhysicsTools/IsolationAlgos/interface/EventDependentAbsVeto.h" - -#include "DataFormats/Candidate/interface/Candidate.h" -#include "CommonTools/Utils/interface/StringObjectFunction.h" -#include "DataFormats/Common/interface/OwnVector.h" - -#include - -namespace edm { - class Event; -} -namespace edm { - class EventSetup; -} - -class PFCandIsolatorFromDeposits : public edm::stream::EDProducer<> { -public: - typedef edm::ValueMap CandDoubleMap; - - enum Mode { Sum, SumRelative, Sum2, Sum2Relative, Max, MaxRelative, Count, NearestDR }; - PFCandIsolatorFromDeposits(const edm::ParameterSet &); - - ~PFCandIsolatorFromDeposits() override; - - void produce(edm::Event &, const edm::EventSetup &) override; - -private: - class SingleDeposit { - public: - SingleDeposit(const edm::ParameterSet &, edm::ConsumesCollector &&iC); - void cleanup(); - void open(const edm::Event &iEvent, const edm::EventSetup &iSetup); - double compute(const reco::CandidateBaseRef &cand); - const reco::IsoDepositMap &map() { return *hDeps_; } - - private: - Mode mode_; - edm::EDGetTokenT srcToken_; - double deltaR_; - bool usesFunction_; - double weight_; - - StringObjectFunction weightExpr_; - reco::isodeposit::AbsVetos barrelVetos_; - reco::isodeposit::AbsVetos endcapVetos_; - reco::isodeposit::EventDependentAbsVetos evdepVetos_; // note: these are a subset of the above. Don't delete twice! - bool skipDefaultVeto_; - bool usePivotForBarrelEndcaps_; - edm::Handle hDeps_; // transient - - bool isNumber(const std::string &str) const; - double toNumber(const std::string &str) const; - }; - // datamembers - std::vector sources_; -}; -#endif diff --git a/CommonTools/ParticleFlow/plugins/PFCandidateFromFwdPtrProducer.h b/CommonTools/ParticleFlow/plugins/PFCandidateFromFwdPtrProducer.cc similarity index 60% rename from CommonTools/ParticleFlow/plugins/PFCandidateFromFwdPtrProducer.h rename to CommonTools/ParticleFlow/plugins/PFCandidateFromFwdPtrProducer.cc index bf00abfe5c274..2dd5cbb653f16 100644 --- a/CommonTools/ParticleFlow/plugins/PFCandidateFromFwdPtrProducer.h +++ b/CommonTools/ParticleFlow/plugins/PFCandidateFromFwdPtrProducer.cc @@ -1,7 +1,13 @@ #include "CommonTools/UtilAlgos/interface/ProductFromFwdPtrProducer.h" +#include "DataFormats/JetReco/interface/PFJet.h" #include "DataFormats/ParticleFlowCandidate/interface/PFCandidate.h" #include "DataFormats/ParticleFlowCandidate/interface/PFCandidateFwd.h" #include "CommonTools/ParticleFlow/interface/PFCandidateWithSrcPtrFactory.h" typedef edm::ProductFromFwdPtrProducer PFCandidateFromFwdPtrProducer; +typedef edm::ProductFromFwdPtrProducer PFJetFromFwdPtrProducer; + +#include "FWCore/Framework/interface/MakerMacros.h" +DEFINE_FWK_MODULE(PFCandidateFromFwdPtrProducer); +DEFINE_FWK_MODULE(PFJetFromFwdPtrProducer); diff --git a/CommonTools/ParticleFlow/plugins/PFCandidateFwdPtrCollectionFilter.h b/CommonTools/ParticleFlow/plugins/PFCandidateFwdPtrCollectionFilter.cc similarity index 83% rename from CommonTools/ParticleFlow/plugins/PFCandidateFwdPtrCollectionFilter.h rename to CommonTools/ParticleFlow/plugins/PFCandidateFwdPtrCollectionFilter.cc index 59180562e777f..23d388f1eb890 100644 --- a/CommonTools/ParticleFlow/plugins/PFCandidateFwdPtrCollectionFilter.h +++ b/CommonTools/ParticleFlow/plugins/PFCandidateFwdPtrCollectionFilter.cc @@ -11,3 +11,7 @@ typedef edm::FwdPtrCollectionFilter PFCandidateFwdPtrCollectionPdgIdFilter; + +#include "FWCore/Framework/interface/MakerMacros.h" +DEFINE_FWK_MODULE(PFCandidateFwdPtrCollectionStringFilter); +DEFINE_FWK_MODULE(PFCandidateFwdPtrCollectionPdgIdFilter); diff --git a/CommonTools/ParticleFlow/plugins/PFJetFwdPtrProducer.h b/CommonTools/ParticleFlow/plugins/PFJetFwdPtrProducer.cc similarity index 71% rename from CommonTools/ParticleFlow/plugins/PFJetFwdPtrProducer.h rename to CommonTools/ParticleFlow/plugins/PFJetFwdPtrProducer.cc index baa72c343b8ef..9aa6ea159b46d 100644 --- a/CommonTools/ParticleFlow/plugins/PFJetFwdPtrProducer.h +++ b/CommonTools/ParticleFlow/plugins/PFJetFwdPtrProducer.cc @@ -3,3 +3,6 @@ #include "DataFormats/JetReco/interface/PFJetCollection.h" typedef edm::FwdPtrProducer PFJetFwdPtrProducer; + +#include "FWCore/Framework/interface/MakerMacros.h" +DEFINE_FWK_MODULE(PFJetFwdPtrProducer); diff --git a/CommonTools/ParticleFlow/plugins/PFMET.cc b/CommonTools/ParticleFlow/plugins/PFMET.cc index cc17a52f91b19..7810cc771598f 100644 --- a/CommonTools/ParticleFlow/plugins/PFMET.cc +++ b/CommonTools/ParticleFlow/plugins/PFMET.cc @@ -1,16 +1,45 @@ -#include "CommonTools/ParticleFlow/plugins/PFMET.h" +/**\class PFMET +\brief Computes the MET from a collection of PFCandidates. HF missing! -#include "DataFormats/ParticleFlowCandidate/interface/PFCandidate.h" +\todo Add HF energy to the MET calculation (access HF towers) + +\author Colin Bernet +\date february 2008 +*/ +#include "CommonTools/ParticleFlow/interface/PFMETAlgo.h" #include "DataFormats/METReco/interface/MET.h" #include "DataFormats/METReco/interface/METFwd.h" #include "DataFormats/Math/interface/LorentzVector.h" - +#include "DataFormats/ParticleFlowCandidate/interface/PFCandidate.h" +#include "FWCore/Framework/interface/EDProducer.h" #include "FWCore/Framework/interface/ESHandle.h" - +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/Utilities/interface/Exception.h" -#include "FWCore/Framework/interface/EventSetup.h" + +#include +#include + +class PFMET : public edm::EDProducer { +public: + explicit PFMET(const edm::ParameterSet&); + + ~PFMET() override; + + void produce(edm::Event&, const edm::EventSetup&) override; + + void beginJob() override; + +private: + /// Input PFCandidates + edm::InputTag inputTagPFCandidates_; + edm::EDGetTokenT tokenPFCandidates_; + + pf2pat::PFMETAlgo pfMETAlgo_; +}; using namespace std; using namespace edm; @@ -26,6 +55,9 @@ PFMET::PFMET(const edm::ParameterSet& iConfig) : pfMETAlgo_(iConfig) { LogDebug("PFMET") << " input collection : " << inputTagPFCandidates_; } +#include "FWCore/Framework/interface/MakerMacros.h" +DEFINE_FWK_MODULE(PFMET); + PFMET::~PFMET() {} void PFMET::beginJob() {} diff --git a/CommonTools/ParticleFlow/plugins/PFMET.h b/CommonTools/ParticleFlow/plugins/PFMET.h deleted file mode 100644 index 5b7f253a61826..0000000000000 --- a/CommonTools/ParticleFlow/plugins/PFMET.h +++ /dev/null @@ -1,45 +0,0 @@ -#ifndef PhysicsTools_PFCandProducer_PFMET_ -#define PhysicsTools_PFCandProducer_PFMET_ - -// system include files -#include -#include - -// user include files -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDProducer.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" - -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/MakerMacros.h" - -#include "CommonTools/ParticleFlow/interface/PFMETAlgo.h" - -/**\class PFMET -\brief Computes the MET from a collection of PFCandidates. HF missing! - -\todo Add HF energy to the MET calculation (access HF towers) - -\author Colin Bernet -\date february 2008 -*/ - -class PFMET : public edm::EDProducer { -public: - explicit PFMET(const edm::ParameterSet&); - - ~PFMET() override; - - void produce(edm::Event&, const edm::EventSetup&) override; - - void beginJob() override; - -private: - /// Input PFCandidates - edm::InputTag inputTagPFCandidates_; - edm::EDGetTokenT tokenPFCandidates_; - - pf2pat::PFMETAlgo pfMETAlgo_; -}; - -#endif diff --git a/CommonTools/ParticleFlow/plugins/PFNoPileUpPacked.cc b/CommonTools/ParticleFlow/plugins/PFNoPileUpPacked.cc new file mode 100644 index 0000000000000..5a94c6cd3bb0b --- /dev/null +++ b/CommonTools/ParticleFlow/plugins/PFNoPileUpPacked.cc @@ -0,0 +1,91 @@ +// system include files +#include +#include + +// user include files +#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 "DataFormats/Candidate/interface/Candidate.h" +#include "DataFormats/VertexReco/interface/VertexFwd.h" +#include "DataFormats/Common/interface/Association.h" + +#include "DataFormats/VertexReco/interface/Vertex.h" + +#include "FWCore/Utilities/interface/Exception.h" +#include "FWCore/Framework/interface/EventSetup.h" + +#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" +#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" + +using namespace std; +using namespace edm; +using namespace reco; + +/**\class PFNoPileUpPacked +\brief Identifies pile-up candidates from a collection of Candidates, and +produces the corresponding collection of NoPileUpCandidates. + +\author Andreas Hinzmann +\date May 2021 + +*/ + +class PFNoPileUpPacked : public edm::stream::EDProducer<> { +public: + typedef edm::View CandidateView; + typedef edm::Association CandToVertex; + + explicit PFNoPileUpPacked(const edm::ParameterSet&); + + ~PFNoPileUpPacked() override = default; + + void produce(edm::Event&, const edm::EventSetup&) override; + + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + +private: + edm::EDGetTokenT tokenCandidatesView_; + edm::EDGetTokenT tokenVertices_; + edm::EDGetTokenT tokenVertexAssociation_; + edm::EDGetTokenT> tokenVertexAssociationQuality_; + int vertexAssociationQuality_; +}; + +PFNoPileUpPacked::PFNoPileUpPacked(const edm::ParameterSet& iConfig) { + tokenCandidatesView_ = consumes(iConfig.getParameter("candidates")); + vertexAssociationQuality_ = iConfig.getParameter("vertexAssociationQuality"); + tokenVertexAssociation_ = consumes(iConfig.getParameter("vertexAssociation")); + tokenVertexAssociationQuality_ = + consumes>(iConfig.getParameter("vertexAssociation")); + produces>(); +} + +void PFNoPileUpPacked::produce(Event& iEvent, const EventSetup& iSetup) { + unique_ptr> pOutput(new edm::PtrVector); + Handle candidateView; + iEvent.getByToken(tokenCandidatesView_, candidateView); + const edm::Association& associatedPV = iEvent.get(tokenVertexAssociation_); + const edm::ValueMap& associationQuality = iEvent.get(tokenVertexAssociationQuality_); + for (const auto& p : candidateView->ptrs()) { + const reco::VertexRef& PVOrig = associatedPV[p]; + int quality = associationQuality[p]; + if (!(PVOrig.isNonnull() && (PVOrig.key() > 0) && (quality >= vertexAssociationQuality_))) + pOutput->push_back(p); + } + iEvent.put(std::move(pOutput)); +} + +void PFNoPileUpPacked::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + desc.add("candidates", edm::InputTag("packedPFCandidates")); + desc.add("vertexAssociationQuality", 7); + desc.add("vertexAssociation", edm::InputTag("packedPrimaryVertexAssociationJME", "original")); + descriptions.addWithDefaultLabel(desc); +} + +DEFINE_FWK_MODULE(PFNoPileUpPacked); \ No newline at end of file diff --git a/CommonTools/ParticleFlow/plugins/PFPileUp.cc b/CommonTools/ParticleFlow/plugins/PFPileUp.cc index e3681db53e9c4..35b328035eda6 100644 --- a/CommonTools/ParticleFlow/plugins/PFPileUp.cc +++ b/CommonTools/ParticleFlow/plugins/PFPileUp.cc @@ -1,4 +1,20 @@ -#include "CommonTools/ParticleFlow/plugins/PFPileUp.h" +// system include files +#include +#include + +// user include files +#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 "DataFormats/ParticleFlowCandidate/interface/PFCandidateFwd.h" +#include "DataFormats/VertexReco/interface/VertexFwd.h" +#include "DataFormats/Common/interface/Association.h" + +#include "CommonTools/ParticleFlow/interface/PFPileUpAlgo.h" #include "DataFormats/ParticleFlowCandidate/interface/PileUpPFCandidate.h" #include "DataFormats/ParticleFlowCandidate/interface/PileUpPFCandidateFwd.h" @@ -6,7 +22,6 @@ #include "FWCore/Framework/interface/ESHandle.h" -// #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/Utilities/interface/Exception.h" #include "FWCore/Framework/interface/EventSetup.h" @@ -14,12 +29,69 @@ using namespace std; using namespace edm; using namespace reco; +/**\class PFPileUp +\brief Identifies pile-up candidates from a collection of PFCandidates, and +produces the corresponding collection of PileUpCandidates. + +\author Colin Bernet +\date february 2008 +\updated Florian Beaudette 30/03/2012 + +*/ + +class PFPileUp : public edm::stream::EDProducer<> { +public: + typedef std::vector> PFCollection; + typedef edm::View PFView; + typedef std::vector PFCollectionByValue; + typedef edm::Association CandToVertex; + + explicit PFPileUp(const edm::ParameterSet&); + + ~PFPileUp() override; + + void produce(edm::Event&, const edm::EventSetup&) override; + +private: + PFPileUpAlgo pileUpAlgo_; + + /// PFCandidates to be analyzed + edm::EDGetTokenT tokenPFCandidates_; + /// fall-back token + edm::EDGetTokenT tokenPFCandidatesView_; + + /// vertices + edm::EDGetTokenT tokenVertices_; + + /// enable PFPileUp selection + bool enable_; + + /// verbose ? + bool verbose_; + + /// use the closest z vertex if a track is not in a vertex + bool checkClosestZVertex_; + + edm::EDGetTokenT tokenVertexAssociation_; + edm::EDGetTokenT> tokenVertexAssociationQuality_; + bool fUseVertexAssociation; + int vertexAssociationQuality_; +}; + PFPileUp::PFPileUp(const edm::ParameterSet& iConfig) { tokenPFCandidates_ = consumes(iConfig.getParameter("PFCandidates")); tokenPFCandidatesView_ = mayConsume(iConfig.getParameter("PFCandidates")); tokenVertices_ = consumes(iConfig.getParameter("Vertices")); + fUseVertexAssociation = iConfig.getParameter("useVertexAssociation"); + vertexAssociationQuality_ = iConfig.getParameter("vertexAssociationQuality"); + if (fUseVertexAssociation) { + tokenVertexAssociation_ = consumes(iConfig.getParameter("vertexAssociation")); + tokenVertexAssociationQuality_ = + consumes>(iConfig.getParameter("vertexAssociation")); + } + enable_ = iConfig.getParameter("Enable"); verbose_ = iConfig.getUntrackedParameter("verbose", false); @@ -93,10 +165,22 @@ void PFPileUp::produce(Event& iEvent, const EventSetup& iSetup) { "error."); } - pileUpAlgo_.process(*pfCandidatesRef, *vertices); - pOutput->insert( - pOutput->end(), pileUpAlgo_.getPFCandidatesFromPU().begin(), pileUpAlgo_.getPFCandidatesFromPU().end()); - + if (fUseVertexAssociation) { + const edm::Association& associatedPV = iEvent.get(tokenVertexAssociation_); + const edm::ValueMap& associationQuality = iEvent.get(tokenVertexAssociationQuality_); + PFCollection pfCandidatesFromPU; + for (auto& p : (*pfCandidatesRef)) { + const reco::VertexRef& PVOrig = associatedPV[p]; + int quality = associationQuality[p]; + if (PVOrig.isNonnull() && (PVOrig.key() > 0) && (quality >= vertexAssociationQuality_)) + pfCandidatesFromPU.push_back(p); + } + pOutput->insert(pOutput->end(), pfCandidatesFromPU.begin(), pfCandidatesFromPU.end()); + } else { + pileUpAlgo_.process(*pfCandidatesRef, *vertices); + pOutput->insert( + pOutput->end(), pileUpAlgo_.getPFCandidatesFromPU().begin(), pileUpAlgo_.getPFCandidatesFromPU().end()); + } // for ( PFCollection::const_iterator byValueBegin = pileUpAlgo_.getPFCandidatesFromPU().begin(), // byValueEnd = pileUpAlgo_.getPFCandidatesFromPU().end(), ibyValue = byValueBegin; // ibyValue != byValueEnd; ++ibyValue ) { @@ -108,3 +192,4 @@ void PFPileUp::produce(Event& iEvent, const EventSetup& iSetup) { iEvent.put(std::move(pOutput)); // iEvent.put(std::move(pOutputByValue)); } +DEFINE_FWK_MODULE(PFPileUp); diff --git a/CommonTools/ParticleFlow/plugins/PFPileUp.h b/CommonTools/ParticleFlow/plugins/PFPileUp.h deleted file mode 100644 index 6016386986150..0000000000000 --- a/CommonTools/ParticleFlow/plugins/PFPileUp.h +++ /dev/null @@ -1,64 +0,0 @@ -#ifndef PhysicsTools_PFCandProducer_PFPileUp_ -#define PhysicsTools_PFCandProducer_PFPileUp_ - -// system include files -#include -#include - -// user include files -#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 "DataFormats/ParticleFlowCandidate/interface/PFCandidateFwd.h" -#include "DataFormats/VertexReco/interface/VertexFwd.h" - -#include "CommonTools/ParticleFlow/interface/PFPileUpAlgo.h" - -/**\class PFPileUp -\brief Identifies pile-up candidates from a collection of PFCandidates, and -produces the corresponding collection of PileUpCandidates. - -\author Colin Bernet -\date february 2008 -\updated Florian Beaudette 30/03/2012 - -*/ - -class PFPileUp : public edm::stream::EDProducer<> { -public: - typedef std::vector > PFCollection; - typedef edm::View PFView; - typedef std::vector PFCollectionByValue; - - explicit PFPileUp(const edm::ParameterSet&); - - ~PFPileUp() override; - - void produce(edm::Event&, const edm::EventSetup&) override; - -private: - PFPileUpAlgo pileUpAlgo_; - - /// PFCandidates to be analyzed - edm::EDGetTokenT tokenPFCandidates_; - /// fall-back token - edm::EDGetTokenT tokenPFCandidatesView_; - - /// vertices - edm::EDGetTokenT tokenVertices_; - - /// enable PFPileUp selection - bool enable_; - - /// verbose ? - bool verbose_; - - /// use the closest z vertex if a track is not in a vertex - bool checkClosestZVertex_; -}; - -#endif diff --git a/CommonTools/ParticleFlow/plugins/PFTauFwdPtrProducer.h b/CommonTools/ParticleFlow/plugins/PFTauFwdPtrProducer.cc similarity index 70% rename from CommonTools/ParticleFlow/plugins/PFTauFwdPtrProducer.h rename to CommonTools/ParticleFlow/plugins/PFTauFwdPtrProducer.cc index b6bf2053c90b4..920402228451a 100644 --- a/CommonTools/ParticleFlow/plugins/PFTauFwdPtrProducer.h +++ b/CommonTools/ParticleFlow/plugins/PFTauFwdPtrProducer.cc @@ -3,3 +3,6 @@ #include "DataFormats/TauReco/interface/PFTauFwd.h" typedef edm::FwdPtrProducer PFTauFwdPtrProducer; + +#include "FWCore/Framework/interface/MakerMacros.h" +DEFINE_FWK_MODULE(PFTauFwdPtrProducer); diff --git a/CommonTools/ParticleFlow/plugins/SealModule.cc b/CommonTools/ParticleFlow/plugins/SealModule.cc deleted file mode 100644 index eb561b1381c31..0000000000000 --- a/CommonTools/ParticleFlow/plugins/SealModule.cc +++ /dev/null @@ -1,23 +0,0 @@ -#include "FWCore/Framework/interface/MakerMacros.h" - -#include "CommonTools/ParticleFlow/plugins/PFMET.h" -#include "CommonTools/ParticleFlow/plugins/PFPileUp.h" -#include "CommonTools/ParticleFlow/plugins/PFCandidateFwdPtrCollectionFilter.h" -#include "CommonTools/ParticleFlow/plugins/PFJetFwdPtrProducer.h" -#include "CommonTools/ParticleFlow/plugins/PFTauFwdPtrProducer.h" -#include "CommonTools/ParticleFlow/plugins/PFCandidateFromFwdPtrProducer.h" -#include "CommonTools/ParticleFlow/plugins/DeltaBetaWeights.h" - -DEFINE_FWK_MODULE(PFMET); -DEFINE_FWK_MODULE(PFPileUp); - -DEFINE_FWK_MODULE(PFCandidateFwdPtrCollectionStringFilter); -DEFINE_FWK_MODULE(PFCandidateFwdPtrCollectionPdgIdFilter); -DEFINE_FWK_MODULE(PFJetFwdPtrProducer); -DEFINE_FWK_MODULE(PFTauFwdPtrProducer); -DEFINE_FWK_MODULE(PFCandidateFromFwdPtrProducer); - -typedef edm::ProductFromFwdPtrProducer PFJetFromFwdPtrProducer; -DEFINE_FWK_MODULE(PFJetFromFwdPtrProducer); - -DEFINE_FWK_MODULE(DeltaBetaWeights); diff --git a/CommonTools/ParticleFlow/plugins/TopProjector.cc b/CommonTools/ParticleFlow/plugins/TopProjector.cc index 40cba4ecfb171..6b30fd6e4dc1b 100644 --- a/CommonTools/ParticleFlow/plugins/TopProjector.cc +++ b/CommonTools/ParticleFlow/plugins/TopProjector.cc @@ -1,26 +1,250 @@ -#include "CommonTools/ParticleFlow/plugins/TopProjector.h" +/**\class TopProjector +\brief -#include "DataFormats/ParticleFlowCandidate/interface/PileUpPFCandidate.h" -#include "DataFormats/ParticleFlowCandidate/interface/PileUpPFCandidateFwd.h" -#include "DataFormats/ParticleFlowCandidate/interface/IsolatedPFCandidate.h" -#include "DataFormats/ParticleFlowCandidate/interface/IsolatedPFCandidateFwd.h" +\author Colin Bernet +\date february 2008 +*/ + +#include "DataFormats/Candidate/interface/CandidateFwd.h" +#include "DataFormats/Candidate/interface/OverlapChecker.h" #include "DataFormats/JetReco/interface/PFJet.h" #include "DataFormats/JetReco/interface/PFJetCollection.h" +#include "DataFormats/Math/interface/deltaR.h" +#include "DataFormats/ParticleFlowCandidate/interface/IsolatedPFCandidate.h" +#include "DataFormats/ParticleFlowCandidate/interface/IsolatedPFCandidateFwd.h" +#include "DataFormats/ParticleFlowCandidate/interface/PFCandidateFwd.h" +#include "DataFormats/ParticleFlowCandidate/interface/PileUpPFCandidate.h" +#include "DataFormats/ParticleFlowCandidate/interface/PileUpPFCandidateFwd.h" +#include "DataFormats/Provenance/interface/ProductID.h" #include "DataFormats/TauReco/interface/PFTau.h" #include "DataFormats/TauReco/interface/PFTauFwd.h" - -//TODO just for testing, remove this #include "DataFormats/TrackReco/interface/Track.h" - #include "FWCore/Framework/interface/ESHandle.h" - -// #include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "FWCore/Utilities/interface/Exception.h" +#include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Framework/interface/stream/EDProducer.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" +#include "FWCore/Utilities/interface/Exception.h" -#include "DataFormats/Math/interface/deltaR.h" +#include +#include +#include -#include "FWCore/Framework/interface/MakerMacros.h" +/// This checks a slew of possible overlaps for FwdPtr and derivatives. +template +class TopProjectorFwdPtrOverlap { +public: + typedef edm::FwdPtr TopFwdPtr; + typedef edm::FwdPtr BottomFwdPtr; + + explicit TopProjectorFwdPtrOverlap() { bottom_ = 0; } + + explicit TopProjectorFwdPtrOverlap(edm::ParameterSet const& iConfig) + : bottom_(nullptr), matchByPtrDirect_(iConfig.getParameter("matchByPtrDirect")) {} + + inline void setBottom(BottomFwdPtr const& bottom) { bottom_ = ⊥ } + + bool operator()(TopFwdPtr const& top) const { + if (std::is_same::value && matchByPtrDirect_) + return top.ptr().refCore() == bottom_->ptr().refCore() && top.ptr().key() == bottom_->ptr().key(); + bool topFwdGood = top.ptr().isNonnull() && top.ptr().isAvailable(); + bool topBckGood = top.backPtr().isNonnull() && top.backPtr().isAvailable(); + bool bottomFwdGood = bottom_->ptr().isNonnull() && bottom_->ptr().isAvailable(); + bool bottomBckGood = bottom_->backPtr().isNonnull() && bottom_->backPtr().isAvailable(); + + bool matched = (topFwdGood && bottomFwdGood && top.ptr().refCore() == bottom_->ptr().refCore() && + top.ptr().key() == bottom_->ptr().key()) || + (topFwdGood && bottomBckGood && top.ptr().refCore() == bottom_->backPtr().refCore() && + top.ptr().key() == bottom_->backPtr().key()) || + (topBckGood && bottomFwdGood && top.backPtr().refCore() == bottom_->ptr().refCore() && + top.backPtr().key() == bottom_->ptr().key()) || + (topBckGood && bottomBckGood && top.backPtr().refCore() == bottom_->backPtr().refCore() && + top.backPtr().key() == bottom_->backPtr().key()); + if (!matched) { + for (unsigned isource = 0; isource < top->numberOfSourceCandidatePtrs(); ++isource) { + reco::CandidatePtr const& topSrcPtr = top->sourceCandidatePtr(isource); + bool topSrcGood = topSrcPtr.isNonnull() && topSrcPtr.isAvailable(); + if ((topSrcGood && bottomFwdGood && topSrcPtr.refCore() == bottom_->ptr().refCore() && + topSrcPtr.key() == bottom_->ptr().key()) || + (topSrcGood && bottomBckGood && topSrcPtr.refCore() == bottom_->backPtr().refCore() && + topSrcPtr.key() == bottom_->backPtr().key())) { + matched = true; + break; + } + } + } + if (!matched) { + for (unsigned isource = 0; isource < (*bottom_)->numberOfSourceCandidatePtrs(); ++isource) { + reco::CandidatePtr const& bottomSrcPtr = (*bottom_)->sourceCandidatePtr(isource); + bool bottomSrcGood = bottomSrcPtr.isNonnull() && bottomSrcPtr.isAvailable(); + if ((topFwdGood && bottomSrcGood && bottomSrcPtr.refCore() == top.ptr().refCore() && + bottomSrcPtr.key() == top.ptr().key()) || + (topBckGood && bottomSrcGood && bottomSrcPtr.refCore() == top.backPtr().refCore() && + bottomSrcPtr.key() == top.backPtr().key())) { + matched = true; + break; + } + } + } + + return matched; + } + +protected: + BottomFwdPtr const* bottom_; + const bool matchByPtrDirect_ = false; +}; + +/// This checks matching based on delta R +template +class TopProjectorDeltaROverlap { +public: + typedef edm::FwdPtr TopFwdPtr; + typedef edm::FwdPtr BottomFwdPtr; + + explicit TopProjectorDeltaROverlap() { bottom_ = 0; } + explicit TopProjectorDeltaROverlap(edm::ParameterSet const& config) + : deltaR2_(config.getParameter("deltaR")), + bottom_(nullptr), + bottomCPtr_(nullptr), + botEta_(-999.f), + botPhi_(0.f) { + deltaR2_ *= deltaR2_; + } + + inline void setBottom(BottomFwdPtr const& bottom) { + bottom_ = ⊥ + bottomCPtr_ = &**bottom_; + botEta_ = bottomCPtr_->eta(); + botPhi_ = bottomCPtr_->phi(); + } + + bool operator()(TopFwdPtr const& top) const { + const Top& oTop = *top; + float topEta = oTop.eta(); + float topPhi = oTop.phi(); + bool matched = reco::deltaR2(topEta, topPhi, botEta_, botPhi_) < deltaR2_; + return matched; + } + +protected: + double deltaR2_; + BottomFwdPtr const* bottom_; + const Bottom* bottomCPtr_; + float botEta_, botPhi_; +}; + +template > +class TopProjector : public edm::stream::EDProducer<> { +public: + typedef std::vector TopCollection; + typedef edm::FwdPtr TopFwdPtr; + typedef std::vector TopFwdPtrCollection; + + typedef std::vector BottomCollection; + typedef edm::FwdPtr BottomFwdPtr; + typedef std::vector BottomFwdPtrCollection; + + TopProjector(const edm::ParameterSet&); + + ~TopProjector() override = default; + + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + + void produce(edm::Event&, const edm::EventSetup&) override; + +private: + /// Matching method. + Matcher match_; + + /// enable? if not, all candidates in the bottom collection are copied to the output collection + const bool enable_; + + /// name of the top projection + const std::string name_; + + /// input tag for the top (masking) collection + const edm::EDGetTokenT tokenTop_; + + /// input tag for the masked collection. + const edm::EDGetTokenT tokenBottom_; +}; + +template +TopProjector::TopProjector(const edm::ParameterSet& iConfig) + : match_(iConfig), + enable_(iConfig.getParameter("enable")), + name_(iConfig.getUntrackedParameter("name", "No Name")), + tokenTop_(consumes(iConfig.getParameter("topCollection"))), + tokenBottom_(consumes(iConfig.getParameter("bottomCollection"))) { + // will produce a collection of the unmasked candidates in the + // bottom collection + produces(); +} + +template +void TopProjector::fillDescriptions(edm::ConfigurationDescriptions& desc) { + edm::ParameterSetDescription psD; + psD.add("enable"); + if (std::is_same>::value) + psD.add("deltaR"); + psD.addUntracked("name", "No Name"); + psD.add("topCollection"); + psD.add("bottomCollection"); + if (std::is_same>::value) + psD.add("matchByPtrDirect", false)->setComment("fast check by ptr() only"); + desc.addWithDefaultLabel(psD); +} + +template +void TopProjector::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { + // get the various collections + + // Access the masking collection + auto const& tops = iEvent.get(tokenTop_); + std::list topsList; + + for (auto const& top : tops) { + topsList.push_back(top); + } + + // Access the collection to + // be masked by the other ones + auto const& bottoms = iEvent.get(tokenBottom_); + + // output collection of FwdPtrs to objects, + // selected from the Bottom collection + std::unique_ptr pBottomFwdPtrOutput(new BottomFwdPtrCollection); + + LogDebug("TopProjection") << " Remaining candidates in the bottom collection ------ "; + + int iB = -1; + for (auto const& bottom : bottoms) { + iB++; + match_.setBottom(bottom); + auto found = topsList.end(); + if (enable_) { + found = std::find_if(topsList.begin(), topsList.end(), match_); + } + + // If this is masked in the top projection, we remove it. + if (found != topsList.end()) { + LogDebug("TopProjection") << "X " << iB << *bottom; + topsList.erase(found); + continue; + } + // otherwise, we keep it. + else { + LogDebug("TopProjection") << "O " << iB << *bottom; + pBottomFwdPtrOutput->push_back(bottom); + } + } + + iEvent.put(std::move(pBottomFwdPtrOutput)); +} using namespace std; using namespace edm; @@ -33,8 +257,9 @@ typedef TopProjector TPIsolatedPFCandidatesOnP typedef TopProjector TPPFCandidatesOnPileUpPFCandidates; typedef TopProjector TPPFTausOnPFJets; -typedef TopProjector > TPPFTausOnPFJetsDeltaR; +typedef TopProjector> TPPFTausOnPFJetsDeltaR; +#include "FWCore/Framework/interface/MakerMacros.h" DEFINE_FWK_MODULE(TPPFJetsOnPFCandidates); DEFINE_FWK_MODULE(TPPFCandidatesOnPFCandidates); DEFINE_FWK_MODULE(TPPileUpPFCandidatesOnPFCandidates); diff --git a/CommonTools/ParticleFlow/plugins/TopProjector.h b/CommonTools/ParticleFlow/plugins/TopProjector.h deleted file mode 100644 index 7b4015c2b97cc..0000000000000 --- a/CommonTools/ParticleFlow/plugins/TopProjector.h +++ /dev/null @@ -1,252 +0,0 @@ -#ifndef CommonTools_ParticleFlow_TopProjector_ -#define CommonTools_ParticleFlow_TopProjector_ - -// system include files -#include -#include -#include - -// user include files -#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 "DataFormats/Provenance/interface/ProductID.h" - -#include "DataFormats/ParticleFlowCandidate/interface/PFCandidateFwd.h" -#include "DataFormats/TauReco/interface/PFTau.h" -#include "DataFormats/JetReco/interface/PFJet.h" - -#include "DataFormats/Candidate/interface/CandidateFwd.h" -#include "DataFormats/Candidate/interface/OverlapChecker.h" - -#include "DataFormats/Math/interface/deltaR.h" - -#include "FWCore/MessageLogger/interface/MessageLogger.h" - -/**\class TopProjector -\brief - -\author Colin Bernet -\date february 2008 -*/ - -#include - -/// This checks a slew of possible overlaps for FwdPtr and derivatives. -template -class TopProjectorFwdPtrOverlap { -public: - typedef edm::FwdPtr TopFwdPtr; - typedef edm::FwdPtr BottomFwdPtr; - - explicit TopProjectorFwdPtrOverlap() { bottom_ = 0; } - - explicit TopProjectorFwdPtrOverlap(edm::ParameterSet const& iConfig) - : bottom_(nullptr), matchByPtrDirect_(iConfig.getParameter("matchByPtrDirect")) {} - - inline void setBottom(BottomFwdPtr const& bottom) { bottom_ = ⊥ } - - bool operator()(TopFwdPtr const& top) const { - if (std::is_same::value && matchByPtrDirect_) - return top.ptr().refCore() == bottom_->ptr().refCore() && top.ptr().key() == bottom_->ptr().key(); - bool topFwdGood = top.ptr().isNonnull() && top.ptr().isAvailable(); - bool topBckGood = top.backPtr().isNonnull() && top.backPtr().isAvailable(); - bool bottomFwdGood = bottom_->ptr().isNonnull() && bottom_->ptr().isAvailable(); - bool bottomBckGood = bottom_->backPtr().isNonnull() && bottom_->backPtr().isAvailable(); - - bool matched = (topFwdGood && bottomFwdGood && top.ptr().refCore() == bottom_->ptr().refCore() && - top.ptr().key() == bottom_->ptr().key()) || - (topFwdGood && bottomBckGood && top.ptr().refCore() == bottom_->backPtr().refCore() && - top.ptr().key() == bottom_->backPtr().key()) || - (topBckGood && bottomFwdGood && top.backPtr().refCore() == bottom_->ptr().refCore() && - top.backPtr().key() == bottom_->ptr().key()) || - (topBckGood && bottomBckGood && top.backPtr().refCore() == bottom_->backPtr().refCore() && - top.backPtr().key() == bottom_->backPtr().key()); - if (!matched) { - for (unsigned isource = 0; isource < top->numberOfSourceCandidatePtrs(); ++isource) { - reco::CandidatePtr const& topSrcPtr = top->sourceCandidatePtr(isource); - bool topSrcGood = topSrcPtr.isNonnull() && topSrcPtr.isAvailable(); - if ((topSrcGood && bottomFwdGood && topSrcPtr.refCore() == bottom_->ptr().refCore() && - topSrcPtr.key() == bottom_->ptr().key()) || - (topSrcGood && bottomBckGood && topSrcPtr.refCore() == bottom_->backPtr().refCore() && - topSrcPtr.key() == bottom_->backPtr().key())) { - matched = true; - break; - } - } - } - if (!matched) { - for (unsigned isource = 0; isource < (*bottom_)->numberOfSourceCandidatePtrs(); ++isource) { - reco::CandidatePtr const& bottomSrcPtr = (*bottom_)->sourceCandidatePtr(isource); - bool bottomSrcGood = bottomSrcPtr.isNonnull() && bottomSrcPtr.isAvailable(); - if ((topFwdGood && bottomSrcGood && bottomSrcPtr.refCore() == top.ptr().refCore() && - bottomSrcPtr.key() == top.ptr().key()) || - (topBckGood && bottomSrcGood && bottomSrcPtr.refCore() == top.backPtr().refCore() && - bottomSrcPtr.key() == top.backPtr().key())) { - matched = true; - break; - } - } - } - - return matched; - } - -protected: - BottomFwdPtr const* bottom_; - const bool matchByPtrDirect_ = false; -}; - -/// This checks matching based on delta R -template -class TopProjectorDeltaROverlap { -public: - typedef edm::FwdPtr TopFwdPtr; - typedef edm::FwdPtr BottomFwdPtr; - - explicit TopProjectorDeltaROverlap() { bottom_ = 0; } - explicit TopProjectorDeltaROverlap(edm::ParameterSet const& config) - : deltaR2_(config.getParameter("deltaR")), - bottom_(nullptr), - bottomCPtr_(nullptr), - botEta_(-999.f), - botPhi_(0.f) { - deltaR2_ *= deltaR2_; - } - - inline void setBottom(BottomFwdPtr const& bottom) { - bottom_ = ⊥ - bottomCPtr_ = &**bottom_; - botEta_ = bottomCPtr_->eta(); - botPhi_ = bottomCPtr_->phi(); - } - - bool operator()(TopFwdPtr const& top) const { - const Top& oTop = *top; - float topEta = oTop.eta(); - float topPhi = oTop.phi(); - bool matched = reco::deltaR2(topEta, topPhi, botEta_, botPhi_) < deltaR2_; - return matched; - } - -protected: - double deltaR2_; - BottomFwdPtr const* bottom_; - const Bottom* bottomCPtr_; - float botEta_, botPhi_; -}; - -template > -class TopProjector : public edm::stream::EDProducer<> { -public: - typedef std::vector TopCollection; - typedef edm::FwdPtr TopFwdPtr; - typedef std::vector TopFwdPtrCollection; - - typedef std::vector BottomCollection; - typedef edm::FwdPtr BottomFwdPtr; - typedef std::vector BottomFwdPtrCollection; - - TopProjector(const edm::ParameterSet&); - - ~TopProjector() override = default; - - static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); - - void produce(edm::Event&, const edm::EventSetup&) override; - -private: - /// Matching method. - Matcher match_; - - /// enable? if not, all candidates in the bottom collection are copied to the output collection - const bool enable_; - - /// name of the top projection - const std::string name_; - - /// input tag for the top (masking) collection - const edm::EDGetTokenT tokenTop_; - - /// input tag for the masked collection. - const edm::EDGetTokenT tokenBottom_; -}; - -template -TopProjector::TopProjector(const edm::ParameterSet& iConfig) - : match_(iConfig), - enable_(iConfig.getParameter("enable")), - name_(iConfig.getUntrackedParameter("name", "No Name")), - tokenTop_(consumes(iConfig.getParameter("topCollection"))), - tokenBottom_(consumes(iConfig.getParameter("bottomCollection"))) { - // will produce a collection of the unmasked candidates in the - // bottom collection - produces(); -} - -template -void TopProjector::fillDescriptions(edm::ConfigurationDescriptions& desc) { - edm::ParameterSetDescription psD; - psD.add("enable"); - if (std::is_same>::value) - psD.add("deltaR"); - psD.addUntracked("name", "No Name"); - psD.add("topCollection"); - psD.add("bottomCollection"); - if (std::is_same>::value) - psD.add("matchByPtrDirect", false)->setComment("fast check by ptr() only"); - desc.addWithDefaultLabel(psD); -} - -template -void TopProjector::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { - // get the various collections - - // Access the masking collection - auto const& tops = iEvent.get(tokenTop_); - std::list topsList; - - for (auto const& top : tops) { - topsList.push_back(top); - } - - // Access the collection to - // be masked by the other ones - auto const& bottoms = iEvent.get(tokenBottom_); - - // output collection of FwdPtrs to objects, - // selected from the Bottom collection - std::unique_ptr pBottomFwdPtrOutput(new BottomFwdPtrCollection); - - LogDebug("TopProjection") << " Remaining candidates in the bottom collection ------ "; - - int iB = -1; - for (auto const& bottom : bottoms) { - iB++; - match_.setBottom(bottom); - auto found = topsList.end(); - if (enable_) { - found = std::find_if(topsList.begin(), topsList.end(), match_); - } - - // If this is masked in the top projection, we remove it. - if (found != topsList.end()) { - LogDebug("TopProjection") << "X " << iB << *bottom; - topsList.erase(found); - continue; - } - // otherwise, we keep it. - else { - LogDebug("TopProjection") << "O " << iB << *bottom; - pBottomFwdPtrOutput->push_back(bottom); - } - } - - iEvent.put(std::move(pBottomFwdPtrOutput)); -} - -#endif diff --git a/CommonTools/ParticleFlow/python/pfCHS_cff.py b/CommonTools/ParticleFlow/python/pfCHS_cff.py new file mode 100644 index 0000000000000..23dba83b7fa79 --- /dev/null +++ b/CommonTools/ParticleFlow/python/pfCHS_cff.py @@ -0,0 +1,15 @@ +import FWCore.ParameterSet.Config as cms +from CommonTools.ParticleFlow.pfNoPileUpJME_cff import adapt, pfPileUpJME +from CommonTools.RecoAlgos.sortedPackedPrimaryVertices_cfi import sortedPackedPrimaryVertices + +packedPrimaryVertexAssociationJME = sortedPackedPrimaryVertices.clone( + produceSortedVertices = False, + producePileUpCollection = False, + produceNoPileUpCollection = False +) +adapt(packedPrimaryVertexAssociationJME) + +from CommonTools.ParticleFlow.pfNoPileUpPacked_cfi import pfNoPileUpPacked as _pfNoPileUpPacked +pfCHS = _pfNoPileUpPacked.clone( + vertexAssociationQuality=pfPileUpJME.vertexAssociationQuality +) diff --git a/CommonTools/ParticleFlow/python/pfNoPileUpJME_cff.py b/CommonTools/ParticleFlow/python/pfNoPileUpJME_cff.py index 0907848fe1db6..caad529298bd3 100644 --- a/CommonTools/ParticleFlow/python/pfNoPileUpJME_cff.py +++ b/CommonTools/ParticleFlow/python/pfNoPileUpJME_cff.py @@ -2,16 +2,38 @@ from CommonTools.ParticleFlow.pfPileUp_cfi import pfPileUp as _pfPileUp from CommonTools.ParticleFlow.TopProjectors.pfNoPileUp_cfi import pfNoPileUp as _pfNoPileUp -from CommonTools.ParticleFlow.goodOfflinePrimaryVertices_cfi import * +from CommonTools.ParticleFlow.goodOfflinePrimaryVertices_cfi import goodOfflinePrimaryVertices +from CommonTools.RecoAlgos.primaryVertexAssociation_cfi import primaryVertexAssociation + +def adapt(primaryVertexAssociationJME): + # options for quality PrimaryDz = 6 (used in PUPPI) + primaryVertexAssociationJME.assignment.maxDzSigForPrimaryAssignment = 1e10 + primaryVertexAssociationJME.assignment.maxDzForPrimaryAssignment = 0.3 + primaryVertexAssociationJME.assignment.maxDzErrorForPrimaryAssignment = 1e10 + primaryVertexAssociationJME.assignment.NumOfPUVtxsForCharged = 2 + primaryVertexAssociationJME.assignment.PtMaxCharged = 20. + primaryVertexAssociationJME.assignment.EtaMinUseDz = 2.4 + primaryVertexAssociationJME.assignment.OnlyUseFirstDz = True + from Configuration.Eras.Modifier_phase2_common_cff import phase2_common + phase2_common.toModify( + primaryVertexAssociationJME.assignment, + maxDzForPrimaryAssignment=0.1, + EtaMinUseDz = 4.0 + ) +primaryVertexAssociationJME = primaryVertexAssociation.clone(vertices = 'goodOfflinePrimaryVertices') +adapt(primaryVertexAssociationJME) pfPileUpJME = _pfPileUp.clone(PFCandidates='particleFlowPtrs', - Vertices = 'goodOfflinePrimaryVertices', - checkClosestZVertex = False ) + useVertexAssociation = True, + vertexAssociationQuality = 7, + vertexAssociation = ('primaryVertexAssociationJME','original'), + ) pfNoPileUpJME = _pfNoPileUp.clone(topCollection = 'pfPileUpJME', bottomCollection = 'particleFlowPtrs' ) pfNoPileUpJMETask = cms.Task( goodOfflinePrimaryVertices, + primaryVertexAssociationJME, pfPileUpJME, pfNoPileUpJME ) diff --git a/CommonTools/ParticleFlow/python/pfPileUp_cfi.py b/CommonTools/ParticleFlow/python/pfPileUp_cfi.py index 4696123d18f91..025d6479ad2eb 100644 --- a/CommonTools/ParticleFlow/python/pfPileUp_cfi.py +++ b/CommonTools/ParticleFlow/python/pfPileUp_cfi.py @@ -8,5 +8,8 @@ # pile-up identification now enabled by default. To be studied for jets Enable = cms.bool(True), verbose = cms.untracked.bool(False), - checkClosestZVertex = cms.bool(True) + checkClosestZVertex = cms.bool(True), + useVertexAssociation = cms.bool(False), + vertexAssociationQuality = cms.int32(0), + vertexAssociation = cms.InputTag(''), ) diff --git a/CommonTools/PileupAlgos/plugins/PuppiPhoton.cc b/CommonTools/PileupAlgos/plugins/PuppiPhoton.cc index 5b9ed019b1b64..d69f0d722d681 100644 --- a/CommonTools/PileupAlgos/plugins/PuppiPhoton.cc +++ b/CommonTools/PileupAlgos/plugins/PuppiPhoton.cc @@ -1,27 +1,63 @@ -// system include files -#include - -// user include files -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDProducer.h" -#include "FWCore/Framework/interface/Event.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 "DataFormats/Common/interface/View.h" +#include "DataFormats/Candidate/interface/Candidate.h" #include "DataFormats/Candidate/interface/CandidateFwd.h" -#include "DataFormats/PatCandidates/interface/PackedCandidate.h" -#include "DataFormats/PatCandidates/interface/Photon.h" -#include "DataFormats/PatCandidates/interface/Electron.h" -#include "DataFormats/VertexReco/interface/VertexFwd.h" -#include "DataFormats/VertexReco/interface/Vertex.h" +#include "DataFormats/Common/interface/Association.h" +#include "DataFormats/Common/interface/ValueMap.h" +#include "DataFormats/Common/interface/View.h" #include "DataFormats/GsfTrackReco/interface/GsfTrack.h" #include "DataFormats/GsfTrackReco/interface/GsfTrackFwd.h" -#include "DataFormats/Common/interface/Association.h" +#include "DataFormats/Math/interface/PtEtaPhiMass.h" #include "DataFormats/Math/interface/deltaR.h" -//Main File -#include "CommonTools/PileupAlgos/plugins/PuppiPhoton.h" +#include "DataFormats/ParticleFlowCandidate/interface/PFCandidate.h" +#include "DataFormats/PatCandidates/interface/Electron.h" +#include "DataFormats/PatCandidates/interface/PackedCandidate.h" +#include "DataFormats/PatCandidates/interface/Photon.h" +#include "DataFormats/VertexReco/interface/Vertex.h" +#include "DataFormats/VertexReco/interface/VertexFwd.h" +#include "FWCore/Framework/interface/EDProducer.h" +#include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/EventSetup.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 + +// ------------------------------------------------------------------------------------------ +class PuppiPhoton : public edm::stream::EDProducer<> { +public: + explicit PuppiPhoton(const edm::ParameterSet &); + ~PuppiPhoton() override; + + static void fillDescriptions(edm::ConfigurationDescriptions &descriptions); + typedef math::XYZTLorentzVector LorentzVector; + typedef std::vector LorentzVectorCollection; + typedef edm::View CandidateView; + typedef std::vector PFOutputCollection; + typedef edm::View PFView; + +private: + void produce(edm::Event &, const edm::EventSetup &) override; + bool matchPFCandidate(const reco::Candidate *iPF, const reco::Candidate *iPho); + edm::EDGetTokenT tokenPFCandidates_; + edm::EDGetTokenT tokenPuppiCandidates_; + edm::EDGetTokenT tokenPhotonCandidates_; + edm::EDGetTokenT>> reco2pf_; + edm::EDGetTokenT> tokenWeights_; + edm::EDGetTokenT> tokenPhotonId_; + double pt_; + double eta_; + bool usePFRef_; + bool usePFphotons_; + bool runOnMiniAOD_; + bool usePhotonId_; + std::vector dRMatch_; + std::vector pdgIds_; + std::unique_ptr corrCandidates_; + double weight_; + bool useValueMap_; +}; // ------------------------------------------------------------------------------------------ PuppiPhoton::PuppiPhoton(const edm::ParameterSet &iConfig) { diff --git a/CommonTools/PileupAlgos/plugins/PuppiPhoton.h b/CommonTools/PileupAlgos/plugins/PuppiPhoton.h deleted file mode 100644 index 194cc3001fe05..0000000000000 --- a/CommonTools/PileupAlgos/plugins/PuppiPhoton.h +++ /dev/null @@ -1,53 +0,0 @@ -#ifndef CommonTools_Puppi_PuppiPhoton_h_ -#define CommonTools_Puppi_PuppiPhoton_h_ -// system include files -#include - -// user include files -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/stream/EDProducer.h" -#include "FWCore/Framework/interface/Event.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 "DataFormats/Math/interface/PtEtaPhiMass.h" -#include "DataFormats/Candidate/interface/Candidate.h" -#include "DataFormats/ParticleFlowCandidate/interface/PFCandidate.h" -#include "DataFormats/Common/interface/ValueMap.h" - -// ------------------------------------------------------------------------------------------ -class PuppiPhoton : public edm::stream::EDProducer<> { -public: - explicit PuppiPhoton(const edm::ParameterSet &); - ~PuppiPhoton() override; - - static void fillDescriptions(edm::ConfigurationDescriptions &descriptions); - typedef math::XYZTLorentzVector LorentzVector; - typedef std::vector LorentzVectorCollection; - typedef edm::View CandidateView; - typedef std::vector PFOutputCollection; - typedef edm::View PFView; - -private: - void produce(edm::Event &, const edm::EventSetup &) override; - bool matchPFCandidate(const reco::Candidate *iPF, const reco::Candidate *iPho); - edm::EDGetTokenT tokenPFCandidates_; - edm::EDGetTokenT tokenPuppiCandidates_; - edm::EDGetTokenT tokenPhotonCandidates_; - edm::EDGetTokenT > > reco2pf_; - edm::EDGetTokenT > tokenWeights_; - edm::EDGetTokenT > tokenPhotonId_; - double pt_; - double eta_; - bool usePFRef_; - bool usePFphotons_; - bool runOnMiniAOD_; - bool usePhotonId_; - std::vector dRMatch_; - std::vector pdgIds_; - std::unique_ptr corrCandidates_; - double weight_; - bool useValueMap_; -}; -#endif diff --git a/CommonTools/PileupAlgos/plugins/PuppiProducer.cc b/CommonTools/PileupAlgos/plugins/PuppiProducer.cc index cfbeb0cc02ff9..0d6c3bdfda83b 100644 --- a/CommonTools/PileupAlgos/plugins/PuppiProducer.cc +++ b/CommonTools/PileupAlgos/plugins/PuppiProducer.cc @@ -1,23 +1,93 @@ -// system include files -#include - -// user include files -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDProducer.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/MakerMacros.h" -#include "DataFormats/Common/interface/ValueMap.h" -#include "FWCore/Framework/interface/ESHandle.h" -#include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "DataFormats/Common/interface/View.h" +#include "CommonTools/PileupAlgos/interface/PuppiAlgo.h" +#include "CommonTools/PileupAlgos/interface/PuppiContainer.h" #include "DataFormats/Candidate/interface/Candidate.h" #include "DataFormats/Candidate/interface/CandidateFwd.h" +#include "DataFormats/Common/interface/Association.h" +#include "DataFormats/Common/interface/ValueMap.h" +#include "DataFormats/Common/interface/View.h" #include "DataFormats/GsfTrackReco/interface/GsfTrack.h" #include "DataFormats/GsfTrackReco/interface/GsfTrackFwd.h" -#include "DataFormats/Common/interface/Association.h" -//Main File -#include "CommonTools/PileupAlgos/plugins/PuppiProducer.h" +#include "DataFormats/Math/interface/LorentzVector.h" +#include "DataFormats/Math/interface/PtEtaPhiMass.h" +#include "DataFormats/ParticleFlowCandidate/interface/PFCandidate.h" +#include "DataFormats/PatCandidates/interface/PackedCandidate.h" +#include "DataFormats/VertexReco/interface/VertexFwd.h" +#include "FWCore/Framework/interface/EDProducer.h" +#include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/EventSetup.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 + +// ------------------------------------------------------------------------------------------ +class PuppiProducer : public edm::stream::EDProducer<> { +public: + explicit PuppiProducer(const edm::ParameterSet&); + ~PuppiProducer() override; + + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + typedef math::XYZTLorentzVector LorentzVector; + typedef std::vector LorentzVectorCollection; + typedef reco::VertexCollection VertexCollection; + typedef edm::View CandidateView; + typedef std::vector PFInputCollection; + typedef std::vector PFOutputCollection; + typedef std::vector PackedOutputCollection; + typedef edm::View PFView; + typedef edm::Association CandToVertex; + +private: + virtual void beginJob(); + void produce(edm::Event&, const edm::EventSetup&) override; + virtual void endJob(); + + edm::EDGetTokenT tokenPFCandidates_; + edm::EDGetTokenT tokenVertices_; + edm::EDGetTokenT tokenVertexAssociation_; + edm::EDGetTokenT> tokenVertexAssociationQuality_; + edm::EDGetTokenT tokenPuppiContainer_; + edm::EDGetTokenT tokenPuppiCandidates_; + edm::EDGetTokenT tokenPackedPuppiCandidates_; + edm::EDGetTokenT puProxyValueToken_; + edm::EDPutTokenT> ptokenPupOut_; + edm::EDPutTokenT> ptokenP4PupOut_; + edm::EDPutTokenT> ptokenValues_; + edm::EDPutTokenT ptokenPackedPuppiCandidates_; + edm::EDPutTokenT ptokenPuppiCandidates_; + edm::EDPutTokenT ptokenNalgos_; + edm::EDPutTokenT> ptokenRawAlphas_; + edm::EDPutTokenT> ptokenAlphas_; + edm::EDPutTokenT> ptokenAlphasMed_; + edm::EDPutTokenT> ptokenAlphasRms_; + std::string fPuppiName; + std::string fPFName; + std::string fPVName; + bool fUseVertexAssociation; + int vertexAssociationQuality_; + bool fPuppiDiagnostics; + bool fPuppiNoLep; + bool fUseFromPVLooseTight; + bool fUseDZ; + double fDZCut; + double fEtaMinUseDZ; + double fPtMaxCharged; + double fEtaMaxCharged; + double fPtMaxPhotons; + double fEtaMaxPhotons; + uint fNumOfPUVtxsForCharged; + double fDZCutForChargedFromPUVtxs; + bool fUseExistingWeights; + bool fClonePackedCands; + int fVtxNdofCut; + double fVtxZCut; + bool fUsePUProxyValue; + std::unique_ptr fPuppiContainer; + std::vector fRecoObjCollection; +}; // ------------------------------------------------------------------------------------------ PuppiProducer::PuppiProducer(const edm::ParameterSet& iConfig) { @@ -41,6 +111,13 @@ PuppiProducer::PuppiProducer(const edm::ParameterSet& iConfig) { tokenPFCandidates_ = consumes(iConfig.getParameter("candName")); tokenVertices_ = consumes(iConfig.getParameter("vertexName")); + fUseVertexAssociation = iConfig.getParameter("useVertexAssociation"); + vertexAssociationQuality_ = iConfig.getParameter("vertexAssociationQuality"); + if (fUseVertexAssociation) { + tokenVertexAssociation_ = consumes(iConfig.getParameter("vertexAssociation")); + tokenVertexAssociationQuality_ = + consumes>(iConfig.getParameter("vertexAssociation")); + } fUsePUProxyValue = iConfig.getParameter("usePUProxyValue"); @@ -80,6 +157,13 @@ void PuppiProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { iEvent.getByToken(tokenVertices_, hVertexProduct); const reco::VertexCollection* pvCol = hVertexProduct.product(); + edm::Association associatedPV; + edm::ValueMap associationQuality; + if ((fUseVertexAssociation) && (!fUseExistingWeights)) { + associatedPV = iEvent.get(tokenVertexAssociation_); + associationQuality = iEvent.get(tokenVertexAssociationQuality_); + } + double puProxyValue = 0.; if (fUsePUProxyValue) { puProxyValue = iEvent.get(puProxyValueToken_); @@ -95,6 +179,7 @@ void PuppiProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { //Fill the reco objects fRecoObjCollection.clear(); fRecoObjCollection.reserve(pfCol->size()); + int iCand = 0; for (auto const& aPF : *pfCol) { RecoObj pReco; pReco.pt = aPF.pt(); @@ -110,7 +195,25 @@ void PuppiProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { uint pVtxId = 0; bool isLepton = ((std::abs(pReco.pdgId) == 11) || (std::abs(pReco.pdgId) == 13)); const pat::PackedCandidate* lPack = dynamic_cast(&aPF); - if (lPack == nullptr) { + + if (fUseVertexAssociation) { + const reco::VertexRef& PVOrig = associatedPV[reco::CandidatePtr(hPFProduct, iCand)]; + int quality = associationQuality[reco::CandidatePtr(hPFProduct, iCand)]; + if (PVOrig.isNonnull() && (quality >= vertexAssociationQuality_)) { + closestVtx = PVOrig.get(); + pVtxId = PVOrig.key(); + } + if (std::abs(pReco.charge) == 0) + pReco.id = 0; + else if (fPuppiNoLep && isLepton) + pReco.id = 3; + else if (closestVtx != nullptr && pVtxId == 0) + pReco.id = 1; // Associated to main vertex + else if (closestVtx != nullptr && pVtxId > 0) + pReco.id = 2; // Associated to PU + else + pReco.id = 0; // Unassociated + } else if (lPack == nullptr) { const reco::PFCandidate* pPF = dynamic_cast(&aPF); double curdz = 9999; int closestVtxForUnassociateds = -9999; @@ -230,6 +333,7 @@ void PuppiProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { } fRecoObjCollection.push_back(pReco); + iCand++; } fPuppiContainer->initialize(fRecoObjCollection); @@ -401,6 +505,9 @@ void PuppiProducer::fillDescriptions(edm::ConfigurationDescriptions& description desc.add("vtxZCut", 24); desc.add("candName", edm::InputTag("particleFlow")); desc.add("vertexName", edm::InputTag("offlinePrimaryVertices")); + desc.add("useVertexAssociation", false); + desc.add("vertexAssociationQuality", 0); + desc.add("vertexAssociation", edm::InputTag("")); desc.add("applyCHS", true); desc.add("invertPuppi", false); desc.add("useExp", false); diff --git a/CommonTools/PileupAlgos/plugins/PuppiProducer.h b/CommonTools/PileupAlgos/plugins/PuppiProducer.h deleted file mode 100644 index befcf4c6a7f0a..0000000000000 --- a/CommonTools/PileupAlgos/plugins/PuppiProducer.h +++ /dev/null @@ -1,82 +0,0 @@ -#ifndef CommonTools_Puppi_PuppiProducer_h_ -#define CommonTools_Puppi_PuppiProducer_h_ -// system include files -#include - -// user include files -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/stream/EDProducer.h" -#include "FWCore/Framework/interface/Event.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 "DataFormats/Math/interface/PtEtaPhiMass.h" -#include "DataFormats/Math/interface/LorentzVector.h" -#include "DataFormats/VertexReco/interface/VertexFwd.h" -#include "DataFormats/ParticleFlowCandidate/interface/PFCandidate.h" -#include "DataFormats/PatCandidates/interface/PackedCandidate.h" -#include "CommonTools/PileupAlgos/interface/PuppiContainer.h" -#include "CommonTools/PileupAlgos/interface/PuppiAlgo.h" - -// ------------------------------------------------------------------------------------------ -class PuppiProducer : public edm::stream::EDProducer<> { -public: - explicit PuppiProducer(const edm::ParameterSet&); - ~PuppiProducer() override; - - static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); - typedef math::XYZTLorentzVector LorentzVector; - typedef std::vector LorentzVectorCollection; - typedef reco::VertexCollection VertexCollection; - typedef edm::View CandidateView; - typedef std::vector PFInputCollection; - typedef std::vector PFOutputCollection; - typedef std::vector PackedOutputCollection; - typedef edm::View PFView; - -private: - virtual void beginJob(); - void produce(edm::Event&, const edm::EventSetup&) override; - virtual void endJob(); - - edm::EDGetTokenT tokenPFCandidates_; - edm::EDGetTokenT tokenVertices_; - edm::EDGetTokenT tokenPuppiContainer_; - edm::EDGetTokenT tokenPuppiCandidates_; - edm::EDGetTokenT tokenPackedPuppiCandidates_; - edm::EDGetTokenT puProxyValueToken_; - edm::EDPutTokenT> ptokenPupOut_; - edm::EDPutTokenT> ptokenP4PupOut_; - edm::EDPutTokenT> ptokenValues_; - edm::EDPutTokenT ptokenPackedPuppiCandidates_; - edm::EDPutTokenT ptokenPuppiCandidates_; - edm::EDPutTokenT ptokenNalgos_; - edm::EDPutTokenT> ptokenRawAlphas_; - edm::EDPutTokenT> ptokenAlphas_; - edm::EDPutTokenT> ptokenAlphasMed_; - edm::EDPutTokenT> ptokenAlphasRms_; - std::string fPuppiName; - std::string fPFName; - std::string fPVName; - bool fPuppiDiagnostics; - bool fPuppiNoLep; - bool fUseFromPVLooseTight; - bool fUseDZ; - double fDZCut; - double fEtaMinUseDZ; - double fPtMaxCharged; - double fEtaMaxCharged; - double fPtMaxPhotons; - double fEtaMaxPhotons; - uint fNumOfPUVtxsForCharged; - double fDZCutForChargedFromPUVtxs; - bool fUseExistingWeights; - bool fClonePackedCands; - int fVtxNdofCut; - double fVtxZCut; - bool fUsePUProxyValue; - std::unique_ptr fPuppiContainer; - std::vector fRecoObjCollection; -}; -#endif diff --git a/CommonTools/PileupAlgos/python/Puppi_cff.py b/CommonTools/PileupAlgos/python/Puppi_cff.py index 107aea9a49cab..9943d59afe49b 100644 --- a/CommonTools/PileupAlgos/python/Puppi_cff.py +++ b/CommonTools/PileupAlgos/python/Puppi_cff.py @@ -31,8 +31,9 @@ NumOfPUVtxsForCharged = 2, PtMaxCharged = 20., PtMaxNeutralsStartSlope = 20., - #candName = cms.string('packedPFCandidates'), - #vertexName = cms.string('offlineSlimmedPrimaryVertices'), + useVertexAssociation = True, + vertexAssociationQuality = 6, + vertexAssociation = ('primaryVertexAssociationJME','original'), clonePackedCands = False, # should only be set to True for MiniAOD algos = { 0: dict( @@ -96,10 +97,12 @@ ) ) +from Configuration.ProcessModifiers.pp_on_AA_cff import pp_on_AA +pp_on_AA.toModify(puppi, algos = []) +from Configuration.ProcessModifiers.run2_miniAOD_pp_on_AA_103X_cff import run2_miniAOD_pp_on_AA_103X +run2_miniAOD_pp_on_AA_103X.toModify(puppi,useVertexAssociation = False) # because the association is only run on cleanedParticleFlow + puppiNoLep = puppi.clone( puppiNoLep = True, PtMaxPhotons = 20. ) - -from Configuration.ProcessModifiers.pp_on_AA_cff import pp_on_AA -pp_on_AA.toModify(puppi, algos = []) diff --git a/CommonTools/PileupAlgos/test/recomputePuppiOnMiniAOD.py b/CommonTools/PileupAlgos/test/recomputePuppiOnMiniAOD.py new file mode 100644 index 0000000000000..8825604bf18c1 --- /dev/null +++ b/CommonTools/PileupAlgos/test/recomputePuppiOnMiniAOD.py @@ -0,0 +1,141 @@ +# Auto generated configuration file +# using: +# Revision: 1.19 +# Source: /local/reps/CMSSW/CMSSW/Configuration/Applications/python/ConfigBuilder.py,v +# with command line options: step5 --conditions auto:run2_mc --nThreads 2 -n 10 --era Run2_2016 --eventcontent MINIAODSIM --filein file:step3_inMINIAODSIM.root -s NANO --datatier NANOAODSIM --mc --fileout file:step5.root +import FWCore.ParameterSet.Config as cms + +from Configuration.Eras.Era_Run2_2016_cff import Run2_2016 + +process = cms.Process('NANO',Run2_2016) + +# import of standard configurations +process.load('Configuration.StandardSequences.Services_cff') +process.load('SimGeneral.HepPDTESSource.pythiapdt_cfi') +process.load('FWCore.MessageService.MessageLogger_cfi') +process.load('Configuration.EventContent.EventContent_cff') +process.load('SimGeneral.MixingModule.mixNoPU_cfi') +process.load('Configuration.StandardSequences.GeometryRecoDB_cff') +process.load('Configuration.StandardSequences.MagneticField_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("PoolSource", + fileNames = cms.untracked.vstring('file:/afs/cern.ch/user/h/hinzmann/stable_13TeV/jetmet/mtd/CMSSW_12_0_0_pre3/src/25202.0_TTbar_13+TTbar_13+DIGIUP15_PU25+RECOUP15_PU25+HARVESTUP15_PU25+NANOUP15_PU25/step3_inMINIAODSIM.root'), + secondaryFileNames = cms.untracked.vstring() +) + +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( + + ), + 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('step5 nevts:10'), + name = cms.untracked.string('Applications'), + version = cms.untracked.string('$Revision: 1.19 $') +) + +# Output definition + +process.MINIAODSIMoutput = cms.OutputModule("PoolOutputModule", + compressionAlgorithm = cms.untracked.string('LZMA'), + compressionLevel = cms.untracked.int32(9), + dataset = cms.untracked.PSet( + dataTier = cms.untracked.string('MINIAODSIM'), + filterName = cms.untracked.string('') + ), + fileName = cms.untracked.string('file:updatedMINIAODSIM.root'), + outputCommands = process.MINIAODSIMEventContent.outputCommands +) + +# Additional output definition + +# Other statements +from Configuration.AlCa.GlobalTag import GlobalTag +process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:run2_mc', '') + +# Rerun PUPPI MET and ak4 jets (but not ak8) +from PhysicsTools.PatAlgos.tools.helpers import getPatAlgosToolsTask, addToProcessAndTask +task = getPatAlgosToolsTask(process) +from PhysicsTools.PatAlgos.slimming.puppiForMET_cff import makePuppiesFromMiniAOD +makePuppiesFromMiniAOD(process,True) +process.puppi.useExistingWeights = False +process.puppiNoLep.useExistingWeights = False +from PhysicsTools.PatUtils.tools.runMETCorrectionsAndUncertainties import runMetCorAndUncFromMiniAOD +runMetCorAndUncFromMiniAOD(process,isData=False,metType="Puppi",postfix="Puppi",jetFlavor="AK4PFPuppi",recoMetFromPFCs=True) +from PhysicsTools.PatAlgos.patPuppiJetSpecificProducer_cfi import patPuppiJetSpecificProducer +addToProcessAndTask('patPuppiJetSpecificProducer', patPuppiJetSpecificProducer.clone(src=cms.InputTag("patJetsPuppi")), process, task) +from PhysicsTools.PatAlgos.tools.jetTools import updateJetCollection +updateJetCollection( + process, + labelName = 'PuppiJetSpecific', + jetSource = cms.InputTag('patJetsPuppi'), +) +process.updatedPatJetsPuppiJetSpecific.userData.userFloats.src = ['patPuppiJetSpecificProducer:puppiMultiplicity', 'patPuppiJetSpecificProducer:neutralPuppiMultiplicity', 'patPuppiJetSpecificProducer:neutralHadronPuppiMultiplicity', 'patPuppiJetSpecificProducer:photonPuppiMultiplicity', 'patPuppiJetSpecificProducer:HFHadronPuppiMultiplicity', 'patPuppiJetSpecificProducer:HFEMPuppiMultiplicity' ] +addToProcessAndTask('slimmedJetsPuppi', process.updatedPatJetsPuppiJetSpecific.clone(), process, task) +del process.updatedPatJetsPuppiJetSpecific +process.puppiSequence = cms.Sequence(process.puppiMETSequence+process.fullPatMetSequencePuppi+process.patPuppiJetSpecificProducer+process.slimmedJetsPuppi) + +# Example how to not use vertex fit for track-vertex-association, but only dz +#process.packedPrimaryVertexAssociationJME.assignment.useVertexFit = False +#process.packedPrimaryVertexAssociationJME.assignment.maxDzSigForPrimaryAssignment = 5.0 +#process.packedPrimaryVertexAssociationJME.assignment.maxDzForPrimaryAssignment = 0.1 +#process.packedPrimaryVertexAssociationJME.assignment.maxDzErrorForPrimaryAssignment = 0.05 +#process.packedPrimaryVertexAssociationJME.assignment.OnlyUseFirstDz = False +#process.pfCHS.vertexAssociationQuality = 6 + +# Path and EndPath definitions +process.puppi_step = cms.Path(process.puppiSequence) +process.endjob_step = cms.EndPath(process.endOfProcess) +process.MINIAODSIMoutput_step = cms.EndPath(process.MINIAODSIMoutput) + +# Schedule definition +process.schedule = cms.Schedule(process.puppi_step,process.endjob_step,process.MINIAODSIMoutput_step) +from PhysicsTools.PatAlgos.tools.helpers import associatePatAlgosToolsTask +associatePatAlgosToolsTask(process) + +#Setup FWK for multithreaded +process.options.numberOfThreads=cms.untracked.uint32(2) +process.options.numberOfStreams=cms.untracked.uint32(0) +process.options.numberOfConcurrentLuminosityBlocks=cms.untracked.uint32(1) + +# customisation of the process. + +# End of customisation functions + +# 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/CommonTools/RecoAlgos/interface/GsfElectronSelector.h b/CommonTools/RecoAlgos/interface/GsfElectronSelector.h index f83299cbb8daf..85592bb314d4c 100644 --- a/CommonTools/RecoAlgos/interface/GsfElectronSelector.h +++ b/CommonTools/RecoAlgos/interface/GsfElectronSelector.h @@ -19,7 +19,7 @@ #include "DataFormats/GsfTrackReco/interface/GsfTrack.h" #include "DataFormats/GsfTrackReco/interface/GsfTrackExtra.h" #include "DataFormats/TrackingRecHit/interface/TrackingRecHit.h" -#include "CommonTools/UtilAlgos/interface/ObjectSelector.h" +#include "CommonTools/UtilAlgos/interface/SingleObjectSelector.h" namespace helper { struct GsfElectronCollectionStoreManager { @@ -108,7 +108,7 @@ namespace helper { std::unique_ptr selHits_; }; - class GsfElectronSelectorBase : public edm::EDFilter { + class GsfElectronSelectorBase : public edm::stream::EDFilter<> { public: GsfElectronSelectorBase(const edm::ParameterSet& cfg) { std::string alias(cfg.getParameter("@module_label")); @@ -122,11 +122,26 @@ namespace helper { } }; - template <> - struct StoreManagerTrait { + struct GsfElectronCollectionStoreManagerTrait { typedef GsfElectronCollectionStoreManager type; typedef GsfElectronSelectorBase base; }; + } // namespace helper +template ::type, + typename StoreContainer = typename ::helper::StoreContainerTrait::type, + typename PostProcessor = ::helper::NullPostProcessor > +using GsfElectronSingleObjectSelector = SingleObjectSelectorBase; + #endif diff --git a/CommonTools/RecoAlgos/interface/PrimaryVertexAssignment.h b/CommonTools/RecoAlgos/interface/PrimaryVertexAssignment.h index da7626850313e..011ee2ecee2d2 100644 --- a/CommonTools/RecoAlgos/interface/PrimaryVertexAssignment.h +++ b/CommonTools/RecoAlgos/interface/PrimaryVertexAssignment.h @@ -12,6 +12,7 @@ #include "DataFormats/Candidate/interface/Candidate.h" #include "DataFormats/ParticleFlowCandidate/interface/PFCandidateFwd.h" #include "DataFormats/ParticleFlowCandidate/interface/PFCandidate.h" +#include "DataFormats/PatCandidates/interface/PackedCandidate.h" #include "DataFormats/VertexReco/interface/VertexFwd.h" #include "TrackingTools/TransientTrack/interface/TransientTrackBuilder.h" @@ -41,7 +42,13 @@ class PrimaryVertexAssignment { maxDxySigForNotReconstructedPrimary_(iConfig.getParameter("maxDxySigForNotReconstructedPrimary")), maxDxyForNotReconstructedPrimary_(iConfig.getParameter("maxDxyForNotReconstructedPrimary")), useTiming_(iConfig.getParameter("useTiming")), - preferHighRanked_(iConfig.getParameter("preferHighRanked")) {} + useVertexFit_(iConfig.getParameter("useVertexFit")), + preferHighRanked_(iConfig.getParameter("preferHighRanked")), + fNumOfPUVtxsForCharged_(iConfig.getParameter("NumOfPUVtxsForCharged")), + fDzCutForChargedFromPUVtxs_(iConfig.getParameter("DzCutForChargedFromPUVtxs")), + fPtMaxCharged_(iConfig.getParameter("PtMaxCharged")), + fEtaMinUseDz_(iConfig.getParameter("EtaMinUseDz")), + fOnlyUseFirstDz_(iConfig.getParameter("OnlyUseFirstDz")) {} ~PrimaryVertexAssignment() {} @@ -54,6 +61,15 @@ class PrimaryVertexAssignment { const edm::View& jets, const TransientTrackBuilder& builder) const; + std::pair chargedHadronVertex( + const reco::VertexCollection& vertices, + int iVertex, + const reco::Track* track, + float trackTime, + float trackTimeResolution, // <0 if timing not available for this object + const edm::View& jets, + const TransientTrackBuilder& builder) const; + std::pair chargedHadronVertex( const reco::VertexCollection& vertices, const reco::TrackRef& trackRef, @@ -75,13 +91,38 @@ class PrimaryVertexAssignment { } if (pfcand.gsfTrackRef().isNull()) { if (pfcand.trackRef().isNull()) - return std::pair(-1, PrimaryVertexAssignment::Unassigned); + return {-1, PrimaryVertexAssignment::Unassigned}; else return chargedHadronVertex(vertices, pfcand.trackRef(), time, timeResolution, jets, builder); } return chargedHadronVertex( vertices, reco::TrackRef(), &(*pfcand.gsfTrackRef()), time, timeResolution, jets, builder); } + + std::pair chargedHadronVertex(const reco::VertexCollection& vertices, + const pat::PackedCandidate& pfcand, + const edm::View& jets, + const TransientTrackBuilder& builder) const { + float time = 0, timeResolution = -1; + if (useTiming_ && pfcand.timeError() > 0) { + time = pfcand.time(); + timeResolution = pfcand.timeError(); + } + if (!pfcand.hasTrackDetails()) + return {-1, PrimaryVertexAssignment::Unassigned}; + else + return chargedHadronVertex( + vertices, + (useVertexFit_ && (pfcand.pvAssociationQuality() >= pat::PackedCandidate::UsedInFitLoose)) + ? pfcand.vertexRef().key() + : -1, + &pfcand.pseudoTrack(), + time, + timeResolution, + jets, + builder); + } + std::pair chargedHadronVertex(const reco::VertexCollection& vertices, const reco::RecoChargedRefCandidate& chcand, const edm::ValueMap* trackTimeTag, @@ -94,7 +135,7 @@ class PrimaryVertexAssignment { timeResolution = (*trackTimeResoTag)[chcand.track()]; } if (chcand.track().isNull()) - return std::pair(-1, PrimaryVertexAssignment::Unassigned); + return {-1, PrimaryVertexAssignment::Unassigned}; return chargedHadronVertex(vertices, chcand.track(), time, timeResolution, jets, builder); } @@ -111,7 +152,13 @@ class PrimaryVertexAssignment { double maxDxySigForNotReconstructedPrimary_; double maxDxyForNotReconstructedPrimary_; bool useTiming_; + bool useVertexFit_; bool preferHighRanked_; + int fNumOfPUVtxsForCharged_; + double fDzCutForChargedFromPUVtxs_; + double fPtMaxCharged_; + double fEtaMinUseDz_; + bool fOnlyUseFirstDz_; }; #endif diff --git a/CommonTools/RecoAlgos/plugins/CaloJetShallowCloneProducer.cc b/CommonTools/RecoAlgos/plugins/CaloJetShallowCloneProducer.cc deleted file mode 100644 index a6fa0206970cc..0000000000000 --- a/CommonTools/RecoAlgos/plugins/CaloJetShallowCloneProducer.cc +++ /dev/null @@ -1,8 +0,0 @@ -#include "DataFormats/JetReco/interface/CaloJet.h" -#include "CommonTools/CandAlgos/interface/ShallowCloneProducer.h" - -typedef ShallowCloneProducer CaloJetShallowCloneProducer; - -#include "FWCore/Framework/interface/MakerMacros.h" - -DEFINE_FWK_MODULE(CaloJetShallowCloneProducer); diff --git a/CommonTools/RecoAlgos/plugins/CaloMETShallowCloneProducer.cc b/CommonTools/RecoAlgos/plugins/CaloMETShallowCloneProducer.cc deleted file mode 100644 index 2be9da4048dff..0000000000000 --- a/CommonTools/RecoAlgos/plugins/CaloMETShallowCloneProducer.cc +++ /dev/null @@ -1,10 +0,0 @@ -#include "DataFormats/EgammaCandidates/interface/ElectronFwd.h" -#include "DataFormats/METReco/interface/CaloMET.h" -#include "DataFormats/METReco/interface/CaloMETCollection.h" -#include "CommonTools/CandAlgos/interface/ShallowCloneProducer.h" - -typedef ShallowCloneProducer CaloMETShallowCloneProducer; - -#include "FWCore/Framework/interface/MakerMacros.h" - -DEFINE_FWK_MODULE(CaloMETShallowCloneProducer); diff --git a/CommonTools/RecoAlgos/plugins/ElectronShallowCloneProducer.cc b/CommonTools/RecoAlgos/plugins/ElectronShallowCloneProducer.cc deleted file mode 100644 index 8a37e780985f3..0000000000000 --- a/CommonTools/RecoAlgos/plugins/ElectronShallowCloneProducer.cc +++ /dev/null @@ -1,9 +0,0 @@ -#include "DataFormats/EgammaCandidates/interface/Electron.h" -#include "DataFormats/EgammaCandidates/interface/ElectronFwd.h" -#include "CommonTools/CandAlgos/interface/ShallowCloneProducer.h" - -typedef ShallowCloneProducer ElectronShallowCloneProducer; - -#include "FWCore/Framework/interface/MakerMacros.h" - -DEFINE_FWK_MODULE(ElectronShallowCloneProducer); diff --git a/CommonTools/RecoAlgos/plugins/EtaPtMinGsfElectronFullCloneSelector.cc b/CommonTools/RecoAlgos/plugins/EtaPtMinGsfElectronFullCloneSelector.cc index 5ac73950354fc..e9926946439ad 100644 --- a/CommonTools/RecoAlgos/plugins/EtaPtMinGsfElectronFullCloneSelector.cc +++ b/CommonTools/RecoAlgos/plugins/EtaPtMinGsfElectronFullCloneSelector.cc @@ -15,7 +15,7 @@ #include "DataFormats/EgammaCandidates/interface/GsfElectronFwd.h" #include "CommonTools/RecoAlgos/interface/GsfElectronSelector.h" -typedef SingleObjectSelector > +typedef GsfElectronSingleObjectSelector > EtaPtMinGsfElectronFullCloneSelector; DEFINE_FWK_MODULE(EtaPtMinGsfElectronFullCloneSelector); diff --git a/CommonTools/RecoAlgos/plugins/EtaPtMinPixelMatchGsfElectronFullCloneSelector.cc b/CommonTools/RecoAlgos/plugins/EtaPtMinPixelMatchGsfElectronFullCloneSelector.cc index 6723c17f8fce3..db7154f2255be 100644 --- a/CommonTools/RecoAlgos/plugins/EtaPtMinPixelMatchGsfElectronFullCloneSelector.cc +++ b/CommonTools/RecoAlgos/plugins/EtaPtMinPixelMatchGsfElectronFullCloneSelector.cc @@ -15,7 +15,7 @@ #include "DataFormats/EgammaCandidates/interface/GsfElectronFwd.h" #include "CommonTools/RecoAlgos/interface/GsfElectronSelector.h" -typedef SingleObjectSelector > +typedef GsfElectronSingleObjectSelector > EtaPtMinPixelMatchGsfElectronFullCloneSelector; DEFINE_FWK_MODULE(EtaPtMinPixelMatchGsfElectronFullCloneSelector); diff --git a/CommonTools/RecoAlgos/plugins/GenJetShallowCloneProducer.cc b/CommonTools/RecoAlgos/plugins/GenJetShallowCloneProducer.cc deleted file mode 100644 index 94e50ddc9b3c2..0000000000000 --- a/CommonTools/RecoAlgos/plugins/GenJetShallowCloneProducer.cc +++ /dev/null @@ -1,8 +0,0 @@ -#include "DataFormats/JetReco/interface/GenJet.h" -#include "CommonTools/CandAlgos/interface/ShallowCloneProducer.h" - -typedef ShallowCloneProducer GenJetShallowCloneProducer; - -#include "FWCore/Framework/interface/MakerMacros.h" - -DEFINE_FWK_MODULE(GenJetShallowCloneProducer); diff --git a/CommonTools/RecoAlgos/plugins/GenMETShallowCloneProducer.cc b/CommonTools/RecoAlgos/plugins/GenMETShallowCloneProducer.cc deleted file mode 100644 index 1186417dc670b..0000000000000 --- a/CommonTools/RecoAlgos/plugins/GenMETShallowCloneProducer.cc +++ /dev/null @@ -1,9 +0,0 @@ -#include "DataFormats/METReco/interface/GenMET.h" -#include "DataFormats/METReco/interface/GenMETCollection.h" -#include "CommonTools/CandAlgos/interface/ShallowCloneProducer.h" - -typedef ShallowCloneProducer GenMETShallowCloneProducer; - -#include "FWCore/Framework/interface/MakerMacros.h" - -DEFINE_FWK_MODULE(GenMETShallowCloneProducer); diff --git a/CommonTools/RecoAlgos/plugins/GsfElectronShallowCloneProducer.cc b/CommonTools/RecoAlgos/plugins/GsfElectronShallowCloneProducer.cc deleted file mode 100644 index e1dcc23e0c8e0..0000000000000 --- a/CommonTools/RecoAlgos/plugins/GsfElectronShallowCloneProducer.cc +++ /dev/null @@ -1,9 +0,0 @@ -#include "DataFormats/EgammaCandidates/interface/GsfElectron.h" -#include "DataFormats/EgammaCandidates/interface/GsfElectronFwd.h" -#include "CommonTools/CandAlgos/interface/ShallowCloneProducer.h" - -typedef ShallowCloneProducer PixelMatchGsfElectronShallowCloneProducer; - -#include "FWCore/Framework/interface/MakerMacros.h" - -DEFINE_FWK_MODULE(PixelMatchGsfElectronShallowCloneProducer); diff --git a/CommonTools/RecoAlgos/plugins/LargestEtCaloJetSelector.cc b/CommonTools/RecoAlgos/plugins/LargestEtCaloJetSelector.cc index da5abccfcb263..286be27c34f7f 100644 --- a/CommonTools/RecoAlgos/plugins/LargestEtCaloJetSelector.cc +++ b/CommonTools/RecoAlgos/plugins/LargestEtCaloJetSelector.cc @@ -6,12 +6,12 @@ * */ #include "FWCore/Framework/interface/MakerMacros.h" -#include "CommonTools/UtilAlgos/interface/ObjectSelectorStream.h" +#include "CommonTools/UtilAlgos/interface/ObjectSelector.h" #include "CommonTools/UtilAlgos/interface/SortCollectionSelector.h" #include "DataFormats/JetReco/interface/CaloJet.h" #include "CommonTools/Utils/interface/EtComparator.h" -typedef ObjectSelectorStream > > +typedef ObjectSelector > > LargestEtCaloJetSelector; DEFINE_FWK_MODULE(LargestEtCaloJetSelector); diff --git a/CommonTools/RecoAlgos/plugins/LargestEtPFJetSelector.cc b/CommonTools/RecoAlgos/plugins/LargestEtPFJetSelector.cc index 8e3517e9f0e04..f9cbc44e6df2a 100644 --- a/CommonTools/RecoAlgos/plugins/LargestEtPFJetSelector.cc +++ b/CommonTools/RecoAlgos/plugins/LargestEtPFJetSelector.cc @@ -6,12 +6,11 @@ * */ #include "FWCore/Framework/interface/MakerMacros.h" -#include "CommonTools/UtilAlgos/interface/ObjectSelectorStream.h" +#include "CommonTools/UtilAlgos/interface/ObjectSelector.h" #include "CommonTools/UtilAlgos/interface/SortCollectionSelector.h" #include "DataFormats/JetReco/interface/PFJet.h" #include "CommonTools/Utils/interface/EtComparator.h" -typedef ObjectSelectorStream > > - LargestEtPFJetSelector; +typedef ObjectSelector > > LargestEtPFJetSelector; DEFINE_FWK_MODULE(LargestEtPFJetSelector); diff --git a/CommonTools/RecoAlgos/plugins/MuonShallowCloneProducer.cc b/CommonTools/RecoAlgos/plugins/MuonShallowCloneProducer.cc deleted file mode 100644 index 0f4c2456415c9..0000000000000 --- a/CommonTools/RecoAlgos/plugins/MuonShallowCloneProducer.cc +++ /dev/null @@ -1,9 +0,0 @@ -#include "DataFormats/MuonReco/interface/Muon.h" -#include "DataFormats/MuonReco/interface/MuonFwd.h" -#include "CommonTools/CandAlgos/interface/ShallowCloneProducer.h" - -typedef ShallowCloneProducer MuonShallowCloneProducer; - -#include "FWCore/Framework/interface/MakerMacros.h" - -DEFINE_FWK_MODULE(MuonShallowCloneProducer); diff --git a/CommonTools/RecoAlgos/plugins/PrimaryVertexSorter.cc b/CommonTools/RecoAlgos/plugins/PrimaryVertexSorter.cc index c9dad79418207..b019100fa3e3b 100644 --- a/CommonTools/RecoAlgos/plugins/PrimaryVertexSorter.cc +++ b/CommonTools/RecoAlgos/plugins/PrimaryVertexSorter.cc @@ -6,3 +6,5 @@ typedef PrimaryVertexSorter > RecoCha DEFINE_FWK_MODULE(RecoChargedRefCandidatePrimaryVertexSorter); typedef PrimaryVertexSorter > PFCandidatePrimaryVertexSorter; DEFINE_FWK_MODULE(PFCandidatePrimaryVertexSorter); +typedef PrimaryVertexSorter > PackedCandidatePrimaryVertexSorter; +DEFINE_FWK_MODULE(PackedCandidatePrimaryVertexSorter); diff --git a/CommonTools/RecoAlgos/plugins/PrimaryVertexSorter.h b/CommonTools/RecoAlgos/plugins/PrimaryVertexSorter.h index 300ce6cb2c14b..e4e8e5b98cc4e 100644 --- a/CommonTools/RecoAlgos/plugins/PrimaryVertexSorter.h +++ b/CommonTools/RecoAlgos/plugins/PrimaryVertexSorter.h @@ -20,6 +20,7 @@ #include "CommonTools/RecoAlgos/interface/PrimaryVertexAssignment.h" #include "CommonTools/RecoAlgos/interface/PrimaryVertexSorting.h" +#include "DataFormats/PatCandidates/interface/PackedCandidate.h" /**\class PrimaryVertexSorter * \author Andrea Rizzi @@ -311,6 +312,10 @@ template <> inline void PrimaryVertexSorter>::doConsumesForTiming(const edm::ParameterSet& iConfig) { } +template <> +inline void PrimaryVertexSorter>::doConsumesForTiming( + const edm::ParameterSet& iConfig) {} + template <> inline bool PrimaryVertexSorter>::needsProductsForTiming() { return true; @@ -321,6 +326,11 @@ inline bool PrimaryVertexSorter>::needsProductsFo return false; } +template <> +inline bool PrimaryVertexSorter>::needsProductsForTiming() { + return false; +} + template <> inline std::pair PrimaryVertexSorter>::runAlgo(const reco::VertexCollection& vertices, @@ -343,4 +353,15 @@ inline std::pair PrimaryVertexSorter +inline std::pair PrimaryVertexSorter>::runAlgo( + const reco::VertexCollection& vertices, + const pat::PackedCandidate& pf, + const edm::ValueMap* trackTimeTag, + const edm::ValueMap* trackTimeResoTag, + const edm::View& jets, + const TransientTrackBuilder& builder) { + return assignmentAlgo_.chargedHadronVertex(vertices, pf, jets, builder); +} + #endif diff --git a/CommonTools/CandAlgos/interface/ShallowCloneProducer.h b/CommonTools/RecoAlgos/plugins/ShallowCloneProducer.cc similarity index 51% rename from CommonTools/CandAlgos/interface/ShallowCloneProducer.h rename to CommonTools/RecoAlgos/plugins/ShallowCloneProducer.cc index 7deaaf9e38365..900e143d56843 100644 --- a/CommonTools/CandAlgos/interface/ShallowCloneProducer.h +++ b/CommonTools/RecoAlgos/plugins/ShallowCloneProducer.cc @@ -1,5 +1,3 @@ -#ifndef CandAlgos_ShallowCloneProducer_h -#define CandAlgos_ShallowCloneProducer_h /** \class ShallowCloneProducer * * Clones a concrete Candidate collection @@ -13,11 +11,12 @@ * - C : Concrete candidate collection type * */ + +#include "DataFormats/Candidate/interface/ShallowCloneCandidate.h" #include "FWCore/Framework/interface/EDProducer.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/Utilities/interface/InputTag.h" -#include "DataFormats/Candidate/interface/ShallowCloneCandidate.h" template class ShallowCloneProducer : public edm::EDProducer { @@ -55,4 +54,33 @@ void ShallowCloneProducer::produce(edm::Event& evt, const edm::EventSetup&) { evt.put(std::move(coll)); } -#endif +#include "DataFormats/EgammaCandidates/interface/Electron.h" +#include "DataFormats/EgammaCandidates/interface/ElectronFwd.h" +#include "DataFormats/EgammaCandidates/interface/GsfElectron.h" +#include "DataFormats/EgammaCandidates/interface/GsfElectronFwd.h" +#include "DataFormats/JetReco/interface/CaloJet.h" +#include "DataFormats/JetReco/interface/GenJet.h" +#include "DataFormats/METReco/interface/CaloMET.h" +#include "DataFormats/METReco/interface/CaloMETCollection.h" +#include "DataFormats/METReco/interface/GenMET.h" +#include "DataFormats/METReco/interface/GenMETCollection.h" +#include "DataFormats/MuonReco/interface/Muon.h" +#include "DataFormats/MuonReco/interface/MuonFwd.h" + +typedef ShallowCloneProducer GenMETShallowCloneProducer; +typedef ShallowCloneProducer PixelMatchGsfElectronShallowCloneProducer; +typedef ShallowCloneProducer MuonShallowCloneProducer; +typedef ShallowCloneProducer CaloMETShallowCloneProducer; +typedef ShallowCloneProducer ElectronShallowCloneProducer; +typedef ShallowCloneProducer GenJetShallowCloneProducer; +typedef ShallowCloneProducer CaloJetShallowCloneProducer; + +#include "FWCore/Framework/interface/MakerMacros.h" + +DEFINE_FWK_MODULE(GenMETShallowCloneProducer); +DEFINE_FWK_MODULE(PixelMatchGsfElectronShallowCloneProducer); +DEFINE_FWK_MODULE(MuonShallowCloneProducer); +DEFINE_FWK_MODULE(CaloMETShallowCloneProducer); +DEFINE_FWK_MODULE(ElectronShallowCloneProducer); +DEFINE_FWK_MODULE(GenJetShallowCloneProducer); +DEFINE_FWK_MODULE(CaloJetShallowCloneProducer); diff --git a/PhysicsTools/PatAlgos/python/slimming/primaryVertexAssociation_cfi.py b/CommonTools/RecoAlgos/python/primaryVertexAssociation_cfi.py similarity index 100% rename from PhysicsTools/PatAlgos/python/slimming/primaryVertexAssociation_cfi.py rename to CommonTools/RecoAlgos/python/primaryVertexAssociation_cfi.py diff --git a/CommonTools/RecoAlgos/python/sortedPFPrimaryVertices_cfi.py b/CommonTools/RecoAlgos/python/sortedPFPrimaryVertices_cfi.py index ef8876b177ebf..1e446422fb1e1 100644 --- a/CommonTools/RecoAlgos/python/sortedPFPrimaryVertices_cfi.py +++ b/CommonTools/RecoAlgos/python/sortedPFPrimaryVertices_cfi.py @@ -18,7 +18,15 @@ maxDxySigForNotReconstructedPrimary = cms.double(2), #in AND with next maxDxyForNotReconstructedPrimary = cms.double(0.01), #in AND with prev useTiming = cms.bool(False), - preferHighRanked = cms.bool(False) + useVertexFit = cms.bool(True), + preferHighRanked = cms.bool(False), + + #options used in PUPPI + NumOfPUVtxsForCharged = cms.int32(-1), + DzCutForChargedFromPUVtxs = cms.double(0.2), + PtMaxCharged = cms.double(-1), + EtaMinUseDz = cms.double(-1), + OnlyUseFirstDz = cms.bool(False), ), particles = cms.InputTag("particleFlow"), vertices= cms.InputTag("offlinePrimaryVertices"), @@ -31,4 +39,3 @@ produceNoPileUpCollection = cms.bool(True), ) - diff --git a/CommonTools/RecoAlgos/python/sortedPackedPrimaryVertices_cfi.py b/CommonTools/RecoAlgos/python/sortedPackedPrimaryVertices_cfi.py new file mode 100644 index 0000000000000..9a9b171db5bf4 --- /dev/null +++ b/CommonTools/RecoAlgos/python/sortedPackedPrimaryVertices_cfi.py @@ -0,0 +1,15 @@ +import FWCore.ParameterSet.Config as cms +from CommonTools.RecoAlgos.sortedPFPrimaryVertices_cfi import sortedPFPrimaryVertices +sortedPackedPrimaryVertices = cms.EDProducer("PackedCandidatePrimaryVertexSorter", + sorting = cms.PSet(), + assignment = sortedPFPrimaryVertices.assignment, + particles = cms.InputTag("packedPFCandidates"), + vertices= cms.InputTag("offlineSlimmedPrimaryVertices"), + jets= cms.InputTag("slimmedJets"), + qualityForPrimary = cms.int32(3), + usePVMET = cms.bool(True), + produceAssociationToOriginalVertices = cms.bool(True), + produceSortedVertices = cms.bool(True), + producePileUpCollection = cms.bool(True), + produceNoPileUpCollection = cms.bool(True), +) diff --git a/CommonTools/RecoAlgos/python/sortedPrimaryVertices_cfi.py b/CommonTools/RecoAlgos/python/sortedPrimaryVertices_cfi.py index e2d877bf93292..57be0713ca862 100644 --- a/CommonTools/RecoAlgos/python/sortedPrimaryVertices_cfi.py +++ b/CommonTools/RecoAlgos/python/sortedPrimaryVertices_cfi.py @@ -18,7 +18,15 @@ maxDxySigForNotReconstructedPrimary = cms.double(2), #in AND with next maxDxyForNotReconstructedPrimary = cms.double(0.01), #in AND with prev useTiming = cms.bool(False), + useVertexFit = cms.bool(True), preferHighRanked = cms.bool(False), + + #options used in PUPPI + NumOfPUVtxsForCharged = cms.int32(-1), + DzCutForChargedFromPUVtxs = cms.double(0.2), + PtMaxCharged = cms.double(-1), + EtaMinUseDz = cms.double(-1), + OnlyUseFirstDz = cms.bool(False), ), particles = cms.InputTag("trackRefsForJets"), trackTimeTag = cms.InputTag(""), diff --git a/CommonTools/RecoAlgos/src/PrimaryVertexAssignment.cc b/CommonTools/RecoAlgos/src/PrimaryVertexAssignment.cc index 83ca81b2679fe..230a336d4d4e3 100644 --- a/CommonTools/RecoAlgos/src/PrimaryVertexAssignment.cc +++ b/CommonTools/RecoAlgos/src/PrimaryVertexAssignment.cc @@ -28,6 +28,19 @@ std::pair PrimaryVertexAssignment::charge } index++; } + return chargedHadronVertex(vertices, iVertex, track, time, timeReso, jets, builder); +} + +std::pair PrimaryVertexAssignment::chargedHadronVertex( + const reco::VertexCollection& vertices, + int iVertex, + const reco::Track* track, + float time, + float timeReso, // <0 if timing not available for this object + const edm::View& jets, + const TransientTrackBuilder& builder) const { + typedef reco::VertexCollection::const_iterator IV; + typedef reco::Vertex::trackRef_iterator IT; bool useTime = useTiming_; if (edm::isNotFinite(time) || timeReso < 1e-6) { @@ -39,8 +52,8 @@ std::pair PrimaryVertexAssignment::charge if (preferHighRanked_) { for (IV iv = vertices.begin(); iv != vertices.end(); ++iv) { int ivtx = iv - vertices.begin(); - if (iVertex == ivtx) - return std::pair(ivtx, PrimaryVertexAssignment::UsedInFit); + if (useVertexFit_ && (iVertex == ivtx)) + return {ivtx, PrimaryVertexAssignment::UsedInFit}; double dz = std::abs(track->dz(iv->position())); double dt = std::abs(time - iv->t()); @@ -49,13 +62,21 @@ std::pair PrimaryVertexAssignment::charge if ((dz < maxDzForPrimaryAssignment_ or dz / track->dzError() < maxDzSigForPrimaryAssignment_) and (!useTimeVtx or dt / timeReso < maxDtSigForPrimaryAssignment_)) { - return std::pair(ivtx, PrimaryVertexAssignment::PrimaryDz); + return {ivtx, PrimaryVertexAssignment::PrimaryDz}; } } } - if (iVertex >= 0) - return std::pair(iVertex, PrimaryVertexAssignment::UsedInFit); + double firstVertexDz = std::numeric_limits::max(); + if (!vertices.empty()) + firstVertexDz = std::abs(track->dz(vertices.at(0).position())); + // recover cases where the primary vertex is split + if (useVertexFit_ && (iVertex > 0) && (iVertex <= fNumOfPUVtxsForCharged_) && + firstVertexDz < fDzCutForChargedFromPUVtxs_) + return {0, PrimaryVertexAssignment::PrimaryDz}; + + if (useVertexFit_ && (iVertex >= 0)) + return {iVertex, PrimaryVertexAssignment::UsedInFit}; double distmin = std::numeric_limits::max(); double dzmin = std::numeric_limits::max(); @@ -86,30 +107,45 @@ std::pair PrimaryVertexAssignment::charge } } - // first use "closest in Z" with tight cuts (targetting primary particles) - const float add_cov = vtxIdMinSignif >= 0 ? vertices[vtxIdMinSignif].covariance(2, 2) : 0.f; - const float dzE = sqrt(track->dzError() * track->dzError() + add_cov); - if (vtxIdMinSignif >= 0 and - (dzmin < maxDzForPrimaryAssignment_ and dzmin / dzE < maxDzSigForPrimaryAssignment_ and - track->dzError() < maxDzErrorForPrimaryAssignment_) and - (!useTime or dtmin / timeReso < maxDtSigForPrimaryAssignment_)) { - iVertex = vtxIdMinSignif; + // protect high pT particles from association to pileup vertices and assign them to the first vertex + if ((fPtMaxCharged_ > 0) && (vtxIdMinSignif >= 0) && (track->pt() > fPtMaxCharged_)) { + iVertex = 0; + } else { + // first use "closest in Z" with tight cuts (targetting primary particles) + const float add_cov = vtxIdMinSignif >= 0 ? vertices[vtxIdMinSignif].covariance(2, 2) : 0.f; + const float dzE = sqrt(track->dzError() * track->dzError() + add_cov); + if (!fOnlyUseFirstDz_) { + if (vtxIdMinSignif >= 0 and + (dzmin < maxDzForPrimaryAssignment_ and dzmin / dzE < maxDzSigForPrimaryAssignment_ and + track->dzError() < maxDzErrorForPrimaryAssignment_) and + (!useTime or dtmin / timeReso < maxDtSigForPrimaryAssignment_)) + iVertex = vtxIdMinSignif; + } else { + // consider only distances to first vertex for association of pileup vertices (originally used in PUPPI) + if ((vtxIdMinSignif >= 0) && (std::abs(track->eta()) > fEtaMinUseDz_)) + iVertex = + ((firstVertexDz < maxDzForPrimaryAssignment_ and firstVertexDz / dzE < maxDzSigForPrimaryAssignment_ and + track->dzError() < maxDzErrorForPrimaryAssignment_) and + (!useTime or std::abs(time - vertices.at(0).t()) / timeReso < maxDtSigForPrimaryAssignment_)) + ? 0 + : vtxIdMinSignif; + } } if (iVertex >= 0) - return std::pair(iVertex, PrimaryVertexAssignment::PrimaryDz); + return {iVertex, PrimaryVertexAssignment::PrimaryDz}; // if track not assigned yet, it could be a b-decay secondary , use jet axis dist criterion // first find the closest jet within maxJetDeltaR_ int jetIdx = -1; - double minDeltaR = maxJetDeltaR_; + double minDeltaR2 = maxJetDeltaR_ * maxJetDeltaR_; for (edm::View::const_iterator ij = jets.begin(); ij != jets.end(); ++ij) { if (ij->pt() < minJetPt_) continue; // skip jets below the jet Pt threshold - double deltaR = reco::deltaR(*ij, *track); - if (deltaR < minDeltaR and track->dzError() < maxDzErrorForPrimaryAssignment_) { - minDeltaR = deltaR; + double deltaR2 = reco::deltaR2(*ij, *track); + if (deltaR2 < minDeltaR2 and track->dzError() < maxDzErrorForPrimaryAssignment_) { + minDeltaR2 = deltaR2; jetIdx = std::distance(jets.begin(), ij); } } @@ -137,20 +173,19 @@ std::pair PrimaryVertexAssignment::charge } } if (iVertex >= 0) - return std::pair(iVertex, PrimaryVertexAssignment::BTrack); + return {iVertex, PrimaryVertexAssignment::BTrack}; // if the track is not compatible with other PVs but is compatible with the BeamSpot, we may simply have not reco'ed the PV! // we still point it to the closest in Z, but flag it as possible orphan-primary if (!vertices.empty() && std::abs(track->dxy(vertices[0].position())) < maxDxyForNotReconstructedPrimary_ && std::abs(track->dxy(vertices[0].position()) / track->dxyError()) < maxDxySigForNotReconstructedPrimary_) - return std::pair(vtxIdMinSignif, - PrimaryVertexAssignment::NotReconstructedPrimary); + return {vtxIdMinSignif, PrimaryVertexAssignment::NotReconstructedPrimary}; //FIXME: here we could better handle V0s and NucInt // all other tracks could be non-B secondaries and we just attach them with closest Z if (vtxIdMinSignif >= 0) - return std::pair(vtxIdMinSignif, PrimaryVertexAssignment::OtherDz); + return {vtxIdMinSignif, PrimaryVertexAssignment::OtherDz}; //If for some reason even the dz failed (when?) we consider the track not assigned - return std::pair(-1, PrimaryVertexAssignment::Unassigned); + return {-1, PrimaryVertexAssignment::Unassigned}; } diff --git a/CommonTools/UtilAlgos/interface/NullPostProcessor.h b/CommonTools/UtilAlgos/interface/NullPostProcessor.h index d2e78c0aa77a1..842fc46bb08c1 100644 --- a/CommonTools/UtilAlgos/interface/NullPostProcessor.h +++ b/CommonTools/UtilAlgos/interface/NullPostProcessor.h @@ -8,18 +8,18 @@ #include "DataFormats/Common/interface/OrphanHandle.h" namespace edm { - class EDFilter; class Event; class ParameterSet; } // namespace edm namespace helper { - template + template struct NullPostProcessor { NullPostProcessor(const edm::ParameterSet& iConfig, edm::ConsumesCollector&& iC) : NullPostProcessor(iConfig) {} NullPostProcessor(const edm::ParameterSet& iConfig) {} - void init(EdmFilter&) {} + template + void init(F&) {} void process(edm::OrphanHandle, edm::Event&) {} }; diff --git a/CommonTools/UtilAlgos/interface/ObjectCountFilter.h b/CommonTools/UtilAlgos/interface/ObjectCountFilter.h index 139b14150cced..f9618695d60bb 100644 --- a/CommonTools/UtilAlgos/interface/ObjectCountFilter.h +++ b/CommonTools/UtilAlgos/interface/ObjectCountFilter.h @@ -13,10 +13,6 @@ * */ -#include "FWCore/Framework/interface/EDFilter.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/Utilities/interface/InputTag.h" #include "CommonTools/UtilAlgos/interface/ParameterAdapter.h" #include "CommonTools/UtilAlgos/interface/CollectionFilterTrait.h" #include "CommonTools/UtilAlgos/interface/EventSelectorAdapter.h" diff --git a/CommonTools/UtilAlgos/interface/ObjectSelector.h b/CommonTools/UtilAlgos/interface/ObjectSelector.h index 8a0edc0f0e524..5ae1ebd951e6a 100644 --- a/CommonTools/UtilAlgos/interface/ObjectSelector.h +++ b/CommonTools/UtilAlgos/interface/ObjectSelector.h @@ -12,77 +12,23 @@ * */ -#include "FWCore/Framework/interface/EDFilter.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/ConsumesCollector.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/Utilities/interface/InputTag.h" -#include "CommonTools/UtilAlgos/interface/ParameterAdapter.h" +#include "FWCore/Framework/interface/stream/EDFilter.h" +#include "CommonTools/UtilAlgos/interface/ObjectSelectorBase.h" #include "CommonTools/UtilAlgos/interface/NonNullNumberSelector.h" #include "CommonTools/UtilAlgos/interface/StoreManagerTrait.h" #include "CommonTools/UtilAlgos/interface/SelectedOutputCollectionTrait.h" #include "CommonTools/UtilAlgos/interface/NullPostProcessor.h" #include "CommonTools/UtilAlgos/interface/EventSetupInitTrait.h" -#include -#include -#include -#include template ::type, typename SizeSelector = NonNullNumberSelector, - typename PostProcessor = ::helper::NullPostProcessor, - typename StoreManager = typename ::helper::StoreManagerTrait::type, - typename Base = typename ::helper::StoreManagerTrait::base, + typename PostProcessor = ::helper::NullPostProcessor, + typename StoreManager = typename ::helper::StoreManagerTrait>::type, + typename Base = typename ::helper::StoreManagerTrait>::base, typename Init = typename ::reco::modules::EventSetupInit::type> -class ObjectSelector : public Base { -public: - /// constructor - // ObjectSelector()=default; - explicit ObjectSelector(const edm::ParameterSet& cfg) - : Base(cfg), - srcToken_( - this->template consumes(cfg.template getParameter("src"))), - filter_(false), - selector_(cfg, this->consumesCollector()), - sizeSelector_(reco::modules::make(cfg)), - postProcessor_(cfg, this->consumesCollector()) { - const std::string filter("filter"); - std::vector bools = cfg.template getParameterNamesForType(); - bool found = std::find(bools.begin(), bools.end(), filter) != bools.end(); - if (found) - filter_ = cfg.template getParameter(filter); - postProcessor_.init(*this); - } - /// destructor - ~ObjectSelector() override {} - -private: - /// process one event - bool filter(edm::Event& evt, const edm::EventSetup& es) override { - Init::init(selector_, evt, es); - using namespace std; - edm::Handle source; - evt.getByToken(srcToken_, source); - StoreManager manager(source); - selector_.select(source, evt, es); - manager.cloneAndStore(selector_.begin(), selector_.end(), evt); - bool result = (!filter_ || sizeSelector_(manager.size())); - edm::OrphanHandle filtered = manager.put(evt); - postProcessor_.process(filtered, evt); - return result; - } - /// source collection label - edm::EDGetTokenT srcToken_; - /// filter event - bool filter_; - /// Object collection selector - Selector selector_; - /// selected object collection size selector - SizeSelector sizeSelector_; - /// post processor - PostProcessor postProcessor_; -}; +using ObjectSelector = + ObjectSelectorBase; #endif diff --git a/CommonTools/UtilAlgos/interface/ObjectSelectorBase.h b/CommonTools/UtilAlgos/interface/ObjectSelectorBase.h new file mode 100644 index 0000000000000..06e6cff0b0632 --- /dev/null +++ b/CommonTools/UtilAlgos/interface/ObjectSelectorBase.h @@ -0,0 +1,81 @@ +#ifndef RecoAlgos_ObjectSelectorBase_h +#define RecoAlgos_ObjectSelectorBase_h +/** \class ObjectSelectorBase + * + * selects a subset of a collection. + * + * \author Luca Lista, INFN + * + * \version $Revision: 1.3 $ + * + * $Id: ObjectSelectorBase.h,v 1.3 2010/02/20 20:55:27 wmtan Exp $ + * + */ + +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/Utilities/interface/InputTag.h" +#include "CommonTools/UtilAlgos/interface/ParameterAdapter.h" +#include +#include +#include +#include + +template +class ObjectSelectorBase : public Base { +public: + /// constructor + // ObjectSelectorBase()=default; + explicit ObjectSelectorBase(const edm::ParameterSet& cfg) + : Base(cfg), + srcToken_( + this->template consumes(cfg.template getParameter("src"))), + filter_(false), + selector_(cfg, this->consumesCollector()), + sizeSelector_(reco::modules::make(cfg)), + postProcessor_(cfg, this->consumesCollector()) { + const std::string filter("filter"); + std::vector bools = cfg.template getParameterNamesForType(); + bool found = std::find(bools.begin(), bools.end(), filter) != bools.end(); + if (found) + filter_ = cfg.template getParameter(filter); + postProcessor_.init(*this); + } + /// destructor + ~ObjectSelectorBase() override {} + +private: + /// process one event + bool filter(edm::Event& evt, const edm::EventSetup& es) override { + Init::init(selector_, evt, es); + using namespace std; + edm::Handle source; + evt.getByToken(srcToken_, source); + StoreManager manager(source); + selector_.select(source, evt, es); + manager.cloneAndStore(selector_.begin(), selector_.end(), evt); + bool result = (!filter_ || sizeSelector_(manager.size())); + edm::OrphanHandle filtered = manager.put(evt); + postProcessor_.process(filtered, evt); + return result; + } + /// source collection label + edm::EDGetTokenT srcToken_; + /// filter event + bool filter_; + /// Object collection selector + Selector selector_; + /// selected object collection size selector + SizeSelector sizeSelector_; + /// post processor + PostProcessor postProcessor_; +}; + +#endif diff --git a/CommonTools/UtilAlgos/interface/ObjectSelectorStream.h b/CommonTools/UtilAlgos/interface/ObjectSelectorStream.h deleted file mode 100644 index d47126b5e04af..0000000000000 --- a/CommonTools/UtilAlgos/interface/ObjectSelectorStream.h +++ /dev/null @@ -1,41 +0,0 @@ -#ifndef CommonTools_UtilAlgos_ObjectSelectorStream_h -#define CommonTools_UtilAlgos_ObjectSelectorStream_h -// -*- C++ -*- -// -// Package: CommonTools/UtilAlgos -// Class : ObjectSelectorStream -// -/**\class ObjectSelectorStream ObjectSelectorStream.h "CommonTools/UtilAlgos/interface/ObjectSelectorStream.h" - - Description: Template for constructing stream based object selector modules - - Usage: - - -*/ -// -// Original Author: Christopher Jones -// Created: Fri, 30 May 2014 18:56:48 GMT -// - -// system include files -#include "FWCore/Framework/interface/stream/EDFilter.h" -#include "CommonTools/UtilAlgos/interface/ObjectSelector.h" - -template ::type, - typename SizeSelector = NonNullNumberSelector, - typename PostProcessor = ::helper::NullPostProcessor>, - typename StoreManager = typename ::helper::StoreManagerTrait>::type, - typename Init = typename ::reco::modules::EventSetupInit::type> -using ObjectSelectorStream = - ObjectSelector>::base, - Init>; - -#endif diff --git a/CommonTools/UtilAlgos/interface/ObjectSelectorStreamProducer.h b/CommonTools/UtilAlgos/interface/ObjectSelectorStreamProducer.h index d8f0b07d05d99..0203b92990ae3 100644 --- a/CommonTools/UtilAlgos/interface/ObjectSelectorStreamProducer.h +++ b/CommonTools/UtilAlgos/interface/ObjectSelectorStreamProducer.h @@ -7,7 +7,7 @@ template < typename Selector, typename OutputCollection = typename ::helper::SelectedOutputCollectionTrait::type, - typename PostProcessor = ::helper::NullPostProcessor>, + typename PostProcessor = ::helper::NullPostProcessor, typename StoreManager = typename ::helper::StoreManagerTrait>::type, typename Init = typename ::reco::modules::EventSetupInit::type> using ObjectSelectorStreamProducer = diff --git a/CommonTools/UtilAlgos/interface/SingleObjectRefSelector.h b/CommonTools/UtilAlgos/interface/SingleObjectRefSelector.h index d9de6f6a0355e..97df182972be5 100644 --- a/CommonTools/UtilAlgos/interface/SingleObjectRefSelector.h +++ b/CommonTools/UtilAlgos/interface/SingleObjectRefSelector.h @@ -13,11 +13,11 @@ template >::type, + typename OutputCollection = typename ::helper::SelectedOutputCollectionTrait>::type, typename StoreContainer = typename ::helper::StoreContainerTrait::type, typename PostProcessor = ::helper::NullPostProcessor, - typename StoreManager = typename ::helper::StoreManagerTrait::type, - typename Base = typename ::helper::StoreManagerTrait::base, + typename StoreManager = typename ::helper::StoreManagerTrait>::type, + typename Base = typename ::helper::StoreManagerTrait>::base, typename RefAdder = typename ::helper::SelectionAdderTrait, StoreContainer>::type> class SingleObjectRefSelector : public ObjectSelector< diff --git a/CommonTools/UtilAlgos/interface/SingleObjectSelector.h b/CommonTools/UtilAlgos/interface/SingleObjectSelector.h index e2b854282182a..4a3014f05345d 100644 --- a/CommonTools/UtilAlgos/interface/SingleObjectSelector.h +++ b/CommonTools/UtilAlgos/interface/SingleObjectSelector.h @@ -4,7 +4,12 @@ * * \author Luca Lista, INFN */ -#include "CommonTools/UtilAlgos/interface/ObjectSelector.h" +#include "CommonTools/UtilAlgos/interface/ObjectSelectorBase.h" +#include "CommonTools/UtilAlgos/interface/NonNullNumberSelector.h" +#include "CommonTools/UtilAlgos/interface/StoreManagerTrait.h" +#include "CommonTools/UtilAlgos/interface/SelectedOutputCollectionTrait.h" +#include "CommonTools/UtilAlgos/interface/NullPostProcessor.h" +#include "CommonTools/UtilAlgos/interface/EventSetupInitTrait.h" #include "CommonTools/UtilAlgos/interface/StoreContainerTrait.h" #include "CommonTools/UtilAlgos/interface/SelectionAdderTrait.h" #include "CommonTools/UtilAlgos/interface/SingleElementCollectionSelector.h" @@ -19,46 +24,45 @@ template ::type, typename StoreContainer = typename ::helper::StoreContainerTrait::type, - typename PostProcessor = ::helper::NullPostProcessor, + typename PostProcessor = ::helper::NullPostProcessor, typename StoreManager = typename ::helper::StoreManagerTrait::type, typename Base = typename ::helper::StoreManagerTrait::base, typename RefAdder = typename ::helper::SelectionAdderTrait::type> class SingleObjectSelectorBase - : public ObjectSelector< + : public ObjectSelectorBase< SingleElementCollectionSelector, OutputCollection, NonNullNumberSelector, PostProcessor, StoreManager, - Base> { + Base, + typename ::reco::modules::EventSetupInit< + SingleElementCollectionSelector>:: + type> { + using Init = typename ::reco::modules::EventSetupInit< + SingleElementCollectionSelector>::type; + public: // SingleObjectSelectorBase() = default; explicit SingleObjectSelectorBase(const edm::ParameterSet& cfg) - : ObjectSelector< + : ObjectSelectorBase< SingleElementCollectionSelector, OutputCollection, NonNullNumberSelector, PostProcessor, StoreManager, - Base>(cfg) {} + Base, + Init>(cfg) {} ~SingleObjectSelectorBase() override {} }; -template ::type, - typename StoreContainer = typename ::helper::StoreContainerTrait::type, - typename PostProcessor = ::helper::NullPostProcessor > -using SingleObjectSelectorLegacy = - SingleObjectSelectorBase; - #include "FWCore/Framework/interface/stream/EDFilter.h" template ::type, typename StoreContainer = typename ::helper::StoreContainerTrait::type, - typename PostProcessor = ::helper::NullPostProcessor > > + typename PostProcessor = ::helper::NullPostProcessor> using SingleObjectSelectorStream = SingleObjectSelectorBase, @@ -70,7 +74,7 @@ template ::type, typename StoreContainer = typename ::helper::StoreContainerTrait::type, - typename PostProcessor = ::helper::NullPostProcessor > > + typename PostProcessor = ::helper::NullPostProcessor> using SingleObjectSelector = SingleObjectSelectorStream; diff --git a/CommonTools/UtilAlgos/interface/StoreManagerTrait.h b/CommonTools/UtilAlgos/interface/StoreManagerTrait.h index 13dcabff47b22..2aa872482f810 100644 --- a/CommonTools/UtilAlgos/interface/StoreManagerTrait.h +++ b/CommonTools/UtilAlgos/interface/StoreManagerTrait.h @@ -87,7 +87,7 @@ namespace helper { ObjectSelectorBase(const edm::ParameterSet &) { this->template produces(); } }; - template + template struct StoreManagerTrait { using type = CollectionStoreManager; using base = ObjectSelectorBase; diff --git a/CommonTools/Utils/test/testDynArray.cpp b/CommonTools/Utils/test/testDynArray.cpp index 25d415933a2ef..a5cac2d427c82 100644 --- a/CommonTools/Utils/test/testDynArray.cpp +++ b/CommonTools/Utils/test/testDynArray.cpp @@ -16,7 +16,9 @@ struct A { int main(int s, char **) { using T = A; - unsigned n = 4 * s; + unsigned n = 4; + if (s > 1) + n = 4 * s; // alignas(alignof(T)) unsigned char a_storage[sizeof(T)*n]; // DynArray a(a_storage,n); diff --git a/CondCore/AlignmentPlugins/plugins/TrackerAlignment_PayloadInspector.cc b/CondCore/AlignmentPlugins/plugins/TrackerAlignment_PayloadInspector.cc index 0bee612603bf5..1633380424575 100644 --- a/CondCore/AlignmentPlugins/plugins/TrackerAlignment_PayloadInspector.cc +++ b/CondCore/AlignmentPlugins/plugins/TrackerAlignment_PayloadInspector.cc @@ -995,10 +995,10 @@ namespace { final->SetMarkerSize(2.5); t1.SetTextColor(kRed); initial->Draw(); - t1.DrawLatex(x0i, y0i - 0.5, Form("(%.2f,%.2f)", x0i, y0i)); + t1.DrawLatex(x0i, y0i + (y0i > y0f ? 0.3 : -0.5), Form("(%.2f,%.2f)", x0i, y0i)); final->Draw("same"); t1.SetTextColor(kBlue); - t1.DrawLatex(x0f, y0f + 0.3, Form("(%.2f,%.2f)", x0f, y0f)); + t1.DrawLatex(x0f, y0f + (y0i > y0f ? -0.5 : 0.3), Form("(%.2f,%.2f)", x0f, y0f)); } // fourth pad is a special case for the z coordinate @@ -1032,10 +1032,10 @@ namespace { final->SetMarkerSize(2.5); initial->Draw(); t1.SetTextColor(kRed); - t1.DrawLatex(c - 1, z0i - 1.5, Form("(%.2f)", z0i)); + t1.DrawLatex(c - 1, z0i + (z0i > z0f ? 1. : -1.5), Form("(%.2f)", z0i)); final->Draw("same"); t1.SetTextColor(kBlue); - t1.DrawLatex(c - 1, z0f + 1., Form("(%.2f)", z0f)); + t1.DrawLatex(c - 1, z0f + (z0i > z0f ? -1.5 : 1), Form("(%.2f)", z0f)); } std::string fileName(this->m_imageFileName); diff --git a/CondCore/AlignmentPlugins/test/testTrackerAlignmentPayloadInspector.cpp b/CondCore/AlignmentPlugins/test/testTrackerAlignmentPayloadInspector.cpp index 486c5d7d2824d..7124f3ff69990 100644 --- a/CondCore/AlignmentPlugins/test/testTrackerAlignmentPayloadInspector.cpp +++ b/CondCore/AlignmentPlugins/test/testTrackerAlignmentPayloadInspector.cpp @@ -22,8 +22,8 @@ int main(int argc, char** argv) { std::string connectionString("frontier://FrontierProd/CMS_CONDITIONS"); std::string tag = "TrackerAlignment_v21_offline"; - cond::Time_t start = boost::lexical_cast(294034); - cond::Time_t end = boost::lexical_cast(305898); + cond::Time_t start = static_cast(294034); + cond::Time_t end = static_cast(305898); std::cout << "## Alignment Histos" << std::endl; diff --git a/CondCore/BeamSpotPlugins/interface/BeamSpotPayloadInspectorHelper.h b/CondCore/BeamSpotPlugins/interface/BeamSpotPayloadInspectorHelper.h index a0d992f6ee90e..f7a4f0ae82a13 100644 --- a/CondCore/BeamSpotPlugins/interface/BeamSpotPayloadInspectorHelper.h +++ b/CondCore/BeamSpotPlugins/interface/BeamSpotPayloadInspectorHelper.h @@ -28,21 +28,32 @@ namespace BeamSpotPI { } enum parameters { - X, - Y, - Z, - sigmaX, - sigmaY, - sigmaZ, - dxdz, - dydz, - lastLumi, - lastRun, - lastFill, - nTracks, - nPVs, - creationTime, - END_OF_TYPES + X = 0, // 0 regular BS methods + Y = 1, // 1 + Z = 2, // 2 + sigmaX = 3, // 3 + sigmaY = 4, // 4 + sigmaZ = 5, // 5 + dxdz = 6, // 6 + dydz = 7, // 7 + lastLumi = 8, // 8 additional int's + lastRun = 9, // 9 + lastFill = 10, // 10 + nTracks = 11, // 11 + nPVs = 12, // 12 + nUsedEvents = 13, // 13 + maxPVs = 14, // 14 + meanPV = 15, // 15 additional float's + meanErrorPV = 16, // 16 + rmsPV = 17, // 17 + rmsErrorPV = 18, // 18 + creationTime = 19, // 19 additional cond::Time_t + startTimeStamp = 20, // 20 + endTimeStamp = 21, // 21 + startTime = 22, // 22 additional std::string + endTime = 23, // 23 + lumiRange = 24, // 24 + END_OF_TYPES = 25, }; /************************************************/ @@ -233,7 +244,7 @@ namespace BeamSpotPI { canvas.cd(1)->SetTopMargin(0.05); canvas.cd(1)->SetBottomMargin(0.06); canvas.cd(1)->SetLeftMargin(0.15); - canvas.cd(1)->SetRightMargin(0.03); + canvas.cd(1)->SetRightMargin(0.01); canvas.cd(1)->Modified(); canvas.cd(1)->SetGrid(); @@ -331,8 +342,8 @@ namespace BeamSpotPI { canvas.cd(2); canvas.cd(2)->SetTopMargin(0.05); canvas.cd(2)->SetBottomMargin(0.06); - canvas.cd(2)->SetLeftMargin(0.15); - canvas.cd(2)->SetRightMargin(0.03); + canvas.cd(2)->SetLeftMargin(0.25); + canvas.cd(2)->SetRightMargin(0.01); canvas.cd(2)->Modified(); canvas.cd(2)->SetGrid(); diff --git a/CondCore/BeamSpotPlugins/plugins/BeamSpotOnline_PayloadInspector.cc b/CondCore/BeamSpotPlugins/plugins/BeamSpotOnline_PayloadInspector.cc index 6a5a087f2b0a0..01adad53bc9d7 100644 --- a/CondCore/BeamSpotPlugins/plugins/BeamSpotOnline_PayloadInspector.cc +++ b/CondCore/BeamSpotPlugins/plugins/BeamSpotOnline_PayloadInspector.cc @@ -62,11 +62,17 @@ namespace { public: std::shared_ptr fillTheExtraHistogram() const override { gStyle->SetHistMinimumZero(); - auto h2_ExtraBSParameters = std::make_shared("ExtraParameters", "", 1, 0.0, 1.0, 6, 0, 6.); + + const auto span = parameters::startTime - parameters::lastLumi; + edm::LogInfo("BeamSpotOnlineParameters") << "the span is" << span; + + auto h2_ExtraBSParameters = + std::make_shared("ExtraParameters", "", 1, 0.0, 1.0, span, 0, static_cast(span)); h2_ExtraBSParameters->SetStats(false); - std::function mycutFunctor = [this](parameters my_param) { - int ret(-999.); + //_____________________________________________________________________________ + std::function myIntFunctor = [this](parameters my_param) { + int ret(-999); switch (my_param) { case lastLumi: return this->m_payload->GetLastAnalyzedLumi(); @@ -78,28 +84,85 @@ namespace { return this->m_payload->GetNumTracks(); case nPVs: return this->m_payload->GetNumPVs(); - case END_OF_TYPES: + case nUsedEvents: + return this->m_payload->GetUsedEvents(); + case maxPVs: + return this->m_payload->GetMaxPVs(); + default: return ret; + } + }; + + //_____________________________________________________________________________ + std::function myFloatFunctor = [this](parameters my_param) { + float ret(-999.); + switch (my_param) { + case meanPV: + return this->m_payload->GetMeanPV(); + case meanErrorPV: + return this->m_payload->GetMeanErrorPV(); + case rmsPV: + return this->m_payload->GetRmsPV(); + case rmsErrorPV: + return this->m_payload->GetRmsErrorPV(); + default: + return ret; + } + }; + + //_____________________________________________________________________________ + std::function myStringFunctor = [this](parameters my_param) { + std::string ret(""); + switch (my_param) { + case startTime: + return this->m_payload->GetStartTime(); + case endTime: + return this->m_payload->GetEndTime(); + case lumiRange: + return this->m_payload->GetLumiRange(); default: return ret; } }; - unsigned int yBin = 6; - for (int foo = parameters::lastLumi; foo != parameters::END_OF_TYPES; foo++) { + //_____________________________________________________________________________ + std::function myTimeFunctor = [this](parameters my_param) { + cond::Time_t ret(1); + switch (my_param) { + case creationTime: + return this->m_payload->GetCreationTime(); + case startTimeStamp: + return this->m_payload->GetStartTimeStamp(); + case endTimeStamp: + return this->m_payload->GetEndTimeStamp(); + default: + return ret; + } + }; + + unsigned int yBin = span; + for (int foo = parameters::lastLumi; foo != parameters::startTime; foo++) { parameters param = static_cast(foo); std::string theLabel = this->getStringFromTypeEnum(param); h2_ExtraBSParameters->GetYaxis()->SetBinLabel(yBin, theLabel.c_str()); - edm::LogInfo("BeamSpotOnline_PayloadInspector") - << theLabel.c_str() << " : " << mycutFunctor(param) << std::endl; - - if (param == BeamSpotPI::creationTime) { - h2_ExtraBSParameters->SetBinContent(1, yBin, m_payload->GetCreationTime()); - } else { - h2_ExtraBSParameters->SetBinContent(1, yBin, mycutFunctor(param)); + if (foo <= parameters::maxPVs) { + const auto output = try_(std::bind(myIntFunctor, param), print_error); + edm::LogInfo("BeamSpotOnline_PayloadInspector") << theLabel.c_str() << " : " << output << std::endl; + h2_ExtraBSParameters->SetBinContent(1, yBin, output); + } else if (foo <= parameters::rmsErrorPV) { + const auto output = try_(std::bind(myFloatFunctor, param), print_error); + edm::LogInfo("BeamSpotOnline_PayloadInspector") << theLabel.c_str() << " : " << output << std::endl; + h2_ExtraBSParameters->SetBinContent(1, yBin, output); + } else if (foo <= parameters::endTimeStamp) { + const auto output = try_(std::bind(myTimeFunctor, param), print_error); + edm::LogInfo("BeamSpotOnline_PayloadInspector") << theLabel.c_str() << " : " << output << std::endl; + h2_ExtraBSParameters->SetBinContent(1, yBin, output); + //} else if( foo <=parameters::lumiRange){ + // const auto output = try_(std::bind(myStringFunctor, param), print_error); + //edm::LogInfo("BeamSpotOnline_PayloadInspector") << theLabel.c_str() << " : " << output << std::endl; + //h2_ExtraBSParameters->SetBinContent(1, yBin, output); } - yBin--; } @@ -141,12 +204,50 @@ namespace { return "# tracks"; case nPVs: return "# PVs"; + case nUsedEvents: + return "# events"; + case maxPVs: + return "max PVs"; + case meanPV: + return "#LT # PV #GT"; + case meanErrorPV: + return "#LT # PV #GT error"; + case rmsPV: + return "RMS(# PV)"; + case rmsErrorPV: + return "RMS(# PV) error"; case creationTime: - return "time"; + return "creation time"; + case startTimeStamp: + return "start timestamp"; + case endTimeStamp: + return "end timestamp"; + case startTime: + return "startTime"; + case endTime: + return "endTime"; + case lumiRange: + return "lumiRange"; default: return "should never be here"; } } + + //slightly better error handler + static void print_error(const std::exception& e) { edm::LogError("BeamSpotOnlineParameters") << e.what() << '\n'; } + + // method to catch exceptions + template + T try_(Func f, Response r) const { + try { + LogDebug("BeamSpotOnlineParameters") << "I have tried" << std::endl; + return f(); + } catch (Except& e) { + LogDebug("BeamSpotOnlineParameters") << "I have caught!" << std::endl; + r(e); + return static_cast(-999); + } + } }; } // namespace diff --git a/CondCore/BeamSpotPlugins/test/testBeamSpotPayloadInspector.cpp b/CondCore/BeamSpotPlugins/test/testBeamSpotPayloadInspector.cpp index 6fc591f7a4be5..4a0741a2a7b3f 100644 --- a/CondCore/BeamSpotPlugins/test/testBeamSpotPayloadInspector.cpp +++ b/CondCore/BeamSpotPlugins/test/testBeamSpotPayloadInspector.cpp @@ -27,8 +27,8 @@ int main(int argc, char** argv) { // BeamSpot std::string tag = "BeamSpotObjects_PCL_byLumi_v0_prompt"; - cond::Time_t start = boost::lexical_cast(1406876667347162); - //cond::Time_t end = boost::lexical_cast(1406876667347162); + cond::Time_t start = static_cast(1406876667347162); + //cond::Time_t end = static_cast(1406876667347162); edm::LogPrint("testBeamSpotPayloadInspector") << "## Exercising BeamSpot plots " << std::endl; @@ -37,7 +37,7 @@ int main(int argc, char** argv) { edm::LogPrint("testBeamSpotPayloadInspector") << histoParameters.data() << std::endl; tag = "BeamSpotOnlineTestLegacy"; - start = boost::lexical_cast(1443392479297557); + start = static_cast(1443392479297557); edm::LogPrint("testBeamSpotPayloadInspector") << "## Exercising BeamSpotOnline plots " << std::endl; diff --git a/CondCore/CTPPSPlugins/src/plugin.cc b/CondCore/CTPPSPlugins/src/plugin.cc index 7f9f109e123f1..1c8892df4218e 100644 --- a/CondCore/CTPPSPlugins/src/plugin.cc +++ b/CondCore/CTPPSPlugins/src/plugin.cc @@ -21,6 +21,10 @@ #include "CondFormats/DataRecord/interface/PPSPixelTopologyRcd.h" #include "CondFormats/PPSObjects/interface/PPSAlignmentConfig.h" #include "CondFormats/DataRecord/interface/PPSAlignmentConfigRcd.h" +#include "CondFormats/PPSObjects/interface/PPSAlignmentConfiguration.h" +#include "CondFormats/DataRecord/interface/PPSAlignmentConfigurationRcd.h" +#include "CondFormats/PPSObjects/interface/PPSAssociationCuts.h" +#include "CondFormats/DataRecord/interface/PPSAssociationCutsRcd.h" REGISTER_PLUGIN(CTPPSBeamParametersRcd, CTPPSBeamParameters); REGISTER_PLUGIN(CTPPSPixelDAQMappingRcd, CTPPSPixelDAQMapping); @@ -34,3 +38,5 @@ REGISTER_PLUGIN(CTPPSOpticsRcd, LHCOpticalFunctionsSetCollection); REGISTER_PLUGIN(PPSDirectSimulationDataRcd, PPSDirectSimulationData); REGISTER_PLUGIN(PPSPixelTopologyRcd, PPSPixelTopology); REGISTER_PLUGIN(PPSAlignmentConfigRcd, PPSAlignmentConfig); +REGISTER_PLUGIN(PPSAlignmentConfigurationRcd, PPSAlignmentConfiguration); +REGISTER_PLUGIN(PPSAssociationCutsRcd, PPSAssociationCuts); diff --git a/CondCore/CondDB/interface/ConnectionPool.h b/CondCore/CondDB/interface/ConnectionPool.h index 9aaab9d705870..30f84fef66fdb 100644 --- a/CondCore/CondDB/interface/ConnectionPool.h +++ b/CondCore/CondDB/interface/ConnectionPool.h @@ -43,6 +43,7 @@ namespace cond { void setAuthenticationSystem(int authSysCode); void setFrontierSecurity(const std::string& signature); void setLogging(bool flag); + void setConnectionTimeout(int seconds); bool isLoggingEnabled() const; void setParameters(const edm::ParameterSet& connectionPset); void configure(); @@ -65,6 +66,7 @@ namespace cond { int m_authSys = 0; std::string m_authenticationService = std::string(""); coral::MsgLevel m_messageLevel = coral::Error; + int m_connectionTimeout = 0; CoralMsgReporter* m_msgReporter = nullptr; bool m_loggingEnabled = false; //The frontier security option is turned on for all sessions diff --git a/CondCore/CondDB/python/CondDB_cfi.py b/CondCore/CondDB/python/CondDB_cfi.py index 3c4969ba1988a..85c21fc4bf196 100644 --- a/CondCore/CondDB/python/CondDB_cfi.py +++ b/CondCore/CondDB/python/CondDB_cfi.py @@ -6,6 +6,7 @@ authenticationSystem = cms.untracked.int32(0), security = cms.untracked.string(''), messageLevel = cms.untracked.int32(0), + connectionTimeout = cms.untracked.int32(0), ), connect = cms.string(''), ) diff --git a/CondCore/CondDB/src/ConnectionPool.cc b/CondCore/CondDB/src/ConnectionPool.cc index 23a09456a0b52..c42447512f695 100644 --- a/CondCore/CondDB/src/ConnectionPool.cc +++ b/CondCore/CondDB/src/ConnectionPool.cc @@ -67,6 +67,7 @@ namespace cond { level = coral::Error; } setMessageVerbosity(level); + setConnectionTimeout(connectionPset.getUntrackedParameter("connectionTimeout", m_connectionTimeout)); setLogging(connectionPset.getUntrackedParameter("logging", m_loggingEnabled)); } @@ -75,6 +76,7 @@ namespace cond { void ConnectionPool::configure(coral::IConnectionServiceConfiguration& coralConfig) { coralConfig.disablePoolAutomaticCleanUp(); coralConfig.disableConnectionSharing(); + coralConfig.setConnectionTimeOut(m_connectionTimeout); // message streaming coral::MessageStream::setMsgVerbosity(m_messageLevel); m_msgReporter->setOutputLevel(m_messageLevel); @@ -185,6 +187,8 @@ namespace cond { void ConnectionPool::setMessageVerbosity(coral::MsgLevel level) { m_messageLevel = level; } + void ConnectionPool::setConnectionTimeout(int seconds) { m_connectionTimeout = seconds; } + void ConnectionPool::setLogDestination(Logger& logger) { m_msgReporter->subscribe(logger); } } // namespace persistency diff --git a/CondCore/DBOutputService/interface/OnlineDBOutputService.h b/CondCore/DBOutputService/interface/OnlineDBOutputService.h index b65829cd42685..b184bb99133a0 100644 --- a/CondCore/DBOutputService/interface/OnlineDBOutputService.h +++ b/CondCore/DBOutputService/interface/OnlineDBOutputService.h @@ -37,11 +37,11 @@ namespace cond { // template - bool writeForNextLumisection(const PayloadType* payload, const std::string& recordName) { + bool writeIOVForNextLumisection(const PayloadType& payload, const std::string& recordName) { cond::Time_t targetTime = getLastLumiProcessed() + m_latencyInLumisections; auto t0 = std::chrono::high_resolution_clock::now(); logger().logInfo() << "Updating lumisection " << targetTime; - cond::Hash payloadId = PoolDBOutputService::writeOne(payload, targetTime, recordName); + cond::Hash payloadId = PoolDBOutputService::writeOneIOV(payload, targetTime, recordName); bool ret = true; if (payloadId.empty()) { return false; @@ -73,6 +73,15 @@ namespace cond { return ret; } + // + template + bool writeForNextLumisection(const PayloadType* payloadPtr, const std::string& recordName) { + if (!payloadPtr) + throwException("Provided payload pointer is invalid.", "OnlineDBOutputService::writeForNextLumisection"); + std::unique_ptr payload(payloadPtr); + return writeForNextLumisection(*payload, recordName); + } + private: cond::Time_t getLastLumiProcessed(); diff --git a/CondCore/DBOutputService/interface/PoolDBOutputService.h b/CondCore/DBOutputService/interface/PoolDBOutputService.h index f87e8b0c20a09..de047207b3381 100644 --- a/CondCore/DBOutputService/interface/PoolDBOutputService.h +++ b/CondCore/DBOutputService/interface/PoolDBOutputService.h @@ -58,11 +58,8 @@ namespace cond { std::string tag(const std::string& recordName); bool isNewTagRequest(const std::string& recordName); - // template - Hash writeOne(const T* payload, Time_t time, const std::string& recordName) { - if (!payload) - throwException("Provided payload pointer is invalid.", "PoolDBOutputService::writeOne"); + Hash writeOneIOV(const T& payload, Time_t time, const std::string& recordName) { std::lock_guard lock(m_mutex); doStartTransaction(); cond::persistency::TransactionScope scope(m_session.transaction()); @@ -87,8 +84,8 @@ namespace cond { return thePayloadHash; } } - thePayloadHash = m_session.storePayload(*payload); - std::string payloadType = cond::demangledName(typeid(T)); + thePayloadHash = m_session.storePayload(payload); + std::string payloadType = cond::demangledName(typeid(payload)); if (newTag) { createNewIOV(thePayloadHash, payloadType, time, myrecord); } else { @@ -108,17 +105,73 @@ namespace cond { return thePayloadHash; } + // warning: takes over the ownership of pointer "payload". Deprecated. Please move to the above referece-based function + template + Hash writeOne(const T* payloadPtr, Time_t time, const std::string& recordName) { + if (!payloadPtr) + throwException("Provided payload pointer is invalid.", "PoolDBOutputService::writeOne"); + std::unique_ptr payload(payloadPtr); + return writeOneIOV(*payload, time, recordName); + } + + template + void writeMany(const std::map >& iovAndPayloads, const std::string& recordName) { + if (iovAndPayloads.empty()) + return; + std::lock_guard lock(m_mutex); + doStartTransaction(); + cond::persistency::TransactionScope scope(m_session.transaction()); + try { + this->initDB(); + Record& myrecord = this->lookUpRecord(recordName); + m_logger.logInfo() << "Tag mapped to record " << recordName << ": " << myrecord.m_tag; + bool newTag = isNewTagRequest(recordName); + cond::Time_t lastSince; + cond::persistency::IOVEditor editor; + if (newTag) { + std::string payloadType = cond::demangledName(typeid(T)); + editor = m_session.createIov(payloadType, myrecord.m_tag, myrecord.m_timetype, cond::SYNCH_ANY); + editor.setDescription("New Tag"); + } else { + editor = m_session.editIov(myrecord.m_tag); + if (myrecord.m_onlyAppendUpdatePolicy) { + cond::TagInfo_t tInfo; + this->getTagInfo(myrecord.m_idName, tInfo); + lastSince = tInfo.lastInterval.since; + if (lastSince == cond::time::MAX_VAL) + lastSince = 0; + } + } + for (auto& iovEntry : iovAndPayloads) { + Time_t time = iovEntry.first; + auto payload = iovEntry.second; + if (myrecord.m_onlyAppendUpdatePolicy && !newTag) { + if (time <= lastSince) { + m_logger.logInfo() << "Won't append iov with since " << std::to_string(time) + << ", because is less or equal to last available since = " << lastSince; + continue; + } + } + auto payloadHash = m_session.storePayload(*payload); + editor.insert(time, payloadHash); + } + cond::UserLogInfo a = this->lookUpUserLogInfo(myrecord.m_idName); + editor.flush(a.usertext); + if (m_autoCommit) { + doCommitTransaction(); + } + } catch (const std::exception& er) { + cond::throwException(std::string(er.what()), "PoolDBOutputService::writeMany"); + } + scope.close(); + return; + } + // close the IOVSequence setting lastTill void closeIOV(Time_t lastTill, const std::string& recordName); - // this one we need to avoid to adapt client code around... to be removed in the long term! template - void createNewIOV(const T* firstPayloadObj, - cond::Time_t firstSinceTime, - cond::Time_t, - const std::string& recordName) { - if (!firstPayloadObj) - throwException("Provided payload pointer is invalid.", "PoolDBOutputService::createNewIOV"); + void createOneIOV(const T& payload, cond::Time_t firstSinceTime, const std::string& recordName) { std::lock_guard lock(m_mutex); Record& myrecord = this->lookUpRecord(recordName); if (!myrecord.m_isNewTag) { @@ -128,19 +181,25 @@ namespace cond { cond::persistency::TransactionScope scope(m_session.transaction()); try { this->initDB(); - Hash payloadId = m_session.storePayload(*firstPayloadObj); - createNewIOV(payloadId, cond::demangledName(typeid(T)), firstSinceTime, myrecord); + Hash payloadId = m_session.storePayload(payload); + createNewIOV(payloadId, cond::demangledName(typeid(payload)), firstSinceTime, myrecord); } catch (const std::exception& er) { cond::throwException(std::string(er.what()), "PoolDBOutputService::createNewIov"); } scope.close(); } - // + // warning: takes over the ownership of pointer "payload" - deprecated. Please move to the above reference-based function template - void appendSinceTime(const T* payloadObj, cond::Time_t sinceTime, const std::string& recordName) { - if (!payloadObj) - throwException("Provided payload pointer is invalid.", "PoolDBOutputService::appendSinceTime"); + void createNewIOV(const T* payloadPtr, cond::Time_t firstSinceTime, cond::Time_t, const std::string& recordName) { + if (!payloadPtr) + throwException("Provided payload pointer is invalid.", "PoolDBOutputService::createNewIOV"); + std::unique_ptr payload(payloadPtr); + this->createOneIOV(*payload, firstSinceTime, recordName); + } + + template + void appendOneIOV(const T& payload, cond::Time_t sinceTime, const std::string& recordName) { std::lock_guard lock(m_mutex); Record& myrecord = this->lookUpRecord(recordName); if (myrecord.m_isNewTag) { @@ -150,13 +209,22 @@ namespace cond { doStartTransaction(); cond::persistency::TransactionScope scope(m_session.transaction()); try { - appendSinceTime(m_session.storePayload(*payloadObj), sinceTime, myrecord); + appendSinceTime(m_session.storePayload(payload), sinceTime, myrecord); } catch (const std::exception& er) { cond::throwException(std::string(er.what()), "PoolDBOutputService::appendSinceTime"); } scope.close(); } + // warning: takes over the ownership of pointer "payload" - deprecated. Please move to the above reference-based function + template + void appendSinceTime(const T* payloadPtr, cond::Time_t sinceTime, const std::string& recordName) { + if (!payloadPtr) + throwException("Provided payload pointer is invalid.", "PoolDBOutputService::appendSinceTime"); + std::unique_ptr payload(payloadPtr); + this->appendOneIOV(*payload, sinceTime, recordName); + } + void createNewIOV(const std::string& firstPayloadId, cond::Time_t firstSinceTime, const std::string& recordName); bool appendSinceTime(const std::string& payloadId, cond::Time_t sinceTime, const std::string& recordName); diff --git a/CondCore/DBOutputService/src/OnlineDBOutputService.cc b/CondCore/DBOutputService/src/OnlineDBOutputService.cc index 3896bfc7e8aa0..20d53634e9950 100644 --- a/CondCore/DBOutputService/src/OnlineDBOutputService.cc +++ b/CondCore/DBOutputService/src/OnlineDBOutputService.cc @@ -69,8 +69,8 @@ namespace cond { if (!std::getline(sinfo, slumi, ',')) { throw Exception("Can't get lumi id from OMS Service."); } - unsigned int run = boost::lexical_cast(srun); - unsigned int lumi = boost::lexical_cast(slumi); + unsigned int run = std::stoul(srun); + unsigned int lumi = std::stoul(slumi); lastLumiProcessed = cond::time::lumiTime(run, lumi); return lastLumiProcessed; } diff --git a/CondCore/DBOutputService/src/PoolDBOutputService.cc b/CondCore/DBOutputService/src/PoolDBOutputService.cc index 3f156f23f34f1..af8e999ddcdde 100644 --- a/CondCore/DBOutputService/src/PoolDBOutputService.cc +++ b/CondCore/DBOutputService/src/PoolDBOutputService.cc @@ -287,10 +287,8 @@ bool cond::service::PoolDBOutputService::appendSinceTime(const std::string& payl cond::Time_t time, Record& myrecord) { m_logger.logInfo() << "Updating existing tag " << myrecord.m_tag << ", adding iov with since " << time; - std::string payloadType(""); try { cond::persistency::IOVEditor editor = m_session.editIov(myrecord.m_tag); - payloadType = editor.payloadType(); editor.insert(time, payloadId); cond::UserLogInfo a = this->lookUpUserLogInfo(myrecord.m_idName); editor.flush(a.usertext); diff --git a/CondCore/DBOutputService/test/stubs/IOVPayloadEndOfJob.cc b/CondCore/DBOutputService/test/stubs/IOVPayloadEndOfJob.cc index f03c51722c888..449df4e354bdc 100644 --- a/CondCore/DBOutputService/test/stubs/IOVPayloadEndOfJob.cc +++ b/CondCore/DBOutputService/test/stubs/IOVPayloadEndOfJob.cc @@ -37,7 +37,7 @@ void IOVPayloadEndOfJob::endJob() { //create cond::Time_t firstSinceTime = mydbservice->beginOfTime(); std::cout << "firstSinceTime is begin of time " << firstSinceTime << std::endl; - mydbservice->writeOne(&myped, firstSinceTime, m_record); + mydbservice->writeOneIOV(myped, firstSinceTime, m_record); } else { //append cond::Time_t current = mydbservice->currentTime(); @@ -52,7 +52,7 @@ void IOVPayloadEndOfJob::endJob() { } cond::Time_t thisPayload_valid_since = current; std::cout << "appeding since time " << thisPayload_valid_since << std::endl; - mydbservice->writeOne(&myped, thisPayload_valid_since, m_record); + mydbservice->writeOneIOV(myped, thisPayload_valid_since, m_record); std::cout << "done" << std::endl; //std::cout<m_pedestals[1].m_mean<logger().logDebug() << "BeamType: " << mybeamspot.GetBeamType(); m_ret = 0; try { - mydbservice->writeForNextLumisection(&mybeamspot, m_record); + mydbservice->writeIOVForNextLumisection(mybeamspot, m_record); } catch (const std::exception& e) { std::cout << "Error:" << e.what() << std::endl; mydbservice->logger().logError() << e.what(); diff --git a/CondCore/DBOutputService/test/stubs/Timestamp.cc b/CondCore/DBOutputService/test/stubs/Timestamp.cc index dad0c3c43a2dd..67ad2e15addf5 100644 --- a/CondCore/DBOutputService/test/stubs/Timestamp.cc +++ b/CondCore/DBOutputService/test/stubs/Timestamp.cc @@ -33,7 +33,7 @@ void Timestamp::analyze(const edm::Event& evt, const edm::EventSetup& evtSetup) std::cout << myped.m_pedestals[1].m_mean << std::endl; std::cout << "currentTime " << mydbservice->currentTime() << std::endl; if (mydbservice->currentTime() % 5 == 0) { - mydbservice->writeOne(&myped, mydbservice->currentTime(), m_record); + mydbservice->writeOneIOV(myped, mydbservice->currentTime(), m_record); } } void Timestamp::endJob() {} diff --git a/CondCore/DTPlugins/interface/DTCompactMapPluginHandler.h b/CondCore/DTPlugins/interface/DTCompactMapPluginHandler.h deleted file mode 100644 index c6ea5fb08b964..0000000000000 --- a/CondCore/DTPlugins/interface/DTCompactMapPluginHandler.h +++ /dev/null @@ -1 +0,0 @@ -#error obsolete header diff --git a/CondCore/DTPlugins/interface/DTConfigPluginHandler.h b/CondCore/DTPlugins/interface/DTConfigPluginHandler.h deleted file mode 100644 index c6ea5fb08b964..0000000000000 --- a/CondCore/DTPlugins/interface/DTConfigPluginHandler.h +++ /dev/null @@ -1 +0,0 @@ -#error obsolete header diff --git a/CondCore/HLTPlugins/plugins/AlCaRecoTriggerBits_PayloadInspector.cc b/CondCore/HLTPlugins/plugins/AlCaRecoTriggerBits_PayloadInspector.cc index 70096f1615be2..2a19317a2f8c1 100644 --- a/CondCore/HLTPlugins/plugins/AlCaRecoTriggerBits_PayloadInspector.cc +++ b/CondCore/HLTPlugins/plugins/AlCaRecoTriggerBits_PayloadInspector.cc @@ -3,6 +3,7 @@ #include "CondCore/CondDB/interface/Time.h" #include "CondFormats/HLTObjects/interface/AlCaRecoTriggerBits.h" +#include #include #include #include @@ -12,13 +13,14 @@ namespace { + using namespace cond::payloadInspector; + /************************************************ Display AlCaRecoTriggerBits mapping *************************************************/ - class AlCaRecoTriggerBits_Display : public cond::payloadInspector::PlotImage { + class AlCaRecoTriggerBits_Display : public PlotImage { public: - AlCaRecoTriggerBits_Display() - : cond::payloadInspector::PlotImage("Table of AlCaRecoTriggerBits") { + AlCaRecoTriggerBits_Display() : PlotImage("Table of AlCaRecoTriggerBits") { setSingleIov(true); } @@ -127,24 +129,33 @@ namespace { /************************************************ Compare AlCaRecoTriggerBits mapping *************************************************/ - class AlCaRecoTriggerBits_CompareBase : public cond::payloadInspector::PlotImage { + template + class AlCaRecoTriggerBits_CompareBase : public PlotImage { public: AlCaRecoTriggerBits_CompareBase() - : cond::payloadInspector::PlotImage("Table of AlCaRecoTriggerBits comparison") {} - - bool fill(const std::vector > &iovs) override { - std::vector > sorted_iovs = iovs; - - // make absolute sure the IOVs are sortd by since - std::sort(begin(sorted_iovs), end(sorted_iovs), [](auto const &t1, auto const &t2) { - return std::get<0>(t1) < std::get<0>(t2); - }); - - auto firstiov = sorted_iovs.front(); - auto lastiov = sorted_iovs.back(); + : PlotImage("Table of AlCaRecoTriggerBits comparison") {} + + bool fill() override { + // trick to deal with the multi-ioved tag and two tag case at the same time + auto theIOVs = PlotBase::getTag<0>().iovs; + auto f_tagname = PlotBase::getTag<0>().name; + std::string l_tagname = ""; + auto firstiov = theIOVs.front(); + std::tuple lastiov; + + // we don't support (yet) comparison with more than 2 tags + assert(this->m_plotAnnotations.ntags < 3); + + if (this->m_plotAnnotations.ntags == 2) { + auto tag2iovs = PlotBase::getTag<1>().iovs; + l_tagname = PlotBase::getTag<1>().name; + lastiov = tag2iovs.front(); + } else { + lastiov = theIOVs.back(); + } - std::shared_ptr last_payload = fetchPayload(std::get<1>(lastiov)); - std::shared_ptr first_payload = fetchPayload(std::get<1>(firstiov)); + std::shared_ptr last_payload = this->fetchPayload(std::get<1>(lastiov)); + std::shared_ptr first_payload = this->fetchPayload(std::get<1>(firstiov)); std::string lastIOVsince = std::to_string(std::get<0>(lastiov)); std::string firstIOVsince = std::to_string(std::get<0>(firstiov)); @@ -195,9 +206,9 @@ namespace { y_x1.push_back(y); s_x1.push_back("#scale[1.2]{Key}"); y_x2.push_back(y); - s_x2.push_back("#scale[1.2]{in IOV: " + firstIOVsince + "}"); + s_x2.push_back(fmt::sprintf("#scale[1.2]{%s in IOV: %s}", f_tagname, firstIOVsince)); y_x3.push_back(y); - s_x3.push_back("#scale[1.2]{in IOV: " + lastIOVsince + "}"); + s_x3.push_back(fmt::sprintf("#scale[1.2]{%s in IOV: %s}", l_tagname, lastIOVsince)); y -= pitch / 3; // print the ones missing in the last key @@ -391,21 +402,14 @@ namespace { } //canvas.SetCanvasSize(2000,(1-y)*1000); - std::string fileName(m_imageFileName); + std::string fileName(this->m_imageFileName); canvas.SaveAs(fileName.c_str()); return true; } }; - class AlCaRecoTriggerBits_Compare : public AlCaRecoTriggerBits_CompareBase { - public: - AlCaRecoTriggerBits_Compare() : AlCaRecoTriggerBits_CompareBase() { this->setSingleIov(false); } - }; - - class AlCaRecoTriggerBits_CompareTwoTags : public AlCaRecoTriggerBits_CompareBase { - public: - AlCaRecoTriggerBits_CompareTwoTags() : AlCaRecoTriggerBits_CompareBase() { this->setTwoTags(true); } - }; + using AlCaRecoTriggerBits_Compare = AlCaRecoTriggerBits_CompareBase; + using AlCaRecoTriggerBits_CompareTwoTags = AlCaRecoTriggerBits_CompareBase; } // namespace diff --git a/CondCore/HLTPlugins/test/test.sh b/CondCore/HLTPlugins/test/test.sh index 739e1cceed0b6..e9d1d5ca299cd 100755 --- a/CondCore/HLTPlugins/test/test.sh +++ b/CondCore/HLTPlugins/test/test.sh @@ -38,4 +38,17 @@ getPayloadData.py \ --db Prod \ --test; -mv *.png $W_DIR/plots/AlCaRecoTriggerBits_Compare.png \ No newline at end of file +mv *.png $W_DIR/plots/AlCaRecoTriggerBits_Compare.png + +getPayloadData.py \ + --plugin pluginAlCaRecoTriggerBits_PayloadInspector \ + --plot plot_AlCaRecoTriggerBits_CompareTwoTags \ + --tag AlCaRecoTriggerBits_TrackerDQM_v2_prompt \ + --tagtwo AlCaRecoTriggerBits_TrackerDQM_v6_offline \ + --time_type Run \ + --iovs '{"start_iov": "325492", "end_iov": "325492"}' \ + --iovstwo '{"start_iov": "304738", "end_iov": "304738"}' \ + --db Prod \ + --test; + +mv *.png $W_DIR/plots/AlCaRecoTriggerBits_CompareTwoTags.png diff --git a/CondCore/HLTPlugins/test/testAlCaRecoTriggerBitsPayloadInspector.cpp b/CondCore/HLTPlugins/test/testAlCaRecoTriggerBitsPayloadInspector.cpp index d08272a31ec45..4eb5a7ecf29e7 100644 --- a/CondCore/HLTPlugins/test/testAlCaRecoTriggerBitsPayloadInspector.cpp +++ b/CondCore/HLTPlugins/test/testAlCaRecoTriggerBitsPayloadInspector.cpp @@ -22,8 +22,8 @@ int main(int argc, char** argv) { std::string connectionString("frontier://FrontierProd/CMS_CONDITIONS"); std::string tag = "AlCaRecoHLTpaths8e29_1e31_v7_hlt"; - cond::Time_t start = boost::lexical_cast(270000); - cond::Time_t end = boost::lexical_cast(304820); + cond::Time_t start = static_cast(270000); + cond::Time_t end = static_cast(304820); std::cout << "## AlCaRecoTriggerBit Histos" << std::endl; diff --git a/CondCore/PopCon/interface/PopCon.h b/CondCore/PopCon/interface/PopCon.h index a35261ae4f32c..38baeaee8b071 100644 --- a/CondCore/PopCon/interface/PopCon.h +++ b/CondCore/PopCon/interface/PopCon.h @@ -29,7 +29,6 @@ namespace popcon { class PopCon { public: typedef cond::Time_t Time_t; - //typedef cond::Summary Summary; PopCon(const edm::ParameterSet& pset); @@ -38,9 +37,6 @@ namespace popcon { template void write(Source const& source); - template - void writeOne(T* payload, Time_t time); - private: cond::persistency::Session initialize(); void finalize(Time_t lastTill); @@ -75,58 +71,37 @@ namespace popcon { static constexpr const char* const s_version = "5.0"; }; - template - void PopCon::writeOne(T* payload, Time_t time) { - m_dbService->writeOne(payload, time, m_record); - } - - template - void displayHelper(Container const& payloads) { - typename Container::const_iterator it; - for (it = payloads.begin(); it != payloads.end(); it++) - edm::LogInfo("PopCon") << "Since " << (*it).time << std::endl; - } - - template - const std::string displayIovHelper(Container const& payloads) { - if (payloads.empty()) - return std::string("Nothing to transfer;"); - std::ostringstream s; - // when only 1 payload is transferred; - if (payloads.size() == 1) - s << "Since " << (*payloads.begin()).time << "; "; - else { - // when more than one payload are transferred; - s << "first payload Since " << (*payloads.begin()).time << ", " - << "last payload Since " << (*payloads.rbegin()).time << "; "; - } - return s.str(); - } - template void PopCon::write(Source const& source) { typedef typename Source::value_type value_type; typedef typename Source::Container Container; std::pair ret = source(initialize(), m_tagInfo, m_logDBEntry); - Container const& payloads = *ret.first; + Container const& iovs = *ret.first; if (m_LoggingOn) { + std::string msg("Nothing to transfer;"); + size_t niovs = iovs.size(); + if (niovs) { + std::ostringstream s; + if (niovs == 1) { + s << "Since " << (*iovs.begin()).first << "; "; + } else { + s << "first payload Since " << (*iovs.begin()).first << ", " + << "last payload Since " << (*iovs.rbegin()).first << "; "; + } + msg = s.str(); + } std::ostringstream s; - s << "PopCon v" << s_version << "; " << displayIovHelper(payloads) << ret.second; - //s << "PopCon v" << s_version << "; " << cond::userInfo() << displayIovHelper(payloads) << ret.second; + s << "PopCon v" << s_version << "; " << msg << ret.second; m_dbService->setLogHeaderForRecord(m_record, source.id(), s.str()); } - displayHelper(payloads); + for (auto it : iovs) + edm::LogInfo("PopCon") << "Since " << it.first << std::endl; - std::for_each(payloads.begin(), - payloads.end(), - std::bind(&popcon::PopCon::writeOne, - this, - std::bind(&Container::value_type::payload, std::placeholders::_1), - std::bind(&Container::value_type::time, std::placeholders::_1))); + m_dbService->writeMany(iovs, m_record); - finalize(payloads.empty() ? Time_t(0) : payloads.back().time); + finalize(iovs.empty() ? Time_t(0) : iovs.rbegin()->first); } } // namespace popcon diff --git a/CondCore/PopCon/interface/PopConAnalyzer.h b/CondCore/PopCon/interface/PopConAnalyzer.h index 2abe222978a92..9a4abcbf5dbe4 100644 --- a/CondCore/PopCon/interface/PopConAnalyzer.h +++ b/CondCore/PopCon/interface/PopConAnalyzer.h @@ -9,12 +9,12 @@ #include #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" namespace popcon { template - class PopConAnalyzer : public edm::EDAnalyzer { + class PopConAnalyzer : public edm::one::EDAnalyzer<> { public: typedef S SourceHandler; diff --git a/CondCore/PopCon/interface/PopConSourceHandler.h b/CondCore/PopCon/interface/PopConSourceHandler.h index ddfa95e66e62d..59f18796e66c4 100644 --- a/CondCore/PopCon/interface/PopConSourceHandler.h +++ b/CondCore/PopCon/interface/PopConSourceHandler.h @@ -32,44 +32,9 @@ namespace popcon { typedef T value_type; typedef PopConSourceHandler self; typedef cond::Time_t Time_t; - typedef cond::Summary Summary; - struct Triplet { - value_type* payload; - Summary* summary; - Time_t time; - }; - - typedef std::vector Container; - - typedef std::vector > OldContainer; - - class Ref { - public: - Ref() : m_dbsession() {} - Ref(cond::persistency::Session& dbsession, const std::string& hash) : m_dbsession(dbsession) { - m_d = m_dbsession.fetchPayload(hash); - } - ~Ref() {} - - Ref(const Ref& ref) : m_dbsession(ref.m_dbsession), m_d(ref.m_d) {} - - Ref& operator=(const Ref& ref) { - m_dbsession = ref.m_dbsession; - m_d = ref.m_d; - return *this; - } - - T const* ptr() const { return m_d.get(); } - - T const* operator->() const { return ptr(); } - // dereference operator - T const& operator*() const { return *ptr(); } - - private: - cond::persistency::Session m_dbsession; - std::shared_ptr m_d; - }; + typedef std::map > Container; + typedef std::unique_ptr Ref; PopConSourceHandler() : m_tagInfo(nullptr), m_logDBEntry(nullptr) {} @@ -78,7 +43,7 @@ namespace popcon { cond::TagInfo_t const& tagInfo() const { return *m_tagInfo; } // return last paylod of the tag - Ref lastPayload() const { return Ref(m_session, tagInfo().lastInterval.payloadId); } + Ref lastPayload() const { return m_session.fetchPayload(tagInfo().lastInterval.payloadId); } // return last successful log entry for the tag in question cond::LogDBEntry_t const& logDBEntry() const { return *m_logDBEntry; } @@ -102,10 +67,11 @@ namespace popcon { Container const& returnData() { getNewObjects(); - if (!m_to_transfer.empty()) - convertFromOld(); - sort(); - return m_triplets; + for (auto item : m_to_transfer) { + std::shared_ptr payload(item.first); + m_iovs.insert(std::make_pair(item.second, payload)); + } + return m_iovs; } std::string const& userTextLog() const { return m_userTextLog; } @@ -117,38 +83,9 @@ namespace popcon { // return a string identifing the source virtual std::string id() const = 0; - void sort() { - std::sort(m_triplets.begin(), - m_triplets.end(), - std::bind(std::less(), - std::bind(&Container::value_type::time, std::placeholders::_1), - std::bind(&Container::value_type::time, std::placeholders::_2))); - } - - // make sure to create a new one each time... - Summary* dummySummary(typename OldContainer::value_type const&) const { - return new cond::GenericSummary("not supplied"); - } - - void convertFromOld() { - std::for_each(m_to_transfer.begin(), - m_to_transfer.end(), - std::bind(&self::add, - this, - std::bind(&OldContainer::value_type::first, std::placeholders::_1), - std::bind(&self::dummySummary, this, std::placeholders::_1), - std::bind(&OldContainer::value_type::second, std::placeholders::_1))); - } - protected: cond::persistency::Session& dbSession() const { return m_session; } - int add(value_type* payload, Summary* summary, Time_t time) { - Triplet t = {payload, summary, time}; - m_triplets.push_back(t); - return m_triplets.size(); - } - private: mutable cond::persistency::Session m_session; @@ -159,12 +96,10 @@ namespace popcon { protected: //vector of payload objects and iovinfo to be transferred //class looses ownership of payload object - OldContainer m_to_transfer; + std::vector > m_to_transfer; - private: - Container m_triplets; + Container m_iovs; - protected: std::string m_userTextLog; }; } // namespace popcon diff --git a/CondCore/RunInfoPlugins/test/testRunInfoPayloadInspector.cpp b/CondCore/RunInfoPlugins/test/testRunInfoPayloadInspector.cpp index dc78079b886b4..5bd13a5c89358 100644 --- a/CondCore/RunInfoPlugins/test/testRunInfoPayloadInspector.cpp +++ b/CondCore/RunInfoPlugins/test/testRunInfoPayloadInspector.cpp @@ -22,8 +22,8 @@ int main(int argc, char** argv) { std::string connectionString("frontier://FrontierProd/CMS_CONDITIONS"); std::string tag = "runinfo_31X_hlt"; - cond::Time_t start = boost::lexical_cast(311950); - cond::Time_t end = boost::lexical_cast(312237); + cond::Time_t start = static_cast(311950); + cond::Time_t end = static_cast(312237); std::cout << "## RunInfo testing" << std::endl; diff --git a/CondCore/SiPixelPlugins/interface/SiPixelGainCalibHelper.h b/CondCore/SiPixelPlugins/interface/SiPixelGainCalibHelper.h index 5f8598040d07f..824c54cc592eb 100644 --- a/CondCore/SiPixelPlugins/interface/SiPixelGainCalibHelper.h +++ b/CondCore/SiPixelPlugins/interface/SiPixelGainCalibHelper.h @@ -426,7 +426,7 @@ namespace gainCalibHelper { auto paramValues = cond::payloadInspector::PlotBase::inputParamValues(); auto ip = paramValues.find("SetLog"); if (ip != paramValues.end()) { - auto answer = boost::lexical_cast(ip->second); + auto answer = ip->second; if (!SiPixelPI::checkAnswerOK(answer, setLog)) { throw cms::Exception(label_) << "\nERROR: " << answer @@ -590,7 +590,7 @@ namespace gainCalibHelper { auto paramValues = cond::payloadInspector::PlotBase::inputParamValues(); auto ip = paramValues.find("SetLog"); if (ip != paramValues.end()) { - auto answer = boost::lexical_cast(ip->second); + auto answer = ip->second; if (!SiPixelPI::checkAnswerOK(answer, setLog)) { throw cms::Exception(label_) << "\nERROR: " << answer diff --git a/CondCore/SiPixelPlugins/interface/SiPixelTemplateHelper.h b/CondCore/SiPixelPlugins/interface/SiPixelTemplateHelper.h index 7cf6dd251a897..873856e23addc 100644 --- a/CondCore/SiPixelPlugins/interface/SiPixelTemplateHelper.h +++ b/CondCore/SiPixelPlugins/interface/SiPixelTemplateHelper.h @@ -242,7 +242,10 @@ namespace templateHelper { h2_Header->GetXaxis()->SetBinLabel(idx, ""); for (unsigned int iy = 1; iy <= 12; iy++) { - if (tempValue.head.Dtype != 0 || uH < 0) { + // Some of the Phase-2 templates have DType = 0 for all partitions (TBPX, TEPX, TFPX) + // so they are distinguished by the uH strength value (<0). + // To avoid changing the behaviour of 0T payload (uH=-99) that case is treated separately + if (tempValue.head.Dtype != 0 || (uH < 0 && uH > -99)) { h2_ghost->SetBinContent(idx, iy, 1); } else { h2_ghost->SetBinContent(idx, iy, -1); diff --git a/CondCore/SiPixelPlugins/plugins/SiPixelFEDChannelContainer_PayloadInspector.cc b/CondCore/SiPixelPlugins/plugins/SiPixelFEDChannelContainer_PayloadInspector.cc index fd440af137345..1839bdf4fe5e5 100644 --- a/CondCore/SiPixelPlugins/plugins/SiPixelFEDChannelContainer_PayloadInspector.cc +++ b/CondCore/SiPixelPlugins/plugins/SiPixelFEDChannelContainer_PayloadInspector.cc @@ -82,7 +82,7 @@ namespace { auto paramValues = PlotBase::inputParamValues(); auto ip = paramValues.find("Scenarios"); if (ip != paramValues.end()) { - auto input = boost::lexical_cast(ip->second); + auto input = ip->second; typedef boost::tokenizer> tokenizer; boost::char_separator sep{","}; tokenizer tok{input, sep}; diff --git a/CondCore/SiPixelPlugins/test/testSiPixelPayloadInspector.cpp b/CondCore/SiPixelPlugins/test/testSiPixelPayloadInspector.cpp index 8a79edc14d72a..7f3871312afc2 100644 --- a/CondCore/SiPixelPlugins/test/testSiPixelPayloadInspector.cpp +++ b/CondCore/SiPixelPlugins/test/testSiPixelPayloadInspector.cpp @@ -33,8 +33,8 @@ int main(int argc, char** argv) { // Lorentz Angle std::string tag = "SiPixelLorentzAngle_v11_offline"; - cond::Time_t start = boost::lexical_cast(303790); - cond::Time_t end = boost::lexical_cast(324245); + cond::Time_t start = static_cast(303790); + cond::Time_t end = static_cast(324245); edm::LogPrint("testSiPixelPayloadInspector") << "## Exercising Lorentz Angle plots " << std::endl; @@ -68,7 +68,7 @@ int main(int argc, char** argv) { // 2 tags comparisons std::string tag2 = "SiPixelLorentzAngle_2016_ultralegacymc_v2"; - cond::Time_t start2 = boost::lexical_cast(1); + cond::Time_t start2 = static_cast(1); SiPixelLorentzAngleValueComparisonTwoTags histo6; histo6.process(connectionString, PI::mk_input(tag, start, start, tag2, start2, start2)); @@ -81,8 +81,8 @@ int main(int argc, char** argv) { // SiPixelQuality tag = "SiPixelQuality_forDigitizer_phase1_2018_permanentlyBad"; - start = boost::lexical_cast(1); - end = boost::lexical_cast(1); + start = static_cast(1); + end = static_cast(1); edm::LogPrint("testSiPixelPayloadInspector") << "## Exercising SiPixelQuality plots " << std::endl; @@ -97,8 +97,8 @@ int main(int argc, char** argv) { // SiPixelGainCalibrationOffline tag = "SiPixelGainCalibration_2009runs_express"; - start = boost::lexical_cast(312203); - end = boost::lexical_cast(312203); + start = static_cast(312203); + end = static_cast(312203); edm::LogPrint("testSiPixelPayloadInspector") << "## Exercising SiPixelGainCalibrationOffline plots " << std::endl; @@ -118,7 +118,7 @@ int main(int argc, char** argv) { histo13.process(connectionString, PI::mk_input(tag, start, end)); edm::LogPrint("testSiPixelPayloadInspector") << histo13.data() << std::endl; - end = boost::lexical_cast(326851); + end = static_cast(326851); SiPixelGainCalibOfflinePedestalComparisonSingleTag histo14; histo14.process(connectionString, PI::mk_input(tag, start, end)); @@ -143,8 +143,8 @@ int main(int argc, char** argv) { // SiPixelTemplates tag = "SiPixelTemplateDBObject38Tv3_express"; - start = boost::lexical_cast(326083); - end = boost::lexical_cast(326083); + start = static_cast(326083); + end = static_cast(326083); edm::LogPrint("testSiPixelPayloadInspector") << "## Exercising SiPixelTemplates plots " << std::endl; @@ -177,8 +177,8 @@ int main(int argc, char** argv) { // SiPixelGenErrors tag = "SiPixelGenErrorDBObject_phase1_BoR3_HV350_Tr2000"; - start = boost::lexical_cast(1); - end = boost::lexical_cast(1); + start = static_cast(1); + end = static_cast(1); edm::LogPrint("testSiPixelPayloadInspector") << "## Exercising SiPixelGenErrors plots " << std::endl; @@ -193,8 +193,8 @@ int main(int argc, char** argv) { // SiPixelQualityProbabilities tag = "SiPixelQualityProbabilities_UltraLegacy2018_v0_mc"; - start = boost::lexical_cast(1); - end = boost::lexical_cast(1); + start = static_cast(1); + end = static_cast(1); edm::LogPrint("testSiPixelPayloadInspector") << "## Exercising SiPixelQualityProbabilities plots " << std::endl; @@ -205,8 +205,8 @@ int main(int argc, char** argv) { // SiPixelDynamicInefficiency tag = "SiPixelDynamicInefficiency_PhaseI_v9"; - start = boost::lexical_cast(1); - end = boost::lexical_cast(1); + start = static_cast(1); + end = static_cast(1); edm::LogPrint("testSiPixelPayloadInspector") << "## Exercising SiPixeDynamicInefficiency plots " << std::endl; @@ -215,7 +215,7 @@ int main(int argc, char** argv) { edm::LogPrint("testSiPixelPayloadInspector") << histo26.data() << std::endl; tag2 = "SiPixelDynamicInefficiency_PhaseI_v6"; - start2 = boost::lexical_cast(1); + start2 = static_cast(1); SiPixelFullIneffROCsMapCompareTwoTags histo27; histo27.process(connectionString, PI::mk_input(tag, start, start, tag2, start2, start2)); diff --git a/CondCore/SiStripPlugins/plugins/SiStripApvGain_PayloadInspector.cc b/CondCore/SiStripPlugins/plugins/SiStripApvGain_PayloadInspector.cc index bc21118b11bc0..dc2b59002db67 100644 --- a/CondCore/SiStripPlugins/plugins/SiStripApvGain_PayloadInspector.cc +++ b/CondCore/SiStripPlugins/plugins/SiStripApvGain_PayloadInspector.cc @@ -566,7 +566,7 @@ namespace { auto paramValues = PlotBase::inputParamValues(); auto ip = paramValues.find("nsigma"); if (ip != paramValues.end()) { - nsigma = boost::lexical_cast(ip->second); + nsigma = std::stoul(ip->second); } // trick to deal with the multi-ioved tag and two tag case at the same time @@ -674,7 +674,7 @@ namespace { auto paramValues = PlotBase::inputParamValues(); auto ip = paramValues.find("nsigma"); if (ip != paramValues.end()) { - nsigma = boost::lexical_cast(ip->second); + nsigma = std::stoul(ip->second); edm::LogPrint("SiStripApvGain_PayloadInspector") << "using custom z-axis saturation: " << nsigma << " sigmas" << std::endl; } else { diff --git a/CondCore/SiStripPlugins/plugins/SiStripNoises_PayloadInspector.cc b/CondCore/SiStripPlugins/plugins/SiStripNoises_PayloadInspector.cc index f367b6ab14a05..213e1c848a583 100644 --- a/CondCore/SiStripPlugins/plugins/SiStripNoises_PayloadInspector.cc +++ b/CondCore/SiStripPlugins/plugins/SiStripNoises_PayloadInspector.cc @@ -117,7 +117,7 @@ namespace { auto paramValues = PlotBase::inputParamValues(); auto ip = paramValues.find("DetIds"); if (ip != paramValues.end()) { - auto input = boost::lexical_cast(ip->second); + auto input = ip->second; typedef boost::tokenizer> tokenizer; boost::char_separator sep{","}; tokenizer tok{input, sep}; @@ -316,7 +316,7 @@ namespace { auto paramValues = PlotBase::inputParamValues(); auto ip = paramValues.find("DetId"); if (ip != paramValues.end()) { - the_detid = boost::lexical_cast(ip->second); + the_detid = std::stoul(ip->second); } if (payload.get()) { @@ -962,7 +962,7 @@ namespace { auto paramValues = PlotBase::inputParamValues(); auto ip = paramValues.find("nsigma"); if (ip != paramValues.end()) { - nsigma = boost::lexical_cast(ip->second); + nsigma = std::stoul(ip->second); } // trick to deal with the multi-ioved tag and two tag case at the same time diff --git a/CondCore/SiStripPlugins/plugins/SiStripPedestals_PayloadInspector.cc b/CondCore/SiStripPlugins/plugins/SiStripPedestals_PayloadInspector.cc index 862300c85b89c..19089ff7b30ad 100644 --- a/CondCore/SiStripPlugins/plugins/SiStripPedestals_PayloadInspector.cc +++ b/CondCore/SiStripPlugins/plugins/SiStripPedestals_PayloadInspector.cc @@ -116,7 +116,7 @@ namespace { auto paramValues = PlotBase::inputParamValues(); auto ip = paramValues.find("DetIds"); if (ip != paramValues.end()) { - auto input = boost::lexical_cast(ip->second); + auto input = ip->second; typedef boost::tokenizer> tokenizer; boost::char_separator sep{","}; tokenizer tok{input, sep}; @@ -315,7 +315,7 @@ namespace { auto paramValues = PlotBase::inputParamValues(); auto ip = paramValues.find("DetId"); if (ip != paramValues.end()) { - the_detid = boost::lexical_cast(ip->second); + the_detid = std::stoul(ip->second); } if (payload.get()) { diff --git a/CondCore/SiStripPlugins/test/testSiStripPayloadInspector.cpp b/CondCore/SiStripPlugins/test/testSiStripPayloadInspector.cpp index ec3e2f0715e65..dad2e4c07b799 100644 --- a/CondCore/SiStripPlugins/test/testSiStripPayloadInspector.cpp +++ b/CondCore/SiStripPlugins/test/testSiStripPayloadInspector.cpp @@ -31,8 +31,9 @@ int main(int argc, char** argv) { // Gains std::string tag = "SiStripApvGain_FromParticles_GR10_v11_offline"; - cond::Time_t start = boost::lexical_cast(132440); - cond::Time_t end = boost::lexical_cast(285368); + + cond::Time_t start = static_cast(132440); + cond::Time_t end = static_cast(285368); py::dict inputs; edm::LogPrint("testSiStripPayloadInspector") << "## Exercising Gains plots " << std::endl; @@ -72,8 +73,8 @@ int main(int argc, char** argv) { // Noise tag = "SiStripNoise_GR10_v1_hlt"; - start = boost::lexical_cast(312968); - end = boost::lexical_cast(313120); + start = static_cast(312968); + end = static_cast(313120); edm::LogPrint("testSiStripPayloadInspector") << "## Exercising Noise plots " << std::endl; @@ -98,8 +99,8 @@ int main(int argc, char** argv) { // Pedestals tag = "SiStripPedestals_v2_prompt"; - start = boost::lexical_cast(303420); - end = boost::lexical_cast(313120); + start = static_cast(303420); + end = static_cast(313120); edm::LogPrint("testSiStripPayloadInspector") << "## Exercising Pedestal plots " << std::endl; @@ -121,8 +122,8 @@ int main(int argc, char** argv) { //Latency tag = "SiStripLatency_v2_prompt"; - start = boost::lexical_cast(315347); - end = boost::lexical_cast(316675); + start = static_cast(315347); + end = static_cast(316675); edm::LogPrint("testSiStripPayloadInspector") << "## Exercising Latency plots " << std::endl; @@ -136,8 +137,8 @@ int main(int argc, char** argv) { //Threshold tag = "SiStripThreshold_v1_prompt"; - start = boost::lexical_cast(315352); - end = boost::lexical_cast(315460); + start = static_cast(315352); + end = static_cast(315460); edm::LogPrint("testSiStripPayloadInspector") << "## Exercising Threshold plots " << std::endl; @@ -147,8 +148,8 @@ int main(int argc, char** argv) { // test SiStripTkMaps tag = "SiStripBadComponents_startupMC_for2017_v1_mc"; - start = boost::lexical_cast(1); - end = boost::lexical_cast(1); + start = static_cast(1); + end = static_cast(1); edm::LogPrint("testSiStripPayloadInspector") << "## Exercising SiStripTkMaps plots " << std::endl; diff --git a/CondCore/Utilities/bin/conddb_test_read.cpp b/CondCore/Utilities/bin/conddb_test_read.cpp index a4024d9fac3b7..2cbb9d44c4672 100644 --- a/CondCore/Utilities/bin/conddb_test_read.cpp +++ b/CondCore/Utilities/bin/conddb_test_read.cpp @@ -53,7 +53,7 @@ int cond::TestReadUtilities::execute() { std::string siovs = getOptionValue("iovs"); tokenizer tok(siovs); for (auto &t : tok) { - iovs.push_back(boost::lexical_cast(t)); + iovs.push_back(std::stoull(t)); } } diff --git a/CondCore/Utilities/interface/Payload2XMLModule.h b/CondCore/Utilities/interface/Payload2XMLModule.h index 2732898484478..40f9eeed46077 100644 --- a/CondCore/Utilities/interface/Payload2XMLModule.h +++ b/CondCore/Utilities/interface/Payload2XMLModule.h @@ -19,6 +19,17 @@ namespace py = pybind11; .def(py::init<>()) \ .def("write", &Payload2xml::write); +#include +namespace cond { + inline std::string boost_version_label() { + std::stringstream ss; + ss << BOOST_VERSION / 100000 << "."; + ss << BOOST_VERSION / 100 % 1000 << "."; + ss << BOOST_VERSION % 100; + return ss.str(); + } +} // namespace cond + namespace { // Avoid cluttering the global namespace. template diff --git a/CondCore/Utilities/plugins/Module_2XML.cc b/CondCore/Utilities/plugins/Module_2XML.cc index ad1e52c5724d5..dfc0c16321ddb 100644 --- a/CondCore/Utilities/plugins/Module_2XML.cc +++ b/CondCore/Utilities/plugins/Module_2XML.cc @@ -2,6 +2,7 @@ #include "CondCore/Utilities/src/CondFormats.h" PAYLOAD_2XML_MODULE(pluginUtilities_payload2xml) { + m.def("boost_version_label", &cond::boost_version_label, "Get boost version for this release"); PAYLOAD_2XML_CLASS(AlCaRecoTriggerBits); PAYLOAD_2XML_CLASS(AlignPCLThresholds); PAYLOAD_2XML_CLASS(AlignmentErrors); @@ -31,6 +32,8 @@ PAYLOAD_2XML_MODULE(pluginUtilities_payload2xml) { PAYLOAD_2XML_CLASS(CTPPSPixelDAQMapping); PAYLOAD_2XML_CLASS(CTPPSPixelGainCalibrations); PAYLOAD_2XML_CLASS(PPSAlignmentConfig) + PAYLOAD_2XML_CLASS(PPSAlignmentConfiguration) + PAYLOAD_2XML_CLASS(PPSAssociationCuts) PAYLOAD_2XML_CLASS(CastorChannelQuality); PAYLOAD_2XML_CLASS(CastorElectronicsMap); PAYLOAD_2XML_CLASS(CastorGainWidths); diff --git a/CondCore/Utilities/python/CondDBFW/command_line.py b/CondCore/Utilities/python/CondDBFW/command_line.py index 73074e65e6fd8..4462fbb7285b0 100755 --- a/CondCore/Utilities/python/CondDBFW/command_line.py +++ b/CondCore/Utilities/python/CondDBFW/command_line.py @@ -5,8 +5,6 @@ Works by taking the main keyword (first command given to the script), passing that to the function that will deal with that action, along with the following arguments as parameters for that function. """ -from __future__ import print_function -from __future__ import absolute_import from . import querying import argparse @@ -112,7 +110,7 @@ def copy_tag(arguments): # set end_of_validity to -1 because sqlite doesn't support long ints source_tag.end_of_validity = -1 source_tag.name = arguments.dest_tag - source_tag.modification_time = datetime.datetime.now() + source_tag.modification_time = datetime.datetime.utcnow() # create new iovs new_iovs = [] @@ -154,7 +152,7 @@ def copy_global_tag(arguments): tags = source_connection.tag(name=tags) # copy global tag first - global_tag.insertion_time = datetime.datetime.now() + global_tag.insertion_time = datetime.datetime.utcnow() global_tag.validity = -1 dest_connection.write_and_commit(global_tag) diff --git a/CondCore/Utilities/python/CondDBFW/data_formats.py b/CondCore/Utilities/python/CondDBFW/data_formats.py index e21a369c00911..4e5daadb36144 100644 --- a/CondCore/Utilities/python/CondDBFW/data_formats.py +++ b/CondCore/Utilities/python/CondDBFW/data_formats.py @@ -6,7 +6,6 @@ Note: may also contain a decorator that can wrap a class around a function that contains a script (future development). """ -from __future__ import absolute_import from .data_sources import json_data_node, json_list, json_dict, json_basic @@ -30,7 +29,7 @@ def to_datatables(script): def new_script(self, connection): try: data = script(self, connection) - if(isinstance(data, list)): + if(type(data) == list): data = _json_data_node.make(data) return to_datatables(data) except (KeyError, TypeError) as e: @@ -64,19 +63,19 @@ def _to_array_of_dicts(data): headers = data.get("headers").data() data_list = data.get("data").data() def unicode_to_str(string): - return str(string) if isinstance(string, unicode) else string - headers = map(unicode_to_str, headers) + return str(string) if type(string) == str else string + headers = list(map(unicode_to_str, headers)) def row_to_dict(row): - row = map(unicode_to_str, row) - return dict(zip(headers, row)) - array_of_dicts = map(row_to_dict, data_list) + row = list(map(unicode_to_str, row)) + return dict(list(zip(headers, row))) + array_of_dicts = list(map(row_to_dict, data_list)) return json_data_node.make(array_of_dicts) def _to_datatables(data): - headers = map(str, data.get(0).data().keys()) + headers = list(map(str, list(data.get(0).data().keys()))) new_data = [] for n in range(0, len(data.data())): - new_data.append(map(lambda entry : str(entry) if isinstance(entry, unicode) else entry, data.get(n).data().values())) + new_data.append([str(entry) if type(entry) == str else entry for entry in list(data.get(n).data().values())]) return json_data_node.make({ "headers" : headers, "data" : new_data diff --git a/CondCore/Utilities/python/CondDBFW/data_sources.py b/CondCore/Utilities/python/CondDBFW/data_sources.py index 2737308574dcc..1ad43a4d00255 100644 --- a/CondCore/Utilities/python/CondDBFW/data_sources.py +++ b/CondCore/Utilities/python/CondDBFW/data_sources.py @@ -3,8 +3,6 @@ This file contains the base DataSource class, and all sub classes that implement their own methods for parsing data. """ -from __future__ import print_function -from __future__ import absolute_import import json @@ -107,7 +105,7 @@ def __init__(self, sqlite_file_name): sql_query = "select %s from %s" % (column_string, table) results = cursor.execute(sql_query).fetchall() for n in range(0, len(results)): - results[n] = dict(zip(table_to_columns[table], map(str, results[n]))) + results[n] = dict(list(zip(table_to_columns[table], list(map(str, results[n]))))) table_to_data[str(table)] = results self._data = json_data_node.make(table_to_data) else: @@ -129,9 +127,9 @@ def __init__(self, data=None): # be created in code that shouldn't be doing it. @staticmethod def make(data): - if isinstance(data, list): + if type(data) == list: return json_list(data) - elif isinstance(data, dict): + elif type(data) == dict: return json_dict(data) else: return json_basic(data) @@ -159,12 +157,12 @@ def find(self, type_name): # traverse json_data_node structure, and find all lists # if this node in the structure is a list, return all sub lists lists = [] - if isinstance(self._data, type_name): + if type(self._data) == type_name: lists.append(self._data) - if isinstance(self._data, list): + if type(self._data) == list: for item in self._data: lists += json_data_node.make(item).find(type_name) - elif isinstance(self._data, dict): + elif type(self._data) == dict: for key in self._data: lists += json_data_node.make(self._data[key]).find(type_name) return lists @@ -198,7 +196,7 @@ def add_child(self, data): def __iter__(self): return self - def next(self): + def __next__(self): if self.iterator_index > len(self._data)-1: self.reset() raise StopIteration @@ -227,13 +225,13 @@ def indices(self, *indices): def get_members(self, member_name): # assume self.data() is a list - if not(type(member_name) in [str, unicode]): + if not(type(member_name) in [str, str]): raise TypeError("Value given for member name must be a string.") type_of_first_item = self.data()[0].__class__ for item in self.data(): if item.__class__ != type_of_first_item: return None - return json_data_node.make(map(lambda item : getattr(item, member_name), self.data())) + return json_data_node.make([getattr(item, member_name) for item in self.data()]) # format methods @@ -245,7 +243,7 @@ def as_dicts(self, convert_timestamps=False): if self.get(0).data().__class__.__name__ in ["GlobalTag", "GlobalTagMap", "Tag", "IOV", "Payload"]: # copy data - new_data = map(lambda item : item.as_dicts(convert_timestamps=convert_timestamps), [item for item in self.data()]) + new_data = [item.as_dicts(convert_timestamps=convert_timestamps) for item in [item for item in self.data()]] return new_data else: print("Data in json_list was not the correct type.") @@ -281,7 +279,7 @@ def as_table(self, fit=["all"], columns=None, hide=None, col_width=None, row_num table_name = None data = self.data() # gets headers stored in first dictionary - headers = data[0].keys() + headers = list(data[0].keys()) if columns != None: headers = columns @@ -298,7 +296,7 @@ def as_table(self, fit=["all"], columns=None, hide=None, col_width=None, row_num if col_width == None: import subprocess - table_width = int(0.95*int(subprocess.check_output(["stty", "size"]).split(" ")[1])) + table_width = int(0.95*int(subprocess.check_output([b'stty', b'size']).split(b' ')[1])) col_width = int(table_width/len(headers)) if hide != None: @@ -335,7 +333,7 @@ def cell(content, header, col_width, fit): for column in fit: if not(column in headers): - print("'%s' is not a valid column." % column) + print(("'%s' is not a valid column." % column)) return column_to_width[column] = max_width_of_column(column, data) diff --git a/CondCore/Utilities/python/CondDBFW/models.py b/CondCore/Utilities/python/CondDBFW/models.py index ca8f783445122..ee9c2773da8fb 100644 --- a/CondCore/Utilities/python/CondDBFW/models.py +++ b/CondCore/Utilities/python/CondDBFW/models.py @@ -8,8 +8,6 @@ so these will not work in a normal context outside the framework. """ -from __future__ import print_function -from __future__ import absolute_import import json import datetime @@ -24,7 +22,7 @@ exit() from . import data_sources, data_formats -import urllib, urllib2, base64 +import urllib.request, urllib.parse, urllib.error, urllib.request, urllib.error, urllib.parse, base64 from copy import deepcopy # get utility functions @@ -50,8 +48,8 @@ def session_independent_object(object, schema=None): return new_object def session_independent(objects): - if isinstance(objects, list): - return map(session_independent_object, objects) + if type(objects) == list: + return list(map(session_independent_object, objects)) else: # assume objects is a single object (not a list) return session_independent_object(objects) @@ -153,9 +151,9 @@ def apply(self): def apply_filter(orm_query, orm_class, attribute, value): filter_attribute = getattr(orm_class, attribute) - if isinstance(value, list): + if type(value) == list: orm_query = orm_query.filter(filter_attribute.in_(value)) - elif isinstance(value, data_sources.json_list): + elif type(value) == data_sources.json_list: orm_query = orm_query.filter(filter_attribute.in_(value.data())) elif type(value) in [Range, Radius]: @@ -163,7 +161,7 @@ def apply_filter(orm_query, orm_class, attribute, value): plus = value.get_end() orm_query = orm_query.filter(and_(filter_attribute >= minus, filter_attribute <= plus)) - elif isinstance(value, RegExp): + elif type(value) == RegExp: # Relies on being a SingletonThreadPool @@ -181,7 +179,7 @@ def apply_filter(orm_query, orm_class, attribute, value): return orm_query def apply_filters(orm_query, orm_class, **filters): - for (key, value) in filters.items(): + for (key, value) in list(filters.items()): if not(key in ["amount"]): orm_query = apply_filter(orm_query, orm_class, key, value) return orm_query @@ -189,8 +187,11 @@ def apply_filters(orm_query, orm_class, **filters): def generate(map_blobs=False, class_name=None): Base = declarative_base() + schema = {"schema" : "CMS_CONDITIONS"} + fk_schema_prefix = ("%s." % schema["schema"]) if schema else "" class GlobalTag(Base): + __table_args__ = schema __tablename__ = 'GLOBAL_TAG' headers = ["name", "validity", "description", "release", "insertion_time", "snapshot_time", "scenario", "workflow", "type"] @@ -246,7 +247,7 @@ def all(self, **kwargs): """ query = self.session.query(GlobalTag) query = apply_filters(query, self.__class__, **kwargs) - amount = kwargs["amount"] if "amount" in kwargs.keys() else None + amount = kwargs["amount"] if "amount" in list(kwargs.keys()) else None query_result = query.order_by(GlobalTag.name).limit(amount).all() gts = data_sources.json_data_node.make(query_result) return gts @@ -258,10 +259,10 @@ def tags(self, **kwargs): kwargs["global_tag_name"] = self.name all_tags = self.session.query(GlobalTagMap.global_tag_name, GlobalTagMap.record, GlobalTagMap.label, GlobalTagMap.tag_name) all_tags = apply_filters(all_tags, GlobalTagMap, **kwargs) - amount = kwargs["amount"] if "amount" in kwargs.keys() else None + amount = kwargs["amount"] if "amount" in list(kwargs.keys()) else None all_tags = all_tags.order_by(GlobalTagMap.tag_name).limit(amount).all() column_names = ["global_tag_name", "record", "label", "tag_name"] - all_tags = map(lambda row : dict(zip(column_names, map(to_timestamp, row))), all_tags) + all_tags = [dict(list(zip(column_names, list(map(to_timestamp, row))))) for row in all_tags] all_tags = data_formats._dicts_to_orm_objects(GlobalTagMap, all_tags) return data_sources.json_data_node.make(all_tags) @@ -281,7 +282,7 @@ def iovs(self, **kwargs): tag_names = self.tags().get_members("tag_name").data() iovs_all_tags = self.session.query(IOV).filter(IOV.tag_name.in_(tag_names)) iovs_all_tags = apply_filters(iovs_all_tags, IOV, **kwargs) - amount = kwargs["amount"] if "amount" in kwargs.keys() else None + amount = kwargs["amount"] if "amount" in list(kwargs.keys()) else None iovs_all_tags = iovs_all_tags.limit(amount).subquery() # now, join Global Tag Map table onto IOVs @@ -293,7 +294,7 @@ def iovs(self, **kwargs): iovs_gt_tags = iovs_gt_tags.order_by(iovs_all_tags.c.since).all() column_names = ["tag_name", "since", "payload_hash", "insertion_time"] - all_iovs = map(lambda row : dict(zip(column_names, row)), iovs_gt_tags) + all_iovs = [dict(list(zip(column_names, row))) for row in iovs_gt_tags] all_iovs = data_formats._dicts_to_orm_objects(IOV, all_iovs) return data_sources.json_data_node.make(all_iovs) @@ -335,14 +336,15 @@ def diff(self, gt): return data_sources.json_data_node.make(table) class GlobalTagMap(Base): + __table_args__ = schema __tablename__ = 'GLOBAL_TAG_MAP' headers = ["global_tag_name", "record", "label", "tag_name"] - global_tag_name = Column(String(100), ForeignKey('GLOBAL_TAG.name'), primary_key=True, nullable=False) - record = Column(String(100), ForeignKey('RECORDS.record'), primary_key=True, nullable=False) + global_tag_name = Column(String(100), ForeignKey(fk_schema_prefix + 'GLOBAL_TAG.name'), primary_key=True, nullable=False) + record = Column(String(100), ForeignKey(fk_schema_prefix + 'RECORDS.record'), primary_key=True, nullable=False) label = Column(String(100), primary_key=True, nullable=False) - tag_name = Column(String(100), ForeignKey('TAG.name'), nullable=False) + tag_name = Column(String(100), ForeignKey(fk_schema_prefix + 'TAG.name'), nullable=False) def __init__(self, dictionary={}, convert_timestamps=True): # assign each entry in a kwargs @@ -372,11 +374,12 @@ def as_dicts(self, convert_timestamps=False): class GlobalTagMapRequest(Base): + __table_args__ = schema __tablename__ = 'GLOBAL_TAG_MAP_REQUEST' queue = Column(String(100), primary_key=True, nullable=False) - tag = Column(String(100), ForeignKey('TAG.name'), primary_key=True, nullable=False) - record = Column(String(100), ForeignKey('RECORDS.record'), primary_key=True, nullable=False) + tag = Column(String(100), ForeignKey(fk_schema_prefix + 'TAG.name'), primary_key=True, nullable=False) + record = Column(String(100), ForeignKey(fk_schema_prefix + 'RECORDS.record'), primary_key=True, nullable=False) label = Column(String(100), primary_key=True, nullable=False) status = Column(String(1), nullable=False) description = Column(String(4000), nullable=False) @@ -420,13 +423,14 @@ def to_array(self): return [self.queue, self.tag, self.record, self.label, status_full_name(self.status), to_timestamp(self.time_submitted), to_timestamp(self.last_edited)] class IOV(Base): + __table_args__ = schema __tablename__ = 'IOV' headers = ["tag_name", "since", "payload_hash", "insertion_time"] - tag_name = Column(String(4000), ForeignKey('TAG.name'), primary_key=True, nullable=False) + tag_name = Column(String(4000), ForeignKey(fk_schema_prefix + 'TAG.name'), primary_key=True, nullable=False) since = Column(Integer, primary_key=True, nullable=False) - payload_hash = Column(String(40), ForeignKey('PAYLOAD.hash'), nullable=False) + payload_hash = Column(String(40), ForeignKey(fk_schema_prefix + 'PAYLOAD.hash'), nullable=False) insertion_time = Column(DateTime, primary_key=True, nullable=False) def __init__(self, dictionary={}, convert_timestamps=True): @@ -463,12 +467,13 @@ def all(self, **kwargs): """ query = self.session.query(IOV) query = apply_filters(query, IOV, **kwargs) - amount = kwargs["amount"] if "amount" in kwargs.keys() else None + amount = kwargs["amount"] if "amount" in list(kwargs.keys()) else None query_result = query.order_by(IOV.tag_name).order_by(IOV.since).limit(amount).all() return data_sources.json_data_node.make(query_result) class Payload(Base): + __table_args__ = schema __tablename__ = 'PAYLOAD' headers = ["hash", "object_type", "version", "insertion_time"] @@ -536,8 +541,8 @@ def parent_tags(self, **kwargs): query = self.session.query(IOV.tag_name) query = apply_filters(query, IOV, **kwargs) query_result = query.all() - tag_names = map(lambda entry : entry[0], query_result) - amount = kwargs["amount"] if "amount" in kwargs.keys() else None + tag_names = [entry[0] for entry in query_result] + amount = kwargs["amount"] if "amount" in list(kwargs.keys()) else None tags = self.session.query(Tag).filter(Tag.name.in_(tag_names)).order_by(Tag.name).limit(amount).all() return data_sources.json_data_node.make(tags) @@ -547,12 +552,13 @@ def all(self, **kwargs): """ query = self.session.query(Payload) query = apply_filters(query, Payload, **kwargs) - amount = kwargs["amount"] if "amount" in kwargs.keys() else None + amount = kwargs["amount"] if "amount" in list(kwargs.keys()) else None query_result = query.order_by(Payload.hash).limit(amount).all() return data_sources.json_data_node.make(query_result) class Record(Base): + __table_args__ = schema __tablename__ = 'RECORDS' headers = ["record", "object", "type"] @@ -583,16 +589,17 @@ def all(self, **kwargs): """ query = self.session.query(Record) query = apply_filters(query, Record, kwargs) - amount = kwargs["amount"] if "amount" in kwargs.keys() else None + amount = kwargs["amount"] if "amount" in list(kwargs.keys()) else None query_result = query.order_by(Record.record).limit(amount).all() return data_sources.json_data_node.make(query_result) class Tag(Base): + __table_args__ = schema __tablename__ = 'TAG' headers = ["name", "time_type", "object_type", "synchronization", "end_of_validity",\ - "description", "last_validated_time", "insertion_time", "modification_time"] + "description", "last_validated_time", "insertion_time", "modification_time", "protection_code"] name = Column(String(4000), primary_key=True, nullable=False) time_type = Column(String(4000), nullable=False) @@ -603,6 +610,7 @@ class Tag(Base): last_validated_time = Column(BigInteger, nullable=False) insertion_time = Column(DateTime, nullable=False) modification_time = Column(DateTime, nullable=False) + protection_code = Column(Integer, nullable=False) record = None label = None @@ -656,8 +664,8 @@ def parent_global_tags(self, **kwargs): query = apply_filters(query, GlobalTagMap, **kwargs) query_result = query.all() if len(query_result) != 0: - global_tag_names = map(lambda entry : entry[0], query_result) - amount = kwargs["amount"] if "amount" in kwargs.keys() else None + global_tag_names = [entry[0] for entry in query_result] + amount = kwargs["amount"] if "amount" in list(kwargs.keys()) else None global_tags = self.session.query(GlobalTag).filter(GlobalTag.name.in_(global_tag_names)).order_by(GlobalTag.name).limit(amount).all() else: global_tags = None @@ -669,7 +677,7 @@ def all(self, **kwargs): """ query = self.session.query(Tag) query = apply_filters(query, Tag, **kwargs) - amount = kwargs["amount"] if "amount" in kwargs.keys() else None + amount = kwargs["amount"] if "amount" in list(kwargs.keys()) else None query_result = query.order_by(Tag.name).limit(amount).all() return data_sources.json_data_node.make(query_result) @@ -680,7 +688,7 @@ def iovs(self, **kwargs): # filter_params contains a list of columns to filter the iovs by iovs_query = self.session.query(IOV).filter(IOV.tag_name == self.name) iovs_query = apply_filters(iovs_query, IOV, **kwargs) - amount = kwargs["amount"] if "amount" in kwargs.keys() else None + amount = kwargs["amount"] if "amount" in list(kwargs.keys()) else None iovs = iovs_query.order_by(IOV.since).limit(amount).all() return data_sources.json_data_node.make(iovs) @@ -738,8 +746,8 @@ def diff(self, tag, short=False): raise TypeError("Tag given must be a CondDBFW Tag object.") # get lists of iovs - iovs1 = dict(map(lambda iov : (iov.since, iov.payload_hash), self.iovs().data())) - iovs2 = dict(map(lambda iov : (iov.since, iov.payload_hash), tag.iovs().data())) + iovs1 = dict([(iov.since, iov.payload_hash) for iov in self.iovs().data()]) + iovs2 = dict([(iov.since, iov.payload_hash) for iov in tag.iovs().data()]) iovs = [(x, iovs1.get(x), iovs2.get(x)) for x in sorted(set(iovs1) | set(iovs2))] iovs.append(("Infinity", 1, 2)) @@ -851,7 +859,7 @@ def merge_into(self, tag, range_object): else: # otherwise, iterate down from n to find the last sqlite iov, # and assign that hash - for i in reversed(range(0,n)): + for i in reversed(list(range(0,n))): if new_iovs_list[i].source == "sqlite": print("change %s to %s at since %d" % (iov.payload_hash, new_iovs_list[i].payload_hash, iov.since)) iov.payload_hash = new_iovs_list[i].payload_hash @@ -867,7 +875,7 @@ def merge_into(self, tag, range_object): new_iov_list_copied = sorted(new_iov_list_copied, key=lambda iov : iov.since) - now = datetime.datetime.now() + now = datetime.datetime.utcnow() new_iovs = [] for iov in new_iov_list_copied: @@ -881,8 +889,47 @@ def merge_into(self, tag, range_object): return new_tag #sqlite.write_and_commit(new_iovs) + + class TagAuthorization(Base): + __table_args__ = schema + __tablename__ = 'TAG_AUTHORIZATION' + + headers = ["tag_name", "access_type", "credential", "credential_type"] + + tag_name = Column(String(100), ForeignKey(fk_schema_prefix + 'TAG.name'), primary_key=True, nullable=False) + access_type = Column(Integer, nullable=False) + credential = Column(String(100), primary_key=True, nullable=False) + credential_type = Column(Integer, nullable=False) + + def as_dicts(self): + """ + Returns dictionary form of this Tag Authorization. + """ + return { + "tag_name" : self.tag_name, + "access_type" : self.access_type, + "credential" : self.credential, + "credential_type" : self.credential_type + } + + def __repr__(self): + return '' % (self.tag_name, self.access_type, self.credential, self.credential_type) + + def to_array(self): + return [self.tag_name, self.access_type, self.credential, self.credential_type] + + def all(self, **kwargs): + """ + Returns `amount` Records ordered by Record record. + """ + query = self.session.query(TagAuthorization) + query = apply_filters(query, TagAuthorization, kwargs) + amount = kwargs["amount"] if "amount" in list(kwargs.keys()) else None + query_result = query.order_by(TagAuthorization.tag).limit(amount).all() + return data_sources.json_data_node.make(query_result) + classes = {"globaltag" : GlobalTag, "iov" : IOV, "globaltagmap" : GlobalTagMap,\ - "payload" : Payload, "tag" : Tag, "Base" : Base} + "payload" : Payload, "tag" : Tag, "TagAuthorization": TagAuthorization, "Base" : Base} if class_name == None: return classes diff --git a/CondCore/Utilities/python/CondDBFW/querying.py b/CondCore/Utilities/python/CondDBFW/querying.py index d7d3528a8e7db..1de2aa3eaddd1 100644 --- a/CondCore/Utilities/python/CondDBFW/querying.py +++ b/CondCore/Utilities/python/CondDBFW/querying.py @@ -6,8 +6,6 @@ connection class can also take a pre-constructed engine - useful for web services. """ -from __future__ import print_function -from __future__ import absolute_import import sqlalchemy from sqlalchemy import create_engine, text, or_ @@ -23,436 +21,439 @@ import sys class connection(object): - engine = None - connection = None - session = None - connection_data = None - netrc_authenticators = None - secrets = None - """ + engine = None + connection = None + session = None + connection_data = None + netrc_authenticators = None + secrets = None + """ Given a connection string, parses the connection string and connects. """ - def __init__(self, connection_data, mode=None, map_blobs=False, secrets=None, pooling=False): - - self._pooling = pooling - - # add querying utility properties - # these must belong to the connection since the way in which their values are handled - # depends on the database being connected to. - self.range = models.Range - self.radius = models.Radius - self.regexp = models.RegExp - self.regexp.connection_object = self - - if type(connection_data) in [str, unicode]: - # if we've been given a connection string, process it - self.connection_data = new_connection_dictionary(connection_data, secrets=secrets, mode=mode) - self.schema = self.connection_data.get("schema") if self.connection_data.get("schema") != None else "" - - self.range.database_type = self.connection_data["host"] - self.radius.database_type = self.connection_data["host"] - self.regexp.database_type = self.connection_data["host"] - else: - self.connection_data = connection_data - # assume we have an engine - # we need to take the string representation so we know which type of db we're aiming at - engine_string = str(connection_data) - db_type = None - if "oracle" in engine_string: - db_type = "oracle" - elif "frontier" in engine_string: - db_type = "frontier" - elif "sqlite" in engine_string: - db_type = "sqlite" - - self.range.database_type = db_type - self.radius.database_type = db_type - self.regexp.database_type = db_type - - from . import models as ms - self.models = ms.generate(map_blobs) - #self.base = self.models["Base"] - - def setup(self): - """ - Setup engine with given credentials from netrc file, and make a session maker. - """ - - if isinstance(self.connection_data, dict): - self.engine = engine_from_dictionary(self.connection_data, pooling=self._pooling) - else: - # we've been given an engine by the user - # use it as the engine - self.engine = self.connection_data - - self.sessionmaker = sessionmaker(bind=self.engine) - self.session = self.sessionmaker() - self.factory = factory(self) - - # assign correct schema for database name to each model - tmp_models_dict = {} - for key in self.models: - if self.models[key].__class__ == sqlalchemy.ext.declarative.api.DeclarativeMeta\ - and str(self.models[key].__name__) != "Base": - - if isinstance(self.connection_data, dict): - # we can only extract the secrets and schema individuall - # if we were given a dictionary... if we were given an engine - # we can't do this without parsing the connection string from the engine - # - a wide range of which it will be difficult to support! - self.models[key].__table__.schema = self.connection_data["schema"] - self.models[key].secrets = self.connection_data["secrets"] - - self.models[key].session = self.session - # isn't used anywhere - comment it out for now - #self.models[key].authentication = self.netrc_authenticators - self.models[key].connection = self - tmp_models_dict[key.lower()] = self.models[key] - tmp_models_dict[key.lower()].empty = False - - self.models = tmp_models_dict - - return self - - @staticmethod - def _get_CMS_frontier_connection_string(database): - try: - import subprocess - return subprocess.Popen(['cmsGetFnConnect', 'frontier://%s' % database], stdout = subprocess.PIPE).communicate()[0].strip() - except: - raise Exception("Frontier connections can only be constructed when inside a CMSSW environment.") - - @staticmethod - def _cms_frontier_string(database, schema="cms_conditions"): - """ - Get database string for frontier. - """ - import urllib - return 'oracle+frontier://@%s/%s' % (urllib.quote_plus(connection._get_CMS_frontier_connection_string(database)), schema) - - @staticmethod - def _cms_oracle_string(user, pwd, db_name): - """ - Get database string for oracle. - """ - return 'oracle://%s:%s@%s' % (user, pwd, db_name) - - @staticmethod - def build_oracle_url(user, pwd, db_name): - """ - Build the connection url, and get credentials from self.secrets dictionary. - """ - - database_url = connection._cms_oracle_string(user, pwd, db_name) - - try: - url = sqlalchemy.engine.url.make_url(database_url) - if url.password is None: - url.password = pwd - except sqlalchemy.exc.ArgumentError: - url = sqlalchemy.engine.url.make_url('sqlite:///%s' % db_name) - return url - - @staticmethod - def build_frontier_url(db_name, schema): - database_url = connection._cms_frontier_string(db_name, schema) - - try: - url = sqlalchemy.engine.url.make_url(database_url) - except sqlalchemy.exc.ArgumentError: - """ - Is this needed for a use case? - """ - url = sqlalchemy.engine.url.make_url('sqlite:///%s' % db_name) - return url - - # currently just commits and closes the current session (ends transaction, closes connection) - # may do other things later - def tear_down(self): - try: - self.session.commit() - self.close_session() - except: - return "Couldn't tear down connection on engine %s." % str(self.engine) - - def close_session(self): - self.session.close() - return True - - def hard_close(self): - self.engine.dispose() - return True - - # get model based on given model name - def model(self, model_name): - if model_name.__class__ == sqlalchemy.ext.declarative.api.DeclarativeMeta: - model_name = model_name.__name__ - model_name = model_name.replace("_", "") - return self.models[model_name] - - # model should be the class the developer wants to be instantiated - # pk_to_value maps primary keys to values - def object(self, model, pk_to_value): - if self.session == None: - return None - model_data = self.session.query(model) - for pk in pk_to_value: - model_data = model_data.filter(model.__dict__[pk] == pk_to_value[pk]) - return model_data.first() - - def global_tag(self, **pkargs): - return self.factory.object("globaltag", **pkargs) - - def global_tag_map(self, **pkargs): - return self.factory.object("globaltagmap", **pkargs) - - """def global_tag_map_request(self, **pkargs): + def __init__(self, connection_data, mode=None, map_blobs=False, secrets=None, pooling=False): + + self._pooling = pooling + + # add querying utility properties + # these must belong to the connection since the way in which their values are handled + # depends on the database being connected to. + self.range = models.Range + self.radius = models.Radius + self.regexp = models.RegExp + self.regexp.connection_object = self + + if type(connection_data) in [str, str]: + # if we've been given a connection string, process it + self.connection_data = new_connection_dictionary(connection_data, secrets=secrets, mode=mode) + self.schema = self.connection_data.get("schema") if self.connection_data.get("schema") != None else "" + + self.range.database_type = self.connection_data["host"] + self.radius.database_type = self.connection_data["host"] + self.regexp.database_type = self.connection_data["host"] + else: + self.connection_data = connection_data + # assume we have an engine + # we need to take the string representation so we know which type of db we're aiming at + engine_string = str(connection_data) + db_type = None + if "oracle" in engine_string: + db_type = "oracle" + elif "frontier" in engine_string: + db_type = "frontier" + elif "sqlite" in engine_string: + db_type = "sqlite" + + self.range.database_type = db_type + self.radius.database_type = db_type + self.regexp.database_type = db_type + + from . import models as ms + self.models = ms.generate(map_blobs) + #self.base = self.models["Base"] + + def setup(self): + """ + Setup engine with given credentials from netrc file, and make a session maker. + """ + + if type(self.connection_data) == dict: + self.engine = engine_from_dictionary(self.connection_data, pooling=self._pooling) + else: + # we've been given an engine by the user + # use it as the engine + self.engine = self.connection_data + + self.sessionmaker = sessionmaker(bind=self.engine) + self.session = self.sessionmaker() + self.factory = factory(self) + + # assign correct schema for database name to each model + tmp_models_dict = {} + for key in self.models: + if self.models[key].__class__ == sqlalchemy.ext.declarative.api.DeclarativeMeta\ + and str(self.models[key].__name__) != "Base": + + if type(self.connection_data) == dict: + # we can only extract the secrets and schema individuall + # if we were given a dictionary... if we were given an engine + # we can't do this without parsing the connection string from the engine + # - a wide range of which it will be difficult to support! + self.models[key].__table__.schema = self.connection_data["schema"] + self.models[key].secrets = self.connection_data["secrets"] + + self.models[key].session = self.session + # isn't used anywhere - comment it out for now + #self.models[key].authentication = self.netrc_authenticators + self.models[key].connection = self + tmp_models_dict[key.lower()] = self.models[key] + tmp_models_dict[key.lower()].empty = False + + self.models = tmp_models_dict + + return self + + @staticmethod + def _get_CMS_frontier_connection_string(database): + try: + import subprocess + return subprocess.Popen(['cmsGetFnConnect', 'frontier://%s' % database], stdout = subprocess.PIPE).communicate()[0].strip() + except: + raise Exception("Frontier connections can only be constructed when inside a CMSSW environment.") + + @staticmethod + def _cms_frontier_string(database, schema="cms_conditions"): + """ + Get database string for frontier. + """ + import urllib.request, urllib.parse, urllib.error + return 'oracle+frontier://@%s/%s' % (urllib.parse.quote_plus(connection._get_CMS_frontier_connection_string(database)), schema) + + @staticmethod + def _cms_oracle_string(user, pwd, db_name): + """ + Get database string for oracle. + """ + return 'oracle://%s:%s@%s' % (user, pwd, db_name) + + @staticmethod + def build_oracle_url(user, pwd, db_name): + """ + Build the connection url, and get credentials from self.secrets dictionary. + """ + + database_url = connection._cms_oracle_string(user, pwd, db_name) + + try: + url = sqlalchemy.engine.url.make_url(database_url) + if url.password is None: + url.password = pwd + except sqlalchemy.exc.ArgumentError: + url = sqlalchemy.engine.url.make_url('sqlite:///%s' % db_name) + return url + + @staticmethod + def build_frontier_url(db_name, schema): + database_url = connection._cms_frontier_string(db_name, schema) + + try: + url = sqlalchemy.engine.url.make_url(database_url) + except sqlalchemy.exc.ArgumentError: + """ + Is this needed for a use case? + """ + url = sqlalchemy.engine.url.make_url('sqlite:///%s' % db_name) + return url + + # currently just commits and closes the current session (ends transaction, closes connection) + # may do other things later + def tear_down(self): + try: + self.session.commit() + self.close_session() + except: + return "Couldn't tear down connection on engine %s." % str(self.engine) + + def close_session(self): + self.session.close() + return True + + def hard_close(self): + self.engine.dispose() + return True + + # get model based on given model name + def model(self, model_name): + if model_name.__class__ == sqlalchemy.ext.declarative.api.DeclarativeMeta: + model_name = model_name.__name__ + model_name = model_name.replace("_", "") + return self.models[model_name] + + # model should be the class the developer wants to be instantiated + # pk_to_value maps primary keys to values + def object(self, model, pk_to_value): + if self.session == None: + return None + model_data = self.session.query(model) + for pk in pk_to_value: + model_data = model_data.filter(model.__dict__[pk] == pk_to_value[pk]) + return model_data.first() + + def global_tag(self, **pkargs): + return self.factory.object("globaltag", **pkargs) + + def global_tag_map(self, **pkargs): + return self.factory.object("globaltagmap", **pkargs) + + """def global_tag_map_request(self, **pkargs): return self.factory.object("globaltagmaprequest", **pkargs)""" - def tag(self, **pkargs): - return self.factory.object("tag", **pkargs) + def tag(self, **pkargs): + return self.factory.object("tag", **pkargs) + + def tag_authorization(self, **pkargs): + return self.factory.object("tagauthorization", **pkargs) - def iov(self, **pkargs): - return self.factory.object("iov", **pkargs) + def iov(self, **pkargs): + return self.factory.object("iov", **pkargs) - def payload(self, **pkargs): - return self.factory.object("payload", **pkargs) + def payload(self, **pkargs): + return self.factory.object("payload", **pkargs) - """def record(self, **pkargs): + """def record(self, **pkargs): return self.factory.object("record", **pkargs)""" - # adds %% at the beginning and end so LIKE in SQL searches all of the string - def _oracle_match_format(self, string): - return "%%%s%%" % string - - # returns dictionary mapping object type to a list of all objects found in the search - def search_everything(self, string, amount=10): - string = self._oracle_match_format(string) - - gt = self.model("globaltag") - global_tags = self.session.query(gt).filter(or_( - gt.name.ilike(string), - gt.description.ilike(string), - gt.release.ilike(string) - )).limit(amount) - tag = self.model("tag") - tags = self.session.query(tag).filter(or_( - tag.name.ilike(string), - tag.object_type.ilike(string), - tag.description.ilike(string)) - ).limit(amount) - iov = self.model("iov") - iovs = self.session.query(iov).filter(or_( - iov.tag_name.ilike(string), - iov.since.ilike(string), - iov.payload_hash.ilike(string), - iov.insertion_time.ilike(string) - )).limit(amount) - payload = self.model("payload") - payloads = self.session.query(payload).filter(or_( - payload.hash.ilike(string), - payload.object_type.ilike(string), - payload.insertion_time.ilike(string) - )).limit(amount) - - return json_data_node.make({ - "global_tags" : global_tags.all(), - "tags" : tags.all(), - "iovs" : iovs.all(), - "payloads" : payloads.all() - }) - - def write(self, object): - new_object = models.session_independent_object(object, schema=self.schema) - self.session.add(new_object) - return new_object - - def commit(self): - try: - self.session.commit() - except: - traceback.print_exc() - self.session.rollback() - - def write_and_commit(self, object): - if isinstance(object, list): - for item in object: - self.write_and_commit(item) - else: - # should be changed to deal with errors - add them to exception handling if they appear - self.write(object) - self.commit() - - def rollback(self): - try: - self.session.rollback() - except: - traceback.print_exc() - print("Session couldn't be rolled back.") + # adds %% at the beginning and end so LIKE in SQL searches all of the string + def _oracle_match_format(self, string): + return "%%%s%%" % string + + # returns dictionary mapping object type to a list of all objects found in the search + def search_everything(self, string, amount=10): + string = self._oracle_match_format(string) + + gt = self.model("globaltag") + global_tags = self.session.query(gt).filter(or_( + gt.name.ilike(string), + gt.description.ilike(string), + gt.release.ilike(string) + )).limit(amount) + tag = self.model("tag") + tags = self.session.query(tag).filter(or_( + tag.name.ilike(string), + tag.object_type.ilike(string), + tag.description.ilike(string)) + ).limit(amount) + iov = self.model("iov") + iovs = self.session.query(iov).filter(or_( + iov.tag_name.ilike(string), + iov.since.ilike(string), + iov.payload_hash.ilike(string), + iov.insertion_time.ilike(string) + )).limit(amount) + payload = self.model("payload") + payloads = self.session.query(payload).filter(or_( + payload.hash.ilike(string), + payload.object_type.ilike(string), + payload.insertion_time.ilike(string) + )).limit(amount) + + return json_data_node.make({ + "global_tags" : global_tags.all(), + "tags" : tags.all(), + "iovs" : iovs.all(), + "payloads" : payloads.all() + }) + + def write(self, object): + new_object = models.session_independent_object(object, schema=self.schema) + self.session.add(new_object) + return new_object + + def commit(self): + try: + self.session.commit() + except: + traceback.print_exc() + self.session.rollback() + + def write_and_commit(self, object): + if type(object) == list: + for item in object: + self.write_and_commit(item) + else: + # should be changed to deal with errors - add them to exception handling if they appear + self.write(object) + self.commit() + + def rollback(self): + try: + self.session.rollback() + except: + traceback.print_exc() + print("Session couldn't be rolled back.") class factory(): - """ - Contains methods for creating objects. - """ - def __init__(self, connection): - self.connection = connection - - # class_name is the class name of the model to be used - # pkargs is a dictionary of keyword arguments used as primary key values - # this dictionary will be used to populate the object of type name class_name - def object(self, class_name, **pkargs): - from .data_sources import json_list - from .models import apply_filters - # get the class that self.connection holds from the class name - model = self.connection.model(class_name) - - if self.connection.session == None: - return None - - # query for the ORM object, and return the appropriate object (None, CondDBFW object, or json_list) - model_data = self.connection.session.query(model) - if len(pkargs.items()) != 0: - # apply the filters defined in **kwargs - model_data = apply_filters(model_data, model, **pkargs) - amount = pkargs["amount"] if "amount" in pkargs.keys() else None - model_data = model_data.limit(amount) - if model_data.count() > 1: - # if we have multiple objects, return a json_list - return json_list(model_data.all()) - elif model_data.count() == 1: - # if we have a single object, return that object - return model_data.first() - else: - # if we have no objects returned, return None - return None - else: - # no column arguments were given, so return an empty object - new_object = model() - new_object.empty = True - return new_object + """ + Contains methods for creating objects. + """ + def __init__(self, connection): + self.connection = connection + + # class_name is the class name of the model to be used + # pkargs is a dictionary of keyword arguments used as primary key values + # this dictionary will be used to populate the object of type name class_name + def object(self, class_name, **pkargs): + from .data_sources import json_list + from .models import apply_filters + # get the class that self.connection holds from the class name + model = self.connection.model(class_name) + + if self.connection.session == None: + return None + + # query for the ORM object, and return the appropriate object (None, CondDBFW object, or json_list) + model_data = self.connection.session.query(model) + if len(list(pkargs.items())) != 0: + # apply the filters defined in **kwargs + model_data = apply_filters(model_data, model, **pkargs) + amount = pkargs["amount"] if "amount" in list(pkargs.keys()) else None + model_data = model_data.limit(amount) + if model_data.count() > 1: + # if we have multiple objects, return a json_list + return json_list(model_data.all()) + elif model_data.count() == 1: + # if we have a single object, return that object + return model_data.first() + else: + # if we have no objects returned, return None + return None + else: + # no column arguments were given, so return an empty object + new_object = model() + new_object.empty = True + return new_object def _get_netrc_data(netrc_file, key): - """ - Returns a dictionary {login : ..., account : ..., password : ...} - """ - try: - headers = ["login", "account", "password"] - authenticator_tuple = netrc.netrc(netrc_file).authenticators(key) - if authenticator_tuple == None: - raise Exception("netrc file must contain key '%s'." % key) - except: - raise Exception("Couldn't get credentials from netrc file.") - return dict(zip(headers, authenticator_tuple)) + """ + Returns a dictionary {login : ..., account : ..., password : ...} + """ + try: + headers = ["login", "account", "password"] + authenticator_tuple = netrc.netrc(netrc_file).authenticators(key) + if authenticator_tuple == None: + raise Exception("netrc file must contain key '%s'." % key) + except: + raise Exception("Couldn't get credentials from netrc file.") + return dict(list(zip(headers, authenticator_tuple))) def new_connection_dictionary(connection_data, secrets=None, mode="r"): - """ - Function used to construct connection data dictionaries - internal to framework. - """ - frontier_str_length = len("frontier://") - sqlite_str_length = len("sqlite://") - #sqlite_file_str_length = len("sqlite_file://") - oracle_str_length = len("oracle://") - - if type(connection_data) in [str, unicode] and connection_data[0:frontier_str_length] == "frontier://": - """ - frontier://database_name/schema - """ - db_name = connection_data[frontier_str_length:].split("/")[0] - schema = connection_data[frontier_str_length:].split("/")[1] - connection_data = {} - connection_data["database_name"] = db_name - connection_data["schema"] = schema - connection_data["host"] = "frontier" - connection_data["secrets"] = None - elif type(connection_data) in [str, unicode] and connection_data[0:sqlite_str_length] == "sqlite://": - """ - sqlite://database_file_name - """ - # for now, just support "sqlite://" format for sqlite connection strings - db_name = connection_data[sqlite_str_length:] - schema = "" - connection_data = {} - connection_data["database_name"] = os.path.abspath(db_name) - connection_data["schema"] = schema - connection_data["host"] = "sqlite" - connection_data["secrets"] = None - elif type(connection_data) in [str, unicode] and connection_data[0:oracle_str_length] == "oracle://": - """ - oracle://account:password@database_name - or - oracle://database_name/schema (requires a separate method of authentication - either dictionary or netrc) - """ - new_connection_string = connection_data[oracle_str_length:] - - if ":" in new_connection_string: - # the user has given a password - usually in the case of the db upload service - database_name = new_connection_string[new_connection_string.index("@")+1:] - schema_name = new_connection_string[0:new_connection_string.index(":")] - # set username based on connection string - username = new_connection_string[0:new_connection_string.index(":")] - password = new_connection_string[new_connection_string.index(":")+1:new_connection_string.index("@")] - else: - mode_to_netrc_key_suffix = {"r" : "read", "w" : "write"} - database_name = new_connection_string[0:new_connection_string.index("/")] - schema_name = new_connection_string[new_connection_string.index("/")+1:] - if secrets == None: - username = str(raw_input("Enter the username you want to connect to the schema '%s' with: " % (schema_name))) - password = str(raw_input("Enter the password for the user '%s' in database '%s': " % (username, database_name))) - else: - if isinstance(secrets, str): - netrc_key = "%s/%s/%s" % (database_name, schema_name, mode_to_netrc_key_suffix[mode]) - netrc_data = _get_netrc_data(secrets, key=netrc_key) - # take the username from the netrc entry corresponding to the mode the database is opened in - # eg, if the user has given mode="read", the database_name/schema_name/read entry will be taken - username = netrc_data["login"] - password = netrc_data["password"] - elif isinstance(secrets, dict): - username = secrets["user"] - password = secrets["password"] - else: - raise Exception("Invalid type given for secrets. Either an str or a dict must be given.") - - #print("Connected to database %s, schema %s, with username %s." % (database_name, schema_name, username)) - - connection_data = {} - connection_data["database_name"] = database_name - connection_data["schema"] = schema_name - connection_data["password"] = password - connection_data["host"] = "oracle" - connection_data["secrets"] = {"login" : username, "password" : password} - - return connection_data + """ + Function used to construct connection data dictionaries - internal to framework. + """ + frontier_str_length = len("frontier://") + sqlite_str_length = len("sqlite://") + #sqlite_file_str_length = len("sqlite_file://") + oracle_str_length = len("oracle://") + + if type(connection_data) in [str, str] and connection_data[0:frontier_str_length] == "frontier://": + """ + frontier://database_name/schema + """ + db_name = connection_data[frontier_str_length:].split("/")[0] + schema = connection_data[frontier_str_length:].split("/")[1] + connection_data = {} + connection_data["database_name"] = db_name + connection_data["schema"] = schema + connection_data["host"] = "frontier" + connection_data["secrets"] = None + elif type(connection_data) in [str, str] and connection_data[0:sqlite_str_length] == "sqlite://": + """ + sqlite://database_file_name + """ + # for now, just support "sqlite://" format for sqlite connection strings + db_name = connection_data[sqlite_str_length:] + schema = "" + connection_data = {} + connection_data["database_name"] = os.path.abspath(db_name) + connection_data["schema"] = schema + connection_data["host"] = "sqlite" + connection_data["secrets"] = None + elif type(connection_data) in [str, str] and connection_data[0:oracle_str_length] == "oracle://": + """ + oracle://account:password@database_name + or + oracle://database_name/schema (requires a separate method of authentication - either dictionary or netrc) + """ + new_connection_string = connection_data[oracle_str_length:] + + if ":" in new_connection_string: + # the user has given a password - usually in the case of the db upload service + database_name = new_connection_string[new_connection_string.index("@")+1:] + schema_name = new_connection_string[0:new_connection_string.index(":")] + # set username based on connection string + username = new_connection_string[0:new_connection_string.index(":")] + password = new_connection_string[new_connection_string.index(":")+1:new_connection_string.index("@")] + else: + mode_to_netrc_key_suffix = {"r" : "read", "w" : "write"} + database_name = new_connection_string[0:new_connection_string.index("/")] + schema_name = new_connection_string[new_connection_string.index("/")+1:] + if secrets == None: + username = str(input("Enter the username you want to connect to the schema '%s' with: " % (schema_name))) + password = str(input("Enter the password for the user '%s' in database '%s': " % (username, database_name))) + else: + if type(secrets) == str: + netrc_key = "%s/%s/%s" % (database_name, schema_name, mode_to_netrc_key_suffix[mode]) + netrc_data = _get_netrc_data(secrets, key=netrc_key) + # take the username from the netrc entry corresponding to the mode the database is opened in + # eg, if the user has given mode="read", the database_name/schema_name/read entry will be taken + username = netrc_data["login"] + password = netrc_data["password"] + elif type(secrets) == dict: + username = secrets["user"] + password = secrets["password"] + else: + raise Exception("Invalid type given for secrets. Either an str or a dict must be given.") + + #print("Connected to database %s, schema %s, with username %s." % (database_name, schema_name, username)) + + connection_data = {} + connection_data["database_name"] = database_name + connection_data["schema"] = schema_name + connection_data["password"] = password + connection_data["host"] = "oracle" + connection_data["secrets"] = {"login" : username, "password" : password} + + return connection_data def engine_from_dictionary(dictionary, pooling=True): - if dictionary["host"] != "sqlite": - if dictionary["host"] != "frontier": - # probably oracle - # if not frontier, we have to authenticate - user = dictionary["secrets"]["login"] - pwd = dictionary["secrets"]["password"] - # set max label length for oracle - if pooling: - return create_engine(connection.build_oracle_url(user, pwd, dictionary["database_name"]), label_length=6) - else: - return create_engine(connection.build_oracle_url(user, pwd, dictionary["database_name"]), label_length=6, poolclass=NullPool) - else: - # if frontier, no need to authenticate - # set max label length for frontier - if pooling: - return create_engine(connection.build_frontier_url(dictionary["database_name"], dictionary["schema"]), label_length=6) - else: - return create_engine(connection.build_frontier_url(dictionary["database_name"], dictionary["schema"]), label_length=6, poolclass=NullPool) - else: - # if host is sqlite, making the url is easy - no authentication - return create_engine("sqlite:///%s" % dictionary["database_name"]) + if dictionary["host"] != "sqlite": + if dictionary["host"] != "frontier": + # probably oracle + # if not frontier, we have to authenticate + user = dictionary["secrets"]["login"] + pwd = dictionary["secrets"]["password"] + # set max label length for oracle + if pooling: + return create_engine(connection.build_oracle_url(user, pwd, dictionary["database_name"]), label_length=6) + else: + return create_engine(connection.build_oracle_url(user, pwd, dictionary["database_name"]), label_length=6, poolclass=NullPool) + else: + # if frontier, no need to authenticate + # set max label length for frontier + if pooling: + return create_engine(connection.build_frontier_url(dictionary["database_name"], dictionary["schema"]), label_length=6) + else: + return create_engine(connection.build_frontier_url(dictionary["database_name"], dictionary["schema"]), label_length=6, poolclass=NullPool) + else: + # if host is sqlite, making the url is easy - no authentication + return create_engine("sqlite:///%s" % dictionary["database_name"]) def connect(connection_data, mode="r", map_blobs=False, secrets=None, pooling=True): - """ - Utility method for user - set up a connection object. - """ - con = connection(connection_data=connection_data, mode=mode, map_blobs=map_blobs, secrets=secrets, pooling=pooling) - con = con.setup() - return con + """ + Utility method for user - set up a connection object. + """ + con = connection(connection_data=connection_data, mode=mode, map_blobs=map_blobs, secrets=secrets, pooling=pooling) + con = con.setup() + return con \ No newline at end of file diff --git a/CondCore/Utilities/python/CondDBFW/shell.py b/CondCore/Utilities/python/CondDBFW/shell.py index e039f63ad8f0b..a19704dae6176 100644 --- a/CondCore/Utilities/python/CondDBFW/shell.py +++ b/CondCore/Utilities/python/CondDBFW/shell.py @@ -3,8 +3,6 @@ Contains classes for shell part of framework - basically a collection of classes that are designed to be invoked on the command line. """ -from __future__ import print_function -from __future__ import absolute_import from . import querying import sys diff --git a/CondCore/Utilities/python/CondDBFW/uploadConditions.py b/CondCore/Utilities/python/CondDBFW/uploadConditions.py index 5e9b0de06ff2c..17977f42b5e8e 100755 --- a/CondCore/Utilities/python/CondDBFW/uploadConditions.py +++ b/CondCore/Utilities/python/CondDBFW/uploadConditions.py @@ -1,8 +1,11 @@ -#!/usr/bin/env python3 +#!/usr/bin/env python3 """ - +Primary Author: Joshua Dawes - CERN, CMS - The University of Manchester +Debugging, Integration and Maintenance: +Andres Cardenas - CERN, CMS - Universidad San Francisco + Upload script wrapper - controls the automatic update system. Note: the name of the file follows a different convention to the others because it should be the same as the current upload script name. @@ -15,10 +18,17 @@ 4. Invoke the CondDBFW.uploads module with the arguments given to this script. """ -from __future__ import print_function -import pycurl -from StringIO import StringIO +__version__ = 1 + +#import pycurl +import requests +import urllib3 +urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) +try: + from StringIO import StringIO +except: + pass import traceback import sys import os @@ -28,146 +38,18 @@ import netrc import shutil import getpass +import errno +import sqlite3 -def get_version_info(url): - """ - Queries the server-side for the commit hash it is currently using. - Note: this is the commit hash used by /data/services/common/CondDBFW on the server-side. - """ - request = pycurl.Curl() - request.setopt(request.CONNECTTIMEOUT, 60) - user_agent = "User-Agent: ConditionWebServices/1.0 python/%d.%d.%d PycURL/%s" % (sys.version_info[ :3 ] + (pycurl.version_info()[1],)) - request.setopt(request.USERAGENT, user_agent) - # we don't need to verify who signed the certificate or who the host is - request.setopt(request.SSL_VERIFYPEER, 0) - request.setopt(request.SSL_VERIFYHOST, 0) - response_buffer = StringIO() - request.setopt(request.WRITEFUNCTION, response_buffer.write) - request.setopt(request.URL, url + "conddbfw_version/") - request.perform() - return json.loads(response_buffer.getvalue()) - -def get_local_commit_hash(): - """ - Gets the commit hash used by the local repository CondDBFW/.git/. - """ - directory = os.path.abspath("CondDBFW") - - # get the commit hash of the code in `directory` - # by reading the .commit_hash file - try: - commit_hash_file_handle = open(os.path.join(directory, ".commit_hash"), "r") - commit_hash = commit_hash_file_handle.read().strip() - - # validate length of the commit hash - if len(commit_hash) != 40: - print("Commit hash found is not valid. Must be 40 characters long.") - exit() - - #commit_hash = run_in_shell("git --git-dir=%s rev-parse HEAD" % (os.path.join(directory, ".git")), shell=True).strip() - - return commit_hash - except Exception: - return None - -def get_directory_to_pull_to(default_directory, commit_hash): - """ - Finds out which directory we can safely use - either CondDBFW/ or a temporary directory. - """ - # try to write a file (and then delete it) - try: - handle = open(os.path.join(default_directory, "test_file"), "w") - handle.write("test") - handle.close() - os.remove(os.path.join(default_directory, "test_file")) - sys.path.insert(0, default_directory) - return default_directory - except IOError as io: - # cannot write to default directory, so set up a directory in /tmp/ - new_path = os.path.join("tmp", commit_hash[0:10]) - if not(os.path.exists(new_path)): - os.mkdir(new_path) - sys.path.insert(0, new_path) - return new_path - else: - # for now, fail - exit("Can't find anywhere to pull the new code base to.") horizontal_rule = "="*60 -def pull_code_from_git(target_directory, repository_url, hash): - """ - Pulls CondDBFW from the git repository specified by the upload server. - """ - # make directory - target = os.path.abspath(target_directory) - sys.path.append(target) - conddbfw_directory = os.path.join(target, "CondDBFW") - git_directory = os.path.join(conddbfw_directory, ".git") - if not(os.path.exists(conddbfw_directory)): - os.mkdir(conddbfw_directory) - else: - # if the directory exists, it may contain things - prompt the user - force_pull = str(raw_input("CondDBFW directory isn't empty - empty it, and update to new version? [y/n] ")) - if force_pull == "y": - # empty directory and delete it - run_in_shell("rm -rf CondDBFW", shell=True) - # remake the directory - it will be empty - os.mkdir(conddbfw_directory) - - print("Pulling code back from repository...") - print(horizontal_rule) - - run_in_shell("git --git-dir=%s clone %s CondDBFW" % (git_directory, repository_url), shell=True) - # --force makes sure we ignore any conflicts that - # could occur and overwrite everything in the checkout - run_in_shell("cd %s && git checkout --force -b version_used %s" % (conddbfw_directory, hash), shell=True) - - # write the hash to a file in the CondDBFW directory so we can delete the git repository - hash_file_handle = open(os.path.join(conddbfw_directory, ".commit_hash"), "w") - hash_file_handle.write(hash) - hash_file_handle.close() - - # can now delete .git directory - shutil.rmtree(git_directory) - - print(horizontal_rule) - print("Creating local log directories (if required)...") - if not(os.path.exists(os.path.join(target, "upload_logs"))): - os.mkdir(os.path.join(target, "upload_logs")) - if not(os.path.exists(os.path.join(target, "server_side_logs"))): - os.mkdir(os.path.join(target, "server_side_logs")) - print("Finished with log directories.") - print("Update of CondDBFW complete.") - - print(horizontal_rule) - - return True - -def run_in_shell(*popenargs, **kwargs): - """ - Runs string-based commands in the shell and returns the result. - """ - out = subprocess.PIPE if kwargs.get("stdout") == None else kwargs.get("stdout") - new_kwargs = kwargs - if new_kwargs.get("stdout"): - del new_kwargs["stdout"] - process = subprocess.Popen(*popenargs, stdout=out, **new_kwargs) - stdout = process.communicate()[0] - returnCode = process.returncode - cmd = kwargs.get('args') - if cmd is None: - cmd = popenargs[0] - if returnCode: - raise subprocess.CalledProcessError(returnCode, cmd) - return stdout - def run_upload(**parameters): """ Imports CondDBFW.uploads and runs the upload with the upload metadata obtained. """ try: - import CondDBFW.uploads as uploads + import CondCore.Utilities.CondDBFW.uploads as uploads except Exception as e: traceback.print_exc() exit("CondDBFW or one of its dependencies could not be imported.\n"\ @@ -176,6 +58,177 @@ def run_upload(**parameters): uploader = uploads.uploader(**parameters) result = uploader.upload() +def getInput(default, prompt = ''): + '''Like raw_input() but with a default and automatic strip(). + ''' + + answer = raw_input(prompt) + if answer: + return answer.strip() + + return default.strip() + + +def getInputWorkflow(prompt = ''): + '''Like getInput() but tailored to get target workflows (synchronization options). + ''' + + while True: + workflow = getInput(defaultWorkflow, prompt) + + if workflow in frozenset(['offline', 'hlt', 'express', 'prompt', 'pcl']): + return workflow + + print('Please specify one of the allowed workflows. See above for the explanation on each of them.') + + +def getInputChoose(optionsList, default, prompt = ''): + '''Makes the user choose from a list of options. + ''' + + while True: + index = getInput(default, prompt) + + try: + return optionsList[int(index)] + except ValueError: + print('Please specify an index of the list (i.e. integer).') + except IndexError: + print('The index you provided is not in the given list.') + + +def getInputRepeat(prompt = ''): + '''Like raw_input() but repeats if nothing is provided and automatic strip(). + ''' + + while True: + answer = raw_input(prompt) + if answer: + return answer.strip() + + print('You need to provide a value.') + +def runWizard(basename, dataFilename, metadataFilename): + while True: + print('''\nWizard for metadata for %s + +I will ask you some questions to fill the metadata file. For some of the questions there are defaults between square brackets (i.e. []), leave empty (i.e. hit Enter) to use them.''' % basename) + + # Try to get the available inputTags + try: + dataConnection = sqlite3.connect(dataFilename) + dataCursor = dataConnection.cursor() + dataCursor.execute('select name from sqlite_master where type == "table"') + tables = set(zip(*dataCursor.fetchall())[0]) + + # only conddb V2 supported... + if 'TAG' in tables: + dataCursor.execute('select NAME from TAG') + # In any other case, do not try to get the inputTags + else: + raise Exception() + + inputTags = dataCursor.fetchall() + if len(inputTags) == 0: + raise Exception() + inputTags = list(zip(*inputTags))[0] + + except Exception: + inputTags = [] + + if len(inputTags) == 0: + print('\nI could not find any input tag in your data file, but you can still specify one manually.') + + inputTag = getInputRepeat( + '\nWhich is the input tag (i.e. the tag to be read from the SQLite data file)?\ne.g. BeamSpotObject_ByRun\ninputTag: ') + + else: + print('\nI found the following input tags in your SQLite data file:') + for (index, inputTag) in enumerate(inputTags): + print(' %s) %s' % (index, inputTag)) + + inputTag = getInputChoose(inputTags, '0', + '\nWhich is the input tag (i.e. the tag to be read from the SQLite data file)?\ne.g. 0 (you select the first in the list)\ninputTag [0]: ') + + databases = { + 'oraprod': 'oracle://cms_orcon_prod/CMS_CONDITIONS', + 'prod': 'oracle://cms_orcon_prod/CMS_CONDITIONS', + 'oradev': 'oracle://cms_orcoff_prep/CMS_CONDITIONS', + 'prep': 'oracle://cms_orcoff_prep/CMS_CONDITIONS', + } + + destinationDatabase = '' + ntry = 0 + print('\nWhich is the destination database where the tags should be exported?') + print('\n%s) %s' % ('oraprod', databases['oraprod'])) + print('\n%s) %s' % ('oradev', databases['oradev'])) + + while ( destinationDatabase not in databases.values() ): + if ntry==0: + inputMessage = \ + '\nPossible choices: oraprod or oradev \ndestinationDatabase: ' + elif ntry==1: + inputMessage = \ + '\nPlease choose one of the two valid destinations: oraprod or oradev \ndestinationDatabase: ' + else: + raise Exception('No valid destination chosen. Bailing out...') + + databaseInput = getInputRepeat(inputMessage).lower() + if databaseInput in databases.keys(): + destinationDatabase = databases[databaseInput] + ntry += 1 + + while True: + since = getInput('', + '\nWhich is the given since? (if not specified, the one from the SQLite data file will be taken -- note that even if specified, still this may not be the final since, depending on the synchronization options you select later: if the synchronization target is not offline, and the since you give is smaller than the next possible one (i.e. you give a run number earlier than the one which will be started/processed next in prompt/hlt/express), the DropBox will move the since ahead to go to the first safe run instead of the value you gave)\ne.g. 1234\nsince []: ') + if not since: + since = None + break + else: + try: + since = int(since) + break + except ValueError: + print('The since value has to be an integer or empty (null).') + + userText = getInput('', + '\nWrite any comments/text you may want to describe your request\ne.g. Muon alignment scenario for...\nuserText []: ') + + destinationTags = {} + while True: + destinationTag = getInput('', + '\nWhich is the next destination tag to be added (leave empty to stop)?\ne.g. BeamSpotObjects_PCL_byRun_v0_offline\ndestinationTag []: ') + if not destinationTag: + if len(destinationTags) == 0: + print('There must be at least one destination tag.') + continue + break + + if destinationTag in destinationTags: + print( + 'You already added this destination tag. Overwriting the previous one with this new one.') + + destinationTags[destinationTag] = { + } + + metadata = { + 'destinationDatabase': destinationDatabase, + 'destinationTags': destinationTags, + 'inputTag': inputTag, + 'since': since, + 'userText': userText, + } + + metadata = json.dumps(metadata, sort_keys=True, indent=4) + print('\nThis is the generated metadata:\n%s' % metadata) + + if getInput('n', + '\nIs it fine (i.e. save in %s and *upload* the conditions if this is the latest file)?\nAnswer [n]: ' % metadataFilename).lower() == 'y': + break + print('Saving generated metadata in %s...', metadataFilename) + with open(metadataFilename, 'wb') as metadataFile: + metadataFile.write(metadata) + def parse_arguments(): # read in command line arguments, and build metadata dictionary from them parser = argparse.ArgumentParser(prog="cmsDbUpload client", description="CMS Conditions Upload Script in CondDBFW.") @@ -210,13 +263,19 @@ def parse_arguments(): parser.add_argument("--review-options", required=False, action="store_true") + parser.add_argument("--replay-file", required=False) + command_line_data = parser.parse_args() + if command_line_data.replay_file: + dictionary = json.loads("".join(open(command_line_data.replay_file, "r").readlines())) + command_line_data.tier0_response = dictionary["tier0_response"] + # default is the production server, which can point to either database anyway server_alias_to_url = { "prep" : "https://cms-conddb-dev.cern.ch/cmsDbCondUpload/", - "prod" : "https://cms-conddb.cern.ch/cmsDbCondUpload/", - None : "https://cms-conddb.cern.ch/cmsDbCondUpload/" + "dev" : "https://cms-conddb-dev.cern.ch/cmsDbCondUpload/", + "prod" : "https://cms-conddb.cern.ch/cmsDbCondUpload/" } # if prep, prod or None were given, convert to URLs in dictionary server_alias_to_url @@ -224,6 +283,17 @@ def parse_arguments(): if command_line_data.server in server_alias_to_url.keys(): command_line_data.server = server_alias_to_url[command_line_data.server] + # resolve destination databases + database_alias_to_connection = { + "prep": "oracle://cms_orcoff_prep/CMS_CONDITIONS", + "dev": "oracle://cms_orcoff_prep/CMS_CONDITIONS", + "prod": "oracle://cms_orcon_adg/CMS_CONDITIONS" + } + + if command_line_data.destinationDatabase in database_alias_to_connection.keys(): + command_line_data.destinationDatabase = database_alias_to_connection[command_line_data.destinationDatabase] + + # use netrc to get username and password try: netrc_file = command_line_data.netrc @@ -264,23 +334,63 @@ def parse_arguments(): since these override the options set in the metadata file. """ + + # Hash to use, entirely from command line if command_line_data.hashToUse != None: command_line_data.userText = "" metadata_dictionary = command_line_data.__dict__ elif command_line_data.metadataFile == None: - command_line_data.userText = command_line_data.userText\ - if command_line_data.userText != None\ - else str(raw_input("Tag's description [can be empty]:")) - metadata_dictionary = command_line_data.__dict__ - else: + if command_line_data.sourceDB != None and (command_line_data.inputTag == None or command_line_data.destinationTag == None or command_line_data.destinationDatabase == None): + basepath = command_line_data.sourceDB.rsplit('.db', 1)[0].rsplit('.txt', 1)[0] + basename = os.path.basename(basepath) + dataFilename = '%s.db' % basepath + metadataFilename = '%s.txt' % basepath + # Data file + try: + with open(dataFilename, 'rb') as dataFile: + pass + except IOError as e: + errMsg = 'Impossible to open SQLite data file %s' %dataFilename + print( errMsg ) + ret['status'] = -3 + ret['error'] = errMsg + return ret + + # Metadata file + + try: + with open(metadataFilename, 'rb') as metadataFile: + pass + except IOError as e: + if e.errno != errno.ENOENT: + errMsg = 'Impossible to open file %s (for other reason than not existing)' %metadataFilename + ret = {} + ret['status'] = -4 + ret['error'] = errMsg + exit (ret) + + if getInput('y', '\nIt looks like the metadata file %s does not exist and not enough parameters were received in the command line. Do you want me to create it and help you fill it?\nAnswer [y]: ' % metadataFilename).lower() != 'y': + errMsg = 'Metadata file %s does not exist' %metadataFilename + ret = {} + ret['status'] = -5 + ret['error'] = errMsg + exit(ret) + # Wizard + runWizard(basename, dataFilename, metadataFilename) + command_line_data.metadataFile = metadataFilename + else: + command_line_data.userText = command_line_data.userText\ + if command_line_data.userText != None\ + else str(raw_input("Tag's description [can be empty]:")) + metadata_dictionary = command_line_data.__dict__ + + if command_line_data.metadataFile != None: metadata_dictionary = json.loads("".join(open(os.path.abspath(command_line_data.metadataFile), "r").readlines())) metadata_dictionary["username"] = username metadata_dictionary["password"] = password metadata_dictionary["userText"] = metadata_dictionary.get("userText")\ if metadata_dictionary.get("userText") != None\ else str(raw_input("Tag's description [can be empty]:")) - # set the server to use to be the default one - metadata_dictionary["server"] = server_alias_to_url[None] # go through command line options and, if they are set, overwrite entries for (option_name, option_value) in command_line_data.__dict__.items(): @@ -314,47 +424,51 @@ def parse_arguments(): if raw_input("\nDo you want to continue? [y/n] ") != "y": exit() + if metadata_dictionary["server"] == None: + if metadata_dictionary["destinationDatabase"] == "oracle://cms_orcoff_prep/CMS_CONDITIONS": + metadata_dictionary["server"] = server_alias_to_url["prep"] + else: + metadata_dictionary["server"] = server_alias_to_url["prod"] + return metadata_dictionary +def get_version(url): + return requests.get(url + "script_version/", verify=False) + + if __name__ == "__main__": upload_metadata = parse_arguments() # upload_metadata should be used to decide the service url final_service_url = upload_metadata["server"] + try: + response = get_version(final_service_url) + server_version = response.json() + except Exception as e: + print(horizontal_rule) + print(e) + print("Could not connect to server at %s"%final_service_url) + print("If you specified a server please check it is correct. If that is not the issue please contact the AlcaDB team.") + print(horizontal_rule) + exit(1) - conddbfw_version = get_version_info(final_service_url) - local_version = get_local_commit_hash() + if server_version["version"] != __version__: + print(horizontal_rule) + print("Local upload script is different than server version. Please run the following command to get the latest script.") + print("curl --insecure -o uploadConditions.py %sget_upload_script/ && chmod +x uploadConditions.py;"%final_service_url) + print(horizontal_rule) + exit(1) - """ - Todo - case where we don't have write permission in the current directory (local_version == None and hashes don't match) - """ - # target_directory is only used if we don't find a version of CondDBFW locally, - # but is set here so we can access it later if we need to delete a temporary directory - target_directory = "" - # check if we have a persistent local version of CondDBFW - if local_version != None: - if conddbfw_version["hash"] == local_version: - # no update is required, pass for now - print("No change of version of CondDBFW is required - performing the upload.") - # add CondDBFW to the system paths (local_version != None, so we know it's in this directory) - sys.path.append(os.path.abspath(os.getcwd())) - elif conddbfw_version["hash"] != local_version: - # this is the case where CondDBFW is in the directory working_dir/CondDBFW, but there is an update available - # CondDBFW isn't in this directory, and the local commit hash doesn't match the latest one on the server - print("The server uses a different version of CondDBFW - changing to commit '%s' of CondDBFW." % conddbfw_version["hash"]) - shell_response = pull_code_from_git(os.getcwd(), conddbfw_version["repo"], conddbfw_version["hash"]) - else: - # no CondDBFW version - we should pull the code and start from scratch - # we can't look for temporary versions of it in /tmp/, since we can't guess the hash used to make the directory name - print("No CondDBFW version found locally - pulling one.") - target_directory = get_directory_to_pull_to(os.getcwd(), conddbfw_version["hash"]) - shell_response = pull_code_from_git(target_directory, conddbfw_version["repo"], conddbfw_version["hash"]) - - import CondDBFW.data_sources as data_sources + import CondCore.Utilities.CondDBFW.data_sources as data_sources upload_metadata["sqlite_file"] = upload_metadata.get("sourceDB") - + + try: + os.mkdir('upload_logs') + except OSError as e: + pass + # make new dictionary, and copy over everything except "metadata_source" upload_metadata_argument = {} for (key, value) in upload_metadata.items(): @@ -362,15 +476,15 @@ def parse_arguments(): upload_metadata_argument[key] = value upload_metadata["metadata_source"] = data_sources.json_data_node.make(upload_metadata_argument) - - # pass dictionary as arguments to match keywords - the constructor has a **kwargs parameter to deal with stray arguments - run_upload(**upload_metadata) - - # if the directory was temporary, delete it - if "tmp" in target_directory: + try: + # pass dictionary as arguments to match keywords - the constructor has a **kwargs parameter to deal with stray arguments + run_upload(**upload_metadata) + print(horizontal_rule) + print("Process completed without issues. Please check logs for further details.") + print(horizontal_rule) + except SystemExit as e: + print(horizontal_rule) + print("Process exited abnormally. Please check logs for details.") print(horizontal_rule) - print("Removing directory %s..." % target_directory) - try: - run_in_shell("rm -rf %s" % target_directory, shell=True) - except Exception as e: - print("Couldn't delete the directory %s - try to manually delete it." % target_directory) \ No newline at end of file + exit(1) + exit(0) diff --git a/CondCore/Utilities/python/CondDBFW/uploads.py b/CondCore/Utilities/python/CondDBFW/uploads.py index 2bc8927badfd3..953492d625128 100755 --- a/CondCore/Utilities/python/CondDBFW/uploads.py +++ b/CondCore/Utilities/python/CondDBFW/uploads.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python3 +#!/usr/bin/env python3 """ Joshua Dawes - CERN, CMS - The University of Manchester @@ -6,14 +6,12 @@ This module holds classes to help with uploading conditions to the drop box web service, which also uses CondDBFW to read and write data. """ -from __future__ import print_function -from __future__ import absolute_import import os import json import base64 from datetime import datetime -from urllib import urlencode +from urllib.parse import urlencode import math import sys import traceback @@ -42,7 +40,7 @@ def log(file_handle, message): """ Very simple logging function, used by output class. """ - file_handle.write("[%s] %s\n" % (to_timestamp(datetime.now()), message)) + file_handle.write("[%s] %s\n" % (to_timestamp(datetime.utcnow()), message)) def new_log_file_id(): """ @@ -59,38 +57,23 @@ def new_log_file_id(): return new_id class output(): - INFO = 0 - ERROR = 1 - WARNING = 2 - VERBOSE = 3 - DEBUG = 4 - """ Used to control output to the console and to the client-side log. """ - def __init__(self, log_handle=None, verbose=False, debug=False): + def __init__(self, log_handle=None, verbose=False): # first time writing progress bar, don't need to go back along the line self.current_output_length = 0 self._verbose = verbose self._log_handle = log_handle - self._debug = debug - self.labels = ["INFO", "ERROR", "WARNING", "VERBOSE", "DEBUG"] - def write(self, message="", level=INFO): + def write(self, message="", ignore_verbose=False): """ Write to the console and to the log file held by self. """ - message = "[%s] %s: %s"%(datetime.now(), self.labels[level], message) - if self._verbose: - if level == output.DEBUG and self._debug: - print(message) - elif level < output.DEBUG: - print(message) - elif self._debug: - if level == output.DEBUG: - print(message) - elif level <= output.ERROR: + if ignore_verbose: + print(message) + elif self._verbose: print(message) if self._log_handle != None: log(self._log_handle, message) @@ -123,7 +106,7 @@ def __init__(self, metadata_source=None, debug=False, verbose=False, testing=Fal self._handle = open(self.upload_log_file_name, "a") # set up client-side logging object - self._outputter = output(verbose=verbose, log_handle=self._handle, debug = self._debug) + self._outputter = output(verbose=verbose, log_handle=self._handle) self._outputter.write("Using server instance at '%s'." % self._SERVICE_URL) # expect a CondDBFW data_source object for metadata_source @@ -139,7 +122,7 @@ def __init__(self, metadata_source=None, debug=False, verbose=False, testing=Fal if self.metadata_source.get("destinationTags") == None: self.exit_upload("No destination Tag was given.") else: - if isinstance(self.metadata_source.get("destinationTags"), dict) and self.metadata_source.get("destinationTags").keys()[0] == None: + if type(self.metadata_source.get("destinationTags")) == dict and list(self.metadata_source.get("destinationTags").keys())[0] == None: self.exit_upload("No destination Tag was given.") # make sure a destination database was given @@ -171,7 +154,7 @@ def __init__(self, metadata_source=None, debug=False, verbose=False, testing=Fal self.exit_upload("SQLite file '%s' given doesn't exist." % self.sqlite_file_name) sqlite_con = querying.connect("sqlite://%s" % os.path.abspath(self.sqlite_file_name)) - self._outputter.write("Getting Tag and IOVs from SQLite database.", output.VERBOSE) + self._outputter.write("Getting Tag and IOVs from SQLite database.") # query for Tag, check for existence, then convert to dictionary tag = sqlite_con.tag(name=self.input_tag) @@ -184,7 +167,7 @@ def __init__(self, metadata_source=None, debug=False, verbose=False, testing=Fal if iovs == None: self.exit_upload("No IOVs found in the SQLite file given for Tag '%s'." % self.input_tag) iovs = iovs.as_dicts(convert_timestamps=True) - iovs = [iovs] if not isinstance(iovs, list) else iovs + iovs = [iovs] if type(iovs) != list else iovs """ Finally, get the list of all Payload hashes of IOVs, @@ -210,7 +193,7 @@ def __init__(self, metadata_source=None, debug=False, verbose=False, testing=Fal # set empty dictionary to contain Tag and IOV data from command line result_dictionary = {} - now = to_timestamp(datetime.now()) + now = to_timestamp(datetime.utcnow()) # tag dictionary will be taken from the server # this does not require any authentication tag = self.get_tag_dictionary() @@ -244,6 +227,17 @@ def __init__(self, metadata_source=None, debug=False, verbose=False, testing=Fal # Tag time_type says IOVs use Runs for sinces, so we convert to Lumi-based for uniform processing self.data_to_send["since"] = self.data_to_send["since"] << 32 + """ + TODO - Settle on a single destination tag format. + """ + # look for deprecated metadata entries - give warnings + # Note - we only really support this format + try: + if type(result_dictionary["destinationTags"]) == dict: + self._outputter.write("WARNING: Multiple destination tags in a single metadata source is deprecated.") + except Exception as e: + self._outputter.write("ERROR: %s" % str(e)) + @check_response(check="json") def get_tag_dictionary(self): url_data = {"tag_name" : self.metadata_source["destinationTag"], "database" : self.metadata_source["destinationDatabase"]} @@ -257,21 +251,21 @@ def check_response_for_error_key(self, response_dict, exit_if_error=True): If it is a dictionary, and one of its keys is "error", the server returned an error """ # if the decoded response data is a dictionary and has an error key in it, we should display an error and its traceback - if isinstance(response_dict, dict) and "error" in response_dict.keys(): + if type(response_dict) == dict and "error" in list(response_dict.keys()): splitter_string = "\n%s\n" % ("-"*50) - self._outputter.write("\nERROR: %s" % splitter_string, output.ERROR) - self._outputter.write(response_dict["error"], output.ERROR) + self._outputter.write("\nERROR: %s" % splitter_string, ignore_verbose=True) + self._outputter.write(response_dict["error"], ignore_verbose=True) # if the user has given the --debug flag, show the traceback as well if self._debug: # suggest to the user to email this to db upload experts - self._outputter.write("\nTRACEBACK (since --debug is set):%s" % splitter_string, output.DEBUG) + self._outputter.write("\nTRACEBACK (since --debug is set):%s" % splitter_string, ignore_verbose=True) if response_dict.get("traceback") != None: - self._outputter.write(response_dict["traceback"], output.DEBUG) + self._outputter.write(response_dict["traceback"], ignore_verbose=True) else: - self._outputter.write("No traceback was returned from the server.", output.DEBUG) + self._outputter.write("No traceback was returned from the server.", ignore_verbose=True) else: - self._outputter.write("Use the --debug option to show the traceback of this error.", output.INFO) + self._outputter.write("Use the --debug option to show the traceback of this error.", ignore_verbose=True) # write server side log to client side (if we have an error from creating an upload session, the log is in its initial state ("")) # if an error has occurred on the server side, a log will have been written @@ -282,9 +276,9 @@ def check_response_for_error_key(self, response_dict, exit_if_error=True): return False else: exit() - elif not("error" in response_dict.keys()) and "log_data" in response_dict.keys(): + elif not("error" in list(response_dict.keys())) and "log_data" in list(response_dict.keys()): # store the log data, if it's there, in memory - this is used if a request times out and we don't get any log data back - self._log_data = response_dict["log_data"][2:-1] + self._log_data = response_dict["log_data"] return True def write_server_side_log(self, log_data): @@ -314,18 +308,12 @@ def write_server_side_log(self, log_data): # tell the user where the log files are # in the next iteration we may just merge the log files and store one log (how it's done in the plotter module) - if self._SERVICE_URL.startswith("https://cms-conddb-dev.cern.ch/cmsDbCondUpload"): - logUrl = "https://cms-conddb.cern.ch/cmsDbBrowser/logs/show_cond_uploader_log/Prep/%s"%self.upload_session_id - else: - logUrl = "https://cms-conddb.cern.ch/cmsDbBrowser/logs/show_cond_uploader_log/Prod/%s"%self.upload_session_id - - print("[%s] INFO: Server log found at %s." % (datetime.now(), logUrl)) if server_log_file_name != None: - print("[%s] INFO: Local copy of server log file at '%s'." % (datetime.now(), server_log_file_name)) + print("Log file from server written to '%s'." % server_log_file_name) else: print("No server log file could be written locally.") - print("[%s] INFO: Local copy of client log file at '%s'." % (datetime.now(), self.upload_log_file_name)) + print("Log file from CondDBFW written to '%s'." % self.upload_log_file_name) def exit_upload(self, message=None): """ @@ -368,14 +356,14 @@ def upload(self): return False self.upload_session_id = upload_session_data["id"] - self._outputter.write("Upload session obtained with token '%s'." % self.upload_session_id, output.DEBUG) + self._outputter.write("Upload session obtained with token '%s'." % self.upload_session_id) self.server_side_log_file = upload_session_data["log_file"] except errors.NoMoreRetriesException as no_more_retries: return self.exit_upload("Ran out of retries opening an upload session, where the limit was 3.") except Exception as e: # something went wrong that we have no specific exception for, so just exit and output the traceback if --debug is set. - self._outputter.write(traceback.format_exc(), output.ERROR) + self._outputter.write(traceback.format_exc(), ignore_verbose=True) if not(self._verbose): self._outputter.write("Something went wrong that isn't handled by code - to get the traceback, run again with --verbose.") @@ -403,7 +391,7 @@ def upload(self): return self.exit_upload("Ran out of retries trying to filter IOVs by FCSR from server, where the limit was 3.") except Exception as e: # something went wrong that we have no specific exception for, so just exit and output the traceback if --debug is set. - self._outputter.write(traceback.format_exc(), output.ERROR) + self._outputter.write(traceback.format_exc(), ignore_verbose=True) if not(self._verbose): self._outputter.write("Something went wrong that isn't handled by code - to get the traceback, run again with --verbose.") @@ -429,10 +417,10 @@ def upload(self): # finally, check hashes_not_found with hashes not found locally - if there is an intersection, we stop the upload # because if a hash is not found and is not on the server, there is no data to upload - all_hashes = map(lambda iov : iov["payload_hash"], self.data_to_send["iovs"]) + all_hashes = [iov["payload_hash"] for iov in self.data_to_send["iovs"]] hashes_not_found = check_hashes_response["hashes_not_found"] hashes_found = list(set(all_hashes) - set(hashes_not_found)) - self._outputter.write("Checking for IOVs that have no Payload locally or on the server.", output.VERBOSE) + self._outputter.write("Checking for IOVs that have no Payload locally or on the server.") # check if any hashes not found on the server is used in the local SQLite database for hash_not_found in hashes_not_found: if hash_not_found in self.hashes_with_no_local_payload: @@ -440,19 +428,16 @@ def upload(self): for hash_found in hashes_found: if hash_found in self.hashes_with_no_local_payload: - self._outputter.write("Payload with hash %s on server, so can upload IOV." % hash_found, output.VERBOSE) - - self._outputter.write("Found %i Payloads in remote server" % len(hashes_found), output.INFO) - self._outputter.write("Found %i Payloads not in remote server" % len(hashes_not_found), output.INFO) + self._outputter.write("Payload with hash %s on server, so can upload IOV." % hash_found) - self._outputter.write("All IOVs either come with Payloads or point to a Payload already on the server.", output.VERBOSE) + self._outputter.write("All IOVs either come with Payloads or point to a Payload already on the server.") except errors.NoMoreRetriesException as no_more_retries: # for now, just write the log if we get a NoMoreRetriesException return self.exit_upload("Ran out of retries trying to check hashes of payloads to send, where the limit was 3.") except Exception as e: # something went wrong that we have no specific exception for, so just exit and output the traceback if --debug is set. - self._outputter.write(traceback.format_exc(), output.ERROR) + self._outputter.write(traceback.format_exc(), ignore_verbose=True) if not(self._verbose): self._outputter.write("Something went wrong that isn't handled by code - to get the traceback, run again with --verbose.") @@ -477,16 +462,10 @@ def upload(self): # note that the response (in send_metadata_response) is already decoded from base64 by the response check decorator send_metadata_response = self.send_metadata(self.upload_session_id) - no_error = self.check_response_for_error_key(send_metadata_response) if not(no_error) and self._testing: return False - try: - self._outputter.write(send_metadata_response["summary"], output.INFO) - except KeyError: - pass - # we have to call this explicitly here since check_response_for_error_key only writes the log file # if an error has occurred, whereas it should always be written here self.write_server_side_log(self._log_data) @@ -495,7 +474,7 @@ def upload(self): return self.exit_upload("Ran out of retries trying to send metadata, where the limit was 3.") except Exception as e: # something went wrong that we have no specific exception for, so just exit and output the traceback if --debug is set. - self._outputter.write(traceback.format_exc(), output.ERROR) + self._outputter.write(traceback.format_exc(), ignore_verbose=True) if not(self._verbose): self._outputter.write("Something went wrong that isn't handled by code - to get the traceback, run again with --verbose.") @@ -517,7 +496,7 @@ def get_upload_session_id(self): Open an upload session on the server, and get a unique token back that we can use to authenticate for all future requests, as long as the upload session is still open. """ - self._outputter.write("Getting upload session.", output.VERBOSE) + self._outputter.write("Getting upload session.") # send password in the body so it can be encrypted over https # username and password are taken from the netrc file @@ -525,11 +504,11 @@ def get_upload_session_id(self): # this method's end result is obtaining a token. body_data = base64.b64encode(json.dumps( { - "destinationTag" : self.data_to_send["destinationTags"].keys()[0], + "destinationTag" : list(self.data_to_send["destinationTags"].keys())[0], "username_or_token" : self.data_to_send["username"], "password" : self.data_to_send["password"] } - )) + ).encode('UTF-8')) url_data = {"database" : self.data_to_send["destinationDatabase"]} @@ -557,11 +536,15 @@ def get_fcsr_from_server(self, upload_session_id): Note: we do this in a separate function we so we can do the decoding check for json data with check_response. """ # tiny amount of client-side logic here - all of the work is done on the server + # tier0_response uses get() so if the key isn't present, we default to None + # tier0_response is for replaying uploads from the old upload service, with knowledge of the tier0 response + # when those uploads happened. url_data = { "database" : self.data_to_send["destinationDatabase"], "upload_session_id" : upload_session_id, - "destinationTag" : self.data_to_send["destinationTags"].keys()[0], - "sourceTagSync" : self.data_to_send["fcsr_filter"] + "destinationTag" : list(self.data_to_send["destinationTags"].keys())[0], + "sourceTagSync" : self.data_to_send["fcsr_filter"], + "tier0_response" : self.data_to_send.get("tier0_response") } query = url_query(url=self._SERVICE_URL + "get_fcsr/", url_data=url_data) result = query.send() @@ -626,7 +609,7 @@ def filter_iovs_by_fcsr(self, upload_session_id): self.data_to_send["iovs"][i]["since"] = self.data_to_send["since"] # modify insertion_time of iovs - new_time = to_timestamp(datetime.now()) + new_time = to_timestamp(datetime.utcnow()) for (i, iov) in enumerate(self.data_to_send["iovs"]): self.data_to_send["iovs"][i]["insertion_time"] = new_time @@ -634,9 +617,8 @@ def get_all_hashes(self): """ Get all the hashes from the dictionary of IOVs we have from the SQLite file. """ - self._outputter.write("\tGetting list of all hashes found in SQLite database.", output.DEBUG) - hashes = map(lambda iov : iov["payload_hash"], self.data_to_send["iovs"]) - self._outputter.write("Found %i local Payload(s) referenced in IOVs"%len(hashes), output.INFO) + self._outputter.write("\tGetting list of all hashes found in SQLite database.") + hashes = [iov["payload_hash"] for iov in self.data_to_send["iovs"]] return hashes @check_response(check="json") @@ -644,7 +626,7 @@ def get_hashes_to_send(self, upload_session_id): """ Get the hashes of the payloads we want to send that the server doesn't have yet. """ - self._outputter.write("Getting list of hashes that the server does not have Payloads for, to send to server.", output.DEBUG) + self._outputter.write("Getting list of hashes that the server does not have Payloads for, to send to server.") post_data = json.dumps(self.get_all_hashes()) url_data = {"database" : self.data_to_send["destinationDatabase"], "upload_session_id" : upload_session_id} query = url_query(url=self._SERVICE_URL + "check_hashes/", url_data=url_data, body=post_data) @@ -658,21 +640,22 @@ def send_payloads(self, hashes, upload_session_id): # if we have no hashes, we can't send anything # but don't exit since it might mean all the Payloads were already on the server if len(hashes) == 0: - self._outputter.write("No payloads to send - moving to IOV upload.") + self._outputter.write("No hashes to send - moving to metadata upload.") return True else: self._outputter.write("Sending payloads of hashes not found:") # construct connection string for local SQLite database file - database = ("sqlite://%s" % os.path.abspath(self.sqlite_file_name)) if isinstance(self.sqlite_file_name, str) else self.sqlite_file_name + database = ("sqlite://%s" % os.path.abspath(self.sqlite_file_name)) if type(self.sqlite_file_name) == str else self.sqlite_file_name # create CondDBFW connection that maps blobs - as we need to query for payload BLOBs (disabled by default in CondDBFW) self._outputter.write("\tConnecting to input SQLite database.") con = querying.connect(database, map_blobs=True) # query for the Payloads self._outputter.write("\tGetting Payloads from SQLite database based on list of hashes.") - payloads = con.payload(hash=hashes) + byte_hashes = [bytes(h, 'utf-8') for h in hashes] + payloads = con.payload(hash=byte_hashes) # if we get a single Payload back, put it in a list and turn it into a json_list - if payloads.__class__ != data_sources.json_list: + if payloads and payloads.__class__ != data_sources.json_list: payloads = data_sources.json_data_node.make([payloads]) # close the session with the SQLite database file - we won't use it again @@ -713,7 +696,7 @@ def send_blob(self, payload, upload_session_id): url_data = {"database" : self.data_to_send["destinationDatabase"], "upload_session_id" : upload_session_id} # construct the data to send in the body and header of the HTTPs request - for key in payload.keys(): + for key in list(payload.keys()): # skip blob if key != "data": if key == "insertion_time": @@ -730,7 +713,7 @@ def send_blob(self, payload, upload_session_id): return request_response except Exception as e: # make sure we don't try again - if a NoMoreRetriesException has been thrown, retries have run out - if isinstance(e, errors.NoMoreRetriesException): + if type(e) == errors.NoMoreRetriesException: self._outputter.write("\t\t\tPayload with hash '%s' was not uploaded because the maximum number of retries was exceeded." % payload["hash"]) self._outputter.write("Payload with hash '%s' was not uploaded because the maximum number of retries was exceeded." % payload["hash"]) return json.dumps({"error" : str(e), "traceback" : traceback.format_exc()}) @@ -744,16 +727,16 @@ def send_metadata(self, upload_session_id): # set user text if it's empty if self.data_to_send["userText"] in ["", None]: - self.data_to_send["userText"] = "Tag '%s' uploaded from CondDBFW client." % self.data_to_send["destinationTags"].keys()[0] + self.data_to_send["userText"] = "Tag '%s' uploaded from CondDBFW client." % list(self.data_to_send["destinationTags"].keys())[0] self._outputter.write("Sending metadata to server - see server_side_log at server_side_logs/upload_log_%s for details on metadata processing on server side."\ - % self.upload_session_id, output.VERBOSE) + % self.upload_session_id) # sent the HTTPs request to the server - url_data = {"database" : self.data_to_send["destinationDatabase"], "upload_session_id" : upload_session_id} + url_data = {"database" : self.data_to_send["destinationDatabase"], "upload_session_id" : upload_session_id, "tier0_response" : self.data_to_send.get("tier0_response")} request = url_query(url=self._SERVICE_URL + "upload_metadata/", url_data=url_data, body=json.dumps(self.data_to_send)) response = request.send() - self._outputter.write("Response received - conditions upload process complete.", output.VERBOSE) + self._outputter.write("Response received - conditions upload process complete.") return response if __name__ == "__main__": @@ -777,7 +760,7 @@ def send_metadata(self, upload_session_id): # make new dictionary, and copy over everything except "metadata_source" upload_metadata_argument = {} - for (key, value) in upload_metadata.items(): + for (key, value) in list(upload_metadata.items()): if key != "metadata_source": upload_metadata_argument[key] = value diff --git a/CondCore/Utilities/python/CondDBFW/url_query.py b/CondCore/Utilities/python/CondDBFW/url_query.py index 4639eb261800b..e6fab9c9ba55d 100644 --- a/CondCore/Utilities/python/CondDBFW/url_query.py +++ b/CondCore/Utilities/python/CondDBFW/url_query.py @@ -6,20 +6,35 @@ Provides methods for performing/closing the request, as well as getting the request response. Note: user agent string from current version of cmsDbUpload """ -from __future__ import print_function -from __future__ import absolute_import -import pycurl -from StringIO import StringIO -from urllib import urlencode +#import pycurl +import requests +from io import StringIO +from urllib.parse import urlencode import traceback import sys import json from .errors import * from time import sleep +import urllib3 +urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) + class url_query(): + def __init__(self, url=None, url_data=None, body=None): + self._url = url + self._url_data = url_data + self._body = body + + def send(self): + if self._body: + return requests.post(self._url, data=self._body, params=self._url_data, verify=False).text + else: + return requests.get(self._url, params=self._url_data, verify=False).text + +"""class url_query(): + def __init__(self, url=None, url_data=None, body=None, response_stream=None, timeout=60): if not(url): return None @@ -38,15 +53,15 @@ def __init__(self, url=None, url_data=None, body=None, response_stream=None, tim self._response = StringIO() if body: - if isinstance(body, dict): + if type(body) == dict: body = urlencode(body) - elif isinstance(body, list): + elif type(body) == list: body = json.dumps(body) self._r.setopt(self._r.POSTFIELDS, body) if url_data: - if isinstance(url_data, dict): + if type(url_data) == dict: url_data = urlencode(url_data) else: exit("URL data '%s' for request to URL '%s' was not valid - should be a dictionary." % (str(url_data), url)) @@ -54,7 +69,7 @@ def __init__(self, url=None, url_data=None, body=None, response_stream=None, tim # set the URL with url parameters if they were given self._r.setopt(self._r.URL, url + (("?%s" % url_data) if url_data else "")) - if response_stream and not isinstance(response_stream, StringIO): + if response_stream and type(response_stream) != StringIO: response_stream = StringIO() # copy reference to instance variable self._response = response_stream @@ -79,7 +94,7 @@ def send(self): attempt += 1 # this catches exceptions that occur with the actual http request # not exceptions sent back from server side - if isinstance(e, pycurl.error) and e[0] in [7, 52]: + if type(e) == pycurl.error and e[0] in [7, 52]: # wait two seconds to retry print("Request failed - waiting 3 seconds to retry.") sleep(3) @@ -89,4 +104,4 @@ def send(self): print("Unforesoon error occurred when sending data to server.") traceback.print_exc() if attempt == max_retries: - raise NoMoreRetriesException(max_retries) \ No newline at end of file + raise NoMoreRetriesException(max_retries)""" \ No newline at end of file diff --git a/CondCore/Utilities/python/CondDBFW/utils.py b/CondCore/Utilities/python/CondDBFW/utils.py index 053dacb0c15d2..277995e824b50 100644 --- a/CondCore/Utilities/python/CondDBFW/utils.py +++ b/CondCore/Utilities/python/CondDBFW/utils.py @@ -7,13 +7,13 @@ def to_timestamp(obj): """ Takes a datetime object and outputs a timestamp string with the format Y-m-d H:m:S.f """ - return obj.strftime('%Y-%m-%d %H:%M:%S.%f') if isinstance(obj, datetime.datetime) else obj + return obj.strftime('%d-%b-%y %I:%M:%S.%f %p') if isinstance(obj, datetime.datetime) else obj def to_datetime(date_string): """ Takes a date string with the format Y-m-d H:m:S.f and gives back a datetime.datetime object """ - return datetime.datetime.strptime(date_string.replace(",", "."), "%Y-%m-%d %H:%M:%S.%f") + return datetime.datetime.strptime(date_string.replace(",", "."), "%d-%b-%y %I:%M:%S.%f %p") def friendly_since(time_type, since): """ diff --git a/CondCore/Utilities/python/cond2xml.py b/CondCore/Utilities/python/cond2xml.py index 4043ec64b624f..1a64d662f4506 100644 --- a/CondCore/Utilities/python/cond2xml.py +++ b/CondCore/Utilities/python/cond2xml.py @@ -52,6 +52,10 @@ def localLibName( payloadType ): ptype = payloadType.replace('::','_') return "%s_%spayload2xml" %(sanitize(ptype),prefix) +def boost_version_for_this_release(): + import pluginUtilities_payload2xml as mod2XML + return mod2XML.boost_version_label() + class CondXmlProcessor(object): def __init__(self, condDBIn): diff --git a/CondCore/Utilities/python/o2olib.py b/CondCore/Utilities/python/o2olib.py index f76fc65d645db..ea873305c9028 100644 --- a/CondCore/Utilities/python/o2olib.py +++ b/CondCore/Utilities/python/o2olib.py @@ -139,7 +139,7 @@ def connect( self, service, args ): if self.session is None: return False else: - self.db_connection = coral_tpl %(service[0],schema_name) + self.db_connection = coral_tpl %(service,schema_name) self.conf_dict['db']=self.db_connection return True def runManager( self ): @@ -371,7 +371,7 @@ def executeJob( self, args ): return started ret = -1 try: - # replacing %([key])s placeholders... + # replacing %([key])s placeholders... command = command %(self.conf_dict) #replacing {[key]} placeholders command = command.format(**self.conf_dict ) diff --git a/CondCore/Utilities/scripts/conddb b/CondCore/Utilities/scripts/conddb index 886f8a3f087c1..0e5c2e60daeee 100755 --- a/CondCore/Utilities/scripts/conddb +++ b/CondCore/Utilities/scripts/conddb @@ -573,7 +573,7 @@ def search(args): session = connection.session() max_limit = 100 - if args.limit > max_limit: + if args.limit is not None and int(args.limit) > max_limit: raise Exception('The limit on the number of returned results is capped at %s. Please use a reasonable limit.' % max_limit) if connection.is_frontier and ':' in args.string: @@ -739,6 +739,24 @@ def _get_last_frozen_since( session, tagName, fcsr=None ): logging.debug('Last frozen since in destination tag is %s' %res) return res +def _get_maxtime_for_boost_version( session, timeType, boost_version): + BoostRunMap = session.get_dbtype(conddb.BoostRunMap) + q = session.query(BoostRunMap).order_by(BoostRunMap.boost_version.asc()) + time = (maxSince,maxSince,maxSince) + for r in q: + r= _rawdict(r) + if boost_version < r['boost_version']: + tlumi = r['run_number']<<32|0x1 + time = (r['run_number'],tlumi,r['run_start_time']) + break + if timeType=='Run': + return time[0] + elif timeType=='Lumi': + return time[1] + elif timeType=='Time': + return time[2] + return None + class run_to_timestamp( object ): def __init__( self, session ): self.session = session @@ -1833,8 +1851,13 @@ def _copy_tag(args, copyTime, session1, session2, first, second, fromIOV=None, t logging.debug('%s iov(s) to copy with %s payload(s)' %(len(iovs),len(hashes))) else: + maxTime = _get_maxtime_for_boost_version( session1, tag['time_type'], cond2xml.boost_version_for_this_release()) + logging.info('Max time for boost version %s is %s'%(cond2xml.boost_version_for_this_release(),maxTime)) query = query.order_by(IOV1.since.desc(), IOV1.insertion_time.desc()) lastIov = None + prevIovSince = None + targetIovSince = None + targetIovPayload = None for iov in query: iov = _rawdict(iov) since = iov['since'] @@ -1842,9 +1865,15 @@ def _copy_tag(args, copyTime, session1, session2, first, second, fromIOV=None, t lastIov = since else: if lastIov != since: - iovs[since] = iov['payload_hash'] - hashes.add( iov['payload_hash'] ) - break + if targetIovSince is None: + targetIovSince = since + if since < maxTime: + targetIovPayload = iov['payload_hash'] + prevIovSince = since + break + iovs[prevIovSince]=targetIovPayload + iovs[targetIovSince]=targetIovPayload + hashes.add(targetIovPayload) logfun = logging.info if len(iovs)==0: logfun = logging.warning diff --git a/CondCore/Utilities/src/CondDBFetch.cc b/CondCore/Utilities/src/CondDBFetch.cc index 25aa9d1e16edd..7043331b0a519 100644 --- a/CondCore/Utilities/src/CondDBFetch.cc +++ b/CondCore/Utilities/src/CondDBFetch.cc @@ -57,6 +57,8 @@ namespace cond { FETCH_PAYLOAD_CASE(CTPPSPixelGainCalibrations) FETCH_PAYLOAD_CASE(CTPPSRPAlignmentCorrectionsData) FETCH_PAYLOAD_CASE(PPSAlignmentConfig) + FETCH_PAYLOAD_CASE(PPSAlignmentConfiguration) + FETCH_PAYLOAD_CASE(PPSAssociationCuts) FETCH_PAYLOAD_CASE(LHCOpticalFunctionsSetCollection) FETCH_PAYLOAD_CASE(CastorChannelQuality) FETCH_PAYLOAD_CASE(CastorElectronicsMap) @@ -344,9 +346,7 @@ namespace cond { std::string payloadTypeName; bool found = session.fetchPayloadData(payloadId, payloadTypeName, data, streamerInfo); if (!found) - throwException( - "Payload with id " + boost::lexical_cast(payloadId) + " has not been found in the database.", - "fetch"); + throwException("Payload with id " + payloadId + " has not been found in the database.", "fetch"); return fetchOne(payloadTypeName, data, streamerInfo, payloadPtr); } diff --git a/CondCore/Utilities/src/CondDBImport.cc b/CondCore/Utilities/src/CondDBImport.cc index 0a93d0b0346b4..2f28abd8b2728 100644 --- a/CondCore/Utilities/src/CondDBImport.cc +++ b/CondCore/Utilities/src/CondDBImport.cc @@ -77,6 +77,8 @@ namespace cond { IMPORT_PAYLOAD_CASE(CTPPSPixelGainCalibrations) IMPORT_PAYLOAD_CASE(CTPPSRPAlignmentCorrectionsData) IMPORT_PAYLOAD_CASE(PPSAlignmentConfig) + IMPORT_PAYLOAD_CASE(PPSAlignmentConfiguration) + IMPORT_PAYLOAD_CASE(PPSAssociationCuts) IMPORT_PAYLOAD_CASE(LHCOpticalFunctionsSetCollection) IMPORT_PAYLOAD_CASE(CastorChannelQuality) IMPORT_PAYLOAD_CASE(CastorElectronicsMap) diff --git a/CondCore/Utilities/src/CondFormats.h b/CondCore/Utilities/src/CondFormats.h index 48fe8f23f996b..2fc9054377a8f 100644 --- a/CondCore/Utilities/src/CondFormats.h +++ b/CondCore/Utilities/src/CondFormats.h @@ -32,7 +32,9 @@ #include "CondFormats/PPSObjects/interface/CTPPSPixelAnalysisMask.h" #include "CondFormats/PPSObjects/interface/CTPPSPixelGainCalibrations.h" #include "CondFormats/PPSObjects/interface/CTPPSRPAlignmentCorrectionsData.h" +#include "CondFormats/PPSObjects/interface/PPSAssociationCuts.h" #include "CondFormats/PPSObjects/interface/PPSTimingCalibration.h" +#include "CondFormats/PPSObjects/interface/PPSAlignmentConfiguration.h" #include "CondFormats/PPSObjects/interface/LHCOpticalFunctionsSetCollection.h" #include "CondFormats/PPSObjects/interface/PPSAlignmentConfig.h" #include "CondFormats/DTObjects/interface/DTCCBConfig.h" diff --git a/CondCore/Utilities/test/testPngHistograms.cpp b/CondCore/Utilities/test/testPngHistograms.cpp index f527f6e4ce27e..0ecbfef087a3b 100644 --- a/CondCore/Utilities/test/testPngHistograms.cpp +++ b/CondCore/Utilities/test/testPngHistograms.cpp @@ -23,7 +23,7 @@ int main(int argc, char** argv) { std::string connectionString("frontier://FrontierProd/CMS_CONDITIONS"); std::string tag = std::string("BasicPayload_v10.0"); - cond::Time_t since = boost::lexical_cast("901"); + cond::Time_t since = std::stoull("901"); std::cout << "## PNG Histo" << std::endl; diff --git a/CondFormats/BeamSpotObjects/interface/BeamSpotOnlineObjects.h b/CondFormats/BeamSpotObjects/interface/BeamSpotOnlineObjects.h index 335a7ec58f155..3383c661db12a 100644 --- a/CondFormats/BeamSpotObjects/interface/BeamSpotOnlineObjects.h +++ b/CondFormats/BeamSpotObjects/interface/BeamSpotOnlineObjects.h @@ -30,14 +30,18 @@ class BeamSpotOnlineObjects : public BeamSpotObjects { lastAnalyzedRun_ = 0; lastAnalyzedFill_ = 0; intParams_.resize(ISIZE, std::vector(1, 0)); + floatParams_.resize(FSIZE, std::vector(1, 0.0)); + stringParams_.resize(SSIZE, std::vector(1, "")); timeParams_.resize(TSIZE, std::vector(1, 0ULL)); } ~BeamSpotOnlineObjects() override {} /// Enums - enum IntParamIndex { NUM_TRACKS = 0, NUM_PVS = 1, ISIZE = 2 }; - enum TimeParamIndex { CREATE_TIME = 0, TSIZE = 1 }; + enum IntParamIndex { NUM_TRACKS = 0, NUM_PVS = 1, USED_EVENTS = 2, MAX_PVS = 3, ISIZE = 4 }; + enum FloatParamIndex { MEAN_PV = 0, ERR_MEAN_PV = 1, RMS_PV = 2, ERR_RMS_PV = 3, FSIZE = 4 }; + enum StringParamIndex { START_TIME = 0, END_TIME = 1, LUMI_RANGE = 2, SSIZE = 3 }; + enum TimeParamIndex { CREATE_TIME = 0, START_TIMESTAMP = 1, END_TIMESTAMP = 2, TSIZE = 3 }; /// Setters Methods // set lastAnalyzedLumi_, last analyzed lumisection @@ -55,9 +59,42 @@ class BeamSpotOnlineObjects : public BeamSpotObjects { // set number of Primary Vertices used in the BeamSpot fit void SetNumPVs(int val); + // set number of Events used in the BeamSpot fit (for DIP) + void SetUsedEvents(int val); + + // set max number of Primary Vertices used in the BeamSpot fit (for DIP) + void SetMaxPVs(int val); + + // set mean number of PVs (for DIP) + void SetMeanPV(float val); + + // set error on mean number of PVs (for DIP) + void SetMeanErrorPV(float val); + + // set rms of number of PVs (for DIP) + void SetRmsPV(float val); + + // set error on rm of number of PVs (for DIP) + void SetRmsErrorPV(float val); + + // set start time of the firs LS as string (for DIP) + void SetStartTime(std::string val); + + // set end time of the last LS as string (for DIP) + void SetEndTime(std::string val); + + // set lumi range as string (for DIP) + void SetLumiRange(std::string val); + // set creation time of the payload void SetCreationTime(cond::Time_t val); + // set timestamp of the first LS (for DIP) + void SetStartTimeStamp(cond::Time_t val); + + // set timestamp of the last LS (for DIP) + void SetEndTimeStamp(cond::Time_t val); + /// Getters Methods // get lastAnalyzedLumi_, last analyzed lumisection int GetLastAnalyzedLumi() const { return lastAnalyzedLumi_; } @@ -74,9 +111,42 @@ class BeamSpotOnlineObjects : public BeamSpotObjects { // get number of Primary Vertices used in the BeamSpot fit int GetNumPVs() const; + // get number of Events used in the BeamSpot fit (for DIP) + int GetUsedEvents() const; + + // get max number of Primary Vertices used in the BeamSpot fit (for DIP) + int GetMaxPVs() const; + + // get mean number of PVs (for DIP) + float GetMeanPV() const; + + // get error on mean number of PVs (for DIP) + float GetMeanErrorPV() const; + + // get rms of number of PVs (for DIP) + float GetRmsPV() const; + + // get error on rm of number of PVs (for DIP) + float GetRmsErrorPV() const; + + // get start time of the firs LS as string (for DIP) + std::string GetStartTime() const; + + // get end time of the last LS as string (for DIP) + std::string GetEndTime() const; + + // get lumi range as string (for DIP) + std::string GetLumiRange() const; + // get creation time of the payload cond::Time_t GetCreationTime() const; + // get timestamp of the first LS (for DIP) + cond::Time_t GetStartTimeStamp() const; + + // get timestamp of the last LS (for DIP) + cond::Time_t GetEndTimeStamp() const; + /// Print BeamSpotOnline parameters void print(std::stringstream& ss) const; @@ -87,7 +157,7 @@ class BeamSpotOnlineObjects : public BeamSpotObjects { std::vector > intParams_; std::vector > floatParams_; std::vector > stringParams_; - std::vector > timeParams_; + std::vector > timeParams_; // unsigned long long is equal to cond::Time_t COND_SERIALIZABLE; }; diff --git a/CondFormats/BeamSpotObjects/src/BeamSpotOnlineObjects.cc b/CondFormats/BeamSpotObjects/src/BeamSpotOnlineObjects.cc index 23acf630b4059..1edd2b5db69a1 100644 --- a/CondFormats/BeamSpotObjects/src/BeamSpotOnlineObjects.cc +++ b/CondFormats/BeamSpotObjects/src/BeamSpotOnlineObjects.cc @@ -51,10 +51,48 @@ int BeamSpotOnlineObjects::GetNumTracks() const { int BeamSpotOnlineObjects::GetNumPVs() const { return BeamSpotOnlineObjectsImpl::getOneParam(intParams_, NUM_PVS); } +int BeamSpotOnlineObjects::GetUsedEvents() const { + return BeamSpotOnlineObjectsImpl::getOneParam(intParams_, USED_EVENTS); +} + +int BeamSpotOnlineObjects::GetMaxPVs() const { return BeamSpotOnlineObjectsImpl::getOneParam(intParams_, MAX_PVS); } + +float BeamSpotOnlineObjects::GetMeanPV() const { return BeamSpotOnlineObjectsImpl::getOneParam(floatParams_, MEAN_PV); } + +float BeamSpotOnlineObjects::GetMeanErrorPV() const { + return BeamSpotOnlineObjectsImpl::getOneParam(floatParams_, ERR_MEAN_PV); +} + +float BeamSpotOnlineObjects::GetRmsPV() const { return BeamSpotOnlineObjectsImpl::getOneParam(floatParams_, RMS_PV); } + +float BeamSpotOnlineObjects::GetRmsErrorPV() const { + return BeamSpotOnlineObjectsImpl::getOneParam(floatParams_, ERR_RMS_PV); +} + +std::string BeamSpotOnlineObjects::GetStartTime() const { + return BeamSpotOnlineObjectsImpl::getOneParam(stringParams_, START_TIME); +} + +std::string BeamSpotOnlineObjects::GetEndTime() const { + return BeamSpotOnlineObjectsImpl::getOneParam(stringParams_, END_TIME); +} + +std::string BeamSpotOnlineObjects::GetLumiRange() const { + return BeamSpotOnlineObjectsImpl::getOneParam(stringParams_, LUMI_RANGE); +} + cond::Time_t BeamSpotOnlineObjects::GetCreationTime() const { return BeamSpotOnlineObjectsImpl::getOneParam(timeParams_, CREATE_TIME); } +cond::Time_t BeamSpotOnlineObjects::GetStartTimeStamp() const { + return BeamSpotOnlineObjectsImpl::getOneParam(timeParams_, START_TIMESTAMP); +} + +cond::Time_t BeamSpotOnlineObjects::GetEndTimeStamp() const { + return BeamSpotOnlineObjectsImpl::getOneParam(timeParams_, END_TIMESTAMP); +} + // setters void BeamSpotOnlineObjects::SetNumTracks(int nTracks) { BeamSpotOnlineObjectsImpl::setOneParam(intParams_, NUM_TRACKS, nTracks); @@ -62,10 +100,54 @@ void BeamSpotOnlineObjects::SetNumTracks(int nTracks) { void BeamSpotOnlineObjects::SetNumPVs(int nPVs) { BeamSpotOnlineObjectsImpl::setOneParam(intParams_, NUM_PVS, nPVs); } +void BeamSpotOnlineObjects::SetUsedEvents(int usedEvents) { + BeamSpotOnlineObjectsImpl::setOneParam(intParams_, USED_EVENTS, usedEvents); +} + +void BeamSpotOnlineObjects::SetMaxPVs(int maxPVs) { + BeamSpotOnlineObjectsImpl::setOneParam(intParams_, MAX_PVS, maxPVs); +} + +void BeamSpotOnlineObjects::SetMeanPV(float meanPVs) { + BeamSpotOnlineObjectsImpl::setOneParam(floatParams_, MEAN_PV, meanPVs); +} + +void BeamSpotOnlineObjects::SetMeanErrorPV(float errMeanPVs) { + BeamSpotOnlineObjectsImpl::setOneParam(floatParams_, ERR_MEAN_PV, errMeanPVs); +} + +void BeamSpotOnlineObjects::SetRmsPV(float rmsPVs) { + BeamSpotOnlineObjectsImpl::setOneParam(floatParams_, RMS_PV, rmsPVs); +} + +void BeamSpotOnlineObjects::SetRmsErrorPV(float errRmsPVs) { + BeamSpotOnlineObjectsImpl::setOneParam(floatParams_, ERR_RMS_PV, errRmsPVs); +} + +void BeamSpotOnlineObjects::SetStartTime(std::string startTime) { + BeamSpotOnlineObjectsImpl::setOneParam(stringParams_, START_TIME, startTime); +} + +void BeamSpotOnlineObjects::SetEndTime(std::string endTime) { + BeamSpotOnlineObjectsImpl::setOneParam(stringParams_, END_TIME, endTime); +} + +void BeamSpotOnlineObjects::SetLumiRange(std::string lumiRange) { + BeamSpotOnlineObjectsImpl::setOneParam(stringParams_, LUMI_RANGE, lumiRange); +} + void BeamSpotOnlineObjects::SetCreationTime(cond::Time_t createTime) { BeamSpotOnlineObjectsImpl::setOneParam(timeParams_, CREATE_TIME, createTime); } +void BeamSpotOnlineObjects::SetStartTimeStamp(cond::Time_t starTimeStamp) { + BeamSpotOnlineObjectsImpl::setOneParam(timeParams_, START_TIMESTAMP, starTimeStamp); +} + +void BeamSpotOnlineObjects::SetEndTimeStamp(cond::Time_t endTimeStamp) { + BeamSpotOnlineObjectsImpl::setOneParam(timeParams_, END_TIMESTAMP, endTimeStamp); +} + // printers void BeamSpotOnlineObjects::print(std::stringstream& ss) const { ss << "-----------------------------------------------------\n" diff --git a/CondFormats/CSCObjects/interface/CSCL1TPLookupTableCCLUT.h b/CondFormats/CSCObjects/interface/CSCL1TPLookupTableCCLUT.h new file mode 100644 index 0000000000000..3afcb817c9abd --- /dev/null +++ b/CondFormats/CSCObjects/interface/CSCL1TPLookupTableCCLUT.h @@ -0,0 +1,30 @@ +#ifndef CondFormats_CSCObjects_CSCL1TPLookupTableCCLUT_h +#define CondFormats_CSCObjects_CSCL1TPLookupTableCCLUT_h + +#include "CondFormats/Serialization/interface/Serializable.h" +#include +#include + +class CSCL1TPLookupTableCCLUT { +public: + CSCL1TPLookupTableCCLUT(); + ~CSCL1TPLookupTableCCLUT() {} + + typedef std::unordered_map > t_lut; + + // setters + void set_cclutPosition(t_lut lut); + void set_cclutSlope(t_lut lut); + + // getters + unsigned cclutPosition(unsigned pattern, unsigned code) const; + unsigned cclutSlope(unsigned pattern, unsigned code) const; + +private: + t_lut cclutPosition_; + t_lut cclutSlope_; + + COND_SERIALIZABLE; +}; + +#endif diff --git a/CondFormats/CSCObjects/interface/CSCL1TPLookupTableME11ILT.h b/CondFormats/CSCObjects/interface/CSCL1TPLookupTableME11ILT.h new file mode 100644 index 0000000000000..f6d530d30afe9 --- /dev/null +++ b/CondFormats/CSCObjects/interface/CSCL1TPLookupTableME11ILT.h @@ -0,0 +1,156 @@ +#ifndef CondFormats_CSCObjects_CSCL1TPLookupTableME11ILT_h +#define CondFormats_CSCObjects_CSCL1TPLookupTableME11ILT_h + +#include "CondFormats/Serialization/interface/Serializable.h" +#include + +class CSCL1TPLookupTableME11ILT { +public: + CSCL1TPLookupTableME11ILT(); + + ~CSCL1TPLookupTableME11ILT() {} + + typedef std::vector t_lut; + + // setters + void set_GEM_pad_CSC_hs_ME1b_even(t_lut lut); + void set_GEM_pad_CSC_hs_ME1a_even(t_lut lut); + void set_GEM_pad_CSC_hs_ME1b_odd(t_lut lut); + void set_GEM_pad_CSC_hs_ME1a_odd(t_lut lut); + + void set_GEM_pad_CSC_es_ME1b_even(t_lut lut); + void set_GEM_pad_CSC_es_ME1a_even(t_lut lut); + void set_GEM_pad_CSC_es_ME1b_odd(t_lut lut); + void set_GEM_pad_CSC_es_ME1a_odd(t_lut lut); + + void set_GEM_roll_L1_CSC_min_wg_ME11_even(t_lut lut); + void set_GEM_roll_L1_CSC_max_wg_ME11_even(t_lut lut); + void set_GEM_roll_L1_CSC_min_wg_ME11_odd(t_lut lut); + void set_GEM_roll_L1_CSC_max_wg_ME11_odd(t_lut lut); + + void set_GEM_roll_L2_CSC_min_wg_ME11_even(t_lut lut); + void set_GEM_roll_L2_CSC_max_wg_ME11_even(t_lut lut); + void set_GEM_roll_L2_CSC_min_wg_ME11_odd(t_lut lut); + void set_GEM_roll_L2_CSC_max_wg_ME11_odd(t_lut lut); + + // GEM-CSC trigger: slope correction + void set_CSC_slope_cosi_2to1_L1_ME11_even(t_lut lut); + void set_CSC_slope_cosi_2to1_L1_ME11_odd(t_lut lut); + void set_CSC_slope_cosi_3to1_L1_ME11_even(t_lut lut); + void set_CSC_slope_cosi_3to1_L1_ME11_odd(t_lut lut); + + void set_CSC_slope_cosi_corr_L1_ME11_even(t_lut lut); + void set_CSC_slope_cosi_corr_L2_ME11_even(t_lut lut); + void set_CSC_slope_cosi_corr_L1_ME11_odd(t_lut lut); + void set_CSC_slope_cosi_corr_L2_ME11_odd(t_lut lut); + + void set_CSC_slope_corr_L1_ME11_even(t_lut lut); + void set_CSC_slope_corr_L2_ME11_even(t_lut lut); + void set_CSC_slope_corr_L1_ME11_odd(t_lut lut); + void set_CSC_slope_corr_L2_ME11_odd(t_lut lut); + + void set_es_diff_slope_L1_ME1a_even(t_lut lut); + void set_es_diff_slope_L2_ME1a_even(t_lut lut); + void set_es_diff_slope_L1_ME1a_odd(t_lut lut); + void set_es_diff_slope_L2_ME1a_odd(t_lut lut); + void set_es_diff_slope_L1_ME1b_even(t_lut lut); + void set_es_diff_slope_L2_ME1b_even(t_lut lut); + void set_es_diff_slope_L1_ME1b_odd(t_lut lut); + void set_es_diff_slope_L2_ME1b_odd(t_lut lut); + + // getters + unsigned GEM_pad_CSC_hs_ME1b_even(unsigned pad) const; + unsigned GEM_pad_CSC_hs_ME1a_even(unsigned pad) const; + unsigned GEM_pad_CSC_hs_ME1b_odd(unsigned pad) const; + unsigned GEM_pad_CSC_hs_ME1a_odd(unsigned pad) const; + + unsigned GEM_pad_CSC_es_ME1b_even(unsigned pad) const; + unsigned GEM_pad_CSC_es_ME1a_even(unsigned pad) const; + unsigned GEM_pad_CSC_es_ME1b_odd(unsigned pad) const; + unsigned GEM_pad_CSC_es_ME1a_odd(unsigned pad) const; + + unsigned GEM_roll_L1_CSC_min_wg_ME11_even(unsigned roll) const; + unsigned GEM_roll_L1_CSC_max_wg_ME11_even(unsigned roll) const; + unsigned GEM_roll_L1_CSC_min_wg_ME11_odd(unsigned roll) const; + unsigned GEM_roll_L1_CSC_max_wg_ME11_odd(unsigned roll) const; + + unsigned GEM_roll_L2_CSC_min_wg_ME11_even(unsigned roll) const; + unsigned GEM_roll_L2_CSC_max_wg_ME11_even(unsigned roll) const; + unsigned GEM_roll_L2_CSC_min_wg_ME11_odd(unsigned roll) const; + unsigned GEM_roll_L2_CSC_max_wg_ME11_odd(unsigned roll) const; + + // GEM-CSC trigger: slope correction + unsigned CSC_slope_cosi_2to1_L1_ME11_even(unsigned channel) const; + unsigned CSC_slope_cosi_2to1_L1_ME11_odd(unsigned channel) const; + unsigned CSC_slope_cosi_3to1_L1_ME11_even(unsigned channel) const; + unsigned CSC_slope_cosi_3to1_L1_ME11_odd(unsigned channel) const; + + unsigned CSC_slope_cosi_corr_L1_ME11_even(unsigned channel) const; + unsigned CSC_slope_cosi_corr_L2_ME11_even(unsigned channel) const; + unsigned CSC_slope_cosi_corr_L1_ME11_odd(unsigned channel) const; + unsigned CSC_slope_cosi_corr_L2_ME11_odd(unsigned channel) const; + + unsigned CSC_slope_corr_L1_ME11_even(unsigned channel) const; + unsigned CSC_slope_corr_L2_ME11_even(unsigned channel) const; + unsigned CSC_slope_corr_L1_ME11_odd(unsigned channel) const; + unsigned CSC_slope_corr_L2_ME11_odd(unsigned channel) const; + + // GEM-CSC trigger: 1/8-strip difference to slope + unsigned es_diff_slope_L1_ME1a_even(unsigned es_diff) const; + unsigned es_diff_slope_L2_ME1a_even(unsigned es_diff) const; + unsigned es_diff_slope_L1_ME1a_odd(unsigned es_diff) const; + unsigned es_diff_slope_L2_ME1a_odd(unsigned es_diff) const; + unsigned es_diff_slope_L1_ME1b_even(unsigned es_diff) const; + unsigned es_diff_slope_L2_ME1b_even(unsigned es_diff) const; + unsigned es_diff_slope_L1_ME1b_odd(unsigned es_diff) const; + unsigned es_diff_slope_L2_ME1b_odd(unsigned es_diff) const; + +private: + t_lut GEM_pad_CSC_hs_ME1b_even_; + t_lut GEM_pad_CSC_hs_ME1a_even_; + t_lut GEM_pad_CSC_hs_ME1b_odd_; + t_lut GEM_pad_CSC_hs_ME1a_odd_; + + t_lut GEM_pad_CSC_es_ME1b_even_; + t_lut GEM_pad_CSC_es_ME1a_even_; + t_lut GEM_pad_CSC_es_ME1b_odd_; + t_lut GEM_pad_CSC_es_ME1a_odd_; + + t_lut GEM_roll_L1_CSC_min_wg_ME11_even_; + t_lut GEM_roll_L1_CSC_max_wg_ME11_even_; + t_lut GEM_roll_L1_CSC_min_wg_ME11_odd_; + t_lut GEM_roll_L1_CSC_max_wg_ME11_odd_; + + t_lut GEM_roll_L2_CSC_min_wg_ME11_even_; + t_lut GEM_roll_L2_CSC_max_wg_ME11_even_; + t_lut GEM_roll_L2_CSC_min_wg_ME11_odd_; + t_lut GEM_roll_L2_CSC_max_wg_ME11_odd_; + + t_lut CSC_slope_cosi_2to1_L1_ME11_even_; + t_lut CSC_slope_cosi_2to1_L1_ME11_odd_; + t_lut CSC_slope_cosi_3to1_L1_ME11_even_; + t_lut CSC_slope_cosi_3to1_L1_ME11_odd_; + + t_lut CSC_slope_cosi_corr_L1_ME11_even_; + t_lut CSC_slope_cosi_corr_L2_ME11_even_; + t_lut CSC_slope_cosi_corr_L1_ME11_odd_; + t_lut CSC_slope_cosi_corr_L2_ME11_odd_; + + t_lut CSC_slope_corr_L1_ME11_even_; + t_lut CSC_slope_corr_L2_ME11_even_; + t_lut CSC_slope_corr_L1_ME11_odd_; + t_lut CSC_slope_corr_L2_ME11_odd_; + + t_lut es_diff_slope_L1_ME1a_even_; + t_lut es_diff_slope_L2_ME1a_even_; + t_lut es_diff_slope_L1_ME1a_odd_; + t_lut es_diff_slope_L2_ME1a_odd_; + t_lut es_diff_slope_L1_ME1b_even_; + t_lut es_diff_slope_L2_ME1b_even_; + t_lut es_diff_slope_L1_ME1b_odd_; + t_lut es_diff_slope_L2_ME1b_odd_; + + COND_SERIALIZABLE; +}; + +#endif diff --git a/CondFormats/CSCObjects/interface/CSCL1TPLookupTableME21ILT.h b/CondFormats/CSCObjects/interface/CSCL1TPLookupTableME21ILT.h new file mode 100644 index 0000000000000..733581f13cf44 --- /dev/null +++ b/CondFormats/CSCObjects/interface/CSCL1TPLookupTableME21ILT.h @@ -0,0 +1,85 @@ +#ifndef CondFormats_CSCObjects_CSCL1TPLookupTableME21ILT_h +#define CondFormats_CSCObjects_CSCL1TPLookupTableME21ILT_h + +#include "CondFormats/Serialization/interface/Serializable.h" +#include + +class CSCL1TPLookupTableME21ILT { +public: + CSCL1TPLookupTableME21ILT(); + + ~CSCL1TPLookupTableME21ILT() {} + + typedef std::vector t_lut; + + // setters + void set_GEM_pad_CSC_hs_ME21_even(t_lut lut); + void set_GEM_pad_CSC_hs_ME21_odd(t_lut lut); + + void set_GEM_pad_CSC_es_ME21_even(t_lut lut); + void set_GEM_pad_CSC_es_ME21_odd(t_lut lut); + + void set_GEM_roll_L1_CSC_min_wg_ME21_even(t_lut lut); + void set_GEM_roll_L1_CSC_max_wg_ME21_even(t_lut lut); + void set_GEM_roll_L1_CSC_min_wg_ME21_odd(t_lut lut); + void set_GEM_roll_L1_CSC_max_wg_ME21_odd(t_lut lut); + + void set_GEM_roll_L2_CSC_min_wg_ME21_even(t_lut lut); + void set_GEM_roll_L2_CSC_max_wg_ME21_even(t_lut lut); + void set_GEM_roll_L2_CSC_min_wg_ME21_odd(t_lut lut); + void set_GEM_roll_L2_CSC_max_wg_ME21_odd(t_lut lut); + + void set_es_diff_slope_L1_ME21_even(t_lut lut); + void set_es_diff_slope_L2_ME21_even(t_lut lut); + void set_es_diff_slope_L1_ME21_odd(t_lut lut); + void set_es_diff_slope_L2_ME21_odd(t_lut lut); + + // getters + unsigned GEM_pad_CSC_hs_ME21_even(unsigned pad) const; + unsigned GEM_pad_CSC_hs_ME21_odd(unsigned pad) const; + + unsigned GEM_pad_CSC_es_ME21_even(unsigned pad) const; + unsigned GEM_pad_CSC_es_ME21_odd(unsigned pad) const; + + unsigned GEM_roll_L1_CSC_min_wg_ME21_even(unsigned roll) const; + unsigned GEM_roll_L1_CSC_max_wg_ME21_even(unsigned roll) const; + unsigned GEM_roll_L1_CSC_min_wg_ME21_odd(unsigned roll) const; + unsigned GEM_roll_L1_CSC_max_wg_ME21_odd(unsigned roll) const; + + unsigned GEM_roll_L2_CSC_min_wg_ME21_even(unsigned roll) const; + unsigned GEM_roll_L2_CSC_max_wg_ME21_even(unsigned roll) const; + unsigned GEM_roll_L2_CSC_min_wg_ME21_odd(unsigned roll) const; + unsigned GEM_roll_L2_CSC_max_wg_ME21_odd(unsigned roll) const; + + // GEM-CSC trigger: 1/8-strip difference to slope + unsigned es_diff_slope_L1_ME21_even(unsigned es_diff) const; + unsigned es_diff_slope_L2_ME21_even(unsigned es_diff) const; + unsigned es_diff_slope_L1_ME21_odd(unsigned es_diff) const; + unsigned es_diff_slope_L2_ME21_odd(unsigned es_diff) const; + +private: + std::vector GEM_pad_CSC_hs_ME21_even_; + std::vector GEM_pad_CSC_hs_ME21_odd_; + + std::vector GEM_pad_CSC_es_ME21_even_; + std::vector GEM_pad_CSC_es_ME21_odd_; + + std::vector GEM_roll_L1_CSC_min_wg_ME21_even_; + std::vector GEM_roll_L1_CSC_max_wg_ME21_even_; + std::vector GEM_roll_L1_CSC_min_wg_ME21_odd_; + std::vector GEM_roll_L1_CSC_max_wg_ME21_odd_; + + std::vector GEM_roll_L2_CSC_min_wg_ME21_even_; + std::vector GEM_roll_L2_CSC_max_wg_ME21_even_; + std::vector GEM_roll_L2_CSC_min_wg_ME21_odd_; + std::vector GEM_roll_L2_CSC_max_wg_ME21_odd_; + + std::vector es_diff_slope_L1_ME21_even_; + std::vector es_diff_slope_L2_ME21_even_; + std::vector es_diff_slope_L1_ME21_odd_; + std::vector es_diff_slope_L2_ME21_odd_; + + COND_SERIALIZABLE; +}; + +#endif diff --git a/CondFormats/CSCObjects/src/CSCL1TPLookupTableCCLUT.cc b/CondFormats/CSCObjects/src/CSCL1TPLookupTableCCLUT.cc new file mode 100644 index 0000000000000..85db058d93587 --- /dev/null +++ b/CondFormats/CSCObjects/src/CSCL1TPLookupTableCCLUT.cc @@ -0,0 +1,18 @@ +#include "CondFormats/CSCObjects/interface/CSCL1TPLookupTableCCLUT.h" + +CSCL1TPLookupTableCCLUT::CSCL1TPLookupTableCCLUT() { + cclutPosition_.reserve(5); + cclutSlope_.reserve(5); +} + +void CSCL1TPLookupTableCCLUT::set_cclutPosition(t_lut lut) { cclutPosition_ = std::move(lut); } + +void CSCL1TPLookupTableCCLUT::set_cclutSlope(t_lut lut) { cclutSlope_ = std::move(lut); } + +unsigned CSCL1TPLookupTableCCLUT::cclutPosition(unsigned pattern, unsigned code) const { + return cclutPosition_.at(pattern)[code]; +} + +unsigned CSCL1TPLookupTableCCLUT::cclutSlope(unsigned pattern, unsigned code) const { + return cclutSlope_.at(pattern)[code]; +} diff --git a/CondFormats/CSCObjects/src/CSCL1TPLookupTableME11ILT.cc b/CondFormats/CSCObjects/src/CSCL1TPLookupTableME11ILT.cc new file mode 100644 index 0000000000000..c0dab08691faf --- /dev/null +++ b/CondFormats/CSCObjects/src/CSCL1TPLookupTableME11ILT.cc @@ -0,0 +1,321 @@ +#include "CondFormats/CSCObjects/interface/CSCL1TPLookupTableME11ILT.h" + +CSCL1TPLookupTableME11ILT::CSCL1TPLookupTableME11ILT() + : GEM_pad_CSC_hs_ME1b_even_(0), + GEM_pad_CSC_hs_ME1a_even_(0), + GEM_pad_CSC_hs_ME1b_odd_(0), + GEM_pad_CSC_hs_ME1a_odd_(0), + + GEM_pad_CSC_es_ME1b_even_(0), + GEM_pad_CSC_es_ME1a_even_(0), + GEM_pad_CSC_es_ME1b_odd_(0), + GEM_pad_CSC_es_ME1a_odd_(0), + + GEM_roll_L1_CSC_min_wg_ME11_even_(0), + GEM_roll_L1_CSC_max_wg_ME11_even_(0), + GEM_roll_L1_CSC_min_wg_ME11_odd_(0), + GEM_roll_L1_CSC_max_wg_ME11_odd_(0), + + GEM_roll_L2_CSC_min_wg_ME11_even_(0), + GEM_roll_L2_CSC_max_wg_ME11_even_(0), + GEM_roll_L2_CSC_min_wg_ME11_odd_(0), + GEM_roll_L2_CSC_max_wg_ME11_odd_(0), + + CSC_slope_cosi_2to1_L1_ME11_even_(0), + CSC_slope_cosi_2to1_L1_ME11_odd_(0), + CSC_slope_cosi_3to1_L1_ME11_even_(0), + CSC_slope_cosi_3to1_L1_ME11_odd_(0), + + CSC_slope_cosi_corr_L1_ME11_even_(0), + CSC_slope_cosi_corr_L2_ME11_even_(0), + CSC_slope_cosi_corr_L1_ME11_odd_(0), + CSC_slope_cosi_corr_L2_ME11_odd_(0), + + CSC_slope_corr_L1_ME11_even_(0), + CSC_slope_corr_L2_ME11_even_(0), + CSC_slope_corr_L1_ME11_odd_(0), + CSC_slope_corr_L2_ME11_odd_(0), + + es_diff_slope_L1_ME1a_even_(0), + es_diff_slope_L2_ME1a_even_(0), + es_diff_slope_L1_ME1a_odd_(0), + es_diff_slope_L2_ME1a_odd_(0), + es_diff_slope_L1_ME1b_even_(0), + es_diff_slope_L2_ME1b_even_(0), + es_diff_slope_L1_ME1b_odd_(0), + es_diff_slope_L2_ME1b_odd_(0) {} + +// GEM-CSC trigger: coordinate conversion +void CSCL1TPLookupTableME11ILT::set_GEM_pad_CSC_hs_ME1b_even(t_lut lut) { GEM_pad_CSC_hs_ME1b_even_ = std::move(lut); } + +void CSCL1TPLookupTableME11ILT::set_GEM_pad_CSC_hs_ME1a_even(t_lut lut) { GEM_pad_CSC_hs_ME1a_even_ = std::move(lut); } + +void CSCL1TPLookupTableME11ILT::set_GEM_pad_CSC_hs_ME1b_odd(t_lut lut) { GEM_pad_CSC_hs_ME1b_odd_ = std::move(lut); } + +void CSCL1TPLookupTableME11ILT::set_GEM_pad_CSC_hs_ME1a_odd(t_lut lut) { GEM_pad_CSC_hs_ME1a_odd_ = std::move(lut); } + +void CSCL1TPLookupTableME11ILT::set_GEM_pad_CSC_es_ME1b_even(t_lut lut) { GEM_pad_CSC_es_ME1b_even_ = std::move(lut); } + +void CSCL1TPLookupTableME11ILT::set_GEM_pad_CSC_es_ME1a_even(t_lut lut) { GEM_pad_CSC_es_ME1a_even_ = std::move(lut); } + +void CSCL1TPLookupTableME11ILT::set_GEM_pad_CSC_es_ME1b_odd(t_lut lut) { GEM_pad_CSC_es_ME1b_odd_ = std::move(lut); } + +void CSCL1TPLookupTableME11ILT::set_GEM_pad_CSC_es_ME1a_odd(t_lut lut) { GEM_pad_CSC_es_ME1a_odd_ = std::move(lut); } + +void CSCL1TPLookupTableME11ILT::set_GEM_roll_L1_CSC_min_wg_ME11_even(t_lut lut) { + GEM_roll_L1_CSC_min_wg_ME11_even_ = std::move(lut); +} + +void CSCL1TPLookupTableME11ILT::set_GEM_roll_L1_CSC_max_wg_ME11_even(t_lut lut) { + GEM_roll_L1_CSC_max_wg_ME11_even_ = std::move(lut); +} + +void CSCL1TPLookupTableME11ILT::set_GEM_roll_L1_CSC_min_wg_ME11_odd(t_lut lut) { + GEM_roll_L1_CSC_min_wg_ME11_odd_ = std::move(lut); +} + +void CSCL1TPLookupTableME11ILT::set_GEM_roll_L1_CSC_max_wg_ME11_odd(t_lut lut) { + GEM_roll_L1_CSC_max_wg_ME11_odd_ = std::move(lut); +} + +void CSCL1TPLookupTableME11ILT::set_GEM_roll_L2_CSC_min_wg_ME11_even(t_lut lut) { + GEM_roll_L2_CSC_min_wg_ME11_even_ = std::move(lut); +} + +void CSCL1TPLookupTableME11ILT::set_GEM_roll_L2_CSC_max_wg_ME11_even(t_lut lut) { + GEM_roll_L2_CSC_max_wg_ME11_even_ = std::move(lut); +} + +void CSCL1TPLookupTableME11ILT::set_GEM_roll_L2_CSC_min_wg_ME11_odd(t_lut lut) { + GEM_roll_L2_CSC_min_wg_ME11_odd_ = std::move(lut); +} + +void CSCL1TPLookupTableME11ILT::set_GEM_roll_L2_CSC_max_wg_ME11_odd(t_lut lut) { + GEM_roll_L2_CSC_max_wg_ME11_odd_ = std::move(lut); +} + +// GEM-CSC trigger: slope correction +void CSCL1TPLookupTableME11ILT::set_CSC_slope_cosi_2to1_L1_ME11_even(t_lut lut) { + CSC_slope_cosi_2to1_L1_ME11_even_ = std::move(lut); +} + +void CSCL1TPLookupTableME11ILT::set_CSC_slope_cosi_2to1_L1_ME11_odd(t_lut lut) { + CSC_slope_cosi_2to1_L1_ME11_odd_ = std::move(lut); +} + +void CSCL1TPLookupTableME11ILT::set_CSC_slope_cosi_3to1_L1_ME11_even(t_lut lut) { + CSC_slope_cosi_3to1_L1_ME11_even_ = std::move(lut); +} + +void CSCL1TPLookupTableME11ILT::set_CSC_slope_cosi_3to1_L1_ME11_odd(t_lut lut) { + CSC_slope_cosi_3to1_L1_ME11_odd_ = std::move(lut); +} + +void CSCL1TPLookupTableME11ILT::set_CSC_slope_cosi_corr_L1_ME11_even(t_lut lut) { + CSC_slope_cosi_corr_L1_ME11_even_ = std::move(lut); +} +void CSCL1TPLookupTableME11ILT::set_CSC_slope_cosi_corr_L2_ME11_even(t_lut lut) { + CSC_slope_cosi_corr_L2_ME11_even_ = std::move(lut); +} + +void CSCL1TPLookupTableME11ILT::set_CSC_slope_cosi_corr_L1_ME11_odd(t_lut lut) { + CSC_slope_cosi_corr_L1_ME11_odd_ = std::move(lut); +} + +void CSCL1TPLookupTableME11ILT::set_CSC_slope_cosi_corr_L2_ME11_odd(t_lut lut) { + CSC_slope_cosi_corr_L2_ME11_odd_ = std::move(lut); +} + +void CSCL1TPLookupTableME11ILT::set_CSC_slope_corr_L1_ME11_even(t_lut lut) { + CSC_slope_corr_L1_ME11_even_ = std::move(lut); +} + +void CSCL1TPLookupTableME11ILT::set_CSC_slope_corr_L2_ME11_even(t_lut lut) { + CSC_slope_corr_L2_ME11_even_ = std::move(lut); +} + +void CSCL1TPLookupTableME11ILT::set_CSC_slope_corr_L1_ME11_odd(t_lut lut) { + CSC_slope_corr_L1_ME11_odd_ = std::move(lut); +} + +void CSCL1TPLookupTableME11ILT::set_CSC_slope_corr_L2_ME11_odd(t_lut lut) { + CSC_slope_corr_L2_ME11_odd_ = std::move(lut); +} + +void CSCL1TPLookupTableME11ILT::set_es_diff_slope_L1_ME1a_even(t_lut lut) { + es_diff_slope_L1_ME1a_even_ = std::move(lut); +} + +void CSCL1TPLookupTableME11ILT::set_es_diff_slope_L2_ME1a_even(t_lut lut) { + es_diff_slope_L2_ME1a_even_ = std::move(lut); +} + +void CSCL1TPLookupTableME11ILT::set_es_diff_slope_L1_ME1a_odd(t_lut lut) { + es_diff_slope_L1_ME1a_odd_ = std::move(lut); +} + +void CSCL1TPLookupTableME11ILT::set_es_diff_slope_L2_ME1a_odd(t_lut lut) { + es_diff_slope_L2_ME1a_odd_ = std::move(lut); +} + +void CSCL1TPLookupTableME11ILT::set_es_diff_slope_L1_ME1b_even(t_lut lut) { + es_diff_slope_L1_ME1b_even_ = std::move(lut); +} + +void CSCL1TPLookupTableME11ILT::set_es_diff_slope_L2_ME1b_even(t_lut lut) { + es_diff_slope_L2_ME1b_even_ = std::move(lut); +} + +void CSCL1TPLookupTableME11ILT::set_es_diff_slope_L1_ME1b_odd(t_lut lut) { + es_diff_slope_L1_ME1b_odd_ = std::move(lut); +} + +void CSCL1TPLookupTableME11ILT::set_es_diff_slope_L2_ME1b_odd(t_lut lut) { + es_diff_slope_L2_ME1b_odd_ = std::move(lut); +} + +// GEM-CSC trigger: coordinate conversion +unsigned CSCL1TPLookupTableME11ILT::GEM_pad_CSC_hs_ME1b_even(unsigned pad) const { + return GEM_pad_CSC_hs_ME1b_even_.at(pad); +} + +unsigned CSCL1TPLookupTableME11ILT::GEM_pad_CSC_hs_ME1a_even(unsigned pad) const { + return GEM_pad_CSC_hs_ME1a_even_.at(pad); +} + +unsigned CSCL1TPLookupTableME11ILT::GEM_pad_CSC_hs_ME1b_odd(unsigned pad) const { + return GEM_pad_CSC_hs_ME1b_odd_.at(pad); +} + +unsigned CSCL1TPLookupTableME11ILT::GEM_pad_CSC_hs_ME1a_odd(unsigned pad) const { + return GEM_pad_CSC_hs_ME1a_odd_.at(pad); +} + +unsigned CSCL1TPLookupTableME11ILT::GEM_pad_CSC_es_ME1b_even(unsigned pad) const { + return GEM_pad_CSC_es_ME1b_even_.at(pad); +} + +unsigned CSCL1TPLookupTableME11ILT::GEM_pad_CSC_es_ME1a_even(unsigned pad) const { + return GEM_pad_CSC_es_ME1a_even_.at(pad); +} + +unsigned CSCL1TPLookupTableME11ILT::GEM_pad_CSC_es_ME1b_odd(unsigned pad) const { + return GEM_pad_CSC_es_ME1b_odd_.at(pad); +} + +unsigned CSCL1TPLookupTableME11ILT::GEM_pad_CSC_es_ME1a_odd(unsigned pad) const { + return GEM_pad_CSC_es_ME1a_odd_.at(pad); +} + +unsigned CSCL1TPLookupTableME11ILT::GEM_roll_L1_CSC_min_wg_ME11_even(unsigned roll) const { + return GEM_roll_L1_CSC_min_wg_ME11_even_[roll]; +} + +unsigned CSCL1TPLookupTableME11ILT::GEM_roll_L1_CSC_max_wg_ME11_even(unsigned roll) const { + return GEM_roll_L1_CSC_max_wg_ME11_even_[roll]; +} + +unsigned CSCL1TPLookupTableME11ILT::GEM_roll_L1_CSC_min_wg_ME11_odd(unsigned roll) const { + return GEM_roll_L1_CSC_min_wg_ME11_odd_[roll]; +} + +unsigned CSCL1TPLookupTableME11ILT::GEM_roll_L1_CSC_max_wg_ME11_odd(unsigned roll) const { + return GEM_roll_L1_CSC_max_wg_ME11_odd_[roll]; +} + +unsigned CSCL1TPLookupTableME11ILT::GEM_roll_L2_CSC_min_wg_ME11_even(unsigned roll) const { + return GEM_roll_L2_CSC_min_wg_ME11_even_[roll]; +} + +unsigned CSCL1TPLookupTableME11ILT::GEM_roll_L2_CSC_max_wg_ME11_even(unsigned roll) const { + return GEM_roll_L2_CSC_max_wg_ME11_even_[roll]; +} + +unsigned CSCL1TPLookupTableME11ILT::GEM_roll_L2_CSC_min_wg_ME11_odd(unsigned roll) const { + return GEM_roll_L2_CSC_min_wg_ME11_odd_[roll]; +} + +unsigned CSCL1TPLookupTableME11ILT::GEM_roll_L2_CSC_max_wg_ME11_odd(unsigned roll) const { + return GEM_roll_L2_CSC_max_wg_ME11_odd_[roll]; +} + +// GEM-CSC trigger: slope correction +unsigned CSCL1TPLookupTableME11ILT::CSC_slope_cosi_2to1_L1_ME11_even(unsigned slope) const { + return CSC_slope_cosi_2to1_L1_ME11_even_[slope]; +} + +unsigned CSCL1TPLookupTableME11ILT::CSC_slope_cosi_2to1_L1_ME11_odd(unsigned slope) const { + return CSC_slope_cosi_2to1_L1_ME11_odd_[slope]; +} + +unsigned CSCL1TPLookupTableME11ILT::CSC_slope_cosi_3to1_L1_ME11_even(unsigned slope) const { + return CSC_slope_cosi_3to1_L1_ME11_even_[slope]; +} + +unsigned CSCL1TPLookupTableME11ILT::CSC_slope_cosi_3to1_L1_ME11_odd(unsigned slope) const { + return CSC_slope_cosi_3to1_L1_ME11_odd_[slope]; +} + +unsigned CSCL1TPLookupTableME11ILT::CSC_slope_cosi_corr_L1_ME11_even(unsigned slope) const { + return CSC_slope_cosi_corr_L1_ME11_even_[slope]; +} + +unsigned CSCL1TPLookupTableME11ILT::CSC_slope_cosi_corr_L1_ME11_odd(unsigned slope) const { + return CSC_slope_cosi_corr_L1_ME11_odd_[slope]; +} + +unsigned CSCL1TPLookupTableME11ILT::CSC_slope_cosi_corr_L2_ME11_even(unsigned slope) const { + return CSC_slope_cosi_corr_L2_ME11_even_[slope]; +} + +unsigned CSCL1TPLookupTableME11ILT::CSC_slope_cosi_corr_L2_ME11_odd(unsigned slope) const { + return CSC_slope_cosi_corr_L2_ME11_odd_[slope]; +} + +unsigned CSCL1TPLookupTableME11ILT::CSC_slope_corr_L1_ME11_even(unsigned slope) const { + return CSC_slope_corr_L1_ME11_even_[slope]; +} + +unsigned CSCL1TPLookupTableME11ILT::CSC_slope_corr_L1_ME11_odd(unsigned slope) const { + return CSC_slope_corr_L1_ME11_odd_[slope]; +} + +unsigned CSCL1TPLookupTableME11ILT::CSC_slope_corr_L2_ME11_even(unsigned slope) const { + return CSC_slope_corr_L2_ME11_even_[slope]; +} + +unsigned CSCL1TPLookupTableME11ILT::CSC_slope_corr_L2_ME11_odd(unsigned slope) const { + return CSC_slope_corr_L2_ME11_odd_[slope]; +} + +unsigned CSCL1TPLookupTableME11ILT::es_diff_slope_L1_ME1a_even(unsigned es_diff) const { + return es_diff_slope_L1_ME1a_even_[es_diff]; +} + +unsigned CSCL1TPLookupTableME11ILT::es_diff_slope_L2_ME1a_even(unsigned es_diff) const { + return es_diff_slope_L2_ME1a_even_[es_diff]; +} + +unsigned CSCL1TPLookupTableME11ILT::es_diff_slope_L1_ME1a_odd(unsigned es_diff) const { + return es_diff_slope_L1_ME1a_odd_[es_diff]; +} + +unsigned CSCL1TPLookupTableME11ILT::es_diff_slope_L2_ME1a_odd(unsigned es_diff) const { + return es_diff_slope_L2_ME1a_odd_[es_diff]; +} + +unsigned CSCL1TPLookupTableME11ILT::es_diff_slope_L1_ME1b_even(unsigned es_diff) const { + return es_diff_slope_L1_ME1b_even_[es_diff]; +} + +unsigned CSCL1TPLookupTableME11ILT::es_diff_slope_L2_ME1b_even(unsigned es_diff) const { + return es_diff_slope_L2_ME1b_even_[es_diff]; +} + +unsigned CSCL1TPLookupTableME11ILT::es_diff_slope_L1_ME1b_odd(unsigned es_diff) const { + return es_diff_slope_L1_ME1b_odd_[es_diff]; +} + +unsigned CSCL1TPLookupTableME11ILT::es_diff_slope_L2_ME1b_odd(unsigned es_diff) const { + return es_diff_slope_L2_ME1b_odd_[es_diff]; +} diff --git a/CondFormats/CSCObjects/src/CSCL1TPLookupTableME21ILT.cc b/CondFormats/CSCObjects/src/CSCL1TPLookupTableME21ILT.cc new file mode 100644 index 0000000000000..3ff567ca10645 --- /dev/null +++ b/CondFormats/CSCObjects/src/CSCL1TPLookupTableME21ILT.cc @@ -0,0 +1,143 @@ +#include "CondFormats/CSCObjects/interface/CSCL1TPLookupTableME21ILT.h" + +CSCL1TPLookupTableME21ILT::CSCL1TPLookupTableME21ILT() + : GEM_pad_CSC_hs_ME21_even_(0), + GEM_pad_CSC_hs_ME21_odd_(0), + + GEM_pad_CSC_es_ME21_even_(0), + GEM_pad_CSC_es_ME21_odd_(0), + + GEM_roll_L1_CSC_min_wg_ME21_even_(0), + GEM_roll_L1_CSC_max_wg_ME21_even_(0), + GEM_roll_L1_CSC_min_wg_ME21_odd_(0), + GEM_roll_L1_CSC_max_wg_ME21_odd_(0), + + GEM_roll_L2_CSC_min_wg_ME21_even_(0), + GEM_roll_L2_CSC_max_wg_ME21_even_(0), + GEM_roll_L2_CSC_min_wg_ME21_odd_(0), + GEM_roll_L2_CSC_max_wg_ME21_odd_(0), + + es_diff_slope_L1_ME21_even_(0), + es_diff_slope_L2_ME21_even_(0), + es_diff_slope_L1_ME21_odd_(0), + es_diff_slope_L2_ME21_odd_(0) {} + +void CSCL1TPLookupTableME21ILT::set_GEM_pad_CSC_hs_ME21_even(t_lut lut) { GEM_pad_CSC_hs_ME21_even_ = std::move(lut); } + +void CSCL1TPLookupTableME21ILT::set_GEM_pad_CSC_hs_ME21_odd(t_lut lut) { GEM_pad_CSC_hs_ME21_odd_ = std::move(lut); } + +void CSCL1TPLookupTableME21ILT::set_GEM_pad_CSC_es_ME21_even(t_lut lut) { GEM_pad_CSC_es_ME21_even_ = std::move(lut); } + +void CSCL1TPLookupTableME21ILT::set_GEM_pad_CSC_es_ME21_odd(t_lut lut) { GEM_pad_CSC_es_ME21_odd_ = std::move(lut); } + +void CSCL1TPLookupTableME21ILT::set_GEM_roll_L1_CSC_min_wg_ME21_even(t_lut lut) { + GEM_roll_L1_CSC_min_wg_ME21_even_ = std::move(lut); +} + +void CSCL1TPLookupTableME21ILT::set_GEM_roll_L1_CSC_max_wg_ME21_even(t_lut lut) { + GEM_roll_L1_CSC_max_wg_ME21_even_ = std::move(lut); +} + +void CSCL1TPLookupTableME21ILT::set_GEM_roll_L1_CSC_min_wg_ME21_odd(t_lut lut) { + GEM_roll_L1_CSC_min_wg_ME21_odd_ = std::move(lut); +} + +void CSCL1TPLookupTableME21ILT::set_GEM_roll_L1_CSC_max_wg_ME21_odd(t_lut lut) { + GEM_roll_L1_CSC_max_wg_ME21_odd_ = std::move(lut); +} + +void CSCL1TPLookupTableME21ILT::set_GEM_roll_L2_CSC_min_wg_ME21_even(t_lut lut) { + GEM_roll_L2_CSC_min_wg_ME21_even_ = std::move(lut); +} + +void CSCL1TPLookupTableME21ILT::set_GEM_roll_L2_CSC_max_wg_ME21_even(t_lut lut) { + GEM_roll_L2_CSC_max_wg_ME21_even_ = std::move(lut); +} + +void CSCL1TPLookupTableME21ILT::set_GEM_roll_L2_CSC_min_wg_ME21_odd(t_lut lut) { + GEM_roll_L2_CSC_min_wg_ME21_odd_ = std::move(lut); +} + +void CSCL1TPLookupTableME21ILT::set_GEM_roll_L2_CSC_max_wg_ME21_odd(t_lut lut) { + GEM_roll_L2_CSC_max_wg_ME21_odd_ = std::move(lut); +} + +void CSCL1TPLookupTableME21ILT::set_es_diff_slope_L1_ME21_even(t_lut lut) { + es_diff_slope_L1_ME21_even_ = std::move(lut); +} + +void CSCL1TPLookupTableME21ILT::set_es_diff_slope_L2_ME21_even(t_lut lut) { + es_diff_slope_L2_ME21_even_ = std::move(lut); +} + +void CSCL1TPLookupTableME21ILT::set_es_diff_slope_L1_ME21_odd(t_lut lut) { + es_diff_slope_L1_ME21_odd_ = std::move(lut); +} + +void CSCL1TPLookupTableME21ILT::set_es_diff_slope_L2_ME21_odd(t_lut lut) { + es_diff_slope_L2_ME21_odd_ = std::move(lut); +} + +unsigned CSCL1TPLookupTableME21ILT::GEM_pad_CSC_hs_ME21_even(unsigned pad) const { + return GEM_pad_CSC_hs_ME21_even_[pad]; +} + +unsigned CSCL1TPLookupTableME21ILT::GEM_pad_CSC_hs_ME21_odd(unsigned pad) const { + return GEM_pad_CSC_hs_ME21_odd_[pad]; +} + +unsigned CSCL1TPLookupTableME21ILT::GEM_pad_CSC_es_ME21_even(unsigned pad) const { + return GEM_pad_CSC_es_ME21_even_[pad]; +} + +unsigned CSCL1TPLookupTableME21ILT::GEM_pad_CSC_es_ME21_odd(unsigned pad) const { + return GEM_pad_CSC_es_ME21_odd_[pad]; +} + +unsigned CSCL1TPLookupTableME21ILT::GEM_roll_L1_CSC_min_wg_ME21_even(unsigned roll) const { + return GEM_roll_L1_CSC_min_wg_ME21_even_[roll]; +} + +unsigned CSCL1TPLookupTableME21ILT::GEM_roll_L1_CSC_max_wg_ME21_even(unsigned roll) const { + return GEM_roll_L1_CSC_max_wg_ME21_even_[roll]; +} + +unsigned CSCL1TPLookupTableME21ILT::GEM_roll_L1_CSC_min_wg_ME21_odd(unsigned roll) const { + return GEM_roll_L1_CSC_min_wg_ME21_odd_[roll]; +} + +unsigned CSCL1TPLookupTableME21ILT::GEM_roll_L1_CSC_max_wg_ME21_odd(unsigned roll) const { + return GEM_roll_L1_CSC_max_wg_ME21_odd_[roll]; +} + +unsigned CSCL1TPLookupTableME21ILT::GEM_roll_L2_CSC_min_wg_ME21_even(unsigned roll) const { + return GEM_roll_L2_CSC_min_wg_ME21_even_[roll]; +} + +unsigned CSCL1TPLookupTableME21ILT::GEM_roll_L2_CSC_max_wg_ME21_even(unsigned roll) const { + return GEM_roll_L2_CSC_max_wg_ME21_even_[roll]; +} + +unsigned CSCL1TPLookupTableME21ILT::GEM_roll_L2_CSC_min_wg_ME21_odd(unsigned roll) const { + return GEM_roll_L2_CSC_min_wg_ME21_odd_[roll]; +} + +unsigned CSCL1TPLookupTableME21ILT::GEM_roll_L2_CSC_max_wg_ME21_odd(unsigned roll) const { + return GEM_roll_L2_CSC_max_wg_ME21_odd_[roll]; +} + +unsigned CSCL1TPLookupTableME21ILT::es_diff_slope_L1_ME21_even(unsigned es_diff) const { + return es_diff_slope_L1_ME21_even_[es_diff]; +} + +unsigned CSCL1TPLookupTableME21ILT::es_diff_slope_L2_ME21_even(unsigned es_diff) const { + return es_diff_slope_L2_ME21_even_[es_diff]; +} + +unsigned CSCL1TPLookupTableME21ILT::es_diff_slope_L1_ME21_odd(unsigned es_diff) const { + return es_diff_slope_L1_ME21_odd_[es_diff]; +} + +unsigned CSCL1TPLookupTableME21ILT::es_diff_slope_L2_ME21_odd(unsigned es_diff) const { + return es_diff_slope_L2_ME21_odd_[es_diff]; +} diff --git a/CondFormats/CSCObjects/src/T_EventSetup_CSCL1TPLookupTableCCLUT.cc b/CondFormats/CSCObjects/src/T_EventSetup_CSCL1TPLookupTableCCLUT.cc new file mode 100644 index 0000000000000..9deec5db3b5cf --- /dev/null +++ b/CondFormats/CSCObjects/src/T_EventSetup_CSCL1TPLookupTableCCLUT.cc @@ -0,0 +1,4 @@ +#include "CondFormats/CSCObjects/interface/CSCL1TPLookupTableCCLUT.h" +#include "FWCore/Utilities/interface/typelookup.h" + +TYPELOOKUP_DATA_REG(CSCL1TPLookupTableCCLUT); diff --git a/CondFormats/CSCObjects/src/T_EventSetup_CSCL1TPLookupTableME11ILT.cc b/CondFormats/CSCObjects/src/T_EventSetup_CSCL1TPLookupTableME11ILT.cc new file mode 100644 index 0000000000000..69fd0f8efbed9 --- /dev/null +++ b/CondFormats/CSCObjects/src/T_EventSetup_CSCL1TPLookupTableME11ILT.cc @@ -0,0 +1,4 @@ +#include "CondFormats/CSCObjects/interface/CSCL1TPLookupTableME11ILT.h" +#include "FWCore/Utilities/interface/typelookup.h" + +TYPELOOKUP_DATA_REG(CSCL1TPLookupTableME11ILT); diff --git a/CondFormats/CSCObjects/src/T_EventSetup_CSCL1TPLookupTableME21ILT.cc b/CondFormats/CSCObjects/src/T_EventSetup_CSCL1TPLookupTableME21ILT.cc new file mode 100644 index 0000000000000..bb452ba805264 --- /dev/null +++ b/CondFormats/CSCObjects/src/T_EventSetup_CSCL1TPLookupTableME21ILT.cc @@ -0,0 +1,4 @@ +#include "CondFormats/CSCObjects/interface/CSCL1TPLookupTableME21ILT.h" +#include "FWCore/Utilities/interface/typelookup.h" + +TYPELOOKUP_DATA_REG(CSCL1TPLookupTableME21ILT); diff --git a/CondFormats/CSCObjects/src/classes_def.xml b/CondFormats/CSCObjects/src/classes_def.xml index 5355aff34ee2c..4ec72ea55e9ea 100644 --- a/CondFormats/CSCObjects/src/classes_def.xml +++ b/CondFormats/CSCObjects/src/classes_def.xml @@ -15,13 +15,13 @@ - + - + @@ -99,9 +99,13 @@ - + + + + + @@ -134,5 +138,4 @@ - - + diff --git a/CondFormats/CSCObjects/src/headers.h b/CondFormats/CSCObjects/src/headers.h index 29296e98f17c6..496bc998f6f8a 100644 --- a/CondFormats/CSCObjects/src/headers.h +++ b/CondFormats/CSCObjects/src/headers.h @@ -26,3 +26,6 @@ #include "CondFormats/CSCObjects/interface/CSCTriggerMapping.h" #include "CondFormats/CSCObjects/interface/CSCL1TPParameters.h" #include "CondFormats/CSCObjects/interface/CSCDBL1TPParameters.h" +#include "CondFormats/CSCObjects/interface/CSCL1TPLookupTableCCLUT.h" +#include "CondFormats/CSCObjects/interface/CSCL1TPLookupTableME11ILT.h" +#include "CondFormats/CSCObjects/interface/CSCL1TPLookupTableME21ILT.h" diff --git a/CondFormats/CSCObjects/test/testSerializationCSCObjects.cpp b/CondFormats/CSCObjects/test/testSerializationCSCObjects.cpp index d36fbf5e1e22a..49d8d6fb57ddb 100644 --- a/CondFormats/CSCObjects/test/testSerializationCSCObjects.cpp +++ b/CondFormats/CSCObjects/test/testSerializationCSCObjects.cpp @@ -34,6 +34,9 @@ int main() { testSerialization(); testSerialization(); testSerialization(); + testSerialization(); + testSerialization(); + testSerialization(); testSerialization(); testSerialization(); testSerialization(); diff --git a/CondFormats/CastorObjects/interface/AllClasses.h b/CondFormats/CastorObjects/interface/AllClasses.h deleted file mode 100644 index ac0d1349110df..0000000000000 --- a/CondFormats/CastorObjects/interface/AllClasses.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef CondFormats_CastorObjects_AllClasses_h -#define CondFormats_CastorObjects_AllClasses_h -#include "CondFormats/CastorObjects/interface/AllObjects.h" -/* -class CastorPedestals; -class CastorPedestalWidths; -class CastorGains; -class CastorRawGains; -class CastorGainWidths; -class CastorQIEShape; -class CastorQIEData; -class CastorCalibrationQIEData; -class CastorChannelQuality; -class CastorElectronicsMap; -*/ -#endif diff --git a/CondFormats/Common/interface/Constants.h b/CondFormats/Common/interface/Constants.h deleted file mode 100644 index 8a4253dbcc168..0000000000000 --- a/CondFormats/Common/interface/Constants.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef CondCommon_Constants_h -#define CondCommon_Constants_h -#include -#include -#include - -/* constants other than time used in cond - */ - -namespace cond { - - const std::string invalidToken(" "); - -} - -#endif //CondCommon_Constants_h diff --git a/CondFormats/Common/test/CTPPSRPAlignmentCorrectionsDataRcd_prep.json b/CondFormats/Common/test/CTPPSRPAlignmentCorrectionsDataRcd_prep.json new file mode 100644 index 0000000000000..06bdbaee63228 --- /dev/null +++ b/CondFormats/Common/test/CTPPSRPAlignmentCorrectionsDataRcd_prep.json @@ -0,0 +1,9 @@ +{ + "destinationDatabase": "oracle://cms_orcoff_prep/CMS_CONDITIONS", + "destinationTags": { + "CTPPSRPAlignment_byPCL_v0_prompt": {} + }, + "inputTag": "CTPPSRPAlignment_real_pcl", + "since": null, + "userText": "Tier0 PCL Upload for CTPPSRPAlignment" +} diff --git a/CondFormats/Common/test/CTPPSRPAlignmentCorrectionsDataRcd_prod.json b/CondFormats/Common/test/CTPPSRPAlignmentCorrectionsDataRcd_prod.json new file mode 100644 index 0000000000000..d5c5077599827 --- /dev/null +++ b/CondFormats/Common/test/CTPPSRPAlignmentCorrectionsDataRcd_prod.json @@ -0,0 +1,9 @@ +{ + "destinationDatabase": "oracle://cms_orcon_prod/CMS_CONDITIONS", + "destinationTags": { + "CTPPSRPAlignment_byPCL_v0_prompt": {} + }, + "inputTag": "CTPPSRPAlignment_real_pcl", + "since": null, + "userText": "Tier0 PCL Upload for CTPPSRPAlignment" +} diff --git a/CondFormats/Common/test/PPSTimingCalibrationRcd_Sampic_prep.json b/CondFormats/Common/test/PPSTimingCalibrationRcd_Sampic_prep.json new file mode 100644 index 0000000000000..715f2b5cdd7c0 --- /dev/null +++ b/CondFormats/Common/test/PPSTimingCalibrationRcd_Sampic_prep.json @@ -0,0 +1,9 @@ +{ + "destinationDatabase": "oracle://cms_orcoff_prep/CMS_CONDITIONS", + "destinationTags": { + "CTPPPSTimingCalibration_SAMPIC_byPCL_v0_prompt": {} + }, + "inputTag": "DiamondSampicCalibration", + "since": null, + "userText": "Tier0 PCL Upload for PPSDiamondTimingCalibration (Sampic)" +} diff --git a/CondFormats/Common/test/PPSTimingCalibrationRcd_Sampic_prod.json b/CondFormats/Common/test/PPSTimingCalibrationRcd_Sampic_prod.json new file mode 100644 index 0000000000000..e876a5850632e --- /dev/null +++ b/CondFormats/Common/test/PPSTimingCalibrationRcd_Sampic_prod.json @@ -0,0 +1,9 @@ +{ + "destinationDatabase": "oracle://cms_orcon_prod/CMS_CONDITIONS", + "destinationTags": { + "CTPPPSTimingCalibration_SAMPIC_byPCL_v0_prompt": {} + }, + "inputTag": "DiamondSampicCalibration", + "since": null, + "userText": "Tier0 PCL Upload for PPSDiamondTimingCalibration (Sampic)" +} diff --git a/CondFormats/Common/test/PPSTimingCalibrationRcd_prep.json b/CondFormats/Common/test/PPSTimingCalibrationRcd_prep.json new file mode 100644 index 0000000000000..50a6d8e7977b2 --- /dev/null +++ b/CondFormats/Common/test/PPSTimingCalibrationRcd_prep.json @@ -0,0 +1,9 @@ +{ + "destinationDatabase": "oracle://cms_orcoff_prep/CMS_CONDITIONS", + "destinationTags": { + "CTPPPSTimingCalibration_HPTDC_byPCL_v0_prompt": {} + }, + "inputTag": "PPSDiamondTimingCalibration_pcl", + "since": null, + "userText": "Tier0 PCL Upload for PPSDiamondTimingCalibration (HPTDC)" +} diff --git a/CondFormats/Common/test/PPSTimingCalibrationRcd_prod.json b/CondFormats/Common/test/PPSTimingCalibrationRcd_prod.json new file mode 100644 index 0000000000000..8f84eca130899 --- /dev/null +++ b/CondFormats/Common/test/PPSTimingCalibrationRcd_prod.json @@ -0,0 +1,9 @@ +{ + "destinationDatabase": "oracle://cms_orcon_prod/CMS_CONDITIONS", + "destinationTags": { + "CTPPPSTimingCalibration_HPTDC_byPCL_v0_prompt": {} + }, + "inputTag": "PPSDiamondTimingCalibration_pcl", + "since": null, + "userText": "Tier0 PCL Upload for PPSDiamondTimingCalibration (HPTDC)" +} diff --git a/CondFormats/Common/test/ProduceDropBoxMetadata.py b/CondFormats/Common/test/ProduceDropBoxMetadata.py index 3abffa9f09d3e..98e22e0705e06 100644 --- a/CondFormats/Common/test/ProduceDropBoxMetadata.py +++ b/CondFormats/Common/test/ProduceDropBoxMetadata.py @@ -70,7 +70,7 @@ def encodeJsonInString(filename): LumiCorrectionsRcd_prod_str = encodeJsonInString("LumiCorrections_prod.json") LumiCorrectionsRcd_prep_str = encodeJsonInString("LumiCorrections_prep.json") -#PixelQuality +#SiPixelQuality SiPixelQualityFromDbRcd_prompt_prod_str = encodeJsonInString("SiPixelQualityFromDbRcd_prompt_prod.json") SiPixelQualityFromDbRcd_prompt_prep_str = encodeJsonInString("SiPixelQualityFromDbRcd_prompt_prep.json") SiPixelQualityFromDbRcd_stuckTBM_prod_str = encodeJsonInString("SiPixelQualityFromDbRcd_stuckTBM_prod.json") @@ -78,6 +78,21 @@ def encodeJsonInString(filename): SiPixelQualityFromDbRcd_other_prod_str = encodeJsonInString("SiPixelQualityFromDbRcd_other_prod.json") SiPixelQualityFromDbRcd_other_prep_str = encodeJsonInString("SiPixelQualityFromDbRcd_other_prep.json") +#SiPixelLorenzAngle +SiPixelLorentzAngleRcd_prod_str = encodeJsonInString("SiPixelLorentzAngleRcd_prod.json") +SiPixelLorentzAngleRcd_multirun_prod_str = encodeJsonInString("SiPixelLorentzAngleRcd_multirun_prod.json") +SiPixelLorentzAngleRcd_prep_str = encodeJsonInString("SiPixelLorentzAngleRcd_prep.json") +SiPixelLorentzAngleRcd_multirun_prep_str = encodeJsonInString("SiPixelLorentzAngleRcd_multirun_prep.json") + +#CT-PPS alignment and timing +CTPPSRPAlignmentCorrectionsDataRcd_prod_str = encodeJsonInString("CTPPSRPAlignmentCorrectionsDataRcd_prod.json") +CTPPSRPAlignmentCorrectionsDataRcd_prep_str = encodeJsonInString("CTPPSRPAlignmentCorrectionsDataRcd_prep.json") +PPSTimingCalibrationRcd_prod_str = encodeJsonInString("PPSTimingCalibrationRcd_prod.json") +PPSTimingCalibrationRcd_prep_str = encodeJsonInString("PPSTimingCalibrationRcd_prep.json") +PPSTimingCalibrationRcd_Sampic_prod_str = encodeJsonInString("PPSTimingCalibrationRcd_Sampic_prod.json") +PPSTimingCalibrationRcd_Sampic_prep_str = encodeJsonInString("PPSTimingCalibrationRcd_Sampic_prep.json") + + # given a set of .json files in the current dir, ProduceDropBoxMetadata produces a sqlite containign the payload with the prod/and/prep metadata process.mywriter = cms.EDAnalyzer("ProduceDropBoxMetadata", # set to True if you want to write out a sqlite.db translating the json's into a payload @@ -172,13 +187,39 @@ def encodeJsonInString(filename): prodMetaData = cms.untracked.string(SiPixelQualityFromDbRcd_other_prod_str), prepMetaData = cms.untracked.string(SiPixelQualityFromDbRcd_other_prep_str), ), + cms.PSet(record = cms.untracked.string('SiPixelLorentzAngleRcd'), + Source = cms.untracked.string("AlcaHarvesting"), + FileClass = cms.untracked.string("ALCA"), + prodMetaData = cms.untracked.string(SiPixelLorentzAngleRcd_prod_str), + prodMetaDataMultiRun = cms.untracked.string(SiPixelLorentzAngleRcd_multirun_prod_str), + prepMetaData = cms.untracked.string(SiPixelLorentzAngleRcd_prep_str), + prepMetaDataMultiRun = cms.untracked.string(SiPixelLorentzAngleRcd_multirun_prep_str), + ), + cms.PSet(record = cms.untracked.string('CTPPSRPAlignmentCorrectionsDataRcd'), + Source = cms.untracked.string("AlcaHarvesting"), + FileClass = cms.untracked.string("ALCA"), + prodMetaData = cms.untracked.string(CTPPSRPAlignmentCorrectionsDataRcd_prod_str), + prepMetaData = cms.untracked.string(CTPPSRPAlignmentCorrectionsDataRcd_prep_str), + ), + cms.PSet(record = cms.untracked.string('PPSTimingCalibrationRcd'), + Source = cms.untracked.string("AlcaHarvesting"), + FileClass = cms.untracked.string("ALCA"), + prodMetaData = cms.untracked.string(PPSTimingCalibrationRcd_prod_str), + prepMetaData = cms.untracked.string(PPSTimingCalibrationRcd_prep_str), + ), + cms.PSet(record = cms.untracked.string('PPSTimingCalibrationRcd_Sampic'), + Source = cms.untracked.string("AlcaHarvesting"), + FileClass = cms.untracked.string("ALCA"), + prodMetaData = cms.untracked.string(PPSTimingCalibrationRcd_Sampic_prod_str), + prepMetaData = cms.untracked.string(PPSTimingCalibrationRcd_Sampic_prep_str), + ), ), # this boolean will read the content of whichever payload is available and print its content to stoutput # set this to false if you write out a sqlite.db translating the json's into a payload read = cms.untracked.bool(False), - # toRead lists of record naemes to be sought inside the DropBoxMetadataRcd payload avaialble to the ProduceDropBoxMetadata; for instance, if write is True, you're reading back the metadata you've just entered in the payload from the .json files - toRead = cms.untracked.vstring('BeamSpotObjectsRcdByRun','BeamSpotObjectsRcdByLumi','BeamSpotObjectsRcdHPByLumi','BeamSpotObjectsRcdHPByRun','SiStripBadStripRcd','SiStripApvGainRcd','TrackerAlignmentRcd','SiStripApvGainRcdAfterAbortGap','SiStripApvGainRcdAAG','EcalPedestalsRcd',"LumiCorrectionsRcd","SiPixelQualityFromDbRcd_prompt","SiPixelQualityFromDbRcd_stuckTBM","SiPixelQualityFromDbRcd_other") # same strings as fType + # toRead lists of record names to be sought inside the DropBoxMetadataRcd payload avaialble to the ProduceDropBoxMetadata; for instance, if write is True, you're reading back the metadata you've just entered in the payload from the .json files + toRead = cms.untracked.vstring('BeamSpotObjectsRcdByRun','BeamSpotObjectsRcdByLumi','BeamSpotObjectsRcdHPByLumi','BeamSpotObjectsRcdHPByRun','SiStripBadStripRcd','SiStripApvGainRcd','TrackerAlignmentRcd','SiStripApvGainRcdAfterAbortGap','SiStripApvGainRcdAAG','EcalPedestalsRcd',"LumiCorrectionsRcd","SiPixelQualityFromDbRcd_prompt","SiPixelQualityFromDbRcd_stuckTBM","SiPixelQualityFromDbRcd_other","SiPixelLorentzAngleRcd","CTPPSRPAlignmentCorrectionsDataRcd","PPSTimingCalibrationRcd","PPSTimingCalibrationRcd_Sampic") # same strings as fType ) process.p = cms.Path(process.mywriter) @@ -201,10 +242,7 @@ def encodeJsonInString(filename): ) process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff') -process.GlobalTag.globaltag = '92X_dataRun2_Express_Queue' - -#process.GlobalTag.connect = 'frontier://PromptProd/CMS_CONDITIONS' -#process.GlobalTag.connect = 'sqlite_file:/data/franzoni/92x/CMSSW_9_2_X_2017-05-16-1100_metadata/src/CondFormats/Common/test/last-iov-DropBoxMetadata_v5.1_express.db' +process.GlobalTag.globaltag = '121X_dataRun3_Express_Queue' # Set to True if you want to read a DropBoxMetadata payload from a local sqlite # specify the name of the sqlitefile.db and the tag name; the payload loaded will be for run 300000 diff --git a/CondFormats/Common/test/SiPixelLorentzAngleRcd_multirun_prep.json b/CondFormats/Common/test/SiPixelLorentzAngleRcd_multirun_prep.json new file mode 100644 index 0000000000000..ff39c072ed734 --- /dev/null +++ b/CondFormats/Common/test/SiPixelLorentzAngleRcd_multirun_prep.json @@ -0,0 +1,9 @@ +{ + "destinationDatabase": "oracle://cms_orcoff_prep/CMS_CONDITIONS", + "destinationTags": { + "SiPixelLorentzAngle_byPCL_multirun_v0_prompt": {} + }, + "inputTag": "SiPixelLA_pcl", + "since": null, + "userText": "Multirun Upload for SiPixelLA (prep)" +} diff --git a/CondFormats/Common/test/SiPixelLorentzAngleRcd_multirun_prod.json b/CondFormats/Common/test/SiPixelLorentzAngleRcd_multirun_prod.json new file mode 100644 index 0000000000000..df32cdc305153 --- /dev/null +++ b/CondFormats/Common/test/SiPixelLorentzAngleRcd_multirun_prod.json @@ -0,0 +1,9 @@ +{ + "destinationDatabase": "oracle://cms_orcon_prod/CMS_CONDITIONS", + "destinationTags": { + "SiPixelLorentzAngle_byPCL_multirun_v0_prompt": {} + }, + "inputTag": "SiPixelLA_pcl", + "since": null, + "userText": "Multirun Upload for SiPixelLorentzAngle" +} diff --git a/CondFormats/Common/test/SiPixelLorentzAngleRcd_prep.json b/CondFormats/Common/test/SiPixelLorentzAngleRcd_prep.json new file mode 100644 index 0000000000000..85caef817b82d --- /dev/null +++ b/CondFormats/Common/test/SiPixelLorentzAngleRcd_prep.json @@ -0,0 +1,9 @@ +{ + "destinationDatabase": "oracle://cms_orcoff_prep/CMS_CONDITIONS", + "destinationTags": { + "SiPixelLorentzAngle_byPCL_v0_prompt": {} + }, + "inputTag": "SiPixelLA_pcl", + "since": null, + "userText": "Tier0 PCL Upload for SiPixelLA (prep)" +} diff --git a/CondFormats/Common/test/SiPixelLorentzAngleRcd_prod.json b/CondFormats/Common/test/SiPixelLorentzAngleRcd_prod.json new file mode 100644 index 0000000000000..b444a98d0bd5b --- /dev/null +++ b/CondFormats/Common/test/SiPixelLorentzAngleRcd_prod.json @@ -0,0 +1,9 @@ +{ + "destinationDatabase": "oracle://cms_orcon_prod/CMS_CONDITIONS", + "destinationTags": { + "SiPixelLorentzAngle_byPCL_v0_prompt": {} + }, + "inputTag": "SiPixelLA_pcl", + "since": null, + "userText": "Tier0 PCL Upload for SiPixelLorentzAngle" +} diff --git a/CondFormats/DataRecord/interface/CSCL1TPLookupTableCCLUTRcd.h b/CondFormats/DataRecord/interface/CSCL1TPLookupTableCCLUTRcd.h new file mode 100644 index 0000000000000..e64928d8daf25 --- /dev/null +++ b/CondFormats/DataRecord/interface/CSCL1TPLookupTableCCLUTRcd.h @@ -0,0 +1,6 @@ +#ifndef CondFormats_DataRecord_CSCL1TPLookupTableCCLUTRcd +#define CondFormats_DataRecord_CSCL1TPLookupTableCCLUTRcd +#include "FWCore/Framework/interface/EventSetupRecordImplementation.h" +class CSCL1TPLookupTableCCLUTRcd : public edm::eventsetup::EventSetupRecordImplementation { +}; +#endif diff --git a/CondFormats/DataRecord/interface/CSCL1TPLookupTableME11ILTRcd.h b/CondFormats/DataRecord/interface/CSCL1TPLookupTableME11ILTRcd.h new file mode 100644 index 0000000000000..96fdacb936c58 --- /dev/null +++ b/CondFormats/DataRecord/interface/CSCL1TPLookupTableME11ILTRcd.h @@ -0,0 +1,6 @@ +#ifndef CondFormats_DataRecord_CSCL1TPLookupTableME11ILTRcd +#define CondFormats_DataRecord_CSCL1TPLookupTableME11ILTRcd +#include "FWCore/Framework/interface/EventSetupRecordImplementation.h" +class CSCL1TPLookupTableME11ILTRcd + : public edm::eventsetup::EventSetupRecordImplementation {}; +#endif diff --git a/CondFormats/DataRecord/interface/CSCL1TPLookupTableME21ILTRcd.h b/CondFormats/DataRecord/interface/CSCL1TPLookupTableME21ILTRcd.h new file mode 100644 index 0000000000000..c9930715a9534 --- /dev/null +++ b/CondFormats/DataRecord/interface/CSCL1TPLookupTableME21ILTRcd.h @@ -0,0 +1,6 @@ +#ifndef CondFormats_DataRecord_CSCL1TPLookupTableME21ILTRcd +#define CondFormats_DataRecord_CSCL1TPLookupTableME21ILTRcd +#include "FWCore/Framework/interface/EventSetupRecordImplementation.h" +class CSCL1TPLookupTableME21ILTRcd + : public edm::eventsetup::EventSetupRecordImplementation {}; +#endif diff --git a/CondFormats/DataRecord/interface/PPSAlignmentConfigurationRcd.h b/CondFormats/DataRecord/interface/PPSAlignmentConfigurationRcd.h new file mode 100644 index 0000000000000..159b1873f7e00 --- /dev/null +++ b/CondFormats/DataRecord/interface/PPSAlignmentConfigurationRcd.h @@ -0,0 +1,15 @@ +/**************************************************************************** +* Authors: +* Jan KaÅ¡par (jan.kaspar@gmail.com) +* Mateusz Kocot (mateuszkocot99@gmail.com) +****************************************************************************/ + +#ifndef CondFormats_DataRecord_PPSAlignmentConfigurationRcd_h +#define CondFormats_DataRecord_PPSAlignmentConfigurationRcd_h + +#include "FWCore/Framework/interface/EventSetupRecordImplementation.h" + +class PPSAlignmentConfigurationRcd + : public edm::eventsetup::EventSetupRecordImplementation {}; + +#endif diff --git a/CondFormats/DataRecord/interface/PPSAssociationCutsRcd.h b/CondFormats/DataRecord/interface/PPSAssociationCutsRcd.h new file mode 100644 index 0000000000000..fa0ded88e74a4 --- /dev/null +++ b/CondFormats/DataRecord/interface/PPSAssociationCutsRcd.h @@ -0,0 +1,8 @@ +#ifndef CondFormats_DataRecord_PPSAssociationCutsRcd_h +#define CondFormats_DataRecord_PPSAssociationCutsRcd_h + +#include "FWCore/Framework/interface/EventSetupRecordImplementation.h" + +class PPSAssociationCutsRcd : public edm::eventsetup::EventSetupRecordImplementation {}; + +#endif diff --git a/CondFormats/DataRecord/interface/SiStripBadChannelRcd.h b/CondFormats/DataRecord/interface/SiStripBadChannelRcd.h deleted file mode 100644 index af76e665c008c..0000000000000 --- a/CondFormats/DataRecord/interface/SiStripBadChannelRcd.h +++ /dev/null @@ -1 +0,0 @@ -#include "CondFormats/DataRecord/interface/SiStripCondDataRecords.h" diff --git a/CondFormats/DataRecord/interface/SiStripBadFiberRcd.h b/CondFormats/DataRecord/interface/SiStripBadFiberRcd.h deleted file mode 100644 index af76e665c008c..0000000000000 --- a/CondFormats/DataRecord/interface/SiStripBadFiberRcd.h +++ /dev/null @@ -1 +0,0 @@ -#include "CondFormats/DataRecord/interface/SiStripCondDataRecords.h" diff --git a/CondFormats/DataRecord/interface/SiStripBadModuleRcd.h b/CondFormats/DataRecord/interface/SiStripBadModuleRcd.h deleted file mode 100644 index af76e665c008c..0000000000000 --- a/CondFormats/DataRecord/interface/SiStripBadModuleRcd.h +++ /dev/null @@ -1 +0,0 @@ -#include "CondFormats/DataRecord/interface/SiStripCondDataRecords.h" diff --git a/CondFormats/DataRecord/interface/SiStripModuleHVRcd.h b/CondFormats/DataRecord/interface/SiStripModuleHVRcd.h deleted file mode 100644 index af76e665c008c..0000000000000 --- a/CondFormats/DataRecord/interface/SiStripModuleHVRcd.h +++ /dev/null @@ -1 +0,0 @@ -#include "CondFormats/DataRecord/interface/SiStripCondDataRecords.h" diff --git a/CondFormats/DataRecord/interface/SiStripPerformanceSummaryRcd.h b/CondFormats/DataRecord/interface/SiStripPerformanceSummaryRcd.h deleted file mode 100644 index af76e665c008c..0000000000000 --- a/CondFormats/DataRecord/interface/SiStripPerformanceSummaryRcd.h +++ /dev/null @@ -1 +0,0 @@ -#include "CondFormats/DataRecord/interface/SiStripCondDataRecords.h" diff --git a/CondFormats/DataRecord/interface/SiStripRunSummaryRcd.h b/CondFormats/DataRecord/interface/SiStripRunSummaryRcd.h deleted file mode 100644 index af76e665c008c..0000000000000 --- a/CondFormats/DataRecord/interface/SiStripRunSummaryRcd.h +++ /dev/null @@ -1 +0,0 @@ -#include "CondFormats/DataRecord/interface/SiStripCondDataRecords.h" diff --git a/CondFormats/DataRecord/src/CSCL1TPLookupTableCCLUTRcd.cc b/CondFormats/DataRecord/src/CSCL1TPLookupTableCCLUTRcd.cc new file mode 100644 index 0000000000000..cf8d9849d459e --- /dev/null +++ b/CondFormats/DataRecord/src/CSCL1TPLookupTableCCLUTRcd.cc @@ -0,0 +1,4 @@ +#include "CondFormats/DataRecord/interface/CSCL1TPLookupTableCCLUTRcd.h" +#include "FWCore/Framework/interface/eventsetuprecord_registration_macro.h" + +EVENTSETUP_RECORD_REG(CSCL1TPLookupTableCCLUTRcd); diff --git a/CondFormats/DataRecord/src/CSCL1TPLookupTableME11ILTRcd.cc b/CondFormats/DataRecord/src/CSCL1TPLookupTableME11ILTRcd.cc new file mode 100644 index 0000000000000..5b634bee1ed4f --- /dev/null +++ b/CondFormats/DataRecord/src/CSCL1TPLookupTableME11ILTRcd.cc @@ -0,0 +1,4 @@ +#include "CondFormats/DataRecord/interface/CSCL1TPLookupTableME11ILTRcd.h" +#include "FWCore/Framework/interface/eventsetuprecord_registration_macro.h" + +EVENTSETUP_RECORD_REG(CSCL1TPLookupTableME11ILTRcd); diff --git a/CondFormats/DataRecord/src/CSCL1TPLookupTableME21ILTRcd.cc b/CondFormats/DataRecord/src/CSCL1TPLookupTableME21ILTRcd.cc new file mode 100644 index 0000000000000..2bb72edae143d --- /dev/null +++ b/CondFormats/DataRecord/src/CSCL1TPLookupTableME21ILTRcd.cc @@ -0,0 +1,4 @@ +#include "CondFormats/DataRecord/interface/CSCL1TPLookupTableME21ILTRcd.h" +#include "FWCore/Framework/interface/eventsetuprecord_registration_macro.h" + +EVENTSETUP_RECORD_REG(CSCL1TPLookupTableME21ILTRcd); diff --git a/CondFormats/DataRecord/src/PPSAlignmentConfigurationRcd.cc b/CondFormats/DataRecord/src/PPSAlignmentConfigurationRcd.cc new file mode 100644 index 0000000000000..4c952462c6597 --- /dev/null +++ b/CondFormats/DataRecord/src/PPSAlignmentConfigurationRcd.cc @@ -0,0 +1,10 @@ +/**************************************************************************** +* Authors: +* Jan KaÅ¡par (jan.kaspar@gmail.com) +* Mateusz Kocot (mateuszkocot99@gmail.com) +****************************************************************************/ + +#include "CondFormats/DataRecord/interface/PPSAlignmentConfigurationRcd.h" +#include "FWCore/Framework/interface/eventsetuprecord_registration_macro.h" + +EVENTSETUP_RECORD_REG(PPSAlignmentConfigurationRcd); diff --git a/CondFormats/DataRecord/src/PPSAssociationCutsRcd.cc b/CondFormats/DataRecord/src/PPSAssociationCutsRcd.cc new file mode 100644 index 0000000000000..750bda92d75ca --- /dev/null +++ b/CondFormats/DataRecord/src/PPSAssociationCutsRcd.cc @@ -0,0 +1,4 @@ +#include "CondFormats/DataRecord/interface/PPSAssociationCutsRcd.h" +#include "FWCore/Framework/interface/eventsetuprecord_registration_macro.h" + +EVENTSETUP_RECORD_REG(PPSAssociationCutsRcd); diff --git a/CondFormats/EcalObjects/src/EcalTPGTPMode.cc b/CondFormats/EcalObjects/src/EcalTPGTPMode.cc index cc7608c4ec63b..85c623c7dc078 100644 --- a/CondFormats/EcalObjects/src/EcalTPGTPMode.cc +++ b/CondFormats/EcalObjects/src/EcalTPGTPMode.cc @@ -1,6 +1,5 @@ #include "CondFormats/EcalObjects/interface/EcalTPGTPMode.h" #include -#include "FWCore/MessageLogger/interface/MessageLogger.h" EcalTPGTPMode::EcalTPGTPMode() {} diff --git a/CondFormats/HcalObjects/interface/HcalChannelQualityGPU.h b/CondFormats/HcalObjects/interface/HcalChannelQualityGPU.h new file mode 100644 index 0000000000000..4abdcc3e52c82 --- /dev/null +++ b/CondFormats/HcalObjects/interface/HcalChannelQualityGPU.h @@ -0,0 +1,37 @@ +#ifndef CondFormats_HcalObjects_interface_HcalChannelQualityGPU_h +#define CondFormats_HcalObjects_interface_HcalChannelQualityGPU_h + +#include "CondFormats/HcalObjects/interface/HcalChannelQuality.h" +#include "FWCore/Utilities/interface/propagate_const_array.h" +#include "HeterogeneousCore/CUDAUtilities/interface/device_unique_ptr.h" + +#ifndef __CUDACC__ +#include "HeterogeneousCore/CUDAUtilities/interface/HostAllocator.h" +#include "HeterogeneousCore/CUDACore/interface/ESProduct.h" +#endif + +class HcalChannelQualityGPU { +public: + struct Product { + edm::propagate_const_array> status; + }; + +#ifndef __CUDACC__ + // rearrange reco params + HcalChannelQualityGPU(HcalChannelQuality const &); + + // will trigger deallocation of Product thru ~Product + ~HcalChannelQualityGPU() = default; + + // get device pointers + Product const &getProduct(cudaStream_t) const; + +private: + uint64_t totalChannels_; + std::vector> status_; + + cms::cuda::ESProduct product_; +#endif // __CUDACC__ +}; + +#endif // RecoLocalCalo_HcalRecAlgos_interface_HcalChannelQualityGPU_h diff --git a/CondFormats/HcalObjects/interface/HcalItemArrayColl.h b/CondFormats/HcalObjects/interface/HcalItemArrayColl.h deleted file mode 100644 index 40997120b675e..0000000000000 --- a/CondFormats/HcalObjects/interface/HcalItemArrayColl.h +++ /dev/null @@ -1,101 +0,0 @@ -#ifndef CondFormats_HcalObjects_HcalItemArrayColl_h -#define CondFormats_HcalObjects_HcalItemArrayColl_h - -#include "boost/array.hpp" -#include "boost/serialization/access.hpp" -#include "boost/serialization/version.hpp" -#include "boost/serialization/shared_ptr.hpp" -#include "boost/serialization/vector.hpp" -#include "boost/version.hpp" -#if BOOST_VERSION < 106400 -#include "boost/serialization/array.hpp" -#else -#include "boost/serialization/boost_array.hpp" -#endif - -#include -#include -#include - -// -// This collection manages arrays of pointers and references. -// In particular, it can be used for storing objects in -// an inheritance hierarchy by their base pointers. -// The pointee objects are owned by this collection. -// -template -class HcalItemArrayColl { -public: - typedef Item value_type; - typedef std::array, N> InputArray; - static constexpr unsigned arraySize() { return N; } - - // The following method adds a new array of pointers to the collection. - // This class will take ownership of the pointee objects. - void push_back(InputArray& arr) { - StoredArray st; - for (unsigned i = 0; i < N; ++i) - st[i] = std::shared_ptr(arr[i].release()); - data_.push_back(st); - } - - // Other modifiers - inline void clear() { data_.clear(); } - inline void reserve(const unsigned n) { data_.reserve(n); } - - // Some inspectors - inline std::size_t size() const { return data_.size(); } - inline bool empty() const { return data_.empty(); } - - // The following function returns nullptr if - // one of the argument indices is out of range - inline const Item* get(const unsigned itemIndex, const unsigned arrayIndex) const { - if (itemIndex < data_.size() && arrayIndex < N) - return data_[itemIndex][arrayIndex].get(); - else - return nullptr; - } - - // The following function throws an exception if - // one of the argument indices is out of range - inline Item& at(const unsigned itemIndex, const unsigned arrayIndex) const { - return *data_.at(itemIndex).at(arrayIndex); - } - - // Deep comparison for equality is useful for testing serialization - bool operator==(const HcalItemArrayColl& r) const { - const std::size_t sz = data_.size(); - if (sz != r.data_.size()) - return false; - for (std::size_t i = 0; i < sz; ++i) - for (unsigned j = 0; j < N; ++j) - if (!(*data_[i][j] == *r.data_[i][j])) - return false; - return true; - } - - inline bool operator!=(const HcalItemArrayColl& r) const { return !(*this == r); } - -private: - typedef boost::array, N> StoredArray; - std::vector data_; - - friend class boost::serialization::access; - - template - inline void serialize(Archive& ar, unsigned /* version */) { - ar& data_; - } -}; - -// boost serialization version number for this template -namespace boost { - namespace serialization { - template - struct version > { - BOOST_STATIC_CONSTANT(int, value = 1); - }; - } // namespace serialization -} // namespace boost - -#endif // CondFormats_HcalObjects_HcalItemArrayColl_h diff --git a/CondFormats/HcalObjects/interface/HcalItemArrayCollById.h b/CondFormats/HcalObjects/interface/HcalItemArrayCollById.h deleted file mode 100644 index 2c66a4860a717..0000000000000 --- a/CondFormats/HcalObjects/interface/HcalItemArrayCollById.h +++ /dev/null @@ -1,161 +0,0 @@ -#ifndef CondFormats_HcalObjects_HcalItemArrayCollById_h -#define CondFormats_HcalObjects_HcalItemArrayCollById_h - -#include - -#include "FWCore/Utilities/interface/Exception.h" - -#include "CondFormats/HcalObjects/interface/HcalItemArrayColl.h" -#include "CondFormats/HcalObjects/interface/HcalIndexLookup.h" -#include "DataFormats/HcalDetId/interface/HcalDetId.h" -#include "CondFormats/HcalObjects/interface/HcalDetIdTransform.h" -#include "CondFormats/HcalObjects/interface/AbsHcalAlgoData.h" - -// -// This collection allows lookup of arrays of items by HcalDetId. -// If the given HcalDetId is not explicitly listed in the -// lookup table, default item is returned. -// -// Just like HcalItemArrayColl, this collection works with pointers -// and references only, so it can be used with the inheritance -// scenarios. Note that the ownership of objects is shared with -// the collection provided in the constructor. The default array -// is owned by this collection. Its ownership will also become -// shared if a copy of this collection is made. -// -template -class HcalItemArrayCollById : public AbsHcalAlgoData { -public: - typedef Item value_type; - typedef typename HcalItemArrayColl::InputArray InputArray; - static constexpr unsigned arraySize() { return N; } - - // Dummy constructor. To be used for deserialization only. - inline HcalItemArrayCollById() : transformCode_(HcalDetIdTransform::N_TRANSFORMS) {} - - // Normal constructor - HcalItemArrayCollById(const HcalItemArrayColl& coll, - const HcalIndexLookup& indexLookupTable, - const unsigned detIdTransformCode, - InputArray& defaultFunctors) - : coll_(coll), lookup_(indexLookupTable), transformCode_(detIdTransformCode) { - // Check that the lookup table is valid for this application - if (lookup_.hasDuplicateIds()) - throw cms::Exception( - "In HcalItemArrayCollById constructor:" - " invalid lookup table"); - - // Check that the lookup table is consistent with the size - // of the collection - const unsigned maxIndex = lookup_.largestIndex(); - if (maxIndex != HcalIndexLookup::InvalidIndex && maxIndex >= coll_.size()) - throw cms::Exception( - "In HcalItemArrayCollById constructor:" - " collection and lookup table are inconsistent"); - - HcalDetIdTransform::validateCode(transformCode_); - - // Take care of the default array - setDefault(defaultFunctors); - } - - inline virtual ~HcalItemArrayCollById() {} - - // Modifier for the default array of items - inline void setDefault(InputArray& arr) { - for (unsigned i = 0; i < N; ++i) - default_[i] = std::shared_ptr(arr[i].release()); - } - - // Size of the internal collection, not counting the default - inline std::size_t size() const { return coll_.size(); } - - // Look up the index into the collection by detector id - inline unsigned getIndex(const HcalDetId& id) const { - return lookup_.find(HcalDetIdTransform::transform(id, transformCode_)); - } - - // Item lookup by its index and array index. If item lookup - // by index fails and the array index is not out of bounds, - // default item is returned. - inline const Item* getByIndex(const unsigned itemIndex, const unsigned arrayIndex) const { - const Item* f = coll_.get(itemIndex, arrayIndex); - if (f == nullptr && arrayIndex < N) - f = default_[arrayIndex].get(); - return f; - } - - // The following method will return nullptr if - // there is no corresponding default - inline const Item* getDefault(const unsigned arrayIndex) const { - if (arrayIndex < N) - return default_[arrayIndex].get(); - else - return nullptr; - } - - // Convenience function for getting what we need by id. - // Note that, if you are simply cycling over array indices, - // it will be more efficient to retrieve the item index - // first and then use "getByIndex" method. - inline const Item* get(const HcalDetId& id, const unsigned arrayIndex) const { - return getByIndex(getIndex(id), arrayIndex); - } - - // Similar comment applies here if you are just cycling over array indices - inline const Item& at(const HcalDetId& id, const unsigned arrayIndex) const { - const Item* f = getByIndex(getIndex(id), arrayIndex); - if (f == nullptr) - throw cms::Exception("In HcalItemArrayCollById::at: invalid detector id"); - return *f; - } - -protected: - virtual bool isEqual(const AbsHcalAlgoData& other) const override { - const HcalItemArrayCollById& r = static_cast(other); - if (coll_ != r.coll_) - return false; - if (lookup_ != r.lookup_) - return false; - if (transformCode_ != r.transformCode_) - return false; - for (unsigned j = 0; j < N; ++j) { - // The default may or may not be there - const bool ld = default_[j].get(); - const bool rd = r.default_[j].get(); - if (ld != rd) - return false; - if (ld) - if (!(*default_[j] == *r.default_[j])) - return false; - } - return true; - } - -private: - typedef boost::array, N> StoredArray; - - HcalItemArrayColl coll_; - HcalIndexLookup lookup_; - StoredArray default_; - uint32_t transformCode_; - - friend class boost::serialization::access; - - template - inline void serialize(Archive& ar, unsigned /* version */) { - ar& coll_& lookup_& default_& transformCode_; - } -}; - -// boost serialization version number for this template -namespace boost { - namespace serialization { - template - struct version > { - BOOST_STATIC_CONSTANT(int, value = 1); - }; - } // namespace serialization -} // namespace boost - -#endif // CondFormats_HcalObjects_HcalItemArrayCollById_h diff --git a/CondFormats/HcalObjects/src/HcalChannelQualityGPU.cc b/CondFormats/HcalObjects/src/HcalChannelQualityGPU.cc new file mode 100644 index 0000000000000..103dcdc86c26a --- /dev/null +++ b/CondFormats/HcalObjects/src/HcalChannelQualityGPU.cc @@ -0,0 +1,39 @@ +#include "CondFormats/HcalObjects/interface/HcalChannelQuality.h" +#include "CondFormats/HcalObjects/interface/HcalChannelQualityGPU.h" +#include "FWCore/Utilities/interface/typelookup.h" +#include "HeterogeneousCore/CUDAUtilities/interface/copyAsync.h" + +// FIXME: add proper getters to conditions +HcalChannelQualityGPU::HcalChannelQualityGPU(HcalChannelQuality const& quality) + : totalChannels_{quality.getAllContainers()[0].second.size() + quality.getAllContainers()[1].second.size()}, + status_(totalChannels_) { + auto const containers = quality.getAllContainers(); + + // fill in eb + auto const& barrelValues = containers[0].second; + for (uint64_t i = 0; i < barrelValues.size(); ++i) { + status_[i] = barrelValues[i].getValue(); + } + + // fill in ee + auto const& endcapValues = containers[1].second; + auto const offset = barrelValues.size(); + for (uint64_t i = 0; i < endcapValues.size(); ++i) { + status_[i + offset] = endcapValues[i].getValue(); + } +} + +HcalChannelQualityGPU::Product const& HcalChannelQualityGPU::getProduct(cudaStream_t stream) const { + auto const& product = + product_.dataForCurrentDeviceAsync(stream, [this](HcalChannelQualityGPU::Product& product, cudaStream_t stream) { + // allocate + product.status = cms::cuda::make_device_unique(status_.size(), stream); + + // transfer + cms::cuda::copyAsync(product.status, status_, stream); + }); + + return product; +} + +TYPELOOKUP_DATA_REG(HcalChannelQualityGPU); diff --git a/CondFormats/L1TObjects/interface/L1TMuonOverlapParams.h b/CondFormats/L1TObjects/interface/L1TMuonOverlapParams.h index 641e3ed051ef9..d27d0c77b7454 100644 --- a/CondFormats/L1TObjects/interface/L1TMuonOverlapParams.h +++ b/CondFormats/L1TObjects/interface/L1TMuonOverlapParams.h @@ -98,7 +98,8 @@ class L1TMuonOverlapParams { GENERAL = 5, SECTORS_START = 6, SECTORS_END = 7, - NUM_OMTFPARAMNODES = 8 + DIST_PHI_SHIFT = 8, + NUM_OMTFPARAMNODES = 9 }; // General configuration parameters indexes @@ -205,6 +206,17 @@ class L1TMuonOverlapParams { const l1t::LUT *pdfLUT() const { return &pnodes_[PDF].LUT_; } const l1t::LUT *meanDistPhiLUT() const { return &pnodes_[MEANDISTPHI].LUT_; } + /** + * return nullptr if the DistPhiShiftLUT is not available in the given L1TMuonOverlapParamsRcd, + * which is the case for the fwVersion <= 0x6 + */ + const l1t::LUT *distPhiShiftLUT() const { + if (pnodes_.size() >= (DIST_PHI_SHIFT + 1)) + return &pnodes_[DIST_PHI_SHIFT].LUT_; + else + return nullptr; + } + void setChargeLUT(const l1t::LUT &lut) { pnodes_[CHARGE].type_ = "LUT"; pnodes_[CHARGE].LUT_ = lut; @@ -225,6 +237,10 @@ class L1TMuonOverlapParams { pnodes_[MEANDISTPHI].type_ = "LUT"; pnodes_[MEANDISTPHI].LUT_ = lut; } + void setDistPhiShiftLUT(const l1t::LUT &lut) { + pnodes_[DIST_PHI_SHIFT].type_ = "LUT"; + pnodes_[DIST_PHI_SHIFT].LUT_ = lut; + } private: ///Version of firmware configuration diff --git a/CondFormats/MFObjects/src/MagFieldConfig.cc b/CondFormats/MFObjects/src/MagFieldConfig.cc index 4b3853e9a0752..f1ef5440064d8 100644 --- a/CondFormats/MFObjects/src/MagFieldConfig.cc +++ b/CondFormats/MFObjects/src/MagFieldConfig.cc @@ -12,7 +12,6 @@ #include #include -#include using namespace std; using namespace magneticfield; @@ -81,8 +80,8 @@ vector MagFieldConfig::expandList(const string& list) { for (vstring::const_iterator i = v1.begin(); i != v1.end(); ++i) { vstring v2; boost::split(v2, *i, boost::is_any_of("-")); - unsigned start = boost::lexical_cast(v2.front()); - unsigned end = boost::lexical_cast(v2.back()); + unsigned start = std::stoul(v2.front()); + unsigned end = std::stoul(v2.back()); if ((v2.size() > 2) || (start > end)) { throw cms::Exception("ConfigurationError") << "VolumeBasedMagneticFieldESProducerFromDB: malformed configuration" << list << endl; diff --git a/CondFormats/MFObjects/test/MagFieldConfigDBWriter.cc b/CondFormats/MFObjects/test/MagFieldConfigDBWriter.cc index 47f1f5e4080e6..29c798c024a43 100644 --- a/CondFormats/MFObjects/test/MagFieldConfigDBWriter.cc +++ b/CondFormats/MFObjects/test/MagFieldConfigDBWriter.cc @@ -45,10 +45,10 @@ void MagFieldConfigDBWriter::endJob() { try { if (dbOutputSvc->isNewTagRequest(record)) { //create mode - dbOutputSvc->writeOne(conf, dbOutputSvc->beginOfTime(), record); + dbOutputSvc->writeOneIOV(*conf, dbOutputSvc->beginOfTime(), record); } else { //append mode. Note: correct PoolDBESSource must be loaded - dbOutputSvc->writeOne(conf, dbOutputSvc->currentTime(), record); + dbOutputSvc->writeOneIOV(*conf, dbOutputSvc->currentTime(), record); } } catch (const cond::Exception& er) { std::cout << er.what() << std::endl; diff --git a/CondFormats/PPSObjects/interface/PPSAlignmentConfiguration.h b/CondFormats/PPSObjects/interface/PPSAlignmentConfiguration.h new file mode 100644 index 0000000000000..f514fa1c9bbd2 --- /dev/null +++ b/CondFormats/PPSObjects/interface/PPSAlignmentConfiguration.h @@ -0,0 +1,199 @@ +/**************************************************************************** +* Authors: +* Jan KaÅ¡par (jan.kaspar@gmail.com) +* Mateusz Kocot (mateuszkocot99@gmail.com) +****************************************************************************/ + +#ifndef CondFormats_PPSObjects_PPSAlignmentConfiguration_h +#define CondFormats_PPSObjects_PPSAlignmentConfiguration_h + +#include "CondFormats/Serialization/interface/Serializable.h" + +#include +#include +#include + +class PPSAlignmentConfiguration { +public: + // Auxiliary structures + struct PointErrors { + double x_; + double y_; + double ex_; // error x + double ey_; // error y + + COND_SERIALIZABLE; + }; + + struct SelectionRange { + double x_min_; + double x_max_; + + COND_SERIALIZABLE; + }; + + struct RPConfig { + std::string name_; + unsigned int id_; + std::string position_; + double slope_; + double sh_x_; + + double x_min_fit_mode_, x_max_fit_mode_; + double y_max_fit_mode_; + double y_cen_add_; + double y_width_mult_; + + int x_slice_n_; + double x_slice_min_, x_slice_w_; + + COND_SERIALIZABLE; + }; + + struct SectorConfig { + std::string name_; + RPConfig rp_N_, rp_F_; + double slope_; + + bool cut_h_apply_; + double cut_h_a_, cut_h_c_, cut_h_si_; + + bool cut_v_apply_; + double cut_v_a_, cut_v_c_, cut_v_si_; + + COND_SERIALIZABLE; + }; + + struct Binning { + double bin_size_x_; // mm + unsigned int n_bins_x_; + + double pixel_x_offset_; + + unsigned int n_bins_y_; + double y_min_, y_max_; + + unsigned int diffFN_n_bins_x_; + double diffFN_x_min_, diffFN_x_max_; + + unsigned int slice_n_bins_x_, slice_n_bins_y_; + double slice_x_min_, slice_x_max_, slice_y_min_, slice_y_max_; + + COND_SERIALIZABLE; + }; + + // Getters + const SectorConfig& sectorConfig45() const; + const SectorConfig& sectorConfig56() const; + + double x_ali_sh_step() const; + + double y_mode_sys_unc() const; + double chiSqThreshold() const; + double y_mode_unc_max_valid() const; + double y_mode_max_valid() const; + + double minRPTracksSize() const; + double maxRPTracksSize() const; + double n_si() const; + + const std::map>& matchingReferencePoints() const; + const std::map& matchingShiftRanges() const; + + const std::map& alignment_x_meth_o_ranges() const; + unsigned int fitProfileMinBinEntries() const; + unsigned int fitProfileMinNReasonable() const; + unsigned int methOGraphMinN() const; + double methOUncFitRange() const; + + const std::map& alignment_x_relative_ranges() const; + unsigned int nearFarMinEntries() const; + + const std::map& alignment_y_ranges() const; + unsigned int modeGraphMinN() const; + unsigned int multSelProjYMinEntries() const; + + const Binning& binning() const; + + const std::vector& extraParams() const; + + // Setters + void setSectorConfig45(SectorConfig& sectorConfig45); + void setSectorConfig56(SectorConfig& sectorConfig56); + + void setX_ali_sh_step(double x_ali_sh_step); + + void setY_mode_sys_unc(double y_mode_sys_unc); + void setChiSqThreshold(double chiSqThreshold); + void setY_mode_unc_max_valid(double y_mode_unc_max_valid); + void setY_mode_max_valid(double y_mode_max_valid); + + void setMinRPTracksSize(unsigned int minRPTracksSize); + void setMaxRPTracksSize(unsigned int maxRPTracksSize); + void setN_si(double n_si); + + void setMatchingReferencePoints(std::map>& matchingReferencePoints); + void setMatchingShiftRanges(std::map& matchingShiftRanges); + + void setAlignment_x_meth_o_ranges(std::map& alignment_x_meth_o_ranges); + void setFitProfileMinBinEntries(unsigned int fitProfileMinBinEntries); + void setFitProfileMinNReasonable(unsigned int fitProfileMinNReasonable); + void setMethOGraphMinN(unsigned int methOGraphMinN); + void setMethOUncFitRange(double methOUncFitRange); + + void setAlignment_x_relative_ranges(std::map& alignment_x_relative_ranges); + void setNearFarMinEntries(unsigned int nearFarMinEntries); + + void setAlignment_y_ranges(std::map& alignment_y_ranges); + void setModeGraphMinN(unsigned int modeGraphMinN); + void setMultSelProjYMinEntries(unsigned int multSelProjYMinEntries); + + void setBinning(Binning& binning); + + void setExtraParams(std::vector& extraParams); + + // << operator + friend std::ostream& operator<<(std::ostream& os, const PPSAlignmentConfiguration& c); + +private: + SectorConfig sectorConfig45_, sectorConfig56_; + + double x_ali_sh_step_; // mm + + double y_mode_sys_unc_; + double chiSqThreshold_; + double y_mode_unc_max_valid_; + double y_mode_max_valid_; + + unsigned int minRPTracksSize_; + unsigned int maxRPTracksSize_; + double n_si_; + + std::map> matchingReferencePoints_; + std::map matchingShiftRanges_; + + std::map alignment_x_meth_o_ranges_; + unsigned int fitProfileMinBinEntries_; + unsigned int fitProfileMinNReasonable_; + unsigned int methOGraphMinN_; + double methOUncFitRange_; // mm + + std::map alignment_x_relative_ranges_; + unsigned int nearFarMinEntries_; + + std::map alignment_y_ranges_; + unsigned int modeGraphMinN_; + unsigned int multSelProjYMinEntries_; + + Binning binning_; + + std::vector extraParams_; + + COND_SERIALIZABLE; +}; + +std::ostream& operator<<(std::ostream& os, const PPSAlignmentConfiguration::RPConfig& rc); +std::ostream& operator<<(std::ostream& os, const PPSAlignmentConfiguration::SectorConfig& sc); +std::ostream& operator<<(std::ostream& os, const PPSAlignmentConfiguration::Binning& b); + +#endif diff --git a/CondFormats/PPSObjects/interface/PPSAssociationCuts.h b/CondFormats/PPSObjects/interface/PPSAssociationCuts.h new file mode 100644 index 0000000000000..12bbcd6d01538 --- /dev/null +++ b/CondFormats/PPSObjects/interface/PPSAssociationCuts.h @@ -0,0 +1,85 @@ +/**************************************************************************** + * Authors: + * Jan KaÅ¡par + * Grzegorz Sroka + ****************************************************************************/ + +#ifndef CondFormats_PPSObjects_PPSAssociationCuts_h +#define CondFormats_PPSObjects_PPSAssociationCuts_h + +struct TF1; + +#include "CondFormats/Serialization/interface/Serializable.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" + +#include +#include +#include +#include + +class PPSAssociationCuts { +public: + class CutsPerArm { + public: + enum Quantities { qX, qY, qXi, qThetaY }; + + CutsPerArm() {} + + CutsPerArm(const edm::ParameterSet &iConfig, int sector); + + ~CutsPerArm() {} + + const std::vector &getMeans() const { return s_means_; } + const std::vector &getThresholds() const { return s_thresholds_; } + + double getTiTrMin() const { return ti_tr_min_; } + double getTiTrMax() const { return ti_tr_max_; } + + // returns whether the specified cut is applied + bool isApplied(Quantities quantity) const; + + // returns whether if the specified cut is satisfied (for a particular event) + bool isSatisfied(Quantities quantity, double x_near, double y_near, double xangle, double q_NF_diff) const; + + protected: + // string representation of the cut parameters - for serialisation + std::vector s_means_; + std::vector s_thresholds_; + + // TF1 representation of the cut parameters - for run time evaluations + std::vector > f_means_ COND_TRANSIENT; + std::vector > f_thresholds_ COND_TRANSIENT; + + // timing-tracking cuts + double ti_tr_min_; + double ti_tr_max_; + + static double evaluateExpression(std::shared_ptr expression, double x_near, double y_near, double xangle); + + COND_SERIALIZABLE; + }; + + PPSAssociationCuts() {} + + PPSAssociationCuts(const edm::ParameterSet &iConfig); + + ~PPSAssociationCuts() {} + + const CutsPerArm &getAssociationCuts(const int sector) const { return association_cuts_.at(sector); } + + static edm::ParameterSetDescription getDefaultParameters(); + +private: + std::map association_cuts_; + + COND_SERIALIZABLE; +}; + +//---------------------------------------------------------------------------------------------------- + +std::ostream &operator<<(std::ostream &os, const PPSAssociationCuts::CutsPerArm &cutsPerArm); + +std::ostream &operator<<(std::ostream &os, const PPSAssociationCuts &ppsAssociationCuts); + +#endif diff --git a/CondFormats/PPSObjects/src/PPSAlignmentConfiguration.cc b/CondFormats/PPSObjects/src/PPSAlignmentConfiguration.cc new file mode 100644 index 0000000000000..1e3db71078b63 --- /dev/null +++ b/CondFormats/PPSObjects/src/PPSAlignmentConfiguration.cc @@ -0,0 +1,263 @@ +/**************************************************************************** +* Authors: +* Jan KaÅ¡par (jan.kaspar@gmail.com) +* Mateusz Kocot (mateuszkocot99@gmail.com) +****************************************************************************/ + +#include "CondFormats/PPSObjects/interface/PPSAlignmentConfiguration.h" + +#include +#include +#include + +// -------------------------------- PPSAlignmentConfiguration getters -------------------------------- + +const PPSAlignmentConfiguration::SectorConfig& PPSAlignmentConfiguration::sectorConfig45() const { + return sectorConfig45_; +} +const PPSAlignmentConfiguration::SectorConfig& PPSAlignmentConfiguration::sectorConfig56() const { + return sectorConfig56_; +} + +double PPSAlignmentConfiguration::x_ali_sh_step() const { return x_ali_sh_step_; } + +double PPSAlignmentConfiguration::y_mode_sys_unc() const { return y_mode_sys_unc_; } +double PPSAlignmentConfiguration::chiSqThreshold() const { return chiSqThreshold_; } +double PPSAlignmentConfiguration::y_mode_unc_max_valid() const { return y_mode_unc_max_valid_; } +double PPSAlignmentConfiguration::y_mode_max_valid() const { return y_mode_max_valid_; } + +double PPSAlignmentConfiguration::minRPTracksSize() const { return minRPTracksSize_; } +double PPSAlignmentConfiguration::maxRPTracksSize() const { return maxRPTracksSize_; } +double PPSAlignmentConfiguration::n_si() const { return n_si_; } + +const std::map>& +PPSAlignmentConfiguration::matchingReferencePoints() const { + return matchingReferencePoints_; +} +const std::map& +PPSAlignmentConfiguration::matchingShiftRanges() const { + return matchingShiftRanges_; +} + +const std::map& +PPSAlignmentConfiguration::alignment_x_meth_o_ranges() const { + return alignment_x_meth_o_ranges_; +} +unsigned int PPSAlignmentConfiguration::fitProfileMinBinEntries() const { return fitProfileMinBinEntries_; } +unsigned int PPSAlignmentConfiguration::fitProfileMinNReasonable() const { return fitProfileMinNReasonable_; } +unsigned int PPSAlignmentConfiguration::methOGraphMinN() const { return methOGraphMinN_; } +double PPSAlignmentConfiguration::methOUncFitRange() const { return methOUncFitRange_; } + +const std::map& +PPSAlignmentConfiguration::alignment_x_relative_ranges() const { + return alignment_x_relative_ranges_; +} +unsigned int PPSAlignmentConfiguration::nearFarMinEntries() const { return nearFarMinEntries_; } + +const std::map& PPSAlignmentConfiguration::alignment_y_ranges() + const { + return alignment_y_ranges_; +} +unsigned int PPSAlignmentConfiguration::modeGraphMinN() const { return modeGraphMinN_; } +unsigned int PPSAlignmentConfiguration::multSelProjYMinEntries() const { return multSelProjYMinEntries_; } + +const PPSAlignmentConfiguration::Binning& PPSAlignmentConfiguration::binning() const { return binning_; } + +const std::vector& PPSAlignmentConfiguration::extraParams() const { return extraParams_; } + +// -------------------------------- PPSAlignmentConfiguration setters -------------------------------- + +void PPSAlignmentConfiguration::setSectorConfig45(PPSAlignmentConfiguration::SectorConfig& sectorConfig45) { + sectorConfig45_ = sectorConfig45; +} +void PPSAlignmentConfiguration::setSectorConfig56(PPSAlignmentConfiguration::SectorConfig& sectorConfig56) { + sectorConfig56_ = sectorConfig56; +} + +void PPSAlignmentConfiguration::setX_ali_sh_step(double x_ali_sh_step) { x_ali_sh_step_ = x_ali_sh_step; } + +void PPSAlignmentConfiguration::setY_mode_sys_unc(double y_mode_sys_unc) { y_mode_sys_unc_ = y_mode_sys_unc; } +void PPSAlignmentConfiguration::setChiSqThreshold(double chiSqThreshold) { chiSqThreshold_ = chiSqThreshold; } +void PPSAlignmentConfiguration::setY_mode_unc_max_valid(double y_mode_unc_max_valid) { + y_mode_unc_max_valid_ = y_mode_unc_max_valid; +} +void PPSAlignmentConfiguration::setY_mode_max_valid(double y_mode_max_valid) { y_mode_max_valid_ = y_mode_max_valid; } + +void PPSAlignmentConfiguration::setMinRPTracksSize(unsigned int minRPTracksSize) { minRPTracksSize_ = minRPTracksSize; } +void PPSAlignmentConfiguration::setMaxRPTracksSize(unsigned int maxRPTracksSize) { maxRPTracksSize_ = maxRPTracksSize; } +void PPSAlignmentConfiguration::setN_si(double n_si) { n_si_ = n_si; } + +void PPSAlignmentConfiguration::setMatchingReferencePoints( + std::map>& matchingReferencePoints) { + matchingReferencePoints_ = matchingReferencePoints; +} +void PPSAlignmentConfiguration::setMatchingShiftRanges( + std::map& matchingShiftRanges) { + matchingShiftRanges_ = matchingShiftRanges; +} + +void PPSAlignmentConfiguration::setAlignment_x_meth_o_ranges( + std::map& alignment_x_meth_o_ranges) { + alignment_x_meth_o_ranges_ = alignment_x_meth_o_ranges; +} +void PPSAlignmentConfiguration::setFitProfileMinBinEntries(unsigned int fitProfileMinBinEntries) { + fitProfileMinBinEntries_ = fitProfileMinBinEntries; +} +void PPSAlignmentConfiguration::setFitProfileMinNReasonable(unsigned int fitProfileMinNReasonable) { + fitProfileMinNReasonable_ = fitProfileMinNReasonable; +} +void PPSAlignmentConfiguration::setMethOGraphMinN(unsigned int methOGraphMinN) { methOGraphMinN_ = methOGraphMinN; } +void PPSAlignmentConfiguration::setMethOUncFitRange(double methOUncFitRange) { methOUncFitRange_ = methOUncFitRange; } + +void PPSAlignmentConfiguration::setAlignment_x_relative_ranges( + std::map& alignment_x_relative_ranges) { + alignment_x_relative_ranges_ = alignment_x_relative_ranges; +} +void PPSAlignmentConfiguration::setNearFarMinEntries(unsigned int nearFarMinEntries) { + nearFarMinEntries_ = nearFarMinEntries; +} + +void PPSAlignmentConfiguration::setAlignment_y_ranges( + std::map& alignment_y_ranges) { + alignment_y_ranges_ = alignment_y_ranges; +} +void PPSAlignmentConfiguration::setModeGraphMinN(unsigned int modeGraphMinN) { modeGraphMinN_ = modeGraphMinN; } +void PPSAlignmentConfiguration::setMultSelProjYMinEntries(unsigned int multSelProjYMinEntries) { + multSelProjYMinEntries_ = multSelProjYMinEntries; +} + +void PPSAlignmentConfiguration::setBinning(PPSAlignmentConfiguration::Binning& binning) { binning_ = binning; } + +void PPSAlignmentConfiguration::setExtraParams(std::vector& extraParams) { extraParams_ = extraParams; } + +// -------------------------------- << operators -------------------------------- + +std::ostream& operator<<(std::ostream& os, const PPSAlignmentConfiguration::RPConfig& rc) { + os << std::fixed << std::setprecision(3); + os << " " << rc.name_ << ", id = " << rc.id_ << ", position = " << rc.position_ << ":\n"; + os << " slope = " << rc.slope_ << ", sh_x = " << rc.sh_x_ << "\n"; + os << " x_min_fit_mode = " << rc.x_min_fit_mode_ << ", x_max_fit_mode = " << rc.x_max_fit_mode_ << "\n"; + os << " y_max_fit_mode = " << rc.y_max_fit_mode_ << "\n"; + os << " y_cen_add = " << rc.y_cen_add_ << ", y_width_mult = " << rc.y_width_mult_ << "\n"; + os << std::setprecision(2); + os << " x slices: min = " << rc.x_slice_min_ << ", w = " << rc.x_slice_w_ << ", n = " << rc.x_slice_n_; + + return os; +} + +std::ostream& operator<<(std::ostream& os, const PPSAlignmentConfiguration::SectorConfig& sc) { + os << std::fixed << std::setprecision(3); + os << sc.name_ << ":\n"; + os << sc.rp_N_ << "\n" << sc.rp_F_ << "\n"; + os << std::setprecision(3); + os << " slope = " << sc.slope_ << "\n"; + os << " cut_h: apply = " << std::boolalpha << sc.cut_h_apply_ << ", a = " << sc.cut_h_a_ << ", c = " << sc.cut_h_c_ + << ", si = " << sc.cut_h_si_ << "\n"; + os << " cut_v: apply = " << std::boolalpha << sc.cut_v_apply_ << ", a = " << sc.cut_v_a_ << ", c = " << sc.cut_v_c_ + << ", si = " << sc.cut_v_si_ << "\n"; + + return os; +} + +std::ostream& operator<<(std::ostream& os, const PPSAlignmentConfiguration::Binning& b) { + os << " bin_size_x = " << b.bin_size_x_ << ", n_bins_x = " << b.n_bins_x_ << "\n"; + os << " pixel_x_offset = " << b.pixel_x_offset_ << "\n"; + os << " n_bins_y = " << b.n_bins_y_ << ", y_min = " << b.y_min_ << ", y_max = " << b.y_max_ << "\n"; + os << " diff far-near:" + << "\n"; + os << " n_bins_x = " << b.diffFN_n_bins_x_ << ", x_min = " << b.diffFN_x_min_ + << ", x_max = " << b.diffFN_x_max_ << "\n"; + os << " slice plots:" + << "\n"; + os << " n_bins_x = " << b.slice_n_bins_x_ << ", x_min = " << b.slice_x_min_ << ", x_max = " << b.slice_x_max_ + << "\n"; + os << " n_bins_y = " << b.slice_n_bins_y_ << ", y_min = " << b.slice_y_min_ << ", y_max = " << b.slice_y_max_; + + return os; +} + +std::ostream& operator<<(std::ostream& os, const PPSAlignmentConfiguration& c) { + os << "* " << c.sectorConfig45_ << "\n\n"; + os << "* " << c.sectorConfig56_ << "\n\n"; + + std::map rpTags = {{c.sectorConfig45_.rp_F_.id_, c.sectorConfig45_.rp_F_.name_}, + {c.sectorConfig45_.rp_N_.id_, c.sectorConfig45_.rp_N_.name_}, + {c.sectorConfig56_.rp_N_.id_, c.sectorConfig56_.rp_N_.name_}, + {c.sectorConfig56_.rp_F_.id_, c.sectorConfig56_.rp_F_.name_}}; + + os << "* x alignment shift step\n"; + os << " x_ali_sh_step = " << c.x_ali_sh_step_ << "\n\n"; + + os << "* mode graph parameters\n"; + os << " y_mode_sys_unc = " << c.y_mode_sys_unc_ << "\n"; + os << " chiSqThreshold = " << c.chiSqThreshold_ << "\n"; + os << " y_mode_unc_max_valid = " << c.y_mode_unc_max_valid_ << "\n"; + os << " y_mode_max_valid = " << c.y_mode_max_valid_ << "\n\n"; + + os << "* selection\n"; + os << " min_RP_tracks_size = " << c.minRPTracksSize_ << "\n"; + os << " max_RP_tracks_size = " << c.maxRPTracksSize_ << "\n\n"; + + os << "* cuts\n"; + os << " n_si = " << c.n_si_ << "\n\n"; + + os << "* matching\n" << std::setprecision(3); + + os << " shift ranges:\n"; + for (const auto& p : c.matchingShiftRanges_) + os << " RP " << rpTags[p.first] << " (" << std::setw(3) << p.first << "): sh_min = " << p.second.x_min_ + << ", sh_max = " << p.second.x_max_ << "\n"; + + os << " reference points:\n"; + for (const auto& pm : c.matchingReferencePoints_) { + os << " " << std::setw(3) << pm.first << ": "; + for (unsigned int i = 0; i < pm.second.size(); i++) { + const auto& p = pm.second[i]; + if (i % 5 == 0 && i > 0) + os << "\n "; + os << "(" << std::setw(6) << p.x_ << " +- " << p.ex_ << ", " << std::setw(6) << p.y_ << " +- " << p.ey_ << "), "; + } + os << "\n"; + } + + os << "\n" + << "* alignment_x_meth_o\n"; + for (const auto& p : c.alignment_x_meth_o_ranges_) + os << " RP " << rpTags[p.first] << " (" << std::setw(3) << p.first << "): sh_min = " << p.second.x_min_ + << ", sh_max = " << p.second.x_max_ << "\n"; + os << " fit_profile_min_bin_entries = " << c.fitProfileMinBinEntries_ << "\n"; + os << " fit_profile_min_N_reasonable = " << c.fitProfileMinNReasonable_ << "\n"; + os << " meth_o_graph_min_N = " << c.methOGraphMinN_ << "\n"; + os << " meth_o_unc_fit_range = " << c.methOUncFitRange_ << "\n"; + + os << "\n" + << "* alignment_x_relative\n"; + for (const auto& p : c.alignment_x_relative_ranges_) + if (p.first == c.sectorConfig45_.rp_N_.id_ || p.first == c.sectorConfig56_.rp_N_.id_) { // only near RPs + os << " RP " << rpTags[p.first] << " (" << std::setw(3) << p.first << "): sh_min = " << p.second.x_min_ + << ", sh_max = " << p.second.x_max_ << "\n"; + } + os << " near_far_min_entries = " << c.nearFarMinEntries_ << "\n"; + + os << "\n" + << "* alignment_y\n"; + for (const auto& p : c.alignment_y_ranges_) + os << " RP " << rpTags[p.first] << " (" << std::setw(3) << p.first << "): sh_min = " << p.second.x_min_ + << ", sh_max = " << p.second.x_max_ << "\n"; + os << " mode_graph_min_N = " << c.modeGraphMinN_ << "\n"; + os << " mult_sel_proj_y_min_entries = " << c.multSelProjYMinEntries_ << "\n"; + + os << "\n" + << "* binning\n"; + os << c.binning_ << "\n"; + + if (!c.extraParams_.empty()) { + os << "\n"; + os << "extra_params:\n"; + for (size_t i = 0; i < c.extraParams_.size(); i++) { + os << std::setw(5) << i << ": " << c.extraParams_[i] << "\n"; + } + } + + return os; +} diff --git a/CondFormats/PPSObjects/src/PPSAssociationCuts.cc b/CondFormats/PPSObjects/src/PPSAssociationCuts.cc new file mode 100644 index 0000000000000..ca04123c98c06 --- /dev/null +++ b/CondFormats/PPSObjects/src/PPSAssociationCuts.cc @@ -0,0 +1,130 @@ +/**************************************************************************** + * Authors: + * Jan KaÅ¡par + * Grzegorz Sroka + ****************************************************************************/ + +#include "CondFormats/PPSObjects/interface/PPSAssociationCuts.h" +#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" + +#include "TF1.h" + +#include + +//---------------------------------------------------------------------------------------------------- + +PPSAssociationCuts::CutsPerArm::CutsPerArm(const edm::ParameterSet &iConfig, int sector) { + const auto &association_cuts = iConfig.getParameterSet("association_cuts_" + std::to_string(sector)); + + const std::vector names{"x", "y", "xi", "th_y"}; + for (std::size_t i = 0; i < names.size(); ++i) { + std::string mean = association_cuts.getParameter(names[i] + "_cut_mean"); + s_means_.push_back(mean); + + std::string threshold = association_cuts.getParameter(names[i] + "_cut_threshold"); + s_thresholds_.push_back(threshold); + + f_means_.push_back(std::make_shared("f", mean.c_str())); + f_thresholds_.push_back(std::make_shared("f", threshold.c_str())); + } + + ti_tr_min_ = association_cuts.getParameter("ti_tr_min"); + ti_tr_max_ = association_cuts.getParameter("ti_tr_max"); +} + +//---------------------------------------------------------------------------------------------------- + +bool PPSAssociationCuts::CutsPerArm::isApplied(Quantities quantity) const { + return (!s_thresholds_.at(quantity).empty()) && (!s_means_.at(quantity).empty()); +} + +//---------------------------------------------------------------------------------------------------- + +bool PPSAssociationCuts::CutsPerArm::isSatisfied( + Quantities quantity, double x_near, double y_near, double xangle, double q_NF_diff) const { + if (!isApplied(quantity)) + return true; + const double mean = evaluateExpression(f_means_.at(quantity), x_near, y_near, xangle); + const double threshold = evaluateExpression(f_thresholds_.at(quantity), x_near, y_near, xangle); + return fabs(q_NF_diff - mean) < threshold; +} + +//---------------------------------------------------------------------------------------------------- + +double PPSAssociationCuts::CutsPerArm::evaluateExpression(std::shared_ptr expression, + double x_near, + double y_near, + double xangle) { + expression->SetParameter("x_near", x_near); + expression->SetParameter("y_near", y_near); + expression->SetParameter("xangle", xangle); + return expression->EvalPar(nullptr); +} + +//---------------------------------------------------------------------------------------------------- + +PPSAssociationCuts::PPSAssociationCuts(const edm::ParameterSet &iConfig) { + unsigned int i = 0; + for (const int §or : {45, 56}) + association_cuts_[i++] = CutsPerArm(iConfig, sector); +} + +//---------------------------------------------------------------------------------------------------- + +edm::ParameterSetDescription PPSAssociationCuts::getDefaultParameters() { + edm::ParameterSetDescription desc; + + desc.add("x_cut_mean", "")->setComment("mean of track-association cut in x, mm"); + desc.add("x_cut_threshold", "")->setComment("threshold of track-association cut in x, mm"); + + desc.add("y_cut_mean", "")->setComment("mean of track-association cut in y, mm"); + desc.add("y_cut_threshold", "")->setComment("threshold of track-association cut in y, mm"); + + desc.add("xi_cut_mean", "")->setComment("mean of track-association cut in xi"); + desc.add("xi_cut_threshold", "")->setComment("threshold of track-association cut in xi"); + + desc.add("th_y_cut_mean", "")->setComment("mean of track-association cut in th_y, rad"); + desc.add("th_y_cut_threshold", "")->setComment("threshold of track-association cut in th_y, rad"); + + desc.add("ti_tr_min", -1.)->setComment("minimum value for timing-tracking association cut"); + desc.add("ti_tr_max", +1.)->setComment("maximum value for timing-tracking association cut"); + + return desc; +} + +//---------------------------------------------------------------------------------------------------- + +std::ostream &operator<<(std::ostream &os, const PPSAssociationCuts::CutsPerArm &cutsPerArm) { + os << "CutsPerArm {" << std::endl; + + os << "\tmeans {"; + for (auto const &value : cutsPerArm.getMeans()) { + os << "\"" << value << "\", "; + } + os << "}" << std::endl << std::endl; + + os << "\tthresholds {"; + for (auto const &value : cutsPerArm.getThresholds()) { + os << "\"" << value << "\", "; + } + os << "}" << std::endl << std::endl; + + os << "\tti_tr_min " << cutsPerArm.getTiTrMin() << std::endl; + os << "\tti_tr_max " << cutsPerArm.getTiTrMax() << std::endl; + os << "}" << std::endl; + + return os; +} + +//---------------------------------------------------------------------------------------------------- + +std::ostream &operator<<(std::ostream &os, const PPSAssociationCuts &ppsAssociationCuts) { + os << "PPSAssociationCuts {" << std::endl; + os << "45" << std::endl; + os << ppsAssociationCuts.getAssociationCuts(0); + os << "56" << std::endl; + os << ppsAssociationCuts.getAssociationCuts(1); + os << "}" << std::endl; + + return os; +} \ No newline at end of file diff --git a/CondFormats/PPSObjects/src/PPSPixelTopology.cc b/CondFormats/PPSObjects/src/PPSPixelTopology.cc index 13d20b8a0547c..55f78046d9938 100644 --- a/CondFormats/PPSObjects/src/PPSPixelTopology.cc +++ b/CondFormats/PPSObjects/src/PPSPixelTopology.cc @@ -28,16 +28,17 @@ unsigned short PPSPixelTopology::pixelIndex(PixelInfo pI) const { bool PPSPixelTopology::isPixelHit(float xLocalCoordinate, float yLocalCoordinate, bool is3x2 = true) const { // check hit fiducial boundaries - double xModuleSize = 2 * ((no_of_pixels_simX_ / 2. + 1) * pitch_simX_ + dead_edge_width_); + const double xModuleSize = 2 * ((no_of_pixels_simX_ / 2. + 1) * pitch_simX_ + dead_edge_width_); if (xLocalCoordinate < -xModuleSize / 2. || xLocalCoordinate > xModuleSize / 2.) return false; - double yModuleSize = (no_of_pixels_simY_ + 4.) * pitch_simY_ + 2. * dead_edge_width_; - double y2x2top = no_of_pixels_simY_ / 6. * pitch_simY_ + dead_edge_width_; + const double yModuleSize = (no_of_pixels_simY_ + 4.) * pitch_simY_ + 2. * dead_edge_width_; + const double y2x2top = no_of_pixels_simY_ / 6. * pitch_simY_ + dead_edge_width_; if (is3x2 && (yLocalCoordinate < -yModuleSize / 2. || yLocalCoordinate > yModuleSize / 2.)) return false; - - if (!is3x2 && (yLocalCoordinate < -yModuleSize / 2. || yLocalCoordinate > y2x2top)) + if (!is3x2 && (runType_ == "Run2") && (yLocalCoordinate < -yModuleSize / 2. || yLocalCoordinate > y2x2top)) + return false; + if (!is3x2 && (runType_ == "Run3") && (yLocalCoordinate < -yModuleSize / 2. || yLocalCoordinate > yModuleSize / 2.)) return false; return true; diff --git a/CondFormats/PPSObjects/src/T_EventSetup_PPSAlignmentConfiguration.cc b/CondFormats/PPSObjects/src/T_EventSetup_PPSAlignmentConfiguration.cc new file mode 100644 index 0000000000000..66ce70016939b --- /dev/null +++ b/CondFormats/PPSObjects/src/T_EventSetup_PPSAlignmentConfiguration.cc @@ -0,0 +1,4 @@ +#include "CondFormats/PPSObjects/interface/PPSAlignmentConfiguration.h" +#include "FWCore/Utilities/interface/typelookup.h" + +TYPELOOKUP_DATA_REG(PPSAlignmentConfiguration); diff --git a/CondFormats/PPSObjects/src/T_EventSetup_PPSAssociationCuts.cc b/CondFormats/PPSObjects/src/T_EventSetup_PPSAssociationCuts.cc new file mode 100644 index 0000000000000..f2858de6540ef --- /dev/null +++ b/CondFormats/PPSObjects/src/T_EventSetup_PPSAssociationCuts.cc @@ -0,0 +1,4 @@ +#include "CondFormats/PPSObjects/interface/PPSAssociationCuts.h" +#include "FWCore/Utilities/interface/typelookup.h" + +TYPELOOKUP_DATA_REG(PPSAssociationCuts); diff --git a/CondFormats/PPSObjects/src/classes_def.xml b/CondFormats/PPSObjects/src/classes_def.xml index 74cfa9a9761dc..528dc7485e326 100644 --- a/CondFormats/PPSObjects/src/classes_def.xml +++ b/CondFormats/PPSObjects/src/classes_def.xml @@ -27,6 +27,12 @@ + + + + + + @@ -80,5 +86,16 @@ + + + + + + + + + + + - \ No newline at end of file + diff --git a/CondFormats/PPSObjects/src/headers.h b/CondFormats/PPSObjects/src/headers.h index 1b77a578cb8ca..e0e1edae9d95e 100644 --- a/CondFormats/PPSObjects/src/headers.h +++ b/CondFormats/PPSObjects/src/headers.h @@ -5,6 +5,7 @@ #include "CondFormats/PPSObjects/interface/CTPPSRPAlignmentCorrectionsData.h" #include "CondFormats/PPSObjects/interface/CTPPSRPAlignmentCorrectionsDataSequence.h" #include "CondFormats/PPSObjects/interface/PPSTimingCalibration.h" +#include "CondFormats/PPSObjects/interface/PPSAlignmentConfiguration.h" #include "CondFormats/PPSObjects/interface/LHCOpticalFunctionsSet.h" #include "CondFormats/PPSObjects/interface/LHCOpticalFunctionsSetCollection.h" @@ -15,3 +16,4 @@ #include "CondFormats/PPSObjects/interface/PPSPixelTopology.h" #include "CondFormats/PPSObjects/interface/PPSAlignmentConfig.h" +#include "CondFormats/PPSObjects/interface/PPSAssociationCuts.h" diff --git a/CondFormats/PPSObjects/test/BuildFile.xml b/CondFormats/PPSObjects/test/BuildFile.xml index edb32ad3438ca..37fdb1e9d95c1 100644 --- a/CondFormats/PPSObjects/test/BuildFile.xml +++ b/CondFormats/PPSObjects/test/BuildFile.xml @@ -13,3 +13,11 @@ + + + + + + + + diff --git a/CondFormats/PPSObjects/test/testSerializationPPSAlignmentConfiguration.cc b/CondFormats/PPSObjects/test/testSerializationPPSAlignmentConfiguration.cc new file mode 100644 index 0000000000000..092c293844946 --- /dev/null +++ b/CondFormats/PPSObjects/test/testSerializationPPSAlignmentConfiguration.cc @@ -0,0 +1,17 @@ +#include "CondFormats/Serialization/interface/Test.h" + +#include "../src/headers.h" + +int main() { + testSerialization(); + testSerialization(); + testSerialization(); + testSerialization(); + testSerialization(); + + testSerialization>(); + testSerialization>>(); + testSerialization>(); + + testSerialization(); +} diff --git a/CondFormats/PPSObjects/test/testSerializationPPSAssociationCuts.cc b/CondFormats/PPSObjects/test/testSerializationPPSAssociationCuts.cc new file mode 100644 index 0000000000000..802165ff05a44 --- /dev/null +++ b/CondFormats/PPSObjects/test/testSerializationPPSAssociationCuts.cc @@ -0,0 +1,10 @@ +#include "CondFormats/Serialization/interface/Test.h" + +#include "CondFormats/PPSObjects/src/headers.h" + +int main() { + testSerialization(); + testSerialization(); + testSerialization>(); + testSerialization>(); +} \ No newline at end of file diff --git a/CondFormats/PhysicsToolsObjects/test/SiStripDeDx2DBuilder.cc b/CondFormats/PhysicsToolsObjects/test/SiStripDeDx2DBuilder.cc index 5396b53d1887f..4a66e17d3f369 100644 --- a/CondFormats/PhysicsToolsObjects/test/SiStripDeDx2DBuilder.cc +++ b/CondFormats/PhysicsToolsObjects/test/SiStripDeDx2DBuilder.cc @@ -15,7 +15,7 @@ //#include "CLHEP/Random/RandFlat.h" //#include "CLHEP/Random/RandGauss.h" -class SiStripDeDx2DBuilder : public edm::EDAnalyzer { +class SiStripDeDx2DBuilder : public edm::one::EDAnalyzer<> { public: explicit SiStripDeDx2DBuilder(const edm::ParameterSet& iConfig); diff --git a/CondFormats/PhysicsToolsObjects/test/SiStripDeDx3DBuilder.cc b/CondFormats/PhysicsToolsObjects/test/SiStripDeDx3DBuilder.cc index f373da3344eca..af44a27027488 100644 --- a/CondFormats/PhysicsToolsObjects/test/SiStripDeDx3DBuilder.cc +++ b/CondFormats/PhysicsToolsObjects/test/SiStripDeDx3DBuilder.cc @@ -15,7 +15,7 @@ //#include "CLHEP/Random/RandFlat.h" //#include "CLHEP/Random/RandGauss.h" -class SiStripDeDx3DBuilder : public edm::EDAnalyzer { +class SiStripDeDx3DBuilder : public edm::one::EDAnalyzer<> { public: explicit SiStripDeDx3DBuilder(const edm::ParameterSet& iConfig); diff --git a/CondFormats/PhysicsToolsObjects/test/SiStripDeDxMipBuilder.h b/CondFormats/PhysicsToolsObjects/test/SiStripDeDxMipBuilder.h index 1247e2e36c397..fa6d63bbd1544 100644 --- a/CondFormats/PhysicsToolsObjects/test/SiStripDeDxMipBuilder.h +++ b/CondFormats/PhysicsToolsObjects/test/SiStripDeDxMipBuilder.h @@ -13,7 +13,7 @@ //#include "CLHEP/Random/RandFlat.h" //#include "CLHEP/Random/RandGauss.h" -class SiStripDeDxMipBuilder : public edm::EDAnalyzer { +class SiStripDeDxMipBuilder : public edm::one::EDAnalyzer<> { public: explicit SiStripDeDxMipBuilder(const edm::ParameterSet& iConfig); diff --git a/CondFormats/Serialization/interface/eos/polymorphic_portable_archive.hpp b/CondFormats/Serialization/interface/eos/polymorphic_portable_archive.hpp deleted file mode 100644 index 45933afa4bbd5..0000000000000 --- a/CondFormats/Serialization/interface/eos/polymorphic_portable_archive.hpp +++ /dev/null @@ -1,35 +0,0 @@ -/*****************************************************************************/ -/** - * \file polymorphic_portable_archive.hpp - * \brief Needed for unit tests on portable archives. - * \author christian.pfligersdorffer@gmx.at - * - * Header for testing portable archives with all of the serialization tests. - * Before use copy all hpp files from this directory to your boost folder - * boost_.../libs/serialization/test and run from there a visual studio - * prompt with b2 oder bjam -sBOOST_ARCHIVE_LIST=portable_archive.hpp - * - * \note Since portable archives version 5.0 we depend on program_options! - * Edit libs/serialization/test/Jamfile.v2 and change the requirements to - * : requirements /boost/filesystem /boost/program_options - */ -/****************************************************************************/ - -#pragma warning(disable : 4217 4127 4310 4244 4800 4267) - -// text_archive test header -// include output archive header -#include "portable_oarchive.hpp" -// set name of test output archive -typedef eos::polymorphic_portable_oarchive test_oarchive; -// set name of test output stream -typedef std::ofstream test_ostream; - -// repeat the above for input archive -#include "portable_iarchive.hpp" -typedef eos::polymorphic_portable_iarchive test_iarchive; -typedef std::ifstream test_istream; - -// define open mode for streams -// binary archives should use std::ios_base::binary -#define TEST_STREAM_FLAGS std::ios_base::binary diff --git a/CondFormats/Serialization/interface/eos/portable_archive.hpp b/CondFormats/Serialization/interface/eos/portable_archive.hpp deleted file mode 100644 index f5b51ccb82cee..0000000000000 --- a/CondFormats/Serialization/interface/eos/portable_archive.hpp +++ /dev/null @@ -1,35 +0,0 @@ -/*****************************************************************************/ -/** - * \file portable_archive.hpp - * \brief Needed for unit tests on portable archives. - * \author christian.pfligersdorffer@gmx.at - * - * Header for testing portable archives with all of the serialization tests. - * Before use copy all hpp files from this directory to your boost folder - * boost_.../libs/serialization/test and run from there a visual studio - * prompt with b2 oder bjam -sBOOST_ARCHIVE_LIST=portable_archive.hpp - * - * \note Since portable archives version 5.0 we depend on program_options! - * Edit libs/serialization/test/Jamfile.v2 and change the requirements to - * : requirements /boost/filesystem /boost/program_options - */ -/****************************************************************************/ - -#pragma warning(disable : 4217 4127 4310 4244 4800 4267) - -// text_archive test header -// include output archive header -#include "portable_oarchive.hpp" -// set name of test output archive -typedef eos::portable_oarchive test_oarchive; -// set name of test output stream -typedef std::ofstream test_ostream; - -// repeat the above for input archive -#include "portable_iarchive.hpp" -typedef eos::portable_iarchive test_iarchive; -typedef std::ifstream test_istream; - -// define open mode for streams -// binary archives should use std::ios_base::binary -#define TEST_STREAM_FLAGS std::ios_base::binary diff --git a/CondFormats/Serialization/interface/eos/portable_archive_exception.hpp b/CondFormats/Serialization/interface/eos/portable_archive_exception.hpp index 0aa18a83c752f..0f0628a93f6d8 100644 --- a/CondFormats/Serialization/interface/eos/portable_archive_exception.hpp +++ b/CondFormats/Serialization/interface/eos/portable_archive_exception.hpp @@ -14,7 +14,6 @@ #pragma once -#include #include #include @@ -75,7 +74,7 @@ namespace eos { template portable_archive_exception(const T& abnormal) : boost::archive::archive_exception(other_exception), msg("serialization of illegal floating point value: ") { - msg += boost::lexical_cast(abnormal); + msg += std::to_string(abnormal); } //! override the base class function with our message diff --git a/CondFormats/SiPixelObjects/interface/MapPathTodetUnit.h b/CondFormats/SiPixelObjects/interface/MapPathTodetUnit.h deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/CondFormats/SiPixelObjects/src/SiPixelVCal.cc b/CondFormats/SiPixelObjects/src/SiPixelVCal.cc index a40fa5f4985af..da083bd629a84 100644 --- a/CondFormats/SiPixelObjects/src/SiPixelVCal.cc +++ b/CondFormats/SiPixelObjects/src/SiPixelVCal.cc @@ -1,6 +1,8 @@ #include "CondFormats/SiPixelObjects/interface/SiPixelVCal.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" +#include + bool SiPixelVCal::putSlopeAndOffset(const uint32_t& pixid, float& slopeValue, float& offsetValue) { std::map::const_iterator id = m_vcal.find(pixid); if (id != m_vcal.end()) { diff --git a/CondFormats/SiPixelTransient/interface/SiPixelUtils.h b/CondFormats/SiPixelTransient/interface/SiPixelUtils.h index 6b944c2f316c1..fb814a23c74a8 100644 --- a/CondFormats/SiPixelTransient/interface/SiPixelUtils.h +++ b/CondFormats/SiPixelTransient/interface/SiPixelUtils.h @@ -4,8 +4,8 @@ namespace SiPixelUtils { float generic_position_formula(int size, //!< Size of this projection. - int Q_f, //!< Charge in the first pixel. - int Q_l, //!< Charge in the last pixel. + int q_f, //!< Charge in the first pixel. + int q_l, //!< Charge in the last pixel. float upper_edge_first_pix, //!< As the name says. float lower_edge_last_pix, //!< As the name says. float lorentz_shift, //!< L-width @@ -19,6 +19,24 @@ namespace SiPixelUtils { float size_cut //!< Use edge when size == cuts ); -} + float generic_position_formula_y_bricked( + int size, //!< Size of this projection. + int q_f, //!< Charge in the first pixel. + int q_l, //!< Charge in the last pixel. + int q_f_b, //!< Charge in pixels that are "dented" compared to the lowest pixel of the cluster. + int q_l_b, //!< Charge in pixels that are "dented" compared to the highest pixel of the cluster. + float upper_edge_first_pix, //!< As the name says. + float lower_edge_last_pix, //!< As the name says. + float lorentz_shift, //!< L-width + float theThickness, //detector thickness + float cot_angle, //!< cot of alpha_ or beta_ + float pitch, //!< thePitchX or thePitchY + bool first_is_big, //!< true if the first is big + bool last_is_big, //!< true if the last is big + float eff_charge_cut_low, //!< Use edge if > W_eff (in pix) &&& + float eff_charge_cut_high, //!< Use edge if < W_eff (in pix) &&& + float size_cut //!< Use edge when size == cuts + ); +} // namespace SiPixelUtils #endif diff --git a/CondFormats/SiPixelTransient/src/SiPixelUtils.cc b/CondFormats/SiPixelTransient/src/SiPixelUtils.cc index 567ce0ee4bd4d..734fc13804870 100644 --- a/CondFormats/SiPixelTransient/src/SiPixelUtils.cc +++ b/CondFormats/SiPixelTransient/src/SiPixelUtils.cc @@ -28,8 +28,6 @@ namespace SiPixelUtils { float eff_charge_cut_high, //!< Use edge if < w_eff &&& float size_cut //!< Use edge when size == cuts ) { - //cout<<" in PixelCPEGeneric:generic_position_formula - "< w_eff &&& + float eff_charge_cut_high, //!< Use edge if < w_eff &&& + float size_cut //!< Use edge when size == cuts + ) { + const auto geom_center = 0.5f * (upper_edge_first_pix + lower_edge_last_pix); + + //--- The case of only one pixel in this projection is separate. Note that + //--- here first_pix == last_pix, so the average of the two is still the + //--- center of the pixel. + + //--- Width of the clusters minus the edge (first and last) pixels. + //--- In the note, they are denoted x_F and x_L (and y_F and y_L) + const auto w_inner = lower_edge_last_pix - upper_edge_first_pix; // in cm + + //--- Predicted charge width from geometry + const auto w_pred = theThickness * cot_angle // geometric correction (in cm) + - lorentz_shift; // (in cm) &&& check fpix! + + //--- Total length of the two edge pixels (first+last) + auto sum_of_edge = 2.0f; + if (first_is_big) + sum_of_edge += 1.0f; + if (last_is_big) + sum_of_edge += 1.0f; + + //--- The `effective' charge width -- particle's path in first and last pixels only + auto w_eff = std::abs(w_pred) - std::abs(w_inner); + + //--- If the observed charge width is inconsistent with the expectations + //--- based on the track, do *not* use w_pred-w_innner. Instead, replace + //--- it with an *average* effective charge width, which is the average + //--- length of the edge pixels. + // + // bool usedEdgeAlgo = false; + //Modified cut to make use of the w_eff in the bricked geometry + if (size >= size_cut) { + w_eff = pitch * 0.5f * sum_of_edge; // ave. length of edge pixels (first+last) (cm) + // usedEdgeAlgo = true; + } + + //--- Finally, compute the position in this projection + const auto q_diff = q_l - q_f; + auto q_sum = q_l + q_f; + const auto q_b_corr = q_l_b + q_f_b; + + //--- Temporary fix for clusters with both first and last pixel with charge = 0 + if (q_sum == 0) + q_sum = 1.0f; + + float hit_pos = + geom_center + 0.5f * (q_diff / q_sum) * w_eff + 0.5f * (q_b_corr / q_sum) * w_eff; //bricked correction + + return hit_pos; + } } // namespace SiPixelUtils diff --git a/CondFormats/SiStripObjects/src/SiStripDetSummary.cc b/CondFormats/SiStripObjects/src/SiStripDetSummary.cc index 7ade22ed47d7e..495ef24a2dff3 100644 --- a/CondFormats/SiStripObjects/src/SiStripDetSummary.cc +++ b/CondFormats/SiStripObjects/src/SiStripDetSummary.cc @@ -34,7 +34,6 @@ void SiStripDetSummary::add(DetId detid, float value) { break; } detNum += layer * 10 + stereo; - // string name( detector + boost::lexical_cast(layer) + boost::lexical_cast(stereo) ); valueMap_[detNum].mean += value; valueMap_[detNum].rms += value * value; valueMap_[detNum].count += 1; diff --git a/CondTools/BeamSpot/plugins/BeamSpotOnlineHLTRcdReader.cc b/CondTools/BeamSpot/plugins/BeamSpotOnlineHLTRcdReader.cc deleted file mode 100644 index 0a5be5fd9e360..0000000000000 --- a/CondTools/BeamSpot/plugins/BeamSpotOnlineHLTRcdReader.cc +++ /dev/null @@ -1,202 +0,0 @@ -// -*- C++ -*- -// -// Package: CondTools/BeamSpot -// Class: BeamSpotOnlineHLTRcdReader -// -/**\class BeamSpotOnlineHLTRcdReader BeamSpotOnlineHLTRcdReader.cc CondTools/BeamSpot/plugins/BeamSpotOnlineHLTRcdReader.cc - - Description: EDAnalyzer to create a BeamSpotOnlineHLTObjectsRcd payload from a txt file and dump it in a db file - - Implementation: - [Notes on implementation] -*/ -// -// Original Author: Francesco Brivio -// Created: Tue, 11 Feb 2020 08:39:14 GMT -// -// - -// system include files -#include -#include -#include - -// user include files -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/one/EDAnalyzer.h" - -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/MakerMacros.h" - -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/Utilities/interface/InputTag.h" -#include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/Framework/interface/ESHandle.h" -#include "FWCore/Framework/interface/ESWatcher.h" - -#include "CondFormats/DataRecord/interface/BeamSpotOnlineHLTObjectsRcd.h" -#include "CondFormats/BeamSpotObjects/interface/BeamSpotOnlineObjects.h" - -// For ROOT -#include "FWCore/ServiceRegistry/interface/Service.h" -#include "CommonTools/UtilAlgos/interface/TFileService.h" -#include - -// -// class declaration -// - -class BeamSpotOnlineHLTRcdReader : public edm::one::EDAnalyzer { -public: - explicit BeamSpotOnlineHLTRcdReader(const edm::ParameterSet&); - ~BeamSpotOnlineHLTRcdReader() override; - - static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); - -private: - void beginJob() override; - void analyze(const edm::Event&, const edm::EventSetup&) override; - void endJob() override; - - struct theBSOfromDB { - int ls; - int run; - float BSx0_; - float BSy0_; - float BSz0_; - float Beamsigmaz_; - float Beamdxdz_; - float BeamWidthX_; - float BeamWidthY_; - int lastAnalyzedLumi_; - int lastAnalyzedRun_; - int lastAnalyzedFill_; - void init(); - } theBSOfromDB_; - - edm::Service tFileService; - TTree* bstree_; - - // ----------member data --------------------------- - edm::ESWatcher watcher_; - std::unique_ptr output_; -}; - -// -// constructors and destructor -// -BeamSpotOnlineHLTRcdReader::BeamSpotOnlineHLTRcdReader(const edm::ParameterSet& iConfig) : bstree_(nullptr) { - //now do what ever initialization is needed - usesResource("TFileService"); - std::string fileName(iConfig.getUntrackedParameter("rawFileName")); - if (!fileName.empty()) { - output_.reset(new std::ofstream(fileName.c_str())); - if (!output_->good()) { - edm::LogError("IOproblem") << "Could not open output file " << fileName << "."; - output_.reset(); - } - } -} - -BeamSpotOnlineHLTRcdReader::~BeamSpotOnlineHLTRcdReader() { - // do anything here that needs to be done at desctruction time - // (e.g. close files, deallocate resources etc.) -} - -// -// member functions -// - -void BeamSpotOnlineHLTRcdReader::theBSOfromDB::init() { - float dummy_float = -999.0; - int dummy_int = -999; - - run = dummy_int; - ls = dummy_int; - BSx0_ = dummy_float; - BSy0_ = dummy_float; - BSz0_ = dummy_float; - Beamsigmaz_ = dummy_float; - Beamdxdz_ = dummy_float; - BeamWidthX_ = dummy_float; - BeamWidthY_ = dummy_float; - lastAnalyzedLumi_ = dummy_int; - lastAnalyzedRun_ = dummy_int; - lastAnalyzedFill_ = dummy_int; -} - -// ------------ method called for each event ------------ -void BeamSpotOnlineHLTRcdReader::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { - using namespace edm; - std::ostringstream output; - - // initialize the ntuple - theBSOfromDB_.init(); - - if (watcher_.check(iSetup)) { // check for new IOV for this run / LS - - output << " for runs: " << iEvent.id().run() << " - " << iEvent.id().luminosityBlock() << std::endl; - - // Get BeamSpot from EventSetup: - edm::ESHandle beamhandle; - iSetup.get().get(beamhandle); - const BeamSpotOnlineObjects* mybeamspot = beamhandle.product(); - - theBSOfromDB_.run = iEvent.id().run(); - theBSOfromDB_.ls = iEvent.id().luminosityBlock(); - theBSOfromDB_.BSx0_ = mybeamspot->GetX(); - theBSOfromDB_.BSy0_ = mybeamspot->GetY(); - theBSOfromDB_.BSz0_ = mybeamspot->GetZ(); - theBSOfromDB_.Beamsigmaz_ = mybeamspot->GetSigmaZ(); - theBSOfromDB_.Beamdxdz_ = mybeamspot->Getdxdz(); - theBSOfromDB_.BeamWidthX_ = mybeamspot->GetBeamWidthX(); - theBSOfromDB_.BeamWidthY_ = mybeamspot->GetBeamWidthY(); - theBSOfromDB_.lastAnalyzedLumi_ = mybeamspot->GetLastAnalyzedLumi(); - theBSOfromDB_.lastAnalyzedRun_ = mybeamspot->GetLastAnalyzedRun(); - theBSOfromDB_.lastAnalyzedFill_ = mybeamspot->GetLastAnalyzedFill(); - - bstree_->Fill(); - - output << *mybeamspot << std::endl; - } - - // Final output - either message logger or output file: - if (output_.get()) - *output_ << output.str(); - else - edm::LogInfo("") << output.str(); -} - -// ------------ method called once each job just before starting event loop ------------ -void BeamSpotOnlineHLTRcdReader::beginJob() { - bstree_ = tFileService->make("BSONtuple", "BeamSpotOnline analyzer ntuple"); - - //Tree Branches - bstree_->Branch("run", &theBSOfromDB_.run, "run/I"); - bstree_->Branch("ls", &theBSOfromDB_.ls, "ls/I"); - bstree_->Branch("BSx0", &theBSOfromDB_.BSx0_, "BSx0/F"); - bstree_->Branch("BSy0", &theBSOfromDB_.BSy0_, "BSy0/F"); - bstree_->Branch("BSz0", &theBSOfromDB_.BSz0_, "BSz0/F"); - bstree_->Branch("Beamsigmaz", &theBSOfromDB_.Beamsigmaz_, "Beamsigmaz/F"); - bstree_->Branch("Beamdxdz", &theBSOfromDB_.Beamdxdz_, "Beamdxdz/F"); - bstree_->Branch("BeamWidthX", &theBSOfromDB_.BeamWidthX_, "BeamWidthX/F"); - bstree_->Branch("BeamWidthY", &theBSOfromDB_.BeamWidthY_, "BeamWidthY/F"); - bstree_->Branch("LastAnalyzedLumi", &theBSOfromDB_.lastAnalyzedLumi_, "LastAnalyzedLumi/I"); - bstree_->Branch("LastAnalyzedRun", &theBSOfromDB_.lastAnalyzedRun_, "LastAnalyzedRun/I"); - bstree_->Branch("LastAnalyzedFill", &theBSOfromDB_.lastAnalyzedFill_, "LastAnalyzedFill/I"); -} - -// ------------ method called once each job just after ending the event loop ------------ -void BeamSpotOnlineHLTRcdReader::endJob() {} - -// ------------ method fills 'descriptions' with the allowed parameters for the module ------------ -void BeamSpotOnlineHLTRcdReader::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { - //The following says we do not know what parameters are allowed so do no validation - // Please change this to state exactly what you do use, even if it is no parameters - edm::ParameterSetDescription desc; - desc.setUnknown(); - descriptions.addDefault(desc); -} - -//define this as a plug-in -DEFINE_FWK_MODULE(BeamSpotOnlineHLTRcdReader); diff --git a/CondTools/BeamSpot/plugins/BeamSpotOnlineHLTRcdWriter.cc b/CondTools/BeamSpot/plugins/BeamSpotOnlineHLTRcdWriter.cc deleted file mode 100644 index b1cba94925d62..0000000000000 --- a/CondTools/BeamSpot/plugins/BeamSpotOnlineHLTRcdWriter.cc +++ /dev/null @@ -1,234 +0,0 @@ -// -*- C++ -*- -// -// Package: CondTools/BeamSpot -// Class: BeamSpotOnlineHLTRcdWriter -// -/**\class BeamSpotOnlineHLTRcdWriter BeamSpotOnlineHLTRcdWriter.cc CondTools/BeamSpot/plugins/BeamSpotOnlineHLTRcdWriter.cc - - Description: EDAnalyzer to read the BeamSpotOnlineHLTObjectsRcd and dump it into a txt and root file - - Implementation: - [Notes on implementation] -*/ -// -// Original Author: Francesco Brivio -// Created: Tue, 11 Feb 2020 11:10:12 GMT -// -// - -// system include files -#include -#include -#include -#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/MakerMacros.h" - -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/Utilities/interface/InputTag.h" -#include "FWCore/ServiceRegistry/interface/Service.h" - -#include "CondFormats/DataRecord/interface/BeamSpotOnlineHLTObjectsRcd.h" -#include "CondFormats/BeamSpotObjects/interface/BeamSpotOnlineObjects.h" - -#include "CondCore/DBOutputService/interface/PoolDBOutputService.h" - -// -// class declaration -// - -class BeamSpotOnlineHLTRcdWriter : public edm::one::EDAnalyzer<> { -public: - explicit BeamSpotOnlineHLTRcdWriter(const edm::ParameterSet&); - ~BeamSpotOnlineHLTRcdWriter() override; - - static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); - cond::Time_t pack(uint32_t, uint32_t); - -private: - void beginJob() override; - void analyze(const edm::Event&, const edm::EventSetup&) override; - void endJob() override; - - std::ifstream fasciiFile; - std::string fasciiFileName; - uint32_t fIOVStartRun; - uint32_t fIOVStartLumi; - cond::Time_t fnewSince; - bool fuseNewSince; - - // ----------member data --------------------------- -}; - -// -// constructors and destructor -// -BeamSpotOnlineHLTRcdWriter::BeamSpotOnlineHLTRcdWriter(const edm::ParameterSet& iConfig) { - //now do what ever initialization is needed - fasciiFileName = iConfig.getUntrackedParameter("InputFileName"); - fasciiFile.open(fasciiFileName.c_str()); - if (iConfig.exists("IOVStartRun") && iConfig.exists("IOVStartLumi")) { - fIOVStartRun = iConfig.getUntrackedParameter("IOVStartRun"); - fIOVStartLumi = iConfig.getUntrackedParameter("IOVStartLumi"); - fnewSince = BeamSpotOnlineHLTRcdWriter::pack(fIOVStartRun, fIOVStartLumi); - fuseNewSince = true; - } else { - fuseNewSince = false; - } -} - -BeamSpotOnlineHLTRcdWriter::~BeamSpotOnlineHLTRcdWriter() { - // do anything here that needs to be done at desctruction time - // (e.g. close files, deallocate resources etc.) -} - -// -// member functions -// - -// ------------ Create a since object (cond::Time_t) by packing Run and LS (both uint32_t) ------------ -cond::Time_t BeamSpotOnlineHLTRcdWriter::pack(uint32_t fIOVStartRun, uint32_t fIOVStartLumi) { - return ((uint64_t)fIOVStartRun << 32 | fIOVStartLumi); -} - -// ------------ method called for each event ------------ -void BeamSpotOnlineHLTRcdWriter::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) {} - -// ------------ method called once each job just before starting event loop ------------ -void BeamSpotOnlineHLTRcdWriter::beginJob() {} - -// ------------ method called once each job just after ending the event loop ------------ -void BeamSpotOnlineHLTRcdWriter::endJob() { - std::cout << "Reading BeamSpotOnlineHLTRcd data from text file: " << fasciiFileName << std::endl; - - // extract from file - double x, y, z, sigmaZ, dxdz, dydz, beamWidthX, beamWidthY, emittanceX, emittanceY, betastar; - double cov[7][7]; - int type, lastAnalyzedLumi, firstAnalyzedLumi, lastAnalyzedRun, lastAnalyzedFill; - std::string tag; - - fasciiFile >> tag >> lastAnalyzedRun; - fasciiFile >> tag >> tag >> tag >> tag >> tag; // BeginTimeOfFit parsing (not used in payload) - fasciiFile >> tag >> tag >> tag >> tag >> tag; // EndTimeOfFit parsing (not used in payload) - fasciiFile >> tag >> firstAnalyzedLumi; - fasciiFile >> tag >> lastAnalyzedLumi; - fasciiFile >> tag >> type; - fasciiFile >> tag >> x; - fasciiFile >> tag >> y; - fasciiFile >> tag >> z; - fasciiFile >> tag >> sigmaZ; - fasciiFile >> tag >> dxdz; - fasciiFile >> tag >> dydz; - fasciiFile >> tag >> beamWidthX; - fasciiFile >> tag >> beamWidthY; - fasciiFile >> tag >> cov[0][0] >> cov[0][1] >> cov[0][2] >> cov[0][3] >> cov[0][4] >> cov[0][5] >> cov[0][6]; - fasciiFile >> tag >> cov[1][0] >> cov[1][1] >> cov[1][2] >> cov[1][3] >> cov[1][4] >> cov[1][5] >> cov[1][6]; - fasciiFile >> tag >> cov[2][0] >> cov[2][1] >> cov[2][2] >> cov[2][3] >> cov[2][4] >> cov[2][5] >> cov[2][6]; - fasciiFile >> tag >> cov[3][0] >> cov[3][1] >> cov[3][2] >> cov[3][3] >> cov[3][4] >> cov[3][5] >> cov[3][6]; - fasciiFile >> tag >> cov[4][0] >> cov[4][1] >> cov[4][2] >> cov[4][3] >> cov[4][4] >> cov[4][5] >> cov[4][6]; - fasciiFile >> tag >> cov[5][0] >> cov[5][1] >> cov[5][2] >> cov[5][3] >> cov[5][4] >> cov[5][5] >> cov[5][6]; - fasciiFile >> tag >> cov[6][0] >> cov[6][1] >> cov[6][2] >> cov[6][3] >> cov[6][4] >> cov[6][5] >> cov[6][6]; - fasciiFile >> tag >> emittanceX; - fasciiFile >> tag >> emittanceY; - fasciiFile >> tag >> betastar; - - lastAnalyzedFill = -999; - - std::cout << "---- Parsed these parameters from input txt file ----" << std::endl; - std::cout << " lastAnalyzedRun : " << lastAnalyzedRun << std::endl; - std::cout << " lastAnalyzedFill : " << lastAnalyzedFill << std::endl; - std::cout << " firstAnalyzedLumi : " << firstAnalyzedLumi << std::endl; - std::cout << " lastAnalyzedLumi : " << lastAnalyzedLumi << std::endl; - std::cout << " type : " << type << std::endl; - std::cout << " x : " << x << std::endl; - std::cout << " y : " << y << std::endl; - std::cout << " z : " << z << std::endl; - std::cout << " sigmaZ : " << sigmaZ << std::endl; - std::cout << " dxdz : " << dxdz << std::endl; - std::cout << " dydz : " << dydz << std::endl; - std::cout << " beamWidthX : " << beamWidthX << std::endl; - std::cout << " beamWidthY : " << beamWidthY << std::endl; - std::cout << " Cov(0,j) : " << cov[0][0] << " " << cov[0][1] << " " << cov[0][2] << " " << cov[0][3] << " " - << cov[0][4] << " " << cov[0][5] << " " << cov[0][6] << std::endl; - std::cout << " Cov(1,j) : " << cov[1][0] << " " << cov[1][1] << " " << cov[1][2] << " " << cov[1][3] << " " - << cov[1][4] << " " << cov[1][5] << " " << cov[1][6] << std::endl; - std::cout << " Cov(2,j) : " << cov[2][0] << " " << cov[2][1] << " " << cov[2][2] << " " << cov[2][3] << " " - << cov[2][4] << " " << cov[2][5] << " " << cov[2][6] << std::endl; - std::cout << " Cov(3,j) : " << cov[3][0] << " " << cov[3][1] << " " << cov[3][2] << " " << cov[3][3] << " " - << cov[3][4] << " " << cov[3][5] << " " << cov[3][6] << std::endl; - std::cout << " Cov(4,j) : " << cov[4][0] << " " << cov[4][1] << " " << cov[4][2] << " " << cov[4][3] << " " - << cov[4][4] << " " << cov[4][5] << " " << cov[4][6] << std::endl; - std::cout << " Cov(5,j) : " << cov[5][0] << " " << cov[5][1] << " " << cov[5][2] << " " << cov[5][3] << " " - << cov[5][4] << " " << cov[5][5] << " " << cov[5][6] << std::endl; - std::cout << " Cov(6,j) : " << cov[6][0] << " " << cov[6][1] << " " << cov[6][2] << " " << cov[6][3] << " " - << cov[6][4] << " " << cov[6][5] << " " << cov[6][6] << std::endl; - std::cout << " emittanceX : " << emittanceX << std::endl; - std::cout << " emittanceY : " << emittanceY << std::endl; - std::cout << " betastar : " << betastar << std::endl; - std::cout << "-----------------------------------------------------" << std::endl; - - BeamSpotOnlineObjects* abeam = new BeamSpotOnlineObjects(); - - abeam->SetLastAnalyzedLumi(lastAnalyzedLumi); - abeam->SetLastAnalyzedRun(lastAnalyzedRun); - abeam->SetLastAnalyzedFill(lastAnalyzedFill); - abeam->SetType(type); - abeam->SetPosition(x, y, z); - abeam->SetSigmaZ(sigmaZ); - abeam->Setdxdz(dxdz); - abeam->Setdydz(dydz); - abeam->SetBeamWidthX(beamWidthX); - abeam->SetBeamWidthY(beamWidthY); - abeam->SetEmittanceX(emittanceX); - abeam->SetEmittanceY(emittanceY); - abeam->SetBetaStar(betastar); - - for (int i = 0; i < 7; ++i) { - for (int j = 0; j < 7; ++j) { - abeam->SetCovariance(i, j, cov[i][j]); - } - } - - std::cout << " Writing results to DB..." << std::endl; - - edm::Service poolDbService; - if (poolDbService.isAvailable()) { - std::cout << "poolDBService available" << std::endl; - if (poolDbService->isNewTagRequest("BeamSpotOnlineHLTObjectsRcd")) { - std::cout << "new tag requested" << std::endl; - if (fuseNewSince) { - std::cout << "Using a new Since: " << fnewSince << std::endl; - poolDbService->createNewIOV( - abeam, fnewSince, poolDbService->endOfTime(), "BeamSpotOnlineHLTObjectsRcd"); - } else - poolDbService->createNewIOV( - abeam, poolDbService->beginOfTime(), poolDbService->endOfTime(), "BeamSpotOnlineHLTObjectsRcd"); - } else { - std::cout << "no new tag requested" << std::endl; - if (fuseNewSince) { - std::cout << "Using a new Since: " << fnewSince << std::endl; - poolDbService->appendSinceTime(abeam, fnewSince, "BeamSpotOnlineHLTObjectsRcd"); - } else - poolDbService->appendSinceTime( - abeam, poolDbService->currentTime(), "BeamSpotOnlineHLTObjectsRcd"); - } - } - - std::cout << "[BeamSpotOnlineHLTRcdWriter] endJob done \n" << std::endl; -} - -// ------------ method fills 'descriptions' with the allowed parameters for the module ------------ -void BeamSpotOnlineHLTRcdWriter::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { - //The following says we do not know what parameters are allowed so do no validation - // Please change this to state exactly what you do use, even if it is no parameters - edm::ParameterSetDescription desc; - desc.setUnknown(); - descriptions.addDefault(desc); -} - -//define this as a plug-in -DEFINE_FWK_MODULE(BeamSpotOnlineHLTRcdWriter); diff --git a/CondTools/BeamSpot/plugins/BeamSpotOnlineLegacyRcdWriter.cc b/CondTools/BeamSpot/plugins/BeamSpotOnlineLegacyRcdWriter.cc deleted file mode 100644 index 64b3ccc50d838..0000000000000 --- a/CondTools/BeamSpot/plugins/BeamSpotOnlineLegacyRcdWriter.cc +++ /dev/null @@ -1,234 +0,0 @@ -// -*- C++ -*- -// -// Package: CondTools/BeamSpot -// Class: BeamSpotOnlineLegacyRcdWriter -// -/**\class BeamSpotOnlineLegacyRcdWriter BeamSpotOnlineLegacyRcdWriter.cc CondTools/BeamSpot/plugins/BeamSpotOnlineLegacyRcdWriter.cc - - Description: EDAnalyzer to read the BeamSpotOnlineLegacyObjectsRcd and dump it into a txt and root file - - Implementation: - [Notes on implementation] -*/ -// -// Original Author: Francesco Brivio -// Created: Tue, 11 Feb 2020 11:10:12 GMT -// -// - -// system include files -#include -#include -#include -#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/MakerMacros.h" - -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/Utilities/interface/InputTag.h" -#include "FWCore/ServiceRegistry/interface/Service.h" - -#include "CondFormats/DataRecord/interface/BeamSpotOnlineLegacyObjectsRcd.h" -#include "CondFormats/BeamSpotObjects/interface/BeamSpotOnlineObjects.h" - -#include "CondCore/DBOutputService/interface/PoolDBOutputService.h" - -// -// class declaration -// - -class BeamSpotOnlineLegacyRcdWriter : public edm::one::EDAnalyzer<> { -public: - explicit BeamSpotOnlineLegacyRcdWriter(const edm::ParameterSet&); - ~BeamSpotOnlineLegacyRcdWriter() override; - - static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); - cond::Time_t pack(uint32_t, uint32_t); - -private: - void beginJob() override; - void analyze(const edm::Event&, const edm::EventSetup&) override; - void endJob() override; - - std::ifstream fasciiFile; - std::string fasciiFileName; - uint32_t fIOVStartRun; - uint32_t fIOVStartLumi; - cond::Time_t fnewSince; - bool fuseNewSince; - - // ----------member data --------------------------- -}; - -// -// constructors and destructor -// -BeamSpotOnlineLegacyRcdWriter::BeamSpotOnlineLegacyRcdWriter(const edm::ParameterSet& iConfig) { - //now do what ever initialization is needed - fasciiFileName = iConfig.getUntrackedParameter("InputFileName"); - fasciiFile.open(fasciiFileName.c_str()); - if (iConfig.exists("IOVStartRun") && iConfig.exists("IOVStartLumi")) { - fIOVStartRun = iConfig.getUntrackedParameter("IOVStartRun"); - fIOVStartLumi = iConfig.getUntrackedParameter("IOVStartLumi"); - fnewSince = BeamSpotOnlineLegacyRcdWriter::pack(fIOVStartRun, fIOVStartLumi); - fuseNewSince = true; - } else { - fuseNewSince = false; - } -} - -BeamSpotOnlineLegacyRcdWriter::~BeamSpotOnlineLegacyRcdWriter() { - // do anything here that needs to be done at desctruction time - // (e.g. close files, deallocate resources etc.) -} - -// -// member functions -// - -// ------------ Create a since object (cond::Time_t) by packing Run and LS (both uint32_t) ------------ -cond::Time_t BeamSpotOnlineLegacyRcdWriter::pack(uint32_t fIOVStartRun, uint32_t fIOVStartLumi) { - return ((uint64_t)fIOVStartRun << 32 | fIOVStartLumi); -} - -// ------------ method called for each event ------------ -void BeamSpotOnlineLegacyRcdWriter::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) {} - -// ------------ method called once each job just before starting event loop ------------ -void BeamSpotOnlineLegacyRcdWriter::beginJob() {} - -// ------------ method called once each job just after ending the event loop ------------ -void BeamSpotOnlineLegacyRcdWriter::endJob() { - std::cout << "Reading BeamSpotOnlineLegacyObjectsRcd data from text file: " << fasciiFileName << std::endl; - - // extract from file - double x, y, z, sigmaZ, dxdz, dydz, beamWidthX, beamWidthY, emittanceX, emittanceY, betastar; - double cov[7][7]; - int type, lastAnalyzedLumi, firstAnalyzedLumi, lastAnalyzedRun, lastAnalyzedFill; - std::string tag; - - fasciiFile >> tag >> lastAnalyzedRun; - fasciiFile >> tag >> tag >> tag >> tag >> tag; // BeginTimeOfFit parsing (not used in payload) - fasciiFile >> tag >> tag >> tag >> tag >> tag; // EndTimeOfFit parsing (not used in payload) - fasciiFile >> tag >> firstAnalyzedLumi; - fasciiFile >> tag >> lastAnalyzedLumi; - fasciiFile >> tag >> type; - fasciiFile >> tag >> x; - fasciiFile >> tag >> y; - fasciiFile >> tag >> z; - fasciiFile >> tag >> sigmaZ; - fasciiFile >> tag >> dxdz; - fasciiFile >> tag >> dydz; - fasciiFile >> tag >> beamWidthX; - fasciiFile >> tag >> beamWidthY; - fasciiFile >> tag >> cov[0][0] >> cov[0][1] >> cov[0][2] >> cov[0][3] >> cov[0][4] >> cov[0][5] >> cov[0][6]; - fasciiFile >> tag >> cov[1][0] >> cov[1][1] >> cov[1][2] >> cov[1][3] >> cov[1][4] >> cov[1][5] >> cov[1][6]; - fasciiFile >> tag >> cov[2][0] >> cov[2][1] >> cov[2][2] >> cov[2][3] >> cov[2][4] >> cov[2][5] >> cov[2][6]; - fasciiFile >> tag >> cov[3][0] >> cov[3][1] >> cov[3][2] >> cov[3][3] >> cov[3][4] >> cov[3][5] >> cov[3][6]; - fasciiFile >> tag >> cov[4][0] >> cov[4][1] >> cov[4][2] >> cov[4][3] >> cov[4][4] >> cov[4][5] >> cov[4][6]; - fasciiFile >> tag >> cov[5][0] >> cov[5][1] >> cov[5][2] >> cov[5][3] >> cov[5][4] >> cov[5][5] >> cov[5][6]; - fasciiFile >> tag >> cov[6][0] >> cov[6][1] >> cov[6][2] >> cov[6][3] >> cov[6][4] >> cov[6][5] >> cov[6][6]; - fasciiFile >> tag >> emittanceX; - fasciiFile >> tag >> emittanceY; - fasciiFile >> tag >> betastar; - - lastAnalyzedFill = -999; - - std::cout << "---- Parsed these parameters from input txt file ----" << std::endl; - std::cout << " lastAnalyzedRun : " << lastAnalyzedRun << std::endl; - std::cout << " lastAnalyzedFill : " << lastAnalyzedFill << std::endl; - std::cout << " firstAnalyzedLumi : " << firstAnalyzedLumi << std::endl; - std::cout << " lastAnalyzedLumi : " << lastAnalyzedLumi << std::endl; - std::cout << " type : " << type << std::endl; - std::cout << " x : " << x << std::endl; - std::cout << " y : " << y << std::endl; - std::cout << " z : " << z << std::endl; - std::cout << " sigmaZ : " << sigmaZ << std::endl; - std::cout << " dxdz : " << dxdz << std::endl; - std::cout << " dydz : " << dydz << std::endl; - std::cout << " beamWidthX : " << beamWidthX << std::endl; - std::cout << " beamWidthY : " << beamWidthY << std::endl; - std::cout << " Cov(0,j) : " << cov[0][0] << " " << cov[0][1] << " " << cov[0][2] << " " << cov[0][3] << " " - << cov[0][4] << " " << cov[0][5] << " " << cov[0][6] << std::endl; - std::cout << " Cov(1,j) : " << cov[1][0] << " " << cov[1][1] << " " << cov[1][2] << " " << cov[1][3] << " " - << cov[1][4] << " " << cov[1][5] << " " << cov[1][6] << std::endl; - std::cout << " Cov(2,j) : " << cov[2][0] << " " << cov[2][1] << " " << cov[2][2] << " " << cov[2][3] << " " - << cov[2][4] << " " << cov[2][5] << " " << cov[2][6] << std::endl; - std::cout << " Cov(3,j) : " << cov[3][0] << " " << cov[3][1] << " " << cov[3][2] << " " << cov[3][3] << " " - << cov[3][4] << " " << cov[3][5] << " " << cov[3][6] << std::endl; - std::cout << " Cov(4,j) : " << cov[4][0] << " " << cov[4][1] << " " << cov[4][2] << " " << cov[4][3] << " " - << cov[4][4] << " " << cov[4][5] << " " << cov[4][6] << std::endl; - std::cout << " Cov(5,j) : " << cov[5][0] << " " << cov[5][1] << " " << cov[5][2] << " " << cov[5][3] << " " - << cov[5][4] << " " << cov[5][5] << " " << cov[5][6] << std::endl; - std::cout << " Cov(6,j) : " << cov[6][0] << " " << cov[6][1] << " " << cov[6][2] << " " << cov[6][3] << " " - << cov[6][4] << " " << cov[6][5] << " " << cov[6][6] << std::endl; - std::cout << " emittanceX : " << emittanceX << std::endl; - std::cout << " emittanceY : " << emittanceY << std::endl; - std::cout << " betastar : " << betastar << std::endl; - std::cout << "-----------------------------------------------------" << std::endl; - - BeamSpotOnlineObjects* abeam = new BeamSpotOnlineObjects(); - - abeam->SetLastAnalyzedLumi(lastAnalyzedLumi); - abeam->SetLastAnalyzedRun(lastAnalyzedRun); - abeam->SetLastAnalyzedFill(lastAnalyzedFill); - abeam->SetType(type); - abeam->SetPosition(x, y, z); - abeam->SetSigmaZ(sigmaZ); - abeam->Setdxdz(dxdz); - abeam->Setdydz(dydz); - abeam->SetBeamWidthX(beamWidthX); - abeam->SetBeamWidthY(beamWidthY); - abeam->SetEmittanceX(emittanceX); - abeam->SetEmittanceY(emittanceY); - abeam->SetBetaStar(betastar); - - for (int i = 0; i < 7; ++i) { - for (int j = 0; j < 7; ++j) { - abeam->SetCovariance(i, j, cov[i][j]); - } - } - - std::cout << " Writing results to DB..." << std::endl; - - edm::Service poolDbService; - if (poolDbService.isAvailable()) { - std::cout << "poolDBService available" << std::endl; - if (poolDbService->isNewTagRequest("BeamSpotOnlineLegacyObjectsRcd")) { - std::cout << "new tag requested" << std::endl; - if (fuseNewSince) { - std::cout << "Using a new Since: " << fnewSince << std::endl; - poolDbService->createNewIOV( - abeam, fnewSince, poolDbService->endOfTime(), "BeamSpotOnlineLegacyObjectsRcd"); - } else - poolDbService->createNewIOV( - abeam, poolDbService->beginOfTime(), poolDbService->endOfTime(), "BeamSpotOnlineLegacyObjectsRcd"); - } else { - std::cout << "no new tag requested" << std::endl; - if (fuseNewSince) { - std::cout << "Using a new Since: " << fnewSince << std::endl; - poolDbService->appendSinceTime(abeam, fnewSince, "BeamSpotOnlineLegacyObjectsRcd"); - } else - poolDbService->appendSinceTime( - abeam, poolDbService->currentTime(), "BeamSpotOnlineLegacyObjectsRcd"); - } - } - - std::cout << "[BeamSpotOnlineLegacyRcdWriter] endJob done \n" << std::endl; -} - -// ------------ method fills 'descriptions' with the allowed parameters for the module ------------ -void BeamSpotOnlineLegacyRcdWriter::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { - //The following says we do not know what parameters are allowed so do no validation - // Please change this to state exactly what you do use, even if it is no parameters - edm::ParameterSetDescription desc; - desc.setUnknown(); - descriptions.addDefault(desc); -} - -//define this as a plug-in -DEFINE_FWK_MODULE(BeamSpotOnlineLegacyRcdWriter); diff --git a/CondTools/BeamSpot/plugins/BeamSpotOnlineLegacyRcdReader.cc b/CondTools/BeamSpot/plugins/BeamSpotOnlineRecordsReader.cc similarity index 54% rename from CondTools/BeamSpot/plugins/BeamSpotOnlineLegacyRcdReader.cc rename to CondTools/BeamSpot/plugins/BeamSpotOnlineRecordsReader.cc index 20ffefbc6eb2c..a00285f182341 100644 --- a/CondTools/BeamSpot/plugins/BeamSpotOnlineLegacyRcdReader.cc +++ b/CondTools/BeamSpot/plugins/BeamSpotOnlineRecordsReader.cc @@ -1,11 +1,11 @@ // -*- C++ -*- // // Package: CondTools/BeamSpot -// Class: BeamSpotOnlineLegacyRcdReader +// Class: BeamSpotOnlineRecordsReader // -/**\class BeamSpotOnlineLegacyRcdReader BeamSpotOnlineLegacyRcdReader.cc CondTools/BeamSpot/plugins/BeamSpotOnlineLegacyRcdReader.cc +/**\class BeamSpotOnlineRecordsReader BeamSpotOnlineRecordsReader.cc CondTools/BeamSpot/plugins/BeamSpotOnlineRecordsReader.cc - Description: EDAnalyzer to create a BeamSpotOnlineLegacyObjectsRcd payload from a txt file and dump it in a db file + Description: EDAnalyzer to read the BeamSpotOnlineHLTObjectsRcd or BeamSpotOnlineLegacyObjectsRcd and dump it into a txt and root file Implementation: [Notes on implementation] @@ -35,6 +35,7 @@ #include "FWCore/Framework/interface/ESWatcher.h" #include "CondFormats/DataRecord/interface/BeamSpotOnlineLegacyObjectsRcd.h" +#include "CondFormats/DataRecord/interface/BeamSpotOnlineHLTObjectsRcd.h" #include "CondFormats/BeamSpotObjects/interface/BeamSpotOnlineObjects.h" // For ROOT @@ -46,17 +47,18 @@ // class declaration // -class BeamSpotOnlineLegacyRcdReader : public edm::one::EDAnalyzer { +class BeamSpotOnlineRecordsReader : public edm::one::EDAnalyzer { public: - explicit BeamSpotOnlineLegacyRcdReader(const edm::ParameterSet&); - ~BeamSpotOnlineLegacyRcdReader() override; + explicit BeamSpotOnlineRecordsReader(const edm::ParameterSet&); + ~BeamSpotOnlineRecordsReader() override; static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); private: void beginJob() override; void analyze(const edm::Event&, const edm::EventSetup&) override; - void endJob() override; + template + void dump(const edm::Event&, const edm::EventSetup&, const edm::ESGetToken&); struct theBSOfromDB { int ls; @@ -77,20 +79,27 @@ class BeamSpotOnlineLegacyRcdReader : public edm::one::EDAnalyzer tFileService; TTree* bstree_; + const edm::ESGetToken hltToken; + const edm::ESGetToken legacyToken; + // ----------member data --------------------------- - edm::ESWatcher watcher_; + bool isHLT_; + edm::ESWatcher hlt_watcher_; + edm::ESWatcher legacy_watcher_; std::unique_ptr output_; }; // // constructors and destructor // -BeamSpotOnlineLegacyRcdReader::BeamSpotOnlineLegacyRcdReader(const edm::ParameterSet& iConfig) : bstree_(nullptr) { +BeamSpotOnlineRecordsReader::BeamSpotOnlineRecordsReader(const edm::ParameterSet& iConfig) + : bstree_(nullptr), hltToken(esConsumes()), legacyToken(esConsumes()) { //now do what ever initialization is needed + isHLT_ = iConfig.getParameter("isHLT"); usesResource("TFileService"); std::string fileName(iConfig.getUntrackedParameter("rawFileName")); if (!fileName.empty()) { - output_.reset(new std::ofstream(fileName.c_str())); + output_ = std::make_unique(fileName.c_str()); if (!output_->good()) { edm::LogError("IOproblem") << "Could not open output file " << fileName << "."; output_.reset(); @@ -98,16 +107,13 @@ BeamSpotOnlineLegacyRcdReader::BeamSpotOnlineLegacyRcdReader(const edm::Paramete } } -BeamSpotOnlineLegacyRcdReader::~BeamSpotOnlineLegacyRcdReader() { - // do anything here that needs to be done at desctruction time - // (e.g. close files, deallocate resources etc.) -} +BeamSpotOnlineRecordsReader::~BeamSpotOnlineRecordsReader() = default; // // member functions // -void BeamSpotOnlineLegacyRcdReader::theBSOfromDB::init() { +void BeamSpotOnlineRecordsReader::theBSOfromDB::init() { float dummy_float = -999.0; int dummy_int = -999; @@ -126,49 +132,59 @@ void BeamSpotOnlineLegacyRcdReader::theBSOfromDB::init() { } // ------------ method called for each event ------------ -void BeamSpotOnlineLegacyRcdReader::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { +void BeamSpotOnlineRecordsReader::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { using namespace edm; - std::ostringstream output; + if (isHLT_) { + if (hlt_watcher_.check(iSetup)) { + dump(iEvent, iSetup, hltToken); + } // check for new IOV for this run / LS + } else { + if (legacy_watcher_.check(iSetup)) { + dump(iEvent, iSetup, legacyToken); + } // check for new IOV for this run / LS + } +} + +template +void BeamSpotOnlineRecordsReader::dump(const edm::Event& iEvent, + const edm::EventSetup& iSetup, + const edm::ESGetToken& token) { + std::ostringstream output; // initialize the ntuple theBSOfromDB_.init(); + output << " for runs: " << iEvent.id().run() << " - " << iEvent.id().luminosityBlock() << std::endl; - if (watcher_.check(iSetup)) { // check for new IOV for this run / LS - - output << " for runs: " << iEvent.id().run() << " - " << iEvent.id().luminosityBlock() << std::endl; - - // Get BeamSpot from EventSetup: - edm::ESHandle beamhandle; - iSetup.get().get(beamhandle); - const BeamSpotOnlineObjects* mybeamspot = beamhandle.product(); + // Get BeamSpot from EventSetup: + const BeamSpotOnlineObjects* mybeamspot = &iSetup.getData(token); - theBSOfromDB_.run = iEvent.id().run(); - theBSOfromDB_.ls = iEvent.id().luminosityBlock(); - theBSOfromDB_.BSx0_ = mybeamspot->GetX(); - theBSOfromDB_.BSy0_ = mybeamspot->GetY(); - theBSOfromDB_.BSz0_ = mybeamspot->GetZ(); - theBSOfromDB_.Beamsigmaz_ = mybeamspot->GetSigmaZ(); - theBSOfromDB_.Beamdxdz_ = mybeamspot->Getdxdz(); - theBSOfromDB_.BeamWidthX_ = mybeamspot->GetBeamWidthX(); - theBSOfromDB_.BeamWidthY_ = mybeamspot->GetBeamWidthY(); - theBSOfromDB_.lastAnalyzedLumi_ = mybeamspot->GetLastAnalyzedLumi(); - theBSOfromDB_.lastAnalyzedRun_ = mybeamspot->GetLastAnalyzedRun(); - theBSOfromDB_.lastAnalyzedFill_ = mybeamspot->GetLastAnalyzedFill(); + theBSOfromDB_.run = iEvent.id().run(); + theBSOfromDB_.ls = iEvent.id().luminosityBlock(); + theBSOfromDB_.BSx0_ = mybeamspot->GetX(); + theBSOfromDB_.BSy0_ = mybeamspot->GetY(); + theBSOfromDB_.BSz0_ = mybeamspot->GetZ(); + theBSOfromDB_.Beamsigmaz_ = mybeamspot->GetSigmaZ(); + theBSOfromDB_.Beamdxdz_ = mybeamspot->Getdxdz(); + theBSOfromDB_.BeamWidthX_ = mybeamspot->GetBeamWidthX(); + theBSOfromDB_.BeamWidthY_ = mybeamspot->GetBeamWidthY(); + theBSOfromDB_.lastAnalyzedLumi_ = mybeamspot->GetLastAnalyzedLumi(); + theBSOfromDB_.lastAnalyzedRun_ = mybeamspot->GetLastAnalyzedRun(); + theBSOfromDB_.lastAnalyzedFill_ = mybeamspot->GetLastAnalyzedFill(); - bstree_->Fill(); + bstree_->Fill(); - output << *mybeamspot << std::endl; - } + output << *mybeamspot << std::endl; // Final output - either message logger or output file: - if (output_.get()) + if (output_.get()) { *output_ << output.str(); - else - edm::LogInfo("") << output.str(); + } else { + edm::LogInfo("BeamSpotOnlineRecordsReader") << output.str(); + } } // ------------ method called once each job just before starting event loop ------------ -void BeamSpotOnlineLegacyRcdReader::beginJob() { +void BeamSpotOnlineRecordsReader::beginJob() { bstree_ = tFileService->make("BSONtuple", "BeamSpotOnline analyzer ntuple"); //Tree Branches @@ -186,17 +202,13 @@ void BeamSpotOnlineLegacyRcdReader::beginJob() { bstree_->Branch("LastAnalyzedFill", &theBSOfromDB_.lastAnalyzedFill_, "LastAnalyzedFill/I"); } -// ------------ method called once each job just after ending the event loop ------------ -void BeamSpotOnlineLegacyRcdReader::endJob() {} - // ------------ method fills 'descriptions' with the allowed parameters for the module ------------ -void BeamSpotOnlineLegacyRcdReader::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { - //The following says we do not know what parameters are allowed so do no validation - // Please change this to state exactly what you do use, even if it is no parameters +void BeamSpotOnlineRecordsReader::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { edm::ParameterSetDescription desc; - desc.setUnknown(); + desc.add("isHLT", true); + desc.addUntracked("rawFileName", ""); descriptions.addDefault(desc); } //define this as a plug-in -DEFINE_FWK_MODULE(BeamSpotOnlineLegacyRcdReader); +DEFINE_FWK_MODULE(BeamSpotOnlineRecordsReader); diff --git a/CondTools/BeamSpot/plugins/BeamSpotOnlineRecordsWriter.cc b/CondTools/BeamSpot/plugins/BeamSpotOnlineRecordsWriter.cc new file mode 100644 index 0000000000000..fc1ce7ae22792 --- /dev/null +++ b/CondTools/BeamSpot/plugins/BeamSpotOnlineRecordsWriter.cc @@ -0,0 +1,237 @@ +// -*- C++ -*- +// +// Package: CondTools/BeamSpot +// Class: BeamSpotOnlineRecordsWriter +// +/**\class BeamSpotOnlineRecordsWriter BeamSpotOnlineRecordsWriter.cc CondTools/BeamSpot/plugins/BeamSpotOnlineRecordsWriter.cc + + Description: EDAnalyzer to create a BeamSpotOnlineHLTObjectsRcd or BeamSpotOnlineLegacyObjectsRcd payload from a txt file and dump it in a db file + + Implementation: + [Notes on implementation] +*/ +// +// Original Author: Francesco Brivio +// Created: Tue, 11 Feb 2020 11:10:12 GMT +// +// + +// system include files +#include +#include +#include +#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/MakerMacros.h" + +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/Utilities/interface/InputTag.h" +#include "FWCore/ServiceRegistry/interface/Service.h" + +#include "CondFormats/DataRecord/interface/BeamSpotOnlineLegacyObjectsRcd.h" +#include "CondFormats/DataRecord/interface/BeamSpotOnlineHLTObjectsRcd.h" +#include "CondFormats/BeamSpotObjects/interface/BeamSpotOnlineObjects.h" +#include "CondCore/DBOutputService/interface/PoolDBOutputService.h" + +// +// class declaration +// + +class BeamSpotOnlineRecordsWriter : public edm::one::EDAnalyzer<> { +public: + explicit BeamSpotOnlineRecordsWriter(const edm::ParameterSet&); + ~BeamSpotOnlineRecordsWriter() override; + + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + cond::Time_t pack(uint32_t, uint32_t); + +private: + void analyze(const edm::Event&, const edm::EventSetup&) override; + void endJob() override; + + // ----------member data --------------------------- + bool fIsHLT; + std::ifstream fasciiFile; + std::string fasciiFileName; + uint32_t fIOVStartRun; + uint32_t fIOVStartLumi; + cond::Time_t fnewSince; + bool fuseNewSince; +}; + +// +// constructors and destructor +// +BeamSpotOnlineRecordsWriter::BeamSpotOnlineRecordsWriter(const edm::ParameterSet& iConfig) { + //now do what ever initialization is needed + fIsHLT = iConfig.getParameter("isHLT"); + fasciiFileName = iConfig.getUntrackedParameter("InputFileName"); + fasciiFile.open(fasciiFileName.c_str()); + if (iConfig.exists("IOVStartRun") && iConfig.exists("IOVStartLumi")) { + fIOVStartRun = iConfig.getUntrackedParameter("IOVStartRun"); + fIOVStartLumi = iConfig.getUntrackedParameter("IOVStartLumi"); + fnewSince = BeamSpotOnlineRecordsWriter::pack(fIOVStartRun, fIOVStartLumi); + fuseNewSince = true; + edm::LogPrint("BeamSpotOnlineRecordsWriter") << "useNewSince = True"; + } else { + fuseNewSince = false; + edm::LogPrint("BeamSpotOnlineRecordsWriter") << "useNewSince = False"; + } +} + +BeamSpotOnlineRecordsWriter::~BeamSpotOnlineRecordsWriter() = default; + +// +// member functions +// + +// ------------ Create a since object (cond::Time_t) by packing Run and LS (both uint32_t) ------------ +cond::Time_t BeamSpotOnlineRecordsWriter::pack(uint32_t fIOVStartRun, uint32_t fIOVStartLumi) { + return ((uint64_t)fIOVStartRun << 32 | fIOVStartLumi); +} + +// ------------ method called for each event ------------ +void BeamSpotOnlineRecordsWriter::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) {} + +// ------------ method called once each job just after ending the event loop ------------ +void BeamSpotOnlineRecordsWriter::endJob() { + const std::string fLabel = (fIsHLT) ? "BeamSpotOnlineHLTObjectsRcd" : "BeamSpotOnlineLegacyObjectsRcd"; + edm::LogInfo("BeamSpotOnlineRecordsWriter") + << "Reading " << fLabel << " data from text file: " << fasciiFileName << std::endl; + + // extract from file + double x, y, z, sigmaZ, dxdz, dydz, beamWidthX, beamWidthY, emittanceX, emittanceY, betastar; + double cov[7][7]; + int type, lastAnalyzedLumi, firstAnalyzedLumi, lastAnalyzedRun, lastAnalyzedFill; + std::string tag; + + fasciiFile >> tag >> lastAnalyzedRun; + fasciiFile >> tag >> tag >> tag >> tag >> tag; // BeginTimeOfFit parsing (not used in payload) + fasciiFile >> tag >> tag >> tag >> tag >> tag; // EndTimeOfFit parsing (not used in payload) + fasciiFile >> tag >> firstAnalyzedLumi; + fasciiFile >> tag >> lastAnalyzedLumi; + fasciiFile >> tag >> type; + fasciiFile >> tag >> x; + fasciiFile >> tag >> y; + fasciiFile >> tag >> z; + fasciiFile >> tag >> sigmaZ; + fasciiFile >> tag >> dxdz; + fasciiFile >> tag >> dydz; + fasciiFile >> tag >> beamWidthX; + fasciiFile >> tag >> beamWidthY; + fasciiFile >> tag >> cov[0][0] >> cov[0][1] >> cov[0][2] >> cov[0][3] >> cov[0][4] >> cov[0][5] >> cov[0][6]; + fasciiFile >> tag >> cov[1][0] >> cov[1][1] >> cov[1][2] >> cov[1][3] >> cov[1][4] >> cov[1][5] >> cov[1][6]; + fasciiFile >> tag >> cov[2][0] >> cov[2][1] >> cov[2][2] >> cov[2][3] >> cov[2][4] >> cov[2][5] >> cov[2][6]; + fasciiFile >> tag >> cov[3][0] >> cov[3][1] >> cov[3][2] >> cov[3][3] >> cov[3][4] >> cov[3][5] >> cov[3][6]; + fasciiFile >> tag >> cov[4][0] >> cov[4][1] >> cov[4][2] >> cov[4][3] >> cov[4][4] >> cov[4][5] >> cov[4][6]; + fasciiFile >> tag >> cov[5][0] >> cov[5][1] >> cov[5][2] >> cov[5][3] >> cov[5][4] >> cov[5][5] >> cov[5][6]; + fasciiFile >> tag >> cov[6][0] >> cov[6][1] >> cov[6][2] >> cov[6][3] >> cov[6][4] >> cov[6][5] >> cov[6][6]; + fasciiFile >> tag >> emittanceX; + fasciiFile >> tag >> emittanceY; + fasciiFile >> tag >> betastar; + + lastAnalyzedFill = -999; + + edm::LogPrint("BeamSpotOnlineRecordsWriter") << "---- Parsed these parameters from input txt file ----"; + edm::LogPrint("BeamSpotOnlineRecordsWriter") << " lastAnalyzedRun : " << lastAnalyzedRun; + edm::LogPrint("BeamSpotOnlineRecordsWriter") << " lastAnalyzedFill : " << lastAnalyzedFill; + edm::LogPrint("BeamSpotOnlineRecordsWriter") << " firstAnalyzedLumi : " << firstAnalyzedLumi; + edm::LogPrint("BeamSpotOnlineRecordsWriter") << " lastAnalyzedLumi : " << lastAnalyzedLumi; + edm::LogPrint("BeamSpotOnlineRecordsWriter") << " type : " << type; + edm::LogPrint("BeamSpotOnlineRecordsWriter") << " x : " << x; + edm::LogPrint("BeamSpotOnlineRecordsWriter") << " y : " << y; + edm::LogPrint("BeamSpotOnlineRecordsWriter") << " z : " << z; + edm::LogPrint("BeamSpotOnlineRecordsWriter") << " sigmaZ : " << sigmaZ; + edm::LogPrint("BeamSpotOnlineRecordsWriter") << " dxdz : " << dxdz; + edm::LogPrint("BeamSpotOnlineRecordsWriter") << " dydz : " << dydz; + edm::LogPrint("BeamSpotOnlineRecordsWriter") << " beamWidthX : " << beamWidthX; + edm::LogPrint("BeamSpotOnlineRecordsWriter") << " beamWidthY : " << beamWidthY; + edm::LogPrint("BeamSpotOnlineRecordsWriter") + << " Cov(0,j) : " << cov[0][0] << " " << cov[0][1] << " " << cov[0][2] << " " << cov[0][3] << " " + << cov[0][4] << " " << cov[0][5] << " " << cov[0][6]; + edm::LogPrint("BeamSpotOnlineRecordsWriter") + << " Cov(1,j) : " << cov[1][0] << " " << cov[1][1] << " " << cov[1][2] << " " << cov[1][3] << " " + << cov[1][4] << " " << cov[1][5] << " " << cov[1][6]; + edm::LogPrint("BeamSpotOnlineRecordsWriter") + << " Cov(2,j) : " << cov[2][0] << " " << cov[2][1] << " " << cov[2][2] << " " << cov[2][3] << " " + << cov[2][4] << " " << cov[2][5] << " " << cov[2][6]; + edm::LogPrint("BeamSpotOnlineRecordsWriter") + << " Cov(3,j) : " << cov[3][0] << " " << cov[3][1] << " " << cov[3][2] << " " << cov[3][3] << " " + << cov[3][4] << " " << cov[3][5] << " " << cov[3][6]; + edm::LogPrint("BeamSpotOnlineRecordsWriter") + << " Cov(4,j) : " << cov[4][0] << " " << cov[4][1] << " " << cov[4][2] << " " << cov[4][3] << " " + << cov[4][4] << " " << cov[4][5] << " " << cov[4][6]; + edm::LogPrint("BeamSpotOnlineRecordsWriter") + << " Cov(5,j) : " << cov[5][0] << " " << cov[5][1] << " " << cov[5][2] << " " << cov[5][3] << " " + << cov[5][4] << " " << cov[5][5] << " " << cov[5][6]; + edm::LogPrint("BeamSpotOnlineRecordsWriter") + << " Cov(6,j) : " << cov[6][0] << " " << cov[6][1] << " " << cov[6][2] << " " << cov[6][3] << " " + << cov[6][4] << " " << cov[6][5] << " " << cov[6][6]; + edm::LogPrint("BeamSpotOnlineRecordsWriter") << " emittanceX : " << emittanceX; + edm::LogPrint("BeamSpotOnlineRecordsWriter") << " emittanceY : " << emittanceY; + edm::LogPrint("BeamSpotOnlineRecordsWriter") << " betastar : " << betastar; + edm::LogPrint("BeamSpotOnlineRecordsWriter") << "-----------------------------------------------------"; + + std::unique_ptr abeam = std::make_unique(); + + abeam->SetLastAnalyzedLumi(lastAnalyzedLumi); + abeam->SetLastAnalyzedRun(lastAnalyzedRun); + abeam->SetLastAnalyzedFill(lastAnalyzedFill); + abeam->SetType(type); + abeam->SetPosition(x, y, z); + abeam->SetSigmaZ(sigmaZ); + abeam->Setdxdz(dxdz); + abeam->Setdydz(dydz); + abeam->SetBeamWidthX(beamWidthX); + abeam->SetBeamWidthY(beamWidthY); + abeam->SetEmittanceX(emittanceX); + abeam->SetEmittanceY(emittanceY); + abeam->SetBetaStar(betastar); + + for (int i = 0; i < 7; ++i) { + for (int j = 0; j < 7; ++j) { + abeam->SetCovariance(i, j, cov[i][j]); + } + } + + edm::LogPrint("BeamSpotOnlineRecordsWriter") << " Writing results to DB..."; + + edm::Service poolDbService; + if (poolDbService.isAvailable()) { + edm::LogPrint("BeamSpotOnlineRecordsWriter") << "poolDBService available"; + if (poolDbService->isNewTagRequest(fLabel)) { + edm::LogPrint("BeamSpotOnlineRecordsWriter") << "new tag requested"; + if (fuseNewSince) { + edm::LogPrint("BeamSpotOnlineRecordsWriter") << "Using a new Since: " << fnewSince; + poolDbService->createNewIOV(abeam.get(), fnewSince, poolDbService->endOfTime(), fLabel); + } else + poolDbService->createNewIOV( + abeam.get(), poolDbService->beginOfTime(), poolDbService->endOfTime(), fLabel); + } else { + edm::LogPrint("BeamSpotOnlineRecordsWriter") << "no new tag requested"; + if (fuseNewSince) { + edm::LogPrint("BeamSpotOnlineRecordsWriter") << "Using a new Since: " << fnewSince; + poolDbService->appendSinceTime(abeam.get(), fnewSince, fLabel); + } else + poolDbService->appendSinceTime(abeam.get(), poolDbService->currentTime(), fLabel); + } + } + edm::LogPrint("BeamSpotOnlineRecordsWriter") << "[BeamSpotOnlineRecordsWriter] endJob done \n"; +} + +// ------------ method fills 'descriptions' with the allowed parameters for the module ------------ +void BeamSpotOnlineRecordsWriter::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + desc.add("isHLT", true); + desc.addUntracked("InputFileName", ""); + desc.addOptionalUntracked("IOVStartRun", 1); + desc.addOptionalUntracked("IOVStartLumi", 1); + descriptions.addWithDefaultLabel(desc); +} + +//define this as a plug-in +DEFINE_FWK_MODULE(BeamSpotOnlineRecordsWriter); diff --git a/CondTools/BeamSpot/plugins/BeamSpotRcdReader.cc b/CondTools/BeamSpot/plugins/BeamSpotRcdReader.cc index e1f14bdf07092..84fbbaa9c36f7 100644 --- a/CondTools/BeamSpot/plugins/BeamSpotRcdReader.cc +++ b/CondTools/BeamSpot/plugins/BeamSpotRcdReader.cc @@ -55,7 +55,6 @@ class BeamSpotRcdReader : public edm::one::EDAnalyzer private: void beginJob() override; void analyze(const edm::Event&, const edm::EventSetup&) override; - void endJob() override; struct theBSfromDB { int run; @@ -70,6 +69,7 @@ class BeamSpotRcdReader : public edm::one::EDAnalyzer void init(); } theBSfromDB_; + const edm::ESGetToken beamSpotToken_; edm::Service tFileService; TTree* bstree_; @@ -78,23 +78,16 @@ class BeamSpotRcdReader : public edm::one::EDAnalyzer std::unique_ptr output_; }; -// -// constants, enums and typedefs -// - -// -// static data member definitions -// - // // constructors and destructor // -BeamSpotRcdReader::BeamSpotRcdReader(const edm::ParameterSet& iConfig) : bstree_(nullptr) { +BeamSpotRcdReader::BeamSpotRcdReader(const edm::ParameterSet& iConfig) + : beamSpotToken_(esConsumes()), bstree_(nullptr) { //now do what ever initialization is needed usesResource("TFileService"); std::string fileName(iConfig.getUntrackedParameter("rawFileName")); if (!fileName.empty()) { - output_.reset(new std::ofstream(fileName.c_str())); + output_ = std::make_unique(fileName.c_str()); if (!output_->good()) { edm::LogError("IOproblem") << "Could not open output file " << fileName << "."; output_.reset(); @@ -102,10 +95,7 @@ BeamSpotRcdReader::BeamSpotRcdReader(const edm::ParameterSet& iConfig) : bstree_ } } -BeamSpotRcdReader::~BeamSpotRcdReader() { - // do anything here that needs to be done at desctruction time - // (e.g. close files, deallocate resources etc.) -} +BeamSpotRcdReader::~BeamSpotRcdReader() = default; // // member functions @@ -139,9 +129,7 @@ void BeamSpotRcdReader::analyze(const edm::Event& iEvent, const edm::EventSetup& output << " for runs: " << iEvent.id().run() << " - " << iEvent.id().luminosityBlock() << std::endl; // Get BeamSpot from EventSetup: - edm::ESHandle beamhandle; - iSetup.get().get(beamhandle); - const BeamSpotObjects* mybeamspot = beamhandle.product(); + const BeamSpotObjects* mybeamspot = &iSetup.getData(beamSpotToken_); theBSfromDB_.run = iEvent.id().run(); theBSfromDB_.ls = iEvent.id().luminosityBlock(); @@ -181,9 +169,6 @@ void BeamSpotRcdReader::beginJob() { bstree_->Branch("BeamWidthY", &theBSfromDB_.BeamWidthY_, "BeamWidthY/F"); } -// ------------ method called once each job just after ending the event loop ------------ -void BeamSpotRcdReader::endJob() {} - // ------------ method fills 'descriptions' with the allowed parameters for the module ------------ void BeamSpotRcdReader::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { //The following says we do not know what parameters are allowed so do no validation diff --git a/CondTools/BeamSpot/plugins/BuildFile.xml b/CondTools/BeamSpot/plugins/BuildFile.xml index 4877c06be98aa..ed4b944cf2472 100644 --- a/CondTools/BeamSpot/plugins/BuildFile.xml +++ b/CondTools/BeamSpot/plugins/BuildFile.xml @@ -6,7 +6,6 @@ - - + diff --git a/CondTools/BeamSpot/test/BeamSpotOnlineHLTRcdReader_cfg.py b/CondTools/BeamSpot/test/BeamSpotOnlineHLTRcdReader_cfg.py deleted file mode 100644 index c11db68926bd5..0000000000000 --- a/CondTools/BeamSpot/test/BeamSpotOnlineHLTRcdReader_cfg.py +++ /dev/null @@ -1,68 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -process = cms.Process("READ") - -process.load("FWCore.MessageService.MessageLogger_cfi") -process.MessageLogger.cerr.FwkReport.reportEvery = 100000 # do not clog output with IO - -process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(10000000) ) # large number of events is needed since we probe 5000LS for run (see below) - -#################################################################### -# Empty source -#################################################################### - -process.source = cms.Source("EmptySource", - firstRun = cms.untracked.uint32(306171), # Run in ../data/BeamFitResults_Run306171.txt - firstLuminosityBlock = cms.untracked.uint32(497), # Lumi in ../data/BeamFitResults_Run306171.txt - numberEventsInLuminosityBlock = cms.untracked.uint32(1), # probe one event per LS - numberEventsInRun = cms.untracked.uint32(5000), # a number of events > the number of LS possible in a real run (5000 s ~ 32 h) - ) - -#################################################################### -# Connect to conditions DB -#################################################################### - -# either from Global Tag -# process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cfi") -# from Configuration.AlCa.GlobalTag import GlobalTag -# process.GlobalTag = GlobalTag(process.GlobalTag,"auto:run2_data") - -# ...or specify database connection and tag: -#from CondCore.CondDB.CondDB_cfi import * -#CondDBBeamSpotObjects = CondDB.clone(connect = cms.string('frontier://FrontierProd/CMS_CONDITIONS')) -#process.dbInput = cms.ESSource("PoolDBESSource", -# CondDBBeamSpotObjects, -# toGet = cms.VPSet(cms.PSet(record = cms.string('BeamSpotOnlineHLTObjectsRcd'), # BeamSpotOnlineHLT record -# tag = cms.string('BSHLT_tag') # choose your favourite tag -# ) -# ) -# ) -# ...or from a local db file -# input database (in this case the local sqlite file) -from CondCore.CondDB.CondDB_cfi import * -CondDBBeamSpotOnlineHLT = CondDB.clone(connect = cms.string("sqlite_file:test.db")) # customize with input db file -process.PoolDBESSource = cms.ESSource("PoolDBESSource", - CondDBBeamSpotOnlineHLT, - DumpStat=cms.untracked.bool(True), - toGet = cms.VPSet(cms.PSet( - record = cms.string('BeamSpotOnlineHLTObjectsRcd'), # BeamSpotOnlineHLT record - tag = cms.string('BSHLT_tag') # choose your favourite tag - )) -) - -#################################################################### -# Load and configure analyzer -#################################################################### -process.beamspotonlinereader = cms.EDAnalyzer("BeamSpotOnlineHLTRcdReader", - rawFileName = cms.untracked.string("test.txt") # choose an output name - ) - -#################################################################### -# Output file -#################################################################### -process.TFileService = cms.Service("TFileService", - fileName=cms.string("test.root") # choose an output name - ) - -# Put module in path: -process.p = cms.Path(process.beamspotonlinereader) diff --git a/CondTools/BeamSpot/test/BeamSpotOnlineHLTRcdWriter_cfg.py b/CondTools/BeamSpot/test/BeamSpotOnlineHLTRcdWriter_cfg.py deleted file mode 100644 index 88782f0deebdf..0000000000000 --- a/CondTools/BeamSpot/test/BeamSpotOnlineHLTRcdWriter_cfg.py +++ /dev/null @@ -1,44 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -process = cms.Process("write2DB") -process.load("FWCore.MessageLogger.MessageLogger_cfi") -from CondCore.CondDB.CondDB_cfi import * - -################################# -# Produce a SQLITE FILE -# -CondDBBeamSpotObjects = CondDB.clone(connect = cms.string('sqlite_file:test.db')) # choose an output name - -################################# -# -# upload conditions to orcon -# -#process.CondDBCommon.connect = "oracle://cms_orcoff_prep/CMS_COND_BEAMSPOT" -#process.load('Configuration/StandardSequences/FrontierConditions_GlobalTag_cff') -#process.GlobalTag.globaltag = 'MC_31X_V2::All' - -################################# - -process.PoolDBOutputService = cms.Service("PoolDBOutputService", - #process.CondDBCommon, - CondDBBeamSpotObjects, - timetype = cms.untracked.string('lumiid'), #('lumiid'), #('runnumber') - toPut = cms.VPSet(cms.PSet( - record = cms.string('BeamSpotOnlineHLTObjectsRcd'), # BeamSpotOnlineHLT record - tag = cms.string('BSHLT_tag') )), # choose your favourite tag - loadBlobStreamer = cms.untracked.bool(False) -) - -process.source = cms.Source("EmptySource") - -process.maxEvents = cms.untracked.PSet( - input = cms.untracked.int32(1) - ) - -process.beamspotonlinewriter = cms.EDAnalyzer("BeamSpotOnlineHLTRcdWriter", - InputFileName = cms.untracked.string('../data/BeamFitResults_Run306171.txt'), # choose your input file - #IOVStartRun = cms.untracked.uint32(306171), # Customize your Run - #IOVStartLumi = cms.untracked.uint32(497), # Customize your Lumi - ) - -process.p = cms.Path(process.beamspotonlinewriter) \ No newline at end of file diff --git a/CondTools/BeamSpot/test/BeamSpotOnlineLegacyRcdWriter_cfg.py b/CondTools/BeamSpot/test/BeamSpotOnlineLegacyRcdWriter_cfg.py deleted file mode 100644 index 25e07e9771feb..0000000000000 --- a/CondTools/BeamSpot/test/BeamSpotOnlineLegacyRcdWriter_cfg.py +++ /dev/null @@ -1,44 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -process = cms.Process("write2DB") -process.load("FWCore.MessageLogger.MessageLogger_cfi") -from CondCore.CondDB.CondDB_cfi import * - -################################# -# Produce a SQLITE FILE -# -CondDBBeamSpotObjects = CondDB.clone(connect = cms.string('sqlite_file:test.db')) # choose an output name - -################################# -# -# upload conditions to orcon -# -#process.CondDBCommon.connect = "oracle://cms_orcoff_prep/CMS_COND_BEAMSPOT" -#process.load('Configuration/StandardSequences/FrontierConditions_GlobalTag_cff') -#process.GlobalTag.globaltag = 'MC_31X_V2::All' - -################################# - -process.PoolDBOutputService = cms.Service("PoolDBOutputService", - #process.CondDBCommon, - CondDBBeamSpotObjects, - timetype = cms.untracked.string('lumiid'), #('lumiid'), #('runnumber') - toPut = cms.VPSet(cms.PSet( - record = cms.string('BeamSpotOnlineLegacyObjectsRcd'), # BeamSpotOnlineLegacy record - tag = cms.string('BSLegacy_tag') )), # choose your favourite tag - loadBlobStreamer = cms.untracked.bool(False) -) - -process.source = cms.Source("EmptySource") - -process.maxEvents = cms.untracked.PSet( - input = cms.untracked.int32(1) - ) - -process.beamspotonlinewriter = cms.EDAnalyzer("BeamSpotOnlineLegacyRcdWriter", - InputFileName = cms.untracked.string('../data/BeamFitResults_Run306171.txt'), # choose your input file - #IOVStartRun = cms.untracked.uint32(306171), # Customize your Run - #IOVStartLumi = cms.untracked.uint32(497), # Customize your Lumi - ) - -process.p = cms.Path(process.beamspotonlinewriter) \ No newline at end of file diff --git a/CondTools/BeamSpot/test/BeamSpotOnlineLegacyRcdReader_cfg.py b/CondTools/BeamSpot/test/BeamSpotOnlineRecordsReader_cfg.py similarity index 51% rename from CondTools/BeamSpot/test/BeamSpotOnlineLegacyRcdReader_cfg.py rename to CondTools/BeamSpot/test/BeamSpotOnlineRecordsReader_cfg.py index 096d7322de93f..85dfa50a14aa9 100644 --- a/CondTools/BeamSpot/test/BeamSpotOnlineLegacyRcdReader_cfg.py +++ b/CondTools/BeamSpot/test/BeamSpotOnlineRecordsReader_cfg.py @@ -1,19 +1,48 @@ import FWCore.ParameterSet.Config as cms +import FWCore.ParameterSet.VarParsing as VarParsing process = cms.Process("READ") +options = VarParsing.VarParsing() +options.register('unitTest', + False, # default value + VarParsing.VarParsing.multiplicity.singleton, # singleton or list + VarParsing.VarParsing.varType.bool, # string, int, or float + "are we running the unit test?") +options.register('inputTag', + "myTagName", # default value + VarParsing.VarParsing.multiplicity.singleton, # singleton or list + VarParsing.VarParsing.varType.string, # string, int, or float + "output tag name") +options.register('inputRecord', + "BeamSpotOnlineLegacyObjectsRcd", # default value + VarParsing.VarParsing.multiplicity.singleton, # singleton or list + VarParsing.VarParsing.varType.string, # string, int, or float + "type of record") +options.register('startRun', + 306171, # default value + VarParsing.VarParsing.multiplicity.singleton, # singleton or list + VarParsing.VarParsing.varType.int, # string, int, or float + "location of the input data") +options.register('startLumi', + 497, # default value + VarParsing.VarParsing.multiplicity.singleton, # singleton or list + VarParsing.VarParsing.varType.int, # string, int, or float + "IOV Start Lumi") +options.parseArguments() + process.load("FWCore.MessageService.MessageLogger_cfi") process.MessageLogger.cerr.FwkReport.reportEvery = 100000 # do not clog output with IO -process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(10000000) ) # large number of events is needed since we probe 5000LS for run (see below) +process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(1 if options.unitTest else 10000000) ) # large number of events is needed since we probe 5000LS for run (see below) #################################################################### # Empty source #################################################################### process.source = cms.Source("EmptySource", - firstRun = cms.untracked.uint32(306171), # Run in ../data/BeamFitResults_Run306171.txt - firstLuminosityBlock = cms.untracked.uint32(497), # Lumi in ../data/BeamFitResults_Run306171.txt + firstRun = cms.untracked.uint32(options.startRun), # Run in ../data/BeamFitResults_Run306171.txt + firstLuminosityBlock = cms.untracked.uint32(options.startLumi), # Lumi in ../data/BeamFitResults_Run306171.txt numberEventsInLuminosityBlock = cms.untracked.uint32(1), # probe one event per LS numberEventsInRun = cms.untracked.uint32(5000), # a number of events > the number of LS possible in a real run (5000 s ~ 32 h) ) @@ -39,24 +68,35 @@ # ) # ...or from a local db file # input database (in this case the local sqlite file) + +if options.unitTest : + if options.inputRecord == "BeamSpotOnlineLegacyObjectsRcd" : + tag_name = 'BSLegacy_tag' + else: + tag_name = 'BSHLT_tag' +else: + tag_name = options.inputTag + from CondCore.CondDB.CondDB_cfi import * -CondDBBeamSpotOnlineLegacy = CondDB.clone(connect = cms.string("sqlite_file:test.db")) # customize with input db file +CondDBBeamSpotOnlineLegacy = CondDB.clone(connect = cms.string("sqlite_file:test_%s.db" % tag_name)) # customize with input db file process.PoolDBESSource = cms.ESSource("PoolDBESSource", CondDBBeamSpotOnlineLegacy, DumpStat=cms.untracked.bool(True), toGet = cms.VPSet(cms.PSet( - record = cms.string('BeamSpotOnlineLegacyObjectsRcd'), # BeamSpotOnlineLegacy record - tag = cms.string('BSLegacy_tag') # choose your favourite tag + record = cms.string(options.inputRecord), # BeamSpotOnline record + tag = cms.string(tag_name) # choose your favourite tag )) ) +print("isForHLT: ",(options.inputRecord == "BeamSpotOnlineHLTObjectsRcd")) #################################################################### # Load and configure analyzer #################################################################### -process.beamspotonlinereader = cms.EDAnalyzer("BeamSpotOnlineLegacyRcdReader", - rawFileName = cms.untracked.string("test.txt") # choose an output name - ) +process.beamspotonlinereader = cms.EDAnalyzer("BeamSpotOnlineRecordsReader", + isHLT = cms.bool((options.inputRecord == "BeamSpotOnlineHLTObjectsRcd")), + rawFileName = cms.untracked.string("test.txt") # choose an output name + ) #################################################################### # Output file diff --git a/CondTools/BeamSpot/test/BeamSpotOnlineRecordsWriter_cfg.py b/CondTools/BeamSpot/test/BeamSpotOnlineRecordsWriter_cfg.py new file mode 100644 index 0000000000000..0c3a528aae176 --- /dev/null +++ b/CondTools/BeamSpot/test/BeamSpotOnlineRecordsWriter_cfg.py @@ -0,0 +1,77 @@ +import FWCore.ParameterSet.Config as cms +import FWCore.ParameterSet.VarParsing as VarParsing + +process = cms.Process("write2DB") + +options = VarParsing.VarParsing() +options.register('unitTest', + False, # default value + VarParsing.VarParsing.multiplicity.singleton, # singleton or list + VarParsing.VarParsing.varType.bool, # string, int, or float + "are we running the unit test?") +options.register('inputFile', + "BeamFitResults_Run306171.txt", # default value + VarParsing.VarParsing.multiplicity.singleton, # singleton or list + VarParsing.VarParsing.varType.string, # string, int, or float + "location of the input data") +options.register('inputTag', + "myTagName", # default value + VarParsing.VarParsing.multiplicity.singleton, # singleton or list + VarParsing.VarParsing.varType.string, # string, int, or float + "output tag name") +options.register('inputRecord', + "BeamSpotOnlineLegacyObjectsRcd", # default value + VarParsing.VarParsing.multiplicity.singleton, # singleton or list + VarParsing.VarParsing.varType.string, # string, int, or float + "type of record") +options.register('startRun', + 306171, # default value + VarParsing.VarParsing.multiplicity.singleton, # singleton or list + VarParsing.VarParsing.varType.int, # string, int, or float + "location of the input data") +options.register('startLumi', + 497, # default value + VarParsing.VarParsing.multiplicity.singleton, # singleton or list + VarParsing.VarParsing.varType.int, # string, int, or float + "IOV Start Lumi") +options.parseArguments() + + +process.load("FWCore.MessageLogger.MessageLogger_cfi") +from CondCore.CondDB.CondDB_cfi import * + +if options.unitTest : + if options.inputRecord == "BeamSpotOnlineLegacyObjectsRcd" : + tag_name = 'BSLegacy_tag' + else: + tag_name = 'BSHLT_tag' +else: + tag_name = options.inputTag + +################################# +# Produce a SQLITE FILE +################################# +CondDBBeamSpotObjects = CondDB.clone(connect = cms.string('sqlite_file:test_%s.db' % tag_name)) # choose an output name +process.PoolDBOutputService = cms.Service("PoolDBOutputService", + CondDBBeamSpotObjects, + timetype = cms.untracked.string('lumiid'), #('lumiid'), #('runnumber') + toPut = cms.VPSet(cms.PSet(record = cms.string(options.inputRecord), # BeamSpotOnline record + tag = cms.string(tag_name))), # choose your favourite tag + loadBlobStreamer = cms.untracked.bool(False) + ) + +process.source = cms.Source("EmptySource") + +process.maxEvents = cms.untracked.PSet(input = cms.untracked.int32(1)) + +process.beamspotonlinewriter = cms.EDAnalyzer("BeamSpotOnlineRecordsWriter", + isHLT = cms.bool((options.inputRecord == "BeamSpotOnlineHLTObjectsRcd")), + InputFileName = cms.untracked.string(options.inputFile), # choose your input file + ) + +if(options.startRun>0 and options.startLumi>0): + process.beamspotonlinewriter.IOVStartRun = cms.untracked.uint32(options.startRun) # Customize your Run + process.beamspotonlinewriter.IOVStartLumi = cms.untracked.uint32(options.startLumi) # Customize your Lumi + + +process.p = cms.Path(process.beamspotonlinewriter) diff --git a/CondTools/BeamSpot/test/BeamSpotRcdPrinter_cfg.py b/CondTools/BeamSpot/test/BeamSpotRcdPrinter_cfg.py index be21dcede1ec1..3610e8a6edfe5 100644 --- a/CondTools/BeamSpot/test/BeamSpotRcdPrinter_cfg.py +++ b/CondTools/BeamSpot/test/BeamSpotRcdPrinter_cfg.py @@ -1,7 +1,25 @@ import FWCore.ParameterSet.Config as cms +import FWCore.ParameterSet.VarParsing as VarParsing import os process = cms.Process("summary") +options = VarParsing.VarParsing() +options.register('inputTag', + "BeamSpotObjects_PCL_byLumi_v0_prompt", # default value + VarParsing.VarParsing.multiplicity.singleton, # singleton or list + VarParsing.VarParsing.varType.string, # string, int, or float + "output tag name") +options.register('startIOV', + 1406713458589700, # default value + VarParsing.VarParsing.multiplicity.singleton, # singleton or list + VarParsing.VarParsing.varType.int, # string, int, or float + "location of the input data") +options.register('endIOV', + 1406876667347162, # default value + VarParsing.VarParsing.multiplicity.singleton, # singleton or list + VarParsing.VarParsing.varType.int, # string, int, or float + "location of the input data") +options.parseArguments() process.MessageLogger = cms.Service( "MessageLogger", debugModules = cms.untracked.vstring( "*" ), @@ -20,11 +38,16 @@ process.load("CondCore.CondDB.CondDB_cfi") process.load("CondTools.BeamSpot.BeamSpotRcdPrinter_cfi") +process.BeamSpotRcdPrinter.tagName = options.inputTag +process.BeamSpotRcdPrinter.startIOV = options.startIOV +process.BeamSpotRcdPrinter.endIOV = options.endIOV +process.BeamSpotRcdPrinter.output = "summary.txt" + ### 2018 Prompt -process.BeamSpotRcdPrinter.tagName = "BeamSpotObjects_PCL_byLumi_v0_prompt" -process.BeamSpotRcdPrinter.startIOV = 1350646955507767 -process.BeamSpotRcdPrinter.endIOV = 1406876667347162 -process.BeamSpotRcdPrinter.output = "summary2018_Prompt.txt" +#process.BeamSpotRcdPrinter.tagName = "BeamSpotObjects_PCL_byLumi_v0_prompt" +#process.BeamSpotRcdPrinter.startIOV = 1350646955507767 +#process.BeamSpotRcdPrinter.endIOV = 1406876667347162 +#process.BeamSpotRcdPrinter.output = "summary2018_Prompt.txt" ### 2017 ReReco #process.BeamSpotRcdPrinter.tagName = "BeamSpotObjects_LumiBased_v4_offline" diff --git a/CondTools/BeamSpot/test/BuildFile.xml b/CondTools/BeamSpot/test/BuildFile.xml new file mode 100644 index 0000000000000..6bb09f88411b9 --- /dev/null +++ b/CondTools/BeamSpot/test/BuildFile.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/CondTools/BeamSpot/test/testReadWriteOnlineBSFromDB.cpp b/CondTools/BeamSpot/test/testReadWriteOnlineBSFromDB.cpp new file mode 100644 index 0000000000000..2f0e0c40064da --- /dev/null +++ b/CondTools/BeamSpot/test/testReadWriteOnlineBSFromDB.cpp @@ -0,0 +1,2 @@ +#include "FWCore/Utilities/interface/TestHelper.h" +RUNTEST() diff --git a/CondTools/BeamSpot/test/testReadWriteOnlineBSFromDB.sh b/CondTools/BeamSpot/test/testReadWriteOnlineBSFromDB.sh new file mode 100755 index 0000000000000..0ae82bd5977e3 --- /dev/null +++ b/CondTools/BeamSpot/test/testReadWriteOnlineBSFromDB.sh @@ -0,0 +1,34 @@ +#!/bin/sh + +function die { echo $1: status $2 ; exit $2; } + +echo "TESTING BeamSpotOnline From DB Read / Write codes ..." + +## clean the input db files +if test -f "test_BSHLT_tag.db"; then + rm -fr test_BSHLT_tag.db +fi + +if test -f "test_BSLegacy_tag.db"; then + rm -fr test_BSLegacy_tag.db +fi + +## copy the input file +cp -pr $CMSSW_BASE/src/CondTools/BeamSpot/data/BeamFitResults_Run306171.txt . + +# test write +printf "TESTING Writing BeamSpotOnlineLegacyObjectsRcd DB object ...\n\n" +cmsRun ${LOCAL_TEST_DIR}/BeamSpotOnlineRecordsWriter_cfg.py unitTest=True inputRecord=BeamSpotOnlineLegacyObjectsRcd || die "Failure writing payload for BeamSpotOnlineLegacyObjectsRcd" $? + +printf "TESTING Writing BeamSpotOnlineHLTObjectsRcd DB object ...\n\n" +cmsRun ${LOCAL_TEST_DIR}/BeamSpotOnlineRecordsWriter_cfg.py unitTest=True inputRecord=BeamSpotOnlineHLTObjectsRcd || die "Failure writing payload for BeamSpotOnlineHLTObjectsRcd" $? +# test read + +printf "TESTING Reading BeamSpotOnlineLegacyObjectsRcd DB object ...\n\n" +cmsRun ${LOCAL_TEST_DIR}/BeamSpotOnlineRecordsReader_cfg.py unitTest=True inputRecord=BeamSpotOnlineLegacyObjectsRcd || die "Failure reading payload for BeamSpotOnlineLegacyObjectsRcd" $? + +printf "TESTING Reading BeamSpotOnlineHLTObjectsRcd DB object ...\n\n" +cmsRun ${LOCAL_TEST_DIR}/BeamSpotOnlineRecordsReader_cfg.py unitTest=True inputRecord=BeamSpotOnlineHLTObjectsRcd || die "Failure reading payload for BeamSpotOnlineHLTObjectsRcd" $? + +echo "TESTING reading BeamSpotObjectRcd DB object ...\n\n" +cmsRun ${LOCAL_TEST_DIR}/BeamSpotRcdPrinter_cfg.py || die "Failure running BeamSpotRcdPrinter" $? diff --git a/CondTools/CTPPS/plugins/RetrieveCTPPSRPAlignmentCorrectionsData.cc b/CondTools/CTPPS/plugins/RetrieveCTPPSRPAlignmentCorrectionsData.cc new file mode 100644 index 0000000000000..d039391e5a9f5 --- /dev/null +++ b/CondTools/CTPPS/plugins/RetrieveCTPPSRPAlignmentCorrectionsData.cc @@ -0,0 +1,43 @@ +/**************************************************************************** +* Author: +* Mateusz Kocot (mateuszkocot99@gmail.com) +****************************************************************************/ + +#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/MakerMacros.h" + +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ServiceRegistry/interface/Service.h" + +#include "CondFormats/PPSObjects/interface/CTPPSRPAlignmentCorrectionsData.h" +#include "CondFormats/DataRecord/interface/CTPPSRPAlignmentCorrectionsDataRcd.h" + +#include + +class RetrieveCTPPSRPAlignmentCorrectionsData : public edm::one::EDAnalyzer<> { +public: + explicit RetrieveCTPPSRPAlignmentCorrectionsData(const edm::ParameterSet &); + +private: + void analyze(const edm::Event &, const edm::EventSetup &) override; + + edm::ESGetToken esToken_; +}; + +RetrieveCTPPSRPAlignmentCorrectionsData::RetrieveCTPPSRPAlignmentCorrectionsData(const edm::ParameterSet &iConfig) + : esToken_(esConsumes()) {} + +void RetrieveCTPPSRPAlignmentCorrectionsData::analyze(const edm::Event &iEvent, const edm::EventSetup &iSetup) { + // get the data + const auto &ctppsRPAlignmentCorrectionsData = iSetup.getData(esToken_); + + edm::LogInfo("PPS") << ctppsRPAlignmentCorrectionsData; +} + +//define this as a plug-in +DEFINE_FWK_MODULE(RetrieveCTPPSRPAlignmentCorrectionsData); diff --git a/CondTools/CTPPS/plugins/RetrievePPSAlignmentConfiguration.cc b/CondTools/CTPPS/plugins/RetrievePPSAlignmentConfiguration.cc new file mode 100644 index 0000000000000..823fe93efbc97 --- /dev/null +++ b/CondTools/CTPPS/plugins/RetrievePPSAlignmentConfiguration.cc @@ -0,0 +1,43 @@ +/**************************************************************************** +* Author: +* Mateusz Kocot (mateuszkocot99@gmail.com) +****************************************************************************/ + +#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/MakerMacros.h" + +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ServiceRegistry/interface/Service.h" + +#include "CondFormats/PPSObjects/interface/PPSAlignmentConfiguration.h" +#include "CondFormats/DataRecord/interface/PPSAlignmentConfigurationRcd.h" + +#include + +class RetrievePPSAlignmentConfiguration : public edm::one::EDAnalyzer<> { +public: + explicit RetrievePPSAlignmentConfiguration(const edm::ParameterSet&); + +private: + void analyze(const edm::Event&, const edm::EventSetup&) override; + + edm::ESGetToken esToken_; +}; + +RetrievePPSAlignmentConfiguration::RetrievePPSAlignmentConfiguration(const edm::ParameterSet& iConfig) + : esToken_(esConsumes()) {} + +void RetrievePPSAlignmentConfiguration::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { + // get the data + const auto& ppsAlignmentConfiguration = iSetup.getData(esToken_); + + edm::LogInfo("PPS") << ppsAlignmentConfiguration; +} + +//define this as a plug-in +DEFINE_FWK_MODULE(RetrievePPSAlignmentConfiguration); diff --git a/CondTools/CTPPS/plugins/RetrievePPSAssociationCuts.cc b/CondTools/CTPPS/plugins/RetrievePPSAssociationCuts.cc new file mode 100644 index 0000000000000..90d3c8f98d526 --- /dev/null +++ b/CondTools/CTPPS/plugins/RetrievePPSAssociationCuts.cc @@ -0,0 +1,42 @@ +/**************************************************************************** +* Author: +* Grzegorz Sroka +****************************************************************************/ + +#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/MakerMacros.h" + +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ServiceRegistry/interface/Service.h" + +#include "CondFormats/PPSObjects/interface/PPSAssociationCuts.h" +#include "CondFormats/DataRecord/interface/PPSAssociationCutsRcd.h" + +#include + +class RetrievePPSAssociationCuts : public edm::one::EDAnalyzer<> { +public: + explicit RetrievePPSAssociationCuts(const edm::ParameterSet &); + +private: + void analyze(const edm::Event &, const edm::EventSetup &) override; + + edm::ESGetToken esToken_; +}; + +RetrievePPSAssociationCuts::RetrievePPSAssociationCuts(const edm::ParameterSet &iConfig) : esToken_(esConsumes()) {} + +void RetrievePPSAssociationCuts::analyze(const edm::Event &iEvent, const edm::EventSetup &iSetup) { + // get the data + const auto &ppsAssociationCuts = iSetup.getData(esToken_); + + edm::LogInfo("PPS") << ppsAssociationCuts; +} + +//define this as a plug-in +DEFINE_FWK_MODULE(RetrievePPSAssociationCuts); \ No newline at end of file diff --git a/CondTools/CTPPS/plugins/WritePPSAlignmentConfiguration.cc b/CondTools/CTPPS/plugins/WritePPSAlignmentConfiguration.cc new file mode 100644 index 0000000000000..387ec812d0bb6 --- /dev/null +++ b/CondTools/CTPPS/plugins/WritePPSAlignmentConfiguration.cc @@ -0,0 +1,51 @@ +/**************************************************************************** +* Author: +* Mateusz Kocot (mateuszkocot99@gmail.com) +****************************************************************************/ + +#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/MakerMacros.h" + +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ServiceRegistry/interface/Service.h" + +#include "CondCore/DBOutputService/interface/PoolDBOutputService.h" + +#include "CondFormats/PPSObjects/interface/PPSAlignmentConfiguration.h" +#include "CondFormats/DataRecord/interface/PPSAlignmentConfigurationRcd.h" + +#include + +class WritePPSAlignmentConfiguration : public edm::one::EDAnalyzer<> { +public: + explicit WritePPSAlignmentConfiguration(const edm::ParameterSet &); + +private: + void analyze(const edm::Event &, const edm::EventSetup &) override; + + edm::ESGetToken esToken_; +}; + +WritePPSAlignmentConfiguration::WritePPSAlignmentConfiguration(const edm::ParameterSet &iConfig) + : esToken_(esConsumes( + edm::ESInputTag("", iConfig.getParameter("label")))) {} + +void WritePPSAlignmentConfiguration::analyze(const edm::Event &iEvent, const edm::EventSetup &iSetup) { + // get the data + const auto &ppsAlignmentConfiguration = iSetup.getData(esToken_); + + // store the data in a DB object + edm::Service poolDbService; + if (poolDbService.isAvailable()) { + poolDbService->writeOne(&ppsAlignmentConfiguration, poolDbService->currentTime(), "PPSAlignmentConfigurationRcd"); + } else { + throw cms::Exception("WritePPSAlignmentConfiguration") << "PoolDBService required."; + } +} + +//define this as a plug-in +DEFINE_FWK_MODULE(WritePPSAlignmentConfiguration); diff --git a/CondTools/CTPPS/plugins/WritePPSAssociationCuts.cc b/CondTools/CTPPS/plugins/WritePPSAssociationCuts.cc new file mode 100644 index 0000000000000..6d2dbe84b2409 --- /dev/null +++ b/CondTools/CTPPS/plugins/WritePPSAssociationCuts.cc @@ -0,0 +1,51 @@ +/**************************************************************************** +* Author: +* Grzegorz Sroka +****************************************************************************/ + +#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/MakerMacros.h" + +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ServiceRegistry/interface/Service.h" + +#include "CondCore/DBOutputService/interface/PoolDBOutputService.h" + +#include "CondFormats/PPSObjects/interface/PPSAssociationCuts.h" +#include "CondFormats/DataRecord/interface/PPSAssociationCutsRcd.h" + +#include + +class WritePPSAssociationCuts : public edm::one::EDAnalyzer<> { +public: + explicit WritePPSAssociationCuts(const edm::ParameterSet &); + +private: + void analyze(const edm::Event &, const edm::EventSetup &) override; + + edm::ESGetToken esToken_; +}; + +WritePPSAssociationCuts::WritePPSAssociationCuts(const edm::ParameterSet &iConfig) + : esToken_(esConsumes( + edm::ESInputTag("", iConfig.getParameter("label")))) {} + +void WritePPSAssociationCuts::analyze(const edm::Event &iEvent, const edm::EventSetup &iSetup) { + // get the data + const auto &ppsAssociationCuts = iSetup.getData(esToken_); + + // store the data in a DB object + edm::Service poolDbService; + if (poolDbService.isAvailable()) { + poolDbService->writeOneIOV(&ppsAssociationCuts, poolDbService->currentTime(), "PPSAssociationCutsRcd"); + } else { + throw cms::Exception("WritePPSAssociationCuts") << "PoolDBService required."; + } +} + +//define this as a plug-in +DEFINE_FWK_MODULE(WritePPSAssociationCuts); diff --git a/CondTools/CTPPS/test/BuildFile.xml b/CondTools/CTPPS/test/BuildFile.xml new file mode 100644 index 0000000000000..2e95cb4d6b8fe --- /dev/null +++ b/CondTools/CTPPS/test/BuildFile.xml @@ -0,0 +1 @@ + diff --git a/CondTools/CTPPS/test/retrieve_PPSAlignmentConfiguration_cfg.py b/CondTools/CTPPS/test/retrieve_PPSAlignmentConfiguration_cfg.py new file mode 100644 index 0000000000000..2a9d3ddc5b1d3 --- /dev/null +++ b/CondTools/CTPPS/test/retrieve_PPSAlignmentConfiguration_cfg.py @@ -0,0 +1,52 @@ +##### configuration ##### +input_conditions = 'sqlite_file:alignment_config.db' # input database +run_number = 1 # used to select the IOV +db_tag = 'PPSAlignmentConfiguration_v1_express' # database tag +######################### + +import FWCore.ParameterSet.Config as cms + +process = cms.Process("retrievePPSAlignmentConfiguration") + +# Message Logger +process.MessageLogger = cms.Service("MessageLogger", + destinations = cms.untracked.vstring('retrieve_PPSAlignmentConfiguration'), + retrieve_PPSAlignmentConfiguration = cms.untracked.PSet( + threshold = cms.untracked.string('INFO') + ) +) + +# Load CondDB service +process.load("CondCore.CondDB.CondDB_cfi") +\ +# input database (in this case the local sqlite file) +process.CondDB.connect = input_conditions + +# A data source must always be defined. We don't need it, so here's a dummy one. +process.source = cms.Source("EmptyIOVSource", + timetype = cms.string('runnumber'), + firstValue = cms.uint64(run_number), + lastValue = cms.uint64(run_number), + interval = cms.uint64(1) +) + +# input service +process.PoolDBESSource = cms.ESSource("PoolDBESSource", + process.CondDB, + DumbStat = cms.untracked.bool(True), + toGet = cms.VPSet(cms.PSet( + record = cms.string('PPSAlignmentConfigurationRcd'), + tag = cms.string(db_tag) + )) +) + +# DB object retrieve module +process.retrieve_config = cms.EDAnalyzer("RetrievePPSAlignmentConfiguration", + toGet = cms.VPSet(cms.PSet( + record = cms.string('PPSAlignmentConfigurationRcd'), + data = cms.vstring('PPSAlignmentConfiguration') + )), + verbose = cms.untracked.bool(True) +) + +process.path = cms.Path(process.retrieve_config) diff --git a/CondTools/CTPPS/test/retrieve_PPSAssociationCuts_cfg.py b/CondTools/CTPPS/test/retrieve_PPSAssociationCuts_cfg.py new file mode 100644 index 0000000000000..29edd0aa0e066 --- /dev/null +++ b/CondTools/CTPPS/test/retrieve_PPSAssociationCuts_cfg.py @@ -0,0 +1,53 @@ +##### configuration ##### +input_conditions = 'sqlite_file:association_config.db' # input database +run_number = 1 # used to select the IOV +db_tag = 'PPSAssociationCuts_test' # database tag +######################### + +import FWCore.ParameterSet.Config as cms + +process = cms.Process("retrievePPSAssociationConfig") + +# Message Logger +process.MessageLogger = cms.Service("MessageLogger", + destinations = cms.untracked.vstring('cout'), + cout = cms.untracked.PSet( + threshold = cms.untracked.string('INFO') + ) + ) + + +# Load CondDB service +process.load("CondCore.CondDB.CondDB_cfi") + +# input database (in this case the local sqlite file) +process.CondDB.connect = input_conditions + +# A data source must always be defined. We don't need it, so here's a dummy one. +process.source = cms.Source("EmptyIOVSource", + timetype = cms.string('runnumber'), + firstValue = cms.uint64(run_number), + lastValue = cms.uint64(run_number), + interval = cms.uint64(1) + ) + +# input service +process.PoolDBESSource = cms.ESSource("PoolDBESSource", + process.CondDB, + DumbStat = cms.untracked.bool(True), + toGet = cms.VPSet(cms.PSet( + record = cms.string('PPSAssociationCutsRcd'), + tag = cms.string(db_tag) + )) + ) + +# DB object retrieve module +process.retrieve_config = cms.EDAnalyzer("RetrievePPSAssociationCuts", + toGet = cms.VPSet(cms.PSet( + record = cms.string('PPSAssociationCutsRcd'), + data = cms.vstring('PPSAssociationCuts') + )), + verbose = cms.untracked.bool(True) + ) + +process.path = cms.Path(process.retrieve_config) diff --git a/CondTools/CTPPS/test/test_CondToolsCTPPS.sh b/CondTools/CTPPS/test/test_CondToolsCTPPS.sh new file mode 100755 index 0000000000000..f7d93515a1a67 --- /dev/null +++ b/CondTools/CTPPS/test/test_CondToolsCTPPS.sh @@ -0,0 +1,5 @@ + #!/bin/bash -ex +TEST_DIR=$CMSSW_BASE/src/CondTools/CTPPS/test +echo "test dir: $TEST_DIR" + +cmsRun ${TEST_DIR}/write_PPSAssociationCuts_cfg.py diff --git a/CondTools/CTPPS/test/write_PPSAlignmentConfiguration_cfg.py b/CondTools/CTPPS/test/write_PPSAlignmentConfiguration_cfg.py new file mode 100644 index 0000000000000..0c5b693ff9cab --- /dev/null +++ b/CondTools/CTPPS/test/write_PPSAlignmentConfiguration_cfg.py @@ -0,0 +1,90 @@ +##### configuration ##### +output_conditions = 'sqlite_file:alignment_config.db' # output database +run_number = 1 # beginning of the IOV +db_tag = 'PPSAlignmentConfiguration_v1_express' # database tag +produce_logs = True # if set to True, a file with logs will be produced. +product_instance_label = 'db_test' # ES product label +# ESSource parameters can be configured below +######################### + +import FWCore.ParameterSet.Config as cms + +process = cms.Process("writePPSAlignmentConfiguration") + +# Message Logger +if produce_logs: + process.MessageLogger = cms.Service("MessageLogger", + destinations = cms.untracked.vstring('write_PPSAlignmentConfiguration', + 'cout' + ), + write_PPSAlignmentConfiguration = cms.untracked.PSet( + threshold = cms.untracked.string('INFO') + ), + cout = cms.untracked.PSet( + threshold = cms.untracked.string('WARNING') + ) + ) +else: + process.MessageLogger = cms.Service("MessageLogger", + destinations = cms.untracked.vstring('cout'), + cout = cms.untracked.PSet( + threshold = cms.untracked.string('WARNING') + ) + ) + +# Load CondDB service +process.load("CondCore.CondDB.CondDB_cfi") + +# output database +process.CondDB.connect = output_conditions + +# A data source must always be defined. We don't need it, so here's a dummy one. +process.source = cms.Source("EmptyIOVSource", + timetype = cms.string('runnumber'), + firstValue = cms.uint64(run_number), + lastValue = cms.uint64(run_number), + interval = cms.uint64(1) +) + +# output service +process.PoolDBOutputService = cms.Service("PoolDBOutputService", + process.CondDB, + timetype = cms.untracked.string('runnumber'), + toPut = cms.VPSet(cms.PSet( + record = cms.string('PPSAlignmentConfigurationRcd'), + tag = cms.string(db_tag) + )) +) + +# ESSource +process.ppsAlignmentConfigurationESSource = cms.ESSource("PPSAlignmentConfigurationESSource", + # PPSAlignmentConfigurationESSource parameters, defaults will be taken from fillDescriptions + label = cms.string(product_instance_label), + sector_45 = cms.PSet( + rp_N = cms.PSet( + name = cms.string('db_test_RP'), + id = cms.int32(44), + y_max_fit_mode = cms.double(66.6) + ) + ), + y_alignment = cms.PSet( + rp_L_F = cms.PSet( + x_min = cms.double(102), + x_max = cms.double(210.0) + ) + ), + extra_params = cms.vdouble( 1.15, 102., 777.7 ) +) + +# DB object maker +process.config_writer = cms.EDAnalyzer("WritePPSAlignmentConfiguration", + record = cms.string('PPSAlignmentConfigurationRcd'), + loggingOn = cms.untracked.bool(True), + SinceAppendMode = cms.bool(True), + Source = cms.PSet( + IOVRun = cms.untracked.uint32(1) + ), + label = cms.string(product_instance_label) +) + +process.path = cms.Path(process.config_writer) diff --git a/CondTools/CTPPS/test/write_PPSAssociationCuts_cfg.py b/CondTools/CTPPS/test/write_PPSAssociationCuts_cfg.py new file mode 100644 index 0000000000000..de4c8ce69b5d7 --- /dev/null +++ b/CondTools/CTPPS/test/write_PPSAssociationCuts_cfg.py @@ -0,0 +1,67 @@ +##### configuration ##### +output_conditions = 'sqlite_file:association_config.db' # output database +run_number = 1 # beginning of the IOV +db_tag = 'PPSAssociationCuts_test' # database tag +product_instance_label = 'db_test_label' # ES product label +######################### + +import FWCore.ParameterSet.Config as cms + +process = cms.Process("writePPSAssociationCuts") + +# Message Logger + +process.MessageLogger = cms.Service("MessageLogger", + destinations = cms.untracked.vstring('cout'), + cout = cms.untracked.PSet( + threshold = cms.untracked.string('INFO') + ) + ) + +# Load CondDB service +process.load("CondCore.CondDB.CondDB_cfi") + +# output database +process.CondDB.connect = output_conditions + +# A data source must always be defined. We don't need it, so here's a dummy one. +process.source = cms.Source("EmptyIOVSource", + timetype = cms.string('runnumber'), + firstValue = cms.uint64(run_number), + lastValue = cms.uint64(run_number), + interval = cms.uint64(1) + ) + +# output service +process.PoolDBOutputService = cms.Service("PoolDBOutputService", + process.CondDB, + timetype = cms.untracked.string('runnumber'), + toPut = cms.VPSet(cms.PSet( + record = cms.string('PPSAssociationCutsRcd'), + tag = cms.string(db_tag) + )) + ) + +# ESSource + +import CalibPPS.ESProducers.ppsAssociationCuts_non_DB_cff as ac +ac.use_single_infinite_iov_entry(ac.ppsAssociationCutsESSource,ac.p2018) + +process.ppsAssociationCutsESSource = ac.ppsAssociationCutsESSource +process.ppsAssociationCutsESSource.appendToDataLabel = cms.string('product_instance_label') + + + + +# DB object maker +process.config_writer = cms.EDAnalyzer("WritePPSAssociationCuts", + record = cms.string('PPSAssociationCutsRcd'), + loggingOn = cms.untracked.bool(True), + SinceAppendMode = cms.bool(True), + Source = cms.PSet( + IOVRun = cms.untracked.uint32(1) + ), + label = cms.string("product_instance_label") + ) + +process.path = cms.Path(process.config_writer) diff --git a/CondTools/DQM/interface/DQMReferenceHistogramRootFileSourceHandler.h b/CondTools/DQM/interface/DQMReferenceHistogramRootFileSourceHandler.h deleted file mode 100644 index 96b21e1874fe0..0000000000000 --- a/CondTools/DQM/interface/DQMReferenceHistogramRootFileSourceHandler.h +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef CondTools_DQM_DQMReferenceHistogramRootFileSourceHandler_h -#define CondTools_DQM_DQMReferenceHistogramRootFileSourceHandler_h - -#include "FWCore/ParameterSet/interface/ParameterSetfwd.h" -#include "CondCore/PopCon/interface/PopConSourceHandler.h" -#include "CondFormats/Common/interface/FileBlob.h" -#include - -namespace popcon { - class DQMReferenceHistogramRootFileSourceHandler : public popcon::PopConSourceHandler { - public: - DQMReferenceHistogramRootFileSourceHandler(const edm::ParameterSet& pset); - ~DQMReferenceHistogramRootFileSourceHandler() override; - void getNewObjects() override; - std::string id() const override; - - private: - std::string m_name; - std::string m_file; - bool m_zip; - //cond::Time_t m_since; - unsigned long long m_since; - bool m_debugMode; - }; -} // namespace popcon - -#endif diff --git a/CondTools/DQM/plugins/BuildFile.xml b/CondTools/DQM/plugins/BuildFile.xml index f545b20152377..17765a01a99e1 100644 --- a/CondTools/DQM/plugins/BuildFile.xml +++ b/CondTools/DQM/plugins/BuildFile.xml @@ -12,19 +12,6 @@ - - - - - - - - - - - - - diff --git a/CondTools/DQM/plugins/DQMReferenceHistogramRootFileEventSetupAnalyzer.cc b/CondTools/DQM/plugins/DQMReferenceHistogramRootFileEventSetupAnalyzer.cc deleted file mode 100644 index 7ec38ab5406f9..0000000000000 --- a/CondTools/DQM/plugins/DQMReferenceHistogramRootFileEventSetupAnalyzer.cc +++ /dev/null @@ -1,98 +0,0 @@ -// C++ common header -#include -#include -#include -#include - -#include "FWCore/Framework/interface/one/EDAnalyzer.h" -#include "FWCore/Framework/interface/Run.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/Framework/interface/MakerMacros.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/Utilities/interface/Exception.h" -#include "FWCore/ServiceRegistry/interface/Service.h" -#include "CondFormats/Common/interface/FileBlob.h" -#include "CondFormats/DataRecord/interface/DQMReferenceHistogramRootFileRcd.h" -#include "DQMServices/Core/interface/DQMStore.h" - -namespace edmtest { - class DQMReferenceHistogramRootFileEventSetupAnalyzer : public edm::one::EDAnalyzer<> { - public: - typedef dqm::legacy::MonitorElement MonitorElement; - typedef dqm::legacy::DQMStore DQMStore; - explicit DQMReferenceHistogramRootFileEventSetupAnalyzer(const edm::ParameterSet& pset); - explicit DQMReferenceHistogramRootFileEventSetupAnalyzer(int i); - ~DQMReferenceHistogramRootFileEventSetupAnalyzer() override; - void analyze(const edm::Event& event, const edm::EventSetup& setup) override; - void beginRun(edm::Run const&, edm::EventSetup const&); - - private: - const edm::ESGetToken fileBlobToken_; - bool init_; - }; - - DQMReferenceHistogramRootFileEventSetupAnalyzer::DQMReferenceHistogramRootFileEventSetupAnalyzer( - const edm::ParameterSet& ps) - : fileBlobToken_(esConsumes()) { - init_ = false; - edm::LogPrint("DQMReferenceHistogramRootFileEventSetupAnalyzer") - << "DQMReferenceHistogramRootFileEventSetupAnalyzer(const edm::ParameterSet &ps)" << std::endl; - } - - DQMReferenceHistogramRootFileEventSetupAnalyzer::DQMReferenceHistogramRootFileEventSetupAnalyzer(int i) - : fileBlobToken_(esConsumes()) { - init_ = false; - edm::LogPrint("DQMReferenceHistogramRootFileEventSetupAnalyzer") - << "DQMReferenceHistogramRootFileEventSetupAnalyzer(int i) " << i << std::endl; - } - - DQMReferenceHistogramRootFileEventSetupAnalyzer::~DQMReferenceHistogramRootFileEventSetupAnalyzer() { - init_ = false; - edm::LogPrint("DQMReferenceHistogramRootFileEventSetupAnalyzer") - << "~DQMReferenceHistogramRootFileEventSetupAnalyzer" << std::endl; - } - - void DQMReferenceHistogramRootFileEventSetupAnalyzer::analyze(const edm::Event& iEvent, - const edm::EventSetup& iSetup) { - return; - } - - void DQMReferenceHistogramRootFileEventSetupAnalyzer::beginRun(edm::Run const& run, edm::EventSetup const& iSetup) { - edm::LogPrint("DQMReferenceHistogramRootFileEventSetupAnalyzer") - << "DQMReferenceHistogramRootFileEventSetupAnalyzer::beginRun()" << std::endl; - if (!init_) { - init_ = true; - edm::eventsetup::EventSetupRecordKey recordKey( - edm::eventsetup::EventSetupRecordKey::TypeTag::findType("DQMReferenceHistogramRootFileRcd")); - if (recordKey.type() == edm::eventsetup::EventSetupRecordKey::TypeTag()) { - throw cms::Exception("Record not found") << "Record \"DQMReferenceHistogramRootFileRcd" - << "\" does not exist!" << std::endl; - } - const auto& rootgeo = &iSetup.getData(fileBlobToken_); - edm::LogPrint("DQMReferenceHistogramRootFileEventSetupAnalyzer") << "ROOT FILE IN MEMORY" << std::endl; - std::unique_ptr > tb((*rootgeo).getUncompressedBlob()); - // char filename[128]; - // sprintf(filename, "mem:%p,%ul", &(*tb)[0], (unsigned long) tb->size()); - // edm::Service()->open(filename, false, "", "Reference"); - - //here you can implement the stream for putting the TFile on disk... - std::string outfile("dqmreference.root"); - std::ofstream output(outfile.c_str()); - output.write((const char*)&(*tb)[0], tb->size()); - output.close(); - - DQMStore* dqm = &*edm::Service(); - dqm->open(outfile, false, "", "Reference"); - remove(outfile.c_str()); - - std::vector mes = dqm->getAllContents(""); - for (std::vector::iterator i = mes.begin(), e = mes.end(); i != e; ++i) - edm::LogPrint("DQMReferenceHistogramRootFileEventSetupAnalyzer") << "ME '" << (*i)->getFullname() << "'\n"; - - edm::LogPrint("DQMReferenceHistogramRootFileEventSetupAnalyzer") << "SIZE FILE = " << tb->size() << std::endl; - } - } - - DEFINE_FWK_MODULE(DQMReferenceHistogramRootFileEventSetupAnalyzer); -} // namespace edmtest diff --git a/CondTools/DQM/plugins/DQMReferenceHistogramRootFilePopConAnalyzer.cc b/CondTools/DQM/plugins/DQMReferenceHistogramRootFilePopConAnalyzer.cc deleted file mode 100644 index 8fc884527ae6e..0000000000000 --- a/CondTools/DQM/plugins/DQMReferenceHistogramRootFilePopConAnalyzer.cc +++ /dev/null @@ -1,8 +0,0 @@ -#include "CondCore/PopCon/interface/PopConAnalyzer.h" -#include "CondTools/DQM/interface/DQMReferenceHistogramRootFileSourceHandler.h" -#include "FWCore/Framework/interface/MakerMacros.h" - -typedef popcon::PopConAnalyzer - DQMReferenceHistogramRootFilePopConAnalyzer; -//define this as a plug-in -DEFINE_FWK_MODULE(DQMReferenceHistogramRootFilePopConAnalyzer); diff --git a/CondTools/DQM/python/DQMReferenceHistogramRootFileEventSetupAnalyzer_OrcoffOnly_cfi.py b/CondTools/DQM/python/DQMReferenceHistogramRootFileEventSetupAnalyzer_OrcoffOnly_cfi.py deleted file mode 100644 index 59c334eb8c13c..0000000000000 --- a/CondTools/DQM/python/DQMReferenceHistogramRootFileEventSetupAnalyzer_OrcoffOnly_cfi.py +++ /dev/null @@ -1,22 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -from DQMServices.Core.DQMStore_cfg import * -from CondCore.CondDB.CondDB_cfi import * -CondDBReference = CondDB.clone(connect = cms.string('oracle://cms_orcoff_prep/CMS_COND_TEMP')) -CondDBReference.DBParameters.messageLevel = cms.untracked.int32(1) #3 for high verbosity - -ReferenceRetrieval = cms.ESSource("PoolDBESSource", - CondDBReference, - toGet = cms.VPSet(cms.PSet(record = cms.string('DQMReferenceHistogramRootFileRcd'), - tag = cms.string('DQM_Cosmics_prompt') - ) - ) - ) - -## RecordDataGetter = cms.EDAnalyzer("EventSetupRecordDataGetter", -## toGet = cms.VPSet(cms.PSet(record = cms.string('DQMReferenceHistogramRootFileRcd'), -## data = cms.vstring('DQM_Cosmics_prompt') -## ) -## ), -## verbose = cms.untracked.bool(False) -## ) diff --git a/CondTools/DQM/python/DQMReferenceHistogramRootFileEventSetupAnalyzer_SQLiteOnly_cfi.py b/CondTools/DQM/python/DQMReferenceHistogramRootFileEventSetupAnalyzer_SQLiteOnly_cfi.py deleted file mode 100644 index c4e5f0fbe1252..0000000000000 --- a/CondTools/DQM/python/DQMReferenceHistogramRootFileEventSetupAnalyzer_SQLiteOnly_cfi.py +++ /dev/null @@ -1,22 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -from DQMServices.Core.DQMStore_cfg import * -from CondCore.CondDB.CondDB_cfi import * -CondDBReference = CondDB.clone(connect = cms.string('sqlite_file:ROOTFILE_Test.db')) -CondDBReference.DBParameters.messageLevel = cms.untracked.int32(1) #3 for high verbosity - -ReferenceRetrieval = cms.ESSource("PoolDBESSource", - CondDBReference, - toGet = cms.VPSet(cms.PSet(record = cms.string('DQMReferenceHistogramRootFileRcd'), - tag = cms.string('ROOTFILE_Test') - ) - ) - ) - -## RecordDataGetter = cms.EDAnalyzer("EventSetupRecordDataGetter", -## toGet = cms.VPSet(cms.PSet(record = cms.string('DQMReferenceHistogramRootFileRcd'), -## data = cms.vstring('DQM_Cosmics_prompt') -## ) -## ), -## verbose = cms.untracked.bool(False) -## ) diff --git a/CondTools/DQM/python/DQMReferenceHistogramRootFileEventSetupAnalyzer_cfi.py b/CondTools/DQM/python/DQMReferenceHistogramRootFileEventSetupAnalyzer_cfi.py deleted file mode 100644 index 0ff9886c3baf4..0000000000000 --- a/CondTools/DQM/python/DQMReferenceHistogramRootFileEventSetupAnalyzer_cfi.py +++ /dev/null @@ -1,24 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -from DQMServices.Core.DQMStore_cfg import * - -dqmRefHistoRootFileGetter=cms.EDAnalyzer("DQMReferenceHistogramRootFileEventSetupAnalyzer") - -## from CondCore.CondDB.CondDB_cfi import * -## CondDBReference = CondDB.clone(connect = cms.string('sqlite_file:DQMReferenceHistogramTest.db')) -## CondDBReference.DBParameters.messageLevel = cms.untracked.int32(1) #3 for high verbosity -## ReferenceRetrieval = cms.ESSource("PoolDBESSource", -## CondDBReference, -## toGet = cms.VPSet(cms.PSet(record = cms.string('DQMReferenceHistogramRootFileRcd'), -## tag = cms.string('ROOTFILE_DQM_Test10') -## ) -## ) -## ) -## -## RecordDataGetter = cms.EDAnalyzer("EventSetupRecordDataGetter", -## toGet = cms.VPSet(cms.PSet(record = cms.string('DQMReferenceHistogramRootFileRcd'), -## data = cms.vstring('ROOTFILE_DQM_Test10') -## ) -## ), -## verbose = cms.untracked.bool(False) -## ) diff --git a/CondTools/DQM/src/DQMReferenceHistogramRootFileSourceHandler.cc b/CondTools/DQM/src/DQMReferenceHistogramRootFileSourceHandler.cc deleted file mode 100644 index 34d54d1c1a7f6..0000000000000 --- a/CondTools/DQM/src/DQMReferenceHistogramRootFileSourceHandler.cc +++ /dev/null @@ -1,76 +0,0 @@ -#include "CondTools/DQM/interface/DQMReferenceHistogramRootFileSourceHandler.h" -#include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/ParameterSet/interface/ParameterSetfwd.h" -#include -#include -#include - -namespace popcon { - DQMReferenceHistogramRootFileSourceHandler::DQMReferenceHistogramRootFileSourceHandler(const edm::ParameterSet& pset) - : m_name(pset.getUntrackedParameter("name", "DQMReferenceHistogramRootFileSourceHandler")), - m_file(pset.getUntrackedParameter("ROOTFile", "./file.root")), - m_zip(pset.getUntrackedParameter("zip", false)), - m_since(pset.getUntrackedParameter("firstSince", 1)), - m_debugMode(pset.getUntrackedParameter("debug", false)) {} - - DQMReferenceHistogramRootFileSourceHandler::~DQMReferenceHistogramRootFileSourceHandler() {} - - void DQMReferenceHistogramRootFileSourceHandler::getNewObjects() { - edm::LogInfo("DQMReferenceHistogramRootFileSourceHandler") - << "[DQMReferenceHistogramRootFileSourceHandler::getNewObjects] for PopCon application " << m_name; - if (m_debugMode) { - std::stringstream ss; - ss << "\n------- " << m_name << " - > getNewObjects\n"; - if (this->tagInfo().size > 0) { - //check what is already inside of the database - ss << "\ngot offlineInfo " << this->tagInfo().name << ",\n size " << this->tagInfo().size << ",\n" - << "last object valid since " << this->tagInfo().lastInterval.since << ",\n token " - << this->tagInfo().lastInterval.payloadId << ",\n UserText " << this->userTextLog() - << ";\n last entry info regarding the payload (if existing):" - << ",\n logId" << this->logDBEntry().logId - << ",\n last record with the correct tag (if existing) has been written in the db " - << this->logDBEntry().destinationDB << ",\n provenance " << this->logDBEntry().provenance << ",\n usertext " - << this->logDBEntry().usertext << ",\n iovtag " << this->logDBEntry().iovtag << ",\n timetype " - << this->logDBEntry().iovtimetype << ",\n payload index " << this->logDBEntry().payloadIdx - << ",\n payload class " << this->logDBEntry().payloadClass << ",\n payload token " - << this->logDBEntry().payloadToken << ",\n execution time " << this->logDBEntry().exectime - << ",\n execution message " << this->logDBEntry().execmessage << std::endl; - Ref payload = this->lastPayload(); - ss << "size of last payload " << payload->size() << std::endl; - } else { - ss << " First object for this tag " << std::endl; - } - edm::LogInfo("DQMReferenceHistogramRootFileSourceHandler") << ss.str(); - } - edm::LogInfo("DQMReferenceHistogramRootFileSourceHandler") << "runnumber/first since = " << m_since << std::endl; - if (m_since <= this->tagInfo().lastInterval.since) { - edm::LogInfo("DQMReferenceHistogramRootFileSourceHandler") - << "[DQMReferenceHistogramRootFileSourceHandler::getNewObjects] \nthe current starting iov " << m_since - << "\nis not compatible with the last iov (" << this->tagInfo().lastInterval.since << ") open for the object " - << this->logDBEntry().payloadClass << " \nin the db " << this->logDBEntry().destinationDB - << " \n NO TRANSFER NEEDED" << std::endl; - return; - } - edm::LogInfo("DQMReferenceHistogramRootFileSourceHandler") - << "[DQMReferenceHistogramRootFileSourceHandler::getNewObjects] " << m_name - << " getting data to be transferred " << std::endl; - FileBlob* rootFile = new FileBlob(m_file, m_zip); - /*if(!this->tagInfo().size) - m_since=1; - else - if (m_debugMode) - m_since=this->tagInfo().lastInterval.first+1; */ - if (rootFile->size() != 0) { - edm::LogInfo("DQMReferenceHistogramRootFileSourceHandler") - << "setting runnumber/first since = " << m_since << std::endl; - this->m_to_transfer.push_back(std::make_pair(rootFile, m_since)); - } else { - edm::LogError("DQMSummarySourceHandler") << "Root file " << m_file << " does not exist" << std::endl; - delete rootFile; - } - edm::LogInfo("DQMSummarySourceHandler") << "------- " << m_name << " - > getNewObjects" << std::endl; - } - - std::string DQMReferenceHistogramRootFileSourceHandler::id() const { return m_name; } -} // namespace popcon diff --git a/CondTools/DQM/test/DQMReferenceHistogramRootFileEventSetupAnalyzer_OrcoffOnly_cfg.py b/CondTools/DQM/test/DQMReferenceHistogramRootFileEventSetupAnalyzer_OrcoffOnly_cfg.py deleted file mode 100644 index e09ea459578ae..0000000000000 --- a/CondTools/DQM/test/DQMReferenceHistogramRootFileEventSetupAnalyzer_OrcoffOnly_cfg.py +++ /dev/null @@ -1,24 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -process = cms.Process('ROOTFILERETRIEVER') - -# import of standard configurations -process.load("DQMServices.Core.DQMStore_cfg") -process.DQMStore.verbose = cms.untracked.int32(1) -process.DQMStore.verboseQT = cms.untracked.int32(0) - -# Put reference histograms into the EventSetup -process.load('CondTools/DQM/DQMReferenceHistogramRootFileEventSetupAnalyzer_OrcoffOnly_cfi') - -process.maxEvents = cms.untracked.PSet(input = cms.untracked.int32(-1)) -# Input source -process.source = cms.Source("EmptyIOVSource", - timetype = cms.string('runnumber'), - firstValue = cms.uint64(1), - lastValue = cms.uint64(1), - interval = cms.uint64(1) - ) - -process.load('CondTools/DQM/DQMReferenceHistogramRootFileEventSetupAnalyzer_cfi') - -process.path = cms.Path(process.dqmRefHistoRootFileGetter) diff --git a/CondTools/DQM/test/DQMReferenceHistogramRootFileEventSetupAnalyzer_SQLiteOnly_cfg.py b/CondTools/DQM/test/DQMReferenceHistogramRootFileEventSetupAnalyzer_SQLiteOnly_cfg.py deleted file mode 100644 index e9aad1ee28513..0000000000000 --- a/CondTools/DQM/test/DQMReferenceHistogramRootFileEventSetupAnalyzer_SQLiteOnly_cfg.py +++ /dev/null @@ -1,24 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -process = cms.Process('ROOTFILERETRIEVER') - -# import of standard configurations -process.load("DQMServices.Core.DQMStore_cfg") -process.DQMStore.verbose = cms.untracked.int32(1) -process.DQMStore.verboseQT = cms.untracked.int32(0) - -# Put reference histograms into the EventSetup -process.load('CondTools/DQM/DQMReferenceHistogramRootFileEventSetupAnalyzer_SQLiteOnly_cfi') - -process.maxEvents = cms.untracked.PSet(input = cms.untracked.int32(-1)) -# Input source -process.source = cms.Source("EmptyIOVSource", - timetype = cms.string('runnumber'), - firstValue = cms.uint64(1), - lastValue = cms.uint64(1), - interval = cms.uint64(1) - ) - -process.load('CondTools/DQM/DQMReferenceHistogramRootFileEventSetupAnalyzer_cfi') - -process.path = cms.Path(process.dqmRefHistoRootFileGetter) diff --git a/CondTools/DQM/test/DQMReferenceHistogramRootFileEventSetupAnalyzer_cfg.py b/CondTools/DQM/test/DQMReferenceHistogramRootFileEventSetupAnalyzer_cfg.py deleted file mode 100644 index d02d0e4ca8b6c..0000000000000 --- a/CondTools/DQM/test/DQMReferenceHistogramRootFileEventSetupAnalyzer_cfg.py +++ /dev/null @@ -1,26 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -process = cms.Process('ROOTFILERETRIEVER') - -# setting the Global Tag -process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff") -process.GlobalTag.globaltag = 'GR09_P_V2::All' - -# import of standard configurations -process.load("DQMServices.Core.DQMStore_cfg") -process.DQMStore.verbose = cms.untracked.int32(1) -process.DQMStore.verboseQT = cms.untracked.int32(0) - -process.maxEvents = cms.untracked.PSet(input = cms.untracked.int32(-1)) - -# Input source -process.source = cms.Source("EmptyIOVSource", - timetype = cms.string('runnumber'), - firstValue = cms.uint64(1), - lastValue = cms.uint64(1), - interval = cms.uint64(1) - ) - -process.load('CondTools/DQM/DQMReferenceHistogramRootFileEventSetupAnalyzer_cfi') - -process.path = cms.Path(process.dqmRefHistoRootFileGetter) diff --git a/CondTools/DQM/test/DQMReferenceHistogramRootFileTest.py b/CondTools/DQM/test/DQMReferenceHistogramRootFileTest.py deleted file mode 100644 index 07446a881d271..0000000000000 --- a/CondTools/DQM/test/DQMReferenceHistogramRootFileTest.py +++ /dev/null @@ -1,47 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -process = cms.Process("TEST") - -process.MessageLogger = cms.Service("MessageLogger", - cerr = cms.untracked.PSet( - enable = cms.untracked.bool(False) - ), - cout = cms.untracked.PSet( - enable = cms.untracked.bool(True), - threshold = cms.untracked.string('INFO') - ) -) - -process.load("CondCore.DBCommon.CondDBCommon_cfi") -process.CondDBCommon.connect = cms.string('sqlite_file:ROOTFILE_Test.db') -process.CondDBCommon.BlobStreamerName = cms.untracked.string('TBufferBlobStreamingService') -process.CondDBCommon.DBParameters.messageLevel = cms.untracked.int32(1) #3 for high verbosity - -process.source = cms.Source("EmptyIOVSource", #needed to EvSetup in order to load data - timetype = cms.string('runnumber'), - firstValue = cms.uint64(1), - lastValue = cms.uint64(1), - interval = cms.uint64(1) - ) - -process.PoolDBOutputService = cms.Service("PoolDBOutputService", - process.CondDBCommon, - timetype = cms.untracked.string('runnumber'), - toPut = cms.VPSet(cms.PSet(record = cms.string('FileBlob'), - tag = cms.string('ROOTFILE_Test') - ) - ), - logconnect = cms.untracked.string('sqlite_file:ROOTFILE_TestLog.db') - ) - -process.dqmReferenceHistogramRootFileTest = cms.EDAnalyzer("DQMReferenceHistogramRootFilePopConAnalyzer", - record = cms.string('FileBlob'), - loggingOn = cms.untracked.bool(True), #always True, needs to create the log db - SinceAppendMode = cms.bool(True), - Source = cms.PSet(ROOTFile = cms.untracked.string("salvo.root"), - firstSince = cms.untracked.uint64(1), #1, 43434, 46335, 51493, 51500 - debug = cms.untracked.bool(True) - ) - ) - -process.p = cms.Path(process.dqmReferenceHistogramRootFileTest) diff --git a/CondTools/DQM/test/DQMReferenceHistogramRootFile_PopCon_cfg.py b/CondTools/DQM/test/DQMReferenceHistogramRootFile_PopCon_cfg.py deleted file mode 100644 index 8d9521143a969..0000000000000 --- a/CondTools/DQM/test/DQMReferenceHistogramRootFile_PopCon_cfg.py +++ /dev/null @@ -1,48 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -process = cms.Process("TEST") - -process.MessageLogger = cms.Service("MessageLogger", - cerr = cms.untracked.PSet( - enable = cms.untracked.bool(False) - ), - cout = cms.untracked.PSet( - enable = cms.untracked.bool(True), - threshold = cms.untracked.string('INFO') - ) -) - -process.load("CondCore.DBCommon.CondDBCommon_cfi") -process.CondDBCommon.connect = cms.string('oracle://cms_orcoff_prep/CMS_COND_31X_DQM_SUMMARY') -process.CondDBCommon.DBParameters.authenticationPath = cms.untracked.string('/build/diguida/conddb') -process.CondDBCommon.BlobStreamerName = cms.untracked.string('TBufferBlobStreamingService') -process.CondDBCommon.DBParameters.messageLevel = cms.untracked.int32(1) #3 for high verbosity - -process.source = cms.Source("EmptyIOVSource", #needed to EvSetup in order to load data - timetype = cms.string('runnumber'), - firstValue = cms.uint64(1), - lastValue = cms.uint64(1), - interval = cms.uint64(1) - ) - -process.PoolDBOutputService = cms.Service("PoolDBOutputService", - process.CondDBCommon, - timetype = cms.untracked.string('runnumber'), - toPut = cms.VPSet(cms.PSet(record = cms.string('FileBlob'), - tag = cms.string('DQM_Cosmics_prompt') - ) - ), - logconnect = cms.untracked.string('oracle://cms_orcoff_prep/CMS_COND_31X_POPCONLOG') - ) - -process.dqmReferenceHistogramRootFileTest = cms.EDAnalyzer("DQMReferenceHistogramRootFilePopConAnalyzer", - record = cms.string('FileBlob'), - loggingOn = cms.untracked.bool(True), #always True, needs to create the log db - SinceAppendMode = cms.bool(True), - Source = cms.PSet(ROOTFile = cms.untracked.string("salvo.root"), - firstSince = cms.untracked.uint64(1), #1, 43434, 46335, 51493, 51500 - debug = cms.untracked.bool(True) - ) - ) - -process.p = cms.Path(process.dqmReferenceHistogramRootFileTest) diff --git a/CondTools/DQM/test/DQMXMLFileEventSetupAnalyzer_cfg.py b/CondTools/DQM/test/DQMXMLFileEventSetupAnalyzer_cfg.py index e55ec890cedf7..835cb43c35649 100644 --- a/CondTools/DQM/test/DQMXMLFileEventSetupAnalyzer_cfg.py +++ b/CondTools/DQM/test/DQMXMLFileEventSetupAnalyzer_cfg.py @@ -63,27 +63,6 @@ verbose = cms.untracked.bool(True) ) - -# process.ReferenceRetrieval = cms.ESSource("PoolDBESSource", -# CondDBSetup, -# connect = cms.string('sqlite_file:DQMReferenceHistogramTest.db'), -# BlobStreamerName = cms.untracked.string('TBufferBlobStreamingService'), -# messageLevel = cms.untracked.int32(1), #3 for high verbosity -# timetype = cms.string('runnumber'), -# toGet = cms.VPSet(cms.PSet(record = cms.string('DQMReferenceHistogramRootFileRcd'), -# tag = cms.string('ROOTFILE_DQM') -# ) -# ) -# ) -# - -# process.RecordDataGetter = cms.EDAnalyzer("EventSetupRecordDataGetter", -# toGet = cms.VPSet(cms.PSet(record = cms.string('DQMReferenceHistogramRootFileRcd'), -# data = cms.vstring('ROOTFILE_DQM_Test10') -# ) -# ), -# verbose = cms.untracked.bool(False) -# ) process.load('CondTools.DQM.DQMXMLFileEventSetupAnalyzer_cfi') if(options.unitTest): diff --git a/CondTools/DT/plugins/DTKeyedConfigDBDump.cc b/CondTools/DT/plugins/DTKeyedConfigDBDump.cc index fb9a62d4b1db8..0f850e975616e 100644 --- a/CondTools/DT/plugins/DTKeyedConfigDBDump.cc +++ b/CondTools/DT/plugins/DTKeyedConfigDBDump.cc @@ -7,11 +7,16 @@ * */ -//----------------------- -// This Class' Header -- -//----------------------- -#include "CondTools/DT/plugins/DTKeyedConfigDBDump.h" - +//---------------------- +// Base Class Headers -- +//---------------------- +#include "FWCore/Framework/interface/one/EDAnalyzer.h" +//------------------------------------ +// Collaborating Class Declarations -- +//------------------------------------ +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" //------------------------------- // Collaborating Class Headers -- //------------------------------- @@ -21,12 +26,28 @@ #include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/MakerMacros.h" -//--------------- -// C++ Headers -- -//--------------- -#include -#include +//----------------------- +// This Class' Header -- +//----------------------- +class DTKeyedConfigDBDump : public edm::one::EDAnalyzer<> { +public: + /** Constructor + */ + explicit DTKeyedConfigDBDump(const edm::ParameterSet& ps); + + /** Destructor + */ + ~DTKeyedConfigDBDump() override; + + /** Operations + */ + /// + void beginJob() override; + void analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) override; +private: + edm::ESGetToken perskeylistToken_; +}; //------------------- // Initializations -- //------------------- @@ -34,7 +55,7 @@ //---------------- // Constructors -- //---------------- -DTKeyedConfigDBDump::DTKeyedConfigDBDump(const edm::ParameterSet& ps) {} +DTKeyedConfigDBDump::DTKeyedConfigDBDump(const edm::ParameterSet& ps) : perskeylistToken_(esConsumes()) {} //-------------- // Destructor -- @@ -46,28 +67,23 @@ DTKeyedConfigDBDump::~DTKeyedConfigDBDump() {} //-------------- void DTKeyedConfigDBDump::beginJob() { return; } -void DTKeyedConfigDBDump::analyze(const edm::Event& e, const edm::EventSetup& c) { +void DTKeyedConfigDBDump::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { edm::eventsetup::EventSetupRecordKey recordKey( edm::eventsetup::EventSetupRecordKey::TypeTag::findType("DTKeyedConfigListRcd")); if (recordKey.type() == edm::eventsetup::EventSetupRecordKey::TypeTag()) { //record not found - std::cout << "Record \"DTKeyedConfigListRcd " - << "\" does not exist " << std::endl; + edm::LogWarning("DTKeyedConfigDBDump") << "Record \"DTKeyedConfigListRcd " + << "\" does not exist " << std::endl; } - edm::ESHandle klh; - std::cout << "got eshandle" << std::endl; - c.get().get(klh); - std::cout << "got context" << std::endl; - cond::persistency::KeyList const& kl = *klh.product(); - cond::persistency::KeyList const* kp = &kl; - std::cout << "now load and get" << std::endl; + cond::persistency::KeyList const* kp = &iSetup.getData(perskeylistToken_); + edm::LogInfo("DTKeyedConfigDBDump") << "now load and get" << std::endl; auto pkc = kp->getUsingKey(999999999); - std::cout << "now check" << std::endl; + edm::LogInfo("DTKeyedConfigDBDump") << "now check" << std::endl; if (pkc.get()) - std::cout << pkc->getId() << " " << *(pkc->dataBegin()) << std::endl; + edm::LogInfo("DTKeyedConfigDBDump") << pkc->getId() << " " << *(pkc->dataBegin()) << std::endl; else - std::cout << "not found" << std::endl; - std::cout << std::endl; + edm::LogInfo("DTKeyedConfigDBDump") << "not found" << std::endl; + edm::LogInfo("DTKeyedConfigDBDump") << std::endl; return; } diff --git a/CondTools/DT/plugins/DTKeyedConfigDBDump.h b/CondTools/DT/plugins/DTKeyedConfigDBDump.h deleted file mode 100644 index fd3b2efc752c0..0000000000000 --- a/CondTools/DT/plugins/DTKeyedConfigDBDump.h +++ /dev/null @@ -1,54 +0,0 @@ -#ifndef DTKeyedConfigDBDump_H -#define DTKeyedConfigDBDump_H -/** \class DTKeyedConfigDBDump - * - * Description: - * - * - * $Date: 2010/03/18 16:07:59 $ - * $Revision: 1.1.2.1 $ - * \author Paolo Ronchese INFN Padova - * - */ - -//---------------------- -// Base Class Headers -- -//---------------------- -#include "FWCore/Framework/interface/EDAnalyzer.h" - -//------------------------------------ -// Collaborating Class Declarations -- -//------------------------------------ -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" - -//--------------- -// C++ Headers -- -//--------------- -#include - -// --------------------- -// -- Class Interface -- -// --------------------- - -class DTKeyedConfigDBDump : public edm::EDAnalyzer { -public: - /** Constructor - */ - explicit DTKeyedConfigDBDump(const edm::ParameterSet& ps); - - /** Destructor - */ - ~DTKeyedConfigDBDump() override; - - /** Operations - */ - /// - void beginJob() override; - void analyze(const edm::Event& e, const edm::EventSetup& c) override; - -private: -}; - -#endif // DTKeyedConfigDBDump_H diff --git a/CondTools/DT/plugins/DTKeyedConfigDBInit.h b/CondTools/DT/plugins/DTKeyedConfigDBInit.h index 3ba081d05ce4c..acd8c9a26af5b 100644 --- a/CondTools/DT/plugins/DTKeyedConfigDBInit.h +++ b/CondTools/DT/plugins/DTKeyedConfigDBInit.h @@ -14,7 +14,7 @@ //---------------------- // Base Class Headers -- //---------------------- -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" //------------------------------------ // Collaborating Class Declarations -- @@ -32,7 +32,7 @@ // -- Class Interface -- // --------------------- -class DTKeyedConfigDBInit : public edm::EDAnalyzer { +class DTKeyedConfigDBInit : public edm::one::EDAnalyzer<> { public: /** Constructor */ diff --git a/CondTools/DT/plugins/DTKeyedConfigPopConAnalyzer.cc b/CondTools/DT/plugins/DTKeyedConfigPopConAnalyzer.cc index 58d3b3854a4c4..0f63bdb4bbdfe 100644 --- a/CondTools/DT/plugins/DTKeyedConfigPopConAnalyzer.cc +++ b/CondTools/DT/plugins/DTKeyedConfigPopConAnalyzer.cc @@ -13,27 +13,25 @@ class DTKeyedConfigPopConAnalyzer : public popcon::PopConAnalyzer(pset), - copyData(pset.getParameter("Source").getUntrackedParameter("copyData", true)) {} + copyData(pset.getParameter("Source").getUntrackedParameter("copyData", true)), + perskeylistToken_(esConsumes()) {} ~DTKeyedConfigPopConAnalyzer() override {} - void analyze(const edm::Event& e, const edm::EventSetup& s) override { + void analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) override { if (!copyData) return; - - edm::ESHandle klh; - std::cout << "got eshandle" << std::endl; - s.get().get(klh); - std::cout << "got context" << std::endl; - cond::persistency::KeyList const& kl = *klh.product(); + edm::LogInfo("DTKeyedConfigPopConAnalyzer") << "got context" << std::endl; + cond::persistency::KeyList const& kl = iSetup.getData(perskeylistToken_); for (size_t i = 0; i < kl.size(); i++) { std::shared_ptr kelem = kl.getUsingIndex(i); if (kelem.get()) - std::cout << kelem->getId() << std::endl; + edm::LogInfo("DTKeyedConfigPopConAnalyzer") << kelem->getId() << std::endl; } source().setList(&kl); } private: bool copyData; + edm::ESGetToken perskeylistToken_; }; DEFINE_FWK_MODULE(DTKeyedConfigPopConAnalyzer); diff --git a/CondTools/DT/plugins/DTUserKeyedConfigPopConAnalyzer.cc b/CondTools/DT/plugins/DTUserKeyedConfigPopConAnalyzer.cc index 2087b2dbbf1a7..a8d8d06b92c55 100644 --- a/CondTools/DT/plugins/DTUserKeyedConfigPopConAnalyzer.cc +++ b/CondTools/DT/plugins/DTUserKeyedConfigPopConAnalyzer.cc @@ -12,23 +12,21 @@ class DTUserKeyedConfigPopConAnalyzer : public popcon::PopConAnalyzer { public: DTUserKeyedConfigPopConAnalyzer(const edm::ParameterSet& pset) - : popcon::PopConAnalyzer(pset) {} + : popcon::PopConAnalyzer(pset), perskeylistToken_(esConsumes()) {} ~DTUserKeyedConfigPopConAnalyzer() override {} - void analyze(const edm::Event& e, const edm::EventSetup& s) override { - edm::ESHandle klh; - std::cout << "got eshandle" << std::endl; - s.get().get(klh); - std::cout << "got context" << std::endl; - cond::persistency::KeyList const& kl = *klh.product(); + void analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) override { + edm::LogInfo("DTUserKeyedConfigPopConAnalyzer") << "got eSdata" << std::endl; + cond::persistency::KeyList const& kl = iSetup.getData(perskeylistToken_); for (size_t i = 0; i < kl.size(); i++) { std::shared_ptr kentry = kl.getUsingIndex(i); if (kentry.get()) - std::cout << kentry->getId() << std::endl; + edm::LogInfo("DTUserKeyedConfigPopConAnalyzer") << kentry->getId() << std::endl; } source().setList(&kl); } private: + edm::ESGetToken perskeylistToken_; }; DEFINE_FWK_MODULE(DTUserKeyedConfigPopConAnalyzer); diff --git a/CondTools/DT/test/stubs/DTGeometryDump.cc b/CondTools/DT/test/stubs/DTGeometryDump.cc index de2a6d9a18a83..58c91d90e5546 100644 --- a/CondTools/DT/test/stubs/DTGeometryDump.cc +++ b/CondTools/DT/test/stubs/DTGeometryDump.cc @@ -18,17 +18,15 @@ Toy EDAnalyzer for testing purposes only. namespace edmtest { - DTGeometryDump::DTGeometryDump(edm::ParameterSet const& p) {} + DTGeometryDump::DTGeometryDump(edm::ParameterSet const& p) : dtgeomToken_(esConsumes()) {} - DTGeometryDump::DTGeometryDump(int i) {} + DTGeometryDump::DTGeometryDump(int i) : dtgeomToken_(esConsumes()) {} DTGeometryDump::~DTGeometryDump() {} void DTGeometryDump::analyze(const edm::Event& e, const edm::EventSetup& context) { using namespace edm::eventsetup; - edm::ESHandle muonGeom; - context.get().get(muonGeom); - + auto muonGeom = context.getHandle(dtgeomToken_); const std::vector& ch_cont = muonGeom->chambers(); std::vector::const_iterator ch_iter = ch_cont.begin(); std::vector::const_iterator ch_iend = ch_cont.end(); diff --git a/CondTools/DT/test/stubs/DTGeometryDump.h b/CondTools/DT/test/stubs/DTGeometryDump.h index 1fffd243055f1..fbc1c7519b80c 100644 --- a/CondTools/DT/test/stubs/DTGeometryDump.h +++ b/CondTools/DT/test/stubs/DTGeometryDump.h @@ -12,6 +12,8 @@ Toy EDAnalyzer for testing purposes only. #include "FWCore/ParameterSet/interface/ParameterSet.h" #include +class DTGeometry; +class MuonGeometryRecord; namespace edmtest { class DTGeometryDump : public edm::EDAnalyzer { @@ -22,5 +24,6 @@ namespace edmtest { virtual void analyze(const edm::Event& e, const edm::EventSetup& c); private: + edm::ESGetToken dtgeomToken_; }; } // namespace edmtest diff --git a/CondTools/DT/test/stubs/DTHVDump.cc b/CondTools/DT/test/stubs/DTHVDump.cc index 8eab8714f2626..503a426170f04 100644 --- a/CondTools/DT/test/stubs/DTHVDump.cc +++ b/CondTools/DT/test/stubs/DTHVDump.cc @@ -12,7 +12,6 @@ Toy EDAnalyzer for testing purposes only. #include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/MakerMacros.h" #include "CoralBase/TimeStamp.h" - #include "CondTools/DT/test/stubs/DTHVDump.h" #include "CondFormats/DTObjects/interface/DTHVStatus.h" #include "CondFormats/DataRecord/interface/DTHVStatusRcd.h" @@ -21,11 +20,11 @@ Toy EDAnalyzer for testing purposes only. namespace edmtest { - DTHVDump::DTHVDump(edm::ParameterSet const& p) { + DTHVDump::DTHVDump(edm::ParameterSet const& p) : dthvstatusToken_(esConsumes()) { // parameters to setup } - DTHVDump::DTHVDump(int i) {} + DTHVDump::DTHVDump(int i) : dthvstatusToken_(esConsumes()) {} DTHVDump::~DTHVDump() {} @@ -36,8 +35,7 @@ namespace edmtest { std::cout << " ---EVENT NUMBER " << e.id().event() << std::endl; // get configuration for current run - edm::ESHandle hv; - context.get().get(hv); + auto hv = context.getHandle(dthvstatusToken_); std::cout << hv->version() << std::endl; std::cout << std::distance(hv->begin(), hv->end()) << " data in the container" << std::endl; edm::ValidityInterval iov(context.get().validityInterval()); diff --git a/CondTools/DT/test/stubs/DTHVDump.h b/CondTools/DT/test/stubs/DTHVDump.h index 5210572bd92dc..3f512bbe6d87d 100644 --- a/CondTools/DT/test/stubs/DTHVDump.h +++ b/CondTools/DT/test/stubs/DTHVDump.h @@ -12,7 +12,8 @@ Toy EDAnalyzer for testing purposes only. #include "FWCore/ParameterSet/interface/ParameterSet.h" #include - +class DTHVStatus; +class DTHVStatusRcd; namespace edmtest { class DTHVDump : public edm::EDAnalyzer { public: @@ -22,5 +23,6 @@ namespace edmtest { virtual void analyze(const edm::Event& e, const edm::EventSetup& c); private: + edm::ESGetToken dthvstatusToken_; }; } // namespace edmtest diff --git a/CondTools/DT/test/validate/DTCCBConfigValidateDBRead.cc b/CondTools/DT/test/validate/DTCCBConfigValidateDBRead.cc index 6bb4b9f30ab39..eea3710803c09 100644 --- a/CondTools/DT/test/validate/DTCCBConfigValidateDBRead.cc +++ b/CondTools/DT/test/validate/DTCCBConfigValidateDBRead.cc @@ -25,9 +25,11 @@ Toy EDAnalyzer for testing purposes only. #include "CondFormats/DataRecord/interface/DTCCBConfigRcd.h" DTCCBConfigValidateDBRead::DTCCBConfigValidateDBRead(edm::ParameterSet const& p) - : dataFileName(p.getParameter("chkFile")), elogFileName(p.getParameter("logFile")) {} + : dataFileName(p.getParameter("chkFile")), + elogFileName(p.getParameter("logFile")), + dtccbToken_(esConsumes()) {} -DTCCBConfigValidateDBRead::DTCCBConfigValidateDBRead(int i) {} +DTCCBConfigValidateDBRead::DTCCBConfigValidateDBRead(int i) : dtccbToken_(esConsumes()) {} DTCCBConfigValidateDBRead::~DTCCBConfigValidateDBRead() {} @@ -40,8 +42,7 @@ void DTCCBConfigValidateDBRead::analyze(const edm::Event& e, const edm::EventSet run_fn << "run" << e.id().run() << dataFileName; std::ifstream chkFile(run_fn.str().c_str()); std::ofstream logFile(elogFileName.c_str(), std::ios_base::app); - edm::ESHandle conf; - context.get().get(conf); + auto conf = context.getHandle(dtccbToken_); std::cout << conf->version() << std::endl; std::cout << std::distance(conf->begin(), conf->end()) << " data in the container" << std::endl; int whe; diff --git a/CondTools/DT/test/validate/DTCCBConfigValidateDBRead.h b/CondTools/DT/test/validate/DTCCBConfigValidateDBRead.h index 2a32d7606ad91..7150f5c315431 100644 --- a/CondTools/DT/test/validate/DTCCBConfigValidateDBRead.h +++ b/CondTools/DT/test/validate/DTCCBConfigValidateDBRead.h @@ -1,4 +1,3 @@ - /*---------------------------------------------------------------------- Toy EDAnalyzer for testing purposes only. @@ -11,7 +10,8 @@ Toy EDAnalyzer for testing purposes only. #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" class DTConfigKey; - +class DTCCBConfig; +class DTCCBConfigRcd; class DTCCBConfigValidateDBRead : public edm::EDAnalyzer { public: explicit DTCCBConfigValidateDBRead(edm::ParameterSet const& p); @@ -23,7 +23,7 @@ class DTCCBConfigValidateDBRead : public edm::EDAnalyzer { private: std::string dataFileName; std::string elogFileName; - + edm::ESGetToken dtccbToken_; static bool cfrDiff(const std::vector& l_conf, const std::vector& r_conf); static bool cfrDiff(const std::vector& l_conf, const std::vector& r_conf); }; diff --git a/CondTools/DT/test/validate/DTCompMapValidateDBRead.cc b/CondTools/DT/test/validate/DTCompMapValidateDBRead.cc index 6464a23e32591..d5058ff51b376 100644 --- a/CondTools/DT/test/validate/DTCompMapValidateDBRead.cc +++ b/CondTools/DT/test/validate/DTCompMapValidateDBRead.cc @@ -25,9 +25,11 @@ Toy EDAnalyzer for testing purposes only. #include "CondFormats/DataRecord/interface/DTReadOutMappingRcd.h" DTCompMapValidateDBRead::DTCompMapValidateDBRead(edm::ParameterSet const& p) - : dataFileName(p.getParameter("chkFile")), elogFileName(p.getParameter("logFile")) {} + : dataFileName(p.getParameter("chkFile")), + elogFileName(p.getParameter("logFile")), + dtreadoutmappingToken_(esConsumes()) {} -DTCompMapValidateDBRead::DTCompMapValidateDBRead(int i) {} +DTCompMapValidateDBRead::DTCompMapValidateDBRead(int i) : dtreadoutmappingToken_(esConsumes()) {} DTCompMapValidateDBRead::~DTCompMapValidateDBRead() {} @@ -41,8 +43,7 @@ void DTCompMapValidateDBRead::analyze(const edm::Event& e, const edm::EventSetup // std::ifstream chkFile( run_fn.str().c_str() ); std::ifstream chkFile(dataFileName.c_str()); std::ofstream logFile(elogFileName.c_str(), std::ios_base::app); - edm::ESHandle ro; - context.get().get(ro); + auto ro = context.getHandle(dtreadoutmappingToken_); std::cout << ro->mapRobRos() << " " << ro->mapCellTdc() << std::endl; std::cout << std::distance(ro->begin(), ro->end()) << " data in the container" << std::endl; int whe; diff --git a/CondTools/DT/test/validate/DTCompMapValidateDBRead.h b/CondTools/DT/test/validate/DTCompMapValidateDBRead.h index 932e4f7a7a538..c83caa8c71498 100644 --- a/CondTools/DT/test/validate/DTCompMapValidateDBRead.h +++ b/CondTools/DT/test/validate/DTCompMapValidateDBRead.h @@ -11,6 +11,8 @@ Toy EDAnalyzer for testing purposes only. #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" +class DTReadOutMapping; +class DTReadOutMappingRcd; class DTCompMapValidateDBRead : public edm::EDAnalyzer { public: explicit DTCompMapValidateDBRead(edm::ParameterSet const& p); @@ -22,4 +24,5 @@ class DTCompMapValidateDBRead : public edm::EDAnalyzer { private: std::string dataFileName; std::string elogFileName; + edm::ESGetToken dtreadoutmappingToken_; }; diff --git a/CondTools/DT/test/validate/DTDeadFlagValidateDBRead.cc b/CondTools/DT/test/validate/DTDeadFlagValidateDBRead.cc index 2333fb3a7bd94..f5989f5870c50 100644 --- a/CondTools/DT/test/validate/DTDeadFlagValidateDBRead.cc +++ b/CondTools/DT/test/validate/DTDeadFlagValidateDBRead.cc @@ -25,9 +25,11 @@ Toy EDAnalyzer for testing purposes only. #include "CondFormats/DataRecord/interface/DTDeadFlagRcd.h" DTDeadFlagValidateDBRead::DTDeadFlagValidateDBRead(edm::ParameterSet const& p) - : dataFileName(p.getParameter("chkFile")), elogFileName(p.getParameter("logFile")) {} + : dataFileName(p.getParameter("chkFile")), + elogFileName(p.getParameter("logFile")), + dtdeadflagToken_(esConsumes()) {} -DTDeadFlagValidateDBRead::DTDeadFlagValidateDBRead(int i) {} +DTDeadFlagValidateDBRead::DTDeadFlagValidateDBRead(int i) : dtdeadflagToken_(esConsumes()) {} DTDeadFlagValidateDBRead::~DTDeadFlagValidateDBRead() {} @@ -40,8 +42,7 @@ void DTDeadFlagValidateDBRead::analyze(const edm::Event& e, const edm::EventSetu run_fn << "run" << e.id().run() << dataFileName; std::ifstream chkFile(run_fn.str().c_str()); std::ofstream logFile(elogFileName.c_str(), std::ios_base::app); - edm::ESHandle df; - context.get().get(df); + auto df = context.getHandle(dtdeadflagToken_); std::cout << df->version() << std::endl; std::cout << std::distance(df->begin(), df->end()) << " data in the container" << std::endl; int whe; diff --git a/CondTools/DT/test/validate/DTDeadFlagValidateDBRead.h b/CondTools/DT/test/validate/DTDeadFlagValidateDBRead.h index 160b4015c65d7..1255f9b7457f0 100644 --- a/CondTools/DT/test/validate/DTDeadFlagValidateDBRead.h +++ b/CondTools/DT/test/validate/DTDeadFlagValidateDBRead.h @@ -10,7 +10,8 @@ Toy EDAnalyzer for testing purposes only. #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" - +class DTDeadFlag; +class DTDeadFlagRcd; class DTDeadFlagValidateDBRead : public edm::EDAnalyzer { public: explicit DTDeadFlagValidateDBRead(edm::ParameterSet const& p); @@ -22,4 +23,5 @@ class DTDeadFlagValidateDBRead : public edm::EDAnalyzer { private: std::string dataFileName; std::string elogFileName; + edm::ESGetToken dtdeadflagToken_; }; diff --git a/CondTools/DT/test/validate/DTHVStatusValidateDBRead.cc b/CondTools/DT/test/validate/DTHVStatusValidateDBRead.cc index e69811d95a74f..14fc6d432fd59 100644 --- a/CondTools/DT/test/validate/DTHVStatusValidateDBRead.cc +++ b/CondTools/DT/test/validate/DTHVStatusValidateDBRead.cc @@ -25,9 +25,11 @@ Toy EDAnalyzer for testing purposes only. #include "CondFormats/DataRecord/interface/DTHVStatusRcd.h" DTHVStatusValidateDBRead::DTHVStatusValidateDBRead(edm::ParameterSet const& p) - : dataFileName(p.getParameter("chkFile")), elogFileName(p.getParameter("logFile")) {} + : dataFileName(p.getParameter("chkFile")), + elogFileName(p.getParameter("logFile")), + dthvstatusToken_(esConsumes()) {} -DTHVStatusValidateDBRead::DTHVStatusValidateDBRead(int i) {} +DTHVStatusValidateDBRead::DTHVStatusValidateDBRead(int i) : dthvstatusToken_(esConsumes()) {} DTHVStatusValidateDBRead::~DTHVStatusValidateDBRead() {} @@ -40,8 +42,7 @@ void DTHVStatusValidateDBRead::analyze(const edm::Event& e, const edm::EventSetu run_fn << "run" << e.id().run() << dataFileName; std::ifstream chkFile(run_fn.str().c_str()); std::ofstream logFile(elogFileName.c_str(), std::ios_base::app); - edm::ESHandle hv; - context.get().get(hv); + auto hv = context.getHandle(dthvstatusToken_); std::cout << hv->version() << std::endl; std::cout << std::distance(hv->begin(), hv->end()) << " data in the container" << std::endl; int status; diff --git a/CondTools/DT/test/validate/DTHVStatusValidateDBRead.h b/CondTools/DT/test/validate/DTHVStatusValidateDBRead.h index 04578b31a2a1c..7d22769134d31 100644 --- a/CondTools/DT/test/validate/DTHVStatusValidateDBRead.h +++ b/CondTools/DT/test/validate/DTHVStatusValidateDBRead.h @@ -10,7 +10,8 @@ Toy EDAnalyzer for testing purposes only. #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" - +class DTHVStatus; +class DTHVStatusRcd; class DTHVStatusValidateDBRead : public edm::EDAnalyzer { public: explicit DTHVStatusValidateDBRead(edm::ParameterSet const& p); @@ -22,4 +23,5 @@ class DTHVStatusValidateDBRead : public edm::EDAnalyzer { private: std::string dataFileName; std::string elogFileName; + edm::ESGetToken dthvstatusToken_; }; diff --git a/CondTools/DT/test/validate/DTLVStatusValidateDBRead.cc b/CondTools/DT/test/validate/DTLVStatusValidateDBRead.cc index 5f934e1615fc0..f4d54eba544d8 100644 --- a/CondTools/DT/test/validate/DTLVStatusValidateDBRead.cc +++ b/CondTools/DT/test/validate/DTLVStatusValidateDBRead.cc @@ -25,9 +25,11 @@ Toy EDAnalyzer for testing purposes only. #include "CondFormats/DataRecord/interface/DTLVStatusRcd.h" DTLVStatusValidateDBRead::DTLVStatusValidateDBRead(edm::ParameterSet const& p) - : dataFileName(p.getParameter("chkFile")), elogFileName(p.getParameter("logFile")) {} + : dataFileName(p.getParameter("chkFile")), + elogFileName(p.getParameter("logFile")), + dtlvstatusToken_(esConsumes()) {} -DTLVStatusValidateDBRead::DTLVStatusValidateDBRead(int i) {} +DTLVStatusValidateDBRead::DTLVStatusValidateDBRead(int i) : dtlvstatusToken_(esConsumes()) {} DTLVStatusValidateDBRead::~DTLVStatusValidateDBRead() {} @@ -40,8 +42,7 @@ void DTLVStatusValidateDBRead::analyze(const edm::Event& e, const edm::EventSetu run_fn << "run" << e.id().run() << dataFileName; std::ifstream chkFile(run_fn.str().c_str()); std::ofstream logFile(elogFileName.c_str(), std::ios_base::app); - edm::ESHandle lv; - context.get().get(lv); + auto lv = context.getHandle(dtlvstatusToken_); std::cout << lv->version() << std::endl; std::cout << std::distance(lv->begin(), lv->end()) << " data in the container" << std::endl; int status; diff --git a/CondTools/DT/test/validate/DTLVStatusValidateDBRead.h b/CondTools/DT/test/validate/DTLVStatusValidateDBRead.h index 27230c325f28c..8f24277d50ffe 100644 --- a/CondTools/DT/test/validate/DTLVStatusValidateDBRead.h +++ b/CondTools/DT/test/validate/DTLVStatusValidateDBRead.h @@ -11,6 +11,8 @@ Toy EDAnalyzer for testing purposes only. #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" +class DTLVStatus; +class DTLVStatusRcd; class DTLVStatusValidateDBRead : public edm::EDAnalyzer { public: explicit DTLVStatusValidateDBRead(edm::ParameterSet const& p); @@ -22,4 +24,5 @@ class DTLVStatusValidateDBRead : public edm::EDAnalyzer { private: std::string dataFileName; std::string elogFileName; + edm::ESGetToken dtlvstatusToken_; }; diff --git a/CondTools/DT/test/validate/DTMtimeValidateDBRead.cc b/CondTools/DT/test/validate/DTMtimeValidateDBRead.cc index 39e3fbf6c5ea5..eb37bffff8cf5 100644 --- a/CondTools/DT/test/validate/DTMtimeValidateDBRead.cc +++ b/CondTools/DT/test/validate/DTMtimeValidateDBRead.cc @@ -29,9 +29,11 @@ Toy EDAnalyzer for testing purposes only. DTMtimeValidateDBRead::DTMtimeValidateDBRead(edm::ParameterSet const& p) : dataFileName(p.getParameter("chkFile")), elogFileName(p.getParameter("logFile")), - readLegacyVDriftDB(p.getParameter("readLegacyVDriftDB")) {} + readLegacyVDriftDB(p.getParameter("readLegacyVDriftDB")), + dtmtTimeToken_(esConsumes()), + dtrecoCondToken_(esConsumes()) {} -DTMtimeValidateDBRead::DTMtimeValidateDBRead(int i) {} +DTMtimeValidateDBRead::DTMtimeValidateDBRead(int i) : dtmtTimeToken_(esConsumes()), dtrecoCondToken_(esConsumes()) {} DTMtimeValidateDBRead::~DTMtimeValidateDBRead() {} @@ -54,8 +56,7 @@ void DTMtimeValidateDBRead::analyze(const edm::Event& e, const edm::EventSetup& float ckmt; float ckrms; if (readLegacyVDriftDB) { //legacy format - edm::ESHandle mT; - context.get().get(mT); + auto mT = context.getHandle(dtmtTimeToken_); std::cout << mT->version() << std::endl; std::cout << std::distance(mT->begin(), mT->end()) << " data in the container" << std::endl; @@ -83,9 +84,9 @@ void DTMtimeValidateDBRead::analyze(const edm::Event& e, const edm::EventSetup& << ckmt << " " << ckrms << " -> " << mTime << " " << mTrms << std::endl; } } else { - edm::ESHandle hVdrift; - context.get().get(hVdrift); - const DTRecoConditions* vDriftMap_ = &*hVdrift; + //hVdrift; + //context.get().get(hVdrift); + const DTRecoConditions* vDriftMap_ = &context.getData(dtrecoCondToken_); // Consistency check: no parametrization is implemented for the time being int version = vDriftMap_->version(); if (version != 1) { diff --git a/CondTools/DT/test/validate/DTMtimeValidateDBRead.h b/CondTools/DT/test/validate/DTMtimeValidateDBRead.h index d59c29e7bae6c..ce81cccf8c893 100644 --- a/CondTools/DT/test/validate/DTMtimeValidateDBRead.h +++ b/CondTools/DT/test/validate/DTMtimeValidateDBRead.h @@ -11,6 +11,10 @@ Toy EDAnalyzer for testing purposes only. #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" +class DTMtime; +class DTMtimeRcd; +class DTRecoConditions; +class DTRecoConditionsVdriftRcd; class DTMtimeValidateDBRead : public edm::EDAnalyzer { public: explicit DTMtimeValidateDBRead(edm::ParameterSet const& p); @@ -23,4 +27,6 @@ class DTMtimeValidateDBRead : public edm::EDAnalyzer { std::string dataFileName; std::string elogFileName; bool readLegacyVDriftDB; // which DB to use + edm::ESGetToken dtmtTimeToken_; + edm::ESGetToken dtrecoCondToken_; }; diff --git a/CondTools/DT/test/validate/DTPerformanceValidateDBRead.cc b/CondTools/DT/test/validate/DTPerformanceValidateDBRead.cc index 9f90dc769dd25..7ea71c56d5cab 100644 --- a/CondTools/DT/test/validate/DTPerformanceValidateDBRead.cc +++ b/CondTools/DT/test/validate/DTPerformanceValidateDBRead.cc @@ -25,9 +25,11 @@ Toy EDAnalyzer for testing purposes only. #include "CondFormats/DataRecord/interface/DTPerformanceRcd.h" DTPerformanceValidateDBRead::DTPerformanceValidateDBRead(edm::ParameterSet const& p) - : dataFileName(p.getParameter("chkFile")), elogFileName(p.getParameter("logFile")) {} + : dataFileName(p.getParameter("chkFile")), + elogFileName(p.getParameter("logFile")), + dtperfToken_(esConsumes()) {} -DTPerformanceValidateDBRead::DTPerformanceValidateDBRead(int i) {} +DTPerformanceValidateDBRead::DTPerformanceValidateDBRead(int i) : dtperfToken_(esConsumes()) {} DTPerformanceValidateDBRead::~DTPerformanceValidateDBRead() {} @@ -40,8 +42,7 @@ void DTPerformanceValidateDBRead::analyze(const edm::Event& e, const edm::EventS run_fn << "run" << e.id().run() << dataFileName; std::ifstream chkFile(run_fn.str().c_str()); std::ofstream logFile(elogFileName.c_str(), std::ios_base::app); - edm::ESHandle mP; - context.get().get(mP); + auto mP = context.getHandle(dtperfToken_); std::cout << mP->version() << std::endl; std::cout << std::distance(mP->begin(), mP->end()) << " data in the container" << std::endl; int status; diff --git a/CondTools/DT/test/validate/DTPerformanceValidateDBRead.h b/CondTools/DT/test/validate/DTPerformanceValidateDBRead.h index cd73087147c17..f789eb17f8dec 100644 --- a/CondTools/DT/test/validate/DTPerformanceValidateDBRead.h +++ b/CondTools/DT/test/validate/DTPerformanceValidateDBRead.h @@ -11,6 +11,8 @@ Toy EDAnalyzer for testing purposes only. #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" +class DTPerformance; +class DTPerformanceRcd; class DTPerformanceValidateDBRead : public edm::EDAnalyzer { public: explicit DTPerformanceValidateDBRead(edm::ParameterSet const& p); @@ -22,4 +24,5 @@ class DTPerformanceValidateDBRead : public edm::EDAnalyzer { private: std::string dataFileName; std::string elogFileName; + edm::ESGetToken dtperfToken_; }; diff --git a/CondTools/DT/test/validate/DTROMapValidateDBRead.cc b/CondTools/DT/test/validate/DTROMapValidateDBRead.cc index a74ec0259a57a..7896e6c993b5e 100644 --- a/CondTools/DT/test/validate/DTROMapValidateDBRead.cc +++ b/CondTools/DT/test/validate/DTROMapValidateDBRead.cc @@ -25,9 +25,11 @@ Toy EDAnalyzer for testing purposes only. #include "CondFormats/DataRecord/interface/DTReadOutMappingRcd.h" DTROMapValidateDBRead::DTROMapValidateDBRead(edm::ParameterSet const& p) - : dataFileName(p.getParameter("chkFile")), elogFileName(p.getParameter("logFile")) {} + : dataFileName(p.getParameter("chkFile")), + elogFileName(p.getParameter("logFile")), + dtreadoutmappingToken_(esConsumes()) {} -DTROMapValidateDBRead::DTROMapValidateDBRead(int i) {} +DTROMapValidateDBRead::DTROMapValidateDBRead(int i) : dtreadoutmappingToken_(esConsumes()) {} DTROMapValidateDBRead::~DTROMapValidateDBRead() {} @@ -41,8 +43,7 @@ void DTROMapValidateDBRead::analyze(const edm::Event& e, const edm::EventSetup& // std::ifstream chkFile( run_fn.str().c_str() ); std::ifstream chkFile(dataFileName.c_str()); std::ofstream logFile(elogFileName.c_str(), std::ios_base::app); - edm::ESHandle ro; - context.get().get(ro); + auto ro = context.getHandle(dtreadoutmappingToken_); std::cout << ro->mapRobRos() << " " << ro->mapCellTdc() << std::endl; std::cout << std::distance(ro->begin(), ro->end()) << " data in the container" << std::endl; int whe; diff --git a/CondTools/DT/test/validate/DTROMapValidateDBRead.h b/CondTools/DT/test/validate/DTROMapValidateDBRead.h index 754c0cb9aa5cf..ef436d1fe2ec2 100644 --- a/CondTools/DT/test/validate/DTROMapValidateDBRead.h +++ b/CondTools/DT/test/validate/DTROMapValidateDBRead.h @@ -11,6 +11,9 @@ Toy EDAnalyzer for testing purposes only. #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" +class DTReadOutMapping; +class DTReadOutMappingRcd; + class DTROMapValidateDBRead : public edm::EDAnalyzer { public: explicit DTROMapValidateDBRead(edm::ParameterSet const& p); @@ -22,4 +25,5 @@ class DTROMapValidateDBRead : public edm::EDAnalyzer { private: std::string dataFileName; std::string elogFileName; + edm::ESGetToken dtreadoutmappingToken_; }; diff --git a/CondTools/DT/test/validate/DTRangeT0ValidateDBRead.cc b/CondTools/DT/test/validate/DTRangeT0ValidateDBRead.cc index 532371c0ad27b..9d435269d3df3 100644 --- a/CondTools/DT/test/validate/DTRangeT0ValidateDBRead.cc +++ b/CondTools/DT/test/validate/DTRangeT0ValidateDBRead.cc @@ -25,9 +25,11 @@ Toy EDAnalyzer for testing purposes only. #include "CondFormats/DataRecord/interface/DTRangeT0Rcd.h" DTRangeT0ValidateDBRead::DTRangeT0ValidateDBRead(edm::ParameterSet const& p) - : dataFileName(p.getParameter("chkFile")), elogFileName(p.getParameter("logFile")) {} + : dataFileName(p.getParameter("chkFile")), + elogFileName(p.getParameter("logFile")), + dtrangeToken_(esConsumes()) {} -DTRangeT0ValidateDBRead::DTRangeT0ValidateDBRead(int i) {} +DTRangeT0ValidateDBRead::DTRangeT0ValidateDBRead(int i) : dtrangeToken_(esConsumes()) {} DTRangeT0ValidateDBRead::~DTRangeT0ValidateDBRead() {} @@ -40,8 +42,7 @@ void DTRangeT0ValidateDBRead::analyze(const edm::Event& e, const edm::EventSetup run_fn << "run" << e.id().run() << dataFileName; std::ifstream chkFile(run_fn.str().c_str()); std::ofstream logFile(elogFileName.c_str(), std::ios_base::app); - edm::ESHandle tR; - context.get().get(tR); + auto tR = context.getHandle(dtrangeToken_); std::cout << tR->version() << std::endl; std::cout << std::distance(tR->begin(), tR->end()) << " data in the container" << std::endl; int status; diff --git a/CondTools/DT/test/validate/DTRangeT0ValidateDBRead.h b/CondTools/DT/test/validate/DTRangeT0ValidateDBRead.h index 6b7beeca7a50b..baf4ec326da8c 100644 --- a/CondTools/DT/test/validate/DTRangeT0ValidateDBRead.h +++ b/CondTools/DT/test/validate/DTRangeT0ValidateDBRead.h @@ -11,6 +11,9 @@ Toy EDAnalyzer for testing purposes only. #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" +class DTRangeT0; +class DTRangeT0Rcd; + class DTRangeT0ValidateDBRead : public edm::EDAnalyzer { public: explicit DTRangeT0ValidateDBRead(edm::ParameterSet const& p); @@ -22,4 +25,5 @@ class DTRangeT0ValidateDBRead : public edm::EDAnalyzer { private: std::string dataFileName; std::string elogFileName; + edm::ESGetToken dtrangeToken_; }; diff --git a/CondTools/DT/test/validate/DTStatusFlagValidateDBRead.cc b/CondTools/DT/test/validate/DTStatusFlagValidateDBRead.cc index 58b752d5ea0f4..b617adcacfea9 100644 --- a/CondTools/DT/test/validate/DTStatusFlagValidateDBRead.cc +++ b/CondTools/DT/test/validate/DTStatusFlagValidateDBRead.cc @@ -25,9 +25,11 @@ Toy EDAnalyzer for testing purposes only. #include "CondFormats/DataRecord/interface/DTStatusFlagRcd.h" DTStatusFlagValidateDBRead::DTStatusFlagValidateDBRead(edm::ParameterSet const& p) - : dataFileName(p.getParameter("chkFile")), elogFileName(p.getParameter("logFile")) {} + : dataFileName(p.getParameter("chkFile")), + elogFileName(p.getParameter("logFile")), + dtstatusFlagToken_(esConsumes()) {} -DTStatusFlagValidateDBRead::DTStatusFlagValidateDBRead(int i) {} +DTStatusFlagValidateDBRead::DTStatusFlagValidateDBRead(int i) : dtstatusFlagToken_(esConsumes()) {} DTStatusFlagValidateDBRead::~DTStatusFlagValidateDBRead() {} @@ -40,8 +42,7 @@ void DTStatusFlagValidateDBRead::analyze(const edm::Event& e, const edm::EventSe run_fn << "run" << e.id().run() << dataFileName; std::ifstream chkFile(run_fn.str().c_str()); std::ofstream logFile(elogFileName.c_str(), std::ios_base::app); - edm::ESHandle sf; - context.get().get(sf); + auto sf = context.getHandle(dtstatusFlagToken_); std::cout << sf->version() << std::endl; std::cout << std::distance(sf->begin(), sf->end()) << " data in the container" << std::endl; int whe; diff --git a/CondTools/DT/test/validate/DTStatusFlagValidateDBRead.h b/CondTools/DT/test/validate/DTStatusFlagValidateDBRead.h index 02297c20d470c..fb8527f7b97b8 100644 --- a/CondTools/DT/test/validate/DTStatusFlagValidateDBRead.h +++ b/CondTools/DT/test/validate/DTStatusFlagValidateDBRead.h @@ -11,6 +11,8 @@ Toy EDAnalyzer for testing purposes only. #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" +class DTStatusFlag; +class DTStatusFlagRcd; class DTStatusFlagValidateDBRead : public edm::EDAnalyzer { public: explicit DTStatusFlagValidateDBRead(edm::ParameterSet const& p); @@ -22,4 +24,5 @@ class DTStatusFlagValidateDBRead : public edm::EDAnalyzer { private: std::string dataFileName; std::string elogFileName; + edm::ESGetToken dtstatusFlagToken_; }; diff --git a/CondTools/DT/test/validate/DTT0ValidateDBRead.cc b/CondTools/DT/test/validate/DTT0ValidateDBRead.cc index 00d999dd38d88..325343d771175 100644 --- a/CondTools/DT/test/validate/DTT0ValidateDBRead.cc +++ b/CondTools/DT/test/validate/DTT0ValidateDBRead.cc @@ -25,9 +25,11 @@ Toy EDAnalyzer for testing purposes only. #include "CondFormats/DataRecord/interface/DTT0Rcd.h" DTT0ValidateDBRead::DTT0ValidateDBRead(edm::ParameterSet const& p) - : dataFileName(p.getParameter("chkFile")), elogFileName(p.getParameter("logFile")) {} + : dataFileName(p.getParameter("chkFile")), + elogFileName(p.getParameter("logFile")), + dtT0Token_(esConsumes()) {} -DTT0ValidateDBRead::DTT0ValidateDBRead(int i) {} +DTT0ValidateDBRead::DTT0ValidateDBRead(int i) : dtT0Token_(esConsumes()) {} DTT0ValidateDBRead::~DTT0ValidateDBRead() {} @@ -40,8 +42,7 @@ void DTT0ValidateDBRead::analyze(const edm::Event& e, const edm::EventSetup& con run_fn << "run" << e.id().run() << dataFileName; std::ifstream chkFile(run_fn.str().c_str()); std::ofstream logFile(elogFileName.c_str(), std::ios_base::app); - edm::ESHandle t0; - context.get().get(t0); + auto t0 = context.getHandle(dtT0Token_); std::cout << t0->version() << std::endl; std::cout << std::distance(t0->begin(), t0->end()) << " data in the container" << std::endl; int whe; diff --git a/CondTools/DT/test/validate/DTT0ValidateDBRead.h b/CondTools/DT/test/validate/DTT0ValidateDBRead.h index 753563393a680..a99961d48f21f 100644 --- a/CondTools/DT/test/validate/DTT0ValidateDBRead.h +++ b/CondTools/DT/test/validate/DTT0ValidateDBRead.h @@ -11,6 +11,8 @@ Toy EDAnalyzer for testing purposes only. #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" +class DTT0; +class DTT0Rcd; class DTT0ValidateDBRead : public edm::EDAnalyzer { public: explicit DTT0ValidateDBRead(edm::ParameterSet const& p); @@ -22,4 +24,5 @@ class DTT0ValidateDBRead : public edm::EDAnalyzer { private: std::string dataFileName; std::string elogFileName; + edm::ESGetToken dtT0Token_; }; diff --git a/CondTools/DT/test/validate/DTTPGParametersValidateDBRead.cc b/CondTools/DT/test/validate/DTTPGParametersValidateDBRead.cc index 72e2ec817b12b..a208bb23ad85f 100644 --- a/CondTools/DT/test/validate/DTTPGParametersValidateDBRead.cc +++ b/CondTools/DT/test/validate/DTTPGParametersValidateDBRead.cc @@ -25,9 +25,11 @@ Toy EDAnalyzer for testing purposes only. #include "CondFormats/DataRecord/interface/DTTPGParametersRcd.h" DTTPGParametersValidateDBRead::DTTPGParametersValidateDBRead(edm::ParameterSet const& p) - : dataFileName(p.getParameter("chkFile")), elogFileName(p.getParameter("logFile")) {} + : dataFileName(p.getParameter("chkFile")), + elogFileName(p.getParameter("logFile")), + dttpgPramToken_(esConsumes()) {} -DTTPGParametersValidateDBRead::DTTPGParametersValidateDBRead(int i) {} +DTTPGParametersValidateDBRead::DTTPGParametersValidateDBRead(int i) : dttpgPramToken_(esConsumes()) {} DTTPGParametersValidateDBRead::~DTTPGParametersValidateDBRead() {} @@ -40,8 +42,7 @@ void DTTPGParametersValidateDBRead::analyze(const edm::Event& e, const edm::Even run_fn << "run" << e.id().run() << dataFileName; std::ifstream chkFile(run_fn.str().c_str()); std::ofstream logFile(elogFileName.c_str(), std::ios_base::app); - edm::ESHandle tpg; - context.get().get(tpg); + auto tpg = context.getHandle(dttpgPramToken_); std::cout << tpg->version() << std::endl; std::cout << std::distance(tpg->begin(), tpg->end()) << " data in the container" << std::endl; int whe; diff --git a/CondTools/DT/test/validate/DTTPGParametersValidateDBRead.h b/CondTools/DT/test/validate/DTTPGParametersValidateDBRead.h index 0e9ec5cc5a137..6c6082d92154f 100644 --- a/CondTools/DT/test/validate/DTTPGParametersValidateDBRead.h +++ b/CondTools/DT/test/validate/DTTPGParametersValidateDBRead.h @@ -11,6 +11,8 @@ Toy EDAnalyzer for testing purposes only. #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" +class DTTPGParameters; +class DTTPGParametersRcd; class DTTPGParametersValidateDBRead : public edm::EDAnalyzer { public: explicit DTTPGParametersValidateDBRead(edm::ParameterSet const& p); @@ -22,4 +24,5 @@ class DTTPGParametersValidateDBRead : public edm::EDAnalyzer { private: std::string dataFileName; std::string elogFileName; + edm::ESGetToken dttpgPramToken_; }; diff --git a/CondTools/DT/test/validate/DTTtrigValidateDBRead.cc b/CondTools/DT/test/validate/DTTtrigValidateDBRead.cc index 2875b3da47988..bd9917d6f8d58 100644 --- a/CondTools/DT/test/validate/DTTtrigValidateDBRead.cc +++ b/CondTools/DT/test/validate/DTTtrigValidateDBRead.cc @@ -25,9 +25,11 @@ Toy EDAnalyzer for testing purposes only. #include "CondFormats/DataRecord/interface/DTTtrigRcd.h" DTTtrigValidateDBRead::DTTtrigValidateDBRead(edm::ParameterSet const& p) - : dataFileName(p.getParameter("chkFile")), elogFileName(p.getParameter("logFile")) {} + : dataFileName(p.getParameter("chkFile")), + elogFileName(p.getParameter("logFile")), + dtTrigToken_(esConsumes()) {} -DTTtrigValidateDBRead::DTTtrigValidateDBRead(int i) {} +DTTtrigValidateDBRead::DTTtrigValidateDBRead(int i) : dtTrigToken_(esConsumes()) {} DTTtrigValidateDBRead::~DTTtrigValidateDBRead() {} @@ -40,8 +42,7 @@ void DTTtrigValidateDBRead::analyze(const edm::Event& e, const edm::EventSetup& run_fn << "run" << e.id().run() << dataFileName; std::ifstream chkFile(run_fn.str().c_str()); std::ofstream logFile(elogFileName.c_str(), std::ios_base::app); - edm::ESHandle tT; - context.get().get(tT); + auto tT = context.getHandle(dtTrigToken_); std::cout << tT->version() << std::endl; std::cout << std::distance(tT->begin(), tT->end()) << " data in the container" << std::endl; int status; diff --git a/CondTools/DT/test/validate/DTTtrigValidateDBRead.h b/CondTools/DT/test/validate/DTTtrigValidateDBRead.h index 02c2a2938a160..925d47d137728 100644 --- a/CondTools/DT/test/validate/DTTtrigValidateDBRead.h +++ b/CondTools/DT/test/validate/DTTtrigValidateDBRead.h @@ -10,6 +10,8 @@ Toy EDAnalyzer for testing purposes only. #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" +class DTTtrig; +class DTTtrigRcd; class DTTtrigValidateDBRead : public edm::EDAnalyzer { public: @@ -22,4 +24,5 @@ class DTTtrigValidateDBRead : public edm::EDAnalyzer { private: std::string dataFileName; std::string elogFileName; + edm::ESGetToken dtTrigToken_; }; diff --git a/CondTools/Ecal/interface/ESDBCopy.h b/CondTools/Ecal/interface/ESDBCopy.h index c658aa62effca..c4cac2c5dd824 100644 --- a/CondTools/Ecal/interface/ESDBCopy.h +++ b/CondTools/Ecal/interface/ESDBCopy.h @@ -1,9 +1,22 @@ -#ifndef ESDBCOPY_H -#define ESDBCOPY_H +#ifndef CondTools_Ecal_ESDBCopy_h +#define CondTools_Ecal_ESDBCopy_h -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "CondCore/CondDB/interface/Exception.h" +#include "CondFormats/ESObjects/interface/ESPedestals.h" +#include "CondFormats/DataRecord/interface/ESPedestalsRcd.h" +#include "CondFormats/ESObjects/interface/ESADCToGeVConstant.h" +#include "CondFormats/DataRecord/interface/ESADCToGeVConstantRcd.h" +#include "CondFormats/ESObjects/interface/ESChannelStatus.h" +#include "CondFormats/DataRecord/interface/ESChannelStatusRcd.h" +#include "CondFormats/ESObjects/interface/ESIntercalibConstants.h" +#include "CondFormats/DataRecord/interface/ESIntercalibConstantsRcd.h" +#include "CondFormats/ESObjects/interface/ESWeightStripGroups.h" +#include "CondFormats/DataRecord/interface/ESWeightStripGroupsRcd.h" +#include "CondFormats/ESObjects/interface/ESTBWeights.h" +#include "CondFormats/DataRecord/interface/ESTBWeightsRcd.h" + #include "FWCore/Framework/interface/IOVSyncValue.h" #include @@ -15,7 +28,7 @@ namespace edm { class EventSetup; } // namespace edm -class ESDBCopy : public edm::EDAnalyzer { +class ESDBCopy : public edm::one::EDAnalyzer<> { public: explicit ESDBCopy(const edm::ParameterSet& iConfig); ~ESDBCopy() override; @@ -23,12 +36,19 @@ class ESDBCopy : public edm::EDAnalyzer { void analyze(const edm::Event& evt, const edm::EventSetup& evtSetup) override; private: - bool shouldCopy(const edm::EventSetup& evtSetup, std::string container); - void copyToDB(const edm::EventSetup& evtSetup, std::string container); + bool shouldCopy(const edm::EventSetup& evtSetup, const std::string& container); + void copyToDB(const edm::EventSetup& evtSetup, const std::string& container); std::string m_timetype; std::map m_cacheIDs; std::map m_records; + + const edm::ESGetToken esPedestalsToken_; + const edm::ESGetToken esADCToGeVConstantToken_; + const edm::ESGetToken esChannelStatusToken_; + const edm::ESGetToken esIntercalibConstantsToken_; + const edm::ESGetToken esWeightStripGroupsToken_; + const edm::ESGetToken esTBWeightsToken_; }; #endif diff --git a/CondTools/Ecal/interface/EcalDBCopy.h b/CondTools/Ecal/interface/EcalDBCopy.h index 2b638b44db3dd..69a3d65bf7ff9 100644 --- a/CondTools/Ecal/interface/EcalDBCopy.h +++ b/CondTools/Ecal/interface/EcalDBCopy.h @@ -1,11 +1,32 @@ #ifndef ECALDBCOPY_H #define ECALDBCOPY_H -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "CondCore/CondDB/interface/Exception.h" #include "FWCore/Framework/interface/IOVSyncValue.h" - +#include "CondFormats/EcalObjects/interface/EcalPedestals.h" +#include "CondFormats/EcalObjects/interface/EcalTimeCalibConstants.h" +#include "CondFormats/EcalObjects/interface/EcalChannelStatus.h" +#include "CondFormats/EcalObjects/interface/EcalDQMChannelStatus.h" +#include "CondFormats/EcalObjects/interface/EcalDQMTowerStatus.h" +#include "CondFormats/EcalObjects/interface/EcalDCSTowerStatus.h" +#include "CondFormats/EcalObjects/interface/EcalDAQTowerStatus.h" +#include "CondFormats/EcalObjects/interface/EcalTPGCrystalStatus.h" +#include "CondFormats/EcalObjects/interface/EcalLinearCorrections.h" +#include "CondFormats/EcalObjects/interface/EcalIntercalibConstants.h" +#include "CondFormats/EcalObjects/interface/EcalIntercalibErrors.h" +#include "CondFormats/EcalObjects/interface/EcalGainRatios.h" +#include "CondFormats/EcalObjects/interface/EcalWeightXtalGroups.h" +#include "CondFormats/EcalObjects/interface/EcalIntercalibConstantsMC.h" +#include "CondFormats/EcalObjects/interface/EcalLaserAlphas.h" +#include "CondFormats/EcalObjects/interface/EcalLaserAPDPNRatiosRef.h" +#include "CondFormats/EcalObjects/interface/EcalClusterCrackCorrParameters.h" +#include "CondFormats/EcalObjects/interface/EcalPFRecHitThresholds.h" +#include "CondFormats/EcalObjects/interface/EcalClusterEnergyUncertaintyParameters.h" +#include "CondFormats/EcalObjects/interface/EcalClusterEnergyCorrectionParameters.h" +#include "CondFormats/EcalObjects/interface/EcalClusterEnergyCorrectionObjectSpecificParameters.h" +#include "CondFormats/EcalObjects/interface/EcalClusterLocalContCorrParameters.h" #include #include @@ -15,7 +36,54 @@ namespace edm { class EventSetup; } // namespace edm -class EcalDBCopy : public edm::EDAnalyzer { +class EcalADCToGeVConstant; +class EcalTPGTowerStatus; +class EcalTBWeights; +class EcalLaserAPDPNRatios; +class Alignments; +class EcalTimeOffsetConstant; +class EcalSampleMask; +class EcalSimPulseShape; +class EcalTimeBiasCorrections; +class EcalSamplesCorrelation; + +class EcalPedestalsRcd; +class EcalADCToGeVConstantRcd; +class EcalTimeCalibConstantsRcd; +class EcalChannelStatusRcd; +class EcalDQMChannelStatusRcd; +class EcalDQMTowerStatusRcd; +class EcalDCSTowerStatusRcd; +class EcalTPGCrystalStatusRcd; +class EcalDAQTowerStatusRcd; +class EcalTPGTowerStatusRcd; +class EcalTPGTowerStatusRcd; +class EcalIntercalibConstantsRcd; +class EcalLinearCorrectionsRcd; +class EcalIntercalibConstantsMCRcd; +class EcalIntercalibErrorsRcd; +class EcalGainRatiosRcd; +class EcalWeightXtalGroupsRcd; +class EcalTBWeightsRcd; +class EcalLaserAlphasRcd; +class EcalLaserAPDPNRatiosRcd; +class EcalLaserAPDPNRatiosRefRcd; +class EcalClusterCrackCorrParametersRcd; +class EcalPFRecHitThresholdsRcd; +class EcalClusterEnergyUncertaintyParametersRcd; +class EcalClusterEnergyCorrectionParametersRcd; +class EcalClusterEnergyCorrectionObjectSpecificParametersRcd; +class EcalClusterLocalContCorrParametersRcd; +class EBAlignmentRcd; +class EEAlignmentRcd; +class ESAlignmentRcd; +class EcalTimeOffsetConstantRcd; +class EcalSampleMaskRcd; +class EcalSimPulseShapeRcd; +class EcalTimeBiasCorrectionsRcd; +class EcalSamplesCorrelationRcd; + +class EcalDBCopy : public edm::one::EDAnalyzer<> { public: explicit EcalDBCopy(const edm::ParameterSet& iConfig); ~EcalDBCopy() override; @@ -23,12 +91,52 @@ class EcalDBCopy : public edm::EDAnalyzer { void analyze(const edm::Event& evt, const edm::EventSetup& evtSetup) override; private: - bool shouldCopy(const edm::EventSetup& evtSetup, std::string container); - void copyToDB(const edm::EventSetup& evtSetup, std::string container); + bool shouldCopy(const edm::EventSetup& evtSetup, const std::string& container); + void copyToDB(const edm::EventSetup& evtSetup, const std::string& container); std::string m_timetype; std::map m_cacheIDs; std::map m_records; + edm::ESGetToken ecalPedestalToken_; + edm::ESGetToken ecalADCtoGeVToken_; + edm::ESGetToken ecalTimeCalibToken_; + edm::ESGetToken ecalChannelStatusToken_; + edm::ESGetToken ecalDQMChannelStatusToken_; + edm::ESGetToken ecalDQMTowerStatusToken_; + edm::ESGetToken ecalDCSTowerStatusToken_; + edm::ESGetToken ecalDAQTowerStatusToken_; + edm::ESGetToken ecalTPGCrystalStatusToken_; + edm::ESGetToken ecalTPGTowerStatusToken_; + edm::ESGetToken ecalIntercalibConstantsToken_; + edm::ESGetToken ecalLinearCorrectionsToken_; + edm::ESGetToken ecalIntercalibConstantsMCToken_; + edm::ESGetToken ecalIntercalibErrorsToken_; + edm::ESGetToken ecalGainRatiosToken_; + edm::ESGetToken ecalWeightXtalGroupsToken_; + edm::ESGetToken ecalTBWeightsToken_; + edm::ESGetToken ecalLaserAlphasToken_; + edm::ESGetToken ecalLaserAPDPNRatiosToken_; + edm::ESGetToken ecalLaserAPDPNRatiosRefToken_; + edm::ESGetToken + ecalClusterCrackCorrParametersToken_; + edm::ESGetToken ecalPFRecHitThresholdsToken_; + edm::ESGetToken + ecalClusterEnergyUncertaintyParametersToken_; + edm::ESGetToken + ecalClusterEnergyCorrectionParametersToken_; + edm::ESGetToken + ecalClusterEnergyCorrectionObjectSpecificParametersToken_; + edm::ESGetToken + ecalClusterLocalContCorrParametersToken_; + edm::ESGetToken ebAlignmentToken_; + edm::ESGetToken eeAlignmentToken_; + edm::ESGetToken esAlignmentToken_; + edm::ESGetToken ecalTimeOffsetConstantToken_; + edm::ESGetToken ecalSampleMaskToken_; + edm::ESGetToken ecalSimPulseShapeToken_; + edm::ESGetToken ecalTimeBiasCorrectionsToken_; + edm::ESGetToken ecalSamplesCorrelationToken_; }; #endif diff --git a/CondTools/Ecal/interface/EcalGetLaserData.h b/CondTools/Ecal/interface/EcalGetLaserData.h index e85fa5277d93c..c6a06f4b0f1a5 100644 --- a/CondTools/Ecal/interface/EcalGetLaserData.h +++ b/CondTools/Ecal/interface/EcalGetLaserData.h @@ -1,28 +1,12 @@ #ifndef ECALGETLASERDATA_H #define ECALGETLASERDATA_H -#include "FWCore/Framework/interface/EDAnalyzer.h" -#include "CondCore/CondDB/interface/Exception.h" - -#include "FWCore/Framework/interface/IOVSyncValue.h" - -#include "CondFormats/EcalObjects/interface/EcalLaserAPDPNRatios.h" -#include "CondFormats/DataRecord/interface/EcalLaserAPDPNRatiosRcd.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "CondFormats/EcalObjects/interface/EcalLaserAPDPNRatiosRef.h" -#include "CondFormats/DataRecord/interface/EcalLaserAPDPNRatiosRefRcd.h" #include "CondFormats/EcalObjects/interface/EcalLaserAlphas.h" -#include "CondFormats/DataRecord/interface/EcalLaserAlphasRcd.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/EBDetId.h" -#include "DataFormats/EcalDetId/interface/EEDetId.h" #include #include -#include #include #include @@ -32,7 +16,12 @@ namespace edm { class EventSetup; } // namespace edm -class EcalGetLaserData : public edm::EDAnalyzer { +class EcalLaserAPDPNRatios; +class EcalLaserAPDPNRatiosRcd; +class EcalLaserAPDPNRatiosRefRcd; +class EcalLaserAlphasRcd; + +class EcalGetLaserData : public edm::one::EDAnalyzer<> { public: explicit EcalGetLaserData(const edm::ParameterSet& iConfig); ~EcalGetLaserData() override; @@ -48,6 +37,9 @@ class EcalGetLaserData : public edm::EDAnalyzer { void beginJob() override; void endJob() override; + edm::ESGetToken ecalLaserAPDPNRatiosToken_; + edm::ESGetToken ecalLaserAPDPNRatiosRefToken_; + edm::ESGetToken ecalLaserAlphasToken_; }; #endif diff --git a/CondTools/Ecal/interface/EcalIntercalibConstantsHandler.h b/CondTools/Ecal/interface/EcalIntercalibConstantsHandler.h deleted file mode 100644 index 062fd8546863b..0000000000000 --- a/CondTools/Ecal/interface/EcalIntercalibConstantsHandler.h +++ /dev/null @@ -1,17 +0,0 @@ -/** - \file - Declaration of class IntercalibConstantsHandler - - \author Stefano ARGIRO - \version $Id: EcalIntercalibConstantsHandler.h,v 1.1 2008/11/14 15:46:05 argiro Exp $ - \date 09 Sep 2008 -*/ - -#ifndef _CondToolsEcal_EcalIntercalibConstantsHandler_h_ -#define _CondToolsEcal_EcalIntercalibConstantsHandler_h_ - -#include "CondTools/Ecal/interface/EcalFloatCondObjectContainerHandler.h" - -typedef EcalFloatCondObjectContainerHandler EcalIntercalibConstantsHandler; - -#endif diff --git a/CondTools/Ecal/interface/EcalIntercalibConstantsMCHandler.h b/CondTools/Ecal/interface/EcalIntercalibConstantsMCHandler.h deleted file mode 100644 index f92ede7ae1f35..0000000000000 --- a/CondTools/Ecal/interface/EcalIntercalibConstantsMCHandler.h +++ /dev/null @@ -1,18 +0,0 @@ -/** - \file - Declaration of class InterlcalibConstantsMCHandler - - \author Stefano ARGIRO - \version $Id: EcalIntercalibConstantsMCHandler.h,v 1.1 2009/04/08 15:20:25 argiro Exp $ - \date 09 Sep 2008 -*/ - -#ifndef _CondToolsEcal_EcalIntercalibConstantsMCHandler_h_ -#define _CondToolsEcal_EcalIntercalibConstantsMCHandler_h_ - - -#include "CondTools/Ecal/interface/EcalFloatCondObjectContainerHandler.h" - -typedef EcalFloatCondObjectContainerHandler EcalIntercalibConstantsMCHandler; - -#endif diff --git a/CondTools/Ecal/interface/EcalIntercalibErrorsHandler.h b/CondTools/Ecal/interface/EcalIntercalibErrorsHandler.h deleted file mode 100644 index f881eb7356ebf..0000000000000 --- a/CondTools/Ecal/interface/EcalIntercalibErrorsHandler.h +++ /dev/null @@ -1,23 +0,0 @@ -/** - \file - Declaration of class IntercalibErrorsHandler - - \author Stefano ARGIRO - \version $Id: EcalIntercalibErrorsHandler.h,v 1.1 2008/11/14 15:46:05 argiro Exp $ - \date 09 Sep 2008 -*/ - -#ifndef _CondToolsEcal_EcalIntercalibErrorsHandler_h_ -#define _CondToolsEcal_EcalIntercalibErrorsHandler_h_ - -#include "CondTools/Ecal/interface/EcalFloatCondObjectContainerHandler.h" - -typedef EcalFloatCondObjectContainerHandler EcalIntercalibErrorsHandler; - -#endif // _CondToolsEcal_EcalIntercalibErrorsHandler_h_ - -// Configure (x)emacs for this file ... -// Local Variables: -// mode:c++ -// compile-command: "scram b" -// End diff --git a/CondTools/Ecal/interface/EcalIntercalibErrorsXMLTranslator.h b/CondTools/Ecal/interface/EcalIntercalibErrorsXMLTranslator.h deleted file mode 100644 index eec459e867071..0000000000000 --- a/CondTools/Ecal/interface/EcalIntercalibErrorsXMLTranslator.h +++ /dev/null @@ -1,17 +0,0 @@ -/** - Translates a EcalIntercalibErrors record to XML - and vice versa - - \author Stefano ARGIRO - \version $Id: EcalIntercalibErrorsXMLTranslator.h,v 1.3 2009/06/30 16:15:16 argiro Exp $ - \date 20 Jun 2008 -*/ - -#ifndef __EcalIntercalibErrorsXMLTranslator_h_ -#define __EcalIntercalibErrorsXMLTranslator_h_ - -#include "CondTools/Ecal/interface/EcalFloatCondObjectContainerXMLTranslator.h" - -typedef EcalFloatCondObjectContainerXMLTranslator EcalIntercalibErrorsXMLTranslator; - -#endif // __EcalIntercalibErrorsXMLTranslator_h_ diff --git a/CondTools/Ecal/interface/EcalPFRecHitThresholdsMaker.h b/CondTools/Ecal/interface/EcalPFRecHitThresholdsMaker.h index 5dd0f16cc2672..08103e946489d 100644 --- a/CondTools/Ecal/interface/EcalPFRecHitThresholdsMaker.h +++ b/CondTools/Ecal/interface/EcalPFRecHitThresholdsMaker.h @@ -1,13 +1,13 @@ #ifndef ECALPFRECHITTHRESHOLDSMAKER_H #define ECALPFRECHITTHRESHOLDSMAKER_H -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "CondCore/CondDB/interface/Exception.h" #include "FWCore/Framework/interface/IOVSyncValue.h" - +#include "CondFormats/EcalObjects/interface/EcalPedestals.h" +#include "CondFormats/EcalObjects/interface/EcalIntercalibConstants.h" #include -#include namespace edm { class ParameterSet; @@ -15,7 +15,13 @@ namespace edm { class EventSetup; } // namespace edm -class EcalPFRecHitThresholdsMaker : public edm::EDAnalyzer { +class EcalPedestalsRcd; +class EcalADCToGeVConstant; +class EcalADCToGeVConstantRcd; +class EcalIntercalibConstantsRcd; +class EcalLaserDbService; +class EcalLaserDbRecord; +class EcalPFRecHitThresholdsMaker : public edm::one::EDAnalyzer<> { public: explicit EcalPFRecHitThresholdsMaker(const edm::ParameterSet& iConfig); ~EcalPFRecHitThresholdsMaker() override; @@ -25,6 +31,10 @@ class EcalPFRecHitThresholdsMaker : public edm::EDAnalyzer { private: std::string m_timetype; double m_nsigma; + edm::ESGetToken ecalPedestalsToken_; + edm::ESGetToken ecalADCToGeVConstantToken_; + edm::ESGetToken ecalIntercalibConstantsToken_; + edm::ESGetToken ecalLaserDbServiceToken_; }; #endif diff --git a/CondTools/Ecal/interface/EcalPFRecHitThresholdsXMLTranslator.h b/CondTools/Ecal/interface/EcalPFRecHitThresholdsXMLTranslator.h deleted file mode 100644 index 509ed640de898..0000000000000 --- a/CondTools/Ecal/interface/EcalPFRecHitThresholdsXMLTranslator.h +++ /dev/null @@ -1,17 +0,0 @@ -/** - Translates a EcalPFRecHitThresholds record to XML - and vice versa - - \author Stefano ARGIRO - \version $Id: EcalPFRecHitThresholdsXMLTranslator.h,v 1.2 2009/06/30 14:40:11 argiro Exp $ - \date 20 Jun 2008 -*/ - -#ifndef __EcalPFRecHitThresholdsXMLTranslator_h_ -#define __EcalPFRecHitThresholdsXMLTranslator_h_ - -#include "CondTools/Ecal/interface/EcalFloatCondObjectContainerXMLTranslator.h" - -typedef EcalFloatCondObjectContainerXMLTranslator EcalPFRecHitThresholdsXMLTranslator; - -#endif // __EcalPFRecHitThresholdsXMLTranslator_h_ diff --git a/CondTools/Ecal/interface/EcalTimeCalibConstantsHandler.h b/CondTools/Ecal/interface/EcalTimeCalibConstantsHandler.h deleted file mode 100644 index f48c154857f93..0000000000000 --- a/CondTools/Ecal/interface/EcalTimeCalibConstantsHandler.h +++ /dev/null @@ -1,18 +0,0 @@ -/** - \file - Declaration of class EcalTimeCalibConstantsHandler - - \author Seth COOPER - \version $Id: EcalTimeCalibConstantsHandler.h,v 1.1 2009/10/26 14:14:11 scooper Exp $ - \date 09 Sep 2008 -*/ - -#ifndef _CondToolsEcal_EcalTimeCalibConstantsHandler_h_ -#define _CondToolsEcal_EcalTimeCalibConstantsHandler_h_ - -#include "CondTools/Ecal/interface/EcalFloatCondObjectContainerHandler.h" - -typedef EcalFloatCondObjectContainerHandler EcalTimeCalibConstantsHandler; - -#endif - diff --git a/CondTools/Ecal/interface/EcalTimeCalibConstantsXMLTranslator.h b/CondTools/Ecal/interface/EcalTimeCalibConstantsXMLTranslator.h deleted file mode 100644 index 945623f0d7c1c..0000000000000 --- a/CondTools/Ecal/interface/EcalTimeCalibConstantsXMLTranslator.h +++ /dev/null @@ -1,19 +0,0 @@ -/** - Translates an EcalTimeCalibConstants record to XML - and vice versa - - \author Seth COOPER - \version $Id: EcalTimeCalibConstantsXMLTranslator.h,v 1.1 2009/10/26 16:15:16 scooper Exp $ - \date 20 Jun 2008 -*/ - -#ifndef __EcalTimeCalibConstantsXMLTranslator_h_ -#define __EcalTimeCalibConstantsXMLTranslator_h_ - -#include "CondTools/Ecal/interface/EcalFloatCondObjectContainerXMLTranslator.h" - -typedef EcalFloatCondObjectContainerXMLTranslator EcalTimeCalibConstantsXMLTranslator; - - -#endif // __EcalTimeCalibConstantsXMLTranslator_h_ - diff --git a/CondTools/Ecal/interface/EcalTimeCalibErrorsHandler.h b/CondTools/Ecal/interface/EcalTimeCalibErrorsHandler.h deleted file mode 100644 index b6b829e068020..0000000000000 --- a/CondTools/Ecal/interface/EcalTimeCalibErrorsHandler.h +++ /dev/null @@ -1,18 +0,0 @@ -/** - \file - Declaration of class EcalTimeCalibErrorsHandler - - \author Seth COOPER - \version $Id: EcalTimeCalibErrorsHandler.h,v 1.1 2009/10/26 14:14:11 scooper Exp $ - \date 09 Sep 2008 -*/ - -#ifndef _CondToolsEcal_EcalTimeCalibErrorsHandler_h_ -#define _CondToolsEcal_EcalTimeCalibErrorsHandler_h_ - -#include "CondTools/Ecal/interface/EcalFloatCondObjectContainerHandler.h" - -typedef EcalFloatCondObjectContainerHandler EcalTimeCalibErrorsHandler; - -#endif - diff --git a/CondTools/Ecal/interface/EcalTimeCalibErrorsXMLTranslator.h b/CondTools/Ecal/interface/EcalTimeCalibErrorsXMLTranslator.h deleted file mode 100644 index 241363a884e78..0000000000000 --- a/CondTools/Ecal/interface/EcalTimeCalibErrorsXMLTranslator.h +++ /dev/null @@ -1,19 +0,0 @@ -/** - Translates an EcalTimeCalibErrors record to XML - and vice versa - - \author Seth COOPER - \version $Id: EcalTimeCalibErrorsXMLTranslator.h,v 1.1 2009/10/26 16:15:16 scooper Exp $ - \date 20 Jun 2008 -*/ - -#ifndef __EcalTimeCalibErrorsXMLTranslator_h_ -#define __EcalTimeCalibErrorsXMLTranslator_h_ - -#include "CondTools/Ecal/interface/EcalFloatCondObjectContainerXMLTranslator.h" - -typedef EcalFloatCondObjectContainerXMLTranslator EcalTimeCalibErrorsXMLTranslator; - - -#endif // __EcalTimeCalibErrorsXMLTranslator_h_ - diff --git a/CondTools/Ecal/plugins/TestEcalChannelStatusAnalyzer.cc b/CondTools/Ecal/plugins/TestEcalChannelStatusAnalyzer.cc index a3a5ce72bf6c9..b53bf7d29c767 100644 --- a/CondTools/Ecal/plugins/TestEcalChannelStatusAnalyzer.cc +++ b/CondTools/Ecal/plugins/TestEcalChannelStatusAnalyzer.cc @@ -9,13 +9,12 @@ class ExTestEcalChannelStatusAnalyzer : public popcon::PopConAnalyzer(pset), m_populator(pset), - m_source(pset.getParameter("Source")) {} + m_source(pset.getParameter("Source")), + ecalElectronicsMappingToken_(esConsumes()) {} private: void analyze(const edm::Event& ev, const edm::EventSetup& iSetup) override { - edm::ESHandle eleMap; - iSetup.get().get(eleMap); - ecalElectronicsMap = eleMap.product(); + ecalElectronicsMap = &iSetup.getData(ecalElectronicsMappingToken_); } void endJob() override { @@ -29,6 +28,7 @@ class ExTestEcalChannelStatusAnalyzer : public popcon::PopConAnalyzer ecalElectronicsMappingToken_; }; //define this as a plug-in diff --git a/CondTools/Ecal/src/ESDBCopy.cc b/CondTools/Ecal/src/ESDBCopy.cc index 360c833f2b1e0..b3fbfa4a9c5c1 100644 --- a/CondTools/Ecal/src/ESDBCopy.cc +++ b/CondTools/Ecal/src/ESDBCopy.cc @@ -3,56 +3,44 @@ #include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/EventSetup.h" #include "CondTools/Ecal/interface/ESDBCopy.h" -#include "CondFormats/ESObjects/interface/ESPedestals.h" -#include "CondFormats/DataRecord/interface/ESPedestalsRcd.h" -#include "CondFormats/ESObjects/interface/ESADCToGeVConstant.h" -#include "CondFormats/DataRecord/interface/ESADCToGeVConstantRcd.h" -#include "CondFormats/ESObjects/interface/ESChannelStatus.h" -#include "CondFormats/DataRecord/interface/ESChannelStatusRcd.h" -#include "CondFormats/ESObjects/interface/ESIntercalibConstants.h" -#include "CondFormats/DataRecord/interface/ESIntercalibConstantsRcd.h" -#include "CondFormats/ESObjects/interface/ESWeightStripGroups.h" -#include "CondFormats/DataRecord/interface/ESWeightStripGroupsRcd.h" -#include "CondFormats/ESObjects/interface/ESTBWeights.h" -#include "CondFormats/DataRecord/interface/ESTBWeightsRcd.h" - #include ESDBCopy::ESDBCopy(const edm::ParameterSet& iConfig) - : m_timetype(iConfig.getParameter("timetype")), m_cacheIDs(), m_records() { + : m_timetype(iConfig.getParameter("timetype")), + m_cacheIDs(), + m_records(), + esPedestalsToken_(esConsumes()), + esADCToGeVConstantToken_(esConsumes()), + esChannelStatusToken_(esConsumes()), + esIntercalibConstantsToken_(esConsumes()), + esWeightStripGroupsToken_(esConsumes()), + esTBWeightsToken_(esConsumes()) { std::string container; - std::string tag; std::string record; typedef std::vector Parameters; Parameters toCopy = iConfig.getParameter("toCopy"); - for (Parameters::iterator i = toCopy.begin(); i != toCopy.end(); ++i) { - container = i->getParameter("container"); - record = i->getParameter("record"); - m_cacheIDs.insert(std::make_pair(container, 0)); - m_records.insert(std::make_pair(container, record)); + for (const auto& iparam : toCopy) { + container = iparam.getParameter("container"); + record = iparam.getParameter("record"); + m_cacheIDs.emplace(container, 0); + m_records.emplace(container, record); } } ESDBCopy::~ESDBCopy() {} void ESDBCopy::analyze(const edm::Event& evt, const edm::EventSetup& evtSetup) { - std::string container; - std::string record; - typedef std::map::const_iterator recordIter; - for (recordIter i = m_records.begin(); i != m_records.end(); ++i) { - container = (*i).first; - record = (*i).second; - if (shouldCopy(evtSetup, container)) { - copyToDB(evtSetup, container); + for (const auto& irec : m_records) { + if (shouldCopy(evtSetup, irec.first)) { + copyToDB(evtSetup, irec.first); } } } -bool ESDBCopy::shouldCopy(const edm::EventSetup& evtSetup, std::string container) { +bool ESDBCopy::shouldCopy(const edm::EventSetup& evtSetup, const std::string& container) { unsigned long long cacheID = 0; if (container == "ESPedestals") { cacheID = evtSetup.get().cacheIdentifier(); @@ -66,9 +54,7 @@ bool ESDBCopy::shouldCopy(const edm::EventSetup& evtSetup, std::string container cacheID = evtSetup.get().cacheIdentifier(); } else if (container == "ESChannelStatus") { cacheID = evtSetup.get().cacheIdentifier(); - } - - else { + } else { throw cms::Exception("Unknown container"); } @@ -80,7 +66,7 @@ bool ESDBCopy::shouldCopy(const edm::EventSetup& evtSetup, std::string container } } -void ESDBCopy::copyToDB(const edm::EventSetup& evtSetup, std::string container) { +void ESDBCopy::copyToDB(const edm::EventSetup& evtSetup, const std::string& container) { edm::Service dbOutput; if (!dbOutput.isAvailable()) { throw cms::Exception("PoolDBOutputService is not available"); @@ -89,52 +75,38 @@ void ESDBCopy::copyToDB(const edm::EventSetup& evtSetup, std::string container) std::string recordName = m_records[container]; if (container == "ESPedestals") { - edm::ESHandle handle; - evtSetup.get().get(handle); - const ESPedestals* obj = handle.product(); - std::cout << "ped pointer is: " << obj << std::endl; + const auto* obj = &evtSetup.getData(esPedestalsToken_); + edm::LogInfo("ESDBCopy") << "ped pointer is: " << obj; dbOutput->createNewIOV( new ESPedestals(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); } else if (container == "ESADCToGeVConstant") { - edm::ESHandle handle; - evtSetup.get().get(handle); - const ESADCToGeVConstant* obj = handle.product(); - std::cout << "adc pointer is: " << obj << std::endl; - + const auto* obj = &evtSetup.getData(esADCToGeVConstantToken_); + edm::LogInfo("ESDBCopy") << "adc pointer is: " << obj; dbOutput->createNewIOV( new ESADCToGeVConstant(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); } else if (container == "ESChannelStatus") { - edm::ESHandle handle; - evtSetup.get().get(handle); - const ESChannelStatus* obj = handle.product(); - std::cout << "channel status pointer is: " << obj << std::endl; - + const auto* obj = &evtSetup.getData(esChannelStatusToken_); + edm::LogInfo("ESDBCopy") << "channel status pointer is: " << obj; dbOutput->createNewIOV( new ESChannelStatus(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); } else if (container == "ESIntercalibConstants") { - edm::ESHandle handle; - evtSetup.get().get(handle); - const ESIntercalibConstants* obj = handle.product(); - std::cout << "inter pointer is: " << obj << std::endl; + const auto* obj = &evtSetup.getData(esIntercalibConstantsToken_); + edm::LogInfo("ESDBCopy") << "inter pointer is: " << obj; dbOutput->createNewIOV( new ESIntercalibConstants(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); } else if (container == "ESWeightStripGroups") { - edm::ESHandle handle; - evtSetup.get().get(handle); - const ESWeightStripGroups* obj = handle.product(); - std::cout << "weight pointer is: " << obj << std::endl; + const auto* obj = &evtSetup.getData(esWeightStripGroupsToken_); + edm::LogInfo("ESDBCopy") << "weight pointer is: " << obj; dbOutput->createNewIOV( new ESWeightStripGroups(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); } else if (container == "ESTBWeights") { - edm::ESHandle handle; - evtSetup.get().get(handle); - const ESTBWeights* obj = handle.product(); - std::cout << "tbweight pointer is: " << obj << std::endl; + const auto* obj = &evtSetup.getData(esTBWeightsToken_); + edm::LogInfo("ESDBCopy") << "tbweight pointer is: " << obj; dbOutput->createNewIOV( new ESTBWeights(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); @@ -142,5 +114,5 @@ void ESDBCopy::copyToDB(const edm::EventSetup& evtSetup, std::string container) throw cms::Exception("Unknown container"); } - std::cout << "ESDBCopy wrote " << recordName << std::endl; + edm::LogInfo("ESDBCopy") << "ESDBCopy wrote " << recordName; } diff --git a/CondTools/Ecal/src/EcalDBCopy.cc b/CondTools/Ecal/src/EcalDBCopy.cc index 2ea779c8b19de..1f04ce036df8e 100644 --- a/CondTools/Ecal/src/EcalDBCopy.cc +++ b/CondTools/Ecal/src/EcalDBCopy.cc @@ -1,67 +1,38 @@ #include "FWCore/ServiceRegistry/interface/Service.h" #include "CondCore/DBOutputService/interface/PoolDBOutputService.h" - #include "FWCore/ParameterSet/interface/ParameterSet.h" - #include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/EventSetup.h" - #include "CondTools/Ecal/interface/EcalDBCopy.h" -#include "CondFormats/EcalObjects/interface/EcalPedestals.h" #include "CondFormats/DataRecord/interface/EcalPedestalsRcd.h" #include "CondFormats/EcalObjects/interface/EcalADCToGeVConstant.h" #include "CondFormats/DataRecord/interface/EcalADCToGeVConstantRcd.h" -#include "CondFormats/EcalObjects/interface/EcalTimeCalibConstants.h" #include "CondFormats/DataRecord/interface/EcalTimeCalibConstantsRcd.h" -#include "CondFormats/EcalObjects/interface/EcalChannelStatus.h" #include "CondFormats/DataRecord/interface/EcalChannelStatusRcd.h" -#include "CondFormats/EcalObjects/interface/EcalLinearCorrections.h" #include "CondFormats/DataRecord/interface/EcalLinearCorrectionsRcd.h" -#include "CondFormats/EcalObjects/interface/EcalIntercalibConstants.h" #include "CondFormats/DataRecord/interface/EcalIntercalibConstantsRcd.h" -#include "CondFormats/EcalObjects/interface/EcalIntercalibConstantsMC.h" #include "CondFormats/DataRecord/interface/EcalIntercalibConstantsMCRcd.h" -#include "CondFormats/EcalObjects/interface/EcalIntercalibErrors.h" #include "CondFormats/DataRecord/interface/EcalIntercalibErrorsRcd.h" -#include "CondFormats/EcalObjects/interface/EcalGainRatios.h" #include "CondFormats/DataRecord/interface/EcalGainRatiosRcd.h" -#include "CondFormats/EcalObjects/interface/EcalWeightXtalGroups.h" #include "CondFormats/DataRecord/interface/EcalWeightXtalGroupsRcd.h" #include "CondFormats/EcalObjects/interface/EcalTBWeights.h" #include "CondFormats/DataRecord/interface/EcalTBWeightsRcd.h" -#include "CondFormats/EcalObjects/interface/EcalLaserAlphas.h" #include "CondFormats/DataRecord/interface/EcalLaserAlphasRcd.h" #include "CondFormats/EcalObjects/interface/EcalLaserAPDPNRatios.h" #include "CondFormats/DataRecord/interface/EcalLaserAPDPNRatiosRcd.h" -#include "CondFormats/EcalObjects/interface/EcalLaserAPDPNRatiosRef.h" #include "CondFormats/DataRecord/interface/EcalLaserAPDPNRatiosRefRcd.h" -#include "CondFormats/EcalObjects/interface/EcalTPGCrystalStatus.h" #include "CondFormats/DataRecord/interface/EcalTPGCrystalStatusRcd.h" #include "CondFormats/EcalObjects/interface/EcalTPGTowerStatus.h" #include "CondFormats/DataRecord/interface/EcalTPGTowerStatusRcd.h" - -#include "CondFormats/EcalObjects/interface/EcalDCSTowerStatus.h" #include "CondFormats/DataRecord/interface/EcalDCSTowerStatusRcd.h" -#include "CondFormats/EcalObjects/interface/EcalDAQTowerStatus.h" #include "CondFormats/DataRecord/interface/EcalDAQTowerStatusRcd.h" -#include "CondFormats/EcalObjects/interface/EcalDQMTowerStatus.h" #include "CondFormats/DataRecord/interface/EcalDQMTowerStatusRcd.h" -#include "CondFormats/EcalObjects/interface/EcalDQMChannelStatus.h" #include "CondFormats/DataRecord/interface/EcalDQMChannelStatusRcd.h" - -#include "CondFormats/EcalObjects/interface/EcalClusterCrackCorrParameters.h" #include "CondFormats/DataRecord/interface/EcalClusterCrackCorrParametersRcd.h" - -#include "CondFormats/EcalObjects/interface/EcalPFRecHitThresholds.h" #include "CondFormats/DataRecord/interface/EcalPFRecHitThresholdsRcd.h" - -#include "CondFormats/EcalObjects/interface/EcalClusterEnergyCorrectionParameters.h" #include "CondFormats/DataRecord/interface/EcalClusterEnergyCorrectionParametersRcd.h" -#include "CondFormats/EcalObjects/interface/EcalClusterEnergyUncertaintyParameters.h" #include "CondFormats/DataRecord/interface/EcalClusterEnergyUncertaintyParametersRcd.h" -#include "CondFormats/EcalObjects/interface/EcalClusterEnergyCorrectionObjectSpecificParameters.h" #include "CondFormats/DataRecord/interface/EcalClusterEnergyCorrectionObjectSpecificParametersRcd.h" -#include "CondFormats/EcalObjects/interface/EcalClusterLocalContCorrParameters.h" #include "CondFormats/DataRecord/interface/EcalClusterLocalContCorrParametersRcd.h" #include "CondFormats/Alignment/interface/Alignments.h" @@ -86,36 +57,66 @@ #include EcalDBCopy::EcalDBCopy(const edm::ParameterSet& iConfig) - : m_timetype(iConfig.getParameter("timetype")), m_cacheIDs(), m_records() { + : m_timetype(iConfig.getParameter("timetype")), + m_cacheIDs(), + m_records(), + ecalPedestalToken_(esConsumes()), + ecalADCtoGeVToken_(esConsumes()), + ecalTimeCalibToken_(esConsumes()), + ecalChannelStatusToken_(esConsumes()), + ecalDQMChannelStatusToken_(esConsumes()), + ecalDQMTowerStatusToken_(esConsumes()), + ecalDCSTowerStatusToken_(esConsumes()), + ecalDAQTowerStatusToken_(esConsumes()), + ecalTPGCrystalStatusToken_(esConsumes()), + ecalTPGTowerStatusToken_(esConsumes()), + ecalIntercalibConstantsToken_(esConsumes()), + ecalLinearCorrectionsToken_(esConsumes()), + ecalIntercalibConstantsMCToken_(esConsumes()), + ecalIntercalibErrorsToken_(esConsumes()), + ecalGainRatiosToken_(esConsumes()), + ecalWeightXtalGroupsToken_(esConsumes()), + ecalTBWeightsToken_(esConsumes()), + ecalLaserAlphasToken_(esConsumes()), + ecalLaserAPDPNRatiosToken_(esConsumes()), + ecalLaserAPDPNRatiosRefToken_(esConsumes()), + ecalClusterCrackCorrParametersToken_(esConsumes()), + ecalPFRecHitThresholdsToken_(esConsumes()), + ecalClusterEnergyUncertaintyParametersToken_(esConsumes()), + ecalClusterEnergyCorrectionParametersToken_(esConsumes()), + ecalClusterEnergyCorrectionObjectSpecificParametersToken_(esConsumes()), + ecalClusterLocalContCorrParametersToken_(esConsumes()), + ebAlignmentToken_(esConsumes()), + eeAlignmentToken_(esConsumes()), + esAlignmentToken_(esConsumes()), + ecalTimeOffsetConstantToken_(esConsumes()), + ecalSampleMaskToken_(esConsumes()), + ecalSimPulseShapeToken_(esConsumes()), + ecalTimeBiasCorrectionsToken_(esConsumes()), + ecalSamplesCorrelationToken_(esConsumes()) { std::string container; - std::string tag; std::string record; typedef std::vector Parameters; Parameters toCopy = iConfig.getParameter("toCopy"); - for (Parameters::iterator i = toCopy.begin(); i != toCopy.end(); ++i) { - container = i->getParameter("container"); - record = i->getParameter("record"); - m_cacheIDs.insert(std::make_pair(container, 0)); - m_records.insert(std::make_pair(container, record)); + for (auto& iparam : toCopy) { + container = iparam.getParameter("container"); + record = iparam.getParameter("record"); + m_cacheIDs.emplace(container, 0); + m_records.emplace(container, record); } } EcalDBCopy::~EcalDBCopy() {} void EcalDBCopy::analyze(const edm::Event& evt, const edm::EventSetup& evtSetup) { - std::string container; - std::string record; - typedef std::map::const_iterator recordIter; - for (recordIter i = m_records.begin(); i != m_records.end(); ++i) { - container = (*i).first; - record = (*i).second; - if (shouldCopy(evtSetup, container)) { - copyToDB(evtSetup, container); + for (const auto& irec : m_records) { + if (shouldCopy(evtSetup, irec.first)) { + copyToDB(evtSetup, irec.first); } } } -bool EcalDBCopy::shouldCopy(const edm::EventSetup& evtSetup, std::string container) { +bool EcalDBCopy::shouldCopy(const edm::EventSetup& evtSetup, const std::string& container) { unsigned long long cacheID = 0; if (container == "EcalPedestals") { cacheID = evtSetup.get().cacheIdentifier(); @@ -199,7 +200,7 @@ bool EcalDBCopy::shouldCopy(const edm::EventSetup& evtSetup, std::string contain } } -void EcalDBCopy::copyToDB(const edm::EventSetup& evtSetup, std::string container) { +void EcalDBCopy::copyToDB(const edm::EventSetup& evtSetup, const std::string& container) { edm::Service dbOutput; if (!dbOutput.isAvailable()) { throw cms::Exception("PoolDBOutputService is not available"); @@ -208,209 +209,160 @@ void EcalDBCopy::copyToDB(const edm::EventSetup& evtSetup, std::string container std::string recordName = m_records[container]; if (container == "EcalPedestals") { - edm::ESHandle handle; - evtSetup.get().get(handle); - const EcalPedestals* obj = handle.product(); - std::cout << "ped pointer is: " << obj << std::endl; + const EcalPedestals* obj = &evtSetup.getData(ecalPedestalToken_); + edm::LogInfo("EcalDBCopy") << "ped pointer is: " << obj << std::endl; dbOutput->createNewIOV( new EcalPedestals(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); } else if (container == "EcalADCToGeVConstant") { - edm::ESHandle handle; - evtSetup.get().get(handle); - const EcalADCToGeVConstant* obj = handle.product(); - std::cout << "adc pointer is: " << obj << std::endl; + const EcalADCToGeVConstant* obj = &evtSetup.getData(ecalADCtoGeVToken_); + edm::LogInfo("EcalDBCopy") << "adc pointer is: " << obj << std::endl; dbOutput->createNewIOV( new EcalADCToGeVConstant(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); } else if (container == "EcalTimeCalibConstants") { - edm::ESHandle handle; - evtSetup.get().get(handle); - const EcalTimeCalibConstants* obj = handle.product(); - std::cout << "adc pointer is: " << obj << std::endl; + const EcalTimeCalibConstants* obj = &evtSetup.getData(ecalTimeCalibToken_); + edm::LogInfo("EcalDBCopy") << "adc pointer is: " << obj << std::endl; dbOutput->createNewIOV( new EcalTimeCalibConstants(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); } else if (container == "EcalChannelStatus") { - edm::ESHandle handle; - evtSetup.get().get(handle); - const EcalChannelStatus* obj = handle.product(); - std::cout << "channel status pointer is: " << obj << std::endl; + const EcalChannelStatus* obj = &evtSetup.getData(ecalChannelStatusToken_); + edm::LogInfo("EcalDBCopy") << "channel status pointer is: " << obj << std::endl; dbOutput->createNewIOV( new EcalChannelStatus(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); } else if (container == "EcalDQMChannelStatus") { - edm::ESHandle handle; - evtSetup.get().get(handle); - const EcalDQMChannelStatus* obj = handle.product(); - std::cout << "DQM channel status pointer is: " << obj << std::endl; + const EcalDQMChannelStatus* obj = &evtSetup.getData(ecalDQMChannelStatusToken_); + edm::LogInfo("EcalDBCopy") << "DQM channel status pointer is: " << obj << std::endl; dbOutput->createNewIOV( new EcalDQMChannelStatus(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); } else if (container == "EcalDQMTowerStatus") { - edm::ESHandle handle; - evtSetup.get().get(handle); - const EcalDQMTowerStatus* obj = handle.product(); - std::cout << "DQM Tower status pointer is: " << obj << std::endl; + const EcalDQMTowerStatus* obj = &evtSetup.getData(ecalDQMTowerStatusToken_); + edm::LogInfo("EcalDBCopy") << "DQM Tower status pointer is: " << obj << std::endl; dbOutput->createNewIOV( new EcalDQMTowerStatus(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); } else if (container == "EcalDCSTowerStatus") { - edm::ESHandle handle; - evtSetup.get().get(handle); - const EcalDCSTowerStatus* obj = handle.product(); - std::cout << "channel status pointer is: " << obj << std::endl; + const EcalDCSTowerStatus* obj = &evtSetup.getData(ecalDCSTowerStatusToken_); + edm::LogInfo("EcalDBCopy") << "channel status pointer is: " << obj << std::endl; dbOutput->createNewIOV( new EcalDCSTowerStatus(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); } else if (container == "EcalDAQTowerStatus") { - edm::ESHandle handle; - evtSetup.get().get(handle); - const EcalDAQTowerStatus* obj = handle.product(); - std::cout << "DAQ channel status pointer is: " << obj << std::endl; + const EcalDAQTowerStatus* obj = &evtSetup.getData(ecalDAQTowerStatusToken_); + edm::LogInfo("EcalDBCopy") << "DAQ channel status pointer is: " << obj << std::endl; dbOutput->createNewIOV( new EcalDAQTowerStatus(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); } else if (container == "EcalTPGCrystalStatus") { - edm::ESHandle handle; - evtSetup.get().get(handle); - const EcalTPGCrystalStatus* obj = handle.product(); - std::cout << "TPG channel status pointer is: " << obj << std::endl; + const EcalTPGCrystalStatus* obj = &evtSetup.getData(ecalTPGCrystalStatusToken_); + edm::LogInfo("EcalDBCopy") << "TPG channel status pointer is: " << obj << std::endl; dbOutput->createNewIOV( new EcalTPGCrystalStatus(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); } else if (container == "EcalTPGTowerStatus") { - edm::ESHandle handle; - evtSetup.get().get(handle); - const EcalTPGTowerStatus* obj = handle.product(); - std::cout << "TPG tower status pointer is: " << obj << std::endl; + const EcalTPGTowerStatus* obj = &evtSetup.getData(ecalTPGTowerStatusToken_); + edm::LogInfo("EcalDBCopy") << "TPG tower status pointer is: " << obj << std::endl; dbOutput->createNewIOV( new EcalTPGTowerStatus(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); } else if (container == "EcalIntercalibConstants") { - edm::ESHandle handle; - evtSetup.get().get(handle); - const EcalIntercalibConstants* obj = handle.product(); - std::cout << "inter pointer is: " << obj << std::endl; + const EcalIntercalibConstants* obj = &evtSetup.getData(ecalIntercalibConstantsToken_); + edm::LogInfo("EcalDBCopy") << "inter pointer is: " << obj << std::endl; dbOutput->createNewIOV( new EcalIntercalibConstants(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); } else if (container == "EcalLinearCorrections") { - edm::ESHandle handle; - evtSetup.get().get(handle); - const EcalLinearCorrections* obj = handle.product(); - std::cout << "inter pointer is: " << obj << std::endl; + const EcalLinearCorrections* obj = &evtSetup.getData(ecalLinearCorrectionsToken_); + edm::LogInfo("EcalDBCopy") << "inter pointer is: " << obj << std::endl; dbOutput->createNewIOV( new EcalLinearCorrections(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); } else if (container == "EcalIntercalibConstantsMC") { - edm::ESHandle handle; - evtSetup.get().get(handle); - const EcalIntercalibConstantsMC* obj = handle.product(); - std::cout << "intercalib MC pointer is: " << obj << std::endl; + const EcalIntercalibConstantsMC* obj = &evtSetup.getData(ecalIntercalibConstantsMCToken_); + edm::LogInfo("EcalDBCopy") << "intercalib MC pointer is: " << obj << std::endl; dbOutput->createNewIOV( new EcalIntercalibConstantsMC(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); } else if (container == "EcalIntercalibErrors") { - edm::ESHandle handle; - evtSetup.get().get(handle); - const EcalIntercalibErrors* obj = handle.product(); - std::cout << "inter pointer is: " << obj << std::endl; + const EcalIntercalibErrors* obj = &evtSetup.getData(ecalIntercalibErrorsToken_); + edm::LogInfo("EcalDBCopy") << "inter pointer is: " << obj << std::endl; dbOutput->createNewIOV( new EcalIntercalibErrors(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); } else if (container == "EcalGainRatios") { - edm::ESHandle handle; - evtSetup.get().get(handle); - const EcalGainRatios* obj = handle.product(); - std::cout << "gain pointer is: " << obj << std::endl; + const EcalGainRatios* obj = &evtSetup.getData(ecalGainRatiosToken_); + edm::LogInfo("EcalDBCopy") << "gain pointer is: " << obj << std::endl; dbOutput->createNewIOV( new EcalGainRatios(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); } else if (container == "EcalWeightXtalGroups") { - edm::ESHandle handle; - evtSetup.get().get(handle); - const EcalWeightXtalGroups* obj = handle.product(); - std::cout << "weight pointer is: " << obj << std::endl; + const EcalWeightXtalGroups* obj = &evtSetup.getData(ecalWeightXtalGroupsToken_); + edm::LogInfo("EcalDBCopy") << "weight pointer is: " << obj << std::endl; dbOutput->createNewIOV( new EcalWeightXtalGroups(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); } else if (container == "EcalTBWeights") { - edm::ESHandle handle; - evtSetup.get().get(handle); - const EcalTBWeights* obj = handle.product(); - std::cout << "tbweight pointer is: " << obj << std::endl; + const EcalTBWeights* obj = &evtSetup.getData(ecalTBWeightsToken_); + edm::LogInfo("EcalDBCopy") << "tbweight pointer is: " << obj << std::endl; dbOutput->createNewIOV( new EcalTBWeights(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); } else if (container == "EcalLaserAlphas") { - edm::ESHandle handle; - evtSetup.get().get(handle); - const EcalLaserAlphas* obj = handle.product(); - std::cout << "ecalLaserAlpha pointer is: " << obj << std::endl; + const EcalLaserAlphas* obj = &evtSetup.getData(ecalLaserAlphasToken_); + edm::LogInfo("EcalDBCopy") << "ecalLaserAlpha pointer is: " << obj << std::endl; dbOutput->createNewIOV( new EcalLaserAlphas(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); } else if (container == "EcalLaserAPDPNRatios") { - edm::ESHandle handle; - evtSetup.get().get(handle); - const EcalLaserAPDPNRatios* obj = handle.product(); - std::cout << "tbweight pointer is: " << obj << std::endl; + const EcalLaserAPDPNRatios* obj = &evtSetup.getData(ecalLaserAPDPNRatiosToken_); + edm::LogInfo("EcalDBCopy") << "tbweight pointer is: " << obj << std::endl; dbOutput->createNewIOV( new EcalLaserAPDPNRatios(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); } else if (container == "EcalLaserAPDPNRatiosRef") { - edm::ESHandle handle; - evtSetup.get().get(handle); - const EcalLaserAPDPNRatiosRef* obj = handle.product(); - std::cout << "tbweight pointer is: " << obj << std::endl; + const EcalLaserAPDPNRatiosRef* obj = &evtSetup.getData(ecalLaserAPDPNRatiosRefToken_); + edm::LogInfo("EcalDBCopy") << "tbweight pointer is: " << obj << std::endl; dbOutput->createNewIOV( new EcalLaserAPDPNRatiosRef(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); } else if (container == "EcalClusterCrackCorrParameters") { - edm::ESHandle handle; - evtSetup.get().get(handle); - const EcalClusterCrackCorrParameters* obj = handle.product(); - std::cout << "cluster crack pointer is: " << obj << std::endl; + const EcalClusterCrackCorrParameters* obj = &evtSetup.getData(ecalClusterCrackCorrParametersToken_); + edm::LogInfo("EcalDBCopy") << "cluster crack pointer is: " << obj << std::endl; dbOutput->createNewIOV( new EcalClusterCrackCorrParameters(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); } else if (container == "EcalPFRecHitThresholds") { - edm::ESHandle handle; - evtSetup.get().get(handle); - const EcalPFRecHitThresholds* obj = handle.product(); - std::cout << "Ecal PF rec hit thresholds pointer is: " << obj << std::endl; + const EcalPFRecHitThresholds* obj = &evtSetup.getData(ecalPFRecHitThresholdsToken_); + edm::LogInfo("EcalDBCopy") << "Ecal PF rec hit thresholds pointer is: " << obj << std::endl; dbOutput->createNewIOV( new EcalPFRecHitThresholds(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); } else if (container == "EcalClusterEnergyUncertaintyParameters") { - edm::ESHandle handle; - evtSetup.get().get(handle); - const EcalClusterEnergyUncertaintyParameters* obj = handle.product(); - std::cout << "tbweight pointer is: " << obj << std::endl; + const EcalClusterEnergyUncertaintyParameters* obj = &evtSetup.getData(ecalClusterEnergyUncertaintyParametersToken_); + edm::LogInfo("EcalDBCopy") << "tbweight pointer is: " << obj << std::endl; dbOutput->createNewIOV( new EcalClusterEnergyUncertaintyParameters(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); } else if (container == "EcalClusterEnergyCorrectionParameters") { - edm::ESHandle handle; - evtSetup.get().get(handle); - const EcalClusterEnergyCorrectionParameters* obj = handle.product(); - std::cout << "tbweight pointer is: " << obj << std::endl; + const EcalClusterEnergyCorrectionParameters* obj = &evtSetup.getData(ecalClusterEnergyCorrectionParametersToken_); + edm::LogInfo("EcalDBCopy") << "tbweight pointer is: " << obj << std::endl; dbOutput->createNewIOV( new EcalClusterEnergyCorrectionParameters(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); } else if (container == "EcalClusterEnergyCorrectionObjectSpecificParameters") { - edm::ESHandle handle; - evtSetup.get().get(handle); - const EcalClusterEnergyCorrectionObjectSpecificParameters* obj = handle.product(); - std::cout << "tbweight pointer is: " << obj << std::endl; + const EcalClusterEnergyCorrectionObjectSpecificParameters* obj = + &evtSetup.getData(ecalClusterEnergyCorrectionObjectSpecificParametersToken_); + edm::LogInfo("EcalDBCopy") << "tbweight pointer is: " << obj << std::endl; dbOutput->createNewIOV( new EcalClusterEnergyCorrectionObjectSpecificParameters(*obj), dbOutput->beginOfTime(), @@ -418,65 +370,49 @@ void EcalDBCopy::copyToDB(const edm::EventSetup& evtSetup, std::string container recordName); } else if (container == "EcalClusterLocalContCorrParameters") { - edm::ESHandle handle; - evtSetup.get().get(handle); - const EcalClusterLocalContCorrParameters* obj = handle.product(); - std::cout << "tbweight pointer is: " << obj << std::endl; + const EcalClusterLocalContCorrParameters* obj = &evtSetup.getData(ecalClusterLocalContCorrParametersToken_); + edm::LogInfo("EcalDBCopy") << "tbweight pointer is: " << obj << std::endl; dbOutput->createNewIOV( new EcalClusterLocalContCorrParameters(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); } else if (container == "EBAlignment") { - edm::ESHandle handle; - evtSetup.get().get(handle); - const Alignments* obj = handle.product(); - std::cout << "EB alignment pointer is: " << obj << std::endl; + const Alignments* obj = &evtSetup.getData(ebAlignmentToken_); + edm::LogInfo("EcalDBCopy") << "EB alignment pointer is: " << obj << std::endl; dbOutput->createNewIOV( new Alignments(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); } else if (container == "EEAlignment") { - edm::ESHandle handle; - evtSetup.get().get(handle); - const Alignments* obj = handle.product(); - std::cout << "EE alignment pointer is: " << obj << std::endl; + const Alignments* obj = &evtSetup.getData(eeAlignmentToken_); + edm::LogInfo("EcalDBCopy") << "EE alignment pointer is: " << obj << std::endl; dbOutput->createNewIOV( new Alignments(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); } else if (container == "ESAlignment") { - edm::ESHandle handle; - evtSetup.get().get(handle); - const Alignments* obj = handle.product(); - std::cout << "ES alignment pointer is: " << obj << std::endl; + const Alignments* obj = &evtSetup.getData(esAlignmentToken_); + edm::LogInfo("EcalDBCopy") << "ES alignment pointer is: " << obj << std::endl; dbOutput->createNewIOV( new Alignments(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); } else if (container == "EcalTimeOffsetConstant") { - edm::ESHandle handle; - evtSetup.get().get(handle); - const EcalTimeOffsetConstant* obj = handle.product(); - std::cout << "TimeOffset pointer is: " << obj << std::endl; + const EcalTimeOffsetConstant* obj = &evtSetup.getData(ecalTimeOffsetConstantToken_); + edm::LogInfo("EcalDBCopy") << "TimeOffset pointer is: " << obj << std::endl; dbOutput->createNewIOV( new EcalTimeOffsetConstant(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); } else if (container == "EcalSampleMask") { - edm::ESHandle handle; - evtSetup.get().get(handle); - const EcalSampleMask* obj = handle.product(); - std::cout << "sample mask pointer is: " << obj << std::endl; + const EcalSampleMask* obj = &evtSetup.getData(ecalSampleMaskToken_); + edm::LogInfo("EcalDBCopy") << "sample mask pointer is: " << obj << std::endl; dbOutput->createNewIOV( new EcalSampleMask(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); } else if (container == "EcalSimPulseShape") { - edm::ESHandle handle; - evtSetup.get().get(handle); - const EcalSimPulseShape* obj = handle.product(); + const EcalSimPulseShape* obj = &evtSetup.getData(ecalSimPulseShapeToken_); dbOutput->createNewIOV( new EcalSimPulseShape(*obj), dbOutput->beginOfTime(), dbOutput->endOfTime(), recordName); } else if (container == "EcalTimeBiasCorrections") { - edm::ESHandle handle; - evtSetup.get().get(handle); - const EcalTimeBiasCorrections* obj = handle.product(); - std::cout << "TimeBiasCorrections pointer is: " << obj << std::endl; + const EcalTimeBiasCorrections* obj = &evtSetup.getData(ecalTimeBiasCorrectionsToken_); + edm::LogInfo("EcalDBCopy") << "TimeBiasCorrections pointer is: " << obj << std::endl; EcalTimeBiasCorrections* bias_; bias_ = new EcalTimeBiasCorrections(); std::vector vect = obj->EBTimeCorrAmplitudeBins; @@ -490,10 +426,8 @@ void EcalDBCopy::copyToDB(const edm::EventSetup& evtSetup, std::string container dbOutput->writeOne(bias_, dbOutput->beginOfTime(), "EcalTimeBiasCorrectionsRcd"); } else if (container == "EcalSamplesCorrelation") { - edm::ESHandle handle; - evtSetup.get().get(handle); - const EcalSamplesCorrelation* obj = handle.product(); - std::cout << "SamplesCorrelation pointer is: " << obj << std::endl; + const EcalSamplesCorrelation* obj = &evtSetup.getData(ecalSamplesCorrelationToken_); + edm::LogInfo("EcalDBCopy") << "SamplesCorrelation pointer is: " << obj << std::endl; EcalSamplesCorrelation* correl_; correl_ = new EcalSamplesCorrelation(); std::vector vect = obj->EBG12SamplesCorrelation; @@ -514,5 +448,5 @@ void EcalDBCopy::copyToDB(const edm::EventSetup& evtSetup, std::string container throw cms::Exception("Unknown container"); } - std::cout << "EcalDBCopy wrote " << recordName << std::endl; + edm::LogInfo("EcalDBCopy") << "EcalDBCopy wrote " << recordName << std::endl; } diff --git a/CondTools/Ecal/src/EcalGetLaserData.cc b/CondTools/Ecal/src/EcalGetLaserData.cc index 0040ce225e6a6..5d3a0f1d360ce 100644 --- a/CondTools/Ecal/src/EcalGetLaserData.cc +++ b/CondTools/Ecal/src/EcalGetLaserData.cc @@ -19,27 +19,38 @@ #include // user include files - -#include "FWCore/ServiceRegistry/interface/Service.h" -#include "CondCore/DBOutputService/interface/PoolDBOutputService.h" - #include "FWCore/Framework/interface/Frameworkfwd.h" #include "FWCore/Framework/interface/EDAnalyzer.h" - #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/MakerMacros.h" - +#include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Framework/interface/EventSetupRecordKey.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ServiceRegistry/interface/Service.h" +#include "FWCore/Framework/interface/IOVSyncValue.h" -#include "DataFormats/Common/interface/Handle.h" +#include "CondCore/CondDB/interface/Exception.h" +#include "CondCore/DBOutputService/interface/PoolDBOutputService.h" -#include "CondTools/Ecal/interface/EcalGetLaserData.h" +#include "CondFormats/EcalObjects/interface/EcalLaserAPDPNRatios.h" +#include "CondFormats/DataRecord/interface/EcalLaserAPDPNRatiosRcd.h" +#include "CondFormats/EcalObjects/interface/EcalLaserAPDPNRatiosRef.h" +#include "CondFormats/DataRecord/interface/EcalLaserAPDPNRatiosRefRcd.h" +#include "CondFormats/EcalObjects/interface/EcalLaserAlphas.h" +#include "CondFormats/DataRecord/interface/EcalLaserAlphasRcd.h" -#include "FWCore/Framework/interface/ESHandle.h" -#include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/Framework/interface/EventSetupRecordKey.h" +#include "OnlineDB/EcalCondDB/interface/all_monitoring_types.h" +#include "OnlineDB/Oracle/interface/Oracle.h" +#include "OnlineDB/EcalCondDB/interface/EcalCondDBInterface.h" -#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "DataFormats/EcalDetId/interface/EBDetId.h" +#include "DataFormats/EcalDetId/interface/EEDetId.h" + +#include "DataFormats/Common/interface/Handle.h" + +#include "CondTools/Ecal/interface/EcalGetLaserData.h" // // constants, enums and typedefs @@ -55,21 +66,21 @@ EcalGetLaserData::EcalGetLaserData(const edm::ParameterSet& iConfig) : // m_timetype(iConfig.getParameter("timetype")), m_cacheIDs(), - m_records() { - std::string container; - std::string tag; - std::string record; - + m_records(), + ecalLaserAPDPNRatiosToken_(esConsumes()), + ecalLaserAPDPNRatiosRefToken_(esConsumes()), + ecalLaserAlphasToken_(esConsumes()) { //m_firstRun=(unsigned long long)atoi( iConfig.getParameter("firstRun").c_str()); //m_lastRun=(unsigned long long)atoi( iConfig.getParameter("lastRun").c_str()); - + std::string container; + std::string record; typedef std::vector Parameters; Parameters toGet = iConfig.getParameter("toGet"); - for (Parameters::iterator i = toGet.begin(); i != toGet.end(); ++i) { - container = i->getParameter("container"); - record = i->getParameter("record"); - m_cacheIDs.insert(std::make_pair(container, 0)); - m_records.insert(std::make_pair(container, record)); + for (const auto& iparam : toGet) { + container = iparam.getParameter("container"); + record = iparam.getParameter("record"); + m_cacheIDs.emplace(container, 0); + m_records.emplace(container, record); } //now do what ever initialization is needed } @@ -88,26 +99,19 @@ void EcalGetLaserData::analyze(const edm::Event& evt, const edm::EventSetup& evt using namespace edm; // loop on offline DB conditions to be transferred as from config file - std::string container; - std::string record; - typedef std::map::const_iterator recordIter; - for (recordIter i = m_records.begin(); i != m_records.end(); ++i) { - container = (*i).first; - record = (*i).second; - - std::string recordName = m_records[container]; + for (const auto& irec : m_records) { + const std::string& container = irec.first; + //record = irec.second; if (container == "EcalLaserAPDPNRatios") { // get from offline DB the last valid laser set - edm::ESHandle handle; - evtSetup.get().get(handle); - + const EcalLaserAPDPNRatios* laserapdpnrRatios = &evtSetup.getData(ecalLaserAPDPNRatiosToken_); // this is the offline object EcalLaserAPDPNRatios::EcalLaserTimeStamp timestamp; EcalLaserAPDPNRatios::EcalLaserAPDPNpair apdpnpair; - const EcalLaserAPDPNRatios::EcalLaserAPDPNRatiosMap& laserRatiosMap = handle.product()->getLaserMap(); - const EcalLaserAPDPNRatios::EcalLaserTimeStampMap& laserTimeMap = handle.product()->getTimeMap(); + const EcalLaserAPDPNRatios::EcalLaserAPDPNRatiosMap& laserRatiosMap = laserapdpnrRatios->getLaserMap(); + const EcalLaserAPDPNRatios::EcalLaserTimeStampMap& laserTimeMap = laserapdpnrRatios->getTimeMap(); // loop through ecal barrel for (int iEta = -EBDetId::MAX_IETA; iEta <= EBDetId::MAX_IETA; ++iEta) { @@ -119,8 +123,8 @@ void EcalGetLaserData::analyze(const edm::Event& evt, const edm::EventSetup& evt if (hi < static_cast(laserRatiosMap.size())) { apdpnpair = laserRatiosMap[hi]; - std::cout << "A sample value of APDPN pair EB : " << hi << " : " << apdpnpair.p1 << " , " << apdpnpair.p2 - << std::endl; + edm::LogInfo("EcalGetLaserData") << "A sample value of APDPN pair EB : " << hi << " : " << apdpnpair.p1 + << " , " << apdpnpair.p2 << std::endl; } else { edm::LogError("EcalGetLaserData") << "error with laserRatiosMap!" << std::endl; } @@ -138,8 +142,8 @@ void EcalGetLaserData::analyze(const edm::Event& evt, const edm::EventSetup& evt if (hi < static_cast(laserRatiosMap.size())) { apdpnpair = laserRatiosMap[hi]; - std::cout << "A sample value of APDPN pair EE+ : " << hi << " : " << apdpnpair.p1 << " , " << apdpnpair.p2 - << std::endl; + edm::LogInfo("EcalGetLaserData") << "A sample value of APDPN pair EE+ : " << hi << " : " << apdpnpair.p1 + << " , " << apdpnpair.p2 << std::endl; } else { edm::LogError("EcalGetLaserData") << "error with laserRatiosMap!" << std::endl; } @@ -151,8 +155,8 @@ void EcalGetLaserData::analyze(const edm::Event& evt, const edm::EventSetup& evt if (hi < static_cast(laserRatiosMap.size())) { apdpnpair = laserRatiosMap[hi]; - std::cout << "A sample value of APDPN pair EE- : " << hi << " : " << apdpnpair.p1 << " , " << apdpnpair.p2 - << std::endl; + edm::LogInfo("EcalGetLaserData") << "A sample value of APDPN pair EE- : " << hi << " : " << apdpnpair.p1 + << " , " << apdpnpair.p2 << std::endl; } else { edm::LogError("EcalGetLaserData") << "error with laserRatiosMap!" << std::endl; } @@ -161,19 +165,16 @@ void EcalGetLaserData::analyze(const edm::Event& evt, const edm::EventSetup& evt for (int i = 0; i < 92; i++) { timestamp = laserTimeMap[i]; - std::cout << "A value of timestamp pair : " << i << " " << timestamp.t1.value() << " , " << timestamp.t2.value() - << std::endl; + edm::LogInfo("EcalGetLaserData") << "A value of timestamp pair : " << i << " " << timestamp.t1.value() << " , " + << timestamp.t2.value() << std::endl; } - std::cout << ".. just retrieved the last valid record from DB " << std::endl; + edm::LogInfo("EcalGetLaserData") << ".. just retrieved the last valid record from DB " << std::endl; } else if (container == "EcalLaserAPDPNRatiosRef") { // get from offline DB the last valid laser set - edm::ESHandle handle; - evtSetup.get().get(handle); - EcalLaserAPDPNref apdpnref; - const EcalLaserAPDPNRatiosRefMap& laserRefMap = handle.product()->getMap(); + const EcalLaserAPDPNRatiosRefMap& laserRefMap = (&evtSetup.getData(ecalLaserAPDPNRatiosRefToken_))->getMap(); // first barrel for (int iEta = -EBDetId::MAX_IETA; iEta <= EBDetId::MAX_IETA; ++iEta) { @@ -185,7 +186,8 @@ void EcalGetLaserData::analyze(const edm::Event& evt, const edm::EventSetup& evt if (hi < static_cast(laserRefMap.size())) { apdpnref = laserRefMap[hi]; - std::cout << "A sample value of APDPN Reference value EB : " << hi << " : " << apdpnref << std::endl; + edm::LogInfo("EcalGetLaserData") + << "A sample value of APDPN Reference value EB : " << hi << " : " << apdpnref << std::endl; } else { edm::LogError("EcalGetLaserData") << "error with laserRefMap!" << std::endl; } @@ -203,7 +205,8 @@ void EcalGetLaserData::analyze(const edm::Event& evt, const edm::EventSetup& evt if (hi < static_cast(laserRefMap.size())) { apdpnref = laserRefMap[hi]; - std::cout << "A sample value of APDPN Reference value EE+ : " << hi << " : " << apdpnref << std::endl; + edm::LogInfo("EcalGetLaserData") + << "A sample value of APDPN Reference value EE+ : " << hi << " : " << apdpnref << std::endl; } else { edm::LogError("EcalGetLaserData") << "error with laserRefMap!" << std::endl; @@ -216,23 +219,21 @@ void EcalGetLaserData::analyze(const edm::Event& evt, const edm::EventSetup& evt if (hi < static_cast(laserRefMap.size())) { apdpnref = laserRefMap[hi]; - std::cout << "A sample value of APDPN Reference value EE- : " << hi << " : " << apdpnref << std::endl; + edm::LogInfo("EcalGetLaserData") + << "A sample value of APDPN Reference value EE- : " << hi << " : " << apdpnref << std::endl; } else { edm::LogError("EcalGetLaserData") << "error with laserRefMap!" << std::endl; } } } - std::cout << "... just retrieved the last valid record from DB " << std::endl; + edm::LogInfo("EcalGetLaserData") << "... just retrieved the last valid record from DB " << std::endl; } else if (container == "EcalLaserAlphas") { // get from offline DB the last valid laser set - edm::ESHandle handle; - evtSetup.get().get(handle); - // this is the offline object EcalLaserAlpha alpha; - const EcalLaserAlphaMap& laserAlphaMap = handle.product()->getMap(); // map of apdpns + const EcalLaserAlphaMap& laserAlphaMap = (&evtSetup.getData(ecalLaserAlphasToken_))->getMap(); // map of apdpns // first barrel for (int iEta = -EBDetId::MAX_IETA; iEta <= EBDetId::MAX_IETA; ++iEta) { @@ -244,7 +245,8 @@ void EcalGetLaserData::analyze(const edm::Event& evt, const edm::EventSetup& evt if (hi < static_cast(laserAlphaMap.size())) { alpha = laserAlphaMap[hi]; - std::cout << " A sample value of Alpha value EB : " << hi << " : " << alpha << std::endl; + edm::LogInfo("EcalGetLaserData") + << " A sample value of Alpha value EB : " << hi << " : " << alpha << std::endl; } else { edm::LogError("EcalGetLaserData") << "error with laserAlphaMap!" << std::endl; } @@ -262,7 +264,8 @@ void EcalGetLaserData::analyze(const edm::Event& evt, const edm::EventSetup& evt if (hi < static_cast(laserAlphaMap.size())) { alpha = laserAlphaMap[hi]; - std::cout << " A sample value of Alpha value EE+ : " << hi << " : " << alpha << std::endl; + edm::LogInfo("EcalGetLaserData") + << " A sample value of Alpha value EE+ : " << hi << " : " << alpha << std::endl; } else { edm::LogError("EcalGetLaserData") << "error with laserAlphaMap!" << std::endl; } @@ -274,14 +277,15 @@ void EcalGetLaserData::analyze(const edm::Event& evt, const edm::EventSetup& evt if (hi < static_cast(laserAlphaMap.size())) { alpha = laserAlphaMap[hi]; - std::cout << " A sample value of Alpha value EE- : " << hi << " : " << alpha << std::endl; + edm::LogInfo("EcalGetLaserData") + << " A sample value of Alpha value EE- : " << hi << " : " << alpha << std::endl; } else { edm::LogError("EcalGetLaserData") << "error with laserAlphaMap!" << std::endl; } } } - std::cout << "... just retrieved the last valid record from DB " << std::endl; + edm::LogInfo("EcalGetLaserData") << "... just retrieved the last valid record from DB " << std::endl; } else { edm::LogError("EcalGetLaserData") << "Cannot retrieve for container: " << container << std::endl; diff --git a/CondTools/Ecal/src/EcalPFRecHitThresholdsMaker.cc b/CondTools/Ecal/src/EcalPFRecHitThresholdsMaker.cc index a9038062963a3..e897c83b43209 100644 --- a/CondTools/Ecal/src/EcalPFRecHitThresholdsMaker.cc +++ b/CondTools/Ecal/src/EcalPFRecHitThresholdsMaker.cc @@ -1,102 +1,27 @@ #include "FWCore/ServiceRegistry/interface/Service.h" #include "CondCore/DBOutputService/interface/PoolDBOutputService.h" - #include "FWCore/ParameterSet/interface/ParameterSet.h" - #include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/EventSetup.h" - #include "FWCore/Framework/interface/Event.h" - #include "CalibCalorimetry/EcalLaserCorrection/interface/EcalLaserDbService.h" #include "CalibCalorimetry/EcalLaserCorrection/interface/EcalLaserDbRecord.h" - #include "CondTools/Ecal/interface/EcalPFRecHitThresholdsMaker.h" -#include "CondFormats/EcalObjects/interface/EcalPedestals.h" +#include "CondFormats/EcalObjects/interface/EcalPFRecHitThresholds.h" +#include "CondFormats/DataRecord/interface/EcalPFRecHitThresholdsRcd.h" #include "CondFormats/DataRecord/interface/EcalPedestalsRcd.h" +#include "CondFormats/DataRecord/interface/EcalIntercalibConstantsRcd.h" #include "CondFormats/EcalObjects/interface/EcalADCToGeVConstant.h" #include "CondFormats/DataRecord/interface/EcalADCToGeVConstantRcd.h" -#include "CondFormats/EcalObjects/interface/EcalTimeCalibConstants.h" -#include "CondFormats/DataRecord/interface/EcalTimeCalibConstantsRcd.h" -#include "CondFormats/EcalObjects/interface/EcalChannelStatus.h" -#include "CondFormats/DataRecord/interface/EcalChannelStatusRcd.h" -#include "CondFormats/EcalObjects/interface/EcalLinearCorrections.h" -#include "CondFormats/DataRecord/interface/EcalLinearCorrectionsRcd.h" -#include "CondFormats/EcalObjects/interface/EcalIntercalibConstants.h" -#include "CondFormats/DataRecord/interface/EcalIntercalibConstantsRcd.h" -#include "CondFormats/EcalObjects/interface/EcalIntercalibConstantsMC.h" -#include "CondFormats/DataRecord/interface/EcalIntercalibConstantsMCRcd.h" -#include "CondFormats/EcalObjects/interface/EcalIntercalibErrors.h" -#include "CondFormats/DataRecord/interface/EcalIntercalibErrorsRcd.h" -#include "CondFormats/EcalObjects/interface/EcalGainRatios.h" -#include "CondFormats/DataRecord/interface/EcalGainRatiosRcd.h" -#include "CondFormats/EcalObjects/interface/EcalWeightXtalGroups.h" -#include "CondFormats/DataRecord/interface/EcalWeightXtalGroupsRcd.h" -#include "CondFormats/EcalObjects/interface/EcalTBWeights.h" -#include "CondFormats/DataRecord/interface/EcalTBWeightsRcd.h" -#include "CondFormats/EcalObjects/interface/EcalLaserAlphas.h" -#include "CondFormats/DataRecord/interface/EcalLaserAlphasRcd.h" -#include "CondFormats/EcalObjects/interface/EcalLaserAPDPNRatios.h" -#include "CondFormats/DataRecord/interface/EcalLaserAPDPNRatiosRcd.h" -#include "CondFormats/EcalObjects/interface/EcalLaserAPDPNRatiosRef.h" -#include "CondFormats/DataRecord/interface/EcalLaserAPDPNRatiosRefRcd.h" -#include "CondFormats/EcalObjects/interface/EcalTPGCrystalStatus.h" -#include "CondFormats/DataRecord/interface/EcalTPGCrystalStatusRcd.h" -#include "CondFormats/EcalObjects/interface/EcalTPGTowerStatus.h" -#include "CondFormats/DataRecord/interface/EcalTPGTowerStatusRcd.h" - -#include "CondFormats/EcalObjects/interface/EcalDCSTowerStatus.h" -#include "CondFormats/DataRecord/interface/EcalDCSTowerStatusRcd.h" -#include "CondFormats/EcalObjects/interface/EcalDAQTowerStatus.h" -#include "CondFormats/DataRecord/interface/EcalDAQTowerStatusRcd.h" -#include "CondFormats/EcalObjects/interface/EcalDQMTowerStatus.h" -#include "CondFormats/DataRecord/interface/EcalDQMTowerStatusRcd.h" -#include "CondFormats/EcalObjects/interface/EcalDQMChannelStatus.h" -#include "CondFormats/DataRecord/interface/EcalDQMChannelStatusRcd.h" - -#include "CondFormats/EcalObjects/interface/EcalClusterCrackCorrParameters.h" -#include "CondFormats/DataRecord/interface/EcalClusterCrackCorrParametersRcd.h" - -#include "CondFormats/EcalObjects/interface/EcalPFRecHitThresholds.h" -#include "CondFormats/DataRecord/interface/EcalPFRecHitThresholdsRcd.h" - -#include "CondFormats/EcalObjects/interface/EcalClusterEnergyCorrectionParameters.h" -#include "CondFormats/DataRecord/interface/EcalClusterEnergyCorrectionParametersRcd.h" -#include "CondFormats/EcalObjects/interface/EcalClusterEnergyUncertaintyParameters.h" -#include "CondFormats/DataRecord/interface/EcalClusterEnergyUncertaintyParametersRcd.h" -#include "CondFormats/EcalObjects/interface/EcalClusterEnergyCorrectionObjectSpecificParameters.h" -#include "CondFormats/DataRecord/interface/EcalClusterEnergyCorrectionObjectSpecificParametersRcd.h" -#include "CondFormats/EcalObjects/interface/EcalClusterLocalContCorrParameters.h" -#include "CondFormats/DataRecord/interface/EcalClusterLocalContCorrParametersRcd.h" - -#include "CondFormats/Alignment/interface/Alignments.h" -#include "CondFormats/AlignmentRecord/interface/EBAlignmentRcd.h" -#include "CondFormats/AlignmentRecord/interface/EEAlignmentRcd.h" -#include "CondFormats/AlignmentRecord/interface/ESAlignmentRcd.h" -#include "CondFormats/EcalObjects/interface/EcalTimeOffsetConstant.h" -#include "CondFormats/DataRecord/interface/EcalTimeOffsetConstantRcd.h" - -#include "CondFormats/EcalObjects/interface/EcalSampleMask.h" -#include "CondFormats/DataRecord/interface/EcalSampleMaskRcd.h" - -#include "CondFormats/EcalObjects/interface/EcalTimeBiasCorrections.h" -#include "CondFormats/DataRecord/interface/EcalTimeBiasCorrectionsRcd.h" - -#include "CondFormats/EcalObjects/interface/EcalSamplesCorrelation.h" -#include "CondFormats/DataRecord/interface/EcalSamplesCorrelationRcd.h" - -#include "DataFormats/Provenance/interface/Timestamp.h" - -#include "CondCore/DBOutputService/interface/PoolDBOutputService.h" #include EcalPFRecHitThresholdsMaker::EcalPFRecHitThresholdsMaker(const edm::ParameterSet& iConfig) - : m_timetype(iConfig.getParameter("timetype")) { - std::string container; - std::string tag; - std::string record; - + : m_timetype(iConfig.getParameter("timetype")), + ecalPedestalsToken_(esConsumes()), + ecalADCToGeVConstantToken_(esConsumes()), + ecalIntercalibConstantsToken_(esConsumes()), + ecalLaserDbServiceToken_(esConsumes()) { m_nsigma = iConfig.getParameter("NSigma"); } @@ -108,23 +33,16 @@ void EcalPFRecHitThresholdsMaker::analyze(const edm::Event& evt, const edm::Even throw cms::Exception("PoolDBOutputService is not available"); } - edm::ESHandle handle1; - evtSetup.get().get(handle1); - const EcalPedestals* ped_db = handle1.product(); - std::cout << "ped pointer is: " << ped_db << std::endl; + const EcalPedestals* ped_db = &evtSetup.getData(ecalPedestalsToken_); + edm::LogInfo("EcalPFRecHitThresholdsMaker") << "ped pointer is: " << ped_db << std::endl; - edm::ESHandle handle2; - evtSetup.get().get(handle2); - const EcalADCToGeVConstant* adc_db = handle2.product(); - std::cout << "adc pointer is: " << adc_db << std::endl; + const EcalADCToGeVConstant* adc_db = &evtSetup.getData(ecalADCToGeVConstantToken_); + edm::LogInfo("EcalPFRecHitThresholdsMaker") << "adc pointer is: " << adc_db << std::endl; - edm::ESHandle handle3; - evtSetup.get().get(handle3); - const EcalIntercalibConstants* ical_db = handle3.product(); - std::cout << "inter pointer is: " << ical_db << std::endl; + const EcalIntercalibConstants* ical_db = &evtSetup.getData(ecalIntercalibConstantsToken_); + edm::LogInfo("EcalPFRecHitThresholdsMaker") << "inter pointer is: " << ical_db << std::endl; - edm::ESHandle laser; - evtSetup.get().get(laser); + const auto laser = evtSetup.getHandle(ecalLaserDbServiceToken_); EcalPFRecHitThresholds* pfthresh = new EcalPFRecHitThresholds(); @@ -155,7 +73,7 @@ void EcalPFRecHitThresholdsMaker::analyze(const edm::Event& evt, const edm::Even EcalPFRecHitThreshold thresh = aped.rms_x12 * calib * adc_EB * lasercalib * m_nsigma; if (iPhi == 100) - std::cout << "Thresh(GeV)=" << thresh << std::endl; + edm::LogInfo("EcalPFRecHitThresholdsMaker") << "Thresh(GeV)=" << thresh << std::endl; pfthresh->insert(std::make_pair(ebdetid.rawId(), thresh)); } @@ -198,7 +116,7 @@ void EcalPFRecHitThresholdsMaker::analyze(const edm::Event& evt, const edm::Even pfthresh->insert(std::make_pair(eedetid.rawId(), thresh)); if (iX == 50) - std::cout << "Thresh(GeV)=" << thresh << std::endl; + edm::LogInfo("EcalPFRecHitThresholdsMaker") << "Thresh(GeV)=" << thresh << std::endl; } } } @@ -206,5 +124,5 @@ void EcalPFRecHitThresholdsMaker::analyze(const edm::Event& evt, const edm::Even dbOutput->createNewIOV( pfthresh, dbOutput->beginOfTime(), dbOutput->endOfTime(), "EcalPFRecHitThresholdsRcd"); - std::cout << "EcalPFRecHitThresholdsMaker wrote it " << std::endl; + edm::LogInfo("EcalPFRecHitThresholdsMaker") << "EcalPFRecHitThresholdsMaker wrote it " << std::endl; } diff --git a/CondTools/Ecal/src/EcalTPGOddWeightIdMapHandler.cc b/CondTools/Ecal/src/EcalTPGOddWeightIdMapHandler.cc index f744a85bd144e..d273829021fd8 100644 --- a/CondTools/Ecal/src/EcalTPGOddWeightIdMapHandler.cc +++ b/CondTools/Ecal/src/EcalTPGOddWeightIdMapHandler.cc @@ -45,35 +45,35 @@ void popcon::EcalTPGOddWeightIdMapHandler::getNewObjects() { } else if (m_file_type == "xml") { readxmlFile(); } else { - edm::LogInfo("EcalTPGOddWeightIdMapHandler") << "Started GetNewObjects!!!"; + edm::LogVerbatim("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; + edm::LogVerbatim("EcalTPGOddWeightIdMapHandler") << "got offlineInfo = "; + edm::LogVerbatim("EcalTPGOddWeightIdMapHandler") << "tag name = " << tagInfo().name; + edm::LogVerbatim("EcalTPGOddWeightIdMapHandler") << "size = " << tagInfo().size; + } else { - std::cout << " First object for this tag " << std::endl; + edm::LogVerbatim("EcalTPGOddWeightIdMapHandler") << " First object for this tag "; } unsigned int max_since = 0; max_since = static_cast(tagInfo().lastInterval.since); - edm::LogInfo("EcalTPGOddWeightIdMapHandler") << "max_since : " << max_since; - //Ref weightIdMap_db = lastPayload(); + edm::LogVerbatim("EcalTPGOddWeightIdMapHandler") << "max_since : " << max_since; - edm::LogInfo("EcalTPGOddWeightIdMapHandler") << "retrieved last payload "; + edm::LogVerbatim("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::LogVerbatim("EcalTPGOddWeightIdMapHandler") << "Retrieving run list from ONLINE DB ... "; + + edm::LogVerbatim("EcalTPGOddWeightIdMapHandler") << "Making connection..."; + auto econn = std::make_shared(m_sid, m_user, m_pass); - edm::LogInfo("EcalTPGOddWeightIdMapHandler") << "Making connection..."; - econn = new EcalCondDBInterface(m_sid, m_user, m_pass); - edm::LogInfo("EcalTPGOddWeightIdMapHandler") << "Done."; + edm::LogVerbatim("EcalTPGOddWeightIdMapHandler") << "Done."; if (!econn) { - std::cout << " connection parameters " << m_sid << "/" << m_user << std::endl; - // cerr << e.what() << std::endl; + edm::LogVerbatim("EcalTPGOddWeightIdMapHandler") << " connection parameters " << m_sid << "/" << m_user; throw cms::Exception("OMDS not available"); } @@ -101,29 +101,27 @@ void popcon::EcalTPGOddWeightIdMapHandler::getNewObjects() { 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; + edm::LogVerbatim("EcalTPGOddWeightIdMapHandler") + << "m_i_run_number" << m_i_run_number << "m_firstRun " << m_firstRun << "max_since " << max_since; unsigned int max_run = m_lastRun; - edm::LogInfo("EcalTPGOddWeightIdMapHandler") << "min_run= " << min_run << "max_run= " << max_run; + edm::LogVerbatim("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; + edm::LogVerbatim("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; + edm::LogVerbatim("EcalTPGOddWeightIdMapHandler") << " **************** "; + edm::LogVerbatim("EcalTPGOddWeightIdMapHandler") << " **************** "; + edm::LogVerbatim("EcalTPGOddWeightIdMapHandler") << " run= " << irun; // retrieve the data : std::map dataset; @@ -137,7 +135,6 @@ void popcon::EcalTPGOddWeightIdMapHandler::getNewObjects() { 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(); @@ -145,22 +142,23 @@ void popcon::EcalTPGOddWeightIdMapHandler::getNewObjects() { // 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; + edm::LogVerbatim("EcalTPGOddWeightIdMapHandler") + << " run= " << irun << " tag " << the_config_tag << " version=" << the_config_version; // 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; + edm::LogVerbatim("EcalTPGOddWeightIdMapHandler") + << "the tag is different from last transferred run ... retrieving last config set from DB"; 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; + edm::LogVerbatim("EcalTPGOddWeightIdMapHandler") << " before fetch config set"; econn->fetchConfigSet(&fe_main_info); - std::cout << " after fetch config set" << std::endl; + edm::LogVerbatim("EcalTPGOddWeightIdMapHandler") << " after fetch config set"; // now get TPGOddWeightIdMap int weightId = fe_main_info.getWei2Id(); @@ -171,7 +169,7 @@ void popcon::EcalTPGOddWeightIdMapHandler::getNewObjects() { econn->fetchConfigSet(&fe_odd_weight_info); std::map dataset_TpgWeight; econn->fetchDataSet(&dataset_TpgWeight, &fe_odd_weight_info); - edm::LogInfo("EcalTPGOddWeightIdMapHandler") << "Got object!"; + edm::LogVerbatim("EcalTPGOddWeightIdMapHandler") << "Got object!"; EcalTPGOddWeightIdMap* weightMap = new EcalTPGOddWeightIdMap; typedef std::map::const_iterator CIfeweight; EcalLogicID ecid_xt; @@ -194,7 +192,7 @@ void popcon::EcalTPGOddWeightIdMapHandler::getNewObjects() { ++igroups; } - edm::LogInfo("EcalTPGOddWeightIdMapHandler") << "found " << igroups << "Weight groups"; + edm::LogVerbatim("EcalTPGOddWeightIdMapHandler") << "found " << igroups << "Weight groups"; Time_t snc = (Time_t)irun; m_to_transfer.push_back(std::make_pair((EcalTPGOddWeightIdMap*)weightMap, snc)); @@ -213,49 +211,47 @@ void popcon::EcalTPGOddWeightIdMapHandler::getNewObjects() { 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; + edm::LogVerbatim("EcalTPGOddWeightIdMapHandler") + << " even if the tag/version is not the same, the weightIdMap id is the same -> no transfer needed "; } } 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; + throw cms::Exception("FileReadError") << "ERROR: THIS CONFIG DOES NOT EXIST: tag=" << the_config_tag + << " version=" << the_config_version << "\n" + << e.what(); } - std::cout << " **************** " << std::endl; + edm::LogVerbatim("EcalTPGOddWeightIdMapHandler") << " **************** "; } 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; + edm::LogVerbatim("EcalTPGOddWeightIdMapHandler") + << " no tag saved to RUN_TPGCONFIG_DAT by EcalSupervisor -> no transfer needed "; + edm::LogVerbatim("EcalTPGOddWeightIdMapHandler") << " **************** "; } 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; + edm::LogVerbatim("EcalTPGOddWeightIdMapHandler") << " the tag/version is the same -> no transfer needed "; + edm::LogVerbatim("EcalTPGOddWeightIdMapHandler") << " **************** "; writeFile("last_tpg_OddweightIdMap_settings.txt"); } } } - delete econn; } // usual way - edm::LogInfo("EcalTPGOddWeightIdMapHandler") << "Ecal - > end of getNewObjects -----------"; + edm::LogVerbatim("EcalTPGOddWeightIdMapHandler") << "Ecal - > end of getNewObjects -----------"; } void popcon::EcalTPGOddWeightIdMapHandler::readtxtFile() { - std::cout << " reading the input file " << m_file_name << std::endl; + edm::LogVerbatim("EcalTPGOddWeightIdMapHandler") << " reading the input file " << m_file_name; 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); + throw cms::Exception("FileReadError") << "ERROR : cannot open file " << m_file_name; } unsigned int wloc[5]; EcalTPGWeights w; EcalTPGOddWeightIdMap* weightMap = new EcalTPGOddWeightIdMap; + int igroups = 0; std::string line; while (!fInput.eof()) { @@ -264,34 +260,33 @@ void popcon::EcalTPGOddWeightIdMapHandler::readtxtFile() { 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"; + edm::LogVerbatim("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; + throw cms::Exception("FileReadError") << "EcalTPGOddWeightIdMapHandler::readtxtFile error : " << e.what(); } - std::cout << " **************** " << std::endl; + edm::LogVerbatim("EcalTPGOddWeightIdMapHandler") << " **************** "; } void popcon::EcalTPGOddWeightIdMapHandler::readxmlFile() { - std::cout << " reading the input file " << m_file_name << std::endl; + edm::LogVerbatim("EcalTPGOddWeightIdMapHandler") << " reading the input file " << m_file_name; 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); + throw cms::Exception("FileReadError") << "ERROR: Cannot open file : " << m_file_name; } 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 @@ -300,21 +295,18 @@ void popcon::EcalTPGOddWeightIdMapHandler::readxmlFile() { std::string stt = bid.substr(7, 1); std::istringstream sc(stt); sc >> ngroups; - edm::LogInfo("EcalTPGOddWeightIdMapHandler") << "found " << ngroups << " Weight groups"; + edm::LogVerbatim("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; // > bid; // > igroups; if (igroups != i) { - std::cout << " group " << i << ": " << bid << " igroups " << igroups << std::endl; - exit(-1); + throw cms::Exception("MismatchError") << "ERROR in group " << i << ": " << bid << " igroups " << igroups; } for (int i = 0; i < 2; i++) std::getline(fxml, dummyLine); // < second @@ -329,15 +321,15 @@ void popcon::EcalTPGOddWeightIdMapHandler::readxmlFile() { 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; + throw cms::Exception("FileReadError") << "EcalTPGOddWeightIdMapHandler::readxmlFile error : " << e.what(); } - std::cout << " **************** " << std::endl; + edm::LogVerbatim("EcalTPGOddWeightIdMapHandler") << " **************** "; } void popcon::EcalTPGOddWeightIdMapHandler::readFromFile(const char* inputFile) { diff --git a/CondTools/Ecal/src/EcalTPGTPModeHandler.cc b/CondTools/Ecal/src/EcalTPGTPModeHandler.cc index 869f6aa6ec1e9..d4910456e19a5 100644 --- a/CondTools/Ecal/src/EcalTPGTPModeHandler.cc +++ b/CondTools/Ecal/src/EcalTPGTPModeHandler.cc @@ -46,41 +46,35 @@ 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!!!"; + } else { + edm::LogVerbatim("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; + edm::LogVerbatim("EcalTPGTPModeHandler") << "got offlineInfo = "; + edm::LogVerbatim("EcalTPGTPModeHandler") << "tag name = " << tagInfo().name; + edm::LogVerbatim("EcalTPGTPModeHandler") << "size = " << tagInfo().size; } else { - std::cout << " First object for this tag " << std::endl; + edm::LogVerbatim("EcalTPGTPModeHandler") << " First object for this tag "; } unsigned int max_since = 0; max_since = static_cast(tagInfo().lastInterval.since); - edm::LogInfo("EcalTPGTPModeHandler") << "max_since : " << max_since; + edm::LogVerbatim("EcalTPGTPModeHandler") << "max_since : " << max_since; - edm::LogInfo("EcalTPGTPModeHandler") << "retrieved last payload "; + edm::LogVerbatim("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::LogVerbatim("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."; + edm::LogVerbatim("EcalTPGTPModeHandler") << "Making connection..."; + auto econn = std::make_shared(m_sid, m_user, m_pass); + edm::LogVerbatim("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"); + throw cms::Exception("OMDS not available") << " connection parameters " << m_sid << "/" << m_user; } LocationDef my_locdef; @@ -108,29 +102,27 @@ void popcon::EcalTPGTPModeHandler::getNewObjects() { 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; + edm::LogVerbatim("EcalTPGTPModeHandler") + << "m_i_run_number" << m_i_run_number << "m_firstRun " << m_firstRun << "max_since " << max_since; unsigned int max_run = m_lastRun; - edm::LogInfo("EcalTPGTPModeHandler") << "min_run= " << min_run << " max_run= " << max_run; + edm::LogVerbatim("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; + edm::LogVerbatim("EcalTPGTPModeHandler") << "number of runs is : " << num_runs; 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; + edm::LogVerbatim("EcalTPGTPModeHandler") << " **************** "; + edm::LogVerbatim("EcalTPGTPModeHandler") << " **************** "; + edm::LogVerbatim("EcalTPGTPModeHandler") << " run= " << irun; // retrieve the data : std::map dataset; @@ -151,23 +143,23 @@ void popcon::EcalTPGTPModeHandler::getNewObjects() { } // 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; + edm::LogVerbatim("EcalTPGTPModeHandler") + << " run= " << irun << " tag " << the_config_tag << " version=" << the_config_version; // 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; + edm::LogVerbatim("EcalTPGTPModeHandler") + << "the tag is different from last transferred run ... retrieving last config set from DB"; 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; + edm::LogVerbatim("EcalTPGTPModeHandler") << " before fetch config set"; econn->fetchConfigSet(&fe_main_info); - std::cout << " after fetch config set" << std::endl; + edm::LogVerbatim("EcalTPGTPModeHandler") << " after fetch config set"; // now get TPGTPMode int wId = fe_main_info.getWei2Id(); @@ -199,28 +191,28 @@ void popcon::EcalTPGTPModeHandler::getNewObjects() { 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; + + edm::LogVerbatim("EcalTPGTPModeHandler") << "here is the value for the weight mode: "; + edm::LogVerbatim("EcalTPGTPModeHandler") << " EnableEBOddFilter:" << rd_modev[0]; + edm::LogVerbatim("EcalTPGTPModeHandler") << " EnableEEOddFilter:" << rd_modev[1]; + edm::LogVerbatim("EcalTPGTPModeHandler") << " EnableEBOddPeakFinder:" << rd_modev[2]; + edm::LogVerbatim("EcalTPGTPModeHandler") << " EnableEEOddPeakFinder:" << rd_modev[3]; + edm::LogVerbatim("EcalTPGTPModeHandler") << " DisableEBEvenPeakFinder:" << rd_modev[4]; + edm::LogVerbatim("EcalTPGTPModeHandler") << " DisableEEEvenPeakFinder:" << rd_modev[5]; + edm::LogVerbatim("EcalTPGTPModeHandler") << " FenixEBStripOutput:" << rd_modev[6]; + edm::LogVerbatim("EcalTPGTPModeHandler") << " FenixEEStripOutput:" << rd_modev[7]; + edm::LogVerbatim("EcalTPGTPModeHandler") << " FenixEBStripInfobit2:" << rd_modev[8]; + edm::LogVerbatim("EcalTPGTPModeHandler") << " FenixEEStripInfobit2:" << rd_modev[9]; + edm::LogVerbatim("EcalTPGTPModeHandler") << " FenixEBTcpOutput:" << rd_modev[10]; + edm::LogVerbatim("EcalTPGTPModeHandler") << " FenixEBTcpinfobit1:" << rd_modev[11]; + edm::LogVerbatim("EcalTPGTPModeHandler") << " FenixEETcpOutput:" << rd_modev[12]; + edm::LogVerbatim("EcalTPGTPModeHandler") << " FenixEETcpinfobit1:" << rd_modev[13]; k = k + 1; } - std::cout << "*****************************************" << std::endl; - std::cout << "read done " << wId << std::endl; - std::cout << "*****************************************" << std::endl; + edm::LogVerbatim("EcalTPGTPModeHandler") << "*****************************************"; + edm::LogVerbatim("EcalTPGTPModeHandler") << "read done " << wId; + edm::LogVerbatim("EcalTPGTPModeHandler") << "*****************************************"; EcalTPGTPMode* tpMode = new EcalTPGTPMode; tpMode->EnableEBOddFilter = rd_modev[0]; @@ -258,48 +250,45 @@ void popcon::EcalTPGTPModeHandler::getNewObjects() { 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; + edm::LogVerbatim("EcalTPGTPModeHandler") + << " even if the tag/version is not the same, the weight group id is the same -> no transfer needed "; } } 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; + throw cms::Exception("FileReadError") << "ERROR: THIS CONFIG DOES NOT EXIST: tag=" << the_config_tag + << " version=" << the_config_version << "\n" + << e.what(); } - std::cout << " **************** " << std::endl; + edm::LogVerbatim("EcalTPGTPModeHandler") << " **************** "; } 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; + edm::LogVerbatim("EcalTPGTPModeHandler") + << " no tag saved to RUN_TPGCONFIG_DAT by EcalSupervisor -> no transfer needed "; + edm::LogVerbatim("EcalTPGTPModeHandler") << " **************** "; } 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; + edm::LogVerbatim("EcalTPGTPModeHandler") << " the tag/version is the same -> no transfer needed "; + edm::LogVerbatim("EcalTPGTPModeHandler") << " **************** "; writeFile("last_tpg_TPMode_settings.txt"); } } } - delete econn; } // usual way - edm::LogInfo("EcalTPGTPModeHandler") << "Ecal - > end of getNewObjects -----------"; + edm::LogVerbatim("EcalTPGTPModeHandler") << "Ecal - > end of getNewObjects -----------"; } void popcon::EcalTPGTPModeHandler::readtxtFile() { - std::cout << " reading the input file " << m_file_name << std::endl; + edm::LogVerbatim("EcalTPGTPModeHandler") << " reading the input file " << m_file_name; 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); + throw cms::Exception("FileOpenError") << "ERROR : cannot open file " << m_file_name; } std::map values; EcalTPGTPMode* tpMode = new EcalTPGTPMode; @@ -331,14 +320,12 @@ void popcon::EcalTPGTPModeHandler::readtxtFile() { m_to_transfer.push_back(std::make_pair((EcalTPGTPMode*)tpMode, snc)); } catch (std::exception& e) { - std::cout << "EcalTPGTPModeHandler::readtxtFile error : " << e.what() << std::endl; + throw cms::Exception("FileReadError") << "EcalTPGTPModeHandler::readtxtFile error : " << e.what(); } - std::cout << " **************** " << std::endl; + edm::LogVerbatim("EcalTPGTPModeHandler") << " **************** "; } void popcon::EcalTPGTPModeHandler::readFromFile(const char* inputFile) { - //------------------------------------------------------------- - m_i_tag = ""; m_i_version = 0; m_i_run_number = 0; @@ -357,7 +344,7 @@ void popcon::EcalTPGTPModeHandler::readFromFile(const char* inputFile) { fgets(line, 255, inpFile); m_i_tag = to_string(line); - str << "gen tag " << m_i_tag << std::endl; // should I use this? + str << "gen tag " << m_i_tag << std::endl; fgets(line, 255, inpFile); m_i_version = atoi(line); @@ -375,8 +362,6 @@ void popcon::EcalTPGTPModeHandler::readFromFile(const char* inputFile) { } void popcon::EcalTPGTPModeHandler::writeFile(const char* inputFile) { - //------------------------------------------------------------- - std::ofstream myfile; myfile.open(inputFile); myfile << m_i_tag << std::endl; diff --git a/CondTools/Ecal/test/EcalIntercalibConstants_O2O_test.sh b/CondTools/Ecal/test/EcalIntercalibConstants_O2O_test.sh index 0bc4952895f26..9e56eae261ada 100755 --- a/CondTools/Ecal/test/EcalIntercalibConstants_O2O_test.sh +++ b/CondTools/Ecal/test/EcalIntercalibConstants_O2O_test.sh @@ -2,7 +2,7 @@ conddb --yes copy EcalIntercalibConstants_V1_hlt --destdb EcalIntercalibConstants_V1_hlt_O2OTEST.db --o2oTest conddb --yes copy EcalIntercalibConstants_0T --destdb EcalIntercalibConstants_V1_hlt_O2OTEST.db conddb --yes copy EcalIntercalibConstants_3.8T_v2 --destdb EcalIntercalibConstants_V1_hlt_O2OTEST.db -lastRun=`conddb list EcalIntercalibConstants_V1_hlt | tail -2 | awk '{print $1}'` +lastRun=`conddb --db EcalIntercalibConstants_V1_hlt_O2OTEST.db list EcalIntercalibConstants_V1_hlt | tail -2 | head -1 | awk '{print $1}'` conddb --yes copy runinfo_start_31X_hlt --destdb EcalIntercalibConstants_V1_hlt_O2OTEST.db -f $lastRun -t $lastRun cmsRun ./src/CondTools/Ecal/python/EcalIntercalibConstantsPopConBTransitionAnalyzer_cfg.py runNumber=$lastRun destinationDatabase=sqlite_file:EcalIntercalibConstants_V1_hlt_O2OTEST.db destinationTag=EcalIntercalibConstants_V1_hlt tagForRunInfo=runinfo_start_31X_hlt tagForBOff=EcalIntercalibConstants_0T tagForBOn=EcalIntercalibConstants_3.8T_v2 ret=$? diff --git a/CondTools/Ecal/test/testXMLTranslators.cc b/CondTools/Ecal/test/testXMLTranslators.cc deleted file mode 100644 index cde70f806f3aa..0000000000000 --- a/CondTools/Ecal/test/testXMLTranslators.cc +++ /dev/null @@ -1,472 +0,0 @@ -#include "CondTools/Ecal/interface/EcalADCToGeVXMLTranslator.h" -#include "CondTools/Ecal/interface/EcalIntercalibConstantsXMLTranslator.h" -#include "CondTools/Ecal/interface/EcalLinearCorrectionsXMLTranslator.h" -#include "CondTools/Ecal/interface/EcalIntercalibErrorsXMLTranslator.h" -#include "CondTools/Ecal/interface/EcalWeightGroupXMLTranslator.h" -#include "CondTools/Ecal/interface/EcalTBWeightsXMLTranslator.h" -#include "CondTools/Ecal/interface/EcalLaserAPDPNRatiosXMLTranslator.h" -#include "CondTools/Ecal/interface/EcalTimeCalibConstantsXMLTranslator.h" -#include "CondTools/Ecal/interface/EcalTimeCalibErrorsXMLTranslator.h" - -#include "CondFormats/EcalObjects/interface/EcalADCToGeVConstant.h" -#include "CondFormats/EcalObjects/interface/EcalLinearCorrections.h" -#include "CondFormats/EcalObjects/interface/EcalIntercalibConstants.h" -#include "CondFormats/EcalObjects/interface/EcalIntercalibErrors.h" -#include "CondFormats/EcalObjects/interface/EcalLaserAPDPNRatios.h" -#include "CondFormats/EcalObjects/interface/EcalIntercalibConstantsMC.h" - -#include "CondFormats/EcalObjects/interface/EcalTimeCalibConstants.h" -#include "CondFormats/EcalObjects/interface/EcalTimeCalibErrors.h" - -#include "CondFormats/EcalObjects/interface/EcalXtalGroupId.h" -#include "CondFormats/EcalObjects/interface/EcalWeightXtalGroups.h" -#include "CondFormats/EcalObjects/interface/EcalIntercalibErrors.h" - -#include "CondTools/Ecal/interface/EcalGainRatiosXMLTranslator.h" -#include "CondTools/Ecal/interface/EcalChannelStatusXMLTranslator.h" -#include "CondTools/Ecal/interface/EcalWeightSetXMLTranslator.h" - -#include "CondFormats/EcalObjects/interface/EcalGainRatios.h" -#include "CondFormats/EcalObjects/interface/EcalMGPAGainRatio.h" - -#include "CondFormats/EcalObjects/interface/EcalChannelStatus.h" -#include "CondFormats/EcalObjects/interface/EcalChannelStatusCode.h" - -#include "CondFormats/EcalObjects/interface/EcalWeightSet.h" -#include "CondTools/Ecal/interface/EcalCondHeader.h" - -#include "CondFormats/EcalObjects/interface/EcalTBWeights.h" - -#include "DataFormats/EcalDetId/interface/EBDetId.h" - - - -#include -using std::cout; -using std::endl; - -#include - -int main(){ - - // Test ADCtoGeV - - EcalCondHeader header; - EcalCondHeader header2; - - - header.method_="testmethod"; - header.version_="testversion"; - header.datasource_="testdata"; - header.since_=123; - header.tag_="testtag"; - header.date_="Mar 24 1973"; - - - - EcalADCToGeVConstant adctogev_constant; - EcalADCToGeVConstant adctogev_constant2; - - adctogev_constant.setEBValue(1.1); - adctogev_constant.setEEValue(2.2); - - std::string adctogevfile("/tmp/EcalADCToGeVConstant.xml"); - std::string adctogevfile2("/tmp/adctogev2.xml"); - - EcalADCToGeVXMLTranslator::writeXML(adctogevfile,header,adctogev_constant); - EcalADCToGeVXMLTranslator::readXML(adctogevfile,header2,adctogev_constant2); - EcalADCToGeVXMLTranslator::writeXML(adctogevfile2,header2,adctogev_constant2); - - - // Test Intercalibration - - - EcalLinearCorrections lin_constants; - EcalIntercalibConstants intercalib_constants; - EcalIntercalibErrors intercalib_errors; - - std::string linfile("/tmp/EcalLinearCorrections.xml"); - std::string intercalibfile("/tmp/EcalIntercalibConstants.xml"); - std::string intercaliberrfile("/tmp/EcalIntercalibErrors.xml"); - std::string intercalibfiledb("/tmp/EcalIntercalibConstantsDB.xml"); - - for (int cellid = 0; - cellid < EBDetId::kSizeForDenseIndexing; - ++cellid){// loop on EB cells - - - uint32_t rawid = EBDetId::unhashIndex(cellid); - - EcalIntercalibConstant intercalib_constant = - EBDetId::unhashIndex(cellid).iphi(); - - EcalIntercalibConstant lin_constant = - EBDetId::unhashIndex(cellid).iphi(); - - EcalIntercalibError intercalib_error = intercalib_constant +1; - - lin_constants[rawid]=lin_constant; - intercalib_constants[rawid]=intercalib_constant; - intercalib_errors[rawid] =intercalib_error; - } - - for (int cellid = 0; - cellid < EEDetId::kSizeForDenseIndexing; - ++cellid){// loop on EB cells - - - - if (EEDetId::validHashIndex(cellid)){ - uint32_t rawid = EEDetId::unhashIndex(cellid); - EcalLinearCorrection lin_constant = EEDetId::unhashIndex(cellid).ix();; - EcalIntercalibConstant intercalib_constant = EEDetId::unhashIndex(cellid).ix();; - EcalIntercalibError intercalib_error = intercalib_constant +1; - - lin_constants[rawid]=lin_constant; - intercalib_constants[rawid]=intercalib_constant; - intercalib_errors[rawid]=intercalib_error; - } // if - } - - - - EcalLinearCorrectionsXMLTranslator::writeXML(linfile,header, - lin_constants); - - EcalIntercalibConstantsXMLTranslator::writeXML(intercalibfile,header, - intercalib_constants); - - EcalIntercalibErrorsXMLTranslator::writeXML(intercaliberrfile,header, - intercalib_errors); - - EcalIntercalibConstants lin_constants2; - EcalIntercalibConstants intercalib_constants2; - EcalIntercalibErrors intercalib_errors2; - - - EcalLinearCorrectionsXMLTranslator::readXML(linfile,header2, - lin_constants2); - - EcalIntercalibConstantsXMLTranslator::readXML(intercalibfile,header2, - intercalib_constants2); - - EcalIntercalibErrorsXMLTranslator::readXML(intercaliberrfile,header2, - intercalib_errors2); - - std::string linfile2("/tmp/linfile-2.xml"); - std::string intercalibfile2("/tmp/intercalibfile-2.xml"); - std::string intercaliberrfile2("/tmp/intercaliberrfile-2.xml"); - - EcalLinearCorrectionsXMLTranslator::writeXML(linfile2, - header2, - lin_constants2); - EcalIntercalibConstantsXMLTranslator::writeXML(intercalibfile2, - header2, - intercalib_constants2); - - EcalIntercalibErrorsXMLTranslator::writeXML(intercaliberrfile,header2, - intercalib_errors2); - - cout << "Done testing Intercalib abd Linear Corrections" << endl; - - // Test Timing Intercalibration - - - EcalTimeCalibConstants timeCalib_constants; - EcalTimeCalibErrors timeCalib_errors; - - std::string timeCalibFile("/tmp/EcalTimeCalibConstants.xml"); - std::string timeCalibErrFile("/tmp/EcalTimeCalibErrors.xml"); - std::string timeCalibFileDB("/tmp/EcalTimeCalibConstantsDB.xml"); - - for (int cellid = 0; - cellid < EBDetId::kSizeForDenseIndexing; - ++cellid){// loop on EB cells - - - uint32_t rawid = EBDetId::unhashIndex(cellid); - - EcalTimeCalibConstant timeCalib_constant = - EBDetId::unhashIndex(cellid).iphi(); - - EcalTimeCalibError timeCalib_error = timeCalib_constant +1; - - timeCalib_constants[rawid]=timeCalib_constant; - timeCalib_errors[rawid] =timeCalib_error; - } - - for (int cellid = 0; - cellid < EEDetId::kSizeForDenseIndexing; - ++cellid){// loop on EB cells - - - - if (EEDetId::validHashIndex(cellid)){ - uint32_t rawid = EEDetId::unhashIndex(cellid); - EcalTimeCalibConstant timeCalib_constant = EEDetId::unhashIndex(cellid).ix();; - EcalTimeCalibError timeCalib_error = timeCalib_constant +1; - - timeCalib_constants[rawid]=timeCalib_constant; - timeCalib_errors[rawid]=timeCalib_error; - } // if - } - - - - EcalTimeCalibConstantsXMLTranslator::writeXML(timeCalibFile,header, - timeCalib_constants); - - EcalTimeCalibErrorsXMLTranslator::writeXML(timeCalibErrFile,header, - timeCalib_errors); - - EcalTimeCalibConstants timeCalib_constants2; - EcalTimeCalibErrors timeCalib_errors2; - - - EcalTimeCalibConstantsXMLTranslator::readXML(timeCalibFile,header2, - timeCalib_constants2); - - EcalTimeCalibErrorsXMLTranslator::readXML(timeCalibErrFile,header, - timeCalib_errors2); - - std::string timeCalibFile2("/tmp/timeCalibFile-2.xml"); - std::string timeCalibErrFile2("/tmp/timeCalibErrFile-2.xml"); - - EcalTimeCalibConstantsXMLTranslator::writeXML(timeCalibFile2, - header2, - timeCalib_constants2); - - EcalTimeCalibErrorsXMLTranslator::writeXML(timeCalibErrFile2,header2, - timeCalib_errors2); - cout << "Done testing timing intercalib " << endl; - - // test xtalgroup - - EcalWeightGroupXMLTranslator grouptrans; - - EcalWeightXtalGroups groups; - - std::string groupfile("/tmp/EcalWeightXtalGroups.xml"); - - for (int cellid = 0 ; - cellid < EBDetId::kSizeForDenseIndexing; - ++cellid){// loop on EB cells - - - uint32_t rawid = EBDetId::unhashIndex(cellid); - // a random gid - EcalXtalGroupId gid( EBDetId::unhashIndex(cellid).iphi()); - groups[rawid]=gid; - - } - - for (int cellid = 0; - cellid < EEDetId::kSizeForDenseIndexing; - ++cellid){// loop on EB cells - - - - if (EEDetId::validHashIndex(cellid)){ - uint32_t rawid = EEDetId::unhashIndex(cellid); - // a random gid - EcalXtalGroupId gid( EEDetId::unhashIndex(cellid).ix()); - groups[rawid]=gid; - } // if - } - - - - grouptrans.writeXML(groupfile,header,groups); - - EcalWeightXtalGroups groups2; - - grouptrans.readXML(groupfile,header2,groups2); - - std::string groupfile2("/tmp/group-2.xml"); - - grouptrans.writeXML(groupfile2,header2,groups2); - - cout << "Done testing groups " << endl; - - EcalGainRatiosXMLTranslator transGainRatios; - - EcalGainRatios gainratios; - - std::string filenamegr("/tmp/EcalGainRatios.xml"); - std::string newfilegr("/tmp/gainratios-2.xml"); - - - for (int cellid = 0; - cellid < EBDetId::kSizeForDenseIndexing; - ++cellid){// loop on EB cells - - - EcalMGPAGainRatio ecalGR; - ecalGR.setGain12Over6(2.); - ecalGR.setGain6Over1(5.); - - gainratios.insert(std::make_pair(EBDetId::unhashIndex(cellid),ecalGR)); - - } - - for (int cellid = 0; - cellid < EEDetId::kSizeForDenseIndexing; - ++cellid){// loop on EE cells - - if (EEDetId::validHashIndex(cellid)){ - EcalMGPAGainRatio ecalGR; - ecalGR.setGain12Over6(2.); - ecalGR.setGain6Over1(5.); - gainratios.insert(std::make_pair(EEDetId::unhashIndex(cellid),ecalGR)); - } // if - } - - - transGainRatios.writeXML(filenamegr,header,gainratios); - - EcalGainRatios gainratios2; - transGainRatios.readXML(filenamegr,header2,gainratios2); - - - transGainRatios.writeXML(newfilegr,header2,gainratios2); - - - cout << "Done testing gainratios " << endl; - - EcalChannelStatusXMLTranslator transChannelStatus; - - EcalChannelStatus channelstatus; - - - for (int cellid = 0; - cellid < EBDetId::kSizeForDenseIndexing; - ++cellid){// loop on EB cells - - - EcalChannelStatusCode ecalCSC = EcalChannelStatusCode(16); - - uint32_t rawid= EBDetId::unhashIndex(cellid); - - channelstatus[rawid]=ecalCSC; - - } - - for (int cellid = 0; - cellid < EEDetId::kSizeForDenseIndexing; - ++cellid){// loop on Ee cells - - if (EEDetId::validHashIndex(cellid)){ - - uint32_t rawid= EEDetId::unhashIndex(cellid); - EcalChannelStatusCode ecalCSC = EcalChannelStatusCode(35); - channelstatus[rawid]=ecalCSC; - } // if - } - - std::string cscfile("/tmp/EcalChannelStatus.xml"); - - transChannelStatus.writeXML(cscfile,header,channelstatus); - - EcalChannelStatus channelstatus2; - - transChannelStatus.readXML(cscfile,header2,channelstatus2); - - std::string cscfile2("/tmp/cscfile-2.xml"); - - transChannelStatus.writeXML(cscfile2,header2,channelstatus2); - - - cout << "Done testing channelstatus " << endl; - - EcalTBWeightsXMLTranslator transWeight; - - EcalWeightSet weightset; - - - for(int i=0;i<3;i++) - { - for(int k=0;k<10;k++) - { - weightset.getWeightsBeforeGainSwitch()(i,k) = 1.2*k; - weightset.getWeightsAfterGainSwitch()(i,k) = 1.2*k; - } - } - - - - for(int i=0;i<10;i++) - { - for(int k=0;k<10;k++) - { - weightset.getChi2WeightsBeforeGainSwitch()(i,k) = 1.2*k; - weightset.getChi2WeightsAfterGainSwitch()(i,k) = 1.2*k; - } - } - - EcalXtalGroupId gid=1; - EcalTBWeights::EcalTDCId tid=2; - - - EcalTBWeights tbw; - tbw.setValue(gid,tid,weightset); - - - std::string filew("/tmp/EcalTBWeights.xml"); - std::string filew2("/tmp/tbweight2.xml"); - - transWeight.writeXML(filew,header,tbw); - - - EcalTBWeights tbw2; - - transWeight.readXML(filew,header2,tbw2); - - transWeight.writeXML(filew2,header2,tbw2); - - - // test laser - - std::string filelaser("/tmp/EcalLaserAPDPNratios.xml"); - std::string filelaser2("/tmp/EcalLaserAPDPNratios-2.xml"); - - EcalLaserAPDPNRatios laserrecord1; - EcalLaserAPDPNRatios laserrecord2; - - for (int cellid = 0; - cellid < EBDetId::kSizeForDenseIndexing; - ++cellid){// loop on EB cells - - - uint32_t rawid= EBDetId::unhashIndex(cellid); - - EcalLaserAPDPNRatios::EcalLaserAPDPNpair pair; - pair.p1 =1; - pair.p2 =2; - pair.p3 =3; - - laserrecord1.setValue(rawid,pair); - - } - - for (int cellid = 0; - cellid < EEDetId::kSizeForDenseIndexing; - ++cellid){// loop on Ee cells - - if (EEDetId::validHashIndex(cellid)){ - - uint32_t rawid= EEDetId::unhashIndex(cellid); - EcalLaserAPDPNRatios::EcalLaserAPDPNpair pair; - pair.p1 =1; - pair.p2 =2; - pair.p3 =3; - - laserrecord1.setValue(rawid,pair); - - } // if - } - - EcalLaserAPDPNRatiosXMLTranslator::writeXML(filelaser,header,laserrecord1); - EcalLaserAPDPNRatiosXMLTranslator::readXML(filelaser,header2,laserrecord2); - EcalLaserAPDPNRatiosXMLTranslator::writeXML(filelaser2,header2,laserrecord2); - return 0; -} diff --git a/CondTools/Geometry/plugins/CSCRecoIdealDBLoader.cc b/CondTools/Geometry/plugins/CSCRecoIdealDBLoader.cc index ab0ee4eb17814..885ca3858378a 100644 --- a/CondTools/Geometry/plugins/CSCRecoIdealDBLoader.cc +++ b/CondTools/Geometry/plugins/CSCRecoIdealDBLoader.cc @@ -28,10 +28,16 @@ class CSCRecoIdealDBLoader : public edm::one::EDAnalyzer { private: bool fromDD4Hep_; + edm::ESGetToken dd4HepCompactViewToken_; + edm::ESGetToken compactViewToken_; + edm::ESGetToken muonGeomConstantsToken_; }; CSCRecoIdealDBLoader::CSCRecoIdealDBLoader(const edm::ParameterSet& iC) { fromDD4Hep_ = iC.getUntrackedParameter("fromDD4Hep", false); + dd4HepCompactViewToken_ = esConsumes(); + compactViewToken_ = esConsumes(); + muonGeomConstantsToken_ = esConsumes(); } void CSCRecoIdealDBLoader::beginRun(const edm::Run&, edm::EventSetup const& es) { @@ -45,19 +51,15 @@ void CSCRecoIdealDBLoader::beginRun(const edm::Run&, edm::EventSetup const& es) return; } - edm::ESHandle pMNDC; + auto pMNDC = es.getHandle(muonGeomConstantsToken_); CSCGeometryParsFromDD cscgp; if (fromDD4Hep_) { - edm::ESTransientHandle pDD; - es.get().get(pDD); - es.get().get(pMNDC); + auto pDD = es.getTransientHandle(dd4HepCompactViewToken_); const cms::DDCompactView& cpv = *pDD; cscgp.build(&cpv, *pMNDC, *rig, *rdp); } else { - edm::ESTransientHandle pDD; - es.get().get(pDD); - es.get().get(pMNDC); + auto pDD = es.getTransientHandle(compactViewToken_); const DDCompactView& cpv = *pDD; cscgp.build(&cpv, *pMNDC, *rig, *rdp); } diff --git a/CondTools/Geometry/plugins/DTRecoIdealDBLoader.cc b/CondTools/Geometry/plugins/DTRecoIdealDBLoader.cc index 1311f825cedde..c8f9dc2795fce 100644 --- a/CondTools/Geometry/plugins/DTRecoIdealDBLoader.cc +++ b/CondTools/Geometry/plugins/DTRecoIdealDBLoader.cc @@ -29,10 +29,16 @@ class DTRecoIdealDBLoader : public edm::one::EDAnalyzer { private: bool fromDD4Hep_; + edm::ESGetToken dd4HepCompactViewToken_; + edm::ESGetToken compactViewToken_; + edm::ESGetToken muonGeomConstantsToken_; }; DTRecoIdealDBLoader::DTRecoIdealDBLoader(const edm::ParameterSet& iC) { fromDD4Hep_ = iC.getUntrackedParameter("fromDD4Hep", false); + dd4HepCompactViewToken_ = esConsumes(); + compactViewToken_ = esConsumes(); + muonGeomConstantsToken_ = esConsumes(); } void DTRecoIdealDBLoader::beginRun(const edm::Run&, edm::EventSetup const& es) { @@ -43,19 +49,15 @@ void DTRecoIdealDBLoader::beginRun(const edm::Run&, edm::EventSetup const& es) { return; } - edm::ESHandle pMNDC; + auto pMNDC = es.getHandle(muonGeomConstantsToken_); DTGeometryParsFromDD dtgp; if (fromDD4Hep_) { - edm::ESTransientHandle pDD; - es.get().get(pDD); - es.get().get(pMNDC); + auto pDD = es.getTransientHandle(dd4HepCompactViewToken_); const cms::DDCompactView& cpv = *pDD; dtgp.build(&cpv, *pMNDC, *rig); } else { - edm::ESTransientHandle pDD; - es.get().get(pDD); - es.get().get(pMNDC); + auto pDD = es.getTransientHandle(compactViewToken_); const DDCompactView& cpv = *pDD; dtgp.build(&cpv, *pMNDC, *rig); } diff --git a/CondTools/Geometry/plugins/GEMRecoIdealDBLoader.cc b/CondTools/Geometry/plugins/GEMRecoIdealDBLoader.cc index 48fd98f03488b..7787aa61d5e33 100644 --- a/CondTools/Geometry/plugins/GEMRecoIdealDBLoader.cc +++ b/CondTools/Geometry/plugins/GEMRecoIdealDBLoader.cc @@ -30,10 +30,16 @@ class GEMRecoIdealDBLoader : public edm::one::EDAnalyzer { private: bool fromDD4Hep_; + edm::ESGetToken dd4HepCompactViewToken_; + edm::ESGetToken compactViewToken_; + edm::ESGetToken muonGeomConstantsToken_; }; GEMRecoIdealDBLoader::GEMRecoIdealDBLoader(const edm::ParameterSet& iC) { fromDD4Hep_ = iC.getUntrackedParameter("fromDD4Hep", false); // set true for DD4HEP + dd4HepCompactViewToken_ = esConsumes(); + compactViewToken_ = esConsumes(); + muonGeomConstantsToken_ = esConsumes(); } void GEMRecoIdealDBLoader::beginRun(const edm::Run&, edm::EventSetup const& es) { @@ -46,22 +52,19 @@ void GEMRecoIdealDBLoader::beginRun(const edm::Run&, edm::EventSetup const& es) } if (mydbservice->isNewTagRequest("GEMRecoGeometryRcd")) { - edm::ESHandle pMNDC; + auto pMNDC = es.getHandle(muonGeomConstantsToken_); + GEMGeometryParsFromDD rpcpd; RecoIdealGeometry* rig = new RecoIdealGeometry; if (fromDD4Hep_) { edm::LogVerbatim("GEMRecoIdealDBLoader") << "(0) GEMRecoIdealDBLoader - DD4HEP "; - edm::ESTransientHandle pDD; - es.get().get(pDD); - es.get().get(pMNDC); + auto pDD = es.getTransientHandle(dd4HepCompactViewToken_); const cms::DDCompactView& cpv = *pDD; rpcpd.build(&cpv, *pMNDC, *rig); } else { edm::LogVerbatim("GEMRecoIdealDBLoader") << "(0) GEMRecoIdealDBLoader - DDD "; - edm::ESTransientHandle pDD; - es.get().get(pDD); - es.get().get(pMNDC); + auto pDD = es.getTransientHandle(compactViewToken_); const DDCompactView& cpv = *pDD; rpcpd.build(&cpv, *pMNDC, *rig); } diff --git a/CondTools/Geometry/plugins/HcalParametersDBBuilder.cc b/CondTools/Geometry/plugins/HcalParametersDBBuilder.cc index bd49e5ac6aafb..1a21df2ad7a8f 100644 --- a/CondTools/Geometry/plugins/HcalParametersDBBuilder.cc +++ b/CondTools/Geometry/plugins/HcalParametersDBBuilder.cc @@ -26,6 +26,8 @@ class HcalParametersDBBuilder : public edm::one::EDAnalyzer private: bool fromDD4Hep_; + edm::ESGetToken dd4HepCompactViewToken_; + edm::ESGetToken compactViewToken_; }; HcalParametersDBBuilder::HcalParametersDBBuilder(const edm::ParameterSet& ps) @@ -34,6 +36,8 @@ HcalParametersDBBuilder::HcalParametersDBBuilder(const edm::ParameterSet& ps) edm::LogVerbatim("HCalGeom") << "HcalParametersDBBuilder::HcalParametersDBBuilder called with dd4hep: " << fromDD4Hep_; #endif + dd4HepCompactViewToken_ = esConsumes(); + compactViewToken_ = esConsumes(); } void HcalParametersDBBuilder::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { @@ -56,15 +60,13 @@ void HcalParametersDBBuilder::beginRun(const edm::Run&, edm::EventSetup const& e #ifdef EDM_ML_DEBUG edm::LogVerbatim("HCalGeom") << "HcalParametersDBBuilder::Try to access cms::DDCompactView"; #endif - edm::ESTransientHandle cpv; - es.get().get(cpv); + auto cpv = es.getTransientHandle(dd4HepCompactViewToken_); builder.build((*cpv), *php); } else { #ifdef EDM_ML_DEBUG edm::LogVerbatim("HCalGeom") << "HcalParametersDBBuilder::Try to access DDCompactView"; #endif - edm::ESTransientHandle cpv; - es.get().get(cpv); + auto cpv = es.getTransientHandle(compactViewToken_); builder.build(&(*cpv), *php); } diff --git a/CondTools/Geometry/plugins/ME0RecoIdealDBLoader.cc b/CondTools/Geometry/plugins/ME0RecoIdealDBLoader.cc index c28765de7483a..84e71da6d2888 100644 --- a/CondTools/Geometry/plugins/ME0RecoIdealDBLoader.cc +++ b/CondTools/Geometry/plugins/ME0RecoIdealDBLoader.cc @@ -28,10 +28,16 @@ class ME0RecoIdealDBLoader : public edm::one::EDAnalyzer { private: bool fromDD4Hep_; + edm::ESGetToken dd4HepCompactViewToken_; + edm::ESGetToken compactViewToken_; + edm::ESGetToken muonGeomConstantsToken_; }; ME0RecoIdealDBLoader::ME0RecoIdealDBLoader(const edm::ParameterSet& iC) { fromDD4Hep_ = iC.getUntrackedParameter("fromDD4Hep", false); // set true for DD4HEP + dd4HepCompactViewToken_ = esConsumes(); + compactViewToken_ = esConsumes(); + muonGeomConstantsToken_ = esConsumes(); } void ME0RecoIdealDBLoader::beginRun(const edm::Run&, edm::EventSetup const& es) { @@ -44,21 +50,17 @@ void ME0RecoIdealDBLoader::beginRun(const edm::Run&, edm::EventSetup const& es) } if (mydbservice->isNewTagRequest("ME0RecoGeometryRcd")) { - edm::ESHandle pMNDC; + auto pMNDC = es.getHandle(muonGeomConstantsToken_); ME0GeometryParsFromDD me0pd; RecoIdealGeometry* rig = new RecoIdealGeometry; if (fromDD4Hep_) { edm::LogVerbatim("ME0RecoIdealDBLoader") << "(0) ME0RecoIdealDBLoader - DD4HEP "; - edm::ESTransientHandle pDD; - es.get().get(pDD); - es.get().get(pMNDC); + auto pDD = es.getTransientHandle(dd4HepCompactViewToken_); const cms::DDCompactView& cpv = *pDD; me0pd.build(&cpv, *pMNDC, *rig); } else { edm::LogVerbatim("ME0RecoIdealDBLoader") << "(0) ME0RecoIdealDBLoader - DDD "; - edm::ESTransientHandle pDD; - es.get().get(pDD); - es.get().get(pMNDC); + auto pDD = es.getTransientHandle(compactViewToken_); const DDCompactView& cpv = *pDD; me0pd.build(&cpv, *pMNDC, *rig); } diff --git a/CondTools/Geometry/plugins/PCaloGeometryBuilder.cc b/CondTools/Geometry/plugins/PCaloGeometryBuilder.cc index 258b2d17fcc6a..438016e6f2ce3 100644 --- a/CondTools/Geometry/plugins/PCaloGeometryBuilder.cc +++ b/CondTools/Geometry/plugins/PCaloGeometryBuilder.cc @@ -19,7 +19,18 @@ class PCaloGeometryBuilder : public edm::one::EDAnalyzer { PCaloGeometryBuilder(const edm::ParameterSet& pset) : m_ecalE(pset.getUntrackedParameter("EcalE", true)), m_ecalP(pset.getUntrackedParameter("EcalP", true)), - m_hgcal(pset.getUntrackedParameter("HGCal", false)) {} + m_hgcal(pset.getUntrackedParameter("HGCal", false)) { + const std::string toDB("_toDB"); + ebGeomToken_ = esConsumes(edm::ESInputTag("", EcalBarrelGeometry::producerTag() + toDB)); + eeGeomToken_ = esConsumes(edm::ESInputTag("", EcalEndcapGeometry::producerTag() + toDB)); + esGeomToken_ = + esConsumes(edm::ESInputTag("", EcalPreshowerGeometry::producerTag() + toDB)); + hgcalGeomToken_ = esConsumes(edm::ESInputTag("", HGCalGeometry::producerTag() + toDB)); + hcalGeomToken_ = esConsumes(edm::ESInputTag("", HcalGeometry::producerTag() + toDB)); + ctGeomToken_ = esConsumes(edm::ESInputTag("", CaloTowerGeometry::producerTag() + toDB)); + zdcGeomToken_ = esConsumes(edm::ESInputTag("", ZdcGeometry::producerTag() + toDB)); + castGeomToken_ = esConsumes(edm::ESInputTag("", CastorGeometry::producerTag() + toDB)); + } void beginRun(edm::Run const& iEvent, edm::EventSetup const&) override; void analyze(edm::Event const& iEvent, edm::EventSetup const&) override {} @@ -29,48 +40,46 @@ class PCaloGeometryBuilder : public edm::one::EDAnalyzer { bool m_ecalE; bool m_ecalP; bool m_hgcal; + edm::ESGetToken ebGeomToken_; + edm::ESGetToken eeGeomToken_; + edm::ESGetToken esGeomToken_; + edm::ESGetToken hgcalGeomToken_; + edm::ESGetToken hcalGeomToken_; + edm::ESGetToken ctGeomToken_; + edm::ESGetToken zdcGeomToken_; + edm::ESGetToken castGeomToken_; }; void PCaloGeometryBuilder::beginRun(const edm::Run&, edm::EventSetup const& es) { - const std::string toDB("_toDB"); - - std::cout << "Writing out " << EcalBarrelGeometry::producerTag() << std::endl; - edm::ESHandle pGeb; - es.get().get(EcalBarrelGeometry::producerTag() + toDB, pGeb); - + edm::LogInfo("PCaloGeometryBuilder") << "Writing out " << EcalBarrelGeometry::producerTag() << std::endl; + auto pGeb = es.getHandle(ebGeomToken_); if (m_ecalE) { - std::cout << "Writing out " << EcalEndcapGeometry::producerTag() << std::endl; - edm::ESHandle pGee; - es.get().get(EcalEndcapGeometry::producerTag() + toDB, pGee); + edm::LogInfo("PCaloGeometryBuilder") << "Writing out " << EcalEndcapGeometry::producerTag() << std::endl; + auto pGeb = es.getHandle(eeGeomToken_); } if (m_ecalP) { - std::cout << "Writing out " << EcalPreshowerGeometry::producerTag() << std::endl; - edm::ESHandle pGes; - es.get().get(EcalPreshowerGeometry::producerTag() + toDB, pGes); + edm::LogInfo("PCaloGeometryBuilder") << "Writing out " << EcalPreshowerGeometry::producerTag() << std::endl; + auto pGes = es.getHandle(esGeomToken_); } if (m_hgcal) { - std::cout << "Writing out " << HGCalGeometry::producerTag() << std::endl; - edm::ESHandle pGee; - es.get().get(HGCalGeometry::producerTag() + toDB, pGee); + edm::LogInfo("PCaloGeometryBuilder") << "Writing out " << HGCalGeometry::producerTag() << std::endl; + auto pGhgcal = es.getHandle(hgcalGeomToken_); + ; } - std::cout << "Writing out " << HcalGeometry::producerTag() << std::endl; - edm::ESHandle pGhcal; - es.get().get(HcalGeometry::producerTag() + toDB, pGhcal); + edm::LogInfo("PCaloGeometryBuilder") << "Writing out " << HcalGeometry::producerTag() << std::endl; + auto pGhcal = es.getHandle(hcalGeomToken_); - std::cout << "Writing out " << CaloTowerGeometry::producerTag() << std::endl; - edm::ESHandle pGct; - es.get().get(CaloTowerGeometry::producerTag() + toDB, pGct); + edm::LogInfo("PCaloGeometryBuilder") << "Writing out " << CaloTowerGeometry::producerTag() << std::endl; + auto pGct = es.getHandle(ctGeomToken_); - std::cout << "Writing out " << ZdcGeometry::producerTag() << std::endl; - edm::ESHandle pGzdc; - es.get().get(ZdcGeometry::producerTag() + toDB, pGzdc); + edm::LogInfo("PCaloGeometryBuilder") << "Writing out " << ZdcGeometry::producerTag() << std::endl; + auto pGzdc = es.getHandle(zdcGeomToken_); - std::cout << "Writing out " << CastorGeometry::producerTag() << std::endl; - edm::ESHandle pGcast; - es.get().get(CastorGeometry::producerTag() + toDB, pGcast); + edm::LogInfo("PCaloGeometryBuilder") << "Writing out " << CastorGeometry::producerTag() << std::endl; + auto pGcast = es.getHandle(castGeomToken_); } DEFINE_FWK_MODULE(PCaloGeometryBuilder); diff --git a/CondTools/Geometry/plugins/PGeometricDetBuilder.cc b/CondTools/Geometry/plugins/PGeometricDetBuilder.cc index 2e9fae089ae4c..5b4ad5d8d4302 100644 --- a/CondTools/Geometry/plugins/PGeometricDetBuilder.cc +++ b/CondTools/Geometry/plugins/PGeometricDetBuilder.cc @@ -32,10 +32,16 @@ class PGeometricDetBuilder : public edm::one::EDAnalyzer { private: void putOne(const GeometricDet* gd, PGeometricDet* pgd, int lev); bool fromDD4hep_; + edm::ESGetToken dd4HepCompactViewToken_; + edm::ESGetToken compactViewToken_; + edm::ESGetToken geometricDetToken_; }; PGeometricDetBuilder::PGeometricDetBuilder(const edm::ParameterSet& iConfig) { fromDD4hep_ = iConfig.getParameter("fromDD4hep"); + dd4HepCompactViewToken_ = esConsumes(); + compactViewToken_ = esConsumes(); + geometricDetToken_ = esConsumes(); } void PGeometricDetBuilder::beginRun(const edm::Run&, edm::EventSetup const& es) { @@ -46,15 +52,11 @@ void PGeometricDetBuilder::beginRun(const edm::Run&, edm::EventSetup const& es) return; } if (!fromDD4hep_) { - edm::ESTransientHandle pDD; - es.get().get(pDD); + auto pDD = es.getTransientHandle(compactViewToken_); } else { - edm::ESTransientHandle pDD; - es.get().get(pDD); + auto pDD = es.getTransientHandle(dd4HepCompactViewToken_); } - edm::ESHandle rDD; - es.get().get(rDD); - const GeometricDet* tracker = &(*rDD); + const GeometricDet* tracker = &es.getData(geometricDetToken_); // so now I have the tracker itself. loop over all its components to store them. putOne(tracker, pgd, 0); diff --git a/CondTools/Geometry/plugins/PHGCalParametersDBBuilder.cc b/CondTools/Geometry/plugins/PHGCalParametersDBBuilder.cc index 6e70a64d40ed5..5468c050f6d70 100644 --- a/CondTools/Geometry/plugins/PHGCalParametersDBBuilder.cc +++ b/CondTools/Geometry/plugins/PHGCalParametersDBBuilder.cc @@ -31,6 +31,8 @@ class PHGCalParametersDBBuilder : public edm::one::EDAnalyzer dd4HepCompactViewToken_; + edm::ESGetToken compactViewToken_; }; PHGCalParametersDBBuilder::PHGCalParametersDBBuilder(const edm::ParameterSet& iC) { @@ -40,6 +42,9 @@ PHGCalParametersDBBuilder::PHGCalParametersDBBuilder(const edm::ParameterSet& iC namec_ = iC.getParameter("nameC"); namet_ = iC.getParameter("nameT"); fromDD4Hep_ = iC.getParameter("fromDD4Hep"); + dd4HepCompactViewToken_ = esConsumes(); + compactViewToken_ = esConsumes(); + #ifdef EDM_ML_DEBUG edm::LogVerbatim("HGCalGeom") << "HGCalParametersESModule for " << name_ << ":" << name2_ << ":" << namew_ << ":" << namec_ << ":" << namet_ << " and fromDD4Hep flag " << fromDD4Hep_; @@ -71,15 +76,13 @@ void PHGCalParametersDBBuilder::beginRun(const edm::Run&, edm::EventSetup const& #ifdef EDM_ML_DEBUG edm::LogVerbatim("HGCalGeom") << "PHGCalParametersDBBuilder::Try to access cm::DDCompactView"; #endif - edm::ESTransientHandle cpv; - es.get().get(cpv); + auto cpv = es.getTransientHandle(dd4HepCompactViewToken_); builder.build(cpv.product(), *ptp, name_, namew_, namec_, namet_, name2_); } else { #ifdef EDM_ML_DEBUG edm::LogVerbatim("HGCalGeom") << "PHGCalParametersDBBuilder::Try to access DDCompactView"; #endif - edm::ESTransientHandle cpv; - es.get().get(cpv); + auto cpv = es.getTransientHandle(compactViewToken_); builder.build(cpv.product(), *ptp, name_, namew_, namec_, namet_); } swapParameters(ptp, phgp); diff --git a/CondTools/Geometry/plugins/PTrackerParametersDBBuilder.cc b/CondTools/Geometry/plugins/PTrackerParametersDBBuilder.cc index 834408e29356c..7013331e71f41 100644 --- a/CondTools/Geometry/plugins/PTrackerParametersDBBuilder.cc +++ b/CondTools/Geometry/plugins/PTrackerParametersDBBuilder.cc @@ -20,10 +20,14 @@ class PTrackerParametersDBBuilder : public edm::one::EDAnalyzer dd4HepCompactViewToken_; + edm::ESGetToken compactViewToken_; }; PTrackerParametersDBBuilder::PTrackerParametersDBBuilder(const edm::ParameterSet& iConfig) { fromDD4hep_ = iConfig.getParameter("fromDD4hep"); + dd4HepCompactViewToken_ = esConsumes(); + compactViewToken_ = esConsumes(); } void PTrackerParametersDBBuilder::beginRun(const edm::Run&, edm::EventSetup const& es) { @@ -37,12 +41,10 @@ void PTrackerParametersDBBuilder::beginRun(const edm::Run&, edm::EventSetup cons TrackerParametersFromDD builder; if (!fromDD4hep_) { - edm::ESTransientHandle cpv; - es.get().get(cpv); + auto cpv = es.getTransientHandle(compactViewToken_); builder.build(&(*cpv), *ptp); } else { - edm::ESTransientHandle cpv; - es.get().get(cpv); + auto cpv = es.getTransientHandle(dd4HepCompactViewToken_); builder.build(&(*cpv), *ptp); } diff --git a/CondTools/Geometry/plugins/RPCRecoIdealDBLoader.cc b/CondTools/Geometry/plugins/RPCRecoIdealDBLoader.cc index 2c7fd91be2331..69332ef488c9e 100644 --- a/CondTools/Geometry/plugins/RPCRecoIdealDBLoader.cc +++ b/CondTools/Geometry/plugins/RPCRecoIdealDBLoader.cc @@ -28,10 +28,16 @@ class RPCRecoIdealDBLoader : public edm::one::EDAnalyzer { private: bool fromDD4Hep_; + edm::ESGetToken dd4HepCompactViewToken_; + edm::ESGetToken compactViewToken_; + edm::ESGetToken muonGeomConstantsToken_; }; RPCRecoIdealDBLoader::RPCRecoIdealDBLoader(const edm::ParameterSet& iC) { fromDD4Hep_ = iC.getUntrackedParameter("fromDD4Hep", false); + dd4HepCompactViewToken_ = esConsumes(); + compactViewToken_ = esConsumes(); + muonGeomConstantsToken_ = esConsumes(); } void RPCRecoIdealDBLoader::beginRun(const edm::Run&, edm::EventSetup const& es) { @@ -42,19 +48,15 @@ void RPCRecoIdealDBLoader::beginRun(const edm::Run&, edm::EventSetup const& es) return; } - edm::ESHandle pMNDC; + auto pMNDC = es.getHandle(muonGeomConstantsToken_); RPCGeometryParsFromDD rpcpd; if (fromDD4Hep_) { - edm::ESTransientHandle pDD; - es.get().get(pDD); - es.get().get(pMNDC); + auto pDD = es.getTransientHandle(dd4HepCompactViewToken_); const cms::DDCompactView& cpv = *pDD; rpcpd.build(&cpv, *pMNDC, *rig); } else { - edm::ESTransientHandle pDD; - es.get().get(pDD); - es.get().get(pMNDC); + auto pDD = es.getTransientHandle(compactViewToken_); const DDCompactView& cpv = *pDD; rpcpd.build(&cpv, *pMNDC, *rig); } diff --git a/CondTools/Geometry/plugins/XMLGeometryReader.cc b/CondTools/Geometry/plugins/XMLGeometryReader.cc index e1011abab24e7..ff6350373266d 100644 --- a/CondTools/Geometry/plugins/XMLGeometryReader.cc +++ b/CondTools/Geometry/plugins/XMLGeometryReader.cc @@ -25,18 +25,19 @@ class XMLGeometryReader : public edm::one::EDAnalyzer { private: std::string m_fname; std::string m_label; + edm::ESGetToken fileBlobToken_; }; XMLGeometryReader::XMLGeometryReader(const edm::ParameterSet& iConfig) { m_fname = iConfig.getUntrackedParameter("XMLFileName", "test.xml"); m_label = iConfig.getUntrackedParameter("geomLabel", "Extended"); + fileBlobToken_ = esConsumes(); } void XMLGeometryReader::beginRun(edm::Run const& run, edm::EventSetup const& iSetup) { edm::LogInfo("XMLGeometryReader") << "XMLGeometryReader::beginRun"; - edm::ESHandle geometry; - iSetup.get().get(m_label, geometry); + auto geometry = iSetup.getHandle(fileBlobToken_); std::unique_ptr > blob((*geometry).getUncompressedBlob()); std::string outfile1(m_fname); diff --git a/CondTools/L1Trigger/interface/Interval.h b/CondTools/L1Trigger/interface/Interval.h deleted file mode 100644 index 48217473b3f37..0000000000000 --- a/CondTools/L1Trigger/interface/Interval.h +++ /dev/null @@ -1,104 +0,0 @@ -#ifndef CondTools_L1Trigger_Interval_h -#define CondTools_L1Trigger_Interval_h - -#include -#include - -namespace l1t -{ - /* Template class that will be used to represnt interval from one value to another. - * In general this class is not interested in what interval mark means, most of the time - * it should be number, time or something similar - * - * This class requires that TimeType should have defined operator == and < as defined in STL. - * It is enforced via sserts that start time is less then end time under provided operator <. - * TimeType requires empty constructor. - * - * Payload should have defined copy constructor and assigment operator. - */ - template - class Interval - { - public: - /* Construncts the class with provided start and end times. Payload is created - * with default constructor. - */ - Interval (const TimeType& start, const TimeType& end) - : m_start (start), m_end (end), isInvalid (false) - { assert (m_start <= m_end); } - - /* Constructs the class with given start and end times, as well as given payload. - */ - Interval (const TimeType& start, const TimeType& end, const PayloadType& payload) - : m_start(start), m_end (end), _payload (payload), isInvalid (false) {} - - /* Sets the payload to the given one. */ - void setPayload (const PayloadType& payload) { this->_payload = payload; } - /* Returns the payload */ - const PayloadType& payload () const { return this->_payload; } - - /* Returns start time */ - const TimeType & start () const { return this->m_start; } - /* Returns end time */ - const TimeType & end () const { return this->m_end; } - - /* Static member that will define an invalid interval. Two invalid interfaces are - * always considered equal. - */ - static Interval & invalid (); - - // Operator overloading - bool operator== (const Interval & other) const - { return (this->isInvalid == true && other.isInvalid == true ) || - (this->start () == other.start ()) && (this->end () == other.end () && - this->isInvalid == other.isInvalid); } - - bool operator!= (const Interval & other) const - { return ! (*this == other); } - - protected: - /* Private data */ - TimeType m_start; - TimeType m_end; - PayloadType _payload; - - /* flag that will check if this interval is invalid */ - bool isInvalid; - }; - - /* Manages a list of intervals and provides method to find interval that contains - * some value. - * - * Template parameters are used to manage Interval class, so all requirements to these - * parameters comes from Interval class - */ - template - class IntervalManager - { - public: - /* Adds one given interval to the list of intervals. - */ - void addInterval (const Interval & interval) - { intervalMap.insert (std::make_pair (interval.start (), interval)); } - - /* Removes all stored intervals from the list - */ - void clear () { intervalMap.clear (); } - - /* Returns interval that contaisn given time. If multiple intervals exists - * any of them is returned - */ - const Interval & find (const TimeType & time) const; - - protected: - /* Information to store list of intervals */ - typedef std::map > IntervalMap; - IntervalMap intervalMap; - }; - -} // namespace - -// implementation -#include "CondTools/L1Trigger/src/Interval.icc" - -#endif diff --git a/CondTools/L1Trigger/interface/L1ConfigOnlineProdBase.h b/CondTools/L1Trigger/interface/L1ConfigOnlineProdBase.h index f3a7a268514fa..dd085fdad37cb 100644 --- a/CondTools/L1Trigger/interface/L1ConfigOnlineProdBase.h +++ b/CondTools/L1Trigger/interface/L1ConfigOnlineProdBase.h @@ -60,6 +60,8 @@ class L1ConfigOnlineProdBase : public edm::ESProducer { private: // ----------member data --------------------------- + edm::ESGetToken l1TriggerKeyListToken_; + edm::ESGetToken l1TriggerKeyToken_; protected: l1t::OMDSReader m_omdsReader; @@ -84,9 +86,11 @@ L1ConfigOnlineProdBase::L1ConfigOnlineProdBase(const edm::Parameter m_copyFromCondDB(false) { //the following line is needed to tell the framework what // data is being produced - setWhatProduced(this); + auto cc = setWhatProduced(this); //now do what ever other initialization is needed + l1TriggerKeyListToken_ = cc.consumes(); + l1TriggerKeyToken_ = cc.consumes(); if (iConfig.exists("copyFromCondDB")) { m_copyFromCondDB = iConfig.getParameter("copyFromCondDB"); @@ -118,10 +122,7 @@ std::unique_ptr L1ConfigOnlineProdBase::produce(const TRcd& std::string key; if (getObjectKey(iRecord, key) || m_forceGeneration) { if (m_copyFromCondDB) { - // Get L1TriggerKeyList from EventSetup - const L1TriggerKeyListRcd& keyListRcd = iRecord.template getRecord(); - edm::ESHandle keyList; - keyListRcd.get(keyList); + auto keyList = iRecord.getHandle(l1TriggerKeyListToken_); // Find payload token std::string recordName = edm::typelookup::className(); @@ -159,10 +160,7 @@ std::unique_ptr L1ConfigOnlineProdBase::produce(const TRcd& } template -bool L1ConfigOnlineProdBase::getObjectKey(const TRcd& record, std::string& objectKey) { - // Get L1TriggerKey - const L1TriggerKeyRcd& keyRcd = record.template getRecord(); - +bool L1ConfigOnlineProdBase::getObjectKey(const TRcd& iRecord, std::string& objectKey) { // Explanation of funny syntax: since record is dependent, we are not // expecting getRecord to be a template so the compiler parses it // as a non-template. http://gcc.gnu.org/ml/gcc-bugs/2005-11/msg03685.html @@ -171,7 +169,7 @@ bool L1ConfigOnlineProdBase::getObjectKey(const TRcd& record, std:: // already in ORCON. edm::ESHandle key; try { - keyRcd.get(key); + key = iRecord.getHandle(l1TriggerKeyToken_); } catch (l1t::DataAlreadyPresentException& ex) { objectKey = std::string(); return false; @@ -183,10 +181,6 @@ bool L1ConfigOnlineProdBase::getObjectKey(const TRcd& record, std:: objectKey = key->get(recordName, dataType); - /* edm::LogVerbatim( "L1-O2O" ) */ - /* << "L1ConfigOnlineProdBase record " << recordName */ - /* << " type " << dataType << " obj key " << objectKey ; */ - // Get L1TriggerKeyList L1TriggerKeyList keyList; l1t::DataWriter dataWriter; diff --git a/CondTools/L1Trigger/interface/L1ObjectKeysOnlineProdBase.h b/CondTools/L1Trigger/interface/L1ObjectKeysOnlineProdBase.h index 15b336a0b23bc..e5134c9271bec 100644 --- a/CondTools/L1Trigger/interface/L1ObjectKeysOnlineProdBase.h +++ b/CondTools/L1Trigger/interface/L1ObjectKeysOnlineProdBase.h @@ -52,6 +52,7 @@ class L1ObjectKeysOnlineProdBase : public edm::ESProducer { // ----------member data --------------------------- protected: l1t::OMDSReader m_omdsReader; + edm::ESGetToken l1TriggerKeyToken_; }; #endif diff --git a/CondTools/L1Trigger/plugins/L1CondDBIOVWriter.cc b/CondTools/L1Trigger/plugins/L1CondDBIOVWriter.cc index ce77216f3d2d2..f87c1aa279675 100644 --- a/CondTools/L1Trigger/plugins/L1CondDBIOVWriter.cc +++ b/CondTools/L1Trigger/plugins/L1CondDBIOVWriter.cc @@ -60,6 +60,7 @@ L1CondDBIOVWriter::L1CondDBIOVWriter(const edm::ParameterSet& iConfig) std::string type = it->getParameter("type"); m_recordTypes.push_back(record + "@" + type); } + l1TriggerKeyToken_ = esConsumes(); } L1CondDBIOVWriter::~L1CondDBIOVWriter() { @@ -122,9 +123,7 @@ void L1CondDBIOVWriter::analyze(const edm::Event& iEvent, const edm::EventSetup& // ORCON. // Get L1TriggerKey from EventSetup - ESHandle esKey; - iSetup.get().get(esKey); - + auto esKey = iSetup.getHandle(l1TriggerKeyToken_); recordTypeToKeyMap = esKey->recordToKeyMap(); } } else { diff --git a/CondTools/L1Trigger/plugins/L1CondDBIOVWriter.h b/CondTools/L1Trigger/plugins/L1CondDBIOVWriter.h index 8aca0f7832ca7..235e15908830b 100644 --- a/CondTools/L1Trigger/plugins/L1CondDBIOVWriter.h +++ b/CondTools/L1Trigger/plugins/L1CondDBIOVWriter.h @@ -24,7 +24,7 @@ // user include files #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/MakerMacros.h" @@ -34,8 +34,9 @@ #include "CondTools/L1Trigger/interface/DataWriter.h" // forward declarations - -class L1CondDBIOVWriter : public edm::EDAnalyzer { +class L1TriggerKey; +class L1TriggerKeyRcd; +class L1CondDBIOVWriter : public edm::one::EDAnalyzer<> { public: explicit L1CondDBIOVWriter(const edm::ParameterSet&); ~L1CondDBIOVWriter() override; @@ -65,6 +66,8 @@ class L1CondDBIOVWriter : public edm::EDAnalyzer { bool m_logTransactions; bool m_forceUpdate; + + edm::ESGetToken l1TriggerKeyToken_; }; #endif diff --git a/CondTools/L1Trigger/plugins/L1CondDBPayloadWriter.cc b/CondTools/L1Trigger/plugins/L1CondDBPayloadWriter.cc index e74d3f8a2828c..b83618cd9ba3e 100644 --- a/CondTools/L1Trigger/plugins/L1CondDBPayloadWriter.cc +++ b/CondTools/L1Trigger/plugins/L1CondDBPayloadWriter.cc @@ -37,10 +37,6 @@ // constants, enums and typedefs // -// -// static data member definitions -// - // // constructors and destructor // @@ -51,6 +47,7 @@ L1CondDBPayloadWriter::L1CondDBPayloadWriter(const edm::ParameterSet& iConfig) m_logTransactions(iConfig.getParameter("logTransactions")), m_newL1TriggerKeyList(iConfig.getParameter("newL1TriggerKeyList")) { //now do what ever initialization is needed + l1TriggerKeyToken_ = esConsumes(); } L1CondDBPayloadWriter::~L1CondDBPayloadWriter() { @@ -87,7 +84,7 @@ void L1CondDBPayloadWriter::analyze(const edm::Event& iEvent, const edm::EventSe bool triggerKeyOK = true; try { // Get L1TriggerKey - iSetup.get().get(key); + key = iSetup.getHandle(l1TriggerKeyToken_); if (!m_overwriteKeys) { triggerKeyOK = oldKeyList.token(key->tscKey()).empty(); diff --git a/CondTools/L1Trigger/plugins/L1CondDBPayloadWriter.h b/CondTools/L1Trigger/plugins/L1CondDBPayloadWriter.h index c9dcfcf944fd3..9da90c278529c 100644 --- a/CondTools/L1Trigger/plugins/L1CondDBPayloadWriter.h +++ b/CondTools/L1Trigger/plugins/L1CondDBPayloadWriter.h @@ -24,7 +24,7 @@ // user include files #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/MakerMacros.h" @@ -34,8 +34,10 @@ #include "CondTools/L1Trigger/interface/DataWriter.h" // forward declarations +class L1TriggerKey; +class L1TriggerKeyRcd; -class L1CondDBPayloadWriter : public edm::EDAnalyzer { +class L1CondDBPayloadWriter : public edm::one::EDAnalyzer<> { public: explicit L1CondDBPayloadWriter(const edm::ParameterSet&); ~L1CondDBPayloadWriter() override; @@ -62,6 +64,8 @@ class L1CondDBPayloadWriter : public edm::EDAnalyzer { // if true, do not retrieve L1TriggerKeyList from EventSetup bool m_newL1TriggerKeyList; + + edm::ESGetToken l1TriggerKeyToken_; }; #endif diff --git a/CondTools/L1Trigger/plugins/L1GtRunSettingsViewer.cc b/CondTools/L1Trigger/plugins/L1GtRunSettingsViewer.cc index 6ea0a161cbdd3..0ed745c632a8d 100644 --- a/CondTools/L1Trigger/plugins/L1GtRunSettingsViewer.cc +++ b/CondTools/L1Trigger/plugins/L1GtRunSettingsViewer.cc @@ -23,7 +23,7 @@ // user include files #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/MakerMacros.h" @@ -53,7 +53,7 @@ // class decleration // -class L1GtRunSettingsViewer : public edm::EDAnalyzer { +class L1GtRunSettingsViewer : public edm::one::EDAnalyzer<> { public: explicit L1GtRunSettingsViewer(const edm::ParameterSet&); ~L1GtRunSettingsViewer() override; diff --git a/CondTools/L1Trigger/plugins/L1O2OTestAnalyzer.cc b/CondTools/L1Trigger/plugins/L1O2OTestAnalyzer.cc index 3e344721c9fc3..72edb7710e608 100644 --- a/CondTools/L1Trigger/plugins/L1O2OTestAnalyzer.cc +++ b/CondTools/L1Trigger/plugins/L1O2OTestAnalyzer.cc @@ -17,13 +17,12 @@ // // system include files -#include #include #include // user include files #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/MakerMacros.h" @@ -44,7 +43,7 @@ // class decleration // -class L1O2OTestAnalyzer : public edm::EDAnalyzer { +class L1O2OTestAnalyzer : public edm::one::EDAnalyzer<> { public: explicit L1O2OTestAnalyzer(const edm::ParameterSet&); ~L1O2OTestAnalyzer() override; @@ -60,6 +59,7 @@ class L1O2OTestAnalyzer : public edm::EDAnalyzer { bool m_printESRecords; bool m_printPayloadTokens; std::vector m_recordsToPrint; + edm::ESGetToken l1TriggerKeyToken_; }; // @@ -80,6 +80,7 @@ L1O2OTestAnalyzer::L1O2OTestAnalyzer(const edm::ParameterSet& iConfig) m_printPayloadTokens(iConfig.getParameter("printPayloadTokens")), m_recordsToPrint(iConfig.getParameter >("recordsToPrint")) { //now do what ever initialization is needed + l1TriggerKeyToken_ = esConsumes(); } L1O2OTestAnalyzer::~L1O2OTestAnalyzer() { @@ -104,65 +105,65 @@ void L1O2OTestAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& edm::LogError("L1-O2O") << "Problem getting last L1TriggerKeyList"; } - std::cout << "Found " << pList.tscKeyToTokenMap().size() << " TSC keys:" << std::endl; + edm::LogInfo("L1-O2O") << "Found " << pList.tscKeyToTokenMap().size() << " TSC keys:" << std::endl; L1TriggerKeyList::KeyToToken::const_iterator iTSCKey = pList.tscKeyToTokenMap().begin(); L1TriggerKeyList::KeyToToken::const_iterator eTSCKey = pList.tscKeyToTokenMap().end(); for (; iTSCKey != eTSCKey; ++iTSCKey) { - std::cout << iTSCKey->first; + edm::LogInfo("L1-O2O") << iTSCKey->first; if (m_printPayloadTokens) { - std::cout << " " << iTSCKey->second; + edm::LogInfo("L1-O2O") << " " << iTSCKey->second; } - std::cout << std::endl; + edm::LogInfo("L1-O2O") << std::endl; } - std::cout << std::endl; + edm::LogInfo("L1-O2O") << std::endl; L1TriggerKeyList::RecordToKeyToToken::const_iterator iRec = pList.recordTypeToKeyToTokenMap().begin(); L1TriggerKeyList::RecordToKeyToToken::const_iterator eRec = pList.recordTypeToKeyToTokenMap().end(); for (; iRec != eRec; ++iRec) { const L1TriggerKeyList::KeyToToken& keyTokenMap = iRec->second; - std::cout << "For record@type " << iRec->first << ", found " << keyTokenMap.size() << " keys:" << std::endl; + edm::LogInfo("L1-O2O") << "For record@type " << iRec->first << ", found " << keyTokenMap.size() + << " keys:" << std::endl; L1TriggerKeyList::KeyToToken::const_iterator iKey = keyTokenMap.begin(); L1TriggerKeyList::KeyToToken::const_iterator eKey = keyTokenMap.end(); for (; iKey != eKey; ++iKey) { - std::cout << iKey->first; + edm::LogInfo("L1-O2O") << iKey->first; if (m_printPayloadTokens) { - std::cout << " " << iKey->second; + edm::LogInfo("L1-O2O") << " " << iKey->second; } - std::cout << std::endl; + edm::LogInfo("L1-O2O") << std::endl; } - std::cout << std::endl; + edm::LogInfo("L1-O2O") << std::endl; } } if (m_printL1TriggerKey) { try { - ESHandle pKey; - iSetup.get().get(pKey); - - std::cout << std::endl; - std::cout << "Current TSC key = " << pKey->tscKey() << std::endl << std::endl; - - std::cout << "Current subsystem keys:" << std::endl; - std::cout << "CSCTF " << pKey->subsystemKey(L1TriggerKey::kCSCTF) << std::endl; - std::cout << "DTTF " << pKey->subsystemKey(L1TriggerKey::kDTTF) << std::endl; - std::cout << "RPC " << pKey->subsystemKey(L1TriggerKey::kRPC) << std::endl; - std::cout << "GMT " << pKey->subsystemKey(L1TriggerKey::kGMT) << std::endl; - std::cout << "RCT " << pKey->subsystemKey(L1TriggerKey::kRCT) << std::endl; - std::cout << "GCT " << pKey->subsystemKey(L1TriggerKey::kGCT) << std::endl; - std::cout << "GT " << pKey->subsystemKey(L1TriggerKey::kGT) << std::endl; - std::cout << "TSP0 " << pKey->subsystemKey(L1TriggerKey::kTSP0) << std::endl << std::endl; - - std::cout << "Object keys:" << std::endl; + auto pKey = iSetup.getHandle(l1TriggerKeyToken_); + + edm::LogInfo("L1-O2O") << std::endl; + edm::LogInfo("L1-O2O") << "Current TSC key = " << pKey->tscKey() << std::endl << std::endl; + + edm::LogInfo("L1-O2O") << "Current subsystem keys:" << std::endl; + edm::LogInfo("L1-O2O") << "CSCTF " << pKey->subsystemKey(L1TriggerKey::kCSCTF) << std::endl; + edm::LogInfo("L1-O2O") << "DTTF " << pKey->subsystemKey(L1TriggerKey::kDTTF) << std::endl; + edm::LogInfo("L1-O2O") << "RPC " << pKey->subsystemKey(L1TriggerKey::kRPC) << std::endl; + edm::LogInfo("L1-O2O") << "GMT " << pKey->subsystemKey(L1TriggerKey::kGMT) << std::endl; + edm::LogInfo("L1-O2O") << "RCT " << pKey->subsystemKey(L1TriggerKey::kRCT) << std::endl; + edm::LogInfo("L1-O2O") << "GCT " << pKey->subsystemKey(L1TriggerKey::kGCT) << std::endl; + edm::LogInfo("L1-O2O") << "GT " << pKey->subsystemKey(L1TriggerKey::kGT) << std::endl; + edm::LogInfo("L1-O2O") << "TSP0 " << pKey->subsystemKey(L1TriggerKey::kTSP0) << std::endl << std::endl; + + edm::LogInfo("L1-O2O") << "Object keys:" << std::endl; const L1TriggerKey::RecordToKey& recKeyMap = pKey->recordToKeyMap(); L1TriggerKey::RecordToKey::const_iterator iRec = recKeyMap.begin(); L1TriggerKey::RecordToKey::const_iterator eRec = recKeyMap.end(); for (; iRec != eRec; ++iRec) { - std::cout << iRec->first << " " << iRec->second << std::endl; + edm::LogInfo("L1-O2O") << iRec->first << " " << iRec->second << std::endl; } } catch (cms::Exception& ex) { - std::cout << "No L1TriggerKey found." << std::endl; + edm::LogError("L1-O2O") << "No L1TriggerKey found." << std::endl; } } @@ -184,7 +185,7 @@ void L1O2OTestAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& l1t::DataWriter writer; - std::cout << std::endl << "Run Settings keys:" << std::endl; + edm::LogInfo("L1-O2O") << std::endl << "Run Settings keys:" << std::endl; std::vector::const_iterator iRec = m_recordsToPrint.begin(); std::vector::const_iterator iEnd = m_recordsToPrint.end(); @@ -198,11 +199,11 @@ void L1O2OTestAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& key = pList.objectKey(*iRec, payloadToken); } - std::cout << *iRec << " " << key; + edm::LogInfo("L1-O2O") << *iRec << " " << key; if (m_printPayloadTokens) { - std::cout << " " << payloadToken; + edm::LogInfo("L1-O2O") << " " << payloadToken; } - std::cout << std::endl; + edm::LogInfo("L1-O2O") << std::endl; // Replace spaces in key with ?s. Do reverse substitution when // making L1TriggerKey. @@ -210,7 +211,7 @@ void L1O2OTestAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& log += " " + *iRec + "Key=" + key; } - std::cout << std::endl << log << std::endl; + edm::LogInfo("L1-O2O") << std::endl << log << std::endl; } } diff --git a/CondTools/L1Trigger/plugins/L1TriggerKeyOnlineProd.cc b/CondTools/L1Trigger/plugins/L1TriggerKeyOnlineProd.cc index 193d3a4a75e95..8ee11cd2c3a06 100644 --- a/CondTools/L1Trigger/plugins/L1TriggerKeyOnlineProd.cc +++ b/CondTools/L1Trigger/plugins/L1TriggerKeyOnlineProd.cc @@ -47,9 +47,13 @@ L1TriggerKeyOnlineProd::L1TriggerKeyOnlineProd(const edm::ParameterSet& iConfig) : m_subsystemLabels(iConfig.getParameter >("subsystemLabels")) { //the following line is needed to tell the framework what // data is being produced - setWhatProduced(this); + auto cc = setWhatProduced(this); //now do what ever other initialization is needed + l1TriggerKeyToken_ = cc.consumes(edm::ESInputTag("", "SubsystemKeysOnly")); + for (const auto& mlabel : m_subsystemLabels) { + l1TriggerKeyTokenVec_.emplace_back(cc.consumes(edm::ESInputTag("", mlabel))); + } } L1TriggerKeyOnlineProd::~L1TriggerKeyOnlineProd() { @@ -66,7 +70,7 @@ L1TriggerKeyOnlineProd::ReturnType L1TriggerKeyOnlineProd::produce(const L1Trigg // Start with "SubsystemKeysOnly" edm::ESHandle subsystemKeys; try { - iRecord.get("SubsystemKeysOnly", subsystemKeys); + subsystemKeys = iRecord.getHandle(l1TriggerKeyToken_); } catch (l1t::DataAlreadyPresentException& ex) { throw ex; } @@ -74,12 +78,10 @@ L1TriggerKeyOnlineProd::ReturnType L1TriggerKeyOnlineProd::produce(const L1Trigg std::unique_ptr pL1TriggerKey = std::make_unique(*subsystemKeys); // Collate object keys - std::vector::const_iterator itr = m_subsystemLabels.begin(); - std::vector::const_iterator end = m_subsystemLabels.end(); - for (; itr != end; ++itr) { + for (const auto& l1token : l1TriggerKeyTokenVec_) { edm::ESHandle objectKeys; try { - iRecord.get(*itr, objectKeys); + objectKeys = iRecord.getHandle(l1token); } catch (l1t::DataAlreadyPresentException& ex) { throw ex; } diff --git a/CondTools/L1Trigger/plugins/L1TriggerKeyOnlineProd.h b/CondTools/L1Trigger/plugins/L1TriggerKeyOnlineProd.h index 6e4fc1d7002f1..52c1e1173efea 100644 --- a/CondTools/L1Trigger/plugins/L1TriggerKeyOnlineProd.h +++ b/CondTools/L1Trigger/plugins/L1TriggerKeyOnlineProd.h @@ -33,6 +33,8 @@ #include "CondFormats/DataRecord/interface/L1TriggerKeyRcd.h" // forward declarations +class L1TriggerKey; +class L1TriggerKeyRcd; class L1TriggerKeyOnlineProd : public edm::ESProducer { public: @@ -46,6 +48,8 @@ class L1TriggerKeyOnlineProd : public edm::ESProducer { private: // ----------member data --------------------------- std::vector m_subsystemLabels; + edm::ESGetToken l1TriggerKeyToken_; + std::vector> l1TriggerKeyTokenVec_; }; #endif diff --git a/CondTools/L1Trigger/src/L1ObjectKeysOnlineProdBase.cc b/CondTools/L1Trigger/src/L1ObjectKeysOnlineProdBase.cc index 7b84c154f6dac..705080945d74b 100644 --- a/CondTools/L1Trigger/src/L1ObjectKeysOnlineProdBase.cc +++ b/CondTools/L1Trigger/src/L1ObjectKeysOnlineProdBase.cc @@ -52,9 +52,10 @@ L1ObjectKeysOnlineProdBase::L1ObjectKeysOnlineProdBase(const edm::ParameterSet& // The subsystemLabel is used by L1TriggerKeyOnlineProd to identify the // L1TriggerKeys to concatenate. - setWhatProduced(this, iConfig.getParameter("subsystemLabel")); + auto cc = setWhatProduced(this, iConfig.getParameter("subsystemLabel")); //now do what ever other initialization is needed + l1TriggerKeyToken_ = cc.consumes(edm::ESInputTag("", "SubsystemKeysOnly")); } L1ObjectKeysOnlineProdBase::~L1ObjectKeysOnlineProdBase() { @@ -72,7 +73,7 @@ L1ObjectKeysOnlineProdBase::ReturnType L1ObjectKeysOnlineProdBase::produce(const // not present. edm::ESHandle subsystemKeys; try { - iRecord.get("SubsystemKeysOnly", subsystemKeys); + subsystemKeys = iRecord.getHandle(l1TriggerKeyToken_); } catch (l1t::DataAlreadyPresentException& ex) { throw ex; } diff --git a/CondTools/L1TriggerExt/plugins/L1CondDBIOVWriterExt.cc b/CondTools/L1TriggerExt/plugins/L1CondDBIOVWriterExt.cc index f34132d0e0c58..935e8b66d8224 100644 --- a/CondTools/L1TriggerExt/plugins/L1CondDBIOVWriterExt.cc +++ b/CondTools/L1TriggerExt/plugins/L1CondDBIOVWriterExt.cc @@ -25,6 +25,7 @@ L1CondDBIOVWriterExt::L1CondDBIOVWriterExt(const edm::ParameterSet& iConfig) std::string type = it->getParameter("type"); m_recordTypes.push_back(record + "@" + type); } + l1TriggerKeyExtToken_ = esConsumes(); } L1CondDBIOVWriterExt::~L1CondDBIOVWriterExt() { @@ -86,8 +87,7 @@ void L1CondDBIOVWriterExt::analyze(const edm::Event& iEvent, const edm::EventSet // ORCON. // Get L1TriggerKeyExt from EventSetup - ESHandle esKey; - iSetup.get().get(esKey); + auto esKey = iSetup.getHandle(l1TriggerKeyExtToken_); recordTypeToKeyMap = esKey->recordToKeyMap(); } diff --git a/CondTools/L1TriggerExt/plugins/L1CondDBIOVWriterExt.h b/CondTools/L1TriggerExt/plugins/L1CondDBIOVWriterExt.h index 616eed4348ce1..ee26f6e4100e3 100644 --- a/CondTools/L1TriggerExt/plugins/L1CondDBIOVWriterExt.h +++ b/CondTools/L1TriggerExt/plugins/L1CondDBIOVWriterExt.h @@ -4,7 +4,7 @@ // user include files #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/MakerMacros.h" @@ -13,7 +13,10 @@ #include "CondTools/L1TriggerExt/interface/DataWriterExt.h" -class L1CondDBIOVWriterExt : public edm::EDAnalyzer { +class L1TriggerKeyExt; +class L1TriggerKeyExtRcd; + +class L1CondDBIOVWriterExt : public edm::one::EDAnalyzer<> { public: explicit L1CondDBIOVWriterExt(const edm::ParameterSet&); ~L1CondDBIOVWriterExt() override; @@ -45,6 +48,8 @@ class L1CondDBIOVWriterExt : public edm::EDAnalyzer { bool m_logTransactions; bool m_forceUpdate; + + edm::ESGetToken l1TriggerKeyExtToken_; }; #endif diff --git a/CondTools/L1TriggerExt/plugins/L1CondDBPayloadWriterExt.h b/CondTools/L1TriggerExt/plugins/L1CondDBPayloadWriterExt.h index b8da3c798ecc7..062c7e1aa11d8 100644 --- a/CondTools/L1TriggerExt/plugins/L1CondDBPayloadWriterExt.h +++ b/CondTools/L1TriggerExt/plugins/L1CondDBPayloadWriterExt.h @@ -3,7 +3,7 @@ #include #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/MakerMacros.h" @@ -17,7 +17,7 @@ #include "CondFormats/L1TObjects/interface/L1TriggerKeyExt.h" #include "CondFormats/DataRecord/interface/L1TriggerKeyExtRcd.h" -class L1CondDBPayloadWriterExt : public edm::EDAnalyzer { +class L1CondDBPayloadWriterExt : public edm::one::EDAnalyzer<> { public: explicit L1CondDBPayloadWriterExt(const edm::ParameterSet&); ~L1CondDBPayloadWriterExt() override; diff --git a/CondTools/L1TriggerExt/plugins/L1O2OTestAnalyzerExt.cc b/CondTools/L1TriggerExt/plugins/L1O2OTestAnalyzerExt.cc index 051d9e7d5db14..eb5221a3b30c0 100644 --- a/CondTools/L1TriggerExt/plugins/L1O2OTestAnalyzerExt.cc +++ b/CondTools/L1TriggerExt/plugins/L1O2OTestAnalyzerExt.cc @@ -1,9 +1,8 @@ -#include #include #include #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/MakerMacros.h" @@ -26,7 +25,7 @@ // class decleration // -class L1O2OTestAnalyzerExt : public edm::EDAnalyzer { +class L1O2OTestAnalyzerExt : public edm::one::EDAnalyzer<> { public: explicit L1O2OTestAnalyzerExt(const edm::ParameterSet&); ~L1O2OTestAnalyzerExt() override; @@ -42,6 +41,7 @@ class L1O2OTestAnalyzerExt : public edm::EDAnalyzer { bool m_printESRecords; bool m_printPayloadTokens; std::vector m_recordsToPrint; + edm::ESGetToken l1TriggerKeyExtToken_; }; L1O2OTestAnalyzerExt::L1O2OTestAnalyzerExt(const edm::ParameterSet& iConfig) @@ -51,6 +51,7 @@ L1O2OTestAnalyzerExt::L1O2OTestAnalyzerExt(const edm::ParameterSet& iConfig) m_printPayloadTokens(iConfig.getParameter("printPayloadTokens")), m_recordsToPrint(iConfig.getParameter >("recordsToPrint")) { //now do what ever initialization is needed + l1TriggerKeyExtToken_ = esConsumes(); } L1O2OTestAnalyzerExt::~L1O2OTestAnalyzerExt() { @@ -71,65 +72,56 @@ void L1O2OTestAnalyzerExt::analyze(const edm::Event& iEvent, const edm::EventSet edm::LogError("L1-O2O") << "Problem getting last L1TriggerKeyListExt"; } - std::cout << "Found " << pList.tscKeyToTokenMap().size() << " TSC keys:" << std::endl; + edm::LogInfo("L1-O2O") << "Found " << pList.tscKeyToTokenMap().size() << " TSC keys:"; L1TriggerKeyListExt::KeyToToken::const_iterator iTSCKey = pList.tscKeyToTokenMap().begin(); L1TriggerKeyListExt::KeyToToken::const_iterator eTSCKey = pList.tscKeyToTokenMap().end(); for (; iTSCKey != eTSCKey; ++iTSCKey) { - std::cout << iTSCKey->first; + edm::LogInfo("L1-O2O") << iTSCKey->first; if (m_printPayloadTokens) { - std::cout << " " << iTSCKey->second; + edm::LogInfo("L1-O2O") << " " << iTSCKey->second; } - std::cout << std::endl; } - std::cout << std::endl; L1TriggerKeyListExt::RecordToKeyToToken::const_iterator iRec = pList.recordTypeToKeyToTokenMap().begin(); L1TriggerKeyListExt::RecordToKeyToToken::const_iterator eRec = pList.recordTypeToKeyToTokenMap().end(); for (; iRec != eRec; ++iRec) { const L1TriggerKeyListExt::KeyToToken& keyTokenMap = iRec->second; - std::cout << "For record@type " << iRec->first << ", found " << keyTokenMap.size() << " keys:" << std::endl; + edm::LogInfo("L1-O2O") << "For record@type " << iRec->first << ", found " << keyTokenMap.size() << " keys:"; L1TriggerKeyListExt::KeyToToken::const_iterator iKey = keyTokenMap.begin(); L1TriggerKeyListExt::KeyToToken::const_iterator eKey = keyTokenMap.end(); for (; iKey != eKey; ++iKey) { - std::cout << iKey->first; + edm::LogInfo("L1-O2O") << iKey->first; if (m_printPayloadTokens) { - std::cout << " " << iKey->second; + edm::LogInfo("L1-O2O") << " " << iKey->second; } - std::cout << std::endl; } - std::cout << std::endl; } } if (m_printL1TriggerKeyExt) { try { - ESHandle pKey; - iSetup.get().get(pKey); + ESHandle pKey = iSetup.getHandle(l1TriggerKeyExtToken_); - std::cout << std::endl; - std::cout << "Current TSC key = " << pKey->tscKey() << std::endl << std::endl; + edm::LogInfo("L1-O2O") << "Current TSC key = " << pKey->tscKey(); - std::cout << "Current subsystem keys:" << std::endl; - std::cout << "TSP0 " << pKey->subsystemKey(L1TriggerKeyExt::kuGT) << std::endl << std::endl; + edm::LogInfo("L1-O2O") << "Current subsystem keys:"; + edm::LogInfo("L1-O2O") << "TSP0 " << pKey->subsystemKey(L1TriggerKeyExt::kuGT); - std::cout << "Object keys:" << std::endl; + edm::LogInfo("L1-O2O") << "Object keys:"; const L1TriggerKeyExt::RecordToKey& recKeyMap = pKey->recordToKeyMap(); L1TriggerKeyExt::RecordToKey::const_iterator iRec = recKeyMap.begin(); L1TriggerKeyExt::RecordToKey::const_iterator eRec = recKeyMap.end(); for (; iRec != eRec; ++iRec) { - std::cout << iRec->first << " " << iRec->second << std::endl; + edm::LogInfo("L1-O2O") << iRec->first << " " << iRec->second; } } catch (cms::Exception& ex) { - std::cout << "No L1TriggerKeyExt found." << std::endl; + edm::LogInfo("L1-O2O") << "No L1TriggerKeyExt found."; } } if (m_printESRecords) { - // ESHandle< L1TriggerKeyListExt > pList ; - // iSetup.get< L1TriggerKeyListExtRcd >().get( pList ) ; - L1TriggerKeyListExt pList; l1t::DataWriterExt dataWriter; if (!dataWriter.fillLastTriggerKeyList(pList)) { @@ -144,7 +136,7 @@ void L1O2OTestAnalyzerExt::analyze(const edm::Event& iEvent, const edm::EventSet l1t::DataWriterExt writer; - std::cout << std::endl << "Run Settings keys:" << std::endl; + edm::LogInfo("L1-O2O") << "Run Settings keys:"; std::vector::const_iterator iRec = m_recordsToPrint.begin(); std::vector::const_iterator iEnd = m_recordsToPrint.end(); @@ -158,11 +150,10 @@ void L1O2OTestAnalyzerExt::analyze(const edm::Event& iEvent, const edm::EventSet key = pList.objectKey(*iRec, payloadToken); } - std::cout << *iRec << " " << key; + edm::LogInfo("L1-O2O") << *iRec << " " << key; if (m_printPayloadTokens) { - std::cout << " " << payloadToken; + edm::LogInfo("L1-O2O") << " " << payloadToken; } - std::cout << std::endl; // Replace spaces in key with ?s. Do reverse substitution when // making L1TriggerKeyExt. @@ -170,7 +161,7 @@ void L1O2OTestAnalyzerExt::analyze(const edm::Event& iEvent, const edm::EventSet log += " " + *iRec + "Key=" + key; } - std::cout << std::endl << log << std::endl; + edm::LogInfo("L1-O2O") << log; } } diff --git a/CondTools/RPC/interface/L1RPCHwConfigDBWriter.h b/CondTools/RPC/interface/L1RPCHwConfigDBWriter.h deleted file mode 100644 index 5ac0c70158af1..0000000000000 --- a/CondTools/RPC/interface/L1RPCHwConfigDBWriter.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef L1RPCHWCONFIGDBWRITER -#define L1RPCHWCONFIGDBWRITER - -#include "CondCore/PopCon/interface/PopConAnalyzer.h" -#include "CondTools/RPC/interface/L1RPCHwConfigSourceHandler.h" - - -class L1RPCHwConfigDBWriter : public popcon::PopConAnalyzer -{ - public: - L1RPCHwConfigDBWriter(const edm::ParameterSet&); - private: - void initSource(const edm::Event& evt, const edm::EventSetup& est); - int m_validate; -}; - - -#endif diff --git a/CondTools/RPC/interface/RPCEMapDBWriter.h b/CondTools/RPC/interface/RPCEMapDBWriter.h deleted file mode 100644 index 37175c3ade0b4..0000000000000 --- a/CondTools/RPC/interface/RPCEMapDBWriter.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef RPCEMAPDBWRITER -#define RPCEMAPDBWRITER - -#include "CondCore/PopCon/interface/PopConAnalyzer.h" -#include "CondTools/RPC/interface/RPCEMapSourceHandler.h" - - -class RPCEMapDBWriter : public popcon::PopConAnalyzer -{ - public: - RPCEMapDBWriter(const edm::ParameterSet&); - private: - void initSource(const edm::Event& evt, const edm::EventSetup& est); - int m_validate; -}; - - -#endif diff --git a/CondTools/RunInfo/interface/BTransitionAnalyzer.h b/CondTools/RunInfo/interface/BTransitionAnalyzer.h index b4078a7f7793c..fb0d058840ebb 100644 --- a/CondTools/RunInfo/interface/BTransitionAnalyzer.h +++ b/CondTools/RunInfo/interface/BTransitionAnalyzer.h @@ -17,7 +17,11 @@ namespace cond { class BTransitionAnalyzer : public edm::one::EDAnalyzer { public: BTransitionAnalyzer(const edm::ParameterSet& pset) - : m_currentThreshold(pset.getUntrackedParameter("currentThreshold", 18000.)) {} + : m_currentThreshold(pset.getUntrackedParameter("currentThreshold", 18000.)), + m_RunInfoToken(esConsumes()), + m_ESToken(esConsumes()), + m_ESTokenB0T(esConsumes(edm::ESInputTag("", "0T"))), + m_ESTokenB38T(esConsumes(edm::ESInputTag("", "38T"))) {} #ifdef __INTEL_COMPILER virtual ~BTransitionAnalyzer() = default; #endif @@ -28,9 +32,8 @@ namespace cond { void beginRun(edm::Run const&, edm::EventSetup const&) final{}; void analyze(edm::Event const&, edm::EventSetup const&) final{}; void endRun(edm::Run const& run, edm::EventSetup const& eventSetup) final { - edm::ESHandle runInfoHandle; + edm::ESHandle runInfoHandle = eventSetup.getHandle(m_RunInfoToken); edm::ESHandle payloadHandle, payloadRefHandle; - eventSetup.get().get(runInfoHandle); double avg_current = (double)runInfoHandle->m_avg_current; double current_default = -1; std::string bOnLabel = std::string("38T"); @@ -40,13 +43,16 @@ namespace cond { << " A for run: " << run.run() << " with the corresponding threshold: " << m_currentThreshold << " A." << std::endl; - if (avg_current != current_default && avg_current <= m_currentThreshold) + if (avg_current != current_default && avg_current <= m_currentThreshold) { bFieldLabel = bOffLabel; + payloadHandle = eventSetup.getHandle(m_ESTokenB0T); + } else { + payloadHandle = eventSetup.getHandle(m_ESTokenB38T); + } edm::LogInfo("BTransitionAnalyzer") << "The magnet was " << (bFieldLabel == bOnLabel ? "ON" : "OFF") << " during run " << run.run() << ".\nLoading the product for the corrisponding label " << bFieldLabel << std::endl; - eventSetup.get().get(bFieldLabel, payloadHandle); - eventSetup.get().get(payloadRefHandle); + payloadRefHandle = eventSetup.getHandle(m_ESToken); edm::Service mydbservice; if (mydbservice.isAvailable()) { if (!equalPayloads(payloadHandle, payloadRefHandle)) { @@ -68,6 +74,10 @@ namespace cond { private: double m_currentThreshold; + const edm::ESGetToken m_RunInfoToken; + const edm::ESGetToken m_ESToken; + const edm::ESGetToken m_ESTokenB0T; + const edm::ESGetToken m_ESTokenB38T; }; } //namespace cond #endif //BTRANSITIONANALYZER_H diff --git a/CondTools/RunInfo/interface/LHCInfoPopConSourceHandler.h b/CondTools/RunInfo/interface/LHCInfoPopConSourceHandler.h index b5354952d869f..9a96c57765066 100644 --- a/CondTools/RunInfo/interface/LHCInfoPopConSourceHandler.h +++ b/CondTools/RunInfo/interface/LHCInfoPopConSourceHandler.h @@ -47,7 +47,6 @@ class LHCInfoPopConSourceHandler : public popcon::PopConSourceHandler { std::unique_ptr m_fillPayload; std::shared_ptr m_prevPayload; std::vector > > m_tmpBuffer; - std::vector > m_payloadBuffer; bool m_lastPayloadEmpty = false; }; diff --git a/CondTools/RunInfo/plugins/FillInfoESAnalyzer.cc b/CondTools/RunInfo/plugins/FillInfoESAnalyzer.cc index b0a671da4fd40..7f37da876acb8 100644 --- a/CondTools/RunInfo/plugins/FillInfoESAnalyzer.cc +++ b/CondTools/RunInfo/plugins/FillInfoESAnalyzer.cc @@ -1,8 +1,7 @@ #include #include #include -#include "FWCore/Framework/interface/EDAnalyzer.h" -#include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/Framework/interface/MakerMacros.h" @@ -10,33 +9,39 @@ #include "CondFormats/DataRecord/interface/FillInfoRcd.h" namespace edmtest { - class FillInfoESAnalyzer : public edm::EDAnalyzer { + class FillInfoESAnalyzer : public edm::one::EDAnalyzer<> { + private: + const edm::ESGetToken m_FillInfoToken; + public: - explicit FillInfoESAnalyzer(edm::ParameterSet const& p) { std::cout << "FillInfoESAnalyzer" << std::endl; } - explicit FillInfoESAnalyzer(int i) { std::cout << "FillInfoESAnalyzer " << i << std::endl; } - ~FillInfoESAnalyzer() override { std::cout << "~FillInfoESAnalyzer " << std::endl; } + explicit FillInfoESAnalyzer(edm::ParameterSet const& p) : m_FillInfoToken(esConsumes()) { + edm::LogPrint("FillInfoESAnalyzer") << "FillInfoESAnalyzer" << std::endl; + } + explicit FillInfoESAnalyzer(int i) { + edm::LogPrint("FillInfoESAnalyzer") << "FillInfoESAnalyzer " << i << std::endl; + } + ~FillInfoESAnalyzer() override { edm::LogPrint("FillInfoESAnalyzer") << "~FillInfoESAnalyzer " << std::endl; } void analyze(const edm::Event& e, const edm::EventSetup& c) override; }; void FillInfoESAnalyzer::analyze(const edm::Event& e, const edm::EventSetup& context) { - std::cout << "###FillInfoESAnalyzer::analyze" << std::endl; - std::cout << " I AM IN RUN NUMBER " << e.id().run() << std::endl; - std::cout << " ---EVENT NUMBER " << e.id().event() << std::endl; + edm::LogPrint("FillInfoESAnalyzer") << "###FillInfoESAnalyzer::analyze" << std::endl; + edm::LogPrint("FillInfoESAnalyzer") << " I AM IN RUN NUMBER " << e.id().run() << std::endl; + edm::LogPrint("FillInfoESAnalyzer") << " ---EVENT NUMBER " << e.id().event() << std::endl; edm::eventsetup::EventSetupRecordKey recordKey( edm::eventsetup::EventSetupRecordKey::TypeTag::findType("FillInfoRcd")); if (recordKey.type() == edm::eventsetup::EventSetupRecordKey::TypeTag()) { //record not found - std::cout << "Record \"FillInfoRcd" - << "\" does not exist " << std::endl; + edm::LogPrint("FillInfoESAnalyzer") << "Record \"FillInfoRcd" + << "\" does not exist " << std::endl; } - edm::ESHandle sum; - std::cout << "got eshandle" << std::endl; - context.get().get(sum); - std::cout << "got context" << std::endl; + edm::LogPrint("FillInfoESAnalyzer") << "got eshandle" << std::endl; + edm::ESHandle sum = context.getHandle(m_FillInfoToken); + edm::LogPrint("FillInfoESAnalyzer") << "got context" << std::endl; const FillInfo* summary = sum.product(); - std::cout << "got FillInfo* " << std::endl; - std::cout << "print result" << std::endl; - std::cout << *summary; + edm::LogPrint("FillInfoESAnalyzer") << "got FillInfo* " << std::endl; + edm::LogPrint("FillInfoESAnalyzer") << "print result" << std::endl; + edm::LogPrint("FillInfoESAnalyzer") << *summary; } DEFINE_FWK_MODULE(FillInfoESAnalyzer); } // namespace edmtest diff --git a/CondTools/RunInfo/plugins/LHCInfoESAnalyzer.cc b/CondTools/RunInfo/plugins/LHCInfoESAnalyzer.cc index ef8aef7e5674a..652326164a95e 100644 --- a/CondTools/RunInfo/plugins/LHCInfoESAnalyzer.cc +++ b/CondTools/RunInfo/plugins/LHCInfoESAnalyzer.cc @@ -1,8 +1,7 @@ #include #include #include -#include "FWCore/Framework/interface/EDAnalyzer.h" -#include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/Framework/interface/MakerMacros.h" @@ -10,33 +9,37 @@ #include "CondFormats/DataRecord/interface/LHCInfoRcd.h" namespace edmtest { - class LHCInfoESAnalyzer : public edm::EDAnalyzer { + class LHCInfoESAnalyzer : public edm::one::EDAnalyzer<> { + private: + const edm::ESGetToken m_LHCInfoToken; + public: - explicit LHCInfoESAnalyzer(edm::ParameterSet const& p) { std::cout << "LHCInfoESAnalyzer" << std::endl; } - explicit LHCInfoESAnalyzer(int i) { std::cout << "LHCInfoESAnalyzer " << i << std::endl; } - ~LHCInfoESAnalyzer() override { std::cout << "~LHCInfoESAnalyzer " << std::endl; } + explicit LHCInfoESAnalyzer(edm::ParameterSet const& p) : m_LHCInfoToken(esConsumes()) { + edm::LogPrint("LHCInfoESAnalyzer") << "LHCInfoESAnalyzer" << std::endl; + } + explicit LHCInfoESAnalyzer(int i) { edm::LogPrint("LHCInfoESAnalyzer") << "LHCInfoESAnalyzer " << i << std::endl; } + ~LHCInfoESAnalyzer() override { edm::LogPrint("LHCInfoESAnalyzer") << "~LHCInfoESAnalyzer " << std::endl; } void analyze(const edm::Event& e, const edm::EventSetup& c) override; }; void LHCInfoESAnalyzer::analyze(const edm::Event& e, const edm::EventSetup& context) { - std::cout << "###LHCInfoESAnalyzer::analyze" << std::endl; - std::cout << " I AM IN RUN NUMBER " << e.id().run() << std::endl; - std::cout << " ---EVENT NUMBER " << e.id().event() << std::endl; + edm::LogPrint("LHCInfoESAnalyzer") << "###LHCInfoESAnalyzer::analyze" << std::endl; + edm::LogPrint("LHCInfoESAnalyzer") << " I AM IN RUN NUMBER " << e.id().run() << std::endl; + edm::LogPrint("LHCInfoESAnalyzer") << " ---EVENT NUMBER " << e.id().event() << std::endl; edm::eventsetup::EventSetupRecordKey recordKey( edm::eventsetup::EventSetupRecordKey::TypeTag::findType("LHCInfoRcd")); if (recordKey.type() == edm::eventsetup::EventSetupRecordKey::TypeTag()) { //record not found - std::cout << "Record \"LHCInfoRcd" - << "\" does not exist " << std::endl; + edm::LogPrint("LHCInfoESAnalyzer") << "Record \"LHCInfoRcd" + << "\" does not exist " << std::endl; } - edm::ESHandle sum; - std::cout << "got eshandle" << std::endl; - context.get().get(sum); - std::cout << "got context" << std::endl; + edm::LogPrint("LHCInfoESAnalyzer") << "got eshandle" << std::endl; + edm::ESHandle sum = context.getHandle(m_LHCInfoToken); + edm::LogPrint("LHCInfoESAnalyzer") << "got context" << std::endl; const LHCInfo* summary = sum.product(); - std::cout << "got LHCInfo* " << std::endl; - std::cout << "print result" << std::endl; - std::cout << *summary; + edm::LogPrint("LHCInfoESAnalyzer") << "got LHCInfo* " << std::endl; + edm::LogPrint("LHCInfoESAnalyzer") << "print result" << std::endl; + edm::LogPrint("LHCInfoESAnalyzer") << *summary; } DEFINE_FWK_MODULE(LHCInfoESAnalyzer); } // namespace edmtest diff --git a/CondTools/RunInfo/plugins/RunInfoESAnalyzer.cc b/CondTools/RunInfo/plugins/RunInfoESAnalyzer.cc index 73ed2cea5619b..b50861abf30f6 100644 --- a/CondTools/RunInfo/plugins/RunInfoESAnalyzer.cc +++ b/CondTools/RunInfo/plugins/RunInfoESAnalyzer.cc @@ -2,75 +2,54 @@ #include #include #include -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/MakerMacros.h" - #include "FWCore/Framework/interface/EventSetup.h" - #include "CondFormats/RunInfo/interface/RunInfo.h" - #include "CondFormats/DataRecord/interface/RunSummaryRcd.h" using namespace std; namespace edmtest { - class RunInfoESAnalyzer : public edm::EDAnalyzer { + class RunInfoESAnalyzer : public edm::one::EDAnalyzer<> { + private: + const edm::ESGetToken m_RunInfoToken; + public: - explicit RunInfoESAnalyzer(edm::ParameterSet const& p) { std::cout << "RunInfoESAnalyzer" << std::endl; } - explicit RunInfoESAnalyzer(int i) { std::cout << "RunInfoESAnalyzer " << i << std::endl; } - ~RunInfoESAnalyzer() override { std::cout << "~RunInfoESAnalyzer " << std::endl; } - // virtual void beginJob(); - // virtual void beginRun(const edm::Run&, const edm::EventSetup& context); + explicit RunInfoESAnalyzer(edm::ParameterSet const& p) : m_RunInfoToken(esConsumes()) { + edm::LogPrint("RunInfoESAnalyzer") << "RunInfoESAnalyzer" << std::endl; + } + explicit RunInfoESAnalyzer(int i) { edm::LogPrint("RunInfoESAnalyzer") << "RunInfoESAnalyzer " << i << std::endl; } + ~RunInfoESAnalyzer() override { edm::LogPrint("RunInfoESAnalyzer") << "~RunInfoESAnalyzer " << std::endl; } void analyze(const edm::Event& e, const edm::EventSetup& c) override; - - private: }; - - /* void - RunInfoESAnalyzer::beginRun(const edm::Run&, const edm::EventSetup& context){ - std::cout<<"###RunInfoESAnalyzer::beginRun"< RunInfo_lumiarray; - std::cout<<"got eshandle"<().get(RunInfo_lumiarray); - std::cout<<"got data"< sum; - std::cout << "got eshandle" << std::endl; - context.get().get(sum); - std::cout << "got context" << std::endl; + edm::LogPrint("RunInfoESAnalyzer") << "got eshandle" << std::endl; + edm::ESHandle sum = context.getHandle(m_RunInfoToken); + edm::LogPrint("RunInfoESAnalyzer") << "got context" << std::endl; const RunInfo* summary = sum.product(); - std::cout << "got RunInfo* " << std::endl; - - std::cout << "print result" << std::endl; + edm::LogPrint("RunInfoESAnalyzer") << "got RunInfo* " << std::endl; + edm::LogPrint("RunInfoESAnalyzer") << "print result" << std::endl; summary->printAllValues(); - /* std::vector subdet = summary->getSubdtIn(); - std::cout<<"subdetector in the run "<< std::endl; + /* + std::vector subdet = summary->getSubdtIn(); + edm::LogPrint("RunInfoESAnalyzer")<<"subdetector in the run "<< std::endl; for (size_t i=0; i " << subdet[i] << std::endl; + edm::LogPrint("RunInfoESAnalyzer")<<"--> " << subdet[i] << std::endl; } */ } diff --git a/CondTools/RunInfo/plugins/RunSummaryESAnalyzer.cc b/CondTools/RunInfo/plugins/RunSummaryESAnalyzer.cc index ae4b69b5f47a3..1d23fb1b5c283 100644 --- a/CondTools/RunInfo/plugins/RunSummaryESAnalyzer.cc +++ b/CondTools/RunInfo/plugins/RunSummaryESAnalyzer.cc @@ -2,75 +2,59 @@ #include #include #include -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/MakerMacros.h" - #include "FWCore/Framework/interface/EventSetup.h" - #include "CondFormats/RunInfo/interface/RunSummary.h" - #include "CondFormats/DataRecord/interface/RunSummaryRcd.h" using namespace std; namespace edmtest { - class RunSummaryESAnalyzer : public edm::EDAnalyzer { + class RunSummaryESAnalyzer : public edm::one::EDAnalyzer<> { + private: + const edm::ESGetToken m_RunSummaryToken; + public: - explicit RunSummaryESAnalyzer(edm::ParameterSet const& p) { std::cout << "RunSummaryESAnalyzer" << std::endl; } - explicit RunSummaryESAnalyzer(int i) { std::cout << "RunSummaryESAnalyzer " << i << std::endl; } - ~RunSummaryESAnalyzer() override { std::cout << "~RunSummaryESAnalyzer " << std::endl; } - // virtual void beginJob(); - // virtual void beginRun(const edm::Run&, const edm::EventSetup& context); + explicit RunSummaryESAnalyzer(edm::ParameterSet const& p) : m_RunSummaryToken(esConsumes()) { + edm::LogPrint("RunSummaryESAnalyzer") << "RunSummaryESAnalyzer" << std::endl; + } + explicit RunSummaryESAnalyzer(int i) { + edm::LogPrint("RunSummaryESAnalyzer") << "RunSummaryESAnalyzer " << i << std::endl; + } + ~RunSummaryESAnalyzer() override { edm::LogPrint("RunSummaryESAnalyzer") << "~RunSummaryESAnalyzer " << std::endl; } void analyze(const edm::Event& e, const edm::EventSetup& c) override; private: }; - /* void - RunSummaryESAnalyzer::beginRun(const edm::Run&, const edm::EventSetup& context){ - std::cout<<"###RunSummaryESAnalyzer::beginRun"< RunSummary_lumiarray; - std::cout<<"got eshandle"<().get(RunSummary_lumiarray); - std::cout<<"got data"< sum; - std::cout << "got eshandle" << std::endl; - context.get().get(sum); - std::cout << "got context" << std::endl; + edm::LogPrint("RunSummaryESAnalyzer") << "got eshandle" << std::endl; + edm::ESHandle sum = context.getHandle(m_RunSummaryToken); + edm::LogPrint("RunSummaryESAnalyzer") << "got context" << std::endl; const RunSummary* summary = sum.product(); - std::cout << "got RunSummary* " << std::endl; + edm::LogPrint("RunSummaryESAnalyzer") << "got RunSummary* " << std::endl; - std::cout << "print result" << std::endl; + edm::LogPrint("RunSummaryESAnalyzer") << "print result" << std::endl; summary->printAllValues(); std::vector subdet = summary->getSubdtIn(); - std::cout << "subdetector in the run " << std::endl; + edm::LogPrint("RunSummaryESAnalyzer") << "subdetector in the run " << std::endl; for (size_t i = 0; i < subdet.size(); i++) { - std::cout << "--> " << subdet[i] << std::endl; + edm::LogPrint("RunSummaryESAnalyzer") << "--> " << subdet[i] << std::endl; } } DEFINE_FWK_MODULE(RunSummaryESAnalyzer); diff --git a/CondTools/RunInfo/plugins/XangleBetaStarFilter.cc b/CondTools/RunInfo/plugins/XangleBetaStarFilter.cc index 3f15ee08ca43b..25efa0de9d5fd 100644 --- a/CondTools/RunInfo/plugins/XangleBetaStarFilter.cc +++ b/CondTools/RunInfo/plugins/XangleBetaStarFilter.cc @@ -6,17 +6,16 @@ #include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/Utilities/interface/Exception.h" -#include "FWCore/Framework/interface/EDFilter.h" +#include "FWCore/Framework/interface/stream/EDFilter.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/Framework/interface/EventSetup.h" - #include "CondFormats/RunInfo/interface/LHCInfo.h" #include "CondFormats/DataRecord/interface/LHCInfoRcd.h" //---------------------------------------------------------------------------------------------------- -class XangleBetaStarFilter : public edm::EDFilter { +class XangleBetaStarFilter : public edm::stream::EDFilter<> { public: explicit XangleBetaStarFilter(const edm::ParameterSet &); diff --git a/CondTools/RunInfo/src/FillInfoPopConSourceHandler.cc b/CondTools/RunInfo/src/FillInfoPopConSourceHandler.cc index 0ecb37fbdb8be..545be7b1827df 100644 --- a/CondTools/RunInfo/src/FillInfoPopConSourceHandler.cc +++ b/CondTools/RunInfo/src/FillInfoPopConSourceHandler.cc @@ -145,7 +145,8 @@ void FillInfoPopConSourceHandler::getNewObjects() { //execute the query coral::ICursor &fillDataCursor = fillDataQuery->execute(); //initialize loop variables - unsigned short previousFillNumber = 1, currentFill = m_firstFill; + unsigned short previousFillNumber = 1; + unsigned short currentFill = m_firstFill; cond::Time_t previousFillEndTime = 0ULL, afterPreviousFillEndTime = 0ULL, beforeStableBeamStartTime = 0ULL; if (tagInfo().size > 0) { previousFillNumber = previousFill->fillNumber(); diff --git a/CondTools/RunInfo/src/LHCInfoPopConSourceHandler.cc b/CondTools/RunInfo/src/LHCInfoPopConSourceHandler.cc index 0ab9ba892f4f9..a1b4ed97e42e9 100644 --- a/CondTools/RunInfo/src/LHCInfoPopConSourceHandler.cc +++ b/CondTools/RunInfo/src/LHCInfoPopConSourceHandler.cc @@ -31,8 +31,7 @@ LHCInfoPopConSourceHandler::LHCInfoPopConSourceHandler(edm::ParameterSet const& m_authpath(pset.getUntrackedParameter("authenticationPath", "")), m_fillPayload(), m_prevPayload(), - m_tmpBuffer(), - m_payloadBuffer() { + m_tmpBuffer() { if (pset.exists("startTime")) { m_startTime = boost::posix_time::time_from_string(pset.getUntrackedParameter("startTime")); } @@ -773,19 +772,18 @@ bool LHCInfoPopConSourceHandler::getEcalData(cond::persistency::Session& session void LHCInfoPopConSourceHandler::addEmptyPayload(cond::Time_t iov) { bool add = false; - if (m_to_transfer.empty()) { + if (m_iovs.empty()) { if (!m_lastPayloadEmpty) add = true; } else { - LHCInfo* lastAdded = m_to_transfer.back().first; + auto lastAdded = m_iovs.rbegin()->second; if (lastAdded->fillNumber() != 0) { add = true; } } if (add) { auto newPayload = std::make_shared(); - m_to_transfer.push_back(std::make_pair(newPayload.get(), iov)); - m_payloadBuffer.push_back(newPayload); + m_iovs.insert(std::make_pair(iov, newPayload)); m_prevPayload = newPayload; } } @@ -816,26 +814,24 @@ namespace LHCInfoImpl { } size_t transferPayloads(const std::vector>>& buffer, - std::vector>& payloadBuffer, - std::vector>& vecToTransfer, + std::map>& iovsToTransfer, std::shared_ptr& prevPayload) { size_t niovs = 0; for (auto& iov : buffer) { bool add = false; - LHCInfo& payload = *iov.second; + auto payload = iov.second; cond::Time_t since = iov.first; - if (vecToTransfer.empty()) { + if (iovsToTransfer.empty()) { add = true; } else { - LHCInfo& lastAdded = *vecToTransfer.back().first; - if (!comparePayloads(lastAdded, payload)) { + LHCInfo& lastAdded = *iovsToTransfer.rbegin()->second; + if (!comparePayloads(lastAdded, *payload)) { add = true; } } if (add) { niovs++; - vecToTransfer.push_back(std::make_pair(&payload, since)); - payloadBuffer.push_back(iov.second); + iovsToTransfer.insert(std::make_pair(since, payload)); prevPayload = iov.second; } } @@ -965,11 +961,10 @@ void LHCInfoPopConSourceHandler::getNewObjects() { getEcalData(session2, startSampleTime, endSampleTime, updateEcal); session2.transaction().commit(); // - size_t niovs = LHCInfoImpl::transferPayloads(m_tmpBuffer, m_payloadBuffer, m_to_transfer, m_prevPayload); + size_t niovs = LHCInfoImpl::transferPayloads(m_tmpBuffer, m_iovs, m_prevPayload); edm::LogInfo(m_name) << "Added " << niovs << " iovs within the Fill time"; m_tmpBuffer.clear(); iovAdded = true; - //if(m_prevPayload->fillNumber() and m_prevPayload->endTime()!=0ULL) addEmptyPayload( m_fillPayload->endTime() ); if (m_prevPayload->fillNumber() and m_fillPayload->endTime() != 0ULL) addEmptyPayload(m_fillPayload->endTime()); } diff --git a/CondTools/RunInfo/src/RunInfoRead.cc b/CondTools/RunInfo/src/RunInfoRead.cc index 1b7ac4230dafa..f135f1aa3945b 100644 --- a/CondTools/RunInfo/src/RunInfoRead.cc +++ b/CondTools/RunInfo/src/RunInfoRead.cc @@ -23,22 +23,22 @@ #include namespace { - std::string dot("."); - std::string quote("\""); - std::string bNOTb(" NOT "); - std::string squoted(const std::string& s) { return quote + s + quote; } + const std::string dot("."); + const std::string quote("\""); + const std::string bNOTb(" NOT "); + const std::string squoted(const std::string& s) { return quote + s + quote; } //now strings for the tables and columns to be queried - std::string sParameterTable("RUNSESSION_PARAMETER"); - std::string sDateTable("RUNSESSION_DATE"); - std::string sStringTable("RUNSESSION_STRING"); - std::string sIdParameterColumn("ID"); - std::string sRunNumberParameterColumn("RUNNUMBER"); - std::string sNameParameterColumn("NAME"); - std::string sRunSessionParameterIdDataColumn("RUNSESSION_PARAMETER_ID"); - std::string sValueDataColumn("VALUE"); - std::string sDCSMagnetTable("CMSFWMAGNET"); - std::string sDCSMagnetCurrentColumn("CURRENT"); - std::string sDCSMagnetChangeDateColumn("CHANGE_DATE"); + const std::string sParameterTable("RUNSESSION_PARAMETER"); + const std::string sDateTable("RUNSESSION_DATE"); + const std::string sStringTable("RUNSESSION_STRING"); + const std::string sIdParameterColumn("ID"); + const std::string sRunNumberParameterColumn("RUNNUMBER"); + const std::string sNameParameterColumn("NAME"); + const std::string sRunSessionParameterIdDataColumn("RUNSESSION_PARAMETER_ID"); + const std::string sValueDataColumn("VALUE"); + const std::string sDCSMagnetTable("CMSFWMAGNET"); + const std::string sDCSMagnetCurrentColumn("CURRENT"); + const std::string sDCSMagnetChangeDateColumn("CHANGE_DATE"); } // namespace RunInfoRead::RunInfoRead(const std::string& connectionString, const edm::ParameterSet& connectionPset) diff --git a/CondTools/RunInfo/src/RunSummaryHandler.cc b/CondTools/RunInfo/src/RunSummaryHandler.cc index eddf3499f8c76..3232e3fea56c2 100644 --- a/CondTools/RunInfo/src/RunSummaryHandler.cc +++ b/CondTools/RunInfo/src/RunSummaryHandler.cc @@ -47,7 +47,6 @@ void RunSummaryHandler::getNewObjects() { size_t n_empty_run = 0; if (tagInfo().size > 0 && (tagInfo().lastInterval.since + 1) < snc) { - n_empty_run = snc - tagInfo().lastInterval.since - 1; edm::LogInfo("RunSummaryHandler") << "------- " << "entering fake run from " << tagInfo().lastInterval.since + 1 << "to " << snc - 1 << "- > getNewObjects" << std::endl; diff --git a/CondTools/SiPhase2Tracker/test/BuildFile.xml b/CondTools/SiPhase2Tracker/test/BuildFile.xml new file mode 100644 index 0000000000000..4f550c96b297f --- /dev/null +++ b/CondTools/SiPhase2Tracker/test/BuildFile.xml @@ -0,0 +1 @@ + diff --git a/CondTools/SiPhase2Tracker/test/DTCCablingMapProducer_write.py b/CondTools/SiPhase2Tracker/test/DTCCablingMapProducer_write.py index a839346c27ebf..adfa131aa0d52 100644 --- a/CondTools/SiPhase2Tracker/test/DTCCablingMapProducer_write.py +++ b/CondTools/SiPhase2Tracker/test/DTCCablingMapProducer_write.py @@ -33,7 +33,7 @@ #dummy_fill_mode = cms.string("DUMMY_FILL_DISABLED"), #dummy_fill_mode = cms.string("DUMMY_FILL_ELINK_ID"), modulesToDTCCablingCSVFileNames = cms.vstring( - "CondTools/SiPhase2Tracker/TrackerDetToDTCELinkCablingMap__OT614_200_IT404_layer2_10G__T6__OTOnly.csv" + "CondTools/SiPhase2Tracker/data/TrackerModuleToDTCCablingMap__OT616_200_IT613__T14__OTOnly.csv" ), dummy_fill_mode = cms.string("DUMMY_FILL_ELINK_ID_AND_GBT_ID"), csvFormat_ncolumns = cms.uint32( 2), diff --git a/CondTools/SiPhase2Tracker/test/test_CondToolsSiPhase2Tracker.sh b/CondTools/SiPhase2Tracker/test/test_CondToolsSiPhase2Tracker.sh new file mode 100755 index 0000000000000..fe07682f72789 --- /dev/null +++ b/CondTools/SiPhase2Tracker/test/test_CondToolsSiPhase2Tracker.sh @@ -0,0 +1,15 @@ + #!/bin/bash -ex +TEST_DIR=$CMSSW_BASE/src/CondTools/SiPhase2Tracker/test +echo "test dir: $TEST_DIR" + +cmsRun ${TEST_DIR}/SiPhase2OuterTrackerLorentzAngleWriter_cfg.py + +## need to be in order (don't read before writing) +cmsRun ${TEST_DIR}/DTCCablingMapTestProducer_write.py +cmsRun ${TEST_DIR}/DTCCablingMapTestProducer_retrieve.py +cmsRun ${TEST_DIR}/DTCCablingMapTestProducer_dump.py + +## need to be in order (don't read before writing) +cmsRun ${TEST_DIR}/DTCCablingMapProducer_write.py +cmsRun ${TEST_DIR}/DTCCablingMapProducer_retrieve.py +cmsRun ${TEST_DIR}/DTCCablingMapProducer_dump.py diff --git a/CondTools/SiPixel/plugins/BuildFile.xml b/CondTools/SiPixel/plugins/BuildFile.xml index 8b6c28ff1f2d3..e77dddc76cc94 100644 --- a/CondTools/SiPixel/plugins/BuildFile.xml +++ b/CondTools/SiPixel/plugins/BuildFile.xml @@ -1,4 +1,14 @@ + + + + + + + + + + diff --git a/CondTools/SiPixel/plugins/PixelDCSObjectReader.cc b/CondTools/SiPixel/plugins/PixelDCSObjectReader.cc new file mode 100644 index 0000000000000..668402bf0f479 --- /dev/null +++ b/CondTools/SiPixel/plugins/PixelDCSObjectReader.cc @@ -0,0 +1,6 @@ +#include "FWCore/Framework/interface/MakerMacros.h" +#include "CondTools/SiPixel/plugins/PixelDCSObjectReader.h" +#include "CondFormats/DataRecord/interface/PixelDCSRcds.h" +#include "CondFormats/SiPixelObjects/interface/PixelDCSObject.h" + +DEFINE_FWK_MODULE(PixelDCSObjectReader); diff --git a/CondTools/SiPixel/test/PixelDCSObjectReader.h b/CondTools/SiPixel/plugins/PixelDCSObjectReader.h similarity index 66% rename from CondTools/SiPixel/test/PixelDCSObjectReader.h rename to CondTools/SiPixel/plugins/PixelDCSObjectReader.h index 190da5c5d3e67..02f4adda3d221 100644 --- a/CondTools/SiPixel/test/PixelDCSObjectReader.h +++ b/CondTools/SiPixel/plugins/PixelDCSObjectReader.h @@ -12,30 +12,30 @@ #include "TTree.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" -#include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/Framework/interface/Frameworkfwd.h" #include "FWCore/ServiceRegistry/interface/Service.h" #include "CommonTools/UtilAlgos/interface/TFileService.h" template -class PixelDCSObjectReader : public edm::EDAnalyzer { +class PixelDCSObjectReader : public edm::one::EDAnalyzer { typedef typename Record::Object Object; public: - PixelDCSObjectReader(const edm::ParameterSet&) {} + PixelDCSObjectReader(const edm::ParameterSet&) : esToken(esConsumes()) { + usesResource(TFileService::kSharedResource); + } - void analyze(const edm::Event&, const edm::EventSetup&); + void analyze(const edm::Event&, const edm::EventSetup&) override; + +private: + edm::ESGetToken esToken; }; template void PixelDCSObjectReader::analyze(const edm::Event&, const edm::EventSetup& setup) { - edm::ESHandle handle; - - setup.get().get(handle); - - Object object = *handle; + const Object* object = &setup.getData(esToken); edm::Service fs; diff --git a/CondTools/SiPixel/plugins/PixelPopConCalibChecker.cc b/CondTools/SiPixel/plugins/PixelPopConCalibChecker.cc new file mode 100644 index 0000000000000..eba9cbe40616e --- /dev/null +++ b/CondTools/SiPixel/plugins/PixelPopConCalibChecker.cc @@ -0,0 +1,159 @@ +// PixelPopConCalibChecker.cc +// +// EDAnalyzer to check calibration configuration objects transferred to database +// +// M. Eads +// Aug 2008 + +#include +#include "PixelPopConCalibChecker.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "CalibFormats/SiPixelObjects/interface/PixelCalibConfiguration.h" + +using namespace std; + +// +// constructors and destructor +// +PixelPopConCalibChecker::PixelPopConCalibChecker(const edm::ParameterSet& iConfig) : gainCalibToken_(esConsumes()) { + _filename = iConfig.getParameter("filename"); + _messageLevel = iConfig.getUntrackedParameter("messageLevel", 0); + if (_messageLevel > 0) + edm::LogPrint("PixelPopConCalibChecker") << "********* PixelPopConCalibChecker ************" << endl; +} + +PixelPopConCalibChecker::~PixelPopConCalibChecker() = default; + +// +// member functions +// + +// ------------ method called to for each event ------------ +void PixelPopConCalibChecker::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { + using namespace edm; + + bool isSame = true; + + // get the run and event number from the EmptyIOVSource + if (_messageLevel > 0) { + EventID eventID = iEvent.id(); + edm::LogPrint("PixelPopConCalibChecker") << "Comparing SiPixelCalibConfiguration object from database for run " + << eventID.run() << " to calib.dat file at " << _filename << endl; + } // if (_messageLevel > 0) + + // get the calib config object in the database from the event setup + const SiPixelCalibConfiguration* calibES = &iSetup.getData(gainCalibToken_); + + // get the calib config object from the calib.dat file + pos::PixelCalibConfiguration fancyCalib(_filename); + SiPixelCalibConfiguration* calibFile = new SiPixelCalibConfiguration(fancyCalib); + + // check if mode matches + string modeES = calibES->getCalibrationMode(); + string modeFile = calibFile->getCalibrationMode(); + if (_messageLevel > 1) { + edm::LogPrint("PixelPopConCalibChecker") << "*** Checking calibration mode ***" << endl; + edm::LogPrint("PixelPopConCalibChecker") << " mode from DB: " << modeES << endl; + edm::LogPrint("PixelPopConCalibChecker") << " mode from file: " << modeFile << endl; + } + if (modeES != modeFile) { + isSame = false; + if (_messageLevel > 0) { + edm::LogPrint("PixelPopConCalibChecker") << "Mismatch in calibration mode!" << endl; + edm::LogPrint("PixelPopConCalibChecker") << " " << modeES << " in database, " << modeFile << " in file" << endl; + } + } + + // check if the number of triggers matches + short ntriggerES = calibES->getNTriggers(); + short ntriggerFile = calibFile->getNTriggers(); + if (_messageLevel > 1) { + edm::LogPrint("PixelPopConCalibChecker") << "*** Checking number of triggers ***" << endl; + edm::LogPrint("PixelPopConCalibChecker") << " NTriggers from DB: " << ntriggerES << endl; + edm::LogPrint("PixelPopConCalibChecker") << " NTriggers from file: " << ntriggerFile << endl; + } + if (ntriggerES != ntriggerFile) { + isSame = false; + if (_messageLevel > 0) { + edm::LogPrint("PixelPopConCalibChecker") << "Mismatch in number of triggers!" << endl; + edm::LogPrint("PixelPopConCalibChecker") + << " " << ntriggerES << " in database, " << ntriggerFile << " in file" << endl; + } + } + + // check if vcal values match + vector vcalES = calibES->getVCalValues(); + vector vcalFile = calibFile->getVCalValues(); + if (_messageLevel > 1) { + edm::LogPrint("PixelPopConCalibChecker") << "*** Checking vcal values ***" << endl; + edm::LogPrint("PixelPopConCalibChecker") << " vcal values from DB: "; + for (vector::const_iterator it = vcalES.begin(); it != vcalES.end(); ++it) + edm::LogPrint("PixelPopConCalibChecker") << *it << ", "; + edm::LogPrint("PixelPopConCalibChecker") << endl; + edm::LogPrint("PixelPopConCalibChecker") << " vcal values from file: "; + for (vector::const_iterator it = vcalFile.begin(); it != vcalFile.end(); ++it) + edm::LogPrint("PixelPopConCalibChecker") << *it << ", "; + edm::LogPrint("PixelPopConCalibChecker") << endl; + } + if (vcalES != vcalFile) { + isSame = false; + if (_messageLevel > 0) { + edm::LogPrint("PixelPopConCalibChecker") << "Mismatch in vcal values!" << endl; + } + } + + // check if column values match + vector colES = calibES->getColumnPattern(); + vector colFile = calibFile->getColumnPattern(); + if (_messageLevel > 1) { + edm::LogPrint("PixelPopConCalibChecker") << "*** Checking column pattern values ***" << endl; + edm::LogPrint("PixelPopConCalibChecker") << " column pattern from DB: "; + for (vector::const_iterator it = colES.begin(); it != colES.end(); ++it) + edm::LogPrint("PixelPopConCalibChecker") << *it << ", "; + edm::LogPrint("PixelPopConCalibChecker") << endl; + edm::LogPrint("PixelPopConCalibChecker") << " column pattern from file: "; + for (vector::const_iterator it = colFile.begin(); it != colFile.end(); ++it) + edm::LogPrint("PixelPopConCalibChecker") << *it << ", "; + edm::LogPrint("PixelPopConCalibChecker") << endl; + } + if (colES != colFile) { + isSame = false; + if (_messageLevel > 0) { + edm::LogPrint("PixelPopConCalibChecker") << "Mismatch in column pattern!" << endl; + } + } + + // check if row values match + vector rowES = calibES->getRowPattern(); + vector rowFile = calibFile->getRowPattern(); + if (_messageLevel > 1) { + edm::LogPrint("PixelPopConCalibChecker") << "*** Checking row pattern values ***" << endl; + edm::LogPrint("PixelPopConCalibChecker") << " row pattern from DB: "; + for (vector::const_iterator it = rowES.begin(); it != rowES.end(); ++it) + edm::LogPrint("PixelPopConCalibChecker") << *it << ", "; + edm::LogPrint("PixelPopConCalibChecker") << endl; + edm::LogPrint("PixelPopConCalibChecker") << " row pattern from file: "; + for (vector::const_iterator it = rowFile.begin(); it != rowFile.end(); ++it) + edm::LogPrint("PixelPopConCalibChecker") << *it << ", "; + edm::LogPrint("PixelPopConCalibChecker") << endl; + } + if (rowES != rowFile) { + isSame = false; + if (_messageLevel > 0) { + edm::LogPrint("PixelPopConCalibChecker") << "Mismatch in row pattern!" << endl; + } + } + + edm::LogPrint("PixelPopConCalibChecker") << endl; + if (isSame) { + edm::LogPrint("PixelPopConCalibChecker") + << "*** Calibration configuration in database and file match. Go forth and calibrate." << endl; + } else { + edm::LogPrint("PixelPopConCalibChecker") + << "*** WARNING! Calibration configuration is database and file DO NOT match!" << endl; + } + +} // PixelPopConCalibChecker::analyze() + +//define this as a plug-in +DEFINE_FWK_MODULE(PixelPopConCalibChecker); diff --git a/CondTools/SiPixel/test/PixelPopConCalibChecker.h b/CondTools/SiPixel/plugins/PixelPopConCalibChecker.h similarity index 68% rename from CondTools/SiPixel/test/PixelPopConCalibChecker.h rename to CondTools/SiPixel/plugins/PixelPopConCalibChecker.h index 17259c5a25842..64cc36da5d58e 100644 --- a/CondTools/SiPixel/test/PixelPopConCalibChecker.h +++ b/CondTools/SiPixel/plugins/PixelPopConCalibChecker.h @@ -25,31 +25,27 @@ // user include files #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" - +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/MakerMacros.h" - #include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "CondFormats/SiPixelObjects/interface/SiPixelCalibConfiguration.h" +#include "CondFormats/DataRecord/interface/SiPixelCalibConfigurationRcd.h" // // class decleration // -class PixelPopConCalibChecker : public edm::EDAnalyzer { +class PixelPopConCalibChecker : public edm::one::EDAnalyzer<> { public: explicit PixelPopConCalibChecker(const edm::ParameterSet&); - ~PixelPopConCalibChecker(); + ~PixelPopConCalibChecker() override; + void analyze(const edm::Event&, const edm::EventSetup&) override; private: - //virtual void beginJob(const edm::EventSetup&) ; - virtual void beginJob(); - virtual void analyze(const edm::Event&, const edm::EventSetup&); - virtual void endJob(); - + // ----------member data --------------------------- + edm::ESGetToken gainCalibToken_; std::string _filename; int _messageLevel; - - // ----------member data --------------------------- }; #endif diff --git a/CondTools/SiPixel/test/SiPixel2DTemplateDBObjectReader.cc b/CondTools/SiPixel/plugins/SiPixel2DTemplateDBObjectReader.cc similarity index 60% rename from CondTools/SiPixel/test/SiPixel2DTemplateDBObjectReader.cc rename to CondTools/SiPixel/plugins/SiPixel2DTemplateDBObjectReader.cc index 751f2e6f3b19c..c5e626349ab9c 100644 --- a/CondTools/SiPixel/test/SiPixel2DTemplateDBObjectReader.cc +++ b/CondTools/SiPixel/plugins/SiPixel2DTemplateDBObjectReader.cc @@ -1,46 +1,86 @@ -#include "CondTools/SiPixel/test/SiPixel2DTemplateDBObjectReader.h" #include #include #include #include +#include #include "FWCore/ParameterSet/interface/FileInPath.h" #include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" +#include "FWCore/Framework/interface/ESWatcher.h" + +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/MakerMacros.h" + +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" +#include "FWCore/Utilities/interface/ESGetToken.h" + #include "MagneticField/Engine/interface/MagneticField.h" +#include "CondFormats/SiPixelObjects/interface/SiPixel2DTemplateDBObject.h" +#include "CondFormats/DataRecord/interface/SiPixel2DTemplateDBObjectRcd.h" +#include "CalibTracker/Records/interface/SiPixel2DTemplateDBObjectESProducerRcd.h" +#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" + +class SiPixel2DTemplateDBObjectReader : public edm::one::EDAnalyzer<> { +public: + explicit SiPixel2DTemplateDBObjectReader(const edm::ParameterSet&); + ~SiPixel2DTemplateDBObjectReader() override; + +private: + void beginJob() override; + void analyze(const edm::Event&, const edm::EventSetup&) override; + void endJob() override; + + edm::ESWatcher SiPix2DTemplDBObjectWatcher_; + edm::ESWatcher SiPix2DTemplDBObjWatcher_; + + std::string the2DTemplateCalibrationLocation; + bool theDetailed2DTemplateDBErrorOutput; + bool theFull2DTemplateDBOutput; + bool testGlobalTag; + bool hasTriggeredWatcher; + edm::ESGetToken magneticFieldToken_; + edm::ESGetToken the2DTemplateESProdToken_; + edm::ESGetToken the2DTemplateToken_; +}; SiPixel2DTemplateDBObjectReader::SiPixel2DTemplateDBObjectReader(const edm::ParameterSet& iConfig) : the2DTemplateCalibrationLocation(iConfig.getParameter("siPixel2DTemplateCalibrationLocation")), theDetailed2DTemplateDBErrorOutput(iConfig.getParameter("wantDetailed2DTemplateDBErrorOutput")), theFull2DTemplateDBOutput(iConfig.getParameter("wantFull2DTemplateDBOutput")), testGlobalTag(iConfig.getParameter("TestGlobalTag")), - hasTriggeredWatcher(false) {} + hasTriggeredWatcher(false), + magneticFieldToken_(esConsumes()), + the2DTemplateESProdToken_(esConsumes()), + the2DTemplateToken_(esConsumes()) {} -SiPixel2DTemplateDBObjectReader::~SiPixel2DTemplateDBObjectReader() {} +SiPixel2DTemplateDBObjectReader::~SiPixel2DTemplateDBObjectReader() = default; void SiPixel2DTemplateDBObjectReader::beginJob() {} -void SiPixel2DTemplateDBObjectReader::analyze(const edm::Event& iEvent, const edm::EventSetup& setup) { +void SiPixel2DTemplateDBObjectReader::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { //To test with the ESProducer + SiPixel2DTemplateDBObject dbobject; if (testGlobalTag) { - edm::ESHandle magfield; - setup.get().get(magfield); + // Get magnetic field GlobalPoint center(0.0, 0.0, 0.0); + edm::ESHandle magfield = iSetup.getHandle(magneticFieldToken_); float theMagField = magfield.product()->inTesla(center).mag(); - std::cout << "\nTesting global tag at magfield = " << theMagField << std::endl; - if (SiPix2DTemplDBObjWatcher_.check(setup)) { - edm::ESHandle generrorH; - setup.get().get(generrorH); - dbobject = *generrorH.product(); + edm::LogPrint("SiPixel2DTemplateDBObjectReader") << "\nTesting global tag at magnetic field = " << theMagField; + if (SiPix2DTemplDBObjWatcher_.check(iSetup)) { + edm::LogPrint("SiPixel2DTemplateDBObjectESProducerRcd") << "With record SiPixel2DTemplateDBObjectESProducerRcd"; + dbobject = *&iSetup.getData(the2DTemplateESProdToken_); hasTriggeredWatcher = true; } } else { - std::cout << "\nLoading from file " << std::endl; - if (SiPix2DTemplDBObjWatcher_.check(setup)) { - edm::ESHandle generrorH; - setup.get().get(generrorH); - dbobject = *generrorH.product(); + edm::LogPrint("SiPixel2DTemplateDBObjectReader") << "\nLoading from file " << std::endl; + if (SiPix2DTemplDBObjWatcher_.check(iSetup)) { + edm::LogPrint("SiPixelTemplateDBObjectReader") << "With record SiPixel2DTemplateDBObjectRcd"; + dbobject = *&iSetup.getData(the2DTemplateToken_); hasTriggeredWatcher = true; } } @@ -48,31 +88,32 @@ void SiPixel2DTemplateDBObjectReader::analyze(const edm::Event& iEvent, const ed if (hasTriggeredWatcher) { std::vector tempMapId; - /*hp - if(theFull2DTemplateDBOutput) std::cout << "Map info" << std::endl; - std::map templMap=dbobject.get2DTemplateIDs(); - for(std::map::const_iterator it=templMap.begin(); it!=templMap.end();++it) { - if(tempMapId.size()==0) tempMapId.push_back(it->second); - for(unsigned int i=0; isecond) continue; - else if(i==tempMapId.size()-1) { - tempMapId.push_back(it->second); - break; - } - } - if(theFull2DTemplateDBOutput) - std::cout<< "DetId: "<< it->first<<" 2DTemplateID: "<< it->second<<"\n"; - } -hp*/ - - std::cout << "\nMap stores 2DTemplate Id(s): "; + if (theFull2DTemplateDBOutput) { + edm::LogPrint("SiPixel2DTemplateDBObjectReader") << "Map info" << std::endl; + std::map templMap = dbobject.getTemplateIDs(); + for (std::map::const_iterator it = templMap.begin(); it != templMap.end(); ++it) { + if (tempMapId.empty()) + tempMapId.push_back(it->second); + for (unsigned int i = 0; i < tempMapId.size(); ++i) { + if (tempMapId[i] == it->second) + continue; + else if (i == tempMapId.size() - 1) { + tempMapId.push_back(it->second); + break; + } + } + edm::LogPrint("SiPixel2DTemplateDBObjectReader") + << "DetId: " << it->first << " 2DTemplateID: " << it->second << "\n"; + } + } + + edm::LogPrint("SiPixel2DTemplateDBObjectReader") << "\nMap stores 2DTemplate Id(s): "; for (unsigned int vindex = 0; vindex < tempMapId.size(); ++vindex) - std::cout << tempMapId[vindex] << " "; - std::cout << std::endl; + edm::LogPrint("SiPixel2DTemplateDBObjectReader") << tempMapId[vindex] << " "; + edm::LogPrint("SiPixel2DTemplateDBObjectReader") << std::endl; //local variables const char* tempfile; - char c; int numOfTempl = dbobject.numOfTempl(); int index = 0; float tempnum = 0, diff = 0; @@ -80,15 +121,17 @@ hp*/ bool error = false, givenErrorMsg = false; ; - std::cout << "\nChecking 2DTemplate DB object version " << dbobject.version() << " containing " << numOfTempl - << " calibration(s) at " << dbobject.sVector()[index + 22] << "T\n"; + edm::LogPrint("SiPixel2DTemplateDBObjectReader") + << "\nChecking 2DTemplate DB object version " << dbobject.version() << " containing " << numOfTempl + << " calibration(s) at " << dbobject.sVector()[index + 22] << "T\n"; for (int i = 0; i < numOfTempl; ++i) { //Removes header in db object from diff index += 20; //Tell the person viewing the output what the 2DTemplate ID and version are -- note that version is only valid for >=13 - std::cout << "Calibration " << i + 1 << " of " << numOfTempl << ", with 2DTemplate ID " - << dbobject.sVector()[index] << "\tand Version " << dbobject.sVector()[index + 1] << "\t-------- "; + edm::LogPrint("SiPixel2DTemplateDBObjectReader") + << "Calibration " << i + 1 << " of " << numOfTempl << ", with 2DTemplate ID " << dbobject.sVector()[index] + << "\tand Version " << dbobject.sVector()[index + 1] << "\t-------- "; //Opening the text-based 2DTemplate calibration std::ostringstream tout; @@ -102,9 +145,6 @@ hp*/ if (in_file.is_open()) { //Removes header in textfile from diff - for (int header = 0; (c = in_file.get()) != '\n'; ++header) { - } - //First read in from the text file -- this will be compared with index = 20 in_file >> tempnum; @@ -117,14 +157,15 @@ hp*/ if (diff > tol) { //We have the if statement to output the message only once if (!givenErrorMsg) - std::cout << "does NOT match\n"; + edm::LogPrint("SiPixel2DTemplateDBObjectReader") << "does NOT match\n"; //If there is an error we want to display a message upon completion error = true; givenErrorMsg = true; //Do we want more detailed output? if (theDetailed2DTemplateDBErrorOutput) { - std::cout << "from file = " << tempnum << "\t from dbobject = " << dbobject.sVector()[index] - << "\tdiff = " << diff << "\t db index = " << index << std::endl; + edm::LogPrint("SiPixel2DTemplateDBObjectReader") + << "from file = " << tempnum << "\t from dbobject = " << dbobject.sVector()[index] + << "\tdiff = " << diff << "\t db index = " << index << std::endl; } } //Go to the next entries @@ -133,22 +174,23 @@ hp*/ } //There were no errors, the two files match. if (!givenErrorMsg) - std::cout << "MATCHES\n"; + edm::LogPrint("SiPixel2DTemplateDBObjectReader") << "MATCHES\n"; } //end current file in_file.close(); givenErrorMsg = false; } //end loop over all files if (error && !theDetailed2DTemplateDBErrorOutput) - std::cout << "\nThe were differences found between the files and the database.\n" - << "If you would like more detailed information please set\n" - << "wantDetailedOutput = True in the cfg file. If you would like a\n" - << "full output of the contents of the database file please set\n" - << "wantFullOutput = True. Make sure that you pipe the output to a\n" - << "log file. This could take a few minutes.\n\n"; + edm::LogPrint("SiPixel2DTemplateDBObjectReader") + << "\nThe were differences found between the files and the database.\n" + << "If you would like more detailed information please set\n" + << "wantDetailedOutput = True in the cfg file. If you would like a\n" + << "full output of the contents of the database file please set\n" + << "wantFullOutput = True. Make sure that you pipe the output to a\n" + << "log file. This could take a few minutes.\n\n"; if (theFull2DTemplateDBOutput) - std::cout << dbobject << std::endl; + edm::LogPrint("SiPixel2DTemplateDBObjectReader") << dbobject << std::endl; } } @@ -167,25 +209,30 @@ std::ostream& operator<<(std::ostream& s, const SiPixel2DTemplateDBObject& dbobj //!-changes the size of the 2DTemplates based on the version int sizeSetter = 0, generrorVersion = 0; - std::cout << "\n\nDBobject version: " << dbobject.version() << std::endl; + edm::LogPrint("SiPixel2DTemplateDBObjectReader") << "\n\nDBobject version: " << dbobject.version() << std::endl; for (m = 0; m < dbobject.numOfTempl(); ++m) { //To change the size of the output based on which 2DTemplate version we are using" generrorVersion = (int)dbobject.sVector_[index + 21]; if (generrorVersion <= 10) { - std::cout << "*****WARNING***** This code will not format this 2DTemplate version properly *****WARNING*****\n"; + edm::LogPrint("SiPixel2DTemplateDBObjectReader") + << "*****WARNING***** This code will not format this 2DTemplate version properly *****WARNING*****\n"; sizeSetter = 0; } else if (generrorVersion <= 16) sizeSetter = 1; else - std::cout << "*****WARNING***** This code has not been tested at formatting this version *****WARNING*****\n"; + edm::LogPrint("SiPixel2DTemplateDBObjectReader") + << "*****WARNING***** This code has not been tested at formatting this version *****WARNING*****\n"; - std::cout << "\n\n*********************************************************************************************" - << std::endl; - std::cout << "*************** Reading 2DTemplate ID " << dbobject.sVector_[index + 20] << "\t(" - << m + 1 << "/" << dbobject.numOfTempl_ << ") ***************" << std::endl; - std::cout << "*********************************************************************************************\n\n" - << std::endl; + edm::LogPrint("SiPixel2DTemplateDBObjectReader") + << "\n\n*********************************************************************************************" + << std::endl; + edm::LogPrint("SiPixel2DTemplateDBObjectReader") + << "*************** Reading 2DTemplate ID " << dbobject.sVector_[index + 20] << "\t(" << m + 1 + << "/" << dbobject.numOfTempl_ << ") ***************" << std::endl; + edm::LogPrint("SiPixel2DTemplateDBObjectReader") + << "*********************************************************************************************\n\n" + << std::endl; //Header Title SiPixel2DTemplateDBObject::char2float temp; @@ -341,3 +388,5 @@ std::ostream& operator<<(std::ostream& s, const SiPixel2DTemplateDBObject& dbobj } return s; } + +DEFINE_FWK_MODULE(SiPixel2DTemplateDBObjectReader); diff --git a/CondTools/SiPixel/test/SiPixel2DTemplateDBObjectUploader.cc b/CondTools/SiPixel/plugins/SiPixel2DTemplateDBObjectUploader.cc similarity index 73% rename from CondTools/SiPixel/test/SiPixel2DTemplateDBObjectUploader.cc rename to CondTools/SiPixel/plugins/SiPixel2DTemplateDBObjectUploader.cc index 763894b13acab..5dfc275fdbc01 100644 --- a/CondTools/SiPixel/test/SiPixel2DTemplateDBObjectUploader.cc +++ b/CondTools/SiPixel/plugins/SiPixel2DTemplateDBObjectUploader.cc @@ -1,5 +1,10 @@ -#include "CondTools/SiPixel/test/SiPixel2DTemplateDBObjectUploader.h" +#include +#include +#include +#include + #include "CondFormats/DataRecord/interface/SiPixel2DTemplateDBObjectRcd.h" +#include "CondFormats/SiPixelObjects/interface/SiPixel2DTemplateDBObject.h" #include "CondCore/DBOutputService/interface/PoolDBOutputService.h" #include "FWCore/ServiceRegistry/interface/Service.h" @@ -15,9 +20,42 @@ #include "DataFormats/TrackerCommon/interface/PixelBarrelName.h" #include "DataFormats/TrackerCommon/interface/PixelEndcapName.h" -#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/MakerMacros.h" +#include "FWCore/Framework/interface/ESHandle.h" + +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" +#include "FWCore/Utilities/interface/ESGetToken.h" + +class SiPixel2DTemplateDBObjectUploader : public edm::one::EDAnalyzer<> { +public: + explicit SiPixel2DTemplateDBObjectUploader(const edm::ParameterSet&); + ~SiPixel2DTemplateDBObjectUploader() override; + + typedef std::vector vstring; + +private: + void beginJob() override; + void analyze(const edm::Event&, const edm::EventSetup&) override; + void endJob() override; + + vstring theTemplateCalibrations; + std::string theTemplateBaseString; + float theVersion; + float theMagField; + std::vector theDetIds; + vstring theBarrelLocations; + vstring theEndcapLocations; + std::vector theBarrelTemplateIds; + std::vector theEndcapTemplateIds; + bool useVectorIndices; + edm::ESGetToken trackerGeometryToken_; + edm::ESGetToken trackerTopologyToken_; +}; SiPixel2DTemplateDBObjectUploader::SiPixel2DTemplateDBObjectUploader(const edm::ParameterSet& iConfig) : theTemplateCalibrations(iConfig.getParameter("siPixelTemplateCalibrations")), @@ -28,13 +66,15 @@ SiPixel2DTemplateDBObjectUploader::SiPixel2DTemplateDBObjectUploader(const edm:: theEndcapLocations(iConfig.getParameter >("endcapLocations")), theBarrelTemplateIds(iConfig.getParameter >("barrelTemplateIds")), theEndcapTemplateIds(iConfig.getParameter >("endcapTemplateIds")), - useVectorIndices(iConfig.getUntrackedParameter("useVectorIndices", false)) {} + useVectorIndices(iConfig.getUntrackedParameter("useVectorIndices", false)), + trackerGeometryToken_(esConsumes()), + trackerTopologyToken_(esConsumes()) {} -SiPixel2DTemplateDBObjectUploader::~SiPixel2DTemplateDBObjectUploader() {} +SiPixel2DTemplateDBObjectUploader::~SiPixel2DTemplateDBObjectUploader() = default; void SiPixel2DTemplateDBObjectUploader::beginJob() {} -void SiPixel2DTemplateDBObjectUploader::analyze(const edm::Event& iEvent, const edm::EventSetup& es) { +void SiPixel2DTemplateDBObjectUploader::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { //--- Make the POOL-ORA object to store the database object SiPixel2DTemplateDBObject* obj = new SiPixel2DTemplateDBObject; @@ -95,15 +135,12 @@ void SiPixel2DTemplateDBObjectUploader::analyze(const edm::Event& iEvent, const } } - //get the event setup - edm::ESHandle pDD; - es.get().get(pDD); - const TrackerGeometry* tGeo = pDD.product(); + //get TrackerGeometry from the event setup + const edm::ESHandle pDD = iSetup.getHandle(trackerGeometryToken_); + const TrackerGeometry* tGeo = &iSetup.getData(trackerGeometryToken_); // Use the TrackerTopology class for layer/disk etc. number - edm::ESHandle tTopoHandle; - es.get().get(tTopoHandle); - const TrackerTopology* tTopo = tTopoHandle.product(); + const TrackerTopology* tTopo = &iSetup.getData(trackerTopologyToken_); // Check if we are using Phase-1 or Phase-2 geometry int phase = 0; @@ -112,7 +149,7 @@ void SiPixel2DTemplateDBObjectUploader::analyze(const edm::Event& iEvent, const } else if (pDD->isThere(GeomDetEnumerators::P2PXB) && pDD->isThere(GeomDetEnumerators::P2PXEC) == true) { phase = 2; } - std::cout << "Phase-" << phase << " geometry is used" << std::endl; + edm::LogPrint("SiPixel2DTemplateDBObjectUploader") << "Phase-" << phase << " geometry is used" << std::endl; //Loop over the detector elements and put template IDs in place for (const auto& it : pDD->detUnits()) { @@ -120,8 +157,7 @@ void SiPixel2DTemplateDBObjectUploader::analyze(const edm::Event& iEvent, const // Here is the actual looping step over all DetIds: DetId detid = it->geographicalId(); unsigned int layer = 0, ladder = 0, disk = 0, side = 0, blade = 0, panel = 0, module = 0; - // Some extra variables that can be used for Phase 1 - comment in if needed - // unsigned int shl=0, sec=0, half=0, flipped=0, ring=0; + short thisID = 10000; unsigned int iter; @@ -129,21 +165,11 @@ void SiPixel2DTemplateDBObjectUploader::analyze(const edm::Event& iEvent, const //Barrel Pixels first if ((phase == 1 && detid.subdetId() == static_cast(PixelSubdetector::PixelBarrel)) || (phase == 2 && tGeo->geomDetSubDetector(detid.subdetId()) == GeomDetEnumerators::P2PXB)) { - std::cout << "--- IN THE BARREL ---\n"; - //Get the layer, ladder, and module corresponding to this detID layer = tTopo->pxbLayer(detid.rawId()); ladder = tTopo->pxbLadder(detid.rawId()); module = tTopo->pxbModule(detid.rawId()); - /* - // Comment these in if needed - PixelBarrelName pbn(detid, tTopo, phase); - shl = pbn.shell(); - sec = pbn.sectorName(); - half = pbn.isHalfModule(); - // This tells if we are on a flipped ladder (in the inner radius, closer to beam) - flipped = (phase ? layer==4 : layer%2) ? ladder%2==0 : ladder%2==1; - */ + if (useVectorIndices) { --layer; --ladder; @@ -156,8 +182,8 @@ void SiPixel2DTemplateDBObjectUploader::analyze(const edm::Event& iEvent, const //get the string of this barrel location std::string loc_string = theBarrelLocations[iter]; //find where the delimiters are - unsigned int first_delim_pos = loc_string.find("_"); - unsigned int second_delim_pos = loc_string.find("_", first_delim_pos + 1); + unsigned int first_delim_pos = loc_string.find('_'); + unsigned int second_delim_pos = loc_string.find('_', first_delim_pos + 1); //get the layer, ladder, and module as unsigned ints unsigned int checklayer = (unsigned int)stoi(loc_string.substr(0, first_delim_pos)); unsigned int checkladder = @@ -170,28 +196,20 @@ void SiPixel2DTemplateDBObjectUploader::analyze(const edm::Event& iEvent, const } if (thisID == 10000 || (!(*obj).putTemplateID(detid.rawId(), thisID))) - std::cout << " Could not fill barrel layer " << layer << ", module " << module << "\n"; - // ----- debug: - std::cout << "This is a barrel element with: layer " << layer << ", ladder " << ladder << " and module " - << module << ".\n"; //Uncomment to read out exact position of each element. - // ----- + edm::LogPrint("SiPixel2DTemplateDBObjectUploader") + << " Could not fill barrel layer " << layer << ", module " << module << "\n"; + edm::LogPrint("SiPixel2DTemplateDBObjectUploader") + << "This is a barrel element with: layer " << layer << ", ladder " << ladder << " and module " << module; } //Now endcaps else if ((phase == 1 && detid.subdetId() == static_cast(PixelSubdetector::PixelEndcap)) || (phase == 2 && tGeo->geomDetSubDetector(detid.subdetId()) == GeomDetEnumerators::P2PXEC)) { - std::cout << "--- IN AN ENDCAP ---\n"; - //Get the DetId's disk, blade, side, panel, and module disk = tTopo->pxfDisk(detid.rawId()); //1,2,3 blade = tTopo->pxfBlade(detid.rawId()); //1-56 (Ring 1 is 1-22, Ring 2 is 23-56) side = tTopo->pxfSide(detid.rawId()); //side=1 for -z, 2 for +z panel = tTopo->pxfPanel(detid.rawId()); //panel=1,2 - /* - // Comment these in if needed - PixelEndcapName pen(detid, tTopo, phase); - shl = pen.halfCylinder(); - ring = pen.ringName(); //1,2 This is for Phase I - */ + if (useVectorIndices) { --disk; --blade; @@ -206,9 +224,9 @@ void SiPixel2DTemplateDBObjectUploader::analyze(const edm::Event& iEvent, const //get the string of this barrel location std::string loc_string = theEndcapLocations[iter]; //find where the delimiters are - unsigned int first_delim_pos = loc_string.find("_"); - unsigned int second_delim_pos = loc_string.find("_", first_delim_pos + 1); - unsigned int third_delim_pos = loc_string.find("_", second_delim_pos + 1); + unsigned int first_delim_pos = loc_string.find('_'); + unsigned int second_delim_pos = loc_string.find('_', first_delim_pos + 1); + unsigned int third_delim_pos = loc_string.find('_', second_delim_pos + 1); //get the disk, blade, side, panel, and module as unsigned ints unsigned int checkdisk = (unsigned int)stoi(loc_string.substr(0, first_delim_pos)); unsigned int checkblade = @@ -223,21 +241,21 @@ void SiPixel2DTemplateDBObjectUploader::analyze(const edm::Event& iEvent, const } if (thisID == 10000 || (!(*obj).putTemplateID(detid.rawId(), thisID))) - std::cout << " Could not fill endcap det unit" << side << ", disk " << disk << ", blade " << blade - << ", and panel " << panel << ".\n"; - // ----- debug: - std::cout << "This is an endcap element with: side " << side << ", disk " << disk << ", blade " << blade - << ", and panel " << panel << ".\n"; //Uncomment to read out exact position of each element. - // ----- + edm::LogPrint("SiPixel2DTemplateDBObjectUploader") + << " Could not fill endcap det unit" << side << ", disk " << disk << ", blade " << blade << ", and panel " + << panel << ".\n"; + edm::LogPrint("SiPixel2DTemplateDBObjectUploader") + << "This is an endcap element with: side " << side << ", disk " << disk << ", blade " << blade + << ", and panel " << panel; } else { continue; } //Print out the assignment of this detID short mapnum; - std::cout << "checking map:\n"; mapnum = (*obj).getTemplateID(detid.rawId()); - std::cout << "The DetID: " << detid.rawId() << " is mapped to the template: " << mapnum << ".\n\n"; + edm::LogPrint("SiPixel2DTemplateDBObjectUploader") + << "The DetID: " << detid.rawId() << " is mapped to the template: " << mapnum << "\n"; } } @@ -252,3 +270,5 @@ void SiPixel2DTemplateDBObjectUploader::analyze(const edm::Event& iEvent, const } void SiPixel2DTemplateDBObjectUploader::endJob() {} + +DEFINE_FWK_MODULE(SiPixel2DTemplateDBObjectUploader); diff --git a/CondTools/SiPixel/test/SiPixelBadModuleByHandBuilder.cc b/CondTools/SiPixel/plugins/SiPixelBadModuleByHandBuilder.cc similarity index 93% rename from CondTools/SiPixel/test/SiPixelBadModuleByHandBuilder.cc rename to CondTools/SiPixel/plugins/SiPixelBadModuleByHandBuilder.cc index c7c766f7cd2c4..6f1808692e082 100644 --- a/CondTools/SiPixel/test/SiPixelBadModuleByHandBuilder.cc +++ b/CondTools/SiPixel/plugins/SiPixelBadModuleByHandBuilder.cc @@ -8,12 +8,13 @@ SiPixelBadModuleByHandBuilder::SiPixelBadModuleByHandBuilder(const edm::ParameterSet& iConfig) : ConditionDBWriter(iConfig) { + tkTopoToken_ = esConsumes(); printdebug_ = iConfig.getUntrackedParameter("printDebug", false); BadModuleList_ = iConfig.getUntrackedParameter("BadModuleList"); ROCListFile_ = iConfig.getUntrackedParameter("ROCListFile"); } -SiPixelBadModuleByHandBuilder::~SiPixelBadModuleByHandBuilder() {} +SiPixelBadModuleByHandBuilder::~SiPixelBadModuleByHandBuilder() = default; std::unique_ptr SiPixelBadModuleByHandBuilder::getNewObject() { auto obj = std::make_unique(); @@ -90,16 +91,16 @@ std::unique_ptr SiPixelBadModuleByHandBuilder::getNewObject() { uint32_t detId; if (name[0] == 'B') { PixelBarrelName bn(name, true); - detId = bn.getDetId(tTopo_); + detId = bn.getDetId(tTopo_.get()); } else { PixelEndcapName en(name, true); - detId = en.getDetId(tTopo_); + detId = en.getDetId(tTopo_.get()); } std::map::iterator it = disabledModules.find(detId); if (it == disabledModules.end()) it = disabledModules.insert(disabledModules.begin(), std::make_pair(detId, 0)); it->second |= 1 << roc; - //std::cout<<"New module read "< "<(it->second)< "<(it->second)< SiPixelBadModuleByHandBuilder::getNewObject() { return obj; } +DEFINE_FWK_MODULE(SiPixelBadModuleByHandBuilder); diff --git a/CondTools/SiPixel/test/SiPixelBadModuleByHandBuilder.h b/CondTools/SiPixel/plugins/SiPixelBadModuleByHandBuilder.h similarity index 73% rename from CondTools/SiPixel/test/SiPixelBadModuleByHandBuilder.h rename to CondTools/SiPixel/plugins/SiPixelBadModuleByHandBuilder.h index 00f24650317e9..9107aef14431e 100644 --- a/CondTools/SiPixel/test/SiPixelBadModuleByHandBuilder.h +++ b/CondTools/SiPixel/plugins/SiPixelBadModuleByHandBuilder.h @@ -1,9 +1,9 @@ #ifndef SiPixelBadModuleByHandBuilder_H #define SiPixelBadModuleByHandBuilder_H +#include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/Utilities/interface/Exception.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "DataFormats/DetId/interface/DetId.h" #include "CommonTools/ConditionDBWriter/interface/ConditionDBWriter.h" @@ -18,22 +18,24 @@ class SiPixelBadModuleByHandBuilder : public ConditionDBWriter { public: explicit SiPixelBadModuleByHandBuilder(const edm::ParameterSet&); - ~SiPixelBadModuleByHandBuilder(); + ~SiPixelBadModuleByHandBuilder() override; private: std::unique_ptr getNewObject() override; - void algoBeginJob(const edm::EventSetup& es) override { - edm::ESHandle htopo; - es.get().get(htopo); - tTopo_ = htopo.product(); + + void algoBeginRun(const edm::Run& run, const edm::EventSetup& es) override { + if (!tTopo_) { + tTopo_ = std::make_unique(es.getData(tkTopoToken_)); + } }; private: + edm::ESGetToken tkTopoToken_; bool printdebug_; typedef std::vector Parameters; Parameters BadModuleList_; std::string ROCListFile_; - const TrackerTopology* tTopo_; + std::unique_ptr tTopo_; }; #endif diff --git a/CondTools/SiPixel/test/SiPixelBadModuleReader.cc b/CondTools/SiPixel/plugins/SiPixelBadModuleReader.cc similarity index 88% rename from CondTools/SiPixel/test/SiPixelBadModuleReader.cc rename to CondTools/SiPixel/plugins/SiPixelBadModuleReader.cc index 0b96ca828c47f..daeb5d9ed8efc 100644 --- a/CondTools/SiPixel/test/SiPixelBadModuleReader.cc +++ b/CondTools/SiPixel/plugins/SiPixelBadModuleReader.cc @@ -1,23 +1,12 @@ -#include "CondFormats/SiPixelObjects/interface/SiPixelQuality.h" -#include "CondFormats/DataRecord/interface/SiPixelQualityFromDbRcd.h" -#include "CondFormats/DataRecord/interface/SiPixelQualityRcd.h" -#include "CondFormats/DataRecord/interface/SiPixelFedCablingMapRcd.h" -#include "CondFormats/SiPixelObjects/interface/SiPixelFedCablingMap.h" -#include "CondTools/SiPixel/test/SiPixelBadModuleReader.h" +#include "SiPixelBadModuleReader.h" #include "DataFormats/DetId/interface/DetId.h" -#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" -#include "CondFormats/SiPixelObjects/interface/SiPixelFedCabling.h" #include "CondFormats/SiPixelObjects/interface/PixelROC.h" #include "CondFormats/SiPixelObjects/interface/PixelFEDCabling.h" #include "Geometry/CommonDetUnit/interface/PixelGeomDetUnit.h" -#include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" -#include "FWCore/ServiceRegistry/interface/Service.h" #include "CommonTools/UtilAlgos/interface/TFileService.h" #include "DataFormats/TrackerCommon/interface/PixelBarrelName.h" #include "DataFormats/TrackerCommon/interface/PixelEndcapName.h" #include "DataFormats/SiPixelDetId/interface/PixelSubdetector.h" -#include "DataFormats/TrackerCommon/interface/TrackerTopology.h" - #include "TCanvas.h" #include "TStyle.h" #include @@ -29,29 +18,36 @@ #include SiPixelBadModuleReader::SiPixelBadModuleReader(const edm::ParameterSet& iConfig) - : printdebug_(iConfig.getUntrackedParameter("printDebug", 1)), - whichRcd(iConfig.getUntrackedParameter("RcdName")) {} + : badModuleToken(esConsumes()), + badModuleFromDBToken(esConsumes()), + siPixelFedCablingToken(esConsumes()), + tkGeomToken(esConsumes()), + tkTopoToken(esConsumes()), + printdebug_(iConfig.getUntrackedParameter("printDebug", 1)), + whichRcd(iConfig.getUntrackedParameter("RcdName")) { + usesResource(TFileService::kSharedResource); +} // txtFileName_(iConfig.getUntrackedParameter("OutputFile","BadModuleSummary.txt")){} -SiPixelBadModuleReader::~SiPixelBadModuleReader() {} +SiPixelBadModuleReader::~SiPixelBadModuleReader() = default; void SiPixelBadModuleReader::analyze(const edm::Event& e, const edm::EventSetup& iSetup) { - edm::ESHandle SiPixelBadModule_; - if (whichRcd == "SiPixelQualityRcd") - iSetup.get().get(SiPixelBadModule_); - if (whichRcd == "SiPixelQualityFromDbRcd") - iSetup.get().get(SiPixelBadModule_); + const SiPixelQuality* SiPixelBadModule_ = nullptr; + if (whichRcd == "SiPixelQualityRcd") { + SiPixelBadModule_ = &iSetup.getData(badModuleToken); + } else if (whichRcd == "SiPixelQualityFromDbRcd") { + SiPixelBadModule_ = &iSetup.getData(badModuleFromDBToken); + } else { + throw cms::Exception("LogicalError") << "SiPixelBadModuleReader::analyze, unsupported RcdName value " << whichRcd + << ".\n Please check the configuration." << std::endl; + } - edm::ESHandle map; - iSetup.get().get(map); + edm::ESHandle map = iSetup.getHandle(siPixelFedCablingToken); edm::LogInfo("SiPixelBadModuleReader") << "[SiPixelBadModuleReader::analyze] End Reading SiPixelBadModule" << std::endl; - edm::ESHandle geom; - iSetup.get().get(geom); - edm::ESHandle httopo; - iSetup.get().get(httopo); - const TrackerTopology& ttopo = *httopo; + const TrackerGeometry* geom = &iSetup.getData(tkGeomToken); + const TrackerTopology& ttopo = iSetup.getData(tkTopoToken); edm::Service fs; _TH2F_dead_modules_BPIX_lay1 = @@ -254,3 +250,4 @@ void SiPixelBadModuleReader::analyze(const edm::Event& e, const edm::EventSetup& txtout << "The total number of completely dead modules is: " << nbadmodules << std::endl; txtout << "The total number of partially dead modules is: " << npartialbad << std::endl; } +DEFINE_FWK_MODULE(SiPixelBadModuleReader); diff --git a/CondTools/SiPixel/plugins/SiPixelBadModuleReader.h b/CondTools/SiPixel/plugins/SiPixelBadModuleReader.h new file mode 100644 index 0000000000000..85a34e2d4c7b0 --- /dev/null +++ b/CondTools/SiPixel/plugins/SiPixelBadModuleReader.h @@ -0,0 +1,56 @@ +#ifndef CondTools_SiPixel_SiPixelBadModuleReader_H +#define CondTools_SiPixel_SiPixelBadModuleReader_H + +// system include files + +// user include files +#include "CondFormats/DataRecord/interface/SiPixelFedCablingMapRcd.h" +#include "CondFormats/DataRecord/interface/SiPixelQualityFromDbRcd.h" +#include "CondFormats/DataRecord/interface/SiPixelQualityRcd.h" +#include "CondFormats/SiPixelObjects/interface/SiPixelFedCabling.h" +#include "CondFormats/SiPixelObjects/interface/SiPixelFedCablingMap.h" +#include "CondFormats/SiPixelObjects/interface/SiPixelQuality.h" +#include "DataFormats/DetId/interface/DetId.h" +#include "DataFormats/TrackerCommon/interface/TrackerTopology.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ServiceRegistry/interface/Service.h" +#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" +#include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" + +#include "TROOT.h" +#include "TFile.h" +#include "TTree.h" +#include "TBranch.h" +#include "TH2F.h" + +class SiPixelBadModuleReader : public edm::one::EDAnalyzer { +public: + explicit SiPixelBadModuleReader(const edm::ParameterSet &); + ~SiPixelBadModuleReader() override; + + void analyze(const edm::Event &, const edm::EventSetup &) override; + +private: + const edm::ESGetToken badModuleToken; + const edm::ESGetToken badModuleFromDBToken; + const edm::ESGetToken siPixelFedCablingToken; + const edm::ESGetToken tkGeomToken; + const edm::ESGetToken tkTopoToken; + + uint32_t printdebug_; + std::string whichRcd; + TH2F *_TH2F_dead_modules_BPIX_lay1; + TH2F *_TH2F_dead_modules_BPIX_lay2; + TH2F *_TH2F_dead_modules_BPIX_lay3; + TH2F *_TH2F_dead_modules_FPIX_minusZ_disk1; + TH2F *_TH2F_dead_modules_FPIX_minusZ_disk2; + TH2F *_TH2F_dead_modules_FPIX_plusZ_disk1; + TH2F *_TH2F_dead_modules_FPIX_plusZ_disk2; +}; +#endif diff --git a/CondTools/SiPixel/test/SiPixelCalibConfigurationObjectMaker.cc b/CondTools/SiPixel/plugins/SiPixelCalibConfigurationObjectMaker.cc similarity index 87% rename from CondTools/SiPixel/test/SiPixelCalibConfigurationObjectMaker.cc rename to CondTools/SiPixel/plugins/SiPixelCalibConfigurationObjectMaker.cc index 7546be0004351..b083f78870262 100644 --- a/CondTools/SiPixel/test/SiPixelCalibConfigurationObjectMaker.cc +++ b/CondTools/SiPixel/plugins/SiPixelCalibConfigurationObjectMaker.cc @@ -21,7 +21,7 @@ #include // user include files -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "FWCore/Framework/interface/MakerMacros.h" @@ -36,14 +36,11 @@ // class decleration // -class SiPixelCalibConfigurationObjectMaker : public edm::EDAnalyzer { +class SiPixelCalibConfigurationObjectMaker : public edm::one::EDAnalyzer<> { public: explicit SiPixelCalibConfigurationObjectMaker(const edm::ParameterSet&); ~SiPixelCalibConfigurationObjectMaker() override; - - void beginJob() override { ; } void analyze(const edm::Event&, const edm::EventSetup&) override; - void endJob() override { ; } private: // ----------member data --------------------------- @@ -71,10 +68,7 @@ SiPixelCalibConfigurationObjectMaker::SiPixelCalibConfigurationObjectMaker(const ::putenv((char*)"CORAL_AUTH_PASSWORD=test"); } -SiPixelCalibConfigurationObjectMaker::~SiPixelCalibConfigurationObjectMaker() { - // do anything here that needs to be done at desctruction time - // (e.g. close files, deallocate resources etc.) -} +SiPixelCalibConfigurationObjectMaker::~SiPixelCalibConfigurationObjectMaker() = default; // // member functions @@ -86,10 +80,10 @@ void SiPixelCalibConfigurationObjectMaker::analyze(const edm::Event&, const edm: std::string fixedmode = fancyCalib.mode(); std::string tobereplaced = "WithSLink"; - std::cout << "mode = " << fixedmode << std::endl; + edm::LogPrint("SiPixelCalibConfigurationObjectMaker") << "mode = " << fixedmode << std::endl; if (fixedmode.find(tobereplaced) != std::string::npos) fixedmode.erase(fixedmode.find(tobereplaced), tobereplaced.length()); - std::cout << "mode = " << fixedmode << std::endl; + edm::LogPrint("SiPixelCalibConfigurationObjectMaker") << "mode = " << fixedmode << std::endl; myCalib->setCalibrationMode(fixedmode); edm::Service poolDbService; diff --git a/CondTools/SiPixel/test/SiPixelCalibConfigurationReadDb.cc b/CondTools/SiPixel/plugins/SiPixelCalibConfigurationReadDb.cc similarity index 54% rename from CondTools/SiPixel/test/SiPixelCalibConfigurationReadDb.cc rename to CondTools/SiPixel/plugins/SiPixelCalibConfigurationReadDb.cc index 465113ad274fd..3eba2ad007b06 100644 --- a/CondTools/SiPixel/test/SiPixelCalibConfigurationReadDb.cc +++ b/CondTools/SiPixel/plugins/SiPixelCalibConfigurationReadDb.cc @@ -3,7 +3,7 @@ // Package: SiPixelCalibConfigurationReadDb // Class: SiPixelCalibConfigurationReadDb // -/**\class SiPixelCalibConfigurationReadDb SiPixelCalibConfigurationReadDb.cc CalibTracker/SiPixelTools/test/SiPixelCalibConfigurationReadDb.cc +/**\class SiPixelCalibConfigurationReadDb SiPixelCalibConfigurationReadDb.cc CalibTracker/SiPixelTools/plugins/SiPixelCalibConfigurationReadDb.cc Description: @@ -21,7 +21,7 @@ #include // user include files -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/Framework/interface/MakerMacros.h" @@ -34,15 +34,14 @@ // class decleration // -class SiPixelCalibConfigurationReadDb : public edm::EDAnalyzer { +class SiPixelCalibConfigurationReadDb : public edm::one::EDAnalyzer<> { public: explicit SiPixelCalibConfigurationReadDb(const edm::ParameterSet&); ~SiPixelCalibConfigurationReadDb() override; private: - void beginJob() override; + const edm::ESGetToken calibConfigToken; void analyze(const edm::Event&, const edm::EventSetup&) override; - void endJob() override; // ----------member data --------------------------- bool verbose_; @@ -60,16 +59,11 @@ class SiPixelCalibConfigurationReadDb : public edm::EDAnalyzer { // constructors and destructor // SiPixelCalibConfigurationReadDb::SiPixelCalibConfigurationReadDb(const edm::ParameterSet& iConfig) - : verbose_(iConfig.getParameter("verbosity")) - -{ + : calibConfigToken(esConsumes()), verbose_(iConfig.getParameter("verbosity")) { //now do what ever initialization is needed } -SiPixelCalibConfigurationReadDb::~SiPixelCalibConfigurationReadDb() { - // do anything here that needs to be done at desctruction time - // (e.g. close files, deallocate resources etc.) -} +SiPixelCalibConfigurationReadDb::~SiPixelCalibConfigurationReadDb() = default; // // member functions @@ -81,71 +75,66 @@ void SiPixelCalibConfigurationReadDb::analyze(const edm::Event& iEvent, const ed LogInfo("") << " examining SiPixelCalibConfiguration database object..." << std::endl; - ESHandle calib; - iSetup.get().get(calib); - std::cout << "calibration type: " << calib->getCalibrationMode() << std::endl; - std::cout << "number of triggers: " << calib->getNTriggers() << std::endl; + const SiPixelCalibConfiguration* calib = &iSetup.getData(calibConfigToken); + edm::LogPrint("SiPixelCalibConfigurationReadDb") << "calibration type: " << calib->getCalibrationMode() << std::endl; + edm::LogPrint("SiPixelCalibConfigurationReadDb") << "number of triggers: " << calib->getNTriggers() << std::endl; std::vector vcalvalues = calib->getVCalValues(); - std::cout << "number of VCAL: " << vcalvalues.size() << std::endl; + edm::LogPrint("SiPixelCalibConfigurationReadDb") << "number of VCAL: " << vcalvalues.size() << std::endl; int ngoodcols = 0; int ngoodrows = 0; for (uint32_t i = 0; i < vcalvalues.size(); ++i) { if (verbose_) { - std::cout << "Vcal values " << i << "," << i + 1 << " : " << vcalvalues[i] << ","; + edm::LogPrint("SiPixelCalibConfigurationReadDb") + << "Vcal values " << i << "," << i + 1 << " : " << vcalvalues[i] << ","; } ++i; if (verbose_) { if (i < vcalvalues.size()) - std::cout << vcalvalues[i]; - std::cout << std::endl; + edm::LogPrint("SiPixelCalibConfigurationReadDb") << vcalvalues[i]; + edm::LogPrint("SiPixelCalibConfigurationReadDb") << std::endl; } } if (verbose_) - std::cout << "column patterns:" << std::endl; + edm::LogPrint("SiPixelCalibConfigurationReadDb") << "column patterns:" << std::endl; for (uint32_t i = 0; i < calib->getColumnPattern().size(); ++i) { if (calib->getColumnPattern()[i] != -1) { if (verbose_) - std::cout << calib->getColumnPattern()[i]; + edm::LogPrint("SiPixelCalibConfigurationReadDb") << calib->getColumnPattern()[i]; ngoodcols++; } if (verbose_) { if (i != 0) - std::cout << " "; + edm::LogPrint("SiPixelCalibConfigurationReadDb") << " "; if (calib->getColumnPattern()[i] == -1) - std::cout << "- "; + edm::LogPrint("SiPixelCalibConfigurationReadDb") << "- "; } } if (verbose_) { - std::cout << std::endl; - std::cout << "row patterns:" << std::endl; + edm::LogPrint("SiPixelCalibConfigurationReadDb") << std::endl; + edm::LogPrint("SiPixelCalibConfigurationReadDb") << "row patterns:" << std::endl; } for (uint32_t i = 0; i < calib->getRowPattern().size(); ++i) { if (calib->getRowPattern()[i] != -1) { if (verbose_) - std::cout << calib->getRowPattern()[i]; + edm::LogPrint("SiPixelCalibConfigurationReadDb") << calib->getRowPattern()[i]; ngoodrows++; } if (verbose_) { if (i != 0) - std::cout << " "; + edm::LogPrint("SiPixelCalibConfigurationReadDb") << " "; if (calib->getRowPattern()[i] == -1) - std::cout << "- "; + edm::LogPrint("SiPixelCalibConfigurationReadDb") << "- "; } } if (verbose_) { - std::cout << std::endl; - std::cout << "number of row patterns: " << ngoodrows << std::endl; - std::cout << "number of column patterns: " << ngoodcols << std::endl; + edm::LogPrint("SiPixelCalibConfigurationReadDb") << std::endl; + edm::LogPrint("SiPixelCalibConfigurationReadDb") << "number of row patterns: " << ngoodrows << std::endl; + edm::LogPrint("SiPixelCalibConfigurationReadDb") << "number of column patterns: " << ngoodcols << std::endl; } - std::cout << "this payload is designed to run on " - << vcalvalues.size() * ngoodcols * ngoodrows * calib->getNTriggers() << " events." << std::endl; + edm::LogPrint("SiPixelCalibConfigurationReadDb") + << "this payload is designed to run on " << vcalvalues.size() * ngoodcols * ngoodrows * calib->getNTriggers() + << " events." << std::endl; } -// ------------ method called once each job just before starting event loop ------------ -void SiPixelCalibConfigurationReadDb::beginJob() {} - -// ------------ method called once each job just after ending the event loop ------------ -void SiPixelCalibConfigurationReadDb::endJob() {} - //define this as a plug-in DEFINE_FWK_MODULE(SiPixelCalibConfigurationReadDb); diff --git a/CondTools/SiPixel/test/SiPixelCondObjAllPayloadsReader.cc b/CondTools/SiPixel/plugins/SiPixelCondObjAllPayloadsReader.cc similarity index 91% rename from CondTools/SiPixel/test/SiPixelCondObjAllPayloadsReader.cc rename to CondTools/SiPixel/plugins/SiPixelCondObjAllPayloadsReader.cc index 1ef74c59bebff..221c25d849b50 100644 --- a/CondTools/SiPixel/test/SiPixelCondObjAllPayloadsReader.cc +++ b/CondTools/SiPixel/plugins/SiPixelCondObjAllPayloadsReader.cc @@ -1,7 +1,6 @@ #include -#include "CondTools/SiPixel/test/SiPixelCondObjAllPayloadsReader.h" - +#include "SiPixelCondObjAllPayloadsReader.h" #include "Geometry/CommonDetUnit/interface/PixelGeomDetUnit.h" #include "Geometry/CommonTopologies/interface/PixelTopology.h" #include "FWCore/ServiceRegistry/interface/Service.h" @@ -10,6 +9,7 @@ namespace cms { SiPixelCondObjAllPayloadsReader::SiPixelCondObjAllPayloadsReader(const edm::ParameterSet& conf) : conf_(conf), tkGeomToken_(esConsumes()) { + usesResource(TFileService::kSharedResource); std::string payloadType = conf.getParameter("payloadType"); if (strcmp(payloadType.c_str(), "HLT") == 0) { SiPixelGainCalibrationService_ = std::make_unique(conf, consumesCollector()); @@ -93,7 +93,7 @@ namespace cms { _TH1F_Pedestals_m[detid]->Fill(ped); _TH1F_Pedestals_all->Fill(ped); - //std::cout << " Col "< End job " << std::endl; } + void SiPixelCondObjAllPayloadsReader::endJob() { + edm::LogPrint("SiPixelCondObjAllPayloadsReader") << " ---> End job " << std::endl; + } } // namespace cms + +using namespace cms; +DEFINE_FWK_MODULE(SiPixelCondObjAllPayloadsReader); diff --git a/CondTools/SiPixel/test/SiPixelCondObjAllPayloadsReader.h b/CondTools/SiPixel/plugins/SiPixelCondObjAllPayloadsReader.h similarity index 88% rename from CondTools/SiPixel/test/SiPixelCondObjAllPayloadsReader.h rename to CondTools/SiPixel/plugins/SiPixelCondObjAllPayloadsReader.h index 5f75c77ae7a6a..0d70a82c9da32 100644 --- a/CondTools/SiPixel/test/SiPixelCondObjAllPayloadsReader.h +++ b/CondTools/SiPixel/plugins/SiPixelCondObjAllPayloadsReader.h @@ -18,8 +18,9 @@ // $Id: SiPixelCondObjAllPayloadsReader.h,v 1.4 2009/05/28 22:12:54 dlange Exp $ // // +#include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" @@ -41,12 +42,12 @@ #include namespace cms { - class SiPixelCondObjAllPayloadsReader : public edm::EDAnalyzer { + class SiPixelCondObjAllPayloadsReader : public edm::one::EDAnalyzer { public: explicit SiPixelCondObjAllPayloadsReader(const edm::ParameterSet& iConfig); - virtual void analyze(const edm::Event&, const edm::EventSetup&); - virtual void endJob(); + void analyze(const edm::Event&, const edm::EventSetup&) override; + void endJob() override; private: edm::ParameterSet conf_; diff --git a/CondTools/SiPixel/test/SiPixelCondObjBuilder.cc b/CondTools/SiPixel/plugins/SiPixelCondObjBuilder.cc similarity index 89% rename from CondTools/SiPixel/test/SiPixelCondObjBuilder.cc rename to CondTools/SiPixel/plugins/SiPixelCondObjBuilder.cc index fba4b968be672..5a7147d91a4a2 100644 --- a/CondTools/SiPixel/test/SiPixelCondObjBuilder.cc +++ b/CondTools/SiPixel/plugins/SiPixelCondObjBuilder.cc @@ -1,6 +1,6 @@ #include #include -#include "CondTools/SiPixel/test/SiPixelCondObjBuilder.h" +#include "CondTools/SiPixel/plugins/SiPixelCondObjBuilder.h" #include "FWCore/ServiceRegistry/interface/Service.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" @@ -68,7 +68,7 @@ namespace cms { // Get the module sizes. int nrows = topol.nrows(); // rows in x int ncols = topol.ncolumns(); // cols in y - //std::cout << " ---> PIXEL DETID " << detid << " Cols " << ncols << " Rows " << nrows << std::endl; + //edm::LogPrint("SiPixelCondObjBuilder") << " ---> PIXEL DETID " << detid << " Cols " << ncols << " Rows " << nrows << std::endl; PixelIndices pIndexConverter(ncols, nrows); @@ -126,7 +126,7 @@ namespace cms { } // if(i==mycol && j==myrow) { - // std::cout << " Col "< PIXEL Modules " << nmodules << std::endl; - std::cout << " ---> PIXEL Channels " << nchannels << std::endl; + edm::LogPrint("SiPixelCondObjBuilder") << " ---> PIXEL Modules " << nmodules << std::endl; + edm::LogPrint("SiPixelCondObjBuilder") << " ---> PIXEL Channels " << nchannels << std::endl; // // Try to read object // int mynmodules =0; @@ -156,14 +156,14 @@ namespace cms { // SiPixelGainCalibration::Range myrange = SiPixelGainCalibration_->getRange(mydetid); // float mypedestal = SiPixelGainCalibration_->getPed (mycol,myrow,myrange,416); // float mygain = SiPixelGainCalibration_->getGain(mycol,myrow,myrange,416); - // //std::cout<<" PEDESTAL "<< mypedestal<<" GAIN "< mydbservice; if (!mydbservice.isAvailable()) { - std::cout << "Didn't get DB" << std::endl; + edm::LogPrint("SiPixelCondObjBuilder") << "Didn't get DB" << std::endl; edm::LogError("db service unavailable"); return; } else { @@ -193,10 +193,10 @@ namespace cms { } edm::LogInfo(" --- all OK"); } catch (const cond::Exception& er) { - std::cout << "Database exception! " << er.what() << std::endl; + edm::LogPrint("SiPixelCondObjBuilder") << "Database exception! " << er.what() << std::endl; edm::LogError("SiPixelCondObjBuilder") << er.what() << std::endl; } catch (const std::exception& er) { - std::cout << "Standard exception! " << er.what() << std::endl; + edm::LogPrint("SiPixelCondObjBuilder") << "Standard exception! " << er.what() << std::endl; edm::LogError("SiPixelCondObjBuilder") << "caught std::exception " << er.what() << std::endl; } catch (...) { edm::LogError("SiPixelCondObjBuilder") << "Funny error" << std::endl; @@ -213,9 +213,6 @@ namespace cms { } } - // ------------ method called once each job just after ending the event loop ------------ - void SiPixelCondObjBuilder::endJob() {} - bool SiPixelCondObjBuilder::loadFromFile() { float par0, par1; //,par2,par3; int colid, rowid; //rocid @@ -241,7 +238,8 @@ namespace cms { for (int i = 0; i < (52 * 80); i++) { in_file >> par0 >> par1 >> name >> colid >> rowid; - std::cout << " Col " << colid << " Row " << rowid << " P0 " << par0 << " P1 " << par1 << std::endl; + edm::LogPrint("SiPixelCondObjBuilder") + << " Col " << colid << " Row " << rowid << " P0 " << par0 << " P1 " << par1 << std::endl; CalParameters onePix; onePix.p0 = par0; @@ -262,3 +260,6 @@ namespace cms { } } // namespace cms + +using namespace cms; +DEFINE_FWK_MODULE(SiPixelCondObjBuilder); diff --git a/CondTools/SiPixel/test/SiPixelCondObjBuilder.h b/CondTools/SiPixel/plugins/SiPixelCondObjBuilder.h similarity index 86% rename from CondTools/SiPixel/test/SiPixelCondObjBuilder.h rename to CondTools/SiPixel/plugins/SiPixelCondObjBuilder.h index 690e39a8bc7cc..a129c7a2d0bcf 100644 --- a/CondTools/SiPixel/test/SiPixelCondObjBuilder.h +++ b/CondTools/SiPixel/plugins/SiPixelCondObjBuilder.h @@ -18,8 +18,9 @@ // $Id: SiPixelCondObjBuilder.h,v 1.9 2009/05/28 22:12:54 dlange Exp $ // // +#include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" @@ -31,14 +32,13 @@ #include namespace cms { - class SiPixelCondObjBuilder : public edm::EDAnalyzer { + class SiPixelCondObjBuilder : public edm::one::EDAnalyzer<> { public: explicit SiPixelCondObjBuilder(const edm::ParameterSet& iConfig); - ~SiPixelCondObjBuilder(){}; - virtual void beginJob(); - virtual void analyze(const edm::Event&, const edm::EventSetup&); - virtual void endJob(); + ~SiPixelCondObjBuilder() override = default; + void beginJob() override; + void analyze(const edm::Event&, const edm::EventSetup&) override; bool loadFromFile(); private: diff --git a/CondTools/SiPixel/test/SiPixelCondObjForHLTBuilder.cc b/CondTools/SiPixel/plugins/SiPixelCondObjForHLTBuilder.cc similarity index 90% rename from CondTools/SiPixel/test/SiPixelCondObjForHLTBuilder.cc rename to CondTools/SiPixel/plugins/SiPixelCondObjForHLTBuilder.cc index 93c8e06141f3d..64b06906f0549 100644 --- a/CondTools/SiPixel/test/SiPixelCondObjForHLTBuilder.cc +++ b/CondTools/SiPixel/plugins/SiPixelCondObjForHLTBuilder.cc @@ -1,13 +1,10 @@ #include #include -#include "CondTools/SiPixel/test/SiPixelCondObjForHLTBuilder.h" +#include "SiPixelCondObjForHLTBuilder.h" #include "FWCore/ServiceRegistry/interface/Service.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" - -#include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" #include "Geometry/CommonDetUnit/interface/PixelGeomDetUnit.h" -#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" #include "Geometry/CommonTopologies/interface/PixelTopology.h" #include "DataFormats/SiPixelDetId/interface/PixelSubdetector.h" #include "DataFormats/DetId/interface/DetId.h" @@ -18,7 +15,8 @@ namespace cms { SiPixelCondObjForHLTBuilder::SiPixelCondObjForHLTBuilder(const edm::ParameterSet& iConfig) - : conf_(iConfig), + : tkGeometryToken_(esConsumes()), + conf_(iConfig), appendMode_(conf_.getUntrackedParameter("appendMode", true)), SiPixelGainCalibration_(nullptr), SiPixelGainCalibrationService_(iConfig, consumesCollector()), @@ -66,8 +64,7 @@ namespace cms { float maxped = 255; SiPixelGainCalibration_ = new SiPixelGainCalibrationForHLT(minped, maxped, mingain, maxgain); - edm::ESHandle pDD; - iSetup.get().get(pDD); + const TrackerGeometry* pDD = &iSetup.getData(tkGeometryToken_); edm::LogInfo("SiPixelCondObjForHLTBuilder") << " There are " << pDD->dets().size() << " detectors" << std::endl; for (TrackerGeometry::DetContainer::const_iterator it = pDD->dets().begin(); it != pDD->dets().end(); it++) { @@ -84,7 +81,7 @@ namespace cms { // Get the module sizes. int nrows = topol.nrows(); // rows in x int ncols = topol.ncolumns(); // cols in y - //std::cout << " ---> PIXEL DETID " << detid << " Cols " << ncols << " Rows " << nrows << std::endl; + //edm::LogPrint("SiPixelCondObjForHLTBuilder") << " ---> PIXEL DETID " << detid << " Cols " << ncols << " Rows " << nrows << std::endl; double meanPedWork = meanPed_; double rmsPedWork = rmsPed_; @@ -129,14 +126,14 @@ namespace cms { double val = CLHEP::RandFlat::shoot(); if (val < deadFraction_) { isDead = true; - // std::cout << "dead pixel " << detid << " " << i << "," << j << " " << val << std::endl; + // edm::LogPrint("SiPixelCondObjForHLTBuilder") << "dead pixel " << detid << " " << i << "," << j << " " << val << std::endl; } } if (deadFraction_ > 0 && !isDead) { double val = CLHEP::RandFlat::shoot(); if (val < noisyFraction_) { isNoisy = true; - // std::cout << "noisy pixel " << detid << " " << i << "," << j << " " << val << std::endl; + // edm::LogPrint("SiPixelCondObjForHLTBuilder") << "noisy pixel " << detid << " " << i << "," << j << " " << val << std::endl; } } @@ -180,7 +177,7 @@ namespace cms { totalGain += gain; if ((j + 1) % 80 == 0) { - //std::cout << "Filling Col "<(80); float averageGain = totalGain / static_cast(80); @@ -208,8 +205,8 @@ namespace cms { << "[SiPixelCondObjForHLTBuilder::analyze] detid already exists" << std::endl; } } - std::cout << " ---> PIXEL Modules " << nmodules << std::endl; - std::cout << " ---> PIXEL Channels " << nchannels << std::endl; + edm::LogPrint("SiPixelCondObjForHLTBuilder") << " ---> PIXEL Modules " << nmodules << std::endl; + edm::LogPrint("SiPixelCondObjForHLTBuilder") << " ---> PIXEL Channels " << nchannels << std::endl; // // Try to read object // int mynmodules =0; @@ -221,7 +218,7 @@ namespace cms { // SiPixelGainCalibration::Range myrange = SiPixelGainCalibration_->getRange(mydetid); // float mypedestal = SiPixelGainCalibration_->getPed (mycol,myrow,myrange,416); // float mygain = SiPixelGainCalibration_->getGain(mycol,myrow,myrange,416); - // //std::cout<<" PEDESTAL "<< mypedestal<<" GAIN "<> par0 >> par1 >> name >> colid >> rowid; - std::cout << " Col " << colid << " Row " << rowid << " P0 " << par0 << " P1 " << par1 << std::endl; + edm::LogPrint("SiPixelCondObjForHLTBuilder") + << " Col " << colid << " Row " << rowid << " P0 " << par0 << " P1 " << par1 << std::endl; CalParameters onePix; onePix.p0 = par0; @@ -324,3 +319,6 @@ namespace cms { } } // namespace cms + +using namespace cms; +DEFINE_FWK_MODULE(SiPixelCondObjForHLTBuilder); diff --git a/CondTools/SiPixel/test/SiPixelCondObjForHLTBuilder.h b/CondTools/SiPixel/plugins/SiPixelCondObjForHLTBuilder.h similarity index 79% rename from CondTools/SiPixel/test/SiPixelCondObjForHLTBuilder.h rename to CondTools/SiPixel/plugins/SiPixelCondObjForHLTBuilder.h index 8abff13d92e5b..da1a4bb31412e 100644 --- a/CondTools/SiPixel/test/SiPixelCondObjForHLTBuilder.h +++ b/CondTools/SiPixel/plugins/SiPixelCondObjForHLTBuilder.h @@ -18,29 +18,32 @@ // $Id: SiPixelCondObjForHLTBuilder.h,v 1.6 2009/11/20 19:21:02 rougny Exp $ // // + +#include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDAnalyzer.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/ParameterSet/interface/ParameterSet.h" -//#include "CondFormats/SiPixelObjects/interface/SiPixelGainCalibrationForHLT.h" #include "CalibTracker/SiPixelESProducers/interface/SiPixelGainCalibrationForHLTService.h" #include "CondFormats/SiPixelObjects/interface/PixelIndices.h" +#include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" +#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" + #include namespace cms { - class SiPixelCondObjForHLTBuilder : public edm::EDAnalyzer { + class SiPixelCondObjForHLTBuilder : public edm::one::EDAnalyzer<> { public: explicit SiPixelCondObjForHLTBuilder(const edm::ParameterSet& iConfig); - - ~SiPixelCondObjForHLTBuilder(){}; - virtual void beginJob(); - virtual void analyze(const edm::Event&, const edm::EventSetup&); - virtual void endJob(); + ~SiPixelCondObjForHLTBuilder() override{}; + void beginJob() override; + void analyze(const edm::Event&, const edm::EventSetup&) override; bool loadFromFile(); private: + const edm::ESGetToken tkGeometryToken_; + edm::ParameterSet conf_; bool appendMode_; SiPixelGainCalibrationForHLT* SiPixelGainCalibration_; diff --git a/CondTools/SiPixel/test/SiPixelCondObjForHLTReader.cc b/CondTools/SiPixel/plugins/SiPixelCondObjForHLTReader.cc similarity index 76% rename from CondTools/SiPixel/test/SiPixelCondObjForHLTReader.cc rename to CondTools/SiPixel/plugins/SiPixelCondObjForHLTReader.cc index fc59dd1ca04e2..aea6e0078f0fc 100644 --- a/CondTools/SiPixel/test/SiPixelCondObjForHLTReader.cc +++ b/CondTools/SiPixel/plugins/SiPixelCondObjForHLTReader.cc @@ -1,6 +1,6 @@ #include -#include "CondTools/SiPixel/test/SiPixelCondObjForHLTReader.h" +#include "SiPixelCondObjForHLTReader.h" #include "Geometry/CommonDetUnit/interface/PixelGeomDetUnit.h" #include "Geometry/CommonTopologies/interface/PixelTopology.h" @@ -119,12 +119,12 @@ namespace cms { nchannels++; if (SiPixelGainCalibrationService_->isDead(detid, col_iter, row_iter)) { - // std::cout << "found dead pixel " << detid << " " <isNoisy(detid, col_iter, row_iter)) { - // std::cout << "found noisy pixel " << detid << " " <getPedestal(detid, col_iter, row_iter); _TH1F_Pedestals_m[detid]->Fill(ped); _TH1F_Pedestals_all->Fill(ped); - // std::cout<<"detid "<(PixelSubdetector::PixelBarrel)) _TH1F_Pedestals_bpix->Fill(ped); if (detIdObject.subdetId() == static_cast(PixelSubdetector::PixelEndcap)) _TH1F_Pedestals_fpix->Fill(ped); - // std::cout <<" DetId "<GetRMS(); pedmeanfortree = _TH1F_Pedestals_m[detid]->GetMean(); pedrmsfortree = _TH1F_Pedestals_m[detid]->GetRMS(); - //std::cout<<"DetId "<Fill(); ibin++; @@ -180,23 +180,28 @@ namespace cms { << "[SiPixelCondObjForHLTReader::analyze] ---> PIXEL Channels (i.e. Number of Columns)" << nchannels << std::endl; - std::cout << " ---> SUMMARY :" << std::endl; - std::cout << "Encounted " << ndead << " dead pixels" << std::endl; - std::cout << "Encounted " << nnoisy << " noisy pixels" << std::endl; - std::cout << "The Gain Mean is " << _TH1F_Gains_all->GetMean() << " with rms " << _TH1F_Gains_all->GetRMS() - << std::endl; - std::cout << " in BPIX " << _TH1F_Gains_bpix->GetMean() << " with rms " << _TH1F_Gains_bpix->GetRMS() - << std::endl; - std::cout << " in FPIX " << _TH1F_Gains_fpix->GetMean() << " with rms " << _TH1F_Gains_fpix->GetRMS() - << std::endl; - std::cout << "The Ped Mean is " << _TH1F_Pedestals_all->GetMean() << " with rms " << _TH1F_Pedestals_all->GetRMS() - << std::endl; - std::cout << " in BPIX " << _TH1F_Pedestals_bpix->GetMean() << " with rms " - << _TH1F_Pedestals_bpix->GetRMS() << std::endl; - std::cout << " in FPIX " << _TH1F_Pedestals_fpix->GetMean() << " with rms " - << _TH1F_Pedestals_fpix->GetRMS() << std::endl; + edm::LogPrint("SiPixelCondObjForHLTReader") << " ---> SUMMARY :" << std::endl; + edm::LogPrint("SiPixelCondObjForHLTReader") << "Encounted " << ndead << " dead pixels" << std::endl; + edm::LogPrint("SiPixelCondObjForHLTReader") << "Encounted " << nnoisy << " noisy pixels" << std::endl; + edm::LogPrint("SiPixelCondObjForHLTReader") + << "The Gain Mean is " << _TH1F_Gains_all->GetMean() << " with rms " << _TH1F_Gains_all->GetRMS() << std::endl; + edm::LogPrint("SiPixelCondObjForHLTReader") << " in BPIX " << _TH1F_Gains_bpix->GetMean() << " with rms " + << _TH1F_Gains_bpix->GetRMS() << std::endl; + edm::LogPrint("SiPixelCondObjForHLTReader") << " in FPIX " << _TH1F_Gains_fpix->GetMean() << " with rms " + << _TH1F_Gains_fpix->GetRMS() << std::endl; + edm::LogPrint("SiPixelCondObjForHLTReader") << "The Ped Mean is " << _TH1F_Pedestals_all->GetMean() << " with rms " + << _TH1F_Pedestals_all->GetRMS() << std::endl; + edm::LogPrint("SiPixelCondObjForHLTReader") << " in BPIX " << _TH1F_Pedestals_bpix->GetMean() + << " with rms " << _TH1F_Pedestals_bpix->GetRMS() << std::endl; + edm::LogPrint("SiPixelCondObjForHLTReader") << " in FPIX " << _TH1F_Pedestals_fpix->GetMean() + << " with rms " << _TH1F_Pedestals_fpix->GetRMS() << std::endl; } // ------------ method called once each job just after ending the event loop ------------ - void SiPixelCondObjForHLTReader::endJob() { std::cout << " ---> End job " << std::endl; } + void SiPixelCondObjForHLTReader::endJob() { + edm::LogPrint("SiPixelCondObjForHLTReader") << " ---> End job " << std::endl; + } } // namespace cms + +using namespace cms; +DEFINE_FWK_MODULE(SiPixelCondObjForHLTReader); diff --git a/CondTools/SiPixel/test/SiPixelCondObjForHLTReader.h b/CondTools/SiPixel/plugins/SiPixelCondObjForHLTReader.h similarity index 88% rename from CondTools/SiPixel/test/SiPixelCondObjForHLTReader.h rename to CondTools/SiPixel/plugins/SiPixelCondObjForHLTReader.h index ca20a0e3288e7..39aa28d5b6c31 100644 --- a/CondTools/SiPixel/test/SiPixelCondObjForHLTReader.h +++ b/CondTools/SiPixel/plugins/SiPixelCondObjForHLTReader.h @@ -18,8 +18,9 @@ // $Id: SiPixelCondObjForHLTReader.h,v 1.7 2009/05/28 22:12:55 dlange Exp $ // // +#include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" @@ -36,12 +37,12 @@ #include "TH1F.h" namespace cms { - class SiPixelCondObjForHLTReader : public edm::EDAnalyzer { + class SiPixelCondObjForHLTReader : public edm::one::EDAnalyzer { public: explicit SiPixelCondObjForHLTReader(const edm::ParameterSet &iConfig); - virtual void analyze(const edm::Event &, const edm::EventSetup &); - virtual void endJob(); + void analyze(const edm::Event &, const edm::EventSetup &) override; + void endJob() override; private: edm::ParameterSet conf_; diff --git a/CondTools/SiPixel/test/SiPixelCondObjOfflineBuilder.cc b/CondTools/SiPixel/plugins/SiPixelCondObjOfflineBuilder.cc similarity index 87% rename from CondTools/SiPixel/test/SiPixelCondObjOfflineBuilder.cc rename to CondTools/SiPixel/plugins/SiPixelCondObjOfflineBuilder.cc index 45eae5bdd9d7f..c34b53e679c94 100644 --- a/CondTools/SiPixel/test/SiPixelCondObjOfflineBuilder.cc +++ b/CondTools/SiPixel/plugins/SiPixelCondObjOfflineBuilder.cc @@ -1,6 +1,6 @@ #include #include -#include "CondTools/SiPixel/test/SiPixelCondObjOfflineBuilder.h" +#include "SiPixelCondObjOfflineBuilder.h" #include "FWCore/ServiceRegistry/interface/Service.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" @@ -80,7 +80,7 @@ namespace cms { // Get the module sizes. int nrows = topol.nrows(); // rows in x int ncols = topol.ncolumns(); // cols in y - //std::cout << " ---> PIXEL DETID " << detid << " Cols " << ncols << " Rows " << nrows << std::endl; + //edm::LogPrint("SiPixelCondObjOfflineBuilder") << " ---> PIXEL DETID " << detid << " Cols " << ncols << " Rows " << nrows << std::endl; double meanPedWork = meanPed_; double rmsPedWork = rmsPed_; @@ -124,14 +124,14 @@ namespace cms { double val = CLHEP::RandFlat::shoot(); if (val < deadFraction_) { isDead = true; - // std::cout << "dead pixel " << detid << " " << i << "," << j << " " << val << std::endl; + // edm::LogPrint("SiPixelCondObjOfflineBuilder") << "dead pixel " << detid << " " << i << "," << j << " " << val << std::endl; } } if (deadFraction_ > 0 && !isDead) { double val = CLHEP::RandFlat::shoot(); if (val < noisyFraction_) { isNoisy = true; - // std::cout << "noisy pixel " << detid << " " << i << "," << j << " " << val << std::endl; + // edm::LogPrint("SiPixelCondObjOfflineBuilder") << "noisy pixel " << detid << " " << i << "," << j << " " << val << std::endl; } } @@ -151,7 +151,7 @@ namespace cms { } // if(i==mycol && j==myrow) { - // std::cout << " Col "<setDataPedestal(ped, theSiPixelGainCalibration); } else if (isDead) // dead pixel - // std::cout << "filling pixel as dead for detid " << detid <<", col " << i << ", row" << j << std::endl; + // edm::LogPrint("SiPixelCondObjOfflineBuilder") << "filling pixel as dead for detid " << detid <<", col " << i << ", row" << j << std::endl; SiPixelGainCalibration_->setDeadPixel(theSiPixelGainCalibration); else if (isNoisy) // dead pixel - // std::cout << "filling pixel as dead for detid " << detid <<", col " << i << ", row" << j << std::endl; + // edm::LogPrint("SiPixelCondObjOfflineBuilder") << "filling pixel as dead for detid " << detid <<", col " << i << ", row" << j << std::endl; SiPixelGainCalibration_->setNoisyPixel(theSiPixelGainCalibration); if ((j + 1) % 80 == 0) // fill the column average after ever ROC! { @@ -191,7 +191,7 @@ namespace cms { averageGain = gain; } - //std::cout << "Filling gain " << averageGain << " for col: " << i << " row: " << j << std::endl; + //edm::LogPrint("SiPixelCondObjOfflineBuilder") << "Filling gain " << averageGain << " for col: " << i << " row: " << j << std::endl; SiPixelGainCalibration_->setDataGain(averageGain, 80, theSiPixelGainCalibration); totalGain = 0; } @@ -204,8 +204,8 @@ namespace cms { << "[SiPixelCondObjOfflineBuilder::analyze] detid already exists" << std::endl; } } - std::cout << " ---> PIXEL Modules " << nmodules << std::endl; - std::cout << " ---> PIXEL Channels " << nchannels << std::endl; + edm::LogPrint("SiPixelCondObjOfflineBuilder") << " ---> PIXEL Modules " << nmodules << std::endl; + edm::LogPrint("SiPixelCondObjOfflineBuilder") << " ---> PIXEL Channels " << nchannels << std::endl; // // Try to read object // int mynmodules =0; @@ -217,7 +217,7 @@ namespace cms { // SiPixelGainCalibration::Range myrange = SiPixelGainCalibration_->getRange(mydetid); // float mypedestal = SiPixelGainCalibration_->getPed (mycol,myrow,myrange,416); // float mygain = SiPixelGainCalibration_->getGain(mycol,myrow,myrange,416); - // //std::cout<<" PEDESTAL "<< mypedestal<<" GAIN "<> par0 >> par1 >> name >> colid >> rowid; - std::cout << " Col " << colid << " Row " << rowid << " P0 " << par0 << " P1 " << par1 << std::endl; + edm::LogPrint("SiPixelCondObjOfflineBuilder") + << " Col " << colid << " Row " << rowid << " P0 " << par0 << " P1 " << par1 << std::endl; CalParameters onePix; onePix.p0 = par0; @@ -304,3 +305,6 @@ namespace cms { } } // namespace cms + +using namespace cms; +DEFINE_FWK_MODULE(SiPixelCondObjOfflineBuilder); diff --git a/CondTools/SiPixel/test/SiPixelCondObjOfflineBuilder.h b/CondTools/SiPixel/plugins/SiPixelCondObjOfflineBuilder.h similarity index 89% rename from CondTools/SiPixel/test/SiPixelCondObjOfflineBuilder.h rename to CondTools/SiPixel/plugins/SiPixelCondObjOfflineBuilder.h index 07a5130ce107c..4c4cd72e30fac 100644 --- a/CondTools/SiPixel/test/SiPixelCondObjOfflineBuilder.h +++ b/CondTools/SiPixel/plugins/SiPixelCondObjOfflineBuilder.h @@ -18,8 +18,9 @@ // $Id: SiPixelCondObjOfflineBuilder.h,v 1.7 2009/11/20 19:21:29 rougny Exp $ // // +#include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" @@ -31,12 +32,12 @@ #include namespace cms { - class SiPixelCondObjOfflineBuilder : public edm::EDAnalyzer { + class SiPixelCondObjOfflineBuilder : public edm::one::EDAnalyzer<> { public: explicit SiPixelCondObjOfflineBuilder(const edm::ParameterSet& iConfig); - virtual void beginJob(); - virtual void analyze(const edm::Event&, const edm::EventSetup&); + void beginJob() override; + void analyze(const edm::Event&, const edm::EventSetup&) override; bool loadFromFile(); private: diff --git a/CondTools/SiPixel/test/SiPixelCondObjOfflineReader.cc b/CondTools/SiPixel/plugins/SiPixelCondObjOfflineReader.cc similarity index 75% rename from CondTools/SiPixel/test/SiPixelCondObjOfflineReader.cc rename to CondTools/SiPixel/plugins/SiPixelCondObjOfflineReader.cc index d151e8e25524a..1e9d6789f9545 100644 --- a/CondTools/SiPixel/test/SiPixelCondObjOfflineReader.cc +++ b/CondTools/SiPixel/plugins/SiPixelCondObjOfflineReader.cc @@ -1,6 +1,6 @@ #include -#include "CondTools/SiPixel/test/SiPixelCondObjOfflineReader.h" +#include "SiPixelCondObjOfflineReader.h" #include "CalibTracker/SiPixelESProducers/interface/SiPixelGainCalibrationOfflineService.h" #include "CalibTracker/SiPixelESProducers/interface/SiPixelGainCalibrationOfflineSimService.h" @@ -13,6 +13,7 @@ namespace cms { SiPixelCondObjOfflineReader::SiPixelCondObjOfflineReader(const edm::ParameterSet& conf) : conf_(conf), tkGeomToken_(esConsumes()) { + usesResource(TFileService::kSharedResource); if (conf_.getParameter("useSimRcd")) SiPixelGainCalibrationService_ = std::make_unique(conf_, consumesCollector()); @@ -119,12 +120,12 @@ namespace cms { nchannels++; if (SiPixelGainCalibrationService_->isDead(detid, col_iter, row_iter)) { - // std::cout << "found dead pixel " << detid << " " <isNoisy(detid, col_iter, row_iter)) { - // std::cout << "found noisy pixel " << detid << " " <getPedestal(detid, col_iter, row_iter); _TH1F_Pedestals_m[detid]->Fill(ped); _TH1F_Pedestals_all->Fill(ped); - // std::cout<<"detid "<(PixelSubdetector::PixelBarrel)) _TH1F_Pedestals_bpix->Fill(ped); if (detIdObject.subdetId() == static_cast(PixelSubdetector::PixelEndcap)) _TH1F_Pedestals_fpix->Fill(ped); - // std::cout <<" DetId "<GetRMS(); pedmeanfortree = _TH1F_Pedestals_m[detid]->GetMean(); pedrmsfortree = _TH1F_Pedestals_m[detid]->GetRMS(); - std::cout << "DetId " << detid << " GainMean " << gainmeanfortree << " RMS " << gainrmsfortree - << " PedMean " << pedmeanfortree << " RMS " << pedrmsfortree << std::endl; + edm::LogPrint("SiPixelCondObjOfflineReader") + << "DetId " << detid << " GainMean " << gainmeanfortree << " RMS " << gainrmsfortree << " PedMean " + << pedmeanfortree << " RMS " << pedrmsfortree << std::endl; tree->Fill(); if (pedmeanfortree == 0) - std::cout << detid << std::endl; + edm::LogPrint("SiPixelCondObjOfflineReader") << detid << std::endl; ibin++; } @@ -184,23 +186,27 @@ namespace cms { << "[SiPixelCondObjOfflineReader::analyze] ---> PIXEL Channels (i.e. Number of Columns)" << nchannels << std::endl; - std::cout << " ---> SUMMARY :" << std::endl; - std::cout << "Encounted " << ndead << " dead pixels" << std::endl; - std::cout << "Encounted " << nnoisy << " noisy pixels" << std::endl; - std::cout << "The Gain Mean is " << _TH1F_Gains_all->GetMean() << " with rms " << _TH1F_Gains_all->GetRMS() - << std::endl; - std::cout << " in BPIX " << _TH1F_Gains_bpix->GetMean() << " with rms " << _TH1F_Gains_bpix->GetRMS() - << std::endl; - std::cout << " in FPIX " << _TH1F_Gains_fpix->GetMean() << " with rms " << _TH1F_Gains_fpix->GetRMS() - << std::endl; - std::cout << "The Ped Mean is " << _TH1F_Pedestals_all->GetMean() << " with rms " << _TH1F_Pedestals_all->GetRMS() - << std::endl; - std::cout << " in BPIX " << _TH1F_Pedestals_bpix->GetMean() << " with rms " - << _TH1F_Pedestals_bpix->GetRMS() << std::endl; - std::cout << " in FPIX " << _TH1F_Pedestals_fpix->GetMean() << " with rms " - << _TH1F_Pedestals_fpix->GetRMS() << std::endl; + edm::LogPrint("SiPixelCondObjOfflineReader") << " ---> SUMMARY :" << std::endl; + edm::LogPrint("SiPixelCondObjOfflineReader") << "Encounted " << ndead << " dead pixels" << std::endl; + edm::LogPrint("SiPixelCondObjOfflineReader") << "Encounted " << nnoisy << " noisy pixels" << std::endl; + edm::LogPrint("SiPixelCondObjOfflineReader") + << "The Gain Mean is " << _TH1F_Gains_all->GetMean() << " with rms " << _TH1F_Gains_all->GetRMS() << std::endl; + edm::LogPrint("SiPixelCondObjOfflineReader") << " in BPIX " << _TH1F_Gains_bpix->GetMean() << " with rms " + << _TH1F_Gains_bpix->GetRMS() << std::endl; + edm::LogPrint("SiPixelCondObjOfflineReader") << " in FPIX " << _TH1F_Gains_fpix->GetMean() << " with rms " + << _TH1F_Gains_fpix->GetRMS() << std::endl; + edm::LogPrint("SiPixelCondObjOfflineReader") << "The Ped Mean is " << _TH1F_Pedestals_all->GetMean() << " with rms " + << _TH1F_Pedestals_all->GetRMS() << std::endl; + edm::LogPrint("SiPixelCondObjOfflineReader") << " in BPIX " << _TH1F_Pedestals_bpix->GetMean() + << " with rms " << _TH1F_Pedestals_bpix->GetRMS() << std::endl; + edm::LogPrint("SiPixelCondObjOfflineReader") << " in FPIX " << _TH1F_Pedestals_fpix->GetMean() + << " with rms " << _TH1F_Pedestals_fpix->GetRMS() << std::endl; } // ------------ method called once each job just after ending the event loop ------------ - void SiPixelCondObjOfflineReader::endJob() { std::cout << " ---> End job " << std::endl; } + void SiPixelCondObjOfflineReader::endJob() { + edm::LogPrint("SiPixelCondObjOfflineReader") << " ---> End job " << std::endl; + } } // namespace cms +using namespace cms; +DEFINE_FWK_MODULE(SiPixelCondObjOfflineReader); diff --git a/CondTools/SiPixel/test/SiPixelCondObjOfflineReader.h b/CondTools/SiPixel/plugins/SiPixelCondObjOfflineReader.h similarity index 88% rename from CondTools/SiPixel/test/SiPixelCondObjOfflineReader.h rename to CondTools/SiPixel/plugins/SiPixelCondObjOfflineReader.h index ccd6d89e13ee0..d72774d4834db 100644 --- a/CondTools/SiPixel/test/SiPixelCondObjOfflineReader.h +++ b/CondTools/SiPixel/plugins/SiPixelCondObjOfflineReader.h @@ -18,8 +18,9 @@ // $Id: SiPixelCondObjOfflineReader.h,v 1.11 2009/05/28 22:12:55 dlange Exp $ // // +#include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" @@ -36,12 +37,11 @@ #include "TH1F.h" namespace cms { - class SiPixelCondObjOfflineReader : public edm::EDAnalyzer { + class SiPixelCondObjOfflineReader : public edm::one::EDAnalyzer { public: explicit SiPixelCondObjOfflineReader(const edm::ParameterSet &iConfig); - - virtual void analyze(const edm::Event &, const edm::EventSetup &); - virtual void endJob(); + void analyze(const edm::Event &, const edm::EventSetup &) override; + void endJob() override; private: edm::ParameterSet conf_; diff --git a/CondTools/SiPixel/test/SiPixelCondObjReader.cc b/CondTools/SiPixel/plugins/SiPixelCondObjReader.cc similarity index 75% rename from CondTools/SiPixel/test/SiPixelCondObjReader.cc rename to CondTools/SiPixel/plugins/SiPixelCondObjReader.cc index 38180d640b805..3c4ceb1ffffeb 100644 --- a/CondTools/SiPixel/test/SiPixelCondObjReader.cc +++ b/CondTools/SiPixel/plugins/SiPixelCondObjReader.cc @@ -1,6 +1,6 @@ #include -#include "CondTools/SiPixel/test/SiPixelCondObjReader.h" +#include "SiPixelCondObjReader.h" #include "Geometry/CommonDetUnit/interface/PixelGeomDetUnit.h" #include "Geometry/CommonTopologies/interface/PixelTopology.h" @@ -10,7 +10,9 @@ namespace cms { SiPixelCondObjReader::SiPixelCondObjReader(const edm::ParameterSet& conf) - : conf_(conf), tkGeomToken_(esConsumes()), SiPixelGainCalibrationService_(conf, consumesCollector()) {} + : conf_(conf), tkGeomToken_(esConsumes()), SiPixelGainCalibrationService_(conf, consumesCollector()) { + usesResource(TFileService::kSharedResource); + } void SiPixelCondObjReader::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { //Create Subdirectories @@ -109,12 +111,12 @@ namespace cms { nchannels++; if (SiPixelGainCalibrationService_.isDead(detid, col_iter, row_iter)) { - // std::cout << "found dead pixel " << detid << " " <Fill(ped); _TH1F_Pedestals_all->Fill(ped); - // std::cout<<"detid "<(PixelSubdetector::PixelBarrel)) _TH1F_Pedestals_bpix->Fill(ped); if (detIdObject.subdetId() == static_cast(PixelSubdetector::PixelEndcap)) _TH1F_Pedestals_fpix->Fill(ped); - // std::cout <<" DetId "<GetRMS(); pedmeanfortree = _TH1F_Pedestals_m[detid]->GetMean(); pedrmsfortree = _TH1F_Pedestals_m[detid]->GetRMS(); - std::cout << "DetId " << detid << " GainMean " << gainmeanfortree << " RMS " << gainrmsfortree - << " PedMean " << pedmeanfortree << " RMS " << pedrmsfortree << std::endl; + edm::LogPrint("SiPixelCondObjReader") + << "DetId " << detid << " GainMean " << gainmeanfortree << " RMS " << gainrmsfortree << " PedMean " + << pedmeanfortree << " RMS " << pedrmsfortree << std::endl; tree->Fill(); ibin++; @@ -170,26 +173,25 @@ namespace cms { edm::LogInfo("SiPixelCondObjReader") << "[SiPixelCondObjReader::analyze] ---> PIXEL Channels " << nchannels << std::endl; - std::cout << " ---> SUMMARY :" << std::endl; - std::cout << "Encounted " << ndead << " dead pixels" << std::endl; - std::cout << "Encounted " << nnoisy << " noisy pixels" << std::endl; - std::cout << "The Gain Mean is " << _TH1F_Gains_all->GetMean() << " with rms " << _TH1F_Gains_all->GetRMS() - << std::endl; - std::cout << " in BPIX " << _TH1F_Gains_bpix->GetMean() << " with rms " << _TH1F_Gains_bpix->GetRMS() - << std::endl; - std::cout << " in FPIX " << _TH1F_Gains_fpix->GetMean() << " with rms " << _TH1F_Gains_fpix->GetRMS() - << std::endl; - std::cout << "The Ped Mean is " << _TH1F_Pedestals_all->GetMean() << " with rms " << _TH1F_Pedestals_all->GetRMS() - << std::endl; - std::cout << " in BPIX " << _TH1F_Pedestals_bpix->GetMean() << " with rms " - << _TH1F_Pedestals_bpix->GetRMS() << std::endl; - std::cout << " in FPIX " << _TH1F_Pedestals_fpix->GetMean() << " with rms " - << _TH1F_Pedestals_fpix->GetRMS() << std::endl; + edm::LogPrint("SiPixelCondObjReader") << " ---> SUMMARY :" << std::endl; + edm::LogPrint("SiPixelCondObjReader") << "Encounted " << ndead << " dead pixels" << std::endl; + edm::LogPrint("SiPixelCondObjReader") << "Encounted " << nnoisy << " noisy pixels" << std::endl; + edm::LogPrint("SiPixelCondObjReader") + << "The Gain Mean is " << _TH1F_Gains_all->GetMean() << " with rms " << _TH1F_Gains_all->GetRMS() << std::endl; + edm::LogPrint("SiPixelCondObjReader") << " in BPIX " << _TH1F_Gains_bpix->GetMean() << " with rms " + << _TH1F_Gains_bpix->GetRMS() << std::endl; + edm::LogPrint("SiPixelCondObjReader") << " in FPIX " << _TH1F_Gains_fpix->GetMean() << " with rms " + << _TH1F_Gains_fpix->GetRMS() << std::endl; + edm::LogPrint("SiPixelCondObjReader") << "The Ped Mean is " << _TH1F_Pedestals_all->GetMean() << " with rms " + << _TH1F_Pedestals_all->GetRMS() << std::endl; + edm::LogPrint("SiPixelCondObjReader") << " in BPIX " << _TH1F_Pedestals_bpix->GetMean() << " with rms " + << _TH1F_Pedestals_bpix->GetRMS() << std::endl; + edm::LogPrint("SiPixelCondObjReader") << " in FPIX " << _TH1F_Pedestals_fpix->GetMean() << " with rms " + << _TH1F_Pedestals_fpix->GetRMS() << std::endl; } - // ------------ method called once each job just before starting event loop ------------ - void SiPixelCondObjReader::beginJob() {} - // ------------ method called once each job just after ending the event loop ------------ - void SiPixelCondObjReader::endJob() { std::cout << " ---> End job " << std::endl; } + void SiPixelCondObjReader::endJob() { edm::LogPrint("SiPixelCondObjReader") << " ---> End job " << std::endl; } } // namespace cms +using namespace cms; +DEFINE_FWK_MODULE(SiPixelCondObjReader); diff --git a/CondTools/SiPixel/test/SiPixelCondObjReader.h b/CondTools/SiPixel/plugins/SiPixelCondObjReader.h similarity index 86% rename from CondTools/SiPixel/test/SiPixelCondObjReader.h rename to CondTools/SiPixel/plugins/SiPixelCondObjReader.h index 789940404a4b5..53ce59ba65738 100644 --- a/CondTools/SiPixel/test/SiPixelCondObjReader.h +++ b/CondTools/SiPixel/plugins/SiPixelCondObjReader.h @@ -18,8 +18,9 @@ // $Id: SiPixelCondObjReader.h,v 1.8 2009/05/28 22:12:55 dlange Exp $ // // +#include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" @@ -36,14 +37,13 @@ #include "TH1F.h" namespace cms { - class SiPixelCondObjReader : public edm::EDAnalyzer { + class SiPixelCondObjReader : public edm::one::EDAnalyzer { public: explicit SiPixelCondObjReader(const edm::ParameterSet &iConfig); - ~SiPixelCondObjReader(){}; - virtual void beginJob(); - virtual void analyze(const edm::Event &, const edm::EventSetup &); - virtual void endJob(); + ~SiPixelCondObjReader() override{}; + void analyze(const edm::Event &, const edm::EventSetup &) override; + void endJob() override; private: edm::ParameterSet conf_; diff --git a/CondTools/SiPixel/test/SiPixelDynamicInefficiencyDB.cc b/CondTools/SiPixel/plugins/SiPixelDynamicInefficiencyDB.cc similarity index 80% rename from CondTools/SiPixel/test/SiPixelDynamicInefficiencyDB.cc rename to CondTools/SiPixel/plugins/SiPixelDynamicInefficiencyDB.cc index cb0f05e52d74b..a3b4bb7c5b3c0 100644 --- a/CondTools/SiPixel/test/SiPixelDynamicInefficiencyDB.cc +++ b/CondTools/SiPixel/plugins/SiPixelDynamicInefficiencyDB.cc @@ -3,18 +3,11 @@ #include #include #include +#include "SiPixelDynamicInefficiencyDB.h" #include "CondCore/DBOutputService/interface/PoolDBOutputService.h" -#include "CondTools/SiPixel/test/SiPixelDynamicInefficiencyDB.h" #include "Geometry/CommonDetUnit/interface/PixelGeomDetUnit.h" #include "CondFormats/SiPixelObjects/interface/SiPixelDynamicInefficiency.h" -#include "FWCore/Framework/interface/ESHandle.h" - -#include "DataFormats/TrackerCommon/interface/TrackerTopology.h" -#include "Geometry/Records/interface/IdealGeometryRecord.h" - -#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" #include "FWCore/ServiceRegistry/interface/Service.h" - #include "DataFormats/GeometryCommonDetAlgo/interface/MeasurementPoint.h" #include "DataFormats/GeometryCommonDetAlgo/interface/MeasurementError.h" #include "DataFormats/GeometrySurface/interface/GloballyPositioned.h" @@ -25,9 +18,9 @@ using namespace edm; //Constructor -SiPixelDynamicInefficiencyDB::SiPixelDynamicInefficiencyDB(edm::ParameterSet const& conf) : conf_(conf) { +SiPixelDynamicInefficiencyDB::SiPixelDynamicInefficiencyDB(edm::ParameterSet const& conf) + : tkTopoToken_(esConsumes()), conf_(conf) { recordName_ = conf_.getUntrackedParameter("record", "SiPixelDynamicInefficiencyRcd"); - thePixelGeomFactors_ = conf_.getUntrackedParameter("thePixelGeomFactors"); theColGeomFactors_ = conf_.getUntrackedParameter("theColGeomFactors"); theChipGeomFactors_ = conf_.getUntrackedParameter("theChipGeomFactors"); @@ -35,13 +28,8 @@ SiPixelDynamicInefficiencyDB::SiPixelDynamicInefficiencyDB(edm::ParameterSet con theInstLumiScaleFactor_ = conf_.getUntrackedParameter("theInstLumiScaleFactor"); } -//BeginJob - -void SiPixelDynamicInefficiencyDB::beginJob() {} - // Virtual destructor needed. - -SiPixelDynamicInefficiencyDB::~SiPixelDynamicInefficiencyDB() {} +SiPixelDynamicInefficiencyDB::~SiPixelDynamicInefficiencyDB() = default; // Analyzer: Functions that gets called by framework every event @@ -49,9 +37,7 @@ void SiPixelDynamicInefficiencyDB::analyze(const edm::Event& e, const edm::Event SiPixelDynamicInefficiency* DynamicInefficiency = new SiPixelDynamicInefficiency(); //Retrieve tracker topology from geometry - edm::ESHandle tTopoHandle; - es.get().get(tTopoHandle); - const TrackerTopology* const tTopo = tTopoHandle.product(); + const TrackerTopology* const tTopo = &es.getData(tkTopoToken_); uint32_t max = numeric_limits::max(); uint32_t mask; @@ -95,13 +81,14 @@ void SiPixelDynamicInefficiencyDB::analyze(const edm::Event& e, const edm::Event double factor = it->getParameter("factor"); if (det == "bpix") { DetId detID = tTopo->pxbDetId(layer, ladder, module); - std::cout << "Putting Pixel geom BPix layer " << layer << " ladder " << ladder << " module " << module - << " factor " << factor << std::endl; + edm::LogPrint("SiPixelDynamicInefficiencyDB") << "Putting Pixel geom BPix layer " << layer << " ladder " << ladder + << " module " << module << " factor " << factor << std::endl; DynamicInefficiency->putPixelGeomFactor(detID.rawId(), factor); } else if (det == "fpix") { DetId detID = tTopo->pxfDetId(side, disk, blade, panel, module); - std::cout << "Putting Pixel geom FPix side " << side << " disk " << disk << " blade " << blade << " panel " - << panel << " module " << module << " factor " << factor << std::endl; + edm::LogPrint("SiPixelDynamicInefficiencyDB") + << "Putting Pixel geom FPix side " << side << " disk " << disk << " blade " << blade << " panel " << panel + << " module " << module << " factor " << factor << std::endl; DynamicInefficiency->putPixelGeomFactor(detID.rawId(), factor); } else edm::LogError("SiPixelDynamicInefficiencyDB") @@ -121,13 +108,15 @@ void SiPixelDynamicInefficiencyDB::analyze(const edm::Event& e, const edm::Event double factor = it->getParameter("factor"); if (det == "bpix") { DetId detID = tTopo->pxbDetId(layer, ladder, module); - std::cout << "Putting Column geom BPix layer " << layer << " ladder " << ladder << " module " << module - << " factor " << factor << std::endl; + edm::LogPrint("SiPixelDynamicInefficiencyDB") + << "Putting Column geom BPix layer " << layer << " ladder " << ladder << " module " << module << " factor " + << factor << std::endl; DynamicInefficiency->putColGeomFactor(detID.rawId(), factor); } else if (det == "fpix") { DetId detID = tTopo->pxfDetId(side, disk, blade, panel, module); - std::cout << "Putting Column geom FPix side " << side << " disk " << disk << " blade " << blade << " panel " - << panel << " module " << module << " factor " << factor << std::endl; + edm::LogPrint("SiPixelDynamicInefficiencyDB") + << "Putting Column geom FPix side " << side << " disk " << disk << " blade " << blade << " panel " << panel + << " module " << module << " factor " << factor << std::endl; DynamicInefficiency->putColGeomFactor(detID.rawId(), factor); } else edm::LogError("SiPixelDynamicInefficiencyDB") @@ -147,13 +136,14 @@ void SiPixelDynamicInefficiencyDB::analyze(const edm::Event& e, const edm::Event double factor = it->getParameter("factor"); if (det == "bpix") { DetId detID = tTopo->pxbDetId(layer, ladder, module); - std::cout << "Putting Chip geom BPix layer " << layer << " ladder " << ladder << " module " << module - << " factor " << factor << std::endl; + edm::LogPrint("SiPixelDynamicInefficiencyDB") << "Putting Chip geom BPix layer " << layer << " ladder " << ladder + << " module " << module << " factor " << factor << std::endl; DynamicInefficiency->putChipGeomFactor(detID.rawId(), factor); } else if (det == "fpix") { DetId detID = tTopo->pxfDetId(side, disk, blade, panel, module); - std::cout << "Putting Chip geom FPix side " << side << " disk " << disk << " blade " << blade << " panel " - << panel << " module " << module << " factor " << factor << std::endl; + edm::LogPrint("SiPixelDynamicInefficiencyDB") + << "Putting Chip geom FPix side " << side << " disk " << disk << " blade " << blade << " panel " << panel + << " module " << module << " factor " << factor << std::endl; DynamicInefficiency->putChipGeomFactor(detID.rawId(), factor); } else edm::LogError("SiPixelDynamicInefficiencyDB") @@ -173,13 +163,15 @@ void SiPixelDynamicInefficiencyDB::analyze(const edm::Event& e, const edm::Event std::vector factor = it->getParameter >("factor"); if (det == "bpix") { DetId detID = tTopo->pxbDetId(layer, ladder, module); - std::cout << "Putting PU efficiency BPix layer " << layer << " ladder " << ladder << " module " << module - << " factor size " << factor.size() << std::endl; + edm::LogPrint("SiPixelDynamicInefficiencyDB") + << "Putting PU efficiency BPix layer " << layer << " ladder " << ladder << " module " << module + << " factor size " << factor.size() << std::endl; DynamicInefficiency->putPUFactor(detID.rawId(), factor); } else if (det == "fpix") { DetId detID = tTopo->pxfDetId(side, disk, blade, panel, module); - std::cout << "Putting PU efficiency FPix side " << side << " disk " << disk << " blade " << blade << " panel " - << panel << " module " << module << " factor size " << factor.size() << std::endl; + edm::LogPrint("SiPixelDynamicInefficiencyDB") + << "Putting PU efficiency FPix side " << side << " disk " << disk << " blade " << blade << " panel " << panel + << " module " << module << " factor size " << factor.size() << std::endl; DynamicInefficiency->putPUFactor(detID.rawId(), factor); } } @@ -207,4 +199,4 @@ void SiPixelDynamicInefficiencyDB::analyze(const edm::Event& e, const edm::Event edm::LogError("SiPixelDynamicInefficiencyDB") << "Service is unavailable" << std::endl; } } -void SiPixelDynamicInefficiencyDB::endJob() {} +DEFINE_FWK_MODULE(SiPixelDynamicInefficiencyDB); diff --git a/CondTools/SiPixel/test/SiPixelDynamicInefficiencyDB.h b/CondTools/SiPixel/plugins/SiPixelDynamicInefficiencyDB.h similarity index 63% rename from CondTools/SiPixel/test/SiPixelDynamicInefficiencyDB.h rename to CondTools/SiPixel/plugins/SiPixelDynamicInefficiencyDB.h index 05d1594dfa5ce..11c8a5311676e 100644 --- a/CondTools/SiPixel/test/SiPixelDynamicInefficiencyDB.h +++ b/CondTools/SiPixel/plugins/SiPixelDynamicInefficiencyDB.h @@ -3,30 +3,25 @@ #include -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "DataFormats/TrackerCommon/interface/TrackerTopology.h" #include "FWCore/Framework/interface/Event.h" -#include "DataFormats/Common/interface/Handle.h" #include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" - +#include "Geometry/Records/interface/TrackerTopologyRcd.h" #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" -#include "FWCore/MessageLogger/interface/MessageLogger.h" - -#include "DataFormats/DetId/interface/DetId.h" -class SiPixelDynamicInefficiencyDB : public edm::EDAnalyzer { +class SiPixelDynamicInefficiencyDB : public edm::one::EDAnalyzer<> { public: explicit SiPixelDynamicInefficiencyDB(const edm::ParameterSet& conf); - virtual ~SiPixelDynamicInefficiencyDB(); - - virtual void beginJob(); - - virtual void endJob(); - - virtual void analyze(const edm::Event& e, const edm::EventSetup& c); + ~SiPixelDynamicInefficiencyDB() override; + void analyze(const edm::Event& e, const edm::EventSetup& c) override; private: + const edm::ESGetToken tkTopoToken_; edm::ParameterSet conf_; std::string recordName_; diff --git a/CondTools/SiPixel/test/SiPixelDynamicInefficiencyReader.cc b/CondTools/SiPixel/plugins/SiPixelDynamicInefficiencyReader.cc similarity index 85% rename from CondTools/SiPixel/test/SiPixelDynamicInefficiencyReader.cc rename to CondTools/SiPixel/plugins/SiPixelDynamicInefficiencyReader.cc index 9b028569e4216..181a4b4107068 100644 --- a/CondTools/SiPixel/test/SiPixelDynamicInefficiencyReader.cc +++ b/CondTools/SiPixel/plugins/SiPixelDynamicInefficiencyReader.cc @@ -1,19 +1,12 @@ -#include "CondFormats/SiPixelObjects/interface/SiPixelDynamicInefficiency.h" -#include "CondFormats/DataRecord/interface/SiPixelDynamicInefficiencyRcd.h" +#include "SiPixelDynamicInefficiencyReader.h" #include "Geometry/CommonDetUnit/interface/PixelGeomDetUnit.h" -#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" -#include "CondTools/SiPixel/test/SiPixelDynamicInefficiencyReader.h" #include "DataFormats/SiPixelDetId/interface/PixelSubdetector.h" #include "DataFormats/DetId/interface/DetId.h" -#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" #include "Geometry/CommonDetUnit/interface/PixelGeomDetUnit.h" #include "FWCore/ServiceRegistry/interface/Service.h" #include "DataFormats/TrackerCommon/interface/PixelBarrelName.h" #include "DataFormats/TrackerCommon/interface/PixelEndcapName.h" #include "DataFormats/SiPixelDetId/interface/PixelSubdetector.h" -#include "DataFormats/TrackerCommon/interface/TrackerTopology.h" - -#include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" #include #include @@ -22,7 +15,10 @@ using namespace cms; SiPixelDynamicInefficiencyReader::SiPixelDynamicInefficiencyReader(const edm::ParameterSet& iConfig) - : printdebug_(iConfig.getUntrackedParameter("printDebug", false)) { + : tkGeomToken(esConsumes()), + tkTopoToken(esConsumes()), + dynIneffToken(esConsumes()), + printdebug_(iConfig.getUntrackedParameter("printDebug", false)) { //Load factors from config file, copied from SimTracker/SiPixelDigitizer/plugins/SiPixelDigitizerAlgorithm.cc int i = 0; thePixelColEfficiency[i++] = iConfig.getParameter("thePixelColEfficiency_BPix1"); @@ -77,11 +73,10 @@ SiPixelDynamicInefficiencyReader::SiPixelDynamicInefficiencyReader(const edm::Pa thePUEfficiency[i++] = iConfig.getParameter >("thePUEfficiency_FPix_Outer"); } -SiPixelDynamicInefficiencyReader::~SiPixelDynamicInefficiencyReader() {} +SiPixelDynamicInefficiencyReader::~SiPixelDynamicInefficiencyReader() = default; void SiPixelDynamicInefficiencyReader::analyze(const edm::Event& e, const edm::EventSetup& iSetup) { - edm::ESHandle SiPixelDynamicInefficiency_; - iSetup.get().get(SiPixelDynamicInefficiency_); + const SiPixelDynamicInefficiency* SiPixelDynamicInefficiency_ = &iSetup.getData(dynIneffToken); edm::LogInfo("SiPixelDynamicInefficiencyReader") << "[SiPixelDynamicInefficiencyReader::analyze] End Reading SiPixelDynamicInefficiency" << std::endl; @@ -94,7 +89,7 @@ void SiPixelDynamicInefficiencyReader::analyze(const edm::Event& e, const edm::E std::map::const_iterator it_chipgeom; std::map >::const_iterator it_pu; - std::cout << "Printing out DB content:" << std::endl; + edm::LogPrint("SiPixelDynamicInefficiencyReader") << "Printing out DB content:" << std::endl; for (it_pixelgeom = map_pixelgeomfactor.begin(); it_pixelgeom != map_pixelgeomfactor.end(); it_pixelgeom++) { printf("pixelgeom detid %x\tfactor %f\n", it_pixelgeom->first, it_pixelgeom->second); } @@ -106,31 +101,29 @@ void SiPixelDynamicInefficiencyReader::analyze(const edm::Event& e, const edm::E } for (it_pu = map_pufactor.begin(); it_pu != map_pufactor.end(); it_pu++) { printf("pu detid %x\t", it_pu->first); - std::cout << " Size of vector " << it_pu->second.size() << " elements:"; + edm::LogPrint("SiPixelDynamicInefficiencyReader") << " Size of vector " << it_pu->second.size() << " elements:"; if (it_pu->second.size() > 1) { for (unsigned int i = 0; i < it_pu->second.size(); i++) { - std::cout << " " << it_pu->second.at(i); + edm::LogPrint("SiPixelDynamicInefficiencyReader") << " " << it_pu->second.at(i); } - std::cout << std::endl; + edm::LogPrint("SiPixelDynamicInefficiencyReader") << std::endl; } else { - std::cout << " " << it_pu->second.at(0) << std::endl; + edm::LogPrint("SiPixelDynamicInefficiencyReader") << " " << it_pu->second.at(0) << std::endl; } } std::vector detIdmasks = SiPixelDynamicInefficiency_->getDetIdmasks(); for (unsigned int i = 0; i < detIdmasks.size(); i++) printf("DetId Mask: %x\t\n", detIdmasks.at(i)); double theInstLumiScaleFactor = SiPixelDynamicInefficiency_->gettheInstLumiScaleFactor_(); - std::cout << "theInstLumiScaleFactor " << theInstLumiScaleFactor << std::endl; + edm::LogPrint("SiPixelDynamicInefficiencyReader") << "theInstLumiScaleFactor " << theInstLumiScaleFactor << std::endl; //Comparing DB factors to config factors - std::cout << "\nCalculating factors/module and comparing it to config file factors...\n" << std::endl; - - edm::ESHandle tTopoHandle; - iSetup.get().get(tTopoHandle); - const TrackerTopology* const tTopo = tTopoHandle.product(); + edm::LogPrint("SiPixelDynamicInefficiencyReader") + << "\nCalculating factors/module and comparing it to config file factors...\n" + << std::endl; - edm::ESHandle pDD; - iSetup.get().get(pDD); + const TrackerTopology* const tTopo = &iSetup.getData(tkTopoToken); + const TrackerGeometry* pDD = &iSetup.getData(tkGeomToken); edm::LogInfo("SiPixelDynamicInefficiency (old)") << " There are " << pDD->detUnits().size() << " detectors (old)" << std::endl; @@ -245,14 +238,16 @@ void SiPixelDynamicInefficiencyReader::analyze(const edm::Event& e, const edm::E } } } - std::cout << match << " geom factors and " << pu_match << " pu factors matched to config file factors!\n" - << std::endl; + edm::LogPrint("SiPixelDynamicInefficiencyReader") + << match << " geom factors and " << pu_match << " pu factors matched to config file factors!\n" + << std::endl; if (mismatch != 0) - std::cout << "ERROR! " << mismatch - << " geom factors mismatched to config file factors! Please change config and/or DB content!" - << std::endl; + edm::LogPrint("SiPixelDynamicInefficiencyReader") + << "ERROR! " << mismatch + << " geom factors mismatched to config file factors! Please change config and/or DB content!" << std::endl; if (pu_mismatch != 0) - std::cout << "ERROR! " << pu_mismatch - << " pu_factors mismatched to config file pu_factors! Please change config and/or DB content!" - << std::endl; + edm::LogPrint("SiPixelDynamicInefficiencyReader") + << "ERROR! " << pu_mismatch + << " pu_factors mismatched to config file pu_factors! Please change config and/or DB content!" << std::endl; } +DEFINE_FWK_MODULE(SiPixelDynamicInefficiencyReader); diff --git a/CondTools/SiPixel/test/SiPixelDynamicInefficiencyReader.h b/CondTools/SiPixel/plugins/SiPixelDynamicInefficiencyReader.h similarity index 58% rename from CondTools/SiPixel/test/SiPixelDynamicInefficiencyReader.h rename to CondTools/SiPixel/plugins/SiPixelDynamicInefficiencyReader.h index c80cc41d3e93b..acf7d75de8433 100644 --- a/CondTools/SiPixel/test/SiPixelDynamicInefficiencyReader.h +++ b/CondTools/SiPixel/plugins/SiPixelDynamicInefficiencyReader.h @@ -5,27 +5,36 @@ //#include // user include files +#include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDAnalyzer.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/ServiceRegistry/interface/Service.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" +#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" +#include "CondFormats/SiPixelObjects/interface/SiPixelDynamicInefficiency.h" +#include "CondFormats/DataRecord/interface/SiPixelDynamicInefficiencyRcd.h" +#include "DataFormats/TrackerCommon/interface/TrackerTopology.h" // // // class decleration // -class SiPixelDynamicInefficiencyReader : public edm::EDAnalyzer { +class SiPixelDynamicInefficiencyReader : public edm::one::EDAnalyzer<> { public: explicit SiPixelDynamicInefficiencyReader(const edm::ParameterSet&); - ~SiPixelDynamicInefficiencyReader(); + ~SiPixelDynamicInefficiencyReader() override; - void analyze(const edm::Event&, const edm::EventSetup&); + void analyze(const edm::Event&, const edm::EventSetup&) override; private: + const edm::ESGetToken tkGeomToken; + const edm::ESGetToken tkTopoToken; + const edm::ESGetToken dynIneffToken; + bool printdebug_; double thePixelEfficiency[20]; // Single pixel effciency double thePixelColEfficiency[20]; // Column effciency diff --git a/CondTools/SiPixel/plugins/SiPixelFakeGenErrorDBSourceReader.cc b/CondTools/SiPixel/plugins/SiPixelFakeGenErrorDBSourceReader.cc new file mode 100644 index 0000000000000..ee58efd5a853a --- /dev/null +++ b/CondTools/SiPixel/plugins/SiPixelFakeGenErrorDBSourceReader.cc @@ -0,0 +1,48 @@ +#include +#include + +#include "CondFormats/SiPixelObjects/interface/SiPixelGenErrorDBObject.h" +#include "CondFormats/DataRecord/interface/SiPixelGenErrorDBObjectRcd.h" + +#include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/Framework/interface/EventSetup.h" + +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" +#include "FWCore/Framework/interface/ESWatcher.h" + +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/MakerMacros.h" + +#include "FWCore/ParameterSet/interface/ParameterSet.h" + +class SiPixelFakeGenErrorDBSourceReader : public edm::one::EDAnalyzer<> { +public: + explicit SiPixelFakeGenErrorDBSourceReader(const edm::ParameterSet&); + ~SiPixelFakeGenErrorDBSourceReader() override; + +private: + void beginJob() override; + void analyze(const edm::Event&, const edm::EventSetup&) override; + void endJob() override; + + edm::ESWatcher SiPixelGenErrorDBObjectWatcher_; + edm::ESGetToken genErrToken_; +}; + +SiPixelFakeGenErrorDBSourceReader::SiPixelFakeGenErrorDBSourceReader(const edm::ParameterSet& iConfig) + : genErrToken_(esConsumes()) {} + +SiPixelFakeGenErrorDBSourceReader::~SiPixelFakeGenErrorDBSourceReader() = default; + +void SiPixelFakeGenErrorDBSourceReader::beginJob() {} + +void SiPixelFakeGenErrorDBSourceReader::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { + if (SiPixelGenErrorDBObjectWatcher_.check(iSetup)) { + edm::LogPrint("SiPixelFakeGenErrorDBSourceReader") << *&iSetup.getData(genErrToken_) << std::endl; + } +} + +void SiPixelFakeGenErrorDBSourceReader::endJob() {} + +DEFINE_FWK_MODULE(SiPixelFakeGenErrorDBSourceReader); diff --git a/CondTools/SiPixel/plugins/SiPixelFakeTemplateDBSourceReader.cc b/CondTools/SiPixel/plugins/SiPixelFakeTemplateDBSourceReader.cc new file mode 100644 index 0000000000000..9086506bad713 --- /dev/null +++ b/CondTools/SiPixel/plugins/SiPixelFakeTemplateDBSourceReader.cc @@ -0,0 +1,48 @@ +#include +#include + +#include "CondFormats/SiPixelObjects/interface/SiPixelTemplateDBObject.h" +#include "CondFormats/DataRecord/interface/SiPixelTemplateDBObjectRcd.h" + +#include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/Framework/interface/EventSetup.h" + +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" +#include "FWCore/Framework/interface/ESWatcher.h" + +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/MakerMacros.h" + +#include "FWCore/ParameterSet/interface/ParameterSet.h" + +class SiPixelFakeTemplateDBSourceReader : public edm::one::EDAnalyzer<> { +public: + explicit SiPixelFakeTemplateDBSourceReader(const edm::ParameterSet&); + ~SiPixelFakeTemplateDBSourceReader() override; + +private: + void beginJob() override; + void analyze(const edm::Event&, const edm::EventSetup&) override; + void endJob() override; + + edm::ESWatcher SiPixelTemplateDBObjectWatcher_; + edm::ESGetToken the1DTemplateToken_; +}; + +SiPixelFakeTemplateDBSourceReader::SiPixelFakeTemplateDBSourceReader(const edm::ParameterSet& iConfig) + : the1DTemplateToken_(esConsumes()) {} + +SiPixelFakeTemplateDBSourceReader::~SiPixelFakeTemplateDBSourceReader() = default; + +void SiPixelFakeTemplateDBSourceReader::beginJob() {} + +void SiPixelFakeTemplateDBSourceReader::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { + if (SiPixelTemplateDBObjectWatcher_.check(iSetup)) { + edm::LogPrint("SiPixelFakeTemplateDBSourceReader") << *&iSetup.getData(the1DTemplateToken_) << std::endl; + } +} + +void SiPixelFakeTemplateDBSourceReader::endJob() {} + +DEFINE_FWK_MODULE(SiPixelFakeTemplateDBSourceReader); diff --git a/CondTools/SiPixel/test/SiPixelGainCalibScaler.cc b/CondTools/SiPixel/plugins/SiPixelGainCalibScaler.cc similarity index 96% rename from CondTools/SiPixel/test/SiPixelGainCalibScaler.cc rename to CondTools/SiPixel/plugins/SiPixelGainCalibScaler.cc index 6b2388d85887c..f6db922b29a11 100644 --- a/CondTools/SiPixel/test/SiPixelGainCalibScaler.cc +++ b/CondTools/SiPixel/plugins/SiPixelGainCalibScaler.cc @@ -116,6 +116,8 @@ class SiPixelGainCalibScaler : public edm::one::EDAnalyzer gainHLTCalibToken_; edm::ESGetToken gainOfflineCalibToken_; + edm::ESGetToken tkGeomToken_; + edm::ESGetToken tkTopoToken_; edm::ESWatcher pixelHLTGainWatcher_; edm::ESWatcher pixelOfflineGainWatcher_; @@ -129,8 +131,10 @@ SiPixelGainCalibScaler::SiPixelGainCalibScaler(const edm::ParameterSet& iConfig) isForHLT_(iConfig.getParameter("isForHLT")), verbose_(iConfig.getUntrackedParameter("verbose", false)), m_parameters(iConfig.getParameter >("parameters")) { - gainHLTCalibToken_ = esConsumes(); - gainOfflineCalibToken_ = esConsumes(); + gainHLTCalibToken_ = esConsumes(); + gainOfflineCalibToken_ = esConsumes(); + tkGeomToken_ = esConsumes(); + tkTopoToken_ = esConsumes(); for (auto& thePSet : m_parameters) { const unsigned int phase(thePSet.getParameter("phase")); @@ -190,8 +194,7 @@ void SiPixelGainCalibScaler::computeAndStorePalyoads(const edm::EventSetup& iSet //======================================================= // Retrieve geometry information //======================================================= - edm::ESHandle pDD; - iSetup.get().get(pDD); + const TrackerGeometry* pDD = &iSetup.getData(tkGeomToken_); edm::LogInfo("SiPixelGainCalibScaler") << "There are: " << pDD->dets().size() << " detectors"; // switch on the phase1 @@ -206,7 +209,7 @@ void SiPixelGainCalibScaler::computeAndStorePalyoads(const edm::EventSetup& iSet myVCalInfo.printAllInfo(); // if need the ESHandle to check if the SetupData was there or not - auto payload = iSetup.getHandle(token); + auto payload = &iSetup.getData(token); std::vector detids; payload->getDetIds(detids); @@ -218,10 +221,9 @@ void SiPixelGainCalibScaler::computeAndStorePalyoads(const edm::EventSetup& iSet auto SiPixelGainCalibration_ = new PayloadType(minped, maxped, mingain, maxgain); //Retrieve tracker topology from geometry - edm::ESHandle tTopoHandle; - iSetup.get().get(tTopoHandle); - const TrackerTopology* tTopo = tTopoHandle.product(); + const TrackerTopology* tTopo = &iSetup.getData(tkTopoToken_); + // possible to load it not from EventSetup //const char* path_toTopologyXML = "Geometry/TrackerCommonData/data/PhaseI/trackerParameters.xml"; //TrackerTopology tTopo = StandaloneTrackerTopology::fromTrackerParametersXMLFile(edm::FileInPath(path_toTopologyXML).fullPath()); diff --git a/CondTools/SiPixel/test/SiPixelGainCalibrationReadDQMFile.cc b/CondTools/SiPixel/plugins/SiPixelGainCalibrationReadDQMFile.cc similarity index 72% rename from CondTools/SiPixel/test/SiPixelGainCalibrationReadDQMFile.cc rename to CondTools/SiPixel/plugins/SiPixelGainCalibrationReadDQMFile.cc index 26868a87de495..a54533f81bf43 100644 --- a/CondTools/SiPixel/test/SiPixelGainCalibrationReadDQMFile.cc +++ b/CondTools/SiPixel/plugins/SiPixelGainCalibrationReadDQMFile.cc @@ -23,21 +23,6 @@ #include // user include files -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" - -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/MakerMacros.h" - -#include "FWCore/ServiceRegistry/interface/Service.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "CondFormats/SiPixelObjects/interface/SiPixelCalibConfiguration.h" -#include "CondFormats/SiPixelObjects/interface/SiPixelGainCalibration.h" -#include "CondFormats/SiPixelObjects/interface/SiPixelGainCalibrationOffline.h" -#include "CondFormats/SiPixelObjects/interface/SiPixelGainCalibrationForHLT.h" -#include "CalibTracker/SiPixelESProducers/interface/SiPixelGainCalibrationService.h" -#include "CondCore/DBOutputService/interface/PoolDBOutputService.h" - #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" #include "Geometry/CommonDetUnit/interface/PixelGeomDetUnit.h" #include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" @@ -51,7 +36,7 @@ #include "TList.h" #include "TTree.h" -#include "CondTools/SiPixel/test/SiPixelGainCalibrationReadDQMFile.h" +#include "SiPixelGainCalibrationReadDQMFile.h" #include "CommonTools/UtilAlgos/interface/TFileService.h" #include "FWCore/ServiceRegistry/interface/Service.h" // @@ -61,7 +46,7 @@ void SiPixelGainCalibrationReadDQMFile::fillDatabase(const edm::EventSetup &iSetup, TFile *therootfile) { // only create when necessary. // process the minimum and maximum gain & ped values... - std::cout << "now starting db fill!!!" << std::endl; + edm::LogPrint("SiPixelGainCalibrationReadDQMFile") << "now starting db fill!!!" << std::endl; std::map > badresults; @@ -90,9 +75,10 @@ void SiPixelGainCalibrationReadDQMFile::fillDatabase(const edm::EventSetup &iSet // TH1F *pedPerDetid; size_t ntimes = 0; - std::cout << "now filling record " << record_ << std::endl; + edm::LogPrint("SiPixelGainCalibrationReadDQMFile") << "now filling record " << record_ << std::endl; if (record_ != "SiPixelGainCalibrationForHLTRcd" && record_ != "SiPixelGainCalibrationOfflineRcd") { - std::cout << "you passed record " << record_ << ", which I have no idea what to do with!" << std::endl; + edm::LogPrint("SiPixelGainCalibrationReadDQMFile") + << "you passed record " << record_ << ", which I have no idea what to do with!" << std::endl; return; } if (gainlow_ > gainhi_) { @@ -111,12 +97,12 @@ void SiPixelGainCalibrationReadDQMFile::fillDatabase(const edm::EventSetup &iSet pedhi_ = pedmax_; float badpedval = pedlow_ - 200; float badgainval = gainlow_ - 200; - std::cout << "now filling db: values: pedlow, hi: " << pedlow_ << ", " << pedhi_ << " and gainlow, hi: " << gainlow_ - << ", " << gainhi_; + edm::LogPrint("SiPixelGainCalibrationReadDQMFile") << "now filling db: values: pedlow, hi: " << pedlow_ << ", " + << pedhi_ << " and gainlow, hi: " << gainlow_ << ", " << gainhi_; float meangain = meanGainHist_->GetMean(); float meanped = meanPedHist_->GetMean(); - // std::cout << ", and mean gain " << meangain<< ", ped " << meanped ; - // std::cout << std::endl; + // edm::LogPrint("SiPixelGainCalibrationReadDQMFile") << ", and mean gain " << meangain<< ", ped " << meanped ; + // edm::LogPrint("SiPixelGainCalibrationReadDQMFile") << std::endl; // and fill the dummy histos: @@ -138,8 +124,8 @@ void SiPixelGainCalibrationReadDQMFile::fillDatabase(const edm::EventSetup &iSet uint32_t nchannels = 0; uint32_t nmodules = 0; - std::cout << "now starting loop on detids, there are " << bookkeeper_.size() << " histograms to consider..." - << std::endl; + edm::LogPrint("SiPixelGainCalibrationReadDQMFile") + << "now starting loop on detids, there are " << bookkeeper_.size() << " histograms to consider..." << std::endl; uint32_t detid = 0; therootfile->cd(); const TrackerGeometry *pDD = &iSetup.getData(pddToken_); @@ -160,9 +146,9 @@ void SiPixelGainCalibrationReadDQMFile::fillDatabase(const edm::EventSetup &iSet //if(detid!=302058516) continue; ntimes = 0; useddefaultfortree = 0; - std::cout + edm::LogPrint("SiPixelGainCalibrationReadDQMFile") << "now creating database object for detid " << detid - << std::endl; //<< " " << bookkeeper_[detid]["gain_2d"] << " " << bookkeeper_[detid]["ped_2d"] << std::endl; //std::cout<< " nrows:" << nrows << " ncols: " << ncols << std::endl; + << std::endl; //<< " " << bookkeeper_[detid]["gain_2d"] << " " << bookkeeper_[detid]["ped_2d"] << std::endl; //edm::LogPrint("SiPixelGainCalibrationReadDQMFile")<< " nrows:" << nrows << " ncols: " << ncols << std::endl; // Get the module sizes. TH2F *tempchi2; @@ -187,14 +173,14 @@ void SiPixelGainCalibrationReadDQMFile::fillDatabase(const edm::EventSetup &iSet TString tempgainstring = bookkeeper_[detid]["gain_2d"]; tempgain = dynamic_cast(therootfile->Get(tempgainstring)); if (tempgain == nullptr) { - // std::cout <<"WARNING, gain histo " << bookkeeper_[detid]["gain_2d"] << " does not exist, using default instead" << std::endl; + // edm::LogPrint("SiPixelGainCalibrationReadDQMFile") <<"WARNING, gain histo " << bookkeeper_[detid]["gain_2d"] << " does not exist, using default instead" << std::endl; tempgain = defaultGain_.get(); useddefaultfortree = 1; } TString temppedstring = bookkeeper_[detid]["ped_2d"]; tempped = dynamic_cast(therootfile->Get(temppedstring)); if (tempped == nullptr) { - // std::cout <<"WARNING, ped histo " << bookkeeper_[detid]["ped_2d"] << " for detid " << detid << " does not exist, using default instead" << std::endl; + // edm::LogPrint("SiPixelGainCalibrationReadDQMFile") <<"WARNING, ped histo " << bookkeeper_[detid]["ped_2d"] << " for detid " << detid << " does not exist, using default instead" << std::endl; std::pair tempval(tempgainstring, 0); badresults[detid] = tempval; tempped = defaultPed_.get(); @@ -218,7 +204,7 @@ void SiPixelGainCalibrationReadDQMFile::fillDatabase(const edm::EventSetup &iSet // int nrows=tempgain->GetNbinsY(); // int ncols=tempgain->GetNbinsX(); - // std::cout << "next histo " << tempgain->GetTitle() << " has nrow,ncol:" << nrows << ","<< ncols << std::endl; + // edm::LogPrint("SiPixelGainCalibrationReadDQMFile") << "next histo " << tempgain->GetTitle() << " has nrow,ncol:" << nrows << ","<< ncols << std::endl; size_t nrowsrocsplit = theGainCalibrationDbInputHLT->getNumberOfRowsToAverageOver(); if (theGainCalibrationDbInputOffline->getNumberOfRowsToAverageOver() != nrowsrocsplit) throw cms::Exception("GainCalibration Payload configuration error") @@ -263,12 +249,12 @@ void SiPixelGainCalibrationReadDQMFile::fillDatabase(const edm::EventSetup &iSet float gainforthiscol[2]; int nusedrows[2]; size_t nemptypixels = 0; - //std::cout << pedlow_<<" "< nrowsrocsplit) @@ -283,7 +269,7 @@ void SiPixelGainCalibrationReadDQMFile::fillDatabase(const edm::EventSetup &iSet if (ped > pedlow_ && gain > gainlow_ && ped < pedhi_ && gain < gainhi_ && (fitresult > 0)) { ntimes++; // if(ntimes<=10) - // std::cout << detid << " " << jrow << " " << icol << " " << ped << " " << ped << " " << chi2 << " " << fitresult << std::endl; + // edm::LogPrint("SiPixelGainCalibrationReadDQMFile") << detid << " " << jrow << " " << icol << " " << ped << " " << ped << " " << chi2 << " " << fitresult << std::endl; VCAL_endpoint->Fill((255 - ped) / gain); peds[jrow] = ped; gains[jrow] = gain; @@ -302,12 +288,12 @@ void SiPixelGainCalibrationReadDQMFile::fillDatabase(const edm::EventSetup &iSet } else { nemptypixels++; // if(nemptypixels<0.01*nrows*ncols ) - // std::cout << "ped,gain="<< ped << ","<< gain << " row, col " << jrow <<","<< icol << ", detid " << detid << std::endl; + // edm::LogPrint("SiPixelGainCalibrationReadDQMFile") << "ped,gain="<< ped << ","<< gain << " row, col " << jrow <<","<< icol << ", detid " << detid << std::endl; if (usemeanwhenempty_) { //ntimes++; //if(nemptypixels<=50) - //std::cout << "USING DEFAULT MEAN GAIN & PED (" << meangain << ","<< meanped << ")!, observed values are gain,ped : "<< gain << "," << ped <<", chi2 " << chi2 << ", fitresult "<< fitresult<< std::endl; - // std::cout < tempval(tempgainstring, 2); badresults[detid] = tempval; // if everything else fails: set the gain & ped now to dead @@ -323,7 +309,7 @@ void SiPixelGainCalibrationReadDQMFile::fillDatabase(const edm::EventSetup &iSet gains[jrow] = badgainval; } } - //std::cout << detid << " " << jrow << " " << icol << " " << peds[jrow] << " " << gains[jrow] << " " << chi2 << " " << fitresult << std::endl; + //edm::LogPrint("SiPixelGainCalibrationReadDQMFile") << detid << " " << jrow << " " << icol << " " << peds[jrow] << " " << gains[jrow] << " " << chi2 << " " << fitresult << std::endl; totgains->Fill(gains[jrow]); totpeds->Fill(peds[jrow]); @@ -347,24 +333,24 @@ void SiPixelGainCalibrationReadDQMFile::fillDatabase(const edm::EventSetup &iSet } if (jrow % nrowsrocsplit == 0) { - // std::cout << "now in col " << icol << " " << jrow << " " << iglobalrow << std::endl; + // edm::LogPrint("SiPixelGainCalibrationReadDQMFile") << "now in col " << icol << " " << jrow << " " << iglobalrow << std::endl; if (nusedrows[iglobalrow] > 0) { pedforthiscol[iglobalrow] /= (float)nusedrows[iglobalrow]; gainforthiscol[iglobalrow] /= (float)nusedrows[iglobalrow]; } if (gainforthiscol[iglobalrow] > gainlow_ && gainforthiscol[iglobalrow] < gainhi_ && pedforthiscol[iglobalrow] > pedlow_ && pedforthiscol[iglobalrow] < pedhi_) { // good - // std::cout << "setting ped & col aves: " << pedforthiscol[iglobalrow] << " " << gainforthiscol[iglobalrow]<< std::endl; + // edm::LogPrint("SiPixelGainCalibrationReadDQMFile") << "setting ped & col aves: " << pedforthiscol[iglobalrow] << " " << gainforthiscol[iglobalrow]<< std::endl; } else { if (usemeanwhenempty_) { - // std::cout << "setting ped & col aves: " << pedforthiscol[iglobalrow] << " " << gainforthiscol[iglobalrow]<< std::endl; + // edm::LogPrint("SiPixelGainCalibrationReadDQMFile") << "setting ped & col aves: " << pedforthiscol[iglobalrow] << " " << gainforthiscol[iglobalrow]<< std::endl; pedforthiscol[iglobalrow] = meanped; gainforthiscol[iglobalrow] = meangain; std::pair tempval(tempgainstring, 3); badresults[detid] = tempval; } else { //make dead //if(ntimes<=100) - //std::cout << tempgainstring << "dead Column, observed values are gain,ped : "<< gainforthiscol[iglobalrow] << "," << pedforthiscol[iglobalrow] << std::endl; + //edm::LogPrint("SiPixelGainCalibrationReadDQMFile") << tempgainstring << "dead Column, observed values are gain,ped : "<< gainforthiscol[iglobalrow] << "," << pedforthiscol[iglobalrow] << std::endl; pedforthiscol[iglobalrow] = badpedval; gainforthiscol[iglobalrow] = badgainval; std::pair tempval(tempgainstring, 4); @@ -379,7 +365,7 @@ void SiPixelGainCalibrationReadDQMFile::fillDatabase(const edm::EventSetup &iSet theGainCalibrationDbInputHLT->setData( pedforthiscol[iglobalrow], gainforthiscol[iglobalrow], theSiPixelGainCalibrationPerColumn); } else { - // std::cout << pedforthiscol[iglobalrow] << " " << gainforthiscol[iglobalrow] << std::endl; + // edm::LogPrint("SiPixelGainCalibrationReadDQMFile") << pedforthiscol[iglobalrow] << " " << gainforthiscol[iglobalrow] << std::endl; theGainCalibrationDbInputOffline->setDeadColumn(nrowsrocsplit, theSiPixelGainCalibrationGainPerColPedPerPixel); theGainCalibrationDbInputHLT->setDeadColumn(nrowsrocsplit, theSiPixelGainCalibrationPerColumn); @@ -388,7 +374,7 @@ void SiPixelGainCalibrationReadDQMFile::fillDatabase(const edm::EventSetup &iSet } } - // std::cout << "setting range..." << std::endl; + // edm::LogPrint("SiPixelGainCalibrationReadDQMFile") << "setting range..." << std::endl; SiPixelGainCalibration::Range range(theSiPixelGainCalibrationPerPixel.begin(), theSiPixelGainCalibrationPerPixel.end()); SiPixelGainCalibrationForHLT::Range hltrange(theSiPixelGainCalibrationPerColumn.begin(), @@ -396,7 +382,7 @@ void SiPixelGainCalibrationReadDQMFile::fillDatabase(const edm::EventSetup &iSet SiPixelGainCalibrationOffline::Range offlinerange(theSiPixelGainCalibrationGainPerColPedPerPixel.begin(), theSiPixelGainCalibrationGainPerColPedPerPixel.end()); - // std::cout <<"putting things in db..." << std::endl; + // edm::LogPrint("SiPixelGainCalibrationReadDQMFile") <<"putting things in db..." << std::endl; // now start creating the various database objects if (!theGainCalibrationDbInput->put(detid, range, ncols)) edm::LogError("SiPixelGainCalibrationAnalysis") @@ -422,61 +408,63 @@ void SiPixelGainCalibrationReadDQMFile::fillDatabase(const edm::EventSetup &iSet ++ibad) { uint32_t detid = ibad->first; if (badresults[detid].second == 0) { - // std::cout << " used pixel mean value"; + // edm::LogPrint("SiPixelGainCalibrationReadDQMFile") << " used pixel mean value"; nempty++; } else if (badresults[detid].second == 1) { - // std::cout << " used pixel mean value"; + // edm::LogPrint("SiPixelGainCalibrationReadDQMFile") << " used pixel mean value"; ndefault++; } else if (badresults[detid].second == 2) { - std::cout << badresults[detid].first; - std::cout << " has one or more dead pixels"; - std::cout << std::endl; + edm::LogPrint("SiPixelGainCalibrationReadDQMFile") << badresults[detid].first; + edm::LogPrint("SiPixelGainCalibrationReadDQMFile") << " has one or more dead pixels"; + edm::LogPrint("SiPixelGainCalibrationReadDQMFile") << std::endl; ndead++; } else if (badresults[detid].second == 3) { - // std::cout << " used column mean value"; + // edm::LogPrint("SiPixelGainCalibrationReadDQMFile") << " used column mean value"; ncoldefault++; } else if (badresults[detid].second == 4) { - std::cout << badresults[detid].first; - std::cout << " has one or more dead columns"; + edm::LogPrint("SiPixelGainCalibrationReadDQMFile") << badresults[detid].first; + edm::LogPrint("SiPixelGainCalibrationReadDQMFile") << " has one or more dead columns"; ncoldead++; - std::cout << std::endl; + edm::LogPrint("SiPixelGainCalibrationReadDQMFile") << std::endl; } } - std::cout << nempty << " modules were empty and now have pixels filled with default values." << std::endl; - std::cout << ndefault << " modules have pixels filled with default values." << std::endl; - std::cout << ndead << " modules have pixels flagged as dead." << std::endl; - std::cout << ncoldefault << " modules have columns filled with default values." << std::endl; - std::cout << ncoldead << " modules have columns filled with dead values." << std::endl; - std::cout << " ---> PIXEL Modules " << nmodules << "\n" - << " ---> PIXEL Channels " << nchannels << std::endl; - - std::cout << " --- writing to DB!" << std::endl; + edm::LogPrint("SiPixelGainCalibrationReadDQMFile") + << nempty << " modules were empty and now have pixels filled with default values." << std::endl; + edm::LogPrint("SiPixelGainCalibrationReadDQMFile") + << ndefault << " modules have pixels filled with default values." << std::endl; + edm::LogPrint("SiPixelGainCalibrationReadDQMFile") << ndead << " modules have pixels flagged as dead." << std::endl; + edm::LogPrint("SiPixelGainCalibrationReadDQMFile") + << ncoldefault << " modules have columns filled with default values." << std::endl; + edm::LogPrint("SiPixelGainCalibrationReadDQMFile") + << ncoldead << " modules have columns filled with dead values." << std::endl; + edm::LogPrint("SiPixelGainCalibrationReadDQMFile") << " ---> PIXEL Modules " << nmodules << "\n" + << " ---> PIXEL Channels " << nchannels << std::endl; + + edm::LogPrint("SiPixelGainCalibrationReadDQMFile") << " --- writing to DB!" << std::endl; edm::Service mydbservice; if (!mydbservice.isAvailable()) { edm::LogError("db service unavailable"); return; } else { if (record_ == "SiPixelGainCalibrationForHLTRcd") { - std::cout << "now doing SiPixelGainCalibrationForHLTRcd payload..." << std::endl; + edm::LogPrint("SiPixelGainCalibrationReadDQMFile") + << "now doing SiPixelGainCalibrationForHLTRcd payload..." << std::endl; if (mydbservice->isNewTagRequest(record_)) { - mydbservice->createNewIOV(theGainCalibrationDbInputHLT.release(), - mydbservice->beginOfTime(), - mydbservice->endOfTime(), - "SiPixelGainCalibrationForHLTRcd"); + mydbservice->createOneIOV( + *theGainCalibrationDbInputHLT, mydbservice->beginOfTime(), "SiPixelGainCalibrationForHLTRcd"); } else { - mydbservice->appendSinceTime( - theGainCalibrationDbInputHLT.release(), mydbservice->currentTime(), "SiPixelGainCalibrationForHLTRcd"); + mydbservice->appendOneIOV( + *theGainCalibrationDbInputHLT, mydbservice->currentTime(), "SiPixelGainCalibrationForHLTRcd"); } } else if (record_ == "SiPixelGainCalibrationOfflineRcd") { - std::cout << "now doing SiPixelGainCalibrationOfflineRcd payload..." << std::endl; + edm::LogPrint("SiPixelGainCalibrationReadDQMFile") + << "now doing SiPixelGainCalibrationOfflineRcd payload..." << std::endl; if (mydbservice->isNewTagRequest(record_)) { - mydbservice->createNewIOV(theGainCalibrationDbInputOffline.release(), - mydbservice->beginOfTime(), - mydbservice->endOfTime(), - "SiPixelGainCalibrationOfflineRcd"); + mydbservice->createOneIOV( + *theGainCalibrationDbInputOffline, mydbservice->beginOfTime(), "SiPixelGainCalibrationOfflineRcd"); } else { - mydbservice->appendSinceTime( - theGainCalibrationDbInputOffline.release(), mydbservice->currentTime(), "SiPixelGainCalibrationOfflineRcd"); + mydbservice->appendOneIOV( + *theGainCalibrationDbInputOffline, mydbservice->currentTime(), "SiPixelGainCalibrationOfflineRcd"); } } edm::LogInfo(" --- all OK"); @@ -554,7 +542,7 @@ void SiPixelGainCalibrationReadDQMFile::analyze(const edm::Event &iEvent, const } std::unique_ptr SiPixelGainCalibrationReadDQMFile::getHistograms() { - std::cout << "now parsing file " << rootfilestring_ << std::endl; + edm::LogPrint("SiPixelGainCalibrationReadDQMFile") << "now parsing file " << rootfilestring_ << std::endl; auto therootfile = std::make_unique(rootfilestring_.c_str()); therootfile->cd(); TDirectory *dir = therootfile->GetDirectory("DQMData"); @@ -577,18 +565,18 @@ std::unique_ptr SiPixelGainCalibrationReadDQMFile::getHistograms() { TString keytype = thekey->GetClassName(); // if(keyname=="EventInfo") // continue; - // std::cout << keytype << " " << keyname << std::endl; + // edm::LogPrint("SiPixelGainCalibrationReadDQMFile") << keytype << " " << keyname << std::endl; if (keytype == "TDirectoryFile") { TString dirname = dir->GetPath(); dirname += "/"; dirname += keyname; - // std::cout << dirname << std::endl; + // edm::LogPrint("SiPixelGainCalibrationReadDQMFile") << dirname << std::endl; dir = therootfile->GetDirectory(dirname); list = dir->GetListOfKeys(); if (dirname.Contains(comparestring)) { dirlist.push_back(dirname); - // std::cout << dirname << std::endl; + // edm::LogPrint("SiPixelGainCalibrationReadDQMFile") << dirname << std::endl; } else { notdonelist.push_back(dirname); nsubdirs.push_back(-1); @@ -600,11 +588,11 @@ std::unique_ptr SiPixelGainCalibrationReadDQMFile::getHistograms() { for (size_t idir = 0; idir < notdonelist.size(); ++idir) { if (nsubdirs[idir] == 0) continue; - // std::cout << "now examining " << notdonelist[idir]<< " " << nsubdirs[idir] << std::endl; + // edm::LogPrint("SiPixelGainCalibrationReadDQMFile") << "now examining " << notdonelist[idir]<< " " << nsubdirs[idir] << std::endl; dir = therootfile->GetDirectory(notdonelist[idir]); - // std::cout << dir->GetName() << std::endl; + // edm::LogPrint("SiPixelGainCalibrationReadDQMFile") << dir->GetName() << std::endl; list = dir->GetListOfKeys(); - // std::cout << list->GetEntries() << std::endl; + // edm::LogPrint("SiPixelGainCalibrationReadDQMFile") << list->GetEntries() << std::endl; int ndirectories = 0; for (ikey = 0; ikey < list->GetEntries(); ikey++) { TKey *thekey = (TKey *)list->At(ikey); @@ -612,15 +600,15 @@ std::unique_ptr SiPixelGainCalibrationReadDQMFile::getHistograms() { continue; TString keyname = thekey->GetName(); TString keytype = thekey->GetClassName(); - // std::cout << keyname << " " << keytype << std::endl; + // edm::LogPrint("SiPixelGainCalibrationReadDQMFile") << keyname << " " << keytype << std::endl; if (keytype == "TDirectoryFile") { TString dirname = dir->GetPath(); dirname += "/"; dirname += keyname; - // std::cout << dirname << std::endl; + // edm::LogPrint("SiPixelGainCalibrationReadDQMFile") << dirname << std::endl; ndirectories++; if (dirname.Contains(comparestring)) { - // std::cout << dirname << std::endl; + // edm::LogPrint("SiPixelGainCalibrationReadDQMFile") << dirname << std::endl; dirlist.push_back(dirname); } else { notdonelist.push_back(dirname); @@ -629,7 +617,7 @@ std::unique_ptr SiPixelGainCalibrationReadDQMFile::getHistograms() { } } nsubdirs[idir] = ndirectories; - // std::cout << "now done examining " << notdonelist[idir]<< " " << nsubdirs[idir] << std::endl; + // edm::LogPrint("SiPixelGainCalibrationReadDQMFile") << "now done examining " << notdonelist[idir]<< " " << nsubdirs[idir] << std::endl; } nempty = 0; for (size_t i = 0; i < nsubdirs.size(); i++) { @@ -637,10 +625,10 @@ std::unique_ptr SiPixelGainCalibrationReadDQMFile::getHistograms() { nempty++; } } - // std::cout << "\n done!" << std::endl; + // edm::LogPrint("SiPixelGainCalibrationReadDQMFile") << "\n done!" << std::endl; for (size_t idir = 0; idir < dirlist.size(); ++idir) { - // std::cout << "good dir " << dirlist[idir] << std::endl; + // edm::LogPrint("SiPixelGainCalibrationReadDQMFile") << "good dir " << dirlist[idir] << std::endl; uint32_t detid = 1; @@ -652,7 +640,7 @@ std::unique_ptr SiPixelGainCalibrationReadDQMFile::getHistograms() { continue; TString keyname = thekey->GetName(); TString keytype = thekey->GetClassName(); - // std::cout << keyname << " " << keytype << std::endl; + // edm::LogPrint("SiPixelGainCalibrationReadDQMFile") << keyname << " " << keytype << std::endl; if (keytype == "TH2F" && (keyname.Contains("Gain2d") || keyname.Contains("Pedestal2d") || keyname.Contains("GainChi2Prob2d") || keyname.Contains("GainFitResult2d"))) { TString detidstring = keyname; @@ -667,7 +655,7 @@ std::unique_ptr SiPixelGainCalibrationReadDQMFile::getHistograms() { TString replacestring = rootfilestring_; replacestring += ":"; tempstr.ReplaceAll(replacestring, ""); - // std::cout << tempstr << std::endl; + // edm::LogPrint("SiPixelGainCalibrationReadDQMFile") << tempstr << std::endl; bookkeeper_[detid]["chi2prob_2d"] = tempstr; } else if (keyname.Contains("GainFitResult2d")) { TString tempstr = dirlist[idir]; @@ -676,10 +664,10 @@ std::unique_ptr SiPixelGainCalibrationReadDQMFile::getHistograms() { TString replacestring = rootfilestring_; replacestring += ":"; tempstr.ReplaceAll(replacestring, ""); - // std::cout << tempstr << std::endl; + // edm::LogPrint("SiPixelGainCalibrationReadDQMFile") << tempstr << std::endl; bookkeeper_[detid]["fitresult_2d"] = tempstr; } else if (keyname.Contains("Gain2d")) { - // std::cout << dirlist[idir] << std::endl; + // edm::LogPrint("SiPixelGainCalibrationReadDQMFile") << dirlist[idir] << std::endl; std::map tempmap; TString tempstr = dirlist[idir]; tempstr += "/"; @@ -687,26 +675,26 @@ std::unique_ptr SiPixelGainCalibrationReadDQMFile::getHistograms() { TString replacestring = rootfilestring_; replacestring += ":"; tempstr.ReplaceAll(replacestring, ""); - // std::cout << tempstr << std::endl; + // edm::LogPrint("SiPixelGainCalibrationReadDQMFile") << tempstr << std::endl; bookkeeper_[detid]["gain_2d"] = tempstr; - //std::cout << detidstring << " " << keyname << " " << detid << " " << bookkeeper_[detid]["gain_2d"] << std::endl ; + //edm::LogPrint("SiPixelGainCalibrationReadDQMFile") << detidstring << " " << keyname << " " << detid << " " << bookkeeper_[detid]["gain_2d"] << std::endl ; } if (keyname.Contains("Pedestal2d")) { - // std::cout << dirlist[idir] << std::endl; + // edm::LogPrint("SiPixelGainCalibrationReadDQMFile") << dirlist[idir] << std::endl; std::map tempmap; TString tempstr = dirlist[idir]; tempstr += "/"; tempstr += keyname; - // std::cout << tempstr << std::endl; + // edm::LogPrint("SiPixelGainCalibrationReadDQMFile") << tempstr << std::endl; TString replacestring = rootfilestring_; replacestring += ":"; tempstr.ReplaceAll(replacestring, ""); bookkeeper_[detid]["ped_2d"] = tempstr; - //std::cout << detidstring << " " << keyname << " " << detid << " " << bookkeeper_[detid]["ped_2d"] << std::endl ; + //edm::LogPrint("SiPixelGainCalibrationReadDQMFile") << detidstring << " " << keyname << " " << detid << " " << bookkeeper_[detid]["ped_2d"] << std::endl ; } - // std::cout << keyname << " " << keytype << std::endl; + // edm::LogPrint("SiPixelGainCalibrationReadDQMFile") << keyname << " " << keytype << std::endl; } } @@ -749,3 +737,4 @@ std::unique_ptr SiPixelGainCalibrationReadDQMFile::getHistograms() { } //define this as a plug-in +DEFINE_FWK_MODULE(SiPixelGainCalibrationReadDQMFile); diff --git a/CondTools/SiPixel/test/SiPixelGainCalibrationReadDQMFile.h b/CondTools/SiPixel/plugins/SiPixelGainCalibrationReadDQMFile.h similarity index 100% rename from CondTools/SiPixel/test/SiPixelGainCalibrationReadDQMFile.h rename to CondTools/SiPixel/plugins/SiPixelGainCalibrationReadDQMFile.h diff --git a/CondTools/SiPixel/test/SiPixelGainCalibrationRejectNoisyAndDead.cc b/CondTools/SiPixel/plugins/SiPixelGainCalibrationRejectNoisyAndDead.cc similarity index 75% rename from CondTools/SiPixel/test/SiPixelGainCalibrationRejectNoisyAndDead.cc rename to CondTools/SiPixel/plugins/SiPixelGainCalibrationRejectNoisyAndDead.cc index 84dc098506f06..d0feb5259045a 100644 --- a/CondTools/SiPixel/test/SiPixelGainCalibrationRejectNoisyAndDead.cc +++ b/CondTools/SiPixel/plugins/SiPixelGainCalibrationRejectNoisyAndDead.cc @@ -41,11 +41,14 @@ using namespace std; void SiPixelGainCalibrationRejectNoisyAndDead::fillDatabase(const edm::EventSetup& iSetup) { if (DEBUG) - cout << "=>=>=>=> Starting the function fillDatabase()" << endl; + edm::LogPrint("SiPixelGainCalibrationRejectNoisyAndDead") + << "=>=>=>=> Starting the function fillDatabase()" << endl; if (record_ != "SiPixelGainCalibrationOfflineRcd" && record_ != "SiPixelGainCalibrationForHLTRcd") { - std::cout << record_ << " : this record can't be used !" << std::endl; - std::cout << "Please select SiPixelGainCalibrationForHLTRcd or SiPixelGainCalibrationOfflineRcd" << std::endl; + edm::LogPrint("SiPixelGainCalibrationRejectNoisyAndDead") + << record_ << " : this record can't be used !" << std::endl; + edm::LogPrint("SiPixelGainCalibrationRejectNoisyAndDead") + << "Please select SiPixelGainCalibrationForHLTRcd or SiPixelGainCalibrationOfflineRcd" << std::endl; return; } @@ -79,8 +82,9 @@ void SiPixelGainCalibrationRejectNoisyAndDead::fillDatabase(const edm::EventSetu if (pedhi_ > 300) pedhi_ = 300; - std::cout << "New payload will have pedlow,hi " << pedlow_ << "," << pedhi_ << " and gainlow,hi " << gainlow_ << "," - << gainhi_ << endl; + edm::LogPrint("SiPixelGainCalibrationRejectNoisyAndDead") + << "New payload will have pedlow,hi " << pedlow_ << "," << pedhi_ << " and gainlow,hi " << gainlow_ << "," + << gainhi_ << endl; if (record_ == "SiPixelGainCalibrationOfflineRcd") theGainCalibrationDbInputOffline_ = new SiPixelGainCalibrationOffline(pedlow_, pedhi_, gainlow_, gainhi_); if (record_ == "SiPixelGainCalibrationForHLTRcd") @@ -108,12 +112,13 @@ void SiPixelGainCalibrationRejectNoisyAndDead::fillDatabase(const edm::EventSetu } } if (!willNoisyPixBeInserted) - cout << "All Noisy Pixels in detid " << it->first - << "won't be inserted, check the TrackerGeometry you are using !! You are missing some modules" << endl; + edm::LogPrint("SiPixelGainCalibrationRejectNoisyAndDead") + << "All Noisy Pixels in detid " << it->first + << "won't be inserted, check the TrackerGeometry you are using !! You are missing some modules" << endl; } if (DEBUG) - cout << "=>=>=>=> Starting Loop over all modules" << endl; + edm::LogPrint("SiPixelGainCalibrationRejectNoisyAndDead") << "=>=>=>=> Starting Loop over all modules" << endl; //Looping over all modules for (TrackerGeometry::DetContainer::const_iterator it = pDD->dets().begin(); it != pDD->dets().end(); it++) { @@ -123,11 +128,11 @@ void SiPixelGainCalibrationRejectNoisyAndDead::fillDatabase(const edm::EventSetu if (detid == 0) continue; NDetid++; - //cout<=>=>=> We are in module " << detid << endl; + edm::LogPrint("SiPixelGainCalibrationRejectNoisyAndDead") << "=>=>=>=> We are in module " << detid << endl; // Get the module sizes const PixelGeomDetUnit* pixDet = dynamic_cast((*it)); @@ -149,11 +154,11 @@ void SiPixelGainCalibrationRejectNoisyAndDead::fillDatabase(const edm::EventSetu std::vector theSiPixelGainCalibrationPerCol; if (DEBUG) - cout << "=>=>=>=> Starting Loop for each rows/cols " << endl; + edm::LogPrint("SiPixelGainCalibrationRejectNoisyAndDead") << "=>=>=>=> Starting Loop for each rows/cols " << endl; for (int icol = 0; icol <= ncols - 1; icol++) { if (DEBUG) - cout << "=>=>=>=> Starting a new column" << endl; + edm::LogPrint("SiPixelGainCalibrationRejectNoisyAndDead") << "=>=>=>=> Starting a new column" << endl; nusedrows[0] = nusedrows[1] = 0; gainforthiscol[0] = gainforthiscol[1] = 0; @@ -161,7 +166,8 @@ void SiPixelGainCalibrationRejectNoisyAndDead::fillDatabase(const edm::EventSetu for (int jrow = 0; jrow <= nrows - 1; jrow++) { if (DEBUG) - cout << "=>=>=>=> We are in col,row " << icol << "," << jrow << endl; + edm::LogPrint("SiPixelGainCalibrationRejectNoisyAndDead") + << "=>=>=>=> We are in col,row " << icol << "," << jrow << endl; ped = 0; @@ -188,7 +194,7 @@ void SiPixelGainCalibrationRejectNoisyAndDead::fillDatabase(const edm::EventSetu bool isPixelNoisy = false; if (DEBUG) - cout << "=>=>=>=> Trying to get gain/ped " << endl; + edm::LogPrint("SiPixelGainCalibrationRejectNoisyAndDead") << "=>=>=>=> Trying to get gain/ped " << endl; try { if (record_ == "SiPixelGainCalibrationOfflineRcd") { @@ -213,14 +219,16 @@ void SiPixelGainCalibrationRejectNoisyAndDead::fillDatabase(const edm::EventSetu if (record_ == "SiPixelGainCalibrationOfflineRcd") ped = SiPixelGainCalibrationOfflineService_.getPedestal(detid, icol, jrow); } catch (const std::exception& er) { - cout << "Problem trying to catch gain/ped from DETID " << detid << " @ col,row " << icol << "," << jrow - << endl; + edm::LogPrint("SiPixelGainCalibrationRejectNoisyAndDead") + << "Problem trying to catch gain/ped from DETID " << detid << " @ col,row " << icol << "," << jrow + << endl; } - //std::cout<<"For DetId "<=>=>=> Found gain " << gainforthiscol[iglobalrow] << " and ped " << pedforthiscol[iglobalrow] - << endl; + edm::LogPrint("SiPixelGainCalibrationRejectNoisyAndDead") + << "=>=>=>=> Found gain " << gainforthiscol[iglobalrow] << " and ped " << pedforthiscol[iglobalrow] + << endl; //Check if pixel is in new noisy list for (std::map > >::const_iterator it = noisypixelkeeper.begin(); @@ -250,21 +258,24 @@ void SiPixelGainCalibrationRejectNoisyAndDead::fillDatabase(const edm::EventSetu } if (isPixelNoisy) - cout << "Inserting a noisy pixel in " << detid << " at col,row " << icol << "," << jrow << endl; + edm::LogPrint("SiPixelGainCalibrationRejectNoisyAndDead") + << "Inserting a noisy pixel in " << detid << " at col,row " << icol << "," << jrow << endl; if (isColumnNoisy) - cout << "Inserting a noisy column in " << detid << " at col,row " << icol << "," << jrow << endl; + edm::LogPrint("SiPixelGainCalibrationRejectNoisyAndDead") + << "Inserting a noisy column in " << detid << " at col,row " << icol << "," << jrow << endl; if (isPixelNoisy) nnoisy++; if (isPixelDead) ndead++; if (DEBUG) - cout << "=>=>=>=> Now Starting to fill the DB" << endl; + edm::LogPrint("SiPixelGainCalibrationRejectNoisyAndDead") << "=>=>=>=> Now Starting to fill the DB" << endl; //********** Fill the new DB !! if (DEBUG) - cout << "=>=>=>=> Filling Pixel Level Calibration" << endl; + edm::LogPrint("SiPixelGainCalibrationRejectNoisyAndDead") + << "=>=>=>=> Filling Pixel Level Calibration" << endl; //Set Pedestal if (record_ == "SiPixelGainCalibrationOfflineRcd") { @@ -279,7 +290,8 @@ void SiPixelGainCalibrationRejectNoisyAndDead::fillDatabase(const edm::EventSetu //Set Gain if ((jrow + 1) % nrowsrocsplit == 0) { if (DEBUG) - cout << "=>=>=>=> Filling Column Level Calibration" << endl; + edm::LogPrint("SiPixelGainCalibrationRejectNoisyAndDead") + << "=>=>=>=> Filling Column Level Calibration" << endl; if (isColumnDead) { if (record_ == "SiPixelGainCalibrationOfflineRcd") @@ -304,17 +316,19 @@ void SiPixelGainCalibrationRejectNoisyAndDead::fillDatabase(const edm::EventSetu } if (DEBUG) - cout << "=>=>=>=> This pixel is finished inserting" << endl; + edm::LogPrint("SiPixelGainCalibrationRejectNoisyAndDead") + << "=>=>=>=> This pixel is finished inserting" << endl; } //end of loop over rows if (DEBUG) - cout << "=>=>=>=> This column is finished inserting" << endl; + edm::LogPrint("SiPixelGainCalibrationRejectNoisyAndDead") + << "=>=>=>=> This column is finished inserting" << endl; } //end of loop over col if (DEBUG) - cout << "=>=>=>=> Loop over rows/cols is finished" << endl; + edm::LogPrint("SiPixelGainCalibrationRejectNoisyAndDead") << "=>=>=>=> Loop over rows/cols is finished" << endl; if (record_ == "SiPixelGainCalibrationOfflineRcd") { SiPixelGainCalibrationOffline::Range offlinerange(theSiPixelGainCalibrationGainPerColPedPerPixel.begin(), @@ -333,18 +347,19 @@ void SiPixelGainCalibrationRejectNoisyAndDead::fillDatabase(const edm::EventSetu } if (DEBUG) - cout << "=>=>=>=> This detid is finished inserting" << endl; + edm::LogPrint("SiPixelGainCalibrationRejectNoisyAndDead") << "=>=>=>=> This detid is finished inserting" << endl; } //end of loop over Detids - std::cout << " --- writing to DB!" << std::endl; + edm::LogPrint("SiPixelGainCalibrationRejectNoisyAndDead") << " --- writing to DB!" << std::endl; edm::Service mydbservice; if (!mydbservice.isAvailable()) { edm::LogError("db service unavailable"); return; } else { if (record_ == "SiPixelGainCalibrationOfflineRcd") { - std::cout << "now doing SiPixelGainCalibrationOfflineRcd payload..." << std::endl; + edm::LogPrint("SiPixelGainCalibrationRejectNoisyAndDead") + << "now doing SiPixelGainCalibrationOfflineRcd payload..." << std::endl; if (mydbservice->isNewTagRequest("SiPixelGainCalibrationOfflineRcd")) { mydbservice->createNewIOV(theGainCalibrationDbInputOffline_, mydbservice->beginOfTime(), @@ -356,7 +371,8 @@ void SiPixelGainCalibrationRejectNoisyAndDead::fillDatabase(const edm::EventSetu } } if (record_ == "SiPixelGainCalibrationForHLTRcd") { - std::cout << "now doing SiPixelGainCalibrationForHLTRcd payload..." << std::endl; + edm::LogPrint("SiPixelGainCalibrationRejectNoisyAndDead") + << "now doing SiPixelGainCalibrationForHLTRcd payload..." << std::endl; if (mydbservice->isNewTagRequest("SiPixelGainCalibrationForHLTRcd")) { mydbservice->createNewIOV(theGainCalibrationDbInputForHLT_, mydbservice->beginOfTime(), @@ -369,11 +385,12 @@ void SiPixelGainCalibrationRejectNoisyAndDead::fillDatabase(const edm::EventSetu } } - std::cout << " ---> SUMMARY :" << std::endl; - std::cout << " File had " << nnoisyininput << " noisy pixels" << std::endl; + edm::LogPrint("SiPixelGainCalibrationRejectNoisyAndDead") << " ---> SUMMARY :" << std::endl; + edm::LogPrint("SiPixelGainCalibrationRejectNoisyAndDead") + << " File had " << nnoisyininput << " noisy pixels" << std::endl; - std::cout << " DB has now " << nnoisy << " noisy pixels" << std::endl; - std::cout << " DB has now " << ndead << " dead pixels" << std::endl; + edm::LogPrint("SiPixelGainCalibrationRejectNoisyAndDead") << " DB has now " << nnoisy << " noisy pixels" << std::endl; + edm::LogPrint("SiPixelGainCalibrationRejectNoisyAndDead") << " DB has now " << ndead << " dead pixels" << std::endl; } void SiPixelGainCalibrationRejectNoisyAndDead::getNoisyPixels() { @@ -382,16 +399,16 @@ void SiPixelGainCalibrationRejectNoisyAndDead::getNoisyPixels() { ifstream in; struct stat Stat; if (stat(noisypixellist_.c_str(), &Stat)) { - std::cout << "No file named " << noisypixellist_ << std::endl; - std::cout << "If you don't want to insert noisy pixel flag, disable it using tag insertNoisyPixelsInDB " - << std::endl; + edm::LogPrint("SiPixelGainCalibrationRejectNoisyAndDead") << "No file named " << noisypixellist_ << std::endl; + edm::LogPrint("SiPixelGainCalibrationRejectNoisyAndDead") + << "If you don't want to insert noisy pixel flag, disable it using tag insertNoisyPixelsInDB " << std::endl; return; } in.open(noisypixellist_.c_str()); if (in.is_open()) { TString line; - cout << "opened" << endl; + edm::LogPrint("SiPixelGainCalibrationRejectNoisyAndDead") << "opened" << endl; char linetmp[201]; while (in.getline(linetmp, 200)) { line = linetmp; @@ -407,7 +424,8 @@ void SiPixelGainCalibrationRejectNoisyAndDead::getNoisyPixels() { TString row = line; row.Remove(line.First(" "), line.Sizeof()); - std::cout << "Found noisy pixel in DETID " << detidstring << " col,row " << col << "," << row << std::endl; + edm::LogPrint("SiPixelGainCalibrationRejectNoisyAndDead") + << "Found noisy pixel in DETID " << detidstring << " col,row " << col << "," << row << std::endl; nnoisyininput++; std::vector > tempvec; @@ -423,7 +441,7 @@ void SiPixelGainCalibrationRejectNoisyAndDead::getNoisyPixels() { /* for(std::map > >::const_iterator it=noisypixelkeeper.begin();it!=noisypixelkeeper.end();it++) for(int i=0;i<(it->second).size();i++) - std::cout<first<<" "<<(it->second.at(i)).first<<" "<<(it->second.at(i)).second<first<<" "<<(it->second.at(i)).first<<" "<<(it->second.at(i)).second< { public: explicit SiPixelGainCalibrationRejectNoisyAndDead(const edm::ParameterSet &); - ~SiPixelGainCalibrationRejectNoisyAndDead(); + ~SiPixelGainCalibrationRejectNoisyAndDead() override; private: edm::ParameterSet conf_; @@ -48,7 +48,7 @@ class SiPixelGainCalibrationRejectNoisyAndDead : public edm::EDAnalyzer { SiPixelGainCalibrationForHLTService SiPixelGainCalibrationForHLTService_; SiPixelGainCalibrationForHLT *theGainCalibrationDbInputForHLT_; - virtual void analyze(const edm::Event &, const edm::EventSetup &); + void analyze(const edm::Event &, const edm::EventSetup &) override; std::map > > noisypixelkeeper; std::map > > insertednoisypixel; diff --git a/CondTools/SiPixel/test/SiPixelGenErrorDBObjectReader.cc b/CondTools/SiPixel/plugins/SiPixelGenErrorDBObjectReader.cc similarity index 59% rename from CondTools/SiPixel/test/SiPixelGenErrorDBObjectReader.cc rename to CondTools/SiPixel/plugins/SiPixelGenErrorDBObjectReader.cc index 0873f02686fe8..a59af508f23f2 100644 --- a/CondTools/SiPixel/test/SiPixelGenErrorDBObjectReader.cc +++ b/CondTools/SiPixel/plugins/SiPixelGenErrorDBObjectReader.cc @@ -6,37 +6,68 @@ #include #include #include +#include #include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/EventSetup.h" #include "CondFormats/SiPixelTransient/interface/SiPixelGenError.h" -#include "CondTools/SiPixel/test/SiPixelGenErrorDBObjectReader.h" -using namespace std; +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" +#include "FWCore/Framework/interface/ESWatcher.h" + +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/MakerMacros.h" + +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" +#include "FWCore/Utilities/interface/ESGetToken.h" + +#include "CondFormats/SiPixelObjects/interface/SiPixelGenErrorDBObject.h" +#include "CondFormats/DataRecord/interface/SiPixelGenErrorDBObjectRcd.h" +#include "CalibTracker/Records/interface/SiPixelGenErrorDBObjectESProducerRcd.h" +#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" + +class SiPixelGenErrorDBObjectReader : public edm::one::EDAnalyzer<> { +public: + explicit SiPixelGenErrorDBObjectReader(const edm::ParameterSet&); + ~SiPixelGenErrorDBObjectReader() override; + +private: + void beginJob() override; + void analyze(const edm::Event&, const edm::EventSetup&) override; + void endJob() override; + + std::string theGenErrorCalibrationLocation; + bool theDetailedGenErrorDBErrorOutput; + bool theFullGenErrorDBOutput; + + edm::ESGetToken genErrToken_; +}; SiPixelGenErrorDBObjectReader::SiPixelGenErrorDBObjectReader(const edm::ParameterSet& iConfig) : theGenErrorCalibrationLocation(iConfig.getParameter("siPixelGenErrorCalibrationLocation")), theDetailedGenErrorDBErrorOutput(iConfig.getParameter("wantDetailedGenErrorDBErrorOutput")), - theFullGenErrorDBOutput(iConfig.getParameter("wantFullGenErrorDBOutput")) {} + theFullGenErrorDBOutput(iConfig.getParameter("wantFullGenErrorDBOutput")), + genErrToken_(esConsumes()) {} -SiPixelGenErrorDBObjectReader::~SiPixelGenErrorDBObjectReader() {} +SiPixelGenErrorDBObjectReader::~SiPixelGenErrorDBObjectReader() = default; void SiPixelGenErrorDBObjectReader::beginJob() {} -void SiPixelGenErrorDBObjectReader::analyze(const edm::Event& iEvent, const edm::EventSetup& setup) { - std::cout << "\nLoading ... " << std::endl; +void SiPixelGenErrorDBObjectReader::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { + edm::LogPrint("SiPixelGenErrorDBObjectReader") << "\nLoading ... " << std::endl; - edm::ESHandle generrorH; - setup.get().get(generrorH); - dbobject = *generrorH.product(); - const SiPixelGenErrorDBObject* db = generrorH.product(); + SiPixelGenErrorDBObject dbobject = *&iSetup.getData(genErrToken_); + const SiPixelGenErrorDBObject* db = &iSetup.getData(genErrToken_); // these seem to be the only variables I can get directly from the object class - cout << " DBObject version " << dbobject.version() << " index " << dbobject.index() << " max " << dbobject.maxIndex() - << " fail " << dbobject.fail() << " numOfTeml " << dbobject.numOfTempl() << endl; + edm::LogPrint("SiPixelGenErrorDBObjectReader") + << " DBObject version " << dbobject.version() << " index " << dbobject.index() << " max " << dbobject.maxIndex() + << " fail " << dbobject.fail() << " numOfTeml " << dbobject.numOfTempl() << std::endl; if (theFullGenErrorDBOutput) { - std::cout << "Map info" << std::endl; + edm::LogPrint("SiPixelGenErrorDBObjectReader") << "Map info" << std::endl; std::vector tempMapId; std::map templMap = dbobject.getGenErrorIDs(); for (std::map::const_iterator it = templMap.begin(); it != templMap.end(); ++it) { @@ -51,32 +82,32 @@ void SiPixelGenErrorDBObjectReader::analyze(const edm::Event& iEvent, const edm: } } - std::cout << "DetId: " << it->first << " GenErrorID: " << it->second << "\n"; + edm::LogPrint("SiPixelGenErrorDBObjectReader") << "DetId: " << it->first << " GenErrorID: " << it->second << "\n"; } - std::cout << "\nMap stores GenError Id(s): "; + edm::LogPrint("SiPixelGenErrorDBObjectReader") << "\nMap stores GenError Id(s): "; for (unsigned int vindex = 0; vindex < tempMapId.size(); ++vindex) - std::cout << tempMapId[vindex] << " "; - std::cout << std::endl; + edm::LogPrint("SiPixelGenErrorDBObjectReader") << tempMapId[vindex] << " "; + edm::LogPrint("SiPixelGenErrorDBObjectReader") << std::endl; } // if the dircetory is an empty string ignore file comparison if (theGenErrorCalibrationLocation.empty()) { - cout << " no file for camparison defined, comparison will be skipped " << endl; + edm::LogPrint("SiPixelGenErrorDBObjectReader") + << " no file for camparison defined, comparison will be skipped " << std::endl; } else { // do the file comparision - //if(compareWithFile) { bool error = false; - char c; int numOfTempl = dbobject.numOfTempl(); int index = 0; float tempnum = 0, diff = 0; float tol = 1.0E-23; bool givenErrorMsg = false; - std::cout << "\nChecking GenError DB object version " << dbobject.version() << " containing " << numOfTempl - << " calibration(s) at " << dbobject.sVector()[index + 22] << "T\n"; + edm::LogPrint("SiPixelGenErrorDBObjectReader") + << "\nChecking GenError DB object version " << dbobject.version() << " containing " << numOfTempl + << " calibration(s) at " << dbobject.sVector()[index + 22] << "T\n"; for (int i = 0; i < numOfTempl; ++i) { //Removes header in db object from diff @@ -84,26 +115,23 @@ void SiPixelGenErrorDBObjectReader::analyze(const edm::Event& iEvent, const edm: //Tell the person viewing the output what the GenError ID and version are -- note that version is only valid for >=13 // Does not work correctly for data - std::cout << "Calibration " << i + 1 << " of " << numOfTempl << ", with GenError ID " << dbobject.sVector()[index] - << "\tand Version " << dbobject.sVector()[index + 1] << "\t-------- " << endl; + edm::LogPrint("SiPixelGenErrorDBObjectReader") + << "Calibration " << i + 1 << " of " << numOfTempl << ", with GenError ID " << dbobject.sVector()[index] + << "\tand Version " << dbobject.sVector()[index + 1] << "\t-------- " << std::endl; //Opening the text-based GenError calibration std::ostringstream tout; tout << theGenErrorCalibrationLocation.c_str() << "generror_summary_zp" << std::setw(4) << std::setfill('0') << std::right << dbobject.sVector()[index] << ".out" << std::ends; - //edm::FileInPath file( tout.str()); - //tempfile = (file.fullPath()).c_str(); - string temp = tout.str(); + std::string temp = tout.str(); std::ifstream in_file(temp.c_str(), std::ios::in); - cout << " open file " << tout.str() << " " << in_file.is_open() << endl; + edm::LogPrint("SiPixelGenErrorDBObjectReader") + << " open file " << tout.str() << " " << in_file.is_open() << std::endl; if (in_file.is_open()) { //Removes header in textfile from diff - for (int header = 0; (c = in_file.get()) != '\n'; ++header) { - } - //First read in from the text file -- this will be compared with index = 20 in_file >> tempnum; @@ -116,14 +144,15 @@ void SiPixelGenErrorDBObjectReader::analyze(const edm::Event& iEvent, const edm: if (diff > tol) { //We have the if statement to output the message only once if (!givenErrorMsg) - std::cout << "does NOT match\n"; + edm::LogPrint("SiPixelGenErrorDBObjectReader") << "does NOT match\n"; //If there is an error we want to display a message upon completion error = true; givenErrorMsg = true; //Do we want more detailed output? if (theDetailedGenErrorDBErrorOutput) { - std::cout << "from file = " << tempnum << "\t from dbobject = " << dbobject.sVector()[index] - << "\tdiff = " << diff << "\t db index = " << index << std::endl; + edm::LogPrint("SiPixelGenErrorDBObjectReader") + << "from file = " << tempnum << "\t from dbobject = " << dbobject.sVector()[index] + << "\tdiff = " << diff << "\t db index = " << index << std::endl; } } //Go to the next entries @@ -132,9 +161,10 @@ void SiPixelGenErrorDBObjectReader::analyze(const edm::Event& iEvent, const edm: } //There were no errors, the two files match. if (!givenErrorMsg) - std::cout << "MATCHES\n"; + edm::LogPrint("SiPixelGenErrorDBObjectReader") << "MATCHES\n"; } else { //end current file - cout << " ERROR: cannot open file, comparison will be stopped" << endl; + edm::LogPrint("SiPixelGenErrorDBObjectReader") + << " ERROR: cannot open file, comparison will be stopped" << std::endl; break; } in_file.close(); @@ -143,27 +173,30 @@ void SiPixelGenErrorDBObjectReader::analyze(const edm::Event& iEvent, const edm: } //end loop over all files if (error && !theDetailedGenErrorDBErrorOutput) - cout << "\nThe were differences found between the files and the database.\n" - << "If you would like more detailed information please set\n" - << "wantDetailedOutput = True in the cfg file. If you would like a\n" - << "full output of the contents of the database file please set\n" - << "wantFullOutput = True. Make sure that you pipe the output to a\n" - << "log file. This could take a few minutes.\n\n"; + edm::LogPrint("SiPixelGenErrorDBObjectReader") + << "\nThe were differences found between the files and the database.\n" + << "If you would like more detailed information please set\n" + << "wantDetailedOutput = True in the cfg file. If you would like a\n" + << "full output of the contents of the database file please set\n" + << "wantFullOutput = True. Make sure that you pipe the output to a\n" + << "log file. This could take a few minutes.\n\n"; } // if compare // Try to interpret the object - vector thePixelGenError; - //const SiPixelGenErrorDBObject * ge = &dbobject; + std::vector thePixelGenError; bool status = SiPixelGenError::pushfile(*db, thePixelGenError); - cout << " status = " << status << " size = " << thePixelGenError.size() << endl; + edm::LogPrint("SiPixelGenErrorDBObjectReader") + << " status = " << status << " size = " << thePixelGenError.size() << std::endl; SiPixelGenError genError(thePixelGenError); // these are all 0 because qbin() was not run. - cout << " some values " << genError.lorxwidth() << " " << genError.lorywidth() << " " << endl; + edm::LogPrint("SiPixelGenErrorDBObjectReader") + << " some values " << genError.lorxwidth() << " " << genError.lorywidth() << " " << std::endl; // Print the full object, I think it does not work, the print is for templates. - //if(theFullGenErrorDBOutput) std::cout << dbobject << std::endl; + if (theFullGenErrorDBOutput) + edm::LogPrint("SiPixelGenErrorDBObjectReader") << dbobject << std::endl; } void SiPixelGenErrorDBObjectReader::endJob() {} @@ -183,31 +216,36 @@ std::ostream& operator<<(std::ostream& s, const SiPixelGenErrorDBObject& dbobjec //!-changes the size of the GenErrors based on the version int sizeSetter = 1, generrorVersion = 0; - std::cout << "\n\nDBobject version: " << dbobject.version() << std::endl; + edm::LogPrint("SiPixelGenErrorDBObjectReader") << "\n\nDBobject version: " << dbobject.version() << std::endl; for (m = 0; m < dbobject.numOfTempl(); ++m) { //To change the size of the output based on which GenError version we are using" generrorVersion = (int)dbobject.sVector_[index + 21]; - cout << " GenError version " << generrorVersion << " " << m << endl; + edm::LogPrint("SiPixelGenErrorDBObjectReader") << " GenError version " << generrorVersion << " " << m << std::endl; if (generrorVersion <= 10) { - std::cout << "*****WARNING***** This code will not format this GenError version properly *****WARNING*****\n"; + edm::LogPrint("SiPixelGenErrorDBObjectReader") + << "*****WARNING***** This code will not format this GenError version properly *****WARNING*****\n"; sizeSetter = 0; } else if (generrorVersion <= 16) sizeSetter = 1; else - std::cout << "*****WARNING***** This code has not been tested at formatting this version *****WARNING*****\n"; - - std::cout << "\n\n*********************************************************************************************" - << std::endl; - std::cout << "*************** Reading GenError ID " << dbobject.sVector_[index + 20] << "\t(" - << m + 1 << "/" << dbobject.numOfTempl_ << ") ***************" << std::endl; - std::cout << "*********************************************************************************************\n\n" - << std::endl; + edm::LogPrint("SiPixelGenErrorDBObjectReader") + << "*****WARNING***** This code has not been tested at formatting this version *****WARNING*****\n"; + + edm::LogPrint("SiPixelGenErrorDBObjectReader") + << "\n\n*********************************************************************************************" + << std::endl; + edm::LogPrint("SiPixelGenErrorDBObjectReader") + << "*************** Reading GenError ID " << dbobject.sVector_[index + 20] << "\t(" << m + 1 + << "/" << dbobject.numOfTempl_ << ") ***************" << std::endl; + edm::LogPrint("SiPixelGenErrorDBObjectReader") + << "*********************************************************************************************\n\n" + << std::endl; //Header Title - cout << " Header Title" << endl; + edm::LogPrint("SiPixelGenErrorDBObjectReader") << " Header Title" << std::endl; SiPixelGenErrorDBObject::char2float temp; for (n = 0; n < 20; ++n) { temp.f = dbobject.sVector_[index]; @@ -219,7 +257,7 @@ std::ostream& operator<<(std::ostream& s, const SiPixelGenErrorDBObject& dbobjec entries[1] = (int)(dbobject.sVector_[index + 4] * dbobject.sVector_[index + 5]); // X //Header - cout << " Header " << endl; + edm::LogPrint("SiPixelGenErrorDBObjectReader") << " Header " << std::endl; s << dbobject.sVector_[index] << "\t" << dbobject.sVector_[index + 1] << "\t" << dbobject.sVector_[index + 2] << "\t" << dbobject.sVector_[index + 3] << "\t" << dbobject.sVector_[index + 4] << "\t" << dbobject.sVector_[index + 5] << "\t" << dbobject.sVector_[index + 6] << "\t" << dbobject.sVector_[index + 7] @@ -230,7 +268,7 @@ std::ostream& operator<<(std::ostream& s, const SiPixelGenErrorDBObject& dbobjec index += 17; //Loop over By,Bx,Fy,Fx - cout << " ByBxFyFx" << endl; + edm::LogPrint("SiPixelGenErrorDBObjectReader") << " ByBxFyFx" << std::endl; for (entry_it = 0; entry_it < 4; ++entry_it) { //Run,costrk,qavg,...,clslenx for (i = 0; i < entries[entry_it]; ++i) { @@ -246,7 +284,7 @@ std::ostream& operator<<(std::ostream& s, const SiPixelGenErrorDBObject& dbobjec << dbobject.sVector_[index + 18] << std::endl; index += 19; //YPar - cout << " YPar" << endl; + edm::LogPrint("SiPixelGenErrorDBObjectReader") << " YPar" << std::endl; for (j = 0; j < 2; ++j) { for (k = 0; k < 5; ++k) { s << dbobject.sVector_[index] << "\t"; @@ -255,7 +293,7 @@ std::ostream& operator<<(std::ostream& s, const SiPixelGenErrorDBObject& dbobjec s << std::endl; } //YTemp - cout << " YTemp" << endl; + edm::LogPrint("SiPixelGenErrorDBObjectReader") << " YTemp" << std::endl; for (j = 0; j < 9; ++j) { for (k = 0; k < tysize[sizeSetter]; ++k) { s << dbobject.sVector_[index] << "\t"; @@ -264,7 +302,7 @@ std::ostream& operator<<(std::ostream& s, const SiPixelGenErrorDBObject& dbobjec s << std::endl; } //XPar - cout << " XPar" << endl; + edm::LogPrint("SiPixelGenErrorDBObjectReader") << " XPar" << std::endl; for (j = 0; j < 2; ++j) { for (k = 0; k < 5; ++k) { s << dbobject.sVector_[index] << "\t"; @@ -273,7 +311,7 @@ std::ostream& operator<<(std::ostream& s, const SiPixelGenErrorDBObject& dbobjec s << std::endl; } //XTemp - cout << " Xtemp" << endl; + edm::LogPrint("SiPixelGenErrorDBObjectReader") << " Xtemp" << std::endl; for (j = 0; j < 9; ++j) { for (k = 0; k < txsize[sizeSetter]; ++k) { s << dbobject.sVector_[index] << "\t"; @@ -282,7 +320,7 @@ std::ostream& operator<<(std::ostream& s, const SiPixelGenErrorDBObject& dbobjec s << std::endl; } //Y average reco params - cout << " Y average reco params " << endl; + edm::LogPrint("SiPixelGenErrorDBObjectReader") << " Y average reco params " << std::endl; for (j = 0; j < 4; ++j) { for (k = 0; k < 4; ++k) { s << dbobject.sVector_[index] << "\t"; @@ -291,7 +329,7 @@ std::ostream& operator<<(std::ostream& s, const SiPixelGenErrorDBObject& dbobjec s << std::endl; } //Yflpar - cout << " Yflar " << endl; + edm::LogPrint("SiPixelGenErrorDBObjectReader") << " Yflar " << std::endl; for (j = 0; j < 4; ++j) { for (k = 0; k < 6; ++k) { s << dbobject.sVector_[index] << "\t"; @@ -300,7 +338,7 @@ std::ostream& operator<<(std::ostream& s, const SiPixelGenErrorDBObject& dbobjec s << std::endl; } //X average reco params - cout << " X average reco params" << endl; + edm::LogPrint("SiPixelGenErrorDBObjectReader") << " X average reco params" << std::endl; for (j = 0; j < 4; ++j) { for (k = 0; k < 4; ++k) { s << dbobject.sVector_[index] << "\t"; @@ -309,7 +347,7 @@ std::ostream& operator<<(std::ostream& s, const SiPixelGenErrorDBObject& dbobjec s << std::endl; } //Xflpar - cout << " Xflar" << endl; + edm::LogPrint("SiPixelGenErrorDBObjectReader") << " Xflar" << std::endl; for (j = 0; j < 4; ++j) { for (k = 0; k < 6; ++k) { s << dbobject.sVector_[index] << "\t"; @@ -318,7 +356,7 @@ std::ostream& operator<<(std::ostream& s, const SiPixelGenErrorDBObject& dbobjec s << std::endl; } //Chi2X,Y - cout << " XY chi2" << endl; + edm::LogPrint("SiPixelGenErrorDBObjectReader") << " XY chi2" << std::endl; for (j = 0; j < 4; ++j) { for (k = 0; k < 2; ++k) { for (l = 0; l < 2; ++l) { @@ -329,7 +367,7 @@ std::ostream& operator<<(std::ostream& s, const SiPixelGenErrorDBObject& dbobjec s << std::endl; } //Y average Chi2 params - cout << " Y chi2" << endl; + edm::LogPrint("SiPixelGenErrorDBObjectReader") << " Y chi2" << std::endl; for (j = 0; j < 4; ++j) { for (k = 0; k < 4; ++k) { s << dbobject.sVector_[index] << "\t"; @@ -338,7 +376,7 @@ std::ostream& operator<<(std::ostream& s, const SiPixelGenErrorDBObject& dbobjec s << std::endl; } //X average Chi2 params - cout << " X chi2" << endl; + edm::LogPrint("SiPixelGenErrorDBObjectReader") << " X chi2" << std::endl; for (j = 0; j < 4; ++j) { for (k = 0; k < 4; ++k) { s << dbobject.sVector_[index] << "\t"; @@ -347,7 +385,7 @@ std::ostream& operator<<(std::ostream& s, const SiPixelGenErrorDBObject& dbobjec s << std::endl; } //Y average reco params for CPE Generic - cout << " Y reco params for generic" << endl; + edm::LogPrint("SiPixelGenErrorDBObjectReader") << " Y reco params for generic" << std::endl; for (j = 0; j < 4; ++j) { for (k = 0; k < 4; ++k) { s << dbobject.sVector_[index] << "\t"; @@ -356,7 +394,7 @@ std::ostream& operator<<(std::ostream& s, const SiPixelGenErrorDBObject& dbobjec s << std::endl; } //X average reco params for CPE Generic - cout << " X reco params for generic" << endl; + edm::LogPrint("SiPixelGenErrorDBObjectReader") << " X reco params for generic" << std::endl; for (j = 0; j < 4; ++j) { for (k = 0; k < 4; ++k) { s << dbobject.sVector_[index] << "\t"; @@ -365,7 +403,7 @@ std::ostream& operator<<(std::ostream& s, const SiPixelGenErrorDBObject& dbobjec s << std::endl; } //SpareX,Y - cout << " Spare " << endl; + edm::LogPrint("SiPixelGenErrorDBObjectReader") << " Spare " << std::endl; for (j = 0; j < 20; ++j) { s << dbobject.sVector_[index] << "\t"; ++index; @@ -377,3 +415,5 @@ std::ostream& operator<<(std::ostream& s, const SiPixelGenErrorDBObject& dbobjec } return s; } + +DEFINE_FWK_MODULE(SiPixelGenErrorDBObjectReader); diff --git a/CondTools/SiPixel/test/SiPixelGenErrorDBObjectUploader.cc b/CondTools/SiPixel/plugins/SiPixelGenErrorDBObjectUploader.cc similarity index 72% rename from CondTools/SiPixel/test/SiPixelGenErrorDBObjectUploader.cc rename to CondTools/SiPixel/plugins/SiPixelGenErrorDBObjectUploader.cc index 794f29ced38f9..94b99b05a0f54 100644 --- a/CondTools/SiPixel/test/SiPixelGenErrorDBObjectUploader.cc +++ b/CondTools/SiPixel/plugins/SiPixelGenErrorDBObjectUploader.cc @@ -1,5 +1,10 @@ -#include "CondTools/SiPixel/test/SiPixelGenErrorDBObjectUploader.h" +#include +#include +#include +#include + #include "CondFormats/DataRecord/interface/SiPixelGenErrorDBObjectRcd.h" +#include "CondFormats/SiPixelObjects/interface/SiPixelGenErrorDBObject.h" #include "CondCore/DBOutputService/interface/PoolDBOutputService.h" #include "FWCore/ServiceRegistry/interface/Service.h" @@ -14,9 +19,42 @@ #include "DataFormats/TrackerCommon/interface/PixelBarrelName.h" #include "DataFormats/TrackerCommon/interface/PixelEndcapName.h" -#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/MakerMacros.h" +#include "FWCore/Framework/interface/ESHandle.h" + +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" +#include "FWCore/Utilities/interface/ESGetToken.h" + +class SiPixelGenErrorDBObjectUploader : public edm::one::EDAnalyzer<> { +public: + explicit SiPixelGenErrorDBObjectUploader(const edm::ParameterSet&); + ~SiPixelGenErrorDBObjectUploader() override; + + typedef std::vector vstring; + +private: + void beginJob() override; + void analyze(const edm::Event&, const edm::EventSetup&) override; + void endJob() override; + + vstring theGenErrorCalibrations; + std::string theGenErrorBaseString; + float theVersion; + float theMagField; + std::vector theDetIds; + vstring theBarrelLocations; + vstring theEndcapLocations; + std::vector theBarrelGenErrIds; + std::vector theEndcapGenErrIds; + bool useVectorIndices; + edm::ESGetToken trackerGeometryToken_; + edm::ESGetToken trackerTopologyToken_; +}; SiPixelGenErrorDBObjectUploader::SiPixelGenErrorDBObjectUploader(const edm::ParameterSet& iConfig) : theGenErrorCalibrations(iConfig.getParameter("siPixelGenErrorCalibrations")), @@ -27,13 +65,15 @@ SiPixelGenErrorDBObjectUploader::SiPixelGenErrorDBObjectUploader(const edm::Para theEndcapLocations(iConfig.getParameter >("endcapLocations")), theBarrelGenErrIds(iConfig.getParameter >("barrelGenErrIds")), theEndcapGenErrIds(iConfig.getParameter >("endcapGenErrIds")), - useVectorIndices(iConfig.getUntrackedParameter("useVectorIndices", false)) {} + useVectorIndices(iConfig.getUntrackedParameter("useVectorIndices", false)), + trackerGeometryToken_(esConsumes()), + trackerTopologyToken_(esConsumes()) {} -SiPixelGenErrorDBObjectUploader::~SiPixelGenErrorDBObjectUploader() {} +SiPixelGenErrorDBObjectUploader::~SiPixelGenErrorDBObjectUploader() = default; void SiPixelGenErrorDBObjectUploader::beginJob() {} -void SiPixelGenErrorDBObjectUploader::analyze(const edm::Event& iEvent, const edm::EventSetup& es) { +void SiPixelGenErrorDBObjectUploader::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { //--- Make the POOL-ORA object to store the database object SiPixelGenErrorDBObject* obj = new SiPixelGenErrorDBObject; @@ -86,9 +126,10 @@ void SiPixelGenErrorDBObjectUploader::analyze(const edm::Event& iEvent, const ed if ((title_char[k] == '@') && (title_char[k - 1] == 'T')) { double localMagField = (((int)title_char[k - 4]) - 48) * 10 + ((int)title_char[k - 2]) - 48; if (theMagField != localMagField) { - std::cout << "\n -------- WARNING -------- \n Magnetic field in the cfg is " << theMagField - << "T while it is " << title_char[k - 4] << title_char[k - 2] << title_char[k - 1] - << " in the header \n ------------------------- \n " << std::endl; + edm::LogPrint("SiPixelGenErrorDBObjectUploader") + << "\n -------- WARNING -------- \n Magnetic field in the cfg is " << theMagField << "T while it is " + << title_char[k - 4] << title_char[k - 2] << title_char[k - 1] + << " in the header \n ------------------------- \n " << std::endl; } } } @@ -108,15 +149,12 @@ void SiPixelGenErrorDBObjectUploader::analyze(const edm::Event& iEvent, const ed } } - //Get the event setup - edm::ESHandle pDD; - es.get().get(pDD); - const TrackerGeometry* tGeo = pDD.product(); + //get TrackerGeometry from the event setup + const edm::ESHandle pDD = iSetup.getHandle(trackerGeometryToken_); + const TrackerGeometry* tGeo = &iSetup.getData(trackerGeometryToken_); // Use the TrackerTopology class for layer/disk etc. number - edm::ESHandle tTopoHandle; - es.get().get(tTopoHandle); - const TrackerTopology* tTopo = tTopoHandle.product(); + const TrackerTopology* tTopo = &iSetup.getData(trackerTopologyToken_); // Check if we are using Phase-1 or Phase-2 geometry int phase = 0; @@ -125,7 +163,7 @@ void SiPixelGenErrorDBObjectUploader::analyze(const edm::Event& iEvent, const ed } else if (pDD->isThere(GeomDetEnumerators::P2PXB) && pDD->isThere(GeomDetEnumerators::P2PXEC) == true) { phase = 2; } - std::cout << "Phase-" << phase << " geometry is used" << std::endl; + edm::LogPrint("SiPixelGenErrorDBObjectUploader") << "Phase-" << phase << " geometry is used" << std::endl; //Loop over the detector elements and put the GenError IDs in place for (const auto& it : pDD->detUnits()) { @@ -142,21 +180,11 @@ void SiPixelGenErrorDBObjectUploader::analyze(const edm::Event& iEvent, const ed //Barrel Pixels first if ((phase == 1 && detid.subdetId() == static_cast(PixelSubdetector::PixelBarrel)) || (phase == 2 && tGeo->geomDetSubDetector(detid.subdetId()) == GeomDetEnumerators::P2PXB)) { - std::cout << "--- IN THE BARREL ---\n"; - //Get the layer, ladder, and module corresponding to this DetID layer = tTopo->pxbLayer(detid.rawId()); ladder = tTopo->pxbLadder(detid.rawId()); module = tTopo->pxbModule(detid.rawId()); - /* - // Comment these in if needed - PixelBarrelName pbn(detid, tTopo, phase); - shl = pbn.shell(); - sec = pbn.sectorName(); - half = pbn.isHalfModule(); - // This tells if we are on a flipped ladder (in the inner radius, closer to beam) - flipped = (phase ? layer==4 : layer%2) ? ladder%2==0 : ladder%2==1; - */ + if (useVectorIndices) { --layer; --ladder; @@ -169,8 +197,8 @@ void SiPixelGenErrorDBObjectUploader::analyze(const edm::Event& iEvent, const ed //get the string of this barrel location std::string loc_string = theBarrelLocations[iter]; //find where the delimiters are - unsigned int first_delim_pos = loc_string.find("_"); - unsigned int second_delim_pos = loc_string.find("_", first_delim_pos + 1); + unsigned int first_delim_pos = loc_string.find('_'); + unsigned int second_delim_pos = loc_string.find('_', first_delim_pos + 1); //get the layer, ladder, and module as unsigned ints unsigned int checklayer = (unsigned int)stoi(loc_string.substr(0, first_delim_pos)); unsigned int checkladder = @@ -183,28 +211,20 @@ void SiPixelGenErrorDBObjectUploader::analyze(const edm::Event& iEvent, const ed } if (thisID == 10000 || (!(*obj).putGenErrorID(detid.rawId(), thisID))) - std::cout << " Could not fill barrel layer " << layer << ", module " << module << "\n"; - // ----- debug: - std::cout << "This is a barrel element with: layer " << layer << ", ladder " << ladder << " and module " - << module << ".\n"; //Uncomment to read out exact position of each element. - // ----- + edm::LogPrint("SiPixelGenErrorDBObjectUploader") + << " Could not fill barrel layer " << layer << ", module " << module << "\n"; + edm::LogPrint("SiPixelGenErrorDBObjectUploader") + << "This is a barrel element with: layer " << layer << ", ladder " << ladder << " and module " << module; } //Now endcaps else if ((phase == 1 && detid.subdetId() == static_cast(PixelSubdetector::PixelEndcap)) || (phase == 2 && tGeo->geomDetSubDetector(detid.subdetId()) == GeomDetEnumerators::P2PXEC)) { - std::cout << "--- IN AN ENDCAP ---\n"; - //Get the DetID's disk, blade, side, panel, and module disk = tTopo->pxfDisk(detid.rawId()); //1,2,3 blade = tTopo->pxfBlade(detid.rawId()); //1-56 (Ring 1 is 1-22, Ring 2 is 23-56) side = tTopo->pxfSide(detid.rawId()); //side=1 for -z, 2 for +z panel = tTopo->pxfPanel(detid.rawId()); //panel=1,2 - /* - // Comment these in if needed - PixelEndcapName pen(detid, tTopo, phase); - shl = pen.halfCylinder(); - ring = pen.ringName(); //1,2 This is for Phase I - */ + if (useVectorIndices) { --disk; --blade; @@ -218,9 +238,9 @@ void SiPixelGenErrorDBObjectUploader::analyze(const edm::Event& iEvent, const ed //get the string of this barrel location std::string loc_string = theEndcapLocations[iter]; //find where the delimiters are - unsigned int first_delim_pos = loc_string.find("_"); - unsigned int second_delim_pos = loc_string.find("_", first_delim_pos + 1); - unsigned int third_delim_pos = loc_string.find("_", second_delim_pos + 1); + unsigned int first_delim_pos = loc_string.find('_'); + unsigned int second_delim_pos = loc_string.find('_', first_delim_pos + 1); + unsigned int third_delim_pos = loc_string.find('_', second_delim_pos + 1); //get the disk, blade, side, panel, and module as unsigned ints unsigned int checkdisk = (unsigned int)stoi(loc_string.substr(0, first_delim_pos)); unsigned int checkblade = @@ -235,21 +255,20 @@ void SiPixelGenErrorDBObjectUploader::analyze(const edm::Event& iEvent, const ed } if (thisID == 10000 || (!(*obj).putGenErrorID(detid.rawId(), thisID))) - std::cout << " Could not fill endcap det unit" << side << ", disk " << disk << ", blade " << blade - << ", panel " << panel << ".\n"; - // ----- debug: - std::cout << "This is an endcap element with: side " << side << ", disk " << disk << ", blade " << blade - << ", panel " << panel << ".\n"; //Uncomment to read out exact position of each element. - // ----- + edm::LogPrint("SiPixelGenErrorDBObjectUploader") + << " Could not fill endcap det unit" << side << ", disk " << disk << ", blade " << blade << ", panel " + << panel << ".\n"; + edm::LogPrint("SiPixelGenErrorDBObjectUploader") << "This is an endcap element with: side " << side << ", disk " + << disk << ", blade " << blade << ", panel " << panel; } else { continue; } //Print out the assignment of this DetID short mapnum; - std::cout << "checking map:\n"; mapnum = (*obj).getGenErrorID(detid.rawId()); - std::cout << "The DetID: " << detid.rawId() << " is mapped to the template: " << mapnum << ".\n\n"; + edm::LogPrint("SiPixelGenErrorDBObjectUploader") + << "The DetID: " << detid.rawId() << " is mapped to the template: " << mapnum << "\n"; } } @@ -264,3 +283,5 @@ void SiPixelGenErrorDBObjectUploader::analyze(const edm::Event& iEvent, const ed } void SiPixelGenErrorDBObjectUploader::endJob() {} + +DEFINE_FWK_MODULE(SiPixelGenErrorDBObjectUploader); diff --git a/CondTools/SiPixel/test/SiPixelLorentzAngleDB.cc b/CondTools/SiPixel/plugins/SiPixelLorentzAngleDB.cc similarity index 77% rename from CondTools/SiPixel/test/SiPixelLorentzAngleDB.cc rename to CondTools/SiPixel/plugins/SiPixelLorentzAngleDB.cc index 3eef8c6a01aea..db92cb1443540 100644 --- a/CondTools/SiPixel/test/SiPixelLorentzAngleDB.cc +++ b/CondTools/SiPixel/plugins/SiPixelLorentzAngleDB.cc @@ -2,18 +2,11 @@ #include #include #include +#include "SiPixelLorentzAngleDB.h" #include "CondCore/DBOutputService/interface/PoolDBOutputService.h" -#include "CondTools/SiPixel/test/SiPixelLorentzAngleDB.h" #include "Geometry/CommonDetUnit/interface/PixelGeomDetUnit.h" #include "CondFormats/SiPixelObjects/interface/SiPixelLorentzAngle.h" -#include "FWCore/Framework/interface/ESHandle.h" - -#include "DataFormats/TrackerCommon/interface/TrackerTopology.h" -#include "Geometry/Records/interface/TrackerTopologyRcd.h" - -#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" #include "FWCore/ServiceRegistry/interface/Service.h" - #include "DataFormats/GeometryCommonDetAlgo/interface/MeasurementPoint.h" #include "DataFormats/GeometryCommonDetAlgo/interface/MeasurementError.h" #include "DataFormats/GeometrySurface/interface/GloballyPositioned.h" @@ -24,7 +17,8 @@ using namespace edm; //Constructor -SiPixelLorentzAngleDB::SiPixelLorentzAngleDB(edm::ParameterSet const& conf) : conf_(conf) { +SiPixelLorentzAngleDB::SiPixelLorentzAngleDB(edm::ParameterSet const& conf) + : tkGeomToken_(esConsumes()), tkTopoToken_(esConsumes()), conf_(conf) { magneticField_ = conf_.getParameter("magneticField"); recordName_ = conf_.getUntrackedParameter("record", "SiPixelLorentzAngleRcd"); useFile_ = conf_.getParameter("useFile"); @@ -35,13 +29,8 @@ SiPixelLorentzAngleDB::SiPixelLorentzAngleDB(edm::ParameterSet const& conf) : co ModuleParameters_ = conf_.getUntrackedParameter("ModuleParameters"); } -//BeginJob - -void SiPixelLorentzAngleDB::beginJob() {} - // Virtual destructor needed. - -SiPixelLorentzAngleDB::~SiPixelLorentzAngleDB() {} +SiPixelLorentzAngleDB::~SiPixelLorentzAngleDB() = default; // Analyzer: Functions that gets called by framework every event @@ -49,13 +38,10 @@ void SiPixelLorentzAngleDB::analyze(const edm::Event& e, const edm::EventSetup& SiPixelLorentzAngle* LorentzAngle = new SiPixelLorentzAngle(); //Retrieve tracker topology from geometry - edm::ESHandle tTopoHandle; - es.get().get(tTopoHandle); - const TrackerTopology* const tTopo = tTopoHandle.product(); + const TrackerTopology* tTopo = &es.getData(tkTopoToken_); //Retrieve old style tracker geometry from geometry - edm::ESHandle pDD; - es.get().get(pDD); + const TrackerGeometry* pDD = &es.getData(tkGeomToken_); edm::LogInfo("SiPixelLorentzAngle (old)") << " There are " << pDD->detUnits().size() << " detectors (old)" << std::endl; @@ -66,9 +52,10 @@ void SiPixelLorentzAngleDB::analyze(const edm::Event& e, const edm::EventSetup& // fill bpix values for LA if (detid.subdetId() == static_cast(PixelSubdetector::PixelBarrel)) { - cout << " pixel barrel:" - << " layer=" << tTopo->pxbLayer(detidc.rawId()) << " ladder=" << tTopo->pxbLadder(detidc.rawId()) - << " module=" << tTopo->pxbModule(detidc.rawId()) << " rawId=" << detidc.rawId() << endl; + edm::LogPrint("SiPixelLorentzAngleDB") + << " pixel barrel:" + << " layer=" << tTopo->pxbLayer(detidc.rawId()) << " ladder=" << tTopo->pxbLadder(detidc.rawId()) + << " module=" << tTopo->pxbModule(detidc.rawId()) << " rawId=" << detidc.rawId() << endl; if (!useFile_) { //first individuals are put @@ -76,7 +63,8 @@ void SiPixelLorentzAngleDB::analyze(const edm::Event& e, const edm::EventSetup& if (it->getParameter("rawid") == detidc.rawId()) { float lorentzangle = (float)it->getParameter("angle"); LorentzAngle->putLorentzAngle(detid.rawId(), lorentzangle); - cout << " individual value=" << lorentzangle << " put into rawid=" << detid.rawId() << endl; + edm::LogPrint("SiPixelLorentzAngleDB") + << " individual value=" << lorentzangle << " put into rawid=" << detid.rawId() << endl; } } @@ -96,17 +84,19 @@ void SiPixelLorentzAngleDB::analyze(const edm::Event& e, const edm::EventSetup& // fill fpix values for LA } else if (detid.subdetId() == static_cast(PixelSubdetector::PixelEndcap)) { - cout << " pixel endcap:" - << " side=" << tTopo->pxfSide(detidc.rawId()) << " disk=" << tTopo->pxfDisk(detidc.rawId()) - << " blade=" << tTopo->pxfBlade(detidc.rawId()) << " panel=" << tTopo->pxfPanel(detidc.rawId()) - << " module=" << tTopo->pxfModule(detidc.rawId()) << " rawId=" << detidc.rawId() << endl; + edm::LogPrint("SiPixelLorentzAngleDB") + << " pixel endcap:" + << " side=" << tTopo->pxfSide(detidc.rawId()) << " disk=" << tTopo->pxfDisk(detidc.rawId()) + << " blade=" << tTopo->pxfBlade(detidc.rawId()) << " panel=" << tTopo->pxfPanel(detidc.rawId()) + << " module=" << tTopo->pxfModule(detidc.rawId()) << " rawId=" << detidc.rawId() << endl; //first individuals are put for (Parameters::iterator it = ModuleParameters_.begin(); it != ModuleParameters_.end(); ++it) { if (it->getParameter("rawid") == detidc.rawId()) { float lorentzangle = (float)it->getParameter("angle"); LorentzAngle->putLorentzAngle(detid.rawId(), lorentzangle); - cout << " individual value=" << lorentzangle << " put into rawid=" << detid.rawId() << endl; + edm::LogPrint("SiPixelLorentzAngleDB") + << " individual value=" << lorentzangle << " put into rawid=" << detid.rawId() << endl; } } @@ -159,10 +149,9 @@ unsigned int SiPixelLorentzAngleDB::HVgroup(unsigned int panel, unsigned int mod } else if (2 == panel && (2 == module || 3 == module)) { return 2; } else { - cout << " *** error *** in SiPixelLorentzAngleDB::HVgroup(...), panel = " << panel << ", module = " << module - << endl; + edm::LogPrint("SiPixelLorentzAngleDB") << " *** error *** in SiPixelLorentzAngleDB::HVgroup(...), panel = " << panel + << ", module = " << module << endl; return 0; } } - -void SiPixelLorentzAngleDB::endJob() {} +DEFINE_FWK_MODULE(SiPixelLorentzAngleDB); diff --git a/CondTools/SiPixel/test/SiPixelLorentzAngleDB.h b/CondTools/SiPixel/plugins/SiPixelLorentzAngleDB.h similarity index 64% rename from CondTools/SiPixel/test/SiPixelLorentzAngleDB.h rename to CondTools/SiPixel/plugins/SiPixelLorentzAngleDB.h index bc7afa25dfc38..53d35135353a3 100644 --- a/CondTools/SiPixel/test/SiPixelLorentzAngleDB.h +++ b/CondTools/SiPixel/plugins/SiPixelLorentzAngleDB.h @@ -3,12 +3,16 @@ #include -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "FWCore/Framework/interface/Event.h" -#include "DataFormats/Common/interface/Handle.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "DataFormats/TrackerCommon/interface/TrackerTopology.h" +#include "Geometry/Records/interface/TrackerTopologyRcd.h" + +#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" @@ -18,19 +22,16 @@ #include "MagneticField/Engine/interface/MagneticField.h" #include "MagneticField/Records/interface/IdealMagneticFieldRecord.h" -class SiPixelLorentzAngleDB : public edm::EDAnalyzer { +class SiPixelLorentzAngleDB : public edm::one::EDAnalyzer<> { public: explicit SiPixelLorentzAngleDB(const edm::ParameterSet& conf); - - virtual ~SiPixelLorentzAngleDB(); - - virtual void beginJob(); - - virtual void endJob(); - - virtual void analyze(const edm::Event& e, const edm::EventSetup& c); + ~SiPixelLorentzAngleDB() override; + void analyze(const edm::Event& e, const edm::EventSetup& c) override; private: + const edm::ESGetToken tkGeomToken_; + const edm::ESGetToken tkTopoToken_; + unsigned int HVgroup(unsigned int panel, unsigned int module); std::vector > detid_la; diff --git a/CondTools/SiPixel/test/SiPixelLorentzAngleReader.cc b/CondTools/SiPixel/plugins/SiPixelLorentzAngleReader.cc similarity index 71% rename from CondTools/SiPixel/test/SiPixelLorentzAngleReader.cc rename to CondTools/SiPixel/plugins/SiPixelLorentzAngleReader.cc index 7ebc966cc1c0b..6b30df3db8e5d 100644 --- a/CondTools/SiPixel/test/SiPixelLorentzAngleReader.cc +++ b/CondTools/SiPixel/plugins/SiPixelLorentzAngleReader.cc @@ -1,9 +1,6 @@ -#include "CondFormats/SiPixelObjects/interface/SiPixelLorentzAngle.h" -#include "CondFormats/DataRecord/interface/SiPixelLorentzAngleRcd.h" -#include "CondFormats/DataRecord/interface/SiPixelLorentzAngleSimRcd.h" +#include "SiPixelLorentzAngleReader.h" #include "Geometry/CommonDetUnit/interface/PixelGeomDetUnit.h" #include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" -#include "CondTools/SiPixel/test/SiPixelLorentzAngleReader.h" #include "DataFormats/SiPixelDetId/interface/PixelSubdetector.h" #include "DataFormats/DetId/interface/DetId.h" #include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" @@ -21,17 +18,23 @@ using namespace cms; SiPixelLorentzAngleReader::SiPixelLorentzAngleReader(const edm::ParameterSet& iConfig) - : printdebug_(iConfig.getUntrackedParameter("printDebug", false)), - useSimRcd_(iConfig.getParameter("useSimRcd")) {} + : siPixelLAToken_(esConsumes()), + siPixelSimLAToken_(esConsumes()), + printdebug_(iConfig.getUntrackedParameter("printDebug", false)), + useSimRcd_(iConfig.getParameter("useSimRcd")) { + usesResource(TFileService::kSharedResource); +} -SiPixelLorentzAngleReader::~SiPixelLorentzAngleReader() {} +SiPixelLorentzAngleReader::~SiPixelLorentzAngleReader() = default; void SiPixelLorentzAngleReader::analyze(const edm::Event& e, const edm::EventSetup& iSetup) { - edm::ESHandle SiPixelLorentzAngle_; - if (useSimRcd_ == true) - iSetup.get().get(SiPixelLorentzAngle_); - else - iSetup.get().get(SiPixelLorentzAngle_); + const SiPixelLorentzAngle* SiPixelLorentzAngle_; + if (useSimRcd_) { + SiPixelLorentzAngle_ = &iSetup.getData(siPixelSimLAToken_); + } else { + SiPixelLorentzAngle_ = &iSetup.getData(siPixelLAToken_); + } + edm::LogInfo("SiPixelLorentzAngleReader") << "[SiPixelLorentzAngleReader::analyze] End Reading SiPixelLorentzAngle" << std::endl; edm::Service fs; @@ -40,7 +43,7 @@ void SiPixelLorentzAngleReader::analyze(const edm::Event& e, const edm::EventSet std::map detid_la = SiPixelLorentzAngle_->getLorentzAngles(); std::map::const_iterator it; for (it = detid_la.begin(); it != detid_la.end(); it++) { - // std::cout << "detid " << it->first << " \t" << " Lorentz angle " << it->second << std::endl; + // edm::LogPrint("SiPixelLorentzAngleReader") << "detid " << it->first << " \t" << " Lorentz angle " << it->second << std::endl; //edm::LogInfo("SiPixelLorentzAngleReader") << "detid " << it->first << " \t" << " Lorentz angle " << it->second; unsigned int subdet = DetId(it->first).subdetId(); if (subdet == static_cast(PixelSubdetector::PixelBarrel)) { @@ -50,3 +53,4 @@ void SiPixelLorentzAngleReader::analyze(const edm::Event& e, const edm::EventSet } } } +DEFINE_FWK_MODULE(SiPixelLorentzAngleReader); diff --git a/CondTools/SiPixel/test/SiPixelLorentzAngleReader.h b/CondTools/SiPixel/plugins/SiPixelLorentzAngleReader.h similarity index 51% rename from CondTools/SiPixel/test/SiPixelLorentzAngleReader.h rename to CondTools/SiPixel/plugins/SiPixelLorentzAngleReader.h index 35d12579f527b..27eca3e33362d 100644 --- a/CondTools/SiPixel/test/SiPixelLorentzAngleReader.h +++ b/CondTools/SiPixel/plugins/SiPixelLorentzAngleReader.h @@ -5,14 +5,17 @@ //#include // user include files +#include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDAnalyzer.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/ServiceRegistry/interface/Service.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "CondFormats/SiPixelObjects/interface/SiPixelLorentzAngle.h" +#include "CondFormats/DataRecord/interface/SiPixelLorentzAngleRcd.h" +#include "CondFormats/DataRecord/interface/SiPixelLorentzAngleSimRcd.h" #include "TROOT.h" #include "TFile.h" #include "TH2F.h" @@ -21,14 +24,17 @@ // // class decleration // -class SiPixelLorentzAngleReader : public edm::EDAnalyzer { +class SiPixelLorentzAngleReader : public edm::one::EDAnalyzer { public: explicit SiPixelLorentzAngleReader(const edm::ParameterSet&); - ~SiPixelLorentzAngleReader(); + ~SiPixelLorentzAngleReader() override; - void analyze(const edm::Event&, const edm::EventSetup&); + void analyze(const edm::Event&, const edm::EventSetup&) override; private: + const edm::ESGetToken siPixelLAToken_; + const edm::ESGetToken siPixelSimLAToken_; + bool printdebug_; TH1F* LorentzAngleBarrel_; TH1F* LorentzAngleForward_; diff --git a/CondTools/SiPixel/test/SiPixelPerformanceSummaryBuilder.cc b/CondTools/SiPixel/plugins/SiPixelPerformanceSummaryBuilder.cc similarity index 91% rename from CondTools/SiPixel/test/SiPixelPerformanceSummaryBuilder.cc rename to CondTools/SiPixel/plugins/SiPixelPerformanceSummaryBuilder.cc index d5bea4a8e7b3d..831f4de2511d7 100644 --- a/CondTools/SiPixel/test/SiPixelPerformanceSummaryBuilder.cc +++ b/CondTools/SiPixel/plugins/SiPixelPerformanceSummaryBuilder.cc @@ -14,17 +14,17 @@ #include "CondCore/DBOutputService/interface/PoolDBOutputService.h" #include "CondFormats/SiPixelObjects/interface/SiPixelPerformanceSummary.h" -#include "CondTools/SiPixel/test/SiPixelPerformanceSummaryBuilder.h" +#include "CondTools/SiPixel/plugins/SiPixelPerformanceSummaryBuilder.h" using namespace cms; -SiPixelPerformanceSummaryBuilder::SiPixelPerformanceSummaryBuilder(const edm::ParameterSet& iConfig) {} +SiPixelPerformanceSummaryBuilder::SiPixelPerformanceSummaryBuilder(const edm::ParameterSet& iConfig) + : tkGeomToken_(esConsumes()) {} -SiPixelPerformanceSummaryBuilder::~SiPixelPerformanceSummaryBuilder() {} +SiPixelPerformanceSummaryBuilder::~SiPixelPerformanceSummaryBuilder() = default; void SiPixelPerformanceSummaryBuilder::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { - edm::ESHandle pDD; - iSetup.get().get(pDD); + const TrackerGeometry* pDD = &iSetup.getData(tkGeomToken_); edm::LogInfo("SiPixelPerformanceSummaryBuilder") << pDD->detUnits().size() << " detectors" << std::endl; for (const auto& it : pDD->detUnits()) { @@ -73,7 +73,4 @@ void SiPixelPerformanceSummaryBuilder::analyze(const edm::Event& iEvent, const e } else edm::LogError("PoolDBOutputService") << "service unavailable" << std::endl; } - -void SiPixelPerformanceSummaryBuilder::beginJob() {} - -void SiPixelPerformanceSummaryBuilder::endJob() {} +DEFINE_FWK_MODULE(SiPixelPerformanceSummaryBuilder); diff --git a/CondTools/SiPixel/test/SiPixelPerformanceSummaryBuilder.h b/CondTools/SiPixel/plugins/SiPixelPerformanceSummaryBuilder.h similarity index 60% rename from CondTools/SiPixel/test/SiPixelPerformanceSummaryBuilder.h rename to CondTools/SiPixel/plugins/SiPixelPerformanceSummaryBuilder.h index 83d1eb7770976..518b043d8db89 100644 --- a/CondTools/SiPixel/test/SiPixelPerformanceSummaryBuilder.h +++ b/CondTools/SiPixel/plugins/SiPixelPerformanceSummaryBuilder.h @@ -4,23 +4,20 @@ #include #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" namespace cms { - class SiPixelPerformanceSummaryBuilder : public edm::EDAnalyzer { + class SiPixelPerformanceSummaryBuilder : public edm::one::EDAnalyzer<> { public: explicit SiPixelPerformanceSummaryBuilder(const edm::ParameterSet&); - ~SiPixelPerformanceSummaryBuilder(); - - private: - virtual void beginJob(); - virtual void analyze(const edm::Event&, const edm::EventSetup&); - virtual void endJob(); + ~SiPixelPerformanceSummaryBuilder() override; + void analyze(const edm::Event&, const edm::EventSetup&) override; private: + edm::ESGetToken tkGeomToken_; std::vector detectorModules_; }; } // namespace cms diff --git a/CondTools/SiPixel/test/SiPixelPerformanceSummaryReader.cc b/CondTools/SiPixel/plugins/SiPixelPerformanceSummaryReader.cc similarity index 65% rename from CondTools/SiPixel/test/SiPixelPerformanceSummaryReader.cc rename to CondTools/SiPixel/plugins/SiPixelPerformanceSummaryReader.cc index c4d9b9ebc9660..6f8455d9da118 100644 --- a/CondTools/SiPixel/test/SiPixelPerformanceSummaryReader.cc +++ b/CondTools/SiPixel/plugins/SiPixelPerformanceSummaryReader.cc @@ -1,10 +1,6 @@ +#include "SiPixelPerformanceSummaryReader.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "CondFormats/SiPixelObjects/interface/SiPixelPerformanceSummary.h" -#include "CondFormats/DataRecord/interface/SiPixelPerformanceSummaryRcd.h" - -#include "CondTools/SiPixel/test/SiPixelPerformanceSummaryReader.h" - #include #include #include @@ -13,14 +9,13 @@ using namespace cms; using namespace std; SiPixelPerformanceSummaryReader::SiPixelPerformanceSummaryReader(const edm::ParameterSet& iConfig) - : printdebug_(iConfig.getUntrackedParameter("printDebug", false)) {} + : perfSummaryToken_(esConsumes()), printdebug_(iConfig.getUntrackedParameter("printDebug", false)) {} -SiPixelPerformanceSummaryReader::~SiPixelPerformanceSummaryReader() {} +SiPixelPerformanceSummaryReader::~SiPixelPerformanceSummaryReader() = default; void SiPixelPerformanceSummaryReader::analyze(const edm::Event& e, const edm::EventSetup& iSetup) { edm::LogInfo("SiPixelPerformanceSummaryReader") << "start reading SiPixelPerformanceSummary" << endl; - edm::ESHandle SiPixelPerformanceSummary_; - iSetup.get().get(SiPixelPerformanceSummary_); + const SiPixelPerformanceSummary* SiPixelPerformanceSummary_ = &iSetup.getData(perfSummaryToken_); edm::LogInfo("SiPixelPerformanceSummaryReader") << "end reading SiPixelPerformanceSummary" << endl; SiPixelPerformanceSummary_->print(); @@ -29,3 +24,4 @@ void SiPixelPerformanceSummaryReader::analyze(const edm::Event& e, const edm::Ev SiPixelPerformanceSummary_->print(allDetIds[0]); SiPixelPerformanceSummary_->printAll(); } +DEFINE_FWK_MODULE(SiPixelPerformanceSummaryReader); diff --git a/CondTools/SiPixel/plugins/SiPixelPerformanceSummaryReader.h b/CondTools/SiPixel/plugins/SiPixelPerformanceSummaryReader.h new file mode 100644 index 0000000000000..efe647678616b --- /dev/null +++ b/CondTools/SiPixel/plugins/SiPixelPerformanceSummaryReader.h @@ -0,0 +1,28 @@ +#ifndef SiPixelPerformanceSummaryReader_H +#define SiPixelPerformanceSummaryReader_H + +#include "FWCore/Framework/interface/MakerMacros.h" +#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/ServiceRegistry/interface/Service.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "CondFormats/SiPixelObjects/interface/SiPixelPerformanceSummary.h" +#include "CondFormats/DataRecord/interface/SiPixelPerformanceSummaryRcd.h" + +namespace cms { + class SiPixelPerformanceSummaryReader : public edm::one::EDAnalyzer<> { + public: + explicit SiPixelPerformanceSummaryReader(const edm::ParameterSet&); + ~SiPixelPerformanceSummaryReader() override; + + void analyze(const edm::Event&, const edm::EventSetup&) override; + + private: + const edm::ESGetToken perfSummaryToken_; + bool printdebug_; + }; +} // namespace cms + +#endif diff --git a/CondTools/SiPixel/test/SiPixelTemplateDBObjectReader.cc b/CondTools/SiPixel/plugins/SiPixelTemplateDBObjectReader.cc similarity index 64% rename from CondTools/SiPixel/test/SiPixelTemplateDBObjectReader.cc rename to CondTools/SiPixel/plugins/SiPixelTemplateDBObjectReader.cc index f3ae14594f4a1..579fa915173b9 100644 --- a/CondTools/SiPixel/test/SiPixelTemplateDBObjectReader.cc +++ b/CondTools/SiPixel/plugins/SiPixelTemplateDBObjectReader.cc @@ -1,46 +1,87 @@ -#include "CondTools/SiPixel/test/SiPixelTemplateDBObjectReader.h" #include #include #include #include +#include + +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" +#include "FWCore/Framework/interface/ESWatcher.h" + +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/MakerMacros.h" + +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" +#include "FWCore/Utilities/interface/ESGetToken.h" + +#include "CondFormats/SiPixelObjects/interface/SiPixelTemplateDBObject.h" +#include "CondFormats/DataRecord/interface/SiPixelTemplateDBObjectRcd.h" +#include "CalibTracker/Records/interface/SiPixelTemplateDBObjectESProducerRcd.h" +#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" +#include "MagneticField/Engine/interface/MagneticField.h" #include "FWCore/ParameterSet/interface/FileInPath.h" #include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/EventSetup.h" -#include "MagneticField/Engine/interface/MagneticField.h" + +class SiPixelTemplateDBObjectReader : public edm::one::EDAnalyzer<> { +public: + explicit SiPixelTemplateDBObjectReader(const edm::ParameterSet&); + ~SiPixelTemplateDBObjectReader() override; + +private: + void beginJob() override; + void analyze(const edm::Event&, const edm::EventSetup&) override; + void endJob() override; + + edm::ESWatcher SiPixTemplDBObjectWatcher_; + edm::ESWatcher SiPixTemplDBObjWatcher_; + + std::string theTemplateCalibrationLocation; + bool theDetailedTemplateDBErrorOutput; + bool theFullTemplateDBOutput; + bool testGlobalTag; + bool hasTriggeredWatcher; + edm::ESGetToken magneticFieldToken_; + edm::ESGetToken the1DTemplateESProdToken_; + edm::ESGetToken the1DTemplateToken_; +}; SiPixelTemplateDBObjectReader::SiPixelTemplateDBObjectReader(const edm::ParameterSet& iConfig) : theTemplateCalibrationLocation(iConfig.getParameter("siPixelTemplateCalibrationLocation")), theDetailedTemplateDBErrorOutput(iConfig.getParameter("wantDetailedTemplateDBErrorOutput")), theFullTemplateDBOutput(iConfig.getParameter("wantFullTemplateDBOutput")), testGlobalTag(iConfig.getParameter("TestGlobalTag")), - hasTriggeredWatcher(false) {} + hasTriggeredWatcher(false), + magneticFieldToken_(esConsumes()), + the1DTemplateESProdToken_(esConsumes()), + the1DTemplateToken_(esConsumes()) {} -SiPixelTemplateDBObjectReader::~SiPixelTemplateDBObjectReader() {} +SiPixelTemplateDBObjectReader::~SiPixelTemplateDBObjectReader() = default; void SiPixelTemplateDBObjectReader::beginJob() {} -void SiPixelTemplateDBObjectReader::analyze(const edm::Event& iEvent, const edm::EventSetup& setup) { +void SiPixelTemplateDBObjectReader::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { //To test with the ESProducer + SiPixelTemplateDBObject dbobject; if (testGlobalTag) { - edm::ESHandle magfield; - setup.get().get(magfield); + // Get magnetic field GlobalPoint center(0.0, 0.0, 0.0); + edm::ESHandle magfield = iSetup.getHandle(magneticFieldToken_); float theMagField = magfield.product()->inTesla(center).mag(); - std::cout << "\nTesting global tag at magfield = " << theMagField << std::endl; - if (SiPixTemplDBObjWatcher_.check(setup)) { - edm::ESHandle templateH; - setup.get().get(templateH); - dbobject = *templateH.product(); + edm::LogPrint("SiPixelTemplateDBObjectReader") << "\nTesting global tag at magfield = " << theMagField; + if (SiPixTemplDBObjWatcher_.check(iSetup)) { + edm::LogPrint("SiPixelTemplateDBObjectReader") << "With record SiPixelTemplateDBObjectESProducerRcd"; + dbobject = *&iSetup.getData(the1DTemplateESProdToken_); hasTriggeredWatcher = true; } } else { - std::cout << "\nLoading from file " << std::endl; - if (SiPixTemplDBObjWatcher_.check(setup)) { - edm::ESHandle templateH; - setup.get().get(templateH); - dbobject = *templateH.product(); + edm::LogPrint("SiPixelTemplateDBObjectReader") << "\nLoading from file " << std::endl; + if (SiPixTemplDBObjWatcher_.check(iSetup)) { + edm::LogPrint("SiPixelTemplateDBObjectReader") << "With record SiPixelTemplateDBObjectRcd"; + dbobject = *&iSetup.getData(the1DTemplateToken_); hasTriggeredWatcher = true; } } @@ -49,7 +90,7 @@ void SiPixelTemplateDBObjectReader::analyze(const edm::Event& iEvent, const edm: std::vector tempMapId; if (theFullTemplateDBOutput) - std::cout << "Map info" << std::endl; + edm::LogPrint("SiPixelTemplateDBObjectReader") << "Map info" << std::endl; std::map templMap = dbobject.getTemplateIDs(); for (std::map::const_iterator it = templMap.begin(); it != templMap.end(); ++it) { if (tempMapId.empty()) @@ -63,33 +104,34 @@ void SiPixelTemplateDBObjectReader::analyze(const edm::Event& iEvent, const edm: } } if (theFullTemplateDBOutput) - std::cout << "DetId: " << it->first << " TemplateID: " << it->second << "\n"; + edm::LogPrint("SiPixelTemplateDBObjectReader") + << "DetId: " << it->first << " TemplateID: " << it->second << "\n"; } - std::cout << "\nMap stores template Id(s): "; + edm::LogPrint("SiPixelTemplateDBObjectReader") << "\nMap stores template Id(s): "; for (unsigned int vindex = 0; vindex < tempMapId.size(); ++vindex) - std::cout << tempMapId[vindex] << " "; - std::cout << std::endl; + edm::LogPrint("SiPixelTemplateDBObjectReader") << tempMapId[vindex] << " "; + edm::LogPrint("SiPixelTemplateDBObjectReader") << std::endl; //local variables const char* tempfile; - char c; int numOfTempl = dbobject.numOfTempl(); int index = 0; float tempnum = 0, diff = 0; float tol = 1.0E-23; bool error = false, givenErrorMsg = false; - ; - std::cout << "\nChecking Template DB object version " << dbobject.version() << " containing " << numOfTempl - << " calibration(s) at " << dbobject.sVector()[index + 22] << "T\n"; + edm::LogPrint("SiPixelTemplateDBObjectReader") + << "\nChecking Template DB object version " << dbobject.version() << " containing " << numOfTempl + << " calibration(s) at " << dbobject.sVector()[index + 22] << "T\n"; for (int i = 0; i < numOfTempl; ++i) { //Removes header in db object from diff index += 20; //Tell the person viewing the output what the template ID and version are -- note that version is only valid for >=13 - std::cout << "Calibration " << i + 1 << " of " << numOfTempl << ", with Template ID " << dbobject.sVector()[index] - << "\tand Version " << dbobject.sVector()[index + 1] << "\t-------- "; + edm::LogPrint("SiPixelTemplateDBObjectReader") + << "Calibration " << i + 1 << " of " << numOfTempl << ", with Template ID " << dbobject.sVector()[index] + << "\tand Version " << dbobject.sVector()[index + 1] << "\t-------- "; //Opening the text-based template calibration std::ostringstream tout; @@ -102,9 +144,6 @@ void SiPixelTemplateDBObjectReader::analyze(const edm::Event& iEvent, const edm: if (in_file.is_open()) { //Removes header in textfile from diff - for (int header = 0; (c = in_file.get()) != '\n'; ++header) { - } - //First read in from the text file -- this will be compared with index = 20 in_file >> tempnum; @@ -117,14 +156,15 @@ void SiPixelTemplateDBObjectReader::analyze(const edm::Event& iEvent, const edm: if (diff > tol) { //We have the if statement to output the message only once if (!givenErrorMsg) - std::cout << "does NOT match\n"; + edm::LogPrint("SiPixelTemplateDBObjectReader") << "does NOT match\n"; //If there is an error we want to display a message upon completion error = true; givenErrorMsg = true; //Do we want more detailed output? if (theDetailedTemplateDBErrorOutput) { - std::cout << "from file = " << tempnum << "\t from dbobject = " << dbobject.sVector()[index] - << "\tdiff = " << diff << "\t db index = " << index << std::endl; + edm::LogPrint("SiPixelTemplateDBObjectReader") + << "from file = " << tempnum << "\t from dbobject = " << dbobject.sVector()[index] + << "\tdiff = " << diff << "\t db index = " << index << std::endl; } } //Go to the next entries @@ -133,22 +173,23 @@ void SiPixelTemplateDBObjectReader::analyze(const edm::Event& iEvent, const edm: } //There were no errors, the two files match. if (!givenErrorMsg) - std::cout << "MATCHES\n"; + edm::LogPrint("SiPixelTemplateDBObjectReader") << "MATCHES\n"; } //end current file in_file.close(); givenErrorMsg = false; } //end loop over all files if (error && !theDetailedTemplateDBErrorOutput) - std::cout << "\nThe were differences found between the files and the database.\n" - << "If you would like more detailed information please set\n" - << "wantDetailedOutput = True in the cfg file. If you would like a\n" - << "full output of the contents of the database file please set\n" - << "wantFullOutput = True. Make sure that you pipe the output to a\n" - << "log file. This could take a few minutes.\n\n"; + edm::LogPrint("SiPixelTemplateDBObjectReader") + << "\nThe were differences found between the files and the database.\n" + << "If you would like more detailed information please set\n" + << "wantDetailedOutput = True in the cfg file. If you would like a\n" + << "full output of the contents of the database file please set\n" + << "wantFullOutput = True. Make sure that you pipe the output to a\n" + << "log file. This could take a few minutes.\n\n"; if (theFullTemplateDBOutput) - std::cout << dbobject << std::endl; + edm::LogPrint("SiPixelTemplateDBObjectReader") << dbobject << std::endl; } } @@ -167,25 +208,30 @@ std::ostream& operator<<(std::ostream& s, const SiPixelTemplateDBObject& dbobjec //!-changes the size of the templates based on the version int sizeSetter = 0, templateVersion = 0; - std::cout << "\n\nDBobject version: " << dbobject.version() << std::endl; + edm::LogPrint("SiPixelTemplateDBObjectReader") << "\n\nDBobject version: " << dbobject.version() << std::endl; for (m = 0; m < dbobject.numOfTempl(); ++m) { //To change the size of the output based on which template version we are using" templateVersion = (int)dbobject.sVector_[index + 21]; if (templateVersion <= 10) { - std::cout << "*****WARNING***** This code will not format this template version properly *****WARNING*****\n"; + edm::LogPrint("SiPixelTemplateDBObjectReader") + << "*****WARNING***** This code will not format this template version properly *****WARNING*****\n"; sizeSetter = 0; } else if (templateVersion <= 16) sizeSetter = 1; else - std::cout << "*****WARNING***** This code has not been tested at formatting this version *****WARNING*****\n"; + edm::LogPrint("SiPixelTemplateDBObjectReader") + << "*****WARNING***** This code has not been tested at formatting this version *****WARNING*****\n"; - std::cout << "\n\n*********************************************************************************************" - << std::endl; - std::cout << "*************** Reading Template ID " << dbobject.sVector_[index + 20] << "\t(" - << m + 1 << "/" << dbobject.numOfTempl_ << ") ***************" << std::endl; - std::cout << "*********************************************************************************************\n\n" - << std::endl; + edm::LogPrint("SiPixelTemplateDBObjectReader") + << "\n\n*********************************************************************************************" + << std::endl; + edm::LogPrint("SiPixelTemplateDBObjectReader") + << "*************** Reading Template ID " << dbobject.sVector_[index + 20] << "\t(" << m + 1 + << "/" << dbobject.numOfTempl_ << ") ***************" << std::endl; + edm::LogPrint("SiPixelTemplateDBObjectReader") + << "*********************************************************************************************\n\n" + << std::endl; //Header Title SiPixelTemplateDBObject::char2float temp; @@ -341,3 +387,5 @@ std::ostream& operator<<(std::ostream& s, const SiPixelTemplateDBObject& dbobjec } return s; } + +DEFINE_FWK_MODULE(SiPixelTemplateDBObjectReader); diff --git a/CondTools/SiPixel/test/SiPixelTemplateDBObjectUploader.cc b/CondTools/SiPixel/plugins/SiPixelTemplateDBObjectUploader.cc similarity index 69% rename from CondTools/SiPixel/test/SiPixelTemplateDBObjectUploader.cc rename to CondTools/SiPixel/plugins/SiPixelTemplateDBObjectUploader.cc index 1740153b3833b..e24b48b2228a0 100644 --- a/CondTools/SiPixel/test/SiPixelTemplateDBObjectUploader.cc +++ b/CondTools/SiPixel/plugins/SiPixelTemplateDBObjectUploader.cc @@ -1,5 +1,10 @@ -#include "CondTools/SiPixel/test/SiPixelTemplateDBObjectUploader.h" +#include +#include +#include +#include + #include "CondFormats/DataRecord/interface/SiPixelTemplateDBObjectRcd.h" +#include "CondFormats/SiPixelObjects/interface/SiPixelTemplateDBObject.h" #include "CondCore/DBOutputService/interface/PoolDBOutputService.h" #include "FWCore/ServiceRegistry/interface/Service.h" @@ -15,9 +20,42 @@ #include "DataFormats/TrackerCommon/interface/PixelBarrelName.h" #include "DataFormats/TrackerCommon/interface/PixelEndcapName.h" -#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/MakerMacros.h" +#include "FWCore/Framework/interface/ESHandle.h" + +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" +#include "FWCore/Utilities/interface/ESGetToken.h" + +class SiPixelTemplateDBObjectUploader : public edm::one::EDAnalyzer<> { +public: + explicit SiPixelTemplateDBObjectUploader(const edm::ParameterSet&); + ~SiPixelTemplateDBObjectUploader() override; + + typedef std::vector vstring; + +private: + void beginJob() override; + void analyze(const edm::Event&, const edm::EventSetup&) override; + void endJob() override; + + vstring theTemplateCalibrations; + std::string theTemplateBaseString; + float theVersion; + float theMagField; + std::vector theDetIds; + vstring theBarrelLocations; + vstring theEndcapLocations; + std::vector theBarrelTemplateIds; + std::vector theEndcapTemplateIds; + bool useVectorIndices; + edm::ESGetToken trackerGeometryToken_; + edm::ESGetToken trackerTopologyToken_; +}; SiPixelTemplateDBObjectUploader::SiPixelTemplateDBObjectUploader(const edm::ParameterSet& iConfig) : theTemplateCalibrations(iConfig.getParameter("siPixelTemplateCalibrations")), @@ -28,13 +66,15 @@ SiPixelTemplateDBObjectUploader::SiPixelTemplateDBObjectUploader(const edm::Para theEndcapLocations(iConfig.getParameter >("endcapLocations")), theBarrelTemplateIds(iConfig.getParameter >("barrelTemplateIds")), theEndcapTemplateIds(iConfig.getParameter >("endcapTemplateIds")), - useVectorIndices(iConfig.getUntrackedParameter("useVectorIndices", false)) {} + useVectorIndices(iConfig.getUntrackedParameter("useVectorIndices", false)), + trackerGeometryToken_(esConsumes()), + trackerTopologyToken_(esConsumes()) {} -SiPixelTemplateDBObjectUploader::~SiPixelTemplateDBObjectUploader() {} +SiPixelTemplateDBObjectUploader::~SiPixelTemplateDBObjectUploader() = default; void SiPixelTemplateDBObjectUploader::beginJob() {} -void SiPixelTemplateDBObjectUploader::analyze(const edm::Event& iEvent, const edm::EventSetup& es) { +void SiPixelTemplateDBObjectUploader::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { //--- Make the POOL-ORA object to store the database object SiPixelTemplateDBObject obj; @@ -50,7 +90,7 @@ void SiPixelTemplateDBObjectUploader::analyze(const edm::Event& iEvent, const ed auto tempfile = (file.fullPath()); std::ifstream in_file(tempfile.c_str(), std::ios::in); if (in_file.is_open()) { - edm::LogInfo("Template Info") << "Opened Template File: " << file.fullPath().c_str(); + edm::LogInfo("SiPixelTemplateDBObjectUploader") << "Opened Template File: " << file.fullPath().c_str(); // Local variables char title_char[80], c; @@ -82,9 +122,10 @@ void SiPixelTemplateDBObjectUploader::analyze(const edm::Event& iEvent, const ed if ((title_char[k] == '@') && (title_char[k - 1] == 'T')) { double localMagField = (((int)title_char[k - 4]) - 48) * 10 + ((int)title_char[k - 2]) - 48; if (theMagField != localMagField) { - std::cout << "\n -------- WARNING -------- \n Magnetic field in the cfg is " << theMagField - << "T while it is " << title_char[k - 4] << title_char[k - 2] << title_char[k - 1] - << " in the header \n ------------------------- \n " << std::endl; + edm::LogPrint("SiPixelTemplateDBObjectUploader") + << "\n -------- WARNING -------- \n Magnetic field in the cfg is " << theMagField << "T while it is " + << title_char[k - 4] << title_char[k - 2] << title_char[k - 1] + << " in the header \n ------------------------- \n " << std::endl; } } } @@ -104,15 +145,12 @@ void SiPixelTemplateDBObjectUploader::analyze(const edm::Event& iEvent, const ed } } - // Get the event setup - edm::ESHandle pDD; - es.get().get(pDD); - const TrackerGeometry* tGeo = pDD.product(); + //get TrackerGeometry from the event setup + const edm::ESHandle pDD = iSetup.getHandle(trackerGeometryToken_); + const TrackerGeometry* tGeo = &iSetup.getData(trackerGeometryToken_); // Use the TrackerTopology class for layer/disk etc. number - edm::ESHandle tTopoHandle; - es.get().get(tTopoHandle); - const TrackerTopology* tTopo = tTopoHandle.product(); + const TrackerTopology* tTopo = &iSetup.getData(trackerTopologyToken_); // Check if we are using Phase-1 or Phase-2 geometry int phase = 0; @@ -121,7 +159,7 @@ void SiPixelTemplateDBObjectUploader::analyze(const edm::Event& iEvent, const ed } else if (pDD->isThere(GeomDetEnumerators::P2PXB) && pDD->isThere(GeomDetEnumerators::P2PXEC) == true) { phase = 2; } - std::cout << "Phase-" << phase << " geometry is used \n" << std::endl; + edm::LogPrint("SiPixelTemplateDBObjectUploader") << "Phase-" << phase << " geometry is used \n" << std::endl; //Loop over the detector elements and put template IDs in place for (const auto& it : pDD->detUnits()) { @@ -129,8 +167,6 @@ void SiPixelTemplateDBObjectUploader::analyze(const edm::Event& iEvent, const ed // Here is the actual looping step over all DetIds: DetId detid = it->geographicalId(); unsigned int layer = 0, ladder = 0, disk = 0, side = 0, blade = 0, panel = 0, module = 0; - // Some extra variables that can be used for Phase 1 - comment in if needed - // unsigned int shl=0, sec=0, half=0, flipped=0, ring=0; short thisID = 10000; unsigned int iter; @@ -138,21 +174,11 @@ void SiPixelTemplateDBObjectUploader::analyze(const edm::Event& iEvent, const ed //Barrel Pixels first if ((phase == 1 && detid.subdetId() == static_cast(PixelSubdetector::PixelBarrel)) || (phase == 2 && tGeo->geomDetSubDetector(detid.subdetId()) == GeomDetEnumerators::P2PXB)) { - std::cout << "--- IN THE BARREL ---\n"; - //Get the layer, ladder, and module corresponding to this detID layer = tTopo->pxbLayer(detid.rawId()); ladder = tTopo->pxbLadder(detid.rawId()); module = tTopo->pxbModule(detid.rawId()); - /* - // Comment these in if needed - PixelBarrelName pbn(detid, tTopo, phase); - shl = pbn.shell(); - sec = pbn.sectorName(); - half = pbn.isHalfModule(); - // This tells if we are on a flipped ladder (in the inner radius, closer to beam) - flipped = (phase ? layer==4 : layer%2) ? ladder%2==0 : ladder%2==1; - */ + if (useVectorIndices) { --layer; --ladder; @@ -165,8 +191,8 @@ void SiPixelTemplateDBObjectUploader::analyze(const edm::Event& iEvent, const ed //get the string of this barrel location std::string loc_string = theBarrelLocations[iter]; //find where the delimiters are - unsigned int first_delim_pos = loc_string.find("_"); - unsigned int second_delim_pos = loc_string.find("_", first_delim_pos + 1); + unsigned int first_delim_pos = loc_string.find('_'); + unsigned int second_delim_pos = loc_string.find('_', first_delim_pos + 1); //get the layer, ladder, and module as unsigned ints unsigned int checklayer = (unsigned int)stoi(loc_string.substr(0, first_delim_pos)); unsigned int checkladder = @@ -179,28 +205,20 @@ void SiPixelTemplateDBObjectUploader::analyze(const edm::Event& iEvent, const ed } if (thisID == 10000 || (!obj.putTemplateID(detid.rawId(), thisID))) - std::cout << " Could not fill barrel layer " << layer << ", module " << module << "\n"; - // ----- debug: - std::cout << "This is a barrel element with: layer " << layer << ", ladder " << ladder << " and module " - << module << ".\n"; //Uncomment to read out exact position of each element. - // ----- + edm::LogPrint("SiPixelTemplateDBObjectUploader") + << " Could not fill barrel layer " << layer << ", module " << module << "\n"; + edm::LogPrint("SiPixelTemplateDBObjectUploader") + << "This is a barrel element with: layer " << layer << ", ladder " << ladder << " and module " << module; } //Now endcaps else if ((phase == 1 && detid.subdetId() == static_cast(PixelSubdetector::PixelEndcap)) || (phase == 2 && tGeo->geomDetSubDetector(detid.subdetId()) == GeomDetEnumerators::P2PXEC)) { - std::cout << "--- IN AN ENDCAP ---\n"; - //Get the DetId's disk, blade, side, panel, and module disk = tTopo->pxfDisk(detid.rawId()); //1,2,3 blade = tTopo->pxfBlade(detid.rawId()); //1-56 (Ring 1 is 1-22, Ring 2 is 23-56) side = tTopo->pxfSide(detid.rawId()); //side=1 for -z, 2 for +z panel = tTopo->pxfPanel(detid.rawId()); //panel=1,2 - /* - // Comment these in if needed - PixelEndcapName pen(detid, tTopo, phase); - shl = pen.halfCylinder(); - ring = pen.ringName(); //1,2 This is for Phase I - */ + if (useVectorIndices) { --disk; --blade; @@ -209,15 +227,14 @@ void SiPixelTemplateDBObjectUploader::analyze(const edm::Event& iEvent, const ed } //Assign IDs - //Loop over all the endcap locations for (iter = 0; iter < theEndcapLocations.size(); ++iter) { //get the string of this barrel location std::string loc_string = theEndcapLocations[iter]; //find where the delimiters are - unsigned int first_delim_pos = loc_string.find("_"); - unsigned int second_delim_pos = loc_string.find("_", first_delim_pos + 1); - unsigned int third_delim_pos = loc_string.find("_", second_delim_pos + 1); + unsigned int first_delim_pos = loc_string.find('_'); + unsigned int second_delim_pos = loc_string.find('_', first_delim_pos + 1); + unsigned int third_delim_pos = loc_string.find('_', second_delim_pos + 1); //get the disk, blade, side, panel, and module as unsigned ints unsigned int checkdisk = (unsigned int)stoi(loc_string.substr(0, first_delim_pos)); unsigned int checkblade = @@ -232,21 +249,20 @@ void SiPixelTemplateDBObjectUploader::analyze(const edm::Event& iEvent, const ed } if (thisID == 10000 || (!obj.putTemplateID(detid.rawId(), thisID))) - std::cout << " Could not fill endcap det unit" << side << ", disk " << disk << ", blade " << blade - << ", and panel " << panel << ".\n"; - // ----- debug: - std::cout << "This is an endcap element with: side " << side << ", disk " << disk << ", blade " << blade - << ", and panel " << panel << ".\n"; //Uncomment to read out exact position of each element. - // ----- + edm::LogPrint("SiPixelTemplateDBObjectUploader") + << " Could not fill endcap det unit" << side << ", disk " << disk << ", blade " << blade << ", and panel " + << panel << ".\n"; + edm::LogPrint("SiPixelTemplateDBObjectUploader") << "This is an endcap element with: side " << side << ", disk " + << disk << ", blade " << blade << ", and panel " << panel; } else { continue; } //Print out the assignment of this detID short mapnum; - std::cout << "checking map:\n"; mapnum = obj.getTemplateID(detid.rawId()); - std::cout << "The DetID: " << detid.rawId() << " is mapped to the template: " << mapnum << ".\n\n"; + edm::LogPrint("SiPixelTemplateDBObjectUploader") + << "The DetID: " << detid.rawId() << " is mapped to the template: " << mapnum << "\n"; } } @@ -255,9 +271,11 @@ void SiPixelTemplateDBObjectUploader::analyze(const edm::Event& iEvent, const ed if (!poolDbService.isAvailable()) // Die if not available throw cms::Exception("NotAvailable") << "PoolDBOutputService not available"; if (poolDbService->isNewTagRequest("SiPixelTemplateDBObjectRcd")) - poolDbService->writeOne(&obj, poolDbService->beginOfTime(), "SiPixelTemplateDBObjectRcd"); + poolDbService->writeOneIOV(obj, poolDbService->beginOfTime(), "SiPixelTemplateDBObjectRcd"); else - poolDbService->writeOne(&obj, poolDbService->currentTime(), "SiPixelTemplateDBObjectRcd"); + poolDbService->writeOneIOV(obj, poolDbService->currentTime(), "SiPixelTemplateDBObjectRcd"); } void SiPixelTemplateDBObjectUploader::endJob() {} + +DEFINE_FWK_MODULE(SiPixelTemplateDBObjectUploader); diff --git a/CondTools/SiPixel/test/SiPixelVCalDB.cc b/CondTools/SiPixel/plugins/SiPixelVCalDB.cc similarity index 76% rename from CondTools/SiPixel/test/SiPixelVCalDB.cc rename to CondTools/SiPixel/plugins/SiPixelVCalDB.cc index 492317c573f13..fb545ca674843 100644 --- a/CondTools/SiPixel/test/SiPixelVCalDB.cc +++ b/CondTools/SiPixel/plugins/SiPixelVCalDB.cc @@ -1,17 +1,16 @@ -#include "CondTools/SiPixel/test/SiPixelVCalDB.h" +#include "SiPixelVCalDB.h" using namespace std; using namespace edm; -SiPixelVCalDB::SiPixelVCalDB(edm::ParameterSet const& iConfig) { +SiPixelVCalDB::SiPixelVCalDB(edm::ParameterSet const& iConfig) + : tkGeomToken_(esConsumes()), tkTopoToken_(esConsumes()) { recordName_ = iConfig.getUntrackedParameter("record", "SiPixelVCalRcd"); BPixParameters_ = iConfig.getUntrackedParameter("BPixParameters"); FPixParameters_ = iConfig.getUntrackedParameter("FPixParameters"); } -SiPixelVCalDB::~SiPixelVCalDB() {} -void SiPixelVCalDB::beginJob() {} -void SiPixelVCalDB::endJob() {} +SiPixelVCalDB::~SiPixelVCalDB() = default; // Analyzer: Functions that gets called by framework every event void SiPixelVCalDB::analyze(const edm::Event& e, const edm::EventSetup& iSetup) { @@ -19,14 +18,11 @@ void SiPixelVCalDB::analyze(const edm::Event& e, const edm::EventSetup& iSetup) bool phase1 = true; // Retrieve tracker topology from geometry - edm::ESHandle tTopoHandle; - iSetup.get().get(tTopoHandle); - const TrackerTopology* const tTopo = tTopoHandle.product(); + const TrackerTopology* const tTopo = &iSetup.getData(tkTopoToken_); // Retrieve old style tracker geometry from geometry - edm::ESHandle pDD; - iSetup.get().get(pDD); - std::cout << " There are " << pDD->detUnits().size() << " modules" << std::endl; + const TrackerGeometry* pDD = &iSetup.getData(tkGeomToken_); + edm::LogPrint("SiPixelVCalDB") << " There are " << pDD->detUnits().size() << " modules" << std::endl; for (const auto& it : pDD->detUnits()) { if (dynamic_cast(it) != nullptr) { @@ -38,19 +34,19 @@ void SiPixelVCalDB::analyze(const edm::Event& e, const edm::EventSetup& iSetup) if (subid == static_cast(PixelSubdetector::PixelBarrel)) { int layer = tTopo->pxbLayer(detid); // 1, 2, 3, 4 int ladder = tTopo->pxbLadder(detid); // 1-12/28/44/64 - std::cout << " pixel barrel:" - << " detId=" << rawDetId << ", layer=" << layer << ", ladder=" << ladder; + edm::LogPrint("SiPixelVCalDB") << " pixel barrel:" + << " detId=" << rawDetId << ", layer=" << layer << ", ladder=" << ladder; for (Parameters::iterator it = BPixParameters_.begin(); it != BPixParameters_.end(); ++it) { if (it->getParameter("layer") == layer && it->getParameter("ladder") == ladder) { float slope = (float)it->getParameter("slope"); float offset = (float)it->getParameter("offset"); - std::cout << "; VCal slope " << slope << ", offset " << offset; + edm::LogPrint("SiPixelVCalDB") << "; VCal slope " << slope << ", offset " << offset; // edm::LogInfo("SiPixelVCalDB") << " detId " << rawDetId << " \t // VCal slope " << slope << ", offset " << offset; vcal->putSlopeAndOffset(detid, slope, offset); } } - std::cout << std::endl; + edm::LogPrint("SiPixelVCalDB") << std::endl; // FILL FPIX } else if (subid == static_cast(PixelSubdetector::PixelEndcap)) { @@ -63,20 +59,21 @@ void SiPixelVCalDB::analyze(const edm::Event& e, const edm::EventSetup& iSetup) edm::LogError("SiPixelVCalDB::analyze") << "Found contradicting FPIX disk number: " << disk << " vs." << disk2 << std::endl; } - std::cout << " pixel endcap:" - << " detId=" << rawDetId << ", side=" << side << ", disk=" << disk << ", ring=" << ring; + edm::LogPrint("SiPixelVCalDB") << " pixel endcap:" + << " detId=" << rawDetId << ", side=" << side << ", disk=" << disk + << ", ring=" << ring; for (Parameters::iterator it = FPixParameters_.begin(); it != FPixParameters_.end(); ++it) { if (it->getParameter("side") == side && it->getParameter("disk") == disk && it->getParameter("ring") == ring) { float slope = (float)it->getParameter("slope"); float offset = (float)it->getParameter("offset"); - std::cout << "; VCal slope " << slope << ", offset " << offset; + edm::LogPrint("SiPixelVCalDB") << "; VCal slope " << slope << ", offset " << offset; // edm::LogInfo("SiPixelVCalDB") << " detId " << rawDetId << " \t // VCal slope " << slope << ", offset " << offset; vcal->putSlopeAndOffset(rawDetId, slope, offset); } } - std::cout << std::endl; + edm::LogPrint("SiPixelVCalDB") << std::endl; } else { edm::LogError("SiPixelVCalDB::analyze") << "detid is Pixel but neither bpix nor fpix" << std::endl; @@ -104,3 +101,4 @@ void SiPixelVCalDB::analyze(const edm::Event& e, const edm::EventSetup& iSetup) edm::LogError("SiPixelVCalDB") << "Service is unavailable" << std::endl; } } +DEFINE_FWK_MODULE(SiPixelVCalDB); diff --git a/CondTools/SiPixel/test/SiPixelVCalDB.h b/CondTools/SiPixel/plugins/SiPixelVCalDB.h similarity index 71% rename from CondTools/SiPixel/test/SiPixelVCalDB.h rename to CondTools/SiPixel/plugins/SiPixelVCalDB.h index df7cfe8fddcfe..68f96c3452f3e 100644 --- a/CondTools/SiPixel/test/SiPixelVCalDB.h +++ b/CondTools/SiPixel/plugins/SiPixelVCalDB.h @@ -1,20 +1,20 @@ -#ifndef CalibTracker_SiPixelVCalDB_SiPixelVCalDB_h -#define CalibTracker_SiPixelVCalDB_SiPixelVCalDB_h +#ifndef CondTools_SiPixel_SiPixelVCalDB_h +#define CondTools_SiPixel_SiPixelVCalDB_h #include #include #include #include #include -#include "CondCore/DBOutputService/interface/PoolDBOutputService.h" #include "CondFormats/SiPixelObjects/interface/SiPixelVCal.h" -#include "DataFormats/Common/interface/Handle.h" +#include "CondCore/DBOutputService/interface/PoolDBOutputService.h" #include "DataFormats/DetId/interface/DetId.h" #include "DataFormats/TrackerCommon/interface/PixelBarrelName.h" #include "DataFormats/TrackerCommon/interface/PixelEndcapName.h" #include "DataFormats/TrackerCommon/interface/TrackerTopology.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/ServiceRegistry/interface/Service.h" @@ -22,18 +22,17 @@ #include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" #include "Geometry/Records/interface/TrackerTopologyRcd.h" #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" -//#include "CondTools/SiPixel/test/SiPixelVCalPixelId.h" -class SiPixelVCalDB : public edm::EDAnalyzer { +class SiPixelVCalDB : public edm::one::EDAnalyzer<> { public: explicit SiPixelVCalDB(const edm::ParameterSet& conf); explicit SiPixelVCalDB(); - virtual ~SiPixelVCalDB(); - virtual void beginJob(); - virtual void endJob(); - virtual void analyze(const edm::Event&, const edm::EventSetup&); + ~SiPixelVCalDB() override; + void analyze(const edm::Event&, const edm::EventSetup&) override; private: + edm::ESGetToken tkGeomToken_; + edm::ESGetToken tkTopoToken_; std::string recordName_; typedef std::vector Parameters; Parameters BPixParameters_; diff --git a/CondTools/SiPixel/test/SiPixelVCalReader.cc b/CondTools/SiPixel/plugins/SiPixelVCalReader.cc similarity index 64% rename from CondTools/SiPixel/test/SiPixelVCalReader.cc rename to CondTools/SiPixel/plugins/SiPixelVCalReader.cc index ce15406c74b2a..3a6bcefb5dbb9 100644 --- a/CondTools/SiPixel/test/SiPixelVCalReader.cc +++ b/CondTools/SiPixel/plugins/SiPixelVCalReader.cc @@ -1,35 +1,37 @@ -#include "CondTools/SiPixel/test/SiPixelVCalReader.h" +#include "SiPixelVCalReader.h" using namespace cms; SiPixelVCalReader::SiPixelVCalReader(const edm::ParameterSet& iConfig) - : printdebug_(iConfig.getUntrackedParameter("printDebug", false)), - useSimRcd_(iConfig.getParameter("useSimRcd")) {} + : siPixelVCalSimToken_(esConsumes()), + siPixelVCalToken_(esConsumes()), + tkGeomToken_(esConsumes()), + tkTopoToken_(esConsumes()), + printdebug_(iConfig.getUntrackedParameter("printDebug", false)), + useSimRcd_(iConfig.getParameter("useSimRcd")) { + usesResource(TFileService::kSharedResource); +} -SiPixelVCalReader::~SiPixelVCalReader() {} -void SiPixelVCalReader::beginJob() {} -void SiPixelVCalReader::endJob() {} +SiPixelVCalReader::~SiPixelVCalReader() = default; void SiPixelVCalReader::analyze(const edm::Event& e, const edm::EventSetup& iSetup) { - edm::ESHandle siPixelVCal; + const SiPixelVCal* siPixelVCal; // Get record & file service - if (useSimRcd_ == true) - iSetup.get().get(siPixelVCal); - else - iSetup.get().get(siPixelVCal); + if (useSimRcd_) { + siPixelVCal = &iSetup.getData(siPixelVCalSimToken_); + } else { + siPixelVCal = &iSetup.getData(siPixelVCalToken_); + } edm::LogInfo("SiPixelVCalReader") << "[SiPixelVCalReader::analyze] End Reading SiPixelVCal" << std::endl; edm::Service fs; // Retrieve tracker topology from geometry - edm::ESHandle tTopoHandle; - iSetup.get().get(tTopoHandle); - const TrackerTopology* const tTopo = tTopoHandle.product(); + const TrackerTopology* const tTopo = &iSetup.getData(tkTopoToken_); // Retrieve old style tracker geometry from geometry - edm::ESHandle pDD; - iSetup.get().get(pDD); - std::cout << " There are " << pDD->detUnits().size() << " modules" << std::endl; + const TrackerGeometry* pDD = &iSetup.getData(tkGeomToken_); + edm::LogPrint("SiPixelVCalReader") << " There are " << pDD->detUnits().size() << " modules" << std::endl; // Phase bool phase1 = true; @@ -57,8 +59,9 @@ void SiPixelVCalReader::analyze(const edm::Event& e, const edm::EventSetup& iSet std::map::const_iterator it; // Fill histograms - std::cout << std::setw(12) << "detid" << std::setw(8) << "subdet" << std::setw(8) << "layer" << std::setw(8) << "disk" - << std::setw(14) << "VCal slope" << std::setw(8) << "offset" << std::endl; + edm::LogPrint("SiPixelVCalReader") << std::setw(12) << "detid" << std::setw(8) << "subdet" << std::setw(8) << "layer" + << std::setw(8) << "disk" << std::setw(14) << "VCal slope" << std::setw(8) + << "offset" << std::endl; for (it = vcal.begin(); it != vcal.end(); it++) { detid = it->first; slope = it->second.slope; @@ -71,9 +74,10 @@ void SiPixelVCalReader::analyze(const edm::Event& e, const edm::EventSetup& iSet side = tTopo->pxfSide(detIdObj); // 1, 2 disk = tTopo->pxfDisk(detIdObj); // 1, 2, 3 ring = fpix.ringName(); // 1 (lower), 2 (upper) - std::cout << std::setw(12) << detid << std::setw(8) << subdet << std::setw(8) << layer << std::setw(8) << disk - << std::setw(14) << slope << std::setw(8) << offset << std::endl; - // std::cout << "detid " << detid << ", subdet " << subdet << ", layer " << + edm::LogPrint("SiPixelVCalReader") << std::setw(12) << detid << std::setw(8) << subdet << std::setw(8) << layer + << std::setw(8) << disk << std::setw(14) << slope << std::setw(8) << offset + << std::endl; + // edm::LogPrint("SiPixelVCalReader") << "detid " << detid << ", subdet " << subdet << ", layer " << // layer << ", disk " << disk // << ", VCal slope " << slope << ", offset " << offset << // std::endl; @@ -91,3 +95,4 @@ void SiPixelVCalReader::analyze(const edm::Event& e, const edm::EventSetup& iSet tree->Fill(); } } +DEFINE_FWK_MODULE(SiPixelVCalReader); diff --git a/CondTools/SiPixel/test/SiPixelVCalReader.h b/CondTools/SiPixel/plugins/SiPixelVCalReader.h similarity index 59% rename from CondTools/SiPixel/test/SiPixelVCalReader.h rename to CondTools/SiPixel/plugins/SiPixelVCalReader.h index 10e9e679eba73..2a51b71e7d086 100644 --- a/CondTools/SiPixel/test/SiPixelVCalReader.h +++ b/CondTools/SiPixel/plugins/SiPixelVCalReader.h @@ -1,50 +1,47 @@ #ifndef SiPixelVCalReader_H #define SiPixelVCalReader_H -#include -#include -#include // std::setw -#include -#include "FWCore/Framework/interface/EDAnalyzer.h" -#include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "TFile.h" #include "TH2F.h" #include "TROOT.h" #include "TTree.h" -//#include "DataFormats/Common/interface/Handle.h" +#include +#include // std::setw +#include +#include +#include "SiPixelVCalDB.h" #include "DataFormats/DetId/interface/DetId.h" #include "DataFormats/SiPixelDetId/interface/PixelSubdetector.h" #include "DataFormats/TrackerCommon/interface/TrackerTopology.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/ServiceRegistry/interface/Service.h" -//#include "DataFormats/TrackerCommon/interface/PixelEndcapName.h" -//#include "DataFormats/TrackerCommon/interface/PixelBarrelName.h" #include "Geometry/Records/interface/TrackerTopologyRcd.h" -//#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" -//#include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" -//#include "Geometry/CommonDetUnit/interface/PixelGeomDetUnit.h" #include "CommonTools/UtilAlgos/interface/TFileService.h" #include "CondFormats/DataRecord/interface/SiPixelVCalRcd.h" #include "CondFormats/DataRecord/interface/SiPixelVCalSimRcd.h" #include "CondFormats/SiPixelObjects/interface/SiPixelVCal.h" -#include "CondTools/SiPixel/test/SiPixelVCalDB.h" -//#include "CondCore/DBOutputService/interface/PoolDBOutputService.h" -class SiPixelVCalReader : public edm::EDAnalyzer { +class SiPixelVCalReader : public edm::one::EDAnalyzer { public: explicit SiPixelVCalReader(const edm::ParameterSet&); - ~SiPixelVCalReader(); - virtual void beginJob(); - virtual void endJob(); - virtual void analyze(const edm::Event&, const edm::EventSetup&); + ~SiPixelVCalReader() override; + void analyze(const edm::Event&, const edm::EventSetup&) override; private: + const edm::ESGetToken siPixelVCalSimToken_; + const edm::ESGetToken siPixelVCalToken_; + const edm::ESGetToken tkGeomToken_; + const edm::ESGetToken tkTopoToken_; + bool printdebug_; bool useSimRcd_; + TH1F* slopeBPix_; TH1F* slopeFPix_; TH1F* offsetBPix_; diff --git a/CondTools/SiPixel/test/BuildFile.xml b/CondTools/SiPixel/test/BuildFile.xml index 1a39aaf3dda1f..b4207adf1513a 100644 --- a/CondTools/SiPixel/test/BuildFile.xml +++ b/CondTools/SiPixel/test/BuildFile.xml @@ -1,17 +1,3 @@ - - - - - - - - - - - - - - diff --git a/CondTools/SiPixel/test/PixelPopConCalibChecker.cc b/CondTools/SiPixel/test/PixelPopConCalibChecker.cc deleted file mode 100644 index 62592a2257090..0000000000000 --- a/CondTools/SiPixel/test/PixelPopConCalibChecker.cc +++ /dev/null @@ -1,173 +0,0 @@ -// PixelPopConCalibChecker.cc -// -// EDAnalyzer to check calibration configuration objects transferred to database -// -// M. Eads -// Aug 2008 - -#include - -#include "CondTools/SiPixel/test/PixelPopConCalibChecker.h" - -#include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/Framework/interface/ESHandle.h" -#include "CondFormats/SiPixelObjects/interface/SiPixelCalibConfiguration.h" -#include "CondFormats/DataRecord/interface/SiPixelCalibConfigurationRcd.h" -#include "CalibFormats/SiPixelObjects/interface/PixelCalibConfiguration.h" - -using namespace std; - -// -// constructors and destructor -// -PixelPopConCalibChecker::PixelPopConCalibChecker(const edm::ParameterSet& iConfig) - -{ - _filename = iConfig.getParameter("filename"); - _messageLevel = iConfig.getUntrackedParameter("messageLevel", 0); - if (_messageLevel > 0) - cout << "********* PixelPopConCalibChecker ************" << endl; -} - -PixelPopConCalibChecker::~PixelPopConCalibChecker() { - // do anything here that needs to be done at desctruction time - // (e.g. close files, deallocate resources etc.) -} - -// -// member functions -// - -// ------------ method called to for each event ------------ -void PixelPopConCalibChecker::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { - using namespace edm; - - bool isSame = true; - - // get the run and event number from the EmptyIOVSource - if (_messageLevel > 0) { - EventID eventID = iEvent.id(); - cout << "Comparing SiPixelCalibConfiguration object from database for run " << eventID.run() - << " to calib.dat file at " << _filename << endl; - } // if (_messageLevel > 0) - - // get the calib config object in the database from the event setup - ESHandle calibES; - iSetup.get().get(calibES); - - // get the calib config object from the calib.dat file - pos::PixelCalibConfiguration fancyCalib(_filename); - SiPixelCalibConfiguration* calibFile = new SiPixelCalibConfiguration(fancyCalib); - - // check if mode matches - string modeES = calibES->getCalibrationMode(); - string modeFile = calibFile->getCalibrationMode(); - if (_messageLevel > 1) { - cout << "*** Checking calibration mode ***" << endl; - cout << " mode from DB: " << modeES << endl; - cout << " mode from file: " << modeFile << endl; - } - if (modeES != modeFile) { - isSame = false; - if (_messageLevel > 0) { - cout << "Mismatch in calibration mode!" << endl; - cout << " " << modeES << " in database, " << modeFile << " in file" << endl; - } - } - - // check if the number of triggers matches - short ntriggerES = calibES->getNTriggers(); - short ntriggerFile = calibFile->getNTriggers(); - if (_messageLevel > 1) { - cout << "*** Checking number of triggers ***" << endl; - cout << " NTriggers from DB: " << ntriggerES << endl; - cout << " NTriggers from file: " << ntriggerFile << endl; - } - if (ntriggerES != ntriggerFile) { - isSame = false; - if (_messageLevel > 0) { - cout << "Mismatch in number of triggers!" << endl; - cout << " " << ntriggerES << " in database, " << ntriggerFile << " in file" << endl; - } - } - - // check if vcal values match - vector vcalES = calibES->getVCalValues(); - vector vcalFile = calibFile->getVCalValues(); - if (_messageLevel > 1) { - cout << "*** Checking vcal values ***" << endl; - cout << " vcal values from DB: "; - for (vector::const_iterator it = vcalES.begin(); it != vcalES.end(); ++it) - cout << *it << ", "; - cout << endl; - cout << " vcal values from file: "; - for (vector::const_iterator it = vcalFile.begin(); it != vcalFile.end(); ++it) - cout << *it << ", "; - cout << endl; - } - if (vcalES != vcalFile) { - isSame = false; - if (_messageLevel > 0) { - cout << "Mismatch in vcal values!" << endl; - } - } - - // check if column values match - vector colES = calibES->getColumnPattern(); - vector colFile = calibFile->getColumnPattern(); - if (_messageLevel > 1) { - cout << "*** Checking column pattern values ***" << endl; - cout << " column pattern from DB: "; - for (vector::const_iterator it = colES.begin(); it != colES.end(); ++it) - cout << *it << ", "; - cout << endl; - cout << " column pattern from file: "; - for (vector::const_iterator it = colFile.begin(); it != colFile.end(); ++it) - cout << *it << ", "; - cout << endl; - } - if (colES != colFile) { - isSame = false; - if (_messageLevel > 0) { - cout << "Mismatch in column pattern!" << endl; - } - } - - // check if row values match - vector rowES = calibES->getRowPattern(); - vector rowFile = calibFile->getRowPattern(); - if (_messageLevel > 1) { - cout << "*** Checking row pattern values ***" << endl; - cout << " row pattern from DB: "; - for (vector::const_iterator it = rowES.begin(); it != rowES.end(); ++it) - cout << *it << ", "; - cout << endl; - cout << " row pattern from file: "; - for (vector::const_iterator it = rowFile.begin(); it != rowFile.end(); ++it) - cout << *it << ", "; - cout << endl; - } - if (rowES != rowFile) { - isSame = false; - if (_messageLevel > 0) { - cout << "Mismatch in row pattern!" << endl; - } - } - - cout << endl; - if (isSame) { - cout << "*** Calibration configuration in database and file match. Go forth and calibrate." << endl; - } else { - cout << "*** WARNING! Calibration configuration is database and file DO NOT match!" << endl; - } - -} // PixelPopConCalibChecker::analyze() - -void -//PixelPopConCalibChecker::beginJob(const edm::EventSetup&) -PixelPopConCalibChecker::beginJob() {} // void PixelPopConCalibChecker::beginJob(const edm::EventSetup&) - -void PixelPopConCalibChecker::endJob() {} // void PixelPopConCalibChecker::endJob() - -//define this as a plug-in -DEFINE_FWK_MODULE(PixelPopConCalibChecker); diff --git a/CondTools/SiPixel/test/SealModules.cc b/CondTools/SiPixel/test/SealModules.cc deleted file mode 100644 index 1bfeae7957096..0000000000000 --- a/CondTools/SiPixel/test/SealModules.cc +++ /dev/null @@ -1,88 +0,0 @@ -#include "FWCore/Framework/interface/MakerMacros.h" - -#include "CondTools/SiPixel/test/SiPixelCondObjAllPayloadsReader.h" -#include "CondTools/SiPixel/test/SiPixelCondObjBuilder.h" -#include "CondTools/SiPixel/test/SiPixelCondObjForHLTBuilder.h" -#include "CondTools/SiPixel/test/SiPixelCondObjForHLTReader.h" -#include "CondTools/SiPixel/test/SiPixelCondObjOfflineBuilder.h" -#include "CondTools/SiPixel/test/SiPixelCondObjOfflineReader.h" -#include "CondTools/SiPixel/test/SiPixelCondObjReader.h" - -#include "CondTools/SiPixel/test/SiPixelGainCalibrationReadDQMFile.h" -#include "CondTools/SiPixel/test/SiPixelGainCalibrationRejectNoisyAndDead.h" - -#include "CondTools/SiPixel/test/SiPixelBadModuleByHandBuilder.h" -#include "CondTools/SiPixel/test/SiPixelBadModuleReader.h" - -#include "CondTools/SiPixel/test/SiPixelLorentzAngleDB.h" -#include "CondTools/SiPixel/test/SiPixelLorentzAngleReader.h" - -#include "CondTools/SiPixel/test/SiPixelVCalDB.h" -#include "CondTools/SiPixel/test/SiPixelVCalReader.h" - -#include "CondTools/SiPixel/test/SiPixelDynamicInefficiencyDB.h" -#include "CondTools/SiPixel/test/SiPixelDynamicInefficiencyReader.h" - -#include "CondTools/SiPixel/test/SiPixelPerformanceSummaryBuilder.h" -#include "CondTools/SiPixel/test/SiPixelPerformanceSummaryReader.h" - -#include "CondTools/SiPixel/test/SiPixelCPEGenericErrorParmReader.h" -#include "CondTools/SiPixel/test/SiPixelCPEGenericErrorParmUploader.h" -#include "CondTools/SiPixel/test/SiPixelFakeCPEGenericErrorParmSourceReader.h" - -#include "CondTools/SiPixel/test/SiPixelFakeTemplateDBSourceReader.h" -#include "CondTools/SiPixel/test/SiPixelTemplateDBObjectReader.h" -#include "CondTools/SiPixel/test/SiPixelTemplateDBObjectUploader.h" - -#include "CondTools/SiPixel/test/SiPixel2DTemplateDBObjectReader.h" -#include "CondTools/SiPixel/test/SiPixel2DTemplateDBObjectUploader.h" - -#include "CondTools/SiPixel/test/SiPixelFakeGenErrorDBSourceReader.h" -#include "CondTools/SiPixel/test/SiPixelGenErrorDBObjectReader.h" -#include "CondTools/SiPixel/test/SiPixelGenErrorDBObjectUploader.h" - -#include "CondFormats/DataRecord/interface/PixelDCSRcds.h" -#include "CondFormats/SiPixelObjects/interface/PixelDCSObject.h" -#include "CondTools/SiPixel/test/PixelDCSObjectReader.h" - -using cms::SiPixelCondObjAllPayloadsReader; -using cms::SiPixelCondObjBuilder; -using cms::SiPixelCondObjForHLTBuilder; -using cms::SiPixelCondObjForHLTReader; -using cms::SiPixelCondObjOfflineBuilder; -using cms::SiPixelCondObjOfflineReader; -using cms::SiPixelCondObjReader; -using cms::SiPixelPerformanceSummaryBuilder; -using cms::SiPixelPerformanceSummaryReader; - -DEFINE_FWK_MODULE(SiPixelCondObjBuilder); -DEFINE_FWK_MODULE(SiPixelCondObjReader); -DEFINE_FWK_MODULE(SiPixelCondObjForHLTBuilder); -DEFINE_FWK_MODULE(SiPixelCondObjForHLTReader); -DEFINE_FWK_MODULE(SiPixelCondObjOfflineBuilder); -DEFINE_FWK_MODULE(SiPixelCondObjOfflineReader); -DEFINE_FWK_MODULE(SiPixelCondObjAllPayloadsReader); -DEFINE_FWK_MODULE(SiPixelLorentzAngleReader); -DEFINE_FWK_MODULE(SiPixelLorentzAngleDB); -DEFINE_FWK_MODULE(SiPixelVCalReader); -DEFINE_FWK_MODULE(SiPixelVCalDB); -DEFINE_FWK_MODULE(SiPixelDynamicInefficiencyReader); -DEFINE_FWK_MODULE(SiPixelDynamicInefficiencyDB); -DEFINE_FWK_MODULE(SiPixelPerformanceSummaryBuilder); -DEFINE_FWK_MODULE(SiPixelPerformanceSummaryReader); -DEFINE_FWK_MODULE(SiPixelBadModuleByHandBuilder); -DEFINE_FWK_MODULE(SiPixelBadModuleReader); -DEFINE_FWK_MODULE(SiPixelGainCalibrationReadDQMFile); -DEFINE_FWK_MODULE(SiPixelGainCalibrationRejectNoisyAndDead); -DEFINE_FWK_MODULE(SiPixelCPEGenericErrorParmReader); -DEFINE_FWK_MODULE(SiPixelCPEGenericErrorParmUploader); -DEFINE_FWK_MODULE(SiPixelFakeCPEGenericErrorParmSourceReader); -DEFINE_FWK_MODULE(SiPixelTemplateDBObjectReader); -DEFINE_FWK_MODULE(SiPixelTemplateDBObjectUploader); -DEFINE_FWK_MODULE(SiPixelFakeTemplateDBSourceReader); -DEFINE_FWK_MODULE(SiPixel2DTemplateDBObjectUploader); -DEFINE_FWK_MODULE(SiPixel2DTemplateDBObjectReader); -DEFINE_FWK_MODULE(SiPixelGenErrorDBObjectReader); -DEFINE_FWK_MODULE(SiPixelGenErrorDBObjectUploader); -DEFINE_FWK_MODULE(SiPixelFakeGenErrorDBSourceReader); -DEFINE_FWK_MODULE(PixelDCSObjectReader); diff --git a/CondTools/SiPixel/test/SiPixel2DTemplateDBObjectReader.h b/CondTools/SiPixel/test/SiPixel2DTemplateDBObjectReader.h deleted file mode 100644 index f8c74f2aad5ef..0000000000000 --- a/CondTools/SiPixel/test/SiPixel2DTemplateDBObjectReader.h +++ /dev/null @@ -1,41 +0,0 @@ -#ifndef CondTools_SiPixel_SiPixel2DTemplateDBObjectReader_h -#define CondTools_SiPixel_SiPixel2DTemplateDBObjectReader_h - -#include - -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" -#include "FWCore/Framework/interface/ESWatcher.h" - -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/MakerMacros.h" - -#include "FWCore/ParameterSet/interface/ParameterSet.h" - -#include "CondFormats/SiPixelObjects/interface/SiPixel2DTemplateDBObject.h" -#include "CondFormats/DataRecord/interface/SiPixel2DTemplateDBObjectRcd.h" -#include "CalibTracker/Records/interface/SiPixel2DTemplateDBObjectESProducerRcd.h" - -class SiPixel2DTemplateDBObjectReader : public edm::EDAnalyzer { -public: - explicit SiPixel2DTemplateDBObjectReader(const edm::ParameterSet&); - ~SiPixel2DTemplateDBObjectReader(); - -private: - virtual void beginJob(); - virtual void analyze(const edm::Event&, const edm::EventSetup&); - virtual void endJob(); - - edm::ESWatcher SiPix2DTemplDBObjectWatcher_; - edm::ESWatcher SiPix2DTemplDBObjWatcher_; - - std::string the2DTemplateCalibrationLocation; - bool theDetailed2DTemplateDBErrorOutput; - bool theFull2DTemplateDBOutput; - bool testGlobalTag; - - SiPixel2DTemplateDBObject dbobject; - bool hasTriggeredWatcher; -}; - -#endif diff --git a/CondTools/SiPixel/test/SiPixel2DTemplateDBObjectUploader.h b/CondTools/SiPixel/test/SiPixel2DTemplateDBObjectUploader.h deleted file mode 100644 index 9637bb0101fef..0000000000000 --- a/CondTools/SiPixel/test/SiPixel2DTemplateDBObjectUploader.h +++ /dev/null @@ -1,41 +0,0 @@ -#ifndef CondTools_SiPixel_SiPixel2DTemplateDBObjectUploader_h -#define CondTools_SiPixel_SiPixel2DTemplateDBObjectUploader_h - -#include - -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" - -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/MakerMacros.h" -#include "FWCore/Framework/interface/ESHandle.h" - -#include "FWCore/ParameterSet/interface/ParameterSet.h" - -#include "CondFormats/SiPixelObjects/interface/SiPixel2DTemplateDBObject.h" - -class SiPixel2DTemplateDBObjectUploader : public edm::EDAnalyzer { -public: - explicit SiPixel2DTemplateDBObjectUploader(const edm::ParameterSet&); - ~SiPixel2DTemplateDBObjectUploader(); - - typedef std::vector vstring; - -private: - virtual void beginJob(); - virtual void analyze(const edm::Event&, const edm::EventSetup&); - virtual void endJob(); - - vstring theTemplateCalibrations; - std::string theTemplateBaseString; - float theVersion; - float theMagField; - std::vector theDetIds; - vstring theBarrelLocations; - vstring theEndcapLocations; - std::vector theBarrelTemplateIds; - std::vector theEndcapTemplateIds; - bool useVectorIndices; -}; - -#endif diff --git a/CondTools/SiPixel/test/SiPixel2DTemplateDBObjectUploader_Phase2_cfg.py b/CondTools/SiPixel/test/SiPixel2DTemplateDBObjectUploader_Phase2_cfg.py index 6ae575b0c3dd1..27e450ed1e18e 100644 --- a/CondTools/SiPixel/test/SiPixel2DTemplateDBObjectUploader_Phase2_cfg.py +++ b/CondTools/SiPixel/test/SiPixel2DTemplateDBObjectUploader_Phase2_cfg.py @@ -84,7 +84,7 @@ MagFieldString+=magfieldstrsplit[1] #open the map file -mapfile = open(options.Map,'rU', newline='') +mapfile = open(options.Map,'r', newline='') #read the csv file into a reader mapfilereader = csv.reader(mapfile,delimiter=options.Delimiter,quotechar=options.Quotechar) #separate into the different sections diff --git a/CondTools/SiPixel/test/SiPixel2DTemplateDBObjectUploader_cfg.py b/CondTools/SiPixel/test/SiPixel2DTemplateDBObjectUploader_cfg.py index a6fc40f10e65c..2e28e26d311e5 100644 --- a/CondTools/SiPixel/test/SiPixel2DTemplateDBObjectUploader_cfg.py +++ b/CondTools/SiPixel/test/SiPixel2DTemplateDBObjectUploader_cfg.py @@ -1,11 +1,12 @@ import FWCore.ParameterSet.Config as cms import FWCore.ParameterSet.VarParsing as opts import csv +from io import open options = opts.VarParsing ('standard') options.register('MagField', - 3.8, + None, opts.VarParsing.multiplicity.singleton, opts.VarParsing.varType.float, 'Magnetic field value in Tesla') @@ -24,11 +25,6 @@ opts.VarParsing.multiplicity.singleton, opts.VarParsing.varType.string, 'Any additional string to add to the filename, i.e. "bugfix", etc.') -options.register('Fullname', - None, - opts.VarParsing.multiplicity.singleton, - opts.VarParsing.varType.string, - 'The entire filename in case the options above are insufficient, i.e. "SiPixel2DTemplateDBObject_phase1_EoR3_HV600_Tr2000", etc.') options.register('Map', '../data/template2D_phase1_2017_IOV1/IOV1_phase1_map.csv', opts.VarParsing.multiplicity.singleton, @@ -72,47 +68,44 @@ options.parseArguments() if options.numerator==False and options.denominator==False : - print 'ERROR: Neither numerator nor denominator option was selected. Please rerun with numerator/denominator=True options.' + print('ERROR: Neither numerator nor denominator option was selected. Please rerun with numerator/denominator=True options.') quit() if options.numerator==True and options.denominator==True : - print 'ERROR: Both numerator and denominator options are true. Please rerun with only one of numerator/denominator=True.' + print('ERROR: Both numerator and denominator options are true. Please rerun with only one of numerator/denominator=True.') quit() MagFieldValue = 10.*options.MagField #code needs it in deciTesla -print '\nMagField = %f deciTesla \n'%(MagFieldValue) +print('\nMagField = %f deciTesla \n'%(MagFieldValue)) version = options.Version -print'\nVersion = %s \n'%(version) +print('\nVersion = %s \n'%(version)) magfieldstrsplit = str(options.MagField).split('.') MagFieldString = magfieldstrsplit[0] if len(magfieldstrsplit)>1 : MagFieldString+=magfieldstrsplit[1] #open the map file -mapfile = open(options.Map,'rUb') +mapfile = open(options.Map,'r', newline='') #read the csv file into a reader mapfilereader = csv.reader(mapfile,delimiter=options.Delimiter,quotechar=options.Quotechar) #separate into the different sections barrel_rule_lines = []; endcap_rule_lines = [] barrel_exception_lines = []; endcap_exception_lines = [] sections = [barrel_rule_lines, endcap_rule_lines, barrel_exception_lines, endcap_exception_lines] -i=0; line = mapfilereader.next() +i=0; line = next(mapfilereader) for i in range(len(sections)) : - #print 'line = %s (length=%d)'%(line,len(line)) #DEBUG - while len(line)==0 or line[0].find('NUMERATOR TEMPLATE ID')==-1 : #skip to just before the section of info - line=mapfilereader.next() - # print 'line = %s (length=%d)'%(line,len(line)) #DEBUG + while line[0].find('TEMPLATE ID')==-1 : #skip to just before the section of info + line=next(mapfilereader) try : - line=mapfilereader.next() + line=next(mapfilereader) except StopIteration : - print 'Done reading input file' #DEBUG + print('Done reading input file') break - #print 'line2 = %s'%(line) #DEBUG - while len(line)>0 and line[1]!='' : #add the relevant lines to the section + while line[1]!='' : #add the lines that are the barrel rules sections[i].append(line) try : - line=mapfilereader.next() + line=next(mapfilereader) except StopIteration : - print 'Done reading input file' + print('Done reading input file') break #print 'barrel rules = %s\nendcap rules = %s\nbarrel exceptions = %s\nendcap exceptions = %s'%(barrel_rule_lines,endcap_rule_lines,barrel_exception_lines,endcap_exception_lines) #DEBUG #Make the lists of location strings and template IDs @@ -126,7 +119,7 @@ for s in range(len(sections)) : for line in sections[s] : # print 'reading line: %s'%(line) #DEBUG - template_ID_s = line[0] if options.numerator==True else line[1] + template_ID_s = line[0] while len(template_ID_s)<4 : template_ID_s='0'+template_ID_s newtemplatefilename = prefix+template_ID_s+suffix @@ -134,7 +127,7 @@ if not newtemplatefilename in template_filenames : template_filenames.append(newtemplatefilename) if s%2==0 : - lay, lad, mod = line[2], line[3], line[4] + lay, lad, mod = line[1], line[2], line[3] # print ' lay = %s, lad = %s, mod = %s'%(lay, lad, mod) #DEBUG #barrel ID strings are "layer_ladder_module" laysplit = lay.split('-'); firstlay=int(laysplit[0]); lastlay= int(laysplit[1])+1 if len(laysplit)>1 else firstlay+1 @@ -154,7 +147,7 @@ location_index = barrel_locations.index(location_string) barrel_template_IDs[location_index]=template_ID else : - disk, blade, side, panel = line[2], line[3], line[4], line[5] + disk, blade, side, panel = line[1], line[2], line[3], line[4] #endcap ID strings are "disk_blade_side_panel" disksplit = disk.split('-'); firstdisk=int(disksplit[0]); lastdisk = int(disksplit[1])+1 if len(disksplit)>1 else firstdisk+1 for i in range(firstdisk,lastdisk) : @@ -177,9 +170,9 @@ #Debug print out assignments #print 'BARREL ASSIGNMENTS:' #DEBUG #for i in range(len(barrel_locations)) : #DEBUG -# tempid = barrel_template_IDs[i] #DEBUG -# lay, lad, mod = barrel_locations[i].split('_')[0], barrel_locations[i].split('_')[1], barrel_locations[i].split('_')[2] #DEBUG -# print ' layer %s, ladder %s, module %s will have template ID %d assigned to it'%(lay,lad,mod,tempid) #DEBUG + #tempid = barrel_template_IDs[i] #DEBUG + #lay, lad, mod = barrel_locations[i].split('_')[0], barrel_locations[i].split('_')[1], barrel_locations[i].split('_')[2] #DEBUG + #print ' layer %s, ladder %s, module %s will have template ID %d assigned to it'%(lay,lad,mod,tempid) #DEBUG #print 'ENDCAP ASSIGNMENTS:' #DEBUG #for i in range(len(endcap_locations)) : #DEBUG # tempid = endcap_template_IDs[i] #DEBUG @@ -188,7 +181,7 @@ from Configuration.StandardSequences.Eras import eras -process = cms.Process("SiPixel2DTemplateDBUpload",eras.Run2_2017) +process = cms.Process("SiPixel2DTemplateDBUpload",eras.Run2_2017)#C2) process.load("CondCore.CondDB.CondDB_cfi") process.load("FWCore.MessageService.MessageLogger_cfi") process.load('Configuration.Geometry.GeometryExtended2017Reco_cff') @@ -197,71 +190,62 @@ from Configuration.AlCa.GlobalTag import GlobalTag process.GlobalTag = GlobalTag(process.GlobalTag, options.GlobalTag, '') - -template_base='' -if options.Fullname!=None : - template_base=options.Fullname -else : - template_base = 'SiPixel2DTemplateDBObject_phase1_'+MagFieldString+'T_'+options.Year+'_v'+version +template_base = 'SiPixel2DTemplateDBObject_phase1_'+MagFieldString+'T'+'_v'+version if options.numerator==True : template_base+='_num' elif options.denominator==True : template_base+='_den' -if options.Append!=None and options.Fullname==None : +if options.Append!=None : template_base+='_'+options.Append #output SQLite filename sqlitefilename = 'sqlite_file:'+template_base+'.db' -print '\nUploading %s with record SiPixel2DTemplateDBObjectRcd in file %s\n' % (template_base,sqlitefilename) +print('\nUploading %s with record SiPixel2DTemplateDBObjectRcd in file %s\n' % (template_base,sqlitefilename)) process.source = cms.Source("EmptyIOVSource", - timetype = cms.string('runnumber'), - firstValue = cms.uint64(1), - lastValue = cms.uint64(1), - interval = cms.uint64(1) - ) + timetype = cms.string('runnumber'), + firstValue = cms.uint64(1), + lastValue = cms.uint64(1), + interval = cms.uint64(1) + ) process.maxEvents = cms.untracked.PSet(input = cms.untracked.int32(1)) if options.numerator==True : process.PoolDBOutputService = cms.Service("PoolDBOutputService", - DBParameters = cms.PSet(messageLevel = cms.untracked.int32(0), - authenticationPath = cms.untracked.string('.') - ), - timetype = cms.untracked.string('runnumber'), - connect = cms.string(sqlitefilename), - toPut = cms.VPSet( - cms.PSet( - record = cms.string('SiPixel2DTemplateDBObjectRcd'), - tag = cms.string(template_base) - ) - ) - ) + DBParameters = cms.PSet(messageLevel = cms.untracked.int32(0), + authenticationPath = cms.untracked.string('.') + ), + timetype = cms.untracked.string('runnumber'), + connect = cms.string(sqlitefilename), + toPut = cms.VPSet(cms.PSet(record = cms.string('SiPixel2DTemplateDBObjectRcd'), + tag = cms.string(template_base) + ) + ) + ) elif options.denominator==True : process.PoolDBOutputService = cms.Service("PoolDBOutputService", - DBParameters = cms.PSet(messageLevel = cms.untracked.int32(0), - authenticationPath = cms.untracked.string('.') - ), - timetype = cms.untracked.string('runnumber'), - connect = cms.string(sqlitefilename), - toPut = cms.VPSet( - cms.PSet( - record = cms.string('SiPixel2DTemplateDBObjectRcd'), - label=cms.string('unirradiated'), - tag = cms.string(template_base) - ) - ) - ) + DBParameters = cms.PSet(messageLevel = cms.untracked.int32(0), + authenticationPath = cms.untracked.string('.') + ), + timetype = cms.untracked.string('runnumber'), + connect = cms.string(sqlitefilename), + toPut = cms.VPSet(cms.PSet(record = cms.string('SiPixel2DTemplateDBObjectRcd'), + label=cms.string('unirradiated'), + tag = cms.string(template_base) + ) + ) + ) process.uploader = cms.EDAnalyzer("SiPixel2DTemplateDBObjectUploader", - siPixelTemplateCalibrations = cms.vstring(template_filenames), - theTemplateBaseString = cms.string(template_base), - Version = cms.double(3.0), - MagField = cms.double(MagFieldValue), - detIds = cms.vuint32(1,2), #0 is for all, 1 is Barrel, 2 is EndCap - barrelLocations = cms.vstring(barrel_locations), - endcapLocations = cms.vstring(endcap_locations), - barrelTemplateIds = cms.vuint32(barrel_template_IDs), - endcapTemplateIds = cms.vuint32(endcap_template_IDs), - useVectorIndices = cms.untracked.bool(options.useVectorIndices), - ) + siPixelTemplateCalibrations = cms.vstring(template_filenames), + theTemplateBaseString = cms.string(template_base), + Version = cms.double(3.0), + MagField = cms.double(MagFieldValue), + detIds = cms.vuint32(1,2), #0 is for all, 1 is Barrel, 2 is EndCap + barrelLocations = cms.vstring(barrel_locations), + endcapLocations = cms.vstring(endcap_locations), + barrelTemplateIds = cms.vuint32(barrel_template_IDs), + endcapTemplateIds = cms.vuint32(endcap_template_IDs), + useVectorIndices = cms.untracked.bool(options.useVectorIndices), + ) process.myprint = cms.OutputModule("AsciiOutputModule") process.p = cms.Path(process.uploader) process.CondDB.connect = sqlitefilename diff --git a/CondTools/SiPixel/test/SiPixelBadModuleReader.h b/CondTools/SiPixel/test/SiPixelBadModuleReader.h deleted file mode 100644 index f56ecbeefb1f6..0000000000000 --- a/CondTools/SiPixel/test/SiPixelBadModuleReader.h +++ /dev/null @@ -1,41 +0,0 @@ -#ifndef SiPixelBadModuleReader_H -#define SiPixelBadModuleReader_H - -// system include files - -// user include files -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/Framework/interface/ESHandle.h" -#include "FWCore/ServiceRegistry/interface/Service.h" -#include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/Framework/interface/MakerMacros.h" -#include "DataFormats/DetId/interface/DetId.h" -#include "TROOT.h" -#include "TFile.h" -#include "TTree.h" -#include "TBranch.h" -#include "TH2F.h" - -class SiPixelBadModuleReader : public edm::EDAnalyzer { -public: - explicit SiPixelBadModuleReader(const edm::ParameterSet &); - ~SiPixelBadModuleReader(); - - void analyze(const edm::Event &, const edm::EventSetup &); - -private: - uint32_t printdebug_; - std::string whichRcd; - TH2F *_TH2F_dead_modules_BPIX_lay1; - TH2F *_TH2F_dead_modules_BPIX_lay2; - TH2F *_TH2F_dead_modules_BPIX_lay3; - TH2F *_TH2F_dead_modules_FPIX_minusZ_disk1; - TH2F *_TH2F_dead_modules_FPIX_minusZ_disk2; - TH2F *_TH2F_dead_modules_FPIX_plusZ_disk1; - TH2F *_TH2F_dead_modules_FPIX_plusZ_disk2; -}; -#endif diff --git a/CondTools/SiPixel/test/SiPixelBadModuleReader_cfg.py b/CondTools/SiPixel/test/SiPixelBadModuleReader_cfg.py index 94c8876c0de0f..08b8c366eb42f 100644 --- a/CondTools/SiPixel/test/SiPixelBadModuleReader_cfg.py +++ b/CondTools/SiPixel/test/SiPixelBadModuleReader_cfg.py @@ -5,12 +5,7 @@ input = cms.untracked.int32(1) ) process.source = cms.Source("EmptySource", - lastRun = cms.untracked.uint32(85000), - timetype = cms.string('runnumber'), - firstRun = cms.untracked.uint32(85000), - interval = cms.uint32(1) -) - + firstRun = cms.untracked.uint32(1)) process.TFileService = cms.Service("TFileService", fileName = cms.string("histo.root") @@ -27,7 +22,9 @@ process.Timing = cms.Service("Timing") process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff") -process.load("Configuration.StandardSequences.GeometryIdeal_cff") +process.load("Configuration.StandardSequences.GeometryDB_cff") +from Configuration.AlCa.autoCond import autoCond +process.GlobalTag.globaltag = autoCond['run2_design'] process.QualityReader = cms.ESSource("PoolDBESSource", BlobStreamerName = cms.untracked.string('TBufferBlobStreamingService'), @@ -38,9 +35,9 @@ timetype = cms.string('runnumber'), toGet = cms.VPSet(cms.PSet( record = cms.string('SiPixelQualityFromDbRcd'), - tag = cms.string('SiPixelQuality_v03') + tag = cms.string('SiPixelQuality_v07_mc') )), - connect = cms.string('sqlite_file:Quality_v03.db') + connect = cms.string('sqlite_file:prova.db') ) process.es_prefer_QualityReader = cms.ESPrefer("PoolDBESSource","QualityReader") diff --git a/CondTools/SiPixel/test/SiPixelCPEGenericErrorParmReader.cc b/CondTools/SiPixel/test/SiPixelCPEGenericErrorParmReader.cc deleted file mode 100644 index 6ac14b6fc3ef9..0000000000000 --- a/CondTools/SiPixel/test/SiPixelCPEGenericErrorParmReader.cc +++ /dev/null @@ -1,38 +0,0 @@ -#include "CondTools/SiPixel/test/SiPixelCPEGenericErrorParmReader.h" -#include "CondFormats/SiPixelObjects/interface/SiPixelCPEGenericErrorParm.h" -#include "CalibTracker/SiPixelESProducers/interface/SiPixelCPEGenericDBErrorParametrization.h" -#include "FWCore/Framework/interface/ESHandle.h" -#include "FWCore/Framework/interface/EventSetup.h" -#include - -SiPixelCPEGenericErrorParmReader::SiPixelCPEGenericErrorParmReader(const edm::ParameterSet& iConfig) {} - -SiPixelCPEGenericErrorParmReader::~SiPixelCPEGenericErrorParmReader() {} - -void SiPixelCPEGenericErrorParmReader::beginJob() {} - -void SiPixelCPEGenericErrorParmReader::analyze(const edm::Event& iEvent, const edm::EventSetup& setup) { - if (SiPixelCPEGenericErrorParmWatcher_.check(setup)) { - edm::ESHandle errorsH; - setup.get().get(errorsH); - - std::cout << *errorsH.product(); - - //uncomment to test random access - /* SiPixelCPEGenericDBErrorParametrization theErrorGetter; - theErrorGetter.setDBAccess(setup); - std::pair dbentry; - - dbentry = theErrorGetter.getError(GeomDetEnumerators::PixelBarrel, 3, 3, 1.57, 2.72, true, true); - - std::cout << "\n\n\n---------------------------------------------------------------------\n\n" - << "This test was written for version 1.3. We are using version: " << (*errorsH.product()).version() - << "\n\nFor Barrel, size x = 3, size y = 3, alpha = 1.57, beta = 2.72\n" - << "By hand the indices should be for bx and by respectively: 346, 99\n" - << "And the errors should be 0.000289 and 0.003431\nThey are: " - << dbentry.first << " " << dbentry.second << std::endl; - */ - } -} - -void SiPixelCPEGenericErrorParmReader::endJob() {} diff --git a/CondTools/SiPixel/test/SiPixelCPEGenericErrorParmReader.h b/CondTools/SiPixel/test/SiPixelCPEGenericErrorParmReader.h deleted file mode 100644 index 132169b1c9dda..0000000000000 --- a/CondTools/SiPixel/test/SiPixelCPEGenericErrorParmReader.h +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef CondTools_SiPixel_SiPixelCPEGenericErrorParmReader_h -#define CondTools_SiPixel_SiPixelCPEGenericErrorParmReader_h - -#include - -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" -#include "FWCore/Framework/interface/ESWatcher.h" - -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/MakerMacros.h" - -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "CondFormats/DataRecord/interface/SiPixelCPEGenericErrorParmRcd.h" - -class SiPixelCPEGenericErrorParmReader : public edm::EDAnalyzer { -public: - explicit SiPixelCPEGenericErrorParmReader(const edm::ParameterSet&); - ~SiPixelCPEGenericErrorParmReader(); - -private: - virtual void beginJob(); - virtual void analyze(const edm::Event&, const edm::EventSetup&); - virtual void endJob(); - - edm::ESWatcher SiPixelCPEGenericErrorParmWatcher_; -}; - -#endif diff --git a/CondTools/SiPixel/test/SiPixelCPEGenericErrorParmReader_cfg.py b/CondTools/SiPixel/test/SiPixelCPEGenericErrorParmReader_cfg.py deleted file mode 100644 index 3ee8fa63da0e0..0000000000000 --- a/CondTools/SiPixel/test/SiPixelCPEGenericErrorParmReader_cfg.py +++ /dev/null @@ -1,37 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -process = cms.Process("SiPixelCPEGenericErrorParmReaderTest") -process.load("CondCore.DBCommon.CondDBSetup_cfi") -process.load("FWCore.MessageService.MessageLogger_cfi") - -process.source = cms.Source("EmptySource") - -process.maxEvents = cms.untracked.PSet( - input = cms.untracked.int32(1) - ) - -#Uncomment these two lines to get from the global tag -#process.load('Configuration/StandardSequences/FrontierConditions_GlobalTag_cff') -#process.GlobalTag.globaltag = 'IDEAL_30X::All' - -process.PoolDBESSource = cms.ESSource("PoolDBESSource", - process.CondDBSetup, - loadAll = cms.bool(True), - toGet = cms.VPSet(cms.PSet( - record = cms.string('SiPixelCPEGenericErrorParmRcd'), - tag = cms.string('SiPixelCPEGenericErrorParm') - )), - DBParameters = cms.PSet( - messageLevel = cms.untracked.int32(0), - authenticationPath = cms.untracked.string('.') - ), - catalog = cms.untracked.string('file:PoolFileCatalog.xml'), - timetype = cms.string('runnumber'), - connect = cms.string('sqlite_file:siPixelCPEGenericErrorParm.db') - ) - -process.reader = cms.EDAnalyzer("SiPixelCPEGenericErrorParmReader") - -process.myprint = cms.OutputModule("AsciiOutputModule") - -process.p = cms.Path(process.reader) diff --git a/CondTools/SiPixel/test/SiPixelCPEGenericErrorParmUploader.cc b/CondTools/SiPixel/test/SiPixelCPEGenericErrorParmUploader.cc deleted file mode 100644 index 1d1997cb91167..0000000000000 --- a/CondTools/SiPixel/test/SiPixelCPEGenericErrorParmUploader.cc +++ /dev/null @@ -1,39 +0,0 @@ -#include "CondTools/SiPixel/test/SiPixelCPEGenericErrorParmUploader.h" -#include "CondFormats/SiPixelObjects/interface/SiPixelCPEGenericErrorParm.h" - -#include "CondCore/DBOutputService/interface/PoolDBOutputService.h" -#include "FWCore/ServiceRegistry/interface/Service.h" - -#include - -SiPixelCPEGenericErrorParmUploader::SiPixelCPEGenericErrorParmUploader(const edm::ParameterSet& iConfig) - : theFileName(iConfig.getParameter("fileName")), - theVersion(iConfig.getParameter("version")) {} - -SiPixelCPEGenericErrorParmUploader::~SiPixelCPEGenericErrorParmUploader() {} - -void SiPixelCPEGenericErrorParmUploader::beginJob() {} - -void SiPixelCPEGenericErrorParmUploader::analyze(const edm::Event& iEvent, const edm::EventSetup& setup) {} - -void SiPixelCPEGenericErrorParmUploader::endJob() { - //--- Make the POOL-ORA thingy to store the vector of error structs (DbEntry) - SiPixelCPEGenericErrorParm* obj = new SiPixelCPEGenericErrorParm; - obj->fillCPEGenericErrorParm(theVersion, theFileName.fullPath()); - // std::cout << *obj << std::endl; - - //--- Create a new IOV - edm::Service poolDbService; - - if (poolDbService.isAvailable()) { - if (poolDbService->isNewTagRequest("SiPixelCPEGenericErrorParmRcd")) - poolDbService->createNewIOV( - obj, poolDbService->beginOfTime(), poolDbService->endOfTime(), "SiPixelCPEGenericErrorParmRcd"); - else - poolDbService->appendSinceTime( - obj, poolDbService->currentTime(), "SiPixelCPEGenericErrorParmRcd"); - } else { - std::cout << "Pool Service Unavailable" << std::endl; - // &&& throw an exception??? - } -} diff --git a/CondTools/SiPixel/test/SiPixelCPEGenericErrorParmUploader.h b/CondTools/SiPixel/test/SiPixelCPEGenericErrorParmUploader.h deleted file mode 100644 index 205b9694aca7e..0000000000000 --- a/CondTools/SiPixel/test/SiPixelCPEGenericErrorParmUploader.h +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef CondTools_SiPixel_SiPixelCPEGenericErrorParmUploader_h -#define CondTools_SiPixel_SiPixelCPEGenericErrorParmUploader_h - -#include - -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" - -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/MakerMacros.h" - -#include "FWCore/ParameterSet/interface/ParameterSet.h" - -class SiPixelCPEGenericErrorParmUploader : public edm::EDAnalyzer { -public: - explicit SiPixelCPEGenericErrorParmUploader(const edm::ParameterSet&); - ~SiPixelCPEGenericErrorParmUploader(); - -private: - virtual void beginJob(); - virtual void analyze(const edm::Event&, const edm::EventSetup&); - virtual void endJob(); - edm::FileInPath theFileName; - double theVersion; -}; - -#endif diff --git a/CondTools/SiPixel/test/SiPixelCPEGenericErrorParmUploader_cfg.py b/CondTools/SiPixel/test/SiPixelCPEGenericErrorParmUploader_cfg.py deleted file mode 100644 index a19e235490fa9..0000000000000 --- a/CondTools/SiPixel/test/SiPixelCPEGenericErrorParmUploader_cfg.py +++ /dev/null @@ -1,41 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -process = cms.Process("SiPixelCPEGenericErrorParmUploaderTest") -process.load("CondCore.DBCommon.CondDBCommon_cfi") -process.load("FWCore.MessageService.MessageLogger_cfi") - -process.source = cms.Source("EmptyIOVSource", - timetype = cms.string('runnumber'), - firstValue = cms.uint64(1), - lastValue = cms.uint64(1), - interval = cms.uint64(1) - ) - -process.maxEvents = cms.untracked.PSet( - input = cms.untracked.int32(1) - ) - -process.PoolDBOutputService = cms.Service("PoolDBOutputService", - DBParameters = cms.PSet( - messageLevel = cms.untracked.int32(0), - authenticationPath = cms.untracked.string('.') - ), - timetype = cms.untracked.string('runnumber'), - connect = cms.string('sqlite_file:siPixelCPEGenericErrorParm.db'), - toPut = cms.VPSet(cms.PSet( - record = cms.string('SiPixelCPEGenericErrorParmRcd'), - tag = cms.string('SiPixelCPEGenericErrorParm') - )) - ) - -process.uploader = cms.EDAnalyzer("SiPixelCPEGenericErrorParmUploader", - fileName = cms.FileInPath('RecoLocalTracker/SiPixelRecHits/data/residuals.dat'), - version=cms.double(1.3) -) - -process.myprint = cms.OutputModule("AsciiOutputModule") - -process.p = cms.Path(process.uploader) -process.CondDBCommon.connect = 'sqlite_file:siPixelCPEGenericErrorParm.db' -process.CondDBCommon.DBParameters.messageLevel = 0 -process.CondDBCommon.DBParameters.authenticationPath = './' diff --git a/CondTools/SiPixel/test/SiPixelCondObjForHLTBuilder_cfg.py b/CondTools/SiPixel/test/SiPixelCondObjForHLTBuilder_cfg.py index 3ecf4c4834144..c3b611ffe6539 100644 --- a/CondTools/SiPixel/test/SiPixelCondObjForHLTBuilder_cfg.py +++ b/CondTools/SiPixel/test/SiPixelCondObjForHLTBuilder_cfg.py @@ -4,7 +4,7 @@ process.load("Configuration.StandardSequences.MagneticField_cff") #process.load("Geometry.TrackerSimData.trackerSimGeometryXML_cfi") -process.load("Configuration.StandardSequences.Geometry_cff") +process.load("Configuration.StandardSequences.GeometryDB_cff") process.load("Geometry.TrackerGeometryBuilder.trackerGeometry_cfi") process.load("Geometry.TrackerGeometryBuilder.idealForDigiTrackerGeometry_cff") process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff") diff --git a/CondTools/SiPixel/test/SiPixelCondObjForHLTReader_cfg.py b/CondTools/SiPixel/test/SiPixelCondObjForHLTReader_cfg.py index d812254bdd31a..6d9e0f0c3d9e4 100644 --- a/CondTools/SiPixel/test/SiPixelCondObjForHLTReader_cfg.py +++ b/CondTools/SiPixel/test/SiPixelCondObjForHLTReader_cfg.py @@ -4,7 +4,7 @@ process.load("FWCore.MessageService.MessageLogger_cfi") #process.load("Geometry.TrackerSimData.trackerSimGeometryXML_cfi") -process.load("Configuration.StandardSequences.Geometry_cff") +process.load("Configuration.StandardSequences.GeometryDB_cff") process.load("Geometry.TrackerGeometryBuilder.trackerGeometry_cfi") process.load("Geometry.TrackerGeometryBuilder.idealForDigiTrackerGeometry_cff") process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff") diff --git a/CondTools/SiPixel/test/SiPixelCondObjOfflineBuilder_cfg.py b/CondTools/SiPixel/test/SiPixelCondObjOfflineBuilder_cfg.py index 5d341f082810e..2dfdac01d9d95 100644 --- a/CondTools/SiPixel/test/SiPixelCondObjOfflineBuilder_cfg.py +++ b/CondTools/SiPixel/test/SiPixelCondObjOfflineBuilder_cfg.py @@ -4,7 +4,7 @@ process.load("Configuration.StandardSequences.MagneticField_cff") #process.load("Geometry.TrackerSimData.trackerSimGeometryXML_cfi") -process.load("Configuration.StandardSequences.Geometry_cff") +process.load("Configuration.StandardSequences.GeometryDB_cff") process.load("Geometry.TrackerGeometryBuilder.trackerGeometry_cfi") process.load("Geometry.TrackerGeometryBuilder.idealForDigiTrackerGeometry_cff") process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff") diff --git a/CondTools/SiPixel/test/SiPixelCondObjOfflineReader_cfg.py b/CondTools/SiPixel/test/SiPixelCondObjOfflineReader_cfg.py index 9a3efdd0f22ee..263f12884c334 100644 --- a/CondTools/SiPixel/test/SiPixelCondObjOfflineReader_cfg.py +++ b/CondTools/SiPixel/test/SiPixelCondObjOfflineReader_cfg.py @@ -4,7 +4,7 @@ process.load("FWCore.MessageService.MessageLogger_cfi") #process.load("Geometry.TrackerSimData.trackerSimGeometryXML_cfi") -process.load("Configuration.StandardSequences.Geometry_cff") +process.load("Configuration.StandardSequences.GeometryDB_cff") process.load("Geometry.TrackerGeometryBuilder.trackerGeometry_cfi") process.load("Geometry.TrackerGeometryBuilder.idealForDigiTrackerGeometry_cff") process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff") diff --git a/CondTools/SiPixel/test/SiPixelCondObjReader_cfg.py b/CondTools/SiPixel/test/SiPixelCondObjReader_cfg.py index 25c43578d3957..00a988dd5a5a8 100644 --- a/CondTools/SiPixel/test/SiPixelCondObjReader_cfg.py +++ b/CondTools/SiPixel/test/SiPixelCondObjReader_cfg.py @@ -4,7 +4,7 @@ process.load("FWCore.MessageService.MessageLogger_cfi") #process.load("Geometry.TrackerSimData.trackerSimGeometryXML_cfi") -process.load("Configuration.StandardSequences.Geometry_cff") +process.load("Configuration.StandardSequences.GeometryDB_cff") process.load("Geometry.TrackerGeometryBuilder.trackerGeometry_cfi") process.load("Geometry.TrackerGeometryBuilder.idealForDigiTrackerGeometry_cff") process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff") diff --git a/CondTools/SiPixel/test/SiPixelDynamicInefficiencyDB_cfg.py b/CondTools/SiPixel/test/SiPixelDynamicInefficiencyDB_cfg.py index f4bd52f2d531c..dccb9b3a2ce56 100644 --- a/CondTools/SiPixel/test/SiPixelDynamicInefficiencyDB_cfg.py +++ b/CondTools/SiPixel/test/SiPixelDynamicInefficiencyDB_cfg.py @@ -1,5 +1,5 @@ from __future__ import print_function -#import os +import os import shlex, shutil, getpass #import subprocess @@ -50,7 +50,8 @@ #standard python libraries instead of spawn processes -shutil.move("siPixelDynamicInefficiency.db", "siPixelDynamicInefficiency_old.db") +if(os.path.isfile('./'+file)): + shutil.move("siPixelDynamicInefficiency.db", "siPixelDynamicInefficiency_old.db") #subprocess.call(["/bin/cp", "siPixelDynamicInefficiency.db", file]) #subprocess.call(["/bin/mv", "siPixelDynamicInefficiency.db", "siPixelDynamicInefficiency.db"]) diff --git a/CondTools/SiPixel/test/SiPixelFakeCPEGenericErrorParmSourceReader.cc b/CondTools/SiPixel/test/SiPixelFakeCPEGenericErrorParmSourceReader.cc deleted file mode 100644 index f157beae4103e..0000000000000 --- a/CondTools/SiPixel/test/SiPixelFakeCPEGenericErrorParmSourceReader.cc +++ /dev/null @@ -1,25 +0,0 @@ -#include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/Framework/interface/ESHandle.h" - -#include "CondTools/SiPixel/test/SiPixelFakeCPEGenericErrorParmSourceReader.h" -#include "CondFormats/SiPixelObjects/interface/SiPixelCPEGenericErrorParm.h" -#include "CondFormats/DataRecord/interface/SiPixelCPEGenericErrorParmRcd.h" -#include - -SiPixelFakeCPEGenericErrorParmSourceReader::SiPixelFakeCPEGenericErrorParmSourceReader( - const edm::ParameterSet& iConfig) {} - -SiPixelFakeCPEGenericErrorParmSourceReader::~SiPixelFakeCPEGenericErrorParmSourceReader() {} - -void SiPixelFakeCPEGenericErrorParmSourceReader::beginJob() {} - -void SiPixelFakeCPEGenericErrorParmSourceReader::analyze(const edm::Event& iEvent, const edm::EventSetup& setup) { - if (SiPixelCPEGenericErrorParmWatcher_.check(setup)) { - edm::ESHandle errorsH; - setup.get().get(errorsH); - - std::cout << *errorsH << std::endl; - } -} - -void SiPixelFakeCPEGenericErrorParmSourceReader::endJob() {} diff --git a/CondTools/SiPixel/test/SiPixelFakeCPEGenericErrorParmSourceReader.h b/CondTools/SiPixel/test/SiPixelFakeCPEGenericErrorParmSourceReader.h deleted file mode 100644 index d3ecf8d4e75fc..0000000000000 --- a/CondTools/SiPixel/test/SiPixelFakeCPEGenericErrorParmSourceReader.h +++ /dev/null @@ -1,30 +0,0 @@ -#ifndef CondTools_SiPixel_SiPixelFakeCPEGenericErrorParmSourceReader_h -#define CondTools_SiPixel_SiPixelFakeCPEGenericErrorParmSourceReader_h - -#include - -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" -#include "FWCore/Framework/interface/ESWatcher.h" - -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/MakerMacros.h" - -#include "FWCore/ParameterSet/interface/ParameterSet.h" - -#include "CondFormats/DataRecord/interface/SiPixelCPEGenericErrorParmRcd.h" - -class SiPixelFakeCPEGenericErrorParmSourceReader : public edm::EDAnalyzer { -public: - explicit SiPixelFakeCPEGenericErrorParmSourceReader(const edm::ParameterSet&); - ~SiPixelFakeCPEGenericErrorParmSourceReader(); - -private: - virtual void beginJob(); - virtual void analyze(const edm::Event&, const edm::EventSetup&); - virtual void endJob(); - - edm::ESWatcher SiPixelCPEGenericErrorParmWatcher_; -}; - -#endif diff --git a/CondTools/SiPixel/test/SiPixelFakeCPEGenericErrorParmSourceReader_cfg.py b/CondTools/SiPixel/test/SiPixelFakeCPEGenericErrorParmSourceReader_cfg.py deleted file mode 100644 index fae6188f78227..0000000000000 --- a/CondTools/SiPixel/test/SiPixelFakeCPEGenericErrorParmSourceReader_cfg.py +++ /dev/null @@ -1,22 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -process = cms.Process("SiPixelCPEFakeGenericErrorParmSourceReader") - -process.load("FWCore.MessageService.MessageLogger_cfi") - -process.load("CalibTracker.SiPixelESProducers.SiPixelFakeCPEGenericErrorParmESSource_cfi") - -process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(2) ) - -process.source = cms.Source("PoolSource", - # replace 'myfile.root' with the source file you want to use - fileNames = cms.untracked.vstring( - '/store/relval/CMSSW_2_1_9/RelValSingleMuPt10/GEN-SIM-DIGI-RAW-HLTDEBUG-RECO/IDEAL_V9_v2/0000/2A00EECC-A185-DD11-93A9-000423D9517C.root' - ) -) - -process.reader = cms.EDAnalyzer('SiPixelFakeCPEGenericErrorParmSourceReader' -) - - -process.p = cms.Path(process.reader) diff --git a/CondTools/SiPixel/test/SiPixelFakeGenErrorDBSourceReader.cc b/CondTools/SiPixel/test/SiPixelFakeGenErrorDBSourceReader.cc deleted file mode 100644 index d94de600605ce..0000000000000 --- a/CondTools/SiPixel/test/SiPixelFakeGenErrorDBSourceReader.cc +++ /dev/null @@ -1,23 +0,0 @@ -#include "CondTools/SiPixel/test/SiPixelFakeGenErrorDBSourceReader.h" -#include "CondFormats/SiPixelObjects/interface/SiPixelGenErrorDBObject.h" - -#include "FWCore/Framework/interface/ESHandle.h" -#include "FWCore/Framework/interface/EventSetup.h" -#include - -SiPixelFakeGenErrorDBSourceReader::SiPixelFakeGenErrorDBSourceReader(const edm::ParameterSet& iConfig) {} - -SiPixelFakeGenErrorDBSourceReader::~SiPixelFakeGenErrorDBSourceReader() {} - -void SiPixelFakeGenErrorDBSourceReader::beginJob() {} - -void SiPixelFakeGenErrorDBSourceReader::analyze(const edm::Event& iEvent, const edm::EventSetup& setup) { - if (SiPixelGenErrorDBObjectWatcher_.check(setup)) { - edm::ESHandle generrorH; - setup.get().get(generrorH); - - std::cout << *generrorH.product() << std::endl; - } -} - -void SiPixelFakeGenErrorDBSourceReader::endJob() {} diff --git a/CondTools/SiPixel/test/SiPixelFakeGenErrorDBSourceReader.h b/CondTools/SiPixel/test/SiPixelFakeGenErrorDBSourceReader.h deleted file mode 100644 index 3f2cac8e79c27..0000000000000 --- a/CondTools/SiPixel/test/SiPixelFakeGenErrorDBSourceReader.h +++ /dev/null @@ -1,30 +0,0 @@ -#ifndef CondTools_SiPixel_SiPixelFakeGenErrorDBSourceReader_h -#define CondTools_SiPixel_SiPixelFakeGenErrorDBSourceReader_h - -#include - -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" -#include "FWCore/Framework/interface/ESWatcher.h" - -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/MakerMacros.h" - -#include "FWCore/ParameterSet/interface/ParameterSet.h" - -#include "CondFormats/DataRecord/interface/SiPixelGenErrorDBObjectRcd.h" - -class SiPixelFakeGenErrorDBSourceReader : public edm::EDAnalyzer { -public: - explicit SiPixelFakeGenErrorDBSourceReader(const edm::ParameterSet&); - ~SiPixelFakeGenErrorDBSourceReader(); - -private: - virtual void beginJob(); - virtual void analyze(const edm::Event&, const edm::EventSetup&); - virtual void endJob(); - - edm::ESWatcher SiPixelGenErrorDBObjectWatcher_; -}; - -#endif diff --git a/CondTools/SiPixel/test/SiPixelFakeTemplateDBSourceReader.cc b/CondTools/SiPixel/test/SiPixelFakeTemplateDBSourceReader.cc deleted file mode 100644 index 78ab3eb61a6e7..0000000000000 --- a/CondTools/SiPixel/test/SiPixelFakeTemplateDBSourceReader.cc +++ /dev/null @@ -1,23 +0,0 @@ -#include "CondTools/SiPixel/test/SiPixelFakeTemplateDBSourceReader.h" -#include "CondFormats/SiPixelObjects/interface/SiPixelTemplateDBObject.h" - -#include "FWCore/Framework/interface/ESHandle.h" -#include "FWCore/Framework/interface/EventSetup.h" -#include - -SiPixelFakeTemplateDBSourceReader::SiPixelFakeTemplateDBSourceReader(const edm::ParameterSet& iConfig) {} - -SiPixelFakeTemplateDBSourceReader::~SiPixelFakeTemplateDBSourceReader() {} - -void SiPixelFakeTemplateDBSourceReader::beginJob() {} - -void SiPixelFakeTemplateDBSourceReader::analyze(const edm::Event& iEvent, const edm::EventSetup& setup) { - if (SiPixelTemplateDBObjectWatcher_.check(setup)) { - edm::ESHandle templateH; - setup.get().get(templateH); - - std::cout << *templateH.product() << std::endl; - } -} - -void SiPixelFakeTemplateDBSourceReader::endJob() {} diff --git a/CondTools/SiPixel/test/SiPixelFakeTemplateDBSourceReader.h b/CondTools/SiPixel/test/SiPixelFakeTemplateDBSourceReader.h deleted file mode 100644 index 36be290e8dc55..0000000000000 --- a/CondTools/SiPixel/test/SiPixelFakeTemplateDBSourceReader.h +++ /dev/null @@ -1,30 +0,0 @@ -#ifndef CondTools_SiPixel_SiPixelFakeTemplateDBSourceReader_h -#define CondTools_SiPixel_SiPixelFakeTemplateDBSourceReader_h - -#include - -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" -#include "FWCore/Framework/interface/ESWatcher.h" - -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/MakerMacros.h" - -#include "FWCore/ParameterSet/interface/ParameterSet.h" - -#include "CondFormats/DataRecord/interface/SiPixelTemplateDBObjectRcd.h" - -class SiPixelFakeTemplateDBSourceReader : public edm::EDAnalyzer { -public: - explicit SiPixelFakeTemplateDBSourceReader(const edm::ParameterSet&); - ~SiPixelFakeTemplateDBSourceReader(); - -private: - virtual void beginJob(); - virtual void analyze(const edm::Event&, const edm::EventSetup&); - virtual void endJob(); - - edm::ESWatcher SiPixelTemplateDBObjectWatcher_; -}; - -#endif diff --git a/CondTools/SiPixel/test/SiPixelGainCalibScaler_cfg.py b/CondTools/SiPixel/test/SiPixelGainCalibScaler_cfg.py index ebdb27f28ead5..883987ffef159 100644 --- a/CondTools/SiPixel/test/SiPixelGainCalibScaler_cfg.py +++ b/CondTools/SiPixel/test/SiPixelGainCalibScaler_cfg.py @@ -71,7 +71,8 @@ ## ## Empty Source ## -process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(400000)) +print("running over",options.maxEvents, "events") +process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(options.maxEvents)) #################################################################### # Empty source diff --git a/CondTools/SiPixel/test/SiPixelGainCalibrationReadDQMFile_cfg.py b/CondTools/SiPixel/test/SiPixelGainCalibrationReadDQMFile_cfg.py index 7d168952c8e2e..92865be54bbc4 100644 --- a/CondTools/SiPixel/test/SiPixelGainCalibrationReadDQMFile_cfg.py +++ b/CondTools/SiPixel/test/SiPixelGainCalibrationReadDQMFile_cfg.py @@ -2,7 +2,7 @@ process = cms.Process("test") process.load("CondTools.SiPixel.SiPixelGainCalibrationService_cfi") -process.load("Configuration.StandardSequences.Geometry_cff") +process.load("Configuration.StandardSequences.GeometryDB_cff") process.load("Geometry.TrackerGeometryBuilder.trackerGeometry_cfi") process.load("Geometry.TrackerGeometryBuilder.idealForDigiTrackerGeometry_cff") process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff") diff --git a/CondTools/SiPixel/test/SiPixelGainCalibrationRejectNoisyAndDead_cfg.py b/CondTools/SiPixel/test/SiPixelGainCalibrationRejectNoisyAndDead_cfg.py index 0f8286118a90d..8532973109332 100644 --- a/CondTools/SiPixel/test/SiPixelGainCalibrationRejectNoisyAndDead_cfg.py +++ b/CondTools/SiPixel/test/SiPixelGainCalibrationRejectNoisyAndDead_cfg.py @@ -2,7 +2,7 @@ process = cms.Process("test") process.load("CondTools.SiPixel.SiPixelGainCalibrationService_cfi") -process.load("Configuration.StandardSequences.Geometry_cff") +process.load("Configuration.StandardSequences.GeometryDB_cff") process.load("Geometry.TrackerGeometryBuilder.trackerGeometry_cfi") process.load("Geometry.TrackerGeometryBuilder.idealForDigiTrackerGeometry_cff") process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff") diff --git a/CondTools/SiPixel/test/SiPixelGenErrorDBObjectReader.h b/CondTools/SiPixel/test/SiPixelGenErrorDBObjectReader.h deleted file mode 100644 index 3809b58cd6f89..0000000000000 --- a/CondTools/SiPixel/test/SiPixelGenErrorDBObjectReader.h +++ /dev/null @@ -1,39 +0,0 @@ -#ifndef CondTools_SiPixel_SiPixelGenErrorDBObjectReader_h -#define CondTools_SiPixel_SiPixelGenErrorDBObjectReader_h - -#include - -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" -#include "FWCore/Framework/interface/ESWatcher.h" - -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/MakerMacros.h" - -#include "FWCore/ParameterSet/interface/ParameterSet.h" - -#include "CondFormats/SiPixelObjects/interface/SiPixelGenErrorDBObject.h" -#include "CondFormats/DataRecord/interface/SiPixelGenErrorDBObjectRcd.h" -#include "CalibTracker/Records/interface/SiPixelGenErrorDBObjectESProducerRcd.h" - -class SiPixelGenErrorDBObjectReader : public edm::EDAnalyzer { -public: - explicit SiPixelGenErrorDBObjectReader(const edm::ParameterSet&); - ~SiPixelGenErrorDBObjectReader(); - -private: - virtual void beginJob(); - virtual void analyze(const edm::Event&, const edm::EventSetup&); - virtual void endJob(); - - //edm::ESWatcher SiPixGenerDBObjectWatcher_; - //edm::ESWatcher SiPixGenerDBObjWatcher_; - - std::string theGenErrorCalibrationLocation; - bool theDetailedGenErrorDBErrorOutput; - bool theFullGenErrorDBOutput; - //bool testGlobalTag; - SiPixelGenErrorDBObject dbobject; - //bool hasTriggeredWatcher; -}; -#endif diff --git a/CondTools/SiPixel/test/SiPixelGenErrorDBObjectUploader.h b/CondTools/SiPixel/test/SiPixelGenErrorDBObjectUploader.h deleted file mode 100644 index 83106121a1b04..0000000000000 --- a/CondTools/SiPixel/test/SiPixelGenErrorDBObjectUploader.h +++ /dev/null @@ -1,41 +0,0 @@ -#ifndef CondTools_SiPixel_SiPixelGenErrorDBObjectUploader_h -#define CondTools_SiPixel_SiPixelGenErrorDBObjectUploader_h - -#include - -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" - -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/MakerMacros.h" -#include "FWCore/Framework/interface/ESHandle.h" - -#include "FWCore/ParameterSet/interface/ParameterSet.h" - -#include "CondFormats/SiPixelObjects/interface/SiPixelGenErrorDBObject.h" - -class SiPixelGenErrorDBObjectUploader : public edm::EDAnalyzer { -public: - explicit SiPixelGenErrorDBObjectUploader(const edm::ParameterSet&); - ~SiPixelGenErrorDBObjectUploader(); - - typedef std::vector vstring; - -private: - virtual void beginJob(); - virtual void analyze(const edm::Event&, const edm::EventSetup&); - virtual void endJob(); - - vstring theGenErrorCalibrations; - std::string theGenErrorBaseString; - float theVersion; - float theMagField; - std::vector theDetIds; - vstring theBarrelLocations; - vstring theEndcapLocations; - std::vector theBarrelGenErrIds; - std::vector theEndcapGenErrIds; - bool useVectorIndices; -}; - -#endif diff --git a/CondTools/SiPixel/test/SiPixelGenErrorDBObjectUploader_Phase2_cfg.py b/CondTools/SiPixel/test/SiPixelGenErrorDBObjectUploader_Phase2_cfg.py index ef7ee3e120254..708122a16d2da 100644 --- a/CondTools/SiPixel/test/SiPixelGenErrorDBObjectUploader_Phase2_cfg.py +++ b/CondTools/SiPixel/test/SiPixelGenErrorDBObjectUploader_Phase2_cfg.py @@ -72,7 +72,7 @@ MagFieldString+=magfieldstrsplit[1] #open the map file -mapfile = open(options.Map,'rU', newline='') +mapfile = open(options.Map,'r', newline='') #read the csv file into a reader mapfilereader = csv.reader(mapfile,delimiter=options.Delimiter,quotechar=options.Quotechar) #separate into the different sections diff --git a/CondTools/SiPixel/test/SiPixelGenErrorDBObjectUploader_cfg.py b/CondTools/SiPixel/test/SiPixelGenErrorDBObjectUploader_cfg.py index 5391bd00ef1c1..26e7b7aa8b7db 100644 --- a/CondTools/SiPixel/test/SiPixelGenErrorDBObjectUploader_cfg.py +++ b/CondTools/SiPixel/test/SiPixelGenErrorDBObjectUploader_cfg.py @@ -72,7 +72,7 @@ MagFieldString+=magfieldstrsplit[1] #open the map file -mapfile = open(options.Map,'rU', newline='') +mapfile = open(options.Map,'r', newline='') #read the csv file into a reader mapfilereader = csv.reader(mapfile,delimiter=options.Delimiter,quotechar=options.Quotechar) #separate into the different sections diff --git a/CondTools/SiPixel/test/SiPixelLorentzAngleDB_cfg.py b/CondTools/SiPixel/test/SiPixelLorentzAngleDB_cfg.py index ae20854e22503..16e96ab480f3d 100644 --- a/CondTools/SiPixel/test/SiPixelLorentzAngleDB_cfg.py +++ b/CondTools/SiPixel/test/SiPixelLorentzAngleDB_cfg.py @@ -1,5 +1,5 @@ from __future__ import print_function -#import os +import os import shlex, shutil, getpass #import subprocess @@ -9,7 +9,7 @@ process.load("FWCore.MessageService.MessageLogger_cfi") process.MessageLogger.cerr.enable = False -process.MessageLogger.cout = dict(enable = True, threshold = "INFO") +process.MessageLogger.cout = dict(enable = True, threshold = "WARNING") process.load("Configuration.StandardSequences.MagneticField_cff") @@ -22,17 +22,13 @@ print(process.GlobalTag.globaltag) process.load("Configuration.StandardSequences.GeometryDB_cff") -process.load("Geometry.CMSCommonData.cmsIdealGeometryXML_cfi") - +#process.load("Geometry.CMSCommonData.cmsIdealGeometryXML_cfi") #process.load("CalibTracker.Configuration.TrackerAlignment.TrackerAlignment_Fake_cff") - #process.load("Geometry.TrackerGeometryBuilder.trackerGeometry_cfi") - #process.load("Geometry.TrackerNumberingBuilder.trackerNumberingGeometry_cfi") process.load("CondTools.SiPixel.SiPixelGainCalibrationService_cfi") - -process.load("CondCore.DBCommon.CondDBCommon_cfi") +process.load("CondCore.CondDB.CondDB_cfi") process.source = cms.Source("EmptyIOVSource", firstValue = cms.uint64(1), @@ -60,7 +56,8 @@ print('\n-> Uploading as user %s into file %s, i.e. %s\n' % (user, file, sqlfile)) #standard python libraries instead of spawn processes -shutil.move("siPixelLorentzAngle.db", "siPixelLorentzAngle_old.db") +if(os.path.isfile('./'+file)): + shutil.move("siPixelLorentzAngle.db", "siPixelLorentzAngle_old.db") #subprocess.call(["/bin/cp", "siPixelLorentzAngle.db", file]) #subprocess.call(["/bin/mv", "siPixelLorentzAngle.db", "siPixelLorentzAngle.db"]) @@ -86,18 +83,13 @@ tag = cms.string('SiPixelLorentzAngle_2015_v2') #tag = cms.string('SiPixelLorentzAngle_v1') ), -### cms.PSet( -### record = cms.string('SiPixelLorentzAngleSimRcd'), -### tag = cms.string('SiPixelLorentzAngleSim_v1') -### ), - ) + ### cms.PSet( + ### record = cms.string('SiPixelLorentzAngleSimRcd'), + ### tag = cms.string('SiPixelLorentzAngleSim_v1') + ### ), + ) ) - - - - - ###### LORENTZ ANGLE OBJECT ###### process.SiPixelLorentzAngle = cms.EDAnalyzer("SiPixelLorentzAngleDB", magneticField = cms.double(3.8), diff --git a/CondTools/SiPixel/test/SiPixelPerformanceSummaryReader.h b/CondTools/SiPixel/test/SiPixelPerformanceSummaryReader.h deleted file mode 100644 index 0fa0ad9c85d64..0000000000000 --- a/CondTools/SiPixel/test/SiPixelPerformanceSummaryReader.h +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef SiPixelPerformanceSummaryReader_H -#define SiPixelPerformanceSummaryReader_H - -#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/ServiceRegistry/interface/Service.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" - -namespace cms { - class SiPixelPerformanceSummaryReader : public edm::EDAnalyzer { - public: - explicit SiPixelPerformanceSummaryReader(const edm::ParameterSet&); - ~SiPixelPerformanceSummaryReader(); - - void analyze(const edm::Event&, const edm::EventSetup&); - - private: - bool printdebug_; - }; -} // namespace cms - -#endif diff --git a/CondTools/SiPixel/test/SiPixelTemplateDBObjectReader.h b/CondTools/SiPixel/test/SiPixelTemplateDBObjectReader.h deleted file mode 100644 index 295d17283c9f2..0000000000000 --- a/CondTools/SiPixel/test/SiPixelTemplateDBObjectReader.h +++ /dev/null @@ -1,41 +0,0 @@ -#ifndef CondTools_SiPixel_SiPixelTemplateDBObjectReader_h -#define CondTools_SiPixel_SiPixelTemplateDBObjectReader_h - -#include - -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" -#include "FWCore/Framework/interface/ESWatcher.h" - -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/MakerMacros.h" - -#include "FWCore/ParameterSet/interface/ParameterSet.h" - -#include "CondFormats/SiPixelObjects/interface/SiPixelTemplateDBObject.h" -#include "CondFormats/DataRecord/interface/SiPixelTemplateDBObjectRcd.h" -#include "CalibTracker/Records/interface/SiPixelTemplateDBObjectESProducerRcd.h" - -class SiPixelTemplateDBObjectReader : public edm::EDAnalyzer { -public: - explicit SiPixelTemplateDBObjectReader(const edm::ParameterSet&); - ~SiPixelTemplateDBObjectReader(); - -private: - virtual void beginJob(); - virtual void analyze(const edm::Event&, const edm::EventSetup&); - virtual void endJob(); - - edm::ESWatcher SiPixTemplDBObjectWatcher_; - edm::ESWatcher SiPixTemplDBObjWatcher_; - - std::string theTemplateCalibrationLocation; - bool theDetailedTemplateDBErrorOutput; - bool theFullTemplateDBOutput; - bool testGlobalTag; - - SiPixelTemplateDBObject dbobject; - bool hasTriggeredWatcher; -}; - -#endif diff --git a/CondTools/SiPixel/test/SiPixelTemplateDBObjectUploader.h b/CondTools/SiPixel/test/SiPixelTemplateDBObjectUploader.h deleted file mode 100644 index 5bcd2dc826078..0000000000000 --- a/CondTools/SiPixel/test/SiPixelTemplateDBObjectUploader.h +++ /dev/null @@ -1,41 +0,0 @@ -#ifndef CondTools_SiPixel_SiPixelTemplateDBObjectUploader_h -#define CondTools_SiPixel_SiPixelTemplateDBObjectUploader_h - -#include - -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" - -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/MakerMacros.h" -#include "FWCore/Framework/interface/ESHandle.h" - -#include "FWCore/ParameterSet/interface/ParameterSet.h" - -#include "CondFormats/SiPixelObjects/interface/SiPixelTemplateDBObject.h" - -class SiPixelTemplateDBObjectUploader : public edm::EDAnalyzer { -public: - explicit SiPixelTemplateDBObjectUploader(const edm::ParameterSet&); - ~SiPixelTemplateDBObjectUploader(); - - typedef std::vector vstring; - -private: - virtual void beginJob(); - virtual void analyze(const edm::Event&, const edm::EventSetup&); - virtual void endJob(); - - vstring theTemplateCalibrations; - std::string theTemplateBaseString; - float theVersion; - float theMagField; - std::vector theDetIds; - vstring theBarrelLocations; - vstring theEndcapLocations; - std::vector theBarrelTemplateIds; - std::vector theEndcapTemplateIds; - bool useVectorIndices; -}; - -#endif diff --git a/CondTools/SiPixel/test/SiPixelTemplateDBObjectUploader_Phase2_cfg.py b/CondTools/SiPixel/test/SiPixelTemplateDBObjectUploader_Phase2_cfg.py index 0154f094e132f..119156a869565 100644 --- a/CondTools/SiPixel/test/SiPixelTemplateDBObjectUploader_Phase2_cfg.py +++ b/CondTools/SiPixel/test/SiPixelTemplateDBObjectUploader_Phase2_cfg.py @@ -72,7 +72,7 @@ MagFieldString+=magfieldstrsplit[1] #open the map file -mapfile = open(options.Map,'rU', newline='') +mapfile = open(options.Map,'r', newline='') #read the csv file into a reader mapfilereader = csv.reader(mapfile,delimiter=options.Delimiter,quotechar=options.Quotechar) #separate into the different sections diff --git a/CondTools/SiPixel/test/SiPixelTemplateDBObjectUploader_cfg.py b/CondTools/SiPixel/test/SiPixelTemplateDBObjectUploader_cfg.py index c790e271a766f..6f02bfa2ee193 100644 --- a/CondTools/SiPixel/test/SiPixelTemplateDBObjectUploader_cfg.py +++ b/CondTools/SiPixel/test/SiPixelTemplateDBObjectUploader_cfg.py @@ -72,7 +72,7 @@ MagFieldString+=magfieldstrsplit[1] #open the map file -mapfile = open(options.Map,'rU', newline='') +mapfile = open(options.Map,'r', newline='') #read the csv file into a reader mapfilereader = csv.reader(mapfile,delimiter=options.Delimiter,quotechar=options.Quotechar) #separate into the different sections diff --git a/CondTools/SiPixel/test/createTestDBObjects.sh b/CondTools/SiPixel/test/createTestDBObjects.sh index 35eac65cd9c79..493a270040520 100755 --- a/CondTools/SiPixel/test/createTestDBObjects.sh +++ b/CondTools/SiPixel/test/createTestDBObjects.sh @@ -18,3 +18,40 @@ cmsRun ${LOCAL_TEST_DIR}/SiPixelGenErrorDBObjectUploader_Phase2_cfg.py MagField= echo "TESTING Pixel 2D Template DB code for Phase-2 ..." cmsRun ${LOCAL_TEST_DIR}/SiPixel2DTemplateDBObjectUploader_Phase2_cfg.py MagField=3.8 Version=7 Append=mc_25x100 Map=${LOCAL_TEST_DIR}/../data/phase2_T15_mapping.csv TemplateFilePath=CalibTracker/SiPixelESProducers/data/Phase2_25by100_templates_2020October denominator=True || die "Failure running SiPixel2DTemplateDBObjectUploader_Phase2_cfg.py" $? + +echo "TESTING SiPixelVCal DB codes ... \n\n" + +echo "TESTING Writing SiPixelVCal DB object ...\n\n" +cmsRun ${LOCAL_TEST_DIR}/SiPixelVCalDB_cfg.py || die "Failure running SiPixelVCalDB_cfg.py" $? + +echo "TESTING Reading SiPixelVCal DB object ...\n\n" +cmsRun ${LOCAL_TEST_DIR}/SiPixelVCalReader_cfg.py || die "Failure running SiPixelVCalReader_cfg.py" $? + +echo "TESTING SiPixelLorentzAngle DB codes ... \n\n" + +echo "TESTING Writing SiPixelLorentzAngle DB object ...\n\n" +cmsRun ${LOCAL_TEST_DIR}/SiPixelLorentzAngleDB_cfg.py || die "Failure running SiPixelLorentzAngleDB_cfg.py" $? + +echo "TESTING Reading SiPixelLorentzAngle DB object ...\n\n" +cmsRun ${LOCAL_TEST_DIR}/SiPixelLorentzAngleReader_cfg.py || die "Failure running SiPixelLorentzAngleReader_cfg.py" $? + +echo "TESTING SiPixelDynamicInefficiency DB codes ... \n\n" + +echo "TESTING Writing SiPixelDynamicInefficiency DB object ...\n\n" +cmsRun ${LOCAL_TEST_DIR}/SiPixelDynamicInefficiencyDB_cfg.py || die "Failure running SiPixelDynamicInefficiencyDB_cfg.py" $? + +echo "TESTING Reading SiPixelDynamicInefficiency DB object ...\n\n" +cmsRun ${LOCAL_TEST_DIR}/SiPixelDynamicInefficiencyReader_cfg.py || die "Failure running SiPixelDynamicInefficiencyReader_cfg.py" $? + +echo "TESTING SiPixelGain Scaling DB codes ... \n\n" + +echo "TESTING Writing Scaled SiPixel Gain DB Object ...\n\n" +cmsRun ${LOCAL_TEST_DIR}/SiPixelGainCalibScaler_cfg.py firstRun=278869 maxEvents=12000 || die "Failure running SiPixelGainCalibScaler_cfg.py" $? + +echo "TESTING SiPixelQuality DB codes ... \n\n" + +echo "TESTING Writing SiPixelQuality DB object ...\n\n" +cmsRun ${LOCAL_TEST_DIR}/SiPixelBadModuleByHandBuilder_cfg.py || die "Failure running SiPixelBadModuleByHandBuilder_cfg.py" $? + +echo "TESTING Reading SiPixelQuality DB object ...\n\n" +cmsRun ${LOCAL_TEST_DIR}/SiPixelBadModuleReader_cfg.py || die "Failure running SiPixelBadModuleReader_cfg.py" $? diff --git a/CondTools/SiStrip/interface/SiStripCondObjBuilderBase.h b/CondTools/SiStrip/interface/SiStripCondObjBuilderBase.h deleted file mode 100644 index 115599f4b0aef..0000000000000 --- a/CondTools/SiStrip/interface/SiStripCondObjBuilderBase.h +++ /dev/null @@ -1,30 +0,0 @@ -#ifndef CondTools_SiStrip_SiStripCondObjBuilderBase_H -#define CondTools_SiStrip_SiStripCondObjBuilderBase_H - -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include -#include - -template -class SiStripCondObjBuilderBase { -public: - SiStripCondObjBuilderBase(const edm::ParameterSet& pset) : _pset(pset){}; - virtual ~SiStripCondObjBuilderBase() noexcept(false){}; - - virtual void initialize(){}; - - /** Returns MetaData information in a stringstream */ - virtual void getMetaDataString(std::stringstream& ss){}; - - /** Check MetaData information in a stringstream */ - virtual bool checkForCompatibility(std::string ss) { return true; } - - /** Returns the CondObj */ - virtual void getObj(T*& obj){}; - -protected: - T* obj_; - edm::ParameterSet _pset; -}; - -#endif // CondTools_SiStrip_SiStripCondObjBuilderBase_H diff --git a/CondTools/SiStrip/interface/SiStripDepCondObjBuilderBase.h b/CondTools/SiStrip/interface/SiStripDepCondObjBuilderBase.h deleted file mode 100644 index 7e0b86c9b86d2..0000000000000 --- a/CondTools/SiStrip/interface/SiStripDepCondObjBuilderBase.h +++ /dev/null @@ -1,30 +0,0 @@ -#ifndef CondTools_SiStrip_SiStripDepCondObjBuilderBase_H -#define CondTools_SiStrip_SiStripDepCondObjBuilderBase_H - -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include -#include - -template -class SiStripDepCondObjBuilderBase { -public: - SiStripDepCondObjBuilderBase(const edm::ParameterSet& pset) : _pset(pset){}; - virtual ~SiStripDepCondObjBuilderBase(){}; - - virtual void initialize(){}; - - /** Returns MetaData information in a stringstream */ - virtual void getMetaDataString(std::stringstream& ss){}; - - /** Check MetaData information in a stringstream */ - virtual bool checkForCompatibility(std::string ss) { return true; } - - /** Returns the CondObj */ - virtual void getObj(T*& obj, const D* depObj){}; - -protected: - T* obj_; - edm::ParameterSet _pset; -}; - -#endif // CondTools_SiStrip_SiStripDepCondObjBuilderBase_H diff --git a/CondTools/SiStrip/plugins/SiStripApvGainBuilder.h b/CondTools/SiStrip/plugins/SiStripApvGainBuilder.h index 66003cbc5579a..fd6368fb77e77 100644 --- a/CondTools/SiStrip/plugins/SiStripApvGainBuilder.h +++ b/CondTools/SiStrip/plugins/SiStripApvGainBuilder.h @@ -13,7 +13,7 @@ #include "CLHEP/Random/RandFlat.h" #include "CLHEP/Random/RandGauss.h" -class SiStripApvGainBuilder : public edm::EDAnalyzer { +class SiStripApvGainBuilder : public edm::one::EDAnalyzer<> { public: explicit SiStripApvGainBuilder(const edm::ParameterSet& iConfig); diff --git a/CondTools/SiStrip/plugins/SiStripApvGainReader.cc b/CondTools/SiStrip/plugins/SiStripApvGainReader.cc index 2686023b83615..10dec6cca6783 100644 --- a/CondTools/SiStrip/plugins/SiStripApvGainReader.cc +++ b/CondTools/SiStrip/plugins/SiStripApvGainReader.cc @@ -15,6 +15,8 @@ SiStripApvGainReader::SiStripApvGainReader(const edm::ParameterSet& iConfig) formatedOutput_(iConfig.getUntrackedParameter("outputFile", "")), gainType_(iConfig.getUntrackedParameter("gainType", 1)), gainToken_(esConsumes()) { + usesResource(TFileService::kSharedResource); + if (fs_.isAvailable()) { tree_ = fs_->make("Gains", "Gains"); @@ -25,8 +27,6 @@ SiStripApvGainReader::SiStripApvGainReader(const edm::ParameterSet& iConfig) } } -SiStripApvGainReader::~SiStripApvGainReader() {} - void SiStripApvGainReader::analyze(const edm::Event& e, const edm::EventSetup& iSetup) { const auto& stripApvGain = iSetup.getData(gainToken_); edm::LogInfo("SiStripApvGainReader") << "[SiStripApvGainReader::analyze] End Reading SiStripApvGain" << std::endl; diff --git a/CondTools/SiStrip/plugins/SiStripApvGainReader.h b/CondTools/SiStrip/plugins/SiStripApvGainReader.h index 627fee902642b..6551d4184fc81 100644 --- a/CondTools/SiStrip/plugins/SiStripApvGainReader.h +++ b/CondTools/SiStrip/plugins/SiStripApvGainReader.h @@ -6,7 +6,7 @@ // user include files #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/ServiceRegistry/interface/Service.h" @@ -24,10 +24,10 @@ class SiStripGain; -class SiStripApvGainReader : public edm::EDAnalyzer { +class SiStripApvGainReader : public edm::one::EDAnalyzer { public: explicit SiStripApvGainReader(const edm::ParameterSet&); - ~SiStripApvGainReader() override; + ~SiStripApvGainReader() override = default; void analyze(const edm::Event&, const edm::EventSetup&) override; diff --git a/CondTools/SiStrip/plugins/SiStripApvSimulationParametersBuilder.cc b/CondTools/SiStrip/plugins/SiStripApvSimulationParametersBuilder.cc index 6863d9bf59e58..c391b42fb691c 100644 --- a/CondTools/SiStrip/plugins/SiStripApvSimulationParametersBuilder.cc +++ b/CondTools/SiStrip/plugins/SiStripApvSimulationParametersBuilder.cc @@ -22,11 +22,11 @@ void SiStripApvSimulationParametersBuilder::analyze(const edm::Event&, const edm edm::Service mydbservice; if (mydbservice.isAvailable()) { if (mydbservice->isNewTagRequest("SiStripApvSimulationParametersRcd")) { - mydbservice->createNewIOV( - obj.get(), mydbservice->beginOfTime(), mydbservice->endOfTime(), "SiStripApvSimulationParametersRcd"); + mydbservice->createOneIOV( + *obj, mydbservice->beginOfTime(), "SiStripApvSimulationParametersRcd"); } else { - mydbservice->appendSinceTime( - obj.get(), mydbservice->currentTime(), "SiStripApvSimulationParametersRcd"); + mydbservice->appendOneIOV( + *obj, mydbservice->currentTime(), "SiStripApvSimulationParametersRcd"); } } else { edm::LogError("SiStripApvSimulationParametersBuilder") << "Service is unavailable"; diff --git a/CondTools/SiStrip/plugins/SiStripBadChannelBuilder.cc b/CondTools/SiStrip/plugins/SiStripBadChannelBuilder.cc index eea06c86a5bf7..68d1bef917bbe 100644 --- a/CondTools/SiStrip/plugins/SiStripBadChannelBuilder.cc +++ b/CondTools/SiStrip/plugins/SiStripBadChannelBuilder.cc @@ -79,11 +79,9 @@ std::unique_ptr SiStripBadChannelBuilder::getNewObject() { if (mydbservice.isAvailable()) { if (mydbservice->isNewTagRequest("SiStripBadStripRcd")) { - mydbservice->createNewIOV( - obj.get(), mydbservice->beginOfTime(), mydbservice->endOfTime(), "SiStripBadStripRcd"); + mydbservice->createOneIOV(*obj, mydbservice->beginOfTime(), "SiStripBadStripRcd"); } else { - //mydbservice->createNewIOV(obj.get(),mydbservice->currentTime(),"SiStripBadStripRcd"); - mydbservice->appendSinceTime(obj.get(), mydbservice->currentTime(), "SiStripBadStripRcd"); + mydbservice->appendOneIOV(*obj, mydbservice->currentTime(), "SiStripBadStripRcd"); } } else { edm::LogError("SiStripBadStripBuilder") << "Service is unavailable" << std::endl; diff --git a/CondTools/SiStrip/plugins/SiStripBadStripReader.cc b/CondTools/SiStrip/plugins/SiStripBadStripReader.cc index 2bb881dead7ef..320086d35a93c 100644 --- a/CondTools/SiStrip/plugins/SiStripBadStripReader.cc +++ b/CondTools/SiStrip/plugins/SiStripBadStripReader.cc @@ -1,5 +1,5 @@ #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" @@ -11,7 +11,7 @@ #include #include -class SiStripBadStripReader : public edm::EDAnalyzer { +class SiStripBadStripReader : public edm::one::EDAnalyzer<> { public: explicit SiStripBadStripReader(const edm::ParameterSet& iConfig) : printdebug_(iConfig.getUntrackedParameter("printDebug", 1)), badStripToken_(esConsumes()) {} @@ -25,7 +25,7 @@ class SiStripBadStripReader : public edm::EDAnalyzer { edm::ESGetToken badStripToken_; }; -SiStripBadStripReader::~SiStripBadStripReader() {} +SiStripBadStripReader::~SiStripBadStripReader() = default; void SiStripBadStripReader::analyze(const edm::Event& e, const edm::EventSetup& iSetup) { const auto& badStrip = iSetup.getData(badStripToken_); diff --git a/CondTools/SiStrip/plugins/SiStripCablingTrackerMap.cc b/CondTools/SiStrip/plugins/SiStripCablingTrackerMap.cc index e819db9d53025..bb01f2154916a 100644 --- a/CondTools/SiStrip/plugins/SiStripCablingTrackerMap.cc +++ b/CondTools/SiStrip/plugins/SiStripCablingTrackerMap.cc @@ -3,13 +3,10 @@ #include -SiStripCablingTrackerMap::SiStripCablingTrackerMap(edm::ParameterSet const& conf) - : conf_(conf), detCablingToken_(esConsumes()) {} - -SiStripCablingTrackerMap::~SiStripCablingTrackerMap() {} +SiStripCablingTrackerMap::SiStripCablingTrackerMap(edm::ParameterSet const& conf) : detCablingToken_(esConsumes()) {} void SiStripCablingTrackerMap::beginRun(const edm::Run& run, const edm::EventSetup& es) { - tkMap_detCab = new TrackerMap("DetCabling"); + tkMap_detCab = std::make_unique("DetCabling"); } //------------------------------------------------------------------------------------------ diff --git a/CondTools/SiStrip/plugins/SiStripCablingTrackerMap.h b/CondTools/SiStrip/plugins/SiStripCablingTrackerMap.h index b9c0471a003d5..b1ce7ac03f410 100644 --- a/CondTools/SiStrip/plugins/SiStripCablingTrackerMap.h +++ b/CondTools/SiStrip/plugins/SiStripCablingTrackerMap.h @@ -2,7 +2,7 @@ #define SiStripCablingTrackerMap_h #include "FWCore/Utilities/interface/Exception.h" -#include "FWCore/Framework/interface/EDAnalyzer.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" @@ -13,22 +13,20 @@ #include "CalibFormats/SiStripObjects/interface/SiStripDetCabling.h" -class SiStripCablingTrackerMap : public edm::EDAnalyzer { +class SiStripCablingTrackerMap : public edm::one::EDAnalyzer { public: SiStripCablingTrackerMap(const edm::ParameterSet& conf); - ~SiStripCablingTrackerMap() override; + ~SiStripCablingTrackerMap() override = default; void beginRun(const edm::Run& run, const edm::EventSetup& es) override; - void endJob() override; - + void endRun(const edm::Run& run, const edm::EventSetup& es) override{}; void analyze(const edm::Event& e, const edm::EventSetup& c) override; private: - edm::ParameterSet conf_; edm::ESGetToken detCablingToken_; - TrackerMap* tkMap_detCab; //0 for onTrack, 1 for offTrack, 2 for All + std::unique_ptr tkMap_detCab; //0 for onTrack, 1 for offTrack, 2 for All }; #endif diff --git a/CondTools/SiStrip/plugins/SiStripDetVOffFakeBuilder.h b/CondTools/SiStrip/plugins/SiStripDetVOffFakeBuilder.h index c0b0e000a6bbe..8c3957325b1d1 100644 --- a/CondTools/SiStrip/plugins/SiStripDetVOffFakeBuilder.h +++ b/CondTools/SiStrip/plugins/SiStripDetVOffFakeBuilder.h @@ -2,7 +2,7 @@ #define SiStripDetVOff_H #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDAnalyzer.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" @@ -13,7 +13,7 @@ class TrackerGeometry; -class SiStripDetVOffFakeBuilder : public edm::EDAnalyzer { +class SiStripDetVOffFakeBuilder : public edm::one::EDAnalyzer<> { public: explicit SiStripDetVOffFakeBuilder(const edm::ParameterSet& iConfig); diff --git a/CondTools/SiStrip/plugins/SiStripDetVOffReader.cc b/CondTools/SiStrip/plugins/SiStripDetVOffReader.cc index 346c017c81136..c829e0545bdf6 100644 --- a/CondTools/SiStrip/plugins/SiStripDetVOffReader.cc +++ b/CondTools/SiStrip/plugins/SiStripDetVOffReader.cc @@ -9,8 +9,6 @@ SiStripDetVOffReader::SiStripDetVOffReader(const edm::ParameterSet& iConfig) : printdebug_(iConfig.getUntrackedParameter("printDebug", true)), detVOffToken_(esConsumes()) {} -SiStripDetVOffReader::~SiStripDetVOffReader() {} - void SiStripDetVOffReader::analyze(const edm::Event& e, const edm::EventSetup& iSetup) { const auto& detVOff = iSetup.getData(detVOffToken_); edm::LogInfo("SiStripDetVOffReader") << "[SiStripDetVOffReader::analyze] End Reading SiStripDetVOff" << std::endl; diff --git a/CondTools/SiStrip/plugins/SiStripDetVOffReader.h b/CondTools/SiStrip/plugins/SiStripDetVOffReader.h index 82e349f9812c5..ad79ce3b65727 100644 --- a/CondTools/SiStrip/plugins/SiStripDetVOffReader.h +++ b/CondTools/SiStrip/plugins/SiStripDetVOffReader.h @@ -6,7 +6,7 @@ // user include files #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDAnalyzer.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" @@ -24,10 +24,10 @@ class SiStripDetVOff; // // class decleration // -class SiStripDetVOffReader : public edm::EDAnalyzer { +class SiStripDetVOffReader : public edm::one::EDAnalyzer<> { public: explicit SiStripDetVOffReader(const edm::ParameterSet&); - ~SiStripDetVOffReader() override; + ~SiStripDetVOffReader() override = default; void analyze(const edm::Event&, const edm::EventSetup&) override; diff --git a/CondTools/SiStrip/plugins/SiStripFedCablingBuilder.h b/CondTools/SiStrip/plugins/SiStripFedCablingBuilder.h index f98d0523d6ab1..3d29527da4f0e 100644 --- a/CondTools/SiStrip/plugins/SiStripFedCablingBuilder.h +++ b/CondTools/SiStrip/plugins/SiStripFedCablingBuilder.h @@ -4,7 +4,7 @@ #include "FWCore/Utilities/interface/Exception.h" #include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "CondFormats/DataRecord/interface/SiStripFedCablingRcd.h" #include "CalibTracker/Records/interface/SiStripFecCablingRcd.h" #include "CalibTracker/Records/interface/SiStripDetCablingRcd.h" @@ -15,15 +15,15 @@ class SiStripFecCabling; class SiStripDetCabling; class SiStripRegionCabling; -class SiStripFedCablingBuilder : public edm::EDAnalyzer { +class SiStripFedCablingBuilder : public edm::one::EDAnalyzer { public: SiStripFedCablingBuilder(const edm::ParameterSet& iConfig); - ~SiStripFedCablingBuilder() override{}; + ~SiStripFedCablingBuilder() = default; void beginRun(const edm::Run&, const edm::EventSetup&) override; - - void analyze(const edm::Event&, const edm::EventSetup&) override { ; } + void analyze(const edm::Event&, const edm::EventSetup&) override {} + void endRun(const edm::Run&, const edm::EventSetup&) override{}; private: bool printFecCabling_; diff --git a/CondTools/SiStrip/plugins/SiStripFedCablingReader.h b/CondTools/SiStrip/plugins/SiStripFedCablingReader.h index f6a84d0f32172..52f7fd539b246 100644 --- a/CondTools/SiStrip/plugins/SiStripFedCablingReader.h +++ b/CondTools/SiStrip/plugins/SiStripFedCablingReader.h @@ -1,7 +1,7 @@ #ifndef CondTools_SiStrip_FedCablingReader_H #define CondTools_SiStrip_FedCablingReader_H -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" @@ -15,15 +15,14 @@ class SiStripFecCabling; class SiStripDetCabling; class SiStripRegionCabling; -class SiStripFedCablingReader : public edm::EDAnalyzer { +class SiStripFedCablingReader : public edm::one::EDAnalyzer { public: SiStripFedCablingReader(const edm::ParameterSet&); - - ~SiStripFedCablingReader() override { ; } + ~SiStripFedCablingReader() = default; void beginRun(const edm::Run&, const edm::EventSetup&) override; - - void analyze(const edm::Event&, const edm::EventSetup&) override { ; } + void endRun(const edm::Run&, const edm::EventSetup&) override{}; + void analyze(const edm::Event&, const edm::EventSetup&) override{}; private: bool printFecCabling_; diff --git a/CondTools/SiStrip/plugins/SiStripLorentzAngleReader.cc b/CondTools/SiStrip/plugins/SiStripLorentzAngleReader.cc index d282050b19f25..c0553dfa6f591 100644 --- a/CondTools/SiStrip/plugins/SiStripLorentzAngleReader.cc +++ b/CondTools/SiStrip/plugins/SiStripLorentzAngleReader.cc @@ -12,7 +12,6 @@ SiStripLorentzAngleReader::SiStripLorentzAngleReader(const edm::ParameterSet& iC : printdebug_(iConfig.getUntrackedParameter("printDebug", 5)), label_(iConfig.getUntrackedParameter("label", "")), laToken_(esConsumes(edm::ESInputTag{"", label_})) {} -SiStripLorentzAngleReader::~SiStripLorentzAngleReader() {} void SiStripLorentzAngleReader::analyze(const edm::Event& e, const edm::EventSetup& iSetup) { const auto& lorentzAngles = iSetup.getData(laToken_); diff --git a/CondTools/SiStrip/plugins/SiStripLorentzAngleReader.h b/CondTools/SiStrip/plugins/SiStripLorentzAngleReader.h index 84bcb0e1a4a2b..d5b174a101307 100644 --- a/CondTools/SiStrip/plugins/SiStripLorentzAngleReader.h +++ b/CondTools/SiStrip/plugins/SiStripLorentzAngleReader.h @@ -6,7 +6,7 @@ // user include files #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDAnalyzer.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" @@ -21,10 +21,10 @@ class SiStripLorentzAngle; // // class decleration // -class SiStripLorentzAngleReader : public edm::EDAnalyzer { +class SiStripLorentzAngleReader : public edm::one::EDAnalyzer<> { public: explicit SiStripLorentzAngleReader(const edm::ParameterSet&); - ~SiStripLorentzAngleReader() override; + ~SiStripLorentzAngleReader() override = default; void analyze(const edm::Event&, const edm::EventSetup&) override; diff --git a/CondTools/SiStrip/plugins/SiStripNoisesBuilder.h b/CondTools/SiStrip/plugins/SiStripNoisesBuilder.h index fdea4f8990a97..1b2114344fc3f 100644 --- a/CondTools/SiStrip/plugins/SiStripNoisesBuilder.h +++ b/CondTools/SiStrip/plugins/SiStripNoisesBuilder.h @@ -12,7 +12,7 @@ #include "CLHEP/Random/RandFlat.h" #include "CLHEP/Random/RandGauss.h" -class SiStripNoisesBuilder : public edm::EDAnalyzer { +class SiStripNoisesBuilder : public edm::one::EDAnalyzer<> { public: explicit SiStripNoisesBuilder(const edm::ParameterSet& iConfig); diff --git a/CondTools/SiStrip/plugins/SiStripNoisesReader.h b/CondTools/SiStrip/plugins/SiStripNoisesReader.h index d811148f60638..c03e6f6693111 100644 --- a/CondTools/SiStrip/plugins/SiStripNoisesReader.h +++ b/CondTools/SiStrip/plugins/SiStripNoisesReader.h @@ -6,7 +6,7 @@ // user include files #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDAnalyzer.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" @@ -22,7 +22,7 @@ #include #include -class SiStripNoisesReader : public edm::EDAnalyzer { +class SiStripNoisesReader : public edm::one::EDAnalyzer<> { public: explicit SiStripNoisesReader(const edm::ParameterSet&); ~SiStripNoisesReader() override; diff --git a/CondTools/SiStrip/plugins/SiStripPedestalsBuilder.h b/CondTools/SiStrip/plugins/SiStripPedestalsBuilder.h index 3c5ab721e73a1..743d13da60a53 100644 --- a/CondTools/SiStrip/plugins/SiStripPedestalsBuilder.h +++ b/CondTools/SiStrip/plugins/SiStripPedestalsBuilder.h @@ -13,7 +13,7 @@ #include "CLHEP/Random/RandFlat.h" #include "CLHEP/Random/RandGauss.h" -class SiStripPedestalsBuilder : public edm::EDAnalyzer { +class SiStripPedestalsBuilder : public edm::one::EDAnalyzer<> { public: explicit SiStripPedestalsBuilder(const edm::ParameterSet& iConfig); diff --git a/CondTools/SiStrip/plugins/SiStripPedestalsReader.cc b/CondTools/SiStrip/plugins/SiStripPedestalsReader.cc index 1b00144225ece..b528bcd5d2802 100644 --- a/CondTools/SiStrip/plugins/SiStripPedestalsReader.cc +++ b/CondTools/SiStrip/plugins/SiStripPedestalsReader.cc @@ -6,8 +6,6 @@ using namespace cms; SiStripPedestalsReader::SiStripPedestalsReader(const edm::ParameterSet& iConfig) : printdebug_(iConfig.getUntrackedParameter("printDebug", 1)), pedestalsToken_(esConsumes()) {} -SiStripPedestalsReader::~SiStripPedestalsReader() {} - void SiStripPedestalsReader::analyze(const edm::Event& e, const edm::EventSetup& iSetup) { const auto& pedestals = iSetup.getData(pedestalsToken_); edm::LogInfo("SiStripPedestalsReader") << "[SiStripPedestalsReader::analyze] End Reading SiStripPedestals" diff --git a/CondTools/SiStrip/plugins/SiStripPedestalsReader.h b/CondTools/SiStrip/plugins/SiStripPedestalsReader.h index bb25f5b89348a..534f8b7cbfaf3 100644 --- a/CondTools/SiStrip/plugins/SiStripPedestalsReader.h +++ b/CondTools/SiStrip/plugins/SiStripPedestalsReader.h @@ -6,7 +6,7 @@ // user include files #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDAnalyzer.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" @@ -22,10 +22,10 @@ #include #include -class SiStripPedestalsReader : public edm::EDAnalyzer { +class SiStripPedestalsReader : public edm::one::EDAnalyzer<> { public: explicit SiStripPedestalsReader(const edm::ParameterSet&); - ~SiStripPedestalsReader() override; + ~SiStripPedestalsReader() override = default; void analyze(const edm::Event&, const edm::EventSetup&) override; diff --git a/CondTools/SiStrip/plugins/SiStripSummaryBuilder.h b/CondTools/SiStrip/plugins/SiStripSummaryBuilder.h index 7021a5710cb15..ad7c83331bfc3 100644 --- a/CondTools/SiStrip/plugins/SiStripSummaryBuilder.h +++ b/CondTools/SiStrip/plugins/SiStripSummaryBuilder.h @@ -13,7 +13,7 @@ #include "CLHEP/Random/RandFlat.h" #include "CLHEP/Random/RandGauss.h" -class SiStripSummaryBuilder : public edm::EDAnalyzer { +class SiStripSummaryBuilder : public edm::one::EDAnalyzer<> { public: explicit SiStripSummaryBuilder(const edm::ParameterSet& iConfig); diff --git a/CondTools/SiStrip/plugins/SiStripSummaryReader.cc b/CondTools/SiStrip/plugins/SiStripSummaryReader.cc index 8c2a5d8d4ba64..c2a1087d03d42 100644 --- a/CondTools/SiStrip/plugins/SiStripSummaryReader.cc +++ b/CondTools/SiStrip/plugins/SiStripSummaryReader.cc @@ -11,8 +11,6 @@ SiStripSummaryReader::SiStripSummaryReader(const edm::ParameterSet& iConfig) : printdebug_(iConfig.getUntrackedParameter("printDebug", 1)), summaryToken_(esConsumes()) {} -SiStripSummaryReader::~SiStripSummaryReader() {} - void SiStripSummaryReader::analyze(const edm::Event& e, const edm::EventSetup& iSetup) { const auto& summary = iSetup.getData(summaryToken_); edm::LogInfo("SiStripSummaryReader") << "[SiStripSummaryReader::analyze] End Reading SiStripSummary" << std::endl; diff --git a/CondTools/SiStrip/plugins/SiStripSummaryReader.h b/CondTools/SiStrip/plugins/SiStripSummaryReader.h index 1449e8dde99da..f07f9a78137bb 100644 --- a/CondTools/SiStrip/plugins/SiStripSummaryReader.h +++ b/CondTools/SiStrip/plugins/SiStripSummaryReader.h @@ -6,7 +6,7 @@ // user include files #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDAnalyzer.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" @@ -17,10 +17,10 @@ #include "CondFormats/DataRecord/interface/SiStripSummaryRcd.h" class SiStripSummary; -class SiStripSummaryReader : public edm::EDAnalyzer { +class SiStripSummaryReader : public edm::one::EDAnalyzer<> { public: explicit SiStripSummaryReader(const edm::ParameterSet&); - ~SiStripSummaryReader() override; + ~SiStripSummaryReader() override = default; void analyze(const edm::Event&, const edm::EventSetup&) override; diff --git a/CondTools/SiStrip/plugins/SiStripThresholdBuilder.h b/CondTools/SiStrip/plugins/SiStripThresholdBuilder.h index 52a4a6ed9d175..da3cd68576ba6 100644 --- a/CondTools/SiStrip/plugins/SiStripThresholdBuilder.h +++ b/CondTools/SiStrip/plugins/SiStripThresholdBuilder.h @@ -13,7 +13,7 @@ #include "CLHEP/Random/RandFlat.h" #include "CLHEP/Random/RandGauss.h" -class SiStripThresholdBuilder : public edm::EDAnalyzer { +class SiStripThresholdBuilder : public edm::one::EDAnalyzer<> { public: explicit SiStripThresholdBuilder(const edm::ParameterSet& iConfig); diff --git a/CondTools/SiStrip/plugins/SiStripThresholdReader.cc b/CondTools/SiStrip/plugins/SiStripThresholdReader.cc index 14a6a43c69db4..ab8b8c492785b 100644 --- a/CondTools/SiStrip/plugins/SiStripThresholdReader.cc +++ b/CondTools/SiStrip/plugins/SiStripThresholdReader.cc @@ -7,8 +7,6 @@ using namespace cms; SiStripThresholdReader::SiStripThresholdReader(const edm::ParameterSet& iConfig) : printdebug_(iConfig.getUntrackedParameter("printDebug", 3)), thresholdToken_(esConsumes()) {} -SiStripThresholdReader::~SiStripThresholdReader() {} - void SiStripThresholdReader::analyze(const edm::Event& e, const edm::EventSetup& iSetup) { const auto& thresholds = iSetup.getData(thresholdToken_); edm::LogInfo("SiStripThresholdReader") << "[SiStripThresholdReader::analyze] End Reading SiStripThreshold" diff --git a/CondTools/SiStrip/plugins/SiStripThresholdReader.h b/CondTools/SiStrip/plugins/SiStripThresholdReader.h index 32234ec98bb7d..5b15e39e0226a 100644 --- a/CondTools/SiStrip/plugins/SiStripThresholdReader.h +++ b/CondTools/SiStrip/plugins/SiStripThresholdReader.h @@ -6,7 +6,7 @@ // user include files #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDAnalyzer.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" @@ -22,10 +22,10 @@ #include #include -class SiStripThresholdReader : public edm::EDAnalyzer { +class SiStripThresholdReader : public edm::one::EDAnalyzer<> { public: explicit SiStripThresholdReader(const edm::ParameterSet&); - ~SiStripThresholdReader() override; + ~SiStripThresholdReader() override = default; void analyze(const edm::Event&, const edm::EventSetup&) override; diff --git a/CondTools/SiStrip/test/SiStripDetVOffFakeBuilder_cfg.py b/CondTools/SiStrip/test/SiStripDetVOffFakeBuilder_cfg.py index 6d8c5cade745f..c33cd43c3f7aa 100644 --- a/CondTools/SiStrip/test/SiStripDetVOffFakeBuilder_cfg.py +++ b/CondTools/SiStrip/test/SiStripDetVOffFakeBuilder_cfg.py @@ -31,7 +31,7 @@ )) ) -process.load("Configuration.StandardSequences.Geometry_cff") +process.load("Configuration.StandardSequences.GeometryDB_cff") process.TrackerDigiGeometryESModule.applyAlignment = False process.prod = cms.EDAnalyzer("SiStripDetVOffFakeBuilder") diff --git a/CondTools/SiStrip/test/SiStripFedCablingBuilder_cfg.py b/CondTools/SiStrip/test/SiStripFedCablingBuilder_cfg.py index e5c0d47c76984..fd1b07788723e 100644 --- a/CondTools/SiStrip/test/SiStripFedCablingBuilder_cfg.py +++ b/CondTools/SiStrip/test/SiStripFedCablingBuilder_cfg.py @@ -35,7 +35,7 @@ )) ) -process.load("Configuration.StandardSequences.Geometry_cff") +process.load("Configuration.StandardSequences.GeometryDB_cff") process.TrackerDigiGeometryESModule.applyAlignment = False process.SiStripConnectivity = cms.ESProducer("SiStripConnectivity") process.SiStripRegionConnectivity = cms.ESProducer("SiStripRegionConnectivity", diff --git a/CondTools/SiStrip/test/SiStripFedCablingReader_cfg.py b/CondTools/SiStrip/test/SiStripFedCablingReader_cfg.py index 7b5c4bcb10cc2..3c7f757284db1 100644 --- a/CondTools/SiStrip/test/SiStripFedCablingReader_cfg.py +++ b/CondTools/SiStrip/test/SiStripFedCablingReader_cfg.py @@ -33,7 +33,7 @@ )) ) -process.load("Configuration.StandardSequences.Geometry_cff") +process.load("Configuration.StandardSequences.GeometryDB_cff") process.TrackerDigiGeometryESModule.applyAlignment = False process.SiStripConnectivity = cms.ESProducer("SiStripConnectivity") process.SiStripRegionConnectivity = cms.ESProducer("SiStripRegionConnectivity", diff --git a/Configuration/AlCa/python/autoAlca.py b/Configuration/AlCa/python/autoAlca.py index ab1eec7399b72..0fafdd26dacb8 100644 --- a/Configuration/AlCa/python/autoAlca.py +++ b/Configuration/AlCa/python/autoAlca.py @@ -35,7 +35,7 @@ "DoubleMuParked" : "MuAlCalIsolatedMu+MuAlOverlaps+TkAlZMuMu", "MuOniaParked" : "TkAlJpsiMuMu+TkAlUpsilonMuMu", "DoubleElectron" : "EcalCalZElectron+EcalUncalZElectron+HcalCalIsoTrkFilter", - "StreamExpress" : "SiStripCalZeroBias+TkAlMinBias+SiStripPCLHistos+SiStripCalMinBias+SiStripCalMinBiasAAG+Hotline+LumiPixelsMinBias+SiPixelCalZeroBias", + "StreamExpress" : "SiStripCalZeroBias+TkAlMinBias+SiStripPCLHistos+SiStripCalMinBias+SiStripCalMinBiasAAG+Hotline+LumiPixelsMinBias+SiPixelCalZeroBias+SiPixelCalSingleMuon", "StreamExpressHI" : "SiStripCalZeroBias+TkAlMinBiasHI+SiStripPCLHistos+SiStripCalMinBias+SiStripCalMinBiasAAG+SiPixelCalZeroBias" } @@ -124,3 +124,11 @@ def buildList(pdList, matrix): 'allForPromptCosmics' : buildList(['Cosmics'], AlCaRecoMatrix), 'allForExpressCosmics' : buildList(['ExpressCosmics'], AlCaRecoMatrix) } autoAlca.update(AlCaRecoMatrix) + +# list of AlCa sequences that have modules that do not support concurrent LuminosityBlocks +AlCaNoConcurrentLumis = [ + 'PromptCalibProd', # AlcaBeamSpotProducer + 'PromptCalibProdSiPixelAli', # AlignmentProducerAsAnalyzer, MillePedeFileConverter + 'PromptCalibProdBeamSpotHP', # AlcaBeamSpotProducer + 'PromptCalibProdBeamSpotHPLowPU', # AlcaBeamSpotProducer +] diff --git a/Configuration/AlCa/python/autoCond.py b/Configuration/AlCa/python/autoCond.py index dad86350fa96b..108c0b021056f 100644 --- a/Configuration/AlCa/python/autoCond.py +++ b/Configuration/AlCa/python/autoCond.py @@ -2,81 +2,83 @@ ### NEW KEYS ### # GlobalTag for MC production with perfectly aligned and calibrated detector for Run1 - 'run1_design' : '120X_mcRun1_design_v1', + 'run1_design' : '121X_mcRun1_design_v6', # GlobalTag for MC production (pp collisions) with realistic alignment and calibrations for Run1 - 'run1_mc' : '120X_mcRun1_realistic_v1', + 'run1_mc' : '121X_mcRun1_realistic_v6', # GlobalTag for MC production (Heavy Ions collisions) with realistic alignment and calibrations for Run1 - 'run1_mc_hi' : '120X_mcRun1_HeavyIon_v1', + 'run1_mc_hi' : '121X_mcRun1_HeavyIon_v7', # GlobalTag for MC production with pessimistic alignment and calibrations for Run2 - 'run2_mc_50ns' : '120X_mcRun2_startup_v1', + 'run2_mc_50ns' : '121X_mcRun2_startup_v6', # GlobalTag for MC production (2015 L1 Trigger Stage1) with startup-like alignment and calibrations for Run2, L1 trigger in Stage1 mode - 'run2_mc_l1stage1' : '120X_mcRun2_asymptotic_l1stage1_v1', + 'run2_mc_l1stage1' : '121X_mcRun2_asymptotic_l1stage1_v6', # GlobalTag for MC production with perfectly aligned and calibrated detector for Run2 - 'run2_design' : '120X_mcRun2_design_v1', + 'run2_design' : '121X_mcRun2_design_v6', #GlobalTag for MC production with optimistic alignment and calibrations for 2016, prior to VFP change - 'run2_mc_pre_vfp' : '120X_mcRun2_asymptotic_preVFP_v2', + 'run2_mc_pre_vfp' : '121X_mcRun2_asymptotic_preVFP_v6', #GlobalTag for MC production with optimistic alignment and calibrations for 2016, after VFP change - 'run2_mc' : '120X_mcRun2_asymptotic_v2', + 'run2_mc' : '121X_mcRun2_asymptotic_v6', # GlobalTag for MC production (cosmics) with starup-like alignment and calibrations for Run2, Strip tracker in peak mode - 'run2_mc_cosmics' : '120X_mcRun2cosmics_asymptotic_deco_v1', + 'run2_mc_cosmics' : '121X_mcRun2cosmics_asymptotic_deco_v6', # GlobalTag for MC production (Heavy Ions collisions) with optimistic alignment and calibrations for Run2 - 'run2_mc_hi' : '120X_mcRun2_HeavyIon_v1', + 'run2_mc_hi' : '121X_mcRun2_HeavyIon_v6', # GlobalTag for MC production (p-Pb collisions) with realistic alignment and calibrations for Run2 - 'run2_mc_pa' : '120X_mcRun2_pA_v1', + 'run2_mc_pa' : '121X_mcRun2_pA_v6', # GlobalTag for Run2 data reprocessing - 'run2_data' : '120X_dataRun2_v2', + 'run2_data' : '121X_dataRun2_v5', # GlobalTag for Run2 data 2018B relvals only: HEM-15-16 fail - 'run2_data_HEfail' : '120X_dataRun2_HEfail_v1', + 'run2_data_HEfail' : '121X_dataRun2_HEfail_v5', # GlobalTag for Run2 data relvals: allows customization to run with fixed L1 menu - 'run2_data_relval' : '120X_dataRun2_relval_v2', + 'run2_data_relval' : '121X_dataRun2_relval_v5', # GlobalTag for Run2 HI data - 'run2_data_promptlike_hi' : '120X_dataRun2_PromptLike_HI_v1', + 'run2_data_promptlike_hi' : '121X_dataRun2_PromptLike_HI_v5', # GlobalTag for Run3 HLT: it points to the online GT - 'run3_hlt' : '113X_dataRun3_HLT_v3', + 'run3_hlt' : '121X_dataRun3_HLT_v6', # GlobalTag with fixed snapshot time for Run2 HLT RelVals: customizations to run with fixed L1 Menu - 'run2_hlt_relval' : '113X_dataRun2_HLT_relval_v2', + 'run2_hlt_relval' : '121X_dataRun2_HLT_relval_v5', # GlobalTag for Run3 data relvals (express GT) - 'run3_data_express' : '113X_dataRun3_Express_v4', + 'run3_data_express' : '121X_dataRun3_Express_v6', # GlobalTag for Run3 data relvals - 'run3_data_prompt' : '113X_dataRun3_Prompt_v3', + 'run3_data_prompt' : '121X_dataRun3_Prompt_v6', + # GlobalTag for Run3 offline data reprocessing + 'run3_data' : '121X_dataRun3_v5', # GlobalTag for MC production with perfectly aligned and calibrated detector for Phase1 2017 (and 0,0,~0-centred beamspot) - 'phase1_2017_design' : '120X_mc2017_design_v1', + 'phase1_2017_design' : '121X_mc2017_design_v6', # GlobalTag for MC production with realistic conditions for Phase1 2017 detector - 'phase1_2017_realistic' : '120X_mc2017_realistic_v1', + 'phase1_2017_realistic' : '121X_mc2017_realistic_v6', # GlobalTag for MC production with realistic conditions for Phase1 2017 detector, for PP reference run 'phase1_2017_realistic_ppref' : '120X_mc2017_realistic_forppRef5TeV_v2', # GlobalTag for MC production (cosmics) with realistic alignment and calibrations for Phase1 2017 detector, Strip tracker in DECO mode - 'phase1_2017_cosmics' : '120X_mc2017cosmics_realistic_deco_v1', + 'phase1_2017_cosmics' : '121X_mc2017cosmics_realistic_deco_v6', # GlobalTag for MC production (cosmics) with realistic alignment and calibrations for Phase1 2017 detector, Strip tracker in PEAK mode - 'phase1_2017_cosmics_peak' : '120X_mc2017cosmics_realistic_peak_v1', + 'phase1_2017_cosmics_peak' : '121X_mc2017cosmics_realistic_peak_v6', # GlobalTag for MC production with perfectly aligned and calibrated detector for full Phase1 2018 (and 0,0,0-centred beamspot) - 'phase1_2018_design' : '120X_upgrade2018_design_v1', + 'phase1_2018_design' : '121X_upgrade2018_design_v6', # GlobalTag for MC production with realistic conditions for full Phase1 2018 detector - 'phase1_2018_realistic' : '120X_upgrade2018_realistic_v1', + 'phase1_2018_realistic' : '121X_upgrade2018_realistic_v6', # GlobalTag for MC production with realistic run-dependent (RD) conditions for full Phase1 2018 detector - 'phase1_2018_realistic_rd' : '113X_upgrade2018_realistic_RD_v5', + 'phase1_2018_realistic_rd' : '121X_upgrade2018_realistic_RD_v6', # GlobalTag for MC production with realistic conditions for full Phase1 2018 detector for Heavy Ion - 'phase1_2018_realistic_hi' : '120X_upgrade2018_realistic_HI_v1', + 'phase1_2018_realistic_hi' : '121X_upgrade2018_realistic_HI_v6', # GlobalTag for MC production with realistic conditions for full Phase1 2018 detector: HEM-15-16 fail - 'phase1_2018_realistic_HEfail' : '120X_upgrade2018_realistic_HEfail_v1', + 'phase1_2018_realistic_HEfail' : '121X_upgrade2018_realistic_HEfail_v6', # GlobalTag for MC production (cosmics) with realistic conditions for full Phase1 2018 detector, Strip tracker in DECO mode - 'phase1_2018_cosmics' : '120X_upgrade2018cosmics_realistic_deco_v1', + 'phase1_2018_cosmics' : '121X_upgrade2018cosmics_realistic_deco_v8', # GlobalTag for MC production (cosmics) with realistic conditions for full Phase1 2018 detector, Strip tracker in PEAK mode - 'phase1_2018_cosmics_peak' : '120X_upgrade2018cosmics_realistic_peak_v1', + 'phase1_2018_cosmics_peak' : '121X_upgrade2018cosmics_realistic_peak_v6', # GlobalTag for MC production with perfectly aligned and calibrated detector for Phase1 2021 - 'phase1_2021_design' : '121X_mcRun3_2021_design_v1', # GT containing design conditions for Phase1 2021 + 'phase1_2021_design' : '121X_mcRun3_2021_design_v10', # GlobalTag for MC production with realistic conditions for Phase1 2021 - 'phase1_2021_realistic' : '121X_mcRun3_2021_realistic_v1', # GT containing realistic conditions for Phase1 2021 + 'phase1_2021_realistic' : '121X_mcRun3_2021_realistic_v12', # GlobalTag for MC production (cosmics) with realistic conditions for Phase1 2021, Strip tracker in DECO mode - 'phase1_2021_cosmics' : '121X_mcRun3_2021cosmics_realistic_deco_v1', + 'phase1_2021_cosmics' : '121X_mcRun3_2021cosmics_realistic_deco_v12', # GlobalTag for MC production with realistic conditions for Phase1 2021 detector for Heavy Ion - 'phase1_2021_realistic_hi' : '121X_mcRun3_2021_realistic_HI_v1', + 'phase1_2021_realistic_hi' : '121X_mcRun3_2021_realistic_HI_v12', # GlobalTag for MC production with realistic conditions for Phase1 2023 - 'phase1_2023_realistic' : '121X_mcRun3_2023_realistic_v1', # GT containing realistic conditions for Phase1 2023 + 'phase1_2023_realistic' : '121X_mcRun3_2023_realistic_v11', # GlobalTag for MC production with realistic conditions for Phase1 2024 - 'phase1_2024_realistic' : '121X_mcRun3_2024_realistic_v1', # GT containing realistic conditions for Phase1 2024 + 'phase1_2024_realistic' : '121X_mcRun3_2024_realistic_v11', # GlobalTag for MC production with realistic conditions for Phase2 - 'phase2_realistic' : '113X_mcRun4_realistic_v7' + 'phase2_realistic' : '121X_mcRun4_realistic_v6' } aliases = { @@ -106,6 +108,10 @@ from Configuration.AlCa.autoCondModifiers import autoCondHLTHI autoCond = autoCondHLTHI(autoCond) +# special GT for 2021 DD4HEP geometry +from Configuration.AlCa.autoCondModifiers import autoCondDD4HEP +autoCond = autoCondDD4HEP(autoCond) + ### OLD KEYS ### kept for backward compatibility # GlobalTag for MC production with perfectly aligned and calibrated detector autoCond['mc'] = ( autoCond['run1_design'] ) diff --git a/Configuration/AlCa/python/autoCondModifiers.py b/Configuration/AlCa/python/autoCondModifiers.py index bb90f15a9876c..710fe1b75213d 100644 --- a/Configuration/AlCa/python/autoCondModifiers.py +++ b/Configuration/AlCa/python/autoCondModifiers.py @@ -30,3 +30,44 @@ def autoCondHLTHI(autoCond): autoCond.update(GlobalTagsHLTHI) return autoCond + +def autoCondDD4HEP(autoCond): + + GlobalTagsDDHEP = {} + # substitute the DDD geometry tags with DD4HEP ones + CSCRECODIGI_Geometry_dd4hep = ','.join( ['CSCRECODIGI_Geometry_120DD4hepV1' , "CSCRecoDigiParametersRcd", connectionString, "", "2021-09-28 12:00:00.000"] ) + CSCRECO_Geometry_dd4hep = ','.join( ['CSCRECO_Geometry_120DD4hepV1' , "CSCRecoGeometryRcd" , connectionString, "", "2021-09-28 12:00:00.000"] ) + DTRECO_Geometry_dd4hep = ','.join( ['DTRECO_Geometry_120DD4hepV1' , "DTRecoGeometryRcd" , connectionString, "", "2021-09-28 12:00:00.000"] ) + GEMRECO_Geometry_dd4hep = ','.join( ['GEMRECO_Geometry_120DD4hepV1' , "GEMRecoGeometryRcd" , connectionString, "", "2021-09-28 12:00:00.000"] ) + XMLFILE_Geometry_dd4hep = ','.join( ['XMLFILE_Geometry_121DD4hepV1_Extended2021_mc', "GeometryFileRcd" , connectionString, "Extended", "2021-09-28 12:00:00.000"] ) + HCALParameters_Geometry_dd4hep = ','.join( ['HCALParameters_Geometry_120DD4hepV1' , "HcalParametersRcd" , connectionString, "", "2021-09-28 12:00:00.000"] ) + TKRECO_Geometry_dd4hep = ','.join( ['TKRECO_Geometry_121DD4hepV1' , "IdealGeometryRecord" , connectionString, "", "2021-09-28 12:00:00.000"] ) + CTRECO_Geometry_dd4hep = ','.join( ['CTRECO_Geometry_120DD4hepV1' , "PCaloTowerRcd" , connectionString, "", "2021-09-28 12:00:00.000"] ) + EBRECO_Geometry_dd4hep = ','.join( ['EBRECO_Geometry_120DD4hepV1' , "PEcalBarrelRcd" , connectionString, "", "2021-09-28 12:00:00.000"] ) + EERECO_Geometry_dd4hep = ','.join( ['EERECO_Geometry_120DD4hepV1' , "PEcalEndcapRcd" , connectionString, "", "2021-09-28 12:00:00.000"] ) + EPRECO_Geometry_dd4hep = ','.join( ['EPRECO_Geometry_120DD4hepV1' , "PEcalPreshowerRcd" , connectionString, "", "2021-09-28 12:00:00.000"] ) + HCALRECO_Geometry_dd4hep = ','.join( ['HCALRECO_Geometry_120DD4hepV1' , "PHcalRcd" , connectionString, "", "2021-09-28 12:00:00.000"] ) + TKParameters_Geometry_dd4hep = ','.join( ['TKParameters_Geometry_120DD4hepV1' , "PTrackerParametersRcd" , connectionString, "", "2021-09-28 12:00:00.000"] ) + ZDCRECO_Geometry_dd4hep = ','.join( ['ZDCRECO_Geometry_120DD4hepV1' , "PZdcRcd" , connectionString, "", "2021-09-28 12:00:00.000"] ) + RPCRECO_Geometry_dd4hep = ','.join( ['RPCRECO_Geometry_120DD4hepV1' , "RPCRecoGeometryRcd" , connectionString, "", "2021-09-28 12:00:00.000"] ) + + for key,val in autoCond.items(): + if key == 'phase1_2021_realistic': # modification of the DD4HEP relval GT + GlobalTagsDDHEP['phase1_2021_dd4hep'] = (autoCond[key], + CSCRECODIGI_Geometry_dd4hep, + CSCRECO_Geometry_dd4hep, + DTRECO_Geometry_dd4hep, + GEMRECO_Geometry_dd4hep, + XMLFILE_Geometry_dd4hep, + HCALParameters_Geometry_dd4hep, + TKRECO_Geometry_dd4hep, + CTRECO_Geometry_dd4hep, + EBRECO_Geometry_dd4hep, + EERECO_Geometry_dd4hep, + EPRECO_Geometry_dd4hep, + HCALRECO_Geometry_dd4hep, + TKParameters_Geometry_dd4hep, + ZDCRECO_Geometry_dd4hep, + RPCRECO_Geometry_dd4hep) + autoCond.update(GlobalTagsDDHEP) + return autoCond diff --git a/Configuration/AlCa/python/autoPCL.py b/Configuration/AlCa/python/autoPCL.py index e2825741730a0..c39f1fadff178 100644 --- a/Configuration/AlCa/python/autoPCL.py +++ b/Configuration/AlCa/python/autoPCL.py @@ -3,10 +3,13 @@ 'PromptCalibProdBeamSpotHPLowPU' : 'BeamSpotHPLowPUByRun+BeamSpotHPLowPUByLumi', 'PromptCalibProdSiStrip' : 'SiStripQuality', 'PromptCalibProdSiStripGains' : 'SiStripGains', + 'PromptCalibProdSiStripGainsAAG' : 'SiStripGainsAAG', 'PromptCalibProdSiPixelAli' : 'SiPixelAli', + 'PromptCalibProdSiPixel' : 'SiPixelQuality', + 'PromptCalibProdSiPixelLA' : 'SiPixelLA', 'PromptCalibProdEcalPedestals': 'EcalPedestals', - 'PromptCalibProdSiStripGainsAAG' : 'SiStripGainsAAG', 'PromptCalibProdLumiPCC': 'LumiPCC', - 'PromptCalibProdSiPixel' : 'SiPixelQuality', - 'PromptCalibProdPPS' : 'PPSTimingCalibration' + 'PromptCalibProdPPS' : 'PPSTimingCalibration', + 'PromptCalibProdPPSDiamondSampic' : 'PPSDiamondSampicTimingCalibration', + 'PromptCalibProdPPSAlig' : 'PPSAlignment' } diff --git a/Configuration/Applications/python/ConfigBuilder.py b/Configuration/Applications/python/ConfigBuilder.py index ab050086b91ab..4c40035cdb79e 100644 --- a/Configuration/Applications/python/ConfigBuilder.py +++ b/Configuration/Applications/python/ConfigBuilder.py @@ -302,8 +302,8 @@ def profileOptions(self): profilerFormat = "%s___%s___%%I.gz" % ( self._options.evt_type.replace("_cfi", ""), hashlib.md5( - str(self._options.step) + str(self._options.pileup) + str(self._options.conditions) + - str(self._options.datatier) + str(self._options.profileTypeLabel) + (str(self._options.step) + str(self._options.pileup) + str(self._options.conditions) + + str(self._options.datatier) + str(self._options.profileTypeLabel)).encode('utf-8') ).hexdigest() ) if not profilerJobFormat and profilerFormat.endswith(".gz"): @@ -1151,7 +1151,7 @@ def inGeometryKeys(opt): self.REDIGIDefaultSeq=self.DIGIDefaultSeq # for alca, skims, etc - def addExtraStream(self,name,stream,workflow='full'): + def addExtraStream(self, name, stream, workflow='full'): # define output module and go from there output = cms.OutputModule("PoolOutputModule") if stream.selectEvents.parameters_().__len__()!=0: @@ -1275,7 +1275,7 @@ def prepare_ALCA(self, sequence = None, workflow = 'full'): # decide which ALCA paths to use alcaList = sequence.split("+") maxLevel=0 - from Configuration.AlCa.autoAlca import autoAlca + from Configuration.AlCa.autoAlca import autoAlca, AlCaNoConcurrentLumis # support @X from autoAlca.py, and recursion support: i.e T0:@Mu+@EG+... self.expandMapping(alcaList,autoAlca) self.AlCaPaths=[] @@ -1283,6 +1283,10 @@ def prepare_ALCA(self, sequence = None, workflow = 'full'): alcastream = getattr(alcaConfig,name) shortName = name.replace('ALCARECOStream','') if shortName in alcaList and isinstance(alcastream,cms.FilteredStream): + if shortName in AlCaNoConcurrentLumis: + print("Setting numberOfConcurrentLuminosityBlocks=1 because of AlCa sequence {}".format(shortName)) + self._options.nConcurrentLumis = "1" + self._options.nConcurrentIOVs = "1" output = self.addExtraStream(name,alcastream, workflow = workflow) self.executeAndRemember('process.ALCARECOEventContent.outputCommands.extend(process.OutALCARECO'+shortName+'_noDrop.outputCommands)') self.AlCaPaths.append(shortName) @@ -1364,6 +1368,8 @@ def prepare_GEN(self, sequence = None): raise Exception("Neither gen fragment of input files provided: this is an inconsistent GEN step configuration") if not loadFailure: + from Configuration.Generator.concurrentLumisDisable import noConcurrentLumiGenerators + generatorModule=sys.modules[loadFragment] genModules=generatorModule.__dict__ #remove lhe producer module since this should have been @@ -1381,6 +1387,10 @@ def prepare_GEN(self, sequence = None): theObject = getattr(generatorModule,name) if isinstance(theObject, cmstypes._Module): self._options.inlineObjets=name+','+self._options.inlineObjets + if theObject.type_() in noConcurrentLumiGenerators: + print("Setting numberOfConcurrentLuminosityBlocks=1 because of generator {}".format(theObject.type_())) + self._options.nConcurrentLumis = "1" + self._options.nConcurrentIOVs = "1" elif isinstance(theObject, cms.Sequence) or isinstance(theObject, cmstypes.ESProducer): self._options.inlineObjets+=','+name @@ -2124,7 +2134,9 @@ def create_process(self): if hasattr(self._options,"procModifiers") and self._options.procModifiers: import importlib thingsImported=[] - for pm in self._options.procModifiers.split(','): + for c in self._options.procModifiers: + thingsImported.extend(c.split(",")) + for pm in thingsImported: modifierStrings.append(pm) modifierImports.append('from Configuration.ProcessModifiers.'+pm+'_cff import '+pm) modifiers.append(getattr(importlib.import_module('Configuration.ProcessModifiers.'+pm+'_cff'),pm)) diff --git a/Configuration/Applications/python/Options.py b/Configuration/Applications/python/Options.py index 0c5e39fe1f44c..75de94c79c1df 100644 --- a/Configuration/Applications/python/Options.py +++ b/Configuration/Applications/python/Options.py @@ -363,7 +363,8 @@ expertSettings.add_option("--procModifiers", help="Specify any process Modifiers to include (in Configuration/ProcessModiers) - comma separated list", - default=None, + default=[], + action="append", dest="procModifiers") expertSettings.add_option("--evt_type", diff --git a/Configuration/Applications/python/cmsDriverOptions.py b/Configuration/Applications/python/cmsDriverOptions.py index 6d3643231cdb5..ba8fc6e6442ed 100755 --- a/Configuration/Applications/python/cmsDriverOptions.py +++ b/Configuration/Applications/python/cmsDriverOptions.py @@ -72,13 +72,6 @@ def OptionsFromItems(items): #now adjust the given parameters before passing it to the ConfigBuilder - # concurrency options - nStreams = options.nStreams if options.nStreams != '0' else options.nThreads - if options.nConcurrentLumis == '0': - options.nConcurrentLumis = '1' if nStreams == '1' else '2' - if options.nConcurrentIOVs == '0': - options.nConcurrentIOVs = options.nConcurrentLumis - #trail a "/" to dirin and dirout if options.dirin!='' and (not options.dirin.endswith('/')): options.dirin+='/' if options.dirout!='' and (not options.dirout.endswith('/')): options.dirout+='/' diff --git a/Configuration/DataProcessing/python/RecoTLR.py b/Configuration/DataProcessing/python/RecoTLR.py index 8396ff1d71711..bfc099512a375 100644 --- a/Configuration/DataProcessing/python/RecoTLR.py +++ b/Configuration/DataProcessing/python/RecoTLR.py @@ -5,6 +5,11 @@ # common utilities ############################################################################## def _swapOfflineBSwithOnline(process): + import RecoVertex.BeamSpotProducer.onlineBeamSpotESProducer_cfi as _mod + process.BeamSpotESProducer = _mod.onlineBeamSpotESProducer.clone( + timeThreshold = 999999 # for express allow >48h old payloads for replays. DO NOT CHANGE + ) + from RecoVertex.BeamSpotProducer.BeamSpotOnline_cfi import onlineBeamSpotProducer process.offlineBeamSpot = onlineBeamSpotProducer.clone() return process diff --git a/Configuration/DataProcessing/test/run_CfgTest.sh b/Configuration/DataProcessing/test/run_CfgTest.sh index ad04c1d7c2db6..9d09dbb9e99a3 100755 --- a/Configuration/DataProcessing/test/run_CfgTest.sh +++ b/Configuration/DataProcessing/test/run_CfgTest.sh @@ -21,6 +21,12 @@ do runTest "${LOCAL_TEST_DIR}/RunAlcaHarvesting.py --scenario $scenario --lfn /store/whatever --dataset /A/B/C --global-tag GLOBALTAG --workflows=BeamSpotByRun,BeamSpotByLumi,SiStripQuality" done +declare -a arr=("cosmicsEra_Run2_2018" "cosmicsHybridEra_Run2_2018" "cosmicsEra_Run3") +for scenario in "${arr[@]}" +do + runTest "${LOCAL_TEST_DIR}/RunExpressProcessing.py --scenario $scenario --global-tag GLOBALTAG --lfn /store/whatever --fevt --dqmio --alcareco SiStripCalCosmicsNano " +done + declare -a arr=("HeavyIonsEra_Run2_2018") for scenario in "${arr[@]}" do diff --git a/Configuration/Eras/python/Era_Phase2C11I13T27M9_cff.py b/Configuration/Eras/python/Era_Phase2C11I13T27M9_cff.py new file mode 100644 index 0000000000000..fe23d8f75b23e --- /dev/null +++ b/Configuration/Eras/python/Era_Phase2C11I13T27M9_cff.py @@ -0,0 +1,7 @@ +import FWCore.ParameterSet.Config as cms + +from Configuration.Eras.Era_Phase2C11I13_cff import Phase2C11I13 +from Configuration.Eras.Modifier_phase2_brickedPixels_cff import phase2_brickedPixels +from Configuration.Eras.Modifier_phase2_GE0_cff import phase2_GE0 + +Phase2C11I13T27M9 = cms.ModifierChain(Phase2C11I13, phase2_brickedPixels, phase2_GE0) diff --git a/Configuration/Eras/python/Era_Phase2_cff.py b/Configuration/Eras/python/Era_Phase2_cff.py index 9e76017824dff..b77860ca7414e 100644 --- a/Configuration/Eras/python/Era_Phase2_cff.py +++ b/Configuration/Eras/python/Era_Phase2_cff.py @@ -1,6 +1,6 @@ import FWCore.ParameterSet.Config as cms -from Configuration.Eras.Era_Run3_cff import Run3 +from Configuration.Eras.Era_Run3_noMkFit_cff import Run3_noMkFit from Configuration.Eras.Modifier_phase2_common_cff import phase2_common from Configuration.Eras.Modifier_phase2_tracker_cff import phase2_tracker from Configuration.Eras.Modifier_phase2_ecal_cff import phase2_ecal @@ -17,4 +17,4 @@ from Configuration.Eras.Modifier_phase2_trigger_cff import phase2_trigger from Configuration.Eras.Modifier_ctpps_2021_cff import ctpps_2021 -Phase2 = cms.ModifierChain(Run3.copyAndExclude([phase1Pixel,trackingPhase1,ctpps_2021]), phase2_common, phase2_tracker, trackingPhase2PU140, phase2_ecal, phase2_hcal, phase2_hgcal, phase2_muon, phase2_GEM, hcalHardcodeConditions, phase2_timing, phase2_timing_layer, phase2_trigger) +Phase2 = cms.ModifierChain(Run3_noMkFit.copyAndExclude([phase1Pixel,trackingPhase1,ctpps_2021]), phase2_common, phase2_tracker, trackingPhase2PU140, phase2_ecal, phase2_hcal, phase2_hgcal, phase2_muon, phase2_GEM, hcalHardcodeConditions, phase2_timing, phase2_timing_layer, phase2_trigger) diff --git a/Configuration/Eras/python/Era_Run2_2017_cff.py b/Configuration/Eras/python/Era_Run2_2017_cff.py index 0fbe87a05e9d8..f3edca7cba96f 100644 --- a/Configuration/Eras/python/Era_Run2_2017_cff.py +++ b/Configuration/Eras/python/Era_Run2_2017_cff.py @@ -9,6 +9,7 @@ from Configuration.Eras.Modifier_run2_HE_2017_cff import run2_HE_2017 from Configuration.Eras.Modifier_run2_HEPlan1_2017_cff import run2_HEPlan1_2017 from Configuration.Eras.Modifier_trackingPhase1_cff import trackingPhase1 +from Configuration.Eras.ModifierChain_trackingMkFitProd_cff import trackingMkFitProd from Configuration.Eras.Modifier_run2_GEM_2017_cff import run2_GEM_2017 from Configuration.Eras.Modifier_stage2L1Trigger_2017_cff import stage2L1Trigger_2017 from Configuration.Eras.Modifier_run2_HLTconditions_2017_cff import run2_HLTconditions_2017 @@ -26,5 +27,5 @@ 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) + trackingPhase1, trackingMkFitProd, 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_2017_ppRef_cff.py b/Configuration/Eras/python/Era_Run2_2017_ppRef_cff.py index f9fd0f9692e47..480841cb46837 100644 --- a/Configuration/Eras/python/Era_Run2_2017_ppRef_cff.py +++ b/Configuration/Eras/python/Era_Run2_2017_ppRef_cff.py @@ -2,5 +2,6 @@ from Configuration.Eras.Era_Run2_2017_cff import Run2_2017 from Configuration.Eras.Modifier_ppRef_2017_cff import ppRef_2017 +from Configuration.Eras.ModifierChain_trackingMkFitProd_cff import trackingMkFitProd -Run2_2017_ppRef = cms.ModifierChain(Run2_2017, ppRef_2017) +Run2_2017_ppRef = cms.ModifierChain(Run2_2017.copyAndExclude([trackingMkFitProd]), ppRef_2017) diff --git a/Configuration/Eras/python/Era_Run2_2017_pp_on_XeXe_cff.py b/Configuration/Eras/python/Era_Run2_2017_pp_on_XeXe_cff.py index 2369c1ec0ae33..047cfbb2ee477 100644 --- a/Configuration/Eras/python/Era_Run2_2017_pp_on_XeXe_cff.py +++ b/Configuration/Eras/python/Era_Run2_2017_pp_on_XeXe_cff.py @@ -2,5 +2,6 @@ from Configuration.Eras.Era_Run2_2017_cff import Run2_2017 from Configuration.Eras.Modifier_pp_on_XeXe_2017_cff import pp_on_XeXe_2017 +from Configuration.Eras.ModifierChain_trackingMkFitProd_cff import trackingMkFitProd -Run2_2017_pp_on_XeXe = cms.ModifierChain(Run2_2017, pp_on_XeXe_2017) +Run2_2017_pp_on_XeXe = cms.ModifierChain(Run2_2017.copyAndExclude([trackingMkFitProd]), pp_on_XeXe_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 8ddbed4872a96..50f6caac90be3 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,5 +3,6 @@ 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.ModifierChain_trackingMkFitProd_cff import trackingMkFitProd -Run2_2018_pp_on_AA = cms.ModifierChain(Run2_2018, pp_on_AA, pp_on_AA_2018) +Run2_2018_pp_on_AA = cms.ModifierChain(Run2_2018.copyAndExclude([trackingMkFitProd]), pp_on_AA, pp_on_AA_2018) diff --git a/Configuration/Eras/python/Era_Run3_noMkFit_cff.py b/Configuration/Eras/python/Era_Run3_noMkFit_cff.py new file mode 100644 index 0000000000000..839d5e8299968 --- /dev/null +++ b/Configuration/Eras/python/Era_Run3_noMkFit_cff.py @@ -0,0 +1,6 @@ +import FWCore.ParameterSet.Config as cms + +from Configuration.Eras.Era_Run3_cff import Run3 +from Configuration.Eras.ModifierChain_trackingMkFitProd_cff import trackingMkFitProd + +Run3_noMkFit = Run3.copyAndExclude([trackingMkFitProd]) diff --git a/Configuration/Eras/python/Era_Run3_pp_on_PbPb_cff.py b/Configuration/Eras/python/Era_Run3_pp_on_PbPb_cff.py index 0312aad3064a6..097759b30e15c 100644 --- a/Configuration/Eras/python/Era_Run3_pp_on_PbPb_cff.py +++ b/Configuration/Eras/python/Era_Run3_pp_on_PbPb_cff.py @@ -1,7 +1,7 @@ import FWCore.ParameterSet.Config as cms -from Configuration.Eras.Era_Run3_cff import Run3 +from Configuration.Eras.Era_Run3_noMkFit_cff import Run3_noMkFit from Configuration.ProcessModifiers.pp_on_AA_cff import pp_on_AA from Configuration.Eras.Modifier_pp_on_PbPb_run3_cff import pp_on_PbPb_run3 -Run3_pp_on_PbPb = cms.ModifierChain(Run3, pp_on_AA, pp_on_PbPb_run3) +Run3_pp_on_PbPb = cms.ModifierChain(Run3_noMkFit, pp_on_AA, pp_on_PbPb_run3) diff --git a/Configuration/Eras/python/ModifierChain_run2_2017_noTrackingModifier_cff.py b/Configuration/Eras/python/ModifierChain_run2_2017_noTrackingModifier_cff.py index 1b9980e66576a..1fb8676d4e31e 100644 --- a/Configuration/Eras/python/ModifierChain_run2_2017_noTrackingModifier_cff.py +++ b/Configuration/Eras/python/ModifierChain_run2_2017_noTrackingModifier_cff.py @@ -2,5 +2,6 @@ from Configuration.Eras.Era_Run2_2017_cff import Run2_2017 from Configuration.Eras.Modifier_trackingPhase1_cff import trackingPhase1 +from Configuration.Eras.ModifierChain_trackingMkFitProd_cff import trackingMkFitProd -run2_2017_noTrackingModifier = Run2_2017.copyAndExclude([trackingPhase1]) +run2_2017_noTrackingModifier = Run2_2017.copyAndExclude([trackingPhase1,trackingMkFitProd]) diff --git a/Configuration/Eras/python/ModifierChain_trackingMkFitProd_cff.py b/Configuration/Eras/python/ModifierChain_trackingMkFitProd_cff.py new file mode 100644 index 0000000000000..448e0cad2e17a --- /dev/null +++ b/Configuration/Eras/python/ModifierChain_trackingMkFitProd_cff.py @@ -0,0 +1,20 @@ +import FWCore.ParameterSet.Config as cms + +# to replace CKF with MkFit in select iterations +from Configuration.ProcessModifiers.trackingMkFitCommon_cff import * +from Configuration.ProcessModifiers.trackingMkFitInitialStepPreSplitting_cff import * +from Configuration.ProcessModifiers.trackingMkFitInitialStep_cff import * +from Configuration.ProcessModifiers.trackingMkFitHighPtTripletStep_cff import * +from Configuration.ProcessModifiers.trackingMkFitDetachedQuadStep_cff import * +from Configuration.ProcessModifiers.trackingMkFitDetachedTripletStep_cff import * +from Configuration.ProcessModifiers.trackingMkFitPixelLessStep_cff import * + +trackingMkFitProd = cms.ModifierChain( + trackingMkFitCommon, + trackingMkFitInitialStepPreSplitting, + trackingMkFitInitialStep, + trackingMkFitHighPtTripletStep, + trackingMkFitDetachedQuadStep, + trackingMkFitDetachedTripletStep, + trackingMkFitPixelLessStep, +) diff --git a/Configuration/Eras/python/Modifier_phase2_brickedPixels_cff.py b/Configuration/Eras/python/Modifier_phase2_brickedPixels_cff.py new file mode 100644 index 0000000000000..20b13a317a809 --- /dev/null +++ b/Configuration/Eras/python/Modifier_phase2_brickedPixels_cff.py @@ -0,0 +1,3 @@ +import FWCore.ParameterSet.Config as cms + +phase2_brickedPixels = cms.Modifier() diff --git a/Configuration/Eras/python/Modifier_run3_nanoAOD_devel_cff.py b/Configuration/Eras/python/Modifier_run3_nanoAOD_devel_cff.py new file mode 100644 index 0000000000000..29aa657695945 --- /dev/null +++ b/Configuration/Eras/python/Modifier_run3_nanoAOD_devel_cff.py @@ -0,0 +1,3 @@ +import FWCore.ParameterSet.Config as cms + +run3_nanoAOD_devel = cms.Modifier() diff --git a/Configuration/EventContent/python/AlCaRecoOutput_cff.py b/Configuration/EventContent/python/AlCaRecoOutput_cff.py index 6c8f7a465e64a..835c8b99eaf70 100644 --- a/Configuration/EventContent/python/AlCaRecoOutput_cff.py +++ b/Configuration/EventContent/python/AlCaRecoOutput_cff.py @@ -53,6 +53,7 @@ from CalibTracker.SiPixelQuality.ALCARECOSiPixelCalZeroBias_Output_cff import * # AlCaReco for tracker calibration using Cosmics events from Calibration.TkAlCaRecoProducers.ALCARECOSiStripCalCosmics_Output_cff import * +from Calibration.TkAlCaRecoProducers.ALCARECOSiStripCalCosmicsNano_Output_cff import * from Calibration.TkAlCaRecoProducers.ALCARECOSiPixelCalCosmics_Output_cff import * # AlCaReco for tracker based alignment using beam halo @@ -90,7 +91,9 @@ # HCAL calibration with isolated tracks from Calibration.HcalAlCaRecoProducers.ALCARECOHcalCalIsoTrk_Output_cff import * from Calibration.HcalAlCaRecoProducers.ALCARECOHcalCalIsoTrkFilter_Output_cff import * +from Calibration.HcalAlCaRecoProducers.ALCARECOHcalCalIsoTrkFilterNoHLT_Output_cff import * from Calibration.HcalAlCaRecoProducers.ALCARECOHcalCalIsoTrkNoHLT_Output_cff import * +from Calibration.HcalAlCaRecoProducers.ALCARECOHcalCalIsoTrkProducerFilter_Output_cff import * # HCAL calibration with iterative phi sym from Calibration.HcalAlCaRecoProducers.ALCARECOHcalCalIterativePhiSym_Output_cff import * # HCAL calibration with min.bias @@ -107,10 +110,12 @@ from Calibration.HcalAlCaRecoProducers.ALCARECOHcalCalIsolatedBunchSelector_Output_cff import * # HCAL calibration with muons (HB/HE) from Calibration.HcalAlCaRecoProducers.ALCARECOHcalCalHBHEMuonFilter_Output_cff import * +from Calibration.HcalAlCaRecoProducers.ALCARECOHcalCalHBHEMuonProducerFilter_Output_cff import * # HCAL calibration with muons from low PU (HB/HE) from Calibration.HcalAlCaRecoProducers.ALCARECOHcalCalLowPUHBHEMuonFilter_Output_cff import * # HCAL calibration with muons (HE) from Calibration.HcalAlCaRecoProducers.ALCARECOHcalCalHEMuonFilter_Output_cff import * +from Calibration.HcalAlCaRecoProducers.ALCARECOHcalCalHEMuonProducerFilter_Output_cff import * ############################################################### # Muon Alignment (incl. stream for calibration) ############################################################### @@ -143,6 +148,8 @@ ############################################################### from CalibPPS.TimingCalibration.ALCARECOPPSCalTrackBasedSel_Output_cff import * from CalibPPS.TimingCalibration.ALCARECOPPSTimingCalib_Output_cff import * +from CalibPPS.TimingCalibration.ALCARECOPPSDiamondSampicTimingCalib_Output_cff import * +from CalibPPS.AlignmentGlobal.ALCARECOPPSAlignment_Output_cff import * ############################################################### # stream for prompt-calibration @ Tier0 @@ -153,7 +160,7 @@ from Calibration.TkAlCaRecoProducers.ALCARECOPromptCalibProdSiStrip_Output_cff import * from Calibration.TkAlCaRecoProducers.ALCARECOPromptCalibProdSiStripGains_Output_cff import * from Calibration.TkAlCaRecoProducers.ALCARECOPromptCalibProdSiStripGainsAAG_Output_cff import * - +from Calibration.TkAlCaRecoProducers.ALCARECOPromptCalibProdSiPixelLorentzAngle_Output_cff import * from Calibration.TkAlCaRecoProducers.ALCARECOSiStripPCLHistos_Output_cff import * from Alignment.CommonAlignmentProducer.ALCARECOPromptCalibProdSiPixelAli_Output_cff import * diff --git a/Configuration/Generator/python/SMS-Higgsino_mN2-170_mC1-160_mN1-150_HT60_TuneCP5_13TeV_pythia8_cfi.py b/Configuration/Generator/python/SMS-Higgsino_mN2-170_mC1-160_mN1-150_HT60_TuneCP5_13TeV_pythia8_cfi.py new file mode 100644 index 0000000000000..a7a190657ceef --- /dev/null +++ b/Configuration/Generator/python/SMS-Higgsino_mN2-170_mC1-160_mN1-150_HT60_TuneCP5_13TeV_pythia8_cfi.py @@ -0,0 +1,276 @@ +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 10.0E+4 # ~g + 1000022 150 # ~chi_10 + 1000023 170 # ~chi_20 + 1000025 10.0E+4 # ~chi_30 + 1000035 10.0E+4 # ~chi_40 + 1000024 160 # ~chi_1+ + 1000037 10.0E+4 # ~chi_2+ +# +BLOCK NMIX # Neutralino Mixing Matrix + 1 1 0.00000000E+00 # N_11 + 1 2 0.00000000E+00 # N_12 + 1 3 0.70710678E+00 # N_13 + 1 4 0.70710678E+00 # N_14 + 2 1 0.00000000E+00 # N_21 + 2 2 0.00000000E+00 # N_22 + 2 3 0.70710678E+00 # N_23 + 2 4 -0.70710678E+00 # N_24 + 3 1 0.00000000E+00 # N_31 + 3 2 1.00000000E+00 # N_32 + 3 3 0.00000000E+00 # N_33 + 3 4 0.00000000E+00 # N_34 + 4 1 1.00000000E+00 # N_41 + 4 2 0.00000000E+00 # N_42 + 4 3 0.00000000E+00 # N_43 + 4 4 0.00000000E+00 # N_44 +# +BLOCK UMIX # Chargino Mixing Matrix U + 1 1 0.00000000E+00 # U_11 + 1 2 1.00000000E+00 # U_12 + 2 1 1.00000000E+00 # U_21 + 2 2 0.00000000E+00 # U_22 +# +BLOCK VMIX # Chargino Mixing Matrix V + 1 1 0.00000000E+00 # V_11 + 1 2 1.00000000E+00 # V_12 + 2 1 1.00000000E+00 # V_21 + 2 2 0.00000000E+00 # 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 1.00000000E-05 # neutralino2 decays + 0.33333333E+00 3 1000022 -11 11 # BR(~chi_1+ -> ~chi_10 e+ nu_e) + 0.33333333E+00 3 1000022 -13 13 # BR(~chi_1+ -> ~chi_10 mu+ nu_mu) + 0.33333333E+00 3 1000022 -15 15 # BR(~chi_1+ -> ~chi_10 tau+ nu_tau) +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(13000), + SLHATableForPythia8 = cms.string(SLHA_TABLE), + maxEventsToPrint = cms.untracked.int32(0), + PythiaParameters = cms.PSet( + pythia8CommonSettingsBlock, + pythia8CP5SettingsBlock, + processParameters = cms.vstring( + 'SUSY:all = off', + 'SUSY:qqbar2chi0chi0 = on', + 'SUSY:qqbar2chi+-chi0 = on', + 'SUSY:qqbar2chi+chi- = on', + 'PhaseSpace:pTHatMin = 60.', + ), + parameterSets = cms.vstring( + 'pythia8CommonSettings', + 'pythia8CP5Settings', + 'processParameters' + ) + ) +) diff --git a/Configuration/Generator/python/concurrentLumisDisable.py b/Configuration/Generator/python/concurrentLumisDisable.py new file mode 100644 index 0000000000000..5c0f3b851d9b5 --- /dev/null +++ b/Configuration/Generator/python/concurrentLumisDisable.py @@ -0,0 +1,17 @@ +# list of generator EDModules (C++ type) that do not support concurrentLuminosityBlocks +noConcurrentLumiGenerators = [ + "AMPTGeneratorFilter", + "BeamHaloProducer", + "CosMuoGenProducer", + "Herwig7GeneratorFilter", + "HydjetGeneratorFilter", + "PyquenGeneratorFilter", + "Pythia6GeneratorFilter", + "Pythia8EGun", + "Pythia8GeneratorFilter", + "Pythia8HadronizerFilter", + "Pythia8PtAndDxyGun", + "Pythia8PtGun", + "ReggeGribovPartonMCGeneratorFilter", + "SherpaGeneratorFilter", +] diff --git a/Configuration/Generator/python/sherpa_ttbar_2j_MENLOPS_13TeV_MASTER_ExtGen_cff.py b/Configuration/Generator/python/sherpa_ttbar_2j_MENLOPS_13TeV_MASTER_ExtGen_cff.py index 4c6e0621f529d..0bb2670c3d0f3 100644 --- a/Configuration/Generator/python/sherpa_ttbar_2j_MENLOPS_13TeV_MASTER_ExtGen_cff.py +++ b/Configuration/Generator/python/sherpa_ttbar_2j_MENLOPS_13TeV_MASTER_ExtGen_cff.py @@ -29,7 +29,7 @@ " METS_BBAR_MODE 5;", " NJET:=2; LJET:=2; QCUT:=20.;", " ME_SIGNAL_GENERATOR Comix Amegic LOOPGEN;", - " OL_PREFIX={0} ".format(os.environ['CMS_OPENLOOPS_PREFIX']), + " OL_PREFIX={0};".format(os.environ['CMS_OPENLOOPS_PREFIX'] if 'CMS_OPENLOOPS_PREFIX' in os.environ else ''), " LOOPGEN:=OpenLoops;", " MI_HANDLER=Amisic;", " NLO_SMEAR_THRESHOLD 1;", @@ -62,8 +62,6 @@ ) from GeneratorInterface.Core.ExternalGeneratorFilter import ExternalGeneratorFilter -generator = ExternalGeneratorFilter(_generator, - _external_process_waitTime_=cms.untracked.uint32(1200), # increase the max waitTime for Sherpa - ) +generator = ExternalGeneratorFilter(_generator) ProductionFilterSequence = cms.Sequence(generator) diff --git a/Configuration/Geometry/README.md b/Configuration/Geometry/README.md index a8c1dea16db2d..9c360b7004360 100644 --- a/Configuration/Geometry/README.md +++ b/Configuration/Geometry/README.md @@ -1,3 +1,18 @@ +# To work on geometry package + +### To create or update geometries +``` +git cms-addpkg Geometry/CMSCommonData +git cms-addpkg Configuration/Geometry +scram b -j 8 +cd Configuration/Geometry +vi python/dict2021Geometry.py +python3 ./scripts/generate2021Geometry.py -D 2021 +``` +Note: +* For Phase-2, use [generate2026Geometry.py](./python/dict2026Geometry.py) and [generate2026Geometry.py](./scripts/generate2026Geometry.py) instead. +* For the list of geometries, see below. + # Run 3 Geometries The Run 3 geometry is automatically created using the script [generate2021Geometry.py](./scripts/generate2021Geometry.py). @@ -19,26 +34,21 @@ Muon system: * M1: 2021 baseline PPS: -* P2: 2021 baseline (after using its own material files for pixel) -* P3: 2021 baseline (same as P2 but removing common materials) -* P4: 2021 baseline (same as P2 or P3 but using the same Vacuum) -* P5: new Run3 detectors -* P6: Same as P5 but with unique names for materials +* P7: 2021 baseline (after removing overlaps and using common materials whenever possible) The script also handles the common and forward elements of the geometry: -* O3: 2021 baseline -* O4: as O3, but with zero material -* O5: as O3, but with trackermaterial removed (they are in T5, T6, T7, T8) -* O6: Replaces O3 as baseline to rmove duplicate material definition +* O4: as O6, but with zero material +* O5: as O6, but with trackermaterial removed (they are in T5, T6, T7, T8) +* O6: 2021 baseline * F1: 2021 baseline Several detector combinations have been generated: -* 2021 = T3+C1+M1+P6+O6+F1 -* 2021ZeroMaterial = T4+C1+M1+P6+O4+F1 -* 2021FlatMinus05Percent = T5+C1+M1+P6+O5+F1 -* 2021FlatMinus10Percent = T6+C1+M1+P6+O5+F1 -* 2021FlatPlus05Percent = T7+C1+M1+P6+O5+F1 -* 2021FlatPlus10Percent = T8+C1+M1+P6+O5+F1 +* 2021 = T3+C1+M1+P7+O6+F1 +* 2021ZeroMaterial = T4+C1+M1+P7+O4+F1 +* 2021FlatMinus05Percent = T5+C1+M1+P7+O5+F1 +* 2021FlatMinus10Percent = T6+C1+M1+P7+O5+F1 +* 2021FlatPlus05Percent = T7+C1+M1+P7+O5+F1 +* 2021FlatPlus10Percent = T8+C1+M1+P7+O5+F1 # Phase 2 Geometries @@ -58,15 +68,14 @@ Tracker: * T27: Phase2 tilted tracker. Outer Tracker (v8.0.0): same as T24/T21. Inner Tracker (v8.0.0): Based on (v7.0.2) (T25), but with bricked pixels in the central rod of TBPX L2 and in the central 3 rods of TBPX L3+4. All pixels in TFPX and TEPX are bricked. Compatible with DD4hep library. Calorimeters: -* C9: HGCal (v11 post TDR HGCal Geometry w/ corner centering for HE part) + Phase2 HCAL and EB + Tracker cables -* C10: HGCal (as in C9) + HFNose with corrected wafer size + Phase2 HCAL and EB -* C11: HGCal (v12 post TDR HGCal Geometry same as C9 + modified support structure + full list of masked wafers) -* 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 -* C17: HGCal (create HGCal geometry with new longitudinal structure having 47 layers and new definition of partial wafers using the constants of the flat file) + Phase2 HCAL and EB +* C9: HGCal (v11 post TDR HGCal Geometry w/ corner centering for HE part) + Phase2 HCAL and EB + Tracker cables (used in 2026D49) +* C10: HGCal (as in C9) + HFNose with corrected wafer size + Phase2 HCAL and EB (used in 2026D60) +* C11: HGCal (v12 post TDR HGCal Geometry same as C9 + modified support structure + full list of masked wafers) + Phase2 HCAL and EB + Tracker cables (used in 2026D68) +* C13: HGCal (v13 version which reads the input from the flat file, uses these for checks and makes provision to be used downstream) + Phase2 HCAL and EB (used in 2026D70, 2026D84) +* C14: HGCal (v14 version reading the input from the flat file and uses it to create geometry, still using masking to define partial wafers) + Phase2 HCAL and EB (used in 2026D76-81, 2026D85, 2026D87) +* C15: HGCal (as in C14) + HFNose with corrected wafer size + Phase2 HCAL and EB (used in 2026D82) +* C16: HGCal (v15 version of HGCal geometry created using real full and partial silicon modules using the constants of the flat file) + Phase2 HCAL and EB (used in 2026D83) +* C17: HGCal (v16 version of HGCal geometry created with new longitudinal structure having 47 layers and new definition of partial wafers using the constants of the flat file) + Phase2 HCAL and EB (used in 2026D86) 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 diff --git a/Configuration/Geometry/python/GeometryDD4hepExtended2021FlatMinus05PercentReco_cff.py b/Configuration/Geometry/python/GeometryDD4hepExtended2021FlatMinus05PercentReco_cff.py index 0e921c0acea74..3cc9ae3004e21 100644 --- a/Configuration/Geometry/python/GeometryDD4hepExtended2021FlatMinus05PercentReco_cff.py +++ b/Configuration/Geometry/python/GeometryDD4hepExtended2021FlatMinus05PercentReco_cff.py @@ -12,7 +12,6 @@ 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.CaloTopology_cfi import * diff --git a/Configuration/Geometry/python/GeometryDD4hepExtended2021FlatMinus10PercentReco_cff.py b/Configuration/Geometry/python/GeometryDD4hepExtended2021FlatMinus10PercentReco_cff.py index 469e47feb7236..53fdfe55fdf7f 100644 --- a/Configuration/Geometry/python/GeometryDD4hepExtended2021FlatMinus10PercentReco_cff.py +++ b/Configuration/Geometry/python/GeometryDD4hepExtended2021FlatMinus10PercentReco_cff.py @@ -12,7 +12,6 @@ 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.CaloTopology_cfi import * diff --git a/Configuration/Geometry/python/GeometryDD4hepExtended2021FlatPlus05PercentReco_cff.py b/Configuration/Geometry/python/GeometryDD4hepExtended2021FlatPlus05PercentReco_cff.py index 19aac45a7d9e7..898420b813bc8 100644 --- a/Configuration/Geometry/python/GeometryDD4hepExtended2021FlatPlus05PercentReco_cff.py +++ b/Configuration/Geometry/python/GeometryDD4hepExtended2021FlatPlus05PercentReco_cff.py @@ -12,7 +12,6 @@ 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.CaloTopology_cfi import * diff --git a/Configuration/Geometry/python/GeometryDD4hepExtended2021FlatPlus10PercentReco_cff.py b/Configuration/Geometry/python/GeometryDD4hepExtended2021FlatPlus10PercentReco_cff.py index 6ca4b2f0b6b6c..ac606c5857577 100644 --- a/Configuration/Geometry/python/GeometryDD4hepExtended2021FlatPlus10PercentReco_cff.py +++ b/Configuration/Geometry/python/GeometryDD4hepExtended2021FlatPlus10PercentReco_cff.py @@ -12,7 +12,6 @@ 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.CaloTopology_cfi import * diff --git a/Configuration/Geometry/python/GeometryDD4hepExtended2021Reco_cff.py b/Configuration/Geometry/python/GeometryDD4hepExtended2021Reco_cff.py index 8b94a6b3d9f79..bb0eed90f8e97 100644 --- a/Configuration/Geometry/python/GeometryDD4hepExtended2021Reco_cff.py +++ b/Configuration/Geometry/python/GeometryDD4hepExtended2021Reco_cff.py @@ -12,7 +12,6 @@ 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.CaloTopology_cfi import * diff --git a/Configuration/Geometry/python/GeometryDD4hepExtended2021ZeroMaterialReco_cff.py b/Configuration/Geometry/python/GeometryDD4hepExtended2021ZeroMaterialReco_cff.py index b9ae26ff64194..2b687c4b806f1 100644 --- a/Configuration/Geometry/python/GeometryDD4hepExtended2021ZeroMaterialReco_cff.py +++ b/Configuration/Geometry/python/GeometryDD4hepExtended2021ZeroMaterialReco_cff.py @@ -12,7 +12,6 @@ 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.CaloTopology_cfi import * diff --git a/Configuration/Geometry/python/GeometryDDDSimDB_cff.py b/Configuration/Geometry/python/GeometryDDDSimDB_cff.py index f78a9d05efb85..cfdc361714b58 100644 --- a/Configuration/Geometry/python/GeometryDDDSimDB_cff.py +++ b/Configuration/Geometry/python/GeometryDDDSimDB_cff.py @@ -4,12 +4,14 @@ # Geometry master configuration # # Ideal geometry, needed for simulation +# +# Strictly xpeaking muonOffsetESProducer_cff is not needed; +# added for consistency with the DD4Hep version +# from GeometryReaders.XMLIdealGeometryESSource.cmsGeometryDB_cff import * from Geometry.MuonNumbering.muonNumberingInitialization_cfi import * from Geometry.TrackerNumberingBuilder.trackerNumberingGeometryDB_cfi import * from Geometry.EcalCommonData.ecalSimulationParameters_cff import * -from Geometry.HcalCommonData.hcalSimulationParameters_cff import * -from Geometry.HcalCommonData.hcalDDDSimConstants_cfi import * -from Geometry.HcalCommonData.hcalSimulationConstants_cfi import * -from Geometry.HcalCommonData.caloSimulationParameters_cff import * +from Geometry.HcalCommonData.hcalSimDBConstants_cff import * from Geometry.MuonNumbering.muonGeometryConstants_cff import * +from Geometry.MuonNumbering.muonOffsetESProducer_cff import * diff --git a/Configuration/Geometry/python/GeometryExtended2021FlatMinus05PercentReco_cff.py b/Configuration/Geometry/python/GeometryExtended2021FlatMinus05PercentReco_cff.py index 2457ac1b060ba..c98b17ff1dce4 100644 --- a/Configuration/Geometry/python/GeometryExtended2021FlatMinus05PercentReco_cff.py +++ b/Configuration/Geometry/python/GeometryExtended2021FlatMinus05PercentReco_cff.py @@ -12,7 +12,6 @@ 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.CaloTopology_cfi import * diff --git a/Configuration/Geometry/python/GeometryExtended2021FlatMinus10PercentReco_cff.py b/Configuration/Geometry/python/GeometryExtended2021FlatMinus10PercentReco_cff.py index 83ada461b0a85..0d20e27f047ab 100644 --- a/Configuration/Geometry/python/GeometryExtended2021FlatMinus10PercentReco_cff.py +++ b/Configuration/Geometry/python/GeometryExtended2021FlatMinus10PercentReco_cff.py @@ -12,7 +12,6 @@ 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.CaloTopology_cfi import * diff --git a/Configuration/Geometry/python/GeometryExtended2021FlatPlus05PercentReco_cff.py b/Configuration/Geometry/python/GeometryExtended2021FlatPlus05PercentReco_cff.py index 82b4c2cf5f218..ca96a5b16ec9b 100644 --- a/Configuration/Geometry/python/GeometryExtended2021FlatPlus05PercentReco_cff.py +++ b/Configuration/Geometry/python/GeometryExtended2021FlatPlus05PercentReco_cff.py @@ -12,7 +12,6 @@ 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.CaloTopology_cfi import * diff --git a/Configuration/Geometry/python/GeometryExtended2021FlatPlus10PercentReco_cff.py b/Configuration/Geometry/python/GeometryExtended2021FlatPlus10PercentReco_cff.py index 52faf9264acfd..14a33b3afc6f8 100644 --- a/Configuration/Geometry/python/GeometryExtended2021FlatPlus10PercentReco_cff.py +++ b/Configuration/Geometry/python/GeometryExtended2021FlatPlus10PercentReco_cff.py @@ -12,7 +12,6 @@ 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.CaloTopology_cfi import * diff --git a/Configuration/Geometry/python/GeometryExtended2021Reco_cff.py b/Configuration/Geometry/python/GeometryExtended2021Reco_cff.py index 792748585f995..f573869340ef1 100644 --- a/Configuration/Geometry/python/GeometryExtended2021Reco_cff.py +++ b/Configuration/Geometry/python/GeometryExtended2021Reco_cff.py @@ -12,7 +12,6 @@ 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.CaloTopology_cfi import * diff --git a/Configuration/Geometry/python/GeometryExtended2021ZeroMaterialReco_cff.py b/Configuration/Geometry/python/GeometryExtended2021ZeroMaterialReco_cff.py index d80bc32f051fb..31be348f0238c 100644 --- a/Configuration/Geometry/python/GeometryExtended2021ZeroMaterialReco_cff.py +++ b/Configuration/Geometry/python/GeometryExtended2021ZeroMaterialReco_cff.py @@ -12,7 +12,6 @@ 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.CaloTopology_cfi import * diff --git a/Configuration/Geometry/python/dict2021Geometry.py b/Configuration/Geometry/python/dict2021Geometry.py index 6461b92b41d59..6a43b1d5aab58 100644 --- a/Configuration/Geometry/python/dict2021Geometry.py +++ b/Configuration/Geometry/python/dict2021Geometry.py @@ -3,95 +3,11 @@ commonDict = { "abbrev" : "O", "name" : "common", - "default" : 3, - "O1" : { - 1 : [ - 'Geometry/CMSCommonData/data/materials/2021/v1/materials.xml', - 'Geometry/TrackerCommonData/data/Run2/trackermaterial.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/2021/v3/cms.xml', - 'Geometry/CMSCommonData/data/cmsMother.xml', - 'Geometry/CMSCommonData/data/eta3/etaMax.xml', - 'Geometry/CMSCommonData/data/cmsTracker.xml', - 'Geometry/CMSCommonData/data/caloBase/2017/v1/caloBase.xml', - 'Geometry/CMSCommonData/data/cmsCalo.xml', - 'Geometry/CMSCommonData/data/muonBase/2018/v1/muonBase.xml', - 'Geometry/CMSCommonData/data/cmsMuon.xml', - 'Geometry/CMSCommonData/data/mgnt.xml', - 'Geometry/CMSCommonData/data/beampipe/2021/v1/beampipe.xml', - 'Geometry/CMSCommonData/data/cmsBeam/2021/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" : "run3_common, stage2L1Trigger_2021", - }, - "O2" : { - 1 : [ - 'Geometry/CMSCommonData/data/materials/2021ZeroMaterial/v1/materials.xml', - 'Geometry/TrackerCommonData/data/trackermaterial/2017ZeroMaterial/v1/trackermaterial.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/2021/v3/cms.xml', - 'Geometry/CMSCommonData/data/cmsMother.xml', - 'Geometry/CMSCommonData/data/eta3/etaMax.xml', - 'Geometry/CMSCommonData/data/cmsTracker.xml', - 'Geometry/CMSCommonData/data/caloBase/2017/v1/caloBase.xml', - 'Geometry/CMSCommonData/data/cmsCalo.xml', - 'Geometry/CMSCommonData/data/muonBase/2018/v1/muonBase.xml', - 'Geometry/CMSCommonData/data/cmsMuon.xml', - 'Geometry/CMSCommonData/data/mgnt.xml', - 'Geometry/CMSCommonData/data/beampipe/2021/v1/beampipe.xml', - 'Geometry/CMSCommonData/data/cmsBeam/2021/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" : "run3_common, stage2L1Trigger_2021", - }, - "O3" : { - 1 : [ - 'Geometry/CMSCommonData/data/materials/2021/v2/materials.xml', - 'Geometry/TrackerCommonData/data/trackermaterial/2021/v1/trackermaterial.xml', - 'Geometry/CMSCommonData/data/rotations.xml', - 'Geometry/CMSCommonData/data/extend/v3/cmsextent.xml', - 'Geometry/CMSCommonData/data/cavernData/2021/v1/cavernData.xml', - 'Geometry/CMSCommonData/data/cms/2021/v3/cms.xml', - 'Geometry/CMSCommonData/data/cmsMother.xml', - 'Geometry/CMSCommonData/data/eta3/etaMax.xml', - 'Geometry/CMSCommonData/data/cmsTracker.xml', - 'Geometry/CMSCommonData/data/caloBase/2017/v1/caloBase.xml', - 'Geometry/CMSCommonData/data/cmsCalo.xml', - 'Geometry/CMSCommonData/data/muonBase/2018/v1/muonBase.xml', - 'Geometry/CMSCommonData/data/cmsMuon.xml', - 'Geometry/CMSCommonData/data/mgnt.xml', - 'Geometry/CMSCommonData/data/beampipe/2021/v1/beampipe.xml', - 'Geometry/CMSCommonData/data/cmsBeam/2021/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" : "run3_common, stage2L1Trigger_2021", - }, + "default" : 6, "O4" : { 1 : [ 'Geometry/CMSCommonData/data/materials/2021/v2/materials.xml', - 'Geometry/TrackerCommonData/data/zeroMaterial/2021/v1/trackermaterial.xml', + 'Geometry/TrackerCommonData/data/zeroMaterial/2021/v2/trackermaterial.xml', 'Geometry/CMSCommonData/data/rotations.xml', 'Geometry/CMSCommonData/data/extend/v3/cmsextent.xml', 'Geometry/CMSCommonData/data/cavernData/2021/v1/cavernData.xml', @@ -146,7 +62,7 @@ "O6" : { 1 : [ 'Geometry/CMSCommonData/data/materials/2021/v3/materials.xml', - 'Geometry/TrackerCommonData/data/trackermaterial/2021/v1/trackermaterial.xml', + 'Geometry/TrackerCommonData/data/trackermaterial/2021/v2/trackermaterial.xml', 'Geometry/CMSCommonData/data/rotations.xml', 'Geometry/CMSCommonData/data/extend/v3/cmsextent.xml', 'Geometry/CMSCommonData/data/cavernData/2021/v1/cavernData.xml', @@ -162,428 +78,21 @@ 'Geometry/CMSCommonData/data/beampipe/2021/v1/beampipe.xml', 'Geometry/CMSCommonData/data/cmsBeam/2021/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" : "run3_common, stage2L1Trigger_2021", - }, -} - -trackerDict = { - "abbrev" : "T", - "name" : "tracker", - "default" : 3, - "T1" : { - 1 : [ - 'Geometry/TrackerCommonData/data/PhaseI/trackerParameters.xml', - 'Geometry/TrackerCommonData/data/pixfwdMaterials/2021/v1/pixfwdMaterials.xml', - 'Geometry/TrackerCommonData/data/pixfwdCommon.xml', - 'Geometry/TrackerCommonData/data/PhaseI/pixfwdCylinder.xml', - 'Geometry/TrackerCommonData/data/PhaseI/pixfwdDisks.xml', - 'Geometry/TrackerCommonData/data/PhaseI/pixfwd.xml', - 'Geometry/TrackerCommonData/data/PhaseI/pixfwdSupportRingParameters.xml', - 'Geometry/TrackerCommonData/data/PhaseI/pixfwdInnerDiskZplus.xml', - 'Geometry/TrackerCommonData/data/PhaseI/pixfwdInnerDiskZminus.xml', - 'Geometry/TrackerCommonData/data/PhaseI/pixfwdOuterDiskZplus.xml', - 'Geometry/TrackerCommonData/data/PhaseI/pixfwdOuterDiskZminus.xml', - 'Geometry/TrackerCommonData/data/PhaseI/pixfwdbladeInnerZplus.xml', - 'Geometry/TrackerCommonData/data/PhaseI/pixfwdbladeInnerZminus.xml', - 'Geometry/TrackerCommonData/data/PhaseI/pixfwdbladeOuterZplus.xml', - 'Geometry/TrackerCommonData/data/PhaseI/pixfwdbladeOuterZminus.xml', - 'Geometry/TrackerCommonData/data/PhaseI/pixbarmaterial.xml', - 'Geometry/TrackerCommonData/data/PhaseI/pixbarladder.xml', - 'Geometry/TrackerCommonData/data/PhaseI/pixbarladderfull0.xml', - 'Geometry/TrackerCommonData/data/PhaseI/pixbarladderfull1.xml', - 'Geometry/TrackerCommonData/data/PhaseI/pixbarladderfull2.xml', - 'Geometry/TrackerCommonData/data/PhaseI/pixbarladderfull3.xml', - 'Geometry/TrackerCommonData/data/PhaseI/pixbarlayer.xml', - 'Geometry/TrackerCommonData/data/PhaseI/pixbarlayer0.xml', - 'Geometry/TrackerCommonData/data/PhaseI/pixbarlayer1.xml', - 'Geometry/TrackerCommonData/data/PhaseI/pixbarlayer2.xml', - 'Geometry/TrackerCommonData/data/PhaseI/pixbarlayer3.xml', - 'Geometry/TrackerCommonData/data/PhaseI/v1/pixbar.xml', - 'Geometry/TrackerCommonData/data/Run2/trackerpatchpannel.xml', - 'Geometry/TrackerCommonData/data/Run2/trackerpixelnose.xml', - 'Geometry/TrackerCommonData/data/tibtidcommonmaterial.xml', - 'Geometry/TrackerCommonData/data/tibmaterial.xml', - 'Geometry/TrackerCommonData/data/tibmodpar.xml', - 'Geometry/TrackerCommonData/data/tibmodule0.xml', - 'Geometry/TrackerCommonData/data/tibmodule0a.xml', - 'Geometry/TrackerCommonData/data/tibmodule0b.xml', - 'Geometry/TrackerCommonData/data/tibmodule2.xml', - 'Geometry/TrackerCommonData/data/tibstringpar.xml', - 'Geometry/TrackerCommonData/data/tibstring0ll.xml', - 'Geometry/TrackerCommonData/data/tibstring0lr.xml', - 'Geometry/TrackerCommonData/data/tibstring0ul.xml', - 'Geometry/TrackerCommonData/data/tibstring0ur.xml', - 'Geometry/TrackerCommonData/data/tibstring0.xml', - 'Geometry/TrackerCommonData/data/tibstring1ll.xml', - 'Geometry/TrackerCommonData/data/tibstring1lr.xml', - 'Geometry/TrackerCommonData/data/tibstring1ul.xml', - 'Geometry/TrackerCommonData/data/tibstring1ur.xml', - 'Geometry/TrackerCommonData/data/tibstring1.xml', - 'Geometry/TrackerCommonData/data/tibstring2ll.xml', - 'Geometry/TrackerCommonData/data/tibstring2lr.xml', - 'Geometry/TrackerCommonData/data/tibstring2ul.xml', - 'Geometry/TrackerCommonData/data/tibstring2ur.xml', - 'Geometry/TrackerCommonData/data/tibstring2.xml', - 'Geometry/TrackerCommonData/data/tibstring3ll.xml', - 'Geometry/TrackerCommonData/data/tibstring3lr.xml', - 'Geometry/TrackerCommonData/data/tibstring3ul.xml', - 'Geometry/TrackerCommonData/data/tibstring3ur.xml', - 'Geometry/TrackerCommonData/data/tibstring3.xml', - 'Geometry/TrackerCommonData/data/tiblayerpar.xml', - 'Geometry/TrackerCommonData/data/tiblayer0.xml', - 'Geometry/TrackerCommonData/data/tiblayer1.xml', - 'Geometry/TrackerCommonData/data/tiblayer2.xml', - 'Geometry/TrackerCommonData/data/tiblayer3.xml', - 'Geometry/TrackerCommonData/data/tib.xml', - 'Geometry/TrackerCommonData/data/tidmaterial.xml', - 'Geometry/TrackerCommonData/data/tidmodpar.xml', - 'Geometry/TrackerCommonData/data/tidmodule0.xml', - 'Geometry/TrackerCommonData/data/tidmodule0r.xml', - 'Geometry/TrackerCommonData/data/tidmodule0l.xml', - 'Geometry/TrackerCommonData/data/tidmodule1.xml', - 'Geometry/TrackerCommonData/data/tidmodule1r.xml', - 'Geometry/TrackerCommonData/data/tidmodule1l.xml', - 'Geometry/TrackerCommonData/data/tidmodule2.xml', - 'Geometry/TrackerCommonData/data/tidringpar.xml', - 'Geometry/TrackerCommonData/data/tidring0.xml', - 'Geometry/TrackerCommonData/data/tidring0f.xml', - 'Geometry/TrackerCommonData/data/tidring0b.xml', - 'Geometry/TrackerCommonData/data/tidring1.xml', - 'Geometry/TrackerCommonData/data/tidring1f.xml', - 'Geometry/TrackerCommonData/data/tidring1b.xml', - 'Geometry/TrackerCommonData/data/tidring2.xml', - 'Geometry/TrackerCommonData/data/tid.xml', - 'Geometry/TrackerCommonData/data/tidf.xml', - 'Geometry/TrackerCommonData/data/tidb.xml', - 'Geometry/TrackerCommonData/data/tibtidservices.xml', - 'Geometry/TrackerCommonData/data/tibtidservicesf.xml', - 'Geometry/TrackerCommonData/data/tibtidservicesb.xml', - 'Geometry/TrackerCommonData/data/tobmaterial.xml', - 'Geometry/TrackerCommonData/data/tobmodpar.xml', - 'Geometry/TrackerCommonData/data/tobmodule0.xml', - 'Geometry/TrackerCommonData/data/tobmodule2.xml', - 'Geometry/TrackerCommonData/data/tobmodule4.xml', - 'Geometry/TrackerCommonData/data/tobrodpar.xml', - 'Geometry/TrackerCommonData/data/tobrod0c.xml', - 'Geometry/TrackerCommonData/data/tobrod0l.xml', - 'Geometry/TrackerCommonData/data/tobrod0h.xml', - 'Geometry/TrackerCommonData/data/tobrod0.xml', - 'Geometry/TrackerCommonData/data/tobrod1l.xml', - 'Geometry/TrackerCommonData/data/tobrod1h.xml', - 'Geometry/TrackerCommonData/data/tobrod1.xml', - 'Geometry/TrackerCommonData/data/tobrod2c.xml', - 'Geometry/TrackerCommonData/data/tobrod2l.xml', - 'Geometry/TrackerCommonData/data/tobrod2h.xml', - 'Geometry/TrackerCommonData/data/tobrod2.xml', - 'Geometry/TrackerCommonData/data/tobrod3l.xml', - 'Geometry/TrackerCommonData/data/tobrod3h.xml', - 'Geometry/TrackerCommonData/data/tobrod3.xml', - 'Geometry/TrackerCommonData/data/tobrod4c.xml', - 'Geometry/TrackerCommonData/data/tobrod4l.xml', - 'Geometry/TrackerCommonData/data/tobrod4h.xml', - 'Geometry/TrackerCommonData/data/tobrod4.xml', - 'Geometry/TrackerCommonData/data/tobrod5l.xml', - 'Geometry/TrackerCommonData/data/tobrod5h.xml', - 'Geometry/TrackerCommonData/data/tobrod5.xml', - 'Geometry/TrackerCommonData/data/tob/v3/tob.xml', - 'Geometry/TrackerCommonData/data/tecmaterial.xml', - 'Geometry/TrackerCommonData/data/tecmodpar.xml', - 'Geometry/TrackerCommonData/data/tecmodule0.xml', - 'Geometry/TrackerCommonData/data/tecmodule0r.xml', - 'Geometry/TrackerCommonData/data/tecmodule0s.xml', - 'Geometry/TrackerCommonData/data/tecmodule1.xml', - 'Geometry/TrackerCommonData/data/tecmodule1r.xml', - 'Geometry/TrackerCommonData/data/tecmodule1s.xml', - 'Geometry/TrackerCommonData/data/tecmodule2.xml', - 'Geometry/TrackerCommonData/data/tecmodule3.xml', - 'Geometry/TrackerCommonData/data/tecmodule4.xml', - 'Geometry/TrackerCommonData/data/tecmodule4r.xml', - 'Geometry/TrackerCommonData/data/tecmodule4s.xml', - 'Geometry/TrackerCommonData/data/tecmodule5.xml', - 'Geometry/TrackerCommonData/data/tecmodule6.xml', - 'Geometry/TrackerCommonData/data/tecpetpar.xml', - 'Geometry/TrackerCommonData/data/tecring0.xml', - 'Geometry/TrackerCommonData/data/tecring1.xml', - 'Geometry/TrackerCommonData/data/tecring2.xml', - 'Geometry/TrackerCommonData/data/tecring3.xml', - 'Geometry/TrackerCommonData/data/tecring4.xml', - 'Geometry/TrackerCommonData/data/tecring5.xml', - 'Geometry/TrackerCommonData/data/tecring6.xml', - 'Geometry/TrackerCommonData/data/tecring0f.xml', - 'Geometry/TrackerCommonData/data/tecring1f.xml', - 'Geometry/TrackerCommonData/data/tecring2f.xml', - 'Geometry/TrackerCommonData/data/tecring3f.xml', - 'Geometry/TrackerCommonData/data/tecring4f.xml', - 'Geometry/TrackerCommonData/data/tecring5f.xml', - 'Geometry/TrackerCommonData/data/tecring6f.xml', - 'Geometry/TrackerCommonData/data/tecring0b.xml', - 'Geometry/TrackerCommonData/data/tecring1b.xml', - 'Geometry/TrackerCommonData/data/tecring2b.xml', - 'Geometry/TrackerCommonData/data/tecring3b.xml', - 'Geometry/TrackerCommonData/data/tecring4b.xml', - 'Geometry/TrackerCommonData/data/tecring5b.xml', - 'Geometry/TrackerCommonData/data/tecring6b.xml', - 'Geometry/TrackerCommonData/data/tecpetalf.xml', - 'Geometry/TrackerCommonData/data/tecpetalb.xml', - 'Geometry/TrackerCommonData/data/tecpetal0.xml', - 'Geometry/TrackerCommonData/data/tecpetal0f.xml', - 'Geometry/TrackerCommonData/data/tecpetal0b.xml', - 'Geometry/TrackerCommonData/data/tecpetal3.xml', - 'Geometry/TrackerCommonData/data/tecpetal3f.xml', - 'Geometry/TrackerCommonData/data/tecpetal3b.xml', - 'Geometry/TrackerCommonData/data/tecpetal6f.xml', - 'Geometry/TrackerCommonData/data/tecpetal6b.xml', - 'Geometry/TrackerCommonData/data/tecpetal8f.xml', - 'Geometry/TrackerCommonData/data/tecpetal8b.xml', - 'Geometry/TrackerCommonData/data/tecwheel/2021/v1/tecwheel.xml', - 'Geometry/TrackerCommonData/data/tecwheela.xml', - 'Geometry/TrackerCommonData/data/tecwheelb.xml', - 'Geometry/TrackerCommonData/data/tecwheelc.xml', - 'Geometry/TrackerCommonData/data/tecwheeld.xml', - 'Geometry/TrackerCommonData/data/tecwheel6.xml', - 'Geometry/TrackerCommonData/data/tecservices.xml', - 'Geometry/TrackerCommonData/data/tecbackplate.xml', - 'Geometry/TrackerCommonData/data/tec.xml', - 'Geometry/TrackerCommonData/data/Run2/tracker.xml', - 'Geometry/TrackerCommonData/data/trackerpixbar.xml', - 'Geometry/TrackerCommonData/data/PhaseI/trackerpixfwd.xml', - 'Geometry/TrackerCommonData/data/trackertibtidservices.xml', - 'Geometry/TrackerCommonData/data/trackertib.xml', - 'Geometry/TrackerCommonData/data/trackertid.xml', - 'Geometry/TrackerCommonData/data/trackertob.xml', - 'Geometry/TrackerCommonData/data/trackertec.xml', - 'Geometry/TrackerCommonData/data/v2/trackerbulkhead.xml', - 'Geometry/TrackerCommonData/data/trackerother.xml', - 'Geometry/TrackerCommonData/data/PhaseI/trackerStructureTopology.xml', - 'Geometry/TrackerSimData/data/PhaseI/trackersens.xml', - 'Geometry/TrackerRecoData/data/PhaseI/v1/trackerRecoMaterial.xml', - 'SimTracker/TrackerMaterialAnalysis/data/trackingMaterialGroups_ForPhaseI/v1/trackingMaterialGroups_ForPhaseI.xml', - 'Geometry/TrackerSimData/data/PhaseI/trackerProdCuts.xml', - 'Geometry/TrackerSimData/data/trackerProdCutsBEAM.xml', - ], - "sim" : [ - 'from Geometry.TrackerNumberingBuilder.trackerNumberingGeometry_cff import *', - ], - "reco" : [ - 'from Geometry.CommonTopologies.globalTrackingGeometry_cfi import *', - 'from RecoTracker.GeometryESProducer.TrackerRecoGeometryESProducer_cfi import *', - 'from Geometry.TrackerGeometryBuilder.TrackerAdditionalParametersPerDet_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)', - ], - }, - "T2" : { - 1 : [ - 'Geometry/TrackerCommonData/data/PhaseI/trackerParameters.xml', - 'Geometry/TrackerCommonData/data/pixfwdMaterials/2017ZeroMaterial/v1/pixfwdMaterials.xml', - 'Geometry/TrackerCommonData/data/pixfwdCommon.xml', - 'Geometry/TrackerCommonData/data/PhaseI/pixfwdCylinder.xml', - 'Geometry/TrackerCommonData/data/PhaseI/pixfwdDisks.xml', - 'Geometry/TrackerCommonData/data/PhaseI/pixfwd.xml', - 'Geometry/TrackerCommonData/data/PhaseI/pixfwdSupportRingParameters.xml', - 'Geometry/TrackerCommonData/data/PhaseI/pixfwdInnerDiskZplus.xml', - 'Geometry/TrackerCommonData/data/PhaseI/pixfwdInnerDiskZminus.xml', - 'Geometry/TrackerCommonData/data/PhaseI/pixfwdOuterDiskZplus.xml', - 'Geometry/TrackerCommonData/data/PhaseI/pixfwdOuterDiskZminus.xml', - 'Geometry/TrackerCommonData/data/PhaseI/pixfwdbladeInnerZplus.xml', - 'Geometry/TrackerCommonData/data/PhaseI/pixfwdbladeInnerZminus.xml', - 'Geometry/TrackerCommonData/data/PhaseI/pixfwdbladeOuterZplus.xml', - 'Geometry/TrackerCommonData/data/PhaseI/pixfwdbladeOuterZminus.xml', - 'Geometry/TrackerCommonData/data/pixbarmaterial/2017ZeroMaterial/v1/pixbarmaterial.xml', - 'Geometry/TrackerCommonData/data/PhaseI/pixbarladder.xml', - 'Geometry/TrackerCommonData/data/PhaseI/pixbarladderfull0.xml', - 'Geometry/TrackerCommonData/data/PhaseI/pixbarladderfull1.xml', - 'Geometry/TrackerCommonData/data/PhaseI/pixbarladderfull2.xml', - 'Geometry/TrackerCommonData/data/PhaseI/pixbarladderfull3.xml', - 'Geometry/TrackerCommonData/data/PhaseI/pixbarlayer.xml', - 'Geometry/TrackerCommonData/data/PhaseI/pixbarlayer0.xml', - 'Geometry/TrackerCommonData/data/PhaseI/pixbarlayer1.xml', - 'Geometry/TrackerCommonData/data/PhaseI/pixbarlayer2.xml', - 'Geometry/TrackerCommonData/data/PhaseI/pixbarlayer3.xml', - 'Geometry/TrackerCommonData/data/PhaseI/v1/pixbar.xml', - 'Geometry/TrackerCommonData/data/Run2/trackerpatchpannel.xml', - 'Geometry/TrackerCommonData/data/Run2/trackerpixelnose.xml', - 'Geometry/TrackerCommonData/data/tibtidcommonmaterial/2017ZeroMaterial/v1/tibtidcommonmaterial.xml', - 'Geometry/TrackerCommonData/data/tibmaterial/2017ZeroMaterial/v1/tibmaterial.xml', - 'Geometry/TrackerCommonData/data/tibmodpar.xml', - 'Geometry/TrackerCommonData/data/tibmodule0.xml', - 'Geometry/TrackerCommonData/data/tibmodule0a.xml', - 'Geometry/TrackerCommonData/data/tibmodule0b.xml', - 'Geometry/TrackerCommonData/data/tibmodule2.xml', - 'Geometry/TrackerCommonData/data/tibstringpar.xml', - 'Geometry/TrackerCommonData/data/tibstring0ll.xml', - 'Geometry/TrackerCommonData/data/tibstring0lr.xml', - 'Geometry/TrackerCommonData/data/tibstring0ul.xml', - 'Geometry/TrackerCommonData/data/tibstring0ur.xml', - 'Geometry/TrackerCommonData/data/tibstring0.xml', - 'Geometry/TrackerCommonData/data/tibstring1ll.xml', - 'Geometry/TrackerCommonData/data/tibstring1lr.xml', - 'Geometry/TrackerCommonData/data/tibstring1ul.xml', - 'Geometry/TrackerCommonData/data/tibstring1ur.xml', - 'Geometry/TrackerCommonData/data/tibstring1.xml', - 'Geometry/TrackerCommonData/data/tibstring2ll.xml', - 'Geometry/TrackerCommonData/data/tibstring2lr.xml', - 'Geometry/TrackerCommonData/data/tibstring2ul.xml', - 'Geometry/TrackerCommonData/data/tibstring2ur.xml', - 'Geometry/TrackerCommonData/data/tibstring2.xml', - 'Geometry/TrackerCommonData/data/tibstring3ll.xml', - 'Geometry/TrackerCommonData/data/tibstring3lr.xml', - 'Geometry/TrackerCommonData/data/tibstring3ul.xml', - 'Geometry/TrackerCommonData/data/tibstring3ur.xml', - 'Geometry/TrackerCommonData/data/tibstring3.xml', - 'Geometry/TrackerCommonData/data/tiblayerpar.xml', - 'Geometry/TrackerCommonData/data/tiblayer0.xml', - 'Geometry/TrackerCommonData/data/tiblayer1.xml', - 'Geometry/TrackerCommonData/data/tiblayer2.xml', - 'Geometry/TrackerCommonData/data/tiblayer3.xml', - 'Geometry/TrackerCommonData/data/tib.xml', - 'Geometry/TrackerCommonData/data/tidmaterial/2017ZeroMaterial/v1/tidmaterial.xml', - 'Geometry/TrackerCommonData/data/tidmodpar.xml', - 'Geometry/TrackerCommonData/data/tidmodule0.xml', - 'Geometry/TrackerCommonData/data/tidmodule0r.xml', - 'Geometry/TrackerCommonData/data/tidmodule0l.xml', - 'Geometry/TrackerCommonData/data/tidmodule1.xml', - 'Geometry/TrackerCommonData/data/tidmodule1r.xml', - 'Geometry/TrackerCommonData/data/tidmodule1l.xml', - 'Geometry/TrackerCommonData/data/tidmodule2.xml', - 'Geometry/TrackerCommonData/data/tidringpar.xml', - 'Geometry/TrackerCommonData/data/tidring0.xml', - 'Geometry/TrackerCommonData/data/tidring0f.xml', - 'Geometry/TrackerCommonData/data/tidring0b.xml', - 'Geometry/TrackerCommonData/data/tidring1.xml', - 'Geometry/TrackerCommonData/data/tidring1f.xml', - 'Geometry/TrackerCommonData/data/tidring1b.xml', - 'Geometry/TrackerCommonData/data/tidring2.xml', - 'Geometry/TrackerCommonData/data/tid.xml', - 'Geometry/TrackerCommonData/data/tidf.xml', - 'Geometry/TrackerCommonData/data/tidb.xml', - 'Geometry/TrackerCommonData/data/tibtidservices.xml', - 'Geometry/TrackerCommonData/data/tibtidservicesf.xml', - 'Geometry/TrackerCommonData/data/tibtidservicesb.xml', - 'Geometry/TrackerCommonData/data/tobmaterial/2017ZeroMaterial/v1/tobmaterial.xml', - 'Geometry/TrackerCommonData/data/tobmodpar.xml', - 'Geometry/TrackerCommonData/data/tobmodule0.xml', - 'Geometry/TrackerCommonData/data/tobmodule2.xml', - 'Geometry/TrackerCommonData/data/tobmodule4.xml', - 'Geometry/TrackerCommonData/data/tobrodpar.xml', - 'Geometry/TrackerCommonData/data/tobrod0c.xml', - 'Geometry/TrackerCommonData/data/tobrod0l.xml', - 'Geometry/TrackerCommonData/data/tobrod0h.xml', - 'Geometry/TrackerCommonData/data/tobrod0.xml', - 'Geometry/TrackerCommonData/data/tobrod1l.xml', - 'Geometry/TrackerCommonData/data/tobrod1h.xml', - 'Geometry/TrackerCommonData/data/tobrod1.xml', - 'Geometry/TrackerCommonData/data/tobrod2c.xml', - 'Geometry/TrackerCommonData/data/tobrod2l.xml', - 'Geometry/TrackerCommonData/data/tobrod2h.xml', - 'Geometry/TrackerCommonData/data/tobrod2.xml', - 'Geometry/TrackerCommonData/data/tobrod3l.xml', - 'Geometry/TrackerCommonData/data/tobrod3h.xml', - 'Geometry/TrackerCommonData/data/tobrod3.xml', - 'Geometry/TrackerCommonData/data/tobrod4c.xml', - 'Geometry/TrackerCommonData/data/tobrod4l.xml', - 'Geometry/TrackerCommonData/data/tobrod4h.xml', - 'Geometry/TrackerCommonData/data/tobrod4.xml', - 'Geometry/TrackerCommonData/data/tobrod5l.xml', - 'Geometry/TrackerCommonData/data/tobrod5h.xml', - 'Geometry/TrackerCommonData/data/tobrod5.xml', - 'Geometry/TrackerCommonData/data/tob/v3/tob.xml', - 'Geometry/TrackerCommonData/data/tecmaterial/2017ZeroMaterial/v1/tecmaterial.xml', - 'Geometry/TrackerCommonData/data/tecmodpar.xml', - 'Geometry/TrackerCommonData/data/tecmodule0.xml', - 'Geometry/TrackerCommonData/data/tecmodule0r.xml', - 'Geometry/TrackerCommonData/data/tecmodule0s.xml', - 'Geometry/TrackerCommonData/data/tecmodule1.xml', - 'Geometry/TrackerCommonData/data/tecmodule1r.xml', - 'Geometry/TrackerCommonData/data/tecmodule1s.xml', - 'Geometry/TrackerCommonData/data/tecmodule2.xml', - 'Geometry/TrackerCommonData/data/tecmodule3.xml', - 'Geometry/TrackerCommonData/data/tecmodule4.xml', - 'Geometry/TrackerCommonData/data/tecmodule4r.xml', - 'Geometry/TrackerCommonData/data/tecmodule4s.xml', - 'Geometry/TrackerCommonData/data/tecmodule5.xml', - 'Geometry/TrackerCommonData/data/tecmodule6.xml', - 'Geometry/TrackerCommonData/data/tecpetpar.xml', - 'Geometry/TrackerCommonData/data/tecring0.xml', - 'Geometry/TrackerCommonData/data/tecring1.xml', - 'Geometry/TrackerCommonData/data/tecring2.xml', - 'Geometry/TrackerCommonData/data/tecring3.xml', - 'Geometry/TrackerCommonData/data/tecring4.xml', - 'Geometry/TrackerCommonData/data/tecring5.xml', - 'Geometry/TrackerCommonData/data/tecring6.xml', - 'Geometry/TrackerCommonData/data/tecring0f.xml', - 'Geometry/TrackerCommonData/data/tecring1f.xml', - 'Geometry/TrackerCommonData/data/tecring2f.xml', - 'Geometry/TrackerCommonData/data/tecring3f.xml', - 'Geometry/TrackerCommonData/data/tecring4f.xml', - 'Geometry/TrackerCommonData/data/tecring5f.xml', - 'Geometry/TrackerCommonData/data/tecring6f.xml', - 'Geometry/TrackerCommonData/data/tecring0b.xml', - 'Geometry/TrackerCommonData/data/tecring1b.xml', - 'Geometry/TrackerCommonData/data/tecring2b.xml', - 'Geometry/TrackerCommonData/data/tecring3b.xml', - 'Geometry/TrackerCommonData/data/tecring4b.xml', - 'Geometry/TrackerCommonData/data/tecring5b.xml', - 'Geometry/TrackerCommonData/data/tecring6b.xml', - 'Geometry/TrackerCommonData/data/tecpetalf.xml', - 'Geometry/TrackerCommonData/data/tecpetalb.xml', - 'Geometry/TrackerCommonData/data/tecpetal0.xml', - 'Geometry/TrackerCommonData/data/tecpetal0f.xml', - 'Geometry/TrackerCommonData/data/tecpetal0b.xml', - 'Geometry/TrackerCommonData/data/tecpetal3.xml', - 'Geometry/TrackerCommonData/data/tecpetal3f.xml', - 'Geometry/TrackerCommonData/data/tecpetal3b.xml', - 'Geometry/TrackerCommonData/data/tecpetal6f.xml', - 'Geometry/TrackerCommonData/data/tecpetal6b.xml', - 'Geometry/TrackerCommonData/data/tecpetal8f.xml', - 'Geometry/TrackerCommonData/data/tecpetal8b.xml', - 'Geometry/TrackerCommonData/data/tecwheel/2021/v1/tecwheel.xml', - 'Geometry/TrackerCommonData/data/tecwheela.xml', - 'Geometry/TrackerCommonData/data/tecwheelb.xml', - 'Geometry/TrackerCommonData/data/tecwheelc.xml', - 'Geometry/TrackerCommonData/data/tecwheeld.xml', - 'Geometry/TrackerCommonData/data/tecwheel6.xml', - 'Geometry/TrackerCommonData/data/tecservices.xml', - 'Geometry/TrackerCommonData/data/tecbackplate.xml', - 'Geometry/TrackerCommonData/data/tec.xml', - 'Geometry/TrackerCommonData/data/Run2/tracker.xml', - 'Geometry/TrackerCommonData/data/trackerpixbar.xml', - 'Geometry/TrackerCommonData/data/PhaseI/trackerpixfwd.xml', - 'Geometry/TrackerCommonData/data/trackertibtidservices.xml', - 'Geometry/TrackerCommonData/data/trackertib.xml', - 'Geometry/TrackerCommonData/data/trackertid.xml', - 'Geometry/TrackerCommonData/data/trackertob.xml', - 'Geometry/TrackerCommonData/data/trackertec.xml', - 'Geometry/TrackerCommonData/data/v2/trackerbulkhead.xml', - 'Geometry/TrackerCommonData/data/trackerother.xml', - 'Geometry/TrackerCommonData/data/PhaseI/trackerStructureTopology.xml', - 'Geometry/TrackerSimData/data/PhaseI/trackersens.xml', - 'Geometry/TrackerRecoData/data/PhaseI/v1/trackerRecoMaterial.xml', - 'Geometry/TrackerSimData/data/PhaseI/trackerProdCuts.xml', - 'Geometry/TrackerSimData/data/trackerProdCutsBEAM.xml', - ], - "sim" : [ - 'from Geometry.TrackerNumberingBuilder.trackerNumberingGeometry_cff import *', - ], - "reco" : [ - 'from Geometry.CommonTopologies.globalTrackingGeometry_cfi import *', - 'from RecoTracker.GeometryESProducer.TrackerRecoGeometryESProducer_cfi import *', - 'from Geometry.TrackerGeometryBuilder.TrackerAdditionalParametersPerDet_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)', + '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" : "run3_common, stage2L1Trigger_2021", }, +} + +trackerDict = { + "abbrev" : "T", + "name" : "tracker", + "default" : 3, "T3" : { 1 : [ 'Geometry/TrackerCommonData/data/PhaseI/trackerParameters.xml', @@ -615,8 +124,8 @@ 'Geometry/TrackerCommonData/data/PhaseI/v2/pixbar.xml', 'Geometry/TrackerCommonData/data/Run2/trackerpatchpannel.xml', 'Geometry/TrackerCommonData/data/Run2/trackerpixelnose.xml', - 'Geometry/TrackerCommonData/data/tibtidcommonmaterial/2021/v1/tibtidcommonmaterial.xml', - 'Geometry/TrackerCommonData/data/tibmaterial/2021/v1/tibmaterial.xml', + 'Geometry/TrackerCommonData/data/tibtidcommonmaterial/2021/v2/tibtidcommonmaterial.xml', + 'Geometry/TrackerCommonData/data/tibmaterial/2021/v2/tibmaterial.xml', 'Geometry/TrackerCommonData/data/tibmodpar.xml', 'Geometry/TrackerCommonData/data/tibmodule0.xml', 'Geometry/TrackerCommonData/data/tibmodule0a.xml', @@ -649,7 +158,7 @@ 'Geometry/TrackerCommonData/data/tiblayer2.xml', 'Geometry/TrackerCommonData/data/tiblayer3.xml', 'Geometry/TrackerCommonData/data/tib.xml', - 'Geometry/TrackerCommonData/data/tidmaterial/2021/v1/tidmaterial.xml', + 'Geometry/TrackerCommonData/data/tidmaterial/2021/v2/tidmaterial.xml', 'Geometry/TrackerCommonData/data/tidmodpar.xml', 'Geometry/TrackerCommonData/data/tidmodule0.xml', 'Geometry/TrackerCommonData/data/tidmodule0r.xml', @@ -672,7 +181,7 @@ 'Geometry/TrackerCommonData/data/tibtidservices.xml', 'Geometry/TrackerCommonData/data/tibtidservicesf.xml', 'Geometry/TrackerCommonData/data/tibtidservicesb.xml', - 'Geometry/TrackerCommonData/data/tobmaterial/2021/v1/tobmaterial.xml', + 'Geometry/TrackerCommonData/data/tobmaterial/2021/v2/tobmaterial.xml', 'Geometry/TrackerCommonData/data/tobmodpar.xml', 'Geometry/TrackerCommonData/data/tobmodule0.xml', 'Geometry/TrackerCommonData/data/tobmodule2.xml', @@ -785,7 +294,6 @@ 'from Geometry.TrackerGeometryBuilder.trackerParameters_cff import *', 'from Geometry.TrackerNumberingBuilder.trackerTopology_cfi import *', 'from Geometry.TrackerGeometryBuilder.idealForDigiTrackerGeometry_cff import *', - 'trackerGeometry.applyAlignment = cms.bool(False)', ], }, "T4" : { @@ -819,8 +327,8 @@ 'Geometry/TrackerCommonData/data/PhaseI/v2/pixbar.xml', 'Geometry/TrackerCommonData/data/Run2/trackerpatchpannel.xml', 'Geometry/TrackerCommonData/data/Run2/trackerpixelnose.xml', - 'Geometry/TrackerCommonData/data/zeroMaterial/2021/v1/tibtidcommonmaterial.xml', - 'Geometry/TrackerCommonData/data/zeroMaterial/2021/v1/tibmaterial.xml', + 'Geometry/TrackerCommonData/data/zeroMaterial/2021/v2/tibtidcommonmaterial.xml', + 'Geometry/TrackerCommonData/data/zeroMaterial/2021/v2/tibmaterial.xml', 'Geometry/TrackerCommonData/data/tibmodpar.xml', 'Geometry/TrackerCommonData/data/tibmodule0.xml', 'Geometry/TrackerCommonData/data/tibmodule0a.xml', @@ -853,7 +361,7 @@ 'Geometry/TrackerCommonData/data/tiblayer2.xml', 'Geometry/TrackerCommonData/data/tiblayer3.xml', 'Geometry/TrackerCommonData/data/tib.xml', - 'Geometry/TrackerCommonData/data/zeroMaterial/2021/v1/tidmaterial.xml', + 'Geometry/TrackerCommonData/data/zeroMaterial/2021/v2/tidmaterial.xml', 'Geometry/TrackerCommonData/data/tidmodpar.xml', 'Geometry/TrackerCommonData/data/tidmodule0.xml', 'Geometry/TrackerCommonData/data/tidmodule0r.xml', @@ -876,7 +384,7 @@ 'Geometry/TrackerCommonData/data/tibtidservices.xml', 'Geometry/TrackerCommonData/data/tibtidservicesf.xml', 'Geometry/TrackerCommonData/data/tibtidservicesb.xml', - 'Geometry/TrackerCommonData/data/zeroMaterial/2021/v1/tobmaterial.xml', + 'Geometry/TrackerCommonData/data/zeroMaterial/2021/v2/tobmaterial.xml', 'Geometry/TrackerCommonData/data/tobmodpar.xml', 'Geometry/TrackerCommonData/data/tobmodule0.xml', 'Geometry/TrackerCommonData/data/tobmodule2.xml', @@ -989,19 +497,18 @@ 'from Geometry.TrackerGeometryBuilder.trackerParameters_cff import *', 'from Geometry.TrackerNumberingBuilder.trackerTopology_cfi import *', 'from Geometry.TrackerGeometryBuilder.idealForDigiTrackerGeometry_cff import *', - 'trackerGeometry.applyAlignment = cms.bool(False)', ], }, "T5" : { 1 : [ 'Geometry/TrackerCommonData/data/PhaseI/trackerParameters.xml', - 'Geometry/TrackerCommonData/data/FlatMinus05Percent/2021/trackermaterial.xml', + 'Geometry/TrackerCommonData/data/FlatMinus05Percent/2021/v2/trackermaterial.xml', 'Geometry/TrackerCommonData/data/FlatMinus05Percent/2021/pixfwdMaterials.xml', 'Geometry/TrackerCommonData/data/FlatMinus05Percent/2021/pixbarmaterial.xml', - 'Geometry/TrackerCommonData/data/FlatMinus05Percent/2021/tibtidcommonmaterial.xml', - 'Geometry/TrackerCommonData/data/FlatMinus05Percent/2021/tibmaterial.xml', - 'Geometry/TrackerCommonData/data/FlatMinus05Percent/2021/tidmaterial.xml', - 'Geometry/TrackerCommonData/data/FlatMinus05Percent/2021/tobmaterial.xml', + 'Geometry/TrackerCommonData/data/FlatMinus05Percent/2021/v2/tibtidcommonmaterial.xml', + 'Geometry/TrackerCommonData/data/FlatMinus05Percent/2021/v2/tibmaterial.xml', + 'Geometry/TrackerCommonData/data/FlatMinus05Percent/2021/v2/tidmaterial.xml', + 'Geometry/TrackerCommonData/data/FlatMinus05Percent/2021/v2/tobmaterial.xml', 'Geometry/TrackerCommonData/data/FlatMinus05Percent/2021/tecmaterial.xml', 'Geometry/TrackerCommonData/data/pixfwdCommon.xml', 'Geometry/TrackerCommonData/data/PhaseI/v2/pixfwdCylinder.xml', @@ -1194,19 +701,18 @@ 'from Geometry.TrackerGeometryBuilder.trackerParameters_cff import *', 'from Geometry.TrackerNumberingBuilder.trackerTopology_cfi import *', 'from Geometry.TrackerGeometryBuilder.idealForDigiTrackerGeometry_cff import *', - 'trackerGeometry.applyAlignment = cms.bool(False)', ], }, "T6" : { 1 : [ 'Geometry/TrackerCommonData/data/PhaseI/trackerParameters.xml', - 'Geometry/TrackerCommonData/data/FlatMinus10Percent/2021/trackermaterial.xml', + 'Geometry/TrackerCommonData/data/FlatMinus10Percent/2021/v2/trackermaterial.xml', 'Geometry/TrackerCommonData/data/FlatMinus10Percent/2021/pixfwdMaterials.xml', 'Geometry/TrackerCommonData/data/FlatMinus10Percent/2021/pixbarmaterial.xml', - 'Geometry/TrackerCommonData/data/FlatMinus10Percent/2021/tibtidcommonmaterial.xml', - 'Geometry/TrackerCommonData/data/FlatMinus10Percent/2021/tibmaterial.xml', - 'Geometry/TrackerCommonData/data/FlatMinus10Percent/2021/tidmaterial.xml', - 'Geometry/TrackerCommonData/data/FlatMinus10Percent/2021/tobmaterial.xml', + 'Geometry/TrackerCommonData/data/FlatMinus10Percent/2021/v2/tibtidcommonmaterial.xml', + 'Geometry/TrackerCommonData/data/FlatMinus10Percent/2021/v2/tibmaterial.xml', + 'Geometry/TrackerCommonData/data/FlatMinus10Percent/2021/v2/tidmaterial.xml', + 'Geometry/TrackerCommonData/data/FlatMinus10Percent/2021/v2/tobmaterial.xml', 'Geometry/TrackerCommonData/data/FlatMinus10Percent/2021/tecmaterial.xml', 'Geometry/TrackerCommonData/data/pixfwdCommon.xml', 'Geometry/TrackerCommonData/data/PhaseI/v2/pixfwdCylinder.xml', @@ -1399,19 +905,18 @@ 'from Geometry.TrackerGeometryBuilder.trackerParameters_cff import *', 'from Geometry.TrackerNumberingBuilder.trackerTopology_cfi import *', 'from Geometry.TrackerGeometryBuilder.idealForDigiTrackerGeometry_cff import *', - 'trackerGeometry.applyAlignment = cms.bool(False)', ], }, "T7" : { 1 : [ 'Geometry/TrackerCommonData/data/PhaseI/trackerParameters.xml', - 'Geometry/TrackerCommonData/data/FlatPlus05Percent/2021/trackermaterial.xml', + 'Geometry/TrackerCommonData/data/FlatPlus05Percent/2021/v2/trackermaterial.xml', 'Geometry/TrackerCommonData/data/FlatPlus05Percent/2021/pixfwdMaterials.xml', 'Geometry/TrackerCommonData/data/FlatPlus05Percent/2021/pixbarmaterial.xml', - 'Geometry/TrackerCommonData/data/FlatPlus05Percent/2021/tibtidcommonmaterial.xml', - 'Geometry/TrackerCommonData/data/FlatPlus05Percent/2021/tibmaterial.xml', - 'Geometry/TrackerCommonData/data/FlatPlus05Percent/2021/tidmaterial.xml', - 'Geometry/TrackerCommonData/data/FlatPlus05Percent/2021/tobmaterial.xml', + 'Geometry/TrackerCommonData/data/FlatPlus05Percent/2021/v2/tibtidcommonmaterial.xml', + 'Geometry/TrackerCommonData/data/FlatPlus05Percent/2021/v2/tibmaterial.xml', + 'Geometry/TrackerCommonData/data/FlatPlus05Percent/2021/v2/tidmaterial.xml', + 'Geometry/TrackerCommonData/data/FlatPlus05Percent/2021/v2/tobmaterial.xml', 'Geometry/TrackerCommonData/data/FlatPlus05Percent/2021/tecmaterial.xml', 'Geometry/TrackerCommonData/data/pixfwdCommon.xml', 'Geometry/TrackerCommonData/data/PhaseI/v2/pixfwdCylinder.xml', @@ -1604,19 +1109,18 @@ 'from Geometry.TrackerGeometryBuilder.trackerParameters_cff import *', 'from Geometry.TrackerNumberingBuilder.trackerTopology_cfi import *', 'from Geometry.TrackerGeometryBuilder.idealForDigiTrackerGeometry_cff import *', - 'trackerGeometry.applyAlignment = cms.bool(False)', ], }, "T8" : { 1 : [ 'Geometry/TrackerCommonData/data/PhaseI/trackerParameters.xml', - 'Geometry/TrackerCommonData/data/FlatPlus10Percent/2021/trackermaterial.xml', + 'Geometry/TrackerCommonData/data/FlatPlus10Percent/2021/v2/trackermaterial.xml', 'Geometry/TrackerCommonData/data/FlatPlus10Percent/2021/pixfwdMaterials.xml', 'Geometry/TrackerCommonData/data/FlatPlus10Percent/2021/pixbarmaterial.xml', - 'Geometry/TrackerCommonData/data/FlatPlus10Percent/2021/tibtidcommonmaterial.xml', - 'Geometry/TrackerCommonData/data/FlatPlus10Percent/2021/tibmaterial.xml', - 'Geometry/TrackerCommonData/data/FlatPlus10Percent/2021/tidmaterial.xml', - 'Geometry/TrackerCommonData/data/FlatPlus10Percent/2021/tobmaterial.xml', + 'Geometry/TrackerCommonData/data/FlatPlus10Percent/2021/v2/tibtidcommonmaterial.xml', + 'Geometry/TrackerCommonData/data/FlatPlus10Percent/2021/v2/tibmaterial.xml', + 'Geometry/TrackerCommonData/data/FlatPlus10Percent/2021/v2/tidmaterial.xml', + 'Geometry/TrackerCommonData/data/FlatPlus10Percent/2021/v2/tobmaterial.xml', 'Geometry/TrackerCommonData/data/FlatPlus10Percent/2021/tecmaterial.xml', 'Geometry/TrackerCommonData/data/pixfwdCommon.xml', 'Geometry/TrackerCommonData/data/PhaseI/v2/pixfwdCylinder.xml', @@ -1809,7 +1313,6 @@ 'from Geometry.TrackerGeometryBuilder.trackerParameters_cff import *', 'from Geometry.TrackerNumberingBuilder.trackerTopology_cfi import *', 'from Geometry.TrackerGeometryBuilder.idealForDigiTrackerGeometry_cff import *', - 'trackerGeometry.applyAlignment = cms.bool(False)', ], }, } @@ -1975,527 +1478,8 @@ ppsDict = { "abbrev" : "P", "name" : "pps", - "default" : 2, - "P1" : { - 2 : [ - 'Geometry/ForwardCommonData/data/Run2/totemMaterials.xml', - 'Geometry/ForwardCommonData/data/totemRotations.xml', - 'Geometry/VeryForwardData/data/RP_Box.xml', - 'Geometry/VeryForwardData/data/RP_Box/RP_Box_000.xml', - 'Geometry/VeryForwardData/data/RP_Box/RP_Box_001.xml', - 'Geometry/VeryForwardData/data/RP_Box/RP_Box_002.xml', - 'Geometry/VeryForwardData/data/RP_Box/RP_Box_003.xml', - 'Geometry/VeryForwardData/data/RP_Box/RP_Box_004.xml', - 'Geometry/VeryForwardData/data/RP_Box/RP_Box_005.xml', - 'Geometry/VeryForwardData/data/RP_Box/RP_Box_020.xml', - 'Geometry/VeryForwardData/data/RP_Box/RP_Box_021.xml', - 'Geometry/VeryForwardData/data/RP_Box/RP_Box_022.xml', - 'Geometry/VeryForwardData/data/RP_Box/RP_Box_023.xml', - 'Geometry/VeryForwardData/data/RP_Box/RP_Box_024.xml', - 'Geometry/VeryForwardData/data/RP_Box/RP_Box_025.xml', - 'Geometry/VeryForwardData/data/RP_Box/RP_Box_100.xml', - 'Geometry/VeryForwardData/data/RP_Box/RP_Box_101.xml', - 'Geometry/VeryForwardData/data/RP_Box/RP_Box_102.xml', - 'Geometry/VeryForwardData/data/RP_Box/RP_Box_103.xml', - 'Geometry/VeryForwardData/data/RP_Box/RP_Box_104.xml', - 'Geometry/VeryForwardData/data/RP_Box/RP_Box_105.xml', - 'Geometry/VeryForwardData/data/RP_Box/RP_Box_120.xml', - 'Geometry/VeryForwardData/data/RP_Box/RP_Box_121.xml', - 'Geometry/VeryForwardData/data/RP_Box/RP_Box_122.xml', - 'Geometry/VeryForwardData/data/RP_Box/RP_Box_123.xml', - 'Geometry/VeryForwardData/data/RP_Box/RP_Box_124.xml', - 'Geometry/VeryForwardData/data/RP_Box/RP_Box_125.xml', - 'Geometry/VeryForwardData/data/RP_Hybrid/v1/RP_Hybrid.xml', - 'Geometry/VeryForwardData/data/RP_Materials/v1/RP_Materials.xml', - 'Geometry/VeryForwardData/data/RP_Transformations.xml', - 'Geometry/VeryForwardData/data/RP_Detectors_Assembly.xml', - 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_000.xml', - 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_001.xml', - 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_002.xml', - 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_004.xml', - 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_005.xml', - 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_020.xml', - 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_021.xml', - 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_022.xml', - 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_024.xml', - 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_025.xml', - 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_100.xml', - 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_101.xml', - 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_102.xml', - 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_104.xml', - 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_105.xml', - 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_120.xml', - 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_121.xml', - 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_122.xml', - '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/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', - 'Geometry/VeryForwardData/data/CTPPS_2018/CTPPS_210_Left_Station.xml', - 'Geometry/VeryForwardData/data/CTPPS_Stations_Assembly.xml', - 'Geometry/VeryForwardData/data/CTPPS_Cuts_Per_Region.xml', - 'Geometry/VeryForwardData/data/RP_Sensitive_Dets.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_Materials.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_Transformations.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_Parameters.xml', - 'Geometry/VeryForwardData/data/CTPPS_Timing_Station_Parameters.xml', - 'Geometry/VeryForwardData/data/CTPPS_Timing_Horizontal_Pot.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern1_Segment1.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern2_Segment1.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern2_Segment2.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern3_Segment1.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern3_Segment2.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern3_Segment3.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern3_Segment4.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern4_Segment1.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern4_Segment2.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern4_Segment3.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern4_Segment4.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern4_Segment5.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_2018/CTPPS_Diamond_Planes/CTPPS_Diamond_Plane1.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_2018/CTPPS_Diamond_Planes/CTPPS_Diamond_Plane2.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_2018/CTPPS_Diamond_Planes/CTPPS_Diamond_Plane3.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_2018/CTPPS_Diamond_Planes/CTPPS_Diamond_Plane4.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_2018/CTPPS_Diamond_Detector_Assembly/2021/v1/CTPPS_Diamond_Detector_Assembly.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_Sensitive_Dets_TimingHits.xml', - 'Geometry/VeryForwardData/data/ppstrackerMaterials.xml', - 'Geometry/VeryForwardData/data/CTPPS_Pixel_Module.xml', - 'Geometry/VeryForwardData/data/CTPPS_Pixel_Module_2x2.xml', - 'Geometry/VeryForwardData/data/CTPPS_Pixel_2018/CTPPS_Pixel_Assembly_Box_Real_003.xml', - 'Geometry/VeryForwardData/data/CTPPS_Pixel_2018/CTPPS_Pixel_Assembly_Box_Real_023.xml', - 'Geometry/VeryForwardData/data/CTPPS_Pixel_2018/CTPPS_Pixel_Assembly_Box_Real_103.xml', - 'Geometry/VeryForwardData/data/CTPPS_Pixel_2018/CTPPS_Pixel_Assembly_Box_Real_123.xml', - 'Geometry/VeryForwardData/data/CTPPS_Pixel_Sens.xml', - 'Geometry/VeryForwardData/data/CTPPS_2018/RP_Dist_Beam_Cent.xml', - ], - "sim" : [ - - ], - "reco" :[ - - ], - }, - "P2" : { - 2 : [ - 'Geometry/ForwardCommonData/data/Run2/totemMaterials.xml', - 'Geometry/ForwardCommonData/data/totemRotations.xml', - 'Geometry/VeryForwardData/data/RP_Box.xml', - 'Geometry/VeryForwardData/data/RP_Box/RP_Box_000.xml', - 'Geometry/VeryForwardData/data/RP_Box/RP_Box_001.xml', - 'Geometry/VeryForwardData/data/RP_Box/RP_Box_002.xml', - 'Geometry/VeryForwardData/data/RP_Box/RP_Box_003.xml', - 'Geometry/VeryForwardData/data/RP_Box/RP_Box_004.xml', - 'Geometry/VeryForwardData/data/RP_Box/RP_Box_005.xml', - 'Geometry/VeryForwardData/data/RP_Box/RP_Box_020.xml', - 'Geometry/VeryForwardData/data/RP_Box/RP_Box_021.xml', - 'Geometry/VeryForwardData/data/RP_Box/RP_Box_022.xml', - 'Geometry/VeryForwardData/data/RP_Box/RP_Box_023.xml', - 'Geometry/VeryForwardData/data/RP_Box/RP_Box_024.xml', - 'Geometry/VeryForwardData/data/RP_Box/RP_Box_025.xml', - 'Geometry/VeryForwardData/data/RP_Box/RP_Box_100.xml', - 'Geometry/VeryForwardData/data/RP_Box/RP_Box_101.xml', - 'Geometry/VeryForwardData/data/RP_Box/RP_Box_102.xml', - 'Geometry/VeryForwardData/data/RP_Box/RP_Box_103.xml', - 'Geometry/VeryForwardData/data/RP_Box/RP_Box_104.xml', - 'Geometry/VeryForwardData/data/RP_Box/RP_Box_105.xml', - 'Geometry/VeryForwardData/data/RP_Box/RP_Box_120.xml', - 'Geometry/VeryForwardData/data/RP_Box/RP_Box_121.xml', - 'Geometry/VeryForwardData/data/RP_Box/RP_Box_122.xml', - 'Geometry/VeryForwardData/data/RP_Box/RP_Box_123.xml', - 'Geometry/VeryForwardData/data/RP_Box/RP_Box_124.xml', - 'Geometry/VeryForwardData/data/RP_Box/RP_Box_125.xml', - 'Geometry/VeryForwardData/data/RP_Hybrid/v1/RP_Hybrid.xml', - 'Geometry/VeryForwardData/data/RP_Materials/v1/RP_Materials.xml', - 'Geometry/VeryForwardData/data/RP_Transformations.xml', - 'Geometry/VeryForwardData/data/RP_Detectors_Assembly.xml', - 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_000.xml', - 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_001.xml', - 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_002.xml', - 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_004.xml', - 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_005.xml', - 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_020.xml', - 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_021.xml', - 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_022.xml', - 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_024.xml', - 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_025.xml', - 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_100.xml', - 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_101.xml', - 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_102.xml', - 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_104.xml', - 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_105.xml', - 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_120.xml', - 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_121.xml', - 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_122.xml', - '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/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', - 'Geometry/VeryForwardData/data/CTPPS_2018/CTPPS_210_Left_Station.xml', - 'Geometry/VeryForwardData/data/CTPPS_Stations_Assembly.xml', - 'Geometry/VeryForwardData/data/CTPPS_Cuts_Per_Region.xml', - 'Geometry/VeryForwardData/data/RP_Sensitive_Dets.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_Materials.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_Transformations.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_Parameters.xml', - 'Geometry/VeryForwardData/data/CTPPS_Timing_Station_Parameters.xml', - 'Geometry/VeryForwardData/data/CTPPS_Timing_Horizontal_Pot.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern1_Segment1.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern2_Segment1.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern2_Segment2.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern3_Segment1.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern3_Segment2.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern3_Segment3.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern3_Segment4.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern4_Segment1.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern4_Segment2.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern4_Segment3.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern4_Segment4.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern4_Segment5.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_2018/CTPPS_Diamond_Planes/CTPPS_Diamond_Plane1.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_2018/CTPPS_Diamond_Planes/CTPPS_Diamond_Plane2.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_2018/CTPPS_Diamond_Planes/CTPPS_Diamond_Plane3.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_2018/CTPPS_Diamond_Planes/CTPPS_Diamond_Plane4.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_2018/CTPPS_Diamond_Detector_Assembly/2021/v1/CTPPS_Diamond_Detector_Assembly.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_Sensitive_Dets_TimingHits.xml', - 'Geometry/VeryForwardData/data/ppstrackerMaterials/v1/ppstrackerMaterials.xml', - 'Geometry/VeryForwardData/data/CTPPS_Pixel_Module/v2/CTPPS_Pixel_Module.xml', - 'Geometry/VeryForwardData/data/CTPPS_Pixel_Module_2x2/v2/CTPPS_Pixel_Module_2x2.xml', - 'Geometry/VeryForwardData/data/CTPPS_Pixel_2018/CTPPS_Pixel_Assembly_Box_Real_003.xml', - 'Geometry/VeryForwardData/data/CTPPS_Pixel_2018/CTPPS_Pixel_Assembly_Box_Real_023.xml', - 'Geometry/VeryForwardData/data/CTPPS_Pixel_2018/CTPPS_Pixel_Assembly_Box_Real_103.xml', - 'Geometry/VeryForwardData/data/CTPPS_Pixel_2018/CTPPS_Pixel_Assembly_Box_Real_123.xml', - 'Geometry/VeryForwardData/data/CTPPS_Pixel_Sens.xml', - 'Geometry/VeryForwardData/data/CTPPS_2018/RP_Dist_Beam_Cent.xml', - ], - "sim" : [ - - ], - "reco" :[ - - ], - }, - "P3" : { - 2 : [ - 'Geometry/ForwardCommonData/data/Run2/totemMaterials.xml', - 'Geometry/ForwardCommonData/data/totemRotations.xml', - 'Geometry/VeryForwardData/data/RP_Box.xml', - 'Geometry/VeryForwardData/data/RP_Box/RP_Box_000.xml', - 'Geometry/VeryForwardData/data/RP_Box/RP_Box_001.xml', - 'Geometry/VeryForwardData/data/RP_Box/RP_Box_002.xml', - 'Geometry/VeryForwardData/data/RP_Box/RP_Box_003.xml', - 'Geometry/VeryForwardData/data/RP_Box/RP_Box_004.xml', - 'Geometry/VeryForwardData/data/RP_Box/RP_Box_005.xml', - 'Geometry/VeryForwardData/data/RP_Box/RP_Box_020.xml', - 'Geometry/VeryForwardData/data/RP_Box/RP_Box_021.xml', - 'Geometry/VeryForwardData/data/RP_Box/RP_Box_022.xml', - 'Geometry/VeryForwardData/data/RP_Box/RP_Box_023.xml', - 'Geometry/VeryForwardData/data/RP_Box/RP_Box_024.xml', - 'Geometry/VeryForwardData/data/RP_Box/RP_Box_025.xml', - 'Geometry/VeryForwardData/data/RP_Box/RP_Box_100.xml', - 'Geometry/VeryForwardData/data/RP_Box/RP_Box_101.xml', - 'Geometry/VeryForwardData/data/RP_Box/RP_Box_102.xml', - 'Geometry/VeryForwardData/data/RP_Box/RP_Box_103.xml', - 'Geometry/VeryForwardData/data/RP_Box/RP_Box_104.xml', - 'Geometry/VeryForwardData/data/RP_Box/RP_Box_105.xml', - 'Geometry/VeryForwardData/data/RP_Box/RP_Box_120.xml', - 'Geometry/VeryForwardData/data/RP_Box/RP_Box_121.xml', - 'Geometry/VeryForwardData/data/RP_Box/RP_Box_122.xml', - 'Geometry/VeryForwardData/data/RP_Box/RP_Box_123.xml', - 'Geometry/VeryForwardData/data/RP_Box/RP_Box_124.xml', - 'Geometry/VeryForwardData/data/RP_Box/RP_Box_125.xml', - 'Geometry/VeryForwardData/data/RP_Hybrid/v1/RP_Hybrid.xml', - 'Geometry/VeryForwardData/data/RP_Materials/v2/RP_Materials.xml', - 'Geometry/VeryForwardData/data/RP_Transformations.xml', - 'Geometry/VeryForwardData/data/RP_Detectors_Assembly.xml', - 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_000.xml', - 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_001.xml', - 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_002.xml', - 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_004.xml', - 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_005.xml', - 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_020.xml', - 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_021.xml', - 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_022.xml', - 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_024.xml', - 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_025.xml', - 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_100.xml', - 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_101.xml', - 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_102.xml', - 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_104.xml', - 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_105.xml', - 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_120.xml', - 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_121.xml', - 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_122.xml', - '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/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', - 'Geometry/VeryForwardData/data/CTPPS_2018/CTPPS_210_Left_Station/v1/CTPPS_210_Left_Station.xml', - 'Geometry/VeryForwardData/data/CTPPS_Stations_Assembly.xml', - 'Geometry/VeryForwardData/data/CTPPS_Cuts_Per_Region.xml', - 'Geometry/VeryForwardData/data/RP_Sensitive_Dets.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_Materials.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_Transformations.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_Parameters.xml', - 'Geometry/VeryForwardData/data/CTPPS_Timing_Station_Parameters.xml', - 'Geometry/VeryForwardData/data/CTPPS_Timing_Horizontal_Pot.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern1_Segment1.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern2_Segment1.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern2_Segment2.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern3_Segment1.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern3_Segment2.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern3_Segment3.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern3_Segment4.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern4_Segment1.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern4_Segment2.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern4_Segment3.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern4_Segment4.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern4_Segment5.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_2018/CTPPS_Diamond_Planes/CTPPS_Diamond_Plane1.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_2018/CTPPS_Diamond_Planes/CTPPS_Diamond_Plane2.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_2018/CTPPS_Diamond_Planes/CTPPS_Diamond_Plane3.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_2018/CTPPS_Diamond_Planes/CTPPS_Diamond_Plane4.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_2018/CTPPS_Diamond_Detector_Assembly/2021/v1/CTPPS_Diamond_Detector_Assembly.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_Sensitive_Dets_TimingHits.xml', - 'Geometry/VeryForwardData/data/ppstrackerMaterials/v2/ppstrackerMaterials.xml', - 'Geometry/VeryForwardData/data/CTPPS_Pixel_Module/v3/CTPPS_Pixel_Module.xml', - 'Geometry/VeryForwardData/data/CTPPS_Pixel_Module_2x2/v3/CTPPS_Pixel_Module_2x2.xml', - 'Geometry/VeryForwardData/data/CTPPS_Pixel_2018/CTPPS_Pixel_Assembly_Box_Real_003.xml', - 'Geometry/VeryForwardData/data/CTPPS_Pixel_2018/CTPPS_Pixel_Assembly_Box_Real_023.xml', - 'Geometry/VeryForwardData/data/CTPPS_Pixel_2018/CTPPS_Pixel_Assembly_Box_Real_103.xml', - 'Geometry/VeryForwardData/data/CTPPS_Pixel_2018/CTPPS_Pixel_Assembly_Box_Real_123.xml', - 'Geometry/VeryForwardData/data/CTPPS_Pixel_Sens.xml', - 'Geometry/VeryForwardData/data/CTPPS_2018/RP_Dist_Beam_Cent.xml', - ], - "sim" : [ - - ], - "reco" :[ - - ], - }, - "P4" : { - 2 : [ - 'Geometry/ForwardCommonData/data/Run2/totemMaterials.xml', - 'Geometry/ForwardCommonData/data/totemRotations.xml', - 'Geometry/VeryForwardData/data/RP_Box.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_000.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_001.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_002.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_003.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_004.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_005.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_020.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_021.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_022.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_023.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_024.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_025.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_100.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_101.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_102.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_103.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_104.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_105.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_120.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_121.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_122.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_123.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_124.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_125.xml', - 'Geometry/VeryForwardData/data/RP_Hybrid/v1/RP_Hybrid.xml', - 'Geometry/VeryForwardData/data/RP_Materials/v3/RP_Materials.xml', - 'Geometry/VeryForwardData/data/RP_Transformations.xml', - 'Geometry/VeryForwardData/data/RP_Detectors_Assembly.xml', - 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_000.xml', - 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_001.xml', - 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_002.xml', - 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_004.xml', - 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_005.xml', - 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_020.xml', - 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_021.xml', - 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_022.xml', - 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_024.xml', - 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_025.xml', - 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_100.xml', - 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_101.xml', - 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_102.xml', - 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_104.xml', - 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_105.xml', - 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_120.xml', - 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_121.xml', - 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_122.xml', - '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/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/v2/CTPPS_220_Right_Station.xml', - 'Geometry/VeryForwardData/data/CTPPS_2018/CTPPS_220_Left_Station/v2/CTPPS_220_Left_Station.xml', - 'Geometry/VeryForwardData/data/CTPPS_2018/CTPPS_210_Right_Station/v2/CTPPS_210_Right_Station.xml', - 'Geometry/VeryForwardData/data/CTPPS_2018/CTPPS_210_Left_Station/v2/CTPPS_210_Left_Station.xml', - 'Geometry/VeryForwardData/data/CTPPS_Stations_Assembly.xml', - 'Geometry/VeryForwardData/data/CTPPS_Cuts_Per_Region.xml', - 'Geometry/VeryForwardData/data/RP_Sensitive_Dets.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_Transformations.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_Parameters.xml', - 'Geometry/VeryForwardData/data/CTPPS_Timing_Station_Parameters.xml', - 'Geometry/VeryForwardData/data/CTPPS_Timing_Horizontal_Pot/v1/CTPPS_Timing_Horizontal_Pot.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern1_Segment1.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern2_Segment1.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern2_Segment2.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern3_Segment1.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern3_Segment2.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern3_Segment3.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern3_Segment4.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern4_Segment1.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern4_Segment2.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern4_Segment3.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern4_Segment4.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern4_Segment5.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_2018/CTPPS_Diamond_Planes/CTPPS_Diamond_Plane1.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_2018/CTPPS_Diamond_Planes/CTPPS_Diamond_Plane2.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_2018/CTPPS_Diamond_Planes/CTPPS_Diamond_Plane3.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_2018/CTPPS_Diamond_Planes/CTPPS_Diamond_Plane4.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_2018/CTPPS_Diamond_Detector_Assembly/2021/v1/CTPPS_Diamond_Detector_Assembly.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_Sensitive_Dets_TimingHits.xml', - 'Geometry/VeryForwardData/data/ppstrackerMaterials/v2/ppstrackerMaterials.xml', - 'Geometry/VeryForwardData/data/CTPPS_Pixel_Module/v3/CTPPS_Pixel_Module.xml', - 'Geometry/VeryForwardData/data/CTPPS_Pixel_Module_2x2/v3/CTPPS_Pixel_Module_2x2.xml', - 'Geometry/VeryForwardData/data/CTPPS_Pixel_2018/CTPPS_Pixel_Assembly_Box_Real_003.xml', - 'Geometry/VeryForwardData/data/CTPPS_Pixel_2018/CTPPS_Pixel_Assembly_Box_Real_023.xml', - 'Geometry/VeryForwardData/data/CTPPS_Pixel_2018/CTPPS_Pixel_Assembly_Box_Real_103.xml', - 'Geometry/VeryForwardData/data/CTPPS_Pixel_2018/CTPPS_Pixel_Assembly_Box_Real_123.xml', - 'Geometry/VeryForwardData/data/CTPPS_Pixel_Sens.xml', - 'Geometry/VeryForwardData/data/CTPPS_2018/RP_Dist_Beam_Cent.xml', - ], - "sim" : [ - - ], - "reco" :[ - - ], - }, - "P5" : { - 2 : [ - 'Geometry/ForwardCommonData/data/Run2/totemMaterials.xml', - 'Geometry/ForwardCommonData/data/totemRotations.xml', - 'Geometry/VeryForwardData/data/RP_Box.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_000.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_001.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_002.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_003.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_004.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_005.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_020.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_021.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_022.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_023.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_024.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_025.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_100.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_101.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_102.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_103.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_104.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_105.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_120.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_121.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_122.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_123.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_124.xml', - 'Geometry/VeryForwardData/data/RP_Box/v2/RP_Box_125.xml', - 'Geometry/VeryForwardData/data/RP_Hybrid/v1/RP_Hybrid.xml', - 'Geometry/VeryForwardData/data/RP_Materials/v3/RP_Materials.xml', - 'Geometry/VeryForwardData/data/RP_Transformations.xml', - 'Geometry/VeryForwardData/data/RP_Detectors_Assembly.xml', - 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_000.xml', - 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_001.xml', - 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_002.xml', - 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_004.xml', - 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_005.xml', - 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_020.xml', - 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_021.xml', -# 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_022.xml', - 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_024.xml', - 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_025.xml', - 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_100.xml', - 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_101.xml', - 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_102.xml', - 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_104.xml', - 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_105.xml', - 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_120.xml', - 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_121.xml', -# 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_122.xml', - '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', -# RP_Vertical_Device.xml, RP_Horizontal_Device.xml different RECO vs SIMU - 'Geometry/VeryForwardData/data/RP_Vertical_Device/2021/Simu/v1/RP_Vertical_Device.xml', - 'Geometry/VeryForwardData/data/RP_Horizontal_Device/2021/Simu/v1/RP_Horizontal_Device.xml', -## CTPPS_220_Right_Station is for SIMU. RECO version is called RP_220_Right_Station - 'Geometry/VeryForwardData/data/CTPPS_2021/Stations/Simu/v2/CTPPS_220_Right_Station.xml', - 'Geometry/VeryForwardData/data/CTPPS_2021/Stations/Simu/v2/CTPPS_220_Left_Station.xml', - 'Geometry/VeryForwardData/data/CTPPS_2021/Stations/Simu/v2/CTPPS_210_Right_Station.xml', - 'Geometry/VeryForwardData/data/CTPPS_2021/Stations/Simu/v2/CTPPS_210_Left_Station.xml', - 'Geometry/VeryForwardData/data/CTPPS_2021/Stations/Simu/v2/CTPPS_Stations_Assembly.xml', -# - 'Geometry/VeryForwardData/data/CTPPS_2021/Cuts_Per_Region/Simu/v1/CTPPS_Cuts_Per_Region.xml', - 'Geometry/VeryForwardData/data/RP_Sensitive_Dets.xml', -## - 'Geometry/VeryForwardData/data/CTPPS_Diamond_Transformations.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_Parameters.xml', - 'Geometry/VeryForwardData/data/CTPPS_Timing_Station_Parameters.xml', - 'Geometry/VeryForwardData/data/CTPPS_Timing_Horizontal_Pot/v1/CTPPS_Timing_Horizontal_Pot.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern1_Segment1.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern2_Segment1.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern2_Segment2.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern3_Segment1.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern3_Segment2.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern3_Segment3.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern3_Segment4.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern4_Segment1.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern4_Segment2.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern4_Segment3.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern4_Segment4.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern4_Segment5.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_2021/CTPPS_Diamond_Planes/CTPPS_Diamond_Plane1.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_2021/CTPPS_Diamond_Planes/CTPPS_Diamond_Plane2.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_2021/CTPPS_Diamond_Planes/CTPPS_Diamond_Plane3.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_2021/CTPPS_Diamond_Planes/CTPPS_Diamond_Plane4.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_2021/CTPPS_Diamond_Detector_Assembly.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_2021/Simu/v1/CTPPS_Detectors_Assembly_022.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_2021/Simu/v1/CTPPS_Detectors_Assembly_122.xml', - 'Geometry/VeryForwardData/data/CTPPS_Diamond_Sensitive_Dets_TimingHits.xml', - 'Geometry/VeryForwardData/data/CTPPS_Pixel_2021/Modules/v1/ppstrackerMaterials.xml', - 'Geometry/VeryForwardData/data/CTPPS_Pixel_2021/Modules/v1/PPS_Pixel_Module_2x2_Run3.xml', - 'Geometry/VeryForwardData/data/CTPPS_Pixel_2021/Modules/v1/PPS_Pixel_Sens.xml', - 'Geometry/VeryForwardData/data/CTPPS_Pixel_2021/Assembly/v1/CTPPS_Pixel_Assembly_Box_Real_003.xml', - 'Geometry/VeryForwardData/data/CTPPS_Pixel_2021/Assembly/v1/CTPPS_Pixel_Assembly_Box_Real_023.xml', - 'Geometry/VeryForwardData/data/CTPPS_Pixel_2021/Assembly/v1/CTPPS_Pixel_Assembly_Box_Real_103.xml', - 'Geometry/VeryForwardData/data/CTPPS_Pixel_2021/Assembly/v1/CTPPS_Pixel_Assembly_Box_Real_123.xml', - - 'Geometry/VeryForwardData/data/CTPPS_2021/RP_Dist_Beam_Cent/Simu/v1/RP_Dist_Beam_Cent.xml', - ], - "sim" : [ - - ], - "reco" :[ - - ], - }, - "P6" : { + "default" : 7, + "P7" : { 2 : [ 'Geometry/VeryForwardData/data/RP_Box.xml', 'Geometry/VeryForwardData/data/RP_Box/v3/RP_Box_000.xml', @@ -2579,12 +1563,12 @@ 'Geometry/VeryForwardData/data/CTPPS_Diamond_2021/Simu/v1/CTPPS_Detectors_Assembly_122.xml', 'Geometry/VeryForwardData/data/CTPPS_Diamond_Sensitive_Dets_TimingHits.xml', 'Geometry/VeryForwardData/data/CTPPS_Pixel_2021/Modules/v2/ppstrackerMaterials.xml', - 'Geometry/VeryForwardData/data/CTPPS_Pixel_2021/Modules/v2/PPS_Pixel_Module_2x2_Run3.xml', + 'Geometry/VeryForwardData/data/CTPPS_Pixel_2021/Modules/v3/PPS_Pixel_Module_2x2_Run3.xml', 'Geometry/VeryForwardData/data/CTPPS_Pixel_2021/Modules/v2/PPS_Pixel_Sens.xml', - 'Geometry/VeryForwardData/data/CTPPS_Pixel_2021/Assembly/v1/CTPPS_Pixel_Assembly_Box_Real_003.xml', - 'Geometry/VeryForwardData/data/CTPPS_Pixel_2021/Assembly/v1/CTPPS_Pixel_Assembly_Box_Real_023.xml', - 'Geometry/VeryForwardData/data/CTPPS_Pixel_2021/Assembly/v1/CTPPS_Pixel_Assembly_Box_Real_103.xml', - 'Geometry/VeryForwardData/data/CTPPS_Pixel_2021/Assembly/v1/CTPPS_Pixel_Assembly_Box_Real_123.xml', + 'Geometry/VeryForwardData/data/CTPPS_Pixel_2021/Assembly/v2/CTPPS_Pixel_Assembly_Box_Real_003.xml', + 'Geometry/VeryForwardData/data/CTPPS_Pixel_2021/Assembly/v2/CTPPS_Pixel_Assembly_Box_Real_023.xml', + 'Geometry/VeryForwardData/data/CTPPS_Pixel_2021/Assembly/v2/CTPPS_Pixel_Assembly_Box_Real_103.xml', + 'Geometry/VeryForwardData/data/CTPPS_Pixel_2021/Assembly/v2/CTPPS_Pixel_Assembly_Box_Real_123.xml', 'Geometry/VeryForwardData/data/CTPPS_2021/RP_Dist_Beam_Cent/Simu/v1/RP_Dist_Beam_Cent.xml', ], "sim" : [ @@ -2599,13 +1583,13 @@ allDicts = [ commonDict, trackerDict, caloDict, muonDict, forwardDict, ppsDict ] detectorVersionDict = { - ("O6","T3","C1","M1","F1","P6") : "2021", - ("O4","T4","C1","M1","F1","P6") : "2021ZeroMaterial", - ("O5","T5","C1","M1","F1","P6") : "2021FlatMinus05Percent", - ("O5","T6","C1","M1","F1","P6") : "2021FlatMinus10Percent", - ("O5","T7","C1","M1","F1","P6") : "2021FlatPlus05Percent", - ("O5","T8","C1","M1","F1","P6") : "2021FlatPlus10Percent", + ("O6","T3","C1","M1","F1","P7") : "2021", + ("O4","T4","C1","M1","F1","P7") : "2021ZeroMaterial", + ("O5","T5","C1","M1","F1","P7") : "2021FlatMinus05Percent", + ("O5","T6","C1","M1","F1","P7") : "2021FlatMinus10Percent", + ("O5","T7","C1","M1","F1","P7") : "2021FlatPlus05Percent", + ("O5","T8","C1","M1","F1","P7") : "2021FlatPlus10Percent", } deprecatedSubdets = set([ "T1", "T2", "O1", "O2", "O3", "P1", "P2", "P3", - "P4", "P5" ]) + "P4", "P5", "P6" ]) diff --git a/Configuration/Geometry/python/dict2026Geometry.py b/Configuration/Geometry/python/dict2026Geometry.py index d450ab5c3b596..b84940ef49003 100644 --- a/Configuration/Geometry/python/dict2026Geometry.py +++ b/Configuration/Geometry/python/dict2026Geometry.py @@ -427,7 +427,7 @@ 'from Geometry.TrackerGeometryBuilder.idealForDigiTrackerGeometry_cff import *', 'trackerGeometry.applyAlignment = cms.bool(False)', ], - "era" : "phase2_tracker, phase2_3DPixels, trackingPhase2PU140", + "era" : "phase2_tracker, phase2_brickedPixels, trackingPhase2PU140", } } @@ -978,7 +978,7 @@ 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/ectkcablemat/2026/v2/ectkcablemat.xml', 'Geometry/EcalCommonData/data/ebalgo.xml', 'Geometry/EcalCommonData/data/ebcon/2021/v1/ebcon.xml', 'Geometry/EcalCommonData/data/ebrot.xml', diff --git a/Configuration/HLT/python/addOnTestsHLT.py b/Configuration/HLT/python/addOnTestsHLT.py index c49ace09eef0a..dc134db316c88 100644 --- a/Configuration/HLT/python/addOnTestsHLT.py +++ b/Configuration/HLT/python/addOnTestsHLT.py @@ -1,25 +1,25 @@ def addOnTestsHLT(): addOnTestsHLT = { - 'hlt_mc_Fake' : ['cmsDriver.py TTbar_Tauola_8TeV_TuneCUETP8M1_cfi -s GEN,SIM,DIGI,L1,DIGI2RAW --mc --scenario=pp -n 10 --conditions auto:run1_mc_Fake --relval 9000,50 --datatier "GEN-SIM-RAW" --eventcontent RAWSIM --customise=HLTrigger/Configuration/CustomConfigs.L1T --fileout file:RelVal_Raw_Fake_MC.root', + 'hlt_mc_Fake' : ['cmsDriver.py TTbar_8TeV_TuneCUETP8M1_cfi -s GEN,SIM,DIGI,L1,DIGI2RAW --mc --scenario=pp -n 10 --conditions auto:run1_mc_Fake --relval 9000,50 --datatier "GEN-SIM-RAW" --eventcontent RAWSIM --customise=HLTrigger/Configuration/CustomConfigs.L1T --fileout file:RelVal_Raw_Fake_MC.root', 'HLTrigger/Configuration/test/OnLine_HLT_Fake.py', 'cmsDriver.py RelVal -s HLT:Fake,RAW2DIGI,L1Reco,RECO --mc --scenario=pp -n 10 --conditions auto:run1_mc_Fake --relval 9000,50 --datatier "RAW-HLT-RECO" --eventcontent FEVTDEBUGHLT --customise=HLTrigger/Configuration/CustomConfigs.L1THLT --processName=HLTRECO --filein file:RelVal_Raw_Fake_MC.root --fileout file:RelVal_Raw_Fake_MC_HLT_RECO.root'], - 'hlt_mc_Fake1': ['cmsDriver.py TTbar_Tauola_13TeV_TuneCUETP8M1_cfi -s GEN,SIM,DIGI,L1,DIGI2RAW --mc --scenario=pp -n 10 --conditions auto:run2_mc_Fake1 --relval 9000,50 --datatier "GEN-SIM-RAW" --eventcontent RAWSIM --customise=HLTrigger/Configuration/CustomConfigs.L1T --era Run2_25ns --fileout file:RelVal_Raw_Fake1_MC.root', + 'hlt_mc_Fake1': ['cmsDriver.py TTbar_13TeV_TuneCUETP8M1_cfi -s GEN,SIM,DIGI,L1,DIGI2RAW --mc --scenario=pp -n 10 --conditions auto:run2_mc_Fake1 --relval 9000,50 --datatier "GEN-SIM-RAW" --eventcontent RAWSIM --customise=HLTrigger/Configuration/CustomConfigs.L1T --era Run2_25ns --fileout file:RelVal_Raw_Fake1_MC.root', 'HLTrigger/Configuration/test/OnLine_HLT_Fake1.py', 'cmsDriver.py RelVal -s HLT:Fake1,RAW2DIGI,L1Reco,RECO --mc --scenario=pp -n 10 --conditions auto:run2_mc_Fake1 --relval 9000,50 --datatier "RAW-HLT-RECO" --eventcontent FEVTDEBUGHLT --customise=HLTrigger/Configuration/CustomConfigs.L1THLT --era Run2_25ns --processName=HLTRECO --filein file:RelVal_Raw_Fake1_MC.root --fileout file:RelVal_Raw_Fake1_MC_HLT_RECO.root'], - 'hlt_mc_Fake2': ['cmsDriver.py TTbar_Tauola_13TeV_TuneCUETP8M1_cfi -s GEN,SIM,DIGI,L1,DIGI2RAW --mc --scenario=pp -n 10 --conditions auto:run2_mc_Fake2 --relval 9000,50 --datatier "GEN-SIM-RAW" --eventcontent RAWSIM --customise=HLTrigger/Configuration/CustomConfigs.L1T --era Run2_2016 --fileout file:RelVal_Raw_Fake2_MC.root', + 'hlt_mc_Fake2': ['cmsDriver.py TTbar_13TeV_TuneCUETP8M1_cfi -s GEN,SIM,DIGI,L1,DIGI2RAW --mc --scenario=pp -n 10 --conditions auto:run2_mc_Fake2 --relval 9000,50 --datatier "GEN-SIM-RAW" --eventcontent RAWSIM --customise=HLTrigger/Configuration/CustomConfigs.L1T --era Run2_2016 --fileout file:RelVal_Raw_Fake2_MC.root', 'HLTrigger/Configuration/test/OnLine_HLT_Fake2.py', 'cmsDriver.py RelVal -s HLT:Fake2,RAW2DIGI,L1Reco,RECO --mc --scenario=pp -n 10 --conditions auto:run2_mc_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_MC.root --fileout file:RelVal_Raw_Fake2_MC_HLT_RECO.root'], - 'hlt_mc_GRun' : ['cmsDriver.py TTbar_Tauola_13TeV_TuneCUETP8M1_cfi -s GEN,SIM,DIGI,L1,DIGI2RAW --mc --scenario=pp -n 10 --conditions auto:run3_mc_GRun --relval 9000,50 --datatier "GEN-SIM-RAW" --eventcontent RAWSIM --customise=HLTrigger/Configuration/CustomConfigs.L1T --era Run3 --fileout file:RelVal_Raw_GRun_MC.root', + 'hlt_mc_GRun' : ['cmsDriver.py TTbar_13TeV_TuneCUETP8M1_cfi -s GEN,SIM,DIGI,L1,DIGI2RAW --mc --scenario=pp -n 10 --conditions auto:run3_mc_GRun --relval 9000,50 --datatier "GEN-SIM-RAW" --eventcontent RAWSIM --customise=HLTrigger/Configuration/CustomConfigs.L1T --era Run3 --fileout file:RelVal_Raw_GRun_MC.root', 'HLTrigger/Configuration/test/OnLine_HLT_GRun.py', 'cmsDriver.py RelVal -s HLT:GRun,RAW2DIGI,L1Reco,RECO --mc --scenario=pp -n 10 --conditions auto:run3_mc_GRun --relval 9000,50 --datatier "RAW-HLT-RECO" --eventcontent FEVTDEBUGHLT --customise=HLTrigger/Configuration/CustomConfigs.L1THLT --era Run3 --processName=HLTRECO --filein file:RelVal_Raw_GRun_MC.root --fileout file:RelVal_Raw_GRun_MC_HLT_RECO.root'], - 'hlt_mc_HIon' : ['cmsDriver.py TTbar_Tauola_13TeV_TuneCUETP8M1_cfi -s GEN,SIM,DIGI,L1,DIGI2RAW --mc --scenario=pp -n 10 --conditions auto:run3_mc_HIon --relval 9000,50 --datatier "GEN-SIM-RAW" --eventcontent RAWSIM --customise=HLTrigger/Configuration/CustomConfigs.L1T --era Run3_pp_on_PbPb --fileout file:RelVal_Raw_HIon_MC.root', + 'hlt_mc_HIon' : ['cmsDriver.py TTbar_13TeV_TuneCUETP8M1_cfi -s GEN,SIM,DIGI,L1,DIGI2RAW --mc --scenario=pp -n 10 --conditions auto:run3_mc_HIon --relval 9000,50 --datatier "GEN-SIM-RAW" --eventcontent RAWSIM --customise=HLTrigger/Configuration/CustomConfigs.L1T --era Run3_pp_on_PbPb --fileout file:RelVal_Raw_HIon_MC.root', 'HLTrigger/Configuration/test/OnLine_HLT_HIon.py', 'cmsDriver.py RelVal -s HLT:HIon,RAW2DIGI,L1Reco,RECO --mc --scenario=pp -n 10 --conditions auto:run3_mc_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_MC.root --fileout file:RelVal_Raw_HIon_MC_HLT_RECO.root'], - 'hlt_mc_PIon' : ['cmsDriver.py TTbar_Tauola_13TeV_TuneCUETP8M1_cfi -s GEN,SIM,DIGI,L1,DIGI2RAW --mc --scenario=pp -n 10 --conditions auto:run3_mc_PIon --relval 9000,50 --datatier "GEN-SIM-RAW" --eventcontent RAWSIM --customise=HLTrigger/Configuration/CustomConfigs.L1T --era Run3 --fileout file:RelVal_Raw_PIon_MC.root', + 'hlt_mc_PIon' : ['cmsDriver.py TTbar_13TeV_TuneCUETP8M1_cfi -s GEN,SIM,DIGI,L1,DIGI2RAW --mc --scenario=pp -n 10 --conditions auto:run3_mc_PIon --relval 9000,50 --datatier "GEN-SIM-RAW" --eventcontent RAWSIM --customise=HLTrigger/Configuration/CustomConfigs.L1T --era Run3 --fileout file:RelVal_Raw_PIon_MC.root', 'HLTrigger/Configuration/test/OnLine_HLT_PIon.py', 'cmsDriver.py RelVal -s HLT:PIon,RAW2DIGI,L1Reco,RECO --mc --scenario=pp -n 10 --conditions auto:run3_mc_PIon --relval 9000,50 --datatier "RAW-HLT-RECO" --eventcontent FEVTDEBUGHLT --customise=HLTrigger/Configuration/CustomConfigs.L1THLT --era Run3 --processName=HLTRECO --filein file:RelVal_Raw_PIon_MC.root --fileout file:RelVal_Raw_PIon_MC_HLT_RECO.root'], - 'hlt_mc_PRef' : ['cmsDriver.py TTbar_Tauola_13TeV_TuneCUETP8M1_cfi -s GEN,SIM,DIGI,L1,DIGI2RAW --mc --scenario=pp -n 10 --conditions auto:run3_mc_PRef --relval 9000,50 --datatier "GEN-SIM-RAW" --eventcontent RAWSIM --customise=HLTrigger/Configuration/CustomConfigs.L1T --era Run3 --fileout file:RelVal_Raw_PRef_MC.root', + 'hlt_mc_PRef' : ['cmsDriver.py TTbar_13TeV_TuneCUETP8M1_cfi -s GEN,SIM,DIGI,L1,DIGI2RAW --mc --scenario=pp -n 10 --conditions auto:run3_mc_PRef --relval 9000,50 --datatier "GEN-SIM-RAW" --eventcontent RAWSIM --customise=HLTrigger/Configuration/CustomConfigs.L1T --era Run3 --fileout file:RelVal_Raw_PRef_MC.root', 'HLTrigger/Configuration/test/OnLine_HLT_PRef.py', 'cmsDriver.py RelVal -s HLT:PRef,RAW2DIGI,L1Reco,RECO --mc --scenario=pp -n 10 --conditions auto:run3_mc_PRef --relval 9000,50 --datatier "RAW-HLT-RECO" --eventcontent FEVTDEBUGHLT --customise=HLTrigger/Configuration/CustomConfigs.L1THLT --era Run3 --processName=HLTRECO --filein file:RelVal_Raw_PRef_MC.root --fileout file:RelVal_Raw_PRef_MC_HLT_RECO.root'], 'hlt_data_Fake' : ['cmsDriver.py RelVal -s L1REPACK:GT1 --data --scenario=pp -n 10 --conditions auto:run1_hlt_Fake --relval 9000,50 --datatier "RAW" --eventcontent RAW --customise=HLTrigger/Configuration/CustomConfigs.L1T --fileout file:RelVal_Raw_Fake_DATA.root --filein /store/data/Run2012A/MuEG/RAW/v1/000/191/718/14932935-E289-E111-830C-5404A6388697.root', diff --git a/Configuration/PyReleaseValidation/README.md b/Configuration/PyReleaseValidation/README.md index 4c43222519724..6942ed89355d1 100644 --- a/Configuration/PyReleaseValidation/README.md +++ b/Configuration/PyReleaseValidation/README.md @@ -32,13 +32,17 @@ The offsets currently in use are: * 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.502: Patatrack, pixel only quadruplets, with automatic offload to GPU if available * 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.506: Patatrack, pixel only triplets, with automatic offload to GPU if available +* 0.511: Patatrack, ECAL only, on CPU +* 0.512: Patatrack, ECAL only, with automatic offload to GPU if available +* 0.521: Patatrack, HCAL only, on CPU +* 0.522: Patatrack, HCAL only, with automatic offload to GPU if available +* 0.591: Patatrack, full reco with pixel quadruplets, on CPU +* 0.592: Patatrack, full reco with pixel quadruplets, with automatic offload to GPU if available +* 0.595: Patatrack, full reco with pixel triplets, on CPU +* 0.596: Patatrack, full reco with pixel triplets, with automatic offload to GPU if available * 0.6: HE Collapse (old depth segmentation for 2018) * 0.7: trackingMkFit modifier * 0.8: BPH Parking (Run-2) diff --git a/Configuration/PyReleaseValidation/python/MatrixInjector.py b/Configuration/PyReleaseValidation/python/MatrixInjector.py index 6d8a1223ef32e..750c460b53c99 100644 --- a/Configuration/PyReleaseValidation/python/MatrixInjector.py +++ b/Configuration/PyReleaseValidation/python/MatrixInjector.py @@ -65,6 +65,19 @@ def __init__(self,opt,mode='init',options=''): if(opt.batchName): self.batchName = '__'+opt.batchName+'-'+self.batchTime + #################################### + # Checking and setting up GPU attributes + #################################### + # Mendatory + self.RequiresGPU = opt.gpu + self.GPUMemoryMB = opt.GPUMemoryMB + self.CUDACapabilities = opt.CUDACapabilities + self.CUDARuntime = opt.CUDARuntime + # optional + self.GPUName = opt.GPUName + self.CUDADriverVersion = opt.CUDADriverVersion + self.CUDARuntimeVersion = opt.CUDARuntimeVersion + # WMagent url if not self.wmagent: # Overwrite with env variable @@ -180,8 +193,18 @@ def __init__(self,opt,mode='init',options=''): "nowmIO": {}, "Multicore" : opt.nThreads, # this is the per-taskchain Multicore; it's the default assigned to a task if it has no value specified "EventStreams": self.numberOfStreams, - "KeepOutput" : False + "KeepOutput" : False, + "RequiresGPU" : None, + "GPUParams": None + } + self.defaultGPUParams={ + "GPUMemoryMB": self.GPUMemoryMB, + "CUDACapabilities": self.CUDACapabilities, + "CUDARuntime": self.CUDARuntime } + if self.GPUName: self.defaultGPUParams.update({"GPUName": self.GPUName}) + if self.CUDADriverVersion: self.defaultGPUParams.update({"CUDADriverVersion": self.CUDADriverVersion}) + if self.CUDARuntimeVersion: self.defaultGPUParams.update({"CUDARuntimeVersion": self.CUDARuntimeVersion}) self.chainDicts={} @@ -408,6 +431,9 @@ def prepare(self, mReader, directories, mode='init'): if setPrimaryDs: chainDict['nowmTasklist'][-1]['PrimaryDataset']=setPrimaryDs nextHasDSInput=None + if 'GPU' in step and self.RequiresGPU != 'forbidden': + chainDict['nowmTasklist'][-1]['RequiresGPU'] = self.RequiresGPU + chainDict['nowmTasklist'][-1]['GPUParams']=json.dumps(self.defaultGPUParams) else: #not first step and no inputDS chainDict['nowmTasklist'].append(copy.deepcopy(self.defaultTask)) @@ -420,6 +446,9 @@ def prepare(self, mReader, directories, mode='init'): chainDict['nowmTasklist'][-1]['LumisPerJob']=splitForThisWf if step in wmsplit: chainDict['nowmTasklist'][-1]['LumisPerJob']=wmsplit[step] + if 'GPU' in step and self.RequiresGPU != 'forbidden': + chainDict['nowmTasklist'][-1]['RequiresGPU'] = self.RequiresGPU + chainDict['nowmTasklist'][-1]['GPUParams']=json.dumps(self.defaultGPUParams) # change LumisPerJob for Hadronizer steps. if 'Hadronizer' in step: @@ -439,11 +468,14 @@ def prepare(self, mReader, directories, mode='init'): if 'pileup' in chainDict['nowmTasklist'][-1]['nowmIO']: chainDict['nowmTasklist'][-1]['MCPileup']=chainDict['nowmTasklist'][-1]['nowmIO']['pileup'] if '--pileup ' in s[2][index]: # catch --pileup (scenarion) and not --pileup_ (dataset to be mixed) => works also making PRE-MIXed dataset + pileupString = s[2][index].split()[s[2][index].split().index('--pileup')+1] processStrPrefix='PU_' # take care of pu overlay done with GEN-SIM mixing - if ( s[2][index].split()[ s[2][index].split().index('--pileup')+1 ] ).find('25ns') > 0 : + if pileupString.find('25ns') > 0 : processStrPrefix='PU25ns_' - elif ( s[2][index].split()[ s[2][index].split().index('--pileup')+1 ] ).find('50ns') > 0 : + elif pileupString.find('50ns') > 0 : processStrPrefix='PU50ns_' + elif 'nopu' in pileupString.lower(): + processStrPrefix='' if 'premix_stage2' in s[2][index] and '--pileup_input' in s[2][index]: # take care of pu overlay done with DIGI mixing of premixed events if s[2][index].split()[ s[2][index].split().index('--pileup_input')+1 ].find('25ns') > 0 : processStrPrefix='PUpmx25ns_' diff --git a/Configuration/PyReleaseValidation/python/relval_2017.py b/Configuration/PyReleaseValidation/python/relval_2017.py index 440b8d120f04a..0c65ccc7fd102 100644 --- a/Configuration/PyReleaseValidation/python/relval_2017.py +++ b/Configuration/PyReleaseValidation/python/relval_2017.py @@ -16,18 +16,19 @@ # 2017 (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, ZEE PU, TTbar design) # (TTbar trackingOnly, trackingRun2, trackingOnlyRun2, trackingLowPU, pixelTrackingOnly) -# (TTbar PU with JME NanoAOD) +# (TTbar PU with JME NanoAOD, disable for now due to Run-3 Nano-Prompt preparation) # 2018 (ele guns 10, 35, 1000; pho guns 10, 35; mu guns 1, 10, 100, 1000, QCD 3TeV, QCD Flat) # 2018 (ZMM, TTbar, ZEE, MinBias, TTbar PU, ZEE PU, TTbar design) # (TTbar trackingOnly, pixelTrackingOnly) # (HE collapse: TTbar, TTbar PU, TTbar design) # (ParkingBPH: TTbar) -# (TTbar PU with JME NanoAOD) +# (TTbar PU with JME NanoAOD, disable for now due to Run-3 Nano-Prompt preparation) # (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) +# 2021 (DD4HEP XML: TTbar, ZMM) +# (DD4HEP DB: TTbar) # (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) @@ -43,13 +44,13 @@ numWFIB = [10001.0,10002.0,10003.0,10004.0,10005.0,10006.0,10007.0,10008.0,10009.0,10059.0,10071.0, 10042.0,10024.0,10025.0,10026.0,10023.0,10224.0,10225.0,10424.0, 10024.1,10024.2,10024.3,10024.4,10024.5, - 10224.15, + #10224.15, 10801.0,10802.0,10803.0,10804.0,10805.0,10806.0,10807.0,10808.0,10809.0,10859.0,10871.0, 10842.0,10824.0,10825.0,10826.0,10823.0,11024.0,11025.0,11224.0, 10824.1,10824.5, 10824.6,11024.6,11224.6, 10824.8, - 11024.15, + #11024.15, 10842.501,10842.505, 10824.501,10824.505, 10824.511, diff --git a/Configuration/PyReleaseValidation/python/relval_gpu.py b/Configuration/PyReleaseValidation/python/relval_gpu.py index db417a2a94365..04dfa32a05f83 100644 --- a/Configuration/PyReleaseValidation/python/relval_gpu.py +++ b/Configuration/PyReleaseValidation/python/relval_gpu.py @@ -20,12 +20,16 @@ # (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) +# (Patatrack full reco with pixel quadruplets: TTbar - on GPU, both CPU and GPU, auto) +# (Patatrack full reco with pixel triplets: 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) +# (Patatrack full reco with pixel quadruplets: TTbar - on GPU, both CPU and GPU, auto) +# (Patatrack full reco with pixel triplets: TTbar - on GPU, both CPU and GPU, auto) numWFIB = [ 10842.502, # 10842.503,10842.504, 10842.506, # 10842.507,10842.508, @@ -33,12 +37,16 @@ 10824.506, # 10824.507,10824.508, 10824.512, # 10824.513,10824.514, 10824.522, # 10824.523,10824.524, + 10824.592, # 10824.593,10824.594, + 10824.596, # 10824.597,10824.598, 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 + 11634.592, # 11634.593,11634.594, + 11634.596, # 11634.597,11634.598, ] for numWF in numWFIB: if not numWF in _upgrade_workflows: continue diff --git a/Configuration/PyReleaseValidation/python/relval_pileup.py b/Configuration/PyReleaseValidation/python/relval_pileup.py index 8f2fd8794c9d9..55b30ebadced3 100644 --- a/Configuration/PyReleaseValidation/python/relval_pileup.py +++ b/Configuration/PyReleaseValidation/python/relval_pileup.py @@ -39,7 +39,7 @@ workflows[25202]=['',['TTbar_13','DIGIUP15_PU25','RECOUP15_PU25','HARVESTUP15_PU25','NANOUP15_PU25']] workflows[25202.1]=['',['TTbar_13','DIGIUP15APVSimu_PU25','RECOUP15_PU25','HARVESTUP15_PU25']] workflows[25202.2]=['',['TTbar_13','DIGIUP15APVSimu_PU25','RECOUP15_PU25_HIPM','HARVESTUP15_PU25']] -workflows[25202.15]=['',['TTbar_13','DIGIUP15_PU25','RECOUP15_PU25','HARVESTUP15_PU25','NANOUP15MC_PU25_JME']] +#workflows[25202.15]=['',['TTbar_13','DIGIUP15_PU25','RECOUP15_PU25','HARVESTUP15_PU25','NANOUP15MC_PU25_JME']] #JME NanoAOD, disable until Nano-Run3 prompt dev is done workflows[25203]=['',['H125GGgluonfusion_13','DIGIUP15_PU25','RECOUP15_PU25','HARVESTUP15_PU25','NANOUP15_PU25']] workflows[25204]=['',['QQH1352T_13','DIGIUP15_PU25','RECOUP15_PU25','HARVESTUP15_PU25']] workflows[25205]=['',['ZTT_13','DIGIUP15_PU25','RECOUP15_PU25','HARVESTUP15_PU25','NANOUP15_PU25']] diff --git a/Configuration/PyReleaseValidation/python/relval_production.py b/Configuration/PyReleaseValidation/python/relval_production.py index a7bbc199faf7d..0dd840730b0f2 100644 --- a/Configuration/PyReleaseValidation/python/relval_production.py +++ b/Configuration/PyReleaseValidation/python/relval_production.py @@ -11,7 +11,7 @@ ## data production test workflows[1000] = [ '',['RunMinBias2011A','TIER0','SKIMD','HARVESTDfst2','ALCASPLIT']] -workflows[1001] = [ '',['RunMinBias2011A','TIER0EXP','ALCAEXP','ALCAHARVDSIPIXELCALRUN1','ALCAHARVD1','ALCAHARVD2','ALCAHARVD3','ALCAHARVD4','ALCAHARVD5']] +workflows[1001] = [ '',['RunMinBias2011A','TIER0EXP','ALCAEXP','ALCAHARVDSIPIXELCALRUN1','ALCAHARVD1','ALCAHARVD2','ALCAHARVD3','ALCAHARVD4','ALCAHARVD5','ALCAHARVD7']] workflows[1001.2] = [ '',['RunZeroBias2017F','TIER0EXPRUN2','ALCAEXPRUN2','ALCAHARVDSIPIXELCAL']] workflows[1002]=['RRD',['RunMinBias2011A','RECODR1','COPYPASTE']] @@ -26,6 +26,7 @@ workflows[1040.1] = ['',['RunExpressPhy2017F','TIER0EXPSIPIXELCAL','ALCASPLITSIPIXELCAL','ALCAHARVDSIPIXELCAL']] workflows[1041] = ['',['RunExpressPhy2017F','TIER0EXPPPSCAL','ALCASPLITPPSCAL','ALCAHARVDPPSCAL']] +workflows[1042] = ['',['RunExpressPhy2017F','TIER0EXPPPSCAL','ALCASPLITPPSALIG','ALCAHARVDPPSALIG']] ## MC production test #workflows[1100] = [ '',[]] diff --git a/Configuration/PyReleaseValidation/python/relval_standard.py b/Configuration/PyReleaseValidation/python/relval_standard.py index 7e339233900b6..d82ea4a2e5a1a 100644 --- a/Configuration/PyReleaseValidation/python/relval_standard.py +++ b/Configuration/PyReleaseValidation/python/relval_standard.py @@ -191,6 +191,8 @@ workflows[136.735] = ['',['RunNoBPTX2016B','HLTDR2_2016','RECODR2reHLTAlCaTkCosmics_HIPM','HARVESTDR2']] # reminiAOD wf on 2016B input, mainly here for PPS testing workflows[136.72411] = ['',['RunJetHT2016B_reminiaodUL','REMINIAOD_data2016UL_HIPM','HARVESTDR2_REMINIAOD_data2016UL_HIPM']] +workflows[136.72412] = ['',['RunJetHT2016B_reminiaodUL','REMININANO_data2016UL_HIPM','HARVESTDR2_REMININANO_data2016UL_HIPM']] +#workflows[136.72413] = ['',['RunJetHT2016B_reminiaodUL','REMININANO_data2016UL_HIPM_met','HARVESTDR2_REMININANO_data2016UL_HIPM_met']] #diable for now until MET is fixed. ### run 2016C ### workflows[136.736] = ['',['RunHLTPhy2016C','HLTDR2_2016','RECODR2_2016reHLT_HIPM','HARVESTDR2']] @@ -425,11 +427,14 @@ workflows[136.885521] = ['',['RunHLTPhy2018D','HLTDR2_2018','RECODR2_2018reHLT_HCALOnlyCPU','HARVEST2018_HCALOnly']] workflows[136.888521] = ['',['RunJetHT2018D','HLTDR2_2018','RECODR2_2018reHLT_HCALOnlyCPU','HARVEST2018_HCALOnly']] +### run 2021 CRUZET ### +workflows[136.897] = ['',['RunCosmics2021CRUZET','RECOCOSDRUN3','ALCACOSDRUN3','HARVESTDCRUN3']] + # multi-run harvesting workflows[137.8] = ['',['RunEGamma2018C','HLTDR2_2018','RECODR2_2018reHLT_skimEGamma_Offline_L1TEgDQM', 'RunEGamma2018D','HLTDR2_2018','RECODR2_2018reHLT_skimEGamma_Prompt_L1TEgDQM','HARVEST2018_L1TEgDQM_MULTIRUN']] ### LS2 - MWGR ### -workflows[138.1] = ['',['RunCosmics2021','RECOCOSDPROMPTRUN3','ALCACOSDRUN3','HARVESTDCRUN3']] +workflows[138.1] = ['',['RunCosmics2021','RECOCOSDPROMPTRUN3','ALCACOSDPROMPTRUN3','HARVESTDCPROMPTRUN3']] workflows[138.2] = ['',['RunCosmics2021','RECOCOSDEXPRUN3','ALCACOSDEXPRUN3','HARVESTDCEXPRUN3']] #### Test of lumi section boundary crossing with run2 2018D #### diff --git a/Configuration/PyReleaseValidation/python/relval_steps.py b/Configuration/PyReleaseValidation/python/relval_steps.py index a6d51b37517b8..82d2ce53f3631 100644 --- a/Configuration/PyReleaseValidation/python/relval_steps.py +++ b/Configuration/PyReleaseValidation/python/relval_steps.py @@ -493,6 +493,9 @@ ### LS2 - MWGR 2021 - CSC, DAQ, DCS, DQM, DT, ECAL, GEM, HCAL, L1SCOUT, PIXEL, RPC, TCDS, TRACKER, TRG ### steps['RunCosmics2021']={'INPUT':InputInfo(dataSet='/ExpressCosmics/Commissioning2021-Express-v1/FEVT',label='2021GR5',ls={343498: [[1, 10000]]},events=100000,location='STD')} +#### run3 Cosmics #### +##Run 344518 @ 0T 2021CRUZET +steps['RunCosmics2021CRUZET']={'INPUT':InputInfo(dataSet='/Cosmics/Commissioning2021-v1/RAW',label='2021CRUZET',run=[344518],events=100000,location='STD')} #### Test of lumi section boundary crossing with run2 2018D #### Run2018Dml1={320822: [[1,1]] , 320823: [[1,1]]} @@ -1357,7 +1360,7 @@ def identityFS(wf): steps['BsToMuMu_forSTEAM_13TeV_ExtGen']=genvalid('BsToMuMu_forSTEAM_13TeV_ExtGen_cfi',step1GenDefaults) steps['BuToKstarJPsiToMuMu_forSTEAM_13TeV_ExtGen']=genvalid('BuToKstarJPsiToMuMu_forSTEAM_13TeV_ExtGen_cfi',step1GenDefaults) steps['ZTTFS_ExtGen']=genvalid('ZTT_Tauola_OneLepton_OtherHadrons_8TeV_TuneCUETP8M1_ExtGen_cfi',step1GenDefaults) -steps['sherpa_ttbar_2j_MENLOPS_13TeV_MASTER_ExtGen']=genvalid('sherpa_ttbar_2j_MENLOPS_13TeV_MASTER_ExtGen_cff',step1GenDefaults) +steps['sherpa_ttbar_2j_MENLOPS_13TeV_MASTER_ExtGen']=genvalid('sherpa_ttbar_2j_MENLOPS_13TeV_MASTER_ExtGen_cff',merge([{'-n':'50'},step1GenDefaults])) steps['HydjetQ_B12_5020GeV_2018_ExtGen']=genvalid('Hydjet_Quenched_B12_5020GeV_ExtGen_cfi',step1GenDefaults) steps['AMPT_PPb_5020GeV_MinimumBias_ExtGen']=genvalid('AMPT_PPb_5020GeV_MinimumBias_ExtGen_cfi',step1GenDefaults) steps['EPOS_PPb_8160GeV_MinimumBias_ExtGen']=genvalid('ReggeGribovPartonMC_EposLHC_4080_4080GeV_pPb_ExtGen_cfi',step1GenDefaults) @@ -2123,6 +2126,16 @@ def lhegensim2018ml(fragment,howMuch): '--triggerResultsProcess':'RECO', } +steps['ALCASPLITPPSALIG']={'-s':'ALCAOUTPUT:PPSCalTrackBasedSel,ALCA:PPSAlignment', + '--scenario':'pp', + '--data':'', + '--era':'Run2_2017', + '--datatier':'ALCARECO', + '--eventcontent':'ALCARECO', + '--conditions':'auto:run3_data_express', + '--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 @@ -2162,6 +2175,13 @@ def lhegensim2018ml(fragment,howMuch): '--era':'Run2_2017', '--filein':'file:PPSTimingCalib.root'} +steps['ALCAHARVDPPSALIG']={'-s':'ALCAHARVEST:%s'%(autoPCL['PromptCalibProdPPSAlig']), + '--conditions':'auto:run3_data_express', + '--scenario':'pp', + '--data':'', + '--era':'Run2_2017', + '--filein':'file:PPSAlignment.root'} + steps['RECOCOSD']=merge([{'--scenario':'cosmics', '-s':'RAW2DIGI,L1Reco,RECO,DQM', '--datatier':'RECO,DQMIO', # no miniAOD for cosmics @@ -2170,7 +2190,7 @@ def lhegensim2018ml(fragment,howMuch): },dataReco]) steps['RECOCOSDRUN2']=merge([{'--conditions':'auto:run2_data','--era':'Run2_2016'},steps['RECOCOSD']]) -steps['RECOCOSDRUN3']=merge([{'--conditions':'auto:run3_data_prompt','--era':'Run3'},steps['RECOCOSD']]) +steps['RECOCOSDRUN3']=merge([{'--conditions':'auto:run3_data','--era':'Run3'},steps['RECOCOSD']]) steps['RECOCOSDPROMPTRUN3']=merge([{'--conditions':'auto:run3_data_prompt', '--era':'Run3', @@ -2442,7 +2462,7 @@ def gen2021HiMix(fragment,howMuch): steps['RECOMINUP15']=merge([{'-s':'RAW2DIGI,L1Reco,RECO,RECOSIM,EI,ALCA:SiStripCalZeroBias+SiStripCalMinBias,VALIDATION,DQM'},step3Up2015Defaults]) steps['RECOAODUP15']=merge([{'--datatier':'AODSIM,MINIAODSIM,DQMIO','--eventcontent':'AODSIM,MINIAODSIM,DQM'},step3Up2015Defaults]) -steps['RECODDQM']=merge([{'-s':'RAW2DIGI,L1Reco,RECO,EI,DQM:@common+@muon+@hcal+@jetmet+@ecal'},steps['RECOD']]) +steps['RECODDQM']=merge([{'-s':'RAW2DIGI,L1Reco,RECO,EI,DQM:@allForPrompt'},steps['RECOD']]) steps['RECOPU1']=merge([PU,steps['RECO']]) steps['RECOPU2']=merge([PU2,steps['RECO']]) @@ -2594,23 +2614,24 @@ def gen2021HiMix(fragment,howMuch): '-s':'ALCA:TkAlCosmics0T+MuAlGlobalCosmics+HcalCalHOCosmics+DQM' } -steps['ALCACOSDRUN2']=merge([{'--conditions':'auto:run2_data','--era':'Run2_2016','-s':'ALCA:SiPixelCalCosmics+TkAlCosmics0T+SiStripCalCosmics+MuAlGlobalCosmics+HcalCalHOCosmics+DQM'},steps['ALCACOSD']]) +steps['ALCACOSDRUN2']=merge([{'--conditions':'auto:run2_data','--era':'Run2_2016','-s':'ALCA:SiPixelCalCosmics+TkAlCosmics0T+SiStripCalCosmics+SiStripCalCosmicsNano+MuAlGlobalCosmics+HcalCalHOCosmics+DQM'},steps['ALCACOSD']]) -steps['ALCACOSDRUN3']=merge([{'--conditions':'auto:run3_data_prompt','--era':'Run3','-s':'ALCA:SiPixelCalCosmics+TkAlCosmics0T+SiStripCalCosmics+MuAlGlobalCosmics+HcalCalHOCosmics+DQM'},steps['ALCACOSD']]) -steps['ALCACOSDEXPRUN3']=merge([{'--conditions':'auto:run3_data_express','--era':'Run3','-s':'ALCA:SiPixelCalCosmics+TkAlCosmics0T+SiStripCalCosmics+MuAlGlobalCosmics+HcalCalHOCosmics+DQM'},steps['ALCACOSD']]) +steps['ALCACOSDRUN3']=merge([{'--conditions':'auto:run3_data','--era':'Run3','-s':'ALCA:SiPixelCalCosmics+TkAlCosmics0T+SiStripCalCosmics+SiStripCalCosmicsNano+MuAlGlobalCosmics+HcalCalHOCosmics+DQM'},steps['ALCACOSD']]) +steps['ALCACOSDPROMPTRUN3']=merge([{'--conditions':'auto:run3_data_prompt','--era':'Run3','-s':'ALCA:SiPixelCalCosmics+TkAlCosmics0T+SiStripCalCosmics+SiStripCalCosmicsNano+MuAlGlobalCosmics+HcalCalHOCosmics+DQM'},steps['ALCACOSD']]) +steps['ALCACOSDEXPRUN3']=merge([{'--conditions':'auto:run3_data_express','--era':'Run3','-s':'ALCA:SiPixelCalCosmics+TkAlCosmics0T+SiStripCalCosmics+SiStripCalCosmicsNano+MuAlGlobalCosmics+HcalCalHOCosmics+DQM'},steps['ALCACOSD']]) steps['ALCAPROMPT']={'-s':'ALCA:PromptCalibProd', '--filein':'file:TkAlMinBias.root', '--conditions':'auto:run1_data', '--datatier':'ALCARECO', '--eventcontent':'ALCARECO'} -steps['ALCAEXP']={'-s':'ALCAOUTPUT:SiStripCalZeroBias+TkAlMinBias+Hotline+LumiPixelsMinBias+AlCaPCCZeroBiasFromRECO+AlCaPCCRandomFromRECO,ALCA:PromptCalibProd+PromptCalibProdSiStrip+PromptCalibProdSiStripGains+PromptCalibProdSiStripGainsAAG+PromptCalibProdSiPixelAli+PromptCalibProdSiPixel', +steps['ALCAEXP']={'-s':'ALCAOUTPUT:SiStripCalZeroBias+TkAlMinBias+Hotline+LumiPixelsMinBias+AlCaPCCZeroBiasFromRECO+AlCaPCCRandomFromRECO+SiPixelCalSingleMuon,ALCA:PromptCalibProd+PromptCalibProdSiStrip+PromptCalibProdSiStripGains+PromptCalibProdSiStripGainsAAG+PromptCalibProdSiPixelAli+PromptCalibProdSiPixel+PromptCalibProdSiPixelLorentzAngle', '--conditions':'auto:run1_data', '--datatier':'ALCARECO', '--eventcontent':'ALCARECO', '--triggerResultsProcess': 'RECO'} -steps['ALCAEXPRUN2']={'-s':'ALCAOUTPUT:SiStripCalZeroBias+TkAlMinBias+LumiPixelsMinBias+AlCaPCCZeroBiasFromRECO+AlCaPCCRandomFromRECO+SiPixelCalZeroBias,ALCA:PromptCalibProd+PromptCalibProdSiStrip+PromptCalibProdSiStripGains+PromptCalibProdSiStripGainsAAG+PromptCalibProdSiPixelAli+PromptCalibProdSiPixel', +steps['ALCAEXPRUN2']={'-s':'ALCAOUTPUT:SiStripCalZeroBias+TkAlMinBias+LumiPixelsMinBias+AlCaPCCZeroBiasFromRECO+AlCaPCCRandomFromRECO+SiPixelCalZeroBias+SiPixelCalSingleMuon,ALCA:PromptCalibProd+PromptCalibProdSiStrip+PromptCalibProdSiStripGains+PromptCalibProdSiStripGainsAAG+PromptCalibProdSiPixelAli+PromptCalibProdSiPixel+PromptCalibProdSiPixelLorentzAngle', '--conditions':'auto:run2_data', '--datatier':'ALCARECO', '--eventcontent':'ALCARECO', @@ -2654,10 +2675,10 @@ def gen2021HiMix(fragment,howMuch): steps['ALCAHAL']=merge([{'-s':'ALCA:TkAlBeamHalo+MuAlBeamHaloOverlaps+MuAlBeamHalo'},step4Up2015Defaults]) steps['ALCACOS_UP15']=merge([{'--conditions':'auto:run2_mc_cosmics','-s':'ALCA:TkAlBeamHalo+MuAlBeamHaloOverlaps+MuAlBeamHalo'},step4Up2015Defaults]) -steps['ALCACOS_UP16']=merge([{'--conditions':'auto:run2_mc_cosmics','-s':'ALCA:TkAlCosmics0T+SiStripCalCosmics+SiPixelCalCosmics+TkAlBeamHalo+MuAlBeamHaloOverlaps+MuAlBeamHalo','--era':'Run2_2016'},step4Up2015Defaults]) -steps['ALCACOS_UP17']=merge([{'--conditions':'auto:phase1_2017_cosmics','-s':'ALCA:TkAlCosmics0T+SiStripCalCosmics+SiPixelCalCosmics+TkAlBeamHalo+MuAlBeamHaloOverlaps+MuAlBeamHalo','--era':'Run2_2017'},step4Up2015Defaults]) -steps['ALCACOS_UP18']=merge([{'--conditions':'auto:phase1_2018_cosmics','-s':'ALCA:TkAlCosmics0T+SiStripCalCosmics+SiPixelCalCosmics+TkAlBeamHalo+MuAlBeamHaloOverlaps+MuAlBeamHalo','--era':'Run2_2018'},step4Up2015Defaults]) -steps['ALCACOS_UP21']=merge([{'--conditions':'auto:phase1_2021_cosmics','-s':'ALCA:TkAlCosmics0T+SiStripCalCosmics+SiPixelCalCosmics+TkAlBeamHalo+MuAlBeamHaloOverlaps+MuAlBeamHalo','--era':'Run3'},step4Up2015Defaults]) +steps['ALCACOS_UP16']=merge([{'--conditions':'auto:run2_mc_cosmics','-s':'ALCA:TkAlCosmics0T+SiStripCalCosmics+SiStripCalCosmicsNano+SiPixelCalCosmics+TkAlBeamHalo+MuAlBeamHaloOverlaps+MuAlBeamHalo','--era':'Run2_2016'},step4Up2015Defaults]) +steps['ALCACOS_UP17']=merge([{'--conditions':'auto:phase1_2017_cosmics','-s':'ALCA:TkAlCosmics0T+SiStripCalCosmics+SiStripCalCosmicsNano+SiPixelCalCosmics+TkAlBeamHalo+MuAlBeamHaloOverlaps+MuAlBeamHalo','--era':'Run2_2017'},step4Up2015Defaults]) +steps['ALCACOS_UP18']=merge([{'--conditions':'auto:phase1_2018_cosmics','-s':'ALCA:TkAlCosmics0T+SiStripCalCosmics+SiStripCalCosmicsNano+SiPixelCalCosmics+TkAlBeamHalo+MuAlBeamHaloOverlaps+MuAlBeamHalo','--era':'Run2_2018'},step4Up2015Defaults]) +steps['ALCACOS_UP21']=merge([{'--conditions':'auto:phase1_2021_cosmics','-s':'ALCA:TkAlCosmics0T+SiStripCalCosmics+SiStripCalCosmicsNano+SiPixelCalCosmics+TkAlBeamHalo+MuAlBeamHaloOverlaps+MuAlBeamHalo','--era':'Run3'},step4Up2015Defaults]) steps['ALCACOS_UP21_0T']=merge([{'--magField':'0T','--conditions':'auto:phase1_2021_cosmics_0T'},steps['ALCACOS_UP21']]) steps['ALCAHARVD']={'-s':'ALCAHARVEST:BeamSpotByRun+BeamSpotByLumi+SiStripQuality', '--conditions':'auto:run1_data', @@ -2708,6 +2729,12 @@ def gen2021HiMix(fragment,howMuch): '--data':'', '--filein':'file:PromptCalibProdSiPixel.root'} +steps['ALCAHARVD7']={'-s':'ALCAHARVEST:%s'%(autoPCL['PromptCalibProdSiPixelLA']), + '--conditions':'auto:run1_data', + '--scenario':'pp', + '--data':'', + '--filein':'file:PromptCalibProdSiPixelLorentzAngle.root'} + steps['ALCAHARVD5HI']=merge([{'--scenario':'HeavyIons'},steps['ALCAHARVD5']]) steps['ALCAHARVDTE']={'-s':'ALCAHARVEST:%s'%(autoPCL['PromptCalibProdEcalPedestals']), '--conditions':'auto:run2_data', @@ -2804,7 +2831,7 @@ def gen2021HiMix(fragment,howMuch): steps['HARVESTDQMHLTonAOD_2017'] = merge([ {'--filein':'file:DQMHLTonAOD.root','-s':'HARVESTING:hltOfflineDQMClient'}, steps['HARVEST2017'] ]) ### Harvesting step for the DQM-only workflow -steps['HARVESTDDQM']=merge([{'-s':'HARVESTING:@common+@muon+@hcal+@jetmet+@ecal'},steps['HARVESTD']]) +steps['HARVESTDDQM']=merge([{'-s':'HARVESTING:@allForPrompt'},steps['HARVESTD']]) steps['HARVESTDfst2']=merge([{'--filein':'file:step2_inDQM.root'},steps['HARVESTDR1']]) @@ -2817,13 +2844,18 @@ def gen2021HiMix(fragment,howMuch): steps['HARVESTDCRUN2']=merge([{'--conditions':'auto:run2_data','--era':'Run2_2016'},steps['HARVESTDC']]) -steps['HARVESTDCRUN3']=merge([{'--conditions':'auto:run3_data_prompt','--era':'Run3'},steps['HARVESTDC']]) +steps['HARVESTDCRUN3']=merge([{'--conditions':'auto:run3_data','--era':'Run3'},steps['HARVESTDC']]) +steps['HARVESTDCPROMPTRUN3']=merge([{'--conditions':'auto:run3_data_prompt','--era':'Run3'},steps['HARVESTDC']]) steps['HARVESTDCEXPRUN3']=merge([{'--conditions':'auto:run3_data_express','--era':'Run3'},steps['HARVESTDC']]) steps['HARVESTDR2_REMINIAOD_data2016']=merge([{'--data':'', '-s':'HARVESTING:@miniAODDQM','--era':'Run2_2016,run2_miniAOD_80XLegacy'},steps['HARVESTDR2']]) +steps['HARVESTDR2_REMININANO_data2016']=merge([{'--data':'', '-s':'HARVESTING:@miniAODDQM+@nanoAODDQM','--era':'Run2_2016'},steps['HARVESTDR2']]) steps['HARVESTDR2_REMINIAOD_data2016_HIPM']=merge([{'--era':'Run2_2016_HIPM,run2_miniAOD_80XLegacy'},steps['HARVESTDR2_REMINIAOD_data2016']]) steps['HARVESTDR2_REMINIAOD_data2016UL']=merge([{'--era':'Run2_2016', '--procModifiers':'run2_miniAOD_UL_preSummer20'},steps['HARVESTDR2_REMINIAOD_data2016']]) +steps['HARVESTDR2_REMININANO_data2016UL']=merge([{'--era':'Run2_2016', '--procModifiers':'run2_miniAOD_UL_preSummer20'},steps['HARVESTDR2_REMININANO_data2016']]) steps['HARVESTDR2_REMINIAOD_data2016UL_HIPM']=merge([{'--era':'Run2_2016_HIPM'},steps['HARVESTDR2_REMINIAOD_data2016UL']]) +steps['HARVESTDR2_REMININANO_data2016UL_HIPM']=merge([{'--era':'Run2_2016_HIPM,run2_nanoAOD_106Xv2,run3_nanoAOD_devel'},steps['HARVESTDR2_REMININANO_data2016UL']]) +steps['HARVESTDR2_REMININANO_data2016UL_HIPM_met']=merge([{'--era':'Run2_2016_HIPM,run2_nanoAOD_106Xv1,run3_nanoAOD_devel'},steps['HARVESTDR2_REMININANO_data2016UL']]) steps['HARVEST2017_REMINIAOD_data2017']=merge([{'--era':'Run2_2017,run2_miniAOD_94XFall17'},steps['HARVESTDR2_REMINIAOD_data2016']]) steps['HARVEST2017_REMINIAOD_data2017UL']=merge([{'--era':'Run2_2017'},steps['HARVESTDR2_REMINIAOD_data2016UL']]) @@ -2855,7 +2887,6 @@ def gen2021HiMix(fragment,howMuch): '--filetype':'DQM', '--scenario':'pp'} - steps['HARVESTCOS']={'-s':'HARVESTING:dqmHarvestingFakeHLT', '--conditions':'auto:run1_mc', '--mc':'', @@ -3105,9 +3136,22 @@ def gen2021HiMix(fragment,howMuch): '--datatier' : 'MINIAOD,DQMIO' },stepMiniAODDefaults]) +steps['REMININANO_data2016'] = merge([{'-s' : 'PAT,NANO,DQM:@miniAODDQM+@nanoAODDQM', + '--process' : 'PATnano', + '--era' : 'Run2_2016', + '--conditions' : 'auto:run2_data_relval', + '--data' : '', + '--scenario' : 'pp', + '--eventcontent' : 'MINIAOD,NANOEDMAOD,DQM', + '--datatier' : 'MINIAOD,NANOAOD,DQMIO' + }]) + steps['REMINIAOD_data2016_HIPM'] = merge([{'--era' : 'Run2_2016_HIPM,run2_miniAOD_80XLegacy'},steps['REMINIAOD_data2016']]) steps['REMINIAOD_data2016UL'] = merge([{'--era' : 'Run2_2016', '--procModifiers' : 'run2_miniAOD_UL_preSummer20'},steps['REMINIAOD_data2016']]) +steps['REMININANO_data2016UL'] = merge([{'--era' : 'Run2_2016', '--procModifiers' : 'run2_miniAOD_UL_preSummer20'},steps['REMININANO_data2016']]) steps['REMINIAOD_data2016UL_HIPM'] = merge([{'--era' : 'Run2_2016_HIPM'},steps['REMINIAOD_data2016UL']]) +steps['REMININANO_data2016UL_HIPM'] = merge([{'--era' : 'Run2_2016_HIPM,run2_nanoAOD_106Xv2,run3_nanoAOD_devel'},steps['REMININANO_data2016UL']]) +steps['REMININANO_data2016UL_HIPM_met'] = merge([{'--era' : 'Run2_2016_HIPM,run2_nanoAOD_106Xv1,run3_nanoAOD_devel'},steps['REMININANO_data2016UL']]) stepReMiniAODData17 = merge([{'--era' : 'Run2_2017,run2_miniAOD_94XFall17'},steps['REMINIAOD_data2016']]) steps['REMINIAOD_data2017'] = stepReMiniAODData17 @@ -3258,7 +3302,7 @@ def gen2021HiMix(fragment,howMuch): '--datatier':'NANOAODSIM', '--eventcontent':'NANOEDMAODSIM', '--filein':'file:step3_inMINIAODSIM.root'} - + ################################################################################# ####From this line till the end of the file : ####UPGRADE WORKFLOWS IN PREPARATION - Gaelle's sandbox - @@ -3439,6 +3483,14 @@ def gen2021HiMix(fragment,howMuch): '--filetype':'DQM', } + upgradeStepDict['HARVESTRecNan'][k]={'-s':'HARVESTING:@standardValidation+@standardDQM+@ExtraHLT+@miniAODValidation+@miniAODDQM+@nanoAODDQM', + '--conditions':gt, + '--mc':'', + '--geometry' : geom, + '--scenario' : 'pp', + '--filetype':'DQM', + } + upgradeStepDict['HARVESTFakeHLT'][k]={'-s':'HARVESTING:@standardValidationNoHLT+@standardDQMFakeHLT+@miniAODValidation+@miniAODDQM', '--conditions':gt, '--mc':'', @@ -3473,15 +3525,23 @@ def gen2021HiMix(fragment,howMuch): '--scenario' : 'pp' } - upgradeStepDict['Nano'][k] = {'-s':'NANO', + upgradeStepDict['Nano'][k] = {'-s':'NANO,DQM:@nanoAODDQM', '--conditions':gt, - '--datatier':'NANOAODSIM', + '--datatier':'NANOAODSIM,DQMIO', '-n':'10', - '--eventcontent':'NANOEDMAODSIM', + '--eventcontent':'NANOEDMAODSIM,DQM', '--filein':'file:step3_inMINIAODSIM.root', '--geometry' : geom } - + + upgradeStepDict['RecNan'][k] = {'-s':'RAW2DIGI,L1Reco,RECO,RECOSIM,EI,PAT,NANO,VALIDATION:@standardValidation+@miniAODValidation,DQM:@standardDQM+@ExtraHLT+@miniAODDQM+@nanoAODDQM', + '--conditions':gt, + '--datatier':'GEN-SIM-RECO,MINIAODSIM,NANOAODSIM,DQMIO', + '-n':'10', + '--eventcontent':'RECOSIM,MINIAODSIM,NANOEDMAODSIM,DQM', + '--geometry' : geom + } + # setup baseline and variations for specialType,specialWF in upgradeWFs.items(): specialWF.setup(upgradeStepDict, k, upgradeProperties[year][k]) diff --git a/Configuration/PyReleaseValidation/python/relval_upgrade.py b/Configuration/PyReleaseValidation/python/relval_upgrade.py index 574bb2cff83a9..341102308fc28 100644 --- a/Configuration/PyReleaseValidation/python/relval_upgrade.py +++ b/Configuration/PyReleaseValidation/python/relval_upgrade.py @@ -28,7 +28,7 @@ def makeStepName(key,frag,step,suffix): for specialType in upgradeWFs.keys(): stepList[specialType] = [] hasHarvest = False - for step in upgradeProperties[year][key]['ScenToRun']: + for step in upgradeProperties[year][key]['ScenToRun']: stepMaker = makeStepName if 'Sim' in step: if 'HLBeamSpot' in step: @@ -47,6 +47,7 @@ def makeStepName(key,frag,step,suffix): if 'ProdLike' in specialType: if 'Reco' in step: # handles both Reco and RecoGlobal stepList[specialType].append(stepMaker(key,frag[:-4],step.replace('RecoGlobal','MiniAOD').replace('Reco','MiniAOD'),specialWF.suffix)) + stepList[specialType].append(stepMaker(key,frag[:-4],step.replace('RecoGlobal','Nano').replace('Reco','Nano'),specialWF.suffix)) # similar hacks for premixing if 'PMX' in specialType: if 'GenSim' in step: @@ -59,6 +60,11 @@ def makeStepName(key,frag,step,suffix): else: stepList[specialType][-1] = stepMade else: stepList[specialType].append(stepMaker(key,frag[:-4],step,'')) + + if specialType in ['baseline']: + for ist, st in enumerate(stepList[specialType]): + if st.split('_')[0] == 'Reco': stepList[specialType][ist] = st.replace('Reco', 'RecNan') + elif st.split('_')[0] == 'HARVEST': stepList[specialType][ist] = st.replace('HARVEST', 'HARVESTRecNan') for specialType,specialWF in upgradeWFs.items(): # remove other steps for premixS1 diff --git a/Configuration/PyReleaseValidation/python/upgradeWorkflowComponents.py b/Configuration/PyReleaseValidation/python/upgradeWorkflowComponents.py index bd2a20d5e2471..d6cb11b15e450 100644 --- a/Configuration/PyReleaseValidation/python/upgradeWorkflowComponents.py +++ b/Configuration/PyReleaseValidation/python/upgradeWorkflowComponents.py @@ -150,7 +150,9 @@ def setup_(self, step, stepName, stepDict, k, properties): era=properties.get('Era', None) modifier=properties.get('ProcessModifier',None) if cust is not None: stepDict[stepName][k]['--customise']=cust - if era is not None: stepDict[stepName][k]['--era']=era + if era is not None: + stepDict[stepName][k]['--era']=era + if 'RecNan' in stepName: stepDict[stepName][k]['--era'] += ',run3_nanoAOD_devel' if modifier is not None: stepDict[stepName][k]['--procModifier']=modifier def condition(self, fragment, stepList, key, hasHarvest): return True @@ -168,12 +170,14 @@ def condition(self, fragment, stepList, key, hasHarvest): 'RecoGlobal', 'HARVEST', 'HARVESTFakeHLT', + 'HARVESTRecNan', 'FastSim', 'HARVESTFast', 'HARVESTGlobal', 'ALCA', 'Nano', 'MiniAOD', + 'RecNan', ], PU = [ 'DigiTrigger', @@ -184,9 +188,11 @@ def condition(self, fragment, stepList, key, hasHarvest): 'RecoFakeHLT', 'HARVEST', 'HARVESTFakeHLT', + 'HARVESTRecNan', 'HARVESTGlobal', 'MiniAOD', 'Nano', + 'RecNan', ], suffix = '', offset = 0.0, @@ -415,10 +421,12 @@ def condition(self, fragment, stepList, key, hasHarvest): # - 2021 conditions, TTbar # - 2021 conditions, Z->mumu, class PatatrackWorkflow(UpgradeWorkflow): - def __init__(self, reco, harvest, **kwargs): + def __init__(self, digi = {}, reco = {}, harvest = {}, **kwargs): # adapt the parameters for the UpgradeWorkflow init method super(PatatrackWorkflow, self).__init__( steps = [ + 'Digi', + 'DigiTrigger', 'Reco', 'HARVEST', 'RecoFakeHLT', @@ -428,6 +436,7 @@ def __init__(self, reco, harvest, **kwargs): ], PU = [], **kwargs) + self.__digi = digi self.__reco = reco self.__reco.update({ '--datatier': 'GEN-SIM-RECO,DQMIO', @@ -452,13 +461,27 @@ def condition(self, fragment, stepList, key, hasHarvest): return result def setup_(self, step, stepName, stepDict, k, properties): - if 'Reco' in step: - stepDict[stepName][k] = merge([self.__reco, stepDict[step][k]]) + if 'Digi' in step: + if self.__digi is None: + stepDict[stepName][k] = None + else: + stepDict[stepName][k] = merge([self.__digi, stepDict[step][k]]) + elif 'Reco' in step: + if self.__reco is None: + stepDict[stepName][k] = None + else: + stepDict[stepName][k] = merge([self.__reco, stepDict[step][k]]) elif 'HARVEST' in step: - stepDict[stepName][k] = merge([self.__harvest, stepDict[step][k]]) + if self.__harvest is None: + stepDict[stepName][k] = None + else: + stepDict[stepName][k] = merge([self.__harvest, stepDict[step][k]]) upgradeWFs['PatatrackPixelOnlyCPU'] = PatatrackWorkflow( + digi = { + # there is no customisation for enabling the Patatrack pixel quadruplets running only on the CPU + }, reco = { '-s': 'RAW2DIGI:RawToDigi_pixelOnly,RECO:reconstruction_pixelTrackingOnly,VALIDATION:@pixelTrackingOnlyValidation,DQM:@pixelTrackingOnlyDQM', '--procModifiers': 'pixelNtupletFit' @@ -471,6 +494,9 @@ def setup_(self, step, stepName, stepDict, k, properties): ) upgradeWFs['PatatrackPixelOnlyGPU'] = PatatrackWorkflow( + digi = { + '--procModifiers': 'gpu' + }, reco = { '-s': 'RAW2DIGI:RawToDigi_pixelOnly,RECO:reconstruction_pixelTrackingOnly,VALIDATION:@pixelTrackingOnlyValidation,DQM:@pixelTrackingOnlyDQM', '--procModifiers': 'pixelNtupletFit,gpu' @@ -482,7 +508,26 @@ def setup_(self, step, stepName, stepDict, k, properties): offset = 0.502, ) +# add here a .503 workflow for GPU vs CPU validation + +upgradeWFs['PatatrackPixelOnlyGPUProfiling'] = PatatrackWorkflow( + digi = { + '--procModifiers': 'gpu' + }, + reco = { + '-s': 'RAW2DIGI:RawToDigi_pixelOnly,RECO:reconstruction_pixelTrackingOnly', + '--procModifiers': 'pixelNtupletFit,gpu', + '--customise' : 'RecoTracker/Configuration/customizePixelOnlyForProfiling.customizePixelOnlyForProfilingGPUOnly' + }, + harvest = None, + suffix = 'Patatrack_PixelOnlyGPU_Profiling', + offset = 0.504, +) + upgradeWFs['PatatrackPixelOnlyTripletsCPU'] = PatatrackWorkflow( + digi = { + # there is no customisation for enabling the Patatrack pixel triplets running only on the CPU + }, reco = { '-s': 'RAW2DIGI:RawToDigi_pixelOnly,RECO:reconstruction_pixelTrackingOnly,VALIDATION:@pixelTrackingOnlyValidation,DQM:@pixelTrackingOnlyDQM', '--procModifiers': 'pixelNtupletFit', @@ -496,6 +541,10 @@ def setup_(self, step, stepName, stepDict, k, properties): ) upgradeWFs['PatatrackPixelOnlyTripletsGPU'] = PatatrackWorkflow( + digi = { + '--procModifiers': 'gpu', + '--customise': 'HLTrigger/Configuration/customizeHLTforPatatrack.enablePatatrackPixelTriplets' + }, reco = { '-s': 'RAW2DIGI:RawToDigi_pixelOnly,RECO:reconstruction_pixelTrackingOnly,VALIDATION:@pixelTrackingOnlyValidation,DQM:@pixelTrackingOnlyDQM', '--procModifiers': 'pixelNtupletFit,gpu', @@ -508,6 +557,23 @@ def setup_(self, step, stepName, stepDict, k, properties): offset = 0.506, ) +# add here a .507 workflow for GPU vs CPU validation + +upgradeWFs['PatatrackPixelOnlyTripletsGPUProfiling'] = PatatrackWorkflow( + digi = { + '--procModifiers': 'gpu', + '--customise': 'HLTrigger/Configuration/customizeHLTforPatatrack.enablePatatrackPixelTriplets' + }, + reco = { + '-s': 'RAW2DIGI:RawToDigi_pixelOnly,RECO:reconstruction_pixelTrackingOnly', + '--procModifiers': 'pixelNtupletFit,gpu', + '--customise': 'RecoPixelVertexing/Configuration/customizePixelTracksForTriplets.customizePixelTracksForTriplets,RecoTracker/Configuration/customizePixelOnlyForProfiling.customizePixelOnlyForProfilingGPUOnly' + }, + harvest = None, + suffix = 'Patatrack_PixelOnlyTripletsGPU_Profiling', + offset = 0.508, +) + upgradeWFs['PatatrackECALOnlyCPU'] = PatatrackWorkflow( reco = { '-s': 'RAW2DIGI:RawToDigi_ecalOnly,RECO:reconstruction_ecalOnly,VALIDATION:@ecalOnlyValidation,DQM:@ecalOnly', @@ -520,6 +586,9 @@ def setup_(self, step, stepName, stepDict, k, properties): ) upgradeWFs['PatatrackECALOnlyGPU'] = PatatrackWorkflow( + digi = { + '--procModifiers': 'gpu' + }, reco = { '-s': 'RAW2DIGI:RawToDigi_ecalOnly,RECO:reconstruction_ecalOnly,VALIDATION:@ecalOnlyValidation,DQM:@ecalOnly', '--procModifiers': 'gpu' @@ -531,6 +600,22 @@ def setup_(self, step, stepName, stepDict, k, properties): offset = 0.512, ) +# add here a .513 workflow for GPU vs CPU validation + +upgradeWFs['PatatrackECALOnlyGPUProfiling'] = PatatrackWorkflow( + digi = { + '--procModifiers': 'gpu' + }, + reco = { + '-s': 'RAW2DIGI:RawToDigi_ecalOnly,RECO:reconstruction_ecalOnly', + '--procModifiers': 'gpu', + '--customise' : 'RecoLocalCalo/Configuration/customizeEcalOnlyForProfiling.customizeEcalOnlyForProfilingGPUOnly' + }, + harvest = None, + suffix = 'Patatrack_ECALOnlyGPU_Profiling', + offset = 0.514, +) + upgradeWFs['PatatrackHCALOnlyCPU'] = PatatrackWorkflow( reco = { '-s': 'RAW2DIGI:RawToDigi_hcalOnly,RECO:reconstruction_hcalOnly,VALIDATION:@hcalOnlyValidation,DQM:@hcalOnly+@hcal2Only', @@ -543,6 +628,9 @@ def setup_(self, step, stepName, stepDict, k, properties): ) upgradeWFs['PatatrackHCALOnlyGPU'] = PatatrackWorkflow( + digi = { + '--procModifiers': 'gpu' + }, reco = { '-s': 'RAW2DIGI:RawToDigi_hcalOnly,RECO:reconstruction_hcalOnly,VALIDATION:@hcalOnlyValidation,DQM:@hcalOnly+@hcal2Only', '--procModifiers': 'gpu' @@ -554,6 +642,85 @@ def setup_(self, step, stepName, stepDict, k, properties): offset = 0.522, ) +# add here a .523 workflow for GPU vs CPU validation + +upgradeWFs['PatatrackHCALOnlyGPUProfiling'] = PatatrackWorkflow( + digi = { + '--procModifiers': 'gpu' + }, + reco = { + '-s': 'RAW2DIGI:RawToDigi_hcalOnly,RECO:reconstruction_hcalOnly', + '--procModifiers': 'gpu', + '--customise' : 'RecoLocalCalo/Configuration/customizeHcalOnlyForProfiling.customizeHcalOnlyForProfilingGPUOnly' + }, + harvest = None, + suffix = 'Patatrack_HCALOnlyGPU_Profiling', + offset = 0.524, +) + +upgradeWFs['PatatrackCPU'] = PatatrackWorkflow( + digi = { + # there is no customisation for enabling the Patatrack pixel quadruplets running only on the CPU + }, + reco = { + # skip the @pixelTrackingOnlyValidation which cannot run together with the full reconstruction + '-s': 'RAW2DIGI:RawToDigi+RawToDigi_pixelOnly,L1Reco,RECO:reconstruction+reconstruction_pixelTrackingOnly,RECOSIM,EI,PAT,VALIDATION:@standardValidation+@miniAODValidation,DQM:@standardDQM+@ExtraHLT+@miniAODDQM+@pixelTrackingOnlyDQM', + '--procModifiers': 'pixelNtupletFit' + }, + harvest = { + }, + suffix = 'Patatrack_CPU', + offset = 0.591, +) + +upgradeWFs['PatatrackGPU'] = PatatrackWorkflow( + digi = { + '--procModifiers': 'gpu' + }, + reco = { + # skip the @pixelTrackingOnlyValidation which cannot run together with the full reconstruction + '-s': 'RAW2DIGI:RawToDigi+RawToDigi_pixelOnly,L1Reco,RECO:reconstruction+reconstruction_pixelTrackingOnly,RECOSIM,EI,PAT,VALIDATION:@standardValidation+@miniAODValidation,DQM:@standardDQM+@ExtraHLT+@miniAODDQM+@pixelTrackingOnlyDQM', + '--procModifiers': 'pixelNtupletFit,gpu' + }, + harvest = { + }, + suffix = 'Patatrack_GPU', + offset = 0.592, +) + +upgradeWFs['PatatrackTripletsCPU'] = PatatrackWorkflow( + digi = { + # there is no customisation for enabling the Patatrack pixel triplets running only on the CPU + }, + reco = { + # skip the @pixelTrackingOnlyValidation which cannot run together with the full reconstruction + '-s': 'RAW2DIGI:RawToDigi+RawToDigi_pixelOnly,L1Reco,RECO:reconstruction+reconstruction_pixelTrackingOnly,RECOSIM,EI,PAT,VALIDATION:@standardValidation+@miniAODValidation,DQM:@standardDQM+@ExtraHLT+@miniAODDQM+@pixelTrackingOnlyDQM', + '--procModifiers': 'pixelNtupletFit', + '--customise' : 'RecoPixelVertexing/Configuration/customizePixelTracksForTriplets.customizePixelTracksForTriplets' + }, + harvest = { + }, + suffix = 'Patatrack_TripletsCPU', + offset = 0.595, +) + +upgradeWFs['PatatrackTripletsGPU'] = PatatrackWorkflow( + digi = { + '--procModifiers': 'gpu', + '--customise': 'HLTrigger/Configuration/customizeHLTforPatatrack.enablePatatrackPixelTriplets' + }, + reco = { + # skip the @pixelTrackingOnlyValidation which cannot run together with the full reconstruction + '-s': 'RAW2DIGI:RawToDigi+RawToDigi_pixelOnly,L1Reco,RECO:reconstruction+reconstruction_pixelTrackingOnly,RECOSIM,EI,PAT,VALIDATION:@standardValidation+@miniAODValidation,DQM:@standardDQM+@ExtraHLT+@miniAODDQM+@pixelTrackingOnlyDQM', + '--procModifiers': 'pixelNtupletFit,gpu', + '--customise': 'RecoPixelVertexing/Configuration/customizePixelTracksForTriplets.customizePixelTracksForTriplets' + }, + harvest = { + }, + suffix = 'Patatrack_TripletsGPU', + offset = 0.596, +) + # end of Patatrack workflows class UpgradeWorkflow_ProdLike(UpgradeWorkflow): @@ -573,7 +740,7 @@ def setup_(self, step, stepName, stepDict, k, properties): # remove step stepDict[stepName][k] = None if 'Nano' in step: - stepDict[stepName][k] = merge([{'--filein':'file:step4.root'}, stepDict[step][k]]) + stepDict[stepName][k] = merge([{'--filein':'file:step4.root','-s':'NANO','--datatier':'NANOAODSIM','--eventcontent':'NANOEDMAODSIM'}, stepDict[step][k]]) def condition(self, fragment, stepList, key, hasHarvest): return fragment=="TTbar_14TeV" and ('2026' in key or '2021' in key) upgradeWFs['ProdLike'] = UpgradeWorkflow_ProdLike( @@ -942,6 +1109,8 @@ def setup_(self, step, stepName, stepDict, k, properties): "--eventcontent": "PREMIXRAW"}, d]) stepDict[stepName][k] = d + if 'Nano' in step: + stepDict[stepName][k] = merge([{'--filein':'file:step5.root','-s':'NANO','--datatier':'NANOAODSIM','--eventcontent':'NANOEDMAODSIM'}, stepDict[step][k]]) def condition(self, fragment, stepList, key, hasHarvest): # use both conditions return UpgradeWorkflowPremix.condition(self, fragment, stepList, key, hasHarvest) and UpgradeWorkflow_ProdLike.condition(self, fragment, stepList, key, hasHarvest) @@ -1017,7 +1186,7 @@ def condition(self, fragment, stepList, key, hasHarvest): class UpgradeWorkflow_DD4hepDB(UpgradeWorkflow): def setup_(self, step, stepName, stepDict, k, properties): if 'Run3' in stepDict[step][k]['--era']: - stepDict[stepName][k] = merge([{'--conditions': '120X_mcRun3_2021_realistic_dd4hep_v1', '--geometry': 'DB:Extended', '--procModifiers': 'dd4hep'}, stepDict[step][k]]) + stepDict[stepName][k] = merge([{'--conditions': 'auto:phase1_2021_dd4hep', '--geometry': 'DB:Extended', '--procModifiers': 'dd4hep'}, stepDict[step][k]]) def condition(self, fragment, stepList, key, hasHarvest): return '2021' in key upgradeWFs['DD4hepDB'] = UpgradeWorkflow_DD4hepDB( @@ -1264,11 +1433,11 @@ def condition(self, fragment, stepList, key, hasHarvest): 'ScenToRun' : ['GenSimHLBeamSpot','DigiTrigger','RecoGlobal', 'HARVESTGlobal'], }, '2026D87' : { - 'Geom' : 'Extended2026D87', # N.B.: Geometry with 3D pixels in the Inner Tracker L1. + 'Geom' : 'Extended2026D87', # N.B.: Geometry with bricked pixels in the Inner Tracker (+others) 'HLTmenu': '@fake2', 'GT' : 'auto:phase2_realistic_T27', - 'Era' : 'Phase2C11I13T25M9', # customized for 3D pixels and Muon M9 - 'ScenToRun' : ['GenSimHLBeamSpot','DigiTrigger'], + 'Era' : 'Phase2C11I13T27M9', # customized for bricked pixels and Muon M9 + 'ScenToRun' : ['GenSimHLBeamSpot','DigiTrigger','RecoGlobal', 'HARVESTGlobal'], }, } diff --git a/Configuration/PyReleaseValidation/scripts/runTheMatrix.py b/Configuration/PyReleaseValidation/scripts/runTheMatrix.py index 263b5f8106724..471e4e7f3d7da 100755 --- a/Configuration/PyReleaseValidation/scripts/runTheMatrix.py +++ b/Configuration/PyReleaseValidation/scripts/runTheMatrix.py @@ -90,6 +90,7 @@ def runSelected(opt): 11634.911, #2021 DD4hep ttbar reading geometry from XML 11634.912, #2021 DD4hep ttbar reading geometry from the DB 11634.0, #2021 ttbar + 11634.7, #2021 ttbar mkFit 12434.0, #2023 ttbar 23234.0, #2026D49 ttbar (HLT TDR baseline w/ HGCal v11) 28234.0, #2026D60 (exercise HF nose) @@ -104,213 +105,272 @@ def runSelected(opt): } - import optparse + import argparse usage = 'usage: runTheMatrix.py --show -s ' - parser = optparse.OptionParser(usage) - - parser.add_option('-b','--batchName', - help='relval batch: suffix to be appended to Campaign name', - dest='batchName', - default='' - ) - - parser.add_option('-m','--memoryOffset', - help='memory of the wf for single core', - dest='memoryOffset', - default=3000 - ) - parser.add_option('--addMemPerCore', - help='increase of memory per each n > 1 core: memory(n_core) = memoryOffset + (n_core-1) * memPerCore', - dest='memPerCore', - default=1500 - ) - parser.add_option('-j','--nproc', - help='number of processes. 0 Will use 4 processes, not execute anything but create the wfs', - dest='nProcs', - default=4 - ) - parser.add_option('-t','--nThreads', - help='number of threads per process to use in cmsRun.', - dest='nThreads', - default=1 - ) - parser.add_option('--nStreams', - help='number of streams to use in cmsRun.', - dest='nStreams', - default=0 - ) - parser.add_option('--numberEventsInLuminosityBlock', - help='number of events in a luminosity block', - dest='numberEventsInLuminosityBlock', - default=-1 - ) - - parser.add_option('-n','--showMatrix', - help='Only show the worflows. Use --ext to show more', - dest='show', - default=False, - action='store_true' - ) - parser.add_option('-e','--extended', - help='Show details of workflows, used with --show', - dest='extended', - default=False, - action='store_true' - ) - parser.add_option('-s','--selected', - help='Run a pre-defined selected matrix of wf. Deprecated, please use -l limited', - dest='restricted', - default=False, - action='store_true' - ) - parser.add_option('-l','--list', - help='Coma separated list of workflow to be shown or ran. Possible keys are also '+str(predefinedSet.keys())+'. and wild card like muon, or mc', - dest='testList', - default=None - ) - parser.add_option('-r','--raw', - help='Temporary dump the .txt needed for prodAgent interface. To be discontinued soon. Argument must be the name of the set (standard, pileup,...)', - dest='raw' - ) - parser.add_option('-i','--useInput', - help='Use recyling where available. Either all, or a coma separated list of wf number.', - dest='useInput', - default=None - ) - parser.add_option('-w','--what', - 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' - ) - parser.add_option('--step1', - help='Used with --raw. Limit the production to step1', - dest='step1Only', - default=False - ) - parser.add_option('--maxSteps', - help='Only run maximum on maxSteps. Used when we are only interested in first n steps.', - dest='maxSteps', - default=9999, - type="int" - ) - parser.add_option('--fromScratch', - help='Coma separated list of wf to be run without recycling. all is not supported as default.', - dest='fromScratch', - default=None - ) - parser.add_option('--refRelease', - help='Allow to modify the recycling dataset version', - dest='refRel', - default=None - ) - parser.add_option('--wmcontrol', - help='Create the workflows for injection to WMAgent. In the WORKING. -wmcontrol init will create the the workflows, -wmcontrol test will dryRun a test, -wmcontrol submit will submit to wmagent', - choices=['init','test','submit','force'], - dest='wmcontrol', - default=None, - ) - parser.add_option('--revertDqmio', - help='When submitting workflows to wmcontrol, force DQM outout to use pool and not DQMIO', - choices=['yes','no'], - dest='revertDqmio', - default='no', - ) - parser.add_option('--optionswm', - help='Specify a few things for wm injection', - default='', - dest='wmoptions') - parser.add_option('--keep', - help='allow to specify for which coma separated steps the output is needed', - default=None) - parser.add_option('--label', - help='allow to give a special label to the output dataset name', - default='') - parser.add_option('--command', - help='provide a way to add additional command to all of the cmsDriver commands in the matrix', - dest='command', - action='append', - default=None - ) - parser.add_option('--apply', - help='allow to use the --command only for 1 coma separeated', - dest='apply', - default=None) - parser.add_option('--workflow', - help='define a workflow to be created or altered from the matrix', - action='append', - dest='workflow', - default=None - ) - parser.add_option('--dryRun', - help='do not run the wf at all', - action='store_true', - dest='dryRun', - default=False - ) - parser.add_option('--testbed', - help='workflow injection to cmswebtest (you need dedicated rqmgr account)', - dest='testbed', - default=False, - action='store_true' - ) - parser.add_option('--noCafVeto', - help='Run from any source, ignoring the CAF label', - dest='cafVeto', - default=True, - action='store_false' - ) - parser.add_option('--overWrite', - help='Change the content of a step for another. List of pairs.', - dest='overWrite', - default=None - ) - parser.add_option('--noRun', - help='Remove all run list selection from wfs', - dest='noRun', - default=False, - action='store_true') - - parser.add_option('--das-options', - help='Options to be passed to dasgoclient.', - dest='dasOptions', - default="--limit 0", - action='store') - - parser.add_option('--job-reports', - help='Dump framework job reports', - dest='jobReports', - default=False, - action='store_true') - - parser.add_option('--ibeos', - help='Use IB EOS site configuration', - dest='IBEos', - default=False, - action='store_true') - - parser.add_option('--sites', - help='Run DAS query to get data from a specific site (default is T2_CH_CERN). Set it to empty string to search all sites.', - dest='dasSites', - default='T2_CH_CERN', - action='store') - parser.add_option('--interactive', - help="Open the Matrix interactive shell", - action='store_true', - default=False) - - parser.add_option('--dbs-url', - help='Overwrite DbsUrl value in JSON submitted to ReqMgr2', - dest='dbsUrl', - default=None, - action='store') - - opt,args = parser.parse_args() + parser = argparse.ArgumentParser(usage,formatter_class=argparse.ArgumentDefaultsHelpFormatter) + + parser.add_argument('-b','--batchName', + help='relval batch: suffix to be appended to Campaign name', + dest='batchName', + default='') + + parser.add_argument('-m','--memoryOffset', + help='memory of the wf for single core', + dest='memoryOffset', + type=int, + default=3000) + + parser.add_argument('--addMemPerCore', + help='increase of memory per each n > 1 core: memory(n_core) = memoryOffset + (n_core-1) * memPerCore', + dest='memPerCore', + type=int, + default=1500) + + parser.add_argument('-j','--nproc', + help='number of processes. 0 Will use 4 processes, not execute anything but create the wfs', + dest='nProcs', + type=int, + default=4) + + parser.add_argument('-t','--nThreads', + help='number of threads per process to use in cmsRun.', + dest='nThreads', + type=int, + default=1) + + parser.add_argument('--nStreams', + help='number of streams to use in cmsRun.', + dest='nStreams', + type=int, + default=0) + + parser.add_argument('--numberEventsInLuminosityBlock', + help='number of events in a luminosity block', + dest='numberEventsInLuminosityBlock', + type=int, + default=-1) + + parser.add_argument('-n','--showMatrix', + help='Only show the worflows. Use --ext to show more', + dest='show', + default=False, + action='store_true') + + parser.add_argument('-e','--extended', + help='Show details of workflows, used with --show', + dest='extended', + default=False, + action='store_true') + + parser.add_argument('-s','--selected', + help='Run a pre-defined selected matrix of wf. Deprecated, please use -l limited', + dest='restricted', + default=False, + action='store_true') + + parser.add_argument('-l','--list', + help='Comma separated list of workflow to be shown or ran. Possible keys are also '+str(predefinedSet.keys())+'. and wild card like muon, or mc', + dest='testList', + default=None) + + parser.add_argument('-r','--raw', + help='Temporary dump the .txt needed for prodAgent interface. To be discontinued soon. Argument must be the name of the set (standard, pileup,...)', + dest='raw') + + parser.add_argument('-i','--useInput', + help='Use recyling where available. Either all, or a comma separated list of wf number.', + dest='useInput', + type=lambda x: x.split(','), + default=None) + + parser.add_argument('-w','--what', + 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') + + parser.add_argument('--step1', + help='Used with --raw. Limit the production to step1', + dest='step1Only', + default=False) + + parser.add_argument('--maxSteps', + help='Only run maximum on maxSteps. Used when we are only interested in first n steps.', + dest='maxSteps', + default=9999, + type=int) + + parser.add_argument('--fromScratch', + help='Comma separated list of wf to be run without recycling. all is not supported as default.', + dest='fromScratch', + type=lambda x: x.split(','), + default=None) + + parser.add_argument('--refRelease', + help='Allow to modify the recycling dataset version', + dest='refRel', + default=None) + + parser.add_argument('--wmcontrol', + help='Create the workflows for injection to WMAgent. In the WORKING. -wmcontrol init will create the the workflows, -wmcontrol test will dryRun a test, -wmcontrol submit will submit to wmagent', + choices=['init','test','submit','force'], + dest='wmcontrol', + default=None) + + parser.add_argument('--revertDqmio', + help='When submitting workflows to wmcontrol, force DQM outout to use pool and not DQMIO', + choices=['yes','no'], + dest='revertDqmio', + default='no') + + parser.add_argument('--optionswm', + help='Specify a few things for wm injection', + default='', + dest='wmoptions') + + parser.add_argument('--keep', + help='allow to specify for which comma separated steps the output is needed', + default=None) + + parser.add_argument('--label', + help='allow to give a special label to the output dataset name', + default='') + + parser.add_argument('--command', + help='provide a way to add additional command to all of the cmsDriver commands in the matrix', + dest='command', + action='append', + default=None) + + parser.add_argument('--apply', + help='allow to use the --command only for 1 comma separeated', + dest='apply', + default=None) + + parser.add_argument('--workflow', + help='define a workflow to be created or altered from the matrix', + action='append', + dest='workflow', + default=None) + + parser.add_argument('--dryRun', + help='do not run the wf at all', + action='store_true', + dest='dryRun', + default=False) + + parser.add_argument('--testbed', + help='workflow injection to cmswebtest (you need dedicated rqmgr account)', + dest='testbed', + default=False, + action='store_true') + + parser.add_argument('--noCafVeto', + help='Run from any source, ignoring the CAF label', + dest='cafVeto', + default=True, + action='store_false') + + parser.add_argument('--overWrite', + help='Change the content of a step for another. List of pairs.', + dest='overWrite', + default=None) + + parser.add_argument('--noRun', + help='Remove all run list selection from wfs', + dest='noRun', + default=False, + action='store_true') + + parser.add_argument('--das-options', + help='Options to be passed to dasgoclient.', + dest='dasOptions', + default="--limit 0", + action='store') + + parser.add_argument('--job-reports', + help='Dump framework job reports', + dest='jobReports', + default=False, + action='store_true') + + parser.add_argument('--ibeos', + help='Use IB EOS site configuration', + dest='IBEos', + default=False, + action='store_true') + + parser.add_argument('--sites', + help='Run DAS query to get data from a specific site. Set it to empty string to search all sites.', + dest='dasSites', + default='T2_CH_CERN', + action='store') + + parser.add_argument('--interactive', + help="Open the Matrix interactive shell", + action='store_true', + default=False) + + parser.add_argument('--dbs-url', + help='Overwrite DbsUrl value in JSON submitted to ReqMgr2', + dest='dbsUrl', + default=None, + action='store') + + gpugroup = parser.add_argument_group('GPU-related options','These options are only meaningful when --gpu is used, and is not set to forbidden.') + + gpugroup.add_argument('--gpu','--requires-gpu', + help='Enable GPU workflows. Possible options are "forbidden" (default), "required" (implied if no argument is given), or "optional".', + dest='gpu', + choices=['forbidden', 'optional', 'required'], + nargs='?', + const='required', + default='forbidden', + action='store') + + gpugroup.add_argument('--gpu-memory', + help='Specify the minimum amount of GPU memory required by the job, in MB.', + dest='GPUMemoryMB', + type=int, + default=8000) + + gpugroup.add_argument('--cuda-capabilities', + help='Specify a comma-separated list of CUDA "compute capabilities", or GPU hardware architectures, that the job can use.', + dest='CUDACapabilities', + type=lambda x: x.split(','), + default='6.0,6.1,6.2,7.0,7.2,7.5,8.0,8.6') + + # read the CUDA runtime version included in CMSSW + cudart_version = None + libcudart = os.path.realpath(os.path.expandvars('$CMSSW_RELEASE_BASE/external/$SCRAM_ARCH/lib/libcudart.so')) + if os.path.isfile(libcudart): + cudart_basename = os.path.basename(libcudart) + cudart_version = '.'.join(cudart_basename.split('.')[2:4]) + gpugroup.add_argument('--cuda-runtime', + help='Specify major and minor version of the CUDA runtime used to build the application.', + dest='CUDARuntime', + default=cudart_version) + + gpugroup.add_argument('--force-gpu-name', + help='Request a specific GPU model, e.g. "Tesla T4" or "NVIDIA GeForce RTX 2080". The default behaviour is to accept any supported GPU.', + dest='GPUName', + default='') + + gpugroup.add_argument('--force-cuda-driver-version', + help='Request a specific CUDA driver version, e.g. 470.57.02. The default behaviour is to accept any supported CUDA driver version.', + dest='CUDADriverVersion', + default='') + + gpugroup.add_argument('--force-cuda-runtime-version', + help='Request a specific CUDA runtime version, e.g. 11.4. The default behaviour is to accept any supported CUDA runtime version.', + dest='CUDARuntimeVersion', + default='') + + opt = parser.parse_args() if opt.command: opt.command = ' '.join(opt.command) os.environ["CMSSW_DAS_QUERY_SITES"]=opt.dasSites if opt.IBEos: - try:from commands import getstatusoutput as run_cmd - except:from subprocess import getstatusoutput as run_cmd + from subprocess import getstatusoutput as run_cmd ibeos_cache = os.path.join(os.getenv("LOCALRT"), "ibeos_cache.txt") if not os.path.exists(ibeos_cache): @@ -346,8 +406,6 @@ def stepOrIndex(s): if opt.keep: opt.keep=map(stepOrIndex,opt.keep.split(',')) - - if opt.testList: testList=[] for entry in opt.testList.split(','): @@ -365,17 +423,7 @@ def stepOrIndex(s): print(entry,'is not a possible selected entry') opt.testList = list(set(testList)) - - - if opt.useInput: opt.useInput = opt.useInput.split(',') - if opt.fromScratch: opt.fromScratch = opt.fromScratch.split(',') - if opt.nProcs: opt.nProcs=int(opt.nProcs) - if opt.nThreads: opt.nThreads=int(opt.nThreads) - if opt.nStreams: opt.nStreams=int(opt.nStreams) - if (opt.numberEventsInLuminosityBlock): opt.numberEventsInLuminosityBlock=int(opt.numberEventsInLuminosityBlock) - if (opt.memoryOffset): opt.memoryOffset=int(opt.memoryOffset) - if (opt.memPerCore): opt.memPerCore=int(opt.memPerCore) - + if opt.wmcontrol: performInjectionOptionTest(opt) if opt.overWrite: @@ -393,6 +441,7 @@ def __init__(self, opt): self.matrices_ = {} tmp = MatrixReader(self.opt_) for what in tmp.files: + what = what.replace('relval_','') self.opt_.what = what self.matrices_[what] = MatrixReader(self.opt_) self.matrices_[what].prepare(self.opt_.useInput, self.opt_.refRel, @@ -523,7 +572,7 @@ def do_dumpWorkflowId(self, arg): maxLen = 100 for wflid in wflids: dump = True - for key, mrd in self.matrices_.iteritems(): + for key, mrd in self.matrices_.items(): for wfl in mrd.workFlows: if wfl.numId == float(wflid): wfName, stepNames = wfl.nameId.split('+',1) diff --git a/Configuration/Skimming/interface/LeptonRecoSkim.h b/Configuration/Skimming/interface/LeptonRecoSkim.h index 9edb3d3fa467e..233681149dd1e 100644 --- a/Configuration/Skimming/interface/LeptonRecoSkim.h +++ b/Configuration/Skimming/interface/LeptonRecoSkim.h @@ -17,15 +17,13 @@ #include // user include files -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDFilter.h" - +#include "DataFormats/Common/interface/Handle.h" #include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/Frameworkfwd.h" #include "FWCore/Framework/interface/MakerMacros.h" - +#include "FWCore/Framework/interface/one/EDFilter.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "DataFormats/Common/interface/Handle.h" -#include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/Utilities/interface/EDGetToken.h" //includes for reco objects #include "DataFormats/EgammaCandidates/interface/GsfElectron.h" @@ -54,7 +52,7 @@ #include "DataFormats/Common/interface/TriggerResults.h" #include "FWCore/Common/interface/TriggerNames.h" -class LeptonRecoSkim : public edm::EDFilter { +class LeptonRecoSkim : public edm::one::EDFilter<> { public: explicit LeptonRecoSkim(const edm::ParameterSet&); ~LeptonRecoSkim() override; @@ -66,15 +64,20 @@ class LeptonRecoSkim : public edm::EDFilter { void handleObjects(const edm::Event&, const edm::EventSetup& iSetup); + // ----------member data --------------------------- + const edm::ESGetToken m_CaloGeoToken; + const edm::ESGetToken m_CaloTopoToken; + edm::InputTag hltLabel; std::string filterName; - edm::InputTag m_electronSrc; - edm::InputTag m_pfelectronSrc; - edm::InputTag m_muonSrc; - edm::InputTag m_jetsSrc; - edm::InputTag m_pfjetsSrc; - edm::InputTag m_ebRecHitsSrc; - edm::InputTag m_eeRecHitsSrc; + + edm::EDGetTokenT gsfElectronCollectionToken_; + edm::EDGetTokenT pfCandidateCollectionToken_; + edm::EDGetTokenT muonCollectionToken_; + edm::EDGetTokenT caloJetCollectionToken_; + edm::EDGetTokenT pfJetCollectionToken_; + edm::EDGetTokenT ebRecHitCollectionToken_; + edm::EDGetTokenT eeRecHitCollectionToken_; const reco::GsfElectronCollection* theElectronCollection; const reco::PFCandidateCollection* thePfCandidateCollection; @@ -119,5 +122,4 @@ class LeptonRecoSkim : public edm::EDFilter { int NtotalElectrons; int NmvaElectrons; - // ----------member data --------------------------- }; diff --git a/Configuration/Skimming/src/LeptonRecoSkim.cc b/Configuration/Skimming/src/LeptonRecoSkim.cc index b6f620cc33b9a..dce52f9011549 100644 --- a/Configuration/Skimming/src/LeptonRecoSkim.cc +++ b/Configuration/Skimming/src/LeptonRecoSkim.cc @@ -28,15 +28,17 @@ using namespace std; // constructors and destructor // LeptonRecoSkim::LeptonRecoSkim(const edm::ParameterSet& iConfig) - : hltLabel(iConfig.getParameter("HltLabel")), + : m_CaloGeoToken(esConsumes()), + m_CaloTopoToken(esConsumes()), + hltLabel(iConfig.getParameter("HltLabel")), filterName(iConfig.getParameter("@module_label")), - m_electronSrc(iConfig.getParameter("electronCollection")), - m_pfelectronSrc(iConfig.getParameter("pfElectronCollection")), - m_muonSrc(iConfig.getParameter("muonCollection")), - m_jetsSrc(iConfig.getParameter("caloJetCollection")), - m_pfjetsSrc(iConfig.getParameter("PFJetCollection")), - m_ebRecHitsSrc(iConfig.getParameter("ecalBarrelRecHitsCollection")), - m_eeRecHitsSrc(iConfig.getParameter("ecalEndcapRecHitsCollection")), + gsfElectronCollectionToken_(consumes(iConfig.getParameter("electronCollection"))), + pfCandidateCollectionToken_(consumes(iConfig.getParameter("pfElectronCollection"))), + muonCollectionToken_(consumes(iConfig.getParameter("muonCollection"))), + caloJetCollectionToken_(consumes(iConfig.getParameter("caloJetCollection"))), + pfJetCollectionToken_(consumes(iConfig.getParameter("PFJetCollection"))), + ebRecHitCollectionToken_(consumes(iConfig.getParameter("ecalBarrelRecHitsCollection"))), + eeRecHitCollectionToken_(consumes(iConfig.getParameter("ecalEndcapRecHitsCollection"))), useElectronSelection(iConfig.getParameter("UseElectronSelection")), usePfElectronSelection(iConfig.getParameter("UsePfElectronSelection")), useMuonSelection(iConfig.getParameter("UseMuonSelection")), @@ -204,65 +206,45 @@ void LeptonRecoSkim::beginJob() { firstEvent = true; } // ------------ method called once each job just after ending the event loop ------------ void LeptonRecoSkim::endJob() { - cout << "Filter Name = " << filterName << endl; - cout << "Total number of events = " << NeventsTotal << endl; - cout << "Total HLT_Mu9 = " << NHltMu9 << endl; - cout << "Total HLT_DoubleMu3 = " << NHltDiMu3 << endl; - cout << "Filtered events = " << NeventsFiltered << endl; - cout << "Filter Efficiency = " << (float)NeventsFiltered / (float)NeventsTotal << endl; - cout << endl; - cout << "N total electrons = " << NtotalElectrons << endl; - cout << "N mva>-0.1 electrons = " << NmvaElectrons << endl; - cout << endl; - cout << endl; + edm::LogPrint("LeptonRecoSkim") << "Filter Name = " << filterName << endl; + edm::LogPrint("LeptonRecoSkim") << "Total number of events = " << NeventsTotal << endl; + edm::LogPrint("LeptonRecoSkim") << "Total HLT_Mu9 = " << NHltMu9 << endl; + edm::LogPrint("LeptonRecoSkim") << "Total HLT_DoubleMu3 = " << NHltDiMu3 << endl; + edm::LogPrint("LeptonRecoSkim") << "Filtered events = " << NeventsFiltered << endl; + edm::LogPrint("LeptonRecoSkim") << "Filter Efficiency = " << (float)NeventsFiltered / (float)NeventsTotal + << endl; + edm::LogPrint("LeptonRecoSkim") << endl; + edm::LogPrint("LeptonRecoSkim") << "N total electrons = " << NtotalElectrons << endl; + edm::LogPrint("LeptonRecoSkim") << "N mva>-0.1 electrons = " << NmvaElectrons << endl; + edm::LogPrint("LeptonRecoSkim") << endl; + edm::LogPrint("LeptonRecoSkim") << endl; } void LeptonRecoSkim::handleObjects(const edm::Event& iEvent, const edm::EventSetup& iSetup) { //Get the electrons - Handle theElectronCollectionHandle; - iEvent.getByLabel(m_electronSrc, theElectronCollectionHandle); - theElectronCollection = theElectronCollectionHandle.product(); + theElectronCollection = &iEvent.get(gsfElectronCollectionToken_); //Get the pf electrons - Handle thePfCandidateHandle; - iEvent.getByLabel(m_pfelectronSrc, thePfCandidateHandle); - thePfCandidateCollection = thePfCandidateHandle.product(); + thePfCandidateCollection = &iEvent.get(pfCandidateCollectionToken_); //Get the Muons - Handle theMuonCollectionHandle; - iEvent.getByLabel(m_muonSrc, theMuonCollectionHandle); - theMuonCollection = theMuonCollectionHandle.product(); + theMuonCollection = &iEvent.get(muonCollectionToken_); //Get the CaloJets - Handle theCaloJetCollectionHandle; - iEvent.getByLabel(m_jetsSrc, theCaloJetCollectionHandle); - theCaloJetCollection = theCaloJetCollectionHandle.product(); + theCaloJetCollection = &iEvent.get(caloJetCollectionToken_); //Get the PfJets - Handle thePFJetCollectionHandle; - iEvent.getByLabel(m_pfjetsSrc, thePFJetCollectionHandle); - thePFJetCollection = thePFJetCollectionHandle.product(); + thePFJetCollection = &iEvent.get(pfJetCollectionToken_); - //Get the ECAL rechhits to clean the spikes + // Get the ECAL rechhits to clean the spikes // Get EB RecHits - edm::Handle ebRecHitsHandle; - iEvent.getByLabel(m_ebRecHitsSrc, ebRecHitsHandle); - theEcalBarrelCollection = ebRecHitsHandle.product(); + theEcalBarrelCollection = &iEvent.get(ebRecHitCollectionToken_); // Get EE RecHits - edm::Handle eeRecHitsHandle; - iEvent.getByLabel(m_eeRecHitsSrc, eeRecHitsHandle); - theEcalEndcapCollection = eeRecHitsHandle.product(); + theEcalEndcapCollection = &iEvent.get(eeRecHitCollectionToken_); // Get topology for spike cleaning - edm::ESHandle geometryHandle; - iSetup.get().get(geometryHandle); - theCaloGeometry = geometryHandle.product(); - // theCaloBarrelSubdetTopology = new EcalBarrelTopology(geometryHandle); - // theCaloEndcapSubdetTopology = new EcalEndcapTopology(geometryHandle); - - edm::ESHandle pTopology; - iSetup.get().get(pTopology); - theCaloTopology = pTopology.product(); + theCaloGeometry = &iSetup.getData(m_CaloGeoToken); + theCaloTopology = &iSetup.getData(m_CaloTopoToken); } //define this as a plug-in diff --git a/Configuration/Skimming/src/LeptonSkimming.cc b/Configuration/Skimming/src/LeptonSkimming.cc index 6fc1c7f3f610a..e7ffe11affd61 100644 --- a/Configuration/Skimming/src/LeptonSkimming.cc +++ b/Configuration/Skimming/src/LeptonSkimming.cc @@ -1,10 +1,10 @@ // -*- C++ -*- // -// Package: SkimmingForB/LeptonSkimming +// Package: Configuration/Skimming // Class: LeptonSkimming // -/**\class LeptonSkimming LeptonSkimming.cc SkimmingForB/LeptonSkimming/plugins/LeptonSkimming.cc +/**\class LeptonSkimming LeptonSkimming.cc Configuration/Skimming/src/LeptonSkimming.cc Description: [one line class summary] diff --git a/Configuration/StandardSequences/python/AlCaHarvesting_cff.py b/Configuration/StandardSequences/python/AlCaHarvesting_cff.py index 41604bb588ed0..0050299b593dc 100644 --- a/Configuration/StandardSequences/python/AlCaHarvesting_cff.py +++ b/Configuration/StandardSequences/python/AlCaHarvesting_cff.py @@ -5,12 +5,15 @@ from Calibration.TkAlCaRecoProducers.AlcaSiStripQualityHarvester_cff import * from Calibration.TkAlCaRecoProducers.AlcaSiStripGainsHarvester_cff import * from Calibration.TkAlCaRecoProducers.AlcaSiStripGainsAAGHarvester_cff import * +from Calibration.TkAlCaRecoProducers.AlcaSiPixelLorentzAngleHarvester_cff import * from Alignment.CommonAlignmentProducer.AlcaSiPixelAliHarvester_cff import * from Calibration.EcalCalibAlgos.AlcaEcalPedestalsHarvester_cff import * 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 CalibPPS.TimingCalibration.ALCARECOPPSDiamondSampicTimingCalibHarvester_cff import * +from CalibPPS.AlignmentGlobal.PPSAlignmentHarvester_cff import * from Calibration.TkAlCaRecoProducers.PCLMetadataWriter_cfi import * @@ -154,6 +157,15 @@ timetype = cms.untracked.string('runnumber') ) +# -------------------------------------------------------------------------------------- +# SiPixel Lorentz Angle +ALCAHARVESTSiPixelLA_metadata = cms.PSet(record = cms.untracked.string('SiPixelLorentzAngleRcd')) + +ALCAHARVESTSiPixelLA_dbOutput = cms.PSet(record = cms.string('SiPixelLorentzAngleRcd'), + tag = cms.string('SiPixelLA_pcl'), + timetype = cms.untracked.string('runnumber') + ) + # -------------------------------------------------------------------------------------- # ECAL Pedestals ALCAHARVESTEcalPedestals_metadata = cms.PSet(record = cms.untracked.string('EcalPedestalsRcd')) @@ -220,9 +232,20 @@ 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') + timetype = cms.untracked.string('runnumber') ) +ALCAHARVESTPPSDiamondSampicTimingCalibration_metadata = cms.PSet(record = cms.untracked.string('PPSTimingCalibrationRcd_Sampic')) +ALCAHARVESTPPSDiamondSampicTimingCalibration_dbOutput = cms.PSet(record = cms.string('PPSTimingCalibrationRcd_Sampic'), + tag = cms.string('DiamondSampicCalibration'), + timetype = cms.untracked.string('runnumber')) + +ALCAHARVESTPPSAlignment = ppsAlignmentHarvester.clone() +ALCAHARVESTPPSAlignment_metadata = cms.PSet(record = cms.untracked.string('CTPPSRPAlignmentCorrectionsDataRcd')) +ALCAHARVESTPPSAlignment_dbOutput = cms.PSet(record = cms.string('CTPPSRPAlignmentCorrectionsDataRcd'), + tag = cms.string('CTPPSRPAlignment_real_pcl'), + timetype = cms.untracked.string('runnumber')) + # define all the paths BeamSpotByRun = cms.Path(ALCAHARVESTBeamSpotByRun) BeamSpotByLumi = cms.Path(ALCAHARVESTBeamSpotByLumi) @@ -233,11 +256,14 @@ SiStripQuality = cms.Path(ALCAHARVESTSiStripQuality) SiStripGains = cms.Path(ALCAHARVESTSiStripGains) SiPixelAli = cms.Path(ALCAHARVESTSiPixelAli) +SiPixelLA = cms.Path(ALCAHARVESTSiPixelLorentzAngle) EcalPedestals = cms.Path(ALCAHARVESTEcalPedestals) SiStripGainsAAG = cms.Path(ALCAHARVESTSiStripGainsAAG) LumiPCC = cms.Path(ALCAHARVESTLumiPCC) SiPixelQuality = cms.Path(dqmEnvSiPixelQuality+ALCAHARVESTSiPixelQuality)#+siPixelPhase1DQMHarvester) PPSTimingCalibration = cms.Path(ALCAHARVESTPPSTimingCalibration) +PPSDiamondSampicTimingCalibration = cms.Path(ALCAHARVESTPPSDiamondSampicTimingCalibration) +PPSAlignment = cms.Path(ALCAHARVESTPPSAlignment) ALCAHARVESTDQMSaveAndMetadataWriter = cms.Path(dqmSaver+pclMetadataWriter) diff --git a/Configuration/StandardSequences/python/AlCaRecoStreams_cff.py b/Configuration/StandardSequences/python/AlCaRecoStreams_cff.py index 3dfc8ef22cb0d..ad3bc858f980b 100644 --- a/Configuration/StandardSequences/python/AlCaRecoStreams_cff.py +++ b/Configuration/StandardSequences/python/AlCaRecoStreams_cff.py @@ -51,6 +51,7 @@ from CalibTracker.SiPixelQuality.ALCARECOSiPixelCalZeroBias_cff import * # AlCaReco for tracker calibration using Cosmics events from Calibration.TkAlCaRecoProducers.ALCARECOSiStripCalCosmics_cff import * +from Calibration.TkAlCaRecoProducers.ALCARECOSiStripCalCosmicsNano_cff import * ############################################################### # LUMI Calibration @@ -91,6 +92,7 @@ from Calibration.HcalAlCaRecoProducers.ALCARECOHcalCalIsoTrk_cff import * from Calibration.HcalAlCaRecoProducers.ALCARECOHcalCalIsoTrkFilter_cff import * from Calibration.HcalAlCaRecoProducers.ALCARECOHcalCalIsoTrkFilterNoHLT_cff import * +from Calibration.HcalAlCaRecoProducers.ALCARECOHcalCalIsoTrkProducerFilter_cff import * # HCAL noise from Calibration.HcalAlCaRecoProducers.ALCARECOHcalCalNoise_cff import * #HCAL calibration iterative PhiSym @@ -100,10 +102,12 @@ from Calibration.HcalAlCaRecoProducers.ALCARECOHcalCalIsolatedBunchSelector_cff import * # HCAL calibration with muons in HB/HE from Calibration.HcalAlCaRecoProducers.ALCARECOHcalCalHBHEMuonFilter_cff import * +from Calibration.HcalAlCaRecoProducers.ALCARECOHcalCalHBHEMuonProducerFilter_cff import * # HCAL calibration with muons at low luminosity in HB/HE from Calibration.HcalAlCaRecoProducers.ALCARECOHcalCalLowPUHBHEMuonFilter_cff import * # HCAL calibration with muons in HE high eta from Calibration.HcalAlCaRecoProducers.ALCARECOHcalCalHEMuonFilter_cff import * +from Calibration.HcalAlCaRecoProducers.ALCARECOHcalCalHEMuonProducerFilter_cff import * ############################################################### # Muon alignment @@ -128,6 +132,9 @@ # Timing calibration from CalibPPS.TimingCalibration.ALCARECOPPSCalTrackBasedSel_cff import * from CalibPPS.TimingCalibration.ALCARECOPPSTimingCalib_cff import * +from CalibPPS.TimingCalibration.ALCARECOPPSDiamondSampicTimingCalib_cff import * +# Alignment +from CalibPPS.AlignmentGlobal.ALCARECOPPSAlignment_cff import * ############################################################### # nonbeam alcas @@ -148,6 +155,8 @@ from Calibration.TkAlCaRecoProducers.ALCARECOPromptCalibProdSiStripGains_cff import * from Calibration.TkAlCaRecoProducers.ALCARECOPromptCalibProdSiStripGainsAAG_cff import * +from Calibration.TkAlCaRecoProducers.ALCARECOPromptCalibProdSiPixelLorentzAngle_cff import * + from Calibration.TkAlCaRecoProducers.ALCARECOSiStripPCLHistos_cff import * from Alignment.CommonAlignmentProducer.ALCARECOPromptCalibProdSiPixelAli_cff import * @@ -183,6 +192,7 @@ pathALCARECOSiPixelCalCosmics = cms.Path(seqALCARECOSiPixelCalCosmics) pathALCARECOSiStripCalMinBias = cms.Path(seqALCARECOSiStripCalMinBias*ALCARECOSiStripCalMinBiasDQM) pathALCARECOSiStripCalCosmics = cms.Path(seqALCARECOSiStripCalCosmics) +pathALCARECOSiStripCalCosmicsNano = cms.Path(seqALCARECOSiStripCalCosmics*seqALCARECOSiStripCalCosmicsNano) pathALCARECOSiStripCalMinBiasAAG = cms.Path(seqALCARECOSiStripCalMinBiasAAG*ALCARECOSiStripCalMinBiasAAGDQM) pathALCARECOSiStripCalSmallBiasScan = cms.Path(seqALCARECOSiStripCalSmallBiasScan) pathALCARECOSiStripCalZeroBias = cms.Path(seqALCARECOSiStripCalZeroBias*ALCARECOSiStripCalZeroBiasDQM) @@ -216,13 +226,16 @@ pathALCARECOHcalCalIsoTrk = cms.Path(seqALCARECOHcalCalIsoTrk*ALCARECOHcalCalIsoTrackDQM) pathALCARECOHcalCalIsoTrkFilter = cms.Path(seqALCARECOHcalCalIsoTrkFilter) pathALCARECOHcalCalIsoTrkFilterNoHLT = cms.Path(seqALCARECOHcalCalIsoTrkFilterNoHLT) +pathALCARECOHcalCalIsoTrkProducerFilter = cms.Path(seqALCARECOHcalCalIsoTrkProducerFilter) pathALCARECOHcalCalNoise = cms.Path(seqALCARECOHcalCalNoise) pathALCARECOHcalCalIterativePhiSym = cms.Path(seqALCARECOHcalCalIterativePhiSym*ALCARECOHcalCalIterativePhisymDQM) pathALCARECOHcalCalIsolatedBunchFilter = cms.Path(seqALCARECOHcalCalIsolatedBunchFilter) pathALCARECOHcalCalIsolatedBunchSelector = cms.Path(seqALCARECOHcalCalIsolatedBunchSelector*ALCARECOHcalCalIsolatedBunchDQM) pathALCARECOHcalCalHBHEMuonFilter = cms.Path(seqALCARECOHcalCalHBHEMuonFilter) +pathALCARECOHcalCalHBHEMuonProducerFilter = cms.Path(seqALCARECOHcalCalHBHEMuonProducerFilter) pathALCARECOHcalCalLowPUHBHEMuonFilter = cms.Path(seqALCARECOHcalCalLowPUHBHEMuonFilter) pathALCARECOHcalCalHEMuonFilter = cms.Path(seqALCARECOHcalCalHEMuonFilter) +pathALCARECOHcalCalHEMuonProducerFilter = cms.Path(seqALCARECOHcalCalHEMuonProducerFilter) pathALCARECOMuAlCalIsolatedMu = cms.Path(seqALCARECOMuAlCalIsolatedMu) pathALCARECOMuAlCalIsolatedMuGeneralTracks = cms.Path(seqALCARECOMuAlCalIsolatedMuGeneralTracks) pathALCARECOMuAlZMuMu = cms.Path(seqALCARECOMuAlZMuMu) @@ -231,6 +244,8 @@ pathALCARECOMuAlOverlapsGeneralTracks = cms.Path(seqALCARECOMuAlOverlapsGeneralTracks) pathALCARECORpcCalHLT = cms.Path(seqALCARECORpcCalHLT) pathALCARECOPPSTimingCalib = cms.Path(taskALCARECOPPSTimingCalib) +pathALCARECOPPSDiamondSampicTimingCalib = cms.Path(taskALCARECOPPSDiamondSampicTimingCalib) +pathALCARECOPPSAlignment = cms.Path(taskALCARECOPPSAlignment) pathALCARECOTkAlBeamHalo = cms.Path(seqALCARECOTkAlBeamHalo*ALCARECOTkAlBeamHaloDQM) pathALCARECOMuAlBeamHaloOverlaps = cms.Path(seqALCARECOMuAlBeamHaloOverlaps) pathALCARECOMuAlBeamHalo = cms.Path(seqALCARECOMuAlBeamHalo) @@ -257,6 +272,7 @@ pathALCARECOPromptCalibProdSiStrip = cms.Path(seqALCARECOPromptCalibProdSiStrip) pathALCARECOPromptCalibProdSiStripGains = cms.Path(seqALCARECOPromptCalibProdSiStripGains) pathALCARECOPromptCalibProdSiStripGainsAAG = cms.Path(seqALCARECOPromptCalibProdSiStripGainsAAG) +pathALCARECOPromptCalibProdSiPixelLorentzAngle = cms.Path(seqALCARECOPromptCalibProdSiPixelLorentzAngle) pathALCARECOPromptCalibProdSiPixelAli = cms.Path(seqALCARECOPromptCalibProdSiPixelAli) pathALCARECOPromptCalibProdSiPixel = cms.Path(seqALCARECOPromptCalibProdSiPixel) pathALCARECOPromptCalibProdEcalPedestals = cms.Path(seqALCARECOPromptCalibProdEcalPedestals) @@ -441,6 +457,15 @@ dataTier = cms.untracked.string('ALCARECO') ) +ALCARECOStreamSiStripCalCosmicsNano = cms.FilteredStream( + responsible = "Pieter David", + name = "SiStripCalCosmicsNano", + paths = (pathALCARECOSiStripCalCosmicsNano), + content = OutALCARECOSiStripCalCosmicsNano.outputCommands, + selectEvents = OutALCARECOSiStripCalCosmicsNano.SelectEvents, + dataTier = cms.untracked.string("NANOAOD") + ) + ALCARECOStreamSiStripCalZeroBias = cms.FilteredStream( responsible = 'Gordon Kaussen', name = 'SiStripCalZeroBias', @@ -633,11 +658,20 @@ responsible = 'Sunanda Banerjee', name = 'HcalCalIsoTrkFilterNoHLT', paths = (pathALCARECOHcalCalIsoTrkFilterNoHLT), - content = OutALCARECOHcalCalIsoTrkFilter.outputCommands, + content = OutALCARECOHcalCalIsoTrkFilterNoHLT.outputCommands, selectEvents = OutALCARECOHcalCalIsoTrkFilter.SelectEvents, dataTier = cms.untracked.string('ALCARECO') ) +ALCARECOStreamHcalCalIsoTrkProducerFilter = cms.FilteredStream( + responsible = 'Sunanda Banerjee', + name = 'HcalCalIsoTrkProducerFilter', + paths = (pathALCARECOHcalCalIsoTrkProducerFilter), + content = OutALCARECOHcalCalIsoTrkProducerFilter.outputCommands, + selectEvents = OutALCARECOHcalCalIsoTrkProducerFilter.SelectEvents, + dataTier = cms.untracked.string('ALCARECO') + ) + ALCARECOStreamHcalCalNoise = cms.FilteredStream( responsible = 'Grigory Safronov', name = 'HcalCalNoise', @@ -683,6 +717,15 @@ dataTier = cms.untracked.string('ALCARECO') ) +ALCARECOStreamHcalCalHBHEMuonProducerFilter = cms.FilteredStream( + responsible = 'Sunanda Banerjee', + name = 'HcalCalHBHEMuonProducerFilter', + paths = (pathALCARECOHcalCalHBHEMuonProducerFilter), + content = OutALCARECOHcalCalHBHEMuonProducerFilter.outputCommands, + selectEvents = OutALCARECOHcalCalHBHEMuonProducerFilter.SelectEvents, + dataTier = cms.untracked.string('ALCARECO') + ) + ALCARECOStreamHcalCalLowPUHBHEMuonFilter = cms.FilteredStream( responsible = 'Nan Lu', name = 'HcalCalLowPUHBHEMuonFilter', @@ -701,6 +744,15 @@ dataTier = cms.untracked.string('ALCARECO') ) +ALCARECOStreamHcalCalHEMuonProducerFilter = cms.FilteredStream( + responsible = 'Sunanda Banerjee', + name = 'HcalCalHEMuonProducerFilter', + paths = (pathALCARECOHcalCalHEMuonProducerFilter), + content = OutALCARECOHcalCalHEMuonProducerFilter.outputCommands, + selectEvents = OutALCARECOHcalCalHEMuonProducerFilter.SelectEvents, + dataTier = cms.untracked.string('ALCARECO') + ) + ALCARECOStreamMuAlCalIsolatedMu = cms.FilteredStream( responsible = 'Luca Pernie', name = 'MuAlCalIsolatedMu', @@ -844,6 +896,24 @@ selectEvents = OutALCARECOPPSTimingCalib.SelectEvents, dataTier = cms.untracked.string('ALCARECO') ) + +ALCARECOStreamPPSDiamondSampicTimingCalib = cms.FilteredStream( + responsible = 'Christopher Misan', + name = 'PPSDiamondSampicTimingCalib', + paths = (pathALCARECOPPSDiamondSampicTimingCalib), + content = OutALCARECOPPSDiamondSampicTimingCalib.outputCommands, + selectEvents = OutALCARECOPPSDiamondSampicTimingCalib.SelectEvents, + dataTier = cms.untracked.string('ALCARECO') + ) + +ALCARECOStreamPPSAlignment = cms.FilteredStream( + responsible = 'Mateusz Kocot', + name = 'PPSAlignment', + paths = (pathALCARECOPPSAlignment), + content = OutALCARECOPPSAlignment.outputCommands, + selectEvents = OutALCARECOPPSAlignment.SelectEvents, + dataTier = cms.untracked.string('ALCARECO') +) ALCARECOStreamPromptCalibProd = cms.FilteredStream( responsible = 'Gianluca Cerminara', @@ -909,7 +979,14 @@ dataTier = cms.untracked.string('ALCARECO') ) - +ALCARECOStreamPromptCalibProdSiPixelLorentzAngle = cms.FilteredStream( + responsible = 'Marco Musich', + name = 'PromptCalibProdSiPixelLorentzAngle', + paths = (pathALCARECOPromptCalibProdSiPixelLorentzAngle), + content = OutALCARECOPromptCalibProdSiPixelLorentzAngle.outputCommands, + selectEvents = OutALCARECOPromptCalibProdSiPixelLorentzAngle.SelectEvents, + dataTier = cms.untracked.string('ALCARECO') + ) ALCARECOStreamPromptCalibProdSiPixelAli = cms.FilteredStream( responsible = 'Gianluca Cerminara', diff --git a/Configuration/StandardSequences/python/Eras.py b/Configuration/StandardSequences/python/Eras.py index 72bc7b46fed06..f2d80ef09702d 100644 --- a/Configuration/StandardSequences/python/Eras.py +++ b/Configuration/StandardSequences/python/Eras.py @@ -32,6 +32,7 @@ def __init__(self): 'Run2_2018_pp_on_AA_noHCALmitigation', 'Run2_2018_highBetaStar', 'Run3', + 'Run3_noMkFit', 'Run3_pp_on_PbPb', 'Run3_dd4hep', 'Phase2', @@ -51,7 +52,8 @@ def __init__(self): 'Phase2C11I13T22M9', 'Phase2C11I13T23M9', 'Phase2C11I13T25M9', - 'Phase2C11I13T26M9' + 'Phase2C11I13T26M9', + 'Phase2C11I13T27M9' ] internalUseMods = ['run2_common', 'run2_25ns_specific', @@ -68,15 +70,15 @@ def __init__(self): 'phase2_hgcal', 'phase2_timing', 'phase2_hfnose', 'phase2_hgcalV10', 'phase2_hgcalV11', 'phase2_hgcalV12', 'phase2_timing_layer', 'phase2_etlV4', 'phase2_hcal', 'phase2_ecal','phase2_ecal_devel', 'phase2_trigger', - 'phase2_squarePixels', 'phase2_3DPixels', + 'phase2_squarePixels', 'phase2_3DPixels', 'phase2_brickedPixels', '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', + 'run2_miniAOD_devel', 'run2_nanoAOD_102Xv1', 'run2_nanoAOD_106Xv1', 'run2_nanoAOD_106Xv2', 'run3_nanoAOD_devel', 'hcalHardcodeConditions', 'hcalSkipPacker', 'run2_HLTconditions_2016','run2_HLTconditions_2017','run2_HLTconditions_2018', 'bParking'] - internalUseModChains = ['run2_2017_noTrackingModifier'] + internalUseModChains = ['run2_2017_noTrackingModifier', 'trackingMkFitProd'] self.pythonCfgLines = {} diff --git a/Configuration/StandardSequences/python/L1TrackTrigger_cff.py b/Configuration/StandardSequences/python/L1TrackTrigger_cff.py index 031655562f570..c6a5ef6925bf1 100644 --- a/Configuration/StandardSequences/python/L1TrackTrigger_cff.py +++ b/Configuration/StandardSequences/python/L1TrackTrigger_cff.py @@ -13,5 +13,3 @@ from Configuration.Eras.Modifier_phase2_trigger_cff import phase2_trigger phase2_trigger.toReplaceWith( L1TrackTrigger, _tttracks_l1tracktrigger ) - -TTStubAlgorithm_official_Phase2TrackerDigi_.zMatchingPS = True diff --git a/Configuration/StandardSequences/python/Mixing.py b/Configuration/StandardSequences/python/Mixing.py index 792d4259773df..dfd619fd64425 100644 --- a/Configuration/StandardSequences/python/Mixing.py +++ b/Configuration/StandardSequences/python/Mixing.py @@ -118,6 +118,7 @@ def addMixingScenario(label,dict): addMixingScenario("mix_2016_PoissonOOTPU_HighPUTrains_Fill5412",{'file': 'SimGeneral.MixingModule.mix_2016_PoissonOOTPU_HighPUTrains_Fill5412_cfi'}) addMixingScenario("2017_25ns_WinterMC_PUScenarioV1_PoissonOOTPU",{'file': 'SimGeneral.MixingModule.mix_2017_25ns_WinterMC_PUScenarioV1_PoissonOOTPU_cfi'}) addMixingScenario("2017_25ns_UltraLegacy_PoissonOOTPU",{'file': 'SimGeneral.MixingModule.mix_2017_25ns_UltraLegacy_PoissonOOTPU_cfi'}) +addMixingScenario("2017_5TeV_UltraLegacy_PoissonOOTPU",{'file': 'SimGeneral.MixingModule.mix_2017_5TeV_UltraLegacy_PoissonOOTPU_cfi'}) addMixingScenario("2018_25ns_ProjectedPileup_PoissonOOTPU",{'file': 'SimGeneral.MixingModule.mix_2018_25ns_ProjectedPileup_PoissonOOTPU_cfi'}) addMixingScenario("2018_25ns_JuneProjectionFull18_PoissonOOTPU",{'file': 'SimGeneral.MixingModule.mix_2018_25ns_JuneProjectionFull18_PoissonOOTPU_cfi'}) addMixingScenario("2018_25ns_UltraLegacy_PoissonOOTPU",{'file': 'SimGeneral.MixingModule.mix_2018_25ns_UltraLegacy_PoissonOOTPU_cfi'}) diff --git a/Configuration/StandardSequences/python/Reconstruction_cff.py b/Configuration/StandardSequences/python/Reconstruction_cff.py index 3d9341d5cf0a5..cf742103ef9e5 100644 --- a/Configuration/StandardSequences/python/Reconstruction_cff.py +++ b/Configuration/StandardSequences/python/Reconstruction_cff.py @@ -90,7 +90,7 @@ ########################################### _fastSim_localrecoTask = localrecoTask.copyAndExclude([ castorreco, - totemRPLocalReconstructionTask,totemTimingLocalReconstructionTask,ctppsDiamondLocalReconstructionTask, + totemRPLocalReconstructionTask,totemTimingLocalReconstructionTask,diamondSampicLocalReconstructionTask,ctppsDiamondLocalReconstructionTask, ctppsLocalTrackLiteProducer,ctppsPixelLocalReconstructionTask,ctppsProtons, trackerlocalrecoTask ]) diff --git a/Configuration/StandardSequences/python/Services_cff.py b/Configuration/StandardSequences/python/Services_cff.py index 0949c7b8d4972..f68e2e399e9e9 100644 --- a/Configuration/StandardSequences/python/Services_cff.py +++ b/Configuration/StandardSequences/python/Services_cff.py @@ -10,7 +10,9 @@ # load CUDA services when the "gpu" or "pixelNtupletFit" modifiers are enabled def _addCUDAServices(process): - process.load("HeterogeneousCore.CUDAServices.CUDAService_cfi") + process.load("HeterogeneousCore.CUDAServices.CUDAService_cfi") + process.load("FWCore.MessageService.MessageLogger_cfi") + process.MessageLogger.CUDAService = cms.untracked.PSet() from Configuration.ProcessModifiers.gpu_cff import gpu from Configuration.ProcessModifiers.pixelNtupletFit_cff import pixelNtupletFit diff --git a/DPGAnalysis/HcalTools/interface/CMTRawAnalyzer.h b/DPGAnalysis/HcalTools/interface/CMTRawAnalyzer.h deleted file mode 100644 index 984c4139426bf..0000000000000 --- a/DPGAnalysis/HcalTools/interface/CMTRawAnalyzer.h +++ /dev/null @@ -1,487 +0,0 @@ -// -*- C++ -*- -// -// Package: CMTRawAnalyzer -#ifndef CMTRawAnalyzer_h -#define CMTRawAnalyzer_h -#include -#include -#include -#include -#include -#include -//using namespace std; -#include "FWCore/Framework/interface/ESHandle.h" -#include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "FWCore/ServiceRegistry/interface/Service.h" -#include "FWCore/PluginManager/interface/ModuleDef.h" -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/MakerMacros.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -//using namespace edm; -// this line is to retrieve HCAL RecHitCollections: -#include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h" -#include "DataFormats/HcalDetId/interface/HcalElectronicsId.h" -#include "DataFormats/HcalDetId/interface/HcalGenericDetId.h" -#include "DataFormats/HcalDetId/interface/HcalDetId.h" -#include "DataFormats/HcalDigi/interface/HcalQIESample.h" -#include "DataFormats/HcalDetId/interface/HcalCalibDetId.h" -#include "DataFormats/HcalDetId/interface/HcalSubdetector.h" -#include "DataFormats/HcalDigi/interface/HcalDigiCollections.h" -#include "DataFormats/HcalDigi/interface/HBHEDataFrame.h" -#include "DataFormats/HcalDigi/interface/HFDataFrame.h" -#include "DataFormats/HcalDigi/interface/HODataFrame.h" -#include "DataFormats/HcalDigi/interface/QIE10DataFrame.h" -#include "DataFormats/HcalDigi/interface/QIE11DataFrame.h" -#include "DataFormats/HcalDigi/interface/HcalCalibrationEventTypes.h" -#include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutRecord.h" -#include "CalibCalorimetry/HcalAlgos/interface/HcalLogicalMapGenerator.h" -#include "CondFormats/HcalObjects/interface/HcalLogicalMap.h" -#include "CalibFormats/HcalObjects/interface/HcalDbRecord.h" -#include "CalibFormats/HcalObjects/interface/HcalCalibrations.h" -#include "CalibFormats/HcalObjects/interface/HcalCoderDb.h" -#include "CalibFormats/HcalObjects/interface/HcalDbService.h" -#include "CondFormats/HcalObjects/interface/HcalQIECoder.h" -#include "CondFormats/HcalObjects/interface/HcalQIEShape.h" -#include "EventFilter/HcalRawToDigi/interface/HcalDCCHeader.h" -#include "CondFormats/DataRecord/interface/L1GtTriggerMaskAlgoTrigRcd.h" -#include "CondFormats/DataRecord/interface/L1GtTriggerMaskTechTrigRcd.h" -#include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h" -#include "DataFormats/FEDRawData/interface/FEDHeader.h" -#include "DataFormats/FEDRawData/interface/FEDTrailer.h" -#include "DataFormats/FEDRawData/interface/FEDNumbering.h" -#include "Geometry/Records/interface/HcalGeometryRecord.h" -#include "Geometry/Records/interface/CaloGeometryRecord.h" -#include "Geometry/Records/interface/IdealGeometryRecord.h" -#include "Geometry/Records/interface/HcalRecNumberingRecord.h" -#include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h" -#include "Geometry/CaloGeometry/interface/CaloCellGeometry.h" -#include "Geometry/CaloGeometry/interface/CaloGeometry.h" -#include "Geometry/CaloTopology/interface/HcalTopology.h" -#include "Geometry/HcalTowerAlgo/interface/HcalGeometry.h" -#include "Geometry/HcalCommonData/interface/HcalDDDRecConstants.h" -#include "TFile.h" -#include "TTree.h" -#include "TH1.h" -#include "TH2.h" -#include "TF1.h" - -#define NUMADCS 256 -// very preliminary, NEEDS UPDATING -double adc2fC_QIE10[NUMADCS] = { - // - - - - - - - range 0 - - - - - - - - - //subrange0 - 1.58, - 4.73, - 7.88, - 11.0, - 14.2, - 17.3, - 20.5, - 23.6, - 26.8, - 29.9, - 33.1, - 36.2, - 39.4, - 42.5, - 45.7, - 48.8, - //subrange1 - 53.6, - 60.1, - 66.6, - 73.0, - 79.5, - 86.0, - 92.5, - 98.9, - 105, - 112, - 118, - 125, - 131, - 138, - 144, - 151, - //subrange2 - 157, - 164, - 170, - 177, - 186, - 199, - 212, - 225, - 238, - 251, - 264, - 277, - 289, - 302, - 315, - 328, - //subrange3 - 341, - 354, - 367, - 380, - 393, - 406, - 418, - 431, - 444, - 464, - 490, - 516, - 542, - 568, - 594, - 620, - - // - - - - - - - range 1 - - - - - - - - - //subrange0 - 569, - 594, - 619, - 645, - 670, - 695, - 720, - 745, - 771, - 796, - 821, - 846, - 871, - 897, - 922, - 947, - //subrange1 - 960, - 1010, - 1060, - 1120, - 1170, - 1220, - 1270, - 1320, - 1370, - 1430, - 1480, - 1530, - 1580, - 1630, - 1690, - 1740, - //subrange2 - 1790, - 1840, - 1890, - 1940, - 2020, - 2120, - 2230, - 2330, - 2430, - 2540, - 2640, - 2740, - 2850, - 2950, - 3050, - 3150, - //subrange3 - 3260, - 3360, - 3460, - 3570, - 3670, - 3770, - 3880, - 3980, - 4080, - 4240, - 4450, - 4650, - 4860, - 5070, - 5280, - 5490, - - // - - - - - - - range 2 - - - - - - - - - //subrange0 - 5080, - 5280, - 5480, - 5680, - 5880, - 6080, - 6280, - 6480, - 6680, - 6890, - 7090, - 7290, - 7490, - 7690, - 7890, - 8090, - //subrange1 - 8400, - 8810, - 9220, - 9630, - 10000, - 10400, - 10900, - 11300, - 11700, - 12100, - 12500, - 12900, - 13300, - 13700, - 14100, - 14500, - //subrange2 - 15000, - 15400, - 15800, - 16200, - 16800, - 17600, - 18400, - 19300, - 20100, - 20900, - 21700, - 22500, - 23400, - 24200, - 25000, - 25800, - //subrange3 - 26600, - 27500, - 28300, - 29100, - 29900, - 30700, - 31600, - 32400, - 33200, - 34400, - 36100, - 37700, - 39400, - 41000, - 42700, - 44300, - - // - - - - - - - range 3 - - - - - - - - - - //subrange0 - 41100, - 42700, - 44300, - 45900, - 47600, - 49200, - 50800, - 52500, - 54100, - 55700, - 57400, - 59000, - 60600, - 62200, - 63900, - 65500, - //subrange1 - 68000, - 71300, - 74700, - 78000, - 81400, - 84700, - 88000, - 91400, - 94700, - 98100, - 101000, - 105000, - 108000, - 111000, - 115000, - 118000, - //subrange2 - 121000, - 125000, - 128000, - 131000, - 137000, - 145000, - 152000, - 160000, - 168000, - 176000, - 183000, - 191000, - 199000, - 206000, - 214000, - 222000, - //subrange3 - 230000, - 237000, - 245000, - 253000, - 261000, - 268000, - 276000, - 284000, - 291000, - 302000, - 316000, - 329000, - 343000, - 356000, - 370000, - 384000 - -}; - -//shunt1 -double const adc2fC_QIE11_shunt1[NUMADCS] = { - 1.89, 5.07, 8.25, 11.43, 14.61, 17.78, 20.96, 24.14, 27.32, 30.50, 33.68, - 36.86, 40.04, 43.22, 46.40, 49.58, 54.35, 60.71, 67.07, 73.43, 79.79, 86.15, - 92.51, 98.87, 105.2, 111.6, 117.9, 124.3, 130.7, 137.0, 143.4, 149.7, 156.1, - 162.5, 168.8, 175.2, 184.7, 197.4, 210.2, 222.9, 235.6, 248.3, 261.0, 273.7, - 286.5, 299.2, 311.9, 324.6, 337.3, 350.1, 362.8, 375.5, 388.2, 400.9, 413.6, - 426.4, 439.1, 458.2, 483.6, 509.0, 534.5, 559.9, 585.3, 610.8, 558.9, 584.2, - 609.5, 634.7, 660.0, 685.3, 710.6, 735.9, 761.2, 786.5, 811.8, 837.1, 862.4, - 887.7, 913.0, 938.3, 976.2, 1026.8, 1077.4, 1128.0, 1178.6, 1229.1, 1279.7, 1330.3, - 1380.9, 1431.5, 1482.1, 1532.7, 1583.3, 1633.8, 1684.4, 1735.0, 1785.6, 1836.2, 1886.8, - 1937.4, 2013.2, 2114.4, 2215.6, 2316.8, 2417.9, 2519.1, 2620.3, 2721.5, 2822.6, 2923.8, - 3025.0, 3126.2, 3227.3, 3328.5, 3429.7, 3530.9, 3632.0, 3733.2, 3834.4, 3935.5, 4036.7, - 4188.5, 4390.8, 4593.2, 4795.5, 4997.9, 5200.2, 5402.6, 5057.5, 5262.3, 5467.1, 5671.8, - 5876.6, 6081.4, 6286.2, 6491.0, 6695.8, 6900.6, 7105.3, 7310.1, 7514.9, 7719.7, 7924.5, - 8129.3, 8436.4, 8846.0, 9255.6, 9665.1, 10074.7, 10484.3, 10893.9, 11303.4, 11713.0, 12122.6, - 12532.1, 12941.7, 13351.3, 13760.8, 14170.4, 14580.0, 14989.5, 15399.1, 15808.7, 16218.2, 16832.6, - 17651.7, 18470.9, 19290.0, 20109.2, 20928.3, 21747.4, 22566.6, 23385.7, 24204.8, 25024.0, 25843.1, - 26662.3, 27481.4, 28300.5, 29119.7, 29938.8, 30757.9, 31577.1, 32396.2, 33215.4, 34444.1, 36082.3, - 37720.6, 39358.9, 40997.2, 42635.4, 44273.7, 40908.7, 42542.6, 44176.5, 45810.4, 47444.3, 49078.3, - 50712.2, 52346.1, 53980.0, 55613.9, 57247.8, 58881.8, 60515.7, 62149.6, 63783.5, 65417.4, 67868.3, - 71136.1, 74404.0, 77671.8, 80939.7, 84207.5, 87475.3, 90743.2, 94011.0, 97278.8, 100546.7, 103814.5, - 107082.3, 110350.2, 113618.0, 116885.8, 120153.7, 123421.5, 126689.3, 129957.2, 134858.9, 141394.6, 147930.3, - 154465.9, 161001.6, 167537.3, 174072.9, 180608.6, 187144.3, 193679.9, 200215.6, 206751.3, 213287.0, 219822.6, - 226358.3, 232894.0, 239429.6, 245965.3, 252501.0, 259036.6, 265572.3, 275375.8, 288447.2, 301518.5, 314589.8, - 327661.2, 340732.5, 353803.8}; -//shunt6 -double const adc2fC_QIE11_shunt6[NUMADCS] = { - 9.56, 28.24, 46.91, 65.59, 84.27, 102.9, 121.6, 140.3, 159.0, 177.7, - 196.3, 215.0, 233.7, 252.4, 271.0, 289.7, 317.7, 355.1, 392.4, 429.8, - 467.1, 504.5, 541.9, 579.2, 616.6, 653.9, 691.3, 728.6, 766.0, 803.3, - 840.7, 878.0, 915.4, 952.8, 990.1, 1027.5, 1083.5, 1158.2, 1232.9, 1307.6, - 1382.3, 1457.0, 1531.7, 1606.4, 1681.2, 1755.9, 1830.6, 1905.3, 1980.0, 2054.7, - 2129.4, 2204.1, 2278.8, 2353.5, 2428.2, 2502.9, 2577.7, 2689.7, 2839.1, 2988.6, - 3138.0, 3287.4, 3436.8, 3586.2, 3263.0, 3411.3, 3559.6, 3707.9, 3856.2, 4004.5, - 4152.9, 4301.2, 4449.5, 4597.8, 4746.1, 4894.4, 5042.7, 5191.0, 5339.4, 5487.7, - 5710.1, 6006.8, 6303.4, 6600.0, 6896.6, 7193.3, 7489.9, 7786.5, 8083.1, 8379.8, - 8676.4, 8973.0, 9269.6, 9566.3, 9862.9, 10159.5, 10456.2, 10752.8, 11049.4, 11346.0, - 11791.0, 12384.2, 12977.5, 13570.7, 14164.0, 14757.2, 15350.5, 15943.7, 16537.0, 17130.2, - 17723.5, 18316.7, 18910.0, 19503.2, 20096.5, 20689.7, 21283.0, 21876.2, 22469.5, 23062.8, - 23656.0, 24545.9, 25732.4, 26918.9, 28105.4, 29291.9, 30478.4, 31664.9, 29399.4, 30590.1, - 31780.9, 32971.7, 34162.4, 35353.2, 36544.0, 37734.7, 38925.5, 40116.3, 41307.0, 42497.8, - 43688.5, 44879.3, 46070.1, 47260.8, 49047.0, 51428.5, 53810.1, 56191.6, 58573.1, 60954.6, - 63336.2, 65717.7, 68099.2, 70480.8, 72862.3, 75243.8, 77625.4, 80006.9, 82388.4, 84769.9, - 87151.5, 89533.0, 91914.5, 94296.1, 97868.4, 102631.4, 107394.5, 112157.5, 116920.6, 121683.7, - 126446.7, 131209.8, 135972.8, 140735.9, 145499.0, 150262.0, 155025.1, 159788.2, 164551.2, 169314.3, - 174077.3, 178840.4, 183603.5, 188366.5, 193129.6, 200274.2, 209800.3, 219326.4, 228852.5, 238378.7, - 247904.8, 257430.9, 237822.7, 247326.7, 256830.7, 266334.8, 275838.8, 285342.9, 294846.9, 304351.0, - 313855.0, 323359.1, 332863.1, 342367.1, 351871.2, 361375.2, 370879.3, 380383.3, 394639.4, 413647.5, - 432655.6, 451663.6, 470671.7, 489679.8, 508687.9, 527696.0, 546704.1, 565712.2, 584720.3, 603728.3, - 622736.4, 641744.5, 660752.6, 679760.7, 698768.8, 717776.9, 736785.0, 755793.0, 784305.2, 822321.3, - 860337.5, 898353.7, 936369.9, 974386.0, 1012402.2, 1050418.4, 1088434.6, 1126450.7, 1164466.9, 1202483.1, - 1240499.3, 1278515.4, 1316531.6, 1354547.8, 1392564.0, 1430580.1, 1468596.3, 1506612.5, 1544628.7, 1601652.9, - 1677685.3, 1753717.6, 1829750.0, 1905782.3, 1981814.7, 2057847.0}; -// for HPD: -static const float adc2fC[128] = { - -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5, 9.5, 10.5, 11.5, - 12.5, 13.5, 15., 17., 19., 21., 23., 25., 27., 29.5, 32.5, 35.5, 38.5, - 42., 46., 50., 54.5, 59.5, 64.5, 59.5, 64.5, 69.5, 74.5, 79.5, 84.5, 89.5, - 94.5, 99.5, 104.5, 109.5, 114.5, 119.5, 124.5, 129.5, 137., 147., 157., 167., 177., - 187., 197., 209.5, 224.5, 239.5, 254.5, 272., 292., 312., 334.5, 359.5, 384.5, 359.5, - 384.5, 409.5, 434.5, 459.5, 484.5, 509.5, 534.5, 559.5, 584.5, 609.5, 634.5, 659.5, 684.5, - 709.5, 747., 797., 847., 897., 947., 997., 1047., 1109.5, 1184.5, 1259.5, 1334.5, 1422., - 1522., 1622., 1734.5, 1859.5, 1984.5, 1859.5, 1984.5, 2109.5, 2234.5, 2359.5, 2484.5, 2609.5, 2734.5, - 2859.5, 2984.5, 3109.5, 3234.5, 3359.5, 3484.5, 3609.5, 3797., 4047., 4297., 4547., 4797., 5047., - 5297., 5609.5, 5984.5, 6359.5, 6734.5, 7172., 7672., 8172., 8734.5, 9359.5, 9984.5}; -const int nsub = 4; -const int ndepth = 7; -const int neta = 82; -const int nphi = 72; -float bphi = 72.; -const int zneta = 22; -const int znphi = 18; -float zbphi = 18.; -const int npfit = 220; -float anpfit = 220.; // for SiPM: - -///////////////////////////////////////////////////////////////////////// -// SERVICE FUNCTIONS -------------------------------------------------------- -/* -double CMTRawAnalyzer::dR(double eta1, double phi1, double eta2, double phi2) { - double PI = 3.1415926535898; - double deltaphi = phi1 - phi2; - if (phi2 > phi1) { - deltaphi = phi2 - phi1; - } - if (deltaphi > PI) { - deltaphi = 2. * PI - deltaphi; - } - double deltaeta = eta2 - eta1; - double tmp = sqrt(deltaeta * deltaeta + deltaphi * deltaphi); - return tmp; -} - -double CMTRawAnalyzer::phi12(double phi1, double en1, double phi2, double en2) { - // weighted mean value of phi1 and phi2 - - double tmp; - double PI = 3.1415926535898; - double a1 = phi1; - double a2 = phi2; - - if (a1 > 0.5 * PI && a2 < 0.) - a2 += 2 * PI; - if (a2 > 0.5 * PI && a1 < 0.) - a1 += 2 * PI; - tmp = (a1 * en1 + a2 * en2) / (en1 + en2); - if (tmp > PI) - tmp -= 2. * PI; - - return tmp; -} - -double CMTRawAnalyzer::dPhiWsign(double phi1, double phi2) { - // clockwise phi2 w.r.t phi1 means "+" phi distance - // anti-clockwise phi2 w.r.t phi1 means "-" phi distance - - double PI = 3.1415926535898; - double a1 = phi1; - double a2 = phi2; - double tmp = a2 - a1; - if (a1 * a2 < 0.) { - if (a1 > 0.5 * PI) - tmp += 2. * PI; - if (a2 > 0.5 * PI) - tmp -= 2. * PI; - } - return tmp; -} -*/ -///////////////////////////////////////////////////////////////////////// - -#endif diff --git a/DPGAnalysis/HcalTools/BuildFile.xml b/DPGAnalysis/HcalTools/plugins/BuildFile.xml similarity index 79% rename from DPGAnalysis/HcalTools/BuildFile.xml rename to DPGAnalysis/HcalTools/plugins/BuildFile.xml index 1799f0836c471..dd8648b74e287 100644 --- a/DPGAnalysis/HcalTools/BuildFile.xml +++ b/DPGAnalysis/HcalTools/plugins/BuildFile.xml @@ -1,3 +1,4 @@ + @@ -7,4 +8,6 @@ + + diff --git a/DPGAnalysis/HcalTools/src/CMTRawAnalyzer.cc b/DPGAnalysis/HcalTools/plugins/CMTRawAnalyzer.cc similarity index 72% rename from DPGAnalysis/HcalTools/src/CMTRawAnalyzer.cc rename to DPGAnalysis/HcalTools/plugins/CMTRawAnalyzer.cc index dd6c2bba22155..a479d0098f030 100644 --- a/DPGAnalysis/HcalTools/src/CMTRawAnalyzer.cc +++ b/DPGAnalysis/HcalTools/plugins/CMTRawAnalyzer.cc @@ -3,14 +3,434 @@ // // Package: CMTRawAnalyzer // -#include "DPGAnalysis/HcalTools/interface/CMTRawAnalyzer.h" -// -using namespace std; -// -using namespace edm; +#include +#include +#include +#include +#include +#include + +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/ServiceRegistry/interface/Service.h" +#include "FWCore/PluginManager/interface/ModuleDef.h" +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" + +// this line is to retrieve HCAL RecHitCollections: +#include "CommonTools/UtilAlgos/interface/TFileService.h" +#include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h" +#include "DataFormats/HcalDetId/interface/HcalElectronicsId.h" +#include "DataFormats/HcalDetId/interface/HcalGenericDetId.h" +#include "DataFormats/HcalDetId/interface/HcalDetId.h" +#include "DataFormats/HcalDigi/interface/HcalQIESample.h" +#include "DataFormats/HcalDetId/interface/HcalCalibDetId.h" +#include "DataFormats/HcalDetId/interface/HcalSubdetector.h" +#include "DataFormats/HcalDigi/interface/HcalDigiCollections.h" +#include "DataFormats/HcalDigi/interface/HBHEDataFrame.h" +#include "DataFormats/HcalDigi/interface/HFDataFrame.h" +#include "DataFormats/HcalDigi/interface/HODataFrame.h" +#include "DataFormats/HcalDigi/interface/QIE10DataFrame.h" +#include "DataFormats/HcalDigi/interface/QIE11DataFrame.h" +#include "DataFormats/HcalDigi/interface/HcalCalibrationEventTypes.h" +#include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutRecord.h" +#include "CalibCalorimetry/HcalAlgos/interface/HcalLogicalMapGenerator.h" +#include "CondFormats/HcalObjects/interface/HcalLogicalMap.h" +#include "CalibFormats/HcalObjects/interface/HcalDbRecord.h" +#include "CalibFormats/HcalObjects/interface/HcalCalibrations.h" +#include "CalibFormats/HcalObjects/interface/HcalCoderDb.h" +#include "CalibFormats/HcalObjects/interface/HcalDbService.h" +#include "CondFormats/HcalObjects/interface/HcalQIECoder.h" +#include "CondFormats/HcalObjects/interface/HcalQIEShape.h" +#include "EventFilter/HcalRawToDigi/interface/HcalDCCHeader.h" +#include "CondFormats/DataRecord/interface/L1GtTriggerMaskAlgoTrigRcd.h" +#include "CondFormats/DataRecord/interface/L1GtTriggerMaskTechTrigRcd.h" +#include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h" +#include "DataFormats/FEDRawData/interface/FEDHeader.h" +#include "DataFormats/FEDRawData/interface/FEDTrailer.h" +#include "DataFormats/FEDRawData/interface/FEDNumbering.h" +#include "Geometry/Records/interface/HcalGeometryRecord.h" +#include "Geometry/Records/interface/CaloGeometryRecord.h" +#include "Geometry/Records/interface/IdealGeometryRecord.h" +#include "Geometry/Records/interface/HcalRecNumberingRecord.h" +#include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h" +#include "Geometry/CaloGeometry/interface/CaloCellGeometry.h" +#include "Geometry/CaloGeometry/interface/CaloGeometry.h" +#include "Geometry/CaloTopology/interface/HcalTopology.h" +#include "Geometry/HcalTowerAlgo/interface/HcalGeometry.h" +#include "Geometry/HcalCommonData/interface/HcalDDDRecConstants.h" +#include "TFile.h" +#include "TTree.h" +#include "TH1.h" +#include "TH2.h" +#include "TF1.h" + +#define NUMADCS 256 +// very preliminary, NEEDS UPDATING +double adc2fC_QIE10[NUMADCS] = { + // - - - - - - - range 0 - - - - - - - - + //subrange0 + 1.58, + 4.73, + 7.88, + 11.0, + 14.2, + 17.3, + 20.5, + 23.6, + 26.8, + 29.9, + 33.1, + 36.2, + 39.4, + 42.5, + 45.7, + 48.8, + //subrange1 + 53.6, + 60.1, + 66.6, + 73.0, + 79.5, + 86.0, + 92.5, + 98.9, + 105, + 112, + 118, + 125, + 131, + 138, + 144, + 151, + //subrange2 + 157, + 164, + 170, + 177, + 186, + 199, + 212, + 225, + 238, + 251, + 264, + 277, + 289, + 302, + 315, + 328, + //subrange3 + 341, + 354, + 367, + 380, + 393, + 406, + 418, + 431, + 444, + 464, + 490, + 516, + 542, + 568, + 594, + 620, + + // - - - - - - - range 1 - - - - - - - - + //subrange0 + 569, + 594, + 619, + 645, + 670, + 695, + 720, + 745, + 771, + 796, + 821, + 846, + 871, + 897, + 922, + 947, + //subrange1 + 960, + 1010, + 1060, + 1120, + 1170, + 1220, + 1270, + 1320, + 1370, + 1430, + 1480, + 1530, + 1580, + 1630, + 1690, + 1740, + //subrange2 + 1790, + 1840, + 1890, + 1940, + 2020, + 2120, + 2230, + 2330, + 2430, + 2540, + 2640, + 2740, + 2850, + 2950, + 3050, + 3150, + //subrange3 + 3260, + 3360, + 3460, + 3570, + 3670, + 3770, + 3880, + 3980, + 4080, + 4240, + 4450, + 4650, + 4860, + 5070, + 5280, + 5490, + + // - - - - - - - range 2 - - - - - - - - + //subrange0 + 5080, + 5280, + 5480, + 5680, + 5880, + 6080, + 6280, + 6480, + 6680, + 6890, + 7090, + 7290, + 7490, + 7690, + 7890, + 8090, + //subrange1 + 8400, + 8810, + 9220, + 9630, + 10000, + 10400, + 10900, + 11300, + 11700, + 12100, + 12500, + 12900, + 13300, + 13700, + 14100, + 14500, + //subrange2 + 15000, + 15400, + 15800, + 16200, + 16800, + 17600, + 18400, + 19300, + 20100, + 20900, + 21700, + 22500, + 23400, + 24200, + 25000, + 25800, + //subrange3 + 26600, + 27500, + 28300, + 29100, + 29900, + 30700, + 31600, + 32400, + 33200, + 34400, + 36100, + 37700, + 39400, + 41000, + 42700, + 44300, + + // - - - - - - - range 3 - - - - - - - - - + //subrange0 + 41100, + 42700, + 44300, + 45900, + 47600, + 49200, + 50800, + 52500, + 54100, + 55700, + 57400, + 59000, + 60600, + 62200, + 63900, + 65500, + //subrange1 + 68000, + 71300, + 74700, + 78000, + 81400, + 84700, + 88000, + 91400, + 94700, + 98100, + 101000, + 105000, + 108000, + 111000, + 115000, + 118000, + //subrange2 + 121000, + 125000, + 128000, + 131000, + 137000, + 145000, + 152000, + 160000, + 168000, + 176000, + 183000, + 191000, + 199000, + 206000, + 214000, + 222000, + //subrange3 + 230000, + 237000, + 245000, + 253000, + 261000, + 268000, + 276000, + 284000, + 291000, + 302000, + 316000, + 329000, + 343000, + 356000, + 370000, + 384000 + +}; + +//shunt1 +double const adc2fC_QIE11_shunt1[NUMADCS] = { + 1.89, 5.07, 8.25, 11.43, 14.61, 17.78, 20.96, 24.14, 27.32, 30.50, 33.68, + 36.86, 40.04, 43.22, 46.40, 49.58, 54.35, 60.71, 67.07, 73.43, 79.79, 86.15, + 92.51, 98.87, 105.2, 111.6, 117.9, 124.3, 130.7, 137.0, 143.4, 149.7, 156.1, + 162.5, 168.8, 175.2, 184.7, 197.4, 210.2, 222.9, 235.6, 248.3, 261.0, 273.7, + 286.5, 299.2, 311.9, 324.6, 337.3, 350.1, 362.8, 375.5, 388.2, 400.9, 413.6, + 426.4, 439.1, 458.2, 483.6, 509.0, 534.5, 559.9, 585.3, 610.8, 558.9, 584.2, + 609.5, 634.7, 660.0, 685.3, 710.6, 735.9, 761.2, 786.5, 811.8, 837.1, 862.4, + 887.7, 913.0, 938.3, 976.2, 1026.8, 1077.4, 1128.0, 1178.6, 1229.1, 1279.7, 1330.3, + 1380.9, 1431.5, 1482.1, 1532.7, 1583.3, 1633.8, 1684.4, 1735.0, 1785.6, 1836.2, 1886.8, + 1937.4, 2013.2, 2114.4, 2215.6, 2316.8, 2417.9, 2519.1, 2620.3, 2721.5, 2822.6, 2923.8, + 3025.0, 3126.2, 3227.3, 3328.5, 3429.7, 3530.9, 3632.0, 3733.2, 3834.4, 3935.5, 4036.7, + 4188.5, 4390.8, 4593.2, 4795.5, 4997.9, 5200.2, 5402.6, 5057.5, 5262.3, 5467.1, 5671.8, + 5876.6, 6081.4, 6286.2, 6491.0, 6695.8, 6900.6, 7105.3, 7310.1, 7514.9, 7719.7, 7924.5, + 8129.3, 8436.4, 8846.0, 9255.6, 9665.1, 10074.7, 10484.3, 10893.9, 11303.4, 11713.0, 12122.6, + 12532.1, 12941.7, 13351.3, 13760.8, 14170.4, 14580.0, 14989.5, 15399.1, 15808.7, 16218.2, 16832.6, + 17651.7, 18470.9, 19290.0, 20109.2, 20928.3, 21747.4, 22566.6, 23385.7, 24204.8, 25024.0, 25843.1, + 26662.3, 27481.4, 28300.5, 29119.7, 29938.8, 30757.9, 31577.1, 32396.2, 33215.4, 34444.1, 36082.3, + 37720.6, 39358.9, 40997.2, 42635.4, 44273.7, 40908.7, 42542.6, 44176.5, 45810.4, 47444.3, 49078.3, + 50712.2, 52346.1, 53980.0, 55613.9, 57247.8, 58881.8, 60515.7, 62149.6, 63783.5, 65417.4, 67868.3, + 71136.1, 74404.0, 77671.8, 80939.7, 84207.5, 87475.3, 90743.2, 94011.0, 97278.8, 100546.7, 103814.5, + 107082.3, 110350.2, 113618.0, 116885.8, 120153.7, 123421.5, 126689.3, 129957.2, 134858.9, 141394.6, 147930.3, + 154465.9, 161001.6, 167537.3, 174072.9, 180608.6, 187144.3, 193679.9, 200215.6, 206751.3, 213287.0, 219822.6, + 226358.3, 232894.0, 239429.6, 245965.3, 252501.0, 259036.6, 265572.3, 275375.8, 288447.2, 301518.5, 314589.8, + 327661.2, 340732.5, 353803.8}; +//shunt6 +double const adc2fC_QIE11_shunt6[NUMADCS] = { + 9.56, 28.24, 46.91, 65.59, 84.27, 102.9, 121.6, 140.3, 159.0, 177.7, + 196.3, 215.0, 233.7, 252.4, 271.0, 289.7, 317.7, 355.1, 392.4, 429.8, + 467.1, 504.5, 541.9, 579.2, 616.6, 653.9, 691.3, 728.6, 766.0, 803.3, + 840.7, 878.0, 915.4, 952.8, 990.1, 1027.5, 1083.5, 1158.2, 1232.9, 1307.6, + 1382.3, 1457.0, 1531.7, 1606.4, 1681.2, 1755.9, 1830.6, 1905.3, 1980.0, 2054.7, + 2129.4, 2204.1, 2278.8, 2353.5, 2428.2, 2502.9, 2577.7, 2689.7, 2839.1, 2988.6, + 3138.0, 3287.4, 3436.8, 3586.2, 3263.0, 3411.3, 3559.6, 3707.9, 3856.2, 4004.5, + 4152.9, 4301.2, 4449.5, 4597.8, 4746.1, 4894.4, 5042.7, 5191.0, 5339.4, 5487.7, + 5710.1, 6006.8, 6303.4, 6600.0, 6896.6, 7193.3, 7489.9, 7786.5, 8083.1, 8379.8, + 8676.4, 8973.0, 9269.6, 9566.3, 9862.9, 10159.5, 10456.2, 10752.8, 11049.4, 11346.0, + 11791.0, 12384.2, 12977.5, 13570.7, 14164.0, 14757.2, 15350.5, 15943.7, 16537.0, 17130.2, + 17723.5, 18316.7, 18910.0, 19503.2, 20096.5, 20689.7, 21283.0, 21876.2, 22469.5, 23062.8, + 23656.0, 24545.9, 25732.4, 26918.9, 28105.4, 29291.9, 30478.4, 31664.9, 29399.4, 30590.1, + 31780.9, 32971.7, 34162.4, 35353.2, 36544.0, 37734.7, 38925.5, 40116.3, 41307.0, 42497.8, + 43688.5, 44879.3, 46070.1, 47260.8, 49047.0, 51428.5, 53810.1, 56191.6, 58573.1, 60954.6, + 63336.2, 65717.7, 68099.2, 70480.8, 72862.3, 75243.8, 77625.4, 80006.9, 82388.4, 84769.9, + 87151.5, 89533.0, 91914.5, 94296.1, 97868.4, 102631.4, 107394.5, 112157.5, 116920.6, 121683.7, + 126446.7, 131209.8, 135972.8, 140735.9, 145499.0, 150262.0, 155025.1, 159788.2, 164551.2, 169314.3, + 174077.3, 178840.4, 183603.5, 188366.5, 193129.6, 200274.2, 209800.3, 219326.4, 228852.5, 238378.7, + 247904.8, 257430.9, 237822.7, 247326.7, 256830.7, 266334.8, 275838.8, 285342.9, 294846.9, 304351.0, + 313855.0, 323359.1, 332863.1, 342367.1, 351871.2, 361375.2, 370879.3, 380383.3, 394639.4, 413647.5, + 432655.6, 451663.6, 470671.7, 489679.8, 508687.9, 527696.0, 546704.1, 565712.2, 584720.3, 603728.3, + 622736.4, 641744.5, 660752.6, 679760.7, 698768.8, 717776.9, 736785.0, 755793.0, 784305.2, 822321.3, + 860337.5, 898353.7, 936369.9, 974386.0, 1012402.2, 1050418.4, 1088434.6, 1126450.7, 1164466.9, 1202483.1, + 1240499.3, 1278515.4, 1316531.6, 1354547.8, 1392564.0, 1430580.1, 1468596.3, 1506612.5, 1544628.7, 1601652.9, + 1677685.3, 1753717.6, 1829750.0, 1905782.3, 1981814.7, 2057847.0}; +// for HPD: +static const float adc2fC[128] = { + -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5, 9.5, 10.5, 11.5, + 12.5, 13.5, 15., 17., 19., 21., 23., 25., 27., 29.5, 32.5, 35.5, 38.5, + 42., 46., 50., 54.5, 59.5, 64.5, 59.5, 64.5, 69.5, 74.5, 79.5, 84.5, 89.5, + 94.5, 99.5, 104.5, 109.5, 114.5, 119.5, 124.5, 129.5, 137., 147., 157., 167., 177., + 187., 197., 209.5, 224.5, 239.5, 254.5, 272., 292., 312., 334.5, 359.5, 384.5, 359.5, + 384.5, 409.5, 434.5, 459.5, 484.5, 509.5, 534.5, 559.5, 584.5, 609.5, 634.5, 659.5, 684.5, + 709.5, 747., 797., 847., 897., 947., 997., 1047., 1109.5, 1184.5, 1259.5, 1334.5, 1422., + 1522., 1622., 1734.5, 1859.5, 1984.5, 1859.5, 1984.5, 2109.5, 2234.5, 2359.5, 2484.5, 2609.5, 2734.5, + 2859.5, 2984.5, 3109.5, 3234.5, 3359.5, 3484.5, 3609.5, 3797., 4047., 4297., 4547., 4797., 5047., + 5297., 5609.5, 5984.5, 6359.5, 6734.5, 7172., 7672., 8172., 8734.5, 9359.5, 9984.5}; +const int nsub = 4; +const int ndepth = 7; +const int neta = 82; +const int nphi = 72; +const float bphi = 72.; +const int zneta = 22; +const int znphi = 18; +const int npfit = 220; +const float anpfit = 220.; // for SiPM: + // // -class CMTRawAnalyzer : public edm::EDAnalyzer { +class CMTRawAnalyzer : public edm::one::EDAnalyzer { public: explicit CMTRawAnalyzer(const edm::ParameterSet&); ~CMTRawAnalyzer() override; @@ -22,6 +442,10 @@ class CMTRawAnalyzer : public edm::EDAnalyzer { virtual void fillMAP(); private: + double phi12(double phi1, double en1, double phi2, double en2); + double dR(double eta1, double phi1, double eta2, double phi2); + double dPhiWsign(double phi1, double phi2); + edm::EDGetTokenT tok_calib_; edm::EDGetTokenT tok_hbhe_; edm::EDGetTokenT tok_ho_; @@ -33,18 +457,15 @@ class CMTRawAnalyzer : public edm::EDAnalyzer { edm::EDGetTokenT tok_hbheNoise_; edm::EDGetTokenT tok_hfSignal_; edm::EDGetTokenT tok_hfNoise_; - //////////////////////////////////// - // double dR(double eta1, double phi1, double eta2, double phi2); - // double phi12(double phi1, double en1, double phi2, double en2); - // double dPhiWsign(double phi1, double phi2); - //////////////////////////////////// + + edm::Service fs_; std::string fOutputFileName; std::string MAPOutputFileName; edm::InputTag inputTag_; - edm::ESHandle geometry; - edm::ESHandle conditions; + const edm::ESGetToken tokDB_; + const edm::ESGetToken tokTopo_; const HcalQIEShape* shape; - edm::ESHandle topo_; + const HcalDbService* conditions; const HcalTopology* topo; ///////////////////////////////////////////// int verbosity; @@ -1901,7 +2322,7 @@ class CMTRawAnalyzer : public edm::EDAnalyzer { double maxxOCCUP4; TTree* myTree; TFile* hOutputFile; - ofstream MAPfile; + std::ofstream MAPfile; ///////////////////////////////////////// // Get RBX number from 1-35 for Calibration box int getRBX(int& i, int& j, int& k); @@ -1926,6 +2347,7 @@ class CMTRawAnalyzer : public edm::EDAnalyzer { float blsmax; int nlsminmax; }; + // /////////////////////////////// ------------------------------------------------------------------- // @@ -1940,14 +2362,6 @@ void CMTRawAnalyzer::endJob() { h_nls_per_run->Fill(float(lscounterrun)); h_nls_per_run10->Fill(float(lscounterrun10)); - hOutputFile->SetCompressionLevel(2); - - hOutputFile->Write(); - hOutputFile->cd(); - - if (recordNtuples_) - myTree->Write(); - /////////////////////////////////////////////////////////////////////////////////////////////// std::cout << "===== full number of events = " << nevent << std::endl; std::cout << "===== possible max number of events in ntuple(each 50th recorded) = " << nevent50 << std::endl; @@ -1962,1724 +2376,15 @@ void CMTRawAnalyzer::endJob() { std::cout << "===== Start writing user histograms =====" << std::endl; ////////////////////////////////////////////////////////////////////// scaling of some histoes: ///////////////////////////////////////////->Write(); - h_bcnvsamplitude_HB->Write(); - h_bcnvsamplitude0_HB->Write(); - h_bcnvsamplitude_HE->Write(); - h_bcnvsamplitude0_HE->Write(); - h_bcnvsamplitude_HF->Write(); - h_bcnvsamplitude0_HF->Write(); - h_bcnvsamplitude_HO->Write(); - h_bcnvsamplitude0_HO->Write(); - - h_orbitNumvsamplitude_HB->Write(); - h_orbitNumvsamplitude0_HB->Write(); - h_orbitNumvsamplitude_HE->Write(); - h_orbitNumvsamplitude0_HE->Write(); - h_orbitNumvsamplitude_HF->Write(); - h_orbitNumvsamplitude0_HF->Write(); - h_orbitNumvsamplitude_HO->Write(); - h_orbitNumvsamplitude0_HO->Write(); - - h_2DsumADCAmplEtaPhiLs0->Write(); - h_2DsumADCAmplEtaPhiLs1->Write(); - h_2DsumADCAmplEtaPhiLs2->Write(); - h_2DsumADCAmplEtaPhiLs3->Write(); - - h_2DsumADCAmplEtaPhiLs00->Write(); - h_2DsumADCAmplEtaPhiLs10->Write(); - h_2DsumADCAmplEtaPhiLs20->Write(); - h_2DsumADCAmplEtaPhiLs30->Write(); - - h_sumADCAmplEtaPhiLs->Write(); - h_sumADCAmplEtaPhiLs_bbbc->Write(); - h_sumADCAmplEtaPhiLs_bbb1->Write(); - h_sumADCAmplEtaPhiLs_lscounterM1->Write(); - h_sumADCAmplEtaPhiLs_ietaphi->Write(); - h_sumADCAmplEtaPhiLs_lscounterM1orbitNum->Write(); - h_sumADCAmplEtaPhiLs_orbitNum->Write(); - - if (recordHistoes_) { - h_errorGeneral->Write(); - h_error1->Write(); - h_error2->Write(); - h_error3->Write(); - h_amplError->Write(); - h_amplFine->Write(); - - h_errorGeneral_HB->Write(); - h_error1_HB->Write(); - h_error2_HB->Write(); - h_error3_HB->Write(); - h_error4_HB->Write(); - h_error5_HB->Write(); - h_error6_HB->Write(); - h_error7_HB->Write(); - h_amplError_HB->Write(); - h_amplFine_HB->Write(); - h_mapDepth1Error_HB->Write(); - h_mapDepth2Error_HB->Write(); - h_mapDepth3Error_HB->Write(); - h_mapDepth4Error_HB->Write(); - h_fiber0_HB->Write(); - h_fiber1_HB->Write(); - h_fiber2_HB->Write(); - h_repetedcapid_HB->Write(); - - h_errorGeneral_HE->Write(); - h_error1_HE->Write(); - h_error2_HE->Write(); - h_error3_HE->Write(); - h_error4_HE->Write(); - h_error5_HE->Write(); - h_error6_HE->Write(); - h_error7_HE->Write(); - h_amplError_HE->Write(); - h_amplFine_HE->Write(); - h_mapDepth1Error_HE->Write(); - h_mapDepth2Error_HE->Write(); - h_mapDepth3Error_HE->Write(); - h_mapDepth4Error_HE->Write(); - h_mapDepth5Error_HE->Write(); - h_mapDepth6Error_HE->Write(); - h_mapDepth7Error_HE->Write(); - h_fiber0_HE->Write(); - h_fiber1_HE->Write(); - h_fiber2_HE->Write(); - h_repetedcapid_HE->Write(); - - h_errorGeneral_HF->Write(); - h_error1_HF->Write(); - h_error2_HF->Write(); - h_error3_HF->Write(); - h_error4_HF->Write(); - h_error5_HF->Write(); - h_error6_HF->Write(); - h_error7_HF->Write(); - h_amplError_HF->Write(); - h_amplFine_HF->Write(); - h_mapDepth1Error_HF->Write(); - h_mapDepth2Error_HF->Write(); - h_mapDepth3Error_HF->Write(); - h_mapDepth4Error_HF->Write(); - h_fiber0_HF->Write(); - h_fiber1_HF->Write(); - h_fiber2_HF->Write(); - h_repetedcapid_HF->Write(); - - h_errorGeneral_HO->Write(); - h_error1_HO->Write(); - h_error2_HO->Write(); - h_error3_HO->Write(); - h_error4_HO->Write(); - h_error5_HO->Write(); - h_error6_HO->Write(); - h_error7_HO->Write(); - h_amplError_HO->Write(); - h_amplFine_HO->Write(); - h_mapDepth4Error_HO->Write(); - h_fiber0_HO->Write(); - h_fiber1_HO->Write(); - h_fiber2_HO->Write(); - h_repetedcapid_HO->Write(); - - /////////////////////// - h_numberofhitsHBtest->Write(); - h_numberofhitsHEtest->Write(); - h_numberofhitsHFtest->Write(); - h_numberofhitsHOtest->Write(); - h_AmplitudeHBtest->Write(); - h_AmplitudeHBtest1->Write(); - h_AmplitudeHBtest6->Write(); - h_AmplitudeHEtest->Write(); - h_AmplitudeHEtest1->Write(); - h_AmplitudeHEtest6->Write(); - h_AmplitudeHFtest->Write(); - h_AmplitudeHOtest->Write(); - h_totalAmplitudeHB->Write(); - h_totalAmplitudeHE->Write(); - h_totalAmplitudeHF->Write(); - h_totalAmplitudeHO->Write(); - h_totalAmplitudeHBperEvent->Write(); - h_totalAmplitudeHEperEvent->Write(); - h_totalAmplitudeHFperEvent->Write(); - h_totalAmplitudeHOperEvent->Write(); - - h_ADCAmpl345Zoom_HB->Write(); - h_ADCAmpl345Zoom1_HB->Write(); - h_ADCAmpl345_HB->Write(); - - h_ADCAmpl_HBCapIdNoError->Write(); - h_ADCAmpl345_HBCapIdNoError->Write(); - h_ADCAmpl_HBCapIdError->Write(); - h_ADCAmpl345_HBCapIdError->Write(); - - h_ADCAmplZoom_HB->Write(); - h_ADCAmplZoom1_HB->Write(); - h_ADCAmpl_HB->Write(); - - h_AmplitudeHBrest->Write(); - h_AmplitudeHBrest1->Write(); - h_AmplitudeHBrest6->Write(); - - h_mapDepth1ADCAmpl225_HB->Write(); - h_mapDepth2ADCAmpl225_HB->Write(); - h_mapDepth1ADCAmpl_HB->Write(); - h_mapDepth2ADCAmpl_HB->Write(); - h_mapDepth1ADCAmpl12_HB->Write(); - h_mapDepth2ADCAmpl12_HB->Write(); - - h_mapDepth3ADCAmpl225_HB->Write(); - h_mapDepth4ADCAmpl225_HB->Write(); - h_mapDepth3ADCAmpl_HB->Write(); - h_mapDepth4ADCAmpl_HB->Write(); - h_mapDepth3ADCAmpl12_HB->Write(); - h_mapDepth4ADCAmpl12_HB->Write(); - - h_TSmeanA_HB->Write(); - h_mapDepth1TSmeanA225_HB->Write(); - h_mapDepth2TSmeanA225_HB->Write(); - h_mapDepth1TSmeanA_HB->Write(); - h_mapDepth2TSmeanA_HB->Write(); - h_mapDepth3TSmeanA225_HB->Write(); - h_mapDepth4TSmeanA225_HB->Write(); - h_mapDepth3TSmeanA_HB->Write(); - h_mapDepth4TSmeanA_HB->Write(); - - h_TSmaxA_HB->Write(); - h_mapDepth1TSmaxA225_HB->Write(); - h_mapDepth2TSmaxA225_HB->Write(); - h_mapDepth1TSmaxA_HB->Write(); - h_mapDepth2TSmaxA_HB->Write(); - h_mapDepth3TSmaxA225_HB->Write(); - h_mapDepth4TSmaxA225_HB->Write(); - h_mapDepth3TSmaxA_HB->Write(); - h_mapDepth4TSmaxA_HB->Write(); - - h_Amplitude_HB->Write(); - h_mapDepth1Amplitude225_HB->Write(); - h_mapDepth2Amplitude225_HB->Write(); - h_mapDepth1Amplitude_HB->Write(); - h_mapDepth2Amplitude_HB->Write(); - h_mapDepth3Amplitude225_HB->Write(); - h_mapDepth4Amplitude225_HB->Write(); - h_mapDepth3Amplitude_HB->Write(); - h_mapDepth4Amplitude_HB->Write(); - - h_Ampl_HB->Write(); - h_mapDepth1Ampl047_HB->Write(); - h_mapDepth2Ampl047_HB->Write(); - h_mapDepth1Ampl_HB->Write(); - h_mapDepth2Ampl_HB->Write(); - h_mapDepth1AmplE34_HB->Write(); - h_mapDepth2AmplE34_HB->Write(); - h_mapDepth1_HB->Write(); - h_mapDepth2_HB->Write(); - h_mapDepth3Ampl047_HB->Write(); - h_mapDepth4Ampl047_HB->Write(); - h_mapDepth3Ampl_HB->Write(); - h_mapDepth4Ampl_HB->Write(); - h_mapDepth3AmplE34_HB->Write(); - h_mapDepth4AmplE34_HB->Write(); - h_mapDepth3_HB->Write(); - h_mapDepth4_HB->Write(); - - h_mapDepth1ADCAmpl225Copy_HB->Write(); - h_mapDepth2ADCAmpl225Copy_HB->Write(); - h_mapDepth3ADCAmpl225Copy_HB->Write(); - h_mapDepth4ADCAmpl225Copy_HB->Write(); - h_mapDepth1ADCAmpl225Copy_HE->Write(); - h_mapDepth2ADCAmpl225Copy_HE->Write(); - h_mapDepth3ADCAmpl225Copy_HE->Write(); - h_mapDepth4ADCAmpl225Copy_HE->Write(); - h_mapDepth5ADCAmpl225Copy_HE->Write(); - h_mapDepth6ADCAmpl225Copy_HE->Write(); - h_mapDepth7ADCAmpl225Copy_HE->Write(); - h_mapDepth1ADCAmpl225Copy_HF->Write(); - h_mapDepth2ADCAmpl225Copy_HF->Write(); - h_mapDepth3ADCAmpl225Copy_HF->Write(); - h_mapDepth4ADCAmpl225Copy_HF->Write(); - h_mapDepth4ADCAmpl225Copy_HO->Write(); - /////////////////////// - h_ADCAmpl_HF->Write(); - h_ADCAmplrest1_HF->Write(); - h_ADCAmplrest6_HF->Write(); - - h_ADCAmplZoom1_HF->Write(); - h_mapDepth1ADCAmpl225_HF->Write(); - h_mapDepth2ADCAmpl225_HF->Write(); - h_mapDepth1ADCAmpl_HF->Write(); - h_mapDepth2ADCAmpl_HF->Write(); - h_mapDepth1ADCAmpl12_HF->Write(); - h_mapDepth2ADCAmpl12_HF->Write(); - h_mapDepth3ADCAmpl225_HF->Write(); - h_mapDepth4ADCAmpl225_HF->Write(); - h_mapDepth3ADCAmpl_HF->Write(); - h_mapDepth4ADCAmpl_HF->Write(); - h_mapDepth3ADCAmpl12_HF->Write(); - h_mapDepth4ADCAmpl12_HF->Write(); - - h_TSmeanA_HF->Write(); - h_mapDepth1TSmeanA225_HF->Write(); - h_mapDepth2TSmeanA225_HF->Write(); - h_mapDepth1TSmeanA_HF->Write(); - h_mapDepth2TSmeanA_HF->Write(); - h_mapDepth3TSmeanA225_HF->Write(); - h_mapDepth4TSmeanA225_HF->Write(); - h_mapDepth3TSmeanA_HF->Write(); - h_mapDepth4TSmeanA_HF->Write(); - - h_TSmaxA_HF->Write(); - h_mapDepth1TSmaxA225_HF->Write(); - h_mapDepth2TSmaxA225_HF->Write(); - h_mapDepth1TSmaxA_HF->Write(); - h_mapDepth2TSmaxA_HF->Write(); - h_mapDepth3TSmaxA225_HF->Write(); - h_mapDepth4TSmaxA225_HF->Write(); - h_mapDepth3TSmaxA_HF->Write(); - h_mapDepth4TSmaxA_HF->Write(); - - h_Amplitude_HF->Write(); - h_mapDepth1Amplitude225_HF->Write(); - h_mapDepth2Amplitude225_HF->Write(); - h_mapDepth1Amplitude_HF->Write(); - h_mapDepth2Amplitude_HF->Write(); - h_mapDepth3Amplitude225_HF->Write(); - h_mapDepth4Amplitude225_HF->Write(); - h_mapDepth3Amplitude_HF->Write(); - h_mapDepth4Amplitude_HF->Write(); - - h_Ampl_HF->Write(); - h_mapDepth1Ampl047_HF->Write(); - h_mapDepth2Ampl047_HF->Write(); - h_mapDepth3Ampl047_HF->Write(); - h_mapDepth4Ampl047_HF->Write(); - - h_mapDepth1Ampl_HF->Write(); - h_mapDepth2Ampl_HF->Write(); - h_mapDepth1AmplE34_HF->Write(); - h_mapDepth2AmplE34_HF->Write(); - h_mapDepth1_HF->Write(); - h_mapDepth2_HF->Write(); - h_mapDepth3Ampl_HF->Write(); - h_mapDepth4Ampl_HF->Write(); - h_mapDepth3AmplE34_HF->Write(); - h_mapDepth4AmplE34_HF->Write(); - h_mapDepth3_HF->Write(); - h_mapDepth4_HF->Write(); - - /////////////////////// - h_ADCAmpl_HO->Write(); - h_ADCAmplrest1_HO->Write(); - h_ADCAmplrest6_HO->Write(); - - h_ADCAmplZoom1_HO->Write(); - h_ADCAmpl_HO_copy->Write(); - h_mapDepth4ADCAmpl225_HO->Write(); - h_mapDepth4ADCAmpl_HO->Write(); - h_mapDepth4ADCAmpl12_HO->Write(); - - h_TSmeanA_HO->Write(); - h_mapDepth4TSmeanA225_HO->Write(); - h_mapDepth4TSmeanA_HO->Write(); - - h_TSmaxA_HO->Write(); - h_mapDepth4TSmaxA225_HO->Write(); - h_mapDepth4TSmaxA_HO->Write(); - - h_Amplitude_HO->Write(); - h_mapDepth4Amplitude225_HO->Write(); - h_mapDepth4Amplitude_HO->Write(); - h_Ampl_HO->Write(); - h_mapDepth4Ampl047_HO->Write(); - h_mapDepth4Ampl_HO->Write(); - h_mapDepth4AmplE34_HO->Write(); - h_mapDepth4_HO->Write(); - - ////////////////////////////////////////// - - h_ADCAmpl345Zoom_HE->Write(); - h_ADCAmpl345Zoom1_HE->Write(); - h_ADCAmpl345_HE->Write(); - h_ADCAmpl_HE->Write(); - h_ADCAmplrest_HE->Write(); - h_ADCAmplrest1_HE->Write(); - h_ADCAmplrest6_HE->Write(); - - h_ADCAmplZoom1_HE->Write(); - - h_corrforxaMAIN_HE->Write(); - h_corrforxaMAIN0_HE->Write(); - h_corrforxaADDI_HE->Write(); - h_corrforxaADDI0_HE->Write(); - - h_mapDepth1ADCAmpl225_HE->Write(); - h_mapDepth2ADCAmpl225_HE->Write(); - h_mapDepth3ADCAmpl225_HE->Write(); - h_mapDepth4ADCAmpl225_HE->Write(); - h_mapDepth5ADCAmpl225_HE->Write(); - h_mapDepth6ADCAmpl225_HE->Write(); - h_mapDepth7ADCAmpl225_HE->Write(); - - h_mapADCAmplfirstpeak_HE->Write(); - h_mapADCAmplfirstpeak0_HE->Write(); - h_mapADCAmplsecondpeak_HE->Write(); - h_mapADCAmplsecondpeak0_HE->Write(); - h_mapADCAmpl11firstpeak_HE->Write(); - h_mapADCAmpl11firstpeak0_HE->Write(); - h_mapADCAmpl11secondpeak_HE->Write(); - h_mapADCAmpl11secondpeak0_HE->Write(); - h_mapADCAmpl12firstpeak_HE->Write(); - h_mapADCAmpl12firstpeak0_HE->Write(); - h_mapADCAmpl12secondpeak_HE->Write(); - h_mapADCAmpl12secondpeak0_HE->Write(); - - h_gsmdifferencefit1_HE->Write(); - h_gsmdifferencefit2_HE->Write(); - h_gsmdifferencefit3_HE->Write(); - h_gsmdifferencefit4_HE->Write(); - h_gsmdifferencefit5_HE->Write(); - h_gsmdifferencefit6_HE->Write(); - - h_mapDepth1ADCAmpl_HE->Write(); - h_mapDepth2ADCAmpl_HE->Write(); - h_mapDepth3ADCAmpl_HE->Write(); - h_mapDepth4ADCAmpl_HE->Write(); - h_mapDepth5ADCAmpl_HE->Write(); - h_mapDepth6ADCAmpl_HE->Write(); - h_mapDepth7ADCAmpl_HE->Write(); - h_mapDepth1ADCAmpl12_HE->Write(); - h_mapDepth2ADCAmpl12_HE->Write(); - h_mapDepth3ADCAmpl12_HE->Write(); - h_mapDepth4ADCAmpl12_HE->Write(); - h_mapDepth5ADCAmpl12_HE->Write(); - h_mapDepth6ADCAmpl12_HE->Write(); - h_mapDepth7ADCAmpl12_HE->Write(); - - h_mapDepth1ADCAmplSiPM_HE->Write(); - h_mapDepth2ADCAmplSiPM_HE->Write(); - h_mapDepth3ADCAmplSiPM_HE->Write(); - h_mapDepth1ADCAmpl12SiPM_HE->Write(); - h_mapDepth2ADCAmpl12SiPM_HE->Write(); - h_mapDepth3ADCAmpl12SiPM_HE->Write(); - - h_mapDepth1linADCAmpl12_HE->Write(); - h_mapDepth2linADCAmpl12_HE->Write(); - h_mapDepth3linADCAmpl12_HE->Write(); - - h_TSmeanA_HE->Write(); - h_mapDepth1TSmeanA225_HE->Write(); - h_mapDepth2TSmeanA225_HE->Write(); - h_mapDepth3TSmeanA225_HE->Write(); - h_mapDepth4TSmeanA225_HE->Write(); - h_mapDepth5TSmeanA225_HE->Write(); - h_mapDepth6TSmeanA225_HE->Write(); - h_mapDepth7TSmeanA225_HE->Write(); - h_mapDepth1TSmeanA_HE->Write(); - h_mapDepth2TSmeanA_HE->Write(); - h_mapDepth3TSmeanA_HE->Write(); - h_mapDepth4TSmeanA_HE->Write(); - h_mapDepth5TSmeanA_HE->Write(); - h_mapDepth6TSmeanA_HE->Write(); - h_mapDepth7TSmeanA_HE->Write(); - - h_TSmaxA_HE->Write(); - h_mapDepth1TSmaxA225_HE->Write(); - h_mapDepth2TSmaxA225_HE->Write(); - h_mapDepth3TSmaxA225_HE->Write(); - h_mapDepth4TSmaxA225_HE->Write(); - h_mapDepth5TSmaxA225_HE->Write(); - h_mapDepth6TSmaxA225_HE->Write(); - h_mapDepth7TSmaxA225_HE->Write(); - h_mapDepth1TSmaxA_HE->Write(); - h_mapDepth2TSmaxA_HE->Write(); - h_mapDepth3TSmaxA_HE->Write(); - h_mapDepth4TSmaxA_HE->Write(); - h_mapDepth5TSmaxA_HE->Write(); - h_mapDepth6TSmaxA_HE->Write(); - h_mapDepth7TSmaxA_HE->Write(); - - h_Amplitude_HE->Write(); - h_mapDepth1Amplitude225_HE->Write(); - h_mapDepth2Amplitude225_HE->Write(); - h_mapDepth3Amplitude225_HE->Write(); - h_mapDepth4Amplitude225_HE->Write(); - h_mapDepth5Amplitude225_HE->Write(); - h_mapDepth6Amplitude225_HE->Write(); - h_mapDepth7Amplitude225_HE->Write(); - h_mapDepth1Amplitude_HE->Write(); - h_mapDepth2Amplitude_HE->Write(); - h_mapDepth3Amplitude_HE->Write(); - h_mapDepth4Amplitude_HE->Write(); - h_mapDepth5Amplitude_HE->Write(); - h_mapDepth6Amplitude_HE->Write(); - h_mapDepth7Amplitude_HE->Write(); - - h_Ampl_HE->Write(); - h_mapDepth1Ampl047_HE->Write(); - h_mapDepth2Ampl047_HE->Write(); - h_mapDepth3Ampl047_HE->Write(); - h_mapDepth4Ampl047_HE->Write(); - h_mapDepth5Ampl047_HE->Write(); - h_mapDepth6Ampl047_HE->Write(); - h_mapDepth7Ampl047_HE->Write(); - h_mapDepth1Ampl_HE->Write(); - h_mapDepth2Ampl_HE->Write(); - h_mapDepth3Ampl_HE->Write(); - h_mapDepth4Ampl_HE->Write(); - h_mapDepth5Ampl_HE->Write(); - h_mapDepth6Ampl_HE->Write(); - h_mapDepth7Ampl_HE->Write(); - h_mapDepth1AmplE34_HE->Write(); - h_mapDepth2AmplE34_HE->Write(); - h_mapDepth3AmplE34_HE->Write(); - h_mapDepth4AmplE34_HE->Write(); - h_mapDepth5AmplE34_HE->Write(); - h_mapDepth6AmplE34_HE->Write(); - h_mapDepth7AmplE34_HE->Write(); - h_mapDepth1_HE->Write(); - h_mapDepth2_HE->Write(); - h_mapDepth3_HE->Write(); - h_mapDepth4_HE->Write(); - h_mapDepth5_HE->Write(); - h_mapDepth6_HE->Write(); - h_mapDepth7_HE->Write(); - - /////////////////////// - - h_FullSignal3D_HB->Write(); - h_FullSignal3D0_HB->Write(); - h_FullSignal3D_HE->Write(); - h_FullSignal3D0_HE->Write(); - h_FullSignal3D_HO->Write(); - h_FullSignal3D0_HO->Write(); - h_FullSignal3D_HF->Write(); - h_FullSignal3D0_HF->Write(); - - h_nbadchannels_depth1_HB->Write(); - h_runnbadchannels_depth1_HB->Write(); - h_runnbadchannelsC_depth1_HB->Write(); - h_runbadrate_depth1_HB->Write(); - h_runbadrateC_depth1_HB->Write(); - h_runbadrate0_depth1_HB->Write(); - - h_nbadchannels_depth2_HB->Write(); - h_runnbadchannels_depth2_HB->Write(); - h_runnbadchannelsC_depth2_HB->Write(); - h_runbadrate_depth2_HB->Write(); - h_runbadrateC_depth2_HB->Write(); - h_runbadrate0_depth2_HB->Write(); - - h_nbadchannels_depth1_HE->Write(); - h_runnbadchannels_depth1_HE->Write(); - h_runnbadchannelsC_depth1_HE->Write(); - h_runbadrate_depth1_HE->Write(); - h_runbadrateC_depth1_HE->Write(); - h_runbadrate0_depth1_HE->Write(); - - h_nbadchannels_depth2_HE->Write(); - h_runnbadchannels_depth2_HE->Write(); - h_runnbadchannelsC_depth2_HE->Write(); - h_runbadrate_depth2_HE->Write(); - h_runbadrateC_depth2_HE->Write(); - h_runbadrate0_depth2_HE->Write(); - - h_nbadchannels_depth3_HE->Write(); - h_runnbadchannels_depth3_HE->Write(); - h_runnbadchannelsC_depth3_HE->Write(); - h_runbadrate_depth3_HE->Write(); - h_runbadrateC_depth3_HE->Write(); - h_runbadrate0_depth3_HE->Write(); - - h_nbadchannels_depth1_HF->Write(); - h_runnbadchannels_depth1_HF->Write(); - h_runnbadchannelsC_depth1_HF->Write(); - h_runbadrate_depth1_HF->Write(); - h_runbadrateC_depth1_HF->Write(); - h_runbadrate0_depth1_HF->Write(); - - h_nbadchannels_depth2_HF->Write(); - h_runnbadchannels_depth2_HF->Write(); - h_runnbadchannelsC_depth2_HF->Write(); - h_runbadrate_depth2_HF->Write(); - h_runbadrateC_depth2_HF->Write(); - h_runbadrate0_depth2_HF->Write(); - - h_nbadchannels_depth4_HO->Write(); - h_runnbadchannels_depth4_HO->Write(); - h_runnbadchannelsC_depth4_HO->Write(); - h_runbadrate_depth4_HO->Write(); - h_runbadrateC_depth4_HO->Write(); - h_runbadrate0_depth4_HO->Write(); - - /////////////////////// - h_mapCapCalib047_HB->Write(); - h_mapCapCalib047_HE->Write(); - h_mapCapCalib047_HO->Write(); - h_mapCapCalib047_HF->Write(); - - h_ADCCalib_HB->Write(); - h_ADCCalib1_HB->Write(); - h_mapADCCalib047_HB->Write(); - h_mapADCCalib_HB->Write(); - h_RatioCalib_HB->Write(); - h_mapRatioCalib047_HB->Write(); - h_mapRatioCalib_HB->Write(); - h_TSmaxCalib_HB->Write(); - h_mapTSmaxCalib047_HB->Write(); - h_mapTSmaxCalib_HB->Write(); - h_TSmeanCalib_HB->Write(); - h_mapTSmeanCalib047_HB->Write(); - h_mapTSmeanCalib_HB->Write(); - h_WidthCalib_HB->Write(); - h_mapWidthCalib047_HB->Write(); - h_mapWidthCalib_HB->Write(); - h_map_HB->Write(); - h_ADCCalib_HE->Write(); - h_ADCCalib1_HE->Write(); - h_mapADCCalib047_HE->Write(); - h_mapADCCalib_HE->Write(); - h_RatioCalib_HE->Write(); - h_mapRatioCalib047_HE->Write(); - h_mapRatioCalib_HE->Write(); - h_TSmaxCalib_HE->Write(); - h_mapTSmaxCalib047_HE->Write(); - h_mapTSmaxCalib_HE->Write(); - h_TSmeanCalib_HE->Write(); - h_mapTSmeanCalib047_HE->Write(); - h_mapTSmeanCalib_HE->Write(); - h_WidthCalib_HE->Write(); - h_mapWidthCalib047_HE->Write(); - h_mapWidthCalib_HE->Write(); - h_map_HE->Write(); - h_ADCCalib_HO->Write(); - h_ADCCalib1_HO->Write(); - h_mapADCCalib047_HO->Write(); - h_mapADCCalib_HO->Write(); - h_RatioCalib_HO->Write(); - h_mapRatioCalib047_HO->Write(); - h_mapRatioCalib_HO->Write(); - h_TSmaxCalib_HO->Write(); - h_mapTSmaxCalib047_HO->Write(); - h_mapTSmaxCalib_HO->Write(); - h_TSmeanCalib_HO->Write(); - h_mapTSmeanCalib047_HO->Write(); - h_mapTSmeanCalib_HO->Write(); - h_WidthCalib_HO->Write(); - h_mapWidthCalib047_HO->Write(); - h_mapWidthCalib_HO->Write(); - h_map_HO->Write(); - h_ADCCalib_HF->Write(); - h_ADCCalib1_HF->Write(); - h_mapADCCalib047_HF->Write(); - h_mapADCCalib_HF->Write(); - h_RatioCalib_HF->Write(); - h_mapRatioCalib047_HF->Write(); - h_mapRatioCalib_HF->Write(); - h_TSmaxCalib_HF->Write(); - h_mapTSmaxCalib047_HF->Write(); - h_mapTSmaxCalib_HF->Write(); - h_TSmeanCalib_HF->Write(); - h_mapTSmeanCalib047_HF->Write(); - h_mapTSmeanCalib_HF->Write(); - h_WidthCalib_HF->Write(); - h_mapWidthCalib047_HF->Write(); - h_mapWidthCalib_HF->Write(); - h_map_HF->Write(); - - h_nls_per_run->Write(); - h_nls_per_run10->Write(); - h_nevents_per_LS->Write(); - h_nevents_per_LSzoom->Write(); - h_nevents_per_eachRealLS->Write(); - h_nevents_per_eachLS->Write(); - h_lsnumber_per_eachLS->Write(); - - // for estimator0: - h_sumPedestalLS1->Write(); - h_2DsumPedestalLS1->Write(); - h_sumPedestalperLS1->Write(); - h_2D0sumPedestalLS1->Write(); - h_sum0PedestalperLS1->Write(); - - h_sumPedestalLS2->Write(); - h_2DsumPedestalLS2->Write(); - h_sumPedestalperLS2->Write(); - h_2D0sumPedestalLS2->Write(); - h_sum0PedestalperLS2->Write(); - - h_sumPedestalLS3->Write(); - h_2DsumPedestalLS3->Write(); - h_sumPedestalperLS3->Write(); - h_2D0sumPedestalLS3->Write(); - h_sum0PedestalperLS3->Write(); - - h_sumPedestalLS4->Write(); - h_2DsumPedestalLS4->Write(); - h_sumPedestalperLS4->Write(); - h_2D0sumPedestalLS4->Write(); - h_sum0PedestalperLS4->Write(); - - h_sumPedestalLS5->Write(); - h_2DsumPedestalLS5->Write(); - h_sumPedestalperLS5->Write(); - h_2D0sumPedestalLS5->Write(); - h_sum0PedestalperLS5->Write(); - - h_sumPedestalLS6->Write(); - h_2DsumPedestalLS6->Write(); - h_sumPedestalperLS6->Write(); - h_2D0sumPedestalLS6->Write(); - h_sum0PedestalperLS6->Write(); - - h_sumPedestalLS7->Write(); - h_2DsumPedestalLS7->Write(); - h_sumPedestalperLS7->Write(); - h_2D0sumPedestalLS7->Write(); - h_sum0PedestalperLS7->Write(); - - h_sumPedestalLS8->Write(); - h_2DsumPedestalLS8->Write(); - h_sumPedestalperLS8->Write(); - h_2D0sumPedestalLS8->Write(); - h_sum0PedestalperLS8->Write(); - - // for estimator1: - - // for HE gain stability vs LS: - h_2DsumADCAmplLSdepth4HEu->Write(); - h_2D0sumADCAmplLSdepth4HEu->Write(); - h_2DsumADCAmplLSdepth5HEu->Write(); - h_2D0sumADCAmplLSdepth5HEu->Write(); - h_2DsumADCAmplLSdepth6HEu->Write(); - h_2D0sumADCAmplLSdepth6HEu->Write(); - h_2DsumADCAmplLSdepth7HEu->Write(); - h_2D0sumADCAmplLSdepth7HEu->Write(); - h_2DsumADCAmplLSdepth3HFu->Write(); - h_2D0sumADCAmplLSdepth3HFu->Write(); - h_2DsumADCAmplLSdepth4HFu->Write(); - h_2D0sumADCAmplLSdepth4HFu->Write(); - // for HB gain stability vs LS: - h_2DsumADCAmplLSdepth3HBu->Write(); - h_2D0sumADCAmplLSdepth3HBu->Write(); - h_2DsumADCAmplLSdepth4HBu->Write(); - h_2D0sumADCAmplLSdepth4HBu->Write(); - - h_sumADCAmplLS1copy1->Write(); - h_sumADCAmplLS1copy2->Write(); - h_sumADCAmplLS1copy3->Write(); - h_sumADCAmplLS1copy4->Write(); - h_sumADCAmplLS1copy5->Write(); - h_sumADCAmplLS1->Write(); - h_2DsumADCAmplLS1->Write(); - h_2DsumADCAmplLS1_LSselected->Write(); - h_sumADCAmplperLS1->Write(); - h_sumCutADCAmplperLS1->Write(); - h_2D0sumADCAmplLS1->Write(); - h_sum0ADCAmplperLS1->Write(); - - h_sumADCAmplLS2->Write(); - h_2DsumADCAmplLS2->Write(); - h_2DsumADCAmplLS2_LSselected->Write(); - h_sumADCAmplperLS2->Write(); - h_sumCutADCAmplperLS2->Write(); - h_2D0sumADCAmplLS2->Write(); - h_sum0ADCAmplperLS2->Write(); - - h_sumADCAmplLS3->Write(); - h_2DsumADCAmplLS3->Write(); - h_2DsumADCAmplLS3_LSselected->Write(); - h_sumADCAmplperLS3->Write(); - h_sumCutADCAmplperLS3->Write(); - h_2D0sumADCAmplLS3->Write(); - h_sum0ADCAmplperLS3->Write(); - - h_sumADCAmplLS4->Write(); - h_2DsumADCAmplLS4->Write(); - h_2DsumADCAmplLS4_LSselected->Write(); - h_sumADCAmplperLS4->Write(); - h_sumCutADCAmplperLS4->Write(); - h_2D0sumADCAmplLS4->Write(); - h_sum0ADCAmplperLS4->Write(); - - h_sumADCAmplLS5->Write(); - h_2DsumADCAmplLS5->Write(); - h_2DsumADCAmplLS5_LSselected->Write(); - h_sumADCAmplperLS5->Write(); - h_sumCutADCAmplperLS5->Write(); - h_2D0sumADCAmplLS5->Write(); - h_sum0ADCAmplperLS5->Write(); - - h_sumADCAmplLS6->Write(); - h_2DsumADCAmplLS6->Write(); - h_2DsumADCAmplLS6_LSselected->Write(); - h_2D0sumADCAmplLS6->Write(); - h_sumADCAmplperLS6->Write(); - h_sumCutADCAmplperLS6->Write(); - h_sum0ADCAmplperLS6->Write(); - h_sumADCAmplperLS6u->Write(); - h_sumCutADCAmplperLS6u->Write(); - h_sum0ADCAmplperLS6u->Write(); - - h_sumADCAmplperLSdepth4HEu->Write(); - h_sumADCAmplperLSdepth5HEu->Write(); - h_sumADCAmplperLSdepth6HEu->Write(); - h_sumADCAmplperLSdepth7HEu->Write(); - h_sumCutADCAmplperLSdepth4HEu->Write(); - h_sumCutADCAmplperLSdepth5HEu->Write(); - h_sumCutADCAmplperLSdepth6HEu->Write(); - h_sumCutADCAmplperLSdepth7HEu->Write(); - h_sum0ADCAmplperLSdepth4HEu->Write(); - h_sum0ADCAmplperLSdepth5HEu->Write(); - h_sum0ADCAmplperLSdepth6HEu->Write(); - h_sum0ADCAmplperLSdepth7HEu->Write(); - - h_sumADCAmplperLSdepth3HBu->Write(); - h_sumADCAmplperLSdepth4HBu->Write(); - h_sumCutADCAmplperLSdepth3HBu->Write(); - h_sumCutADCAmplperLSdepth4HBu->Write(); - h_sum0ADCAmplperLSdepth3HBu->Write(); - h_sum0ADCAmplperLSdepth4HBu->Write(); - - h_sumADCAmplperLS1_P1->Write(); - h_sum0ADCAmplperLS1_P1->Write(); - h_sumADCAmplperLS1_P2->Write(); - h_sum0ADCAmplperLS1_P2->Write(); - h_sumADCAmplperLS1_M1->Write(); - h_sum0ADCAmplperLS1_M1->Write(); - h_sumADCAmplperLS1_M2->Write(); - h_sum0ADCAmplperLS1_M2->Write(); - - h_sumADCAmplperLS3_P1->Write(); - h_sum0ADCAmplperLS3_P1->Write(); - h_sumADCAmplperLS3_P2->Write(); - h_sum0ADCAmplperLS3_P2->Write(); - h_sumADCAmplperLS3_M1->Write(); - h_sum0ADCAmplperLS3_M1->Write(); - h_sumADCAmplperLS3_M2->Write(); - h_sum0ADCAmplperLS3_M2->Write(); - - h_sumADCAmplperLS6_P1->Write(); - h_sum0ADCAmplperLS6_P1->Write(); - h_sumADCAmplperLS6_P2->Write(); - h_sum0ADCAmplperLS6_P2->Write(); - h_sumADCAmplperLS6_M1->Write(); - h_sum0ADCAmplperLS6_M1->Write(); - h_sumADCAmplperLS6_M2->Write(); - h_sum0ADCAmplperLS6_M2->Write(); - - h_sumADCAmplperLS8_P1->Write(); - h_sum0ADCAmplperLS8_P1->Write(); - h_sumADCAmplperLS8_P2->Write(); - h_sum0ADCAmplperLS8_P2->Write(); - h_sumADCAmplperLS8_M1->Write(); - h_sum0ADCAmplperLS8_M1->Write(); - h_sumADCAmplperLS8_M2->Write(); - h_sum0ADCAmplperLS8_M2->Write(); - - h_sumADCAmplLS7->Write(); - h_2DsumADCAmplLS7->Write(); - h_2DsumADCAmplLS7_LSselected->Write(); - h_2D0sumADCAmplLS7->Write(); - h_sumADCAmplperLS7->Write(); - h_sumCutADCAmplperLS7->Write(); - h_sum0ADCAmplperLS7->Write(); - h_sumADCAmplperLS7u->Write(); - h_sumCutADCAmplperLS7u->Write(); - h_sum0ADCAmplperLS7u->Write(); - - h_sumADCAmplLS8->Write(); - h_2DsumADCAmplLS8->Write(); - h_2DsumADCAmplLS8_LSselected->Write(); - h_sumADCAmplperLS8->Write(); - h_sumCutADCAmplperLS8->Write(); - h_2D0sumADCAmplLS8->Write(); - h_sum0ADCAmplperLS8->Write(); - - // for estimator2: - h_sumTSmeanALS1->Write(); - h_2DsumTSmeanALS1->Write(); - h_sumTSmeanAperLS1->Write(); - h_sumTSmeanAperLS1_LSselected->Write(); - h_sumCutTSmeanAperLS1->Write(); - h_2D0sumTSmeanALS1->Write(); - h_sum0TSmeanAperLS1->Write(); - - h_sumTSmeanALS2->Write(); - h_2DsumTSmeanALS2->Write(); - h_sumTSmeanAperLS2->Write(); - h_sumCutTSmeanAperLS2->Write(); - h_2D0sumTSmeanALS2->Write(); - h_sum0TSmeanAperLS2->Write(); - - h_sumTSmeanALS3->Write(); - h_2DsumTSmeanALS3->Write(); - h_sumTSmeanAperLS3->Write(); - h_sumCutTSmeanAperLS3->Write(); - h_2D0sumTSmeanALS3->Write(); - h_sum0TSmeanAperLS3->Write(); - - h_sumTSmeanALS4->Write(); - h_2DsumTSmeanALS4->Write(); - h_sumTSmeanAperLS4->Write(); - h_sumCutTSmeanAperLS4->Write(); - h_2D0sumTSmeanALS4->Write(); - h_sum0TSmeanAperLS4->Write(); - - h_sumTSmeanALS5->Write(); - h_2DsumTSmeanALS5->Write(); - h_sumTSmeanAperLS5->Write(); - h_sumCutTSmeanAperLS5->Write(); - h_2D0sumTSmeanALS5->Write(); - h_sum0TSmeanAperLS5->Write(); - - h_sumTSmeanALS6->Write(); - h_2DsumTSmeanALS6->Write(); - h_sumTSmeanAperLS6->Write(); - h_sumCutTSmeanAperLS6->Write(); - h_2D0sumTSmeanALS6->Write(); - h_sum0TSmeanAperLS6->Write(); - - h_sumTSmeanALS7->Write(); - h_2DsumTSmeanALS7->Write(); - h_sumTSmeanAperLS7->Write(); - h_sumCutTSmeanAperLS7->Write(); - h_2D0sumTSmeanALS7->Write(); - h_sum0TSmeanAperLS7->Write(); - - h_sumTSmeanALS8->Write(); - h_2DsumTSmeanALS8->Write(); - h_sumTSmeanAperLS8->Write(); - h_sumCutTSmeanAperLS8->Write(); - h_2D0sumTSmeanALS8->Write(); - h_sum0TSmeanAperLS8->Write(); - - // for estimator3: - h_sumTSmaxALS1->Write(); - h_2DsumTSmaxALS1->Write(); - h_sumTSmaxAperLS1->Write(); - h_sumTSmaxAperLS1_LSselected->Write(); - h_sumCutTSmaxAperLS1->Write(); - h_2D0sumTSmaxALS1->Write(); - h_sum0TSmaxAperLS1->Write(); - - h_sumTSmaxALS2->Write(); - h_2DsumTSmaxALS2->Write(); - h_sumTSmaxAperLS2->Write(); - h_sumCutTSmaxAperLS2->Write(); - h_2D0sumTSmaxALS2->Write(); - h_sum0TSmaxAperLS2->Write(); - - h_sumTSmaxALS3->Write(); - h_2DsumTSmaxALS3->Write(); - h_sumTSmaxAperLS3->Write(); - h_sumCutTSmaxAperLS3->Write(); - h_2D0sumTSmaxALS3->Write(); - h_sum0TSmaxAperLS3->Write(); - - h_sumTSmaxALS4->Write(); - h_2DsumTSmaxALS4->Write(); - h_sumTSmaxAperLS4->Write(); - h_sumCutTSmaxAperLS4->Write(); - h_2D0sumTSmaxALS4->Write(); - h_sum0TSmaxAperLS4->Write(); - - h_sumTSmaxALS5->Write(); - h_2DsumTSmaxALS5->Write(); - h_sumTSmaxAperLS5->Write(); - h_sumCutTSmaxAperLS5->Write(); - h_2D0sumTSmaxALS5->Write(); - h_sum0TSmaxAperLS5->Write(); - - h_sumTSmaxALS6->Write(); - h_2DsumTSmaxALS6->Write(); - h_sumTSmaxAperLS6->Write(); - h_sumCutTSmaxAperLS6->Write(); - h_2D0sumTSmaxALS6->Write(); - h_sum0TSmaxAperLS6->Write(); - - h_sumTSmaxALS7->Write(); - h_2DsumTSmaxALS7->Write(); - h_sumTSmaxAperLS7->Write(); - h_sumCutTSmaxAperLS7->Write(); - h_2D0sumTSmaxALS7->Write(); - h_sum0TSmaxAperLS7->Write(); - - h_sumTSmaxALS8->Write(); - h_2DsumTSmaxALS8->Write(); - h_sumTSmaxAperLS8->Write(); - h_sumCutTSmaxAperLS8->Write(); - h_2D0sumTSmaxALS8->Write(); - h_sum0TSmaxAperLS8->Write(); - - // for estimator4: - h_sumAmplitudeLS1->Write(); - h_2DsumAmplitudeLS1->Write(); - h_sumAmplitudeperLS1->Write(); - h_sumAmplitudeperLS1_LSselected->Write(); - h_sumCutAmplitudeperLS1->Write(); - h_2D0sumAmplitudeLS1->Write(); - h_sum0AmplitudeperLS1->Write(); - - h_sumAmplitudeLS2->Write(); - h_2DsumAmplitudeLS2->Write(); - h_sumAmplitudeperLS2->Write(); - h_sumCutAmplitudeperLS2->Write(); - h_2D0sumAmplitudeLS2->Write(); - h_sum0AmplitudeperLS2->Write(); - - h_sumAmplitudeLS3->Write(); - h_2DsumAmplitudeLS3->Write(); - h_sumAmplitudeperLS3->Write(); - h_sumCutAmplitudeperLS3->Write(); - h_2D0sumAmplitudeLS3->Write(); - h_sum0AmplitudeperLS3->Write(); - - h_sumAmplitudeLS4->Write(); - h_2DsumAmplitudeLS4->Write(); - h_sumAmplitudeperLS4->Write(); - h_sumCutAmplitudeperLS4->Write(); - h_2D0sumAmplitudeLS4->Write(); - h_sum0AmplitudeperLS4->Write(); - - h_sumAmplitudeLS5->Write(); - h_2DsumAmplitudeLS5->Write(); - h_sumAmplitudeperLS5->Write(); - h_sumCutAmplitudeperLS5->Write(); - h_2D0sumAmplitudeLS5->Write(); - h_sum0AmplitudeperLS5->Write(); - - h_sumAmplitudeLS6->Write(); - h_2DsumAmplitudeLS6->Write(); - h_sumAmplitudeperLS6->Write(); - h_sumCutAmplitudeperLS6->Write(); - h_2D0sumAmplitudeLS6->Write(); - h_sum0AmplitudeperLS6->Write(); - - h_sumAmplitudeLS7->Write(); - h_2DsumAmplitudeLS7->Write(); - h_sumAmplitudeperLS7->Write(); - h_sumCutAmplitudeperLS7->Write(); - h_2D0sumAmplitudeLS7->Write(); - h_sum0AmplitudeperLS7->Write(); - - h_sumAmplitudeLS8->Write(); - h_2DsumAmplitudeLS8->Write(); - h_sumAmplitudeperLS8->Write(); - h_sumCutAmplitudeperLS8->Write(); - h_2D0sumAmplitudeLS8->Write(); - h_sum0AmplitudeperLS8->Write(); - - // for estimator6: - h_sumErrorBLS1->Write(); - h_sumErrorBperLS1->Write(); - h_sum0ErrorBperLS1->Write(); - h_2D0sumErrorBLS1->Write(); - h_2DsumErrorBLS1->Write(); - h_sumErrorBLS2->Write(); - h_sumErrorBperLS2->Write(); - h_sum0ErrorBperLS2->Write(); - h_2D0sumErrorBLS2->Write(); - h_2DsumErrorBLS2->Write(); - - h_sumErrorBLS3->Write(); - h_sumErrorBperLS3->Write(); - h_sum0ErrorBperLS3->Write(); - h_2D0sumErrorBLS3->Write(); - h_2DsumErrorBLS3->Write(); - h_sumErrorBLS4->Write(); - h_sumErrorBperLS4->Write(); - h_sum0ErrorBperLS4->Write(); - h_2D0sumErrorBLS4->Write(); - h_2DsumErrorBLS4->Write(); - h_sumErrorBLS5->Write(); - h_sumErrorBperLS5->Write(); - h_sum0ErrorBperLS5->Write(); - h_2D0sumErrorBLS5->Write(); - h_2DsumErrorBLS5->Write(); - - h_sumErrorBLS6->Write(); - h_sumErrorBperLS6->Write(); - h_sum0ErrorBperLS6->Write(); - h_2D0sumErrorBLS6->Write(); - h_2DsumErrorBLS6->Write(); - h_sumErrorBLS7->Write(); - h_sumErrorBperLS7->Write(); - h_sum0ErrorBperLS7->Write(); - h_2D0sumErrorBLS7->Write(); - h_2DsumErrorBLS7->Write(); - - h_sumErrorBLS8->Write(); - h_sumErrorBperLS8->Write(); - h_sum0ErrorBperLS8->Write(); - h_2D0sumErrorBLS8->Write(); - h_2DsumErrorBLS8->Write(); - - // for estimator5: - h_sumAmplLS1->Write(); - h_2DsumAmplLS1->Write(); - h_sumAmplperLS1->Write(); - h_sumAmplperLS1_LSselected->Write(); - h_sumCutAmplperLS1->Write(); - h_2D0sumAmplLS1->Write(); - h_sum0AmplperLS1->Write(); - - h_sumAmplLS2->Write(); - h_2DsumAmplLS2->Write(); - h_sumAmplperLS2->Write(); - h_sumCutAmplperLS2->Write(); - h_2D0sumAmplLS2->Write(); - h_sum0AmplperLS2->Write(); - - h_sumAmplLS3->Write(); - h_2DsumAmplLS3->Write(); - h_sumAmplperLS3->Write(); - h_sumCutAmplperLS3->Write(); - h_2D0sumAmplLS3->Write(); - h_sum0AmplperLS3->Write(); - - h_sumAmplLS4->Write(); - h_2DsumAmplLS4->Write(); - h_sumAmplperLS4->Write(); - h_sumCutAmplperLS4->Write(); - h_2D0sumAmplLS4->Write(); - h_sum0AmplperLS4->Write(); - - h_sumAmplLS5->Write(); - h_2DsumAmplLS5->Write(); - h_sumAmplperLS5->Write(); - h_sumCutAmplperLS5->Write(); - h_2D0sumAmplLS5->Write(); - h_sum0AmplperLS5->Write(); - - h_sumAmplLS6->Write(); - h_2DsumAmplLS6->Write(); - h_sumAmplperLS6->Write(); - h_sumCutAmplperLS6->Write(); - h_2D0sumAmplLS6->Write(); - h_sum0AmplperLS6->Write(); - - h_RatioOccupancy_HBP->Write(); - h_RatioOccupancy_HBM->Write(); - h_RatioOccupancy_HEP->Write(); - h_RatioOccupancy_HEM->Write(); - h_RatioOccupancy_HOP->Write(); - h_RatioOccupancy_HOM->Write(); - h_RatioOccupancy_HFP->Write(); - h_RatioOccupancy_HFM->Write(); - - h_sumAmplLS7->Write(); - h_2DsumAmplLS7->Write(); - h_sumAmplperLS7->Write(); - h_sumCutAmplperLS7->Write(); - h_2D0sumAmplLS7->Write(); - h_sum0AmplperLS7->Write(); - - h_sumAmplLS8->Write(); - h_2DsumAmplLS8->Write(); - h_sumAmplperLS8->Write(); - h_sumCutAmplperLS8->Write(); - h_2D0sumAmplLS8->Write(); - h_sum0AmplperLS8->Write(); - - h_pedestal0_HB->Write(); - h_pedestal1_HB->Write(); - h_pedestal2_HB->Write(); - h_pedestal3_HB->Write(); - h_pedestalaver4_HB->Write(); - h_pedestalaver9_HB->Write(); - h_pedestalw0_HB->Write(); - h_pedestalw1_HB->Write(); - h_pedestalw2_HB->Write(); - h_pedestalw3_HB->Write(); - h_pedestalwaver4_HB->Write(); - h_pedestalwaver9_HB->Write(); - - h_pedestal0_HE->Write(); - h_pedestal1_HE->Write(); - h_pedestal2_HE->Write(); - h_pedestal3_HE->Write(); - h_pedestalaver4_HE->Write(); - h_pedestalaver9_HE->Write(); - h_pedestalw0_HE->Write(); - h_pedestalw1_HE->Write(); - h_pedestalw2_HE->Write(); - h_pedestalw3_HE->Write(); - h_pedestalwaver4_HE->Write(); - h_pedestalwaver9_HE->Write(); - - h_pedestal0_HF->Write(); - h_pedestal1_HF->Write(); - h_pedestal2_HF->Write(); - h_pedestal3_HF->Write(); - h_pedestalaver4_HF->Write(); - h_pedestalaver9_HF->Write(); - h_pedestalw0_HF->Write(); - h_pedestalw1_HF->Write(); - h_pedestalw2_HF->Write(); - h_pedestalw3_HF->Write(); - h_pedestalwaver4_HF->Write(); - h_pedestalwaver9_HF->Write(); - - h_pedestal0_HO->Write(); - h_pedestal1_HO->Write(); - h_pedestal2_HO->Write(); - h_pedestal3_HO->Write(); - h_pedestalaver4_HO->Write(); - h_pedestalaver9_HO->Write(); - h_pedestalw0_HO->Write(); - h_pedestalw1_HO->Write(); - h_pedestalw2_HO->Write(); - h_pedestalw3_HO->Write(); - h_pedestalwaver4_HO->Write(); - h_pedestalwaver9_HO->Write(); - - h_mapDepth1pedestalw_HB->Write(); - h_mapDepth2pedestalw_HB->Write(); - h_mapDepth3pedestalw_HB->Write(); - h_mapDepth4pedestalw_HB->Write(); - h_mapDepth1pedestalw_HE->Write(); - h_mapDepth2pedestalw_HE->Write(); - h_mapDepth3pedestalw_HE->Write(); - h_mapDepth4pedestalw_HE->Write(); - h_mapDepth5pedestalw_HE->Write(); - h_mapDepth6pedestalw_HE->Write(); - h_mapDepth7pedestalw_HE->Write(); - h_mapDepth1pedestalw_HF->Write(); - h_mapDepth2pedestalw_HF->Write(); - h_mapDepth3pedestalw_HF->Write(); - h_mapDepth4pedestalw_HF->Write(); - h_mapDepth4pedestalw_HO->Write(); - - h_mapDepth1pedestal_HB->Write(); - h_mapDepth2pedestal_HB->Write(); - h_mapDepth3pedestal_HB->Write(); - h_mapDepth4pedestal_HB->Write(); - h_mapDepth1pedestal_HE->Write(); - h_mapDepth2pedestal_HE->Write(); - h_mapDepth3pedestal_HE->Write(); - h_mapDepth4pedestal_HE->Write(); - h_mapDepth5pedestal_HE->Write(); - h_mapDepth6pedestal_HE->Write(); - h_mapDepth7pedestal_HE->Write(); - h_mapDepth1pedestal_HF->Write(); - h_mapDepth2pedestal_HF->Write(); - h_mapDepth3pedestal_HF->Write(); - h_mapDepth4pedestal_HF->Write(); - h_mapDepth4pedestal_HO->Write(); - - h_pedestal00_HB->Write(); - h_gain_HB->Write(); - h_respcorr_HB->Write(); - h_timecorr_HB->Write(); - h_lutcorr_HB->Write(); - h_difpedestal0_HB->Write(); - h_difpedestal1_HB->Write(); - h_difpedestal2_HB->Write(); - h_difpedestal3_HB->Write(); - - h_pedestal00_HE->Write(); - h_gain_HE->Write(); - h_respcorr_HE->Write(); - h_timecorr_HE->Write(); - h_lutcorr_HE->Write(); - - h_pedestal00_HF->Write(); - h_gain_HF->Write(); - h_respcorr_HF->Write(); - h_timecorr_HF->Write(); - h_lutcorr_HF->Write(); - - h_pedestal00_HO->Write(); - h_gain_HO->Write(); - h_respcorr_HO->Write(); - h_timecorr_HO->Write(); - h_lutcorr_HO->Write(); - - h2_pedvsampl_HB->Write(); - h2_pedwvsampl_HB->Write(); - h_pedvsampl_HB->Write(); - h_pedwvsampl_HB->Write(); - h_pedvsampl0_HB->Write(); - h_pedwvsampl0_HB->Write(); - h2_amplvsped_HB->Write(); - h2_amplvspedw_HB->Write(); - h_amplvsped_HB->Write(); - h_amplvspedw_HB->Write(); - h_amplvsped0_HB->Write(); - - h2_pedvsampl_HE->Write(); - h2_pedwvsampl_HE->Write(); - h_pedvsampl_HE->Write(); - h_pedwvsampl_HE->Write(); - h_pedvsampl0_HE->Write(); - h_pedwvsampl0_HE->Write(); - h2_pedvsampl_HF->Write(); - h2_pedwvsampl_HF->Write(); - h_pedvsampl_HF->Write(); - h_pedwvsampl_HF->Write(); - h_pedvsampl0_HF->Write(); - h_pedwvsampl0_HF->Write(); - h2_pedvsampl_HO->Write(); - h2_pedwvsampl_HO->Write(); - h_pedvsampl_HO->Write(); - h_pedwvsampl_HO->Write(); - h_pedvsampl0_HO->Write(); - h_pedwvsampl0_HO->Write(); - - h_mapDepth1Ped0_HB->Write(); - h_mapDepth1Ped1_HB->Write(); - h_mapDepth1Ped2_HB->Write(); - h_mapDepth1Ped3_HB->Write(); - h_mapDepth1Pedw0_HB->Write(); - h_mapDepth1Pedw1_HB->Write(); - h_mapDepth1Pedw2_HB->Write(); - h_mapDepth1Pedw3_HB->Write(); - h_mapDepth2Ped0_HB->Write(); - h_mapDepth2Ped1_HB->Write(); - h_mapDepth2Ped2_HB->Write(); - h_mapDepth2Ped3_HB->Write(); - h_mapDepth2Pedw0_HB->Write(); - h_mapDepth2Pedw1_HB->Write(); - h_mapDepth2Pedw2_HB->Write(); - h_mapDepth2Pedw3_HB->Write(); - - h_mapDepth1Ped0_HE->Write(); - h_mapDepth1Ped1_HE->Write(); - h_mapDepth1Ped2_HE->Write(); - h_mapDepth1Ped3_HE->Write(); - h_mapDepth1Pedw0_HE->Write(); - h_mapDepth1Pedw1_HE->Write(); - h_mapDepth1Pedw2_HE->Write(); - h_mapDepth1Pedw3_HE->Write(); - h_mapDepth2Ped0_HE->Write(); - h_mapDepth2Ped1_HE->Write(); - h_mapDepth2Ped2_HE->Write(); - h_mapDepth2Ped3_HE->Write(); - h_mapDepth2Pedw0_HE->Write(); - h_mapDepth2Pedw1_HE->Write(); - h_mapDepth2Pedw2_HE->Write(); - h_mapDepth2Pedw3_HE->Write(); - h_mapDepth3Ped0_HE->Write(); - h_mapDepth3Ped1_HE->Write(); - h_mapDepth3Ped2_HE->Write(); - h_mapDepth3Ped3_HE->Write(); - h_mapDepth3Pedw0_HE->Write(); - h_mapDepth3Pedw1_HE->Write(); - h_mapDepth3Pedw2_HE->Write(); - h_mapDepth3Pedw3_HE->Write(); - - h_mapDepth1Ped0_HF->Write(); - h_mapDepth1Ped1_HF->Write(); - h_mapDepth1Ped2_HF->Write(); - h_mapDepth1Ped3_HF->Write(); - h_mapDepth1Pedw0_HF->Write(); - h_mapDepth1Pedw1_HF->Write(); - h_mapDepth1Pedw2_HF->Write(); - h_mapDepth1Pedw3_HF->Write(); - h_mapDepth2Ped0_HF->Write(); - h_mapDepth2Ped1_HF->Write(); - h_mapDepth2Ped2_HF->Write(); - h_mapDepth2Ped3_HF->Write(); - h_mapDepth2Pedw0_HF->Write(); - h_mapDepth2Pedw1_HF->Write(); - h_mapDepth2Pedw2_HF->Write(); - h_mapDepth2Pedw3_HF->Write(); - - h_mapDepth4Ped0_HO->Write(); - h_mapDepth4Ped1_HO->Write(); - h_mapDepth4Ped2_HO->Write(); - h_mapDepth4Ped3_HO->Write(); - h_mapDepth4Pedw0_HO->Write(); - h_mapDepth4Pedw1_HO->Write(); - h_mapDepth4Pedw2_HO->Write(); - h_mapDepth4Pedw3_HO->Write(); - - h_mapGetRMSOverNormalizedSignal_HB->Write(); - h_mapGetRMSOverNormalizedSignal0_HB->Write(); - h_mapGetRMSOverNormalizedSignal_HE->Write(); - h_mapGetRMSOverNormalizedSignal0_HE->Write(); - h_mapGetRMSOverNormalizedSignal_HF->Write(); - h_mapGetRMSOverNormalizedSignal0_HF->Write(); - h_mapGetRMSOverNormalizedSignal_HO->Write(); - h_mapGetRMSOverNormalizedSignal0_HO->Write(); - - h_shape_Ahigh_HB0->Write(); - h_shape0_Ahigh_HB0->Write(); - h_shape_Alow_HB0->Write(); - h_shape0_Alow_HB0->Write(); - h_shape_Ahigh_HB1->Write(); - h_shape0_Ahigh_HB1->Write(); - h_shape_Alow_HB1->Write(); - h_shape0_Alow_HB1->Write(); - h_shape_Ahigh_HB2->Write(); - h_shape0_Ahigh_HB2->Write(); - h_shape_Alow_HB2->Write(); - h_shape0_Alow_HB2->Write(); - h_shape_Ahigh_HB3->Write(); - h_shape0_Ahigh_HB3->Write(); - h_shape_Alow_HB3->Write(); - h_shape0_Alow_HB3->Write(); - - h_shape_bad_channels_HB->Write(); - h_shape0_bad_channels_HB->Write(); - h_shape_good_channels_HB->Write(); - h_shape0_good_channels_HB->Write(); - h_shape_bad_channels_HE->Write(); - h_shape0_bad_channels_HE->Write(); - h_shape_good_channels_HE->Write(); - h_shape0_good_channels_HE->Write(); - h_shape_bad_channels_HF->Write(); - h_shape0_bad_channels_HF->Write(); - h_shape_good_channels_HF->Write(); - h_shape0_good_channels_HF->Write(); - h_shape_bad_channels_HO->Write(); - h_shape0_bad_channels_HO->Write(); - h_shape_good_channels_HO->Write(); - h_shape0_good_channels_HO->Write(); - - h_sumamplitude_depth1_HB->Write(); - h_sumamplitude_depth2_HB->Write(); - h_sumamplitude_depth1_HE->Write(); - h_sumamplitude_depth2_HE->Write(); - h_sumamplitude_depth3_HE->Write(); - h_sumamplitude_depth1_HF->Write(); - h_sumamplitude_depth2_HF->Write(); - h_sumamplitude_depth4_HO->Write(); - - h_sumamplitude_depth1_HB0->Write(); - h_sumamplitude_depth2_HB0->Write(); - h_sumamplitude_depth1_HE0->Write(); - h_sumamplitude_depth2_HE0->Write(); - h_sumamplitude_depth3_HE0->Write(); - h_sumamplitude_depth1_HF0->Write(); - h_sumamplitude_depth2_HF0->Write(); - h_sumamplitude_depth4_HO0->Write(); - - h_sumamplitude_depth1_HB1->Write(); - h_sumamplitude_depth2_HB1->Write(); - h_sumamplitude_depth1_HE1->Write(); - h_sumamplitude_depth2_HE1->Write(); - h_sumamplitude_depth3_HE1->Write(); - h_sumamplitude_depth1_HF1->Write(); - h_sumamplitude_depth2_HF1->Write(); - h_sumamplitude_depth4_HO1->Write(); - h_bcnnbadchannels_depth1_HB->Write(); - h_bcnnbadchannels_depth2_HB->Write(); - h_bcnnbadchannels_depth1_HE->Write(); - h_bcnnbadchannels_depth2_HE->Write(); - h_bcnnbadchannels_depth3_HE->Write(); - h_bcnnbadchannels_depth4_HO->Write(); - h_bcnnbadchannels_depth1_HF->Write(); - h_bcnnbadchannels_depth2_HF->Write(); - h_bcnbadrate0_depth1_HB->Write(); - h_bcnbadrate0_depth2_HB->Write(); - h_bcnbadrate0_depth1_HE->Write(); - h_bcnbadrate0_depth2_HE->Write(); - h_bcnbadrate0_depth3_HE->Write(); - h_bcnbadrate0_depth4_HO->Write(); - h_bcnbadrate0_depth1_HF->Write(); - h_bcnbadrate0_depth2_HF->Write(); - - h_Amplitude_forCapIdErrors_HB1->Write(); - h_Amplitude_forCapIdErrors_HB2->Write(); - h_Amplitude_forCapIdErrors_HE1->Write(); - h_Amplitude_forCapIdErrors_HE2->Write(); - h_Amplitude_forCapIdErrors_HE3->Write(); - h_Amplitude_forCapIdErrors_HF1->Write(); - h_Amplitude_forCapIdErrors_HF2->Write(); - h_Amplitude_forCapIdErrors_HO4->Write(); - - h_Amplitude_notCapIdErrors_HB1->Write(); - h_Amplitude_notCapIdErrors_HB2->Write(); - h_Amplitude_notCapIdErrors_HE1->Write(); - h_Amplitude_notCapIdErrors_HE2->Write(); - h_Amplitude_notCapIdErrors_HE3->Write(); - h_Amplitude_notCapIdErrors_HF1->Write(); - h_Amplitude_notCapIdErrors_HF2->Write(); - h_Amplitude_notCapIdErrors_HO4->Write(); - - h_averSIGNALoccupancy_HB->Write(); - h_averSIGNALoccupancy_HE->Write(); - h_averSIGNALoccupancy_HF->Write(); - h_averSIGNALoccupancy_HO->Write(); - - h_averSIGNALsumamplitude_HB->Write(); - h_averSIGNALsumamplitude_HE->Write(); - h_averSIGNALsumamplitude_HF->Write(); - h_averSIGNALsumamplitude_HO->Write(); - - h_averNOSIGNALoccupancy_HB->Write(); - h_averNOSIGNALoccupancy_HE->Write(); - h_averNOSIGNALoccupancy_HF->Write(); - h_averNOSIGNALoccupancy_HO->Write(); - - h_averNOSIGNALsumamplitude_HB->Write(); - h_averNOSIGNALsumamplitude_HE->Write(); - h_averNOSIGNALsumamplitude_HF->Write(); - h_averNOSIGNALsumamplitude_HO->Write(); - - h_maxxSUMAmpl_HB->Write(); - h_maxxSUMAmpl_HE->Write(); - h_maxxSUMAmpl_HF->Write(); - h_maxxSUMAmpl_HO->Write(); - - h_maxxOCCUP_HB->Write(); - h_maxxOCCUP_HE->Write(); - h_maxxOCCUP_HF->Write(); - h_maxxOCCUP_HO->Write(); - - h_sumamplitudechannel_HB->Write(); - h_sumamplitudechannel_HE->Write(); - h_sumamplitudechannel_HF->Write(); - h_sumamplitudechannel_HO->Write(); - - h_eventamplitude_HB->Write(); - h_eventamplitude_HE->Write(); - h_eventamplitude_HF->Write(); - h_eventamplitude_HO->Write(); - - h_eventoccupancy_HB->Write(); - h_eventoccupancy_HE->Write(); - h_eventoccupancy_HF->Write(); - h_eventoccupancy_HO->Write(); - - h_2DAtaildepth1_HB->Write(); - h_2D0Ataildepth1_HB->Write(); - h_2DAtaildepth2_HB->Write(); - h_2D0Ataildepth2_HB->Write(); - - h_mapenophinorm_HE1->Write(); - h_mapenophinorm_HE2->Write(); - h_mapenophinorm_HE3->Write(); - h_mapenophinorm_HE4->Write(); - h_mapenophinorm_HE5->Write(); - h_mapenophinorm_HE6->Write(); - h_mapenophinorm_HE7->Write(); - h_mapenophinorm2_HE1->Write(); - h_mapenophinorm2_HE2->Write(); - h_mapenophinorm2_HE3->Write(); - h_mapenophinorm2_HE4->Write(); - h_mapenophinorm2_HE5->Write(); - h_mapenophinorm2_HE6->Write(); - h_mapenophinorm2_HE7->Write(); - - h_maprphinorm_HE1->Write(); - h_maprphinorm_HE2->Write(); - h_maprphinorm_HE3->Write(); - h_maprphinorm_HE4->Write(); - h_maprphinorm_HE5->Write(); - h_maprphinorm_HE6->Write(); - h_maprphinorm_HE7->Write(); - h_maprphinorm2_HE1->Write(); - h_maprphinorm2_HE2->Write(); - h_maprphinorm2_HE3->Write(); - h_maprphinorm2_HE4->Write(); - h_maprphinorm2_HE5->Write(); - h_maprphinorm2_HE6->Write(); - h_maprphinorm2_HE7->Write(); - - h_maprphinorm0_HE1->Write(); - h_maprphinorm0_HE2->Write(); - h_maprphinorm0_HE3->Write(); - h_maprphinorm0_HE4->Write(); - h_maprphinorm0_HE5->Write(); - h_maprphinorm0_HE6->Write(); - h_maprphinorm0_HE7->Write(); - - //// phi-symmetry phy-symmetry: - h_energyhitSignal_HB->Write(); - h_energyhitSignal_HE->Write(); - h_energyhitSignal_HF->Write(); - h_energyhitNoise_HB->Write(); - h_energyhitNoise_HE->Write(); - h_energyhitNoise_HF->Write(); - //HB - h_recSignalEnergy0_HB1->Write(); - h_recSignalEnergy1_HB1->Write(); - h_recSignalEnergy2_HB1->Write(); - h_recSignalEnergy0_HB2->Write(); - h_recSignalEnergy1_HB2->Write(); - h_recSignalEnergy2_HB2->Write(); - h_recSignalEnergy0_HB3->Write(); - h_recSignalEnergy1_HB3->Write(); - h_recSignalEnergy2_HB3->Write(); - h_recSignalEnergy0_HB4->Write(); - h_recSignalEnergy1_HB4->Write(); - h_recSignalEnergy2_HB4->Write(); - - h_recNoiseEnergy0_HB1->Write(); - h_recNoiseEnergy1_HB1->Write(); - h_recNoiseEnergy2_HB1->Write(); - h_recNoiseEnergy0_HB2->Write(); - h_recNoiseEnergy1_HB2->Write(); - h_recNoiseEnergy2_HB2->Write(); - h_recNoiseEnergy0_HB3->Write(); - h_recNoiseEnergy1_HB3->Write(); - h_recNoiseEnergy2_HB3->Write(); - h_recNoiseEnergy0_HB4->Write(); - h_recNoiseEnergy1_HB4->Write(); - h_recNoiseEnergy2_HB4->Write(); - - //HE - h_recSignalEnergy0_HE1->Write(); - h_recSignalEnergy1_HE1->Write(); - h_recSignalEnergy2_HE1->Write(); - h_recSignalEnergy0_HE2->Write(); - h_recSignalEnergy1_HE2->Write(); - h_recSignalEnergy2_HE2->Write(); - h_recSignalEnergy0_HE3->Write(); - h_recSignalEnergy1_HE3->Write(); - h_recSignalEnergy2_HE3->Write(); - h_recSignalEnergy0_HE4->Write(); - h_recSignalEnergy1_HE4->Write(); - h_recSignalEnergy2_HE4->Write(); - h_recSignalEnergy0_HE5->Write(); - h_recSignalEnergy1_HE5->Write(); - h_recSignalEnergy2_HE5->Write(); - h_recSignalEnergy0_HE6->Write(); - h_recSignalEnergy1_HE6->Write(); - h_recSignalEnergy2_HE6->Write(); - h_recSignalEnergy0_HE7->Write(); - h_recSignalEnergy1_HE7->Write(); - h_recSignalEnergy2_HE7->Write(); - - h_recNoiseEnergy0_HE1->Write(); - h_recNoiseEnergy1_HE1->Write(); - h_recNoiseEnergy2_HE1->Write(); - h_recNoiseEnergy0_HE2->Write(); - h_recNoiseEnergy1_HE2->Write(); - h_recNoiseEnergy2_HE2->Write(); - h_recNoiseEnergy0_HE3->Write(); - h_recNoiseEnergy1_HE3->Write(); - h_recNoiseEnergy2_HE3->Write(); - h_recNoiseEnergy0_HE4->Write(); - h_recNoiseEnergy1_HE4->Write(); - h_recNoiseEnergy2_HE4->Write(); - h_recNoiseEnergy0_HE5->Write(); - h_recNoiseEnergy1_HE5->Write(); - h_recNoiseEnergy2_HE5->Write(); - h_recNoiseEnergy0_HE6->Write(); - h_recNoiseEnergy1_HE6->Write(); - h_recNoiseEnergy2_HE6->Write(); - h_recNoiseEnergy0_HE7->Write(); - h_recNoiseEnergy1_HE7->Write(); - h_recNoiseEnergy2_HE7->Write(); - - //HF - h_recSignalEnergy0_HF1->Write(); - h_recSignalEnergy1_HF1->Write(); - h_recSignalEnergy2_HF1->Write(); - h_recSignalEnergy0_HF2->Write(); - h_recSignalEnergy1_HF2->Write(); - h_recSignalEnergy2_HF2->Write(); - - h_recNoiseEnergy0_HF1->Write(); - h_recNoiseEnergy1_HF1->Write(); - h_recNoiseEnergy2_HF1->Write(); - h_recNoiseEnergy0_HF2->Write(); - h_recNoiseEnergy1_HF2->Write(); - h_recNoiseEnergy2_HF2->Write(); - - // Digi as Reco: - //HB: - h_amplitudechannel0_HB1->Write(); - h_amplitudechannel1_HB1->Write(); - h_amplitudechannel2_HB1->Write(); - h_amplitudechannel0_HB2->Write(); - h_amplitudechannel1_HB2->Write(); - h_amplitudechannel2_HB2->Write(); - h_amplitudechannel0_HB3->Write(); - h_amplitudechannel1_HB3->Write(); - h_amplitudechannel2_HB3->Write(); - h_amplitudechannel0_HB4->Write(); - h_amplitudechannel1_HB4->Write(); - h_amplitudechannel2_HB4->Write(); - - h_amplitudechannel0_HE1->Write(); - h_amplitudechannel1_HE1->Write(); - h_amplitudechannel2_HE1->Write(); - h_amplitudechannel0_HE2->Write(); - h_amplitudechannel1_HE2->Write(); - h_amplitudechannel2_HE2->Write(); - h_amplitudechannel0_HE3->Write(); - h_amplitudechannel1_HE3->Write(); - h_amplitudechannel2_HE3->Write(); - h_amplitudechannel0_HE4->Write(); - h_amplitudechannel1_HE4->Write(); - h_amplitudechannel2_HE4->Write(); - h_amplitudechannel0_HE5->Write(); - h_amplitudechannel1_HE5->Write(); - h_amplitudechannel2_HE5->Write(); - h_amplitudechannel0_HE6->Write(); - h_amplitudechannel1_HE6->Write(); - h_amplitudechannel2_HE6->Write(); - h_amplitudechannel0_HE7->Write(); - h_amplitudechannel1_HE7->Write(); - h_amplitudechannel2_HE7->Write(); - - h_amplitudechannel0_HF1->Write(); - h_amplitudechannel1_HF1->Write(); - h_amplitudechannel2_HF1->Write(); - h_amplitudechannel0_HF2->Write(); - h_amplitudechannel1_HF2->Write(); - h_amplitudechannel2_HF2->Write(); - h_amplitudechannel0_HF3->Write(); - h_amplitudechannel1_HF3->Write(); - h_amplitudechannel2_HF3->Write(); - h_amplitudechannel0_HF4->Write(); - h_amplitudechannel1_HF4->Write(); - h_amplitudechannel2_HF4->Write(); - - // RADDAM: - h_mapDepth1RADDAM_HE->Write(); - h_mapDepth2RADDAM_HE->Write(); - h_mapDepth3RADDAM_HE->Write(); - h_mapDepth1RADDAM0_HE->Write(); - h_mapDepth2RADDAM0_HE->Write(); - h_mapDepth3RADDAM0_HE->Write(); - h_AamplitudewithPedSubtr_RADDAM_HE->Write(); - h_AamplitudewithPedSubtr_RADDAM_HEzoom0->Write(); - h_AamplitudewithPedSubtr_RADDAM_HEzoom1->Write(); - h_A_Depth1RADDAM_HE->Write(); - h_A_Depth2RADDAM_HE->Write(); - h_A_Depth3RADDAM_HE->Write(); - h_sumphiEta16Depth3RADDAM_HED2->Write(); - h_Eta16Depth3RADDAM_HED2->Write(); - h_NphiForEta16Depth3RADDAM_HED2->Write(); - h_sumphiEta16Depth3RADDAM_HED2P->Write(); - h_Eta16Depth3RADDAM_HED2P->Write(); - h_NphiForEta16Depth3RADDAM_HED2P->Write(); - h_sumphiEta16Depth3RADDAM_HED2ALL->Write(); - h_Eta16Depth3RADDAM_HED2ALL->Write(); - h_NphiForEta16Depth3RADDAM_HED2ALL->Write(); - h_sigLayer1RADDAM_HE->Write(); - h_sigLayer2RADDAM_HE->Write(); - h_sigLayer1RADDAM0_HE->Write(); - h_sigLayer2RADDAM0_HE->Write(); - h_sigLayer1RADDAM5_HE->Write(); - h_sigLayer2RADDAM5_HE->Write(); - h_sigLayer1RADDAM6_HE->Write(); - h_sigLayer2RADDAM6_HE->Write(); - h_sigLayer1RADDAM5_HED2->Write(); - h_sigLayer1RADDAM6_HED2->Write(); - h_sigLayer2RADDAM5_HED2->Write(); - h_sigLayer2RADDAM6_HED2->Write(); - h_mapDepth3RADDAM16_HE->Write(); - - h_amplitudeaveragedbydepthes_HE->Write(); - h_ndepthesperamplitudebins_HE->Write(); - /////////////////////// - } //if - /////////////////////// - hOutputFile->Close(); - std::cout << "===== Finish writing user histograms and ntuple =====" << std::endl; - /////////////////////// } // // // -CMTRawAnalyzer::CMTRawAnalyzer(const edm::ParameterSet& iConfig) { +CMTRawAnalyzer::CMTRawAnalyzer(const edm::ParameterSet& iConfig) + : tokDB_(esConsumes()), + tokTopo_(edm::ESGetToken()) { + usesResource(TFileService::kSharedResource); verbosity = iConfig.getUntrackedParameter("Verbosity"); MAPcreation = iConfig.getUntrackedParameter("MapCreation"); recordNtuples_ = iConfig.getUntrackedParameter("recordNtuples"); @@ -3956,10 +2661,9 @@ CMTRawAnalyzer::CMTRawAnalyzer(const edm::ParameterSet& iConfig) { } CMTRawAnalyzer::~CMTRawAnalyzer() {} void CMTRawAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { - iSetup.get().get(conditions); - iSetup.get().get(topo_); + conditions = &iSetup.getData(tokDB_); + topo = &iSetup.getData(tokTopo_); if (MAPcreation > 0) { - topo = &*topo_; if (flagupgradeqie1011_ == 1) fillMAP(); MAPcreation = 0; @@ -3981,18 +2685,19 @@ void CMTRawAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iS ++runcounter; if (runcounter != 1) { nevcounter00 = eventcounter; - cout << " --------------------------------------- " << endl; - cout << " for Run = " << run0 << " with runcounter = " << runcounter - 1 << " #ev = " << eventcounter << endl; - cout << " #LS = " << lscounterrun << " #LS10 = " << lscounterrun10 << " Last LS = " << ls0 << endl; - cout << " --------------------------------------------- " << endl; + std::cout << " --------------------------------------- " << std::endl; + std::cout << " for Run = " << run0 << " with runcounter = " << runcounter - 1 << " #ev = " << eventcounter + << std::endl; + std::cout << " #LS = " << lscounterrun << " #LS10 = " << lscounterrun10 << " Last LS = " << ls0 << std::endl; + std::cout << " --------------------------------------------- " << std::endl; h_nls_per_run->Fill(float(lscounterrun)); h_nls_per_run10->Fill(float(lscounterrun10)); lscounterrun = 0; lscounterrun10 = 0; } // runcounter > 1 - cout << " ---------***********************------------- " << endl; - cout << " New Run = " << Run << " runcounter = " << runcounter << endl; - cout << " ------- " << endl; + std::cout << " ---------***********************------------- " << std::endl; + std::cout << " New Run = " << Run << " runcounter = " << runcounter << std::endl; + std::cout << " ------- " << std::endl; run0 = Run; eventcounter = 0; ls0 = -1; @@ -5463,7 +4168,8 @@ void CMTRawAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iS gotHFDigis = false; } //if it is not there, leave it false if (!gotHFDigis) { - cout << " ****************************** =========================== No HFDigiCollection found " << endl; + std::cout << " ****************************** =========================== No HFDigiCollection found " + << std::endl; } else { //////////////////////////////////////////////////////////////////// qie8 QIE8 : for (HFDigiCollection::const_iterator digi = hf->begin(); digi != hf->end(); digi++) { @@ -5513,7 +4219,7 @@ void CMTRawAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iS gotQIE10Digis = false; } //if it is not there, leave it false if (!gotQIE10Digis) { - cout << " No QIE10DigiCollection collection is found " << endl; + std::cout << " No QIE10DigiCollection collection is found " << std::endl; } else { //////////////////////////////////////////////////////////////////// qie10 QIE10 : double totalAmplitudeHF = 0.; @@ -5584,7 +4290,7 @@ void CMTRawAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iS if (!(hbhe.isValid())) gotHBHEDigis = false; //if it is not there, leave it false if (!gotHBHEDigis) { - cout << " No HBHEDigiCollection collection is found " << endl; + std::cout << " No HBHEDigiCollection collection is found " << std::endl; } else { // unsigned int NHBHEDigiCollectionsize = hbhe->size(); double totalAmplitudeHB = 0.; @@ -5694,7 +4400,7 @@ void CMTRawAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iS if (!(heqie11.isValid())) gotQIE11Digis = false; //if it is not there, leave it false if (!gotQIE11Digis) { - cout << " No QIE11DigiCollection collection is found " << endl; + std::cout << " No QIE11DigiCollection collection is found " << std::endl; } else { //////////////////////////////////////////////////////////////////// qie11 QIE11 : double totalAmplitudeHBQIE11 = 0.; @@ -5818,7 +4524,7 @@ void CMTRawAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iS gotHODigis = false; //if it is not there, leave it false if (!gotHODigis) { // if(!ho.isValid()) { - cout << " No HO collection is found " << endl; + std::cout << " No HO collection is found " << std::endl; } else { int qwert6 = 0; double totalAmplitudeHO = 0.; @@ -5891,7 +4597,7 @@ void CMTRawAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iS gotHBHERecHitsNoise = false; //if it is not there, leave it false if (!gotHBHERecHitsNoise) { // if(!hbheNoise.isValid()) { - std::cout << " No RecHits HBHENoise collection is found " << endl; + std::cout << " No RecHits HBHENoise collection is found " << std::endl; } else { for (HBHERecHitCollection::const_iterator hbheItr = hbheNoise->begin(); hbheItr != hbheNoise->end(); hbheItr++) { @@ -5950,7 +4656,7 @@ void CMTRawAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iS gotHFRecHitsNoise = false; //if it is not there, leave it false if (!gotHFRecHitsNoise) { // if(!hfNoise.isValid()) { - std::cout << " No RecHits HFNoise collection is found " << endl; + std::cout << " No RecHits HFNoise collection is found " << std::endl; } else { for (HFRecHitCollection::const_iterator hfItr = hfNoise->begin(); hfItr != hfNoise->end(); hfItr++) { // Recalibration of energy @@ -6004,7 +4710,7 @@ void CMTRawAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iS gotHBHERecHitsSignal = false; //if it is not there, leave it false if (!gotHBHERecHitsSignal) { // if(!hbheSignal.isValid()) { - std::cout << " No RecHits HBHESignal collection is found " << endl; + std::cout << " No RecHits HBHESignal collection is found " << std::endl; } else { for (HBHERecHitCollection::const_iterator hbheItr = hbheSignal->begin(); hbheItr != hbheSignal->end(); hbheItr++) { @@ -6062,7 +4768,7 @@ void CMTRawAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iS gotHFRecHitsSignal = false; //if it is not there, leave it false if (!gotHFRecHitsSignal) { // if(!hfSignal.isValid()) { - std::cout << " No RecHits HFSignal collection is found " << endl; + std::cout << " No RecHits HFSignal collection is found " << std::endl; } else { for (HFRecHitCollection::const_iterator hfItr = hfSignal->begin(); hfItr != hfSignal->end(); hfItr++) { // Recalibration of energy @@ -6144,7 +4850,7 @@ void CMTRawAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iS if (verbosity == -9504) std::cout << "nsumoverphi= " << nsumoverphi << " sumoverphi= " << sumoverphi << " k1= " << k1 << " k2= " << k2 << " kkk= " << kkk << " k3= " << k3 - << " maprphinorm= " << maprphinorm[k0][k1][k2][k3] << endl; + << " maprphinorm= " << maprphinorm[k0][k1][k2][k3] << std::endl; if (k1 == 0) { h_mapenophinorm_HE1->Fill(double(kkk), double(k3), tocamplchannel[k0][k1][k2][k3]); h_mapenophinorm2_HE1->Fill( @@ -7360,8 +6066,8 @@ void CMTRawAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iS /////////////////////////////////////////////////// if (++local_event % 100 == 0) { if (verbosity == -22) - cout << "run " << Run << " processing events " << local_event << " ok, " - << ", lumi " << lumi << ", numOfLaserEv " << numOfLaserEv << endl; + std::cout << "run " << Run << " processing events " << local_event << " ok, " + << ", lumi " << lumi << ", numOfLaserEv " << numOfLaserEv << std::endl; } } // bcn @@ -7371,8 +6077,8 @@ void CMTRawAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iS // ------------ method called once each job just before starting event loop ----------- void CMTRawAnalyzer::beginJob() { if (verbosity > 0) - cout << "======================== beignJob START +++++++++++++++++++++++++++" << endl; - hOutputFile = new TFile(fOutputFileName.c_str(), "RECREATE"); + std::cout << "======================== beignJob START +++++++++++++++++++++++++++" << std::endl; + // hOutputFile = new TFile(fOutputFileName.c_str(), "RECREATE"); //////////////////////////////////////////////////////////////////////////////////////////////////////// nnnnnn = 0; nnnnnnhbhe = 0; @@ -7394,532 +6100,543 @@ void CMTRawAnalyzer::beginJob() { ////////////////////////////////////////////////////////////////////////////////// book histoes if (recordHistoes_) { - // ha2 = new TH2F("ha2"," ", neta, -41., 41., nphi, 0., bphi); - - h_errorGeneral = new TH1F("h_errorGeneral", " ", 5, 0., 5.); - h_error1 = new TH1F("h_error1", " ", 5, 0., 5.); - h_error2 = new TH1F("h_error2", " ", 5, 0., 5.); - h_error3 = new TH1F("h_error3", " ", 5, 0., 5.); - h_amplError = new TH1F("h_amplError", " ", 100, -2., 98.); - h_amplFine = new TH1F("h_amplFine", " ", 100, -2., 98.); - - h_errorGeneral_HB = new TH1F("h_errorGeneral_HB", " ", 5, 0., 5.); - h_error1_HB = new TH1F("h_error1_HB", " ", 5, 0., 5.); - h_error2_HB = new TH1F("h_error2_HB", " ", 5, 0., 5.); - h_error3_HB = new TH1F("h_error3_HB", " ", 5, 0., 5.); - h_error4_HB = new TH1F("h_error4_HB", " ", 5, 0., 5.); - h_error5_HB = new TH1F("h_error5_HB", " ", 5, 0., 5.); - h_error6_HB = new TH1F("h_error6_HB", " ", 5, 0., 5.); - h_error7_HB = new TH1F("h_error7_HB", " ", 5, 0., 5.); - h_amplError_HB = new TH1F("h_amplError_HB", " ", 100, -2., 98.); - h_amplFine_HB = new TH1F("h_amplFine_HB", " ", 100, -2., 98.); - h_mapDepth1Error_HB = new TH2F("h_mapDepth1Error_HB", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth2Error_HB = new TH2F("h_mapDepth2Error_HB", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth3Error_HB = new TH2F("h_mapDepth3Error_HB", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth4Error_HB = new TH2F("h_mapDepth4Error_HB", " ", neta, -41., 41., nphi, 0., bphi); - h_fiber0_HB = new TH1F("h_fiber0_HB", " ", 10, 0., 10.); - h_fiber1_HB = new TH1F("h_fiber1_HB", " ", 10, 0., 10.); - h_fiber2_HB = new TH1F("h_fiber2_HB", " ", 40, 0., 40.); - h_repetedcapid_HB = new TH1F("h_repetedcapid_HB", " ", 5, 0., 5.); - - h_errorGeneral_HE = new TH1F("h_errorGeneral_HE", " ", 5, 0., 5.); - h_error1_HE = new TH1F("h_error1_HE", " ", 5, 0., 5.); - h_error2_HE = new TH1F("h_error2_HE", " ", 5, 0., 5.); - h_error3_HE = new TH1F("h_error3_HE", " ", 5, 0., 5.); - h_error4_HE = new TH1F("h_error4_HE", " ", 5, 0., 5.); - h_error5_HE = new TH1F("h_error5_HE", " ", 5, 0., 5.); - h_error6_HE = new TH1F("h_error6_HE", " ", 5, 0., 5.); - h_error7_HE = new TH1F("h_error7_HE", " ", 5, 0., 5.); - h_amplError_HE = new TH1F("h_amplError_HE", " ", 100, -2., 98.); - h_amplFine_HE = new TH1F("h_amplFine_HE", " ", 100, -2., 98.); - h_mapDepth1Error_HE = new TH2F("h_mapDepth1Error_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth2Error_HE = new TH2F("h_mapDepth2Error_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth3Error_HE = new TH2F("h_mapDepth3Error_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth4Error_HE = new TH2F("h_mapDepth4Error_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth5Error_HE = new TH2F("h_mapDepth5Error_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth6Error_HE = new TH2F("h_mapDepth6Error_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth7Error_HE = new TH2F("h_mapDepth7Error_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_fiber0_HE = new TH1F("h_fiber0_HE", " ", 10, 0., 10.); - h_fiber1_HE = new TH1F("h_fiber1_HE", " ", 10, 0., 10.); - h_fiber2_HE = new TH1F("h_fiber2_HE", " ", 40, 0., 40.); - h_repetedcapid_HE = new TH1F("h_repetedcapid_HE", " ", 5, 0., 5.); - - h_errorGeneral_HF = new TH1F("h_errorGeneral_HF", " ", 5, 0., 5.); - h_error1_HF = new TH1F("h_error1_HF", " ", 5, 0., 5.); - h_error2_HF = new TH1F("h_error2_HF", " ", 5, 0., 5.); - h_error3_HF = new TH1F("h_error3_HF", " ", 5, 0., 5.); - h_error4_HF = new TH1F("h_error4_HF", " ", 5, 0., 5.); - h_error5_HF = new TH1F("h_error5_HF", " ", 5, 0., 5.); - h_error6_HF = new TH1F("h_error6_HF", " ", 5, 0., 5.); - h_error7_HF = new TH1F("h_error7_HF", " ", 5, 0., 5.); - h_amplError_HF = new TH1F("h_amplError_HF", " ", 100, -2., 98.); - h_amplFine_HF = new TH1F("h_amplFine_HF", " ", 100, -2., 98.); - h_mapDepth1Error_HF = new TH2F("h_mapDepth1Error_HF", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth2Error_HF = new TH2F("h_mapDepth2Error_HF", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth3Error_HF = new TH2F("h_mapDepth3Error_HF", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth4Error_HF = new TH2F("h_mapDepth4Error_HF", " ", neta, -41., 41., nphi, 0., bphi); - h_fiber0_HF = new TH1F("h_fiber0_HF", " ", 10, 0., 10.); - h_fiber1_HF = new TH1F("h_fiber1_HF", " ", 10, 0., 10.); - h_fiber2_HF = new TH1F("h_fiber2_HF", " ", 40, 0., 40.); - h_repetedcapid_HF = new TH1F("h_repetedcapid_HF", " ", 5, 0., 5.); - - h_errorGeneral_HO = new TH1F("h_errorGeneral_HO", " ", 5, 0., 5.); - h_error1_HO = new TH1F("h_error1_HO", " ", 5, 0., 5.); - h_error2_HO = new TH1F("h_error2_HO", " ", 5, 0., 5.); - h_error3_HO = new TH1F("h_error3_HO", " ", 5, 0., 5.); - h_error4_HO = new TH1F("h_error4_HO", " ", 5, 0., 5.); - h_error5_HO = new TH1F("h_error5_HO", " ", 5, 0., 5.); - h_error6_HO = new TH1F("h_error6_HO", " ", 5, 0., 5.); - h_error7_HO = new TH1F("h_error7_HO", " ", 5, 0., 5.); - h_amplError_HO = new TH1F("h_amplError_HO", " ", 100, -2., 98.); - h_amplFine_HO = new TH1F("h_amplFine_HO", " ", 100, -2., 98.); - h_mapDepth4Error_HO = new TH2F("h_mapDepth4Error_HO", " ", neta, -41., 41., nphi, 0., bphi); - h_fiber0_HO = new TH1F("h_fiber0_HO", " ", 10, 0., 10.); - h_fiber1_HO = new TH1F("h_fiber1_HO", " ", 10, 0., 10.); - h_fiber2_HO = new TH1F("h_fiber2_HO", " ", 40, 0., 40.); - h_repetedcapid_HO = new TH1F("h_repetedcapid_HO", " ", 5, 0., 5.); + // ha2 = fs_->make("ha2"," ", neta, -41., 41., nphi, 0., bphi); + + h_errorGeneral = fs_->make("h_errorGeneral", " ", 5, 0., 5.); + h_error1 = fs_->make("h_error1", " ", 5, 0., 5.); + h_error2 = fs_->make("h_error2", " ", 5, 0., 5.); + h_error3 = fs_->make("h_error3", " ", 5, 0., 5.); + h_amplError = fs_->make("h_amplError", " ", 100, -2., 98.); + h_amplFine = fs_->make("h_amplFine", " ", 100, -2., 98.); + + h_errorGeneral_HB = fs_->make("h_errorGeneral_HB", " ", 5, 0., 5.); + h_error1_HB = fs_->make("h_error1_HB", " ", 5, 0., 5.); + h_error2_HB = fs_->make("h_error2_HB", " ", 5, 0., 5.); + h_error3_HB = fs_->make("h_error3_HB", " ", 5, 0., 5.); + h_error4_HB = fs_->make("h_error4_HB", " ", 5, 0., 5.); + h_error5_HB = fs_->make("h_error5_HB", " ", 5, 0., 5.); + h_error6_HB = fs_->make("h_error6_HB", " ", 5, 0., 5.); + h_error7_HB = fs_->make("h_error7_HB", " ", 5, 0., 5.); + h_amplError_HB = fs_->make("h_amplError_HB", " ", 100, -2., 98.); + h_amplFine_HB = fs_->make("h_amplFine_HB", " ", 100, -2., 98.); + h_mapDepth1Error_HB = fs_->make("h_mapDepth1Error_HB", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth2Error_HB = fs_->make("h_mapDepth2Error_HB", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth3Error_HB = fs_->make("h_mapDepth3Error_HB", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth4Error_HB = fs_->make("h_mapDepth4Error_HB", " ", neta, -41., 41., nphi, 0., bphi); + h_fiber0_HB = fs_->make("h_fiber0_HB", " ", 10, 0., 10.); + h_fiber1_HB = fs_->make("h_fiber1_HB", " ", 10, 0., 10.); + h_fiber2_HB = fs_->make("h_fiber2_HB", " ", 40, 0., 40.); + h_repetedcapid_HB = fs_->make("h_repetedcapid_HB", " ", 5, 0., 5.); + + h_errorGeneral_HE = fs_->make("h_errorGeneral_HE", " ", 5, 0., 5.); + h_error1_HE = fs_->make("h_error1_HE", " ", 5, 0., 5.); + h_error2_HE = fs_->make("h_error2_HE", " ", 5, 0., 5.); + h_error3_HE = fs_->make("h_error3_HE", " ", 5, 0., 5.); + h_error4_HE = fs_->make("h_error4_HE", " ", 5, 0., 5.); + h_error5_HE = fs_->make("h_error5_HE", " ", 5, 0., 5.); + h_error6_HE = fs_->make("h_error6_HE", " ", 5, 0., 5.); + h_error7_HE = fs_->make("h_error7_HE", " ", 5, 0., 5.); + h_amplError_HE = fs_->make("h_amplError_HE", " ", 100, -2., 98.); + h_amplFine_HE = fs_->make("h_amplFine_HE", " ", 100, -2., 98.); + h_mapDepth1Error_HE = fs_->make("h_mapDepth1Error_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth2Error_HE = fs_->make("h_mapDepth2Error_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth3Error_HE = fs_->make("h_mapDepth3Error_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth4Error_HE = fs_->make("h_mapDepth4Error_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth5Error_HE = fs_->make("h_mapDepth5Error_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth6Error_HE = fs_->make("h_mapDepth6Error_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth7Error_HE = fs_->make("h_mapDepth7Error_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_fiber0_HE = fs_->make("h_fiber0_HE", " ", 10, 0., 10.); + h_fiber1_HE = fs_->make("h_fiber1_HE", " ", 10, 0., 10.); + h_fiber2_HE = fs_->make("h_fiber2_HE", " ", 40, 0., 40.); + h_repetedcapid_HE = fs_->make("h_repetedcapid_HE", " ", 5, 0., 5.); + + h_errorGeneral_HF = fs_->make("h_errorGeneral_HF", " ", 5, 0., 5.); + h_error1_HF = fs_->make("h_error1_HF", " ", 5, 0., 5.); + h_error2_HF = fs_->make("h_error2_HF", " ", 5, 0., 5.); + h_error3_HF = fs_->make("h_error3_HF", " ", 5, 0., 5.); + h_error4_HF = fs_->make("h_error4_HF", " ", 5, 0., 5.); + h_error5_HF = fs_->make("h_error5_HF", " ", 5, 0., 5.); + h_error6_HF = fs_->make("h_error6_HF", " ", 5, 0., 5.); + h_error7_HF = fs_->make("h_error7_HF", " ", 5, 0., 5.); + h_amplError_HF = fs_->make("h_amplError_HF", " ", 100, -2., 98.); + h_amplFine_HF = fs_->make("h_amplFine_HF", " ", 100, -2., 98.); + h_mapDepth1Error_HF = fs_->make("h_mapDepth1Error_HF", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth2Error_HF = fs_->make("h_mapDepth2Error_HF", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth3Error_HF = fs_->make("h_mapDepth3Error_HF", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth4Error_HF = fs_->make("h_mapDepth4Error_HF", " ", neta, -41., 41., nphi, 0., bphi); + h_fiber0_HF = fs_->make("h_fiber0_HF", " ", 10, 0., 10.); + h_fiber1_HF = fs_->make("h_fiber1_HF", " ", 10, 0., 10.); + h_fiber2_HF = fs_->make("h_fiber2_HF", " ", 40, 0., 40.); + h_repetedcapid_HF = fs_->make("h_repetedcapid_HF", " ", 5, 0., 5.); + + h_errorGeneral_HO = fs_->make("h_errorGeneral_HO", " ", 5, 0., 5.); + h_error1_HO = fs_->make("h_error1_HO", " ", 5, 0., 5.); + h_error2_HO = fs_->make("h_error2_HO", " ", 5, 0., 5.); + h_error3_HO = fs_->make("h_error3_HO", " ", 5, 0., 5.); + h_error4_HO = fs_->make("h_error4_HO", " ", 5, 0., 5.); + h_error5_HO = fs_->make("h_error5_HO", " ", 5, 0., 5.); + h_error6_HO = fs_->make("h_error6_HO", " ", 5, 0., 5.); + h_error7_HO = fs_->make("h_error7_HO", " ", 5, 0., 5.); + h_amplError_HO = fs_->make("h_amplError_HO", " ", 100, -2., 98.); + h_amplFine_HO = fs_->make("h_amplFine_HO", " ", 100, -2., 98.); + h_mapDepth4Error_HO = fs_->make("h_mapDepth4Error_HO", " ", neta, -41., 41., nphi, 0., bphi); + h_fiber0_HO = fs_->make("h_fiber0_HO", " ", 10, 0., 10.); + h_fiber1_HO = fs_->make("h_fiber1_HO", " ", 10, 0., 10.); + h_fiber2_HO = fs_->make("h_fiber2_HO", " ", 40, 0., 40.); + h_repetedcapid_HO = fs_->make("h_repetedcapid_HO", " ", 5, 0., 5.); ///////////////////////////////////////////////////////////////////////////////////////////////// HB - h_numberofhitsHBtest = new TH1F("h_numberofhitsHBtest", " ", 100, 0., 100.); - h_AmplitudeHBtest = new TH1F("h_AmplitudeHBtest", " ", 100, 0., 10000.); - h_AmplitudeHBtest1 = new TH1F("h_AmplitudeHBtest1", " ", 100, 0., 1000000.); - h_AmplitudeHBtest6 = new TH1F("h_AmplitudeHBtest6", " ", 100, 0., 2000000.); - h_totalAmplitudeHB = new TH1F("h_totalAmplitudeHB", " ", 100, 0., 3000000.); - h_totalAmplitudeHBperEvent = new TH1F("h_totalAmplitudeHBperEvent", " ", 1000, 1., 1001.); + h_numberofhitsHBtest = fs_->make("h_numberofhitsHBtest", " ", 100, 0., 100.); + h_AmplitudeHBtest = fs_->make("h_AmplitudeHBtest", " ", 100, 0., 10000.); + h_AmplitudeHBtest1 = fs_->make("h_AmplitudeHBtest1", " ", 100, 0., 1000000.); + h_AmplitudeHBtest6 = fs_->make("h_AmplitudeHBtest6", " ", 100, 0., 2000000.); + h_totalAmplitudeHB = fs_->make("h_totalAmplitudeHB", " ", 100, 0., 3000000.); + h_totalAmplitudeHBperEvent = fs_->make("h_totalAmplitudeHBperEvent", " ", 1000, 1., 1001.); // fullAmplitude: - h_ADCAmpl345Zoom_HB = new TH1F("h_ADCAmpl345Zoom_HB", " ", 100, 0., 400.); - h_ADCAmpl345Zoom1_HB = new TH1F("h_ADCAmpl345Zoom1_HB", " ", 100, 0., 100.); - h_ADCAmpl345_HB = new TH1F("h_ADCAmpl345_HB", " ", 100, 10., 3000.); - - h_AmplitudeHBrest = new TH1F("h_AmplitudeHBrest", " ", 100, 0., 10000.); - h_AmplitudeHBrest1 = new TH1F("h_AmplitudeHBrest1", " ", 100, 0., 1000000.); - h_AmplitudeHBrest6 = new TH1F("h_AmplitudeHBrest6", " ", 100, 0., 2000000.); - - h_ADCAmpl345_HBCapIdError = new TH1F("h_ADCAmpl345_HBCapIdError", " ", 100, 10., 3000.); - h_ADCAmpl345_HBCapIdNoError = new TH1F("h_ADCAmpl345_HBCapIdNoError", " ", 100, 10., 3000.); - h_ADCAmpl_HBCapIdError = new TH1F("h_ADCAmpl_HBCapIdError", " ", 100, 10., 3000.); - h_ADCAmpl_HBCapIdNoError = new TH1F("h_ADCAmpl_HBCapIdNoError", " ", 100, 10., 3000.); - - h_ADCAmplZoom_HB = new TH1F("h_ADCAmplZoom_HB", " ", 100, 0., 400.); - h_ADCAmplZoom1_HB = new TH1F("h_ADCAmplZoom1_HB", " ", 100, -20., 80.); - h_ADCAmpl_HB = new TH1F("h_ADCAmpl_HB", " ", 100, 10., 5000.); - h_mapDepth1ADCAmpl225_HB = new TH2F("h_mapDepth1ADCAmpl225_HB", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth2ADCAmpl225_HB = new TH2F("h_mapDepth2ADCAmpl225_HB", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth3ADCAmpl225_HB = new TH2F("h_mapDepth3ADCAmpl225_HB", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth4ADCAmpl225_HB = new TH2F("h_mapDepth4ADCAmpl225_HB", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth1ADCAmpl225Copy_HB = new TH2F("h_mapDepth1ADCAmpl225Copy_HB", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth2ADCAmpl225Copy_HB = new TH2F("h_mapDepth2ADCAmpl225Copy_HB", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth3ADCAmpl225Copy_HB = new TH2F("h_mapDepth3ADCAmpl225Copy_HB", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth4ADCAmpl225Copy_HB = new TH2F("h_mapDepth4ADCAmpl225Copy_HB", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth1ADCAmpl_HB = new TH2F("h_mapDepth1ADCAmpl_HB", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth2ADCAmpl_HB = new TH2F("h_mapDepth2ADCAmpl_HB", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth3ADCAmpl_HB = new TH2F("h_mapDepth3ADCAmpl_HB", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth4ADCAmpl_HB = new TH2F("h_mapDepth4ADCAmpl_HB", " ", neta, -41., 41., nphi, 0., bphi); - h_TSmeanA_HB = new TH1F("h_TSmeanA_HB", " ", 100, -1., 11.); - h_mapDepth1TSmeanA225_HB = new TH2F("h_mapDepth1TSmeanA225_HB", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth2TSmeanA225_HB = new TH2F("h_mapDepth2TSmeanA225_HB", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth3TSmeanA225_HB = new TH2F("h_mapDepth3TSmeanA225_HB", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth4TSmeanA225_HB = new TH2F("h_mapDepth4TSmeanA225_HB", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth1TSmeanA_HB = new TH2F("h_mapDepth1TSmeanA_HB", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth2TSmeanA_HB = new TH2F("h_mapDepth2TSmeanA_HB", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth3TSmeanA_HB = new TH2F("h_mapDepth3TSmeanA_HB", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth4TSmeanA_HB = new TH2F("h_mapDepth4TSmeanA_HB", " ", neta, -41., 41., nphi, 0., bphi); - h_TSmaxA_HB = new TH1F("h_TSmaxA_HB", " ", 100, -1., 11.); - h_mapDepth1TSmaxA225_HB = new TH2F("h_mapDepth1TSmaxA225_HB", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth2TSmaxA225_HB = new TH2F("h_mapDepth2TSmaxA225_HB", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth3TSmaxA225_HB = new TH2F("h_mapDepth3TSmaxA225_HB", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth4TSmaxA225_HB = new TH2F("h_mapDepth4TSmaxA225_HB", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth1TSmaxA_HB = new TH2F("h_mapDepth1TSmaxA_HB", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth2TSmaxA_HB = new TH2F("h_mapDepth2TSmaxA_HB", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth3TSmaxA_HB = new TH2F("h_mapDepth3TSmaxA_HB", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth4TSmaxA_HB = new TH2F("h_mapDepth4TSmaxA_HB", " ", neta, -41., 41., nphi, 0., bphi); + h_ADCAmpl345Zoom_HB = fs_->make("h_ADCAmpl345Zoom_HB", " ", 100, 0., 400.); + h_ADCAmpl345Zoom1_HB = fs_->make("h_ADCAmpl345Zoom1_HB", " ", 100, 0., 100.); + h_ADCAmpl345_HB = fs_->make("h_ADCAmpl345_HB", " ", 100, 10., 3000.); + + h_AmplitudeHBrest = fs_->make("h_AmplitudeHBrest", " ", 100, 0., 10000.); + h_AmplitudeHBrest1 = fs_->make("h_AmplitudeHBrest1", " ", 100, 0., 1000000.); + h_AmplitudeHBrest6 = fs_->make("h_AmplitudeHBrest6", " ", 100, 0., 2000000.); + + h_ADCAmpl345_HBCapIdError = fs_->make("h_ADCAmpl345_HBCapIdError", " ", 100, 10., 3000.); + h_ADCAmpl345_HBCapIdNoError = fs_->make("h_ADCAmpl345_HBCapIdNoError", " ", 100, 10., 3000.); + h_ADCAmpl_HBCapIdError = fs_->make("h_ADCAmpl_HBCapIdError", " ", 100, 10., 3000.); + h_ADCAmpl_HBCapIdNoError = fs_->make("h_ADCAmpl_HBCapIdNoError", " ", 100, 10., 3000.); + + h_ADCAmplZoom_HB = fs_->make("h_ADCAmplZoom_HB", " ", 100, 0., 400.); + h_ADCAmplZoom1_HB = fs_->make("h_ADCAmplZoom1_HB", " ", 100, -20., 80.); + h_ADCAmpl_HB = fs_->make("h_ADCAmpl_HB", " ", 100, 10., 5000.); + h_mapDepth1ADCAmpl225_HB = fs_->make("h_mapDepth1ADCAmpl225_HB", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth2ADCAmpl225_HB = fs_->make("h_mapDepth2ADCAmpl225_HB", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth3ADCAmpl225_HB = fs_->make("h_mapDepth3ADCAmpl225_HB", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth4ADCAmpl225_HB = fs_->make("h_mapDepth4ADCAmpl225_HB", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth1ADCAmpl225Copy_HB = + fs_->make("h_mapDepth1ADCAmpl225Copy_HB", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth2ADCAmpl225Copy_HB = + fs_->make("h_mapDepth2ADCAmpl225Copy_HB", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth3ADCAmpl225Copy_HB = + fs_->make("h_mapDepth3ADCAmpl225Copy_HB", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth4ADCAmpl225Copy_HB = + fs_->make("h_mapDepth4ADCAmpl225Copy_HB", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth1ADCAmpl_HB = fs_->make("h_mapDepth1ADCAmpl_HB", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth2ADCAmpl_HB = fs_->make("h_mapDepth2ADCAmpl_HB", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth3ADCAmpl_HB = fs_->make("h_mapDepth3ADCAmpl_HB", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth4ADCAmpl_HB = fs_->make("h_mapDepth4ADCAmpl_HB", " ", neta, -41., 41., nphi, 0., bphi); + h_TSmeanA_HB = fs_->make("h_TSmeanA_HB", " ", 100, -1., 11.); + h_mapDepth1TSmeanA225_HB = fs_->make("h_mapDepth1TSmeanA225_HB", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth2TSmeanA225_HB = fs_->make("h_mapDepth2TSmeanA225_HB", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth3TSmeanA225_HB = fs_->make("h_mapDepth3TSmeanA225_HB", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth4TSmeanA225_HB = fs_->make("h_mapDepth4TSmeanA225_HB", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth1TSmeanA_HB = fs_->make("h_mapDepth1TSmeanA_HB", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth2TSmeanA_HB = fs_->make("h_mapDepth2TSmeanA_HB", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth3TSmeanA_HB = fs_->make("h_mapDepth3TSmeanA_HB", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth4TSmeanA_HB = fs_->make("h_mapDepth4TSmeanA_HB", " ", neta, -41., 41., nphi, 0., bphi); + h_TSmaxA_HB = fs_->make("h_TSmaxA_HB", " ", 100, -1., 11.); + h_mapDepth1TSmaxA225_HB = fs_->make("h_mapDepth1TSmaxA225_HB", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth2TSmaxA225_HB = fs_->make("h_mapDepth2TSmaxA225_HB", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth3TSmaxA225_HB = fs_->make("h_mapDepth3TSmaxA225_HB", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth4TSmaxA225_HB = fs_->make("h_mapDepth4TSmaxA225_HB", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth1TSmaxA_HB = fs_->make("h_mapDepth1TSmaxA_HB", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth2TSmaxA_HB = fs_->make("h_mapDepth2TSmaxA_HB", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth3TSmaxA_HB = fs_->make("h_mapDepth3TSmaxA_HB", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth4TSmaxA_HB = fs_->make("h_mapDepth4TSmaxA_HB", " ", neta, -41., 41., nphi, 0., bphi); // RMS: - h_Amplitude_HB = new TH1F("h_Amplitude_HB", " ", 100, 0., 5.); - h_mapDepth1Amplitude225_HB = new TH2F("h_mapDepth1Amplitude225_HB", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth2Amplitude225_HB = new TH2F("h_mapDepth2Amplitude225_HB", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth3Amplitude225_HB = new TH2F("h_mapDepth3Amplitude225_HB", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth4Amplitude225_HB = new TH2F("h_mapDepth4Amplitude225_HB", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth1Amplitude_HB = new TH2F("h_mapDepth1Amplitude_HB", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth2Amplitude_HB = new TH2F("h_mapDepth2Amplitude_HB", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth3Amplitude_HB = new TH2F("h_mapDepth3Amplitude_HB", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth4Amplitude_HB = new TH2F("h_mapDepth4Amplitude_HB", " ", neta, -41., 41., nphi, 0., bphi); + h_Amplitude_HB = fs_->make("h_Amplitude_HB", " ", 100, 0., 5.); + h_mapDepth1Amplitude225_HB = fs_->make("h_mapDepth1Amplitude225_HB", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth2Amplitude225_HB = fs_->make("h_mapDepth2Amplitude225_HB", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth3Amplitude225_HB = fs_->make("h_mapDepth3Amplitude225_HB", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth4Amplitude225_HB = fs_->make("h_mapDepth4Amplitude225_HB", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth1Amplitude_HB = fs_->make("h_mapDepth1Amplitude_HB", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth2Amplitude_HB = fs_->make("h_mapDepth2Amplitude_HB", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth3Amplitude_HB = fs_->make("h_mapDepth3Amplitude_HB", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth4Amplitude_HB = fs_->make("h_mapDepth4Amplitude_HB", " ", neta, -41., 41., nphi, 0., bphi); // Ratio: - h_Ampl_HB = new TH1F("h_Ampl_HB", " ", 100, 0., 1.1); - h_mapDepth1Ampl047_HB = new TH2F("h_mapDepth1Ampl047_HB", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth2Ampl047_HB = new TH2F("h_mapDepth2Ampl047_HB", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth3Ampl047_HB = new TH2F("h_mapDepth3Ampl047_HB", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth4Ampl047_HB = new TH2F("h_mapDepth4Ampl047_HB", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth1Ampl_HB = new TH2F("h_mapDepth1Ampl_HB", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth2Ampl_HB = new TH2F("h_mapDepth2Ampl_HB", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth3Ampl_HB = new TH2F("h_mapDepth3Ampl_HB", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth4Ampl_HB = new TH2F("h_mapDepth4Ampl_HB", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth1AmplE34_HB = new TH2F("h_mapDepth1AmplE34_HB", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth2AmplE34_HB = new TH2F("h_mapDepth2AmplE34_HB", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth3AmplE34_HB = new TH2F("h_mapDepth3AmplE34_HB", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth4AmplE34_HB = new TH2F("h_mapDepth4AmplE34_HB", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth1_HB = new TH2F("h_mapDepth1_HB", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth2_HB = new TH2F("h_mapDepth2_HB", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth3_HB = new TH2F("h_mapDepth3_HB", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth4_HB = new TH2F("h_mapDepth4_HB", " ", neta, -41., 41., nphi, 0., bphi); + h_Ampl_HB = fs_->make("h_Ampl_HB", " ", 100, 0., 1.1); + h_mapDepth1Ampl047_HB = fs_->make("h_mapDepth1Ampl047_HB", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth2Ampl047_HB = fs_->make("h_mapDepth2Ampl047_HB", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth3Ampl047_HB = fs_->make("h_mapDepth3Ampl047_HB", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth4Ampl047_HB = fs_->make("h_mapDepth4Ampl047_HB", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth1Ampl_HB = fs_->make("h_mapDepth1Ampl_HB", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth2Ampl_HB = fs_->make("h_mapDepth2Ampl_HB", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth3Ampl_HB = fs_->make("h_mapDepth3Ampl_HB", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth4Ampl_HB = fs_->make("h_mapDepth4Ampl_HB", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth1AmplE34_HB = fs_->make("h_mapDepth1AmplE34_HB", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth2AmplE34_HB = fs_->make("h_mapDepth2AmplE34_HB", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth3AmplE34_HB = fs_->make("h_mapDepth3AmplE34_HB", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth4AmplE34_HB = fs_->make("h_mapDepth4AmplE34_HB", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth1_HB = fs_->make("h_mapDepth1_HB", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth2_HB = fs_->make("h_mapDepth2_HB", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth3_HB = fs_->make("h_mapDepth3_HB", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth4_HB = fs_->make("h_mapDepth4_HB", " ", neta, -41., 41., nphi, 0., bphi); ////////////////////////////////////////////////////////////////////////////////////////////// HE // stuff regarding summed(total) Amplitude vs iEvent (histo-name is h_totalAmplitudeHEperEvent) // to see from which event ALL channels are available(related to quality of the run) - h_numberofhitsHEtest = new TH1F("h_numberofhitsHEtest", " ", 100, 0., 10000.); - h_AmplitudeHEtest = new TH1F("h_AmplitudeHEtest", " ", 100, 0., 1000000.); - h_AmplitudeHEtest1 = new TH1F("h_AmplitudeHEtest1", " ", 100, 0., 1000000.); - h_AmplitudeHEtest6 = new TH1F("h_AmplitudeHEtest6", " ", 100, 0., 2000000.); - h_totalAmplitudeHE = new TH1F("h_totalAmplitudeHE", " ", 100, 0., 10000000000.); - h_totalAmplitudeHEperEvent = new TH1F("h_totalAmplitudeHEperEvent", " ", 1000, 1., 1001.); + h_numberofhitsHEtest = fs_->make("h_numberofhitsHEtest", " ", 100, 0., 10000.); + h_AmplitudeHEtest = fs_->make("h_AmplitudeHEtest", " ", 100, 0., 1000000.); + h_AmplitudeHEtest1 = fs_->make("h_AmplitudeHEtest1", " ", 100, 0., 1000000.); + h_AmplitudeHEtest6 = fs_->make("h_AmplitudeHEtest6", " ", 100, 0., 2000000.); + h_totalAmplitudeHE = fs_->make("h_totalAmplitudeHE", " ", 100, 0., 10000000000.); + h_totalAmplitudeHEperEvent = fs_->make("h_totalAmplitudeHEperEvent", " ", 1000, 1., 1001.); // Aijk Amplitude: - h_ADCAmplZoom1_HE = new TH1F("h_ADCAmplZoom1_HE", " ", npfit, 0., anpfit); // for amplmaxts 1TS w/ max - h_ADCAmpl345Zoom1_HE = new TH1F("h_ADCAmpl345Zoom1_HE", " ", npfit, 0., anpfit); // for ampl3ts 3TSs - h_ADCAmpl345Zoom_HE = new TH1F("h_ADCAmpl345Zoom_HE", " ", npfit, 0., anpfit); // for ampl 4TSs + h_ADCAmplZoom1_HE = fs_->make("h_ADCAmplZoom1_HE", " ", npfit, 0., anpfit); // for amplmaxts 1TS w/ max + h_ADCAmpl345Zoom1_HE = fs_->make("h_ADCAmpl345Zoom1_HE", " ", npfit, 0., anpfit); // for ampl3ts 3TSs + h_ADCAmpl345Zoom_HE = fs_->make("h_ADCAmpl345Zoom_HE", " ", npfit, 0., anpfit); // for ampl 4TSs h_amplitudeaveragedbydepthes_HE = - new TH1F("h_amplitudeaveragedbydepthes_HE", " ", npfit, 0., anpfit); // for cross-check: A spectrum + fs_->make("h_amplitudeaveragedbydepthes_HE", " ", npfit, 0., anpfit); // for cross-check: A spectrum h_ndepthesperamplitudebins_HE = - new TH1F("h_ndepthesperamplitudebins_HE", " ", 10, 0., 10.); // for cross-check: ndepthes + fs_->make("h_ndepthesperamplitudebins_HE", " ", 10, 0., 10.); // for cross-check: ndepthes // Ampl12 4TSs to work with "ped-Gsel0" or "led-low-intensity" to clarify gain diff peak2-peak1 h_mapADCAmplfirstpeak_HE = - new TH2F("h_mapADCAmplfirstpeak_HE", " ", neta, -41., 41., nphi, 0., bphi); // for amplmaxts 1TS w/ max + fs_->make("h_mapADCAmplfirstpeak_HE", " ", neta, -41., 41., nphi, 0., bphi); // for amplmaxts 1TS w/ max h_mapADCAmplfirstpeak0_HE = - new TH2F("h_mapADCAmplfirstpeak0_HE", " ", neta, -41., 41., nphi, 0., bphi); // for amplmaxts 1TS w/ max + fs_->make("h_mapADCAmplfirstpeak0_HE", " ", neta, -41., 41., nphi, 0., bphi); // for amplmaxts 1TS w/ max h_mapADCAmplsecondpeak_HE = - new TH2F("h_mapADCAmplsecondpeak_HE", " ", neta, -41., 41., nphi, 0., bphi); // for amplmaxts 1TS w/ max - h_mapADCAmplsecondpeak0_HE = - new TH2F("h_mapADCAmplsecondpeak0_HE", " ", neta, -41., 41., nphi, 0., bphi); // for amplmaxts 1TS w/ max + fs_->make("h_mapADCAmplsecondpeak_HE", " ", neta, -41., 41., nphi, 0., bphi); // for amplmaxts 1TS w/ max + h_mapADCAmplsecondpeak0_HE = fs_->make( + "h_mapADCAmplsecondpeak0_HE", " ", neta, -41., 41., nphi, 0., bphi); // for amplmaxts 1TS w/ max h_mapADCAmpl11firstpeak_HE = - new TH2F("h_mapADCAmpl11firstpeak_HE", " ", neta, -41., 41., nphi, 0., bphi); // for ampl3ts 3TSs + fs_->make("h_mapADCAmpl11firstpeak_HE", " ", neta, -41., 41., nphi, 0., bphi); // for ampl3ts 3TSs h_mapADCAmpl11firstpeak0_HE = - new TH2F("h_mapADCAmpl11firstpeak0_HE", " ", neta, -41., 41., nphi, 0., bphi); // for ampl3ts 3TSs + fs_->make("h_mapADCAmpl11firstpeak0_HE", " ", neta, -41., 41., nphi, 0., bphi); // for ampl3ts 3TSs h_mapADCAmpl11secondpeak_HE = - new TH2F("h_mapADCAmpl11secondpeak_HE", " ", neta, -41., 41., nphi, 0., bphi); // for ampl3ts 3TSs + fs_->make("h_mapADCAmpl11secondpeak_HE", " ", neta, -41., 41., nphi, 0., bphi); // for ampl3ts 3TSs h_mapADCAmpl11secondpeak0_HE = - new TH2F("h_mapADCAmpl11secondpeak0_HE", " ", neta, -41., 41., nphi, 0., bphi); // for ampl3ts 3TSs + fs_->make("h_mapADCAmpl11secondpeak0_HE", " ", neta, -41., 41., nphi, 0., bphi); // for ampl3ts 3TSs h_mapADCAmpl12firstpeak_HE = - new TH2F("h_mapADCAmpl12firstpeak_HE", " ", neta, -41., 41., nphi, 0., bphi); // for ampl 4TSs + fs_->make("h_mapADCAmpl12firstpeak_HE", " ", neta, -41., 41., nphi, 0., bphi); // for ampl 4TSs h_mapADCAmpl12firstpeak0_HE = - new TH2F("h_mapADCAmpl12firstpeak0_HE", " ", neta, -41., 41., nphi, 0., bphi); // for ampl 4TSs + fs_->make("h_mapADCAmpl12firstpeak0_HE", " ", neta, -41., 41., nphi, 0., bphi); // for ampl 4TSs h_mapADCAmpl12secondpeak_HE = - new TH2F("h_mapADCAmpl12secondpeak_HE", " ", neta, -41., 41., nphi, 0., bphi); // for ampl 4TSs + fs_->make("h_mapADCAmpl12secondpeak_HE", " ", neta, -41., 41., nphi, 0., bphi); // for ampl 4TSs h_mapADCAmpl12secondpeak0_HE = - new TH2F("h_mapADCAmpl12secondpeak0_HE", " ", neta, -41., 41., nphi, 0., bphi); // for ampl 4TSs + fs_->make("h_mapADCAmpl12secondpeak0_HE", " ", neta, -41., 41., nphi, 0., bphi); // for ampl 4TSs // Ampl12 4TSs to work with "ped-Gsel0" or "led-low-intensity" to clarify gain diff peak2-peak1 fit results: - h_gsmdifferencefit1_HE = new TH1F("h_gsmdifferencefit1_HE", " ", 80, 20., 60.); - h_gsmdifferencefit2_HE = new TH1F("h_gsmdifferencefit2_HE", " ", 80, 20., 60.); - h_gsmdifferencefit3_HE = new TH1F("h_gsmdifferencefit3_HE", " ", 80, 20., 60.); - h_gsmdifferencefit4_HE = new TH1F("h_gsmdifferencefit4_HE", " ", 80, 20., 60.); - h_gsmdifferencefit5_HE = new TH1F("h_gsmdifferencefit5_HE", " ", 80, 20., 60.); - h_gsmdifferencefit6_HE = new TH1F("h_gsmdifferencefit6_HE", " ", 80, 20., 60.); + h_gsmdifferencefit1_HE = fs_->make("h_gsmdifferencefit1_HE", " ", 80, 20., 60.); + h_gsmdifferencefit2_HE = fs_->make("h_gsmdifferencefit2_HE", " ", 80, 20., 60.); + h_gsmdifferencefit3_HE = fs_->make("h_gsmdifferencefit3_HE", " ", 80, 20., 60.); + h_gsmdifferencefit4_HE = fs_->make("h_gsmdifferencefit4_HE", " ", 80, 20., 60.); + h_gsmdifferencefit5_HE = fs_->make("h_gsmdifferencefit5_HE", " ", 80, 20., 60.); + h_gsmdifferencefit6_HE = fs_->make("h_gsmdifferencefit6_HE", " ", 80, 20., 60.); // Aijk Amplitude: - h_ADCAmpl_HE = new TH1F("h_ADCAmpl_HE", " ", 200, 0., 2000000.); - h_ADCAmplrest_HE = new TH1F("h_ADCAmplrest_HE", " ", 100, 0., 500.); - h_ADCAmplrest1_HE = new TH1F("h_ADCAmplrest1_HE", " ", 100, 0., 100.); - h_ADCAmplrest6_HE = new TH1F("h_ADCAmplrest6_HE", " ", 100, 0., 10000.); + h_ADCAmpl_HE = fs_->make("h_ADCAmpl_HE", " ", 200, 0., 2000000.); + h_ADCAmplrest_HE = fs_->make("h_ADCAmplrest_HE", " ", 100, 0., 500.); + h_ADCAmplrest1_HE = fs_->make("h_ADCAmplrest1_HE", " ", 100, 0., 100.); + h_ADCAmplrest6_HE = fs_->make("h_ADCAmplrest6_HE", " ", 100, 0., 10000.); - h_ADCAmpl345_HE = new TH1F("h_ADCAmpl345_HE", " ", 70, 0., 700000.); + h_ADCAmpl345_HE = fs_->make("h_ADCAmpl345_HE", " ", 70, 0., 700000.); // SiPM corrections: - h_corrforxaMAIN_HE = new TH1F("h_corrforxaMAIN_HE", " ", 70, 0., 700000.); - h_corrforxaMAIN0_HE = new TH1F("h_corrforxaMAIN0_HE", " ", 70, 0., 700000.); - h_corrforxaADDI_HE = new TH1F("h_corrforxaADDI_HE", " ", 70, 0., 700000.); - h_corrforxaADDI0_HE = new TH1F("h_corrforxaADDI0_HE", " ", 70, 0., 700000.); - - h_mapDepth1ADCAmpl225_HE = new TH2F("h_mapDepth1ADCAmpl225_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth2ADCAmpl225_HE = new TH2F("h_mapDepth2ADCAmpl225_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth3ADCAmpl225_HE = new TH2F("h_mapDepth3ADCAmpl225_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth4ADCAmpl225_HE = new TH2F("h_mapDepth4ADCAmpl225_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth5ADCAmpl225_HE = new TH2F("h_mapDepth5ADCAmpl225_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth6ADCAmpl225_HE = new TH2F("h_mapDepth6ADCAmpl225_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth7ADCAmpl225_HE = new TH2F("h_mapDepth7ADCAmpl225_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth1ADCAmpl225Copy_HE = new TH2F("h_mapDepth1ADCAmpl225Copy_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth2ADCAmpl225Copy_HE = new TH2F("h_mapDepth2ADCAmpl225Copy_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth3ADCAmpl225Copy_HE = new TH2F("h_mapDepth3ADCAmpl225Copy_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth4ADCAmpl225Copy_HE = new TH2F("h_mapDepth4ADCAmpl225Copy_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth5ADCAmpl225Copy_HE = new TH2F("h_mapDepth5ADCAmpl225Copy_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth6ADCAmpl225Copy_HE = new TH2F("h_mapDepth6ADCAmpl225Copy_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth7ADCAmpl225Copy_HE = new TH2F("h_mapDepth7ADCAmpl225Copy_HE", " ", neta, -41., 41., nphi, 0., bphi); - - h_mapDepth1ADCAmpl_HE = new TH2F("h_mapDepth1ADCAmpl_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth2ADCAmpl_HE = new TH2F("h_mapDepth2ADCAmpl_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth3ADCAmpl_HE = new TH2F("h_mapDepth3ADCAmpl_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth4ADCAmpl_HE = new TH2F("h_mapDepth4ADCAmpl_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth5ADCAmpl_HE = new TH2F("h_mapDepth5ADCAmpl_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth6ADCAmpl_HE = new TH2F("h_mapDepth6ADCAmpl_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth7ADCAmpl_HE = new TH2F("h_mapDepth7ADCAmpl_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth1ADCAmplSiPM_HE = new TH2F("h_mapDepth1ADCAmplSiPM_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth2ADCAmplSiPM_HE = new TH2F("h_mapDepth2ADCAmplSiPM_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth3ADCAmplSiPM_HE = new TH2F("h_mapDepth3ADCAmplSiPM_HE", " ", neta, -41., 41., nphi, 0., bphi); - - h_TSmeanA_HE = new TH1F("h_TSmeanA_HE", " ", 100, -2., 8.); - h_mapDepth1TSmeanA225_HE = new TH2F("h_mapDepth1TSmeanA225_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth2TSmeanA225_HE = new TH2F("h_mapDepth2TSmeanA225_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth3TSmeanA225_HE = new TH2F("h_mapDepth3TSmeanA225_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth4TSmeanA225_HE = new TH2F("h_mapDepth4TSmeanA225_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth5TSmeanA225_HE = new TH2F("h_mapDepth5TSmeanA225_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth6TSmeanA225_HE = new TH2F("h_mapDepth6TSmeanA225_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth7TSmeanA225_HE = new TH2F("h_mapDepth7TSmeanA225_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth1TSmeanA_HE = new TH2F("h_mapDepth1TSmeanA_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth2TSmeanA_HE = new TH2F("h_mapDepth2TSmeanA_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth3TSmeanA_HE = new TH2F("h_mapDepth3TSmeanA_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth4TSmeanA_HE = new TH2F("h_mapDepth4TSmeanA_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth5TSmeanA_HE = new TH2F("h_mapDepth5TSmeanA_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth6TSmeanA_HE = new TH2F("h_mapDepth6TSmeanA_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth7TSmeanA_HE = new TH2F("h_mapDepth7TSmeanA_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_TSmaxA_HE = new TH1F("h_TSmaxA_HE", " ", 100, -1., 11.); - h_mapDepth1TSmaxA225_HE = new TH2F("h_mapDepth1TSmaxA225_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth2TSmaxA225_HE = new TH2F("h_mapDepth2TSmaxA225_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth3TSmaxA225_HE = new TH2F("h_mapDepth3TSmaxA225_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth4TSmaxA225_HE = new TH2F("h_mapDepth4TSmaxA225_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth5TSmaxA225_HE = new TH2F("h_mapDepth5TSmaxA225_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth6TSmaxA225_HE = new TH2F("h_mapDepth6TSmaxA225_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth7TSmaxA225_HE = new TH2F("h_mapDepth7TSmaxA225_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth1TSmaxA_HE = new TH2F("h_mapDepth1TSmaxA_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth2TSmaxA_HE = new TH2F("h_mapDepth2TSmaxA_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth3TSmaxA_HE = new TH2F("h_mapDepth3TSmaxA_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth4TSmaxA_HE = new TH2F("h_mapDepth4TSmaxA_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth5TSmaxA_HE = new TH2F("h_mapDepth5TSmaxA_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth6TSmaxA_HE = new TH2F("h_mapDepth6TSmaxA_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth7TSmaxA_HE = new TH2F("h_mapDepth7TSmaxA_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_corrforxaMAIN_HE = fs_->make("h_corrforxaMAIN_HE", " ", 70, 0., 700000.); + h_corrforxaMAIN0_HE = fs_->make("h_corrforxaMAIN0_HE", " ", 70, 0., 700000.); + h_corrforxaADDI_HE = fs_->make("h_corrforxaADDI_HE", " ", 70, 0., 700000.); + h_corrforxaADDI0_HE = fs_->make("h_corrforxaADDI0_HE", " ", 70, 0., 700000.); + + h_mapDepth1ADCAmpl225_HE = fs_->make("h_mapDepth1ADCAmpl225_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth2ADCAmpl225_HE = fs_->make("h_mapDepth2ADCAmpl225_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth3ADCAmpl225_HE = fs_->make("h_mapDepth3ADCAmpl225_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth4ADCAmpl225_HE = fs_->make("h_mapDepth4ADCAmpl225_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth5ADCAmpl225_HE = fs_->make("h_mapDepth5ADCAmpl225_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth6ADCAmpl225_HE = fs_->make("h_mapDepth6ADCAmpl225_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth7ADCAmpl225_HE = fs_->make("h_mapDepth7ADCAmpl225_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth1ADCAmpl225Copy_HE = + fs_->make("h_mapDepth1ADCAmpl225Copy_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth2ADCAmpl225Copy_HE = + fs_->make("h_mapDepth2ADCAmpl225Copy_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth3ADCAmpl225Copy_HE = + fs_->make("h_mapDepth3ADCAmpl225Copy_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth4ADCAmpl225Copy_HE = + fs_->make("h_mapDepth4ADCAmpl225Copy_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth5ADCAmpl225Copy_HE = + fs_->make("h_mapDepth5ADCAmpl225Copy_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth6ADCAmpl225Copy_HE = + fs_->make("h_mapDepth6ADCAmpl225Copy_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth7ADCAmpl225Copy_HE = + fs_->make("h_mapDepth7ADCAmpl225Copy_HE", " ", neta, -41., 41., nphi, 0., bphi); + + h_mapDepth1ADCAmpl_HE = fs_->make("h_mapDepth1ADCAmpl_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth2ADCAmpl_HE = fs_->make("h_mapDepth2ADCAmpl_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth3ADCAmpl_HE = fs_->make("h_mapDepth3ADCAmpl_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth4ADCAmpl_HE = fs_->make("h_mapDepth4ADCAmpl_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth5ADCAmpl_HE = fs_->make("h_mapDepth5ADCAmpl_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth6ADCAmpl_HE = fs_->make("h_mapDepth6ADCAmpl_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth7ADCAmpl_HE = fs_->make("h_mapDepth7ADCAmpl_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth1ADCAmplSiPM_HE = fs_->make("h_mapDepth1ADCAmplSiPM_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth2ADCAmplSiPM_HE = fs_->make("h_mapDepth2ADCAmplSiPM_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth3ADCAmplSiPM_HE = fs_->make("h_mapDepth3ADCAmplSiPM_HE", " ", neta, -41., 41., nphi, 0., bphi); + + h_TSmeanA_HE = fs_->make("h_TSmeanA_HE", " ", 100, -2., 8.); + h_mapDepth1TSmeanA225_HE = fs_->make("h_mapDepth1TSmeanA225_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth2TSmeanA225_HE = fs_->make("h_mapDepth2TSmeanA225_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth3TSmeanA225_HE = fs_->make("h_mapDepth3TSmeanA225_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth4TSmeanA225_HE = fs_->make("h_mapDepth4TSmeanA225_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth5TSmeanA225_HE = fs_->make("h_mapDepth5TSmeanA225_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth6TSmeanA225_HE = fs_->make("h_mapDepth6TSmeanA225_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth7TSmeanA225_HE = fs_->make("h_mapDepth7TSmeanA225_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth1TSmeanA_HE = fs_->make("h_mapDepth1TSmeanA_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth2TSmeanA_HE = fs_->make("h_mapDepth2TSmeanA_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth3TSmeanA_HE = fs_->make("h_mapDepth3TSmeanA_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth4TSmeanA_HE = fs_->make("h_mapDepth4TSmeanA_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth5TSmeanA_HE = fs_->make("h_mapDepth5TSmeanA_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth6TSmeanA_HE = fs_->make("h_mapDepth6TSmeanA_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth7TSmeanA_HE = fs_->make("h_mapDepth7TSmeanA_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_TSmaxA_HE = fs_->make("h_TSmaxA_HE", " ", 100, -1., 11.); + h_mapDepth1TSmaxA225_HE = fs_->make("h_mapDepth1TSmaxA225_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth2TSmaxA225_HE = fs_->make("h_mapDepth2TSmaxA225_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth3TSmaxA225_HE = fs_->make("h_mapDepth3TSmaxA225_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth4TSmaxA225_HE = fs_->make("h_mapDepth4TSmaxA225_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth5TSmaxA225_HE = fs_->make("h_mapDepth5TSmaxA225_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth6TSmaxA225_HE = fs_->make("h_mapDepth6TSmaxA225_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth7TSmaxA225_HE = fs_->make("h_mapDepth7TSmaxA225_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth1TSmaxA_HE = fs_->make("h_mapDepth1TSmaxA_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth2TSmaxA_HE = fs_->make("h_mapDepth2TSmaxA_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth3TSmaxA_HE = fs_->make("h_mapDepth3TSmaxA_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth4TSmaxA_HE = fs_->make("h_mapDepth4TSmaxA_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth5TSmaxA_HE = fs_->make("h_mapDepth5TSmaxA_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth6TSmaxA_HE = fs_->make("h_mapDepth6TSmaxA_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth7TSmaxA_HE = fs_->make("h_mapDepth7TSmaxA_HE", " ", neta, -41., 41., nphi, 0., bphi); // RMS: - h_Amplitude_HE = new TH1F("h_Amplitude_HE", " ", 100, 0., 5.5); - h_mapDepth1Amplitude225_HE = new TH2F("h_mapDepth1Amplitude225_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth2Amplitude225_HE = new TH2F("h_mapDepth2Amplitude225_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth3Amplitude225_HE = new TH2F("h_mapDepth3Amplitude225_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth4Amplitude225_HE = new TH2F("h_mapDepth4Amplitude225_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth5Amplitude225_HE = new TH2F("h_mapDepth5Amplitude225_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth6Amplitude225_HE = new TH2F("h_mapDepth6Amplitude225_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth7Amplitude225_HE = new TH2F("h_mapDepth7Amplitude225_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth1Amplitude_HE = new TH2F("h_mapDepth1Amplitude_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth2Amplitude_HE = new TH2F("h_mapDepth2Amplitude_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth3Amplitude_HE = new TH2F("h_mapDepth3Amplitude_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth4Amplitude_HE = new TH2F("h_mapDepth4Amplitude_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth5Amplitude_HE = new TH2F("h_mapDepth5Amplitude_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth6Amplitude_HE = new TH2F("h_mapDepth6Amplitude_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth7Amplitude_HE = new TH2F("h_mapDepth7Amplitude_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_Amplitude_HE = fs_->make("h_Amplitude_HE", " ", 100, 0., 5.5); + h_mapDepth1Amplitude225_HE = fs_->make("h_mapDepth1Amplitude225_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth2Amplitude225_HE = fs_->make("h_mapDepth2Amplitude225_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth3Amplitude225_HE = fs_->make("h_mapDepth3Amplitude225_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth4Amplitude225_HE = fs_->make("h_mapDepth4Amplitude225_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth5Amplitude225_HE = fs_->make("h_mapDepth5Amplitude225_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth6Amplitude225_HE = fs_->make("h_mapDepth6Amplitude225_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth7Amplitude225_HE = fs_->make("h_mapDepth7Amplitude225_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth1Amplitude_HE = fs_->make("h_mapDepth1Amplitude_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth2Amplitude_HE = fs_->make("h_mapDepth2Amplitude_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth3Amplitude_HE = fs_->make("h_mapDepth3Amplitude_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth4Amplitude_HE = fs_->make("h_mapDepth4Amplitude_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth5Amplitude_HE = fs_->make("h_mapDepth5Amplitude_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth6Amplitude_HE = fs_->make("h_mapDepth6Amplitude_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth7Amplitude_HE = fs_->make("h_mapDepth7Amplitude_HE", " ", neta, -41., 41., nphi, 0., bphi); // Ratio: - h_Ampl_HE = new TH1F("h_Ampl_HE", " ", 100, 0., 1.1); - h_mapDepth1Ampl047_HE = new TH2F("h_mapDepth1Ampl047_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth2Ampl047_HE = new TH2F("h_mapDepth2Ampl047_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth3Ampl047_HE = new TH2F("h_mapDepth3Ampl047_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth4Ampl047_HE = new TH2F("h_mapDepth4Ampl047_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth5Ampl047_HE = new TH2F("h_mapDepth5Ampl047_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth6Ampl047_HE = new TH2F("h_mapDepth6Ampl047_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth7Ampl047_HE = new TH2F("h_mapDepth7Ampl047_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth1Ampl_HE = new TH2F("h_mapDepth1Ampl_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth2Ampl_HE = new TH2F("h_mapDepth2Ampl_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth3Ampl_HE = new TH2F("h_mapDepth3Ampl_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth4Ampl_HE = new TH2F("h_mapDepth4Ampl_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth5Ampl_HE = new TH2F("h_mapDepth5Ampl_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth6Ampl_HE = new TH2F("h_mapDepth6Ampl_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth7Ampl_HE = new TH2F("h_mapDepth7Ampl_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth1AmplE34_HE = new TH2F("h_mapDepth1AmplE34_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth2AmplE34_HE = new TH2F("h_mapDepth2AmplE34_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth3AmplE34_HE = new TH2F("h_mapDepth3AmplE34_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth4AmplE34_HE = new TH2F("h_mapDepth4AmplE34_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth5AmplE34_HE = new TH2F("h_mapDepth5AmplE34_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth6AmplE34_HE = new TH2F("h_mapDepth6AmplE34_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth7AmplE34_HE = new TH2F("h_mapDepth7AmplE34_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth1_HE = new TH2F("h_mapDepth1_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth2_HE = new TH2F("h_mapDepth2_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth3_HE = new TH2F("h_mapDepth3_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth4_HE = new TH2F("h_mapDepth4_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth5_HE = new TH2F("h_mapDepth5_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth6_HE = new TH2F("h_mapDepth6_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth7_HE = new TH2F("h_mapDepth7_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_Ampl_HE = fs_->make("h_Ampl_HE", " ", 100, 0., 1.1); + h_mapDepth1Ampl047_HE = fs_->make("h_mapDepth1Ampl047_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth2Ampl047_HE = fs_->make("h_mapDepth2Ampl047_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth3Ampl047_HE = fs_->make("h_mapDepth3Ampl047_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth4Ampl047_HE = fs_->make("h_mapDepth4Ampl047_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth5Ampl047_HE = fs_->make("h_mapDepth5Ampl047_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth6Ampl047_HE = fs_->make("h_mapDepth6Ampl047_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth7Ampl047_HE = fs_->make("h_mapDepth7Ampl047_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth1Ampl_HE = fs_->make("h_mapDepth1Ampl_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth2Ampl_HE = fs_->make("h_mapDepth2Ampl_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth3Ampl_HE = fs_->make("h_mapDepth3Ampl_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth4Ampl_HE = fs_->make("h_mapDepth4Ampl_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth5Ampl_HE = fs_->make("h_mapDepth5Ampl_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth6Ampl_HE = fs_->make("h_mapDepth6Ampl_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth7Ampl_HE = fs_->make("h_mapDepth7Ampl_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth1AmplE34_HE = fs_->make("h_mapDepth1AmplE34_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth2AmplE34_HE = fs_->make("h_mapDepth2AmplE34_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth3AmplE34_HE = fs_->make("h_mapDepth3AmplE34_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth4AmplE34_HE = fs_->make("h_mapDepth4AmplE34_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth5AmplE34_HE = fs_->make("h_mapDepth5AmplE34_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth6AmplE34_HE = fs_->make("h_mapDepth6AmplE34_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth7AmplE34_HE = fs_->make("h_mapDepth7AmplE34_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth1_HE = fs_->make("h_mapDepth1_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth2_HE = fs_->make("h_mapDepth2_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth3_HE = fs_->make("h_mapDepth3_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth4_HE = fs_->make("h_mapDepth4_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth5_HE = fs_->make("h_mapDepth5_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth6_HE = fs_->make("h_mapDepth6_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth7_HE = fs_->make("h_mapDepth7_HE", " ", neta, -41., 41., nphi, 0., bphi); /////////////////////////////////////////////////////////////////////////////////////////////////// IterativeMethodCalibrationGroup - h_mapenophinorm_HE1 = new TH2F("h_mapenophinorm_HE1", " ", neta, -41., 41., nphi, 0., bphi); - h_mapenophinorm_HE2 = new TH2F("h_mapenophinorm_HE2", " ", neta, -41., 41., nphi, 0., bphi); - h_mapenophinorm_HE3 = new TH2F("h_mapenophinorm_HE3", " ", neta, -41., 41., nphi, 0., bphi); - h_mapenophinorm_HE4 = new TH2F("h_mapenophinorm_HE4", " ", neta, -41., 41., nphi, 0., bphi); - h_mapenophinorm_HE5 = new TH2F("h_mapenophinorm_HE5", " ", neta, -41., 41., nphi, 0., bphi); - h_mapenophinorm_HE6 = new TH2F("h_mapenophinorm_HE6", " ", neta, -41., 41., nphi, 0., bphi); - h_mapenophinorm_HE7 = new TH2F("h_mapenophinorm_HE7", " ", neta, -41., 41., nphi, 0., bphi); - h_mapenophinorm2_HE1 = new TH2F("h_mapenophinorm2_HE1", " ", neta, -41., 41., nphi, 0., bphi); - h_mapenophinorm2_HE2 = new TH2F("h_mapenophinorm2_HE2", " ", neta, -41., 41., nphi, 0., bphi); - h_mapenophinorm2_HE3 = new TH2F("h_mapenophinorm2_HE3", " ", neta, -41., 41., nphi, 0., bphi); - h_mapenophinorm2_HE4 = new TH2F("h_mapenophinorm2_HE4", " ", neta, -41., 41., nphi, 0., bphi); - h_mapenophinorm2_HE5 = new TH2F("h_mapenophinorm2_HE5", " ", neta, -41., 41., nphi, 0., bphi); - h_mapenophinorm2_HE6 = new TH2F("h_mapenophinorm2_HE6", " ", neta, -41., 41., nphi, 0., bphi); - h_mapenophinorm2_HE7 = new TH2F("h_mapenophinorm2_HE7", " ", neta, -41., 41., nphi, 0., bphi); - - h_maprphinorm_HE1 = new TH2F("h_maprphinorm_HE1", " ", neta, -41., 41., nphi, 0., bphi); - h_maprphinorm_HE2 = new TH2F("h_maprphinorm_HE2", " ", neta, -41., 41., nphi, 0., bphi); - h_maprphinorm_HE3 = new TH2F("h_maprphinorm_HE3", " ", neta, -41., 41., nphi, 0., bphi); - h_maprphinorm_HE4 = new TH2F("h_maprphinorm_HE4", " ", neta, -41., 41., nphi, 0., bphi); - h_maprphinorm_HE5 = new TH2F("h_maprphinorm_HE5", " ", neta, -41., 41., nphi, 0., bphi); - h_maprphinorm_HE6 = new TH2F("h_maprphinorm_HE6", " ", neta, -41., 41., nphi, 0., bphi); - h_maprphinorm_HE7 = new TH2F("h_maprphinorm_HE7", " ", neta, -41., 41., nphi, 0., bphi); - h_maprphinorm2_HE1 = new TH2F("h_maprphinorm2_HE1", " ", neta, -41., 41., nphi, 0., bphi); - h_maprphinorm2_HE2 = new TH2F("h_maprphinorm2_HE2", " ", neta, -41., 41., nphi, 0., bphi); - h_maprphinorm2_HE3 = new TH2F("h_maprphinorm2_HE3", " ", neta, -41., 41., nphi, 0., bphi); - h_maprphinorm2_HE4 = new TH2F("h_maprphinorm2_HE4", " ", neta, -41., 41., nphi, 0., bphi); - h_maprphinorm2_HE5 = new TH2F("h_maprphinorm2_HE5", " ", neta, -41., 41., nphi, 0., bphi); - h_maprphinorm2_HE6 = new TH2F("h_maprphinorm2_HE6", " ", neta, -41., 41., nphi, 0., bphi); - h_maprphinorm2_HE7 = new TH2F("h_maprphinorm2_HE7", " ", neta, -41., 41., nphi, 0., bphi); - - h_maprphinorm0_HE1 = new TH2F("h_maprphinorm0_HE1", " ", neta, -41., 41., nphi, 0., bphi); - h_maprphinorm0_HE2 = new TH2F("h_maprphinorm0_HE2", " ", neta, -41., 41., nphi, 0., bphi); - h_maprphinorm0_HE3 = new TH2F("h_maprphinorm0_HE3", " ", neta, -41., 41., nphi, 0., bphi); - h_maprphinorm0_HE4 = new TH2F("h_maprphinorm0_HE4", " ", neta, -41., 41., nphi, 0., bphi); - h_maprphinorm0_HE5 = new TH2F("h_maprphinorm0_HE5", " ", neta, -41., 41., nphi, 0., bphi); - h_maprphinorm0_HE6 = new TH2F("h_maprphinorm0_HE6", " ", neta, -41., 41., nphi, 0., bphi); - h_maprphinorm0_HE7 = new TH2F("h_maprphinorm0_HE7", " ", neta, -41., 41., nphi, 0., bphi); + h_mapenophinorm_HE1 = fs_->make("h_mapenophinorm_HE1", " ", neta, -41., 41., nphi, 0., bphi); + h_mapenophinorm_HE2 = fs_->make("h_mapenophinorm_HE2", " ", neta, -41., 41., nphi, 0., bphi); + h_mapenophinorm_HE3 = fs_->make("h_mapenophinorm_HE3", " ", neta, -41., 41., nphi, 0., bphi); + h_mapenophinorm_HE4 = fs_->make("h_mapenophinorm_HE4", " ", neta, -41., 41., nphi, 0., bphi); + h_mapenophinorm_HE5 = fs_->make("h_mapenophinorm_HE5", " ", neta, -41., 41., nphi, 0., bphi); + h_mapenophinorm_HE6 = fs_->make("h_mapenophinorm_HE6", " ", neta, -41., 41., nphi, 0., bphi); + h_mapenophinorm_HE7 = fs_->make("h_mapenophinorm_HE7", " ", neta, -41., 41., nphi, 0., bphi); + h_mapenophinorm2_HE1 = fs_->make("h_mapenophinorm2_HE1", " ", neta, -41., 41., nphi, 0., bphi); + h_mapenophinorm2_HE2 = fs_->make("h_mapenophinorm2_HE2", " ", neta, -41., 41., nphi, 0., bphi); + h_mapenophinorm2_HE3 = fs_->make("h_mapenophinorm2_HE3", " ", neta, -41., 41., nphi, 0., bphi); + h_mapenophinorm2_HE4 = fs_->make("h_mapenophinorm2_HE4", " ", neta, -41., 41., nphi, 0., bphi); + h_mapenophinorm2_HE5 = fs_->make("h_mapenophinorm2_HE5", " ", neta, -41., 41., nphi, 0., bphi); + h_mapenophinorm2_HE6 = fs_->make("h_mapenophinorm2_HE6", " ", neta, -41., 41., nphi, 0., bphi); + h_mapenophinorm2_HE7 = fs_->make("h_mapenophinorm2_HE7", " ", neta, -41., 41., nphi, 0., bphi); + + h_maprphinorm_HE1 = fs_->make("h_maprphinorm_HE1", " ", neta, -41., 41., nphi, 0., bphi); + h_maprphinorm_HE2 = fs_->make("h_maprphinorm_HE2", " ", neta, -41., 41., nphi, 0., bphi); + h_maprphinorm_HE3 = fs_->make("h_maprphinorm_HE3", " ", neta, -41., 41., nphi, 0., bphi); + h_maprphinorm_HE4 = fs_->make("h_maprphinorm_HE4", " ", neta, -41., 41., nphi, 0., bphi); + h_maprphinorm_HE5 = fs_->make("h_maprphinorm_HE5", " ", neta, -41., 41., nphi, 0., bphi); + h_maprphinorm_HE6 = fs_->make("h_maprphinorm_HE6", " ", neta, -41., 41., nphi, 0., bphi); + h_maprphinorm_HE7 = fs_->make("h_maprphinorm_HE7", " ", neta, -41., 41., nphi, 0., bphi); + h_maprphinorm2_HE1 = fs_->make("h_maprphinorm2_HE1", " ", neta, -41., 41., nphi, 0., bphi); + h_maprphinorm2_HE2 = fs_->make("h_maprphinorm2_HE2", " ", neta, -41., 41., nphi, 0., bphi); + h_maprphinorm2_HE3 = fs_->make("h_maprphinorm2_HE3", " ", neta, -41., 41., nphi, 0., bphi); + h_maprphinorm2_HE4 = fs_->make("h_maprphinorm2_HE4", " ", neta, -41., 41., nphi, 0., bphi); + h_maprphinorm2_HE5 = fs_->make("h_maprphinorm2_HE5", " ", neta, -41., 41., nphi, 0., bphi); + h_maprphinorm2_HE6 = fs_->make("h_maprphinorm2_HE6", " ", neta, -41., 41., nphi, 0., bphi); + h_maprphinorm2_HE7 = fs_->make("h_maprphinorm2_HE7", " ", neta, -41., 41., nphi, 0., bphi); + + h_maprphinorm0_HE1 = fs_->make("h_maprphinorm0_HE1", " ", neta, -41., 41., nphi, 0., bphi); + h_maprphinorm0_HE2 = fs_->make("h_maprphinorm0_HE2", " ", neta, -41., 41., nphi, 0., bphi); + h_maprphinorm0_HE3 = fs_->make("h_maprphinorm0_HE3", " ", neta, -41., 41., nphi, 0., bphi); + h_maprphinorm0_HE4 = fs_->make("h_maprphinorm0_HE4", " ", neta, -41., 41., nphi, 0., bphi); + h_maprphinorm0_HE5 = fs_->make("h_maprphinorm0_HE5", " ", neta, -41., 41., nphi, 0., bphi); + h_maprphinorm0_HE6 = fs_->make("h_maprphinorm0_HE6", " ", neta, -41., 41., nphi, 0., bphi); + h_maprphinorm0_HE7 = fs_->make("h_maprphinorm0_HE7", " ", neta, -41., 41., nphi, 0., bphi); // // Didi as done in Reco //HB: - h_amplitudechannel0_HB1 = new TH2F("h_amplitudechannel0_HB1", " ", neta, -41., 41., nphi, 0., bphi); - h_amplitudechannel1_HB1 = new TH2F("h_amplitudechannel1_HB1", " ", neta, -41., 41., nphi, 0., bphi); - h_amplitudechannel2_HB1 = new TH2F("h_amplitudechannel2_HB1", " ", neta, -41., 41., nphi, 0., bphi); - h_amplitudechannel0_HB2 = new TH2F("h_amplitudechannel0_HB2", " ", neta, -41., 41., nphi, 0., bphi); - h_amplitudechannel1_HB2 = new TH2F("h_amplitudechannel1_HB2", " ", neta, -41., 41., nphi, 0., bphi); - h_amplitudechannel2_HB2 = new TH2F("h_amplitudechannel2_HB2", " ", neta, -41., 41., nphi, 0., bphi); - h_amplitudechannel0_HB3 = new TH2F("h_amplitudechannel0_HB3", " ", neta, -41., 41., nphi, 0., bphi); - h_amplitudechannel1_HB3 = new TH2F("h_amplitudechannel1_HB3", " ", neta, -41., 41., nphi, 0., bphi); - h_amplitudechannel2_HB3 = new TH2F("h_amplitudechannel2_HB3", " ", neta, -41., 41., nphi, 0., bphi); - h_amplitudechannel0_HB4 = new TH2F("h_amplitudechannel0_HB4", " ", neta, -41., 41., nphi, 0., bphi); - h_amplitudechannel1_HB4 = new TH2F("h_amplitudechannel1_HB4", " ", neta, -41., 41., nphi, 0., bphi); - h_amplitudechannel2_HB4 = new TH2F("h_amplitudechannel2_HB4", " ", neta, -41., 41., nphi, 0., bphi); + h_amplitudechannel0_HB1 = fs_->make("h_amplitudechannel0_HB1", " ", neta, -41., 41., nphi, 0., bphi); + h_amplitudechannel1_HB1 = fs_->make("h_amplitudechannel1_HB1", " ", neta, -41., 41., nphi, 0., bphi); + h_amplitudechannel2_HB1 = fs_->make("h_amplitudechannel2_HB1", " ", neta, -41., 41., nphi, 0., bphi); + h_amplitudechannel0_HB2 = fs_->make("h_amplitudechannel0_HB2", " ", neta, -41., 41., nphi, 0., bphi); + h_amplitudechannel1_HB2 = fs_->make("h_amplitudechannel1_HB2", " ", neta, -41., 41., nphi, 0., bphi); + h_amplitudechannel2_HB2 = fs_->make("h_amplitudechannel2_HB2", " ", neta, -41., 41., nphi, 0., bphi); + h_amplitudechannel0_HB3 = fs_->make("h_amplitudechannel0_HB3", " ", neta, -41., 41., nphi, 0., bphi); + h_amplitudechannel1_HB3 = fs_->make("h_amplitudechannel1_HB3", " ", neta, -41., 41., nphi, 0., bphi); + h_amplitudechannel2_HB3 = fs_->make("h_amplitudechannel2_HB3", " ", neta, -41., 41., nphi, 0., bphi); + h_amplitudechannel0_HB4 = fs_->make("h_amplitudechannel0_HB4", " ", neta, -41., 41., nphi, 0., bphi); + h_amplitudechannel1_HB4 = fs_->make("h_amplitudechannel1_HB4", " ", neta, -41., 41., nphi, 0., bphi); + h_amplitudechannel2_HB4 = fs_->make("h_amplitudechannel2_HB4", " ", neta, -41., 41., nphi, 0., bphi); //HE: - h_amplitudechannel0_HE1 = new TH2F("h_amplitudechannel0_HE1", " ", neta, -41., 41., nphi, 0., bphi); - h_amplitudechannel1_HE1 = new TH2F("h_amplitudechannel1_HE1", " ", neta, -41., 41., nphi, 0., bphi); - h_amplitudechannel2_HE1 = new TH2F("h_amplitudechannel2_HE1", " ", neta, -41., 41., nphi, 0., bphi); - h_amplitudechannel0_HE2 = new TH2F("h_amplitudechannel0_HE2", " ", neta, -41., 41., nphi, 0., bphi); - h_amplitudechannel1_HE2 = new TH2F("h_amplitudechannel1_HE2", " ", neta, -41., 41., nphi, 0., bphi); - h_amplitudechannel2_HE2 = new TH2F("h_amplitudechannel2_HE2", " ", neta, -41., 41., nphi, 0., bphi); - h_amplitudechannel0_HE3 = new TH2F("h_amplitudechannel0_HE3", " ", neta, -41., 41., nphi, 0., bphi); - h_amplitudechannel1_HE3 = new TH2F("h_amplitudechannel1_HE3", " ", neta, -41., 41., nphi, 0., bphi); - h_amplitudechannel2_HE3 = new TH2F("h_amplitudechannel2_HE3", " ", neta, -41., 41., nphi, 0., bphi); - h_amplitudechannel0_HE4 = new TH2F("h_amplitudechannel0_HE4", " ", neta, -41., 41., nphi, 0., bphi); - h_amplitudechannel1_HE4 = new TH2F("h_amplitudechannel1_HE4", " ", neta, -41., 41., nphi, 0., bphi); - h_amplitudechannel2_HE4 = new TH2F("h_amplitudechannel2_HE4", " ", neta, -41., 41., nphi, 0., bphi); - h_amplitudechannel0_HE5 = new TH2F("h_amplitudechannel0_HE5", " ", neta, -41., 41., nphi, 0., bphi); - h_amplitudechannel1_HE5 = new TH2F("h_amplitudechannel1_HE5", " ", neta, -41., 41., nphi, 0., bphi); - h_amplitudechannel2_HE5 = new TH2F("h_amplitudechannel2_HE5", " ", neta, -41., 41., nphi, 0., bphi); - h_amplitudechannel0_HE6 = new TH2F("h_amplitudechannel0_HE6", " ", neta, -41., 41., nphi, 0., bphi); - h_amplitudechannel1_HE6 = new TH2F("h_amplitudechannel1_HE6", " ", neta, -41., 41., nphi, 0., bphi); - h_amplitudechannel2_HE6 = new TH2F("h_amplitudechannel2_HE6", " ", neta, -41., 41., nphi, 0., bphi); - h_amplitudechannel0_HE7 = new TH2F("h_amplitudechannel0_HE7", " ", neta, -41., 41., nphi, 0., bphi); - h_amplitudechannel1_HE7 = new TH2F("h_amplitudechannel1_HE7", " ", neta, -41., 41., nphi, 0., bphi); - h_amplitudechannel2_HE7 = new TH2F("h_amplitudechannel2_HE7", " ", neta, -41., 41., nphi, 0., bphi); + h_amplitudechannel0_HE1 = fs_->make("h_amplitudechannel0_HE1", " ", neta, -41., 41., nphi, 0., bphi); + h_amplitudechannel1_HE1 = fs_->make("h_amplitudechannel1_HE1", " ", neta, -41., 41., nphi, 0., bphi); + h_amplitudechannel2_HE1 = fs_->make("h_amplitudechannel2_HE1", " ", neta, -41., 41., nphi, 0., bphi); + h_amplitudechannel0_HE2 = fs_->make("h_amplitudechannel0_HE2", " ", neta, -41., 41., nphi, 0., bphi); + h_amplitudechannel1_HE2 = fs_->make("h_amplitudechannel1_HE2", " ", neta, -41., 41., nphi, 0., bphi); + h_amplitudechannel2_HE2 = fs_->make("h_amplitudechannel2_HE2", " ", neta, -41., 41., nphi, 0., bphi); + h_amplitudechannel0_HE3 = fs_->make("h_amplitudechannel0_HE3", " ", neta, -41., 41., nphi, 0., bphi); + h_amplitudechannel1_HE3 = fs_->make("h_amplitudechannel1_HE3", " ", neta, -41., 41., nphi, 0., bphi); + h_amplitudechannel2_HE3 = fs_->make("h_amplitudechannel2_HE3", " ", neta, -41., 41., nphi, 0., bphi); + h_amplitudechannel0_HE4 = fs_->make("h_amplitudechannel0_HE4", " ", neta, -41., 41., nphi, 0., bphi); + h_amplitudechannel1_HE4 = fs_->make("h_amplitudechannel1_HE4", " ", neta, -41., 41., nphi, 0., bphi); + h_amplitudechannel2_HE4 = fs_->make("h_amplitudechannel2_HE4", " ", neta, -41., 41., nphi, 0., bphi); + h_amplitudechannel0_HE5 = fs_->make("h_amplitudechannel0_HE5", " ", neta, -41., 41., nphi, 0., bphi); + h_amplitudechannel1_HE5 = fs_->make("h_amplitudechannel1_HE5", " ", neta, -41., 41., nphi, 0., bphi); + h_amplitudechannel2_HE5 = fs_->make("h_amplitudechannel2_HE5", " ", neta, -41., 41., nphi, 0., bphi); + h_amplitudechannel0_HE6 = fs_->make("h_amplitudechannel0_HE6", " ", neta, -41., 41., nphi, 0., bphi); + h_amplitudechannel1_HE6 = fs_->make("h_amplitudechannel1_HE6", " ", neta, -41., 41., nphi, 0., bphi); + h_amplitudechannel2_HE6 = fs_->make("h_amplitudechannel2_HE6", " ", neta, -41., 41., nphi, 0., bphi); + h_amplitudechannel0_HE7 = fs_->make("h_amplitudechannel0_HE7", " ", neta, -41., 41., nphi, 0., bphi); + h_amplitudechannel1_HE7 = fs_->make("h_amplitudechannel1_HE7", " ", neta, -41., 41., nphi, 0., bphi); + h_amplitudechannel2_HE7 = fs_->make("h_amplitudechannel2_HE7", " ", neta, -41., 41., nphi, 0., bphi); //HF: - h_amplitudechannel0_HF1 = new TH2F("h_amplitudechannel0_HF1", " ", neta, -41., 41., nphi, 0., bphi); - h_amplitudechannel1_HF1 = new TH2F("h_amplitudechannel1_HF1", " ", neta, -41., 41., nphi, 0., bphi); - h_amplitudechannel2_HF1 = new TH2F("h_amplitudechannel2_HF1", " ", neta, -41., 41., nphi, 0., bphi); - h_amplitudechannel0_HF2 = new TH2F("h_amplitudechannel0_HF2", " ", neta, -41., 41., nphi, 0., bphi); - h_amplitudechannel1_HF2 = new TH2F("h_amplitudechannel1_HF2", " ", neta, -41., 41., nphi, 0., bphi); - h_amplitudechannel2_HF2 = new TH2F("h_amplitudechannel2_HF2", " ", neta, -41., 41., nphi, 0., bphi); - h_amplitudechannel0_HF3 = new TH2F("h_amplitudechannel0_HF3", " ", neta, -41., 41., nphi, 0., bphi); - h_amplitudechannel1_HF3 = new TH2F("h_amplitudechannel1_HF3", " ", neta, -41., 41., nphi, 0., bphi); - h_amplitudechannel2_HF3 = new TH2F("h_amplitudechannel2_HF3", " ", neta, -41., 41., nphi, 0., bphi); - h_amplitudechannel0_HF4 = new TH2F("h_amplitudechannel0_HF4", " ", neta, -41., 41., nphi, 0., bphi); - h_amplitudechannel1_HF4 = new TH2F("h_amplitudechannel1_HF4", " ", neta, -41., 41., nphi, 0., bphi); - h_amplitudechannel2_HF4 = new TH2F("h_amplitudechannel2_HF4", " ", neta, -41., 41., nphi, 0., bphi); + h_amplitudechannel0_HF1 = fs_->make("h_amplitudechannel0_HF1", " ", neta, -41., 41., nphi, 0., bphi); + h_amplitudechannel1_HF1 = fs_->make("h_amplitudechannel1_HF1", " ", neta, -41., 41., nphi, 0., bphi); + h_amplitudechannel2_HF1 = fs_->make("h_amplitudechannel2_HF1", " ", neta, -41., 41., nphi, 0., bphi); + h_amplitudechannel0_HF2 = fs_->make("h_amplitudechannel0_HF2", " ", neta, -41., 41., nphi, 0., bphi); + h_amplitudechannel1_HF2 = fs_->make("h_amplitudechannel1_HF2", " ", neta, -41., 41., nphi, 0., bphi); + h_amplitudechannel2_HF2 = fs_->make("h_amplitudechannel2_HF2", " ", neta, -41., 41., nphi, 0., bphi); + h_amplitudechannel0_HF3 = fs_->make("h_amplitudechannel0_HF3", " ", neta, -41., 41., nphi, 0., bphi); + h_amplitudechannel1_HF3 = fs_->make("h_amplitudechannel1_HF3", " ", neta, -41., 41., nphi, 0., bphi); + h_amplitudechannel2_HF3 = fs_->make("h_amplitudechannel2_HF3", " ", neta, -41., 41., nphi, 0., bphi); + h_amplitudechannel0_HF4 = fs_->make("h_amplitudechannel0_HF4", " ", neta, -41., 41., nphi, 0., bphi); + h_amplitudechannel1_HF4 = fs_->make("h_amplitudechannel1_HF4", " ", neta, -41., 41., nphi, 0., bphi); + h_amplitudechannel2_HF4 = fs_->make("h_amplitudechannel2_HF4", " ", neta, -41., 41., nphi, 0., bphi); // Reco - h_energyhitSignal_HB = new TH1F("h_energyhitSignal_HB", " ", npfit, 0., 0.); // - h_energyhitSignal_HE = new TH1F("h_energyhitSignal_HE", " ", npfit, 0., 0.); // - h_energyhitSignal_HF = new TH1F("h_energyhitSignal_HF", " ", npfit, 0., 0.); // - h_energyhitNoise_HB = new TH1F("h_energyhitNoise_HB", " ", npfit, 0., 0.); // - h_energyhitNoise_HE = new TH1F("h_energyhitNoise_HE", " ", npfit, 0., 0.); // - h_energyhitNoise_HF = new TH1F("h_energyhitNoise_HF", " ", npfit, 0., 0.); // + h_energyhitSignal_HB = fs_->make("h_energyhitSignal_HB", " ", npfit, 0., 0.); // + h_energyhitSignal_HE = fs_->make("h_energyhitSignal_HE", " ", npfit, 0., 0.); // + h_energyhitSignal_HF = fs_->make("h_energyhitSignal_HF", " ", npfit, 0., 0.); // + h_energyhitNoise_HB = fs_->make("h_energyhitNoise_HB", " ", npfit, 0., 0.); // + h_energyhitNoise_HE = fs_->make("h_energyhitNoise_HE", " ", npfit, 0., 0.); // + h_energyhitNoise_HF = fs_->make("h_energyhitNoise_HF", " ", npfit, 0., 0.); // //HB: - h_recSignalEnergy0_HB1 = new TH2F("h_recSignalEnergy0_HB1", " ", neta, -41., 41., nphi, 0., bphi); - h_recSignalEnergy1_HB1 = new TH2F("h_recSignalEnergy1_HB1", " ", neta, -41., 41., nphi, 0., bphi); - h_recSignalEnergy2_HB1 = new TH2F("h_recSignalEnergy2_HB1", " ", neta, -41., 41., nphi, 0., bphi); - h_recSignalEnergy0_HB2 = new TH2F("h_recSignalEnergy0_HB2", " ", neta, -41., 41., nphi, 0., bphi); - h_recSignalEnergy1_HB2 = new TH2F("h_recSignalEnergy1_HB2", " ", neta, -41., 41., nphi, 0., bphi); - h_recSignalEnergy2_HB2 = new TH2F("h_recSignalEnergy2_HB2", " ", neta, -41., 41., nphi, 0., bphi); - h_recSignalEnergy0_HB3 = new TH2F("h_recSignalEnergy0_HB3", " ", neta, -41., 41., nphi, 0., bphi); - h_recSignalEnergy1_HB3 = new TH2F("h_recSignalEnergy1_HB3", " ", neta, -41., 41., nphi, 0., bphi); - h_recSignalEnergy2_HB3 = new TH2F("h_recSignalEnergy2_HB3", " ", neta, -41., 41., nphi, 0., bphi); - h_recSignalEnergy0_HB4 = new TH2F("h_recSignalEnergy0_HB4", " ", neta, -41., 41., nphi, 0., bphi); - h_recSignalEnergy1_HB4 = new TH2F("h_recSignalEnergy1_HB4", " ", neta, -41., 41., nphi, 0., bphi); - h_recSignalEnergy2_HB4 = new TH2F("h_recSignalEnergy2_HB4", " ", neta, -41., 41., nphi, 0., bphi); - - h_recNoiseEnergy0_HB1 = new TH2F("h_recNoiseEnergy0_HB1", " ", neta, -41., 41., nphi, 0., bphi); - h_recNoiseEnergy1_HB1 = new TH2F("h_recNoiseEnergy1_HB1", " ", neta, -41., 41., nphi, 0., bphi); - h_recNoiseEnergy2_HB1 = new TH2F("h_recNoiseEnergy2_HB1", " ", neta, -41., 41., nphi, 0., bphi); - h_recNoiseEnergy0_HB2 = new TH2F("h_recNoiseEnergy0_HB2", " ", neta, -41., 41., nphi, 0., bphi); - h_recNoiseEnergy1_HB2 = new TH2F("h_recNoiseEnergy1_HB2", " ", neta, -41., 41., nphi, 0., bphi); - h_recNoiseEnergy2_HB2 = new TH2F("h_recNoiseEnergy2_HB2", " ", neta, -41., 41., nphi, 0., bphi); - h_recNoiseEnergy0_HB3 = new TH2F("h_recNoiseEnergy0_HB3", " ", neta, -41., 41., nphi, 0., bphi); - h_recNoiseEnergy1_HB3 = new TH2F("h_recNoiseEnergy1_HB3", " ", neta, -41., 41., nphi, 0., bphi); - h_recNoiseEnergy2_HB3 = new TH2F("h_recNoiseEnergy2_HB3", " ", neta, -41., 41., nphi, 0., bphi); - h_recNoiseEnergy0_HB4 = new TH2F("h_recNoiseEnergy0_HB4", " ", neta, -41., 41., nphi, 0., bphi); - h_recNoiseEnergy1_HB4 = new TH2F("h_recNoiseEnergy1_HB4", " ", neta, -41., 41., nphi, 0., bphi); - h_recNoiseEnergy2_HB4 = new TH2F("h_recNoiseEnergy2_HB4", " ", neta, -41., 41., nphi, 0., bphi); + h_recSignalEnergy0_HB1 = fs_->make("h_recSignalEnergy0_HB1", " ", neta, -41., 41., nphi, 0., bphi); + h_recSignalEnergy1_HB1 = fs_->make("h_recSignalEnergy1_HB1", " ", neta, -41., 41., nphi, 0., bphi); + h_recSignalEnergy2_HB1 = fs_->make("h_recSignalEnergy2_HB1", " ", neta, -41., 41., nphi, 0., bphi); + h_recSignalEnergy0_HB2 = fs_->make("h_recSignalEnergy0_HB2", " ", neta, -41., 41., nphi, 0., bphi); + h_recSignalEnergy1_HB2 = fs_->make("h_recSignalEnergy1_HB2", " ", neta, -41., 41., nphi, 0., bphi); + h_recSignalEnergy2_HB2 = fs_->make("h_recSignalEnergy2_HB2", " ", neta, -41., 41., nphi, 0., bphi); + h_recSignalEnergy0_HB3 = fs_->make("h_recSignalEnergy0_HB3", " ", neta, -41., 41., nphi, 0., bphi); + h_recSignalEnergy1_HB3 = fs_->make("h_recSignalEnergy1_HB3", " ", neta, -41., 41., nphi, 0., bphi); + h_recSignalEnergy2_HB3 = fs_->make("h_recSignalEnergy2_HB3", " ", neta, -41., 41., nphi, 0., bphi); + h_recSignalEnergy0_HB4 = fs_->make("h_recSignalEnergy0_HB4", " ", neta, -41., 41., nphi, 0., bphi); + h_recSignalEnergy1_HB4 = fs_->make("h_recSignalEnergy1_HB4", " ", neta, -41., 41., nphi, 0., bphi); + h_recSignalEnergy2_HB4 = fs_->make("h_recSignalEnergy2_HB4", " ", neta, -41., 41., nphi, 0., bphi); + + h_recNoiseEnergy0_HB1 = fs_->make("h_recNoiseEnergy0_HB1", " ", neta, -41., 41., nphi, 0., bphi); + h_recNoiseEnergy1_HB1 = fs_->make("h_recNoiseEnergy1_HB1", " ", neta, -41., 41., nphi, 0., bphi); + h_recNoiseEnergy2_HB1 = fs_->make("h_recNoiseEnergy2_HB1", " ", neta, -41., 41., nphi, 0., bphi); + h_recNoiseEnergy0_HB2 = fs_->make("h_recNoiseEnergy0_HB2", " ", neta, -41., 41., nphi, 0., bphi); + h_recNoiseEnergy1_HB2 = fs_->make("h_recNoiseEnergy1_HB2", " ", neta, -41., 41., nphi, 0., bphi); + h_recNoiseEnergy2_HB2 = fs_->make("h_recNoiseEnergy2_HB2", " ", neta, -41., 41., nphi, 0., bphi); + h_recNoiseEnergy0_HB3 = fs_->make("h_recNoiseEnergy0_HB3", " ", neta, -41., 41., nphi, 0., bphi); + h_recNoiseEnergy1_HB3 = fs_->make("h_recNoiseEnergy1_HB3", " ", neta, -41., 41., nphi, 0., bphi); + h_recNoiseEnergy2_HB3 = fs_->make("h_recNoiseEnergy2_HB3", " ", neta, -41., 41., nphi, 0., bphi); + h_recNoiseEnergy0_HB4 = fs_->make("h_recNoiseEnergy0_HB4", " ", neta, -41., 41., nphi, 0., bphi); + h_recNoiseEnergy1_HB4 = fs_->make("h_recNoiseEnergy1_HB4", " ", neta, -41., 41., nphi, 0., bphi); + h_recNoiseEnergy2_HB4 = fs_->make("h_recNoiseEnergy2_HB4", " ", neta, -41., 41., nphi, 0., bphi); //HE: - h_recSignalEnergy0_HE1 = new TH2F("h_recSignalEnergy0_HE1", " ", neta, -41., 41., nphi, 0., bphi); - h_recSignalEnergy1_HE1 = new TH2F("h_recSignalEnergy1_HE1", " ", neta, -41., 41., nphi, 0., bphi); - h_recSignalEnergy2_HE1 = new TH2F("h_recSignalEnergy2_HE1", " ", neta, -41., 41., nphi, 0., bphi); - h_recSignalEnergy0_HE2 = new TH2F("h_recSignalEnergy0_HE2", " ", neta, -41., 41., nphi, 0., bphi); - h_recSignalEnergy1_HE2 = new TH2F("h_recSignalEnergy1_HE2", " ", neta, -41., 41., nphi, 0., bphi); - h_recSignalEnergy2_HE2 = new TH2F("h_recSignalEnergy2_HE2", " ", neta, -41., 41., nphi, 0., bphi); - h_recSignalEnergy0_HE3 = new TH2F("h_recSignalEnergy0_HE3", " ", neta, -41., 41., nphi, 0., bphi); - h_recSignalEnergy1_HE3 = new TH2F("h_recSignalEnergy1_HE3", " ", neta, -41., 41., nphi, 0., bphi); - h_recSignalEnergy2_HE3 = new TH2F("h_recSignalEnergy2_HE3", " ", neta, -41., 41., nphi, 0., bphi); - h_recSignalEnergy0_HE4 = new TH2F("h_recSignalEnergy0_HE4", " ", neta, -41., 41., nphi, 0., bphi); - h_recSignalEnergy1_HE4 = new TH2F("h_recSignalEnergy1_HE4", " ", neta, -41., 41., nphi, 0., bphi); - h_recSignalEnergy2_HE4 = new TH2F("h_recSignalEnergy2_HE4", " ", neta, -41., 41., nphi, 0., bphi); - h_recSignalEnergy0_HE5 = new TH2F("h_recSignalEnergy0_HE5", " ", neta, -41., 41., nphi, 0., bphi); - h_recSignalEnergy1_HE5 = new TH2F("h_recSignalEnergy1_HE5", " ", neta, -41., 41., nphi, 0., bphi); - h_recSignalEnergy2_HE5 = new TH2F("h_recSignalEnergy2_HE5", " ", neta, -41., 41., nphi, 0., bphi); - h_recSignalEnergy0_HE6 = new TH2F("h_recSignalEnergy0_HE6", " ", neta, -41., 41., nphi, 0., bphi); - h_recSignalEnergy1_HE6 = new TH2F("h_recSignalEnergy1_HE6", " ", neta, -41., 41., nphi, 0., bphi); - h_recSignalEnergy2_HE6 = new TH2F("h_recSignalEnergy2_HE6", " ", neta, -41., 41., nphi, 0., bphi); - h_recSignalEnergy0_HE7 = new TH2F("h_recSignalEnergy0_HE7", " ", neta, -41., 41., nphi, 0., bphi); - h_recSignalEnergy1_HE7 = new TH2F("h_recSignalEnergy1_HE7", " ", neta, -41., 41., nphi, 0., bphi); - h_recSignalEnergy2_HE7 = new TH2F("h_recSignalEnergy2_HE7", " ", neta, -41., 41., nphi, 0., bphi); - - h_recNoiseEnergy0_HE1 = new TH2F("h_recNoiseEnergy0_HE1", " ", neta, -41., 41., nphi, 0., bphi); - h_recNoiseEnergy1_HE1 = new TH2F("h_recNoiseEnergy1_HE1", " ", neta, -41., 41., nphi, 0., bphi); - h_recNoiseEnergy2_HE1 = new TH2F("h_recNoiseEnergy2_HE1", " ", neta, -41., 41., nphi, 0., bphi); - h_recNoiseEnergy0_HE2 = new TH2F("h_recNoiseEnergy0_HE2", " ", neta, -41., 41., nphi, 0., bphi); - h_recNoiseEnergy1_HE2 = new TH2F("h_recNoiseEnergy1_HE2", " ", neta, -41., 41., nphi, 0., bphi); - h_recNoiseEnergy2_HE2 = new TH2F("h_recNoiseEnergy2_HE2", " ", neta, -41., 41., nphi, 0., bphi); - h_recNoiseEnergy0_HE3 = new TH2F("h_recNoiseEnergy0_HE3", " ", neta, -41., 41., nphi, 0., bphi); - h_recNoiseEnergy1_HE3 = new TH2F("h_recNoiseEnergy1_HE3", " ", neta, -41., 41., nphi, 0., bphi); - h_recNoiseEnergy2_HE3 = new TH2F("h_recNoiseEnergy2_HE3", " ", neta, -41., 41., nphi, 0., bphi); - h_recNoiseEnergy0_HE4 = new TH2F("h_recNoiseEnergy0_HE4", " ", neta, -41., 41., nphi, 0., bphi); - h_recNoiseEnergy1_HE4 = new TH2F("h_recNoiseEnergy1_HE4", " ", neta, -41., 41., nphi, 0., bphi); - h_recNoiseEnergy2_HE4 = new TH2F("h_recNoiseEnergy2_HE4", " ", neta, -41., 41., nphi, 0., bphi); - h_recNoiseEnergy0_HE5 = new TH2F("h_recNoiseEnergy0_HE5", " ", neta, -41., 41., nphi, 0., bphi); - h_recNoiseEnergy1_HE5 = new TH2F("h_recNoiseEnergy1_HE5", " ", neta, -41., 41., nphi, 0., bphi); - h_recNoiseEnergy2_HE5 = new TH2F("h_recNoiseEnergy2_HE5", " ", neta, -41., 41., nphi, 0., bphi); - h_recNoiseEnergy0_HE6 = new TH2F("h_recNoiseEnergy0_HE6", " ", neta, -41., 41., nphi, 0., bphi); - h_recNoiseEnergy1_HE6 = new TH2F("h_recNoiseEnergy1_HE6", " ", neta, -41., 41., nphi, 0., bphi); - h_recNoiseEnergy2_HE6 = new TH2F("h_recNoiseEnergy2_HE6", " ", neta, -41., 41., nphi, 0., bphi); - h_recNoiseEnergy0_HE7 = new TH2F("h_recNoiseEnergy0_HE7", " ", neta, -41., 41., nphi, 0., bphi); - h_recNoiseEnergy1_HE7 = new TH2F("h_recNoiseEnergy1_HE7", " ", neta, -41., 41., nphi, 0., bphi); - h_recNoiseEnergy2_HE7 = new TH2F("h_recNoiseEnergy2_HE7", " ", neta, -41., 41., nphi, 0., bphi); + h_recSignalEnergy0_HE1 = fs_->make("h_recSignalEnergy0_HE1", " ", neta, -41., 41., nphi, 0., bphi); + h_recSignalEnergy1_HE1 = fs_->make("h_recSignalEnergy1_HE1", " ", neta, -41., 41., nphi, 0., bphi); + h_recSignalEnergy2_HE1 = fs_->make("h_recSignalEnergy2_HE1", " ", neta, -41., 41., nphi, 0., bphi); + h_recSignalEnergy0_HE2 = fs_->make("h_recSignalEnergy0_HE2", " ", neta, -41., 41., nphi, 0., bphi); + h_recSignalEnergy1_HE2 = fs_->make("h_recSignalEnergy1_HE2", " ", neta, -41., 41., nphi, 0., bphi); + h_recSignalEnergy2_HE2 = fs_->make("h_recSignalEnergy2_HE2", " ", neta, -41., 41., nphi, 0., bphi); + h_recSignalEnergy0_HE3 = fs_->make("h_recSignalEnergy0_HE3", " ", neta, -41., 41., nphi, 0., bphi); + h_recSignalEnergy1_HE3 = fs_->make("h_recSignalEnergy1_HE3", " ", neta, -41., 41., nphi, 0., bphi); + h_recSignalEnergy2_HE3 = fs_->make("h_recSignalEnergy2_HE3", " ", neta, -41., 41., nphi, 0., bphi); + h_recSignalEnergy0_HE4 = fs_->make("h_recSignalEnergy0_HE4", " ", neta, -41., 41., nphi, 0., bphi); + h_recSignalEnergy1_HE4 = fs_->make("h_recSignalEnergy1_HE4", " ", neta, -41., 41., nphi, 0., bphi); + h_recSignalEnergy2_HE4 = fs_->make("h_recSignalEnergy2_HE4", " ", neta, -41., 41., nphi, 0., bphi); + h_recSignalEnergy0_HE5 = fs_->make("h_recSignalEnergy0_HE5", " ", neta, -41., 41., nphi, 0., bphi); + h_recSignalEnergy1_HE5 = fs_->make("h_recSignalEnergy1_HE5", " ", neta, -41., 41., nphi, 0., bphi); + h_recSignalEnergy2_HE5 = fs_->make("h_recSignalEnergy2_HE5", " ", neta, -41., 41., nphi, 0., bphi); + h_recSignalEnergy0_HE6 = fs_->make("h_recSignalEnergy0_HE6", " ", neta, -41., 41., nphi, 0., bphi); + h_recSignalEnergy1_HE6 = fs_->make("h_recSignalEnergy1_HE6", " ", neta, -41., 41., nphi, 0., bphi); + h_recSignalEnergy2_HE6 = fs_->make("h_recSignalEnergy2_HE6", " ", neta, -41., 41., nphi, 0., bphi); + h_recSignalEnergy0_HE7 = fs_->make("h_recSignalEnergy0_HE7", " ", neta, -41., 41., nphi, 0., bphi); + h_recSignalEnergy1_HE7 = fs_->make("h_recSignalEnergy1_HE7", " ", neta, -41., 41., nphi, 0., bphi); + h_recSignalEnergy2_HE7 = fs_->make("h_recSignalEnergy2_HE7", " ", neta, -41., 41., nphi, 0., bphi); + + h_recNoiseEnergy0_HE1 = fs_->make("h_recNoiseEnergy0_HE1", " ", neta, -41., 41., nphi, 0., bphi); + h_recNoiseEnergy1_HE1 = fs_->make("h_recNoiseEnergy1_HE1", " ", neta, -41., 41., nphi, 0., bphi); + h_recNoiseEnergy2_HE1 = fs_->make("h_recNoiseEnergy2_HE1", " ", neta, -41., 41., nphi, 0., bphi); + h_recNoiseEnergy0_HE2 = fs_->make("h_recNoiseEnergy0_HE2", " ", neta, -41., 41., nphi, 0., bphi); + h_recNoiseEnergy1_HE2 = fs_->make("h_recNoiseEnergy1_HE2", " ", neta, -41., 41., nphi, 0., bphi); + h_recNoiseEnergy2_HE2 = fs_->make("h_recNoiseEnergy2_HE2", " ", neta, -41., 41., nphi, 0., bphi); + h_recNoiseEnergy0_HE3 = fs_->make("h_recNoiseEnergy0_HE3", " ", neta, -41., 41., nphi, 0., bphi); + h_recNoiseEnergy1_HE3 = fs_->make("h_recNoiseEnergy1_HE3", " ", neta, -41., 41., nphi, 0., bphi); + h_recNoiseEnergy2_HE3 = fs_->make("h_recNoiseEnergy2_HE3", " ", neta, -41., 41., nphi, 0., bphi); + h_recNoiseEnergy0_HE4 = fs_->make("h_recNoiseEnergy0_HE4", " ", neta, -41., 41., nphi, 0., bphi); + h_recNoiseEnergy1_HE4 = fs_->make("h_recNoiseEnergy1_HE4", " ", neta, -41., 41., nphi, 0., bphi); + h_recNoiseEnergy2_HE4 = fs_->make("h_recNoiseEnergy2_HE4", " ", neta, -41., 41., nphi, 0., bphi); + h_recNoiseEnergy0_HE5 = fs_->make("h_recNoiseEnergy0_HE5", " ", neta, -41., 41., nphi, 0., bphi); + h_recNoiseEnergy1_HE5 = fs_->make("h_recNoiseEnergy1_HE5", " ", neta, -41., 41., nphi, 0., bphi); + h_recNoiseEnergy2_HE5 = fs_->make("h_recNoiseEnergy2_HE5", " ", neta, -41., 41., nphi, 0., bphi); + h_recNoiseEnergy0_HE6 = fs_->make("h_recNoiseEnergy0_HE6", " ", neta, -41., 41., nphi, 0., bphi); + h_recNoiseEnergy1_HE6 = fs_->make("h_recNoiseEnergy1_HE6", " ", neta, -41., 41., nphi, 0., bphi); + h_recNoiseEnergy2_HE6 = fs_->make("h_recNoiseEnergy2_HE6", " ", neta, -41., 41., nphi, 0., bphi); + h_recNoiseEnergy0_HE7 = fs_->make("h_recNoiseEnergy0_HE7", " ", neta, -41., 41., nphi, 0., bphi); + h_recNoiseEnergy1_HE7 = fs_->make("h_recNoiseEnergy1_HE7", " ", neta, -41., 41., nphi, 0., bphi); + h_recNoiseEnergy2_HE7 = fs_->make("h_recNoiseEnergy2_HE7", " ", neta, -41., 41., nphi, 0., bphi); //HF: - h_recSignalEnergy0_HF1 = new TH2F("h_recSignalEnergy0_HF1", " ", neta, -41., 41., nphi, 0., bphi); - h_recSignalEnergy1_HF1 = new TH2F("h_recSignalEnergy1_HF1", " ", neta, -41., 41., nphi, 0., bphi); - h_recSignalEnergy2_HF1 = new TH2F("h_recSignalEnergy2_HF1", " ", neta, -41., 41., nphi, 0., bphi); - h_recSignalEnergy0_HF2 = new TH2F("h_recSignalEnergy0_HF2", " ", neta, -41., 41., nphi, 0., bphi); - h_recSignalEnergy1_HF2 = new TH2F("h_recSignalEnergy1_HF2", " ", neta, -41., 41., nphi, 0., bphi); - h_recSignalEnergy2_HF2 = new TH2F("h_recSignalEnergy2_HF2", " ", neta, -41., 41., nphi, 0., bphi); - - h_recNoiseEnergy0_HF1 = new TH2F("h_recNoiseEnergy0_HF1", " ", neta, -41., 41., nphi, 0., bphi); - h_recNoiseEnergy1_HF1 = new TH2F("h_recNoiseEnergy1_HF1", " ", neta, -41., 41., nphi, 0., bphi); - h_recNoiseEnergy2_HF1 = new TH2F("h_recNoiseEnergy2_HF1", " ", neta, -41., 41., nphi, 0., bphi); - h_recNoiseEnergy0_HF2 = new TH2F("h_recNoiseEnergy0_HF2", " ", neta, -41., 41., nphi, 0., bphi); - h_recNoiseEnergy1_HF2 = new TH2F("h_recNoiseEnergy1_HF2", " ", neta, -41., 41., nphi, 0., bphi); - h_recNoiseEnergy2_HF2 = new TH2F("h_recNoiseEnergy2_HF2", " ", neta, -41., 41., nphi, 0., bphi); + h_recSignalEnergy0_HF1 = fs_->make("h_recSignalEnergy0_HF1", " ", neta, -41., 41., nphi, 0., bphi); + h_recSignalEnergy1_HF1 = fs_->make("h_recSignalEnergy1_HF1", " ", neta, -41., 41., nphi, 0., bphi); + h_recSignalEnergy2_HF1 = fs_->make("h_recSignalEnergy2_HF1", " ", neta, -41., 41., nphi, 0., bphi); + h_recSignalEnergy0_HF2 = fs_->make("h_recSignalEnergy0_HF2", " ", neta, -41., 41., nphi, 0., bphi); + h_recSignalEnergy1_HF2 = fs_->make("h_recSignalEnergy1_HF2", " ", neta, -41., 41., nphi, 0., bphi); + h_recSignalEnergy2_HF2 = fs_->make("h_recSignalEnergy2_HF2", " ", neta, -41., 41., nphi, 0., bphi); + + h_recNoiseEnergy0_HF1 = fs_->make("h_recNoiseEnergy0_HF1", " ", neta, -41., 41., nphi, 0., bphi); + h_recNoiseEnergy1_HF1 = fs_->make("h_recNoiseEnergy1_HF1", " ", neta, -41., 41., nphi, 0., bphi); + h_recNoiseEnergy2_HF1 = fs_->make("h_recNoiseEnergy2_HF1", " ", neta, -41., 41., nphi, 0., bphi); + h_recNoiseEnergy0_HF2 = fs_->make("h_recNoiseEnergy0_HF2", " ", neta, -41., 41., nphi, 0., bphi); + h_recNoiseEnergy1_HF2 = fs_->make("h_recNoiseEnergy1_HF2", " ", neta, -41., 41., nphi, 0., bphi); + h_recNoiseEnergy2_HF2 = fs_->make("h_recNoiseEnergy2_HF2", " ", neta, -41., 41., nphi, 0., bphi); /////////////////////////////////////////////////////////////////////////////////////////////////// raddam: // RADDAM: @@ -7928,213 +6645,220 @@ void CMTRawAnalyzer::beginJob() { int min80 = -100.; int max80 = 9000.; // fill for each digi (=each event, each channel) - h_mapDepth1RADDAM_HE = new TH2F("h_mapDepth1RADDAM_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth2RADDAM_HE = new TH2F("h_mapDepth2RADDAM_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth3RADDAM_HE = new TH2F("h_mapDepth3RADDAM_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth1RADDAM0_HE = new TH2F("h_mapDepth1RADDAM0_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth2RADDAM0_HE = new TH2F("h_mapDepth2RADDAM0_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth3RADDAM0_HE = new TH2F("h_mapDepth3RADDAM0_HE", " ", neta, -41., 41., nphi, 0., bphi); - - h_sigLayer1RADDAM_HE = new TH1F("h_sigLayer1RADDAM_HE", " ", neta, -41., 41.); - h_sigLayer2RADDAM_HE = new TH1F("h_sigLayer2RADDAM_HE", " ", neta, -41., 41.); - h_sigLayer1RADDAM0_HE = new TH1F("h_sigLayer1RADDAM0_HE", " ", neta, -41., 41.); - h_sigLayer2RADDAM0_HE = new TH1F("h_sigLayer2RADDAM0_HE", " ", neta, -41., 41.); - h_AamplitudewithPedSubtr_RADDAM_HE = new TH1F("h_AamplitudewithPedSubtr_RADDAM_HE", " ", 100, min80, max80); + h_mapDepth1RADDAM_HE = fs_->make("h_mapDepth1RADDAM_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth2RADDAM_HE = fs_->make("h_mapDepth2RADDAM_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth3RADDAM_HE = fs_->make("h_mapDepth3RADDAM_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth1RADDAM0_HE = fs_->make("h_mapDepth1RADDAM0_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth2RADDAM0_HE = fs_->make("h_mapDepth2RADDAM0_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth3RADDAM0_HE = fs_->make("h_mapDepth3RADDAM0_HE", " ", neta, -41., 41., nphi, 0., bphi); + + h_sigLayer1RADDAM_HE = fs_->make("h_sigLayer1RADDAM_HE", " ", neta, -41., 41.); + h_sigLayer2RADDAM_HE = fs_->make("h_sigLayer2RADDAM_HE", " ", neta, -41., 41.); + h_sigLayer1RADDAM0_HE = fs_->make("h_sigLayer1RADDAM0_HE", " ", neta, -41., 41.); + h_sigLayer2RADDAM0_HE = fs_->make("h_sigLayer2RADDAM0_HE", " ", neta, -41., 41.); + h_AamplitudewithPedSubtr_RADDAM_HE = fs_->make("h_AamplitudewithPedSubtr_RADDAM_HE", " ", 100, min80, max80); h_AamplitudewithPedSubtr_RADDAM_HEzoom0 = - new TH1F("h_AamplitudewithPedSubtr_RADDAM_HEzoom0", " ", 100, min80, 4000.); + fs_->make("h_AamplitudewithPedSubtr_RADDAM_HEzoom0", " ", 100, min80, 4000.); h_AamplitudewithPedSubtr_RADDAM_HEzoom1 = - new TH1F("h_AamplitudewithPedSubtr_RADDAM_HEzoom1", " ", 100, min80, 1000.); - h_mapDepth3RADDAM16_HE = new TH1F("h_mapDepth3RADDAM16_HE", " ", 100, min80, max80); - h_A_Depth1RADDAM_HE = new TH1F("h_A_Depth1RADDAM_HE", " ", 100, min80, max80); - h_A_Depth2RADDAM_HE = new TH1F("h_A_Depth2RADDAM_HE", " ", 100, min80, max80); - h_A_Depth3RADDAM_HE = new TH1F("h_A_Depth3RADDAM_HE", " ", 100, min80, max80); + fs_->make("h_AamplitudewithPedSubtr_RADDAM_HEzoom1", " ", 100, min80, 1000.); + h_mapDepth3RADDAM16_HE = fs_->make("h_mapDepth3RADDAM16_HE", " ", 100, min80, max80); + h_A_Depth1RADDAM_HE = fs_->make("h_A_Depth1RADDAM_HE", " ", 100, min80, max80); + h_A_Depth2RADDAM_HE = fs_->make("h_A_Depth2RADDAM_HE", " ", 100, min80, max80); + h_A_Depth3RADDAM_HE = fs_->make("h_A_Depth3RADDAM_HE", " ", 100, min80, max80); int min90 = 0.; int max90 = 5000.; - h_sumphiEta16Depth3RADDAM_HED2 = new TH1F("h_sumphiEta16Depth3RADDAM_HED2", " ", 100, min90, 70. * max90); - h_Eta16Depth3RADDAM_HED2 = new TH1F("h_Eta16Depth3RADDAM_HED2", " ", 100, min90, max90); - h_NphiForEta16Depth3RADDAM_HED2 = new TH1F("h_NphiForEta16Depth3RADDAM_HED2", " ", 100, 0, 100.); - h_sumphiEta16Depth3RADDAM_HED2P = new TH1F("h_sumphiEta16Depth3RADDAM_HED2P", " ", 100, min90, 70. * max90); - h_Eta16Depth3RADDAM_HED2P = new TH1F("h_Eta16Depth3RADDAM_HED2P", " ", 100, min90, max90); - h_NphiForEta16Depth3RADDAM_HED2P = new TH1F("h_NphiForEta16Depth3RADDAM_HED2P", " ", 100, 0, 100.); - h_sumphiEta16Depth3RADDAM_HED2ALL = new TH1F("h_sumphiEta16Depth3RADDAM_HED2ALL", " ", 100, min90, 70. * max90); - h_Eta16Depth3RADDAM_HED2ALL = new TH1F("h_Eta16Depth3RADDAM_HED2ALL", " ", 100, min90, max90); - h_NphiForEta16Depth3RADDAM_HED2ALL = new TH1F("h_NphiForEta16Depth3RADDAM_HED2ALL", " ", 100, 0, 100.); - h_sigLayer1RADDAM5_HE = new TH1F("h_sigLayer1RADDAM5_HE", " ", neta, -41., 41.); - h_sigLayer2RADDAM5_HE = new TH1F("h_sigLayer2RADDAM5_HE", " ", neta, -41., 41.); - h_sigLayer1RADDAM6_HE = new TH1F("h_sigLayer1RADDAM6_HE", " ", neta, -41., 41.); - h_sigLayer2RADDAM6_HE = new TH1F("h_sigLayer2RADDAM6_HE", " ", neta, -41., 41.); - h_sigLayer1RADDAM5_HED2 = new TH1F("h_sigLayer1RADDAM5_HED2", " ", neta, -41., 41.); - h_sigLayer2RADDAM5_HED2 = new TH1F("h_sigLayer2RADDAM5_HED2", " ", neta, -41., 41.); - h_sigLayer1RADDAM6_HED2 = new TH1F("h_sigLayer1RADDAM6_HED2", " ", neta, -41., 41.); - h_sigLayer2RADDAM6_HED2 = new TH1F("h_sigLayer2RADDAM6_HED2", " ", neta, -41., 41.); - - h_numberofhitsHFtest = new TH1F("h_numberofhitsHFtest", " ", 100, 0., 30000.); - h_AmplitudeHFtest = new TH1F("h_AmplitudeHFtest", " ", 100, 0., 300000.); - h_totalAmplitudeHF = new TH1F("h_totalAmplitudeHF", " ", 100, 0., 100000000000.); - h_totalAmplitudeHFperEvent = new TH1F("h_totalAmplitudeHFperEvent", " ", 1000, 1., 1001.); + h_sumphiEta16Depth3RADDAM_HED2 = fs_->make("h_sumphiEta16Depth3RADDAM_HED2", " ", 100, min90, 70. * max90); + h_Eta16Depth3RADDAM_HED2 = fs_->make("h_Eta16Depth3RADDAM_HED2", " ", 100, min90, max90); + h_NphiForEta16Depth3RADDAM_HED2 = fs_->make("h_NphiForEta16Depth3RADDAM_HED2", " ", 100, 0, 100.); + h_sumphiEta16Depth3RADDAM_HED2P = fs_->make("h_sumphiEta16Depth3RADDAM_HED2P", " ", 100, min90, 70. * max90); + h_Eta16Depth3RADDAM_HED2P = fs_->make("h_Eta16Depth3RADDAM_HED2P", " ", 100, min90, max90); + h_NphiForEta16Depth3RADDAM_HED2P = fs_->make("h_NphiForEta16Depth3RADDAM_HED2P", " ", 100, 0, 100.); + h_sumphiEta16Depth3RADDAM_HED2ALL = + fs_->make("h_sumphiEta16Depth3RADDAM_HED2ALL", " ", 100, min90, 70. * max90); + h_Eta16Depth3RADDAM_HED2ALL = fs_->make("h_Eta16Depth3RADDAM_HED2ALL", " ", 100, min90, max90); + h_NphiForEta16Depth3RADDAM_HED2ALL = fs_->make("h_NphiForEta16Depth3RADDAM_HED2ALL", " ", 100, 0, 100.); + h_sigLayer1RADDAM5_HE = fs_->make("h_sigLayer1RADDAM5_HE", " ", neta, -41., 41.); + h_sigLayer2RADDAM5_HE = fs_->make("h_sigLayer2RADDAM5_HE", " ", neta, -41., 41.); + h_sigLayer1RADDAM6_HE = fs_->make("h_sigLayer1RADDAM6_HE", " ", neta, -41., 41.); + h_sigLayer2RADDAM6_HE = fs_->make("h_sigLayer2RADDAM6_HE", " ", neta, -41., 41.); + h_sigLayer1RADDAM5_HED2 = fs_->make("h_sigLayer1RADDAM5_HED2", " ", neta, -41., 41.); + h_sigLayer2RADDAM5_HED2 = fs_->make("h_sigLayer2RADDAM5_HED2", " ", neta, -41., 41.); + h_sigLayer1RADDAM6_HED2 = fs_->make("h_sigLayer1RADDAM6_HED2", " ", neta, -41., 41.); + h_sigLayer2RADDAM6_HED2 = fs_->make("h_sigLayer2RADDAM6_HED2", " ", neta, -41., 41.); + + h_numberofhitsHFtest = fs_->make("h_numberofhitsHFtest", " ", 100, 0., 30000.); + h_AmplitudeHFtest = fs_->make("h_AmplitudeHFtest", " ", 100, 0., 300000.); + h_totalAmplitudeHF = fs_->make("h_totalAmplitudeHF", " ", 100, 0., 100000000000.); + h_totalAmplitudeHFperEvent = fs_->make("h_totalAmplitudeHFperEvent", " ", 1000, 1., 1001.); // fullAmplitude: - h_ADCAmplZoom1_HF = new TH1F("h_ADCAmplZoom1_HF", " ", 100, 0., 1000000.); - h_ADCAmpl_HF = new TH1F("h_ADCAmpl_HF", " ", 250, 0., 500000.); - h_ADCAmplrest1_HF = new TH1F("h_ADCAmplrest1_HF", " ", 100, 0., 1000.); - h_ADCAmplrest6_HF = new TH1F("h_ADCAmplrest6_HF", " ", 100, 0., 10000.); - - h_mapDepth1ADCAmpl225_HF = new TH2F("h_mapDepth1ADCAmpl225_HF", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth2ADCAmpl225_HF = new TH2F("h_mapDepth2ADCAmpl225_HF", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth1ADCAmpl225Copy_HF = new TH2F("h_mapDepth1ADCAmpl225Copy_HF", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth2ADCAmpl225Copy_HF = new TH2F("h_mapDepth2ADCAmpl225Copy_HF", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth1ADCAmpl_HF = new TH2F("h_mapDepth1ADCAmpl_HF", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth2ADCAmpl_HF = new TH2F("h_mapDepth2ADCAmpl_HF", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth3ADCAmpl225_HF = new TH2F("h_mapDepth3ADCAmpl225_HF", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth4ADCAmpl225_HF = new TH2F("h_mapDepth4ADCAmpl225_HF", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth3ADCAmpl225Copy_HF = new TH2F("h_mapDepth3ADCAmpl225Copy_HF", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth4ADCAmpl225Copy_HF = new TH2F("h_mapDepth4ADCAmpl225Copy_HF", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth3ADCAmpl_HF = new TH2F("h_mapDepth3ADCAmpl_HF", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth4ADCAmpl_HF = new TH2F("h_mapDepth4ADCAmpl_HF", " ", neta, -41., 41., nphi, 0., bphi); - h_TSmeanA_HF = new TH1F("h_TSmeanA_HF", " ", 100, -1., 11.); - h_mapDepth1TSmeanA225_HF = new TH2F("h_mapDepth1TSmeanA225_HF", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth2TSmeanA225_HF = new TH2F("h_mapDepth2TSmeanA225_HF", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth1TSmeanA_HF = new TH2F("h_mapDepth1TSmeanA_HF", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth2TSmeanA_HF = new TH2F("h_mapDepth2TSmeanA_HF", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth3TSmeanA225_HF = new TH2F("h_mapDepth3TSmeanA225_HF", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth4TSmeanA225_HF = new TH2F("h_mapDepth4TSmeanA225_HF", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth3TSmeanA_HF = new TH2F("h_mapDepth3TSmeanA_HF", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth4TSmeanA_HF = new TH2F("h_mapDepth4TSmeanA_HF", " ", neta, -41., 41., nphi, 0., bphi); - h_Amplitude_HF = new TH1F("h_Amplitude_HF", " ", 100, 0., 5.); - h_TSmaxA_HF = new TH1F("h_TSmaxA_HF", " ", 100, -1., 11.); - h_mapDepth1TSmaxA225_HF = new TH2F("h_mapDepth1TSmaxA225_HF", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth2TSmaxA225_HF = new TH2F("h_mapDepth2TSmaxA225_HF", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth1TSmaxA_HF = new TH2F("h_mapDepth1TSmaxA_HF", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth2TSmaxA_HF = new TH2F("h_mapDepth2TSmaxA_HF", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth3TSmaxA225_HF = new TH2F("h_mapDepth3TSmaxA225_HF", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth4TSmaxA225_HF = new TH2F("h_mapDepth4TSmaxA225_HF", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth3TSmaxA_HF = new TH2F("h_mapDepth3TSmaxA_HF", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth4TSmaxA_HF = new TH2F("h_mapDepth4TSmaxA_HF", " ", neta, -41., 41., nphi, 0., bphi); - h_Amplitude_HF = new TH1F("h_Amplitude_HF", " ", 100, 0., 5.); - h_mapDepth1Amplitude225_HF = new TH2F("h_mapDepth1Amplitude225_HF", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth2Amplitude225_HF = new TH2F("h_mapDepth2Amplitude225_HF", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth1Amplitude_HF = new TH2F("h_mapDepth1Amplitude_HF", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth2Amplitude_HF = new TH2F("h_mapDepth2Amplitude_HF", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth3Amplitude225_HF = new TH2F("h_mapDepth3Amplitude225_HF", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth4Amplitude225_HF = new TH2F("h_mapDepth4Amplitude225_HF", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth3Amplitude_HF = new TH2F("h_mapDepth3Amplitude_HF", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth4Amplitude_HF = new TH2F("h_mapDepth4Amplitude_HF", " ", neta, -41., 41., nphi, 0., bphi); + h_ADCAmplZoom1_HF = fs_->make("h_ADCAmplZoom1_HF", " ", 100, 0., 1000000.); + h_ADCAmpl_HF = fs_->make("h_ADCAmpl_HF", " ", 250, 0., 500000.); + h_ADCAmplrest1_HF = fs_->make("h_ADCAmplrest1_HF", " ", 100, 0., 1000.); + h_ADCAmplrest6_HF = fs_->make("h_ADCAmplrest6_HF", " ", 100, 0., 10000.); + + h_mapDepth1ADCAmpl225_HF = fs_->make("h_mapDepth1ADCAmpl225_HF", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth2ADCAmpl225_HF = fs_->make("h_mapDepth2ADCAmpl225_HF", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth1ADCAmpl225Copy_HF = + fs_->make("h_mapDepth1ADCAmpl225Copy_HF", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth2ADCAmpl225Copy_HF = + fs_->make("h_mapDepth2ADCAmpl225Copy_HF", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth1ADCAmpl_HF = fs_->make("h_mapDepth1ADCAmpl_HF", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth2ADCAmpl_HF = fs_->make("h_mapDepth2ADCAmpl_HF", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth3ADCAmpl225_HF = fs_->make("h_mapDepth3ADCAmpl225_HF", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth4ADCAmpl225_HF = fs_->make("h_mapDepth4ADCAmpl225_HF", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth3ADCAmpl225Copy_HF = + fs_->make("h_mapDepth3ADCAmpl225Copy_HF", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth4ADCAmpl225Copy_HF = + fs_->make("h_mapDepth4ADCAmpl225Copy_HF", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth3ADCAmpl_HF = fs_->make("h_mapDepth3ADCAmpl_HF", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth4ADCAmpl_HF = fs_->make("h_mapDepth4ADCAmpl_HF", " ", neta, -41., 41., nphi, 0., bphi); + h_TSmeanA_HF = fs_->make("h_TSmeanA_HF", " ", 100, -1., 11.); + h_mapDepth1TSmeanA225_HF = fs_->make("h_mapDepth1TSmeanA225_HF", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth2TSmeanA225_HF = fs_->make("h_mapDepth2TSmeanA225_HF", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth1TSmeanA_HF = fs_->make("h_mapDepth1TSmeanA_HF", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth2TSmeanA_HF = fs_->make("h_mapDepth2TSmeanA_HF", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth3TSmeanA225_HF = fs_->make("h_mapDepth3TSmeanA225_HF", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth4TSmeanA225_HF = fs_->make("h_mapDepth4TSmeanA225_HF", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth3TSmeanA_HF = fs_->make("h_mapDepth3TSmeanA_HF", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth4TSmeanA_HF = fs_->make("h_mapDepth4TSmeanA_HF", " ", neta, -41., 41., nphi, 0., bphi); + h_Amplitude_HF = fs_->make("h_Amplitude_HF", " ", 100, 0., 5.); + h_TSmaxA_HF = fs_->make("h_TSmaxA_HF", " ", 100, -1., 11.); + h_mapDepth1TSmaxA225_HF = fs_->make("h_mapDepth1TSmaxA225_HF", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth2TSmaxA225_HF = fs_->make("h_mapDepth2TSmaxA225_HF", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth1TSmaxA_HF = fs_->make("h_mapDepth1TSmaxA_HF", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth2TSmaxA_HF = fs_->make("h_mapDepth2TSmaxA_HF", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth3TSmaxA225_HF = fs_->make("h_mapDepth3TSmaxA225_HF", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth4TSmaxA225_HF = fs_->make("h_mapDepth4TSmaxA225_HF", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth3TSmaxA_HF = fs_->make("h_mapDepth3TSmaxA_HF", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth4TSmaxA_HF = fs_->make("h_mapDepth4TSmaxA_HF", " ", neta, -41., 41., nphi, 0., bphi); + h_Amplitude_HF = fs_->make("h_Amplitude_HF", " ", 100, 0., 5.); + h_mapDepth1Amplitude225_HF = fs_->make("h_mapDepth1Amplitude225_HF", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth2Amplitude225_HF = fs_->make("h_mapDepth2Amplitude225_HF", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth1Amplitude_HF = fs_->make("h_mapDepth1Amplitude_HF", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth2Amplitude_HF = fs_->make("h_mapDepth2Amplitude_HF", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth3Amplitude225_HF = fs_->make("h_mapDepth3Amplitude225_HF", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth4Amplitude225_HF = fs_->make("h_mapDepth4Amplitude225_HF", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth3Amplitude_HF = fs_->make("h_mapDepth3Amplitude_HF", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth4Amplitude_HF = fs_->make("h_mapDepth4Amplitude_HF", " ", neta, -41., 41., nphi, 0., bphi); // Ratio: - h_Ampl_HF = new TH1F("h_Ampl_HF", " ", 100, 0., 1.1); - h_mapDepth1Ampl047_HF = new TH2F("h_mapDepth1Ampl047_HF", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth2Ampl047_HF = new TH2F("h_mapDepth2Ampl047_HF", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth1Ampl_HF = new TH2F("h_mapDepth1Ampl_HF", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth2Ampl_HF = new TH2F("h_mapDepth2Ampl_HF", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth1AmplE34_HF = new TH2F("h_mapDepth1AmplE34_HF", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth2AmplE34_HF = new TH2F("h_mapDepth2AmplE34_HF", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth1_HF = new TH2F("h_mapDepth1_HF", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth2_HF = new TH2F("h_mapDepth2_HF", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth3Ampl047_HF = new TH2F("h_mapDepth3Ampl047_HF", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth4Ampl047_HF = new TH2F("h_mapDepth4Ampl047_HF", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth3Ampl_HF = new TH2F("h_mapDepth3Ampl_HF", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth4Ampl_HF = new TH2F("h_mapDepth4Ampl_HF", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth3AmplE34_HF = new TH2F("h_mapDepth3AmplE34_HF", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth4AmplE34_HF = new TH2F("h_mapDepth4AmplE34_HF", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth3_HF = new TH2F("h_mapDepth3_HF", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth4_HF = new TH2F("h_mapDepth4_HF", " ", neta, -41., 41., nphi, 0., bphi); + h_Ampl_HF = fs_->make("h_Ampl_HF", " ", 100, 0., 1.1); + h_mapDepth1Ampl047_HF = fs_->make("h_mapDepth1Ampl047_HF", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth2Ampl047_HF = fs_->make("h_mapDepth2Ampl047_HF", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth1Ampl_HF = fs_->make("h_mapDepth1Ampl_HF", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth2Ampl_HF = fs_->make("h_mapDepth2Ampl_HF", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth1AmplE34_HF = fs_->make("h_mapDepth1AmplE34_HF", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth2AmplE34_HF = fs_->make("h_mapDepth2AmplE34_HF", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth1_HF = fs_->make("h_mapDepth1_HF", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth2_HF = fs_->make("h_mapDepth2_HF", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth3Ampl047_HF = fs_->make("h_mapDepth3Ampl047_HF", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth4Ampl047_HF = fs_->make("h_mapDepth4Ampl047_HF", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth3Ampl_HF = fs_->make("h_mapDepth3Ampl_HF", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth4Ampl_HF = fs_->make("h_mapDepth4Ampl_HF", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth3AmplE34_HF = fs_->make("h_mapDepth3AmplE34_HF", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth4AmplE34_HF = fs_->make("h_mapDepth4AmplE34_HF", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth3_HF = fs_->make("h_mapDepth3_HF", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth4_HF = fs_->make("h_mapDepth4_HF", " ", neta, -41., 41., nphi, 0., bphi); //////////////////////////////////////////////////////////////////////////////////////////////// HO - h_numberofhitsHOtest = new TH1F("h_numberofhitsHOtest", " ", 100, 0., 30000.); - h_AmplitudeHOtest = new TH1F("h_AmplitudeHOtest", " ", 100, 0., 300000.); - h_totalAmplitudeHO = new TH1F("h_totalAmplitudeHO", " ", 100, 0., 100000000.); - h_totalAmplitudeHOperEvent = new TH1F("h_totalAmplitudeHOperEvent", " ", 1000, 1., 1001.); + h_numberofhitsHOtest = fs_->make("h_numberofhitsHOtest", " ", 100, 0., 30000.); + h_AmplitudeHOtest = fs_->make("h_AmplitudeHOtest", " ", 100, 0., 300000.); + h_totalAmplitudeHO = fs_->make("h_totalAmplitudeHO", " ", 100, 0., 100000000.); + h_totalAmplitudeHOperEvent = fs_->make("h_totalAmplitudeHOperEvent", " ", 1000, 1., 1001.); // fullAmplitude: - h_ADCAmpl_HO = new TH1F("h_ADCAmpl_HO", " ", 100, 0., 7000.); - h_ADCAmplrest1_HO = new TH1F("h_ADCAmplrest1_HO", " ", 100, 0., 150.); - h_ADCAmplrest6_HO = new TH1F("h_ADCAmplrest6_HO", " ", 100, 0., 500.); - - h_ADCAmplZoom1_HO = new TH1F("h_ADCAmplZoom1_HO", " ", 100, -20., 280.); - h_ADCAmpl_HO_copy = new TH1F("h_ADCAmpl_HO_copy", " ", 100, 0., 30000.); - h_mapDepth4ADCAmpl225_HO = new TH2F("h_mapDepth4ADCAmpl225_HO", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth4ADCAmpl225Copy_HO = new TH2F("h_mapDepth4ADCAmpl225Copy_HO", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth4ADCAmpl_HO = new TH2F("h_mapDepth4ADCAmpl_HO", " ", neta, -41., 41., nphi, 0., bphi); - h_TSmeanA_HO = new TH1F("h_TSmeanA_HO", " ", 100, 0., 10.); - h_mapDepth4TSmeanA225_HO = new TH2F("h_mapDepth4TSmeanA225_HO", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth4TSmeanA_HO = new TH2F("h_mapDepth4TSmeanA_HO", " ", neta, -41., 41., nphi, 0., bphi); - h_TSmaxA_HO = new TH1F("h_TSmaxA_HO", " ", 100, 0., 10.); - h_mapDepth4TSmaxA225_HO = new TH2F("h_mapDepth4TSmaxA225_HO", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth4TSmaxA_HO = new TH2F("h_mapDepth4TSmaxA_HO", " ", neta, -41., 41., nphi, 0., bphi); - h_Amplitude_HO = new TH1F("h_Amplitude_HO", " ", 100, 0., 5.); - h_mapDepth4Amplitude225_HO = new TH2F("h_mapDepth4Amplitude225_HO", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth4Amplitude_HO = new TH2F("h_mapDepth4Amplitude_HO", " ", neta, -41., 41., nphi, 0., bphi); + h_ADCAmpl_HO = fs_->make("h_ADCAmpl_HO", " ", 100, 0., 7000.); + h_ADCAmplrest1_HO = fs_->make("h_ADCAmplrest1_HO", " ", 100, 0., 150.); + h_ADCAmplrest6_HO = fs_->make("h_ADCAmplrest6_HO", " ", 100, 0., 500.); + + h_ADCAmplZoom1_HO = fs_->make("h_ADCAmplZoom1_HO", " ", 100, -20., 280.); + h_ADCAmpl_HO_copy = fs_->make("h_ADCAmpl_HO_copy", " ", 100, 0., 30000.); + h_mapDepth4ADCAmpl225_HO = fs_->make("h_mapDepth4ADCAmpl225_HO", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth4ADCAmpl225Copy_HO = + fs_->make("h_mapDepth4ADCAmpl225Copy_HO", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth4ADCAmpl_HO = fs_->make("h_mapDepth4ADCAmpl_HO", " ", neta, -41., 41., nphi, 0., bphi); + h_TSmeanA_HO = fs_->make("h_TSmeanA_HO", " ", 100, 0., 10.); + h_mapDepth4TSmeanA225_HO = fs_->make("h_mapDepth4TSmeanA225_HO", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth4TSmeanA_HO = fs_->make("h_mapDepth4TSmeanA_HO", " ", neta, -41., 41., nphi, 0., bphi); + h_TSmaxA_HO = fs_->make("h_TSmaxA_HO", " ", 100, 0., 10.); + h_mapDepth4TSmaxA225_HO = fs_->make("h_mapDepth4TSmaxA225_HO", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth4TSmaxA_HO = fs_->make("h_mapDepth4TSmaxA_HO", " ", neta, -41., 41., nphi, 0., bphi); + h_Amplitude_HO = fs_->make("h_Amplitude_HO", " ", 100, 0., 5.); + h_mapDepth4Amplitude225_HO = fs_->make("h_mapDepth4Amplitude225_HO", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth4Amplitude_HO = fs_->make("h_mapDepth4Amplitude_HO", " ", neta, -41., 41., nphi, 0., bphi); // Ratio: - h_Ampl_HO = new TH1F("h_Ampl_HO", " ", 100, 0., 1.1); - h_mapDepth4Ampl047_HO = new TH2F("h_mapDepth4Ampl047_HO", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth4Ampl_HO = new TH2F("h_mapDepth4Ampl_HO", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth4AmplE34_HO = new TH2F("h_mapDepth4AmplE34_HO", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth4_HO = new TH2F("h_mapDepth4_HO", " ", neta, -41., 41., nphi, 0., bphi); + h_Ampl_HO = fs_->make("h_Ampl_HO", " ", 100, 0., 1.1); + h_mapDepth4Ampl047_HO = fs_->make("h_mapDepth4Ampl047_HO", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth4Ampl_HO = fs_->make("h_mapDepth4Ampl_HO", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth4AmplE34_HO = fs_->make("h_mapDepth4AmplE34_HO", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth4_HO = fs_->make("h_mapDepth4_HO", " ", neta, -41., 41., nphi, 0., bphi); ////////////////////////////////////////////////////////////////////////////////////// int baP = 4000; float baR = 0.; float baR2 = baP; - h_bcnnbadchannels_depth1_HB = new TH1F("h_bcnnbadchannels_depth1_HB", " ", baP, baR, baR2); - h_bcnnbadchannels_depth2_HB = new TH1F("h_bcnnbadchannels_depth2_HB", " ", baP, baR, baR2); - h_bcnnbadchannels_depth1_HE = new TH1F("h_bcnnbadchannels_depth1_HE", " ", baP, baR, baR2); - h_bcnnbadchannels_depth2_HE = new TH1F("h_bcnnbadchannels_depth2_HE", " ", baP, baR, baR2); - h_bcnnbadchannels_depth3_HE = new TH1F("h_bcnnbadchannels_depth3_HE", " ", baP, baR, baR2); - h_bcnnbadchannels_depth4_HO = new TH1F("h_bcnnbadchannels_depth4_HO", " ", baP, baR, baR2); - h_bcnnbadchannels_depth1_HF = new TH1F("h_bcnnbadchannels_depth1_HF", " ", baP, baR, baR2); - h_bcnnbadchannels_depth2_HF = new TH1F("h_bcnnbadchannels_depth2_HF", " ", baP, baR, baR2); - h_bcnbadrate0_depth1_HB = new TH1F("h_bcnbadrate0_depth1_HB", " ", baP, baR, baR2); - h_bcnbadrate0_depth2_HB = new TH1F("h_bcnbadrate0_depth2_HB", " ", baP, baR, baR2); - h_bcnbadrate0_depth1_HE = new TH1F("h_bcnbadrate0_depth1_HE", " ", baP, baR, baR2); - h_bcnbadrate0_depth2_HE = new TH1F("h_bcnbadrate0_depth2_HE", " ", baP, baR, baR2); - h_bcnbadrate0_depth3_HE = new TH1F("h_bcnbadrate0_depth3_HE", " ", baP, baR, baR2); - h_bcnbadrate0_depth4_HO = new TH1F("h_bcnbadrate0_depth4_HO", " ", baP, baR, baR2); - h_bcnbadrate0_depth1_HF = new TH1F("h_bcnbadrate0_depth1_HF", " ", baP, baR, baR2); - h_bcnbadrate0_depth2_HF = new TH1F("h_bcnbadrate0_depth2_HF", " ", baP, baR, baR2); - - h_bcnvsamplitude_HB = new TH1F("h_bcnvsamplitude_HB", " ", baP, baR, baR2); - h_bcnvsamplitude_HE = new TH1F("h_bcnvsamplitude_HE", " ", baP, baR, baR2); - h_bcnvsamplitude_HF = new TH1F("h_bcnvsamplitude_HF", " ", baP, baR, baR2); - h_bcnvsamplitude_HO = new TH1F("h_bcnvsamplitude_HO", " ", baP, baR, baR2); - h_bcnvsamplitude0_HB = new TH1F("h_bcnvsamplitude0_HB", " ", baP, baR, baR2); - h_bcnvsamplitude0_HE = new TH1F("h_bcnvsamplitude0_HE", " ", baP, baR, baR2); - h_bcnvsamplitude0_HF = new TH1F("h_bcnvsamplitude0_HF", " ", baP, baR, baR2); - h_bcnvsamplitude0_HO = new TH1F("h_bcnvsamplitude0_HO", " ", baP, baR, baR2); + h_bcnnbadchannels_depth1_HB = fs_->make("h_bcnnbadchannels_depth1_HB", " ", baP, baR, baR2); + h_bcnnbadchannels_depth2_HB = fs_->make("h_bcnnbadchannels_depth2_HB", " ", baP, baR, baR2); + h_bcnnbadchannels_depth1_HE = fs_->make("h_bcnnbadchannels_depth1_HE", " ", baP, baR, baR2); + h_bcnnbadchannels_depth2_HE = fs_->make("h_bcnnbadchannels_depth2_HE", " ", baP, baR, baR2); + h_bcnnbadchannels_depth3_HE = fs_->make("h_bcnnbadchannels_depth3_HE", " ", baP, baR, baR2); + h_bcnnbadchannels_depth4_HO = fs_->make("h_bcnnbadchannels_depth4_HO", " ", baP, baR, baR2); + h_bcnnbadchannels_depth1_HF = fs_->make("h_bcnnbadchannels_depth1_HF", " ", baP, baR, baR2); + h_bcnnbadchannels_depth2_HF = fs_->make("h_bcnnbadchannels_depth2_HF", " ", baP, baR, baR2); + h_bcnbadrate0_depth1_HB = fs_->make("h_bcnbadrate0_depth1_HB", " ", baP, baR, baR2); + h_bcnbadrate0_depth2_HB = fs_->make("h_bcnbadrate0_depth2_HB", " ", baP, baR, baR2); + h_bcnbadrate0_depth1_HE = fs_->make("h_bcnbadrate0_depth1_HE", " ", baP, baR, baR2); + h_bcnbadrate0_depth2_HE = fs_->make("h_bcnbadrate0_depth2_HE", " ", baP, baR, baR2); + h_bcnbadrate0_depth3_HE = fs_->make("h_bcnbadrate0_depth3_HE", " ", baP, baR, baR2); + h_bcnbadrate0_depth4_HO = fs_->make("h_bcnbadrate0_depth4_HO", " ", baP, baR, baR2); + h_bcnbadrate0_depth1_HF = fs_->make("h_bcnbadrate0_depth1_HF", " ", baP, baR, baR2); + h_bcnbadrate0_depth2_HF = fs_->make("h_bcnbadrate0_depth2_HF", " ", baP, baR, baR2); + + h_bcnvsamplitude_HB = fs_->make("h_bcnvsamplitude_HB", " ", baP, baR, baR2); + h_bcnvsamplitude_HE = fs_->make("h_bcnvsamplitude_HE", " ", baP, baR, baR2); + h_bcnvsamplitude_HF = fs_->make("h_bcnvsamplitude_HF", " ", baP, baR, baR2); + h_bcnvsamplitude_HO = fs_->make("h_bcnvsamplitude_HO", " ", baP, baR, baR2); + h_bcnvsamplitude0_HB = fs_->make("h_bcnvsamplitude0_HB", " ", baP, baR, baR2); + h_bcnvsamplitude0_HE = fs_->make("h_bcnvsamplitude0_HE", " ", baP, baR, baR2); + h_bcnvsamplitude0_HF = fs_->make("h_bcnvsamplitude0_HF", " ", baP, baR, baR2); + h_bcnvsamplitude0_HO = fs_->make("h_bcnvsamplitude0_HO", " ", baP, baR, baR2); int zaP = 1000; float zaR = 10000000.; float zaR2 = 50000000.; - h_orbitNumvsamplitude_HB = new TH1F("h_orbitNumvsamplitude_HB", " ", zaP, zaR, zaR2); - h_orbitNumvsamplitude_HE = new TH1F("h_orbitNumvsamplitude_HE", " ", zaP, zaR, zaR2); - h_orbitNumvsamplitude_HF = new TH1F("h_orbitNumvsamplitude_HF", " ", zaP, zaR, zaR2); - h_orbitNumvsamplitude_HO = new TH1F("h_orbitNumvsamplitude_HO", " ", zaP, zaR, zaR2); - h_orbitNumvsamplitude0_HB = new TH1F("h_orbitNumvsamplitude0_HB", " ", zaP, zaR, zaR2); - h_orbitNumvsamplitude0_HE = new TH1F("h_orbitNumvsamplitude0_HE", " ", zaP, zaR, zaR2); - h_orbitNumvsamplitude0_HF = new TH1F("h_orbitNumvsamplitude0_HF", " ", zaP, zaR, zaR2); - h_orbitNumvsamplitude0_HO = new TH1F("h_orbitNumvsamplitude0_HO", " ", zaP, zaR, zaR2); - - h_2DsumADCAmplEtaPhiLs0 = - new TH2F("h_2DsumADCAmplEtaPhiLs0", " ", nlsminmax, alsmin, blsmax, znphi * zneta, 1., znphi * zneta + 1.); - h_2DsumADCAmplEtaPhiLs1 = - new TH2F("h_2DsumADCAmplEtaPhiLs1", " ", nlsminmax, alsmin, blsmax, znphi * zneta, 1., znphi * zneta + 1.); - h_2DsumADCAmplEtaPhiLs2 = - new TH2F("h_2DsumADCAmplEtaPhiLs2", " ", nlsminmax, alsmin, blsmax, znphi * zneta, 1., znphi * zneta + 1.); - h_2DsumADCAmplEtaPhiLs3 = - new TH2F("h_2DsumADCAmplEtaPhiLs3", " ", nlsminmax, alsmin, blsmax, znphi * zneta, 1., znphi * zneta + 1.); - - h_2DsumADCAmplEtaPhiLs00 = - new TH2F("h_2DsumADCAmplEtaPhiLs00", " ", nlsminmax, alsmin, blsmax, znphi * zneta, 1., znphi * zneta + 1.); - h_2DsumADCAmplEtaPhiLs10 = - new TH2F("h_2DsumADCAmplEtaPhiLs10", " ", nlsminmax, alsmin, blsmax, znphi * zneta, 1., znphi * zneta + 1.); - h_2DsumADCAmplEtaPhiLs20 = - new TH2F("h_2DsumADCAmplEtaPhiLs20", " ", nlsminmax, alsmin, blsmax, znphi * zneta, 1., znphi * zneta + 1.); - h_2DsumADCAmplEtaPhiLs30 = - new TH2F("h_2DsumADCAmplEtaPhiLs30", " ", nlsminmax, alsmin, blsmax, znphi * zneta, 1., znphi * zneta + 1.); - - h_sumADCAmplEtaPhiLs = new TH1F("h_sumADCAmplEtaPhiLs", " ", 1000, 0., 14000.); - h_sumADCAmplEtaPhiLs_bbbc = new TH1F("h_sumADCAmplEtaPhiLs_bbbc", " ", 1000, 0., 300000.); - h_sumADCAmplEtaPhiLs_bbb1 = new TH1F("h_sumADCAmplEtaPhiLs_bbb1", " ", 100, 0., 3000.); - h_sumADCAmplEtaPhiLs_lscounterM1 = new TH1F("h_sumADCAmplEtaPhiLs_lscounterM1", " ", 600, 1., 601.); - h_sumADCAmplEtaPhiLs_ietaphi = new TH1F("h_sumADCAmplEtaPhiLs_ietaphi", " ", 400, 0., 400.); - h_sumADCAmplEtaPhiLs_lscounterM1orbitNum = new TH1F("h_sumADCAmplEtaPhiLs_lscounterM1orbitNum", " ", 600, 1., 601.); - h_sumADCAmplEtaPhiLs_orbitNum = new TH1F("h_sumADCAmplEtaPhiLs_orbitNum", " ", 1000, 25000000., 40000000.); + h_orbitNumvsamplitude_HB = fs_->make("h_orbitNumvsamplitude_HB", " ", zaP, zaR, zaR2); + h_orbitNumvsamplitude_HE = fs_->make("h_orbitNumvsamplitude_HE", " ", zaP, zaR, zaR2); + h_orbitNumvsamplitude_HF = fs_->make("h_orbitNumvsamplitude_HF", " ", zaP, zaR, zaR2); + h_orbitNumvsamplitude_HO = fs_->make("h_orbitNumvsamplitude_HO", " ", zaP, zaR, zaR2); + h_orbitNumvsamplitude0_HB = fs_->make("h_orbitNumvsamplitude0_HB", " ", zaP, zaR, zaR2); + h_orbitNumvsamplitude0_HE = fs_->make("h_orbitNumvsamplitude0_HE", " ", zaP, zaR, zaR2); + h_orbitNumvsamplitude0_HF = fs_->make("h_orbitNumvsamplitude0_HF", " ", zaP, zaR, zaR2); + h_orbitNumvsamplitude0_HO = fs_->make("h_orbitNumvsamplitude0_HO", " ", zaP, zaR, zaR2); + + h_2DsumADCAmplEtaPhiLs0 = fs_->make( + "h_2DsumADCAmplEtaPhiLs0", " ", nlsminmax, alsmin, blsmax, znphi * zneta, 1., znphi * zneta + 1.); + h_2DsumADCAmplEtaPhiLs1 = fs_->make( + "h_2DsumADCAmplEtaPhiLs1", " ", nlsminmax, alsmin, blsmax, znphi * zneta, 1., znphi * zneta + 1.); + h_2DsumADCAmplEtaPhiLs2 = fs_->make( + "h_2DsumADCAmplEtaPhiLs2", " ", nlsminmax, alsmin, blsmax, znphi * zneta, 1., znphi * zneta + 1.); + h_2DsumADCAmplEtaPhiLs3 = fs_->make( + "h_2DsumADCAmplEtaPhiLs3", " ", nlsminmax, alsmin, blsmax, znphi * zneta, 1., znphi * zneta + 1.); + + h_2DsumADCAmplEtaPhiLs00 = fs_->make( + "h_2DsumADCAmplEtaPhiLs00", " ", nlsminmax, alsmin, blsmax, znphi * zneta, 1., znphi * zneta + 1.); + h_2DsumADCAmplEtaPhiLs10 = fs_->make( + "h_2DsumADCAmplEtaPhiLs10", " ", nlsminmax, alsmin, blsmax, znphi * zneta, 1., znphi * zneta + 1.); + h_2DsumADCAmplEtaPhiLs20 = fs_->make( + "h_2DsumADCAmplEtaPhiLs20", " ", nlsminmax, alsmin, blsmax, znphi * zneta, 1., znphi * zneta + 1.); + h_2DsumADCAmplEtaPhiLs30 = fs_->make( + "h_2DsumADCAmplEtaPhiLs30", " ", nlsminmax, alsmin, blsmax, znphi * zneta, 1., znphi * zneta + 1.); + + h_sumADCAmplEtaPhiLs = fs_->make("h_sumADCAmplEtaPhiLs", " ", 1000, 0., 14000.); + h_sumADCAmplEtaPhiLs_bbbc = fs_->make("h_sumADCAmplEtaPhiLs_bbbc", " ", 1000, 0., 300000.); + h_sumADCAmplEtaPhiLs_bbb1 = fs_->make("h_sumADCAmplEtaPhiLs_bbb1", " ", 100, 0., 3000.); + h_sumADCAmplEtaPhiLs_lscounterM1 = fs_->make("h_sumADCAmplEtaPhiLs_lscounterM1", " ", 600, 1., 601.); + h_sumADCAmplEtaPhiLs_ietaphi = fs_->make("h_sumADCAmplEtaPhiLs_ietaphi", " ", 400, 0., 400.); + h_sumADCAmplEtaPhiLs_lscounterM1orbitNum = + fs_->make("h_sumADCAmplEtaPhiLs_lscounterM1orbitNum", " ", 600, 1., 601.); + h_sumADCAmplEtaPhiLs_orbitNum = fs_->make("h_sumADCAmplEtaPhiLs_orbitNum", " ", 1000, 25000000., 40000000.); // for LS : @@ -8144,1080 +6868,1088 @@ void CMTRawAnalyzer::beginJob() { float bac2 = bac + 1.; // bac, 1., bac2 ); - h_nbadchannels_depth1_HB = new TH1F("h_nbadchannels_depth1_HB", " ", 100, 1., 3001.); - h_runnbadchannels_depth1_HB = new TH1F("h_runnbadchannels_depth1_HB", " ", bac, 1., bac2); - h_runnbadchannelsC_depth1_HB = new TH1F("h_runnbadchannelsC_depth1_HB", " ", bac, 1., bac2); - h_runbadrate_depth1_HB = new TH1F("h_runbadrate_depth1_HB", " ", bac, 1., bac2); - h_runbadrateC_depth1_HB = new TH1F("h_runbadrateC_depth1_HB", " ", bac, 1., bac2); - h_runbadrate0_depth1_HB = new TH1F("h_runbadrate0_depth1_HB", " ", bac, 1., bac2); - - h_nbadchannels_depth2_HB = new TH1F("h_nbadchannels_depth2_HB", " ", 100, 1., 501.); - h_runnbadchannels_depth2_HB = new TH1F("h_runnbadchannels_depth2_HB", " ", bac, 1., bac2); - h_runnbadchannelsC_depth2_HB = new TH1F("h_runnbadchannelsC_depth2_HB", " ", bac, 1., bac2); - h_runbadrate_depth2_HB = new TH1F("h_runbadrate_depth2_HB", " ", bac, 1., bac2); - h_runbadrateC_depth2_HB = new TH1F("h_runbadrateC_depth2_HB", " ", bac, 1., bac2); - h_runbadrate0_depth2_HB = new TH1F("h_runbadrate0_depth2_HB", " ", bac, 1., bac2); - - h_nbadchannels_depth1_HE = new TH1F("h_nbadchannels_depth1_HE", " ", 100, 1., 3001.); - h_runnbadchannels_depth1_HE = new TH1F("h_runnbadchannels_depth1_HE", " ", bac, 1., bac2); - h_runnbadchannelsC_depth1_HE = new TH1F("h_runnbadchannelsC_depth1_HE", " ", bac, 1., bac2); - h_runbadrate_depth1_HE = new TH1F("h_runbadrate_depth1_HE", " ", bac, 1., bac2); - h_runbadrateC_depth1_HE = new TH1F("h_runbadrateC_depth1_HE", " ", bac, 1., bac2); - h_runbadrate0_depth1_HE = new TH1F("h_runbadrate0_depth1_HE", " ", bac, 1., bac2); - - h_nbadchannels_depth2_HE = new TH1F("h_nbadchannels_depth2_HE", " ", 100, 1., 3001.); - h_runnbadchannels_depth2_HE = new TH1F("h_runnbadchannels_depth2_HE", " ", bac, 1., bac2); - h_runnbadchannelsC_depth2_HE = new TH1F("h_runnbadchannelsC_depth2_HE", " ", bac, 1., bac2); - h_runbadrate_depth2_HE = new TH1F("h_runbadrate_depth2_HE", " ", bac, 1., bac2); - h_runbadrateC_depth2_HE = new TH1F("h_runbadrateC_depth2_HE", " ", bac, 1., bac2); - h_runbadrate0_depth2_HE = new TH1F("h_runbadrate0_depth2_HE", " ", bac, 1., bac2); - - h_nbadchannels_depth3_HE = new TH1F("h_nbadchannels_depth3_HE", " ", 100, 1., 501.); - h_runnbadchannels_depth3_HE = new TH1F("h_runnbadchannels_depth3_HE", " ", bac, 1., bac2); - h_runnbadchannelsC_depth3_HE = new TH1F("h_runnbadchannelsC_depth3_HE", " ", bac, 1., bac2); - h_runbadrate_depth3_HE = new TH1F("h_runbadrate_depth3_HE", " ", bac, 1., bac2); - h_runbadrateC_depth3_HE = new TH1F("h_runbadrateC_depth3_HE", " ", bac, 1., bac2); - h_runbadrate0_depth3_HE = new TH1F("h_runbadrate0_depth3_HE", " ", bac, 1., bac2); - - h_nbadchannels_depth1_HF = new TH1F("h_nbadchannels_depth1_HF", " ", 100, 1., 3001.); - h_runnbadchannels_depth1_HF = new TH1F("h_runnbadchannels_depth1_HF", " ", bac, 1., bac2); - h_runnbadchannelsC_depth1_HF = new TH1F("h_runnbadchannelsC_depth1_HF", " ", bac, 1., bac2); - h_runbadrate_depth1_HF = new TH1F("h_runbadrate_depth1_HF", " ", bac, 1., bac2); - h_runbadrateC_depth1_HF = new TH1F("h_runbadrateC_depth1_HF", " ", bac, 1., bac2); - h_runbadrate0_depth1_HF = new TH1F("h_runbadrate0_depth1_HF", " ", bac, 1., bac2); - - h_nbadchannels_depth2_HF = new TH1F("h_nbadchannels_depth2_HF", " ", 100, 1., 501.); - h_runnbadchannels_depth2_HF = new TH1F("h_runnbadchannels_depth2_HF", " ", bac, 1., bac2); - h_runnbadchannelsC_depth2_HF = new TH1F("h_runnbadchannelsC_depth2_HF", " ", bac, 1., bac2); - h_runbadrate_depth2_HF = new TH1F("h_runbadrate_depth2_HF", " ", bac, 1., bac2); - h_runbadrateC_depth2_HF = new TH1F("h_runbadrateC_depth2_HF", " ", bac, 1., bac2); - h_runbadrate0_depth2_HF = new TH1F("h_runbadrate0_depth2_HF", " ", bac, 1., bac2); - - h_nbadchannels_depth4_HO = new TH1F("h_nbadchannels_depth4_HO", " ", 100, 1., 3001.); - h_runnbadchannels_depth4_HO = new TH1F("h_runnbadchannels_depth4_HO", " ", bac, 1., bac2); - h_runnbadchannelsC_depth4_HO = new TH1F("h_runnbadchannelsC_depth4_HO", " ", bac, 1., bac2); - h_runbadrate_depth4_HO = new TH1F("h_runbadrate_depth4_HO", " ", bac, 1., bac2); - h_runbadrateC_depth4_HO = new TH1F("h_runbadrateC_depth4_HO", " ", bac, 1., bac2); - h_runbadrate0_depth4_HO = new TH1F("h_runbadrate0_depth4_HO", " ", bac, 1., bac2); + h_nbadchannels_depth1_HB = fs_->make("h_nbadchannels_depth1_HB", " ", 100, 1., 3001.); + h_runnbadchannels_depth1_HB = fs_->make("h_runnbadchannels_depth1_HB", " ", bac, 1., bac2); + h_runnbadchannelsC_depth1_HB = fs_->make("h_runnbadchannelsC_depth1_HB", " ", bac, 1., bac2); + h_runbadrate_depth1_HB = fs_->make("h_runbadrate_depth1_HB", " ", bac, 1., bac2); + h_runbadrateC_depth1_HB = fs_->make("h_runbadrateC_depth1_HB", " ", bac, 1., bac2); + h_runbadrate0_depth1_HB = fs_->make("h_runbadrate0_depth1_HB", " ", bac, 1., bac2); + + h_nbadchannels_depth2_HB = fs_->make("h_nbadchannels_depth2_HB", " ", 100, 1., 501.); + h_runnbadchannels_depth2_HB = fs_->make("h_runnbadchannels_depth2_HB", " ", bac, 1., bac2); + h_runnbadchannelsC_depth2_HB = fs_->make("h_runnbadchannelsC_depth2_HB", " ", bac, 1., bac2); + h_runbadrate_depth2_HB = fs_->make("h_runbadrate_depth2_HB", " ", bac, 1., bac2); + h_runbadrateC_depth2_HB = fs_->make("h_runbadrateC_depth2_HB", " ", bac, 1., bac2); + h_runbadrate0_depth2_HB = fs_->make("h_runbadrate0_depth2_HB", " ", bac, 1., bac2); + + h_nbadchannels_depth1_HE = fs_->make("h_nbadchannels_depth1_HE", " ", 100, 1., 3001.); + h_runnbadchannels_depth1_HE = fs_->make("h_runnbadchannels_depth1_HE", " ", bac, 1., bac2); + h_runnbadchannelsC_depth1_HE = fs_->make("h_runnbadchannelsC_depth1_HE", " ", bac, 1., bac2); + h_runbadrate_depth1_HE = fs_->make("h_runbadrate_depth1_HE", " ", bac, 1., bac2); + h_runbadrateC_depth1_HE = fs_->make("h_runbadrateC_depth1_HE", " ", bac, 1., bac2); + h_runbadrate0_depth1_HE = fs_->make("h_runbadrate0_depth1_HE", " ", bac, 1., bac2); + + h_nbadchannels_depth2_HE = fs_->make("h_nbadchannels_depth2_HE", " ", 100, 1., 3001.); + h_runnbadchannels_depth2_HE = fs_->make("h_runnbadchannels_depth2_HE", " ", bac, 1., bac2); + h_runnbadchannelsC_depth2_HE = fs_->make("h_runnbadchannelsC_depth2_HE", " ", bac, 1., bac2); + h_runbadrate_depth2_HE = fs_->make("h_runbadrate_depth2_HE", " ", bac, 1., bac2); + h_runbadrateC_depth2_HE = fs_->make("h_runbadrateC_depth2_HE", " ", bac, 1., bac2); + h_runbadrate0_depth2_HE = fs_->make("h_runbadrate0_depth2_HE", " ", bac, 1., bac2); + + h_nbadchannels_depth3_HE = fs_->make("h_nbadchannels_depth3_HE", " ", 100, 1., 501.); + h_runnbadchannels_depth3_HE = fs_->make("h_runnbadchannels_depth3_HE", " ", bac, 1., bac2); + h_runnbadchannelsC_depth3_HE = fs_->make("h_runnbadchannelsC_depth3_HE", " ", bac, 1., bac2); + h_runbadrate_depth3_HE = fs_->make("h_runbadrate_depth3_HE", " ", bac, 1., bac2); + h_runbadrateC_depth3_HE = fs_->make("h_runbadrateC_depth3_HE", " ", bac, 1., bac2); + h_runbadrate0_depth3_HE = fs_->make("h_runbadrate0_depth3_HE", " ", bac, 1., bac2); + + h_nbadchannels_depth1_HF = fs_->make("h_nbadchannels_depth1_HF", " ", 100, 1., 3001.); + h_runnbadchannels_depth1_HF = fs_->make("h_runnbadchannels_depth1_HF", " ", bac, 1., bac2); + h_runnbadchannelsC_depth1_HF = fs_->make("h_runnbadchannelsC_depth1_HF", " ", bac, 1., bac2); + h_runbadrate_depth1_HF = fs_->make("h_runbadrate_depth1_HF", " ", bac, 1., bac2); + h_runbadrateC_depth1_HF = fs_->make("h_runbadrateC_depth1_HF", " ", bac, 1., bac2); + h_runbadrate0_depth1_HF = fs_->make("h_runbadrate0_depth1_HF", " ", bac, 1., bac2); + + h_nbadchannels_depth2_HF = fs_->make("h_nbadchannels_depth2_HF", " ", 100, 1., 501.); + h_runnbadchannels_depth2_HF = fs_->make("h_runnbadchannels_depth2_HF", " ", bac, 1., bac2); + h_runnbadchannelsC_depth2_HF = fs_->make("h_runnbadchannelsC_depth2_HF", " ", bac, 1., bac2); + h_runbadrate_depth2_HF = fs_->make("h_runbadrate_depth2_HF", " ", bac, 1., bac2); + h_runbadrateC_depth2_HF = fs_->make("h_runbadrateC_depth2_HF", " ", bac, 1., bac2); + h_runbadrate0_depth2_HF = fs_->make("h_runbadrate0_depth2_HF", " ", bac, 1., bac2); + + h_nbadchannels_depth4_HO = fs_->make("h_nbadchannels_depth4_HO", " ", 100, 1., 3001.); + h_runnbadchannels_depth4_HO = fs_->make("h_runnbadchannels_depth4_HO", " ", bac, 1., bac2); + h_runnbadchannelsC_depth4_HO = fs_->make("h_runnbadchannelsC_depth4_HO", " ", bac, 1., bac2); + h_runbadrate_depth4_HO = fs_->make("h_runbadrate_depth4_HO", " ", bac, 1., bac2); + h_runbadrateC_depth4_HO = fs_->make("h_runbadrateC_depth4_HO", " ", bac, 1., bac2); + h_runbadrate0_depth4_HO = fs_->make("h_runbadrate0_depth4_HO", " ", bac, 1., bac2); /////////////////////////////////////////////////////////////////////////////////////////////// - h_FullSignal3D_HB = new TH2F("h_FullSignal3D_HB", " ", neta, -41., 41., nphi, 0., bphi); - h_FullSignal3D0_HB = new TH2F("h_FullSignal3D0_HB", " ", neta, -41., 41., nphi, 0., bphi); - h_FullSignal3D_HE = new TH2F("h_FullSignal3D_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_FullSignal3D0_HE = new TH2F("h_FullSignal3D0_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_FullSignal3D_HO = new TH2F("h_FullSignal3D_HO", " ", neta, -41., 41., nphi, 0., bphi); - h_FullSignal3D0_HO = new TH2F("h_FullSignal3D0_HO", " ", neta, -41., 41., nphi, 0., bphi); - h_FullSignal3D_HF = new TH2F("h_FullSignal3D_HF", " ", neta, -41., 41., nphi, 0., bphi); - h_FullSignal3D0_HF = new TH2F("h_FullSignal3D0_HF", " ", neta, -41., 41., nphi, 0., bphi); + h_FullSignal3D_HB = fs_->make("h_FullSignal3D_HB", " ", neta, -41., 41., nphi, 0., bphi); + h_FullSignal3D0_HB = fs_->make("h_FullSignal3D0_HB", " ", neta, -41., 41., nphi, 0., bphi); + h_FullSignal3D_HE = fs_->make("h_FullSignal3D_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_FullSignal3D0_HE = fs_->make("h_FullSignal3D0_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_FullSignal3D_HO = fs_->make("h_FullSignal3D_HO", " ", neta, -41., 41., nphi, 0., bphi); + h_FullSignal3D0_HO = fs_->make("h_FullSignal3D0_HO", " ", neta, -41., 41., nphi, 0., bphi); + h_FullSignal3D_HF = fs_->make("h_FullSignal3D_HF", " ", neta, -41., 41., nphi, 0., bphi); + h_FullSignal3D0_HF = fs_->make("h_FullSignal3D0_HF", " ", neta, -41., 41., nphi, 0., bphi); ////////////////////////////////////////////////////////////////////////////////////////////////// - h_ADCCalib_HB = new TH1F("h_ADCCalib_HB", " ", 100, 10., 10000.); - h_ADCCalib1_HB = new TH1F("h_ADCCalib1_HB", " ", 100, 0.1, 100.1); - h_mapADCCalib047_HB = new TH2F("h_mapADCCalib047_HB", " ", neta, -41., 41., nphi, 0., bphi); - h_mapADCCalib_HB = new TH2F("h_mapADCCalib_HB", " ", neta, -41., 41., nphi, 0., bphi); - h_RatioCalib_HB = new TH1F("h_RatioCalib_HB", " ", 100, 0., 1.); - h_mapRatioCalib047_HB = new TH2F("h_mapRatioCalib047_HB", " ", neta, -41., 41., nphi, 0., bphi); - h_mapRatioCalib_HB = new TH2F("h_mapRatioCalib_HB", " ", neta, -41., 41., nphi, 0., bphi); - h_TSmaxCalib_HB = new TH1F("h_TSmaxCalib_HB", " ", 100, 0., 10.); - h_mapTSmaxCalib047_HB = new TH2F("h_mapTSmaxCalib047_HB", " ", neta, -41., 41., nphi, 0., bphi); - h_mapTSmaxCalib_HB = new TH2F("h_mapTSmaxCalib_HB", " ", neta, -41., 41., nphi, 0., bphi); - h_TSmeanCalib_HB = new TH1F("h_TSmeanCalib_HB", " ", 100, 0., 10.); - h_mapTSmeanCalib047_HB = new TH2F("h_mapTSmeanCalib047_HB", " ", neta, -41., 41., nphi, 0., bphi); - h_mapTSmeanCalib_HB = new TH2F("h_mapTSmeanCalib_HB", " ", neta, -41., 41., nphi, 0., bphi); - h_WidthCalib_HB = new TH1F("h_WidthCalib_HB", " ", 100, 0., 5.); - h_mapWidthCalib047_HB = new TH2F("h_mapWidthCalib047_HB", " ", neta, -41., 41., nphi, 0., bphi); - h_mapCapCalib047_HB = new TH2F("h_mapCapCalib047_HB", " ", neta, -41., 41., nphi, 0., bphi); - h_mapWidthCalib_HB = new TH2F("h_mapWidthCalib_HB", " ", neta, -41., 41., nphi, 0., bphi); - h_map_HB = new TH2F("h_map_HB", " ", neta, -41., 41., nphi, 0., bphi); - h_ADCCalib_HE = new TH1F("h_ADCCalib_HE", " ", 100, 10., 10000.); - h_ADCCalib1_HE = new TH1F("h_ADCCalib1_HE", " ", 100, 0.1, 100.1); - h_mapADCCalib047_HE = new TH2F("h_mapADCCalib047_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapADCCalib_HE = new TH2F("h_mapADCCalib_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_RatioCalib_HE = new TH1F("h_RatioCalib_HE", " ", 100, 0., 1.); - h_mapRatioCalib047_HE = new TH2F("h_mapRatioCalib047_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapRatioCalib_HE = new TH2F("h_mapRatioCalib_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_TSmaxCalib_HE = new TH1F("h_TSmaxCalib_HE", " ", 100, 0., 10.); - h_mapTSmaxCalib047_HE = new TH2F("h_mapTSmaxCalib047_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapTSmaxCalib_HE = new TH2F("h_mapTSmaxCalib_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_TSmeanCalib_HE = new TH1F("h_TSmeanCalib_HE", " ", 100, 0., 10.); - h_mapTSmeanCalib047_HE = new TH2F("h_mapTSmeanCalib047_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapTSmeanCalib_HE = new TH2F("h_mapTSmeanCalib_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_WidthCalib_HE = new TH1F("h_WidthCalib_HE", " ", 100, 0., 5.); - h_mapWidthCalib047_HE = new TH2F("h_mapWidthCalib047_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapCapCalib047_HE = new TH2F("h_mapCapCalib047_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapWidthCalib_HE = new TH2F("h_mapWidthCalib_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_map_HE = new TH2F("h_map_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_ADCCalib_HO = new TH1F("h_ADCCalib_HO", " ", 100, 10., 10000.); - h_ADCCalib1_HO = new TH1F("h_ADCCalib1_HO", " ", 100, 0.1, 100.1); - h_mapADCCalib047_HO = new TH2F("h_mapADCCalib047_HO", " ", neta, -41., 41., nphi, 0., bphi); - h_mapADCCalib_HO = new TH2F("h_mapADCCalib_HO", " ", neta, -41., 41., nphi, 0., bphi); - h_RatioCalib_HO = new TH1F("h_RatioCalib_HO", " ", 100, 0., 1.); - h_mapRatioCalib047_HO = new TH2F("h_mapRatioCalib047_HO", " ", neta, -41., 41., nphi, 0., bphi); - h_mapRatioCalib_HO = new TH2F("h_mapRatioCalib_HO", " ", neta, -41., 41., nphi, 0., bphi); - h_TSmaxCalib_HO = new TH1F("h_TSmaxCalib_HO", " ", 100, 0., 10.); - h_mapTSmaxCalib047_HO = new TH2F("h_mapTSmaxCalib047_HO", " ", neta, -41., 41., nphi, 0., bphi); - h_mapTSmaxCalib_HO = new TH2F("h_mapTSmaxCalib_HO", " ", neta, -41., 41., nphi, 0., bphi); - h_TSmeanCalib_HO = new TH1F("h_TSmeanCalib_HO", " ", 100, 0., 10.); - h_mapTSmeanCalib047_HO = new TH2F("h_mapTSmeanCalib047_HO", " ", neta, -41., 41., nphi, 0., bphi); - h_mapTSmeanCalib_HO = new TH2F("h_mapTSmeanCalib_HO", " ", neta, -41., 41., nphi, 0., bphi); - h_WidthCalib_HO = new TH1F("h_WidthCalib_HO", " ", 100, 0., 5.); - h_mapWidthCalib047_HO = new TH2F("h_mapWidthCalib047_HO", " ", neta, -41., 41., nphi, 0., bphi); - h_mapCapCalib047_HO = new TH2F("h_mapCapCalib047_HO", " ", neta, -41., 41., nphi, 0., bphi); - h_mapWidthCalib_HO = new TH2F("h_mapWidthCalib_HO", " ", neta, -41., 41., nphi, 0., bphi); - h_map_HO = new TH2F("h_map_HO", " ", neta, -41., 41., nphi, 0., bphi); - h_ADCCalib_HF = new TH1F("h_ADCCalib_HF", " ", 100, 10., 2000.); - h_ADCCalib1_HF = new TH1F("h_ADCCalib1_HF", " ", 100, 0.1, 100.1); - h_mapADCCalib047_HF = new TH2F("h_mapADCCalib047_HF", " ", neta, -41., 41., nphi, 0., bphi); - h_mapADCCalib_HF = new TH2F("h_mapADCCalib_HF", " ", neta, -41., 41., nphi, 0., bphi); - h_RatioCalib_HF = new TH1F("h_RatioCalib_HF", " ", 100, 0., 1.); - h_mapRatioCalib047_HF = new TH2F("h_mapRatioCalib047_HF", " ", neta, -41., 41., nphi, 0., bphi); - h_mapRatioCalib_HF = new TH2F("h_mapRatioCalib_HF", " ", neta, -41., 41., nphi, 0., bphi); - h_TSmaxCalib_HF = new TH1F("h_TSmaxCalib_HF", " ", 100, 0., 10.); - h_mapTSmaxCalib047_HF = new TH2F("h_mapTSmaxCalib047_HF", " ", neta, -41., 41., nphi, 0., bphi); - h_mapTSmaxCalib_HF = new TH2F("h_mapTSmaxCalib_HF", " ", neta, -41., 41., nphi, 0., bphi); - h_TSmeanCalib_HF = new TH1F("h_TSmeanCalib_HF", " ", 100, 0., 10.); - h_mapTSmeanCalib047_HF = new TH2F("h_mapTSmeanCalib047_HF", " ", neta, -41., 41., nphi, 0., bphi); - h_mapTSmeanCalib_HF = new TH2F("h_mapTSmeanCalib_HF", " ", neta, -41., 41., nphi, 0., bphi); - h_WidthCalib_HF = new TH1F("h_WidthCalib_HF", " ", 100, 0., 5.); - h_mapWidthCalib047_HF = new TH2F("h_mapWidthCalib047_HF", " ", neta, -41., 41., nphi, 0., bphi); - h_mapCapCalib047_HF = new TH2F("h_mapCapCalib047_HF", " ", neta, -41., 41., nphi, 0., bphi); - h_mapWidthCalib_HF = new TH2F("h_mapWidthCalib_HF", " ", neta, -41., 41., nphi, 0., bphi); - h_map_HF = new TH2F("h_map_HF", " ", neta, -41., 41., nphi, 0., bphi); - - h_nls_per_run = new TH1F("h_nls_per_run", " ", 100, 0., 800.); - h_nls_per_run10 = new TH1F("h_nls_per_run10", " ", 100, 0., 60.); - h_nevents_per_LS = new TH1F("h_nevents_per_LS", " ", 100, 0., 600.); - h_nevents_per_LSzoom = new TH1F("h_nevents_per_LSzoom", " ", 50, 0., 50.); - h_nevents_per_eachLS = new TH1F("h_nevents_per_eachLS", " ", bac, 1., bac2); - h_nevents_per_eachRealLS = new TH1F("h_nevents_per_eachRealLS", " ", bac, 1., bac2); - h_lsnumber_per_eachLS = new TH1F("h_lsnumber_per_eachLS", " ", bac, 1., bac2); + h_ADCCalib_HB = fs_->make("h_ADCCalib_HB", " ", 100, 10., 10000.); + h_ADCCalib1_HB = fs_->make("h_ADCCalib1_HB", " ", 100, 0.1, 100.1); + h_mapADCCalib047_HB = fs_->make("h_mapADCCalib047_HB", " ", neta, -41., 41., nphi, 0., bphi); + h_mapADCCalib_HB = fs_->make("h_mapADCCalib_HB", " ", neta, -41., 41., nphi, 0., bphi); + h_RatioCalib_HB = fs_->make("h_RatioCalib_HB", " ", 100, 0., 1.); + h_mapRatioCalib047_HB = fs_->make("h_mapRatioCalib047_HB", " ", neta, -41., 41., nphi, 0., bphi); + h_mapRatioCalib_HB = fs_->make("h_mapRatioCalib_HB", " ", neta, -41., 41., nphi, 0., bphi); + h_TSmaxCalib_HB = fs_->make("h_TSmaxCalib_HB", " ", 100, 0., 10.); + h_mapTSmaxCalib047_HB = fs_->make("h_mapTSmaxCalib047_HB", " ", neta, -41., 41., nphi, 0., bphi); + h_mapTSmaxCalib_HB = fs_->make("h_mapTSmaxCalib_HB", " ", neta, -41., 41., nphi, 0., bphi); + h_TSmeanCalib_HB = fs_->make("h_TSmeanCalib_HB", " ", 100, 0., 10.); + h_mapTSmeanCalib047_HB = fs_->make("h_mapTSmeanCalib047_HB", " ", neta, -41., 41., nphi, 0., bphi); + h_mapTSmeanCalib_HB = fs_->make("h_mapTSmeanCalib_HB", " ", neta, -41., 41., nphi, 0., bphi); + h_WidthCalib_HB = fs_->make("h_WidthCalib_HB", " ", 100, 0., 5.); + h_mapWidthCalib047_HB = fs_->make("h_mapWidthCalib047_HB", " ", neta, -41., 41., nphi, 0., bphi); + h_mapCapCalib047_HB = fs_->make("h_mapCapCalib047_HB", " ", neta, -41., 41., nphi, 0., bphi); + h_mapWidthCalib_HB = fs_->make("h_mapWidthCalib_HB", " ", neta, -41., 41., nphi, 0., bphi); + h_map_HB = fs_->make("h_map_HB", " ", neta, -41., 41., nphi, 0., bphi); + h_ADCCalib_HE = fs_->make("h_ADCCalib_HE", " ", 100, 10., 10000.); + h_ADCCalib1_HE = fs_->make("h_ADCCalib1_HE", " ", 100, 0.1, 100.1); + h_mapADCCalib047_HE = fs_->make("h_mapADCCalib047_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapADCCalib_HE = fs_->make("h_mapADCCalib_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_RatioCalib_HE = fs_->make("h_RatioCalib_HE", " ", 100, 0., 1.); + h_mapRatioCalib047_HE = fs_->make("h_mapRatioCalib047_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapRatioCalib_HE = fs_->make("h_mapRatioCalib_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_TSmaxCalib_HE = fs_->make("h_TSmaxCalib_HE", " ", 100, 0., 10.); + h_mapTSmaxCalib047_HE = fs_->make("h_mapTSmaxCalib047_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapTSmaxCalib_HE = fs_->make("h_mapTSmaxCalib_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_TSmeanCalib_HE = fs_->make("h_TSmeanCalib_HE", " ", 100, 0., 10.); + h_mapTSmeanCalib047_HE = fs_->make("h_mapTSmeanCalib047_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapTSmeanCalib_HE = fs_->make("h_mapTSmeanCalib_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_WidthCalib_HE = fs_->make("h_WidthCalib_HE", " ", 100, 0., 5.); + h_mapWidthCalib047_HE = fs_->make("h_mapWidthCalib047_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapCapCalib047_HE = fs_->make("h_mapCapCalib047_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapWidthCalib_HE = fs_->make("h_mapWidthCalib_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_map_HE = fs_->make("h_map_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_ADCCalib_HO = fs_->make("h_ADCCalib_HO", " ", 100, 10., 10000.); + h_ADCCalib1_HO = fs_->make("h_ADCCalib1_HO", " ", 100, 0.1, 100.1); + h_mapADCCalib047_HO = fs_->make("h_mapADCCalib047_HO", " ", neta, -41., 41., nphi, 0., bphi); + h_mapADCCalib_HO = fs_->make("h_mapADCCalib_HO", " ", neta, -41., 41., nphi, 0., bphi); + h_RatioCalib_HO = fs_->make("h_RatioCalib_HO", " ", 100, 0., 1.); + h_mapRatioCalib047_HO = fs_->make("h_mapRatioCalib047_HO", " ", neta, -41., 41., nphi, 0., bphi); + h_mapRatioCalib_HO = fs_->make("h_mapRatioCalib_HO", " ", neta, -41., 41., nphi, 0., bphi); + h_TSmaxCalib_HO = fs_->make("h_TSmaxCalib_HO", " ", 100, 0., 10.); + h_mapTSmaxCalib047_HO = fs_->make("h_mapTSmaxCalib047_HO", " ", neta, -41., 41., nphi, 0., bphi); + h_mapTSmaxCalib_HO = fs_->make("h_mapTSmaxCalib_HO", " ", neta, -41., 41., nphi, 0., bphi); + h_TSmeanCalib_HO = fs_->make("h_TSmeanCalib_HO", " ", 100, 0., 10.); + h_mapTSmeanCalib047_HO = fs_->make("h_mapTSmeanCalib047_HO", " ", neta, -41., 41., nphi, 0., bphi); + h_mapTSmeanCalib_HO = fs_->make("h_mapTSmeanCalib_HO", " ", neta, -41., 41., nphi, 0., bphi); + h_WidthCalib_HO = fs_->make("h_WidthCalib_HO", " ", 100, 0., 5.); + h_mapWidthCalib047_HO = fs_->make("h_mapWidthCalib047_HO", " ", neta, -41., 41., nphi, 0., bphi); + h_mapCapCalib047_HO = fs_->make("h_mapCapCalib047_HO", " ", neta, -41., 41., nphi, 0., bphi); + h_mapWidthCalib_HO = fs_->make("h_mapWidthCalib_HO", " ", neta, -41., 41., nphi, 0., bphi); + h_map_HO = fs_->make("h_map_HO", " ", neta, -41., 41., nphi, 0., bphi); + h_ADCCalib_HF = fs_->make("h_ADCCalib_HF", " ", 100, 10., 2000.); + h_ADCCalib1_HF = fs_->make("h_ADCCalib1_HF", " ", 100, 0.1, 100.1); + h_mapADCCalib047_HF = fs_->make("h_mapADCCalib047_HF", " ", neta, -41., 41., nphi, 0., bphi); + h_mapADCCalib_HF = fs_->make("h_mapADCCalib_HF", " ", neta, -41., 41., nphi, 0., bphi); + h_RatioCalib_HF = fs_->make("h_RatioCalib_HF", " ", 100, 0., 1.); + h_mapRatioCalib047_HF = fs_->make("h_mapRatioCalib047_HF", " ", neta, -41., 41., nphi, 0., bphi); + h_mapRatioCalib_HF = fs_->make("h_mapRatioCalib_HF", " ", neta, -41., 41., nphi, 0., bphi); + h_TSmaxCalib_HF = fs_->make("h_TSmaxCalib_HF", " ", 100, 0., 10.); + h_mapTSmaxCalib047_HF = fs_->make("h_mapTSmaxCalib047_HF", " ", neta, -41., 41., nphi, 0., bphi); + h_mapTSmaxCalib_HF = fs_->make("h_mapTSmaxCalib_HF", " ", neta, -41., 41., nphi, 0., bphi); + h_TSmeanCalib_HF = fs_->make("h_TSmeanCalib_HF", " ", 100, 0., 10.); + h_mapTSmeanCalib047_HF = fs_->make("h_mapTSmeanCalib047_HF", " ", neta, -41., 41., nphi, 0., bphi); + h_mapTSmeanCalib_HF = fs_->make("h_mapTSmeanCalib_HF", " ", neta, -41., 41., nphi, 0., bphi); + h_WidthCalib_HF = fs_->make("h_WidthCalib_HF", " ", 100, 0., 5.); + h_mapWidthCalib047_HF = fs_->make("h_mapWidthCalib047_HF", " ", neta, -41., 41., nphi, 0., bphi); + h_mapCapCalib047_HF = fs_->make("h_mapCapCalib047_HF", " ", neta, -41., 41., nphi, 0., bphi); + h_mapWidthCalib_HF = fs_->make("h_mapWidthCalib_HF", " ", neta, -41., 41., nphi, 0., bphi); + h_map_HF = fs_->make("h_map_HF", " ", neta, -41., 41., nphi, 0., bphi); + + h_nls_per_run = fs_->make("h_nls_per_run", " ", 100, 0., 800.); + h_nls_per_run10 = fs_->make("h_nls_per_run10", " ", 100, 0., 60.); + h_nevents_per_LS = fs_->make("h_nevents_per_LS", " ", 100, 0., 600.); + h_nevents_per_LSzoom = fs_->make("h_nevents_per_LSzoom", " ", 50, 0., 50.); + h_nevents_per_eachLS = fs_->make("h_nevents_per_eachLS", " ", bac, 1., bac2); + h_nevents_per_eachRealLS = fs_->make("h_nevents_per_eachRealLS", " ", bac, 1., bac2); + h_lsnumber_per_eachLS = fs_->make("h_lsnumber_per_eachLS", " ", bac, 1., bac2); //-------------------------------------------------- // for estimator0: float pst1 = 30.; - h_sumPedestalLS1 = new TH1F("h_sumPedestalLS1", " ", 100, 0., pst1); - h_2DsumPedestalLS1 = new TH2F("h_2DsumPedestalLS1", " ", neta, -41., 41., nphi, 0., bphi); - h_sumPedestalperLS1 = new TH1F("h_sumPedestalperLS1", " ", bac, 1., bac2); - h_2D0sumPedestalLS1 = new TH2F("h_2D0sumPedestalLS1", " ", neta, -41., 41., nphi, 0., bphi); - h_sum0PedestalperLS1 = new TH1F("h_sum0PedestalperLS1", " ", bac, 1., bac2); - - h_sumPedestalLS2 = new TH1F("h_sumPedestalLS2", " ", 100, 0., pst1); - h_2DsumPedestalLS2 = new TH2F("h_2DsumPedestalLS2", " ", neta, -41., 41., nphi, 0., bphi); - h_sumPedestalperLS2 = new TH1F("h_sumPedestalperLS2", " ", bac, 1., bac2); - h_2D0sumPedestalLS2 = new TH2F("h_2D0sumPedestalLS2", " ", neta, -41., 41., nphi, 0., bphi); - h_sum0PedestalperLS2 = new TH1F("h_sum0PedestalperLS2", " ", bac, 1., bac2); - - h_sumPedestalLS3 = new TH1F("h_sumPedestalLS3", " ", 100, 0., pst1); - h_2DsumPedestalLS3 = new TH2F("h_2DsumPedestalLS3", " ", neta, -41., 41., nphi, 0., bphi); - h_sumPedestalperLS3 = new TH1F("h_sumPedestalperLS3", " ", bac, 1., bac2); - h_2D0sumPedestalLS3 = new TH2F("h_2D0sumPedestalLS3", " ", neta, -41., 41., nphi, 0., bphi); - h_sum0PedestalperLS3 = new TH1F("h_sum0PedestalperLS3", " ", bac, 1., bac2); - - h_sumPedestalLS4 = new TH1F("h_sumPedestalLS4", " ", 100, 0., pst1); - h_2DsumPedestalLS4 = new TH2F("h_2DsumPedestalLS4", " ", neta, -41., 41., nphi, 0., bphi); - h_sumPedestalperLS4 = new TH1F("h_sumPedestalperLS4", " ", bac, 1., bac2); - h_2D0sumPedestalLS4 = new TH2F("h_2D0sumPedestalLS4", " ", neta, -41., 41., nphi, 0., bphi); - h_sum0PedestalperLS4 = new TH1F("h_sum0PedestalperLS4", " ", bac, 1., bac2); - - h_sumPedestalLS5 = new TH1F("h_sumPedestalLS5", " ", 100, 0., pst1); - h_2DsumPedestalLS5 = new TH2F("h_2DsumPedestalLS5", " ", neta, -41., 41., nphi, 0., bphi); - h_sumPedestalperLS5 = new TH1F("h_sumPedestalperLS5", " ", bac, 1., bac2); - h_2D0sumPedestalLS5 = new TH2F("h_2D0sumPedestalLS5", " ", neta, -41., 41., nphi, 0., bphi); - h_sum0PedestalperLS5 = new TH1F("h_sum0PedestalperLS5", " ", bac, 1., bac2); - - h_sumPedestalLS6 = new TH1F("h_sumPedestalLS6", " ", 100, 0., pst1); - h_2DsumPedestalLS6 = new TH2F("h_2DsumPedestalLS6", " ", neta, -41., 41., nphi, 0., bphi); - h_sumPedestalperLS6 = new TH1F("h_sumPedestalperLS6", " ", bac, 1., bac2); - h_2D0sumPedestalLS6 = new TH2F("h_2D0sumPedestalLS6", " ", neta, -41., 41., nphi, 0., bphi); - h_sum0PedestalperLS6 = new TH1F("h_sum0PedestalperLS6", " ", bac, 1., bac2); - - h_sumPedestalLS7 = new TH1F("h_sumPedestalLS7", " ", 100, 0., pst1); - h_2DsumPedestalLS7 = new TH2F("h_2DsumPedestalLS7", " ", neta, -41., 41., nphi, 0., bphi); - h_sumPedestalperLS7 = new TH1F("h_sumPedestalperLS7", " ", bac, 1., bac2); - h_2D0sumPedestalLS7 = new TH2F("h_2D0sumPedestalLS7", " ", neta, -41., 41., nphi, 0., bphi); - h_sum0PedestalperLS7 = new TH1F("h_sum0PedestalperLS7", " ", bac, 1., bac2); - - h_sumPedestalLS8 = new TH1F("h_sumPedestalLS8", " ", 100, 0., pst1); - h_2DsumPedestalLS8 = new TH2F("h_2DsumPedestalLS8", " ", neta, -41., 41., nphi, 0., bphi); - h_sumPedestalperLS8 = new TH1F("h_sumPedestalperLS8", " ", bac, 1., bac2); - h_2D0sumPedestalLS8 = new TH2F("h_2D0sumPedestalLS8", " ", neta, -41., 41., nphi, 0., bphi); - h_sum0PedestalperLS8 = new TH1F("h_sum0PedestalperLS8", " ", bac, 1., bac2); + h_sumPedestalLS1 = fs_->make("h_sumPedestalLS1", " ", 100, 0., pst1); + h_2DsumPedestalLS1 = fs_->make("h_2DsumPedestalLS1", " ", neta, -41., 41., nphi, 0., bphi); + h_sumPedestalperLS1 = fs_->make("h_sumPedestalperLS1", " ", bac, 1., bac2); + h_2D0sumPedestalLS1 = fs_->make("h_2D0sumPedestalLS1", " ", neta, -41., 41., nphi, 0., bphi); + h_sum0PedestalperLS1 = fs_->make("h_sum0PedestalperLS1", " ", bac, 1., bac2); + + h_sumPedestalLS2 = fs_->make("h_sumPedestalLS2", " ", 100, 0., pst1); + h_2DsumPedestalLS2 = fs_->make("h_2DsumPedestalLS2", " ", neta, -41., 41., nphi, 0., bphi); + h_sumPedestalperLS2 = fs_->make("h_sumPedestalperLS2", " ", bac, 1., bac2); + h_2D0sumPedestalLS2 = fs_->make("h_2D0sumPedestalLS2", " ", neta, -41., 41., nphi, 0., bphi); + h_sum0PedestalperLS2 = fs_->make("h_sum0PedestalperLS2", " ", bac, 1., bac2); + + h_sumPedestalLS3 = fs_->make("h_sumPedestalLS3", " ", 100, 0., pst1); + h_2DsumPedestalLS3 = fs_->make("h_2DsumPedestalLS3", " ", neta, -41., 41., nphi, 0., bphi); + h_sumPedestalperLS3 = fs_->make("h_sumPedestalperLS3", " ", bac, 1., bac2); + h_2D0sumPedestalLS3 = fs_->make("h_2D0sumPedestalLS3", " ", neta, -41., 41., nphi, 0., bphi); + h_sum0PedestalperLS3 = fs_->make("h_sum0PedestalperLS3", " ", bac, 1., bac2); + + h_sumPedestalLS4 = fs_->make("h_sumPedestalLS4", " ", 100, 0., pst1); + h_2DsumPedestalLS4 = fs_->make("h_2DsumPedestalLS4", " ", neta, -41., 41., nphi, 0., bphi); + h_sumPedestalperLS4 = fs_->make("h_sumPedestalperLS4", " ", bac, 1., bac2); + h_2D0sumPedestalLS4 = fs_->make("h_2D0sumPedestalLS4", " ", neta, -41., 41., nphi, 0., bphi); + h_sum0PedestalperLS4 = fs_->make("h_sum0PedestalperLS4", " ", bac, 1., bac2); + + h_sumPedestalLS5 = fs_->make("h_sumPedestalLS5", " ", 100, 0., pst1); + h_2DsumPedestalLS5 = fs_->make("h_2DsumPedestalLS5", " ", neta, -41., 41., nphi, 0., bphi); + h_sumPedestalperLS5 = fs_->make("h_sumPedestalperLS5", " ", bac, 1., bac2); + h_2D0sumPedestalLS5 = fs_->make("h_2D0sumPedestalLS5", " ", neta, -41., 41., nphi, 0., bphi); + h_sum0PedestalperLS5 = fs_->make("h_sum0PedestalperLS5", " ", bac, 1., bac2); + + h_sumPedestalLS6 = fs_->make("h_sumPedestalLS6", " ", 100, 0., pst1); + h_2DsumPedestalLS6 = fs_->make("h_2DsumPedestalLS6", " ", neta, -41., 41., nphi, 0., bphi); + h_sumPedestalperLS6 = fs_->make("h_sumPedestalperLS6", " ", bac, 1., bac2); + h_2D0sumPedestalLS6 = fs_->make("h_2D0sumPedestalLS6", " ", neta, -41., 41., nphi, 0., bphi); + h_sum0PedestalperLS6 = fs_->make("h_sum0PedestalperLS6", " ", bac, 1., bac2); + + h_sumPedestalLS7 = fs_->make("h_sumPedestalLS7", " ", 100, 0., pst1); + h_2DsumPedestalLS7 = fs_->make("h_2DsumPedestalLS7", " ", neta, -41., 41., nphi, 0., bphi); + h_sumPedestalperLS7 = fs_->make("h_sumPedestalperLS7", " ", bac, 1., bac2); + h_2D0sumPedestalLS7 = fs_->make("h_2D0sumPedestalLS7", " ", neta, -41., 41., nphi, 0., bphi); + h_sum0PedestalperLS7 = fs_->make("h_sum0PedestalperLS7", " ", bac, 1., bac2); + + h_sumPedestalLS8 = fs_->make("h_sumPedestalLS8", " ", 100, 0., pst1); + h_2DsumPedestalLS8 = fs_->make("h_2DsumPedestalLS8", " ", neta, -41., 41., nphi, 0., bphi); + h_sumPedestalperLS8 = fs_->make("h_sumPedestalperLS8", " ", bac, 1., bac2); + h_2D0sumPedestalLS8 = fs_->make("h_2D0sumPedestalLS8", " ", neta, -41., 41., nphi, 0., bphi); + h_sum0PedestalperLS8 = fs_->make("h_sum0PedestalperLS8", " ", bac, 1., bac2); //-------------------------------------------------- // for estimator1: - h_sumADCAmplLS1copy1 = new TH1F("h_sumADCAmplLS1copy1", " ", 100, 0., 10000); - h_sumADCAmplLS1copy2 = new TH1F("h_sumADCAmplLS1copy2", " ", 100, 0., 20000); - h_sumADCAmplLS1copy3 = new TH1F("h_sumADCAmplLS1copy3", " ", 100, 0., 50000); - h_sumADCAmplLS1copy4 = new TH1F("h_sumADCAmplLS1copy4", " ", 100, 0., 100000); - h_sumADCAmplLS1copy5 = new TH1F("h_sumADCAmplLS1copy5", " ", 100, 0., 150000); - h_sumADCAmplLS1 = new TH1F("h_sumADCAmplLS1", " ", 100, 0., lsdep_estimator1_HBdepth1_); - h_2DsumADCAmplLS1 = new TH2F("h_2DsumADCAmplLS1", " ", neta, -41., 41., nphi, 0., bphi); - h_2DsumADCAmplLS1_LSselected = new TH2F("h_2DsumADCAmplLS1_LSselected", " ", neta, -41., 41., nphi, 0., bphi); - h_sumADCAmplperLS1 = new TH1F("h_sumADCAmplperLS1", " ", bac, 1., bac2); - h_sumCutADCAmplperLS1 = new TH1F("h_sumCutADCAmplperLS1", " ", bac, 1., bac2); - h_2D0sumADCAmplLS1 = new TH2F("h_2D0sumADCAmplLS1", " ", neta, -41., 41., nphi, 0., bphi); - h_sum0ADCAmplperLS1 = new TH1F("h_sum0ADCAmplperLS1", " ", bac, 1., bac2); - - h_sumADCAmplLS2 = new TH1F("h_sumADCAmplLS2", " ", 100, 0., lsdep_estimator1_HBdepth2_); - h_2DsumADCAmplLS2 = new TH2F("h_2DsumADCAmplLS2", " ", neta, -41., 41., nphi, 0., bphi); - h_2DsumADCAmplLS2_LSselected = new TH2F("h_2DsumADCAmplLS2_LSselected", " ", neta, -41., 41., nphi, 0., bphi); - h_sumADCAmplperLS2 = new TH1F("h_sumADCAmplperLS2", " ", bac, 1., bac2); - h_sumCutADCAmplperLS2 = new TH1F("h_sumCutADCAmplperLS2", " ", bac, 1., bac2); - h_2D0sumADCAmplLS2 = new TH2F("h_2D0sumADCAmplLS2", " ", neta, -41., 41., nphi, 0., bphi); - h_sum0ADCAmplperLS2 = new TH1F("h_sum0ADCAmplperLS2", " ", bac, 1., bac2); - - h_sumADCAmplLS3 = new TH1F("h_sumADCAmplLS3", " ", 100, 0., lsdep_estimator1_HEdepth1_); - h_2DsumADCAmplLS3 = new TH2F("h_2DsumADCAmplLS3", " ", neta, -41., 41., nphi, 0., bphi); - h_2DsumADCAmplLS3_LSselected = new TH2F("h_2DsumADCAmplLS3_LSselected", " ", neta, -41., 41., nphi, 0., bphi); - h_sumADCAmplperLS3 = new TH1F("h_sumADCAmplperLS3", " ", bac, 1., bac2); - h_sumCutADCAmplperLS3 = new TH1F("h_sumCutADCAmplperLS3", " ", bac, 1., bac2); - h_2D0sumADCAmplLS3 = new TH2F("h_2D0sumADCAmplLS3", " ", neta, -41., 41., nphi, 0., bphi); - h_sum0ADCAmplperLS3 = new TH1F("h_sum0ADCAmplperLS3", " ", bac, 1., bac2); - - h_sumADCAmplLS4 = new TH1F("h_sumADCAmplLS4", " ", 100, 0., lsdep_estimator1_HEdepth2_); - h_2DsumADCAmplLS4 = new TH2F("h_2DsumADCAmplLS4", " ", neta, -41., 41., nphi, 0., bphi); - h_2DsumADCAmplLS4_LSselected = new TH2F("h_2DsumADCAmplLS4_LSselected", " ", neta, -41., 41., nphi, 0., bphi); - h_sumADCAmplperLS4 = new TH1F("h_sumADCAmplperLS4", " ", bac, 1., bac2); - h_sumCutADCAmplperLS4 = new TH1F("h_sumCutADCAmplperLS4", " ", bac, 1., bac2); - h_2D0sumADCAmplLS4 = new TH2F("h_2D0sumADCAmplLS4", " ", neta, -41., 41., nphi, 0., bphi); - h_sum0ADCAmplperLS4 = new TH1F("h_sum0ADCAmplperLS4", " ", bac, 1., bac2); - - h_sumADCAmplLS5 = new TH1F("h_sumADCAmplLS5", " ", 100, 0., lsdep_estimator1_HEdepth3_); - h_2DsumADCAmplLS5 = new TH2F("h_2DsumADCAmplLS5", " ", neta, -41., 41., nphi, 0., bphi); - h_2DsumADCAmplLS5_LSselected = new TH2F("h_2DsumADCAmplLS5_LSselected", " ", neta, -41., 41., nphi, 0., bphi); - h_sumADCAmplperLS5 = new TH1F("h_sumADCAmplperLS5", " ", bac, 1., bac2); - h_sumCutADCAmplperLS5 = new TH1F("h_sumCutADCAmplperLS5", " ", bac, 1., bac2); - h_2D0sumADCAmplLS5 = new TH2F("h_2D0sumADCAmplLS5", " ", neta, -41., 41., nphi, 0., bphi); - h_sum0ADCAmplperLS5 = new TH1F("h_sum0ADCAmplperLS5", " ", bac, 1., bac2); + h_sumADCAmplLS1copy1 = fs_->make("h_sumADCAmplLS1copy1", " ", 100, 0., 10000); + h_sumADCAmplLS1copy2 = fs_->make("h_sumADCAmplLS1copy2", " ", 100, 0., 20000); + h_sumADCAmplLS1copy3 = fs_->make("h_sumADCAmplLS1copy3", " ", 100, 0., 50000); + h_sumADCAmplLS1copy4 = fs_->make("h_sumADCAmplLS1copy4", " ", 100, 0., 100000); + h_sumADCAmplLS1copy5 = fs_->make("h_sumADCAmplLS1copy5", " ", 100, 0., 150000); + h_sumADCAmplLS1 = fs_->make("h_sumADCAmplLS1", " ", 100, 0., lsdep_estimator1_HBdepth1_); + h_2DsumADCAmplLS1 = fs_->make("h_2DsumADCAmplLS1", " ", neta, -41., 41., nphi, 0., bphi); + h_2DsumADCAmplLS1_LSselected = + fs_->make("h_2DsumADCAmplLS1_LSselected", " ", neta, -41., 41., nphi, 0., bphi); + h_sumADCAmplperLS1 = fs_->make("h_sumADCAmplperLS1", " ", bac, 1., bac2); + h_sumCutADCAmplperLS1 = fs_->make("h_sumCutADCAmplperLS1", " ", bac, 1., bac2); + h_2D0sumADCAmplLS1 = fs_->make("h_2D0sumADCAmplLS1", " ", neta, -41., 41., nphi, 0., bphi); + h_sum0ADCAmplperLS1 = fs_->make("h_sum0ADCAmplperLS1", " ", bac, 1., bac2); + + h_sumADCAmplLS2 = fs_->make("h_sumADCAmplLS2", " ", 100, 0., lsdep_estimator1_HBdepth2_); + h_2DsumADCAmplLS2 = fs_->make("h_2DsumADCAmplLS2", " ", neta, -41., 41., nphi, 0., bphi); + h_2DsumADCAmplLS2_LSselected = + fs_->make("h_2DsumADCAmplLS2_LSselected", " ", neta, -41., 41., nphi, 0., bphi); + h_sumADCAmplperLS2 = fs_->make("h_sumADCAmplperLS2", " ", bac, 1., bac2); + h_sumCutADCAmplperLS2 = fs_->make("h_sumCutADCAmplperLS2", " ", bac, 1., bac2); + h_2D0sumADCAmplLS2 = fs_->make("h_2D0sumADCAmplLS2", " ", neta, -41., 41., nphi, 0., bphi); + h_sum0ADCAmplperLS2 = fs_->make("h_sum0ADCAmplperLS2", " ", bac, 1., bac2); + + h_sumADCAmplLS3 = fs_->make("h_sumADCAmplLS3", " ", 100, 0., lsdep_estimator1_HEdepth1_); + h_2DsumADCAmplLS3 = fs_->make("h_2DsumADCAmplLS3", " ", neta, -41., 41., nphi, 0., bphi); + h_2DsumADCAmplLS3_LSselected = + fs_->make("h_2DsumADCAmplLS3_LSselected", " ", neta, -41., 41., nphi, 0., bphi); + h_sumADCAmplperLS3 = fs_->make("h_sumADCAmplperLS3", " ", bac, 1., bac2); + h_sumCutADCAmplperLS3 = fs_->make("h_sumCutADCAmplperLS3", " ", bac, 1., bac2); + h_2D0sumADCAmplLS3 = fs_->make("h_2D0sumADCAmplLS3", " ", neta, -41., 41., nphi, 0., bphi); + h_sum0ADCAmplperLS3 = fs_->make("h_sum0ADCAmplperLS3", " ", bac, 1., bac2); + + h_sumADCAmplLS4 = fs_->make("h_sumADCAmplLS4", " ", 100, 0., lsdep_estimator1_HEdepth2_); + h_2DsumADCAmplLS4 = fs_->make("h_2DsumADCAmplLS4", " ", neta, -41., 41., nphi, 0., bphi); + h_2DsumADCAmplLS4_LSselected = + fs_->make("h_2DsumADCAmplLS4_LSselected", " ", neta, -41., 41., nphi, 0., bphi); + h_sumADCAmplperLS4 = fs_->make("h_sumADCAmplperLS4", " ", bac, 1., bac2); + h_sumCutADCAmplperLS4 = fs_->make("h_sumCutADCAmplperLS4", " ", bac, 1., bac2); + h_2D0sumADCAmplLS4 = fs_->make("h_2D0sumADCAmplLS4", " ", neta, -41., 41., nphi, 0., bphi); + h_sum0ADCAmplperLS4 = fs_->make("h_sum0ADCAmplperLS4", " ", bac, 1., bac2); + + h_sumADCAmplLS5 = fs_->make("h_sumADCAmplLS5", " ", 100, 0., lsdep_estimator1_HEdepth3_); + h_2DsumADCAmplLS5 = fs_->make("h_2DsumADCAmplLS5", " ", neta, -41., 41., nphi, 0., bphi); + h_2DsumADCAmplLS5_LSselected = + fs_->make("h_2DsumADCAmplLS5_LSselected", " ", neta, -41., 41., nphi, 0., bphi); + h_sumADCAmplperLS5 = fs_->make("h_sumADCAmplperLS5", " ", bac, 1., bac2); + h_sumCutADCAmplperLS5 = fs_->make("h_sumCutADCAmplperLS5", " ", bac, 1., bac2); + h_2D0sumADCAmplLS5 = fs_->make("h_2D0sumADCAmplLS5", " ", neta, -41., 41., nphi, 0., bphi); + h_sum0ADCAmplperLS5 = fs_->make("h_sum0ADCAmplperLS5", " ", bac, 1., bac2); // HE upgrade depth4 - h_sumADCAmplperLSdepth4HEu = new TH1F("h_sumADCAmplperLSdepth4HEu", " ", bac, 1., bac2); - h_sumCutADCAmplperLSdepth4HEu = new TH1F("h_sumCutADCAmplperLSdepth4HEu", " ", bac, 1., bac2); - h_sum0ADCAmplperLSdepth4HEu = new TH1F("h_sum0ADCAmplperLSdepth4HEu", " ", bac, 1., bac2); + h_sumADCAmplperLSdepth4HEu = fs_->make("h_sumADCAmplperLSdepth4HEu", " ", bac, 1., bac2); + h_sumCutADCAmplperLSdepth4HEu = fs_->make("h_sumCutADCAmplperLSdepth4HEu", " ", bac, 1., bac2); + h_sum0ADCAmplperLSdepth4HEu = fs_->make("h_sum0ADCAmplperLSdepth4HEu", " ", bac, 1., bac2); // HE upgrade depth5 - h_sumADCAmplperLSdepth5HEu = new TH1F("h_sumADCAmplperLSdepth5HEu", " ", bac, 1., bac2); - h_sumCutADCAmplperLSdepth5HEu = new TH1F("h_sumCutADCAmplperLSdepth5HEu", " ", bac, 1., bac2); - h_sum0ADCAmplperLSdepth5HEu = new TH1F("h_sum0ADCAmplperLSdepth5HEu", " ", bac, 1., bac2); + h_sumADCAmplperLSdepth5HEu = fs_->make("h_sumADCAmplperLSdepth5HEu", " ", bac, 1., bac2); + h_sumCutADCAmplperLSdepth5HEu = fs_->make("h_sumCutADCAmplperLSdepth5HEu", " ", bac, 1., bac2); + h_sum0ADCAmplperLSdepth5HEu = fs_->make("h_sum0ADCAmplperLSdepth5HEu", " ", bac, 1., bac2); // HE upgrade depth6 - h_sumADCAmplperLSdepth6HEu = new TH1F("h_sumADCAmplperLSdepth6HEu", " ", bac, 1., bac2); - h_sumCutADCAmplperLSdepth6HEu = new TH1F("h_sumCutADCAmplperLSdepth6HEu", " ", bac, 1., bac2); - h_sum0ADCAmplperLSdepth6HEu = new TH1F("h_sum0ADCAmplperLSdepth6HEu", " ", bac, 1., bac2); + h_sumADCAmplperLSdepth6HEu = fs_->make("h_sumADCAmplperLSdepth6HEu", " ", bac, 1., bac2); + h_sumCutADCAmplperLSdepth6HEu = fs_->make("h_sumCutADCAmplperLSdepth6HEu", " ", bac, 1., bac2); + h_sum0ADCAmplperLSdepth6HEu = fs_->make("h_sum0ADCAmplperLSdepth6HEu", " ", bac, 1., bac2); // HE upgrade depth7 - h_sumADCAmplperLSdepth7HEu = new TH1F("h_sumADCAmplperLSdepth7HEu", " ", bac, 1., bac2); - h_sumCutADCAmplperLSdepth7HEu = new TH1F("h_sumCutADCAmplperLSdepth7HEu", " ", bac, 1., bac2); - h_sum0ADCAmplperLSdepth7HEu = new TH1F("h_sum0ADCAmplperLSdepth7HEu", " ", bac, 1., bac2); + h_sumADCAmplperLSdepth7HEu = fs_->make("h_sumADCAmplperLSdepth7HEu", " ", bac, 1., bac2); + h_sumCutADCAmplperLSdepth7HEu = fs_->make("h_sumCutADCAmplperLSdepth7HEu", " ", bac, 1., bac2); + h_sum0ADCAmplperLSdepth7HEu = fs_->make("h_sum0ADCAmplperLSdepth7HEu", " ", bac, 1., bac2); // for HE gain stability vs LS: - h_2DsumADCAmplLSdepth4HEu = new TH2F("h_2DsumADCAmplLSdepth4HEu", " ", neta, -41., 41., nphi, 0., bphi); - h_2D0sumADCAmplLSdepth4HEu = new TH2F("h_2D0sumADCAmplLSdepth4HEu", " ", neta, -41., 41., nphi, 0., bphi); - h_2DsumADCAmplLSdepth5HEu = new TH2F("h_2DsumADCAmplLSdepth5HEu", " ", neta, -41., 41., nphi, 0., bphi); - h_2D0sumADCAmplLSdepth5HEu = new TH2F("h_2D0sumADCAmplLSdepth5HEu", " ", neta, -41., 41., nphi, 0., bphi); - h_2DsumADCAmplLSdepth6HEu = new TH2F("h_2DsumADCAmplLSdepth6HEu", " ", neta, -41., 41., nphi, 0., bphi); - h_2D0sumADCAmplLSdepth6HEu = new TH2F("h_2D0sumADCAmplLSdepth6HEu", " ", neta, -41., 41., nphi, 0., bphi); - h_2DsumADCAmplLSdepth7HEu = new TH2F("h_2DsumADCAmplLSdepth7HEu", " ", neta, -41., 41., nphi, 0., bphi); - h_2D0sumADCAmplLSdepth7HEu = new TH2F("h_2D0sumADCAmplLSdepth7HEu", " ", neta, -41., 41., nphi, 0., bphi); - h_2DsumADCAmplLSdepth3HFu = new TH2F("h_2DsumADCAmplLSdepth3HFu", " ", neta, -41., 41., nphi, 0., bphi); - h_2D0sumADCAmplLSdepth3HFu = new TH2F("h_2D0sumADCAmplLSdepth3HFu", " ", neta, -41., 41., nphi, 0., bphi); - h_2DsumADCAmplLSdepth4HFu = new TH2F("h_2DsumADCAmplLSdepth4HFu", " ", neta, -41., 41., nphi, 0., bphi); - h_2D0sumADCAmplLSdepth4HFu = new TH2F("h_2D0sumADCAmplLSdepth4HFu", " ", neta, -41., 41., nphi, 0., bphi); - - h_sumADCAmplLS6 = new TH1F("h_sumADCAmplLS6", " ", 100, 0., lsdep_estimator1_HFdepth1_); - h_2DsumADCAmplLS6 = new TH2F("h_2DsumADCAmplLS6", " ", neta, -41., 41., nphi, 0., bphi); - h_2DsumADCAmplLS6_LSselected = new TH2F("h_2DsumADCAmplLS6_LSselected", " ", neta, -41., 41., nphi, 0., bphi); - h_2D0sumADCAmplLS6 = new TH2F("h_2D0sumADCAmplLS6", " ", neta, -41., 41., nphi, 0., bphi); - h_sumADCAmplperLS6 = new TH1F("h_sumADCAmplperLS6", " ", bac, 1., bac2); - h_sumCutADCAmplperLS6 = new TH1F("h_sumCutADCAmplperLS6", " ", bac, 1., bac2); - h_sum0ADCAmplperLS6 = new TH1F("h_sum0ADCAmplperLS6", " ", bac, 1., bac2); + h_2DsumADCAmplLSdepth4HEu = fs_->make("h_2DsumADCAmplLSdepth4HEu", " ", neta, -41., 41., nphi, 0., bphi); + h_2D0sumADCAmplLSdepth4HEu = fs_->make("h_2D0sumADCAmplLSdepth4HEu", " ", neta, -41., 41., nphi, 0., bphi); + h_2DsumADCAmplLSdepth5HEu = fs_->make("h_2DsumADCAmplLSdepth5HEu", " ", neta, -41., 41., nphi, 0., bphi); + h_2D0sumADCAmplLSdepth5HEu = fs_->make("h_2D0sumADCAmplLSdepth5HEu", " ", neta, -41., 41., nphi, 0., bphi); + h_2DsumADCAmplLSdepth6HEu = fs_->make("h_2DsumADCAmplLSdepth6HEu", " ", neta, -41., 41., nphi, 0., bphi); + h_2D0sumADCAmplLSdepth6HEu = fs_->make("h_2D0sumADCAmplLSdepth6HEu", " ", neta, -41., 41., nphi, 0., bphi); + h_2DsumADCAmplLSdepth7HEu = fs_->make("h_2DsumADCAmplLSdepth7HEu", " ", neta, -41., 41., nphi, 0., bphi); + h_2D0sumADCAmplLSdepth7HEu = fs_->make("h_2D0sumADCAmplLSdepth7HEu", " ", neta, -41., 41., nphi, 0., bphi); + h_2DsumADCAmplLSdepth3HFu = fs_->make("h_2DsumADCAmplLSdepth3HFu", " ", neta, -41., 41., nphi, 0., bphi); + h_2D0sumADCAmplLSdepth3HFu = fs_->make("h_2D0sumADCAmplLSdepth3HFu", " ", neta, -41., 41., nphi, 0., bphi); + h_2DsumADCAmplLSdepth4HFu = fs_->make("h_2DsumADCAmplLSdepth4HFu", " ", neta, -41., 41., nphi, 0., bphi); + h_2D0sumADCAmplLSdepth4HFu = fs_->make("h_2D0sumADCAmplLSdepth4HFu", " ", neta, -41., 41., nphi, 0., bphi); + + h_sumADCAmplLS6 = fs_->make("h_sumADCAmplLS6", " ", 100, 0., lsdep_estimator1_HFdepth1_); + h_2DsumADCAmplLS6 = fs_->make("h_2DsumADCAmplLS6", " ", neta, -41., 41., nphi, 0., bphi); + h_2DsumADCAmplLS6_LSselected = + fs_->make("h_2DsumADCAmplLS6_LSselected", " ", neta, -41., 41., nphi, 0., bphi); + h_2D0sumADCAmplLS6 = fs_->make("h_2D0sumADCAmplLS6", " ", neta, -41., 41., nphi, 0., bphi); + h_sumADCAmplperLS6 = fs_->make("h_sumADCAmplperLS6", " ", bac, 1., bac2); + h_sumCutADCAmplperLS6 = fs_->make("h_sumCutADCAmplperLS6", " ", bac, 1., bac2); + h_sum0ADCAmplperLS6 = fs_->make("h_sum0ADCAmplperLS6", " ", bac, 1., bac2); // HF upgrade depth3 - h_sumADCAmplperLS6u = new TH1F("h_sumADCAmplperLS6u", " ", bac, 1., bac2); - h_sumCutADCAmplperLS6u = new TH1F("h_sumCutADCAmplperLS6u", " ", bac, 1., bac2); - h_sum0ADCAmplperLS6u = new TH1F("h_sum0ADCAmplperLS6u", " ", bac, 1., bac2); - - h_sumADCAmplLS7 = new TH1F("h_sumADCAmplLS7", " ", 100, 0., lsdep_estimator1_HFdepth2_); - h_2DsumADCAmplLS7 = new TH2F("h_2DsumADCAmplLS7", " ", neta, -41., 41., nphi, 0., bphi); - h_2DsumADCAmplLS7_LSselected = new TH2F("h_2DsumADCAmplLS7_LSselected", " ", neta, -41., 41., nphi, 0., bphi); - h_2D0sumADCAmplLS7 = new TH2F("h_2D0sumADCAmplLS7", " ", neta, -41., 41., nphi, 0., bphi); - h_sumADCAmplperLS7 = new TH1F("h_sumADCAmplperLS7", " ", bac, 1., bac2); - h_sumCutADCAmplperLS7 = new TH1F("h_sumCutADCAmplperLS7", " ", bac, 1., bac2); - h_sum0ADCAmplperLS7 = new TH1F("h_sum0ADCAmplperLS7", " ", bac, 1., bac2); + h_sumADCAmplperLS6u = fs_->make("h_sumADCAmplperLS6u", " ", bac, 1., bac2); + h_sumCutADCAmplperLS6u = fs_->make("h_sumCutADCAmplperLS6u", " ", bac, 1., bac2); + h_sum0ADCAmplperLS6u = fs_->make("h_sum0ADCAmplperLS6u", " ", bac, 1., bac2); + + h_sumADCAmplLS7 = fs_->make("h_sumADCAmplLS7", " ", 100, 0., lsdep_estimator1_HFdepth2_); + h_2DsumADCAmplLS7 = fs_->make("h_2DsumADCAmplLS7", " ", neta, -41., 41., nphi, 0., bphi); + h_2DsumADCAmplLS7_LSselected = + fs_->make("h_2DsumADCAmplLS7_LSselected", " ", neta, -41., 41., nphi, 0., bphi); + h_2D0sumADCAmplLS7 = fs_->make("h_2D0sumADCAmplLS7", " ", neta, -41., 41., nphi, 0., bphi); + h_sumADCAmplperLS7 = fs_->make("h_sumADCAmplperLS7", " ", bac, 1., bac2); + h_sumCutADCAmplperLS7 = fs_->make("h_sumCutADCAmplperLS7", " ", bac, 1., bac2); + h_sum0ADCAmplperLS7 = fs_->make("h_sum0ADCAmplperLS7", " ", bac, 1., bac2); // HF upgrade depth4 - h_sumADCAmplperLS7u = new TH1F("h_sumADCAmplperLS7u", " ", bac, 1., bac2); - h_sumCutADCAmplperLS7u = new TH1F("h_sumCutADCAmplperLS7u", " ", bac, 1., bac2); - h_sum0ADCAmplperLS7u = new TH1F("h_sum0ADCAmplperLS7u", " ", bac, 1., bac2); - - h_sumADCAmplLS8 = new TH1F("h_sumADCAmplLS8", " ", 100, 0., lsdep_estimator1_HOdepth4_); - h_2DsumADCAmplLS8 = new TH2F("h_2DsumADCAmplLS8", " ", neta, -41., 41., nphi, 0., bphi); - h_2DsumADCAmplLS8_LSselected = new TH2F("h_2DsumADCAmplLS8_LSselected", " ", neta, -41., 41., nphi, 0., bphi); - h_sumADCAmplperLS8 = new TH1F("h_sumADCAmplperLS8", " ", bac, 1., bac2); - h_sumCutADCAmplperLS8 = new TH1F("h_sumCutADCAmplperLS8", " ", bac, 1., bac2); - h_2D0sumADCAmplLS8 = new TH2F("h_2D0sumADCAmplLS8", " ", neta, -41., 41., nphi, 0., bphi); - h_sum0ADCAmplperLS8 = new TH1F("h_sum0ADCAmplperLS8", " ", bac, 1., bac2); + h_sumADCAmplperLS7u = fs_->make("h_sumADCAmplperLS7u", " ", bac, 1., bac2); + h_sumCutADCAmplperLS7u = fs_->make("h_sumCutADCAmplperLS7u", " ", bac, 1., bac2); + h_sum0ADCAmplperLS7u = fs_->make("h_sum0ADCAmplperLS7u", " ", bac, 1., bac2); + + h_sumADCAmplLS8 = fs_->make("h_sumADCAmplLS8", " ", 100, 0., lsdep_estimator1_HOdepth4_); + h_2DsumADCAmplLS8 = fs_->make("h_2DsumADCAmplLS8", " ", neta, -41., 41., nphi, 0., bphi); + h_2DsumADCAmplLS8_LSselected = + fs_->make("h_2DsumADCAmplLS8_LSselected", " ", neta, -41., 41., nphi, 0., bphi); + h_sumADCAmplperLS8 = fs_->make("h_sumADCAmplperLS8", " ", bac, 1., bac2); + h_sumCutADCAmplperLS8 = fs_->make("h_sumCutADCAmplperLS8", " ", bac, 1., bac2); + h_2D0sumADCAmplLS8 = fs_->make("h_2D0sumADCAmplLS8", " ", neta, -41., 41., nphi, 0., bphi); + h_sum0ADCAmplperLS8 = fs_->make("h_sum0ADCAmplperLS8", " ", bac, 1., bac2); // HB upgrade depth3 - h_sumADCAmplperLSdepth3HBu = new TH1F("h_sumADCAmplperLSdepth3HBu", " ", bac, 1., bac2); - h_sumCutADCAmplperLSdepth3HBu = new TH1F("h_sumCutADCAmplperLSdepth3HBu", " ", bac, 1., bac2); - h_sum0ADCAmplperLSdepth3HBu = new TH1F("h_sum0ADCAmplperLSdepth3HBu", " ", bac, 1., bac2); + h_sumADCAmplperLSdepth3HBu = fs_->make("h_sumADCAmplperLSdepth3HBu", " ", bac, 1., bac2); + h_sumCutADCAmplperLSdepth3HBu = fs_->make("h_sumCutADCAmplperLSdepth3HBu", " ", bac, 1., bac2); + h_sum0ADCAmplperLSdepth3HBu = fs_->make("h_sum0ADCAmplperLSdepth3HBu", " ", bac, 1., bac2); // HB upgrade depth4 - h_sumADCAmplperLSdepth4HBu = new TH1F("h_sumADCAmplperLSdepth4HBu", " ", bac, 1., bac2); - h_sumCutADCAmplperLSdepth4HBu = new TH1F("h_sumCutADCAmplperLSdepth4HBu", " ", bac, 1., bac2); - h_sum0ADCAmplperLSdepth4HBu = new TH1F("h_sum0ADCAmplperLSdepth4HBu", " ", bac, 1., bac2); + h_sumADCAmplperLSdepth4HBu = fs_->make("h_sumADCAmplperLSdepth4HBu", " ", bac, 1., bac2); + h_sumCutADCAmplperLSdepth4HBu = fs_->make("h_sumCutADCAmplperLSdepth4HBu", " ", bac, 1., bac2); + h_sum0ADCAmplperLSdepth4HBu = fs_->make("h_sum0ADCAmplperLSdepth4HBu", " ", bac, 1., bac2); // for HB gain stability vs LS: - h_2DsumADCAmplLSdepth3HBu = new TH2F("h_2DsumADCAmplLSdepth3HBu", " ", neta, -41., 41., nphi, 0., bphi); - h_2D0sumADCAmplLSdepth3HBu = new TH2F("h_2D0sumADCAmplLSdepth3HBu", " ", neta, -41., 41., nphi, 0., bphi); - h_2DsumADCAmplLSdepth4HBu = new TH2F("h_2DsumADCAmplLSdepth4HBu", " ", neta, -41., 41., nphi, 0., bphi); - h_2D0sumADCAmplLSdepth4HBu = new TH2F("h_2D0sumADCAmplLSdepth4HBu", " ", neta, -41., 41., nphi, 0., bphi); + h_2DsumADCAmplLSdepth3HBu = fs_->make("h_2DsumADCAmplLSdepth3HBu", " ", neta, -41., 41., nphi, 0., bphi); + h_2D0sumADCAmplLSdepth3HBu = fs_->make("h_2D0sumADCAmplLSdepth3HBu", " ", neta, -41., 41., nphi, 0., bphi); + h_2DsumADCAmplLSdepth4HBu = fs_->make("h_2DsumADCAmplLSdepth4HBu", " ", neta, -41., 41., nphi, 0., bphi); + h_2D0sumADCAmplLSdepth4HBu = fs_->make("h_2D0sumADCAmplLSdepth4HBu", " ", neta, -41., 41., nphi, 0., bphi); // error-A for HB( depth1 only) - h_sumADCAmplperLS1_P1 = new TH1F("h_sumADCAmplperLS1_P1", " ", bac, 1., bac2); - h_sum0ADCAmplperLS1_P1 = new TH1F("h_sum0ADCAmplperLS1_P1", " ", bac, 1., bac2); - h_sumADCAmplperLS1_P2 = new TH1F("h_sumADCAmplperLS1_P2", " ", bac, 1., bac2); - h_sum0ADCAmplperLS1_P2 = new TH1F("h_sum0ADCAmplperLS1_P2", " ", bac, 1., bac2); - h_sumADCAmplperLS1_M1 = new TH1F("h_sumADCAmplperLS1_M1", " ", bac, 1., bac2); - h_sum0ADCAmplperLS1_M1 = new TH1F("h_sum0ADCAmplperLS1_M1", " ", bac, 1., bac2); - h_sumADCAmplperLS1_M2 = new TH1F("h_sumADCAmplperLS1_M2", " ", bac, 1., bac2); - h_sum0ADCAmplperLS1_M2 = new TH1F("h_sum0ADCAmplperLS1_M2", " ", bac, 1., bac2); + h_sumADCAmplperLS1_P1 = fs_->make("h_sumADCAmplperLS1_P1", " ", bac, 1., bac2); + h_sum0ADCAmplperLS1_P1 = fs_->make("h_sum0ADCAmplperLS1_P1", " ", bac, 1., bac2); + h_sumADCAmplperLS1_P2 = fs_->make("h_sumADCAmplperLS1_P2", " ", bac, 1., bac2); + h_sum0ADCAmplperLS1_P2 = fs_->make("h_sum0ADCAmplperLS1_P2", " ", bac, 1., bac2); + h_sumADCAmplperLS1_M1 = fs_->make("h_sumADCAmplperLS1_M1", " ", bac, 1., bac2); + h_sum0ADCAmplperLS1_M1 = fs_->make("h_sum0ADCAmplperLS1_M1", " ", bac, 1., bac2); + h_sumADCAmplperLS1_M2 = fs_->make("h_sumADCAmplperLS1_M2", " ", bac, 1., bac2); + h_sum0ADCAmplperLS1_M2 = fs_->make("h_sum0ADCAmplperLS1_M2", " ", bac, 1., bac2); // error-A for HE( depth1 only) - h_sumADCAmplperLS3_P1 = new TH1F("h_sumADCAmplperLS3_P1", " ", bac, 1., bac2); - h_sum0ADCAmplperLS3_P1 = new TH1F("h_sum0ADCAmplperLS3_P1", " ", bac, 1., bac2); - h_sumADCAmplperLS3_P2 = new TH1F("h_sumADCAmplperLS3_P2", " ", bac, 1., bac2); - h_sum0ADCAmplperLS3_P2 = new TH1F("h_sum0ADCAmplperLS3_P2", " ", bac, 1., bac2); - h_sumADCAmplperLS3_M1 = new TH1F("h_sumADCAmplperLS3_M1", " ", bac, 1., bac2); - h_sum0ADCAmplperLS3_M1 = new TH1F("h_sum0ADCAmplperLS3_M1", " ", bac, 1., bac2); - h_sumADCAmplperLS3_M2 = new TH1F("h_sumADCAmplperLS3_M2", " ", bac, 1., bac2); - h_sum0ADCAmplperLS3_M2 = new TH1F("h_sum0ADCAmplperLS3_M2", " ", bac, 1., bac2); + h_sumADCAmplperLS3_P1 = fs_->make("h_sumADCAmplperLS3_P1", " ", bac, 1., bac2); + h_sum0ADCAmplperLS3_P1 = fs_->make("h_sum0ADCAmplperLS3_P1", " ", bac, 1., bac2); + h_sumADCAmplperLS3_P2 = fs_->make("h_sumADCAmplperLS3_P2", " ", bac, 1., bac2); + h_sum0ADCAmplperLS3_P2 = fs_->make("h_sum0ADCAmplperLS3_P2", " ", bac, 1., bac2); + h_sumADCAmplperLS3_M1 = fs_->make("h_sumADCAmplperLS3_M1", " ", bac, 1., bac2); + h_sum0ADCAmplperLS3_M1 = fs_->make("h_sum0ADCAmplperLS3_M1", " ", bac, 1., bac2); + h_sumADCAmplperLS3_M2 = fs_->make("h_sumADCAmplperLS3_M2", " ", bac, 1., bac2); + h_sum0ADCAmplperLS3_M2 = fs_->make("h_sum0ADCAmplperLS3_M2", " ", bac, 1., bac2); // error-A for HF( depth1 only) - h_sumADCAmplperLS6_P1 = new TH1F("h_sumADCAmplperLS6_P1", " ", bac, 1., bac2); - h_sum0ADCAmplperLS6_P1 = new TH1F("h_sum0ADCAmplperLS6_P1", " ", bac, 1., bac2); - h_sumADCAmplperLS6_P2 = new TH1F("h_sumADCAmplperLS6_P2", " ", bac, 1., bac2); - h_sum0ADCAmplperLS6_P2 = new TH1F("h_sum0ADCAmplperLS6_P2", " ", bac, 1., bac2); - h_sumADCAmplperLS6_M1 = new TH1F("h_sumADCAmplperLS6_M1", " ", bac, 1., bac2); - h_sum0ADCAmplperLS6_M1 = new TH1F("h_sum0ADCAmplperLS6_M1", " ", bac, 1., bac2); - h_sumADCAmplperLS6_M2 = new TH1F("h_sumADCAmplperLS6_M2", " ", bac, 1., bac2); - h_sum0ADCAmplperLS6_M2 = new TH1F("h_sum0ADCAmplperLS6_M2", " ", bac, 1., bac2); + h_sumADCAmplperLS6_P1 = fs_->make("h_sumADCAmplperLS6_P1", " ", bac, 1., bac2); + h_sum0ADCAmplperLS6_P1 = fs_->make("h_sum0ADCAmplperLS6_P1", " ", bac, 1., bac2); + h_sumADCAmplperLS6_P2 = fs_->make("h_sumADCAmplperLS6_P2", " ", bac, 1., bac2); + h_sum0ADCAmplperLS6_P2 = fs_->make("h_sum0ADCAmplperLS6_P2", " ", bac, 1., bac2); + h_sumADCAmplperLS6_M1 = fs_->make("h_sumADCAmplperLS6_M1", " ", bac, 1., bac2); + h_sum0ADCAmplperLS6_M1 = fs_->make("h_sum0ADCAmplperLS6_M1", " ", bac, 1., bac2); + h_sumADCAmplperLS6_M2 = fs_->make("h_sumADCAmplperLS6_M2", " ", bac, 1., bac2); + h_sum0ADCAmplperLS6_M2 = fs_->make("h_sum0ADCAmplperLS6_M2", " ", bac, 1., bac2); // error-A for HO( depth4 only) - h_sumADCAmplperLS8_P1 = new TH1F("h_sumADCAmplperLS8_P1", " ", bac, 1., bac2); - h_sum0ADCAmplperLS8_P1 = new TH1F("h_sum0ADCAmplperLS8_P1", " ", bac, 1., bac2); - h_sumADCAmplperLS8_P2 = new TH1F("h_sumADCAmplperLS8_P2", " ", bac, 1., bac2); - h_sum0ADCAmplperLS8_P2 = new TH1F("h_sum0ADCAmplperLS8_P2", " ", bac, 1., bac2); - h_sumADCAmplperLS8_M1 = new TH1F("h_sumADCAmplperLS8_M1", " ", bac, 1., bac2); - h_sum0ADCAmplperLS8_M1 = new TH1F("h_sum0ADCAmplperLS8_M1", " ", bac, 1., bac2); - h_sumADCAmplperLS8_M2 = new TH1F("h_sumADCAmplperLS8_M2", " ", bac, 1., bac2); - h_sum0ADCAmplperLS8_M2 = new TH1F("h_sum0ADCAmplperLS8_M2", " ", bac, 1., bac2); + h_sumADCAmplperLS8_P1 = fs_->make("h_sumADCAmplperLS8_P1", " ", bac, 1., bac2); + h_sum0ADCAmplperLS8_P1 = fs_->make("h_sum0ADCAmplperLS8_P1", " ", bac, 1., bac2); + h_sumADCAmplperLS8_P2 = fs_->make("h_sumADCAmplperLS8_P2", " ", bac, 1., bac2); + h_sum0ADCAmplperLS8_P2 = fs_->make("h_sum0ADCAmplperLS8_P2", " ", bac, 1., bac2); + h_sumADCAmplperLS8_M1 = fs_->make("h_sumADCAmplperLS8_M1", " ", bac, 1., bac2); + h_sum0ADCAmplperLS8_M1 = fs_->make("h_sum0ADCAmplperLS8_M1", " ", bac, 1., bac2); + h_sumADCAmplperLS8_M2 = fs_->make("h_sumADCAmplperLS8_M2", " ", bac, 1., bac2); + h_sum0ADCAmplperLS8_M2 = fs_->make("h_sum0ADCAmplperLS8_M2", " ", bac, 1., bac2); //-------------------------------------------------- - h_sumTSmeanALS1 = new TH1F("h_sumTSmeanALS1", " ", 100, 0., lsdep_estimator2_HBdepth1_); - h_2DsumTSmeanALS1 = new TH2F("h_2DsumTSmeanALS1", " ", neta, -41., 41., nphi, 0., bphi); - h_sumTSmeanAperLS1 = new TH1F("h_sumTSmeanAperLS1", " ", bac, 1., bac2); - h_sumTSmeanAperLS1_LSselected = new TH1F("h_sumTSmeanAperLS1_LSselected", " ", bac, 1., bac2); - h_sumCutTSmeanAperLS1 = new TH1F("h_sumCutTSmeanAperLS1", " ", bac, 1., bac2); - h_2D0sumTSmeanALS1 = new TH2F("h_2D0sumTSmeanALS1", " ", neta, -41., 41., nphi, 0., bphi); - h_sum0TSmeanAperLS1 = new TH1F("h_sum0TSmeanAperLS1", " ", bac, 1., bac2); - - h_sumTSmeanALS2 = new TH1F("h_sumTSmeanALS2", " ", 100, 0., lsdep_estimator2_HBdepth2_); - h_2DsumTSmeanALS2 = new TH2F("h_2DsumTSmeanALS2", " ", neta, -41., 41., nphi, 0., bphi); - h_sumTSmeanAperLS2 = new TH1F("h_sumTSmeanAperLS2", " ", bac, 1., bac2); - h_sumCutTSmeanAperLS2 = new TH1F("h_sumCutTSmeanAperLS2", " ", bac, 1., bac2); - h_2D0sumTSmeanALS2 = new TH2F("h_2D0sumTSmeanALS2", " ", neta, -41., 41., nphi, 0., bphi); - h_sum0TSmeanAperLS2 = new TH1F("h_sum0TSmeanAperLS2", " ", bac, 1., bac2); - - h_sumTSmeanALS3 = new TH1F("h_sumTSmeanALS3", " ", 100, 0., lsdep_estimator2_HEdepth1_); - h_2DsumTSmeanALS3 = new TH2F("h_2DsumTSmeanALS3", " ", neta, -41., 41., nphi, 0., bphi); - h_sumTSmeanAperLS3 = new TH1F("h_sumTSmeanAperLS3", " ", bac, 1., bac2); - h_sumCutTSmeanAperLS3 = new TH1F("h_sumCutTSmeanAperLS3", " ", bac, 1., bac2); - h_2D0sumTSmeanALS3 = new TH2F("h_2D0sumTSmeanALS3", " ", neta, -41., 41., nphi, 0., bphi); - h_sum0TSmeanAperLS3 = new TH1F("h_sum0TSmeanAperLS3", " ", bac, 1., bac2); - - h_sumTSmeanALS4 = new TH1F("h_sumTSmeanALS4", " ", 100, 0., lsdep_estimator2_HEdepth2_); - h_2DsumTSmeanALS4 = new TH2F("h_2DsumTSmeanALS4", " ", neta, -41., 41., nphi, 0., bphi); - h_sumTSmeanAperLS4 = new TH1F("h_sumTSmeanAperLS4", " ", bac, 1., bac2); - h_sumCutTSmeanAperLS4 = new TH1F("h_sumCutTSmeanAperLS4", " ", bac, 1., bac2); - h_2D0sumTSmeanALS4 = new TH2F("h_2D0sumTSmeanALS4", " ", neta, -41., 41., nphi, 0., bphi); - h_sum0TSmeanAperLS4 = new TH1F("h_sum0TSmeanAperLS4", " ", bac, 1., bac2); - - h_sumTSmeanALS5 = new TH1F("h_sumTSmeanALS5", " ", 100, 0., lsdep_estimator2_HEdepth3_); - h_2DsumTSmeanALS5 = new TH2F("h_2DsumTSmeanALS5", " ", neta, -41., 41., nphi, 0., bphi); - h_sumTSmeanAperLS5 = new TH1F("h_sumTSmeanAperLS5", " ", bac, 1., bac2); - h_sumCutTSmeanAperLS5 = new TH1F("h_sumCutTSmeanAperLS5", " ", bac, 1., bac2); - h_2D0sumTSmeanALS5 = new TH2F("h_2D0sumTSmeanALS5", " ", neta, -41., 41., nphi, 0., bphi); - h_sum0TSmeanAperLS5 = new TH1F("h_sum0TSmeanAperLS5", " ", bac, 1., bac2); - - h_sumTSmeanALS6 = new TH1F("h_sumTSmeanALS6", " ", 100, 0., lsdep_estimator2_HFdepth1_); - h_2DsumTSmeanALS6 = new TH2F("h_2DsumTSmeanALS6", " ", neta, -41., 41., nphi, 0., bphi); - h_sumTSmeanAperLS6 = new TH1F("h_sumTSmeanAperLS6", " ", bac, 1., bac2); - h_sumCutTSmeanAperLS6 = new TH1F("h_sumCutTSmeanAperLS6", " ", bac, 1., bac2); - h_2D0sumTSmeanALS6 = new TH2F("h_2D0sumTSmeanALS6", " ", neta, -41., 41., nphi, 0., bphi); - h_sum0TSmeanAperLS6 = new TH1F("h_sum0TSmeanAperLS6", " ", bac, 1., bac2); - - h_sumTSmeanALS7 = new TH1F("h_sumTSmeanALS7", " ", 100, 0., lsdep_estimator2_HFdepth2_); - h_2DsumTSmeanALS7 = new TH2F("h_2DsumTSmeanALS7", " ", neta, -41., 41., nphi, 0., bphi); - h_sumTSmeanAperLS7 = new TH1F("h_sumTSmeanAperLS7", " ", bac, 1., bac2); - h_sumCutTSmeanAperLS7 = new TH1F("h_sumCutTSmeanAperLS7", " ", bac, 1., bac2); - h_2D0sumTSmeanALS7 = new TH2F("h_2D0sumTSmeanALS7", " ", neta, -41., 41., nphi, 0., bphi); - h_sum0TSmeanAperLS7 = new TH1F("h_sum0TSmeanAperLS7", " ", bac, 1., bac2); - - h_sumTSmeanALS8 = new TH1F("h_sumTSmeanALS8", " ", 100, 0., lsdep_estimator2_HOdepth4_); - h_2DsumTSmeanALS8 = new TH2F("h_2DsumTSmeanALS8", " ", neta, -41., 41., nphi, 0., bphi); - h_sumTSmeanAperLS8 = new TH1F("h_sumTSmeanAperLS8", " ", bac, 1., bac2); - h_sumCutTSmeanAperLS8 = new TH1F("h_sumCutTSmeanAperLS8", " ", bac, 1., bac2); - h_2D0sumTSmeanALS8 = new TH2F("h_2D0sumTSmeanALS8", " ", neta, -41., 41., nphi, 0., bphi); - h_sum0TSmeanAperLS8 = new TH1F("h_sum0TSmeanAperLS8", " ", bac, 1., bac2); + h_sumTSmeanALS1 = fs_->make("h_sumTSmeanALS1", " ", 100, 0., lsdep_estimator2_HBdepth1_); + h_2DsumTSmeanALS1 = fs_->make("h_2DsumTSmeanALS1", " ", neta, -41., 41., nphi, 0., bphi); + h_sumTSmeanAperLS1 = fs_->make("h_sumTSmeanAperLS1", " ", bac, 1., bac2); + h_sumTSmeanAperLS1_LSselected = fs_->make("h_sumTSmeanAperLS1_LSselected", " ", bac, 1., bac2); + h_sumCutTSmeanAperLS1 = fs_->make("h_sumCutTSmeanAperLS1", " ", bac, 1., bac2); + h_2D0sumTSmeanALS1 = fs_->make("h_2D0sumTSmeanALS1", " ", neta, -41., 41., nphi, 0., bphi); + h_sum0TSmeanAperLS1 = fs_->make("h_sum0TSmeanAperLS1", " ", bac, 1., bac2); + + h_sumTSmeanALS2 = fs_->make("h_sumTSmeanALS2", " ", 100, 0., lsdep_estimator2_HBdepth2_); + h_2DsumTSmeanALS2 = fs_->make("h_2DsumTSmeanALS2", " ", neta, -41., 41., nphi, 0., bphi); + h_sumTSmeanAperLS2 = fs_->make("h_sumTSmeanAperLS2", " ", bac, 1., bac2); + h_sumCutTSmeanAperLS2 = fs_->make("h_sumCutTSmeanAperLS2", " ", bac, 1., bac2); + h_2D0sumTSmeanALS2 = fs_->make("h_2D0sumTSmeanALS2", " ", neta, -41., 41., nphi, 0., bphi); + h_sum0TSmeanAperLS2 = fs_->make("h_sum0TSmeanAperLS2", " ", bac, 1., bac2); + + h_sumTSmeanALS3 = fs_->make("h_sumTSmeanALS3", " ", 100, 0., lsdep_estimator2_HEdepth1_); + h_2DsumTSmeanALS3 = fs_->make("h_2DsumTSmeanALS3", " ", neta, -41., 41., nphi, 0., bphi); + h_sumTSmeanAperLS3 = fs_->make("h_sumTSmeanAperLS3", " ", bac, 1., bac2); + h_sumCutTSmeanAperLS3 = fs_->make("h_sumCutTSmeanAperLS3", " ", bac, 1., bac2); + h_2D0sumTSmeanALS3 = fs_->make("h_2D0sumTSmeanALS3", " ", neta, -41., 41., nphi, 0., bphi); + h_sum0TSmeanAperLS3 = fs_->make("h_sum0TSmeanAperLS3", " ", bac, 1., bac2); + + h_sumTSmeanALS4 = fs_->make("h_sumTSmeanALS4", " ", 100, 0., lsdep_estimator2_HEdepth2_); + h_2DsumTSmeanALS4 = fs_->make("h_2DsumTSmeanALS4", " ", neta, -41., 41., nphi, 0., bphi); + h_sumTSmeanAperLS4 = fs_->make("h_sumTSmeanAperLS4", " ", bac, 1., bac2); + h_sumCutTSmeanAperLS4 = fs_->make("h_sumCutTSmeanAperLS4", " ", bac, 1., bac2); + h_2D0sumTSmeanALS4 = fs_->make("h_2D0sumTSmeanALS4", " ", neta, -41., 41., nphi, 0., bphi); + h_sum0TSmeanAperLS4 = fs_->make("h_sum0TSmeanAperLS4", " ", bac, 1., bac2); + + h_sumTSmeanALS5 = fs_->make("h_sumTSmeanALS5", " ", 100, 0., lsdep_estimator2_HEdepth3_); + h_2DsumTSmeanALS5 = fs_->make("h_2DsumTSmeanALS5", " ", neta, -41., 41., nphi, 0., bphi); + h_sumTSmeanAperLS5 = fs_->make("h_sumTSmeanAperLS5", " ", bac, 1., bac2); + h_sumCutTSmeanAperLS5 = fs_->make("h_sumCutTSmeanAperLS5", " ", bac, 1., bac2); + h_2D0sumTSmeanALS5 = fs_->make("h_2D0sumTSmeanALS5", " ", neta, -41., 41., nphi, 0., bphi); + h_sum0TSmeanAperLS5 = fs_->make("h_sum0TSmeanAperLS5", " ", bac, 1., bac2); + + h_sumTSmeanALS6 = fs_->make("h_sumTSmeanALS6", " ", 100, 0., lsdep_estimator2_HFdepth1_); + h_2DsumTSmeanALS6 = fs_->make("h_2DsumTSmeanALS6", " ", neta, -41., 41., nphi, 0., bphi); + h_sumTSmeanAperLS6 = fs_->make("h_sumTSmeanAperLS6", " ", bac, 1., bac2); + h_sumCutTSmeanAperLS6 = fs_->make("h_sumCutTSmeanAperLS6", " ", bac, 1., bac2); + h_2D0sumTSmeanALS6 = fs_->make("h_2D0sumTSmeanALS6", " ", neta, -41., 41., nphi, 0., bphi); + h_sum0TSmeanAperLS6 = fs_->make("h_sum0TSmeanAperLS6", " ", bac, 1., bac2); + + h_sumTSmeanALS7 = fs_->make("h_sumTSmeanALS7", " ", 100, 0., lsdep_estimator2_HFdepth2_); + h_2DsumTSmeanALS7 = fs_->make("h_2DsumTSmeanALS7", " ", neta, -41., 41., nphi, 0., bphi); + h_sumTSmeanAperLS7 = fs_->make("h_sumTSmeanAperLS7", " ", bac, 1., bac2); + h_sumCutTSmeanAperLS7 = fs_->make("h_sumCutTSmeanAperLS7", " ", bac, 1., bac2); + h_2D0sumTSmeanALS7 = fs_->make("h_2D0sumTSmeanALS7", " ", neta, -41., 41., nphi, 0., bphi); + h_sum0TSmeanAperLS7 = fs_->make("h_sum0TSmeanAperLS7", " ", bac, 1., bac2); + + h_sumTSmeanALS8 = fs_->make("h_sumTSmeanALS8", " ", 100, 0., lsdep_estimator2_HOdepth4_); + h_2DsumTSmeanALS8 = fs_->make("h_2DsumTSmeanALS8", " ", neta, -41., 41., nphi, 0., bphi); + h_sumTSmeanAperLS8 = fs_->make("h_sumTSmeanAperLS8", " ", bac, 1., bac2); + h_sumCutTSmeanAperLS8 = fs_->make("h_sumCutTSmeanAperLS8", " ", bac, 1., bac2); + h_2D0sumTSmeanALS8 = fs_->make("h_2D0sumTSmeanALS8", " ", neta, -41., 41., nphi, 0., bphi); + h_sum0TSmeanAperLS8 = fs_->make("h_sum0TSmeanAperLS8", " ", bac, 1., bac2); //-------------------------------------------------- // for estimator3: // float est3 = 10.0; - h_sumTSmaxALS1 = new TH1F("h_sumTSmaxALS1", " ", 100, 0., lsdep_estimator3_HBdepth1_); - h_2DsumTSmaxALS1 = new TH2F("h_2DsumTSmaxALS1", " ", neta, -41., 41., nphi, 0., bphi); - h_sumTSmaxAperLS1 = new TH1F("h_sumTSmaxAperLS1", " ", bac, 1., bac2); - h_sumTSmaxAperLS1_LSselected = new TH1F("h_sumTSmaxAperLS1_LSselected", " ", bac, 1., bac2); - h_sumCutTSmaxAperLS1 = new TH1F("h_sumCutTSmaxAperLS1", " ", bac, 1., bac2); - h_2D0sumTSmaxALS1 = new TH2F("h_2D0sumTSmaxALS1", " ", neta, -41., 41., nphi, 0., bphi); - h_sum0TSmaxAperLS1 = new TH1F("h_sum0TSmaxAperLS1", " ", bac, 1., bac2); - - h_sumTSmaxALS2 = new TH1F("h_sumTSmaxALS2", " ", 100, 0., lsdep_estimator3_HBdepth2_); - h_2DsumTSmaxALS2 = new TH2F("h_2DsumTSmaxALS2", " ", neta, -41., 41., nphi, 0., bphi); - h_sumTSmaxAperLS2 = new TH1F("h_sumTSmaxAperLS2", " ", bac, 1., bac2); - h_sumCutTSmaxAperLS2 = new TH1F("h_sumCutTSmaxAperLS2", " ", bac, 1., bac2); - h_2D0sumTSmaxALS2 = new TH2F("h_2D0sumTSmaxALS2", " ", neta, -41., 41., nphi, 0., bphi); - h_sum0TSmaxAperLS2 = new TH1F("h_sum0TSmaxAperLS2", " ", bac, 1., bac2); - - h_sumTSmaxALS3 = new TH1F("h_sumTSmaxALS3", " ", 100, 0., lsdep_estimator3_HEdepth1_); - h_2DsumTSmaxALS3 = new TH2F("h_2DsumTSmaxALS3", " ", neta, -41., 41., nphi, 0., bphi); - h_sumTSmaxAperLS3 = new TH1F("h_sumTSmaxAperLS3", " ", bac, 1., bac2); - h_sumCutTSmaxAperLS3 = new TH1F("h_sumCutTSmaxAperLS3", " ", bac, 1., bac2); - h_2D0sumTSmaxALS3 = new TH2F("h_2D0sumTSmaxALS3", " ", neta, -41., 41., nphi, 0., bphi); - h_sum0TSmaxAperLS3 = new TH1F("h_sum0TSmaxAperLS3", " ", bac, 1., bac2); - - h_sumTSmaxALS4 = new TH1F("h_sumTSmaxALS4", " ", 100, 0., lsdep_estimator3_HEdepth2_); - h_2DsumTSmaxALS4 = new TH2F("h_2DsumTSmaxALS4", " ", neta, -41., 41., nphi, 0., bphi); - h_sumTSmaxAperLS4 = new TH1F("h_sumTSmaxAperLS4", " ", bac, 1., bac2); - h_sumCutTSmaxAperLS4 = new TH1F("h_sumCutTSmaxAperLS4", " ", bac, 1., bac2); - h_2D0sumTSmaxALS4 = new TH2F("h_2D0sumTSmaxALS4", " ", neta, -41., 41., nphi, 0., bphi); - h_sum0TSmaxAperLS4 = new TH1F("h_sum0TSmaxAperLS4", " ", bac, 1., bac2); - - h_sumTSmaxALS5 = new TH1F("h_sumTSmaxALS5", " ", 100, 0., lsdep_estimator3_HEdepth3_); - h_2DsumTSmaxALS5 = new TH2F("h_2DsumTSmaxALS5", " ", neta, -41., 41., nphi, 0., bphi); - h_sumTSmaxAperLS5 = new TH1F("h_sumTSmaxAperLS5", " ", bac, 1., bac2); - h_sumCutTSmaxAperLS5 = new TH1F("h_sumCutTSmaxAperLS5", " ", bac, 1., bac2); - h_2D0sumTSmaxALS5 = new TH2F("h_2D0sumTSmaxALS5", " ", neta, -41., 41., nphi, 0., bphi); - h_sum0TSmaxAperLS5 = new TH1F("h_sum0TSmaxAperLS5", " ", bac, 1., bac2); - - h_sumTSmaxALS6 = new TH1F("h_sumTSmaxALS6", " ", 100, 0., lsdep_estimator3_HFdepth1_); - h_2DsumTSmaxALS6 = new TH2F("h_2DsumTSmaxALS6", " ", neta, -41., 41., nphi, 0., bphi); - h_sumTSmaxAperLS6 = new TH1F("h_sumTSmaxAperLS6", " ", bac, 1., bac2); - h_sumCutTSmaxAperLS6 = new TH1F("h_sumCutTSmaxAperLS6", " ", bac, 1., bac2); - h_2D0sumTSmaxALS6 = new TH2F("h_2D0sumTSmaxALS6", " ", neta, -41., 41., nphi, 0., bphi); - h_sum0TSmaxAperLS6 = new TH1F("h_sum0TSmaxAperLS6", " ", bac, 1., bac2); - - h_sumTSmaxALS7 = new TH1F("h_sumTSmaxALS7", " ", 100, 0., lsdep_estimator3_HFdepth2_); - h_2DsumTSmaxALS7 = new TH2F("h_2DsumTSmaxALS7", " ", neta, -41., 41., nphi, 0., bphi); - h_sumTSmaxAperLS7 = new TH1F("h_sumTSmaxAperLS7", " ", bac, 1., bac2); - h_sumCutTSmaxAperLS7 = new TH1F("h_sumCutTSmaxAperLS7", " ", bac, 1., bac2); - h_2D0sumTSmaxALS7 = new TH2F("h_2D0sumTSmaxALS7", " ", neta, -41., 41., nphi, 0., bphi); - h_sum0TSmaxAperLS7 = new TH1F("h_sum0TSmaxAperLS7", " ", bac, 1., bac2); - - h_sumTSmaxALS8 = new TH1F("h_sumTSmaxALS8", " ", 100, 0., lsdep_estimator3_HOdepth4_); - h_2DsumTSmaxALS8 = new TH2F("h_2DsumTSmaxALS8", " ", neta, -41., 41., nphi, 0., bphi); - h_sumTSmaxAperLS8 = new TH1F("h_sumTSmaxAperLS8", " ", bac, 1., bac2); - h_sumCutTSmaxAperLS8 = new TH1F("h_sumCutTSmaxAperLS8", " ", bac, 1., bac2); - h_2D0sumTSmaxALS8 = new TH2F("h_2D0sumTSmaxALS8", " ", neta, -41., 41., nphi, 0., bphi); - h_sum0TSmaxAperLS8 = new TH1F("h_sum0TSmaxAperLS8", " ", bac, 1., bac2); + h_sumTSmaxALS1 = fs_->make("h_sumTSmaxALS1", " ", 100, 0., lsdep_estimator3_HBdepth1_); + h_2DsumTSmaxALS1 = fs_->make("h_2DsumTSmaxALS1", " ", neta, -41., 41., nphi, 0., bphi); + h_sumTSmaxAperLS1 = fs_->make("h_sumTSmaxAperLS1", " ", bac, 1., bac2); + h_sumTSmaxAperLS1_LSselected = fs_->make("h_sumTSmaxAperLS1_LSselected", " ", bac, 1., bac2); + h_sumCutTSmaxAperLS1 = fs_->make("h_sumCutTSmaxAperLS1", " ", bac, 1., bac2); + h_2D0sumTSmaxALS1 = fs_->make("h_2D0sumTSmaxALS1", " ", neta, -41., 41., nphi, 0., bphi); + h_sum0TSmaxAperLS1 = fs_->make("h_sum0TSmaxAperLS1", " ", bac, 1., bac2); + + h_sumTSmaxALS2 = fs_->make("h_sumTSmaxALS2", " ", 100, 0., lsdep_estimator3_HBdepth2_); + h_2DsumTSmaxALS2 = fs_->make("h_2DsumTSmaxALS2", " ", neta, -41., 41., nphi, 0., bphi); + h_sumTSmaxAperLS2 = fs_->make("h_sumTSmaxAperLS2", " ", bac, 1., bac2); + h_sumCutTSmaxAperLS2 = fs_->make("h_sumCutTSmaxAperLS2", " ", bac, 1., bac2); + h_2D0sumTSmaxALS2 = fs_->make("h_2D0sumTSmaxALS2", " ", neta, -41., 41., nphi, 0., bphi); + h_sum0TSmaxAperLS2 = fs_->make("h_sum0TSmaxAperLS2", " ", bac, 1., bac2); + + h_sumTSmaxALS3 = fs_->make("h_sumTSmaxALS3", " ", 100, 0., lsdep_estimator3_HEdepth1_); + h_2DsumTSmaxALS3 = fs_->make("h_2DsumTSmaxALS3", " ", neta, -41., 41., nphi, 0., bphi); + h_sumTSmaxAperLS3 = fs_->make("h_sumTSmaxAperLS3", " ", bac, 1., bac2); + h_sumCutTSmaxAperLS3 = fs_->make("h_sumCutTSmaxAperLS3", " ", bac, 1., bac2); + h_2D0sumTSmaxALS3 = fs_->make("h_2D0sumTSmaxALS3", " ", neta, -41., 41., nphi, 0., bphi); + h_sum0TSmaxAperLS3 = fs_->make("h_sum0TSmaxAperLS3", " ", bac, 1., bac2); + + h_sumTSmaxALS4 = fs_->make("h_sumTSmaxALS4", " ", 100, 0., lsdep_estimator3_HEdepth2_); + h_2DsumTSmaxALS4 = fs_->make("h_2DsumTSmaxALS4", " ", neta, -41., 41., nphi, 0., bphi); + h_sumTSmaxAperLS4 = fs_->make("h_sumTSmaxAperLS4", " ", bac, 1., bac2); + h_sumCutTSmaxAperLS4 = fs_->make("h_sumCutTSmaxAperLS4", " ", bac, 1., bac2); + h_2D0sumTSmaxALS4 = fs_->make("h_2D0sumTSmaxALS4", " ", neta, -41., 41., nphi, 0., bphi); + h_sum0TSmaxAperLS4 = fs_->make("h_sum0TSmaxAperLS4", " ", bac, 1., bac2); + + h_sumTSmaxALS5 = fs_->make("h_sumTSmaxALS5", " ", 100, 0., lsdep_estimator3_HEdepth3_); + h_2DsumTSmaxALS5 = fs_->make("h_2DsumTSmaxALS5", " ", neta, -41., 41., nphi, 0., bphi); + h_sumTSmaxAperLS5 = fs_->make("h_sumTSmaxAperLS5", " ", bac, 1., bac2); + h_sumCutTSmaxAperLS5 = fs_->make("h_sumCutTSmaxAperLS5", " ", bac, 1., bac2); + h_2D0sumTSmaxALS5 = fs_->make("h_2D0sumTSmaxALS5", " ", neta, -41., 41., nphi, 0., bphi); + h_sum0TSmaxAperLS5 = fs_->make("h_sum0TSmaxAperLS5", " ", bac, 1., bac2); + + h_sumTSmaxALS6 = fs_->make("h_sumTSmaxALS6", " ", 100, 0., lsdep_estimator3_HFdepth1_); + h_2DsumTSmaxALS6 = fs_->make("h_2DsumTSmaxALS6", " ", neta, -41., 41., nphi, 0., bphi); + h_sumTSmaxAperLS6 = fs_->make("h_sumTSmaxAperLS6", " ", bac, 1., bac2); + h_sumCutTSmaxAperLS6 = fs_->make("h_sumCutTSmaxAperLS6", " ", bac, 1., bac2); + h_2D0sumTSmaxALS6 = fs_->make("h_2D0sumTSmaxALS6", " ", neta, -41., 41., nphi, 0., bphi); + h_sum0TSmaxAperLS6 = fs_->make("h_sum0TSmaxAperLS6", " ", bac, 1., bac2); + + h_sumTSmaxALS7 = fs_->make("h_sumTSmaxALS7", " ", 100, 0., lsdep_estimator3_HFdepth2_); + h_2DsumTSmaxALS7 = fs_->make("h_2DsumTSmaxALS7", " ", neta, -41., 41., nphi, 0., bphi); + h_sumTSmaxAperLS7 = fs_->make("h_sumTSmaxAperLS7", " ", bac, 1., bac2); + h_sumCutTSmaxAperLS7 = fs_->make("h_sumCutTSmaxAperLS7", " ", bac, 1., bac2); + h_2D0sumTSmaxALS7 = fs_->make("h_2D0sumTSmaxALS7", " ", neta, -41., 41., nphi, 0., bphi); + h_sum0TSmaxAperLS7 = fs_->make("h_sum0TSmaxAperLS7", " ", bac, 1., bac2); + + h_sumTSmaxALS8 = fs_->make("h_sumTSmaxALS8", " ", 100, 0., lsdep_estimator3_HOdepth4_); + h_2DsumTSmaxALS8 = fs_->make("h_2DsumTSmaxALS8", " ", neta, -41., 41., nphi, 0., bphi); + h_sumTSmaxAperLS8 = fs_->make("h_sumTSmaxAperLS8", " ", bac, 1., bac2); + h_sumCutTSmaxAperLS8 = fs_->make("h_sumCutTSmaxAperLS8", " ", bac, 1., bac2); + h_2D0sumTSmaxALS8 = fs_->make("h_2D0sumTSmaxALS8", " ", neta, -41., 41., nphi, 0., bphi); + h_sum0TSmaxAperLS8 = fs_->make("h_sum0TSmaxAperLS8", " ", bac, 1., bac2); //-------------------------------------------------- // for estimator4: // float est4 = 3.4; // float est41= 2.0; - h_sumAmplitudeLS1 = new TH1F("h_sumAmplitudeLS1", " ", 100, 0.0, lsdep_estimator4_HBdepth1_); - h_2DsumAmplitudeLS1 = new TH2F("h_2DsumAmplitudeLS1", " ", neta, -41., 41., nphi, 0., bphi); - h_sumAmplitudeperLS1 = new TH1F("h_sumAmplitudeperLS1", " ", bac, 1., bac2); - h_sumAmplitudeperLS1_LSselected = new TH1F("h_sumAmplitudeperLS1_LSselected", " ", bac, 1., bac2); - h_sumCutAmplitudeperLS1 = new TH1F("h_sumCutAmplitudeperLS1", " ", bac, 1., bac2); - h_2D0sumAmplitudeLS1 = new TH2F("h_2D0sumAmplitudeLS1", " ", neta, -41., 41., nphi, 0., bphi); - h_sum0AmplitudeperLS1 = new TH1F("h_sum0AmplitudeperLS1", " ", bac, 1., bac2); - - h_sumAmplitudeLS2 = new TH1F("h_sumAmplitudeLS2", " ", 100, 0.0, lsdep_estimator4_HBdepth2_); - h_2DsumAmplitudeLS2 = new TH2F("h_2DsumAmplitudeLS2", " ", neta, -41., 41., nphi, 0., bphi); - h_sumAmplitudeperLS2 = new TH1F("h_sumAmplitudeperLS2", " ", bac, 1., bac2); - h_sumCutAmplitudeperLS2 = new TH1F("h_sumCutAmplitudeperLS2", " ", bac, 1., bac2); - h_2D0sumAmplitudeLS2 = new TH2F("h_2D0sumAmplitudeLS2", " ", neta, -41., 41., nphi, 0., bphi); - h_sum0AmplitudeperLS2 = new TH1F("h_sum0AmplitudeperLS2", " ", bac, 1., bac2); - - h_sumAmplitudeLS3 = new TH1F("h_sumAmplitudeLS3", " ", 100, 0.0, lsdep_estimator4_HEdepth1_); - h_2DsumAmplitudeLS3 = new TH2F("h_2DsumAmplitudeLS3", " ", neta, -41., 41., nphi, 0., bphi); - h_sumAmplitudeperLS3 = new TH1F("h_sumAmplitudeperLS3", " ", bac, 1., bac2); - h_sumCutAmplitudeperLS3 = new TH1F("h_sumCutAmplitudeperLS3", " ", bac, 1., bac2); - h_2D0sumAmplitudeLS3 = new TH2F("h_2D0sumAmplitudeLS3", " ", neta, -41., 41., nphi, 0., bphi); - h_sum0AmplitudeperLS3 = new TH1F("h_sum0AmplitudeperLS3", " ", bac, 1., bac2); - - h_sumAmplitudeLS4 = new TH1F("h_sumAmplitudeLS4", " ", 100, 0.0, lsdep_estimator4_HEdepth2_); - h_2DsumAmplitudeLS4 = new TH2F("h_2DsumAmplitudeLS4", " ", neta, -41., 41., nphi, 0., bphi); - h_sumAmplitudeperLS4 = new TH1F("h_sumAmplitudeperLS4", " ", bac, 1., bac2); - h_sumCutAmplitudeperLS4 = new TH1F("h_sumCutAmplitudeperLS4", " ", bac, 1., bac2); - h_2D0sumAmplitudeLS4 = new TH2F("h_2D0sumAmplitudeLS4", " ", neta, -41., 41., nphi, 0., bphi); - h_sum0AmplitudeperLS4 = new TH1F("h_sum0AmplitudeperLS4", " ", bac, 1., bac2); - - h_sumAmplitudeLS5 = new TH1F("h_sumAmplitudeLS5", " ", 100, 0.0, lsdep_estimator4_HEdepth3_); - h_2DsumAmplitudeLS5 = new TH2F("h_2DsumAmplitudeLS5", " ", neta, -41., 41., nphi, 0., bphi); - h_sumAmplitudeperLS5 = new TH1F("h_sumAmplitudeperLS5", " ", bac, 1., bac2); - h_sumCutAmplitudeperLS5 = new TH1F("h_sumCutAmplitudeperLS5", " ", bac, 1., bac2); - h_2D0sumAmplitudeLS5 = new TH2F("h_2D0sumAmplitudeLS5", " ", neta, -41., 41., nphi, 0., bphi); - h_sum0AmplitudeperLS5 = new TH1F("h_sum0AmplitudeperLS5", " ", bac, 1., bac2); - - h_sumAmplitudeLS6 = new TH1F("h_sumAmplitudeLS6", " ", 100, 0., lsdep_estimator4_HFdepth1_); - h_2DsumAmplitudeLS6 = new TH2F("h_2DsumAmplitudeLS6", " ", neta, -41., 41., nphi, 0., bphi); - h_sumAmplitudeperLS6 = new TH1F("h_sumAmplitudeperLS6", " ", bac, 1., bac2); - h_sumCutAmplitudeperLS6 = new TH1F("h_sumCutAmplitudeperLS6", " ", bac, 1., bac2); - h_2D0sumAmplitudeLS6 = new TH2F("h_2D0sumAmplitudeLS6", " ", neta, -41., 41., nphi, 0., bphi); - h_sum0AmplitudeperLS6 = new TH1F("h_sum0AmplitudeperLS6", " ", bac, 1., bac2); - - h_sumAmplitudeLS7 = new TH1F("h_sumAmplitudeLS7", " ", 100, 0., lsdep_estimator4_HFdepth2_); - h_2DsumAmplitudeLS7 = new TH2F("h_2DsumAmplitudeLS7", " ", neta, -41., 41., nphi, 0., bphi); - h_sumAmplitudeperLS7 = new TH1F("h_sumAmplitudeperLS7", " ", bac, 1., bac2); - h_sumCutAmplitudeperLS7 = new TH1F("h_sumCutAmplitudeperLS7", " ", bac, 1., bac2); - h_2D0sumAmplitudeLS7 = new TH2F("h_2D0sumAmplitudeLS7", " ", neta, -41., 41., nphi, 0., bphi); - h_sum0AmplitudeperLS7 = new TH1F("h_sum0AmplitudeperLS7", " ", bac, 1., bac2); - - h_sumAmplitudeLS8 = new TH1F("h_sumAmplitudeLS8", " ", 100, 0., lsdep_estimator4_HOdepth4_); - h_2DsumAmplitudeLS8 = new TH2F("h_2DsumAmplitudeLS8", " ", neta, -41., 41., nphi, 0., bphi); - h_sumAmplitudeperLS8 = new TH1F("h_sumAmplitudeperLS8", " ", bac, 1., bac2); - h_sumCutAmplitudeperLS8 = new TH1F("h_sumCutAmplitudeperLS8", " ", bac, 1., bac2); - h_2D0sumAmplitudeLS8 = new TH2F("h_2D0sumAmplitudeLS8", " ", neta, -41., 41., nphi, 0., bphi); - h_sum0AmplitudeperLS8 = new TH1F("h_sum0AmplitudeperLS8", " ", bac, 1., bac2); + h_sumAmplitudeLS1 = fs_->make("h_sumAmplitudeLS1", " ", 100, 0.0, lsdep_estimator4_HBdepth1_); + h_2DsumAmplitudeLS1 = fs_->make("h_2DsumAmplitudeLS1", " ", neta, -41., 41., nphi, 0., bphi); + h_sumAmplitudeperLS1 = fs_->make("h_sumAmplitudeperLS1", " ", bac, 1., bac2); + h_sumAmplitudeperLS1_LSselected = fs_->make("h_sumAmplitudeperLS1_LSselected", " ", bac, 1., bac2); + h_sumCutAmplitudeperLS1 = fs_->make("h_sumCutAmplitudeperLS1", " ", bac, 1., bac2); + h_2D0sumAmplitudeLS1 = fs_->make("h_2D0sumAmplitudeLS1", " ", neta, -41., 41., nphi, 0., bphi); + h_sum0AmplitudeperLS1 = fs_->make("h_sum0AmplitudeperLS1", " ", bac, 1., bac2); + + h_sumAmplitudeLS2 = fs_->make("h_sumAmplitudeLS2", " ", 100, 0.0, lsdep_estimator4_HBdepth2_); + h_2DsumAmplitudeLS2 = fs_->make("h_2DsumAmplitudeLS2", " ", neta, -41., 41., nphi, 0., bphi); + h_sumAmplitudeperLS2 = fs_->make("h_sumAmplitudeperLS2", " ", bac, 1., bac2); + h_sumCutAmplitudeperLS2 = fs_->make("h_sumCutAmplitudeperLS2", " ", bac, 1., bac2); + h_2D0sumAmplitudeLS2 = fs_->make("h_2D0sumAmplitudeLS2", " ", neta, -41., 41., nphi, 0., bphi); + h_sum0AmplitudeperLS2 = fs_->make("h_sum0AmplitudeperLS2", " ", bac, 1., bac2); + + h_sumAmplitudeLS3 = fs_->make("h_sumAmplitudeLS3", " ", 100, 0.0, lsdep_estimator4_HEdepth1_); + h_2DsumAmplitudeLS3 = fs_->make("h_2DsumAmplitudeLS3", " ", neta, -41., 41., nphi, 0., bphi); + h_sumAmplitudeperLS3 = fs_->make("h_sumAmplitudeperLS3", " ", bac, 1., bac2); + h_sumCutAmplitudeperLS3 = fs_->make("h_sumCutAmplitudeperLS3", " ", bac, 1., bac2); + h_2D0sumAmplitudeLS3 = fs_->make("h_2D0sumAmplitudeLS3", " ", neta, -41., 41., nphi, 0., bphi); + h_sum0AmplitudeperLS3 = fs_->make("h_sum0AmplitudeperLS3", " ", bac, 1., bac2); + + h_sumAmplitudeLS4 = fs_->make("h_sumAmplitudeLS4", " ", 100, 0.0, lsdep_estimator4_HEdepth2_); + h_2DsumAmplitudeLS4 = fs_->make("h_2DsumAmplitudeLS4", " ", neta, -41., 41., nphi, 0., bphi); + h_sumAmplitudeperLS4 = fs_->make("h_sumAmplitudeperLS4", " ", bac, 1., bac2); + h_sumCutAmplitudeperLS4 = fs_->make("h_sumCutAmplitudeperLS4", " ", bac, 1., bac2); + h_2D0sumAmplitudeLS4 = fs_->make("h_2D0sumAmplitudeLS4", " ", neta, -41., 41., nphi, 0., bphi); + h_sum0AmplitudeperLS4 = fs_->make("h_sum0AmplitudeperLS4", " ", bac, 1., bac2); + + h_sumAmplitudeLS5 = fs_->make("h_sumAmplitudeLS5", " ", 100, 0.0, lsdep_estimator4_HEdepth3_); + h_2DsumAmplitudeLS5 = fs_->make("h_2DsumAmplitudeLS5", " ", neta, -41., 41., nphi, 0., bphi); + h_sumAmplitudeperLS5 = fs_->make("h_sumAmplitudeperLS5", " ", bac, 1., bac2); + h_sumCutAmplitudeperLS5 = fs_->make("h_sumCutAmplitudeperLS5", " ", bac, 1., bac2); + h_2D0sumAmplitudeLS5 = fs_->make("h_2D0sumAmplitudeLS5", " ", neta, -41., 41., nphi, 0., bphi); + h_sum0AmplitudeperLS5 = fs_->make("h_sum0AmplitudeperLS5", " ", bac, 1., bac2); + + h_sumAmplitudeLS6 = fs_->make("h_sumAmplitudeLS6", " ", 100, 0., lsdep_estimator4_HFdepth1_); + h_2DsumAmplitudeLS6 = fs_->make("h_2DsumAmplitudeLS6", " ", neta, -41., 41., nphi, 0., bphi); + h_sumAmplitudeperLS6 = fs_->make("h_sumAmplitudeperLS6", " ", bac, 1., bac2); + h_sumCutAmplitudeperLS6 = fs_->make("h_sumCutAmplitudeperLS6", " ", bac, 1., bac2); + h_2D0sumAmplitudeLS6 = fs_->make("h_2D0sumAmplitudeLS6", " ", neta, -41., 41., nphi, 0., bphi); + h_sum0AmplitudeperLS6 = fs_->make("h_sum0AmplitudeperLS6", " ", bac, 1., bac2); + + h_sumAmplitudeLS7 = fs_->make("h_sumAmplitudeLS7", " ", 100, 0., lsdep_estimator4_HFdepth2_); + h_2DsumAmplitudeLS7 = fs_->make("h_2DsumAmplitudeLS7", " ", neta, -41., 41., nphi, 0., bphi); + h_sumAmplitudeperLS7 = fs_->make("h_sumAmplitudeperLS7", " ", bac, 1., bac2); + h_sumCutAmplitudeperLS7 = fs_->make("h_sumCutAmplitudeperLS7", " ", bac, 1., bac2); + h_2D0sumAmplitudeLS7 = fs_->make("h_2D0sumAmplitudeLS7", " ", neta, -41., 41., nphi, 0., bphi); + h_sum0AmplitudeperLS7 = fs_->make("h_sum0AmplitudeperLS7", " ", bac, 1., bac2); + + h_sumAmplitudeLS8 = fs_->make("h_sumAmplitudeLS8", " ", 100, 0., lsdep_estimator4_HOdepth4_); + h_2DsumAmplitudeLS8 = fs_->make("h_2DsumAmplitudeLS8", " ", neta, -41., 41., nphi, 0., bphi); + h_sumAmplitudeperLS8 = fs_->make("h_sumAmplitudeperLS8", " ", bac, 1., bac2); + h_sumCutAmplitudeperLS8 = fs_->make("h_sumCutAmplitudeperLS8", " ", bac, 1., bac2); + h_2D0sumAmplitudeLS8 = fs_->make("h_2D0sumAmplitudeLS8", " ", neta, -41., 41., nphi, 0., bphi); + h_sum0AmplitudeperLS8 = fs_->make("h_sum0AmplitudeperLS8", " ", bac, 1., bac2); //-------------------------------------------------- // for estimator5: // float est5 = 0.6; // float est51= 1.0; // float est52= 0.8; - h_sumAmplLS1 = new TH1F("h_sumAmplLS1", " ", 100, 0.0, lsdep_estimator5_HBdepth1_); - h_2DsumAmplLS1 = new TH2F("h_2DsumAmplLS1", " ", neta, -41., 41., nphi, 0., bphi); - h_sumAmplperLS1 = new TH1F("h_sumAmplperLS1", " ", bac, 1., bac2); - h_sumAmplperLS1_LSselected = new TH1F("h_sumAmplperLS1_LSselected", " ", bac, 1., bac2); - h_sumCutAmplperLS1 = new TH1F("h_sumCutAmplperLS1", " ", bac, 1., bac2); - h_2D0sumAmplLS1 = new TH2F("h_2D0sumAmplLS1", " ", neta, -41., 41., nphi, 0., bphi); - h_sum0AmplperLS1 = new TH1F("h_sum0AmplperLS1", " ", bac, 1., bac2); - - h_sumAmplLS2 = new TH1F("h_sumAmplLS2", " ", 100, 0.0, lsdep_estimator5_HBdepth2_); - h_2DsumAmplLS2 = new TH2F("h_2DsumAmplLS2", " ", neta, -41., 41., nphi, 0., bphi); - h_sumAmplperLS2 = new TH1F("h_sumAmplperLS2", " ", bac, 1., bac2); - h_sumCutAmplperLS2 = new TH1F("h_sumCutAmplperLS2", " ", bac, 1., bac2); - h_2D0sumAmplLS2 = new TH2F("h_2D0sumAmplLS2", " ", neta, -41., 41., nphi, 0., bphi); - h_sum0AmplperLS2 = new TH1F("h_sum0AmplperLS2", " ", bac, 1., bac2); - - h_sumAmplLS3 = new TH1F("h_sumAmplLS3", " ", 100, 0.0, lsdep_estimator5_HEdepth1_); - h_2DsumAmplLS3 = new TH2F("h_2DsumAmplLS3", " ", neta, -41., 41., nphi, 0., bphi); - h_sumAmplperLS3 = new TH1F("h_sumAmplperLS3", " ", bac, 1., bac2); - h_sumCutAmplperLS3 = new TH1F("h_sumCutAmplperLS3", " ", bac, 1., bac2); - h_2D0sumAmplLS3 = new TH2F("h_2D0sumAmplLS3", " ", neta, -41., 41., nphi, 0., bphi); - h_sum0AmplperLS3 = new TH1F("h_sum0AmplperLS3", " ", bac, 1., bac2); - - h_sumAmplLS4 = new TH1F("h_sumAmplLS4", " ", 100, 0.0, lsdep_estimator5_HEdepth2_); - h_2DsumAmplLS4 = new TH2F("h_2DsumAmplLS4", " ", neta, -41., 41., nphi, 0., bphi); - h_sumAmplperLS4 = new TH1F("h_sumAmplperLS4", " ", bac, 1., bac2); - h_sumCutAmplperLS4 = new TH1F("h_sumCutAmplperLS4", " ", bac, 1., bac2); - h_2D0sumAmplLS4 = new TH2F("h_2D0sumAmplLS4", " ", neta, -41., 41., nphi, 0., bphi); - h_sum0AmplperLS4 = new TH1F("h_sum0AmplperLS4", " ", bac, 1., bac2); - - h_sumAmplLS5 = new TH1F("h_sumAmplLS5", " ", 100, 0.0, lsdep_estimator5_HEdepth3_); - h_2DsumAmplLS5 = new TH2F("h_2DsumAmplLS5", " ", neta, -41., 41., nphi, 0., bphi); - h_sumAmplperLS5 = new TH1F("h_sumAmplperLS5", " ", bac, 1., bac2); - h_sumCutAmplperLS5 = new TH1F("h_sumCutAmplperLS5", " ", bac, 1., bac2); - h_2D0sumAmplLS5 = new TH2F("h_2D0sumAmplLS5", " ", neta, -41., 41., nphi, 0., bphi); - h_sum0AmplperLS5 = new TH1F("h_sum0AmplperLS5", " ", bac, 1., bac2); - - h_sumAmplLS6 = new TH1F("h_sumAmplLS6", " ", 100, 0.0, lsdep_estimator5_HFdepth1_); - h_2DsumAmplLS6 = new TH2F("h_2DsumAmplLS6", " ", neta, -41., 41., nphi, 0., bphi); - h_sumAmplperLS6 = new TH1F("h_sumAmplperLS6", " ", bac, 1., bac2); - h_sumCutAmplperLS6 = new TH1F("h_sumCutAmplperLS6", " ", bac, 1., bac2); - h_2D0sumAmplLS6 = new TH2F("h_2D0sumAmplLS6", " ", neta, -41., 41., nphi, 0., bphi); - h_sum0AmplperLS6 = new TH1F("h_sum0AmplperLS6", " ", bac, 1., bac2); - - h_RatioOccupancy_HBP = new TH1F("h_RatioOccupancy_HBP", " ", bac, 1., bac2); - h_RatioOccupancy_HBM = new TH1F("h_RatioOccupancy_HBM", " ", bac, 1., bac2); - h_RatioOccupancy_HEP = new TH1F("h_RatioOccupancy_HEP", " ", bac, 1., bac2); - h_RatioOccupancy_HEM = new TH1F("h_RatioOccupancy_HEM", " ", bac, 1., bac2); - h_RatioOccupancy_HOP = new TH1F("h_RatioOccupancy_HOP", " ", bac, 1., bac2); - h_RatioOccupancy_HOM = new TH1F("h_RatioOccupancy_HOM", " ", bac, 1., bac2); - h_RatioOccupancy_HFP = new TH1F("h_RatioOccupancy_HFP", " ", bac, 1., bac2); - h_RatioOccupancy_HFM = new TH1F("h_RatioOccupancy_HFM", " ", bac, 1., bac2); - - h_sumAmplLS7 = new TH1F("h_sumAmplLS7", " ", 100, 0.0, lsdep_estimator5_HFdepth2_); - h_2DsumAmplLS7 = new TH2F("h_2DsumAmplLS7", " ", neta, -41., 41., nphi, 0., bphi); - h_sumAmplperLS7 = new TH1F("h_sumAmplperLS7", " ", bac, 1., bac2); - h_sumCutAmplperLS7 = new TH1F("h_sumCutAmplperLS7", " ", bac, 1., bac2); - h_2D0sumAmplLS7 = new TH2F("h_2D0sumAmplLS7", " ", neta, -41., 41., nphi, 0., bphi); - h_sum0AmplperLS7 = new TH1F("h_sum0AmplperLS7", " ", bac, 1., bac2); - - h_sumAmplLS8 = new TH1F("h_sumAmplLS8", " ", 100, 0.0, lsdep_estimator5_HOdepth4_); - h_2DsumAmplLS8 = new TH2F("h_2DsumAmplLS8", " ", neta, -41., 41., nphi, 0., bphi); - h_sumAmplperLS8 = new TH1F("h_sumAmplperLS8", " ", bac, 1., bac2); - h_sumCutAmplperLS8 = new TH1F("h_sumCutAmplperLS8", " ", bac, 1., bac2); - h_2D0sumAmplLS8 = new TH2F("h_2D0sumAmplLS8", " ", neta, -41., 41., nphi, 0., bphi); - h_sum0AmplperLS8 = new TH1F("h_sum0AmplperLS8", " ", bac, 1., bac2); + h_sumAmplLS1 = fs_->make("h_sumAmplLS1", " ", 100, 0.0, lsdep_estimator5_HBdepth1_); + h_2DsumAmplLS1 = fs_->make("h_2DsumAmplLS1", " ", neta, -41., 41., nphi, 0., bphi); + h_sumAmplperLS1 = fs_->make("h_sumAmplperLS1", " ", bac, 1., bac2); + h_sumAmplperLS1_LSselected = fs_->make("h_sumAmplperLS1_LSselected", " ", bac, 1., bac2); + h_sumCutAmplperLS1 = fs_->make("h_sumCutAmplperLS1", " ", bac, 1., bac2); + h_2D0sumAmplLS1 = fs_->make("h_2D0sumAmplLS1", " ", neta, -41., 41., nphi, 0., bphi); + h_sum0AmplperLS1 = fs_->make("h_sum0AmplperLS1", " ", bac, 1., bac2); + + h_sumAmplLS2 = fs_->make("h_sumAmplLS2", " ", 100, 0.0, lsdep_estimator5_HBdepth2_); + h_2DsumAmplLS2 = fs_->make("h_2DsumAmplLS2", " ", neta, -41., 41., nphi, 0., bphi); + h_sumAmplperLS2 = fs_->make("h_sumAmplperLS2", " ", bac, 1., bac2); + h_sumCutAmplperLS2 = fs_->make("h_sumCutAmplperLS2", " ", bac, 1., bac2); + h_2D0sumAmplLS2 = fs_->make("h_2D0sumAmplLS2", " ", neta, -41., 41., nphi, 0., bphi); + h_sum0AmplperLS2 = fs_->make("h_sum0AmplperLS2", " ", bac, 1., bac2); + + h_sumAmplLS3 = fs_->make("h_sumAmplLS3", " ", 100, 0.0, lsdep_estimator5_HEdepth1_); + h_2DsumAmplLS3 = fs_->make("h_2DsumAmplLS3", " ", neta, -41., 41., nphi, 0., bphi); + h_sumAmplperLS3 = fs_->make("h_sumAmplperLS3", " ", bac, 1., bac2); + h_sumCutAmplperLS3 = fs_->make("h_sumCutAmplperLS3", " ", bac, 1., bac2); + h_2D0sumAmplLS3 = fs_->make("h_2D0sumAmplLS3", " ", neta, -41., 41., nphi, 0., bphi); + h_sum0AmplperLS3 = fs_->make("h_sum0AmplperLS3", " ", bac, 1., bac2); + + h_sumAmplLS4 = fs_->make("h_sumAmplLS4", " ", 100, 0.0, lsdep_estimator5_HEdepth2_); + h_2DsumAmplLS4 = fs_->make("h_2DsumAmplLS4", " ", neta, -41., 41., nphi, 0., bphi); + h_sumAmplperLS4 = fs_->make("h_sumAmplperLS4", " ", bac, 1., bac2); + h_sumCutAmplperLS4 = fs_->make("h_sumCutAmplperLS4", " ", bac, 1., bac2); + h_2D0sumAmplLS4 = fs_->make("h_2D0sumAmplLS4", " ", neta, -41., 41., nphi, 0., bphi); + h_sum0AmplperLS4 = fs_->make("h_sum0AmplperLS4", " ", bac, 1., bac2); + + h_sumAmplLS5 = fs_->make("h_sumAmplLS5", " ", 100, 0.0, lsdep_estimator5_HEdepth3_); + h_2DsumAmplLS5 = fs_->make("h_2DsumAmplLS5", " ", neta, -41., 41., nphi, 0., bphi); + h_sumAmplperLS5 = fs_->make("h_sumAmplperLS5", " ", bac, 1., bac2); + h_sumCutAmplperLS5 = fs_->make("h_sumCutAmplperLS5", " ", bac, 1., bac2); + h_2D0sumAmplLS5 = fs_->make("h_2D0sumAmplLS5", " ", neta, -41., 41., nphi, 0., bphi); + h_sum0AmplperLS5 = fs_->make("h_sum0AmplperLS5", " ", bac, 1., bac2); + + h_sumAmplLS6 = fs_->make("h_sumAmplLS6", " ", 100, 0.0, lsdep_estimator5_HFdepth1_); + h_2DsumAmplLS6 = fs_->make("h_2DsumAmplLS6", " ", neta, -41., 41., nphi, 0., bphi); + h_sumAmplperLS6 = fs_->make("h_sumAmplperLS6", " ", bac, 1., bac2); + h_sumCutAmplperLS6 = fs_->make("h_sumCutAmplperLS6", " ", bac, 1., bac2); + h_2D0sumAmplLS6 = fs_->make("h_2D0sumAmplLS6", " ", neta, -41., 41., nphi, 0., bphi); + h_sum0AmplperLS6 = fs_->make("h_sum0AmplperLS6", " ", bac, 1., bac2); + + h_RatioOccupancy_HBP = fs_->make("h_RatioOccupancy_HBP", " ", bac, 1., bac2); + h_RatioOccupancy_HBM = fs_->make("h_RatioOccupancy_HBM", " ", bac, 1., bac2); + h_RatioOccupancy_HEP = fs_->make("h_RatioOccupancy_HEP", " ", bac, 1., bac2); + h_RatioOccupancy_HEM = fs_->make("h_RatioOccupancy_HEM", " ", bac, 1., bac2); + h_RatioOccupancy_HOP = fs_->make("h_RatioOccupancy_HOP", " ", bac, 1., bac2); + h_RatioOccupancy_HOM = fs_->make("h_RatioOccupancy_HOM", " ", bac, 1., bac2); + h_RatioOccupancy_HFP = fs_->make("h_RatioOccupancy_HFP", " ", bac, 1., bac2); + h_RatioOccupancy_HFM = fs_->make("h_RatioOccupancy_HFM", " ", bac, 1., bac2); + + h_sumAmplLS7 = fs_->make("h_sumAmplLS7", " ", 100, 0.0, lsdep_estimator5_HFdepth2_); + h_2DsumAmplLS7 = fs_->make("h_2DsumAmplLS7", " ", neta, -41., 41., nphi, 0., bphi); + h_sumAmplperLS7 = fs_->make("h_sumAmplperLS7", " ", bac, 1., bac2); + h_sumCutAmplperLS7 = fs_->make("h_sumCutAmplperLS7", " ", bac, 1., bac2); + h_2D0sumAmplLS7 = fs_->make("h_2D0sumAmplLS7", " ", neta, -41., 41., nphi, 0., bphi); + h_sum0AmplperLS7 = fs_->make("h_sum0AmplperLS7", " ", bac, 1., bac2); + + h_sumAmplLS8 = fs_->make("h_sumAmplLS8", " ", 100, 0.0, lsdep_estimator5_HOdepth4_); + h_2DsumAmplLS8 = fs_->make("h_2DsumAmplLS8", " ", neta, -41., 41., nphi, 0., bphi); + h_sumAmplperLS8 = fs_->make("h_sumAmplperLS8", " ", bac, 1., bac2); + h_sumCutAmplperLS8 = fs_->make("h_sumCutAmplperLS8", " ", bac, 1., bac2); + h_2D0sumAmplLS8 = fs_->make("h_2D0sumAmplLS8", " ", neta, -41., 41., nphi, 0., bphi); + h_sum0AmplperLS8 = fs_->make("h_sum0AmplperLS8", " ", bac, 1., bac2); //-------------------------------------------------- // for estimator6: - h_sumErrorBLS1 = new TH1F("h_sumErrorBLS1", " ", 10, 0., 10.); - h_sumErrorBperLS1 = new TH1F("h_sumErrorBperLS1", " ", bac, 1., bac2); - h_sum0ErrorBperLS1 = new TH1F("h_sum0ErrorBperLS1", " ", bac, 1., bac2); - h_2D0sumErrorBLS1 = new TH2F("h_2D0sumErrorBLS1", " ", neta, -41., 41., nphi, 0., bphi); - h_2DsumErrorBLS1 = new TH2F("h_2DsumErrorBLS1", " ", neta, -41., 41., nphi, 0., bphi); - h_sumErrorBLS2 = new TH1F("h_sumErrorBLS2", " ", 10, 0., 10.); - h_sumErrorBperLS2 = new TH1F("h_sumErrorBperLS2", " ", bac, 1., bac2); - h_sum0ErrorBperLS2 = new TH1F("h_sum0ErrorBperLS2", " ", bac, 1., bac2); - h_2D0sumErrorBLS2 = new TH2F("h_2D0sumErrorBLS2", " ", neta, -41., 41., nphi, 0., bphi); - h_2DsumErrorBLS2 = new TH2F("h_2DsumErrorBLS2", " ", neta, -41., 41., nphi, 0., bphi); - - h_sumErrorBLS3 = new TH1F("h_sumErrorBLS3", " ", 10, 0., 10.); - h_sumErrorBperLS3 = new TH1F("h_sumErrorBperLS3", " ", bac, 1., bac2); - h_sum0ErrorBperLS3 = new TH1F("h_sum0ErrorBperLS3", " ", bac, 1., bac2); - h_2D0sumErrorBLS3 = new TH2F("h_2D0sumErrorBLS3", " ", neta, -41., 41., nphi, 0., bphi); - h_2DsumErrorBLS3 = new TH2F("h_2DsumErrorBLS3", " ", neta, -41., 41., nphi, 0., bphi); - h_sumErrorBLS4 = new TH1F("h_sumErrorBLS4", " ", 10, 0., 10.); - h_sumErrorBperLS4 = new TH1F("h_sumErrorBperLS4", " ", bac, 1., bac2); - h_sum0ErrorBperLS4 = new TH1F("h_sum0ErrorBperLS4", " ", bac, 1., bac2); - h_2D0sumErrorBLS4 = new TH2F("h_2D0sumErrorBLS4", " ", neta, -41., 41., nphi, 0., bphi); - h_2DsumErrorBLS4 = new TH2F("h_2DsumErrorBLS4", " ", neta, -41., 41., nphi, 0., bphi); - h_sumErrorBLS5 = new TH1F("h_sumErrorBLS5", " ", 10, 0., 10.); - h_sumErrorBperLS5 = new TH1F("h_sumErrorBperLS5", " ", bac, 1., bac2); - h_sum0ErrorBperLS5 = new TH1F("h_sum0ErrorBperLS5", " ", bac, 1., bac2); - h_2D0sumErrorBLS5 = new TH2F("h_2D0sumErrorBLS5", " ", neta, -41., 41., nphi, 0., bphi); - h_2DsumErrorBLS5 = new TH2F("h_2DsumErrorBLS5", " ", neta, -41., 41., nphi, 0., bphi); - - h_sumErrorBLS6 = new TH1F("h_sumErrorBLS6", " ", 10, 0., 10.); - h_sumErrorBperLS6 = new TH1F("h_sumErrorBperLS6", " ", bac, 1., bac2); - h_sum0ErrorBperLS6 = new TH1F("h_sum0ErrorBperLS6", " ", bac, 1., bac2); - h_2D0sumErrorBLS6 = new TH2F("h_2D0sumErrorBLS6", " ", neta, -41., 41., nphi, 0., bphi); - h_2DsumErrorBLS6 = new TH2F("h_2DsumErrorBLS6", " ", neta, -41., 41., nphi, 0., bphi); - h_sumErrorBLS7 = new TH1F("h_sumErrorBLS7", " ", 10, 0., 10.); - h_sumErrorBperLS7 = new TH1F("h_sumErrorBperLS7", " ", bac, 1., bac2); - h_sum0ErrorBperLS7 = new TH1F("h_sum0ErrorBperLS7", " ", bac, 1., bac2); - h_2D0sumErrorBLS7 = new TH2F("h_2D0sumErrorBLS7", " ", neta, -41., 41., nphi, 0., bphi); - h_2DsumErrorBLS7 = new TH2F("h_2DsumErrorBLS7", " ", neta, -41., 41., nphi, 0., bphi); - - h_sumErrorBLS8 = new TH1F("h_sumErrorBLS8", " ", 10, 0., 10.); - h_sumErrorBperLS8 = new TH1F("h_sumErrorBperLS8", " ", bac, 1., bac2); - h_sum0ErrorBperLS8 = new TH1F("h_sum0ErrorBperLS8", " ", bac, 1., bac2); - h_2D0sumErrorBLS8 = new TH2F("h_2D0sumErrorBLS8", " ", neta, -41., 41., nphi, 0., bphi); - h_2DsumErrorBLS8 = new TH2F("h_2DsumErrorBLS8", " ", neta, -41., 41., nphi, 0., bphi); + h_sumErrorBLS1 = fs_->make("h_sumErrorBLS1", " ", 10, 0., 10.); + h_sumErrorBperLS1 = fs_->make("h_sumErrorBperLS1", " ", bac, 1., bac2); + h_sum0ErrorBperLS1 = fs_->make("h_sum0ErrorBperLS1", " ", bac, 1., bac2); + h_2D0sumErrorBLS1 = fs_->make("h_2D0sumErrorBLS1", " ", neta, -41., 41., nphi, 0., bphi); + h_2DsumErrorBLS1 = fs_->make("h_2DsumErrorBLS1", " ", neta, -41., 41., nphi, 0., bphi); + h_sumErrorBLS2 = fs_->make("h_sumErrorBLS2", " ", 10, 0., 10.); + h_sumErrorBperLS2 = fs_->make("h_sumErrorBperLS2", " ", bac, 1., bac2); + h_sum0ErrorBperLS2 = fs_->make("h_sum0ErrorBperLS2", " ", bac, 1., bac2); + h_2D0sumErrorBLS2 = fs_->make("h_2D0sumErrorBLS2", " ", neta, -41., 41., nphi, 0., bphi); + h_2DsumErrorBLS2 = fs_->make("h_2DsumErrorBLS2", " ", neta, -41., 41., nphi, 0., bphi); + + h_sumErrorBLS3 = fs_->make("h_sumErrorBLS3", " ", 10, 0., 10.); + h_sumErrorBperLS3 = fs_->make("h_sumErrorBperLS3", " ", bac, 1., bac2); + h_sum0ErrorBperLS3 = fs_->make("h_sum0ErrorBperLS3", " ", bac, 1., bac2); + h_2D0sumErrorBLS3 = fs_->make("h_2D0sumErrorBLS3", " ", neta, -41., 41., nphi, 0., bphi); + h_2DsumErrorBLS3 = fs_->make("h_2DsumErrorBLS3", " ", neta, -41., 41., nphi, 0., bphi); + h_sumErrorBLS4 = fs_->make("h_sumErrorBLS4", " ", 10, 0., 10.); + h_sumErrorBperLS4 = fs_->make("h_sumErrorBperLS4", " ", bac, 1., bac2); + h_sum0ErrorBperLS4 = fs_->make("h_sum0ErrorBperLS4", " ", bac, 1., bac2); + h_2D0sumErrorBLS4 = fs_->make("h_2D0sumErrorBLS4", " ", neta, -41., 41., nphi, 0., bphi); + h_2DsumErrorBLS4 = fs_->make("h_2DsumErrorBLS4", " ", neta, -41., 41., nphi, 0., bphi); + h_sumErrorBLS5 = fs_->make("h_sumErrorBLS5", " ", 10, 0., 10.); + h_sumErrorBperLS5 = fs_->make("h_sumErrorBperLS5", " ", bac, 1., bac2); + h_sum0ErrorBperLS5 = fs_->make("h_sum0ErrorBperLS5", " ", bac, 1., bac2); + h_2D0sumErrorBLS5 = fs_->make("h_2D0sumErrorBLS5", " ", neta, -41., 41., nphi, 0., bphi); + h_2DsumErrorBLS5 = fs_->make("h_2DsumErrorBLS5", " ", neta, -41., 41., nphi, 0., bphi); + + h_sumErrorBLS6 = fs_->make("h_sumErrorBLS6", " ", 10, 0., 10.); + h_sumErrorBperLS6 = fs_->make("h_sumErrorBperLS6", " ", bac, 1., bac2); + h_sum0ErrorBperLS6 = fs_->make("h_sum0ErrorBperLS6", " ", bac, 1., bac2); + h_2D0sumErrorBLS6 = fs_->make("h_2D0sumErrorBLS6", " ", neta, -41., 41., nphi, 0., bphi); + h_2DsumErrorBLS6 = fs_->make("h_2DsumErrorBLS6", " ", neta, -41., 41., nphi, 0., bphi); + h_sumErrorBLS7 = fs_->make("h_sumErrorBLS7", " ", 10, 0., 10.); + h_sumErrorBperLS7 = fs_->make("h_sumErrorBperLS7", " ", bac, 1., bac2); + h_sum0ErrorBperLS7 = fs_->make("h_sum0ErrorBperLS7", " ", bac, 1., bac2); + h_2D0sumErrorBLS7 = fs_->make("h_2D0sumErrorBLS7", " ", neta, -41., 41., nphi, 0., bphi); + h_2DsumErrorBLS7 = fs_->make("h_2DsumErrorBLS7", " ", neta, -41., 41., nphi, 0., bphi); + + h_sumErrorBLS8 = fs_->make("h_sumErrorBLS8", " ", 10, 0., 10.); + h_sumErrorBperLS8 = fs_->make("h_sumErrorBperLS8", " ", bac, 1., bac2); + h_sum0ErrorBperLS8 = fs_->make("h_sum0ErrorBperLS8", " ", bac, 1., bac2); + h_2D0sumErrorBLS8 = fs_->make("h_2D0sumErrorBLS8", " ", neta, -41., 41., nphi, 0., bphi); + h_2DsumErrorBLS8 = fs_->make("h_2DsumErrorBLS8", " ", neta, -41., 41., nphi, 0., bphi); //-------------------------------------------------- // for averSIGNALOCCUPANCY : - h_averSIGNALoccupancy_HB = new TH1F("h_averSIGNALoccupancy_HB", " ", bac, 1., bac2); - h_averSIGNALoccupancy_HE = new TH1F("h_averSIGNALoccupancy_HE", " ", bac, 1., bac2); - h_averSIGNALoccupancy_HF = new TH1F("h_averSIGNALoccupancy_HF", " ", bac, 1., bac2); - h_averSIGNALoccupancy_HO = new TH1F("h_averSIGNALoccupancy_HO", " ", bac, 1., bac2); + h_averSIGNALoccupancy_HB = fs_->make("h_averSIGNALoccupancy_HB", " ", bac, 1., bac2); + h_averSIGNALoccupancy_HE = fs_->make("h_averSIGNALoccupancy_HE", " ", bac, 1., bac2); + h_averSIGNALoccupancy_HF = fs_->make("h_averSIGNALoccupancy_HF", " ", bac, 1., bac2); + h_averSIGNALoccupancy_HO = fs_->make("h_averSIGNALoccupancy_HO", " ", bac, 1., bac2); // for averSIGNALsumamplitude : - h_averSIGNALsumamplitude_HB = new TH1F("h_averSIGNALsumamplitude_HB", " ", bac, 1., bac2); - h_averSIGNALsumamplitude_HE = new TH1F("h_averSIGNALsumamplitude_HE", " ", bac, 1., bac2); - h_averSIGNALsumamplitude_HF = new TH1F("h_averSIGNALsumamplitude_HF", " ", bac, 1., bac2); - h_averSIGNALsumamplitude_HO = new TH1F("h_averSIGNALsumamplitude_HO", " ", bac, 1., bac2); + h_averSIGNALsumamplitude_HB = fs_->make("h_averSIGNALsumamplitude_HB", " ", bac, 1., bac2); + h_averSIGNALsumamplitude_HE = fs_->make("h_averSIGNALsumamplitude_HE", " ", bac, 1., bac2); + h_averSIGNALsumamplitude_HF = fs_->make("h_averSIGNALsumamplitude_HF", " ", bac, 1., bac2); + h_averSIGNALsumamplitude_HO = fs_->make("h_averSIGNALsumamplitude_HO", " ", bac, 1., bac2); // for averNOSIGNALOCCUPANCY : - h_averNOSIGNALoccupancy_HB = new TH1F("h_averNOSIGNALoccupancy_HB", " ", bac, 1., bac2); - h_averNOSIGNALoccupancy_HE = new TH1F("h_averNOSIGNALoccupancy_HE", " ", bac, 1., bac2); - h_averNOSIGNALoccupancy_HF = new TH1F("h_averNOSIGNALoccupancy_HF", " ", bac, 1., bac2); - h_averNOSIGNALoccupancy_HO = new TH1F("h_averNOSIGNALoccupancy_HO", " ", bac, 1., bac2); + h_averNOSIGNALoccupancy_HB = fs_->make("h_averNOSIGNALoccupancy_HB", " ", bac, 1., bac2); + h_averNOSIGNALoccupancy_HE = fs_->make("h_averNOSIGNALoccupancy_HE", " ", bac, 1., bac2); + h_averNOSIGNALoccupancy_HF = fs_->make("h_averNOSIGNALoccupancy_HF", " ", bac, 1., bac2); + h_averNOSIGNALoccupancy_HO = fs_->make("h_averNOSIGNALoccupancy_HO", " ", bac, 1., bac2); // for averNOSIGNALsumamplitude : - h_averNOSIGNALsumamplitude_HB = new TH1F("h_averNOSIGNALsumamplitude_HB", " ", bac, 1., bac2); - h_averNOSIGNALsumamplitude_HE = new TH1F("h_averNOSIGNALsumamplitude_HE", " ", bac, 1., bac2); - h_averNOSIGNALsumamplitude_HF = new TH1F("h_averNOSIGNALsumamplitude_HF", " ", bac, 1., bac2); - h_averNOSIGNALsumamplitude_HO = new TH1F("h_averNOSIGNALsumamplitude_HO", " ", bac, 1., bac2); + h_averNOSIGNALsumamplitude_HB = fs_->make("h_averNOSIGNALsumamplitude_HB", " ", bac, 1., bac2); + h_averNOSIGNALsumamplitude_HE = fs_->make("h_averNOSIGNALsumamplitude_HE", " ", bac, 1., bac2); + h_averNOSIGNALsumamplitude_HF = fs_->make("h_averNOSIGNALsumamplitude_HF", " ", bac, 1., bac2); + h_averNOSIGNALsumamplitude_HO = fs_->make("h_averNOSIGNALsumamplitude_HO", " ", bac, 1., bac2); // for channel SUM over depthes Amplitudes for each sub-detector - h_sumamplitudechannel_HB = new TH1F("h_sumamplitudechannel_HB", " ", 100, 0., 2000.); - h_sumamplitudechannel_HE = new TH1F("h_sumamplitudechannel_HE", " ", 100, 0., 3000.); - h_sumamplitudechannel_HF = new TH1F("h_sumamplitudechannel_HF", " ", 100, 0., 7000.); - h_sumamplitudechannel_HO = new TH1F("h_sumamplitudechannel_HO", " ", 100, 0., 10000.); + h_sumamplitudechannel_HB = fs_->make("h_sumamplitudechannel_HB", " ", 100, 0., 2000.); + h_sumamplitudechannel_HE = fs_->make("h_sumamplitudechannel_HE", " ", 100, 0., 3000.); + h_sumamplitudechannel_HF = fs_->make("h_sumamplitudechannel_HF", " ", 100, 0., 7000.); + h_sumamplitudechannel_HO = fs_->make("h_sumamplitudechannel_HO", " ", 100, 0., 10000.); // for event Amplitudes for each sub-detector - h_eventamplitude_HB = new TH1F("h_eventamplitude_HB", " ", 100, 0., 80000.); - h_eventamplitude_HE = new TH1F("h_eventamplitude_HE", " ", 100, 0., 100000.); - h_eventamplitude_HF = new TH1F("h_eventamplitude_HF", " ", 100, 0., 150000.); - h_eventamplitude_HO = new TH1F("h_eventamplitude_HO", " ", 100, 0., 250000.); + h_eventamplitude_HB = fs_->make("h_eventamplitude_HB", " ", 100, 0., 80000.); + h_eventamplitude_HE = fs_->make("h_eventamplitude_HE", " ", 100, 0., 100000.); + h_eventamplitude_HF = fs_->make("h_eventamplitude_HF", " ", 100, 0., 150000.); + h_eventamplitude_HO = fs_->make("h_eventamplitude_HO", " ", 100, 0., 250000.); // for event Occupancy for each sub-detector - h_eventoccupancy_HB = new TH1F("h_eventoccupancy_HB", " ", 100, 0., 3000.); - h_eventoccupancy_HE = new TH1F("h_eventoccupancy_HE", " ", 100, 0., 2000.); - h_eventoccupancy_HF = new TH1F("h_eventoccupancy_HF", " ", 100, 0., 1000.); - h_eventoccupancy_HO = new TH1F("h_eventoccupancy_HO", " ", 100, 0., 2500.); + h_eventoccupancy_HB = fs_->make("h_eventoccupancy_HB", " ", 100, 0., 3000.); + h_eventoccupancy_HE = fs_->make("h_eventoccupancy_HE", " ", 100, 0., 2000.); + h_eventoccupancy_HF = fs_->make("h_eventoccupancy_HF", " ", 100, 0., 1000.); + h_eventoccupancy_HO = fs_->make("h_eventoccupancy_HO", " ", 100, 0., 2500.); // for maxxSUMAmplitude - h_maxxSUMAmpl_HB = new TH1F("h_maxxSUMAmpl_HB", " ", bac, 1., bac2); - h_maxxSUMAmpl_HE = new TH1F("h_maxxSUMAmpl_HE", " ", bac, 1., bac2); - h_maxxSUMAmpl_HF = new TH1F("h_maxxSUMAmpl_HF", " ", bac, 1., bac2); - h_maxxSUMAmpl_HO = new TH1F("h_maxxSUMAmpl_HO", " ", bac, 1., bac2); + h_maxxSUMAmpl_HB = fs_->make("h_maxxSUMAmpl_HB", " ", bac, 1., bac2); + h_maxxSUMAmpl_HE = fs_->make("h_maxxSUMAmpl_HE", " ", bac, 1., bac2); + h_maxxSUMAmpl_HF = fs_->make("h_maxxSUMAmpl_HF", " ", bac, 1., bac2); + h_maxxSUMAmpl_HO = fs_->make("h_maxxSUMAmpl_HO", " ", bac, 1., bac2); // for maxxOCCUP - h_maxxOCCUP_HB = new TH1F("h_maxxOCCUP_HB", " ", bac, 1., bac2); - h_maxxOCCUP_HE = new TH1F("h_maxxOCCUP_HE", " ", bac, 1., bac2); - h_maxxOCCUP_HF = new TH1F("h_maxxOCCUP_HF", " ", bac, 1., bac2); - h_maxxOCCUP_HO = new TH1F("h_maxxOCCUP_HO", " ", bac, 1., bac2); + h_maxxOCCUP_HB = fs_->make("h_maxxOCCUP_HB", " ", bac, 1., bac2); + h_maxxOCCUP_HE = fs_->make("h_maxxOCCUP_HE", " ", bac, 1., bac2); + h_maxxOCCUP_HF = fs_->make("h_maxxOCCUP_HF", " ", bac, 1., bac2); + h_maxxOCCUP_HO = fs_->make("h_maxxOCCUP_HO", " ", bac, 1., bac2); //-------------------------------------------------- // pedestals - h_pedestal0_HB = new TH1F("h_pedestal0_HB", " ", 100, 0., 10.); - h_pedestal1_HB = new TH1F("h_pedestal1_HB", " ", 100, 0., 10.); - h_pedestal2_HB = new TH1F("h_pedestal2_HB", " ", 100, 0., 10.); - h_pedestal3_HB = new TH1F("h_pedestal3_HB", " ", 100, 0., 10.); - h_pedestalaver4_HB = new TH1F("h_pedestalaver4_HB", " ", 100, 0., 10.); - h_pedestalaver9_HB = new TH1F("h_pedestalaver9_HB", " ", 100, 0., 10.); - h_pedestalw0_HB = new TH1F("h_pedestalw0_HB", " ", 100, 0., 2.5); - h_pedestalw1_HB = new TH1F("h_pedestalw1_HB", " ", 100, 0., 2.5); - h_pedestalw2_HB = new TH1F("h_pedestalw2_HB", " ", 100, 0., 2.5); - h_pedestalw3_HB = new TH1F("h_pedestalw3_HB", " ", 100, 0., 2.5); - h_pedestalwaver4_HB = new TH1F("h_pedestalwaver4_HB", " ", 100, 0., 2.5); - h_pedestalwaver9_HB = new TH1F("h_pedestalwaver9_HB", " ", 100, 0., 2.5); - - h_pedestal0_HE = new TH1F("h_pedestal0_HE", " ", 100, 0., 10.); - h_pedestal1_HE = new TH1F("h_pedestal1_HE", " ", 100, 0., 10.); - h_pedestal2_HE = new TH1F("h_pedestal2_HE", " ", 100, 0., 10.); - h_pedestal3_HE = new TH1F("h_pedestal3_HE", " ", 100, 0., 10.); - h_pedestalaver4_HE = new TH1F("h_pedestalaver4_HE", " ", 100, 0., 10.); - h_pedestalaver9_HE = new TH1F("h_pedestalaver9_HE", " ", 100, 0., 10.); - h_pedestalw0_HE = new TH1F("h_pedestalw0_HE", " ", 100, 0., 2.5); - h_pedestalw1_HE = new TH1F("h_pedestalw1_HE", " ", 100, 0., 2.5); - h_pedestalw2_HE = new TH1F("h_pedestalw2_HE", " ", 100, 0., 2.5); - h_pedestalw3_HE = new TH1F("h_pedestalw3_HE", " ", 100, 0., 2.5); - h_pedestalwaver4_HE = new TH1F("h_pedestalwaver4_HE", " ", 100, 0., 2.5); - h_pedestalwaver9_HE = new TH1F("h_pedestalwaver9_HE", " ", 100, 0., 2.5); - - h_pedestal0_HF = new TH1F("h_pedestal0_HF", " ", 100, 0., 20.); - h_pedestal1_HF = new TH1F("h_pedestal1_HF", " ", 100, 0., 20.); - h_pedestal2_HF = new TH1F("h_pedestal2_HF", " ", 100, 0., 20.); - h_pedestal3_HF = new TH1F("h_pedestal3_HF", " ", 100, 0., 20.); - h_pedestalaver4_HF = new TH1F("h_pedestalaver4_HF", " ", 100, 0., 20.); - h_pedestalaver9_HF = new TH1F("h_pedestalaver9_HF", " ", 100, 0., 20.); - h_pedestalw0_HF = new TH1F("h_pedestalw0_HF", " ", 100, 0., 2.5); - h_pedestalw1_HF = new TH1F("h_pedestalw1_HF", " ", 100, 0., 2.5); - h_pedestalw2_HF = new TH1F("h_pedestalw2_HF", " ", 100, 0., 2.5); - h_pedestalw3_HF = new TH1F("h_pedestalw3_HF", " ", 100, 0., 2.5); - h_pedestalwaver4_HF = new TH1F("h_pedestalwaver4_HF", " ", 100, 0., 2.5); - h_pedestalwaver9_HF = new TH1F("h_pedestalwaver9_HF", " ", 100, 0., 2.5); - - h_pedestal0_HO = new TH1F("h_pedestal0_HO", " ", 100, 0., 20.); - h_pedestal1_HO = new TH1F("h_pedestal1_HO", " ", 100, 0., 20.); - h_pedestal2_HO = new TH1F("h_pedestal2_HO", " ", 100, 0., 20.); - h_pedestal3_HO = new TH1F("h_pedestal3_HO", " ", 100, 0., 20.); - h_pedestalaver4_HO = new TH1F("h_pedestalaver4_HO", " ", 100, 0., 20.); - h_pedestalaver9_HO = new TH1F("h_pedestalaver9_HO", " ", 100, 0., 20.); - h_pedestalw0_HO = new TH1F("h_pedestalw0_HO", " ", 100, 0., 2.5); - h_pedestalw1_HO = new TH1F("h_pedestalw1_HO", " ", 100, 0., 2.5); - h_pedestalw2_HO = new TH1F("h_pedestalw2_HO", " ", 100, 0., 2.5); - h_pedestalw3_HO = new TH1F("h_pedestalw3_HO", " ", 100, 0., 2.5); - h_pedestalwaver4_HO = new TH1F("h_pedestalwaver4_HO", " ", 100, 0., 2.5); - h_pedestalwaver9_HO = new TH1F("h_pedestalwaver9_HO", " ", 100, 0., 2.5); + h_pedestal0_HB = fs_->make("h_pedestal0_HB", " ", 100, 0., 10.); + h_pedestal1_HB = fs_->make("h_pedestal1_HB", " ", 100, 0., 10.); + h_pedestal2_HB = fs_->make("h_pedestal2_HB", " ", 100, 0., 10.); + h_pedestal3_HB = fs_->make("h_pedestal3_HB", " ", 100, 0., 10.); + h_pedestalaver4_HB = fs_->make("h_pedestalaver4_HB", " ", 100, 0., 10.); + h_pedestalaver9_HB = fs_->make("h_pedestalaver9_HB", " ", 100, 0., 10.); + h_pedestalw0_HB = fs_->make("h_pedestalw0_HB", " ", 100, 0., 2.5); + h_pedestalw1_HB = fs_->make("h_pedestalw1_HB", " ", 100, 0., 2.5); + h_pedestalw2_HB = fs_->make("h_pedestalw2_HB", " ", 100, 0., 2.5); + h_pedestalw3_HB = fs_->make("h_pedestalw3_HB", " ", 100, 0., 2.5); + h_pedestalwaver4_HB = fs_->make("h_pedestalwaver4_HB", " ", 100, 0., 2.5); + h_pedestalwaver9_HB = fs_->make("h_pedestalwaver9_HB", " ", 100, 0., 2.5); + + h_pedestal0_HE = fs_->make("h_pedestal0_HE", " ", 100, 0., 10.); + h_pedestal1_HE = fs_->make("h_pedestal1_HE", " ", 100, 0., 10.); + h_pedestal2_HE = fs_->make("h_pedestal2_HE", " ", 100, 0., 10.); + h_pedestal3_HE = fs_->make("h_pedestal3_HE", " ", 100, 0., 10.); + h_pedestalaver4_HE = fs_->make("h_pedestalaver4_HE", " ", 100, 0., 10.); + h_pedestalaver9_HE = fs_->make("h_pedestalaver9_HE", " ", 100, 0., 10.); + h_pedestalw0_HE = fs_->make("h_pedestalw0_HE", " ", 100, 0., 2.5); + h_pedestalw1_HE = fs_->make("h_pedestalw1_HE", " ", 100, 0., 2.5); + h_pedestalw2_HE = fs_->make("h_pedestalw2_HE", " ", 100, 0., 2.5); + h_pedestalw3_HE = fs_->make("h_pedestalw3_HE", " ", 100, 0., 2.5); + h_pedestalwaver4_HE = fs_->make("h_pedestalwaver4_HE", " ", 100, 0., 2.5); + h_pedestalwaver9_HE = fs_->make("h_pedestalwaver9_HE", " ", 100, 0., 2.5); + + h_pedestal0_HF = fs_->make("h_pedestal0_HF", " ", 100, 0., 20.); + h_pedestal1_HF = fs_->make("h_pedestal1_HF", " ", 100, 0., 20.); + h_pedestal2_HF = fs_->make("h_pedestal2_HF", " ", 100, 0., 20.); + h_pedestal3_HF = fs_->make("h_pedestal3_HF", " ", 100, 0., 20.); + h_pedestalaver4_HF = fs_->make("h_pedestalaver4_HF", " ", 100, 0., 20.); + h_pedestalaver9_HF = fs_->make("h_pedestalaver9_HF", " ", 100, 0., 20.); + h_pedestalw0_HF = fs_->make("h_pedestalw0_HF", " ", 100, 0., 2.5); + h_pedestalw1_HF = fs_->make("h_pedestalw1_HF", " ", 100, 0., 2.5); + h_pedestalw2_HF = fs_->make("h_pedestalw2_HF", " ", 100, 0., 2.5); + h_pedestalw3_HF = fs_->make("h_pedestalw3_HF", " ", 100, 0., 2.5); + h_pedestalwaver4_HF = fs_->make("h_pedestalwaver4_HF", " ", 100, 0., 2.5); + h_pedestalwaver9_HF = fs_->make("h_pedestalwaver9_HF", " ", 100, 0., 2.5); + + h_pedestal0_HO = fs_->make("h_pedestal0_HO", " ", 100, 0., 20.); + h_pedestal1_HO = fs_->make("h_pedestal1_HO", " ", 100, 0., 20.); + h_pedestal2_HO = fs_->make("h_pedestal2_HO", " ", 100, 0., 20.); + h_pedestal3_HO = fs_->make("h_pedestal3_HO", " ", 100, 0., 20.); + h_pedestalaver4_HO = fs_->make("h_pedestalaver4_HO", " ", 100, 0., 20.); + h_pedestalaver9_HO = fs_->make("h_pedestalaver9_HO", " ", 100, 0., 20.); + h_pedestalw0_HO = fs_->make("h_pedestalw0_HO", " ", 100, 0., 2.5); + h_pedestalw1_HO = fs_->make("h_pedestalw1_HO", " ", 100, 0., 2.5); + h_pedestalw2_HO = fs_->make("h_pedestalw2_HO", " ", 100, 0., 2.5); + h_pedestalw3_HO = fs_->make("h_pedestalw3_HO", " ", 100, 0., 2.5); + h_pedestalwaver4_HO = fs_->make("h_pedestalwaver4_HO", " ", 100, 0., 2.5); + h_pedestalwaver9_HO = fs_->make("h_pedestalwaver9_HO", " ", 100, 0., 2.5); //-------------------------------------------------- - h_mapDepth1pedestalw_HB = new TH2F("h_mapDepth1pedestalw_HB", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth2pedestalw_HB = new TH2F("h_mapDepth2pedestalw_HB", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth3pedestalw_HB = new TH2F("h_mapDepth3pedestalw_HB", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth4pedestalw_HB = new TH2F("h_mapDepth4pedestalw_HB", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth1pedestalw_HE = new TH2F("h_mapDepth1pedestalw_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth2pedestalw_HE = new TH2F("h_mapDepth2pedestalw_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth3pedestalw_HE = new TH2F("h_mapDepth3pedestalw_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth4pedestalw_HE = new TH2F("h_mapDepth4pedestalw_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth5pedestalw_HE = new TH2F("h_mapDepth5pedestalw_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth6pedestalw_HE = new TH2F("h_mapDepth6pedestalw_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth7pedestalw_HE = new TH2F("h_mapDepth7pedestalw_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth1pedestalw_HF = new TH2F("h_mapDepth1pedestalw_HF", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth2pedestalw_HF = new TH2F("h_mapDepth2pedestalw_HF", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth3pedestalw_HF = new TH2F("h_mapDepth3pedestalw_HF", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth4pedestalw_HF = new TH2F("h_mapDepth4pedestalw_HF", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth4pedestalw_HO = new TH2F("h_mapDepth4pedestalw_HO", " ", neta, -41., 41., nphi, 0., bphi); - - h_mapDepth1pedestal_HB = new TH2F("h_mapDepth1pedestal_HB", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth2pedestal_HB = new TH2F("h_mapDepth2pedestal_HB", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth3pedestal_HB = new TH2F("h_mapDepth3pedestal_HB", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth4pedestal_HB = new TH2F("h_mapDepth4pedestal_HB", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth1pedestal_HE = new TH2F("h_mapDepth1pedestal_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth2pedestal_HE = new TH2F("h_mapDepth2pedestal_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth3pedestal_HE = new TH2F("h_mapDepth3pedestal_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth4pedestal_HE = new TH2F("h_mapDepth4pedestal_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth5pedestal_HE = new TH2F("h_mapDepth5pedestal_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth6pedestal_HE = new TH2F("h_mapDepth6pedestal_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth7pedestal_HE = new TH2F("h_mapDepth7pedestal_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth1pedestal_HF = new TH2F("h_mapDepth1pedestal_HF", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth2pedestal_HF = new TH2F("h_mapDepth2pedestal_HF", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth3pedestal_HF = new TH2F("h_mapDepth3pedestal_HF", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth4pedestal_HF = new TH2F("h_mapDepth4pedestal_HF", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth4pedestal_HO = new TH2F("h_mapDepth4pedestal_HO", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth1pedestalw_HB = fs_->make("h_mapDepth1pedestalw_HB", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth2pedestalw_HB = fs_->make("h_mapDepth2pedestalw_HB", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth3pedestalw_HB = fs_->make("h_mapDepth3pedestalw_HB", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth4pedestalw_HB = fs_->make("h_mapDepth4pedestalw_HB", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth1pedestalw_HE = fs_->make("h_mapDepth1pedestalw_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth2pedestalw_HE = fs_->make("h_mapDepth2pedestalw_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth3pedestalw_HE = fs_->make("h_mapDepth3pedestalw_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth4pedestalw_HE = fs_->make("h_mapDepth4pedestalw_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth5pedestalw_HE = fs_->make("h_mapDepth5pedestalw_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth6pedestalw_HE = fs_->make("h_mapDepth6pedestalw_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth7pedestalw_HE = fs_->make("h_mapDepth7pedestalw_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth1pedestalw_HF = fs_->make("h_mapDepth1pedestalw_HF", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth2pedestalw_HF = fs_->make("h_mapDepth2pedestalw_HF", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth3pedestalw_HF = fs_->make("h_mapDepth3pedestalw_HF", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth4pedestalw_HF = fs_->make("h_mapDepth4pedestalw_HF", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth4pedestalw_HO = fs_->make("h_mapDepth4pedestalw_HO", " ", neta, -41., 41., nphi, 0., bphi); + + h_mapDepth1pedestal_HB = fs_->make("h_mapDepth1pedestal_HB", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth2pedestal_HB = fs_->make("h_mapDepth2pedestal_HB", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth3pedestal_HB = fs_->make("h_mapDepth3pedestal_HB", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth4pedestal_HB = fs_->make("h_mapDepth4pedestal_HB", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth1pedestal_HE = fs_->make("h_mapDepth1pedestal_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth2pedestal_HE = fs_->make("h_mapDepth2pedestal_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth3pedestal_HE = fs_->make("h_mapDepth3pedestal_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth4pedestal_HE = fs_->make("h_mapDepth4pedestal_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth5pedestal_HE = fs_->make("h_mapDepth5pedestal_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth6pedestal_HE = fs_->make("h_mapDepth6pedestal_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth7pedestal_HE = fs_->make("h_mapDepth7pedestal_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth1pedestal_HF = fs_->make("h_mapDepth1pedestal_HF", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth2pedestal_HF = fs_->make("h_mapDepth2pedestal_HF", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth3pedestal_HF = fs_->make("h_mapDepth3pedestal_HF", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth4pedestal_HF = fs_->make("h_mapDepth4pedestal_HF", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth4pedestal_HO = fs_->make("h_mapDepth4pedestal_HO", " ", neta, -41., 41., nphi, 0., bphi); //-------------------------------------------------- - h_pedestal00_HB = new TH1F("h_pedestal00_HB", " ", 100, 0., 10.); - h_gain_HB = new TH1F("h_gain_HB", " ", 100, 0., 1.); - h_respcorr_HB = new TH1F("h_respcorr_HB", " ", 100, 0., 2.5); - h_timecorr_HB = new TH1F("h_timecorr_HB", " ", 100, 0., 30.); - h_lutcorr_HB = new TH1F("h_lutcorr_HB", " ", 100, 0., 10.); - h_difpedestal0_HB = new TH1F("h_difpedestal0_HB", " ", 100, -3., 3.); - h_difpedestal1_HB = new TH1F("h_difpedestal1_HB", " ", 100, -3., 3.); - h_difpedestal2_HB = new TH1F("h_difpedestal2_HB", " ", 100, -3., 3.); - h_difpedestal3_HB = new TH1F("h_difpedestal3_HB", " ", 100, -3., 3.); - - h_pedestal00_HE = new TH1F("h_pedestal00_HE", " ", 100, 0., 10.); - h_gain_HE = new TH1F("h_gain_HE", " ", 100, 0., 1.); - h_respcorr_HE = new TH1F("h_respcorr_HE", " ", 100, 0., 2.5); - h_timecorr_HE = new TH1F("h_timecorr_HE", " ", 100, 0., 30.); - h_lutcorr_HE = new TH1F("h_lutcorr_HE", " ", 100, 0., 10.); - - h_pedestal00_HF = new TH1F("h_pedestal00_HF", " ", 100, 0., 10.); - h_gain_HF = new TH1F("h_gain_HF", " ", 100, 0., 1.); - h_respcorr_HF = new TH1F("h_respcorr_HF", " ", 100, 0., 2.5); - h_timecorr_HF = new TH1F("h_timecorr_HF", " ", 100, 0., 30.); - h_lutcorr_HF = new TH1F("h_lutcorr_HF", " ", 100, 0., 10.); - - h_pedestal00_HO = new TH1F("h_pedestal00_HO", " ", 100, 0., 10.); - h_gain_HO = new TH1F("h_gain_HO", " ", 100, 0., 1.); - h_respcorr_HO = new TH1F("h_respcorr_HO", " ", 100, 0., 2.5); - h_timecorr_HO = new TH1F("h_timecorr_HO", " ", 100, 0., 30.); - h_lutcorr_HO = new TH1F("h_lutcorr_HO", " ", 100, 0., 10.); + h_pedestal00_HB = fs_->make("h_pedestal00_HB", " ", 100, 0., 10.); + h_gain_HB = fs_->make("h_gain_HB", " ", 100, 0., 1.); + h_respcorr_HB = fs_->make("h_respcorr_HB", " ", 100, 0., 2.5); + h_timecorr_HB = fs_->make("h_timecorr_HB", " ", 100, 0., 30.); + h_lutcorr_HB = fs_->make("h_lutcorr_HB", " ", 100, 0., 10.); + h_difpedestal0_HB = fs_->make("h_difpedestal0_HB", " ", 100, -3., 3.); + h_difpedestal1_HB = fs_->make("h_difpedestal1_HB", " ", 100, -3., 3.); + h_difpedestal2_HB = fs_->make("h_difpedestal2_HB", " ", 100, -3., 3.); + h_difpedestal3_HB = fs_->make("h_difpedestal3_HB", " ", 100, -3., 3.); + + h_pedestal00_HE = fs_->make("h_pedestal00_HE", " ", 100, 0., 10.); + h_gain_HE = fs_->make("h_gain_HE", " ", 100, 0., 1.); + h_respcorr_HE = fs_->make("h_respcorr_HE", " ", 100, 0., 2.5); + h_timecorr_HE = fs_->make("h_timecorr_HE", " ", 100, 0., 30.); + h_lutcorr_HE = fs_->make("h_lutcorr_HE", " ", 100, 0., 10.); + + h_pedestal00_HF = fs_->make("h_pedestal00_HF", " ", 100, 0., 10.); + h_gain_HF = fs_->make("h_gain_HF", " ", 100, 0., 1.); + h_respcorr_HF = fs_->make("h_respcorr_HF", " ", 100, 0., 2.5); + h_timecorr_HF = fs_->make("h_timecorr_HF", " ", 100, 0., 30.); + h_lutcorr_HF = fs_->make("h_lutcorr_HF", " ", 100, 0., 10.); + + h_pedestal00_HO = fs_->make("h_pedestal00_HO", " ", 100, 0., 10.); + h_gain_HO = fs_->make("h_gain_HO", " ", 100, 0., 1.); + h_respcorr_HO = fs_->make("h_respcorr_HO", " ", 100, 0., 2.5); + h_timecorr_HO = fs_->make("h_timecorr_HO", " ", 100, 0., 30.); + h_lutcorr_HO = fs_->make("h_lutcorr_HO", " ", 100, 0., 10.); //-------------------------------------------------- float est6 = 2500.; int ist6 = 30; int ist2 = 60; - h2_pedvsampl_HB = new TH2F("h2_pedvsampl_HB", " ", ist2, 0., 7.0, ist2, 0., est6); - h2_pedwvsampl_HB = new TH2F("h2_pedwvsampl_HB", " ", ist2, 0., 2.5, ist2, 0., est6); - h_pedvsampl_HB = new TH1F("h_pedvsampl_HB", " ", ist6, 0., 7.0); - h_pedwvsampl_HB = new TH1F("h_pedwvsampl_HB", " ", ist6, 0., 2.5); - h_pedvsampl0_HB = new TH1F("h_pedvsampl0_HB", " ", ist6, 0., 7.); - h_pedwvsampl0_HB = new TH1F("h_pedwvsampl0_HB", " ", ist6, 0., 2.5); - h2_amplvsped_HB = new TH2F("h2_amplvsped_HB", " ", ist2, 0., est6, ist2, 0., 7.0); - h2_amplvspedw_HB = new TH2F("h2_amplvspedw_HB", " ", ist2, 0., est6, ist2, 0., 2.5); - h_amplvsped_HB = new TH1F("h_amplvsped_HB", " ", ist6, 0., est6); - h_amplvspedw_HB = new TH1F("h_amplvspedw_HB", " ", ist6, 0., est6); - h_amplvsped0_HB = new TH1F("h_amplvsped0_HB", " ", ist6, 0., est6); - - h2_pedvsampl_HE = new TH2F("h2_pedvsampl_HE", " ", ist2, 0., 7.0, ist2, 0., est6); - h2_pedwvsampl_HE = new TH2F("h2_pedwvsampl_HE", " ", ist2, 0., 2.5, ist2, 0., est6); - h_pedvsampl_HE = new TH1F("h_pedvsampl_HE", " ", ist6, 0., 7.0); - h_pedwvsampl_HE = new TH1F("h_pedwvsampl_HE", " ", ist6, 0., 2.5); - h_pedvsampl0_HE = new TH1F("h_pedvsampl0_HE", " ", ist6, 0., 7.); - h_pedwvsampl0_HE = new TH1F("h_pedwvsampl0_HE", " ", ist6, 0., 2.5); - - h2_pedvsampl_HF = new TH2F("h2_pedvsampl_HF", " ", ist2, 0., 20.0, ist2, 0., est6); - h2_pedwvsampl_HF = new TH2F("h2_pedwvsampl_HF", " ", ist2, 0., 2.0, ist2, 0., est6); - h_pedvsampl_HF = new TH1F("h_pedvsampl_HF", " ", ist6, 0., 20.0); - h_pedwvsampl_HF = new TH1F("h_pedwvsampl_HF", " ", ist6, 0., 2.0); - h_pedvsampl0_HF = new TH1F("h_pedvsampl0_HF", " ", ist6, 0., 20.); - h_pedwvsampl0_HF = new TH1F("h_pedwvsampl0_HF", " ", ist6, 0., 2.0); - - h2_pedvsampl_HO = new TH2F("h2_pedvsampl_HO", " ", ist2, 0., 20.0, ist2, 0., est6); - h2_pedwvsampl_HO = new TH2F("h2_pedwvsampl_HO", " ", ist2, 0., 2.5, ist2, 0., est6); - h_pedvsampl_HO = new TH1F("h_pedvsampl_HO", " ", ist6, 0., 20.0); - h_pedwvsampl_HO = new TH1F("h_pedwvsampl_HO", " ", ist6, 0., 2.5); - h_pedvsampl0_HO = new TH1F("h_pedvsampl0_HO", " ", ist6, 0., 20.); - h_pedwvsampl0_HO = new TH1F("h_pedwvsampl0_HO", " ", ist6, 0., 2.5); + h2_pedvsampl_HB = fs_->make("h2_pedvsampl_HB", " ", ist2, 0., 7.0, ist2, 0., est6); + h2_pedwvsampl_HB = fs_->make("h2_pedwvsampl_HB", " ", ist2, 0., 2.5, ist2, 0., est6); + h_pedvsampl_HB = fs_->make("h_pedvsampl_HB", " ", ist6, 0., 7.0); + h_pedwvsampl_HB = fs_->make("h_pedwvsampl_HB", " ", ist6, 0., 2.5); + h_pedvsampl0_HB = fs_->make("h_pedvsampl0_HB", " ", ist6, 0., 7.); + h_pedwvsampl0_HB = fs_->make("h_pedwvsampl0_HB", " ", ist6, 0., 2.5); + h2_amplvsped_HB = fs_->make("h2_amplvsped_HB", " ", ist2, 0., est6, ist2, 0., 7.0); + h2_amplvspedw_HB = fs_->make("h2_amplvspedw_HB", " ", ist2, 0., est6, ist2, 0., 2.5); + h_amplvsped_HB = fs_->make("h_amplvsped_HB", " ", ist6, 0., est6); + h_amplvspedw_HB = fs_->make("h_amplvspedw_HB", " ", ist6, 0., est6); + h_amplvsped0_HB = fs_->make("h_amplvsped0_HB", " ", ist6, 0., est6); + + h2_pedvsampl_HE = fs_->make("h2_pedvsampl_HE", " ", ist2, 0., 7.0, ist2, 0., est6); + h2_pedwvsampl_HE = fs_->make("h2_pedwvsampl_HE", " ", ist2, 0., 2.5, ist2, 0., est6); + h_pedvsampl_HE = fs_->make("h_pedvsampl_HE", " ", ist6, 0., 7.0); + h_pedwvsampl_HE = fs_->make("h_pedwvsampl_HE", " ", ist6, 0., 2.5); + h_pedvsampl0_HE = fs_->make("h_pedvsampl0_HE", " ", ist6, 0., 7.); + h_pedwvsampl0_HE = fs_->make("h_pedwvsampl0_HE", " ", ist6, 0., 2.5); + + h2_pedvsampl_HF = fs_->make("h2_pedvsampl_HF", " ", ist2, 0., 20.0, ist2, 0., est6); + h2_pedwvsampl_HF = fs_->make("h2_pedwvsampl_HF", " ", ist2, 0., 2.0, ist2, 0., est6); + h_pedvsampl_HF = fs_->make("h_pedvsampl_HF", " ", ist6, 0., 20.0); + h_pedwvsampl_HF = fs_->make("h_pedwvsampl_HF", " ", ist6, 0., 2.0); + h_pedvsampl0_HF = fs_->make("h_pedvsampl0_HF", " ", ist6, 0., 20.); + h_pedwvsampl0_HF = fs_->make("h_pedwvsampl0_HF", " ", ist6, 0., 2.0); + + h2_pedvsampl_HO = fs_->make("h2_pedvsampl_HO", " ", ist2, 0., 20.0, ist2, 0., est6); + h2_pedwvsampl_HO = fs_->make("h2_pedwvsampl_HO", " ", ist2, 0., 2.5, ist2, 0., est6); + h_pedvsampl_HO = fs_->make("h_pedvsampl_HO", " ", ist6, 0., 20.0); + h_pedwvsampl_HO = fs_->make("h_pedwvsampl_HO", " ", ist6, 0., 2.5); + h_pedvsampl0_HO = fs_->make("h_pedvsampl0_HO", " ", ist6, 0., 20.); + h_pedwvsampl0_HO = fs_->make("h_pedwvsampl0_HO", " ", ist6, 0., 2.5); //-------------------------------------------------- - h_mapDepth1Ped0_HB = new TH2F("h_mapDepth1Ped0_HB", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth1Ped1_HB = new TH2F("h_mapDepth1Ped1_HB", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth1Ped2_HB = new TH2F("h_mapDepth1Ped2_HB", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth1Ped3_HB = new TH2F("h_mapDepth1Ped3_HB", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth1Pedw0_HB = new TH2F("h_mapDepth1Pedw0_HB", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth1Pedw1_HB = new TH2F("h_mapDepth1Pedw1_HB", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth1Pedw2_HB = new TH2F("h_mapDepth1Pedw2_HB", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth1Pedw3_HB = new TH2F("h_mapDepth1Pedw3_HB", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth2Ped0_HB = new TH2F("h_mapDepth2Ped0_HB", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth2Ped1_HB = new TH2F("h_mapDepth2Ped1_HB", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth2Ped2_HB = new TH2F("h_mapDepth2Ped2_HB", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth2Ped3_HB = new TH2F("h_mapDepth2Ped3_HB", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth2Pedw0_HB = new TH2F("h_mapDepth2Pedw0_HB", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth2Pedw1_HB = new TH2F("h_mapDepth2Pedw1_HB", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth2Pedw2_HB = new TH2F("h_mapDepth2Pedw2_HB", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth2Pedw3_HB = new TH2F("h_mapDepth2Pedw3_HB", " ", neta, -41., 41., nphi, 0., bphi); - - h_mapDepth1Ped0_HE = new TH2F("h_mapDepth1Ped0_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth1Ped1_HE = new TH2F("h_mapDepth1Ped1_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth1Ped2_HE = new TH2F("h_mapDepth1Ped2_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth1Ped3_HE = new TH2F("h_mapDepth1Ped3_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth1Pedw0_HE = new TH2F("h_mapDepth1Pedw0_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth1Pedw1_HE = new TH2F("h_mapDepth1Pedw1_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth1Pedw2_HE = new TH2F("h_mapDepth1Pedw2_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth1Pedw3_HE = new TH2F("h_mapDepth1Pedw3_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth2Ped0_HE = new TH2F("h_mapDepth2Ped0_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth2Ped1_HE = new TH2F("h_mapDepth2Ped1_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth2Ped2_HE = new TH2F("h_mapDepth2Ped2_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth2Ped3_HE = new TH2F("h_mapDepth2Ped3_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth2Pedw0_HE = new TH2F("h_mapDepth2Pedw0_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth2Pedw1_HE = new TH2F("h_mapDepth2Pedw1_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth2Pedw2_HE = new TH2F("h_mapDepth2Pedw2_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth2Pedw3_HE = new TH2F("h_mapDepth2Pedw3_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth3Ped0_HE = new TH2F("h_mapDepth3Ped0_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth3Ped1_HE = new TH2F("h_mapDepth3Ped1_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth3Ped2_HE = new TH2F("h_mapDepth3Ped2_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth3Ped3_HE = new TH2F("h_mapDepth3Ped3_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth3Pedw0_HE = new TH2F("h_mapDepth3Pedw0_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth3Pedw1_HE = new TH2F("h_mapDepth3Pedw1_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth3Pedw2_HE = new TH2F("h_mapDepth3Pedw2_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth3Pedw3_HE = new TH2F("h_mapDepth3Pedw3_HE", " ", neta, -41., 41., nphi, 0., bphi); - - h_mapDepth1Ped0_HF = new TH2F("h_mapDepth1Ped0_HF", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth1Ped1_HF = new TH2F("h_mapDepth1Ped1_HF", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth1Ped2_HF = new TH2F("h_mapDepth1Ped2_HF", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth1Ped3_HF = new TH2F("h_mapDepth1Ped3_HF", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth1Pedw0_HF = new TH2F("h_mapDepth1Pedw0_HF", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth1Pedw1_HF = new TH2F("h_mapDepth1Pedw1_HF", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth1Pedw2_HF = new TH2F("h_mapDepth1Pedw2_HF", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth1Pedw3_HF = new TH2F("h_mapDepth1Pedw3_HF", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth2Ped0_HF = new TH2F("h_mapDepth2Ped0_HF", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth2Ped1_HF = new TH2F("h_mapDepth2Ped1_HF", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth2Ped2_HF = new TH2F("h_mapDepth2Ped2_HF", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth2Ped3_HF = new TH2F("h_mapDepth2Ped3_HF", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth2Pedw0_HF = new TH2F("h_mapDepth2Pedw0_HF", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth2Pedw1_HF = new TH2F("h_mapDepth2Pedw1_HF", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth2Pedw2_HF = new TH2F("h_mapDepth2Pedw2_HF", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth2Pedw3_HF = new TH2F("h_mapDepth2Pedw3_HF", " ", neta, -41., 41., nphi, 0., bphi); - - h_mapDepth4Ped0_HO = new TH2F("h_mapDepth4Ped0_HO", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth4Ped1_HO = new TH2F("h_mapDepth4Ped1_HO", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth4Ped2_HO = new TH2F("h_mapDepth4Ped2_HO", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth4Ped3_HO = new TH2F("h_mapDepth4Ped3_HO", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth4Pedw0_HO = new TH2F("h_mapDepth4Pedw0_HO", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth4Pedw1_HO = new TH2F("h_mapDepth4Pedw1_HO", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth4Pedw2_HO = new TH2F("h_mapDepth4Pedw2_HO", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth4Pedw3_HO = new TH2F("h_mapDepth4Pedw3_HO", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth1Ped0_HB = fs_->make("h_mapDepth1Ped0_HB", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth1Ped1_HB = fs_->make("h_mapDepth1Ped1_HB", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth1Ped2_HB = fs_->make("h_mapDepth1Ped2_HB", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth1Ped3_HB = fs_->make("h_mapDepth1Ped3_HB", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth1Pedw0_HB = fs_->make("h_mapDepth1Pedw0_HB", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth1Pedw1_HB = fs_->make("h_mapDepth1Pedw1_HB", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth1Pedw2_HB = fs_->make("h_mapDepth1Pedw2_HB", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth1Pedw3_HB = fs_->make("h_mapDepth1Pedw3_HB", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth2Ped0_HB = fs_->make("h_mapDepth2Ped0_HB", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth2Ped1_HB = fs_->make("h_mapDepth2Ped1_HB", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth2Ped2_HB = fs_->make("h_mapDepth2Ped2_HB", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth2Ped3_HB = fs_->make("h_mapDepth2Ped3_HB", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth2Pedw0_HB = fs_->make("h_mapDepth2Pedw0_HB", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth2Pedw1_HB = fs_->make("h_mapDepth2Pedw1_HB", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth2Pedw2_HB = fs_->make("h_mapDepth2Pedw2_HB", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth2Pedw3_HB = fs_->make("h_mapDepth2Pedw3_HB", " ", neta, -41., 41., nphi, 0., bphi); + + h_mapDepth1Ped0_HE = fs_->make("h_mapDepth1Ped0_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth1Ped1_HE = fs_->make("h_mapDepth1Ped1_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth1Ped2_HE = fs_->make("h_mapDepth1Ped2_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth1Ped3_HE = fs_->make("h_mapDepth1Ped3_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth1Pedw0_HE = fs_->make("h_mapDepth1Pedw0_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth1Pedw1_HE = fs_->make("h_mapDepth1Pedw1_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth1Pedw2_HE = fs_->make("h_mapDepth1Pedw2_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth1Pedw3_HE = fs_->make("h_mapDepth1Pedw3_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth2Ped0_HE = fs_->make("h_mapDepth2Ped0_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth2Ped1_HE = fs_->make("h_mapDepth2Ped1_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth2Ped2_HE = fs_->make("h_mapDepth2Ped2_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth2Ped3_HE = fs_->make("h_mapDepth2Ped3_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth2Pedw0_HE = fs_->make("h_mapDepth2Pedw0_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth2Pedw1_HE = fs_->make("h_mapDepth2Pedw1_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth2Pedw2_HE = fs_->make("h_mapDepth2Pedw2_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth2Pedw3_HE = fs_->make("h_mapDepth2Pedw3_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth3Ped0_HE = fs_->make("h_mapDepth3Ped0_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth3Ped1_HE = fs_->make("h_mapDepth3Ped1_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth3Ped2_HE = fs_->make("h_mapDepth3Ped2_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth3Ped3_HE = fs_->make("h_mapDepth3Ped3_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth3Pedw0_HE = fs_->make("h_mapDepth3Pedw0_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth3Pedw1_HE = fs_->make("h_mapDepth3Pedw1_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth3Pedw2_HE = fs_->make("h_mapDepth3Pedw2_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth3Pedw3_HE = fs_->make("h_mapDepth3Pedw3_HE", " ", neta, -41., 41., nphi, 0., bphi); + + h_mapDepth1Ped0_HF = fs_->make("h_mapDepth1Ped0_HF", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth1Ped1_HF = fs_->make("h_mapDepth1Ped1_HF", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth1Ped2_HF = fs_->make("h_mapDepth1Ped2_HF", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth1Ped3_HF = fs_->make("h_mapDepth1Ped3_HF", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth1Pedw0_HF = fs_->make("h_mapDepth1Pedw0_HF", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth1Pedw1_HF = fs_->make("h_mapDepth1Pedw1_HF", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth1Pedw2_HF = fs_->make("h_mapDepth1Pedw2_HF", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth1Pedw3_HF = fs_->make("h_mapDepth1Pedw3_HF", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth2Ped0_HF = fs_->make("h_mapDepth2Ped0_HF", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth2Ped1_HF = fs_->make("h_mapDepth2Ped1_HF", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth2Ped2_HF = fs_->make("h_mapDepth2Ped2_HF", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth2Ped3_HF = fs_->make("h_mapDepth2Ped3_HF", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth2Pedw0_HF = fs_->make("h_mapDepth2Pedw0_HF", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth2Pedw1_HF = fs_->make("h_mapDepth2Pedw1_HF", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth2Pedw2_HF = fs_->make("h_mapDepth2Pedw2_HF", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth2Pedw3_HF = fs_->make("h_mapDepth2Pedw3_HF", " ", neta, -41., 41., nphi, 0., bphi); + + h_mapDepth4Ped0_HO = fs_->make("h_mapDepth4Ped0_HO", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth4Ped1_HO = fs_->make("h_mapDepth4Ped1_HO", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth4Ped2_HO = fs_->make("h_mapDepth4Ped2_HO", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth4Ped3_HO = fs_->make("h_mapDepth4Ped3_HO", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth4Pedw0_HO = fs_->make("h_mapDepth4Pedw0_HO", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth4Pedw1_HO = fs_->make("h_mapDepth4Pedw1_HO", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth4Pedw2_HO = fs_->make("h_mapDepth4Pedw2_HO", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth4Pedw3_HO = fs_->make("h_mapDepth4Pedw3_HO", " ", neta, -41., 41., nphi, 0., bphi); //-------------------------------------------------- - h_mapDepth1ADCAmpl12_HB = new TH2F("h_mapDepth1ADCAmpl12_HB", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth2ADCAmpl12_HB = new TH2F("h_mapDepth2ADCAmpl12_HB", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth3ADCAmpl12_HB = new TH2F("h_mapDepth3ADCAmpl12_HB", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth4ADCAmpl12_HB = new TH2F("h_mapDepth4ADCAmpl12_HB", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth1ADCAmpl12_HE = new TH2F("h_mapDepth1ADCAmpl12_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth2ADCAmpl12_HE = new TH2F("h_mapDepth2ADCAmpl12_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth3ADCAmpl12_HE = new TH2F("h_mapDepth3ADCAmpl12_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth4ADCAmpl12_HE = new TH2F("h_mapDepth4ADCAmpl12_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth5ADCAmpl12_HE = new TH2F("h_mapDepth5ADCAmpl12_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth6ADCAmpl12_HE = new TH2F("h_mapDepth6ADCAmpl12_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth7ADCAmpl12_HE = new TH2F("h_mapDepth7ADCAmpl12_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth1ADCAmpl12SiPM_HE = new TH2F("h_mapDepth1ADCAmpl12SiPM_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth2ADCAmpl12SiPM_HE = new TH2F("h_mapDepth2ADCAmpl12SiPM_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth3ADCAmpl12SiPM_HE = new TH2F("h_mapDepth3ADCAmpl12SiPM_HE", " ", neta, -41., 41., nphi, 0., bphi); - - h_mapDepth1ADCAmpl12_HF = new TH2F("h_mapDepth1ADCAmpl12_HF", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth2ADCAmpl12_HF = new TH2F("h_mapDepth2ADCAmpl12_HF", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth3ADCAmpl12_HF = new TH2F("h_mapDepth3ADCAmpl12_HF", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth4ADCAmpl12_HF = new TH2F("h_mapDepth4ADCAmpl12_HF", " ", neta, -41., 41., nphi, 0., bphi); - - h_mapDepth4ADCAmpl12_HO = new TH2F("h_mapDepth4ADCAmpl12_HO", " ", neta, -41., 41., nphi, 0., bphi); - - h_mapDepth1linADCAmpl12_HE = new TH2F("h_mapDepth1linADCAmpl12_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth2linADCAmpl12_HE = new TH2F("h_mapDepth2linADCAmpl12_HE", " ", neta, -41., 41., nphi, 0., bphi); - h_mapDepth3linADCAmpl12_HE = new TH2F("h_mapDepth3linADCAmpl12_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth1ADCAmpl12_HB = fs_->make("h_mapDepth1ADCAmpl12_HB", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth2ADCAmpl12_HB = fs_->make("h_mapDepth2ADCAmpl12_HB", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth3ADCAmpl12_HB = fs_->make("h_mapDepth3ADCAmpl12_HB", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth4ADCAmpl12_HB = fs_->make("h_mapDepth4ADCAmpl12_HB", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth1ADCAmpl12_HE = fs_->make("h_mapDepth1ADCAmpl12_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth2ADCAmpl12_HE = fs_->make("h_mapDepth2ADCAmpl12_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth3ADCAmpl12_HE = fs_->make("h_mapDepth3ADCAmpl12_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth4ADCAmpl12_HE = fs_->make("h_mapDepth4ADCAmpl12_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth5ADCAmpl12_HE = fs_->make("h_mapDepth5ADCAmpl12_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth6ADCAmpl12_HE = fs_->make("h_mapDepth6ADCAmpl12_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth7ADCAmpl12_HE = fs_->make("h_mapDepth7ADCAmpl12_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth1ADCAmpl12SiPM_HE = fs_->make("h_mapDepth1ADCAmpl12SiPM_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth2ADCAmpl12SiPM_HE = fs_->make("h_mapDepth2ADCAmpl12SiPM_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth3ADCAmpl12SiPM_HE = fs_->make("h_mapDepth3ADCAmpl12SiPM_HE", " ", neta, -41., 41., nphi, 0., bphi); + + h_mapDepth1ADCAmpl12_HF = fs_->make("h_mapDepth1ADCAmpl12_HF", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth2ADCAmpl12_HF = fs_->make("h_mapDepth2ADCAmpl12_HF", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth3ADCAmpl12_HF = fs_->make("h_mapDepth3ADCAmpl12_HF", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth4ADCAmpl12_HF = fs_->make("h_mapDepth4ADCAmpl12_HF", " ", neta, -41., 41., nphi, 0., bphi); + + h_mapDepth4ADCAmpl12_HO = fs_->make("h_mapDepth4ADCAmpl12_HO", " ", neta, -41., 41., nphi, 0., bphi); + + h_mapDepth1linADCAmpl12_HE = fs_->make("h_mapDepth1linADCAmpl12_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth2linADCAmpl12_HE = fs_->make("h_mapDepth2linADCAmpl12_HE", " ", neta, -41., 41., nphi, 0., bphi); + h_mapDepth3linADCAmpl12_HE = fs_->make("h_mapDepth3linADCAmpl12_HE", " ", neta, -41., 41., nphi, 0., bphi); //-------------------------------------------------- h_mapGetRMSOverNormalizedSignal_HB = - new TH2F("h_mapGetRMSOverNormalizedSignal_HB", " ", neta, -41., 41., nphi, 0., bphi); + fs_->make("h_mapGetRMSOverNormalizedSignal_HB", " ", neta, -41., 41., nphi, 0., bphi); h_mapGetRMSOverNormalizedSignal0_HB = - new TH2F("h_mapGetRMSOverNormalizedSignal0_HB", " ", neta, -41., 41., nphi, 0., bphi); + fs_->make("h_mapGetRMSOverNormalizedSignal0_HB", " ", neta, -41., 41., nphi, 0., bphi); h_mapGetRMSOverNormalizedSignal_HE = - new TH2F("h_mapGetRMSOverNormalizedSignal_HE", " ", neta, -41., 41., nphi, 0., bphi); + fs_->make("h_mapGetRMSOverNormalizedSignal_HE", " ", neta, -41., 41., nphi, 0., bphi); h_mapGetRMSOverNormalizedSignal0_HE = - new TH2F("h_mapGetRMSOverNormalizedSignal0_HE", " ", neta, -41., 41., nphi, 0., bphi); + fs_->make("h_mapGetRMSOverNormalizedSignal0_HE", " ", neta, -41., 41., nphi, 0., bphi); h_mapGetRMSOverNormalizedSignal_HF = - new TH2F("h_mapGetRMSOverNormalizedSignal_HF", " ", neta, -41., 41., nphi, 0., bphi); + fs_->make("h_mapGetRMSOverNormalizedSignal_HF", " ", neta, -41., 41., nphi, 0., bphi); h_mapGetRMSOverNormalizedSignal0_HF = - new TH2F("h_mapGetRMSOverNormalizedSignal0_HF", " ", neta, -41., 41., nphi, 0., bphi); + fs_->make("h_mapGetRMSOverNormalizedSignal0_HF", " ", neta, -41., 41., nphi, 0., bphi); h_mapGetRMSOverNormalizedSignal_HO = - new TH2F("h_mapGetRMSOverNormalizedSignal_HO", " ", neta, -41., 41., nphi, 0., bphi); + fs_->make("h_mapGetRMSOverNormalizedSignal_HO", " ", neta, -41., 41., nphi, 0., bphi); h_mapGetRMSOverNormalizedSignal0_HO = - new TH2F("h_mapGetRMSOverNormalizedSignal0_HO", " ", neta, -41., 41., nphi, 0., bphi); + fs_->make("h_mapGetRMSOverNormalizedSignal0_HO", " ", neta, -41., 41., nphi, 0., bphi); //-------------------------------------------------- - h_shape_Ahigh_HB0 = new TH1F("h_shape_Ahigh_HB0", " ", 10, 0., 10.); - h_shape0_Ahigh_HB0 = new TH1F("h_shape0_Ahigh_HB0", " ", 10, 0., 10.); - h_shape_Alow_HB0 = new TH1F("h_shape_Alow_HB0", " ", 10, 0., 10.); - h_shape0_Alow_HB0 = new TH1F("h_shape0_Alow_HB0", " ", 10, 0., 10.); - h_shape_Ahigh_HB1 = new TH1F("h_shape_Ahigh_HB1", " ", 10, 0., 10.); - h_shape0_Ahigh_HB1 = new TH1F("h_shape0_Ahigh_HB1", " ", 10, 0., 10.); - h_shape_Alow_HB1 = new TH1F("h_shape_Alow_HB1", " ", 10, 0., 10.); - h_shape0_Alow_HB1 = new TH1F("h_shape0_Alow_HB1", " ", 10, 0., 10.); - h_shape_Ahigh_HB2 = new TH1F("h_shape_Ahigh_HB2", " ", 10, 0., 10.); - h_shape0_Ahigh_HB2 = new TH1F("h_shape0_Ahigh_HB2", " ", 10, 0., 10.); - h_shape_Alow_HB2 = new TH1F("h_shape_Alow_HB2", " ", 10, 0., 10.); - h_shape0_Alow_HB2 = new TH1F("h_shape0_Alow_HB2", " ", 10, 0., 10.); - h_shape_Ahigh_HB3 = new TH1F("h_shape_Ahigh_HB3", " ", 10, 0., 10.); - h_shape0_Ahigh_HB3 = new TH1F("h_shape0_Ahigh_HB3", " ", 10, 0., 10.); - h_shape_Alow_HB3 = new TH1F("h_shape_Alow_HB3", " ", 10, 0., 10.); - h_shape0_Alow_HB3 = new TH1F("h_shape0_Alow_HB3", " ", 10, 0., 10.); + h_shape_Ahigh_HB0 = fs_->make("h_shape_Ahigh_HB0", " ", 10, 0., 10.); + h_shape0_Ahigh_HB0 = fs_->make("h_shape0_Ahigh_HB0", " ", 10, 0., 10.); + h_shape_Alow_HB0 = fs_->make("h_shape_Alow_HB0", " ", 10, 0., 10.); + h_shape0_Alow_HB0 = fs_->make("h_shape0_Alow_HB0", " ", 10, 0., 10.); + h_shape_Ahigh_HB1 = fs_->make("h_shape_Ahigh_HB1", " ", 10, 0., 10.); + h_shape0_Ahigh_HB1 = fs_->make("h_shape0_Ahigh_HB1", " ", 10, 0., 10.); + h_shape_Alow_HB1 = fs_->make("h_shape_Alow_HB1", " ", 10, 0., 10.); + h_shape0_Alow_HB1 = fs_->make("h_shape0_Alow_HB1", " ", 10, 0., 10.); + h_shape_Ahigh_HB2 = fs_->make("h_shape_Ahigh_HB2", " ", 10, 0., 10.); + h_shape0_Ahigh_HB2 = fs_->make("h_shape0_Ahigh_HB2", " ", 10, 0., 10.); + h_shape_Alow_HB2 = fs_->make("h_shape_Alow_HB2", " ", 10, 0., 10.); + h_shape0_Alow_HB2 = fs_->make("h_shape0_Alow_HB2", " ", 10, 0., 10.); + h_shape_Ahigh_HB3 = fs_->make("h_shape_Ahigh_HB3", " ", 10, 0., 10.); + h_shape0_Ahigh_HB3 = fs_->make("h_shape0_Ahigh_HB3", " ", 10, 0., 10.); + h_shape_Alow_HB3 = fs_->make("h_shape_Alow_HB3", " ", 10, 0., 10.); + h_shape0_Alow_HB3 = fs_->make("h_shape0_Alow_HB3", " ", 10, 0., 10.); //-------------------------------------------------- - h_shape_bad_channels_HB = new TH1F("h_shape_bad_channels_HB", " ", 10, 0., 10.); - h_shape0_bad_channels_HB = new TH1F("h_shape0_bad_channels_HB", " ", 10, 0., 10.); - h_shape_good_channels_HB = new TH1F("h_shape_good_channels_HB", " ", 10, 0., 10.); - h_shape0_good_channels_HB = new TH1F("h_shape0_good_channels_HB", " ", 10, 0., 10.); - h_shape_bad_channels_HE = new TH1F("h_shape_bad_channels_HE", " ", 10, 0., 10.); - h_shape0_bad_channels_HE = new TH1F("h_shape0_bad_channels_HE", " ", 10, 0., 10.); - h_shape_good_channels_HE = new TH1F("h_shape_good_channels_HE", " ", 10, 0., 10.); - h_shape0_good_channels_HE = new TH1F("h_shape0_good_channels_HE", " ", 10, 0., 10.); - h_shape_bad_channels_HF = new TH1F("h_shape_bad_channels_HF", " ", 10, 0., 10.); - h_shape0_bad_channels_HF = new TH1F("h_shape0_bad_channels_HF", " ", 10, 0., 10.); - h_shape_good_channels_HF = new TH1F("h_shape_good_channels_HF", " ", 10, 0., 10.); - h_shape0_good_channels_HF = new TH1F("h_shape0_good_channels_HF", " ", 10, 0., 10.); - h_shape_bad_channels_HO = new TH1F("h_shape_bad_channels_HO", " ", 10, 0., 10.); - h_shape0_bad_channels_HO = new TH1F("h_shape0_bad_channels_HO", " ", 10, 0., 10.); - h_shape_good_channels_HO = new TH1F("h_shape_good_channels_HO", " ", 10, 0., 10.); - h_shape0_good_channels_HO = new TH1F("h_shape0_good_channels_HO", " ", 10, 0., 10.); + h_shape_bad_channels_HB = fs_->make("h_shape_bad_channels_HB", " ", 10, 0., 10.); + h_shape0_bad_channels_HB = fs_->make("h_shape0_bad_channels_HB", " ", 10, 0., 10.); + h_shape_good_channels_HB = fs_->make("h_shape_good_channels_HB", " ", 10, 0., 10.); + h_shape0_good_channels_HB = fs_->make("h_shape0_good_channels_HB", " ", 10, 0., 10.); + h_shape_bad_channels_HE = fs_->make("h_shape_bad_channels_HE", " ", 10, 0., 10.); + h_shape0_bad_channels_HE = fs_->make("h_shape0_bad_channels_HE", " ", 10, 0., 10.); + h_shape_good_channels_HE = fs_->make("h_shape_good_channels_HE", " ", 10, 0., 10.); + h_shape0_good_channels_HE = fs_->make("h_shape0_good_channels_HE", " ", 10, 0., 10.); + h_shape_bad_channels_HF = fs_->make("h_shape_bad_channels_HF", " ", 10, 0., 10.); + h_shape0_bad_channels_HF = fs_->make("h_shape0_bad_channels_HF", " ", 10, 0., 10.); + h_shape_good_channels_HF = fs_->make("h_shape_good_channels_HF", " ", 10, 0., 10.); + h_shape0_good_channels_HF = fs_->make("h_shape0_good_channels_HF", " ", 10, 0., 10.); + h_shape_bad_channels_HO = fs_->make("h_shape_bad_channels_HO", " ", 10, 0., 10.); + h_shape0_bad_channels_HO = fs_->make("h_shape0_bad_channels_HO", " ", 10, 0., 10.); + h_shape_good_channels_HO = fs_->make("h_shape_good_channels_HO", " ", 10, 0., 10.); + h_shape0_good_channels_HO = fs_->make("h_shape0_good_channels_HO", " ", 10, 0., 10.); //-------------------------------------------------- // if(flagcpuoptimization_== 0 ) { int spl = 1000; float spls = 5000; - h_sumamplitude_depth1_HB = new TH1F("h_sumamplitude_depth1_HB", " ", spl, 0., spls); - h_sumamplitude_depth2_HB = new TH1F("h_sumamplitude_depth2_HB", " ", spl, 0., spls); - h_sumamplitude_depth1_HE = new TH1F("h_sumamplitude_depth1_HE", " ", spl, 0., spls); - h_sumamplitude_depth2_HE = new TH1F("h_sumamplitude_depth2_HE", " ", spl, 0., spls); - h_sumamplitude_depth3_HE = new TH1F("h_sumamplitude_depth3_HE", " ", spl, 0., spls); - h_sumamplitude_depth1_HF = new TH1F("h_sumamplitude_depth1_HF", " ", spl, 0., spls); - h_sumamplitude_depth2_HF = new TH1F("h_sumamplitude_depth2_HF", " ", spl, 0., spls); - h_sumamplitude_depth4_HO = new TH1F("h_sumamplitude_depth4_HO", " ", spl, 0., spls); + h_sumamplitude_depth1_HB = fs_->make("h_sumamplitude_depth1_HB", " ", spl, 0., spls); + h_sumamplitude_depth2_HB = fs_->make("h_sumamplitude_depth2_HB", " ", spl, 0., spls); + h_sumamplitude_depth1_HE = fs_->make("h_sumamplitude_depth1_HE", " ", spl, 0., spls); + h_sumamplitude_depth2_HE = fs_->make("h_sumamplitude_depth2_HE", " ", spl, 0., spls); + h_sumamplitude_depth3_HE = fs_->make("h_sumamplitude_depth3_HE", " ", spl, 0., spls); + h_sumamplitude_depth1_HF = fs_->make("h_sumamplitude_depth1_HF", " ", spl, 0., spls); + h_sumamplitude_depth2_HF = fs_->make("h_sumamplitude_depth2_HF", " ", spl, 0., spls); + h_sumamplitude_depth4_HO = fs_->make("h_sumamplitude_depth4_HO", " ", spl, 0., spls); int spl0 = 1000; float spls0 = 10000; - h_sumamplitude_depth1_HB0 = new TH1F("h_sumamplitude_depth1_HB0", " ", spl0, 0., spls0); - h_sumamplitude_depth2_HB0 = new TH1F("h_sumamplitude_depth2_HB0", " ", spl0, 0., spls0); - h_sumamplitude_depth1_HE0 = new TH1F("h_sumamplitude_depth1_HE0", " ", spl0, 0., spls0); - h_sumamplitude_depth2_HE0 = new TH1F("h_sumamplitude_depth2_HE0", " ", spl0, 0., spls0); - h_sumamplitude_depth3_HE0 = new TH1F("h_sumamplitude_depth3_HE0", " ", spl0, 0., spls0); - h_sumamplitude_depth1_HF0 = new TH1F("h_sumamplitude_depth1_HF0", " ", spl0, 0., spls0); - h_sumamplitude_depth2_HF0 = new TH1F("h_sumamplitude_depth2_HF0", " ", spl0, 0., spls0); - h_sumamplitude_depth4_HO0 = new TH1F("h_sumamplitude_depth4_HO0", " ", spl0, 0., spls0); + h_sumamplitude_depth1_HB0 = fs_->make("h_sumamplitude_depth1_HB0", " ", spl0, 0., spls0); + h_sumamplitude_depth2_HB0 = fs_->make("h_sumamplitude_depth2_HB0", " ", spl0, 0., spls0); + h_sumamplitude_depth1_HE0 = fs_->make("h_sumamplitude_depth1_HE0", " ", spl0, 0., spls0); + h_sumamplitude_depth2_HE0 = fs_->make("h_sumamplitude_depth2_HE0", " ", spl0, 0., spls0); + h_sumamplitude_depth3_HE0 = fs_->make("h_sumamplitude_depth3_HE0", " ", spl0, 0., spls0); + h_sumamplitude_depth1_HF0 = fs_->make("h_sumamplitude_depth1_HF0", " ", spl0, 0., spls0); + h_sumamplitude_depth2_HF0 = fs_->make("h_sumamplitude_depth2_HF0", " ", spl0, 0., spls0); + h_sumamplitude_depth4_HO0 = fs_->make("h_sumamplitude_depth4_HO0", " ", spl0, 0., spls0); int spl1 = 1000; float spls1 = 100000; - h_sumamplitude_depth1_HB1 = new TH1F("h_sumamplitude_depth1_HB1", " ", spl1, 0., spls1); - h_sumamplitude_depth2_HB1 = new TH1F("h_sumamplitude_depth2_HB1", " ", spl1, 0., spls1); - h_sumamplitude_depth1_HE1 = new TH1F("h_sumamplitude_depth1_HE1", " ", spl1, 0., spls1); - h_sumamplitude_depth2_HE1 = new TH1F("h_sumamplitude_depth2_HE1", " ", spl1, 0., spls1); - h_sumamplitude_depth3_HE1 = new TH1F("h_sumamplitude_depth3_HE1", " ", spl1, 0., spls1); - h_sumamplitude_depth1_HF1 = new TH1F("h_sumamplitude_depth1_HF1", " ", spl1, 0., spls1); - h_sumamplitude_depth2_HF1 = new TH1F("h_sumamplitude_depth2_HF1", " ", spl1, 0., spls1); - h_sumamplitude_depth4_HO1 = new TH1F("h_sumamplitude_depth4_HO1", " ", spl1, 0., spls1); - - h_Amplitude_forCapIdErrors_HB1 = new TH1F("h_Amplitude_forCapIdErrors_HB1", " ", 100, 0., 30000.); - h_Amplitude_forCapIdErrors_HB2 = new TH1F("h_Amplitude_forCapIdErrors_HB2", " ", 100, 0., 30000.); - h_Amplitude_forCapIdErrors_HE1 = new TH1F("h_Amplitude_forCapIdErrors_HE1", " ", 100, 0., 30000.); - h_Amplitude_forCapIdErrors_HE2 = new TH1F("h_Amplitude_forCapIdErrors_HE2", " ", 100, 0., 30000.); - h_Amplitude_forCapIdErrors_HE3 = new TH1F("h_Amplitude_forCapIdErrors_HE3", " ", 100, 0., 30000.); - h_Amplitude_forCapIdErrors_HF1 = new TH1F("h_Amplitude_forCapIdErrors_HF1", " ", 100, 0., 30000.); - h_Amplitude_forCapIdErrors_HF2 = new TH1F("h_Amplitude_forCapIdErrors_HF2", " ", 100, 0., 30000.); - h_Amplitude_forCapIdErrors_HO4 = new TH1F("h_Amplitude_forCapIdErrors_HO4", " ", 100, 0., 30000.); - - h_Amplitude_notCapIdErrors_HB1 = new TH1F("h_Amplitude_notCapIdErrors_HB1", " ", 100, 0., 30000.); - h_Amplitude_notCapIdErrors_HB2 = new TH1F("h_Amplitude_notCapIdErrors_HB2", " ", 100, 0., 30000.); - h_Amplitude_notCapIdErrors_HE1 = new TH1F("h_Amplitude_notCapIdErrors_HE1", " ", 100, 0., 30000.); - h_Amplitude_notCapIdErrors_HE2 = new TH1F("h_Amplitude_notCapIdErrors_HE2", " ", 100, 0., 30000.); - h_Amplitude_notCapIdErrors_HE3 = new TH1F("h_Amplitude_notCapIdErrors_HE3", " ", 100, 0., 30000.); - h_Amplitude_notCapIdErrors_HF1 = new TH1F("h_Amplitude_notCapIdErrors_HF1", " ", 100, 0., 30000.); - h_Amplitude_notCapIdErrors_HF2 = new TH1F("h_Amplitude_notCapIdErrors_HF2", " ", 100, 0., 30000.); - h_Amplitude_notCapIdErrors_HO4 = new TH1F("h_Amplitude_notCapIdErrors_HO4", " ", 100, 0., 30000.); - - h_2DAtaildepth1_HB = new TH2F("h_2DAtaildepth1_HB", " ", neta, -41., 41., nphi, 0., bphi); - h_2D0Ataildepth1_HB = new TH2F("h_2D0Ataildepth1_HB", " ", neta, -41., 41., nphi, 0., bphi); - h_2DAtaildepth2_HB = new TH2F("h_2DAtaildepth2_HB", " ", neta, -41., 41., nphi, 0., bphi); - h_2D0Ataildepth2_HB = new TH2F("h_2D0Ataildepth2_HB", " ", neta, -41., 41., nphi, 0., bphi); + h_sumamplitude_depth1_HB1 = fs_->make("h_sumamplitude_depth1_HB1", " ", spl1, 0., spls1); + h_sumamplitude_depth2_HB1 = fs_->make("h_sumamplitude_depth2_HB1", " ", spl1, 0., spls1); + h_sumamplitude_depth1_HE1 = fs_->make("h_sumamplitude_depth1_HE1", " ", spl1, 0., spls1); + h_sumamplitude_depth2_HE1 = fs_->make("h_sumamplitude_depth2_HE1", " ", spl1, 0., spls1); + h_sumamplitude_depth3_HE1 = fs_->make("h_sumamplitude_depth3_HE1", " ", spl1, 0., spls1); + h_sumamplitude_depth1_HF1 = fs_->make("h_sumamplitude_depth1_HF1", " ", spl1, 0., spls1); + h_sumamplitude_depth2_HF1 = fs_->make("h_sumamplitude_depth2_HF1", " ", spl1, 0., spls1); + h_sumamplitude_depth4_HO1 = fs_->make("h_sumamplitude_depth4_HO1", " ", spl1, 0., spls1); + + h_Amplitude_forCapIdErrors_HB1 = fs_->make("h_Amplitude_forCapIdErrors_HB1", " ", 100, 0., 30000.); + h_Amplitude_forCapIdErrors_HB2 = fs_->make("h_Amplitude_forCapIdErrors_HB2", " ", 100, 0., 30000.); + h_Amplitude_forCapIdErrors_HE1 = fs_->make("h_Amplitude_forCapIdErrors_HE1", " ", 100, 0., 30000.); + h_Amplitude_forCapIdErrors_HE2 = fs_->make("h_Amplitude_forCapIdErrors_HE2", " ", 100, 0., 30000.); + h_Amplitude_forCapIdErrors_HE3 = fs_->make("h_Amplitude_forCapIdErrors_HE3", " ", 100, 0., 30000.); + h_Amplitude_forCapIdErrors_HF1 = fs_->make("h_Amplitude_forCapIdErrors_HF1", " ", 100, 0., 30000.); + h_Amplitude_forCapIdErrors_HF2 = fs_->make("h_Amplitude_forCapIdErrors_HF2", " ", 100, 0., 30000.); + h_Amplitude_forCapIdErrors_HO4 = fs_->make("h_Amplitude_forCapIdErrors_HO4", " ", 100, 0., 30000.); + + h_Amplitude_notCapIdErrors_HB1 = fs_->make("h_Amplitude_notCapIdErrors_HB1", " ", 100, 0., 30000.); + h_Amplitude_notCapIdErrors_HB2 = fs_->make("h_Amplitude_notCapIdErrors_HB2", " ", 100, 0., 30000.); + h_Amplitude_notCapIdErrors_HE1 = fs_->make("h_Amplitude_notCapIdErrors_HE1", " ", 100, 0., 30000.); + h_Amplitude_notCapIdErrors_HE2 = fs_->make("h_Amplitude_notCapIdErrors_HE2", " ", 100, 0., 30000.); + h_Amplitude_notCapIdErrors_HE3 = fs_->make("h_Amplitude_notCapIdErrors_HE3", " ", 100, 0., 30000.); + h_Amplitude_notCapIdErrors_HF1 = fs_->make("h_Amplitude_notCapIdErrors_HF1", " ", 100, 0., 30000.); + h_Amplitude_notCapIdErrors_HF2 = fs_->make("h_Amplitude_notCapIdErrors_HF2", " ", 100, 0., 30000.); + h_Amplitude_notCapIdErrors_HO4 = fs_->make("h_Amplitude_notCapIdErrors_HO4", " ", 100, 0., 30000.); + + h_2DAtaildepth1_HB = fs_->make("h_2DAtaildepth1_HB", " ", neta, -41., 41., nphi, 0., bphi); + h_2D0Ataildepth1_HB = fs_->make("h_2D0Ataildepth1_HB", " ", neta, -41., 41., nphi, 0., bphi); + h_2DAtaildepth2_HB = fs_->make("h_2DAtaildepth2_HB", " ", neta, -41., 41., nphi, 0., bphi); + h_2D0Ataildepth2_HB = fs_->make("h_2D0Ataildepth2_HB", " ", neta, -41., 41., nphi, 0., bphi); //////////////////////////////////////////////////////////////////////////////////// } //if(recordHistoes_ if (verbosity > 0) - cout << "======================== booking DONE +++++++++++++++++++++++++++" << endl; + std::cout << "======================== booking DONE +++++++++++++++++++++++++++" << std::endl; /////////////////////////////////////////////////////// ntuples: if (recordNtuples_) { - myTree = new TTree("Hcal", "Hcal Tree"); + myTree = fs_->make("Hcal", "Hcal Tree"); myTree->Branch("Nevent", &Nevent, "Nevent/I"); myTree->Branch("Run", &Run, "Run/I"); } //if(recordNtuples_ if (verbosity > 0) - cout << "======================== beignJob finish +++++++++++++++++++++++++++" << endl; + std::cout << "======================== beignJob finish +++++++++++++++++++++++++++" << std::endl; ////////////////////////////////////////////////////////////////// } @@ -12452,10 +11184,8 @@ void CMTRawAnalyzer::fillDigiAmplitudeHFQIE10(QIE10DataFrame qie10df) { if (mdepth > 2 && flagupgradeqie1011_ == 9) return; ///////////////////////////////////////////////////////////////// - // HcalCalibrations calib = conditions->getHcalCalibrations(hcaldetid); const HcalPedestal* pedestal00 = conditions->getPedestal(hcaldetid); const HcalGain* gain = conditions->getGain(hcaldetid); - // const HcalGainWidth* gainWidth = conditions->getGainWidth(hcaldetid); const HcalRespCorr* respcorr = conditions->getHcalRespCorr(hcaldetid); const HcalTimeCorr* timecorr = conditions->getHcalTimeCorr(hcaldetid); const HcalLUTCorr* lutcorr = conditions->getHcalLUTCorr(hcaldetid); @@ -14687,6 +13417,52 @@ void CMTRawAnalyzer::fillMAP() { std::cout << "===== Finish writing Channel MAP =====" << std::endl; } +double CMTRawAnalyzer::dR(double eta1, double phi1, double eta2, double phi2) { + double deltaphi = phi1 - phi2; + if (phi2 > phi1) { + deltaphi = phi2 - phi1; + } + if (deltaphi > M_PI) { + deltaphi = 2. * M_PI - deltaphi; + } + double deltaeta = eta2 - eta1; + double tmp = sqrt(deltaeta * deltaeta + deltaphi * deltaphi); + return tmp; +} + +double CMTRawAnalyzer::phi12(double phi1, double en1, double phi2, double en2) { + // weighted mean value of phi1 and phi2 + + double a1 = phi1; + double a2 = phi2; + + if (a1 > 0.5 * M_PI && a2 < 0.) + a2 += 2 * M_PI; + if (a2 > 0.5 * M_PI && a1 < 0.) + a1 += 2 * M_PI; + double tmp = (a1 * en1 + a2 * en2) / (en1 + en2); + if (tmp > M_PI) + tmp -= 2. * M_PI; + + return tmp; +} + +double CMTRawAnalyzer::dPhiWsign(double phi1, double phi2) { + // clockwise phi2 w.r.t phi1 means "+" phi distance + // anti-clockwise phi2 w.r.t phi1 means "-" phi distance + + double a1 = phi1; + double a2 = phi2; + double tmp = a2 - a1; + if (a1 * a2 < 0.) { + if (a1 > 0.5 * M_PI) + tmp += 2. * M_PI; + if (a2 > 0.5 * M_PI) + tmp -= 2. * M_PI; + } + return tmp; +} + /////////////////////////////// ------------------------------------------------------------------- /////////////////////////////// ------------------------------------------------------------------- //define this as a plug-in diff --git a/DPGAnalysis/HcalTools/test/remoteMonitoring_LED_eraTEST2019_cfg.py b/DPGAnalysis/HcalTools/test/remoteMonitoring_LED_eraTEST2019_cfg.py index b871d7ab03e5a..e9f12c0043c6d 100644 --- a/DPGAnalysis/HcalTools/test/remoteMonitoring_LED_eraTEST2019_cfg.py +++ b/DPGAnalysis/HcalTools/test/remoteMonitoring_LED_eraTEST2019_cfg.py @@ -379,6 +379,10 @@ 'RespCorrs') ) +process.TFileService = cms.Service("TFileService", + fileName = cms.string(histodir+'/LED_'+runnumber+'.root') + ) + process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff") from Configuration.AlCa.autoCond import autoCond # 2018: diff --git a/DPGAnalysis/Skims/interface/BeamSplash.h b/DPGAnalysis/Skims/interface/BeamSplash.h index 1b76149e447e0..d2ed149274934 100644 --- a/DPGAnalysis/Skims/interface/BeamSplash.h +++ b/DPGAnalysis/Skims/interface/BeamSplash.h @@ -17,7 +17,7 @@ // user include files #include "FWCore/Utilities/interface/InputTag.h" #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDFilter.h" +#include "FWCore/Framework/interface/stream/EDFilter.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" @@ -28,7 +28,7 @@ // class declaration // -class BeamSplash : public edm::EDFilter { +class BeamSplash : public edm::stream::EDFilter<> { public: explicit BeamSplash(const edm::ParameterSet &); ~BeamSplash() override; diff --git a/DPGAnalysis/Skims/interface/CSCSkim.h b/DPGAnalysis/Skims/interface/CSCSkim.h index b303c4caba8a2..16c5424463854 100644 --- a/DPGAnalysis/Skims/interface/CSCSkim.h +++ b/DPGAnalysis/Skims/interface/CSCSkim.h @@ -20,7 +20,7 @@ #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/Framework/interface/Frameworkfwd.h" #include "FWCore/Framework/interface/EDAnalyzer.h" -#include "FWCore/Framework/interface/EDFilter.h" +#include "FWCore/Framework/interface/one/EDFilter.h" #include "FWCore/Framework/interface/Event.h" #include "DataFormats/Common/interface/Handle.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" @@ -69,7 +69,7 @@ #include "TString.h" #include "TTree.h" -class CSCSkim : public edm::EDFilter { +class CSCSkim : public edm::one::EDFilter<> { public: // Constructor explicit CSCSkim(const edm::ParameterSet &pset); @@ -137,6 +137,9 @@ class CSCSkim : public edm::EDFilter { std::string outputFileName; std::string histogramFileName; + // es token names + const edm::ESGetToken m_CSCGeomToken; + // token names edm::EDGetTokenT wds_token; edm::EDGetTokenT sds_token; diff --git a/DPGAnalysis/Skims/interface/ECALActivity.h b/DPGAnalysis/Skims/interface/ECALActivity.h index 3d43bae77cf0c..89a4620c56dfc 100644 --- a/DPGAnalysis/Skims/interface/ECALActivity.h +++ b/DPGAnalysis/Skims/interface/ECALActivity.h @@ -17,7 +17,7 @@ // user include files #include "FWCore/Utilities/interface/InputTag.h" #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDFilter.h" +#include "FWCore/Framework/interface/stream/EDFilter.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" @@ -28,7 +28,7 @@ // class declaration // -class ECALActivity : public edm::EDFilter { +class ECALActivity : public edm::stream::EDFilter<> { public: explicit ECALActivity(const edm::ParameterSet &); ~ECALActivity() override; diff --git a/DPGAnalysis/Skims/interface/EcalSkim.h b/DPGAnalysis/Skims/interface/EcalSkim.h index 5012e9f976de7..e4680e20d0573 100644 --- a/DPGAnalysis/Skims/interface/EcalSkim.h +++ b/DPGAnalysis/Skims/interface/EcalSkim.h @@ -22,7 +22,7 @@ // user include files #include "FWCore/Utilities/interface/InputTag.h" #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDFilter.h" +#include "FWCore/Framework/interface/stream/EDFilter.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" @@ -41,7 +41,7 @@ class TFile; -class EcalSkim : public edm::EDFilter { +class EcalSkim : public edm::stream::EDFilter<> { public: explicit EcalSkim(const edm::ParameterSet &); ~EcalSkim() override; diff --git a/DPGAnalysis/Skims/interface/EcalTangentFilter.h b/DPGAnalysis/Skims/interface/EcalTangentFilter.h index a55fd1cdccc15..cbcdc7ceaed76 100644 --- a/DPGAnalysis/Skims/interface/EcalTangentFilter.h +++ b/DPGAnalysis/Skims/interface/EcalTangentFilter.h @@ -3,31 +3,29 @@ // user include files #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDFilter.h" +#include "FWCore/Framework/interface/stream/EDFilter.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" -#include -#include -#include -#include +#include "DataFormats/TrackReco/interface/Track.h" +#include "DataFormats/TrackReco/interface/TrackBase.h" +#include "DataFormats/MuonReco/interface/Muon.h" +#include "DataFormats/MuonReco/interface/MuonFwd.h" // // class declaration // -class EcalTangentFilter : public edm::EDFilter { +class EcalTangentFilter : public edm::stream::EDFilter<> { public: explicit EcalTangentFilter(const edm::ParameterSet&); ~EcalTangentFilter() override; private: - void beginJob() override; bool filter(edm::Event&, const edm::EventSetup&) override; - void endJob() override; // ----------member data --------------------------- int fNgood, fNtot, fEvt; diff --git a/DPGAnalysis/Skims/interface/FilterOutScraping.h b/DPGAnalysis/Skims/interface/FilterOutScraping.h index c48ab634c8773..673bbe9c9f70e 100644 --- a/DPGAnalysis/Skims/interface/FilterOutScraping.h +++ b/DPGAnalysis/Skims/interface/FilterOutScraping.h @@ -17,7 +17,7 @@ // user include files #include "FWCore/Utilities/interface/InputTag.h" #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDFilter.h" +#include "FWCore/Framework/interface/stream/EDFilter.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" @@ -30,7 +30,7 @@ // class declaration // -class FilterOutScraping : public edm::EDFilter { +class FilterOutScraping : public edm::stream::EDFilter<> { public: explicit FilterOutScraping(const edm::ParameterSet &); ~FilterOutScraping() override; diff --git a/DPGAnalysis/Skims/interface/FilterScrapingPixelProbability.h b/DPGAnalysis/Skims/interface/FilterScrapingPixelProbability.h index cf3075f9cbe10..c3494050cd43c 100644 --- a/DPGAnalysis/Skims/interface/FilterScrapingPixelProbability.h +++ b/DPGAnalysis/Skims/interface/FilterScrapingPixelProbability.h @@ -27,7 +27,7 @@ // user include files #include "FWCore/Utilities/interface/InputTag.h" #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDFilter.h" +#include "FWCore/Framework/interface/stream/EDFilter.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" @@ -39,7 +39,7 @@ #include "DataFormats/TrackerRecHit2D/interface/SiPixelRecHit.h" #include "DataFormats/SiPixelDetId/interface/PixelSubdetector.h" -class FilterScrapingPixelProbability : public edm::EDFilter { +class FilterScrapingPixelProbability : public edm::stream::EDFilter<> { public: explicit FilterScrapingPixelProbability(const edm::ParameterSet &); ~FilterScrapingPixelProbability() override; diff --git a/DPGAnalysis/Skims/interface/HLTInspect.h b/DPGAnalysis/Skims/interface/HLTInspect.h index 4ad12849c9ee4..18ec2753b6ec9 100644 --- a/DPGAnalysis/Skims/interface/HLTInspect.h +++ b/DPGAnalysis/Skims/interface/HLTInspect.h @@ -17,7 +17,7 @@ // user include files #include "FWCore/Utilities/interface/InputTag.h" #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" @@ -28,7 +28,7 @@ // class declaration // -class HLTInspect : public edm::EDAnalyzer { +class HLTInspect : public edm::one::EDAnalyzer<> { public: explicit HLTInspect(const edm::ParameterSet&); ~HLTInspect() override; diff --git a/DPGAnalysis/Skims/interface/MatchedProbeMaker.h b/DPGAnalysis/Skims/interface/MatchedProbeMaker.h index 7698a64111b40..97ac94e95cb2a 100644 --- a/DPGAnalysis/Skims/interface/MatchedProbeMaker.h +++ b/DPGAnalysis/Skims/interface/MatchedProbeMaker.h @@ -16,7 +16,7 @@ #include "DataFormats/Candidate/interface/Candidate.h" #include "DataFormats/Candidate/interface/CandMatchMap.h" #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDProducer.h" +#include "FWCore/Framework/interface/one/EDProducer.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" @@ -27,7 +27,7 @@ // template -class MatchedProbeMaker : public edm::EDProducer { +class MatchedProbeMaker : public edm::one::EDProducer<> { public: typedef std::vector collection; diff --git a/DPGAnalysis/Skims/interface/MuonPtFilter.h b/DPGAnalysis/Skims/interface/MuonPtFilter.h index 74cfbe361ccee..d5b857d81ea36 100644 --- a/DPGAnalysis/Skims/interface/MuonPtFilter.h +++ b/DPGAnalysis/Skims/interface/MuonPtFilter.h @@ -13,7 +13,7 @@ /* Base Class Headers */ #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDFilter.h" +#include "FWCore/Framework/interface/stream/EDFilter.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" @@ -27,7 +27,7 @@ class Propagator; /* Class MuonPtFilter Interface */ -class MuonPtFilter : public edm::EDFilter { +class MuonPtFilter : public edm::stream::EDFilter<> { public: /// Constructor MuonPtFilter(const edm::ParameterSet &); diff --git a/DPGAnalysis/Skims/interface/PhysDecl.h b/DPGAnalysis/Skims/interface/PhysDecl.h index 0cfed4703c990..98062df9abe5c 100644 --- a/DPGAnalysis/Skims/interface/PhysDecl.h +++ b/DPGAnalysis/Skims/interface/PhysDecl.h @@ -17,7 +17,7 @@ // user include files #include "FWCore/Utilities/interface/InputTag.h" #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDFilter.h" +#include "FWCore/Framework/interface/one/EDFilter.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" @@ -31,7 +31,7 @@ // class declaration // -class PhysDecl : public edm::EDFilter { +class PhysDecl : public edm::one::EDFilter<> { public: explicit PhysDecl(const edm::ParameterSet &); ~PhysDecl() override; diff --git a/DPGAnalysis/Skims/interface/SelectHFMinBias.h b/DPGAnalysis/Skims/interface/SelectHFMinBias.h index 6176bbdf3848c..a5abfe139568f 100644 --- a/DPGAnalysis/Skims/interface/SelectHFMinBias.h +++ b/DPGAnalysis/Skims/interface/SelectHFMinBias.h @@ -17,20 +17,17 @@ // user include files #include "FWCore/Utilities/interface/InputTag.h" #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDFilter.h" +#include "FWCore/Framework/interface/stream/EDFilter.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "DataFormats/TrackReco/interface/Track.h" -#include "DataFormats/TrackReco/interface/TrackFwd.h" // // class declaration // -class SelectHFMinBias : public edm::EDFilter { +class SelectHFMinBias : public edm::stream::EDFilter<> { public: explicit SelectHFMinBias(const edm::ParameterSet &); ~SelectHFMinBias() override; diff --git a/DPGAnalysis/Skims/interface/TagProbeMassEDMFilter.h b/DPGAnalysis/Skims/interface/TagProbeMassEDMFilter.h index a2eb52c657304..83c16a601c395 100644 --- a/DPGAnalysis/Skims/interface/TagProbeMassEDMFilter.h +++ b/DPGAnalysis/Skims/interface/TagProbeMassEDMFilter.h @@ -24,7 +24,7 @@ // user include files #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDFilter.h" +#include "FWCore/Framework/interface/one/EDFilter.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/MakerMacros.h" @@ -35,7 +35,7 @@ // class declaration // -class TagProbeMassEDMFilter : public edm::EDFilter { +class TagProbeMassEDMFilter : public edm::one::EDFilter<> { public: explicit TagProbeMassEDMFilter(const edm::ParameterSet&); ~TagProbeMassEDMFilter() override; diff --git a/DPGAnalysis/Skims/interface/TagProbeMassProducer.h b/DPGAnalysis/Skims/interface/TagProbeMassProducer.h index 468ff474d793f..26caba3bf5143 100644 --- a/DPGAnalysis/Skims/interface/TagProbeMassProducer.h +++ b/DPGAnalysis/Skims/interface/TagProbeMassProducer.h @@ -24,22 +24,20 @@ // user include files #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDProducer.h" +#include "FWCore/Framework/interface/stream/EDProducer.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "DataFormats/Candidate/interface/CandidateFwd.h" // forward declarations -class TagProbeMassProducer : public edm::EDProducer { +class TagProbeMassProducer : public edm::stream::EDProducer<> { public: explicit TagProbeMassProducer(const edm::ParameterSet&); ~TagProbeMassProducer() override; private: - void beginJob() override; void produce(edm::Event&, const edm::EventSetup&) override; - void endJob() override; bool isPassingProbe(const unsigned int iprobe) const; diff --git a/DPGAnalysis/Skims/src/CSCSkim.cc b/DPGAnalysis/Skims/src/CSCSkim.cc index 4762965ac2bae..9e91ded30c630 100644 --- a/DPGAnalysis/Skims/src/CSCSkim.cc +++ b/DPGAnalysis/Skims/src/CSCSkim.cc @@ -48,7 +48,7 @@ using namespace edm; //=================== // CONSTRUCTOR //=================== -CSCSkim::CSCSkim(const edm::ParameterSet& pset) { +CSCSkim::CSCSkim(const edm::ParameterSet& pset) : m_CSCGeomToken(esConsumes()) { // tokens from tags // Really should define the wire and digi tags in config, but for now, to avoid having to modify @@ -222,8 +222,7 @@ bool CSCSkim::filter(edm::Event& event, const edm::EventSetup& eventSetup) { LogDebug("[CSCSkim] EventInfo") << "Run: " << iRun << "\tEvent: " << iEvent << "\tn Analyzed: " << nEventsAnalyzed; // Get the CSC Geometry : - ESHandle cscGeom; - eventSetup.get().get(cscGeom); + ESHandle cscGeom = eventSetup.getHandle(m_CSCGeomToken); // Get the DIGI collections edm::Handle wires; diff --git a/DPGAnalysis/Skims/src/DetStatus.cc b/DPGAnalysis/Skims/src/DetStatus.cc index 36cd5a432dbd3..3ce8232333cf8 100644 --- a/DPGAnalysis/Skims/src/DetStatus.cc +++ b/DPGAnalysis/Skims/src/DetStatus.cc @@ -70,7 +70,7 @@ DetStatus::DetStatus(const edm::ParameterSet& pset) { // // -- Destructor // -DetStatus::~DetStatus() {} +DetStatus::~DetStatus() = default; //*********************************************************************// bool DetStatus::checkForDCSStatus(const DcsStatusCollection& dcsStatus) @@ -116,9 +116,15 @@ bool DetStatus::checkForDCSRecord(const DCSRecord& dcsRecord) } for (unsigned int detlist = 0; detlist < DcsStatus::nPartitions; detlist++) { + if (verbose_) + edm::LogInfo("DetStatus") << "testing " << DcsStatus::partitionName[detlist]; if (requestedPartitions_.test(detlist)) { + if (verbose_) + edm::LogInfo("DetStatus") << " " << DcsStatus::partitionName[detlist] << "in the requested list" << std::endl; if (AndOr_) { - accepted = (accepted & dcsRecord.highVoltageReady(detlist)); + accepted = dcsRecord.highVoltageReady(detlist); + if (!accepted) + break; } else { accepted = (accepted || dcsRecord.highVoltageReady(detlist)); } @@ -126,7 +132,7 @@ bool DetStatus::checkForDCSRecord(const DCSRecord& dcsRecord) } if (verbose_) { - edm::LogInfo("DetStatus") << "DCSStatus filter: " << accepted << "( AndOr: " << AndOr_ << ")" << std::endl; + edm::LogInfo("DetStatus") << "DCSStatus filter: " << accepted << " ( AndOr: " << AndOr_ << ")" << std::endl; edm::LogVerbatim("DetStatus") << "Partitions ON: "; for (unsigned int detlist = 0; detlist < DcsStatus::nPartitions; detlist++) { if ((dcsRecord.highVoltageReady(detlist))) { @@ -154,11 +160,12 @@ bool DetStatus::filter(edm::Event& evt, edm::EventSetup const& es) edm::Handle dcsRecord; evt.getByToken(dcsRecordToken_, dcsRecord); + // if the old style DCS status is valid (Run1 + Run2) if (dcsStatus.isValid() && !dcsStatus->empty()) { accepted = checkForDCSStatus(*dcsStatus); } else if (dcsRecord.isValid()) { if (evt.eventAuxiliary().isRealData()) { - // in case of real data check for DCS + // in case of real data check for DCSRecord content (Run >=3) accepted = checkForDCSRecord(*dcsRecord); } else { // in case of MC accept in any case diff --git a/DPGAnalysis/Skims/src/EcalTangentFilter.cc b/DPGAnalysis/Skims/src/EcalTangentFilter.cc index 3586e00025ae1..fd579e64e697e 100644 --- a/DPGAnalysis/Skims/src/EcalTangentFilter.cc +++ b/DPGAnalysis/Skims/src/EcalTangentFilter.cc @@ -49,11 +49,5 @@ bool EcalTangentFilter::filter(edm::Event& iEvent, const edm::EventSetup& iSetup return goodEvent; } -// ------------ method called once each job just before starting event loop ------------ -void EcalTangentFilter::beginJob() {} - -// ------------ method called once each job just after ending the event loop ------------ -void EcalTangentFilter::endJob() {} - //define this as a plug-in DEFINE_FWK_MODULE(EcalTangentFilter); diff --git a/DPGAnalysis/Skims/src/HCALHighEnergyFilter.cc b/DPGAnalysis/Skims/src/HCALHighEnergyFilter.cc index 696e100c9cfde..9b0875b0859cd 100644 --- a/DPGAnalysis/Skims/src/HCALHighEnergyFilter.cc +++ b/DPGAnalysis/Skims/src/HCALHighEnergyFilter.cc @@ -22,7 +22,7 @@ // user include files #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDFilter.h" +#include "FWCore/Framework/interface/stream/EDFilter.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/MakerMacros.h" @@ -45,15 +45,13 @@ using namespace edm; //using namespace l1extra; -class HCALHighEnergyFilter : public edm::EDFilter { +class HCALHighEnergyFilter : public edm::stream::EDFilter<> { public: explicit HCALHighEnergyFilter(const edm::ParameterSet&); ~HCALHighEnergyFilter() override; private: - void beginJob() override; bool filter(edm::Event&, const edm::EventSetup&) override; - void endJob() override; // bool jetGood(L1JetParticleCollection::const_iterator &); bool jetGood(reco::CaloJetCollection::const_iterator&); // ----------member data --------------------------- @@ -134,11 +132,5 @@ bool HCALHighEnergyFilter::filter(edm::Event& iEvent, const edm::EventSetup& iSe return false; } -// ------------ method called once each job just before starting event loop ------------ -void HCALHighEnergyFilter::beginJob() {} - -// ------------ method called once each job just after ending the event loop ------------ -void HCALHighEnergyFilter::endJob() {} - //define this as a plug-in DEFINE_FWK_MODULE(HCALHighEnergyFilter); diff --git a/DPGAnalysis/Skims/src/HcalHPDFilter.cc b/DPGAnalysis/Skims/src/HcalHPDFilter.cc index 1ce6f455727f3..2780cd2509305 100644 --- a/DPGAnalysis/Skims/src/HcalHPDFilter.cc +++ b/DPGAnalysis/Skims/src/HcalHPDFilter.cc @@ -22,7 +22,7 @@ // user include files #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDFilter.h" +#include "FWCore/Framework/interface/stream/EDFilter.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/MakerMacros.h" @@ -35,27 +35,17 @@ // class declaration // -class HcalHPDFilter : public edm::EDFilter { +class HcalHPDFilter : public edm::stream::EDFilter<> { public: explicit HcalHPDFilter(const edm::ParameterSet&); ~HcalHPDFilter() override; private: - void beginJob() override; bool filter(edm::Event&, const edm::EventSetup&) override; - void endJob() override; // ----------member data --------------------------- }; -// -// constants, enums and typedefs -// - -// -// static data member definitions -// - // // constructors and destructor // @@ -84,11 +74,5 @@ bool HcalHPDFilter::filter(edm::Event& iEvent, const edm::EventSetup& iSetup) { return false; } -// ------------ method called once each job just before starting event loop ------------ -void HcalHPDFilter::beginJob() {} - -// ------------ method called once each job just after ending the event loop ------------ -void HcalHPDFilter::endJob() {} - //define this as a plug-in DEFINE_FWK_MODULE(HcalHPDFilter); diff --git a/DPGAnalysis/Skims/src/NMaxPerLumi.cc b/DPGAnalysis/Skims/src/NMaxPerLumi.cc index 89426ad92f6a5..bb39fddeb753e 100644 --- a/DPGAnalysis/Skims/src/NMaxPerLumi.cc +++ b/DPGAnalysis/Skims/src/NMaxPerLumi.cc @@ -22,7 +22,7 @@ // user include files #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDFilter.h" +#include "FWCore/Framework/interface/stream/EDFilter.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/MakerMacros.h" @@ -33,15 +33,13 @@ // class declaration // -class NMaxPerLumi : public edm::EDFilter { +class NMaxPerLumi : public edm::stream::EDFilter<> { public: explicit NMaxPerLumi(const edm::ParameterSet&); ~NMaxPerLumi() override; private: - void beginJob() override; bool filter(edm::Event&, const edm::EventSetup&) override; - void endJob() override; // ----------member data --------------------------- std::map > counters; @@ -86,11 +84,5 @@ bool NMaxPerLumi::filter(edm::Event& iEvent, const edm::EventSetup& iSetup) { } } -// ------------ method called once each job just before starting event loop ------------ -void NMaxPerLumi::beginJob() {} - -// ------------ method called once each job just after ending the event loop ------------ -void NMaxPerLumi::endJob() {} - //define this as a plug-in DEFINE_FWK_MODULE(NMaxPerLumi); diff --git a/DPGAnalysis/Skims/src/PickEvents.cc b/DPGAnalysis/Skims/src/PickEvents.cc index 850f09c0853f0..1ce402347a99d 100644 --- a/DPGAnalysis/Skims/src/PickEvents.cc +++ b/DPGAnalysis/Skims/src/PickEvents.cc @@ -32,7 +32,7 @@ // user include files #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDFilter.h" +#include "FWCore/Framework/interface/one/EDFilter.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/MakerMacros.h" @@ -51,7 +51,7 @@ bool orderLuminosityBlockRange(edm::LuminosityBlockRange u, edm::LuminosityBlock // class declaration // -class PickEvents : public edm::EDFilter { +class PickEvents : public edm::one::EDFilter<> { public: explicit PickEvents(const edm::ParameterSet&); ~PickEvents() override; diff --git a/DPGAnalysis/Skims/src/RPCNoise.cc b/DPGAnalysis/Skims/src/RPCNoise.cc index 88ea0a3255791..cb49f4efc96ae 100644 --- a/DPGAnalysis/Skims/src/RPCNoise.cc +++ b/DPGAnalysis/Skims/src/RPCNoise.cc @@ -28,7 +28,7 @@ // user include files #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDFilter.h" +#include "FWCore/Framework/interface/one/EDFilter.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/MakerMacros.h" @@ -84,7 +84,7 @@ using namespace edm; // class declaration // -class RPCNoise : public edm::EDFilter { +class RPCNoise : public edm::one::EDFilter<> { public: explicit RPCNoise(const edm::ParameterSet &); ~RPCNoise() override; diff --git a/DPGAnalysis/Skims/src/RPCRecHitFilter.cc b/DPGAnalysis/Skims/src/RPCRecHitFilter.cc index 513313cd53a9e..138a0580f5a4e 100644 --- a/DPGAnalysis/Skims/src/RPCRecHitFilter.cc +++ b/DPGAnalysis/Skims/src/RPCRecHitFilter.cc @@ -4,11 +4,8 @@ // #include "DPGAnalysis/Skims/src/RPCRecHitFilter.h" -//#include "../interface/RecHitFilter.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" -//#include "DataFormats/RPCDigi/interface/RPCDigi.h" -//#include "DataFormats/RPCDigi/interface/RPCDigiCollection.h" #include "FWCore/Framework/interface/Frameworkfwd.h" #include "FWCore/Framework/interface/MakerMacros.h" @@ -17,7 +14,6 @@ #include "DataFormats/RPCRecHit/interface/RPCRecHitCollection.h" #include -#include #include "Geometry/RPCGeometry/interface/RPCGeomServ.h" #include "MagneticField/Engine/interface/MagneticField.h" #include "MagneticField/Records/interface/IdealMagneticFieldRecord.h" @@ -40,14 +36,6 @@ #include "CondFormats/L1TObjects/interface/L1GtParameters.h" #include "CondFormats/DataRecord/interface/L1GtParametersRcd.h" -/*#include "DataFormats/L1Trigger/interface/L1MuonParticleFwd.h" -#include "DataFormats/L1GlobalMuonTrigger/interface/L1MuRegionalCand.h" - -#include "DataFormats/L1GlobalMuonTrigger/interface/L1MuGMTReadoutCollection.h" - -#include "DataFormats/L1GlobalMuonTrigger/interface/L1MuGMTCand.h" -*/ - using namespace reco; typedef std::vector L1MuRegionalCandCollection; @@ -75,12 +63,12 @@ using namespace edm; using namespace reco; using namespace std; -RPCRecHitFilter::RPCRecHitFilter(const edm::ParameterSet& iConfig) { - LogTrace("RPCEffTrackExtrapolation") << "Dentro Costruttore" << std::endl; +RPCRecHitFilter::RPCRecHitFilter(const edm::ParameterSet& iConfig) + : rpcGeomToken_(esConsumes()), trackingGeoToken_(esConsumes()) { + LogTrace("RPCEffTrackExtrapolation") << "inside constructor" << std::endl; - RPCDataLabel = iConfig.getUntrackedParameter("rpcRecHitLabel"); - - // RPCRecHits = iConfig.getParameter< edm::InputTag >("RPCRecHits"); + RPCDataLabel_ = iConfig.getUntrackedParameter("rpcRecHitLabel"); + rpcRecHitToken_ = consumes(edm::InputTag(RPCDataLabel_)); centralBX_ = iConfig.getUntrackedParameter("CentralBunchCrossing", 0); BXWindow_ = iConfig.getUntrackedParameter("BunchCrossingWindow", 9999); @@ -99,14 +87,10 @@ RPCRecHitFilter::RPCRecHitFilter(const edm::ParameterSet& iConfig) { } bool RPCRecHitFilter::filter(edm::Event& iEvent, const edm::EventSetup& iSetup) { - edm::ESHandle rpcGeo; - iSetup.get().get(rpcGeo); - - edm::Handle rpcHits; - iEvent.getByLabel(RPCDataLabel, rpcHits); + edm::ESHandle rpcGeo = iSetup.getHandle(rpcGeomToken_); + edm::ESHandle theTrackingGeometry = iSetup.getHandle(trackingGeoToken_); - ESHandle theTrackingGeometry; - iSetup.get().get(theTrackingGeometry); + edm::Handle rpcHits = iEvent.getHandle(rpcRecHitToken_); std::map numberOfRecHitsBarrel; std::map numberOfDigisBarrel; diff --git a/DPGAnalysis/Skims/src/RPCRecHitFilter.h b/DPGAnalysis/Skims/src/RPCRecHitFilter.h index 30a900d8e7a14..bb7d10b21ea88 100644 --- a/DPGAnalysis/Skims/src/RPCRecHitFilter.h +++ b/DPGAnalysis/Skims/src/RPCRecHitFilter.h @@ -42,7 +42,8 @@ #include "TrackingTools/TrajectoryState/interface/TrajectoryStateOnSurface.h" #include "RecoMuon/TransientTrackingRecHit/interface/MuonTransientTrackingRecHit.h" -#include "FWCore/Framework/interface/EDFilter.h" +#include "Geometry/RPCGeometry/interface/RPCGeometry.h" +#include "FWCore/Framework/interface/stream/EDFilter.h" #include "TDirectory.h" #include "TFile.h" @@ -58,7 +59,7 @@ typedef std::vector MeasurementContainer; typedef std::pair DetWithState; typedef std::vector Trajectories; -class RPCRecHitFilter : public edm::EDFilter { +class RPCRecHitFilter : public edm::stream::EDFilter<> { public: explicit RPCRecHitFilter(const edm::ParameterSet &); ~RPCRecHitFilter() override {} @@ -66,7 +67,14 @@ class RPCRecHitFilter : public edm::EDFilter { private: bool filter(edm::Event &, const edm::EventSetup &) override; - std::string RPCDataLabel; + // es token + const edm::ESGetToken rpcGeomToken_; + const edm::ESGetToken trackingGeoToken_; + + // event token + edm::EDGetTokenT rpcRecHitToken_; + + std::string RPCDataLabel_; int centralBX_, BXWindow_, minHits_, hitsInStations_; diff --git a/DPGAnalysis/Skims/src/RecHitEnergyFilter.cc b/DPGAnalysis/Skims/src/RecHitEnergyFilter.cc index 0ecad4a2dcea9..8f5ff55b53de6 100644 --- a/DPGAnalysis/Skims/src/RecHitEnergyFilter.cc +++ b/DPGAnalysis/Skims/src/RecHitEnergyFilter.cc @@ -22,7 +22,7 @@ // user include files #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDFilter.h" +#include "FWCore/Framework/interface/stream/EDFilter.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" @@ -32,15 +32,13 @@ // class declaration // -class RecHitEnergyFilter : public edm::EDFilter { +class RecHitEnergyFilter : public edm::stream::EDFilter<> { public: explicit RecHitEnergyFilter(const edm::ParameterSet&); ~RecHitEnergyFilter() override; private: - void beginJob() override; bool filter(edm::Event&, const edm::EventSetup&) override; - void endJob() override; // RecHit input tags edm::InputTag ebRecHitsTag_; @@ -103,11 +101,5 @@ bool RecHitEnergyFilter::filter(edm::Event& evt, const edm::EventSetup& iSetup) return false; } -// ------------ method called once each job just before starting event loop ------------ -void RecHitEnergyFilter::beginJob() {} - -// ------------ method called once each job just after ending the event loop ------------ -void RecHitEnergyFilter::endJob() {} - //define this as a plug-in DEFINE_FWK_MODULE(RecHitEnergyFilter); diff --git a/DPGAnalysis/Skims/src/SecondaryVertexFilter.cc b/DPGAnalysis/Skims/src/SecondaryVertexFilter.cc index e0782f0d8c74e..5b25597186137 100644 --- a/DPGAnalysis/Skims/src/SecondaryVertexFilter.cc +++ b/DPGAnalysis/Skims/src/SecondaryVertexFilter.cc @@ -22,7 +22,7 @@ // user include files #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDFilter.h" +#include "FWCore/Framework/interface/stream/EDFilter.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/MakerMacros.h" @@ -36,7 +36,7 @@ // class declaration // -class SecondaryVertexFilter : public edm::EDFilter { +class SecondaryVertexFilter : public edm::stream::EDFilter<> { public: explicit SecondaryVertexFilter(const edm::ParameterSet&); ~SecondaryVertexFilter() override; diff --git a/DPGAnalysis/Skims/src/SelectHFMinBias.cc b/DPGAnalysis/Skims/src/SelectHFMinBias.cc index fa6eea0b1d291..b1728ee558fdc 100644 --- a/DPGAnalysis/Skims/src/SelectHFMinBias.cc +++ b/DPGAnalysis/Skims/src/SelectHFMinBias.cc @@ -15,11 +15,9 @@ #include "FWCore/Utilities/interface/InputTag.h" #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDFilter.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "DPGAnalysis/Skims/interface/SelectHFMinBias.h" diff --git a/DPGAnalysis/Skims/src/SimpleJetFilter.cc b/DPGAnalysis/Skims/src/SimpleJetFilter.cc index 3e8654921b583..3a519c25ce9ed 100644 --- a/DPGAnalysis/Skims/src/SimpleJetFilter.cc +++ b/DPGAnalysis/Skims/src/SimpleJetFilter.cc @@ -22,7 +22,7 @@ // user include files #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDFilter.h" +#include "FWCore/Framework/interface/stream/EDFilter.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/MakerMacros.h" @@ -45,15 +45,13 @@ // class declaration // -class SimpleJetFilter : public edm::EDFilter { +class SimpleJetFilter : public edm::stream::EDFilter<> { public: explicit SimpleJetFilter(const edm::ParameterSet&); ~SimpleJetFilter() override; private: - void beginJob() override; bool filter(edm::Event&, const edm::EventSetup&) override; - void endJob() override; // ----------member data --------------------------- @@ -65,14 +63,6 @@ class SimpleJetFilter : public edm::EDFilter { JetIDSelectionFunctor m_jetIDfunc; }; -// -// constants, enums and typedefs -// - -// -// static data member definitions -// - // // constructors and destructor // @@ -139,11 +129,5 @@ bool SimpleJetFilter::filter(edm::Event& iEvent, const edm::EventSetup& iSetup) return selected; } -// ------------ method called once each job just before starting event loop ------------ -void SimpleJetFilter::beginJob() {} - -// ------------ method called once each job just after ending the event loop ------------ -void SimpleJetFilter::endJob() {} - //define this as a plug-in DEFINE_FWK_MODULE(SimpleJetFilter); diff --git a/DPGAnalysis/Skims/src/TagProbeMassProducer.cc b/DPGAnalysis/Skims/src/TagProbeMassProducer.cc index ab5b84bae6e1d..69f86ea8a2387 100644 --- a/DPGAnalysis/Skims/src/TagProbeMassProducer.cc +++ b/DPGAnalysis/Skims/src/TagProbeMassProducer.cc @@ -119,12 +119,6 @@ void TagProbeMassProducer::produce(edm::Event& iEvent, const edm::EventSetup& iS iEvent.put(std::move(TPmass), "TPmass"); } -// ------------ method called once each job just before starting event loop ------------ -void TagProbeMassProducer::beginJob() {} - -// ------------ method called once each job just after ending the event loop ------------ -void TagProbeMassProducer::endJob() {} - bool TagProbeMassProducer::isPassingProbe(const unsigned int iProbe) const { if (iProbe > probes->size()) return false; diff --git a/DPGAnalysis/Skims/src/WZInterestingEventSelector.cc b/DPGAnalysis/Skims/src/WZInterestingEventSelector.cc index 355428018afe6..f6bb4da82a547 100644 --- a/DPGAnalysis/Skims/src/WZInterestingEventSelector.cc +++ b/DPGAnalysis/Skims/src/WZInterestingEventSelector.cc @@ -14,7 +14,7 @@ #include // user include files #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDFilter.h" +#include "FWCore/Framework/interface/one/EDFilter.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/MakerMacros.h" @@ -41,7 +41,7 @@ using namespace reco; -class WZInterestingEventSelector : public edm::EDFilter { +class WZInterestingEventSelector : public edm::one::EDFilter<> { public: struct event { long run; diff --git a/DQM/BeamMonitor/plugins/BeamMonitor.cc b/DQM/BeamMonitor/plugins/BeamMonitor.cc index 3471760327667..8728e4907dad7 100644 --- a/DQM/BeamMonitor/plugins/BeamMonitor.cc +++ b/DQM/BeamMonitor/plugins/BeamMonitor.cc @@ -88,6 +88,13 @@ void BeamMonitor::formatFitTime(char* ts, const time_t& t) { static constexpr int buffTime = 23; +std::string BeamMonitor::getGMTstring(const time_t& timeToConvert) { + char buff[32]; + std::strftime(buff, sizeof(buff), "%Y.%m.%d %H:%M:%S GMT", gmtime(&timeToConvert)); + std::string timeStr(buff); + return timeStr; +} + // // constructors and destructor // @@ -1348,7 +1355,7 @@ void BeamMonitor::FitAndFill(const LuminosityBlock& lumiSeg, int& lastlumi, int& // Create the BeamSpotOnlineObjects object BeamSpotOnlineObjects* BSOnline = new BeamSpotOnlineObjects(); - BSOnline->SetLastAnalyzedLumi(fitLS.second); + BSOnline->SetLastAnalyzedLumi(LSRange.second); BSOnline->SetLastAnalyzedRun(theBeamFitter->getRunNumber()); BSOnline->SetLastAnalyzedFill(0); // To be updated with correct LHC Fill number BSOnline->SetPosition(bs.x0(), bs.y0(), bs.z0()); @@ -1370,11 +1377,23 @@ void BeamMonitor::FitAndFill(const LuminosityBlock& lumiSeg, int& lastlumi, int& } BSOnline->SetNumTracks(theBeamFitter->getNTracks()); BSOnline->SetNumPVs(theBeamFitter->getNPVs()); + BSOnline->SetUsedEvents((int)DipPVInfo_[0]); + BSOnline->SetMeanPV(DipPVInfo_[1]); + BSOnline->SetMeanErrorPV(DipPVInfo_[2]); + BSOnline->SetRmsPV(DipPVInfo_[3]); + BSOnline->SetRmsErrorPV(DipPVInfo_[4]); + BSOnline->SetMaxPVs((int)DipPVInfo_[5]); auto creationTime = std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()) .count(); BSOnline->SetCreationTime(creationTime); + std::pair timeForDIP = theBeamFitter->getRefTime(); + BSOnline->SetStartTimeStamp(timeForDIP.first); + BSOnline->SetStartTime(getGMTstring(timeForDIP.first)); + BSOnline->SetEndTimeStamp(timeForDIP.second); + BSOnline->SetEndTime(getGMTstring(timeForDIP.second)); + edm::LogInfo("BeamMonitor") << "FitAndFill::[PayloadCreation] BeamSpotOnline object created: \n" << std::endl; edm::LogInfo("BeamMonitor") << *BSOnline << std::endl; @@ -1385,8 +1404,8 @@ void BeamMonitor::FitAndFill(const LuminosityBlock& lumiSeg, int& lastlumi, int& onlineDbService_->logger().logInfo() << "BeamMonitor::FitAndFill - Do PV Fitting for LS = " << beginLumiOfPVFit_ << " to " << endLumiOfPVFit_; onlineDbService_->logger().logInfo() - << "BeamMonitor::FitAndFill - [BeamFitter] Do BeamSpot Fit for LS = " << fitLS.first << " to " - << fitLS.second; + << "BeamMonitor::FitAndFill - [BeamFitter] Do BeamSpot Fit for LS = " << LSRange.first << " to " + << LSRange.second; onlineDbService_->logger().logInfo() << "BeamMonitor::FitAndFill - [BeamMonitor] Do BeamSpot Fit for LS = " << beginLumiOfBSFit_ << " to " << endLumiOfBSFit_; @@ -1395,17 +1414,28 @@ void BeamMonitor::FitAndFill(const LuminosityBlock& lumiSeg, int& lastlumi, int& onlineDbService_->logger().logInfo() << "BeamMonitor::FitAndFill - [PayloadCreation] BeamSpotOnline object created:"; onlineDbService_->logger().logInfo() << "\n" << *BSOnline; + onlineDbService_->logger().logInfo() << "BeamMonitor - Additional parameters for DIP:"; + onlineDbService_->logger().logInfo() << "Events used in the fit: " << BSOnline->GetUsedEvents(); + onlineDbService_->logger().logInfo() << "Mean PV : " << BSOnline->GetMeanPV(); + onlineDbService_->logger().logInfo() << "Mean PV Error : " << BSOnline->GetMeanErrorPV(); + onlineDbService_->logger().logInfo() << "Rms PV : " << BSOnline->GetRmsPV(); + onlineDbService_->logger().logInfo() << "Rms PV Error : " << BSOnline->GetRmsErrorPV(); + onlineDbService_->logger().logInfo() << "Max PVs : " << BSOnline->GetMaxPVs(); + onlineDbService_->logger().logInfo() << "StartTime : " << BSOnline->GetStartTime(); + onlineDbService_->logger().logInfo() << "StartTimeStamp : " << BSOnline->GetStartTimeStamp(); + onlineDbService_->logger().logInfo() << "EndTime : " << BSOnline->GetEndTime(); + onlineDbService_->logger().logInfo() << "EndTimeStamp : " << BSOnline->GetEndTimeStamp(); onlineDbService_->logger().logInfo() << "BeamMonitor::FitAndFill - [PayloadCreation] onlineDbService available"; onlineDbService_->logger().logInfo() << "BeamMonitor::FitAndFill - [PayloadCreation] SetCreationTime: " << creationTime << " [epoch in microseconds]"; try { - onlineDbService_->writeForNextLumisection(BSOnline, recordName_); + onlineDbService_->writeIOVForNextLumisection(BSOnline, recordName_); onlineDbService_->logger().logInfo() << "BeamMonitor::FitAndFill - [PayloadCreation] writeForNextLumisection executed correctly"; } catch (const std::exception& e) { onlineDbService_->logger().logError() << "BeamMonitor - Error writing record: " << recordName_ - << " for Run: " << frun << " - Lumi: " << fitLS.second; + << " for Run: " << frun << " - Lumi: " << LSRange.second; onlineDbService_->logger().logError() << "Error is: " << e.what(); onlineDbService_->logger().logError() << "RESULTS OF DEFAULT FIT WAS:"; onlineDbService_->logger().logError() << "\n" << bs; diff --git a/DQM/BeamMonitor/plugins/BeamMonitor.h b/DQM/BeamMonitor/plugins/BeamMonitor.h index 4fbd758c06edc..e8d22e40eec9a 100644 --- a/DQM/BeamMonitor/plugins/BeamMonitor.h +++ b/DQM/BeamMonitor/plugins/BeamMonitor.h @@ -55,6 +55,8 @@ class BeamMonitor : public DQMOneEDAnalyzer { void scrollTH1(TH1*, std::time_t); bool testScroll(std::time_t&, std::time_t&); void formatFitTime(char*, const std::time_t&); + std::string getGMTstring(const std::time_t&); + const int dxBin_; const double dxMin_; const double dxMax_; diff --git a/DQM/BeamMonitor/plugins/BeamSpotDipServer.cc b/DQM/BeamMonitor/plugins/BeamSpotDipServer.cc new file mode 100644 index 0000000000000..bcb6d6ec84d2b --- /dev/null +++ b/DQM/BeamMonitor/plugins/BeamSpotDipServer.cc @@ -0,0 +1,775 @@ +#include "DQM/BeamMonitor/plugins/BeamSpotDipServer.h" + +#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/Framework/interface/LuminosityBlock.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" +#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" + +#include +#include +#include +#include + +#include "Dip.h" +#include "DipFactory.h" +#include "DipPublication.h" +#include "DipTimestamp.h" + +using namespace std; + +/*****************************************************************************/ +class ErrHandler : public DipPublicationErrorHandler { +public: + virtual ~ErrHandler() = default; + +private: + void handleException(DipPublication* publication, DipException& e) override { + edm::LogError("BeamSpotDipServer") << "exception (create): " << e.what(); + } +}; + +/*****************************************************************************/ +BeamSpotDipServer::BeamSpotDipServer(const edm::ParameterSet& ps) { + // + verbose = ps.getUntrackedParameter("verbose"); + testing = ps.getUntrackedParameter("testing"); + + subjectCMS = ps.getUntrackedParameter("subjectCMS"); + subjectLHC = ps.getUntrackedParameter("subjectLHC"); + subjectPV = ps.getUntrackedParameter("subjectPV"); + + readFromNFS = ps.getUntrackedParameter("readFromNFS"); + // only if readFromNFS = true + sourceFile = ps.getUntrackedParameter("sourceFile"); // beamspot + sourceFile1 = ps.getUntrackedParameter("sourceFile1"); // tk status + + timeoutLS = ps.getUntrackedParameter>("timeoutLS"); + + // + bsLegacyToken_ = esConsumes(); + + dcsRecordInputTag_ = ps.getParameter("dcsRecordInputTag"); + dcsRecordToken_ = consumes(dcsRecordInputTag_); + + // + dip = Dip::create("CmsBeamSpotServer"); + edm::LogInfo("BeamSpotDipServer") << "reading from " << (readFromNFS ? "file (NFS)" : "database"); +} + +/*****************************************************************************/ +void BeamSpotDipServer::bookHistograms(DQMStore::IBooker&, const edm::Run&, const edm::EventSetup&) { + // do nothing +} + +/*****************************************************************************/ +void BeamSpotDipServer::dqmBeginRun(const edm::Run& r, const edm::EventSetup&) { + edm::LogInfo("BeamSpotDipServer") << "begin run " << r.run(); + + try { + ErrHandler errHandler; + + edm::LogInfo("BeamSpotDipServer") << "server started at " + getDateTime(); + + edm::LogInfo("BeamSpotDipServer") << "creating publication " + subjectCMS; + publicationCMS = dip->createDipPublication(subjectCMS.c_str(), &errHandler); + messageCMS = dip->createDipData(); + + edm::LogInfo("BeamSpotDipServer") << "creating publication " + subjectLHC; + publicationLHC = dip->createDipPublication(subjectLHC.c_str(), &errHandler); + messageLHC = dip->createDipData(); + + edm::LogInfo("BeamSpotDipServer") << "creating publication " + subjectPV; + publicationPV = dip->createDipPublication(subjectPV.c_str(), &errHandler); + messagePV = dip->createDipData(); + + trueRcd(); // starts with all 0 + publishRcd("UNINITIALIZED", "", true, false); + } catch (exception& e) { + edm::LogError("BeamSpotDipServer") << "exception (start up): " << e.what(); + } + + quality = qualities[0]; // start with Uncertain +} + +/*****************************************************************************/ +void BeamSpotDipServer::dqmBeginLuminosityBlock(const edm::LuminosityBlock&, const edm::EventSetup&) { + // do nothing +} + +/*****************************************************************************/ +void BeamSpotDipServer::analyze(const edm::Event& iEvent, const edm::EventSetup&) { + if (!readFromNFS) { + // get runnumber + runnum = iEvent.run(); + + // get tracker status if in a new lumisection + int nthlumi = iEvent.luminosityBlock(); + + if (nthlumi > lastlumi) { // check every LS + lastlumi = nthlumi; + + edm::Handle dcsRecord; + iEvent.getByToken(dcsRecordToken_, dcsRecord); + + wholeTrackerOn = + (*dcsRecord).highVoltageReady(DCSRecord::BPIX) && (*dcsRecord).highVoltageReady(DCSRecord::FPIX) && + (*dcsRecord).highVoltageReady(DCSRecord::TIBTID) && (*dcsRecord).highVoltageReady(DCSRecord::TOB) && + (*dcsRecord).highVoltageReady(DCSRecord::TECp) && (*dcsRecord).highVoltageReady(DCSRecord::TECm); + + if (verbose) + edm::LogInfo("BeamSpotDipServer") << "whole tracker on? " << (wholeTrackerOn ? "yes" : "no"); + } + } +} + +/*****************************************************************************/ +void BeamSpotDipServer::dqmEndLuminosityBlock(const edm::LuminosityBlock& lumiSeg, const edm::EventSetup& iSetup) { + edm::LogInfo("BeamSpotDipServer") << "--------------------- end of LS " << lumiSeg.luminosityBlock(); + + try { + if (readFromNFS) { + ifstream logFile(sourceFile); + + if (!logFile.good()) { + edm::LogWarning("BeamSpotDipServer") << "Source File: " + sourceFile + " doesn't exist!"; + problem(); + } else { + lastModTime = getLastTime(sourceFile); + + if (lastFitTime == 0) + lastFitTime = lastModTime; + + if (getFileSize(sourceFile) == 0) { + // source file has zero length + if (lastModTime > lastFitTime) { + string tmp = tkStatus(); + edm::LogInfo("BeamSpotDipServer") << "New run starts. Run number: " << runnum; + if (verbose) + edm::LogInfo("BeamSpotDipServer") << "Initial lastModTime = " + getDateTime(lastModTime); + } + lastFitTime = lastModTime; + } + + if (lastModTime > lastFitTime) { + // source file modified + if (verbose) { + edm::LogInfo("BeamSpotDipServer") << "time of last fit = " + getDateTime(lastFitTime); + edm::LogInfo("BeamSpotDipServer") << "time of current fit = " + getDateTime(lastModTime); + } + lastFitTime = lastModTime; + + // source file length > 0 + if (getFileSize(sourceFile) > 0) { + if (verbose) + edm::LogInfo("BeamSpotDipServer") << "reading record from " + sourceFile; + + if (readRcd(logFile)) { + if (verbose) + edm::LogInfo("BeamSpotDipServer") << "got new record from file"; + + trueRcd(); + alive.reset(); + alive.flip(7); + } else { + if (verbose) + edm::LogInfo("BeamSpotDipServer") << "problem with new record"; + fakeRcd(); + } + + lsCount = 0; + } + } else { + // source file not touched + problem(); + } + } + + logFile.close(); + } else { + edm::ESHandle bsLegacyHandle = iSetup.getHandle(bsLegacyToken_); + auto const& bs = *bsLegacyHandle; + + // from database + if (readRcd(bs)) { + if (verbose) + edm::LogInfo("BeamSpotDipServer") << "got new record from database"; + trueRcd(); + alive.reset(); + alive.flip(7); + } else { + if (verbose) + edm::LogInfo("BeamSpotDipServer") << "problem with new record"; + fakeRcd(); + } + + lsCount = 0; + } + + // quality of the publish results + if (testing) + publishRcd(qualities[0], "Testing", true, true); // Uncertain + else if (quality == qualities[1]) // Bad + publishRcd(quality, "No fit or fit fails", true, true); + else + publishRcd(quality, "", true, true); // Good + } catch (exception& e) { + edm::LogWarning("BeamSpotDipServer") << "io exception (end of lumi): " << e.what(); + }; +} + +/*****************************************************************************/ +void BeamSpotDipServer::dqmEndRun(const edm::Run&, const edm::EventSetup&) { + // destroy publications and data + edm::LogInfo("BeamSpotDipServer") << "destroying publication " + subjectCMS; + dip->destroyDipPublication(publicationCMS); + delete messageCMS; + + edm::LogInfo("BeamSpotDipServer") << "destroying publication " + subjectLHC; + dip->destroyDipPublication(publicationLHC); + delete messageLHC; + + edm::LogInfo("BeamSpotDipServer") << "destroying publication " + subjectPV; + dip->destroyDipPublication(publicationPV); + delete messagePV; +} + +/*****************************************************************************/ +long BeamSpotDipServer::getFileSize(string filename) { + struct stat stat_buf; + int rc = stat(filename.c_str(), &stat_buf); + return (rc == 0 ? stat_buf.st_size : -1); +} + +/*****************************************************************************/ +time_t BeamSpotDipServer::getLastTime(string filename) { + struct stat stat_buf; + int rc = stat(filename.c_str(), &stat_buf); + return (rc == 0 ? stat_buf.st_mtime : -1); +} + +/*****************************************************************************/ +vector BeamSpotDipServer::parse(string line, const string& delimiter) { + vector list; + + size_t pos = 0; + while ((pos = line.find(delimiter)) != string::npos) { + string token = line.substr(0, pos); + + list.push_back(token); + + line.erase(0, pos + delimiter.length()); + } + + list.push_back(line); // remainder + + return list; +} + +/*****************************************************************************/ +string BeamSpotDipServer::tkStatus() { + string outstr; + + if (readFromNFS) { // get from file on /nfs + ifstream logfile(sourceFile1); + + if (!logfile.good() || getFileSize(sourceFile1) == 0) { + // file does not exist or has zero size + outstr = "No CMS Tracker status available. No DAQ/DQM."; + } else { + int nthLnInRcd = 0; + string record; + + try { + string record; + + while (getline(logfile, record)) { + nthLnInRcd++; + vector tmp = parse(record, " "); + + switch (nthLnInRcd) { + case 7: + if (tmp[1].find("Yes") == string::npos) + outstr = "CMS Tracker OFF."; + else + outstr = "CMS not taking data or no beam."; + break; + case 8: + runnum = stoi(tmp[1]); + break; + default: + break; + } + } + } catch (exception& e) { + edm::LogWarning("BeamSpotDipServer") << "exception (tkStatus): " << e.what(); + } + } + + logfile.close(); + } else { + // get from DCS + if (wholeTrackerOn) + outstr = "CMS not taking data or no beam."; + else + outstr = "CMS Tracker OFF."; + } + + return outstr; +} + +/*****************************************************************************/ +void BeamSpotDipServer::problem() { + if (verbose) + edm::LogInfo("BeamSpotDipServer") << "no update | alive = " << alive; + + lsCount++; + + if ((lsCount % timeoutLS[0] == 0) && (lsCount % timeoutLS[1] != 0)) // first time out + { + if (!alive.test(1)) + alive.flip(1); + if (!alive.test(2)) { + if (!alive.test(7)) + fakeRcd(); + else + trueRcd(); + + stringstream warnMsg; + warnMsg << "No new data for " << lsCount << " LS"; + publishRcd("Uncertain", warnMsg.str(), false, false); + } else { + fakeRcd(); + + stringstream warnMsg; + warnMsg << "No new data for " << lsCount << " LS: " << tkStatus(); + publishRcd("Bad", warnMsg.str(), false, false); + } + } else if (lsCount % timeoutLS[1] == 0) // second time out + { + if (!alive.test(2)) + alive.flip(2); + fakeRcd(); + + stringstream warnMsg; + warnMsg << "No new data for " << lsCount << " LS: " << tkStatus(); + publishRcd("Bad", warnMsg.str(), false, false); + } +} + +/*****************************************************************************/ +bool BeamSpotDipServer::readRcd(const BeamSpotOnlineObjects& bs) +// read from database +{ + runnum = bs.GetLastAnalyzedRun(); + + // get from BeamSpotOnlineObject + + try { + startTime = bs.GetStartTime(); + startTimeStamp = bs.GetStartTimeStamp(); + endTime = bs.GetEndTime(); + endTimeStamp = bs.GetEndTimeStamp(); + } catch (exception& e) { + edm::LogWarning("BeamSpotDipServer") << "time variables are not available (readRcd): " << e.what(); + + startTime = bs.GetCreationTime(); + startTimeStamp = bs.GetCreationTime(); + endTime = bs.GetCreationTime(); + endTimeStamp = bs.GetCreationTime(); + } + + try { + lumiRange = bs.GetLumiRange(); + } catch (exception& e) { + edm::LogWarning("BeamSpotDipServer") << "lumirange variable not avaialble (readRcd): " << e.what(); + + lumiRange = to_string(bs.GetLastAnalyzedLumi()); + } + + currentLS = bs.GetLastAnalyzedLumi(); + + type = bs.GetBeamType(); + + if (verbose) + edm::LogInfo("BeamSpotDipServer") << "run: " << runnum << ", LS: " << currentLS << ", time: " << startTime << " " + << startTimeStamp << ", type: " << type; + + if (testing) + quality = qualities[0]; // Uncertain + else if (type >= 2) + quality = qualities[2]; // Good + else + quality = qualities[1]; // Bad + + x = bs.GetX(); + y = bs.GetY(); + z = bs.GetZ(); + + sigma_z = bs.GetSigmaZ(); + dxdz = bs.Getdxdz(); + dydz = bs.Getdydz(); + width_x = bs.GetBeamWidthX(); + width_y = bs.GetBeamWidthX(); + + err_x = bs.GetXError(); + err_y = bs.GetYError(); + err_z = bs.GetZError(); + err_sigma_z = bs.GetSigmaZError(); + err_dxdz = bs.GetdxdzError(); + err_dydz = bs.GetdydzError(); + err_width_x = bs.GetBeamWidthXError(); + err_width_y = bs.GetBeamWidthYError(); + + try { + events = bs.GetUsedEvents(); + meanPV = bs.GetMeanPV(); + err_meanPV = bs.GetMeanErrorPV(); + rmsPV = bs.GetRmsPV(); + err_rmsPV = bs.GetRmsErrorPV(); + maxPV = bs.GetMaxPVs(); + } catch (exception& e) { + edm::LogWarning("BeamSpotDipServer") << "PV variables are not available (readRcd): " << e.what(); + + events = 0.; + meanPV = 0.; + err_meanPV = 0.; + rmsPV = 0.; + err_rmsPV = 0.; + maxPV = 0.; + } + + nPV = bs.GetNumPVs(); + + if (verbose) + edm::LogInfo("BeamSpotDipServer") << "pos: (" << x << "," << y << "," << z << ")" + << " nPV: " << nPV; + + return true; +} + +/*****************************************************************************/ +bool BeamSpotDipServer::readRcd(ifstream& file) // readFromNFS +{ + int nthLnInRcd = 0; + bool rcdQlty = false; + + try { + string record; + while (getline(file, record)) { + nthLnInRcd++; + + vector tmp = parse(record, " "); + + switch (nthLnInRcd) { + case 1: + if (record.rfind("Run", 0) != 0) { + edm::LogError("BeamSpotDipServer") << "Reading of results text file interrupted. " + getDateTime(); + return false; + } + runnum = stoi(tmp[1]); + break; + case 2: + startTime = tmp[1] + " " + tmp[2] + " " + tmp[3]; + startTimeStamp = stol(tmp[4]); + break; + case 3: + endTime = tmp[1] + " " + tmp[2] + " " + tmp[3]; + endTimeStamp = stol(tmp[4]); + break; + case 4: + lumiRange = record.substr(10); + if (verbose) + edm::LogInfo("BeamSpotDipServer") << "lumisection range: " + lumiRange; + currentLS = stoi(tmp[3]); + break; + case 5: + type = stoi(tmp[1]); + if (testing) + quality = qualities[0]; // Uncertain + else if (type >= 2) + quality = qualities[2]; // Good + else + quality = qualities[1]; // Bad + break; + + case 6: + x = stof(tmp[1]); + break; + case 7: + y = stof(tmp[1]); + break; + case 8: + z = stof(tmp[1]); + break; + + case 9: + sigma_z = stof(tmp[1]); + break; + case 10: + dxdz = stof(tmp[1]); + break; + case 11: + dydz = stof(tmp[1]); + break; + case 12: + width_x = stof(tmp[1]); + break; + case 13: + width_y = stof(tmp[1]); + break; + + case 14: + err_x = sqrt(stof(tmp[1])); + break; + case 15: + err_y = sqrt(stof(tmp[2])); + break; + case 16: + err_z = sqrt(stof(tmp[3])); + break; + case 17: + err_sigma_z = sqrt(stof(tmp[4])); + break; + case 18: + err_dxdz = sqrt(stof(tmp[5])); + break; + case 19: + err_dydz = sqrt(stof(tmp[6])); + break; + case 20: + err_width_x = sqrt(stof(tmp[7])); + err_width_y = err_width_x; + break; + case 21: + break; + case 22: + break; + case 23: + break; + case 24: + events = stoi(tmp[1]); + break; + + case 25: + meanPV = stof(tmp[1]); + break; + case 26: + err_meanPV = stof(tmp[1]); + break; + case 27: + rmsPV = stof(tmp[1]); + break; + case 28: + err_rmsPV = stof(tmp[1]); + break; + case 29: + maxPV = stoi(tmp[1]); + break; + case 30: + nPV = stoi(tmp[1]); + rcdQlty = true; + break; + + default: + break; + } + } + + file.close(); + } catch (exception& e) { + edm::LogWarning("BeamSpotDipServer") << "io exception (readRcd): " << e.what(); + } + + return rcdQlty; +} + +/*****************************************************************************/ +void BeamSpotDipServer::CMS2LHCRF_POS(float x, float y, float z) { + if (x != 0) { // Rotation + Translation + Inversion + Scaling + double tmpx = x; + // x*rotY[0]*rotZ[0] + y*rotY[0]*rotZ[1] - z*rotY[1] + trans[0]; + Centroid[0] = tmpx; + Centroid[0] *= -1.0 * cm2um; + } else + Centroid[0] = x; + + if (y != 0) { // Rotation + Translation + Scaling + double tmpy = y; + // x*(rotX[1]*rotY[1]*rotZ[0] - rotX[0]*rotZ[1]) + + // y*(rotX[0]*rotZ[0] + rotX[1]*rotY[1]*rotZ[1]) + + // z*rotX[1]*rotY[0] + trans[1]; + Centroid[1] = tmpy; + Centroid[1] *= cm2um; + } else + Centroid[1] = y; + + if (z != 0) { // Rotation + Translation + Inversion + Scaling + double tmpz = z; + // x*(rotX[0]*rotY[1]*rotZ[0] + rotX[1]*rotZ[1]) + + // y*(rotX[0]*rotY[1]*rotZ[1] - rotX[1]*rotZ[0]) + + // z*rotX[0]*rotY[0] + trans[2]; + Centroid[2] = tmpz; + Centroid[2] *= -1.0 * cm2mm; + } else + Centroid[2] = z; +} + +/*****************************************************************************/ +void BeamSpotDipServer::trueRcd() { + try { + // CMS to LHC RF + CMS2LHCRF_POS(x, y, z); + + Tilt[0] = dxdz * rad2urad; + Tilt[1] = (dydz != 0 ? (dydz * -1 * rad2urad) : 0); + + Size[0] = width_x * cm2um; + Size[1] = width_y * cm2um; + Size[2] = sigma_z * cm2mm; + + // CMS + messageCMS->insert(runnum, "runnum"); + messageCMS->insert(startTime, "startTime"); + messageCMS->insert(endTime, "endTime"); + messageCMS->insert(startTimeStamp, "startTimeStamp"); + messageCMS->insert(endTimeStamp, "endTimeStamp"); + messageCMS->insert(lumiRange, "lumiRange"); + messageCMS->insert(quality, "quality"); + messageCMS->insert(type, "type"); // Unknown=-1, Fake=0, Tracker=2(Good) + messageCMS->insert(x, "x"); + messageCMS->insert(y, "y"); + messageCMS->insert(z, "z"); + messageCMS->insert(dxdz, "dxdz"); + messageCMS->insert(dydz, "dydz"); + messageCMS->insert(width_x, "width_x"); + messageCMS->insert(width_y, "width_y"); + messageCMS->insert(sigma_z, "sigma_z"); + + if (publishStatErrors) { + messageCMS->insert(err_x, "err_x"); + messageCMS->insert(err_y, "err_y"); + messageCMS->insert(err_z, "err_z"); + messageCMS->insert(err_dxdz, "err_dxdz"); + messageCMS->insert(err_dydz, "err_dydz"); + messageCMS->insert(err_width_x, "err_width_x"); + messageCMS->insert(err_width_y, "err_width_y"); + messageCMS->insert(err_sigma_z, "err_sigma_z"); + } + + // LHC + messageLHC->insert(Size, 3, "Size"); + messageLHC->insert(Centroid, 3, "Centroid"); + messageLHC->insert(Tilt, 2, "Tilt"); + + // PV + messagePV->insert(runnum, "runnum"); + messagePV->insert(startTime, "startTime"); + messagePV->insert(endTime, "endTime"); + messagePV->insert(startTimeStamp, "startTimeStamp"); + messagePV->insert(endTimeStamp, "endTimeStamp"); + messagePV->insert(lumiRange, "lumiRange"); + messagePV->insert(events, "events"); + messagePV->insert(meanPV, "meanPV"); + messagePV->insert(err_meanPV, "err_meanPV"); + messagePV->insert(rmsPV, "rmsPV"); + messagePV->insert(err_rmsPV, "err_rmsPV"); + messagePV->insert(maxPV, "maxPV"); + messagePV->insert(nPV, "nPV"); + } catch (exception& e) { + edm::LogWarning("BeamSpotDipServer") << "exception (trueRcd): " << e.what(); + } +} + +/*****************************************************************************/ +void BeamSpotDipServer::fakeRcd() { + try { + Centroid[0] = 0; + Centroid[1] = 0; + Centroid[2] = 0; + + Size[0] = 0; + Size[1] = 0; + Size[2] = 0; + + Tilt[0] = 0; + Tilt[1] = 0; + + messageLHC->insert(Size, 3, "Size"); + messageLHC->insert(Centroid, 3, "Centroid"); + messageLHC->insert(Tilt, 2, "Tilt"); + } catch (exception& e) { + edm::LogWarning("BeamSpotDipServer") << "exception (fakeRcd): " << e.what(); + } +} + +/*****************************************************************************/ +void BeamSpotDipServer::publishRcd(string qlty, string err, bool pubCMS, bool fitTime) { + try { + bool updateCMS = pubCMS && (currentLS % intLS == 0); + + if (verbose) { + edm::LogInfo("BeamSpotDipServer") << "sending (" << qlty << " | " << err << ")"; + + if (alive.test(7)) { + if (updateCMS) + edm::LogInfo("BeamSpotDipServer") << " to CCC and CMS"; + else if (!alive.test(1) && !alive.test(2)) + edm::LogInfo("BeamSpotDipServer") << " to CCC only"; + } + } + + DipTimestamp zeit; + if (fitTime) { + long epoch; + epoch = endTimeStamp * 1000; // convert to ms + zeit = DipTimestamp(epoch); + } else + zeit = DipTimestamp(); + + // send + if (updateCMS) + publicationCMS->send(messageCMS, zeit); + + publicationLHC->send(messageLHC, zeit); + publicationPV->send(messagePV, zeit); + + // set qualities + if (qlty == qualities[0]) { // Uncertain + if (updateCMS) + publicationCMS->setQualityUncertain(err.c_str()); + + publicationLHC->setQualityUncertain(err.c_str()); + } else if (qlty == qualities[1]) { // Bad + if (updateCMS) + publicationCMS->setQualityBad(err.c_str()); + + publicationLHC->setQualityBad(err.c_str()); + } else if (qlty == "UNINITIALIZED") { + if (updateCMS) + publicationCMS->setQualityBad("UNINITIALIZED"); + + publicationLHC->setQualityBad("UNINITIALIZED"); + } + } catch (exception& e) { + edm::LogWarning("BeamSpotDipServer") << "exception (publishRcd): " << e.what(); + } +} + +/*****************************************************************************/ +string BeamSpotDipServer::getDateTime(time_t t) { + char mbstr[100]; + strftime(mbstr, sizeof(mbstr), "%Y.%m.%d %H:%M:%S %z", std::localtime(&t)); + + return mbstr; +} + +// +string BeamSpotDipServer::getDateTime() { + time_t t = time(nullptr); + + return getDateTime(t); +} + +DEFINE_FWK_MODULE(BeamSpotDipServer); diff --git a/DQM/BeamMonitor/plugins/BeamSpotDipServer.h b/DQM/BeamMonitor/plugins/BeamSpotDipServer.h new file mode 100644 index 0000000000000..ec1fc3de570b0 --- /dev/null +++ b/DQM/BeamMonitor/plugins/BeamSpotDipServer.h @@ -0,0 +1,151 @@ +#ifndef DQM_BeamMonitor__BeamSpotDipServer_h +#define DQM_BeamMonitor__BeamSpotDipServer_h + +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/Framework/interface/EventSetup.h" + +#include "FWCore/Utilities/interface/ESGetToken.h" + +#include "DataFormats/Scalers/interface/BeamSpotOnline.h" +#include "DataFormats/OnlineMetaData/interface/DCSRecord.h" + +#include "DQMServices/Core/interface/DQMStore.h" +#include "DQMServices/Core/interface/DQMOneEDAnalyzer.h" + +#include "CondFormats/BeamSpotObjects/interface/BeamSpotOnlineObjects.h" +#include "CondFormats/DataRecord/interface/BeamSpotOnlineLegacyObjectsRcd.h" + +#include +#include + +class DipFactory; +class DipData; +class DipPublication; + +class LuminosityBlock; + +class BeamSpotDipServer : public DQMOneLumiEDAnalyzer<> { +public: + explicit BeamSpotDipServer(const edm::ParameterSet&); + +protected: + void bookHistograms(DQMStore::IBooker&, const edm::Run&, const edm::EventSetup&) override; + void dqmBeginRun(const edm::Run& r, const edm::EventSetup&) override; + void analyze(const edm::Event& e, const edm::EventSetup&) override; + void dqmBeginLuminosityBlock(const edm::LuminosityBlock& lumiSeg, const edm::EventSetup&) override; + void dqmEndLuminosityBlock(const edm::LuminosityBlock& lumiSeg, const edm::EventSetup&) override; + void dqmEndRun(const edm::Run&, const edm::EventSetup& iSetup) override; + +private: + long getFileSize(std::string filename); + time_t getLastTime(std::string filename); + + std::vector parse(std::string line, const std::string& delimiter); + std::string tkStatus(); + + bool readRcd(const BeamSpotOnlineObjects& bs); // read from database + bool readRcd(std::ifstream& file); // read from NFS + + void problem(); + void CMS2LHCRF_POS(float x, float y, float z); + + void trueRcd(); + void fakeRcd(); + void publishRcd(std::string qlty, std::string err, bool pubCMS, bool fitTime); + + std::string getDateTime(); + std::string getDateTime(long epoch); + + // constants + const char* qualities[3] = {"Uncertain", "Bad", "Good"}; + const bool publishStatErrors = true; + const int rad2urad = 1000000; + const int cm2um = 10000; + const int cm2mm = 10; + const int intLS = 1; // for CMS scaler + + // variables + long lastFitTime = 0; + long lastModTime = 0; + std::bitset<8> alive; + int lsCount = 0; + int currentLS = 0; + + // DIP objects + DipFactory* dip; + DipData* messageCMS; + DipData* messageLHC; + DipData* messagePV; + DipPublication* publicationCMS; + DipPublication* publicationLHC; + DipPublication* publicationPV; + + // initial values of beamspot object + int runnum; + std::string startTime = getDateTime(); + std::string endTime = getDateTime(); + time_t startTimeStamp = 0; + time_t endTimeStamp = 0; + std::string lumiRange = "0 - 0"; + std::string quality = "Uncertain"; + int type = -1; + float x = 0; + float y = 0; + float z = 0; + float dxdz = 0; + float dydz = 0; + float err_x = 0; + float err_y = 0; + float err_z = 0; + float err_dxdz = 0; + float err_dydz = 0; + float width_x = 0; + float width_y = 0; + float sigma_z = 0; + float err_width_x = 0; + float err_width_y = 0; + float err_sigma_z = 0; + + // added for PV information + int events = 0; + float meanPV = 0; + float err_meanPV = 0; + float rmsPV = 0; + float err_rmsPV = 0; + int maxPV = 0; + int nPV = 0; + + // + float Size[3]; + float Centroid[3]; + float Tilt[2]; + + // tracker status + edm::InputTag dcsRecordInputTag_; + edm::EDGetTokenT dcsRecordToken_; + + int lastlumi = -1; + bool wholeTrackerOn = false; + + // online beamspot + edm::ESGetToken bsLegacyToken_; + + // inputs + bool verbose; + bool testing; + + std::string subjectCMS; + std::string subjectLHC; + std::string subjectPV; + + bool readFromNFS; + + std::string sourceFile; + std::string sourceFile1; + + std::vector timeoutLS; +}; + +#endif diff --git a/DQM/BeamMonitor/plugins/BuildFile.xml b/DQM/BeamMonitor/plugins/BuildFile.xml index 3c22dc071607f..ecd0152d69faa 100644 --- a/DQM/BeamMonitor/plugins/BuildFile.xml +++ b/DQM/BeamMonitor/plugins/BuildFile.xml @@ -53,3 +53,12 @@ + + + + + + + + + diff --git a/DQM/BeamMonitor/plugins/FakeBeamMonitor.cc b/DQM/BeamMonitor/plugins/FakeBeamMonitor.cc index 1d0ec92d83b1b..17fe6c8b0859a 100644 --- a/DQM/BeamMonitor/plugins/FakeBeamMonitor.cc +++ b/DQM/BeamMonitor/plugins/FakeBeamMonitor.cc @@ -89,6 +89,13 @@ void FakeBeamMonitor::formatFitTime(char* ts, const time_t& t) { static constexpr int buffTime = 23; +std::string FakeBeamMonitor::getGMTstring(const time_t& timeToConvert) { + char buff[32]; + std::strftime(buff, sizeof(buff), "%Y.%m.%d %H:%M:%S GMT", gmtime(&timeToConvert)); + std::string timeStr(buff); + return timeStr; +} + // // constructors and destructor // @@ -881,8 +888,8 @@ void FakeBeamMonitor::FitAndFill(const LuminosityBlock& lumiSeg, int& lastlumi, sprintf(tmpTitlePV, "%s %i %s %i", "Num. of reco. vertices for LS: ", beginLumiOfPVFit_, " to ", endLumiOfPVFit_); h_nVtx_st->setAxisTitle(tmpTitlePV, 1); - // std::vector DipPVInfo_; - // DipPVInfo_.clear(); + std::vector DipPVInfo_; + DipPVInfo_.clear(); // // if (countTotPV_ != 0) { // DipPVInfo_.push_back((float)countEvtLastNLS_); @@ -903,6 +910,12 @@ void FakeBeamMonitor::FitAndFill(const LuminosityBlock& lumiSeg, int& lastlumi, // } // } // theBeamFitter->SetPVInfo(DipPVInfo_); + DipPVInfo_.push_back(rndm_->Gaus(1000., 100.)); // Events used + DipPVInfo_.push_back(rndm_->Gaus(100., 10.)); // Mean PV + DipPVInfo_.push_back(rndm_->Gaus(10., 5.)); // Mean PV err + DipPVInfo_.push_back(rndm_->Gaus(10., 5.)); // Rms PV + DipPVInfo_.push_back(rndm_->Gaus(5., 3.)); // Rms PV err + DipPVInfo_.push_back(rndm_->Gaus(100., 10.)); // Max PVs countEvtLastNLS_ = 0; if (onlineMode_) { // filling LS gap @@ -1371,7 +1384,7 @@ void FakeBeamMonitor::FitAndFill(const LuminosityBlock& lumiSeg, int& lastlumi, // Create the BeamSpotOnlineObjects object BeamSpotOnlineObjects* BSOnline = new BeamSpotOnlineObjects(); - BSOnline->SetLastAnalyzedLumi(fitLS.second); + BSOnline->SetLastAnalyzedLumi(LSRange.second); BSOnline->SetLastAnalyzedRun(frun); BSOnline->SetLastAnalyzedFill(0); // To be updated with correct LHC Fill number BSOnline->SetPosition(bs.x0(), bs.y0(), bs.z0()); @@ -1395,10 +1408,23 @@ void FakeBeamMonitor::FitAndFill(const LuminosityBlock& lumiSeg, int& lastlumi, // BSOnline->SetNumPVs(theBeamFitter->getNPVs()); BSOnline->SetNumTracks(50); BSOnline->SetNumPVs(10); + BSOnline->SetUsedEvents((int)DipPVInfo_[0]); + BSOnline->SetMeanPV(DipPVInfo_[1]); + BSOnline->SetMeanErrorPV(DipPVInfo_[2]); + BSOnline->SetRmsPV(DipPVInfo_[3]); + BSOnline->SetRmsErrorPV(DipPVInfo_[4]); + BSOnline->SetMaxPVs((int)DipPVInfo_[5]); auto creationTime = std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(); BSOnline->SetCreationTime(creationTime); + // use fake timestamps from 1970.01.01 00:00:00 to 1970.01.01 00:00:01 GMT + std::pair timeForDIP = std::make_pair(0, 1); + BSOnline->SetStartTimeStamp(timeForDIP.first); + BSOnline->SetStartTime(getGMTstring(timeForDIP.first)); + BSOnline->SetEndTimeStamp(timeForDIP.second); + BSOnline->SetEndTime(getGMTstring(timeForDIP.second)); + edm::LogInfo("FakeBeamMonitor") << "FitAndFill::[PayloadCreation] BeamSpotOnline object created: \n" << std::endl; edm::LogInfo("FakeBeamMonitor") << *BSOnline << std::endl; //std::cout << "------------------> fitted BS: " << *BSOnline << std::endl; @@ -1410,7 +1436,7 @@ void FakeBeamMonitor::FitAndFill(const LuminosityBlock& lumiSeg, int& lastlumi, onlineDbService_->logger().logInfo() << "FakeBeamMonitor::FitAndFill - Do PV Fitting for LS = " << beginLumiOfPVFit_ << " to " << endLumiOfPVFit_; onlineDbService_->logger().logInfo() << "FakeBeamMonitor::FitAndFill - [BeamFitter] Do BeamSpot Fit for LS = " - << fitLS.first << " to " << fitLS.second; + << LSRange.first << " to " << LSRange.second; onlineDbService_->logger().logInfo() << "FakeBeamMonitor::FitAndFill - [FakeBeamMonitor] Do BeamSpot Fit for LS = " << beginLumiOfBSFit_ << " to " << endLumiOfBSFit_; onlineDbService_->logger().logInfo() << "FakeBeamMonitor - RESULTS OF DEFAULT FIT:"; @@ -1418,16 +1444,27 @@ void FakeBeamMonitor::FitAndFill(const LuminosityBlock& lumiSeg, int& lastlumi, onlineDbService_->logger().logInfo() << "FakeBeamMonitor::FitAndFill - [PayloadCreation] BeamSpotOnline object created:"; onlineDbService_->logger().logInfo() << "\n" << *BSOnline; + onlineDbService_->logger().logInfo() << "FakeBeamMonitor - Additional parameters for DIP:"; + onlineDbService_->logger().logInfo() << "Events used in the fit: " << BSOnline->GetUsedEvents(); + onlineDbService_->logger().logInfo() << "Mean PV : " << BSOnline->GetMeanPV(); + onlineDbService_->logger().logInfo() << "Mean PV Error : " << BSOnline->GetMeanErrorPV(); + onlineDbService_->logger().logInfo() << "Rms PV : " << BSOnline->GetRmsPV(); + onlineDbService_->logger().logInfo() << "Rms PV Error : " << BSOnline->GetRmsErrorPV(); + onlineDbService_->logger().logInfo() << "Max PVs : " << BSOnline->GetMaxPVs(); + onlineDbService_->logger().logInfo() << "StartTime : " << BSOnline->GetStartTime(); + onlineDbService_->logger().logInfo() << "StartTimeStamp : " << BSOnline->GetStartTimeStamp(); + onlineDbService_->logger().logInfo() << "EndTime : " << BSOnline->GetEndTime(); + onlineDbService_->logger().logInfo() << "EndTimeStamp : " << BSOnline->GetEndTimeStamp(); onlineDbService_->logger().logInfo() << "FakeBeamMonitor::FitAndFill - [PayloadCreation] onlineDbService available"; onlineDbService_->logger().logInfo() << "FakeBeamMonitor::FitAndFill - [PayloadCreation] SetCreationTime: " << creationTime << " [epoch in microseconds]"; try { - onlineDbService_->writeForNextLumisection(BSOnline, recordName_); + onlineDbService_->writeIOVForNextLumisection(BSOnline, recordName_); onlineDbService_->logger().logInfo() << "FakeBeamMonitor::FitAndFill - [PayloadCreation] writeForNextLumisection executed correctly"; } catch (const std::exception& e) { onlineDbService_->logger().logError() << "FakeBeamMonitor - Error writing record: " << recordName_ - << " for Run: " << frun << " - Lumi: " << fitLS.second; + << " for Run: " << frun << " - Lumi: " << LSRange.second; onlineDbService_->logger().logError() << "Error is: " << e.what(); onlineDbService_->logger().logError() << "RESULTS OF DEFAULT FIT WAS:"; onlineDbService_->logger().logError() << "\n" << bs; diff --git a/DQM/BeamMonitor/plugins/FakeBeamMonitor.h b/DQM/BeamMonitor/plugins/FakeBeamMonitor.h index 934486fbd4ed7..7dac2b214dd56 100644 --- a/DQM/BeamMonitor/plugins/FakeBeamMonitor.h +++ b/DQM/BeamMonitor/plugins/FakeBeamMonitor.h @@ -56,6 +56,7 @@ class FakeBeamMonitor : public DQMOneEDAnalyzer void scrollTH1(TH1*, std::time_t); bool testScroll(std::time_t&, std::time_t&); void formatFitTime(char*, const std::time_t&); + std::string getGMTstring(const std::time_t&); const int dxBin_; const double dxMin_; diff --git a/DQM/BeamMonitor/python/AlcaBeamMonitorHeavyIons_cff.py b/DQM/BeamMonitor/python/AlcaBeamMonitorHeavyIons_cff.py index e6fbaa6a674b7..4ef737f37899f 100644 --- a/DQM/BeamMonitor/python/AlcaBeamMonitorHeavyIons_cff.py +++ b/DQM/BeamMonitor/python/AlcaBeamMonitorHeavyIons_cff.py @@ -11,6 +11,11 @@ from Configuration.ProcessModifiers.dqmPerLSsaving_cff import dqmPerLSsaving dqmPerLSsaving.toModify(AlcaBeamMonitor, perLSsaving=True) +import RecoVertex.BeamSpotProducer.onlineBeamSpotESProducer_cfi as _mod +BeamSpotESProducer = _mod.onlineBeamSpotESProducer.clone( + timeThreshold = 999999 # accept even old payloads for MC/Data ReReco. DO NOT CHANGE +) + import RecoVertex.BeamSpotProducer.BeamSpotOnline_cfi scalerBeamSpot = RecoVertex.BeamSpotProducer.BeamSpotOnline_cfi.onlineBeamSpotProducer.clone() alcaBeamMonitor = cms.Sequence( scalerBeamSpot*AlcaBeamMonitor ) diff --git a/DQM/BeamMonitor/python/AlcaBeamMonitor_cff.py b/DQM/BeamMonitor/python/AlcaBeamMonitor_cff.py index 392d5125c2f8e..67b994824c378 100644 --- a/DQM/BeamMonitor/python/AlcaBeamMonitor_cff.py +++ b/DQM/BeamMonitor/python/AlcaBeamMonitor_cff.py @@ -5,6 +5,11 @@ from Configuration.ProcessModifiers.dqmPerLSsaving_cff import dqmPerLSsaving dqmPerLSsaving.toModify(AlcaBeamMonitor, perLSsaving=True) +import RecoVertex.BeamSpotProducer.onlineBeamSpotESProducer_cfi as _mod +BeamSpotESProducer = _mod.onlineBeamSpotESProducer.clone( + timeThreshold = 999999 # accept even old payloads for MC/Data ReReco. DO NOT CHANGE +) + import RecoVertex.BeamSpotProducer.BeamSpotOnline_cfi scalerBeamSpot = RecoVertex.BeamSpotProducer.BeamSpotOnline_cfi.onlineBeamSpotProducer.clone() diff --git a/DQM/BeamMonitor/python/BeamSpotDipServer_cff.py b/DQM/BeamMonitor/python/BeamSpotDipServer_cff.py new file mode 100644 index 0000000000000..e9703357777a3 --- /dev/null +++ b/DQM/BeamMonitor/python/BeamSpotDipServer_cff.py @@ -0,0 +1,25 @@ +import FWCore.ParameterSet.Config as cms +from DQMServices.Core.DQMEDAnalyzer import DQMEDAnalyzer + +beamSpotDipServer = DQMEDAnalyzer("BeamSpotDipServer", + monitorName = cms.untracked.string("BeamSpotDipServer"), + # + verbose = cms.untracked.bool(False), + testing = cms.untracked.bool(False), + # + subjectCMS = cms.untracked.string("dip/CMS/Tracker/BeamSpot"), + subjectLHC = cms.untracked.string("dip/CMS/LHC/LuminousRegion"), + subjectPV = cms.untracked.string("dip/CMS/Tracker/PrimaryVertices"), + # + readFromNFS = cms.untracked.bool(True), + # + dcsRecordInputTag = cms.InputTag ( "onlineMetaDataDigis" ), + # + sourceFile = cms.untracked.string( + "/nfshome0/dqmpro/BeamMonitorDQM/BeamFitResults.txt"), + sourceFile1 = cms.untracked.string( + "/nfshome0/dqmpro/BeamMonitorDQM/BeamFitResults_TkStatus.txt"), + # + timeoutLS = cms.untracked.vint32(1,2) +) + diff --git a/DQM/BeamMonitor/test/beamspotdip_dqm_sourceclient-file_cfg.py b/DQM/BeamMonitor/test/beamspotdip_dqm_sourceclient-file_cfg.py new file mode 100644 index 0000000000000..13e0c508fe62e --- /dev/null +++ b/DQM/BeamMonitor/test/beamspotdip_dqm_sourceclient-file_cfg.py @@ -0,0 +1,58 @@ +from __future__ import print_function +import FWCore.ParameterSet.Config as cms + +# +process = cms.Process("BeamSpotDipServer") +process.load("DQMServices.Core.DQM_cfg") + +# message logger +process.load("FWCore.MessageLogger.MessageLogger_cfi") +process.MessageLogger.cerr = cms.untracked.PSet( + threshold = cms.untracked.string('INFO'), + default = cms.untracked.PSet( + limit = cms.untracked.int32(1000) + ), + BeamSpotDipServer = cms.untracked.PSet( + limit = cms.untracked.int32(1000) + ) +) + +# source +process.source = cms.Source("PoolSource", + fileNames=cms.untracked.vstring( + 'file:/tmp/sikler/b.root' # lxplus7101 + ) +) + +process.maxEvents = cms.untracked.PSet( + input = cms.untracked.int32(100) +) + +# beamspot from database +process.load("CondCore.CondDB.CondDB_cfi") + +process.load("DQM.Integration.config.FrontierCondition_GT_cfi") + +process.GlobalTag.toGet = cms.VPSet( + cms.PSet( + record = cms.string("BeamSpotOnlineLegacyObjectsRcd"), + refreshTime = cms.uint64(1) + ), +) + +# module +process.load("DQM.BeamMonitor.BeamSpotDipServer_cff") + +process.beamSpotDipServer.verbose = True +process.beamSpotDipServer.testing = True + +process.beamSpotDipServer.readFromNFS = True +process.beamSpotDipServer.sourceFile = "../../../../../BeamFitResults.txt" +process.beamSpotDipServer.sourceFile1 = "../../../../../TkStatus.txt" + +# process customizations +from DQM.Integration.config.online_customizations_cfi import * +process = customise(process) + +# path +process.p = cms.Path( process.beamSpotDipServer ) diff --git a/DQM/BeamMonitor/test/log4cplus.properties b/DQM/BeamMonitor/test/log4cplus.properties new file mode 100644 index 0000000000000..f59034a2aba66 --- /dev/null +++ b/DQM/BeamMonitor/test/log4cplus.properties @@ -0,0 +1,14 @@ +# Set root logger level to WARN and its only appender to A1. +log4cplus.rootLogger=WARN, A1 + +# A1 is set to be a ConsoleAppender. +log4cplus.appender.A1=log4cplus::ConsoleAppender +log4cplus.appender.A1.ImmediateFlush=true +log4cplus.appender.A1.logToStdErr=false + +# A1 uses PatternLayout. +log4cplus.appender.A1.layout=log4cplus::PatternLayout +log4cplus.appender.A1.layout.ConversionPattern=%d{%m/%d/%y %H:%M:%S} [%t] %-5p %c{2} %%%x%% - %m%n + +#log4cplus.logger.dip.system=INFO +#log4cplus.logger.dip.publication=WARN diff --git a/DQM/CTPPS/plugins/BuildFile.xml b/DQM/CTPPS/plugins/BuildFile.xml index f82346cffcbd3..545d763e6edea 100644 --- a/DQM/CTPPS/plugins/BuildFile.xml +++ b/DQM/CTPPS/plugins/BuildFile.xml @@ -13,4 +13,6 @@ + + diff --git a/DQM/CTPPS/plugins/CTPPSCommonDQMSource.cc b/DQM/CTPPS/plugins/CTPPSCommonDQMSource.cc index a281905ce3ce9..018058234091d 100644 --- a/DQM/CTPPS/plugins/CTPPSCommonDQMSource.cc +++ b/DQM/CTPPS/plugins/CTPPSCommonDQMSource.cc @@ -156,44 +156,49 @@ void CTPPSCommonDQMSource::GlobalPlots::Init(DQMStore::IBooker &ibooker) { ya->SetBinLabel(18, "56, 220, NR-TP"); } - h_trackCorr_hor = ibooker.book2D("track correlation hor", "ctpps_common_rp_hor", 6, -0.5, 5.5, 6, -0.5, 5.5); + h_trackCorr_hor = ibooker.book2D("track correlation hor", "ctpps_common_rp_hor", 8, -0.5, 7.5, 8, -0.5, 7.5); { TH2F *hist = h_trackCorr_hor->getTH2F(); TAxis *xa = hist->GetXaxis(), *ya = hist->GetYaxis(); - xa->SetBinLabel(1, "45, 210, far"); - ya->SetBinLabel(1, "45, 210, far"); - xa->SetBinLabel(2, "45, 220, far"); - ya->SetBinLabel(2, "45, 220, far"); - xa->SetBinLabel(3, "45, 220, cyl"); - ya->SetBinLabel(3, "45, 220, cyl"); - xa->SetBinLabel(4, "56, 210, far"); - ya->SetBinLabel(4, "56, 210, far"); - xa->SetBinLabel(5, "56, 220, far"); - ya->SetBinLabel(5, "56, 220, far"); - xa->SetBinLabel(6, "56, 220, cyl"); - ya->SetBinLabel(6, "56, 220, cyl"); + xa->SetBinLabel(1, "45, 210, FR"); + ya->SetBinLabel(1, "45, 210, FR"); + xa->SetBinLabel(2, "45, 220, NR"); + ya->SetBinLabel(2, "45, 220, NR"); + xa->SetBinLabel(3, "45, 220, C1"); + ya->SetBinLabel(3, "45, 220, C1"); + xa->SetBinLabel(4, "45, 220, FR"); + ya->SetBinLabel(4, "45, 220, FR"); + + xa->SetBinLabel(5, "56, 210, FR"); + ya->SetBinLabel(5, "56, 210, FR"); + xa->SetBinLabel(6, "56, 220, NR"); + ya->SetBinLabel(6, "56, 220, NR"); + xa->SetBinLabel(7, "56, 220, C1"); + ya->SetBinLabel(7, "56, 220, C1"); + xa->SetBinLabel(8, "56, 220, FR"); + ya->SetBinLabel(8, "56, 220, FR"); } h_trackCorr_vert = ibooker.book2D("track correlation vert", "ctpps_common_rp_vert", 8, -0.5, 7.5, 8, -0.5, 7.5); { TH2F *hist = h_trackCorr_vert->getTH2F(); TAxis *xa = hist->GetXaxis(), *ya = hist->GetYaxis(); - xa->SetBinLabel(1, "45, 210, far, top"); - ya->SetBinLabel(1, "45, 210, far, top"); - xa->SetBinLabel(2, "45, 210, far, bot"); - ya->SetBinLabel(2, "45, 210, far, bot"); - xa->SetBinLabel(3, "45, 220, far, top"); - ya->SetBinLabel(3, "45, 220, far, top"); - xa->SetBinLabel(4, "45, 220, far, bot"); - ya->SetBinLabel(4, "45, 220, far, bot"); - xa->SetBinLabel(5, "56, 210, far, top"); - ya->SetBinLabel(5, "56, 210, far, top"); - xa->SetBinLabel(6, "56, 210, far, bot"); - ya->SetBinLabel(6, "56, 210, far, bot"); - xa->SetBinLabel(7, "56, 220, far, top"); - ya->SetBinLabel(7, "56, 220, far, top"); - xa->SetBinLabel(8, "56, 220, far, bot"); - ya->SetBinLabel(8, "56, 220, far, bot"); + xa->SetBinLabel(1, "45, 210, FR-TP"); + ya->SetBinLabel(1, "45, 210, FR-TP"); + xa->SetBinLabel(2, "45, 210, FR-BT"); + ya->SetBinLabel(2, "45, 210, FR-BT"); + xa->SetBinLabel(3, "45, 220, FR-TP"); + ya->SetBinLabel(3, "45, 220, FR-TP"); + xa->SetBinLabel(4, "45, 220, FR-BT"); + ya->SetBinLabel(4, "45, 220, FR-BT"); + xa->SetBinLabel(5, "56, 210, FR-TP"); + ya->SetBinLabel(5, "56, 210, FR-TP"); + xa->SetBinLabel(6, "56, 210, FR-BT"); + ya->SetBinLabel(6, "56, 210, FR-BT"); + xa->SetBinLabel(7, "56, 220, FR-TP"); + ya->SetBinLabel(7, "56, 220, FR-TP"); + xa->SetBinLabel(8, "56, 220, FR-BT"); + ya->SetBinLabel(8, "56, 220, FR-BT"); } } @@ -214,42 +219,46 @@ CTPPSCommonDQMSource::ArmPlots::ArmPlots(DQMStore::IBooker &ibooker, int _id, bo h_numRPWithTrack_bot = ibooker.book1D("number of bot RPs with tracks", title + ";number of bot RPs with tracks", 5, -0.5, 4.5); - h_trackCorr = ibooker.book2D("track correlation", title, 7, -0.5, 6.5, 7, -0.5, 6.5); + h_trackCorr = ibooker.book2D("track correlation", title, 8, -0.5, 7.5, 8, -0.5, 7.5); TH2F *h_trackCorr_h = h_trackCorr->getTH2F(); TAxis *xa = h_trackCorr_h->GetXaxis(), *ya = h_trackCorr_h->GetYaxis(); - xa->SetBinLabel(1, "210, far, hor"); - ya->SetBinLabel(1, "210, far, hor"); - xa->SetBinLabel(2, "210, far, top"); - ya->SetBinLabel(2, "210, far, top"); - xa->SetBinLabel(3, "210, far, bot"); - ya->SetBinLabel(3, "210, far, bot"); - xa->SetBinLabel(4, "220, cyl"); - ya->SetBinLabel(4, "220, cyl"); - xa->SetBinLabel(5, "220, far, hor"); - ya->SetBinLabel(5, "220, far, hor"); - xa->SetBinLabel(6, "220, far, top"); - ya->SetBinLabel(6, "220, far, top"); - xa->SetBinLabel(7, "220, far, bot"); - ya->SetBinLabel(7, "220, far, bot"); - - h_trackCorr_overlap = ibooker.book2D("track correlation hor-vert overlaps", title, 7, -0.5, 6.5, 7, -0.5, 6.5); + xa->SetBinLabel(1, "210, FR-HR"); + ya->SetBinLabel(1, "210, FR-HR"); + xa->SetBinLabel(2, "210, FR-TP"); + ya->SetBinLabel(2, "210, FR-TP"); + xa->SetBinLabel(3, "210, FR-BT"); + ya->SetBinLabel(3, "210, FR-BT"); + xa->SetBinLabel(4, "220, NR-HR"); + ya->SetBinLabel(4, "220, NR-HR"); + xa->SetBinLabel(5, "220, C1"); + ya->SetBinLabel(5, "220, C1"); + xa->SetBinLabel(6, "220, FR-HR"); + ya->SetBinLabel(6, "220, FR-HR"); + xa->SetBinLabel(7, "220, FR-TP"); + ya->SetBinLabel(7, "220, FR-TP"); + xa->SetBinLabel(8, "220, FR-BT"); + ya->SetBinLabel(8, "220, FR-BT"); + + h_trackCorr_overlap = ibooker.book2D("track correlation hor-vert overlaps", title, 8, -0.5, 7.5, 8, -0.5, 7.5); h_trackCorr_h = h_trackCorr_overlap->getTH2F(); xa = h_trackCorr_h->GetXaxis(); ya = h_trackCorr_h->GetYaxis(); - xa->SetBinLabel(1, "210, far, hor"); - ya->SetBinLabel(1, "210, far, hor"); - xa->SetBinLabel(2, "210, far, top"); - ya->SetBinLabel(2, "210, far, top"); - xa->SetBinLabel(3, "210, far, bot"); - ya->SetBinLabel(3, "210, far, bot"); - xa->SetBinLabel(4, "220, cyl"); - ya->SetBinLabel(4, "220, cyl"); - xa->SetBinLabel(5, "220, far, hor"); - ya->SetBinLabel(5, "220, far, hor"); - xa->SetBinLabel(6, "220, far, top"); - ya->SetBinLabel(6, "220, far, top"); - xa->SetBinLabel(7, "220, far, bot"); - ya->SetBinLabel(7, "220, far, bot"); + xa->SetBinLabel(1, "210, FR-HR"); + ya->SetBinLabel(1, "210, FR-HR"); + xa->SetBinLabel(2, "210, FR-TP"); + ya->SetBinLabel(2, "210, FR-TP"); + xa->SetBinLabel(3, "210, FR-BT"); + ya->SetBinLabel(3, "210, FR-BT"); + xa->SetBinLabel(4, "220, NR-HR"); + ya->SetBinLabel(4, "220, NR-HR"); + xa->SetBinLabel(5, "220, C1"); + ya->SetBinLabel(5, "220, C1"); + xa->SetBinLabel(6, "220, FR-HR"); + ya->SetBinLabel(6, "220, FR-HR"); + xa->SetBinLabel(7, "220, FR-TP"); + ya->SetBinLabel(7, "220, FR-TP"); + xa->SetBinLabel(8, "220, FR-BT"); + ya->SetBinLabel(8, "220, FR-BT"); if (makeProtonRecoPlots) { h_proton_xi = ibooker.book1D("proton xi", title + ";xi", 100, 0., 0.3); @@ -259,7 +268,7 @@ CTPPSCommonDQMSource::ArmPlots::ArmPlots(DQMStore::IBooker &ibooker, int _id, bo h_proton_time = ibooker.book1D("proton time", title + ";time (ns)", 100, -1., 1.); } - for (const unsigned int rpDecId : {2, 3, 16, 23}) { + for (const unsigned int rpDecId : {3, 22, 16, 23}) { unsigned int st = rpDecId / 10, rp = rpDecId % 10, rpFullDecId = id * 100 + rpDecId; CTPPSDetId rpId(CTPPSDetId::sdTrackingStrip, id, st, rp); string stName, rpName; @@ -267,7 +276,9 @@ CTPPSCommonDQMSource::ArmPlots::ArmPlots(DQMStore::IBooker &ibooker, int _id, bo rpId.rpName(rpName, CTPPSDetId::nShort); rpName = stName + "_" + rpName; - if (rp == 6) { + const bool timingRP = (rpDecId == 22 || rpDecId == 16); + + if (timingRP) { timingRPPlots[rpFullDecId] = { ibooker.book1D(rpName + " - track x histogram", title + "/" + rpName + ";track x (mm)", 200, 0., 40.), ibooker.book1D( @@ -373,13 +384,15 @@ void CTPPSCommonDQMSource::analyzeTracks(edm::Event const &event, edm::EventSetu signed int idx = -1; if (stRPNum == 3) idx = 0; - if (stRPNum == 23) + if (stRPNum == 22) idx = 1; if (stRPNum == 16) idx = 2; + if (stRPNum == 23) + idx = 3; if (idx >= 0) - s_rp_idx_global_hor.insert(3 * arm + idx); + s_rp_idx_global_hor.insert(4 * arm + idx); } { @@ -405,14 +418,16 @@ void CTPPSCommonDQMSource::analyzeTracks(edm::Event const &event, edm::EventSetu idx = 1; if (stRPNum == 5) idx = 2; - if (stRPNum == 16) + if (stRPNum == 22) idx = 3; - if (stRPNum == 23) + if (stRPNum == 16) idx = 4; - if (stRPNum == 24) + if (stRPNum == 23) idx = 5; - if (stRPNum == 25) + if (stRPNum == 24) idx = 6; + if (stRPNum == 25) + idx = 7; const signed int hor = ((rpNum == 2) || (rpNum == 3) || (rpNum == 6)) ? 1 : 0; diff --git a/DQM/CTPPS/plugins/CTPPSDiamondDQMSource.cc b/DQM/CTPPS/plugins/CTPPSDiamondDQMSource.cc index adba4530d145e..1d6afd266755a 100644 --- a/DQM/CTPPS/plugins/CTPPSDiamondDQMSource.cc +++ b/DQM/CTPPS/plugins/CTPPSDiamondDQMSource.cc @@ -1,10 +1,11 @@ /**************************************************************************** * -* This is a part of CTPPS offline software. +* This is a part of CTPPSDQM software. * Authors: * Jan Kašpar (jan.kaspar@gmail.com) * Nicola Minafra * Laurent Forthomme +* Christopher Misan * ****************************************************************************/ @@ -37,6 +38,9 @@ #include "Geometry/VeryForwardGeometryBuilder/interface/CTPPSGeometry.h" #include "Geometry/Records/interface/VeryForwardRealGeometryRecord.h" +// #include "CondFormats/RunInfo/interface/LHCInfo.h" +// #include "CondFormats/DataRecord/interface/LHCInfoRcd.h" + #include //---------------------------------------------------------------------------------------------------- @@ -68,10 +72,10 @@ namespace dds { class CTPPSDiamondDQMSource : public DQMOneEDAnalyzer> { public: CTPPSDiamondDQMSource(const edm::ParameterSet&); - ~CTPPSDiamondDQMSource() override; protected: void dqmBeginRun(const edm::Run&, const edm::EventSetup&) override; + void dqmEndRun(edm::Run const&, edm::EventSetup const&) override; void bookHistograms(DQMStore::IBooker&, const edm::Run&, const edm::EventSetup&) override; void analyze(const edm::Event&, const edm::EventSetup&) override; std::shared_ptr globalBeginLuminosityBlock(const edm::LuminosityBlock&, @@ -80,48 +84,39 @@ class CTPPSDiamondDQMSource : public DQMOneEDAnalyzer> tokenStatus_; - edm::EDGetTokenT> tokenPixelTrack_; - edm::EDGetTokenT> tokenDigi_; - edm::EDGetTokenT> tokenDiamondHit_; - edm::EDGetTokenT> tokenDiamondTrack_; - edm::EDGetTokenT> tokenFEDInfo_; - - edm::ESGetToken ctppsGeometryRunToken_; - edm::ESGetToken ctppsGeometryEventToken_; - - bool excludeMultipleHits_; - bool perLSsaving_; //to avoid nanoDQMIO crashing, driven by DQMServices/Core/python/DQMStore_cfi.py - double horizontalShiftBwDiamondPixels_; - double horizontalShiftOfDiamond_; - std::vector> runParameters_; - int centralOOT_; - unsigned int verbosity_; + /// Number of seconds per lumisection: used to compute hit rates in Hz + static constexpr double SEC_PER_LUMI_SECTION = 23.31; + /// Channel ID of the VFAT that contains clock data + static constexpr unsigned short CHANNEL_OF_VFAT_CLOCK = 30; + /// Bin width of histograms showing hits and tracks (in mm) + static constexpr double DISPLAY_RESOLUTION_FOR_HITS_MM = 0.1; + static constexpr double INV_DISPLAY_RESOLUTION_FOR_HITS_MM = 1. / DISPLAY_RESOLUTION_FOR_HITS_MM; + /// ns per HPTDC bin + static constexpr double HPTDC_BIN_WIDTH_NS = 25. / 1024; + static constexpr unsigned short CTPPS_PIXEL_STATION_ID = 2; + static constexpr unsigned short CTPPS_FAR_RP_ID = 3; + static constexpr unsigned short CTPPS_DIAMOND_NUM_OF_CHANNELS = 12; + static constexpr unsigned short CTPPS_FED_ID_45 = 583; + static constexpr unsigned short CTPPS_FED_ID_56 = 582; + static constexpr unsigned short HPTDC_0_CHANNEL = 6; + static constexpr unsigned short HPTDC_1_CHANNEL = 7; + /// Number of OOT indices monitored + static constexpr unsigned int FIRST_RUN_W_PIXELS = 300000; /// plots related to the whole system struct GlobalPlots { - GlobalPlots() {} + GlobalPlots() = default; GlobalPlots(DQMStore::IBooker& ibooker); }; - - GlobalPlots globalPlot_; - + /// plots related to one sector + struct SectorPlots { + // Tracks + MonitorElement* trackCorrelation = nullptr; + MonitorElement* trackCorrelationLowMultiplicity = nullptr; + MonitorElement* digiSentPercentage = nullptr; + SectorPlots(){}; + SectorPlots(DQMStore::IBooker& ibooker, unsigned int id, bool plotOnline); + }; /// plots related to one Diamond detector package struct PotPlots { std::unordered_map activity_per_bx; @@ -139,7 +134,7 @@ class CTPPSDiamondDQMSource : public DQMOneEDAnalyzer potPlots_; - int EC_difference_56_, EC_difference_45_; + // MonitorElement* TOTVsLSProfile = nullptr; + // MonitorElement* trackTimeVsLSProfile = nullptr; + MonitorElement* trackTimeVsBXProfile = nullptr; + // MonitorElement* trackTimeVsXAngleProfile = nullptr; + PotPlots() = default; + PotPlots(DQMStore::IBooker& ibooker, unsigned int id, unsigned int windowsNum, bool plotOnline, bool plotOffline); + }; /// plots related to one Diamond plane struct PlanePlots { MonitorElement* digiProfileCumulativePerPlane = nullptr; @@ -177,12 +180,9 @@ class CTPPSDiamondDQMSource : public DQMOneEDAnalyzer planePlots_; - /// plots related to one Diamond channel struct ChannelPlots { std::unordered_map activity_per_bx; @@ -191,46 +191,90 @@ class CTPPSDiamondDQMSource : public DQMOneEDAnalyzer> tokenStatus_; + edm::EDGetTokenT> tokenPixelTrack_; + edm::EDGetTokenT> tokenDigi_; + edm::EDGetTokenT> tokenDiamondHit_; + edm::EDGetTokenT> tokenDiamondTrack_; + edm::EDGetTokenT> tokenFEDInfo_; + + edm::ESGetToken ctppsGeometryRunToken_; + edm::ESGetToken ctppsGeometryEventToken_; + // edm::ESGetToken ctppsLhcInfoToken_; + + bool excludeMultipleHits_; + bool perLSsaving_; //to avoid nanoDQMIO crashing, driven by DQMServices/Core/python/DQMStore_cfi.py + const bool extract_digi_info_; + struct DiamondShifts { + double global, withPixels; }; + std::unordered_map diamShifts_; + std::vector> runParameters_; + int centralOOT_; + unsigned int verbosity_; + const bool plotOnline_; + const bool plotOffline_; + unsigned int windowsNum_; + unsigned int trackCorrelationThreshold_; + GlobalPlots globalPlot_; + std::unordered_map potPlots_; + std::unordered_map sectorPlots_; + std::unordered_map planePlots_; std::unordered_map channelPlots_; + + int EC_difference_56_, EC_difference_45_; }; //---------------------------------------------------------------------------------------------------- -// Values for all constants -const double CTPPSDiamondDQMSource::SEC_PER_LUMI_SECTION = 23.31; -const int CTPPSDiamondDQMSource::CHANNEL_OF_VFAT_CLOCK = 30; -const double CTPPSDiamondDQMSource::DISPLAY_RESOLUTION_FOR_HITS_MM = 0.1; -const double CTPPSDiamondDQMSource::INV_DISPLAY_RESOLUTION_FOR_HITS_MM = 1. / DISPLAY_RESOLUTION_FOR_HITS_MM; -const double CTPPSDiamondDQMSource::HPTDC_BIN_WIDTH_NS = 25. / 1024; -const int CTPPSDiamondDQMSource::CTPPS_NUM_OF_ARMS = 2; -const int CTPPSDiamondDQMSource::CTPPS_DIAMOND_STATION_ID = 1; -const int CTPPSDiamondDQMSource::CTPPS_PIXEL_STATION_ID = 2; -const int CTPPSDiamondDQMSource::CTPPS_DIAMOND_RP_ID = 6; -const int CTPPSDiamondDQMSource::CTPPS_NEAR_RP_ID = 2; -const int CTPPSDiamondDQMSource::CTPPS_FAR_RP_ID = 3; -const int CTPPSDiamondDQMSource::CTPPS_DIAMOND_NUM_OF_PLANES = 4; -const int CTPPSDiamondDQMSource::CTPPS_DIAMOND_NUM_OF_CHANNELS = 12; -const int CTPPSDiamondDQMSource::CTPPS_FED_ID_56 = 582; -const int CTPPSDiamondDQMSource::CTPPS_FED_ID_45 = 583; +CTPPSDiamondDQMSource::GlobalPlots::GlobalPlots(DQMStore::IBooker& ibooker) { ibooker.setCurrentFolder("CTPPS"); } //---------------------------------------------------------------------------------------------------- -CTPPSDiamondDQMSource::GlobalPlots::GlobalPlots(DQMStore::IBooker& ibooker) { ibooker.setCurrentFolder("CTPPS"); } +CTPPSDiamondDQMSource::SectorPlots::SectorPlots(DQMStore::IBooker& ibooker, unsigned int id, bool plotOnline) { + std::string path, title; + CTPPSDiamondDetId(id).armName(path, CTPPSDiamondDetId::nPath); + ibooker.setCurrentFolder(path); -//---------------------------------------------------------------------------------------------------- + CTPPSDiamondDetId(id).armName(title, CTPPSDiamondDetId::nFull); + + trackCorrelation = ibooker.book2D("tracks correlation near-far", + title + " tracks correlation near-far;x (mm);x (mm)", + 19. * INV_DISPLAY_RESOLUTION_FOR_HITS_MM, + -1, + 18, + 19. * INV_DISPLAY_RESOLUTION_FOR_HITS_MM, + -1, + 18); + trackCorrelationLowMultiplicity = + ibooker.book2D("tracks correlation with low multiplicity near-far", + title + " tracks correlation with low multiplicity near-far;x (mm);x (mm)", + 19. * INV_DISPLAY_RESOLUTION_FOR_HITS_MM, + -1, + 18, + 19. * INV_DISPLAY_RESOLUTION_FOR_HITS_MM, + -1, + 18); +} -CTPPSDiamondDQMSource::PotPlots::PotPlots(DQMStore::IBooker& ibooker, unsigned int id) +//---------------------------------------------------------------------------------------------------- +CTPPSDiamondDQMSource::PotPlots::PotPlots( + DQMStore::IBooker& ibooker, unsigned int id, unsigned int windowsNum, bool plotOnline, bool plotOffline) : HitCounter(0), MHCounter(0), LeadingOnlyCounter(0), @@ -243,12 +287,85 @@ CTPPSDiamondDQMSource::PotPlots::PotPlots(DQMStore::IBooker& ibooker, unsigned i CTPPSDiamondDetId(id).rpName(title, CTPPSDiamondDetId::nFull); - activity_per_bx[0] = - ibooker.book1D("activity per BX 0 25", title + " Activity per BX 0 - 25 ns;Event.BX", 3600, -1.5, 3598. + 0.5); - activity_per_bx[1] = - ibooker.book1D("activity per BX 25 50", title + " Activity per BX 25 - 50 ns;Event.BX", 3600, -1.5, 3598. + 0.5); - activity_per_bx[2] = - ibooker.book1D("activity per BX 50 75", title + " Activity per BX 50 - 75 ns;Event.BX", 3600, -1.5, 3598. + 0.5); + if (plotOnline) { + hitDistribution2d_lumisection = + ibooker.book2D("hits in planes lumisection", + title + " hits in planes in the last lumisection;plane number;x (mm)", + 10, + -0.5, + 4.5, + 19. * INV_DISPLAY_RESOLUTION_FOR_HITS_MM, + -0.5, + 18.5); + + hitDistribution2dOOT_le = + ibooker.book2D("hits with OOT in planes (le only)", + title + " hits with OOT in planes (le only);plane number, OOT index;x (mm)", + 1 + windowsNum * 4, + -1. / windowsNum, + 4, + 19. * INV_DISPLAY_RESOLUTION_FOR_HITS_MM, + -0.5, + 18.5); + + activePlanesInclusive = + ibooker.book1D("active planes inclusive", + title + " active planes, MH and le only included (per event);number of active planes", + 6, + -0.5, + 5.5); + + ECCheck = ibooker.book1D("optorxEC(8bit) - vfatEC", title + " EC Error;optorxEC-vfatEC", 50, -25, 25); + + EfficiencyOfChannelsInPot = + ibooker.book2D("Efficiency in channels", + title + " Efficiency (%) in channels (diamonds only);plane number;ch number", + 10, + -0.5, + 4.5, + 14, + -1, + 13); + } + + if (plotOffline) { + ibooker.setCurrentFolder(path + "/timing_profiles"); + // TOTVsLS=ibooker.book2D("ToT vs LS",title +" ToT vs LS;LS;ToT(ns)",4000,0,4000, 200,5,25); + // trackTimeVsLS=ibooker.book2D("track time vs LS",title+" track time vs LS;LS;track_time(ns)",4000,0,4000, 500, -25, 25); + trackTimeVsBX = + ibooker.book2D("track time vs BX", title + " track time vs BX;BX;track_time(ns)", 4000, 0, 4000, 500, -25, 25); + // trackTimeVsXAngle = ibooker.book2D( + // "track time vs xangle", title + " track time vs xangle;xangle;track_time(ns)", 60, 120, 180, 500, -25, 25); + + // TOTVsLSProfile=ibooker.bookProfile("ToT vs LS profile",title+" ToT vs LS profile;LS;track_time(ns)", 500, -25, 25,4000,0,4000); + // trackTimeVsLSProfile=ibooker.bookProfile("track time vs LS profile",title+" track time vs LS profile;LS;track_time(ns)", 500, -25, 25,4000,0,4000); + trackTimeVsBXProfile = ibooker.bookProfile( + "track time vs BX profile", title + " track time vs BX profile;BX;track_time(ns)", 500, -25, 25, 4000, 0, 4000); + // trackTimeVsXAngleProfile = ibooker.bookProfile("track time vs xangle profile", + // title + " track time vs xangle profile;xangle;track_time(ns)", + // 500, + // -25, + // 25, + // 60, + // 120, + // 180); + ibooker.setCurrentFolder(path); + } + + for (unsigned int i = 0; i < windowsNum; i++) { + std::string window = std::to_string(i * 25) + "-" + std::to_string((i + 1) * 25); + activity_per_bx[i] = ibooker.book1D( + "activity per BX " + window, title + " Activity per BX " + window + " ns;Event.BX", 3600, -1.5, 3598. + 0.5); + pixelTomographyAll[i] = + ibooker.book2D("tomography pixel " + window, + title + " tomography with pixel " + window + " ns (all planes);x + 25*plane(mm);y (mm)", + 100, + 0, + 100, + 10, + -5, + 5); + } hitDistribution2d = ibooker.book2D("hits in planes", title + " hits in planes;plane number;x (mm)", @@ -258,38 +375,33 @@ CTPPSDiamondDQMSource::PotPlots::PotPlots(DQMStore::IBooker& ibooker, unsigned i 19. * INV_DISPLAY_RESOLUTION_FOR_HITS_MM, -0.5, 18.5); - hitDistribution2d_lumisection = ibooker.book2D("hits in planes lumisection", - title + " hits in planes in the last lumisection;plane number;x (mm)", - 10, - -0.5, - 4.5, - 19. * INV_DISPLAY_RESOLUTION_FOR_HITS_MM, - -0.5, - 18.5); + hitDistribution2dOOT = ibooker.book2D("hits with OOT in planes", - title + " hits with OOT in planes;plane number + 0.25 OOT;x (mm)", - 17, - -0.25, + title + " hits with OOT in planes;plane number, OOT index;x (mm)", + 1 + windowsNum * 4, + -1. / windowsNum, 4, 19. * INV_DISPLAY_RESOLUTION_FOR_HITS_MM, -0.5, 18.5); - hitDistribution2dOOT_le = ibooker.book2D("hits with OOT in planes (le only)", - title + " hits with OOT in planes (le only);plane number + 0.25 OOT;x (mm)", - 17, - -0.25, - 4, - 19. * INV_DISPLAY_RESOLUTION_FOR_HITS_MM, - -0.5, - 18.5); + + { // bin labelling (for clarity) + int idx = 2; // start counting at 1, first bin is empty + for (int pl = 0; pl < 4; ++pl) + for (unsigned int oot = 0; oot < windowsNum; ++oot) { + const std::string bin_label = + (oot == 0 ? "Plane " + std::to_string(pl) + ", " : "") + "OOT" + std::to_string(oot); + hitDistribution2dOOT->setBinLabel(idx, bin_label); + if (plotOnline) + hitDistribution2dOOT_le->setBinLabel(idx, bin_label); + ++idx; + } + } + + recHitTime = ibooker.book1D("recHit time", title + " recHit time; t (ns)", 500, -25, 25); + activePlanes = ibooker.book1D("active planes", title + " active planes (per event);number of active planes", 6, -0.5, 5.5); - activePlanesInclusive = - ibooker.book1D("active planes inclusive", - title + " active planes, MH and le only included (per event);number of active planes", - 6, - -0.5, - 5.5); trackDistribution = ibooker.book1D("tracks", title + " tracks;x (mm)", 19. * INV_DISPLAY_RESOLUTION_FOR_HITS_MM, -0.5, 18.5); @@ -302,53 +414,37 @@ CTPPSDiamondDQMSource::PotPlots::PotPlots(DQMStore::IBooker& ibooker, unsigned i -0.5, 18.5); - pixelTomographyAll[0] = - ibooker.book2D("tomography pixel 0 25", - title + " tomography with pixel 0 - 25 ns (all planes);x + 25*plane(mm);y (mm)", - 100, - 0, - 100, - 8, - 0, - 8); - pixelTomographyAll[1] = - ibooker.book2D("tomography pixel 25 50", - title + " tomography with pixel 25 - 50 ns (all planes);x + 25*plane(mm);y (mm)", - 100, - 0, - 100, - 8, - 0, - 8); - pixelTomographyAll[2] = - ibooker.book2D("tomography pixel 50 75", - title + " tomography with pixel 50 - 75 ns (all planes);x + 25*plane(mm);y (mm)", - 100, - 0, - 100, - 8, - 0, - 8); - - leadingEdgeCumulative_both = ibooker.book1D( - "leading edge (le and te)", title + " leading edge (le and te) (recHits); leading edge (ns)", 75, 0, 75); - leadingEdgeCumulative_all = ibooker.book1D( - "leading edge (all)", title + " leading edge (with or without te) (DIGIs); leading edge (ns)", 75, 0, 75); - leadingEdgeCumulative_le = - ibooker.book1D("leading edge (le only)", title + " leading edge (le only) (DIGIs); leading edge (ns)", 75, 0, 75); - trailingEdgeCumulative_te = ibooker.book1D( - "trailing edge (te only)", title + " trailing edge (te only) (DIGIs); trailing edge (ns)", 75, 0, 75); + leadingEdgeCumulative_both = ibooker.book1D("leading edge (le and te)", + title + " leading edge (le and te) (recHits); leading edge (ns)", + 25 * windowsNum, + 0, + 25 * windowsNum); + leadingEdgeCumulative_all = ibooker.book1D("leading edge (all)", + title + " leading edge (with or without te) (DIGIs); leading edge (ns)", + 25 * windowsNum, + 0, + 25 * windowsNum); + leadingEdgeCumulative_le = ibooker.book1D("leading edge (le only)", + title + " leading edge (le only) (DIGIs); leading edge (ns)", + 25 * windowsNum, + 0, + 25 * windowsNum); + trailingEdgeCumulative_te = ibooker.book1D("trailing edge (te only)", + title + " trailing edge (te only) (DIGIs); trailing edge (ns)", + 25 * windowsNum, + 0, + 25 * windowsNum); timeOverThresholdCumulativePot = ibooker.book1D("time over threshold", title + " time over threshold;time over threshold (ns)", 250, -25, 100); - leadingTrailingCorrelationPot = - ibooker.book2D("leading trailing correlation", - title + " leading trailing correlation;leading edge (ns);trailing edge (ns)", - 75, - 0, - 75, - 75, - 0, - 75); + // leadingTrailingCorrelationPot = + // ibooker.book2D("leading trailing correlation", + // title + " leading trailing correlation;leading edge (ns);trailing edge (ns)", + // 75, + // 0, + // 75, + // 75, + // 0, + // 75); leadingWithoutTrailingCumulativePot = ibooker.book1D("event category", title + " leading edges without trailing;;%", 3, 0.5, 3.5); @@ -356,8 +452,6 @@ CTPPSDiamondDQMSource::PotPlots::PotPlots(DQMStore::IBooker& ibooker, unsigned i leadingWithoutTrailingCumulativePot->setBinLabel(2, "Trailing only"); leadingWithoutTrailingCumulativePot->setBinLabel(3, "Both"); - ECCheck = ibooker.book1D("optorxEC(8bit) - vfatEC", title + " EC Error;optorxEC-vfatEC", 50, -25, 25); - HPTDCErrorFlags_2D = ibooker.book2D("HPTDC Errors", title + " HPTDC Errors", 16, -0.5, 16.5, 9, -0.5, 8.5); for (unsigned short error_index = 1; error_index < 16; ++error_index) HPTDCErrorFlags_2D->setBinLabel(error_index, HPTDCErrorFlags::hptdcErrorName(error_index - 1)); @@ -376,16 +470,6 @@ CTPPSDiamondDQMSource::PotPlots::PotPlots(DQMStore::IBooker& ibooker, unsigned i MHComprensive = ibooker.book2D("MH in channels", title + " MH (%) in channels;plane number;ch number", 10, -0.5, 4.5, 14, -1, 13); - EfficiencyOfChannelsInPot = - ibooker.book2D("Efficiency in channels", - title + " Efficiency (%) in channels (diamonds only);plane number;ch number", - 10, - -0.5, - 4.5, - 14, - -1, - 13); - // ibooker.setCurrentFolder( path+"/clock/" ); // clock_Digi1_le = ibooker.book1D( "clock1 leading edge", title+" clock1;leading edge (ns)", 250, 0, 25 ); // clock_Digi1_te = ibooker.book1D( "clock1 trailing edge", title+" clock1;trailing edge (ns)", 75, 0, 75 ); @@ -395,7 +479,7 @@ CTPPSDiamondDQMSource::PotPlots::PotPlots(DQMStore::IBooker& ibooker, unsigned i //---------------------------------------------------------------------------------------------------- -CTPPSDiamondDQMSource::PlanePlots::PlanePlots(DQMStore::IBooker& ibooker, unsigned int id) +CTPPSDiamondDQMSource::PlanePlots::PlanePlots(DQMStore::IBooker& ibooker, unsigned int id, unsigned int windowsNum) : pixelTracksMapWithDiamonds("Pixel track maps for efficiency with coincidence", "Pixel track maps for efficiency with coincidence", 25, @@ -410,20 +494,30 @@ CTPPSDiamondDQMSource::PlanePlots::PlanePlots(DQMStore::IBooker& ibooker, unsign CTPPSDiamondDetId(id).planeName(title, CTPPSDiamondDetId::nFull); - digiProfileCumulativePerPlane = ibooker.book1D("digi profile", title + " digi profile; ch number", 12, -0.5, 11.5); + digiProfileCumulativePerPlane = ibooker.book1D("digi profile", + title + " digi profile; ch number", + CTPPS_DIAMOND_NUM_OF_CHANNELS, + -0.5, + CTPPS_DIAMOND_NUM_OF_CHANNELS - 0.5); hitProfile = ibooker.book1D( "hit profile", title + " hit profile;x (mm)", 19. * INV_DISPLAY_RESOLUTION_FOR_HITS_MM, -0.5, 18.5); hit_multiplicity = ibooker.book1D("channels per plane", title + " channels per plane; ch per plane", 13, -0.5, 12.5); - pixelTomography_far = - ibooker.book2D("tomography pixel", title + " tomography with pixel;x + 25 OOT (mm);y (mm)", 75, 0, 75, 8, 0, 8); + pixelTomography_far = ibooker.book2D("tomography pixel", + title + " tomography with pixel;x + 25 OOT (mm);y (mm)", + 25 * windowsNum, + 0, + 25 * windowsNum, + 8, + 0, + 8); EfficiencyWRTPixelsInPlane = ibooker.book2D("Efficiency wrt pixels", title + " Efficiency wrt pixels;x (mm);y (mm)", 25, 0, 25, 12, -2, 10); } //---------------------------------------------------------------------------------------------------- -CTPPSDiamondDQMSource::ChannelPlots::ChannelPlots(DQMStore::IBooker& ibooker, unsigned int id) +CTPPSDiamondDQMSource::ChannelPlots::ChannelPlots(DQMStore::IBooker& ibooker, unsigned int id, unsigned int windowsNum) : HitCounter(0), MHCounter(0), LeadingOnlyCounter(0), TrailingOnlyCounter(0), CompleteCounter(0) { std::string path, title; CTPPSDiamondDetId(id).channelName(path, CTPPSDiamondDetId::nPath); @@ -436,62 +530,77 @@ CTPPSDiamondDQMSource::ChannelPlots::ChannelPlots(DQMStore::IBooker& ibooker, un leadingWithoutTrailing->setBinLabel(2, "Trailing only"); leadingWithoutTrailing->setBinLabel(3, "Full"); - activity_per_bx[0] = - ibooker.book1D("activity per BX 0 25", title + " Activity per BX 0 - 25 ns;Event.BX", 500, -1.5, 498. + 0.5); - activity_per_bx[1] = - ibooker.book1D("activity per BX 25 50", title + " Activity per BX 25 - 50 ns;Event.BX", 500, -1.5, 498. + 0.5); - activity_per_bx[2] = - ibooker.book1D("activity per BX 50 75", title + " Activity per BX 50 - 75 ns;Event.BX", 500, -1.5, 498. + 0.5); + for (unsigned int i = 0; i < windowsNum; i++) { + std::string window = std::to_string(i * 25) + "-" + std::to_string((i + 1) * 25); + activity_per_bx[i] = ibooker.book1D( + "activity per BX " + window, title + " Activity per BX " + window + " ns;Event.BX", 3600, -1.5, 3598. + 0.5); + } HPTDCErrorFlags = ibooker.book1D("hptdc_Errors", title + " HPTDC Errors", 16, -0.5, 16.5); for (unsigned short error_index = 1; error_index < 16; ++error_index) HPTDCErrorFlags->setBinLabel(error_index, HPTDCErrorFlags::hptdcErrorName(error_index - 1)); HPTDCErrorFlags->setBinLabel(16, "MH (%)"); - leadingEdgeCumulative_both = - ibooker.book1D("leading edge (le and te)", title + " leading edge (recHits); leading edge (ns)", 75, 0, 75); - leadingEdgeCumulative_le = - ibooker.book1D("leading edge (le only)", title + " leading edge (DIGIs); leading edge (ns)", 75, 0, 75); - trailingEdgeCumulative_te = ibooker.book1D( - "trailing edge (te only)", title + " trailing edge (te only) (DIGIs); trailing edge (ns)", 75, 0, 75); + leadingEdgeCumulative_both = ibooker.book1D("leading edge (le and te)", + title + " leading edge (recHits); leading edge (ns)", + 25 * windowsNum, + 0, + 25 * windowsNum); + leadingEdgeCumulative_le = ibooker.book1D( + "leading edge (le only)", title + " leading edge (DIGIs); leading edge (ns)", 25 * windowsNum, 0, 25 * windowsNum); + trailingEdgeCumulative_te = ibooker.book1D("trailing edge (te only)", + title + " trailing edge (te only) (DIGIs); trailing edge (ns)", + 25 * windowsNum, + 0, + 25 * windowsNum); TimeOverThresholdCumulativePerChannel = ibooker.book1D("time over threshold", title + " time over threshold;time over threshold (ns)", 75, -25, 50); - LeadingTrailingCorrelationPerChannel = - ibooker.book2D("leading trailing correlation", - title + " leading trailing correlation;leading edge (ns);trailing edge (ns)", - 75, - 0, - 75, - 75, - 0, - 75); - - pixelTomography_far = - ibooker.book2D("tomography pixel", "tomography with pixel;x + 25 OOT (mm);y (mm)", 75, 0, 75, 8, 0, 8); + // LeadingTrailingCorrelationPerChannel = + // ibooker.book2D("leading trailing correlation", + // title + " leading trailing correlation;leading edge (ns);trailing edge (ns)", + // 75, + // 0, + // 75, + // 75, + // 0, + // 75); + + pixelTomography_far = ibooker.book2D( + "tomography pixel", "tomography with pixel;x + 25 OOT (mm);y (mm)", 25 * windowsNum, 0, 25 * windowsNum, 8, 0, 8); hit_rate = ibooker.book1D("hit rate", title + "hit rate;rate (Hz)", 40, 0, 20); + + recHitTime = ibooker.book1D("recHit Time", title + " recHit Time; t (ns)", 500, -25, 25); } //---------------------------------------------------------------------------------------------------- CTPPSDiamondDQMSource::CTPPSDiamondDQMSource(const edm::ParameterSet& ps) - : tokenStatus_(consumes>(ps.getParameter("tagStatus"))), - tokenPixelTrack_( + : tokenPixelTrack_( consumes>(ps.getParameter("tagPixelLocalTracks"))), - tokenDigi_(consumes>(ps.getParameter("tagDigi"))), tokenDiamondHit_( consumes>(ps.getParameter("tagDiamondRecHits"))), tokenDiamondTrack_( consumes>(ps.getParameter("tagDiamondLocalTracks"))), - tokenFEDInfo_(consumes>(ps.getParameter("tagFEDInfo"))), ctppsGeometryRunToken_(esConsumes()), ctppsGeometryEventToken_(esConsumes()), + // ctppsLhcInfoToken_(esConsumes()), excludeMultipleHits_(ps.getParameter("excludeMultipleHits")), perLSsaving_(ps.getUntrackedParameter("perLSsaving", false)), + extract_digi_info_(ps.getParameter("extractDigiInfo")), centralOOT_(-999), verbosity_(ps.getUntrackedParameter("verbosity", 0)), + plotOnline_(ps.getUntrackedParameter("plotOnline", true)), + plotOffline_(ps.getUntrackedParameter("plotOffline", false)), + windowsNum_(ps.getUntrackedParameter("windowsNum", 3)), + trackCorrelationThreshold_(ps.getUntrackedParameter("trackCorrelationThreshold", 3)), EC_difference_56_(-500), EC_difference_45_(-500) { + if (extract_digi_info_) { + tokenStatus_ = consumes>(ps.getParameter("tagStatus")); + tokenFEDInfo_ = consumes>(ps.getParameter("tagFEDInfo")); + tokenDigi_ = consumes>(ps.getParameter("tagDigi")); + } for (const auto& pset : ps.getParameter>("offsetsOOT")) { runParameters_.emplace_back( std::make_pair(pset.getParameter("validityRange"), pset.getParameter("centralOOT"))); @@ -500,10 +609,6 @@ CTPPSDiamondDQMSource::CTPPSDiamondDQMSource(const edm::ParameterSet& ps) //---------------------------------------------------------------------------------------------------- -CTPPSDiamondDQMSource::~CTPPSDiamondDQMSource() {} - -//---------------------------------------------------------------------------------------------------- - void CTPPSDiamondDQMSource::dqmBeginRun(const edm::Run& iRun, const edm::EventSetup& iSetup) { centralOOT_ = -999; for (const auto& oot : runParameters_) { @@ -515,38 +620,52 @@ void CTPPSDiamondDQMSource::dqmBeginRun(const edm::Run& iRun, const edm::EventSe // Get detector shifts from the geometry const CTPPSGeometry& geom = iSetup.getData(ctppsGeometryRunToken_); - const CTPPSDiamondDetId detid(0, CTPPS_DIAMOND_STATION_ID, CTPPS_DIAMOND_RP_ID, 0, 0); - const DetGeomDesc* det = geom.sensor(detid); - horizontalShiftOfDiamond_ = det->translation().x() - det->getDiamondDimensions().xHalfWidth; - - // Rough alignement of pixel detector for diamond thomography - const CTPPSPixelDetId pixid(0, CTPPS_PIXEL_STATION_ID, CTPPS_FAR_RP_ID, 0); - if (iRun.run() > 300000) { //Pixel installed - det = geom.sensor(pixid); - horizontalShiftBwDiamondPixels_ = - det->translation().x() - det->getDiamondDimensions().xHalfWidth - horizontalShiftOfDiamond_ - 1; - } + for (auto it = geom.beginRP(); it != geom.endRP(); ++it) + if (CTPPSDiamondDetId::check(it->first)) { + const CTPPSDiamondDetId diam_id(it->first); + const auto diam = geom.sensor(it->first); + diamShifts_[diam_id].global = diam->translation().x() - diam->getDiamondDimensions().xHalfWidth; + if (iRun.run() > FIRST_RUN_W_PIXELS) { // pixel installed + const CTPPSPixelDetId pixid(diam_id.arm(), CTPPS_PIXEL_STATION_ID, CTPPS_FAR_RP_ID); + auto pix = geom.sensor(pixid); + // Rough alignement of pixel detector for diamond tomography + diamShifts_[diam_id].withPixels = + pix->translation().x() - pix->getDiamondDimensions().xHalfWidth - diamShifts_[diam_id].global - 1.; + } + } } //---------------------------------------------------------------------------------------------------- -void CTPPSDiamondDQMSource::bookHistograms(DQMStore::IBooker& ibooker, const edm::Run&, const edm::EventSetup&) { +void CTPPSDiamondDQMSource::bookHistograms(DQMStore::IBooker& ibooker, const edm::Run&, const edm::EventSetup& iSetup) { ibooker.cd(); ibooker.setCurrentFolder("CTPPS"); globalPlot_ = GlobalPlots(ibooker); - for (unsigned short arm = 0; arm < CTPPS_NUM_OF_ARMS; ++arm) { - const CTPPSDiamondDetId rpId(arm, CTPPS_DIAMOND_STATION_ID, CTPPS_DIAMOND_RP_ID); - potPlots_[rpId] = PotPlots(ibooker, rpId); - for (unsigned short pl = 0; pl < CTPPS_DIAMOND_NUM_OF_PLANES; ++pl) { - const CTPPSDiamondDetId plId(arm, CTPPS_DIAMOND_STATION_ID, CTPPS_DIAMOND_RP_ID, pl); - planePlots_[plId] = PlanePlots(ibooker, plId); - for (unsigned short ch = 0; ch < CTPPS_DIAMOND_NUM_OF_CHANNELS; ++ch) { - const CTPPSDiamondDetId chId(arm, CTPPS_DIAMOND_STATION_ID, CTPPS_DIAMOND_RP_ID, pl, ch); - channelPlots_[chId] = ChannelPlots(ibooker, chId); - } - } + // book plots from the geometry + const CTPPSGeometry& geom = iSetup.getData(ctppsGeometryRunToken_); + for (auto it = geom.beginSensor(); it != geom.endSensor(); ++it) { + if (!CTPPSDiamondDetId::check(it->first)) + continue; + // per-channel plots + const CTPPSDiamondDetId chId(it->first); + if (plotOnline_ && channelPlots_.count(chId) == 0) + channelPlots_[chId] = ChannelPlots(ibooker, chId, windowsNum_); + + // per-plane plots + const CTPPSDiamondDetId plId(chId.planeId()); + if (planePlots_.count(plId) == 0) + planePlots_[plId] = PlanePlots(ibooker, plId, windowsNum_); + // per-pot plots + const CTPPSDiamondDetId rpId(chId.rpId()); + if (potPlots_.count(rpId) == 0) + potPlots_[rpId] = PotPlots(ibooker, rpId, windowsNum_, plotOnline_, plotOffline_); + + // per-sector plots + const CTPPSDiamondDetId secId(chId.armId()); + if (plotOffline_ && sectorPlots_.count(secId) == 0) + sectorPlots_[secId] = SectorPlots(ibooker, secId, plotOnline_); } } @@ -556,7 +675,7 @@ std::shared_ptr CTPPSDiamondDQMSource::globalBeginLuminosityBlock(co const edm::EventSetup&) const { auto d = std::make_shared(); d->hitDistribution2dMap.reserve(potPlots_.size()); - if (!perLSsaving_) { + if (!perLSsaving_ && plotOnline_) { for (auto& plot : potPlots_) d->hitDistribution2dMap[plot.first] = std::unique_ptr(static_cast(plot.second.hitDistribution2d_lumisection->getTH2F()->Clone())); @@ -568,18 +687,19 @@ std::shared_ptr CTPPSDiamondDQMSource::globalBeginLuminosityBlock(co void CTPPSDiamondDQMSource::analyze(const edm::Event& event, const edm::EventSetup& iSetup) { // get event data + edm::Handle> diamondVFATStatus; - event.getByToken(tokenStatus_, diamondVFATStatus); + edm::Handle> diamondDigis; + edm::Handle> fedInfo; + if (extract_digi_info_) { + event.getByToken(tokenStatus_, diamondVFATStatus); + event.getByToken(tokenDigi_, diamondDigis); + event.getByToken(tokenFEDInfo_, fedInfo); + } edm::Handle> pixelTracks; event.getByToken(tokenPixelTrack_, pixelTracks); - edm::Handle> diamondDigis; - event.getByToken(tokenDigi_, diamondDigis); - - edm::Handle> fedInfo; - event.getByToken(tokenFEDInfo_, fedInfo); - edm::Handle> diamondRecHits; event.getByToken(tokenDiamondHit_, diamondRecHits); @@ -587,32 +707,82 @@ void CTPPSDiamondDQMSource::analyze(const edm::Event& event, const edm::EventSet event.getByToken(tokenDiamondTrack_, diamondLocalTracks); const CTPPSGeometry* ctppsGeometry = &iSetup.getData(ctppsGeometryEventToken_); + // const LHCInfo* hLhcInfo = &iSetup.getData(ctppsLhcInfoToken_); // check validity bool valid = true; - valid &= diamondVFATStatus.isValid(); + if (extract_digi_info_) { // drop DIGI-level validity checks if not monitored + valid &= diamondVFATStatus.isValid(); + valid &= diamondDigis.isValid(); + valid &= fedInfo.isValid(); + } valid &= pixelTracks.isValid(); - valid &= diamondDigis.isValid(); - valid &= fedInfo.isValid(); valid &= diamondRecHits.isValid(); valid &= diamondLocalTracks.isValid(); if (!valid) { - if (verbosity_) { + if (verbosity_) edm::LogProblem("CTPPSDiamondDQMSource") << "ERROR in CTPPSDiamondDQMSource::analyze > some of the required inputs are not valid. Skipping this " "event.\n" + << " DIGI-level: (checked? " << std::boolalpha << extract_digi_info_ << ")\n" << " diamondVFATStatus.isValid = " << diamondVFATStatus.isValid() << "\n" - << " pixelTracks.isValid = " << pixelTracks.isValid() << "\n" << " diamondDigis.isValid = " << diamondDigis.isValid() << "\n" << " fedInfo.isValid = " << fedInfo.isValid() << "\n" + << " RECO-level:\n" + << " pixelTracks.isValid = " << pixelTracks.isValid() << "\n" << " diamondRecHits.isValid = " << diamondRecHits.isValid() << "\n" << " diamondLocalTracks.isValid = " << diamondLocalTracks.isValid(); - } - return; } + //------------------------------ + // Sector Plots + //------------------------------ + // Using CTPPSDiamondLocalTrack + if (plotOffline_) + for (const auto& tracks : *diamondLocalTracks) { + const CTPPSDiamondDetId detId_near(tracks.detId()); + + for (const auto& track : tracks) { + if (!track.isValid()) + continue; + if (potPlots_.count(detId_near.rpId()) == 0) + continue; + TH1F* trackHistoInTimeTmp = potPlots_[detId_near.rpId()].trackDistribution->getTH1F(); + int startBin_near = + trackHistoInTimeTmp->FindBin(track.x0() - diamShifts_[detId_near.rpId()].global - track.x0Sigma()); + int numOfBins_near = 2 * track.x0Sigma() * INV_DISPLAY_RESOLUTION_FOR_HITS_MM; + + for (const auto& tracks_far : *diamondLocalTracks) { + CTPPSDiamondDetId detId_far(tracks_far.detId()); + if (detId_near.arm() != detId_far.arm() || detId_near.station() == detId_far.station()) + continue; + for (const auto& track_far : tracks_far) { + if (!track.isValid()) + continue; + if (sectorPlots_.count(detId_far.armId()) == 0) + continue; + TH2F* trackHistoTmp = sectorPlots_[detId_far.armId()].trackCorrelation->getTH2F(); + TAxis* trackHistoTmpXAxis = trackHistoTmp->GetXaxis(); + TAxis* trackHistoTmpYAxis = trackHistoTmp->GetYaxis(); + int startBin_far = trackHistoTmpYAxis->FindBin(track_far.x0() - diamShifts_[detId_far.rpId()].global - + track_far.x0Sigma()); + int numOfBins_far = 2 * track_far.x0Sigma() * INV_DISPLAY_RESOLUTION_FOR_HITS_MM; + for (int i = 0; i < numOfBins_near; ++i) + for (int y = 0; y < numOfBins_far; ++y) { + trackHistoTmp->Fill(trackHistoTmpXAxis->GetBinCenter(startBin_near + i), + trackHistoTmpYAxis->GetBinCenter(startBin_far + y)); + if (tracks.size() < 3 && tracks_far.size() < trackCorrelationThreshold_) + sectorPlots_[detId_far.armId()].trackCorrelationLowMultiplicity->Fill( + trackHistoTmpXAxis->GetBinCenter(startBin_near + i), + trackHistoTmpYAxis->GetBinCenter(startBin_far + y)); + } + } + } + } + } + //------------------------------ // RP Plots //------------------------------ @@ -621,97 +791,69 @@ void CTPPSDiamondDQMSource::analyze(const edm::Event& event, const edm::EventSet // Correlation Plots //------------------------------ - // Using CTPPSDiamondDigi - for (const auto& digis : *diamondDigis) { - const CTPPSDiamondDetId detId(digis.detId()); - CTPPSDiamondDetId detId_pot(digis.detId()); - - for (const auto& digi : digis) { - detId_pot.setPlane(0); - detId_pot.setChannel(0); - if (detId.channel() == CHANNEL_OF_VFAT_CLOCK) - continue; - if (potPlots_.find(detId_pot) == potPlots_.end()) - continue; - //Leading without trailing investigation - if (digi.leadingEdge() != 0 || digi.trailingEdge() != 0) { - ++(potPlots_[detId_pot].HitCounter); - if (digi.leadingEdge() != 0) { - potPlots_[detId_pot].leadingEdgeCumulative_all->Fill(HPTDC_BIN_WIDTH_NS * digi.leadingEdge()); - } - if (digi.leadingEdge() != 0 && digi.trailingEdge() == 0) { - ++(potPlots_[detId_pot].LeadingOnlyCounter); - potPlots_[detId_pot].leadingEdgeCumulative_le->Fill(HPTDC_BIN_WIDTH_NS * digi.leadingEdge()); - } - if (digi.leadingEdge() == 0 && digi.trailingEdge() != 0) { - ++(potPlots_[detId_pot].TrailingOnlyCounter); - potPlots_[detId_pot].trailingEdgeCumulative_te->Fill(HPTDC_BIN_WIDTH_NS * digi.trailingEdge()); - } - if (digi.leadingEdge() != 0 && digi.trailingEdge() != 0) { - ++(potPlots_[detId_pot].CompleteCounter); - potPlots_[detId_pot].leadingTrailingCorrelationPot->Fill(HPTDC_BIN_WIDTH_NS * digi.leadingEdge(), - HPTDC_BIN_WIDTH_NS * digi.trailingEdge()); + if (extract_digi_info_) { + // Using CTPPSDiamondDigi + for (const auto& digis : *diamondDigis) { + const CTPPSDiamondDetId detId(digis.detId()), detId_pot(detId.rpId()); + for (const auto& digi : digis) { + if (detId.channel() == CHANNEL_OF_VFAT_CLOCK) + continue; + if (potPlots_.count(detId_pot) == 0) + continue; + //Leading without trailing investigation + if (digi.leadingEdge() != 0 || digi.trailingEdge() != 0) { + ++potPlots_[detId_pot].HitCounter; + if (digi.leadingEdge() != 0) { + potPlots_[detId_pot].leadingEdgeCumulative_all->Fill(HPTDC_BIN_WIDTH_NS * digi.leadingEdge()); + } + if (digi.leadingEdge() != 0 && digi.trailingEdge() == 0) { + ++potPlots_[detId_pot].LeadingOnlyCounter; + potPlots_[detId_pot].leadingEdgeCumulative_le->Fill(HPTDC_BIN_WIDTH_NS * digi.leadingEdge()); + } + if (digi.leadingEdge() == 0 && digi.trailingEdge() != 0) { + ++potPlots_[detId_pot].TrailingOnlyCounter; + potPlots_[detId_pot].trailingEdgeCumulative_te->Fill(HPTDC_BIN_WIDTH_NS * digi.trailingEdge()); + } + if (digi.leadingEdge() != 0 && digi.trailingEdge() != 0) { + ++potPlots_[detId_pot].CompleteCounter; + // potPlots_[detId_pot].leadingTrailingCorrelationPot->Fill(HPTDC_BIN_WIDTH_NS * digi.leadingEdge(), + // HPTDC_BIN_WIDTH_NS * digi.trailingEdge()); + } } - } - // HPTDC Errors - const HPTDCErrorFlags hptdcErrors = digi.hptdcErrorFlags(); - if (detId.channel() == 6 || detId.channel() == 7) // ch6 for HPTDC 0 and ch7 for HPTDC 1 - { - int verticalIndex = 2 * detId.plane() + (detId.channel() - 6); - for (unsigned short hptdcErrorIndex = 1; hptdcErrorIndex < 16; ++hptdcErrorIndex) - if (hptdcErrors.errorId(hptdcErrorIndex - 1)) - potPlots_[detId_pot].HPTDCErrorFlags_2D->Fill(hptdcErrorIndex, verticalIndex); + // HPTDC Errors + const HPTDCErrorFlags hptdcErrors = digi.hptdcErrorFlags(); + if (detId.channel() == HPTDC_0_CHANNEL || + detId.channel() == HPTDC_1_CHANNEL) { // ch6 for HPTDC 0 and ch7 for HPTDC 1 + int verticalIndex = 2 * detId.plane() + (detId.channel() - HPTDC_0_CHANNEL); + for (unsigned short hptdcErrorIndex = 1; hptdcErrorIndex < 16; ++hptdcErrorIndex) + if (hptdcErrors.errorId(hptdcErrorIndex - 1)) + potPlots_[detId_pot].HPTDCErrorFlags_2D->Fill(hptdcErrorIndex, verticalIndex); + } + if (digi.multipleHit()) + ++potPlots_[detId_pot].MHCounter; } - if (digi.multipleHit()) - ++(potPlots_[detId_pot].MHCounter); } } // EC Errors - for (const auto& vfat_status : *diamondVFATStatus) { - const CTPPSDiamondDetId detId(vfat_status.detId()); - CTPPSDiamondDetId detId_pot(vfat_status.detId()); - detId_pot.setPlane(0); - detId_pot.setChannel(0); - for (const auto& status : vfat_status) { - if (!status.isOK()) - continue; - if (potPlots_.find(detId_pot) == potPlots_.end()) - continue; - if (channelPlots_.find(detId) == channelPlots_.end()) - continue; + if (extract_digi_info_) { + for (const auto& vfat_status : *diamondVFATStatus) { + const CTPPSDiamondDetId detId(vfat_status.detId()); + for (const auto& status : vfat_status) { + if (!status.isOK()) + continue; + if (potPlots_.count(detId.rpId()) == 0) + continue; + if (channelPlots_.count(detId) == 0) + continue; - // Check Event Number - for (const auto& optorx : *fedInfo) { - if (detId.arm() == 1 && optorx.fedId() == CTPPS_FED_ID_56) { - potPlots_[detId_pot].ECCheck->Fill((int)((optorx.lv1() & 0xFF) - ((unsigned int)status.ec() & 0xFF)) & 0xFF); - if ((static_cast((optorx.lv1() & 0xFF) - status.ec()) != EC_difference_56_) && - (static_cast((optorx.lv1() & 0xFF) - status.ec()) < 128)) - EC_difference_56_ = static_cast(optorx.lv1() & 0xFF) - (static_cast(status.ec()) & 0xFF); - if (EC_difference_56_ != 1 && EC_difference_56_ != -500 && std::abs(EC_difference_56_) < 127) { - if (detId.channel() == 6 || detId.channel() == 7) - potPlots_[detId_pot].HPTDCErrorFlags_2D->Fill(16, 2 * detId.plane() + (detId.channel() - 6)); - if (verbosity_) - edm::LogProblem("CTPPSDiamondDQMSource") - << "FED " << CTPPS_FED_ID_56 << ": ECError at EV: 0x" << std::hex << optorx.lv1() << "\t\tVFAT EC: 0x" - << static_cast(status.ec()) << "\twith ID: " << std::dec << detId - << "\tdiff: " << EC_difference_56_; - } - } else if (detId.arm() == 0 && optorx.fedId() == CTPPS_FED_ID_45) { - potPlots_[detId_pot].ECCheck->Fill((int)((optorx.lv1() & 0xFF) - status.ec()) & 0xFF); - if ((static_cast((optorx.lv1() & 0xFF) - status.ec()) != EC_difference_45_) && - (static_cast((optorx.lv1() & 0xFF) - status.ec()) < 128)) - EC_difference_45_ = static_cast(optorx.lv1() & 0xFF) - (static_cast(status.ec()) & 0xFF); - if (EC_difference_45_ != 1 && EC_difference_45_ != -500 && std::abs(EC_difference_45_) < 127) { - if (detId.channel() == 6 || detId.channel() == 7) - potPlots_[detId_pot].HPTDCErrorFlags_2D->Fill(16, 2 * detId.plane() + (detId.channel() - 6)); - if (verbosity_) - edm::LogProblem("CTPPSDiamondDQMSource") - << "FED " << CTPPS_FED_ID_45 << ": ECError at EV: 0x" << std::hex << optorx.lv1() << "\t\tVFAT EC: 0x" - << static_cast(status.ec()) << "\twith ID: " << std::dec << detId - << "\tdiff: " << EC_difference_45_; - } + // Check Event Number + for (const auto& optorx : *fedInfo) { + if (detId.arm() == 1 && optorx.fedId() == CTPPS_FED_ID_56) + checkEventNumber(detId, optorx, status, potPlots_[detId.rpId()], EC_difference_56_); + else if (detId.arm() == 0 && optorx.fedId() == CTPPS_FED_ID_45) + checkEventNumber(detId, optorx, status, potPlots_[detId.rpId()], EC_difference_45_); } } } @@ -723,10 +865,8 @@ void CTPPSDiamondDQMSource::analyze(const edm::Event& event, const edm::EventSet auto lumiCache = luminosityBlockCache(event.getLuminosityBlock().index()); for (const auto& rechits : *diamondRecHits) { - CTPPSDiamondDetId detId_pot(rechits.detId()); - detId_pot.setPlane(0); - detId_pot.setChannel(0); - const CTPPSDiamondDetId detId(rechits.detId()); + const CTPPSDiamondDetId detId(rechits.detId()), detId_pot(detId.rpId()); + const auto& x_shift = diamShifts_.at(detId_pot); for (const auto& rechit : rechits) { planes_inclusive[detId_pot].insert(detId.plane()); @@ -735,9 +875,11 @@ void CTPPSDiamondDQMSource::analyze(const edm::Event& event, const edm::EventSet if (rechit.toT() != 0 && centralOOT_ != -999 && rechit.ootIndex() == centralOOT_) planes[detId_pot].insert(detId.plane()); - if (potPlots_.find(detId_pot) == potPlots_.end()) + if (potPlots_.count(detId_pot) == 0) continue; + potPlots_[detId_pot].recHitTime->Fill(rechit.time()); + float UFSDShift = 0.0; if (rechit.yWidth() < 3) UFSDShift = 0.5; // Display trick for UFSD that have 2 pixels with same X @@ -745,20 +887,18 @@ void CTPPSDiamondDQMSource::analyze(const edm::Event& event, const edm::EventSet if (rechit.toT() != 0 && centralOOT_ != -999 && rechit.ootIndex() == centralOOT_) { TH2F* hitHistoTmp = potPlots_[detId_pot].hitDistribution2d->getTH2F(); TAxis* hitHistoTmpYAxis = hitHistoTmp->GetYaxis(); - int startBin = hitHistoTmpYAxis->FindBin(rechit.x() - horizontalShiftOfDiamond_ - 0.5 * rechit.xWidth()); + int startBin = hitHistoTmpYAxis->FindBin(rechit.x() - x_shift.global - 0.5 * rechit.xWidth()); int numOfBins = rechit.xWidth() * INV_DISPLAY_RESOLUTION_FOR_HITS_MM; - for (int i = 0; i < numOfBins; ++i) { + for (int i = 0; i < numOfBins; ++i) hitHistoTmp->Fill(detId.plane() + UFSDShift, hitHistoTmpYAxis->GetBinCenter(startBin + i)); - } - if (!perLSsaving_) { + if (!perLSsaving_ && plotOnline_) { hitHistoTmp = lumiCache->hitDistribution2dMap[detId_pot].get(); hitHistoTmpYAxis = hitHistoTmp->GetYaxis(); - startBin = hitHistoTmpYAxis->FindBin(rechit.x() - horizontalShiftOfDiamond_ - 0.5 * rechit.xWidth()); + startBin = hitHistoTmpYAxis->FindBin(rechit.x() - x_shift.global - 0.5 * rechit.xWidth()); numOfBins = rechit.xWidth() * INV_DISPLAY_RESOLUTION_FOR_HITS_MM; - for (int i = 0; i < numOfBins; ++i) { + for (int i = 0; i < numOfBins; ++i) hitHistoTmp->Fill(detId.plane() + UFSDShift, hitHistoTmpYAxis->GetBinCenter(startBin + i)); - } } } @@ -769,42 +909,41 @@ void CTPPSDiamondDQMSource::analyze(const edm::Event& event, const edm::EventSet TH2F* hitHistoOOTTmp = potPlots_[detId_pot].hitDistribution2dOOT->getTH2F(); TAxis* hitHistoOOTTmpYAxis = hitHistoOOTTmp->GetYaxis(); - int startBin = hitHistoOOTTmpYAxis->FindBin(rechit.x() - horizontalShiftOfDiamond_ - 0.5 * rechit.xWidth()); + int startBin = hitHistoOOTTmpYAxis->FindBin(rechit.x() - x_shift.global - 0.5 * rechit.xWidth()); + int numOfBins = rechit.xWidth() * INV_DISPLAY_RESOLUTION_FOR_HITS_MM; + for (int i = 0; i < numOfBins; ++i) + hitHistoOOTTmp->Fill(detId.plane() + 0.25 * rechit.ootIndex(), + hitHistoOOTTmpYAxis->GetBinCenter(startBin + i)); + } else if (rechit.ootIndex() != CTPPSDiamondRecHit::TIMESLICE_WITHOUT_LEADING && plotOnline_) { + // Only leading + TH2F* hitHistoOOTTmp = potPlots_[detId_pot].hitDistribution2dOOT_le->getTH2F(); + TAxis* hitHistoOOTTmpYAxis = hitHistoOOTTmp->GetYaxis(); + int startBin = hitHistoOOTTmpYAxis->FindBin(rechit.x() - x_shift.global - 0.5 * rechit.xWidth()); int numOfBins = rechit.xWidth() * INV_DISPLAY_RESOLUTION_FOR_HITS_MM; for (int i = 0; i < numOfBins; ++i) { hitHistoOOTTmp->Fill(detId.plane() + 0.25 * rechit.ootIndex(), hitHistoOOTTmpYAxis->GetBinCenter(startBin + i)); } - } else { - if (rechit.ootIndex() != CTPPSDiamondRecHit::TIMESLICE_WITHOUT_LEADING) { - // Only leading - TH2F* hitHistoOOTTmp = potPlots_[detId_pot].hitDistribution2dOOT_le->getTH2F(); - TAxis* hitHistoOOTTmpYAxis = hitHistoOOTTmp->GetYaxis(); - int startBin = hitHistoOOTTmpYAxis->FindBin(rechit.x() - horizontalShiftOfDiamond_ - 0.5 * rechit.xWidth()); - int numOfBins = rechit.xWidth() * INV_DISPLAY_RESOLUTION_FOR_HITS_MM; - for (int i = 0; i < numOfBins; ++i) { - hitHistoOOTTmp->Fill(detId.plane() + 0.25 * rechit.ootIndex(), - hitHistoOOTTmpYAxis->GetBinCenter(startBin + i)); - } - } } if (rechit.ootIndex() != CTPPSDiamondRecHit::TIMESLICE_WITHOUT_LEADING && potPlots_[detId_pot].activity_per_bx.count(rechit.ootIndex()) > 0) potPlots_[detId_pot].activity_per_bx.at(rechit.ootIndex())->Fill(event.bunchCrossing()); + + // if(plotOffline_) + // potPlots_[detId_pot].TOTVsLS->Fill(event.luminosityBlock(),rechit.toT()); } } for (const auto& plt : potPlots_) { plt.second.activePlanes->Fill(planes[plt.first].size()); - plt.second.activePlanesInclusive->Fill(planes_inclusive[plt.first].size()); + if (plotOnline_) + plt.second.activePlanesInclusive->Fill(planes_inclusive[plt.first].size()); } // Using CTPPSDiamondLocalTrack for (const auto& tracks : *diamondLocalTracks) { - CTPPSDiamondDetId detId_pot(tracks.detId()); - detId_pot.setPlane(0); - detId_pot.setChannel(0); - const CTPPSDiamondDetId detId(tracks.detId()); + const CTPPSDiamondDetId detId(tracks.detId()), detId_pot(detId.rpId()); + const auto& x_shift = diamShifts_.at(detId_pot); for (const auto& track : tracks) { if (!track.isValid()) @@ -813,33 +952,34 @@ void CTPPSDiamondDQMSource::analyze(const edm::Event& event, const edm::EventSet continue; if (excludeMultipleHits_ && track.multipleHits() > 0) continue; - if (potPlots_.find(detId_pot) == potPlots_.end()) + if (potPlots_.count(detId_pot) == 0) continue; TH2F* trackHistoOOTTmp = potPlots_[detId_pot].trackDistributionOOT->getTH2F(); TAxis* trackHistoOOTTmpYAxis = trackHistoOOTTmp->GetYaxis(); - int startBin = trackHistoOOTTmpYAxis->FindBin(track.x0() - horizontalShiftOfDiamond_ - track.x0Sigma()); + int startBin = trackHistoOOTTmpYAxis->FindBin(track.x0() - x_shift.global - track.x0Sigma()); int numOfBins = 2 * track.x0Sigma() * INV_DISPLAY_RESOLUTION_FOR_HITS_MM; - for (int i = 0; i < numOfBins; ++i) { + for (int i = 0; i < numOfBins; ++i) trackHistoOOTTmp->Fill(track.ootIndex(), trackHistoOOTTmpYAxis->GetBinCenter(startBin + i)); - } if (centralOOT_ != -999 && track.ootIndex() == centralOOT_) { TH1F* trackHistoInTimeTmp = potPlots_[detId_pot].trackDistribution->getTH1F(); - int startBin = trackHistoInTimeTmp->FindBin(track.x0() - horizontalShiftOfDiamond_ - track.x0Sigma()); + int startBin = trackHistoInTimeTmp->FindBin(track.x0() - x_shift.global - track.x0Sigma()); int numOfBins = 2 * track.x0Sigma() * INV_DISPLAY_RESOLUTION_FOR_HITS_MM; - for (int i = 0; i < numOfBins; ++i) { + for (int i = 0; i < numOfBins; ++i) trackHistoInTimeTmp->Fill(trackHistoInTimeTmp->GetBinCenter(startBin + i)); - } + } + if (plotOffline_) { + // potPlots_[detId_pot].trackTimeVsLS->Fill(event.luminosityBlock(),track.time()); + potPlots_[detId_pot].trackTimeVsBX->Fill(event.bunchCrossing(), track.time()); + //potPlots_[detId_pot].trackTimeVsXAngle->Fill(hLhcInfo->crossingAngle(), track.time()); } } } // Channel efficiency using CTPPSDiamondLocalTrack for (const auto& tracks : *diamondLocalTracks) { - CTPPSDiamondDetId detId_pot(tracks.detId()); - detId_pot.setPlane(0); - detId_pot.setChannel(0); + const CTPPSDiamondDetId detId(tracks.detId()), detId_pot(detId.rpId()); for (const auto& track : tracks) { // Find hits and planes in the track int numOfHits = 0; @@ -859,29 +999,24 @@ void CTPPSDiamondDQMSource::analyze(const edm::Event& event, const edm::EventSet } if (numOfHits > 0 && numOfHits <= 10 && planesInTrackSet.size() > 2) { - for (int plane = 0; plane < 4; ++plane) { - for (int channel = 0; channel < 12; ++channel) { - int map_index = plane * 100 + channel; - if (potPlots_[detId_pot].effDoublecountingChMap.find(map_index) == - potPlots_[detId_pot].effDoublecountingChMap.end()) { - potPlots_[detId_pot].effTriplecountingChMap[map_index] = 0; - potPlots_[detId_pot].effDoublecountingChMap[map_index] = 0; - } - CTPPSDiamondDetId detId(detId_pot.arm(), CTPPS_DIAMOND_STATION_ID, CTPPS_DIAMOND_RP_ID, plane, channel); - if (channelAlignedWithTrack(ctppsGeometry, detId, track, 0.2)) { - // Channel should fire - ++(potPlots_[detId_pot].effDoublecountingChMap[map_index]); - for (const auto& rechits : *diamondRecHits) { - CTPPSDiamondDetId detId_hit(rechits.detId()); - if (detId_hit == detId) { - for (const auto& rechit : rechits) { - if (track.containsHit(rechit, 1)) { - // Channel fired - ++(potPlots_[detId_pot].effTriplecountingChMap[map_index]); - } - } - } - } + for (const auto& plt_vs_ch : channelPlots_) { // loop over all channels registered in geometry + const CTPPSDiamondDetId detId(plt_vs_ch.first); + if (detId.rpId() != detId_pot) + continue; + const unsigned short map_index = detId.plane() * 100 + detId.channel(); + if (potPlots_[detId_pot].effDoublecountingChMap.count(map_index) == 0) { + potPlots_[detId_pot].effTriplecountingChMap[map_index] = 0; + potPlots_[detId_pot].effDoublecountingChMap[map_index] = 0; + } + if (channelAlignedWithTrack(ctppsGeometry, detId, track, 0.2)) { + // Channel should fire + ++potPlots_[detId_pot].effDoublecountingChMap[map_index]; + for (const auto& rechits : *diamondRecHits) { + const CTPPSDiamondDetId detId_hit(rechits.detId()); + if (detId_hit == detId) + for (const auto& rechit : rechits) + if (track.containsHit(rechit, 1)) // Channel fired + ++potPlots_[detId_pot].effTriplecountingChMap[map_index]; } } } @@ -891,10 +1026,8 @@ void CTPPSDiamondDQMSource::analyze(const edm::Event& event, const edm::EventSet // Tomography of diamonds using pixel for (const auto& rechits : *diamondRecHits) { - CTPPSDiamondDetId detId_pot(rechits.detId()); - detId_pot.setPlane(0); - detId_pot.setChannel(0); - const CTPPSDiamondDetId detId(rechits.detId()); + const CTPPSDiamondDetId detId(rechits.detId()), detId_pot(detId.rpId()); + const auto pix_shift = diamShifts_.at(detId_pot).withPixels; for (const auto& rechit : rechits) { if (excludeMultipleHits_ && rechit.multipleHits() > 0) continue; @@ -902,7 +1035,7 @@ void CTPPSDiamondDQMSource::analyze(const edm::Event& event, const edm::EventSet continue; if (!pixelTracks.isValid()) continue; - if (potPlots_.find(detId_pot) == potPlots_.end()) + if (potPlots_.count(detId_pot) == 0) continue; for (const auto& ds : *pixelTracks) { @@ -914,11 +1047,10 @@ void CTPPSDiamondDQMSource::analyze(const edm::Event& event, const edm::EventSet for (const auto& lt : ds) { if (lt.isValid() && pixId.arm() == detId_pot.arm()) { if (rechit.ootIndex() != CTPPSDiamondRecHit::TIMESLICE_WITHOUT_LEADING && rechit.ootIndex() >= 0 && - potPlots_[detId_pot].pixelTomographyAll.count(rechit.ootIndex()) > 0 && - lt.x0() - horizontalShiftBwDiamondPixels_ < 24) + potPlots_[detId_pot].pixelTomographyAll.count(rechit.ootIndex()) > 0 && lt.x0() - pix_shift < 24) potPlots_[detId_pot] .pixelTomographyAll.at(rechit.ootIndex()) - ->Fill(lt.x0() - horizontalShiftBwDiamondPixels_ + 25 * detId.plane(), lt.y0()); + ->Fill(lt.x0() - pix_shift + 25 * detId.plane(), lt.y0()); } } } @@ -930,11 +1062,8 @@ void CTPPSDiamondDQMSource::analyze(const edm::Event& event, const edm::EventSet //------------------------------ // Commented out to save space in the DQM files, but code should be kept // for ( const auto& digis : *diamondDigis ) { - // const CTPPSDiamondDetId detId( digis.detId() ); - // CTPPSDiamondDetId detId_pot( digis.detId() ); + // const CTPPSDiamondDetId detId(digis.detId()), detId_pot(detId.rpId()); // if ( detId.channel() == CHANNEL_OF_VFAT_CLOCK ) { - // detId_pot.setPlane( 0 ); - // detId_pot.setChannel( 0 ); // for ( const auto& digi : digis ) { // if ( digi.leadingEdge() != 0 ) { // if ( detId.plane() == 1 ) { @@ -956,47 +1085,41 @@ void CTPPSDiamondDQMSource::analyze(const edm::Event& event, const edm::EventSet // Using CTPPSDiamondDigi std::unordered_map channelsPerPlane; - for (const auto& digis : *diamondDigis) { - const CTPPSDiamondDetId detId(digis.detId()); - CTPPSDiamondDetId detId_plane(digis.detId()); - for (const auto& digi : digis) { - detId_plane.setChannel(0); - if (detId.channel() == CHANNEL_OF_VFAT_CLOCK) - continue; - if (planePlots_.find(detId_plane) == planePlots_.end()) - continue; + if (extract_digi_info_) { + for (const auto& digis : *diamondDigis) { + const CTPPSDiamondDetId detId(digis.detId()), detId_plane(detId.planeId()); + for (const auto& digi : digis) { + if (detId.channel() == CHANNEL_OF_VFAT_CLOCK) + continue; + if (planePlots_.count(detId_plane) == 0) + continue; - if (digi.leadingEdge() != 0) { - planePlots_[detId_plane].digiProfileCumulativePerPlane->Fill(detId.channel()); - if (channelsPerPlane.find(detId_plane) != channelsPerPlane.end()) + if (digi.leadingEdge() != 0) { + planePlots_[detId_plane].digiProfileCumulativePerPlane->Fill(detId.channel()); channelsPerPlane[detId_plane]++; - else - channelsPerPlane[detId_plane] = 0; + } } } } - for (const auto& plt : channelsPerPlane) { + for (const auto& plt : channelsPerPlane) planePlots_[plt.first].hit_multiplicity->Fill(plt.second); - } // Using CTPPSDiamondRecHit for (const auto& rechits : *diamondRecHits) { - CTPPSDiamondDetId detId_plane(rechits.detId()); - detId_plane.setChannel(0); + const CTPPSDiamondDetId detId(rechits.detId()), detId_plane(detId.planeId()), detId_pot(detId.rpId()); for (const auto& rechit : rechits) { if (excludeMultipleHits_ && rechit.multipleHits() > 0) continue; if (rechit.toT() == 0) continue; - if (planePlots_.find(detId_plane) != planePlots_.end()) { + if (planePlots_.count(detId_plane) != 0) { if (centralOOT_ != -999 && rechit.ootIndex() == centralOOT_) { TH1F* hitHistoTmp = planePlots_[detId_plane].hitProfile->getTH1F(); - int startBin = hitHistoTmp->FindBin(rechit.x() - horizontalShiftOfDiamond_ - 0.5 * rechit.xWidth()); + int startBin = hitHistoTmp->FindBin(rechit.x() - diamShifts_.at(detId_pot).global - 0.5 * rechit.xWidth()); int numOfBins = rechit.xWidth() * INV_DISPLAY_RESOLUTION_FOR_HITS_MM; - for (int i = 0; i < numOfBins; ++i) { + for (int i = 0; i < numOfBins; ++i) hitHistoTmp->Fill(hitHistoTmp->GetBinCenter(startBin + i)); - } } } } @@ -1011,24 +1134,27 @@ void CTPPSDiamondDQMSource::analyze(const edm::Event& event, const edm::EventSet continue; for (const auto& lt : ds) { if (lt.isValid()) { - // For efficieny - CTPPSDiamondDetId detId_pot(pixId.arm(), CTPPS_DIAMOND_STATION_ID, CTPPS_DIAMOND_RP_ID); - potPlots_[detId_pot].pixelTracksMap.Fill(lt.x0() - horizontalShiftBwDiamondPixels_, lt.y0()); + for (const auto& sh_vs_id : diamShifts_) { + const CTPPSDiamondDetId& detId_pot = sh_vs_id.first; + const auto& shift = sh_vs_id.second; + if (detId_pot.arm() == pixId.arm()) + // For efficieny + potPlots_[detId_pot].pixelTracksMap.Fill(lt.x0() - shift.withPixels, lt.y0()); + } std::set planesWitHits_set; for (const auto& rechits : *diamondRecHits) { - CTPPSDiamondDetId detId_plane(rechits.detId()); - detId_plane.setChannel(0); + const CTPPSDiamondDetId detId(rechits.detId()), detId_plane(detId.planeId()), detId_pot(detId.rpId()); + const auto pix_shift = diamShifts_.at(detId_pot).withPixels; for (const auto& rechit : rechits) { if (excludeMultipleHits_ && rechit.multipleHits() > 0) continue; if (rechit.ootIndex() == CTPPSDiamondRecHit::TIMESLICE_WITHOUT_LEADING || rechit.toT() == 0) continue; - if (planePlots_.find(detId_plane) == planePlots_.end()) + if (planePlots_.count(detId_plane) == 0) continue; - if (pixId.arm() == detId_plane.arm() && lt.x0() - horizontalShiftBwDiamondPixels_ < 24) { - planePlots_[detId_plane].pixelTomography_far->Fill( - lt.x0() - horizontalShiftBwDiamondPixels_ + 25 * rechit.ootIndex(), lt.y0()); + if (pixId.arm() == detId_plane.arm() && lt.x0() - pix_shift < 24) { + planePlots_[detId_plane].pixelTomography_far->Fill(lt.x0() - pix_shift + 25 * rechit.ootIndex(), lt.y0()); if (centralOOT_ != -999 && rechit.ootIndex() == centralOOT_) planesWitHits_set.insert(detId_plane); } @@ -1036,7 +1162,8 @@ void CTPPSDiamondDQMSource::analyze(const edm::Event& event, const edm::EventSet } for (auto& planeId : planesWitHits_set) - planePlots_[planeId].pixelTracksMapWithDiamonds.Fill(lt.x0() - horizontalShiftBwDiamondPixels_, lt.y0()); + planePlots_[planeId].pixelTracksMapWithDiamonds.Fill(lt.x0() - diamShifts_.at(planeId.rpId()).withPixels, + lt.y0()); } } } @@ -1046,35 +1173,35 @@ void CTPPSDiamondDQMSource::analyze(const edm::Event& event, const edm::EventSet //------------------------------ // digi profile cumulative - for (const auto& digis : *diamondDigis) { - const CTPPSDiamondDetId detId(digis.detId()); - for (const auto& digi : digis) { - if (detId.channel() == CHANNEL_OF_VFAT_CLOCK) - continue; - if (channelPlots_.find(detId) != channelPlots_.end()) { - // HPTDC Errors - const HPTDCErrorFlags hptdcErrors = digi.hptdcErrorFlags(); - for (unsigned short hptdcErrorIndex = 1; hptdcErrorIndex < 16; ++hptdcErrorIndex) - if (hptdcErrors.errorId(hptdcErrorIndex - 1)) - channelPlots_[detId].HPTDCErrorFlags->Fill(hptdcErrorIndex); - if (digi.multipleHit()) - ++(channelPlots_[detId].MHCounter); - - // Check dropped trailing edges - if (digi.leadingEdge() != 0 || digi.trailingEdge() != 0) { - ++(channelPlots_[detId].HitCounter); - if (digi.leadingEdge() != 0 && digi.trailingEdge() == 0) { - ++(channelPlots_[detId].LeadingOnlyCounter); - channelPlots_[detId].leadingEdgeCumulative_le->Fill(HPTDC_BIN_WIDTH_NS * digi.leadingEdge()); - } - if (digi.leadingEdge() == 0 && digi.trailingEdge() != 0) { - ++(channelPlots_[detId].TrailingOnlyCounter); - channelPlots_[detId].trailingEdgeCumulative_te->Fill(HPTDC_BIN_WIDTH_NS * digi.trailingEdge()); - } - if (digi.leadingEdge() != 0 && digi.trailingEdge() != 0) { - ++(channelPlots_[detId].CompleteCounter); - channelPlots_[detId].LeadingTrailingCorrelationPerChannel->Fill(HPTDC_BIN_WIDTH_NS * digi.leadingEdge(), - HPTDC_BIN_WIDTH_NS * digi.trailingEdge()); + if (extract_digi_info_) { + for (const auto& digis : *diamondDigis) { + const CTPPSDiamondDetId detId(digis.detId()); + for (const auto& digi : digis) { + if (detId.channel() == CHANNEL_OF_VFAT_CLOCK) + continue; + if (channelPlots_.count(detId) != 0) { + // HPTDC Errors + const HPTDCErrorFlags hptdcErrors = digi.hptdcErrorFlags(); + for (unsigned short hptdcErrorIndex = 1; hptdcErrorIndex < 16; ++hptdcErrorIndex) + if (hptdcErrors.errorId(hptdcErrorIndex - 1)) + channelPlots_[detId].HPTDCErrorFlags->Fill(hptdcErrorIndex); + if (digi.multipleHit()) + ++channelPlots_[detId].MHCounter; + + // Check dropped trailing edges + if (digi.leadingEdge() != 0 || digi.trailingEdge() != 0) { + ++channelPlots_[detId].HitCounter; + if (digi.trailingEdge() == 0) { + ++channelPlots_[detId].LeadingOnlyCounter; + channelPlots_[detId].leadingEdgeCumulative_le->Fill(HPTDC_BIN_WIDTH_NS * digi.leadingEdge()); + } else if (digi.leadingEdge() == 0) { + ++channelPlots_[detId].TrailingOnlyCounter; + channelPlots_[detId].trailingEdgeCumulative_te->Fill(HPTDC_BIN_WIDTH_NS * digi.trailingEdge()); + } else { + ++channelPlots_[detId].CompleteCounter; + // channelPlots_[detId].LeadingTrailingCorrelationPerChannel->Fill(HPTDC_BIN_WIDTH_NS * digi.leadingEdge(), + // HPTDC_BIN_WIDTH_NS * digi.trailingEdge()); + } } } } @@ -1088,23 +1215,25 @@ void CTPPSDiamondDQMSource::analyze(const edm::Event& event, const edm::EventSet for (const auto& rechit : rechits) { if (excludeMultipleHits_ && rechit.multipleHits() > 0) continue; - if (channelPlots_.find(detId) != channelPlots_.end()) { + if (channelPlots_.count(detId) != 0) { + channelPlots_[detId].recHitTime->Fill(rechit.time()); if (rechit.ootIndex() != CTPPSDiamondRecHit::TIMESLICE_WITHOUT_LEADING && rechit.toT() != 0) { channelPlots_[detId].leadingEdgeCumulative_both->Fill(rechit.time() + 25 * rechit.ootIndex()); channelPlots_[detId].TimeOverThresholdCumulativePerChannel->Fill(rechit.toT()); } - ++(lumiCache->hitsCounterMap[detId]); - } + ++lumiCache->hitsCounterMap[detId]; - if (rechit.ootIndex() != CTPPSDiamondRecHit::TIMESLICE_WITHOUT_LEADING && - channelPlots_[detId].activity_per_bx.count(rechit.ootIndex()) > 0) - channelPlots_[detId].activity_per_bx.at(rechit.ootIndex())->Fill(event.bunchCrossing()); + if (rechit.ootIndex() != CTPPSDiamondRecHit::TIMESLICE_WITHOUT_LEADING && + channelPlots_[detId].activity_per_bx.count(rechit.ootIndex()) > 0) + channelPlots_[detId].activity_per_bx.at(rechit.ootIndex())->Fill(event.bunchCrossing()); + } } } // Tomography of diamonds using pixel for (const auto& rechits : *diamondRecHits) { - const CTPPSDiamondDetId detId(rechits.detId()); + const CTPPSDiamondDetId detId(rechits.detId()), detId_pot(detId.rpId()); + const auto shift_pix = diamShifts_.at(detId_pot).withPixels; for (const auto& rechit : rechits) { if (excludeMultipleHits_ && rechit.multipleHits() > 0) continue; @@ -1112,7 +1241,7 @@ void CTPPSDiamondDQMSource::analyze(const edm::Event& event, const edm::EventSet continue; if (!pixelTracks.isValid()) continue; - if (channelPlots_.find(detId) == channelPlots_.end()) + if (channelPlots_.count(detId) == 0) continue; for (const auto& ds : *pixelTracks) { @@ -1122,9 +1251,8 @@ void CTPPSDiamondDQMSource::analyze(const edm::Event& event, const edm::EventSet if (ds.size() > 1) continue; for (const auto& lt : ds) { - if (lt.isValid() && pixId.arm() == detId.arm() && lt.x0() - horizontalShiftBwDiamondPixels_ < 24) - channelPlots_[detId].pixelTomography_far->Fill( - lt.x0() - horizontalShiftBwDiamondPixels_ + 25 * rechit.ootIndex(), lt.y0()); + if (lt.isValid() && pixId.arm() == detId.arm() && lt.x0() - shift_pix < 24) + channelPlots_[detId].pixelTomography_far->Fill(lt.x0() - shift_pix + 25 * rechit.ootIndex(), lt.y0()); } } } @@ -1136,9 +1264,10 @@ void CTPPSDiamondDQMSource::analyze(const edm::Event& event, const edm::EventSet void CTPPSDiamondDQMSource::globalEndLuminosityBlock(const edm::LuminosityBlock& iLumi, const edm::EventSetup&) { auto lumiCache = luminosityBlockCache(iLumi.index()); if (!perLSsaving_) { - for (auto& plot : potPlots_) { - *(plot.second.hitDistribution2d_lumisection->getTH2F()) = *(lumiCache->hitDistribution2dMap[plot.first]); - } + if (plotOnline_) + for (auto& plot : potPlots_) { + *(plot.second.hitDistribution2d_lumisection->getTH2F()) = *(lumiCache->hitDistribution2dMap[plot.first]); + } for (auto& plot : channelPlots_) { auto hitsCounterPerLumisection = lumiCache->hitsCounterMap[plot.first]; @@ -1167,9 +1296,9 @@ void CTPPSDiamondDQMSource::globalEndLuminosityBlock(const edm::LuminosityBlock& 3, HundredOverHitCounterPot * plot.second.CompleteCounter); plot.second.MHComprensive->Reset(); - CTPPSDiamondDetId rpId(plot.first); + const CTPPSDiamondDetId rpId(plot.first); for (auto& chPlot : channelPlots_) { - CTPPSDiamondDetId chId(chPlot.first); + const CTPPSDiamondDetId chId(chPlot.first); if (chId.arm() == rpId.arm() && chId.rp() == rpId.rp()) { plot.second.MHComprensive->Fill( chId.plane(), chId.channel(), chPlot.second.HPTDCErrorFlags->getBinContent(16)); @@ -1177,29 +1306,28 @@ void CTPPSDiamondDQMSource::globalEndLuminosityBlock(const edm::LuminosityBlock& } } // Efficiencies of single channels - for (auto& plot : potPlots_) { - plot.second.EfficiencyOfChannelsInPot->Reset(); - for (auto& element : plot.second.effTriplecountingChMap) { - if (plot.second.effDoublecountingChMap[element.first] > 0) { - int plane = element.first / 100; - int channel = element.first % 100; - double counted = element.second; - double total = plot.second.effDoublecountingChMap[element.first]; - double efficiency = counted / total; - // double error = std::sqrt( efficiency * ( 1 - efficiency ) / total ); - - plot.second.EfficiencyOfChannelsInPot->Fill(plane, channel, 100 * efficiency); + if (plotOnline_) + for (auto& plot : potPlots_) { + plot.second.EfficiencyOfChannelsInPot->Reset(); + for (auto& element : plot.second.effTriplecountingChMap) { + if (plot.second.effDoublecountingChMap[element.first] > 0) { + int plane = element.first / 100; + int channel = element.first % 100; + double counted = element.second; + double total = plot.second.effDoublecountingChMap[element.first]; + double efficiency = counted / total; + // double error = std::sqrt( efficiency * ( 1 - efficiency ) / total ); + + plot.second.EfficiencyOfChannelsInPot->Fill(plane, channel, 100 * efficiency); + } } } - } // Efficeincy wrt pixels //TODO for (auto& plot : planePlots_) { TH2F* hitHistoTmp = plot.second.EfficiencyWRTPixelsInPlane->getTH2F(); - CTPPSDiamondDetId detId_pot(plot.first); - detId_pot.setPlane(0); - + const CTPPSDiamondDetId detId(plot.first), detId_pot(detId.rpId()); hitHistoTmp->Divide(&(plot.second.pixelTracksMapWithDiamonds), &(potPlots_[detId_pot].pixelTracksMap)); } } //perLSsaving @@ -1207,4 +1335,40 @@ void CTPPSDiamondDQMSource::globalEndLuminosityBlock(const edm::LuminosityBlock& //---------------------------------------------------------------------------------------------------- +void CTPPSDiamondDQMSource::checkEventNumber(const CTPPSDiamondDetId& detId, + const TotemFEDInfo& optorx, + const TotemVFATStatus& status, + CTPPSDiamondDQMSource::PotPlots& plots, + int& EC_difference) const { + const CTPPSDiamondDetId detId_pot(detId.rpId()); + if (plotOnline_) + plots.ECCheck->Fill((int)((optorx.lv1() & 0xFF) - ((unsigned int)status.ec() & 0xFF)) & 0xFF); + if ((static_cast((optorx.lv1() & 0xFF) - status.ec()) != EC_difference) && + (static_cast((optorx.lv1() & 0xFF) - status.ec()) < 128)) + EC_difference = static_cast(optorx.lv1() & 0xFF) - (static_cast(status.ec()) & 0xFF); + if (EC_difference != 1 && EC_difference != -500 && std::abs(EC_difference) < 127) { + if (detId.channel() == HPTDC_0_CHANNEL || detId.channel() == HPTDC_1_CHANNEL) + plots.HPTDCErrorFlags_2D->Fill(16, 2 * detId.plane() + (detId.channel() - HPTDC_0_CHANNEL)); + if (verbosity_) + edm::LogProblem("CTPPSDiamondDQMSource") + << "FED " << optorx.fedId() << ": ECError at EV: 0x" << std::hex << optorx.lv1() << "\t\tVFAT EC: 0x" + << static_cast(status.ec()) << "\twith ID: " << std::dec << detId + << "\tdiff: " << EC_difference; + } +} + +//---------------------------------------------------------------------------------------------------- + +void CTPPSDiamondDQMSource::dqmEndRun(edm::Run const&, edm::EventSetup const&) { + if (plotOffline_) + for (const auto& rpPlots : potPlots_) { + auto plots = rpPlots.second; + // *(plots.TOTVsLSProfile->getTProfile())=*plots.TOTVsLS->getTH2F()->ProfileX(); + // *(plots.trackTimeVsLSProfile->getTProfile())=*plots.trackTimeVsLS->getTH2F()->ProfileX(); + *(plots.trackTimeVsBXProfile->getTProfile()) = *plots.trackTimeVsBX->getTH2F()->ProfileX(); + // *(plots.trackTimeVsXAngleProfile->getTProfile()) = *plots.trackTimeVsXAngle->getTH2F()->ProfileX(); + } +} + +//---------------------------------------------------------------------------------------------------- DEFINE_FWK_MODULE(CTPPSDiamondDQMSource); diff --git a/DQM/CTPPS/plugins/DiamondSampicCalibrationDQMSource.cc b/DQM/CTPPS/plugins/DiamondSampicCalibrationDQMSource.cc new file mode 100644 index 0000000000000..81a5cf0e4ba71 --- /dev/null +++ b/DQM/CTPPS/plugins/DiamondSampicCalibrationDQMSource.cc @@ -0,0 +1,300 @@ +// -*- C++ -*- +// +// Package: DQM/CTPPS/DiamondSampicCalibrationDQMSource +// Class: DiamondSampicCalibrationDQMSource +// +/**\class DiamondSampicCalibrationDQMSource DiamondSampicCalibrationDQMSource.cc SampicDigi/DiamondSampicCalibrationDQMSource/plugins/DiamondSampicCalibrationDQMSource.cc + + Description: DQM module for the diamond sampic offset calibration + + Implementation: + [Notes on implementation] +*/ +// +// Original Author: Christopher Misan +// Created: Mon, 24 Aug 2021 14:21:17 GMT +// +// + +#include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/Framework/interface/Run.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/Utilities/interface/InputTag.h" + +#include "DQMServices/Core/interface/DQMOneEDAnalyzer.h" +#include "DQMServices/Core/interface/DQMStore.h" + +#include "DataFormats/CTPPSDigi/interface/TotemFEDInfo.h" +#include "DataFormats/CTPPSDigi/interface/TotemVFATStatus.h" +#include "DataFormats/CTPPSReco/interface/TotemRPLocalTrack.h" +#include "DataFormats/Common/interface/DetSetVector.h" +#include "DataFormats/FEDRawData/interface/FEDNumbering.h" +#include "DataFormats/Provenance/interface/EventRange.h" + +#include "DataFormats/CTPPSDetId/interface/CTPPSDiamondDetId.h" +#include "DataFormats/CTPPSDigi/interface/TotemTimingDigi.h" +#include "DataFormats/CTPPSReco/interface/TotemTimingRecHit.h" + +#include "DataFormats/CTPPSDetId/interface/TotemRPDetId.h" +#include "DataFormats/CTPPSReco/interface/TotemTimingLocalTrack.h" +#include "Geometry/Records/interface/VeryForwardRealGeometryRecord.h" +#include "Geometry/VeryForwardGeometryBuilder/interface/CTPPSGeometry.h" +#include "CondFormats/PPSObjects/interface/PPSTimingCalibration.h" +#include "CondFormats/DataRecord/interface/PPSTimingCalibrationRcd.h" + +#include + +//---------------------------------------------------------------------------------------------------- + +class DiamondSampicCalibrationDQMSource : public DQMOneEDAnalyzer<> { +public: + DiamondSampicCalibrationDQMSource(const edm::ParameterSet &); + ~DiamondSampicCalibrationDQMSource() override; + +protected: + void dqmBeginRun(const edm::Run &, const edm::EventSetup &) override; + void bookHistograms(DQMStore::IBooker &, const edm::Run &, const edm::EventSetup &) override; + void analyze(const edm::Event &, const edm::EventSetup &) override; + +private: + // Constants + static const double DISPLAY_RESOLUTION_FOR_HITS_MM; // Bin width of histograms + // showing hits and tracks + // (in mm) + static const double INV_DISPLAY_RESOLUTION_FOR_HITS_MM; + + edm::EDGetTokenT> totemTimingDigiToken_; + edm::EDGetTokenT> tokenRecHit_; + edm::ESGetToken timingCalibrationToken_; + edm::ESGetToken geomEsToken_; + unsigned int verbosity_; + edm::TimeValue_t timeOfPreviousEvent_; + + float verticalShiftBot_, verticalShiftTop_; + std::unordered_map horizontalShiftOfDiamond_; + + /// plots related to the whole system + struct GlobalPlots { + GlobalPlots() {} + GlobalPlots(DQMStore::IBooker &ibooker); + }; + + GlobalPlots globalPlot_; + + /// plots related to one Diamond detector package + struct PotPlots { + // RecHits + MonitorElement *hitDistribution2d = nullptr; + MonitorElement *recHitTime = nullptr; + + PotPlots(){}; + PotPlots(DQMStore::IBooker &ibooker, unsigned int id); + }; + + std::unordered_map potPlots_; + + /// plots related to one Diamond plane + struct PlanePlots { + PlanePlots() {} + PlanePlots(DQMStore::IBooker &ibooker, unsigned int id); + }; + + std::unordered_map planePlots_; + + /// plots related to one Diamond channel + struct ChannelPlots { + // RecHits + MonitorElement *recHitTime = nullptr; + + ChannelPlots() {} + ChannelPlots(DQMStore::IBooker &ibooker, unsigned int id); + }; + + edm::ESHandle hTimingCalib_; + std::unordered_map channelPlots_; +}; + +//---------------------------------------------------------------------------------------------------- + +// Values for all constants +const double DiamondSampicCalibrationDQMSource::DISPLAY_RESOLUTION_FOR_HITS_MM = 0.05; +const double DiamondSampicCalibrationDQMSource::INV_DISPLAY_RESOLUTION_FOR_HITS_MM = + 1. / DISPLAY_RESOLUTION_FOR_HITS_MM; + +//---------------------------------------------------------------------------------------------------- + +DiamondSampicCalibrationDQMSource::GlobalPlots::GlobalPlots(DQMStore::IBooker &ibooker) { + ibooker.setCurrentFolder("CTPPS/TimingFastSilicon"); +} + +//---------------------------------------------------------------------------------------------------- + +DiamondSampicCalibrationDQMSource::PotPlots::PotPlots(DQMStore::IBooker &ibooker, unsigned int id) { + std::string path, title; + CTPPSDiamondDetId(id).rpName(path, CTPPSDiamondDetId::nPath); + ibooker.setCurrentFolder(path); + + CTPPSDiamondDetId(id).rpName(title, CTPPSDiamondDetId::nFull); + + hitDistribution2d = ibooker.book2D("hits in planes", + title + " hits in planes;plane number;x (mm)", + 10, + -0.5, + 4.5, + 19. * INV_DISPLAY_RESOLUTION_FOR_HITS_MM, + -0.5, + 18.5); + + recHitTime = ibooker.book1D("recHit time", title + " time in the recHits; t (ns)", 500, -25, 25); +} + +//---------------------------------------------------------------------------------------------------- + +DiamondSampicCalibrationDQMSource::PlanePlots::PlanePlots(DQMStore::IBooker &ibooker, unsigned int id) { + std::string path, title; + CTPPSDiamondDetId(id).planeName(path, CTPPSDiamondDetId::nPath); + ibooker.setCurrentFolder(path); +} + +//---------------------------------------------------------------------------------------------------- + +DiamondSampicCalibrationDQMSource::ChannelPlots::ChannelPlots(DQMStore::IBooker &ibooker, unsigned int id) { + std::string path, title; + CTPPSDiamondDetId(id).channelName(path, CTPPSDiamondDetId::nPath); + ibooker.setCurrentFolder(path); + + CTPPSDiamondDetId(id).channelName(title, CTPPSDiamondDetId::nFull); + recHitTime = ibooker.book1D("recHit Time", title + " recHit Time; t (ns)", 500, -25, 25); +} + +//---------------------------------------------------------------------------------------------------- + +DiamondSampicCalibrationDQMSource::DiamondSampicCalibrationDQMSource(const edm::ParameterSet &ps) + : totemTimingDigiToken_( + consumes>(ps.getParameter("totemTimingDigiTag"))), + tokenRecHit_(consumes>(ps.getParameter("tagRecHits"))), + timingCalibrationToken_(esConsumes()), + geomEsToken_(esConsumes()), + verbosity_(ps.getUntrackedParameter("verbosity", 0)), + timeOfPreviousEvent_(0) {} + +//---------------------------------------------------------------------------------------------------- + +DiamondSampicCalibrationDQMSource::~DiamondSampicCalibrationDQMSource() {} + +//---------------------------------------------------------------------------------------------------- + +void DiamondSampicCalibrationDQMSource::dqmBeginRun(const edm::Run &iRun, const edm::EventSetup &iSetup) { + // Get detector shifts from the geometry (if present) + 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); + + const DetGeomDesc *det = geom.sensorNoThrow(detid); + if (det) + horizontalShiftOfDiamond_[detid.rpId()] = det->translation().x() - det->getDiamondDimensions().xHalfWidth; + else + edm::LogProblem("DiamondSampicCalibrationDQMSource") << "ERROR: no descriptor for detId"; + } +} + +//---------------------------------------------------------------------------------------------------- + +void DiamondSampicCalibrationDQMSource::bookHistograms(DQMStore::IBooker &ibooker, + const edm::Run &, + const edm::EventSetup &iSetup) { + ibooker.cd(); + ibooker.setCurrentFolder("CTPPS"); + + globalPlot_ = GlobalPlots(ibooker); + 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); + + const CTPPSDiamondDetId rpId(detid.arm(), detid.station(), detid.rp()); + potPlots_[rpId] = PotPlots(ibooker, rpId); + + const CTPPSDiamondDetId plId(detid.arm(), detid.station(), detid.rp(), detid.plane()); + planePlots_[plId] = PlanePlots(ibooker, plId); + + const CTPPSDiamondDetId chId(detid.arm(), detid.station(), detid.rp(), detid.plane(), detid.channel()); + channelPlots_[chId] = ChannelPlots(ibooker, chId); + } + hTimingCalib_ = iSetup.getHandle(timingCalibrationToken_); +} + +//---------------------------------------------------------------------------------------------------- + +void DiamondSampicCalibrationDQMSource::analyze(const edm::Event &event, const edm::EventSetup &eventSetup) { + PPSTimingCalibration calib = *hTimingCalib_; + // get event setup data + edm::Handle> timingRecHits; + event.getByToken(tokenRecHit_, timingRecHits); + + edm::Handle> timingDigi; + event.getByToken(totemTimingDigiToken_, timingDigi); + + std::unordered_map detIdToHw; + + for (const auto &digis : *timingDigi) { + const CTPPSDiamondDetId detId(digis.detId()); + for (const auto &digi : digis) + detIdToHw[detId] = digi.hardwareId(); + } + + // Using TotemTimingDigi + std::set boardSet; + std::unordered_map channelsPerPlane; + std::unordered_map channelsPerPlaneWithTime; + + // End digis + + for (const auto &rechits : *timingRecHits) { + const CTPPSDiamondDetId detId(rechits.detId()); + CTPPSDiamondDetId detId_pot(rechits.detId()); + detId_pot.setPlane(0); + detId_pot.setChannel(0); + CTPPSDiamondDetId detId_plane(rechits.detId()); + detId_plane.setChannel(0); + + for (const auto &rechit : rechits) { + if (potPlots_.find(detId_pot) != potPlots_.end()) { + float UFSDShift = 0.0; + if (rechit.yWidth() < 3) + UFSDShift = 0.5; + + TH2F *hitHistoTmp = potPlots_[detId_pot].hitDistribution2d->getTH2F(); + TAxis *hitHistoTmpYAxis = hitHistoTmp->GetYaxis(); + int startBin = + hitHistoTmpYAxis->FindBin(rechit.x() - horizontalShiftOfDiamond_[detId_pot] - 0.5 * rechit.xWidth()); + int numOfBins = rechit.xWidth() * INV_DISPLAY_RESOLUTION_FOR_HITS_MM; + for (int i = 0; i < numOfBins; ++i) + potPlots_[detId_pot].hitDistribution2d->Fill(detId.plane() + UFSDShift, + hitHistoTmpYAxis->GetBinCenter(startBin + i)); + + //All plots with Time + if (rechit.time() != TotemTimingRecHit::NO_T_AVAILABLE) { + int db = (detIdToHw[detId] & 0xE0) >> 5; + int sampic = (detIdToHw[detId] & 0x10) >> 4; + int channel = (detIdToHw[detId] & 0x0F); + double offset = calib.timeOffset(db, sampic, channel); + potPlots_[detId_pot].recHitTime->Fill(rechit.time() + offset); + if (channelPlots_.find(detId) != channelPlots_.end()) + channelPlots_[detId].recHitTime->Fill(rechit.time() + offset); + } + } + } + } + // End RecHits + + timeOfPreviousEvent_ = event.time().value(); +} + +DEFINE_FWK_MODULE(DiamondSampicCalibrationDQMSource); diff --git a/DQM/CTPPS/plugins/DiamondSampicDQMSource.cc b/DQM/CTPPS/plugins/DiamondSampicDQMSource.cc new file mode 100644 index 0000000000000..68f72805e4420 --- /dev/null +++ b/DQM/CTPPS/plugins/DiamondSampicDQMSource.cc @@ -0,0 +1,759 @@ +/**************************************************************************** + * + * This is a part of CTPPSDQM software. + * Authors: + * Christopher Misan + * Nicola Minafra + * Laurent Forthomme + * + ****************************************************************************/ + +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/Framework/interface/Run.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/Utilities/interface/InputTag.h" + +#include "DQMServices/Core/interface/DQMOneEDAnalyzer.h" +#include "DQMServices/Core/interface/DQMStore.h" + +#include "DataFormats/CTPPSDigi/interface/TotemFEDInfo.h" +#include "DataFormats/CTPPSDigi/interface/TotemVFATStatus.h" +#include "DataFormats/CTPPSReco/interface/TotemRPLocalTrack.h" +#include "DataFormats/Common/interface/DetSetVector.h" +#include "DataFormats/FEDRawData/interface/FEDNumbering.h" +#include "DataFormats/Provenance/interface/EventRange.h" + +#include "DataFormats/CTPPSDetId/interface/CTPPSDiamondDetId.h" +#include "DataFormats/CTPPSDigi/interface/TotemTimingDigi.h" +#include "DataFormats/CTPPSReco/interface/TotemTimingRecHit.h" + +#include "DataFormats/CTPPSDetId/interface/TotemRPDetId.h" +#include "DataFormats/CTPPSReco/interface/TotemTimingLocalTrack.h" +#include "Geometry/Records/interface/VeryForwardRealGeometryRecord.h" +#include "Geometry/VeryForwardGeometryBuilder/interface/CTPPSGeometry.h" + +#include + +//---------------------------------------------------------------------------------------------------- + +namespace totemds { + struct Cache { + std::unordered_map> hitDistribution2dMap; + + std::unordered_map hitsCounterMap; + }; +} // namespace totemds + +class DiamondSampicDQMSource : public DQMOneEDAnalyzer> { +public: + DiamondSampicDQMSource(const edm::ParameterSet &); + ~DiamondSampicDQMSource() override; + +protected: + void dqmBeginRun(const edm::Run &, const edm::EventSetup &) override; + void bookHistograms(DQMStore::IBooker &, const edm::Run &, const edm::EventSetup &) override; + void analyze(const edm::Event &, const edm::EventSetup &) override; + std::shared_ptr globalBeginLuminosityBlock(const edm::LuminosityBlock &, + const edm::EventSetup &) const override; + void globalEndLuminosityBlock(const edm::LuminosityBlock &, const edm::EventSetup &) override; + +private: + // Constants + static const double SEC_PER_LUMI_SECTION; // Number of seconds per + // lumisection: used to compute hit + // rates in Hz + static const double LHC_CLOCK_PERIOD_NS; + static const double DQM_FRACTION_OF_EVENTS; // approximate fraction of events + // sent to DQM stream + static const double HIT_RATE_FACTOR; // factor to have real rate in Hz + static const double DISPLAY_RESOLUTION_FOR_HITS_MM; // Bin width of histograms + // showing hits and tracks + // (in mm) + static const double INV_DISPLAY_RESOLUTION_FOR_HITS_MM; + static const double SAMPIC_ADC_V; + + edm::EDGetTokenT> tokenLocalTrack_; + edm::EDGetTokenT> tokenDigi_; + edm::EDGetTokenT> tokenRecHit_; + edm::EDGetTokenT> tokenTrack_; + edm::EDGetTokenT> tokenFEDInfo_; + + edm::ESGetToken ctppsGeometryRunToken_; + + unsigned int samplesForNoise_; + unsigned int verbosity_; + bool plotOnline_; + bool perLSsaving_; //to avoid nanoDQMIO crashing, driven by DQMServices/Core/python/DQMStore_cfi.py + unsigned int trackCorrelationThreshold_; + edm::TimeValue_t timeOfPreviousEvent_; + + std::unordered_map horizontalShiftOfDiamond_; + + /// plots related to the whole system + struct GlobalPlots { + MonitorElement *digiSentPercentage = nullptr; + + GlobalPlots() {} + GlobalPlots(DQMStore::IBooker &ibooker); + }; + + GlobalPlots globalPlot_; + + struct SectorPlots { + // Tracks + MonitorElement *trackCorrelation = nullptr; + MonitorElement *trackCorrelationLowMultiplicity = nullptr; + MonitorElement *digiSentPercentage = nullptr; + SectorPlots(){}; + SectorPlots(DQMStore::IBooker &ibooker, unsigned int id, bool plotOnline); + }; + std::unordered_map sectorPlots_; + + /// plots related to one Diamond detector package + struct PotPlots { + // Digis + MonitorElement *activityPerBX = nullptr; + MonitorElement *digiDistribution = nullptr; + MonitorElement *dataSamplesRaw = nullptr; + MonitorElement *baseline = nullptr; + MonitorElement *noiseRMS = nullptr; + + MonitorElement *digiSent = nullptr; + MonitorElement *digiAll = nullptr; + MonitorElement *digiSentPercentage = nullptr; + + // RecHits + MonitorElement *hitDistribution2d = nullptr; + MonitorElement *hitDistribution2dWithTime = nullptr; + MonitorElement *hitDistribution2d_lumisection = nullptr; + + MonitorElement *recHitTime = nullptr; + MonitorElement *amplitude = nullptr; + MonitorElement *baselineRMS = nullptr; + MonitorElement *triggerCellTime = nullptr; + MonitorElement *meanAmplitude = nullptr; + MonitorElement *cellOfMax = nullptr; + + MonitorElement *hitRate = nullptr; + + MonitorElement *planesWithDigis = nullptr; + MonitorElement *planesWithTime = nullptr; + + MonitorElement *trackDistribution = nullptr; + + std::set planesWithDigisSet; + std::set planesWithTimeSet; + + PotPlots(){}; + PotPlots(DQMStore::IBooker &ibooker, unsigned int id, bool plotOnline); + }; + + std::unordered_map potPlots_; + + /// plots related to one Diamond plane + struct PlanePlots { + MonitorElement *digiDistribution = nullptr; + + MonitorElement *hitProfile = nullptr; + MonitorElement *hitMultiplicity = nullptr; + MonitorElement *hitMultiplicityWithTime = nullptr; + + PlanePlots() {} + PlanePlots(DQMStore::IBooker &ibooker, unsigned int id); + }; + + std::unordered_map planePlots_; + + /// plots related to one Diamond channel + struct ChannelPlots { + // Digis + MonitorElement *activityPerBX = nullptr; + MonitorElement *dataSamplesRaw = nullptr; + MonitorElement *cellOfMax = nullptr; + MonitorElement *maxTimeAfterTrigger = nullptr; + + // RecHits + MonitorElement *triggerCellTime = nullptr; + MonitorElement *recHitTime = nullptr; + MonitorElement *amplitude = nullptr; + MonitorElement *noiseSamples = nullptr; + + //MonitorElement *hitTime = nullptr; + MonitorElement *hitRate = nullptr; + + ChannelPlots() {} + ChannelPlots(DQMStore::IBooker &ibooker, unsigned int id); + }; + + std::unordered_map channelPlots_; + static std::string changePathToSampic(std::string path); +}; +//---------------------------------------------------------------------------------------------------- +std::string DiamondSampicDQMSource::changePathToSampic(std::string path) { + std::string toReplace = "TimingDiamond"; + path = path.substr(path.find(toReplace) + toReplace.length()); + path = "CTPPS/DiamondSampic/" + path; + return path; +} +//---------------------------------------------------------------------------------------------------- + +// Values for all constants +const double DiamondSampicDQMSource::SEC_PER_LUMI_SECTION = 23.31; +const double DiamondSampicDQMSource::LHC_CLOCK_PERIOD_NS = 24.95; +const double DiamondSampicDQMSource::DQM_FRACTION_OF_EVENTS = 1.; +const double DiamondSampicDQMSource::HIT_RATE_FACTOR = DQM_FRACTION_OF_EVENTS / SEC_PER_LUMI_SECTION; +const double DiamondSampicDQMSource::DISPLAY_RESOLUTION_FOR_HITS_MM = 0.05; +const double DiamondSampicDQMSource::INV_DISPLAY_RESOLUTION_FOR_HITS_MM = 1. / DISPLAY_RESOLUTION_FOR_HITS_MM; +const double DiamondSampicDQMSource::SAMPIC_ADC_V = 1. / 256; +//---------------------------------------------------------------------------------------------------- + +DiamondSampicDQMSource::GlobalPlots::GlobalPlots(DQMStore::IBooker &ibooker) { + ibooker.setCurrentFolder("CTPPS/DiamondSampic"); + digiSentPercentage = ibooker.book2D( + "sent digis percentage", "sent digis percentage (sampic);board + 0.5 sampic;channel", 14, -0.5, 6.5, 16, 0, 16); +} + +//---------------------------------------------------------------------------------------------------- + +DiamondSampicDQMSource::SectorPlots::SectorPlots(DQMStore::IBooker &ibooker, unsigned int id, bool plotOnline) { + std::string path, title; + CTPPSDiamondDetId(id).armName(path, CTPPSDiamondDetId::nPath); + ibooker.setCurrentFolder(DiamondSampicDQMSource::changePathToSampic(path)); + + CTPPSDiamondDetId(id).armName(title, CTPPSDiamondDetId::nFull); + + trackCorrelation = ibooker.book2D("tracks correlation near-far", + title + " tracks correlation near-far;x (mm);x (mm)", + 19. * INV_DISPLAY_RESOLUTION_FOR_HITS_MM, + -1, + 18, + 19. * INV_DISPLAY_RESOLUTION_FOR_HITS_MM, + -1, + 18); + trackCorrelationLowMultiplicity = + ibooker.book2D("tracks correlation with low multiplicity near-far", + title + " tracks correlation with low multiplicity near-far;x (mm);x (mm)", + 19. * INV_DISPLAY_RESOLUTION_FOR_HITS_MM, + -1, + 18, + 19. * INV_DISPLAY_RESOLUTION_FOR_HITS_MM, + -1, + 18); + if (plotOnline) + digiSentPercentage = ibooker.book2D("sent digis percentage", + title + " sent digis percentage (sampic);board + 0.5 sampic;channel", + 14, + -0.5, + 6.5, + 16, + 0, + 16); +} + +//---------------------------------------------------------------------------------------------------- + +DiamondSampicDQMSource::PotPlots::PotPlots(DQMStore::IBooker &ibooker, unsigned int id, bool plotOnline) { + std::string path, title; + CTPPSDiamondDetId(id).rpName(path, CTPPSDiamondDetId::nPath); + ibooker.setCurrentFolder(DiamondSampicDQMSource::changePathToSampic(path)); + + CTPPSDiamondDetId(id).rpName(title, CTPPSDiamondDetId::nFull); + + digiDistribution = + ibooker.book2D("digi distribution", title + " digi distribution;plane;channel", 10, -0.5, 4.5, 12, 0, 12); + + hitDistribution2d = ibooker.book2D("hits in planes", + title + " hits in planes;plane number;x (mm)", + 10, + -0.5, + 4.5, + 19. * INV_DISPLAY_RESOLUTION_FOR_HITS_MM, + -0.5, + 18.5); + hitDistribution2dWithTime = ibooker.book2D("hits in planes with time", + title + " hits in planes with time;plane number;x (mm)", + 10, + -0.5, + 4.5, + 19. * INV_DISPLAY_RESOLUTION_FOR_HITS_MM, + -0.5, + 18.5); + + recHitTime = ibooker.book1D("recHit time", title + " recHit time; t (ns)", 500, -25, 25); + trackDistribution = ibooker.book1D( + "tracks", title + " tracks;x (mm)", 19. * INV_DISPLAY_RESOLUTION_FOR_HITS_MM, -1, 18); //TODO needs tracks + + if (plotOnline) { + hitDistribution2d_lumisection = + ibooker.book2D("hits in planes lumisection", + title + " hits in planes in the last lumisection;plane number;x (mm)", + 18, + -0.5, + 4, + 15. * INV_DISPLAY_RESOLUTION_FOR_HITS_MM, + 0, + 15); + triggerCellTime = ibooker.book1D("trigger cell time", title + " Trigger Cell Time; t (ns)", 390, -25, 25); + activityPerBX = ibooker.book1D("activity per BX CMS", title + " Activity per BX;Event.BX", 3600, -1.5, 3598. + 0.5); + amplitude = ibooker.book1D("amplitude", title + " amplitude above baseline; amplitude (V)", 50, 0, 1); + baselineRMS = ibooker.book2D("noise RMS", title + " noise RMS (V);plane;channel", 10, -0.5, 4.5, 12, 0, 12); + meanAmplitude = + ibooker.book2D("mean amplitude", title + " Mean Amplitude (V);plane;channel", 10, -0.5, 4.5, 12, 0, 12); + cellOfMax = ibooker.book2D("cell of max", title + " cell of max (0-23);plane;channel", 10, -0.5, 4.5, 12, 0, 12); + + //hitRate = ibooker.book2D("hit rate", title + " hit rate (Hz);plane;channel", 10, -0.5, 4.5, 12, 0, 12); + + planesWithDigis = ibooker.book1D("active planes digis", + title + " active planes with digis sent (per event);number of active planes", + 6, + -0.5, + 5.5); + planesWithTime = ibooker.book1D( + "active planes with time", title + " active planes with time (per event);number of active planes", 6, -0.5, 5.5); + + dataSamplesRaw = ibooker.book1D("raw Samples", title + " Raw Samples; ADC", 256, 0, 256); + + baseline = ibooker.book2D("baseline", title + " baseline (V);plane;channel", 10, -0.5, 4.5, 12, 0, 12); + noiseRMS = ibooker.book2D("noise RMS", title + " noise RMS (V);plane;channel", 10, -0.5, 4.5, 12, 0, 12); + + digiSent = ibooker.book2D( + "digis sent", title + " digi sent (sampic);board + 0.5 sampic;channel", 14, -0.5, 6.5, 16, 0, 16); + digiAll = + ibooker.book2D("all digis", title + " all digis(sampic);board + 0.5 sampic;channel", 14, -0.5, 6.5, 16, 0, 16); + digiSentPercentage = ibooker.book2D("sent digis percentage", + title + " sent digis percentage (sampic);board + 0.5 sampic;channel", + 14, + -0.5, + 6.5, + 16, + 0, + 16); + } +} + +//---------------------------------------------------------------------------------------------------- + +DiamondSampicDQMSource::PlanePlots::PlanePlots(DQMStore::IBooker &ibooker, unsigned int id) { + std::string path, title; + CTPPSDiamondDetId(id).planeName(path, CTPPSDiamondDetId::nPath); + ibooker.setCurrentFolder(DiamondSampicDQMSource::changePathToSampic(path)); + + CTPPSDiamondDetId(id).planeName(title, CTPPSDiamondDetId::nFull); + + digiDistribution = ibooker.book1D("digi distribution", title + " digi distribution;channel", 12, 0, 12); + + hitProfile = ibooker.book1D("hit distribution with time", + title + " hit distribution (with time);x(mm)", + 30. * INV_DISPLAY_RESOLUTION_FOR_HITS_MM, + 0, + 30); + + hitMultiplicity = ibooker.book1D("channels per plane", title + " channels per plane; ch per plane", 13, -0.5, 12.5); + + hitMultiplicityWithTime = ibooker.book1D( + "channels per plane with time", title + " channels per plane with time; ch per plane", 13, -0.5, 12.5); +} + +//---------------------------------------------------------------------------------------------------- + +DiamondSampicDQMSource::ChannelPlots::ChannelPlots(DQMStore::IBooker &ibooker, unsigned int id) { + std::string path, title; + CTPPSDiamondDetId(id).channelName(path, CTPPSDiamondDetId::nPath); + ibooker.setCurrentFolder(DiamondSampicDQMSource::changePathToSampic(path)); + + CTPPSDiamondDetId(id).channelName(title, CTPPSDiamondDetId::nFull); + + activityPerBX = ibooker.book1D("activity per BX", title + " Activity per BX;Event.BX", 1000, -1.5, 998. + 0.5); + dataSamplesRaw = ibooker.book1D("raw samples", title + " Raw Samples; ADC", 256, 0, 256); + cellOfMax = ibooker.book1D("cell of max", title + " cell of max; cell", 24, 0, 24); + + triggerCellTime = ibooker.book1D("sampic trigger time", title + " Sampic Trigger Time; t (ns)", 100, -25, 25); + recHitTime = ibooker.book1D("recHit Time", title + " recHit Time; t (ns)", 500, -25, 25); + amplitude = ibooker.book1D("amplitude", title + " amplitude above baseline; amplitude (V)", 50, 0, 1); + noiseSamples = ibooker.book1D("noise samples", title + " noise samples; V", 50, 0, 1); + + //hitTime = ibooker.book1D("hit time", title + "hit time;t - t_previous (us)", 100, 0, 10000); + //hitRate = ibooker.book1D("hit rate", title + "hit rate;rate (Hz)", 100, 0, 10000); +} + +//---------------------------------------------------------------------------------------------------- + +DiamondSampicDQMSource::DiamondSampicDQMSource(const edm::ParameterSet &ps) + : tokenLocalTrack_(consumes>(ps.getParameter("tagLocalTrack"))), + tokenDigi_(consumes>(ps.getParameter("tagDigi"))), + tokenRecHit_(consumes>(ps.getParameter("tagRecHits"))), + tokenTrack_(consumes>(ps.getParameter("tagTracks"))), + tokenFEDInfo_(consumes>(ps.getParameter("tagFEDInfo"))), + ctppsGeometryRunToken_(esConsumes()), + samplesForNoise_(ps.getUntrackedParameter("samplesForNoise", 5)), + verbosity_(ps.getUntrackedParameter("verbosity", 0)), + plotOnline_(ps.getUntrackedParameter("plotOnline", true)), + perLSsaving_(ps.getUntrackedParameter("perLSsaving", false)), + trackCorrelationThreshold_(ps.getUntrackedParameter("trackCorrelationThreshold", 3)), + timeOfPreviousEvent_(0) {} + +//---------------------------------------------------------------------------------------------------- + +DiamondSampicDQMSource::~DiamondSampicDQMSource() {} + +//---------------------------------------------------------------------------------------------------- + +void DiamondSampicDQMSource::dqmBeginRun(const edm::Run &iRun, const edm::EventSetup &iSetup) { + // Get detector shifts from the geometry (if present) + const CTPPSGeometry *geom = &iSetup.getData(ctppsGeometryRunToken_); + for (auto it = geom->beginSensor(); it != geom->endSensor(); it++) { + if (!CTPPSDiamondDetId::check(it->first)) + continue; + const CTPPSDiamondDetId detid(it->first); + + const DetGeomDesc *det = geom->sensorNoThrow(detid); + if (det) + horizontalShiftOfDiamond_[detid.rpId()] = det->translation().x() - det->getDiamondDimensions().xHalfWidth; + else + edm::LogProblem("DiamondSampicCalibrationDQMSource") << "ERROR: no descriptor for detId"; + } + //horizontalShiftOfDiamond_=0;//unlock the shift +} + +//---------------------------------------------------------------------------------------------------- + +void DiamondSampicDQMSource::bookHistograms(DQMStore::IBooker &ibooker, + const edm::Run &, + const edm::EventSetup &iSetup) { + ibooker.cd(); + ibooker.setCurrentFolder("CTPPS/DiamondSampic"); + + const CTPPSGeometry *geom = &iSetup.getData(ctppsGeometryRunToken_); + for (auto it = geom->beginSensor(); it != geom->endSensor(); ++it) { + if (!CTPPSDiamondDetId::check(it->first)) + continue; + const CTPPSDiamondDetId detid(it->first); + + sectorPlots_[detid.armId()] = SectorPlots(ibooker, detid.armId(), plotOnline_); + + const CTPPSDiamondDetId rpId(detid.arm(), detid.station(), detid.rp()); + potPlots_[rpId] = PotPlots(ibooker, rpId, plotOnline_); + + if (plotOnline_) { + globalPlot_ = GlobalPlots(ibooker); + const CTPPSDiamondDetId plId(detid.arm(), detid.station(), detid.rp(), detid.plane()); + planePlots_[plId] = PlanePlots(ibooker, plId); + + const CTPPSDiamondDetId chId(detid.arm(), detid.station(), detid.rp(), detid.plane(), detid.channel()); + channelPlots_[chId] = ChannelPlots(ibooker, chId); + } + } +} + +//---------------------------------------------------------------------------------------------------- + +std::shared_ptr DiamondSampicDQMSource::globalBeginLuminosityBlock(const edm::LuminosityBlock &, + const edm::EventSetup &) const { + auto d = std::make_shared(); + d->hitDistribution2dMap.reserve(potPlots_.size()); + if (!perLSsaving_ && plotOnline_) + for (auto &plot : potPlots_) + d->hitDistribution2dMap[plot.first] = + std::unique_ptr(static_cast(plot.second.hitDistribution2d_lumisection->getTH2F()->Clone())); + return d; +} + +//---------------------------------------------------------------------------------------------------- + +void DiamondSampicDQMSource::analyze(const edm::Event &event, const edm::EventSetup &eventSetup) { + // get event data + edm::Handle> timingDigis; + event.getByToken(tokenDigi_, timingDigis); + + edm::Handle> fedInfo; + event.getByToken(tokenFEDInfo_, fedInfo); + + edm::Handle> timingRecHits; + event.getByToken(tokenRecHit_, timingRecHits); + + edm::Handle> timingLocalTracks; + event.getByToken(tokenTrack_, timingLocalTracks); + + // check validity + bool valid = true; + valid &= timingDigis.isValid(); + //valid &= fedInfo.isValid(); + + if (!valid) { + if (verbosity_) { + edm::LogProblem("DiamondSampicDQMSource") + << "ERROR in DiamondSampicDQMSource::analyze > some of the required inputs " + "are not valid. Skipping this event.\n" + << " timingDigis.isValid = " << timingDigis.isValid() << "\n" + << " fedInfo.isValid = " << fedInfo.isValid(); + } + + return; + } + + // Using TotemTimingDigi + std::set boardSet; + std::unordered_map channelsPerPlane; + std::unordered_map channelsPerPlaneWithTime; + + auto lumiCache = luminosityBlockCache(event.getLuminosityBlock().index()); + + for (const auto &digis : *timingDigis) { + const CTPPSDiamondDetId detId(digis.detId()); + CTPPSDiamondDetId detId_pot(digis.detId()); + detId_pot.setPlane(0); + detId_pot.setChannel(0); + CTPPSDiamondDetId detId_plane(digis.detId()); + detId_plane.setChannel(0); + + for (const auto &digi : digis) { + // Pot Plots + if (potPlots_.find(detId_pot) != potPlots_.end()) { + potPlots_[detId_pot].digiDistribution->Fill(detId.plane(), detId.channel()); + + if (plotOnline_) { + potPlots_[detId_pot].activityPerBX->Fill(event.bunchCrossing()); + + for (auto it = digi.samplesBegin(); it != digi.samplesEnd(); ++it) { + potPlots_[detId_pot].dataSamplesRaw->Fill(*it); + } + + float boardId = digi.eventInfo().hardwareBoardId() + 0.5 * digi.eventInfo().hardwareSampicId(); + potPlots_[detId_pot].digiSent->Fill(boardId, digi.hardwareChannelId()); + + if (boardSet.find(digi.eventInfo().hardwareId()) == boardSet.end()) { + // This guarantees that every board is counted only once + boardSet.insert(digi.eventInfo().hardwareId()); + std::bitset<16> chMap(digi.eventInfo().channelMap()); + for (int i = 0; i < 16; ++i) { + if (chMap.test(i)) { + potPlots_[detId_pot].digiAll->Fill(boardId, i); + } + } + } + + potPlots_[detId_pot].planesWithDigisSet.insert(detId.plane()); + } + } + + if (plotOnline_) { + // Plane Plots + if (planePlots_.find(detId_plane) != planePlots_.end()) { + planePlots_[detId_plane].digiDistribution->Fill(detId.channel()); + + if (channelsPerPlane.find(detId_plane) != channelsPerPlane.end()) + channelsPerPlane[detId_plane]++; + else + channelsPerPlane[detId_plane] = 0; + } + + // Channel Plots + if (channelPlots_.find(detId) != channelPlots_.end()) { + channelPlots_[detId].activityPerBX->Fill(event.bunchCrossing()); + + for (auto it = digi.samplesBegin(); it != digi.samplesEnd(); ++it) + channelPlots_[detId].dataSamplesRaw->Fill(*it); + for (unsigned short i = 0; i < samplesForNoise_; ++i) + channelPlots_[detId].noiseSamples->Fill(SAMPIC_ADC_V * digi.sampleAt(i)); + + unsigned int cellOfMax = std::max_element(digi.samplesBegin(), digi.samplesEnd()) - digi.samplesBegin(); + channelPlots_[detId].cellOfMax->Fill((int)cellOfMax); + + // if (timeOfPreviousEvent_ != 0) + // channelPlots_[detId].hitTime->Fill(1e-3 * LHC_CLOCK_PERIOD_NS * + // (event.time().value() - timeOfPreviousEvent_)); + ++(lumiCache->hitsCounterMap[detId]); + } + } + } + } + // End digis + + for (const auto &rechits : *timingRecHits) { + const CTPPSDiamondDetId detId(rechits.detId()); + CTPPSDiamondDetId detId_pot(rechits.detId()); + detId_pot.setPlane(0); + detId_pot.setChannel(0); + CTPPSDiamondDetId detId_plane(rechits.detId()); + detId_plane.setChannel(0); + + for (const auto &rechit : rechits) { + if (potPlots_.find(detId_pot) != potPlots_.end()) { + float UFSDShift = 0.0; + if (rechit.yWidth() < 3) + UFSDShift = 0.5; + + TH2F *hitHistoTmp = potPlots_[detId_pot].hitDistribution2d->getTH2F(); + TAxis *hitHistoTmpYAxis = hitHistoTmp->GetYaxis(); + int startBin = + hitHistoTmpYAxis->FindBin(rechit.x() - horizontalShiftOfDiamond_[detId_pot] - 0.5 * rechit.xWidth()); + const int numOfBins = rechit.xWidth() * INV_DISPLAY_RESOLUTION_FOR_HITS_MM; + for (int i = 0; i < numOfBins; ++i) { + potPlots_[detId_pot].hitDistribution2d->Fill(detId.plane() + UFSDShift, + hitHistoTmpYAxis->GetBinCenter(startBin + i)); + if (!perLSsaving_ && plotOnline_) + potPlots_[detId_pot].hitDistribution2d_lumisection->Fill(detId.plane() + UFSDShift, + hitHistoTmpYAxis->GetBinCenter(startBin + i)); + } + + //All plots with Time + if (rechit.time() != TotemTimingRecHit::NO_T_AVAILABLE) { + for (int i = 0; i < numOfBins; ++i) + potPlots_[detId_pot].hitDistribution2dWithTime->Fill(detId.plane() + UFSDShift, + hitHistoTmpYAxis->GetBinCenter(startBin + i)); + + potPlots_[detId_pot].recHitTime->Fill(rechit.time()); + if (plotOnline_) { + potPlots_[detId_pot].amplitude->Fill(rechit.amplitude()); + potPlots_[detId_pot].planesWithTimeSet.insert(detId.plane()); + + // Plane Plots + if (planePlots_.find(detId_plane) != planePlots_.end()) { + TH1F *hitProfileHistoTmp = planePlots_[detId_plane].hitProfile->getTH1F(); + const int startBin = hitProfileHistoTmp->FindBin(rechit.x() - horizontalShiftOfDiamond_[detId_pot] - + 0.5 * rechit.xWidth()); + for (int i = 0; i < numOfBins; ++i) + hitProfileHistoTmp->Fill(hitProfileHistoTmp->GetBinCenter(startBin + i)); + + if (channelsPerPlaneWithTime.find(detId_plane) != channelsPerPlaneWithTime.end()) + channelsPerPlaneWithTime[detId_plane]++; + else + channelsPerPlaneWithTime[detId_plane] = 0; + } + + if (channelPlots_.find(detId) != channelPlots_.end()) { + potPlots_[detId_pot].triggerCellTime->Fill(rechit.sampicThresholdTime()); + channelPlots_[detId].triggerCellTime->Fill(rechit.sampicThresholdTime()); + channelPlots_[detId].recHitTime->Fill(rechit.time()); + channelPlots_[detId].amplitude->Fill(rechit.amplitude()); + } + } + } + } + } + } + // End RecHits + + // Using CTPPSDiamondLocalTrack + for (const auto &tracks : *timingLocalTracks) { + CTPPSDiamondDetId detId_pot(tracks.detId()); + detId_pot.setPlane(0); + detId_pot.setChannel(0); + const CTPPSDiamondDetId detId_near(tracks.detId()); + + for (const auto &track : tracks) { + if (!track.isValid()) + continue; + if (potPlots_.find(detId_pot) == potPlots_.end()) + continue; + + TH1F *trackHistoInTimeTmp = potPlots_[detId_pot].trackDistribution->getTH1F(); + const int startBin = + trackHistoInTimeTmp->FindBin(track.x0() - horizontalShiftOfDiamond_[detId_pot] - track.x0Sigma()); + const int numOfBins = 2 * track.x0Sigma() * INV_DISPLAY_RESOLUTION_FOR_HITS_MM; + for (int i = 0; i < numOfBins; ++i) { + trackHistoInTimeTmp->Fill(trackHistoInTimeTmp->GetBinCenter(startBin + i)); + } + + //this plot was made with 2 stations per arm in mind + for (const auto &tracks_far : *timingLocalTracks) { + CTPPSDiamondDetId detId_far(tracks_far.detId()); + detId_far.setPlane(0); + detId_far.setChannel(0); + if (detId_near.arm() != detId_far.arm() || detId_near.station() == detId_far.station()) + continue; + for (const auto &track_far : tracks_far) { + if (!track.isValid()) + continue; + if (sectorPlots_.find(detId_far.armId()) == sectorPlots_.end()) + continue; + TH2F *trackHistoTmp = sectorPlots_[detId_far.armId()].trackCorrelation->getTH2F(); + TAxis *trackHistoTmpXAxis = trackHistoTmp->GetXaxis(); + TAxis *trackHistoTmpYAxis = trackHistoTmp->GetYaxis(); + const int startBin_far = + trackHistoTmpYAxis->FindBin(track_far.x0() - horizontalShiftOfDiamond_[detId_far] - track_far.x0Sigma()); + const int numOfBins_far = 2 * track_far.x0Sigma() * INV_DISPLAY_RESOLUTION_FOR_HITS_MM; + for (int i = 0; i < numOfBins; ++i) { + for (int y = 0; y < numOfBins_far; ++y) { + trackHistoTmp->Fill(trackHistoTmpXAxis->GetBinCenter(startBin + i), + trackHistoTmpYAxis->GetBinCenter(startBin_far + y)); + if (tracks.size() < 3 && tracks_far.size() < trackCorrelationThreshold_) + sectorPlots_[detId_far.armId()].trackCorrelationLowMultiplicity->Fill( + trackHistoTmpXAxis->GetBinCenter(startBin + i), trackHistoTmpYAxis->GetBinCenter(startBin_far + y)); + } + } + } + } + } + } + if (plotOnline_) { + for (auto &plt : potPlots_) { + plt.second.planesWithDigis->Fill(plt.second.planesWithDigisSet.size()); + plt.second.planesWithDigisSet.clear(); + plt.second.planesWithTime->Fill(plt.second.planesWithTimeSet.size()); + plt.second.planesWithTimeSet.clear(); + } + + for (const auto &plt : channelsPerPlane) + planePlots_[plt.first].hitMultiplicity->Fill(plt.second); + + for (const auto &plt : channelsPerPlaneWithTime) + planePlots_[plt.first].hitMultiplicityWithTime->Fill(plt.second); + } + timeOfPreviousEvent_ = event.time().value(); +} + +//---------------------------------------------------------------------------------------------------- + +void DiamondSampicDQMSource::globalEndLuminosityBlock(const edm::LuminosityBlock &iLumi, const edm::EventSetup &) { + auto lumiCache = luminosityBlockCache(iLumi.index()); + if (!perLSsaving_ && plotOnline_) { + for (auto &plot : potPlots_) + *(plot.second.hitDistribution2d_lumisection->getTH2F()) = *(lumiCache->hitDistribution2dMap[plot.first]); + globalPlot_.digiSentPercentage->Reset(); + for (auto &plot : sectorPlots_) + plot.second.digiSentPercentage->Reset(); + TH2F *hitHistoGlobalTmp = globalPlot_.digiSentPercentage->getTH2F(); + for (auto &plot : potPlots_) { + TH2F *hitHistoTmp = plot.second.digiSentPercentage->getTH2F(); + TH2F *histoSent = plot.second.digiSent->getTH2F(); + TH2F *histoAll = plot.second.digiAll->getTH2F(); + + hitHistoTmp->Divide(histoSent, histoAll); + hitHistoTmp->Scale(100); + hitHistoGlobalTmp->Add(hitHistoTmp, 1); + + plot.second.baseline->Reset(); + plot.second.noiseRMS->Reset(); + plot.second.meanAmplitude->Reset(); + plot.second.cellOfMax->Reset(); + //plot.second.hitRate->Reset(); + CTPPSDiamondDetId rpId(plot.first); + TH2F *hitHistoSectorTmp = sectorPlots_[rpId.armId()].digiSentPercentage->getTH2F(); + hitHistoSectorTmp->Add(hitHistoTmp, 1); + + for (auto &chPlot : channelPlots_) { + CTPPSDiamondDetId chId(chPlot.first); + if (chId.arm() == rpId.arm() && chId.rp() == rpId.rp()) { + plot.second.baseline->Fill(chId.plane(), chId.channel(), chPlot.second.noiseSamples->getTH1F()->GetMean()); + plot.second.noiseRMS->Fill(chId.plane(), chId.channel(), chPlot.second.noiseSamples->getTH1F()->GetRMS()); + plot.second.meanAmplitude->Fill(chId.plane(), chId.channel(), chPlot.second.amplitude->getTH1F()->GetMean()); + plot.second.cellOfMax->Fill(chId.plane(), chId.channel(), chPlot.second.cellOfMax->getTH1F()->GetMean()); + //auto hitsCounterPerLumisection = lumiCache->hitsCounterMap[chPlot.first]; + //plot.second.hitRate->Fill(chId.plane(), chId.channel(), (double)hitsCounterPerLumisection * HIT_RATE_FACTOR); + } + } + } + + // for (auto &plot : channelPlots_) { + // auto hitsCounterPerLumisection = lumiCache->hitsCounterMap[plot.first]; + // if (hitsCounterPerLumisection != 0) { + // plot.second.hitRate->Fill((double)hitsCounterPerLumisection * HIT_RATE_FACTOR); + // } + // } + } +} + +DEFINE_FWK_MODULE(DiamondSampicDQMSource); diff --git a/DQM/CTPPS/python/ctppsDQM_cff.py b/DQM/CTPPS/python/ctppsDQM_cff.py index 3221dd26f2ca1..f8e1a0980914c 100644 --- a/DQM/CTPPS/python/ctppsDQM_cff.py +++ b/DQM/CTPPS/python/ctppsDQM_cff.py @@ -7,6 +7,8 @@ from DQM.CTPPS.ctppsDiamondDQMSource_cfi import * +from DQM.CTPPS.diamondSampicDQMSource_cfi import * + from DQM.CTPPS.totemTimingDQMSource_cfi import * from DQM.CTPPS.ctppsPixelDQMSource_cfi import * @@ -23,7 +25,7 @@ _ctppsDQMOnlineSource = cms.Sequence( ctppsPixelDQMSource + ctppsDiamondDQMSource - + totemTimingDQMSource + + diamondSampicDQMSourceOnline + ctppsCommonDQMSourceOnline ) @@ -35,7 +37,7 @@ totemRPDQMSource + ctppsPixelDQMSource + ctppsDiamondDQMSource - + totemTimingDQMSource + + diamondSampicDQMSourceOnline + ctppsCommonDQMSourceOnline + elasticPlotDQMSource ) @@ -52,19 +54,32 @@ #Check if perLSsaving is enabled to mask MEs vs LS from Configuration.ProcessModifiers.dqmPerLSsaving_cff import dqmPerLSsaving dqmPerLSsaving.toModify(ctppsDiamondDQMSource, perLSsaving=True) -dqmPerLSsaving.toModify(totemTimingDQMSource, perLSsaving=True) +dqmPerLSsaving.toModify(diamondSampicDQMSourceOffline, perLSsaving=True) dqmPerLSsaving.toModify(ctppsCommonDQMSourceOffline, perLSsaving=True) _ctppsDQMOfflineSource = cms.Sequence( ctppsPixelDQMOfflineSource - + ctppsDiamondDQMSource - + totemTimingDQMSource + + ctppsDiamondDQMOfflineSource + + diamondSampicDQMSourceOffline + ctppsCommonDQMSourceOffline ) _ctppsDQMOfflineHarvest = cms.Sequence( ) +from Configuration.Eras.Modifier_ctpps_2018_cff import ctpps_2018 +ctpps_2018.toReplaceWith( + _ctppsDQMOfflineSource, + cms.Sequence( + ctppsPixelDQMOfflineSource + + ctppsDiamondDQMOfflineSource + + totemTimingDQMSource + + ctppsCommonDQMSourceOffline + ) + +) + + # the actually used sequences must be empty for pre-PPS data from Configuration.Eras.Modifier_ctpps_cff import ctpps diff --git a/DQM/CTPPS/python/ctppsDiamondDQMSource_cfi.py b/DQM/CTPPS/python/ctppsDiamondDQMSource_cfi.py index 7611902ba1a6c..905c436dfcebf 100644 --- a/DQM/CTPPS/python/ctppsDiamondDQMSource_cfi.py +++ b/DQM/CTPPS/python/ctppsDiamondDQMSource_cfi.py @@ -8,9 +8,56 @@ tagDiamondRecHits = cms.InputTag("ctppsDiamondRecHits"), tagDiamondLocalTracks = cms.InputTag("ctppsDiamondLocalTracks"), tagPixelLocalTracks = cms.InputTag("ctppsPixelLocalTracks"), + + excludeMultipleHits = cms.bool(True), + extractDigiInfo = cms.bool(True), + + plotOnline = cms.untracked.bool(True), + plotOffline= cms.untracked.bool(False), + + offsetsOOT = cms.VPSet( # cut on the OOT bin for physics hits + # 2016, after TS2 + cms.PSet( + validityRange = cms.EventRange("1:min - 292520:max"), + centralOOT = cms.int32(1), + ), + # 2017 + cms.PSet( + validityRange = cms.EventRange("292521:min - 301417:max"), + centralOOT = cms.int32(3), + ), + # 2017, after channel delays corrections + cms.PSet( + validityRange = cms.EventRange("301418:min - 301517:max"), + centralOOT = cms.int32(1), + ), + # 2017, after channel delays corrections + cms.PSet( + validityRange = cms.EventRange("301518:min - 9999999:max"), + centralOOT = cms.int32(0), + ), + ), + + perLSsaving = cms.untracked.bool(False), #driven by DQMServices/Core/python/DQMStore_cfi.py + + verbosity = cms.untracked.uint32(10), +) + +ctppsDiamondDQMOfflineSource = DQMEDAnalyzer('CTPPSDiamondDQMSource', + tagStatus = cms.InputTag("ctppsDiamondRawToDigi", "TimingDiamond"), + tagDigi = cms.InputTag("ctppsDiamondRawToDigi", "TimingDiamond"), + tagFEDInfo = cms.InputTag("ctppsDiamondRawToDigi", "TimingDiamond"), + tagDiamondRecHits = cms.InputTag("ctppsDiamondRecHits"), + tagDiamondLocalTracks = cms.InputTag("ctppsDiamondLocalTracks"), + tagPixelLocalTracks = cms.InputTag("ctppsPixelLocalTracks"), + excludeMultipleHits = cms.bool(True), + extractDigiInfo = cms.bool(True), + plotOnline = cms.untracked.bool(False), + plotOffline= cms.untracked.bool(True), + offsetsOOT = cms.VPSet( # cut on the OOT bin for physics hits # 2016, after TS2 cms.PSet( @@ -35,6 +82,6 @@ ), perLSsaving = cms.untracked.bool(False), #driven by DQMServices/Core/python/DQMStore_cfi.py - + verbosity = cms.untracked.uint32(10), ) diff --git a/DQM/CTPPS/python/diamondSampicDQMSource_cfi.py b/DQM/CTPPS/python/diamondSampicDQMSource_cfi.py new file mode 100644 index 0000000000000..e4bb2a48a6d1c --- /dev/null +++ b/DQM/CTPPS/python/diamondSampicDQMSource_cfi.py @@ -0,0 +1,28 @@ +import FWCore.ParameterSet.Config as cms + +from DQMServices.Core.DQMEDAnalyzer import DQMEDAnalyzer +diamondSampicDQMSourceOnline = DQMEDAnalyzer('DiamondSampicDQMSource', + tagDigi = cms.InputTag("totemTimingRawToDigi", "TotemTiming"), + tagFEDInfo = cms.InputTag("totemTimingRawToDigi", "TotemTiming"), + tagRecHits = cms.InputTag("totemTimingRecHits"), + tagTracks = cms.InputTag("diamondSampicLocalTracks"), + tagLocalTrack = cms.InputTag("totemRPLocalTrackFitter"), + + samplesForNoise = cms.untracked.uint32(6), + + verbosity = cms.untracked.uint32(10), + plotOnline=cms.untracked.bool(True) +) + +diamondSampicDQMSourceOffline = DQMEDAnalyzer('DiamondSampicDQMSource', + tagDigi = cms.InputTag("totemTimingRawToDigi", "TotemTiming"), + tagFEDInfo = cms.InputTag("totemTimingRawToDigi", "TotemTiming"), + tagRecHits = cms.InputTag("totemTimingRecHits"), + tagTracks = cms.InputTag("diamondSampicLocalTracks"), + tagLocalTrack = cms.InputTag("totemRPLocalTrackFitter"), + + samplesForNoise = cms.untracked.uint32(6), + + verbosity = cms.untracked.uint32(10), + plotOnline=cms.untracked.bool(False) +) diff --git a/DQM/CTPPS/test/diamond_dqm_test_cfg.py b/DQM/CTPPS/test/diamond_dqm_test_cfg.py index 78eeebdfa86c8..b3aa3a277c22c 100644 --- a/DQM/CTPPS/test/diamond_dqm_test_cfg.py +++ b/DQM/CTPPS/test/diamond_dqm_test_cfg.py @@ -1,21 +1,19 @@ import FWCore.ParameterSet.Config as cms -import string +from Configuration.Eras.Era_Run2_2018_cff import Run2_2018 -process = cms.Process('RECODQM') +process = cms.Process('RECODQM', Run2_2018) process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(-1) ) process.verbosity = cms.untracked.PSet( input = cms.untracked.int32(-1) ) # minimum of logs process.MessageLogger = cms.Service("MessageLogger", - statistics = cms.untracked.vstring(), - destinations = cms.untracked.vstring('cerr'), cerr = cms.untracked.PSet( threshold = cms.untracked.string('WARNING') ) ) - - # import of standard configurations + +# import of standard configurations process.load('Configuration.StandardSequences.Services_cff') process.load('FWCore.MessageService.MessageLogger_cfi') process.load('Configuration.EventContent.EventContent_cff') @@ -30,47 +28,31 @@ # raw data source process.source = cms.Source("PoolSource", - # replace '*.root',',' with the source file you want to use fileNames = cms.untracked.vstring( - *( -'/store/data/Run2017C/ZeroBias/AOD/PromptReco-v2/000/300/088/00000/469D8C89-1477-E711-A6A4-02163E01190C.root', - ) +'/store/data/Run2018D/ZeroBias/AOD/12Nov2019_UL2018_rsb-v1/280000/FE61A0D8-CEDC-2142-81AA-06301F452792.root', ), ) - from Configuration.AlCa.GlobalTag import GlobalTag -process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:run2_hlt_relval', '') +#process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:run2_hlt_relval', '') +process.GlobalTag = GlobalTag(process.GlobalTag, '120X_dataRun2_v2', '') # raw-to-digi conversion process.load("EventFilter.CTPPSRawToDigi.ctppsRawToDigi_cff") # local RP reconstruction chain with standard settings process.load("RecoPPS.Configuration.recoCTPPS_cff") - -# rechits production -process.load('RecoPPS.Local.ctppsDiamondRecHits_cfi') - -# local tracks fitter -process.load('RecoPPS.Local.ctppsDiamondLocalTracks_cfi') - -# pixel -process.load('RecoPPS.Local.ctppsPixelLocalTracks_cfi') - +process.load('Geometry.VeryForwardGeometry.geometryRPFromDD_2021_cfi') # CTPPS DQM modules process.load("DQM.CTPPS.ctppsDQM_cff") -process.ctppsDiamondDQMSource.excludeMultipleHits = cms.bool(True); - +process.ctppsDiamondDQMSource.excludeMultipleHits = cms.bool(True) +process.ctppsDiamondDQMSource.plotOnline = cms.untracked.bool(True) +process.ctppsDiamondDQMSource.plotOffline = cms.untracked.bool(False) process.path = cms.Path( - #process.ctppsRawToDigi * - process.recoCTPPS * - #process.ctppsDiamondRawToDigi * - process.ctppsDiamondRecHits * - process.ctppsDiamondLocalTracks * - process.ctppsPixelLocalTracks * - process.ctppsDQM - ) - + process.recoCTPPS* + process.ctppsDQMOnlineSource* + process.ctppsDQMOnlineHarvest +) process.end_path = cms.EndPath( process.dqmEnv + diff --git a/DQM/DTMonitorModule/src/DTLocalTriggerSynchTask.cc b/DQM/DTMonitorModule/src/DTLocalTriggerSynchTask.cc index 79ff423d6acb6..d87827426097f 100644 --- a/DQM/DTMonitorModule/src/DTLocalTriggerSynchTask.cc +++ b/DQM/DTMonitorModule/src/DTLocalTriggerSynchTask.cc @@ -9,6 +9,7 @@ // Framework #include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" #include "FWCore/Utilities/interface/InputTag.h" // Geometry @@ -40,7 +41,8 @@ using namespace std; DTLocalTriggerSynchTask::DTLocalTriggerSynchTask(const edm::ParameterSet& ps) : nevents(0), tTrigSync{DTTTrigSyncFactory::get()->create(ps.getParameter("tTrigMode"), - ps.getParameter("tTrigModeConfig"))}, + ps.getParameter("tTrigModeConfig"), + consumesCollector())}, muonGeomToken_(esConsumes()) { edm::LogVerbatim("DTLocalTriggerSynchTask") << "[DTLocalTriggerSynchTask]: Constructor" << endl; tm_Token_ = consumes(ps.getParameter("TMInputTag")); diff --git a/DQM/EcalCommon/data/readEcalDQMStatus.py b/DQM/EcalCommon/data/readEcalDQMStatus.py deleted file mode 100644 index e0fd16e0d0cc7..0000000000000 --- a/DQM/EcalCommon/data/readEcalDQMStatus.py +++ /dev/null @@ -1,43 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -process = cms.Process("DB") - -process.load("Geometry.CMSCommonData.cmsIdealGeometryXML_cfi") - -process.load("Geometry.EcalMapping.EcalMapping_cfi") -process.load("Geometry.EcalMapping.EcalMappingRecord_cfi") - -process.load("Geometry.CaloEventSetup.CaloGeometry_cfi") -process.load("Geometry.CaloEventSetup.CaloTopology_cfi") -process.load("Geometry.CaloEventSetup.EcalTrigTowerConstituents_cfi") - -process.source = cms.Source("EmptyIOVSource", - firstValue = cms.uint64(1), - lastValue = cms.uint64(1), - timetype = cms.string('runnumber'), - interval = cms.uint64(1) - ) - -process.load("DQM.Integration.test.FrontierCondition_GT_cfi") - -process.GlobalTag.toGet = cms.VPSet( - cms.PSet(record = cms.string("EcalDQMChannelStatusRcd"), -# tag = cms.string("EcalDQMChannelStatus_v1_hlt"), -# tag = cms.string("EcalDQMChannelStatus_v1_express"), -# tag = cms.string("EcalDQMChannelStatus_v1_offline"), -# connect = cms.untracked.string("sqlite_file:mask-ECAL.db") - ), - cms.PSet(record = cms.string("EcalDQMTowerStatusRcd"), -# tag = cms.string("EcalDQMTowerStatus_v1_hlt"), -# tag = cms.string("EcalDQMTowerStatus_v1_express"), -# tag = cms.string("EcalDQMTowerStatus_v1_offline"), -# connect = cms.untracked.string("sqlite_file:mask-ECAL.db") - ) -) - -process.read = cms.EDAnalyzer("EcalDQMStatusReader", - verbose = cms.untracked.bool(True), -) - -process.p = cms.Path(process.read) - diff --git a/DQM/EcalCommon/data/writeEcalDQMStatus.py b/DQM/EcalCommon/data/writeEcalDQMStatus.py index 735789141be81..ce7e721922f5f 100644 --- a/DQM/EcalCommon/data/writeEcalDQMStatus.py +++ b/DQM/EcalCommon/data/writeEcalDQMStatus.py @@ -15,10 +15,10 @@ process.EcalTrivialConditionRetriever.producedEcalDQMChannelStatus = False process.EcalTrivialConditionRetriever.producedEcalDQMTowerStatus = False -process.load("CondCore.DBCommon.CondDBCommon_cfi") -process.CondDBCommon.DBParameters.authenticationPath = '/nfshome0/popcondev/conddb' -#process.CondDBCommon.connect = 'sqlite_file:mask-ECAL.db' -#process.CondDBCommon.connect = 'oracle://cms_orcon_prod/CMS_COND_34X_ECAL' +process.load("CondCore.CondDB.CondDB_cfi") +process.CondDB.DBParameters.authenticationPath = '/nfshome0/popcondev/conddb' +process.CondDB.connect = 'sqlite_file:mask-ECAL.db' +#process.CondDB.connect = 'oracle://cms_orcon_prod/CMS_COND_34X_ECAL' process.source = cms.Source("EmptyIOVSource", firstValue = cms.uint64(1), @@ -28,17 +28,17 @@ ) process.PoolDBOutputService = cms.Service("PoolDBOutputService", - process.CondDBCommon, + process.CondDB, toPut = cms.VPSet( cms.PSet( record = cms.string('EcalDQMChannelStatusRcd'), -# tag = cms.string('EcalDQMChannelStatus_v1_hlt') + tag = cms.string('EcalDQMChannelStatus_v1_hlt') # tag = cms.string('EcalDQMChannelStatus_v1_express') # tag = cms.string('EcalDQMChannelStatus_v1_offline') ), cms.PSet( record = cms.string('EcalDQMTowerStatusRcd'), -# tag = cms.string('EcalDQMTowerStatus_v1_hlt') + tag = cms.string('EcalDQMTowerStatus_v1_hlt') # tag = cms.string('EcalDQMTowerStatus_v1_express') # tag = cms.string('EcalDQMTowerStatus_v1_offline') ) @@ -46,19 +46,9 @@ ) process.write = cms.EDAnalyzer("EcalDQMStatusWriter", - verbose = cms.untracked.bool(False), - toPut = cms.VPSet( - cms.PSet( - conditionType = cms.untracked.string('EcalDQMChannelStatus'), - since = cms.untracked.uint32(1), - inputFile = cms.untracked.string('mask-ECAL.txt') - ), - cms.PSet( - conditionType = cms.untracked.string('EcalDQMTowerStatus'), - since = cms.untracked.uint32(1), - inputFile = cms.untracked.string('mask-ECAL.txt') - ) - ) + firstRun = cms.untracked.uint32(350000), + inputFile = cms.untracked.string('mask-EB.txt') + #inputFile = cms.untracked.string('mask-EE.txt') ) process.p = cms.Path(process.write) diff --git a/DQM/EcalCommon/python/CommonParams_cfi.py b/DQM/EcalCommon/python/CommonParams_cfi.py index b7905c858cdf1..fe3bb8cdc8ba9 100644 --- a/DQM/EcalCommon/python/CommonParams_cfi.py +++ b/DQM/EcalCommon/python/CommonParams_cfi.py @@ -4,8 +4,8 @@ onlineMode = cms.untracked.bool(False), willConvertToEDM = cms.untracked.bool(True) ) -ecaldqmLaserWavelengths = 1, 2, 3 -ecaldqmLedWavelengths = 1, 2 -ecaldqmMGPAGains = 12 -ecaldqmMGPAGainsPN = 16 +ecaldqmLaserWavelengths = cms.untracked.vint32(1, 2, 3) +ecaldqmLedWavelengths = cms.untracked.vint32(1, 2) +ecaldqmMGPAGains = cms.untracked.vint32(12) +ecaldqmMGPAGainsPN = cms.untracked.vint32(16) diff --git a/DQM/EcalMonitorDbModule/interface/EcalDQMStatusWriter.h b/DQM/EcalMonitorDbModule/interface/EcalDQMStatusWriter.h index 56ee6decfeabb..a96dbb725e007 100644 --- a/DQM/EcalMonitorDbModule/interface/EcalDQMStatusWriter.h +++ b/DQM/EcalMonitorDbModule/interface/EcalDQMStatusWriter.h @@ -1,5 +1,5 @@ -#ifndef EcalDQMStatusWriter_H -#define EcalDQMStatusWriter_H +#ifndef DQM_EcalMonitorDbModule_EcalDQMStatusWriter_h +#define DQM_EcalMonitorDbModule_EcalDQMStatusWriter_h #include "FWCore/Framework/interface/one/EDAnalyzer.h" @@ -11,24 +11,25 @@ #include -class EcalDQMStatusWriter : public edm::one::EDAnalyzer<> { +class EcalDQMStatusWriter : public edm::one::EDAnalyzer { public: EcalDQMStatusWriter(edm::ParameterSet const &); ~EcalDQMStatusWriter() override {} private: void analyze(edm::Event const &, edm::EventSetup const &) override; - void beginRun(edm::Run const &, edm::EventSetup const &); + void beginRun(edm::Run const &, edm::EventSetup const &) override; + void endRun(edm::Run const &, edm::EventSetup const &) override; EcalDQMChannelStatus channelStatus_; EcalDQMTowerStatus towerStatus_; unsigned firstRun_; std::ifstream inputFile_; - EcalElectronicsMapping const *electronicsMap; + EcalElectronicsMapping const *electronicsMap_; + edm::ESGetToken elecMapHandle_; void setElectronicsMap(edm::EventSetup const &); EcalElectronicsMapping const *GetElectronicsMap(); - edm::ESGetToken elecMapHandle; }; #endif diff --git a/DQM/EcalMonitorDbModule/plugins/EcalDQMStatusWriter.cc b/DQM/EcalMonitorDbModule/plugins/EcalDQMStatusWriter.cc index 84e3377f925e6..c959fd16b8570 100644 --- a/DQM/EcalMonitorDbModule/plugins/EcalDQMStatusWriter.cc +++ b/DQM/EcalMonitorDbModule/plugins/EcalDQMStatusWriter.cc @@ -9,14 +9,13 @@ #include "FWCore/Framework/interface/MakerMacros.h" -#include - EcalDQMStatusWriter::EcalDQMStatusWriter(edm::ParameterSet const &_ps) : channelStatus_(), towerStatus_(), firstRun_(_ps.getUntrackedParameter("firstRun")), inputFile_(_ps.getUntrackedParameter("inputFile")), - elecMapHandle(esConsumes()) { + electronicsMap_(nullptr), + elecMapHandle_(esConsumes()) { if (!inputFile_.is_open()) throw cms::Exception("Invalid input for EcalDQMStatusWriter"); } @@ -30,25 +29,27 @@ void EcalDQMStatusWriter::beginRun(edm::Run const &_run, edm::EventSetup const & statusManager.writeToObj(channelStatus_, towerStatus_); } +void EcalDQMStatusWriter::endRun(edm::Run const &_run, edm::EventSetup const &_es) {} + void EcalDQMStatusWriter::analyze(edm::Event const &, edm::EventSetup const &_es) { cond::service::PoolDBOutputService &dbOutput(*edm::Service()); if (firstRun_ == dbOutput.endOfTime()) return; - dbOutput.writeOne(&channelStatus_, firstRun_, "EcalDQMChannelStatusRcd"); - dbOutput.writeOne(&towerStatus_, firstRun_, "EcalDQMTowerStatusRcd"); + dbOutput.writeOneIOV(channelStatus_, firstRun_, "EcalDQMChannelStatusRcd"); + dbOutput.writeOneIOV(towerStatus_, firstRun_, "EcalDQMTowerStatusRcd"); firstRun_ = dbOutput.endOfTime(); // avoid accidentally re-writing the conditions } void EcalDQMStatusWriter::setElectronicsMap(edm::EventSetup const &_es) { - electronicsMap = &_es.getData(elecMapHandle); + electronicsMap_ = &_es.getData(elecMapHandle_); } EcalElectronicsMapping const *EcalDQMStatusWriter::GetElectronicsMap() { - if (!electronicsMap) + if (!electronicsMap_) throw cms::Exception("InvalidCall") << "Electronics Mapping not initialized"; - return electronicsMap; + return electronicsMap_; } DEFINE_FWK_MODULE(EcalDQMStatusWriter); diff --git a/DQM/EcalMonitorTasks/interface/OccupancyTask.h b/DQM/EcalMonitorTasks/interface/OccupancyTask.h index bd4cd4e9d0a48..d58a0f1172fcd 100644 --- a/DQM/EcalMonitorTasks/interface/OccupancyTask.h +++ b/DQM/EcalMonitorTasks/interface/OccupancyTask.h @@ -29,7 +29,6 @@ namespace ecaldqm { void runOnDigis(DigiCollection const&, Collections); void runOnTPDigis(EcalTrigPrimDigiCollection const&); void runOnRecHits(EcalRecHitCollection const&, Collections); - void setEventTime(const edm::TimeValue_t& iTime); void setTokens(edm::ConsumesCollector&) override; private: diff --git a/DQM/EcalMonitorTasks/src/OccupancyTask.cc b/DQM/EcalMonitorTasks/src/OccupancyTask.cc index 83571c22458f2..f89cdf7016d5c 100644 --- a/DQM/EcalMonitorTasks/src/OccupancyTask.cc +++ b/DQM/EcalMonitorTasks/src/OccupancyTask.cc @@ -1,5 +1,5 @@ #include "DQM/EcalMonitorTasks/interface/OccupancyTask.h" - +#include "FWCore/Framework/interface/Event.h" #include "DQM/EcalCommon/interface/EcalDQMCommonUtils.h" #include "DataFormats/EcalRawData/interface/EcalDCCHeaderBlock.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" @@ -28,7 +28,6 @@ namespace ecaldqm { } void OccupancyTask::beginRun(edm::Run const&, edm::EventSetup const& _es) { FillLaser = true; } - void OccupancyTask::setEventTime(const edm::TimeValue_t& iTime) { m_iTime = iTime; } void OccupancyTask::beginEvent(edm::Event const& _evt, edm::EventSetup const& _es, bool const& ByLumiResetSwitch, @@ -39,6 +38,7 @@ namespace ecaldqm { MEs_.at("RecHitThrAllByLumi").reset(GetElectronicsMap()); } MESet& meLaserCorrProjEta(MEs_.at("LaserCorrProjEta")); + m_iTime = _evt.time().value(); if (FillLaser) { float lasercalib = 1.; auto const& laser = &_es.getData(lasertoken_); diff --git a/DQM/EcalMonitorTasks/src/RawDataTask.cc b/DQM/EcalMonitorTasks/src/RawDataTask.cc index e15adf4b56d69..859e9f72233c6 100644 --- a/DQM/EcalMonitorTasks/src/RawDataTask.cc +++ b/DQM/EcalMonitorTasks/src/RawDataTask.cc @@ -8,6 +8,7 @@ #include "DQM/EcalCommon/interface/FEFlags.h" #include "DataFormats/EcalDetId/interface/EcalElectronicsId.h" +#include "DataFormats/Luminosity/interface/LumiConstants.h" namespace ecaldqm { @@ -22,7 +23,15 @@ namespace ecaldqm { void RawDataTask::beginEvent(edm::Event const& _evt, edm::EventSetup const&, bool const& ByLumiResetSwitch, bool&) { orbit_ = _evt.orbitNumber() & 0xffffffff; + bx_ = _evt.bunchCrossing() & 0xfff; + // There's no agreement in CMS on how to label the last/first BX + // TCDS calls it always 3564, but some subsystems call it 0. + // From testing: bx_ is labeled 0, dccBX and FEBxs[iFE] labeled 3564 + // Setting bx_ to 0 to match the other two + if (bx_ == LumiConstants::numBX) // 3564 + bx_ = 0; + triggerType_ = _evt.experimentType() & 0xf; l1A_ = 0; feL1Offset_ = _evt.isRealData() ? 1 : 0; diff --git a/DQM/GEM/plugins/GEMDAQStatusSource.cc b/DQM/GEM/plugins/GEMDAQStatusSource.cc index 0cf50109c125c..0a76ef25912d2 100644 --- a/DQM/GEM/plugins/GEMDAQStatusSource.cc +++ b/DQM/GEM/plugins/GEMDAQStatusSource.cc @@ -38,7 +38,7 @@ void GEMDAQStatusSource::SetLabelAMC13Status(MonitorElement *h2Status) { h2Status->setBinLabel(unBinPos++, "S-link error", 2); h2Status->setBinLabel(unBinPos++, "Wrong FED ID", 2); - h2Status->setBinLabel(1, "GE11-N", 1); + h2Status->setBinLabel(1, "GE11-M", 1); h2Status->setBinLabel(2, "GE11-P", 1); } @@ -107,8 +107,8 @@ void GEMDAQStatusSource::bookHistograms(DQMStore::IBooker &ibooker, edm::Run con h2AMC13Status_ = ibooker.book2D("amc13_status", "AMC13 Status;AMC13;", 2, 0.5, 2.5, nBitAMC13_, 0.5, nBitAMC13_ + 0.5); - h2AMCStatusNeg_ = ibooker.book2D("amc_status_GE11-N", - "AMC Status GE11-N;AMC slot;", + h2AMCStatusNeg_ = ibooker.book2D("amc_status_GE11-M", + "AMC Status GE11-M;AMC slot;", nAMCSlots_, -0.5, nAMCSlots_ - 0.5, diff --git a/DQM/HcalCommon/interface/Constants.h b/DQM/HcalCommon/interface/Constants.h index d91541b65851c..c9494a31c5409 100644 --- a/DQM/HcalCommon/interface/Constants.h +++ b/DQM/HcalCommon/interface/Constants.h @@ -25,6 +25,7 @@ namespace hcaldqm { // use conversion functions in Utilities.h // For fast look up // This is for uTCA Crates/FEDs only - no other way... + // As of 2021: https://cmshcal.docs.cern.ch/hcos/crateFedMap/ std::map const crate2fed_map = { {24, 1100}, {20, 1102}, @@ -38,7 +39,6 @@ namespace hcaldqm { {22, 1118}, {29, 1120}, {32, 1122}, - //{38, 1134}, {3, 724}, {7, 726}, {6, 728}, @@ -48,7 +48,7 @@ namespace hcaldqm { {23, 1124}, {27, 1126}, {26, 1128}, - {38, 1130}, + {38, 1134}, }; std::map const fed2crate_map = { @@ -56,16 +56,18 @@ namespace hcaldqm { {1101, 24}, {1102, 20}, {1103, 20}, {1104, 21}, {1105, 21}, {1106, 25}, {1107, 25}, {1108, 31}, {1109, 31}, {1110, 35}, {1111, 35}, {1112, 37}, {1113, 37}, {1114, 34}, {1115, 34}, {1116, 30}, {1117, 30}, {1118, 22}, {1119, 22}, {1120, 29}, {1121, 29}, {1122, 32}, {1123, 32}, {1124, 23}, {1125, 23}, {1126, 27}, {1127, 27}, - {1128, 26}, {1129, 26}, {1130, 38}, {1131, 38}, {1134, 38}, {1135, 38}, + {1128, 26}, {1129, 26}, {1134, 38}, {1135, 38}, {1140, 24}, {1141, 20}, {1142, 21}, {1143, 25}, {1144, 31}, + {1145, 35}, {1146, 37}, {1147, 34}, {1148, 30}, }; - std::vector const fedList = {724, 725, 726, 727, 728, 729, 730, 731, 1100, 1101, 1102, - 1103, 1104, 1105, 1106, 1107, 1108, 1109, 1110, 1111, 1112, 1113, - 1114, 1115, 1116, 1117, 1118, 1119, 1120, 1121, 1122, 1123, 1124, - 1125, 1126, 1127, 1128, 1129, 1130, 1131, 1134, 1135}; - std::vector const fedListuTCA = { - 1100, 1101, 1102, 1103, 1104, 1105, 1106, 1107, 1108, 1109, 1110, 1111, 1112, 1113, 1114, 1115, 1116, - 1117, 1118, 1119, 1120, 1121, 1122, 1123, 1124, 1125, 1126, 1127, 1128, 1129, 1130, 1131, 1134, 1135}; + std::vector const fedList = { + 724, 725, 726, 727, 728, 729, 730, 731, 1100, 1101, 1102, 1103, 1104, 1105, 1106, 1107, 1108, + 1109, 1110, 1111, 1112, 1113, 1114, 1115, 1116, 1117, 1118, 1119, 1120, 1121, 1122, 1123, 1124, 1125, + 1126, 1127, 1128, 1129, 1134, 1135, 1140, 1141, 1142, 1143, 1144, 1145, 1146, 1147, 1148}; + std::vector const fedListuTCA = {1100, 1101, 1102, 1103, 1104, 1105, 1106, 1107, 1108, 1109, 1110, + 1111, 1112, 1113, 1114, 1115, 1116, 1117, 1118, 1119, 1120, 1121, + 1122, 1123, 1124, 1125, 1126, 1127, 1128, 1129, 1134, 1135, 1140, + 1141, 1142, 1143, 1144, 1145, 1146, 1147, 1148}; std::vector const fedListVME = {724, 725, 726, 727, 728, 729, 730, 731}; std::vector const crateList = {3, 6, 7, 13, 20, 21, 22, 23, 24, 25, 26, 27, 29, 30, 31, 32, 34, 35, 37, 38}; diff --git a/DQM/HcalCommon/interface/DQModule.h b/DQM/HcalCommon/interface/DQModule.h index c94c14cbbadbb..ba7221e182c19 100644 --- a/DQM/HcalCommon/interface/DQModule.h +++ b/DQM/HcalCommon/interface/DQModule.h @@ -29,8 +29,9 @@ namespace hcaldqm { class DQModule { public: - DQModule(edm::ParameterSet const &); + DQModule(edm::ParameterSet const&); virtual ~DQModule() noexcept(false) {} + static void fillPSetDescription(edm::ParameterSetDescription& desc); protected: // Member variables diff --git a/DQM/HcalCommon/interface/DQTask.h b/DQM/HcalCommon/interface/DQTask.h index c6fe7c37eec1c..736948f4deddb 100644 --- a/DQM/HcalCommon/interface/DQTask.h +++ b/DQM/HcalCommon/interface/DQTask.h @@ -43,6 +43,7 @@ namespace hcaldqm { std::shared_ptr globalBeginLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &) const override; void globalEndLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &) override; + static void fillPSetDescription(edm::ParameterSetDescription &des); protected: // protected funcs diff --git a/DQM/HcalCommon/interface/HcalCommonHeaders.h b/DQM/HcalCommon/interface/HcalCommonHeaders.h index a6031be0f859d..bee231c8dda9a 100644 --- a/DQM/HcalCommon/interface/HcalCommonHeaders.h +++ b/DQM/HcalCommon/interface/HcalCommonHeaders.h @@ -56,7 +56,6 @@ #include "DQM/HcalCommon/interface/Constants.h" -#include "boost/lexical_cast.hpp" #include #include #include diff --git a/DQM/HcalCommon/src/DQClient.cc b/DQM/HcalCommon/src/DQClient.cc index b611a4800cd82..8d04c4072140e 100644 --- a/DQM/HcalCommon/src/DQClient.cc +++ b/DQM/HcalCommon/src/DQClient.cc @@ -8,6 +8,7 @@ namespace hcaldqm { edm::ConsumesCollector &iC) : DQModule(ps), _taskname(taskname), + _totalLS(0), _maxProcessedLS(0), hcalDbServiceToken_(iC.esConsumes()), runInfoToken_(iC.esConsumes()), diff --git a/DQM/HcalCommon/src/DQModule.cc b/DQM/HcalCommon/src/DQModule.cc index d19e5011c1217..8d9b962f640c3 100644 --- a/DQM/HcalCommon/src/DQModule.cc +++ b/DQM/HcalCommon/src/DQModule.cc @@ -2,7 +2,7 @@ #include "DQM/HcalCommon/interface/DQModule.h" namespace hcaldqm { - DQModule::DQModule(edm::ParameterSet const &ps) : _evsTotal(0), _evsPerLS(0) { + DQModule::DQModule(edm::ParameterSet const& ps) : _evsTotal(0), _evsPerLS(0) { _name = ps.getUntrackedParameter("name", "Unknown_Module"); _debug = ps.getUntrackedParameter("debug", 0); _logger.set(_name, _debug); @@ -26,4 +26,11 @@ namespace hcaldqm { _logger.debug("Calling Constructor"); } + + void DQModule::fillPSetDescription(edm::ParameterSetDescription& desc) { + desc.addUntracked("subsystem", "Hcal"); + desc.addUntracked("mtype", true); + desc.addUntracked("ptype", 0); + desc.addUntracked("maxLS", 4000); + } } // namespace hcaldqm diff --git a/DQM/HcalCommon/src/DQTask.cc b/DQM/HcalCommon/src/DQTask.cc index fa887092dcee1..ef4694be89482 100644 --- a/DQM/HcalCommon/src/DQTask.cc +++ b/DQM/HcalCommon/src/DQTask.cc @@ -23,6 +23,13 @@ namespace hcaldqm { _tokRaw = consumes(_tagRaw); } + void DQTask::fillPSetDescription(edm::ParameterSetDescription &desc) { + //from class inheritance + hcaldqm::DQModule::fillPSetDescription(desc); + + desc.addUntracked("tagRaw", edm::InputTag("rawDataCollector")); + } + /* * By design, all the sources will ahve this function inherited and will * never override. diff --git a/DQM/HcalCommon/src/HashFunctions.cc b/DQM/HcalCommon/src/HashFunctions.cc index 9b78ea8cddd7c..52a7c834e384e 100644 --- a/DQM/HcalCommon/src/HashFunctions.cc +++ b/DQM/HcalCommon/src/HashFunctions.cc @@ -243,10 +243,15 @@ namespace hcaldqm { if (eid.isVMEid()) return utilities::hash(HcalElectronicsId(FIBERCH_MIN, FIBER_VME_MIN, SPIGOT_MIN, eid.dccid())); else { - // tmp - we need to hash HF's FEDs with slot in mind - // bool isHF = eid.crateId()==22 || eid.crateId()==29 || eid.crateId()==32; + // HO and HO are dual-FED + bool isHF = eid.crateId() == 22 || eid.crateId() == 29 || eid.crateId() == 32; + bool isHO = eid.crateId() == 23 || eid.crateId() == 27 || eid.crateId() == 26 || eid.crateId() == 38; // for HF, slot number is either - int slotToUse = eid.slot() > 6 ? SLOT_uTCA_MIN + 6 : SLOT_uTCA_MIN; + int slotToUse = 1; + if (isHF || isHO) + slotToUse = eid.slot() > 6 ? SLOT_uTCA_MIN + 6 : SLOT_uTCA_MIN; + else + slotToUse = eid.slot() > 8 ? SLOT_uTCA_MIN + 8 : (eid.slot() > 4 ? SLOT_uTCA_MIN + 4 : SLOT_uTCA_MIN); return utilities::hash(HcalElectronicsId(eid.crateId(), slotToUse, FIBER_uTCA_MIN1, FIBERCH_MIN, false)); } } diff --git a/DQM/HcalCommon/src/Utilities.cc b/DQM/HcalCommon/src/Utilities.cc index 486cb3e2ae823..7dc7ed00cb4f7 100644 --- a/DQM/HcalCommon/src/Utilities.cc +++ b/DQM/HcalCommon/src/Utilities.cc @@ -36,9 +36,21 @@ namespace hcaldqm { ++fed; } } else { - if (slot > 6 && (std::find(constants::crateListuTCA.begin(), constants::crateListuTCA.end(), crate) != - constants::crateListuTCA.end())) { // needed to handle dual fed readout - ++fed; + if (crate == 22 || crate == 29 || crate == 32 || crate == 23 || crate == 27 || crate == 26 || + crate == 38) { // needed to handle dual fed readout for HF and HO + if (slot > 6 && (std::find(constants::crateListuTCA.begin(), constants::crateListuTCA.end(), crate) != + constants::crateListuTCA.end())) { + ++fed; // hard coded mid slot FED numbering + } + } else { // needed to handle 3-FED readout for HBHE + if (slot > 8 && (std::find(constants::crateListuTCA.begin(), constants::crateListuTCA.end(), crate) != + constants::crateListuTCA.end())) { + fed = (fed + 1100) / 2 + 40; // hard coded right slot FED numbering, no better way + } else if (slot > 4 && + (std::find(constants::crateListuTCA.begin(), constants::crateListuTCA.end(), crate) != + constants::crateListuTCA.end())) { + ++fed; // hard coded mid slot FED numbering + } } } } @@ -144,7 +156,7 @@ namespace hcaldqm { return false; } else { int fed = crate2fed(eid.crateId(), eid.slot()); - if (fed >= 1100 && fed < 1118) + if ((fed >= 1100 && fed < 1118) || (fed >= 1140 && fed <= 1148)) return true; else return false; @@ -154,17 +166,6 @@ namespace hcaldqm { } bool isFEDHF(HcalElectronicsId const &eid) { - /* - if (eid.isVMEid()) - { - int fed = eid.dccid()+FED_VME_MIN; - if (fed>=718 && fed<=723) - return true; - else - return false; - }*/ - // else - // { if (eid.isVMEid()) return false; int fed = crate2fed(eid.crateId(), eid.slot()); @@ -172,17 +173,15 @@ namespace hcaldqm { return true; else return false; - // } return false; } bool isFEDHO(HcalElectronicsId const &eid) { - if (!eid.isVMEid()) + if (eid.isVMEid()) return false; - - int fed = eid.dccid() + FED_VME_MIN; - if (fed >= 724 && fed <= 731) + int fed = crate2fed(eid.crateId(), eid.slot()); + if (fed >= 1124 && fed <= 1135) return true; else return false; diff --git a/DQM/HcalTasks/interface/QIE11Task.h b/DQM/HcalTasks/interface/QIE11Task.h index b59ffadcb98a7..a7e0bc3b0899d 100644 --- a/DQM/HcalTasks/interface/QIE11Task.h +++ b/DQM/HcalTasks/interface/QIE11Task.h @@ -21,16 +21,17 @@ class QIE11Task : public hcaldqm::DQTask { public: - QIE11Task(edm::ParameterSet const&); + QIE11Task(edm::ParameterSet const &); ~QIE11Task() override {} - void bookHistograms(DQMStore::IBooker&, edm::Run const&, edm::EventSetup const&) override; - void globalEndLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) override; + void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override; + void globalEndLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &) override; + static void fillDescriptions(edm::ConfigurationDescriptions &); protected: - void _process(edm::Event const&, edm::EventSetup const&) override; + void _process(edm::Event const &, edm::EventSetup const &) override; void _resetMonitors(hcaldqm::UpdateFreq) override; - bool _isApplicable(edm::Event const&) override; + bool _isApplicable(edm::Event const &) override; // tags edm::InputTag _tagQIE11; diff --git a/DQM/HcalTasks/plugins/PedestalTask.cc b/DQM/HcalTasks/plugins/PedestalTask.cc index 8616f2c8926b5..44edb89c8a497 100644 --- a/DQM/HcalTasks/plugins/PedestalTask.cc +++ b/DQM/HcalTasks/plugins/PedestalTask.cc @@ -884,8 +884,8 @@ PedestalTask::PedestalTask(edm::ParameterSet const& ps) // @cDAQ if (hcaldqm::utilities::isFEDHBHE(eid) || hcaldqm::utilities::isFEDHO(eid) || hcaldqm::utilities::isFEDHF(eid)) { - double frmissing = double(_xNMsn1LS.get(eid)) / double(_xNChs.get(eid)); - double frbadm = _xNBadMean1LS.get(eid) / _xNChs.get(eid); + double frmissing = (_xNChs.get(eid) == 0) ? 0 : double(_xNMsn1LS.get(eid)) / double(_xNChs.get(eid)); + double frbadm = (_xNChs.get(eid) == 0) ? 0 : _xNBadMean1LS.get(eid) / _xNChs.get(eid); //double frbadr = _xNBadRMS1LS.get(eid)/_xNChs.get(eid); if (frmissing >= _thresh_missing_high) diff --git a/DQM/HcalTasks/plugins/QIE11Task.cc b/DQM/HcalTasks/plugins/QIE11Task.cc index a1c972b50d354..e022673a489ce 100644 --- a/DQM/HcalTasks/plugins/QIE11Task.cc +++ b/DQM/HcalTasks/plugins/QIE11Task.cc @@ -18,6 +18,26 @@ QIE11Task::QIE11Task(edm::ParameterSet const& ps) _laserType = ps.getUntrackedParameter("laserType", -1); _eventType = ps.getUntrackedParameter("eventType", -1); } +//statis +void QIE11Task::fillDescriptions(edm::ConfigurationDescriptions& _desc) { + edm::ParameterSetDescription desc; + + //from class inheritance + hcaldqm::DQTask::fillPSetDescription(desc); + + desc.addUntracked("name", "QIE11Task"); + desc.addUntracked("debug", 0); + desc.addUntracked("runkeyVal", 0); + desc.addUntracked("runkeyName", "pp_run"); + desc.addUntracked("tagQIE11", edm::InputTag("hcalDigis")); + desc.addUntracked("cut", 20); + desc.addUntracked("ped", 4); + desc.addUntracked("laserType", -1); + desc.addUntracked("eventType", -1); + + _desc.addDefault(desc); +} + /* virtual */ void QIE11Task::bookHistograms(DQMStore::IBooker& ib, edm::Run const& r, edm::EventSetup const& es) { if (_ptype == fLocal) if (r.runAuxiliary().run() == 1) diff --git a/DQM/HcalTasks/plugins/RawTask.cc b/DQM/HcalTasks/plugins/RawTask.cc index 9c59f7fceedc1..887ecf08c8008 100644 --- a/DQM/HcalTasks/plugins/RawTask.cc +++ b/DQM/HcalTasks/plugins/RawTask.cc @@ -127,14 +127,14 @@ RawTask::RawTask(edm::ParameterSet const& ps) // Bad Quality _cBadQuality_FEDVME.initialize(_name, "BadQuality", - hcaldqm::hashfunctions::fFED, + hcaldqm::hashfunctions::fCrate, new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSpigot), new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberVMEFiberCh), new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), 0); _cBadQuality_FEDuTCA.initialize(_name, "BadQuality", - hcaldqm::hashfunctions::fFED, + hcaldqm::hashfunctions::fCrate, new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberuTCAFiberCh), new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), diff --git a/DQM/HcalTasks/python/QIE10Task.py b/DQM/HcalTasks/python/QIE10Task.py index 3b497be970c3e..4cb95a5d71fc1 100644 --- a/DQM/HcalTasks/python/QIE10Task.py +++ b/DQM/HcalTasks/python/QIE10Task.py @@ -13,6 +13,9 @@ # tag tagQIE10 = cms.untracked.InputTag("hcalDigis"), + # folder + subsystem = cms.untracked.string("HcalCalib"), + # cuts, cut = cms.untracked.double(20), ped = cms.untracked.int32(4) diff --git a/DQM/HcalTasks/python/QIE11Task.py b/DQM/HcalTasks/python/QIE11Task.py index 4321f73edcb94..e8c27f789086f 100644 --- a/DQM/HcalTasks/python/QIE11Task.py +++ b/DQM/HcalTasks/python/QIE11Task.py @@ -13,6 +13,9 @@ # tag tagQIE11 = cms.untracked.InputTag("hcalDigis"), + # folder + subsystem = cms.untracked.string("HcalCalib"), + # cuts, cut = cms.untracked.double(20), ped = cms.untracked.int32(4), 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 6a6d9d2a962bc..863cb3a5d712d 100644 --- a/DQM/Integration/python/clients/beam_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/beam_dqm_sourceclient-live_cfg.py @@ -89,7 +89,7 @@ process.load("DQM.BeamMonitor.BeamSpotProblemMonitor_cff") process.load("DQM.BeamMonitor.BeamConditionsMonitor_cff") -if process.dqmRunConfig.type.value() is "production": +if process.dqmRunConfig.type.value() == "production": process.dqmBeamMonitor.BeamFitter.WriteAscii = True process.dqmBeamMonitor.BeamFitter.AsciiFileName = '/nfshome0/yumiceva/BeamMonitorDQM/BeamFitResultsOld.txt' process.dqmBeamMonitor.BeamFitter.WriteDIPAscii = True diff --git a/DQM/Integration/python/clients/beamfake_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/beamfake_dqm_sourceclient-live_cfg.py index 44e6495d057ba..04a7e29e5b94f 100644 --- a/DQM/Integration/python/clients/beamfake_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/beamfake_dqm_sourceclient-live_cfg.py @@ -198,6 +198,11 @@ #--------- # Final path +print("Final Source settings:", process.source) + process.p = cms.Path(process.dqmcommon * process.monitor ) + + + diff --git a/DQM/Integration/python/clients/beamhlt_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/beamhlt_dqm_sourceclient-live_cfg.py index 956cf77f70847..7041223f56cc3 100644 --- a/DQM/Integration/python/clients/beamhlt_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/beamhlt_dqm_sourceclient-live_cfg.py @@ -99,7 +99,7 @@ # Change Beam Monitor variables process.dqmBeamMonitor.useLockRecords = cms.untracked.bool(useLockRecords) -if process.dqmRunConfig.type.value() is "production": +if process.dqmRunConfig.type.value() == "production": process.dqmBeamMonitor.BeamFitter.WriteAscii = True process.dqmBeamMonitor.BeamFitter.AsciiFileName = '/nfshome0/yumiceva/BeamMonitorDQM/BeamFitResults.txt' process.dqmBeamMonitor.BeamFitter.WriteDIPAscii = True diff --git a/DQM/Integration/python/clients/beamhltfake_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/beamhltfake_dqm_sourceclient-live_cfg.py index 4edc1310160c1..c93032d5031ce 100644 --- a/DQM/Integration/python/clients/beamhltfake_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/beamhltfake_dqm_sourceclient-live_cfg.py @@ -167,5 +167,10 @@ ) print("Configured frontierKey", options.runUniqueKey) +#--------- +# Final path +print("Final Source settings:", process.source) + process.p = cms.Path(process.dqmcommon * process.monitor ) + 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 58a62ae56de98..e5dab578f1b0e 100644 --- a/DQM/Integration/python/clients/beampixel_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/beampixel_dqm_sourceclient-live_cfg.py @@ -213,7 +213,7 @@ #---------------------------- # File to save beamspot info #---------------------------- -if process.dqmRunConfig.type.value() is "production": +if process.dqmRunConfig.type.value() == "production": process.pixelVertexDQM.fileName = "/nfshome0/dqmpro/BeamMonitorDQM/BeamPixelResults.txt" else: process.pixelVertexDQM.fileName = "/nfshome0/dqmdev/BeamMonitorDQM/BeamPixelResults.txt" diff --git a/DQM/Integration/python/clients/beamspotdip_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/beamspotdip_dqm_sourceclient-live_cfg.py new file mode 100644 index 0000000000000..0b5b1c4988e63 --- /dev/null +++ b/DQM/Integration/python/clients/beamspotdip_dqm_sourceclient-live_cfg.py @@ -0,0 +1,34 @@ +from __future__ import print_function +import FWCore.ParameterSet.Config as cms + +# +process = cms.Process("BeamSpotDipServer") +process.load("DQMServices.Core.DQM_cfg") + +# input +# for live online DQM in P5 +process.load("DQM.Integration.config.inputsource_cfi") +# for testing in lxplus +# process.load("DQM.Integration.config.fileinputsource_cfi") + +# beamspot from database +process.load("CondCore.CondDB.CondDB_cfi") + +process.load("DQM.Integration.config.FrontierCondition_GT_cfi") + +process.GlobalTag.toGet = cms.VPSet( + cms.PSet( + record = cms.string("BeamSpotOnlineLegacyObjectsRcd"), + refreshTime = cms.uint64(1) + ), +) + +# module +process.load("DQM.BeamMonitor.BeamSpotDipServer_cff") + +# process customizations included here +from DQM.Integration.config.online_customizations_cfi import * +process = customise(process) + +# path +process.p = cms.Path( process.beamSpotDipServer ) diff --git a/DQM/Integration/python/clients/castor_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/castor_dqm_sourceclient-live_cfg.py index 21c7ba5d03802..3c9ba334c2c96 100644 --- a/DQM/Integration/python/clients/castor_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/castor_dqm_sourceclient-live_cfg.py @@ -143,4 +143,7 @@ ### process customizations included here from DQM.Integration.config.online_customizations_cfi import * +print("Final Source settings:", process.source) process = customise(process) + + diff --git a/DQM/Integration/python/clients/csc_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/csc_dqm_sourceclient-live_cfg.py index 03a0947379fcb..0a2915a1be984 100644 --- a/DQM/Integration/python/clients/csc_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/csc_dqm_sourceclient-live_cfg.py @@ -222,4 +222,6 @@ ### process customizations included here from DQM.Integration.config.online_customizations_cfi import * +print("Final Source settings:", process.source) process = customise(process) + diff --git a/DQM/Integration/python/clients/ctpps_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/ctpps_dqm_sourceclient-live_cfg.py index ca590a35ef5ab..c4f29f4a30af9 100644 --- a/DQM/Integration/python/clients/ctpps_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/ctpps_dqm_sourceclient-live_cfg.py @@ -1,8 +1,8 @@ import FWCore.ParameterSet.Config as cms import sys -from Configuration.Eras.Era_Run2_2018_cff import Run2_2018 -process = cms.Process('CTPPSDQM', Run2_2018) +from Configuration.Eras.Era_Run3_cff import Run3 +process = cms.Process('CTPPSDQM', Run3) test = False unitTest = False @@ -104,4 +104,5 @@ # Process customizations included here from DQM.Integration.config.online_customizations_cfi import * +print("Final Source settings:", process.source) process = customise(process) diff --git a/DQM/Integration/python/clients/dt4ml_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/dt4ml_dqm_sourceclient-live_cfg.py index a775a8debe554..f68e01817f44d 100644 --- a/DQM/Integration/python/clients/dt4ml_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/dt4ml_dqm_sourceclient-live_cfg.py @@ -123,4 +123,5 @@ ### process customizations included here from DQM.Integration.config.online_customizations_cfi import * +print("Final Source settings:", process.source) process = customise(process) diff --git a/DQM/Integration/python/clients/dt_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/dt_dqm_sourceclient-live_cfg.py index 33708fd2b40f7..0001acf61064b 100644 --- a/DQM/Integration/python/clients/dt_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/dt_dqm_sourceclient-live_cfg.py @@ -104,4 +104,5 @@ ### process customizations included here from DQM.Integration.config.online_customizations_cfi import * +print("Final Source settings:", process.source) process = customise(process) diff --git a/DQM/Integration/python/clients/ecal_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/ecal_dqm_sourceclient-live_cfg.py index 8409881dd6e62..350732160fbb1 100644 --- a/DQM/Integration/python/clients/ecal_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/ecal_dqm_sourceclient-live_cfg.py @@ -171,4 +171,5 @@ ### process customizations included here from DQM.Integration.config.online_customizations_cfi import * +print("Final Source settings:", process.source) process = customise(process) diff --git a/DQM/Integration/python/clients/ecalcalib_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/ecalcalib_dqm_sourceclient-live_cfg.py index 4b8508fb3023b..27588bd4156f1 100644 --- a/DQM/Integration/python/clients/ecalcalib_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/ecalcalib_dqm_sourceclient-live_cfg.py @@ -213,4 +213,5 @@ ### process customizations included here from DQM.Integration.config.online_customizations_cfi import * +print("Final Source settings:", process.source) process = customise(process) diff --git a/DQM/Integration/python/clients/es_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/es_dqm_sourceclient-live_cfg.py index 50821b2842190..868f9119170f6 100644 --- a/DQM/Integration/python/clients/es_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/es_dqm_sourceclient-live_cfg.py @@ -96,4 +96,5 @@ ### process customizations included here from DQM.Integration.config.online_customizations_cfi import * +print("Final Source settings:", process.source) process = customise(process) diff --git a/DQM/Integration/python/clients/fed_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/fed_dqm_sourceclient-live_cfg.py index 7cb5cb5900b7c..4264ac93ab9d5 100644 --- a/DQM/Integration/python/clients/fed_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/fed_dqm_sourceclient-live_cfg.py @@ -156,4 +156,5 @@ # Finaly: DQM process customizations from DQM.Integration.config.online_customizations_cfi import * +print("Final Source settings:", process.source) process = customise(process) diff --git a/DQM/Integration/python/clients/gem_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/gem_dqm_sourceclient-live_cfg.py index 087c80024c1d7..8729da504bc58 100644 --- a/DQM/Integration/python/clients/gem_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/gem_dqm_sourceclient-live_cfg.py @@ -58,4 +58,5 @@ process.dqmProvInfo.runType = process.runType.getRunTypeName() from DQM.Integration.config.online_customizations_cfi import * +print("Final Source settings:", process.source) process = customise(process) diff --git a/DQM/Integration/python/clients/hcal_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/hcal_dqm_sourceclient-live_cfg.py index 346786f8f9476..95a51c5c2ccf2 100644 --- a/DQM/Integration/python/clients/hcal_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/hcal_dqm_sourceclient-live_cfg.py @@ -59,8 +59,9 @@ process.dqmSaverPB.runNumber = options.runNumber process = customise(process) process.DQMStore.verbose = 0 -if not useFileInput and not unitTest: - process.source.minEventsPerLumi = 100 +if not unitTest and not useFileInput : + if not options.BeamSplashRun : + process.source.minEventsPerLumi = 100 #------------------------------------- # CMSSW/Hcal non-DQM Related Module import @@ -256,4 +257,5 @@ # tracer #process.Tracer = cms.Service("Tracer") +print("Final Source settings:", process.source) process = customise(process) diff --git a/DQM/Integration/python/clients/hcalcalib_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/hcalcalib_dqm_sourceclient-live_cfg.py index 0910e080f8185..11ca9f357b3bf 100644 --- a/DQM/Integration/python/clients/hcalcalib_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/hcalcalib_dqm_sourceclient-live_cfg.py @@ -52,7 +52,8 @@ process.dqmSaverPB.runNumber = options.runNumber process = customise(process) if not useFileInput: - process.source.minEventsPerLumi=100 + if not options.BeamSplashRun : + process.source.minEventsPerLumi=100 #------------------------------------- @@ -236,6 +237,7 @@ #------------------------------------- # Scheduling #------------------------------------- +print("Final Source settings:", process.source) process.options = cms.untracked.PSet( Rethrow = cms.untracked.vstring( # "ProductNotFound", diff --git a/DQM/Integration/python/clients/hcalreco_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/hcalreco_dqm_sourceclient-live_cfg.py index 8e37ecc6756b4..a0367c856fc72 100644 --- a/DQM/Integration/python/clients/hcalreco_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/hcalreco_dqm_sourceclient-live_cfg.py @@ -68,8 +68,9 @@ process.dqmSaverPB.runNumber = options.runNumber process = customise(process) process.DQMStore.verbose = 0 -if not useFileInput and not unitTest: - process.source.minEventsPerLumi = 5 +if not unitTest and not useFileInput: + if not options.BeamSplashRun : + process.source.minEventsPerLumi = 5 # Note, runType is obtained after importing DQM-related modules # => DQM-dependent @@ -196,4 +197,7 @@ "TooFewProducts" ) ) + process.options.wantSummary = True +print("Final Source settings:", process.source) + diff --git a/DQM/Integration/python/clients/hlt_dqm_clientPB-live_cfg.py b/DQM/Integration/python/clients/hlt_dqm_clientPB-live_cfg.py index 047c9b1924722..200f38f849d69 100644 --- a/DQM/Integration/python/clients/hlt_dqm_clientPB-live_cfg.py +++ b/DQM/Integration/python/clients/hlt_dqm_clientPB-live_cfg.py @@ -33,7 +33,7 @@ #----------------------------- # customise for playback -if process.dqmRunConfig.type.value() is "playback": +if process.dqmRunConfig.type.value() == "playback": process.dqmEnv.eventInfoFolder = 'EventInfo/Random' # DQM Modules @@ -85,5 +85,5 @@ process.load('DQM.HLTEvF.psMonitorClient_cfi') process.psChecker = process.psMonitorClient.clone() - +print("Final Source settings:", process.source) process.p = cms.EndPath( process.fastTimerServiceClient + process.throughputServiceClient + process.psColumnVsLumi + process.psChecker + process.dqmEnv + process.dqmSaver + process.dqmSaverPB ) diff --git a/DQM/Integration/python/clients/hlt_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/hlt_dqm_sourceclient-live_cfg.py index c2203f1eeb50b..19d4a18a757bb 100644 --- a/DQM/Integration/python/clients/hlt_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/hlt_dqm_sourceclient-live_cfg.py @@ -136,3 +136,4 @@ ### process customizations included here from DQM.Integration.config.online_customizations_cfi import * process = customise(process) +print("Final Source settings:", process.source) diff --git a/DQM/Integration/python/clients/info_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/info_dqm_sourceclient-live_cfg.py index 6f1666f2313cd..bab64c29a006e 100644 --- a/DQM/Integration/python/clients/info_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/info_dqm_sourceclient-live_cfg.py @@ -79,3 +79,4 @@ # Process customizations included here from DQM.Integration.config.online_customizations_cfi import * process = customise(process) +print("Final Source settings:", process.source) diff --git a/DQM/Integration/python/clients/l1tstage2_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/l1tstage2_dqm_sourceclient-live_cfg.py index 8f95e2b1b8fa4..cc0aae145ff1e 100644 --- a/DQM/Integration/python/clients/l1tstage2_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/l1tstage2_dqm_sourceclient-live_cfg.py @@ -184,4 +184,4 @@ from DQM.Integration.config.online_customizations_cfi import * process = customise(process) - +print("Final Source settings:", process.source) diff --git a/DQM/Integration/python/clients/l1tstage2emulator_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/l1tstage2emulator_dqm_sourceclient-live_cfg.py index 6c660e08e7249..f1b7a69c79d23 100644 --- a/DQM/Integration/python/clients/l1tstage2emulator_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/l1tstage2emulator_dqm_sourceclient-live_cfg.py @@ -180,3 +180,4 @@ from DQM.Integration.config.online_customizations_cfi import * process = customise(process) +print("Final Source settings:", process.source) diff --git a/DQM/Integration/python/clients/mutracking_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/mutracking_dqm_sourceclient-live_cfg.py index fc7262569776e..def262433037a 100644 --- a/DQM/Integration/python/clients/mutracking_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/mutracking_dqm_sourceclient-live_cfg.py @@ -188,5 +188,6 @@ from DQM.Integration.config.online_customizations_cfi import * process = customise(process) - +process.options.wantSummary = cms.untracked.bool(True) +print("Final Source settings:", process.source) diff --git a/DQM/Integration/python/clients/onlinebeammonitor_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/onlinebeammonitor_dqm_sourceclient-live_cfg.py index c2082f42ccfaf..46e579f65fd74 100644 --- a/DQM/Integration/python/clients/onlinebeammonitor_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/onlinebeammonitor_dqm_sourceclient-live_cfg.py @@ -171,4 +171,4 @@ process.p = cms.Path( process.dqmcommon * process.monitor ) - +print("Final Source settings:", process.source) diff --git a/DQM/Integration/python/clients/pixel_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/pixel_dqm_sourceclient-live_cfg.py index ed4e66d3a889e..3831cd32a456c 100644 --- a/DQM/Integration/python/clients/pixel_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/pixel_dqm_sourceclient-live_cfg.py @@ -128,6 +128,9 @@ else: process.load("Configuration.StandardSequences.Reconstruction_cff") +import RecoVertex.BeamSpotProducer.onlineBeamSpotESProducer_cfi as _mod +process.BeamSpotESProducer = _mod.onlineBeamSpotESProducer.clone() + import RecoVertex.BeamSpotProducer.BeamSpotOnline_cfi process.offlineBeamSpot = RecoVertex.BeamSpotProducer.BeamSpotOnline_cfi.onlineBeamSpotProducer.clone() @@ -252,3 +255,4 @@ #-------------------------------------------------- print("Running with run type = ", process.runType.getRunType()) +print("Final Source settings:", process.source) diff --git a/DQM/Integration/python/clients/pixellumi_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/pixellumi_dqm_sourceclient-live_cfg.py index f7e4ee9fdf91e..619a9f77ec155 100644 --- a/DQM/Integration/python/clients/pixellumi_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/pixellumi_dqm_sourceclient-live_cfg.py @@ -112,7 +112,7 @@ #---------------------- process.load("DQM.PixelLumi.PixelLumiDQM_cfi") -if process.dqmRunConfig.type.value() is "playback": +if process.dqmRunConfig.type.value() == "playback": process.pixel_lumi_dqm.logFileName = "pixel_lumi.txt" else: process.pixel_lumi_dqm.logFileName = "/nfshome0/dqmpro/pixel_lumi.txt" @@ -142,3 +142,4 @@ ### process customizations included here from DQM.Integration.config.online_customizations_cfi import * process = customise(process) +print("Final Source settings:", process.source) diff --git a/DQM/Integration/python/clients/rpc_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/rpc_dqm_sourceclient-live_cfg.py index b0c99a3130971..0c84f0ca17f36 100644 --- a/DQM/Integration/python/clients/rpc_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/rpc_dqm_sourceclient-live_cfg.py @@ -190,3 +190,6 @@ ### process customizations included here from DQM.Integration.config.online_customizations_cfi import * process = customise(process) +print("Final Source settings:", process.source) + + diff --git a/DQM/Integration/python/clients/scal_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/scal_dqm_sourceclient-live_cfg.py index 96d0368af11a4..3aca30e0fa20d 100644 --- a/DQM/Integration/python/clients/scal_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/scal_dqm_sourceclient-live_cfg.py @@ -107,3 +107,4 @@ ### process customizations included here from DQM.Integration.config.online_customizations_cfi import * process = customise(process) +print("Final Source settings:", process.source) diff --git a/DQM/Integration/python/clients/sistrip_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/sistrip_dqm_sourceclient-live_cfg.py index f6c0a82d59682..c3440fd2d3b39 100644 --- a/DQM/Integration/python/clients/sistrip_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/sistrip_dqm_sourceclient-live_cfg.py @@ -116,6 +116,9 @@ else: process.load("Configuration.StandardSequences.Reconstruction_cff") +import RecoVertex.BeamSpotProducer.onlineBeamSpotESProducer_cfi as _mod +process.BeamSpotESProducer = _mod.onlineBeamSpotESProducer.clone() + import RecoVertex.BeamSpotProducer.BeamSpotOnline_cfi process.offlineBeamSpot = RecoVertex.BeamSpotProducer.BeamSpotOnline_cfi.onlineBeamSpotProducer.clone() @@ -243,7 +246,7 @@ process.SiStripAnalyserCosmic.TkMapCreationFrequency = -1 process.SiStripAnalyserCosmic.ShiftReportFrequency = -1 process.SiStripAnalyserCosmic.StaticUpdateFrequency = 5 - process.SiStripAnalyserCosmic.MonitorSiStripBackPlaneCorrection = False + process.SiStripAnalyserCosmic.MonitorSiStrip_PSet.MonitorSiStripBackPlaneCorrection = False process.SiStripClients = cms.Sequence(process.SiStripAnalyserCosmic) ### TRACKING process.load("DQM.TrackingMonitorClient.TrackingClientConfigP5_Cosmic_cff") @@ -334,7 +337,7 @@ process.SiStripAnalyser.ShiftReportFrequency = -1 process.SiStripAnalyser.StaticUpdateFrequency = 5 process.SiStripAnalyser.RawDataTag = "rawDataCollector" - process.SiStripAnalyser.MonitorSiStripBackPlaneCorrection = False + process.SiStripAnalyser.MonitorSiStrip_PSet.MonitorSiStripBackPlaneCorrection = False process.SiStripClients = cms.Sequence(process.SiStripAnalyser) process.SiStripMonitorDigi.TotalNumberOfDigisFailure.integrateNLumisections = 25 @@ -439,7 +442,7 @@ process.SiStripAnalyser.ShiftReportFrequency = -1 process.SiStripAnalyser.StaticUpdateFrequency = 5 process.SiStripAnalyser.RawDataTag = "rawDataCollector" - process.SiStripAnalyser.MonitorSiStripBackPlaneCorrection = False + process.SiStripAnalyser.MonitorSiStrip_PSet.MonitorSiStripBackPlaneCorrection = False process.SiStripClients = cms.Sequence(process.SiStripAnalyser) ### TRACKING process.load("DQM.TrackingMonitorClient.TrackingClientConfigP5_cff") @@ -561,7 +564,7 @@ process.SiStripAnalyser.ShiftReportFrequency = -1 process.SiStripAnalyser.StaticUpdateFrequency = 5 process.SiStripAnalyser.RawDataTag = "rawDataRepacker" - process.SiStripAnalyser.MonitorSiStripBackPlaneCorrection = False + process.SiStripAnalyser.MonitorSiStrip_PSet.MonitorSiStripBackPlaneCorrection = False process.SiStripClients = cms.Sequence(process.SiStripAnalyser) process.SiStripMonitorDigi.TotalNumberOfDigisFailure.integrateNLumisections = 25 @@ -659,3 +662,4 @@ ### process customizations included here from DQM.Integration.config.online_customizations_cfi import * process = customise(process) +print("Final Source settings:", process.source) diff --git a/DQM/Integration/python/clients/visualization-live-secondInstance_cfg.py b/DQM/Integration/python/clients/visualization-live-secondInstance_cfg.py index 38273da9aaf35..79c654ba917f3 100644 --- a/DQM/Integration/python/clients/visualization-live-secondInstance_cfg.py +++ b/DQM/Integration/python/clients/visualization-live-secondInstance_cfg.py @@ -14,12 +14,12 @@ if unitTest: from DQM.Integration.config.unittestinputsource_cfi import options, runType, source else: - from DQM.Integration.config.inputsource_cfi import options, runType, source + from DQM.Integration.config.inputsource_cfi import options, runType, source, set_BeamSplashRun_settings # this is needed to map the names of the run-types chosen by DQM to the scenarios, ideally we could converge to the same names #scenarios = {'pp_run': 'ppEra_Run2_2016','cosmic_run':'cosmicsEra_Run2_2016','hi_run':'HeavyIons'} #scenarios = {'pp_run': 'ppEra_Run2_2016','pp_run_stage1': 'ppEra_Run2_2016','cosmic_run':'cosmicsEra_Run2_2016','cosmic_run_stage1':'cosmicsEra_Run2_2016','hi_run':'HeavyIonsEra_Run2_HI'} -scenarios = {'pp_run': 'ppEra_Run3','cosmic_run':'cosmicsEra_Run3','hi_run':'ppEra_Run2_2016_pA'} +scenarios = {'pp_run': 'ppEra_Run3','cosmic_run':'cosmicsEra_Run3','hi_run':'ppEra_Run2_2016_pA', 'commissioning_run':'cosmicsEra_Run3'} if not runType.getRunTypeName() in scenarios.keys(): msg = "Error getting the scenario out of the 'runkey', no mapping for: %s\n"%runType.getRunTypeName() @@ -27,6 +27,11 @@ scenarioName = scenarios[runType.getRunTypeName()] +if not unitTest : + if options.BeamSplashRun : + # scenarioName = 'ppEra_Run3' FIXME + pass + print("Using scenario:",scenarioName) try: @@ -68,6 +73,8 @@ process.source.minEventsPerLumi = 0 process.source.nextLumiTimeoutMillis = 10000 process.source.streamLabel = 'streamDQMEventDisplay' + if options.BeamSplashRun : + set_BeamSplashRun_settings( process.source ) m = re.search(r"\((\w+)\)", str(source.runNumber)) runno = str(m.group(1)) @@ -118,3 +125,4 @@ psetFile.close() cmsRun = "cmsRun -e RunVisualizationProcessingCfg.py" print("Now do:\n%s" % cmsRun) +print("Final Source settings:", process.source) diff --git a/DQM/Integration/python/clients/visualization-live_cfg.py b/DQM/Integration/python/clients/visualization-live_cfg.py index 621c3b595cf98..80e2e37461310 100644 --- a/DQM/Integration/python/clients/visualization-live_cfg.py +++ b/DQM/Integration/python/clients/visualization-live_cfg.py @@ -14,12 +14,12 @@ if unitTest: from DQM.Integration.config.unittestinputsource_cfi import options, runType, source else: - from DQM.Integration.config.inputsource_cfi import options, runType, source + from DQM.Integration.config.inputsource_cfi import options, runType, source, set_BeamSplashRun_settings # this is needed to map the names of the run-types chosen by DQM to the scenarios, ideally we could converge to the same names #scenarios = {'pp_run': 'ppEra_Run2_2016','cosmic_run':'cosmicsEra_Run2_2016','hi_run':'HeavyIons'} #scenarios = {'pp_run': 'ppEra_Run2_2016','pp_run_stage1': 'ppEra_Run2_2016','cosmic_run':'cosmicsEra_Run2_2016','cosmic_run_stage1':'cosmicsEra_Run2_2016','hi_run':'HeavyIonsEra_Run2_HI'} -scenarios = {'pp_run': 'ppEra_Run3','cosmic_run':'cosmicsEra_Run3','hi_run':'ppEra_Run2_2016_pA'} +scenarios = {'pp_run': 'ppEra_Run3','cosmic_run':'cosmicsEra_Run3','hi_run':'ppEra_Run2_2016_pA', 'commissioning_run':'cosmicsEra_Run3'} if not runType.getRunTypeName() in scenarios.keys(): msg = "Error getting the scenario out of the 'runkey', no mapping for: %s\n"%runType.getRunTypeName() @@ -27,6 +27,11 @@ scenarioName = scenarios[runType.getRunTypeName()] +if not unitTest : + if options.BeamSplashRun : + # scenarioName = 'ppEra_Run3' #FIXME + pass + print("Using scenario:",scenarioName) try: @@ -66,6 +71,8 @@ process.source.minEventsPerLumi = 0 process.source.nextLumiTimeoutMillis = 10000 process.source.streamLabel = 'streamDQM' + if options.BeamSplashRun : + set_BeamSplashRun_settings( process.source ) m = re.search(r"\((\w+)\)", str(source.runNumber)) runno = str(m.group(1)) @@ -113,3 +120,4 @@ psetFile.close() cmsRun = "cmsRun -e RunVisualizationProcessingCfg.py" print("Now do:\n%s" % cmsRun) +print("Final Source settings:", process.source) diff --git a/DQM/Integration/python/config/inputsource_cfi.py b/DQM/Integration/python/config/inputsource_cfi.py index ebc4a3036d526..359839d70193a 100644 --- a/DQM/Integration/python/config/inputsource_cfi.py +++ b/DQM/Integration/python/config/inputsource_cfi.py @@ -45,6 +45,12 @@ VarParsing.VarParsing.varType.bool, "Don't upload the BeamSpot conditions to the DB") +options.register('BeamSplashRun', + False, # default value + VarParsing.VarParsing.multiplicity.singleton, + VarParsing.VarParsing.varType.bool, + "Set client source settings for beam SPLASH run") + # Parameters for runType options.register ('runkey', @@ -94,6 +100,7 @@ skipFirstLumis = cms.untracked.bool(options.skipFirstLumis), deleteDatFiles = cms.untracked.bool(False), endOfRunKills = cms.untracked.bool(endOfRunKills), + inputFileTransitionsEachEvent = cms.untracked.bool(False) ) else: print("The list of input files is provided. Disabling discovery and running on everything.") @@ -110,4 +117,17 @@ # secondaryFileNames = cms.untracked.vstring() #) -print("Source:", source) +# https://twiki.cern.ch/twiki/bin/viewauth/CMS/CMSBeamSplash2017 +def set_BeamSplashRun_settings( source ): + source.minEventsPerLumi = 1000000 + source.nextLumiTimeoutMillis = 15000 + +if options.BeamSplashRun : set_BeamSplashRun_settings( source ) + +print("Initial Source settings:", source) + + + + + + diff --git a/DQM/Integration/python/config/pbsource_cfi.py b/DQM/Integration/python/config/pbsource_cfi.py index b3ba96c4aafa4..127df864e5ed8 100644 --- a/DQM/Integration/python/config/pbsource_cfi.py +++ b/DQM/Integration/python/config/pbsource_cfi.py @@ -32,6 +32,12 @@ VarParsing.VarParsing.varType.bool, "Skip (and ignore the minEventsPerLumi parameter) for the files which have been available at the begining of the processing. ") +options.register('BeamSplashRun', + False, # default value + VarParsing.VarParsing.multiplicity.singleton, + VarParsing.VarParsing.varType.bool, + "Set client source settings for beam SPLASH run") + # Parameters for runType options.register ('runkey', @@ -83,4 +89,13 @@ endOfRunKills = cms.untracked.bool(endOfRunKills), ) -print("Source:", source) +# https://twiki.cern.ch/twiki/bin/viewauth/CMS/CMSBeamSplash2017 +def set_BeamSplashRun_settings( source ): + # source.minEventsPerLumi = 1000000 + source.nextLumiTimeoutMillis = 15000 + +if options.BeamSplashRun : set_BeamSplashRun_settings( source ) + +print("Initial Source settings:", source) + + diff --git a/DQM/Integration/python/config/unittestinputsource_cfi.py b/DQM/Integration/python/config/unittestinputsource_cfi.py index c6356200fe0c2..bfa2bb6596c9b 100644 --- a/DQM/Integration/python/config/unittestinputsource_cfi.py +++ b/DQM/Integration/python/config/unittestinputsource_cfi.py @@ -32,16 +32,16 @@ "Unique run key from RCMS for Frontier") options.register('runNumber', - 334393, + 344518, VarParsing.VarParsing.multiplicity.singleton, VarParsing.VarParsing.varType.int, "Run number. This run number has to be present in the dataset configured with the dataset option.") options.register('dataset', - '/ExpressCosmics/Commissioning2019-Express-v1/FEVT', + '/ExpressCosmics/Commissioning2021-Express-v1/FEVT', VarParsing.VarParsing.multiplicity.singleton, VarParsing.VarParsing.varType.string, - "Dataset name like '/ExpressCosmics/Commissioning2019-Express-v1/FEVT'") + "Dataset name like '/ExpressCosmics/Commissioning2021-Express-v1/FEVT'") options.register('maxLumi', 2, diff --git a/DQM/Integration/scripts/filecollector/commonAnTS.py b/DQM/Integration/scripts/filecollector/commonAnTS.py index 809a362319f1b..9b2629de6a8af 100644 --- a/DQM/Integration/scripts/filecollector/commonAnTS.py +++ b/DQM/Integration/scripts/filecollector/commonAnTS.py @@ -55,11 +55,11 @@ def prettyPrintUnits(value,unit,decimals=0): if unit is "b": units=["B","KB","MB","GB","TB"] it=iter(units) - v=long(value/1024) + v=int(value/1024) p=0 runit=next(it) while v > 0: - v=long(v/1024) + v=int(v/1024) try: runit=next(it) p+=1 diff --git a/DQM/Integration/scripts/filecollector/fileCollector.py b/DQM/Integration/scripts/filecollector/fileCollector.py index a1af438eef9e5..d2b67125be418 100755 --- a/DQM/Integration/scripts/filecollector/fileCollector.py +++ b/DQM/Integration/scripts/filecollector/fileCollector.py @@ -107,10 +107,10 @@ def sendmail(body="Hello from visDQMZipCastorVerifier"): time.sleep(WAITTIME) continue - TAGRUNEND=long(sorted(NEW.keys(),reverse=True)[1]) + TAGRUNEND=int(sorted(NEW.keys(),reverse=True)[1]) else: - TAGRUNEND=long(TAGS[0].split("_")[2]) + TAGRUNEND=int(TAGS[0].split("_")[2]) for tag in TAGS: os.remove(tag) diff --git a/DQM/Integration/scripts/filecollector/producerFileCleanner.py b/DQM/Integration/scripts/filecollector/producerFileCleanner.py index 61ac98d5d2c98..b03764a82260c 100755 --- a/DQM/Integration/scripts/filecollector/producerFileCleanner.py +++ b/DQM/Integration/scripts/filecollector/producerFileCleanner.py @@ -84,7 +84,7 @@ def sendmail(body="Hello from producerFileCleanner",subject= "Hello!"): time.sleep(WAITTIME) continue - quota=long(diskSize*PRODUCER_DU_BOT/100) + quota=int(diskSize*PRODUCER_DU_BOT/100) delQuota=diskUsed-quota if delQuota > doneSize: now = time.time() diff --git a/DQM/Integration/scripts/filecollector/visDQMSyncDaemon b/DQM/Integration/scripts/filecollector/visDQMSyncDaemon index 632238c799d29..df1c75aefa44a 100755 --- a/DQM/Integration/scripts/filecollector/visDQMSyncDaemon +++ b/DQM/Integration/scripts/filecollector/visDQMSyncDaemon @@ -52,7 +52,7 @@ INDEPQUEUES = [] REPODIR = "" DESTDIR = "" -MAXQUOTA = long(0) +MAXQUOTA = int(0) SAFEFACTOR = 0.01 currTime = time.time() unitsDic = {"B":0,"K":1,"M":2,"G":3,"T":4} @@ -111,9 +111,9 @@ def getFileList(path, quota = -1,all = True): if quota > -1: for f in sorted(finalFileDict.keys(),key=lambda x:finalFileDict[x][0], reverse=True): - if aQuota+long(finalFileDict[f][1]) <= quota: + if aQuota+int(finalFileDict[f][1]) <= quota: fileList.append(f) - aQuota=aQuota+long(finalFileDict[f][1]) + aQuota=aQuota+int(finalFileDict[f][1]) continue break else: @@ -148,12 +148,12 @@ try: elif opt == "--dirs": WATCHDIRS=val.split(",") elif "--dirs_quotas" == opt: - INDEPQUEUES=[ long(i[:-1])*pow(1024,unitsDic[i[-1]]) for i in val.split(",") if i!='' and len(i)>1] + INDEPQUEUES=[ int(i[:-1])*pow(1024,unitsDic[i[-1]]) for i in val.split(",") if i!='' and len(i)>1] if len(args) != 3: print __doc__ logme('ERROR: Argument ') sys.exit(0) - MAXQUOTA= long(args[0][:-1])*pow(1024,unitsDic[args[0][-1]]) + MAXQUOTA= int(args[0][:-1])*pow(1024,unitsDic[args[0][-1]]) REPODIR = args[1] DESTDIR = args[2] if WATCHDIRS: @@ -168,7 +168,7 @@ try: totalQuotaAlloc=sum(dirsQuotaDic.values()) totalDirs4Alloc=sum([1 for q in dirsQuotaDic.values() if q ==0]) quota = 0 - if totalDirs4Alloc > 0: quota=long((MAXQUOTA-totalQuotaAlloc)/totalDirs4Alloc*(1-SAFEFACTOR)) + if totalDirs4Alloc > 0: quota=int((MAXQUOTA-totalQuotaAlloc)/totalDirs4Alloc*(1-SAFEFACTOR)) if quota < 0 or totalQuotaAlloc+quota*totalDirs4Alloc > MAXQUOTA: logme('ERROR: Auto quota set up error, quota for unallocated directories %d ,Total Individual Quotas Allocation %d - MAX_QUOTA %d. please revise ',quota,totalQuotaAlloc+quota*totalDirs4Alloc, MAXQUOTA ) sys.exit(0) diff --git a/DQM/Integration/scripts/harvesting_tools/cmsHarvester.py b/DQM/Integration/scripts/harvesting_tools/cmsHarvester.py index afb6e2d723944..0b8417747ed5c 100755 --- a/DQM/Integration/scripts/harvesting_tools/cmsHarvester.py +++ b/DQM/Integration/scripts/harvesting_tools/cmsHarvester.py @@ -4685,41 +4685,6 @@ def check_ref_hist_tag(self, tag_name): ########## - def create_es_prefer_snippet(self, dataset_name): - """Build the es_prefer snippet for the reference histograms. - - The building of the snippet is wrapped in some care-taking - code that figures out the name of the reference histogram set - and makes sure the corresponding tag exists. - - """ - - # Figure out the name of the reference histograms tag. - # NOTE: The existence of these tags has already been checked. - ref_hist_tag_name = self.ref_hist_mappings[dataset_name] - - connect_name = self.frontier_connection_name["refhists"] - connect_name += self.db_account_name_cms_cond_dqm_summary() - record_name = "DQMReferenceHistogramRootFileRcd" - - # Build up the code snippet. - code_lines = [] - code_lines.append("from CondCore.DBCommon.CondDBSetup_cfi import *") - code_lines.append("process.ref_hist_source = cms.ESSource(\"PoolDBESSource\", CondDBSetup,") - code_lines.append(" connect = cms.string(\"%s\")," % connect_name) - code_lines.append(" toGet = cms.VPSet(cms.PSet(record = cms.string(\"%s\")," % record_name) - code_lines.append(" tag = cms.string(\"%s\"))," % ref_hist_tag_name) - code_lines.append(" )") - code_lines.append(" )") - code_lines.append("process.es_prefer_ref_hist_source = cms.ESPrefer(\"PoolDBESSource\", \"ref_hist_source\")") - - snippet = "\n".join(code_lines) - - # End of create_es_prefer_snippet. - return snippet - - ########## - def create_harvesting_config(self, dataset_name): """Create the Python harvesting configuration for harvesting. diff --git a/DQM/Integration/scripts/igfilemgr/igmerge b/DQM/Integration/scripts/igfilemgr/igmerge index 8e371db0422ba..75e5d6e2704df 100755 --- a/DQM/Integration/scripts/igfilemgr/igmerge +++ b/DQM/Integration/scripts/igfilemgr/igmerge @@ -45,10 +45,10 @@ def numericalSort(x,y): if len(yvec) < 3 or len(xvec) < 3: return cmp(x,y) - xrun=long(xvec[1].split("_")[1]) - xevent=long(xvec[2].split("_")[1]) - yrun=long(yvec[1].split("_")[1]) - yevent=long(yvec[2].split("_")[1]) + xrun=int(xvec[1].split("_")[1]) + xevent=int(xvec[2].split("_")[1]) + yrun=int(yvec[1].split("_")[1]) + yevent=int(yvec[2].split("_")[1]) if xrun < yrun: return -1 elif xrun > yrun: @@ -115,7 +115,7 @@ if __name__ == "__main__": elif item[0]=="-e": KEEP=False elif item[0]=="-n": - CHUNKSIZE=long(item[1]) + CHUNKSIZE=int(item[1]) elif item[0]=="-o": MFILENAME=item[1] elif item[0]=="--help": @@ -139,7 +139,7 @@ if __name__ == "__main__": TOTALSIZE+=info.compress_size/1024 print "found %d archived files in %d archives" % (len(MEMBERS),len(ZFHANDLES)) numfiles=TOTALSIZE/CHUNKSIZE - numfiles=long(round(numfiles) + (numfiles-round(numfiles)>0 and 1 or 0 )) + numfiles=int(round(numfiles) + (numfiles-round(numfiles)>0 and 1 or 0 )) print "The Number of expected requiered files is: %d (could be more)" % numfiles print "Starting Merging process..." diff --git a/DQM/Integration/scripts/igfilemgr/zipmerge b/DQM/Integration/scripts/igfilemgr/zipmerge index 4ab597de8feef..e094ac87d1d59 100755 --- a/DQM/Integration/scripts/igfilemgr/zipmerge +++ b/DQM/Integration/scripts/igfilemgr/zipmerge @@ -91,7 +91,7 @@ if __name__ == "__main__": elif item[0]=="-e": KEEP=False elif item[0]=="-n": - CHUNKSIZE=long(item[1]) + CHUNKSIZE=int(item[1]) elif item[0]=="-o": MFILENAME=item[1] elif item[0]=="--help": @@ -115,7 +115,7 @@ if __name__ == "__main__": TOTALSIZE+=info.compress_size/1024 print "found %d archived files in %d archives" % (len(MEMBERS),len(ZFHANDLES)) numfiles=TOTALSIZE/CHUNKSIZE - numfiles=long(round(numfiles) + (numfiles-round(numfiles)>0 and 1 or 0 )) + numfiles=int(round(numfiles) + (numfiles-round(numfiles)>0 and 1 or 0 )) print "The Number of expected requiered files is: %d (could be more)" % numfiles print "Starting Merging process..." diff --git a/DQM/Integration/test/BuildFile.xml b/DQM/Integration/test/BuildFile.xml index 890e4833e4ab5..157ab636e88b7 100644 --- a/DQM/Integration/test/BuildFile.xml +++ b/DQM/Integration/test/BuildFile.xml @@ -29,6 +29,5 @@ - - - + + diff --git a/DQM/L1TMonitor/interface/L1ExtraDQM.h b/DQM/L1TMonitor/interface/L1ExtraDQM.h index 69311a3f12f00..ca298444d70fd 100644 --- a/DQM/L1TMonitor/interface/L1ExtraDQM.h +++ b/DQM/L1TMonitor/interface/L1ExtraDQM.h @@ -65,7 +65,6 @@ #include "DQMServices/Core/interface/DQMStore.h" -#include "boost/lexical_cast.hpp" #include "DQMServices/Core/interface/DQMOneEDAnalyzer.h" // forward declarations diff --git a/DQM/L1TMonitor/interface/L1TdeCSCTPG.h b/DQM/L1TMonitor/interface/L1TdeCSCTPG.h index 9d45e16b63b23..2f1e0bc0918e5 100644 --- a/DQM/L1TMonitor/interface/L1TdeCSCTPG.h +++ b/DQM/L1TMonitor/interface/L1TdeCSCTPG.h @@ -61,9 +61,12 @@ class L1TdeCSCTPG : public DQMEDAnalyzer { /* When set to True, we assume that the data comes from the Building 904 CSC test-stand. This test-stand is a single - ME1/1 chamber. + ME1/1 chamber or ME4/2 chamber. */ - bool B904Setup_; + bool useB904_; + bool useB904ME11_; + bool useB904ME21_; + bool useB904ME234s2_; bool isRun3_; diff --git a/DQM/L1TMonitor/python/L1TStage2Emulator_cff.py b/DQM/L1TMonitor/python/L1TStage2Emulator_cff.py index f22f2b69497c3..da68863ec1fa1 100644 --- a/DQM/L1TMonitor/python/L1TStage2Emulator_cff.py +++ b/DQM/L1TMonitor/python/L1TStage2Emulator_cff.py @@ -42,12 +42,14 @@ ) # OMTF -from L1Trigger.L1TMuonOverlap.simOmtfDigis_cfi import * +from L1Trigger.L1TMuonOverlapPhase1.simOmtfDigis_cfi import * valOmtfDigis = simOmtfDigis.clone( srcDTPh = "omtfStage2Digis", srcDTTh = "omtfStage2Digis", srcCSC = "omtfStage2Digis", - srcRPC = "omtfStage2Digis" + srcRPC = "omtfStage2Digis", + bxMin = -3, + bxMax = 4 ) # GEM TPG @@ -55,6 +57,8 @@ valMuonGEMPadDigis = simMuonGEMPadDigis.clone(InputCollection = "muonGEMDigis") valMuonGEMPadDigiClusters = simMuonGEMPadDigiClusters.clone(InputCollection = "valMuonGEMPadDigis") +# Lookup tables for the CSC TP emulator +from CalibMuon.CSCCalibration.CSCL1TPLookupTableEP_cff import * # CSC TPG from L1Trigger.CSCTriggerPrimitives.cscTriggerPrimitiveDigis_cfi import * valCscStage2Digis = cscTriggerPrimitiveDigis.clone( diff --git a/DQM/L1TMonitor/python/L1TdeCSCTPG_cfi.py b/DQM/L1TMonitor/python/L1TdeCSCTPG_cfi.py index 0e5980f5513ac..c7c91ecc0f514 100644 --- a/DQM/L1TMonitor/python/L1TdeCSCTPG_cfi.py +++ b/DQM/L1TMonitor/python/L1TdeCSCTPG_cfi.py @@ -28,7 +28,9 @@ lctNBin = cms.vuint32(16, 116, 224, 16, 2, 448, 896, 5, 16, 2, 2), lctMinBin = cms.vdouble(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), lctMaxBin = cms.vdouble(16, 116, 224, 16, 2, 448, 896, 5, 16, 2, 2), - B904Setup = cms.bool(False), + useB904ME11 = cms.bool(False), + useB904ME21 = cms.bool(False), + useB904ME234s2 = cms.bool(False), isRun3 = cms.bool(False), preTriggerAnalysis = cms.bool(False) ) diff --git a/DQM/L1TMonitor/src/L1TdeCSCTPG.cc b/DQM/L1TMonitor/src/L1TdeCSCTPG.cc index 0fce802af66b2..3a700af9ff560 100644 --- a/DQM/L1TMonitor/src/L1TdeCSCTPG.cc +++ b/DQM/L1TMonitor/src/L1TdeCSCTPG.cc @@ -30,30 +30,45 @@ L1TdeCSCTPG::L1TdeCSCTPG(const edm::ParameterSet& ps) alctMaxBin_(ps.getParameter>("alctMaxBin")), clctMaxBin_(ps.getParameter>("clctMaxBin")), lctMaxBin_(ps.getParameter>("lctMaxBin")), - B904Setup_(ps.getParameter("B904Setup")), + useB904ME11_(ps.getParameter("useB904ME11")), + useB904ME21_(ps.getParameter("useB904ME21")), + useB904ME234s2_(ps.getParameter("useB904ME234s2")), isRun3_(ps.getParameter("isRun3")), - preTriggerAnalysis_(ps.getParameter("preTriggerAnalysis")) {} + preTriggerAnalysis_(ps.getParameter("preTriggerAnalysis")) { + useB904_ = useB904ME11_ or useB904ME21_ or useB904ME234s2_; +} L1TdeCSCTPG::~L1TdeCSCTPG() {} void L1TdeCSCTPG::bookHistograms(DQMStore::IBooker& iBooker, const edm::Run&, const edm::EventSetup&) { iBooker.setCurrentFolder(monitorDir_); - // do not analyze Run-3 properties in Run-1 and Run-2 eras - if (!isRun3_) { - clctVars_.resize(4); - lctVars_.resize(5); + // remove the non-ME1/1 chambers from the list when useB904ME11 is set to true + if (useB904ME11_) { + chambers_.resize(1); } - - // remove the non-ME1/1 chambers from the list when B904Setup is set to true - if (B904Setup_) { + // similar for ME2/1 + else if (useB904ME21_) { + auto temp = chambers_[3]; chambers_.resize(1); + chambers_[0] = temp; } - // do not analyze the 1/4-strip bit, 1/8-strip bit - else { + // similar for ME4/2 + else if (useB904ME234s2_) { + auto temp = chambers_.back(); + chambers_.resize(1); + chambers_[0] = temp; + } + // collision data in Run-3 + else if (isRun3_) { clctVars_.resize(9); lctVars_.resize(9); } + // do not analyze Run-3 properties in Run-1 and Run-2 eras + else { + clctVars_.resize(4); + lctVars_.resize(5); + } // chamber type for (unsigned iType = 0; iType < chambers_.size(); iType++) { @@ -109,15 +124,23 @@ void L1TdeCSCTPG::analyze(const edm::Event& e, const edm::EventSetup& c) { e.getByToken(dataLCT_token_, dataLCTs); e.getByToken(emulLCT_token_, emulLCTs); // only do pre-trigger analysis when B904 setup is used - if (B904Setup_) + if (useB904_) e.getByToken(emulpreCLCT_token_, emulpreCLCTs); for (auto it = dataALCTs->begin(); it != dataALCTs->end(); it++) { auto range = dataALCTs->get((*it).first); - const int type = ((*it).first).iChamberType() - 2; + const CSCDetId& detid((*it).first); + int type = ((*it).first).iChamberType() - 2; // ignore non-ME1/1 chambers when using B904 test-stand data - if (B904Setup_ and !((*it).first).isME11()) + if (useB904ME11_ and !(detid.isME11())) continue; + if (useB904ME21_ and !(detid.isME21())) + continue; + if (useB904ME234s2_ and !(detid.isME22() or detid.isME32() or detid.isME42())) + continue; + // to prevent crashes because you are booking histos for single b904 chamber + if (useB904ME234s2_ or useB904ME21_) + type = 0; for (auto alct = range.first; alct != range.second; alct++) { if (alct->isValid()) { chamberHistos[type]["alct_quality_data"]->Fill(alct->getQuality()); @@ -129,10 +152,18 @@ void L1TdeCSCTPG::analyze(const edm::Event& e, const edm::EventSetup& c) { for (auto it = emulALCTs->begin(); it != emulALCTs->end(); it++) { auto range = emulALCTs->get((*it).first); - const int type = ((*it).first).iChamberType() - 2; + const CSCDetId& detid((*it).first); + int type = ((*it).first).iChamberType() - 2; // ignore non-ME1/1 chambers when using B904 test-stand data - if (B904Setup_ and !((*it).first).isME11()) + if (useB904ME11_ and !(detid.isME11())) + continue; + if (useB904ME21_ and !(detid.isME21())) + continue; + if (useB904ME234s2_ and !(detid.isME22() or detid.isME32() or detid.isME42())) continue; + // to prevent crashes because you are booking histos for single b904 chamber + if (useB904ME234s2_ or useB904ME21_) + type = 0; for (auto alct = range.first; alct != range.second; alct++) { if (alct->isValid()) { chamberHistos[type]["alct_quality_emul"]->Fill(alct->getQuality()); @@ -148,10 +179,18 @@ void L1TdeCSCTPG::analyze(const edm::Event& e, const edm::EventSetup& c) { for (auto it = dataCLCTs->begin(); it != dataCLCTs->end(); it++) { auto range = dataCLCTs->get((*it).first); - const int type = ((*it).first).iChamberType() - 2; + const CSCDetId& detid((*it).first); + int type = ((*it).first).iChamberType() - 2; // ignore non-ME1/1 chambers when using B904 test-stand data - if (B904Setup_ and !((*it).first).isME11()) + if (useB904ME11_ and !(detid.isME11())) continue; + if (useB904ME21_ and !(detid.isME21())) + continue; + if (useB904ME234s2_ and !(detid.isME22() or detid.isME32() or detid.isME42())) + continue; + // to prevent crashes because you are booking histos for single b904 chamber + if (useB904ME234s2_ or useB904ME21_) + type = 0; for (auto clct = range.first; clct != range.second; clct++) { if (clct->isValid()) { if (preTriggerAnalysis_) { @@ -167,7 +206,7 @@ void L1TdeCSCTPG::analyze(const edm::Event& e, const edm::EventSetup& c) { chamberHistos[type]["clct_eighthstrip_data"]->Fill(clct->getKeyStrip(8)); chamberHistos[type]["clct_slope_data"]->Fill(clct->getSlope()); chamberHistos[type]["clct_compcode_data"]->Fill(clct->getCompCode()); - if (B904Setup_) { + if (useB904_) { chamberHistos[type]["clct_quartstripbit_data"]->Fill(clct->getQuartStripBit()); chamberHistos[type]["clct_eighthstripbit_data"]->Fill(clct->getEighthStripBit()); } @@ -178,10 +217,18 @@ void L1TdeCSCTPG::analyze(const edm::Event& e, const edm::EventSetup& c) { for (auto it = emulCLCTs->begin(); it != emulCLCTs->end(); it++) { auto range = emulCLCTs->get((*it).first); - const int type = ((*it).first).iChamberType() - 2; + const CSCDetId& detid((*it).first); + int type = ((*it).first).iChamberType() - 2; // ignore non-ME1/1 chambers when using B904 test-stand data - if (B904Setup_ and !((*it).first).isME11()) + if (useB904ME11_ and !(detid.isME11())) + continue; + if (useB904ME21_ and !(detid.isME21())) continue; + if (useB904ME234s2_ and !(detid.isME22() or detid.isME32() or detid.isME42())) + continue; + // to prevent crashes because you are booking histos for single b904 chamber + if (useB904ME234s2_ or useB904ME21_) + type = 0; // remove the duplicate CLCTs // these are CLCTs that have the same properties as CLCTs found // before by the emulator, except for the BX, which is off by +1 @@ -205,7 +252,7 @@ void L1TdeCSCTPG::analyze(const edm::Event& e, const edm::EventSetup& c) { chamberHistos[type]["clct_eighthstrip_emul"]->Fill(clct.getKeyStrip(8)); chamberHistos[type]["clct_slope_emul"]->Fill(clct.getSlope()); chamberHistos[type]["clct_compcode_emul"]->Fill(clct.getCompCode()); - if (B904Setup_) { + if (useB904_) { chamberHistos[type]["clct_quartstripbit_emul"]->Fill(clct.getQuartStripBit()); chamberHistos[type]["clct_eighthstripbit_emul"]->Fill(clct.getEighthStripBit()); } @@ -234,10 +281,18 @@ void L1TdeCSCTPG::analyze(const edm::Event& e, const edm::EventSetup& c) { for (auto it = dataLCTs->begin(); it != dataLCTs->end(); it++) { auto range = dataLCTs->get((*it).first); - const int type = ((*it).first).iChamberType() - 2; + const CSCDetId& detid((*it).first); + int type = ((*it).first).iChamberType() - 2; // ignore non-ME1/1 chambers when using B904 test-stand data - if (B904Setup_ and !((*it).first).isME11()) + if (useB904ME11_ and !(detid.isME11())) + continue; + if (useB904ME21_ and !(detid.isME21())) + continue; + if (useB904ME234s2_ and !(detid.isME22() or detid.isME32() or detid.isME42())) continue; + // to prevent crashes because you are booking histos for single b904 chamber + if (useB904ME234s2_ or useB904ME21_) + type = 0; for (auto lct = range.first; lct != range.second; lct++) { if (lct->isValid()) { chamberHistos[type]["lct_pattern_data"]->Fill(lct->getPattern()); @@ -250,7 +305,7 @@ void L1TdeCSCTPG::analyze(const edm::Event& e, const edm::EventSetup& c) { chamberHistos[type]["lct_slope_data"]->Fill(lct->getSlope()); chamberHistos[type]["lct_quartstrip_data"]->Fill(lct->getStrip(4)); chamberHistos[type]["lct_eighthstrip_data"]->Fill(lct->getStrip(8)); - if (B904Setup_) { + if (useB904_) { chamberHistos[type]["lct_quartstripbit_data"]->Fill(lct->getQuartStripBit()); chamberHistos[type]["lct_eighthstripbit_data"]->Fill(lct->getEighthStripBit()); } @@ -261,11 +316,18 @@ void L1TdeCSCTPG::analyze(const edm::Event& e, const edm::EventSetup& c) { for (auto it = emulLCTs->begin(); it != emulLCTs->end(); it++) { auto range = emulLCTs->get((*it).first); - const int type = ((*it).first).iChamberType() - 2; + const CSCDetId& detid((*it).first); + int type = ((*it).first).iChamberType() - 2; // ignore non-ME1/1 chambers when using B904 test-stand data - if (B904Setup_ and !((*it).first).isME11()) + if (useB904ME11_ and !(detid.isME11())) continue; - + if (useB904ME21_ and !(detid.isME21())) + continue; + if (useB904ME234s2_ and !(detid.isME22() or detid.isME32() or detid.isME42())) + continue; + // to prevent crashes because you are booking histos for single b904 chamber + if (useB904ME234s2_ or useB904ME21_) + type = 0; // remove the duplicate LCTs // these are LCTs that have the same properties as LCTs found // before by the emulator, except for the BX, which is off by +1 @@ -287,7 +349,7 @@ void L1TdeCSCTPG::analyze(const edm::Event& e, const edm::EventSetup& c) { chamberHistos[type]["lct_slope_emul"]->Fill(lct.getSlope()); chamberHistos[type]["lct_quartstrip_emul"]->Fill(lct.getStrip(4)); chamberHistos[type]["lct_eighthstrip_emul"]->Fill(lct.getStrip(8)); - if (B904Setup_) { + if (useB904_) { chamberHistos[type]["lct_quartstripbit_emul"]->Fill(lct.getQuartStripBit()); chamberHistos[type]["lct_eighthstripbit_emul"]->Fill(lct.getEighthStripBit()); } diff --git a/DQM/L1TMonitorClient/interface/L1TdeCSCTPGClient.h b/DQM/L1TMonitorClient/interface/L1TdeCSCTPGClient.h index dad9dced6b1a7..4f5a2cdbc7870 100644 --- a/DQM/L1TMonitorClient/interface/L1TdeCSCTPGClient.h +++ b/DQM/L1TMonitorClient/interface/L1TdeCSCTPGClient.h @@ -53,7 +53,10 @@ class L1TdeCSCTPGClient : public DQMEDHarvester { the Building 904 CSC test-stand. This test-stand is a single ME1/1 chamber. */ - bool B904Setup_; + bool useB904_; + bool useB904ME11_; + bool useB904ME21_; + bool useB904ME234s2_; bool isRun3_; diff --git a/DQM/L1TMonitorClient/src/L1TdeCSCTPGClient.cc b/DQM/L1TMonitorClient/src/L1TdeCSCTPGClient.cc index 9240368f9026c..f3859a33a8f62 100644 --- a/DQM/L1TMonitorClient/src/L1TdeCSCTPGClient.cc +++ b/DQM/L1TMonitorClient/src/L1TdeCSCTPGClient.cc @@ -27,8 +27,12 @@ L1TdeCSCTPGClient::L1TdeCSCTPGClient(const edm::ParameterSet &ps) alctMaxBin_(ps.getParameter>("alctMaxBin")), clctMaxBin_(ps.getParameter>("clctMaxBin")), lctMaxBin_(ps.getParameter>("lctMaxBin")), - B904Setup_(ps.getParameter("B904Setup")), - isRun3_(ps.getParameter("isRun3")) {} + useB904ME11_(ps.getParameter("useB904ME11")), + useB904ME21_(ps.getParameter("useB904ME21")), + useB904ME234s2_(ps.getParameter("useB904ME234s2")), + isRun3_(ps.getParameter("isRun3")) { + useB904_ = useB904ME11_ or useB904ME21_ or useB904ME234s2_; +} L1TdeCSCTPGClient::~L1TdeCSCTPGClient() {} @@ -49,21 +53,32 @@ void L1TdeCSCTPGClient::dqmEndJob(DQMStore::IBooker &ibooker, DQMStore::IGetter void L1TdeCSCTPGClient::book(DQMStore::IBooker &iBooker) { iBooker.setCurrentFolder(monitorDir_); - // do not analyze Run-3 properties in Run-1 and Run-2 eras - if (!isRun3_) { - clctVars_.resize(4); - lctVars_.resize(5); + // remove the non-ME1/1 chambers from the list when useB904ME11 is set to true + if (useB904ME11_) { + chambers_.resize(1); } - - // remove the non-ME1/1 chambers from the list when B904Setup is set to true - if (B904Setup_) { + // similar for ME2/1 + else if (useB904ME21_) { + auto temp = chambers_[3]; chambers_.resize(1); + chambers_[0] = temp; } - // do not analyze the 1/4-strip bit, 1/8-strip bit - else { + // similar for ME4/2 + else if (useB904ME234s2_) { + auto temp = chambers_.back(); + chambers_.resize(1); + chambers_[0] = temp; + } + // collision data in Run-3 + else if (isRun3_) { clctVars_.resize(9); lctVars_.resize(9); } + // do not analyze Run-3 properties in Run-1 and Run-2 eras + else { + clctVars_.resize(4); + lctVars_.resize(5); + } // chamber type for (unsigned iType = 0; iType < chambers_.size(); iType++) { diff --git a/DQM/Physics/BuildFile.xml b/DQM/Physics/BuildFile.xml index 5d68d7f2833d8..5fda1b5441f7b 100644 --- a/DQM/Physics/BuildFile.xml +++ b/DQM/Physics/BuildFile.xml @@ -24,5 +24,4 @@ - diff --git a/DQM/SiPixelCommon/python/SiPixelOfflineDQM_client_cff.py b/DQM/SiPixelCommon/python/SiPixelOfflineDQM_client_cff.py index 27572902ab7f5..25489203d4ece 100644 --- a/DQM/SiPixelCommon/python/SiPixelOfflineDQM_client_cff.py +++ b/DQM/SiPixelCommon/python/SiPixelOfflineDQM_client_cff.py @@ -31,7 +31,7 @@ #Heavy Ion QualityTester sipixelQTesterHI = sipixelQTester.clone( - qtList = cms.untracked.FileInPath('DQM/SiPixelMonitorClient/test/sipixel_tier0_qualitytest_heavyions.xml') + qtList = 'DQM/SiPixelMonitorClient/test/sipixel_tier0_qualitytest_heavyions.xml' ) #DataCertification: diff --git a/DQM/SiPixelCommon/python/SiPixelOfflineDQM_source_cff.py b/DQM/SiPixelCommon/python/SiPixelOfflineDQM_source_cff.py index d1082b864f43b..e20287e4821b0 100644 --- a/DQM/SiPixelCommon/python/SiPixelOfflineDQM_source_cff.py +++ b/DQM/SiPixelCommon/python/SiPixelOfflineDQM_source_cff.py @@ -97,16 +97,17 @@ #HI track modules hiTracks = "hiGeneralTracks" -hiRefittedForPixelDQM= refittedForPixelDQM.clone() -hiRefittedForPixelDQM.src=hiTracks +hiRefittedForPixelDQM= refittedForPixelDQM.clone( + src = hiTracks +) SiPixelTrackResidualSource_HeavyIons = SiPixelTrackResidualSource.clone( - vtxsrc='hiSelectedVertex' - ) + vtxsrc = 'hiSelectedVertex' +) SiPixelHitEfficiencySource_HeavyIons = SiPixelHitEfficiencySource.clone( - vtxsrc='hiSelectedVertex' - ) + vtxsrc = 'hiSelectedVertex' +) #DQM service diff --git a/DQM/SiPixelMonitorTrack/python/RefitterForPixelDQM.py b/DQM/SiPixelMonitorTrack/python/RefitterForPixelDQM.py index ed7b2f1cf64f2..5c324baa1c956 100644 --- a/DQM/SiPixelMonitorTrack/python/RefitterForPixelDQM.py +++ b/DQM/SiPixelMonitorTrack/python/RefitterForPixelDQM.py @@ -1,5 +1,6 @@ import FWCore.ParameterSet.Config as cms import RecoTracker.TrackProducer.TrackRefitter_cfi -refittedForPixelDQM = RecoTracker.TrackProducer.TrackRefitter_cfi.TrackRefitter.clone() -refittedForPixelDQM.NavigationSchool = '' -refittedForPixelDQM.Fitter = 'FlexibleKFFittingSmoother' +refittedForPixelDQM = RecoTracker.TrackProducer.TrackRefitter_cfi.TrackRefitter.clone( + NavigationSchool = '', + Fitter = 'FlexibleKFFittingSmoother' +) diff --git a/DQM/SiPixelPhase1Common/python/HistogramManager_cfi.py b/DQM/SiPixelPhase1Common/python/HistogramManager_cfi.py index 306decf7eb8da..d99b5f7dfcae9 100644 --- a/DQM/SiPixelPhase1Common/python/HistogramManager_cfi.py +++ b/DQM/SiPixelPhase1Common/python/HistogramManager_cfi.py @@ -100,17 +100,21 @@ #) ) -DefaultHistoDigiCluster=DefaultHisto.clone() -DefaultHistoDigiCluster.topFolderName= cms.string("PixelPhase1/Phase1_MechanicalView") +DefaultHistoDigiCluster=DefaultHisto.clone( + topFolderName = "PixelPhase1/Phase1_MechanicalView" +) -DefaultHistoSummary=DefaultHisto.clone() -DefaultHistoSummary.topFolderName= cms.string("PixelPhase1/Summary") +DefaultHistoSummary=DefaultHisto.clone( + topFolderName = "PixelPhase1/Summary" +) -DefaultHistoTrack=DefaultHisto.clone() -DefaultHistoTrack.topFolderName= cms.string("PixelPhase1/Tracks") +DefaultHistoTrack=DefaultHisto.clone( + topFolderName = "PixelPhase1/Tracks" +) -DefaultHistoReadout=DefaultHisto.clone() -DefaultHistoReadout.topFolderName= cms.string("PixelPhase1/FED/Readout") +DefaultHistoReadout=DefaultHisto.clone( + topFolderName = "PixelPhase1/FED/Readout" +) # Commonly used specifications. StandardSpecifications1D = [ diff --git a/DQM/SiPixelPhase1Config/python/SiPixelPhase1OfflineDQM_harvesting_cff.py b/DQM/SiPixelPhase1Config/python/SiPixelPhase1OfflineDQM_harvesting_cff.py index 8fa1f33308eb0..0e23e659b60bd 100644 --- a/DQM/SiPixelPhase1Config/python/SiPixelPhase1OfflineDQM_harvesting_cff.py +++ b/DQM/SiPixelPhase1Config/python/SiPixelPhase1OfflineDQM_harvesting_cff.py @@ -16,10 +16,12 @@ + SiPixelPhase1SummaryOffline + SiPixelBarycenterOffline + SiPixelPhase1ResidualsExtra + + SiPixelPhase1EfficiencyExtras ) siPixelPhase1OfflineDQM_harvesting_cosmics = siPixelPhase1OfflineDQM_harvesting.copyAndExclude([ - SiPixelPhase1TrackEfficiencyHarvester, + SiPixelPhase1TrackEfficiencyHarvester, + SiPixelPhase1EfficiencyExtras, ]) siPixelPhase1OfflineDQM_harvesting_cosmics.replace(RunQTests_offline, RunQTests_cosmics) diff --git a/DQM/SiPixelPhase1Config/python/SiPixelPhase1OfflineDQM_source_cff.py b/DQM/SiPixelPhase1Config/python/SiPixelPhase1OfflineDQM_source_cff.py index a4131f6752cb0..a2e0da8bddb68 100644 --- a/DQM/SiPixelPhase1Config/python/SiPixelPhase1OfflineDQM_source_cff.py +++ b/DQM/SiPixelPhase1Config/python/SiPixelPhase1OfflineDQM_source_cff.py @@ -27,6 +27,7 @@ from RecoPixelVertexing.PixelLowPtUtilities.ClusterShapeHitFilterESProducer_cfi import * from RecoLocalTracker.SiStripClusterizer.SiStripClusterChargeCut_cfi import * +from DQM.SiPixelPhase1Track.SiPixelPhase1EfficiencyExtras_cfi import * PerModule.enabled = False IsOffline.enabled=True @@ -48,26 +49,28 @@ SiPixelPhase1TrackEfficiencyAnalyzer ]) -SiPixelPhase1TrackResidualsAnalyzer_cosmics = SiPixelPhase1TrackResidualsAnalyzer.clone() -SiPixelPhase1TrackResidualsAnalyzer_cosmics.Tracks = "ctfWithMaterialTracksP5" -SiPixelPhase1TrackResidualsAnalyzer_cosmics.trajectoryInput = "ctfWithMaterialTracksP5" -SiPixelPhase1TrackResidualsAnalyzer_cosmics.VertexCut =cms.untracked.bool(False) # don't cuts based on the primary vertex position for cosmics - +SiPixelPhase1TrackResidualsAnalyzer_cosmics = SiPixelPhase1TrackResidualsAnalyzer.clone( + Tracks = "ctfWithMaterialTracksP5", + trajectoryInput = "ctfWithMaterialTracksP5", + VertexCut = False # don't cuts based on the primary vertex position for cosmics +) siPixelPhase1OfflineDQM_source_cosmics.replace(SiPixelPhase1TrackResidualsAnalyzer, SiPixelPhase1TrackResidualsAnalyzer_cosmics) -SiPixelPhase1RecHitsAnalyzer_cosmics = SiPixelPhase1RecHitsAnalyzer.clone() -SiPixelPhase1RecHitsAnalyzer_cosmics.onlyValidHits = True # In Cosmics the efficiency plugin will not run, so we monitor only valid hits -SiPixelPhase1RecHitsAnalyzer_cosmics.src = "ctfWithMaterialTracksP5" -SiPixelPhase1RecHitsAnalyzer_cosmics.VertexCut = cms.untracked.bool(False) +SiPixelPhase1RecHitsAnalyzer_cosmics = SiPixelPhase1RecHitsAnalyzer.clone( + onlyValidHits = True, # In Cosmics the efficiency plugin will not run, so we monitor only valid hits + src = "ctfWithMaterialTracksP5", + VertexCut = False +) siPixelPhase1OfflineDQM_source_cosmics.replace(SiPixelPhase1RecHitsAnalyzer, SiPixelPhase1RecHitsAnalyzer_cosmics) -SiPixelPhase1TrackClustersAnalyzer_cosmics = SiPixelPhase1TrackClustersAnalyzer.clone() -SiPixelPhase1TrackClustersAnalyzer_cosmics.tracks = "ctfWithMaterialTracksP5" -SiPixelPhase1TrackClustersAnalyzer_cosmics.VertexCut = cms.untracked.bool(False) +SiPixelPhase1TrackClustersAnalyzer_cosmics = SiPixelPhase1TrackClustersAnalyzer.clone( + tracks = "ctfWithMaterialTracksP5", + VertexCut = False +) siPixelPhase1OfflineDQM_source_cosmics.replace(SiPixelPhase1TrackClustersAnalyzer, SiPixelPhase1TrackClustersAnalyzer_cosmics) @@ -77,30 +80,34 @@ siPixelPhase1OfflineDQM_source_hi = siPixelPhase1OfflineDQM_source.copy() -SiPixelPhase1RecHitsAnalyzer_hi = SiPixelPhase1RecHitsAnalyzer.clone() -SiPixelPhase1RecHitsAnalyzer_hi.src = "hiGeneralTracks" +SiPixelPhase1RecHitsAnalyzer_hi = SiPixelPhase1RecHitsAnalyzer.clone( + src = "hiGeneralTracks" +) siPixelPhase1OfflineDQM_source_hi.replace(SiPixelPhase1RecHitsAnalyzer, SiPixelPhase1RecHitsAnalyzer_hi) -SiPixelPhase1TrackResidualsAnalyzer_hi = SiPixelPhase1TrackResidualsAnalyzer.clone() -SiPixelPhase1TrackResidualsAnalyzer_hi.Tracks = "hiGeneralTracks" -SiPixelPhase1TrackResidualsAnalyzer_hi.trajectoryInput = "hiRefittedForPixelDQM" -SiPixelPhase1TrackResidualsAnalyzer_hi.vertices = "hiSelectedVertex" +SiPixelPhase1TrackResidualsAnalyzer_hi = SiPixelPhase1TrackResidualsAnalyzer.clone( + Tracks = "hiGeneralTracks", + trajectoryInput = "hiRefittedForPixelDQM", + vertices = "hiSelectedVertex" +) siPixelPhase1OfflineDQM_source_hi.replace(SiPixelPhase1TrackResidualsAnalyzer, SiPixelPhase1TrackResidualsAnalyzer_hi) -SiPixelPhase1TrackClustersAnalyzer_hi = SiPixelPhase1TrackClustersAnalyzer.clone() -SiPixelPhase1TrackClustersAnalyzer_hi.tracks = "hiGeneralTracks" -SiPixelPhase1TrackClustersAnalyzer_hi.vertices = "hiSelectedVertex" +SiPixelPhase1TrackClustersAnalyzer_hi = SiPixelPhase1TrackClustersAnalyzer.clone( + tracks = "hiGeneralTracks", + vertices = "hiSelectedVertex" +) siPixelPhase1OfflineDQM_source_hi.replace(SiPixelPhase1TrackClustersAnalyzer, SiPixelPhase1TrackClustersAnalyzer_hi) -SiPixelPhase1TrackEfficiencyAnalyzer_hi = SiPixelPhase1TrackEfficiencyAnalyzer.clone() -SiPixelPhase1TrackEfficiencyAnalyzer_hi.tracks = "hiGeneralTracks" -SiPixelPhase1TrackEfficiencyAnalyzer_hi.primaryvertices = "hiSelectedVertex" +SiPixelPhase1TrackEfficiencyAnalyzer_hi = SiPixelPhase1TrackEfficiencyAnalyzer.clone( + tracks = "hiGeneralTracks", + primaryvertices = "hiSelectedVertex" +) siPixelPhase1OfflineDQM_source_hi.replace(SiPixelPhase1TrackEfficiencyAnalyzer, SiPixelPhase1TrackEfficiencyAnalyzer_hi) diff --git a/DQM/SiPixelPhase1Config/python/SiPixelPhase1OnlineDQM_Timing_cff.py b/DQM/SiPixelPhase1Config/python/SiPixelPhase1OnlineDQM_Timing_cff.py index 4367625dd014b..ff64e24c45200 100644 --- a/DQM/SiPixelPhase1Config/python/SiPixelPhase1OnlineDQM_Timing_cff.py +++ b/DQM/SiPixelPhase1Config/python/SiPixelPhase1OnlineDQM_Timing_cff.py @@ -129,17 +129,20 @@ ## Additional settings for cosmic runs -SiPixelPhase1TrackClustersAnalyzer_cosmics = SiPixelPhase1TrackClustersAnalyzer.clone() -SiPixelPhase1TrackClustersAnalyzer_cosmics.tracks = cms.InputTag( "ctfWithMaterialTracksP5" ) -SiPixelPhase1TrackClustersAnalyzer_cosmics.VertexCut = cms.untracked.bool(False) +SiPixelPhase1TrackClustersAnalyzer_cosmics = SiPixelPhase1TrackClustersAnalyzer.clone( + tracks = "ctfWithMaterialTracksP5", + VertexCut = False +) -SiPixelPhase1TrackResidualsAnalyzer_cosmics = SiPixelPhase1TrackResidualsAnalyzer.clone() -SiPixelPhase1TrackResidualsAnalyzer_cosmics.Tracks = cms.InputTag( "ctfWithMaterialTracksP5" ) -SiPixelPhase1TrackResidualsAnalyzer_cosmics.trajectoryInput = "ctfWithMaterialTracksP5" -SiPixelPhase1TrackResidualsAnalyzer_cosmics.VertexCut = cms.untracked.bool(False) +SiPixelPhase1TrackResidualsAnalyzer_cosmics = SiPixelPhase1TrackResidualsAnalyzer.clone( + Tracks = "ctfWithMaterialTracksP5", + trajectoryInput = "ctfWithMaterialTracksP5", + VertexCut = False +) -SiPixelPhase1TrackEfficiencyAnalyzer_cosmics=SiPixelPhase1TrackEfficiencyAnalyzer.clone() -SiPixelPhase1TrackEfficiencyAnalyzer_cosmics.tracks=cms.InputTag( "ctfWithMaterialTracksP5" ) +SiPixelPhase1TrackEfficiencyAnalyzer_cosmics=SiPixelPhase1TrackEfficiencyAnalyzer.clone( + tracks = "ctfWithMaterialTracksP5" +) siPixelPhase1OnlineDQM_source_cosmics = cms.Sequence( SiPixelPhase1DigisAnalyzer @@ -150,20 +153,23 @@ ) ## Additional settings for pp_run (Phase 0 test) -SiPixelPhase1TrackClustersAnalyzer_pprun = SiPixelPhase1TrackClustersAnalyzer.clone() -SiPixelPhase1TrackClustersAnalyzer_pprun.tracks = cms.InputTag( "initialStepTracksPreSplitting" ) -SiPixelPhase1TrackClustersAnalyzer_pprun.clusterShapeCache = cms.InputTag("siPixelClusterShapeCachePreSplitting") -SiPixelPhase1TrackClustersAnalyzer_pprun.vertices = cms.InputTag('firstStepPrimaryVerticesPreSplitting') -SiPixelPhase1TrackClustersAnalyzer_pprun.VertexCut = cms.untracked.bool(False) - -SiPixelPhase1TrackResidualsAnalyzer_pprun = SiPixelPhase1TrackResidualsAnalyzer.clone() -SiPixelPhase1TrackResidualsAnalyzer_pprun.Tracks = cms.InputTag( "initialStepTracksPreSplitting" ) -SiPixelPhase1TrackResidualsAnalyzer_pprun.trajectoryInput = "initialStepTracksPreSplitting" -SiPixelPhase1TrackResidualsAnalyzer_pprun.VertexCut = cms.untracked.bool(False) - -SiPixelPhase1TrackEfficiencyAnalyzer_pprun=SiPixelPhase1TrackEfficiencyAnalyzer.clone() -SiPixelPhase1TrackEfficiencyAnalyzer_pprun.tracks=cms.InputTag( "initialStepTracksPreSplitting" ) -SiPixelPhase1TrackEfficiencyAnalyzer_pprun.VertexCut = cms.untracked.bool(False) +SiPixelPhase1TrackClustersAnalyzer_pprun = SiPixelPhase1TrackClustersAnalyzer.clone( + tracks = "initialStepTracksPreSplitting", + clusterShapeCache = "siPixelClusterShapeCachePreSplitting", + vertices = 'firstStepPrimaryVerticesPreSplitting', + VertexCut = False +) + +SiPixelPhase1TrackResidualsAnalyzer_pprun = SiPixelPhase1TrackResidualsAnalyzer.clone( + Tracks = "initialStepTracksPreSplitting", + trajectoryInput = "initialStepTracksPreSplitting", + VertexCut = False +) + +SiPixelPhase1TrackEfficiencyAnalyzer_pprun = SiPixelPhase1TrackEfficiencyAnalyzer.clone( + tracks = "initialStepTracksPreSplitting", + VertexCut = False +) siPixelPhase1OnlineDQM_source_pprun = cms.Sequence( SiPixelPhase1DigisAnalyzer diff --git a/DQM/SiPixelPhase1Config/python/SiPixelPhase1OnlineDQM_cff.py b/DQM/SiPixelPhase1Config/python/SiPixelPhase1OnlineDQM_cff.py index 173396b7d9fac..48a54228082a7 100644 --- a/DQM/SiPixelPhase1Config/python/SiPixelPhase1OnlineDQM_cff.py +++ b/DQM/SiPixelPhase1Config/python/SiPixelPhase1OnlineDQM_cff.py @@ -102,14 +102,16 @@ ## Additional settings for cosmic runs -SiPixelPhase1TrackClustersAnalyzer_cosmics = SiPixelPhase1TrackClustersAnalyzer.clone() -SiPixelPhase1TrackClustersAnalyzer_cosmics.tracks = cms.InputTag( "ctfWithMaterialTracksP5" ) -SiPixelPhase1TrackClustersAnalyzer_cosmics.VertexCut = cms.untracked.bool(False) +SiPixelPhase1TrackClustersAnalyzer_cosmics = SiPixelPhase1TrackClustersAnalyzer.clone( + tracks = "ctfWithMaterialTracksP5", + VertexCut = False +) -SiPixelPhase1TrackResidualsAnalyzer_cosmics = SiPixelPhase1TrackResidualsAnalyzer.clone() -SiPixelPhase1TrackResidualsAnalyzer_cosmics.Tracks = cms.InputTag( "ctfWithMaterialTracksP5" ) -SiPixelPhase1TrackResidualsAnalyzer_cosmics.trajectoryInput = "ctfWithMaterialTracksP5" -SiPixelPhase1TrackResidualsAnalyzer_cosmics.VertexCut = cms.untracked.bool(False) +SiPixelPhase1TrackResidualsAnalyzer_cosmics = SiPixelPhase1TrackResidualsAnalyzer.clone( + Tracks = "ctfWithMaterialTracksP5", + trajectoryInput = "ctfWithMaterialTracksP5", + VertexCut = False +) siPixelPhase1OnlineDQM_source_cosmics = cms.Sequence( SiPixelPhase1DigisAnalyzer @@ -121,16 +123,18 @@ ) ## Additional settings for pp_run -SiPixelPhase1TrackClustersAnalyzer_pprun = SiPixelPhase1TrackClustersAnalyzer.clone() -SiPixelPhase1TrackClustersAnalyzer_pprun.tracks = cms.InputTag( "initialStepTracksPreSplitting" ) -SiPixelPhase1TrackClustersAnalyzer_pprun.clusterShapeCache = cms.InputTag("siPixelClusterShapeCachePreSplitting") -SiPixelPhase1TrackClustersAnalyzer_pprun.vertices = cms.InputTag('firstStepPrimaryVerticesPreSplitting') -SiPixelPhase1TrackClustersAnalyzer_pprun.VertexCut = cms.untracked.bool(False) - -SiPixelPhase1TrackResidualsAnalyzer_pprun = SiPixelPhase1TrackResidualsAnalyzer.clone() -SiPixelPhase1TrackResidualsAnalyzer_pprun.Tracks = cms.InputTag( "initialStepTracksPreSplitting" ) -SiPixelPhase1TrackResidualsAnalyzer_pprun.trajectoryInput = "initialStepTracksPreSplitting" -SiPixelPhase1TrackResidualsAnalyzer_pprun.VertexCut = cms.untracked.bool(False) +SiPixelPhase1TrackClustersAnalyzer_pprun = SiPixelPhase1TrackClustersAnalyzer.clone( + tracks = "initialStepTracksPreSplitting", + clusterShapeCache = "siPixelClusterShapeCachePreSplitting", + vertices = 'firstStepPrimaryVerticesPreSplitting', + VertexCut = False +) + +SiPixelPhase1TrackResidualsAnalyzer_pprun = SiPixelPhase1TrackResidualsAnalyzer.clone( + Tracks = "initialStepTracksPreSplitting", + trajectoryInput = "initialStepTracksPreSplitting", + VertexCut = False +) siPixelPhase1OnlineDQM_source_pprun = cms.Sequence( SiPixelPhase1DigisAnalyzer diff --git a/DQM/SiPixelPhase1Track/plugins/SiPixelPhase1EfficiencyExtras.cc b/DQM/SiPixelPhase1Track/plugins/SiPixelPhase1EfficiencyExtras.cc new file mode 100644 index 0000000000000..806caf980429c --- /dev/null +++ b/DQM/SiPixelPhase1Track/plugins/SiPixelPhase1EfficiencyExtras.cc @@ -0,0 +1,238 @@ +// -*- C++ -*- +// +// Package: SiPixelPhase1EfficiencyExtras +// Class: SiPixelPhase1EfficiencyExtras +// +/**\class + + Description: Create the Phase 1 extra efficiency trend plots + + Implementation: + +*/ +// +// Original Author: Jack Sisson, Julie Hogan +// Created: 7 July, 2021 +// +// + +// Framework +#include "FWCore/ServiceRegistry/interface/Service.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/EventSetup.h" + +// DQM Framework +#include "DQMServices/Core/interface/DQMStore.h" +#include "DQMServices/Core/interface/DQMEDHarvester.h" + +using namespace std; +using namespace edm; + +class SiPixelPhase1EfficiencyExtras : public DQMEDHarvester { +public: + explicit SiPixelPhase1EfficiencyExtras(const edm::ParameterSet& conf); + ~SiPixelPhase1EfficiencyExtras() override; + +protected: + void beginRun(edm::Run const& run, edm::EventSetup const& eSetup) override; + + void dqmEndJob(DQMStore::IBooker& iBooker, DQMStore::IGetter& iGetter) override; + + const std::string effFolderName_; + const std::string vtxFolderName_; + const std::string instLumiFolderName_; +}; + +SiPixelPhase1EfficiencyExtras::SiPixelPhase1EfficiencyExtras(const edm::ParameterSet& iConfig) + : effFolderName_(iConfig.getParameter("EffFolderName")), + vtxFolderName_(iConfig.getParameter("VtxFolderName")), + instLumiFolderName_(iConfig.getParameter("InstLumiFolderName")) { + LogInfo("PixelDQM") << "SiPixelPhase1EfficiencyExtras::SiPixelPhase1EfficiencyExtras: Hello!" << endl; +} + +SiPixelPhase1EfficiencyExtras::~SiPixelPhase1EfficiencyExtras() { + LogInfo("PixelDQM") << "SiPixelPhase1EfficiencyExtras::~SiPixelPhase1EfficiencyExtras: Destructor" << endl; +} + +void SiPixelPhase1EfficiencyExtras::beginRun(edm::Run const& run, edm::EventSetup const& eSetup) {} + +//------------------------------------------------------------------ +// Method called for every event +//------------------------------------------------------------------ +void SiPixelPhase1EfficiencyExtras::dqmEndJob(DQMStore::IBooker& iBooker, DQMStore::IGetter& iGetter) { + iBooker.setCurrentFolder(effFolderName_); + + //Get the existing histos + MonitorElement* vtx_v_lumi = iGetter.get(vtxFolderName_ + "/NumberOfGoodPVtxVsLS_GenTk"); + + MonitorElement* scalLumi_v_lumi = iGetter.get(instLumiFolderName_ + "/lumiVsLS"); + + MonitorElement* eff_v_lumi_forward = + iGetter.get(effFolderName_ + "/hitefficiency_per_Lumisection_per_PXDisk_PXForward"); + + MonitorElement* eff_v_lumi_barrel = + iGetter.get(effFolderName_ + "/hitefficiency_per_Lumisection_per_PXLayer_PXBarrel"); + + //set up some booleans that will tell us which graphs to create + bool createNvtx = true; + bool createInstLumi = true; + + //check which of the MEs exist and respond appropriately + if (!eff_v_lumi_forward) { + edm::LogWarning("SiPixelPhase1EfficiencyExtras") + << "no hitefficiency_per_Lumisection_per_PXDisk_PXForward ME is available in " << effFolderName_ << std::endl; + return; + } + if (!eff_v_lumi_barrel) { + edm::LogWarning("SiPixelPhase1EfficiencyExtras") + << "no hitefficiency_per_Lumisection_per_PXLayer_PXBarrel ME is available in " << effFolderName_ << std::endl; + return; + } + if (!vtx_v_lumi) { + edm::LogWarning("SiPixelPhase1EfficiencyExtras") + << "no NumberOfGoodPVtxVsLS_GenTK ME is available in " << vtxFolderName_ << std::endl; + createNvtx = false; + } + if (!scalLumi_v_lumi) { + edm::LogWarning("SiPixelPhase1EfficiencyExtras") + << "no lumiVsLS ME is available in " << instLumiFolderName_ << std::endl; + createInstLumi = false; + } + + //If the existing MEs are empty, set the boolean to skip booking + if (vtx_v_lumi && vtx_v_lumi->getEntries() == 0) + createNvtx = false; + if (scalLumi_v_lumi && scalLumi_v_lumi->getEntries() == 0) + createInstLumi = false; + + double eff = 0.0; + + //Will pass if nvtx ME exists and is not empty + if (createNvtx) { + //Book new histos + MonitorElement* eff_v_vtx_barrel = + iBooker.book2D("hitefficiency_per_meanNvtx_per_PXLayer_PXBarrel", + "hitefficiency_per_meanNvtx_per_PXLayer_PXBarrel; meanNvtx; PXLayer", + 500, + 0, + 100, + 3, + .5, + 3.5); + + MonitorElement* eff_v_vtx_forward = + iBooker.book2D("hitefficiency_per_meanNvtx_per_PXDisk_PXForward", + "hitefficiency_per_meanNvtx_per_PXDisk_PXForward; meanNvtx; PXDisk", + 500, + 0, + 100, + 7, + -3.5, + 3.5); + + //initialize variables + int numLumiNvtx = int(vtx_v_lumi->getNbinsX()); + double nvtx = 0.0; + int binNumVtx = 0; + + //For loop to loop through lumisections + for (int iLumi = 1; iLumi < numLumiNvtx - 1; iLumi++) { + //get the meanNvtx for each lumi + nvtx = vtx_v_lumi->getBinContent(iLumi); + + //Filter out useless iterations + if (nvtx != 0) { + //Grab the bin number for the nvtx + binNumVtx = eff_v_vtx_barrel->getTH2F()->FindBin(nvtx); + + //loop through the layers + for (int iLayer = 1; iLayer < 8; iLayer++) { + //get the eff at the lumisection and layer + eff = eff_v_lumi_forward->getBinContent(iLumi - 1, iLayer); + + //set the efficiency in the new histo + eff_v_vtx_forward->setBinContent(binNumVtx, iLayer, eff); + } + + //loop through the layers + for (int iLayer = 1; iLayer < 5; iLayer++) { + //get the efficiency for each lumi at each layer + eff = eff_v_lumi_barrel->getBinContent(iLumi - 1, iLayer); + + //set the efficiency + eff_v_vtx_barrel->setBinContent(binNumVtx, iLayer, eff); + } + } + } + } + // Will pass if InstLumi ME exists and is not empty + if (createInstLumi) { + //Get the max value of inst lumi for plot + int yMax2 = scalLumi_v_lumi->getTProfile()->GetMaximum(); + yMax2 = yMax2 + yMax2 * .1; + + //Book new histos + MonitorElement* eff_v_scalLumi_barrel = + iBooker.book2D("hitefficiency_per_scalLumi_per_PXLayer_PXBarrel", + "hitefficiency_per_scalLumi_per_PXLayer_PXBarrel; scal inst lumi E30; PXLayer", + 500, + 0, + yMax2, + 3, + .5, + 3.5); + + MonitorElement* eff_v_scalLumi_forward = + iBooker.book2D("hitefficiency_per_scalLumi_per_PXDisk_PXForward", + "hitefficiency_per_scalLumi_per_PXDisk_PXForward; scal inst lumi E30; PXDisk", + 500, + 0, + yMax2, + 7, + -3.5, + 3.5); + + //initialize variables + int numLumiScal = int(scalLumi_v_lumi->getNbinsX()); + double scalLumi = 0.0; + int binNumScal = 0; + + //For loop to loop through lumisections + for (int iLumi = 1; iLumi < numLumiScal - 1; iLumi++) { + //get the inst lumi for each lumi + scalLumi = scalLumi_v_lumi->getBinContent(iLumi); + + //Filter out useless iterations + if (scalLumi != 0) { + //Grab the bin number for the inst lumi + binNumScal = eff_v_scalLumi_barrel->getTH2F()->FindBin(scalLumi); + + //loop through the layers + for (int iLayer = 1; iLayer < 8; iLayer++) { + //get the eff at the lumisection and layer + eff = eff_v_lumi_forward->getBinContent(iLumi - 1, iLayer); + + //set the efficiency in the new histo + eff_v_scalLumi_forward->setBinContent(binNumScal, iLayer, eff); + } + + //loop through the layers + for (int iLayer = 1; iLayer < 5; iLayer++) { + //get the eff at the lumisection and layer + eff = eff_v_lumi_barrel->getBinContent(iLumi - 1, iLayer); + + //set the efficiency in the new histo + eff_v_scalLumi_barrel->setBinContent(binNumScal, iLayer, eff); + } + } + } + } else + return; +} + +//define this as a plug-in +DEFINE_FWK_MODULE(SiPixelPhase1EfficiencyExtras); diff --git a/DQM/SiPixelPhase1Track/python/SiPixelPhase1EfficiencyExtras_cfi.py b/DQM/SiPixelPhase1Track/python/SiPixelPhase1EfficiencyExtras_cfi.py new file mode 100644 index 0000000000000..ae66b29b0a15e --- /dev/null +++ b/DQM/SiPixelPhase1Track/python/SiPixelPhase1EfficiencyExtras_cfi.py @@ -0,0 +1,9 @@ +import FWCore.ParameterSet.Config as cms +from DQMServices.Core.DQMEDHarvester import DQMEDHarvester + + +SiPixelPhase1EfficiencyExtras = DQMEDHarvester("SiPixelPhase1EfficiencyExtras", + EffFolderName = cms.string('PixelPhase1/Tracks/'), + VtxFolderName = cms.string('Tracking/TrackParameters/generalTracks/GeneralProperties/'), + InstLumiFolderName = cms.string('HLT/LumiMonitoring/') +) diff --git a/DQM/SiPixelPhase1Track/python/SiPixelPhase1RecHits_cfi.py b/DQM/SiPixelPhase1Track/python/SiPixelPhase1RecHits_cfi.py index e4a25af427809..3984ed76f7379 100644 --- a/DQM/SiPixelPhase1Track/python/SiPixelPhase1RecHits_cfi.py +++ b/DQM/SiPixelPhase1Track/python/SiPixelPhase1RecHits_cfi.py @@ -221,7 +221,8 @@ histograms = SiPixelPhase1RecHitsConf, geometry = SiPixelPhase1Geometry, onlyValidHits = cms.bool(False), - triggerflags = trigger.SiPixelPhase1Triggers + triggerflags = trigger.SiPixelPhase1Triggers, + VertexCut = cms.untracked.bool(True) ) SiPixelPhase1RecHitsHarvester = DQMEDHarvester("SiPixelPhase1Harvester", diff --git a/DQM/SiPixelPhase1Track/python/SiPixelPhase1TrackClusters_cfi.py b/DQM/SiPixelPhase1Track/python/SiPixelPhase1TrackClusters_cfi.py index 22b3ff0fde731..d65fab240e3d3 100644 --- a/DQM/SiPixelPhase1Track/python/SiPixelPhase1TrackClusters_cfi.py +++ b/DQM/SiPixelPhase1Track/python/SiPixelPhase1TrackClusters_cfi.py @@ -587,7 +587,8 @@ vertices = cms.InputTag("offlinePrimaryVertices"), histograms = SiPixelPhase1TrackClustersConf, geometry = SiPixelPhase1Geometry, - triggerflags = trigger.SiPixelPhase1Triggers + triggerflags = trigger.SiPixelPhase1Triggers, + VertexCut = cms.untracked.bool(True) ) SiPixelPhase1TrackClustersHarvester = DQMEDHarvester("SiPixelPhase1Harvester", diff --git a/DQM/SiPixelPhase1Track/python/SiPixelPhase1TrackEfficiency_cfi.py b/DQM/SiPixelPhase1Track/python/SiPixelPhase1TrackEfficiency_cfi.py index 9c2fa7ce0aec6..6b1e945ab94b0 100644 --- a/DQM/SiPixelPhase1Track/python/SiPixelPhase1TrackEfficiency_cfi.py +++ b/DQM/SiPixelPhase1Track/python/SiPixelPhase1TrackEfficiency_cfi.py @@ -74,9 +74,8 @@ xlabel = "#valid/(#valid+#missing)", dimensions = 1, specs = VPSet( - #2D profile maps per layer StandardSpecification2DProfile, - + #profiles per layer and shell Specification(PerLadder).groupBy("PXBarrel/Shell/PXLayer/SignedLadder") .reduce("MEAN") @@ -94,9 +93,20 @@ Specification().groupBy("PXForward/PXDisk") .reduce("MEAN") .groupBy("PXForward", "EXTEND_X") - .save() + .save(), - #StandardSpecificationPixelmapProfile + Specification(PerLayer2D) + .groupBy("PXBarrel/PXLayer/Lumisection") + .groupBy("PXBarrel/PXLayer", "EXTEND_X") + .groupBy("PXBarrel", "EXTEND_Y") + .reduce("MEAN") + .save(), + Specification(PerLayer2D) + .groupBy("PXForward/PXDisk/Lumisection") + .groupBy("PXForward/PXDisk", "EXTEND_X") + .groupBy("PXForward", "EXTEND_Y") + .reduce("MEAN") + .save(), ) ) @@ -139,7 +149,8 @@ tracker = cms.InputTag("MeasurementTrackerEvent"), histograms = SiPixelPhase1TrackEfficiencyConf, geometry = SiPixelPhase1Geometry, - triggerflags = trigger.SiPixelPhase1Triggers + triggerflags = trigger.SiPixelPhase1Triggers, + VertexCut = cms.untracked.bool(True) ) SiPixelPhase1TrackEfficiencyHarvester = DQMEDHarvester("SiPixelPhase1Harvester", diff --git a/DQM/SiPixelPhase1Track/python/SiPixelPhase1TrackResiduals_cfi.py b/DQM/SiPixelPhase1Track/python/SiPixelPhase1TrackResiduals_cfi.py index e12cfe4b67748..5c2703b444ed9 100644 --- a/DQM/SiPixelPhase1Track/python/SiPixelPhase1TrackResiduals_cfi.py +++ b/DQM/SiPixelPhase1Track/python/SiPixelPhase1TrackResiduals_cfi.py @@ -139,7 +139,8 @@ vertices = cms.InputTag("offlinePrimaryVertices"), histograms = SiPixelPhase1TrackResidualsConf, geometry = SiPixelPhase1Geometry, - triggerflags = trigger.SiPixelPhase1Triggers + triggerflags = trigger.SiPixelPhase1Triggers, + VertexCut = cms.untracked.bool(True) ) SiPixelPhase1TrackResidualsHarvester = DQMEDHarvester("SiPixelPhase1Harvester", diff --git a/DQM/SiStripCommissioningSources/python/SiStripOfflineCRack_cfg.py b/DQM/SiStripCommissioningSources/python/SiStripOfflineCRack_cfg.py index 160e7bea16803..273ffd34c768d 100644 --- a/DQM/SiStripCommissioningSources/python/SiStripOfflineCRack_cfg.py +++ b/DQM/SiStripCommissioningSources/python/SiStripOfflineCRack_cfg.py @@ -131,9 +131,10 @@ process.load('DQM.SiStripCommissioningSources.SiStripFineDelayHit_cfi') # Commissioning source file production -process.CommissioningHistosWithTracking = process.CommissioningHistos.clone() -process.CommissioningHistosWithTracking.InputModuleLabel = cms.string('siStripFineDelayHit') -process.CommissioningHistosWithTracking.SignalToNoiseCut = cms.double(3.0) +process.CommissioningHistosWithTracking = process.CommissioningHistos.clone( + InputModuleLabel = 'siStripFineDelayHit', + SignalToNoiseCut = cms.double(3.0) +) # the path to run for analysis with tracking process.p2 = cms.Path( diff --git a/DQM/SiStripCommissioningSources/python/SiStripOfflineP5_cfg.py b/DQM/SiStripCommissioningSources/python/SiStripOfflineP5_cfg.py index 3cb3ddae225da..bad9c020e76af 100644 --- a/DQM/SiStripCommissioningSources/python/SiStripOfflineP5_cfg.py +++ b/DQM/SiStripCommissioningSources/python/SiStripOfflineP5_cfg.py @@ -131,9 +131,10 @@ process.load('DQM.SiStripCommissioningSources.SiStripFineDelayHit_cfi') # Commissioning source file production -process.CommissioningHistosWithTracking = process.CommissioningHistos.clone() -process.CommissioningHistosWithTracking.InputModuleLabel = cms.string('siStripFineDelayHit') -process.CommissioningHistosWithTracking.SignalToNoiseCut = cms.double(3.0) +process.CommissioningHistosWithTracking = process.CommissioningHistos.clone( + InputModuleLabel = 'siStripFineDelayHit', + SignalToNoiseCut = cms.double(3.0) +) # the path to run for analysis with tracking process.p2 = cms.Path( diff --git a/DQM/SiStripCommissioningSources/python/SiStripOnlineCRack_cfg.py b/DQM/SiStripCommissioningSources/python/SiStripOnlineCRack_cfg.py index 65e07ddb32f67..5f4f0e997c675 100644 --- a/DQM/SiStripCommissioningSources/python/SiStripOnlineCRack_cfg.py +++ b/DQM/SiStripCommissioningSources/python/SiStripOnlineCRack_cfg.py @@ -129,9 +129,10 @@ process.load('DQM.SiStripCommissioningSources.SiStripFineDelayHit_cfi') # Commissioning source file production -process.CommissioningHistosWithTracking = process.CommissioningHistos.clone() -process.CommissioningHistosWithTracking.InputModuleLabel = cms.string('siStripFineDelayHit') -process.CommissioningHistosWithTracking.SignalToNoiseCut = cms.double(3.0) +process.CommissioningHistosWithTracking = process.CommissioningHistos.clone( + InputModuleLabel = 'siStripFineDelayHit', + SignalToNoiseCut = cms.double(3.0) +) # the path to run for analysis with tracking process.p2 = cms.Path( diff --git a/DQM/SiStripCommissioningSources/python/SiStripOnlineP5NoOutput_cfg.py b/DQM/SiStripCommissioningSources/python/SiStripOnlineP5NoOutput_cfg.py index 777512c01148e..a6ce94b3377e9 100644 --- a/DQM/SiStripCommissioningSources/python/SiStripOnlineP5NoOutput_cfg.py +++ b/DQM/SiStripCommissioningSources/python/SiStripOnlineP5NoOutput_cfg.py @@ -129,9 +129,10 @@ process.load('DQM.SiStripCommissioningSources.SiStripFineDelayHit_cfi') # Commissioning source file production -process.CommissioningHistosWithTracking = process.CommissioningHistos.clone() -process.CommissioningHistosWithTracking.InputModuleLabel = cms.string('siStripFineDelayHit') -process.CommissioningHistosWithTracking.SignalToNoiseCut = cms.double(3.0) +process.CommissioningHistosWithTracking = process.CommissioningHistos.clone( + InputModuleLabel = 'siStripFineDelayHit', + SignalToNoiseCut = cms.double(3.0) +) # the path to run for analysis with tracking process.p2 = cms.Path( diff --git a/DQM/SiStripCommissioningSources/python/SiStripOnlineP5_cfg.py b/DQM/SiStripCommissioningSources/python/SiStripOnlineP5_cfg.py index 702776978d4fd..353958be15212 100644 --- a/DQM/SiStripCommissioningSources/python/SiStripOnlineP5_cfg.py +++ b/DQM/SiStripCommissioningSources/python/SiStripOnlineP5_cfg.py @@ -129,9 +129,10 @@ process.load('DQM.SiStripCommissioningSources.SiStripFineDelayHit_cfi') # Commissioning source file production -process.CommissioningHistosWithTracking = process.CommissioningHistos.clone() -process.CommissioningHistosWithTracking.InputModuleLabel = cms.string('siStripFineDelayHit') -process.CommissioningHistosWithTracking.SignalToNoiseCut = cms.double(3.0) +process.CommissioningHistosWithTracking = process.CommissioningHistos.clone( + InputModuleLabel = 'siStripFineDelayHit', + SignalToNoiseCut = cms.double(3.0) +) # the path to run for analysis with tracking process.p2 = cms.Path( diff --git a/DQM/SiStripCommissioningSources/src/PedsFullNoiseTask.cc b/DQM/SiStripCommissioningSources/src/PedsFullNoiseTask.cc index 5137b2f3adc64..b2c6bc2e97dd6 100644 --- a/DQM/SiStripCommissioningSources/src/PedsFullNoiseTask.cc +++ b/DQM/SiStripCommissioningSources/src/PedsFullNoiseTask.cc @@ -9,8 +9,6 @@ #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "boost/lexical_cast.hpp" - // ----------------------------------------------------------------------------- // PedsFullNoiseTask::PedsFullNoiseTask(DQMStore* dqm, const FedChannelConnection& conn, const edm::ParameterSet& pset) diff --git a/DQM/SiStripMonitorClient/bin/ls_cert.cc b/DQM/SiStripMonitorClient/bin/ls_cert.cc index 7dce64c99767c..8dc3baf63bf08 100644 --- a/DQM/SiStripMonitorClient/bin/ls_cert.cc +++ b/DQM/SiStripMonitorClient/bin/ls_cert.cc @@ -244,7 +244,6 @@ void ls_cert_type(string iDir, lsd[i] = templs; TDirectory* tempDir = dynamic_cast(file->Get(lsdir.str().c_str())); tempDir->cd(); - int j = 0; TIter nextTemp(tempDir->GetListOfKeys()); TKey* keyTemp; while ((keyTemp = dynamic_cast(nextTemp()))) { @@ -261,14 +260,13 @@ void ls_cert_type(string iDir, std::cout << typecert.c_str() << std::endl; tempvalue = atof(detvalue.c_str()); - for (j = 0; j < smax; j++) { + for (int j = 0; j < smax; j++) { if (strstr(typecert.c_str(), certflag[j].c_str()) != nullptr) v[j][i] = tempvalue; if (debug) std::cout << "Entering value " << tempvalue << " " << v[j][i] << " for " << certflag[j].c_str() << std::endl; } - j = j + 1; } } } diff --git a/DQM/SiStripMonitorClient/plugins/SiStripOfflineDQM.cc b/DQM/SiStripMonitorClient/plugins/SiStripOfflineDQM.cc index e3b51fcba6dfa..6c9c29a82de8e 100644 --- a/DQM/SiStripMonitorClient/plugins/SiStripOfflineDQM.cc +++ b/DQM/SiStripMonitorClient/plugins/SiStripOfflineDQM.cc @@ -37,6 +37,7 @@ //Run Info #include "CondFormats/RunInfo/interface/RunInfo.h" +#include "DQMServices/Core/interface/LegacyIOHelper.h" #include #include @@ -199,11 +200,13 @@ void SiStripOfflineDQM::endJob() { } bool SiStripOfflineDQM::openInputFile(DQMStore& dqm_store) { - if (inputFileName_.empty()) + if (inputFileName_.empty()) { return false; + } edm::LogInfo("OpenFile") << "SiStripOfflineDQM::openInputFile: Accessing root File" << inputFileName_; - dqm_store.open(inputFileName_, false); - return true; + dqm::harvesting::DQMStore* temp = dynamic_cast(&dqm_store); + LegacyIOHelper leo(temp); + return leo.open(inputFileName_); } #include "FWCore/Framework/interface/MakerMacros.h" diff --git a/DQM/SiStripMonitorClient/python/SiStripClientConfigP5_Cosmic_cff.py b/DQM/SiStripMonitorClient/python/SiStripClientConfigP5_Cosmic_cff.py index 441a739f4b476..2507569121c93 100644 --- a/DQM/SiStripMonitorClient/python/SiStripClientConfigP5_Cosmic_cff.py +++ b/DQM/SiStripMonitorClient/python/SiStripClientConfigP5_Cosmic_cff.py @@ -21,15 +21,7 @@ ), # Parameters for On Demand Monitoring - MonitorSiStripPedestal = OnDemandMonitoring.MonitorSiStripPedestal, - MonitorSiStripNoise = OnDemandMonitoring.MonitorSiStripNoise, - MonitorSiStripQuality = OnDemandMonitoring.MonitorSiStripQuality, - MonitorSiStripApvGain = OnDemandMonitoring.MonitorSiStripApvGain, - MonitorSiStripLorentzAngle = OnDemandMonitoring.MonitorSiStripLorentzAngle, - - MonitorSiStripCabling = OnDemandMonitoring.MonitorSiStripCabling, - MonitorSiStripLowThreshold = OnDemandMonitoring.MonitorSiStripLowThreshold, - MonitorSiStripHighThreshold = OnDemandMonitoring.MonitorSiStripHighThreshold, + MonitorSiStrip_PSet = OnDemandMonitoring.MonitorSiStrip_PSet, FillConditions_PSet = OnDemandMonitoring.FillConditions_PSet, diff --git a/DQM/SiStripMonitorClient/python/SiStripClientConfigP5_HeavyIons_cff.py b/DQM/SiStripMonitorClient/python/SiStripClientConfigP5_HeavyIons_cff.py index 439b975146db1..29738362111e6 100644 --- a/DQM/SiStripMonitorClient/python/SiStripClientConfigP5_HeavyIons_cff.py +++ b/DQM/SiStripMonitorClient/python/SiStripClientConfigP5_HeavyIons_cff.py @@ -36,15 +36,7 @@ ), # Parameters for On Demand Monitoring - MonitorSiStripPedestal = OnDemandMonitoring.MonitorSiStripPedestal, - MonitorSiStripNoise = OnDemandMonitoring.MonitorSiStripNoise, - MonitorSiStripQuality = OnDemandMonitoring.MonitorSiStripQuality, - MonitorSiStripApvGain = OnDemandMonitoring.MonitorSiStripApvGain, - MonitorSiStripLorentzAngle = OnDemandMonitoring.MonitorSiStripLorentzAngle, - - MonitorSiStripCabling = OnDemandMonitoring.MonitorSiStripCabling, - MonitorSiStripLowThreshold = OnDemandMonitoring.MonitorSiStripLowThreshold, - MonitorSiStripHighThreshold = OnDemandMonitoring.MonitorSiStripHighThreshold, + MonitorSiStrip_PSet = OnDemandMonitoring.MonitorSiStrip_PSet, FillConditions_PSet = OnDemandMonitoring.FillConditions_PSet, diff --git a/DQM/SiStripMonitorClient/python/SiStripClientConfigP5_cff.py b/DQM/SiStripMonitorClient/python/SiStripClientConfigP5_cff.py index 7a6d49e287868..e27508f4a6846 100644 --- a/DQM/SiStripMonitorClient/python/SiStripClientConfigP5_cff.py +++ b/DQM/SiStripMonitorClient/python/SiStripClientConfigP5_cff.py @@ -36,16 +36,7 @@ ), # Parameters for On Demand Monitoring - MonitorSiStripBackPlaneCorrection = OnDemandMonitoring.MonitorSiStripBackPlaneCorrection, - MonitorSiStripPedestal = OnDemandMonitoring.MonitorSiStripPedestal, - MonitorSiStripNoise = OnDemandMonitoring.MonitorSiStripNoise, - MonitorSiStripQuality = OnDemandMonitoring.MonitorSiStripQuality, - MonitorSiStripApvGain = OnDemandMonitoring.MonitorSiStripApvGain, - MonitorSiStripLorentzAngle = OnDemandMonitoring.MonitorSiStripLorentzAngle, - - MonitorSiStripCabling = OnDemandMonitoring.MonitorSiStripCabling, - MonitorSiStripLowThreshold = OnDemandMonitoring.MonitorSiStripLowThreshold, - MonitorSiStripHighThreshold = OnDemandMonitoring.MonitorSiStripHighThreshold, + MonitorSiStrip_PSet = OnDemandMonitoring.MonitorSiStrip_PSet, FillConditions_PSet = OnDemandMonitoring.FillConditions_PSet, diff --git a/DQM/SiStripMonitorClient/python/SiStripClientConfig_Tier0_Cosmic_cff.py b/DQM/SiStripMonitorClient/python/SiStripClientConfig_Tier0_Cosmic_cff.py index bd71e7d6f40e0..e7c9e2480542b 100644 --- a/DQM/SiStripMonitorClient/python/SiStripClientConfig_Tier0_Cosmic_cff.py +++ b/DQM/SiStripMonitorClient/python/SiStripClientConfig_Tier0_Cosmic_cff.py @@ -32,13 +32,11 @@ cms.PSet(record = cms.string('SiStripBadFiberRcd'), tag = cms.string('')), # Bad Channel list from the selected IOV as done at PCL # BadChannel list from FED errors is included below cms.PSet(record = cms.string('RunInfoRcd'), tag = cms.string('')) # List of FEDs exluded during data taking - ) - ) - -mergedSiStripQualityProducer.ReduceGranularity = cms.bool(False) -mergedSiStripQualityProducer.ThresholdForReducedGranularity = cms.double(0.3) -mergedSiStripQualityProducer.appendToDataLabel = 'MergedBadComponent' - + ), + ReduceGranularity = False, + ThresholdForReducedGranularity = 0.3, + appendToDataLabel = 'MergedBadComponent' +) from DQM.SiStripMonitorClient.siStripBadComponentInfo_cfi import siStripBadComponentInfo siStripBadComponentInfo.StripQualityLabel = 'MergedBadComponent' diff --git a/DQM/SiStripMonitorClient/python/SiStripClientConfig_Tier0_HeavyIons_cff.py b/DQM/SiStripMonitorClient/python/SiStripClientConfig_Tier0_HeavyIons_cff.py index 5d4b07b0d1df8..aa9b153e5a50c 100644 --- a/DQM/SiStripMonitorClient/python/SiStripClientConfig_Tier0_HeavyIons_cff.py +++ b/DQM/SiStripMonitorClient/python/SiStripClientConfig_Tier0_HeavyIons_cff.py @@ -43,12 +43,11 @@ cms.PSet(record = cms.string('SiStripBadFiberRcd'), tag = cms.string('')), # Bad Channel list from the selected IOV as done at PCL # BadChannel list from FED errors is included below cms.PSet(record = cms.string('RunInfoRcd'), tag = cms.string('')) # List of FEDs exluded during data taking - ) - ) - -mergedSiStripQualityProducer.ReduceGranularity = cms.bool(False) -mergedSiStripQualityProducer.ThresholdForReducedGranularity = cms.double(0.3) -mergedSiStripQualityProducer.appendToDataLabel = 'MergedBadComponent' + ), + ReduceGranularity = False, + ThresholdForReducedGranularity = 0.3, + appendToDataLabel = 'MergedBadComponent' +) from DQM.SiStripMonitorClient.siStripBadComponentInfo_cfi import siStripBadComponentInfo siStripBadComponentInfo.StripQualityLabel = 'MergedBadComponent' diff --git a/DQM/SiStripMonitorClient/python/SiStripClientConfig_Tier0_cff.py b/DQM/SiStripMonitorClient/python/SiStripClientConfig_Tier0_cff.py index f351f18ba718c..6cca7b387b8ab 100644 --- a/DQM/SiStripMonitorClient/python/SiStripClientConfig_Tier0_cff.py +++ b/DQM/SiStripMonitorClient/python/SiStripClientConfig_Tier0_cff.py @@ -52,12 +52,11 @@ cms.PSet(record = cms.string('SiStripBadFiberRcd'), tag = cms.string('')), # Bad Channel list from the selected IOV as done at PCL # BadChannel list from FED errors is included below cms.PSet(record = cms.string('RunInfoRcd'), tag = cms.string('')) # List of FEDs exluded during data taking - ) - ) - -mergedSiStripQualityProducer.ReduceGranularity = cms.bool(False) -mergedSiStripQualityProducer.ThresholdForReducedGranularity = cms.double(0.3) -mergedSiStripQualityProducer.appendToDataLabel = 'MergedBadComponent' + ), + ReduceGranularity = False, + ThresholdForReducedGranularity = 0.3, + appendToDataLabel = 'MergedBadComponent' +) from DQM.SiStripMonitorClient.siStripBadComponentInfo_cfi import siStripBadComponentInfo siStripBadComponentInfo.StripQualityLabel = 'MergedBadComponent' diff --git a/DQM/SiStripMonitorClient/python/SiStripClientConfig_cff.py b/DQM/SiStripMonitorClient/python/SiStripClientConfig_cff.py index c4c9ccb2edec3..95807bc298a46 100644 --- a/DQM/SiStripMonitorClient/python/SiStripClientConfig_cff.py +++ b/DQM/SiStripMonitorClient/python/SiStripClientConfig_cff.py @@ -19,15 +19,7 @@ ), # Parameters for On Demand Monitoring - MonitorSiStripPedestal = OnDemandMonitoring.MonitorSiStripPedestal, - MonitorSiStripNoise = OnDemandMonitoring.MonitorSiStripNoise, - MonitorSiStripQuality = OnDemandMonitoring.MonitorSiStripQuality, - MonitorSiStripApvGain = OnDemandMonitoring.MonitorSiStripApvGain, - MonitorSiStripLorentzAngle = OnDemandMonitoring.MonitorSiStripLorentzAngle, - - MonitorSiStripCabling = OnDemandMonitoring.MonitorSiStripCabling, - MonitorSiStripLowThreshold = OnDemandMonitoring.MonitorSiStripLowThreshold, - MonitorSiStripHighThreshold = OnDemandMonitoring.MonitorSiStripHighThreshold, + MonitorSiStrip_PSet = OnDemandMonitoring.MonitorSiStrip_PSet, FillConditions_PSet = OnDemandMonitoring.FillConditions_PSet, diff --git a/DQM/SiStripMonitorClient/python/SiStripDQMRecoConfigOfflineGlobalRunCAF_cfi.py b/DQM/SiStripMonitorClient/python/SiStripDQMRecoConfigOfflineGlobalRunCAF_cfi.py index 7a17a75f914c3..c95a139f32f12 100644 --- a/DQM/SiStripMonitorClient/python/SiStripDQMRecoConfigOfflineGlobalRunCAF_cfi.py +++ b/DQM/SiStripMonitorClient/python/SiStripDQMRecoConfigOfflineGlobalRunCAF_cfi.py @@ -8,19 +8,22 @@ from RecoTracker.TrackProducer.TrackRefitters_cff import * # cosmic track finder # import RecoTracker.TrackProducer.TrackRefitters_cff -cosmictrackfinderP5Refitter = RecoTracker.TrackProducer.TrackRefitters_cff.TrackRefitter.clone() -cosmictrackfinderP5Refitter.src = 'cosmictrackfinderP5' -cosmictrackfinderP5Refitter.TrajectoryInEvent = True +cosmictrackfinderP5Refitter = RecoTracker.TrackProducer.TrackRefitters_cff.TrackRefitter.clone( + src = 'cosmictrackfinderP5', + TrajectoryInEvent = True +) # CTF # import RecoTracker.TrackProducer.TrackRefitters_cff -ctfWithMaterialTracksP5Refitter = RecoTracker.TrackProducer.TrackRefitters_cff.TrackRefitter.clone() -ctfWithMaterialTracksP5Refitter.src = 'ctfWithMaterialTracksP5' -ctfWithMaterialTracksP5Refitter.TrajectoryInEvent = True +ctfWithMaterialTracksP5Refitter = RecoTracker.TrackProducer.TrackRefitters_cff.TrackRefitter.clone( + src = 'ctfWithMaterialTracksP5', + TrajectoryInEvent = True +) # RS # import RecoTracker.TrackProducer.TrackRefitters_cff -rsWithMaterialTracksP5Refitter = RecoTracker.TrackProducer.TrackRefitters_cff.TrackRefitter.clone() -rsWithMaterialTracksP5Refitter.src = 'rsWithMaterialTracksP5' -rsWithMaterialTracksP5Refitter.TrajectoryInEvent = True +rsWithMaterialTracksP5Refitter = RecoTracker.TrackProducer.TrackRefitters_cff.TrackRefitter.clone( + src = 'rsWithMaterialTracksP5', + TrajectoryInEvent = True +) ## Scheduling ## # additional reco needed for running from RAW # diff --git a/DQM/SiStripMonitorClient/python/SiStripDQMSourceConfigOfflineGlobalRunCAF_cfi.py b/DQM/SiStripMonitorClient/python/SiStripDQMSourceConfigOfflineGlobalRunCAF_cfi.py index 7b5c26b44c74f..89ccc2c1f8883 100644 --- a/DQM/SiStripMonitorClient/python/SiStripDQMSourceConfigOfflineGlobalRunCAF_cfi.py +++ b/DQM/SiStripMonitorClient/python/SiStripDQMSourceConfigOfflineGlobalRunCAF_cfi.py @@ -15,68 +15,79 @@ # SiStripMonitoDigi import DQM.SiStripMonitorDigi.SiStripMonitorDigi_cfi -SiStripMonitorDigiCAF = DQM.SiStripMonitorDigi.SiStripMonitorDigi_cfi.SiStripMonitorDigi.clone() -SiStripMonitorDigiCAF.SelectAllDetectors = True +SiStripMonitorDigiCAF = DQM.SiStripMonitorDigi.SiStripMonitorDigi_cfi.SiStripMonitorDigi.clone( + SelectAllDetectors = True +) # SiStripMonitorCluster import DQM.SiStripMonitorCluster.SiStripMonitorCluster_cfi -SiStripMonitorClusterCAF = DQM.SiStripMonitorCluster.SiStripMonitorCluster_cfi.SiStripMonitorCluster.clone() -SiStripMonitorClusterCAF.SelectAllDetectors = True -SiStripMonitorClusterCAF.StripQualityLabel = '' +SiStripMonitorClusterCAF = DQM.SiStripMonitorCluster.SiStripMonitorCluster_cfi.SiStripMonitorCluster.clone( + SelectAllDetectors = True, + StripQualityLabel = '' +) # SiStripMonitorTrack # clone for cosmic track finder import DQM.SiStripMonitorTrack.SiStripMonitorTrack_cfi -SiStripMonitorTrackCAF_cosmicTk = DQM.SiStripMonitorTrack.SiStripMonitorTrack_cfi.SiStripMonitorTrack.clone() -SiStripMonitorTrackCAF_cosmicTk.TrackProducer = 'cosmictrackfinderP5Refitter' -SiStripMonitorTrackCAF_cosmicTk.Mod_On = True +SiStripMonitorTrackCAF_cosmicTk = DQM.SiStripMonitorTrack.SiStripMonitorTrack_cfi.SiStripMonitorTrack.clone( + TrackProducer = 'cosmictrackfinderP5Refitter', + Mod_On = True +) # clone for CTF track finder import DQM.SiStripMonitorTrack.SiStripMonitorTrack_cfi -SiStripMonitorTrackCAF_ckf = DQM.SiStripMonitorTrack.SiStripMonitorTrack_cfi.SiStripMonitorTrack.clone() -SiStripMonitorTrackCAF_ckf.TrackProducer = 'ctfWithMaterialTracksP5Refitter' -SiStripMonitorTrackCAF_ckf.Mod_On = True +SiStripMonitorTrackCAF_ckf = DQM.SiStripMonitorTrack.SiStripMonitorTrack_cfi.SiStripMonitorTrack.clone( + TrackProducer = 'ctfWithMaterialTracksP5Refitter', + Mod_On = True +) # clone for RS track finder import DQM.SiStripMonitorTrack.SiStripMonitorTrack_cfi -SiStripMonitorTrackCAF_rs = DQM.SiStripMonitorTrack.SiStripMonitorTrack_cfi.SiStripMonitorTrack.clone() -SiStripMonitorTrackCAF_rs.TrackProducer = 'rsWithMaterialTracksP5Refitter' -SiStripMonitorTrackCAF_rs.Mod_On = True +SiStripMonitorTrackCAF_rs = DQM.SiStripMonitorTrack.SiStripMonitorTrack_cfi.SiStripMonitorTrack.clone( + TrackProducer = 'rsWithMaterialTracksP5Refitter', + Mod_On = True +) # TrackerMonitorTrack # clone for cosmic track finder import DQM.TrackerMonitorTrack.MonitorTrackResiduals_cfi -MonitorTrackResidualsCAF_cosmicTk = DQM.TrackerMonitorTrack.MonitorTrackResiduals_cfi.MonitorTrackResiduals.clone() -MonitorTrackResidualsCAF_cosmicTk.Tracks = 'cosmictrackfinderP5' -MonitorTrackResidualsCAF_cosmicTk.trajectoryInput = 'cosmictrackfinderP5Refitter' +MonitorTrackResidualsCAF_cosmicTk = DQM.TrackerMonitorTrack.MonitorTrackResiduals_cfi.MonitorTrackResiduals.clone( + Tracks = 'cosmictrackfinderP5', + trajectoryInput = 'cosmictrackfinderP5Refitter' +) # clone for CTF track finder import DQM.TrackerMonitorTrack.MonitorTrackResiduals_cfi -MonitorTrackResidualsCAF_ckf = DQM.TrackerMonitorTrack.MonitorTrackResiduals_cfi.MonitorTrackResiduals.clone() -MonitorTrackResidualsCAF_ckf.Tracks = 'ctfWithMaterialTracksP5' -MonitorTrackResidualsCAF_ckf.trajectoryInput = 'ctfWithMaterialTracksP5Refitter' +MonitorTrackResidualsCAF_ckf = DQM.TrackerMonitorTrack.MonitorTrackResiduals_cfi.MonitorTrackResiduals.clone( + Tracks = 'ctfWithMaterialTracksP5', + trajectoryInput = 'ctfWithMaterialTracksP5Refitter' +) # clone for RS track finder import DQM.TrackerMonitorTrack.MonitorTrackResiduals_cfi -MonitorTrackResidualsCAF_rs = DQM.TrackerMonitorTrack.MonitorTrackResiduals_cfi.MonitorTrackResiduals.clone() -MonitorTrackResidualsCAF_rs.Tracks = 'rsWithMaterialTracksP5' -MonitorTrackResidualsCAF_rs.trajectoryInput = 'rsWithMaterialTracksP5Refitter' +MonitorTrackResidualsCAF_rs = DQM.TrackerMonitorTrack.MonitorTrackResiduals_cfi.MonitorTrackResiduals.clone( + Tracks = 'rsWithMaterialTracksP5', + trajectoryInput = 'rsWithMaterialTracksP5Refitter' +) # TrackingMonitor # clone for cosmic track finder import DQM.TrackingMonitor.TrackerCosmicsTrackingMonitor_cfi -TrackMonCAF_cosmicTk = DQM.TrackingMonitor.TrackerCosmicsTrackingMonitor_cfi.TrackerCosmicTrackMon.clone() -TrackMonCAF_cosmicTk.TrackProducer = 'cosmictrackfinderP5' -TrackMonCAF_cosmicTk.AlgoName = 'CosmicTk' -TrackMonCAF_cosmicTk.FolderName = 'SiStrip/Tracks' +TrackMonCAF_cosmicTk = DQM.TrackingMonitor.TrackerCosmicsTrackingMonitor_cfi.TrackerCosmicTrackMon.clone( + TrackProducer = 'cosmictrackfinderP5', + AlgoName = 'CosmicTk', + FolderName = 'SiStrip/Tracks' +) # clone for CTF track finder import DQM.TrackingMonitor.TrackerCosmicsTrackingMonitor_cfi -TrackMonCAF_ckf = DQM.TrackingMonitor.TrackerCosmicsTrackingMonitor_cfi.TrackerCosmicTrackMon.clone() -TrackMonCAF_ckf.TrackProducer = 'ctfWithMaterialTracksP5' -TrackMonCAF_ckf.AlgoName = 'CKFTk' -TrackMonCAF_ckf.FolderName = 'SiStrip/Tracks' +TrackMonCAF_ckf = DQM.TrackingMonitor.TrackerCosmicsTrackingMonitor_cfi.TrackerCosmicTrackMon.clone( + TrackProducer = 'ctfWithMaterialTracksP5', + AlgoName = 'CKFTk', + FolderName = 'SiStrip/Tracks' +) # clone for RS track finder import DQM.TrackingMonitor.TrackerCosmicsTrackingMonitor_cfi -TrackMonCAF_rs = DQM.TrackingMonitor.TrackerCosmicsTrackingMonitor_cfi.TrackerCosmicTrackMon.clone() -TrackMonCAF_rs.TrackProducer = 'rsWithMaterialTracksP5' -TrackMonCAF_rs.AlgoName = 'RSTk' -TrackMonCAF_rs.FolderName = 'SiStrip/Tracks' +TrackMonCAF_rs = DQM.TrackingMonitor.TrackerCosmicsTrackingMonitor_cfi.TrackerCosmicTrackMon.clone( + TrackProducer = 'rsWithMaterialTracksP5', + AlgoName = 'RSTk', + FolderName = 'SiStrip/Tracks' +) # Scheduling SiStripDQMSourceGlobalRunCAF_fromRAW = cms.Sequence( siStripFEDMonitor ) diff --git a/DQM/SiStripMonitorClient/python/SiStripSourceConfigHVOff_cff.py b/DQM/SiStripMonitorClient/python/SiStripSourceConfigHVOff_cff.py index 8e27b1d09503f..44db99e736953 100644 --- a/DQM/SiStripMonitorClient/python/SiStripSourceConfigHVOff_cff.py +++ b/DQM/SiStripMonitorClient/python/SiStripSourceConfigHVOff_cff.py @@ -1,75 +1,110 @@ # SiStripMonitorDigi #### -import DQM.SiStripMonitorDigi.SiStripMonitorDigi_cfi -SiStripMonitorDigiHVOff = DQM.SiStripMonitorDigi.SiStripMonitorDigi_cfi.SiStripMonitorDigi.clone() -SiStripMonitorDigiHVOff.SelectAllDetectors = True -SiStripMonitorDigiHVOff.Mod_On = False -SiStripMonitorDigiHVOff.TkHistoMap_On = False -SiStripMonitorDigiHVOff.UseDCSFiltering = False - -SiStripMonitorDigiHVOff.TProfTotalNumberOfDigis.subdetswitchon = True -SiStripMonitorDigiHVOff.TProfDigiApvCycle.subdetswitchon = False - -SiStripMonitorDigiHVOff.TH1ADCsCoolestStrip.moduleswitchon = False -SiStripMonitorDigiHVOff.TH1ADCsCoolestStrip.layerswitchon = False - -SiStripMonitorDigiHVOff.TH1ADCsHottestStrip.moduleswitchon = False -SiStripMonitorDigiHVOff.TH1ADCsHottestStrip.layerswitchon = False - -SiStripMonitorDigiHVOff.TH1DigiADCs.moduleswitchon = False -SiStripMonitorDigiHVOff.TH1DigiADCs.layerswitchon = False - -SiStripMonitorDigiHVOff.TH1NumberOfDigis.moduleswitchon = False -SiStripMonitorDigiHVOff.TH1NumberOfDigis.layerswitchon = False - -SiStripMonitorDigiHVOff.TH1StripOccupancy.moduleswitchon = False -SiStripMonitorDigiHVOff.TH1StripOccupancy.layerswitchon = False - +from DQM.SiStripMonitorDigi.SiStripMonitorDigi_cfi import * +SiStripMonitorDigiHVOff = SiStripMonitorDigi.clone( + SelectAllDetectors = True, + Mod_On = False, + TkHistoMap_On = False, + UseDCSFiltering = False, + TProfTotalNumberOfDigis = SiStripMonitorDigi.TProfTotalNumberOfDigis.clone( + subdetswitchon = True + ), + TProfDigiApvCycle = SiStripMonitorDigi.TProfDigiApvCycle.clone( + subdetswitchon = False + ), + TH1ADCsCoolestStrip = SiStripMonitorDigi.TH1ADCsCoolestStrip.clone( + moduleswitchon = False, + layerswitchon = False + ), + TH1ADCsHottestStrip = SiStripMonitorDigi.TH1ADCsHottestStrip.clone( + moduleswitchon = False, + layerswitchon = False + ), + TH1DigiADCs = SiStripMonitorDigi.TH1DigiADCs.clone( + moduleswitchon = False, + layerswitchon = False + ), + TH1NumberOfDigis = SiStripMonitorDigi.TH1NumberOfDigis.clone( + moduleswitchon = False, + layerswitchon = False + ), + TH1StripOccupancy = SiStripMonitorDigi.TH1StripOccupancy.clone( + moduleswitchon = False, + layerswitchon = False + ) +) # SiStripMonitorCluster #### -import DQM.SiStripMonitorCluster.SiStripMonitorCluster_cfi -SiStripMonitorClusterHVOff = DQM.SiStripMonitorCluster.SiStripMonitorCluster_cfi.SiStripMonitorCluster.clone() -SiStripMonitorClusterHVOff.SelectAllDetectors = True -SiStripMonitorClusterHVOff.Mod_On = False -SiStripMonitorClusterHVOff.TkHistoMap_On = False -SiStripMonitorClusterHVOff.TProfTotalNumberOfClusters.subdetswitchon = True -SiStripMonitorClusterHVOff.TProfClustersApvCycle.subdetswitchon = False -SiStripMonitorClusterHVOff.UseDCSFiltering = False - -SiStripMonitorClusterHVOff.TH1ClusterNoise.layerswitchon = False -SiStripMonitorClusterHVOff.TH1ClusterNoise.moduleswitchon = False - -SiStripMonitorClusterHVOff.TH1NrOfClusterizedStrips.layerswitchon = False -SiStripMonitorClusterHVOff.TH1NrOfClusterizedStrips.moduleswitchon = False - -SiStripMonitorClusterHVOff.TH1ClusterPos.layerswitchon = False -SiStripMonitorClusterHVOff.TH1ClusterPos.moduleswitchon = False - -SiStripMonitorClusterHVOff.TH1ClusterDigiPos.layerswitchon = False -SiStripMonitorClusterHVOff.TH1ClusterDigiPos.moduleswitchon = False - -SiStripMonitorClusterHVOff.TH1ModuleLocalOccupancy.layerswitchon = False -SiStripMonitorClusterHVOff.TH1ModuleLocalOccupancy.moduleswitchon = False - -SiStripMonitorClusterHVOff.TH1nClusters.layerswitchon = False -SiStripMonitorClusterHVOff.TH1nClusters.moduleswitchon = False - -SiStripMonitorClusterHVOff.TH1ClusterStoN.layerswitchon = False -SiStripMonitorClusterHVOff.TH1ClusterStoN.moduleswitchon = False - -SiStripMonitorClusterHVOff.TH1ClusterStoNVsPos.layerswitchon = False -SiStripMonitorClusterHVOff.TH1ClusterStoNVsPos.moduleswitchon = False - -SiStripMonitorClusterHVOff.TH1ClusterCharge.layerswitchon = False -SiStripMonitorClusterHVOff.TH1ClusterCharge.moduleswitchon = False - -SiStripMonitorClusterHVOff.TH1ClusterWidth.layerswitchon = False -SiStripMonitorClusterHVOff.TH1ClusterWidth.moduleswitchon = False - -SiStripMonitorClusterHVOff.TProfClustersVsDBxCycle.subdetswitchon = False -SiStripMonitorClusterHVOff.TH2ApvCycleVsDBxGlobal.globalswitchon = False - -SiStripMonitorClusterHVOff.TH2CStripVsCpixel.globalswitchon=True -SiStripMonitorClusterHVOff.TH1MultiplicityRegions.globalswitchon=True -SiStripMonitorClusterHVOff.TH1MainDiagonalPosition.globalswitchon=True -SiStripMonitorClusterHVOff.TH1StripNoise2ApvCycle.globalswitchon=True -SiStripMonitorClusterHVOff.TH1StripNoise3ApvCycle.globalswitchon=True +from DQM.SiStripMonitorCluster.SiStripMonitorCluster_cfi import * +SiStripMonitorClusterHVOff = SiStripMonitorCluster.clone( + SelectAllDetectors = True, + Mod_On = False, + TkHistoMap_On = False, + TProfTotalNumberOfClusters = SiStripMonitorCluster.TProfTotalNumberOfClusters.clone( + subdetswitchon = True + ), + TProfClustersApvCycle = SiStripMonitorCluster.TProfClustersApvCycle.clone( + subdetswitchon = False + ), + UseDCSFiltering = False, + TH1ClusterNoise = SiStripMonitorCluster.TH1ClusterNoise.clone( + layerswitchon = False, + moduleswitchon = False + ), + TH1NrOfClusterizedStrips = SiStripMonitorCluster.TH1NrOfClusterizedStrips.clone( + layerswitchon = False, + moduleswitchon = False + ), + TH1ClusterPos = SiStripMonitorCluster.TH1ClusterPos.clone( + layerswitchon = False, + moduleswitchon = False + ), + TH1ClusterDigiPos = SiStripMonitorCluster.TH1ClusterDigiPos.clone( + layerswitchon = False, + moduleswitchon = False + ), + TH1ModuleLocalOccupancy = SiStripMonitorCluster.TH1ModuleLocalOccupancy.clone( + layerswitchon = False, + moduleswitchon = False + ), + TH1nClusters = SiStripMonitorCluster.TH1nClusters.clone( + layerswitchon = False, + moduleswitchon = False + ), + TH1ClusterStoN = SiStripMonitorCluster.TH1ClusterStoN.clone( + layerswitchon = False, + moduleswitchon = False + ), + TH1ClusterStoNVsPos = SiStripMonitorCluster.TH1ClusterStoNVsPos.clone( + layerswitchon = False, + moduleswitchon = False + ), + TH1ClusterCharge = SiStripMonitorCluster.TH1ClusterCharge.clone( + layerswitchon = False, + moduleswitchon = False + ), + TH1ClusterWidth = SiStripMonitorCluster.TH1ClusterWidth.clone( + layerswitchon = False, + moduleswitchon = False + ), + TProfClustersVsDBxCycle = SiStripMonitorCluster.TProfClustersVsDBxCycle.clone( + subdetswitchon = False + ), + TH2ApvCycleVsDBxGlobal = SiStripMonitorCluster.TH2ApvCycleVsDBxGlobal.clone( + globalswitchon = False + ), + TH2CStripVsCpixel = SiStripMonitorCluster.TH2CStripVsCpixel.clone( + globalswitchon = True + ), + TH1MultiplicityRegions = SiStripMonitorCluster.TH1MultiplicityRegions.clone( + globalswitchon = True + ), + TH1MainDiagonalPosition = SiStripMonitorCluster.TH1MainDiagonalPosition.clone( + globalswitchon = True + ), + TH1StripNoise2ApvCycle = SiStripMonitorCluster.TH1StripNoise2ApvCycle.clone( + globalswitchon = True + ), + TH1StripNoise3ApvCycle = SiStripMonitorCluster.TH1StripNoise3ApvCycle.clone( + globalswitchon = True + ) +) diff --git a/DQM/SiStripMonitorClient/python/SiStripSourceConfigP5_cff.py b/DQM/SiStripMonitorClient/python/SiStripSourceConfigP5_cff.py index 95997c13ccbec..ab39bcf8e9c8d 100644 --- a/DQM/SiStripMonitorClient/python/SiStripSourceConfigP5_cff.py +++ b/DQM/SiStripMonitorClient/python/SiStripSourceConfigP5_cff.py @@ -37,92 +37,129 @@ from DQM.SiStripMonitorDigi.SiStripBaselineValidator_cfi import * # SiStripMonitorCluster #### -import DQM.SiStripMonitorCluster.SiStripMonitorCluster_cfi -SiStripMonitorClusterReal = DQM.SiStripMonitorCluster.SiStripMonitorCluster_cfi.SiStripMonitorCluster.clone() -SiStripMonitorClusterReal.SelectAllDetectors = True -SiStripMonitorClusterReal.TProfTotalNumberOfClusters.subdetswitchon = True -SiStripMonitorClusterReal.TProfClustersApvCycle.subdetswitchon = True -SiStripMonitorClusterReal.TH2CStripVsCpixel.globalswitchon=True -SiStripMonitorClusterReal.TH1MultiplicityRegions.globalswitchon=True -SiStripMonitorClusterReal.TH1MainDiagonalPosition.globalswitchon=True -SiStripMonitorClusterReal.TH1StripNoise2ApvCycle.globalswitchon=True -SiStripMonitorClusterReal.TH1StripNoise3ApvCycle.globalswitchon=True -SiStripMonitorClusterReal.ClusterHisto = True +from DQM.SiStripMonitorCluster.SiStripMonitorCluster_cfi import * +SiStripMonitorClusterReal = SiStripMonitorCluster.clone( + SelectAllDetectors = True, + TProfTotalNumberOfClusters = SiStripMonitorCluster.TProfTotalNumberOfClusters.clone( + subdetswitchon = True + ), + TProfClustersApvCycle = SiStripMonitorCluster.TProfClustersApvCycle.clone( + subdetswitchon = True + ), + TH2CStripVsCpixel = SiStripMonitorCluster.TH2CStripVsCpixel.clone( + globalswitchon = True + ), + TH1MultiplicityRegions = SiStripMonitorCluster.TH1MultiplicityRegions.clone( + globalswitchon = True + ), + TH1MainDiagonalPosition = SiStripMonitorCluster.TH1MainDiagonalPosition.clone( + globalswitchon = True + ), + TH1StripNoise2ApvCycle = SiStripMonitorCluster.TH1StripNoise2ApvCycle.clone( + globalswitchon = True + ), + TH1StripNoise3ApvCycle = SiStripMonitorCluster.TH1StripNoise3ApvCycle.clone( + globalswitchon = True + ), + ClusterHisto = True, + # removing some histograms + TH1NrOfClusterizedStrips = SiStripMonitorCluster.TH1NrOfClusterizedStrips.clone( + moduleswitchon = False + ), + TH1ClusterNoise = SiStripMonitorCluster.TH1ClusterNoise.clone( + moduleswitchon = False + ), + TH1ClusterStoN = SiStripMonitorCluster.TH1ClusterStoN.clone( + moduleswitchon = False + ), + TH1ClusterCharge = SiStripMonitorCluster.TH1ClusterCharge.clone( + moduleswitchon = False + ), + TH1ClusterWidth = SiStripMonitorCluster.TH1ClusterWidth.clone( + moduleswitchon = False + ), + TH1ModuleLocalOccupancy = SiStripMonitorCluster.TH1ModuleLocalOccupancy.clone( + moduleswitchon = False + ), + TH1nClusters = SiStripMonitorCluster.TH1nClusters.clone( + moduleswitchon = False + ), + TH1ClusterPos = SiStripMonitorCluster.TH1ClusterPos.clone( + moduleswitchon = False + ) +) -# removing some histograms -SiStripMonitorClusterReal.TH1NrOfClusterizedStrips.moduleswitchon = False -SiStripMonitorClusterReal.TH1ClusterNoise.moduleswitchon = False -SiStripMonitorClusterReal.TH1ClusterStoN.moduleswitchon = False -SiStripMonitorClusterReal.TH1ClusterCharge.moduleswitchon = False -SiStripMonitorClusterReal.TH1ClusterWidth.moduleswitchon = False -SiStripMonitorClusterReal.TH1ModuleLocalOccupancy.moduleswitchon = False -SiStripMonitorClusterReal.TH1nClusters.moduleswitchon = False -SiStripMonitorClusterReal.TH1ClusterPos.moduleswitchon = False - -# SiStripMonitorTrack #### # Clone for Cosmic Track Finder import DQM.SiStripMonitorTrack.SiStripMonitorTrack_cfi -SiStripMonitorTrack_cosmicTk = DQM.SiStripMonitorTrack.SiStripMonitorTrack_cfi.SiStripMonitorTrack.clone() -SiStripMonitorTrack_cosmicTk.TrackProducer = 'cosmictrackfinderP5' -SiStripMonitorTrack_cosmicTk.Mod_On = False +SiStripMonitorTrack_cosmicTk = DQM.SiStripMonitorTrack.SiStripMonitorTrack_cfi.SiStripMonitorTrack.clone( + TrackProducer = 'cosmictrackfinderP5', + Mod_On = False +) # Clone for CKF Tracks -SiStripMonitorTrack_ckf = DQM.SiStripMonitorTrack.SiStripMonitorTrack_cfi.SiStripMonitorTrack.clone() -SiStripMonitorTrack_ckf.TrackProducer = 'ctfWithMaterialTracksP5' -SiStripMonitorTrack_ckf.Mod_On = False +SiStripMonitorTrack_ckf = DQM.SiStripMonitorTrack.SiStripMonitorTrack_cfi.SiStripMonitorTrack.clone( + TrackProducer = 'ctfWithMaterialTracksP5', + Mod_On = False +) # Clone fir Road Search Tracks -#SiStripMonitorTrack_rs = DQM.SiStripMonitorTrack.SiStripMonitorTrack_cfi.SiStripMonitorTrack.clone() -#SiStripMonitorTrack_rs.TrackProducer = 'rsWithMaterialTracksP5' -#SiStripMonitorTrack_rs.Mod_On = True +# SiStripMonitorTrack_rs = DQM.SiStripMonitorTrack.SiStripMonitorTrack_cfi.SiStripMonitorTrack.clone( +# TrackProducer = 'rsWithMaterialTracksP5', +# Mod_On = True +# ) # Clone for General Tracks (for Collision) SiStripMonitorTrack_gentk = DQM.SiStripMonitorTrack.SiStripMonitorTrack_cfi.SiStripMonitorTrack.clone( - TrackProducer = 'generalTracks', - Mod_On = False + TrackProducer = 'generalTracks', + Mod_On = False ) # Clone for Heavy Ion Tracks (for HI Collisions) -SiStripMonitorTrack_hi = DQM.SiStripMonitorTrack.SiStripMonitorTrack_cfi.SiStripMonitorTrack.clone() -SiStripMonitorTrack_hi.TrackProducer = 'hiGeneralTracks' -SiStripMonitorTrack_hi.Mod_On = True +SiStripMonitorTrack_hi = DQM.SiStripMonitorTrack.SiStripMonitorTrack_cfi.SiStripMonitorTrack.clone( + TrackProducer = 'hiGeneralTracks', + Mod_On = True +) # TrackerMonitorTrack #### # Clone for Cosmic Track Finder -#import DQM.TrackerMonitorTrack.MonitorTrackResiduals_cfi -#MonitorTrackResiduals_cosmicTk = DQM.TrackerMonitorTrack.MonitorTrackResiduals_cfi.MonitorTrackResiduals.clone() -#MonitorTrackResiduals_cosmicTk.Tracks = 'cosmictrackfinderP5' -#MonitorTrackResiduals_cosmicTk.trajectoryInput = 'cosmictrackfinderP5' -#MonitorTrackResiduals_cosmicTk.Mod_On = False +# import DQM.TrackerMonitorTrack.MonitorTrackResiduals_cfi +# MonitorTrackResiduals_cosmicTk = DQM.TrackerMonitorTrack.MonitorTrackResiduals_cfi.MonitorTrackResiduals.clone( +# Tracks = 'cosmictrackfinderP5', +# trajectoryInput = 'cosmictrackfinderP5', +# Mod_On = False +# ) # Clone for CKF Tracks -#import DQM.TrackerMonitorTrack.MonitorTrackResiduals_cfi -#MonitorTrackResiduals_ckf = DQM.TrackerMonitorTrack.MonitorTrackResiduals_cfi.MonitorTrackResiduals.clone() -#MonitorTrackResiduals_ckf.Tracks = 'ctfWithMaterialTracksP5' -#MonitorTrackResiduals_ckf.trajectoryInput = 'ctfWithMaterialTracksP5' -#MonitorTrackResiduals_ckf.Mod_On = False +# import DQM.TrackerMonitorTrack.MonitorTrackResiduals_cfi +# MonitorTrackResiduals_ckf = DQM.TrackerMonitorTrack.MonitorTrackResiduals_cfi.MonitorTrackResiduals.clone( +# Tracks = 'ctfWithMaterialTracksP5', +# trajectoryInput = 'ctfWithMaterialTracksP5', +# Mod_On = False +# ) # Clone for Road Search Tracks -#import DQM.TrackerMonitorTrack.MonitorTrackResiduals_cfi -#MonitorTrackResiduals_rs = DQM.TrackerMonitorTrack.MonitorTrackResiduals_cfi.MonitorTrackResiduals.clone() -#MonitorTrackResiduals_rs.Tracks = 'rsWithMaterialTracksP5' -#MonitorTrackResiduals_rs.trajectoryInput = 'rsWithMaterialTracksP5' -#MonitorTrackResiduals_rs.Mod_On = False +# import DQM.TrackerMonitorTrack.MonitorTrackResiduals_cfi +# MonitorTrackResiduals_rs = DQM.TrackerMonitorTrack.MonitorTrackResiduals_cfi.MonitorTrackResiduals.clone( +# Tracks = 'rsWithMaterialTracksP5', +# trajectoryInput = 'rsWithMaterialTracksP5', +# Mod_On = False +# ) # Clone for General Track (for Collision data) import DQM.TrackerMonitorTrack.MonitorTrackResiduals_cfi MonitorTrackResiduals_gentk = DQM.TrackerMonitorTrack.MonitorTrackResiduals_cfi.MonitorTrackResiduals.clone( - Tracks = 'generalTracks', - trajectoryInput = 'generalTracks', - Mod_On = False + Tracks = 'generalTracks', + trajectoryInput = 'generalTracks', + Mod_On = False ) # Clone for Heavy Ion Tracks (for HI Collisions) -#import DQM.TrackerMonitorTrack.MonitorTrackResiduals_cfi -#MonitorTrackResiduals_hi = DQM.TrackerMonitorTrack.MonitorTrackResiduals_cfi.MonitorTrackResiduals.clone() -#MonitorTrackResiduals_hi.Tracks = 'hiGeneralTracks' -#MonitorTrackResiduals_hi.trajectoryInput = 'hiGeneralTracks' -#MonitorTrackResiduals_hi.Mod_On = False +# import DQM.TrackerMonitorTrack.MonitorTrackResiduals_cfi +# MonitorTrackResiduals_hi = DQM.TrackerMonitorTrack.MonitorTrackResiduals_cfi.MonitorTrackResiduals.clone( +# Tracks = 'hiGeneralTracks', +# trajectoryInput = 'hiGeneralTracks', +# Mod_On = False +# ) # Services needed for TkHistoMap from CalibTracker.SiStripCommon.TkDetMapESProducer_cfi import * diff --git a/DQM/SiStripMonitorClient/python/SiStripSourceConfigTier0_Cosmic_cff.py b/DQM/SiStripMonitorClient/python/SiStripSourceConfigTier0_Cosmic_cff.py index 87823c1a2eafd..efa0cf94a924b 100644 --- a/DQM/SiStripMonitorClient/python/SiStripSourceConfigTier0_Cosmic_cff.py +++ b/DQM/SiStripMonitorClient/python/SiStripSourceConfigTier0_Cosmic_cff.py @@ -60,41 +60,47 @@ # SiStripMonitorTrack #### # Clone for Cosmic Tracks -import DQM.SiStripMonitorTrack.SiStripMonitorTrack_cfi -SiStripMonitorTrack_cosmicTk = DQM.SiStripMonitorTrack.SiStripMonitorTrack_cfi.SiStripMonitorTrack.clone() -SiStripMonitorTrack_cosmicTk.TrackProducer = 'cosmictrackfinderP5' -SiStripMonitorTrack_cosmicTk.Mod_On = False +from DQM.SiStripMonitorTrack.SiStripMonitorTrack_cfi import * +SiStripMonitorTrack_cosmicTk = SiStripMonitorTrack.clone( + TrackProducer = 'cosmictrackfinderP5', + Mod_On = False +) # Clone for CKF Tracks -SiStripMonitorTrack_ckf = DQM.SiStripMonitorTrack.SiStripMonitorTrack_cfi.SiStripMonitorTrack.clone() -SiStripMonitorTrack_ckf.TrackProducer = 'ctfWithMaterialTracksP5' -SiStripMonitorTrack_ckf.Mod_On = False -SiStripMonitorTrack_ckf.TH1nClustersOff.xmax = cms.double(1999.5) +SiStripMonitorTrack_ckf = SiStripMonitorTrack.clone( + TrackProducer = 'ctfWithMaterialTracksP5', + Mod_On = False, + TH1nClustersOff = SiStripMonitorTrack.TH1nClustersOff.clone( + xmax = 1999.5 + ) +) # Clone for Road Search Tracks -#import DQM.SiStripMonitorTrack.SiStripMonitorTrack_cfi -#SiStripMonitorTrack_rs = DQM.SiStripMonitorTrack.SiStripMonitorTrack_cfi.SiStripMonitorTrack.clone() -#SiStripMonitorTrack_rs.TrackProducer = 'rsWithMaterialTracksP5' -#SiStripMonitorTrack_rs.Mod_On = False +# SiStripMonitorTrack_rs = SiStripMonitorTrack.clone( +# TrackProducer = 'rsWithMaterialTracksP5', +# Mod_On = False +# ) # TrackerMonitorTrack #### # Clone for Cosmic Track Finder -import DQM.TrackerMonitorTrack.MonitorTrackResiduals_cfi -MonitorTrackResiduals_cosmicTk = DQM.TrackerMonitorTrack.MonitorTrackResiduals_cfi.MonitorTrackResiduals.clone() -MonitorTrackResiduals_cosmicTk.trajectoryInput = 'cosmictrackfinderP5' -MonitorTrackResiduals_cosmicTk.Tracks = 'cosmictrackfinderP5' -MonitorTrackResiduals_cosmicTk.Mod_On = False +from DQM.TrackerMonitorTrack.MonitorTrackResiduals_cfi import * +MonitorTrackResiduals_cosmicTk = MonitorTrackResiduals.clone( + trajectoryInput = 'cosmictrackfinderP5', + Tracks = 'cosmictrackfinderP5', + Mod_On = False +) # Clone for CKF Tracks -MonitorTrackResiduals_ckf = DQM.TrackerMonitorTrack.MonitorTrackResiduals_cfi.MonitorTrackResiduals.clone() -MonitorTrackResiduals_ckf.trajectoryInput = 'ctfWithMaterialTracksP5' -MonitorTrackResiduals_ckf.Tracks = 'ctfWithMaterialTracksP5' -MonitorTrackResiduals_ckf.Mod_On = False +MonitorTrackResiduals_ckf = MonitorTrackResiduals.clone( + trajectoryInput = 'ctfWithMaterialTracksP5', + Tracks = 'ctfWithMaterialTracksP5', + Mod_On = False +) # Clone for Road Search Tracks -#import DQM.TrackerMonitorTrack.MonitorTrackResiduals_cfi -#MonitorTrackResiduals_rs = DQM.TrackerMonitorTrack.MonitorTrackResiduals_cfi.MonitorTrackResiduals.clone() -#MonitorTrackResiduals_rs.trajectoryInput = 'rsWithMaterialTracksP5' -#MonitorTrackResiduals_rs.Tracks = 'rsWithMaterialTracksP5' -#MonitorTrackResiduals_rs.Mod_On = False +# MonitorTrackResiduals_rs = MonitorTrackResiduals.clone( +# trajectoryInput = 'rsWithMaterialTracksP5', +# Tracks = 'rsWithMaterialTracksP5', +# Mod_On = False +# ) # DQM Services from DQMServices.Core.DQMEDAnalyzer import DQMEDAnalyzer diff --git a/DQM/SiStripMonitorClient/python/SiStripSourceConfigTier0_HeavyIons_cff.py b/DQM/SiStripMonitorClient/python/SiStripSourceConfigTier0_HeavyIons_cff.py index d9b6e0e922800..2753230de035e 100644 --- a/DQM/SiStripMonitorClient/python/SiStripSourceConfigTier0_HeavyIons_cff.py +++ b/DQM/SiStripMonitorClient/python/SiStripSourceConfigTier0_HeavyIons_cff.py @@ -32,18 +32,18 @@ # SiStripMonitorTrack #### import DQM.SiStripMonitorTrack.SiStripMonitorTrack_cfi -SiStripMonitorTrack_hi = DQM.SiStripMonitorTrack.SiStripMonitorTrack_cfi.SiStripMonitorTrack.clone() -SiStripMonitorTrack_hi.TrackProducer = "hiGeneralTracks" -SiStripMonitorTrack_hi.Mod_On = False +SiStripMonitorTrack_hi = DQM.SiStripMonitorTrack.SiStripMonitorTrack_cfi.SiStripMonitorTrack.clone( + TrackProducer = "hiGeneralTracks", + Mod_On = False +) # TrackerMonitorTrack #### import DQM.TrackerMonitorTrack.MonitorTrackResiduals_cfi -MonitorTrackResiduals_hi = DQM.TrackerMonitorTrack.MonitorTrackResiduals_cfi.MonitorTrackResiduals.clone() -MonitorTrackResiduals_hi.Tracks = 'hiGeneralTracks' -MonitorTrackResiduals_hi.trajectoryInput = "hiGeneralTracks" -MonitorTrackResiduals_hi.Mod_On = False - - +MonitorTrackResiduals_hi = DQM.TrackerMonitorTrack.MonitorTrackResiduals_cfi.MonitorTrackResiduals.clone( + Tracks = 'hiGeneralTracks', + trajectoryInput = "hiGeneralTracks", + Mod_On = False +) SiStripDQMTier0_hi = cms.Sequence(APVPhases * consecutiveHEs * siStripFEDCheck * siStripFEDMonitor * diff --git a/DQM/SiStripMonitorClient/python/SiStripSourceConfigTier0_cff.py b/DQM/SiStripMonitorClient/python/SiStripSourceConfigTier0_cff.py index 7b502ad9f831f..2e7fd85237c19 100644 --- a/DQM/SiStripMonitorClient/python/SiStripSourceConfigTier0_cff.py +++ b/DQM/SiStripMonitorClient/python/SiStripSourceConfigTier0_cff.py @@ -37,32 +37,35 @@ # SiStripMonitorCluster #### from DQM.SiStripMonitorCluster.SiStripMonitorCluster_cfi import * -SiStripMonitorClusterBPTX = SiStripMonitorCluster.clone() -SiStripMonitorClusterBPTX.Mod_On = False -SiStripMonitorClusterBPTX.TH1TotalNumberOfClusters.subdetswitchon = True -SiStripMonitorClusterBPTX.TProfClustersApvCycle.subdetswitchon = True -SiStripMonitorClusterBPTX.TProfTotalNumberOfClusters.subdetswitchon = True -SiStripMonitorClusterBPTX.TrendVs10LS = False -SiStripMonitorClusterBPTX.TH2CStripVsCpixel.globalswitchon = True -SiStripMonitorClusterBPTX.TH1MultiplicityRegions.globalswitchon = True -SiStripMonitorClusterBPTX.TH1MainDiagonalPosition.globalswitchon = True -SiStripMonitorClusterBPTX.TH1StripNoise2ApvCycle.globalswitchon = True -SiStripMonitorClusterBPTX.TH1StripNoise3ApvCycle.globalswitchon = True -SiStripMonitorClusterBPTX.ClusterHisto = True -SiStripMonitorClusterBPTX.BPTXfilter = genericTriggerEventFlag4L1bd -SiStripMonitorClusterBPTX.PixelDCSfilter = cms.PSet( - andOr = cms.bool( False ), - dcsInputTag = cms.InputTag( "scalersRawToDigi" ), - dcsPartitions = cms.vint32 ( 28, 29), - andOrDcs = cms.bool( False ), - errorReplyDcs = cms.bool( True ), -) -SiStripMonitorClusterBPTX.StripDCSfilter = cms.PSet( - andOr = cms.bool( False ), - dcsInputTag = cms.InputTag( "scalersRawToDigi" ), - dcsPartitions = cms.vint32 ( 24, 25, 26, 27 ), - andOrDcs = cms.bool( False ), - errorReplyDcs = cms.bool( True ), +SiStripMonitorClusterBPTX = SiStripMonitorCluster.clone( + Mod_On = False, + TH1TotalNumberOfClusters = SiStripMonitorCluster.TH1TotalNumberOfClusters.clone( + subdetswitchon = True + ), + TProfClustersApvCycle = SiStripMonitorCluster.TProfClustersApvCycle.clone( + subdetswitchon = True + ), + TProfTotalNumberOfClusters = SiStripMonitorCluster.TProfTotalNumberOfClusters.clone( + subdetswitchon = True + ), + TrendVs10LS = False, + TH2CStripVsCpixel = SiStripMonitorCluster.TH2CStripVsCpixel.clone( + globalswitchon = True + ), + TH1MultiplicityRegions = SiStripMonitorCluster.TH1MultiplicityRegions.clone( + globalswitchon = True + ), + TH1MainDiagonalPosition = SiStripMonitorCluster.TH1MainDiagonalPosition.clone( + globalswitchon = True + ), + TH1StripNoise2ApvCycle = SiStripMonitorCluster.TH1StripNoise2ApvCycle.clone( + globalswitchon = True + ), + TH1StripNoise3ApvCycle = SiStripMonitorCluster.TH1StripNoise3ApvCycle.clone( + globalswitchon = True + ), + ClusterHisto = True, + BPTXfilter = genericTriggerEventFlag4L1bd ) from Configuration.Eras.Modifier_stage2L1Trigger_cff import stage2L1Trigger @@ -79,37 +82,60 @@ from DQM.SiPixelMonitorTrack.RefitterForPixelDQM import * # Clone for SiStripMonitorTrack for all PDs but Minimum Bias and Jet #### -import DQM.SiStripMonitorTrack.SiStripMonitorTrack_cfi -SiStripMonitorTrackCommon = DQM.SiStripMonitorTrack.SiStripMonitorTrack_cfi.SiStripMonitorTrack.clone() -SiStripMonitorTrackCommon.TrackProducer = 'generalTracks' -SiStripMonitorTrackCommon.Mod_On = False -SiStripMonitorTrackCommon.TH1ClusterCharge.ringView = cms.bool( True ) -SiStripMonitorTrackCommon.TH1ClusterStoNCorr.ringView = cms.bool( True ) -SiStripMonitorTrackCommon.TH1ClusterPos.layerView = cms.bool( False ) -SiStripMonitorTrackCommon.TH1ClusterPos.ringView = cms.bool( True ) +from DQM.SiStripMonitorTrack.SiStripMonitorTrack_cfi import * +SiStripMonitorTrackCommon = SiStripMonitorTrack.clone( + TrackProducer = 'generalTracks', + Mod_On = False, + TH1ClusterCharge = SiStripMonitorTrack.TH1ClusterCharge.clone( + ringView = True + ), + TH1ClusterStoNCorr = SiStripMonitorTrack.TH1ClusterStoNCorr.clone( + ringView = True + ), + TH1ClusterPos = SiStripMonitorTrack.TH1ClusterPos.clone( + layerView = False, + ringView = True + ) +) # Clone for SiStripMonitorTrack for Minimum Bias #### -import DQM.SiStripMonitorTrack.SiStripMonitorTrack_cfi -SiStripMonitorTrackMB = DQM.SiStripMonitorTrack.SiStripMonitorTrack_cfi.SiStripMonitorTrack.clone() -SiStripMonitorTrackMB.TrackProducer = 'generalTracks' -SiStripMonitorTrackMB.Mod_On = False -SiStripMonitorTrackMB.genericTriggerEventPSet = genericTriggerEventFlag4HLTdb -SiStripMonitorTrackMB.TH1ClusterCharge.ringView = cms.bool( True ) -SiStripMonitorTrackMB.TH1ClusterStoNCorr.ringView = cms.bool( True ) +from DQM.SiStripMonitorTrack.SiStripMonitorTrack_cfi import * +SiStripMonitorTrackMB = SiStripMonitorTrack.clone( + TrackProducer = 'generalTracks', + Mod_On = False, + genericTriggerEventPSet = genericTriggerEventFlag4HLTdb, + TH1ClusterCharge = SiStripMonitorTrack.TH1ClusterCharge.clone( + ringView = True + ), + TH1ClusterStoNCorr = SiStripMonitorTrack.TH1ClusterStoNCorr.clone( + ringView = True + ) +) # Clone for SiStripMonitorTrack for Isolated Bunches #### -import DQM.SiStripMonitorTrack.SiStripMonitorTrack_cfi -SiStripMonitorTrackIB = DQM.SiStripMonitorTrack.SiStripMonitorTrack_cfi.SiStripMonitorTrack.clone() -SiStripMonitorTrackIB.TrackProducer = 'generalTracks' -SiStripMonitorTrackIB.Mod_On = False -SiStripMonitorTrackIB.genericTriggerEventPSet = genericTriggerEventFlag4HLTdbIB -SiStripMonitorTrackIB.TH1ClusterCharge.ringView = cms.bool( True ) -SiStripMonitorTrackIB.TH1ClusterStoNCorr.ringView = cms.bool( True ) -SiStripMonitorTrackIB.TkHistoMap_On = cms.bool(False) -SiStripMonitorTrackIB.TH1ClusterNoise.layerView = cms.bool(False) -SiStripMonitorTrackIB.TH1ClusterWidth.layerView = cms.bool(False) -SiStripMonitorTrackIB.TH1ClusterChargePerCM.ringView = cms.bool(False) -SiStripMonitorTrackIB.TopFolderName = cms.string("SiStrip/IsolatedBunches") +from DQM.SiStripMonitorTrack.SiStripMonitorTrack_cfi import * +SiStripMonitorTrackIB = SiStripMonitorTrack.clone( + TrackProducer = 'generalTracks', + Mod_On = False, + genericTriggerEventPSet = genericTriggerEventFlag4HLTdbIB, + TH1ClusterCharge = SiStripMonitorTrack.TH1ClusterCharge.clone( + ringView = True + ), + TH1ClusterStoNCorr = SiStripMonitorTrack.TH1ClusterStoNCorr.clone( + ringView = True + ), + TkHistoMap_On = False, + TH1ClusterNoise = SiStripMonitorTrack.TH1ClusterNoise.clone( + layerView = False + ), + TH1ClusterWidth = SiStripMonitorTrack.TH1ClusterWidth.clone( + layerView = False + ), + TH1ClusterChargePerCM = SiStripMonitorTrack.TH1ClusterChargePerCM.clone( + ringView = False + ), + TopFolderName = "SiStrip/IsolatedBunches" +) ### TrackerMonitorTrack defined and used only for MinimumBias #### from DQM.TrackerMonitorTrack.MonitorTrackResiduals_cfi import * @@ -167,6 +193,3 @@ APVPhases*consecutiveHEs*siStripFEDCheck*siStripFEDMonitor*SiStripMonitorDigi*SiStripMonitorClusterBPTX *SiStripMonitorTrackMB*SiStripMonitorTrackIB*refittedForPixelDQM*MonitorTrackResiduals *dqmInfoSiStrip) - - - diff --git a/DQM/SiStripMonitorClient/python/SiStripSourceConfig_cff.py b/DQM/SiStripMonitorClient/python/SiStripSourceConfig_cff.py index 23ebc7e535c29..e1fdd612b1c90 100644 --- a/DQM/SiStripMonitorClient/python/SiStripSourceConfig_cff.py +++ b/DQM/SiStripMonitorClient/python/SiStripSourceConfig_cff.py @@ -21,67 +21,72 @@ from DQM.SiPixelMonitorTrack.RefitterForPixelDQM import * # On/Off Track Cluster Monitor #### -# Clone for Sim data -import DQM.SiStripMonitorTrack.SiStripMonitorTrack_cfi -SiStripMonitorTrackSim = DQM.SiStripMonitorTrack.SiStripMonitorTrack_cfi.SiStripMonitorTrack.clone() -SiStripMonitorTrackSim.TrackProducer = 'TrackRefitter' -SiStripMonitorTrackSim.TrackLabel = '' -SiStripMonitorTrackSim.Cluster_src = 'siStripClusters' -SiStripMonitorTrackSim.Mod_On = True - -# Clone for Real Data -import DQM.SiStripMonitorTrack.SiStripMonitorTrack_cfi -SiStripMonitorTrackReal = DQM.SiStripMonitorTrack.SiStripMonitorTrack_cfi.SiStripMonitorTrack.clone() -SiStripMonitorTrackReal.TrackProducer = 'ctfWithMaterialTracksP5' -SiStripMonitorTrackReal.TrackLabel = '' -SiStripMonitorTrackReal.Cluster_src = 'siStripClusters' -SiStripMonitorTrackReal.Mod_On = True - -# Clone for Real Data (Collision) -import DQM.SiStripMonitorTrack.SiStripMonitorTrack_cfi -SiStripMonitorTrackColl = DQM.SiStripMonitorTrack.SiStripMonitorTrack_cfi.SiStripMonitorTrack.clone() -SiStripMonitorTrackColl.TrackProducer = 'refittedForPixelDQM' -SiStripMonitorTrackColl.TrackLabel = '' -SiStripMonitorTrackColl.Cluster_src = 'siStripClusters' -SiStripMonitorTrackColl.Mod_On = True - +# Clone for Sim dat +from DQM.SiStripMonitorTrack.SiStripMonitorTrack_cfi import * +SiStripMonitorTrackSim = SiStripMonitorTrack.clone( + TrackProducer = 'TrackRefitter', + TrackLabel = '', + Cluster_src = 'siStripClusters', + Mod_On = True +) + +# Clone for Real Dat +from DQM.SiStripMonitorTrack.SiStripMonitorTrack_cfi import * +SiStripMonitorTrackReal = SiStripMonitorTrack.clone( + TrackProducer = 'ctfWithMaterialTracksP5', + TrackLabel = '', + Cluster_src = 'siStripClusters', + Mod_On = True +) + +# Clone for Real Data (Collision +from DQM.SiStripMonitorTrack.SiStripMonitorTrack_cfi import * +SiStripMonitorTrackColl = SiStripMonitorTrack.clone( + TrackProducer = 'refittedForPixelDQM', + TrackLabel = '', + Cluster_src = 'siStripClusters', + Mod_On = True +) # Residual Monitor #### # Clone for Sim Data -import DQM.TrackerMonitorTrack.MonitorTrackResiduals_cfi -MonitorTrackResidualsSim = DQM.TrackerMonitorTrack.MonitorTrackResiduals_cfi.MonitorTrackResiduals.clone() +from DQM.TrackerMonitorTrack.MonitorTrackResiduals_cfi import * +MonitorTrackResidualsSim = MonitorTrackResiduals.clone() # Clone for Real Data -MonitorTrackResidualsReal = DQM.TrackerMonitorTrack.MonitorTrackResiduals_cfi.MonitorTrackResiduals.clone() -import DQM.TrackerMonitorTrack.MonitorTrackResiduals_cfi -MonitorTrackResidualsReal.Tracks = 'ctfWithMaterialTracksP5' -MonitorTrackResidualsReal.trajectoryInput = 'ctfWithMaterialTracksP5' +MonitorTrackResidualsReal = MonitorTrackResiduals.clone( + Tracks = 'ctfWithMaterialTracksP5', + trajectoryInput = 'ctfWithMaterialTracksP5' +) # Clone for Real Data -MonitorTrackResidualsColl = DQM.TrackerMonitorTrack.MonitorTrackResiduals_cfi.MonitorTrackResiduals.clone() -import DQM.TrackerMonitorTrack.MonitorTrackResiduals_cfi -MonitorTrackResidualsColl.Tracks = 'refittedForPixelDQM' -MonitorTrackResidualsColl.trajectoryInput = 'refittedForPixelDQM' - +MonitorTrackResidualsColl = MonitorTrackResiduals.clone( + Tracks = 'refittedForPixelDQM', + trajectoryInput = 'refittedForPixelDQM' +) # Tracking Monitor #### # Clone for Sim Data -import DQM.TrackingMonitor.TrackingMonitor_cfi -TrackMonSim = DQM.TrackingMonitor.TrackingMonitor_cfi.TrackMon.clone() -TrackMonSim.FolderName = 'Tracking/TrackParameters' +from DQM.TrackingMonitor.TrackingMonitor_cfi import * +TrackMonSim = TrackMon.clone( + FolderName = 'Tracking/TrackParameters' +) + # Clone for Real Data (Cosmic) -import DQM.TrackingMonitor.TrackerCosmicsTrackingMonitor_cfi -TrackMonReal = DQM.TrackingMonitor.TrackerCosmicsTrackingMonitor_cfi.TrackerCosmicTrackMon.clone() -TrackMonReal.TrackProducer = 'ctfWithMaterialTracksP5' -TrackMonReal.FolderName = 'Tracking/TrackParameters' -TrackMonReal.AlgoName = 'CKFTk' -TrackMonReal.doSeedParameterHistos = True +from DQM.TrackingMonitor.TrackerCosmicsTrackingMonitor_cfi import * +TrackMonReal = TrackerCosmicTrackMon.clone( + TrackProducer = 'ctfWithMaterialTracksP5', + FolderName = 'Tracking/TrackParameters', + AlgoName = 'CKFTk', + doSeedParameterHistos = True +) # Clone for Real Data (Collison) -import DQM.TrackingMonitor.TrackingMonitor_cfi -TrackMonColl = DQM.TrackingMonitor.TrackingMonitor_cfi.TrackMon.clone() -TrackMonColl.TrackProducer = 'generalTracks' -TrackMonColl.FolderName = 'Tracking/TrackParameters' -TrackMonColl.AlgoName = 'CKFTk' -TrackMonColl.doSeedParameterHistos = True +from DQM.TrackingMonitor.TrackingMonitor_cfi import * +TrackMonColl = TrackMon.clone( + TrackProducer = 'generalTracks', + FolderName = 'Tracking/TrackParameters', + AlgoName = 'CKFTk', + doSeedParameterHistos = True +) # Sequences #removed modules using TkDetMap service diff --git a/DQM/SiStripMonitorClient/src/SiStripQualityChecker.cc b/DQM/SiStripMonitorClient/src/SiStripQualityChecker.cc index fb3b6885196d6..ac55780183d9f 100644 --- a/DQM/SiStripMonitorClient/src/SiStripQualityChecker.cc +++ b/DQM/SiStripMonitorClient/src/SiStripQualityChecker.cc @@ -230,7 +230,7 @@ void SiStripQualityChecker::fillDetectorStatus(DQMStore& dqm_store, const SiStri continue; dqm_store.cd(dname); ++xbin; - float flag; + float flag = 0; fillSubDetStatus(dqm_store, cabling, local_mes, xbin, flag); global_flag += flag; } diff --git a/DQM/SiStripMonitorClient/src/SiStripTrackerMapCreator.cc b/DQM/SiStripMonitorClient/src/SiStripTrackerMapCreator.cc index d9da603bbc8fc..c31818d04f2ff 100644 --- a/DQM/SiStripMonitorClient/src/SiStripTrackerMapCreator.cc +++ b/DQM/SiStripMonitorClient/src/SiStripTrackerMapCreator.cc @@ -150,6 +150,9 @@ void SiStripTrackerMapCreator::createForOffline(const edm::ParameterSet& tkmapPs << " with range set to 0.0 - 1.0"; trackerMap_->save(true, 0.0, 1.0, map_type + namesuffix + ".svg"); trackerMap_->save(true, 0.0, 1.0, map_type + namesuffix + ".png", 4500, 2400); + // reset the map name to ResidualsMean to restore the + // correct behaviour for the summary file creation + map_type = "ResidualsMean"; } else { edm::LogInfo("TkMapToBeSaved") << "Ready to save TkMap " << map_type << namesuffix << " with range set to " << tkMapMin_ << " - " << tkMapMax_; diff --git a/DQM/SiStripMonitorClient/test/BuildFile.xml b/DQM/SiStripMonitorClient/test/BuildFile.xml new file mode 100644 index 0000000000000..9d51043d4d848 --- /dev/null +++ b/DQM/SiStripMonitorClient/test/BuildFile.xml @@ -0,0 +1,4 @@ + + + + diff --git a/DQM/SiStripMonitorClient/test/TestDriver.cpp b/DQM/SiStripMonitorClient/test/TestDriver.cpp new file mode 100644 index 0000000000000..2f0e0c40064da --- /dev/null +++ b/DQM/SiStripMonitorClient/test/TestDriver.cpp @@ -0,0 +1,2 @@ +#include "FWCore/Utilities/interface/TestHelper.h" +RUNTEST() diff --git a/DQM/SiStripMonitorClient/test/test_SiStripDQM_OfflineTkMap.sh b/DQM/SiStripMonitorClient/test/test_SiStripDQM_OfflineTkMap.sh new file mode 100755 index 0000000000000..8d71811739e19 --- /dev/null +++ b/DQM/SiStripMonitorClient/test/test_SiStripDQM_OfflineTkMap.sh @@ -0,0 +1,14 @@ +#!/bin/bash +function die { echo $1: status $2; exit $2; } +GT=`echo ${@} | python3 -c 'import Configuration.AlCa.autoCond as AC;print(AC.autoCond["run3_data_prompt"])'` +RUN="319176" +DQMFILE="/store/group/comm_dqm/DQMGUI_data/Run2018/ZeroBias/R0003191xx/DQM_V0001_R000319176__ZeroBias__Run2018B-PromptReco-v2__DQMIO.root" +COMMMAND=`xrdfs cms-xrd-global.cern.ch locate $DQMFILE` +STATUS=$? +echo "xrdfs command status = "$STATUS +if [ $STATUS -eq 0 ]; then + echo "Using file ${DQMFILE} and run ${RUN}. Running in ${LOCAL_TEST_DIR}." + (cmsRun "${LOCAL_TEST_DIR}/SiStripDQM_OfflineTkMap_Template_cfg_DB.py" globalTag="$GT" runNumber="$RUN" dqmFile=" root://cms-xrd-global.cern.ch//$DQMFILE" detIdInfoFile="file.root") || die 'failed running SiStripDQM_OfflineTkMap_Template_cfg_DB.py' $? +else + die "SKIPPING test, file ${DQMFILE} not found" 0 +fi diff --git a/DQM/SiStripMonitorCluster/python/SiStripMonitorClusterAlca_cfi.py b/DQM/SiStripMonitorCluster/python/SiStripMonitorClusterAlca_cfi.py index 216aefd93f56d..f5a8025a803f6 100644 --- a/DQM/SiStripMonitorCluster/python/SiStripMonitorClusterAlca_cfi.py +++ b/DQM/SiStripMonitorCluster/python/SiStripMonitorClusterAlca_cfi.py @@ -1,245 +1,232 @@ import FWCore.ParameterSet.Config as cms -import DQM.SiStripMonitorCluster.SiStripMonitorCluster_cfi +from DQM.SiStripMonitorCluster.SiStripMonitorCluster_cfi import * # SiStripMonitorCluster -SiStripCalZeroBiasMonitorCluster = DQM.SiStripMonitorCluster.SiStripMonitorCluster_cfi.SiStripMonitorCluster.clone() - -SiStripCalZeroBiasMonitorCluster.ClusterProducerStrip = cms.InputTag("calZeroBiasClusters") -SiStripCalZeroBiasMonitorCluster.ClusterProducerPix = cms.InputTag('siPixelClusters') - -SiStripCalZeroBiasMonitorCluster.ResetMEsEachRun = cms.bool(False) - -SiStripCalZeroBiasMonitorCluster.StripQualityLabel = cms.string('unbiased') - -SiStripCalZeroBiasMonitorCluster.SelectAllDetectors = cms.bool(True) -SiStripCalZeroBiasMonitorCluster.ShowMechanicalStructureView = cms.bool(True) - -SiStripCalZeroBiasMonitorCluster.ClusterLabel = cms.string('') - -SiStripCalZeroBiasMonitorCluster.TkHistoMap_On = cms.bool(False) - -SiStripCalZeroBiasMonitorCluster.ClusterChTkHistoMap_On = cms.bool(False) - -SiStripCalZeroBiasMonitorCluster.TopFolderName = cms.string('AlcaReco/SiStrip') - -SiStripCalZeroBiasMonitorCluster.BPTXfilter = cms.PSet() -SiStripCalZeroBiasMonitorCluster.PixelDCSfilter = cms.PSet() -SiStripCalZeroBiasMonitorCluster.StripDCSfilter = cms.PSet() - -SiStripCalZeroBiasMonitorCluster.CreateTrendMEs = cms.bool(False) -SiStripCalZeroBiasMonitorCluster.TrendVs10LS = cms.bool(False) -SiStripCalZeroBiasMonitorCluster.TH1ClusterNoise = cms.PSet( - Nbinx = cms.int32(20), - xmin = cms.double(-0.5), - xmax = cms.double(9.5), - layerswitchon = cms.bool(False), - moduleswitchon = cms.bool(False) -) -SiStripCalZeroBiasMonitorCluster.TH1NrOfClusterizedStrips = cms.PSet( - Nbinx = cms.int32(20), - xmin = cms.double(-0.5), - xmax = cms.double(99.5), - layerswitchon = cms.bool(False), - moduleswitchon = cms.bool(False) -) -SiStripCalZeroBiasMonitorCluster.TH1ClusterPos = cms.PSet( - Nbinx = cms.int32(768), - xmin = cms.double(-0.5), - xmax = cms.double(767.5), - layerswitchon = cms.bool(True), - moduleswitchon = cms.bool(False) -) -SiStripCalZeroBiasMonitorCluster.TH1ClusterDigiPos = cms.PSet( - Nbinx = cms.int32(768), - xmin = cms.double(-0.5), - xmax = cms.double(767.5), - layerswitchon = cms.bool(False), - moduleswitchon = cms.bool(True) -) -SiStripCalZeroBiasMonitorCluster.TH1ModuleLocalOccupancy = cms.PSet( - Nbinx = cms.int32(20), - xmin = cms.double(-0.5), - xmax = cms.double(0.95), - layerswitchon = cms.bool(False), - moduleswitchon = cms.bool(False) +SiStripCalZeroBiasMonitorCluster = SiStripMonitorCluster.clone( + ClusterProducerStrip = "calZeroBiasClusters", + ClusterProducerPix = 'siPixelClusters', + ResetMEsEachRun = False, + StripQualityLabel = 'unbiased', + SelectAllDetectors = True, + ShowMechanicalStructureView = True, + ClusterLabel = '', + TkHistoMap_On = False, + ClusterChTkHistoMap_On = False, + TopFolderName = 'AlcaReco/SiStrip', + BPTXfilter = SiStripMonitorCluster.BPTXfilter.clone(), + PixelDCSfilter = SiStripMonitorCluster.PixelDCSfilter.clone(), + StripDCSfilter = SiStripMonitorCluster.StripDCSfilter.clone(), + CreateTrendMEs = False, + TrendVs10LS = False, + TH1ClusterNoise = SiStripMonitorCluster.TH1ClusterNoise.clone( + Nbinx = 20, + xmin = -0.5, + xmax = 9.5, + layerswitchon = False, + moduleswitchon = False + ), + TH1NrOfClusterizedStrips = SiStripMonitorCluster.TH1NrOfClusterizedStrips.clone( + Nbinx = 20, + xmin = -0.5, + xmax = 99.5, + layerswitchon = False, + moduleswitchon = False + ), + TH1ClusterPos = SiStripMonitorCluster.TH1ClusterPos.clone( + Nbinx = 768, + xmin = -0.5, + xmax = 767.5, + layerswitchon = True, + moduleswitchon = False + ), + TH1ClusterDigiPos = SiStripMonitorCluster.TH1ClusterDigiPos.clone( + Nbinx = 768, + xmin = -0.5, + xmax = 767.5, + layerswitchon = False, + moduleswitchon = True + ), + TH1ModuleLocalOccupancy = SiStripMonitorCluster.TH1ModuleLocalOccupancy.clone( + Nbinx = 20, + xmin = -0.5, + xmax = 0.95, + layerswitchon = False, + moduleswitchon = False + ), + TH1nClusters = SiStripMonitorCluster.TH1nClusters.clone( + Nbinx = 11, + xmin = -0.5, + xmax = 10.5, + layerswitchon = False, + moduleswitchon = False + ), + TH1ClusterStoN = SiStripMonitorCluster.TH1ClusterStoN.clone( + Nbinx = 100, + xmin = -0.5, + xmax = 299.5, + layerswitchon = False, + moduleswitchon = False + ), + TH1ClusterStoNVsPos = SiStripMonitorCluster.TH1ClusterStoNVsPos.clone( + Nbinx = 768, + xmin = -0.5, + xmax = 767.5, + Nbiny = 100, + ymin = -0.5, + ymax = 299.5, + layerswitchon = False, + moduleswitchon = False + ), + TH1ClusterCharge = SiStripMonitorCluster.TH1ClusterCharge.clone( + Nbinx = 200, + xmin = -0.5, + xmax = 799.5, + layerswitchon = False, + moduleswitchon = False, + subdetswitchon = True + ), + TH1ClusterWidth = SiStripMonitorCluster.TH1ClusterWidth.clone( + Nbinx = 30, + xmin = -0.5, + xmax = 29.5, + layerswitchon = False, + moduleswitchon = False, + subdetswitchon = True + ), + TProfNumberOfCluster = SiStripMonitorCluster.TProfNumberOfCluster.clone( + Nbinx = 100, + xmin = -0.5, + xmax = 499.5, + layerswitchon = False, + moduleswitchon = False + ), + TProfClusterWidth = SiStripMonitorCluster.TProfClusterWidth.clone( + Nbinx = 100, + xmin = -0.5, + xmax = 499.5, + layerswitchon = False, + moduleswitchon = False + ), + ClusterConditions = SiStripMonitorCluster.ClusterConditions.clone( + minWidth = 0.0, + On = True, + maxStoN = 10000.0, + minStoN = 0.0, + maxWidth = 10000.0 + ), + TProfTotalNumberOfClusters = SiStripMonitorCluster.TProfTotalNumberOfClusters.clone( + subdetswitchon = True + ), + TH1TotalNumberOfClusters = SiStripMonitorCluster.TH1TotalNumberOfClusters.clone( + Nbinx = 500, + xmin = -0.5, + xmax = 19999.5, + subdetswitchon = True + ), + TProfClustersApvCycle = SiStripMonitorCluster.TProfClustersApvCycle.clone( + Nbins = 70, + xmin = -0.5, + xmax = 69.5, + Nbinsy = 200, + ymin = 0.0, + ymax = 0.0, + subdetswitchon = True + ), + TH2ClustersApvCycle = SiStripMonitorCluster.TH2ClustersApvCycle.clone( + Nbinsx = 70, + xmin = -0.5, + xmax = 69.5, + Nbinsy = 400, + ymin = 0.0, + yfactor = 0.01, + subdetswitchon = True + ), + TProfClustersVsDBxCycle = SiStripMonitorCluster.TProfClustersVsDBxCycle.clone( + Nbins = 800, + xmin = 0.5, + xmax = 800.5, + ymin = 0.0, + ymax = 0.0, + subdetswitchon = False + ), + TProf2ApvCycleVsDBx = SiStripMonitorCluster.TProf2ApvCycleVsDBx.clone( + Nbinsx = 70, + xmin = -0.5, + xmax = 69.5, + Nbinsy = 800, + ymin = 0.5, + ymax = 800.5, + zmin = 0.0, + zmax = 0.0, + subdetswitchon = False + ), + TH2ApvCycleVsDBxGlobal = SiStripMonitorCluster.TH2ApvCycleVsDBxGlobal.clone( + Nbinsx = 70, + xmin = -0.5, + xmax = 69.5, + Nbinsy = 800, + ymin = 0.5, + ymax = 800.5, + globalswitchon = False + ), + TH2CStripVsCpixel = SiStripMonitorCluster.TH2CStripVsCpixel.clone( + Nbinsx = 150, + xmin = -0.5, + xmax = 74999.5, + Nbinsy = 50, + ymin = -0.5, + ymax = 14999.5, + globalswitchon = False + ), + MultiplicityRegions = SiStripMonitorCluster.MultiplicityRegions.clone( + k0 = 0.13, # k from linear fit of the diagonal + q0 = 300, # +/- variation of y axis intercept + dk0 = 40, #+/- variation of k0 (in %) to contain the diagonal zone + MaxClus = 20000, #Divide Region 2 and Region 3 + MinPix = 50 # minimum number of Pix clusters to flag events with zero Si clusters + ), + TH1MultiplicityRegions = SiStripMonitorCluster.TH1MultiplicityRegions.clone( + Nbinx = 5, + xmin = 0.5, + xmax = 5.5, + globalswitchon = False + ), + TH1MainDiagonalPosition = SiStripMonitorCluster.TH1MainDiagonalPosition.clone( + Nbinsx = 100, + xmin = 0., + xmax = 2., + globalswitchon = False + ), + # Nunmber of Cluster in Pixel + TH1NClusPx = SiStripMonitorCluster.TH1NClusPx.clone( + Nbinsx = 200, + xmax = 19999.5, + xmin = -0.5 + ), + # Number of Cluster in Strip + TH1NClusStrip = SiStripMonitorCluster.TH1NClusStrip.clone( + Nbinsx = 500, + xmax = 99999.5, + xmin = -0.5 + ), + TH1StripNoise2ApvCycle = SiStripMonitorCluster.TH1StripNoise2ApvCycle.clone( + Nbinsx = 70, + xmin = -0.5, + xmax = 69.5, + globalswitchon = False + ), + TH1StripNoise3ApvCycle = SiStripMonitorCluster.TH1StripNoise3ApvCycle.clone( + Nbinsx = 70, + xmin = -0.5, + xmax = 69.5, + globalswitchon = False + ), + Mod_On = True, + ClusterHisto = False, + HistoryProducer = "consecutiveHEs", + ApvPhaseProducer = "APVPhases", + UseDCSFiltering = True, + ShowControlView = False, + ShowReadoutView = False ) -SiStripCalZeroBiasMonitorCluster.TH1nClusters = cms.PSet( - Nbinx = cms.int32(11), - xmin = cms.double(-0.5), - xmax = cms.double(10.5), - layerswitchon = cms.bool(False), - moduleswitchon = cms.bool(False) -) -SiStripCalZeroBiasMonitorCluster.TH1ClusterStoN = cms.PSet( - Nbinx = cms.int32(100), - xmin = cms.double(-0.5), - xmax = cms.double(299.5), - layerswitchon = cms.bool(False), - moduleswitchon = cms.bool(False) -) -SiStripCalZeroBiasMonitorCluster.TH1ClusterStoNVsPos = cms.PSet( - Nbinx = cms.int32(768), - xmin = cms.double(-0.5), - xmax = cms.double(767.5), - Nbiny = cms.int32(100), - ymin = cms.double(-0.5), - ymax = cms.double(299.5), - layerswitchon = cms.bool(False), - moduleswitchon = cms.bool(False) -) -SiStripCalZeroBiasMonitorCluster.TH1ClusterCharge = cms.PSet( - Nbinx = cms.int32(200), - xmin = cms.double(-0.5), - xmax = cms.double(799.5), - layerswitchon = cms.bool(False), - moduleswitchon = cms.bool(False), - subdetswitchon = cms.bool(True) -) -SiStripCalZeroBiasMonitorCluster.TH1ClusterWidth = cms.PSet( - Nbinx = cms.int32(30), - xmin = cms.double(-0.5), - xmax = cms.double(29.5), - layerswitchon = cms.bool(False), - moduleswitchon = cms.bool(False), - subdetswitchon = cms.bool(True) -) -SiStripCalZeroBiasMonitorCluster.TProfNumberOfCluster = cms.PSet( - Nbinx = cms.int32(100), - xmin = cms.double(-0.5), - xmax = cms.double(499.5), - layerswitchon = cms.bool(False), - moduleswitchon = cms.bool(False) -) -SiStripCalZeroBiasMonitorCluster.TProfClusterWidth = cms.PSet( - Nbinx = cms.int32(100), - xmin = cms.double(-0.5), - xmax = cms.double(499.5), - layerswitchon = cms.bool(False), - moduleswitchon = cms.bool(False) -) -SiStripCalZeroBiasMonitorCluster.ClusterConditions = cms.PSet( - minWidth = cms.double(0.0), - On = cms.bool(True), - maxStoN = cms.double(10000.0), - minStoN = cms.double(0.0), - maxWidth = cms.double(10000.0) -) -SiStripCalZeroBiasMonitorCluster.TProfTotalNumberOfClusters = cms.PSet( - subdetswitchon = cms.bool(True) -) -SiStripCalZeroBiasMonitorCluster.TH1TotalNumberOfClusters = cms.PSet( - Nbinx = cms.int32(500), - xmin = cms.double(-0.5), - xmax = cms.double(19999.5), - subdetswitchon = cms.bool(True) -) -SiStripCalZeroBiasMonitorCluster.TProfClustersApvCycle = cms.PSet( - Nbins = cms.int32(70), - xmin = cms.double(-0.5), - xmax = cms.double(69.5), - Nbinsy = cms.int32(200), - ymin = cms.double(0.0), - ymax = cms.double(0.0), - subdetswitchon = cms.bool(True) - ) -SiStripCalZeroBiasMonitorCluster.TH2ClustersApvCycle = cms.PSet( - Nbinsx = cms.int32(70), - xmin = cms.double(-0.5), - xmax = cms.double(69.5), - Nbinsy = cms.int32(400), - ymin = cms.double(0.0), - yfactor = cms.double(0.01), - subdetswitchon = cms.bool(True) -) -SiStripCalZeroBiasMonitorCluster.TProfClustersVsDBxCycle = cms.PSet( - Nbins = cms.int32(800), - xmin = cms.double(0.5), - xmax = cms.double(800.5), - ymin = cms.double(0.0), - ymax = cms.double(0.0), - subdetswitchon = cms.bool(False) - ) -SiStripCalZeroBiasMonitorCluster.TProf2ApvCycleVsDBx = cms.PSet( - Nbinsx = cms.int32(70), - xmin = cms.double(-0.5), - xmax = cms.double(69.5), - Nbinsy = cms.int32(800), - ymin = cms.double(0.5), - ymax = cms.double(800.5), - zmin = cms.double(0.0), - zmax = cms.double(0.0), - subdetswitchon = cms.bool(False) - ) -SiStripCalZeroBiasMonitorCluster.TH2ApvCycleVsDBxGlobal = cms.PSet( - Nbinsx = cms.int32(70), - xmin = cms.double(-0.5), - xmax = cms.double(69.5), - Nbinsy = cms.int32(800), - ymin = cms.double(0.5), - ymax = cms.double(800.5), - globalswitchon = cms.bool(False) - ) -SiStripCalZeroBiasMonitorCluster.TH2CStripVsCpixel = cms.PSet( - Nbinsx = cms.int32(150), - xmin = cms.double(-0.5), - xmax = cms.double(74999.5), - Nbinsy = cms.int32(50), - ymin = cms.double(-0.5), - ymax = cms.double(14999.5), - globalswitchon = cms.bool(False) - ) -SiStripCalZeroBiasMonitorCluster.MultiplicityRegions = cms.PSet( - k0 = cms.double(0.13), # k from linear fit of the diagonal - q0 = cms.double(300), # +/- variation of y axis intercept - dk0 = cms.double(40), #+/- variation of k0 (in %) to contain the diagonal zone - MaxClus = cms.double(20000), #Divide Region 2 and Region 3 - MinPix = cms.double(50) # minimum number of Pix clusters to flag events with zero Si clusters - ) -SiStripCalZeroBiasMonitorCluster.TH1MultiplicityRegions = cms.PSet( - Nbinx = cms.int32(5), - xmin = cms.double(0.5), - xmax = cms.double(5.5), - globalswitchon = cms.bool(False) - ) -SiStripCalZeroBiasMonitorCluster.TH1MainDiagonalPosition= cms.PSet( - Nbinsx = cms.int32(100), - xmin = cms.double(0.), - xmax = cms.double(2.), - globalswitchon = cms.bool(False) - ) -# Nunmber of Cluster in Pixel -SiStripCalZeroBiasMonitorCluster.TH1NClusPx = cms.PSet( - Nbinsx = cms.int32(200), - xmax = cms.double(19999.5), - xmin = cms.double(-0.5) - ) -# Number of Cluster in Strip -SiStripCalZeroBiasMonitorCluster.TH1NClusStrip = cms.PSet( - Nbinsx = cms.int32(500), - xmax = cms.double(99999.5), - xmin = cms.double(-0.5) - ) -SiStripCalZeroBiasMonitorCluster.TH1StripNoise2ApvCycle = cms.PSet( - Nbinsx = cms.int32(70), - xmin = cms.double(-0.5), - xmax = cms.double(69.5), - globalswitchon = cms.bool(False) - ) -SiStripCalZeroBiasMonitorCluster.TH1StripNoise3ApvCycle = cms.PSet( - Nbinsx = cms.int32(70), - xmin = cms.double(-0.5), - xmax = cms.double(69.5), - globalswitchon = cms.bool(False) - ) -SiStripCalZeroBiasMonitorCluster.Mod_On = cms.bool(True) -SiStripCalZeroBiasMonitorCluster.ClusterHisto = cms.bool(False) - -SiStripCalZeroBiasMonitorCluster.HistoryProducer = cms.InputTag("consecutiveHEs") -SiStripCalZeroBiasMonitorCluster.ApvPhaseProducer = cms.InputTag("APVPhases") - -SiStripCalZeroBiasMonitorCluster.UseDCSFiltering = cms.bool(True) - -SiStripCalZeroBiasMonitorCluster.ShowControlView = cms.bool(False) -SiStripCalZeroBiasMonitorCluster.ShowReadoutView = cms.bool(False) - diff --git a/DQM/SiStripMonitorCluster/python/SiStripMonitorCluster_cfi.py b/DQM/SiStripMonitorCluster/python/SiStripMonitorCluster_cfi.py index 146aa3cd5eb34..656b68f516b80 100644 --- a/DQM/SiStripMonitorCluster/python/SiStripMonitorCluster_cfi.py +++ b/DQM/SiStripMonitorCluster/python/SiStripMonitorCluster_cfi.py @@ -21,9 +21,21 @@ TopFolderName = cms.string('SiStrip'), - BPTXfilter = cms.PSet(), - PixelDCSfilter = cms.PSet(), - StripDCSfilter = cms.PSet(), + BPTXfilter = cms.PSet(), + PixelDCSfilter = cms.PSet( + andOr = cms.bool(False), + dcsInputTag = cms.InputTag("scalersRawToDigi"), + dcsPartitions = cms.vint32(28, 29), + andOrDcs = cms.bool(False), + errorReplyDcs = cms.bool(True) + ), + StripDCSfilter = cms.PSet( + andOr = cms.bool(False), + dcsInputTag = cms.InputTag("scalersRawToDigi"), + dcsPartitions = cms.vint32(24, 25, 26, 27), + andOrDcs = cms.bool(False), + errorReplyDcs = cms.bool(True) + ), CreateTrendMEs = cms.bool(False), TrendVs10LS = cms.bool(False), diff --git a/DQM/SiStripMonitorSummary/python/OnDemandMonitoring_cfi.py b/DQM/SiStripMonitorSummary/python/OnDemandMonitoring_cfi.py index 55905924ef875..ae81b0cc5fd77 100644 --- a/DQM/SiStripMonitorSummary/python/OnDemandMonitoring_cfi.py +++ b/DQM/SiStripMonitorSummary/python/OnDemandMonitoring_cfi.py @@ -1,20 +1,13 @@ import FWCore.ParameterSet.Config as cms +from DQM.SiStripMonitorSummary.SiStripMonitorCommon_cfi import MonitorSiStrip_PSet + OnDemandMonitoring = cms.EDAnalyzer("SiStripMonitorCondDataOnDemandExample", OutputMEsInRootFile = cms.bool(False), OutputFileName = cms.string('SiStripMonitorCondDataOnDemandExample.root'), - - MonitorSiStripPedestal = cms.bool(False), - MonitorSiStripNoise = cms.bool(True), - MonitorSiStripQuality = cms.bool(True), - MonitorSiStripApvGain = cms.bool(False), - MonitorSiStripLorentzAngle = cms.bool(False), - MonitorSiStripBackPlaneCorrection = cms.bool(False), - MonitorSiStripCabling = cms.bool(False), - MonitorSiStripLowThreshold = cms.bool(False), - MonitorSiStripHighThreshold= cms.bool(False) , - + + MonitorSiStrip_PSet = MonitorSiStrip_PSet, FillConditions_PSet = cms.PSet( FolderName_For_QualityAndCabling_SummaryHistos= cms.string("SiStrip/Tracks"), diff --git a/DQM/SiStripMonitorSummary/python/SiStripMonitorCommon_cfi.py b/DQM/SiStripMonitorSummary/python/SiStripMonitorCommon_cfi.py new file mode 100644 index 0000000000000..45cccc1fc9982 --- /dev/null +++ b/DQM/SiStripMonitorSummary/python/SiStripMonitorCommon_cfi.py @@ -0,0 +1,14 @@ +import FWCore.ParameterSet.Config as cms + +MonitorSiStrip_PSet = cms.PSet( + MonitorSiStripPedestal = cms.bool(False), + MonitorSiStripNoise = cms.bool(True), + MonitorSiStripQuality = cms.bool(True), + MonitorSiStripApvGain = cms.bool(False), + MonitorSiStripLorentzAngle = cms.bool(False), + MonitorSiStripBackPlaneCorrection = cms.bool(False), + MonitorSiStripCabling = cms.bool(False), + MonitorSiStripLowThreshold = cms.bool(False), + MonitorSiStripHighThreshold= cms.bool(False), + ) + diff --git a/DQM/SiStripMonitorSummary/python/SiStripMonitorCondDataOffline_cfi.py b/DQM/SiStripMonitorSummary/python/SiStripMonitorCondDataOffline_cfi.py index 9a174da0cb046..66be8cb138d94 100644 --- a/DQM/SiStripMonitorSummary/python/SiStripMonitorCondDataOffline_cfi.py +++ b/DQM/SiStripMonitorSummary/python/SiStripMonitorCondDataOffline_cfi.py @@ -1,20 +1,24 @@ import FWCore.ParameterSet.Config as cms +from DQM.SiStripMonitorSummary.SiStripMonitorCommon_cfi import MonitorSiStrip_PSet + CondDataMonitoring = cms.EDAnalyzer("SiStripMonitorCondData", OutputFileName = cms.string('SiStripMonitorCondData.root'), OutputMEsInRootFile = cms.bool(True), - MonitorSiStripPedestal = cms.bool(True), - MonitorSiStripNoise = cms.bool(True), - MonitorSiStripQuality = cms.bool(True), - MonitorSiStripCabling = cms.bool(True), - MonitorSiStripLowThreshold = cms.bool(True), - MonitorSiStripHighThreshold= cms.bool(True), - MonitorSiStripApvGain = cms.bool(True), - MonitorSiStripLorentzAngle = cms.bool(True), - MonitorSiStripBackPlaneCorrection = cms.bool(True), + MonitorSiStrip_PSet = MonitorSiStrip_PSet.clone( + MonitorSiStripPedestal = True, + MonitorSiStripNoise = True, + MonitorSiStripQuality = True, + MonitorSiStripCabling = True, + MonitorSiStripLowThreshold = True, + MonitorSiStripHighThreshold= True, + MonitorSiStripApvGain = True, + MonitorSiStripLorentzAngle = True, + MonitorSiStripBackPlaneCorrection = True + ), FillConditions_PSet = cms.PSet( FolderName_For_QualityAndCabling_SummaryHistos= cms.string("SiStrip/Tracks"), diff --git a/DQM/SiStripMonitorSummary/python/SiStripMonitorCondDataOnDemandExample_cfi.py b/DQM/SiStripMonitorSummary/python/SiStripMonitorCondDataOnDemandExample_cfi.py index 6a19f0badbf4e..86b2e39440a09 100644 --- a/DQM/SiStripMonitorSummary/python/SiStripMonitorCondDataOnDemandExample_cfi.py +++ b/DQM/SiStripMonitorSummary/python/SiStripMonitorCondDataOnDemandExample_cfi.py @@ -5,22 +5,16 @@ import FWCore.ParameterSet.Config as cms +from DQM.SiStripMonitorSummary.SiStripMonitorCommon_cfi import MonitorSiStrip_PSet + myOnDemandExample = cms.EDAnalyzer("SiStripMonitorCondDataOnDemandExample", OutputMEsInRootFile = cms.bool(True), OutputFileName = cms.string('SiStripMonitorCondDataOnDemandExample.root'), - - MonitorSiStripPedestal = cms.bool(True), - MonitorSiStripNoise = cms.bool(True), - MonitorSiStripQuality = cms.bool(True), - MonitorSiStripApvGain = cms.bool(False), - MonitorSiStripLorentzAngle = cms.bool(False), - MonitorSiStripBackPlaneCorrection = cms.bool(False), - - MonitorSiStripCabling = cms.bool(False), - MonitorSiStripLowThreshold = cms.bool(False), - MonitorSiStripHighThreshold= cms.bool(False) , - + + MonitorSiStrip_PSet = MonitorSiStrip_PSet.clone( + MonitorSiStripPedestal = True + ), FillConditions_PSet = cms.PSet( FolderName_For_QualityAndCabling_SummaryHistos= cms.string("SiStrip/Tracks"), diff --git a/DQM/SiStripMonitorSummary/python/SiStripMonitorCondData_cfi.py b/DQM/SiStripMonitorSummary/python/SiStripMonitorCondData_cfi.py index d14ec5ae59544..196ad73d8976c 100644 --- a/DQM/SiStripMonitorSummary/python/SiStripMonitorCondData_cfi.py +++ b/DQM/SiStripMonitorSummary/python/SiStripMonitorCondData_cfi.py @@ -1,20 +1,24 @@ import FWCore.ParameterSet.Config as cms +from DQM.SiStripMonitorSummary.SiStripMonitorCommon_cfi import MonitorSiStrip_PSet + CondDataMonitoring = cms.EDAnalyzer("SiStripMonitorCondData", OutputFileName = cms.string('SiStripMonitorCondData_MYTEST.root'), OutputMEsInRootFile = cms.bool(True), - MonitorSiStripPedestal = cms.bool(True), - MonitorSiStripNoise = cms.bool(True), - MonitorSiStripQuality = cms.bool(False), - MonitorSiStripCabling = cms.bool(True), - MonitorSiStripLowThreshold = cms.bool(True), - MonitorSiStripHighThreshold= cms.bool(True), - MonitorSiStripApvGain = cms.bool(True), - MonitorSiStripLorentzAngle = cms.bool(True), - MonitorSiStripBackPlaneCorrection = cms.bool(True), + MonitorSiStrip_PSet = MonitorSiStrip_PSet.clone( + MonitorSiStripPedestal = True, + MonitorSiStripNoise = True, + MonitorSiStripQuality = False, + MonitorSiStripCabling = True, + MonitorSiStripLowThreshold = True, + MonitorSiStripHighThreshold= True, + MonitorSiStripApvGain = True, + MonitorSiStripLorentzAngle = True, + MonitorSiStripBackPlaneCorrection = True + ), FillConditions_PSet = cms.PSet( FolderName_For_QualityAndCabling_SummaryHistos= cms.string("SiStrip/Tracks"), diff --git a/DQM/SiStripMonitorSummary/scripts/TemplateCfg21X_PedNoise_cfg.py b/DQM/SiStripMonitorSummary/scripts/TemplateCfg21X_PedNoise_cfg.py index 1b02844fa7f32..7cd049157ab53 100644 --- a/DQM/SiStripMonitorSummary/scripts/TemplateCfg21X_PedNoise_cfg.py +++ b/DQM/SiStripMonitorSummary/scripts/TemplateCfg21X_PedNoise_cfg.py @@ -55,41 +55,39 @@ ) -import CalibTracker.Configuration.Common.PoolDBESSource_cfi -siStripCond = CalibTracker.Configuration.Common.PoolDBESSource_cfi.poolDBESSource.clone() +from CalibTracker.Configuration.Common.PoolDBESSource_cfi import * +siStripCond = poolDBESSource.clone( + toGet = ( + poolDBESSource.toGet[0].clone( + record ='SiStripFedCablingRcd', + tag ='insert_FedCablingTag' + ), + poolDBESSource.toGet[0].clone( + record = 'SiStripNoisesRcd', + tag = 'insert_NoiseTag' + ), + poolDBESSource.toGet[0].clone( + record = 'SiStripPedestalsRcd', + tag = 'insert_PedestalTag' + ), + poolDBESSource.toGet[0].clone( + record = 'SiStripApvGainRcd', + tag = 'SiStripGain_Ideal_21X' + ), + poolDBESSource.toGet[0].clone( + record = 'SiStripLorentzAngleRcd', + tag = 'SiStripLorentzAngle_Ideal_21X' + ), + poolDBESSource.toGet[0].clone( + record = 'SiStripThresholdRcd', + tag = 'insert_ThresholdTag' + ) + ), + connect = 'frontier://cmsfrontier.cern.ch:8000/FrontierProd/insertAccount' +) sistripconn = cms.ESProducer("SiStripConnectivity") -siStripCond.toGet = cms.VPSet( - cms.PSet( - record = cms.string('SiStripFedCablingRcd'), - tag = cms.string('insert_FedCablingTag') - ), - cms.PSet( - record = cms.string('SiStripNoisesRcd'), - tag = cms.string('insert_NoiseTag') - ), - cms.PSet( - record = cms.string('SiStripPedestalsRcd'), - tag = cms.string('insert_PedestalTag') - ), - cms.PSet( - record = cms.string('SiStripApvGainRcd'), - tag = cms.string('SiStripGain_Ideal_21X') - ), - cms.PSet( - record = cms.string('SiStripLorentzAngleRcd'), - tag = cms.string('SiStripLorentzAngle_Ideal_21X') - ), - cms.PSet( - record = cms.string('SiStripThresholdRcd'), - tag = cms.string('insert_ThresholdTag') - )) - - - -siStripCond.connect = 'frontier://cmsfrontier.cern.ch:8000/FrontierProd/insertAccount' - #------------------------------------------------- ## Scheduling diff --git a/DQM/SiStripMonitorSummary/scripts/TemplateCfg21X_Quality_cfg.py b/DQM/SiStripMonitorSummary/scripts/TemplateCfg21X_Quality_cfg.py index 42cca2de36bbc..8bbfdb62b092c 100644 --- a/DQM/SiStripMonitorSummary/scripts/TemplateCfg21X_Quality_cfg.py +++ b/DQM/SiStripMonitorSummary/scripts/TemplateCfg21X_Quality_cfg.py @@ -50,40 +50,38 @@ verbose = cms.untracked.int32(1) ) -import CalibTracker.Configuration.Common.PoolDBESSource_cfi -siStripCond = CalibTracker.Configuration.Common.PoolDBESSource_cfi.poolDBESSource.clone() - -sistripconn = cms.ESProducer("SiStripConnectivity") - -siStripCond.toGet = cms.VPSet( - cms.PSet( - record = cms.string('SiStripFedCablingRcd'), - tag = cms.string('insert_FedCablingTag') - ), - cms.PSet( - record = cms.string('SiStripNoisesRcd'), - tag = cms.string('insert_NoiseTag') - ), - cms.PSet( - record = cms.string('SiStripPedestalsRcd'), - tag = cms.string('insert_PedestalTag') - ), - cms.PSet( - record = cms.string('SiStripApvGainRcd'), - tag = cms.string('SiStripGain_Ideal_21X') +from CalibTracker.Configuration.Common.PoolDBESSource_cfi import * +siStripCond = poolDBESSource.clone( + toGet = ( + poolDBESSource.toGet[0].clone( + record = 'SiStripFedCablingRcd', + tag = 'insert_FedCablingTag' + ), + poolDBESSource.toGet[0].clone( + record = 'SiStripNoisesRcd', + tag = 'insert_NoiseTag' + ), + poolDBESSource.toGet[0].clone( + record = 'SiStripPedestalsRcd', + tag = 'insert_PedestalTag' + ), + poolDBESSource.toGet[0].clone( + record = 'SiStripApvGainRcd', + tag = 'SiStripGain_Ideal_21X' + ), + poolDBESSource.toGet[0].clone( + record = 'SiStripLorentzAngleRcd', + tag = 'SiStripLorentzAngle_Ideal_21X' + ), + poolDBESSource.toGet[0].clone( + record = 'SiStripThresholdRcd', + tag = 'insert_ThresholdTag' + ) ), - cms.PSet( - record = cms.string('SiStripLorentzAngleRcd'), - tag = cms.string('SiStripLorentzAngle_Ideal_21X') - ), - cms.PSet( - record = cms.string('SiStripThresholdRcd'), - tag = cms.string('insert_ThresholdTag') - )) - + connect = 'frontier://cmsfrontier.cern.ch:8000/FrontierProd/insertAccount' +) - -siStripCond.connect = 'frontier://cmsfrontier.cern.ch:8000/FrontierProd/insertAccount' +sistripconn = cms.ESProducer("SiStripConnectivity") process.a = cms.ESSource("PoolDBESSource", appendToDataLabel = cms.string('test'), diff --git a/DQM/SiStripMonitorSummary/src/SiStripClassToMonitorCondData.cc b/DQM/SiStripMonitorSummary/src/SiStripClassToMonitorCondData.cc index 9e050f2adae5e..dd64a6e34b454 100644 --- a/DQM/SiStripMonitorSummary/src/SiStripClassToMonitorCondData.cc +++ b/DQM/SiStripMonitorSummary/src/SiStripClassToMonitorCondData.cc @@ -51,15 +51,17 @@ SiStripClassToMonitorCondData::SiStripClassToMonitorCondData(edm::ParameterSet const& iConfig, edm::ConsumesCollector iC) : conf_(iConfig) { - monitorPedestals_ = iConfig.getParameter("MonitorSiStripPedestal"); - monitorNoises_ = iConfig.getParameter("MonitorSiStripNoise"); - monitorQuality_ = iConfig.getParameter("MonitorSiStripQuality"); - monitorApvGains_ = iConfig.getParameter("MonitorSiStripApvGain"); - monitorLorentzAngle_ = iConfig.getParameter("MonitorSiStripLorentzAngle"); - monitorBackPlaneCorrection_ = iConfig.getParameter("MonitorSiStripBackPlaneCorrection"); - monitorLowThreshold_ = iConfig.getParameter("MonitorSiStripLowThreshold"); - monitorHighThreshold_ = iConfig.getParameter("MonitorSiStripHighThreshold"); - monitorCabling_ = iConfig.getParameter("MonitorSiStripCabling"); + const auto& mPSet = iConfig.getParameter("MonitorSiStrip_PSet"); + monitorPedestals_ = mPSet.getParameter("MonitorSiStripPedestal"); + monitorNoises_ = mPSet.getParameter("MonitorSiStripNoise"); + monitorQuality_ = mPSet.getParameter("MonitorSiStripQuality"); + monitorApvGains_ = mPSet.getParameter("MonitorSiStripApvGain"); + monitorLorentzAngle_ = mPSet.getParameter("MonitorSiStripLorentzAngle"); + monitorBackPlaneCorrection_ = mPSet.getParameter("MonitorSiStripBackPlaneCorrection"); + monitorLowThreshold_ = mPSet.getParameter("MonitorSiStripLowThreshold"); + monitorHighThreshold_ = mPSet.getParameter("MonitorSiStripHighThreshold"); + monitorCabling_ = mPSet.getParameter("MonitorSiStripCabling"); + tkDetMapToken_ = iC.esConsumes(); tTopoToken_ = iC.esConsumes(); if (monitorPedestals_) { diff --git a/DQM/SiTrackerPhase2/python/Phase2TrackerMonitorDigi_cff.py b/DQM/SiTrackerPhase2/python/Phase2TrackerMonitorDigi_cff.py index 665216fcdb789..b76946872d2fc 100644 --- a/DQM/SiTrackerPhase2/python/Phase2TrackerMonitorDigi_cff.py +++ b/DQM/SiTrackerPhase2/python/Phase2TrackerMonitorDigi_cff.py @@ -1,88 +1,98 @@ import FWCore.ParameterSet.Config as cms from DQM.SiTrackerPhase2.Phase2TrackerMonitorDigi_cfi import * +pixDigiMon = digiMon.clone( + PixelPlotFillingFlag = True, + StandAloneClusteriserFlag = False, + TopFolderName = "TrackerPhase2ITDigi", + NumberOfDigisPerDetH = digiMon.NumberOfDigisPerDetH.clone( + Nbins = 500, + xmin = -0.5, + xmax = 999.5, + switch = True + ), + NumberOfClustersPerDetH = digiMon.NumberOfClustersPerDetH.clone( + Nbins = 200, + xmin = 0.0, + xmax = 2000., + switch = True + ), + ChargeXYMapH = digiMon.ChargeXYMapH.clone( + Nxbins = 450, + xmin = 0.5, + xmax = 450.5, + Nybins = 1350, + ymin = 0.5, + ymax = 1350.5, + switch = False + ), + PositionOfDigisPH = digiMon.PositionOfDigisPH.clone( + Nxbins = 675, + xmin = 0.5, + xmax = 1350.5, + Nybins = 225, + ymin = 0.5, + ymax = 450.5, + switch = True + ), + XYPositionMapH = digiMon.XYPositionMapH.clone( + Nxbins = 340, + xmin = -170., + xmax = 170., + Nybins = 340, + ymin = -170., + ymax = 170., + switch = True + ), + RZPositionMapH = digiMon.RZPositionMapH.clone( + Nxbins = 600, + xmin = -3000.0, + xmax = 3000., + Nybins = 280, + ymin = 0., + ymax = 280., + switch = True + ), + ClusterPositionPH = digiMon.ClusterPositionPH.clone( + Nxbins = 960, + xmin = 0.5, + xmax = 960.5, + Nybins = 32, + ymin = 0.5, + ymax = 32.5, + switch = True + ) +) -pixDigiMon = digiMon.clone() -pixDigiMon.PixelPlotFillingFlag = cms.bool(True) -pixDigiMon.StandAloneClusteriserFlag = cms.bool(False) -pixDigiMon.TopFolderName = cms.string("TrackerPhase2ITDigi") -pixDigiMon.NumberOfDigisPerDetH = cms.PSet( - Nbins = cms.int32(500), - xmin = cms.double(-0.5), - xmax = cms.double(999.5), - switch = cms.bool(True)) -pixDigiMon.NumberOfClustersPerDetH = cms.PSet( - Nbins = cms.int32(200), - xmin = cms.double(0.0), - xmax = cms.double(2000.), - switch = cms.bool(True)) -pixDigiMon.ChargeXYMapH = cms.PSet( - Nxbins = cms.int32(450), - xmin = cms.double(0.5), - xmax = cms.double(450.5), - Nybins = cms.int32(1350), - ymin = cms.double(0.5), - ymax = cms.double(1350.5), - switch = cms.bool(False)) -pixDigiMon.PositionOfDigisPH = cms.PSet( - Nxbins = cms.int32(675), - xmin = cms.double(0.5), - xmax = cms.double(1350.5), - Nybins = cms.int32(225), - ymin = cms.double(0.5), - ymax = cms.double(450.5), - switch = cms.bool(True)) -pixDigiMon.XYPositionMapH = cms.PSet( - Nxbins = cms.int32(340), - xmin = cms.double(-170.), - xmax = cms.double(170.), - Nybins = cms.int32(340), - ymin = cms.double(-170.), - ymax = cms.double(170.), - switch = cms.bool(True)) -pixDigiMon.RZPositionMapH = cms.PSet( - Nxbins = cms.int32(600), - xmin = cms.double(-3000.0), - xmax = cms.double(3000.), - Nybins = cms.int32(280), - ymin = cms.double(0.), - ymax = cms.double(280.), - switch = cms.bool(True)) -pixDigiMon.ClusterPositionPH = cms.PSet( - Nxbins = cms.int32(960), - xmin = cms.double(0.5), - xmax = cms.double(960.5), - Nybins = cms.int32(32), - ymin = cms.double(0.5), - ymax = cms.double(32.5), - switch = cms.bool(True)) - - -otDigiMon = digiMon.clone() -otDigiMon.PixelPlotFillingFlag = cms.bool(False) -otDigiMon.StandAloneClusteriserFlag = cms.bool(False) -otDigiMon.TopFolderName = cms.string("TrackerPhase2OTDigi") -otDigiMon.XYPositionMapH = cms.PSet( - Nxbins = cms.int32(250), - xmin = cms.double(-1250.), - xmax = cms.double(1250.), - Nybins = cms.int32(250), - ymin = cms.double(-1250.), - ymax = cms.double(1250.), - switch = cms.bool(True)) -otDigiMon.RZPositionMapH = cms.PSet( - Nxbins = cms.int32(600), - xmin = cms.double(-3000.), - xmax = cms.double(3000.), - Nybins = cms.int32(250), - ymin = cms.double(0.), - ymax = cms.double(1250.), - switch = cms.bool(True)) -otDigiMon.PositionOfDigisSH = cms.PSet( - Nxbins = cms.int32(508), - xmin = cms.double(0.5), - xmax = cms.double(1016.5), - Nybins = cms.int32(2), - ymin = cms.double(0.5), - ymax = cms.double(2.5), - switch = cms.bool(True)) +otDigiMon = digiMon.clone( + PixelPlotFillingFlag = False, + StandAloneClusteriserFlag = False, + TopFolderName = "TrackerPhase2OTDigi", + XYPositionMapH = digiMon.XYPositionMapH.clone( + Nxbins = 250, + xmin = -1250., + xmax = 1250., + Nybins = 250, + ymin = -1250., + ymax = 1250., + switch = True + ), + RZPositionMapH = digiMon.RZPositionMapH.clone( + Nxbins = 600, + xmin = -3000., + xmax = 3000., + Nybins = 250, + ymin = 0., + ymax = 1250., + switch = True + ), + PositionOfDigisSH = digiMon.PositionOfDigisSH.clone( + Nxbins = 508, + xmin = 0.5, + xmax = 1016.5, + Nybins = 2, + ymin = 0.5, + ymax = 2.5, + switch = True + ) +) diff --git a/DQM/TrackerMonitorTrack/python/MonitorTrackResiduals_cff.py b/DQM/TrackerMonitorTrack/python/MonitorTrackResiduals_cff.py index 0f9290526b405..43de17e8dd2b4 100644 --- a/DQM/TrackerMonitorTrack/python/MonitorTrackResiduals_cff.py +++ b/DQM/TrackerMonitorTrack/python/MonitorTrackResiduals_cff.py @@ -9,20 +9,21 @@ # ... but matching for strip stereo should be redone: #ttrhbwor.Matcher = 'StandardMatcher' -import DQM.TrackerMonitorTrack.MonitorTrackResiduals_cfi -MonitorTrackResidualsTier0 = DQM.TrackerMonitorTrack.MonitorTrackResiduals_cfi.MonitorTrackResiduals.clone() -MonitorTrackResidualsTier0.OutputMEsInRootFile = False -MonitorTrackResidualsTier0.Mod_On = False +from DQM.TrackerMonitorTrack.MonitorTrackResiduals_cfi import * +MonitorTrackResidualsTier0 = MonitorTrackResiduals.clone( + OutputMEsInRootFile = False, + Mod_On = False +) -import DQM.TrackerMonitorTrack.MonitorTrackResiduals_cfi -MonitorTrackResidualsDQM = DQM.TrackerMonitorTrack.MonitorTrackResiduals_cfi.MonitorTrackResiduals.clone() -MonitorTrackResidualsDQM.OutputMEsInRootFile = False -MonitorTrackResidualsDQM.Mod_On = True +MonitorTrackResidualsDQM = MonitorTrackResiduals.clone( + OutputMEsInRootFile = False, + Mod_On = True +) -import DQM.TrackerMonitorTrack.MonitorTrackResiduals_cfi -MonitorTrackResidualsStandAlone = DQM.TrackerMonitorTrack.MonitorTrackResiduals_cfi.MonitorTrackResiduals.clone() -MonitorTrackResidualsStandAlone.OutputMEsInRootFile = True -MonitorTrackResidualsStandAlone.Mod_On = False +MonitorTrackResidualsStandAlone = MonitorTrackResiduals.clone( + OutputMEsInRootFile = True, + Mod_On = False +) # Sequences DQMMonitorTrackResidualsTier0 = cms.Sequence(TrackRefitter*MonitorTrackResidualsTier0) diff --git a/DQM/TrackerMonitorTrack/test/monitortrackresiduals_cfg.py b/DQM/TrackerMonitorTrack/test/monitortrackresiduals_cfg.py index 18d7144da3055..4b57adf323a44 100644 --- a/DQM/TrackerMonitorTrack/test/monitortrackresiduals_cfg.py +++ b/DQM/TrackerMonitorTrack/test/monitortrackresiduals_cfg.py @@ -44,21 +44,25 @@ ## Load DBSetup (if needed) ## from Alignment.CommonAlignmentProducer.GlobalPosition_Frontier_DevDB_cff import * -import CalibTracker.Configuration.Common.PoolDBESSource_cfi -trackerAlignment = CalibTracker.Configuration.Common.PoolDBESSource_cfi.poolDBESSource.clone() +from CalibTracker.Configuration.Common.PoolDBESSource_cfi import * +trackerAlignment = poolDBESSource.clone( + connect = 'frontier://FrontierDev/CMS_COND_ALIGNMENT', + toGet = cms.VPSet( + cms.PSet( + record = cms.string('TrackerAlignmentRcd'), + tag = cms.string('Tracker10pbScenario210_mc') + ), + cms.PSet( + record = cms.string('TrackerAlignmentErrorRcd'), + tag = cms.string('Tracker10pbScenarioErrors210_mc') + ) + ) +) from Geometry.TrackerGeometryBuilder.trackerGeometry_cfi import * es_prefer_trackerAlignment = cms.ESPrefer("PoolDBESSource","trackerAlignment") -trackerAlignment.connect = 'frontier://FrontierDev/CMS_COND_ALIGNMENT' -trackerAlignment.toGet = cms.VPSet(cms.PSet( - record = cms.string('TrackerAlignmentRcd'), - tag = cms.string('Tracker10pbScenario210_mc') -), - cms.PSet( - record = cms.string('TrackerAlignmentErrorRcd'), - tag = cms.string('Tracker10pbScenarioErrors210_mc') - )) + # to apply misalignments TrackerDigiGeometryESModule.applyAlignment = True diff --git a/DQM/TrackerRemapper/interface/Phase1PixelMaps.h b/DQM/TrackerRemapper/interface/Phase1PixelMaps.h index 9a22292fb7840..06f46b63ab1fc 100644 --- a/DQM/TrackerRemapper/interface/Phase1PixelMaps.h +++ b/DQM/TrackerRemapper/interface/Phase1PixelMaps.h @@ -80,7 +80,7 @@ class Phase1PixelMaps { // drawing methos void drawBarrelMaps(const std::string& currentHistoName, TCanvas& canvas, const char* drawOption = nullptr); void drawForwardMaps(const std::string& currentHistoName, TCanvas& canvas, const char* drawOption = nullptr); - void drawSummaryMaps(const std::string& currentHistoName, TCanvas& canvas); + void drawSummaryMaps(const std::string& currentHistoName, TCanvas& canvas, const char* drawOption = nullptr); private: Option_t* m_option; diff --git a/DQM/TrackerRemapper/src/Phase1PixelMaps.cc b/DQM/TrackerRemapper/src/Phase1PixelMaps.cc index 8be086c0d678a..96c7a6aa86c9e 100644 --- a/DQM/TrackerRemapper/src/Phase1PixelMaps.cc +++ b/DQM/TrackerRemapper/src/Phase1PixelMaps.cc @@ -393,7 +393,7 @@ void Phase1PixelMaps::drawForwardMaps(const std::string& currentHistoName, TCanv } //============================================================================ -void Phase1PixelMaps::drawSummaryMaps(const std::string& currentHistoName, TCanvas& canvas) { +void Phase1PixelMaps::drawSummaryMaps(const std::string& currentHistoName, TCanvas& canvas, const char* drawOption) { auto found = (std::find(m_knownNames.begin(), m_knownNames.end(), currentHistoName) != m_knownNames.end()); if (!m_isBooked.second || !m_isBooked.first || !found) { @@ -411,7 +411,8 @@ void Phase1PixelMaps::drawSummaryMaps(const std::string& currentHistoName, TCanv pxbTh2PolyBarrelSummary[currentHistoName]->SetMarkerSize(0.5); } pxbTh2PolyBarrelSummary[currentHistoName]->GetZaxis()->SetTitleOffset(1.4); - pxbTh2PolyBarrelSummary[currentHistoName]->Draw(); + pxbTh2PolyBarrelSummary[currentHistoName]->Draw("AL"); + pxbTh2PolyBarrelSummary[currentHistoName]->Draw(fmt::sprintf("%s%ssame", m_option, drawOption).c_str()); canvas.cd(2); adjustCanvasMargins(canvas.cd(2), 0.07, 0.02, 0.01, isText ? 0.05 : 0.15); @@ -420,7 +421,8 @@ void Phase1PixelMaps::drawSummaryMaps(const std::string& currentHistoName, TCanv pxfTh2PolyForwardSummary[currentHistoName]->SetMarkerSize(0.5); } pxfTh2PolyForwardSummary[currentHistoName]->GetZaxis()->SetTitleOffset(1.4); - pxfTh2PolyForwardSummary[currentHistoName]->Draw(); + pxfTh2PolyForwardSummary[currentHistoName]->Draw("AL"); + pxfTh2PolyForwardSummary[currentHistoName]->Draw(fmt::sprintf("%s%ssame", m_option, drawOption).c_str()); } //============================================================================ diff --git a/DQM/TrackerRemapper/src/Phase1PixelROCMaps.cc b/DQM/TrackerRemapper/src/Phase1PixelROCMaps.cc index 105b0d6dbdad6..f803b4f4c6ce3 100644 --- a/DQM/TrackerRemapper/src/Phase1PixelROCMaps.cc +++ b/DQM/TrackerRemapper/src/Phase1PixelROCMaps.cc @@ -645,6 +645,7 @@ void Phase1PixelROCMaps::drawBarrelMaps(TCanvas& canvas, const std::string& text bottomPad->cd(); bottomPad->Divide(2, 2); for (unsigned int lay = 1; lay <= n_layers; lay++) { + h_bpix_maps[lay - 1]->SetStats(false); PixelROCMapHelper::dress_plot(bottomPad, h_bpix_maps[lay - 1].get(), lay, 0, 1, found == std::string::npos); } } @@ -676,6 +677,7 @@ void Phase1PixelROCMaps::drawForwardMaps(TCanvas& canvas, const std::string& tex bottomPad->cd(); bottomPad->Divide(2, 1); for (unsigned int ring = 1; ring <= n_rings; ring++) { + h_fpix_maps[ring - 1]->SetStats(false); PixelROCMapHelper::dress_plot(bottomPad, h_fpix_maps[ring - 1].get(), 0, ring, 1, found == std::string::npos); } } @@ -709,6 +711,7 @@ void Phase1PixelROCMaps::drawMaps(TCanvas& canvas, const std::string& text) // dress the plots for (unsigned int lay = 1; lay <= n_layers; lay++) { + h_bpix_maps[lay - 1]->SetStats(false); PixelROCMapHelper::dress_plot(bottomPad, h_bpix_maps[lay - 1].get(), lay, 0, 1, found == std::string::npos); } @@ -717,6 +720,7 @@ void Phase1PixelROCMaps::drawMaps(TCanvas& canvas, const std::string& text) bottomPad->cd(); for (unsigned int ring = 1; ring <= n_rings; ring++) { + h_fpix_maps[ring - 1]->SetStats(false); PixelROCMapHelper::dress_plot( bottomPad, h_fpix_maps[ring - 1].get(), 0, n_layers + ring, 1, found == std::string::npos); } diff --git a/DQM/TrackerRemapper/src/Phase1PixelSummaryMap.cc b/DQM/TrackerRemapper/src/Phase1PixelSummaryMap.cc index fc3a2f48f3588..d1b2a0846dedd 100644 --- a/DQM/TrackerRemapper/src/Phase1PixelSummaryMap.cc +++ b/DQM/TrackerRemapper/src/Phase1PixelSummaryMap.cc @@ -88,7 +88,8 @@ void Phase1PixelSummaryMap::printTrackerMap(TCanvas& canvas) { canvas.SetBottomMargin(0.02); canvas.SetLeftMargin(0.02); canvas.SetRightMargin(0.14); - m_BaseTrackerMap->Draw("AC COLZ L"); + m_BaseTrackerMap->Draw("AL"); + m_BaseTrackerMap->Draw("AC COLZ0 L SAME"); //### z arrow arrow = TArrow(0.05, 27.0, 0.05, -30.0, 0.02, "|>"); diff --git a/DQM/TrackingMonitor/python/ClientTrackEfficiencySTACosmicMuons_cff.py b/DQM/TrackingMonitor/python/ClientTrackEfficiencySTACosmicMuons_cff.py index 881db697c235c..19deaa7dcba1a 100644 --- a/DQM/TrackingMonitor/python/ClientTrackEfficiencySTACosmicMuons_cff.py +++ b/DQM/TrackingMonitor/python/ClientTrackEfficiencySTACosmicMuons_cff.py @@ -7,8 +7,7 @@ from DQM.TrackingMonitor.TrackEfficiencyClient_cfi import TrackEffClient -ClientTrackEfficiencySTACosmicMuons = TrackEffClient.clone() -ClientTrackEfficiencySTACosmicMuons.FolderName = 'Muons/cosmicMuons' -ClientTrackEfficiencySTACosmicMuons.AlgoName = 'STA' - - +ClientTrackEfficiencySTACosmicMuons = TrackEffClient.clone( + FolderName = 'Muons/cosmicMuons', + AlgoName = 'STA' +) diff --git a/DQM/TrackingMonitor/python/ClientTrackEfficiencyTkTracks_cff.py b/DQM/TrackingMonitor/python/ClientTrackEfficiencyTkTracks_cff.py index ba936d6426799..6ca97ac92400e 100644 --- a/DQM/TrackingMonitor/python/ClientTrackEfficiencyTkTracks_cff.py +++ b/DQM/TrackingMonitor/python/ClientTrackEfficiencyTkTracks_cff.py @@ -7,7 +7,8 @@ from DQM.TrackingMonitor.TrackEfficiencyClient_cfi import TrackEffClient -ClientTrackEfficiencyTkTracks = TrackEffClient.clone() -ClientTrackEfficiencyTkTracks.FolderName = 'Muons/TKTrack' -ClientTrackEfficiencyTkTracks.AlgoName = 'CTF' -ClientTrackEfficiencyTkTracks.trackEfficiency = False +ClientTrackEfficiencyTkTracks = TrackEffClient.clone( + FolderName = 'Muons/TKTrack', + AlgoName = 'CTF', + trackEfficiency = False +) diff --git a/DQM/TrackingMonitor/python/LogMessageMonitor_cff.py b/DQM/TrackingMonitor/python/LogMessageMonitor_cff.py index b1c85084d17cc..8ded4c0f57180 100644 --- a/DQM/TrackingMonitor/python/LogMessageMonitor_cff.py +++ b/DQM/TrackingMonitor/python/LogMessageMonitor_cff.py @@ -1,121 +1,106 @@ import FWCore.ParameterSet.Config as cms -import DQM.TrackingMonitor.LogMessageMonitor_cfi +from DQM.TrackingMonitor.LogMessageMonitor_cfi import * -LocalRecoLogMessageMon = DQM.TrackingMonitor.LogMessageMonitor_cfi.LogMessageMon.clone() -LocalRecoLogMessageMon.pluginsMonName = cms.string ( 'LocalReco' ) -LocalRecoLogMessageMon.modules = cms.vstring( 'siPixelDigis', 'siStripDigis', 'siPixelClusters', 'siStripClusters' ) # siPixelDigis : SiPixelRawToDigi, siStripDigis : SiStripRawToDigi (SiStripRawToDigiUnpacker), siPixelClusters : SiPixelClusterProducer, siStripClusters : SiStripClusterizer -LocalRecoLogMessageMon.categories = cms.vstring( 'SiPixelRawToDigi', 'TooManyErrors', 'TooManyClusters' ) +LocalRecoLogMessageMon = LogMessageMon.clone( + pluginsMonName = 'LocalReco', + modules = ('siPixelDigis', 'siStripDigis', 'siPixelClusters', 'siStripClusters',), # siPixelDigis : SiPixelRawToDigi, siStripDigis : SiStripRawToDigi (SiStripRawToDigiUnpacker), siPixelClusters : SiPixelClusterProducer, siStripClusters : SiStripClusterizer + categories = ('SiPixelRawToDigi', 'TooManyErrors', 'TooManyClusters',) +) # apparentely there are not LogError in RecoLocalTracker/SubCollectionProducers/src/TrackClusterRemover.cc -ClusterizerLogMessageMon = DQM.TrackingMonitor.LogMessageMonitor_cfi.LogMessageMon.clone() -ClusterizerLogMessageMon.pluginsMonName = cms.string ( 'TrackClusterRemover' ) -ClusterizerLogMessageMon.modules = cms.vstring( 'detachedTripletStepClusters', 'lowPtTripletStepClusters', 'pixelPairStepClusters', 'mixedTripletStepClusters', 'pixelLessStepClusters', 'tobTecStepClusters' ) # TrackClusterRemover -ClusterizerLogMessageMon.categories = cms.vstring( ) +ClusterizerLogMessageMon = LogMessageMon.clone( + pluginsMonName = 'TrackClusterRemover', + modules = ('detachedTripletStepClusters', 'lowPtTripletStepClusters', 'pixelPairStepClusters', 'mixedTripletStepClusters', 'pixelLessStepClusters', 'tobTecStepClusters',), # TrackClusterRemover + categories = () +) # initialStepSeeds,lowPtTripletStepSeeds, pixelPairStepSeeds, detachedTripletStepSeeds, : TooManyClusters (SeedGeneratorFromRegionHitsEDProducer), # photonConvTrajSeedFromSingleLeg : (PhotonConversionTrajectorySeedProducerFromSingleLeg) -SeedingLogMessageMon = DQM.TrackingMonitor.LogMessageMonitor_cfi.LogMessageMon.clone() -SeedingLogMessageMon.pluginsMonName = cms.string ( 'Seeding' ) -SeedingLogMessageMon.modules = cms.vstring( 'initialStepSeedsPreSplitting', 'initialStepSeeds', 'detachedTripletStepSeeds', 'lowPtTripletStepSeeds', 'pixelPairStepSeeds', 'mixedTripletStepSeedsA', 'mixedTripletStepSeedsB', 'pixelLessStepSeeds', 'tobTecStepSeeds', 'jetCoreRegionalStepSeeds', 'muonSeededSeedsOutIn', 'muonSeededSeedsInOut', 'photonConvTrajSeedFromSingleLeg') -SeedingLogMessageMon.categories = cms.vstring( 'TooManyClusters', 'TooManyPairs', 'TooManyTriplets', 'TooManySeeds' ) +SeedingLogMessageMon = LogMessageMon.clone( + pluginsMonName = 'Seeding', + modules = ('initialStepSeedsPreSplitting', 'initialStepSeeds', 'detachedTripletStepSeeds', 'lowPtTripletStepSeeds', 'pixelPairStepSeeds', 'mixedTripletStepSeedsA', 'mixedTripletStepSeedsB', 'pixelLessStepSeeds', 'tobTecStepSeeds', 'jetCoreRegionalStepSeeds', 'muonSeededSeedsOutIn', 'muonSeededSeedsInOut', 'photonConvTrajSeedFromSingleLeg',), + categories = ('TooManyClusters', 'TooManyPairs', 'TooManyTriplets', 'TooManySeeds',) +) # RecoTracker/CkfPattern/src/CkfTrackCandidateMakerBase.cc -TrackCandidateLogMessageMon = DQM.TrackingMonitor.LogMessageMonitor_cfi.LogMessageMon.clone() -TrackCandidateLogMessageMon.pluginsMonName = cms.string ( 'TrackCandidate' ) -TrackCandidateLogMessageMon.modules = cms.vstring( 'initialStepTrackCandidatesPreSplitting', 'initialStepTrackCandidates', 'detachedTripletStepTrackCandidates', 'lowPtTripletStepTrackCandidates', 'pixelPairStepTrackCandidates', 'mixedTripletStepTrackCandidates', 'pixelLessStepTrackCandidates', 'tobTecStepTrackCandidates', 'jetCoreRegionalStepTrackCandidates', 'muonSeededTrackCandidatesInOut', 'muonSeededTrackCandidatesOutIn', 'convTrackCandidates' ) -TrackCandidateLogMessageMon.categories = cms.vstring( 'TooManySeeds' ) +TrackCandidateLogMessageMon = LogMessageMon.clone( + pluginsMonName = 'TrackCandidate', + modules = ('initialStepTrackCandidatesPreSplitting', 'initialStepTrackCandidates', 'detachedTripletStepTrackCandidates', 'lowPtTripletStepTrackCandidates', 'pixelPairStepTrackCandidates', 'mixedTripletStepTrackCandidates', 'pixelLessStepTrackCandidates', 'tobTecStepTrackCandidates', 'jetCoreRegionalStepTrackCandidates', 'muonSeededTrackCandidatesInOut', 'muonSeededTrackCandidatesOutIn', 'convTrackCandidates',), + categories = ('TooManySeeds',) +) # TrackProducer:FailedPropagation -TrackFinderLogMessageMon = DQM.TrackingMonitor.LogMessageMonitor_cfi.LogMessageMon.clone() -TrackFinderLogMessageMon.pluginsMonName = cms.string ( 'TrackFinder' ) -TrackFinderLogMessageMon.modules = cms.vstring( 'pixelTracks', 'initialStepTracks', 'lowPtTripletStepTracks', 'pixelPairStepTracks', 'detachedTripletStepTracks', 'mixedTripletStepTracks', 'pixelLessStepTracks', 'tobTecStepTracks', 'jetCoreRegionalStepTracks', 'muonSeededTracksOutIn', 'muonSeededTracksInOut', 'convStepTracks', 'generalTracks' ) -TrackFinderLogMessageMon.categories = cms.vstring( - 'FailedPropagation', 'RKPropagatorInS' +TrackFinderLogMessageMon = LogMessageMon.clone( + pluginsMonName = 'TrackFinder', + modules = ('pixelTracks', 'initialStepTracks', 'lowPtTripletStepTracks', 'pixelPairStepTracks', 'detachedTripletStepTracks', 'mixedTripletStepTracks', 'pixelLessStepTracks', 'tobTecStepTracks', 'jetCoreRegionalStepTracks', 'muonSeededTracksOutIn', 'muonSeededTracksInOut', 'convStepTracks', 'generalTracks',), + categories = ('FailedPropagation', 'RKPropagatorInS',) ) -FullIterTrackingLogMessageMon = DQM.TrackingMonitor.LogMessageMonitor_cfi.LogMessageMon.clone() -FullIterTrackingLogMessageMon.pluginsMonName = cms.string ( 'FullIterTracking' ) -FullIterTrackingLogMessageMon.modules = cms.vstring( - 'initialStepSeeds_iter0', - 'initialStepTrackCandidates_iter0', - 'initialStepTracks_iter0', - 'lowPtTripletStepSeeds_iter1', - 'lowPtTripletStepTrackCandidates_iter1', - 'lowPtTripletStepTracks_iter1', - 'pixelPairStepSeeds_iter2', - 'pixelPairStepTrackCandidates_iter2', - 'pixelPairStepTracks_iter2', - 'detachedTripletStepSeeds_iter3', - 'detachedTripletStepTrackCandidates_iter3', - 'detachedTripletStepTracks_iter3', - 'mixedTripletStepSeedsA_iter4', - 'mixedTripletStepSeedsB_iter4', - 'mixedTripletStepTrackCandidates_iter4', - 'mixedTripletStepTracks_iter4', - 'pixelLessStepSeeds_iter5', - 'pixelLessStepTrackCandidates_iter5', - 'pixelLessStepTracks_iter5', - 'tobTecStepSeeds_iter6', - 'tobTecStepTrackCandidates_iter6', - 'tobTecStepTracks_iter6', - 'photonConvTrajSeedFromSingleLeg', - 'convTrackCandidates', - 'convStepTracks', +FullIterTrackingLogMessageMon = LogMessageMon.clone( + pluginsMonName = 'FullIterTracking', + modules = ( + 'initialStepSeeds_iter0', + 'initialStepTrackCandidates_iter0', + 'initialStepTracks_iter0', + 'lowPtTripletStepSeeds_iter1', + 'lowPtTripletStepTrackCandidates_iter1', + 'lowPtTripletStepTracks_iter1', + 'pixelPairStepSeeds_iter2', + 'pixelPairStepTrackCandidates_iter2', + 'pixelPairStepTracks_iter2', + 'detachedTripletStepSeeds_iter3', + 'detachedTripletStepTrackCandidates_iter3', + 'detachedTripletStepTracks_iter3', + 'mixedTripletStepSeedsA_iter4', + 'mixedTripletStepSeedsB_iter4', + 'mixedTripletStepTrackCandidates_iter4', + 'mixedTripletStepTracks_iter4', + 'pixelLessStepSeeds_iter5', + 'pixelLessStepTrackCandidates_iter5', + 'pixelLessStepTracks_iter5', + 'tobTecStepSeeds_iter6', + 'tobTecStepTrackCandidates_iter6', + 'tobTecStepTracks_iter6', + 'photonConvTrajSeedFromSingleLeg', + 'convTrackCandidates', + 'convStepTracks', + ), + categories = ('TooManyClusters', 'TooManyPairs', 'TooManyTriplets', 'TooManySeeds',) ) -FullIterTrackingLogMessageMon.categories = cms.vstring( - 'TooManyClusters', - 'TooManyPairs', - 'TooManyTriplets', - 'TooManySeeds', -) -IterTrackingLogMessageMon = DQM.TrackingMonitor.LogMessageMonitor_cfi.LogMessageMon.clone() -IterTrackingLogMessageMon.pluginsMonName = cms.string ( 'IterTracking' ) -IterTrackingLogMessageMon.modules = cms.vstring( - 'initialStepSeeds_iter0', - 'initialStepTrackCandidates_iter0', - 'initialStepTracks_iter0', - 'lowPtTripletStepSeeds_iter1', - 'lowPtTripletStepTrackCandidates_iter1', - 'lowPtTripletStepTracks_iter1', - 'pixelPairStepSeeds_iter2', - 'pixelPairStepTrackCandidates_iter2', - 'pixelPairStepTracks_iter2', - 'detachedTripletStepSeeds_iter3', - 'detachedTripletStepTrackCandidates_iter3', - 'detachedTripletStepTracks_iter3', - 'mixedTripletStepSeedsA_iter4', - 'mixedTripletStepSeedsB_iter4', - 'mixedTripletStepTrackCandidates_iter4', - 'mixedTripletStepTracks_iter4', - 'pixelLessStepSeeds_iter5', - 'pixelLessStepTrackCandidates_iter5', - 'pixelLessStepTracks_iter5', - 'tobTecStepSeeds_iter6', - 'tobTecStepTrackCandidates_iter6', - 'tobTecStepTracks_iter6', +IterTrackingLogMessageMon = LogMessageMon.clone( + pluginsMonName = 'IterTracking', + modules = ( + 'initialStepSeeds_iter0', + 'initialStepTrackCandidates_iter0', + 'initialStepTracks_iter0', + 'lowPtTripletStepSeeds_iter1', + 'lowPtTripletStepTrackCandidates_iter1', + 'lowPtTripletStepTracks_iter1', + 'pixelPairStepSeeds_iter2', + 'pixelPairStepTrackCandidates_iter2', + 'pixelPairStepTracks_iter2', + 'detachedTripletStepSeeds_iter3', + 'detachedTripletStepTrackCandidates_iter3', + 'detachedTripletStepTracks_iter3', + 'mixedTripletStepSeedsA_iter4', + 'mixedTripletStepSeedsB_iter4', + 'mixedTripletStepTrackCandidates_iter4', + 'mixedTripletStepTracks_iter4', + 'pixelLessStepSeeds_iter5', + 'pixelLessStepTrackCandidates_iter5', + 'pixelLessStepTracks_iter5', + 'tobTecStepSeeds_iter6', + 'tobTecStepTrackCandidates_iter6', + 'tobTecStepTracks_iter6', + ), + categories = ('TooManyClusters', 'TooManyPairs', 'TooManyTriplets', 'TooManySeeds',) ) -IterTrackingLogMessageMon.categories = cms.vstring( - 'TooManyClusters', - 'TooManyPairs', - 'TooManyTriplets', - 'TooManySeeds', -) - -ConversionLogMessageMon = DQM.TrackingMonitor.LogMessageMonitor_cfi.LogMessageMon.clone() -ConversionLogMessageMon.pluginsMonName = cms.string ( 'Conversion' ) -ConversionLogMessageMon.modules = cms.vstring( - 'photonConvTrajSeedFromSingleLeg', - 'convTrackCandidates', - 'convStepTracks', -) -ConversionLogMessageMon.categories = cms.vstring( - 'TooManyClusters', - 'TooManyPairs', - 'TooManyTriplets', - 'TooManySeeds', +ConversionLogMessageMon = LogMessageMon.clone( + pluginsMonName = 'Conversion', + modules = ('photonConvTrajSeedFromSingleLeg', 'convTrackCandidates', 'convStepTracks',), + categories = ('TooManyClusters', 'TooManyPairs', 'TooManyTriplets', 'TooManySeeds',) ) - diff --git a/DQM/TrackingMonitor/python/MonitorTrackEfficiencySTACosmicMuons_cff.py b/DQM/TrackingMonitor/python/MonitorTrackEfficiencySTACosmicMuons_cff.py index 609e325d90e72..6a7b6bfd8e7f1 100644 --- a/DQM/TrackingMonitor/python/MonitorTrackEfficiencySTACosmicMuons_cff.py +++ b/DQM/TrackingMonitor/python/MonitorTrackEfficiencySTACosmicMuons_cff.py @@ -7,10 +7,10 @@ from DQM.TrackingMonitor.TrackEfficiencyMonitor_cfi import TrackEffMon -MonitorTrackEfficiencySTACosmicMuons = TrackEffMon.clone() -MonitorTrackEfficiencySTACosmicMuons.TKTrackCollection = 'ctfWithMaterialTracksP5' -MonitorTrackEfficiencySTACosmicMuons.STATrackCollection = 'cosmicMuons' -MonitorTrackEfficiencySTACosmicMuons.FolderName = 'Muons/cosmicMuons' -MonitorTrackEfficiencySTACosmicMuons.AlgoName = 'STA' - - +MonitorTrackEfficiencySTACosmicMuons = TrackEffMon.clone( + TKTrackCollection = 'ctfWithMaterialTracksP5', + STATrackCollection = 'cosmicMuons', + FolderName = 'Muons/cosmicMuons', + AlgoName = 'STA' +) + diff --git a/DQM/TrackingMonitor/python/MonitorTrackEfficiencyTkTracks_cff.py b/DQM/TrackingMonitor/python/MonitorTrackEfficiencyTkTracks_cff.py index 4b0a11b847e74..41d13df8d4a20 100644 --- a/DQM/TrackingMonitor/python/MonitorTrackEfficiencyTkTracks_cff.py +++ b/DQM/TrackingMonitor/python/MonitorTrackEfficiencyTkTracks_cff.py @@ -7,9 +7,10 @@ from DQM.TrackingMonitor.TrackEfficiencyMonitor_cfi import TrackEffMon -MonitorTrackEfficiencyTkTracks = TrackEffMon.clone() -MonitorTrackEfficiencyTkTracks.TKTrackCollection = 'ctfWithMaterialTracksP5' -MonitorTrackEfficiencyTkTracks.STATrackCollection = 'cosmicMuons' -MonitorTrackEfficiencyTkTracks.FolderName = 'Muons/TKTrack' -MonitorTrackEfficiencyTkTracks.AlgoName = 'CTF' -MonitorTrackEfficiencyTkTracks.trackEfficiency = False +MonitorTrackEfficiencyTkTracks = TrackEffMon.clone( + TKTrackCollection = 'ctfWithMaterialTracksP5', + STATrackCollection = 'cosmicMuons', + FolderName = 'Muons/TKTrack', + AlgoName = 'CTF', + trackEfficiency = False +) diff --git a/DQM/TrackingMonitor/python/MonitorTrackGLBCosmicMuons_cfi.py b/DQM/TrackingMonitor/python/MonitorTrackGLBCosmicMuons_cfi.py index 71371b8a3ebdc..9ee8fb7c765fb 100644 --- a/DQM/TrackingMonitor/python/MonitorTrackGLBCosmicMuons_cfi.py +++ b/DQM/TrackingMonitor/python/MonitorTrackGLBCosmicMuons_cfi.py @@ -1,13 +1,14 @@ import FWCore.ParameterSet.Config as cms -import DQM.TrackingMonitor.TrackingMonitor_cfi -MonitorTrackGLBCosmicMuons = DQM.TrackingMonitor.TrackingMonitor_cfi.TrackMon.clone() -MonitorTrackGLBCosmicMuons.TrackProducer = 'globalCosmicMuons' -MonitorTrackGLBCosmicMuons.AlgoName = 'glb' -MonitorTrackGLBCosmicMuons.FolderName = 'Muons/globalCosmicMuons' -MonitorTrackGLBCosmicMuons.doBeamSpotPlots = False -MonitorTrackGLBCosmicMuons.BSFolderName = 'Muons/globalCosmicMuons/BeamSpotParameters' -MonitorTrackGLBCosmicMuons.doSeedParameterHistos = False -MonitorTrackGLBCosmicMuons.doAllPlots = False -MonitorTrackGLBCosmicMuons.doHitPropertiesPlots = True -MonitorTrackGLBCosmicMuons.doGeneralPropertiesPlots = True +from DQM.TrackingMonitor.TrackingMonitor_cfi import * +MonitorTrackGLBCosmicMuons = TrackMon.clone( + TrackProducer = 'globalCosmicMuons', + AlgoName = 'glb', + FolderName = 'Muons/globalCosmicMuons', + doBeamSpotPlots = False, + BSFolderName = 'Muons/globalCosmicMuons/BeamSpotParameters', + doSeedParameterHistos = False, + doAllPlots = False, + doHitPropertiesPlots = True, + doGeneralPropertiesPlots = True, +) diff --git a/DQM/TrackingMonitor/python/MonitorTrackGLBMuons_cfi.py b/DQM/TrackingMonitor/python/MonitorTrackGLBMuons_cfi.py index 875fa84c46416..49916346484b4 100644 --- a/DQM/TrackingMonitor/python/MonitorTrackGLBMuons_cfi.py +++ b/DQM/TrackingMonitor/python/MonitorTrackGLBMuons_cfi.py @@ -1,22 +1,23 @@ import FWCore.ParameterSet.Config as cms -import DQM.TrackingMonitor.TrackingMonitor_cfi -MonitorTrackGLBMuons = DQM.TrackingMonitor.TrackingMonitor_cfi.TrackMon.clone() -MonitorTrackGLBMuons.TrackProducer = 'globalMuons' -MonitorTrackGLBMuons.AlgoName = 'glb' -MonitorTrackGLBMuons.FolderName = 'Muons/globalMuons' -MonitorTrackGLBMuons.doBeamSpotPlots = False -MonitorTrackGLBMuons.BSFolderName = 'Muons/globalCosmicMuons/BeamSpotParameters' -MonitorTrackGLBMuons.doSeedParameterHistos = False -MonitorTrackGLBMuons.doProfilesVsLS = True -MonitorTrackGLBMuons.doAllPlots = False -MonitorTrackGLBMuons.doGeneralPropertiesPlots = True -MonitorTrackGLBMuons.doHitPropertiesPlots = True -MonitorTrackGLBMuons.doTrackerSpecific = True -MonitorTrackGLBMuons.doDCAPlots = True -MonitorTrackGLBMuons.doDCAwrtPVPlots = True -MonitorTrackGLBMuons.doDCAwrt000Plots = False -MonitorTrackGLBMuons.doSIPPlots = True -MonitorTrackGLBMuons.doEffFromHitPatternVsPU = True -MonitorTrackGLBMuons.doEffFromHitPatternVsBX = False -MonitorTrackGLBMuons.doEffFromHitPatternVsLUMI = cms.bool(True) +from DQM.TrackingMonitor.TrackingMonitor_cfi import * +MonitorTrackGLBMuons = TrackMon.clone( + TrackProducer = 'globalMuons', + AlgoName = 'glb', + FolderName = 'Muons/globalMuons', + doBeamSpotPlots = False, + BSFolderName = 'Muons/globalCosmicMuons/BeamSpotParameters', + doSeedParameterHistos = False, + doProfilesVsLS = True, + doAllPlots = False, + doGeneralPropertiesPlots = True, + doHitPropertiesPlots = True, + doTrackerSpecific = True, + doDCAPlots = True, + doDCAwrtPVPlots = True, + doDCAwrt000Plots = False, + doSIPPlots = True, + doEffFromHitPatternVsPU = True, + doEffFromHitPatternVsBX = False, + doEffFromHitPatternVsLUMI = True +) diff --git a/DQM/TrackingMonitor/python/MonitorTrackInnerTrackMuons_cff.py b/DQM/TrackingMonitor/python/MonitorTrackInnerTrackMuons_cff.py index c9177af606be1..e82b0282fd572 100644 --- a/DQM/TrackingMonitor/python/MonitorTrackInnerTrackMuons_cff.py +++ b/DQM/TrackingMonitor/python/MonitorTrackInnerTrackMuons_cff.py @@ -15,49 +15,49 @@ ) -import SimMuon.MCTruth.MuonTrackProducer_cfi -muonInnerTrack = SimMuon.MCTruth.MuonTrackProducer_cfi.muonTrackProducer.clone() -#muonInnerTrack.muonsTag = cms.InputTag("muons") -muonInnerTrack.muonsTag = cms.InputTag("muonsPt10") -muonInnerTrack.selectionTags = ('All',) -muonInnerTrack.trackType = "innerTrack" - -import DQM.TrackingMonitor.TrackingMonitor_cfi -MonitorTrackMuonsInnerTrack = DQM.TrackingMonitor.TrackingMonitor_cfi.TrackMon.clone() -MonitorTrackMuonsInnerTrack.TrackProducer = 'muonInnerTrack' -MonitorTrackMuonsInnerTrack.AlgoName = 'inner' -MonitorTrackMuonsInnerTrack.FolderName = 'Muons/Tracking/innerTrack' -MonitorTrackMuonsInnerTrack.doBeamSpotPlots = True -MonitorTrackMuonsInnerTrack.BSFolderName = 'Muons/Tracking/innerTrack/BeamSpotParameters' -MonitorTrackMuonsInnerTrack.doSeedParameterHistos = False -MonitorTrackMuonsInnerTrack.doProfilesVsLS = False -MonitorTrackMuonsInnerTrack.doAllPlots = False -MonitorTrackMuonsInnerTrack.doGeneralPropertiesPlots = True -MonitorTrackMuonsInnerTrack.doHitPropertiesPlots = True -MonitorTrackMuonsInnerTrack.doTrackerSpecific = True -MonitorTrackMuonsInnerTrack.doDCAPlots = True -MonitorTrackMuonsInnerTrack.doDCAwrtPVPlots = True -MonitorTrackMuonsInnerTrack.doDCAwrt000Plots = False -MonitorTrackMuonsInnerTrack.doSIPPlots = True -MonitorTrackMuonsInnerTrack.doEffFromHitPatternVsPU = True -MonitorTrackMuonsInnerTrack.doEffFromHitPatternVsBX = False -MonitorTrackMuonsInnerTrack.TkSizeBin = 10 -MonitorTrackMuonsInnerTrack.TkSizeMax = 10. -MonitorTrackMuonsInnerTrack.phiErrMax = 0.001 -MonitorTrackMuonsInnerTrack.etaErrMax = 0.001 -MonitorTrackMuonsInnerTrack.PVBin = 40 -MonitorTrackMuonsInnerTrack.PVMin = -0.5 -MonitorTrackMuonsInnerTrack.PVMax = 79.5 ## it might need to be adjust if CMS asks to have lumi levelling at lower values - -MonitorTrackMuonsInnerTrack.doRecHitVsPhiVsEtaPerTrack = True -MonitorTrackMuonsInnerTrack.doRecHitVsPtVsEtaPerTrack = True -#MonitorTrackMuonsInnerTrack.doGoodTrackRecHitVsPhiVsEtaPerTrack = True -MonitorTrackMuonsInnerTrack.doLayersVsPhiVsEtaPerTrack = True -#MonitorTrackMuonsInnerTrack.doGoodTrackLayersVsPhiVsEtaPerTrack = True +from SimMuon.MCTruth.MuonTrackProducer_cfi import * +muonInnerTrack = muonTrackProducer.clone( + #muonsTag = "muons", + muonsTag = "muonsPt10", + selectionTags = ('All',), + trackType = "innerTrack" +) -MonitorTrackMuonsInnerTrack.Eta2DBin = 16 -MonitorTrackMuonsInnerTrack.Phi2DBin = 16 -MonitorTrackMuonsInnerTrack.TrackPtBin = 50 +from DQM.TrackingMonitor.TrackingMonitor_cfi import * +MonitorTrackMuonsInnerTrack = TrackMon.clone( + TrackProducer = 'muonInnerTrack', + AlgoName = 'inner', + FolderName = 'Muons/Tracking/innerTrack', + doBeamSpotPlots = True, + BSFolderName = 'Muons/Tracking/innerTrack/BeamSpotParameters', + doSeedParameterHistos = False, + doProfilesVsLS = False, + doAllPlots = False, + doGeneralPropertiesPlots = True, + doHitPropertiesPlots = True, + doTrackerSpecific = True, + doDCAPlots = True, + doDCAwrtPVPlots = True, + doDCAwrt000Plots = False, + doSIPPlots = True, + doEffFromHitPatternVsPU = True, + doEffFromHitPatternVsBX = False, + TkSizeBin = 10, + TkSizeMax = 10., + phiErrMax = 0.001, + etaErrMax = 0.001, + PVBin = 40, + PVMin = -0.5, + PVMax = 79.5, ## it might need to be adjust if CMS asks to have lumi levelling at lower values + doRecHitVsPhiVsEtaPerTrack = True, + doRecHitVsPtVsEtaPerTrack = True, + #doGoodTrackRecHitVsPhiVsEtaPerTrack = True, + doLayersVsPhiVsEtaPerTrack = True, + #doGoodTrackLayersVsPhiVsEtaPerTrack = True, + Eta2DBin = 16, + Phi2DBin = 16, + TrackPtBin = 50 +) from Configuration.Eras.Modifier_phase1Pixel_cff import phase1Pixel from Configuration.Eras.Modifier_phase2_tracker_cff import phase2_tracker diff --git a/DQM/TrackingMonitor/python/MonitorTrackSTACosmicMuonsHLT_cff.py b/DQM/TrackingMonitor/python/MonitorTrackSTACosmicMuonsHLT_cff.py index 96309c3880b82..dcd9e8def3523 100644 --- a/DQM/TrackingMonitor/python/MonitorTrackSTACosmicMuonsHLT_cff.py +++ b/DQM/TrackingMonitor/python/MonitorTrackSTACosmicMuonsHLT_cff.py @@ -1,12 +1,12 @@ import FWCore.ParameterSet.Config as cms -import DQM.TrackingMonitor.MonitorTrackSTAMuons_cfi -MonitorTrackSTACosmicMuonsHLTDT = DQM.TrackingMonitor.MonitorTrackSTAMuons_cfi.MonitorTrackSTAMuons.clone() -import DQM.TrackingMonitor.MonitorTrackSTAMuons_cfi -MonitorTrackSTACosmicMuonsHLTCSC = DQM.TrackingMonitor.MonitorTrackSTAMuons_cfi.MonitorTrackSTAMuons.clone() -MonitorTrackSTACosmicMuonsHLTDT.TrackProducer = 'dtCosmicSTA' -MonitorTrackSTACosmicMuonsHLTDT.FolderName = 'Muons/cosmicMuonsHLTDT' -MonitorTrackSTACosmicMuonsHLTCSC.TrackProducer = 'cscCosmicSTA' -MonitorTrackSTACosmicMuonsHLTCSC.FolderName = 'Muons/cosmicMuonsHLTCSC' - +from DQM.TrackingMonitor.MonitorTrackSTAMuons_cfi import * +MonitorTrackSTACosmicMuonsHLTDT = MonitorTrackSTAMuons.clone( + TrackProducer = 'dtCosmicSTA', + FolderName = 'Muons/cosmicMuonsHLTDT' +) +MonitorTrackSTACosmicMuonsHLTCSC = MonitorTrackSTAMuons.clone( + TrackProducer = 'cscCosmicSTA', + FolderName = 'Muons/cosmicMuonsHLTCSC' +) diff --git a/DQM/TrackingMonitor/python/MonitorTrackSTACosmicMuons_cff.py b/DQM/TrackingMonitor/python/MonitorTrackSTACosmicMuons_cff.py index cea58f1497ede..cc98fa7476ddd 100644 --- a/DQM/TrackingMonitor/python/MonitorTrackSTACosmicMuons_cff.py +++ b/DQM/TrackingMonitor/python/MonitorTrackSTACosmicMuons_cff.py @@ -1,30 +1,34 @@ import FWCore.ParameterSet.Config as cms from DQM.TrackingMonitor.MonitorTrackSTACosmicMuons_cfi import * -import DQM.TrackingMonitor.MonitorTrackSTAMuons_cfi -MonitorTrackSTACosmicMuonsBarrel = DQM.TrackingMonitor.MonitorTrackSTAMuons_cfi.MonitorTrackSTAMuons.clone() -import DQM.TrackingMonitor.MonitorTrackSTAMuons_cfi -MonitorTrackSTACosmicMuonsEndCaps = DQM.TrackingMonitor.MonitorTrackSTAMuons_cfi.MonitorTrackSTAMuons.clone() -import DQM.TrackingMonitor.MonitorTrackSTAMuons_cfi -MonitorTrackSTACosmicMuons1LegBarrel = DQM.TrackingMonitor.MonitorTrackSTAMuons_cfi.MonitorTrackSTAMuons.clone() -import DQM.TrackingMonitor.MonitorTrackSTAMuons_cfi -MonitorTrackLHCStandAloneMuonsBarrelOnly = DQM.TrackingMonitor.MonitorTrackSTAMuons_cfi.MonitorTrackSTAMuons.clone() -import DQM.TrackingMonitor.MonitorTrackSTAMuons_cfi -MonitorTrackLHCStandAloneMuonsEndCapsOnly = DQM.TrackingMonitor.MonitorTrackSTAMuons_cfi.MonitorTrackSTAMuons.clone() -import DQM.TrackingMonitor.MonitorTrackSTAMuons_cfi -MonitorTrackSTACosmicMuonsNoDriftBarrel = DQM.TrackingMonitor.MonitorTrackSTAMuons_cfi.MonitorTrackSTAMuons.clone() +from DQM.TrackingMonitor.MonitorTrackSTAMuons_cfi import * +MonitorTrackSTACosmicMuonsBarrel = MonitorTrackSTAMuons.clone( + FolderName = 'Muons/cosmicMuonsBarrelOnly', + TrackProducer = 'cosmicMuonsBarrelOnly' +) +from DQM.TrackingMonitor.MonitorTrackSTAMuons_cfi import * +MonitorTrackSTACosmicMuonsEndCaps = MonitorTrackSTAMuons.clone( + FolderName = 'Muons/cosmicMuonsEndCapsOnly', + TrackProducer = 'cosmicMuonsEndCapsOnly' +) +from DQM.TrackingMonitor.MonitorTrackSTAMuons_cfi import * +MonitorTrackSTACosmicMuons1LegBarrel = MonitorTrackSTAMuons.clone( + FolderName = 'Muons/cosmicMuons1LegBarrelOnly', + TrackProducer = 'cosmicMuons1LegBarrelOnly' +) +from DQM.TrackingMonitor.MonitorTrackSTAMuons_cfi import * +MonitorTrackLHCStandAloneMuonsBarrelOnly = MonitorTrackSTAMuons.clone( + FolderName = 'Muons/standAloneMuonsBarrelOnly', + TrackProducer = 'lhcStandAloneMuonsBarrelOnly' +) +from DQM.TrackingMonitor.MonitorTrackSTAMuons_cfi import * +MonitorTrackLHCStandAloneMuonsEndCapsOnly = MonitorTrackSTAMuons.clone( + FolderName = 'Muons/standAloneMuonsEndCapsOnly', + TrackProducer = 'lhcStandAloneMuonsEndCapsOnly' +) +from DQM.TrackingMonitor.MonitorTrackSTAMuons_cfi import * +MonitorTrackSTACosmicMuonsNoDriftBarrel = MonitorTrackSTAMuons.clone( + FolderName = 'Muons/cosmicMuonsNoDriftBarrelOnly', + TrackProducer = 'cosmicMuonsNoDriftBarrelOnly' +) standAloneCosmicMuonsMonitors = cms.Sequence(MonitorTrackSTACosmicMuons*MonitorTrackSTACosmicMuonsBarrel*MonitorTrackSTACosmicMuons1LegBarrel*MonitorTrackSTACosmicMuonsEndCaps*MonitorTrackLHCStandAloneMuonsBarrelOnly*MonitorTrackLHCStandAloneMuonsEndCapsOnly*MonitorTrackSTACosmicMuonsNoDriftBarrel) -MonitorTrackSTACosmicMuonsBarrel.FolderName = 'Muons/cosmicMuonsBarrelOnly' -MonitorTrackSTACosmicMuonsBarrel.TrackProducer = 'cosmicMuonsBarrelOnly' -MonitorTrackSTACosmicMuonsEndCaps.FolderName = 'Muons/cosmicMuonsEndCapsOnly' -MonitorTrackSTACosmicMuonsEndCaps.TrackProducer = 'cosmicMuonsEndCapsOnly' -MonitorTrackSTACosmicMuons1LegBarrel.FolderName = 'Muons/cosmicMuons1LegBarrelOnly' -MonitorTrackSTACosmicMuons1LegBarrel.TrackProducer = 'cosmicMuons1LegBarrelOnly' -MonitorTrackLHCStandAloneMuonsBarrelOnly.FolderName = 'Muons/standAloneMuonsBarrelOnly' -MonitorTrackLHCStandAloneMuonsBarrelOnly.TrackProducer = 'lhcStandAloneMuonsBarrelOnly' -MonitorTrackLHCStandAloneMuonsEndCapsOnly.FolderName = 'Muons/standAloneMuonsEndCapsOnly' -MonitorTrackLHCStandAloneMuonsEndCapsOnly.TrackProducer = 'lhcStandAloneMuonsEndCapsOnly' -MonitorTrackSTACosmicMuonsNoDriftBarrel.FolderName = 'Muons/cosmicMuonsNoDriftBarrelOnly' -MonitorTrackSTACosmicMuonsNoDriftBarrel.TrackProducer = 'cosmicMuonsNoDriftBarrelOnly' - - diff --git a/DQM/TrackingMonitor/python/MonitorTrackSTACosmicMuons_cfi.py b/DQM/TrackingMonitor/python/MonitorTrackSTACosmicMuons_cfi.py index 637051357de00..44bd14f72294f 100644 --- a/DQM/TrackingMonitor/python/MonitorTrackSTACosmicMuons_cfi.py +++ b/DQM/TrackingMonitor/python/MonitorTrackSTACosmicMuons_cfi.py @@ -1,8 +1,8 @@ import FWCore.ParameterSet.Config as cms -import DQM.TrackingMonitor.MonitorTrackSTAMuons_cfi -MonitorTrackSTACosmicMuons = DQM.TrackingMonitor.MonitorTrackSTAMuons_cfi.MonitorTrackSTAMuons.clone() -MonitorTrackSTACosmicMuons.FolderName = 'Muons/cosmicMuons' -MonitorTrackSTACosmicMuons.TrackProducer = 'cosmicMuons' - +from DQM.TrackingMonitor.MonitorTrackSTAMuons_cfi import * +MonitorTrackSTACosmicMuons = MonitorTrackSTAMuons.clone( + FolderName = 'Muons/cosmicMuons', + TrackProducer = 'cosmicMuons' +) diff --git a/DQM/TrackingMonitor/python/MonitorTrackSTAMuons_cfi.py b/DQM/TrackingMonitor/python/MonitorTrackSTAMuons_cfi.py index d7b81c70c791d..7f2abbadb5ff9 100644 --- a/DQM/TrackingMonitor/python/MonitorTrackSTAMuons_cfi.py +++ b/DQM/TrackingMonitor/python/MonitorTrackSTAMuons_cfi.py @@ -1,358 +1,300 @@ import FWCore.ParameterSet.Config as cms # MonitorTrackGlobal -import DQM.TrackingMonitor.TrackingMonitor_cfi -MonitorTrackSTAMuons = DQM.TrackingMonitor.TrackingMonitor_cfi.TrackMon.clone() - -# input tags -MonitorTrackSTAMuons.TrackProducer = cms.InputTag("standAloneMuons","UpdatedAtVtx") -MonitorTrackSTAMuons.SeedProducer = cms.InputTag("combinedP5SeedsForCTF") -MonitorTrackSTAMuons.TCProducer = cms.InputTag("ckfTrackCandidatesP5") -MonitorTrackSTAMuons.beamSpot = cms.InputTag("offlineBeamSpot") -MonitorTrackSTAMuons.ClusterLabels = cms.vstring('Tot') - -# output parameters -MonitorTrackSTAMuons.AlgoName = cms.string('sta') -MonitorTrackSTAMuons.Quality = cms.string('') -MonitorTrackSTAMuons.FolderName = cms.string('Muons/standAloneMuonsUpdatedAtVtx') -MonitorTrackSTAMuons.BSFolderName = cms.string('Muons/standAloneMuonsUpdatedAtVtx/BeamSpotParameters') - -# determines where to evaluate track parameters -# options: 'default' --> straight up track parametes -# 'ImpactPoint' --> evalutate at impact point -# 'InnerSurface' --> evalutate at innermost measurement state -# 'OuterSurface' --> evalutate at outermost measurement state -MonitorTrackSTAMuons.MeasurementState = cms.string('default') - -# which plots to do -MonitorTrackSTAMuons.doTrackerSpecific = cms.bool(False) -MonitorTrackSTAMuons.doAllPlots = cms.bool(False) -MonitorTrackSTAMuons.doBeamSpotPlots = cms.bool(False) -MonitorTrackSTAMuons.doSeedParameterHistos = cms.bool(False) -MonitorTrackSTAMuons.doTrackCandHistos = cms.bool(False) -MonitorTrackSTAMuons.doDCAPlots = cms.bool(False) -MonitorTrackSTAMuons.doGeneralPropertiesPlots = cms.bool(True) -MonitorTrackSTAMuons.doHitPropertiesPlots = cms.bool(True) -MonitorTrackSTAMuons.doEffFromHitPatternVsPU = cms.bool(False) -MonitorTrackSTAMuons.doEffFromHitPatternVsBX = cms.bool(False) -#MonitorTrackSTAMuons.doGoodTrackPlots = cms.bool(False) -MonitorTrackSTAMuons.doMeasurementStatePlots = cms.bool(True) -MonitorTrackSTAMuons.doProfilesVsLS = cms.bool(False) -MonitorTrackSTAMuons.doRecHitVsPhiVsEtaPerTrack = cms.bool(False) -#MonitorTrackSTAMuons.doGoodTrackRecHitVsPhiVsEtaPerTrack = cms.bool(False) - -#which seed plots to do -MonitorTrackSTAMuons.doSeedNumberHisto = cms.bool(False) -MonitorTrackSTAMuons.doSeedVsClusterHisto = cms.bool(False) -MonitorTrackSTAMuons.doSeedPTHisto = cms.bool(False) -MonitorTrackSTAMuons.doSeedETAHisto = cms.bool(False) -MonitorTrackSTAMuons.doSeedPHIHisto = cms.bool(False) -MonitorTrackSTAMuons.doSeedPHIVsETAHisto = cms.bool(False) -MonitorTrackSTAMuons.doSeedThetaHisto = cms.bool(False) -MonitorTrackSTAMuons.doSeedQHisto = cms.bool(False) -MonitorTrackSTAMuons.doSeedDxyHisto = cms.bool(False) -MonitorTrackSTAMuons.doSeedDzHisto = cms.bool(False) -MonitorTrackSTAMuons.doSeedNRecHitsHisto = cms.bool(False) -MonitorTrackSTAMuons.doSeedNVsPhiProf = cms.bool(False) -MonitorTrackSTAMuons.doSeedNVsEtaProf = cms.bool(False) - - -# paramters of the Track -# ============================================================ - -# chi2 -MonitorTrackSTAMuons.Chi2Bin = cms.int32(250) -MonitorTrackSTAMuons.Chi2Max = cms.double(500.0) -MonitorTrackSTAMuons.Chi2Min = cms.double(0.0) - -# chi2 dof -MonitorTrackSTAMuons.Chi2NDFBin = cms.int32(200) -MonitorTrackSTAMuons.Chi2NDFMax = cms.double(19.5) -MonitorTrackSTAMuons.Chi2NDFMin = cms.double(-0.5) - -# chi^2 probability -MonitorTrackSTAMuons.Chi2ProbBin = cms.int32(100) -MonitorTrackSTAMuons.Chi2ProbMax = cms.double(1.0) -MonitorTrackSTAMuons.Chi2ProbMin = cms.double(0.0) - -# Number of Tracks per Event -MonitorTrackSTAMuons.TkSizeBin = cms.int32(11) -MonitorTrackSTAMuons.TkSizeMax = cms.double(10.5) -MonitorTrackSTAMuons.TkSizeMin = cms.double(-0.5) - -# Number of seeds per Event -MonitorTrackSTAMuons.TkSeedSizeBin = cms.int32(20) -MonitorTrackSTAMuons.TkSeedSizeMax = cms.double(19.5) -MonitorTrackSTAMuons.TkSeedSizeMin = cms.double(-0.5) - -# Number of Track Cadidates per Event -MonitorTrackSTAMuons.TCSizeBin = cms.int32(150) -MonitorTrackSTAMuons.TCSizeMax = cms.double(149.5) -MonitorTrackSTAMuons.TCSizeMin = cms.double(-0.5) - -# num rec hits -MonitorTrackSTAMuons.TrackQBin = cms.int32(8) -MonitorTrackSTAMuons.TrackQMax = cms.double(2.5) -MonitorTrackSTAMuons.TrackQMin = cms.double(-2.5) - -# num rec hits in seed -MonitorTrackSTAMuons.SeedHitBin = cms.int32(6) -MonitorTrackSTAMuons.SeedHitMax = cms.double(5.5) -MonitorTrackSTAMuons.SeedHitMin = cms.double(-0.5) - -# num rec hits per track candidate -MonitorTrackSTAMuons.TCHitBin = cms.int32(40) -MonitorTrackSTAMuons.TCHitMax = cms.double(39.5) -MonitorTrackSTAMuons.TCHitMin = cms.double(-0.5) - -# num rec hits -MonitorTrackSTAMuons.RecHitBin = cms.int32(120) -MonitorTrackSTAMuons.RecHitMax = cms.double(120.0) -MonitorTrackSTAMuons.RecHitMin = cms.double(0.0) - -# mean rec hits -MonitorTrackSTAMuons.MeanHitBin = cms.int32(30) -MonitorTrackSTAMuons.MeanHitMax = cms.double(29.5) -MonitorTrackSTAMuons.MeanHitMin = cms.double(-0.5) - -# num TOB rec hits -MonitorTrackSTAMuons.TOBHitBin = cms.int32(15) -MonitorTrackSTAMuons.TOBHitMin = cms.double(-0.5) -MonitorTrackSTAMuons.TOBHitMax = cms.double(14.5) - -# num TIB rec hits -MonitorTrackSTAMuons.TIBHitBin = cms.int32(15) -MonitorTrackSTAMuons.TIBHitMin = cms.double(-0.5) -MonitorTrackSTAMuons.TIBHitMax = cms.double(14.5) - -# num TID rec hits -MonitorTrackSTAMuons.TIDHitBin = cms.int32(15) -MonitorTrackSTAMuons.TIDHitMin = cms.double(-0.5) -MonitorTrackSTAMuons.TIDHitMax = cms.double(14.5) - -# num TEC rec hits -MonitorTrackSTAMuons.TECHitBin = cms.int32(25) -MonitorTrackSTAMuons.TECHitMin = cms.double(-0.5) -MonitorTrackSTAMuons.TECHitMax = cms.double(24.5) - -# num PXB rec hits -MonitorTrackSTAMuons.PXBHitBin = cms.int32(10) -MonitorTrackSTAMuons.PXBHitMin = cms.double(-0.5) -MonitorTrackSTAMuons.PXBHitMax = cms.double(9.5) - -# num PXF rec hits -MonitorTrackSTAMuons.PXFHitBin = cms.int32(10) -MonitorTrackSTAMuons.PXFHitMin = cms.double(-0.5) -MonitorTrackSTAMuons.PXFHitMax = cms.double(9.5) - -# num rec hits lost -MonitorTrackSTAMuons.RecLostBin = cms.int32(120) -MonitorTrackSTAMuons.RecLostMax = cms.double(20) -MonitorTrackSTAMuons.RecLostMin = cms.double(0.0) - -# num layers -MonitorTrackSTAMuons.RecLayBin = cms.int32(120) -MonitorTrackSTAMuons.RecLayMax = cms.double(120.0) -MonitorTrackSTAMuons.RecLayMin = cms.double(0.0) - -# mean layers -MonitorTrackSTAMuons.MeanLayBin = cms.int32(20) -MonitorTrackSTAMuons.MeanLayMax = cms.double(19.5) -MonitorTrackSTAMuons.MeanLayMin = cms.double(-0.5) - -# num TOB layers -MonitorTrackSTAMuons.TOBLayBin = cms.int32(10) -MonitorTrackSTAMuons.TOBLayMax = cms.double(9.5) -MonitorTrackSTAMuons.TOBLayMin = cms.double(-0.5) - -# num TIB layers -MonitorTrackSTAMuons.TIBLayBin = cms.int32(6) -MonitorTrackSTAMuons.TIBLayMax = cms.double(5.5) -MonitorTrackSTAMuons.TIBLayMin = cms.double(-0.5) - -# num TID layers -MonitorTrackSTAMuons.TIDLayBin = cms.int32(6) -MonitorTrackSTAMuons.TIDLayMax = cms.double(5.5) -MonitorTrackSTAMuons.TIDLayMin = cms.double(-0.5) - -# num TEC layers -MonitorTrackSTAMuons.TECLayBin = cms.int32(15) -MonitorTrackSTAMuons.TECLayMax = cms.double(14.5) -MonitorTrackSTAMuons.TECLayMin = cms.double(-0.5) - -# num PXB layers -MonitorTrackSTAMuons.PXBLayBin = cms.int32(6) -MonitorTrackSTAMuons.PXBLayMax = cms.double(5.5) -MonitorTrackSTAMuons.PXBLayMin = cms.double(-0.5) - -# num PXF layers -MonitorTrackSTAMuons.PXFLayBin = cms.int32(6) -MonitorTrackSTAMuons.PXFLayMax = cms.double(5.5) -MonitorTrackSTAMuons.PXFLayMin = cms.double(-0.5) - -# Track |p| -MonitorTrackSTAMuons.TrackPBin = cms.int32(1000) -MonitorTrackSTAMuons.TrackPMax = cms.double(1000) -MonitorTrackSTAMuons.TrackPMin = cms.double(0) - -# Track pT -MonitorTrackSTAMuons.TrackPtBin = cms.int32(1000) -MonitorTrackSTAMuons.TrackPtMax = cms.double(1000) -MonitorTrackSTAMuons.TrackPtMin = cms.double(0) - -# Track px -MonitorTrackSTAMuons.TrackPxBin = cms.int32(1000) -MonitorTrackSTAMuons.TrackPxMax = cms.double(500.0) -MonitorTrackSTAMuons.TrackPxMin = cms.double(-500.0) - -# Track py -MonitorTrackSTAMuons.TrackPyBin = cms.int32(1000) -MonitorTrackSTAMuons.TrackPyMax = cms.double(500.0) -MonitorTrackSTAMuons.TrackPyMin = cms.double(-500.0) - -# Track pz -MonitorTrackSTAMuons.TrackPzMin = cms.double(-500.0) -MonitorTrackSTAMuons.TrackPzMax = cms.double(500.0) -MonitorTrackSTAMuons.TrackPzBin = cms.int32(1000) - -# track theta -MonitorTrackSTAMuons.ThetaBin = cms.int32(100) -MonitorTrackSTAMuons.ThetaMax = cms.double(3.2) -MonitorTrackSTAMuons.ThetaMin = cms.double(0.0) - -# track eta -MonitorTrackSTAMuons.EtaBin = cms.int32(100) -MonitorTrackSTAMuons.EtaMax = cms.double(3.0) -MonitorTrackSTAMuons.EtaMin = cms.double(-3.0) - -# track phi -MonitorTrackSTAMuons.PhiBin = cms.int32(36) -MonitorTrackSTAMuons.PhiMax = cms.double(3.2) -MonitorTrackSTAMuons.PhiMin = cms.double(-3.2) - -# Track |p| error -MonitorTrackSTAMuons.pErrBin = cms.int32(100) -MonitorTrackSTAMuons.pErrMax = cms.double(10.0) -MonitorTrackSTAMuons.pErrMin = cms.double(0.0) - -# Track pT error -MonitorTrackSTAMuons.ptErrBin = cms.int32(100) -MonitorTrackSTAMuons.ptErrMax = cms.double(10.0) -MonitorTrackSTAMuons.ptErrMin = cms.double(0.0) - -# Track px error -MonitorTrackSTAMuons.pxErrBin = cms.int32(100) -MonitorTrackSTAMuons.pxErrMax = cms.double(10.0) -MonitorTrackSTAMuons.pxErrMin = cms.double(0.0) - -# Track py error -MonitorTrackSTAMuons.pyErrBin = cms.int32(100) -MonitorTrackSTAMuons.pyErrMax = cms.double(10.0) -MonitorTrackSTAMuons.pyErrMin = cms.double(0.0) - -# Track pz error -MonitorTrackSTAMuons.pzErrBin = cms.int32(100) -MonitorTrackSTAMuons.pzErrMax = cms.double(10.0) -MonitorTrackSTAMuons.pzErrMin = cms.double(0.0) - -# track eta error -MonitorTrackSTAMuons.etaErrBin = cms.int32(100) -MonitorTrackSTAMuons.etaErrMax = cms.double(0.5) -MonitorTrackSTAMuons.etaErrMin = cms.double(0.0) - -# track phi Error -MonitorTrackSTAMuons.phiErrBin = cms.int32(100) -MonitorTrackSTAMuons.phiErrMax = cms.double(1.0) -MonitorTrackSTAMuons.phiErrMin = cms.double(0.0) - -# PCA x position -MonitorTrackSTAMuons.VXBin = cms.int32(20) -MonitorTrackSTAMuons.VXMax = cms.double(20.0) -MonitorTrackSTAMuons.VXMin = cms.double(-20.0) - -# PCA y position -MonitorTrackSTAMuons.VYBin = cms.int32(20) -MonitorTrackSTAMuons.VYMax = cms.double(20.0) -MonitorTrackSTAMuons.VYMin = cms.double(-20.0) - -# PCA z position -MonitorTrackSTAMuons.VZBin = cms.int32(50) -MonitorTrackSTAMuons.VZMax = cms.double(100.0) -MonitorTrackSTAMuons.VZMin = cms.double(-100.0) - -# PCA x position for 2D plot -MonitorTrackSTAMuons.X0Bin = cms.int32(100) -MonitorTrackSTAMuons.X0Max = cms.double(3.0) -MonitorTrackSTAMuons.X0Min = cms.double(-3.0) - -# PCA y position for 2D plot -MonitorTrackSTAMuons.Y0Bin = cms.int32(100) -MonitorTrackSTAMuons.Y0Max = cms.double(3.0) -MonitorTrackSTAMuons.Y0Min = cms.double(-3.0) - -# PCA z position for 2D plot -MonitorTrackSTAMuons.Z0Bin = cms.int32(60) -MonitorTrackSTAMuons.Z0Max = cms.double(30.0) -MonitorTrackSTAMuons.Z0Min = cms.double(-30.0) - -# Track dxy (transverse impact parameter) -MonitorTrackSTAMuons.DxyBin = cms.int32(100) -MonitorTrackSTAMuons.DxyMax = cms.double(0.5) -MonitorTrackSTAMuons.DxyMin = cms.double(-0.5) - -# Seed dxy (transverse impact parameter) -MonitorTrackSTAMuons.SeedDxyBin = cms.int32(100) -MonitorTrackSTAMuons.SeedDxyMax = cms.double(0.5) -MonitorTrackSTAMuons.SeedDxyMin = cms.double(-0.5) - -# Seed dz (longitudinal impact parameter) -MonitorTrackSTAMuons.SeedDzBin = cms.int32(200) -MonitorTrackSTAMuons.SeedDzMax = cms.double(30.0) -MonitorTrackSTAMuons.SeedDzMin = cms.double(-30.0) - -# Track Candidate dxy (transverse impact parameter) -MonitorTrackSTAMuons.TCDxyBin = cms.int32(200) -MonitorTrackSTAMuons.TCDxyMax = cms.double(100.0) -MonitorTrackSTAMuons.TCDxyMin = cms.double(-100.0) - -# Track Candidate dz (transverse impact parameter) -MonitorTrackSTAMuons.TCDzBin = cms.int32(200) -MonitorTrackSTAMuons.TCDzMax = cms.double(400.0) -MonitorTrackSTAMuons.TCDzMin = cms.double(-400.0) - -# NCluster Pixel -MonitorTrackSTAMuons.NClusPxBin = cms.int32(50) -MonitorTrackSTAMuons.NClusPxMax = cms.double(1999.5) -MonitorTrackSTAMuons.NClusPxMin = cms.double(-0.5) - -# NCluster Strip -MonitorTrackSTAMuons.NClusStrBin = cms.int32(150) -MonitorTrackSTAMuons.NClusStrMax = cms.double(14999.5) -MonitorTrackSTAMuons.NClusStrMin = cms.double(-0.5) - -# NCluster 2D -MonitorTrackSTAMuons.NClus2DPxBin = cms.int32(20) -MonitorTrackSTAMuons.NClus2DPxMax = cms.double(1999.5) -MonitorTrackSTAMuons.NClus2DPxMin = cms.double(-0.5) -MonitorTrackSTAMuons.NClus2DStrBin = cms.int32(50) -MonitorTrackSTAMuons.NClus2DStrMax = cms.double(14999.5) -MonitorTrackSTAMuons.NClus2DStrMin = cms.double(-0.5) - -# NCluster Vs Tracks -MonitorTrackSTAMuons.NClus2DTotBin = cms.int32(50) -MonitorTrackSTAMuons.NClus2DTotMax = cms.double(14999.5) -MonitorTrackSTAMuons.NClus2DTotMin = cms.double(-0.5) -MonitorTrackSTAMuons.NTrk2D.NTrk2DBin = cms.int32(20) -MonitorTrackSTAMuons.NTrk2D.NTrk2DMax = cms.double(199.5) -MonitorTrackSTAMuons.NTrk2D.NTrk2DMin = cms.double(-0.5) - -MonitorTrackSTAMuons.TTRHBuilder = cms.string('WithTrackAngle') - -# For plots vs LS -MonitorTrackSTAMuons.LSBin = cms.int32(2000) -MonitorTrackSTAMuons.LSMin = cms.double(0) -MonitorTrackSTAMuons.LSMax = cms.double(2000.) - -# Luminosity based analysis -MonitorTrackSTAMuons.doLumiAnalysis = cms.bool(False) - +from DQM.TrackingMonitor.TrackingMonitor_cfi import * +MonitorTrackSTAMuons = TrackMon.clone( + # input tags + TrackProducer = ("standAloneMuons","UpdatedAtVtx"), + SeedProducer = "combinedP5SeedsForCTF", + TCProducer = "ckfTrackCandidatesP5", + beamSpot = "offlineBeamSpot", + ClusterLabels = ('Tot',), + + # output parameters + AlgoName = 'sta', + Quality = '', + FolderName = 'Muons/standAloneMuonsUpdatedAtVtx', + BSFolderName = 'Muons/standAloneMuonsUpdatedAtVtx/BeamSpotParameters', + + # determines where to evaluate track parameters + # options: 'default' --> straight up track parametes + # 'ImpactPoint' --> evalutate at impact point + # 'InnerSurface' --> evalutate at innermost measurement state + # 'OuterSurface' --> evalutate at outermost measurement state + MeasurementState = 'default', + + # which plots to do + doTrackerSpecific = False, + doAllPlots = False, + doBeamSpotPlots = False, + doSeedParameterHistos = False, + doTrackCandHistos = False, + doDCAPlots = False, + doGeneralPropertiesPlots = True, + doHitPropertiesPlots = True, + doEffFromHitPatternVsPU = False, + doEffFromHitPatternVsBX = False, + #doGoodTrackPlots = False, + doMeasurementStatePlots = True, + doProfilesVsLS = False, + doRecHitVsPhiVsEtaPerTrack = False, + #doGoodTrackRecHitVsPhiVsEtaPerTrack = False, + + # which seed plots to do + doSeedNumberHisto= False, + doSeedVsClusterHisto = False, + doSeedPTHisto = False, + doSeedETAHisto = False, + doSeedPHIHisto = False, + doSeedPHIVsETAHisto = False, + doSeedThetaHisto = False, + doSeedQHisto = False, + doSeedDxyHisto = False, + doSeedDzHisto = False, + doSeedNRecHitsHisto = False, + doSeedNVsPhiProf = False, + doSeedNVsEtaProf = False, + + # paramters of the Track + # ============================================================ + + # chi2 + Chi2Bin = 250, + Chi2Max = 500.0, + Chi2Min = 0.0, + # chi2 dof + Chi2NDFBin = 200, + Chi2NDFMax = 19.5, + Chi2NDFMin = -0.5, + # chi^2 probability + Chi2ProbBin = 100, + Chi2ProbMax = 1.0, + Chi2ProbMin = 0.0, + # Number of Tracks per Event + TkSizeBin = 11, + TkSizeMax = 10.5, + TkSizeMin = -0.5, + # Number of seeds per Event + TkSeedSizeBin = 20, + TkSeedSizeMax = 19.5, + TkSeedSizeMin = -0.5, + # Number of Track Cadidates per Event + TCSizeBin = 150, + TCSizeMax = 149.5, + TCSizeMin = -0.5, + # num rec hits + TrackQBin = 8, + TrackQMax = 2.5, + TrackQMin = -2.5, + # num rec hits in seed + SeedHitBin = 6, + SeedHitMax = 5.5, + SeedHitMin = -0.5, + # num rec hits per track candidate + TCHitBin = 40, + TCHitMax = 39.5, + TCHitMin = -0.5, + # num rec hits + RecHitBin = 120, + RecHitMax = 120.0, + RecHitMin = 0.0, + # mean rec hits + MeanHitBin = 30, + MeanHitMax = 29.5, + MeanHitMin = -0.5, + # num TOB rec hits + TOBHitBin = cms.int32(15), + TOBHitMin = cms.double(-0.5), + TOBHitMax = cms.double(14.5), + # num TIB rec hits + TIBHitBin = cms.int32(15), + TIBHitMin = cms.double(-0.5), + TIBHitMax = cms.double(14.5), + # num TID rec hits + TIDHitBin = cms.int32(15), + TIDHitMin = cms.double(-0.5), + TIDHitMax = cms.double(14.5), + # num TEC rec hits + TECHitBin = cms.int32(25), + TECHitMin = cms.double(-0.5), + TECHitMax = cms.double(24.5), + # num PXB rec hits + PXBHitBin = cms.int32(10), + PXBHitMin = cms.double(-0.5), + PXBHitMax = cms.double(9.5), + # num PXF rec hits + PXFHitBin = cms.int32(10), + PXFHitMin = cms.double(-0.5), + PXFHitMax = cms.double(9.5), + # num rec hits lost + RecLostBin = 120, + RecLostMax = 20., + RecLostMin = 0.0, + # num layers + RecLayBin = 120, + RecLayMax = 120.0, + RecLayMin = 0.0, + # mean layers + MeanLayBin = 20, + MeanLayMax = 19.5, + MeanLayMin = -0.5, + # num TOB layers + TOBLayBin = 10, + TOBLayMax = 9.5, + TOBLayMin = -0.5, + # num TIB layers + TIBLayBin = 6, + TIBLayMax = 5.5, + TIBLayMin = -0.5, + # num TID layers + TIDLayBin = 6, + TIDLayMax = 5.5, + TIDLayMin = -0.5, + # num TEC layers + TECLayBin = 15, + TECLayMax = 14.5, + TECLayMin = -0.5, + # num PXB layers + PXBLayBin = 6, + PXBLayMax = 5.5, + PXBLayMin = -0.5, + # num PXF layers + PXFLayBin = 6, + PXFLayMax = 5.5, + PXFLayMin = -0.5, + # Track |p| + TrackPBin = 1000, + TrackPMax = 1000., + TrackPMin = 0., + # Track pT + TrackPtBin = 1000, + TrackPtMax = 1000., + TrackPtMin = 0., + # Track px + TrackPxBin = 1000, + TrackPxMax = 500.0, + TrackPxMin = -500.0, + # Track py + TrackPyBin = 1000, + TrackPyMax = 500.0, + TrackPyMin = -500.0, + # Track pz + TrackPzMin = -500.0, + TrackPzMax = 500.0, + TrackPzBin = 1000, + # track theta + ThetaBin = 100, + ThetaMax = 3.2, + ThetaMin = 0.0, + # track eta + EtaBin = 100, + EtaMax = 3.0, + EtaMin = -3.0, + # track phi + PhiBin = 36, + PhiMax = 3.2, + PhiMin = -3.2, + # Track |p| error + pErrBin = 100, + pErrMax = 10.0, + pErrMin = 0.0, + # Track pT error + ptErrBin = 100, + ptErrMax = 10.0, + ptErrMin = 0.0, + # Track px error + pxErrBin = 100, + pxErrMax = 10.0, + pxErrMin = 0.0, + # Track py error + pyErrBin = 100, + pyErrMax = 10.0, + pyErrMin = 0.0, + # Track pz error + pzErrBin = 100, + pzErrMax = 10.0, + pzErrMin = 0.0, + # track eta error + etaErrBin = 100, + etaErrMax = 0.5, + etaErrMin = 0.0, + # track phi Error + phiErrBin = 100, + phiErrMax = 1.0, + phiErrMin = 0.0, + # PCA x position + VXBin = 20, + VXMax = 20.0, + VXMin = -20.0, + # PCA y position + VYBin = 20, + VYMax = 20.0, + VYMin = -20.0, + # PCA z position + VZBin = 50, + VZMax = 100.0, + VZMin = -100.0, + # PCA x position for 2D plot + X0Bin = 100, + X0Max = 3.0, + X0Min = -3.0, + # PCA y position for 2D plot + Y0Bin = 100, + Y0Max = 3.0, + Y0Min = -3.0, + # PCA z position for 2D plot + Z0Bin = 60, + Z0Max = 30.0, + Z0Min = -30.0, + # Track dxy (transverse impact parameter) + DxyBin = 100, + DxyMax = 0.5, + DxyMin = -0.5, + # Seed dxy (transverse impact parameter) + SeedDxyBin = 100, + SeedDxyMax = 0.5, + SeedDxyMin = -0.5, + # Seed dz (longitudinal impact parameter) + SeedDzBin = 200, + SeedDzMax = 30.0, + SeedDzMin = -30.0, + # Track Candidate dxy (transverse impact parameter) + TCDxyBin = 200, + TCDxyMax = 100.0, + TCDxyMin = -100.0, + # Track Candidate dz (transverse impact parameter) + TCDzBin = 200, + TCDzMax = 400.0, + TCDzMin = -400.0, + # NCluster Pixel + NClusPxBin = 50, + NClusPxMax = 1999.5, + NClusPxMin = -0.5, + # NCluster Strip + NClusStrBin = 150, + NClusStrMax = 14999.5, + NClusStrMin = -0.5, + # NCluster 2D + NClus2DPxBin = cms.int32(20), + NClus2DPxMax = cms.double(1999.5), + NClus2DPxMin = cms.double(-0.5), + NClus2DStrBin = cms.int32(50), + NClus2DStrMax = cms.double(14999.5), + NClus2DStrMin = cms.double(-0.5), + # NCluster Vs Tracks + NClus2DTotBin = cms.int32(50), + NClus2DTotMax = cms.double(14999.5), + NClus2DTotMin = cms.double(-0.5), + NTrk2D = TrackMon.NTrk2D.clone( + NTrk2DBin = 20, + NTrk2DMax = 199.5, + NTrk2DMin = -0.5 + ), + TTRHBuilder = 'WithTrackAngle', + # For plots vs LS + LSBin = 2000, + LSMin = 0., + LSMax = 2000., + # Luminosity based analysis + doLumiAnalysis = False +) diff --git a/DQM/TrackingMonitor/python/MonitorTrackTKCosmicMuons_cfi.py b/DQM/TrackingMonitor/python/MonitorTrackTKCosmicMuons_cfi.py index e3acffcac09af..b642dc1c55cd5 100644 --- a/DQM/TrackingMonitor/python/MonitorTrackTKCosmicMuons_cfi.py +++ b/DQM/TrackingMonitor/python/MonitorTrackTKCosmicMuons_cfi.py @@ -1,15 +1,15 @@ import FWCore.ParameterSet.Config as cms -import DQM.TrackingMonitor.TrackingMonitor_cfi -MonitorTrackTKCosmicMuons = DQM.TrackingMonitor.TrackingMonitor_cfi.TrackMon.clone() -MonitorTrackTKCosmicMuons.TrackProducer = 'ctfWithMaterialTracksP5' -MonitorTrackTKCosmicMuons.AlgoName = 'ctf' -MonitorTrackTKCosmicMuons.FolderName = 'Muons/TKTrack' -MonitorTrackTKCosmicMuons.doBeamSpotPlots = False -MonitorTrackTKCosmicMuons.BSFolderName = 'Muons/TKTrack/BeamSpotParameters' -MonitorTrackTKCosmicMuons.doSeedParameterHistos = False -MonitorTrackTKCosmicMuons.doAllPlots = False -MonitorTrackTKCosmicMuons.doHitPropertiesPlots = True -MonitorTrackTKCosmicMuons.doGeneralPropertiesPlots = True - +from DQM.TrackingMonitor.TrackingMonitor_cfi import * +MonitorTrackTKCosmicMuons = TrackMon.clone( + TrackProducer = 'ctfWithMaterialTracksP5', + AlgoName = 'ctf', + FolderName = 'Muons/TKTrack', + doBeamSpotPlots = False, + BSFolderName = 'Muons/TKTrack/BeamSpotParameters', + doSeedParameterHistos = False, + doAllPlots = False, + doHitPropertiesPlots = True, + doGeneralPropertiesPlots = True +) diff --git a/DQM/TrackingMonitor/python/TrackFoldedOccupancyClient_cfi.py b/DQM/TrackingMonitor/python/TrackFoldedOccupancyClient_cfi.py index 2459646a77224..190428cdd6c4e 100644 --- a/DQM/TrackingMonitor/python/TrackFoldedOccupancyClient_cfi.py +++ b/DQM/TrackingMonitor/python/TrackFoldedOccupancyClient_cfi.py @@ -19,25 +19,25 @@ 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_dzPV0p1 = TrackerMapFoldedClient.clone( + TrackQuality = 'highPurityTracks/dzPV0p1' ) -TrackerMapFoldedClient_highpurity_pt0to1=TrackerMapFoldedClient.clone( - TrackQuality=cms.string('highPurityTracks/pt_0to1') +TrackerMapFoldedClient_highpurity_pt0to1 = TrackerMapFoldedClient.clone( + TrackQuality = 'highPurityTracks/pt_0to1' ) -TrackerMapFoldedClient_highpurity_pt1=TrackerMapFoldedClient.clone( - TrackQuality=cms.string('highPurityTracks/pt_1') +TrackerMapFoldedClient_highpurity_pt1 = TrackerMapFoldedClient.clone( + TrackQuality = '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') +TrackerMapFoldedClient_hiConformalPixelTracks = TrackerMapFoldedClient.clone( + TrackQuality = 'hiConformalPixelTracks' ) -folded_with_conformalpixtkclient= cms.Sequence(TrackerMapFoldedClient_hiConformalPixelTracks+foldedMapClientSeq.copy()) +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/python/TrackerCollisionTrackingMonitor_cfi.py b/DQM/TrackingMonitor/python/TrackerCollisionTrackingMonitor_cfi.py index 76114242a8766..804f98efe4de9 100644 --- a/DQM/TrackingMonitor/python/TrackerCollisionTrackingMonitor_cfi.py +++ b/DQM/TrackingMonitor/python/TrackerCollisionTrackingMonitor_cfi.py @@ -1,89 +1,84 @@ import FWCore.ParameterSet.Config as cms -import DQM.TrackingMonitor.TrackingMonitor_cfi -TrackerCollisionTrackMon = DQM.TrackingMonitor.TrackingMonitor_cfi.TrackMon.clone() - -# Update specific parameters - -# input tags -TrackerCollisionTrackMon.TrackProducer = cms.InputTag("generalTracks") -TrackerCollisionTrackMon.SeedProducer = cms.InputTag("initialStepSeeds") -TrackerCollisionTrackMon.TCProducer = cms.InputTag("initialStepTrackCandidates") -TrackerCollisionTrackMon.ClusterLabels = cms.vstring('Tot','Strip','Pix') # to decide which Seeds-Clusters correlation plots to have default is Total other options 'Strip', 'Pix' -TrackerCollisionTrackMon.beamSpot = cms.InputTag("offlineBeamSpot") -TrackerCollisionTrackMon.primaryVertex = cms.InputTag('offlinePrimaryVertices') -TrackerCollisionTrackMon.primaryVertexInputTags = cms.VInputTag( - cms.InputTag('offlinePrimaryVertices') -) -TrackerCollisionTrackMon.selPrimaryVertexInputTags = cms.VInputTag( - cms.InputTag('goodOfflinePrimaryVertices') -) -TrackerCollisionTrackMon.pvLabels = cms.vstring( - 'offline' +from DQM.TrackingMonitor.TrackingMonitor_cfi import * +TrackerCollisionTrackMon = TrackMon.clone( + # Update specific parameters + + # input tags + TrackProducer = "generalTracks", + SeedProducer = "initialStepSeeds", + TCProducer = "initialStepTrackCandidates", + ClusterLabels = ('Tot','Strip','Pix',), # to decide which Seeds-Clusters correlation plots to have default is Total other options 'Strip', 'Pix' + beamSpot = "offlineBeamSpot", + primaryVertex = 'offlinePrimaryVertices', + primaryVertexInputTags = ('offlinePrimaryVertices',), + selPrimaryVertexInputTags = ('goodOfflinePrimaryVertices',), + pvLabels = ('offline',), + + # output parameters + AlgoName = 'GenTk', + Quality = '', + FolderName = 'Tracking/GlobalParameters', + BSFolderName = 'Tracking/ParametersVsBeamSpot', + + # determines where to evaluate track parameters + # 'ImpactPoint' --> evalutate at impact point + MeasurementState = 'ImpactPoint', + + # which plots to do + doAllPlots = False, + doGoodTrackPlots = cms.bool(True), + doTrackerSpecific = True, + doHitPropertiesPlots = True, + doGeneralPropertiesPlots = True, + doBeamSpotPlots = True, + doSeedParameterHistos = False, + doRecHitVsPhiVsEtaPerTrack = True, + doGoodTrackRecHitVsPhiVsEtaPerTrack = cms.bool(True), + doLayersVsPhiVsEtaPerTrack = True, + doGoodTrackLayersVsPhiVsEtaPerTrack = cms.bool(True), + doPUmonitoring = False, + doPlotsVsBXlumi = False, + doPlotsVsGoodPVtx = True, + doEffFromHitPatternVsPU = True, + doEffFromHitPatternVsBX = True, + doEffFromHitPatternVsLUMI = True, + + # LS analysis + doLumiAnalysis = True, + doProfilesVsLS = True, + + doSeedNumberHisto = False, + doSeedETAHisto = False, + doSeedVsClusterHisto = False, + + # Number of Tracks per Event + TkSizeBin = 600, + TkSizeMax = 2999.5, + TkSizeMin = -0.5, + + # chi2 dof + Chi2NDFBin = 80, + Chi2NDFMax = 79.5, + Chi2NDFMin = -0.5, + + # Number of seeds per Event + TkSeedSizeBin = 100, + TkSeedSizeMax = 499.5, + TkSeedSizeMin = -0.5, + + # Number of Track Cadidates per Event + TCSizeBin = 100, + TCSizeMax = 499.5, + TCSizeMin = -0.5, + + GoodPVtx = TrackMon.GoodPVtx.clone( + GoodPVtxBin = 60, + GoodPVtxMin = 0., + GoodPVtxMax = 60. + ) ) -# output parameters -TrackerCollisionTrackMon.AlgoName = cms.string('GenTk') -TrackerCollisionTrackMon.Quality = cms.string('') -TrackerCollisionTrackMon.FolderName = cms.string('Tracking/GlobalParameters') -TrackerCollisionTrackMon.BSFolderName = cms.string('Tracking/ParametersVsBeamSpot') - -# determines where to evaluate track parameters -# 'ImpactPoint' --> evalutate at impact point -TrackerCollisionTrackMon.MeasurementState = cms.string('ImpactPoint') - -# which plots to do -TrackerCollisionTrackMon.doAllPlots = cms.bool(False) -TrackerCollisionTrackMon.doGoodTrackPlots = cms.bool(True) -TrackerCollisionTrackMon.doTrackerSpecific = cms.bool(True) -TrackerCollisionTrackMon.doHitPropertiesPlots = cms.bool(True) -TrackerCollisionTrackMon.doGeneralPropertiesPlots = cms.bool(True) -TrackerCollisionTrackMon.doBeamSpotPlots = cms.bool(True) -TrackerCollisionTrackMon.doSeedParameterHistos = cms.bool(False) -TrackerCollisionTrackMon.doRecHitVsPhiVsEtaPerTrack = cms.bool(True) -TrackerCollisionTrackMon.doGoodTrackRecHitVsPhiVsEtaPerTrack = cms.bool(True) -TrackerCollisionTrackMon.doLayersVsPhiVsEtaPerTrack = cms.bool(True) -TrackerCollisionTrackMon.doGoodTrackLayersVsPhiVsEtaPerTrack = cms.bool(True) -TrackerCollisionTrackMon.doPUmonitoring = cms.bool(False) -TrackerCollisionTrackMon.doPlotsVsBXlumi = cms.bool(False) -TrackerCollisionTrackMon.doPlotsVsGoodPVtx = cms.bool(True) -TrackerCollisionTrackMon.doEffFromHitPatternVsPU = cms.bool(True) -TrackerCollisionTrackMon.doEffFromHitPatternVsBX = cms.bool(True) -TrackerCollisionTrackMon.doEffFromHitPatternVsLUMI = cms.bool(True) - -# LS analysis -TrackerCollisionTrackMon.doLumiAnalysis = cms.bool(True) -TrackerCollisionTrackMon.doProfilesVsLS = cms.bool(True) - -TrackerCollisionTrackMon.doSeedNumberHisto = cms.bool(False) -TrackerCollisionTrackMon.doSeedETAHisto = cms.bool(False) -TrackerCollisionTrackMon.doSeedVsClusterHisto = cms.bool(False) - -# Number of Tracks per Event -TrackerCollisionTrackMon.TkSizeBin = cms.int32(600) -TrackerCollisionTrackMon.TkSizeMax = cms.double(2999.5) -TrackerCollisionTrackMon.TkSizeMin = cms.double(-0.5) - -# chi2 dof -TrackerCollisionTrackMon.Chi2NDFBin = cms.int32(80) -TrackerCollisionTrackMon.Chi2NDFMax = cms.double(79.5) -TrackerCollisionTrackMon.Chi2NDFMin = cms.double(-0.5) - -# Number of seeds per Event -TrackerCollisionTrackMon.TkSeedSizeBin = cms.int32(100) -TrackerCollisionTrackMon.TkSeedSizeMax = cms.double(499.5) -TrackerCollisionTrackMon.TkSeedSizeMin = cms.double(-0.5) - -# Number of Track Cadidates per Event -TrackerCollisionTrackMon.TCSizeBin = cms.int32(100) -TrackerCollisionTrackMon.TCSizeMax = cms.double(499.5) -TrackerCollisionTrackMon.TCSizeMin = cms.double(-0.5) - -TrackerCollisionTrackMon.GoodPVtx.GoodPVtxBin = cms.int32(60) -TrackerCollisionTrackMon.GoodPVtx.GoodPVtxMin = cms.double( 0.) -TrackerCollisionTrackMon.GoodPVtx.GoodPVtxMax = cms.double(60.) - - from Configuration.Eras.Modifier_run3_common_cff import run3_common run3_common.toModify(TrackerCollisionTrackMon, GoodPVtx=dict(GoodPVtxBin = 150, GoodPVtxMax = 150.)) run3_common.toModify(TrackerCollisionTrackMon, NTrkPVtx=dict(NTrkPVtxMax = 200.)) diff --git a/DQM/TrackingMonitor/python/TrackerCosmicsTrackingMonitor_cfi.py b/DQM/TrackingMonitor/python/TrackerCosmicsTrackingMonitor_cfi.py index f4af09dfbeced..ca90617e655da 100644 --- a/DQM/TrackingMonitor/python/TrackerCosmicsTrackingMonitor_cfi.py +++ b/DQM/TrackingMonitor/python/TrackerCosmicsTrackingMonitor_cfi.py @@ -1,42 +1,42 @@ import FWCore.ParameterSet.Config as cms -import DQM.TrackingMonitor.TrackingMonitor_cfi -TrackerCosmicTrackMon = DQM.TrackingMonitor.TrackingMonitor_cfi.TrackMon.clone() +from DQM.TrackingMonitor.TrackingMonitor_cfi import * +TrackerCosmicTrackMon = TrackMon.clone( + # Update specific parameters + SeedProducer = "combinedP5SeedsForCTF", + TCProducer = "ckfTrackCandidatesP5", + beamSpot = "offlineBeamSpot", -# Update specific parameters -TrackerCosmicTrackMon.SeedProducer = cms.InputTag("combinedP5SeedsForCTF") -TrackerCosmicTrackMon.TCProducer = cms.InputTag("ckfTrackCandidatesP5") -TrackerCosmicTrackMon.beamSpot = cms.InputTag("offlineBeamSpot") + MeasurementState = 'default', -TrackerCosmicTrackMon.MeasurementState = cms.string('default') + doAllPlots = False, + doHitPropertiesPlots = True, + doGeneralPropertiesPlots = True, + doBeamSpotPlots = False, + doSeedParameterHistos = False, -TrackerCosmicTrackMon.doAllPlots = cms.bool(False) -TrackerCosmicTrackMon.doHitPropertiesPlots = cms.bool(True) -TrackerCosmicTrackMon.doGeneralPropertiesPlots = cms.bool(True) -TrackerCosmicTrackMon.doBeamSpotPlots = cms.bool(False) -TrackerCosmicTrackMon.doSeedParameterHistos = cms.bool(False) + Chi2Max = 500.0, -TrackerCosmicTrackMon.Chi2Max = cms.double(500.0) + TkSizeBin = 25, + TkSizeMax = 24.5, -TrackerCosmicTrackMon.TkSizeBin = cms.int32(25) -TrackerCosmicTrackMon.TkSizeMax = cms.double(24.5) + TkSeedSizeBin = 20, + TkSeedSizeMax = 19.5, -TrackerCosmicTrackMon.TkSeedSizeBin = cms.int32(20) -TrackerCosmicTrackMon.TkSeedSizeMax = cms.double(19.5) + RecLayBin = 35, + RecLayMax = 34.5, -TrackerCosmicTrackMon.RecLayBin = cms.int32(35) -TrackerCosmicTrackMon.RecLayMax = cms.double(34.5) + TrackPtMax = 30.0, + TrackPtMin = -0.5, -TrackerCosmicTrackMon.TrackPtMax = cms.double(30.0) -TrackerCosmicTrackMon.TrackPtMin = cms.double(-0.5) + TrackPxMax = 50.0, + TrackPxMin = -50.0, -TrackerCosmicTrackMon.TrackPxMax = cms.double(50.0) -TrackerCosmicTrackMon.TrackPxMin = cms.double(-50.0) + TrackPyMax = 50.0, + TrackPyMin = -50.0, -TrackerCosmicTrackMon.TrackPyMax = cms.double(50.0) -TrackerCosmicTrackMon.TrackPyMin = cms.double(-50.0) + TrackPzMax = 50.0, + TrackPzMin = -50.0, -TrackerCosmicTrackMon.TrackPzMax = cms.double(50.0) -TrackerCosmicTrackMon.TrackPzMin = cms.double(-50.0) - -TrackerCosmicTrackMon.doLumiAnalysis = cms.bool(False) + doLumiAnalysis = False +) diff --git a/DQM/TrackingMonitor/python/TrackerHeavyIonTrackingMonitor_cfi.py b/DQM/TrackingMonitor/python/TrackerHeavyIonTrackingMonitor_cfi.py index deb37b67ecc74..6bd94daa39997 100644 --- a/DQM/TrackingMonitor/python/TrackerHeavyIonTrackingMonitor_cfi.py +++ b/DQM/TrackingMonitor/python/TrackerHeavyIonTrackingMonitor_cfi.py @@ -1,41 +1,37 @@ import FWCore.ParameterSet.Config as cms -import DQM.TrackingMonitor.TrackingMonitor_cfi -TrackerHeavyIonTrackMon = DQM.TrackingMonitor.TrackingMonitor_cfi.TrackMon.clone() - -# Update specific parameters - -TrackerHeavyIonTrackMon.TrackProducer = cms.InputTag("hiGeneralTracks") -TrackerHeavyIonTrackMon.SeedProducer = cms.InputTag("hiPixelTrackSeeds") -TrackerHeavyIonTrackMon.TCProducer = cms.InputTag("hiPrimTrackCandidates") -TrackerHeavyIonTrackMon.beamSpot = cms.InputTag("offlineBeamSpot") -TrackerHeavyIonTrackMon.primaryVertex = cms.InputTag('hiSelectedVertex') - - -TrackerHeavyIonTrackMon.doHIPlots = cms.bool(True) - - -TrackerHeavyIonTrackMon.AlgoName = cms.string('HeavyIonTk') -TrackerHeavyIonTrackMon.Quality = cms.string('') -TrackerHeavyIonTrackMon.FolderName = cms.string('Tracking/GlobalParameters') -TrackerHeavyIonTrackMon.BSFolderName = cms.string('Tracking/BeamSpotParameters') - -TrackerHeavyIonTrackMon.MeasurementState = cms.string('ImpactPoint') - -TrackerHeavyIonTrackMon.doTrackerSpecific = cms.bool(True) -TrackerHeavyIonTrackMon.doAllPlots = cms.bool(True) -TrackerHeavyIonTrackMon.doBeamSpotPlots = cms.bool(True) -TrackerHeavyIonTrackMon.doSeedParameterHistos = cms.bool(True) - -TrackerHeavyIonTrackMon.doLumiAnalysis = cms.bool(True) - -# Number of Tracks per Event -TrackerHeavyIonTrackMon.TkSizeBin = cms.int32(600) -TrackerHeavyIonTrackMon.TkSizeMax = cms.double(1799.5) -TrackerHeavyIonTrackMon.TkSizeMin = cms.double(-0.5) - -# chi2 dof -TrackerHeavyIonTrackMon.Chi2NDFBin = cms.int32(160) -TrackerHeavyIonTrackMon.Chi2NDFMax = cms.double(79.5) -TrackerHeavyIonTrackMon.Chi2NDFMin = cms.double(-0.5) - +from DQM.TrackingMonitor.TrackingMonitor_cfi import * +TrackerHeavyIonTrackMon = TrackMon.clone( + # Update specific parameters + TrackProducer = "hiGeneralTracks", + SeedProducer = "hiPixelTrackSeeds", + TCProducer = "hiPrimTrackCandidates", + beamSpot = "offlineBeamSpot", + primaryVertex = 'hiSelectedVertex', + + doHIPlots = True, + + AlgoName = 'HeavyIonTk', + Quality = '', + FolderName = 'Tracking/GlobalParameters', + BSFolderName = 'Tracking/BeamSpotParameters', + + MeasurementState = 'ImpactPoint', + + doTrackerSpecific = True, + doAllPlots = True, + doBeamSpotPlots = True, + doSeedParameterHistos = True, + + doLumiAnalysis = True, + + # Number of Tracks per Event + TkSizeBin = 600, + TkSizeMax = 1799.5, + TkSizeMin = -0.5, + + # chi2 dof + Chi2NDFBin = 160, + Chi2NDFMax = 79.5, + Chi2NDFMin = -0.5 +) diff --git a/DQM/TrackingMonitor/python/TrackingMonitorAllTrackingSequences_cff.py b/DQM/TrackingMonitor/python/TrackingMonitorAllTrackingSequences_cff.py index a94f0b43340ec..314357ff45ab6 100644 --- a/DQM/TrackingMonitor/python/TrackingMonitorAllTrackingSequences_cff.py +++ b/DQM/TrackingMonitor/python/TrackingMonitorAllTrackingSequences_cff.py @@ -18,75 +18,81 @@ # ---------------------------------------------------------------------------# # generalTracks -TrackMonGenTk = TrackMon.clone() -TrackMonGenTk.TrackProducer = cms.InputTag("generalTracks") -TrackMonGenTk.beamSpot = cms.InputTag("offlineBeamSpot") -TrackMonGenTk.FolderName = cms.string('Tracking/GenTk/GlobalParameters') -TrackMonGenTk.BSFolderName = cms.string('Tracking/GenTk/BeamSpotParameters') -TrackMonGenTk.AlgoName = cms.string('GenTk') -TrackMonGenTk.doSeedParameterHistos = cms.bool(False) +TrackMonGenTk = TrackMon.clone( + TrackProducer = "generalTracks", + beamSpot = "offlineBeamSpot", + FolderName = 'Tracking/GenTk/GlobalParameters', + BSFolderName = 'Tracking/GenTk/BeamSpotParameters', + AlgoName = 'GenTk', + doSeedParameterHistos = False +) # Step0 -TrackMonStep0 = TrackMon.clone() -TrackMonStep0.TrackProducer = cms.InputTag("zeroStepTracksWithQuality") -TrackMonStep0.SeedProducer = cms.InputTag("initialStepSeeds") -TrackMonStep0.TCProducer = cms.InputTag("initialStepTrackCandidates") -TrackMonStep0.beamSpot = cms.InputTag("offlineBeamSpot") -TrackMonStep0.FolderName = cms.string('Tracking/Step0/GlobalParameters') -TrackMonStep0.BSFolderName = cms.string('Tracking/Step0/BeamSpotParameters') -TrackMonStep0.AlgoName = cms.string('Step0') -TrackMonStep0.doSeedParameterHistos = cms.bool(True) -TrackMonStep0.doTrackCandHistos = cms.bool(True) +TrackMonStep0 = TrackMon.clone( + TrackProducer = "zeroStepTracksWithQuality", + SeedProducer = "initialStepSeeds", + TCProducer = "initialStepTrackCandidates", + beamSpot = "offlineBeamSpot", + FolderName = 'Tracking/Step0/GlobalParameters', + BSFolderName = 'Tracking/Step0/BeamSpotParameters', + AlgoName = 'Step0', + doSeedParameterHistos = True, + doTrackCandHistos = True +) # Step1 -TrackMonStep1 = TrackMon.clone() -TrackMonStep1.TrackProducer = cms.InputTag("preMergingFirstStepTracksWithQuality") -TrackMonStep1.SeedProducer = cms.InputTag("newSeedFromPairs") -TrackMonStep1.TCProducer = cms.InputTag("stepOneTrackCandidateMaker") -TrackMonStep1.beamSpot = cms.InputTag("offlineBeamSpot") -TrackMonStep1.FolderName = cms.string('Tracking/Step1/GlobalParameters') -TrackMonStep1.BSFolderName = cms.string('Tracking/Step1/BeamSpotParameters') -TrackMonStep1.AlgoName = cms.string('Step1') -TrackMonStep1.doSeedParameterHistos = cms.bool(True) -TrackMonStep1.doTrackCandHistos = cms.bool(True) +TrackMonStep1 = TrackMon.clone( + TrackProducer = "preMergingFirstStepTracksWithQuality", + SeedProducer = "newSeedFromPairs", + TCProducer = "stepOneTrackCandidateMaker", + beamSpot = "offlineBeamSpot", + FolderName = 'Tracking/Step1/GlobalParameters', + BSFolderName = 'Tracking/Step1/BeamSpotParameters', + AlgoName = 'Step1', + doSeedParameterHistos = True, + doTrackCandHistos = True +) # Step2 -TrackMonStep2 = TrackMon.clone() -TrackMonStep2.TrackProducer = cms.InputTag("secStep") -TrackMonStep2.SeedProducer = cms.InputTag("secTriplets") -TrackMonStep2.TCProducer = cms.InputTag("secTrackCandidates") -TrackMonStep2.beamSpot = cms.InputTag("offlineBeamSpot") -TrackMonStep2.FolderName = cms.string('Tracking/Step2/GlobalParameters') -TrackMonStep2.BSFolderName = cms.string('Tracking/Step2/BeamSpotParameters') -TrackMonStep2.AlgoName = cms.string('Step2') -TrackMonStep2.doSeedParameterHistos = cms.bool(True) -TrackMonStep2.doTrackCandHistos = cms.bool(True) +TrackMonStep2 = TrackMon.clone( + TrackProducer = "secStep", + SeedProducer = "secTriplets", + TCProducer = "secTrackCandidates", + beamSpot = "offlineBeamSpot", + FolderName = 'Tracking/Step2/GlobalParameters', + BSFolderName = 'Tracking/Step2/BeamSpotParameters', + AlgoName = 'Step2', + doSeedParameterHistos = True, + doTrackCandHistos = True +) # Step4 -TrackMonStep4 = TrackMon.clone() -TrackMonStep4.TrackProducer = cms.InputTag("pixellessStep") -TrackMonStep4.SeedProducer = cms.InputTag("fourthPLSeeds") -TrackMonStep4.TCProducer = cms.InputTag("fourthTrackCandidates") -TrackMonStep4.beamSpot = cms.InputTag("offlineBeamSpot") -TrackMonStep4.FolderName = cms.string('Tracking/Step4/GlobalParameters') -TrackMonStep4.BSFolderName = cms.string('Tracking/Step4/BeamSpotParameters') -TrackMonStep4.AlgoName = cms.string('Step4') -TrackMonStep4.doSeedParameterHistos = cms.bool(True) -TrackMonStep4.doTrackCandHistos = cms.bool(True) +TrackMonStep4 = TrackMon.clone( + TrackProducer = "pixellessStep", + SeedProducer = "fourthPLSeeds", + TCProducer = "fourthTrackCandidates", + beamSpot = "offlineBeamSpot", + FolderName = 'Tracking/Step4/GlobalParameters', + BSFolderName = 'Tracking/Step4/BeamSpotParameters', + AlgoName = 'Step4', + doSeedParameterHistos = True, + doTrackCandHistos = True +) # Step4 -TrackMonStep5 = TrackMon.clone() -TrackMonStep5.TrackProducer = cms.InputTag("tobtecStep") -TrackMonStep5.SeedProducer = cms.InputTag("fifthSeeds") -TrackMonStep5.TCProducer = cms.InputTag("fifthTrackCandidates") -TrackMonStep5.beamSpot = cms.InputTag("offlineBeamSpot") -TrackMonStep5.FolderName = cms.string('Tracking/Step5/GlobalParameters') -TrackMonStep5.BSFolderName = cms.string('Tracking/Step5/BeamSpotParameters') -TrackMonStep5.AlgoName = cms.string('Step5') -TrackMonStep5.doSeedParameterHistos = cms.bool(True) -TrackMonStep5.doTrackCandHistos = cms.bool(True) +TrackMonStep5 = TrackMon.clone( + TrackProducer = "tobtecStep", + SeedProducer = "fifthSeeds", + TCProducer = "fifthTrackCandidates", + beamSpot = "offlineBeamSpot", + FolderName = 'Tracking/Step5/GlobalParameters', + BSFolderName = 'Tracking/Step5/BeamSpotParameters', + AlgoName = 'Step5', + doSeedParameterHistos = True, + doTrackCandHistos = True +) # high Purity # ---------------------------------------------------------------------------# @@ -95,16 +101,6 @@ - - - - - - - - - - #------------------------------------------------- # Paths #------------------------------------------------- diff --git a/DQM/TrackingMonitor/python/TrackingMonitorSeedNumber_cff.py b/DQM/TrackingMonitor/python/TrackingMonitorSeedNumber_cff.py index 3525a3b1fea99..206b31dcfc5b7 100644 --- a/DQM/TrackingMonitor/python/TrackingMonitorSeedNumber_cff.py +++ b/DQM/TrackingMonitor/python/TrackingMonitorSeedNumber_cff.py @@ -3,120 +3,129 @@ #------------------------------------------------- # Tracking Monitor #------------------------------------------------- -import DQM.TrackingMonitor.TrackingMonitorSeed_cfi +from DQM.TrackingMonitor.TrackingMonitorSeed_cfi import * -TrackMonStep0 = DQM.TrackingMonitor.TrackingMonitorSeed_cfi.TrackMonSeed.clone() -TrackMonStep0.TrackProducer = cms.InputTag("generalTracks") -TrackMonStep0.SeedProducer = cms.InputTag("initialStepSeeds") -TrackMonStep0.TCProducer = cms.InputTag("initialStepTrackCandidates") -TrackMonStep0.AlgoName = cms.string('initialStep') -TrackMonStep0.TkSeedSizeBin = cms.int32(100) # could be 50 ? -TrackMonStep0.TkSeedSizeMax = cms.double(5000) -TrackMonStep0.TkSeedSizeMin = cms.double(0) -TrackMonStep0.NClusPxBin = cms.int32(100) -TrackMonStep0.NClusPxMax = cms.double(20000) -TrackMonStep0.ClusterLabels = cms.vstring('Pix') +TrackMonStep0 = TrackMonSeed.clone( + TrackProducer = "generalTracks", + SeedProducer = "initialStepSeeds", + TCProducer = "initialStepTrackCandidates", + AlgoName = 'initialStep', + TkSeedSizeBin = 100, # could be 50 ? + TkSeedSizeMax = 5000., + TkSeedSizeMin = 0., + NClusPxBin = 100, + NClusPxMax = 20000., + ClusterLabels = ('Pix',) +) -TrackMonStep1 = DQM.TrackingMonitor.TrackingMonitorSeed_cfi.TrackMonSeed.clone() -TrackMonStep1.TrackProducer = cms.InputTag("generalTracks") -TrackMonStep1.SeedProducer = cms.InputTag("lowPtTripletStepSeeds") -TrackMonStep1.TCProducer = cms.InputTag("lowPtTripletStepTrackCandidates") -TrackMonStep1.AlgoName = cms.string('lowPtTripletStep') -TrackMonStep1.TkSeedSizeBin = cms.int32(100) -TrackMonStep1.TkSeedSizeMax = cms.double(30000) -TrackMonStep1.TkSeedSizeMin = cms.double(0) -TrackMonStep1.NClusPxBin = cms.int32(100) -TrackMonStep1.NClusPxMax = cms.double(20000) -TrackMonStep1.ClusterLabels = cms.vstring('Pix') +TrackMonStep1 = TrackMonSeed.clone( + TrackProducer = "generalTracks", + SeedProducer = "lowPtTripletStepSeeds", + TCProducer = "lowPtTripletStepTrackCandidates", + AlgoName = 'lowPtTripletStep', + TkSeedSizeBin = 100, + TkSeedSizeMax = 30000., + TkSeedSizeMin = 0., + NClusPxBin = 100, + NClusPxMax = 20000., + ClusterLabels = ('Pix',) +) -TrackMonStep2 = DQM.TrackingMonitor.TrackingMonitorSeed_cfi.TrackMonSeed.clone() -TrackMonStep2.TrackProducer = cms.InputTag("generalTracks") -TrackMonStep2.SeedProducer = cms.InputTag("pixelPairStepSeeds") -TrackMonStep2.TCProducer = cms.InputTag("pixelPairStepTrackCandidates") -TrackMonStep2.AlgoName = cms.string('pixelPairStep') -TrackMonStep2.TkSeedSizeBin = cms.int32(400) -TrackMonStep2.TkSeedSizeMax = cms.double(100000) -TrackMonStep2.TkSeedSizeMin = cms.double(0) -TrackMonStep2.TCSizeMax = cms.double(199.5) -TrackMonStep2.NClusPxBin = cms.int32(100) -TrackMonStep2.NClusPxMax = cms.double(20000) -TrackMonStep2.ClusterLabels = cms.vstring('Pix') +TrackMonStep2 = TrackMonSeed.clone( + TrackProducer = "generalTracks", + SeedProducer = "pixelPairStepSeeds", + TCProducer = "pixelPairStepTrackCandidates", + AlgoName = 'pixelPairStep', + TkSeedSizeBin = 400, + TkSeedSizeMax = 100000., + TkSeedSizeMin = 0., + TCSizeMax = 199.5, + NClusPxBin = 100, + NClusPxMax = 20000., + ClusterLabels = ('Pix',) +) -TrackMonStep3 = DQM.TrackingMonitor.TrackingMonitorSeed_cfi.TrackMonSeed.clone() -TrackMonStep3.TrackProducer = cms.InputTag("generalTracks") -TrackMonStep3.SeedProducer = cms.InputTag("detachedTripletStepSeeds") -TrackMonStep3.TCProducer = cms.InputTag("detachedTripletStepTrackCandidates") -TrackMonStep3.AlgoName = cms.string('detachedTripletStep') -TrackMonStep3.TkSeedSizeBin = cms.int32(100) -TrackMonStep3.TkSeedSizeMax = cms.double(30000) -TrackMonStep3.TkSeedSizeMin = cms.double(0) -TrackMonStep3.NClusPxBin = cms.int32(100) -TrackMonStep3.NClusPxMax = cms.double(20000) -TrackMonStep3.ClusterLabels = cms.vstring('Pix') +TrackMonStep3 = TrackMonSeed.clone( + TrackProducer = "generalTracks", + SeedProducer = "detachedTripletStepSeeds", + TCProducer = "detachedTripletStepTrackCandidates", + AlgoName = 'detachedTripletStep', + TkSeedSizeBin = 100, + TkSeedSizeMax = 30000., + TkSeedSizeMin = 0., + NClusPxBin = 100, + NClusPxMax = 20000., + ClusterLabels = ('Pix',) +) -TrackMonStep4 = DQM.TrackingMonitor.TrackingMonitorSeed_cfi.TrackMonSeed.clone() -TrackMonStep4.TrackProducer = cms.InputTag("generalTracks") -TrackMonStep4.SeedProducer = cms.InputTag("mixedTripletStepSeeds") -TrackMonStep4.TCProducer = cms.InputTag("mixedTripletStepTrackCandidates") -TrackMonStep4.AlgoName = cms.string('mixedTripletStep') -TrackMonStep4.TkSeedSizeBin = cms.int32(400) -TrackMonStep4.TkSeedSizeMax = cms.double(200000) -TrackMonStep4.TkSeedSizeMin = cms.double(0) -TrackMonStep4.TCSizeMax = cms.double(199.5) -TrackMonStep4.NClusStrBin = cms.int32(500) -TrackMonStep4.NClusStrMax = cms.double(100000) -TrackMonStep4.ClusterLabels = cms.vstring('Tot') +TrackMonStep4 = TrackMonSeed.clone( + TrackProducer = "generalTracks", + SeedProducer = "mixedTripletStepSeeds", + TCProducer = "mixedTripletStepTrackCandidates", + AlgoName = 'mixedTripletStep', + TkSeedSizeBin = 400, + TkSeedSizeMax = 200000., + TkSeedSizeMin = 0., + TCSizeMax = 199.5, + NClusStrBin = 500, + NClusStrMax = 100000., + ClusterLabels = ('Tot',) +) -TrackMonStep5 = DQM.TrackingMonitor.TrackingMonitorSeed_cfi.TrackMonSeed.clone() -TrackMonStep5.TrackProducer = cms.InputTag("generalTracks") -TrackMonStep5.SeedProducer = cms.InputTag("pixelLessStepSeeds") -TrackMonStep5.TCProducer = cms.InputTag("pixelLessStepTrackCandidates") -TrackMonStep5.AlgoName = cms.string('pixelLessStep') -TrackMonStep5.TkSeedSizeBin = cms.int32(400) -TrackMonStep5.TkSeedSizeMax = cms.double(200000) -TrackMonStep5.TkSeedSizeMin = cms.double(0) -TrackMonStep5.NClusStrBin = cms.int32(500) -TrackMonStep5.NClusStrMax = cms.double(100000) -TrackMonStep5.ClusterLabels = cms.vstring('Strip') +TrackMonStep5 = TrackMonSeed.clone( + TrackProducer = "generalTracks", + SeedProducer = "pixelLessStepSeeds", + TCProducer = "pixelLessStepTrackCandidates", + AlgoName = 'pixelLessStep', + TkSeedSizeBin = 400, + TkSeedSizeMax = 200000., + TkSeedSizeMin = 0., + NClusStrBin = 500, + NClusStrMax = 100000., + ClusterLabels = ('Strip',) +) -TrackMonStep6 = DQM.TrackingMonitor.TrackingMonitorSeed_cfi.TrackMonSeed.clone() -TrackMonStep6.TrackProducer = cms.InputTag("generalTracks") -TrackMonStep6.SeedProducer = cms.InputTag("tobTecStepSeeds") -TrackMonStep6.TCProducer = cms.InputTag("tobTecStepTrackCandidates") -TrackMonStep6.AlgoName = cms.string('tobTecStep') -TrackMonStep6.TkSeedSizeBin = cms.int32(400) -TrackMonStep6.TkSeedSizeMax = cms.double(100000) -TrackMonStep6.TkSeedSizeMin = cms.double(0) -TrackMonStep6.TCSizeMax = cms.double(199.5) -TrackMonStep6.NClusStrBin = cms.int32(500) -TrackMonStep6.NClusStrMax = cms.double(100000) -TrackMonStep6.ClusterLabels = cms.vstring('Strip') +TrackMonStep6 = TrackMonSeed.clone( + TrackProducer = "generalTracks", + SeedProducer = "tobTecStepSeeds", + TCProducer = "tobTecStepTrackCandidates", + AlgoName = 'tobTecStep', + TkSeedSizeBin = 400, + TkSeedSizeMax = 100000., + TkSeedSizeMin = 0., + TCSizeMax = 199.5, + NClusStrBin = 500, + NClusStrMax = 100000., + ClusterLabels = ('Strip',) +) -TrackMonStep9 = DQM.TrackingMonitor.TrackingMonitorSeed_cfi.TrackMonSeed.clone() -TrackMonStep9.TrackProducer = cms.InputTag("generalTracks") -TrackMonStep9.SeedProducer = cms.InputTag("muonSeededSeedsInOut") -TrackMonStep9.TCProducer = cms.InputTag("muonSeededTrackCandidatesInOut") -TrackMonStep9.AlgoName = cms.string('muonSeededStepInOut') -TrackMonStep9.TkSeedSizeBin = cms.int32(15) -TrackMonStep9.TkSeedSizeMax = cms.double(14.5) -TrackMonStep9.TkSeedSizeMin = cms.double(-0.5) -TrackMonStep9.TCSizeMax = cms.double(199.5) -TrackMonStep9.NClusStrBin = cms.int32(500) -TrackMonStep9.NClusStrMax = cms.double(100000) -TrackMonStep9.ClusterLabels = cms.vstring('Strip') +TrackMonStep9 = TrackMonSeed.clone( + TrackProducer = "generalTracks", + SeedProducer = "muonSeededSeedsInOut", + TCProducer = "muonSeededTrackCandidatesInOut", + AlgoName = 'muonSeededStepInOut', + TkSeedSizeBin = 15, + TkSeedSizeMax = 14.5, + TkSeedSizeMin = -0.5, + TCSizeMax = 199.5, + NClusStrBin = 500, + NClusStrMax = 100000., + ClusterLabels = ('Strip',) +) -TrackMonStep10 = DQM.TrackingMonitor.TrackingMonitorSeed_cfi.TrackMonSeed.clone() -TrackMonStep10.TrackProducer = cms.InputTag("generalTracks") -TrackMonStep10.SeedProducer = cms.InputTag("muonSeededSeedsOutIn") -TrackMonStep10.TCProducer = cms.InputTag("muonSeededTrackCandidatesOutIn") -TrackMonStep10.AlgoName = cms.string('muonSeededStepOutIn') -TrackMonStep10.TkSeedSizeBin = cms.int32(15) -TrackMonStep10.TkSeedSizeMax = cms.double(14.5) -TrackMonStep10.TkSeedSizeMin = cms.double(-0.5) -TrackMonStep10.TCSizeMax = cms.double(199.5) -TrackMonStep10.NClusStrBin = cms.int32(500) -TrackMonStep10.NClusStrMax = cms.double(100000) -TrackMonStep10.ClusterLabels = cms.vstring('Strip') +TrackMonStep10 = TrackMonSeed.clone( + TrackProducer = "generalTracks", + SeedProducer = "muonSeededSeedsOutIn", + TCProducer = "muonSeededTrackCandidatesOutIn", + AlgoName = 'muonSeededStepOutIn', + TkSeedSizeBin = 15, + TkSeedSizeMax = 14.5, + TkSeedSizeMin = -0.5, + TCSizeMax = 199.5, + NClusStrBin = 500, + NClusStrMax = 100000., + ClusterLabels = ('Strip',) +) # out of the box trackMonIterativeTracking2012 = cms.Sequence( diff --git a/DQM/TrackingMonitor/python/TrackingMonitorSeed_cfi.py b/DQM/TrackingMonitor/python/TrackingMonitorSeed_cfi.py index f3b94cc8ef27c..ac7eaf1dee902 100644 --- a/DQM/TrackingMonitor/python/TrackingMonitorSeed_cfi.py +++ b/DQM/TrackingMonitor/python/TrackingMonitorSeed_cfi.py @@ -1,33 +1,33 @@ import FWCore.ParameterSet.Config as cms -import DQM.TrackingMonitor.TrackingMonitor_cfi +from DQM.TrackingMonitor.TrackingMonitor_cfi import * -TrackMonSeed = DQM.TrackingMonitor.TrackingMonitor_cfi.TrackMon.clone() - -TrackMonSeed.MeasurementState = cms.string('ImpactPoint') -TrackMonSeed.FolderName = cms.string('Tracking/TrackParameters') -TrackMonSeed.BSFolderName = cms.string('Tracking/TrackParameters/BeamSpotParameters') -TrackMonSeed.AlgoName = cms.string('Seed') -#TrackMonSeed.doGoodTrackPlots = cms.bool(False) -TrackMonSeed.doTrackerSpecific = cms.bool(False) -TrackMonSeed.doAllPlots = cms.bool(False) -TrackMonSeed.doHitPropertiesPlots = cms.bool(False) -TrackMonSeed.doGeneralPropertiesPlots = cms.bool(False) -TrackMonSeed.doBeamSpotPlots = cms.bool(False) -TrackMonSeed.doSeedParameterHistos = cms.bool(False) -TrackMonSeed.doLumiAnalysis = cms.bool(False) -TrackMonSeed.doMeasurementStatePlots = cms.bool(False) -TrackMonSeed.doRecHitsPerTrackProfile = cms.bool(False) -TrackMonSeed.doRecHitVsPhiVsEtaPerTrack = cms.bool(False) -#TrackMonSeed.doGoodTrackRecHitVsPhiVsEtaPerTrack = cms.bool(False) -# -# plot on Seed (total number, pt, seed # vs cluster) -# -TrackMonSeed.doSeedNumberHisto = cms.bool(True) -TrackMonSeed.doSeedLumiAnalysis = cms.bool(True) -TrackMonSeed.doSeedVsClusterHisto = cms.bool(True) -TrackMonSeed.doSeedPTHisto = cms.bool(True) -TrackMonSeed.doSeedETAHisto = cms.bool(True) -TrackMonSeed.doSeedPHIHisto = cms.bool(True) -TrackMonSeed.doSeedPHIVsETAHisto = cms.bool(True) -TrackMonSeed.doStopSource = cms.bool(True) +TrackMonSeed = TrackMon.clone( + MeasurementState = 'ImpactPoint', + FolderName = 'Tracking/TrackParameters', + BSFolderName = 'Tracking/TrackParameters/BeamSpotParameters', + AlgoName = 'Seed', + #doGoodTrackPlots = False, + doTrackerSpecific = False, + doAllPlots = False, + doHitPropertiesPlots = False, + doGeneralPropertiesPlots = False, + doBeamSpotPlots = False, + doSeedParameterHistos = False, + doLumiAnalysis = False, + doMeasurementStatePlots = False, + doRecHitsPerTrackProfile = False, + doRecHitVsPhiVsEtaPerTrack = False, + #doGoodTrackRecHitVsPhiVsEtaPerTrack = False, + # + # plot on Seed (total number, pt, seed # vs cluster) + # + doSeedNumberHisto = True, + doSeedLumiAnalysis = True, + doSeedVsClusterHisto = True, + doSeedPTHisto = True, + doSeedETAHisto = True, + doSeedPHIHisto = True, + doSeedPHIVsETAHisto = True, + doStopSource = True +) diff --git a/DQM/TrackingMonitor/python/V0Monitor_cff.py b/DQM/TrackingMonitor/python/V0Monitor_cff.py index 05cb3fb688dcf..17732554bd7f4 100644 --- a/DQM/TrackingMonitor/python/V0Monitor_cff.py +++ b/DQM/TrackingMonitor/python/V0Monitor_cff.py @@ -2,22 +2,28 @@ from DQM.TrackingMonitor.V0Monitor_cfi import * -KshortMonitoring = v0Monitor.clone() -KshortMonitoring.FolderName = cms.string("Tracking/V0Monitoring/Ks") -KshortMonitoring.v0 = cms.InputTag('generalV0Candidates:Kshort') -KshortMonitoring.histoPSet.massPSet = cms.PSet( - nbins = cms.int32 ( 100 ), - xmin = cms.double( 0.400), - xmax = cms.double( 0.600), +KshortMonitoring = v0Monitor.clone( + FolderName = "Tracking/V0Monitoring/Ks", + v0 = 'generalV0Candidates:Kshort', + histoPSet = v0Monitor.histoPSet.clone( + massPSet = v0Monitor.histoPSet.massPSet.clone( + nbins = 100, + xmin = 0.400, + xmax = 0.600 + ) + ) ) -LambdaMonitoring = v0Monitor.clone() -LambdaMonitoring.FolderName = cms.string("Tracking/V0Monitoring/Lambda") -LambdaMonitoring.v0 = cms.InputTag('generalV0Candidates:Lambda') -LambdaMonitoring.histoPSet.massPSet = cms.PSet( - nbins = cms.int32 ( 100 ), - xmin = cms.double( 1.050 ), - xmax = cms.double( 1.250 ) +LambdaMonitoring = v0Monitor.clone( + FolderName = "Tracking/V0Monitoring/Lambda", + v0 = 'generalV0Candidates:Lambda', + histoPSet = v0Monitor.histoPSet.clone( + massPSet = v0Monitor.histoPSet.massPSet.clone( + nbins = 100, + xmin = 1.050, + xmax = 1.250 + ) + ) ) voMonitoringSequence = cms.Sequence( @@ -28,12 +34,14 @@ from DQM.TrackingMonitorSource.pset4GenericTriggerEventFlag_cfi import * # tracker ON -KshortMonitoringCommon = KshortMonitoring.clone() -KshortMonitoringCommon.genericTriggerEventPSet = genericTriggerEventFlag4fullTracker +KshortMonitoringCommon = KshortMonitoring.clone( + genericTriggerEventPSet = genericTriggerEventFlag4fullTracker +) KshortMonitoringCommon.setLabel("KshortMonitoringCommon") -LambdaMonitoringCommon = LambdaMonitoring.clone() -LambdaMonitoringCommon.genericTriggerEventPSet = genericTriggerEventFlag4fullTracker +LambdaMonitoringCommon = LambdaMonitoring.clone( + genericTriggerEventPSet = genericTriggerEventFlag4fullTracker +) LambdaMonitoringCommon.setLabel("LambdaMonitoringCommon") voMonitoringCommonSequence = cms.Sequence( @@ -43,47 +51,55 @@ # tracker ON + ZeroBias selection -KshortMonitoringMB = KshortMonitoring.clone() -KshortMonitoringMB.FolderName = cms.string("Tracking/V0Monitoring/HIP_OOTpu_INpu/Ks") -KshortMonitoringMB.genericTriggerEventPSet = genericTriggerEventFlag4fullTrackerAndHLTdb +KshortMonitoringMB = KshortMonitoring.clone( + FolderName = "Tracking/V0Monitoring/HIP_OOTpu_INpu/Ks", + genericTriggerEventPSet = genericTriggerEventFlag4fullTrackerAndHLTdb +) KshortMonitoringMB.setLabel("KshortMonitoringMB") -LambdaMonitoringMB = LambdaMonitoring.clone() -LambdaMonitoringMB.FolderName = cms.string("Tracking/V0Monitoring/HIP_OOTpu_INpu/Lambda") -LambdaMonitoringMB.genericTriggerEventPSet = genericTriggerEventFlag4fullTrackerAndHLTdb +LambdaMonitoringMB = LambdaMonitoring.clone( + FolderName = "Tracking/V0Monitoring/HIP_OOTpu_INpu/Lambda", + genericTriggerEventPSet = genericTriggerEventFlag4fullTrackerAndHLTdb +) LambdaMonitoringMB.setLabel("LambdaMonitoringMB") # tracker ON + no HIP no OOT selection (HLT_ZeroBias_FirstCollisionAfterAbortGap) -KshortMonitoringZBnoHIPnoOOT = KshortMonitoring.clone() -KshortMonitoringZBnoHIPnoOOT.FolderName = cms.string("Tracking/V0Monitoring/noHIP_noOOTpu_INpu/Ks") -KshortMonitoringZBnoHIPnoOOT.genericTriggerEventPSet = genericTriggerEventFlag4fullTrackerAndHLTnoHIPnoOOTdb +KshortMonitoringZBnoHIPnoOOT = KshortMonitoring.clone( + FolderName = "Tracking/V0Monitoring/noHIP_noOOTpu_INpu/Ks", + genericTriggerEventPSet = genericTriggerEventFlag4fullTrackerAndHLTnoHIPnoOOTdb +) KshortMonitoringZBnoHIPnoOOT.setLabel("KshortMonitoringZBnoHIPnoOOT") -LambdaMonitoringZBnoHIPnoOOT = LambdaMonitoring.clone() -LambdaMonitoringZBnoHIPnoOOT.FolderName = cms.string("Tracking/V0Monitoring/noHIP_noOOTpu_INpu/Lambda") -LambdaMonitoringZBnoHIPnoOOT.genericTriggerEventPSet = genericTriggerEventFlag4fullTrackerAndHLTnoHIPnoOOTdb +LambdaMonitoringZBnoHIPnoOOT = LambdaMonitoring.clone( + FolderName = "Tracking/V0Monitoring/noHIP_noOOTpu_INpu/Lambda", + genericTriggerEventPSet = genericTriggerEventFlag4fullTrackerAndHLTnoHIPnoOOTdb +) LambdaMonitoringZBnoHIPnoOOT.setLabel("LambdaMonitoringZBnoHIPnoOOT") # tracker ON + HIP no OOT selection (HLT_ZeroBias_FirstCollisionInTrain) -KshortMonitoringZBHIPnoOOT = KshortMonitoring.clone() -KshortMonitoringZBHIPnoOOT.FolderName = cms.string("Tracking/V0Monitoring/HIP_noOOTpu_INpu/Ks") -KshortMonitoringZBHIPnoOOT.genericTriggerEventPSet = genericTriggerEventFlag4fullTrackerAndHLTHIPnoOOTdb +KshortMonitoringZBHIPnoOOT = KshortMonitoring.clone( + FolderName = "Tracking/V0Monitoring/HIP_noOOTpu_INpu/Ks", + genericTriggerEventPSet = genericTriggerEventFlag4fullTrackerAndHLTHIPnoOOTdb +) KshortMonitoringZBHIPnoOOT.setLabel("KshortMonitoringZBHIPnoOOT") -LambdaMonitoringZBHIPnoOOT = LambdaMonitoring.clone() -LambdaMonitoringZBHIPnoOOT.FolderName = cms.string("Tracking/V0Monitoring/HIP_noOOTpu_INpu/Lambda") -LambdaMonitoringZBHIPnoOOT.genericTriggerEventPSet = genericTriggerEventFlag4fullTrackerAndHLTHIPnoOOTdb +LambdaMonitoringZBHIPnoOOT = LambdaMonitoring.clone( + FolderName = "Tracking/V0Monitoring/HIP_noOOTpu_INpu/Lambda", + genericTriggerEventPSet = genericTriggerEventFlag4fullTrackerAndHLTHIPnoOOTdb +) LambdaMonitoringZBHIPnoOOT.setLabel("LambdaMonitoringZBHIPnoOOT") # tracker ON + HIP OOT selection (HLT_ZeroBias_FirstBXAfterTrain) -KshortMonitoringZBHIPOOT = KshortMonitoring.clone() -KshortMonitoringZBHIPOOT.FolderName = cms.string("Tracking/V0Monitoring/HIP_OOTpu_noINpu/Ks") -KshortMonitoringZBHIPOOT.genericTriggerEventPSet = genericTriggerEventFlag4fullTrackerAndHLTHIPOOTdb +KshortMonitoringZBHIPOOT = KshortMonitoring.clone( + FolderName = "Tracking/V0Monitoring/HIP_OOTpu_noINpu/Ks", + genericTriggerEventPSet = genericTriggerEventFlag4fullTrackerAndHLTHIPOOTdb +) KshortMonitoringZBHIPOOT.setLabel("KshortMonitoringZBHIPOOT") -LambdaMonitoringZBHIPOOT = LambdaMonitoring.clone() -LambdaMonitoringZBHIPOOT.FolderName = cms.string("Tracking/V0Monitoring/HIP_OOTpu_noINpu/Lambda") -LambdaMonitoringZBHIPOOT.genericTriggerEventPSet = genericTriggerEventFlag4fullTrackerAndHLTHIPOOTdb +LambdaMonitoringZBHIPOOT = LambdaMonitoring.clone( + FolderName = "Tracking/V0Monitoring/HIP_OOTpu_noINpu/Lambda", + genericTriggerEventPSet = genericTriggerEventFlag4fullTrackerAndHLTHIPOOTdb +) LambdaMonitoringZBHIPOOT.setLabel("LambdaMonitoringZBHIPOOT") voMonitoringMBSequence = cms.Sequence( @@ -109,85 +125,98 @@ from CommonTools.RecoAlgos.vertexCompositeCandidateCollectionSelector_cfi import * -KshortWlxy16 = vertexCompositeCandidateCollectionSelector.clone() -KshortWlxy16.v0 = cms.InputTag('generalV0Candidates:Kshort') +KshortWlxy16 = vertexCompositeCandidateCollectionSelector.clone( + v0 = 'generalV0Candidates:Kshort' +) -LambdaWlxy16 = vertexCompositeCandidateCollectionSelector.clone() -LambdaWlxy16.v0 = cms.InputTag('generalV0Candidates:Lambda') +LambdaWlxy16 = vertexCompositeCandidateCollectionSelector.clone( + v0 = 'generalV0Candidates:Lambda' +) -KshortWlxy16Monitoring = KshortMonitoring.clone() -KshortWlxy16Monitoring.v0 = cms.InputTag('KshortWlxy16') -KshortWlxy16Monitoring.FolderName = cms.string("Tracking/V0Monitoring/Ks/Lxy16") +KshortWlxy16Monitoring = KshortMonitoring.clone( + v0 = 'KshortWlxy16', + FolderName = "Tracking/V0Monitoring/Ks/Lxy16" +) -LambdaWlxy16Monitoring = LambdaMonitoring.clone() -LambdaWlxy16Monitoring.v0 = cms.InputTag('LambdaWlxy16') -LambdaWlxy16Monitoring.FolderName = cms.string("Tracking/V0Monitoring/Lambda/Lxy16") +LambdaWlxy16Monitoring = LambdaMonitoring.clone( + v0 = 'LambdaWlxy16', + FolderName = "Tracking/V0Monitoring/Lambda/Lxy16" +) voWcutMonitoringSequence = cms.Sequence( KshortWlxy16*KshortWlxy16Monitoring + LambdaWlxy16*LambdaWlxy16Monitoring ) -KshortWlxy16MonitoringCommon = KshortMonitoringCommon.clone() -KshortWlxy16MonitoringCommon.v0 = cms.InputTag('KshortWlxy16') -KshortWlxy16MonitoringCommon.FolderName = cms.string("Tracking/V0Monitoring/Ks/Lxy16") +KshortWlxy16MonitoringCommon = KshortMonitoringCommon.clone( + v0 = 'KshortWlxy16', + FolderName = "Tracking/V0Monitoring/Ks/Lxy16" +) -LambdaWlxy16MonitoringCommon = LambdaMonitoringCommon.clone() -LambdaWlxy16MonitoringCommon.v0 = cms.InputTag('LambdaWlxy16') -LambdaWlxy16MonitoringCommon.FolderName = cms.string("Tracking/V0Monitoring/Lambda/Lxy16") +LambdaWlxy16MonitoringCommon = LambdaMonitoringCommon.clone( + v0 = 'LambdaWlxy16', + FolderName = "Tracking/V0Monitoring/Lambda/Lxy16" +) voWcutMonitoringCommonSequence = cms.Sequence( KshortWlxy16*KshortWlxy16MonitoringCommon +LambdaWlxy16*LambdaWlxy16MonitoringCommon ) -KshortWlxy16MonitoringMB = KshortMonitoringMB.clone() -KshortWlxy16MonitoringMB.v0 = cms.InputTag('KshortWlxy16') -KshortWlxy16MonitoringMB.FolderName = cms.string("Tracking/V0Monitoring/HIP_OOTpu_INpu/Ks/Lxy16") +KshortWlxy16MonitoringMB = KshortMonitoringMB.clone( + v0 = 'KshortWlxy16', + FolderName = "Tracking/V0Monitoring/HIP_OOTpu_INpu/Ks/Lxy16" +) -LambdaWlxy16MonitoringMB = LambdaMonitoringMB.clone() -LambdaWlxy16MonitoringMB.v0 = cms.InputTag('LambdaWlxy16') -LambdaWlxy16MonitoringMB.FolderName = cms.string("Tracking/V0Monitoring/HIP_OOTpu_INpu/Lambda/Lxy16") +LambdaWlxy16MonitoringMB = LambdaMonitoringMB.clone( + v0 = 'LambdaWlxy16', + FolderName = "Tracking/V0Monitoring/HIP_OOTpu_INpu/Lambda/Lxy16" +) voWcutMonitoringMBSequence = cms.Sequence( KshortWlxy16*KshortWlxy16MonitoringMB +LambdaWlxy16*LambdaWlxy16MonitoringMB ) -KshortWlxy16MonitoringZBnoHIPnoOOT = KshortMonitoringZBnoHIPnoOOT.clone() -KshortWlxy16MonitoringZBnoHIPnoOOT.v0 = cms.InputTag('KshortWlxy16') -KshortWlxy16MonitoringZBnoHIPnoOOT.FolderName = cms.string("Tracking/V0Monitoring/noHIP_noOOTpu_INpu/Ks/Lxy16") - -LambdaWlxy16MonitoringZBnoHIPnoOOT = LambdaMonitoringZBnoHIPnoOOT.clone() -LambdaWlxy16MonitoringZBnoHIPnoOOT.v0 = cms.InputTag('LambdaWlxy16') -LambdaWlxy16MonitoringZBnoHIPnoOOT.FolderName = cms.string("Tracking/V0Monitoring/noHIP_noOOTpu_INpu/Lambda/Lxy16") +KshortWlxy16MonitoringZBnoHIPnoOOT = KshortMonitoringZBnoHIPnoOOT.clone( + v0 = 'KshortWlxy16', + FolderName = "Tracking/V0Monitoring/noHIP_noOOTpu_INpu/Ks/Lxy16" +) +LambdaWlxy16MonitoringZBnoHIPnoOOT = LambdaMonitoringZBnoHIPnoOOT.clone( + v0 = 'LambdaWlxy16', + FolderName = "Tracking/V0Monitoring/noHIP_noOOTpu_INpu/Lambda/Lxy16" +) voWcutMonitoringZBnoHIPnoOOTSequence = cms.Sequence( KshortWlxy16*KshortWlxy16MonitoringZBnoHIPnoOOT +LambdaWlxy16*LambdaWlxy16MonitoringZBnoHIPnoOOT ) -KshortWlxy16MonitoringZBHIPnoOOT = KshortMonitoringZBHIPnoOOT.clone() -KshortWlxy16MonitoringZBHIPnoOOT.v0 = cms.InputTag('KshortWlxy16') -KshortWlxy16MonitoringZBHIPnoOOT.FolderName = cms.string("Tracking/V0Monitoring/HIP_noOOTpu_INpu/Ks/Lxy16") +KshortWlxy16MonitoringZBHIPnoOOT = KshortMonitoringZBHIPnoOOT.clone( + v0 = 'KshortWlxy16', + FolderName = "Tracking/V0Monitoring/HIP_noOOTpu_INpu/Ks/Lxy16" +) -LambdaWlxy16MonitoringZBHIPnoOOT = LambdaMonitoringZBHIPnoOOT.clone() -LambdaWlxy16MonitoringZBHIPnoOOT.v0 = cms.InputTag('LambdaWlxy16') -LambdaWlxy16MonitoringZBHIPnoOOT.FolderName = cms.string("Tracking/V0Monitoring/HIP_noOOTpu_INpu/Lambda/Lxy16") +LambdaWlxy16MonitoringZBHIPnoOOT = LambdaMonitoringZBHIPnoOOT.clone( + v0 = 'LambdaWlxy16', + FolderName = "Tracking/V0Monitoring/HIP_noOOTpu_INpu/Lambda/Lxy16" +) voWcutMonitoringZBHIPnoOOTSequence = cms.Sequence( KshortWlxy16*KshortWlxy16MonitoringZBHIPnoOOT +LambdaWlxy16*LambdaWlxy16MonitoringZBHIPnoOOT ) -KshortWlxy16MonitoringZBHIPOOT = KshortMonitoringZBHIPOOT.clone() -KshortWlxy16MonitoringZBHIPOOT.v0 = cms.InputTag('KshortWlxy16') -KshortWlxy16MonitoringZBHIPOOT.FolderName = cms.string("Tracking/V0Monitoring/HIP_OOTpu_noINpu/Ks/Lxy16") +KshortWlxy16MonitoringZBHIPOOT = KshortMonitoringZBHIPOOT.clone( + v0 = 'KshortWlxy16', + FolderName = "Tracking/V0Monitoring/HIP_OOTpu_noINpu/Ks/Lxy16" +) -LambdaWlxy16MonitoringZBHIPOOT = LambdaMonitoringZBHIPOOT.clone() -LambdaWlxy16MonitoringZBHIPOOT.v0 = cms.InputTag('LambdaWlxy16') -LambdaWlxy16MonitoringZBHIPOOT.FolderName = cms.string("Tracking/V0Monitoring/HIP_OOTpu_noINpu/Lambda/Lxy16") +LambdaWlxy16MonitoringZBHIPOOT = LambdaMonitoringZBHIPOOT.clone( + v0 = 'LambdaWlxy16', + FolderName = "Tracking/V0Monitoring/HIP_OOTpu_noINpu/Lambda/Lxy16" +) voWcutMonitoringZBHIPOOTSequence = cms.Sequence( KshortWlxy16*KshortWlxy16MonitoringZBHIPOOT diff --git a/DQM/TrackingMonitor/python/dEdxAnalyzer_cff.py b/DQM/TrackingMonitor/python/dEdxAnalyzer_cff.py index 519d75bb3dcef..918ad0e8cbe6d 100644 --- a/DQM/TrackingMonitor/python/dEdxAnalyzer_cff.py +++ b/DQM/TrackingMonitor/python/dEdxAnalyzer_cff.py @@ -4,22 +4,26 @@ #ADD BY LOIC from RecoTracker.TrackProducer.TrackRefitter_cfi import * -RefitterForDedxDQMDeDx = TrackRefitter.clone() -RefitterForDedxDQMDeDx.src = cms.InputTag("generalTracks") -RefitterForDedxDQMDeDx.TrajectoryInEvent = True +RefitterForDedxDQMDeDx = TrackRefitter.clone( + src = "generalTracks", + TrajectoryInEvent = True +) from RecoTracker.DeDx.dedxEstimators_cff import dedxHarmonic2 -dedxDQMHarm2SP = dedxHarmonic2.clone() -#dedxDQMHarm2SP.tracks = cms.InputTag("RefitterForDedxDQMDeDx") -dedxDQMHarm2SP.tracks = cms.InputTag("generalTracks") -dedxDQMHarm2SP.UseStrip = cms.bool(True) -dedxDQMHarm2SP.UsePixel = cms.bool(True) +dedxDQMHarm2SP = dedxHarmonic2.clone( + #tracks = "RefitterForDedxDQMDeDx", + tracks = "generalTracks", + UseStrip = True, + UsePixel = True +) -dedxDQMHarm2SO = dedxDQMHarm2SP.clone() -dedxDQMHarm2SO.UsePixel = cms.bool(False) +dedxDQMHarm2SO = dedxDQMHarm2SP.clone( + UsePixel = False +) -dedxDQMHarm2PO = dedxDQMHarm2SP.clone() -dedxDQMHarm2PO.UseStrip = cms.bool(False) +dedxDQMHarm2PO = dedxDQMHarm2SP.clone( + UseStrip = False +) #dEdxMonitor = cms.Sequence( # RefitterForDedxDQMDeDx * dedxDQMHarm2SP * dedxDQMHarm2SO * dedxDQMHarm2PO diff --git a/DQM/TrackingMonitor/src/TrackingRecoMaterialAnalyser.cc b/DQM/TrackingMonitor/src/TrackingRecoMaterialAnalyser.cc index 7b9cfdef9bd8c..c87e8fa5d6a7e 100644 --- a/DQM/TrackingMonitor/src/TrackingRecoMaterialAnalyser.cc +++ b/DQM/TrackingMonitor/src/TrackingRecoMaterialAnalyser.cc @@ -17,7 +17,6 @@ #include "DQMServices/Core/interface/DQMEDAnalyzer.h" #include "DQMServices/Core/interface/DQMStore.h" #include "FWCore/Framework/interface/ConsumesCollector.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" diff --git a/DQM/TrackingMonitorClient/python/TrackingClientConfig_Tier0_Cosmic_cff.py b/DQM/TrackingMonitorClient/python/TrackingClientConfig_Tier0_Cosmic_cff.py index be90120171783..9cb19b7a1ae5a 100644 --- a/DQM/TrackingMonitorClient/python/TrackingClientConfig_Tier0_Cosmic_cff.py +++ b/DQM/TrackingMonitorClient/python/TrackingClientConfig_Tier0_Cosmic_cff.py @@ -62,15 +62,15 @@ from DQM.TrackingMonitor.TrackFoldedOccupancyClient_cfi import TrackerMapFoldedClient TrackerMapFoldedClient_CKFTk=TrackerMapFoldedClient.clone( - AlgoName = cms.string('CKFTk'), - MeasurementState = cms.string('default'), - TrackQuality = cms.string('') + AlgoName = 'CKFTk', + MeasurementState = 'default', + TrackQuality = '' ) TrackerMapFoldedClient_CosmicTk=TrackerMapFoldedClient.clone( - AlgoName = cms.string('CosmicTk'), - MeasurementState = cms.string('default'), - TrackQuality = cms.string('') + AlgoName = 'CosmicTk', + MeasurementState = 'default', + TrackQuality = '' ) # Sequence diff --git a/DQM/TrackingMonitorClient/python/TrackingClientConfig_Tier0_cff.py b/DQM/TrackingMonitorClient/python/TrackingClientConfig_Tier0_cff.py index 7b0291c3189c2..098e45844da8e 100644 --- a/DQM/TrackingMonitorClient/python/TrackingClientConfig_Tier0_cff.py +++ b/DQM/TrackingMonitorClient/python/TrackingClientConfig_Tier0_cff.py @@ -79,11 +79,12 @@ from DQM.TrackingMonitorClient.primaryVertexResolutionClient_cfi import * # Sequence -#import DQM.TrackingMonitor.TrackEfficiencyMonitor_cfi -#TrackEffMon_ckf = DQM.TrackingMonitor.TrackEfficiencyMonitor_cfi.TrackEffMon.clone() -#TrackEffMon_ckf.TKTrackCollection = 'ctfWithMaterialTracksP5' -#TrackEffMon_ckf.AlgoName = 'CKFTk' -#TrackEffMon_ckf.FolderName = 'Tracking/TrackParameters/TrackEfficiency' +# from DQM.TrackingMonitor.TrackEfficiencyMonitor_cfi import * +# TrackEffMon_ckf = TrackEffMon.clone( +# TKTrackCollection = 'ctfWithMaterialTracksP5', +# AlgoName = 'CKFTk', +# FolderName = 'Tracking/TrackParameters/TrackEfficiency' +# ) from DQM.TrackingMonitor.TrackEfficiencyClient_cfi import * TrackEffClient.FolderName = 'Tracking/TrackParameters/TrackEfficiency' diff --git a/DQM/TrackingMonitorClient/python/TrackingDQMClientHeavyIons_cfi.py b/DQM/TrackingMonitorClient/python/TrackingDQMClientHeavyIons_cfi.py index 0548381cbccc9..30e238cd9cb84 100644 --- a/DQM/TrackingMonitorClient/python/TrackingDQMClientHeavyIons_cfi.py +++ b/DQM/TrackingMonitorClient/python/TrackingDQMClientHeavyIons_cfi.py @@ -7,8 +7,8 @@ from DQM.TrackingMonitor.TrackFoldedOccupancyClient_cfi import TrackerMapFoldedClient -TrackerMapFoldedClient_heavyionTk=TrackerMapFoldedClient.clone( - AlgoName = cms.string('HeavyIonTk'), - TrackQuality = cms.string('') +TrackerMapFoldedClient_heavyionTk = TrackerMapFoldedClient.clone( + AlgoName = 'HeavyIonTk', + TrackQuality = '' ) hiTrackingDqmClientHeavyIons=cms.Sequence(hiTrackingDqmClientHI*TrackerMapFoldedClient_heavyionTk) diff --git a/DQM/TrackingMonitorClient/python/TrackingEffFromHitPatternClientConfigZeroBias_cff.py b/DQM/TrackingMonitorClient/python/TrackingEffFromHitPatternClientConfigZeroBias_cff.py index 27beaaae2acb5..991e5bb9d1706 100644 --- a/DQM/TrackingMonitorClient/python/TrackingEffFromHitPatternClientConfigZeroBias_cff.py +++ b/DQM/TrackingMonitorClient/python/TrackingEffFromHitPatternClientConfigZeroBias_cff.py @@ -1,8 +1,8 @@ import FWCore.ParameterSet.Config as cms -import DQM.TrackingMonitorClient.TrackingEffFromHitPatternClientConfig_cff -trackingEffFromHitPatternZeroBias = DQM.TrackingMonitorClient.TrackingEffFromHitPatternClientConfig_cff.trackingEffFromHitPattern.clone( - subDirs = cms.untracked.vstring( +from DQM.TrackingMonitorClient.TrackingEffFromHitPatternClientConfig_cff import * +trackingEffFromHitPatternZeroBias = trackingEffFromHitPattern.clone( + subDirs = ( "Tracking/TrackParameters/generalTracks/HitEffFromHitPattern*", "Tracking/TrackParameters/highPurityTracks/pt_1/HitEffFromHitPattern*", "Tracking/TrackParameters/highPurityTracks/dzPV0p1/HitEffFromHitPattern*", @@ -10,6 +10,6 @@ "Tracking/TrackParameters/highPurityTracks/pt_1/HIP_noOOT_INpu/HitEffFromHitPattern*", "Tracking/TrackParameters/highPurityTracks/pt_1/noHIP_noOOT_INpu/HitEffFromHitPattern*", "Muons/Tracking/innerTrack/HitEffFromHitPattern*", - "Muons/globalMuons/HitEffFromHitPattern*" + "Muons/globalMuons/HitEffFromHitPattern*", ) ) diff --git a/DQM/TrackingMonitorClient/python/V0MonitoringClient_cff.py b/DQM/TrackingMonitorClient/python/V0MonitoringClient_cff.py index 06bf4fbe191de..df7d7173346dc 100644 --- a/DQM/TrackingMonitorClient/python/V0MonitoringClient_cff.py +++ b/DQM/TrackingMonitorClient/python/V0MonitoringClient_cff.py @@ -2,13 +2,23 @@ from DQM.TrackingMonitorClient.V0MonitoringClient_cfi import * -KshortMonitorClient = v0MonitorClient.clone() -KshortMonitorClient.inputme.folder = cms.string('Tracking/V0Monitoring/Ks') -KshortMonitorClient.outputme.folder = cms.string('Tracking/V0Monitoring/Ks') +KshortMonitorClient = v0MonitorClient.clone( + inputme = v0MonitorClient.inputme.clone( + folder = 'Tracking/V0Monitoring/Ks' + ), + outputme = v0MonitorClient.outputme.clone( + folder = 'Tracking/V0Monitoring/Ks' + ) +) -LambdaMonitoringClient = v0MonitorClient.clone() -LambdaMonitoringClient.inputme.folder = cms.string('Tracking/V0Monitoring/Lambda') -LambdaMonitoringClient.outputme.folder = cms.string('Tracking/V0Monitoring/Lambda') +LambdaMonitoringClient = v0MonitorClient.clone( + inputme = v0MonitorClient.inputme.clone( + folder = 'Tracking/V0Monitoring/Lambda' + ), + outputme = v0MonitorClient.outputme.clone( + folder = 'Tracking/V0Monitoring/Lambda' + ) +) voMonitoringClientSequence = cms.Sequence( KshortMonitorClient diff --git a/DQM/TrackingMonitorClient/python/V0MonitoringClient_cfi.py b/DQM/TrackingMonitorClient/python/V0MonitoringClient_cfi.py index 6b4ddcbc77895..ffa03fa3a43fa 100644 --- a/DQM/TrackingMonitorClient/python/V0MonitoringClient_cfi.py +++ b/DQM/TrackingMonitorClient/python/V0MonitoringClient_cfi.py @@ -1,12 +1,13 @@ from DQM.TrackingMonitorClient.DQMScaleToClient_cfi import * -v0MonitorClient = dqmScaleToClient.clone() -v0MonitorClient.outputme = cms.PSet( - folder = cms.string('Tracking/V0Monitoring'), - name = cms.string('v0_Lxy_normalized'), - factor = cms.double(1.) -) -v0MonitorClient.inputme = cms.PSet( - folder = cms.string('Tracking/V0Monitoring'), - name = cms.string('v0_Lxy') +v0MonitorClient = dqmScaleToClient.clone( + outputme = dqmScaleToClient.outputme.clone( + folder = 'Tracking/V0Monitoring', + name = 'v0_Lxy_normalized', + factor = 1. + ), + inputme = dqmScaleToClient.inputme.clone( + folder = 'Tracking/V0Monitoring', + name = 'v0_Lxy' + ) ) diff --git a/DQM/TrackingMonitorSource/python/LogMessageMonitor_cff.py b/DQM/TrackingMonitorSource/python/LogMessageMonitor_cff.py index a4d87a566d405..0cbc067ab4a0b 100644 --- a/DQM/TrackingMonitorSource/python/LogMessageMonitor_cff.py +++ b/DQM/TrackingMonitorSource/python/LogMessageMonitor_cff.py @@ -1,12 +1,14 @@ import FWCore.ParameterSet.Config as cms from DQM.TrackingMonitorSource.pset4GenericTriggerEventFlag_cfi import * -import DQM.TrackingMonitor.LogMessageMonitor_cfi +from DQM.TrackingMonitor.LogMessageMonitor_cfi import * # Clone for all PDs but MinBias #### -LogMessageMonCommon = DQM.TrackingMonitor.LogMessageMonitor_cfi.LogMessageMon.clone() -LogMessageMonCommon.genericTriggerEventPSet = genericTriggerEventFlag4fullTracker +LogMessageMonCommon = LogMessageMon.clone( + genericTriggerEventPSet = genericTriggerEventFlag4fullTracker +) # Clone for MinBias ### -LogMessageMonMB = DQM.TrackingMonitor.LogMessageMonitor_cfi.LogMessageMon.clone() -LogMessageMonMB.genericTriggerEventPSet = genericTriggerEventFlag4fullTrackerAndHLTdb +LogMessageMonMB = LogMessageMon.clone( + genericTriggerEventPSet = genericTriggerEventFlag4fullTrackerAndHLTdb +) diff --git a/DQM/TrackingMonitorSource/python/TrackCollections2monitor_cff.py b/DQM/TrackingMonitorSource/python/TrackCollections2monitor_cff.py index 723c75ed68e76..ed9ae83112ee5 100644 --- a/DQM/TrackingMonitorSource/python/TrackCollections2monitor_cff.py +++ b/DQM/TrackingMonitorSource/python/TrackCollections2monitor_cff.py @@ -65,8 +65,9 @@ ) ### highpurity definition: https://cmssdt.cern.ch/SDT/lxr/source/RecoTracker/FinalTrackSelectors/python/selectHighPurity_cfi.py -highPurityPtRange0to1 = trackSelector.clone() -highPurityPtRange0to1.cut = cms.string("quality('highPurity') & pt >= 0 & pt < 1 ") +highPurityPtRange0to1 = trackSelector.clone( + cut = "quality('highPurity') & pt >= 0 & pt < 1 " +) sequenceName ['highPurityPtRange0to1'] = highPurityPtRange0to1 allTrackProducer['highPurityPtRange0to1'] = 'generalTracks' @@ -97,8 +98,9 @@ doEffFromHitPatternVsLumi ['highPurityPtRange0to1'] = cms.bool(False) doStopSource ['highPurityPtRange0to1'] = cms.bool(True) -highPurityPtRange1to10 = trackSelector.clone() -highPurityPtRange1to10.cut = cms.string("quality('highPurity') & pt >= 1 & pt < 10 ") +highPurityPtRange1to10 = trackSelector.clone( + cut = "quality('highPurity') & pt >= 1 & pt < 10 " +) sequenceName ['highPurityPtRange1to10'] = highPurityPtRange1to10 allTrackProducer['highPurityPtRange1to10'] = 'generalTracks' @@ -128,8 +130,9 @@ doEffFromHitPatternVsLumi ['highPurityPtRange1to10'] = cms.bool(False) doStopSource ['highPurityPtRange1to10'] = cms.bool(True) -highPurityPt10 = trackSelector.clone() -highPurityPt10.cut = cms.string("quality('highPurity') & pt >= 10") +highPurityPt10 = trackSelector.clone( + cut = "quality('highPurity') & pt >= 10" +) sequenceName ['highPurityPt10'] = highPurityPt10 allTrackProducer['highPurityPt10'] = 'generalTracks' @@ -160,8 +163,9 @@ doStopSource ['highPurityPt10'] = cms.bool(True) ###### old monitored track collections -highPurityPt1 = trackSelector.clone() -highPurityPt1.cut = cms.string("quality('highPurity') & pt >= 1") +highPurityPt1 = trackSelector.clone( + cut = "quality('highPurity') & pt >= 1" +) sequenceName ['highPurityPt1'] = highPurityPt1 allTrackProducer['highPurityPt1'] = 'generalTracks' @@ -193,8 +197,9 @@ doStopSource ['highPurityPt1'] = cms.bool(True) ###### forward-only monitored track collections -highPurityPt1Eta2p5to3p0 = trackSelector.clone() -highPurityPt1Eta2p5to3p0.cut = cms.string("quality('highPurity') & pt >= 1 & abs(eta) > 2.5") +highPurityPt1Eta2p5to3p0 = trackSelector.clone( + cut = "quality('highPurity') & pt >= 1 & abs(eta) > 2.5" +) sequenceName ['highPurityPt1Eta2p5to3p0'] = highPurityPt1Eta2p5to3p0 allTrackProducer['highPurityPt1Eta2p5to3p0'] = 'generalTracks' @@ -232,46 +237,49 @@ ###### association is dz<1mm from CommonTools.RecoAlgos.TrackWithVertexSelector_cfi import * -trackAssociated2pvSelector = trackWithVertexSelector.clone() -# the track collection -trackAssociated2pvSelector.src = cms.InputTag('generalTracks') -# kinematic cuts (pT in GeV) -trackAssociated2pvSelector.etaMin = cms.double(0.0) -trackAssociated2pvSelector.etaMax = cms.double(5.0) -trackAssociated2pvSelector.ptMin = cms.double(0.0) -trackAssociated2pvSelector.ptMax = cms.double(100000.0) -# impact parameter cut (in cm) -trackAssociated2pvSelector.d0Max = cms.double(999.) -trackAssociated2pvSelector.dzMax = cms.double(999.) -# quality cuts (valid hits, normalized chi2) -trackAssociated2pvSelector.normalizedChi2 = cms.double(999999.) -trackAssociated2pvSelector.numberOfValidHits = cms.uint32(0) -trackAssociated2pvSelector.numberOfLostHits = cms.uint32(999) ## at most 999 lost hits -trackAssociated2pvSelector.numberOfValidPixelHits = cms.uint32(0) ## at least hits in the pixels -trackAssociated2pvSelector.ptErrorCut = cms.double(9999999.) ## [pTError/pT]*max(1,normChi2) <= ptErrorCut -trackAssociated2pvSelector.quality = cms.string("highPurity") # quality cut as defined in reco::TrackBase -# compatibility with a vertex ? -trackAssociated2pvSelector.useVtx = cms.bool(True) -trackAssociated2pvSelector.vertexTag = cms.InputTag('trackingDQMgoodOfflinePrimaryVertices') -trackAssociated2pvSelector.timesTag = cms.InputTag('') -trackAssociated2pvSelector.timeResosTag = cms.InputTag('') -trackAssociated2pvSelector.nVertices = cms.uint32(1) ## how many vertices to look at before dropping the track -trackAssociated2pvSelector.vtxFallback = cms.bool(True) ## falback to beam spot if there are no vertices -# uses vtx=(0,0,0) with deltaZeta=15.9, deltaRho = 0.2 -trackAssociated2pvSelector.zetaVtx = cms.double(999.) -#trackAssociated2pvSelector.rhoVtx = cms.double(0.2) ## tags used by b-tagging folks -trackAssociated2pvSelector.rhoVtx = cms.double(999.) ## tags used by b-tagging folks -trackAssociated2pvSelector.nSigmaDtVertex = cms.double(0) -# should _not_ be used for the TrackWithVertexRefSelector -trackAssociated2pvSelector.copyExtras = cms.untracked.bool(False) ## copies also extras and rechits on RECO -trackAssociated2pvSelector.copyTrajectories = cms.untracked.bool(False) # don't set this to true on AOD! +trackAssociated2pvSelector = trackWithVertexSelector.clone( + # the track collection + src = 'generalTracks', + # kinematic cuts (pT in GeV) + etaMin = 0.0, + etaMax = 5.0, + ptMin = 0.0, + ptMax = 100000.0, + # impact parameter cut (in cm) + d0Max = 999., + dzMax = 999., + # quality cuts (valid hits, normalized chi2) + normalizedChi2 = 999999., + numberOfValidHits = 0, + numberOfLostHits = 999, ## at most 999 lost hits + numberOfValidPixelHits = 0, ## at least hits in the pixels + ptErrorCut = 9999999., ## [pTError/pT]*max(1,normChi2) <= ptErrorCut + quality = "highPurity", # quality cut as defined in reco::TrackBase + # compatibility with a vertex ? + useVtx = True, + vertexTag = 'trackingDQMgoodOfflinePrimaryVertices', + timesTag = '', + timeResosTag = '', + nVertices = 1, ## how many vertices to look at before dropping the track + vtxFallback = True, ## falback to beam spot if there are no vertices + # uses vtx=(0,0,0) with deltaZeta=15.9, deltaRho = 0.2 + zetaVtx = 999., + #rhoVtx = 0.2, ## tags used by b-tagging folks + rhoVtx = 999., ## tags used by b-tagging folks + nSigmaDtVertex = 0., + # should _not_ be used for the TrackWithVertexRefSelector + copyExtras = False, ## copies also extras and rechits on RECO + copyTrajectories = False # don't set this to true on AOD! +) -highPurityPV0p1 = trackAssociated2pvSelector.clone() -highPurityPV0p1.zetaVtx = cms.double(0.1) # wrt PV -#highPurityPV0p1.dzMax = cms.double(0.1) # wrt BS +highPurityPV0p1 = trackAssociated2pvSelector.clone( + zetaVtx = 0.1, # wrt PV + #dzMax = 0.1 # wrt BS +) -PV0p1 = highPurityPV0p1.clone() -PV0p1.quality = cms.string("") # quality cut as defined in reco::TrackBase +PV0p1 = highPurityPV0p1.clone( + quality = "" # quality cut as defined in reco::TrackBase +) #sequenceName ['highPurityPV0p1'] = highPurityPV0p1 sequenceName ['highPurityPV0p1'] = highPurityPV0p1+PV0p1 @@ -304,9 +312,10 @@ doStopSource ['highPurityPV0p1'] = cms.bool(True) #pixel tracks -hiConformalPixelTracksQA = trackSelector.clone() -hiConformalPixelTracksQA.src = cms.InputTag('hiConformalPixelTracks') -hiConformalPixelTracksQA.cut = cms.string("chi2/ndof/hitPattern.trackerLayersWithMeasurement < 200") +hiConformalPixelTracksQA = trackSelector.clone( + src = 'hiConformalPixelTracks', + cut = "chi2/ndof/hitPattern.trackerLayersWithMeasurement < 200" +) sequenceName ['hiConformalPixelTracksQA'] = hiConformalPixelTracksQA allTrackProducer['hiConformalPixelTracksQA'] = 'generalTracks' diff --git a/DQM/TrackingMonitorSource/python/TrackerCollisionTrackingMonitor_cff.py b/DQM/TrackingMonitorSource/python/TrackerCollisionTrackingMonitor_cff.py index ae5f4c2ac0f75..64798a1c5f79a 100644 --- a/DQM/TrackingMonitorSource/python/TrackerCollisionTrackingMonitor_cff.py +++ b/DQM/TrackingMonitorSource/python/TrackerCollisionTrackingMonitor_cff.py @@ -3,33 +3,38 @@ from DQM.TrackingMonitorSource.pset4GenericTriggerEventFlag_cfi import * # Clone for TrackingMonitor for all PDs but MinBias ### -import DQM.TrackingMonitor.TrackerCollisionTrackingMonitor_cfi -TrackerCollisionTrackMonCommon = DQM.TrackingMonitor.TrackerCollisionTrackingMonitor_cfi.TrackerCollisionTrackMon.clone() -TrackerCollisionTrackMonCommon.genericTriggerEventPSet = genericTriggerEventFlag4fullTracker +from DQM.TrackingMonitor.TrackerCollisionTrackingMonitor_cfi import * +TrackerCollisionTrackMonCommon = TrackerCollisionTrackMon.clone( + genericTriggerEventPSet = genericTriggerEventFlag4fullTracker +) TrackerCollisionTrackMonCommon.setLabel("TrackerCollisionTrackMonCommon") # Clone for TrackingMonitor for ZeroBias ### -import DQM.TrackingMonitor.TrackerCollisionTrackingMonitor_cfi -TrackerCollisionTrackMonMB = DQM.TrackingMonitor.TrackerCollisionTrackingMonitor_cfi.TrackerCollisionTrackMon.clone() -TrackerCollisionTrackMonMB.genericTriggerEventPSet = genericTriggerEventFlag4fullTrackerAndHLTdb -TrackerCollisionTrackMonMB.doPrimaryVertexPlots = cms.bool(True) +from DQM.TrackingMonitor.TrackerCollisionTrackingMonitor_cfi import * +TrackerCollisionTrackMonMB = TrackerCollisionTrackMon.clone( + genericTriggerEventPSet = genericTriggerEventFlag4fullTrackerAndHLTdb, + doPrimaryVertexPlots = True +) TrackerCollisionTrackMonMB.setLabel("TrackerCollisionTrackMonMB") # Clone for TrackingMonitor for ZeroBias, no hip, no OOT pu (1st collision after abort gap) ### -TrackerCollisionTrackMonZBnoHIPnoOOT = DQM.TrackingMonitor.TrackerCollisionTrackingMonitor_cfi.TrackerCollisionTrackMon.clone() -TrackerCollisionTrackMonZBnoHIPnoOOT.genericTriggerEventPSet = genericTriggerEventFlag4fullTrackerAndHLTnoHIPnoOOTdb -TrackerCollisionTrackMonZBnoHIPnoOOT.doPrimaryVertexPlots = cms.bool(True) +TrackerCollisionTrackMonZBnoHIPnoOOT = TrackerCollisionTrackMon.clone( + genericTriggerEventPSet = genericTriggerEventFlag4fullTrackerAndHLTnoHIPnoOOTdb, + doPrimaryVertexPlots = True +) TrackerCollisionTrackMonZBnoHIPnoOOT.setLabel("TrackerCollisionTrackMonZBnoHIPnoOOT") # Clone for TrackingMonitor for ZeroBias, hip, no OOT pu (1st collision in train) ### -TrackerCollisionTrackMonZBHIPnoOOT = DQM.TrackingMonitor.TrackerCollisionTrackingMonitor_cfi.TrackerCollisionTrackMon.clone() -TrackerCollisionTrackMonZBHIPnoOOT.genericTriggerEventPSet = genericTriggerEventFlag4fullTrackerAndHLTHIPnoOOTdb -TrackerCollisionTrackMonZBHIPnoOOT.doPrimaryVertexPlots = cms.bool(True) +TrackerCollisionTrackMonZBHIPnoOOT = TrackerCollisionTrackMon.clone( + genericTriggerEventPSet = genericTriggerEventFlag4fullTrackerAndHLTHIPnoOOTdb, + doPrimaryVertexPlots = True +) TrackerCollisionTrackMonZBHIPnoOOT.setLabel("TrackerCollisionTrackMonZBHIPnoOOT") # Clone for TrackingMonitor for ZeroBias, hip, OOT pu (1st collision after train) ### -TrackerCollisionTrackMonZBHIPOOT = DQM.TrackingMonitor.TrackerCollisionTrackingMonitor_cfi.TrackerCollisionTrackMon.clone() -TrackerCollisionTrackMonZBHIPOOT.genericTriggerEventPSet = genericTriggerEventFlag4fullTrackerAndHLTHIPOOTdb -TrackerCollisionTrackMonZBHIPOOT.doPrimaryVertexPlots = cms.bool(True) +TrackerCollisionTrackMonZBHIPOOT = TrackerCollisionTrackMon.clone( + genericTriggerEventPSet = genericTriggerEventFlag4fullTrackerAndHLTHIPOOTdb, + doPrimaryVertexPlots = True +) TrackerCollisionTrackMonZBHIPOOT.setLabel("TrackerCollisionTrackMonZBHIPOOT") diff --git a/DQM/TrackingMonitorSource/python/TrackingSourceConfigP5_cff.py b/DQM/TrackingMonitorSource/python/TrackingSourceConfigP5_cff.py index 9aa7ce37b2a30..7b710d3e4f25d 100644 --- a/DQM/TrackingMonitorSource/python/TrackingSourceConfigP5_cff.py +++ b/DQM/TrackingMonitorSource/python/TrackingSourceConfigP5_cff.py @@ -2,81 +2,91 @@ # TrackingMonitor #### # Clone for Cosmic Track Finder -import DQM.TrackingMonitor.TrackerCosmicsTrackingMonitor_cfi -TrackMon_cosmicTk = DQM.TrackingMonitor.TrackerCosmicsTrackingMonitor_cfi.TrackerCosmicTrackMon.clone() -TrackMon_cosmicTk.TrackProducer = 'cosmictrackfinderP5' -TrackMon_cosmicTk.AlgoName = 'CosmicTk' -TrackMon_cosmicTk.FolderName = 'Tracking/TrackParameters' -TrackMon_cosmicTk.doSeedParameterHistos = True -TrackMon_cosmicTk.TkSizeBin = cms.int32(4) -TrackMon_cosmicTk.TkSizeMax = cms.double( 3.5) -TrackMon_cosmicTk.TkSizeMin = cms.double(-0.5) +from DQM.TrackingMonitor.TrackerCosmicsTrackingMonitor_cfi import * +TrackMon_cosmicTk = TrackerCosmicTrackMon.clone( + TrackProducer = 'cosmictrackfinderP5', + AlgoName = 'CosmicTk', + FolderName = 'Tracking/TrackParameters', + doSeedParameterHistos = True, + TkSizeBin = 4, + TkSizeMax = 3.5, + TkSizeMin = -0.5 +) # Clone for CKF Tracks -import DQM.TrackingMonitor.TrackerCosmicsTrackingMonitor_cfi -TrackMon_ckf = DQM.TrackingMonitor.TrackerCosmicsTrackingMonitor_cfi.TrackerCosmicTrackMon.clone() -TrackMon_ckf.TrackProducer = 'ctfWithMaterialTracksP5' -TrackMon_ckf.AlgoName = 'CKFTk' -TrackMon_ckf.FolderName = 'Tracking/TrackParameters' -TrackMon_ckf.doSeedParameterHistos = True -TrackMon_ckf.TkSizeBin = cms.int32(4) -TrackMon_ckf.TkSizeMax = cms.double( 3.5) -TrackMon_ckf.TkSizeMin = cms.double(-0.5) +from DQM.TrackingMonitor.TrackerCosmicsTrackingMonitor_cfi import * +TrackMon_ckf = TrackerCosmicTrackMon.clone( + TrackProducer = 'ctfWithMaterialTracksP5', + AlgoName = 'CKFTk', + FolderName = 'Tracking/TrackParameters', + doSeedParameterHistos = True, + TkSizeBin = 4, + TkSizeMax = 3.5, + TkSizeMin = -0.5 +) # Clone for Road Search Tracks -#import DQM.TrackingMonitor.TrackerCosmicsTrackingMonitor_cfi -#TrackMon_rs = DQM.TrackingMonitor.TrackerCosmicsTrackingMonitor_cfi.TrackerCosmicTrackMon.clone() -#TrackMon_rs.TrackProducer = 'rsWithMaterialTracksP5' -#TrackMon_rs.AlgoName = 'RSTk' -#TrackMon_rs.FolderName = 'Tracking/TrackParameters' -#TrackMon_rs.doSeedParameterHistos = True +# from DQM.TrackingMonitor.TrackerCosmicsTrackingMonitor_cfi import * +# TrackMon_rs = TrackerCosmicTrackMon.clone( +# TrackProducer = 'rsWithMaterialTracksP5', +# AlgoName = 'RSTk', +# FolderName = 'Tracking/TrackParameters', +# doSeedParameterHistos = True +# ) # Clone for General Track (for Collision data) -import DQM.TrackingMonitor.TrackerCollisionTrackingMonitor_cfi -TrackMon_gentk = DQM.TrackingMonitor.TrackerCollisionTrackingMonitor_cfi.TrackerCollisionTrackMon.clone( - FolderName = 'Tracking/TrackParameters', - BSFolderName = 'Tracking/TrackParameters/BeamSpotParameters', -# decrease number of histograms -# doTrackerSpecific = False +from DQM.TrackingMonitor.TrackerCollisionTrackingMonitor_cfi import * +TrackMon_gentk = TrackerCollisionTrackMon.clone( + FolderName = 'Tracking/TrackParameters', + BSFolderName = 'Tracking/TrackParameters/BeamSpotParameters' + # decrease number of histograms + # doTrackerSpecific = False ) + # Clone for Heavy Ion Tracks (for HI Collisions) -import DQM.TrackingMonitor.TrackerHeavyIonTrackingMonitor_cfi -TrackMon_hi = DQM.TrackingMonitor.TrackerHeavyIonTrackingMonitor_cfi.TrackerHeavyIonTrackMon.clone() -TrackMon_hi.FolderName = 'Tracking/TrackParameters' -TrackMon_hi.BSFolderName = 'Tracking/TrackParameters/BeamSpotParameters' +from DQM.TrackingMonitor.TrackerHeavyIonTrackingMonitor_cfi import * +TrackMon_hi = TrackerHeavyIonTrackMon.clone( + FolderName = 'Tracking/TrackParameters', + BSFolderName = 'Tracking/TrackParameters/BeamSpotParameters' +) # Tracking Efficiency #### # Clone for Cosmic Tracks -import DQM.TrackingMonitor.TrackEfficiencyMonitor_cfi -TrackEffMon_cosmicTk = DQM.TrackingMonitor.TrackEfficiencyMonitor_cfi.TrackEffMon.clone() -TrackEffMon_cosmicTk.TKTrackCollection = 'cosmictrackfinderP5' -TrackEffMon_cosmicTk.AlgoName = 'CosmicTk' -TrackEffMon_cosmicTk.FolderName = 'Tracking/TrackParameters/TrackEfficiency' +from DQM.TrackingMonitor.TrackEfficiencyMonitor_cfi import * +TrackEffMon_cosmicTk = TrackEffMon.clone( + TKTrackCollection = 'cosmictrackfinderP5', + AlgoName = 'CosmicTk', + FolderName = 'Tracking/TrackParameters/TrackEfficiency' +) # Clone for CKF Tracks -import DQM.TrackingMonitor.TrackEfficiencyMonitor_cfi -TrackEffMon_ckf = DQM.TrackingMonitor.TrackEfficiencyMonitor_cfi.TrackEffMon.clone() -TrackEffMon_ckf.TKTrackCollection = 'ctfWithMaterialTracksP5' -TrackEffMon_ckf.AlgoName = 'CKFTk' -TrackEffMon_ckf.FolderName = 'Tracking/TrackParameters/TrackEfficiency' +from DQM.TrackingMonitor.TrackEfficiencyMonitor_cfi import * +TrackEffMon_ckf = TrackEffMon.clone( + TKTrackCollection = 'ctfWithMaterialTracksP5', + AlgoName = 'CKFTk', + FolderName = 'Tracking/TrackParameters/TrackEfficiency' +) # Clone for RS Tracks -#import DQM.TrackingMonitor.TrackEfficiencyMonitor_cfi -#TrackEffMon_rs = DQM.TrackingMonitor.TrackEfficiencyMonitor_cfi.TrackEffMon.clone() -#TrackEffMon_rs.TKTrackCollection = 'rsWithMaterialTracksP5' -#TrackEffMon_rs.AlgoName = 'RSTk' -#TrackEffMon_rs.FolderName = 'Tracking/TrackParameters/TrackEfficiency' +# from DQM.TrackingMonitor.TrackEfficiencyMonitor_cfi import * +# TrackEffMon_rs = TrackEffMon.clone( +# TKTrackCollection = 'rsWithMaterialTracksP5', +# AlgoName = 'RSTk', +# FolderName = 'Tracking/TrackParameters/TrackEfficiency' +# ) # Clone for Beam Halo Tracks -import DQM.TrackingMonitor.TrackEfficiencyMonitor_cfi -TrackEffMon_bhmuon = DQM.TrackingMonitor.TrackEfficiencyMonitor_cfi.TrackEffMon.clone() -TrackEffMon_bhmuon.TKTrackCollection = 'ctfWithMaterialTracksBeamHaloMuon' -TrackEffMon_bhmuon.AlgoName = 'BHMuonTk' -TrackEffMon_bhmuon.FolderName = 'Tracking/TrackParameters/TrackEfficiency' +from DQM.TrackingMonitor.TrackEfficiencyMonitor_cfi import * +TrackEffMon_bhmuon = TrackEffMon.clone( + TKTrackCollection = 'ctfWithMaterialTracksBeamHaloMuon', + AlgoName = 'BHMuonTk', + FolderName = 'Tracking/TrackParameters/TrackEfficiency' +) # Clone for Heavy Ion Tracks (for HI Collisions) -import DQM.TrackingMonitor.TrackEfficiencyMonitor_cfi -TrackEffMon_hi = DQM.TrackingMonitor.TrackEfficiencyMonitor_cfi.TrackEffMon.clone() -TrackEffMon_hi.TKTrackCollection = 'hiGeneralTracks' -TrackEffMon_hi.AlgoName = 'HeavyIonTk' -TrackEffMon_hi.FolderName = 'Tracking/TrackParameters/TrackEfficiency' +from DQM.TrackingMonitor.TrackEfficiencyMonitor_cfi import * +TrackEffMon_hi = TrackEffMon.clone( + TKTrackCollection = 'hiGeneralTracks', + AlgoName = 'HeavyIonTk', + FolderName = 'Tracking/TrackParameters/TrackEfficiency' +) diff --git a/DQM/TrackingMonitorSource/python/TrackingSourceConfig_Tier0_Cosmic_cff.py b/DQM/TrackingMonitorSource/python/TrackingSourceConfig_Tier0_Cosmic_cff.py index 05c5ea1e1b10d..28394a082b2b2 100644 --- a/DQM/TrackingMonitorSource/python/TrackingSourceConfig_Tier0_Cosmic_cff.py +++ b/DQM/TrackingMonitorSource/python/TrackingSourceConfig_Tier0_Cosmic_cff.py @@ -2,65 +2,73 @@ # TrackingMonitor #### # Clone for Cosmic Track Finder -import DQM.TrackingMonitor.TrackerCosmicsTrackingMonitor_cfi -TrackMon_cosmicTk = DQM.TrackingMonitor.TrackerCosmicsTrackingMonitor_cfi.TrackerCosmicTrackMon.clone() -TrackMon_cosmicTk.TrackProducer = 'cosmictrackfinderP5' -TrackMon_cosmicTk.AlgoName = 'CosmicTk' -TrackMon_cosmicTk.FolderName = 'Tracking/TrackParameters' -TrackMon_cosmicTk.doSeedParameterHistos = True +from DQM.TrackingMonitor.TrackerCosmicsTrackingMonitor_cfi import * +TrackMon_cosmicTk = TrackerCosmicTrackMon.clone( + TrackProducer = 'cosmictrackfinderP5', + AlgoName = 'CosmicTk', + FolderName = 'Tracking/TrackParameters', + doSeedParameterHistos = True +) # Clone for CKF Tracks -import DQM.TrackingMonitor.TrackerCosmicsTrackingMonitor_cfi -TrackMon_ckf = DQM.TrackingMonitor.TrackerCosmicsTrackingMonitor_cfi.TrackerCosmicTrackMon.clone() -TrackMon_ckf.TrackProducer = 'ctfWithMaterialTracksP5' -TrackMon_ckf.AlgoName = 'CKFTk' -TrackMon_ckf.FolderName = 'Tracking/TrackParameters' -TrackMon_ckf.doSeedParameterHistos = True +from DQM.TrackingMonitor.TrackerCosmicsTrackingMonitor_cfi import * +TrackMon_ckf = TrackerCosmicTrackMon.clone( + TrackProducer = 'ctfWithMaterialTracksP5', + AlgoName = 'CKFTk', + FolderName = 'Tracking/TrackParameters', + doSeedParameterHistos = True +) # Clone for Road Search Tracks -#import DQM.TrackingMonitor.TrackerCosmicsTrackingMonitor_cfi -#TrackMon_rs = DQM.TrackingMonitor.TrackerCosmicsTrackingMonitor_cfi.TrackerCosmicTrackMon.clone() -#TrackMon_rs.TrackProducer = 'rsWithMaterialTracksP5' -#TrackMon_rs.AlgoName = 'RSTk' -#TrackMon_rs.FolderName = 'Tracking/TrackParameters' -#TrackMon_rs.doSeedParameterHistos = True +from DQM.TrackingMonitor.TrackerCosmicsTrackingMonitor_cfi import * +TrackMon_rs = TrackerCosmicTrackMon.clone( + TrackProducer = 'rsWithMaterialTracksP5', + AlgoName = 'RSTk', + FolderName = 'Tracking/TrackParameters', + doSeedParameterHistos = True +) # Clone for Beam Halo Muon Tracks -import DQM.TrackingMonitor.TrackerCosmicsTrackingMonitor_cfi -TrackMon_bhmuon = DQM.TrackingMonitor.TrackerCosmicsTrackingMonitor_cfi.TrackerCosmicTrackMon.clone() -TrackMon_bhmuon.TrackProducer = 'ctfWithMaterialTracksBeamHaloMuon' -TrackMon_bhmuon.AlgoName = 'BHMuonTk' -TrackMon_bhmuon.FolderName = 'Tracking/TrackParameters' -TrackMon_bhmuon.doSeedParameterHistos = True +# from DQM.TrackingMonitor.TrackerCosmicsTrackingMonitor_cfi import * +# TrackMon_bhmuon = TrackerCosmicTrackMon.clone( +# TrackProducer = 'ctfWithMaterialTracksBeamHaloMuon', +# AlgoName = 'BHMuonTk', +# FolderName = 'Tracking/TrackParameters', +# doSeedParameterHistos = True +# ) # Tracking Efficiency # Clone for Cosmic Tracks -import DQM.TrackingMonitor.TrackEfficiencyMonitor_cfi -TrackEffMon_cosmicTk = DQM.TrackingMonitor.TrackEfficiencyMonitor_cfi.TrackEffMon.clone() -TrackEffMon_cosmicTk.TKTrackCollection = 'cosmictrackfinderP5' -TrackEffMon_cosmicTk.AlgoName = 'CosmicTk' -TrackEffMon_cosmicTk.FolderName = 'Tracking/TrackParameters/TrackEfficiency' +from DQM.TrackingMonitor.TrackEfficiencyMonitor_cfi import * +TrackEffMon_cosmicTk = TrackEffMon.clone( + TKTrackCollection = 'cosmictrackfinderP5', + AlgoName = 'CosmicTk', + FolderName = 'Tracking/TrackParameters/TrackEfficiency' +) # Clone for CKF Tracks -import DQM.TrackingMonitor.TrackEfficiencyMonitor_cfi -TrackEffMon_ckf = DQM.TrackingMonitor.TrackEfficiencyMonitor_cfi.TrackEffMon.clone() -TrackEffMon_ckf.TKTrackCollection = 'ctfWithMaterialTracksP5' -TrackEffMon_ckf.AlgoName = 'CKFTk' -TrackEffMon_ckf.FolderName = 'Tracking/TrackParameters/TrackEfficiency' +from DQM.TrackingMonitor.TrackEfficiencyMonitor_cfi import * +TrackEffMon_ckf = TrackEffMon.clone( + TKTrackCollection = 'ctfWithMaterialTracksP5', + AlgoName = 'CKFTk', + FolderName = 'Tracking/TrackParameters/TrackEfficiency' +) # Clone for RS Tracks -#import DQM.TrackingMonitor.TrackEfficiencyMonitor_cfi -#TrackEffMon_rs = DQM.TrackingMonitor.TrackEfficiencyMonitor_cfi.TrackEffMon.clone() -#TrackEffMon_rs.TKTrackCollection = 'rsWithMaterialTracksP5' -#TrackEffMon_rs.AlgoName = 'RSTk' -#TrackEffMon_rs.FolderName = 'Tracking/TrackParameters/TrackEfficiency' +# from DQM.TrackingMonitor.TrackEfficiencyMonitor_cfi import * +# TrackEffMon_rs = TrackEffMon.clone( +# TKTrackCollection = 'rsWithMaterialTracksP5', +# AlgoName = 'RSTk', +# FolderName = 'Tracking/TrackParameters/TrackEfficiency' +# ) # Clone for Beam Halo Tracks -import DQM.TrackingMonitor.TrackEfficiencyMonitor_cfi -TrackEffMon_bhmuon = DQM.TrackingMonitor.TrackEfficiencyMonitor_cfi.TrackEffMon.clone() -TrackEffMon_bhmuon.TKTrackCollection = 'ctfWithMaterialTracksBeamHaloMuon' -TrackEffMon_bhmuon.AlgoName = 'BHMuonTk' -TrackEffMon_bhmuon.FolderName = 'Tracking/TrackParameters/TrackEfficiency' +from DQM.TrackingMonitor.TrackEfficiencyMonitor_cfi import * +TrackEffMon_bhmuon = TrackEffMon.clone( + TKTrackCollection = 'ctfWithMaterialTracksBeamHaloMuon', + AlgoName = 'BHMuonTk', + FolderName = 'Tracking/TrackParameters/TrackEfficiency' +) # Split Tracking from DQM.TrackingMonitor.TrackSplittingMonitor_cfi import * @@ -75,10 +83,11 @@ for module in selectedModules4cosmics : label = str(module)+'LogMessageMon' - locals()[label] = LogMessageMonCommon.clone() - locals()[label].pluginsMonName = pluginsMonName[module] - locals()[label].modules = modulesLabel[module] - locals()[label].categories = categories[module] + locals()[label] = LogMessageMonCommon.clone( + pluginsMonName = pluginsMonName[module], + modules = modulesLabel[module], + categories = categories[module] + ) locals()[label].setLabel(label) # DQM Services diff --git a/DQM/TrackingMonitorSource/python/TrackingSourceConfig_Tier0_HeavyIons_cff.py b/DQM/TrackingMonitorSource/python/TrackingSourceConfig_Tier0_HeavyIons_cff.py index 4e7788a4e2d59..b1e3b6c275702 100644 --- a/DQM/TrackingMonitorSource/python/TrackingSourceConfig_Tier0_HeavyIons_cff.py +++ b/DQM/TrackingMonitorSource/python/TrackingSourceConfig_Tier0_HeavyIons_cff.py @@ -1,10 +1,11 @@ import FWCore.ParameterSet.Config as cms # TrackingMonitor #### -import DQM.TrackingMonitor.TrackerHeavyIonTrackingMonitor_cfi -TrackMon_hi = DQM.TrackingMonitor.TrackerHeavyIonTrackingMonitor_cfi.TrackerHeavyIonTrackMon.clone() -TrackMon_hi.FolderName = 'Tracking/TrackParameters' -TrackMon_hi.BSFolderName = 'Tracking/TrackParameters/BeamSpotParameters' -TrackMon_hi.TrackProducer = cms.InputTag("hiGeneralTracks") +from DQM.TrackingMonitor.TrackerHeavyIonTrackingMonitor_cfi import * +TrackMon_hi = TrackerHeavyIonTrackMon.clone( + FolderName = 'Tracking/TrackParameters', + BSFolderName = 'Tracking/TrackParameters/BeamSpotParameters', + TrackProducer = "hiGeneralTracks" +) TrackMonDQMTier0_hi = cms.Sequence(TrackMon_hi) diff --git a/DQM/TrackingMonitorSource/python/dEdxAnalyzer_cff.py b/DQM/TrackingMonitorSource/python/dEdxAnalyzer_cff.py index aa5b13b6c457f..bf1d76c0c680a 100644 --- a/DQM/TrackingMonitorSource/python/dEdxAnalyzer_cff.py +++ b/DQM/TrackingMonitorSource/python/dEdxAnalyzer_cff.py @@ -2,31 +2,43 @@ # dEdx monitor #### #from DQM.TrackingMonitor.dEdxAnalyzer_cff import * -import DQM.TrackingMonitor.dEdxAnalyzer_cfi +from DQM.TrackingMonitor.dEdxAnalyzer_cfi import * # Clone for all PDs but ZeroBias #### -dEdxMonCommon = DQM.TrackingMonitor.dEdxAnalyzer_cfi.dEdxAnalyzer.clone() +dEdxMonCommon = dEdxAnalyzer.clone() -dEdxHitMonCommon = DQM.TrackingMonitor.dEdxAnalyzer_cfi.dEdxHitAnalyzer.clone() +dEdxHitMonCommon = dEdxHitAnalyzer.clone() from DQM.TrackingMonitorSource.pset4GenericTriggerEventFlag_cfi import * # Clone for ZeroBias #### -dEdxMonMB = DQM.TrackingMonitor.dEdxAnalyzer_cfi.dEdxAnalyzer.clone() -dEdxMonMB.dEdxParameters.genericTriggerEventPSet = genericTriggerEventFlag4fullTrackerAndHLTdb +dEdxMonMB = dEdxAnalyzer.clone( + dEdxParameters = dEdxAnalyzer.dEdxParameters.clone( + genericTriggerEventPSet = genericTriggerEventFlag4fullTrackerAndHLTdb + ) +) -dEdxHitMonMB = DQM.TrackingMonitor.dEdxAnalyzer_cfi.dEdxHitAnalyzer.clone() -dEdxHitMonMB.dEdxParameters.genericTriggerEventPSet = genericTriggerEventFlag4fullTrackerAndHLTdb +dEdxHitMonMB = dEdxHitAnalyzer.clone( + dEdxParameters = dEdxHitAnalyzer.dEdxParameters.clone( + genericTriggerEventPSet = genericTriggerEventFlag4fullTrackerAndHLTdb + ) +) # Clone for SingleMu #### -dEdxMonMU = DQM.TrackingMonitor.dEdxAnalyzer_cfi.dEdxAnalyzer.clone() -dEdxMonMU.dEdxParameters.andOr = cms.bool( False ) -dEdxMonMU.dEdxParameters.hltInputTag = cms.InputTag( "TriggerResults::HLT" ) -dEdxMonMU.dEdxParameters.hltPaths = cms.vstring("HLT_SingleMu40_Eta2p1_*") -dEdxMonMU.dEdxParameters.errorReplyHlt = cms.bool( False ) -dEdxMonMU.dEdxParameters.andOrHlt = cms.bool(True) +dEdxMonMU = dEdxAnalyzer.clone( + dEdxParameters = cms.PSet( + andOr = cms.bool(False), + hltInputTag = cms.InputTag("TriggerResults::HLT"), + hltPaths = cms.vstring("HLT_SingleMu40_Eta2p1_*"), + errorReplyHlt = cms.bool(False), + andOrHlt = cms.bool(True) + ) +) -dEdxHitMonMU = DQM.TrackingMonitor.dEdxAnalyzer_cfi.dEdxHitAnalyzer.clone() -dEdxHitMonMU.dEdxParameters.andOr = cms.bool( False ) -dEdxHitMonMU.dEdxParameters.hltInputTag = cms.InputTag( "TriggerResults::HLT" ) -dEdxHitMonMU.dEdxParameters.hltPaths = cms.vstring("HLT_SingleMu40_Eta2p1_*") -dEdxHitMonMU.dEdxParameters.errorReplyHlt = cms.bool( False ) -dEdxHitMonMU.dEdxParameters.andOrHlt = cms.bool(True) +dEdxHitMonMU = dEdxHitAnalyzer.clone( + dEdxParameters = cms.PSet( + andOr = cms.bool(False), + hltInputTag = cms.InputTag("TriggerResults::HLT"), + hltPaths = cms.vstring("HLT_SingleMu40_Eta2p1_*"), + errorReplyHlt = cms.bool(False), + andOrHlt = cms.bool(True) + ) +) diff --git a/DQM/TrackingMonitorSource/python/dedxHarmonic2monitor_cfi.py b/DQM/TrackingMonitorSource/python/dedxHarmonic2monitor_cfi.py index 84416cc5cd64c..10fda2b0547c5 100644 --- a/DQM/TrackingMonitorSource/python/dedxHarmonic2monitor_cfi.py +++ b/DQM/TrackingMonitorSource/python/dedxHarmonic2monitor_cfi.py @@ -3,16 +3,19 @@ selectedDeDxHarm = {} from RecoTracker.DeDx.dedxEstimators_cff import dedxHarmonic2 -dedxDQMHarm2SP = dedxHarmonic2.clone() -dedxDQMHarm2SP.tracks = cms.InputTag("generalTracks") -dedxDQMHarm2SP.UseStrip = cms.bool(True) -dedxDQMHarm2SP.UsePixel = cms.bool(True) +dedxDQMHarm2SP = dedxHarmonic2.clone( + tracks = "generalTracks", + UseStrip = True, + UsePixel = True +) -dedxDQMHarm2SO = dedxDQMHarm2SP.clone() -dedxDQMHarm2SO.UsePixel = cms.bool(False) +dedxDQMHarm2SO = dedxDQMHarm2SP.clone( + UsePixel = False +) -dedxDQMHarm2PO = dedxDQMHarm2SP.clone() -dedxDQMHarm2PO.UseStrip = cms.bool(False) +dedxDQMHarm2PO = dedxDQMHarm2SP.clone( + UseStrip = False +) dedxHarmonicSequence = cms.Sequence() dedxHarmonicSequence+=dedxDQMHarm2SP diff --git a/DQM/TrackingMonitorSource/python/pixelTracksMonitoring_cff.py b/DQM/TrackingMonitorSource/python/pixelTracksMonitoring_cff.py index 7c3519ed8786b..4ee76ab68bfd5 100644 --- a/DQM/TrackingMonitorSource/python/pixelTracksMonitoring_cff.py +++ b/DQM/TrackingMonitorSource/python/pixelTracksMonitoring_cff.py @@ -1,25 +1,24 @@ import FWCore.ParameterSet.Config as cms -import DQM.TrackingMonitor.TrackerCollisionTrackingMonitor_cfi -pixelTracksMonitor = DQM.TrackingMonitor.TrackerCollisionTrackingMonitor_cfi.TrackerCollisionTrackMon.clone() -pixelTracksMonitor.FolderName = 'Tracking/PixelTrackParameters/pixelTracks' -pixelTracksMonitor.TrackProducer = 'pixelTracks' -pixelTracksMonitor.allTrackProducer = 'pixelTracks' -pixelTracksMonitor.beamSpot = 'offlineBeamSpot' -pixelTracksMonitor.primaryVertex = 'pixelVertices' -pixelTracksMonitor.pvNDOF = 1 -pixelTracksMonitor.doAllPlots = False -pixelTracksMonitor.doLumiAnalysis = True -pixelTracksMonitor.doProfilesVsLS = True -pixelTracksMonitor.doDCAPlots = True -pixelTracksMonitor.doProfilesVsLS = True -pixelTracksMonitor.doPlotsVsGoodPVtx = True -pixelTracksMonitor.doEffFromHitPatternVsPU = False -pixelTracksMonitor.doEffFromHitPatternVsBX = False -pixelTracksMonitor.doEffFromHitPatternVsLUMI = False -pixelTracksMonitor.doPlotsVsGoodPVtx = True -pixelTracksMonitor.doPlotsVsLUMI = True -pixelTracksMonitor.doPlotsVsBX = True +from DQM.TrackingMonitor.TrackerCollisionTrackingMonitor_cfi import * +pixelTracksMonitor = TrackerCollisionTrackMon.clone( + FolderName = 'Tracking/PixelTrackParameters/pixelTracks', + TrackProducer = 'pixelTracks', + allTrackProducer = 'pixelTracks', + beamSpot = 'offlineBeamSpot', + primaryVertex = 'pixelVertices', + pvNDOF = 1, + doAllPlots = False, + doLumiAnalysis = True, + doProfilesVsLS = True, + doDCAPlots = True, + doEffFromHitPatternVsPU = False, + doEffFromHitPatternVsBX = False, + doEffFromHitPatternVsLUMI = False, + doPlotsVsGoodPVtx = True, + doPlotsVsLUMI = True, + doPlotsVsBX = True +) _trackSelector = cms.EDFilter('TrackSelector', src = cms.InputTag('pixelTracks'), @@ -78,13 +77,13 @@ from CommonTools.ParticleFlow.goodOfflinePrimaryVertices_cfi import goodOfflinePrimaryVertices as _goodOfflinePrimaryVertices goodPixelVertices = _goodOfflinePrimaryVertices.clone( - src = "pixelVertices", + src = "pixelVertices" ) from DQM.TrackingMonitor.primaryVertexResolution_cfi import primaryVertexResolution as _primaryVertexResolution pixelVertexResolution = _primaryVertexResolution.clone( vertexSrc = "goodPixelVertices", - rootFolder = "OfflinePixelPV/Resolution", + rootFolder = "OfflinePixelPV/Resolution" ) pixelTracksMonitoringTask = cms.Task( diff --git a/DQM/TrackingMonitorSource/src/TrackToTrackComparisonHists.cc b/DQM/TrackingMonitorSource/src/TrackToTrackComparisonHists.cc index 983fa54270163..a30b0a94d92ee 100644 --- a/DQM/TrackingMonitorSource/src/TrackToTrackComparisonHists.cc +++ b/DQM/TrackingMonitorSource/src/TrackToTrackComparisonHists.cc @@ -120,7 +120,7 @@ void TrackToTrackComparisonHists::analyze(const edm::Event& iEvent, const edm::E edm::Handle monitoredPVHandle; iEvent.getByToken(monitoredPVToken_, monitoredPVHandle); - if (!monitoredTracksHandle.isValid()) { + if (!monitoredPVHandle.isValid()) { edm::LogError("TrackToTrackComparisonHists") << "monitoredPVHandle not found, skipping event"; return; } diff --git a/DQMOffline/CalibTracker/plugins/SiStripBadComponentsDQMServiceReader.cc b/DQMOffline/CalibTracker/plugins/SiStripBadComponentsDQMServiceReader.cc index 7ae8d30dc2db6..9b1364f291d6a 100644 --- a/DQMOffline/CalibTracker/plugins/SiStripBadComponentsDQMServiceReader.cc +++ b/DQMOffline/CalibTracker/plugins/SiStripBadComponentsDQMServiceReader.cc @@ -8,8 +8,6 @@ #include #include -#include - using namespace std; SiStripBadComponentsDQMServiceReader::SiStripBadComponentsDQMServiceReader(const edm::ParameterSet& iConfig) @@ -47,7 +45,7 @@ void SiStripBadComponentsDQMServiceReader::analyze(const edm::Event& e, const ed unsigned int value = (*(range.first + it)); ss << detIdToString(detid[id], tTopo) << "\t" << detid[id] << "\t"; - uint32_t flag = boost::lexical_cast(siStripBadStrip.decode(value).flag); + uint32_t flag = static_cast(siStripBadStrip.decode(value).flag); printError(ss, ((flag & FedErrorMask) == FedErrorMask), "Fed error, "); printError(ss, ((flag & DigiErrorMask) == DigiErrorMask), "Digi error, "); @@ -120,7 +118,7 @@ string SiStripBadComponentsDQMServiceReader::detIdToString(DetId detid, const Tr name += "+"; } // if( side != -1 ) { - // name += boost::lexical_cast(side); + // name += std::to_string(side); // } return name; diff --git a/DQMOffline/Configuration/python/autoDQM.py b/DQMOffline/Configuration/python/autoDQM.py index fd3af6eb6b4d4..beffb3c556a9f 100644 --- a/DQMOffline/Configuration/python/autoDQM.py +++ b/DQMOffline/Configuration/python/autoDQM.py @@ -2,13 +2,17 @@ 'PostDQMOffline', 'DQMMessageLoggerClientSeq'], - 'common': ['@dcs+@DQMMessageLogger+@stripCommon+@pixel+@tracking+@L1TMon+@hlt+@beam+@castor+@physics+@tau+@ctpps', + 'commonReduced': ['@dcs+@DQMMessageLogger+@hlt+@beam+@castor+@physics', 'PostDQMOffline', - '@dcs+@DQMMessageLogger+@stripCommon+@pixel+@tracking+@L1TMon+@hlt+@beam+@fed+@tau+@ctpps+dqmFastTimerServiceClient'], + '@dcs+@DQMMessageLogger+@hlt+@beam+@fed+dqmFastTimerServiceClient'], - 'commonFakeHLT': ['@dcs+@DQMMessageLogger+@stripCommon+@pixel+@tracking+@L1TMon+@beam+@castor+@physics+@tau', + 'common': ['@dcs+@DQMMessageLogger+@stripCommon+@pixel+@tracking+@hlt+@beam+@castor+@physics', 'PostDQMOffline', - '@dcs+@DQMMessageLoggerClient+@stripCommon+@pixel+@tracking+@L1TMon+@beam+@fed+@tau+dqmFastTimerServiceClient'], + '@dcs+@DQMMessageLogger+@stripCommon+@pixel+@tracking+@hlt+@beam+@fed+dqmFastTimerServiceClient'], + + 'commonFakeHLT': ['@dcs+@DQMMessageLogger+@stripCommon+@pixel+@tracking+@beam+@castor+@physics', + 'PostDQMOffline', + '@dcs+@DQMMessageLoggerClient+@stripCommon+@pixel+@tracking+@beam+@fed+dqmFastTimerServiceClient'], 'commonSiStripZeroBias': ['@dcs+@DQMMessageLogger+@stripZeroBias+@pixelOnlyDQM+@trackingZeroBias+@L1TMon+@hlt+@beam+@castor+@physics', 'PostDQMOffline', @@ -162,9 +166,9 @@ 'PostDQMOffline', '@commonSiStripZeroBias+@muon+@hcal+@jetmet+@ecal'], - 'allForPrompt': ['@common+@muon+@hcal+@jetmet+@ecal+@egamma', + 'allForPrompt': ['@common+@muon+@L1TMon+@hcal+@jetmet+@ecal+@egamma', 'PostDQMOffline', - '@common+@muon+@hcal+@jetmet+@ecal+@egamma'], + '@common+@muon+@L1TMon+@hcal+@jetmet+@ecal+@egamma'], 'rerecoCommon': ['@common+@muon+@hcal+@jetmet+@ecal+@egamma+@L1TMuon+@L1TEgamma+@ctpps', 'PostDQMOffline', diff --git a/DQMOffline/L1Trigger/src/L1TTauOffline.cc b/DQMOffline/L1Trigger/src/L1TTauOffline.cc index 62838b5956894..5faf7ef570bf1 100644 --- a/DQMOffline/L1Trigger/src/L1TTauOffline.cc +++ b/DQMOffline/L1Trigger/src/L1TTauOffline.cc @@ -704,6 +704,19 @@ void L1TTauOffline::getProbeTaus(const edm::Event& iEvent, TLorentzVector mytau; mytau.SetPtEtaPhiE(tauIt->pt(), tauIt->eta(), tauIt->phi(), tauIt->energy()); + if ((*antimu)[tauCandidate].workingPoints.empty()) { + edm::LogWarning("L1TTauOffline") << "This offline tau has no antimu discriminator, skipping" << std::endl; + continue; + } + if ((*antiele)[tauCandidate].workingPoints.empty()) { + edm::LogWarning("L1TTauOffline") << "This offline tau has no antiele discriminator, skipping" << std::endl; + continue; + } + if ((*comb3T)[tauCandidate].workingPoints.empty()) { + edm::LogWarning("L1TTauOffline") << "This offline tau has no comb3T discriminator, skipping" << std::endl; + continue; + } + if (fabs(tauIt->charge()) == 1 && fabs(tauIt->eta()) < 2.1 && tauIt->pt() > 20 && (*antimu)[tauCandidate].workingPoints[AntiMuWPIndex_] && (*antiele)[tauCandidate].workingPoints[AntiEleWPIndex_] && (*dmf)[tauCandidate] > 0.5 && diff --git a/DQMOffline/Muon/interface/CSCOfflineMonitor.h b/DQMOffline/Muon/interface/CSCOfflineMonitor.h index 2a9ce2cd65e4c..72ae6ac6114b6 100644 --- a/DQMOffline/Muon/interface/CSCOfflineMonitor.h +++ b/DQMOffline/Muon/interface/CSCOfflineMonitor.h @@ -156,16 +156,19 @@ class CSCOfflineMonitor : public DQMEDAnalyzer { // Wire digis MonitorElement *hWirenGroupsTotal; + MonitorElement *hWirenGroupsTotalHi; std::vector hWireTBin; std::vector hWireNumber; // Strip Digis MonitorElement *hStripNFired; + MonitorElement *hStripNFiredHi; std::vector hStripNumber; std::vector hStripPed; // Rechits MonitorElement *hRHnrechits; + MonitorElement *hRHnrechitsHi; std::vector hRHGlobal; std::vector hRHSumQ; std::vector hRHTiming; diff --git a/DQMOffline/Muon/src/CSCOfflineMonitor.cc b/DQMOffline/Muon/src/CSCOfflineMonitor.cc index 46aefbec512c5..b37c0cf1d52e4 100644 --- a/DQMOffline/Muon/src/CSCOfflineMonitor.cc +++ b/DQMOffline/Muon/src/CSCOfflineMonitor.cc @@ -56,8 +56,13 @@ void CSCOfflineMonitor::bookHistograms(DQMStore::IBooker& ibooker, // wire digis ibooker.setCurrentFolder("CSC/CSCOfflineMonitor/Digis"); + // For low multiplicities (e.g. low or no pileup) hWirenGroupsTotal = - ibooker.book1D("hWirenGroupsTotal", "Fired Wires per Event; # Wiregroups Fired", 500, -0.5, 499.5); + ibooker.book1D("hWirenGroupsTotal", "Fired Wires per Event; # Wiregroups Fired", 250, 0., 250.); // 1 bin is 1 + // For high multiplcities (e.g. with pileup) + hWirenGroupsTotalHi = + ibooker.book1D("hWirenGroupsTotalHi", "Fired Wires per Event; # Wiregroups Fired", 250, 0., 1000.); // i bin is 4 + hWireTBin.push_back(ibooker.book1D("hWireTBin_m42", "Wire TBin Fired (ME -4/2); Time Bin (25ns)", 17, -0.5, 16.5)); hWireTBin.push_back(ibooker.book1D("hWireTBin_m41", "Wire TBin Fired (ME -4/1); Time Bin (25ns)", 17, -0.5, 16.5)); hWireTBin.push_back(ibooker.book1D("hWireTBin_m32", "Wire TBin Fired (ME -3/2); Time Bin (25ns)", 17, -0.5, 16.5)); @@ -120,8 +125,14 @@ void CSCOfflineMonitor::bookHistograms(DQMStore::IBooker& ibooker, ibooker.book1D("hWireNumber_p42", "Wiregroup Number Fired (ME +4/2); Wiregroup #", 113, -0.5, 112.5)); // strip digis - hStripNFired = - ibooker.book1D("hStripNFired", "Fired Strips per Event; # Strips Fired (above 13 ADC)", 1000, -0.5, 999.5); + + // For low multiplicities (e.g. low or no pileup) + hStripNFired = ibooker.book1D( + "hStripNFired", "Fired Strips per Event; # Strips Fired (above 13 ADC)", 400, 0., 400.); // 1 bin is 1 + // For high multiplcities (e.g. with pileup) + hStripNFiredHi = ibooker.book1D( + "hStripNFiredHi", "Fired Strips per Event; # Strips Fired (above 13 ADC)", 500, 0., 2000.); // 1 bin is 4 + hStripNumber.push_back( ibooker.book1D("hStripNumber_m42", "Strip Number Fired (ME -4/2); Strip # Fired (above 13 ADC)", 81, -0.5, 80.5)); hStripNumber.push_back( @@ -210,7 +221,11 @@ void CSCOfflineMonitor::bookHistograms(DQMStore::IBooker& ibooker, // rechits ibooker.setCurrentFolder("CSC/CSCOfflineMonitor/recHits"); - hRHnrechits = ibooker.book1D("hRHnrechits", "recHits per Event (all chambers); # of RecHits", 500, -0.50, 499.5); + // For low multiplicities (e.g. low or no pileup) + hRHnrechits = ibooker.book1D("hRHnrechits", "RecHits per Event; # of RecHits", 100, 0., 100.); // 1 bin is 1 + // For high multiplcities (e.g. with pileup) + hRHnrechitsHi = ibooker.book1D("hRHnrechitsHi", "RecHits per Event; # of RecHits", 250, 0., 1000.); // 1 bin is 4 + hRHGlobal.push_back(ibooker.book2D( "hRHGlobalp1", "recHit global X,Y station +1; Global X (cm); Global Y (cm)", 100, -800., 800., 100, -800., 800.)); hRHGlobal.push_back(ibooker.book2D( @@ -395,7 +410,8 @@ void CSCOfflineMonitor::bookHistograms(DQMStore::IBooker& ibooker, // segments ibooker.setCurrentFolder("CSC/CSCOfflineMonitor/Segments"); - hSnSegments = ibooker.book1D("hSnSegments", "Number of Segments per Event; # of Segments", 26, -0.5, 25.5); + hSnSegments = ibooker.book1D("hSnSegments", "Segments per Event; # of Segments", 100, 0., 100.); // 1 bin is 1 + hSnhitsAll = ibooker.book1D("hSnhits", "N hits on Segments; # of hits", 8, -0.5, 7.5); hSnhits.push_back(ibooker.book1D("hSnhitsm42", "# of hits on Segments (ME -4/2); # of hits", 8, -0.5, 7.5)); hSnhits.push_back(ibooker.book1D("hSnhitsm41", "# of hits on Segments (ME -4/1); # of hits", 8, -0.5, 7.5)); @@ -1028,10 +1044,8 @@ void CSCOfflineMonitor::doWireDigis(edm::Handle wires) { } } // end wire loop - // this way you can zero suppress but still store info on # events with no digis - // Tim: I'm unhappy with that since it breaks hist statistics - // if (nWireGroupsTotal == 0) nWireGroupsTotal = -1; hWirenGroupsTotal->Fill(nWireGroupsTotal); + hWirenGroupsTotalHi->Fill(nWireGroupsTotal); } // ============================================== @@ -1066,11 +1080,9 @@ void CSCOfflineMonitor::doStripDigis(edm::Handle strips) } } // end strip loop - // this way you can zero suppress but still store info on # events with no digis - // Tim: I guess the above comment means 'zero suppress' because the hist range is from -0.5. - // But doing this means the hist statistics are broken. If the zero bin is high, just apply log scale? - // if (nStripsFired == 0) nStripsFired = -1; hStripNFired->Fill(nStripsFired); + hStripNFiredHi->Fill(nStripsFired); + // fill n per event } @@ -1191,6 +1203,7 @@ void CSCOfflineMonitor::doRecHits(edm::Handle recHits, // if (nRecHits == 0) nRecHits = -1; // I see no point in doing this hRHnrechits->Fill(nRecHits); + hRHnrechitsHi->Fill(nRecHits); } // ============================================== @@ -1313,7 +1326,6 @@ void CSCOfflineMonitor::doSegments(edm::Handle cscSegments } // end segment loop - // if (nSegments == 0) nSegments = -1; // I see no point in doing this hSnSegments->Fill(nSegments); } @@ -1607,11 +1619,16 @@ void CSCOfflineMonitor::doEfficiencies(edm::Handle wires, NumberOfLayers++; } } - int bin = 0; - if (iS == 0) - bin = iR + 1 + (iE * 10); - else - bin = (iS + 1) * 2 + (iR + 1) + (iE * 10); + + // set bin = 1-10 for ME-42, ME-41,...ME-11B, ME-11A, + // 11-20 for ME+11A, ME+11B, ... ME+41, ME+42 + int bin = CSCDetId::iChamberType(iS + 1, iR + 1); // 1-10 for ME11A...ME42 + if (iE > 0) { // in this loop iE=1 is -z endcap + bin = 11 - bin; + } else { // in this loop iE=0 is +z endcap + bin += 10; + } + if (NumberOfLayers > 1) { //if(!(MultiSegments[iE][iS][iR][iC])){ if (AllSegments[iE][iS][iR][iC]) { @@ -1648,21 +1665,6 @@ void CSCOfflineMonitor::doEfficiencies(edm::Handle wires, if (1 == seg_ME3[1]) theSeg.push_back(&theSegments[3]); - // Needed for plots - // at the end the chamber types will be numbered as 1 to 20 - // (ME-4./2, ME-4/1, -ME3/2, -ME3/1, ..., +ME3/1, +ME3/2, ME+4/1, ME+4/2) - std::map chamberTypes; - chamberTypes["ME1/a"] = 0.5; - chamberTypes["ME1/b"] = 1.5; - chamberTypes["ME1/2"] = 2.5; - chamberTypes["ME1/3"] = 3.5; - chamberTypes["ME2/1"] = 4.5; - chamberTypes["ME2/2"] = 5.5; - chamberTypes["ME3/1"] = 6.5; - chamberTypes["ME3/2"] = 7.5; - chamberTypes["ME4/1"] = 8.5; - chamberTypes["ME4/2"] = 9.5; - if (!theSeg.empty()) { std::map extrapolatedPoint; std::map::iterator it; @@ -1728,18 +1730,15 @@ void CSCOfflineMonitor::doEfficiencies(edm::Handle wires, ++nRHLayers; } } - //std::cout<<" nRHLayers = "<specs()->chamberTypeName()]; - if (cscchamberCenter.z() < 0) { - verticalScale = -verticalScale; - } - verticalScale += 10.5; + + // set verticalScale to 1-10 for ME-42...ME-11A, + // 11-20 for ME+11A...ME+42 + float verticalScale = + 9. + cscchamber->id().endcap() + (cscchamber->specs()->chamberType()) * (cscchamber->id().zendcap()); + hSensitiveAreaEvt->Fill(float(cscchamber->id().chamber()), verticalScale); if (nRHLayers > 1) { // this chamber contains a reliable signal - //chamberTypes[cscchamber->specs()->chamberTypeName()]; - // "intrinsic" efficiencies - //std::cout<<" verticalScale = "< only 1 bin labelled \"" << moduleLabel + << "\" will be created in the DQM MonitorElement of the path"; + continue; + } + mePath_binLabels.emplace_back(moduleLabel); } @@ -439,7 +448,7 @@ void HLTFiltersDQMonitor::fillDescriptions(edm::ConfigurationDescriptions& descr edm::ParameterSetDescription desc; desc.add("folderName", "HLT/Filters"); desc.add("efficPlotNamePrefix", "effic_"); - desc.add("triggerResults", edm::InputTag("triggerResults::HLT")); + desc.add("triggerResults", edm::InputTag("TriggerResults::HLT")); desc.add("triggerSummaryAOD", edm::InputTag("hltTriggerSummaryAOD::HLT")); desc.add("triggerSummaryRAW", edm::InputTag("hltTriggerSummaryRAW::HLT")); descriptions.add("hltFiltersDQMonitor", desc); diff --git a/DQMServices/Components/plugins/DQMProvInfo.cc b/DQMServices/Components/plugins/DQMProvInfo.cc index 851fa385f7149..45b2aff852101 100644 --- a/DQMServices/Components/plugins/DQMProvInfo.cc +++ b/DQMServices/Components/plugins/DQMProvInfo.cc @@ -174,6 +174,8 @@ void DQMProvInfo::bookHistogramsEventInfo(DQMStore::IBooker& iBooker) { reportSummaryMap_->setBinLabel(VBIN_TE_M, "TECm", 2); reportSummaryMap_->setBinLabel(VBIN_CASTOR, "CASTOR", 2); reportSummaryMap_->setBinLabel(VBIN_ZDC, "ZDC", 2); + reportSummaryMap_->setBinLabel(VBIN_GEM_P, "GEMp", 2); + reportSummaryMap_->setBinLabel(VBIN_GEM_M, "GEMm", 2); reportSummaryMap_->setBinLabel(VBIN_PHYSICS_DECLARED, "PhysDecl", 2); reportSummaryMap_->setBinLabel(VBIN_MOMENTUM, "13 TeV", 2); reportSummaryMap_->setBinLabel(VBIN_STABLE_BEAM, "Stable B", 2); @@ -361,6 +363,8 @@ void DQMProvInfo::fillDcsBitsFromDCSRecord(const DCSRecord& dcsRecord, bool* dcs dcsBits[VBIN_TE_M] = dcsRecord.highVoltageReady(DCSRecord::Partition::TECm); dcsBits[VBIN_CASTOR] = dcsRecord.highVoltageReady(DCSRecord::Partition::CASTOR); dcsBits[VBIN_ZDC] = dcsRecord.highVoltageReady(DCSRecord::Partition::ZDC); + dcsBits[VBIN_GEM_P] = dcsRecord.highVoltageReady(DCSRecord::Partition::GEMp); + dcsBits[VBIN_GEM_M] = dcsRecord.highVoltageReady(DCSRecord::Partition::GEMm); } void DQMProvInfo::fillDcsBitsFromDcsStatusCollection(const edm::Handle& dcsStatusCollection, @@ -402,6 +406,8 @@ void DQMProvInfo::fillDcsBitsFromDcsStatusCollection(const edm::Handle { const static int VBIN_TE_M = 23; const static int VBIN_CASTOR = 24; const static int VBIN_ZDC = 25; + const static int VBIN_GEM_P = 26; + const static int VBIN_GEM_M = 27; // Highest DCS bin, used for the length of the corresponding array. // We will have the indexes to this array the same as the vbins numbers. // (I.e. value at index 0 will not be used.) - const static int MAX_DCS_VBINS = 25; + const static int MAX_DCS_VBINS = 27; - const static int VBIN_PHYSICS_DECLARED = 26; - const static int VBIN_MOMENTUM = 27; - const static int VBIN_STABLE_BEAM = 28; - const static int VBIN_VALID = 29; + const static int VBIN_PHYSICS_DECLARED = 28; + const static int VBIN_MOMENTUM = 29; + const static int VBIN_STABLE_BEAM = 30; + const static int VBIN_VALID = 31; - const static int MAX_VBINS = 29; + const static int MAX_VBINS = 31; // Beam momentum at flat top, used to determine if collisions are // occurring with the beams at the energy allowed for physics production. diff --git a/DQMServices/Components/scripts/dqmiodatasetharvest.py b/DQMServices/Components/scripts/dqmiodatasetharvest.py index 9bffce24d1e76..8cc0e10edc750 100755 --- a/DQMServices/Components/scripts/dqmiodatasetharvest.py +++ b/DQMServices/Components/scripts/dqmiodatasetharvest.py @@ -54,7 +54,7 @@ def tosqlite(x): return x if isinstance(x, float): return x - if isinstance(x, long): + if isinstance(x, int): return x else: try: diff --git a/DQMServices/Components/scripts/root2sqlite.py b/DQMServices/Components/scripts/root2sqlite.py index 3da3bdf0a0715..73486d5d360c2 100755 --- a/DQMServices/Components/scripts/root2sqlite.py +++ b/DQMServices/Components/scripts/root2sqlite.py @@ -30,7 +30,7 @@ def tosqlite(x): return x if isinstance(x, float): return x - if isinstance(x, long): + if isinstance(x, int): return x else: try: diff --git a/DQMServices/Core/interface/LegacyIOHelper.h b/DQMServices/Core/interface/LegacyIOHelper.h index 0a08fc05d2739..9e1ae4b506df4 100644 --- a/DQMServices/Core/interface/LegacyIOHelper.h +++ b/DQMServices/Core/interface/LegacyIOHelper.h @@ -2,6 +2,7 @@ #define DQMSERVICES_CORE_LEGACYIOHELPER_H #include "DQMServices/Core/interface/DQMStore.h" +#include "TROOT.h" // This class encapsulates the TDirectory based file format used for DQMGUI // uploads and many other use cases. @@ -16,8 +17,14 @@ class LegacyIOHelper { // use internal type here since we call this from the DQMStore itself. typedef dqm::implementation::DQMStore DQMStore; typedef dqm::legacy::MonitorElement MonitorElement; - LegacyIOHelper(DQMStore* dqmstore) : dbe_(dqmstore){}; + typedef dqm::harvesting::DQMStore HarvestedDQMStore; + typedef dqm::harvesting::MonitorElement HarvestedMonitorElement; + + using MEMap = std::set; + + LegacyIOHelper(DQMStore* dqmstore) : dbe_(dqmstore){}; + LegacyIOHelper(HarvestedDQMStore* hdqmstore) : dbe_(hdqmstore){}; // Replace or append to `filename`, a TDirectory ROOT file. If a run number // is passed, the paths are rewritten to the "Run Summary" format used by // DQMGUI. The run number does not affect which MEs are saved; this code only @@ -32,9 +39,30 @@ class LegacyIOHelper { bool saveall = true, std::string const& fileupdate = "RECREATE"); + bool open(std::string const& filename, std::string const& path = "", uint32_t const run = 0); + private: + template + void getMEName(T* h, const std::string& toppath, std::string& meName) { + std::ostringstream fullpath; + fullpath << gDirectory->GetPath() << "/" << h->GetName(); + std::string dirpath = fullpath.str(); + // Search for the substring in string + size_t pos = dirpath.find(toppath); + if (pos != std::string::npos) { + dirpath.erase(pos, toppath.length()); + } + std::string rsummary = "/Run summary"; + pos = dirpath.find(rsummary); + if (pos != std::string::npos) { + dirpath.erase(pos, rsummary.length()); + } + meName = dirpath; + } + bool readdir(TDirectory* dir, const std::string& toppath); bool createDirectoryIfNeededAndCd(const std::string& path); DQMStore* dbe_; + MEMap data_; }; #endif diff --git a/DQMServices/Core/src/LegacyIOHelper.cc b/DQMServices/Core/src/LegacyIOHelper.cc index 3e5e6831bc884..83abc3017a3a6 100644 --- a/DQMServices/Core/src/LegacyIOHelper.cc +++ b/DQMServices/Core/src/LegacyIOHelper.cc @@ -1,4 +1,5 @@ #include "DQMServices/Core/interface/LegacyIOHelper.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" #include #include @@ -8,6 +9,7 @@ #include "TString.h" #include "TSystem.h" #include "TFile.h" +#include "TKey.h" #include void LegacyIOHelper::save(std::string const &filename, @@ -164,3 +166,103 @@ bool LegacyIOHelper::createDirectoryIfNeededAndCd(const std::string &path) { return true; } + +bool LegacyIOHelper::readdir(TDirectory *dir, const std::string &toppath) { + TDirectory *dirsav = gDirectory; + LogDebug("LegacyIOHelper") << "Inside:" << gDirectory->GetPath() << std::endl; + TIter next(dir->GetListOfKeys()); + TKey *key; + while ((key = (TKey *)next())) { + if (key->IsFolder()) { + LogDebug("LegacyIOHelper") << key->GetName() << std::endl; + dir->cd(key->GetName()); + TDirectory *subdir = gDirectory; + readdir(subdir, toppath); + dirsav->cd(); + continue; + } else { + TClass *cl = gROOT->GetClass(key->GetClassName()); + std::string meName; + if (cl->InheritsFrom("TProfile")) { + TProfile *h = dynamic_cast(key->ReadObject()->Clone()); + h->SetDirectory(nullptr); + if (h) { + getMEName(h, toppath, meName); + data_.insert(dbe_->bookProfile(meName, h)); + } + } else if (cl->InheritsFrom("TProfile2D")) { + TProfile2D *h = dynamic_cast(key->ReadObject()->Clone()); + h->SetDirectory(nullptr); + if (h) { + getMEName(h, toppath, meName); + data_.insert(dbe_->bookProfile2D(meName, h)); + } + } else if (cl->InheritsFrom("TH1F")) { + TH1F *h = dynamic_cast(key->ReadObject()->Clone()); + h->SetDirectory(nullptr); + if (h) { + getMEName(h, toppath, meName); + data_.insert(dbe_->book1D(meName, h)); + } + } else if (cl->InheritsFrom("TH1S")) { + TH1S *h = dynamic_cast(key->ReadObject()->Clone()); + h->SetDirectory(nullptr); + if (h) { + getMEName(h, toppath, meName); + data_.insert(dbe_->book1S(meName, h)); + } + } else if (cl->InheritsFrom("TH1D")) { + TH1D *h = dynamic_cast(key->ReadObject()->Clone()); + h->SetDirectory(nullptr); + if (h) { + getMEName(h, toppath, meName); + data_.insert(dbe_->book1DD(meName, h)); + } + } else if (cl->InheritsFrom("TH2F")) { + TH2F *h = dynamic_cast(key->ReadObject()->Clone()); + h->SetDirectory(nullptr); + if (h) { + getMEName(h, toppath, meName); + data_.insert(dbe_->book2D(meName, h)); + } + } else if (cl->InheritsFrom("TH2S")) { + TH2S *h = dynamic_cast(key->ReadObject()->Clone()); + h->SetDirectory(nullptr); + if (h) { + getMEName(h, toppath, meName); + data_.insert(dbe_->book2S(meName, h)); + } + } else if (cl->InheritsFrom("TH2D")) { + TH2D *h = dynamic_cast(key->ReadObject()->Clone()); + h->SetDirectory(nullptr); + if (h) { + getMEName(h, toppath, meName); + data_.insert(dbe_->book2DD(meName, h)); + } + } else if (cl->InheritsFrom("TH3F")) { + TH3F *h = dynamic_cast(key->ReadObject()->Clone()); + h->SetDirectory(nullptr); + if (h) { + getMEName(h, toppath, meName); + data_.insert(dbe_->book3D(meName, h)); + } + } + } + } + if (!data_.empty()) + return true; + return false; +} + +bool LegacyIOHelper::open(std::string const &filename, std::string const &path, uint32_t const run) { + TFile *f1 = TFile::Open(filename.c_str()); + if (!f1) + return false; + std::ostringstream toppath; + toppath << filename << ":/DQMData/Run " << run << "/"; + std::string dirpath = toppath.str(); + edm::LogPrint("LegacyIOHelper") << dirpath << std::endl; + bool flag = readdir(f1, dirpath); + f1->Close(); + return flag; +} diff --git a/DQMServices/FileIO/scripts/compareHistograms.py b/DQMServices/FileIO/scripts/compareHistograms.py index 2e269da323a46..070050162bb54 100755 --- a/DQMServices/FileIO/scripts/compareHistograms.py +++ b/DQMServices/FileIO/scripts/compareHistograms.py @@ -8,11 +8,12 @@ import argparse import numpy as np from DQMServices.FileIO.blacklist import get_blacklist +import multiprocessing -def create_dif(base_file_path, pr_file_path, pr_number, test_number, cmssw_version, output_dir_path): +def create_dif(base_file_path, pr_file_path, pr_number, test_number, cmssw_version, num_processes, output_dir_path): base_file = ROOT.TFile(base_file_path, 'read') ROOT.gROOT.GetListOfFiles().Remove(base_file) - + pr_file = ROOT.TFile(pr_file_path, 'read') ROOT.gROOT.GetListOfFiles().Remove(pr_file) @@ -29,7 +30,7 @@ def create_dif(base_file_path, pr_file_path, pr_number, test_number, cmssw_versi return run_nr = get_run_nr(pr_file_path) - + # Get list of paths (lists of directories) base_flat_dict = flatten_file(base_file, run_nr) pr_flat_dict = flatten_file(pr_file, run_nr) @@ -50,8 +51,35 @@ def create_dif(base_file_path, pr_file_path, pr_number, test_number, cmssw_versi paths_to_save_in_pr = [] # Make comparison - compare(shared_paths, pr_flat_dict, base_flat_dict, paths_to_save_in_pr, paths_to_save_in_base) - + if num_processes > 1: + print("starting comparison using %d process(es)" % num_processes) + manager = multiprocessing.Manager() + return_dict = manager.dict() + proc = [] + iProc = 0 + + block = len(shared_paths)//num_processes + for i in range(num_processes): + p = multiprocessing.Process(target=compareMP, args=(shared_paths[i*block:(i+1)*block], pr_flat_dict, base_flat_dict, i, return_dict)) + proc.append(p) + p.start() + iProc += 1 + p = multiprocessing.Process(target=compareMP, args=(shared_paths[(i+1)*block:len(shared_paths)], pr_flat_dict, base_flat_dict, num_processes, return_dict)) + proc.append(p) + p.start() + iProc += 1 + + for i in range(iProc): + proc[i].join() + paths_to_save_in_pr.extend(return_dict[i]['pr']) + paths_to_save_in_base.extend(return_dict[i]['base']) + + paths_to_save_in_pr.sort() + paths_to_save_in_base.sort() + print("Done") + else: + compare(shared_paths, pr_flat_dict, base_flat_dict, paths_to_save_in_pr, paths_to_save_in_base) + # Collect paths that have to be written to baseline output file for path in only_base_paths: item = base_flat_dict[path] @@ -60,7 +88,7 @@ def create_dif(base_file_path, pr_file_path, pr_number, test_number, cmssw_versi continue paths_to_save_in_base.append(path) - + # Collect paths that have to be written to PR output file for path in only_pr_paths: item = pr_flat_dict[path] @@ -75,7 +103,7 @@ def create_dif(base_file_path, pr_file_path, pr_number, test_number, cmssw_versi # Write baseline output save_paths(base_flat_dict, paths_to_save_in_base, os.path.join(output_dir_path, 'base', base_output_filename)) - + # Write PR output save_paths(pr_flat_dict, paths_to_save_in_pr, os.path.join(output_dir_path, 'pr', pr_output_filename)) @@ -92,6 +120,45 @@ def create_dif(base_file_path, pr_file_path, pr_number, test_number, cmssw_versi print(pr_output_filename) print('%s %s %s' % (nr_of_changed_elements, nr_of_removed_elements, nr_of_added_elements)) +def compareMP(shared_paths, pr_flat_dict, base_flat_dict, iProc, return_dict): + # Prepare output dictionary + comparisons = {'pr': [], 'base': []} + + # Collect paths that have to be written to both output files + for path in shared_paths: + pr_item = pr_flat_dict[path] + base_item = base_flat_dict[path] + + if pr_item == None or base_item == None: + continue + + are_different=False + + if pr_item.InheritsFrom('TProfile2D') and base_item.InheritsFrom('TProfile2D'): + # Compare TProfile (content, entries and errors) + are_different = not compare_TProfile(pr_item, base_item) + + elif pr_item.InheritsFrom('TProfile') and base_item.InheritsFrom('TProfile'): + # Compare TProfile (content, entries and errors) + are_different = not compare_TProfile(pr_item, base_item) + + elif pr_item.InheritsFrom('TH1') and base_item.InheritsFrom('TH1'): + # Compare bin by bin + pr_array = np.array(pr_item) + base_array = np.array(base_item) + + if pr_array.shape != base_array.shape or not np.allclose(pr_array, base_array, equal_nan=True): + are_different = True + else: + # Compare non histograms + if pr_item != base_item: + are_different = True + + if are_different: + comparisons['pr'].append(path) + comparisons['base'].append(path) + return_dict[iProc] = comparisons + def compare(shared_paths, pr_flat_dict, base_flat_dict, paths_to_save_in_pr, paths_to_save_in_base): # Collect paths that have to be written to both output files for path in shared_paths: @@ -106,7 +173,7 @@ def compare(shared_paths, pr_flat_dict, base_flat_dict, paths_to_save_in_pr, pat if pr_item.InheritsFrom('TProfile2D') and base_item.InheritsFrom('TProfile2D'): # Compare TProfile (content, entries and errors) are_different = not compare_TProfile(pr_item, base_item) - + elif pr_item.InheritsFrom('TProfile') and base_item.InheritsFrom('TProfile'): # Compare TProfile (content, entries and errors) are_different = not compare_TProfile(pr_item, base_item) @@ -131,7 +198,7 @@ def compare(shared_paths, pr_flat_dict, base_flat_dict, paths_to_save_in_pr, pat def compare_TProfile(pr_item, base_item): if pr_item.GetSize() != base_item.GetSize(): return False - + for i in range(pr_item.GetSize()): pr_bin_content = pr_item.GetBinContent(i) base_bin_content = base_item.GetBinContent(i) @@ -150,22 +217,22 @@ def compare_TProfile(pr_item, base_item): if not np.isclose(pr_bin_error, base_bin_error, equal_nan=True): return False - + return True def flatten_file(file, run_nr): - result = {} + result = {} for key in file.GetListOfKeys(): try: traverse_till_end(key.ReadObj(), [], result, run_nr) except: pass - + return result def traverse_till_end(node, dirs_list, result, run_nr): new_dir_list = dirs_list + [get_node_name(node)] - if hasattr(node, 'GetListOfKeys'): + if hasattr(node, 'GetListOfKeys'): for key in node.GetListOfKeys(): traverse_till_end(key.ReadObj(), new_dir_list, result, run_nr) else: @@ -202,7 +269,7 @@ def save_paths(flat_dict, paths, result_file_path): result_dir = os.path.dirname(result_file_path) if not os.path.exists(result_dir): os.makedirs(result_dir) - + result_file = ROOT.TFile(result_file_path, 'recreate') ROOT.gROOT.GetListOfFiles().Remove(result_file) @@ -270,9 +337,10 @@ def get_run_nr(file_path): parser.add_argument('-n', '--pr-number', help='PR number under test', default='00001') parser.add_argument('-t', '--test-number', help='Unique test number to distinguish different comparisons of the same PR.', default='1') parser.add_argument('-r', '--release-format', help='Release format in this format: CMSSW_10_5_X_2019-02-17-0000', default=os.environ['CMSSW_VERSION']) + parser.add_argument('-j', '--num-processes', help='Number of processes forked to parallel process the comparison', default=1, type=int) parser.add_argument('-o', '--output-dir', help='Comparison root files output directory', default='dqmHistoComparisonOutput') args = parser.parse_args() cmssw_version = '_'.join(args.release_format.split('_')[:4]) - - create_dif(args.base_file, args.pr_file, args.pr_number, args.test_number, cmssw_version, args.output_dir) + + create_dif(args.base_file, args.pr_file, args.pr_number, args.test_number, cmssw_version, args.num_processes, args.output_dir) diff --git a/DQMServices/StreamerIO/plugins/DQMStreamerReader.cc b/DQMServices/StreamerIO/plugins/DQMStreamerReader.cc index c14e8f3a63d24..e7fe502ce1aab 100644 --- a/DQMServices/StreamerIO/plugins/DQMStreamerReader.cc +++ b/DQMServices/StreamerIO/plugins/DQMStreamerReader.cc @@ -15,12 +15,8 @@ #include #include #include - -#include -#include -#include -#include -#include +#include +#include #include @@ -347,7 +343,10 @@ namespace dqmservices { acceptAllEvt_ = false; for (Strings::const_iterator i(hltSel_.begin()), end(hltSel_.end()); i != end; ++i) { std::string hltPath(*i); - boost::erase_all(hltPath, " \t"); + hltPath.erase( + std::remove_if( + hltPath.begin(), hltPath.end(), [](char c) { return std::isspace(static_cast(c)); }), + hltPath.end()); if (hltPath == "*") acceptAllEvt_ = true; } @@ -361,7 +360,10 @@ namespace dqmservices { matchTriggerSel_ = false; for (Strings::const_iterator i(hltSel_.begin()), end(hltSel_.end()); i != end; ++i) { std::string hltPath(*i); - boost::erase_all(hltPath, " \t"); + hltPath.erase( + std::remove_if( + hltPath.begin(), hltPath.end(), [](char c) { return std::isspace(static_cast(c)); }), + hltPath.end()); std::vector matches = edm::regexMatch(tnames, hltPath); if (!matches.empty()) { matchTriggerSel_ = true; diff --git a/DQMServices/StreamerIO/scripts/esMonitoring.py b/DQMServices/StreamerIO/scripts/esMonitoring.py index fb562bc1fd981..03ad5cb79a478 100755 --- a/DQMServices/StreamerIO/scripts/esMonitoring.py +++ b/DQMServices/StreamerIO/scripts/esMonitoring.py @@ -52,7 +52,7 @@ def defaults(self): pr = l.split("=") if len(pr) > 1 and pr[0] == "runNumber" and pr[1].isdigit(): - run = long(pr[1]) + run = int(pr[1]) self.doc["run"] = run self.make_id() @@ -219,6 +219,7 @@ def handle_close(self): def handle_read(self): rbuf = self.recv(1024*16) + rbuf = rbuf.decode('utf-8') ## not needed, since asyncore automatically handles close #if len(rbuf) == 0: # self.handle_close() diff --git a/DQMServices/StreamerIO/scripts/ztee.py b/DQMServices/StreamerIO/scripts/ztee.py index 5f9c829ba2425..e7e9508c43248 100755 --- a/DQMServices/StreamerIO/scripts/ztee.py +++ b/DQMServices/StreamerIO/scripts/ztee.py @@ -31,7 +31,7 @@ def __init__(self, log_file): self.file_truncate_state = None def write_block(self, data): - self.file.write(self.zstream.compress(data)) + self.file.write(self.zstream.compress( data.encode("utf-8") )) self.file.write(self.zstream.flush(zlib.Z_FULL_FLUSH)) def flush_block(self): diff --git a/DataFormats/BTauReco/interface/PFCombinedTauTagInfo.h b/DataFormats/BTauReco/interface/PFCombinedTauTagInfo.h deleted file mode 100644 index aa7354fb2659e..0000000000000 --- a/DataFormats/BTauReco/interface/PFCombinedTauTagInfo.h +++ /dev/null @@ -1,192 +0,0 @@ -#ifndef DataFormats_BTauReco_PFCombinedTauTagInfo_h -#define DataFormats_BTauReco_PFCombinedTauTagInfo_h - -/* class PFCombinedTauTagInfo - * Extended object for the Particle Flow Tau Combination algorithm, - * created: Apr 21 2007, - * revised: Jun 23 2007, - * author: Ludovic Houchu. - */ - -#include -#include - -#include "DataFormats/BTauReco/interface/RefMacros.h" -#include "DataFormats/JetReco/interface/PFJetCollection.h" -#include "DataFormats/ParticleFlowCandidate/interface/PFCandidateFwd.h" -#include "DataFormats/BTauReco/interface/BaseTagInfo.h" -#include "DataFormats/BTauReco/interface/PFIsolatedTauTagInfo.h" - - - - -namespace reco { - class PFCombinedTauTagInfo : public BaseTagInfo{ - public: - PFCombinedTauTagInfo() { - candidate_selectedByPFChargedHadrCands_=false; - electronTagged_=false; - muonTagged_=false; - PFChargedHadrCands_.clear(); - selectedPFChargedHadrCands_.clear(); - signalPFChargedHadrCands_.clear(); - isolPFChargedHadrCands_.clear(); - leadPFChargedHadrCandsignedSipt_=NAN; - leadPFChargedHadrCandsignedSip3D_=NAN; - signedSflightpath_=NAN; - PFChargedHadrCandsEtJetEtRatio_=NAN; - PFNeutrHadrCandsE_=NAN; - PFNeutrHadrCandsN_=std::numeric_limits::quiet_NaN(); - PFNeutrHadrCandsRadius_=NAN; - PFGammaCandsE_=NAN; - isolPFGammaCandsE_=NAN; - PFGammaCandsN_=std::numeric_limits::quiet_NaN(); - PFGammaCandsRadius_=NAN; - PFGammaCandsEJetalternatERatio_=NAN; - isolPFGammaCandsEJetalternatERatio_=NAN; - PFGammaCandsERatio_=NAN; - alternatLorentzVect_.SetPx(NAN); - alternatLorentzVect_.SetPy(NAN); - alternatLorentzVect_.SetPz(NAN); - alternatLorentzVect_.SetE(NAN); - ECALEtleadPFChargedHadrCandPtRatio_=NAN; - HCALEtleadPFChargedHadrCandPtRatio_=NAN; - } - virtual ~PFCombinedTauTagInfo() {}; - - //the reference to the PFJet; - const PFJetRef& pfjetRef()const{return PFJetRef_;} - void setpfjetRef(const PFJetRef x){PFJetRef_=x;} - - //the reference to the PFIsolatedTauTagInfo; - const PFIsolatedTauTagInfoRef& isolatedtautaginfoRef()const{return PFIsolatedTauTagInfoRef_;} - void setisolatedtautaginfoRef(const PFIsolatedTauTagInfoRef x) {PFIsolatedTauTagInfoRef_=x;} - - //the PF charged hadron candidates contained in the PF Jet; - const PFCandidateRefVector& PFChargedHadrCands()const{return PFChargedHadrCands_;} - void setPFChargedHadrCands(const PFCandidateRefVector& x) {PFChargedHadrCands_=x;} - - //the PF charged hadron candidates considered in the isolation strip and signal cone selections; - const PFCandidateRefVector& selectedPFChargedHadrCands()const{return selectedPFChargedHadrCands_;} - void setselectedPFChargedHadrCands(const PFCandidateRefVector& x) {selectedPFChargedHadrCands_=x;} - - //the PF charged hadron candidates inside signal cone; - const PFCandidateRefVector& signalPFChargedHadrCands()const{return signalPFChargedHadrCands_;} - void setsignalPFChargedHadrCands(const PFCandidateRefVector& x) {signalPFChargedHadrCands_=x;} - - //the PF charged hadron candidates inside isolation band; - const PFCandidateRefVector& isolPFChargedHadrCands()const{return isolPFChargedHadrCands_;} - void setisolPFChargedHadrCands(const PFCandidateRefVector& x) {isolPFChargedHadrCands_=x;} - - virtual PFCombinedTauTagInfo* clone() const{return new PFCombinedTauTagInfo(*this );} - - // float JetTag::discriminator() returns 0. if candidate did not pass PF charged hadron candidates selection, - // 1. if candidate passed PF charged hadron candidates selection and did not contain PF gamma candidate(s), - // 0<= <=1 if candidate passed PF charged hadron candidates selection, contained PF gamma candidate(s) and went through the likelihood ratio mechanism, - // NaN the values of the likelihood functions PDFs are 0 (test the result of discriminator() with bool isnan(.)); - //computed with the parameters taken from the RecoTauTag/PFCombinedTauTag/data/ .cfi files - - bool selectedByPFChargedHadrCands()const{return(candidate_selectedByPFChargedHadrCands_);} - void setselectedByPFChargedHadrCands(bool x){candidate_selectedByPFChargedHadrCands_=x;} - - bool electronTagged()const{return(electronTagged_);} // true : passed PF charged hadron candidates sel., contains 1 signal charged hadron candidate, e-identified through (ECALEtleadPFChargedHadrCandPtRatio(),HCALEtleadPFChargedHadrCandPtRatio()) space; - void setelectronTagged(bool x){electronTagged_=x;} - - bool muonTagged()const{return(muonTagged_);} // true : passed PF charged hadron candidates sel., contains 1 signal charged hadron candidate, mu-identified through (ECALEtleadPFChargedHadrCandPtRatio(),HCALEtleadPFChargedHadrCandPtRatio()) space; - void setmuonTagged(bool x){muonTagged_=x;} - - double leadPFChargedHadrCandsignedSipt()const{return (leadPFChargedHadrCandsignedSipt_);} // NaN : failure; - void setleadPFChargedHadrCandsignedSipt(double x){leadPFChargedHadrCandsignedSipt_=x;} - - double leadPFChargedHadrCandsignedSip3D()const{return(leadPFChargedHadrCandsignedSip3D_);} // NaN : failure; - void setleadPFChargedHadrCandsignedSip3D(double x){leadPFChargedHadrCandsignedSip3D_=x;} - - double signedSflightpath()const{return (signedSflightpath_);} // NaN : failure, did not build a SV.; - void setsignedSflightpath(double x){signedSflightpath_=x;} - - // Et_PFchargedhadrcands/Etjet; - double PFChargedHadrCandsEtJetEtRatio()const{return(PFChargedHadrCandsEtJetEtRatio_);} - void setPFChargedHadrCandsEtJetEtRatio(double x){PFChargedHadrCandsEtJetEtRatio_=x;} - - // PF neutral hadron candidates E sum; - double PFNeutrHadrCandsE()const{return(PFNeutrHadrCandsE_);} - void setPFNeutrHadrCandsE(double x){PFNeutrHadrCandsE_=x;} - - int PFNeutrHadrCandsN()const{return(PFNeutrHadrCandsN_);} - void setPFNeutrHadrCandsN(int x){PFNeutrHadrCandsN_=x;} - - //mean DR_PFNeutrHadrcands-lead.PFcand.; - double PFNeutrHadrCandsRadius()const{return(PFNeutrHadrCandsRadius_);} // NaN : PFNeutrHadrCandsN()=0; - void setPFNeutrHadrCandsRadius(double x){PFNeutrHadrCandsRadius_=x;} - - // PF gamma candidates E sum; - double PFGammaCandsE()const{return(PFGammaCandsE_);} - void setPFGammaCandsE(double x){PFGammaCandsE_=x;} - - // isol. band PF gamma candidates E sum; - double isolPFGammaCandsE()const{return(isolPFGammaCandsE_);} - void setisolPFGammaCandsE(double x){isolPFGammaCandsE_=x;} - - int PFGammaCandsN()const{return(PFGammaCandsN_);} - void setPFGammaCandsN(int x){PFGammaCandsN_=x;} - - //mean DR_PFgammacands-lead.PFcand.; - double PFGammaCandsRadius()const{return(PFGammaCandsRadius_);} // NaN : PFGammaCandsN()=0; - void setPFGammaCandsRadius(double x){PFGammaCandsRadius_=x;} - - // E_PFgammacands / (E_PFgammacands + E_PFchargedhadrcands); - double PFGammaCandsEJetalternatERatio()const{return(PFGammaCandsEJetalternatERatio_);} - void setPFGammaCandsEJetalternatERatio(double x){PFGammaCandsEJetalternatERatio_=x;} - - // E_PFgammacands,isol.band / (E_PFgammacands + E_PFchargedhadrcands); - double isolPFGammaCandsEJetalternatERatio()const{return(isolPFGammaCandsEJetalternatERatio_);} - void setisolPFGammaCandsEJetalternatERatio(double x){isolPFGammaCandsEJetalternatERatio_=x;} - - // E_PFgammacands,isol.band / E_PFgammacands; - double PFGammaCandsERatio()const{return(PFGammaCandsERatio_);} // NaN : PFGammaCandsN()=0; - void setPFGammaCandsERatio(double x){PFGammaCandsERatio_=x;} - - math::XYZTLorentzVector alternatLorentzVect()const{return(alternatLorentzVect_);} // rec. charged hadr. candidates + rec. gamma candidates combined; - void setalternatLorentzVect(math::XYZTLorentzVector x){alternatLorentzVect_=x;} - - // EtECAL*/Pt_lead.PFcand. *using ECAL cell hits inside a DR cone around lead. charged hadr. candidate ECAL impact point direction; - double ECALEtleadPFChargedHadrCandPtRatio()const{return(ECALEtleadPFChargedHadrCandPtRatio_);} // NaN : failure when trying to find the lead. charged hadr. candidate contact on ECAL surface point; - void setECALEtleadPFChargedHadrCandPtRatio(double x){ECALEtleadPFChargedHadrCandPtRatio_=x;} - - // EtHCAL**/Pt_lead.PFcand.; **using HCAL tower hits inside a DR cone around lead. charged hadr. candidate ECAL impact point direction; - double HCALEtleadPFChargedHadrCandPtRatio()const{return(HCALEtleadPFChargedHadrCandPtRatio_);} // NaN : failure when trying to find the lead. charged hadr. candidate contact on ECAL surface point; - void setHCALEtleadPFChargedHadrCandPtRatio(double x){HCALEtleadPFChargedHadrCandPtRatio_=x;} - private: - PFJetRef PFJetRef_; - PFIsolatedTauTagInfoRef PFIsolatedTauTagInfoRef_; - PFCandidateRefVector PFChargedHadrCands_; - PFCandidateRefVector selectedPFChargedHadrCands_; - PFCandidateRefVector signalPFChargedHadrCands_; - PFCandidateRefVector isolPFChargedHadrCands_; - bool candidate_selectedByPFChargedHadrCands_; - bool electronTagged_; - bool muonTagged_; - double leadPFChargedHadrCandsignedSipt_; - double leadPFChargedHadrCandsignedSip3D_; - double signedSflightpath_; - double PFChargedHadrCandsEtJetEtRatio_; - double PFNeutrHadrCandsE_; - int PFNeutrHadrCandsN_; - double PFNeutrHadrCandsRadius_; - double PFGammaCandsE_; - double isolPFGammaCandsE_; - int PFGammaCandsN_; - double PFGammaCandsRadius_; - double PFGammaCandsEJetalternatERatio_; - double isolPFGammaCandsEJetalternatERatio_; - double PFGammaCandsERatio_; - math::XYZTLorentzVector alternatLorentzVect_; - double ECALEtleadPFChargedHadrCandPtRatio_; - double HCALEtleadPFChargedHadrCandPtRatio_; - }; - - DECLARE_EDM_REFS( PFCombinedTauTagInfo ) - -} - -#endif // DataFormats_BTauReco_PFCombinedTauTagInfo_h diff --git a/DataFormats/BTauReco/interface/PFIsolatedTauTagInfo.h b/DataFormats/BTauReco/interface/PFIsolatedTauTagInfo.h deleted file mode 100644 index 1a279e21e2ee3..0000000000000 --- a/DataFormats/BTauReco/interface/PFIsolatedTauTagInfo.h +++ /dev/null @@ -1,147 +0,0 @@ -#ifndef DataFormats_BTauReco_PFIsolatedTauTagInfo_h -#define DataFormats_BTauReco_PFIsolatedTauTagInfo_h - -/* class PFIsolatedTauTagInfo - * Extended object for the Particle Flow Tau Isolation algorithm, - * contains the result and the methods used in the PFConeIsolation Algorithm - * created: Apr 21 2007, - * revised: Jun 23 2007, - * authors: Simone Gennai, Ludovic Houchu - */ - -#include - -#include "DataFormats/BTauReco/interface/RefMacros.h" - -#include "Math/GenVector/PxPyPzE4D.h" -#include "DataFormats/ParticleFlowCandidate/interface/PFCandidate.h" -#include "DataFormats/ParticleFlowCandidate/interface/PFCandidateFwd.h" -#include "DataFormats/JetReco/interface/PFJetCollection.h" -#include "DataFormats/BTauReco/interface/BaseTagInfo.h" - - - - - - -const int PFChargedHadrCand_codenumber=1; -const int PFNeutrHadrCand_codenumber=5; -const int PFGammaCand_codenumber=4; - -const int PFRecTrack_codenumber=1; -const int PFRecECALClus_codenumber=4; -const int PFRecHCALClus_codenumber=5; - -namespace reco{ - class PFIsolatedTauTagInfo : public BaseTagInfo{ - public: - PFIsolatedTauTagInfo() {} - PFIsolatedTauTagInfo(PFCandidateRefVector PFCands){ - initialPFCands_=PFCands; - PFCands_=PFCands; - for(PFCandidateRefVector::const_iterator iPFCand=PFCands_.begin();iPFCand!=PFCands_.end();iPFCand++){ - if ((**iPFCand).particleId()==PFChargedHadrCand_codenumber) initialPFChargedHadrCands_.push_back(*iPFCand); - if ((**iPFCand).particleId()==PFNeutrHadrCand_codenumber) initialPFNeutrHadrCands_.push_back(*iPFCand); - if ((**iPFCand).particleId()==PFGammaCand_codenumber) initialPFGammaCands_.push_back(*iPFCand); - } - PFChargedHadrCands_=initialPFChargedHadrCands_; - PFNeutrHadrCands_=initialPFNeutrHadrCands_; - PFGammaCands_=initialPFGammaCands_; - alternatLorentzVect_.SetPx(NAN); - alternatLorentzVect_.SetPy(NAN); - alternatLorentzVect_.SetPz(NAN); - alternatLorentzVect_.SetE(NAN); - passedtrackerisolation_=false; - passedECALisolation_=false; - } - virtual ~PFIsolatedTauTagInfo(){}; - virtual PFIsolatedTauTagInfo* clone()const{return new PFIsolatedTauTagInfo(*this);} - - //get the PFCandidates's which compose the PF jet and may be have been filtered by filterPFChargedHadrCands(.,.,.,.,.,.), filterPFNeutrHadrCands(.), filterPFGammaCands(.) member functions - const PFCandidateRefVector& PFCands() const {return PFCands_;} - const PFCandidateRefVector& PFChargedHadrCands() const {return PFChargedHadrCands_;} - const PFCandidateRefVector& PFNeutrHadrCands() const {return PFNeutrHadrCands_;} - const PFCandidateRefVector& PFGammaCands() const {return PFGammaCands_;} - - // rec. jet Lorentz-vector combining charged hadr. PFCandidate's and gamma PFCandidate's - math::XYZTLorentzVector alternatLorentzVect()const{return(alternatLorentzVect_);} - void setalternatLorentzVect(math::XYZTLorentzVector x){alternatLorentzVect_=x;} - - //the reference to the PFJet - const PFJetRef& pfjetRef()const{return PFJetRef_;} - void setpfjetRef(const PFJetRef x){PFJetRef_=x;} - - //JetTag::discriminator() computed with the parameters taken from the RecoTauTag/PFConeIsolation/data/pfConeIsolation.cfi file - - // true if a lead. PFCandidate exists and no charged hadron PFCandidate was found in an DR isolation ring around it (DR isolation ring limits defined in the RecoTauTag/PFConeIsolation/data/pfConeIsolation.cfi file - bool passedtrackerisolation()const{return passedtrackerisolation_;} - void setpassedtrackerisolation(bool x){passedtrackerisolation_=x;} - - // true if a lead. PFCandidate exists and no gamma PFCandidate was found in an DR isolation ring around it (DR isolation ring limits defined in the RecoTauTag/PFConeIsolation/data/pfConeIsolation.cfi file - bool passedECALisolation()const{return passedECALisolation_;} - void setpassedECALisolation(bool x){passedECALisolation_=x;} - - //methods to be used to recompute the isolation with a new set of parameters - double discriminatorByIsolPFCandsN(float matchingcone_size,float signalcone_size,float isolcone_size,bool useOnlyChargedHadrforleadPFCand,float minPt_leadPFCand,float minPt_PFCand,int IsolPFCands_maxN=0)const; - double discriminatorByIsolPFCandsN(math::XYZVector myVector,float matchingcone_size,float signalcone_size,float isolcone_size,bool useOnlyChargedHadrforleadPFCand,float minPt_leadPFCand,float minPt_PFCand,int IsolPFCands_maxN=0)const; - double discriminatorByIsolPFChargedHadrCandsN(float matchingcone_size,float signalcone_size,float isolcone_size,bool useOnlyChargedHadrforleadPFCand,float minPt_leadPFCand,float minPt_PFCand,int IsolPFCands_maxN=0)const; - double discriminatorByIsolPFChargedHadrCandsN(math::XYZVector myVector,float matchingcone_size,float signalcone_size,float isolcone_size,bool useOnlyChargedHadrforleadPFCand,float minPt_leadPFCand,float minPt_PFCand,int IsolPFCands_maxN=0)const; - double discriminatorByIsolPFNeutrHadrCandsN(float matchingcone_size,float signalcone_size,float isolcone_size,bool useOnlyChargedHadrforleadPFCand,float minPt_leadPFCand,float minPt_PFCand,int IsolPFCands_maxN=0)const; - double discriminatorByIsolPFNeutrHadrCandsN(math::XYZVector myVector,float matchingcone_size,float signalcone_size,float isolcone_size,bool useOnlyChargedHadrforleadPFCand,float minPt_leadPFCand,float minPt_PFCand,int IsolPFCands_maxN=0)const; - double discriminatorByIsolPFGammaCandsN(float matchingcone_size,float signalcone_size,float isolcone_size,bool useOnlyChargedHadrforleadPFCand,float minPt_leadPFCand,float minPt_PFCand,int IsolPFCands_maxN=0)const; - double discriminatorByIsolPFGammaCandsN(math::XYZVector myVector,float matchingcone_size,float signalcone_size,float isolcone_size,bool useOnlyChargedHadrforleadPFCand,float minPt_leadPFCand,float minPt_PFCand,int IsolPFCands_maxN=0)const; - double discriminatorByIsolPFCandsEtSum(float matchingcone_size,float signalcone_size,float isolcone_size,bool useOnlyChargedHadrforleadPFCand,float minPt_leadPFCand,float minPt_PFCand,float IsolPFCands_maxEtSum=0)const; - double discriminatorByIsolPFCandsEtSum(math::XYZVector myVector,float matchingcone_size,float signalcone_size,float isolcone_size,bool useOnlyChargedHadrforleadPFCand,float minPt_leadPFCand,float minPt_PFCand,float IsolPFCands_maxEtSum=0)const; - double discriminatorByIsolPFChargedHadrCandsEtSum(float matchingcone_size,float signalcone_size,float isolcone_size,bool useOnlyChargedHadrforleadPFCand,float minPt_leadPFCand,float minPt_PFCand,float IsolPFCands_maxEtSum=0)const; - double discriminatorByIsolPFChargedHadrCandsEtSum(math::XYZVector myVector,float matchingcone_size,float signalcone_size,float isolcone_size,bool useOnlyChargedHadrforleadPFCand,float minPt_leadPFCand,float minPt_PFCand,float IsolPFCands_maxEtSum=0)const; - double discriminatorByIsolPFNeutrHadrCandsEtSum(float matchingcone_size,float signalcone_size,float isolcone_size,bool useOnlyChargedHadrforleadPFCand,float minPt_leadPFCand,float minPt_PFCand,float IsolPFCands_maxEtSum=0)const; - double discriminatorByIsolPFNeutrHadrCandsEtSum(math::XYZVector myVector,float matchingcone_size,float signalcone_size,float isolcone_size,bool useOnlyChargedHadrforleadPFCand,float minPt_leadPFCand,float minPt_PFCand,float IsolPFCands_maxEtSum=0)const; - double discriminatorByIsolPFGammaCandsEtSum(float matchingcone_size,float signalcone_size,float isolcone_size,bool useOnlyChargedHadrforleadPFCand,float minPt_leadPFCand,float minPt_PFCand,float IsolPFCands_maxEtSum=0)const; - double discriminatorByIsolPFGammaCandsEtSum(math::XYZVector myVector,float matchingcone_size,float signalcone_size,float isolcone_size,bool useOnlyChargedHadrforleadPFCand,float minPt_leadPFCand,float minPt_PFCand,float IsolPFCands_maxEtSum=0)const; - - // return all PFCandidate's in a cone of size "conesize" around a direction "myVector" - const PFCandidateRefVector PFCandsInCone(const math::XYZVector myVector,const float conesize,const float minPt)const; - const PFCandidateRefVector PFChargedHadrCandsInCone(const math::XYZVector myVector,const float conesize,const float minPt)const; - const PFCandidateRefVector PFNeutrHadrCandsInCone(const math::XYZVector myVector,const float conesize,const float minPt)const; - const PFCandidateRefVector PFGammaCandsInCone(const math::XYZVector myVector,const float conesize,const float minPt)const; - - // return all PFCandidate's in a band defined by inner(size "innercone_size") and outer(size "outercone_size") cones around a direction "myVector" - const PFCandidateRefVector PFCandsInBand(const math::XYZVector myVector,const float innercone_size,const float outercone_size,const float minPt)const; - const PFCandidateRefVector PFChargedHadrCandsInBand(const math::XYZVector myVector,const float innercone_size,const float outercone_size,const float minPt)const; - const PFCandidateRefVector PFNeutrHadrCandsInBand(const math::XYZVector myVector,const float innercone_size,const float outercone_size,const float minPt)const; - const PFCandidateRefVector PFGammaCandsInBand(const math::XYZVector myVector,const float innercone_size,const float outercone_size,const float minPt)const; - - //return the leading PFCandidate in a given cone around the jet axis or a given direction - const PFCandidateRef leadPFCand(const float matchingcone_size, const float minPt)const; - const PFCandidateRef leadPFCand(const math::XYZVector myVector,const float matchingcone_size, const float minPt)const; - const PFCandidateRef leadPFChargedHadrCand(const float matchingcone_size, const float minPt)const; - const PFCandidateRef leadPFChargedHadrCand(const math::XYZVector myVector,const float matchingcone_size, const float minPt)const; - const PFCandidateRef leadPFNeutrHadrCand(const float matchingcone_size, const float minPt)const; - const PFCandidateRef leadPFNeutrHadrCand(const math::XYZVector myVector,const float matchingcone_size, const float minPt)const; - const PFCandidateRef leadPFGammaCand(const float matchingcone_size, const float minPt)const; - const PFCandidateRef leadPFGammaCand(const math::XYZVector myVector,const float matchingcone_size, const float minPt)const; - - void filterPFChargedHadrCands(double ChargedHadrCand_tkminPt,int ChargedHadrCand_tkminPixelHitsn,int ChargedHadrCand_tkminTrackerHitsn,double ChargedHadrCand_tkmaxipt,double ChargedHadrCand_tkmaxChi2,double ChargedHadrCand_tktorefpointDZ,bool UsePVconstraint,double PVtx_Z,bool UseOnlyChargedHadr_for_LeadCand,double LeadChargedHadrCandtoJet_MatchingConeSize,double LeadChargedHadrCand_minPt); - void filterPFNeutrHadrCands(double NeutrHadrCand_HcalclusminEt); - void filterPFGammaCands(double GammaCand_EcalclusminEt); - void removefilters(); - private: - PFJetRef PFJetRef_; - PFCandidateRefVector initialPFCands_; - PFCandidateRefVector PFCands_; - PFCandidateRefVector initialPFChargedHadrCands_; - PFCandidateRefVector PFChargedHadrCands_; - PFCandidateRefVector initialPFNeutrHadrCands_; - PFCandidateRefVector PFNeutrHadrCands_; - PFCandidateRefVector initialPFGammaCands_; - PFCandidateRefVector PFGammaCands_; - math::XYZTLorentzVector alternatLorentzVect_; - bool passedtrackerisolation_; - bool passedECALisolation_; - }; - - DECLARE_EDM_REFS( PFIsolatedTauTagInfo ) - -} - -#endif // DataFormats_BTauReco_PFIsolatedTauTagInfo_h diff --git a/DataFormats/BTauReco/interface/TemplatedSecondaryVertexTagInfo.h b/DataFormats/BTauReco/interface/TemplatedSecondaryVertexTagInfo.h index af39d241c52df..d2f25b5219a5b 100644 --- a/DataFormats/BTauReco/interface/TemplatedSecondaryVertexTagInfo.h +++ b/DataFormats/BTauReco/interface/TemplatedSecondaryVertexTagInfo.h @@ -30,15 +30,15 @@ namespace reco { } struct TrackData { - enum Status { trackSelected = 0, trackUsedForVertexFit, trackAssociatedToVertex }; - - inline bool usedForVertexFit() const { return (int)svStatus >= (int)trackUsedForVertexFit; } - inline bool associatedToVertex() const { return (int)svStatus >= (int)trackAssociatedToVertex; } + static constexpr int trackSelected = 0; + static constexpr int trackUsedForVertexFit = 1; + static constexpr int trackAssociatedToVertex = 2; + inline bool usedForVertexFit() const { return svStatus >= trackUsedForVertexFit; } + inline bool associatedToVertex() const { return svStatus >= trackAssociatedToVertex; } inline bool associatedToVertex(unsigned int index) const { - return (int)svStatus == (int)trackAssociatedToVertex + (int)index; + return svStatus == trackAssociatedToVertex + (int)index; } - - Status svStatus; + int svStatus; }; typedef std::pair IndexedTrackData; diff --git a/DataFormats/BTauReco/interface/TrackIPData.h b/DataFormats/BTauReco/interface/TrackIPData.h deleted file mode 100644 index 4ac87ce7eb346..0000000000000 --- a/DataFormats/BTauReco/interface/TrackIPData.h +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef TrackIPData_h -#define TrackIPData_h - -#include "DataFormats/Common/interface/Ref.h" -#include "DataFormats/GeometryVector/interface/GlobalVector.h" -#include "DataFormats/GeometryCommonDetAlgo/interface/Measurement1D.h" - -#include "DataFormats/JetReco/interface/JetTracksAssociation.h" - -namespace reco { - - -struct TrackIPData -{ - Measurement1D impactParameter3D; - Measurement1D impactParameter2D; - //float decayLen; - //float decayLenError; -}; - -} -#endif - diff --git a/DataFormats/BTauReco/src/classes_def.xml b/DataFormats/BTauReco/src/classes_def.xml index 69836a6d308a9..5073b468ae6ce 100644 --- a/DataFormats/BTauReco/src/classes_def.xml +++ b/DataFormats/BTauReco/src/classes_def.xml @@ -32,7 +32,8 @@ - + + diff --git a/DataFormats/CTPPSReco/interface/CTPPSPixelRecHit.h b/DataFormats/CTPPSReco/interface/CTPPSPixelRecHit.h index 6cbc0d018ded8..cc51dda981676 100644 --- a/DataFormats/CTPPSReco/interface/CTPPSPixelRecHit.h +++ b/DataFormats/CTPPSReco/interface/CTPPSPixelRecHit.h @@ -1,10 +1,10 @@ /* * -* This is a part of CTPPS offline software. -* Author: -* Fabrizio Ferro (ferro@ge.infn.it) -* -*/ + * This is a part of CTPPS offline software. + * Author: + * Fabrizio Ferro (ferro@ge.infn.it) + * + */ #ifndef DataFormats_CTPPSReco_CTPPSPixelRecHit_H #define DataFormats_CTPPSReco_CTPPSPixelRecHit_H @@ -16,10 +16,8 @@ class CTPPSPixelRecHit { public: - CTPPSPixelRecHit() {} - - CTPPSPixelRecHit(LocalPoint lp, - LocalError le, + CTPPSPixelRecHit(LocalPoint lp = LocalPoint(0., 0., 0.), + LocalError le = LocalError(0., 0., 0.), bool edge = false, bool bad = false, bool rocs = false, diff --git a/DataFormats/CaloTowers/interface/CaloTower.h b/DataFormats/CaloTowers/interface/CaloTower.h index 88975ce2cc6b5..acb100fbf77df 100644 --- a/DataFormats/CaloTowers/interface/CaloTower.h +++ b/DataFormats/CaloTowers/interface/CaloTower.h @@ -229,8 +229,8 @@ class CaloTower : public reco::LeafCandidate { GlobalPoint hadPosition_; //hcal subdetector info - HcalSubdetector subdet_; - bool inHO_, inHBHEgap_; + HcalSubdetector subdet_{HcalEmpty}; + bool inHO_{false}, inHBHEgap_{false}; // time int ecalTime_; diff --git a/DataFormats/Common/interface/IDVectorMap.h b/DataFormats/Common/interface/IDVectorMap.h index 7e077f6299ac9..d38610d85621e 100644 --- a/DataFormats/Common/interface/IDVectorMap.h +++ b/DataFormats/Common/interface/IDVectorMap.h @@ -1,6 +1,7 @@ #ifndef DataFormats_Common_IDVectorMap_h #define DataFormats_Common_IDVectorMap_h #include +#include namespace edm { diff --git a/DataFormats/Common/interface/NewPolicy.h b/DataFormats/Common/interface/NewPolicy.h deleted file mode 100644 index d66ae410ee192..0000000000000 --- a/DataFormats/Common/interface/NewPolicy.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef DataFormats_Common_NewPolicy_h -#define DataFormats_Common_NewPolicy_h - -namespace edm { - template - struct NewPolicy{ - static T * clone(const T & t) { - return new T(t); - } - }; -} - -#endif diff --git a/DataFormats/Common/interface/OwnArray.h b/DataFormats/Common/interface/OwnArray.h deleted file mode 100644 index 73976f87bf97e..0000000000000 --- a/DataFormats/Common/interface/OwnArray.h +++ /dev/null @@ -1,506 +0,0 @@ -#ifndef DataFormats_Common_OwnArray_h -#define DataFormats_Common_OwnArray_h - -#include "DataFormats/Common/interface/CMS_CLASS_VERSION.h" -#include "DataFormats/Common/interface/ClonePolicy.h" -#include "DataFormats/Common/interface/fillPtrVector.h" -#include "DataFormats/Common/interface/Ref.h" -#include "DataFormats/Common/interface/setPtr.h" -#include "DataFormats/Common/interface/traits.h" - -#if defined CMS_USE_DEBUGGING_ALLOCATOR -#include "DataFormats/Common/interface/debugging_allocator.h" -#endif -#include "FWCore/Utilities/interface/EDMException.h" - -#include -#include -#include -#include - -namespace edm { - class ProductID; - template > - class OwnArray { - private: - typedef OwnArray self; - typedef std::vector base; - public: - typedef unsigned int size_type; - typedef T value_type; - typedef T* pointer; - typedef T& reference; - typedef T const& const_reference; - typedef P policy_type; - - class iterator; - class const_iterator { - public: - typedef T value_type; - typedef T* pointer; - typedef T const& reference; - typedef ptrdiff_t difference_type; - typedef typename base::const_iterator::iterator_category iterator_category; - const_iterator(pointer const * it) : i(it) { } - const_iterator(iterator const& it) : i(it.i) { } - const_iterator() {} - const_iterator& operator++() { ++i; return *this; } - const_iterator operator++(int) { const_iterator ci = *this; ++i; return ci; } - const_iterator& operator--() { --i; return *this; } - const_iterator operator--(int) { const_iterator ci = *this; --i; return ci; } - difference_type operator-(const_iterator const& o) const { return i - o.i; } - const_iterator operator+(difference_type n) const { return const_iterator(i + n); } - const_iterator operator-(difference_type n) const { return const_iterator(i - n); } - bool operator<(const_iterator const& o) const { return i < o.i; } - bool operator==(const_iterator const& ci) const { return i == ci.i; } - bool operator!=(const_iterator const& ci) const { return i != ci.i; } - T const& operator *() const { return **i; } - // operator T const*() const { return & **i; } - T const* operator->() const { return & (operator*()); } - const_iterator & operator +=(difference_type d) { i += d; return *this; } - const_iterator & operator -=(difference_type d) { i -= d; return *this; } - reference operator[](difference_type d) const { return *const_iterator(i+d); } // for boost::iterator_range [] - private: - pointer const * i; - }; - class iterator { - public: - typedef T value_type; - typedef T * pointer; - typedef T & reference; - typedef ptrdiff_t difference_type; - typedef typename base::iterator::iterator_category iterator_category; - iterator(pointer * it) : i(it) { } - iterator() {} - iterator& operator++() { ++i; return *this; } - iterator operator++(int) { iterator ci = *this; ++i; return ci; } - iterator& operator--() { --i; return *this; } - iterator operator--(int) { iterator ci = *this; --i; return ci; } - difference_type operator-(iterator const& o) const { return i - o.i; } - iterator operator+(difference_type n) const { return iterator(i + n); } - iterator operator-(difference_type n) const { return iterator(i - n); } - bool operator<(iterator const& o) const { return i < o.i; } - bool operator==(iterator const& ci) const { return i == ci.i; } - bool operator!=(iterator const& ci) const { return i != ci.i; } - T & operator *() const { return **i; } - // operator T *() const { return & **i; } - //T *& get() { return *i; } - T * operator->() const { return & (operator*()); } - iterator & operator +=(difference_type d) { i += d; return *this; } - iterator & operator -=(difference_type d) { i -= d; return *this; } - reference operator[](difference_type d) const { return *iterator(i+d); } // for boost::iterator_range [] - private: - pointer * i; - friend class const_iterator; - friend class OwnArray; - }; - - - OwnArray(); - OwnArray(size_type); - OwnArray(OwnArray const&); -#if defined(__GXX_EXPERIMENTAL_CXX0X__) - OwnArray(OwnArray&&); -#endif - - ~OwnArray(); - - iterator begin(); - iterator end(); - const_iterator begin() const; - const_iterator end() const; - size_type size() const; - bool empty() const; - reference operator[](size_type); - const_reference operator[](size_type) const; - - self& operator=(self const&); -#if defined(__GXX_EXPERIMENTAL_CXX0X__) - self& operator=(self&&); -#endif - - - void reserve(size_t){} - size_type capacity() const { return MAX_SIZE;} - template void push_back(D*& d); - template void push_back(D* const& d); - template void push_back(std::unique_ptr d); - void push_back(T const& valueToCopy); - bool is_back_safe() const; - void pop_back(); - reference back(); - const_reference back() const; - reference front(); - const_reference front() const; - pointer const * data() const; - void clear(); - iterator erase(iterator pos); - iterator erase(iterator first, iterator last); - template - void sort(S s); - void sort(); - - void swap(self& other); - - void fillView(ProductID const& id, - std::vector& pointers, - FillViewHelperVector& helpers) const; - - void setPtr(std::type_info const& toType, - unsigned long index, - void const*& ptr) const; - - void fillPtrVector(std::type_info const& toType, - std::vector const& indices, - std::vector& ptrs) const; - - - //Used by ROOT storage - CMS_CLASS_VERSION(11) - - private: - void destroy(); - template - struct Ordering { - Ordering(O const& c) : comp(c) { } - bool operator()(T const* t1, T const* t2) const { - return comp(*t1, *t2); - } - private: - O comp; - }; - template - static Ordering ordering(O const& comp) { - return Ordering(comp); - } - pointer data_[MAX_SIZE]; - size_type size_; - }; - - template - inline OwnArray::OwnArray() : data_{{0}}, size_(0) { - } - - template - inline OwnArray::OwnArray(size_type n) : data_{{0}}, size_(n) { - } - - template - inline OwnArray::OwnArray(OwnArray const& o) : size_(o.size()) { - size_type current = 0; - for (const_iterator i = o.begin(), e = o.end(); i != e; ++i,++current) - data_[current] = policy_type::clone(*i); - } - -#if defined(__GXX_EXPERIMENTAL_CXX0X__) - template - inline OwnArray::OwnArray(OwnArray&& o) { - std::swap_ranges(data_,data_+M, o.data_); - } -#endif - - template - inline OwnArray::~OwnArray() { - destroy(); - } - - template - inline OwnArray& OwnArray::operator=(OwnArray const& o) { - OwnArray temp(o); - swap(temp); - return *this; - } - -#if defined(__GXX_EXPERIMENTAL_CXX0X__) - template - inline OwnArray& OwnArray::operator=(OwnArray&& o) { - std::swap_ranges(data_,data_+M, o.data_); - return *this; - } -#endif - - - template - inline typename OwnArray::iterator OwnArray::begin() { - return iterator(data_); - } - - template - inline typename OwnArray::iterator OwnArray::end() { - return iterator(data_+size()); - } - - template - inline typename OwnArray::const_iterator OwnArray::begin() const { - return const_iterator(data_); - } - - template - inline typename OwnArray::const_iterator OwnArray::end() const { - return const_iterator(data_+size()); - } - - template - inline typename OwnArray::size_type OwnArray::size() const { - return size_; - } - - template - inline bool OwnArray::empty() const { - return 0==size_; - } - - template - inline typename OwnArray::reference OwnArray::operator[](size_type n) { - return *data_[n]; - } - - template - inline typename OwnArray::const_reference OwnArray::operator[](size_type n) const { - return *data_[n]; - } - - template - template - inline void OwnArray::push_back(D*& d) { - // C++ does not yet support rvalue references, so d should only be - // able to bind to an lvalue. - // This should be called only for lvalues. - data_[size_++]=d; - d = 0; - } - - template - template - inline void OwnArray::push_back(D* const& d) { - - // C++ allows d to be bound to an lvalue or rvalue. But the other - // signature should be a better match for an lvalue (because it - // does not require an lvalue->rvalue conversion). Thus this - // signature should only be chosen for rvalues. - data_[size_++]=d; - } - - - template - template - inline void OwnArray::push_back(std::unique_ptr d) { - data_[size_++]=d.release(); - } - - - template - inline void OwnArray::push_back(T const& d) { - data_[size_++]=policy_type::clone(d); - } - - - template - inline void OwnArray::pop_back() { - // We have to delete the pointed-to thing, before we squeeze it - // out of the vector... - delete data_[--size_]; - } - - template - inline bool OwnArray::is_back_safe() const { - return data_[size_-1] != 0; - } - - template - inline typename OwnArray::reference OwnArray::back() { - pointer result = data_[size_-1]; - if (result == 0) { - Exception::throwThis(errors::NullPointerError, - "In OwnArray::back() we have intercepted an attempt to dereference a null pointer\n" - "Since OwnArray is allowed to contain null pointers, you much assure that the\n" - "pointer at the end of the collection is not null before calling back()\n" - "if you wish to avoid this exception.\n" - "Consider using OwnArray::is_back_safe()\n"); - } - return *result; - } - - template - inline typename OwnArray::const_reference OwnArray::back() const { - pointer const * result = data_[size_-1]; - if (result == 0) { - Exception::throwThis(errors::NullPointerError, - "In OwnArray::back() we have intercepted an attempt to dereference a null pointer\n" - "Since OwnArray is allowed to contain null pointers, you much assure that the\n" - "pointer at the end of the collection is not null before calling back()\n" - "if you wish to avoid this exception.\n" - "Consider using OwnArray::is_back_safe()\n"); - } - return *result; - } - - template - inline typename OwnArray::reference OwnArray::front() { - return *data_[0]; - } - - template - inline typename OwnArray::const_reference OwnArray::front() const { - return *data_[0]; - } - - template - inline void OwnArray::destroy() { - pointer * b = data_, * e = data_+size(); - for(pointer * i = b; i != e; ++ i) - delete * i; - } - - template - inline typename OwnArray::pointer const * OwnArray::data() const { - return data_; - } - - template - inline void OwnArray::clear() { - destroy(); - size_=0; - } - - template - typename OwnArray::iterator OwnArray::erase(iterator pos) { - pointer * b = pos.i; - delete *b; - pointer * e = data_+size(); - for(pointer * i = b; i != e-1; ++ i) *i = *(i+1); - size_--; - return iterator(b); - } - - template - typename OwnArray::iterator OwnArray::erase(iterator first, iterator last) { - pointer * b = first.i, * e = last.i; - for(pointer * i = b; i != e; ++ i) delete * i; - pointer * l = data_+size(); - auto ib=b; - for(pointer * i = e; i != l; ++i) *(ib++) = *i; - size_ -= (e-b); - return iterator(b); - } - - template template - void OwnArray::sort(S comp) { - std::sort(data_, data_+size(), ordering(comp)); - } - - template - void OwnArray::sort() { - std::sort(data_, data_+size(), ordering(std::less())); - } - - template - inline void OwnArray::swap(OwnArray& other) { - std::swap_ranges(data_,data_+M, other.data_); - } - - template - void OwnArray::fillView(ProductID const& id, - std::vector& pointers, - FillViewHelperVector& helpers) const { - typedef Ref ref_type ; - typedef reftobase::RefHolder holder_type; - - size_type numElements = this->size(); - pointers.reserve(numElements); - helpers.reserve(numElements); - size_type key = 0; - for(typename base::const_iterator i=data_.begin(), e=data_.end(); i!=e; ++i, ++key) { - - if (*i == 0) { - Exception::throwThis(errors::NullPointerError, - "In OwnArray::fillView() we have intercepted an attempt to put a null pointer\n" - "into a View and that is not allowed. It is probably an error that the null\n" - "pointer was in the OwnArray in the first place.\n"); - } - else { - pointers.push_back(*i); - holder_type h(ref_type(id, *i, key,this)); - helpers.push_back(&h); - } - } - } - - template - inline void swap(OwnArray& a, OwnArray& b) { - a.swap(b); - } - - //---------------------------------------------------------------------- - // - // Free function template to support creation of Views. - - template - inline - void - fillView(OwnArray const& obj, - ProductID const& id, - std::vector& pointers, - FillViewHelperVector& helpers) { - obj.fillView(id, pointers, helpers); - } - - - template - struct has_fillView > { - static bool const value = true; - }; - - - // Free function templates to support the use of edm::Ptr. - - template - inline - void - OwnArray::setPtr(std::type_info const& toType, - unsigned long index, - void const*& ptr) const { - detail::reallySetPtr >(*this, toType, index, ptr); - } - - template - inline - void - setPtr(OwnArray const& obj, - std::type_info const& toType, - unsigned long index, - void const*& ptr) { - obj.setPtr(toType, index, ptr); - } - - template - inline - void - OwnArray::fillPtrVector(std::type_info const& toType, - std::vector const& indices, - std::vector& ptrs) const { - detail::reallyfillPtrVector(*this, toType, indices, ptrs); - } - - - template - inline - void - fillPtrVector(OwnArray const& obj, - std::type_info const& toType, - std::vector const& indices, - std::vector& ptrs) { - obj.fillPtrVector(toType, indices, ptrs); - } - - - template - struct has_setPtr > { - static bool const value = true; - }; - - -} - - -#endif diff --git a/DataFormats/Common/interface/TransientDataFrame.h b/DataFormats/Common/interface/TransientDataFrame.h deleted file mode 100644 index bc77c8df6cb16..0000000000000 --- a/DataFormats/Common/interface/TransientDataFrame.h +++ /dev/null @@ -1,51 +0,0 @@ -#ifndef DataFormats_Common_TransientDataFrame_h -#define DataFormats_Common_TransientDataFrame_h - -#include "DataFormats/Common/interface/DataFrame.h" -#include - -namespace edm { - - /* a fixed size array of 16bit words belonging to - * a "channel" identified by an 32bit id - * - * FIXME interface to be finalized once use-cases fully identified - * - */ - template - class TransientDataFrame { - public: - - typedef DataFrame::data_type data_type; - typedef DataFrame::id_type id_type; - - TransientDataFrame() {} - TransientDataFrame( id_type i) : m_id(i) {} - TransientDataFrame(DataFrame const & iframe) : - m_id(iframe.id()) - { - data_type const * p = iframe.begin(); - std::copy(p,p+SIZE,m_data); - } - - int size() const { return SIZE;} - - data_type operator[](size_t i) const { - return m_data[i]; - } - - data_type & operator[](size_t i) { - return m_data[i]; - } - - id_type id() const { return m_id; } - - private: - id_type m_id; - data_type m_data[SIZE]; - - }; - -} - -#endif // DataFormats_Common_TransientDataFrame_h diff --git a/DataFormats/Common/interface/debugging_allocator.h b/DataFormats/Common/interface/debugging_allocator.h deleted file mode 100644 index 528386613f77b..0000000000000 --- a/DataFormats/Common/interface/debugging_allocator.h +++ /dev/null @@ -1,80 +0,0 @@ -#ifndef DataFormatsCommonDebuggingAllocator -#define DataFormatsCommonDebuggingAllocator - -//--------------------------------------------------------------------- -// -// This file declares and defines an allocator class template. -// This allocator is intended for use with the memory checking tool -// valgrind. It is a minimum conformant implementation which makes sure -// not use use any unitialized memory, and so it causes no spurious error -// reports from valgrind. -// -// The intended use is in the declarations of objects from STL templates, -// e.g. -// typedef vector > vint; -// etc. -// -//--------------------------------------------------------------------- - -#include -#include - -namespace edm -{ - template - class debugging_allocator - { - public: - typedef size_t size_type; - typedef ptrdiff_t difference_type; - typedef T* pointer; - typedef T const* const_pointer; - typedef T& reference; - typedef T const& const_reference; - typedef T value_type; - - template struct rebind { typedef debugging_allocator other; }; - - - debugging_allocator() noexcept : dummy('x') { } - - debugging_allocator(debugging_allocator const&) noexcept : dummy('c') { } - - template debugging_allocator(debugging_allocator const&) noexcept : dummy('u') { } - - ~debugging_allocator() noexcept { }; - - pointer address(reference value) const {return &value;} - - const_pointer address(const_reference value) const {return &value; } - - size_type max_size() const noexcept { return std::numeric_limits::max()/sizeof(T); } - - pointer allocate(size_type num, void const* hint = 0) - { - // allocate objects with global new - return (pointer)(::operator new(num*sizeof(T))); - } - - void construct(pointer p, T const& value) { new((void*)p)T(value); } - - void destroy(pointer p) { p->~T(); } - - void deallocate(pointer p, size_type num) { ::operator delete((void*)p); } - - private: - char dummy; - - }; - - // instances of all specializations of this allocator are equal - template - bool operator== (debugging_allocator const&, debugging_allocator const&) noexcept { return true; } - - template - bool operator!= (debugging_allocator const&, debugging_allocator const&) noexcept { return false; } - -} //namespace edm - - -#endif diff --git a/DataFormats/Common/interface/getThinned_implementation.h b/DataFormats/Common/interface/getThinned_implementation.h index 7bb45fe925a7b..13547215fe8cd 100644 --- a/DataFormats/Common/interface/getThinned_implementation.h +++ b/DataFormats/Common/interface/getThinned_implementation.h @@ -7,6 +7,7 @@ #include #include #include +#include #include "DataFormats/Common/interface/ThinnedAssociation.h" #include "DataFormats/Provenance/interface/BranchID.h" diff --git a/DataFormats/Common/test/OwnArray_t.cpp b/DataFormats/Common/test/OwnArray_t.cpp deleted file mode 100644 index 14afce3c5f1d7..0000000000000 --- a/DataFormats/Common/test/OwnArray_t.cpp +++ /dev/null @@ -1,188 +0,0 @@ -#include -#include -#include - -#include "DataFormats/Common/interface/OwnArray.h" -#include "FWCore/Utilities/interface/propagate_const.h" - - -struct Base -{ - virtual ~Base(); - virtual Base* clone() const = 0; -}; - -Base::~Base() {} - -struct Derived : Base -{ - explicit Derived(int n); - Derived(Derived const& other); - Derived& operator=(Derived const& other); - virtual ~Derived(); - void swap(Derived& other); - virtual Derived* clone() const; - - edm::propagate_const pointer; -}; - -Derived::Derived(int n) : pointer(new int(n)) { } - -Derived::Derived(Derived const& other) : pointer(new int(*other.pointer)) { } - -Derived& Derived::operator=(Derived const& other) -{ - Derived temp(other); - swap(temp); - return *this; -} - -void Derived::swap(Derived& other) -{ - std::swap(pointer, other.pointer); -} - -void swap(Derived& a, Derived& b) -{ - a.swap(b); -} - -Derived::~Derived() -{ - delete pointer.get(); -} - -Derived* -Derived::clone() const -{ - return new Derived(*this); -} - - - -void same_guy_twice() -{ - edm::OwnArray vec; - Base* p = new Derived(1); - - vec.push_back(p); - vec.push_back(p); -} - -void two_different_owners() -{ - edm::OwnArray v1,v2; - Base* p = new Derived(1); - v1.push_back(p); - v2.push_back(p); -} - -// void guy_on_stack() -// { -// edm::OwnArray v; -// Derived d(10); -// v.push_back(&d); -// } - -void copy_good_vec() -{ - // v1 is perfectly fine... - edm::OwnArray v1; - Base* p = new Derived(100); - v1.push_back(p); - //v1.push_back(new Derived(100)); - - // But what if we copy him? - edm::OwnArray v2(v1); -} - -void assign_to_other() -{ - edm::OwnArray v1; - Base* p = new Derived(100); - v1.push_back(p); - - edm::OwnArray v2; - v2 = v1; -} - -void assign_to_self() -{ - // Self-assignment happens, often by accident... - edm::OwnArray v1; - v1.push_back(new Derived(100)); - v1 = v1; -} - -void pop_one() -{ - edm::OwnArray v1; - v1.push_back(new Derived(100)); - v1.pop_back(); -} - -void back_with_null_pointer() -{ - edm::OwnArray v; - Base* p = 0; - v.push_back(p); - try - { - v.back(); - assert("Failed to throw a required exception in OwnArray_t"==0); - } - catch (edm::Exception& x) - { - // this is expected. - } - catch (...) - { - throw; - } -} - -void take_an_rvalue() -{ - edm::OwnArray v; - v.push_back(new Derived(101)); - Derived d(102); - v.push_back(d.clone()); -} - -void take_an_lvalue() -{ - edm::OwnArray v1; - Base* p = new Derived(100); - v1.push_back(p); - - assert(p == 0); -} - -void take_an_auto_ptr() -{ - edm::OwnArray v1; - std::unique_ptr p = std::make_unique(100); - v1.push_back(p); - assert(p.get() == 0); -} - -int main() -{ - edm::OwnArray vec; - vec.push_back(new Derived(100)); - edm::OwnArray* p = new edm::OwnArray; - p->push_back(new Derived(2)); - delete p; - // same_guy_twice(); - // two_different_owners(); - // guy_on_stack(); - copy_good_vec(); - assign_to_other(); - assign_to_self(); - pop_one(); - back_with_null_pointer(); - - take_an_rvalue(); - take_an_lvalue(); - take_an_auto_ptr(); -} diff --git a/DataFormats/Common/test/testOwnArray.cc b/DataFormats/Common/test/testOwnArray.cc deleted file mode 100644 index 498a76f77e4ad..0000000000000 --- a/DataFormats/Common/test/testOwnArray.cc +++ /dev/null @@ -1,139 +0,0 @@ -// -#include "cppunit/extensions/HelperMacros.h" -#include -#include -#include -#include "DataFormats/Common/interface/OwnArray.h" -#include "FWCore/Utilities/interface/propagate_const.h" - -class testOwnArray : public CppUnit::TestFixture { - CPPUNIT_TEST_SUITE(testOwnArray); - CPPUNIT_TEST(checkAll); - CPPUNIT_TEST_SUITE_END(); -public: - void setUp() {} - void tearDown() {} - void checkAll(); -}; - -CPPUNIT_TEST_SUITE_REGISTRATION(testOwnArray); - -namespace testOA { - struct Dummy { - Dummy(int n, bool * r) : value(n), ref(r) { } - ~Dummy() { * ref = true; } - int value; - bool operator<(const Dummy & o) const { - return value < o.value; - } - private: - edm::propagate_const ref; - }; - - struct DummyComp { - bool operator()(const Dummy& d1, const Dummy& d2) const { - return d1.value < d2.value; - } - }; - - class a { - public: - virtual ~a() {} - virtual int f() const = 0; - }; - - class ClassB : public a { - public: - ClassB(int i) : ii(i) {memset(&waste, 0, sizeof(waste));} - virtual ~ClassB() {} - virtual int f() const { return ii; } - int ii; - private: - char waste[1024*1024]; - }; - - class ss { - public: - bool operator() (const a & a1, const a & a2) const { - return (a1.f() > a2.f()); - } - }; - - inline std::ostream& operator<<(std::ostream& os, const a & aa) { - os << aa.f(); - return os; - } -} - -void testOwnArray::checkAll() { - edm::OwnArray v; - CPPUNIT_ASSERT(v.size() == 0); - CPPUNIT_ASSERT(v.empty()); - bool deleted[4] = { false, false, false, false }; - v.push_back(new testOA::Dummy(0, deleted + 0)); - v.push_back(new testOA::Dummy(1, deleted + 1)); - v.push_back(new testOA::Dummy(2, deleted + 2)); - v.push_back(new testOA::Dummy(3, deleted + 3)); - CPPUNIT_ASSERT(v.size() == 4); - auto i = v.begin(); - auto ci = i; - * ci; - v.sort(); - v.sort(testOA::DummyComp()); - CPPUNIT_ASSERT(!v.empty()); - CPPUNIT_ASSERT(v[0].value == 0); - CPPUNIT_ASSERT(v[1].value == 1); - CPPUNIT_ASSERT(v[2].value == 2); - CPPUNIT_ASSERT(v[3].value == 3); - i = v.begin() + 1; - v.erase( i ); - CPPUNIT_ASSERT(!deleted[0]); - CPPUNIT_ASSERT(deleted[1]); - CPPUNIT_ASSERT(!deleted[2]); - CPPUNIT_ASSERT(!deleted[3]); - CPPUNIT_ASSERT(v.size() == 3); - CPPUNIT_ASSERT(v[0].value == 0); - CPPUNIT_ASSERT(v[1].value == 2); - CPPUNIT_ASSERT(v[2].value == 3); - auto b = v.begin(), e = b + 1; - v.erase(b, e); - CPPUNIT_ASSERT(v.size() == 2); - CPPUNIT_ASSERT(deleted[0]); - CPPUNIT_ASSERT(deleted[1]); - CPPUNIT_ASSERT(!deleted[2]); - CPPUNIT_ASSERT(!deleted[3]); - v.clear(); - CPPUNIT_ASSERT(v.size() == 0); - CPPUNIT_ASSERT(v.empty()); - CPPUNIT_ASSERT(deleted[0]); - CPPUNIT_ASSERT(deleted[1]); - CPPUNIT_ASSERT(deleted[2]); - CPPUNIT_ASSERT(deleted[3]); - { - edm::OwnArray v; - testOA::a * aa = new testOA::ClassB(2); - v.push_back(aa); - aa = new testOA::ClassB(1); - v.push_back(aa); - aa = new testOA::ClassB(3); - v.push_back(aa); - v.sort(testOA::ss()); - std::cout << "OwnArray : dumping contents" << std::endl; - std::copy(v.begin(), - v.end(), - std::ostream_iterator(std::cout, "\t")); - - edm::Ptr ptr_v; - unsigned long index(0); - void const * data = &v[0]; - v.setPtr( typeid(testOA::a), index, data ); - testOA::a const * data_a = static_cast(data); - testOA::ClassB const * data_b = dynamic_cast(data_a); - CPPUNIT_ASSERT( data != 0); - CPPUNIT_ASSERT( data_a != 0); - CPPUNIT_ASSERT( data_b != 0); - if(data_b != 0) { // To silence Coverity - CPPUNIT_ASSERT( data_b->f() == 3); - } - } -} diff --git a/DataFormats/EcalDigi/interface/EcalMatacqDigi.h b/DataFormats/EcalDigi/interface/EcalMatacqDigi.h index b7cbc3949cf01..f33815d7b73d5 100644 --- a/DataFormats/EcalDigi/interface/EcalMatacqDigi.h +++ b/DataFormats/EcalDigi/interface/EcalMatacqDigi.h @@ -270,6 +270,7 @@ class EcalMatacqDigi { * @param value new value */ void laserPower(int value) { laserPower_ = value; } +#endif void init() { #if (ECAL_MATACQ_DIGI_VERS >= 2) @@ -285,11 +286,11 @@ class EcalMatacqDigi { emtcPhase_ = -1; attenuation_dB_ = -1; laserPower_ = -1; + tv_sec_ = 0; + tv_usec_ = 0; #endif } -#endif - private: /** Electronic channel id */ @@ -299,10 +300,6 @@ class EcalMatacqDigi { */ std::vector data_; - /** Frequency mode. 1->1GHz sampling, 2->2GHz sampling - */ - int freq; - /**Sampling period in seconds. In priniciple 1ns or 0.5ns */ double ts_; diff --git a/DataFormats/EcalDigi/src/classes_def.xml b/DataFormats/EcalDigi/src/classes_def.xml index 9c40edacab4db..5f365f96523b4 100644 --- a/DataFormats/EcalDigi/src/classes_def.xml +++ b/DataFormats/EcalDigi/src/classes_def.xml @@ -48,7 +48,8 @@ - + + diff --git a/DataFormats/EgammaCandidates/interface/GsfElectron.h b/DataFormats/EgammaCandidates/interface/GsfElectron.h index b81bdf23d1974..22b6c65bd79ef 100644 --- a/DataFormats/EgammaCandidates/interface/GsfElectron.h +++ b/DataFormats/EgammaCandidates/interface/GsfElectron.h @@ -28,8 +28,8 @@ namespace reco { * Renamed from PixelMatchGsfElectron. * Originally adapted from the TRecElectron class in ORCA. * - * \author Claude Charlot - Laboratoire Leprince-Ringuet - École polytechnique, CNRS/IN2P3 - * \author David Chamont - Laboratoire Leprince-Ringuet - École polytechnique, CNRS/IN2P3 + * \author Claude Charlot - Laboratoire Leprince-Ringuet - École polytechnique, CNRS/IN2P3 + * \author David Chamont - Laboratoire Leprince-Ringuet - École polytechnique, CNRS/IN2P3 * ****************************************************************************/ @@ -701,12 +701,28 @@ namespace reco { etOutsideMustache(-std::numeric_limits::max()) {} }; + static constexpr float mvaPlaceholder = -999999999.; + struct MvaOutput { int status; // see PFCandidateElectronExtra::StatusFlag float mva_Isolated; float mva_e_pi; float mvaByPassForIsolated; // complementary MVA used in preselection - MvaOutput() : status(-1), mva_Isolated(-999999999.), mva_e_pi(-999999999.), mvaByPassForIsolated(-999999999.) {} + float dnn_e_sigIsolated; + float dnn_e_sigNonIsolated; + float dnn_e_bkgNonIsolated; + float dnn_e_bkgTau; + float dnn_e_bkgPhoton; + MvaOutput() + : status(-1), + mva_Isolated(mvaPlaceholder), + mva_e_pi(mvaPlaceholder), + mvaByPassForIsolated(mvaPlaceholder), + dnn_e_sigIsolated(mvaPlaceholder), + dnn_e_sigNonIsolated(mvaPlaceholder), + dnn_e_bkgNonIsolated(mvaPlaceholder), + dnn_e_bkgTau(mvaPlaceholder), + dnn_e_bkgPhoton(mvaPlaceholder) {} }; // accessors @@ -726,6 +742,11 @@ namespace reco { // for backward compatibility float mva_Isolated() const { return mvaOutput_.mva_Isolated; } float mva_e_pi() const { return mvaOutput_.mva_e_pi; } + float dnn_signal_Isolated() const { return mvaOutput_.dnn_e_sigIsolated; } + float dnn_signal_nonIsolated() const { return mvaOutput_.dnn_e_sigNonIsolated; } + float dnn_bkg_nonIsolated() const { return mvaOutput_.dnn_e_bkgNonIsolated; } + float dnn_bkg_Tau() const { return mvaOutput_.dnn_e_bkgTau; } + float dnn_bkg_Photon() const { return mvaOutput_.dnn_e_bkgPhoton; } private: PflowIsolationVariables pfIso_; diff --git a/DataFormats/EgammaCandidates/interface/Photon.h b/DataFormats/EgammaCandidates/interface/Photon.h index 071f0329a03fb..f1daf95615eb4 100644 --- a/DataFormats/EgammaCandidates/interface/Photon.h +++ b/DataFormats/EgammaCandidates/interface/Photon.h @@ -556,25 +556,23 @@ namespace reco { /// Set Particle Flow Isolation variables void setPflowIsolationVariables(const PflowIsolationVariables& pfisol) { pfIsolation_ = pfisol; } + static constexpr float mvaPlaceholder = -999999999.; + struct PflowIDVariables { int nClusterOutsideMustache; float etOutsideMustache; float mva; + float dnn; PflowIDVariables() - : - - nClusterOutsideMustache(-1), - etOutsideMustache(-999999999.), - mva(-999999999.) - - {} + : nClusterOutsideMustache(-1), etOutsideMustache(mvaPlaceholder), mva(mvaPlaceholder), dnn(mvaPlaceholder) {} }; // getters int nClusterOutsideMustache() const { return pfID_.nClusterOutsideMustache; } float etOutsideMustache() const { return pfID_.etOutsideMustache; } float pfMVA() const { return pfID_.mva; } + float pfDNN() const { return pfID_.dnn; } // setters void setPflowIDVariables(const PflowIDVariables& pfid) { pfID_ = pfid; } diff --git a/DataFormats/EgammaCandidates/src/classes_def.xml b/DataFormats/EgammaCandidates/src/classes_def.xml index 7b93b9863aa35..9432329160786 100644 --- a/DataFormats/EgammaCandidates/src/classes_def.xml +++ b/DataFormats/EgammaCandidates/src/classes_def.xml @@ -69,7 +69,8 @@ - + + @@ -221,7 +222,8 @@ - + + diff --git a/DataFormats/FEDRawData/src/FEDHeader.cc b/DataFormats/FEDRawData/src/FEDHeader.cc index d92b1a2db6713..9faded6cce9a4 100644 --- a/DataFormats/FEDRawData/src/FEDHeader.cc +++ b/DataFormats/FEDRawData/src/FEDHeader.cc @@ -34,8 +34,8 @@ void FEDHeader::set(unsigned char* header, h->eventid = (FED_SLINK_START_MARKER << FED_HCTRLID_SHIFT) | ((triggerType << FED_EVTY_SHIFT) & FED_EVTY_MASK) | ((lvl1ID << FED_LVL1_SHIFT) & FED_LVL1_MASK); - h->sourceid = ((bxID << FED_BXID_SHIFT) & FED_BXID_MASK) | ((sourceID << FED_SOID_SHIFT) & FED_SOID_MASK) | - ((version << FED_VERSION_SHIFT) & FED_VERSION_MASK); + h->sourceid = (((bxID & FED_BXID_WIDTH) << FED_BXID_SHIFT) & FED_BXID_MASK) | + ((sourceID << FED_SOID_SHIFT) & FED_SOID_MASK) | ((version << FED_VERSION_SHIFT) & FED_VERSION_MASK); if (moreHeaders) h->sourceid |= (FED_MORE_HEADERS_WIDTH << FED_MORE_HEADERS_SHIFT); diff --git a/DataFormats/GeometrySurface/interface/private/extTkRotation.h b/DataFormats/GeometrySurface/interface/private/extTkRotation.h index f1c2aa2a67aeb..e171d5785074a 100644 --- a/DataFormats/GeometrySurface/interface/private/extTkRotation.h +++ b/DataFormats/GeometrySurface/interface/private/extTkRotation.h @@ -7,23 +7,23 @@ #include "DataFormats/Math/interface/ExtVec.h" - #include -template class TkRotation; -template class TkRotation2D; +template +class TkRotation; +template +class TkRotation2D; template -std::ostream & operator<<( std::ostream& s, const TkRotation& r); +std::ostream& operator<<(std::ostream& s, const TkRotation& r); template -std::ostream & operator<<( std::ostream& s, const TkRotation2D& r); +std::ostream& operator<<(std::ostream& s, const TkRotation2D& r); namespace geometryDetails { void TkRotationErr1(); void TkRotationErr2(); -} - +} // namespace geometryDetails /** Rotaion matrix used by Surface. */ @@ -31,65 +31,52 @@ namespace geometryDetails { template class TkRotation { public: - - typedef Vector3DBase< T, GlobalTag> GlobalVector; + typedef Vector3DBase GlobalVector; typedef Basic3DVector BasicVector; - TkRotation( ){} - TkRotation( Rot3 const & irot ) : rot(irot){} - - TkRotation( T xx, T xy, T xz, T yx, T yy, T yz, T zx, T zy, T zz) : - rot(xx,xy,xz, yx,yy,yz, zx, zy,zz){} - - TkRotation( const T* p) : - rot(p[0],p[1],p[2], - p[3],p[4],p[5], - p[6],p[7],p[8]) {} - - TkRotation( const GlobalVector & aX, const GlobalVector & aY) { - + TkRotation() {} + TkRotation(Rot3 const& irot) : rot(irot) {} + + TkRotation(T xx, T xy, T xz, T yx, T yy, T yz, T zx, T zy, T zz) : rot(xx, xy, xz, yx, yy, yz, zx, zy, zz) {} + + TkRotation(const T* p) : rot(p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8]) {} + + TkRotation(const GlobalVector& aX, const GlobalVector& aY) { GlobalVector uX = aX.unit(); GlobalVector uY = aY.unit(); GlobalVector uZ(uX.cross(uY)); - - rot.axis[0]= uX.basicVector().v; - rot.axis[1]= uY.basicVector().v; - rot.axis[2]= uZ.basicVector().v; - + + rot.axis[0] = uX.basicVector().v; + rot.axis[1] = uY.basicVector().v; + rot.axis[2] = uZ.basicVector().v; } - TkRotation( const BasicVector & aX, const BasicVector & aY) { - + TkRotation(const BasicVector& aX, const BasicVector& aY) { BasicVector uX = aX.unit(); BasicVector uY = aY.unit(); BasicVector uZ(uX.cross(uY)); - - rot.axis[0]= uX.v; - rot.axis[1]= uY.v; - rot.axis[2]= uZ.v; - + + rot.axis[0] = uX.v; + rot.axis[1] = uY.v; + rot.axis[2] = uZ.v; } - /** Construct from global vectors of the x, y and z axes. * The axes are assumed to be unit vectors forming * a right-handed orthonormal basis. No checks are performed! */ - TkRotation( const GlobalVector & uX, const GlobalVector & uY, - const GlobalVector & uZ) { - rot.axis[0]= uX.basicVector().v; - rot.axis[1]= uY.basicVector().v; - rot.axis[2]= uZ.basicVector().v; + TkRotation(const GlobalVector& uX, const GlobalVector& uY, const GlobalVector& uZ) { + rot.axis[0] = uX.basicVector().v; + rot.axis[1] = uY.basicVector().v; + rot.axis[2] = uZ.basicVector().v; } - TkRotation( const BasicVector & uX, const BasicVector & uY, - const BasicVector & uZ) { - rot.axis[0]= uX.v; - rot.axis[1]= uY.v; - rot.axis[2]= uZ.v; + TkRotation(const BasicVector& uX, const BasicVector& uY, const BasicVector& uZ) { + rot.axis[0] = uX.v; + rot.axis[1] = uY.v; + rot.axis[2] = uZ.v; } - - + /** rotation around abritrary axis by the amount of phi: * its constructed by O^-1(z<->axis) rot_z(phi) O(z<->axis) * the frame is rotated such that the z-asis corresponds to the rotation @@ -98,26 +85,17 @@ class TkRotation { * unfortuately I'm too stupid to describe such thing directly by 3 Euler * angles.. hence I have to construckt it this way...by brute force */ - TkRotation( const Basic3DVector& axis, T phi) : - rot( cos(phi), sin(phi), 0, - -sin(phi), cos(phi), 0, - 0, 0, 1) { - + TkRotation(const Basic3DVector& axis, T phi) : rot(cos(phi), sin(phi), 0, -sin(phi), cos(phi), 0, 0, 0, 1) { //rotation around the z-axis by phi - TkRotation tmpRotz ( cos(axis.phi()), sin(axis.phi()), 0., - -sin(axis.phi()), cos(axis.phi()), 0., - 0., 0., 1. ); + TkRotation tmpRotz(cos(axis.phi()), sin(axis.phi()), 0., -sin(axis.phi()), cos(axis.phi()), 0., 0., 0., 1.); //rotation around y-axis by theta - TkRotation tmpRoty ( cos(axis.theta()), 0.,-sin(axis.theta()), - 0., 1., 0., - sin(axis.theta()), 0., cos(axis.theta()) ); - (*this)*=tmpRoty; - (*this)*=tmpRotz; // = this * tmpRoty * tmpRotz - + TkRotation tmpRoty(cos(axis.theta()), 0., -sin(axis.theta()), 0., 1., 0., sin(axis.theta()), 0., cos(axis.theta())); + (*this) *= tmpRoty; + (*this) *= tmpRotz; // = this * tmpRoty * tmpRotz + // (tmpRoty * tmpRotz)^-1 * this * tmpRoty * tmpRotz - - *this = (tmpRoty*tmpRotz).multiplyInverse(*this); - + + *this = (tmpRoty * tmpRotz).multiplyInverse(*this); } /* this is the same thing...derived from the CLHEP ... it gives the same results MODULO the sign of the rotation.... but I don't want @@ -151,216 +129,150 @@ class TkRotation { } */ - + template - TkRotation( const TkRotation& a) : - rot (a.xx(), a.xy(), a.xz(), - a.yx(), a.yy(), a.yz(), - a.zx(), a.zy(), a.zz()) {} - - TkRotation transposed() const { - return rot.transpose(); - } - - Basic3DVector rotate( const Basic3DVector& v) const { - return rot.rotate(v.v); - } + TkRotation(const TkRotation& a) : rot(a.xx(), a.xy(), a.xz(), a.yx(), a.yy(), a.yz(), a.zx(), a.zy(), a.zz()) {} - Basic3DVector rotateBack( const Basic3DVector& v) const { - return rot.rotateBack(v.v); - } + TkRotation transposed() const { return rot.transpose(); } + Basic3DVector rotate(const Basic3DVector& v) const { return rot.rotate(v.v); } - Basic3DVector operator*( const Basic3DVector& v) const { - return rot.rotate(v.v); - } + Basic3DVector rotateBack(const Basic3DVector& v) const { return rot.rotateBack(v.v); } + + Basic3DVector operator*(const Basic3DVector& v) const { return rot.rotate(v.v); } + + Basic3DVector multiplyInverse(const Basic3DVector& v) const { return rot.rotateBack(v.v); } - Basic3DVector multiplyInverse( const Basic3DVector& v) const { - return rot.rotateBack(v.v); - } - template - Basic3DVector multiplyInverse( const Basic3DVector& v) const { - return Basic3DVector( xx()*v.x() + yx()*v.y() + zx()*v.z(), - xy()*v.x() + yy()*v.y() + zy()*v.z(), - xz()*v.x() + yz()*v.y() + zz()*v.z()); - } - - Basic3DVector operator*( const Basic2DVector& v) const { - return Basic3DVector( xx()*v.x() + xy()*v.y(), - yx()*v.x() + yy()*v.y(), - zx()*v.x() + zy()*v.y()); - } - Basic3DVector multiplyInverse( const Basic2DVector& v) const { - return Basic3DVector( xx()*v.x() + yx()*v.y(), - xy()*v.x() + yy()*v.y(), - xz()*v.x() + yz()*v.y()); - } - - - - TkRotation operator*( const TkRotation& b) const { - return rot*b.rot; + Basic3DVector multiplyInverse(const Basic3DVector& v) const { + return Basic3DVector(xx() * v.x() + yx() * v.y() + zx() * v.z(), + xy() * v.x() + yy() * v.y() + zy() * v.z(), + xz() * v.x() + yz() * v.y() + zz() * v.z()); } - TkRotation multiplyInverse( const TkRotation& b) const { - return rot.transpose()*b.rot; + + Basic3DVector operator*(const Basic2DVector& v) const { + return Basic3DVector(xx() * v.x() + xy() * v.y(), yx() * v.x() + yy() * v.y(), zx() * v.x() + zy() * v.y()); } - - TkRotation& operator*=( const TkRotation& b) { - return *this = operator * (b); + Basic3DVector multiplyInverse(const Basic2DVector& v) const { + return Basic3DVector(xx() * v.x() + yx() * v.y(), xy() * v.x() + yy() * v.y(), xz() * v.x() + yz() * v.y()); } - + + TkRotation operator*(const TkRotation& b) const { return rot * b.rot; } + TkRotation multiplyInverse(const TkRotation& b) const { return rot.transpose() * b.rot; } + + TkRotation& operator*=(const TkRotation& b) { return *this = operator*(b); } + // Note a *= b; <=> a = a * b; while a.transform(b); <=> a = b * a; - TkRotation& transform(const TkRotation& b) { - return *this = b.operator * (*this); - } - - TkRotation & rotateAxes(const Basic3DVector& newX, - const Basic3DVector& newY, - const Basic3DVector& newZ) { + TkRotation& transform(const TkRotation& b) { return *this = b.operator*(*this); } + + TkRotation& rotateAxes(const Basic3DVector& newX, const Basic3DVector& newY, const Basic3DVector& newZ) { T del = 0.001; - + if ( - - // the check for right-handedness is not needed since - // we want to change the handedness when it's left in cmsim - // - // fabs(newZ.x()-w.x()) > del || - // fabs(newZ.y()-w.y()) > del || - // fabs(newZ.z()-w.z()) > del || - fabs(newX.mag2()-1.) > del || - fabs(newY.mag2()-1.) > del || - fabs(newZ.mag2()-1.) > del || - fabs(newX.dot(newY)) > del || - fabs(newY.dot(newZ)) > del || - fabs(newZ.dot(newX)) > del) { + + // the check for right-handedness is not needed since + // we want to change the handedness when it's left in cmsim + // + // fabs(newZ.x()-w.x()) > del || + // fabs(newZ.y()-w.y()) > del || + // fabs(newZ.z()-w.z()) > del || + fabs(newX.mag2() - 1.) > del || fabs(newY.mag2() - 1.) > del || fabs(newZ.mag2() - 1.) > del || + fabs(newX.dot(newY)) > del || fabs(newY.dot(newZ)) > del || fabs(newZ.dot(newX)) > del) { geometryDetails::TkRotationErr2(); return *this; } else { - return transform(TkRotation(newX.x(), newY.x(), newZ.x(), - newX.y(), newY.y(), newZ.y(), - newX.z(), newY.z(), newZ.z())); + return transform( + TkRotation(newX.x(), newY.x(), newZ.x(), newX.y(), newY.y(), newZ.y(), newX.z(), newY.z(), newZ.z())); } } - - - Basic3DVector x() const { return rot.axis[0];} - Basic3DVector y() const { return rot.axis[1];} - Basic3DVector z() const { return rot.axis[2];} - - T xx() const { return rot.axis[0][0];} - T xy() const { return rot.axis[0][1];} - T xz() const { return rot.axis[0][2];} - T yx() const { return rot.axis[1][0];} - T yy() const { return rot.axis[1][1];} - T yz() const { return rot.axis[1][2];} - T zx() const { return rot.axis[2][0];} - T zy() const { return rot.axis[2][1];} - T zz() const { return rot.axis[2][2];} - + + Basic3DVector x() const { return rot.axis[0]; } + Basic3DVector y() const { return rot.axis[1]; } + Basic3DVector z() const { return rot.axis[2]; } + + T xx() const { return rot.axis[0][0]; } + T xy() const { return rot.axis[0][1]; } + T xz() const { return rot.axis[0][2]; } + T yx() const { return rot.axis[1][0]; } + T yy() const { return rot.axis[1][1]; } + T yz() const { return rot.axis[1][2]; } + T zx() const { return rot.axis[2][0]; } + T zy() const { return rot.axis[2][1]; } + T zz() const { return rot.axis[2][2]; } + private: - Rot3 rot; - }; +template <> +std::ostream& operator<<(std::ostream& s, const TkRotation& r); -template<> -std::ostream & operator<< ( std::ostream& s, const TkRotation& r); - -template<> -std::ostream & operator<< ( std::ostream& s, const TkRotation& r); - +template <> +std::ostream& operator<<(std::ostream& s, const TkRotation& r); template -inline Basic3DVector operator*( const TkRotation& r, const Basic3DVector& v) { - return Basic3DVector( r.xx()*v.x() + r.xy()*v.y() + r.xz()*v.z(), - r.yx()*v.x() + r.yy()*v.y() + r.yz()*v.z(), - r.zx()*v.x() + r.zy()*v.y() + r.zz()*v.z()); +inline Basic3DVector operator*(const TkRotation& r, const Basic3DVector& v) { + return Basic3DVector(r.xx() * v.x() + r.xy() * v.y() + r.xz() * v.z(), + r.yx() * v.x() + r.yy() * v.y() + r.yz() * v.z(), + r.zx() * v.x() + r.zy() * v.y() + r.zz() * v.z()); } template -inline TkRotation::Type> -operator*( const TkRotation& a, const TkRotation& b) { - typedef TkRotation::Type> RT; - return RT( a.xx()*b.xx() + a.xy()*b.yx() + a.xz()*b.zx(), - a.xx()*b.xy() + a.xy()*b.yy() + a.xz()*b.zy(), - a.xx()*b.xz() + a.xy()*b.yz() + a.xz()*b.zz(), - a.yx()*b.xx() + a.yy()*b.yx() + a.yz()*b.zx(), - a.yx()*b.xy() + a.yy()*b.yy() + a.yz()*b.zy(), - a.yx()*b.xz() + a.yy()*b.yz() + a.yz()*b.zz(), - a.zx()*b.xx() + a.zy()*b.yx() + a.zz()*b.zx(), - a.zx()*b.xy() + a.zy()*b.yy() + a.zz()*b.zy(), - a.zx()*b.xz() + a.zy()*b.yz() + a.zz()*b.zz()); +inline TkRotation::Type> operator*(const TkRotation& a, const TkRotation& b) { + typedef TkRotation::Type> RT; + return RT(a.xx() * b.xx() + a.xy() * b.yx() + a.xz() * b.zx(), + a.xx() * b.xy() + a.xy() * b.yy() + a.xz() * b.zy(), + a.xx() * b.xz() + a.xy() * b.yz() + a.xz() * b.zz(), + a.yx() * b.xx() + a.yy() * b.yx() + a.yz() * b.zx(), + a.yx() * b.xy() + a.yy() * b.yy() + a.yz() * b.zy(), + a.yx() * b.xz() + a.yy() * b.yz() + a.yz() * b.zz(), + a.zx() * b.xx() + a.zy() * b.yx() + a.zz() * b.zx(), + a.zx() * b.xy() + a.zy() * b.yy() + a.zz() * b.zy(), + a.zx() * b.xz() + a.zy() * b.yz() + a.zz() * b.zz()); } - template class TkRotation2D { public: - typedef Basic2DVector BasicVector; - TkRotation2D( ){} - TkRotation2D( Rot2 const & irot ) : rot(irot){} - - TkRotation2D( T xx, T xy, T yx, T yy) : - rot(xx,xy, yx,yy){} - - TkRotation2D( const T* p) : - rot(p[0],p[1], - p[2],p[3]) {} - - TkRotation2D( const BasicVector & aX) { - - BasicVector uX = aX.unit(); - BasicVector uY(-uX.y(),uX.x()); - - rot.axis[0]= uX.v; - rot.axis[1]= uY.v; - - } + TkRotation2D() {} + TkRotation2D(Rot2 const& irot) : rot(irot) {} - - TkRotation2D( const BasicVector & uX, const BasicVector & uY) { - rot.axis[0]= uX.v; - rot.axis[1]= uY.v; - } - - BasicVector x() const { return rot.axis[0];} - BasicVector y() const { return rot.axis[1];} + TkRotation2D(T xx, T xy, T yx, T yy) : rot(xx, xy, yx, yy) {} + TkRotation2D(const T* p) : rot(p[0], p[1], p[2], p[3]) {} - TkRotation2D transposed() const { - return rot.transpose(); - } - - BasicVector rotate( const BasicVector& v) const { - return rot.rotate(v.v); + TkRotation2D(const BasicVector& aX) { + BasicVector uX = aX.unit(); + BasicVector uY(-uX.y(), uX.x()); + + rot.axis[0] = uX.v; + rot.axis[1] = uY.v; } - BasicVector rotateBack( const BasicVector& v) const { - return rot.rotateBack(v.v); + TkRotation2D(const BasicVector& uX, const BasicVector& uY) { + rot.axis[0] = uX.v; + rot.axis[1] = uY.v; } + BasicVector x() const { return rot.axis[0]; } + BasicVector y() const { return rot.axis[1]; } + TkRotation2D transposed() const { return rot.transpose(); } - private: - - Rot2 rot; - -}; + BasicVector rotate(const BasicVector& v) const { return rot.rotate(v.v); } + BasicVector rotateBack(const BasicVector& v) const { return rot.rotateBack(v.v); } -template<> -std::ostream & operator<< ( std::ostream& s, const TkRotation2D& r); +private: + Rot2 rot; +}; -template<> -std::ostream & operator<< ( std::ostream& s, const TkRotation2D& r); +template <> +std::ostream& operator<<(std::ostream& s, const TkRotation2D& r); +template <> +std::ostream& operator<<(std::ostream& s, const TkRotation2D& r); #endif - - - - diff --git a/DataFormats/GeometrySurface/interface/private/newTkRotation.h b/DataFormats/GeometrySurface/interface/private/newTkRotation.h deleted file mode 100644 index f12a7b1ebe118..0000000000000 --- a/DataFormats/GeometrySurface/interface/private/newTkRotation.h +++ /dev/null @@ -1,366 +0,0 @@ -#ifndef Geom_newTkRotation_H -#define Geom_newTkRotation_H - -#include "DataFormats/GeometryVector/interface/Basic2DVector.h" -#include "DataFormats/GeometryVector/interface/Basic3DVector.h" -#include "DataFormats/GeometryVector/interface/GlobalVector.h" - -#include "DataFormats/Math/interface/SSERot.h" - - -#include - -template class TkRotation; -template class TkRotation2D; - -template -std::ostream & operator<<( std::ostream& s, const TkRotation& r); -template -std::ostream & operator<<( std::ostream& s, const TkRotation2D& r); - -namespace geometryDetails { - void TkRotationErr1(); - void TkRotationErr2(); - -} - - -/** Rotaion matrix used by Surface. - */ - -template -class TkRotation { -public: - - typedef Vector3DBase< T, GlobalTag> GlobalVector; - typedef Basic3DVector BasicVector; - - TkRotation( ){} - TkRotation( mathSSE::Rot3 const & irot ) : rot(irot){} - - TkRotation( T xx, T xy, T xz, T yx, T yy, T yz, T zx, T zy, T zz) : - rot(xx,xy,xz, yx,yy,yz, zx, zy,zz){} - - TkRotation( const T* p) : - rot(p[0],p[1],p[2], - p[3],p[4],p[5], - p[6],p[7],p[8]) {} - - TkRotation( const GlobalVector & aX, const GlobalVector & aY) { - - GlobalVector uX = aX.unit(); - GlobalVector uY = aY.unit(); - GlobalVector uZ(uX.cross(uY)); - - rot.axis[0]= uX.basicVector().v; - rot.axis[1]= uY.basicVector().v; - rot.axis[2]= uZ.basicVector().v; - - } - - TkRotation( const BasicVector & aX, const BasicVector & aY) { - - BasicVector uX = aX.unit(); - BasicVector uY = aY.unit(); - BasicVector uZ(uX.cross(uY)); - - rot.axis[0]= uX.v; - rot.axis[1]= uY.v; - rot.axis[2]= uZ.v; - - } - - - /** Construct from global vectors of the x, y and z axes. - * The axes are assumed to be unit vectors forming - * a right-handed orthonormal basis. No checks are performed! - */ - TkRotation( const GlobalVector & uX, const GlobalVector & uY, - const GlobalVector & uZ) { - rot.axis[0]= uX.basicVector().v; - rot.axis[1]= uY.basicVector().v; - rot.axis[2]= uZ.basicVector().v; - } - - TkRotation( const BasicVector & uX, const BasicVector & uY, - const BasicVector & uZ) { - rot.axis[0]= uX.v; - rot.axis[1]= uY.v; - rot.axis[2]= uZ.v; - } - - - /** rotation around abritrary axis by the amount of phi: - * its constructed by O^-1(z<->axis) rot_z(phi) O(z<->axis) - * the frame is rotated such that the z-asis corresponds to the rotation - * axis desired. THen it's rotated round the "new" z-axis, and then - * the initial transformation is "taken back" again. - * unfortuately I'm too stupid to describe such thing directly by 3 Euler - * angles.. hence I have to construckt it this way...by brute force - */ - TkRotation( const Basic3DVector& axis, T phi) : - rot( cos(phi), sin(phi), 0, - -sin(phi), cos(phi), 0, - 0, 0, 1) { - - //rotation around the z-axis by phi - TkRotation tmpRotz ( cos(axis.phi()), sin(axis.phi()), 0., - -sin(axis.phi()), cos(axis.phi()), 0., - 0., 0., 1. ); - //rotation around y-axis by theta - TkRotation tmpRoty ( cos(axis.theta()), 0.,-sin(axis.theta()), - 0., 1., 0., - sin(axis.theta()), 0., cos(axis.theta()) ); - (*this)*=tmpRoty; - (*this)*=tmpRotz; // = this * tmpRoty * tmpRotz - - // (tmpRoty * tmpRotz)^-1 * this * tmpRoty * tmpRotz - - *this = (tmpRoty*tmpRotz).multiplyInverse(*this); - - } - /* this is the same thing...derived from the CLHEP ... it gives the - same results MODULO the sign of the rotation.... but I don't want - that... had - TkRotation (const Basic3DVector& axis, float phi) { - T cx = axis.x(); - T cy = axis.y(); - T cz = axis.z(); - - T ll = axis.mag(); - if (ll == 0) { - geometryDetails::TkRotationErr1(); - }else{ - - float cosa = cos(phi), sina = sin(phi); - cx /= ll; cy /= ll; cz /= ll; - - R11 = cosa + (1-cosa)*cx*cx; - R12 = (1-cosa)*cx*cy - sina*cz; - R13 = (1-cosa)*cx*cz + sina*cy; - - R21 = (1-cosa)*cy*cx + sina*cz; - R22 = cosa + (1-cosa)*cy*cy; - R23 = (1-cosa)*cy*cz - sina*cx; - - R31 = (1-cosa)*cz*cx - sina*cy; - R32 = (1-cosa)*cz*cy + sina*cx; - R33 = cosa + (1-cosa)*cz*cz; - - } - - } - */ - - template - TkRotation( const TkRotation& a) : - rot (a.xx(), a.xy(), a.xz(), - a.yx(), a.yy(), a.yz(), - a.zx(), a.zy(), a.zz()) {} - - TkRotation transposed() const { - return rot.transpose(); - } - - Basic3DVector rotate( const Basic3DVector& v) const { - return rot.rotate(v.v); - } - - Basic3DVector rotateBack( const Basic3DVector& v) const { - return rot.rotateBack(v.v); - } - - - Basic3DVector operator*( const Basic3DVector& v) const { - return rot.rotate(v.v); - } - - Basic3DVector multiplyInverse( const Basic3DVector& v) const { - return rot.rotateBack(v.v); - } - - template - Basic3DVector multiplyInverse( const Basic3DVector& v) const { - return Basic3DVector( xx()*v.x() + yx()*v.y() + zx()*v.z(), - xy()*v.x() + yy()*v.y() + zy()*v.z(), - xz()*v.x() + yz()*v.y() + zz()*v.z()); - } - - Basic3DVector operator*( const Basic2DVector& v) const { - return Basic3DVector( xx()*v.x() + xy()*v.y(), - yx()*v.x() + yy()*v.y(), - zx()*v.x() + zy()*v.y()); - } - Basic3DVector multiplyInverse( const Basic2DVector& v) const { - return Basic3DVector( xx()*v.x() + yx()*v.y(), - xy()*v.x() + yy()*v.y(), - xz()*v.x() + yz()*v.y()); - } - - - - TkRotation operator*( const TkRotation& b) const { - return rot*b.rot; - } - TkRotation multiplyInverse( const TkRotation& b) const { - return rot.transpose()*b.rot; - } - - TkRotation& operator*=( const TkRotation& b) { - return *this = operator * (b); - } - - // Note a *= b; <=> a = a * b; while a.transform(b); <=> a = b * a; - TkRotation& transform(const TkRotation& b) { - return *this = b.operator * (*this); - } - - TkRotation & rotateAxes(const Basic3DVector& newX, - const Basic3DVector& newY, - const Basic3DVector& newZ) { - T del = 0.001; - - if ( - - // the check for right-handedness is not needed since - // we want to change the handedness when it's left in cmsim - // - // fabs(newZ.x()-w.x()) > del || - // fabs(newZ.y()-w.y()) > del || - // fabs(newZ.z()-w.z()) > del || - fabs(newX.mag2()-1.) > del || - fabs(newY.mag2()-1.) > del || - fabs(newZ.mag2()-1.) > del || - fabs(newX.dot(newY)) > del || - fabs(newY.dot(newZ)) > del || - fabs(newZ.dot(newX)) > del) { - geometryDetails::TkRotationErr2(); - return *this; - } else { - return transform(TkRotation(newX.x(), newY.x(), newZ.x(), - newX.y(), newY.y(), newZ.y(), - newX.z(), newY.z(), newZ.z())); - } - } - - - Basic3DVector x() const { return rot.axis[0];} - Basic3DVector y() const { return rot.axis[1];} - Basic3DVector z() const { return rot.axis[2];} - - T xx() const { return rot.axis[0].arr[0];} - T xy() const { return rot.axis[0].arr[1];} - T xz() const { return rot.axis[0].arr[2];} - T yx() const { return rot.axis[1].arr[0];} - T yy() const { return rot.axis[1].arr[1];} - T yz() const { return rot.axis[1].arr[2];} - T zx() const { return rot.axis[2].arr[0];} - T zy() const { return rot.axis[2].arr[1];} - T zz() const { return rot.axis[2].arr[2];} - -private: - - mathSSE::Rot3 rot; - -}; - - -template<> -std::ostream & operator<< ( std::ostream& s, const TkRotation& r); - -template<> -std::ostream & operator<< ( std::ostream& s, const TkRotation& r); - - -template -inline Basic3DVector operator*( const TkRotation& r, const Basic3DVector& v) { - return Basic3DVector( r.xx()*v.x() + r.xy()*v.y() + r.xz()*v.z(), - r.yx()*v.x() + r.yy()*v.y() + r.yz()*v.z(), - r.zx()*v.x() + r.zy()*v.y() + r.zz()*v.z()); -} - -template -inline TkRotation::Type> -operator*( const TkRotation& a, const TkRotation& b) { - typedef TkRotation::Type> RT; - return RT( a.xx()*b.xx() + a.xy()*b.yx() + a.xz()*b.zx(), - a.xx()*b.xy() + a.xy()*b.yy() + a.xz()*b.zy(), - a.xx()*b.xz() + a.xy()*b.yz() + a.xz()*b.zz(), - a.yx()*b.xx() + a.yy()*b.yx() + a.yz()*b.zx(), - a.yx()*b.xy() + a.yy()*b.yy() + a.yz()*b.zy(), - a.yx()*b.xz() + a.yy()*b.yz() + a.yz()*b.zz(), - a.zx()*b.xx() + a.zy()*b.yx() + a.zz()*b.zx(), - a.zx()*b.xy() + a.zy()*b.yy() + a.zz()*b.zy(), - a.zx()*b.xz() + a.zy()*b.yz() + a.zz()*b.zz()); -} - - -template -class TkRotation2D { -public: - - typedef Basic2DVector BasicVector; - - TkRotation2D( ){} - TkRotation2D( mathSSE::Rot2 const & irot ) : rot(irot){} - - TkRotation2D( T xx, T xy, T yx, T yy) : - rot(xx,xy, yx,yy){} - - TkRotation2D( const T* p) : - rot(p[0],p[1], - p[2],p[3]) {} - - TkRotation2D( const BasicVector & aX) { - - BasicVector uX = aX.unit(); - BasicVector uY(-uX.y(),uX.x()); - - rot.axis[0]= uX.v; - rot.axis[1]= uY.v; - - } - - - TkRotation2D( const BasicVector & uX, const BasicVector & uY) { - rot.axis[0]= uX.v; - rot.axis[1]= uY.v; - } - - BasicVector x() const { return rot.axis[0];} - BasicVector y() const { return rot.axis[1];} - - - TkRotation2D transposed() const { - return rot.transpose(); - } - - BasicVector rotate( const BasicVector& v) const { - return rot.rotate(v.v); - } - - BasicVector rotateBack( const BasicVector& v) const { - return rot.rotateBack(v.v); - } - - - - private: - - mathSSE::Rot2 rot; - -}; - - -template<> -std::ostream & operator<< ( std::ostream& s, const TkRotation2D& r); - -template<> -std::ostream & operator<< ( std::ostream& s, const TkRotation2D& r); - - -#endif - - - - diff --git a/DataFormats/GeometryVector/interface/OnePiRange.h b/DataFormats/GeometryVector/interface/OnePiRange.h deleted file mode 100644 index 1983da64af506..0000000000000 --- a/DataFormats/GeometryVector/interface/OnePiRange.h +++ /dev/null @@ -1,133 +0,0 @@ -#ifndef GeometryVector_Geom_OnePiRange_h -#define GeometryVector_Geom_OnePiRange_h - -#include -#include - -namespace Geom { - -/** \class OnePiRange - * A class for polar angle represantation. - * The use of OnePiRange is tranparant due to the implicit conversion to T - * Constructs like cos(theta) work as with float or double. - * The difference with respect to built-in types is that - * OnePiRange is kept in the range [0, pi], and this is consistently - * implemented in aritmetic operations. In other words, OnePiRange implements - * "modulo(pi)" arithmetics. - */ - - template - class OnePiRange { - public: - - /// Default constructor does not initialise - just as double. - OnePiRange() {} - - /// Constructor from T, does not provide automatic conversion. - explicit OnePiRange( const T& val) : theValue(val) { normalize(); } - - /// conversion operator makes transparent use possible. - operator T() const { return theValue;} - - /// Template argument conversion - template operator OnePiRange() { return OnePiRange(theValue);} - - /// Explicit access to value in case implicit conversion not OK - T value() const { return theValue;} - - // Standard arithmetics - OnePiRange& operator+=(const T& a) {theValue+=a; normalize(); return *this;} - OnePiRange& operator+=(const OnePiRange& a) {return operator+=(a.value());} - - OnePiRange& operator-=(const T& a) {theValue-=a; normalize(); return *this;} - OnePiRange& operator-=(const OnePiRange& a) {return operator-=(a.value());} - - OnePiRange& operator*=(const T& a) {theValue*=a; normalize(); return *this;} - - OnePiRange& operator/=(const T& a) {theValue/=a; normalize(); return *this;} - - T degrees() const { return theValue*180./pi();} - - /// Return the pseudorapidity. - // No need to handle 0 or pi; in this case "inf" is returned. - T eta() const { return -log(tan(theValue/2.)); } - - - private: - - T theValue; - - void normalize() { - if( theValue > (T) pi() || theValue < 0) { - theValue = fmod( theValue, (T) pi()); - } - if (theValue < 0.) theValue += pi(); - } - - }; - - /// - operator - template - inline OnePiRange operator-(const OnePiRange& a) {return OnePiRange(-a.value());} - - - /// Addition - template - inline OnePiRange operator+(const OnePiRange& a, const OnePiRange& b) { - return OnePiRange(a) += b; - } - /// Addition with scalar, does not change the precision - template - inline OnePiRange operator+(const OnePiRange& a, const Scalar& b) { - return OnePiRange(a) += b; - } - /// Addition with scalar, does not change the precision - template - inline OnePiRange operator+(const Scalar& a, const OnePiRange& b) { - return OnePiRange(b) += a; - } - - /// Subtraction - template - inline OnePiRange operator-(const OnePiRange& a, const OnePiRange& b) { - return OnePiRange(a) -= b; - } - - /// Subtraction with scalar, does not change the precision - template - inline OnePiRange operator-(const OnePiRange& a, const Scalar& b) { - return OnePiRange(a) -= b; - } - - /// Subtraction with scalar, does not change the precision - template - inline OnePiRange operator-(const Scalar& a, const OnePiRange& b) { - return OnePiRange(a - b.value()); // use of unary operators would normalize twice - } - - /// Multiplication with scalar, does not change the precision - template - inline OnePiRange operator*(const OnePiRange& a, const Scalar& b) { - return OnePiRange(a) *= b; - } - - /// Multiplication with scalar - template - inline OnePiRange operator*(double a, const OnePiRange& b) { - return OnePiRange(b) *= a; - } - - /// Division - template - inline T operator/(const OnePiRange& a, const OnePiRange& b) { - return a.value() / b.value(); - } - - /// Division by scalar - template - inline OnePiRange operator/(const OnePiRange& a, double b) { - return OnePiRange(a) /= b; - } - -} -#endif diff --git a/DataFormats/GeometryVector/interface/private/extBasic2DVector.h b/DataFormats/GeometryVector/interface/private/extBasic2DVector.h index 7d6a871576de7..68e6c69d56d81 100644 --- a/DataFormats/GeometryVector/interface/private/extBasic2DVector.h +++ b/DataFormats/GeometryVector/interface/private/extBasic2DVector.h @@ -6,32 +6,28 @@ #include "DataFormats/GeometryVector/interface/CoordinateSets.h" #include "DataFormats/Math/interface/ExtVec.h" - #include #include - -template < class T> +template class Basic2DVector { public: - - typedef T ScalarType; + typedef T ScalarType; typedef Vec2 VectorType; typedef Vec2 MathVector; - typedef Geom::Polar2Cartesian Polar; + typedef Geom::Polar2Cartesian Polar; /** default constructor uses default constructor of T to initialize the * components. For built-in floating-point types this means initialization * to zero */ - Basic2DVector() : v{0,0} {} + Basic2DVector() : v{0, 0} {} /// Copy constructor from same type. Should not be needed but for gcc bug 12685 - Basic2DVector( const Basic2DVector & p) : v(p.v) {} - - template - Basic2DVector( const Basic2DVector & p) : v{T(p.v[0]),T(p.v[1])} {} + Basic2DVector(const Basic2DVector& p) : v(p.v) {} + template + Basic2DVector(const Basic2DVector& p) : v{T(p.v[0]), T(p.v[1])} {} /** Explicit constructor from other (possibly unrelated) vector classes * The only constraint on the argument type is that it has methods @@ -40,47 +36,46 @@ class Basic2DVector { *
construction from a Basic2DVector with different precision *
construction from a coordinate system converter */ - template - explicit Basic2DVector( const Other& p) : v{T(p.x()),T(p.y())} {} + template + explicit Basic2DVector(const Other& p) : v{T(p.x()), T(p.y())} {} /// construct from cartesian coordinates - Basic2DVector( const T& x, const T& y) : v{x,y} {} + Basic2DVector(const T& x, const T& y) : v{x, y} {} // constructor from Vec2 or vec4 - Basic2DVector(MathVector const& iv) : v(iv){} - template - Basic2DVector(Vec2 const& iv) : v{iv[0],iv[1]}{} - template - Basic2DVector(Vec4 const& iv) : v{iv[0],iv[1]}{} - - MathVector const & mathVector() const { return v;} - MathVector & mathVector() { return v;} + Basic2DVector(MathVector const& iv) : v(iv) {} + template + Basic2DVector(Vec2 const& iv) : v{iv[0], iv[1]} {} + template + Basic2DVector(Vec4 const& iv) : v{iv[0], iv[1]} {} - T operator[](int i) const { return v[i];} - T & operator[](int i) { return v[i];} + MathVector const& mathVector() const { return v; } + MathVector& mathVector() { return v; } + T operator[](int i) const { return v[i]; } + T& operator[](int i) { return v[i]; } /// Cartesian x coordinate - T x() const { return v[0];} + T x() const { return v[0]; } /// Cartesian y coordinate - T y() const { return v[1];} + T y() const { return v[1]; } /// The vector magnitude squared. Equivalent to vec.dot(vec) - T mag2() const { return ::dot(v,v);} + T mag2() const { return ::dot(v, v); } /// The vector magnitude. Equivalent to sqrt(vec.mag2()) - T mag() const { return std::sqrt( mag2());} + T mag() const { return std::sqrt(mag2()); } /// Radius, same as mag() - T r() const { return mag();} + T r() const { return mag(); } /** Azimuthal angle. The value is returned in radians, in the range (-pi,pi]. * Same precision as the system atan2(x,y) function. * The return type is Geom::Phi, see it's documentation. - */ - T barePhi() const {return std::atan2(y(),x());} - Geom::Phi phi() const {return Geom::Phi(atan2(y(),x()));} + */ + T barePhi() const { return std::atan2(y(), x()); } + Geom::Phi phi() const { return Geom::Phi(atan2(y(), x())); } /** Unit vector parallel to this. * If mag() is zero, a zero vector is returned. @@ -92,154 +87,140 @@ class Basic2DVector { /** Operator += with a Basic2DVector of possibly different precision. */ - template - Basic2DVector& operator+= ( const Basic2DVector& p) { + template + Basic2DVector& operator+=(const Basic2DVector& p) { v = v + p.v; return *this; - } + } /** Operator -= with a Basic2DVector of possibly different precision. */ - template - Basic2DVector& operator-= ( const Basic2DVector& p) { + template + Basic2DVector& operator-=(const Basic2DVector& p) { v = v - p.v; return *this; - } + } /// Unary minus, returns a vector with components (-x(),-y(),-z()) - Basic2DVector operator-() const { return Basic2DVector(-v);} + Basic2DVector operator-() const { return Basic2DVector(-v); } /// Scaling by a scalar value (multiplication) - Basic2DVector& operator*= ( T t) { - v = v*t; + Basic2DVector& operator*=(T t) { + v = v * t; return *this; - } + } /// Scaling by a scalar value (division) - Basic2DVector& operator/= ( T t) { - t = T(1)/t; - v = v*t; + Basic2DVector& operator/=(T t) { + t = T(1) / t; + v = v * t; return *this; - } + } /// Scalar product, or "dot" product, with a vector of same type. - T dot( const Basic2DVector& lh) const { return ::dot(v,lh.v);} + T dot(const Basic2DVector& lh) const { return ::dot(v, lh.v); } /** Scalar (or dot) product with a vector of different precision. * The product is computed without loss of precision. The type * of the returned scalar is the more precise of the scalar types * of the two vectors. */ - template - typename PreciseFloatType::Type dot( const Basic2DVector& lh) const { - return Basic2DVector::Type>(*this) - .dot(Basic2DVector::Type>(lh)); + template + typename PreciseFloatType::Type dot(const Basic2DVector& lh) const { + return Basic2DVector::Type>(*this).dot( + Basic2DVector::Type>(lh)); } /// Vector product, or "cross" product, with a vector of same type. - T cross( const Basic2DVector& lh) const { return ::cross2(v,lh.v);} + T cross(const Basic2DVector& lh) const { return ::cross2(v, lh.v); } /** Vector (or cross) product with a vector of different precision. * The product is computed without loss of precision. The type * of the returned scalar is the more precise of the scalar types * of the two vectors. */ - template - typename PreciseFloatType::Type cross( const Basic2DVector& lh) const { - return Basic2DVector::Type>(*this) - .cross(Basic2DVector::Type>(lh)); + template + typename PreciseFloatType::Type cross(const Basic2DVector& lh) const { + return Basic2DVector::Type>(*this).cross( + Basic2DVector::Type>(lh)); } - public: - Vec2 v; - }; - namespace geometryDetails { - std::ostream & print2D(std::ostream& s, double x, double y); + std::ostream& print2D(std::ostream& s, double x, double y); } /// simple text output to standard streams template -inline std::ostream & operator<<( std::ostream& s, const Basic2DVector& v) { - return geometryDetails::print2D(s, v.x(),v.y()); +inline std::ostream& operator<<(std::ostream& s, const Basic2DVector& v) { + return geometryDetails::print2D(s, v.x(), v.y()); } - /// vector sum and subtraction of vectors of possibly different precision template -inline Basic2DVector -operator+( const Basic2DVector& a, const Basic2DVector& b) { - return a.v+b.v; +inline Basic2DVector operator+(const Basic2DVector& a, const Basic2DVector& b) { + return a.v + b.v; } template -inline Basic2DVector -operator-( const Basic2DVector& a, const Basic2DVector& b) { - return a.v-b.v; +inline Basic2DVector operator-(const Basic2DVector& a, const Basic2DVector& b) { + return a.v - b.v; } template -inline Basic2DVector::Type> -operator+( const Basic2DVector& a, const Basic2DVector& b) { - typedef Basic2DVector::Type> RT; +inline Basic2DVector::Type> operator+(const Basic2DVector& a, + const Basic2DVector& b) { + typedef Basic2DVector::Type> RT; return RT(a) + RT(b); } template -inline Basic2DVector::Type> -operator-( const Basic2DVector& a, const Basic2DVector& b) { - typedef Basic2DVector::Type> RT; - return RT(a)-RT(b); +inline Basic2DVector::Type> operator-(const Basic2DVector& a, + const Basic2DVector& b) { + typedef Basic2DVector::Type> RT; + return RT(a) - RT(b); } - - - // scalar product of vectors of same precision template -inline T operator*( const Basic2DVector& v1, const Basic2DVector& v2) { +inline T operator*(const Basic2DVector& v1, const Basic2DVector& v2) { return v1.dot(v2); } /// scalar product of vectors of different precision template -inline typename PreciseFloatType::Type operator*( const Basic2DVector& v1, - const Basic2DVector& v2) { +inline typename PreciseFloatType::Type operator*(const Basic2DVector& v1, const Basic2DVector& v2) { return v1.dot(v2); } - /** Multiplication by scalar, does not change the precision of the vector. * The return type is the same as the type of the vector argument. */ template -inline Basic2DVector operator*( const Basic2DVector& v, T t) { - return v.v*t; +inline Basic2DVector operator*(const Basic2DVector& v, T t) { + return v.v * t; } /// Same as operator*( Vector, Scalar) template inline Basic2DVector operator*(T t, const Basic2DVector& v) { - return v.v*t; + return v.v * t; } - - template -inline Basic2DVector operator*( const Basic2DVector& v, const Scalar& s) { +inline Basic2DVector operator*(const Basic2DVector& v, const Scalar& s) { T t = static_cast(s); - return v*t; + return v * t; } /// Same as operator*( Vector, Scalar) template -inline Basic2DVector operator*( const Scalar& s, const Basic2DVector& v) { +inline Basic2DVector operator*(const Scalar& s, const Basic2DVector& v) { T t = static_cast(s); - return v*t; + return v * t; } /** Division by scalar, does not change the precision of the vector. @@ -247,18 +228,17 @@ inline Basic2DVector operator*( const Scalar& s, const Basic2DVector& v) { */ template inline Basic2DVector operator/(const Basic2DVector& v, T t) { - return v.v/t; + return v.v / t; } template -inline Basic2DVector operator/( const Basic2DVector& v, const Scalar& s) { +inline Basic2DVector operator/(const Basic2DVector& v, const Scalar& s) { // T t = static_cast(Scalar(1)/s); return v*t; - T t = static_cast(s); - return v/t; + T t = static_cast(s); + return v / t; } typedef Basic2DVector Basic2DVectorF; typedef Basic2DVector Basic2DVectorD; - -#endif // GeometryVector_Basic2DVector_h +#endif // GeometryVector_Basic2DVector_h diff --git a/DataFormats/HGCalReco/interface/Trackster.h b/DataFormats/HGCalReco/interface/Trackster.h index c0eab45d9bc3a..9521155b6b4dc 100644 --- a/DataFormats/HGCalReco/interface/Trackster.h +++ b/DataFormats/HGCalReco/interface/Trackster.h @@ -73,7 +73,6 @@ namespace ticl { inline void setRawPt(float value) { raw_pt_ = value; } inline void setRawEmPt(float value) { raw_em_pt_ = value; } inline void setBarycenter(Vector value) { barycenter_ = value; } - inline void setEigenValuesVectors(); inline void fillPCAVariables(Eigen::Vector3d &eigenvalues, Eigen::Matrix3d &eigenvectors, Eigen::Vector3d &sigmas, diff --git a/DataFormats/HcalCalibObjects/interface/HcalHBHEMuonVariables.h b/DataFormats/HcalCalibObjects/interface/HcalHBHEMuonVariables.h new file mode 100644 index 0000000000000..5810676b88445 --- /dev/null +++ b/DataFormats/HcalCalibObjects/interface/HcalHBHEMuonVariables.h @@ -0,0 +1,97 @@ +#ifndef DataFormatsHcalCalibObjectsHcalHBHEMuonVariables_h +#define DataFormatsHcalCalibObjectsHcalHBHEMuonVariables_h +#include +#include + +class HcalHBHEMuonVariables { +public: + HcalHBHEMuonVariables() { clear(); } + + void clear() { + runNumber_ = eventNumber_ = lumiNumber_ = bxNumber_ = goodVertex_ = 0; + muonGood_ = muonGlobal_ = muonTracker_ = muonTight_ = muonMedium_ = false; + ptGlob_ = etaGlob_ = phiGlob_ = energyMuon_ = pMuon_ = 0; + muonTrkKink_ = muonChi2LocalPosition_ = muonSegComp_ = 0; + trackerLayer_ = numPixelLayers_ = tightPixelHits_ = 0; + innerTrack_ = outerTrack_ = globalTrack_ = false; + chiTracker_ = dxyTracker_ = dzTracker_ = 0; + innerTrackPt_ = innerTrackEta_ = innerTrackPhi_ = 0; + outerTrackHits_ = outerTrackRHits_ = 0; + outerTrackPt_ = outerTrackEta_ = outerTrackPhi_ = outerTrackChi_ = 0; + globalMuonHits_ = matchedStat_ = 0; + globalTrackPt_ = globalTrackEta_ = globalTrackPhi_ = chiGlobal_ = 0; + tightValidFraction_ = tightLongPara_ = tightTransImpara_ = 0; + isolationR04_ = isolationR03_ = 0; + ecalDetId_ = 0; + ecalEnergy_ = ecal3x3Energy_ = 0; + hcalDetId_ = ehcalDetId_ = 0; + matchedId_ = hcalHot_ = false; + hcalIeta_ = hcalIphi_ = 0; + hcalEnergy_ = hoEnergy_ = 0; + hcal1x1Energy_ = hcal1x1EnergyAux_ = hcal1x1EnergyRaw_ = 0; + hcalDepthActiveLength_.clear(); + hcalDepthActiveLengthHot_.clear(); + hcalDepthEnergy_.clear(); + hcalDepthEnergyHot_.clear(); + hcalDepthEnergyCorr_.clear(); + hcalDepthEnergyHotCorr_.clear(); + hcalDepthChargeHot_.clear(); + hcalDepthChargeHotBG_.clear(); + hcalDepthEnergyAux_.clear(); + hcalDepthEnergyHotAux_.clear(); + hcalDepthEnergyCorrAux_.clear(); + hcalDepthEnergyHotCorrAux_.clear(); + hcalDepthChargeHotAux_.clear(); + hcalDepthChargeHotBGAux_.clear(); + hcalDepthEnergyRaw_.clear(); + hcalDepthEnergyHotRaw_.clear(); + hcalDepthEnergyCorrRaw_.clear(); + hcalDepthEnergyHotCorrRaw_.clear(); + hcalDepthChargeHotRaw_.clear(); + hcalDepthChargeHotBGRaw_.clear(); + hcalDepthMatch_.clear(); + hcalDepthMatchHot_.clear(); + hcalActiveLength_ = hcalActiveLengthHot_ = 0; + allTriggers_.clear(); + hltResults_.clear(); + } + + unsigned int runNumber_, eventNumber_, lumiNumber_, bxNumber_, goodVertex_; + bool muonGood_, muonGlobal_, muonTracker_, muonTight_, muonMedium_; + float ptGlob_, etaGlob_, phiGlob_, energyMuon_, pMuon_; + float muonTrkKink_, muonChi2LocalPosition_, muonSegComp_; + int trackerLayer_, numPixelLayers_, tightPixelHits_; + bool innerTrack_, outerTrack_, globalTrack_; + float chiTracker_, dxyTracker_, dzTracker_; + float innerTrackPt_, innerTrackEta_, innerTrackPhi_; + int outerTrackHits_, outerTrackRHits_; + float outerTrackPt_, outerTrackEta_, outerTrackPhi_, outerTrackChi_; + int globalMuonHits_, matchedStat_; + float globalTrackPt_, globalTrackEta_, globalTrackPhi_, chiGlobal_; + float tightValidFraction_, tightLongPara_, tightTransImpara_; + float isolationR04_, isolationR03_; + unsigned int ecalDetId_; + float ecalEnergy_, ecal3x3Energy_; + unsigned int hcalDetId_, ehcalDetId_; + bool matchedId_, hcalHot_; + int hcalIeta_, hcalIphi_; + float hcalEnergy_, hoEnergy_; + float hcal1x1Energy_, hcal1x1EnergyAux_, hcal1x1EnergyRaw_; + std::vector hcalDepthActiveLength_, hcalDepthActiveLengthHot_; + std::vector hcalDepthEnergy_, hcalDepthEnergyHot_; + std::vector hcalDepthEnergyCorr_, hcalDepthEnergyHotCorr_; + std::vector hcalDepthChargeHot_, hcalDepthChargeHotBG_; + std::vector hcalDepthEnergyAux_, hcalDepthEnergyHotAux_; + std::vector hcalDepthEnergyCorrAux_, hcalDepthEnergyHotCorrAux_; + std::vector hcalDepthChargeHotAux_, hcalDepthChargeHotBGAux_; + std::vector hcalDepthEnergyRaw_, hcalDepthEnergyHotRaw_; + std::vector hcalDepthEnergyCorrRaw_, hcalDepthEnergyHotCorrRaw_; + std::vector hcalDepthChargeHotRaw_, hcalDepthChargeHotBGRaw_; + std::vector hcalDepthMatch_, hcalDepthMatchHot_; + float hcalActiveLength_, hcalActiveLengthHot_; + std::vector allTriggers_; + std::vector hltResults_; +}; + +typedef std::vector HcalHBHEMuonVariablesCollection; +#endif diff --git a/DataFormats/HcalCalibObjects/interface/HcalIsoTrkCalibVariables.h b/DataFormats/HcalCalibObjects/interface/HcalIsoTrkCalibVariables.h new file mode 100644 index 0000000000000..166ad2c17490e --- /dev/null +++ b/DataFormats/HcalCalibObjects/interface/HcalIsoTrkCalibVariables.h @@ -0,0 +1,58 @@ +#ifndef DataFormatsHcalCalibObjectsHcalIsoTrkCalibVariables_h +#define DataFormatsHcalCalibObjectsHcalIsoTrkCalibVariables_h +#include +#include + +class HcalIsoTrkCalibVariables { +public: + HcalIsoTrkCalibVariables() { clear(); } + + void clear() { + eventWeight_ = rhoh_ = 0; + nVtx_ = goodPV_ = nTrk_ = 0; + trgbits_.clear(); + mindR1_ = l1pt_ = l1eta_ = l1phi_ = 0; + mindR2_ = l3pt_ = l3eta_ = l3phi_ = 0; + p_ = pt_ = phi_ = gentrackP_ = 0; + ieta_ = iphi_ = 0; + eMipDR_.clear(); + eHcal_ = eHcal10_ = eHcal30_ = 0; + eHcalRaw_ = eHcal10Raw_ = eHcal30Raw_ = 0; + eHcalAux_ = eHcal10Aux_ = eHcal30Aux_ = 0; + emaxNearP_ = eAnnular_ = hmaxNearP_ = hAnnular_ = 0; + selectTk_ = qltyFlag_ = qltyMissFlag_ = qltyPVFlag_ = false; + detIds_.clear(); + hitEnergies_.clear(); + hitEnergiesRaw_.clear(); + hitEnergiesAux_.clear(); + detIds1_.clear(); + hitEnergies1_.clear(); + hitEnergies1Raw_.clear(); + hitEnergies1Aux_.clear(); + detIds3_.clear(); + hitEnergies3_.clear(); + hitEnergies3Raw_.clear(); + hitEnergies3Aux_.clear(); + }; + + double eventWeight_, rhoh_; + int goodPV_, nVtx_, nTrk_; + std::vector trgbits_; + double mindR1_, l1pt_, l1eta_, l1phi_; + double mindR2_, l3pt_, l3eta_, l3phi_; + double p_, pt_, phi_, gentrackP_; + int ieta_, iphi_; + std::vector eMipDR_; + double eHcal_, eHcal10_, eHcal30_; + double eHcalRaw_, eHcal10Raw_, eHcal30Raw_; + double eHcalAux_, eHcal10Aux_, eHcal30Aux_; + double emaxNearP_, eAnnular_, hmaxNearP_, hAnnular_; + bool selectTk_, qltyFlag_, qltyMissFlag_, qltyPVFlag_; + std::vector detIds_, detIds1_, detIds3_; + std::vector hitEnergies_, hitEnergies1_, hitEnergies3_; + std::vector hitEnergiesRaw_, hitEnergies1Raw_, hitEnergies3Raw_; + std::vector hitEnergiesAux_, hitEnergies1Aux_, hitEnergies3Aux_; +}; + +typedef std::vector HcalIsoTrkCalibVariablesCollection; +#endif diff --git a/DataFormats/HcalCalibObjects/interface/HcalIsoTrkEventVariables.h b/DataFormats/HcalCalibObjects/interface/HcalIsoTrkEventVariables.h new file mode 100644 index 0000000000000..45ebd0366b174 --- /dev/null +++ b/DataFormats/HcalCalibObjects/interface/HcalIsoTrkEventVariables.h @@ -0,0 +1,28 @@ +#ifndef DataFormatsHcalCalibObjectsHcalIsoTrkEventVariables_h +#define DataFormatsHcalCalibObjectsHcalIsoTrkEventVariables_h +#include +#include + +class HcalIsoTrkEventVariables { +public: + HcalIsoTrkEventVariables() { clear(); } + + void clear() { + allvertex_ = 0; + tracks_ = tracksProp_ = tracksSaved_ = tracksLoose_ = tracksTight_ = 0; + l1Bit_ = trigPass_ = trigPassSel_ = false; + hltbits_.clear(); + ietaAll_.clear(); + ietaGood_.clear(); + trackType_.clear(); + }; + + int allvertex_, tracks_, tracksProp_, tracksSaved_; + int tracksLoose_, tracksTight_; + bool l1Bit_, trigPass_, trigPassSel_; + std::vector ietaAll_, ietaGood_, trackType_; + std::vector hltbits_; +}; + +typedef std::vector HcalIsoTrkEventVariablesCollection; +#endif diff --git a/DataFormats/HcalCalibObjects/src/classes.h b/DataFormats/HcalCalibObjects/src/classes.h index 943be3caafd82..875004e6e635e 100644 --- a/DataFormats/HcalCalibObjects/src/classes.h +++ b/DataFormats/HcalCalibObjects/src/classes.h @@ -1,3 +1,5 @@ #include "DataFormats/HcalCalibObjects/interface/HOCalibVariables.h" -// #include "DataFormats/HOCalibHit/interface/HOCalibVariableCollection.h" +#include "DataFormats/HcalCalibObjects/interface/HcalHBHEMuonVariables.h" +#include "DataFormats/HcalCalibObjects/interface/HcalIsoTrkCalibVariables.h" +#include "DataFormats/HcalCalibObjects/interface/HcalIsoTrkEventVariables.h" #include "DataFormats/Common/interface/Wrapper.h" diff --git a/DataFormats/HcalCalibObjects/src/classes_def.xml b/DataFormats/HcalCalibObjects/src/classes_def.xml index 135e27786a254..f266a456e4c74 100644 --- a/DataFormats/HcalCalibObjects/src/classes_def.xml +++ b/DataFormats/HcalCalibObjects/src/classes_def.xml @@ -4,4 +4,23 @@ + + + + + + + + + + + + + + + + + + + diff --git a/DataFormats/L1THGCal/BuildFile.xml b/DataFormats/L1THGCal/BuildFile.xml index a81d1b9fd188b..aaba3b9a72339 100644 --- a/DataFormats/L1THGCal/BuildFile.xml +++ b/DataFormats/L1THGCal/BuildFile.xml @@ -4,7 +4,6 @@ - diff --git a/DataFormats/L1TrackTrigger/BuildFile.xml b/DataFormats/L1TrackTrigger/BuildFile.xml index 4cec83b885a91..7cd37080c5417 100644 --- a/DataFormats/L1TrackTrigger/BuildFile.xml +++ b/DataFormats/L1TrackTrigger/BuildFile.xml @@ -2,6 +2,7 @@ + diff --git a/DataFormats/L1TrackTrigger/interface/TTTrack.h b/DataFormats/L1TrackTrigger/interface/TTTrack.h index f5e46805bd50f..8428d694ac779 100644 --- a/DataFormats/L1TrackTrigger/interface/TTTrack.h +++ b/DataFormats/L1TrackTrigger/interface/TTTrack.h @@ -105,6 +105,9 @@ class TTTrack : public TTTrack_TrackWord { /// Track phi double phi() const; + /// Local track phi (within the sector) + double localPhi() const; + /// Track tanL double tanL() const; @@ -313,6 +316,11 @@ double TTTrack::phi() const { return thePhi_; } +template +double TTTrack::localPhi() const { + return TTTrack_TrackWord::localPhi(thePhi_, thePhiSector_); +} + template double TTTrack::d0() const { return theD0_; @@ -441,9 +449,17 @@ void TTTrack::setTrackWordBits() { // missing conversion of global phi to difference from sector center phi if (theChi2_Z_ < 0) { - setTrackWord( - valid, theMomentum_, thePOCA_, theRInv_, chi2Red(), 0, chi2BendRed(), theHitPattern_, mvaQuality, mvaOther); - + setTrackWord(valid, + theMomentum_, + thePOCA_, + theRInv_, + theChi2_, + 0, + theStubPtConsistency_, + theHitPattern_, + mvaQuality, + mvaOther, + thePhiSector_); } else { setTrackWord(valid, theMomentum_, @@ -454,7 +470,8 @@ void TTTrack::setTrackWordBits() { chi2BendRed(), theHitPattern_, mvaQuality, - mvaOther); + mvaOther, + thePhiSector_); } return; } diff --git a/DataFormats/L1TrackTrigger/interface/TTTrack_TrackWord.h b/DataFormats/L1TrackTrigger/interface/TTTrack_TrackWord.h index 81208788ec947..4b37a6b63a46b 100644 --- a/DataFormats/L1TrackTrigger/interface/TTTrack_TrackWord.h +++ b/DataFormats/L1TrackTrigger/interface/TTTrack_TrackWord.h @@ -15,15 +15,23 @@ #include "DataFormats/GeometryVector/interface/GlobalVector.h" #include "DataFormats/GeometryVector/interface/GlobalPoint.h" +#include "DataFormats/Math/interface/deltaPhi.h" #include #include #include #include +#include +#include #include #include +namespace tttrack_trackword { + void infoTestDigitizationScheme( + const unsigned int, const double, const double, const unsigned int, const double, const unsigned int); +} + class TTTrack_TrackWord { public: // ----------constants, enums and typedefs --------- @@ -96,6 +104,10 @@ class TTTrack_TrackWord { static constexpr std::array bendChi2Bins = { {0.0, 0.75, 1.0, 1.5, 2.25, 3.5, 5.0, 20.0}}; + // Sector constants + static constexpr unsigned int nSectors = 9; + static constexpr double sectorWidth = (2. * M_PI) / nSectors; + // Track flags typedef ap_uint valid_t; // valid bit @@ -130,10 +142,11 @@ class TTTrack_TrackWord { double bendChi2, unsigned int hitPattern, unsigned int mvaQuality, - unsigned int mvaOther); + unsigned int mvaOther, + unsigned int sector); TTTrack_TrackWord(unsigned int valid, unsigned int rInv, - unsigned int phi0, + unsigned int phi0, // local phi unsigned int tanl, unsigned int z0, unsigned int d0, @@ -201,11 +214,11 @@ class TTTrack_TrackWord { // These functions return the unpacked and converted values // These functions return real numbers converted from the digitized quantities by unpacking the 96-bit track word bool getValid() const { return getValidWord().to_bool(); } - double getRinv() const { return unpackSignedValue(getRinvBits(), TrackBitWidths::kRinvSize, stepRinv); } - double getPhi() const { return unpackSignedValue(getPhiBits(), TrackBitWidths::kPhiSize, stepPhi0); } - double getTanl() const { return unpackSignedValue(getTanlBits(), TrackBitWidths::kTanlSize, stepTanL); } - double getZ0() const { return unpackSignedValue(getZ0Bits(), TrackBitWidths::kZ0Size, stepZ0); } - double getD0() const { return unpackSignedValue(getD0Bits(), TrackBitWidths::kD0Size, stepD0); } + double getRinv() const { return undigitizeSignedValue(getRinvBits(), TrackBitWidths::kRinvSize, stepRinv); } + double getPhi() const { return undigitizeSignedValue(getPhiBits(), TrackBitWidths::kPhiSize, stepPhi0); } + double getTanl() const { return undigitizeSignedValue(getTanlBits(), TrackBitWidths::kTanlSize, stepTanL); } + double getZ0() const { return undigitizeSignedValue(getZ0Bits(), TrackBitWidths::kZ0Size, stepZ0); } + double getD0() const { return undigitizeSignedValue(getD0Bits(), TrackBitWidths::kD0Size, stepD0); } double getChi2RPhi() const { return chi2RPhiBins[getChi2RPhiBits()]; } double getChi2RZ() const { return chi2RZBins[getChi2RZBits()]; } double getBendChi2() const { return bendChi2Bins[getBendChi2Bits()]; } @@ -223,11 +236,12 @@ class TTTrack_TrackWord { double bendChi2, unsigned int hitPattern, unsigned int mvaQuality, - unsigned int mvaOther); + unsigned int mvaOther, + unsigned int sector); void setTrackWord(unsigned int valid, unsigned int rInv, - unsigned int phi0, + unsigned int phi0, // local phi unsigned int tanl, unsigned int z0, unsigned int d0, @@ -240,7 +254,7 @@ class TTTrack_TrackWord { void setTrackWord(ap_uint valid, ap_uint rInv, - ap_uint phi0, + ap_uint phi0, // local phi ap_uint tanl, ap_uint z0, ap_uint d0, @@ -251,16 +265,36 @@ class TTTrack_TrackWord { ap_uint mvaQuality, ap_uint mvaOther); + // ----------member functions (testers) ------------ + bool singleDigitizationSchemeTest(const double floatingPointValue, const unsigned int nBits, const double lsb) const; + void testDigitizationScheme() const; + +protected: + // ----------protected member functions ------------ + float localPhi(float globalPhi, unsigned int sector) const { + return reco::deltaPhi(globalPhi, (sector * sectorWidth)); + } + private: // ----------private member functions -------------- unsigned int digitizeSignedValue(double value, unsigned int nBits, double lsb) const { - unsigned int digitized_value = std::floor(std::abs(value) / lsb); - unsigned int digitized_maximum = (1 << (nBits - 1)) - 1; // The remove 1 bit from nBits to account for the sign - if (digitized_value > digitized_maximum) - digitized_value = digitized_maximum; - if (value < 0) - digitized_value = (1 << nBits) - digitized_value; // two's complement encoding - return digitized_value; + // Digitize the incoming value + int digitizedValue = std::floor(value / lsb); + + // Calculate the maxmum possible positive value given an output of nBits in size + int digitizedMaximum = (1 << (nBits - 1)) - 1; // The remove 1 bit from nBits to account for the sign + int digitizedMinimum = -1. * (digitizedMaximum + 1); + + // Saturate the digitized value + digitizedValue = std::clamp(digitizedValue, digitizedMinimum, digitizedMaximum); + + // Do the two's compliment encoding + unsigned int twosValue = digitizedValue; + if (digitizedValue < 0) { + twosValue += (1 << nBits); + } + + return twosValue; } template @@ -269,14 +303,20 @@ class TTTrack_TrackWord { return (up - bins.begin() - 1); } - double unpackSignedValue(unsigned int bits, unsigned int nBits, double lsb) const { - int isign = 1; - unsigned int digitized_maximum = (1 << nBits) - 1; - if (bits & (1 << (nBits - 1))) { // check the sign - isign = -1; - bits = (1 << (nBits + 1)) - bits; // if negative, flip everything for two's complement encoding + double undigitizeSignedValue(unsigned int twosValue, unsigned int nBits, double lsb) const { + // Check that none of the bits above the nBits-1 bit, in a range of [0, nBits-1], are set. + // This makes sure that it isn't possible for the value represented by `twosValue` to be + // any bigger than ((1 << nBits) - 1). + assert((twosValue >> nBits) == 0); + + // Convert from twos compliment to C++ signed integer (normal digitized value) + int digitizedValue = twosValue; + if (twosValue & (1 << (nBits - 1))) { // check if the twosValue is negative + digitizedValue -= (1 << nBits); } - return (double(bits & digitized_maximum) + 0.5) * lsb * isign; + + // Convert to floating point value + return (double(digitizedValue) + 0.5) * lsb; } // ----------member data --------------------------- diff --git a/DataFormats/L1TrackTrigger/src/TTTrack_TrackWord.cc b/DataFormats/L1TrackTrigger/src/TTTrack_TrackWord.cc index 48031bc8fc514..0b1420d2ca09f 100644 --- a/DataFormats/L1TrackTrigger/src/TTTrack_TrackWord.cc +++ b/DataFormats/L1TrackTrigger/src/TTTrack_TrackWord.cc @@ -11,6 +11,20 @@ /////// #include "DataFormats/L1TrackTrigger/interface/TTTrack_TrackWord.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" + +void tttrack_trackword::infoTestDigitizationScheme(const unsigned int nBits, + const double lsb, + const double floatingPointValue, + const unsigned int digitizedSignedValue, + const double undigitizedSignedValue, + const unsigned int redigitizedSignedValue) { + edm::LogInfo("TTTrack_TrackWord") << "testDigitizationScheme: (nBits, lsb) = (" << nBits << ", " << lsb << ")\n" + << "Floating point value = " << floatingPointValue + << "\tDigitized value = " << digitizedSignedValue + << "\tUn-digitized value = " << undigitizedSignedValue + << "\tRe-digitized value = " << redigitizedSignedValue; +} //Constructor - turn track parameters into 96-bit word TTTrack_TrackWord::TTTrack_TrackWord(unsigned int valid, @@ -22,8 +36,9 @@ TTTrack_TrackWord::TTTrack_TrackWord(unsigned int valid, double bendChi2, unsigned int hitPattern, unsigned int mvaQuality, - unsigned int mvaOther) { - setTrackWord(valid, momentum, POCA, rInv, chi2RPhi, chi2RZ, bendChi2, hitPattern, mvaQuality, mvaOther); + unsigned int mvaOther, + unsigned int sector) { + setTrackWord(valid, momentum, POCA, rInv, chi2RPhi, chi2RZ, bendChi2, hitPattern, mvaQuality, mvaOther, sector); } TTTrack_TrackWord::TTTrack_TrackWord(unsigned int valid, @@ -51,9 +66,10 @@ void TTTrack_TrackWord::setTrackWord(unsigned int valid, double bendChi2, unsigned int hitPattern, unsigned int mvaQuality, - unsigned int mvaOther) { + unsigned int mvaOther, + unsigned int sector) { // first, derive quantities to be packed - float rPhi = momentum.phi(); // this needs to be phi relative to center of sector **** + float rPhi = localPhi(momentum.phi(), sector); // this needs to be phi relative to the center of the sector float rTanl = momentum.z() / momentum.perp(); float rZ0 = POCA.z(); float rD0 = POCA.perp(); @@ -176,3 +192,29 @@ void TTTrack_TrackWord::setTrackWord( trackWord_.set(b, valid[b - offset]); } } + +bool TTTrack_TrackWord::singleDigitizationSchemeTest(const double floatingPointValue, + const unsigned int nBits, + const double lsb) const { + unsigned int digitizedSignedValue = digitizeSignedValue(floatingPointValue, nBits, lsb); + double undigitizedSignedValue = undigitizeSignedValue(digitizedSignedValue, nBits, lsb); + unsigned int redigitizedSignedValue = digitizeSignedValue(undigitizedSignedValue, nBits, lsb); + tttrack_trackword::infoTestDigitizationScheme( + nBits, lsb, floatingPointValue, digitizedSignedValue, undigitizedSignedValue, redigitizedSignedValue); + return (std::abs(floatingPointValue - undigitizedSignedValue) <= (lsb / 2.0)) && + (digitizedSignedValue == redigitizedSignedValue); +} + +void TTTrack_TrackWord::testDigitizationScheme() const { + /* + Expected output: + testDigitizationScheme: Floating point value = -4 Digitized value = 4 Un-digitized value = -3.5 + testDigitizationScheme: Floating point value = 3 Digitized value = 3 Un-digitized value = 3.5 + testDigitizationScheme: Floating point value = -3.5 Digitized value = 9 Un-digitized value = -3.25 + testDigitizationScheme: Floating point value = 3.5 Digitized value = 7 Un-digitized value = 3.75 + */ + assert(singleDigitizationSchemeTest(-4.0, 3, 1.0)); + assert(singleDigitizationSchemeTest(3.0, 3, 1.0)); + assert(singleDigitizationSchemeTest(-3.5, 4, 0.5)); + assert(singleDigitizationSchemeTest(3.5, 4, 0.5)); +} diff --git a/DataFormats/L1TrackTrigger/test/BuildFile.xml b/DataFormats/L1TrackTrigger/test/BuildFile.xml new file mode 100644 index 0000000000000..2e2e4ad4f5bb4 --- /dev/null +++ b/DataFormats/L1TrackTrigger/test/BuildFile.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/DataFormats/L1TrackTrigger/test/TestDataFormatsTTTrackTrackWord.cc b/DataFormats/L1TrackTrigger/test/TestDataFormatsTTTrackTrackWord.cc new file mode 100644 index 0000000000000..14709bc605514 --- /dev/null +++ b/DataFormats/L1TrackTrigger/test/TestDataFormatsTTTrackTrackWord.cc @@ -0,0 +1,31 @@ +#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" +#include "DataFormats/TestObjects/interface/ToyProducts.h" +#include "DataFormats/L1TrackTrigger/interface/TTTrack_TrackWord.h" + +#include + +namespace trackwordtest { + class TTTrackTrackWordDummyOneAnalyzer : public edm::EDAnalyzer { + public: + explicit TTTrackTrackWordDummyOneAnalyzer(const edm::ParameterSet&) {} + ~TTTrackTrackWordDummyOneAnalyzer() {} + + void analyze(edm::Event const& iEvent, edm::EventSetup const& iSetup) override { + TTTrack_TrackWord tw; + tw.testDigitizationScheme(); + } + + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + //to ensure distinct cfi names + descriptions.addWithDefaultLabel(desc); + } + }; +} // namespace trackwordtest + +using trackwordtest::TTTrackTrackWordDummyOneAnalyzer; +DEFINE_FWK_MODULE(TTTrackTrackWordDummyOneAnalyzer); \ No newline at end of file diff --git a/DataFormats/L1TrackTrigger/test/testDataFormatsTTTrackTrackWord_cfg.py b/DataFormats/L1TrackTrigger/test/testDataFormatsTTTrackTrackWord_cfg.py new file mode 100644 index 0000000000000..227d9a0e740c2 --- /dev/null +++ b/DataFormats/L1TrackTrigger/test/testDataFormatsTTTrackTrackWord_cfg.py @@ -0,0 +1,14 @@ +import FWCore.ParameterSet.Config as cms + +process = cms.Process("Test") + +process.source = cms.Source("EmptySource") + +process.maxEvents.input = 1 + +process.load("FWCore.MessageService.MessageLogger_cfi") +process.MessageLogger.cerr.INFO.limit = cms.untracked.int32(1000000000) + +process.dummyAna = cms.EDAnalyzer("TTTrackTrackWordDummyOneAnalyzer") + +process.p = cms.Path(process.dummyAna) \ No newline at end of file diff --git a/DataFormats/METReco/interface/PFClusterMETCollection.h b/DataFormats/METReco/interface/PFClusterMETCollection.h deleted file mode 100644 index 1a02b783450ae..0000000000000 --- a/DataFormats/METReco/interface/PFClusterMETCollection.h +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef METRECO_PFClusterMETCOLLECTION_H -#define METRECO_PFClusterMETCOLLECTION_H - -/** \class PFClusterMETCollection - * - * \short Collection of PFCluster MET - * - * PFClusterMETCollection is a collection of PFClusterMET objects - * - * \author Salvatore Rappoccio, JHU - * - * \version 1st Version Dec, 2010 - * - ************************************************************/ - -#include -#include "DataFormats/METReco/interface/PFClusterMETFwd.h" - -namespace reco -{ - typedef std::vector PFClusterMETCollection; -} -#endif // METRECO_PFClusterMETCOLLECTION_H diff --git a/DataFormats/Math/interface/SSEArray.h b/DataFormats/Math/interface/SSEArray.h deleted file mode 100644 index 778100e291007..0000000000000 --- a/DataFormats/Math/interface/SSEArray.h +++ /dev/null @@ -1,111 +0,0 @@ -#ifndef DataFormat_Math_SSEArray_H -#define DataFormat_Math_SSEArray_H - - -#include "DataFormats/Math/interface/SSEVec.h" -#include - -#ifdef CMS_USE_SSE -namespace mathSSE { - -// "vertical array" - template - struct ArrayTraits { - }; - - template - struct ArrayMask { - }; - - //FIXME avoid punning... - template <> - struct ArrayMask { - static inline Vec4 value() { - Vec4 v; v.setMask(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff); - return v; - } - }; - template <> - struct ArrayMask { - static inline Vec4 value() { - Vec4 v; v.setMask(0xffffffff, 0x0, 0x0, 0x0); - return v; - } - }; - template <> - struct ArrayMask { - static inline Vec4 value() { - Vec4 v; v.setMask(0xffffffff, 0xffffffff, 0x0, 0x0); - return v; - } - }; - template <> - struct ArrayMask { - static inline Vec4 value() { - Vec4 v; v.setMask(0xffffffff, 0xffffffff, 0xffffffff, 0x0); - return v; - } - }; - - template <> - struct ArrayMask { - static inline Vec2 value() { - Vec2 v; v.setMask(0xffffffffffffffffLL, 0xffffffffffffffffLL); - return v; - } - }; - template <> - struct ArrayMask { - static inline Vec2 value() { - Vec2 v; v.setMask(0xffffffffffffffffLL, 0x0LL); - return v; - } - }; - - - template - struct ArrayTraits { - typedef float Scalar; - typedef Vec4 Vec; - static const size_t size = S; - static const size_t ssesize = (S+3)/4; - static const size_t arrsize = 4*ssesize; - static inline Vec maskLast() { return ArrayMask::value(); } - static inline Vec __attribute__((__always_inline__)) mask(Vec v, size_t i) { - return (i==ssesize-1) ? maskLast()&v : v; - } - template - static void loop(F f) { - for (size_t i=0; i!=ssesize-1;++i) - f(i, ArrayMask::value()); - f(ssesize-1,maskLast()); - } - }; - - template - struct ArrayTraits { - typedef double Scalar; - typedef Vec2 Vec; - static const size_t size = S; - static const size_t ssesize = (S+1)/2; - static const size_t arrsize = 2*ssesize; - static inline Vec maskLast() { return ArrayMask::value();} - }; - - template - union Array { - typedef ArrayTraits Traits; - typedef typename Traits::Vec Vec; - typename Vec::nativeType vec[Traits::ssesize]; - T __attribute__ ((aligned(16))) arr[Traits::arrsize]; - - Vec operator[]( size_t i) { return vec[i];} - Vec const & operator[]( size_t i) const{ return reinterpret_cast(vec[i]);} - - }; - - -} - -#endif // CMS_USE_SSE -#endif // DataFormat_Math_SSEArray_H diff --git a/DataFormats/Math/interface/libminifloat.h b/DataFormats/Math/interface/libminifloat.h index e811b89bca4e7..14c88c3def68e 100644 --- a/DataFormats/Math/interface/libminifloat.h +++ b/DataFormats/Math/interface/libminifloat.h @@ -1,6 +1,7 @@ #ifndef libminifloat_h #define libminifloat_h #include "FWCore/Utilities/interface/thread_safety_macros.h" +#include "FWCore/Utilities/interface/bit_cast.h" #include #include #include @@ -10,62 +11,42 @@ class MiniFloatConverter { public: MiniFloatConverter(); inline static float float16to32(uint16_t h) { - union { - float flt; - uint32_t i32; - } conv; - conv.i32 = mantissatable[offsettable[h >> 10] + (h & 0x3ff)] + exponenttable[h >> 10]; - return conv.flt; + uint32_t i32 = mantissatable[offsettable[h >> 10] + (h & 0x3ff)] + exponenttable[h >> 10]; + return edm::bit_cast(i32); } inline static uint16_t float32to16(float x) { return float32to16round(x); } /// Fast implementation, but it crops the number so it biases low inline static uint16_t float32to16crop(float x) { - union { - float flt; - uint32_t i32; - } conv; - conv.flt = x; - return basetable[(conv.i32 >> 23) & 0x1ff] + ((conv.i32 & 0x007fffff) >> shifttable[(conv.i32 >> 23) & 0x1ff]); + uint32_t i32 = edm::bit_cast(x); + return basetable[(i32 >> 23) & 0x1ff] + ((i32 & 0x007fffff) >> shifttable[(i32 >> 23) & 0x1ff]); } /// Slower implementation, but it rounds to avoid biases inline static uint16_t float32to16round(float x) { - union { - float flt; - uint32_t i32; - } conv; - conv.flt = x; - uint8_t shift = shifttable[(conv.i32 >> 23) & 0x1ff]; + uint32_t i32 = edm::bit_cast(x); + uint8_t shift = shifttable[(i32 >> 23) & 0x1ff]; if (shift == 13) { - uint16_t base2 = (conv.i32 & 0x007fffff) >> 12; + uint16_t base2 = (i32 & 0x007fffff) >> 12; uint16_t base = base2 >> 1; if (((base2 & 1) != 0) && (base < 1023)) base++; - return basetable[(conv.i32 >> 23) & 0x1ff] + base; + return basetable[(i32 >> 23) & 0x1ff] + base; } else { - return basetable[(conv.i32 >> 23) & 0x1ff] + ((conv.i32 & 0x007fffff) >> shifttable[(conv.i32 >> 23) & 0x1ff]); + return basetable[(i32 >> 23) & 0x1ff] + ((i32 & 0x007fffff) >> shifttable[(i32 >> 23) & 0x1ff]); } } template inline static float reduceMantissaToNbits(const float &f) { static_assert(bits <= 23, "max mantissa size is 23 bits"); constexpr uint32_t mask = (0xFFFFFFFF >> (23 - bits)) << (23 - bits); - union { - float flt; - uint32_t i32; - } conv; - conv.flt = f; - conv.i32 &= mask; - return conv.flt; + uint32_t i32 = edm::bit_cast(f); + i32 &= mask; + return edm::bit_cast(i32); } inline static float reduceMantissaToNbits(const float &f, int bits) { uint32_t mask = (0xFFFFFFFF >> (23 - bits)) << (23 - bits); - union { - float flt; - uint32_t i32; - } conv; - conv.flt = f; - conv.i32 &= mask; - return conv.flt; + uint32_t i32 = edm::bit_cast(f); + i32 &= mask; + return edm::bit_cast(i32); } class ReduceMantissaToNbitsRounding { @@ -77,20 +58,16 @@ class MiniFloatConverter { float operator()(float f) const { constexpr uint32_t low23 = (0x007FFFFF); // mask to keep lowest 23 bits = mantissa constexpr uint32_t hi9 = (0xFF800000); // mask to keep highest 9 bits = the rest - union { - float flt; - uint32_t i32; - } conv; - conv.flt = f; - if (conv.i32 & test) { // need to round - uint32_t mantissa = (conv.i32 & low23) >> shift; + uint32_t i32 = edm::bit_cast(f); + if (i32 & test) { // need to round + uint32_t mantissa = (i32 & low23) >> shift; if (mantissa < maxn) mantissa++; - conv.i32 = (conv.i32 & hi9) | (mantissa << shift); + i32 = (i32 & hi9) | (mantissa << shift); } else { - conv.i32 &= mask; + i32 &= mask; } - return conv.flt; + return edm::bit_cast(i32); } private: @@ -114,54 +91,34 @@ class MiniFloatConverter { } inline static float max() { - union { - float flt; - uint32_t i32; - } conv; - conv.i32 = 0x477fe000; // = mantissatable[offsettable[0x1e]+0x3ff]+exponenttable[0x1e] - return conv.flt; + constexpr uint32_t i32 = 0x477fe000; // = mantissatable[offsettable[0x1e]+0x3ff]+exponenttable[0x1e] + return edm::bit_cast(i32); } // Maximum float32 value that gets rounded to max() inline static float max32RoundedToMax16() { - union { - float flt; - uint32_t i32; - } conv; // 2^16 in float32 is the first to result inf in float16, so // 2^16-1 is the last float32 to result max() in float16 - conv.i32 = (0x8f << 23) - 1; - return conv.flt; + constexpr uint32_t i32 = (0x8f << 23) - 1; + return edm::bit_cast(i32); } inline static float min() { - union { - float flt; - uint32_t i32; - } conv; - conv.i32 = 0x38800000; // = mantissatable[offsettable[1]+0]+exponenttable[1] - return conv.flt; + constexpr uint32_t i32 = 0x38800000; // = mantissatable[offsettable[1]+0]+exponenttable[1] + return edm::bit_cast(i32); } // Minimum float32 value that gets rounded to min() inline static float min32RoundedToMin16() { - union { - float flt; - uint32_t i32; - } conv; // 2^-14-1 in float32 is the first to result denormalized in float16, so // 2^-14 is the first float32 to result min() in float16 - conv.i32 = (0x71 << 23); - return conv.flt; + constexpr uint32_t i32 = (0x71 << 23); + return edm::bit_cast(i32); } inline static float denorm_min() { - union { - float flt; - uint32_t i32; - } conv; - conv.i32 = 0x33800000; // mantissatable[offsettable[0]+1]+exponenttable[0] - return conv.flt; + constexpr uint32_t i32 = 0x33800000; // mantissatable[offsettable[0]+1]+exponenttable[0] + return edm::bit_cast(i32); } inline static bool isdenorm(uint16_t h) { diff --git a/DataFormats/Math/interface/private/AVXVec.h b/DataFormats/Math/interface/private/AVXVec.h index 9fe33e8c3d1fd..78850716bba21 100644 --- a/DataFormats/Math/interface/private/AVXVec.h +++ b/DataFormats/Math/interface/private/AVXVec.h @@ -5,183 +5,157 @@ // only as part of SSEVec namespace mathSSE { - template<> + template <> union Vec4 { - typedef __m256d nativeType; + typedef __m256d nativeType; __m256d vec; - double __attribute__ ((aligned(32))) arr[4]; + double __attribute__((aligned(32))) arr[4]; OldVec o; - + Vec4(__m256d ivec) : vec(ivec) {} - Vec4(OldVec const & ivec) : o(ivec) {} - - Vec4() { - vec = _mm256_setzero_pd(); - } + Vec4(OldVec const& ivec) : o(ivec) {} + Vec4() { vec = _mm256_setzero_pd(); } - inline Vec4(Vec4 ivec) { - vec = _mm256_cvtps_pd(ivec.vec); - } + inline Vec4(Vec4 ivec) { vec = _mm256_cvtps_pd(ivec.vec); } - explicit Vec4(double f1) { - set1(f1); - } + explicit Vec4(double f1) { set1(f1); } - Vec4(double f1, double f2, double f3, double f4=0) { - arr[0] = f1; arr[1] = f2; arr[2] = f3; arr[3]=f4; + Vec4(double f1, double f2, double f3, double f4 = 0) { + arr[0] = f1; + arr[1] = f2; + arr[2] = f3; + arr[3] = f4; } - - Vec4( Vec2 ivec0, Vec2 ivec1) { - vec = _mm256_insertf128_pd(vec,ivec0.vec,0); - vec = _mm256_insertf128_pd(vec,ivec1.vec,1); - - } - - Vec4( Vec2 ivec0, double f3, double f4=0) { - vec = _mm256_insertf128_pd(vec,ivec0.vec,0); - arr[2] = f3; arr[3] = f4; + Vec4(Vec2 ivec0, Vec2 ivec1) { + vec = _mm256_insertf128_pd(vec, ivec0.vec, 0); + vec = _mm256_insertf128_pd(vec, ivec1.vec, 1); } - Vec4( Vec2 ivec0) { - vec = _mm256_setzero_pd(); - vec = _mm256_insertf128_pd(vec,ivec0.vec,0); + Vec4(Vec2 ivec0, double f3, double f4 = 0) { + vec = _mm256_insertf128_pd(vec, ivec0.vec, 0); + arr[2] = f3; + arr[3] = f4; } + Vec4(Vec2 ivec0) { + vec = _mm256_setzero_pd(); + vec = _mm256_insertf128_pd(vec, ivec0.vec, 0); + } // for masking void setMask(unsigned int m1, unsigned int m2, unsigned int m3, unsigned int m4) { - Mask4 mask(m1,m2,m3,m4); vec=mask.vec; + Mask4 mask(m1, m2, m3, m4); + vec = mask.vec; } - void set(double f1, double f2, double f3, double f4=0) { - vec = _mm256_set_pd(f4, f3, f2, f1); - } + void set(double f1, double f2, double f3, double f4 = 0) { vec = _mm256_set_pd(f4, f3, f2, f1); } - void set1(double f1) { - vec = _mm256_set1_pd(f1); - } + void set1(double f1) { vec = _mm256_set1_pd(f1); } - template + template Vec4 get1() const { - return _mm256_set1_pd(arr[N]); //FIXME + return _mm256_set1_pd(arr[N]); //FIXME } /* Vec4 get1(unsigned int n) const { return _mm256_set1_pd(arr[n]); //FIXME } */ - double & operator[](unsigned int n) { - return arr[n]; - } + double& operator[](unsigned int n) { return arr[n]; } - double operator[](unsigned int n) const { - return arr[n]; - } - - Vec2 xy() const { return Vec2(_mm256_castpd256_pd128(vec));} - Vec2 zw() const { return Vec2(_mm256_castpd256_pd128(_mm256_permute2f128_pd(vec,vec,1)));} + double operator[](unsigned int n) const { return arr[n]; } + Vec2 xy() const { return Vec2(_mm256_castpd256_pd128(vec)); } + Vec2 zw() const { return Vec2(_mm256_castpd256_pd128(_mm256_permute2f128_pd(vec, vec, 1))); } }; - - inline Vec4::Vec4(Vec4 ivec) { - vec = _mm256_cvtpd_ps(ivec.vec); - } -} // namespace mathSSE - + inline Vec4::Vec4(Vec4 ivec) { vec = _mm256_cvtpd_ps(ivec.vec); } +} // namespace mathSSE inline bool operator==(mathSSE::Vec4 a, mathSSE::Vec4 b) { - return _mm256_movemask_pd(_mm256_cmp_pd(a.vec,b.vec,_CMP_EQ_OS))==0xf; + return _mm256_movemask_pd(_mm256_cmp_pd(a.vec, b.vec, _CMP_EQ_OS)) == 0xf; } - + inline mathSSE::Vec4 cmpeq(mathSSE::Vec4 a, mathSSE::Vec4 b) { - return _mm256_cmp_pd(a.vec,b.vec,_CMP_EQ_OS); + return _mm256_cmp_pd(a.vec, b.vec, _CMP_EQ_OS); } inline mathSSE::Vec4 cmpgt(mathSSE::Vec4 a, mathSSE::Vec4 b) { - return _mm256_cmp_pd(a.vec,b.vec,_CMP_GT_OS); + return _mm256_cmp_pd(a.vec, b.vec, _CMP_GT_OS); } inline mathSSE::Vec4 hadd(mathSSE::Vec4 a, mathSSE::Vec4 b) { - return _mm256_hadd_pd(a.vec,b.vec); + return _mm256_hadd_pd(a.vec, b.vec); } - - inline mathSSE::Vec4 operator-(mathSSE::Vec4 a) { - const __m256d neg = _mm256_set_pd ( -0.0 , -0.0 , -0.0, -0.0); - return _mm256_xor_pd(a.vec,neg); + const __m256d neg = _mm256_set_pd(-0.0, -0.0, -0.0, -0.0); + return _mm256_xor_pd(a.vec, neg); } inline mathSSE::Vec4 operator&(mathSSE::Vec4 a, mathSSE::Vec4 b) { - return _mm256_and_pd(a.vec,b.vec); + return _mm256_and_pd(a.vec, b.vec); } inline mathSSE::Vec4 operator|(mathSSE::Vec4 a, mathSSE::Vec4 b) { - return _mm256_or_pd(a.vec,b.vec); + return _mm256_or_pd(a.vec, b.vec); } inline mathSSE::Vec4 operator^(mathSSE::Vec4 a, mathSSE::Vec4 b) { - return _mm256_xor_pd(a.vec,b.vec); + return _mm256_xor_pd(a.vec, b.vec); } inline mathSSE::Vec4 andnot(mathSSE::Vec4 a, mathSSE::Vec4 b) { - return _mm256_andnot_pd(a.vec,b.vec); + return _mm256_andnot_pd(a.vec, b.vec); } - inline mathSSE::Vec4 operator+(mathSSE::Vec4 a, mathSSE::Vec4 b) { - return _mm256_add_pd(a.vec,b.vec); + return _mm256_add_pd(a.vec, b.vec); } inline mathSSE::Vec4 operator-(mathSSE::Vec4 a, mathSSE::Vec4 b) { - return _mm256_sub_pd(a.vec,b.vec); + return _mm256_sub_pd(a.vec, b.vec); } inline mathSSE::Vec4 operator*(mathSSE::Vec4 a, mathSSE::Vec4 b) { - return _mm256_mul_pd(a.vec,b.vec); + return _mm256_mul_pd(a.vec, b.vec); } inline mathSSE::Vec4 operator/(mathSSE::Vec4 a, mathSSE::Vec4 b) { - return _mm256_div_pd(a.vec,b.vec); + return _mm256_div_pd(a.vec, b.vec); } inline mathSSE::Vec4 operator*(double a, mathSSE::Vec4 b) { - return _mm256_mul_pd(_mm256_set1_pd(a),b.vec); + return _mm256_mul_pd(_mm256_set1_pd(a), b.vec); } -inline mathSSE::Vec4 operator*(mathSSE::Vec4 b,double a) { - return _mm256_mul_pd(_mm256_set1_pd(a),b.vec); +inline mathSSE::Vec4 operator*(mathSSE::Vec4 b, double a) { + return _mm256_mul_pd(_mm256_set1_pd(a), b.vec); } -inline mathSSE::Vec4 operator/(mathSSE::Vec4 b,double a) { - return _mm256_div_pd(b.vec,_mm256_set1_pd(a)); +inline mathSSE::Vec4 operator/(mathSSE::Vec4 b, double a) { + return _mm256_div_pd(b.vec, _mm256_set1_pd(a)); } - -inline double -__attribute__((always_inline)) __attribute__ ((pure)) +inline double __attribute__((always_inline)) __attribute__((pure)) dot(mathSSE::Vec4 a, mathSSE::Vec4 b) { - using mathSSE::_mm256_dot_pd; + using mathSSE::_mm256_dot_pd; mathSSE::Vec4 ret; - ret.vec = _mm256_dot_pd(a.vec,b.vec); + ret.vec = _mm256_dot_pd(a.vec, b.vec); return ret.arr[0]; } -inline mathSSE::Vec4 -__attribute__((always_inline)) __attribute__ ((pure)) +inline mathSSE::Vec4 __attribute__((always_inline)) __attribute__((pure)) cross(mathSSE::Vec4 a, mathSSE::Vec4 b) { - using mathSSE::_mm256_cross_pd; - return _mm256_cross_pd(a.vec,b.vec); + using mathSSE::_mm256_cross_pd; + return _mm256_cross_pd(a.vec, b.vec); } -inline double -__attribute__((always_inline)) __attribute__ ((pure)) +inline double __attribute__((always_inline)) __attribute__((pure)) dotxy(mathSSE::Vec4 a, mathSSE::Vec4 b) { - mathSSE::Vec4 mul = a*b; - mul = hadd(mul,mul); + mathSSE::Vec4 mul = a * b; + mul = hadd(mul, mul); return mul.arr[0]; } - #endif diff --git a/DataFormats/OnlineMetaData/src/DCSRecord.cc b/DataFormats/OnlineMetaData/src/DCSRecord.cc index 7ab7bc585341d..2d112aa28c55d 100644 --- a/DataFormats/OnlineMetaData/src/DCSRecord.cc +++ b/DataFormats/OnlineMetaData/src/DCSRecord.cc @@ -6,7 +6,7 @@ const DCSRecord::ParitionNames DCSRecord::partitionNames_ = { {"EBp", "EBm", "EEp", "EEm", "HBHEa", "HBHEb", "HBHEc", "HF", "HO", "RPC", "DT0", "DTp", "DTm", "CSCp", - "CSCm", "CASTOR", "ZDC", "TIBTID", "TOB", "TECp", "TECm", "BPIX", "FPIX", "ESp", "ESm", "GEMm", "GEMp"}}; + "CSCm", "CASTOR", "ZDC", "TIBTID", "TOB", "TECp", "TECm", "BPIX", "FPIX", "ESp", "ESm", "GEMp", "GEMm"}}; DCSRecord::DCSRecord() : timestamp_(edm::Timestamp::invalidTimestamp()), magnetCurrent_(-1) {} diff --git a/DataFormats/ParticleFlowCandidate/interface/PFCandidate.h b/DataFormats/ParticleFlowCandidate/interface/PFCandidate.h index 31d43fa4c9087..9ca9bce8832c5 100644 --- a/DataFormats/ParticleFlowCandidate/interface/PFCandidate.h +++ b/DataFormats/ParticleFlowCandidate/interface/PFCandidate.h @@ -343,6 +343,31 @@ namespace reco { /// set mva for neutral hadron - gamma discrimination void set_mva_gamma_nh(float mva) { mva_gamma_nh_ = mva; } + // set DNN for electron PFID + // mva for ele PFID DNN sigIsolated class + float dnn_e_sigIsolated() const { return dnn_e_sigIsolated_; } + void set_dnn_e_sigIsolated(float mva) { dnn_e_sigIsolated_ = mva; } + + // mva for ele PFID DNN sigNonIsolated class + float dnn_e_sigNonIsolated() const { return dnn_e_sigNonIsolated_; } + void set_dnn_e_sigNonIsolated(float mva) { dnn_e_sigNonIsolated_ = mva; } + + // mva for ele PFID DNN bkgNonIsolated class + float dnn_e_bkgNonIsolated() const { return dnn_e_bkgNonIsolated_; } + void set_dnn_e_bkgNonIsolated(float mva) { dnn_e_bkgNonIsolated_ = mva; } + + // mva for ele PFID DNN bkgTau class + float dnn_e_bkgTau() const { return dnn_e_bkgTau_; } + void set_dnn_e_bkgTau(float mva) { dnn_e_bkgTau_ = mva; } + + // mva for ele PFID DNN bkgPhoton class + float dnn_e_bkgPhoton() const { return dnn_e_bkgPhoton_; } + void set_dnn_e_bkgPhoton(float mva) { dnn_e_bkgPhoton_ = mva; } + + // set DNN for gamma PFID + float dnn_gamma() const { return dnn_gamma_; } + void set_dnn_gamma(float mva) { dnn_gamma_ = mva; } + /// mva for neutral hadron - gamma discrimination float mva_gamma_nh() const { return mva_gamma_nh_; } @@ -383,7 +408,7 @@ namespace reco { const ElementsInBlocks& elementsInBlocks() const; - static const float bigMva_; + static constexpr float bigMva_ = -999.; friend std::ostream& operator<<(std::ostream& out, const PFCandidate& c); @@ -492,6 +517,24 @@ namespace reco { /// mva for neutral hadron - gamma discrimination float mva_gamma_nh_; + /// DNN for electron PFid: isolated signal + float dnn_e_sigIsolated_; + + /// DNN for electron PFid: non-isolated signal + float dnn_e_sigNonIsolated_; + + /// DNN for electron PFid: non-isolated bkg + float dnn_e_bkgNonIsolated_; + + /// DNN for electron PFid: tau bkg + float dnn_e_bkgTau_; + + /// DNN for electron PFid: photon bkg + float dnn_e_bkgPhoton_; + + // DNN for gamma PFid + float dnn_gamma_; + /// position at ECAL entrance, from the PFRecTrack math::XYZPointF positionAtECALEntrance_; diff --git a/DataFormats/ParticleFlowCandidate/src/PFCandidate.cc b/DataFormats/ParticleFlowCandidate/src/PFCandidate.cc index c178c042e604b..632579a364f6d 100644 --- a/DataFormats/ParticleFlowCandidate/src/PFCandidate.cc +++ b/DataFormats/ParticleFlowCandidate/src/PFCandidate.cc @@ -18,8 +18,6 @@ using namespace reco; using namespace std; -const float PFCandidate::bigMva_ = -999.; - #include "DataFormats/ParticleFlowCandidate/src/CountBits.h" PFCandidate::PFCandidate() @@ -35,13 +33,18 @@ PFCandidate::PFCandidate() flags_(0), deltaP_(0.), vertexType_(kCandVertex), - mva_Isolated_(bigMva_), - mva_e_pi_(bigMva_), - mva_e_mu_(bigMva_), - mva_pi_mu_(bigMva_), - mva_nothing_gamma_(bigMva_), - mva_nothing_nh_(bigMva_), - mva_gamma_nh_(bigMva_), + mva_Isolated_(PFCandidate::bigMva_), + mva_e_pi_(PFCandidate::bigMva_), + mva_e_mu_(PFCandidate::bigMva_), + mva_pi_mu_(PFCandidate::bigMva_), + mva_nothing_gamma_(PFCandidate::bigMva_), + mva_nothing_nh_(PFCandidate::bigMva_), + mva_gamma_nh_(PFCandidate::bigMva_), + dnn_e_sigIsolated_(PFCandidate::bigMva_), + dnn_e_sigNonIsolated_(PFCandidate::bigMva_), + dnn_e_bkgNonIsolated_(PFCandidate::bigMva_), + dnn_e_bkgTau_(PFCandidate::bigMva_), + dnn_e_bkgPhoton_(PFCandidate::bigMva_), getter_(nullptr), storedRefsBitPattern_(0), time_(0.f), @@ -74,13 +77,18 @@ PFCandidate::PFCandidate(Charge charge, const LorentzVector& p4, ParticleType pa flags_(0), deltaP_(0.), vertexType_(kCandVertex), - mva_Isolated_(bigMva_), - mva_e_pi_(bigMva_), - mva_e_mu_(bigMva_), - mva_pi_mu_(bigMva_), - mva_nothing_gamma_(bigMva_), - mva_nothing_nh_(bigMva_), - mva_gamma_nh_(bigMva_), + mva_Isolated_(PFCandidate::bigMva_), + mva_e_pi_(PFCandidate::bigMva_), + mva_e_mu_(PFCandidate::bigMva_), + mva_pi_mu_(PFCandidate::bigMva_), + mva_nothing_gamma_(PFCandidate::bigMva_), + mva_nothing_nh_(PFCandidate::bigMva_), + mva_gamma_nh_(PFCandidate::bigMva_), + dnn_e_sigIsolated_(PFCandidate::bigMva_), + dnn_e_sigNonIsolated_(PFCandidate::bigMva_), + dnn_e_bkgNonIsolated_(PFCandidate::bigMva_), + dnn_e_bkgTau_(PFCandidate::bigMva_), + dnn_e_bkgPhoton_(PFCandidate::bigMva_), getter_(nullptr), storedRefsBitPattern_(0), time_(0.f), @@ -137,6 +145,11 @@ PFCandidate::PFCandidate(PFCandidate const& iOther) mva_nothing_gamma_(iOther.mva_nothing_gamma_), mva_nothing_nh_(iOther.mva_nothing_nh_), mva_gamma_nh_(iOther.mva_gamma_nh_), + dnn_e_sigIsolated_(iOther.dnn_e_sigIsolated_), + dnn_e_sigNonIsolated_(iOther.dnn_e_sigNonIsolated_), + dnn_e_bkgNonIsolated_(iOther.dnn_e_bkgNonIsolated_), + dnn_e_bkgTau_(iOther.dnn_e_bkgTau_), + dnn_e_bkgPhoton_(iOther.dnn_e_bkgPhoton_), positionAtECALEntrance_(iOther.positionAtECALEntrance_), getter_(iOther.getter_), storedRefsBitPattern_(iOther.storedRefsBitPattern_), @@ -181,6 +194,11 @@ PFCandidate& PFCandidate::operator=(PFCandidate const& iOther) { mva_nothing_gamma_ = iOther.mva_nothing_gamma_; mva_nothing_nh_ = iOther.mva_nothing_nh_; mva_gamma_nh_ = iOther.mva_gamma_nh_; + dnn_e_sigIsolated_ = iOther.dnn_e_sigIsolated_; + dnn_e_sigNonIsolated_ = iOther.dnn_e_sigNonIsolated_; + dnn_e_bkgNonIsolated_ = iOther.dnn_e_bkgNonIsolated_; + dnn_e_bkgTau_ = iOther.dnn_e_bkgTau_; + dnn_e_bkgPhoton_ = iOther.dnn_e_bkgPhoton_; positionAtECALEntrance_ = iOther.positionAtECALEntrance_; getter_ = iOther.getter_; storedRefsBitPattern_ = iOther.storedRefsBitPattern_; diff --git a/DataFormats/ParticleFlowCandidate/src/classes_def.xml b/DataFormats/ParticleFlowCandidate/src/classes_def.xml index eca906716f5bc..17fa11e0ed1ee 100644 --- a/DataFormats/ParticleFlowCandidate/src/classes_def.xml +++ b/DataFormats/ParticleFlowCandidate/src/classes_def.xml @@ -1,6 +1,7 @@ - + + @@ -52,7 +53,8 @@ - + + @@ -67,7 +69,8 @@ - + + diff --git a/DataFormats/ParticleFlowReco/interface/PFBlockElementFwd.h b/DataFormats/ParticleFlowReco/interface/PFBlockElementFwd.h deleted file mode 100644 index 1ec4e68460ee2..0000000000000 --- a/DataFormats/ParticleFlowReco/interface/PFBlockElementFwd.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef DataFormats_ParticleFlowReco_PFBlockElementFwd_h -#define DataFormats_ParticleFlowReco_PFBlockElementFwd_h - -/* #include */ - -/* #include "DataFormats/Common/interface/RefProd.h" */ -/* #include "DataFormats/Common/interface/RefVector.h" */ - -namespace reco { - class PFBlockElement; - class PFBlockElementCluster; - class PFBlockElementTrack; -} // namespace reco - -#endif diff --git a/DataFormats/ParticleFlowReco/interface/PFBlockElementSuperClusterFwd.h b/DataFormats/ParticleFlowReco/interface/PFBlockElementSuperClusterFwd.h deleted file mode 100644 index f185ddc2b8f96..0000000000000 --- a/DataFormats/ParticleFlowReco/interface/PFBlockElementSuperClusterFwd.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef PFBlockElementSuperClusterFwd_H -#define PFBlockElementSuperClusterFwd_H -#include -#include "DataFormats/Common/interface/Ref.h" -namespace reco { - class PFBlockElementSuperCluster; - typedef std::vector PFBlockElementSuperClusterCollection; - typedef edm::Ref PFBlockElementSuperClusterRef; -} // namespace reco - -#endif diff --git a/DataFormats/ParticleFlowReco/interface/PFClusterShapeAssociation.h b/DataFormats/ParticleFlowReco/interface/PFClusterShapeAssociation.h deleted file mode 100644 index d6dccf9c9c476..0000000000000 --- a/DataFormats/ParticleFlowReco/interface/PFClusterShapeAssociation.h +++ /dev/null @@ -1,31 +0,0 @@ -#ifndef ParticleFlowReco_PFClusterShapeAssociation_h_ -#define ParticleFlowReco_PFClusterShapeAssociation_h_ -// \class PFClusterShapeAssociation -// -// \association of ClusterShape to PFCluster -// -// -// -#include "DataFormats/EgammaReco/interface/ClusterShapeFwd.h" -#include "DataFormats/ParticleFlowReco/interface/PFClusterFwd.h" -#include "DataFormats/Common/interface/Ref.h" -#include "DataFormats/Common/interface/RefVector.h" -#include "DataFormats/Common/interface/AssociationMap.h" -#include - -namespace reco -{ - typedef - edm::AssociationMap > - PFClusterShapeAssociationCollection; - typedef - PFClusterShapeAssociationCollection::value_type PFClusterShapeAssociation; - typedef - edm::Ref PFClusterShapeAssociationRef; - typedef - edm::RefProd PFClusterShapeAssociationRefProd; - typedef - edm::RefVector PFClusterShapeAssociationRefVector; -} - -#endif diff --git a/DataFormats/ParticleFlowReco/interface/PFParticleFwd.h b/DataFormats/ParticleFlowReco/interface/PFParticleFwd.h deleted file mode 100644 index ae63ca1682f2b..0000000000000 --- a/DataFormats/ParticleFlowReco/interface/PFParticleFwd.h +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef DataFormats_ParticleFlowReco_PFParticleFwd_h -#define DataFormats_ParticleFlowReco_PFParticleFwd_h -#include -#include "DataFormats/Common/interface/Ref.h" -#include "DataFormats/Common/interface/RefVector.h" -#include "DataFormats/Common/interface/RefProd.h" - -namespace reco { - class PFParticle; - - /// collection of PFParticle objects - typedef std::vector PFParticleCollection; - - /// persistent reference to PFParticle objects - typedef edm::Ref PFParticleRef; - - /// reference to PFParticle collection - typedef edm::RefProd PFParticleRefProd; - - /// vector of references to PFParticle objects all in the same collection - typedef edm::RefVector PFParticleRefVector; - - /// iterator over a vector of references to PFParticle objects - typedef PFParticleRefVector::iterator pfParticle_iterator; -} - -#endif diff --git a/DataFormats/ParticleFlowReco/interface/PFSuperClusterFwd.h b/DataFormats/ParticleFlowReco/interface/PFSuperClusterFwd.h deleted file mode 100644 index 4710147743e4e..0000000000000 --- a/DataFormats/ParticleFlowReco/interface/PFSuperClusterFwd.h +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef ParticleFlowReco_PFSuperClusterFwd_h -#define ParticleFlowReco_PFSuperClusterFwd_h -#include -#include "DataFormats/Common/interface/Ref.h" -#include "DataFormats/Common/interface/RefVector.h" -#include "DataFormats/Common/interface/RefProd.h" - -namespace reco { - class PFSuperCluster; - - /// collection of PFSuperCluster objects - typedef std::vector PFSuperClusterCollection; - - /// persistent reference to PFSuperCluster objects - typedef edm::Ref PFSuperClusterRef; - - /// reference to PFSuperCluster collection - typedef edm::RefProd PFSuperClusterRefProd; - - /// vector of references to PFSuperCluster objects all in the same collection - typedef edm::RefVector PFSuperClusterRefVector; - - /// iterator over a vector of references to PFSuperCluster objects - typedef PFSuperClusterRefVector::iterator PFSuperCluster_iterator; -} - -#endif diff --git a/DataFormats/ParticleFlowReco/interface/PFTrajectoryPointFwd.h b/DataFormats/ParticleFlowReco/interface/PFTrajectoryPointFwd.h deleted file mode 100644 index fa2645f21f5df..0000000000000 --- a/DataFormats/ParticleFlowReco/interface/PFTrajectoryPointFwd.h +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef DataFormats_ParticleFlowReco_PFTrajectoryPointFwd_h -#define DataFormats_ParticleFlowReco_PFTrajectoryPointFwd_h -#include -#include "DataFormats/Common/interface/Ref.h" -#include "DataFormats/Common/interface/RefVector.h" -#include "DataFormats/Common/interface/RefProd.h" - -namespace reco { - class PFTrajectoryPoint; - - /// collection of PFTrajectoryPoint objects - typedef std::vector PFTrajectoryPointCollection; - - /// persistent reference to PFTrajectoryPoint objects - typedef edm::Ref PFTrajectoryPointRef; - - /// reference to PFTrajectoryPoint collection - typedef edm::RefProd PFTrajectoryPointRefProd; - - /// vector of references to PFTrajectoryPoint objects all in the same collection - typedef edm::RefVector PFTrajectoryPointRefVector; - - /// iterator over a vector of references to PFTrajectoryPoint objects - typedef PFTrajectoryPointRefVector::iterator trajectoryPoint_iterator; -} - -#endif diff --git a/DataFormats/PatCandidates/src/classes_def_objects.xml b/DataFormats/PatCandidates/src/classes_def_objects.xml index e4a78ebf00e43..2b98aef02aab2 100644 --- a/DataFormats/PatCandidates/src/classes_def_objects.xml +++ b/DataFormats/PatCandidates/src/classes_def_objects.xml @@ -314,7 +314,8 @@ - + + diff --git a/DataFormats/Provenance/interface/BranchDescriptionIndex.h b/DataFormats/Provenance/interface/BranchDescriptionIndex.h deleted file mode 100644 index 23a6da64024b2..0000000000000 --- a/DataFormats/Provenance/interface/BranchDescriptionIndex.h +++ /dev/null @@ -1,31 +0,0 @@ -#ifndef DataFormats_Provenance_BranchDescriptionIndex_h -#define DataFormats_Provenance_BranchDescriptionIndex_h -// -*- C++ -*- -// -// Package: Provenance -// Class : BranchDescriptionIndex -// -/**\class BranchDescriptionIndex BranchDescriptionIndex.h DataFormats/Provenance/interface/BranchDescriptionIndex.h - - Description: Index into BranchDescription vector - - Usage: - Internally used by ProductRegistry and by Principal to quickly find data - -*/ -// -// Original Author: Chris Jones -// Created: Thu Apr 30 15:46:09 CDT 2009 -// - -// system include files - -// user include files - -// forward declarations - -namespace edm { - typedef unsigned int BranchDescriptionIndex; -} - -#endif diff --git a/DataFormats/Provenance/interface/TypeInBranchType.h b/DataFormats/Provenance/interface/TypeInBranchType.h deleted file mode 100644 index 8dd5c6a262e52..0000000000000 --- a/DataFormats/Provenance/interface/TypeInBranchType.h +++ /dev/null @@ -1,62 +0,0 @@ -#ifndef DataFormats_Provenance_TypeInBranchType_h -#define DataFormats_Provenance_TypeInBranchType_h -// -*- C++ -*- -// -// Package: Provenance -// Class : TypeInBranchType -// -/**\class TypeInBranchType TypeInBranchType.h DataFormats/Provenance/interface/TypeInBranchType.h - - Description: Pairs C++ class type and edm::BranchType - - Usage: - Used internally to ProductRegistry and for quickly finding data in Principals - -*/ -// -// Original Author: Chris Jones -// Created: Thu Apr 30 15:50:17 CDT 2009 -// - -// system include files - -// user include files -#include "DataFormats/Provenance/interface/BranchType.h" -#include "FWCore/Utilities/interface/TypeID.h" - -// forward declarations - -namespace edm { - class TypeInBranchType { - - public: - TypeInBranchType(TypeID const& iID, - BranchType const& iBranch) : - id_(iID), - branch_(iBranch) {} - - TypeID const& typeID() const { - return id_; - } - - BranchType const& branchType() const { - return branch_; - } - - bool operator<(TypeInBranchType const& iRHS) const { - if(branch_ < iRHS.branch_) { - return true; - } - if(iRHS.branch_ < branch_) { - return false; - } - return id_ < iRHS.id_; - } - private: - TypeID id_; - BranchType branch_; - }; - -} - -#endif diff --git a/DataFormats/RPCDigi/interface/RPCDigiL1Linkfwd.h b/DataFormats/RPCDigi/interface/RPCDigiL1Linkfwd.h deleted file mode 100644 index 429c7ab205921..0000000000000 --- a/DataFormats/RPCDigi/interface/RPCDigiL1Linkfwd.h +++ /dev/null @@ -1,4 +0,0 @@ -#ifndef RPCOBJECTS_RPCDIGIL1LINKFWD_H -#define RPCOBJECTS_RPCDIGIL1LINKFWD_H -class RPCDigiL1Link; -#endif // RPCOBJECTS_RPCDIGIL1LINKFWD_H diff --git a/DataFormats/SiPixelDetId/README.md b/DataFormats/SiPixelDetId/README.md index a7e70e623ceab..974688cfaacef 100644 --- a/DataFormats/SiPixelDetId/README.md +++ b/DataFormats/SiPixelDetId/README.md @@ -1,11 +1,18 @@ -2016.05.11 ATricomi+EMigliore (INFN) changes in PixelChannelIdentifier.cc -Change PixelChannelIdentifier::thePacking() to have indexes spanning the full module in case of small pixels (phase II InnerPixel) +Changes - timeline +##### 2016.05.11 ATricomi+EMigliore (INFN) changes in PixelChannelIdentifier.cc +- Change PixelChannelIdentifier::thePacking() to have indexes spanning the full module in case of small pixels (phase II InnerPixel) -PixelChannelIdentifier::thePacking( 11, 11, 0, 10); // It was row=8,col=9, time=4, adc=11 +##### 2021.08.16. Reserve one bit for the flag in pixel digi packing - see PRs #34509 and #34662 +- Change packing from (11, **11**, **0**, 10) -> (11, **10**, **1**, 10), reducing row x column to 2048x1024; and time -> flag -Reserved bits -row = 11 -> 2^11-1 = 2047 -col = 11 -> 2^11-1 = 2047 -time = 0 (not used) -adc = 10 -> 2^10-1 = 1023 +--- +#### PixelChannelIdentifier::thePacking( 11, 10, 1, 10); // row, column, flag, adc +// Before phase II changes, it was row=8,col=9, time=4, adc=11 +// Before introducing the flag, it was row=11, col=11, time=0, adc=10 + +#### Reserved bits: +- row = 11 -> 2^11-1 = 2047 +- col = 10 -> 2^10-1 = 1023 +- flag = 1 -> 0/1 +- adc = 10 -> 2^10-1 = 1023 diff --git a/DataFormats/SiPixelDetId/interface/PixelChannelIdentifier.h b/DataFormats/SiPixelDetId/interface/PixelChannelIdentifier.h index 9c79103ec17d0..3f909412910ec 100644 --- a/DataFormats/SiPixelDetId/interface/PixelChannelIdentifier.h +++ b/DataFormats/SiPixelDetId/interface/PixelChannelIdentifier.h @@ -1,16 +1,17 @@ -#ifndef DATAFORMATS_PIXELCHANMNELIDENTIFIER_H -#define DATAFORMATS_PIXELCHANMNELIDENTIFIER_H +#ifndef DataFormats_SiPixelDetId_interface_PixelChannelIdentifier_h +#define DataFormats_SiPixelDetId_interface_PixelChannelIdentifier_h #include +#include -namespace pixelchanelidentifierimpl { +namespace pixelchannelidentifierimpl { /** * Pack the pixel information to use less memory */ class Packing { public: - using PackedDigiType = unsigned int; + using PackedDigiType = uint32_t; // Constructor: pre-computes masks and shifts from field widths constexpr Packing(unsigned int row_w, unsigned int column_w, unsigned int flag_w, unsigned int adc_w) @@ -30,14 +31,14 @@ namespace pixelchanelidentifierimpl { max_column(column_mask), max_adc(adc_mask) {} - const int row_width; - const int column_width; - const int adc_width; + const uint32_t row_width; + const uint32_t column_width; + const uint32_t adc_width; - const int row_shift; - const int column_shift; - const int flag_shift; - const int adc_shift; + const uint32_t row_shift; + const uint32_t column_shift; + const uint32_t flag_shift; + const uint32_t adc_shift; const PackedDigiType row_mask; const PackedDigiType column_mask; @@ -49,7 +50,7 @@ namespace pixelchanelidentifierimpl { const int max_column; const int max_adc; }; -} // namespace pixelchanelidentifierimpl +} // namespace pixelchannelidentifierimpl class PixelChannelIdentifier { public: @@ -64,7 +65,7 @@ class PixelChannelIdentifier { static int pixelToChannel(int row, int col) { return (row << thePacking.column_width) | col; } - using Packing = pixelchanelidentifierimpl::Packing; + using Packing = pixelchannelidentifierimpl::Packing; public: constexpr static Packing packing() { return Packing(8, 9, 4, 11); } @@ -72,4 +73,4 @@ class PixelChannelIdentifier { constexpr static Packing thePacking = {11, 10, 1, 10}; }; -#endif +#endif // DataFormats_SiPixelDetId_interface_PixelChannelIdentifier_h diff --git a/DataFormats/SiPixelDigi/interface/PixelDigiCollectionfwd.h b/DataFormats/SiPixelDigi/interface/PixelDigiCollectionfwd.h deleted file mode 100644 index 9e5062017f007..0000000000000 --- a/DataFormats/SiPixelDigi/interface/PixelDigiCollectionfwd.h +++ /dev/null @@ -1,4 +0,0 @@ -#ifndef TRACKINGOBJECTS_PIXELDIGICOLLECTIONFWD_H -#define TRACKINGOBJECTS_PIXELDIGICOLLECTIONFWD_H -class PixelDigiCollection; -#endif // TRACKINGOBJECTS_PIXELDIGICOLLECTIONFWD_H diff --git a/DataFormats/SiStripCommon/interface/ConstantsForSummaryPlots.h b/DataFormats/SiStripCommon/interface/ConstantsForSummaryPlots.h deleted file mode 100644 index 7a0bd46627698..0000000000000 --- a/DataFormats/SiStripCommon/interface/ConstantsForSummaryPlots.h +++ /dev/null @@ -1,10 +0,0 @@ - -#ifndef DataFormats_SiStripCommon_ConstantsForSummaryPlots_H -#define DataFormats_SiStripCommon_ConstantsForSummaryPlots_H - -#include "DataFormats/SiStripCommon/interface/ConstantsForMonitorable.h" -#include "DataFormats/SiStripCommon/interface/ConstantsForPresentation.h" - -#endif // DataFormats_SiStripCommon_ConstantsForSummaryPlots_H - - diff --git a/DataFormats/SiStripDigi/interface/SiStripDigifwd.h b/DataFormats/SiStripDigi/interface/SiStripDigifwd.h deleted file mode 100644 index 5287a400d6d3b..0000000000000 --- a/DataFormats/SiStripDigi/interface/SiStripDigifwd.h +++ /dev/null @@ -1,4 +0,0 @@ -#ifndef TRACKINGOBJECTS_SISTRIPDIGIFWD_H -#define TRACKINGOBJECTS_SISTRIPDIGIFWD_H -class SiStripDigi; -#endif // TRACKINGOBJECTS_SISTRIPDIGIFWD_H diff --git a/DataFormats/TrackReco/interface/HitPattern.h b/DataFormats/TrackReco/interface/HitPattern.h index 6b5b8d1e1506e..cb36daa3d16de 100644 --- a/DataFormats/TrackReco/interface/HitPattern.h +++ b/DataFormats/TrackReco/interface/HitPattern.h @@ -33,7 +33,7 @@ // | mu = 0 | DT = 1 | 4*(stat-1)+superlayer | | hit type = 0-3 | // | mu = 0 | CSC = 2 | 4*(stat-1)+(ring-1) | | hit type = 0-3 | // | mu = 0 | RPC = 3 | 4*(stat-1)+2*layer+region | | hit type = 0-3 | -// | mu = 0 | GEM = 4 | 2*(stat-1)+2*(layer-1) | | hit type = 0-3 | +// | mu = 0 | GEM = 4 | 1xxx=st0, 0yxx=st y-1 la x| | hit type = 0-3 | // | mu = 0 | ME0 = 5 | roll | | hit type = 0-3 | // | mtd = 2 | BTL = 1 | moduleType = 1-3 | | hit type = 0-3 | // | mtd = 2 | ETL = 2 | ring = 1-12 | | hit type = 0-3 | @@ -214,7 +214,7 @@ namespace reco { /// GEM station: 1,2. Only valid for muon GEM patterns, of course. static uint16_t getGEMStation(uint16_t pattern); - /// GEM layer: 1,2. Only valid for muon GEM patterns, of course. + /// GEM layer: 1-6 for station 0, 1-2 for stations 1 and 2. Only valid for muon GEM patterns, of course. static uint16_t getGEMLayer(uint16_t pattern); /// BTL Module type: 1,2,3. Only valid for BTL patterns of course. @@ -746,7 +746,9 @@ namespace reco { return ((pattern >> HitTypeOffset) & HitTypeMask); } - inline uint16_t HitPattern::getMuonStation(uint16_t pattern) { return (getSubSubStructure(pattern) >> 2) + 1; } + inline uint16_t HitPattern::getMuonStation(uint16_t pattern) { + return muonGEMHitFilter(pattern) ? getGEMStation(pattern) : (getSubSubStructure(pattern) >> 2) + 1; + } inline uint16_t HitPattern::getDTSuperLayer(uint16_t pattern) { return (getSubSubStructure(pattern) & 3); } @@ -766,11 +768,11 @@ namespace reco { inline uint16_t HitPattern::getRPCregion(uint16_t pattern) { return getSubSubStructure(pattern) & 1; } ////////////////////////////// GEM - inline uint16_t HitPattern::getGEMStation(uint16_t pattern) - - { - uint16_t sss = getSubSubStructure(pattern), stat = sss >> 1; - return stat + 1; + inline uint16_t HitPattern::getGEMStation(uint16_t pattern) { + uint16_t sss = getSubSubStructure(pattern); + if (sss & 0b1000) + return 0; + return (sss >> 2) + 1; } /// MTD @@ -778,7 +780,12 @@ namespace reco { inline uint16_t HitPattern::getETLRing(uint16_t pattern) { return getSubSubStructure(pattern); } - inline uint16_t HitPattern::getGEMLayer(uint16_t pattern) { return (getSubSubStructure(pattern) & 1) + 1; } + inline uint16_t HitPattern::getGEMLayer(uint16_t pattern) { + uint16_t sss = getSubSubStructure(pattern); + if (sss & 0b1000) + return (sss & 0b0111) + 1; + return (sss & 0b11) + 1; + } inline bool HitPattern::validHitFilter(uint16_t pattern) { return getHitType(pattern) == HitPattern::VALID; } diff --git a/DataFormats/TrackReco/src/HitPattern.cc b/DataFormats/TrackReco/src/HitPattern.cc index 8f13a068125e0..18a5d33bfc5d2 100644 --- a/DataFormats/TrackReco/src/HitPattern.cc +++ b/DataFormats/TrackReco/src/HitPattern.cc @@ -99,8 +99,17 @@ namespace { } break; case MuonSubdetId::GEM: { GEMDetId gemid(id.rawId()); - layer = ((gemid.station() - 1) << 2); - layer |= abs(gemid.layer() - 1); + { + uint16_t st = gemid.station(); + uint16_t la = gemid.layer(); + if (st == 0) { + layer |= 0b1000; + layer |= (la - 1); + } else { + layer |= (st - 1) << 2; + layer |= (la - 1); + } + } } break; case MuonSubdetId::ME0: { ME0DetId me0id(id.rawId()); @@ -818,7 +827,8 @@ void HitPattern::printHitPattern(HitCategory category, int position, std::ostrea } else if (muonRPCHitFilter(pattern)) { stream << "\trpc " << (getRPCregion(pattern) ? "endcaps" : "barrel") << ", layer " << getRPCLayer(pattern); } else if (muonGEMHitFilter(pattern)) { - stream << "\tgem " << (getGEMLayer(pattern) ? "layer1" : "layer2") << ", station " << getGEMStation(pattern); + stream << "\tgem " + << " station " << getGEMStation(pattern) << ", layer" << getGEMLayer(pattern); } else if (muonME0HitFilter(pattern)) { stream << "\tme0 "; } else { @@ -872,16 +882,16 @@ uint16_t HitPattern::isStereo(DetId i, const TrackerTopology& ttopo) { } int HitPattern::muonStations(int subdet, int hitType) const { - int stations[4] = {0, 0, 0, 0}; + int stations[5] = {0, 0, 0, 0, 0}; for (int i = beginTrackHits; i < endTrackHits; ++i) { uint16_t pattern = getHitPatternByAbsoluteIndex(i); if (muonHitFilter(pattern) && (subdet == 0 || int(getSubStructure(pattern)) == subdet) && (hitType == -1 || int(getHitType(pattern)) == hitType)) { - stations[getMuonStation(pattern) - 1] = 1; + stations[getMuonStation(pattern)] = 1; } } - return stations[0] + stations[1] + stations[2] + stations[3]; + return stations[0] + stations[1] + stations[2] + stations[3] + stations[4]; } int HitPattern::innermostMuonStationWithHits(int hitType) const { diff --git a/DataFormats/TrackerRecHit2D/interface/SiPixelRecHitfwd.h b/DataFormats/TrackerRecHit2D/interface/SiPixelRecHitfwd.h deleted file mode 100644 index 1e5b57c035863..0000000000000 --- a/DataFormats/TrackerRecHit2D/interface/SiPixelRecHitfwd.h +++ /dev/null @@ -1,4 +0,0 @@ -#ifndef DataFormats_SiPixelRecHitFWD_H -#define DataFormats_SiPixelRecHitFWD_H -class SiPixelRecHit; -#endif // diff --git a/DataFormats/TrajectorySeed/interface/BasicTrajectorySeed.h b/DataFormats/TrajectorySeed/interface/BasicTrajectorySeed.h deleted file mode 100644 index 12c0a9bf9db97..0000000000000 --- a/DataFormats/TrajectorySeed/interface/BasicTrajectorySeed.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef DATAFORMATS_TRAJECTORYSEED_BASICTRAJECTORYSEED_h -#define DATAFORMATS_TRAJECTORYSEED_BASICTRAJECTORYSEED_h - - -#include "DataFormats/TrajectorySeed/interface/TrajectorySeed.h" -typedef TrajectorySeed BasicTrajectorySeed; - - -#endif diff --git a/DetectorDescription/DDCMS/plugins/DDCMSDetector.cc b/DetectorDescription/DDCMS/plugins/DDCMSDetector.cc index 16bb608420a70..1cf405f1db39c 100644 --- a/DetectorDescription/DDCMS/plugins/DDCMSDetector.cc +++ b/DetectorDescription/DDCMS/plugins/DDCMSDetector.cc @@ -29,13 +29,17 @@ class DDCMSDetector : public one::EDAnalyzer<> { private: const ESInputTag m_tag; + const ESGetToken m_detectorToken; + const ESGetToken m_registryToken; }; -DDCMSDetector::DDCMSDetector(const ParameterSet& iConfig) : m_tag(iConfig.getParameter("DDDetector")) {} +DDCMSDetector::DDCMSDetector(const ParameterSet& iConfig) + : m_tag(iConfig.getParameter("DDDetector")), + m_detectorToken(esConsumes(m_tag)), + m_registryToken(esConsumes(m_tag)) {} void DDCMSDetector::analyze(const Event&, const EventSetup& iEventSetup) { - ESTransientHandle det; - iEventSetup.get().get(m_tag, det); + ESTransientHandle det = iEventSetup.getTransientHandle(m_detectorToken); LogVerbatim("Geometry") << "Iterate over the detectors:\n"; LogVerbatim("Geometry").log([&](auto& log) { @@ -46,8 +50,7 @@ void DDCMSDetector::analyze(const Event&, const EventSetup& iEventSetup) { }); LogVerbatim("Geometry") << "..done!"; - ESTransientHandle registry; - iEventSetup.get().get(m_tag, registry); + ESTransientHandle registry = iEventSetup.getTransientHandle(m_registryToken); LogVerbatim("Geometry") << "DD Vector Registry size: " << registry->vectors.size(); LogVerbatim("Geometry").log([&](auto& log) { diff --git a/DetectorDescription/DDCMS/plugins/DDDetectorESProducer.cc b/DetectorDescription/DDCMS/plugins/DDDetectorESProducer.cc index 103d46920153f..640e24c1db61d 100644 --- a/DetectorDescription/DDCMS/plugins/DDDetectorESProducer.cc +++ b/DetectorDescription/DDCMS/plugins/DDDetectorESProducer.cc @@ -70,6 +70,9 @@ DDDetectorESProducer::DDDetectorESProducer(const ParameterSet& iConfig) rootDDName_(iConfig.getParameter("rootDDName")), label_(iConfig.getParameter("label")) { usesResources({edm::ESSharedResourceNames::kDD4Hep}); + edm::LogVerbatim("Geometry") << "DDDetectorESProducer::fromDB " << fromDB_ << " appendToDataLabel " + << appendToDataLabel_ << " rootDDName " << rootDDName_ << " label " << label_ + << " confGeomXMLFiles " << confGeomXMLFiles_; if (rootDDName_ == "MagneticFieldVolumes:MAGF" || rootDDName_ == "cmsMagneticField:MAGF") { auto c = setWhatProduced(this, &DDDetectorESProducer::produceMagField, diff --git a/DetectorDescription/DDCMS/plugins/test/DDTestCompactView.cc b/DetectorDescription/DDCMS/plugins/test/DDTestCompactView.cc index f38bd8d123330..2d31029c269f8 100644 --- a/DetectorDescription/DDCMS/plugins/test/DDTestCompactView.cc +++ b/DetectorDescription/DDCMS/plugins/test/DDTestCompactView.cc @@ -14,7 +14,8 @@ using namespace edm; class DDTestCompactView : public one::EDAnalyzer<> { public: - explicit DDTestCompactView(const ParameterSet& iConfig) : m_tag(iConfig.getParameter("DDDetector")) {} + explicit DDTestCompactView(const ParameterSet& iConfig) + : m_tag(iConfig.getParameter("DDDetector")), m_token(esConsumes(m_tag)) {} void beginJob() override {} void analyze(Event const& iEvent, EventSetup const&) override; @@ -22,12 +23,12 @@ class DDTestCompactView : public one::EDAnalyzer<> { private: const ESInputTag m_tag; + const ESGetToken m_token; }; void DDTestCompactView::analyze(const Event&, const EventSetup& iEventSetup) { LogVerbatim("Geometry") << "DDTestCompactView::analyze: " << m_tag; - ESTransientHandle cpv; - iEventSetup.get().get(m_tag, cpv); + ESTransientHandle cpv = iEventSetup.getTransientHandle(m_token); std::cout << "Get trackerParameters:detIdShifts:\n"; auto const& vec = cpv->getVector("detIdShifts"); diff --git a/DetectorDescription/DDCMS/plugins/test/DDTestDumpFile.cc b/DetectorDescription/DDCMS/plugins/test/DDTestDumpFile.cc index 81c2317337470..7be824e03a8e2 100644 --- a/DetectorDescription/DDCMS/plugins/test/DDTestDumpFile.cc +++ b/DetectorDescription/DDCMS/plugins/test/DDTestDumpFile.cc @@ -32,17 +32,18 @@ class DDTestDumpFile : public one::EDAnalyzer<> { const string m_tag; const string m_outputFileName; const ESInputTag m_label; + const ESGetToken m_token; }; DDTestDumpFile::DDTestDumpFile(const ParameterSet& iConfig) : m_tag(iConfig.getUntrackedParameter("tag", "unknown")), m_outputFileName(iConfig.getUntrackedParameter("outputFileName", "cmsDD4HepGeom.root")), - m_label(iConfig.getParameter("DDDetector")) {} + m_label(iConfig.getParameter("DDDetector")), + m_token(esConsumes(m_label)) {} void DDTestDumpFile::analyze(const Event&, const EventSetup& iEventSetup) { LogVerbatim("Geometry") << "DDTestDumpFile::analyze: " << m_label; - ESTransientHandle det; - iEventSetup.get().get(m_label, det); + ESTransientHandle det = iEventSetup.getTransientHandle(m_token); TGeoManager& geom = det->manager(); diff --git a/DetectorDescription/DDCMS/plugins/test/DDTestDumpGeometry.cc b/DetectorDescription/DDCMS/plugins/test/DDTestDumpGeometry.cc index d8b7a8babd2f0..f3ef7a1e9ca53 100644 --- a/DetectorDescription/DDCMS/plugins/test/DDTestDumpGeometry.cc +++ b/DetectorDescription/DDCMS/plugins/test/DDTestDumpGeometry.cc @@ -29,15 +29,15 @@ class DDTestDumpGeometry : public one::EDAnalyzer<> { private: const ESInputTag m_tag; + const ESGetToken m_token; }; DDTestDumpGeometry::DDTestDumpGeometry(const ParameterSet& iConfig) - : m_tag(iConfig.getParameter("DDDetector")) {} + : m_tag(iConfig.getParameter("DDDetector")), m_token(esConsumes(m_tag)) {} void DDTestDumpGeometry::analyze(const Event&, const EventSetup& iEventSetup) { LogVerbatim("Geometry") << "DDTestDumpGeometry::analyze: " << m_tag; - ESTransientHandle det; - iEventSetup.get().get(m_tag, det); + ESTransientHandle det = iEventSetup.getTransientHandle(m_token); TGeoManager const& geom = det->manager(); diff --git a/DetectorDescription/DDCMS/plugins/test/DDTestFilteredView.cc b/DetectorDescription/DDCMS/plugins/test/DDTestFilteredView.cc index b71982d161ea6..6375eb3a4bb20 100644 --- a/DetectorDescription/DDCMS/plugins/test/DDTestFilteredView.cc +++ b/DetectorDescription/DDCMS/plugins/test/DDTestFilteredView.cc @@ -15,7 +15,8 @@ using namespace edm; class DDTestFilteredView : public one::EDAnalyzer<> { public: - explicit DDTestFilteredView(const ParameterSet& iConfig) : m_tag(iConfig.getParameter("DDDetector")) {} + explicit DDTestFilteredView(const ParameterSet& iConfig) + : m_tag(iConfig.getParameter("DDDetector")), m_token(esConsumes(m_tag)) {} void beginJob() override {} void analyze(Event const& iEvent, EventSetup const&) override; @@ -23,12 +24,12 @@ class DDTestFilteredView : public one::EDAnalyzer<> { private: const ESInputTag m_tag; + const ESGetToken m_token; }; void DDTestFilteredView::analyze(const Event&, const EventSetup& iEventSetup) { LogVerbatim("Geometry") << "DDTestFilteredView::analyze: " << m_tag; - ESTransientHandle cpv; - iEventSetup.get().get(m_tag, cpv); + ESTransientHandle cpv = iEventSetup.getTransientHandle(m_token); DDFilteredView fv(cpv->detector(), cpv->detector()->worldVolume()); diff --git a/DetectorDescription/DDCMS/plugins/test/DDTestSpecPars.cc b/DetectorDescription/DDCMS/plugins/test/DDTestSpecPars.cc index 3ed77010eb060..e17dc4c11ada8 100644 --- a/DetectorDescription/DDCMS/plugins/test/DDTestSpecPars.cc +++ b/DetectorDescription/DDCMS/plugins/test/DDTestSpecPars.cc @@ -1,4 +1,4 @@ -#include "FWCore/Framework/interface/one/EDAnalyzer.h" +#include "FWCore/Framework/interface/global/EDAnalyzer.h" #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/Framework/interface/ESTransientHandle.h" #include "FWCore/Framework/interface/EventSetup.h" @@ -12,24 +12,25 @@ using namespace std; using namespace cms; using namespace edm; -class DDTestSpecPars : public one::EDAnalyzer<> { +class DDTestSpecPars : public global::EDAnalyzer<> { public: - explicit DDTestSpecPars(const ParameterSet& iConfig) : m_tag(iConfig.getParameter("DDDetector")) {} + explicit DDTestSpecPars(const ParameterSet& iConfig) + : m_tag(iConfig.getParameter("DDDetector")), m_token(esConsumes(m_tag)) {} void beginJob() override {} - void analyze(Event const& iEvent, EventSetup const&) override; + void analyze(StreamID, Event const& iEvent, EventSetup const&) const override; void endJob() override {} private: const ESInputTag m_tag; + const ESGetToken m_token; }; -void DDTestSpecPars::analyze(const Event&, const EventSetup& iEventSetup) { - LogVerbatim("Geometry") << "DDTestSpecPars::analyze: " << m_tag; - ESTransientHandle registry; - iEventSetup.get().get(m_tag, registry); +void DDTestSpecPars::analyze(StreamID, const Event&, const EventSetup& iEventSetup) const { + ESTransientHandle registry = iEventSetup.getTransientHandle(m_token); - LogVerbatim("Geometry").log([®istry](auto& log) { + LogVerbatim("Geometry").log([®istry, this](auto& log) { + log << "DDTestSpecPars::analyze: " << m_tag; log << "DD SpecPar Registry size: " << registry->specpars.size(); for (const auto& i : registry->specpars) { log << " " << i.first << " =>"; diff --git a/DetectorDescription/DDCMS/plugins/test/DDTestSpecParsFilter.cc b/DetectorDescription/DDCMS/plugins/test/DDTestSpecParsFilter.cc index 503825ff89dd2..6d01b703227b0 100644 --- a/DetectorDescription/DDCMS/plugins/test/DDTestSpecParsFilter.cc +++ b/DetectorDescription/DDCMS/plugins/test/DDTestSpecParsFilter.cc @@ -17,6 +17,7 @@ class DDTestSpecParsFilter : public one::EDAnalyzer<> { public: explicit DDTestSpecParsFilter(const ParameterSet& iConfig) : m_tag(iConfig.getParameter("DDDetector")), + m_token(esConsumes(m_tag)), m_attribute(iConfig.getUntrackedParameter("attribute", "")), m_value(iConfig.getUntrackedParameter("value", "")) {} @@ -26,14 +27,14 @@ class DDTestSpecParsFilter : public one::EDAnalyzer<> { private: const ESInputTag m_tag; + const ESGetToken m_token; const string m_attribute; const string m_value; }; void DDTestSpecParsFilter::analyze(const Event&, const EventSetup& iEventSetup) { LogVerbatim("Geometry") << "DDTestSpecParsFilter::analyze: " << m_tag; - ESTransientHandle registry; - iEventSetup.get().get(m_tag, registry); + ESTransientHandle registry = iEventSetup.getTransientHandle(m_token); LogVerbatim("Geometry") << "DDTestSpecParsFilter::analyze: " << m_tag << " for attribute " << m_attribute << " and value " << m_value; diff --git a/DetectorDescription/DDCMS/plugins/test/DDTestVectors.cc b/DetectorDescription/DDCMS/plugins/test/DDTestVectors.cc index 6dd4830d77619..569bb6c4d8c16 100644 --- a/DetectorDescription/DDCMS/plugins/test/DDTestVectors.cc +++ b/DetectorDescription/DDCMS/plugins/test/DDTestVectors.cc @@ -1,4 +1,4 @@ -#include "FWCore/Framework/interface/one/EDAnalyzer.h" +#include "FWCore/Framework/interface/global/EDAnalyzer.h" #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/Framework/interface/ESTransientHandle.h" #include "FWCore/Framework/interface/EventSetup.h" @@ -12,24 +12,25 @@ using namespace std; using namespace cms; using namespace edm; -class DDTestVectors : public one::EDAnalyzer<> { +class DDTestVectors : public global::EDAnalyzer<> { public: - explicit DDTestVectors(const ParameterSet& iConfig) : m_tag(iConfig.getParameter("DDDetector")) {} + explicit DDTestVectors(const ParameterSet& iConfig) + : m_tag(iConfig.getParameter("DDDetector")), m_token(esConsumes(m_tag)) {} void beginJob() override {} - void analyze(Event const& iEvent, EventSetup const&) override; + void analyze(StreamID, Event const& iEvent, EventSetup const&) const override; void endJob() override {} private: const ESInputTag m_tag; + const ESGetToken m_token; }; -void DDTestVectors::analyze(const Event&, const EventSetup& iEventSetup) { - LogVerbatim("Geometry") << "DDTestVectors::analyze: " << m_tag; - ESTransientHandle registry; - iEventSetup.get().get(m_tag, registry); +void DDTestVectors::analyze(StreamID, const Event&, const EventSetup& iEventSetup) const { + ESTransientHandle registry = iEventSetup.getTransientHandle(m_token); - LogVerbatim("Geometry").log([®istry](auto& log) { + LogVerbatim("Geometry").log([®istry, this](auto& log) { + log << "DDTestVectors::analyze: " << m_tag; log << "DD Vector Registry size: " << registry->vectors.size() << "\n"; for (const auto& p : registry->vectors) { log << " " << p.first << " => "; diff --git a/DetectorDescription/DDCMS/src/DDNamespace.cc b/DetectorDescription/DDCMS/src/DDNamespace.cc index e71aab1b3429c..3a0c65b96145c 100644 --- a/DetectorDescription/DDCMS/src/DDNamespace.cc +++ b/DetectorDescription/DDCMS/src/DDNamespace.cc @@ -3,9 +3,12 @@ #include "DataFormats/Math/interface/Rounding.h" #include "DD4hep/Path.h" #include "DD4hep/Printout.h" +#include "Evaluator/Evaluator.h" #include "XML/XML.h" #include +#include +#include #include #include @@ -14,7 +17,7 @@ using namespace cms; double cms::rotation_utils::roundBinary(double value) { value = cms_rounding::roundIfNear0(value); - static constexpr double roundingVal = 1 << 14; + static constexpr double roundingVal = 1 << 24; value = (round(value * roundingVal) / roundingVal); // Set -0 to 0 return (cms_rounding::roundIfNear0(value)); @@ -24,7 +27,10 @@ std::string cms::rotation_utils::rotHash(const Double_t* rot) { std::string hashVal; for (int row = 0; row <= 2; ++row) { for (int col = 0; col <= 2; ++col) { - hashVal += std::to_string(roundBinary(rot[(3 * row) + col])); + std::ostringstream numStream; + numStream << std::fixed << std::setprecision(7); + numStream << roundBinary(rot[(3 * row) + col]); + hashVal += numStream.str(); } } return (hashVal); @@ -36,7 +42,10 @@ std::string cms::rotation_utils::rotHash(const dd4hep::Rotation3D& rot) { matrix.assign(9, 0.); rot.GetComponents(matrix.begin()); for (double val : matrix) { - hashVal += std::to_string(roundBinary(val)); + std::ostringstream numStream; + numStream << std::fixed << std::setprecision(7); + numStream << roundBinary(val); + hashVal += numStream.str(); } return (hashVal); } @@ -128,6 +137,10 @@ void DDNamespace::addConstant(const string& name, const string& val, const strin addConstantNS(prepend(name), val, type); } +namespace dd4hep { + dd4hep::tools::Evaluator& evaluator(); +} + void DDNamespace::addConstantNS(const string& name, const string& val, const string& type) const { const string& v = val; const string& n = name; @@ -137,7 +150,14 @@ void DDNamespace::addConstantNS(const string& name, const string& val, const str n.c_str(), v.c_str(), type.c_str()); - dd4hep::_toDictionary(n, v, type); + const dd4hep::tools::Evaluator& eval(dd4hep::evaluator()); + bool constExists = eval.findVariable(n); + dd4hep::printout( + m_context->debug_constants ? dd4hep::ALWAYS : dd4hep::DEBUG, "DD4CMS", "findVariable result = %d", constExists); + if (constExists == false) { + // Only add it to the dictionary if it is not yet defined + dd4hep::_toDictionary(n, v, type); + } dd4hep::Constant c(n, v, type); m_context->description.addConstant(c); @@ -152,7 +172,10 @@ void DDNamespace::addRotation(const string& name, const dd4hep::Rotation3D& rot) m_context->rotations[n] = rot; if (m_context->makePayload) { string hashVal = cms::rotation_utils::rotHash(rot); - m_context->rotRevMap[hashVal] = n; + if (m_context->rotRevMap.find(hashVal) == m_context->rotRevMap.end()) { + // Only set a rotation that is not already in the map + m_context->rotRevMap[hashVal] = n; + } } } diff --git a/DetectorDescription/OfflineDBLoader/src/DDCoreToDDXMLOutput.cc b/DetectorDescription/OfflineDBLoader/src/DDCoreToDDXMLOutput.cc index 273d807ef0040..422d6605e4b86 100644 --- a/DetectorDescription/OfflineDBLoader/src/DDCoreToDDXMLOutput.cc +++ b/DetectorDescription/OfflineDBLoader/src/DDCoreToDDXMLOutput.cc @@ -39,6 +39,9 @@ static inline constexpr NumType convertGPerCcToMgPerCc(NumType gPerCc) // g/cm^ return (gPerCc * 1000.); } +static constexpr double tol0 = 1.e-11; // Tiny values to be considered equal to 0 +static constexpr double reflectTol = 1.0e-3; // Tolerance for recognizing reflections; Geant4-compatible + namespace cms::rotation_utils { /* For debugging static double determinant(const dd4hep::Rotation3D &rot) { @@ -51,7 +54,8 @@ namespace cms::rotation_utils { } */ - static const std::string identityHash("1.0000000.0000000.0000000.0000001.0000000.0000000.0000000.0000001.000000"); + static const std::string identityHash( + "1.00000000.00000000.00000000.00000001.00000000.00000000.00000000.00000001.0000000"); static void addRotWithNewName(cms::DDNamespace& ns, std::string& name, const dd4hep::Rotation3D& rot) { const dd4hep::Rotation3D& rot2 = rot; @@ -61,15 +65,15 @@ namespace cms::rotation_utils { static void addRotWithNewName(cms::DDNamespace& ns, std::string& name, const Double_t* rot) { using namespace cms_rounding; - dd4hep::Rotation3D rot2(roundIfNear0(rot[0]), - roundIfNear0(rot[1]), - roundIfNear0(rot[2]), - roundIfNear0(rot[3]), - roundIfNear0(rot[4]), - roundIfNear0(rot[5]), - roundIfNear0(rot[6]), - roundIfNear0(rot[7]), - roundIfNear0(rot[8])); + dd4hep::Rotation3D rot2(roundIfNear0(rot[0], tol0), + roundIfNear0(rot[1], tol0), + roundIfNear0(rot[2], tol0), + roundIfNear0(rot[3], tol0), + roundIfNear0(rot[4], tol0), + roundIfNear0(rot[5], tol0), + roundIfNear0(rot[6], tol0), + roundIfNear0(rot[7], tol0), + roundIfNear0(rot[8], tol0)); addRotWithNewName(ns, name, rot2); } @@ -115,8 +119,12 @@ void DDCoreToDDXMLOutput::solid(const dd4hep::Solid& solid, const cms::DDParsing xos << " y=\"" << trans[1] << "*mm\""; xos << " z=\"" << trans[2] << "*mm\""; xos << "/>" << std::endl; - std::string rotNameStr = cms::rotation_utils::rotName(rs.rightMatrix()->GetRotationMatrix(), context); - xos << "" << std::endl; + auto rot = rs.rightMatrix()->GetRotationMatrix(); + // The identity rotation can be omitted. + if (cms::rotation_utils::rotHash(rot) != cms::rotation_utils::identityHash) { + std::string rotNameStr = cms::rotation_utils::rotName(rot, context); + xos << "" << std::endl; + } if (shape == cms::DDSolidShape::ddunion) { xos << "" << std::endl; } else if (shape == cms::DDSolidShape::ddsubtraction) { @@ -654,19 +662,21 @@ void DDCoreToDDXMLOutput::element(const TGeoMaterial* material, std::ostream& xo } void DDCoreToDDXMLOutput::rotation(const DDRotation& rotation, std::ostream& xos, const std::string& rotn) { - double tol = 1.0e-3; // Geant4 compatible DD3Vector x, y, z; rotation.rotation().GetComponents(x, y, z); double a, b, c; x.GetCoordinates(a, b, c); - x.SetCoordinates(cms_rounding::roundIfNear0(a), cms_rounding::roundIfNear0(b), cms_rounding::roundIfNear0(c)); + x.SetCoordinates( + cms_rounding::roundIfNear0(a, tol0), cms_rounding::roundIfNear0(b, tol0), cms_rounding::roundIfNear0(c, tol0)); y.GetCoordinates(a, b, c); - y.SetCoordinates(cms_rounding::roundIfNear0(a), cms_rounding::roundIfNear0(b), cms_rounding::roundIfNear0(c)); + y.SetCoordinates( + cms_rounding::roundIfNear0(a, tol0), cms_rounding::roundIfNear0(b, tol0), cms_rounding::roundIfNear0(c, tol0)); z.GetCoordinates(a, b, c); - z.SetCoordinates(cms_rounding::roundIfNear0(a), cms_rounding::roundIfNear0(b), cms_rounding::roundIfNear0(c)); + z.SetCoordinates( + cms_rounding::roundIfNear0(a, tol0), cms_rounding::roundIfNear0(b, tol0), cms_rounding::roundIfNear0(c, tol0)); double check = (x.Cross(y)).Dot(z); // in case of a LEFT-handed orthogonal system // this must be -1 - bool reflection((1. - check) > tol); + bool reflection((1. - check) > reflectTol); std::string rotName = rotation.toString(); if (rotName == ":") { if (!rotn.empty()) { @@ -685,31 +695,33 @@ void DDCoreToDDXMLOutput::rotation(const DDRotation& rotation, std::ostream& xos } using namespace cms_rounding; xos << "name=\"" << rotName << "\"" - << " phiX=\"" << roundIfNear0(convertRadToDeg(x.phi()), 4.e-4) << "*deg\"" - << " thetaX=\"" << roundIfNear0(convertRadToDeg(x.theta()), 4.e-4) << "*deg\"" - << " phiY=\"" << roundIfNear0(convertRadToDeg(y.phi()), 4.e-4) << "*deg\"" - << " thetaY=\"" << roundIfNear0(convertRadToDeg(y.theta()), 4.e-4) << "*deg\"" - << " phiZ=\"" << roundIfNear0(convertRadToDeg(z.phi()), 4.e-4) << "*deg\"" - << " thetaZ=\"" << roundIfNear0(convertRadToDeg(z.theta()), 4.e-4) << "*deg\"/>" << std::endl; + << " phiX=\"" << roundIfNear0(convertRadToDeg(x.phi()), tol0) << "*deg\"" + << " thetaX=\"" << roundIfNear0(convertRadToDeg(x.theta()), tol0) << "*deg\"" + << " phiY=\"" << roundIfNear0(convertRadToDeg(y.phi()), tol0) << "*deg\"" + << " thetaY=\"" << roundIfNear0(convertRadToDeg(y.theta()), tol0) << "*deg\"" + << " phiZ=\"" << roundIfNear0(convertRadToDeg(z.phi()), tol0) << "*deg\"" + << " thetaZ=\"" << roundIfNear0(convertRadToDeg(z.theta()), tol0) << "*deg\"/>" << std::endl; } void DDCoreToDDXMLOutput::rotation(const dd4hep::Rotation3D& rotation, std::ostream& xos, const cms::DDParsingContext& context, const std::string& rotn) { - double tol = 1.0e-3; // Geant4 compatible ROOT::Math::XYZVector x, y, z; rotation.GetComponents(x, y, z); double a, b, c; x.GetCoordinates(a, b, c); - x.SetCoordinates(cms_rounding::roundIfNear0(a), cms_rounding::roundIfNear0(b), cms_rounding::roundIfNear0(c)); + x.SetCoordinates( + cms_rounding::roundIfNear0(a, tol0), cms_rounding::roundIfNear0(b, tol0), cms_rounding::roundIfNear0(c, tol0)); y.GetCoordinates(a, b, c); - y.SetCoordinates(cms_rounding::roundIfNear0(a), cms_rounding::roundIfNear0(b), cms_rounding::roundIfNear0(c)); + y.SetCoordinates( + cms_rounding::roundIfNear0(a, tol0), cms_rounding::roundIfNear0(b, tol0), cms_rounding::roundIfNear0(c, tol0)); z.GetCoordinates(a, b, c); - z.SetCoordinates(cms_rounding::roundIfNear0(a), cms_rounding::roundIfNear0(b), cms_rounding::roundIfNear0(c)); + z.SetCoordinates( + cms_rounding::roundIfNear0(a, tol0), cms_rounding::roundIfNear0(b, tol0), cms_rounding::roundIfNear0(c, tol0)); double check = (x.Cross(y)).Dot(z); // in case of a LEFT-handed orthogonal system // this must be -1 - bool reflection((1. - check) > tol); + bool reflection((1. - check) > reflectTol); if (!reflection) { xos << "" << std::endl; + << " phiX=\"" << roundIfNear0(convertRadToDeg(x.phi()), tol0) << "*deg\"" + << " thetaX=\"" << roundIfNear0(convertRadToDeg(x.theta()), tol0) << "*deg\"" + << " phiY=\"" << roundIfNear0(convertRadToDeg(y.phi()), tol0) << "*deg\"" + << " thetaY=\"" << roundIfNear0(convertRadToDeg(y.theta()), tol0) << "*deg\"" + << " phiZ=\"" << roundIfNear0(convertRadToDeg(z.phi()), tol0) << "*deg\"" + << " thetaZ=\"" << roundIfNear0(convertRadToDeg(z.theta()), tol0) << "*deg\"/>" << std::endl; } void DDCoreToDDXMLOutput::logicalPart(const DDLogicalPart& lp, std::ostream& xos) { diff --git a/EgammaAnalysis/ElectronTools/plugins/CalibratedElectronProducersRun2.cc b/EgammaAnalysis/ElectronTools/plugins/CalibratedElectronProducersRun2.cc index cbc00e9a8cdbc..dd9edcaab41df 100644 --- a/EgammaAnalysis/ElectronTools/plugins/CalibratedElectronProducersRun2.cc +++ b/EgammaAnalysis/ElectronTools/plugins/CalibratedElectronProducersRun2.cc @@ -32,11 +32,12 @@ class CalibratedElectronProducerRun2T : public edm::stream::EDProducer<> { private: edm::EDGetTokenT > theElectronToken; std::string theGBRForestName; - edm::ESHandle theGBRForestHandle; EpCombinationTool theEpCombinationTool; ElectronEnergyCalibratorRun2 theEnCorrectorRun2; std::unique_ptr theSemiDeterministicRng; + + edm::ESGetToken gbrforestToken_; }; template @@ -52,6 +53,7 @@ CalibratedElectronProducerRun2T::CalibratedElectronProducerRun2T(const edm::P theSemiDeterministicRng = std::make_unique(); theEnCorrectorRun2.initPrivateRng(theSemiDeterministicRng.get()); } + gbrforestToken_ = esConsumes(edm::ESInputTag("", theGBRForestName)); produces >(); } @@ -60,8 +62,8 @@ CalibratedElectronProducerRun2T::~CalibratedElectronProducerRun2T() {} template void CalibratedElectronProducerRun2T::produce(edm::Event &iEvent, const edm::EventSetup &iSetup) { - iSetup.get().get(theGBRForestName, theGBRForestHandle); - theEpCombinationTool.init(theGBRForestHandle.product()); + const GBRForest *theGBRForest = &iSetup.getData(gbrforestToken_); + theEpCombinationTool.init(theGBRForest); edm::Handle > in; iEvent.getByToken(theElectronToken, in); diff --git a/EgammaAnalysis/ElectronTools/plugins/EGammaCutBasedEleIdAnalyzer.cc b/EgammaAnalysis/ElectronTools/plugins/EGammaCutBasedEleIdAnalyzer.cc index 42a1e6eed1e78..916893465785a 100644 --- a/EgammaAnalysis/ElectronTools/plugins/EGammaCutBasedEleIdAnalyzer.cc +++ b/EgammaAnalysis/ElectronTools/plugins/EGammaCutBasedEleIdAnalyzer.cc @@ -21,7 +21,7 @@ Description: [one line class summary] // user include files #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/Utilities/interface/transform.h" @@ -45,7 +45,7 @@ Description: [one line class summary] // class declaration // -class EGammaCutBasedEleIdAnalyzer : public edm::EDAnalyzer { +class EGammaCutBasedEleIdAnalyzer : public edm::one::EDAnalyzer<> { public: typedef std::vector > > IsoDepositMaps; typedef std::vector > > IsoDepositVals; @@ -61,11 +61,12 @@ class EGammaCutBasedEleIdAnalyzer : public edm::EDAnalyzer { void analyze(const edm::Event &, const edm::EventSetup &) override; void endJob() override; + /* void beginRun(edm::Run const &, edm::EventSetup const &) override; void endRun(edm::Run const &, edm::EventSetup const &) override; void beginLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &) override; void endLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &) override; - + */ // ----------member data --------------------------- // input tags @@ -254,7 +255,7 @@ void EGammaCutBasedEleIdAnalyzer::beginJob() { // ------------ method called once each job just after ending the event loop ------------ void EGammaCutBasedEleIdAnalyzer::endJob() {} - +/* // ------------ method called when starting to processes a run ------------ void EGammaCutBasedEleIdAnalyzer::beginRun(edm::Run const &, edm::EventSetup const &) {} @@ -266,7 +267,7 @@ void EGammaCutBasedEleIdAnalyzer::beginLuminosityBlock(edm::LuminosityBlock cons // ------------ method called when ending the processing of a luminosity block ------------ void EGammaCutBasedEleIdAnalyzer::endLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &) {} - +*/ // ------------ method fills 'descriptions' with the allowed parameters for the module ------------ void EGammaCutBasedEleIdAnalyzer::fillDescriptions(edm::ConfigurationDescriptions &descriptions) { //The following says we do not know what parameters are allowed so do no validation diff --git a/EgammaAnalysis/ElectronTools/plugins/ElectronIdMVAProducer.cc b/EgammaAnalysis/ElectronTools/plugins/ElectronIdMVAProducer.cc index 7bf1f668ca68d..e6988eb8ad46f 100644 --- a/EgammaAnalysis/ElectronTools/plugins/ElectronIdMVAProducer.cc +++ b/EgammaAnalysis/ElectronTools/plugins/ElectronIdMVAProducer.cc @@ -3,7 +3,7 @@ // user include files #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDFilter.h" +#include "FWCore/Framework/interface/stream/EDFilter.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/MakerMacros.h" @@ -21,7 +21,7 @@ // class declaration // -class ElectronIdMVAProducer : public edm::EDFilter { +class ElectronIdMVAProducer : public edm::stream::EDFilter<> { public: explicit ElectronIdMVAProducer(const edm::ParameterSet&); ~ElectronIdMVAProducer() override; @@ -37,6 +37,7 @@ class ElectronIdMVAProducer : public edm::EDFilter { edm::EDGetTokenT reducedEBRecHitCollectionToken_; edm::EDGetTokenT reducedEERecHitCollectionToken_; const EcalClusterLazyTools::ESGetTokens ecalClusterToolsESGetTokens_; + edm::ESGetToken ttrackbuilderToken_; double _Rho; std::string method_; @@ -73,6 +74,8 @@ ElectronIdMVAProducer::ElectronIdMVAProducer(const edm::ParameterSet& iConfig) Trig_ = iConfig.getParameter("Trig"); NoIP_ = iConfig.getParameter("NoIP"); + ttrackbuilderToken_ = esConsumes(edm::ESInputTag("", "TransientTrackBuilder")); + produces >(""); mvaID_ = new EGammaMvaEleEstimator(); @@ -134,10 +137,7 @@ bool ElectronIdMVAProducer::filter(edm::Event& iEvent, const edm::EventSetup& iS ecalClusterToolsESGetTokens_.get(iSetup), reducedEBRecHitCollectionToken_, reducedEERecHitCollectionToken_); - - edm::ESHandle builder; - iSetup.get().get("TransientTrackBuilder", builder); - TransientTrackBuilder thebuilder = *(builder.product()); + auto const& thebuilder = iSetup.getData(ttrackbuilderToken_); edm::Handle egCollection; iEvent.getByToken(electronToken_, egCollection); diff --git a/EgammaAnalysis/ElectronTools/plugins/ElectronIsolatorFromEffectiveArea.cc b/EgammaAnalysis/ElectronTools/plugins/ElectronIsolatorFromEffectiveArea.cc index ffdcd2778848d..d423e05aa207a 100644 --- a/EgammaAnalysis/ElectronTools/plugins/ElectronIsolatorFromEffectiveArea.cc +++ b/EgammaAnalysis/ElectronTools/plugins/ElectronIsolatorFromEffectiveArea.cc @@ -1,5 +1,5 @@ #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDFilter.h" +#include "FWCore/Framework/interface/stream/EDFilter.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" @@ -11,7 +11,7 @@ #include "EgammaAnalysis/ElectronTools/interface/ElectronEffectiveArea.h" -class ElectronIsolatorFromEffectiveArea : public edm::EDFilter { +class ElectronIsolatorFromEffectiveArea : public edm::stream::EDFilter<> { public: typedef edm::ValueMap CandDoubleMap; typedef ElectronEffectiveArea EEA; diff --git a/EgammaAnalysis/ElectronTools/plugins/ElectronPATIdMVAProducer.cc b/EgammaAnalysis/ElectronTools/plugins/ElectronPATIdMVAProducer.cc index 7a26e15098ea8..3305f3c6a306e 100644 --- a/EgammaAnalysis/ElectronTools/plugins/ElectronPATIdMVAProducer.cc +++ b/EgammaAnalysis/ElectronTools/plugins/ElectronPATIdMVAProducer.cc @@ -3,7 +3,7 @@ // user include files #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDProducer.h" +#include "FWCore/Framework/interface/stream/EDProducer.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/MakerMacros.h" @@ -21,7 +21,7 @@ // class declaration // -class ElectronPATIdMVAProducer : public edm::EDProducer { +class ElectronPATIdMVAProducer : public edm::stream::EDProducer<> { public: explicit ElectronPATIdMVAProducer(const edm::ParameterSet&); ~ElectronPATIdMVAProducer() override; diff --git a/EgammaAnalysis/ElectronTools/plugins/ElectronRegressionEnergyProducer.cc b/EgammaAnalysis/ElectronTools/plugins/ElectronRegressionEnergyProducer.cc index 7696c51aef853..dd76bef027fb2 100644 --- a/EgammaAnalysis/ElectronTools/plugins/ElectronRegressionEnergyProducer.cc +++ b/EgammaAnalysis/ElectronTools/plugins/ElectronRegressionEnergyProducer.cc @@ -5,13 +5,13 @@ #include "FWCore/Framework/interface/Frameworkfwd.h" #include "DataFormats/Common/interface/Handle.h" -#include "FWCore/Framework/interface/EDProducer.h" +#include "FWCore/Framework/interface/stream/EDProducer.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/Framework/interface/MakerMacros.h" -#include "FWCore/Framework/interface/EDFilter.h" +#include "FWCore/Framework/interface/stream/EDFilter.h" #include "FWCore/Framework/interface/ESHandle.h" #include "Geometry/Records/interface/CaloTopologyRecord.h" @@ -27,7 +27,7 @@ // class declaration // -class ElectronRegressionEnergyProducer : public edm::EDFilter { +class ElectronRegressionEnergyProducer : public edm::stream::EDFilter<> { public: explicit ElectronRegressionEnergyProducer(const edm::ParameterSet&); ~ElectronRegressionEnergyProducer() override; @@ -57,6 +57,9 @@ class ElectronRegressionEnergyProducer : public edm::EDFilter { edm::EDGetTokenT hVertexToken_; edm::EDGetTokenT hRhoKt6PFJetsToken_; + + edm::ESGetToken ecalTopoToken_; + edm::ESGetToken caloGeomToken_; }; ElectronRegressionEnergyProducer::ElectronRegressionEnergyProducer(const edm::ParameterSet& iConfig) { @@ -75,6 +78,9 @@ ElectronRegressionEnergyProducer::ElectronRegressionEnergyProducer(const edm::Pa hVertexToken_ = consumes(edm::InputTag("offlinePrimaryVertices")); hRhoKt6PFJetsToken_ = consumes(edm::InputTag("kt6PFJets", "rho")); + ecalTopoToken_ = esConsumes(); + caloGeomToken_ = esConsumes(); + produces >(nameEnergyReg_); produces >(nameEnergyErrorReg_); @@ -104,13 +110,8 @@ bool ElectronRegressionEnergyProducer::filter(edm::Event& iEvent, const edm::Eve assert(regressionEvaluator->isInitialized()); if (!geomInitialized_) { - edm::ESHandle theCaloTopology; - iSetup.get().get(theCaloTopology); - ecalTopology_ = &(*theCaloTopology); - - edm::ESHandle theCaloGeometry; - iSetup.get().get(theCaloGeometry); - caloGeometry_ = &(*theCaloGeometry); + ecalTopology_ = &(iSetup.getData(ecalTopoToken_)); + caloGeometry_ = &(iSetup.getData(caloGeomToken_)); geomInitialized_ = true; } diff --git a/EgammaAnalysis/ElectronTools/plugins/GBRForestGetterFromDB.cc b/EgammaAnalysis/ElectronTools/plugins/GBRForestGetterFromDB.cc index 799516f15c328..91c69bbf18c66 100644 --- a/EgammaAnalysis/ElectronTools/plugins/GBRForestGetterFromDB.cc +++ b/EgammaAnalysis/ElectronTools/plugins/GBRForestGetterFromDB.cc @@ -1,16 +1,14 @@ #ifndef CalibratedElectronProducer_h #define CalibratedElectronProducer_h -#include #include - #include "DataFormats/Common/interface/Handle.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/ParameterSet/interface/ParameterSet.h" - +#include "FWCore/MessageLogger/interface/MessageLogger.h" #include "CondFormats/DataRecord/interface/GBRWrapperRcd.h" #include "CondFormats/GBRForest/interface/GBRForest.h" #include @@ -25,23 +23,24 @@ class GBRForestGetterFromDB : public edm::one::EDAnalyzer<> { std::string theGBRForestName; std::string theOutputFileName; std::string theOutputObjectName; - edm::ESHandle theGBRForestHandle; + edm::ESGetToken theGBRForestToken_; }; GBRForestGetterFromDB::GBRForestGetterFromDB(const edm::ParameterSet &conf) : theGBRForestName(conf.getParameter("grbForestName")), theOutputFileName(conf.getUntrackedParameter("outputFileName")), theOutputObjectName(conf.getUntrackedParameter( - "outputObjectName", theGBRForestName.empty() ? "GBRForest" : theGBRForestName)) {} + "outputObjectName", theGBRForestName.empty() ? "GBRForest" : theGBRForestName)), + theGBRForestToken_(esConsumes()) {} GBRForestGetterFromDB::~GBRForestGetterFromDB() {} void GBRForestGetterFromDB::analyze(const edm::Event &iEvent, const edm::EventSetup &iSetup) { - iSetup.get().get(theGBRForestName, theGBRForestHandle); + auto theGBRForestHandle = iSetup.getHandle(theGBRForestToken_); TFile *fOut = TFile::Open(theOutputFileName.c_str(), "RECREATE"); fOut->WriteObject(theGBRForestHandle.product(), theOutputObjectName.c_str()); fOut->Close(); - std::cout << "Wrote output to " << theOutputFileName << std::endl; + edm::LogPrint("GBRForestGetterFromDB") << "Wrote output to " << theOutputFileName; } #include "FWCore/Framework/interface/MakerMacros.h" diff --git a/EgammaAnalysis/ElectronTools/plugins/PatElectronEAIsoCorrectionProducer.cc b/EgammaAnalysis/ElectronTools/plugins/PatElectronEAIsoCorrectionProducer.cc index 928bdae0d2e59..e4c60c6965b06 100644 --- a/EgammaAnalysis/ElectronTools/plugins/PatElectronEAIsoCorrectionProducer.cc +++ b/EgammaAnalysis/ElectronTools/plugins/PatElectronEAIsoCorrectionProducer.cc @@ -1,4 +1,4 @@ -#include "FWCore/Framework/interface/EDProducer.h" +#include "FWCore/Framework/interface/stream/EDProducer.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" @@ -6,7 +6,7 @@ #include "DataFormats/PatCandidates/interface/Electron.h" #include "DataFormats/Common/interface/ValueMap.h" -class PatElectronEAIsoCorrectionProducer : public edm::EDProducer { +class PatElectronEAIsoCorrectionProducer : public edm::stream::EDProducer<> { public: explicit PatElectronEAIsoCorrectionProducer(const edm::ParameterSet& iConfig); ~PatElectronEAIsoCorrectionProducer() override{}; diff --git a/EgammaAnalysis/ElectronTools/plugins/PhotonIsoProducer.cc b/EgammaAnalysis/ElectronTools/plugins/PhotonIsoProducer.cc index 18bb9ff939be9..e8b2ac31e5eb0 100644 --- a/EgammaAnalysis/ElectronTools/plugins/PhotonIsoProducer.cc +++ b/EgammaAnalysis/ElectronTools/plugins/PhotonIsoProducer.cc @@ -3,11 +3,11 @@ // user include files #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDFilter.h" +#include "FWCore/Framework/interface/stream/EDFilter.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/EgammaCandidates/interface/GsfElectron.h" #include "DataFormats/EgammaCandidates/interface/GsfElectronFwd.h" @@ -22,7 +22,7 @@ // class declaration // -class PhotonIsoProducer : public edm::EDFilter { +class PhotonIsoProducer : public edm::stream::EDFilter<> { public: explicit PhotonIsoProducer(const edm::ParameterSet&); ~PhotonIsoProducer() override; @@ -117,15 +117,14 @@ bool PhotonIsoProducer::filter(edm::Event& iEvent, const edm::EventSetup& iSetup isolator.fGetIsolation(&*aPho, &thePfColl, myVtxRef, vertexCollection); if (verbose_) { - std::cout << " run " << iEvent.id().run() << " lumi " << iEvent.id().luminosityBlock() << " event " - << iEvent.id().event(); - std::cout << " pt " << aPho->pt() << " eta " << aPho->eta() << " phi " << aPho->phi() << " charge " - << aPho->charge() << " : " << std::endl; - ; - - std::cout << " ChargedIso " << isolator.getIsolationCharged() << std::endl; - std::cout << " PhotonIso " << isolator.getIsolationPhoton() << std::endl; - std::cout << " NeutralHadron Iso " << isolator.getIsolationNeutral() << std::endl; + edm::LogPrint("PhotonIsoProducer") << " run " << iEvent.id().run() << " lumi " << iEvent.id().luminosityBlock() + << " event " << iEvent.id().event(); + edm::LogPrint("PhotonIsoProducer") << " pt " << aPho->pt() << " eta " << aPho->eta() << " phi " << aPho->phi() + << " charge " << aPho->charge() << " : "; + + edm::LogPrint("PhotonIsoProducer") << " ChargedIso " << isolator.getIsolationCharged(); + edm::LogPrint("PhotonIsoProducer") << " PhotonIso " << isolator.getIsolationPhoton(); + edm::LogPrint("PhotonIsoProducer") << " NeutralHadron Iso " << isolator.getIsolationNeutral(); } chIsoValues.push_back(isolator.getIsolationCharged()); diff --git a/EgammaAnalysis/ElectronTools/plugins/RegressionEnergyPatElectronProducer.cc b/EgammaAnalysis/ElectronTools/plugins/RegressionEnergyPatElectronProducer.cc index 2d1673c0ca2d5..0059f6e563716 100644 --- a/EgammaAnalysis/ElectronTools/plugins/RegressionEnergyPatElectronProducer.cc +++ b/EgammaAnalysis/ElectronTools/plugins/RegressionEnergyPatElectronProducer.cc @@ -25,6 +25,8 @@ RegressionEnergyPatElectronProducer::RegressionEnergyPatElectronProducer(const e regressionInputFile_ = cfg.getParameter("regressionInputFile"); recHitCollectionEBToken_ = mayConsume(cfg.getParameter("recHitCollectionEB")); recHitCollectionEEToken_ = mayConsume(cfg.getParameter("recHitCollectionEE")); + ecalTopoToken_ = esConsumes(); + caloGeomToken_ = esConsumes(); nameEnergyReg_ = cfg.getParameter("nameEnergyReg"); nameEnergyErrorReg_ = cfg.getParameter("nameEnergyErrorReg"); debug_ = cfg.getUntrackedParameter("debug"); @@ -41,9 +43,9 @@ RegressionEnergyPatElectronProducer::RegressionEnergyPatElectronProducer(const e } if (inputCollectionType_ == 0 && !produceValueMaps_) { - std::cout << " You are running on GsfElectrons and the producer is not configured to produce ValueMaps with the " - "results. In that case, it does not nothing !! " - << std::endl; + edm::LogPrint("RegressionEnergyPatElectronProducer") + << " You are running on GsfElectrons and the producer is not configured to produce ValueMaps with the results. " + "In that case, it does not nothing !! "; } if (inputCollectionType_ == 0) { @@ -52,7 +54,7 @@ RegressionEnergyPatElectronProducer::RegressionEnergyPatElectronProducer(const e produces(); } else { throw cms::Exception("InconsistentParameters") - << " inputCollectionType should be either 0 (GsfElectrons) or 1 (pat::Electrons) " << std::endl; + << " inputCollectionType should be either 0 (GsfElectrons) or 1 (pat::Electrons) "; } //set regression type @@ -79,7 +81,7 @@ RegressionEnergyPatElectronProducer::RegressionEnergyPatElectronProducer(const e geomInitialized_ = false; - std::cout << " Finished initialization " << std::endl; + edm::LogPrint("RegressionEnergyPatElectronProducer") << " Finished initialization "; } RegressionEnergyPatElectronProducer::~RegressionEnergyPatElectronProducer() { delete regressionEvaluator_; } @@ -87,13 +89,8 @@ RegressionEnergyPatElectronProducer::~RegressionEnergyPatElectronProducer() { de void RegressionEnergyPatElectronProducer::produce(edm::Event& event, const edm::EventSetup& setup) { assert(regressionEvaluator_->isInitialized()); if (!geomInitialized_) { - edm::ESHandle theCaloTopology; - setup.get().get(theCaloTopology); - ecalTopology_ = &(*theCaloTopology); - - edm::ESHandle theCaloGeometry; - setup.get().get(theCaloGeometry); - caloGeometry_ = &(*theCaloGeometry); + ecalTopology_ = &setup.getData(ecalTopoToken_); + caloGeometry_ = &setup.getData(caloGeomToken_); geomInitialized_ = true; } @@ -162,10 +159,13 @@ void RegressionEnergyPatElectronProducer::produce(edm::Event& event, const edm:: for (unsigned iele = 0; iele < nElectrons_; ++iele) { const reco::GsfElectron* ele = (inputCollectionType_ == 0) ? &(*gsfCollectionH)[iele] : &(*patCollectionH)[iele]; if (debug_) { - std::cout << "***********************************************************************\n"; - std::cout << "Run Lumi Event: " << event.id().run() << " " << event.luminosityBlock() << " " << event.id().event() - << "\n"; - std::cout << "Pat Electron : " << ele->pt() << " " << ele->eta() << " " << ele->phi() << "\n"; + edm::LogPrint("RegressionEnergyPatElectronProducer") + << "***********************************************************************\n"; + edm::LogPrint("RegressionEnergyPatElectronProducer") + << "Run Lumi Event: " << event.id().run() << " " << event.luminosityBlock() << " " << event.id().event() + << "\n"; + edm::LogPrint("RegressionEnergyPatElectronProducer") + << "Pat Electron : " << ele->pt() << " " << ele->eta() << " " << ele->phi() << "\n"; } pat::Electron* myPatElectron = (inputCollectionType_ == 0) ? nullptr : new pat::Electron((*patCollectionH)[iele]); @@ -516,7 +516,8 @@ void RegressionEnergyPatElectronProducer::produce(edm::Event& event, const edm:: energyValues.push_back(RegressionMomentum); energyErrorValues.push_back(RegressionMomentumError); } else { - std::cout << "Error: RegressionType = " << energyRegressionType_ << " is not supported.\n"; + edm::LogPrint("RegressionEnergyPatElectronProducer") + << "Error: RegressionType = " << energyRegressionType_ << " is not supported.\n"; } if (inputCollectionType_ == 1) { diff --git a/EgammaAnalysis/ElectronTools/plugins/RegressionEnergyPatElectronProducer.h b/EgammaAnalysis/ElectronTools/plugins/RegressionEnergyPatElectronProducer.h index 8617f77530a78..9a5383dea1cad 100644 --- a/EgammaAnalysis/ElectronTools/plugins/RegressionEnergyPatElectronProducer.h +++ b/EgammaAnalysis/ElectronTools/plugins/RegressionEnergyPatElectronProducer.h @@ -2,7 +2,7 @@ #define RegressionEnergyPatElectronProducer_h #include "DataFormats/Common/interface/Handle.h" -#include "FWCore/Framework/interface/EDProducer.h" +#include "FWCore/Framework/interface/stream/EDProducer.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" @@ -10,13 +10,14 @@ #include "Geometry/CaloGeometry/interface/CaloGeometry.h" #include "EgammaAnalysis/ElectronTools/interface/ElectronEnergyRegressionEvaluate.h" -//#include "EGamma/EGammaAnalysisTools/interface/ElectronEnergyRegressionEvaluate.h" #include "DataFormats/PatCandidates/interface/Electron.h" #include "DataFormats/VertexReco/interface/VertexFwd.h" #include "DataFormats/VertexReco/interface/Vertex.h" -class RegressionEnergyPatElectronProducer : public edm::EDProducer { +class CaloTopologyRecord; +class CaloGeometryRecord; +class RegressionEnergyPatElectronProducer : public edm::stream::EDProducer<> { public: explicit RegressionEnergyPatElectronProducer(const edm::ParameterSet &); ~RegressionEnergyPatElectronProducer() override; @@ -31,6 +32,8 @@ class RegressionEnergyPatElectronProducer : public edm::EDProducer { edm::EDGetTokenT recHitCollectionEBToken_; edm::EDGetTokenT recHitCollectionEEToken_; + edm::ESGetToken ecalTopoToken_; + edm::ESGetToken caloGeomToken_; // bool useReducedRecHits_; diff --git a/EventFilter/CSCTFRawToDigi/interface/CSCTFAnalyzer.h b/EventFilter/CSCTFRawToDigi/interface/CSCTFAnalyzer.h deleted file mode 100644 index 8d9917d281f40..0000000000000 --- a/EventFilter/CSCTFRawToDigi/interface/CSCTFAnalyzer.h +++ /dev/null @@ -1,44 +0,0 @@ -#ifndef CSCTFAnalyzer_h -#define CSCTFAnalyzer_h - -#include "FWCore/Framework/interface/ConsumesCollector.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/Utilities/interface/InputTag.h" - -//consumes -#include "DataFormats/CSCDigi/interface/CSCCorrelatedLCTDigiCollection.h" -#include "DataFormats/L1CSCTrackFinder/interface/L1CSCTrackCollection.h" -#include "DataFormats/L1CSCTrackFinder/interface/L1CSCStatusDigiCollection.h" -#include "DataFormats/L1CSCTrackFinder/interface/CSCTriggerContainer.h" -#include "DataFormats/L1CSCTrackFinder/interface/TrackStub.h" - -#include -#include - -class CSCTFAnalyzer : public edm::EDAnalyzer { -private: - edm::InputTag mbProducer, lctProducer, trackProducer, statusProducer; - TTree *tree; - TFile *file; - int dtPhi[12][2]; - - edm::EDGetTokenT L1CSCS_Tok; - edm::EDGetTokenT > CSCTC_Tok; - edm::EDGetTokenT CSCCDC_Tok; - edm::EDGetTokenT L1CST_Tok; - -public: - void analyze(const edm::Event &e, const edm::EventSetup &c) override; - - explicit CSCTFAnalyzer(const edm::ParameterSet &conf); - ~CSCTFAnalyzer(void) override { - file->cd(); - tree->Write(); - file->Close(); - } -}; - -#endif diff --git a/EventFilter/CSCTFRawToDigi/interface/CSCTFPacker.h b/EventFilter/CSCTFRawToDigi/interface/CSCTFPacker.h deleted file mode 100644 index 4164f7fdce1fd..0000000000000 --- a/EventFilter/CSCTFRawToDigi/interface/CSCTFPacker.h +++ /dev/null @@ -1,44 +0,0 @@ -#ifndef CSCTFPacker_h -#define CSCTFPacker_h - -#include "FWCore/Framework/interface/ConsumesCollector.h" - -#include "FWCore/Framework/interface/one/EDProducer.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/Utilities/interface/InputTag.h" - -#include "DataFormats/L1CSCTrackFinder/interface/L1CSCTrackCollection.h" -#include "DataFormats/L1CSCTrackFinder/interface/CSCTriggerContainer.h" -#include "DataFormats/L1CSCTrackFinder/interface/TrackStub.h" - -#include - -class CSCTFPacker : public edm::one::EDProducer<> { -private: - edm::InputTag lctProducer, mbProducer, trackProducer; - - bool zeroSuppression; - unsigned short nTBINs; - unsigned short activeSectors; - bool putBufferToEvent; - - bool swapME1strips; - - FILE* file; - - int m_minBX, m_maxBX, central_lct_bx, central_sp_bx; - - edm::EDGetTokenT CSCCDC_Tok; - edm::EDGetTokenT > CSCTC_Tok; - edm::EDGetTokenT L1CSCTr_Tok; - -public: - void produce(edm::Event& e, const edm::EventSetup& c) override; - - explicit CSCTFPacker(const edm::ParameterSet& conf); - ~CSCTFPacker(void) override; -}; - -#endif diff --git a/EventFilter/CSCTFRawToDigi/interface/CSCTFUnpacker.h b/EventFilter/CSCTFRawToDigi/interface/CSCTFUnpacker.h deleted file mode 100644 index b0470ab41f599..0000000000000 --- a/EventFilter/CSCTFRawToDigi/interface/CSCTFUnpacker.h +++ /dev/null @@ -1,47 +0,0 @@ -#ifndef CSCTFUnpacker_h -#define CSCTFUnpacker_h - -#include "FWCore/Framework/interface/stream/EDProducer.h" -#include "FWCore/Framework/interface/ConsumesCollector.h" -#include -#include - -//CSC Track Finder Raw Data Format -#include "EventFilter/CSCTFRawToDigi/src/CSCTFEvent.h" - -//FEDRawData -#include "DataFormats/FEDRawData/interface/FEDRawData.h" -#include "DataFormats/FEDRawData/interface/FEDNumbering.h" -#include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h" - -#include -#include - -class CSCTriggerMapping; - -class CSCTFUnpacker : public edm::stream::EDProducer<> { -private: - int m_minBX, m_maxBX; - bool swapME1strips; - - CSCTriggerMapping* mapping; // redundant, but needed - - CSCTFEvent tfEvent; // TF data container - - // geometry may not be properly set in CSC TF data - // make an artificial assignment of each of 12 SPs (slots 6-11 and 16-21) to 12 sectors (1-12, 0-not assigned) - std::vector slot2sector; - - // label of the module which produced raw data - edm::InputTag producer; - - edm::EDGetTokenT Raw_token; - -public: - void produce(edm::Event& e, const edm::EventSetup& c) override; - - CSCTFUnpacker(const edm::ParameterSet& pset); - ~CSCTFUnpacker(void) override; -}; - -#endif diff --git a/EventFilter/CSCTFRawToDigi/plugins/CSCTFAnalyzer.cc b/EventFilter/CSCTFRawToDigi/plugins/CSCTFAnalyzer.cc index 80ed4e9042564..e74f6dee3dc3e 100644 --- a/EventFilter/CSCTFRawToDigi/plugins/CSCTFAnalyzer.cc +++ b/EventFilter/CSCTFRawToDigi/plugins/CSCTFAnalyzer.cc @@ -1,4 +1,43 @@ -#include "EventFilter/CSCTFRawToDigi/interface/CSCTFAnalyzer.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" +#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Utilities/interface/InputTag.h" + +//consumes +#include "DataFormats/CSCDigi/interface/CSCCorrelatedLCTDigiCollection.h" +#include "DataFormats/L1CSCTrackFinder/interface/L1CSCTrackCollection.h" +#include "DataFormats/L1CSCTrackFinder/interface/L1CSCStatusDigiCollection.h" +#include "DataFormats/L1CSCTrackFinder/interface/CSCTriggerContainer.h" +#include "DataFormats/L1CSCTrackFinder/interface/TrackStub.h" + +#include +#include + +class CSCTFAnalyzer : public edm::EDAnalyzer { +private: + edm::InputTag mbProducer, lctProducer, trackProducer, statusProducer; + TTree *tree; + TFile *file; + int dtPhi[12][2]; + + edm::EDGetTokenT L1CSCS_Tok; + edm::EDGetTokenT > CSCTC_Tok; + edm::EDGetTokenT CSCCDC_Tok; + edm::EDGetTokenT L1CST_Tok; + +public: + void analyze(const edm::Event &e, const edm::EventSetup &c) override; + + explicit CSCTFAnalyzer(const edm::ParameterSet &conf); + ~CSCTFAnalyzer(void) override { + file->cd(); + tree->Write(); + file->Close(); + } +}; + #include "DataFormats/Common/interface/Handle.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" @@ -7,7 +46,7 @@ #include #include -CSCTFAnalyzer::CSCTFAnalyzer(const edm::ParameterSet& conf) : edm::EDAnalyzer() { +CSCTFAnalyzer::CSCTFAnalyzer(const edm::ParameterSet &conf) : edm::EDAnalyzer() { mbProducer = conf.getUntrackedParameter("mbProducer", edm::InputTag("csctfunpacker")); lctProducer = conf.getUntrackedParameter("lctProducer", edm::InputTag("csctfunpacker")); trackProducer = conf.getUntrackedParameter("trackProducer", edm::InputTag("csctfunpacker")); @@ -46,7 +85,7 @@ CSCTFAnalyzer::CSCTFAnalyzer(const edm::ParameterSet& conf) : edm::EDAnalyzer() L1CST_Tok = consumes(edm::InputTag(trackProducer.label(), trackProducer.instance())); } -void CSCTFAnalyzer::analyze(const edm::Event& e, const edm::EventSetup& c) { +void CSCTFAnalyzer::analyze(const edm::Event &e, const edm::EventSetup &c) { /* edm::Handle rawdata; e.getByToken("source","",rawdata); @@ -192,3 +231,6 @@ void CSCTFAnalyzer::analyze(const edm::Event& e, const edm::EventSetup& c) { edm::LogInfo("CSCTFAnalyzer") << " No valid L1CSCTrackCollection products found"; } } + +#include "FWCore/Framework/interface/MakerMacros.h" +DEFINE_FWK_MODULE(CSCTFAnalyzer); diff --git a/EventFilter/CSCTFRawToDigi/plugins/CSCTFPacker.cc b/EventFilter/CSCTFRawToDigi/plugins/CSCTFPacker.cc index b9ee603bc976a..edc65539eee02 100644 --- a/EventFilter/CSCTFRawToDigi/plugins/CSCTFPacker.cc +++ b/EventFilter/CSCTFRawToDigi/plugins/CSCTFPacker.cc @@ -1,4 +1,43 @@ -#include "EventFilter/CSCTFRawToDigi/interface/CSCTFPacker.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" + +#include "FWCore/Framework/interface/one/EDProducer.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Utilities/interface/InputTag.h" + +#include "DataFormats/L1CSCTrackFinder/interface/L1CSCTrackCollection.h" +#include "DataFormats/L1CSCTrackFinder/interface/CSCTriggerContainer.h" +#include "DataFormats/L1CSCTrackFinder/interface/TrackStub.h" + +#include + +class CSCTFPacker : public edm::one::EDProducer<> { +private: + edm::InputTag lctProducer, mbProducer, trackProducer; + + bool zeroSuppression; + unsigned short nTBINs; + unsigned short activeSectors; + bool putBufferToEvent; + + bool swapME1strips; + + FILE* file; + + int m_minBX, m_maxBX, central_lct_bx, central_sp_bx; + + edm::EDGetTokenT CSCCDC_Tok; + edm::EDGetTokenT > CSCTC_Tok; + edm::EDGetTokenT L1CSCTr_Tok; + +public: + void produce(edm::Event& e, const edm::EventSetup& c) override; + + explicit CSCTFPacker(const edm::ParameterSet& conf); + ~CSCTFPacker(void) override; +}; + #include "EventFilter/CSCTFRawToDigi/src/CSCTFEvent.h" #include @@ -397,3 +436,6 @@ void CSCTFPacker::produce(edm::Event& e, const edm::EventSetup& c) { if (file) fwrite(spDDUrecord, 2, pos - spDDUrecord, file); } + +#include "FWCore/Framework/interface/MakerMacros.h" +DEFINE_FWK_MODULE(CSCTFPacker); diff --git a/EventFilter/CSCTFRawToDigi/plugins/CSCTFUnpacker.cc b/EventFilter/CSCTFRawToDigi/plugins/CSCTFUnpacker.cc index 8ef1ce1e3109c..3d4b1a427643f 100644 --- a/EventFilter/CSCTFRawToDigi/plugins/CSCTFUnpacker.cc +++ b/EventFilter/CSCTFRawToDigi/plugins/CSCTFUnpacker.cc @@ -1,4 +1,45 @@ -#include "EventFilter/CSCTFRawToDigi/interface/CSCTFUnpacker.h" +#include "FWCore/Framework/interface/stream/EDProducer.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" +#include +#include + +//CSC Track Finder Raw Data Format +#include "EventFilter/CSCTFRawToDigi/src/CSCTFEvent.h" + +//FEDRawData +#include "DataFormats/FEDRawData/interface/FEDRawData.h" +#include "DataFormats/FEDRawData/interface/FEDNumbering.h" +#include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h" + +#include +#include + +class CSCTriggerMapping; + +class CSCTFUnpacker : public edm::stream::EDProducer<> { +private: + int m_minBX, m_maxBX; + bool swapME1strips; + + CSCTriggerMapping* mapping; // redundant, but needed + + CSCTFEvent tfEvent; // TF data container + + // geometry may not be properly set in CSC TF data + // make an artificial assignment of each of 12 SPs (slots 6-11 and 16-21) to 12 sectors (1-12, 0-not assigned) + std::vector slot2sector; + + // label of the module which produced raw data + edm::InputTag producer; + + edm::EDGetTokenT Raw_token; + +public: + void produce(edm::Event& e, const edm::EventSetup& c) override; + + CSCTFUnpacker(const edm::ParameterSet& pset); + ~CSCTFUnpacker(void) override; +}; //Framework stuff #include "DataFormats/Common/interface/Handle.h" @@ -330,3 +371,6 @@ void CSCTFUnpacker::produce(edm::Event& e, const edm::EventSetup& c) { e.put(std::move(trackProduct)); e.put(std::move(statusProduct)); } + +#include "FWCore/Framework/interface/MakerMacros.h" +DEFINE_FWK_MODULE(CSCTFUnpacker); diff --git a/EventFilter/CSCTFRawToDigi/plugins/SealModule.cc b/EventFilter/CSCTFRawToDigi/plugins/SealModule.cc deleted file mode 100644 index 1a69f18313757..0000000000000 --- a/EventFilter/CSCTFRawToDigi/plugins/SealModule.cc +++ /dev/null @@ -1,8 +0,0 @@ -#include "FWCore/Framework/interface/MakerMacros.h" -#include -#include -#include - -DEFINE_FWK_MODULE(CSCTFUnpacker); -DEFINE_FWK_MODULE(CSCTFPacker); -DEFINE_FWK_MODULE(CSCTFAnalyzer); diff --git a/EventFilter/CTPPSRawToDigi/interface/CTPPSPixelDataFormatter.h b/EventFilter/CTPPSRawToDigi/interface/CTPPSPixelDataFormatter.h index dcc0a9c2248a2..1f8d0d0b89b2f 100644 --- a/EventFilter/CTPPSRawToDigi/interface/CTPPSPixelDataFormatter.h +++ b/EventFilter/CTPPSRawToDigi/interface/CTPPSPixelDataFormatter.h @@ -71,7 +71,8 @@ class CTPPSPixelDataFormatter { int nWords() const { return m_WordCounter; } - void interpretRawData(bool& errorsInEvent, int fedId, const FEDRawData& data, Collection& digis, Errors& errors); + void interpretRawData( + const bool& isRun3, bool& errorsInEvent, int fedId, const FEDRawData& data, Collection& digis, Errors& errors); int nDigis() const { return m_DigiCounter; } @@ -83,7 +84,8 @@ class CTPPSPixelDataFormatter { short unsigned int fedch; }; - void formatRawData(unsigned int lvl1_ID, + void formatRawData(const bool& isRun3, + unsigned int lvl1_ID, RawData& fedRawData, const Digis& digis, std::vector v_iDdet2fed); @@ -98,8 +100,8 @@ class CTPPSPixelDataFormatter { bool m_IncludeErrors; RPixErrorChecker m_ErrorCheck; - int m_ADC_shift, m_PXID_shift, m_DCOL_shift, m_ROC_shift, m_LINK_shift; - Word32 m_LINK_mask, m_ROC_mask, m_DCOL_mask, m_PXID_mask, m_ADC_mask; + int m_ADC_shift, m_PXID_shift, m_DCOL_shift, m_ROC_shift, m_LINK_shift, m_COL_shift, m_ROW_shift; + Word32 m_LINK_mask, m_ROC_mask, m_DCOL_mask, m_PXID_mask, m_ADC_mask, m_COL_mask, m_ROW_mask; int checkError(const Word32& data) const; diff --git a/EventFilter/CTPPSRawToDigi/interface/CTPPSPixelRawToDigi.h b/EventFilter/CTPPSRawToDigi/interface/CTPPSPixelRawToDigi.h index 12604c610320f..679638680fec1 100644 --- a/EventFilter/CTPPSRawToDigi/interface/CTPPSPixelRawToDigi.h +++ b/EventFilter/CTPPSRawToDigi/interface/CTPPSPixelRawToDigi.h @@ -44,5 +44,6 @@ class CTPPSPixelRawToDigi : public edm::stream::EDProducer<> { std::string mappingLabel_; bool includeErrors_; + bool isRun3_; }; #endif diff --git a/EventFilter/CTPPSRawToDigi/interface/TotemSampicFrame.h b/EventFilter/CTPPSRawToDigi/interface/TotemSampicFrame.h index 31bfbf38071f0..0f9ada845a071 100644 --- a/EventFilter/CTPPSRawToDigi/interface/TotemSampicFrame.h +++ b/EventFilter/CTPPSRawToDigi/interface/TotemSampicFrame.h @@ -27,21 +27,31 @@ enum TotemSampicConstant { controlBits3_Position = 4, controlBits4_Position = 5, controlBits5_Position = 6, - fpgaTime_Position = 7, // fpgaTime_Size = 5, - timestampA_Position = 12, // timestampA_Size = 2, - timestampB_Position = 14, // timestampB_Size = 2, - cellInfo_Position = 16, // cellInfo_Size = 2, + fpgaTime_Position = 7, // fpgaTime_Size = 5, + timestampA_Position = 12, // timestampA_Size = 2, + fpgaTime_Size = timestampA_Position - fpgaTime_Position, + timestampB_Position = 14, // timestampB_Size = 2, + timestampA_Size = timestampB_Position - timestampA_Position, + cellInfo_Position = 16, // cellInfo_Size = 2, + timestampB_Size = cellInfo_Position - timestampB_Position, planeChannelId_Position = 18, // planeChannelId_Size = 1, - reserved_Position = 19, // reserved_Size = 5, - - boardId_Position = 0, // boardId_Size = 1, - l1ATimestamp_Position = 1, // l1ATimestamp_Size = 5, - bunchNumber_Position = 6, // bunchNumber_Size = 2, - orbitNumber_Position = 8, // orbitNumber_Size = 4, - eventNumber_Position = 12, // eventNumber_Size = 4, - channelMap_Position = 16, // channelMap_Size = 2, - l1ALatency_Position = 18, // l1ALatency_Size = 2, + cellInfo_Size = planeChannelId_Position - cellInfo_Position, + reserved_Position = 19, // reserved_Size = 5, + + boardId_Position = 0, // boardId_Size = 1, + l1ATimestamp_Position = 1, // l1ATimestamp_Size = 5, + bunchNumber_Position = 6, // bunchNumber_Size = 2, + l1ATimestamp_Size = bunchNumber_Position - l1ATimestamp_Position, + orbitNumber_Position = 8, // orbitNumber_Size = 4, + bunchNumber_Size = orbitNumber_Position - bunchNumber_Position, + eventNumber_Position = 12, // eventNumber_Size = 4, + orbitNumber_Size = eventNumber_Position - orbitNumber_Position, + channelMap_Position = 16, // channelMap_Size = 2, + eventNumber_Size = channelMap_Position - eventNumber_Position, + l1ALatency_Position = 18, // l1ALatency_Size = 2, + channelMap_Size = l1ALatency_Position - channelMap_Position, numberOfSamples_Position = 20, // numberOfSamples_Size = 1, + l1ALatency_Size = numberOfSamples_Position - l1ALatency_Position, offsetOfSamples_Position = 21, // offsetOfSamples_Size = 1, fwVersion_Position = 22, // fwVersion_Size = 1, pllInfo_Position = 23, // pllInfo_Size = 1, @@ -122,35 +132,44 @@ class TotemSampicFrame { return tmp; } + template + T extractDataFromBytesLSB(const uint8_t* array, int start, int size) const { + T result = 0; + for (int i = start + size - 1; i >= start; i--) + result = (result << 8) | array[i]; + return result; + } + inline uint64_t getFPGATimestamp() const { uint64_t tmp = 0; - if (status_) { - tmp = *((const uint64_t*)(totemSampicInfoPtr_ + TotemSampicConstant::fpgaTime_Position)) & 0xFFFFFFFFFF; - } + if (status_) + tmp = + extractDataFromBytesLSB(totemSampicInfoPtr_, TotemSampicConstant::fpgaTime_Position, fpgaTime_Size); return tmp; } inline uint16_t getTimestampA() const { uint16_t tmp = 0; - if (status_) { - tmp = *((const uint16_t*)(totemSampicInfoPtr_ + TotemSampicConstant::timestampA_Position)); - } + if (status_) + tmp = extractDataFromBytesLSB( + totemSampicInfoPtr_, TotemSampicConstant::timestampA_Position, timestampA_Size); tmp = 0xFFF - tmp; return grayToBinary(tmp); } inline uint16_t getTimestampB() const { uint16_t tmp = 0; - if (status_) { - tmp = *((const uint16_t*)(totemSampicInfoPtr_ + TotemSampicConstant::timestampB_Position)); - } + if (status_) + tmp = extractDataFromBytesLSB( + totemSampicInfoPtr_, TotemSampicConstant::timestampB_Position, timestampB_Size); return grayToBinary(tmp); } inline uint16_t getCellInfo() const { uint16_t tmp = 0; if (status_) - tmp = *((const uint16_t*)(totemSampicInfoPtr_ + TotemSampicConstant::cellInfo_Position)); + tmp = + extractDataFromBytesLSB(totemSampicInfoPtr_, TotemSampicConstant::cellInfo_Position, cellInfo_Size); return tmp & TotemSampicConstant::cellInfo_Mask; } @@ -190,44 +209,49 @@ class TotemSampicFrame { inline uint64_t getL1ATimestamp() const { uint64_t tmp = 0; - if (status_) { - tmp = *((const uint64_t*)(totemSampicEventInfoPtr_ + TotemSampicConstant::l1ATimestamp_Position)) & 0xFFFFFFFFFF; - } + if (status_) + tmp = extractDataFromBytesLSB( + totemSampicEventInfoPtr_, TotemSampicConstant::l1ATimestamp_Position, l1ATimestamp_Size); return tmp; } inline uint16_t getBunchNumber() const { uint16_t tmp = 0; if (status_) - tmp = *((const uint16_t*)(totemSampicEventInfoPtr_ + TotemSampicConstant::bunchNumber_Position)); + tmp = extractDataFromBytesLSB( + totemSampicEventInfoPtr_, TotemSampicConstant::bunchNumber_Position, bunchNumber_Size); return tmp; } inline uint32_t getOrbitNumber() const { uint32_t tmp = 0; if (status_) - tmp = *((const uint32_t*)(totemSampicEventInfoPtr_ + TotemSampicConstant::orbitNumber_Position)); + tmp = extractDataFromBytesLSB( + totemSampicEventInfoPtr_, TotemSampicConstant::orbitNumber_Position, orbitNumber_Size); return tmp; } inline uint32_t getEventNumber() const { uint32_t tmp = 0; if (status_) - tmp = *((const uint32_t*)(totemSampicEventInfoPtr_ + TotemSampicConstant::eventNumber_Position)); + tmp = extractDataFromBytesLSB( + totemSampicEventInfoPtr_, TotemSampicConstant::eventNumber_Position, eventNumber_Size); return tmp; } inline uint16_t getChannelMap() const { uint16_t tmp = 0; if (status_) - tmp = *((const uint16_t*)(totemSampicEventInfoPtr_ + TotemSampicConstant::channelMap_Position)); + tmp = extractDataFromBytesLSB( + totemSampicEventInfoPtr_, TotemSampicConstant::channelMap_Position, channelMap_Size); return tmp; } inline uint16_t getL1ALatency() const { uint16_t tmp = 0; if (status_) - tmp = *((const uint16_t*)(totemSampicEventInfoPtr_ + TotemSampicConstant::l1ALatency_Position)); + tmp = extractDataFromBytesLSB( + totemSampicEventInfoPtr_, TotemSampicConstant::l1ALatency_Position, l1ALatency_Size); return tmp; } diff --git a/EventFilter/CTPPSRawToDigi/plugins/CTPPSPixelDigiToRaw.cc b/EventFilter/CTPPSRawToDigi/plugins/CTPPSPixelDigiToRaw.cc index 38461b1de90c4..2f2409c179fa1 100644 --- a/EventFilter/CTPPSRawToDigi/plugins/CTPPSPixelDigiToRaw.cc +++ b/EventFilter/CTPPSRawToDigi/plugins/CTPPSPixelDigiToRaw.cc @@ -82,6 +82,7 @@ class CTPPSPixelDigiToRaw : public edm::stream::EDProducer<> { edm::ESGetToken tCTPPSPixelDAQMapping_; std::vector v_iDdet2fed_; CTPPSPixelFramePosition fPos_; + bool isRun3_; }; // @@ -99,6 +100,7 @@ CTPPSPixelDigiToRaw::CTPPSPixelDigiToRaw(const edm::ParameterSet& iConfig) : eventCounter_(0), allDigiCounter_(0), allWordCounter_(0), + debug_(false), mappingLabel_(iConfig.getParameter("mappingLabel")) { //register your products tCTPPSPixelDigi_ = consumes>(iConfig.getParameter("InputLabel")); @@ -106,6 +108,8 @@ CTPPSPixelDigiToRaw::CTPPSPixelDigiToRaw(const edm::ParameterSet& iConfig) // Define EDProduct type produces(); + + isRun3_ = iConfig.getParameter("isRun3"); } CTPPSPixelDigiToRaw::~CTPPSPixelDigiToRaw() {} @@ -134,13 +138,13 @@ void CTPPSPixelDigiToRaw::produce(edm::Event& iEvent, const edm::EventSetup& iSe } allDigiCounter_ += digiCounter; edm::ESHandle mapping; - if (recordWatcher_.check(iSetup)) { - mapping = iSetup.getHandle(tCTPPSPixelDAQMapping_); - for (const auto& p : mapping->ROCMapping) - v_iDdet2fed_.emplace_back(CTPPSPixelDataFormatter::PPSPixelIndex{ - p.second.iD, p.second.roc, p.first.getROC(), p.first.getFEDId(), p.first.getChannelIdx()}); - fedIds_ = mapping->fedIds(); - } + + mapping = iSetup.getHandle(tCTPPSPixelDAQMapping_); + for (const auto& p : mapping->ROCMapping) + v_iDdet2fed_.emplace_back(CTPPSPixelDataFormatter::PPSPixelIndex{ + p.second.iD, p.second.roc, p.first.getROC(), p.first.getFEDId(), p.first.getChannelIdx()}); + fedIds_ = mapping->fedIds(); + CTPPSPixelDataFormatter formatter(mapping->ROCMapping); // create product (raw data) @@ -149,7 +153,7 @@ void CTPPSPixelDigiToRaw::produce(edm::Event& iEvent, const edm::EventSetup& iSe std::sort(v_iDdet2fed_.begin(), v_iDdet2fed_.end(), CTPPSPixelDataFormatter::compare); // convert data to raw - formatter.formatRawData(iEvent.id().event(), rawdata, digis, v_iDdet2fed_); + formatter.formatRawData(isRun3_, iEvent.id().event(), rawdata, digis, v_iDdet2fed_); // pack raw data into collection for (auto it = fedIds_.begin(); it != fedIds_.end(); it++) { @@ -171,6 +175,7 @@ void CTPPSPixelDigiToRaw::produce(edm::Event& iEvent, const edm::EventSetup& iSe // ------------ method fills 'descriptions' with the allowed parameters for the module ------------ void CTPPSPixelDigiToRaw::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { edm::ParameterSetDescription desc; + desc.add("isRun3", true); desc.add("InputLabel", edm::InputTag("RPixDetDigitizer")); desc.add("mappingLabel", "RPix"); descriptions.add("ctppsPixelRawData", desc); diff --git a/EventFilter/CTPPSRawToDigi/plugins/CTPPSPixelRawToDigi.cc b/EventFilter/CTPPSRawToDigi/plugins/CTPPSPixelRawToDigi.cc index c0002f2bd2703..9856c37e728cf 100644 --- a/EventFilter/CTPPSRawToDigi/plugins/CTPPSPixelRawToDigi.cc +++ b/EventFilter/CTPPSRawToDigi/plugins/CTPPSPixelRawToDigi.cc @@ -30,6 +30,7 @@ CTPPSPixelRawToDigi::CTPPSPixelRawToDigi(const edm::ParameterSet& conf) produces>(); + isRun3_ = config_.getParameter("isRun3"); includeErrors_ = config_.getParameter("includeErrors"); mappingLabel_ = config_.getParameter("mappingLabel"); @@ -44,6 +45,7 @@ CTPPSPixelRawToDigi::~CTPPSPixelRawToDigi() { void CTPPSPixelRawToDigi::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { edm::ParameterSetDescription desc; + desc.add("isRun3", true); desc.add("includeErrors", true); desc.add("inputLabel", edm::InputTag("rawDataCollector")); desc.add("mappingLabel", "RPix"); @@ -89,7 +91,7 @@ void CTPPSPixelRawToDigi::produce(edm::Event& ev, const edm::EventSetup& es) { /// get event data for this fed const FEDRawData& fedRawData = buffers->FEDData(fedId); - formatter.interpretRawData(errorsInEvent, fedId, fedRawData, *collection, errors); + formatter.interpretRawData(isRun3_, errorsInEvent, fedId, fedRawData, *collection, errors); if (includeErrors_) { for (auto const& is : errors) { diff --git a/EventFilter/CTPPSRawToDigi/python/ctppsRawToDigi_cff.py b/EventFilter/CTPPSRawToDigi/python/ctppsRawToDigi_cff.py index 9151ec8467804..04708735e343c 100644 --- a/EventFilter/CTPPSRawToDigi/python/ctppsRawToDigi_cff.py +++ b/EventFilter/CTPPSRawToDigi/python/ctppsRawToDigi_cff.py @@ -113,6 +113,11 @@ from EventFilter.CTPPSRawToDigi.ctppsPixelDigis_cfi import ctppsPixelDigis ctppsPixelDigis.inputLabel = cms.InputTag("rawDataCollector") +from Configuration.Eras.Modifier_ctpps_2016_cff import ctpps_2016 +from Configuration.Eras.Modifier_ctpps_2017_cff import ctpps_2017 +from Configuration.Eras.Modifier_ctpps_2018_cff import ctpps_2018 +(ctpps_2016 | ctpps_2017 | ctpps_2018).toModify(ctppsPixelDigis, isRun3 = False ) + # raw-to-digi task and sequence ctppsRawToDigiTask = cms.Task( totemTriggerRawToDigi, diff --git a/EventFilter/CTPPSRawToDigi/src/CTPPSPixelDataFormatter.cc b/EventFilter/CTPPSRawToDigi/src/CTPPSPixelDataFormatter.cc index b42bf70341085..983ad51d77cbf 100644 --- a/EventFilter/CTPPSRawToDigi/src/CTPPSPixelDataFormatter.cc +++ b/EventFilter/CTPPSRawToDigi/src/CTPPSPixelDataFormatter.cc @@ -21,13 +21,20 @@ namespace { constexpr int m_ROC_bits = 5; constexpr int m_DCOL_bits = 5; constexpr int m_PXID_bits = 8; + constexpr int m_COL_bits = 6; + constexpr int m_ROW_bits = 7; constexpr int m_ADC_bits = 8; constexpr int min_Dcol = 0; constexpr int max_Dcol = 25; constexpr int min_Pixid = 2; constexpr int max_Pixid = 161; + constexpr int min_COL = 0; + constexpr int max_COL = 51; + constexpr int min_ROW = 0; + constexpr int max_ROW = 79; constexpr int maxRocIndex = 3; - constexpr int maxLinkIndex = 13; + constexpr int maxLinkIndex = 49; + } // namespace CTPPSPixelDataFormatter::CTPPSPixelDataFormatter(std::map const& mapping) @@ -44,6 +51,10 @@ CTPPSPixelDataFormatter::CTPPSPixelDataFormatter(std::map> m_LINK_shift) & m_LINK_mask; int nroc = (ww >> m_ROC_shift) & m_ROC_mask; - int FMC = 0; uint32_t iD = RPixErrorChecker::dummyDetId; //0xFFFFFFFF; //dummyDetId int convroc = nroc - 1; CTPPSPixelFramePosition fPos(fedId, FMC, nlink, convroc); + std::map::const_iterator mit; mit = m_Mapping.find(fPos); @@ -161,8 +176,10 @@ void CTPPSPixelDataFormatter::interpretRawData( int dcol = (ww >> m_DCOL_shift) & m_DCOL_mask; int pxid = (ww >> m_PXID_shift) & m_PXID_mask; + int col = (ww >> m_COL_shift) & m_COL_mask; + int row = (ww >> m_ROW_shift) & m_ROW_mask; - if (dcol < min_Dcol || dcol > max_Dcol || pxid < min_Pixid || pxid > max_Pixid) { + if (!isRun3 && (dcol < min_Dcol || dcol > max_Dcol || pxid < min_Pixid || pxid > max_Pixid)) { edm::LogError("CTPPSPixelDataFormatter") << " unphysical dcol and/or pxid " << " nllink=" << nlink << " nroc=" << nroc << " adc=" << adc << " dcol=" << dcol << " pxid=" << pxid; @@ -171,13 +188,26 @@ void CTPPSPixelDataFormatter::interpretRawData( continue; } + if (isRun3 && (col < min_COL || col > max_COL || row < min_ROW || row > max_ROW)) { + edm::LogError("CTPPSPixelDataFormatter") + << " unphysical col and/or row " + << " nllink=" << nlink << " nroc=" << nroc << " adc=" << adc << " col=" << col << " row=" << row; + + m_ErrorCheck.conversionError(fedId, iD, InvalidPixelId, ww, errors); + + continue; + } std::pair rocPixel; std::pair modPixel; - rocPixel = std::make_pair(dcol, pxid); - - modPixel = rocp.toGlobalfromDcol(rocPixel); + if (isRun3) { + rocPixel = std::make_pair(row, col); + modPixel = rocp.toGlobal(rocPixel); + } else { + rocPixel = std::make_pair(dcol, pxid); + modPixel = rocp.toGlobalfromDcol(rocPixel); + } CTPPSPixelDigi testdigi(modPixel.first, modPixel.second, adc); @@ -186,7 +216,8 @@ void CTPPSPixelDataFormatter::interpretRawData( } } -void CTPPSPixelDataFormatter::formatRawData(unsigned int lvl1_ID, +void CTPPSPixelDataFormatter::formatRawData(const bool& isRun3, + unsigned int lvl1_ID, RawData& fedRawData, const Digis& digis, std::vector iDdet2fed) { @@ -219,11 +250,19 @@ void CTPPSPixelDataFormatter::formatRawData(unsigned int lvl1_ID, nroc = iDdet2fed.at(i).rocch + 1; pps::pixel::ElectronicIndex cabling = {nlink, nroc, dcol, pxid}; - - cms_uint32_t word = (cabling.link << m_LINK_shift) | (cabling.roc << m_ROC_shift) | - (cabling.dcol << m_DCOL_shift) | (cabling.pxid << m_PXID_shift) | (it.adc() << m_ADC_shift); - - words[iDdet2fed.at(i).fedid].push_back(word); + if (isRun3) { + cms_uint32_t word = (cabling.link << m_LINK_shift) | (cabling.roc << m_ROC_shift) | + (rocPixelColumn << m_COL_shift) | (rocPixelRow << m_ROW_shift) | + (it.adc() << m_ADC_shift); + + words[iDdet2fed.at(i).fedid].push_back(word); + } else { + cms_uint32_t word = (cabling.link << m_LINK_shift) | (cabling.roc << m_ROC_shift) | + (cabling.dcol << m_DCOL_shift) | (cabling.pxid << m_PXID_shift) | + (it.adc() << m_ADC_shift); + + words[iDdet2fed.at(i).fedid].push_back(word); + } m_WordCounter++; m_hasDetDigis++; diff --git a/EventFilter/CTPPSRawToDigi/test/test_pixels_only_cfg_eraRun3_562.py b/EventFilter/CTPPSRawToDigi/test/test_pixels_only_cfg_eraRun3_562.py new file mode 100644 index 0000000000000..d718caed4da45 --- /dev/null +++ b/EventFilter/CTPPSRawToDigi/test/test_pixels_only_cfg_eraRun3_562.py @@ -0,0 +1,82 @@ +import FWCore.ParameterSet.Config as cms +from Configuration.StandardSequences.Eras import eras + +#process = cms.Process("CTPPSRawToDigiTestPixelsOnly",eras.Run2_2017) +process = cms.Process("CTPPSRawToDigiTestPixelsOnly",eras.Run3) +# minimum of logs +process.MessageLogger = cms.Service("MessageLogger", + statistics = cms.untracked.vstring(), + destinations = cms.untracked.vstring('cerr'), + cerr = cms.untracked.PSet( threshold = cms.untracked.string('DEBUG') ) +) + +# raw data source +process.source = cms.Source("PoolSource", + fileNames = cms.untracked.vstring( +# 'file:/afs/cern.ch/user/f/fabferro/WORKSPACE/public/Unpacking/CMSSW_11_3_0/src/IORawData/SiPixelInputSources/test/PixelAlive_1463_548.root' + 'file:/eos/cms/store/group/dpg_ctpps/comm_ctpps/PixelAlive_562_RAW.root' + ), +labelRawDataLikeMC = cms.untracked.bool(False), # for testing H8 data +duplicateCheckMode = cms.untracked.string("checkEachFile") +) + +process.maxEvents = cms.untracked.PSet( + input = cms.untracked.int32(-1) +) + +#process.load("CalibPPS.ESProducers.CTPPSPixelDAQMappingESSourceXML_cfi") + +#ctppsPixelDAQMappingESSourceXML = cms.ESSource("CTPPSPixelDAQMappingESSourceXML", +# verbosity = cms.untracked.uint32(2), +# subSystem= cms.untracked.string("RPix"), +# configuration = cms.VPSet( + # example configuration block: +# cms.PSet( +# validityRange = cms.EventRange("1:min - 999999999:max"), +# mappingFileNames = cms.vstring("CondFormats/PPSObjects/xml/rpix_tests_2021.xml"), +# maskFileNames = cms.vstring("CondFormats/PPSObjects/xml/rpix_channel_mask_220_far.xml") +# ) +# ) +# +#) + +# raw-to-digi conversion +process.load("EventFilter.CTPPSRawToDigi.ctppsRawToDigi_cff") +process.ctppsPixelDigis.inputLabel = cms.InputTag("source") + + + + + +#process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff') +#from Configuration.AlCa.GlobalTag import GlobalTag +#process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:phase1_2021_realistic', '') + + +process.load("CondCore.CondDB.CondDB_cfi") +# input database (in this case the local sqlite file) +process.CondDB.connect = 'sqlite_file:/eos/cms/store/group/dpg_ctpps/comm_ctpps/CTPPSPixel_DAQMapping_AnalysisMask.db' + +process.PoolDBESSource = cms.ESSource("PoolDBESSource", + process.CondDB, + DumpStat=cms.untracked.bool(True), + toGet = cms.VPSet(cms.PSet( + record = cms.string('CTPPSPixelDAQMappingRcd'), + tag = cms.string("PixelDAQMapping") + )), +) + +process.p = cms.Path( + process.ctppsPixelDigis +# process.ctppsRawToDigi +) + +# output configuration +process.output = cms.OutputModule("PoolOutputModule", + fileName = cms.untracked.string("file:./_digi_PixelAlive_562.root"), + outputCommands = cms.untracked.vstring( + 'keep *' + ) +) + +process.outpath = cms.EndPath(process.output) diff --git a/EventFilter/DTRawToDigi/interface/DTROS25Data.h b/EventFilter/DTRawToDigi/interface/DTROS25Data.h deleted file mode 100644 index 57ea5ecaa1df0..0000000000000 --- a/EventFilter/DTRawToDigi/interface/DTROS25Data.h +++ /dev/null @@ -1,61 +0,0 @@ -#ifndef DTRawToDigi_DTROS25Data_h -#define DTRawToDigi_DTROS25Data_h - -/** \class DTROS25Data - * The collection containing DT ROS25 status data. - * - * \author M. Zanetti - INFN Padova - */ - -#include - -#include - - -typedef std::pair DTTDCData; - -class DTROS25Data { - -public: - - /// Constructors - DTROS25Data(int ROSId = 0): theROSId(ROSId) {} - - - /// Destructor - virtual ~DTROS25Data() {} - - /// Setters - inline void setROSId(const int & ID) { theROSId = ID; } - - inline void addROSTrailer( const DTROSTrailerWord & word) { theROSTrailers.push_back(word); } - inline void addROSError( const DTROSErrorWord & word) { theROSErrors.push_back(word); } - inline void addROSDebug( const DTROSDebugWord & word) { theROSDebugs.push_back(word); } - inline void addROBTrailer( const DTROBTrailerWord & word) { theROBTrailers.push_back(word); } - inline void addTDCMeasurement( const DTTDCMeasurementWord & word) { theTDCMeasurements.push_back(word); } - inline void addTDCData( const DTTDCData & tdcData) { theTDCData.push_back(tdcData); } - - /// Getters - inline int getROSID() const { return theROSId; } - - inline const std::vector& getROSTrailers() const {return theROSTrailers;} - inline const std::vector& getROSErrors() const {return theROSErrors;} - inline const std::vector& getROSDebugs() const {return theROSDebugs;} - inline const std::vector& getROBTrailers() const {return theROBTrailers;} - inline const std::vector& getTDCMeasurements() const {return theTDCMeasurements;} - inline const std::vector& getTDCData() const {return theTDCData;} - -private: - - int theROSId; - - std::vector theROSTrailers; - std::vector theROSErrors; - std::vector theROSDebugs; - std::vector theROBTrailers; - std::vector theTDCMeasurements; - std::vector theTDCData; - -}; - -#endif diff --git a/EventFilter/ESRawToDigi/interface/ESCrcKchipFast.h b/EventFilter/ESRawToDigi/interface/ESCrcKchipFast.h deleted file mode 100644 index 206cbc5c734dc..0000000000000 --- a/EventFilter/ESRawToDigi/interface/ESCrcKchipFast.h +++ /dev/null @@ -1,50 +0,0 @@ -#ifndef ESCrcKchipFast_H -#define ESCrcKchipFast_H - -#include - -class ESCrcKchipFast { - - private : - - uint32_t crc; - - public: - - ESCrcKchipFast() { - init(); - reset() ; - }; - - void init() { - crc = 0x0ffff ; - } - - void reset() { - crc = 0x0ffff ; - } ; - - void add(unsigned int data) { - for (int i=0;i<16;i++) - { - if ((crc&0x0001) == (data&0x0001)) - crc=crc>>1; - else - crc=(crc>>1)^0x8408; // flipped 0x1021; - data=(data>>1); - } - }; - - uint32_t get_crc() { - return crc ; - }; - - bool isCrcOk(unsigned int crcin=0x0000) { - return ((get_crc()==crcin) ? true : false ); - }; - - ~ESCrcKchipFast() { } ; - -}; - -#endif diff --git a/EventFilter/EcalRawToDigi/interface/DCCEBSRPBlock.h b/EventFilter/EcalRawToDigi/interface/DCCEBSRPBlock.h index 3f87bb7361797..fafcd99cd6b42 100644 --- a/EventFilter/EcalRawToDigi/interface/DCCEBSRPBlock.h +++ b/EventFilter/EcalRawToDigi/interface/DCCEBSRPBlock.h @@ -39,8 +39,6 @@ class DCCEBSRPBlock : public DCCSRPBlock { bool checkSrpIdAndNumbSRFlags() override; std::unique_ptr* ebSrFlagsDigis_; - - EcalTrigTowerDetId* pTTDetId_; }; #endif diff --git a/EventFilter/EcalRawToDigi/interface/DCCEESRPBlock.h b/EventFilter/EcalRawToDigi/interface/DCCEESRPBlock.h index 418949318301a..beb2fa24e8c59 100644 --- a/EventFilter/EcalRawToDigi/interface/DCCEESRPBlock.h +++ b/EventFilter/EcalRawToDigi/interface/DCCEESRPBlock.h @@ -39,8 +39,6 @@ class DCCEESRPBlock : public DCCSRPBlock { bool checkSrpIdAndNumbSRFlags() override; std::unique_ptr* eeSrFlagsDigis_; - - EcalScDetId* pSCDetId_; }; #endif diff --git a/EventFilter/EcalRawToDigi/interface/DCCTCCBlock.h b/EventFilter/EcalRawToDigi/interface/DCCTCCBlock.h index 5db19585bf35b..bac78ea4e17ed 100644 --- a/EventFilter/EcalRawToDigi/interface/DCCTCCBlock.h +++ b/EventFilter/EcalRawToDigi/interface/DCCTCCBlock.h @@ -59,7 +59,6 @@ class DCCTCCBlock : public DCCDataBlockPrototype { unsigned int expTccId_; unsigned int ps_; - EcalTrigTowerDetId* pTTDetId_; EcalTriggerPrimitiveDigi* pTP_; EcalPseudoStripInputDigi* pPS_; std::unique_ptr* tps_; diff --git a/EventFilter/EcalRawToDigi/interface/ECALUnpackerException.h b/EventFilter/EcalRawToDigi/interface/ECALUnpackerException.h deleted file mode 100644 index a9f1e57d0cdb2..0000000000000 --- a/EventFilter/EcalRawToDigi/interface/ECALUnpackerException.h +++ /dev/null @@ -1,32 +0,0 @@ -// Date : 30/05/2005 -// Author : N.Almeida (LIP) - -#ifndef ECALUNPACKEREXCEPTION_H -#define ECALUNPACKEREXCEPTION_H - -#include -#include -#include - - -class ECALUnpackerException { - public : - - /** - * Constructor - */ - ECALUnpackerException(std::ostringstream a){ info_=a.str(); } - - ECALUnpackerException(std::string a){info_=a;} - /** - * Exception's discription - */ - std::string what() const throw() { return info_;} - - protected : - - std::string info_; - -}; - -#endif diff --git a/EventFilter/EcalRawToDigi/interface/EcalElectronicsMapper.h b/EventFilter/EcalRawToDigi/interface/EcalElectronicsMapper.h index 6086063d57268..e187ef1695b18 100644 --- a/EventFilter/EcalRawToDigi/interface/EcalElectronicsMapper.h +++ b/EventFilter/EcalRawToDigi/interface/EcalElectronicsMapper.h @@ -14,6 +14,7 @@ */ #include +#include #include #include #include @@ -26,9 +27,6 @@ #include #include #include -#include -#include - #include class EcalElectronicsMapping; diff --git a/EventFilter/EcalRawToDigi/interface/MatacqProducer.h b/EventFilter/EcalRawToDigi/interface/MatacqProducer.h deleted file mode 100644 index fad2161e4324e..0000000000000 --- a/EventFilter/EcalRawToDigi/interface/MatacqProducer.h +++ /dev/null @@ -1,319 +0,0 @@ -#ifndef PRODUCER_H -#define PRODUCER_H - -//#define USE_STORAGE_MANAGER - -#ifdef USE_STORAGE_MANAGER -#include "Utilities/StorageFactory/interface/Storage.h" -#include "Utilities/StorageFactory/interface/StorageFactory.h" -#else //USE_STORAGE_MANAGER not defined -#ifndef _LARGEFILE64_SOURCE -#define _LARGEFILE64_SOURCE -#endif //_LARGEFILE64_SOURCE not defined -#define _FILE_OFFSET_BITS 64 -#include -#endif //USE_STORAGE_MANAGER defined - -#include "FWCore/Framework/interface/EDProducer.h" -#include "FWCore/Utilities/interface/InputTag.h" -#include "FWCore/Utilities/interface/EDGetToken.h" -#include "EventFilter/EcalRawToDigi/interface/MatacqRawEvent.h" -#include "EventFilter/EcalRawToDigi/src/MatacqDataFormatter.h" -#include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "FWCore/Utilities/interface/InputTag.h" -#include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h" - -#include -#include -#include -#include - -#include - -struct NullOut { - NullOut& operator<<(std::ostream& (*pf)(std::ostream&)) { return *this; } - template - inline NullOut& operator<<(const T& a) { - return *this; - } -}; - -class MatacqProducer : public edm::EDProducer { -public: - enum calibTrigType_t { laserType = 4, ledType = 5, tpType = 6, pedType = 7 }; - -private: -#ifdef USE_STORAGE_MANAGER - typedef IOOffset filepos_t; - typedef std::unique_ptr FILE_t; -#else - typedef off_t filepos_t; - typedef FILE* FILE_t; -#endif - struct MatacqEventId { - MatacqEventId() : run(0), orbit(0) {} - MatacqEventId(uint32_t r, uint32_t o) : run(r), orbit(o) {} - - /** Run number - */ - uint32_t run; - - /** Orbit id - */ - uint32_t orbit; - - bool operator<(const MatacqEventId& a) { - return (this->run < a.run) || ((this->run == a.run) && (this->orbit < a.orbit)); - } - - bool operator>(const MatacqEventId& a) { - return (this->run > a.run) || ((this->run == a.run) && (this->orbit > a.orbit)); - } - - bool operator==(const MatacqEventId& a) { return !((*this) < a || (*this) > a); } - }; - - /** Estimates matacq event position in a file from its orbit id. This - * estimator requires that every event in the file has the same length. A - * linear extrapolation of pos=f(orbit) function from first and last event - * is performed. It gives only a rough estimate, relevant only to initiliaze - * the event search. - */ - class PosEstimator { - //Note: a better estimate could be obtained by using segment of linear - //functions. In such implementation, the estimator must be updated - //each time a point with wrong estimate has been found. - public: - PosEstimator() : eventLength_(0), orbitStepMean_(0), firstOrbit_(0), invalid_(true), verbosity_(0) {} - void init(MatacqProducer* mp); - bool invalid() const { return invalid_; } - int64_t pos(int orb) const; - int eventLength() const { return eventLength_; } - int firstOrbit() const { return firstOrbit_; } - void verbosity(int verb) { verbosity_ = verb; } - - private: - int eventLength_; - int orbitStepMean_; - int firstOrbit_; - bool invalid_; - int verbosity_; - }; - -public: - /** Constructor - * @param params seletive readout parameters - */ - explicit MatacqProducer(const edm::ParameterSet& params); - - /** Destructor - */ - ~MatacqProducer() override; - - /** Produces the EDM products - * @param CMS event - * @param eventSetup event conditions - */ - void produce(edm::Event& event, const edm::EventSetup& eventSetup) override; - -private: - /** Add matacq digi to the event - * @param event the event - * @param digiInstanceName_ name to give to the matacq digi instance - */ - void addMatacqData(edm::Event& event); - - /** Retrieve the file containing a given matacq event - * @param runNumber Number of the run the matacq event is looking from - * @param orbitId Id of the orbit of the matacq event - * @param fileChange if not null pointer, set to true if the file changed. - * @return true if file retrieval succeeded, false otherwise. - * found. - */ - bool getMatacqFile(uint32_t runNumber, uint32_t orbitId, bool* fileChange = nullptr); - - bool getMatacqEvent(uint32_t runNumber, int32_t orbitId, bool fileChange); - /*,bool doWrap = false, std::streamoff maxPos = -1);*/ - - uint32_t getRunNumber(edm::Event& ev) const; - uint32_t getOrbitId(edm::Event& ev) const; - - bool getOrbitRange(uint32_t& firstOrb, uint32_t& lastOrb); - - int getCalibTriggerType(edm::Event& ev) const; - - /** Loading orbit correction table from file. @see orbitOffsetFile_ - */ - void loadOrbitOffset(); - - /** Move input file read pointer. On failure file is rewind. - * @param buf buffer to store read data - * @param n size of data block - * @param mess text to insert in the eventual error message. - * @return true on success, false on failure - */ - bool mseek(filepos_t offset, int whence = SEEK_SET, const char* mess = nullptr); - - bool mtell(filepos_t& pos); - - /** Read a data block from input file. On failure file position is restored - * and if position restoring fails, file is rewind. - * @param buf buffer to store read data - * @param n size of data block - * @param mess text to insert in the eventual error message. - * @param peek if true file position is restored after the data read - * @return true on success, false on failure - */ - bool mread(char* buf, size_t n, const char* mess = nullptr, bool peek = false); - - bool mcheck(const std::string& name); - - bool mopen(const std::string& name); - - void mclose(); - - bool misOpened(); - - bool meof(); - - bool mrewind(); - - bool msize(filepos_t& s); - - void newRun(int prevRun, int newRun); - - static std::string runSubDir(uint32_t runNumber); - -private: - std::vector fileNames_; - - /** Instance name to use for the produced Matacq digi collection - */ - std::string digiInstanceName_; - - /** Instance name to use for the produced Matacq raw data collection - */ - std::string rawInstanceName_; - - /** Parameter to switch module timing. - */ - bool timing_; - - /** Parameter to disable matacq data production. For timing purpose. - */ - bool disabled_; - - /** Verbosity level - */ - int verbosity_; - - /** Swictch for Matacq digi producion - */ - bool produceDigis_; - - /** Switch for Matacq FED raw data production - */ - bool produceRaw_; - - /** Name of the raw data collection the Matacq data must be merge to - * if merging is enabled. - */ - edm::InputTag inputRawCollection_; - - /** EDM token to access the raw data collection the Matacq data must be merge to - * if merging is enabled. - */ - edm::EDGetTokenT inputRawCollectionToken_; - - /** Switch for merging Matacq raw data with existing raw data - * collection. - */ - bool mergeRaw_; - - /** When true look for matacq data independently of trigger type. - */ - bool ignoreTriggerType_; - - MatacqRawEvent matacq_; - - /** Stream of currently opened matacq file - */ - FILE_t inFile_; - - static const int bufferSize = 30000; //must greater or equal to maximum - // matacq event size. - std::vector data_; - MatacqDataFormatter formatter_; - const static int orbitTolerance_; - uint32_t openedFileRunNumber_; - int32_t lastOrb_; - int fastRetrievalThresh_; - - PosEstimator posEstim_; - - timeval startTime_; - - /** File name of table with orbit offset between - * matacq event and DCC. Used to recover data suffering from orbit - * miss-synchonization - */ - std::string orbitOffsetFile_; - - /** Orbit offset table. @see orbitOffsetFile_ - */ - std::map orbitOffset_; - - /** Switch for orbit ID correction. @see orbitOffsetFile_ - */ - bool doOrbitOffset_; - - /** Name of currently opened matacq file - */ - std::string inFileName_; - - static const int matacqFedId_ = 655; - - struct stats_t { - double nEvents; - double nLaserEventsWithMatacq; - double nNonLaserEventsWithMatacq; - } stats_; - - const static stats_t stats_init; - /** Log file name - */ - std::string logFileName_; - - /** Log file - */ - std::ofstream logFile_; - - /** counter for event skipping - */ - int eventSkipCounter_; - - /** Number of events to skip in case of error - */ - int onErrorDisablingEvtCnt_; - - /** Name of file to log timing - */ - std::string timeLogFile_; - /** Buffer for timing - */ - timeval timer_; - - /** Output stream to log code timing - */ - std::ofstream timeLog_; - - /** Switch for code timing. - */ - bool logTiming_; - - /** Number of the currently processed run - */ - uint32_t runNumber_; -}; - -#endif diff --git a/EventFilter/EcalRawToDigi/interface/MyWatcher.h b/EventFilter/EcalRawToDigi/interface/MyWatcher.h deleted file mode 100644 index 5d26a0df24808..0000000000000 --- a/EventFilter/EcalRawToDigi/interface/MyWatcher.h +++ /dev/null @@ -1,43 +0,0 @@ -#ifndef MyWATCHER_H -#define MyWATCHER_H - -#include "TStopwatch.h" -#include -#include - -#ifdef EDM_ML_DEBUG -class MyWatcher : public TStopwatch { - public: - MyWatcher(const std::string n=""):name(n),total(0) {} - ~MyWatcher(){} - - std::string start(bool r=true){Start(r); return " [Start]";} - std::string continu(){Continue(); return " [Continue]";} - std::string reset(){Reset(); return " [Reset]";} - std::string stop() {Stop(); return " [Stop]";} - std::string lap() { - std::stringstream o; - double r=RealTime(); - total+=r; - o<<"\n "< + +#include "EventFilter/EcalRawToDigi/interface/DCCRawDataDefinitions.h" + +#include +#include +#include +#include +#include +#include "Geometry/EcalMapping/interface/EcalMappingRcd.h" +#include "Geometry/EcalMapping/interface/EcalElectronicsMapping.h" +#include "CondFormats/EcalObjects/interface/EcalChannelStatus.h" +#include "CondFormats/DataRecord/interface/EcalChannelStatusRcd.h" + +#include +#include +#include "FWCore/Framework/interface/stream/EDProducer.h" +#include +#include +#include +#include "FWCore/Utilities/interface/ESGetToken.h" +#include "DataFormats/EcalRawData/interface/EcalListOfFEDS.h" +#include + +class EcalElectronicsMapper; +class EcalElectronicsMapping; +class DCCDataUnpacker; + +class EcalRawToDigi : public edm::stream::EDProducer<> { +public: + /** + * Class constructor + */ + explicit EcalRawToDigi(const edm::ParameterSet& ps); + + /** + * Functions that are called by framework at each event + */ + void produce(edm::Event& e, const edm::EventSetup& c) override; + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + + // function called at start of each run + void beginRun(const edm::Run& run, const edm::EventSetup& es) override; + + /** + * Class destructor + */ + ~EcalRawToDigi() override; + + edm::ESWatcher watcher_; + +private: + //list of FEDs to unpack + std::vector fedUnpackList_; + + std::vector orderedFedUnpackList_; + std::vector orderedDCCIdList_; + + unsigned int numbXtalTSamples_; + unsigned int numbTriggerTSamples_; + + bool headerUnpacking_; + bool srpUnpacking_; + bool tccUnpacking_; + bool feUnpacking_; + bool memUnpacking_; + bool syncCheck_; + bool feIdCheck_; + bool forceToKeepFRdata_; + bool first_; + bool put_; + + edm::EDGetTokenT dataToken_; + edm::EDGetTokenT fedsToken_; + edm::ESGetToken chStatusToken_; + edm::ESGetToken ecalMappingToken_; + + // -- For regional unacking : + bool REGIONAL_; + + //an electronics mapper class + EcalElectronicsMapper* myMap_; + + //Ecal unpacker + DCCDataUnpacker* theUnpacker_; + + unsigned int nevts_; // NA: for testing + double RUNNING_TIME_, SETUP_TIME_; +}; + #include "EventFilter/EcalRawToDigi/interface/EcalElectronicsMapper.h" #include "EventFilter/EcalRawToDigi/interface/DCCDataUnpacker.h" @@ -8,9 +110,6 @@ #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/Framework/interface/ESHandle.h" -#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" -#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" - EcalRawToDigi::EcalRawToDigi(edm::ParameterSet const& conf) : @@ -524,3 +623,6 @@ EcalRawToDigi::~EcalRawToDigi() { if (theUnpacker_) delete theUnpacker_; } + +#include "FWCore/Framework/interface/MakerMacros.h" +DEFINE_FWK_MODULE(EcalRawToDigi); diff --git a/EventFilter/EcalRawToDigi/plugins/EcalRawToDigi.h b/EventFilter/EcalRawToDigi/plugins/EcalRawToDigi.h deleted file mode 100644 index a26eca3bdfd82..0000000000000 --- a/EventFilter/EcalRawToDigi/plugins/EcalRawToDigi.h +++ /dev/null @@ -1,107 +0,0 @@ -#ifndef _ECALRAWTODIGIDEV_H_ -#define _ECALRAWTODIGIDEV_H_ - -/* - *\ Class EcalRawToDigi - * - * This class takes unpacks ECAL raw data - * produces digis and raw data format prolblems reports - * - * \file EcalRawToDigi.h - * - * \author N. Almeida - * \author G. Franzoni - * -*/ - -#include - -#include "EventFilter/EcalRawToDigi/interface/DCCRawDataDefinitions.h" - -#include -#include -#include -#include -#include -#include "Geometry/EcalMapping/interface/EcalMappingRcd.h" -#include "Geometry/EcalMapping/interface/EcalElectronicsMapping.h" -#include "CondFormats/EcalObjects/interface/EcalChannelStatus.h" -#include "CondFormats/DataRecord/interface/EcalChannelStatusRcd.h" - -#include -#include -#include "FWCore/Framework/interface/stream/EDProducer.h" -#include -#include -#include -#include "FWCore/Utilities/interface/ESGetToken.h" -#include "DataFormats/EcalRawData/interface/EcalListOfFEDS.h" -#include - -class EcalElectronicsMapper; -class EcalElectronicsMapping; -class DCCDataUnpacker; - -class EcalRawToDigi : public edm::stream::EDProducer<> { -public: - /** - * Class constructor - */ - explicit EcalRawToDigi(const edm::ParameterSet& ps); - - /** - * Functions that are called by framework at each event - */ - void produce(edm::Event& e, const edm::EventSetup& c) override; - static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); - - // function called at start of each run - void beginRun(const edm::Run& run, const edm::EventSetup& es) override; - - /** - * Class destructor - */ - ~EcalRawToDigi() override; - - edm::ESWatcher watcher_; - -private: - //list of FEDs to unpack - std::vector fedUnpackList_; - - std::vector orderedFedUnpackList_; - std::vector orderedDCCIdList_; - - unsigned int numbXtalTSamples_; - unsigned int numbTriggerTSamples_; - - bool headerUnpacking_; - bool srpUnpacking_; - bool tccUnpacking_; - bool feUnpacking_; - bool memUnpacking_; - bool syncCheck_; - bool feIdCheck_; - bool forceToKeepFRdata_; - bool first_; - bool put_; - - edm::EDGetTokenT dataToken_; - edm::EDGetTokenT fedsToken_; - edm::ESGetToken chStatusToken_; - edm::ESGetToken ecalMappingToken_; - - // -- For regional unacking : - bool REGIONAL_; - - //an electronics mapper class - EcalElectronicsMapper* myMap_; - - //Ecal unpacker - DCCDataUnpacker* theUnpacker_; - - unsigned int nevts_; // NA: for testing - double RUNNING_TIME_, SETUP_TIME_; -}; - -#endif diff --git a/EventFilter/EcalRawToDigi/plugins/EcalRegionCablingESProducer.cc b/EventFilter/EcalRawToDigi/plugins/EcalRegionCablingESProducer.cc index d5cef950503f5..4237d346f2780 100644 --- a/EventFilter/EcalRawToDigi/plugins/EcalRegionCablingESProducer.cc +++ b/EventFilter/EcalRawToDigi/plugins/EcalRegionCablingESProducer.cc @@ -1,4 +1,46 @@ -#include "EventFilter/EcalRawToDigi/plugins/EcalRegionCablingESProducer.h" +// -*- C++ -*- +// +// Package: EcalRegionCablingESProducer +// Class: EcalRegionCablingESProducer +// +/**\class EcalRegionCablingESProducer EcalRegionCablingESProducer.h EventFilter/EcalRegionCablingESProducer/src/EcalRegionCablingESProducer.cc + + Description: + + Implementation: + +*/ +// +// Original Author: Jean-Roch Vlimant +// Created: Sun Oct 7 00:37:06 CEST 2007 +// +// + +// system include files +#include + +// user include files +#include "FWCore/Framework/interface/ESProducer.h" +#include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/Utilities/interface/ESGetToken.h" + +#include "EventFilter/EcalRawToDigi/interface/EcalRegionCablingRecord.h" +#include "EventFilter/EcalRawToDigi/interface/EcalRegionCabling.h" + +class EcalRegionCablingESProducer : public edm::ESProducer { +public: + EcalRegionCablingESProducer(const edm::ParameterSet&); + ~EcalRegionCablingESProducer() override; + + typedef std::unique_ptr ReturnType; + + ReturnType produce(const EcalRegionCablingRecord&); + +private: + edm::ParameterSet conf_; + + edm::ESGetToken esEcalElectronicsMappingToken_; +}; EcalRegionCablingESProducer::EcalRegionCablingESProducer(const edm::ParameterSet& iConfig) : conf_(iConfig) { auto cc = setWhatProduced(this); @@ -12,3 +54,6 @@ EcalRegionCablingESProducer::ReturnType EcalRegionCablingESProducer::produce(con return std::make_unique(conf_, mapping.product()); } + +#include "FWCore/Framework/interface/ModuleFactory.h" +DEFINE_FWK_EVENTSETUP_MODULE(EcalRegionCablingESProducer); diff --git a/EventFilter/EcalRawToDigi/plugins/EcalRegionCablingESProducer.h b/EventFilter/EcalRawToDigi/plugins/EcalRegionCablingESProducer.h deleted file mode 100644 index 485cf367cfc87..0000000000000 --- a/EventFilter/EcalRawToDigi/plugins/EcalRegionCablingESProducer.h +++ /dev/null @@ -1,46 +0,0 @@ -#ifndef EventFilter_EcalRawToDigi_EcalRegionCablingESProducer_H -#define EventFilter_EcalRawToDigi_EcalRegionCablingESProducer_H -// -*- C++ -*- -// -// Package: EcalRegionCablingESProducer -// Class: EcalRegionCablingESProducer -// -/**\class EcalRegionCablingESProducer EcalRegionCablingESProducer.h EventFilter/EcalRegionCablingESProducer/src/EcalRegionCablingESProducer.cc - - Description: - - Implementation: - -*/ -// -// Original Author: Jean-Roch Vlimant -// Created: Sun Oct 7 00:37:06 CEST 2007 -// -// - -// system include files -#include - -// user include files -#include "FWCore/Framework/interface/ESProducer.h" -#include "FWCore/Framework/interface/ESHandle.h" -#include "FWCore/Utilities/interface/ESGetToken.h" - -#include "EventFilter/EcalRawToDigi/interface/EcalRegionCablingRecord.h" -#include "EventFilter/EcalRawToDigi/interface/EcalRegionCabling.h" - -class EcalRegionCablingESProducer : public edm::ESProducer { -public: - EcalRegionCablingESProducer(const edm::ParameterSet&); - ~EcalRegionCablingESProducer() override; - - typedef std::unique_ptr ReturnType; - - ReturnType produce(const EcalRegionCablingRecord&); - -private: - edm::ParameterSet conf_; - - edm::ESGetToken esEcalElectronicsMappingToken_; -}; -#endif diff --git a/EventFilter/EcalRawToDigi/plugins/MatacqProducer.cc b/EventFilter/EcalRawToDigi/plugins/MatacqProducer.cc index d50b96c0725fc..b3a523297c7ec 100644 --- a/EventFilter/EcalRawToDigi/plugins/MatacqProducer.cc +++ b/EventFilter/EcalRawToDigi/plugins/MatacqProducer.cc @@ -1,9 +1,321 @@ -#include +//#define USE_STORAGE_MANAGER + +#ifdef USE_STORAGE_MANAGER +#include "Utilities/StorageFactory/interface/Storage.h" +#include "Utilities/StorageFactory/interface/StorageFactory.h" +#else //USE_STORAGE_MANAGER not defined +#ifndef _LARGEFILE64_SOURCE +#define _LARGEFILE64_SOURCE +#endif //_LARGEFILE64_SOURCE not defined +#define _FILE_OFFSET_BITS 64 #include +#endif //USE_STORAGE_MANAGER defined + +#include "FWCore/Framework/interface/EDProducer.h" +#include "FWCore/Utilities/interface/InputTag.h" +#include "FWCore/Utilities/interface/EDGetToken.h" +#include "EventFilter/EcalRawToDigi/interface/MatacqRawEvent.h" +#include "EventFilter/EcalRawToDigi/src/MatacqDataFormatter.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h" + +#include +#include #include +#include + +#include + +struct NullOut { + NullOut& operator<<(std::ostream& (*pf)(std::ostream&)) { return *this; } + template + inline NullOut& operator<<(const T& a) { + return *this; + } +}; + +class MatacqProducer : public edm::EDProducer { +public: + enum calibTrigType_t { laserType = 4, ledType = 5, tpType = 6, pedType = 7 }; + +private: +#ifdef USE_STORAGE_MANAGER + typedef IOOffset filepos_t; + typedef std::unique_ptr FILE_t; +#else + typedef off_t filepos_t; + typedef FILE* FILE_t; +#endif + struct MatacqEventId { + MatacqEventId() : run(0), orbit(0) {} + MatacqEventId(uint32_t r, uint32_t o) : run(r), orbit(o) {} + + /** Run number + */ + uint32_t run; + + /** Orbit id + */ + uint32_t orbit; + + bool operator<(const MatacqEventId& a) { + return (this->run < a.run) || ((this->run == a.run) && (this->orbit < a.orbit)); + } + + bool operator>(const MatacqEventId& a) { + return (this->run > a.run) || ((this->run == a.run) && (this->orbit > a.orbit)); + } + + bool operator==(const MatacqEventId& a) { return !((*this) < a || (*this) > a); } + }; + + /** Estimates matacq event position in a file from its orbit id. This + * estimator requires that every event in the file has the same length. A + * linear extrapolation of pos=f(orbit) function from first and last event + * is performed. It gives only a rough estimate, relevant only to initiliaze + * the event search. + */ + class PosEstimator { + //Note: a better estimate could be obtained by using segment of linear + //functions. In such implementation, the estimator must be updated + //each time a point with wrong estimate has been found. + public: + PosEstimator() : eventLength_(0), orbitStepMean_(0), firstOrbit_(0), invalid_(true), verbosity_(0) {} + void init(MatacqProducer* mp); + bool invalid() const { return invalid_; } + int64_t pos(int orb) const; + int eventLength() const { return eventLength_; } + int firstOrbit() const { return firstOrbit_; } + void verbosity(int verb) { verbosity_ = verb; } + + private: + int eventLength_; + int orbitStepMean_; + int firstOrbit_; + bool invalid_; + int verbosity_; + }; + +public: + /** Constructor + * @param params seletive readout parameters + */ + explicit MatacqProducer(const edm::ParameterSet& params); + + /** Destructor + */ + ~MatacqProducer() override; + + /** Produces the EDM products + * @param CMS event + * @param eventSetup event conditions + */ + void produce(edm::Event& event, const edm::EventSetup& eventSetup) override; + +private: + /** Add matacq digi to the event + * @param event the event + * @param digiInstanceName_ name to give to the matacq digi instance + */ + void addMatacqData(edm::Event& event); + + /** Retrieve the file containing a given matacq event + * @param runNumber Number of the run the matacq event is looking from + * @param orbitId Id of the orbit of the matacq event + * @param fileChange if not null pointer, set to true if the file changed. + * @return true if file retrieval succeeded, false otherwise. + * found. + */ + bool getMatacqFile(uint32_t runNumber, uint32_t orbitId, bool* fileChange = nullptr); + + bool getMatacqEvent(uint32_t runNumber, int32_t orbitId, bool fileChange); + /*,bool doWrap = false, std::streamoff maxPos = -1);*/ + + uint32_t getRunNumber(edm::Event& ev) const; + uint32_t getOrbitId(edm::Event& ev) const; + + bool getOrbitRange(uint32_t& firstOrb, uint32_t& lastOrb); + + int getCalibTriggerType(edm::Event& ev) const; + + /** Loading orbit correction table from file. @see orbitOffsetFile_ + */ + void loadOrbitOffset(); + + /** Move input file read pointer. On failure file is rewind. + * @param buf buffer to store read data + * @param n size of data block + * @param mess text to insert in the eventual error message. + * @return true on success, false on failure + */ + bool mseek(filepos_t offset, int whence = SEEK_SET, const char* mess = nullptr); + + bool mtell(filepos_t& pos); + + /** Read a data block from input file. On failure file position is restored + * and if position restoring fails, file is rewind. + * @param buf buffer to store read data + * @param n size of data block + * @param mess text to insert in the eventual error message. + * @param peek if true file position is restored after the data read + * @return true on success, false on failure + */ + bool mread(char* buf, size_t n, const char* mess = nullptr, bool peek = false); + + bool mcheck(const std::string& name); + + bool mopen(const std::string& name); + + void mclose(); + + bool misOpened(); + + bool meof(); + + bool mrewind(); + + bool msize(filepos_t& s); + + void newRun(int prevRun, int newRun); + + static std::string runSubDir(uint32_t runNumber); + +private: + std::vector fileNames_; + + /** Instance name to use for the produced Matacq digi collection + */ + std::string digiInstanceName_; + + /** Instance name to use for the produced Matacq raw data collection + */ + std::string rawInstanceName_; + + /** Parameter to switch module timing. + */ + bool timing_; + + /** Parameter to disable matacq data production. For timing purpose. + */ + bool disabled_; + + /** Verbosity level + */ + int verbosity_; + + /** Swictch for Matacq digi producion + */ + bool produceDigis_; + + /** Switch for Matacq FED raw data production + */ + bool produceRaw_; + + /** Name of the raw data collection the Matacq data must be merge to + * if merging is enabled. + */ + edm::InputTag inputRawCollection_; + + /** EDM token to access the raw data collection the Matacq data must be merge to + * if merging is enabled. + */ + edm::EDGetTokenT inputRawCollectionToken_; + + /** Switch for merging Matacq raw data with existing raw data + * collection. + */ + bool mergeRaw_; + + /** When true look for matacq data independently of trigger type. + */ + bool ignoreTriggerType_; + + MatacqRawEvent matacq_; + + /** Stream of currently opened matacq file + */ + FILE_t inFile_; + + static const int bufferSize = 30000; //must greater or equal to maximum + // matacq event size. + std::vector data_; + MatacqDataFormatter formatter_; + const static int orbitTolerance_; + uint32_t openedFileRunNumber_; + int32_t lastOrb_; + int fastRetrievalThresh_; + + PosEstimator posEstim_; + + timeval startTime_; + + /** File name of table with orbit offset between + * matacq event and DCC. Used to recover data suffering from orbit + * miss-synchonization + */ + std::string orbitOffsetFile_; + + /** Orbit offset table. @see orbitOffsetFile_ + */ + std::map orbitOffset_; + + /** Switch for orbit ID correction. @see orbitOffsetFile_ + */ + bool doOrbitOffset_; + + /** Name of currently opened matacq file + */ + std::string inFileName_; + + static const int matacqFedId_ = 655; + + struct stats_t { + double nEvents; + double nLaserEventsWithMatacq; + double nNonLaserEventsWithMatacq; + } stats_; + + const static stats_t stats_init; + /** Log file name + */ + std::string logFileName_; + + /** Log file + */ + std::ofstream logFile_; + + /** counter for event skipping + */ + int eventSkipCounter_; + + /** Number of events to skip in case of error + */ + int onErrorDisablingEvtCnt_; + + /** Name of file to log timing + */ + std::string timeLogFile_; + /** Buffer for timing + */ + timeval timer_; + + /** Output stream to log code timing + */ + std::ofstream timeLog_; + + /** Switch for code timing. + */ + bool logTiming_; + + /** Number of the currently processed run + */ + uint32_t runNumber_; +}; + +#include +#include #include #include -#include #include #include @@ -15,10 +327,8 @@ #include "DataFormats/EcalDigi/interface/EcalDigiCollections.h" #include "DataFormats/EcalDigi/interface/EcalMatacqDigi.h" -#include "DataFormats/EcalDigi/interface/EcalMatacqDigi.h" #include "DataFormats/FEDRawData/interface/FEDNumbering.h" #include "DataFormats/FEDRawData/interface/FEDRawData.h" -#include "EventFilter/EcalRawToDigi/interface/MatacqProducer.h" #include "EventFilter/EcalRawToDigi/src/Majority.h" #include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/Event.h" @@ -1163,3 +1473,6 @@ bool MatacqProducer::getOrbitRange(uint32_t& firstOrb, uint32_t& lastOrb) { return true; } + +#include "FWCore/Framework/interface/MakerMacros.h" +DEFINE_FWK_MODULE(MatacqProducer); diff --git a/EventFilter/EcalRawToDigi/plugins/SealModules.cc b/EventFilter/EcalRawToDigi/plugins/SealModules.cc deleted file mode 100644 index e1e9ddf7c8539..0000000000000 --- a/EventFilter/EcalRawToDigi/plugins/SealModules.cc +++ /dev/null @@ -1,14 +0,0 @@ -#include - -#include "FWCore/Framework/interface/ModuleFactory.h" -#include "EventFilter/EcalRawToDigi/plugins/EcalRegionCablingESProducer.h" -DEFINE_FWK_EVENTSETUP_MODULE(EcalRegionCablingESProducer); - -#include "EventFilter/EcalRawToDigi/plugins/EcalRawToDigi.h" -DEFINE_FWK_MODULE(EcalRawToDigi); - -#include "EventFilter/EcalRawToDigi/interface/MatacqProducer.h" -DEFINE_FWK_MODULE(MatacqProducer); - -#include "EventFilter/EcalRawToDigi/interface/EcalDumpRaw.h" -DEFINE_FWK_MODULE(EcalDumpRaw); diff --git a/EventFilter/EcalRawToDigi/src/DCCEESRPBlock.cc b/EventFilter/EcalRawToDigi/src/DCCEESRPBlock.cc index 97a1c5dc0b286..65288060996ca 100644 --- a/EventFilter/EcalRawToDigi/src/DCCEESRPBlock.cc +++ b/EventFilter/EcalRawToDigi/src/DCCEESRPBlock.cc @@ -16,7 +16,7 @@ void DCCEESRPBlock::addSRFlagToCollection() { data_++; const uint16_t *my16Bitp_ = reinterpret_cast(data_); - for (unsigned int n = 0; n < expNumbSrFlags_; n++, pSCDetId_++) { + for (unsigned int n = 0; n < expNumbSrFlags_; ++n) { if (n != 0 && n % 4 == 0) my16Bitp_++; diff --git a/EventFilter/EcalRawToDigi/src/MatacqDataFormatter.cc b/EventFilter/EcalRawToDigi/src/MatacqDataFormatter.cc index d0f038d7ef0e0..1c27e3728da07 100644 --- a/EventFilter/EcalRawToDigi/src/MatacqDataFormatter.cc +++ b/EventFilter/EcalRawToDigi/src/MatacqDataFormatter.cc @@ -9,7 +9,6 @@ #include #include #include -#include #include using namespace std; diff --git a/EventFilter/GEMRawToDigi/plugins/GEMRawToDigiModule.cc b/EventFilter/GEMRawToDigi/plugins/GEMRawToDigiModule.cc index 668a86868a26c..b32a97ac13112 100644 --- a/EventFilter/GEMRawToDigi/plugins/GEMRawToDigiModule.cc +++ b/EventFilter/GEMRawToDigi/plugins/GEMRawToDigiModule.cc @@ -46,7 +46,7 @@ class GEMRawToDigiModule : public edm::global::EDProducer fed_token; edm::ESGetToken gemEMapToken_; bool useDBEMap_, keepDAQStatus_, readMultiBX_; - bool unPackStatusDigis_; + unsigned int fedIdStart_, fedIdEnd_; std::unique_ptr gemRawToDigi_; }; @@ -58,6 +58,8 @@ GEMRawToDigiModule::GEMRawToDigiModule(const edm::ParameterSet& pset) useDBEMap_(pset.getParameter("useDBEMap")), keepDAQStatus_(pset.getParameter("keepDAQStatus")), readMultiBX_(pset.getParameter("readMultiBX")), + fedIdStart_(pset.getParameter("fedIdStart")), + fedIdEnd_(pset.getParameter("fedIdEnd")), gemRawToDigi_(std::make_unique()) { produces(); if (keepDAQStatus_) { @@ -77,6 +79,8 @@ void GEMRawToDigiModule::fillDescriptions(edm::ConfigurationDescriptions& descri desc.add("useDBEMap", false); desc.add("keepDAQStatus", false); desc.add("readMultiBX", false); + desc.add("fedIdStart", FEDNumbering::MINGEMFEDID); + desc.add("fedIdEnd", FEDNumbering::MAXGEMFEDID); descriptions.add("muonGEMDigisDefault", desc); } @@ -109,7 +113,7 @@ void GEMRawToDigiModule::produce(edm::StreamID iID, edm::Event& iEvent, edm::Eve auto gemROMap = runCache(iEvent.getRun().index()); - for (unsigned int fedId = FEDNumbering::MINGEMFEDID; fedId <= FEDNumbering::MAXGEMFEDID; ++fedId) { + for (unsigned int fedId = fedIdStart_; fedId <= fedIdEnd_; ++fedId) { const FEDRawData& fedData = fed_buffers->FEDData(fedId); int nWords = fedData.size() / sizeof(uint64_t); diff --git a/EventFilter/L1TRawToDigi/plugins/implementations_stage2/BMTFPackerOutput.cc b/EventFilter/L1TRawToDigi/plugins/implementations_stage2/BMTFPackerOutput.cc index 0e873900c8ef8..1395fd3f06323 100644 --- a/EventFilter/L1TRawToDigi/plugins/implementations_stage2/BMTFPackerOutput.cc +++ b/EventFilter/L1TRawToDigi/plugins/implementations_stage2/BMTFPackerOutput.cc @@ -20,7 +20,7 @@ namespace l1t { for (auto imu = muons->begin(); imu != muons->end(); imu++) { if (imu->processor() + 1 == board_id) { uint32_t firstWord(0), lastWord(0); - RegionalMuonRawDigiTranslator::generatePackedDataWords(*imu, firstWord, lastWord, isKalman_); + RegionalMuonRawDigiTranslator::generatePackedDataWords(*imu, firstWord, lastWord, isKalman_, false); payloadMap_[bmtfBlockID].push_back(firstWord); //imu->link()*2+1 payloadMap_[bmtfBlockID].push_back(lastWord); //imu->link()*2+1 } diff --git a/EventFilter/L1TRawToDigi/plugins/implementations_stage2/BMTFUnpackerOutput.cc b/EventFilter/L1TRawToDigi/plugins/implementations_stage2/BMTFUnpackerOutput.cc index d905880a3fc74..9869cf3afde81 100644 --- a/EventFilter/L1TRawToDigi/plugins/implementations_stage2/BMTFUnpackerOutput.cc +++ b/EventFilter/L1TRawToDigi/plugins/implementations_stage2/BMTFUnpackerOutput.cc @@ -67,7 +67,7 @@ namespace l1t { RegionalMuonCand muCand; RegionalMuonRawDigiTranslator::fillRegionalMuonCand( - muCand, raw_first, raw_secnd, processor, tftype::bmtf, isKalman); + muCand, raw_first, raw_secnd, processor, tftype::bmtf, isKalman, false); if (muCand.hwPt() == 0) { continue; diff --git a/EventFilter/L1TRawToDigi/plugins/implementations_stage2/EMTFBlockGEM.cc b/EventFilter/L1TRawToDigi/plugins/implementations_stage2/EMTFBlockGEM.cc index 8ad17f728eba0..bfe6d0a845501 100644 --- a/EventFilter/L1TRawToDigi/plugins/implementations_stage2/EMTFBlockGEM.cc +++ b/EventFilter/L1TRawToDigi/plugins/implementations_stage2/EMTFBlockGEM.cc @@ -227,11 +227,12 @@ namespace l1t { } } // End loop: for (auto const & iHit : *res_hit) - if (exact_duplicate) - edm::LogWarning("L1T|EMTF") << "EMTF unpacked duplicate GEM digis: BX " << Hit_.BX() << ", endcap " - << Hit_.Endcap() << ", station " << Hit_.Station() << ", neighbor " - << Hit_.Neighbor() << ", ring " << Hit_.Ring() << ", chamber " << Hit_.Chamber() - << ", roll " << Hit_.Roll() << ", pad " << Hit_.Pad() << std::endl; + // TODO: Re-enable once GEM TP data format is fixed + // if (exact_duplicate) + // edm::LogWarning("L1T|EMTF") << "EMTF unpacked duplicate GEM digis: BX " << Hit_.BX() << ", endcap " + // << Hit_.Endcap() << ", station " << Hit_.Station() << ", neighbor " + // << Hit_.Neighbor() << ", ring " << Hit_.Ring() << ", chamber " << Hit_.Chamber() + // << ", roll " << Hit_.Roll() << ", pad " << Hit_.Pad() << std::endl; (res->at(iOut)).push_GEM(GEM_); if (!exact_duplicate) diff --git a/EventFilter/L1TRawToDigi/plugins/implementations_stage2/GMTSetup.cc b/EventFilter/L1TRawToDigi/plugins/implementations_stage2/GMTSetup.cc index 83f29e7f27b62..c4508e7763388 100644 --- a/EventFilter/L1TRawToDigi/plugins/implementations_stage2/GMTSetup.cc +++ b/EventFilter/L1TRawToDigi/plugins/implementations_stage2/GMTSetup.cc @@ -43,8 +43,11 @@ namespace l1t { if (fed == 1402) { auto gmt_in_packer = static_pointer_cast( PackerFactory::get()->make("stage2::RegionalMuonGMTPacker")); + if (fw >= 0x6010000) { + gmt_in_packer->setUseEmtfDisplacementInfo(); + } if (fw >= 0x6000000) { - gmt_in_packer->setIsRun3(); + gmt_in_packer->setIsKbmtf(); } auto gmt_out_packer = static_pointer_cast(PackerFactory::get()->make("stage2::GMTMuonPacker")); @@ -86,8 +89,11 @@ namespace l1t { // input muons on links 36-71 auto gmt_in_unp = static_pointer_cast( UnpackerFactory::get()->make("stage2::RegionalMuonGMTUnpacker")); + if (fw >= 0x6010000) { + gmt_in_unp->setUseEmtfDisplacementInfo(); + } if (fw >= 0x6000000) { - gmt_in_unp->setIsRun3(); + gmt_in_unp->setIsKbmtf(); } for (int iLink = 72; iLink < 144; iLink += 2) { diff --git a/EventFilter/L1TRawToDigi/plugins/implementations_stage2/RegionalMuonGMTPacker.cc b/EventFilter/L1TRawToDigi/plugins/implementations_stage2/RegionalMuonGMTPacker.cc index 64ed17ecf676b..36301c3037568 100644 --- a/EventFilter/L1TRawToDigi/plugins/implementations_stage2/RegionalMuonGMTPacker.cc +++ b/EventFilter/L1TRawToDigi/plugins/implementations_stage2/RegionalMuonGMTPacker.cc @@ -54,7 +54,7 @@ namespace l1t { uint32_t msw = 0; uint32_t lsw = 0; - RegionalMuonRawDigiTranslator::generatePackedDataWords(*mu, lsw, msw, isRun3_); + RegionalMuonRawDigiTranslator::generatePackedDataWords(*mu, lsw, msw, isKbmtf_, useEmtfDisplacementInfo_); payloadMap[linkTimes2].push_back(lsw); payloadMap[linkTimes2].push_back(msw); diff --git a/EventFilter/L1TRawToDigi/plugins/implementations_stage2/RegionalMuonGMTPacker.h b/EventFilter/L1TRawToDigi/plugins/implementations_stage2/RegionalMuonGMTPacker.h index 67fa5f14d8aa7..e3feb1bce562b 100644 --- a/EventFilter/L1TRawToDigi/plugins/implementations_stage2/RegionalMuonGMTPacker.h +++ b/EventFilter/L1TRawToDigi/plugins/implementations_stage2/RegionalMuonGMTPacker.h @@ -13,13 +13,15 @@ namespace l1t { class RegionalMuonGMTPacker : public Packer { public: Blocks pack(const edm::Event&, const PackerTokens*) override; - void setIsRun3() { isRun3_ = true; }; + void setIsKbmtf() { isKbmtf_ = true; }; + void setUseEmtfDisplacementInfo() { useEmtfDisplacementInfo_ = true; }; private: typedef std::map> PayloadMap; void packTF(const edm::Event&, const edm::EDGetTokenT&, Blocks&); - bool isRun3_{false}; + bool isKbmtf_{false}; + bool useEmtfDisplacementInfo_{false}; }; } // namespace stage2 } // namespace l1t diff --git a/EventFilter/L1TRawToDigi/plugins/implementations_stage2/RegionalMuonGMTUnpacker.cc b/EventFilter/L1TRawToDigi/plugins/implementations_stage2/RegionalMuonGMTUnpacker.cc index d58909a9395fe..57a603a82294e 100644 --- a/EventFilter/L1TRawToDigi/plugins/implementations_stage2/RegionalMuonGMTUnpacker.cc +++ b/EventFilter/L1TRawToDigi/plugins/implementations_stage2/RegionalMuonGMTUnpacker.cc @@ -102,7 +102,7 @@ namespace l1t { RegionalMuonCand mu; RegionalMuonRawDigiTranslator::fillRegionalMuonCand( - mu, raw_data_00_31, raw_data_32_63, processor, trackFinder, isRun3_); + mu, raw_data_00_31, raw_data_32_63, processor, trackFinder, isKbmtf_, useEmtfDisplacementInfo_); LogDebug("L1T") << "Mu" << nWord / 2 << ": eta " << mu.hwEta() << " phi " << mu.hwPhi() << " pT " << mu.hwPt() << " qual " << mu.hwQual() << " sign " << mu.hwSign() << " sign valid " diff --git a/EventFilter/L1TRawToDigi/plugins/implementations_stage2/RegionalMuonGMTUnpacker.h b/EventFilter/L1TRawToDigi/plugins/implementations_stage2/RegionalMuonGMTUnpacker.h index 43362150b2a53..f991d1cffdca1 100644 --- a/EventFilter/L1TRawToDigi/plugins/implementations_stage2/RegionalMuonGMTUnpacker.h +++ b/EventFilter/L1TRawToDigi/plugins/implementations_stage2/RegionalMuonGMTUnpacker.h @@ -10,13 +10,15 @@ namespace l1t { class RegionalMuonGMTUnpacker : public Unpacker { public: bool unpack(const Block& block, UnpackerCollections* coll) override; - void setIsRun3() { isRun3_ = true; } + void setIsKbmtf() { isKbmtf_ = true; } + void setUseEmtfDisplacementInfo() { useEmtfDisplacementInfo_ = true; } private: static constexpr unsigned nWords_ = 6; // every link transmits 6 words (3 muons) per bx static constexpr unsigned bxzs_enable_shift_ = 1; - bool isRun3_{false}; + bool isKbmtf_{false}; + bool useEmtfDisplacementInfo_{false}; }; } // namespace stage2 } // namespace l1t diff --git a/EventFilter/L1TRawToDigi/python/gmtStage2Raw_cfi.py b/EventFilter/L1TRawToDigi/python/gmtStage2Raw_cfi.py index 2e35f21005890..eb031df1e82fd 100644 --- a/EventFilter/L1TRawToDigi/python/gmtStage2Raw_cfi.py +++ b/EventFilter/L1TRawToDigi/python/gmtStage2Raw_cfi.py @@ -13,7 +13,7 @@ ImdInputLabelOMTFNeg = cms.InputTag("simGmtStage2Digis", "imdMuonsOMTFNeg"), ImdInputLabelOMTFPos = cms.InputTag("simGmtStage2Digis", "imdMuonsOMTFPos"), FedId = cms.int32(1402), - FWId = cms.uint32(0x6000000), # FW version in GMT with displaced muon information + FWId = cms.uint32(0x3000000), # First used uGMT firmware version lenSlinkHeader = cms.untracked.int32(8), lenSlinkTrailer = cms.untracked.int32(8) ) @@ -32,4 +32,4 @@ ### Era: Run3_2021 from Configuration.Eras.Modifier_stage2L1Trigger_2021_cff import stage2L1Trigger_2021 -stage2L1Trigger_2021.toModify(gmtStage2Raw, BMTFInputLabel = cms.InputTag("simKBmtfDigis", "BMTF"), FWId = cms.uint32(0x6000000)) +stage2L1Trigger_2021.toModify(gmtStage2Raw, BMTFInputLabel = cms.InputTag("simKBmtfDigis", "BMTF"), FWId = cms.uint32(0x6010000)) diff --git a/EventFilter/L1TRawToDigi/src/MP7FileReader.cc b/EventFilter/L1TRawToDigi/src/MP7FileReader.cc index 2427fcf26c9a7..5ddf8096390e6 100644 --- a/EventFilter/L1TRawToDigi/src/MP7FileReader.cc +++ b/EventFilter/L1TRawToDigi/src/MP7FileReader.cc @@ -5,7 +5,6 @@ #include #include -#include #include #include @@ -165,9 +164,9 @@ std::vector MP7FileReader::searchLinks() { boost::split(tokens, tmp, boost::is_any_of(" \t"), boost::token_compress_on); // Convert it into uint32 s std::vector links; - std::transform( - tokens.begin(), tokens.end(), std::back_inserter(links), boost::lexical_cast); - return links; + std::transform(tokens.begin(), tokens.end(), std::back_inserter(links), [](const std::string& str) { + return std::stoul(str); + }); } else { throw std::logic_error("Unexpected line found!"); } @@ -201,7 +200,7 @@ std::vector > MP7FileReader::readRows() { if (boost::regex_match(line, what, reFrame_)) { // check frame number - uint32_t n = boost::lexical_cast(what[1].str()); + uint32_t n = std::stoul(what[1].str()); if (n != data.size()) { std::stringstream ss; diff --git a/EventFilter/L1TXRawToDigi/test/BuildFile.xml b/EventFilter/L1TXRawToDigi/test/BuildFile.xml index 710fb5b3db7b6..6f0d4939f630b 100644 --- a/EventFilter/L1TXRawToDigi/test/BuildFile.xml +++ b/EventFilter/L1TXRawToDigi/test/BuildFile.xml @@ -1,3 +1,4 @@ + diff --git a/EventFilter/RPCRawToDigi/interface/RPCRawSynchro.h b/EventFilter/RPCRawToDigi/interface/RPCRawSynchro.h deleted file mode 100644 index 446b390012f91..0000000000000 --- a/EventFilter/RPCRawToDigi/interface/RPCRawSynchro.h +++ /dev/null @@ -1 +0,0 @@ -#include "DataFormats/RPCDigi/interface/RPCRawSynchro.h" diff --git a/EventFilter/RPCRawToDigi/plugins/RPCUnpackingModule.cc b/EventFilter/RPCRawToDigi/plugins/RPCUnpackingModule.cc index 12a6c1d19d109..c82a1d399e111 100644 --- a/EventFilter/RPCRawToDigi/plugins/RPCUnpackingModule.cc +++ b/EventFilter/RPCRawToDigi/plugins/RPCUnpackingModule.cc @@ -20,8 +20,6 @@ #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "CondFormats/RPCObjects/interface/RPCEMap.h" -#include "CondFormats/DataRecord/interface/RPCEMapRcd.h" #include "DataFormats/RPCDigi/interface/DataRecord.h" #include "DataFormats/RPCDigi/interface/ReadoutError.h" #include "DataFormats/RPCDigi/interface/RPCRawSynchro.h" @@ -41,6 +39,7 @@ RPCUnpackingModule::RPCUnpackingModule(const edm::ParameterSet& pset) : dataLabel_(pset.getParameter("InputLabel")), doSynchro_(pset.getParameter("doSynchro")), eventCounter_(0), + theReadoutMappingToken(esConsumes()), theCabling(nullptr) { produces(); produces(); @@ -62,8 +61,7 @@ void RPCUnpackingModule::beginRun(const edm::Run& run, const edm::EventSetup& es if (theRecordWatcher.check(es)) { LogTrace("") << "record has CHANGED!!, (re)initialise readout map!"; delete theCabling; - ESTransientHandle readoutMapping; - es.get().get(readoutMapping); + ESTransientHandle readoutMapping = es.getTransientHandle(theReadoutMappingToken); theCabling = readoutMapping->convert(); theReadoutMappingSearch.init(theCabling); LogTrace("") << " READOUT MAP VERSION: " << theCabling->version() << endl; diff --git a/EventFilter/RPCRawToDigi/plugins/RPCUnpackingModule.h b/EventFilter/RPCRawToDigi/plugins/RPCUnpackingModule.h index ea7a4d7846490..c1237dd93c9f6 100644 --- a/EventFilter/RPCRawToDigi/plugins/RPCUnpackingModule.h +++ b/EventFilter/RPCRawToDigi/plugins/RPCUnpackingModule.h @@ -9,6 +9,7 @@ #include "FWCore/Utilities/interface/InputTag.h" #include "FWCore/Framework/interface/ESWatcher.h" #include "CondFormats/DataRecord/interface/RPCEMapRcd.h" +#include "CondFormats/RPCObjects/interface/RPCEMap.h" #include "RPCReadOutMappingWithFastSearch.h" #include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h" @@ -42,6 +43,7 @@ class RPCUnpackingModule : public edm::stream::EDProducer<> { unsigned long eventCounter_; edm::ESWatcher theRecordWatcher; + edm::ESGetToken theReadoutMappingToken; const RPCReadOutMapping* theCabling; RPCReadOutMappingWithFastSearch theReadoutMappingSearch; edm::EDGetTokenT fedToken_; diff --git a/EventFilter/RPCRawToDigi/python/RPCCPPFRawToDigi_cfi.py b/EventFilter/RPCRawToDigi/python/RPCCPPFRawToDigi_cfi.py index 53683de57bd8d..f8dbdb8644429 100644 --- a/EventFilter/RPCRawToDigi/python/RPCCPPFRawToDigi_cfi.py +++ b/EventFilter/RPCRawToDigi/python/RPCCPPFRawToDigi_cfi.py @@ -1,13 +1,7 @@ import FWCore.ParameterSet.Config as cms +import EventFilter.RPCRawToDigi.RPCAMCRawToDigi_cfi as _mod -rpcCPPFRawToDigi = cms.EDProducer('RPCAMCRawToDigi', - inputTag = cms.InputTag('rawDataCollector'), - calculateCRC = cms.bool(True), - fillCounters = cms.bool(True), - RPCAMCUnpacker = cms.string('RPCCPPFUnpacker'), - RPCAMCUnpackerSettings = cms.PSet( - fillAMCCounters = cms.bool(True), - bxMin = cms.int32(-2), - bxMax = cms.int32(2) - ) +rpcCPPFRawToDigi = _mod.RPCAMCRawToDigi.clone( + RPCAMCUnpacker = 'RPCCPPFUnpacker', + RPCAMCUnpackerSettings = dict() ) diff --git a/EventFilter/Utilities/interface/AuxiliaryMakers.h b/EventFilter/Utilities/interface/AuxiliaryMakers.h index 00d15bc0081b1..39cee97ed042f 100644 --- a/EventFilter/Utilities/interface/AuxiliaryMakers.h +++ b/EventFilter/Utilities/interface/AuxiliaryMakers.h @@ -12,7 +12,8 @@ namespace evf { bool isRealData, const edm::EventAuxiliary::ExperimentType&, const std::string& processGUID, - bool verifyLumiSection); + bool verifyLumiSection, + bool suppressWarning); } } // namespace evf #endif diff --git a/EventFilter/Utilities/interface/EvFDaqDirector.h b/EventFilter/Utilities/interface/EvFDaqDirector.h index 2043ce884727e..1c78cfa0c4be6 100644 --- a/EventFilter/Utilities/interface/EvFDaqDirector.h +++ b/EventFilter/Utilities/interface/EvFDaqDirector.h @@ -127,7 +127,8 @@ namespace evf { void createBoLSFile(const uint32_t lumiSection, bool checkIfExists) const; void createLumiSectionFiles(const uint32_t lumiSection, const uint32_t currentLumiSection, - bool doCreateBoLS = true); + bool doCreateBoLS, + bool doCreateEoLS); static int parseFRDFileHeader(std::string const& rawSourcePath, int& rawFd, uint16_t& rawHeaderSize, diff --git a/EventFilter/Utilities/interface/FedRawDataInputSource.h b/EventFilter/Utilities/interface/FedRawDataInputSource.h index b68c98ca9a624..005e103daa8e8 100644 --- a/EventFilter/Utilities/interface/FedRawDataInputSource.h +++ b/EventFilter/Utilities/interface/FedRawDataInputSource.h @@ -60,7 +60,7 @@ class FedRawDataInputSource : public edm::RawInputSource { void maybeOpenNewLumiSection(const uint32_t lumiSection); evf::EvFDaqDirector::FileStatus nextEvent(); evf::EvFDaqDirector::FileStatus getNextEvent(); - edm::Timestamp fillFEDRawDataCollection(FEDRawDataCollection&); + edm::Timestamp fillFEDRawDataCollection(FEDRawDataCollection& rawData, bool& tcdsInRange); void readSupervisor(); void readWorker(unsigned int tid); diff --git a/EventFilter/Utilities/interface/ModuleWeb.h b/EventFilter/Utilities/interface/ModuleWeb.h deleted file mode 100644 index f7c94bfaa47e0..0000000000000 --- a/EventFilter/Utilities/interface/ModuleWeb.h +++ /dev/null @@ -1,51 +0,0 @@ -#ifndef EVF_MODULEWEB_H -#define EVF_MODULEWEB_H - -//#include "toolbox/lang/Class.h" -//#include "xdata/InfoSpace.h" -#include -#include -#include - - - - namespace evf - { - - - namespace moduleweb { - class ForkParams { - public: - ForkParams():slotId(-1),restart(0),isMaster(-1){} - int slotId; - bool restart; - int isMaster; - }; - class ForkInfoObj { - public: - ForkInfoObj() - { - control_sem_ = new sem_t; - sem_init(control_sem_,0,0); - stopCondition=0; - receivedStop_=false; - } - ~ForkInfoObj() - { - sem_destroy(control_sem_); - delete control_sem_; - } - void lock() {if (mst_lock_) pthread_mutex_lock(mst_lock_);} - void unlock() {if (mst_lock_) pthread_mutex_unlock(mst_lock_);} - void (*forkHandler) (void *); - ForkParams forkParams; - unsigned int stopCondition; - bool receivedStop_; - sem_t *control_sem_; - pthread_mutex_t * mst_lock_; - void * fuAddr; - }; - } - -} -#endif diff --git a/EventFilter/Utilities/interface/config_json.h b/EventFilter/Utilities/interface/config_json.h deleted file mode 100644 index 5d334cbc5e6b9..0000000000000 --- a/EventFilter/Utilities/interface/config_json.h +++ /dev/null @@ -1,43 +0,0 @@ -#ifndef JSON_CONFIG_H_INCLUDED -# define JSON_CONFIG_H_INCLUDED - -/// If defined, indicates that json library is embedded in CppTL library. -//# define JSON_IN_CPPTL 1 - -/// If defined, indicates that json may leverage CppTL library -//# define JSON_USE_CPPTL 1 -/// If defined, indicates that cpptl vector based map should be used instead of std::map -/// as Value container. -//# define JSON_USE_CPPTL_SMALLMAP 1 -/// If defined, indicates that Json specific container should be used -/// (hash table & simple deque container with customizable allocator). -/// THIS FEATURE IS STILL EXPERIMENTAL! -//# define JSON_VALUE_USE_INTERNAL_MAP 1 -/// Force usage of standard new/malloc based allocator instead of memory pool based allocator. -/// The memory pools allocator used optimization (initializing Value and ValueInternalLink -/// as if it was a POD) that may cause some validation tool to report errors. -/// Only has effects if JSON_VALUE_USE_INTERNAL_MAP is defined. -//# define JSON_USE_SIMPLE_INTERNAL_ALLOCATOR 1 - -/// If defined, indicates that Json use exception to report invalid type manipulation -/// instead of C assert macro. -# define JSON_USE_EXCEPTION 1 - -# ifdef JSON_IN_CPPTL -# include -# ifndef JSON_USE_CPPTL -# define JSON_USE_CPPTL 1 -# endif -# endif - -# ifdef JSON_IN_CPPTL -# define JSON_API CPPTL_API -# elif defined(JSON_DLL_BUILD) -# define JSON_API __declspec(dllexport) -# elif defined(JSON_DLL) -# define JSON_API __declspec(dllimport) -# else -# define JSON_API -# endif - -#endif // JSON_CONFIG_H_INCLUDED diff --git a/EventFilter/Utilities/plugins/DaqFakeReader.cc b/EventFilter/Utilities/plugins/DaqFakeReader.cc index 7bc931d1658a2..60fd1ace513ea 100644 --- a/EventFilter/Utilities/plugins/DaqFakeReader.cc +++ b/EventFilter/Utilities/plugins/DaqFakeReader.cc @@ -20,6 +20,8 @@ #include #include #include +#include +#include using namespace std; using namespace edm; @@ -33,6 +35,7 @@ DaqFakeReader::DaqFakeReader(const edm::ParameterSet& pset) : runNum(1), eventNum(1), empty_events(pset.getUntrackedParameter("emptyEvents", false)), + fillRandom_(pset.getUntrackedParameter("fillRandom", false)), meansize(pset.getUntrackedParameter("meanSize", 1024)), width(pset.getUntrackedParameter("width", 1024)), injected_errors_per_million_events(pset.getUntrackedParameter("injectErrPpm", 0)), @@ -43,6 +46,12 @@ DaqFakeReader::DaqFakeReader(const edm::ParameterSet& pset) if (tcdsFEDID_ < FEDNumbering::MINTCDSuTCAFEDID) throw cms::Exception("DaqFakeReader::DaqFakeReader") << " TCDS FED ID lower than " << FEDNumbering::MINTCDSuTCAFEDID; + if (fillRandom_) { + //intialize random seed + auto time_count = + static_cast(std::chrono::high_resolution_clock::now().time_since_epoch().count()); + srand(time_count & 0xffffffff); + } produces(); } @@ -102,6 +111,18 @@ void DaqFakeReader::fillFEDs( // Allocate space for header+trailer+payload feddata.resize(size + 16); + if (fillRandom_) { + //fill FED with random values + size_t size_ui = size - size % sizeof(unsigned int); + for (size_t i = 0; i < size_ui; i += sizeof(unsigned int)) { + *((unsigned int*)(feddata.data() + i)) = (unsigned int)rand(); + } + //remainder + for (size_t i = size_ui; i < size; i++) { + *(feddata.data() + i) = rand() & 0xff; + } + } + // Generate header FEDHeader::set(feddata.data(), 1, // Trigger type @@ -164,3 +185,15 @@ void DaqFakeReader::beginLuminosityBlock(LuminosityBlock const& iL, EventSetup c std::cout << "DaqFakeReader begin Lumi " << iL.luminosityBlock() << std::endl; fakeLs_ = iL.luminosityBlock(); } + +void DaqFakeReader::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + desc.setComment("Injector of generated raw FED data for DAQ testing"); + desc.addUntracked("emptyEvents", false); + desc.addUntracked("fillRandom", false); + desc.addUntracked("meanSize", 1024); + desc.addUntracked("width", 1024); + desc.addUntracked("injectErrPpm", 1024); + desc.addUntracked("tcdsFEDID", 1024); + descriptions.add("DaqFakeReader", desc); +} diff --git a/EventFilter/Utilities/plugins/DaqFakeReader.h b/EventFilter/Utilities/plugins/DaqFakeReader.h index 94d9d6d79bd4b..33152b790c686 100644 --- a/EventFilter/Utilities/plugins/DaqFakeReader.h +++ b/EventFilter/Utilities/plugins/DaqFakeReader.h @@ -7,6 +7,7 @@ * \author N. Amapane - CERN */ +#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" #include "FWCore/Framework/interface/one/EDProducer.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" @@ -33,6 +34,8 @@ class DaqFakeReader : public edm::one::EDProducer<> { void produce(edm::Event&, edm::EventSetup const&) override; + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + private: // // private member functions @@ -48,6 +51,7 @@ class DaqFakeReader : public edm::one::EDProducer<> { edm::RunNumber_t runNum; edm::EventNumber_t eventNum; bool empty_events; + bool fillRandom_; unsigned int meansize; // in bytes unsigned int width; unsigned int injected_errors_per_million_events; diff --git a/EventFilter/Utilities/src/AuxiliaryMakers.cc b/EventFilter/Utilities/src/AuxiliaryMakers.cc index a11ccd229fa09..5886700681e86 100644 --- a/EventFilter/Utilities/src/AuxiliaryMakers.cc +++ b/EventFilter/Utilities/src/AuxiliaryMakers.cc @@ -12,7 +12,8 @@ namespace evf { bool isRealData, const edm::EventAuxiliary::ExperimentType& eventType, const std::string& processGUID, - bool verifyLumiSection) { + bool verifyLumiSection, + bool suppressWarning) { edm::EventID eventId(runNumber, // check that runnumber from record is consistent lumiSection, tcds->header.eventNumber); @@ -29,7 +30,7 @@ namespace evf { const uint64_t orbitnr = ((uint64_t)tcds->header.orbitHigh << 16) | tcds->header.orbitLow; const uint32_t recordLumiSection = tcds->header.lumiSection; - if (isRealData) { + if (isRealData && !suppressWarning) { //warnings are disabled for generated data if (verifyLumiSection && recordLumiSection != lumiSection) edm::LogWarning("AuxiliaryMakers") diff --git a/EventFilter/Utilities/src/EvFDaqDirector.cc b/EventFilter/Utilities/src/EvFDaqDirector.cc index 1a8aa796e8ed5..46ecb013799e4 100644 --- a/EventFilter/Utilities/src/EvFDaqDirector.cc +++ b/EventFilter/Utilities/src/EvFDaqDirector.cc @@ -22,7 +22,6 @@ #include #include #include -#include #include //using boost::asio::ip::tcp; @@ -84,10 +83,10 @@ namespace evf { char* fuLockPollIntervalPtr = std::getenv("FFF_LOCKPOLLINTERVAL"); if (fuLockPollIntervalPtr) { try { - fuLockPollInterval_ = boost::lexical_cast(std::string(fuLockPollIntervalPtr)); + fuLockPollInterval_ = std::stoul(std::string(fuLockPollIntervalPtr)); edm::LogInfo("EvFDaqDirector") << "Setting fu lock poll interval by environment string: " << fuLockPollInterval_ << " us"; - } catch (boost::bad_lexical_cast const&) { + } catch (const std::exception&) { edm::LogWarning("EvFDaqDirector") << "Bad lexical cast in parsing: " << std::string(fuLockPollIntervalPtr); } } @@ -96,9 +95,9 @@ namespace evf { char* fileBrokerParamPtr = std::getenv("FFF_USEFILEBROKER"); if (fileBrokerParamPtr) { try { - useFileBroker_ = (boost::lexical_cast(std::string(fileBrokerParamPtr))) > 0; + useFileBroker_ = (std::stoul(std::string(fileBrokerParamPtr))) > 0; edm::LogInfo("EvFDaqDirector") << "Setting useFileBroker parameter by environment string: " << useFileBroker_; - } catch (boost::bad_lexical_cast const&) { + } catch (const std::exception&) { edm::LogWarning("EvFDaqDirector") << "Bad lexical cast in parsing: " << std::string(fileBrokerParamPtr); } } @@ -126,9 +125,9 @@ namespace evf { char* startFromLSPtr = std::getenv("FFF_START_LUMISECTION"); if (startFromLSPtr) { try { - startFromLS_ = boost::lexical_cast(std::string(startFromLSPtr)); + startFromLS_ = std::stoul(std::string(startFromLSPtr)); edm::LogInfo("EvFDaqDirector") << "Setting start from LS by environment string: " << startFromLS_; - } catch (boost::bad_lexical_cast const&) { + } catch (const std::exception&) { edm::LogWarning("EvFDaqDirector") << "Bad lexical cast in parsing: " << std::string(startFromLSPtr); } } @@ -137,10 +136,10 @@ namespace evf { char* fileBrokerUseLockParamPtr = std::getenv("FFF_FILEBROKERUSELOCALLOCK"); if (fileBrokerUseLockParamPtr) { try { - fileBrokerUseLocalLock_ = (boost::lexical_cast(std::string(fileBrokerUseLockParamPtr))) > 0; + fileBrokerUseLocalLock_ = (std::stoul(std::string(fileBrokerUseLockParamPtr))) > 0; edm::LogInfo("EvFDaqDirector") << "Setting fileBrokerUseLocalLock parameter by environment string: " << fileBrokerUseLocalLock_; - } catch (boost::bad_lexical_cast const&) { + } catch (const std::exception&) { edm::LogWarning("EvFDaqDirector") << "Bad lexical cast in parsing: " << std::string(fileBrokerUseLockParamPtr); } } @@ -773,7 +772,7 @@ namespace evf { edm::LogError("EvFDaqDirector") << " error reading number of files from BU JSON -: " << BUEoLSFile; return -1; } - return boost::lexical_cast(data); + return std::stoi(data); } bool EvFDaqDirector::bumpFile(unsigned int& ls, @@ -942,14 +941,18 @@ namespace evf { void EvFDaqDirector::createLumiSectionFiles(const uint32_t lumiSection, const uint32_t currentLumiSection, - bool doCreateBoLS) { + bool doCreateBoLS, + bool doCreateEoLS) { if (currentLumiSection > 0) { const std::string fuEoLS = getEoLSFilePathOnFU(currentLumiSection); struct stat buf; bool found = (stat(fuEoLS.c_str(), &buf) == 0); if (!found) { - int eol_fd = open(fuEoLS.c_str(), O_RDWR | O_CREAT, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH); - close(eol_fd); + if (doCreateEoLS) { + int eol_fd = + open(fuEoLS.c_str(), O_RDWR | O_CREAT, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH); + close(eol_fd); + } if (doCreateBoLS) createBoLSFile(lumiSection, false); } @@ -1326,8 +1329,8 @@ namespace evf { if (i < dp.getData().size()) { std::string dataSize = dp.getData()[i]; try { - fileSizeFromJson = boost::lexical_cast(dataSize); - } catch (boost::bad_lexical_cast const&) { + fileSizeFromJson = std::stol(dataSize); + } catch (const std::exception&) { //non-fatal currently, processing can continue without this value edm::LogWarning("EvFDaqDirector") << "grabNextJsonFile - error parsing number of Bytes from BU JSON. " << "Input value is -: " << dataSize; @@ -1336,10 +1339,13 @@ namespace evf { } } } - return boost::lexical_cast(data); - } catch (boost::bad_lexical_cast const& e) { + return std::stoi(data); + } catch (const std::out_of_range& e) { edm::LogError("EvFDaqDirector") << "grabNextJsonFile - error parsing number of events from BU JSON. " << "Input value is -: " << data; + } catch (const std::invalid_argument& e) { + edm::LogError("EvFDaqDirector") << "grabNextJsonFile - argument error parsing events from BU JSON. " + << "Input value is -: " << data; } catch (std::runtime_error const& e) { //Can be thrown by Json parser edm::LogError("EvFDaqDirector") << "grabNextJsonFile - std::runtime_error exception -: " << e.what(); @@ -1423,7 +1429,7 @@ namespace evf { throw cms::Exception("EvFDaqDirector::grabNextJsonFileUnlock") << " error reading number of events from BU JSON -: No input value " << data; } - return boost::lexical_cast(data); + return std::stoi(data); } catch (std::filesystem::filesystem_error const& ex) { // Input dir gone? unlockFULocal(); @@ -1432,9 +1438,12 @@ namespace evf { // Another process grabbed the file and NFS did not register this unlockFULocal(); edm::LogError("EvFDaqDirector") << "grabNextFile runtime Exception -: " << e.what(); - } catch (boost::bad_lexical_cast const&) { + } catch (const std::out_of_range&) { edm::LogError("EvFDaqDirector") << "grabNextFile error parsing number of events from BU JSON. " << "Input value is -: " << data; + } catch (const std::invalid_argument&) { + edm::LogError("EvFDaqDirector") << "grabNextFile argument error parsing events from BU JSON. " + << "Input value is -: " << data; } catch (std::exception const& e) { // BU run directory disappeared? unlockFULocal(); @@ -1677,8 +1686,10 @@ namespace evf { serverError = true; } } + break; } + } catch (std::exception const& e) { edm::LogWarning("EvFDaqDirector") << "Exception in socket handling"; serverError = true; @@ -1704,6 +1715,7 @@ namespace evf { fileStatus = noFile; sleep(1); //back-off if error detected } + return fileStatus; } @@ -1760,7 +1772,7 @@ namespace evf { //local lock to force index json and EoLS files to appear in order if (fileBrokerUseLocalLock_) - lockFULocal2(); + lockFULocal(); int maxLS = stopFileLS < 0 ? -1 : std::max(stopFileLS, (int)currentLumiSection); bool rawHeader = false; @@ -1770,22 +1782,21 @@ namespace evf { if (serverError) { //do not update anything if (fileBrokerUseLocalLock_) - unlockFULocal2(); + unlockFULocal(); return noFile; } - //handle creation of EoLS and BoLS files if lumisection has changed + //handle creation of BoLS files if lumisection has changed if (currentLumiSection == 0) { - if (fileStatus == runEnded) { - createLumiSectionFiles(closedServerLS, 0); - createLumiSectionFiles(serverLS, closedServerLS, false); // +1 - } else - createLumiSectionFiles(serverLS, 0); + if (fileStatus == runEnded) + createLumiSectionFiles(closedServerLS, 0, true, false); + else + createLumiSectionFiles(serverLS, 0, true, false); } else { - //loop over and create any EoLS files missing if (closedServerLS >= currentLumiSection) { + //only BoLS files for (uint32_t i = std::max(currentLumiSection, 1U); i <= closedServerLS; i++) - createLumiSectionFiles(i + 1, i); + createLumiSectionFiles(i + 1, i, true, false); } } @@ -1803,6 +1814,11 @@ namespace evf { close(rawFd); rawFd = -1; } + + //can unlock because all files have been created locally + if (fileBrokerUseLocalLock_) + unlockFULocal(); + if (!fileFound) { //catch condition where directory got deleted fileStatus = noFile; @@ -1813,9 +1829,26 @@ namespace evf { } } - //can unlock because all files have been created locally - if (fileBrokerUseLocalLock_) + //handle creation of EoLS files if lumisection has changed, this needs to be locked exclusively + //so that EoLS files can not appear locally before index files + if (currentLumiSection == 0) { + lockFULocal2(); + if (fileStatus == runEnded) { + createLumiSectionFiles(closedServerLS, 0, false, true); + createLumiSectionFiles(serverLS, closedServerLS, false, true); // +1 + } else { + createLumiSectionFiles(serverLS, 0, false, true); + } unlockFULocal2(); + } else { + if (closedServerLS >= currentLumiSection) { + //lock exclusive to create EoLS files + lockFULocal2(); + for (uint32_t i = std::max(currentLumiSection, 1U); i <= closedServerLS; i++) + createLumiSectionFiles(i + 1, i, false, true); + unlockFULocal2(); + } + } if (fileStatus == runEnded) ls = std::max(currentLumiSection, serverLS); diff --git a/EventFilter/Utilities/src/FedRawDataInputSource.cc b/EventFilter/Utilities/src/FedRawDataInputSource.cc index 486b11633c15a..74ea18400e35d 100644 --- a/EventFilter/Utilities/src/FedRawDataInputSource.cc +++ b/EventFilter/Utilities/src/FedRawDataInputSource.cc @@ -46,8 +46,6 @@ //JSON file reader #include "EventFilter/Utilities/interface/reader.h" -#include - using namespace evf::FastMonState; FedRawDataInputSource::FedRawDataInputSource(edm::ParameterSet const& pset, edm::InputSourceDescription const& desc) @@ -613,7 +611,8 @@ inline evf::EvFDaqDirector::FileStatus FedRawDataInputSource::getNextEvent() { void FedRawDataInputSource::read(edm::EventPrincipal& eventPrincipal) { setMonState(inReadEvent); std::unique_ptr rawData(new FEDRawDataCollection); - edm::Timestamp tstamp = fillFEDRawDataCollection(*rawData); + bool tcdsInRange; + edm::Timestamp tstamp = fillFEDRawDataCollection(*rawData, tcdsInRange); if (useL1EventID_) { eventID_ = edm::EventID(eventRunNumber_, currentLumiSection_, L1EventID_); @@ -639,7 +638,8 @@ void FedRawDataInputSource::read(edm::EventPrincipal& eventPrincipal) { event_->isRealData(), static_cast(fedHeader.triggerType()), processGUID(), - !fileListLoopMode_); + !fileListLoopMode_, + !tcdsInRange); aux.setProcessHistoryID(processHistoryID_); makeEvent(eventPrincipal, aux); } @@ -684,7 +684,7 @@ void FedRawDataInputSource::read(edm::EventPrincipal& eventPrincipal) { return; } -edm::Timestamp FedRawDataInputSource::fillFEDRawDataCollection(FEDRawDataCollection& rawData) { +edm::Timestamp FedRawDataInputSource::fillFEDRawDataCollection(FEDRawDataCollection& rawData, bool& tcdsInRange) { edm::TimeValue_t time; timeval stv; gettimeofday(&stv, nullptr); @@ -696,6 +696,7 @@ edm::Timestamp FedRawDataInputSource::fillFEDRawDataCollection(FEDRawDataCollect unsigned char* event = (unsigned char*)event_->payload(); GTPEventID_ = 0; tcds_pointer_ = nullptr; + tcdsInRange = false; uint16_t selectedTCDSFed = 0; while (eventSize > 0) { assert(eventSize >= FEDTrailer::length); @@ -712,6 +713,9 @@ edm::Timestamp FedRawDataInputSource::fillFEDRawDataCollection(FEDRawDataCollect if (!selectedTCDSFed) { selectedTCDSFed = fedId; tcds_pointer_ = event + eventSize; + if (fedId >= FEDNumbering::MINTCDSuTCAFEDID && fedId <= FEDNumbering::MAXTCDSuTCAFEDID) { + tcdsInRange = true; + } } else throw cms::Exception("FedRawDataInputSource::fillFEDRawDataCollection") << "Second TCDS FED ID " << fedId << " found. First ID: " << selectedTCDSFed; @@ -810,7 +814,6 @@ void FedRawDataInputSource::readSupervisor() { if (fms_) { setMonStateSup(inSupBusy); fms_->startedLookingForFile(); - setMonStateSup(inSupLockPolling); } evf::EvFDaqDirector::FileStatus status = evf::EvFDaqDirector::noFile; @@ -830,6 +833,7 @@ void FedRawDataInputSource::readSupervisor() { assert(rawFd == -1); uint64_t thisLockWaitTimeUs = 0.; + setMonStateSup(inSupLockPolling); if (fileListMode_) { //return LS if LS not set, otherwise return file status = getFile(ls, nextFile, fileSizeIndex, thisLockWaitTimeUs); @@ -939,7 +943,7 @@ void FedRawDataInputSource::readSupervisor() { //look at last LS file on disk to start from that lumisection (only within first 100 LS) unsigned int lsToStart = daqDirector_->getLumisectionToStart(); - for (unsigned int nextLS = lsToStart; nextLS <= ls; nextLS++) { + for (unsigned int nextLS = std::min(lsToStart, ls); nextLS <= ls; nextLS++) { std::unique_ptr inf(new InputFile(evf::EvFDaqDirector::newLumi, nextLS)); fileQueue_.push(std::move(inf)); } @@ -1556,10 +1560,10 @@ long FedRawDataInputSource::initFileList() { std::string runStr = fileStem.substr(3, end - 3); try { //get long to support test run numbers < 2^32 - long rval = boost::lexical_cast(runStr); + long rval = std::stol(runStr); edm::LogInfo("FedRawDataInputSource") << "Autodetected run number in fileListMode -: " << rval; return rval; - } catch (boost::bad_lexical_cast const&) { + } catch (const std::exception&) { edm::LogWarning("FedRawDataInputSource") << "Unable to autodetect run number in fileListMode from file -: " << fileName; } @@ -1586,7 +1590,7 @@ evf::EvFDaqDirector::FileStatus FedRawDataInputSource::getFile(unsigned int& ls, fileStem = fileStem.substr(0, fileStem.find('_')); if (!fileListLoopMode_) - ls = boost::lexical_cast(fileStem); + ls = std::stoul(fileStem); else //always starting from LS 1 in loop mode ls = 1 + loopModeIterationInc_; diff --git a/EventFilter/Utilities/test/LocalRunBUFU.sh b/EventFilter/Utilities/test/LocalRunBUFU.sh index 156521aca2c45..8497d1cce955e 100755 --- a/EventFilter/Utilities/test/LocalRunBUFU.sh +++ b/EventFilter/Utilities/test/LocalRunBUFU.sh @@ -19,7 +19,7 @@ RC=0 P=$$ PREFIX=results_${USER}${P} OUTDIR=${LOCAL_TMP_DIR}/${PREFIX} - +echo "Output will be temporarily written to ${OUTDIR}" mkdir ${OUTDIR} cp ${SCRIPTDIR}/startBU.py ${OUTDIR} diff --git a/EventFilter/Utilities/test/startBU.py b/EventFilter/Utilities/test/startBU.py index c827a6e5d3022..c4825646fbaaa 100644 --- a/EventFilter/Utilities/test/startBU.py +++ b/EventFilter/Utilities/test/startBU.py @@ -121,6 +121,7 @@ defaultQualifier = cms.untracked.int32(0)) process.s = cms.EDProducer("DaqFakeReader", + fillRandom = cms.untracked.bool(True), meanSize = cms.untracked.uint32(options.fedMeanSize), width = cms.untracked.uint32(int(math.ceil(options.fedMeanSize/2.))), tcdsFEDID = cms.untracked.uint32(1024), diff --git a/EventFilter/Utilities/test/unittest_FU.py b/EventFilter/Utilities/test/unittest_FU.py index e5e8e54c16f2a..f16b1f1f47167 100644 --- a/EventFilter/Utilities/test/unittest_FU.py +++ b/EventFilter/Utilities/test/unittest_FU.py @@ -54,7 +54,7 @@ process.options = cms.untracked.PSet( numberOfThreads = cms.untracked.uint32(options.numThreads), numberOfStreams = cms.untracked.uint32(options.numFwkStreams), - numberOfConcurrentLuminosityBlocks = cms.untracked.uint32(2) + numberOfConcurrentLuminosityBlocks = cms.untracked.uint32(1) # ShmStreamConsumer requires synchronization at LuminosityBlock boundaries ) process.MessageLogger = cms.Service("MessageLogger", cout = cms.untracked.PSet(threshold = cms.untracked.string( "ERROR" )), diff --git a/FWCore/Concurrency/test/streamGrapher_stallMonitor_cfg.py b/FWCore/Concurrency/test/streamGrapher_stallMonitor_cfg.py index 190dbd3c2cdef..4eafda08cb36f 100644 --- a/FWCore/Concurrency/test/streamGrapher_stallMonitor_cfg.py +++ b/FWCore/Concurrency/test/streamGrapher_stallMonitor_cfg.py @@ -21,8 +21,9 @@ process.p = cms.Path(process.strt, process.t) -process.options = cms.untracked.PSet( numberOfStreams = cms.untracked.uint32(4), - numberOfThreads = cms.untracked.uint32(5)) +process.options = dict( numberOfStreams = 4, + numberOfThreads = 5, + numberOfConcurrentLuminosityBlocks = 1) process.add_(cms.Service("Tracer", printTimestamps = cms.untracked.bool(True))) process.add_(cms.Service("StallMonitor", fileName = cms.untracked.string("stallMonitor.log"))) diff --git a/FWCore/Framework/interface/Callback.h b/FWCore/Framework/interface/Callback.h index 2a85a423183a8..a584e3d9046f9 100644 --- a/FWCore/Framework/interface/Callback.h +++ b/FWCore/Framework/interface/Callback.h @@ -36,6 +36,8 @@ #include "FWCore/ServiceRegistry/interface/ESModuleCallingContext.h" namespace edm { + void exceptionContext(cms::Exception&, ESModuleCallingContext const&); + namespace eventsetup { class EventSetupRecordImpl; @@ -208,10 +210,7 @@ namespace edm { decorator_.post(rec); }); } catch (cms::Exception& iException) { - auto const& description = producer_->description(); - std::ostringstream ost; - ost << "Running EventSetup component " << description.type_ << "/'" << description.label_; - iException.addContext(ost.str()); + edm::exceptionContext(iException, callingContext_); exceptPtr = std::current_exception(); } taskList_.doneWaiting(exceptPtr); diff --git a/FWCore/Framework/interface/EDAnalyzer.h b/FWCore/Framework/interface/EDAnalyzer.h index 423dd569c827d..d254e9e0919a4 100644 --- a/FWCore/Framework/interface/EDAnalyzer.h +++ b/FWCore/Framework/interface/EDAnalyzer.h @@ -8,6 +8,7 @@ #include "FWCore/Framework/interface/SharedResourcesAcquirer.h" #include "FWCore/Concurrency/interface/SerialTaskQueue.h" #include "FWCore/Concurrency/interface/WaitingTaskHolder.h" +#include "FWCore/Utilities/interface/deprecated_macro.h" #include @@ -25,7 +26,7 @@ namespace edm { class ModuleHolderT; } - class EDAnalyzer : public EDConsumerBase { + class CMS_DEPRECATED EDAnalyzer : public EDConsumerBase { public: template friend class maker::ModuleHolderT; diff --git a/FWCore/Framework/interface/EDFilter.h b/FWCore/Framework/interface/EDFilter.h index 1a82c85252dd8..552c8613201d2 100644 --- a/FWCore/Framework/interface/EDFilter.h +++ b/FWCore/Framework/interface/EDFilter.h @@ -19,6 +19,7 @@ These products should be informational products about the filter decision. #include "FWCore/Concurrency/interface/WaitingTaskHolder.h" #include "FWCore/ParameterSet/interface/ParameterSetfwd.h" #include "DataFormats/Provenance/interface/ModuleDescription.h" +#include "FWCore/Utilities/interface/deprecated_macro.h" #include #include @@ -35,7 +36,7 @@ namespace edm { class ActivityRegistry; class ThinnedAssociationsHelper; - class EDFilter : public ProducerBase, public EDConsumerBase { + class CMS_DEPRECATED EDFilter : public ProducerBase, public EDConsumerBase { public: template friend class maker::ModuleHolderT; diff --git a/FWCore/Framework/interface/EDProducer.h b/FWCore/Framework/interface/EDProducer.h index ed0778b9a522b..ae029cf6c80b9 100644 --- a/FWCore/Framework/interface/EDProducer.h +++ b/FWCore/Framework/interface/EDProducer.h @@ -16,6 +16,7 @@ EDProducts into an Event. #include "DataFormats/Provenance/interface/ModuleDescription.h" #include "FWCore/ParameterSet/interface/ParameterSetfwd.h" #include "FWCore/Concurrency/interface/WaitingTaskHolder.h" +#include "FWCore/Utilities/interface/deprecated_macro.h" #include #include @@ -32,7 +33,7 @@ namespace edm { class ModuleHolderT; } - class EDProducer : public ProducerBase, public EDConsumerBase { + class CMS_DEPRECATED EDProducer : public ProducerBase, public EDConsumerBase { public: template friend class maker::ModuleHolderT; diff --git a/FWCore/Framework/interface/EventProcessor.h b/FWCore/Framework/interface/EventProcessor.h index 89c604e946a95..3ba6b50dd5131 100644 --- a/FWCore/Framework/interface/EventProcessor.h +++ b/FWCore/Framework/interface/EventProcessor.h @@ -305,7 +305,7 @@ namespace edm { std::shared_ptr looper() const { return get_underlying_safe(looper_); } std::shared_ptr& looper() { return get_underlying_safe(looper_); } - void warnAboutModulesRequiringLuminosityBLockSynchronization() const; + void throwAboutModulesRequiringLuminosityBlockSynchronization() const; void warnAboutLegacyModules() const; //------------------------------------------------------------------ // diff --git a/FWCore/Framework/interface/EventSetup.h b/FWCore/Framework/interface/EventSetup.h index b0a1eb656f398..7b2e4b902e7b4 100644 --- a/FWCore/Framework/interface/EventSetup.h +++ b/FWCore/Framework/interface/EventSetup.h @@ -38,6 +38,7 @@ #include "FWCore/Framework/interface/data_default_record_trait.h" #include "FWCore/Utilities/interface/Transition.h" #include "FWCore/Utilities/interface/ESIndices.h" +#include "FWCore/Utilities/interface/deprecated_macro.h" // forward declarations @@ -124,18 +125,19 @@ namespace edm { /** can directly access data if data_default_record_trait<> is defined for this data type **/ template - bool getData(T& iHolder) const { - return getData(std::string{}, iHolder); + CMS_DEPRECATED bool getData(T& iHolder) const { + auto const& rec = this->get>(); + return rec.get(std::string{}, iHolder); } template - bool getData(const std::string& iLabel, T& iHolder) const { + CMS_DEPRECATED bool getData(const std::string& iLabel, T& iHolder) const { auto const& rec = this->get>(); return rec.get(iLabel, iHolder); } template - bool getData(const ESInputTag& iTag, T& iHolder) const { + CMS_DEPRECATED bool getData(const ESInputTag& iTag, T& iHolder) const { auto const& rec = this->get>(); return rec.get(iTag, iHolder); } diff --git a/FWCore/Framework/interface/EventSetupRecord.h b/FWCore/Framework/interface/EventSetupRecord.h index 3e3ef03952369..d2153b4455aa2 100644 --- a/FWCore/Framework/interface/EventSetupRecord.h +++ b/FWCore/Framework/interface/EventSetupRecord.h @@ -49,6 +49,7 @@ #include "FWCore/Utilities/interface/ESInputTag.h" #include "FWCore/Utilities/interface/ESIndices.h" #include "FWCore/Utilities/interface/Likely.h" +#include "FWCore/Utilities/interface/deprecated_macro.h" // system include files #include @@ -108,37 +109,22 @@ namespace edm { } template - bool get(HolderT& iHolder) const { - return get("", iHolder); + CMS_DEPRECATED bool get(HolderT& iHolder) const { + return deprecated_get("", iHolder); } template - bool get(char const* iName, HolderT& iHolder) const { - if UNLIKELY (requireTokens_) { - throwCalledGetWithoutToken(heterocontainer::className(), iName); - } - typename HolderT::value_type const* value = nullptr; - ComponentDescription const* desc = nullptr; - std::shared_ptr whyFailedFactory; - impl_->getImplementation( - value, iName, desc, iHolder.transientAccessOnly, whyFailedFactory, *context_, eventSetupImpl_); - - if (value) { - iHolder = HolderT(value, desc); - return true; - } else { - iHolder = HolderT(std::move(whyFailedFactory)); - return false; - } + CMS_DEPRECATED bool get(char const* iName, HolderT& iHolder) const { + return deprecated_get(iName, iHolder); } template - bool get(std::string const& iName, HolderT& iHolder) const { - return get(iName.c_str(), iHolder); + CMS_DEPRECATED bool get(std::string const& iName, HolderT& iHolder) const { + return deprecated_get(iName.c_str(), iHolder); } template - bool get(ESInputTag const& iTag, HolderT& iHolder) const { + CMS_DEPRECATED bool get(ESInputTag const& iTag, HolderT& iHolder) const { if UNLIKELY (requireTokens_) { throwCalledGetWithoutToken(heterocontainer::className(), iTag.data().c_str()); } @@ -258,6 +244,26 @@ namespace edm { bool requireTokens() const { return requireTokens_; } private: + template + bool deprecated_get(char const* iName, HolderT& iHolder) const { + if UNLIKELY (requireTokens_) { + throwCalledGetWithoutToken(heterocontainer::className(), iName); + } + typename HolderT::value_type const* value = nullptr; + ComponentDescription const* desc = nullptr; + std::shared_ptr whyFailedFactory; + impl_->getImplementation( + value, iName, desc, iHolder.transientAccessOnly, whyFailedFactory, *context_, eventSetupImpl_); + + if (value) { + iHolder = HolderT(value, desc); + return true; + } else { + iHolder = HolderT(std::move(whyFailedFactory)); + return false; + } + } + template