From 7bec061dbe489be1e8390f92fdbe512bca1c02ea Mon Sep 17 00:00:00 2001 From: Mia <mia.tosi@cern.ch> Date: Thu, 2 Apr 2015 17:33:17 +0200 Subject: [PATCH 01/26] add first version of PointSeededTrackingRegionsProducer.h --- .../src/PointSeededTrackingRegionsProducer.h | 226 ++++++++++++++++++ 1 file changed, 226 insertions(+) create mode 100644 RecoTauTag/HLTProducers/src/PointSeededTrackingRegionsProducer.h diff --git a/RecoTauTag/HLTProducers/src/PointSeededTrackingRegionsProducer.h b/RecoTauTag/HLTProducers/src/PointSeededTrackingRegionsProducer.h new file mode 100644 index 0000000000000..f62e45f7b0696 --- /dev/null +++ b/RecoTauTag/HLTProducers/src/PointSeededTrackingRegionsProducer.h @@ -0,0 +1,226 @@ +#ifndef PointSeededTrackingRegionsProducer_h +#define PointSeededTrackingRegionsProducer_h + + +#include "RecoTracker/TkTrackingRegions/interface/TrackingRegionProducer.h" +#include "RecoTracker/TkTrackingRegions/interface/RectangularEtaPhiTrackingRegion.h" + +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Utilities/interface/InputTag.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" +#include "DataFormats/Common/interface/Handle.h" +#include "DataFormats/BeamSpot/interface/BeamSpot.h" +#include "DataFormats/VertexReco/interface/Vertex.h" +#include "DataFormats/VertexReco/interface/VertexFwd.h" +#include "DataFormats/Candidate/interface/Candidate.h" + +#include <TMath.h> +#include <TLorentzVector.h> + +/** class PointSeededTrackingRegionsProducer + * + * eta-phi TrackingRegions producer in directions defined by Point-based objects of interest + * from the "input" parameters. + * + * Four operational modes are supported ("mode" parameter): + * + * BeamSpotFixed: + * origin is defined by the beam spot + * z-half-length is defined by a fixed zErrorBeamSpot parameter + * BeamSpotSigma: + * origin is defined by the beam spot + * z-half-length is defined by nSigmaZBeamSpot * beamSpot.sigmaZ + * VerticesFixed: + * origins are defined by vertices from VertexCollection (use maximum MaxNVertices of them) + * z-half-length is defined by a fixed zErrorVetex parameter + * VerticesSigma: + * origins are defined by vertices from VertexCollection (use maximum MaxNVertices of them) + * z-half-length is defined by nSigmaZVertex * vetex.zError + * + * If, while using one of the "Vertices" modes, there's no vertices in an event, we fall back into + * either BeamSpotSigma or BeamSpotFixed mode, depending on the positiveness of nSigmaZBeamSpot. + * + */ +class PointSeededTrackingRegionsProducer : public TrackingRegionProducer +{ +public: + + typedef enum {BEAM_SPOT_FIXED, BEAM_SPOT_SIGMA, VERTICES_FIXED, VERTICES_SIGMA } Mode; + + explicit PointSeededTrackingRegionsProducer(const edm::ParameterSet& conf, + edm::ConsumesCollector && iC) + { + edm::ParameterSet regPSet = conf.getParameter<edm::ParameterSet>("RegionPSet"); + + // operation mode + std::string modeString = regPSet.getParameter<std::string>("mode"); + if (modeString == "BeamSpotFixed") m_mode = BEAM_SPOT_FIXED; + else if (modeString == "BeamSpotSigma") m_mode = BEAM_SPOT_SIGMA; + else if (modeString == "VerticesFixed") m_mode = VERTICES_FIXED; + else if (modeString == "VerticesSigma") m_mode = VERTICES_SIGMA; + else edm::LogError ("PointSeededTrackingRegionsProducer")<<"Unknown mode string: "<<modeString; + + // basic inputs + edm::ParameterSet point_input = regPSet.getParameter<edm::ParameterSet>("point_input"); + eta_input = point_input.getParameter<double>("eta"); + phi_input = point_input.getParameter<double>("phi"); + m_maxNRegions = regPSet.getParameter<int>("maxNRegions"); + token_beamSpot = iC.consumes<reco::BeamSpot>(regPSet.getParameter<edm::InputTag>("beamSpot")); + m_maxNVertices = 1; + if (m_mode == VERTICES_FIXED || m_mode == VERTICES_SIGMA) + { + token_vertex = iC.consumes<reco::VertexCollection>(regPSet.getParameter<edm::InputTag>("vertexCollection")); + m_maxNVertices = regPSet.getParameter<int>("maxNVertices"); + } + + // RectangularEtaPhiTrackingRegion parameters: + m_ptMin = regPSet.getParameter<double>("ptMin"); + m_originRadius = regPSet.getParameter<double>("originRadius"); + m_zErrorBeamSpot = regPSet.getParameter<double>("zErrorBeamSpot"); + m_deltaEta = regPSet.getParameter<double>("deltaEta"); + m_deltaPhi = regPSet.getParameter<double>("deltaPhi"); + m_precise = regPSet.getParameter<bool>("precise"); + m_whereToUseMeasurementTracker = RectangularEtaPhiTrackingRegion::UseMeasurementTracker::kForSiStrips; + if (regPSet.exists("measurementTrackerName")) + { + // FIXME: when next time altering the configuration of this + // class, please change the types of the following parameters: + // - whereToUseMeasurementTracker to at least int32 or to a string + // corresponding to the UseMeasurementTracker enumeration + // - measurementTrackerName to InputTag + if (regPSet.exists("whereToUseMeasurementTracker")) + m_whereToUseMeasurementTracker = RectangularEtaPhiTrackingRegion::doubleToUseMeasurementTracker(regPSet.getParameter<double>("whereToUseMeasurementTracker")); + if(m_whereToUseMeasurementTracker != RectangularEtaPhiTrackingRegion::UseMeasurementTracker::kNever) + token_measurementTracker = iC.consumes<MeasurementTrackerEvent>(regPSet.getParameter<std::string>("measurementTrackerName")); + } + m_searchOpt = false; + if (regPSet.exists("searchOpt")) m_searchOpt = regPSet.getParameter<bool>("searchOpt"); + + // mode-dependent z-halflength of tracking regions + if (m_mode == VERTICES_SIGMA) m_nSigmaZVertex = regPSet.getParameter<double>("nSigmaZVertex"); + if (m_mode == VERTICES_FIXED) m_zErrorVetex = regPSet.getParameter<double>("zErrorVetex"); + m_nSigmaZBeamSpot = -1.; + if (m_mode == BEAM_SPOT_SIGMA) + { + m_nSigmaZBeamSpot = regPSet.getParameter<double>("nSigmaZBeamSpot"); + if (m_nSigmaZBeamSpot < 0.) + edm::LogError ("PointSeededTrackingRegionsProducer")<<"nSigmaZBeamSpot must be positive for BeamSpotSigma mode!"; + } + } + + virtual ~PointSeededTrackingRegionsProducer() {} + + + virtual std::vector<TrackingRegion* > regions(const edm::Event& e, const edm::EventSetup& es) const + { + std::vector<TrackingRegion* > result; + + // always need the beam spot (as a fall back strategy for vertex modes) + edm::Handle< reco::BeamSpot > bs; + e.getByToken( token_beamSpot, bs ); + if( !bs.isValid() ) return result; + + // this is a default origin for all modes + GlobalPoint default_origin( bs->x0(), bs->y0(), bs->z0() ); + + // vector of origin & halfLength pairs: + std::vector< std::pair< GlobalPoint, float > > origins; + + // fill the origins and halfLengths depending on the mode + if (m_mode == BEAM_SPOT_FIXED || m_mode == BEAM_SPOT_SIGMA) { + origins.push_back( std::make_pair( default_origin, + (m_mode == BEAM_SPOT_FIXED) ? m_zErrorBeamSpot : m_nSigmaZBeamSpot*bs->sigmaZ() + )); + } else if (m_mode == VERTICES_FIXED || m_mode == VERTICES_SIGMA) { + edm::Handle< reco::VertexCollection > vertices; + e.getByToken( token_vertex, vertices ); + int n_vert = 0; + for (reco::VertexCollection::const_iterator iv = vertices->begin(), ev = vertices->end(); + iv != ev && n_vert < m_maxNVertices; ++iv) { + if ( iv->isFake() || !iv->isValid() ) continue; + + origins.push_back( std::make_pair( GlobalPoint( iv->x(), iv->y(), iv->z() ), + (m_mode == VERTICES_FIXED) ? m_zErrorVetex : m_nSigmaZVertex*iv->zError() + )); + ++n_vert; + } + // no-vertex fall-back case: + if ( origins.empty() ) { + origins.push_back( std::make_pair( default_origin, + (m_nSigmaZBeamSpot > 0.) ? m_nSigmaZBeamSpot*bs->z0Error() : m_zErrorBeamSpot + )); + } + } + + const MeasurementTrackerEvent *measurementTracker = nullptr; + if( !token_measurementTracker.isUninitialized() ) { + edm::Handle<MeasurementTrackerEvent> hmte; + e.getByToken(token_measurementTracker, hmte); + measurementTracker = hmte.product(); + } + + // create tracking regions (maximum MaxNRegions of them) in directions of the + // points of interest + size_t n_points = 1; + int n_regions = 0; + for(size_t i = 0; i < n_points && n_regions < m_maxNRegions; ++i ) { + + double x = TMath::Cos(phi_input); + double y = TMath::Sin(phi_input); + double theta = 2*TMath::ATan(TMath::Exp(-eta_input)); + double z = (x*x+y*y)/TMath::Tan(theta); + + GlobalVector direction( x,y,z ); + + for (size_t j=0; j<origins.size() && n_regions < m_maxNRegions; ++j) { + + result.push_back( new RectangularEtaPhiTrackingRegion( + direction, // GlobalVector + origins[j].first, // GlobalPoint + m_ptMin, + m_originRadius, + origins[j].second, + m_deltaEta, + m_deltaPhi, + m_whereToUseMeasurementTracker, + m_precise, + measurementTracker, + m_searchOpt + )); + ++n_regions; + } + } + //std::cout<<"n_seeded_regions = "<<n_regions<<std::endl; + edm::LogInfo ("PointSeededTrackingRegionsProducer") << "produced "<<n_regions<<" regions"; + + return result; + } + +private: + + Mode m_mode; + + int m_maxNRegions; + edm::EDGetTokenT<reco::VertexCollection> token_vertex; + edm::EDGetTokenT<reco::BeamSpot> token_beamSpot; + double eta_input, phi_input; + int m_maxNVertices; + + float m_ptMin; + float m_originRadius; + float m_zErrorBeamSpot; + float m_deltaEta; + float m_deltaPhi; + bool m_precise; + edm::EDGetTokenT<MeasurementTrackerEvent> token_measurementTracker; + RectangularEtaPhiTrackingRegion::UseMeasurementTracker m_whereToUseMeasurementTracker; + bool m_searchOpt; + + float m_nSigmaZVertex; + float m_zErrorVetex; + float m_nSigmaZBeamSpot; +}; + +#endif From ea69295fdd2fbb9aa2466faa79d47ab6ab9b8926 Mon Sep 17 00:00:00 2001 From: Mia <mia.tosi@cern.ch> Date: Thu, 2 Apr 2015 17:35:56 +0200 Subject: [PATCH 02/26] add first version of PointSeededTrackingRegionsProducer.h --- RecoTauTag/HLTProducers/src/SealModule.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/RecoTauTag/HLTProducers/src/SealModule.cc b/RecoTauTag/HLTProducers/src/SealModule.cc index 2000ad2b29bd8..f09184d0a0c43 100644 --- a/RecoTauTag/HLTProducers/src/SealModule.cc +++ b/RecoTauTag/HLTProducers/src/SealModule.cc @@ -15,6 +15,7 @@ #include "TauRegionalPixelSeedGenerator.h" #include "TrackingRegionsFromBeamSpotAndL2Tau.h" #include "CandidateSeededTrackingRegionsProducer.h" +#include "RecoTauTag/HLTProducers/src/PointSeededTrackingRegionsProducer.h" #include "RecoTauTag/HLTProducers/interface/L2TauIsolationSelector.h" #include "RecoTauTag/HLTProducers/interface/L2TauRelaxingIsolationSelector.h" #include "RecoTauTag/HLTProducers/interface/L2TauIsolationProducer.h" @@ -32,6 +33,7 @@ DEFINE_EDM_PLUGIN(TrackingRegionProducerFactory, TauRegionalPixelSeedGenerator, "TauRegionalPixelSeedGenerator"); DEFINE_EDM_PLUGIN(TrackingRegionProducerFactory, TrackingRegionsFromBeamSpotAndL2Tau, "TrackingRegionsFromBeamSpotAndL2Tau"); DEFINE_EDM_PLUGIN(TrackingRegionProducerFactory, CandidateSeededTrackingRegionsProducer, "CandidateSeededTrackingRegionsProducer"); +DEFINE_EDM_PLUGIN(TrackingRegionProducerFactory, PointSeededTrackingRegionsProducer, "PointSeededTrackingRegionsProducer"); // DEFINE_FWK_MODULE(IsolatedTauJetsSelector); DEFINE_FWK_MODULE(EMIsolatedTauJetsSelector); From f9d9e3f7bf42add757f5bfd14de3b9572568b4b2 Mon Sep 17 00:00:00 2001 From: "W. David Dagenhart" <wdd@fnal.gov> Date: Wed, 29 Apr 2015 16:51:57 -0500 Subject: [PATCH 03/26] Consumes migration for L1GtUtils This modifies L1GtUtils to call the consumes function for all the products it gets. Also the L1GtAnalyzer module has consumes calls added. They also use getByToken instead of getByLabel now. I did not yet modify all the modules that use L1GtUtils yet. This will be done next in a separate commit. Modules will need to use a different L1GtUtils constructor and the arguments determine the behavior. This preserves the previous behavior where it is possible to have L1GtUtils look for the products by type without specifying the InputTags in the configuration. This will make the migration of the modules easier as configurations will not need modification to add the InputTag parameters. It is also possible to pass the InputTags into the constructor as arguments which was also an option in the earlier versions. And I added the the new possibility to set the InputTags in the configuration as well. All modules that use L1GtUtils will also have to remove InputTags where they were being passed in at points other than the constructor. They have to be set in the constructor now. This has to be decided earlier and the module can no longer decide the InputTag when processing the event or run. The new L1GtUtilsHelper class encapsulates most of the logic of the input tag selection and holds the EDGetTokens. --- L1Trigger/GlobalTriggerAnalyzer/BuildFile.xml | 2 + .../interface/L1GtAnalyzer.h | 17 + .../interface/L1GtUtils.h | 247 +++++---- .../interface/L1GtUtilsHelper.h | 178 +++++++ .../GlobalTriggerAnalyzer/src/L1GtAnalyzer.cc | 205 ++++---- .../GlobalTriggerAnalyzer/src/L1GtUtils.cc | 475 ++---------------- .../src/L1GtUtilsHelper.cc | 102 ++++ 7 files changed, 536 insertions(+), 690 deletions(-) create mode 100644 L1Trigger/GlobalTriggerAnalyzer/interface/L1GtUtilsHelper.h create mode 100644 L1Trigger/GlobalTriggerAnalyzer/src/L1GtUtilsHelper.cc diff --git a/L1Trigger/GlobalTriggerAnalyzer/BuildFile.xml b/L1Trigger/GlobalTriggerAnalyzer/BuildFile.xml index 3fa79e79266a4..6f1a5667bec01 100644 --- a/L1Trigger/GlobalTriggerAnalyzer/BuildFile.xml +++ b/L1Trigger/GlobalTriggerAnalyzer/BuildFile.xml @@ -1,9 +1,11 @@ <use name="FWCore/Framework"/> <use name="FWCore/ParameterSet"/> +<use name="FWCore/Utilities"/> <use name="DataFormats/Common"/> <use name="DataFormats/L1GlobalTrigger"/> <use name="DataFormats/L1GlobalMuonTrigger"/> <use name="DataFormats/L1GlobalCaloTrigger"/> +<use name="DataFormats/Provenance"/> <use name="DataFormats/L1Trigger"/> <use name="CondFormats/L1TObjects"/> <use name="CondFormats/DataRecord"/> diff --git a/L1Trigger/GlobalTriggerAnalyzer/interface/L1GtAnalyzer.h b/L1Trigger/GlobalTriggerAnalyzer/interface/L1GtAnalyzer.h index a0f7585db73f3..00ef906446a60 100644 --- a/L1Trigger/GlobalTriggerAnalyzer/interface/L1GtAnalyzer.h +++ b/L1Trigger/GlobalTriggerAnalyzer/interface/L1GtAnalyzer.h @@ -20,6 +20,14 @@ #include <string> // user include files + +#include "DataFormats/Common/interface/ConditionsInEdm.h" + +#include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutRecord.h" +#include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerObjectMapRecord.h" +#include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerObjectMaps.h" +#include "DataFormats/L1GlobalTrigger/interface/L1GtTriggerMenuLite.h" + #include "FWCore/Framework/interface/Frameworkfwd.h" #include "FWCore/Framework/interface/EDAnalyzer.h" @@ -28,6 +36,7 @@ #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/Utilities/interface/EDGetToken.h" #include "FWCore/Utilities/interface/InputTag.h" #include "L1Trigger/GlobalTriggerAnalyzer/interface/L1GtUtils.h" @@ -121,24 +130,31 @@ class L1GtAnalyzer: public edm::EDAnalyzer { /// input tags for GT DAQ product edm::InputTag m_l1GtDaqReadoutRecordInputTag; + edm::EDGetTokenT<L1GlobalTriggerReadoutRecord> m_l1GtDaqReadoutRecordToken; /// input tags for GT lite product edm::InputTag m_l1GtRecordInputTag; /// input tags for GT object map collection L1GlobalTriggerObjectMapRecord edm::InputTag m_l1GtObjectMapTag; + edm::EDGetTokenT<L1GlobalTriggerObjectMapRecord> m_l1GtObjectMapToken; /// input tags for GT object map collection L1GlobalTriggerObjectMaps edm::InputTag m_l1GtObjectMapsInputTag; + edm::EDGetTokenT<L1GlobalTriggerObjectMaps> m_l1GtObjectMapsToken; /// input tag for muon collection from GMT edm::InputTag m_l1GmtInputTag; /// input tag for L1GtTriggerMenuLite edm::InputTag m_l1GtTmLInputTag; + edm::EDGetTokenT<L1GtTriggerMenuLite> m_l1GtTmLToken; /// input tag for ConditionInEdm products edm::InputTag m_condInEdmInputTag; + edm::EDGetTokenT<edm::ConditionsInRunBlock> m_condInRunToken; + edm::EDGetTokenT<edm::ConditionsInLumiBlock> m_condInLumiToken; + edm::EDGetTokenT<edm::ConditionsInEventBlock> m_condInEventToken; /// an algorithm trigger (name or alias) or a technical trigger name std::string m_nameAlgTechTrig; @@ -169,6 +185,7 @@ class L1GtAnalyzer: public edm::EDAnalyzer { private: + L1GtUtils m_l1GtUtilsProv; L1GtUtils m_l1GtUtils; L1GtUtils::LogicalExpressionL1Results m_logicalExpressionL1ResultsProv; L1GtUtils::LogicalExpressionL1Results m_logicalExpressionL1Results; diff --git a/L1Trigger/GlobalTriggerAnalyzer/interface/L1GtUtils.h b/L1Trigger/GlobalTriggerAnalyzer/interface/L1GtUtils.h index e8e6b0c24c4a0..68a544d65921c 100644 --- a/L1Trigger/GlobalTriggerAnalyzer/interface/L1GtUtils.h +++ b/L1Trigger/GlobalTriggerAnalyzer/interface/L1GtUtils.h @@ -16,11 +16,11 @@ */ // system include files +#include <memory> #include <string> #include <utility> // user include files - #include "DataFormats/L1GlobalTrigger/interface/L1GtTriggerMenuLite.h" #include "FWCore/Framework/interface/Event.h" @@ -32,6 +32,8 @@ #include "CondFormats/L1TObjects/interface/L1GtTriggerMenuFwd.h" +#include "L1Trigger/GlobalTriggerAnalyzer/interface/L1GtUtilsHelper.h" + // forward declarations class L1GtStableParameters; class L1GtPrescaleFactors; @@ -47,8 +49,55 @@ class L1GtUtils { public: - /// constructor - explicit L1GtUtils(); + // Using this constructor will require InputTags to be specified in the configuration + L1GtUtils(edm::ParameterSet const& pset, + edm::ConsumesCollector&& iC, + bool useL1GtTriggerMenuLite); + + L1GtUtils(edm::ParameterSet const& pset, + edm::ConsumesCollector& iC, + bool useL1GtTriggerMenuLite); + + // Using this constructor will cause it to look for valid InputTags in + // the following ways in the specified order until they are found. + // 1. The configuration + // 2. Search all products from the RECO process for the required type + // 3. Search all products from any other process for the required type + template <typename T> + L1GtUtils(edm::ParameterSet const& pset, + edm::ConsumesCollector&& iC, + bool useL1GtTriggerMenuLite, + T& module); + + template <typename T> + L1GtUtils(edm::ParameterSet const& pset, + edm::ConsumesCollector& iC, + bool useL1GtTriggerMenuLite, + T& module); + + // Using this constructor will cause it to look for valid InputTags in + // the following ways in the specified order until they are found. + // 1. The constructor arguments + // 2. The configuration + // 3. Search all products from the RECO process for the required type + // 4. Search all products from any other process for the required type + template <typename T> + L1GtUtils(edm::ParameterSet const& pset, + edm::ConsumesCollector&& iC, + bool useL1GtTriggerMenuLite, + T& module, + edm::InputTag const& l1GtRecordInputTag, + edm::InputTag const& l1GtReadoutRecordInputTag, + edm::InputTag const& l1GtTriggerMenuLiteInputTag); + + template <typename T> + L1GtUtils(edm::ParameterSet const& pset, + edm::ConsumesCollector& iC, + bool useL1GtTriggerMenuLite, + T& module, + edm::InputTag const& l1GtRecordInputTag, + edm::InputTag const& l1GtReadoutRecordInputTag, + edm::InputTag const& l1GtTriggerMenuLiteInputTag); /// destructor virtual ~L1GtUtils(); @@ -79,15 +128,9 @@ class L1GtUtils { public: /// constructor(s) - /// trigger decisions, prescale factors and masks from GT record(s) with input tag(s) - /// from provenance + /// trigger decisions, prescale factors and masks from GT record(s) explicit LogicalExpressionL1Results(const std::string&, L1GtUtils&); - /// trigger decisions, prescale factors and masks from GT record(s) with input tag(s) - /// explicitly given - explicit LogicalExpressionL1Results(const std::string&, L1GtUtils&, - const edm::InputTag&, const edm::InputTag&); - /// destructor ~LogicalExpressionL1Results(); @@ -130,10 +173,7 @@ class L1GtUtils { void reset(const std::vector<std::pair<std::string, bool> >&) const; void reset(const std::vector<std::pair<std::string, int> >&) const; - void - l1Results(const edm::Event& iEvent, - const edm::InputTag& l1GtRecordInputTag, - const edm::InputTag& l1GtReadoutRecordInputTag); + void l1Results(const edm::Event& iEvent); private: @@ -144,9 +184,6 @@ class L1GtUtils { L1GtUtils& m_l1GtUtils; - edm::InputTag m_l1GtRecordInputTag; - edm::InputTag m_l1GtReadoutRecordInputTag; - private: // private members @@ -160,10 +197,6 @@ class L1GtUtils { /// true if the logical expression uses accepted L1GtLogicParser operators bool m_validLogicalExpression; - /// true if input tags for GT records are to be found from provenance - /// (if both input tags from constructors are empty) - bool m_l1GtInputTagsFromProv; - /// set to true if the method l1Results was called once bool m_l1ResultsAlreadyCalled; @@ -202,50 +235,17 @@ class L1GtUtils { /// retrieve L1GtTriggerMenuLite (per run product) and cache it to improve the speed /// for use in beginRun(const edm::Run&, const edm::EventSetup&); - /// input tag explicitly given - void retrieveL1GtTriggerMenuLite(const edm::Run&, const edm::InputTag&); + void retrieveL1GtTriggerMenuLite(const edm::Run&); /// get all the run-constant quantities for L1 trigger and cache them /// for use in beginRun(const edm::Run&, const edm::EventSetup&); - /// input tag for L1GtTriggerMenuLite explicitly given - void getL1GtRunCache(const edm::Run&, const edm::EventSetup&, const bool, - const bool, const edm::InputTag&); - /// input tag for L1GtTriggerMenuLite found from provenance void getL1GtRunCache(const edm::Run&, const edm::EventSetup&, const bool, - const bool); + const bool); /// for use in analyze(const edm::Event&, const edm::EventSetup&) - /// input tag for L1GtTriggerMenuLite explicitly given void getL1GtRunCache(const edm::Event&, const edm::EventSetup&, const bool, - const bool, const edm::InputTag&); - /// input tag for L1GtTriggerMenuLite found from provenance - void getL1GtRunCache(const edm::Event&, const edm::EventSetup&, const bool, - const bool); - - /// find from provenance the input tags for L1GlobalTriggerRecord and - /// L1GlobalTriggerReadoutRecord - /// if the product does not exist, return empty input tags - void getL1GtRecordInputTag(const edm::Event& iEvent, - edm::InputTag& l1GtRecordInputTag, - edm::InputTag& l1GtReadoutRecordInputTag) const; - - /// get the input tag for L1GtTriggerMenuLite - void getL1GtTriggerMenuLiteInputTag(const edm::Run& iRun, - edm::InputTag& l1GtTriggerMenuLiteInputTag) const; - - /// return the input tags found from provenance - inline const edm::InputTag& provL1GtRecordInputTag() { - return m_provL1GtRecordInputTag; - } - - inline const edm::InputTag& provL1GtReadoutRecordInputTag() { - return m_provL1GtReadoutRecordInputTag; - } - - inline const edm::InputTag& provL1GtTriggerMenuLiteInputTag() { - return m_provL1GtTriggerMenuLiteInputTag; - } + const bool); /// return the trigger "category" trigCategory /// algorithm trigger alias or algorithm trigger name AlgorithmTrigger = 0, @@ -269,29 +269,7 @@ class L1GtUtils { const TriggerCategory& trigCategory, std::string& aliasL1Trigger, std::string& nameL1Trigger) const; - /// return results for a given algorithm or technical trigger: - /// input: - /// event - /// input tag for the L1GlobalTriggerRecord product - /// input tag for the L1GlobalTriggerReadoutRecord product - /// algorithm trigger name or alias, or technical trigger name - /// output (by reference): - /// decision before mask, - /// decision after mask, - /// prescale factor - /// trigger mask - /// return: integer error code - - const int - l1Results(const edm::Event& iEvent, - const edm::InputTag& l1GtRecordInputTag, - const edm::InputTag& l1GtReadoutRecordInputTag, - const std::string& nameAlgoTechTrig, - bool& decisionBeforeMask, bool& decisionAfterMask, - int& prescaleFactor, int& triggerMask) const; - /// return results for a given algorithm or technical trigger, - /// input tag for the an appropriate EDM product will be found from provenance /// input: /// event /// algorithm trigger name or alias, or technical trigger name @@ -302,88 +280,51 @@ class L1GtUtils { /// trigger mask /// return: integer error code - const int - l1Results(const edm::Event& iEvent, - const std::string& nameAlgoTechTrig, - bool& decisionBeforeMask, bool& decisionAfterMask, - int& prescaleFactor, int& triggerMask) const; + const int l1Results(const edm::Event& iEvent, + const std::string& nameAlgoTechTrig, + bool& decisionBeforeMask, bool& decisionAfterMask, + int& prescaleFactor, int& triggerMask) const; /// for the functions decisionBeforeMask, decisionAfterMask, decision /// prescaleFactor, trigger mask: /// /// input: /// event, event setup - /// input tag for the L1GlobalTriggerRecord product - /// input tag for the L1GlobalTriggerReadoutRecord product /// algorithm trigger name or alias, or technical trigger name /// output (by reference): /// error code /// return: the corresponding quantity - /// - /// if input tags are not given, they are found for the appropriate EDM products - /// from provenance /// return decision before trigger mask for a given algorithm or technical trigger - const bool decisionBeforeMask(const edm::Event& iEvent, - const edm::InputTag& l1GtRecordInputTag, - const edm::InputTag& l1GtReadoutRecordInputTag, - const std::string& nameAlgoTechTrig, int& errorCode) const; - const bool decisionBeforeMask(const edm::Event& iEvent, const std::string& nameAlgoTechTrig, int& errorCode) const; /// return decision after trigger mask for a given algorithm or technical trigger - const bool decisionAfterMask(const edm::Event& iEvent, - const edm::InputTag& l1GtRecordInputTag, - const edm::InputTag& l1GtReadoutRecordInputTag, - const std::string& nameAlgoTechTrig, int& errorCode) const; - const bool decisionAfterMask(const edm::Event& iEvent, const std::string& nameAlgoTechTrig, int& errorCode) const; /// return decision after trigger mask for a given algorithm or technical trigger /// function identical with decisionAfterMask - const bool decision(const edm::Event& iEvent, - const edm::InputTag& l1GtRecordInputTag, - const edm::InputTag& l1GtReadoutRecordInputTag, - const std::string& nameAlgoTechTrig, int& errorCode) const; - const bool decision(const edm::Event& iEvent, const std::string& nameAlgoTechTrig, int& errorCode) const; /// return prescale factor for a given algorithm or technical trigger - const int prescaleFactor(const edm::Event& iEvent, - const edm::InputTag& l1GtRecordInputTag, - const edm::InputTag& l1GtReadoutRecordInputTag, - const std::string& nameAlgoTechTrig, int& errorCode) const; - const int prescaleFactor(const edm::Event& iEvent, const std::string& nameAlgoTechTrig, int& errorCode) const; /// return trigger mask for a given algorithm or technical trigger - const int triggerMask(const edm::Event& iEvent, - const edm::InputTag& l1GtRecordInputTag, - const edm::InputTag& l1GtReadoutRecordInputTag, - const std::string& nameAlgoTechTrig, int& errorCode) const; - const int triggerMask(const edm::Event& iEvent, const std::string& nameAlgoTechTrig, int& errorCode) const; /// faster than previous two methods - one needs in fact for the /// masks the event setup only - const int - triggerMask(const std::string& nameAlgoTechTrig, int& errorCode) const; + const int triggerMask(const std::string& nameAlgoTechTrig, int& errorCode) const; /// return the index of the actual set of prescale factors used for the /// event (must be the same for all events in the luminosity block, /// if no errors) /// - const int prescaleFactorSetIndex(const edm::Event& iEvent, - const edm::InputTag& l1GtRecordInputTag, - const edm::InputTag& l1GtReadoutRecordInputTag, - const TriggerCategory& trigCategory, int& errorCode) const; - const int prescaleFactorSetIndex(const edm::Event& iEvent, const TriggerCategory& trigCategory, int& errorCode) const; @@ -392,11 +333,6 @@ class L1GtUtils { /// event (must be the same for all events in the luminosity block, /// if no errors) - const std::vector<int>& prescaleFactorSet(const edm::Event& iEvent, - const edm::InputTag& l1GtRecordInputTag, - const edm::InputTag& l1GtReadoutRecordInputTag, - const TriggerCategory& trigCategory, int& errorCode); - const std::vector<int>& prescaleFactorSet(const edm::Event& iEvent, const TriggerCategory& trigCategory, int& errorCode); @@ -437,6 +373,8 @@ class L1GtUtils { private: + L1GtUtils(); + /// event setup cached stuff /// stable parameters @@ -509,16 +447,8 @@ class L1GtUtils { /// flag for call of getL1GtRunCache in beginRun bool m_beginRunCache; - /// cached input tags from provenance - - edm::InputTag m_provL1GtRecordInputTag; - edm::InputTag m_provL1GtReadoutRecordInputTag; - edm::InputTag m_provL1GtTriggerMenuLiteInputTag; - /// run cache ID edm::RunID m_runIDCache; - edm::RunID m_provRunIDCache; - private: @@ -532,6 +462,55 @@ class L1GtUtils { bool m_retrieveL1EventSetup; bool m_retrieveL1GtTriggerMenuLite; + std::unique_ptr<L1GtUtilsHelper> m_l1GtUtilsHelper; }; +template <typename T> +L1GtUtils::L1GtUtils(edm::ParameterSet const& pset, + edm::ConsumesCollector&& iC, + bool useL1GtTriggerMenuLite, + T& module) : + L1GtUtils(pset, iC, useL1GtTriggerMenuLite, module) { } + +template <typename T> +L1GtUtils::L1GtUtils(edm::ParameterSet const& pset, + edm::ConsumesCollector& iC, + bool useL1GtTriggerMenuLite, + T& module) : + L1GtUtils() { + m_l1GtUtilsHelper.reset(new L1GtUtilsHelper(pset, + iC, + useL1GtTriggerMenuLite, + module)); +} + +template <typename T> +L1GtUtils::L1GtUtils(edm::ParameterSet const& pset, + edm::ConsumesCollector&& iC, + bool useL1GtTriggerMenuLite, + T& module, + edm::InputTag const& l1GtRecordInputTag, + edm::InputTag const& l1GtReadoutRecordInputTag, + edm::InputTag const& l1GtTriggerMenuLiteInputTag) : + L1GtUtils(pset, iC, useL1GtTriggerMenuLite, module, l1GtRecordInputTag, + l1GtReadoutRecordInputTag, l1GtTriggerMenuLiteInputTag) { } + +template <typename T> +L1GtUtils::L1GtUtils(edm::ParameterSet const& pset, + edm::ConsumesCollector& iC, + bool useL1GtTriggerMenuLite, + T& module, + edm::InputTag const& l1GtRecordInputTag, + edm::InputTag const& l1GtReadoutRecordInputTag, + edm::InputTag const& l1GtTriggerMenuLiteInputTag) : + L1GtUtils() { + m_l1GtUtilsHelper.reset(new L1GtUtilsHelper(pset, + iC, + useL1GtTriggerMenuLite, + module, + l1GtRecordInputTag, + l1GtReadoutRecordInputTag, + l1GtTriggerMenuLiteInputTag)); +} + #endif /*GlobalTriggerAnalyzer_L1GtUtils_h*/ diff --git a/L1Trigger/GlobalTriggerAnalyzer/interface/L1GtUtilsHelper.h b/L1Trigger/GlobalTriggerAnalyzer/interface/L1GtUtilsHelper.h new file mode 100644 index 0000000000000..a03104d677d16 --- /dev/null +++ b/L1Trigger/GlobalTriggerAnalyzer/interface/L1GtUtilsHelper.h @@ -0,0 +1,178 @@ +#ifndef GlobalTriggerAnalyzer_L1GtUtilsHelper_h +#define GlobalTriggerAnalyzer_L1GtUtilsHelper_h + +/** + * \class L1GtUtilsHelper + * + * + * Description: Gets tokens for L1GtUtils to use when getting products + * from the Event and Run. This class was introduced to + * when the consumes function calls were added for L1GtUtils. + * It preserves the special feature of L1GtUtils that allows + * it to run without configuration of InputTags, although it + * allows InputTags to be configured optionally or passed in + * via the constructor arguments. + * + * \author: W.David Dagenhart - Fermilab 30 April 2015 + * + */ + +#include "FWCore/Framework/interface/ConsumesCollector.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/Utilities/interface/EDGetToken.h" +#include "FWCore/Utilities/interface/InputTag.h" + +#include <string> +#include <utility> + +class L1GlobalTriggerRecord; +class L1GlobalTriggerReadoutRecord; +class L1GtTriggerMenuLite; + +namespace edm { + class BranchDescription; + class ParameterSetDescription; +} + +class L1GtUtilsHelper { + +public: + + // Using this constructor will require InputTags to be specified in the configuration + L1GtUtilsHelper(edm::ParameterSet const& pset, + edm::ConsumesCollector& iC, + bool useL1GtTriggerMenuLite); + + // Using this constructor will cause it to look for valid InputTags in + // the following ways in the specified order until they are found. + // 1. The configuration + // 2. Search all products from the RECO process for the required type + // 3. Search all products from any other process for the required type + template <typename T> + L1GtUtilsHelper(edm::ParameterSet const& pset, + edm::ConsumesCollector& iC, + bool useL1GtTriggerMenuLite, + T& module); + + // Using this constructor will cause it to look for valid InputTags in + // the following ways in the specified order until they are found. + // 1. The constructor arguments + // 2. The configuration + // 3. Search all products from the RECO process for the required type + // 4. Search all products from any other process for the required type + template <typename T> + L1GtUtilsHelper(edm::ParameterSet const& pset, + edm::ConsumesCollector& iC, + bool useL1GtTriggerMenuLite, + T& module, + edm::InputTag const& l1GtRecordInputTag, + edm::InputTag const& l1GtReadoutRecordInputTag, + edm::InputTag const& l1GtTriggerMenuLiteInputTag); + + // A module defining its fillDescriptions function might want to use this + static void fillDescription(edm::ParameterSetDescription & desc); + + // Callback which will be registered with the Framework if the InputTags + // are not specified in the configuration or constructor arguments. It + // will get called for each product in the ProductRegistry. + void operator()(edm::BranchDescription const& branchDescription); + + edm::InputTag const& l1GtRecordInputTag() const { return m_l1GtRecordInputTag; } + edm::InputTag const& l1GtReadoutRecordInputTag() const { return m_l1GtReadoutRecordInputTag; } + edm::InputTag const& l1GtTriggerMenuLiteInputTag() const { return m_l1GtTriggerMenuLiteInputTag; } + + edm::EDGetTokenT<L1GlobalTriggerRecord> const& l1GtRecordToken() const { return m_l1GtRecordToken; } + edm::EDGetTokenT<L1GlobalTriggerReadoutRecord> const& l1GtReadoutRecordToken() const { return m_l1GtReadoutRecordToken; } + edm::EDGetTokenT<L1GtTriggerMenuLite> const& l1GtTriggerMenuLiteToken() const { return m_l1GtTriggerMenuLiteToken; } + +private: + + edm::ConsumesCollector m_consumesCollector; + + edm::InputTag m_l1GtRecordInputTag; + edm::InputTag m_l1GtReadoutRecordInputTag; + edm::InputTag m_l1GtTriggerMenuLiteInputTag; + + edm::EDGetTokenT<L1GlobalTriggerRecord> m_l1GtRecordToken; + edm::EDGetTokenT<L1GlobalTriggerReadoutRecord> m_l1GtReadoutRecordToken; + edm::EDGetTokenT<L1GtTriggerMenuLite> m_l1GtTriggerMenuLiteToken; + + bool m_findRecord; + bool m_findReadoutRecord; + bool m_findMenuLite; + + bool m_foundRECORecord; + bool m_foundRECOReadoutRecord; + bool m_foundRECOMenuLite; +}; + +template <typename T> +L1GtUtilsHelper::L1GtUtilsHelper(edm::ParameterSet const& pset, + edm::ConsumesCollector& iC, + bool useL1GtTriggerMenuLite, + T& module) : + L1GtUtilsHelper(pset, iC, useL1GtTriggerMenuLite, module, edm::InputTag(), edm::InputTag(), edm::InputTag()) { +} + +template <typename T> +L1GtUtilsHelper::L1GtUtilsHelper(edm::ParameterSet const& pset, + edm::ConsumesCollector& iC, + bool useL1GtTriggerMenuLite, + T& module, + edm::InputTag const& l1GtRecordInputTag, + edm::InputTag const& l1GtReadoutRecordInputTag, + edm::InputTag const& l1GtTriggerMenuLiteInputTag) : + m_consumesCollector(std::move(iC)), + + // Set InputTags from arguments + m_l1GtRecordInputTag(l1GtRecordInputTag), + m_l1GtReadoutRecordInputTag(l1GtReadoutRecordInputTag), + m_l1GtTriggerMenuLiteInputTag(l1GtTriggerMenuLiteInputTag), + + m_findRecord(false), + m_findReadoutRecord(false), + m_findMenuLite(false), + + m_foundRECORecord(false), + m_foundRECOReadoutRecord(false), + m_foundRECOMenuLite(false) { + + // If the InputTags are not set to valid values by the arguments, then + // try to set them from the configuration. + if(m_l1GtRecordInputTag.label().empty() && + pset.existsAs<edm::InputTag>("l1GtRecordInputTag")) { + m_l1GtRecordInputTag = pset.getParameter<edm::InputTag>("l1GtRecordInputTag"); + } + if(m_l1GtReadoutRecordInputTag.label().empty() && + pset.existsAs<edm::InputTag>("l1GtReadoutRecordInputTag")) { + m_l1GtReadoutRecordInputTag = pset.getParameter<edm::InputTag>("l1GtReadoutRecordInputTag"); + } + if(useL1GtTriggerMenuLite && + m_l1GtTriggerMenuLiteInputTag.label().empty() && + pset.existsAs<edm::InputTag>("l1GtTriggerMenuLiteInputTag")) { + m_l1GtTriggerMenuLiteInputTag = pset.getParameter<edm::InputTag>("l1GtTriggerMenuLiteInputTag"); + } + + // If the InputTags were set to valid values, make the consumes calls. + if(!m_l1GtRecordInputTag.label().empty()) { + m_l1GtRecordToken = iC.consumes<L1GlobalTriggerRecord>(m_l1GtRecordInputTag); + } + if(!m_l1GtReadoutRecordInputTag.label().empty()) { + m_l1GtReadoutRecordToken = iC.consumes<L1GlobalTriggerReadoutRecord>(m_l1GtReadoutRecordInputTag); + } + if(useL1GtTriggerMenuLite && !m_l1GtTriggerMenuLiteInputTag.label().empty()) { + m_l1GtTriggerMenuLiteToken = iC.consumes<L1GtTriggerMenuLite,edm::InRun>(m_l1GtTriggerMenuLiteInputTag); + } + + // Do we still need to search for each InputTag? + m_findRecord = m_l1GtRecordInputTag.label().empty(); + m_findReadoutRecord = m_l1GtReadoutRecordInputTag.label().empty(); + m_findMenuLite = m_l1GtTriggerMenuLiteInputTag.label().empty() && useL1GtTriggerMenuLite; + + // Register the callback function with the Framework + // if any InputTags still need to be found. + if(m_findRecord || m_findReadoutRecord || m_findMenuLite) { + module.callWhenNewProductsRegistered(std::ref(*this)); + } +} +#endif diff --git a/L1Trigger/GlobalTriggerAnalyzer/src/L1GtAnalyzer.cc b/L1Trigger/GlobalTriggerAnalyzer/src/L1GtAnalyzer.cc index e8e0b22c964ce..5046229be6ce1 100644 --- a/L1Trigger/GlobalTriggerAnalyzer/src/L1GtAnalyzer.cc +++ b/L1Trigger/GlobalTriggerAnalyzer/src/L1GtAnalyzer.cc @@ -22,18 +22,9 @@ // user include files #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 "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerObjectMapRecord.h" -#include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerObjectMaps.h" - #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerObjectMap.h" -#include "DataFormats/L1GlobalTrigger/interface/L1GtTriggerMenuLite.h" - -#include "DataFormats/Common/interface/ConditionsInEdm.h" - #include "DataFormats/L1GlobalMuonTrigger/interface/L1MuGMTReadoutCollection.h" #include "L1Trigger/GlobalTrigger/interface/L1GlobalTriggerPSB.h" @@ -109,12 +100,31 @@ L1GtAnalyzer::L1GtAnalyzer(const edm::ParameterSet& parSet) : m_l1GtTmLInputTagProv(parSet.getParameter<bool> ("L1GtTmLInputTagProv")), m_l1GtRecordsInputTagProv(parSet.getParameter<bool> ("L1GtRecordsInputTagProv")), m_l1GtUtilsConfigureBeginRun(parSet.getParameter<bool> ("L1GtUtilsConfigureBeginRun")), - m_l1GtUtilsLogicalExpression(parSet.getParameter<std::string>("L1GtUtilsLogicalExpression")), - m_logicalExpressionL1ResultsProv(m_l1GtUtilsLogicalExpression, m_l1GtUtils), - m_logicalExpressionL1Results(m_l1GtUtilsLogicalExpression, m_l1GtUtils, m_l1GtRecordInputTag, m_l1GtDaqReadoutRecordInputTag) - + m_l1GtUtilsLogicalExpression(parSet.getParameter<std::string>("L1GtUtilsLogicalExpression")), + m_l1GtUtilsProv(parSet, + consumesCollector(), + m_l1GtUtilsConfiguration == 100000 || m_l1GtUtilsConfiguration == 200000, + *this, + edm::InputTag(), + edm::InputTag(), + m_l1GtTmLInputTagProv ? edm::InputTag() : m_l1GtTmLInputTag), + m_l1GtUtils(parSet, + consumesCollector(), + m_l1GtUtilsConfiguration == 100000 || m_l1GtUtilsConfiguration == 200000, + *this, + m_l1GtRecordInputTag, + m_l1GtDaqReadoutRecordInputTag, + m_l1GtTmLInputTagProv ? edm::InputTag() : m_l1GtTmLInputTag), + m_logicalExpressionL1ResultsProv(m_l1GtUtilsLogicalExpression, m_l1GtUtilsProv), + m_logicalExpressionL1Results(m_l1GtUtilsLogicalExpression, m_l1GtUtils) { - + m_l1GtDaqReadoutRecordToken = consumes<L1GlobalTriggerReadoutRecord>(m_l1GtDaqReadoutRecordInputTag); + m_l1GtObjectMapToken = consumes<L1GlobalTriggerObjectMapRecord>(m_l1GtObjectMapTag); + m_l1GtObjectMapsToken = consumes<L1GlobalTriggerObjectMaps>(m_l1GtObjectMapsInputTag); + m_l1GtTmLToken = consumes<L1GtTriggerMenuLite,edm::InRun>(m_l1GtTmLInputTag); + m_condInRunToken = consumes<edm::ConditionsInRunBlock,edm::InRun>(m_condInEdmInputTag); + m_condInLumiToken = consumes<edm::ConditionsInLumiBlock,edm::InLumi>(m_condInEdmInputTag); + m_condInEventToken = consumes<edm::ConditionsInEventBlock>(m_condInEdmInputTag); LogDebug("L1GtAnalyzer") << "\n Input parameters for L1 GT test analyzer" @@ -199,17 +209,11 @@ void L1GtAnalyzer::beginRun(const edm::Run& iRun, break; } - if (m_l1GtTmLInputTagProv) { - // L1GtTriggerMenuLite input tag from provenance - m_l1GtUtils.getL1GtRunCache(iRun, evSetup, useL1EventSetup, - useL1GtTriggerMenuLite); - - } else { + m_l1GtUtilsProv.getL1GtRunCache(iRun, evSetup, useL1EventSetup, + useL1GtTriggerMenuLite); - // L1GtTriggerMenuLite input tag given in configuration file - m_l1GtUtils.getL1GtRunCache(iRun, evSetup, useL1EventSetup, - useL1GtTriggerMenuLite, m_l1GtTmLInputTag); - } + m_l1GtUtils.getL1GtRunCache(iRun, evSetup, useL1EventSetup, + useL1GtTriggerMenuLite); // check if the parsing of the logical expression was successful @@ -270,7 +274,7 @@ void L1GtAnalyzer::analyzeDecisionReadoutRecord(const edm::Event& iEvent, const // get L1GlobalTriggerReadoutRecord edm::Handle<L1GlobalTriggerReadoutRecord> gtReadoutRecord; - iEvent.getByLabel(m_l1GtDaqReadoutRecordInputTag, gtReadoutRecord); + iEvent.getByToken(m_l1GtDaqReadoutRecordToken, gtReadoutRecord); if (!gtReadoutRecord.isValid()) { @@ -374,19 +378,19 @@ void L1GtAnalyzer::analyzeL1GtUtilsCore(const edm::Event& iEvent, iErrorCode = -1; - bool decisionBeforeMaskAlgTechTrig = m_l1GtUtils.decisionBeforeMask(iEvent, + bool decisionBeforeMaskAlgTechTrig = m_l1GtUtilsProv.decisionBeforeMask(iEvent, m_nameAlgTechTrig, iErrorCode); - bool decisionAfterMaskAlgTechTrig = m_l1GtUtils.decisionAfterMask(iEvent, + bool decisionAfterMaskAlgTechTrig = m_l1GtUtilsProv.decisionAfterMask(iEvent, m_nameAlgTechTrig, iErrorCode); - bool decisionAlgTechTrig = m_l1GtUtils.decision(iEvent, m_nameAlgTechTrig, + bool decisionAlgTechTrig = m_l1GtUtilsProv.decision(iEvent, m_nameAlgTechTrig, iErrorCode); - int prescaleFactorAlgTechTrig = m_l1GtUtils.prescaleFactor(iEvent, + int prescaleFactorAlgTechTrig = m_l1GtUtilsProv.prescaleFactor(iEvent, m_nameAlgTechTrig, iErrorCode); - int triggerMaskAlgTechTrig = m_l1GtUtils.triggerMask(iEvent, + int triggerMaskAlgTechTrig = m_l1GtUtilsProv.triggerMask(iEvent, m_nameAlgTechTrig, iErrorCode); myCoutStream << "\n\nMethods:" @@ -420,13 +424,13 @@ void L1GtAnalyzer::analyzeL1GtUtilsCore(const edm::Event& iEvent, } else if (iErrorCode == 1) { myCoutStream << "\n" << m_nameAlgTechTrig << " does not exist in the L1 menu " - << m_l1GtUtils.l1TriggerMenu() << "\n" << std::endl; + << m_l1GtUtilsProv.l1TriggerMenu() << "\n" << std::endl; } else { myCoutStream << "\nError: " << "\n An error was encountered when retrieving decision, mask and prescale factor for " << m_nameAlgTechTrig << "\n L1 Menu: " - << m_l1GtUtils.l1TriggerMenu() << "\n Error code: " + << m_l1GtUtilsProv.l1TriggerMenu() << "\n Error code: " << iErrorCode << std::endl; } @@ -434,7 +438,7 @@ void L1GtAnalyzer::analyzeL1GtUtilsCore(const edm::Event& iEvent, // another method to get the trigger mask (no common errorCode) iErrorCode = -1; - triggerMaskAlgTechTrig = m_l1GtUtils.triggerMask(m_nameAlgTechTrig, + triggerMaskAlgTechTrig = m_l1GtUtilsProv.triggerMask(m_nameAlgTechTrig, iErrorCode); if (iErrorCode == 0) { @@ -445,13 +449,13 @@ void L1GtAnalyzer::analyzeL1GtUtilsCore(const edm::Event& iEvent, } else if (iErrorCode == 1) { myCoutStream << "\n" << m_nameAlgTechTrig << " does not exist in the L1 menu " - << m_l1GtUtils.l1TriggerMenu() << "\n" << std::endl; + << m_l1GtUtilsProv.l1TriggerMenu() << "\n" << std::endl; } else { myCoutStream << "\nError: " << "\n An error was encountered when fast retrieving trigger mask for " << m_nameAlgTechTrig << "\n L1 Menu: " - << m_l1GtUtils.l1TriggerMenu() << "\n Error code: " + << m_l1GtUtilsProv.l1TriggerMenu() << "\n Error code: " << iErrorCode << std::endl; } @@ -469,7 +473,7 @@ void L1GtAnalyzer::analyzeL1GtUtilsCore(const edm::Event& iEvent, << std::endl; iErrorCode = -1; - const int pfSetIndexAlgorithmTrigger = m_l1GtUtils.prescaleFactorSetIndex( + const int pfSetIndexAlgorithmTrigger = m_l1GtUtilsProv.prescaleFactorSetIndex( iEvent, trigCategory, iErrorCode); if (iErrorCode == 0) { @@ -477,7 +481,7 @@ void L1GtAnalyzer::analyzeL1GtUtilsCore(const edm::Event& iEvent, << "\nAlgorithm triggers: index for prescale factor set = " << pfSetIndexAlgorithmTrigger << "\nfor run " << iEvent.run() << ", luminosity block " << iEvent.luminosityBlock() - << ", with L1 menu \n " << m_l1GtUtils.l1TriggerMenu() + << ", with L1 menu \n " << m_l1GtUtilsProv.l1TriggerMenu() << std::endl; @@ -486,19 +490,19 @@ void L1GtAnalyzer::analyzeL1GtUtilsCore(const edm::Event& iEvent, << "\nError encountered when retrieving the prescale factor set index" << "\n for algorithm triggers, for run " << iEvent.run() << ", luminosity block " << iEvent.luminosityBlock() - << " with L1 menu \n " << m_l1GtUtils.l1TriggerMenu() + << " with L1 menu \n " << m_l1GtUtilsProv.l1TriggerMenu() << "\n Error code: " << iErrorCode << "\n" << std::endl; } iErrorCode = -1; const std::vector<int>& pfSetAlgorithmTrigger = - m_l1GtUtils.prescaleFactorSet(iEvent, trigCategory, iErrorCode); + m_l1GtUtilsProv.prescaleFactorSet(iEvent, trigCategory, iErrorCode); if (iErrorCode == 0) { myCoutStream << "\nAlgorithm triggers: prescale factor set index = " << pfSetIndexAlgorithmTrigger << "\nfor run " << iEvent.run() << ", luminosity block " << iEvent.luminosityBlock() - << ", with L1 menu \n " << m_l1GtUtils.l1TriggerMenu() + << ", with L1 menu \n " << m_l1GtUtilsProv.l1TriggerMenu() << std::endl; int iBit = -1; @@ -517,7 +521,7 @@ void L1GtAnalyzer::analyzeL1GtUtilsCore(const edm::Event& iEvent, << "\nError encountered when retrieving the prescale factor set " << "\n for algorithm triggers, for run " << iEvent.run() << ", luminosity block " << iEvent.luminosityBlock() - << " with L1 menu \n " << m_l1GtUtils.l1TriggerMenu() + << " with L1 menu \n " << m_l1GtUtilsProv.l1TriggerMenu() << "\n Error code: " << iErrorCode << "\n" << std::endl; } @@ -529,13 +533,13 @@ void L1GtAnalyzer::analyzeL1GtUtilsCore(const edm::Event& iEvent, iErrorCode = -1; const std::vector<unsigned int>& tmSetAlgorithmTrigger = - m_l1GtUtils.triggerMaskSet(trigCategory, iErrorCode); + m_l1GtUtilsProv.triggerMaskSet(trigCategory, iErrorCode); if (iErrorCode == 0) { myCoutStream << "\nAlgorithm triggers: trigger mask set for run " << iEvent.run() << ", luminosity block " << iEvent.luminosityBlock() << ", with L1 menu \n " - << m_l1GtUtils.l1TriggerMenu() << "\n" << std::endl; + << m_l1GtUtilsProv.l1TriggerMenu() << "\n" << std::endl; int iBit = -1; for (std::vector<unsigned int>::const_iterator cItBit = @@ -553,7 +557,7 @@ void L1GtAnalyzer::analyzeL1GtUtilsCore(const edm::Event& iEvent, << "\nError encountered when retrieving the trigger mask set " << "\n for algorithm triggers, for run " << iEvent.run() << ", luminosity block " << iEvent.luminosityBlock() - << " with L1 menu \n " << m_l1GtUtils.l1TriggerMenu() + << " with L1 menu \n " << m_l1GtUtilsProv.l1TriggerMenu() << "\n Error code: " << iErrorCode << "\n" << std::endl; } @@ -571,7 +575,7 @@ void L1GtAnalyzer::analyzeL1GtUtilsCore(const edm::Event& iEvent, << std::endl; iErrorCode = -1; - const int pfSetIndexTechnicalTrigger = m_l1GtUtils.prescaleFactorSetIndex( + const int pfSetIndexTechnicalTrigger = m_l1GtUtilsProv.prescaleFactorSetIndex( iEvent, trigCategory, iErrorCode); if (iErrorCode == 0) { @@ -579,7 +583,7 @@ void L1GtAnalyzer::analyzeL1GtUtilsCore(const edm::Event& iEvent, << "\nTechnical triggers: index for prescale factor set = " << pfSetIndexTechnicalTrigger << "\nfor run " << iEvent.run() << ", luminosity block " << iEvent.luminosityBlock() - << ", with L1 menu \n " << m_l1GtUtils.l1TriggerMenu() + << ", with L1 menu \n " << m_l1GtUtilsProv.l1TriggerMenu() << "\nMethod: prescaleFactorSetIndex(iEvent, trigCategory, iErrorCode)\n" << std::endl; @@ -588,19 +592,19 @@ void L1GtAnalyzer::analyzeL1GtUtilsCore(const edm::Event& iEvent, << "\nError encountered when retrieving the prescale factor set index" << "\n for technical triggers, for run " << iEvent.run() << ", luminosity block " << iEvent.luminosityBlock() - << " with L1 menu \n " << m_l1GtUtils.l1TriggerMenu() + << " with L1 menu \n " << m_l1GtUtilsProv.l1TriggerMenu() << "\n Error code: " << iErrorCode << "\n" << std::endl; } iErrorCode = -1; const std::vector<int>& pfSetTechnicalTrigger = - m_l1GtUtils.prescaleFactorSet(iEvent, trigCategory, iErrorCode); + m_l1GtUtilsProv.prescaleFactorSet(iEvent, trigCategory, iErrorCode); if (iErrorCode == 0) { myCoutStream << "\nTechnical triggers: prescale factor set index = " << pfSetIndexTechnicalTrigger << "\nfor run " << iEvent.run() << ", luminosity block " << iEvent.luminosityBlock() - << ", with L1 menu \n " << m_l1GtUtils.l1TriggerMenu() + << ", with L1 menu \n " << m_l1GtUtilsProv.l1TriggerMenu() << "\nMethod: prescaleFactorSet(iEvent, trigCategory,iErrorCode)\n" << std::endl; @@ -620,7 +624,7 @@ void L1GtAnalyzer::analyzeL1GtUtilsCore(const edm::Event& iEvent, << "\nError encountered when retrieving the prescale factor set " << "\n for technical triggers, for run " << iEvent.run() << ", luminosity block " << iEvent.luminosityBlock() - << " with L1 menu \n " << m_l1GtUtils.l1TriggerMenu() + << " with L1 menu \n " << m_l1GtUtilsProv.l1TriggerMenu() << "\n Error code: " << iErrorCode << "\n" << std::endl; } @@ -632,13 +636,13 @@ void L1GtAnalyzer::analyzeL1GtUtilsCore(const edm::Event& iEvent, iErrorCode = -1; const std::vector<unsigned int>& tmSetTechnicalTrigger = - m_l1GtUtils.triggerMaskSet(trigCategory, iErrorCode); + m_l1GtUtilsProv.triggerMaskSet(trigCategory, iErrorCode); if (iErrorCode == 0) { myCoutStream << "\nTechnical triggers: trigger mask set for run " << iEvent.run() << ", luminosity block " << iEvent.luminosityBlock() << ", with L1 menu \n " - << m_l1GtUtils.l1TriggerMenu() << "\n" << std::endl; + << m_l1GtUtilsProv.l1TriggerMenu() << "\n" << std::endl; int iBit = -1; for (std::vector<unsigned int>::const_iterator cItBit = @@ -656,7 +660,7 @@ void L1GtAnalyzer::analyzeL1GtUtilsCore(const edm::Event& iEvent, << "\nError encountered when retrieving the trigger mask set " << "\n for technical triggers, for run " << iEvent.run() << ", luminosity block " << iEvent.luminosityBlock() - << " with L1 menu \n " << m_l1GtUtils.l1TriggerMenu() + << " with L1 menu \n " << m_l1GtUtilsProv.l1TriggerMenu() << "\n Error code: " << iErrorCode << "\n" << std::endl; } @@ -691,7 +695,7 @@ void L1GtAnalyzer::analyzeL1GtUtilsCore(const edm::Event& iEvent, << (expL1TriggersProv[iTrig]).tokenNumber << ")\n for run " << iEvent.run() << ", luminosity block " << iEvent.luminosityBlock() << " with L1 menu \n " - << m_l1GtUtils.l1TriggerMenu() << "\n Error code: " + << m_l1GtUtilsProv.l1TriggerMenu() << "\n Error code: " << (errorCodesProv[iTrig]).second << "\n" << std::endl; } else { @@ -737,23 +741,18 @@ void L1GtAnalyzer::analyzeL1GtUtilsCore(const edm::Event& iEvent, iErrorCode = -1; bool decisionBeforeMaskAlgTechTrigITag = m_l1GtUtils.decisionBeforeMask(iEvent, - m_l1GtRecordInputTag, m_l1GtDaqReadoutRecordInputTag, m_nameAlgTechTrig, iErrorCode); bool decisionAfterMaskAlgTechTrigITag = m_l1GtUtils.decisionAfterMask(iEvent, - m_l1GtRecordInputTag, m_l1GtDaqReadoutRecordInputTag, m_nameAlgTechTrig, iErrorCode); bool decisionAlgTechTrigITag = m_l1GtUtils.decision(iEvent, - m_l1GtRecordInputTag, m_l1GtDaqReadoutRecordInputTag, m_nameAlgTechTrig, iErrorCode); int prescaleFactorAlgTechTrigITag = m_l1GtUtils.prescaleFactor(iEvent, - m_l1GtRecordInputTag, m_l1GtDaqReadoutRecordInputTag, m_nameAlgTechTrig, iErrorCode); int triggerMaskAlgTechTrigITag = m_l1GtUtils.triggerMask(iEvent, - m_l1GtRecordInputTag, m_l1GtDaqReadoutRecordInputTag, m_nameAlgTechTrig, iErrorCode); myCoutStream << "\n\nMethods:" @@ -813,8 +812,7 @@ void L1GtAnalyzer::analyzeL1GtUtilsCore(const edm::Event& iEvent, iErrorCode = -1; const int pfSetIndexAlgorithmTriggerITag = m_l1GtUtils.prescaleFactorSetIndex( - iEvent, m_l1GtRecordInputTag, m_l1GtDaqReadoutRecordInputTag, - trigCategory, iErrorCode); + iEvent, trigCategory, iErrorCode); if (iErrorCode == 0) { myCoutStream @@ -836,8 +834,7 @@ void L1GtAnalyzer::analyzeL1GtUtilsCore(const edm::Event& iEvent, iErrorCode = -1; const std::vector<int>& pfSetAlgorithmTriggerITag = - m_l1GtUtils.prescaleFactorSet(iEvent, m_l1GtRecordInputTag, - m_l1GtDaqReadoutRecordInputTag, trigCategory, iErrorCode); + m_l1GtUtils.prescaleFactorSet(iEvent, trigCategory, iErrorCode); if (iErrorCode == 0) { myCoutStream << "\nAlgorithm triggers: prescale factor set index = " @@ -883,8 +880,7 @@ void L1GtAnalyzer::analyzeL1GtUtilsCore(const edm::Event& iEvent, iErrorCode = -1; const int pfSetIndexTechnicalTriggerITag = m_l1GtUtils.prescaleFactorSetIndex( - iEvent, m_l1GtRecordInputTag, m_l1GtDaqReadoutRecordInputTag, - trigCategory, iErrorCode); + iEvent, trigCategory, iErrorCode); if (iErrorCode == 0) { myCoutStream @@ -905,8 +901,7 @@ void L1GtAnalyzer::analyzeL1GtUtilsCore(const edm::Event& iEvent, iErrorCode = -1; const std::vector<int>& pfSetTechnicalTriggerITag = - m_l1GtUtils.prescaleFactorSet(iEvent, m_l1GtRecordInputTag, - m_l1GtDaqReadoutRecordInputTag, trigCategory, iErrorCode); + m_l1GtUtils.prescaleFactorSet(iEvent, trigCategory, iErrorCode); if (iErrorCode == 0) { myCoutStream << "\nTechnical triggers: prescale factor set index = " @@ -1013,21 +1008,13 @@ void L1GtAnalyzer::analyzeL1GtUtilsMenuLite(const edm::Event& iEvent, bool useL1EventSetup = false; bool useL1GtTriggerMenuLite = true; - if (m_l1GtTmLInputTagProv) { - - // input tag for L1GtTriggerMenuLite retrieved from provenance - m_l1GtUtils.getL1GtRunCache(iEvent, evSetup, useL1EventSetup, + m_l1GtUtilsProv.getL1GtRunCache(iEvent, evSetup, useL1EventSetup, useL1GtTriggerMenuLite); - } else { - - // input tag for L1GtTriggerMenuLite explicitly given - m_l1GtUtils.getL1GtRunCache(iEvent, evSetup, useL1EventSetup, - useL1GtTriggerMenuLite, m_l1GtTmLInputTag); - } + m_l1GtUtils.getL1GtRunCache(iEvent, evSetup, useL1EventSetup, + useL1GtTriggerMenuLite); analyzeL1GtUtilsCore(iEvent, evSetup); - } void L1GtAnalyzer::analyzeL1GtUtilsEventSetup(const edm::Event& iEvent, @@ -1045,6 +1032,9 @@ void L1GtAnalyzer::analyzeL1GtUtilsEventSetup(const edm::Event& iEvent, bool useL1EventSetup = true; bool useL1GtTriggerMenuLite = false; + m_l1GtUtilsProv.getL1GtRunCache(iEvent, evSetup, useL1EventSetup, + useL1GtTriggerMenuLite); + m_l1GtUtils.getL1GtRunCache(iEvent, evSetup, useL1EventSetup, useL1GtTriggerMenuLite); @@ -1067,22 +1057,13 @@ void L1GtAnalyzer::analyzeL1GtUtils(const edm::Event& iEvent, bool useL1EventSetup = true; bool useL1GtTriggerMenuLite = true; - if (m_l1GtTmLInputTagProv) { - - // input tag for L1GtTriggerMenuLite retrieved from provenance - m_l1GtUtils.getL1GtRunCache(iEvent, evSetup, useL1EventSetup, + m_l1GtUtilsProv.getL1GtRunCache(iEvent, evSetup, useL1EventSetup, useL1GtTriggerMenuLite); - } else { - - // input tag for L1GtTriggerMenuLite explicitly given - m_l1GtUtils.getL1GtRunCache(iEvent, evSetup, useL1EventSetup, - useL1GtTriggerMenuLite, m_l1GtTmLInputTag); - - } + m_l1GtUtils.getL1GtRunCache(iEvent, evSetup, useL1EventSetup, + useL1GtTriggerMenuLite); analyzeL1GtUtilsCore(iEvent, evSetup); - } void L1GtAnalyzer::analyzeTrigger(const edm::Event& iEvent, @@ -1141,19 +1122,11 @@ void L1GtAnalyzer::analyzeTrigger(const edm::Event& iEvent, break; } - if (m_l1GtTmLInputTagProv) { - - // input tag for L1GtTriggerMenuLite retrieved from provenance - m_l1GtUtils.getL1GtRunCache(iEvent, evSetup, useL1EventSetup, + m_l1GtUtilsProv.getL1GtRunCache(iEvent, evSetup, useL1EventSetup, useL1GtTriggerMenuLite); - } else { - - // input tag for L1GtTriggerMenuLite explicitly given - m_l1GtUtils.getL1GtRunCache(iEvent, evSetup, useL1EventSetup, - useL1GtTriggerMenuLite, m_l1GtTmLInputTag); - - } + m_l1GtUtils.getL1GtRunCache(iEvent, evSetup, useL1EventSetup, + useL1GtTriggerMenuLite); // testing which environment is used @@ -1192,42 +1165,36 @@ void L1GtAnalyzer::analyzeTrigger(const edm::Event& iEvent, int triggerMaskAlgTechTrig = -1; if (m_l1GtRecordsInputTagProv) { - decisionBeforeMaskAlgTechTrig = m_l1GtUtils.decisionBeforeMask(iEvent, + decisionBeforeMaskAlgTechTrig = m_l1GtUtilsProv.decisionBeforeMask(iEvent, m_nameAlgTechTrig, iErrorCode); - decisionAfterMaskAlgTechTrig = m_l1GtUtils.decisionAfterMask(iEvent, + decisionAfterMaskAlgTechTrig = m_l1GtUtilsProv.decisionAfterMask(iEvent, m_nameAlgTechTrig, iErrorCode); - decisionAlgTechTrig = m_l1GtUtils.decision(iEvent, m_nameAlgTechTrig, + decisionAlgTechTrig = m_l1GtUtilsProv.decision(iEvent, m_nameAlgTechTrig, iErrorCode); - prescaleFactorAlgTechTrig = m_l1GtUtils.prescaleFactor(iEvent, + prescaleFactorAlgTechTrig = m_l1GtUtilsProv.prescaleFactor(iEvent, m_nameAlgTechTrig, iErrorCode); - triggerMaskAlgTechTrig = m_l1GtUtils.triggerMask(iEvent, + triggerMaskAlgTechTrig = m_l1GtUtilsProv.triggerMask(iEvent, m_nameAlgTechTrig, iErrorCode); } else { decisionBeforeMaskAlgTechTrig = m_l1GtUtils.decisionBeforeMask(iEvent, - m_l1GtRecordInputTag, m_l1GtDaqReadoutRecordInputTag, m_nameAlgTechTrig, iErrorCode); decisionAfterMaskAlgTechTrig = m_l1GtUtils.decisionAfterMask(iEvent, - m_l1GtRecordInputTag, m_l1GtDaqReadoutRecordInputTag, m_nameAlgTechTrig, iErrorCode); decisionAlgTechTrig = m_l1GtUtils.decision(iEvent, - m_l1GtRecordInputTag, m_l1GtDaqReadoutRecordInputTag, m_nameAlgTechTrig, iErrorCode); prescaleFactorAlgTechTrig = m_l1GtUtils.prescaleFactor(iEvent, - m_l1GtRecordInputTag, m_l1GtDaqReadoutRecordInputTag, m_nameAlgTechTrig, iErrorCode); triggerMaskAlgTechTrig = m_l1GtUtils.triggerMask(iEvent, - m_l1GtRecordInputTag, m_l1GtDaqReadoutRecordInputTag, m_nameAlgTechTrig, iErrorCode); - } switch (iErrorCode) { @@ -1276,7 +1243,7 @@ void L1GtAnalyzer::analyzeTrigger(const edm::Event& iEvent, bool gtObjectMapRecordValid = false; edm::Handle<L1GlobalTriggerObjectMaps> gtObjectMaps; - iEvent.getByLabel(m_l1GtObjectMapsInputTag, gtObjectMaps); + iEvent.getByToken(m_l1GtObjectMapsToken, gtObjectMaps); if (gtObjectMaps.isValid()) { @@ -1291,7 +1258,7 @@ void L1GtAnalyzer::analyzeTrigger(const edm::Event& iEvent, } edm::Handle<L1GlobalTriggerObjectMapRecord> gtObjectMapRecord; - iEvent.getByLabel(m_l1GtObjectMapTag, gtObjectMapRecord); + iEvent.getByToken(m_l1GtObjectMapToken, gtObjectMapRecord); if (gtObjectMapRecord.isValid()) { @@ -1378,7 +1345,7 @@ void L1GtAnalyzer::analyzeObjectMap(const edm::Event& iEvent, // get a handle to the object map product // the product can come only from emulator - no hardware ObjectMapRecord edm::Handle<L1GlobalTriggerObjectMapRecord> gtObjectMapRecord; - iEvent.getByLabel(m_l1GtObjectMapTag, gtObjectMapRecord); + iEvent.getByToken(m_l1GtObjectMapToken, gtObjectMapRecord); if (!gtObjectMapRecord.isValid()) { LogDebug("L1GtAnalyzer") @@ -1446,7 +1413,7 @@ void L1GtAnalyzer::analyzeL1GtTriggerMenuLite(const edm::Event& iEvent, // get L1GtTriggerMenuLite edm::Handle<L1GtTriggerMenuLite> triggerMenuLite; - iRun.getByLabel(m_l1GtTmLInputTag, triggerMenuLite); + iRun.getByToken(m_l1GtTmLToken, triggerMenuLite); if (!triggerMenuLite.isValid()) { @@ -1640,7 +1607,7 @@ void L1GtAnalyzer::analyzeConditionsInRunBlock(const edm::Run& iRun, // get ConditionsInRunBlock edm::Handle<edm::ConditionsInRunBlock> condInRunBlock; - iRun.getByLabel(m_condInEdmInputTag, condInRunBlock); + iRun.getByToken(m_condInRunToken, condInRunBlock); if (!condInRunBlock.isValid()) { @@ -1680,7 +1647,7 @@ void L1GtAnalyzer::analyzeConditionsInLumiBlock( // get ConditionsInLumiBlock edm::Handle<edm::ConditionsInLumiBlock> condInLumiBlock; - iLumi.getByLabel(m_condInEdmInputTag, condInLumiBlock); + iLumi.getByToken(m_condInLumiToken, condInLumiBlock); if (!condInLumiBlock.isValid()) { @@ -1717,7 +1684,7 @@ void L1GtAnalyzer::analyzeConditionsInEventBlock(const edm::Event& iEvent, // get ConditionsInEventBlock edm::Handle<edm::ConditionsInEventBlock> condInEventBlock; - iEvent.getByLabel(m_condInEdmInputTag, condInEventBlock); + iEvent.getByToken(m_condInEventToken, condInEventBlock); if (!condInEventBlock.isValid()) { diff --git a/L1Trigger/GlobalTriggerAnalyzer/src/L1GtUtils.cc b/L1Trigger/GlobalTriggerAnalyzer/src/L1GtUtils.cc index 905cd8df534ec..ac57c4ae26d91 100644 --- a/L1Trigger/GlobalTriggerAnalyzer/src/L1GtUtils.cc +++ b/L1Trigger/GlobalTriggerAnalyzer/src/L1GtUtils.cc @@ -67,8 +67,6 @@ L1GtUtils::L1GtUtils() : m_runIDCache(0), - m_provRunIDCache(0), - m_physicsDaqPartition(0), m_retrieveL1EventSetup(false), @@ -80,6 +78,18 @@ L1GtUtils::L1GtUtils() : // empty } +L1GtUtils::L1GtUtils(edm::ParameterSet const& pset, + edm::ConsumesCollector&& iC, + bool useL1GtTriggerMenuLite) : + L1GtUtils(pset, iC, useL1GtTriggerMenuLite) { } + +L1GtUtils::L1GtUtils(edm::ParameterSet const& pset, + edm::ConsumesCollector& iC, + bool useL1GtTriggerMenuLite) : + L1GtUtils() { + m_l1GtUtilsHelper.reset(new L1GtUtilsHelper(pset, iC, useL1GtTriggerMenuLite)); +} + // destructor L1GtUtils::~L1GtUtils() { @@ -266,21 +276,19 @@ void L1GtUtils::retrieveL1EventSetup(const edm::EventSetup& evSetup) { } -void L1GtUtils::retrieveL1GtTriggerMenuLite(const edm::Run& iRun, - const edm::InputTag& l1GtMenuLiteInputTag) { +void L1GtUtils::retrieveL1GtTriggerMenuLite(const edm::Run& iRun) { - // m_retrieveL1GtTriggerMenuLite = true; // get L1GtTriggerMenuLite edm::Handle<L1GtTriggerMenuLite> l1GtMenuLite; - iRun.getByLabel(l1GtMenuLiteInputTag, l1GtMenuLite); + iRun.getByToken(m_l1GtUtilsHelper->l1GtTriggerMenuLiteToken(), l1GtMenuLite); if (!l1GtMenuLite.isValid()) { LogDebug("L1GtUtils") << "\nL1GtTriggerMenuLite with \n " - << l1GtMenuLiteInputTag - << "\nrequested in configuration, but not found in the event." + << m_l1GtUtilsHelper->l1GtTriggerMenuLiteInputTag() + << "\nrequested, but not found in the run." << std::endl; m_l1GtMenuLiteValid = false; @@ -289,7 +297,7 @@ void L1GtUtils::retrieveL1GtTriggerMenuLite(const edm::Run& iRun, m_l1GtMenuLiteValid = true; LogDebug("L1GtUtils") << "\nL1GtTriggerMenuLite with \n " - << l1GtMenuLiteInputTag << "\nretrieved for run " + << m_l1GtUtilsHelper->l1GtTriggerMenuLiteInputTag() << "\nretrieved for run " << iRun.runAuxiliary().run() << std::endl; m_algorithmMapLite = &(m_l1GtMenuLite->gtAlgorithmMap()); @@ -303,14 +311,12 @@ void L1GtUtils::retrieveL1GtTriggerMenuLite(const edm::Run& iRun, = &(m_l1GtMenuLite->gtPrescaleFactorsAlgoTrig()); m_prescaleFactorsTechTrigLite = &(m_l1GtMenuLite->gtPrescaleFactorsTechTrig()); - } - } void L1GtUtils::getL1GtRunCache(const edm::Run& iRun, - const edm::EventSetup& evSetup, const bool useL1EventSetup, - const bool useL1GtTriggerMenuLite, const edm::InputTag& l1GtTmLInputTag) { + const edm::EventSetup& evSetup, bool useL1EventSetup, + bool useL1GtTriggerMenuLite) { // first call will turn this to true: the quantities which can be cached in // beginRun will not be cached then in analyze @@ -328,31 +334,13 @@ void L1GtUtils::getL1GtRunCache(const edm::Run& iRun, // L1GtTriggerMenuLite is defined per run and produced in prompt reco by L1Reco // and put in the Run section if (useL1GtTriggerMenuLite) { - retrieveL1GtTriggerMenuLite(iRun, l1GtTmLInputTag); + retrieveL1GtTriggerMenuLite(iRun); } - } - -void L1GtUtils::getL1GtRunCache(const edm::Run& iRun, - const edm::EventSetup& evSetup, bool useL1EventSetup, - bool useL1GtTriggerMenuLite) { - - if (useL1GtTriggerMenuLite) { - getL1GtTriggerMenuLiteInputTag(iRun, m_provL1GtTriggerMenuLiteInputTag); - - } - - getL1GtRunCache(iRun, evSetup, useL1EventSetup, useL1GtTriggerMenuLite, - m_provL1GtTriggerMenuLiteInputTag); - -} - - - void L1GtUtils::getL1GtRunCache(const edm::Event& iEvent, const edm::EventSetup& evSetup, const bool useL1EventSetup, - const bool useL1GtTriggerMenuLite, const edm::InputTag& l1GtTmLInputTag) { + const bool useL1GtTriggerMenuLite) { // if there was no retrieval and caching in beginRun, do it here if (!m_beginRunCache) { @@ -376,175 +364,13 @@ void L1GtUtils::getL1GtRunCache(const edm::Event& iEvent, // L1GtTriggerMenuLite is defined per run and produced in prompt reco by L1Reco // and put in the Run section if (useL1GtTriggerMenuLite) { - retrieveL1GtTriggerMenuLite(iRun, l1GtTmLInputTag); + retrieveL1GtTriggerMenuLite(iRun); } } - - // find from provenance and cache the input tags for L1GlobalTriggerRecord and - // L1GlobalTriggerReadoutRecord - getL1GtRecordInputTag(iEvent, m_provL1GtRecordInputTag, - m_provL1GtReadoutRecordInputTag); - - // m_runIDCache = runID; - - } - -} - - -void L1GtUtils::getL1GtRunCache(const edm::Event& iEvent, - const edm::EventSetup& evSetup, const bool useL1EventSetup, - const bool useL1GtTriggerMenuLite) { - - // if the input tag for L1GtTriggerMenuLite was not found in beginRun, do it here - if (!m_beginRunCache) { - - const edm::Run& iRun = iEvent.getRun(); - edm::RunID runID = iRun.runAuxiliary().id(); - - if (runID != m_provRunIDCache) { - - if (useL1GtTriggerMenuLite) { - - getL1GtTriggerMenuLiteInputTag(iRun, - m_provL1GtTriggerMenuLiteInputTag); - } - - // - m_provRunIDCache = runID; - } - - } - - // call now the general method for getL1GtRunCache - getL1GtRunCache(iEvent, evSetup, useL1EventSetup, useL1GtTriggerMenuLite, - m_provL1GtTriggerMenuLiteInputTag); - -} - - -void L1GtUtils::getL1GtRecordInputTag(const edm::Event& iEvent, - edm::InputTag& l1GtRecordInputTag, - edm::InputTag& l1GtReadoutRecordInputTag) const { - - typedef std::vector<edm::Provenance const*> Provenances; - Provenances provenances; - std::string friendlyName; - std::string modLabel; - std::string instanceName; - std::string processName; - - bool foundL1GtRecord = false; - bool foundL1GtReadoutRecord = false; - - LogDebug("L1GtUtils") << "\nTry to get AllProvenance for event " - << iEvent.id().event() << std::endl; - - iEvent.getAllProvenance(provenances); - - LogTrace("L1GtUtils") << "\n" << "Event contains " << provenances.size() - << " product" << (provenances.size() == 1 ? "" : "s") - << " with friendlyClassName, moduleLabel, productInstanceName and processName:\n" - << std::endl; - - for (Provenances::iterator itProv = provenances.begin(), itProvEnd = - provenances.end(); itProv != itProvEnd; ++itProv) { - - friendlyName = (*itProv)->friendlyClassName(); - modLabel = (*itProv)->moduleLabel(); - instanceName = (*itProv)->productInstanceName(); - processName = (*itProv)->processName(); - - LogTrace("L1GtUtils") << friendlyName << "\t \"" << modLabel - << "\" \t \"" << instanceName << "\" \t \"" << processName - << "\"" << std::endl; - - if (friendlyName == "L1GlobalTriggerRecord") { - l1GtRecordInputTag = edm::InputTag(modLabel, instanceName, - processName); - foundL1GtRecord = true; - } else if (friendlyName == "L1GlobalTriggerReadoutRecord") { - - l1GtReadoutRecordInputTag = edm::InputTag(modLabel, instanceName, - processName); - foundL1GtReadoutRecord = true; - } } - - // if not found, return empty input tags - if (!foundL1GtRecord) { - l1GtRecordInputTag = edm::InputTag(); - } else { - LogTrace("L1GtUtils") - << "\nL1GlobalTriggerRecord found in the event with \n " - << l1GtRecordInputTag << std::endl; - } - - if (!foundL1GtReadoutRecord) { - l1GtReadoutRecordInputTag = edm::InputTag(); - } else { - LogTrace("L1GtUtils") - << "\nL1GlobalTriggerReadoutRecord found in the event with \n " - << l1GtReadoutRecordInputTag << std::endl; - } - } -void L1GtUtils::getL1GtTriggerMenuLiteInputTag(const edm::Run& iRun, - edm::InputTag& l1GtTriggerMenuLiteInputTag) const { - - typedef std::vector<edm::Provenance const*> Provenances; - Provenances provenances; - std::string friendlyName; - std::string modLabel; - std::string instanceName; - std::string processName; - - bool foundL1GtTriggerMenuLite = false; - - LogDebug("L1GtUtils") << "\nTry to get AllProvenance for run " - << iRun.runAuxiliary().run() << std::endl; - - iRun.getAllProvenance(provenances); - - LogTrace("L1GtUtils") << "\n" << "Run contains " << provenances.size() - << " product" << (provenances.size() == 1 ? "" : "s") - << " with friendlyClassName, moduleLabel, productInstanceName and processName:\n" - << std::endl; - - for (Provenances::iterator itProv = provenances.begin(), itProvEnd = - provenances.end(); itProv != itProvEnd; ++itProv) { - - friendlyName = (*itProv)->friendlyClassName(); - modLabel = (*itProv)->moduleLabel(); - instanceName = (*itProv)->productInstanceName(); - processName = (*itProv)->processName(); - - LogTrace("L1GtUtils") << friendlyName << "\t \"" << modLabel - << "\" \t \"" << instanceName << "\" \t \"" << processName - << "\"" << std::endl; - - if (friendlyName == "L1GtTriggerMenuLite") { - l1GtTriggerMenuLiteInputTag = edm::InputTag(modLabel, instanceName, - processName); - foundL1GtTriggerMenuLite = true; - } - - } - - if (!foundL1GtTriggerMenuLite) { - l1GtTriggerMenuLiteInputTag = edm::InputTag(); - LogTrace("L1GtUtils") << "\nL1GtTriggerMenuLite not found in Run" - << std::endl; - } else { - LogTrace("L1GtUtils") << "\nL1GtTriggerMenuLite found in Run with \n " - << l1GtTriggerMenuLiteInputTag << std::endl; - } - -} - - const bool L1GtUtils::l1AlgoTechTrigBitNumber( const std::string& nameAlgoTechTrig, TriggerCategory& trigCategory, int& bitNumber) const { @@ -883,8 +709,6 @@ const bool L1GtUtils::l1TriggerNameFromBit(const int& bitNumber, } const int L1GtUtils::l1Results(const edm::Event& iEvent, - const edm::InputTag& l1GtRecordInputTag, - const edm::InputTag& l1GtReadoutRecordInputTag, const std::string& nameAlgoTechTrig, bool& decisionBeforeMask, bool& decisionAfterMask, int& prescaleFactor, int& triggerMask) const { @@ -1001,7 +825,7 @@ const int L1GtUtils::l1Results(const edm::Event& iEvent, bool gtReadoutRecordValid = false; edm::Handle<L1GlobalTriggerRecord> gtRecord; - iEvent.getByLabel(l1GtRecordInputTag, gtRecord); + iEvent.getByToken(m_l1GtUtilsHelper->l1GtRecordToken(), gtRecord); if (gtRecord.isValid()) { @@ -1011,12 +835,12 @@ const int L1GtUtils::l1Results(const edm::Event& iEvent, iErrorRecord = 10; LogDebug("L1GtUtils") << "\nL1GlobalTriggerRecord with \n " - << l1GtRecordInputTag << "\nnot found in the event." + << m_l1GtUtilsHelper->l1GtRecordInputTag() << "\nnot found in the event." << std::endl; } edm::Handle<L1GlobalTriggerReadoutRecord> gtReadoutRecord; - iEvent.getByLabel(l1GtReadoutRecordInputTag, gtReadoutRecord); + iEvent.getByToken(m_l1GtUtilsHelper->l1GtReadoutRecordToken(), gtReadoutRecord); if (gtReadoutRecord.isValid()) { @@ -1027,7 +851,7 @@ const int L1GtUtils::l1Results(const edm::Event& iEvent, iErrorRecord = iErrorRecord + 100; LogDebug("L1GtUtils") << "\nL1GlobalTriggerReadoutRecord with \n " - << l1GtReadoutRecordInputTag << "\nnot found in the event." + << m_l1GtUtilsHelper->l1GtReadoutRecordInputTag() << "\nnot found in the event." << std::endl; } @@ -1062,9 +886,9 @@ const int L1GtUtils::l1Results(const edm::Event& iEvent, LogDebug("L1GtUtils") << "\nError: " << "\nNo valid L1GlobalTriggerRecord with \n " - << l1GtRecordInputTag << "\nfound in the event." + << m_l1GtUtilsHelper->l1GtRecordInputTag() << "\nfound in the event." << "\nNo valid L1GlobalTriggerReadoutRecord with \n " - << l1GtReadoutRecordInputTag << "\nfound in the event." + << m_l1GtUtilsHelper->l1GtReadoutRecordInputTag() << "\nfound in the event." << std::endl; iError = l1ConfCode + iErrorRecord; @@ -1345,49 +1169,6 @@ const int L1GtUtils::l1Results(const edm::Event& iEvent, } return iError; - -} - - -const int L1GtUtils::l1Results(const edm::Event& iEvent, - const std::string& nameAlgoTechTrig, bool& decisionBeforeMask, - bool& decisionAfterMask, int& prescaleFactor, int& triggerMask) const { - - // initial values for returned results - decisionBeforeMask = false; - decisionAfterMask = false; - prescaleFactor = -1; - triggerMask = -1; - - int l1ErrorCode = 0; - - l1ErrorCode = l1Results(iEvent, m_provL1GtRecordInputTag, - m_provL1GtReadoutRecordInputTag, nameAlgoTechTrig, decisionBeforeMask, - decisionAfterMask, prescaleFactor, triggerMask); - - return l1ErrorCode; - -} - -// - -const bool L1GtUtils::decisionBeforeMask(const edm::Event& iEvent, - const edm::InputTag& l1GtRecordInputTag, - const edm::InputTag& l1GtReadoutRecordInputTag, - const std::string& nameAlgoTechTrig, int& errorCode) const { - - // initial values - bool decisionBeforeMask = false; - bool decisionAfterMask = false; - int prescaleFactor = -1; - int triggerMask = -1; - - errorCode = l1Results(iEvent, l1GtRecordInputTag, - l1GtReadoutRecordInputTag, nameAlgoTechTrig, decisionBeforeMask, - decisionAfterMask, prescaleFactor, triggerMask); - - return decisionBeforeMask; - } const bool L1GtUtils::decisionBeforeMask(const edm::Event& iEvent, @@ -1403,28 +1184,6 @@ const bool L1GtUtils::decisionBeforeMask(const edm::Event& iEvent, decisionAfterMask, prescaleFactor, triggerMask); return decisionBeforeMask; - -} - -// - -const bool L1GtUtils::decisionAfterMask(const edm::Event& iEvent, - const edm::InputTag& l1GtRecordInputTag, - const edm::InputTag& l1GtReadoutRecordInputTag, - const std::string& nameAlgoTechTrig, int& errorCode) const { - - // initial values - bool decisionBeforeMask = false; - bool decisionAfterMask = false; - int prescaleFactor = -1; - int triggerMask = -1; - - errorCode = l1Results(iEvent, l1GtRecordInputTag, - l1GtReadoutRecordInputTag, nameAlgoTechTrig, decisionBeforeMask, - decisionAfterMask, prescaleFactor, triggerMask); - - return decisionAfterMask; - } const bool L1GtUtils::decisionAfterMask(const edm::Event& iEvent, @@ -1440,28 +1199,6 @@ const bool L1GtUtils::decisionAfterMask(const edm::Event& iEvent, decisionAfterMask, prescaleFactor, triggerMask); return decisionAfterMask; - -} - -// - -const bool L1GtUtils::decision(const edm::Event& iEvent, - const edm::InputTag& l1GtRecordInputTag, - const edm::InputTag& l1GtReadoutRecordInputTag, - const std::string& nameAlgoTechTrig, int& errorCode) const { - - // initial values - bool decisionBeforeMask = false; - bool decisionAfterMask = false; - int prescaleFactor = -1; - int triggerMask = -1; - - errorCode = l1Results(iEvent, l1GtRecordInputTag, - l1GtReadoutRecordInputTag, nameAlgoTechTrig, decisionBeforeMask, - decisionAfterMask, prescaleFactor, triggerMask); - - return decisionAfterMask; - } const bool L1GtUtils::decision(const edm::Event& iEvent, @@ -1477,28 +1214,6 @@ const bool L1GtUtils::decision(const edm::Event& iEvent, decisionAfterMask, prescaleFactor, triggerMask); return decisionAfterMask; - -} - -// - -const int L1GtUtils::prescaleFactor(const edm::Event& iEvent, - const edm::InputTag& l1GtRecordInputTag, - const edm::InputTag& l1GtReadoutRecordInputTag, - const std::string& nameAlgoTechTrig, int& errorCode) const { - - // initial values - bool decisionBeforeMask = false; - bool decisionAfterMask = false; - int prescaleFactor = -1; - int triggerMask = -1; - - errorCode = l1Results(iEvent, l1GtRecordInputTag, - l1GtReadoutRecordInputTag, nameAlgoTechTrig, decisionBeforeMask, - decisionAfterMask, prescaleFactor, triggerMask); - - return prescaleFactor; - } const int L1GtUtils::prescaleFactor(const edm::Event& iEvent, @@ -1514,26 +1229,6 @@ const int L1GtUtils::prescaleFactor(const edm::Event& iEvent, decisionAfterMask, prescaleFactor, triggerMask); return prescaleFactor; - -} - -const int L1GtUtils::triggerMask(const edm::Event& iEvent, - const edm::InputTag& l1GtRecordInputTag, - const edm::InputTag& l1GtReadoutRecordInputTag, - const std::string& nameAlgoTechTrig, int& errorCode) const { - - // initial values - bool decisionBeforeMask = false; - bool decisionAfterMask = false; - int prescaleFactor = -1; - int triggerMask = -1; - - errorCode = l1Results(iEvent, l1GtRecordInputTag, - l1GtReadoutRecordInputTag, nameAlgoTechTrig, decisionBeforeMask, - decisionAfterMask, prescaleFactor, triggerMask); - - return triggerMask; - } const int L1GtUtils::triggerMask(const edm::Event& iEvent, @@ -1549,7 +1244,6 @@ const int L1GtUtils::triggerMask(const edm::Event& iEvent, decisionAfterMask, prescaleFactor, triggerMask); return triggerMask; - } const int L1GtUtils::triggerMask(const std::string& nameAlgoTechTrig, @@ -1758,8 +1452,6 @@ const int L1GtUtils::triggerMask(const std::string& nameAlgoTechTrig, } const int L1GtUtils::prescaleFactorSetIndex(const edm::Event& iEvent, - const edm::InputTag& l1GtRecordInputTag, - const edm::InputTag& l1GtReadoutRecordInputTag, const TriggerCategory& trigCategory, int& errorCode) const { // initialize the index to a negative value @@ -1789,7 +1481,7 @@ const int L1GtUtils::prescaleFactorSetIndex(const edm::Event& iEvent, bool gtReadoutRecordValid = false; edm::Handle<L1GlobalTriggerRecord> gtRecord; - iEvent.getByLabel(l1GtRecordInputTag, gtRecord); + iEvent.getByToken(m_l1GtUtilsHelper->l1GtRecordToken(), gtRecord); if (gtRecord.isValid()) { @@ -1799,12 +1491,12 @@ const int L1GtUtils::prescaleFactorSetIndex(const edm::Event& iEvent, iErrorRecord = 10; LogDebug("L1GtUtils") << "\nL1GlobalTriggerRecord with \n " - << l1GtRecordInputTag << "\nnot found in the event." + << m_l1GtUtilsHelper->l1GtRecordInputTag() << "\nnot found in the event." << std::endl; } edm::Handle<L1GlobalTriggerReadoutRecord> gtReadoutRecord; - iEvent.getByLabel(l1GtReadoutRecordInputTag, gtReadoutRecord); + iEvent.getByToken(m_l1GtUtilsHelper->l1GtReadoutRecordToken(), gtReadoutRecord); if (gtReadoutRecord.isValid()) { @@ -1815,7 +1507,7 @@ const int L1GtUtils::prescaleFactorSetIndex(const edm::Event& iEvent, iErrorRecord = iErrorRecord + 100; LogDebug("L1GtUtils") << "\nL1GlobalTriggerReadoutRecord with \n " - << l1GtReadoutRecordInputTag << "\nnot found in the event." + << m_l1GtUtilsHelper->l1GtReadoutRecordInputTag() << "\nnot found in the event." << std::endl; } @@ -1850,9 +1542,9 @@ const int L1GtUtils::prescaleFactorSetIndex(const edm::Event& iEvent, LogDebug("L1GtUtils") << "\nError: " << "\nNo valid L1GlobalTriggerRecord with \n " - << l1GtRecordInputTag << "\nfound in the event." + << m_l1GtUtilsHelper->l1GtRecordInputTag() << "\nfound in the event." << "\nNo valid L1GlobalTriggerReadoutRecord with \n " - << l1GtReadoutRecordInputTag << "\nfound in the event." + << m_l1GtUtilsHelper->l1GtReadoutRecordInputTag() << "\nfound in the event." << std::endl; iError = l1ConfCode + iErrorRecord; @@ -1961,29 +1653,7 @@ const int L1GtUtils::prescaleFactorSetIndex(const edm::Event& iEvent, } - -const int L1GtUtils::prescaleFactorSetIndex(const edm::Event& iEvent, - const TriggerCategory& trigCategory, int& errorCode) const { - - // initialize error code and return value - int iError = 0; - int pfIndex = -1; - - pfIndex = prescaleFactorSetIndex(iEvent, m_provL1GtRecordInputTag, - m_provL1GtReadoutRecordInputTag, trigCategory, iError); - - // return the error code and the index value - // if the error code is 0, the index returned is -1 - errorCode = iError; - return pfIndex; - -} - - - const std::vector<int>& L1GtUtils::prescaleFactorSet(const edm::Event& iEvent, - const edm::InputTag& l1GtRecordInputTag, - const edm::InputTag& l1GtReadoutRecordInputTag, const TriggerCategory& trigCategory, int& errorCode) { // clear the vector before filling it @@ -1992,8 +1662,7 @@ const std::vector<int>& L1GtUtils::prescaleFactorSet(const edm::Event& iEvent, // initialize error code int iError = 0; - const int pfIndex = prescaleFactorSetIndex(iEvent, l1GtRecordInputTag, - l1GtReadoutRecordInputTag, trigCategory, iError); + const int pfIndex = prescaleFactorSetIndex(iEvent, trigCategory, iError); if (iError == 0) { @@ -2056,26 +1725,6 @@ const std::vector<int>& L1GtUtils::prescaleFactorSet(const edm::Event& iEvent, } -const std::vector<int>& L1GtUtils::prescaleFactorSet(const edm::Event& iEvent, - const TriggerCategory& trigCategory, int& errorCode) { - - // clear the vector before filling it - m_prescaleFactorSet.clear(); - - // initialize error code - int iError = 0; - - m_prescaleFactorSet = prescaleFactorSet(iEvent, m_provL1GtRecordInputTag, - m_provL1GtReadoutRecordInputTag, trigCategory, iError); - - errorCode = iError; - return m_prescaleFactorSet; - -} - - - - const std::vector<unsigned int>& L1GtUtils::triggerMaskSet( const TriggerCategory& trigCategory, int& errorCode) { @@ -2424,48 +2073,12 @@ L1GtUtils::LogicalExpressionL1Results::LogicalExpressionL1Results( m_l1GtUtils(l1GtUtils), - m_l1GtRecordInputTag(edm::InputTag()), - - m_l1GtReadoutRecordInputTag(edm::InputTag()), - m_l1ConfCode(-1), m_validL1Configuration(false), m_validLogicalExpression(false), - m_l1GtInputTagsFromProv(true), - - m_l1ResultsAlreadyCalled(false), - - m_expL1TriggersSize(0), - - m_expBitsTechTrigger(false) { - - initialize(); -} - -L1GtUtils::LogicalExpressionL1Results::LogicalExpressionL1Results( - const std::string& expression, L1GtUtils& l1GtUtils, - const edm::InputTag& l1GtRecordInputTag, - const edm::InputTag& l1GtReadoutRecordInputTag) : - - m_logicalExpression(expression), - - m_l1GtUtils(l1GtUtils), - - m_l1GtRecordInputTag(l1GtRecordInputTag), - - m_l1GtReadoutRecordInputTag(l1GtReadoutRecordInputTag), - - m_l1ConfCode(-1), - - m_validL1Configuration(false), - - m_validLogicalExpression(false), - - m_l1GtInputTagsFromProv(false), - m_l1ResultsAlreadyCalled(false), m_expL1TriggersSize(0), @@ -2762,15 +2375,7 @@ const std::vector<std::pair<std::string, int> >& L1GtUtils::LogicalExpressionL1R } - if (m_l1GtInputTagsFromProv) { - - l1Results(iEvent, m_l1GtUtils.provL1GtRecordInputTag(), - m_l1GtUtils.provL1GtReadoutRecordInputTag()); - - } else { - - l1Results(iEvent, m_l1GtRecordInputTag, m_l1GtReadoutRecordInputTag); - } + l1Results(iEvent); m_l1ResultsAlreadyCalled = true; @@ -2794,9 +2399,7 @@ void L1GtUtils::LogicalExpressionL1Results::reset( } } -void L1GtUtils::LogicalExpressionL1Results::l1Results(const edm::Event& iEvent, - const edm::InputTag& l1GtRecordInputTag, - const edm::InputTag& l1GtReadoutRecordInputTag) { +void L1GtUtils::LogicalExpressionL1Results::l1Results(const edm::Event& iEvent) { // reset the vectors before filling them reset(m_decisionsBeforeMask); @@ -2823,8 +2426,7 @@ void L1GtUtils::LogicalExpressionL1Results::l1Results(const edm::Event& iEvent, const std::string& trigNameOrAlias = (m_expL1Triggers[iTrig]).tokenName; if (m_expTriggerInMenu[iTrig]) { - errorCode = m_l1GtUtils.l1Results(iEvent, l1GtRecordInputTag, - l1GtReadoutRecordInputTag, trigNameOrAlias, + errorCode = m_l1GtUtils.l1Results(iEvent, trigNameOrAlias, decisionBeforeMaskValue, decisionAfterMaskValue, prescaleFactorValue, triggerMaskValue); @@ -2882,4 +2484,3 @@ void L1GtUtils::LogicalExpressionL1Results::l1Results(const edm::Event& iEvent, const std::string L1GtUtils::EmptyString = ""; const int L1GtUtils::L1GtNotValidError = 99999; - diff --git a/L1Trigger/GlobalTriggerAnalyzer/src/L1GtUtilsHelper.cc b/L1Trigger/GlobalTriggerAnalyzer/src/L1GtUtilsHelper.cc new file mode 100644 index 0000000000000..4cf59f5d159e8 --- /dev/null +++ b/L1Trigger/GlobalTriggerAnalyzer/src/L1GtUtilsHelper.cc @@ -0,0 +1,102 @@ +#include "L1Trigger/GlobalTriggerAnalyzer/interface/L1GtUtilsHelper.h" +#include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerRecord.h" +#include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutRecord.h" +#include "DataFormats/L1GlobalTrigger/interface/L1GtTriggerMenuLite.h" +#include "DataFormats/Provenance/interface/BranchDescription.h" +#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" +#include "FWCore/Utilities/interface/BranchType.h" +#include "FWCore/Utilities/interface/TypeID.h" + +L1GtUtilsHelper::L1GtUtilsHelper(edm::ParameterSet const& pset, + edm::ConsumesCollector& iC, + bool useL1GtTriggerMenuLite) : + m_consumesCollector(std::move(iC)), + m_l1GtRecordInputTag(pset.getParameter<edm::InputTag>("l1GtRecordInputTag")), + m_l1GtReadoutRecordInputTag(pset.getParameter<edm::InputTag>("l1GtReadoutRecordInputTag")), + m_l1GtTriggerMenuLiteInputTag(pset.getParameter<edm::InputTag>("l1GtTriggerMenuLiteInputTag")), + m_findRecord(false), + m_findReadoutRecord(false), + m_findMenuLite(false), + m_foundRECORecord(false), + m_foundRECOReadoutRecord(false), + m_foundRECOMenuLite(false) +{ + m_l1GtRecordToken = iC.consumes<L1GlobalTriggerRecord>(m_l1GtRecordInputTag); + m_l1GtReadoutRecordToken = iC.consumes<L1GlobalTriggerReadoutRecord>(m_l1GtReadoutRecordInputTag); + if(useL1GtTriggerMenuLite) { + m_l1GtTriggerMenuLiteToken = iC.consumes<L1GtTriggerMenuLite,edm::InRun>(m_l1GtTriggerMenuLiteInputTag); + } +} + +void L1GtUtilsHelper::fillDescription(edm::ParameterSetDescription & desc) { + desc.add<edm::InputTag>("l1GtRecordInputTag", edm::InputTag()); + desc.add<edm::InputTag>("l1GtReadoutRecordInputTag", edm::InputTag()); + desc.add<edm::InputTag>("l1GtTriggerMenuLiteInputTag", edm::InputTag()); +} + +void L1GtUtilsHelper::operator()(edm::BranchDescription const& branchDescription) { + + // This is only used if required InputTags were not specified already. + // This is called early in the process, once for each product in the ProductRegistry. + // The callback is registered when callWhenNewProductsRegistered is called. + // It finds products by type and sets the token so that it can be used + // later when getting the product. + // This code assumes there is at most one product from the RECO process + // and at most one product from some other process. It selects a product + // from the RECO process if it is present and a product from some other process + // if it is not. This is a bit unsafe because if there is more than one from + // RECO or none from RECO and more than one from other processes it is somewhat + // arbitrary which one is selected. I'm leaving this behavior in to maintain + // consistency with the previous behavior. It is supposed to not happen and if + // it does the products might be identical anyway. To avoid this risk or select + // different products, specify the InputTags either in the configuration or the + // arguments to the constructor. + + if (m_findRecord && + branchDescription.unwrappedTypeID() == edm::TypeID(typeid(L1GlobalTriggerRecord)) && + branchDescription.branchType() == edm::InEvent) { + edm::InputTag tag{branchDescription.moduleLabel(), + branchDescription.productInstanceName(), + branchDescription.processName()}; + if(branchDescription.processName() == "RECO") { + m_l1GtRecordInputTag = tag; + m_l1GtRecordToken = m_consumesCollector.consumes<L1GlobalTriggerRecord>(tag); + m_foundRECORecord = true; + } else if (!m_foundRECORecord) { + m_l1GtRecordInputTag = tag; + m_l1GtRecordToken = m_consumesCollector.consumes<L1GlobalTriggerRecord>(tag); + } + } + + if (m_findReadoutRecord && + branchDescription.unwrappedTypeID() == edm::TypeID(typeid(L1GlobalTriggerReadoutRecord)) && + branchDescription.branchType() == edm::InEvent) { + edm::InputTag tag{branchDescription.moduleLabel(), + branchDescription.productInstanceName(), + branchDescription.processName()}; + if(branchDescription.processName() == "RECO") { + m_l1GtReadoutRecordInputTag = tag; + m_l1GtReadoutRecordToken = m_consumesCollector.consumes<L1GlobalTriggerReadoutRecord>(tag); + m_foundRECOReadoutRecord = true; + } else if (!m_foundRECOReadoutRecord) { + m_l1GtReadoutRecordInputTag = tag; + m_l1GtReadoutRecordToken = m_consumesCollector.consumes<L1GlobalTriggerReadoutRecord>(tag); + } + } + + if (m_findMenuLite && + branchDescription.branchType() == edm::InRun && + branchDescription.unwrappedTypeID() == edm::TypeID(typeid(L1GtTriggerMenuLite))) { + edm::InputTag tag{branchDescription.moduleLabel(), + branchDescription.productInstanceName(), + branchDescription.processName()}; + if(branchDescription.processName() == "RECO") { + m_l1GtTriggerMenuLiteInputTag = tag; + m_l1GtTriggerMenuLiteToken = m_consumesCollector.consumes<L1GtTriggerMenuLite,edm::InRun>(tag); + m_foundRECOMenuLite = true; + } else if (!m_foundRECOMenuLite) { + m_l1GtTriggerMenuLiteInputTag = tag; + m_l1GtTriggerMenuLiteToken = m_consumesCollector.consumes<L1GtTriggerMenuLite,edm::InRun>(tag); + } + } +} From 2ff8ec4d5f3981d921c2f977183b63876d8512a7 Mon Sep 17 00:00:00 2001 From: "W. David Dagenhart" <wdd@fnal.gov> Date: Mon, 4 May 2015 17:10:26 -0500 Subject: [PATCH 04/26] Consumes migration for L1GtUtils The previous commit added the consumes calls for L1GtUtils. This commit modifies the things that depend on L1GtUtils so that they still work with the modified L1GtUtils. New arguments were added to the L1GtUtils constructor. Specifying InputTags to other functions in L1GtUtils is no longer allowed. Some modules directly use L1GtUtils and some use it through a helper class. The most significant of the helper classes was HLTConfigProvider. In that case, the four functions that required its L1GtUtils member were split into a new helper class HLTPrescaleProvider. Modules that did not use those functions does not need modification, but those that did now have to use HLTPrescaleProvider. --- .../HcalCalibAlgos/src/GammaJetAnalysis.cc | 10 +- .../HcalCalibAlgos/src/GammaJetAnalysis.h | 4 +- .../plugins/IsoTrackCalib.cc | 19 +- .../IsolatedParticles/plugins/IsoTrackCalib.h | 4 +- .../IsolatedParticles/plugins/IsoTrig.cc | 18 +- .../IsolatedParticles/plugins/IsoTrig.h | 4 +- .../plugins/IsolatedTracksNxN.cc | 9 +- .../CandidateTriggerObjectProducer.h | 5 +- .../interface/GenericTriggerEventFlag.h | 25 ++- .../interface/PrescaleWeightProvider.h | 43 ++++- .../plugins/CandidateTriggerObjectProducer.cc | 27 +-- .../src/GenericTriggerEventFlag.cc | 6 +- .../src/PrescaleWeightProvider.cc | 23 ++- .../test/GenericTriggerEventFlagTest.cc | 2 +- DQM/L1TMonitor/interface/L1TMenuHelper.h | 6 +- DQM/L1TMonitor/interface/L1TRate.h | 3 + DQM/L1TMonitor/interface/L1TSync.h | 3 + DQM/L1TMonitor/src/L1TMenuHelper.cc | 7 +- DQM/L1TMonitor/src/L1TRate.cc | 6 +- DQM/L1TMonitor/src/L1TSync.cc | 6 +- DQM/Physics/src/EwkElecDQM.cc | 18 +- DQM/Physics/src/EwkElecDQM.h | 4 +- DQM/Physics/src/EwkMuDQM.cc | 19 +- DQM/Physics/src/EwkMuDQM.h | 4 +- .../src/SiStripMonitorCluster.cc | 6 +- .../src/SiStripMonitorTrack.cc | 2 +- DQM/TrackerCommon/interface/TriggerHelper.h | 30 ++- DQM/TrackerCommon/src/TriggerHelper.cc | 4 +- .../src/MonitorTrackResiduals.cc | 2 +- DQM/TrackingMonitor/src/LogMessageMonitor.cc | 2 +- DQM/TrackingMonitor/src/TrackingMonitor.cc | 2 +- DQM/TrackingMonitor/src/dEdxAnalyzer.cc | 2 +- .../interface/HLTSeedL1LogicScalers.h | 2 +- DQM/TrigXMonitor/src/HLTSeedL1LogicScalers.cc | 17 +- DQMOffline/JetMET/interface/METAnalyzer.h | 9 - DQMOffline/JetMET/src/JetAnalyzer.cc | 4 +- DQMOffline/JetMET/src/METAnalyzer.cc | 2 +- .../L1Trigger/interface/L1TRate_Offline.h | 4 + .../L1Trigger/interface/L1TSync_Offline.h | 3 + DQMOffline/L1Trigger/src/L1TRate_Offline.cc | 6 +- DQMOffline/L1Trigger/src/L1TSync_Offline.cc | 6 +- DQMOffline/Muon/src/MuonRecoOneHLT.cc | 4 +- FWCore/Framework/interface/ProducerBase.h | 1 - .../Framework/interface/one/EDAnalyzerBase.h | 2 - .../Framework/interface/stream/EDAnalyzer.h | 3 +- .../interface/stream/EDAnalyzerBase.h | 1 - .../HLTanalyzers/interface/HLTHeavyIon.h | 2 - HLTrigger/HLTanalyzers/interface/HLTInfo.h | 40 +++- HLTrigger/HLTanalyzers/src/HLTAnalyzer.cc | 3 +- HLTrigger/HLTanalyzers/src/HLTBitAnalyzer.cc | 3 +- HLTrigger/HLTanalyzers/src/HLTInfo.cc | 25 ++- .../HLTcore/interface/HLTConfigProvider.h | 21 -- .../HLTcore/interface/HLTEventAnalyzerAOD.h | 4 +- .../HLTcore/interface/HLTPrescaleProvider.h | 94 +++++++++ .../HLTcore/plugins/HLTEventAnalyzerAOD.cc | 59 +++--- HLTrigger/HLTcore/src/HLTConfigProvider.cc | 152 +-------------- HLTrigger/HLTcore/src/HLTPrescaleProvider.cc | 181 ++++++++++++++++++ .../interface/L1GtUtilsHelper.h | 8 +- .../src/L1GtUtilsHelper.cc | 3 - .../PatAlgos/plugins/PATTriggerProducer.cc | 66 +++---- .../PatAlgos/plugins/PATTriggerProducer.h | 7 +- Validation/RecoTau/src/TauTagValidation.cc | 2 +- .../src/AnotherPrimaryVertexAnalyzer.cc | 10 +- 63 files changed, 652 insertions(+), 417 deletions(-) create mode 100644 HLTrigger/HLTcore/interface/HLTPrescaleProvider.h create mode 100644 HLTrigger/HLTcore/src/HLTPrescaleProvider.cc diff --git a/Calibration/HcalCalibAlgos/src/GammaJetAnalysis.cc b/Calibration/HcalCalibAlgos/src/GammaJetAnalysis.cc index beaf62711fa29..51c2c84fcb371 100644 --- a/Calibration/HcalCalibAlgos/src/GammaJetAnalysis.cc +++ b/Calibration/HcalCalibAlgos/src/GammaJetAnalysis.cc @@ -68,7 +68,9 @@ unsigned int helper_findTrigger(const std::vector<std::string>& list, // ------------------------------------------------- -GammaJetAnalysis::GammaJetAnalysis(const edm::ParameterSet& iConfig) { +GammaJetAnalysis::GammaJetAnalysis(const edm::ParameterSet& iConfig) : + hltPrescaleProvider_(iConfig, consumesCollector(), *this) { + // set parameters debug_ = iConfig.getUntrackedParameter<int>("debug", 0); debugHLTTrigNames = iConfig.getUntrackedParameter<int>("debugHLTTrigNames",1); @@ -353,7 +355,7 @@ void GammaJetAnalysis::analyze(const edm::Event& iEvent, const edm::EventSetup& if (!writeTriggerPrescale_) photonTrigPrescale_.push_back(-1); else { // for triggers with two L1 seeds this fails - std::pair<int,int> prescaleVals= hltConfig_.prescaleValues(iEvent,evSetup, evTrigNames.triggerName(id)); + std::pair<int,int> prescaleVals= hltPrescaleProvider_.prescaleValues(iEvent,evSetup, evTrigNames.triggerName(id)); photonTrigPrescale_.push_back(prescaleVals.first * prescaleVals.second); } } @@ -368,7 +370,7 @@ void GammaJetAnalysis::analyze(const edm::Event& iEvent, const edm::EventSetup& int fired= triggerResults->accept(id); if (fired) jetTrigFlag=true; jetTrigFired_.push_back(fired); - std::pair<int,int> prescaleVals= hltConfig_.prescaleValues(iEvent,evSetup,evTrigNames.triggerName(id)); + std::pair<int,int> prescaleVals = hltPrescaleProvider_.prescaleValues(iEvent,evSetup,evTrigNames.triggerName(id)); jetTrigPrescale_.push_back(prescaleVals.first * prescaleVals.second); } } @@ -1594,7 +1596,7 @@ void GammaJetAnalysis::beginRun(const edm::Run &iRun, if (debug_>0) edm::LogInfo("GammaJetAnalysis") << "Initializing trigger information for individual run"; bool changed(true); std::string processName="HLT"; - if (hltConfig_.init(iRun,setup,processName,changed)) { + if (hltPrescaleProvider_.init(iRun,setup,processName,changed)) { // if init returns TRUE, initialisation has succeeded! if (changed) { // The HLT config has actually changed wrt the previous Run, hence rebook your diff --git a/Calibration/HcalCalibAlgos/src/GammaJetAnalysis.h b/Calibration/HcalCalibAlgos/src/GammaJetAnalysis.h index 7e724879bd315..aad058d07a526 100644 --- a/Calibration/HcalCalibAlgos/src/GammaJetAnalysis.h +++ b/Calibration/HcalCalibAlgos/src/GammaJetAnalysis.h @@ -49,7 +49,7 @@ #include "DataFormats/ParticleFlowCandidate/interface/PFCandidate.h" #include "DataFormats/ParticleFlowCandidate/interface/PFCandidateFwd.h" -#include "HLTrigger/HLTcore/interface/HLTConfigProvider.h" +#include "HLTrigger/HLTcore/interface/HLTPrescaleProvider.h" // forward declarations class TH1D; @@ -200,7 +200,7 @@ class GammaJetAnalysis : public edm::EDAnalyzer { TTree* pf_tree_; // trigger info - HLTConfigProvider hltConfig_; // variable for the access + HLTPrescaleProvider hltPrescaleProvider_; std::vector<int> photonTrigFired_; std::vector<int> photonTrigPrescale_; std::vector<int> jetTrigFired_; diff --git a/Calibration/IsolatedParticles/plugins/IsoTrackCalib.cc b/Calibration/IsolatedParticles/plugins/IsoTrackCalib.cc index bcea99c799d97..bf3e8dc189fe7 100644 --- a/Calibration/IsolatedParticles/plugins/IsoTrackCalib.cc +++ b/Calibration/IsolatedParticles/plugins/IsoTrackCalib.cc @@ -2,9 +2,12 @@ #include "DataFormats/Math/interface/deltaR.h" #include "DataFormats/Math/interface/deltaPhi.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "HLTrigger/HLTcore/interface/HLTConfigProvider.h" IsoTrackCalib::IsoTrackCalib(const edm::ParameterSet& iConfig) : - changed(false), nRun(0), t_trackP(0), t_trackPx(0), t_trackPy(0), + changed(false), + hltPrescaleProvider_(iConfig, consumesCollector(), *this), + nRun(0), t_trackP(0), t_trackPx(0), t_trackPy(0), t_trackPz(0), t_trackEta(0), t_trackPhi(0), t_trackPt(0), t_neu_iso(0), t_charge_iso(0), t_emip(0), t_ehcal(0), t_trkL3mindr(0), t_ieta(0), t_disthotcell(0), t_ietahotcell(0), t_eventweight(0), t_l1pt(0), t_l1eta(0), @@ -132,6 +135,8 @@ void IsoTrackCalib::analyze(const edm::Event& iEvent, const edm::EventSetup& iSe << " Bunch " << iEvent.bunchCrossing() << " start"; clearTreeVectors(); + HLTConfigProvider const& hltConfig = hltPrescaleProvider_.hltConfigProvider(); + //Get magnetic field and ECAL channel status edm::ESHandle<MagneticField> bFieldH; iSetup.get<IdealMagneticFieldRecord>().get(bFieldH); @@ -214,8 +219,8 @@ void IsoTrackCalib::analyze(const edm::Event& iEvent, const edm::EventSetup& iSe const std::vector<std::string> & triggerNames_ = triggerNames.triggerNames(); for (unsigned int iHLT=0; iHLT<triggerResults->size(); iHLT++) { bool ok(false); - unsigned int triggerindx = hltConfig_.triggerIndex(triggerNames_[iHLT]); - const std::vector<std::string>& moduleLabels(hltConfig_.moduleLabels(triggerindx)); + unsigned int triggerindx = hltConfig.triggerIndex(triggerNames_[iHLT]); + const std::vector<std::string>& moduleLabels(hltConfig.moduleLabels(triggerindx)); edm::LogInfo("IsoTrack") << iHLT << " " <<triggerNames_[iHLT]; int ipos = -1; for (unsigned int i=0; i<HLTNames.size(); ++i) { @@ -249,7 +254,7 @@ void IsoTrackCalib::analyze(const edm::Event& iEvent, const edm::EventSetup& iSe edm::LogInfo("IsoTrack") << "Trigger fired? : " << ok; if (ok) { std::vector<math::XYZTLorentzVector> vec[3]; - const std::pair<int,int> prescales(hltConfig_.prescaleValues(iEvent,iSetup,triggerNames_[iHLT])); + const std::pair<int,int> prescales(hltPrescaleProvider_.prescaleValues(iEvent,iSetup,triggerNames_[iHLT])); int preL1 = prescales.first; int preHLT = prescales.second; int prescale = preL1*preHLT; @@ -471,9 +476,9 @@ void IsoTrackCalib::analyze(const edm::Event& iEvent, const edm::EventSetup& iSe changed = false; if ((verbosity/10)%10 > 1) { edm::LogInfo("IsoTrack") <<"New trigger menu found !!!"; - const unsigned int n(hltConfig_.size()); + const unsigned int n(hltConfig.size()); for (unsigned itrig=0; itrig<triggerNames_.size(); itrig++) { - unsigned int triggerindx = hltConfig_.triggerIndex(triggerNames_[itrig]); + unsigned int triggerindx = hltConfig.triggerIndex(triggerNames_[itrig]); if (triggerindx >= n) edm::LogInfo("IsoTrack") << triggerNames_[itrig] << " " << triggerindx << " does not exist"; @@ -573,7 +578,7 @@ void IsoTrackCalib::endJob() { // ------------ method called when starting to processes a run ------------ void IsoTrackCalib::beginRun(edm::Run const& iRun, edm::EventSetup const& iSetup) { edm::LogInfo("IsoTrack") << "Run[" << nRun <<"] " << iRun.run() - << " hltconfig.init " << hltConfig_.init(iRun,iSetup,"HLT",changed); + << " hltconfig.init " << hltPrescaleProvider_.init(iRun,iSetup,"HLT",changed); char hname[100], htit[100]; sprintf(hname, "h_HLTAccepts_%i", iRun.run()); sprintf(htit, "HLT Accepts for Run No %i", iRun.run()); diff --git a/Calibration/IsolatedParticles/plugins/IsoTrackCalib.h b/Calibration/IsolatedParticles/plugins/IsoTrackCalib.h index 5bba5566c16a3..01b4b0a28046c 100644 --- a/Calibration/IsolatedParticles/plugins/IsoTrackCalib.h +++ b/Calibration/IsolatedParticles/plugins/IsoTrackCalib.h @@ -41,7 +41,7 @@ #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/Common/interface/TriggerNames.h" #include "CommonTools/UtilAlgos/interface/TFileService.h" -#include "HLTrigger/HLTcore/interface/HLTConfigProvider.h" +#include "HLTrigger/HLTcore/interface/HLTPrescaleProvider.h" #include "Calibration/IsolatedParticles/interface/CaloPropagateTrack.h" #include "Calibration/IsolatedParticles/interface/ChargeIsolation.h" @@ -95,7 +95,7 @@ class IsoTrackCalib : public edm::EDAnalyzer { bool changed; edm::Service<TFileService> fs; - HLTConfigProvider hltConfig_; + HLTPrescaleProvider hltPrescaleProvider_; std::vector<std::string> trigNames, HLTNames; int verbosity; spr::trackSelectionParameters selectionParameters; diff --git a/Calibration/IsolatedParticles/plugins/IsoTrig.cc b/Calibration/IsolatedParticles/plugins/IsoTrig.cc index da5a27b97ce25..6855585724dce 100644 --- a/Calibration/IsolatedParticles/plugins/IsoTrig.cc +++ b/Calibration/IsolatedParticles/plugins/IsoTrig.cc @@ -24,8 +24,10 @@ #include "Calibration/IsolatedParticles/interface/eCone.h" #include "Calibration/IsolatedParticles/interface/eECALMatrix.h" #include "HLTrigger/Timer/interface/FastTimerService.h" +#include "HLTrigger/HLTcore/interface/HLTConfigProvider.h" -IsoTrig::IsoTrig(const edm::ParameterSet& iConfig) : +IsoTrig::IsoTrig(const edm::ParameterSet& iConfig) : + hltPrescaleProvider_(iConfig, consumesCollector(), *this), changed(false), t_timeL2Prod(0), t_nPixCand(0), t_nPixSeed(0), t_nGoodTk(0), t_TrkhCone(0), t_TrkP(0), t_TrkselTkFlag(0), t_TrkqltyFlag(0), t_TrkMissFlag(0), t_TrkPVFlag(0), t_TrkNuIsolFlag(0), @@ -214,6 +216,8 @@ void IsoTrig::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { #endif int RunNo = iEvent.id().run(); + HLTConfigProvider const& hltConfig = hltPrescaleProvider_.hltConfigProvider(); + iSetup.get<IdealMagneticFieldRecord>().get(bFieldH); iSetup.get<CaloGeometryRecord>().get(pG); const MagneticField *bField = bFieldH.product(); @@ -309,8 +313,8 @@ void IsoTrig::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { #endif int hlt(-1), preL1(-1), preHLT(-1), prescale(-1); for (unsigned int i=0; i<triggerResults->size(); i++) { - unsigned int triggerindx = hltConfig_.triggerIndex(triggerNames_[i]); - const std::vector<std::string>& moduleLabels(hltConfig_.moduleLabels(triggerindx)); + unsigned int triggerindx = hltConfig.triggerIndex(triggerNames_[i]); + const std::vector<std::string>& moduleLabels(hltConfig.moduleLabels(triggerindx)); for (unsigned int in=0; in<trigNames.size(); ++in) { // if (triggerNames_[i].find(trigNames[in].c_str())!=std::string::npos || triggerNames_[i]==" ") { @@ -327,7 +331,7 @@ void IsoTrig::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { edm::Handle<trigger::TriggerFilterObjectWithRefs> L1cands; iEvent.getByToken(tok_l1cand_, L1cands); - const std::pair<int,int> prescales(hltConfig_.prescaleValues(iEvent,iSetup,triggerNames_[i])); + const std::pair<int,int> prescales(hltPrescaleProvider_.prescaleValues(iEvent,iSetup,triggerNames_[i])); preL1 = prescales.first; preHLT = prescales.second; prescale = preL1*preHLT; @@ -421,9 +425,9 @@ void IsoTrig::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { #ifdef DebugLog if ((verbosity/10)%10 > 1) { std::cout << "New trigger menu found !!!" << std::endl; - const unsigned int n(hltConfig_.size()); + const unsigned int n(hltConfig.size()); for (unsigned itrig=0; itrig<triggerNames_.size(); itrig++) { - unsigned int triggerindx = hltConfig_.triggerIndex(triggerNames_[itrig]); + unsigned int triggerindx = hltConfig.triggerIndex(triggerNames_[itrig]); std::cout << triggerNames_[itrig] << " " << triggerindx << " "; if (triggerindx >= n) std::cout << "does not exist in the current menu" << std::endl; @@ -812,7 +816,7 @@ void IsoTrig::endJob() { // ------------ method called when starting to processes a run ------------ void IsoTrig::beginRun(edm::Run const& iRun, edm::EventSetup const& iSetup) { edm::LogWarning ("IsoTrack") << "Run " << iRun.run() << " hltconfig.init " - << hltConfig_.init(iRun,iSetup,processName,changed); + << hltPrescaleProvider_.init(iRun,iSetup,processName,changed); } // ------------ method called when ending the processing of a run ------------ diff --git a/Calibration/IsolatedParticles/plugins/IsoTrig.h b/Calibration/IsolatedParticles/plugins/IsoTrig.h index 2e7bb181cbfbf..e5b8e06d775bd 100644 --- a/Calibration/IsolatedParticles/plugins/IsoTrig.h +++ b/Calibration/IsolatedParticles/plugins/IsoTrig.h @@ -30,7 +30,7 @@ #include "FWCore/ServiceRegistry/interface/Service.h" #include "CommonTools/UtilAlgos/interface/TFileService.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "HLTrigger/HLTcore/interface/HLTConfigProvider.h" +#include "HLTrigger/HLTcore/interface/HLTPrescaleProvider.h" #include "DataFormats/Math/interface/LorentzVector.h" #include "Calibration/IsolatedParticles/interface/TrackSelection.h" #include "DataFormats/TrackReco/interface/Track.h" @@ -120,7 +120,7 @@ class IsoTrig : public edm::EDAnalyzer { double getDistInCM(double eta1,double phi1, double eta2,double phi2); // ----------member data --------------------------- - HLTConfigProvider hltConfig_; + HLTPrescaleProvider hltPrescaleProvider_; std::vector<std::string> trigNames; edm::InputTag PixcandTag_, L1candTag_, L2candTag_; std::vector<edm::InputTag> pixelTracksSources_; diff --git a/Calibration/IsolatedParticles/plugins/IsolatedTracksNxN.cc b/Calibration/IsolatedParticles/plugins/IsolatedTracksNxN.cc index e03fe1b259b18..c01e39ee88fc6 100644 --- a/Calibration/IsolatedParticles/plugins/IsolatedTracksNxN.cc +++ b/Calibration/IsolatedParticles/plugins/IsolatedTracksNxN.cc @@ -32,7 +32,11 @@ #include "CondFormats/DataRecord/interface/L1GtTriggerMaskAlgoTrigRcd.h" #include "CondFormats/DataRecord/interface/L1GtTriggerMaskTechTrigRcd.h" -IsolatedTracksNxN::IsolatedTracksNxN(const edm::ParameterSet& iConfig) { +static const bool useL1EventSetup(true); +static const bool useL1GtTriggerMenuLite(true); + +IsolatedTracksNxN::IsolatedTracksNxN(const edm::ParameterSet& iConfig) : + m_l1GtUtils(iConfig, consumesCollector(), useL1GtTriggerMenuLite, *this) { //now do what ever initialization is needed doMC = iConfig.getUntrackedParameter<bool> ("DoMC", false); @@ -137,9 +141,6 @@ void IsolatedTracksNxN::analyze(const edm::Event& iEvent, const edm::EventSetup& //===================== save L1 Trigger information ======================= if( L1TriggerAlgoInfo_ ) { - bool useL1EventSetup = true; - bool useL1GtTriggerMenuLite = true; - m_l1GtUtils.getL1GtRunCache(iEvent, iSetup, useL1EventSetup, useL1GtTriggerMenuLite); int iErrorCode = -1; diff --git a/CommonTools/TriggerUtils/interface/CandidateTriggerObjectProducer.h b/CommonTools/TriggerUtils/interface/CandidateTriggerObjectProducer.h index a2b4a828080e9..af73f31932cf4 100644 --- a/CommonTools/TriggerUtils/interface/CandidateTriggerObjectProducer.h +++ b/CommonTools/TriggerUtils/interface/CandidateTriggerObjectProducer.h @@ -13,7 +13,7 @@ #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EDProducer.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "HLTrigger/HLTcore/interface/HLTConfigProvider.h" +#include "HLTrigger/HLTcore/interface/HLTPrescaleProvider.h" #include "DataFormats/Common/interface/TriggerResults.h" #include "DataFormats/HLTReco/interface/TriggerEvent.h" @@ -42,7 +42,6 @@ class CandidateTriggerObjectProducer : public edm::EDProducer { /// additional class data memebers edm::Handle<edm::TriggerResults> triggerResultsHandle_; edm::Handle<trigger::TriggerEvent> triggerEventHandle_; - HLTConfigProvider hltConfig_; - + HLTPrescaleProvider hltPrescaleProvider_; }; #endif diff --git a/CommonTools/TriggerUtils/interface/GenericTriggerEventFlag.h b/CommonTools/TriggerUtils/interface/GenericTriggerEventFlag.h index 17b078da07e02..ecdd6e0c8ba74 100644 --- a/CommonTools/TriggerUtils/interface/GenericTriggerEventFlag.h +++ b/CommonTools/TriggerUtils/interface/GenericTriggerEventFlag.h @@ -33,6 +33,7 @@ #include "L1Trigger/GlobalTriggerAnalyzer/interface/L1GtUtils.h" #include "HLTrigger/HLTcore/interface/HLTConfigProvider.h" +#include <memory> #include <string> @@ -40,7 +41,7 @@ class GenericTriggerEventFlag { // Utility classes edm::ESWatcher< AlCaRecoTriggerBitsRcd > * watchDB_; - L1GtUtils l1Gt_; + std::unique_ptr<L1GtUtils> l1Gt_; HLTConfigProvider hltConfig_; bool hltConfigInit_; // Configuration parameters @@ -85,9 +86,13 @@ class GenericTriggerEventFlag { public: - // Constructors and destructor - GenericTriggerEventFlag( const edm::ParameterSet & config, edm::ConsumesCollector && iC ) : GenericTriggerEventFlag( config, iC ) {}; // To be called from the ED module's c'tor - GenericTriggerEventFlag( const edm::ParameterSet & config, edm::ConsumesCollector & iC ); // To be called from the ED module's c'tor + // Constructors must be called from the ED module's c'tor + template <typename T> + GenericTriggerEventFlag( const edm::ParameterSet & config, edm::ConsumesCollector && iC, T& module ); + + template <typename T> + GenericTriggerEventFlag( const edm::ParameterSet & config, edm::ConsumesCollector & iC, T& module ); + ~GenericTriggerEventFlag(); // Public methods @@ -100,6 +105,8 @@ class GenericTriggerEventFlag { // Private methods + GenericTriggerEventFlag( const edm::ParameterSet & config, edm::ConsumesCollector & iC ); + // DCS bool acceptDcs( const edm::Event & event ); bool acceptDcsPartition( const edm::Handle< DcsStatusCollection > & dcsStatus, int dcsPartition ) const; @@ -132,5 +139,15 @@ class GenericTriggerEventFlag { }; +template <typename T> +GenericTriggerEventFlag::GenericTriggerEventFlag( const edm::ParameterSet & config, edm::ConsumesCollector && iC, T& module ) : + GenericTriggerEventFlag(config, iC, module) { +} + +template <typename T> +GenericTriggerEventFlag::GenericTriggerEventFlag( const edm::ParameterSet & config, edm::ConsumesCollector & iC, T& module ) : + GenericTriggerEventFlag(config, iC) { + l1Gt_.reset(new L1GtUtils(config, iC, false, module)); +} #endif diff --git a/CommonTools/TriggerUtils/interface/PrescaleWeightProvider.h b/CommonTools/TriggerUtils/interface/PrescaleWeightProvider.h index f49cf34d54cf4..dc83a428913c6 100644 --- a/CommonTools/TriggerUtils/interface/PrescaleWeightProvider.h +++ b/CommonTools/TriggerUtils/interface/PrescaleWeightProvider.h @@ -20,23 +20,38 @@ */ -#include <vector> +#include <memory> #include <string> +#include <vector> + +#include "DataFormats/Common/interface/Handle.h" #include "FWCore/Framework/interface/Run.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/Framework/interface/ConsumesCollector.h" +#include "FWCore/Utilities/interface/EDGetToken.h" +#include "FWCore/Utilities/interface/InputTag.h" + +#include "HLTrigger/HLTcore/interface/HLTPrescaleProvider.h" -#include "HLTrigger/HLTcore/interface/HLTConfigProvider.h" -#include "DataFormats/L1GlobalTrigger/interface/L1GtTriggerMenuLite.h" +class L1GtTriggerMenuLite; + +namespace edm { + class ConsumesCollector; + class Event; + class EventSetup; + class ParameterSet; + class Run; + class TriggerResults; +} class PrescaleWeightProvider { bool configured_; bool init_; - HLTConfigProvider hltConfig_; + std::unique_ptr<HLTPrescaleProvider> hltPrescaleProvider_; edm::Handle< L1GtTriggerMenuLite > triggerMenuLite_; std::vector< std::string > l1SeedPaths_; @@ -51,8 +66,13 @@ class PrescaleWeightProvider { public: - PrescaleWeightProvider( const edm::ParameterSet & config, edm::ConsumesCollector && iC ) : PrescaleWeightProvider( config, iC ) {}; // to be called from the ED module's c'tor - PrescaleWeightProvider( const edm::ParameterSet & config, edm::ConsumesCollector & iC ); // to be called from the ED module's c'tor + // The constructor must be called from the ED module's c'tor + template <typename T> + PrescaleWeightProvider( const edm::ParameterSet & config, edm::ConsumesCollector && iC, T& module ); + + template <typename T> + PrescaleWeightProvider( const edm::ParameterSet & config, edm::ConsumesCollector & iC, T& module ); + ~PrescaleWeightProvider() {} void initRun( const edm::Run & run, const edm::EventSetup & setup ); // to be called from the ED module's beginRun() method @@ -60,9 +80,20 @@ class PrescaleWeightProvider { private: + PrescaleWeightProvider( const edm::ParameterSet & config, edm::ConsumesCollector & iC ); + void parseL1Seeds( const std::string & l1Seeds ); }; +template <typename T> +PrescaleWeightProvider::PrescaleWeightProvider( const edm::ParameterSet & config, edm::ConsumesCollector && iC, T& module ) : + PrescaleWeightProvider( config, iC, module ) { +} +template <typename T> +PrescaleWeightProvider::PrescaleWeightProvider( const edm::ParameterSet & config, edm::ConsumesCollector & iC, T& module ) : + PrescaleWeightProvider( config, iC ) { + hltPrescaleProvider_.reset(new HLTPrescaleProvider(config, iC, module)); +} #endif diff --git a/CommonTools/TriggerUtils/plugins/CandidateTriggerObjectProducer.cc b/CommonTools/TriggerUtils/plugins/CandidateTriggerObjectProducer.cc index b617f02260f78..85ed0745d25d0 100644 --- a/CommonTools/TriggerUtils/plugins/CandidateTriggerObjectProducer.cc +++ b/CommonTools/TriggerUtils/plugins/CandidateTriggerObjectProducer.cc @@ -4,6 +4,7 @@ #include "DataFormats/Candidate/interface/CandidateFwd.h" #include "DataFormats/Candidate/interface/Candidate.h" #include "DataFormats/Candidate/interface/LeafCandidate.h" +#include "HLTrigger/HLTcore/interface/HLTConfigProvider.h" #include "TString.h" #include "TRegexp.h" @@ -20,7 +21,8 @@ CandidateTriggerObjectProducer::CandidateTriggerObjectProducer(const edm::Parame triggerResultsToken_(consumes<edm::TriggerResults>(ps.getParameter<edm::InputTag>("triggerResults"))), triggerEventTag_(ps.getParameter<edm::InputTag>("triggerEvent")), triggerEventToken_(consumes<trigger::TriggerEvent>(triggerEventTag_)), - triggerName_(ps.getParameter<std::string>("triggerName")) + triggerName_(ps.getParameter<std::string>("triggerName")), + hltPrescaleProvider_(ps, consumesCollector(), *this) { // cout << "Trigger Object Producer:" << endl @@ -44,7 +46,7 @@ CandidateTriggerObjectProducer::beginRun(const edm::Run& iRun, edm::EventSetup c using namespace edm; bool changed(false); - if(!hltConfig_.init(iRun,iSetup,triggerEventTag_.process(),changed) ){ + if(!hltPrescaleProvider_.init(iRun,iSetup,triggerEventTag_.process(),changed) ){ edm::LogError( "CandidateTriggerObjectProducer" ) << "Error! Can't initialize HLTConfigProvider"; throw cms::Exception("HLTConfigProvider::init() returned non 0"); @@ -75,13 +77,16 @@ CandidateTriggerObjectProducer::produce(edm::Event & iEvent, const edm::EventSet edm::LogError( "CandidateTriggerObjectProducer" ) << "CandidateTriggerObjectProducer::analyze: Error in getting TriggerEvent product from Event!" ; return; } + + HLTConfigProvider const& hltConfig = hltPrescaleProvider_.hltConfigProvider(); + // sanity check - // std::cout << hltConfig_.size() << std::endl; + // std::cout << hltConfig.size() << std::endl; // std::cout << triggerResultsHandle_->size() << std::endl; - assert(triggerResultsHandle_->size()==hltConfig_.size()); + assert(triggerResultsHandle_->size()==hltConfig.size()); - const unsigned int n(hltConfig_.size()); - std::vector<std::string> activeHLTPathsInThisEvent = hltConfig_.triggerNames(); + const unsigned int n(hltConfig.size()); + std::vector<std::string> activeHLTPathsInThisEvent = hltConfig.triggerNames(); std::map<std::string, bool> triggerInMenu; std::map<std::string, bool> triggerUnprescaled; @@ -92,7 +97,7 @@ CandidateTriggerObjectProducer::produce(edm::Event & iEvent, const edm::EventSet if (TString(*iHLT).Contains(TRegexp(TString(triggerName_)))) { triggerInMenu[*iHLT] = true; - const std::pair<int,int> prescales(hltConfig_.prescaleValues(iEvent,iSetup,*iHLT)); + const std::pair<int,int> prescales(hltPrescaleProvider_.prescaleValues(iEvent,iSetup,*iHLT)); if (prescales.first * prescales.second == 1) triggerUnprescaled[*iHLT] = true; } @@ -104,7 +109,7 @@ CandidateTriggerObjectProducer::produce(edm::Event & iEvent, const edm::EventSet //using only unprescaled triggers if (!(iMyHLT->second && triggerUnprescaled[iMyHLT->first])) continue; - const unsigned int triggerIndex(hltConfig_.triggerIndex(iMyHLT->first)); + const unsigned int triggerIndex(hltConfig.triggerIndex(iMyHLT->first)); assert(triggerIndex==iEvent.triggerNames(*triggerResultsHandle_).triggerIndex(iMyHLT->first)); @@ -116,8 +121,8 @@ CandidateTriggerObjectProducer::produce(edm::Event & iEvent, const edm::EventSet } // modules on this trigger path - // const unsigned int m(hltConfig_.size(triggerIndex)); - const std::vector<std::string>& moduleLabels(hltConfig_.saveTagsModules(triggerIndex)); + // const unsigned int m(hltConfig.size(triggerIndex)); + const std::vector<std::string>& moduleLabels(hltConfig.saveTagsModules(triggerIndex)); // Results from TriggerResults product if (!(triggerResultsHandle_->wasrun(triggerIndex)) || @@ -135,7 +140,7 @@ CandidateTriggerObjectProducer::produce(edm::Event & iEvent, const edm::EventSet for (unsigned int imodule=0;imodule<moduleLabels.size();++imodule) { const std::string& moduleLabel(moduleLabels[imodule]); - const std::string moduleType(hltConfig_.moduleType(moduleLabel)); + const std::string moduleType(hltConfig.moduleType(moduleLabel)); //Avoiding L1 seeds if (moduleType.find("Level1GTSeed") != std::string::npos) continue; diff --git a/CommonTools/TriggerUtils/src/GenericTriggerEventFlag.cc b/CommonTools/TriggerUtils/src/GenericTriggerEventFlag.cc index 9132d7e03038e..23deb3006e9f6 100644 --- a/CommonTools/TriggerUtils/src/GenericTriggerEventFlag.cc +++ b/CommonTools/TriggerUtils/src/GenericTriggerEventFlag.cc @@ -166,7 +166,7 @@ void GenericTriggerEventFlag::initRun( const edm::Run & run, const edm::EventSet // L1 if ( onL1_ ) { // build vector of algo names - l1Gt_.getL1GtRunCache( run, setup, true, false ); + l1Gt_->getL1GtRunCache( run, setup, useL1EventSetup, useL1GtTriggerMenuLite ); edm::ESHandle< L1GtTriggerMenu > handleL1GtTriggerMenu; setup.get< L1GtTriggerMenuRcd >().get( handleL1GtTriggerMenu ); // L1GtTriggerMenu l1GtTriggerMenu( *handleL1GtTriggerMenu ); @@ -403,7 +403,7 @@ bool GenericTriggerEventFlag::acceptL1( const edm::Event & event, const edm::Eve if ( ! onL1_ || l1LogicalExpressions_.empty() ) return ( ! andOr_ ); // logically neutral, depending on base logical connective // Getting the L1 event setup - l1Gt_.getL1GtRunCache( event, setup, useL1EventSetup, useL1GtTriggerMenuLite ); // FIXME This can possibly go to initRun() + l1Gt_->getL1GtRunCache( event, setup, useL1EventSetup, useL1GtTriggerMenuLite ); // FIXME This can possibly go to initRun() // Determine decision of L1 logical expression combination and return if ( andOrL1_ ) { // OR combination @@ -443,7 +443,7 @@ bool GenericTriggerEventFlag::acceptL1LogicalExpression( const edm::Event & even for ( size_t iAlgorithm = 0; iAlgorithm < l1AlgoLogicParser.operandTokenVector().size(); ++iAlgorithm ) { const std::string l1AlgoName( l1AlgoLogicParser.operandTokenVector().at( iAlgorithm ).tokenName ); int error( -1 ); - const bool decision( l1BeforeMask_ ? l1Gt_.decisionBeforeMask( event, l1AlgoName, error ) : l1Gt_.decisionAfterMask( event, l1AlgoName, error ) ); + const bool decision( l1BeforeMask_ ? l1Gt_->decisionBeforeMask( event, l1AlgoName, error ) : l1Gt_->decisionAfterMask( event, l1AlgoName, error ) ); // Error checks if ( error != 0 ) { if ( verbose_ > 1 ) { diff --git a/CommonTools/TriggerUtils/src/PrescaleWeightProvider.cc b/CommonTools/TriggerUtils/src/PrescaleWeightProvider.cc index ce3c517d137e6..681c48a08289f 100644 --- a/CommonTools/TriggerUtils/src/PrescaleWeightProvider.cc +++ b/CommonTools/TriggerUtils/src/PrescaleWeightProvider.cc @@ -8,10 +8,13 @@ #include <sstream> #include "L1Trigger/GlobalTriggerAnalyzer/interface/L1GtUtils.h" +#include "HLTrigger/HLTcore/interface/HLTConfigProvider.h" #include "DataFormats/Common/interface/TriggerResults.h" +#include "DataFormats/L1GlobalTrigger/interface/L1GtTriggerMenuLite.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" - +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/Utilities/interface/BranchType.h" PrescaleWeightProvider::PrescaleWeightProvider( const edm::ParameterSet & config, edm::ConsumesCollector & iC ) // default values @@ -60,11 +63,12 @@ void PrescaleWeightProvider::initRun( const edm::Run & run, const edm::EventSetu return; } + HLTConfigProvider const& hltConfig = hltPrescaleProvider_->hltConfigProvider(); bool hltChanged( false ); - if ( ! hltConfig_.init( run, setup, triggerResultsTag_.process(), hltChanged ) ) { + if ( ! hltPrescaleProvider_->init( run, setup, triggerResultsTag_.process(), hltChanged ) ) { if ( verbosity_ > 0 ) edm::LogError( "PrescaleWeightProvider" ) << "HLT config initialization error with process name \"" << triggerResultsTag_.process() << "\""; init_ = false; - } else if ( hltConfig_.size() <= 0 ) { + } else if ( hltConfig.size() <= 0 ) { if ( verbosity_ > 0 ) edm::LogError( "PrescaleWeightProvider" ) << "HLT config size error"; init_ = false; } else if ( hltChanged ) { @@ -86,10 +90,11 @@ int PrescaleWeightProvider::prescaleWeight( const edm::Event & event, const edm: if ( ! init_ ) return 1; // L1 - L1GtUtils l1GtUtils; - l1GtUtils.retrieveL1EventSetup( setup ); + L1GtUtils const& l1GtUtils = hltPrescaleProvider_->l1GtUtils(); // HLT + HLTConfigProvider const& hltConfig = hltPrescaleProvider_->hltConfigProvider(); + edm::Handle< edm::TriggerResults > triggerResults; event.getByToken( triggerResultsToken_, triggerResults); if( ! triggerResults.isValid() ) { @@ -102,14 +107,14 @@ int PrescaleWeightProvider::prescaleWeight( const edm::Event & event, const edm: for ( unsigned ui = 0; ui < hltPaths_.size(); ui++ ) { const std::string hltPath( hltPaths_.at( ui ) ); - unsigned hltIndex( hltConfig_.triggerIndex( hltPath ) ); - if ( hltIndex == hltConfig_.size() ) { + unsigned hltIndex( hltConfig.triggerIndex( hltPath ) ); + if ( hltIndex == hltConfig.size() ) { if ( verbosity_ > 0 ) edm::LogError( "PrescaleWeightProvider::prescaleWeight" ) << "HLT path \"" << hltPath << "\" does not exist"; continue; } if ( ! triggerResults->accept( hltIndex ) ) continue; - const std::vector< std::pair < bool, std::string > > level1Seeds = hltConfig_.hltL1GTSeeds( hltPath ); + const std::vector< std::pair < bool, std::string > > level1Seeds = hltConfig.hltL1GTSeeds( hltPath ); if ( level1Seeds.size() != 1 ) { if ( verbosity_ > 0 ) edm::LogError( "PrescaleWeightProvider::prescaleWeight" ) << "HLT path \"" << hltPath << "\" provides too many L1 seeds"; return 1; @@ -148,7 +153,7 @@ int PrescaleWeightProvider::prescaleWeight( const edm::Event & event, const edm: continue; } - int hltPrescale( hltConfig_.prescaleValue( event, setup, hltPath ) ); + int hltPrescale( hltPrescaleProvider_->prescaleValue( event, setup, hltPath ) ); if ( hltPrescale * l1Prescale > 0 ) { if ( weight == SENTINEL || weight > hltPrescale * l1Prescale ) { diff --git a/CommonTools/TriggerUtils/test/GenericTriggerEventFlagTest.cc b/CommonTools/TriggerUtils/test/GenericTriggerEventFlagTest.cc index 3669a6722513d..5aedabe1b10ab 100644 --- a/CommonTools/TriggerUtils/test/GenericTriggerEventFlagTest.cc +++ b/CommonTools/TriggerUtils/test/GenericTriggerEventFlagTest.cc @@ -39,7 +39,7 @@ class GenericTriggerEventFlagTest : public edm::EDFilter { GenericTriggerEventFlagTest::GenericTriggerEventFlagTest( const edm::ParameterSet & iConfig ) -: genericTriggerEventFlag_( new GenericTriggerEventFlag( iConfig, consumesCollector() ) ) + : genericTriggerEventFlag_( new GenericTriggerEventFlag( iConfig, consumesCollector(), *this ) ) { } diff --git a/DQM/L1TMonitor/interface/L1TMenuHelper.h b/DQM/L1TMonitor/interface/L1TMenuHelper.h index 6b24a02b2af4b..1f21e551c41db 100644 --- a/DQM/L1TMonitor/interface/L1TMenuHelper.h +++ b/DQM/L1TMonitor/interface/L1TMenuHelper.h @@ -80,7 +80,9 @@ class L1TMenuHelper { ~L1TMenuHelper(); // Destructor // Get Lowest Unprescaled Single Object Triggers - std::map<std::string,std::string> getLUSOTrigger(const std::map<std::string,bool>& iCategories, int IndexRefPrescaleFactors); + std::map<std::string,std::string> getLUSOTrigger(const std::map<std::string,bool>& iCategories, + int IndexRefPrescaleFactors, + L1GtUtils const& myUtils); std::map<std::string,std::string> testAlgos (const std::map<std::string,std::string>&); @@ -99,8 +101,6 @@ class L1TMenuHelper { edm::ESHandle<L1GtTriggerMenu> menuRcd; edm::ESHandle<L1GtPrescaleFactors> l1GtPfAlgo; - L1GtUtils myUtils; - const L1GtTriggerMenu* m_l1GtMenu; const std::vector<std::vector<int> >* m_prescaleFactorsAlgoTrig; diff --git a/DQM/L1TMonitor/interface/L1TRate.h b/DQM/L1TMonitor/interface/L1TRate.h index 767a93792e823..3130cf5c0b113 100644 --- a/DQM/L1TMonitor/interface/L1TRate.h +++ b/DQM/L1TMonitor/interface/L1TRate.h @@ -34,6 +34,8 @@ #include "DQMServices/Core/interface/DQMEDAnalyzer.h" +#include "L1Trigger/GlobalTriggerAnalyzer/interface/L1GtUtils.h" + #include <TString.h> #include <iostream> @@ -111,6 +113,7 @@ class L1TRate : public DQMEDAnalyzer { // Others //DQMStore* dbe; // The DQM Service Handle + L1GtUtils m_l1GtUtils; }; #endif diff --git a/DQM/L1TMonitor/interface/L1TSync.h b/DQM/L1TMonitor/interface/L1TSync.h index f1ba6f719e548..43676464f4efe 100644 --- a/DQM/L1TMonitor/interface/L1TSync.h +++ b/DQM/L1TMonitor/interface/L1TSync.h @@ -35,6 +35,8 @@ #include "DQMServices/Core/interface/DQMEDAnalyzer.h" +#include "L1Trigger/GlobalTriggerAnalyzer/interface/L1GtUtils.h" + #include <TString.h> #include <iostream> @@ -143,6 +145,7 @@ class L1TSync : public DQMEDAnalyzer { edm::EDGetTokenT<L1GlobalTriggerEvmReadoutRecord> m_l1GtEvmSource; edm::EDGetTokenT<L1GlobalTriggerReadoutRecord> m_l1GtDataDaqInputTag; + L1GtUtils m_l1GtUtils; }; #endif diff --git a/DQM/L1TMonitor/src/L1TMenuHelper.cc b/DQM/L1TMonitor/src/L1TMenuHelper.cc index 4d0b4da36b2e7..c82e0afdb1c9d 100644 --- a/DQM/L1TMonitor/src/L1TMenuHelper.cc +++ b/DQM/L1TMonitor/src/L1TMenuHelper.cc @@ -47,9 +47,6 @@ L1TMenuHelper::L1TMenuHelper(const edm::EventSetup& iSetup){ m_l1GtMenu = menuRcd .product(); // Getting the menu m_prescaleFactorsAlgoTrig = &(m_l1GtPfAlgo->gtPrescaleFactors()); // Retriving the list of prescale sets - - myUtils.retrieveL1EventSetup(iSetup); - } @@ -62,7 +59,9 @@ L1TMenuHelper::~L1TMenuHelper(){} // Method: fetLUSOTrigger // * Get Lowest Unprescaled Single Object Triggers and Energy Sums //------------------------------------------------------------------------------------- -map<string,string> L1TMenuHelper::getLUSOTrigger(const map<string,bool>& iCategories, int IndexRefPrescaleFactors){ +map<string,string> L1TMenuHelper::getLUSOTrigger(const map<string,bool>& iCategories, + int IndexRefPrescaleFactors, + L1GtUtils const& myUtils){ map<string,string> out; // Getting information from the menu diff --git a/DQM/L1TMonitor/src/L1TRate.cc b/DQM/L1TMonitor/src/L1TRate.cc index 5e4efff85d842..93a378b52fdbe 100644 --- a/DQM/L1TMonitor/src/L1TRate.cc +++ b/DQM/L1TMonitor/src/L1TRate.cc @@ -32,7 +32,8 @@ using namespace edm; using namespace std; //_____________________________________________________________________ -L1TRate::L1TRate(const ParameterSet & ps){ +L1TRate::L1TRate(const ParameterSet & ps) : + m_l1GtUtils(ps, consumesCollector(), false, *this) { m_maxNbins = 2500; // Maximum LS for each run (for binning purposes) m_parameters = ps; @@ -104,7 +105,8 @@ void L1TRate::bookHistograms(DQMStore::IBooker &ibooker, const edm::Run&, const // Getting Lowest Prescale Single Object Triggers from the menu L1TMenuHelper myMenuHelper = L1TMenuHelper(iSetup); - m_selectedTriggers = myMenuHelper.getLUSOTrigger(m_inputCategories,m_refPrescaleSet); + m_l1GtUtils.retrieveL1EventSetup(iSetup); + m_selectedTriggers = myMenuHelper.getLUSOTrigger(m_inputCategories, m_refPrescaleSet, m_l1GtUtils); //-> Getting template fits for the algLo cross sections int srcAlgoXSecFit = m_parameters.getParameter<int>("srcAlgoXSecFit"); diff --git a/DQM/L1TMonitor/src/L1TSync.cc b/DQM/L1TMonitor/src/L1TSync.cc index bbc99e7635dbd..2970f691d1072 100644 --- a/DQM/L1TMonitor/src/L1TSync.cc +++ b/DQM/L1TMonitor/src/L1TSync.cc @@ -37,7 +37,8 @@ using namespace std; //------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------- -L1TSync::L1TSync(const ParameterSet & pset){ +L1TSync::L1TSync(const ParameterSet & pset) : + m_l1GtUtils(pset, consumesCollector(), false, *this){ m_parameters = pset; @@ -238,7 +239,8 @@ void L1TSync::bookHistograms(DQMStore::IBooker &ibooker, const edm::Run&, const m_selectedTriggers = myMenuHelper.testAlgos(m_selectedTriggers); - map<string,string> tAutoSelTrig = myMenuHelper.getLUSOTrigger(m_algoAutoSelect,m_refPrescaleSet); + m_l1GtUtils.retrieveL1EventSetup(iSetup); + map<string,string> tAutoSelTrig = myMenuHelper.getLUSOTrigger(m_algoAutoSelect, m_refPrescaleSet, m_l1GtUtils); m_selectedTriggers.insert(tAutoSelTrig.begin(),tAutoSelTrig.end()); // Initializing DQM Monitor Elements diff --git a/DQM/Physics/src/EwkElecDQM.cc b/DQM/Physics/src/EwkElecDQM.cc index 5ccc66ac84f90..afcc46d55d8c3 100644 --- a/DQM/Physics/src/EwkElecDQM.cc +++ b/DQM/Physics/src/EwkElecDQM.cc @@ -32,6 +32,8 @@ #include "DataFormats/Common/interface/View.h" +#include "HLTrigger/HLTcore/interface/HLTConfigProvider.h" + using namespace edm; using namespace std; using namespace reco; @@ -119,8 +121,8 @@ EwkElecDQM::EwkElecDQM(const ParameterSet& cfg) eJetMin_(cfg.getUntrackedParameter<double>("EJetMin", 999999.)), nJetMax_(cfg.getUntrackedParameter<int>("NJetMax", 999999)), PUMax_(cfg.getUntrackedParameter<unsigned int>("PUMax", 60)), - PUBinCount_(cfg.getUntrackedParameter<unsigned int>("PUBinCount", 12)) - + PUBinCount_(cfg.getUntrackedParameter<unsigned int>("PUBinCount", 12)), + hltPrescaleProvider_(cfg, consumesCollector(), *this) // caloJetCollection_(cfg.getUntrackedParameter<edm:InputTag>("CaloJetCollection","sisCone5CaloJets")) { isValidHltConfig_ = false; @@ -141,7 +143,7 @@ void EwkElecDQM::dqmBeginRun(const Run& iRun, const EventSetup& iSet) { // isValidHltConfig_ could be used to short-circuit analyze() in case of // problems isValidHltConfig_ = - hltConfigProvider_.init(iRun, iSet, "HLT", isConfigChanged); + hltPrescaleProvider_.init(iRun, iSet, "HLT", isConfigChanged); LogTrace("") << "isValidHltConfig_=" << isValidHltConfig_ << "\n"; } @@ -450,6 +452,8 @@ void EwkElecDQM::analyze(const Event& ev, const EventSetup& iSet) { const edm::TriggerNames& trigNames = ev.triggerNames(*triggerResults); bool trigger_fired = false; + HLTConfigProvider const& hltConfigProvider = hltPrescaleProvider_.hltConfigProvider(); + /* very old code for (unsigned int i=0; i<triggerResults->size(); i++) { if (triggerResults->accept(i)) { @@ -490,10 +494,10 @@ if not if(!found) continue; bool prescaled=false; - for (unsigned int ps= 0; ps< hltConfigProvider_.prescaleSize(); + for (unsigned int ps= 0; ps< hltConfigProvider.prescaleSize(); ps++){ const unsigned int prescaleValue = -hltConfigProvider_.prescaleValue(ps, trigName) ; +hltConfigProvider.prescaleValue(ps, trigName) ; if (prescaleValue != 1) prescaled =true; } @@ -503,7 +507,7 @@ hltConfigProvider_.prescaleValue(ps, trigName) ; */ // get the prescale set for this event - const int prescaleSet = hltConfigProvider_.prescaleSet(ev, iSet); + const int prescaleSet = hltPrescaleProvider_.prescaleSet(ev, iSet); if (prescaleSet == -1) { LogTrace("") << "Failed to determine prescaleSet\n"; // std::cout << "Failed to determine prescaleSet. Check cmsRun GlobalTag\n"; @@ -525,7 +529,7 @@ hltConfigProvider_.prescaleValue(ps, trigName) ; if (!found) continue; // skip trigger, if it is prescaled - if (hltConfigProvider_.prescaleValue(prescaleSet, trigName) != 1) continue; + if (hltConfigProvider.prescaleValue(prescaleSet, trigName) != 1) continue; // std::cout << "found unprescaled trigger that fired: " << trigName << // "\n"; diff --git a/DQM/Physics/src/EwkElecDQM.h b/DQM/Physics/src/EwkElecDQM.h index fbdab0ab1e574..f2d772f793a60 100644 --- a/DQM/Physics/src/EwkElecDQM.h +++ b/DQM/Physics/src/EwkElecDQM.h @@ -9,7 +9,7 @@ #include "FWCore/Framework/interface/Frameworkfwd.h" #include "FWCore/Framework/interface/MakerMacros.h" -#include "HLTrigger/HLTcore/interface/HLTConfigProvider.h" +#include "HLTrigger/HLTcore/interface/HLTPrescaleProvider.h" #include "FWCore/Utilities/interface/InputTag.h" @@ -91,7 +91,7 @@ class EwkElecDQM : public DQMEDAnalyzer { unsigned int PUMax_, PUBinCount_; bool isValidHltConfig_; - HLTConfigProvider hltConfigProvider_; + HLTPrescaleProvider hltPrescaleProvider_; unsigned int nall; unsigned int nrec; diff --git a/DQM/Physics/src/EwkMuDQM.cc b/DQM/Physics/src/EwkMuDQM.cc index f0ca4cc9177a4..6fddeac287085 100644 --- a/DQM/Physics/src/EwkMuDQM.cc +++ b/DQM/Physics/src/EwkMuDQM.cc @@ -107,7 +107,8 @@ EwkMuDQM::EwkMuDQM(const ParameterSet& cfg) // Photon cuts ptThrForPhoton_(cfg.getUntrackedParameter<double>("ptThrForPhoton", 5.)), - nPhoMax_(cfg.getUntrackedParameter<int>("nPhoMax", 999999)) { + nPhoMax_(cfg.getUntrackedParameter<int>("nPhoMax", 999999)), + hltPrescaleProvider_(cfg, consumesCollector(), *this) { isValidHltConfig_ = false; } @@ -126,7 +127,7 @@ void EwkMuDQM::dqmBeginRun(const Run& iRun, const EventSetup& iSet) { bool isConfigChanged = false; // isValidHltConfig_ used to short-circuit analyze() in case of problems isValidHltConfig_ = - hltConfigProvider_.init(iRun, iSet, "HLT", isConfigChanged); + hltPrescaleProvider_.init(iRun, iSet, "HLT", isConfigChanged); } void EwkMuDQM::bookHistograms(DQMStore::IBooker & ibooker, @@ -404,6 +405,8 @@ void EwkMuDQM::analyze(const Event& ev, const EventSetup& iSet) { const edm::TriggerNames& trigNames = ev.triggerNames(*triggerResults); // LogWarning("")<<"Loop over triggers"; + HLTConfigProvider const& hltConfigProvider = hltPrescaleProvider_.hltConfigProvider(); + /* change faulty logic of triggering for (unsigned int i=0; i<triggerResults->size(); i++) { @@ -419,10 +422,10 @@ void EwkMuDQM::analyze(const Event& ev, const EventSetup& iSet) { if(!found) {continue;} bool prescaled=false; - for (unsigned int ps= 0; ps< hltConfigProvider_.prescaleSize(); + for (unsigned int ps= 0; ps< hltConfigProvider.prescaleSize(); ps++){ const unsigned int prescaleValue = - hltConfigProvider_.prescaleValue(ps, trigName) ; + hltConfigProvider.prescaleValue(ps, trigName) ; if (prescaleValue != 1) prescaled =true; } @@ -433,7 +436,7 @@ void EwkMuDQM::analyze(const Event& ev, const EventSetup& iSet) { */ // get the prescale set for this event - const int prescaleSet = hltConfigProvider_.prescaleSet(ev, iSet); + const int prescaleSet = hltPrescaleProvider_.prescaleSet(ev, iSet); if (prescaleSet == -1) { LogTrace("") << "Failed to determine prescaleSet\n"; // std::cout << "Failed to determine prescaleSet. Check the GlobalTag in @@ -457,15 +460,15 @@ void EwkMuDQM::analyze(const Event& ev, const EventSetup& iSet) { // skip trigger, if it is prescaled if (prescaleSet != -1) { - if (hltConfigProvider_.prescaleValue(prescaleSet, trigName) != 1) + if (hltConfigProvider.prescaleValue(prescaleSet, trigName) != 1) continue; } else { // prescaleSet is not known. // This branch is not needed, if prescaleSet=-1 forces to skip event int prescaled = 0; for (unsigned int ps = 0; - !prescaled && (ps < hltConfigProvider_.prescaleSize()); ++ps) { - if (hltConfigProvider_.prescaleValue(ps, trigName) != 1) { + !prescaled && (ps < hltConfigProvider.prescaleSize()); ++ps) { + if (hltConfigProvider.prescaleValue(ps, trigName) != 1) { prescaled = 1; } } diff --git a/DQM/Physics/src/EwkMuDQM.h b/DQM/Physics/src/EwkMuDQM.h index 6d61c5461148c..55fe1b6af9b75 100644 --- a/DQM/Physics/src/EwkMuDQM.h +++ b/DQM/Physics/src/EwkMuDQM.h @@ -9,7 +9,7 @@ #include "FWCore/Framework/interface/Frameworkfwd.h" #include "FWCore/Framework/interface/MakerMacros.h" -#include "HLTrigger/HLTcore/interface/HLTConfigProvider.h" +#include "HLTrigger/HLTcore/interface/HLTPrescaleProvider.h" // #include "FWCore/Framework/interface/EDAnalyzer.h" #include "FWCore/Utilities/interface/InputTag.h" @@ -85,7 +85,7 @@ class EwkMuDQM : public DQMEDAnalyzer { int nPhoMax_; bool isValidHltConfig_; - HLTConfigProvider hltConfigProvider_; + HLTPrescaleProvider hltPrescaleProvider_; unsigned int nall; unsigned int nrec; diff --git a/DQM/SiStripMonitorCluster/src/SiStripMonitorCluster.cc b/DQM/SiStripMonitorCluster/src/SiStripMonitorCluster.cc index 2f0123661dc85..5f1e3e41b1eac 100644 --- a/DQM/SiStripMonitorCluster/src/SiStripMonitorCluster.cc +++ b/DQM/SiStripMonitorCluster/src/SiStripMonitorCluster.cc @@ -50,9 +50,9 @@ SiStripMonitorCluster::SiStripMonitorCluster(const edm::ParameterSet& iConfig) // initialize GenericTriggerEventFlag by specific configuration // in this way, one can set specific selections for different MEs - genTriggerEventFlagBPTXfilter_ = new GenericTriggerEventFlag(iConfig.getParameter<edm::ParameterSet>("BPTXfilter") , consumesCollector() ); - genTriggerEventFlagPixelDCSfilter_ = new GenericTriggerEventFlag(iConfig.getParameter<edm::ParameterSet>("PixelDCSfilter"), consumesCollector() ); - genTriggerEventFlagStripDCSfilter_ = new GenericTriggerEventFlag(iConfig.getParameter<edm::ParameterSet>("StripDCSfilter"), consumesCollector() ); + genTriggerEventFlagBPTXfilter_ = new GenericTriggerEventFlag(iConfig.getParameter<edm::ParameterSet>("BPTXfilter") , consumesCollector(), *this ); + genTriggerEventFlagPixelDCSfilter_ = new GenericTriggerEventFlag(iConfig.getParameter<edm::ParameterSet>("PixelDCSfilter"), consumesCollector(), *this ); + genTriggerEventFlagStripDCSfilter_ = new GenericTriggerEventFlag(iConfig.getParameter<edm::ParameterSet>("StripDCSfilter"), consumesCollector(), *this ); firstEvent = -1; eventNb = 0; diff --git a/DQM/SiStripMonitorTrack/src/SiStripMonitorTrack.cc b/DQM/SiStripMonitorTrack/src/SiStripMonitorTrack.cc index 16bfaed1bae28..eea47fde75292 100755 --- a/DQM/SiStripMonitorTrack/src/SiStripMonitorTrack.cc +++ b/DQM/SiStripMonitorTrack/src/SiStripMonitorTrack.cc @@ -25,7 +25,7 @@ SiStripMonitorTrack::SiStripMonitorTrack(const edm::ParameterSet& conf): conf_(conf), tracksCollection_in_EventTree(true), firstEvent(-1), - genTriggerEventFlag_(new GenericTriggerEventFlag(conf, consumesCollector())) + genTriggerEventFlag_(new GenericTriggerEventFlag(conf, consumesCollector(), *this)) { Cluster_src_ = conf.getParameter<edm::InputTag>("Cluster_src"); Mod_On_ = conf.getParameter<bool>("Mod_On"); diff --git a/DQM/TrackerCommon/interface/TriggerHelper.h b/DQM/TrackerCommon/interface/TriggerHelper.h index bebc38fcd6ef1..0114cd4cadb2c 100644 --- a/DQM/TrackerCommon/interface/TriggerHelper.h +++ b/DQM/TrackerCommon/interface/TriggerHelper.h @@ -30,11 +30,18 @@ #include "L1Trigger/GlobalTriggerAnalyzer/interface/L1GtUtils.h" #include "HLTrigger/HLTcore/interface/HLTConfigProvider.h" +#include <memory> + +namespace edm { + class ConsumesCollector; + class ParameterSet; +} + class TriggerHelper { // Utility classes edm::ESWatcher< AlCaRecoTriggerBitsRcd > * watchDB_; - L1GtUtils l1Gt_; + std::unique_ptr<L1GtUtils> l1Gt_; HLTConfigProvider hltConfig_; bool hltConfigInit_; // Configuration parameters @@ -68,8 +75,13 @@ class TriggerHelper { public: - // Constructors and destructor - TriggerHelper( const edm::ParameterSet & config ); // To be called from the ED module's c'tor + // Constructors must be called from the ED module's c'tor + template <typename T> + TriggerHelper( const edm::ParameterSet & config, edm::ConsumesCollector && iC, T& module ); + + template <typename T> + TriggerHelper( const edm::ParameterSet & config, edm::ConsumesCollector & iC, T& module ); + ~TriggerHelper(); // Public methods @@ -82,6 +94,8 @@ class TriggerHelper { // Private methods + TriggerHelper( const edm::ParameterSet & config ); + // DCS bool acceptDcs( const edm::Event & event ); bool acceptDcsPartition( const edm::Handle< DcsStatusCollection > & dcsStatus, int dcsPartition ) const; @@ -104,5 +118,15 @@ class TriggerHelper { }; +template <typename T> +TriggerHelper::TriggerHelper( const edm::ParameterSet & config, edm::ConsumesCollector && iC, T& module ) : + TriggerHelper(config, iC, module) { +} + +template <typename T> +TriggerHelper::TriggerHelper( const edm::ParameterSet & config, edm::ConsumesCollector & iC, T& module ) : + TriggerHelper(config) { + l1Gt_.reset(new L1GtUtils(config, iC, false, module)); +} #endif diff --git a/DQM/TrackerCommon/src/TriggerHelper.cc b/DQM/TrackerCommon/src/TriggerHelper.cc index bce3821b85308..a04105406bac6 100644 --- a/DQM/TrackerCommon/src/TriggerHelper.cc +++ b/DQM/TrackerCommon/src/TriggerHelper.cc @@ -290,7 +290,7 @@ bool TriggerHelper::acceptL1( const edm::Event & event, const edm::EventSetup & if ( ! onL1_ || l1LogicalExpressions_.empty() ) return ( ! andOr_ ); // logically neutral, depending on base logical connective // Getting the L1 event setup - l1Gt_.retrieveL1EventSetup( setup ); // FIXME This can possibly go to initRun() + l1Gt_->retrieveL1EventSetup( setup ); // FIXME This can possibly go to initRun() // Determine decision of L1 logical expression combination and return if ( andOrL1_ ) { // OR combination @@ -330,7 +330,7 @@ bool TriggerHelper::acceptL1LogicalExpression( const edm::Event & event, std::st for ( size_t iAlgorithm = 0; iAlgorithm < l1AlgoLogicParser.operandTokenVector().size(); ++iAlgorithm ) { const std::string l1AlgoName( l1AlgoLogicParser.operandTokenVector().at( iAlgorithm ).tokenName ); int error( -1 ); - const bool decision( l1Gt_.decision( event, l1AlgoName, error ) ); + const bool decision( l1Gt_->decision( event, l1AlgoName, error ) ); // Error checks if ( error != 0 ) { if ( error == 1 ) edm::LogError( "TriggerHelper" ) << "L1 algorithm \"" << l1AlgoName << "\" does not exist in the L1 menu ==> decision: " << errorReplyL1_; diff --git a/DQM/TrackerMonitorTrack/src/MonitorTrackResiduals.cc b/DQM/TrackerMonitorTrack/src/MonitorTrackResiduals.cc index 94a7c2c7ff5b2..cf3d519c48314 100644 --- a/DQM/TrackerMonitorTrack/src/MonitorTrackResiduals.cc +++ b/DQM/TrackerMonitorTrack/src/MonitorTrackResiduals.cc @@ -23,7 +23,7 @@ MonitorTrackResiduals::MonitorTrackResiduals(const edm::ParameterSet& iConfig) : dqmStore_( edm::Service<DQMStore>().operator->() ) , conf_(iConfig), m_cacheID_(0) - , genTriggerEventFlag_(new GenericTriggerEventFlag(iConfig, consumesCollector())) + , genTriggerEventFlag_(new GenericTriggerEventFlag(iConfig, consumesCollector(), *this)) , avalidator_(iConfig, consumesCollector()) { ModOn = conf_.getParameter<bool>("Mod_On"); } diff --git a/DQM/TrackingMonitor/src/LogMessageMonitor.cc b/DQM/TrackingMonitor/src/LogMessageMonitor.cc index 80161ada1ebb1..372950b50db19 100644 --- a/DQM/TrackingMonitor/src/LogMessageMonitor.cc +++ b/DQM/TrackingMonitor/src/LogMessageMonitor.cc @@ -91,7 +91,7 @@ LogMessageMonitor::LogMessageMonitor(const edm::ParameterSet& iConfig) edm::ConsumesCollector c{ consumesCollector() }; //now do what ever initialization is needed lumiDetails_ = new GetLumi( iConfig.getParameter<edm::ParameterSet>("BXlumiSetup"), c ); - genTriggerEventFlag_ = new GenericTriggerEventFlag(iConfig, consumesCollector()); + genTriggerEventFlag_ = new GenericTriggerEventFlag(iConfig, consumesCollector(), *this); } diff --git a/DQM/TrackingMonitor/src/TrackingMonitor.cc b/DQM/TrackingMonitor/src/TrackingMonitor.cc index fd37a3a48d78c..ea7dae7377090 100644 --- a/DQM/TrackingMonitor/src/TrackingMonitor.cc +++ b/DQM/TrackingMonitor/src/TrackingMonitor.cc @@ -69,7 +69,7 @@ TrackingMonitor::TrackingMonitor(const edm::ParameterSet& iConfig) , doGeneralPropertiesPlots_( conf_.getParameter<bool>("doGeneralPropertiesPlots")) , doHitPropertiesPlots_ ( conf_.getParameter<bool>("doHitPropertiesPlots")) , doPUmonitoring_ ( conf_.getParameter<bool>("doPUmonitoring") ) - , genTriggerEventFlag_(new GenericTriggerEventFlag(iConfig,consumesCollector())) + , genTriggerEventFlag_(new GenericTriggerEventFlag(iConfig,consumesCollector(), *this)) , numSelection_ (conf_.getParameter<std::string>("numCut")) , denSelection_ (conf_.getParameter<std::string>("denCut")) { diff --git a/DQM/TrackingMonitor/src/dEdxAnalyzer.cc b/DQM/TrackingMonitor/src/dEdxAnalyzer.cc index 042cd2de025c0..3c905abd94ec6 100644 --- a/DQM/TrackingMonitor/src/dEdxAnalyzer.cc +++ b/DQM/TrackingMonitor/src/dEdxAnalyzer.cc @@ -25,7 +25,7 @@ dEdxAnalyzer::dEdxAnalyzer(const edm::ParameterSet& iConfig) , conf_ (fullconf_.getParameter<edm::ParameterSet>("dEdxParameters") ) , doAllPlots_ ( conf_.getParameter<bool>("doAllPlots") ) , doDeDxPlots_ ( conf_.getParameter<bool>("doDeDxPlots") ) - , genTriggerEventFlag_( new GenericTriggerEventFlag(conf_,consumesCollector()) ) + , genTriggerEventFlag_( new GenericTriggerEventFlag(conf_,consumesCollector(), *this) ) { trackInputTag_ = edm::InputTag(conf_.getParameter<std::string>("TracksForDeDx") ); diff --git a/DQM/TrigXMonitor/interface/HLTSeedL1LogicScalers.h b/DQM/TrigXMonitor/interface/HLTSeedL1LogicScalers.h index 6898b023b785e..a0f7313a059a5 100644 --- a/DQM/TrigXMonitor/interface/HLTSeedL1LogicScalers.h +++ b/DQM/TrigXMonitor/interface/HLTSeedL1LogicScalers.h @@ -62,11 +62,11 @@ class HLTSeedL1LogicScalers : public DQMEDAnalyzer { std::string fDQMFolder; std::string fProcessname; - L1GtUtils m_l1GtUtils; HLTConfigProvider fHLTConfig; edm::InputTag fL1GtDaqReadoutRecordInputTag; edm::InputTag fL1GtRecordInputTag; + L1GtUtils m_l1GtUtils; std::vector<std::string> fMonitorPaths; std::vector<MonitorElement*> fMonitorPathsME; diff --git a/DQM/TrigXMonitor/src/HLTSeedL1LogicScalers.cc b/DQM/TrigXMonitor/src/HLTSeedL1LogicScalers.cc index 9a623f8ebe2e1..3e597df066ed9 100644 --- a/DQM/TrigXMonitor/src/HLTSeedL1LogicScalers.cc +++ b/DQM/TrigXMonitor/src/HLTSeedL1LogicScalers.cc @@ -14,7 +14,10 @@ using namespace edm; using namespace std; using namespace trigger; -HLTSeedL1LogicScalers::HLTSeedL1LogicScalers(const edm::ParameterSet& iConfig) { +HLTSeedL1LogicScalers::HLTSeedL1LogicScalers(const edm::ParameterSet& iConfig) : + fL1GtDaqReadoutRecordInputTag(iConfig.getParameter<edm::InputTag>("L1GtDaqReadoutRecordInputTag")), + fL1GtRecordInputTag(iConfig.getParameter<edm::InputTag>("L1GtRecordInputTag")), + m_l1GtUtils(iConfig, consumesCollector(), false, *this, fL1GtRecordInputTag, fL1GtDaqReadoutRecordInputTag, edm::InputTag()) { // now do what ever initialization is needed LogDebug("HLTSeedL1LogicScalers") << "constructor"; @@ -23,14 +26,6 @@ HLTSeedL1LogicScalers::HLTSeedL1LogicScalers(const edm::ParameterSet& iConfig) { fL1BeforeMask = iConfig.getParameter<bool>("l1BeforeMask"); fProcessname = iConfig.getParameter<std::string>("processname"); - // input tag for GT DAQ product - fL1GtDaqReadoutRecordInputTag = - iConfig.getParameter<edm::InputTag>("L1GtDaqReadoutRecordInputTag"); - - // input tag for GT lite product - fL1GtRecordInputTag = - iConfig.getParameter<edm::InputTag>("L1GtRecordInputTag"); - // get untracked parameters fDQMFolder = iConfig.getUntrackedParameter( "DQMFolder", string("HLT/HLTSeedL1LogicScalers/HLT_LogicL1")); @@ -198,11 +193,11 @@ bool HLTSeedL1LogicScalers::analyzeL1GtUtils(const edm::Event& iEvent, // check flag L1BeforeMask if (fL1BeforeMask) { decisionAlgTechTrig = m_l1GtUtils.decisionBeforeMask( - iEvent, fL1GtRecordInputTag, fL1GtDaqReadoutRecordInputTag, l1AlgoName, + iEvent, l1AlgoName, iErrorCode); } else { decisionAlgTechTrig = m_l1GtUtils.decisionAfterMask( - iEvent, fL1GtRecordInputTag, fL1GtDaqReadoutRecordInputTag, l1AlgoName, + iEvent, l1AlgoName, iErrorCode); } diff --git a/DQMOffline/JetMET/interface/METAnalyzer.h b/DQMOffline/JetMET/interface/METAnalyzer.h index 5ca6ecf5940e0..53b80791ac960 100644 --- a/DQMOffline/JetMET/interface/METAnalyzer.h +++ b/DQMOffline/JetMET/interface/METAnalyzer.h @@ -84,11 +84,6 @@ #include "FWCore/Framework/interface/ESHandle.h" #include "JetMETCorrections/JetCorrector/interface/JetCorrector.h" - -#include "L1Trigger/GlobalTriggerAnalyzer/interface/L1GtUtils.h" - - - #include <map> #include <string> @@ -142,10 +137,6 @@ class METAnalyzer : public DQMEDAnalyzer{ // Switch for verbosity int verbose_; - - L1GtUtils m_l1GtUtils; - - std::string MetType_; std::string FolderName_; diff --git a/DQMOffline/JetMET/src/JetAnalyzer.cc b/DQMOffline/JetMET/src/JetAnalyzer.cc index ebc283422645a..7a0642edda790 100644 --- a/DQMOffline/JetMET/src/JetAnalyzer.cc +++ b/DQMOffline/JetMET/src/JetAnalyzer.cc @@ -180,8 +180,8 @@ JetAnalyzer::JetAnalyzer(const edm::ParameterSet& pSet) edm::ParameterSet highptjetparms = pSet.getParameter<edm::ParameterSet>("highPtJetTrigger"); edm::ParameterSet lowptjetparms = pSet.getParameter<edm::ParameterSet>("lowPtJetTrigger" ); - highPtJetEventFlag_ = new GenericTriggerEventFlag( highptjetparms, consumesCollector() ); - lowPtJetEventFlag_ = new GenericTriggerEventFlag( lowptjetparms , consumesCollector() ); + highPtJetEventFlag_ = new GenericTriggerEventFlag( highptjetparms, consumesCollector(), *this ); + lowPtJetEventFlag_ = new GenericTriggerEventFlag( lowptjetparms , consumesCollector(), *this ); highPtJetExpr_ = highptjetparms.getParameter<std::vector<std::string> >("hltPaths"); lowPtJetExpr_ = lowptjetparms .getParameter<std::vector<std::string> >("hltPaths"); diff --git a/DQMOffline/JetMET/src/METAnalyzer.cc b/DQMOffline/JetMET/src/METAnalyzer.cc index cf7c92f948534..03f0a76de68d8 100644 --- a/DQMOffline/JetMET/src/METAnalyzer.cc +++ b/DQMOffline/JetMET/src/METAnalyzer.cc @@ -136,7 +136,7 @@ METAnalyzer::METAnalyzer(const edm::ParameterSet& pSet) { triggerSelectedSubFolders_ = parameters.getParameter<edm::VParameterSet>("triggerSelectedSubFolders"); for (edm::VParameterSet::const_iterator it = triggerSelectedSubFolders_.begin(); it!= triggerSelectedSubFolders_.end(); it++) { - triggerFolderEventFlag_.push_back(new GenericTriggerEventFlag( *it, consumesCollector() )); + triggerFolderEventFlag_.push_back(new GenericTriggerEventFlag( *it, consumesCollector(), *this )); triggerFolderExpr_.push_back(it->getParameter<std::vector<std::string> >("hltPaths")); triggerFolderLabels_.push_back(it->getParameter<std::string>("label")); } diff --git a/DQMOffline/L1Trigger/interface/L1TRate_Offline.h b/DQMOffline/L1Trigger/interface/L1TRate_Offline.h index 2f47c1a93978f..2acc085fa8be1 100644 --- a/DQMOffline/L1Trigger/interface/L1TRate_Offline.h +++ b/DQMOffline/L1Trigger/interface/L1TRate_Offline.h @@ -31,6 +31,8 @@ #include "DQMServices/Core/interface/DQMEDAnalyzer.h" +#include "L1Trigger/GlobalTriggerAnalyzer/interface/L1GtUtils.h" + #include <TString.h> #include <iostream> @@ -126,6 +128,8 @@ class L1TRate_Offline : public DQMEDAnalyzer { // MonitorElement MonitorElement* m_ErrorMonitor; + + L1GtUtils m_l1GtUtils; }; #endif diff --git a/DQMOffline/L1Trigger/interface/L1TSync_Offline.h b/DQMOffline/L1Trigger/interface/L1TSync_Offline.h index 6ff6dcbcf36b0..42405cd829a18 100644 --- a/DQMOffline/L1Trigger/interface/L1TSync_Offline.h +++ b/DQMOffline/L1Trigger/interface/L1TSync_Offline.h @@ -48,6 +48,8 @@ #include "DQMServices/Core/interface/DQMEDAnalyzer.h" +#include "L1Trigger/GlobalTriggerAnalyzer/interface/L1GtUtils.h" + #include <TString.h> #include <iostream> @@ -161,6 +163,7 @@ class L1TSync_Offline : public DQMEDAnalyzer { edm::EDGetTokenT<L1GlobalTriggerEvmReadoutRecord> m_l1GtEvmSource; edm::EDGetTokenT<L1GlobalTriggerReadoutRecord> m_l1GtDataDaqInputTag; + L1GtUtils m_l1GtUtils; }; #endif diff --git a/DQMOffline/L1Trigger/src/L1TRate_Offline.cc b/DQMOffline/L1Trigger/src/L1TRate_Offline.cc index ee4a26b75fe8c..e65d6129b0033 100644 --- a/DQMOffline/L1Trigger/src/L1TRate_Offline.cc +++ b/DQMOffline/L1Trigger/src/L1TRate_Offline.cc @@ -18,7 +18,8 @@ using namespace edm; using namespace std; //_____________________________________________________________________ -L1TRate_Offline::L1TRate_Offline(const ParameterSet & ps){ +L1TRate_Offline::L1TRate_Offline(const ParameterSet & ps) : + m_l1GtUtils(ps, consumesCollector(), false, *this) { m_maxNbins = 2500; // Maximum LS for each run (for binning purposes) m_parameters = ps; @@ -84,7 +85,8 @@ void L1TRate_Offline::bookHistograms(DQMStore::IBooker &ibooker, const edm::Run& // Getting Lowest Prescale Single Object Triggers from the menu L1TMenuHelper myMenuHelper = L1TMenuHelper(iSetup); - m_selectedTriggers = myMenuHelper.getLUSOTrigger(m_inputCategories,m_refPrescaleSet); + m_l1GtUtils.retrieveL1EventSetup(iSetup); + m_selectedTriggers = myMenuHelper.getLUSOTrigger(m_inputCategories,m_refPrescaleSet, m_l1GtUtils); //-> Getting template fits for the algLo cross sections getXSexFitsPython(m_parameters); diff --git a/DQMOffline/L1Trigger/src/L1TSync_Offline.cc b/DQMOffline/L1Trigger/src/L1TSync_Offline.cc index 76eb69237e9b9..44fe29f96f983 100644 --- a/DQMOffline/L1Trigger/src/L1TSync_Offline.cc +++ b/DQMOffline/L1Trigger/src/L1TSync_Offline.cc @@ -58,7 +58,8 @@ using namespace std; //------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------- -L1TSync_Offline::L1TSync_Offline(const ParameterSet & pset){ +L1TSync_Offline::L1TSync_Offline(const ParameterSet & pset) : + m_l1GtUtils(pset, consumesCollector(), false, *this) { m_parameters = pset; @@ -259,7 +260,8 @@ void L1TSync_Offline::bookHistograms(DQMStore::IBooker &ibooker, const edm::Run& m_selectedTriggers = myMenuHelper.testAlgos(m_selectedTriggers); - map<string,string> tAutoSelTrig = myMenuHelper.getLUSOTrigger(m_algoAutoSelect,m_refPrescaleSet); + m_l1GtUtils.retrieveL1EventSetup(iSetup); + map<string,string> tAutoSelTrig = myMenuHelper.getLUSOTrigger(m_algoAutoSelect, m_refPrescaleSet, m_l1GtUtils); m_selectedTriggers.insert(tAutoSelTrig.begin(),tAutoSelTrig.end()); // Initializing DQM Monitor Elements diff --git a/DQMOffline/Muon/src/MuonRecoOneHLT.cc b/DQMOffline/Muon/src/MuonRecoOneHLT.cc index 7d342ae801a05..e8bfb7dbe1742 100644 --- a/DQMOffline/Muon/src/MuonRecoOneHLT.cc +++ b/DQMOffline/Muon/src/MuonRecoOneHLT.cc @@ -19,8 +19,8 @@ MuonRecoOneHLT::MuonRecoOneHLT(const edm::ParameterSet& pSet) { //, MuonServiceP ParameterSet muonparms = parameters.getParameter<edm::ParameterSet>("SingleMuonTrigger"); ParameterSet dimuonparms = parameters.getParameter<edm::ParameterSet>("DoubleMuonTrigger"); - _SingleMuonEventFlag = new GenericTriggerEventFlag( muonparms, consumesCollector() ); - _DoubleMuonEventFlag = new GenericTriggerEventFlag( dimuonparms, consumesCollector() ); + _SingleMuonEventFlag = new GenericTriggerEventFlag( muonparms, consumesCollector(), *this ); + _DoubleMuonEventFlag = new GenericTriggerEventFlag( dimuonparms, consumesCollector(), *this ); // Trigger Expresions in case de connection to the DB fails singlemuonExpr_ = muonparms.getParameter<std::vector<std::string> >("hltPaths"); diff --git a/FWCore/Framework/interface/ProducerBase.h b/FWCore/Framework/interface/ProducerBase.h index ff7920cf06c09..333034ca5d443 100644 --- a/FWCore/Framework/interface/ProducerBase.h +++ b/FWCore/Framework/interface/ProducerBase.h @@ -47,7 +47,6 @@ namespace edm { using ProductRegistryHelper::produces; using ProductRegistryHelper::typeLabelList; - protected: void callWhenNewProductsRegistered(std::function<void(BranchDescription const&)> const& func) { callWhenNewProductsRegistered_ = func; } diff --git a/FWCore/Framework/interface/one/EDAnalyzerBase.h b/FWCore/Framework/interface/one/EDAnalyzerBase.h index fe6de5cf88922..a7a2dccd482fb 100644 --- a/FWCore/Framework/interface/one/EDAnalyzerBase.h +++ b/FWCore/Framework/interface/one/EDAnalyzerBase.h @@ -63,8 +63,6 @@ namespace edm { // Warning: the returned moduleDescription will be invalid during construction ModuleDescription const& moduleDescription() const { return moduleDescription_; } - protected: - void callWhenNewProductsRegistered(std::function<void(BranchDescription const&)> const& func); private: diff --git a/FWCore/Framework/interface/stream/EDAnalyzer.h b/FWCore/Framework/interface/stream/EDAnalyzer.h index dd9b0e3d6ed90..4e7070abbe7fb 100644 --- a/FWCore/Framework/interface/stream/EDAnalyzer.h +++ b/FWCore/Framework/interface/stream/EDAnalyzer.h @@ -57,8 +57,7 @@ namespace edm { // ---------- static member functions -------------------- // ---------- member functions --------------------------- - - protected: + using EDAnalyzerBase::callWhenNewProductsRegistered; private: diff --git a/FWCore/Framework/interface/stream/EDAnalyzerBase.h b/FWCore/Framework/interface/stream/EDAnalyzerBase.h index a5a1194fadb57..579447b9086c8 100644 --- a/FWCore/Framework/interface/stream/EDAnalyzerBase.h +++ b/FWCore/Framework/interface/stream/EDAnalyzerBase.h @@ -52,7 +52,6 @@ namespace edm { ModuleDescription const& moduleDescription() const { return *moduleDescriptionPtr_; } - protected: void callWhenNewProductsRegistered(std::function<void(BranchDescription const&)> const& func); diff --git a/HLTrigger/HLTanalyzers/interface/HLTHeavyIon.h b/HLTrigger/HLTanalyzers/interface/HLTHeavyIon.h index db2198a4e3aa5..f381616e7c658 100644 --- a/HLTrigger/HLTanalyzers/interface/HLTHeavyIon.h +++ b/HLTrigger/HLTanalyzers/interface/HLTHeavyIon.h @@ -46,7 +46,6 @@ //#include "DataFormats/L1GlobalTrigger/interface/L1GtLogicParser.h" #include "HLTrigger/HLTcore/interface/HLTConfigProvider.h" -#include "L1Trigger/GlobalTriggerAnalyzer/interface/L1GtUtils.h" typedef std::vector<std::string> MyStrings; @@ -104,7 +103,6 @@ class HLTHeavyIon { HLTConfigProvider hltConfig_; - L1GtUtils m_l1GtUtils; std::string processName_; bool _OR_BXes; diff --git a/HLTrigger/HLTanalyzers/interface/HLTInfo.h b/HLTrigger/HLTanalyzers/interface/HLTInfo.h index f27d112bbb1a8..3974bdf760c71 100644 --- a/HLTrigger/HLTanalyzers/interface/HLTInfo.h +++ b/HLTrigger/HLTanalyzers/interface/HLTInfo.h @@ -5,6 +5,7 @@ #include "TH2.h" #include "TFile.h" #include "TNamed.h" +#include <memory> #include <vector> #include <map> #include "TROOT.h" @@ -55,8 +56,12 @@ #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerObjectMap.h" //#include "DataFormats/L1GlobalTrigger/interface/L1GtLogicParser.h" -#include "HLTrigger/HLTcore/interface/HLTConfigProvider.h" -#include "L1Trigger/GlobalTriggerAnalyzer/interface/L1GtUtils.h" +#include "HLTrigger/HLTcore/interface/HLTPrescaleProvider.h" + +namespace edm { + class ConsumesCollector; + class ParameterSet; +} typedef std::vector<std::string> MyStrings; @@ -68,7 +73,16 @@ typedef std::vector<std::string> MyStrings; */ class HLTInfo { public: - HLTInfo(); + + template <typename T> + HLTInfo(edm::ParameterSet const& pset, + edm::ConsumesCollector&& iC, + T& module); + + template <typename T> + HLTInfo(edm::ParameterSet const& pset, + edm::ConsumesCollector& iC, + T& module); void setup(const edm::ParameterSet& pSet, TTree* tree); void beginRun(const edm::Run& , const edm::EventSetup& ); @@ -94,6 +108,8 @@ class HLTInfo { private: + HLTInfo(); + // Tree variables float *hltppt, *hltpeta; float *l1extiemet, *l1extieme, *l1extiemeta, *l1extiemphi; @@ -119,8 +135,7 @@ class HLTInfo { TString * techBitToName; std::vector<std::string> dummyBranches_; - HLTConfigProvider hltConfig_; - L1GtUtils m_l1GtUtils; + std::unique_ptr<HLTPrescaleProvider> hltPrescaleProvider_; std::string processName_; bool _OR_BXes; @@ -130,4 +145,19 @@ class HLTInfo { bool _Debug; }; +template <typename T> +HLTInfo::HLTInfo(edm::ParameterSet const& pset, + edm::ConsumesCollector&& iC, + T& module) : + HLTInfo(pset, iC, module) { +} + +template <typename T> +HLTInfo::HLTInfo(edm::ParameterSet const& pset, + edm::ConsumesCollector& iC, + T& module) : + HLTInfo() { + hltPrescaleProvider_.reset(new HLTPrescaleProvider(pset, iC, module)); +} + #endif diff --git a/HLTrigger/HLTanalyzers/src/HLTAnalyzer.cc b/HLTrigger/HLTanalyzers/src/HLTAnalyzer.cc index cadc409e9de80..06a776fdb53ff 100644 --- a/HLTrigger/HLTanalyzers/src/HLTAnalyzer.cc +++ b/HLTrigger/HLTanalyzers/src/HLTAnalyzer.cc @@ -24,7 +24,8 @@ bool getCollection(const edm::Event & event, std::vector<MissingCollectionInfo> } // Boiler-plate constructor definition of an analyzer module: -HLTAnalyzer::HLTAnalyzer(edm::ParameterSet const& conf) { +HLTAnalyzer::HLTAnalyzer(edm::ParameterSet const& conf) : + hlt_analysis_(conf, consumesCollector(), *this) { // If your module takes parameters, here is where you would define // their names and types, and access them to initialize internal diff --git a/HLTrigger/HLTanalyzers/src/HLTBitAnalyzer.cc b/HLTrigger/HLTanalyzers/src/HLTBitAnalyzer.cc index 275df9a7ffd83..d9bb0ec90d731 100644 --- a/HLTrigger/HLTanalyzers/src/HLTBitAnalyzer.cc +++ b/HLTrigger/HLTanalyzers/src/HLTBitAnalyzer.cc @@ -26,7 +26,8 @@ bool getCollection(const edm::Event & event, std::vector<MissingCollectionInfo> } // Boiler-plate constructor definition of an analyzer module: -HLTBitAnalyzer::HLTBitAnalyzer(edm::ParameterSet const& conf) { +HLTBitAnalyzer::HLTBitAnalyzer(edm::ParameterSet const& conf) : + hlt_analysis_(conf, consumesCollector(), *this) { // If your module takes parameters, here is where you would define // their names and types, and access them to initialize internal diff --git a/HLTrigger/HLTanalyzers/src/HLTInfo.cc b/HLTrigger/HLTanalyzers/src/HLTInfo.cc index 7903388a13ee0..66556ae73d5f1 100644 --- a/HLTrigger/HLTanalyzers/src/HLTInfo.cc +++ b/HLTrigger/HLTanalyzers/src/HLTInfo.cc @@ -13,6 +13,7 @@ #include "FWCore/Common/interface/TriggerNames.h" // L1 related +#include "HLTrigger/HLTcore/interface/HLTConfigProvider.h" #include "L1Trigger/GlobalTriggerAnalyzer/interface/L1GtUtils.h" #include "CondFormats/L1TObjects/interface/L1GtTriggerMenu.h" #include "CondFormats/DataRecord/interface/L1GtTriggerMenuRcd.h" @@ -20,9 +21,6 @@ #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutSetup.h" #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutRecord.h" -static const bool useL1EventSetup(true); -static const bool useL1GtTriggerMenuLite(false); - HLTInfo::HLTInfo() { //set parameter defaults @@ -35,7 +33,7 @@ void HLTInfo::beginRun(const edm::Run& run, const edm::EventSetup& c){ bool changed(true); - if (hltConfig_.init(run,c,processName_,changed)) { + if (hltPrescaleProvider_->init(run,c,processName_,changed)) { // if init returns TRUE, initialisation has succeeded! if (changed) { // The HLT config has actually changed wrt the previous Run, hence rebook your @@ -243,10 +241,10 @@ void HLTInfo::analyze(const edm::Handle<edm::TriggerResults> & h HltEvtCnt++; } // ...Fill the corresponding accepts in branch-variables - - //std::cout << "Number of prescale sets: " << hltConfig_.prescaleSize() << std::endl; - //std::cout << "Number of HLT paths: " << hltConfig_.size() << std::endl; - //int presclSet = hltConfig_.prescaleSet(iEvent, eventSetup); + //HLTConfigProvider const& hltConfig = hltPrescaleProvider_->hltConfigProvider(); + //std::cout << "Number of prescale sets: " << hltConfig.prescaleSize() << std::endl; + //std::cout << "Number of HLT paths: " << hltConfig.size() << std::endl; + //int presclSet = hltPrescaleProvider_->prescaleSet(iEvent, eventSetup); //std::cout<<"\tPrescale set number: "<< presclSet <<std::endl; for (int itrig = 0; itrig != ntrigs; ++itrig){ @@ -254,7 +252,7 @@ void HLTInfo::analyze(const edm::Handle<edm::TriggerResults> & h std::string trigName=triggerNames.triggerName(itrig); bool accept = hltresults->accept(itrig); - trigPrescl[itrig] = hltConfig_.prescaleValue(iEvent, eventSetup, trigName); + trigPrescl[itrig] = hltPrescaleProvider_->prescaleValue(iEvent, eventSetup, trigName); if (accept){trigflag[itrig] = 1;} @@ -488,16 +486,15 @@ void HLTInfo::analyze(const edm::Handle<edm::TriggerResults> & h //==============L1 information======================================= // L1 Triggers from Menu + L1GtUtils const& l1GtUtils = hltPrescaleProvider_->l1GtUtils(); - // m_l1GtUtils.retrieveL1EventSetup(eventSetup); - m_l1GtUtils.getL1GtRunCache(iEvent,eventSetup,useL1EventSetup,useL1GtTriggerMenuLite); edm::ESHandle<L1GtTriggerMenu> menuRcd; eventSetup.get<L1GtTriggerMenuRcd>().get(menuRcd) ; const L1GtTriggerMenu* menu = menuRcd.product(); int iErrorCode = -1; L1GtUtils::TriggerCategory trigCategory = L1GtUtils::AlgorithmTrigger; - const int pfSetIndexAlgorithmTrigger = m_l1GtUtils.prescaleFactorSetIndex( + const int pfSetIndexAlgorithmTrigger = l1GtUtils.prescaleFactorSetIndex( iEvent, trigCategory, iErrorCode); if (iErrorCode == 0) { if (_Debug) std::cout << "%Prescale set index: " << pfSetIndexAlgorithmTrigger << std::endl; @@ -561,7 +558,7 @@ void HLTInfo::analyze(const edm::Handle<edm::TriggerResults> & h l1flag[iBit] = gtDecisionWord[iBit]; std::string l1triggername= std::string (algoBitToName[iBit]); - l1Prescl[iBit] = m_l1GtUtils.prescaleFactor(iEvent, + l1Prescl[iBit] = l1GtUtils.prescaleFactor(iEvent, l1triggername, iErrorCode); @@ -576,7 +573,7 @@ void HLTInfo::analyze(const edm::Handle<edm::TriggerResults> & h l1techflag[iBit] = (int) technicalTriggerWordBeforeMask.at(iBit); std::string l1triggername= std::string (techBitToName[iBit]); - l1techPrescl[iBit] = m_l1GtUtils.prescaleFactor(iEvent, + l1techPrescl[iBit] = l1GtUtils.prescaleFactor(iEvent, l1triggername, iErrorCode); diff --git a/HLTrigger/HLTcore/interface/HLTConfigProvider.h b/HLTrigger/HLTcore/interface/HLTConfigProvider.h index b3be0dae928fd..0a6bfe8e15e6a 100644 --- a/HLTrigger/HLTcore/interface/HLTConfigProvider.h +++ b/HLTrigger/HLTcore/interface/HLTConfigProvider.h @@ -15,16 +15,12 @@ #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/LuminosityBlock.h" -#include "L1Trigger/GlobalTriggerAnalyzer/interface/L1GtUtils.h" #include "HLTrigger/HLTcore/interface/HLTConfigData.h" -#include "boost/shared_ptr.hpp" - #include<map> #include<string> #include<vector> - // // class declaration // @@ -233,21 +229,6 @@ class HLTConfigProvider { return hltConfigData_->prescaleValue(set,trigger); } - /// HLT prescale values via (L1) EventSetup - /// current (default) prescale set index - to be taken from L1GtUtil via Event - int prescaleSet(const edm::Event& iEvent, const edm::EventSetup& iSetup) const; - // negative == error - - /// combining the two methods above - unsigned int prescaleValue(const edm::Event& iEvent, const edm::EventSetup& iSetup, const std::string& trigger) const; - - /// Combined L1T (pair.first) and HLT (pair.second) prescales per HLT path - std::pair<int,int> prescaleValues(const edm::Event& iEvent, const edm::EventSetup& iSetup, const std::string& trigger) const; - // any one negative => error in retrieving this (L1T or HLT) prescale - - // In case of a complex Boolean expression as L1 seed - std::pair<std::vector<std::pair<std::string,int> >,int> prescaleValuesInDetail(const edm::Event& iEvent, const edm::EventSetup& iSetup, const std::string& trigger) const; - /// low-level data member access const std::vector<std::string>& prescaleLabels() const { return hltConfigData_->prescaleLabels(); @@ -273,7 +254,5 @@ class HLTConfigProvider { bool inited_; bool changed_; const HLTConfigData* hltConfigData_; - boost::shared_ptr<L1GtUtils> l1GtUtils_; - }; #endif diff --git a/HLTrigger/HLTcore/interface/HLTEventAnalyzerAOD.h b/HLTrigger/HLTcore/interface/HLTEventAnalyzerAOD.h index e6f3fa349cfd8..74f8259979481 100644 --- a/HLTrigger/HLTcore/interface/HLTEventAnalyzerAOD.h +++ b/HLTrigger/HLTcore/interface/HLTEventAnalyzerAOD.h @@ -14,7 +14,7 @@ #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/stream/EDAnalyzer.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "HLTrigger/HLTcore/interface/HLTConfigProvider.h" +#include "HLTrigger/HLTcore/interface/HLTPrescaleProvider.h" #include "DataFormats/Common/interface/TriggerResults.h" #include "DataFormats/HLTReco/interface/TriggerEvent.h" namespace edm { @@ -49,7 +49,7 @@ class HLTEventAnalyzerAOD : public edm::stream::EDAnalyzer< > { /// additional class data memebers edm::Handle<edm::TriggerResults> triggerResultsHandle_; edm::Handle<trigger::TriggerEvent> triggerEventHandle_; - HLTConfigProvider hltConfig_; + HLTPrescaleProvider hltPrescaleProvider_; }; #endif diff --git a/HLTrigger/HLTcore/interface/HLTPrescaleProvider.h b/HLTrigger/HLTcore/interface/HLTPrescaleProvider.h new file mode 100644 index 0000000000000..e5e50a481c3ce --- /dev/null +++ b/HLTrigger/HLTcore/interface/HLTPrescaleProvider.h @@ -0,0 +1,94 @@ +#ifndef HLTcore_HLTPrescaleProvider_h +#define HLTcore_HLTPrescaleProvider_h + +/** \class HLTPrescaleProvider + * + * + * This class provides access routines to get hold of the HLT Configuration + * + * + * \author Martin Grunewald + * + * Originally the functions in here were in HLTConfigProvider. + * The functions that use L1GtUtils and get products from the + * Event were moved into this class in 2015 when the consumes + * function calls were added. W. David Dagenhart + */ + +#include "HLTrigger/HLTcore/interface/HLTConfigProvider.h" +#include "L1Trigger/GlobalTriggerAnalyzer/interface/L1GtUtils.h" + +#include <string> +#include <utility> +#include <vector> + +namespace edm { + class ConsumesCollector; + class Event; + class EventSetup; + class ParameterSet; + class Run; +} + +class HLTPrescaleProvider { + +public: + + template <typename T> + HLTPrescaleProvider(edm::ParameterSet const& pset, + edm::ConsumesCollector&& iC, + T& module); + + template <typename T> + HLTPrescaleProvider(edm::ParameterSet const& pset, + edm::ConsumesCollector& iC, + T& module); + + /// Run-dependent initialisation (non-const method) + /// "init" return value indicates whether intitialisation has succeeded + /// "changed" parameter indicates whether the config has actually changed + bool init(const edm::Run& iRun, const edm::EventSetup& iSetup, + const std::string& processName, bool& changed); + + HLTConfigProvider const& hltConfigProvider() const { return hltConfigProvider_; } + L1GtUtils const& l1GtUtils() const { return l1GtUtils_; } + + /// HLT prescale values via (L1) EventSetup + /// current (default) prescale set index - to be taken from L1GtUtil via Event + int prescaleSet(const edm::Event& iEvent, const edm::EventSetup& iSetup); + // negative == error + + /// combining the two methods above + unsigned int prescaleValue(const edm::Event& iEvent, + const edm::EventSetup& iSetup, + const std::string& trigger); + + /// Combined L1T (pair.first) and HLT (pair.second) prescales per HLT path + std::pair<int,int> prescaleValues(const edm::Event& iEvent, + const edm::EventSetup& iSetup, + const std::string& trigger); + // any one negative => error in retrieving this (L1T or HLT) prescale + + // In case of a complex Boolean expression as L1 seed + std::pair<std::vector<std::pair<std::string,int> >,int> prescaleValuesInDetail(const edm::Event& iEvent, + const edm::EventSetup& iSetup, + const std::string& trigger); + + private: + + HLTConfigProvider hltConfigProvider_; + L1GtUtils l1GtUtils_; +}; + +template <typename T> +HLTPrescaleProvider::HLTPrescaleProvider(edm::ParameterSet const& pset, + edm::ConsumesCollector&& iC, + T& module) : + HLTPrescaleProvider(pset, iC, module) { } + +template <typename T> +HLTPrescaleProvider::HLTPrescaleProvider(edm::ParameterSet const& pset, + edm::ConsumesCollector& iC, + T& module) : + l1GtUtils_(pset, iC, false, module) { } +#endif diff --git a/HLTrigger/HLTcore/plugins/HLTEventAnalyzerAOD.cc b/HLTrigger/HLTcore/plugins/HLTEventAnalyzerAOD.cc index 41745f5f8a498..e59c21e87adf7 100644 --- a/HLTrigger/HLTcore/plugins/HLTEventAnalyzerAOD.cc +++ b/HLTrigger/HLTcore/plugins/HLTEventAnalyzerAOD.cc @@ -9,9 +9,11 @@ #include "FWCore/Common/interface/TriggerNames.h" #include "FWCore/Common/interface/TriggerResultsByName.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" +#include "HLTrigger/HLTcore/interface/HLTConfigProvider.h" #include "HLTrigger/HLTcore/interface/HLTEventAnalyzerAOD.h" -#include "FWCore/MessageLogger/interface/MessageLogger.h" + #include <cassert> // @@ -23,7 +25,8 @@ HLTEventAnalyzerAOD::HLTEventAnalyzerAOD(const edm::ParameterSet& ps) : triggerResultsTag_(ps.getParameter<edm::InputTag>("triggerResults")), triggerResultsToken_(consumes<edm::TriggerResults>(triggerResultsTag_)), triggerEventTag_(ps.getParameter<edm::InputTag>("triggerEvent")), - triggerEventToken_(consumes<trigger::TriggerEvent>(triggerEventTag_)) + triggerEventToken_(consumes<trigger::TriggerEvent>(triggerEventTag_)), + hltPrescaleProvider_(ps, consumesCollector(), *this) { using namespace std; using namespace edm; @@ -63,27 +66,30 @@ HLTEventAnalyzerAOD::beginRun(edm::Run const & iRun, edm::EventSetup const& iSet using namespace edm; bool changed(true); - if (hltConfig_.init(iRun,iSetup,processName_,changed)) { + if (hltPrescaleProvider_.init(iRun,iSetup,processName_,changed)) { + + HLTConfigProvider const& hltConfig = hltPrescaleProvider_.hltConfigProvider(); + if (changed) { // check if trigger name in (new) config if (triggerName_!="@") { // "@" means: analyze all triggers in config - const unsigned int n(hltConfig_.size()); - const unsigned int triggerIndex(hltConfig_.triggerIndex(triggerName_)); + const unsigned int n(hltConfig.size()); + const unsigned int triggerIndex(hltConfig.triggerIndex(triggerName_)); if (triggerIndex>=n) { LogVerbatim("HLTEventAnalyzerAOD") << "HLTEventAnalyzerAOD::analyze:" << " TriggerName " << triggerName_ << " not available in (new) config!" << endl; LogVerbatim("HLTEventAnalyzerAOD") << "Available TriggerNames are: " << endl; - hltConfig_.dump("Triggers"); + hltConfig.dump("Triggers"); } } - hltConfig_.dump("ProcessName"); - hltConfig_.dump("GlobalTag"); - hltConfig_.dump("TableName"); - hltConfig_.dump("Streams"); - hltConfig_.dump("Datasets"); - hltConfig_.dump("PrescaleTable"); - hltConfig_.dump("ProcessPSet"); + hltConfig.dump("ProcessName"); + hltConfig.dump("GlobalTag"); + hltConfig.dump("TableName"); + hltConfig.dump("Streams"); + hltConfig.dump("Datasets"); + hltConfig.dump("PrescaleTable"); + hltConfig.dump("ProcessPSet"); } } else { LogVerbatim("HLTEventAnalyzerAOD") << "HLTEventAnalyzerAOD::analyze:" @@ -112,14 +118,17 @@ HLTEventAnalyzerAOD::analyze(const edm::Event& iEvent, const edm::EventSetup& iS LogVerbatim("HLTEventAnalyzerAOD") << "HLTEventAnalyzerAOD::analyze: Error in getting TriggerEvent product from Event!" << endl; return; } + + HLTConfigProvider const& hltConfig = hltPrescaleProvider_.hltConfigProvider(); + // sanity check - assert(triggerResultsHandle_->size()==hltConfig_.size()); + assert(triggerResultsHandle_->size()==hltConfig.size()); // analyze this event for the triggers requested if (triggerName_=="@") { - const unsigned int n(hltConfig_.size()); + const unsigned int n(hltConfig.size()); for (unsigned int i=0; i!=n; ++i) { - analyzeTrigger(iEvent,iSetup,hltConfig_.triggerName(i)); + analyzeTrigger(iEvent,iSetup,hltConfig.triggerName(i)); } } else { analyzeTrigger(iEvent,iSetup,triggerName_); @@ -138,8 +147,10 @@ void HLTEventAnalyzerAOD::analyzeTrigger(const edm::Event& iEvent, const edm::Ev LogVerbatim("HLTEventAnalyzerAOD") << endl; - const unsigned int n(hltConfig_.size()); - const unsigned int triggerIndex(hltConfig_.triggerIndex(triggerName)); + HLTConfigProvider const& hltConfig = hltPrescaleProvider_.hltConfigProvider(); + + const unsigned int n(hltConfig.size()); + const unsigned int triggerIndex(hltConfig.triggerIndex(triggerName)); assert(triggerIndex==iEvent.triggerNames(*triggerResultsHandle_).triggerIndex(triggerName)); // abort on invalid trigger name @@ -149,12 +160,12 @@ void HLTEventAnalyzerAOD::analyzeTrigger(const edm::Event& iEvent, const edm::Ev return; } - const std::pair<int,int> prescales(hltConfig_.prescaleValues(iEvent,iSetup,triggerName)); + const std::pair<int,int> prescales(hltPrescaleProvider_.prescaleValues(iEvent,iSetup,triggerName)); LogVerbatim("HLTEventAnalyzerAOD") << "HLTEventAnalyzerAOD::analyzeTrigger: path " << triggerName << " [" << triggerIndex << "] " << "prescales L1T,HLT: " << prescales.first << "," << prescales.second << endl; - const std::pair<std::vector<std::pair<std::string,int> >,int> prescalesInDetail(hltConfig_.prescaleValuesInDetail(iEvent,iSetup,triggerName)); + const std::pair<std::vector<std::pair<std::string,int> >,int> prescalesInDetail(hltPrescaleProvider_.prescaleValuesInDetail(iEvent,iSetup,triggerName)); std::ostringstream message; for (unsigned int i=0; i<prescalesInDetail.first.size(); ++i) { message << " " << i << ":" << prescalesInDetail.first[i].first << "/" << prescalesInDetail.first[i].second; @@ -168,8 +179,8 @@ void HLTEventAnalyzerAOD::analyzeTrigger(const edm::Event& iEvent, const edm::Ev << endl; // modules on this trigger path - const unsigned int m(hltConfig_.size(triggerIndex)); - const vector<string>& moduleLabels(hltConfig_.moduleLabels(triggerIndex)); + const unsigned int m(hltConfig.size(triggerIndex)); + const vector<string>& moduleLabels(hltConfig.moduleLabels(triggerIndex)); // Results from TriggerResults product LogVerbatim("HLTEventAnalyzerAOD") << " Trigger path status:" @@ -179,7 +190,7 @@ void HLTEventAnalyzerAOD::analyzeTrigger(const edm::Event& iEvent, const edm::Ev << endl; const unsigned int moduleIndex(triggerResultsHandle_->index(triggerIndex)); LogVerbatim("HLTEventAnalyzerAOD") << " Last active module - label/type: " - << moduleLabels[moduleIndex] << "/" << hltConfig_.moduleType(moduleLabels[moduleIndex]) + << moduleLabels[moduleIndex] << "/" << hltConfig.moduleType(moduleLabels[moduleIndex]) << " [" << moduleIndex << " out of 0-" << (m-1) << " on this path]" << endl; assert (moduleIndex<m); @@ -188,7 +199,7 @@ void HLTEventAnalyzerAOD::analyzeTrigger(const edm::Event& iEvent, const edm::Ev // modules actually run in this path for this event! for (unsigned int j=0; j<=moduleIndex; ++j) { const string& moduleLabel(moduleLabels[j]); - const string moduleType(hltConfig_.moduleType(moduleLabel)); + const string moduleType(hltConfig.moduleType(moduleLabel)); // check whether the module is packed up in TriggerEvent product const unsigned int filterIndex(triggerEventHandle_->filterIndex(InputTag(moduleLabel,"",processName_))); if (filterIndex<triggerEventHandle_->sizeFilters()) { diff --git a/HLTrigger/HLTcore/src/HLTConfigProvider.cc b/HLTrigger/HLTcore/src/HLTConfigProvider.cc index 58e03aed9c424..75ea00612d00d 100644 --- a/HLTrigger/HLTcore/src/HLTConfigProvider.cc +++ b/HLTrigger/HLTcore/src/HLTConfigProvider.cc @@ -21,9 +21,6 @@ #include <boost/regex.hpp> -static const bool useL1EventSetup(true); -static const bool useL1GtTriggerMenuLite(false); - // an empty dummy config data used when we fail to initialize static const HLTConfigData* s_dummyHLTConfigData() { static const HLTConfigData dummyHLTConfigData; @@ -34,8 +31,7 @@ HLTConfigProvider::HLTConfigProvider(): processName_(""), inited_(false), changed_(true), - hltConfigData_(s_dummyHLTConfigData()), - l1GtUtils_(new L1GtUtils()) + hltConfigData_(s_dummyHLTConfigData()) { } @@ -53,9 +49,6 @@ bool HLTConfigProvider::init(const edm::Run& iRun, init(iRun.processHistory(),processName); - /// L1 GTA V3: https://twiki.cern.ch/twiki/bin/view/CMSPublic/SWGuideL1TriggerL1GtUtils#Version_3 - l1GtUtils_->getL1GtRunCache(iRun,iSetup,useL1EventSetup,useL1GtTriggerMenuLite); - processName_=processName; changed=changed_; return inited_; @@ -243,154 +236,11 @@ void HLTConfigProvider::clear() inited_ = false; changed_ = true; hltConfigData_ = s_dummyHLTConfigData(); - *l1GtUtils_ = L1GtUtils(); return; } -int HLTConfigProvider::prescaleSet(const edm::Event& iEvent, const edm::EventSetup& iSetup) const { - // return hltPrescaleTable_.set(); - l1GtUtils_->getL1GtRunCache(iEvent,iSetup,useL1EventSetup,useL1GtTriggerMenuLite); - int errorTech(0); - const int psfsiTech(l1GtUtils_->prescaleFactorSetIndex(iEvent,L1GtUtils::TechnicalTrigger,errorTech)); - int errorPhys(0); - const int psfsiPhys(l1GtUtils_->prescaleFactorSetIndex(iEvent,L1GtUtils::AlgorithmTrigger,errorPhys)); - assert(psfsiTech==psfsiPhys); - if ( (errorTech==0) && (errorPhys==0) && - (psfsiTech>=0) && (psfsiPhys>=0) && (psfsiTech==psfsiPhys) ) { - return psfsiPhys; - } else { - /// error - notify user! - edm::LogError("HLTConfigData") - << " Error in determining HLT prescale set index from L1 data using L1GtUtils: " - << " Tech/Phys error = " << errorTech << "/" << errorPhys - << " Tech/Phys psfsi = " << psfsiTech << "/" << psfsiPhys; - return -1; - } -} - -unsigned int HLTConfigProvider::prescaleValue(const edm::Event& iEvent, const edm::EventSetup& iSetup, const std::string& trigger) const { - const int set(prescaleSet(iEvent,iSetup)); - if (set<0) { - return 1; - } else { - return prescaleValue(static_cast<unsigned int>(set),trigger); - } -} - -std::pair<int,int> HLTConfigProvider::prescaleValues(const edm::Event& iEvent, const edm::EventSetup& iSetup, const std::string& trigger) const { - - // start with setting both L1T and HLT prescale values to 0 - std::pair<int,int> result(std::pair<int,int>(0,0)); - - // get HLT prescale (possible if HLT prescale set index is correctly found) - const int set(prescaleSet(iEvent,iSetup)); - if (set<0) { - result.second = -1; - } else { - result.second = static_cast<int>(prescaleValue(static_cast<unsigned int>(set),trigger)); - } - - // get L1T prescale - works only for those hlt trigger paths with - // exactly one L1GT seed module which has exactly one L1T name as seed - const unsigned int nL1GTSeedModules(hltL1GTSeeds(trigger).size()); - if (nL1GTSeedModules==0) { - // no L1 seed module on path hence no L1 seed hence formally no L1 prescale - result.first=1; - } else if (nL1GTSeedModules==1) { - l1GtUtils_->getL1GtRunCache(iEvent,iSetup,useL1EventSetup,useL1GtTriggerMenuLite); - const std::string l1tname(hltL1GTSeeds(trigger).at(0).second); - int l1error(0); - result.first = l1GtUtils_->prescaleFactor(iEvent,l1tname,l1error); - if (l1error!=0) { - edm::LogError("HLTConfigData") - << " Error in determining L1T prescale for HLT path: '" << trigger - << "' with L1T seed: '" << l1tname - << "' using L1GtUtils: error code = " << l1error << "." << std::endl - << " Note: for this method ('prescaleValues'), only a single L1T name (and not a bit number) is allowed as seed!" << std::endl - << " For seeds being complex logical expressions, try the new method 'prescaleValuesInDetail'."<< std::endl; - result.first = -1; - } - } else { - /// error - can't handle properly multiple L1GTSeed modules - std::string dump("'"+hltL1GTSeeds(trigger).at(0).second+"'"); - for (unsigned int i=1; i!=nL1GTSeedModules; ++i) { - dump += " * '"+hltL1GTSeeds(trigger).at(i).second+"'"; - } - edm::LogError("HLTConfigData") - << " Error in determining L1T prescale for HLT path: '" << trigger - << "' has multiple L1GTSeed modules, " << nL1GTSeedModules - << ", with L1 seeds: " << dump - << ". (Note: at most one L1GTSeed module is allowed for a proper determination of the L1T prescale!)"; - result.first = -1; - } - - return result; -} - -std::pair<std::vector<std::pair<std::string,int> >,int> HLTConfigProvider::prescaleValuesInDetail(const edm::Event& iEvent, const edm::EventSetup& iSetup, const std::string& trigger) const { - - std::pair<std::vector<std::pair<std::string,int> >,int> result; - result.first.clear(); - - // get HLT prescale (possible if HLT prescale set index is correctly found) - const int set(prescaleSet(iEvent,iSetup)); - if (set<0) { - result.second = -1; - } else { - result.second = static_cast<int>(prescaleValue(static_cast<unsigned int>(set),trigger)); - } - - // get L1T prescale - works only for those hlt trigger paths with - // exactly one L1GT seed module which has exactly one L1T name as seed - const unsigned int nL1GTSeedModules(hltL1GTSeeds(trigger).size()); - if (nL1GTSeedModules==0) { - // no L1 seed module on path hence no L1 seed hence formally no L1 prescale - result.first.clear(); - } else if (nL1GTSeedModules==1) { - l1GtUtils_->getL1GtRunCache(iEvent,iSetup,useL1EventSetup,useL1GtTriggerMenuLite); - const std::string l1tname(hltL1GTSeeds(trigger).at(0).second); - L1GtUtils::LogicalExpressionL1Results l1Logical(l1tname,*l1GtUtils_); - l1Logical.logicalExpressionRunUpdate(iEvent.getRun(),iSetup,l1tname); - const std::vector<std::pair<std::string, int> >& errorCodes(l1Logical.errorCodes(iEvent)); - result.first = l1Logical.prescaleFactors(); - int l1error(l1Logical.isValid() ? 0 : 1); - for (unsigned int i=0; i<errorCodes.size(); ++i) { - l1error += std::abs(errorCodes[i].second); - } - if (l1error!=0) { - std::ostringstream message; - message - << " Error in determining L1T prescales for HLT path: '" << trigger - << "' with complex L1T seed: '" << l1tname - << "' using L1GtUtils: " << std::endl - << " isValid=" << l1Logical.isValid() - << " l1tname/error/prescale " << errorCodes.size() - << std::endl; - for (unsigned int i=0; i< errorCodes.size(); ++i) { - message << " " << i << ":" << errorCodes[i].first << "/" << errorCodes[i].second << "/" << result.first[i].second; - } - message << "."; - edm::LogError("HLTConfigData") << message.str(); - result.first.clear(); - } - } else { - /// error - can't handle properly multiple L1GTSeed modules - std::string dump("'"+hltL1GTSeeds(trigger).at(0).second+"'"); - for (unsigned int i=1; i!=nL1GTSeedModules; ++i) { - dump += " * '"+hltL1GTSeeds(trigger).at(i).second+"'"; - } - edm::LogError("HLTConfigData") - << " Error in determining L1T prescale for HLT path: '" << trigger - << "' has multiple L1GTSeed modules, " << nL1GTSeedModules - << ", with L1 seeds: " << dump - << ". (Note: at most one L1GTSeed module is allowed for a proper determination of the L1T prescale!)"; - result.first.clear(); - } - - return result; -} const std::vector<std::string> HLTConfigProvider::matched(const std::vector<std::string>& inputs, const std::string& pattern) { std::vector<std::string> matched; diff --git a/HLTrigger/HLTcore/src/HLTPrescaleProvider.cc b/HLTrigger/HLTcore/src/HLTPrescaleProvider.cc new file mode 100644 index 0000000000000..ddfc3cfe1e128 --- /dev/null +++ b/HLTrigger/HLTcore/src/HLTPrescaleProvider.cc @@ -0,0 +1,181 @@ +/** \class HLTPrescaleProvider + * + * See header file for documentation + * + * + * \author Martin Grunewald + * + */ + +#include "HLTrigger/HLTcore/interface/HLTPrescaleProvider.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" + +#include <cassert> +#include <sstream> + +static const bool useL1EventSetup(true); +static const bool useL1GtTriggerMenuLite(false); + +bool HLTPrescaleProvider::init(const edm::Run& iRun, + const edm::EventSetup& iSetup, + const std::string& processName, + bool& changed) { + + /// L1 GTA V3: https://twiki.cern.ch/twiki/bin/view/CMSPublic/SWGuideL1TriggerL1GtUtils#Version_3 + l1GtUtils_.getL1GtRunCache(iRun,iSetup,useL1EventSetup,useL1GtTriggerMenuLite); + + return hltConfigProvider_.init(iRun, iSetup, processName, changed); +} + +int HLTPrescaleProvider::prescaleSet(const edm::Event& iEvent, const edm::EventSetup& iSetup) { + // return hltPrescaleTable_.set(); + l1GtUtils_.getL1GtRunCache(iEvent,iSetup,useL1EventSetup,useL1GtTriggerMenuLite); + int errorTech(0); + const int psfsiTech(l1GtUtils_.prescaleFactorSetIndex(iEvent,L1GtUtils::TechnicalTrigger,errorTech)); + int errorPhys(0); + const int psfsiPhys(l1GtUtils_.prescaleFactorSetIndex(iEvent,L1GtUtils::AlgorithmTrigger,errorPhys)); + assert(psfsiTech==psfsiPhys); + if ( (errorTech==0) && (errorPhys==0) && + (psfsiTech>=0) && (psfsiPhys>=0) && (psfsiTech==psfsiPhys) ) { + return psfsiPhys; + } else { + /// error - notify user! + edm::LogError("HLTConfigData") + << " Error in determining HLT prescale set index from L1 data using L1GtUtils: " + << " Tech/Phys error = " << errorTech << "/" << errorPhys + << " Tech/Phys psfsi = " << psfsiTech << "/" << psfsiPhys; + return -1; + } +} + +unsigned int HLTPrescaleProvider::prescaleValue(const edm::Event& iEvent, + const edm::EventSetup& iSetup, + const std::string& trigger) { + const int set(prescaleSet(iEvent,iSetup)); + if (set<0) { + return 1; + } else { + return hltConfigProvider_.prescaleValue(static_cast<unsigned int>(set),trigger); + } +} + +std::pair<int,int> +HLTPrescaleProvider::prescaleValues(const edm::Event& iEvent, + const edm::EventSetup& iSetup, + const std::string& trigger) { + + // start with setting both L1T and HLT prescale values to 0 + std::pair<int,int> result(std::pair<int,int>(0,0)); + + // get HLT prescale (possible if HLT prescale set index is correctly found) + const int set(prescaleSet(iEvent,iSetup)); + if (set<0) { + result.second = -1; + } else { + result.second = static_cast<int>(hltConfigProvider_.prescaleValue(static_cast<unsigned int>(set),trigger)); + } + + // get L1T prescale - works only for those hlt trigger paths with + // exactly one L1GT seed module which has exactly one L1T name as seed + const unsigned int nL1GTSeedModules(hltConfigProvider_.hltL1GTSeeds(trigger).size()); + if (nL1GTSeedModules==0) { + // no L1 seed module on path hence no L1 seed hence formally no L1 prescale + result.first=1; + } else if (nL1GTSeedModules==1) { + l1GtUtils_.getL1GtRunCache(iEvent,iSetup,useL1EventSetup,useL1GtTriggerMenuLite); + const std::string l1tname(hltConfigProvider_.hltL1GTSeeds(trigger).at(0).second); + int l1error(0); + result.first = l1GtUtils_.prescaleFactor(iEvent,l1tname,l1error); + if (l1error!=0) { + edm::LogError("HLTConfigData") + << " Error in determining L1T prescale for HLT path: '" << trigger + << "' with L1T seed: '" << l1tname + << "' using L1GtUtils: error code = " << l1error << "." << std::endl + << " Note: for this method ('prescaleValues'), only a single L1T name (and not a bit number) is allowed as seed!" + << std::endl + << " For seeds being complex logical expressions, try the new method 'prescaleValuesInDetail'."<< std::endl; + result.first = -1; + } + } else { + /// error - can't handle properly multiple L1GTSeed modules + std::string dump("'"+hltConfigProvider_.hltL1GTSeeds(trigger).at(0).second+"'"); + for (unsigned int i=1; i!=nL1GTSeedModules; ++i) { + dump += " * '"+hltConfigProvider_.hltL1GTSeeds(trigger).at(i).second+"'"; + } + edm::LogError("HLTConfigData") + << " Error in determining L1T prescale for HLT path: '" << trigger + << "' has multiple L1GTSeed modules, " << nL1GTSeedModules + << ", with L1 seeds: " << dump + << ". (Note: at most one L1GTSeed module is allowed for a proper determination of the L1T prescale!)"; + result.first = -1; + } + + return result; +} + +std::pair<std::vector<std::pair<std::string,int> >,int> +HLTPrescaleProvider::prescaleValuesInDetail(const edm::Event& iEvent, + const edm::EventSetup& iSetup, + const std::string& trigger) { + + std::pair<std::vector<std::pair<std::string,int> >,int> result; + result.first.clear(); + + // get HLT prescale (possible if HLT prescale set index is correctly found) + const int set(prescaleSet(iEvent,iSetup)); + if (set<0) { + result.second = -1; + } else { + result.second = static_cast<int>(hltConfigProvider_.prescaleValue(static_cast<unsigned int>(set),trigger)); + } + + // get L1T prescale - works only for those hlt trigger paths with + // exactly one L1GT seed module which has exactly one L1T name as seed + const unsigned int nL1GTSeedModules(hltConfigProvider_.hltL1GTSeeds(trigger).size()); + if (nL1GTSeedModules==0) { + // no L1 seed module on path hence no L1 seed hence formally no L1 prescale + result.first.clear(); + } else if (nL1GTSeedModules==1) { + l1GtUtils_.getL1GtRunCache(iEvent,iSetup,useL1EventSetup,useL1GtTriggerMenuLite); + const std::string l1tname(hltConfigProvider_.hltL1GTSeeds(trigger).at(0).second); + L1GtUtils::LogicalExpressionL1Results l1Logical(l1tname, l1GtUtils_); + l1Logical.logicalExpressionRunUpdate(iEvent.getRun(),iSetup,l1tname); + const std::vector<std::pair<std::string, int> >& errorCodes(l1Logical.errorCodes(iEvent)); + result.first = l1Logical.prescaleFactors(); + int l1error(l1Logical.isValid() ? 0 : 1); + for (unsigned int i=0; i<errorCodes.size(); ++i) { + l1error += std::abs(errorCodes[i].second); + } + if (l1error!=0) { + std::ostringstream message; + message + << " Error in determining L1T prescales for HLT path: '" << trigger + << "' with complex L1T seed: '" << l1tname + << "' using L1GtUtils: " << std::endl + << " isValid=" << l1Logical.isValid() + << " l1tname/error/prescale " << errorCodes.size() + << std::endl; + for (unsigned int i=0; i< errorCodes.size(); ++i) { + message << " " << i << ":" << errorCodes[i].first << "/" << errorCodes[i].second << "/" + << result.first[i].second; + } + message << "."; + edm::LogError("HLTConfigData") << message.str(); + result.first.clear(); + } + } else { + /// error - can't handle properly multiple L1GTSeed modules + std::string dump("'"+hltConfigProvider_.hltL1GTSeeds(trigger).at(0).second+"'"); + for (unsigned int i=1; i!=nL1GTSeedModules; ++i) { + dump += " * '"+hltConfigProvider_.hltL1GTSeeds(trigger).at(i).second+"'"; + } + edm::LogError("HLTConfigData") + << " Error in determining L1T prescale for HLT path: '" << trigger + << "' has multiple L1GTSeed modules, " << nL1GTSeedModules + << ", with L1 seeds: " << dump + << ". (Note: at most one L1GTSeed module is allowed for a proper determination of the L1T prescale!)"; + result.first.clear(); + } + + return result; +} diff --git a/L1Trigger/GlobalTriggerAnalyzer/interface/L1GtUtilsHelper.h b/L1Trigger/GlobalTriggerAnalyzer/interface/L1GtUtilsHelper.h index a03104d677d16..baf1dae6c7b5a 100644 --- a/L1Trigger/GlobalTriggerAnalyzer/interface/L1GtUtilsHelper.h +++ b/L1Trigger/GlobalTriggerAnalyzer/interface/L1GtUtilsHelper.h @@ -17,6 +17,10 @@ * */ +#include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerRecord.h" +#include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutRecord.h" +#include "DataFormats/L1GlobalTrigger/interface/L1GtTriggerMenuLite.h" + #include "FWCore/Framework/interface/ConsumesCollector.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/Utilities/interface/EDGetToken.h" @@ -25,10 +29,6 @@ #include <string> #include <utility> -class L1GlobalTriggerRecord; -class L1GlobalTriggerReadoutRecord; -class L1GtTriggerMenuLite; - namespace edm { class BranchDescription; class ParameterSetDescription; diff --git a/L1Trigger/GlobalTriggerAnalyzer/src/L1GtUtilsHelper.cc b/L1Trigger/GlobalTriggerAnalyzer/src/L1GtUtilsHelper.cc index 4cf59f5d159e8..27e2f7a354069 100644 --- a/L1Trigger/GlobalTriggerAnalyzer/src/L1GtUtilsHelper.cc +++ b/L1Trigger/GlobalTriggerAnalyzer/src/L1GtUtilsHelper.cc @@ -1,7 +1,4 @@ #include "L1Trigger/GlobalTriggerAnalyzer/interface/L1GtUtilsHelper.h" -#include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerRecord.h" -#include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutRecord.h" -#include "DataFormats/L1GlobalTrigger/interface/L1GtTriggerMenuLite.h" #include "DataFormats/Provenance/interface/BranchDescription.h" #include "FWCore/ParameterSet/interface/ParameterSetDescription.h" #include "FWCore/Utilities/interface/BranchType.h" diff --git a/PhysicsTools/PatAlgos/plugins/PATTriggerProducer.cc b/PhysicsTools/PatAlgos/plugins/PATTriggerProducer.cc index 0f38d54d1a937..8cf8ac3bfc9b6 100644 --- a/PhysicsTools/PatAlgos/plugins/PATTriggerProducer.cc +++ b/PhysicsTools/PatAlgos/plugins/PATTriggerProducer.cc @@ -31,6 +31,8 @@ #include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "L1Trigger/GlobalTriggerAnalyzer/interface/L1GtUtils.h" + using namespace pat; using namespace edm; @@ -39,8 +41,6 @@ using namespace edm; const unsigned L1GlobalTriggerReadoutSetup::NumberPhysTriggers; const unsigned L1GlobalTriggerReadoutSetup::NumberPhysTriggersExtended; const unsigned L1GlobalTriggerReadoutSetup::NumberTechnicalTriggers; -static const bool useL1EventSetup( true ); -static const bool useL1GtTriggerMenuLite( false ); PATTriggerProducer::PATTriggerProducer( const ParameterSet & iConfig ) : @@ -69,7 +69,7 @@ PATTriggerProducer::PATTriggerProducer( const ParameterSet & iConfig ) : autoProcessNameL1ExtraHTM_( false ), mainBxOnly_( true ), saveL1Refs_( false ), - // HLTConfigProvider + hltPrescaleProvider_(iConfig, consumesCollector(), *this), hltConfigInit_( false ), // HLT configuration parameters tagTriggerResults_( "TriggerResults" ), @@ -258,15 +258,16 @@ void PATTriggerProducer::beginRun(const Run & iRun, const EventSetup & iSetup ) if ( autoProcessNameL1ExtraHTM_ ) tagL1ExtraHTM_ = InputTag( tagL1ExtraHTM_.label() , tagL1ExtraHTM_.instance() , nameProcess_ ); // Initialize HLTConfigProvider + HLTConfigProvider const& hltConfig = hltPrescaleProvider_.hltConfigProvider(); bool changed( true ); - if ( ! hltConfig_.init( iRun, iSetup, nameProcess_, changed ) ) { + if ( ! hltPrescaleProvider_.init( iRun, iSetup, nameProcess_, changed ) ) { LogError( "hltConfig" ) << "HLT config extraction error with process name '" << nameProcess_ << "'"; - } else if ( hltConfig_.size() <= 0 ) { + } else if ( hltConfig.size() <= 0 ) { LogError( "hltConfig" ) << "HLT config size error"; } else hltConfigInit_ = true; // Update mapping from filter names to path names - if (hltConfigInit_ && changed) moduleLabelToPathAndFlags_.init( hltConfig_ ); + if (hltConfigInit_ && changed) moduleLabelToPathAndFlags_.init( hltConfig ); // Extract pre-scales if ( hltConfigInit_ ) { @@ -319,6 +320,7 @@ void PATTriggerProducer::produce( Event& iEvent, const EventSetup& iSetup ) std::auto_ptr< PackedTriggerPrescales > packedPrescales; // HLT + HLTConfigProvider const& hltConfig = hltPrescaleProvider_.hltConfigProvider(); // Get and check HLT event data Handle< trigger::TriggerEvent > handleTriggerEvent; @@ -359,9 +361,9 @@ void PATTriggerProducer::produce( Event& iEvent, const EventSetup& iSetup ) LogWarning( "hltPrescaleInputTag" ) << "HLTPrescaleTable product with label '" << labelHltPrescaleTable_ << "' not found in process" << nameProcess_ << "\n" << "Using default from event setup"; } - if ( hltConfig_.prescaleSize() > 0 ) { - if ( hltConfig_.prescaleSet( iEvent, iSetup ) != -1 ) { - hltPrescaleTable = trigger::HLTPrescaleTable( hltConfig_.prescaleSet( iEvent, iSetup ), hltConfig_.prescaleLabels(), hltConfig_.prescaleTable() ); + if ( hltConfig.prescaleSize() > 0 ) { + if ( hltPrescaleProvider_.prescaleSet( iEvent, iSetup ) != -1 ) { + hltPrescaleTable = trigger::HLTPrescaleTable( hltPrescaleProvider_.prescaleSet( iEvent, iSetup ), hltConfig.prescaleLabels(), hltConfig.prescaleTable() ); LogDebug( "hltPrescaleTable" ) << "HLT prescale table found in event setup"; } else { LogWarning( "hltPrescaleSet" ) << "HLTPrescaleTable from event setup has error"; @@ -391,7 +393,7 @@ void PATTriggerProducer::produce( Event& iEvent, const EventSetup& iSetup ) } } - const unsigned sizePaths( hltConfig_.size() ); + const unsigned sizePaths( hltConfig.size() ); const unsigned sizeFilters( handleTriggerEvent->sizeFilters() ); const unsigned sizeObjects( handleTriggerEvent->sizeObjects() ); @@ -400,27 +402,27 @@ void PATTriggerProducer::produce( Event& iEvent, const EventSetup& iSetup ) if ( ! onlyStandAlone_ ) { std::auto_ptr< TriggerPathCollection > triggerPaths( new TriggerPathCollection() ); triggerPaths->reserve( sizePaths ); - const std::vector<std::string> & pathNames = hltConfig_.triggerNames(); + const std::vector<std::string> & pathNames = hltConfig.triggerNames(); for ( size_t indexPath = 0; indexPath < sizePaths; ++indexPath ) { const std::string & namePath = pathNames.at( indexPath ); unsigned indexLastFilterPathModules( handleTriggerResults->index( indexPath ) + 1 ); unsigned indexLastFilterFilters( sizeFilters ); while ( indexLastFilterPathModules > 0 ) { --indexLastFilterPathModules; - const std::string & labelLastFilterPathModules( hltConfig_.moduleLabel( indexPath, indexLastFilterPathModules ) ); + const std::string & labelLastFilterPathModules( hltConfig.moduleLabel( indexPath, indexLastFilterPathModules ) ); indexLastFilterFilters = handleTriggerEvent->filterIndex( InputTag( labelLastFilterPathModules, "", nameProcess_ ) ); if ( indexLastFilterFilters < sizeFilters ) { - if ( hltConfig_.moduleType( labelLastFilterPathModules ) == "HLTBool" ) continue; + if ( hltConfig.moduleType( labelLastFilterPathModules ) == "HLTBool" ) continue; break; } } - TriggerPath triggerPath( namePath, indexPath, hltConfig_.prescaleValue( set, namePath ), handleTriggerResults->wasrun( indexPath ), handleTriggerResults->accept( indexPath ), handleTriggerResults->error( indexPath ), indexLastFilterPathModules, hltConfig_.saveTagsModules( namePath ).size() ); + TriggerPath triggerPath( namePath, indexPath, hltConfig.prescaleValue( set, namePath ), handleTriggerResults->wasrun( indexPath ), handleTriggerResults->accept( indexPath ), handleTriggerResults->error( indexPath ), indexLastFilterPathModules, hltConfig.saveTagsModules( namePath ).size() ); // add module names to path and states' map - const unsigned sizeModulesPath( hltConfig_.size( indexPath ) ); + const unsigned sizeModulesPath( hltConfig.size( indexPath ) ); assert( indexLastFilterPathModules < sizeModulesPath ); std::map< unsigned, std::string > indicesModules; for ( size_t iM = 0; iM < sizeModulesPath; ++iM ) { - const std::string nameModule( hltConfig_.moduleLabel( indexPath, iM ) ); + const std::string nameModule( hltConfig.moduleLabel( indexPath, iM ) ); if ( addPathModuleLabels_ ) { triggerPath.addModule( nameModule ); } @@ -428,11 +430,11 @@ void PATTriggerProducer::produce( Event& iEvent, const EventSetup& iSetup ) if ( indexFilter < sizeFilters ) { triggerPath.addFilterIndex( indexFilter ); } - const unsigned slotModule( hltConfig_.moduleIndex( indexPath, nameModule ) ); + const unsigned slotModule( hltConfig.moduleIndex( indexPath, nameModule ) ); indicesModules.insert( std::pair< unsigned, std::string >( slotModule, nameModule ) ); } // add L1 seeds - const L1SeedCollection l1Seeds( hltConfig_.hltL1GTSeeds( namePath ) ); + const L1SeedCollection l1Seeds( hltConfig.hltL1GTSeeds( namePath ) ); for ( L1SeedCollection::const_iterator iSeed = l1Seeds.begin(); iSeed != l1Seeds.end(); ++iSeed ) { triggerPath.addL1Seed( *iSeed ); } @@ -529,9 +531,9 @@ void PATTriggerProducer::produce( Event& iEvent, const EventSetup& iSetup ) const trigger::Vids & types = handleTriggerEvent->filterIds( iF ); // not cached TriggerFilter triggerFilter( nameFilter ); // set filter type - const std::string typeFilter( hltConfig_.moduleType( nameFilter ) ); + const std::string typeFilter( hltConfig.moduleType( nameFilter ) ); triggerFilter.setType( typeFilter ); - triggerFilter.setSaveTags( hltConfig_.saveTags( nameFilter ) ); + triggerFilter.setSaveTags( hltConfig.saveTags( nameFilter ) ); // set keys and trigger object types of used objects for ( size_t iK = 0; iK < keys.size(); ++iK ) { // identical to types.size() // check, if current object is excluded @@ -564,7 +566,7 @@ void PATTriggerProducer::produce( Event& iEvent, const EventSetup& iSetup ) packedPrescales.reset(new PackedTriggerPrescales(handleTriggerResults)); const edm::TriggerNames & names = iEvent.triggerNames(*handleTriggerResults); for (unsigned int i = 0, n = names.size(); i < n; ++i) { - packedPrescales->addPrescaledTrigger(i, hltConfig_.prescaleValue(set, names.triggerName(i))); + packedPrescales->addPrescaledTrigger(i, hltConfig.prescaleValue(set, names.triggerName(i))); } iEvent.put( packedPrescales ); } @@ -796,7 +798,7 @@ void PATTriggerProducer::produce( Event& iEvent, const EventSetup& iSetup ) mapObjectTypes.insert( std::make_pair( ETM , trigger::TriggerL1ETM ) ); mapObjectTypes.insert( std::make_pair( HTM , trigger::TriggerL1HTM ) ); // get and cache L1 menu - l1GtUtils_.getL1GtRunCache( iEvent, iSetup, useL1EventSetup, useL1GtTriggerMenuLite ); + L1GtUtils const& l1GtUtils = hltPrescaleProvider_.l1GtUtils(); ESHandle< L1GtTriggerMenu > handleL1GtTriggerMenu; iSetup.get< L1GtTriggerMenuRcd >().get( handleL1GtTriggerMenu ); L1GtTriggerMenu l1GtTriggerMenu( *handleL1GtTriggerMenu ); @@ -839,7 +841,7 @@ void PATTriggerProducer::produce( Event& iEvent, const EventSetup& iSetup ) } L1GtUtils::TriggerCategory category; int bit; - if ( ! l1GtUtils_.l1AlgoTechTrigBitNumber( algoName, category, bit ) ) { + if ( ! l1GtUtils.l1AlgoTechTrigBitNumber( algoName, category, bit ) ) { LogError( "l1Algo" ) << "L1 physics algorithm '" << algoName << "' not found in the L1 menu\n" << "Skipping"; continue; @@ -853,7 +855,7 @@ void PATTriggerProducer::produce( Event& iEvent, const EventSetup& iSetup ) bool decisionAfterMask; int prescale; int mask; - int error( l1GtUtils_.l1Results( iEvent, algoName, decisionBeforeMask, decisionAfterMask, prescale, mask ) ); + int error( l1GtUtils.l1Results( iEvent, algoName, decisionBeforeMask, decisionAfterMask, prescale, mask ) ); if ( error ) { LogError( "l1Algo" ) << "L1 physics algorithm '" << algoName << "' decision has error code " << error << " from 'L1GtUtils'\n" << "Skipping"; @@ -963,7 +965,7 @@ void PATTriggerProducer::produce( Event& iEvent, const EventSetup& iSetup ) } L1GtUtils::TriggerCategory category; int bit; - if ( ! l1GtUtils_.l1AlgoTechTrigBitNumber( algoName, category, bit ) ) { + if ( ! l1GtUtils.l1AlgoTechTrigBitNumber( algoName, category, bit ) ) { LogError( "l1Algo" ) << "L1 technical trigger '" << algoName << "' not found in the L1 menu\n" << "Skipping"; continue; @@ -977,7 +979,7 @@ void PATTriggerProducer::produce( Event& iEvent, const EventSetup& iSetup ) bool decisionAfterMask; int prescale; int mask; - int error( l1GtUtils_.l1Results( iEvent, algoName, decisionBeforeMask, decisionAfterMask, prescale, mask ) ); + int error( l1GtUtils.l1Results( iEvent, algoName, decisionBeforeMask, decisionAfterMask, prescale, mask ) ); if ( error ) { LogError( "l1Algo" ) << "L1 technical trigger '" << algoName << "' decision has error code " << error << " from 'L1GtUtils'\n" << "Skipping"; @@ -1008,22 +1010,22 @@ void PATTriggerProducer::produce( Event& iEvent, const EventSetup& iSetup ) } -void PATTriggerProducer::ModuleLabelToPathAndFlags::init(const HLTConfigProvider &hltConfig_) { +void PATTriggerProducer::ModuleLabelToPathAndFlags::init(const HLTConfigProvider &hltConfig) { clear(); - const std::vector<std::string> & pathNames = hltConfig_.triggerNames(); + const std::vector<std::string> & pathNames = hltConfig.triggerNames(); unsigned int sizePaths = pathNames.size(); for ( unsigned int indexPath = 0; indexPath < sizePaths; ++indexPath ) { const std::string & namePath = pathNames[indexPath]; - const std::vector<std::string> & nameModules = hltConfig_.moduleLabels(indexPath); + const std::vector<std::string> & nameModules = hltConfig.moduleLabels(indexPath); unsigned int sizeModulesPath = nameModules.size(); bool lastFilter = true; unsigned int iM = sizeModulesPath; while (iM > 0) { const std::string & nameFilter = nameModules[--iM]; - if (hltConfig_.moduleEDMType(nameFilter) != "EDFilter") continue; - if (hltConfig_.moduleType(nameFilter) == "HLTBool") continue; - bool saveTags = hltConfig_.saveTags(nameFilter); + if (hltConfig.moduleEDMType(nameFilter) != "EDFilter") continue; + if (hltConfig.moduleType(nameFilter) == "HLTBool") continue; + bool saveTags = hltConfig.saveTags(nameFilter); insert( nameFilter, namePath, indexPath, lastFilter, saveTags ); if (saveTags) lastFilter = false; // FIXME: rather always? } diff --git a/PhysicsTools/PatAlgos/plugins/PATTriggerProducer.h b/PhysicsTools/PatAlgos/plugins/PATTriggerProducer.h index 16baa4956d90f..899116e7b3b64 100644 --- a/PhysicsTools/PatAlgos/plugins/PATTriggerProducer.h +++ b/PhysicsTools/PatAlgos/plugins/PATTriggerProducer.h @@ -45,7 +45,7 @@ #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/Utilities/interface/InputTag.h" -#include "L1Trigger/GlobalTriggerAnalyzer/interface/L1GtUtils.h" +#include "HLTrigger/HLTcore/interface/HLTPrescaleProvider.h" #include "HLTrigger/HLTcore/interface/HLTConfigProvider.h" #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerObjectMaps.h" @@ -73,7 +73,6 @@ namespace pat { bool onlyStandAlone_; // configuration bool firstInRun_; // L1 - L1GtUtils l1GtUtils_; edm::ParameterSet * l1PSet_; bool addL1Algos_; // configuration (optional with default) edm::InputTag tagL1GlobalTriggerObjectMaps_; // configuration (optional with default) @@ -105,7 +104,7 @@ namespace pat { bool mainBxOnly_; // configuration (optional with default) bool saveL1Refs_; // configuration (optional with default) // HLT - HLTConfigProvider hltConfig_; + HLTPrescaleProvider hltPrescaleProvider_; bool hltConfigInit_; edm::InputTag tagTriggerResults_; // configuration (optional with default) edm::GetterOfProducts< edm::TriggerResults > triggerResultsGetter_; @@ -133,7 +132,7 @@ namespace pat { bool lastFilter; bool l3Filter; }; - void init(const HLTConfigProvider &conf) ; + void init(const HLTConfigProvider &) ; void clear() { map_.clear(); } const std::vector<PathAndFlags> & operator[](const std::string & filter) const { std::map<std::string,std::vector<PathAndFlags> >::const_iterator it = map_.find(filter); diff --git a/Validation/RecoTau/src/TauTagValidation.cc b/Validation/RecoTau/src/TauTagValidation.cc index fe29f3d9b2001..64f4ff14ea562 100644 --- a/Validation/RecoTau/src/TauTagValidation.cc +++ b/Validation/RecoTau/src/TauTagValidation.cc @@ -59,7 +59,7 @@ TauTagValidation::TauTagValidation(const edm::ParameterSet& iConfig): { turnOnTrigger_ = iConfig.exists("turnOnTrigger") && iConfig.getParameter<bool>("turnOnTrigger"); - genericTriggerEventFlag_ = (iConfig.exists("GenericTriggerSelection") && turnOnTrigger_) ? new GenericTriggerEventFlag(iConfig.getParameter<edm::ParameterSet>("GenericTriggerSelection"), consumesCollector()) : NULL; + genericTriggerEventFlag_ = (iConfig.exists("GenericTriggerSelection") && turnOnTrigger_) ? new GenericTriggerEventFlag(iConfig.getParameter<edm::ParameterSet>("GenericTriggerSelection"), consumesCollector(), *this) : NULL; if(genericTriggerEventFlag_ != NULL) LogDebug(moduleLabel_) <<"--> GenericTriggerSelection parameters found in "<<moduleLabel_<<"."<<std::endl;//move to LogDebug else LogDebug(moduleLabel_) <<"--> GenericTriggerSelection not found in "<<moduleLabel_<<"."<<std::endl;//move to LogDebug to keep track of modules that fail and pass diff --git a/Validation/RecoVertex/src/AnotherPrimaryVertexAnalyzer.cc b/Validation/RecoVertex/src/AnotherPrimaryVertexAnalyzer.cc index 20cf2128e79e4..261faa0512c61 100644 --- a/Validation/RecoVertex/src/AnotherPrimaryVertexAnalyzer.cc +++ b/Validation/RecoVertex/src/AnotherPrimaryVertexAnalyzer.cc @@ -68,7 +68,7 @@ class AnotherPrimaryVertexAnalyzer : public edm::EDAnalyzer { edm::EDGetTokenT<reco::VertexCollection> _recoVertexCollectionToken; bool _firstOnly; - PrescaleWeightProvider* _weightprov; + std::unique_ptr<PrescaleWeightProvider> _weightprov; }; // @@ -87,7 +87,7 @@ AnotherPrimaryVertexAnalyzer::AnotherPrimaryVertexAnalyzer(const edm::ParameterS , _recoVertexCollectionToken(consumes<reco::VertexCollection>(iConfig.getParameter<edm::InputTag>("pvCollection"))) , _firstOnly(iConfig.getUntrackedParameter<bool>("firstOnly",false)) , _weightprov(iConfig.getParameter<bool>("usePrescaleWeight") - ? new PrescaleWeightProvider(iConfig.getParameter<edm::ParameterSet>("prescaleWeightProviderPSet"), consumesCollector()) + ? new PrescaleWeightProvider(iConfig.getParameter<edm::ParameterSet>("prescaleWeightProviderPSet"), consumesCollector(), *this) : 0 ) { @@ -102,12 +102,6 @@ AnotherPrimaryVertexAnalyzer::AnotherPrimaryVertexAnalyzer(const edm::ParameterS AnotherPrimaryVertexAnalyzer::~AnotherPrimaryVertexAnalyzer() { - - // do anything here that needs to be done at desctruction time - // (e.g. close files, deallocate resources etc.) - - delete _weightprov; - } From c77eab6c7ca4fe93830ad5ed1d2279c3548dc0c4 Mon Sep 17 00:00:00 2001 From: "W. David Dagenhart" <wdd@fnal.gov> Date: Thu, 7 May 2015 15:49:56 -0500 Subject: [PATCH 05/26] Consumes migration for L1GtUtils An earlier commit added the consumes calls for L1GtUtils. This commit modifies the things that depend on L1GtUtils so that they still work with the modified L1GtUtils. --- .../src/PrescaleWeightProvider.cc | 3 ++- .../Skims/interface/TriggerMatchProducer.h | 4 ++-- .../Skims/src/TriggerMatchProducer.icc | 18 +++++++++++------- .../interface/L1GtTriggerMenuTester.h | 1 + .../interface/TriggerCandProducer.h | 4 ++-- .../TagAndProbe/src/TriggerCandProducer.icc | 19 ++++++++++++------- 6 files changed, 30 insertions(+), 19 deletions(-) diff --git a/CommonTools/TriggerUtils/src/PrescaleWeightProvider.cc b/CommonTools/TriggerUtils/src/PrescaleWeightProvider.cc index 681c48a08289f..46c5faf2a33dd 100644 --- a/CommonTools/TriggerUtils/src/PrescaleWeightProvider.cc +++ b/CommonTools/TriggerUtils/src/PrescaleWeightProvider.cc @@ -18,7 +18,8 @@ PrescaleWeightProvider::PrescaleWeightProvider( const edm::ParameterSet & config, edm::ConsumesCollector & iC ) // default values -: verbosity_( 0 ) +: init_(false) +, verbosity_( 0 ) , triggerResultsTag_( "TriggerResults::HLT" ) , triggerResultsToken_( iC.mayConsume< edm::TriggerResults >( triggerResultsTag_ ) ) , l1GtTriggerMenuLiteTag_( "l1GtTriggerMenuLite" ) diff --git a/DPGAnalysis/Skims/interface/TriggerMatchProducer.h b/DPGAnalysis/Skims/interface/TriggerMatchProducer.h index 3c960c9c0d4c6..817d037994e45 100644 --- a/DPGAnalysis/Skims/interface/TriggerMatchProducer.h +++ b/DPGAnalysis/Skims/interface/TriggerMatchProducer.h @@ -10,7 +10,7 @@ #include "FWCore/Framework/interface/Event.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "DataFormats/Candidate/interface/ShallowCloneCandidate.h" -#include "HLTrigger/HLTcore/interface/HLTConfigProvider.h" +#include "HLTrigger/HLTcore/interface/HLTPrescaleProvider.h" #include "DataFormats/HLTReco/interface/TriggerObject.h" #include "DataFormats/Common/interface/TriggerResults.h" @@ -47,7 +47,7 @@ class TriggerMatchProducer : public edm::EDProducer // bool isFilter_; // bool printIndex_; bool changed_; - HLTConfigProvider hltConfig_; + HLTPrescaleProvider hltPrescaleProvider_; }; #include "DPGAnalysis/Skims/src/TriggerMatchProducer.icc" #endif diff --git a/DPGAnalysis/Skims/src/TriggerMatchProducer.icc b/DPGAnalysis/Skims/src/TriggerMatchProducer.icc index 88b54758b36f3..3b03ba82c4a4e 100644 --- a/DPGAnalysis/Skims/src/TriggerMatchProducer.icc +++ b/DPGAnalysis/Skims/src/TriggerMatchProducer.icc @@ -3,6 +3,7 @@ #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/ServiceRegistry/interface/Service.h" #include "FWCore/Framework/interface/MakerMacros.h" +#include "HLTrigger/HLTcore/interface/HLTConfigProvider.h" #include <string> #include <TString.h> @@ -10,7 +11,8 @@ template<class object > -TriggerMatchProducer<object>::TriggerMatchProducer(const edm::ParameterSet& iConfig ) +TriggerMatchProducer<object>::TriggerMatchProducer(const edm::ParameterSet& iConfig ) : + hltPrescaleProvider_(iConfig, consumesCollector(), *this) { _inputProducer= iConfig.template getParameter<edm::InputTag>("InputProducer"); @@ -66,6 +68,7 @@ void TriggerMatchProducer<object>::produce(edm::Event &event, const edm::EventSe using namespace reco; using namespace trigger; + HLTConfigProvider const& hltConfig = hltPrescaleProvider_.hltConfigProvider(); // Create the output collection std::auto_ptr< edm::RefToBaseVector<object> > @@ -94,7 +97,7 @@ void TriggerMatchProducer<object>::produce(edm::Event &event, const edm::EventSe event.getByToken(triggerResultsToken_, pTrgResults); //gracefully choose the single appropriate HLT path from the list of desired paths - std::vector<std::string> activeHLTPathsInThisEvent = hltConfig_.triggerNames(); + std::vector<std::string> activeHLTPathsInThisEvent = hltConfig.triggerNames(); std::map<std::string, bool> triggerInMenu; std::map<std::string, bool> triggerUnprescaled; // for (std::vector<edm::InputTag>::const_iterator iMyHLT = hltTags_.begin(); @@ -112,7 +115,7 @@ void TriggerMatchProducer<object>::produce(edm::Event &event, const edm::EventSe if (TString(*iHLT).Contains(TRegexp(hltTag_))) { triggerInMenu[*iHLT] = true; - if (hltConfig_.prescaleValue(event, eventSetup, *iHLT) == 1) + if (hltPrescaleProvider_.prescaleValue(event, eventSetup, *iHLT) == 1) triggerUnprescaled[*iHLT] = true; } } @@ -148,8 +151,8 @@ void TriggerMatchProducer<object>::produce(edm::Event &event, const edm::EventSe int triggerIndex=-1; edm::InputTag filterTag; try { - filters = hltConfig_.moduleLabels( iMyHLT->first ); - triggerIndex = hltConfig_.triggerIndex(iMyHLT->first); + filters = hltConfig.moduleLabels( iMyHLT->first ); + triggerIndex = hltConfig.triggerIndex(iMyHLT->first); } catch (std::exception ex) { cout << "bad trigger\n"; } // Results from TriggerResults product @@ -230,14 +233,15 @@ void TriggerMatchProducer<object>::produce(edm::Event &event, const edm::EventSe template<class object> void TriggerMatchProducer<object>::beginRun(edm::Run const& iRun, edm::EventSetup const& iSetup){ // std::cout << "calling init(" << "iRun" << ", " << "iSetup" << ", " << triggerEventTag_.process() << ", " << "changed_" << ") in beginRun()" << std::endl; - if(!hltConfig_.init(iRun,iSetup,triggerEventTag_.process(),changed_) ){ + if(!hltPrescaleProvider_.init(iRun,iSetup,triggerEventTag_.process(),changed_) ){ edm::LogError("TriggerMatchProducer") << "Error! Can't initialize HLTConfigProvider"; throw cms::Exception("HLTConfigProvider::init() returned non 0"); } +// HLTConfigProvider const& hltConfig = hltPrescaleProvider_.hltConfigProvider(); // if(printIndex_ && changed_) // std::cout << "HLT configuration changed !" << std::endl; -// std::vector<std::string> filters = hltConfig_.moduleLabels( hltTag_.label() ); +// std::vector<std::string> filters = hltConfig.moduleLabels( hltTag_.label() ); } template<class object> diff --git a/L1TriggerConfig/L1GtConfigProducers/interface/L1GtTriggerMenuTester.h b/L1TriggerConfig/L1GtConfigProducers/interface/L1GtTriggerMenuTester.h index d50e66cb0f57d..45e6a7a0965a1 100644 --- a/L1TriggerConfig/L1GtConfigProducers/interface/L1GtTriggerMenuTester.h +++ b/L1TriggerConfig/L1GtConfigProducers/interface/L1GtTriggerMenuTester.h @@ -30,6 +30,7 @@ #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "CondFormats/L1TObjects/interface/L1GtAlgorithm.h" +#include "CondFormats/L1TObjects/interface/L1GtTriggerMenuFwd.h" #include "HLTrigger/HLTcore/interface/HLTConfigProvider.h" diff --git a/PhysicsTools/TagAndProbe/interface/TriggerCandProducer.h b/PhysicsTools/TagAndProbe/interface/TriggerCandProducer.h index b3daff54c782b..db80a85d59423 100644 --- a/PhysicsTools/TagAndProbe/interface/TriggerCandProducer.h +++ b/PhysicsTools/TagAndProbe/interface/TriggerCandProducer.h @@ -10,7 +10,7 @@ #include "FWCore/Framework/interface/Event.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "DataFormats/Candidate/interface/ShallowCloneCandidate.h" -#include "HLTrigger/HLTcore/interface/HLTConfigProvider.h" +#include "HLTrigger/HLTcore/interface/HLTPrescaleProvider.h" #include "PhysicsTools/TagAndProbe/interface/TriggerCandProducer.h" #include "DataFormats/HLTReco/interface/TriggerObject.h" @@ -49,7 +49,7 @@ class TriggerCandProducer : public edm::EDProducer bool isFilter_; bool printIndex_; bool changed_; - HLTConfigProvider hltConfig_; + HLTPrescaleProvider hltPrescaleProvider_; bool skipEvent_; bool matchUnprescaledTriggerOnly_; }; diff --git a/PhysicsTools/TagAndProbe/src/TriggerCandProducer.icc b/PhysicsTools/TagAndProbe/src/TriggerCandProducer.icc index c425d7e109005..cfbfee7c33bb6 100644 --- a/PhysicsTools/TagAndProbe/src/TriggerCandProducer.icc +++ b/PhysicsTools/TagAndProbe/src/TriggerCandProducer.icc @@ -3,10 +3,13 @@ #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/ServiceRegistry/interface/Service.h" #include "FWCore/Framework/interface/MakerMacros.h" +#include "HLTrigger/HLTcore/interface/HLTConfigProvider.h" + #include <string> template<class object > -TriggerCandProducer<object>::TriggerCandProducer(const edm::ParameterSet& iConfig ) +TriggerCandProducer<object>::TriggerCandProducer(const edm::ParameterSet& iConfig ) : + hltPrescaleProvider_(iConfig, consumesCollector(), *this) { _inputProducer = iConfig.template getParameter<edm::InputTag>("InputProducer"); @@ -71,6 +74,8 @@ void TriggerCandProducer<object>::produce(edm::Event &event, const edm::EventSet using namespace reco; using namespace trigger; + HLTConfigProvider const& hltConfig = hltPrescaleProvider_.hltConfigProvider(); + // Create the output collection std::auto_ptr< edm::RefToBaseVector<object> > outColRef( new edm::RefToBaseVector<object> ); @@ -110,7 +115,7 @@ void TriggerCandProducer<object>::produce(edm::Event &event, const edm::EventSet event.getByToken(triggerResultsToken_, pTrgResults); //gracefully choose the single appropriate HLT path from the list of desired paths - std::vector<std::string> activeHLTPathsInThisEvent = hltConfig_.triggerNames(); + std::vector<std::string> activeHLTPathsInThisEvent = hltConfig.triggerNames(); std::map<std::string, bool> triggerInMenu; std::map<std::string, bool> triggerUnprescaled; for (std::vector<edm::InputTag>::const_iterator iMyHLT = hltTags_.begin(); @@ -127,7 +132,7 @@ void TriggerCandProducer<object>::produce(edm::Event &event, const edm::EventSet iMyHLT != hltTags_.end(); ++iMyHLT) { if ((*iMyHLT).label() == *iHLT) { triggerInMenu[(*iMyHLT).label()] = true; - if (hltConfig_.prescaleValue(event, eventSetup, *iHLT) == 1) + if (hltPrescaleProvider_.prescaleValue(event, eventSetup, *iHLT) == 1) triggerUnprescaled[(*iMyHLT).label()] = true; } } @@ -159,7 +164,7 @@ void TriggerCandProducer<object>::produce(edm::Event &event, const edm::EventSet err << "Error: No unprescaled HLT paths in "; err << "run " << event.run() << ", event " << event.id().event() << ", lumi section "; err << event.getLuminosityBlock().luminosityBlock() << std::endl; - err << "Menu name: " << hltConfig_.tableName() << endl; + err << "Menu name: " << hltConfig.tableName() << endl; std::cerr << err.str(); edm::LogError("TriggerCandProducer") << err.str(); throw cms::Exception("GarbageInGarbageOut") << err.str(); @@ -170,7 +175,7 @@ void TriggerCandProducer<object>::produce(edm::Event &event, const edm::EventSet " Multiple HLT paths in "; err << "run " << event.run() << ", event " << event.id().event() << ", lumi section "; err << event.getLuminosityBlock().luminosityBlock() << std::endl; - err << "Menu name: " << hltConfig_.tableName() << endl; + err << "Menu name: " << hltConfig.tableName() << endl; std::cerr << err.str(); edm::LogError("TriggerCandProducer") << err.str(); throw cms::Exception("GarbageInGarbageOut") << err.str(); @@ -209,7 +214,7 @@ void TriggerCandProducer<object>::produce(edm::Event &event, const edm::EventSet } else{ std::vector<std::string> filters; - try { filters = hltConfig_.moduleLabels( theRightHLTTag_.label() ); } + try { filters = hltConfig.moduleLabels( theRightHLTTag_.label() ); } catch (std::exception ex) { cout << "bad trigger\n"; } for(std::vector<std::string>::iterator filter = filters.begin(); filter!= filters.end(); ++filter ) { @@ -314,7 +319,7 @@ void TriggerCandProducer<object>::beginRun(edm::Run const& iRun, edm::EventSetup if (!identical) skipEvent_ = true; //std::cout << "calling init(" << "iRun" << ", " << "iSetup" << ", " << hltTags_[0].process() << ", " << "changed_" << ") in beginRun()" << std::endl; - if(!hltConfig_.init(iRun,iSetup,hltTags_[0].process(),changed_) ){ + if(!hltPrescaleProvider_.init(iRun,iSetup,hltTags_[0].process(),changed_) ){ edm::LogError("TriggerCandProducer") << "Error! Can't initialize HLTConfigProvider"; throw cms::Exception("HLTConfigProvider::init() returned non 0"); From 76027df088db59e11c625ba113249de7cbe61c2a Mon Sep 17 00:00:00 2001 From: "W. David Dagenhart" <wdd@fnal.gov> Date: Fri, 8 May 2015 11:38:03 -0500 Subject: [PATCH 06/26] Consumes migration for L1GtUtils Fix logic in earlier commit (not submitted in a pull request yet). You cannot call getByToken with an uninitialized token. Also pick the first product found instead of the last so we do not declare we consume multiple products (should not make any difference if there is only one). --- .../interface/L1GtUtilsHelper.h | 2 +- .../GlobalTriggerAnalyzer/src/L1GtUtils.cc | 24 ++++++++++++------- .../src/L1GtUtilsHelper.cc | 9 ++++--- 3 files changed, 22 insertions(+), 13 deletions(-) diff --git a/L1Trigger/GlobalTriggerAnalyzer/interface/L1GtUtilsHelper.h b/L1Trigger/GlobalTriggerAnalyzer/interface/L1GtUtilsHelper.h index baf1dae6c7b5a..e2f3c4ffd5eb2 100644 --- a/L1Trigger/GlobalTriggerAnalyzer/interface/L1GtUtilsHelper.h +++ b/L1Trigger/GlobalTriggerAnalyzer/interface/L1GtUtilsHelper.h @@ -6,7 +6,7 @@ * * * Description: Gets tokens for L1GtUtils to use when getting products - * from the Event and Run. This class was introduced to + * from the Event and Run. This class was introduced * when the consumes function calls were added for L1GtUtils. * It preserves the special feature of L1GtUtils that allows * it to run without configuration of InputTags, although it diff --git a/L1Trigger/GlobalTriggerAnalyzer/src/L1GtUtils.cc b/L1Trigger/GlobalTriggerAnalyzer/src/L1GtUtils.cc index ac57c4ae26d91..c3c3a43fc3637 100644 --- a/L1Trigger/GlobalTriggerAnalyzer/src/L1GtUtils.cc +++ b/L1Trigger/GlobalTriggerAnalyzer/src/L1GtUtils.cc @@ -282,7 +282,9 @@ void L1GtUtils::retrieveL1GtTriggerMenuLite(const edm::Run& iRun) { // get L1GtTriggerMenuLite edm::Handle<L1GtTriggerMenuLite> l1GtMenuLite; - iRun.getByToken(m_l1GtUtilsHelper->l1GtTriggerMenuLiteToken(), l1GtMenuLite); + if( !m_l1GtUtilsHelper->l1GtTriggerMenuLiteToken().isUninitialized() ) { + iRun.getByToken(m_l1GtUtilsHelper->l1GtTriggerMenuLiteToken(), l1GtMenuLite); + } if (!l1GtMenuLite.isValid()) { @@ -825,8 +827,9 @@ const int L1GtUtils::l1Results(const edm::Event& iEvent, bool gtReadoutRecordValid = false; edm::Handle<L1GlobalTriggerRecord> gtRecord; - iEvent.getByToken(m_l1GtUtilsHelper->l1GtRecordToken(), gtRecord); - + if( !m_l1GtUtilsHelper->l1GtRecordToken().isUninitialized() ) { + iEvent.getByToken(m_l1GtUtilsHelper->l1GtRecordToken(), gtRecord); + } if (gtRecord.isValid()) { validRecord = true; @@ -840,8 +843,9 @@ const int L1GtUtils::l1Results(const edm::Event& iEvent, } edm::Handle<L1GlobalTriggerReadoutRecord> gtReadoutRecord; - iEvent.getByToken(m_l1GtUtilsHelper->l1GtReadoutRecordToken(), gtReadoutRecord); - + if( !m_l1GtUtilsHelper->l1GtReadoutRecordToken().isUninitialized() ) { + iEvent.getByToken(m_l1GtUtilsHelper->l1GtReadoutRecordToken(), gtReadoutRecord); + } if (gtReadoutRecord.isValid()) { gtReadoutRecordValid = true; @@ -1481,8 +1485,9 @@ const int L1GtUtils::prescaleFactorSetIndex(const edm::Event& iEvent, bool gtReadoutRecordValid = false; edm::Handle<L1GlobalTriggerRecord> gtRecord; - iEvent.getByToken(m_l1GtUtilsHelper->l1GtRecordToken(), gtRecord); - + if( !m_l1GtUtilsHelper->l1GtRecordToken().isUninitialized() ) { + iEvent.getByToken(m_l1GtUtilsHelper->l1GtRecordToken(), gtRecord); + } if (gtRecord.isValid()) { validRecord = true; @@ -1496,8 +1501,9 @@ const int L1GtUtils::prescaleFactorSetIndex(const edm::Event& iEvent, } edm::Handle<L1GlobalTriggerReadoutRecord> gtReadoutRecord; - iEvent.getByToken(m_l1GtUtilsHelper->l1GtReadoutRecordToken(), gtReadoutRecord); - + if( !m_l1GtUtilsHelper->l1GtReadoutRecordToken().isUninitialized() ) { + iEvent.getByToken(m_l1GtUtilsHelper->l1GtReadoutRecordToken(), gtReadoutRecord); + } if (gtReadoutRecord.isValid()) { gtReadoutRecordValid = true; diff --git a/L1Trigger/GlobalTriggerAnalyzer/src/L1GtUtilsHelper.cc b/L1Trigger/GlobalTriggerAnalyzer/src/L1GtUtilsHelper.cc index 27e2f7a354069..128d36f28b74c 100644 --- a/L1Trigger/GlobalTriggerAnalyzer/src/L1GtUtilsHelper.cc +++ b/L1Trigger/GlobalTriggerAnalyzer/src/L1GtUtilsHelper.cc @@ -50,6 +50,7 @@ void L1GtUtilsHelper::operator()(edm::BranchDescription const& branchDescription // arguments to the constructor. if (m_findRecord && + !m_foundRECORecord && branchDescription.unwrappedTypeID() == edm::TypeID(typeid(L1GlobalTriggerRecord)) && branchDescription.branchType() == edm::InEvent) { edm::InputTag tag{branchDescription.moduleLabel(), @@ -59,13 +60,14 @@ void L1GtUtilsHelper::operator()(edm::BranchDescription const& branchDescription m_l1GtRecordInputTag = tag; m_l1GtRecordToken = m_consumesCollector.consumes<L1GlobalTriggerRecord>(tag); m_foundRECORecord = true; - } else if (!m_foundRECORecord) { + } else if (m_l1GtRecordToken.isUninitialized()) { m_l1GtRecordInputTag = tag; m_l1GtRecordToken = m_consumesCollector.consumes<L1GlobalTriggerRecord>(tag); } } if (m_findReadoutRecord && + !m_foundRECOReadoutRecord && branchDescription.unwrappedTypeID() == edm::TypeID(typeid(L1GlobalTriggerReadoutRecord)) && branchDescription.branchType() == edm::InEvent) { edm::InputTag tag{branchDescription.moduleLabel(), @@ -75,13 +77,14 @@ void L1GtUtilsHelper::operator()(edm::BranchDescription const& branchDescription m_l1GtReadoutRecordInputTag = tag; m_l1GtReadoutRecordToken = m_consumesCollector.consumes<L1GlobalTriggerReadoutRecord>(tag); m_foundRECOReadoutRecord = true; - } else if (!m_foundRECOReadoutRecord) { + } else if (m_l1GtReadoutRecordToken.isUninitialized()) { m_l1GtReadoutRecordInputTag = tag; m_l1GtReadoutRecordToken = m_consumesCollector.consumes<L1GlobalTriggerReadoutRecord>(tag); } } if (m_findMenuLite && + !m_foundRECOMenuLite && branchDescription.branchType() == edm::InRun && branchDescription.unwrappedTypeID() == edm::TypeID(typeid(L1GtTriggerMenuLite))) { edm::InputTag tag{branchDescription.moduleLabel(), @@ -91,7 +94,7 @@ void L1GtUtilsHelper::operator()(edm::BranchDescription const& branchDescription m_l1GtTriggerMenuLiteInputTag = tag; m_l1GtTriggerMenuLiteToken = m_consumesCollector.consumes<L1GtTriggerMenuLite,edm::InRun>(tag); m_foundRECOMenuLite = true; - } else if (!m_foundRECOMenuLite) { + } else if (m_l1GtTriggerMenuLiteToken.isUninitialized()) { m_l1GtTriggerMenuLiteInputTag = tag; m_l1GtTriggerMenuLiteToken = m_consumesCollector.consumes<L1GtTriggerMenuLite,edm::InRun>(tag); } From a6683bceef0ca3f98813954ae2f9645c02dfde7c Mon Sep 17 00:00:00 2001 From: "W. David Dagenhart" <wdd@fnal.gov> Date: Tue, 12 May 2015 10:08:09 -0500 Subject: [PATCH 07/26] Consumes migration for L1GtUtils Fix a couple minor problems in earlier commits which were not submitted in a PR yet. --- L1Trigger/GlobalTriggerAnalyzer/interface/L1GtUtils.h | 4 ++++ L1Trigger/GlobalTriggerAnalyzer/src/L1GtAnalyzer.cc | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/L1Trigger/GlobalTriggerAnalyzer/interface/L1GtUtils.h b/L1Trigger/GlobalTriggerAnalyzer/interface/L1GtUtils.h index 68a544d65921c..a7702e716c777 100644 --- a/L1Trigger/GlobalTriggerAnalyzer/interface/L1GtUtils.h +++ b/L1Trigger/GlobalTriggerAnalyzer/interface/L1GtUtils.h @@ -102,6 +102,10 @@ class L1GtUtils { /// destructor virtual ~L1GtUtils(); + static void fillDescription(edm::ParameterSetDescription & desc) { + L1GtUtilsHelper::fillDescription(desc); + } + public: enum TriggerCategory { diff --git a/L1Trigger/GlobalTriggerAnalyzer/src/L1GtAnalyzer.cc b/L1Trigger/GlobalTriggerAnalyzer/src/L1GtAnalyzer.cc index 5046229be6ce1..e4fefb07a16c0 100644 --- a/L1Trigger/GlobalTriggerAnalyzer/src/L1GtAnalyzer.cc +++ b/L1Trigger/GlobalTriggerAnalyzer/src/L1GtAnalyzer.cc @@ -103,14 +103,14 @@ L1GtAnalyzer::L1GtAnalyzer(const edm::ParameterSet& parSet) : m_l1GtUtilsLogicalExpression(parSet.getParameter<std::string>("L1GtUtilsLogicalExpression")), m_l1GtUtilsProv(parSet, consumesCollector(), - m_l1GtUtilsConfiguration == 100000 || m_l1GtUtilsConfiguration == 200000, + m_l1GtUtilsConfiguration == 0 || m_l1GtUtilsConfiguration == 100000, *this, edm::InputTag(), edm::InputTag(), m_l1GtTmLInputTagProv ? edm::InputTag() : m_l1GtTmLInputTag), m_l1GtUtils(parSet, consumesCollector(), - m_l1GtUtilsConfiguration == 100000 || m_l1GtUtilsConfiguration == 200000, + m_l1GtUtilsConfiguration == 0 || m_l1GtUtilsConfiguration == 100000, *this, m_l1GtRecordInputTag, m_l1GtDaqReadoutRecordInputTag, From b881a9d664e987ba98f6b6c7be892962c83de71e Mon Sep 17 00:00:00 2001 From: "W. David Dagenhart" <wdd@fnal.gov> Date: Tue, 12 May 2015 21:52:09 +0200 Subject: [PATCH 08/26] Fix compilation error with EDM_ML_DEBUG ExpressionVariable was failing to compile with the command "scram b USER_CXXFLAGS="-DEDM_ML_DEBUG" because EDGetTokens cannot be printed with operator<< which was happening in a LogDebug print statement. --- PhysicsTools/UtilAlgos/interface/CachingVariable.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PhysicsTools/UtilAlgos/interface/CachingVariable.h b/PhysicsTools/UtilAlgos/interface/CachingVariable.h index c4dcc040b575b..de67e84e10d8f 100644 --- a/PhysicsTools/UtilAlgos/interface/CachingVariable.h +++ b/PhysicsTools/UtilAlgos/interface/CachingVariable.h @@ -394,7 +394,7 @@ class ExpressionVariable : public CachingVariable { edm::Handle<edm::View<Object> > oH; iEvent.getByToken(src_,oH); if (index_>=oH->size()){ - LogDebug(method())<<"fail to get object at index: "<<index_<<" in collection: "<<src_; + LogDebug(method())<<"fail to get object at index: "<<index_<<" in collection: "<<srcTag_; return std::make_pair(false,0); } From 2b861d789092d9e9083b58c4a070ae9cb95725fe Mon Sep 17 00:00:00 2001 From: nhanvtran <nhan.v.tran@gmail.com> Date: Mon, 18 May 2015 16:21:31 -0500 Subject: [PATCH 09/26] update to PUPPI adding eta dependence, some bug fixes, and mechanism for looking at PUPPI diagnostics --- CommonTools/PileupAlgos/interface/PuppiAlgo.h | 11 +- .../PileupAlgos/interface/PuppiContainer.h | 14 +- .../PileupAlgos/plugins/PuppiProducer.cc | 119 ++++-- .../PileupAlgos/plugins/PuppiProducer.h | 3 +- CommonTools/PileupAlgos/python/Puppi_cff.py | 35 +- CommonTools/PileupAlgos/src/PuppiAlgo.cc | 336 ++++++++++------ CommonTools/PileupAlgos/src/PuppiContainer.cc | 377 ++++++++++-------- CommonTools/PileupAlgos/test/testPUMods.py | 12 +- 8 files changed, 562 insertions(+), 345 deletions(-) diff --git a/CommonTools/PileupAlgos/interface/PuppiAlgo.h b/CommonTools/PileupAlgos/interface/PuppiAlgo.h index 05c86f42b9eaa..7aee84160a4f3 100644 --- a/CommonTools/PileupAlgos/interface/PuppiAlgo.h +++ b/CommonTools/PileupAlgos/interface/PuppiAlgo.h @@ -16,6 +16,7 @@ class PuppiAlgo{ void computeMedRMS(const unsigned int &iAlgo,const double &iPVFrac); //Get the Weight double compute(std::vector<double> const &iVals,double iChi2) const; + std::vector<float> alphas(){ return fPups; } //Helpers inline double ptMin() const { return fPtMin; } inline double etaMin() const { return fEtaMin; } @@ -25,6 +26,9 @@ class PuppiAlgo{ inline bool isCharged ( unsigned int iAlgo) const { return fCharged.at(iAlgo); } inline double coneSize ( unsigned int iAlgo) const { return fConeSize.at(iAlgo); } inline double neutralPt (int iNPV) const { return fNeutralPtMin + iNPV * fNeutralPtSlope; } + std::vector<double> fRMS; + std::vector<double> fMedian; + private: unsigned int fNAlgos; @@ -33,6 +37,11 @@ class PuppiAlgo{ float fPtMin ; double fNeutralPtMin; double fNeutralPtSlope; + + double fRMSEtaSF; + double fMedEtaSF; + double fEtaMaxExtrap; + std::vector<float> fPups; std::vector<float> fPupsPV; std::vector<int> fAlgoId; @@ -42,8 +51,6 @@ class PuppiAlgo{ std::vector<double> fConeSize; std::vector<double> fRMSPtMin; std::vector<double> fRMSScaleFactor; - std::vector<double> fRMS; - std::vector<double> fMedian; std::vector<double> fMean; std::vector<int> fNCount; }; diff --git a/CommonTools/PileupAlgos/interface/PuppiContainer.h b/CommonTools/PileupAlgos/interface/PuppiContainer.h index 909e9d9fc82f5..bd9eaebf97a14 100644 --- a/CommonTools/PileupAlgos/interface/PuppiContainer.h +++ b/CommonTools/PileupAlgos/interface/PuppiContainer.h @@ -39,12 +39,20 @@ class PuppiContainer{ void initialize(const std::vector<RecoObj> &iRecoObjects); std::vector<fastjet::PseudoJet> const & pfParticles() const { return fPFParticles; } std::vector<fastjet::PseudoJet> const & pvParticles() const { return fChargedPV; } - std::vector<double> const & puppiWeights() ; + std::vector<double> const & puppiWeights(); + std::vector<double> const & puppiRawAlphas(){ return fRawAlphas; } + std::vector<double> const & puppiAlphas(){ return fVals; } + // const std::vector<double> puppiAlpha () {return fAlpha;} + std::vector<double> const & puppiAlphasMed() {return fAlphaMed;} + std::vector<double> const & puppiAlphasRMS() {return fAlphaRMS;} + + int puppiNAlgos(){ return fNAlgos; } std::vector<fastjet::PseudoJet> const & puppiParticles() const { return fPupParticles;} protected: double goodVar (fastjet::PseudoJet const &iPart,std::vector<fastjet::PseudoJet> const &iParts, int iOpt,double iRCone); void getRMSAvg (int iOpt,std::vector<fastjet::PseudoJet> const &iConstits,std::vector<fastjet::PseudoJet> const &iParticles,std::vector<fastjet::PseudoJet> const &iChargeParticles); + void getRawAlphas (int iOpt,std::vector<fastjet::PseudoJet> const &iConstits,std::vector<fastjet::PseudoJet> const &iParticles,std::vector<fastjet::PseudoJet> const &iChargeParticles); double getChi2FromdZ(double iDZ); int getPuppiId ( float iPt, float iEta); double var_within_R (int iId, const std::vector<fastjet::PseudoJet> & particles, const fastjet::PseudoJet& centre, double R); @@ -55,6 +63,10 @@ class PuppiContainer{ std::vector<fastjet::PseudoJet> fPupParticles; std::vector<double> fWeights; std::vector<double> fVals; + std::vector<double> fRawAlphas; + std::vector<double> fAlphaMed; + std::vector<double> fAlphaRMS; + bool fApplyCHS; bool fUseExp; double fNeutralMinPt; diff --git a/CommonTools/PileupAlgos/plugins/PuppiProducer.cc b/CommonTools/PileupAlgos/plugins/PuppiProducer.cc index 7388a0156d255..f02a3cba3cc41 100644 --- a/CommonTools/PileupAlgos/plugins/PuppiProducer.cc +++ b/CommonTools/PileupAlgos/plugins/PuppiProducer.cc @@ -29,6 +29,7 @@ // ------------------------------------------------------------------------------------------ PuppiProducer::PuppiProducer(const edm::ParameterSet& iConfig) { + fPuppiDiagnostics = iConfig.getParameter<bool>("puppiDiagnostics"); fUseDZ = iConfig.getParameter<bool>("UseDeltaZCut"); fDZCut = iConfig.getParameter<double>("DeltaZCut"); fPuppiContainer = std::unique_ptr<PuppiContainer> ( new PuppiContainer(iConfig) ); @@ -42,10 +43,16 @@ PuppiProducer::PuppiProducer(const edm::ParameterSet& iConfig) { produces<edm::ValueMap<float> > (); produces<edm::ValueMap<LorentzVector> > (); produces< edm::ValueMap<reco::CandidatePtr> >(); - + produces<PFOutputCollection>(); - + if (fPuppiDiagnostics){ + produces<double> ("PuppiNAlgos"); + produces<std::vector<double>> ("PuppiRawAlphas"); + produces<std::vector<double>> ("PuppiAlphas"); + produces<std::vector<double>> ("PuppiAlphasMed"); + produces<std::vector<double>> ("PuppiAlphasRms"); + } } // ------------------------------------------------------------------------------------------ PuppiProducer::~PuppiProducer(){ @@ -78,51 +85,53 @@ void PuppiProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { int pVtxId = -9999; bool lFirst = true; const pat::PackedCandidate *lPack = dynamic_cast<const pat::PackedCandidate*>(&(*itPF)); - if(lPack == 0 ) { + if(lPack == 0 ) { const reco::PFCandidate *pPF = dynamic_cast<const reco::PFCandidate*>(&(*itPF)); for(reco::VertexCollection::const_iterator iV = pvCol->begin(); iV!=pvCol->end(); ++iV) { - if(lFirst) { - if ( pPF->trackRef().isNonnull() ) pDZ = pPF->trackRef() ->dz(iV->position()); - else if ( pPF->gsfTrackRef().isNonnull() ) pDZ = pPF->gsfTrackRef()->dz(iV->position()); - if ( pPF->trackRef().isNonnull() ) pD0 = pPF->trackRef() ->d0(); - else if ( pPF->gsfTrackRef().isNonnull() ) pD0 = pPF->gsfTrackRef()->d0(); - lFirst = false; - if(pDZ > -9999) pVtxId = 0; - } - if(iV->trackWeight(pPF->trackRef())>0) { - closestVtx = &(*iV); - break; - } - pVtxId++; + if(lFirst) { + if ( pPF->trackRef().isNonnull() ) pDZ = pPF->trackRef() ->dz(iV->position()); + else if ( pPF->gsfTrackRef().isNonnull() ) pDZ = pPF->gsfTrackRef()->dz(iV->position()); + if ( pPF->trackRef().isNonnull() ) pD0 = pPF->trackRef() ->d0(); + else if ( pPF->gsfTrackRef().isNonnull() ) pD0 = pPF->gsfTrackRef()->d0(); + lFirst = false; + if(pDZ > -9999) pVtxId = 0; + } + if(iV->trackWeight(pPF->trackRef())>0) { + closestVtx = &(*iV); + break; + } + pVtxId++; } } else if(lPack->vertexRef().isNonnull() ) { - pDZ = lPack->dz(); - pD0 = lPack->dxy(); - closestVtx = &(*(lPack->vertexRef())); - pVtxId = (lPack->fromPV() != (pat::PackedCandidate::PVUsedInFit)); - if( (lPack->fromPV() == pat::PackedCandidate::PVLoose) || - (lPack->fromPV() == pat::PackedCandidate::PVTight) ) - closestVtx = 0; + pDZ = lPack->dz(); + pD0 = lPack->dxy(); + closestVtx = &(*(lPack->vertexRef())); + pVtxId = (lPack->fromPV() != (pat::PackedCandidate::PVUsedInFit)); + if( (lPack->fromPV() == pat::PackedCandidate::PVLoose) || (lPack->fromPV() == pat::PackedCandidate::PVTight) ){ + pVtxId = 0; + } } - pReco.dZ = pDZ; - pReco.d0 = pD0; - - if(closestVtx == 0) pReco.vtxId = -1; - if(closestVtx != 0) pReco.vtxId = pVtxId; - //if(closestVtx != 0) pReco.vtxChi2 = closestVtx->trackWeight(itPF->trackRef()); - //Set the id for Puppi Algo: 0 is neutral pfCandidate, id = 1 for particles coming from PV and id = 2 for charged particles from non-leading vertex - pReco.id = 0; - - if(closestVtx != 0 && pVtxId == 0 && fabs(pReco.charge) > 0) pReco.id = 1; - if(closestVtx != 0 && pVtxId > 0 && fabs(pReco.charge) > 0) pReco.id = 2; - //Add a dZ cut if wanted (this helps) - if(fUseDZ && pDZ > -9999 && closestVtx == 0 && (fabs(pDZ) < fDZCut) && fabs(pReco.charge) > 0) pReco.id = 1; - if(fUseDZ && pDZ > -9999 && closestVtx == 0 && (fabs(pDZ) > fDZCut) && fabs(pReco.charge) > 0) pReco.id = 2; - - //std::cout << "pVtxId = " << pVtxId << ", and charge = " << itPF->charge() << ", and closestVtx = " << closestVtx << ", and id = " << pReco.id << std::endl; + pReco.dZ = pDZ; + pReco.d0 = pD0; + + if(closestVtx == 0) pReco.vtxId = -1; + if(closestVtx != 0) pReco.vtxId = pVtxId; + //if(closestVtx != 0) pReco.vtxChi2 = closestVtx->trackWeight(itPF->trackRef()); + //Set the id for Puppi Algo: 0 is neutral pfCandidate, id = 1 for particles coming from PV and id = 2 for charged particles from non-leading vertex + pReco.id = 0; + + if(closestVtx != 0 && pVtxId == 0 && fabs(pReco.charge) > 0) pReco.id = 1; + if(closestVtx != 0 && pVtxId > 0 && fabs(pReco.charge) > 0) pReco.id = 2; + //Add a dZ cut if wanted (this helps) + if(fUseDZ && pDZ > -9999 && closestVtx == 0 && (fabs(pDZ) < fDZCut) && fabs(pReco.charge) > 0) pReco.id = 1; + if(fUseDZ && pDZ > -9999 && closestVtx == 0 && (fabs(pDZ) > fDZCut) && fabs(pReco.charge) > 0) pReco.id = 2; + + //std::cout << "pVtxId = " << pVtxId << ", and charge = " << itPF->charge() << ", and closestVtx = " << closestVtx << ", and id = " << pReco.id << std::endl; + //std::cout << "charge = " << itPF->charge() << ", pDZ = " << pDZ << ", pVtxId = " << pVtxId << ", closestVtx = " << closestVtx << ", fromPV() = " << lPack->fromPV() << ", pReco.id = " << pReco.id << std::endl; - fRecoObjCollection.push_back(pReco); + fRecoObjCollection.push_back(pReco); } + fPuppiContainer->initialize(fRecoObjCollection); //Compute the weights @@ -133,7 +142,6 @@ void PuppiProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { lPupFiller.insert(hPFProduct,lWeights.begin(),lWeights.end()); lPupFiller.fill(); - // This is a dummy to access the "translate" method which is a // non-static member function even though it doesn't need to be. // Will fix in the future. @@ -191,6 +199,35 @@ void PuppiProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { filler.insert(hPFProduct, values.begin(), values.end()); filler.fill(); iEvent.put(pfMap_p); + + + ////////////////////////////////////////////// + if (fPuppiDiagnostics){ + const std::vector<double> lAlphas = fPuppiContainer->puppiAlphas(); + const std::vector<double> lAlphasMed = fPuppiContainer->puppiAlphasMed(); + const std::vector<double> lAlphasRms = fPuppiContainer->puppiAlphasRMS(); + const std::vector<double> lRawAlphas = fPuppiContainer->puppiRawAlphas(); + double lNAlgos = (double) fPuppiContainer->puppiNAlgos(); + + // all the different alphas per particle + std::auto_ptr<std::vector<double> > alphas(new std::vector<double>); + for (unsigned int i = 0; i < lRawAlphas.size(); i++){ + alphas->push_back( lRawAlphas[i] ); + } + // THE alpha per particle + std::auto_ptr<std::vector<double> > theAlphas(new std::vector<double>); + std::auto_ptr<std::vector<double> > theAlphasMed(new std::vector<double>); + std::auto_ptr<std::vector<double> > theAlphasRms(new std::vector<double>); + for (unsigned int i = 0; i < lAlphas.size(); i++){ theAlphas->push_back( lAlphas[i] ); } + for (unsigned int i = 0; i < lAlphasMed.size(); i++){ theAlphasMed->push_back( lAlphasMed[i] ); } + for (unsigned int i = 0; i < lAlphasRms.size(); i++){ theAlphasRms->push_back( lAlphasRms[i] ); } + std::auto_ptr<double> nalgos(new double(lNAlgos)); + iEvent.put(alphas,"PuppiRawAlphas"); + iEvent.put(nalgos,"PuppiNAlgos"); + iEvent.put(theAlphas,"PuppiAlphas"); + iEvent.put(theAlphasMed,"PuppiAlphasMed"); + iEvent.put(theAlphasRms,"PuppiAlphasRms"); + } } diff --git a/CommonTools/PileupAlgos/plugins/PuppiProducer.h b/CommonTools/PileupAlgos/plugins/PuppiProducer.h index 7252f6e2bad2b..1c7913cd2bb90 100644 --- a/CommonTools/PileupAlgos/plugins/PuppiProducer.h +++ b/CommonTools/PileupAlgos/plugins/PuppiProducer.h @@ -46,8 +46,9 @@ class PuppiProducer : public edm::stream::EDProducer<> { std::string fPuppiName; std::string fPFName; std::string fPVName; + bool fPuppiDiagnostics; bool fUseDZ; - float fDZCut; + float fDZCut; std::unique_ptr<PuppiContainer> fPuppiContainer; std::vector<RecoObj> fRecoObjCollection; std::auto_ptr< PFOutputCollection > fPuppiCandidates; diff --git a/CommonTools/PileupAlgos/python/Puppi_cff.py b/CommonTools/PileupAlgos/python/Puppi_cff.py index 0e04d19a5f9aa..8da828cb2cf28 100644 --- a/CommonTools/PileupAlgos/python/Puppi_cff.py +++ b/CommonTools/PileupAlgos/python/Puppi_cff.py @@ -19,13 +19,14 @@ applyLowPUCorr = cms.bool(True), combOpt = cms.int32(0), cone = cms.double(0.3), - rmsPtMin = cms.double(0.5), + rmsPtMin = cms.double(0.1), rmsScaleFactor = cms.double(1.0) ) ) puppi = cms.EDProducer("PuppiProducer",#cms.PSet(#"PuppiProducer", - UseDeltaZCut = cms.bool (False), + puppiDiagnostics = cms.bool(False), + UseDeltaZCut = cms.bool(False), DeltaZCut = cms.double(0.3), candName = cms.InputTag('particleFlow'), vertexName = cms.InputTag('offlinePrimaryVertices'), @@ -37,10 +38,24 @@ algos = cms.VPSet( cms.PSet( etaMin = cms.double(0.), + etaMax = cms.double( 2.0), + ptMin = cms.double(0.), + MinNeutralPt = cms.double(0.1), + MinNeutralPtSlope = cms.double(0.005), + RMSEtaSF = cms.double(1.0), + MedEtaSF = cms.double(1.0), + EtaMaxExtrap = cms.double(2.0), + puppiAlgos = puppiCentral + ), + cms.PSet( + etaMin = cms.double(2.0), etaMax = cms.double( 2.5), ptMin = cms.double(0.), - MinNeutralPt = cms.double(0.2), - MinNeutralPtSlope = cms.double(0.02), + MinNeutralPt = cms.double(0.1), + MinNeutralPtSlope = cms.double(0.005), + RMSEtaSF = cms.double(0.95), + MedEtaSF = cms.double(1.0), + EtaMaxExtrap = cms.double(2.0), puppiAlgos = puppiCentral ), cms.PSet( @@ -49,14 +64,24 @@ ptMin = cms.double(0.0), MinNeutralPt = cms.double(1.0), MinNeutralPtSlope = cms.double(0.005), + # RMSEtaSF = cms.double(1.545), + # MedEtaSF = cms.double(0.845), + RMSEtaSF = cms.double(1.484), + MedEtaSF = cms.double(0.845), + EtaMaxExtrap = cms.double(2.0), puppiAlgos = puppiForward ), cms.PSet( etaMin = cms.double(3.0), etaMax = cms.double(10.0), ptMin = cms.double(0.0), - MinNeutralPt = cms.double(1.5), + MinNeutralPt = cms.double(1.0), MinNeutralPtSlope = cms.double(0.005), + # RMSEtaSF = cms.double(1.18), + # MedEtaSF = cms.double(0.4397), + RMSEtaSF = cms.double(1.25), + MedEtaSF = cms.double(0.4397), + EtaMaxExtrap = cms.double(2.0), puppiAlgos = puppiForward ) ) diff --git a/CommonTools/PileupAlgos/src/PuppiAlgo.cc b/CommonTools/PileupAlgos/src/PuppiAlgo.cc index 50be293ae4dd0..cc9a26655bf5c 100644 --- a/CommonTools/PileupAlgos/src/PuppiAlgo.cc +++ b/CommonTools/PileupAlgos/src/PuppiAlgo.cc @@ -8,143 +8,221 @@ #include "TMath.h" -PuppiAlgo::PuppiAlgo(edm::ParameterSet &iConfig) { - fEtaMin = iConfig.getParameter<double>("etaMin"); - fEtaMax = iConfig.getParameter<double>("etaMax"); - fPtMin = iConfig.getParameter<double>("ptMin"); - fNeutralPtMin = iConfig.getParameter<double>("MinNeutralPt"); // Weighted Neutral Pt Cut - fNeutralPtSlope = iConfig.getParameter<double>("MinNeutralPtSlope"); // Slope vs #pv - - std::vector<edm::ParameterSet> lAlgos = iConfig.getParameter<std::vector<edm::ParameterSet> >("puppiAlgos"); - fNAlgos = lAlgos.size(); - //Uber Configurable Puppi - for(unsigned int i0 = 0; i0 < lAlgos.size(); i0++) { - int pAlgoId = lAlgos[i0].getParameter<int > ("algoId"); - bool pCharged = lAlgos[i0].getParameter<bool> ("useCharged"); - bool pWeight0 = lAlgos[i0].getParameter<bool> ("applyLowPUCorr"); - int pComb = lAlgos[i0].getParameter<int> ("combOpt"); // 0=> add in chi2/1=>Multiply p-values - double pConeSize = lAlgos[i0].getParameter<double>("cone"); // Min Pt when computing pt and rms - double pRMSPtMin = lAlgos[i0].getParameter<double>("rmsPtMin"); // Min Pt when computing pt and rms - double pRMSSF = lAlgos[i0].getParameter<double>("rmsScaleFactor"); // Additional Tuning parameter for Jokers - fAlgoId .push_back(pAlgoId); - fCharged .push_back(pCharged); - fAdjust .push_back(pWeight0); - fCombId .push_back(pComb); - fConeSize .push_back(pConeSize); - fRMSPtMin .push_back(pRMSPtMin); - fRMSScaleFactor.push_back(pRMSSF); - double pRMS = 0; - double pMed = 0; - double pMean = 0; - int pNCount = 0; - fRMS .push_back(pRMS); - fMedian.push_back(pMed); - fMean .push_back(pMean); - fNCount.push_back(pNCount); - } +PuppiAlgo::PuppiAlgo(edm::ParameterSet &iConfig) { + fEtaMin = iConfig.getParameter<double>("etaMin"); + fEtaMax = iConfig.getParameter<double>("etaMax"); + fPtMin = iConfig.getParameter<double>("ptMin"); + fNeutralPtMin = iConfig.getParameter<double>("MinNeutralPt"); // Weighted Neutral Pt Cut + fNeutralPtSlope = iConfig.getParameter<double>("MinNeutralPtSlope"); // Slope vs #pv + fRMSEtaSF = iConfig.getParameter<double>("RMSEtaSF"); + fMedEtaSF = iConfig.getParameter<double>("MedEtaSF"); + fEtaMaxExtrap = iConfig.getParameter<double>("EtaMaxExtrap"); + + std::vector<edm::ParameterSet> lAlgos = iConfig.getParameter<std::vector<edm::ParameterSet> >("puppiAlgos"); + fNAlgos = lAlgos.size(); + //Uber Configurable Puppi + for(unsigned int i0 = 0; i0 < lAlgos.size(); i0++) { + int pAlgoId = lAlgos[i0].getParameter<int > ("algoId"); + bool pCharged = lAlgos[i0].getParameter<bool> ("useCharged"); + bool pWeight0 = lAlgos[i0].getParameter<bool> ("applyLowPUCorr"); + int pComb = lAlgos[i0].getParameter<int> ("combOpt"); // 0=> add in chi2/1=>Multiply p-values + double pConeSize = lAlgos[i0].getParameter<double>("cone"); // Min Pt when computing pt and rms + double pRMSPtMin = lAlgos[i0].getParameter<double>("rmsPtMin"); // Min Pt when computing pt and rms + double pRMSSF = lAlgos[i0].getParameter<double>("rmsScaleFactor"); // Additional Tuning parameter for Jokers + fAlgoId .push_back(pAlgoId); + fCharged .push_back(pCharged); + fAdjust .push_back(pWeight0); + fCombId .push_back(pComb); + fConeSize .push_back(pConeSize); + fRMSPtMin .push_back(pRMSPtMin); + fRMSScaleFactor.push_back(pRMSSF); + double pRMS = 0; + double pMed = 0; + double pMean = 0; + int pNCount = 0; + fRMS .push_back(pRMS); + fMedian.push_back(pMed); + fMean .push_back(pMean); + fNCount.push_back(pNCount); + } } -PuppiAlgo::~PuppiAlgo() { - fPups .clear(); - fPupsPV.clear(); +PuppiAlgo::~PuppiAlgo() { + fPups .clear(); + fPupsPV.clear(); } -void PuppiAlgo::reset() { - fPups .clear(); - fPupsPV.clear(); - for(unsigned int i0 = 0; i0 < fNAlgos; i0++) { - fMedian[i0] = 0; - fRMS [i0] = 0; - fMean [i0] = 0; - fNCount[i0] = 0; - } +void PuppiAlgo::reset() { + fPups .clear(); + fPupsPV.clear(); + for(unsigned int i0 = 0; i0 < fNAlgos; i0++) { + fMedian[i0] = 0; + fRMS [i0] = 0; + fMean [i0] = 0; + fNCount[i0] = 0; + } } -void PuppiAlgo::add(const fastjet::PseudoJet &iParticle,const double &iVal,const unsigned int iAlgo) { - if(iParticle.pt() < fRMSPtMin[iAlgo]) return; - // Change from SRR : Previously used fastjet::PseudoJet::user_index to decide the particle type. - // In CMSSW we use the user_index to specify the index in the input collection, so I invented - // a new mechanism using the fastjet UserInfo functionality. Of course, it's still just an integer - // but that interface could be changed (or augmented) if desired / needed. - int puppi_register = std::numeric_limits<int>::lowest(); - if ( iParticle.has_user_info() ) { - PuppiContainer::PuppiUserInfo const * pInfo = dynamic_cast<PuppiContainer::PuppiUserInfo const *>( iParticle.user_info_ptr() ); - if ( pInfo != 0 ) { - puppi_register = pInfo->puppi_register(); +void PuppiAlgo::add(const fastjet::PseudoJet &iParticle,const double &iVal,const unsigned int iAlgo) { + if(iParticle.pt() < fRMSPtMin[iAlgo]) return; + // Change from SRR : Previously used fastjet::PseudoJet::user_index to decide the particle type. + // In CMSSW we use the user_index to specify the index in the input collection, so I invented + // a new mechanism using the fastjet UserInfo functionality. Of course, it's still just an integer + // but that interface could be changed (or augmented) if desired / needed. + int puppi_register = std::numeric_limits<int>::lowest(); + if ( iParticle.has_user_info() ) { + PuppiContainer::PuppiUserInfo const * pInfo = dynamic_cast<PuppiContainer::PuppiUserInfo const *>( iParticle.user_info_ptr() ); + if ( pInfo != 0 ) { + puppi_register = pInfo->puppi_register(); + } + } + if ( puppi_register == std::numeric_limits<int>::lowest() ) { + throw cms::Exception("PuppiRegisterNotSet") << "The puppi register is not set. This must be set before use.\n"; + } + + //// original code + // if(fCharged[iAlgo] && std::abs(puppi_register) < 1) return; + // if(fCharged[iAlgo] && (std::abs(puppi_register) >=1 && std::abs(puppi_register) <=2)) fPupsPV.push_back(iVal); + //if(fCharged[iAlgo] && std::abs(puppi_register) < 3) return; + //// if used fCharged and not CHPU, just return + // fPups.push_back(iVal); //original + // fNCount[iAlgo]++; + + // added by Nhan -- for all eta regions, compute mean/RMS from the central charged PU + //std::cout << "std::abs(puppi_register) = " << std::abs(puppi_register) << std::endl; + if ((std::abs(iParticle.eta()) < fEtaMaxExtrap) && (std::abs(puppi_register) >= 3)){ + fPups.push_back(iVal); + fPupsPV.push_back(iVal); + fNCount[iAlgo]++; } - } - if ( puppi_register == std::numeric_limits<int>::lowest() ) { - throw cms::Exception("PuppiRegisterNotSet") << "The puppi register is not set. This must be set before use.\n"; - } - if(fCharged[iAlgo] && std::abs(puppi_register) < 1) return; - if(fCharged[iAlgo] && (std::abs(puppi_register) >=1 && std::abs(puppi_register) <=2)) fPupsPV.push_back(iVal); - if(fCharged[iAlgo] && std::abs(puppi_register) < 3) return; - fPups.push_back(iVal); - fNCount[iAlgo]++; } -void PuppiAlgo::computeMedRMS(const unsigned int &iAlgo,const double &iPVFrac) { - if(iAlgo >= fNAlgos ) return; - if(fNCount[iAlgo] == 0) return; - int lNBefore = 0; - for(unsigned int i0 = 0; i0 < iAlgo; i0++) lNBefore += fNCount[i0]; - std::sort(fPups.begin()+lNBefore,fPups.begin()+lNBefore+fNCount[iAlgo]); - double lCorr = 1.; - //if(!fCharged[iAlgo] && fAdjust[iAlgo]) lCorr *= 1. - iPVFrac; - if(fAdjust[iAlgo]) lCorr *= 1. - iPVFrac; - int lNum0 = 0; - for(int i0 = lNBefore; i0 < lNBefore+fNCount[iAlgo]; i0++) { - if(fPups[i0] == 0) lNum0 = i0-lNBefore; - } - //lNum0 = 0; - int lNHalfway = lNBefore + lNum0 + int( double( fNCount[iAlgo]-lNum0 )*0.50*lCorr); - fMedian[iAlgo] = fPups[lNHalfway]; - double lMed = fMedian[iAlgo]; //Just to make the readability easier - int lNRMS = 0; - for(int i0 = lNBefore; i0 < lNBefore+fNCount[iAlgo]; i0++) { - fMean[iAlgo] += fPups[i0]; - if(fPups[i0] == 0) continue; - if(!fCharged[iAlgo] && fAdjust[iAlgo] && fPups[i0] > lMed) continue; - //if(fAdjust[iAlgo] && fPups[i0] > lMed) continue; - lNRMS++; - fRMS [iAlgo] += (fPups[i0]-lMed)*(fPups[i0]-lMed); - } - fMean[iAlgo]/=fNCount[iAlgo]; - if(lNRMS > 0) fRMS [iAlgo]/=lNRMS; - if(fRMS[iAlgo] == 0) fRMS[iAlgo] = 1e-5; +//////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////// +//NHAN'S VERSION +void PuppiAlgo::computeMedRMS(const unsigned int &iAlgo,const double &iPVFrac) { + + //std::cout << "fNCount[iAlgo] = " << fNCount[iAlgo] << std::endl; + if(iAlgo >= fNAlgos ) return; + if(fNCount[iAlgo] == 0) return; - fRMS [iAlgo] = sqrt(fRMS[iAlgo]); - fRMS [iAlgo] *= fRMSScaleFactor[iAlgo]; - //if(!fCharged[iAlgo]) std::cout << " Process : " << iAlgo << " Median : " << fMedian[iAlgo] << " +/- " << fRMS[iAlgo] << " -- Begin : " << lNBefore << " -- Total : " << fNCount[iAlgo] << " -- 50% " << lNHalfway << " Fraction less than @ Median : " << std::endl; - if(!fAdjust[iAlgo]) return; - //Adjust the p-value to correspond to the median - std::sort(fPupsPV.begin(),fPupsPV.end()); - int lNPV = 0; for(unsigned int i0 = 0; i0 < fPupsPV.size(); i0++) if(fPupsPV[i0] <= lMed ) lNPV++; - double lAdjust = 1.5*double(lNPV)/double(fPupsPV.size()+fNCount[iAlgo]); - if(lAdjust > 0) fMedian[iAlgo] -= sqrt(ROOT::Math::chisquared_quantile(lAdjust,1.)*fRMS[iAlgo]); + // sort alphas + int lNBefore = 0; + for(unsigned int i0 = 0; i0 < iAlgo; i0++) lNBefore += fNCount[i0]; + std::sort(fPups.begin()+lNBefore,fPups.begin()+lNBefore+fNCount[iAlgo]); + + // some correction that phil added... + double lCorr = 1.; + //if(!fCharged[iAlgo] && fAdjust[iAlgo]) lCorr *= 1. - iPVFrac; + if(fAdjust[iAlgo]) lCorr *= 1. - iPVFrac; + + // in case you have alphas == 0 + int lNum0 = 0; + for(int i0 = lNBefore; i0 < lNBefore+fNCount[iAlgo]; i0++) { + if(fPups[i0] == 0) lNum0 = i0-lNBefore; + } + + // comput median, removed lCorr for now + int lNHalfway = lNBefore + lNum0 + int( double( fNCount[iAlgo]-lNum0 )*0.50); + fMedian[iAlgo] = fPups[lNHalfway]; + double lMed = fMedian[iAlgo]; //Just to make the readability easier + + int lNRMS = 0; + for(int i0 = lNBefore; i0 < lNBefore+fNCount[iAlgo]; i0++) { + fMean[iAlgo] += fPups[i0]; + if(fPups[i0] == 0) continue; + if(!fCharged[iAlgo] && fAdjust[iAlgo] && fPups[i0] > lMed) continue; + //if(fAdjust[iAlgo] && fPups[i0] > lMed) continue; + lNRMS++; + fRMS [iAlgo] += (fPups[i0]-lMed)*(fPups[i0]-lMed); + } + fMean[iAlgo]/=fNCount[iAlgo]; + if(lNRMS > 0) fRMS [iAlgo]/=lNRMS; + if(fRMS[iAlgo] == 0) fRMS[iAlgo] = 1e-5; + // here is the raw RMS + fRMS [iAlgo] = sqrt(fRMS[iAlgo]); + + // some ways to do corrections to fRMS and fMedian + fRMS [iAlgo] *= fRMSScaleFactor[iAlgo]; + + fRMS[iAlgo] *= fRMSEtaSF; + fMedian[iAlgo] *= fMedEtaSF; + //if(!fCharged[iAlgo]) std::cout << " Process : " << iAlgo << " Median : " << fMedian[iAlgo] << " +/- " << fRMS[iAlgo] << " -- Begin : " << lNBefore << " -- Total : " << fNCount[iAlgo] << " -- 50% " << lNHalfway << " Fraction less than @ Median : " << std::endl; + + // if(!fAdjust[iAlgo]) return; + // //Adjust the p-value to correspond to the median + // std::sort(fPupsPV.begin(),fPupsPV.end()); + // int lNPV = 0; for(unsigned int i0 = 0; i0 < fPupsPV.size(); i0++) if(fPupsPV[i0] <= lMed ) lNPV++; + // double lAdjust = 1.5*double(lNPV)/double(fPupsPV.size()+fNCount[iAlgo]); + // if(lAdjust > 0) fMedian[iAlgo] -= sqrt(ROOT::Math::chisquared_quantile(lAdjust,1.)*fRMS[iAlgo]); } +//////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////// + +// void PuppiAlgo::computeMedRMS(const unsigned int &iAlgo,const double &iPVFrac) { +// if(iAlgo >= fNAlgos ) return; +// if(fNCount[iAlgo] == 0) return; +// int lNBefore = 0; +// for(unsigned int i0 = 0; i0 < iAlgo; i0++) lNBefore += fNCount[i0]; +// std::sort(fPups.begin()+lNBefore,fPups.begin()+lNBefore+fNCount[iAlgo]); +// double lCorr = 1.; +// //if(!fCharged[iAlgo] && fAdjust[iAlgo]) lCorr *= 1. - iPVFrac; +// if(fAdjust[iAlgo]) lCorr *= 1. - iPVFrac; +// int lNum0 = 0; +// for(int i0 = lNBefore; i0 < lNBefore+fNCount[iAlgo]; i0++) { +// if(fPups[i0] == 0) lNum0 = i0-lNBefore; +// } +// //lNum0 = 0; +// int lNHalfway = lNBefore + lNum0 + int( double( fNCount[iAlgo]-lNum0 )*0.50*lCorr); +// fMedian[iAlgo] = fPups[lNHalfway]; +// double lMed = fMedian[iAlgo]; //Just to make the readability easier + +// int lNRMS = 0; +// for(int i0 = lNBefore; i0 < lNBefore+fNCount[iAlgo]; i0++) { +// fMean[iAlgo] += fPups[i0]; +// if(fPups[i0] == 0) continue; +// if(!fCharged[iAlgo] && fAdjust[iAlgo] && fPups[i0] > lMed) continue; +// //if(fAdjust[iAlgo] && fPups[i0] > lMed) continue; +// lNRMS++; +// fRMS [iAlgo] += (fPups[i0]-lMed)*(fPups[i0]-lMed); +// } +// fMean[iAlgo]/=fNCount[iAlgo]; +// if(lNRMS > 0) fRMS [iAlgo]/=lNRMS; +// if(fRMS[iAlgo] == 0) fRMS[iAlgo] = 1e-5; + +// fRMS [iAlgo] = sqrt(fRMS[iAlgo]); +// fRMS [iAlgo] *= fRMSScaleFactor[iAlgo]; +// //if(!fCharged[iAlgo]) std::cout << " Process : " << iAlgo << " Median : " << fMedian[iAlgo] << " +/- " << fRMS[iAlgo] << " -- Begin : " << lNBefore << " -- Total : " << fNCount[iAlgo] << " -- 50% " << lNHalfway << " Fraction less than @ Median : " << std::endl; +// if(!fAdjust[iAlgo]) return; +// //Adjust the p-value to correspond to the median +// std::sort(fPupsPV.begin(),fPupsPV.end()); +// int lNPV = 0; for(unsigned int i0 = 0; i0 < fPupsPV.size(); i0++) if(fPupsPV[i0] <= lMed ) lNPV++; +// double lAdjust = 1.5*double(lNPV)/double(fPupsPV.size()+fNCount[iAlgo]); +// if(lAdjust > 0) fMedian[iAlgo] -= sqrt(ROOT::Math::chisquared_quantile(lAdjust,1.)*fRMS[iAlgo]); +// } + //This code is probably a bit confusing -double PuppiAlgo::compute(std::vector<double> const &iVals,double iChi2) const { - if(fAlgoId[0] == -1) return 1; - double lVal = 0.; - double lPVal = 1.; - int lNDOF = 0; - for(unsigned int i0 = 0; i0 < fNAlgos; i0++) { - if(fNCount[i0] == 0) return 1.; //in the NoPU case return 1. - if(fCombId[i0] == 1 && i0 > 0) { //Compute the previous p-value so that p-values can be multiplieed - double pPVal = ROOT::Math::chisquared_cdf(lVal,lNDOF); - lPVal *= pPVal; - lNDOF = 0; - lVal = 0; +double PuppiAlgo::compute(std::vector<double> const &iVals,double iChi2) const { + if(fAlgoId[0] == -1) return 1; + double lVal = 0.; + double lPVal = 1.; + int lNDOF = 0; + for(unsigned int i0 = 0; i0 < fNAlgos; i0++) { + if(fNCount[i0] == 0) return 1.; //in the NoPU case return 1. + if(fCombId[i0] == 1 && i0 > 0) { //Compute the previous p-value so that p-values can be multiplieed + double pPVal = ROOT::Math::chisquared_cdf(lVal,lNDOF); + lPVal *= pPVal; + lNDOF = 0; + lVal = 0; + } + double pVal = iVals[i0]; + //Special Check for any algo with log(0) + if(fAlgoId[i0] == 0 && iVals[i0] == 0) pVal = fMedian[i0]; + if(fAlgoId[i0] == 3 && iVals[i0] == 0) pVal = fMedian[i0]; + if(fAlgoId[i0] == 5 && iVals[i0] == 0) pVal = fMedian[i0]; + lVal += (pVal-fMedian[i0])*(fabs(pVal-fMedian[i0]))/fRMS[i0]/fRMS[i0]; + lNDOF++; + if(i0 == 0 && iChi2 != 0) lNDOF++; //Add external Chi2 to first element + if(i0 == 0 && iChi2 != 0) lVal+=iChi2; //Add external Chi2 to first element } - double pVal = iVals[i0]; - //Special Check for any algo with log(0) - if(fAlgoId[i0] == 0 && iVals[i0] == 0) pVal = fMedian[i0]; - if(fAlgoId[i0] == 3 && iVals[i0] == 0) pVal = fMedian[i0]; - if(fAlgoId[i0] == 5 && iVals[i0] == 0) pVal = fMedian[i0]; - lVal += (pVal-fMedian[i0])*(fabs(pVal-fMedian[i0]))/fRMS[i0]/fRMS[i0]; - lNDOF++; - if(i0 == 0 && iChi2 != 0) lNDOF++; //Add external Chi2 to first element - if(i0 == 0 && iChi2 != 0) lVal+=iChi2; //Add external Chi2 to first element - } - //Top it off with the last calc - lPVal *= ROOT::Math::chisquared_cdf(lVal,lNDOF); - return lPVal; + //Top it off with the last calc + lPVal *= ROOT::Math::chisquared_cdf(lVal,lNDOF); + return lPVal; } diff --git a/CommonTools/PileupAlgos/src/PuppiContainer.cc b/CommonTools/PileupAlgos/src/PuppiContainer.cc index 85b11e2c83db0..1b73d5aeac761 100644 --- a/CommonTools/PileupAlgos/src/PuppiContainer.cc +++ b/CommonTools/PileupAlgos/src/PuppiContainer.cc @@ -12,194 +12,243 @@ using namespace std; using namespace fastjet; PuppiContainer::PuppiContainer(const edm::ParameterSet &iConfig) { - fApplyCHS = iConfig.getParameter<bool>("applyCHS"); - fUseExp = iConfig.getParameter<bool>("useExp"); - fPuppiWeightCut = iConfig.getParameter<double>("MinPuppiWeight"); - std::vector<edm::ParameterSet> lAlgos = iConfig.getParameter<std::vector<edm::ParameterSet> >("algos"); - fNAlgos = lAlgos.size(); - for(unsigned int i0 = 0; i0 < lAlgos.size(); i0++) { - PuppiAlgo pPuppiConfig(lAlgos[i0]); - fPuppiAlgo.push_back(pPuppiConfig); - } + fApplyCHS = iConfig.getParameter<bool>("applyCHS"); + fUseExp = iConfig.getParameter<bool>("useExp"); + fPuppiWeightCut = iConfig.getParameter<double>("MinPuppiWeight"); + std::vector<edm::ParameterSet> lAlgos = iConfig.getParameter<std::vector<edm::ParameterSet> >("algos"); + fNAlgos = lAlgos.size(); + for(unsigned int i0 = 0; i0 < lAlgos.size(); i0++) { + PuppiAlgo pPuppiConfig(lAlgos[i0]); + fPuppiAlgo.push_back(pPuppiConfig); + } } -void PuppiContainer::initialize(const std::vector<RecoObj> &iRecoObjects) { +void PuppiContainer::initialize(const std::vector<RecoObj> &iRecoObjects) { //Clear everything - fRecoParticles.resize(0); - fPFParticles .resize(0); - fChargedPV .resize(0); - fPupParticles .resize(0); - fWeights .resize(0); - fVals.resize(0); + fRecoParticles.resize(0); + fPFParticles .resize(0); + fChargedPV .resize(0); + fPupParticles .resize(0); + fWeights .resize(0); + fVals.resize(0); + fRawAlphas.resize(0); + fAlphaMed .resize(0); + fAlphaRMS .resize(0); //fChargedNoPV.resize(0); //Link to the RecoObjects - fPVFrac = 0.; - fNPV = 1.; - fRecoParticles = iRecoObjects; - for (unsigned int i = 0; i < fRecoParticles.size(); i++){ - fastjet::PseudoJet curPseudoJet; - auto fRecoParticle = fRecoParticles[i]; - curPseudoJet.reset_PtYPhiM(fRecoParticle.pt,fRecoParticle.eta,fRecoParticle.phi,fRecoParticle.m); - int puppi_register = 0; - if(fRecoParticle.id == 0 or fRecoParticle.charge == 0) puppi_register = 0; // zero is neutral hadron - if(fRecoParticle.id == 1 and fRecoParticle.charge != 0) puppi_register = fRecoParticle.charge; // from PV use the - if(fRecoParticle.id == 2 and fRecoParticle.charge != 0) puppi_register = fRecoParticle.charge+5; // from NPV use the charge as key +5 as key - curPseudoJet.set_user_info( new PuppiUserInfo( puppi_register ) ); - // fill vector of pseudojets for internal references - fPFParticles.push_back(curPseudoJet); - //Take Charged particles associated to PV - if(std::abs(fRecoParticle.id) == 1) fChargedPV.push_back(curPseudoJet); - if(std::abs(fRecoParticle.id) >= 1 ) fPVFrac+=1.; - //if((fRecoParticle.id == 0) && (inParticles[i].id == 2)) _genParticles.push_back( curPseudoJet); - //if(fRecoParticle.id <= 2 && !(inParticles[i].pt < fNeutralMinE && fRecoParticle.id < 2)) _pfchsParticles.push_back(curPseudoJet); - //if(fRecoParticle.id == 3) _chargedNoPV.push_back(curPseudoJet); - if(fNPV < fRecoParticle.vtxId) fNPV = fRecoParticle.vtxId; - } - if (fPVFrac != 0) fPVFrac = double(fChargedPV.size())/fPVFrac; - else fPVFrac = 0; + fPVFrac = 0.; + fNPV = 1.; + fRecoParticles = iRecoObjects; + for (unsigned int i = 0; i < fRecoParticles.size(); i++){ + fastjet::PseudoJet curPseudoJet; + auto fRecoParticle = fRecoParticles[i]; + float nom = sqrt((fRecoParticle.m)*(fRecoParticle.m) + (fRecoParticle.pt)*(fRecoParticle.pt)*(cosh(fRecoParticle.eta))*(cosh(fRecoParticle.eta))) + (fRecoParticle.pt)*sinh(fRecoParticle.eta);//hacked + float denom = sqrt((fRecoParticle.m)*(fRecoParticle.m) + (fRecoParticle.pt)*(fRecoParticle.pt));//hacked + float rapidity = log(nom/denom);//hacked + curPseudoJet.reset_PtYPhiM(fRecoParticle.pt,rapidity,fRecoParticle.phi,fRecoParticle.m);//hacked + //curPseudoJet.reset_PtYPhiM(fRecoParticle.pt,fRecoParticle.eta,fRecoParticle.phi,fRecoParticle.m); + int puppi_register = 0; + if(fRecoParticle.id == 0 or fRecoParticle.charge == 0) puppi_register = 0; // zero is neutral hadron + if(fRecoParticle.id == 1 and fRecoParticle.charge != 0) puppi_register = fRecoParticle.charge; // from PV use the + if(fRecoParticle.id == 2 and fRecoParticle.charge != 0) puppi_register = fRecoParticle.charge+5; // from NPV use the charge as key +5 as key + curPseudoJet.set_user_info( new PuppiUserInfo( puppi_register ) ); + // fill vector of pseudojets for internal references + fPFParticles.push_back(curPseudoJet); + //Take Charged particles associated to PV + if(std::abs(fRecoParticle.id) == 1) fChargedPV.push_back(curPseudoJet); + if(std::abs(fRecoParticle.id) >= 1 ) fPVFrac+=1.; + //if((fRecoParticle.id == 0) && (inParticles[i].id == 2)) _genParticles.push_back( curPseudoJet); + //if(fRecoParticle.id <= 2 && !(inParticles[i].pt < fNeutralMinE && fRecoParticle.id < 2)) _pfchsParticles.push_back(curPseudoJet); + //if(fRecoParticle.id == 3) _chargedNoPV.push_back(curPseudoJet); + if(fNPV < fRecoParticle.vtxId) fNPV = fRecoParticle.vtxId; + } + if (fPVFrac != 0) fPVFrac = double(fChargedPV.size())/fPVFrac; + else fPVFrac = 0; } PuppiContainer::~PuppiContainer(){} double PuppiContainer::goodVar(PseudoJet const &iPart,std::vector<PseudoJet> const &iParts, int iOpt,double iRCone) { - double lPup = 0; - lPup = var_within_R(iOpt,iParts,iPart,iRCone); - return lPup; + double lPup = 0; + lPup = var_within_R(iOpt,iParts,iPart,iRCone); + return lPup; } double PuppiContainer::var_within_R(int iId, const vector<PseudoJet> & particles, const PseudoJet& centre, double R){ - if(iId == -1) return 1; - fastjet::Selector sel = fastjet::SelectorCircle(R); - sel.set_reference(centre); - vector<PseudoJet> near_particles = sel(particles); - double var = 0; - //double lSumPt = 0; - //if(iId == 1) for(unsigned int i=0; i<near_particles.size(); i++) lSumPt += near_particles[i].pt(); - for(unsigned int i=0; i<near_particles.size(); i++){ - double pDEta = near_particles[i].eta()-centre.eta(); - double pDPhi = std::abs(near_particles[i].phi()-centre.phi()); - if(pDPhi > 2.*M_PI-pDPhi) pDPhi = 2.*M_PI-pDPhi; - double pDR2 = pDEta*pDEta+pDPhi*pDPhi; - if(std::abs(pDR2) < 0.0001) continue; - if(iId == 0) var += (near_particles[i].pt()/pDR2); - if(iId == 1) var += near_particles[i].pt(); - if(iId == 2) var += (1./pDR2); - if(iId == 3) var += (1./pDR2); - if(iId == 4) var += near_particles[i].pt(); - if(iId == 5) var += (near_particles[i].pt() * near_particles[i].pt()/pDR2); - } - if(iId == 1) var += centre.pt(); //Sum in a cone - if(iId == 0 && var != 0) var = log(var); - if(iId == 3 && var != 0) var = log(var); - if(iId == 5 && var != 0) var = log(var); - return var; + if(iId == -1) return 1; + fastjet::Selector sel = fastjet::SelectorCircle(R); + sel.set_reference(centre); + vector<PseudoJet> near_particles = sel(particles); + double var = 0; + //double lSumPt = 0; + //if(iId == 1) for(unsigned int i=0; i<near_particles.size(); i++) lSumPt += near_particles[i].pt(); + for(unsigned int i=0; i<near_particles.size(); i++){ + double pDEta = near_particles[i].eta()-centre.eta(); + double pDPhi = std::abs(near_particles[i].phi()-centre.phi()); + if(pDPhi > 2.*M_PI-pDPhi) pDPhi = 2.*M_PI-pDPhi; + double pDR2 = pDEta*pDEta+pDPhi*pDPhi; + if(std::abs(pDR2) < 0.0001) continue; + if(iId == 0) var += (near_particles[i].pt()/pDR2); + if(iId == 1) var += near_particles[i].pt(); + if(iId == 2) var += (1./pDR2); + if(iId == 3) var += (1./pDR2); + if(iId == 4) var += near_particles[i].pt(); + if(iId == 5) var += (near_particles[i].pt() * near_particles[i].pt()/pDR2); + } + if(iId == 1) var += centre.pt(); //Sum in a cone + if(iId == 0 && var != 0) var = log(var); + if(iId == 3 && var != 0) var = log(var); + if(iId == 5 && var != 0) var = log(var); + return var; } //In fact takes the median not the average -void PuppiContainer::getRMSAvg(int iOpt,std::vector<fastjet::PseudoJet> const &iConstits,std::vector<fastjet::PseudoJet> const &iParticles,std::vector<fastjet::PseudoJet> const &iChargedParticles) { - for(unsigned int i0 = 0; i0 < iConstits.size(); i0++ ) { - double pVal = -1; - //Calculate the Puppi Algo to use - int pPupId = getPuppiId(iConstits[i0].pt(),iConstits[i0].eta()); - if(pPupId == -1 || fPuppiAlgo[pPupId].numAlgos() <= iOpt){ - fVals.push_back(-1); - continue; +void PuppiContainer::getRMSAvg(int iOpt,std::vector<fastjet::PseudoJet> const &iConstits,std::vector<fastjet::PseudoJet> const &iParticles,std::vector<fastjet::PseudoJet> const &iChargedParticles) { + for(unsigned int i0 = 0; i0 < iConstits.size(); i0++ ) { + double pVal = -1; + //Calculate the Puppi Algo to use + int pPupId = getPuppiId(iConstits[i0].pt(),iConstits[i0].eta()); + if(pPupId == -1 || fPuppiAlgo[pPupId].numAlgos() <= iOpt){ + fVals.push_back(-1); + continue; + } + //Get the Puppi Sub Algo (given iteration) + int pAlgo = fPuppiAlgo[pPupId].algoId (iOpt); + bool pCharged = fPuppiAlgo[pPupId].isCharged(iOpt); + double pCone = fPuppiAlgo[pPupId].coneSize (iOpt); + //Compute the Puppi Metric + if(!pCharged) pVal = goodVar(iConstits[i0],iParticles ,pAlgo,pCone); + if( pCharged) pVal = goodVar(iConstits[i0],iChargedParticles,pAlgo,pCone); + fVals.push_back(pVal); + //if(std::isnan(pVal) || std::isinf(pVal)) cerr << "====> Value is Nan " << pVal << " == " << iConstits[i0].pt() << " -- " << iConstits[i0].eta() << endl; + if( ! edm::isFinite(pVal)) { + LogDebug( "NotFound" ) << "====> Value is Nan " << pVal << " == " << iConstits[i0].pt() << " -- " << iConstits[i0].eta() << endl; + continue; + } + + // // fPuppiAlgo[pPupId].add(iConstits[i0],pVal,iOpt); + //code added by Nhan, now instead for every algorithm give it all the particles + for(int i1 = 0; i1 < fNAlgos; i1++){ + pAlgo = fPuppiAlgo[i1].algoId (iOpt); + pCharged = fPuppiAlgo[i1].isCharged(iOpt); + pCone = fPuppiAlgo[i1].coneSize (iOpt); + double curVal = -1; + if(!pCharged) curVal = goodVar(iConstits[i0],iParticles ,pAlgo,pCone); + if( pCharged) curVal = goodVar(iConstits[i0],iChargedParticles,pAlgo,pCone); + //std::cout << "i1 = " << i1 << ", curVal = " << curVal << ", eta = " << iConstits[i0].eta() << ", pupID = " << pPupId << std::endl; + fPuppiAlgo[i1].add(iConstits[i0],curVal,iOpt); + } + } - //Get the Puppi Sub Algo (given iteration) - int pAlgo = fPuppiAlgo[pPupId].algoId (iOpt); - bool pCharged = fPuppiAlgo[pPupId].isCharged(iOpt); - double pCone = fPuppiAlgo[pPupId].coneSize (iOpt); - //Compute the Puppi Metric - if(!pCharged) pVal = goodVar(iConstits[i0],iParticles ,pAlgo,pCone); - if( pCharged) pVal = goodVar(iConstits[i0],iChargedParticles,pAlgo,pCone); - fVals.push_back(pVal); - //if(std::isnan(pVal) || std::isinf(pVal)) cerr << "====> Value is Nan " << pVal << " == " << iConstits[i0].pt() << " -- " << iConstits[i0].eta() << endl; - if( ! edm::isFinite(pVal)) { - LogDebug( "NotFound" ) << "====> Value is Nan " << pVal << " == " << iConstits[i0].pt() << " -- " << iConstits[i0].eta() << endl; - continue; + for(int i0 = 0; i0 < fNAlgos; i0++) fPuppiAlgo[i0].computeMedRMS(iOpt,fPVFrac); +} +//In fact takes the median not the average +void PuppiContainer::getRawAlphas(int iOpt,std::vector<fastjet::PseudoJet> const &iConstits,std::vector<fastjet::PseudoJet> const &iParticles,std::vector<fastjet::PseudoJet> const &iChargedParticles) { + for(int j0 = 0; j0 < fNAlgos; j0++){ + for(unsigned int i0 = 0; i0 < iConstits.size(); i0++ ) { + double pVal = -1; + //Get the Puppi Sub Algo (given iteration) + int pAlgo = fPuppiAlgo[j0].algoId (iOpt); + bool pCharged = fPuppiAlgo[j0].isCharged(iOpt); + double pCone = fPuppiAlgo[j0].coneSize (iOpt); + //Compute the Puppi Metric + if(!pCharged) pVal = goodVar(iConstits[i0],iParticles ,pAlgo,pCone); + if( pCharged) pVal = goodVar(iConstits[i0],iChargedParticles,pAlgo,pCone); + fRawAlphas.push_back(pVal); + if( ! edm::isFinite(pVal)) { + LogDebug( "NotFound" ) << "====> Value is Nan " << pVal << " == " << iConstits[i0].pt() << " -- " << iConstits[i0].eta() << endl; + continue; + } + } } - fPuppiAlgo[pPupId].add(iConstits[i0],pVal,iOpt); - } - for(int i0 = 0; i0 < fNAlgos; i0++) fPuppiAlgo[i0].computeMedRMS(iOpt,fPVFrac); } -int PuppiContainer::getPuppiId( float iPt, float iEta) { - int lId = -1; - for(int i0 = 0; i0 < fNAlgos; i0++) { - if(std::abs(iEta) < fPuppiAlgo[i0].etaMin()) continue; - if(std::abs(iEta) > fPuppiAlgo[i0].etaMax()) continue; - if(iPt < fPuppiAlgo[i0].ptMin()) continue; - lId = i0; - break; - } - //if(lId == -1) std::cerr << "Error : Full fiducial range is not defined " << std::endl; - return lId; +int PuppiContainer::getPuppiId( float iPt, float iEta) { + int lId = -1; + for(int i0 = 0; i0 < fNAlgos; i0++) { + if(std::abs(iEta) < fPuppiAlgo[i0].etaMin()) continue; + if(std::abs(iEta) > fPuppiAlgo[i0].etaMax()) continue; + if(iPt < fPuppiAlgo[i0].ptMin()) continue; + lId = i0; + break; + } + //if(lId == -1) std::cerr << "Error : Full fiducial range is not defined " << std::endl; + return lId; } -double PuppiContainer::getChi2FromdZ(double iDZ) { - //We need to obtain prob of PU + (1-Prob of LV) - // Prob(LV) = Gaus(dZ,sigma) where sigma = 1.5mm (its really more like 1mm) - //double lProbLV = ROOT::Math::normal_cdf_c(std::abs(iDZ),0.2)*2.; //*2 is to do it double sided - //Take iDZ to be corrected by sigma already - double lProbLV = ROOT::Math::normal_cdf_c(std::abs(iDZ),1.)*2.; //*2 is to do it double sided - double lProbPU = 1-lProbLV; - if(lProbPU <= 0) lProbPU = 1e-16; //Quick Trick to through out infs - if(lProbPU >= 0) lProbPU = 1-1e-16; //Ditto - double lChi2PU = TMath::ChisquareQuantile(lProbPU,1); - lChi2PU*=lChi2PU; - return lChi2PU; +double PuppiContainer::getChi2FromdZ(double iDZ) { + //We need to obtain prob of PU + (1-Prob of LV) + // Prob(LV) = Gaus(dZ,sigma) where sigma = 1.5mm (its really more like 1mm) + //double lProbLV = ROOT::Math::normal_cdf_c(std::abs(iDZ),0.2)*2.; //*2 is to do it double sided + //Take iDZ to be corrected by sigma already + double lProbLV = ROOT::Math::normal_cdf_c(std::abs(iDZ),1.)*2.; //*2 is to do it double sided + double lProbPU = 1-lProbLV; + if(lProbPU <= 0) lProbPU = 1e-16; //Quick Trick to through out infs + if(lProbPU >= 0) lProbPU = 1-1e-16; //Ditto + double lChi2PU = TMath::ChisquareQuantile(lProbPU,1); + lChi2PU*=lChi2PU; + return lChi2PU; } std::vector<double> const & PuppiContainer::puppiWeights() { - fPupParticles .resize(0); - fWeights .resize(0); - fVals .resize(0); - for(int i0 = 0; i0 < fNAlgos; i0++) fPuppiAlgo[i0].reset(); - + fPupParticles .resize(0); + fWeights .resize(0); + fVals .resize(0); + for(int i0 = 0; i0 < fNAlgos; i0++) fPuppiAlgo[i0].reset(); + int lNMaxAlgo = 1; for(int i0 = 0; i0 < fNAlgos; i0++) lNMaxAlgo = std::max(fPuppiAlgo[i0].numAlgos(),lNMaxAlgo); //Run through all compute mean and RMS int lNParticles = fRecoParticles.size(); - for(int i0 = 0; i0 < lNMaxAlgo; i0++) { - getRMSAvg(i0,fPFParticles,fPFParticles,fChargedPV); - } - std::vector<double> pVals; - for(int i0 = 0; i0 < lNParticles; i0++) { - //Refresh - pVals.clear(); - double pWeight = 1; - //Get the Puppi Id and if ill defined move on - int pPupId = getPuppiId(fRecoParticles[i0].pt,fRecoParticles[i0].eta); - if(pPupId == -1) { - fWeights .push_back(pWeight); - continue; - } - // fill the p-values - double pChi2 = 0; - if(fUseExp){ - //Compute an Experimental Puppi Weight with delta Z info (very simple example) - pChi2 = getChi2FromdZ(fRecoParticles[i0].dZ); - //Now make sure Neutrals are not set - if(fRecoParticles[i0].pfType > 3) pChi2 = 0; - } - //Fill and compute the PuppiWeight - int lNAlgos = fPuppiAlgo[pPupId].numAlgos(); - for(int i1 = 0; i1 < lNAlgos; i1++) pVals.push_back(fVals[lNParticles*i1+i0]); - pWeight = fPuppiAlgo[pPupId].compute(pVals,pChi2); - //Apply the CHS weights - if(fRecoParticles[i0].id == 1 && fApplyCHS ) pWeight = 1; - if(fRecoParticles[i0].id == 2 && fApplyCHS ) pWeight = 0; - //Basic Weight Checks - if( ! edm::isFinite(pWeight)) { - pWeight = 0.0; - LogDebug("PuppiWeightError") << "====> Weight is nan : " << pWeight << " : pt " << fRecoParticles[i0].pt << " -- eta : " << fRecoParticles[i0].eta << " -- Value" << fVals[i0] << " -- id : " << fRecoParticles[i0].id << " -- NAlgos: " << lNAlgos << std::endl; + for(int i0 = 0; i0 < lNMaxAlgo; i0++) { + getRMSAvg(i0,fPFParticles,fPFParticles,fChargedPV); + } + getRawAlphas(0,fPFParticles,fPFParticles,fChargedPV); + + std::vector<double> pVals; + for(int i0 = 0; i0 < lNParticles; i0++) { + //Refresh + pVals.clear(); + double pWeight = 1; + //Get the Puppi Id and if ill defined move on + int pPupId = getPuppiId(fRecoParticles[i0].pt,fRecoParticles[i0].eta); + if(pPupId == -1) { + fWeights .push_back(pWeight); + fAlphaMed.push_back(-10); + fAlphaRMS.push_back(-10); + continue; + } + // fill the p-values + double pChi2 = 0; + if(fUseExp){ + //Compute an Experimental Puppi Weight with delta Z info (very simple example) + pChi2 = getChi2FromdZ(fRecoParticles[i0].dZ); + //Now make sure Neutrals are not set + if(fRecoParticles[i0].pfType > 3) pChi2 = 0; + } + //Fill and compute the PuppiWeight + int lNAlgos = fPuppiAlgo[pPupId].numAlgos(); + for(int i1 = 0; i1 < lNAlgos; i1++) pVals.push_back(fVals[lNParticles*i1+i0]); + pWeight = fPuppiAlgo[pPupId].compute(pVals,pChi2); + //Apply the CHS weights + if(fRecoParticles[i0].id == 1 && fApplyCHS ) pWeight = 1; + if(fRecoParticles[i0].id == 2 && fApplyCHS ) pWeight = 0; + //Basic Weight Checks + if( ! edm::isFinite(pWeight)) { + pWeight = 0.0; + LogDebug("PuppiWeightError") << "====> Weight is nan : " << pWeight << " : pt " << fRecoParticles[i0].pt << " -- eta : " << fRecoParticles[i0].eta << " -- Value" << fVals[i0] << " -- id : " << fRecoParticles[i0].id << " -- NAlgos: " << lNAlgos << std::endl; + } + //Basic Cuts + if(pWeight < fPuppiWeightCut) pWeight = 0; //==> Elminate the low Weight stuff + if(pWeight*fPFParticles[i0].pt() < fPuppiAlgo[pPupId].neutralPt(fNPV) && fRecoParticles[i0].id == 0 ) pWeight = 0; //threshold cut on the neutral Pt + + //std::cout << "fRecoParticles[i0].pt = " << fRecoParticles[i0].pt << ", fRecoParticles[i0].charge = " << fRecoParticles[i0].charge << ", fRecoParticles[i0].id = " << fRecoParticles[i0].id << ", weight = " << pWeight << std::endl; + + fWeights .push_back(pWeight); + fAlphaMed.push_back(fPuppiAlgo[pPupId].fMedian[0]); + fAlphaRMS.push_back(fPuppiAlgo[pPupId].fRMS [0]); + //Now get rid of the thrown out weights for the particle collection + if(std::abs(pWeight) < std::numeric_limits<double>::denorm_min() ) continue; + //Produce + PseudoJet curjet( pWeight*fPFParticles[i0].px(), pWeight*fPFParticles[i0].py(), pWeight*fPFParticles[i0].pz(), pWeight*fPFParticles[i0].e()); + curjet.set_user_index(i0); + fPupParticles.push_back(curjet); } - //Basic Cuts - if(pWeight < fPuppiWeightCut) pWeight = 0; //==> Elminate the low Weight stuff - if(pWeight*fPFParticles[i0].pt() < fPuppiAlgo[pPupId].neutralPt(fNPV) && fRecoParticles[i0].id == 0 ) pWeight = 0; //threshold cut on the neutral Pt - fWeights .push_back(pWeight); - //Now get rid of the thrown out weights for the particle collection - if(std::abs(pWeight) < std::numeric_limits<double>::denorm_min() ) continue; - //Produce - PseudoJet curjet( pWeight*fPFParticles[i0].px(), pWeight*fPFParticles[i0].py(), pWeight*fPFParticles[i0].pz(), pWeight*fPFParticles[i0].e()); - curjet.set_user_index(i0); - fPupParticles.push_back(curjet); - } - return fWeights; + return fWeights; } diff --git a/CommonTools/PileupAlgos/test/testPUMods.py b/CommonTools/PileupAlgos/test/testPUMods.py index dd386cdaf0069..976e44c0b463a 100644 --- a/CommonTools/PileupAlgos/test/testPUMods.py +++ b/CommonTools/PileupAlgos/test/testPUMods.py @@ -5,18 +5,25 @@ process.load('FWCore/MessageService/MessageLogger_cfi') process.load('Configuration/StandardSequences/FrontierConditions_GlobalTag_cff') process.MessageLogger.cerr.FwkReport.reportEvery = 10 -process.GlobalTag.globaltag = 'START53_V7G::All' +#process.GlobalTag.globaltag = 'MCRUN2_75::All' +#process.GlobalTag.globaltag = 'auto:run1_mc' +from Configuration.AlCa.GlobalTag import GlobalTag +process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:run1_mc', '') process.load('CommonTools/PileupAlgos/Puppi_cff') process.load('CommonTools/PileupAlgos/softKiller_cfi') process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(50) ) process.source = cms.Source("PoolSource", - fileNames = cms.untracked.vstring('/store/relval/CMSSW_7_2_0_pre6/RelValProdTTbar/AODSIM/PRE_STA72_V4-v1/00000/BA8284B4-4F40-E411-9AA2-002590593878.root') + fileNames = cms.untracked.vstring('/store/relval/CMSSW_7_5_0_pre4/RelValQCD_FlatPt_15_3000HS_13/MINIAODSIM/MCRUN2_75_V1-v1/00000/328B19C2-4DF6-E411-92C1-003048FFD796.root') ) process.source.inputCommands = cms.untracked.vstring("keep *", "drop *_MEtoEDMConverter_*_*") +process.puppi.candName = cms.InputTag('packedPFCandidates') +process.puppi.vertexName = cms.InputTag('offlineSlimmedPrimaryVertices') +process.softKiller.PFCandidates = cms.InputTag('packedPFCandidates') + process.options = cms.untracked.PSet( wantSummary = cms.untracked.bool(True), Rethrow = cms.untracked.vstring('ProductNotFound'), @@ -25,6 +32,7 @@ process.puSequence = cms.Sequence(process.puppi*process.softKiller) +#process.puSequence = cms.Sequence(process.puppi) process.p = cms.Path(process.puSequence) process.output = cms.OutputModule("PoolOutputModule", outputCommands = cms.untracked.vstring('drop *', From 230c826649199c8fd41bb50fcf6e10dbae741489 Mon Sep 17 00:00:00 2001 From: nhanvtran <nhan.v.tran@gmail.com> Date: Mon, 18 May 2015 16:53:36 -0500 Subject: [PATCH 10/26] updated with fixes from comments from Slava --- CommonTools/PileupAlgos/interface/PuppiAlgo.h | 4 +- .../PileupAlgos/interface/PuppiContainer.h | 8 ++-- CommonTools/PileupAlgos/interface/RecoObj.h | 2 +- .../PileupAlgos/plugins/PuppiProducer.cc | 1 + CommonTools/PileupAlgos/src/PuppiAlgo.cc | 43 ------------------- CommonTools/PileupAlgos/src/PuppiContainer.cc | 8 ++-- CommonTools/PileupAlgos/test/testPUMods.py | 4 +- 7 files changed, 13 insertions(+), 57 deletions(-) diff --git a/CommonTools/PileupAlgos/interface/PuppiAlgo.h b/CommonTools/PileupAlgos/interface/PuppiAlgo.h index 7aee84160a4f3..ea04ab731451d 100644 --- a/CommonTools/PileupAlgos/interface/PuppiAlgo.h +++ b/CommonTools/PileupAlgos/interface/PuppiAlgo.h @@ -16,7 +16,7 @@ class PuppiAlgo{ void computeMedRMS(const unsigned int &iAlgo,const double &iPVFrac); //Get the Weight double compute(std::vector<double> const &iVals,double iChi2) const; - std::vector<float> alphas(){ return fPups; } + const std::vector<float> alphas(){ return fPups; } //Helpers inline double ptMin() const { return fPtMin; } inline double etaMin() const { return fEtaMin; } @@ -26,10 +26,10 @@ class PuppiAlgo{ inline bool isCharged ( unsigned int iAlgo) const { return fCharged.at(iAlgo); } inline double coneSize ( unsigned int iAlgo) const { return fConeSize.at(iAlgo); } inline double neutralPt (int iNPV) const { return fNeutralPtMin + iNPV * fNeutralPtSlope; } + std::vector<double> fRMS; std::vector<double> fMedian; - private: unsigned int fNAlgos; float fEtaMax; diff --git a/CommonTools/PileupAlgos/interface/PuppiContainer.h b/CommonTools/PileupAlgos/interface/PuppiContainer.h index bd9eaebf97a14..f266be9f89cfe 100644 --- a/CommonTools/PileupAlgos/interface/PuppiContainer.h +++ b/CommonTools/PileupAlgos/interface/PuppiContainer.h @@ -40,11 +40,11 @@ class PuppiContainer{ std::vector<fastjet::PseudoJet> const & pfParticles() const { return fPFParticles; } std::vector<fastjet::PseudoJet> const & pvParticles() const { return fChargedPV; } std::vector<double> const & puppiWeights(); - std::vector<double> const & puppiRawAlphas(){ return fRawAlphas; } - std::vector<double> const & puppiAlphas(){ return fVals; } + const std::vector<double> & puppiRawAlphas(){ return fRawAlphas; } + const std::vector<double> & puppiAlphas(){ return fVals; } // const std::vector<double> puppiAlpha () {return fAlpha;} - std::vector<double> const & puppiAlphasMed() {return fAlphaMed;} - std::vector<double> const & puppiAlphasRMS() {return fAlphaRMS;} + const std::vector<double> & puppiAlphasMed() {return fAlphaMed;} + const std::vector<double> & puppiAlphasRMS() {return fAlphaRMS;} int puppiNAlgos(){ return fNAlgos; } std::vector<fastjet::PseudoJet> const & puppiParticles() const { return fPupParticles;} diff --git a/CommonTools/PileupAlgos/interface/RecoObj.h b/CommonTools/PileupAlgos/interface/RecoObj.h index bde2077758b3b..f1867fdaf5dcd 100644 --- a/CommonTools/PileupAlgos/interface/RecoObj.h +++ b/CommonTools/PileupAlgos/interface/RecoObj.h @@ -14,7 +14,7 @@ class RecoObj {} ~RecoObj(){} - float pt, eta, phi, m; // kinematics + float pt, eta, phi, m, rapidity; // kinematics int id; int pfType; int vtxId; // Vertex Id from Vertex Collection diff --git a/CommonTools/PileupAlgos/plugins/PuppiProducer.cc b/CommonTools/PileupAlgos/plugins/PuppiProducer.cc index f02a3cba3cc41..9088ce9acf2b2 100644 --- a/CommonTools/PileupAlgos/plugins/PuppiProducer.cc +++ b/CommonTools/PileupAlgos/plugins/PuppiProducer.cc @@ -78,6 +78,7 @@ void PuppiProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { pReco.eta = itPF->eta(); pReco.phi = itPF->phi(); pReco.m = itPF->mass(); + pReco.rapidity = itPF->rapidity(); pReco.charge = itPF->charge(); const reco::Vertex *closestVtx = 0; double pDZ = -9999; diff --git a/CommonTools/PileupAlgos/src/PuppiAlgo.cc b/CommonTools/PileupAlgos/src/PuppiAlgo.cc index cc9a26655bf5c..e95bd89bfa56c 100644 --- a/CommonTools/PileupAlgos/src/PuppiAlgo.cc +++ b/CommonTools/PileupAlgos/src/PuppiAlgo.cc @@ -154,49 +154,6 @@ void PuppiAlgo::computeMedRMS(const unsigned int &iAlgo,const double &iPVFrac) { // if(lAdjust > 0) fMedian[iAlgo] -= sqrt(ROOT::Math::chisquared_quantile(lAdjust,1.)*fRMS[iAlgo]); } //////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// - -// void PuppiAlgo::computeMedRMS(const unsigned int &iAlgo,const double &iPVFrac) { -// if(iAlgo >= fNAlgos ) return; -// if(fNCount[iAlgo] == 0) return; -// int lNBefore = 0; -// for(unsigned int i0 = 0; i0 < iAlgo; i0++) lNBefore += fNCount[i0]; -// std::sort(fPups.begin()+lNBefore,fPups.begin()+lNBefore+fNCount[iAlgo]); -// double lCorr = 1.; -// //if(!fCharged[iAlgo] && fAdjust[iAlgo]) lCorr *= 1. - iPVFrac; -// if(fAdjust[iAlgo]) lCorr *= 1. - iPVFrac; -// int lNum0 = 0; -// for(int i0 = lNBefore; i0 < lNBefore+fNCount[iAlgo]; i0++) { -// if(fPups[i0] == 0) lNum0 = i0-lNBefore; -// } -// //lNum0 = 0; -// int lNHalfway = lNBefore + lNum0 + int( double( fNCount[iAlgo]-lNum0 )*0.50*lCorr); -// fMedian[iAlgo] = fPups[lNHalfway]; -// double lMed = fMedian[iAlgo]; //Just to make the readability easier - -// int lNRMS = 0; -// for(int i0 = lNBefore; i0 < lNBefore+fNCount[iAlgo]; i0++) { -// fMean[iAlgo] += fPups[i0]; -// if(fPups[i0] == 0) continue; -// if(!fCharged[iAlgo] && fAdjust[iAlgo] && fPups[i0] > lMed) continue; -// //if(fAdjust[iAlgo] && fPups[i0] > lMed) continue; -// lNRMS++; -// fRMS [iAlgo] += (fPups[i0]-lMed)*(fPups[i0]-lMed); -// } -// fMean[iAlgo]/=fNCount[iAlgo]; -// if(lNRMS > 0) fRMS [iAlgo]/=lNRMS; -// if(fRMS[iAlgo] == 0) fRMS[iAlgo] = 1e-5; - -// fRMS [iAlgo] = sqrt(fRMS[iAlgo]); -// fRMS [iAlgo] *= fRMSScaleFactor[iAlgo]; -// //if(!fCharged[iAlgo]) std::cout << " Process : " << iAlgo << " Median : " << fMedian[iAlgo] << " +/- " << fRMS[iAlgo] << " -- Begin : " << lNBefore << " -- Total : " << fNCount[iAlgo] << " -- 50% " << lNHalfway << " Fraction less than @ Median : " << std::endl; -// if(!fAdjust[iAlgo]) return; -// //Adjust the p-value to correspond to the median -// std::sort(fPupsPV.begin(),fPupsPV.end()); -// int lNPV = 0; for(unsigned int i0 = 0; i0 < fPupsPV.size(); i0++) if(fPupsPV[i0] <= lMed ) lNPV++; -// double lAdjust = 1.5*double(lNPV)/double(fPupsPV.size()+fNCount[iAlgo]); -// if(lAdjust > 0) fMedian[iAlgo] -= sqrt(ROOT::Math::chisquared_quantile(lAdjust,1.)*fRMS[iAlgo]); -// } //This code is probably a bit confusing double PuppiAlgo::compute(std::vector<double> const &iVals,double iChi2) const { diff --git a/CommonTools/PileupAlgos/src/PuppiContainer.cc b/CommonTools/PileupAlgos/src/PuppiContainer.cc index 1b73d5aeac761..83ff37219304d 100644 --- a/CommonTools/PileupAlgos/src/PuppiContainer.cc +++ b/CommonTools/PileupAlgos/src/PuppiContainer.cc @@ -42,10 +42,10 @@ void PuppiContainer::initialize(const std::vector<RecoObj> &iRecoObjects) { for (unsigned int i = 0; i < fRecoParticles.size(); i++){ fastjet::PseudoJet curPseudoJet; auto fRecoParticle = fRecoParticles[i]; - float nom = sqrt((fRecoParticle.m)*(fRecoParticle.m) + (fRecoParticle.pt)*(fRecoParticle.pt)*(cosh(fRecoParticle.eta))*(cosh(fRecoParticle.eta))) + (fRecoParticle.pt)*sinh(fRecoParticle.eta);//hacked - float denom = sqrt((fRecoParticle.m)*(fRecoParticle.m) + (fRecoParticle.pt)*(fRecoParticle.pt));//hacked - float rapidity = log(nom/denom);//hacked - curPseudoJet.reset_PtYPhiM(fRecoParticle.pt,rapidity,fRecoParticle.phi,fRecoParticle.m);//hacked + // float nom = sqrt((fRecoParticle.m)*(fRecoParticle.m) + (fRecoParticle.pt)*(fRecoParticle.pt)*(cosh(fRecoParticle.eta))*(cosh(fRecoParticle.eta))) + (fRecoParticle.pt)*sinh(fRecoParticle.eta);//hacked + // float denom = sqrt((fRecoParticle.m)*(fRecoParticle.m) + (fRecoParticle.pt)*(fRecoParticle.pt));//hacked + // float rapidity = log(nom/denom);//hacked + curPseudoJet.reset_PtYPhiM(fRecoParticle.pt,fRecoParticle.rapidity,fRecoParticle.phi,fRecoParticle.m);//hacked //curPseudoJet.reset_PtYPhiM(fRecoParticle.pt,fRecoParticle.eta,fRecoParticle.phi,fRecoParticle.m); int puppi_register = 0; if(fRecoParticle.id == 0 or fRecoParticle.charge == 0) puppi_register = 0; // zero is neutral hadron diff --git a/CommonTools/PileupAlgos/test/testPUMods.py b/CommonTools/PileupAlgos/test/testPUMods.py index 976e44c0b463a..c0a0f4e39a95b 100644 --- a/CommonTools/PileupAlgos/test/testPUMods.py +++ b/CommonTools/PileupAlgos/test/testPUMods.py @@ -5,10 +5,8 @@ process.load('FWCore/MessageService/MessageLogger_cfi') process.load('Configuration/StandardSequences/FrontierConditions_GlobalTag_cff') process.MessageLogger.cerr.FwkReport.reportEvery = 10 -#process.GlobalTag.globaltag = 'MCRUN2_75::All' -#process.GlobalTag.globaltag = 'auto:run1_mc' from Configuration.AlCa.GlobalTag import GlobalTag -process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:run1_mc', '') +process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:run2_mc', '') process.load('CommonTools/PileupAlgos/Puppi_cff') process.load('CommonTools/PileupAlgos/softKiller_cfi') From c7b5febac2255f4000249f355f7c1faf7630197a Mon Sep 17 00:00:00 2001 From: nhanvtran <nhan.v.tran@gmail.com> Date: Mon, 18 May 2015 17:17:58 -0500 Subject: [PATCH 11/26] more fixes from comments from Slava, all should be fixed --- CommonTools/PileupAlgos/interface/PuppiAlgo.h | 9 +++++--- .../PileupAlgos/plugins/PuppiProducer.cc | 22 +++++-------------- CommonTools/PileupAlgos/src/PuppiContainer.cc | 4 ++-- 3 files changed, 14 insertions(+), 21 deletions(-) diff --git a/CommonTools/PileupAlgos/interface/PuppiAlgo.h b/CommonTools/PileupAlgos/interface/PuppiAlgo.h index ea04ab731451d..7c02713a730d3 100644 --- a/CommonTools/PileupAlgos/interface/PuppiAlgo.h +++ b/CommonTools/PileupAlgos/interface/PuppiAlgo.h @@ -16,7 +16,7 @@ class PuppiAlgo{ void computeMedRMS(const unsigned int &iAlgo,const double &iPVFrac); //Get the Weight double compute(std::vector<double> const &iVals,double iChi2) const; - const std::vector<float> alphas(){ return fPups; } + const std::vector<float> & alphas(){ return fPups; } //Helpers inline double ptMin() const { return fPtMin; } inline double etaMin() const { return fEtaMin; } @@ -27,8 +27,8 @@ class PuppiAlgo{ inline double coneSize ( unsigned int iAlgo) const { return fConeSize.at(iAlgo); } inline double neutralPt (int iNPV) const { return fNeutralPtMin + iNPV * fNeutralPtSlope; } - std::vector<double> fRMS; - std::vector<double> fMedian; + inline double RMS( unsigned int i ) const {return fRMS[i];} + inline double Median( unsigned int i ) const {return fMedian[i];} private: unsigned int fNAlgos; @@ -42,6 +42,9 @@ class PuppiAlgo{ double fMedEtaSF; double fEtaMaxExtrap; + std::vector<double> fRMS; + std::vector<double> fMedian; + std::vector<float> fPups; std::vector<float> fPupsPV; std::vector<int> fAlgoId; diff --git a/CommonTools/PileupAlgos/plugins/PuppiProducer.cc b/CommonTools/PileupAlgos/plugins/PuppiProducer.cc index 9088ce9acf2b2..a3af77d698b39 100644 --- a/CommonTools/PileupAlgos/plugins/PuppiProducer.cc +++ b/CommonTools/PileupAlgos/plugins/PuppiProducer.cc @@ -204,25 +204,15 @@ void PuppiProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { ////////////////////////////////////////////// if (fPuppiDiagnostics){ - const std::vector<double> lAlphas = fPuppiContainer->puppiAlphas(); - const std::vector<double> lAlphasMed = fPuppiContainer->puppiAlphasMed(); - const std::vector<double> lAlphasRms = fPuppiContainer->puppiAlphasRMS(); - const std::vector<double> lRawAlphas = fPuppiContainer->puppiRawAlphas(); - double lNAlgos = (double) fPuppiContainer->puppiNAlgos(); // all the different alphas per particle - std::auto_ptr<std::vector<double> > alphas(new std::vector<double>); - for (unsigned int i = 0; i < lRawAlphas.size(); i++){ - alphas->push_back( lRawAlphas[i] ); - } // THE alpha per particle - std::auto_ptr<std::vector<double> > theAlphas(new std::vector<double>); - std::auto_ptr<std::vector<double> > theAlphasMed(new std::vector<double>); - std::auto_ptr<std::vector<double> > theAlphasRms(new std::vector<double>); - for (unsigned int i = 0; i < lAlphas.size(); i++){ theAlphas->push_back( lAlphas[i] ); } - for (unsigned int i = 0; i < lAlphasMed.size(); i++){ theAlphasMed->push_back( lAlphasMed[i] ); } - for (unsigned int i = 0; i < lAlphasRms.size(); i++){ theAlphasRms->push_back( lAlphasRms[i] ); } - std::auto_ptr<double> nalgos(new double(lNAlgos)); + std::auto_ptr<std::vector<double> > theAlphas(new std::vector<double>(fPuppiContainer->puppiAlphas())); + std::auto_ptr<std::vector<double> > theAlphasMed(new std::vector<double>(fPuppiContainer->puppiAlphasMed())); + std::auto_ptr<std::vector<double> > theAlphasRms(new std::vector<double>(fPuppiContainer->puppiAlphasRMS())); + std::auto_ptr<std::vector<double> > alphas(new std::vector<double>(fPuppiContainer->puppiRawAlphas())); + std::auto_ptr<double> nalgos(new double(fPuppiContainer->puppiNAlgos())); + iEvent.put(alphas,"PuppiRawAlphas"); iEvent.put(nalgos,"PuppiNAlgos"); iEvent.put(theAlphas,"PuppiAlphas"); diff --git a/CommonTools/PileupAlgos/src/PuppiContainer.cc b/CommonTools/PileupAlgos/src/PuppiContainer.cc index 83ff37219304d..44a0ffbe2e08f 100644 --- a/CommonTools/PileupAlgos/src/PuppiContainer.cc +++ b/CommonTools/PileupAlgos/src/PuppiContainer.cc @@ -239,8 +239,8 @@ std::vector<double> const & PuppiContainer::puppiWeights() { //std::cout << "fRecoParticles[i0].pt = " << fRecoParticles[i0].pt << ", fRecoParticles[i0].charge = " << fRecoParticles[i0].charge << ", fRecoParticles[i0].id = " << fRecoParticles[i0].id << ", weight = " << pWeight << std::endl; fWeights .push_back(pWeight); - fAlphaMed.push_back(fPuppiAlgo[pPupId].fMedian[0]); - fAlphaRMS.push_back(fPuppiAlgo[pPupId].fRMS [0]); + fAlphaMed.push_back(fPuppiAlgo[pPupId].Median(0)); + fAlphaRMS.push_back(fPuppiAlgo[pPupId].RMS(0)); //Now get rid of the thrown out weights for the particle collection if(std::abs(pWeight) < std::numeric_limits<double>::denorm_min() ) continue; //Produce From ed928db3e6df550149eb73f0cacf7fb70e6526cc Mon Sep 17 00:00:00 2001 From: nhanvtran <nhan.v.tran@gmail.com> Date: Mon, 18 May 2015 21:11:46 -0500 Subject: [PATCH 12/26] changing case of method names --- CommonTools/PileupAlgos/interface/PuppiAlgo.h | 4 ++-- CommonTools/PileupAlgos/src/PuppiContainer.cc | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CommonTools/PileupAlgos/interface/PuppiAlgo.h b/CommonTools/PileupAlgos/interface/PuppiAlgo.h index 7c02713a730d3..f65323c297178 100644 --- a/CommonTools/PileupAlgos/interface/PuppiAlgo.h +++ b/CommonTools/PileupAlgos/interface/PuppiAlgo.h @@ -27,8 +27,8 @@ class PuppiAlgo{ inline double coneSize ( unsigned int iAlgo) const { return fConeSize.at(iAlgo); } inline double neutralPt (int iNPV) const { return fNeutralPtMin + iNPV * fNeutralPtSlope; } - inline double RMS( unsigned int i ) const {return fRMS[i];} - inline double Median( unsigned int i ) const {return fMedian[i];} + inline double rms( unsigned int i ) const {return fRMS[i];} + inline double median( unsigned int i ) const {return fMedian[i];} private: unsigned int fNAlgos; diff --git a/CommonTools/PileupAlgos/src/PuppiContainer.cc b/CommonTools/PileupAlgos/src/PuppiContainer.cc index 44a0ffbe2e08f..489f529d9820e 100644 --- a/CommonTools/PileupAlgos/src/PuppiContainer.cc +++ b/CommonTools/PileupAlgos/src/PuppiContainer.cc @@ -239,8 +239,8 @@ std::vector<double> const & PuppiContainer::puppiWeights() { //std::cout << "fRecoParticles[i0].pt = " << fRecoParticles[i0].pt << ", fRecoParticles[i0].charge = " << fRecoParticles[i0].charge << ", fRecoParticles[i0].id = " << fRecoParticles[i0].id << ", weight = " << pWeight << std::endl; fWeights .push_back(pWeight); - fAlphaMed.push_back(fPuppiAlgo[pPupId].Median(0)); - fAlphaRMS.push_back(fPuppiAlgo[pPupId].RMS(0)); + fAlphaMed.push_back(fPuppiAlgo[pPupId].median(0)); + fAlphaRMS.push_back(fPuppiAlgo[pPupId].rms(0)); //Now get rid of the thrown out weights for the particle collection if(std::abs(pWeight) < std::numeric_limits<double>::denorm_min() ) continue; //Produce From fad6cb2045e53fd76d0903bec04ae5f5968ce287 Mon Sep 17 00:00:00 2001 From: Mia <mia.tosi@cern.ch> Date: Tue, 19 May 2015 18:15:10 +0200 Subject: [PATCH 13/26] move PointSeededTrackingRegionsProducer.h from RecoTauTag/HLTProducers to RecoTracker/TkTrackingRegions --- RecoTauTag/HLTProducers/src/SealModule.cc | 4 ++-- .../src/PointSeededTrackingRegionsProducer.h | 0 RecoTracker/TkTrackingRegions/src/SealModule.cc | 9 +++++++++ 3 files changed, 11 insertions(+), 2 deletions(-) rename {RecoTauTag/HLTProducers => RecoTracker/TkTrackingRegions}/src/PointSeededTrackingRegionsProducer.h (100%) create mode 100644 RecoTracker/TkTrackingRegions/src/SealModule.cc diff --git a/RecoTauTag/HLTProducers/src/SealModule.cc b/RecoTauTag/HLTProducers/src/SealModule.cc index f09184d0a0c43..34a1c2342a57e 100644 --- a/RecoTauTag/HLTProducers/src/SealModule.cc +++ b/RecoTauTag/HLTProducers/src/SealModule.cc @@ -15,7 +15,7 @@ #include "TauRegionalPixelSeedGenerator.h" #include "TrackingRegionsFromBeamSpotAndL2Tau.h" #include "CandidateSeededTrackingRegionsProducer.h" -#include "RecoTauTag/HLTProducers/src/PointSeededTrackingRegionsProducer.h" +//#include "RecoTauTag/HLTProducers/src/PointSeededTrackingRegionsProducer.h" #include "RecoTauTag/HLTProducers/interface/L2TauIsolationSelector.h" #include "RecoTauTag/HLTProducers/interface/L2TauRelaxingIsolationSelector.h" #include "RecoTauTag/HLTProducers/interface/L2TauIsolationProducer.h" @@ -33,7 +33,7 @@ DEFINE_EDM_PLUGIN(TrackingRegionProducerFactory, TauRegionalPixelSeedGenerator, "TauRegionalPixelSeedGenerator"); DEFINE_EDM_PLUGIN(TrackingRegionProducerFactory, TrackingRegionsFromBeamSpotAndL2Tau, "TrackingRegionsFromBeamSpotAndL2Tau"); DEFINE_EDM_PLUGIN(TrackingRegionProducerFactory, CandidateSeededTrackingRegionsProducer, "CandidateSeededTrackingRegionsProducer"); -DEFINE_EDM_PLUGIN(TrackingRegionProducerFactory, PointSeededTrackingRegionsProducer, "PointSeededTrackingRegionsProducer"); +//DEFINE_EDM_PLUGIN(TrackingRegionProducerFactory, PointSeededTrackingRegionsProducer, "PointSeededTrackingRegionsProducer"); // DEFINE_FWK_MODULE(IsolatedTauJetsSelector); DEFINE_FWK_MODULE(EMIsolatedTauJetsSelector); diff --git a/RecoTauTag/HLTProducers/src/PointSeededTrackingRegionsProducer.h b/RecoTracker/TkTrackingRegions/src/PointSeededTrackingRegionsProducer.h similarity index 100% rename from RecoTauTag/HLTProducers/src/PointSeededTrackingRegionsProducer.h rename to RecoTracker/TkTrackingRegions/src/PointSeededTrackingRegionsProducer.h diff --git a/RecoTracker/TkTrackingRegions/src/SealModule.cc b/RecoTracker/TkTrackingRegions/src/SealModule.cc new file mode 100644 index 0000000000000..4248da393dce9 --- /dev/null +++ b/RecoTracker/TkTrackingRegions/src/SealModule.cc @@ -0,0 +1,9 @@ +#include "FWCore/PluginManager/interface/ModuleDef.h" +#include "FWCore/Framework/interface/MakerMacros.h" +#include "RecoTracker/TkTrackingRegions/interface/TrackingRegionProducerFactory.h" +#include "RecoTracker/TkTrackingRegions/interface/TrackingRegionProducer.h" +#include "RecoTracker/TkTrackingRegions/src/PointSeededTrackingRegionsProducer.h" +#include "RecoTracker/MeasurementDet/interface/MeasurementTrackerEvent.h" + +DEFINE_EDM_PLUGIN(TrackingRegionProducerFactory, PointSeededTrackingRegionsProducer, "PointSeededTrackingRegionsProducer"); +// From 0cb9bf74b1c3e94131cf5ac3bd9508a59be77c7b Mon Sep 17 00:00:00 2001 From: Mia <mia.tosi@cern.ch> Date: Tue, 19 May 2015 19:00:49 +0200 Subject: [PATCH 14/26] restore RecoTauTag/HLTProducers/src/SealModule.cc --- RecoTauTag/HLTProducers/src/SealModule.cc | 2 -- 1 file changed, 2 deletions(-) diff --git a/RecoTauTag/HLTProducers/src/SealModule.cc b/RecoTauTag/HLTProducers/src/SealModule.cc index 34a1c2342a57e..2000ad2b29bd8 100644 --- a/RecoTauTag/HLTProducers/src/SealModule.cc +++ b/RecoTauTag/HLTProducers/src/SealModule.cc @@ -15,7 +15,6 @@ #include "TauRegionalPixelSeedGenerator.h" #include "TrackingRegionsFromBeamSpotAndL2Tau.h" #include "CandidateSeededTrackingRegionsProducer.h" -//#include "RecoTauTag/HLTProducers/src/PointSeededTrackingRegionsProducer.h" #include "RecoTauTag/HLTProducers/interface/L2TauIsolationSelector.h" #include "RecoTauTag/HLTProducers/interface/L2TauRelaxingIsolationSelector.h" #include "RecoTauTag/HLTProducers/interface/L2TauIsolationProducer.h" @@ -33,7 +32,6 @@ DEFINE_EDM_PLUGIN(TrackingRegionProducerFactory, TauRegionalPixelSeedGenerator, "TauRegionalPixelSeedGenerator"); DEFINE_EDM_PLUGIN(TrackingRegionProducerFactory, TrackingRegionsFromBeamSpotAndL2Tau, "TrackingRegionsFromBeamSpotAndL2Tau"); DEFINE_EDM_PLUGIN(TrackingRegionProducerFactory, CandidateSeededTrackingRegionsProducer, "CandidateSeededTrackingRegionsProducer"); -//DEFINE_EDM_PLUGIN(TrackingRegionProducerFactory, PointSeededTrackingRegionsProducer, "PointSeededTrackingRegionsProducer"); // DEFINE_FWK_MODULE(IsolatedTauJetsSelector); DEFINE_FWK_MODULE(EMIsolatedTauJetsSelector); From f38822d1959e2459a70ffe5d7f90e46cca453f99 Mon Sep 17 00:00:00 2001 From: Martin Grunewald <Martin.Grunewald@cern.ch> Date: Wed, 20 May 2015 09:41:55 +0200 Subject: [PATCH 15/26] Move to v2 of lowPU L1T menu --- .../python/customise_overwriteL1Menu.py | 11 + L1Trigger/L1TCommon/python/customsPostLS1.py | 4 +- ...sions2015_lowPU_v2_L1T_Scales_20141121.xml | 1877 +++++++++++++++++ 3 files changed, 1890 insertions(+), 2 deletions(-) create mode 100644 L1TriggerConfig/L1GtConfigProducers/data/Luminosity/startup/L1Menu_Collisions2015_lowPU_v2_L1T_Scales_20141121.xml diff --git a/L1Trigger/Configuration/python/customise_overwriteL1Menu.py b/L1Trigger/Configuration/python/customise_overwriteL1Menu.py index 610df64adf91d..68d73b09f4d46 100644 --- a/L1Trigger/Configuration/python/customise_overwriteL1Menu.py +++ b/L1Trigger/Configuration/python/customise_overwriteL1Menu.py @@ -78,6 +78,17 @@ def L1Menu_Collisions2015_lowPU_v1(process): return process +def L1Menu_Collisions2015_lowPU_v2(process): + process.load( 'L1TriggerConfig.L1GtConfigProducers.l1GtTriggerMenuXml_cfi' ) + process.l1GtTriggerMenuXml.TriggerMenuLuminosity = 'startup' + process.l1GtTriggerMenuXml.DefXmlFile = 'L1Menu_Collisions2015_lowPU_v2_L1T_Scales_20141121.xml' + + process.load( 'L1TriggerConfig.L1GtConfigProducers.L1GtTriggerMenuConfig_cff' ) + process.es_prefer_l1GtParameters = cms.ESPrefer( 'L1GtTriggerMenuXmlProducer', 'l1GtTriggerMenuXml' ) + + return process + + def L1Menu_CollisionsHeavyIons2015_v0(process): process.load( 'L1TriggerConfig.L1GtConfigProducers.l1GtTriggerMenuXml_cfi' ) process.l1GtTriggerMenuXml.TriggerMenuLuminosity = 'startup' diff --git a/L1Trigger/L1TCommon/python/customsPostLS1.py b/L1Trigger/L1TCommon/python/customsPostLS1.py index 4a151afc1dfe7..e84283c9df046 100644 --- a/L1Trigger/L1TCommon/python/customsPostLS1.py +++ b/L1Trigger/L1TCommon/python/customsPostLS1.py @@ -79,8 +79,8 @@ def customiseSimL1EmulatorForStage1(process): from L1Trigger.Configuration.customise_overwriteL1Menu import * def customiseSimL1EmulatorForPostLS1_lowPU(process): - # move to the lowPU v1 L1 menu once the HLT has been updated accordingly - process = L1Menu_Collisions2015_lowPU_v1(process) + # move to the lowPU v2 L1 menu once the HLT has been updated accordingly + process = L1Menu_Collisions2015_lowPU_v2(process) return process def customiseSimL1EmulatorForPostLS1_50ns(process): diff --git a/L1TriggerConfig/L1GtConfigProducers/data/Luminosity/startup/L1Menu_Collisions2015_lowPU_v2_L1T_Scales_20141121.xml b/L1TriggerConfig/L1GtConfigProducers/data/Luminosity/startup/L1Menu_Collisions2015_lowPU_v2_L1T_Scales_20141121.xml new file mode 100644 index 0000000000000..889b9d4484c17 --- /dev/null +++ b/L1TriggerConfig/L1GtConfigProducers/data/Luminosity/startup/L1Menu_Collisions2015_lowPU_v2_L1T_Scales_20141121.xml @@ -0,0 +1,1877 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<def> +<header> + <MenuInterface>L1Menu_Collisions2015_lowPU_v2</MenuInterface> + <MenuInterface_CreationDate>2015-05-18</MenuInterface_CreationDate> + <MenuInterface_CreationAuthor>V. M. Ghete, T. Matsushita</MenuInterface_CreationAuthor> + <MenuInterface_Description>L1 menu for pp data taking 2015, GCT version</MenuInterface_Description> + <Menu_CreationDate>2015-05-18T15:00:36.000000Z</Menu_CreationDate> + <Menu_CreationAuthor>V. M. Ghete, T. Matsushita</Menu_CreationAuthor> + <Menu_Description>L1 menu for pp data taking 2015</Menu_Description> + <AlgImplementation>Imp0</AlgImplementation> + <ScaleDbKey>L1T_Scales_20141121</ScaleDbKey> +</header> + <condition_chip_1> + <prealgos> + <L1_CastorHighJet algAlias="L1_CastorHighJet"> + CASTOR_TotalEnergy.v0 + <output_pin nr="6" pin="a" /> + </L1_CastorHighJet> + <L1_CastorMediumJet algAlias="L1_CastorMediumJet"> + CASTOR_EM.v0 + <output_pin nr="5" pin="a" /> + </L1_CastorMediumJet> + <L1_CastorMuon algAlias="L1_CastorMuon"> + CASTOR_HaloMuon.v0 + <output_pin nr="7" pin="a" /> + </L1_CastorMuon> + <L1_DoubleJet20 algAlias="L1_DoubleJet20"> + DoubleCenJet_0x05 OR DoubleForJet_0x05 OR DoubleTauJet_0x05 OR ( SingleCenJet_0x05 AND ( SingleForJet_0x05 OR SingleTauJet_0x05 ) ) OR ( SingleForJet_0x05 AND SingleTauJet_0x05 ) + <output_pin nr="1" pin="a" /> + </L1_DoubleJet20> + <L1_DoubleJet32 algAlias="L1_DoubleJet32"> + DoubleCenJet_0x08 OR DoubleForJet_0x08 OR DoubleTauJet_0x08 OR ( SingleCenJet_0x08 AND ( SingleForJet_0x08 OR SingleTauJet_0x08 ) ) OR ( SingleForJet_0x08 AND SingleTauJet_0x08 ) + <output_pin nr="2" pin="a" /> + </L1_DoubleJet32> + <L1_DoubleMuOpen algAlias="L1_DoubleMuOpen"> + DoubleMu_0x01_Open + <output_pin nr="4" pin="a" /> + </L1_DoubleMuOpen> + <L1_SingleMuOpen algAlias="L1_SingleMuOpen"> + SingleMu_0x01_Open + <output_pin nr="3" pin="a" /> + </L1_SingleMuOpen> + <L1_TOTEM_0 algAlias="L1_TOTEM_0"> + TOTEM_0 + <output_pin nr="10" pin="a" /> + </L1_TOTEM_0> + <L1_TOTEM_1 algAlias="L1_TOTEM_1"> + TOTEM_1 + <output_pin nr="8" pin="a" /> + </L1_TOTEM_1> + <L1_TOTEM_3 algAlias="L1_TOTEM_3"> + TOTEM_3 + <output_pin nr="9" pin="a" /> + </L1_TOTEM_3> + </prealgos> + <conditions> + <DoubleCenJet_0x05 condition="calo" particle="jet" type="2_s"> + <et_threshold max="3f" min="00"> + <ge_eq mode="bit"> + 1 + </ge_eq> + <value> + 05 + </value> + <value> + 05 + </value> + </et_threshold> + <eta max="7F7F" min="0000"> + <value> + 7F7F + </value> + <value> + 7F7F + </value> + </eta> + <phi max="3ffff" min="00000"> + <value> + 3ffff + </value> + <value> + 3ffff + </value> + </phi> + </DoubleCenJet_0x05> + <DoubleCenJet_0x08 condition="calo" particle="jet" type="2_s"> + <et_threshold max="3f" min="00"> + <ge_eq mode="bit"> + 1 + </ge_eq> + <value> + 08 + </value> + <value> + 08 + </value> + </et_threshold> + <eta max="7F7F" min="0000"> + <value> + 7F7F + </value> + <value> + 7F7F + </value> + </eta> + <phi max="3ffff" min="00000"> + <value> + 3ffff + </value> + <value> + 3ffff + </value> + </phi> + </DoubleCenJet_0x08> + <DoubleForJet_0x05 condition="calo" particle="fwdjet" type="2_s"> + <et_threshold max="3f" min="00"> + <ge_eq mode="bit"> + 1 + </ge_eq> + <value> + 05 + </value> + <value> + 05 + </value> + </et_threshold> + <eta max="0f0f" min="0000"> + <value> + 0F0F + </value> + <value> + 0F0F + </value> + </eta> + <phi max="3ffff" min="00000"> + <value> + 3ffff + </value> + <value> + 3ffff + </value> + </phi> + </DoubleForJet_0x05> + <DoubleForJet_0x08 condition="calo" particle="fwdjet" type="2_s"> + <et_threshold max="3f" min="00"> + <ge_eq mode="bit"> + 1 + </ge_eq> + <value> + 08 + </value> + <value> + 08 + </value> + </et_threshold> + <eta max="0f0f" min="0000"> + <value> + 0F0F + </value> + <value> + 0F0F + </value> + </eta> + <phi max="3ffff" min="00000"> + <value> + 3ffff + </value> + <value> + 3ffff + </value> + </phi> + </DoubleForJet_0x08> + <DoubleMu_0x01_Open condition="muon" particle="muon" type="2_s"> + <pt_h_threshold max="1f" min="00"> + <ge_eq mode="bit"> + 1 + </ge_eq> + <value> + 01 + </value> + <value> + 01 + </value> + </pt_h_threshold> + <pt_l_threshold max="1f" min="00"> + <value>01<en_mip mode="bit">0</en_mip> + <en_iso mode="bit"> + 0 + </en_iso> + <request_iso mode="bit"> + 0 + </request_iso> + </value> + <value>01<en_mip mode="bit">0</en_mip> + <en_iso mode="bit"> + 0 + </en_iso> + <request_iso mode="bit"> + 0 + </request_iso> + </value> + </pt_l_threshold> + <eta max="ffffffffffffffff" min="0000000000000000"> + <value> + FFFFFFFFFFFFFFFF + </value> + <value> + FFFFFFFFFFFFFFFF + </value> + </eta> + <phi_h max="8f" min="00"> + <value> + 8f + </value> + <value> + 8f + </value> + </phi_h> + <phi_l max="ffffffffffffffff" min="0000000000000000"> + <value> + 00 + </value> + <value> + 00 + </value> + </phi_l> + <charge_correlation max="7" min="1"> + 1 + </charge_correlation> + <quality max="ff" min="00"> + <value> + fc + </value> + <value> + fc + </value> + </quality> + </DoubleMu_0x01_Open> + <DoubleTauJet_0x05 condition="calo" particle="tau" type="2_s"> + <et_threshold max="3f" min="00"> + <ge_eq mode="bit"> + 1 + </ge_eq> + <value> + 05 + </value> + <value> + 05 + </value> + </et_threshold> + <eta max="7F7F" min="0000"> + <value> + 7F7F + </value> + <value> + 7F7F + </value> + </eta> + <phi max="3ffff" min="00000"> + <value> + 3ffff + </value> + <value> + 3ffff + </value> + </phi> + </DoubleTauJet_0x05> + <DoubleTauJet_0x08 condition="calo" particle="tau" type="2_s"> + <et_threshold max="3f" min="00"> + <ge_eq mode="bit"> + 1 + </ge_eq> + <value> + 08 + </value> + <value> + 08 + </value> + </et_threshold> + <eta max="7F7F" min="0000"> + <value> + 7F7F + </value> + <value> + 7F7F + </value> + </eta> + <phi max="3ffff" min="00000"> + <value> + 3ffff + </value> + <value> + 3ffff + </value> + </phi> + </DoubleTauJet_0x08> + <SingleCenJet_0x05 condition="calo" particle="jet" type="1_s"> + <et_threshold max="3f" min="00"> + <ge_eq mode="bit"> + 1 + </ge_eq> + <value> + 05 + </value> + </et_threshold> + <eta max="7F7F" min="0000"> + <value> + 7F7F + </value> + </eta> + <phi max="3ffff" min="00000"> + <value> + 3ffff + </value> + </phi> + </SingleCenJet_0x05> + <SingleCenJet_0x08 condition="calo" particle="jet" type="1_s"> + <et_threshold max="3f" min="00"> + <ge_eq mode="bit"> + 1 + </ge_eq> + <value> + 08 + </value> + </et_threshold> + <eta max="7F7F" min="0000"> + <value> + 7F7F + </value> + </eta> + <phi max="3ffff" min="00000"> + <value> + 3ffff + </value> + </phi> + </SingleCenJet_0x08> + <SingleForJet_0x05 condition="calo" particle="fwdjet" type="1_s"> + <et_threshold max="3f" min="00"> + <ge_eq mode="bit"> + 1 + </ge_eq> + <value> + 05 + </value> + </et_threshold> + <eta max="0f0f" min="0000"> + <value> + 0F0F + </value> + </eta> + <phi max="3ffff" min="00000"> + <value> + 3ffff + </value> + </phi> + </SingleForJet_0x05> + <SingleForJet_0x08 condition="calo" particle="fwdjet" type="1_s"> + <et_threshold max="3f" min="00"> + <ge_eq mode="bit"> + 1 + </ge_eq> + <value> + 08 + </value> + </et_threshold> + <eta max="0f0f" min="0000"> + <value> + 0F0F + </value> + </eta> + <phi max="3ffff" min="00000"> + <value> + 3ffff + </value> + </phi> + </SingleForJet_0x08> + <SingleMu_0x01_Open condition="muon" particle="muon" type="1_s"> + <pt_h_threshold max="1f" min="00"> + <ge_eq mode="bit"> + 1 + </ge_eq> + <value> + 01 + </value> + </pt_h_threshold> + <pt_l_threshold max="1f" min="00"> + <value>01<en_mip mode="bit">0</en_mip> + <en_iso mode="bit"> + 0 + </en_iso> + <request_iso mode="bit"> + 0 + </request_iso> + </value> + </pt_l_threshold> + <eta max="ffffffffffffffff" min="0000000000000000"> + <value> + FFFFFFFFFFFFFFFF + </value> + </eta> + <phi_h max="8f" min="00"> + <value> + 8f + </value> + </phi_h> + <phi_l max="ffffffffffffffff" min="0000000000000000"> + <value> + 00 + </value> + </phi_l> + <charge_correlation max="7" min="1"> + 1 + </charge_correlation> + <quality max="ff" min="00"> + <value> + fc + </value> + </quality> + </SingleMu_0x01_Open> + <SingleTauJet_0x05 condition="calo" particle="tau" type="1_s"> + <et_threshold max="3f" min="00"> + <ge_eq mode="bit"> + 1 + </ge_eq> + <value> + 05 + </value> + </et_threshold> + <eta max="7F7F" min="0000"> + <value> + 7F7F + </value> + </eta> + <phi max="3ffff" min="00000"> + <value> + 3ffff + </value> + </phi> + </SingleTauJet_0x05> + <SingleTauJet_0x08 condition="calo" particle="tau" type="1_s"> + <et_threshold max="3f" min="00"> + <ge_eq mode="bit"> + 1 + </ge_eq> + <value> + 08 + </value> + </et_threshold> + <eta max="7F7F" min="0000"> + <value> + 7F7F + </value> + </eta> + <phi max="3ffff" min="00000"> + <value> + 3ffff + </value> + </phi> + </SingleTauJet_0x08> + <CASTOR_EM.v0 condition="CondExternal" particle="GtExternal" type="TypeExternal"></CASTOR_EM.v0> + <CASTOR_HaloMuon.v0 condition="CondExternal" particle="GtExternal" type="TypeExternal"></CASTOR_HaloMuon.v0> + <CASTOR_TotalEnergy.v0 condition="CondExternal" particle="GtExternal" type="TypeExternal"></CASTOR_TotalEnergy.v0> + <TOTEM_0 condition="CondExternal" particle="GtExternal" type="TypeExternal"></TOTEM_0> + <TOTEM_1 condition="CondExternal" particle="GtExternal" type="TypeExternal"></TOTEM_1> + <TOTEM_3 condition="CondExternal" particle="GtExternal" type="TypeExternal"></TOTEM_3> + </conditions> + </condition_chip_1> + <condition_chip_2> + <prealgos> + <L1_AlwaysTrue algAlias="L1_AlwaysTrue"> + BPTX_plus_AND_minus.v0 OR ( NOT BPTX_plus_AND_minus.v0 ) + <output_pin nr="2" pin="a" /> + </L1_AlwaysTrue> + <L1_DoubleJet28 algAlias="L1_DoubleJet28"> + DoubleCenJet_0x07 OR DoubleForJet_0x07 OR DoubleTauJet_0x07 OR ( SingleCenJet_0x07 AND ( SingleForJet_0x07 OR SingleTauJet_0x07 ) ) OR ( SingleForJet_0x07 AND SingleTauJet_0x07 ) + <output_pin nr="22" pin="a" /> + </L1_DoubleJet28> + <L1_ETT130 algAlias="L1_ETT130"> + ETT_0x104 + <output_pin nr="45" pin="a" /> + </L1_ETT130> + <L1_ETT15 algAlias="L1_ETT15"> + ETT_0x01E + <output_pin nr="41" pin="a" /> + </L1_ETT15> + <L1_ETT40 algAlias="L1_ETT40"> + ETT_0x050 + <output_pin nr="42" pin="a" /> + </L1_ETT40> + <L1_ETT60 algAlias="L1_ETT60"> + ETT_0x078 + <output_pin nr="43" pin="a" /> + </L1_ETT60> + <L1_ETT90 algAlias="L1_ETT90"> + ETT_0x0B4 + <output_pin nr="44" pin="a" /> + </L1_ETT90> + <L1_MinimumBiasHF1_AND_v1 algAlias="L1_MinimumBiasHF1_AND"> + ( HfBitCounts_Ind0_0x1 AND HfBitCounts_Ind1_0x1 ) AND BPTX_plus_AND_minus.v0 + <output_pin nr="7" pin="a" /> + </L1_MinimumBiasHF1_AND_v1> + <L1_MinimumBiasHF1_OR algAlias="L1_MinimumBiasHF1_OR"> + ( HfBitCounts_Ind0_0x1 OR HfBitCounts_Ind1_0x1 ) AND BPTX_plus_AND_minus.v0 + <output_pin nr="5" pin="a" /> + </L1_MinimumBiasHF1_OR> + <L1_MinimumBiasHF2_AND algAlias="L1_MinimumBiasHF2_AND"> + ( HfBitCounts_Ind2_0x1 AND HfBitCounts_Ind3_0x1 ) AND BPTX_plus_AND_minus.v0 + <output_pin nr="8" pin="a" /> + </L1_MinimumBiasHF2_AND> + <L1_MinimumBiasHF2_OR algAlias="L1_MinimumBiasHF2_OR"> + ( HfBitCounts_Ind2_0x1 OR HfBitCounts_Ind3_0x1 ) AND BPTX_plus_AND_minus.v0 + <output_pin nr="6" pin="a" /> + </L1_MinimumBiasHF2_OR> + <L1_SingleEG20 algAlias="L1_SingleEG20"> + SingleNoIsoEG_0x14 OR SingleIsoEG_0x14 + <output_pin nr="33" pin="a" /> + </L1_SingleEG20> + <L1_SingleEG2_BptxAND algAlias="L1_SingleEG2_BptxAND"> + ( SingleNoIsoEG_0x02 OR SingleIsoEG_0x02 ) AND BPTX_plus_AND_minus.v0 + <output_pin nr="31" pin="a" /> + </L1_SingleEG2_BptxAND> + <L1_SingleEG5 algAlias="L1_SingleEG5"> + SingleNoIsoEG_0x05 OR SingleIsoEG_0x05 + <output_pin nr="32" pin="a" /> + </L1_SingleEG5> + <L1_SingleJet12_BptxAND algAlias="L1_SingleJet12_BptxAND"> + ( SingleCenJet_0x03 OR SingleForJet_0x03 OR SingleTauJet_0x03 ) AND BPTX_plus_AND_minus.v0 + <output_pin nr="12" pin="a" /> + </L1_SingleJet12_BptxAND> + <L1_SingleJet16 algAlias="L1_SingleJet16"> + SingleCenJet_0x04 OR SingleForJet_0x04 OR SingleTauJet_0x04 + <output_pin nr="13" pin="a" /> + </L1_SingleJet16> + <L1_SingleJet20 algAlias="L1_SingleJet20"> + SingleCenJet_0x05 OR SingleForJet_0x05 OR SingleTauJet_0x05 + <output_pin nr="14" pin="a" /> + </L1_SingleJet20> + <L1_SingleJet200 algAlias="L1_SingleJet200"> + SingleCenJet_0x32 OR SingleForJet_0x32 OR SingleTauJet_0x32 + <output_pin nr="17" pin="a" /> + </L1_SingleJet200> + <L1_SingleJet36 algAlias="L1_SingleJet36"> + SingleCenJet_0x09 OR SingleForJet_0x09 OR SingleTauJet_0x09 + <output_pin nr="15" pin="a" /> + </L1_SingleJet36> + <L1_SingleJet68 algAlias="L1_SingleJet68"> + SingleCenJet_0x11 OR SingleForJet_0x11 OR SingleTauJet_0x11 + <output_pin nr="16" pin="a" /> + </L1_SingleJet68> + <L1_SingleJet8_BptxAND algAlias="L1_SingleJet8_BptxAND"> + ( SingleCenJet_0x02 OR SingleForJet_0x02 OR SingleTauJet_0x02 ) AND BPTX_plus_AND_minus.v0 + <output_pin nr="11" pin="a" /> + </L1_SingleJet8_BptxAND> + <L1_SingleJetC20_NotBptxOR algAlias="L1_SingleJetC20_NotBptxOR"> + ( SingleCenJet_0x05 OR SingleTauJet_0x05 ) AND ( NOT ( BPTX_plus.v0 OR BPTX_minus.v0 ) ) + <output_pin nr="18" pin="a" /> + </L1_SingleJetC20_NotBptxOR> + <L1_SingleJetC32_NotBptxOR algAlias="L1_SingleJetC32_NotBptxOR"> + ( SingleCenJet_0x08 OR SingleTauJet_0x08 ) AND ( NOT ( BPTX_plus.v0 OR BPTX_minus.v0 ) ) + <output_pin nr="19" pin="a" /> + </L1_SingleJetC32_NotBptxOR> + <L1_SingleMu3p5 algAlias="L1_SingleMu3p5"> + SingleMu_0x06 + <output_pin nr="52" pin="a" /> + </L1_SingleMu3p5> + <L1_SingleMuBeamHalo algAlias="L1_SingleMuBeamHalo"> + SingleMu_0x01_BeamHalo + <output_pin nr="54" pin="a" /> + </L1_SingleMuBeamHalo> + <L1_SingleMuOpen_NotBptxOR algAlias="L1_SingleMuOpen_NotBptxOR"> + SingleMu_0x01_Open AND ( NOT ( BPTX_plus.v0 OR BPTX_minus.v0 ) ) + <output_pin nr="55" pin="a" /> + </L1_SingleMuOpen_NotBptxOR> + <L1_ZeroBias algAlias="L1_ZeroBias"> + BPTX_plus_AND_minus.v0 + <output_pin nr="1" pin="a" /> + </L1_ZeroBias> + </prealgos> + <conditions> + <DoubleCenJet_0x07 condition="calo" particle="jet" type="2_s"> + <et_threshold max="3f" min="00"> + <ge_eq mode="bit"> + 1 + </ge_eq> + <value> + 07 + </value> + <value> + 07 + </value> + </et_threshold> + <eta max="7F7F" min="0000"> + <value> + 7F7F + </value> + <value> + 7F7F + </value> + </eta> + <phi max="3ffff" min="00000"> + <value> + 3ffff + </value> + <value> + 3ffff + </value> + </phi> + </DoubleCenJet_0x07> + <DoubleForJet_0x07 condition="calo" particle="fwdjet" type="2_s"> + <et_threshold max="3f" min="00"> + <ge_eq mode="bit"> + 1 + </ge_eq> + <value> + 07 + </value> + <value> + 07 + </value> + </et_threshold> + <eta max="0f0f" min="0000"> + <value> + 0F0F + </value> + <value> + 0F0F + </value> + </eta> + <phi max="3ffff" min="00000"> + <value> + 3ffff + </value> + <value> + 3ffff + </value> + </phi> + </DoubleForJet_0x07> + <DoubleTauJet_0x07 condition="calo" particle="tau" type="2_s"> + <et_threshold max="3f" min="00"> + <ge_eq mode="bit"> + 1 + </ge_eq> + <value> + 07 + </value> + <value> + 07 + </value> + </et_threshold> + <eta max="7F7F" min="0000"> + <value> + 7F7F + </value> + <value> + 7F7F + </value> + </eta> + <phi max="3ffff" min="00000"> + <value> + 3ffff + </value> + <value> + 3ffff + </value> + </phi> + </DoubleTauJet_0x07> + <ETT_0x01E condition="esums" particle="ett" type="ett"> + <et_threshold max="fff" min="000"> + <ge_eq mode="bit"> + 1 + </ge_eq> + <en_overflow mode="bit"> + 0 + </en_overflow> + <value> + 01e + </value> + </et_threshold> + <phi max="ffffffffffffffffff" min="000000000000000000"> + <value> + 00 + </value> + </phi> + </ETT_0x01E> + <ETT_0x050 condition="esums" particle="ett" type="ett"> + <et_threshold max="fff" min="000"> + <ge_eq mode="bit"> + 1 + </ge_eq> + <en_overflow mode="bit"> + 0 + </en_overflow> + <value> + 050 + </value> + </et_threshold> + <phi max="ffffffffffffffffff" min="000000000000000000"> + <value> + 00 + </value> + </phi> + </ETT_0x050> + <ETT_0x078 condition="esums" particle="ett" type="ett"> + <et_threshold max="fff" min="000"> + <ge_eq mode="bit"> + 1 + </ge_eq> + <en_overflow mode="bit"> + 0 + </en_overflow> + <value> + 078 + </value> + </et_threshold> + <phi max="ffffffffffffffffff" min="000000000000000000"> + <value> + 00 + </value> + </phi> + </ETT_0x078> + <ETT_0x0B4 condition="esums" particle="ett" type="ett"> + <et_threshold max="fff" min="000"> + <ge_eq mode="bit"> + 1 + </ge_eq> + <en_overflow mode="bit"> + 0 + </en_overflow> + <value> + 0b4 + </value> + </et_threshold> + <phi max="ffffffffffffffffff" min="000000000000000000"> + <value> + 00 + </value> + </phi> + </ETT_0x0B4> + <ETT_0x104 condition="esums" particle="ett" type="ett"> + <et_threshold max="fff" min="000"> + <ge_eq mode="bit"> + 1 + </ge_eq> + <en_overflow mode="bit"> + 0 + </en_overflow> + <value> + 104 + </value> + </et_threshold> + <phi max="ffffffffffffffffff" min="000000000000000000"> + <value> + 00 + </value> + </phi> + </ETT_0x104> + <HfBitCounts_Ind0_0x1 condition="CondHfBitCounts" particle="HfBitCounts" type="0"> + <et_threshold max="7" min="0"> + <ge_eq mode="bit"> + 1 + </ge_eq> + <value> + 1 + </value> + </et_threshold> + </HfBitCounts_Ind0_0x1> + <HfBitCounts_Ind1_0x1 condition="CondHfBitCounts" particle="HfBitCounts" type="1"> + <et_threshold max="7" min="0"> + <ge_eq mode="bit"> + 1 + </ge_eq> + <value> + 1 + </value> + </et_threshold> + </HfBitCounts_Ind1_0x1> + <HfBitCounts_Ind2_0x1 condition="CondHfBitCounts" particle="HfBitCounts" type="2"> + <et_threshold max="7" min="0"> + <ge_eq mode="bit"> + 1 + </ge_eq> + <value> + 1 + </value> + </et_threshold> + </HfBitCounts_Ind2_0x1> + <HfBitCounts_Ind3_0x1 condition="CondHfBitCounts" particle="HfBitCounts" type="3"> + <et_threshold max="7" min="0"> + <ge_eq mode="bit"> + 1 + </ge_eq> + <value> + 1 + </value> + </et_threshold> + </HfBitCounts_Ind3_0x1> + <SingleCenJet_0x02 condition="calo" particle="jet" type="1_s"> + <et_threshold max="3f" min="00"> + <ge_eq mode="bit"> + 1 + </ge_eq> + <value> + 02 + </value> + </et_threshold> + <eta max="7F7F" min="0000"> + <value> + 7F7F + </value> + </eta> + <phi max="3ffff" min="00000"> + <value> + 3ffff + </value> + </phi> + </SingleCenJet_0x02> + <SingleCenJet_0x03 condition="calo" particle="jet" type="1_s"> + <et_threshold max="3f" min="00"> + <ge_eq mode="bit"> + 1 + </ge_eq> + <value> + 03 + </value> + </et_threshold> + <eta max="7F7F" min="0000"> + <value> + 7F7F + </value> + </eta> + <phi max="3ffff" min="00000"> + <value> + 3ffff + </value> + </phi> + </SingleCenJet_0x03> + <SingleCenJet_0x04 condition="calo" particle="jet" type="1_s"> + <et_threshold max="3f" min="00"> + <ge_eq mode="bit"> + 1 + </ge_eq> + <value> + 04 + </value> + </et_threshold> + <eta max="7F7F" min="0000"> + <value> + 7F7F + </value> + </eta> + <phi max="3ffff" min="00000"> + <value> + 3ffff + </value> + </phi> + </SingleCenJet_0x04> + <SingleCenJet_0x05 condition="calo" particle="jet" type="1_s"> + <et_threshold max="3f" min="00"> + <ge_eq mode="bit"> + 1 + </ge_eq> + <value> + 05 + </value> + </et_threshold> + <eta max="7F7F" min="0000"> + <value> + 7F7F + </value> + </eta> + <phi max="3ffff" min="00000"> + <value> + 3ffff + </value> + </phi> + </SingleCenJet_0x05> + <SingleCenJet_0x07 condition="calo" particle="jet" type="1_s"> + <et_threshold max="3f" min="00"> + <ge_eq mode="bit"> + 1 + </ge_eq> + <value> + 07 + </value> + </et_threshold> + <eta max="7F7F" min="0000"> + <value> + 7F7F + </value> + </eta> + <phi max="3ffff" min="00000"> + <value> + 3ffff + </value> + </phi> + </SingleCenJet_0x07> + <SingleCenJet_0x08 condition="calo" particle="jet" type="1_s"> + <et_threshold max="3f" min="00"> + <ge_eq mode="bit"> + 1 + </ge_eq> + <value> + 08 + </value> + </et_threshold> + <eta max="7F7F" min="0000"> + <value> + 7F7F + </value> + </eta> + <phi max="3ffff" min="00000"> + <value> + 3ffff + </value> + </phi> + </SingleCenJet_0x08> + <SingleCenJet_0x09 condition="calo" particle="jet" type="1_s"> + <et_threshold max="3f" min="00"> + <ge_eq mode="bit"> + 1 + </ge_eq> + <value> + 09 + </value> + </et_threshold> + <eta max="7F7F" min="0000"> + <value> + 7F7F + </value> + </eta> + <phi max="3ffff" min="00000"> + <value> + 3ffff + </value> + </phi> + </SingleCenJet_0x09> + <SingleCenJet_0x11 condition="calo" particle="jet" type="1_s"> + <et_threshold max="3f" min="00"> + <ge_eq mode="bit"> + 1 + </ge_eq> + <value> + 11 + </value> + </et_threshold> + <eta max="7F7F" min="0000"> + <value> + 7F7F + </value> + </eta> + <phi max="3ffff" min="00000"> + <value> + 3ffff + </value> + </phi> + </SingleCenJet_0x11> + <SingleCenJet_0x32 condition="calo" particle="jet" type="1_s"> + <et_threshold max="3f" min="00"> + <ge_eq mode="bit"> + 1 + </ge_eq> + <value> + 32 + </value> + </et_threshold> + <eta max="7F7F" min="0000"> + <value> + 7F7F + </value> + </eta> + <phi max="3ffff" min="00000"> + <value> + 3ffff + </value> + </phi> + </SingleCenJet_0x32> + <SingleForJet_0x02 condition="calo" particle="fwdjet" type="1_s"> + <et_threshold max="3f" min="00"> + <ge_eq mode="bit"> + 1 + </ge_eq> + <value> + 02 + </value> + </et_threshold> + <eta max="0f0f" min="0000"> + <value> + 0F0F + </value> + </eta> + <phi max="3ffff" min="00000"> + <value> + 3ffff + </value> + </phi> + </SingleForJet_0x02> + <SingleForJet_0x03 condition="calo" particle="fwdjet" type="1_s"> + <et_threshold max="3f" min="00"> + <ge_eq mode="bit"> + 1 + </ge_eq> + <value> + 03 + </value> + </et_threshold> + <eta max="0f0f" min="0000"> + <value> + 0F0F + </value> + </eta> + <phi max="3ffff" min="00000"> + <value> + 3ffff + </value> + </phi> + </SingleForJet_0x03> + <SingleForJet_0x04 condition="calo" particle="fwdjet" type="1_s"> + <et_threshold max="3f" min="00"> + <ge_eq mode="bit"> + 1 + </ge_eq> + <value> + 04 + </value> + </et_threshold> + <eta max="0f0f" min="0000"> + <value> + 0F0F + </value> + </eta> + <phi max="3ffff" min="00000"> + <value> + 3ffff + </value> + </phi> + </SingleForJet_0x04> + <SingleForJet_0x05 condition="calo" particle="fwdjet" type="1_s"> + <et_threshold max="3f" min="00"> + <ge_eq mode="bit"> + 1 + </ge_eq> + <value> + 05 + </value> + </et_threshold> + <eta max="0f0f" min="0000"> + <value> + 0F0F + </value> + </eta> + <phi max="3ffff" min="00000"> + <value> + 3ffff + </value> + </phi> + </SingleForJet_0x05> + <SingleForJet_0x07 condition="calo" particle="fwdjet" type="1_s"> + <et_threshold max="3f" min="00"> + <ge_eq mode="bit"> + 1 + </ge_eq> + <value> + 07 + </value> + </et_threshold> + <eta max="0f0f" min="0000"> + <value> + 0F0F + </value> + </eta> + <phi max="3ffff" min="00000"> + <value> + 3ffff + </value> + </phi> + </SingleForJet_0x07> + <SingleForJet_0x09 condition="calo" particle="fwdjet" type="1_s"> + <et_threshold max="3f" min="00"> + <ge_eq mode="bit"> + 1 + </ge_eq> + <value> + 09 + </value> + </et_threshold> + <eta max="0f0f" min="0000"> + <value> + 0F0F + </value> + </eta> + <phi max="3ffff" min="00000"> + <value> + 3ffff + </value> + </phi> + </SingleForJet_0x09> + <SingleForJet_0x11 condition="calo" particle="fwdjet" type="1_s"> + <et_threshold max="3f" min="00"> + <ge_eq mode="bit"> + 1 + </ge_eq> + <value> + 11 + </value> + </et_threshold> + <eta max="0f0f" min="0000"> + <value> + 0F0F + </value> + </eta> + <phi max="3ffff" min="00000"> + <value> + 3ffff + </value> + </phi> + </SingleForJet_0x11> + <SingleForJet_0x32 condition="calo" particle="fwdjet" type="1_s"> + <et_threshold max="3f" min="00"> + <ge_eq mode="bit"> + 1 + </ge_eq> + <value> + 32 + </value> + </et_threshold> + <eta max="0f0f" min="0000"> + <value> + 0F0F + </value> + </eta> + <phi max="3ffff" min="00000"> + <value> + 3ffff + </value> + </phi> + </SingleForJet_0x32> + <SingleIsoEG_0x02 condition="calo" particle="ieg" type="1_s"> + <et_threshold max="3f" min="00"> + <ge_eq mode="bit"> + 1 + </ge_eq> + <value> + 02 + </value> + </et_threshold> + <eta max="7F7F" min="0000"> + <value> + 7F7F + </value> + </eta> + <phi max="3ffff" min="00000"> + <value> + 3ffff + </value> + </phi> + </SingleIsoEG_0x02> + <SingleIsoEG_0x05 condition="calo" particle="ieg" type="1_s"> + <et_threshold max="3f" min="00"> + <ge_eq mode="bit"> + 1 + </ge_eq> + <value> + 05 + </value> + </et_threshold> + <eta max="7F7F" min="0000"> + <value> + 7F7F + </value> + </eta> + <phi max="3ffff" min="00000"> + <value> + 3ffff + </value> + </phi> + </SingleIsoEG_0x05> + <SingleIsoEG_0x14 condition="calo" particle="ieg" type="1_s"> + <et_threshold max="3f" min="00"> + <ge_eq mode="bit"> + 1 + </ge_eq> + <value> + 14 + </value> + </et_threshold> + <eta max="7F7F" min="0000"> + <value> + 7F7F + </value> + </eta> + <phi max="3ffff" min="00000"> + <value> + 3ffff + </value> + </phi> + </SingleIsoEG_0x14> + <SingleMu_0x01_BeamHalo condition="muon" particle="muon" type="1_s"> + <pt_h_threshold max="1f" min="00"> + <ge_eq mode="bit"> + 1 + </ge_eq> + <value> + 01 + </value> + </pt_h_threshold> + <pt_l_threshold max="1f" min="00"> + <value>01<en_mip mode="bit">0</en_mip> + <en_iso mode="bit"> + 0 + </en_iso> + <request_iso mode="bit"> + 0 + </request_iso> + </value> + </pt_l_threshold> + <eta max="ffffffffffffffff" min="0000000000000000"> + <value> + FFFFFFFFFFFFFFFF + </value> + </eta> + <phi_h max="8f" min="00"> + <value> + 8f + </value> + </phi_h> + <phi_l max="ffffffffffffffff" min="0000000000000000"> + <value> + 00 + </value> + </phi_l> + <charge_correlation max="7" min="1"> + 1 + </charge_correlation> + <quality max="ff" min="00"> + <value> + 02 + </value> + </quality> + </SingleMu_0x01_BeamHalo> + <SingleMu_0x01_Open condition="muon" particle="muon" type="1_s"> + <pt_h_threshold max="1f" min="00"> + <ge_eq mode="bit"> + 1 + </ge_eq> + <value> + 01 + </value> + </pt_h_threshold> + <pt_l_threshold max="1f" min="00"> + <value>01<en_mip mode="bit">0</en_mip> + <en_iso mode="bit"> + 0 + </en_iso> + <request_iso mode="bit"> + 0 + </request_iso> + </value> + </pt_l_threshold> + <eta max="ffffffffffffffff" min="0000000000000000"> + <value> + FFFFFFFFFFFFFFFF + </value> + </eta> + <phi_h max="8f" min="00"> + <value> + 8f + </value> + </phi_h> + <phi_l max="ffffffffffffffff" min="0000000000000000"> + <value> + 00 + </value> + </phi_l> + <charge_correlation max="7" min="1"> + 1 + </charge_correlation> + <quality max="ff" min="00"> + <value> + fc + </value> + </quality> + </SingleMu_0x01_Open> + <SingleMu_0x06 condition="muon" particle="muon" type="1_s"> + <pt_h_threshold max="1f" min="00"> + <ge_eq mode="bit"> + 1 + </ge_eq> + <value> + 06 + </value> + </pt_h_threshold> + <pt_l_threshold max="1f" min="00"> + <value>06<en_mip mode="bit">0</en_mip> + <en_iso mode="bit"> + 0 + </en_iso> + <request_iso mode="bit"> + 0 + </request_iso> + </value> + </pt_l_threshold> + <eta max="ffffffffffffffff" min="0000000000000000"> + <value> + FFFFFFFFFFFFFFFF + </value> + </eta> + <phi_h max="8f" min="00"> + <value> + 8f + </value> + </phi_h> + <phi_l max="ffffffffffffffff" min="0000000000000000"> + <value> + 00 + </value> + </phi_l> + <charge_correlation max="7" min="1"> + 1 + </charge_correlation> + <quality max="ff" min="00"> + <value> + f0 + </value> + </quality> + </SingleMu_0x06> + <SingleNoIsoEG_0x02 condition="calo" particle="eg" type="1_s"> + <et_threshold max="3f" min="00"> + <ge_eq mode="bit"> + 1 + </ge_eq> + <value> + 02 + </value> + </et_threshold> + <eta max="7F7F" min="0000"> + <value> + 7F7F + </value> + </eta> + <phi max="3ffff" min="00000"> + <value> + 3ffff + </value> + </phi> + </SingleNoIsoEG_0x02> + <SingleNoIsoEG_0x05 condition="calo" particle="eg" type="1_s"> + <et_threshold max="3f" min="00"> + <ge_eq mode="bit"> + 1 + </ge_eq> + <value> + 05 + </value> + </et_threshold> + <eta max="7F7F" min="0000"> + <value> + 7F7F + </value> + </eta> + <phi max="3ffff" min="00000"> + <value> + 3ffff + </value> + </phi> + </SingleNoIsoEG_0x05> + <SingleNoIsoEG_0x14 condition="calo" particle="eg" type="1_s"> + <et_threshold max="3f" min="00"> + <ge_eq mode="bit"> + 1 + </ge_eq> + <value> + 14 + </value> + </et_threshold> + <eta max="7F7F" min="0000"> + <value> + 7F7F + </value> + </eta> + <phi max="3ffff" min="00000"> + <value> + 3ffff + </value> + </phi> + </SingleNoIsoEG_0x14> + <SingleTauJet_0x02 condition="calo" particle="tau" type="1_s"> + <et_threshold max="3f" min="00"> + <ge_eq mode="bit"> + 1 + </ge_eq> + <value> + 02 + </value> + </et_threshold> + <eta max="7F7F" min="0000"> + <value> + 7F7F + </value> + </eta> + <phi max="3ffff" min="00000"> + <value> + 3ffff + </value> + </phi> + </SingleTauJet_0x02> + <SingleTauJet_0x03 condition="calo" particle="tau" type="1_s"> + <et_threshold max="3f" min="00"> + <ge_eq mode="bit"> + 1 + </ge_eq> + <value> + 03 + </value> + </et_threshold> + <eta max="7F7F" min="0000"> + <value> + 7F7F + </value> + </eta> + <phi max="3ffff" min="00000"> + <value> + 3ffff + </value> + </phi> + </SingleTauJet_0x03> + <SingleTauJet_0x04 condition="calo" particle="tau" type="1_s"> + <et_threshold max="3f" min="00"> + <ge_eq mode="bit"> + 1 + </ge_eq> + <value> + 04 + </value> + </et_threshold> + <eta max="7F7F" min="0000"> + <value> + 7F7F + </value> + </eta> + <phi max="3ffff" min="00000"> + <value> + 3ffff + </value> + </phi> + </SingleTauJet_0x04> + <SingleTauJet_0x05 condition="calo" particle="tau" type="1_s"> + <et_threshold max="3f" min="00"> + <ge_eq mode="bit"> + 1 + </ge_eq> + <value> + 05 + </value> + </et_threshold> + <eta max="7F7F" min="0000"> + <value> + 7F7F + </value> + </eta> + <phi max="3ffff" min="00000"> + <value> + 3ffff + </value> + </phi> + </SingleTauJet_0x05> + <SingleTauJet_0x07 condition="calo" particle="tau" type="1_s"> + <et_threshold max="3f" min="00"> + <ge_eq mode="bit"> + 1 + </ge_eq> + <value> + 07 + </value> + </et_threshold> + <eta max="7F7F" min="0000"> + <value> + 7F7F + </value> + </eta> + <phi max="3ffff" min="00000"> + <value> + 3ffff + </value> + </phi> + </SingleTauJet_0x07> + <SingleTauJet_0x08 condition="calo" particle="tau" type="1_s"> + <et_threshold max="3f" min="00"> + <ge_eq mode="bit"> + 1 + </ge_eq> + <value> + 08 + </value> + </et_threshold> + <eta max="7F7F" min="0000"> + <value> + 7F7F + </value> + </eta> + <phi max="3ffff" min="00000"> + <value> + 3ffff + </value> + </phi> + </SingleTauJet_0x08> + <SingleTauJet_0x09 condition="calo" particle="tau" type="1_s"> + <et_threshold max="3f" min="00"> + <ge_eq mode="bit"> + 1 + </ge_eq> + <value> + 09 + </value> + </et_threshold> + <eta max="7F7F" min="0000"> + <value> + 7F7F + </value> + </eta> + <phi max="3ffff" min="00000"> + <value> + 3ffff + </value> + </phi> + </SingleTauJet_0x09> + <SingleTauJet_0x11 condition="calo" particle="tau" type="1_s"> + <et_threshold max="3f" min="00"> + <ge_eq mode="bit"> + 1 + </ge_eq> + <value> + 11 + </value> + </et_threshold> + <eta max="7F7F" min="0000"> + <value> + 7F7F + </value> + </eta> + <phi max="3ffff" min="00000"> + <value> + 3ffff + </value> + </phi> + </SingleTauJet_0x11> + <SingleTauJet_0x32 condition="calo" particle="tau" type="1_s"> + <et_threshold max="3f" min="00"> + <ge_eq mode="bit"> + 1 + </ge_eq> + <value> + 32 + </value> + </et_threshold> + <eta max="7F7F" min="0000"> + <value> + 7F7F + </value> + </eta> + <phi max="3ffff" min="00000"> + <value> + 3ffff + </value> + </phi> + </SingleTauJet_0x32> + <BPTX_minus.v0 condition="CondExternal" particle="GtExternal" type="TypeExternal"></BPTX_minus.v0> + <BPTX_plus.v0 condition="CondExternal" particle="GtExternal" type="TypeExternal"></BPTX_plus.v0> + <BPTX_plus_AND_minus.v0 condition="CondExternal" particle="GtExternal" type="TypeExternal"></BPTX_plus_AND_minus.v0> + </conditions> + </condition_chip_2> +<techtriggers> + <L1Tech_BPTX_plus_AND_minus.v0> + TechTrig + <output_pin nr="0" /> + </L1Tech_BPTX_plus_AND_minus.v0> + <L1Tech_BPTX_plus.v0> + TechTrig + <output_pin nr="1" /> + </L1Tech_BPTX_plus.v0> + <L1Tech_BPTX_minus.v0> + TechTrig + <output_pin nr="2" /> + </L1Tech_BPTX_minus.v0> + <L1Tech_BPTX_plus_OR_minus.v0> + TechTrig + <output_pin nr="3" /> + </L1Tech_BPTX_plus_OR_minus.v0> + <L1Tech_BPTX_plus_AND_minus_instance1.v0> + TechTrig + <output_pin nr="4" /> + </L1Tech_BPTX_plus_AND_minus_instance1.v0> + <L1Tech_BPTX_plus_AND_NOT_minus.v0> + TechTrig + <output_pin nr="5" /> + </L1Tech_BPTX_plus_AND_NOT_minus.v0> + <L1Tech_BPTX_minus_AND_not_plus.v0> + TechTrig + <output_pin nr="6" /> + </L1Tech_BPTX_minus_AND_not_plus.v0> + <L1Tech_BPTX_quiet.v0> + TechTrig + <output_pin nr="7" /> + </L1Tech_BPTX_quiet.v0> + <L1Tech_HCAL_HF_single_channel.v0> + TechTrig + <output_pin nr="8" /> + </L1Tech_HCAL_HF_single_channel.v0> + <L1Tech_HCAL_HF_coincidence_PM.v2> + TechTrig + <output_pin nr="9" /> + </L1Tech_HCAL_HF_coincidence_PM.v2> + <L1Tech_HCAL_HF_MMP_or_MPP.v1> + TechTrig + <output_pin nr="10" /> + </L1Tech_HCAL_HF_MMP_or_MPP.v1> + <L1Tech_HCAL_HO_totalOR.v0> + TechTrig + <output_pin nr="11" /> + </L1Tech_HCAL_HO_totalOR.v0> + <L1Tech_HCAL_HBHE_totalOR.v0> + TechTrig + <output_pin nr="12" /> + </L1Tech_HCAL_HBHE_totalOR.v0> + <L1Tech_BPTX_PreBPTX.v0> + TechTrig + <output_pin nr="16" /> + </L1Tech_BPTX_PreBPTX.v0> + <L1Tech_DT_GlobalOR.v0> + TechTrig + <output_pin nr="20" /> + </L1Tech_DT_GlobalOR.v0> + <L1Tech_RPC_TTU_barrel_Cosmics.v0> + TechTrig + <output_pin nr="24" /> + </L1Tech_RPC_TTU_barrel_Cosmics.v0> + <L1Tech_RPC_TTU_pointing_Cosmics.v0> + TechTrig + <output_pin nr="25" /> + </L1Tech_RPC_TTU_pointing_Cosmics.v0> + <L1Tech_RPC_TTU_RBplus2_Cosmics.v0> + TechTrig + <output_pin nr="26" /> + </L1Tech_RPC_TTU_RBplus2_Cosmics.v0> + <L1Tech_RPC_TTU_RBplus1_Cosmics.v0> + TechTrig + <output_pin nr="27" /> + </L1Tech_RPC_TTU_RBplus1_Cosmics.v0> + <L1Tech__TTU_RB0_Cosmics.v0> + TechTrig + <output_pin nr="28" /> + </L1Tech__TTU_RB0_Cosmics.v0> + <L1Tech_TOTEM_0> + TechTrig + <output_pin nr="52" /> + </L1Tech_TOTEM_0> + <L1Tech_TOTEM_1> + TechTrig + <output_pin nr="53" /> + </L1Tech_TOTEM_1> + <L1Tech_TOTEM_2> + TechTrig + <output_pin nr="54" /> + </L1Tech_TOTEM_2> + <L1Tech_TOTEM_3> + TechTrig + <output_pin nr="55" /> + </L1Tech_TOTEM_3> + <L1Tech_CASTOR_0.v0> + TechTrig + <output_pin nr="60" /> + </L1Tech_CASTOR_0.v0> + <L1Tech_CASTOR_TotalEnergy.v0> + TechTrig + <output_pin nr="61" /> + </L1Tech_CASTOR_TotalEnergy.v0> + <L1Tech_CASTOR_EM.v0> + TechTrig + <output_pin nr="62" /> + </L1Tech_CASTOR_EM.v0> + <L1Tech_CASTOR_HaloMuon.v0> + TechTrig + <output_pin nr="63" /> + </L1Tech_CASTOR_HaloMuon.v0> + </techtriggers> +</def> + +<!--MenuImplDescription--> +<!--L1TmeVersion: 1.0.13-1--> +<!--TTCablingFkL1TechTrigCabling_2015_May_12--> +<!--ExtCondCablingFkL1ExternalConditionsCabling_2015_May_12--> +<!--AlgoDBLock +AlgoDBLockEnd--> +<!--CondDBLock +BPTX_minus.v0:BPTX_minus.v0 +BPTX_minus_postQuiet.v0:BPTX_minus_postQuiet.v0 +BPTX_plus.v0:BPTX_plus.v0 +BPTX_plus_AND_minus.v0:BPTX_plus_AND_minus.v0 +BPTX_plus_OR_minus.v0:BPTX_plus_OR_minus.v0 +BPTX_plus_postQuiet.v0:BPTX_plus_postQuiet.v0 +BPTXcoincidence:BPTXcoincidence +BSC_BSC2_minus.v0:BSC_BSC2_minus.v0 +BSC_BSC2_plus.v0:BSC_BSC2_plus.v0 +BSC_HighMultiplicity.v0:BSC_HighMultiplicity.v0 +BSC_halo_beam1_inner.v0:BSC_halo_beam1_inner.v0 +BSC_halo_beam1_outer.v0:BSC_halo_beam1_outer.v0 +BSC_halo_beam2_inner.v0:BSC_halo_beam2_inner.v0 +BSC_halo_beam2_outer.v0:BSC_halo_beam2_outer.v0 +BSC_minBias_OR.v0:BSC_minBias_OR.v0 +BSC_minBias_inner_threshold1.v0:BSC_minBias_inner_threshold1.v0 +BSC_minBias_inner_threshold2.v0:BSC_minBias_inner_threshold2.v0 +BSC_minBias_threshold1.v0:BSC_minBias_threshold1.v0 +BSC_minBias_threshold2.v0:BSC_minBias_threshold2.v0 +BSC_splash_beam1.v0:BSC_splash_beam1.v0 +BSC_splash_beam2.v0:BSC_splash_beam2.v0 +CASTOR_0.v0:CASTOR_0.v0 +CASTOR_EM.v0:CASTOR_EM.v0 +CASTOR_HaloMuon.v0:CASTOR_HaloMuon.v0 +CASTOR_TotalEnergy.v0:CASTOR_TotalEnergy.v0 +DoubleCenJet_0x05:DoubleCenJet_0x05 +DoubleCenJet_0x07:DoubleCenJet_0x07 +DoubleCenJet_0x08:DoubleCenJet_0x08 +DoubleForJet_0x05:DoubleForJet_0x05 +DoubleForJet_0x07:DoubleForJet_0x07 +DoubleForJet_0x08:DoubleForJet_0x08 +DoubleMu_0x01_Open:DoubleMu_0x01_Open +DoubleTauJet_0x05:DoubleTauJet_0x05 +DoubleTauJet_0x07:DoubleTauJet_0x07 +DoubleTauJet_0x08:DoubleTauJet_0x08 +Dummy_00:Dummy_00 +Dummy_01:Dummy_01 +Dummy_02:Dummy_02 +Dummy_03:Dummy_03 +Dummy_04:Dummy_04 +Dummy_05:Dummy_05 +Dummy_06:Dummy_06 +Dummy_07:Dummy_07 +Dummy_08:Dummy_08 +Dummy_09:Dummy_09 +Dummy_10:Dummy_10 +Dummy_11:Dummy_11 +Dummy_12:Dummy_12 +Dummy_13:Dummy_13 +Dummy_14:Dummy_14 +Dummy_15:Dummy_15 +Dummy_16:Dummy_16 +Dummy_17:Dummy_17 +Dummy_18:Dummy_18 +Dummy_19:Dummy_19 +Dummy_20:Dummy_20 +Dummy_21:Dummy_21 +Dummy_22:Dummy_22 +Dummy_23:Dummy_23 +Dummy_24:Dummy_24 +Dummy_25:Dummy_25 +Dummy_26:Dummy_26 +Dummy_27:Dummy_27 +Dummy_28:Dummy_28 +Dummy_29:Dummy_29 +Dummy_30:Dummy_30 +Dummy_31:Dummy_31 +Dummy_32:Dummy_32 +Dummy_33:Dummy_33 +Dummy_34:Dummy_34 +Dummy_35:Dummy_35 +Dummy_36:Dummy_36 +Dummy_37:Dummy_37 +Dummy_38:Dummy_38 +Dummy_39:Dummy_39 +Dummy_40:Dummy_40 +Dummy_41:Dummy_41 +Dummy_42:Dummy_42 +Dummy_43:Dummy_43 +Dummy_44:Dummy_44 +Dummy_45:Dummy_45 +Dummy_46:Dummy_46 +Dummy_47:Dummy_47 +Dummy_48:Dummy_48 +Dummy_49:Dummy_49 +Dummy_50:Dummy_50 +Dummy_51:Dummy_51 +Dummy_52:Dummy_52 +Dummy_53:Dummy_53 +Dummy_54:Dummy_54 +Dummy_55:Dummy_55 +Dummy_56:Dummy_56 +Dummy_57:Dummy_57 +Dummy_58:Dummy_58 +Dummy_59:Dummy_59 +Dummy_60:Dummy_60 +Dummy_61:Dummy_61 +Dummy_62:Dummy_62 +Dummy_63:Dummy_63 +ETT_0x01E:ETT_0x01E +ETT_0x050:ETT_0x050 +ETT_0x078:ETT_0x078 +ETT_0x0B4:ETT_0x0B4 +ETT_0x104:ETT_0x104 +FSC_St1Sect45_down.v0:FSC_St1Sect45_down.v0 +FSC_St1Sect45_upp.v0:FSC_St1Sect45_upp.v0 +FSC_St1Sect56_down.v0:FSC_St1Sect56_down.v0 +FSC_St1Sect56_upp.v0:FSC_St1Sect56_upp.v0 +FSC_St2Sect45_down.v0:FSC_St2Sect45_down.v0 +FSC_St2Sect45_upp.v0:FSC_St2Sect45_upp.v0 +FSC_St2Sect56_down.v0:FSC_St2Sect56_down.v0 +FSC_St2Sect56_upp.v0:FSC_St2Sect56_upp.v0 +FSC_St3Sect56_downLeft.v0:FSC_St3Sect56_downLeft.v0 +FSC_St3Sect56_downRight.v0:FSC_St3Sect56_downRight.v0 +FSC_St3Sect56_uppLeft.v0:FSC_St3Sect56_uppLeft.v0 +FSC_St3Sect56_uppRight.v0:FSC_St3Sect56_uppRight.v0 +HCAL_HF_MMP_or_MPP.v0:HCAL_HF_MMP_or_MPP.v0 +HCAL_HF_MMP_or_MPP.v1:HCAL_HF_MMP_or_MPP.v1 +HCAL_HF_MM_or_PP_or_PM.v0:HCAL_HF_MM_or_PP_or_PM.v0 +HCAL_HF_coincidence_PM.v1:HCAL_HF_coincidence_PM.v1 +HCAL_HF_coincidence_PM.v2:HCAL_HF_coincidence_PM.v2 +HCAL_HF_single_channel.v0:HCAL_HF_single_channel.v0 +HCAL_HO_totalOR.v0:HCAL_HO_totalOR.v0 +HfBitCounts_Ind0_0x1:HfBitCounts_Ind0_0x1 +HfBitCounts_Ind1_0x1:HfBitCounts_Ind1_0x1 +HfBitCounts_Ind2_0x1:HfBitCounts_Ind2_0x1 +HfBitCounts_Ind3_0x1:HfBitCounts_Ind3_0x1 +SingleCenJet_0x02:SingleCenJet_0x02 +SingleCenJet_0x03:SingleCenJet_0x03 +SingleCenJet_0x04:SingleCenJet_0x04 +SingleCenJet_0x05:SingleCenJet_0x05 +SingleCenJet_0x07:SingleCenJet_0x07 +SingleCenJet_0x08:SingleCenJet_0x08 +SingleCenJet_0x09:SingleCenJet_0x09 +SingleCenJet_0x11:SingleCenJet_0x11 +SingleCenJet_0x32:SingleCenJet_0x32 +SingleForJet_0x02:SingleForJet_0x02 +SingleForJet_0x03:SingleForJet_0x03 +SingleForJet_0x04:SingleForJet_0x04 +SingleForJet_0x05:SingleForJet_0x05 +SingleForJet_0x07:SingleForJet_0x07 +SingleForJet_0x08:SingleForJet_0x08 +SingleForJet_0x09:SingleForJet_0x09 +SingleForJet_0x11:SingleForJet_0x11 +SingleForJet_0x32:SingleForJet_0x32 +SingleIsoEG_0x02:SingleIsoEG_0x02 +SingleIsoEG_0x05:SingleIsoEG_0x05 +SingleIsoEG_0x14:SingleIsoEG_0x14 +SingleMu_0x01_BeamHalo:SingleMu_0x01_BeamHalo +SingleMu_0x01_Open:SingleMu_0x01_Open +SingleMu_0x06:SingleMu_0x06 +SingleNoIsoEG_0x02:SingleNoIsoEG_0x02 +SingleNoIsoEG_0x05:SingleNoIsoEG_0x05 +SingleNoIsoEG_0x14:SingleNoIsoEG_0x14 +SingleTauJet_0x02:SingleTauJet_0x02 +SingleTauJet_0x03:SingleTauJet_0x03 +SingleTauJet_0x04:SingleTauJet_0x04 +SingleTauJet_0x05:SingleTauJet_0x05 +SingleTauJet_0x07:SingleTauJet_0x07 +SingleTauJet_0x08:SingleTauJet_0x08 +SingleTauJet_0x09:SingleTauJet_0x09 +SingleTauJet_0x11:SingleTauJet_0x11 +SingleTauJet_0x32:SingleTauJet_0x32 +TOTEM_0:TOTEM_0 +TOTEM_1:TOTEM_1 +TOTEM_2:TOTEM_2 +TOTEM_3:TOTEM_3 +TOTEM_Diffractive.v0:TOTEM_Diffractive.v0 +TOTEM_LowMultiplicity.v0:TOTEM_LowMultiplicity.v0 +TOTEM_MinBias.v0:TOTEM_MinBias.v0 +TOTEM_RomanPotsOR:TOTEM_RomanPotsOR +TOTEM_ZeroBias.v0:TOTEM_ZeroBias.v0 +ZDC_Calo_minus.v0:ZDC_Calo_minus.v0 +ZDC_Calo_plus.v0:ZDC_Calo_plus.v0 +ZDC_Scint_loose_vertex.v0:ZDC_Scint_loose_vertex.v0 +ZDC_Scint_minus.v0:ZDC_Scint_minus.v0 +ZDC_Scint_plus.v0:ZDC_Scint_plus.v0 +ZDC_Scint_tight_vertex.v0:ZDC_Scint_tight_vertex.v0 +ZDC_loose_vertex.v0:ZDC_loose_vertex.v0 +ZDC_minus_over_threshold.v0:ZDC_minus_over_threshold.v0 +ZDC_plus_over_threshold.v0:ZDC_plus_over_threshold.v0 +ZDC_tight_vertex.v0:ZDC_tight_vertex.v0 +CondDBLockEnd--> From b413a199b1d72541054a1e9ec317422d8ff6e4fc Mon Sep 17 00:00:00 2001 From: Stefano Argiro <Stefano.Argiro@cern.ch> Date: Wed, 20 May 2015 11:18:46 +0200 Subject: [PATCH 16/26] fix for phi in ebdetid creation --- RecoLocalCalo/EcalRecProducers/plugins/EcalRecHitProducer.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RecoLocalCalo/EcalRecProducers/plugins/EcalRecHitProducer.cc b/RecoLocalCalo/EcalRecProducers/plugins/EcalRecHitProducer.cc index 48febd595be2f..6a217c12cb910 100644 --- a/RecoLocalCalo/EcalRecProducers/plugins/EcalRecHitProducer.cc +++ b/RecoLocalCalo/EcalRecProducers/plugins/EcalRecHitProducer.cc @@ -223,7 +223,7 @@ EcalRecHitProducer::produce(edm::Event& evt, const edm::EventSetup& es) for( std::set<EcalTrigTowerDetId>::const_iterator it = ttIds->begin(); it != ttIds->end(); ++it ) { // uses the EcalUncalibratedRecHit to pass the DetId info int ieta = (((*it).ietaAbs()-1)*5+1)*(*it).zside(); // from EcalTrigTowerConstituentsMap - int iphi = ((*it).iphi()-1)*5+11; // from EcalTrigTowerConstituentsMap + int iphi = (((*it).iphi()-1)*5+11)%360; // from EcalTrigTowerConstituentsMap if( iphi <= 0 ) iphi += 360; // from EcalTrigTowerConstituentsMap EcalUncalibratedRecHit urh( EBDetId(ieta, iphi, EBDetId::ETAPHIMODE), 0, 0, 0, 0, EcalRecHitWorkerBaseClass::EB_FE ); workerRecover_->run( evt, urh, *ebRecHits ); From e5e0fae6a6d9196dec75135062c6184c97e41ceb Mon Sep 17 00:00:00 2001 From: Viktor Khristenko <vdkhristenko1991@gmail.com> Date: Wed, 20 May 2015 15:51:35 +0200 Subject: [PATCH 17/26] Fixing the Expected Digi Size Issue for HF --- DQM/HcalMonitorTasks/src/HcalDigiMonitor.cc | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/DQM/HcalMonitorTasks/src/HcalDigiMonitor.cc b/DQM/HcalMonitorTasks/src/HcalDigiMonitor.cc index 1c2059be33dee..c516c086afe40 100644 --- a/DQM/HcalMonitorTasks/src/HcalDigiMonitor.cc +++ b/DQM/HcalMonitorTasks/src/HcalDigiMonitor.cc @@ -578,6 +578,20 @@ void HcalDigiMonitor::analyze(edm::Event const&e, edm::EventSetup const&s) if (debug_>0) std::cout << "### Processing FED: " << i << std::endl; + // For uTCA spigos are useless => by default we have digisize = 4 + // As of 20.05.2015 + // HF = 2 + if ((i>=1118 && i<=1122) || + (i>=718 && i<=723)) + { + mindigisizeHF_ = 4; + maxdigisizeHF_ = 4; + DigiExpectedSize->Fill(2, 4); + continue; + } + + // VME readout contains Number of Time Samples per Digi + // uTCA doesn't! HcalHTRData htr; for (int spigot=0; spigot<HcalDCCHeader::SPIGOT_COUNT; spigot++) { if (!dccHeader->getSpigotPresent(spigot)) continue; @@ -1125,7 +1139,7 @@ int HcalDigiMonitor::process_Digi(DIGI& digi, DigiHists& h, int& firstcap) maxtime=ff; } } - + if (maxtime>=2 && maxtime<=5 && maxenergy>20 && maxenergy<100) // only look between time slices 2-5; anything else should be nonsense { for (int ff=0;ff<digisize;++ff){ From d60df0a0b5a63469cc9d76ad5a01fb3a76150733 Mon Sep 17 00:00:00 2001 From: Josh Bendavid <Josh.Bendavid@cern.ch> Date: Wed, 20 May 2015 22:37:13 +0200 Subject: [PATCH 18/26] throw exceptions if there are too many or too few lhe events (indicative of matrix element generator error and can cause worse problems downstream) --- .../LHEInterface/plugins/ExternalLHEProducer.cc | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/GeneratorInterface/LHEInterface/plugins/ExternalLHEProducer.cc b/GeneratorInterface/LHEInterface/plugins/ExternalLHEProducer.cc index 7c6658f33b400..5e3c410442c58 100644 --- a/GeneratorInterface/LHEInterface/plugins/ExternalLHEProducer.cc +++ b/GeneratorInterface/LHEInterface/plugins/ExternalLHEProducer.cc @@ -152,8 +152,11 @@ void ExternalLHEProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { nextEvent(); - if (!partonLevel) - return; + if (!partonLevel) { + throw cms::Exception("ExternalLHEProducer") << "No lhe event found in ExternalLHEProducer::produce(). " + << "The likely cause is that the lhe file contains fewer events than were requested, which is possible " + << "in case of phase space integration or uneweighting efficiency problems."; + } std::auto_ptr<LHEEventProduct> product( new LHEEventProduct(*partonLevel->getHEPEUP(), @@ -290,6 +293,13 @@ ExternalLHEProducer::endRunProduce(edm::Run& run, edm::EventSetup const& es) run.put(product); } + nextEvent(); + if (partonLevel) { + throw cms::Exception("ExternalLHEProducer") << "Error in ExternalLHEProducer::endRunProduce(). " + << "Event loop is over, but there are still lhe events to process." + << "This could happen if lhe file contains more events than requested. This is never expected to happen."; + } + reader_.reset(); if (unlink(outputFile_.c_str())) { From b77d81c426af81564553087a640a94ef20bd86b7 Mon Sep 17 00:00:00 2001 From: Christian Schomakers <christian.schomakers@rwth-aachen.de> Date: Thu, 21 May 2015 11:18:37 +0200 Subject: [PATCH 19/26] Geometry comparison tool bug fixes due to extended alignment errors and update to compare the rotation of modules --- .../python/TkAlAllInOneTool/alignment.py | 7 +- .../TkAlAllInOneTool/configTemplates.py | 2 +- .../TkAlAllInOneTool/genericValidation.py | 1 + .../TkAlAllInOneTool/geometryComparison.py | 206 ++++++++++++++++-- .../geometryComparisonTemplates.py | 17 +- .../scripts/comparisonScript.C | 69 ++++-- .../scripts/makeArrowPlots.C | 17 +- 7 files changed, 270 insertions(+), 49 deletions(-) diff --git a/Alignment/OfflineValidation/python/TkAlAllInOneTool/alignment.py b/Alignment/OfflineValidation/python/TkAlAllInOneTool/alignment.py index 309990df329f7..f3d3d9cc30205 100644 --- a/Alignment/OfflineValidation/python/TkAlAllInOneTool/alignment.py +++ b/Alignment/OfflineValidation/python/TkAlAllInOneTool/alignment.py @@ -7,9 +7,10 @@ class Alignment: def __init__(self, name, config, runGeomComp = "1"): self.condShorts = { "TrackerAlignmentErrorExtendedRcd": - {"zeroAPE":{"connectString": ("frontier://FrontierProd" - "/CMS_COND_31X_FROM21X"), - "tagName": "TrackerIdealGeometryErrors210_mc", + {"zeroAPE":{"connectString": ("frontier://PromptProd" + "/CMS_COND_ALIGN_000"), + "tagName": "TrackerAlignmentExtendedErr_2009_v2_express_IOVs", + "labelName": ""}}} section = "alignment:%s"%name if not config.has_section( section ): diff --git a/Alignment/OfflineValidation/python/TkAlAllInOneTool/configTemplates.py b/Alignment/OfflineValidation/python/TkAlAllInOneTool/configTemplates.py index 60c22ae718d94..f7017ebcd9874 100644 --- a/Alignment/OfflineValidation/python/TkAlAllInOneTool/configTemplates.py +++ b/Alignment/OfflineValidation/python/TkAlAllInOneTool/configTemplates.py @@ -44,7 +44,7 @@ cd .oO[CMSSW_BASE]Oo./src export SCRAM_ARCH=.oO[SCRAM_ARCH]Oo. eval `scramv1 ru -sh` -rfmkdir -p .oO[datadir]Oo. &>! /dev/null +#rfmkdir -p .oO[datadir]Oo. &>! /dev/null #remove possible result file from previous runs previous_results=$(cmsLs -l /store/caf/user/$USER/.oO[eosdir]Oo. | awk '{print $5}') diff --git a/Alignment/OfflineValidation/python/TkAlAllInOneTool/genericValidation.py b/Alignment/OfflineValidation/python/TkAlAllInOneTool/genericValidation.py index 539d5b3eca8fb..3ae906c59dfa9 100644 --- a/Alignment/OfflineValidation/python/TkAlAllInOneTool/genericValidation.py +++ b/Alignment/OfflineValidation/python/TkAlAllInOneTool/genericValidation.py @@ -98,6 +98,7 @@ def getRepMap(self, alignment = None): "CMSSW_RELEASE_BASE": self.cmsswreleasebase, "alignmentName": alignment.name, "condLoad": alignment.getConditions(), + "condLoad": alignment.getConditions(), }) return result diff --git a/Alignment/OfflineValidation/python/TkAlAllInOneTool/geometryComparison.py b/Alignment/OfflineValidation/python/TkAlAllInOneTool/geometryComparison.py index c2ec796e287a2..3aeec4c2c8c60 100644 --- a/Alignment/OfflineValidation/python/TkAlAllInOneTool/geometryComparison.py +++ b/Alignment/OfflineValidation/python/TkAlAllInOneTool/geometryComparison.py @@ -97,7 +97,7 @@ def createConfiguration(self, path ): cfgs[cfgName] = configTemplates.compareTemplate repMaps[cfgName] = repMap - cfgSchedule.append( cfgName ) + cfgSchedule.append( cfgName ) GenericValidation.createConfiguration(self, cfgs, path, cfgSchedule, repMaps = repMaps) def createScript(self, path): @@ -107,6 +107,8 @@ def createScript(self, path): %self.name), repMap) for name in self.__compares: if '"DetUnit"' in self.__compares[name][0].split(","): + repMap["outputFile"] = (".oO[name]Oo..Comparison_common"+name+".root") + repMap["nIndex"] = ("") repMap["runComparisonScripts"] += \ ("rfcp .oO[CMSSW_BASE]Oo./src/Alignment/OfflineValidation" "/scripts/comparisonScript.C .\n" @@ -118,37 +120,205 @@ def createScript(self, path): ".oO[name]Oo..Comparison_common"+name+".root\",\"" "./\")'\n") if self.copyImages: + #~ repMap["runComparisonScripts"] += \ + #~ ("rfmkdir -p .oO[datadir]Oo./.oO[name]Oo." + #~ ".Comparison_common"+name+"_Images\n") + #~ repMap["runComparisonScripts"] += \ + #~ ("find . -maxdepth 1 -name \"*PXB*\" " + #~ "-print | xargs -I {} bash -c \"rfcp {} .oO[datadir]Oo." + #~ "/.oO[name]Oo..Comparison_common"+name+"_Images/\" \n") + #~ repMap["runComparisonScripts"] += \ + #~ ("find . -maxdepth 1 -name \"*PXF*\" " + #~ "-print | xargs -I {} bash -c \"rfcp {} .oO[datadir]Oo." + #~ "/.oO[name]Oo..Comparison_common"+name+"_Images/\" \n") + #~ repMap["runComparisonScripts"] += \ + #~ ("find . -maxdepth 1 -name \"*TIB*\" " + #~ "-print | xargs -I {} bash -c \"rfcp {} .oO[datadir]Oo." + #~ "/.oO[name]Oo..Comparison_common"+name+"_Images/\" \n") + #~ repMap["runComparisonScripts"] += \ + #~ ("find . -maxdepth 1 -name \"*TID*\" " + #~ "-print | xargs -I {} bash -c \"rfcp {} .oO[datadir]Oo." + #~ "/.oO[name]Oo..Comparison_common"+name+"_Images/\" \n") + #~ repMap["runComparisonScripts"] += \ + #~ ("find . -maxdepth 1 -name \"*TEC*\" " + #~ "-print | xargs -I {} bash -c \"rfcp {} .oO[datadir]Oo." + #~ "/.oO[name]Oo..Comparison_common"+name+"_Images/\" \n") + #~ repMap["runComparisonScripts"] += \ + #~ ("find . -maxdepth 1 -name \"*TOB*\" " + #~ "-print | xargs -I {} bash -c \"rfcp {} .oO[datadir]Oo." + #~ "/.oO[name]Oo..Comparison_common"+name+"_Images/\" \n") + #~ repMap["runComparisonScripts"] += \ + #~ ("find . -maxdepth 1 -name \"*tracker*\" " + #~ "-print | xargs -I {} bash -c \"rfcp {} .oO[datadir]Oo." + #~ "/.oO[name]Oo..Comparison_common"+name+"_Images/\" \n") repMap["runComparisonScripts"] += \ ("rfmkdir -p .oO[datadir]Oo./.oO[name]Oo." ".Comparison_common"+name+"_Images\n") repMap["runComparisonScripts"] += \ - ("find . -maxdepth 1 -name \"*PXB*\" " + ("rfmkdir -p .oO[datadir]Oo./.oO[name]Oo." + ".Comparison_common"+name+"_Images/Translations\n") + repMap["runComparisonScripts"] += \ + ("rfmkdir -p .oO[datadir]Oo./.oO[name]Oo." + ".Comparison_common"+name+"_Images/Rotations\n") + repMap["runComparisonScripts"] += \ + ("rfmkdir -p .oO[datadir]Oo./.oO[name]Oo." + ".Comparison_common"+name+"_Images/CrossTalk\n") + repMap["runComparisonScripts"] += \ + ("find . -maxdepth 1 -name \"*phi_vs_dr*\" " + "-print | xargs -I {} bash -c \"rfcp {} .oO[datadir]Oo." + "/.oO[name]Oo..Comparison_common"+name+"_Images/Translations/\" \n") + repMap["runComparisonScripts"] += \ + ("find . -maxdepth 1 -name \"*phi_vs_dx*\" " + "-print | xargs -I {} bash -c \"rfcp {} .oO[datadir]Oo." + "/.oO[name]Oo..Comparison_common"+name+"_Images/Translations/\" \n") + repMap["runComparisonScripts"] += \ + ("find . -maxdepth 1 -name \"*phi_vs_dy*\" " + "-print | xargs -I {} bash -c \"rfcp {} .oO[datadir]Oo." + "/.oO[name]Oo..Comparison_common"+name+"_Images/Translations/\" \n") + repMap["runComparisonScripts"] += \ + ("find . -maxdepth 1 -name \"*phi_vs_dz*\" " + "-print | xargs -I {} bash -c \"rfcp {} .oO[datadir]Oo." + "/.oO[name]Oo..Comparison_common"+name+"_Images/Translations/\" \n") + repMap["runComparisonScripts"] += \ + ("find . -maxdepth 1 -name \"*phi_vs_rdphi*\" " + "-print | xargs -I {} bash -c \"rfcp {} .oO[datadir]Oo." + "/.oO[name]Oo..Comparison_common"+name+"_Images/Translations/\" \n") + repMap["runComparisonScripts"] += \ + ("find . -maxdepth 1 -name \"*r_vs_dr*\" " + "-print | xargs -I {} bash -c \"rfcp {} .oO[datadir]Oo." + "/.oO[name]Oo..Comparison_common"+name+"_Images/Translations/\" \n") + repMap["runComparisonScripts"] += \ + ("find . -maxdepth 1 -name \"*r_vs_dx*\" " + "-print | xargs -I {} bash -c \"rfcp {} .oO[datadir]Oo." + "/.oO[name]Oo..Comparison_common"+name+"_Images/Translations/\" \n") + repMap["runComparisonScripts"] += \ + ("find . -maxdepth 1 -name \"*r_vs_dy*\" " + "-print | xargs -I {} bash -c \"rfcp {} .oO[datadir]Oo." + "/.oO[name]Oo..Comparison_common"+name+"_Images/Translations/\" \n") + repMap["runComparisonScripts"] += \ + ("find . -maxdepth 1 -name \"*r_vs_dz*\" " + "-print | xargs -I {} bash -c \"rfcp {} .oO[datadir]Oo." + "/.oO[name]Oo..Comparison_common"+name+"_Images/Translations/\" \n") + repMap["runComparisonScripts"] += \ + ("find . -maxdepth 1 -name \"*r_vs_rdphi*\" " + "-print | xargs -I {} bash -c \"rfcp {} .oO[datadir]Oo." + "/.oO[name]Oo..Comparison_common"+name+"_Images/Translations/\" \n") + repMap["runComparisonScripts"] += \ + ("find . -maxdepth 1 -name \"*z_vs_dr*\" " + "-print | xargs -I {} bash -c \"rfcp {} .oO[datadir]Oo." + "/.oO[name]Oo..Comparison_common"+name+"_Images/Translations/\" \n") + repMap["runComparisonScripts"] += \ + ("find . -maxdepth 1 -name \"*z_vs_dx*\" " + "-print | xargs -I {} bash -c \"rfcp {} .oO[datadir]Oo." + "/.oO[name]Oo..Comparison_common"+name+"_Images/Translations/\" \n") + repMap["runComparisonScripts"] += \ + ("find . -maxdepth 1 -name \"*z_vs_dy*\" " + "-print | xargs -I {} bash -c \"rfcp {} .oO[datadir]Oo." + "/.oO[name]Oo..Comparison_common"+name+"_Images/Translations/\" \n") + repMap["runComparisonScripts"] += \ + ("find . -maxdepth 1 -name \"*z_vs_dz*\" " + "-print | xargs -I {} bash -c \"rfcp {} .oO[datadir]Oo." + "/.oO[name]Oo..Comparison_common"+name+"_Images/Translations/\" \n") + repMap["runComparisonScripts"] += \ + ("find . -maxdepth 1 -name \"*z_vs_rdphi*\" " + "-print | xargs -I {} bash -c \"rfcp {} .oO[datadir]Oo." + "/.oO[name]Oo..Comparison_common"+name+"_Images/Translations/\" \n") + repMap["runComparisonScripts"] += \ + ("find . -maxdepth 1 -name \"*alpha_vs_dalpha*\" " + "-print | xargs -I {} bash -c \"rfcp {} .oO[datadir]Oo." + "/.oO[name]Oo..Comparison_common"+name+"_Images/Rotations/\" \n") + repMap["runComparisonScripts"] += \ + ("find . -maxdepth 1 -name \"*alpha_vs_dbeta*\" " + "-print | xargs -I {} bash -c \"rfcp {} .oO[datadir]Oo." + "/.oO[name]Oo..Comparison_common"+name+"_Images/Rotations/\" \n") + repMap["runComparisonScripts"] += \ + ("find . -maxdepth 1 -name \"*alpha_vs_dgamma*\" " + "-print | xargs -I {} bash -c \"rfcp {} .oO[datadir]Oo." + "/.oO[name]Oo..Comparison_common"+name+"_Images/Rotations/\" \n") + repMap["runComparisonScripts"] += \ + ("find . -maxdepth 1 -name \"*beta_vs_dalpha*\" " + "-print | xargs -I {} bash -c \"rfcp {} .oO[datadir]Oo." + "/.oO[name]Oo..Comparison_common"+name+"_Images/Rotations/\" \n") + repMap["runComparisonScripts"] += \ + ("find . -maxdepth 1 -name \"*beta_vs_dbeta*\" " + "-print | xargs -I {} bash -c \"rfcp {} .oO[datadir]Oo." + "/.oO[name]Oo..Comparison_common"+name+"_Images/Rotations/\" \n") + repMap["runComparisonScripts"] += \ + ("find . -maxdepth 1 -name \"*beta_vs_dgamma*\" " + "-print | xargs -I {} bash -c \"rfcp {} .oO[datadir]Oo." + "/.oO[name]Oo..Comparison_common"+name+"_Images/Rotations/\" \n") + repMap["runComparisonScripts"] += \ + ("find . -maxdepth 1 -name \"*gamma_vs_dalpha*\" " + "-print | xargs -I {} bash -c \"rfcp {} .oO[datadir]Oo." + "/.oO[name]Oo..Comparison_common"+name+"_Images/Rotations/\" \n") + repMap["runComparisonScripts"] += \ + ("find . -maxdepth 1 -name \"*gamma_vs_dbeta*\" " + "-print | xargs -I {} bash -c \"rfcp {} .oO[datadir]Oo." + "/.oO[name]Oo..Comparison_common"+name+"_Images/Rotations/\" \n") + repMap["runComparisonScripts"] += \ + ("find . -maxdepth 1 -name \"*gamma_vs_dgamma*\" " + "-print | xargs -I {} bash -c \"rfcp {} .oO[datadir]Oo." + "/.oO[name]Oo..Comparison_common"+name+"_Images/Rotations/\" \n") + repMap["runComparisonScripts"] += \ + ("find . -maxdepth 1 -name \"*dr_vs_dalpha*\" " + "-print | xargs -I {} bash -c \"rfcp {} .oO[datadir]Oo." + "/.oO[name]Oo..Comparison_common"+name+"_Images/CrossTalk/\" \n") + repMap["runComparisonScripts"] += \ + ("find . -maxdepth 1 -name \"*dr_vs_dbeta*\" " + "-print | xargs -I {} bash -c \"rfcp {} .oO[datadir]Oo." + "/.oO[name]Oo..Comparison_common"+name+"_Images/CrossTalk/\" \n") + repMap["runComparisonScripts"] += \ + ("find . -maxdepth 1 -name \"*dr_vs_dgamma*\" " + "-print | xargs -I {} bash -c \"rfcp {} .oO[datadir]Oo." + "/.oO[name]Oo..Comparison_common"+name+"_Images/CrossTalk/\" \n") + repMap["runComparisonScripts"] += \ + ("find . -maxdepth 1 -name \"*dx_vs_dalpha*\" " + "-print | xargs -I {} bash -c \"rfcp {} .oO[datadir]Oo." + "/.oO[name]Oo..Comparison_common"+name+"_Images/CrossTalk/\" \n") + repMap["runComparisonScripts"] += \ + ("find . -maxdepth 1 -name \"*dx_vs_dbeta*\" " + "-print | xargs -I {} bash -c \"rfcp {} .oO[datadir]Oo." + "/.oO[name]Oo..Comparison_common"+name+"_Images/CrossTalk/\" \n") + repMap["runComparisonScripts"] += \ + ("find . -maxdepth 1 -name \"*dx_vs_dgamma*\" " + "-print | xargs -I {} bash -c \"rfcp {} .oO[datadir]Oo." + "/.oO[name]Oo..Comparison_common"+name+"_Images/CrossTalk/\" \n") + repMap["runComparisonScripts"] += \ + ("find . -maxdepth 1 -name \"*dy_vs_dalpha*\" " + "-print | xargs -I {} bash -c \"rfcp {} .oO[datadir]Oo." + "/.oO[name]Oo..Comparison_common"+name+"_Images/CrossTalk/\" \n") + repMap["runComparisonScripts"] += \ + ("find . -maxdepth 1 -name \"*dy_vs_dbeta*\" " + "-print | xargs -I {} bash -c \"rfcp {} .oO[datadir]Oo." + "/.oO[name]Oo..Comparison_common"+name+"_Images/CrossTalk/\" \n") + repMap["runComparisonScripts"] += \ + ("find . -maxdepth 1 -name \"*dy_vs_dgamma*\" " "-print | xargs -I {} bash -c \"rfcp {} .oO[datadir]Oo." - "/.oO[name]Oo..Comparison_common"+name+"_Images/\" \n") + "/.oO[name]Oo..Comparison_common"+name+"_Images/CrossTalk/\" \n") repMap["runComparisonScripts"] += \ - ("find . -maxdepth 1 -name \"*PXF*\" " + ("find . -maxdepth 1 -name \"*dz_vs_dalpha*\" " "-print | xargs -I {} bash -c \"rfcp {} .oO[datadir]Oo." - "/.oO[name]Oo..Comparison_common"+name+"_Images/\" \n") + "/.oO[name]Oo..Comparison_common"+name+"_Images/CrossTalk/\" \n") repMap["runComparisonScripts"] += \ - ("find . -maxdepth 1 -name \"*TIB*\" " + ("find . -maxdepth 1 -name \"*dz_vs_dbeta*\" " "-print | xargs -I {} bash -c \"rfcp {} .oO[datadir]Oo." - "/.oO[name]Oo..Comparison_common"+name+"_Images/\" \n") + "/.oO[name]Oo..Comparison_common"+name+"_Images/CrossTalk/\" \n") repMap["runComparisonScripts"] += \ - ("find . -maxdepth 1 -name \"*TID*\" " + ("find . -maxdepth 1 -name \"*dz_vs_dgamma*\" " "-print | xargs -I {} bash -c \"rfcp {} .oO[datadir]Oo." - "/.oO[name]Oo..Comparison_common"+name+"_Images/\" \n") + "/.oO[name]Oo..Comparison_common"+name+"_Images/CrossTalk/\" \n") repMap["runComparisonScripts"] += \ - ("find . -maxdepth 1 -name \"*TEC*\" " + ("find . -maxdepth 1 -name \"*rdphi_vs_dalpha*\" " "-print | xargs -I {} bash -c \"rfcp {} .oO[datadir]Oo." - "/.oO[name]Oo..Comparison_common"+name+"_Images/\" \n") + "/.oO[name]Oo..Comparison_common"+name+"_Images/CrossTalk/\" \n") repMap["runComparisonScripts"] += \ - ("find . -maxdepth 1 -name \"*TOB*\" " + ("find . -maxdepth 1 -name \"*rdphi_vs_dbeta*\" " "-print | xargs -I {} bash -c \"rfcp {} .oO[datadir]Oo." - "/.oO[name]Oo..Comparison_common"+name+"_Images/\" \n") + "/.oO[name]Oo..Comparison_common"+name+"_Images/CrossTalk/\" \n") repMap["runComparisonScripts"] += \ - ("find . -maxdepth 1 -name \"*tracker*\" " + ("find . -maxdepth 1 -name \"*rdphi_vs_dgamma*\" " "-print | xargs -I {} bash -c \"rfcp {} .oO[datadir]Oo." - "/.oO[name]Oo..Comparison_common"+name+"_Images/\" \n") + "/.oO[name]Oo..Comparison_common"+name+"_Images/CrossTalk/\" \n") repMap["runComparisonScripts"] += \ ("find . -maxdepth 1 -name " "\"TkMap_SurfDeform*.pdf\" -print | xargs -I {} bash -c" @@ -171,7 +341,7 @@ def createScript(self, path): repMap["runComparisonScripts"] += \ ("rfcp .oO[CMSSW_BASE]Oo./src/Alignment" "/OfflineValidation/scripts/makeArrowPlots.C " - "$CWD/TkAllInOneTool\n" + ".\n" "root -b -q 'makeArrowPlots.C(\"" ".oO[name]Oo..Comparison_common"+name +".root\",\".oO[name]Oo.." @@ -199,7 +369,8 @@ def createScript(self, path): for cfg in self.configFiles: # FIXME: produce this line only for enabled dbOutput # postProcess = "rfcp .oO[workdir]Oo./*.db .oO[datadir]Oo.\n" - postProcess = "rfcp *.db .oO[datadir]Oo.\n" + # postProcess = "rfcp *.db .oO[datadir]Oo.\n" + postProcess = "" repMap["CommandLine"]+= \ repMap["CommandLineTemplate"]%{"cfgFile":cfg, "postProcess":postProcess} @@ -207,6 +378,7 @@ def createScript(self, path): ".oO[runComparisonScripts]Oo.\n" ) + #~ print configTemplates.scriptTemplate scripts = {scriptName: replaceByMap( configTemplates.scriptTemplate, repMap ) } return GenericValidation.createScript(self, scripts, path) diff --git a/Alignment/OfflineValidation/python/TkAlAllInOneTool/geometryComparisonTemplates.py b/Alignment/OfflineValidation/python/TkAlAllInOneTool/geometryComparisonTemplates.py index 9c9bac7867075..2e30f413c2bd6 100644 --- a/Alignment/OfflineValidation/python/TkAlAllInOneTool/geometryComparisonTemplates.py +++ b/Alignment/OfflineValidation/python/TkAlAllInOneTool/geometryComparisonTemplates.py @@ -9,9 +9,14 @@ process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff") process.GlobalTag.globaltag = ".oO[GlobalTag]Oo." -process.load("Configuration.Geometry.GeometryDB_cff") +#process.load('Configuration.Geometry.GeometryExtended2015_cff') +#process.TrackerTopologyEP = cms.ESProducer("TrackerTopologyEP") + +#process.load("Configuration.StandardSequences.Geometry_cff") +process.load("Configuration.Geometry.GeometryRecoDB_cff") #process.load("Geometry.TrackerNumberingBuilder.trackerNumberingGeometry_cfi") #process.load("Geometry.TrackerGeometryBuilder.trackerGeometry_cfi") +process.load("Geometry.TrackerGeometryBuilder.trackerGeometryDB_cfi") #process.load("Alignment.CommonAlignmentProducer.GlobalPosition_Frontier_cff") process.load("CondCore.DBCommon.CondDBSetup_cfi") @@ -50,11 +55,15 @@ # global tag process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff") process.GlobalTag.globaltag = ".oO[GlobalTag]Oo." -process.load("Configuration.Geometry.GeometryDB_cff") -#process.load("Geometry.TrackerNumberingBuilder.trackerNumberingGeometry_cfi") +#process.load('Configuration.Geometry.GeometryExtended2015_cff') +#process.TrackerTopologyEP = cms.ESProducer("TrackerTopologyEP") +#process.load("Configuration.StandardSequences.Geometry_cff") +process.load("Configuration.Geometry.GeometryRecoDB_cff") +#process.load("Geometry.TrackerNumberingBuilder.trackerNumberingGeometry_cfi") #process.load("Geometry.TrackerGeometryBuilder.trackerGeometry_cfi") +process.load("Geometry.TrackerGeometryBuilder.trackerGeometryDB_cfi") #process.load("Alignment.CommonAlignmentProducer.GlobalPosition_Frontier_cff") # the input .GlobalPosition_Frontier_cff is providing the frontier://FrontierProd/CMS_COND_31X_ALIGNMENT in the release which does not provide the ideal geometry @@ -113,7 +122,7 @@ dbOutputTemplate= """ //_________________________ db Output ____________________________ # setup for writing out to DB - include "CondCore/DBCommon/data/CondDBSetup.cfi" + include "CondCore/DBCommon/CondDBSetup.cfi" # include "CondCore/DBCommon/data/CondDBCommon.cfi" service = PoolDBOutputService { diff --git a/Alignment/OfflineValidation/scripts/comparisonScript.C b/Alignment/OfflineValidation/scripts/comparisonScript.C index f5c9e3c441ba1..6d7b94c4d5490 100644 --- a/Alignment/OfflineValidation/scripts/comparisonScript.C +++ b/Alignment/OfflineValidation/scripts/comparisonScript.C @@ -33,25 +33,68 @@ void comparisonScript (TString inFile,//="mp1510_vs_mp1509.Comparison_commonTrac // from r and dphi // now the object to produce the comparison plots is created - GeometryComparisonPlotter * cp = new GeometryComparisonPlotter (inFile, outDir); + + // Plot Translations + GeometryComparisonPlotter * trans = new GeometryComparisonPlotter (inFile, outDir); // x and y contain the couples to plot // -> every combination possible will be performed // /!\ always give units (otherwise, unexpected bug from root...) vector<TString> x,y; - x.push_back("r"); cp->SetBranchUnits("r", "cm"); - x.push_back("phi"); cp->SetBranchUnits("phi", "rad"); - x.push_back("z"); cp->SetBranchUnits("z", "cm"); //cp->SetBranchMax("z", 100); cp->SetBranchMin("z", -100); - y.push_back("dr"); cp->SetBranchSF("dr", 10000); cp->SetBranchUnits("dr", "#mum"); - y.push_back("dz"); cp->SetBranchSF("dz", 10000); cp->SetBranchUnits("dz", "#mum"); - y.push_back("rdphi"); cp->SetBranchSF("rdphi",10000); cp->SetBranchUnits("rdphi", "#mum rad"); - y.push_back("dx"); cp->SetBranchSF("dx", 10000); cp->SetBranchUnits("dx", "#mum"); //cp->SetBranchMax("dx", 10); cp->SetBranchMin("dx", -10); - y.push_back("dy"); cp->SetBranchSF("dy", 10000); cp->SetBranchUnits("dy", "#mum"); //cp->SetBranchMax("dy", 10); cp->SetBranchMin("dy", -10); - cp->MakePlots(x, y); // default output is pdf, but png gives a nicer result, so we use it as well + x.push_back("r"); trans->SetBranchUnits("r", "cm"); + x.push_back("phi"); trans->SetBranchUnits("phi", "rad"); + x.push_back("z"); trans->SetBranchUnits("z", "cm"); //trans->SetBranchMax("z", 100); trans->SetBranchMin("z", -100); + y.push_back("dr"); trans->SetBranchSF("dr", 10000); trans->SetBranchUnits("dr", "#mum"); + y.push_back("dz"); trans->SetBranchSF("dz", 10000); trans->SetBranchUnits("dz", "#mum"); + y.push_back("rdphi"); trans->SetBranchSF("rdphi",10000); trans->SetBranchUnits("rdphi", "#mum rad"); + y.push_back("dx"); trans->SetBranchSF("dx", 10000); trans->SetBranchUnits("dx", "#mum"); //trans->SetBranchMax("dx", 10); trans->SetBranchMin("dx", -10); + y.push_back("dy"); trans->SetBranchSF("dy", 10000); trans->SetBranchUnits("dy", "#mum"); //trans->SetBranchMax("dy", 10); trans->SetBranchMin("dy", -10); + trans->MakePlots(x, y); // default output is pdf, but png gives a nicer result, so we use it as well // remark: what takes the more time is the creation of the output files, // not the looping on the tree (because the code is perfect, of course :p) - cp->SetGrid(1,1); - cp->SetPrintOption("png"); - cp->MakePlots(x, y); + trans->SetGrid(1,1); + trans->SetPrintOption("png"); + trans->MakePlots(x, y); + + + // Plot Rotations + GeometryComparisonPlotter * rot = new GeometryComparisonPlotter (inFile, outDir); + // x and y contain the couples to plot + // -> every combination possible will be performed + // /!\ always give units (otherwise, unexpected bug from root...) + vector<TString> a,b; + a.push_back("alpha"); rot->SetBranchUnits("alpha", "rad"); + a.push_back("beta"); rot->SetBranchUnits("beta", "rad"); + a.push_back("gamma"); rot->SetBranchUnits("gamma", "rad"); + b.push_back("dalpha"); rot->SetBranchUnits("dalpha", "rad"); + b.push_back("dbeta"); rot->SetBranchUnits("dbeta", "rad"); + b.push_back("dgamma"); rot->SetBranchUnits("dgamma", "rad"); + rot->MakePlots(a, b); // default output is pdf, but png gives a nicer result, so we use it as well + // remark: what takes the more time is the creation of the output files, + // not the looping on the tree (because the code is perfect, of course :p) + rot->SetGrid(1,1); + rot->SetPrintOption("png"); + rot->MakePlots(a, b); + + // Plot cross talk + GeometryComparisonPlotter * cross = new GeometryComparisonPlotter (inFile, outDir); + // x and y contain the couples to plot + // -> every combination possible will be performed + // /!\ always give units (otherwise, unexpected bug from root...) + vector<TString> dx,dy; + dx.push_back("dr"); cross->SetBranchSF("dr", 10000); cross->SetBranchUnits("dr", "#mum"); + dx.push_back("dz"); cross->SetBranchSF("dz", 10000); cross->SetBranchUnits("dz", "#mum"); + dx.push_back("rdphi"); cross->SetBranchSF("rdphi",10000); cross->SetBranchUnits("rdphi", "#mum rad"); + dx.push_back("dx"); cross->SetBranchSF("dx", 10000); cross->SetBranchUnits("dx", "#mum"); + dx.push_back("dy"); cross->SetBranchSF("dy", 10000); cross->SetBranchUnits("dy", "#mum"); + dy.push_back("dalpha"); cross->SetBranchUnits("dalpha", "rad"); + dy.push_back("dbeta"); cross->SetBranchUnits("dbeta", "rad"); + dy.push_back("dgamma"); cross->SetBranchUnits("dgamma", "rad"); + cross->MakePlots(dx,dy); // default output is pdf, but png gives a nicer result, so we use it as well + // remark: what takes the more time is the creation of the output files, + // not the looping on the tree (because the code is perfect, of course :p) + cross->SetGrid(1,1); + cross->SetPrintOption("png"); + cross->MakePlots(dx, dy); // now the same object can be reused with other specifications/cuts //void SetPrint (const bool); // activates the printing of the individual and global pdf diff --git a/Alignment/OfflineValidation/scripts/makeArrowPlots.C b/Alignment/OfflineValidation/scripts/makeArrowPlots.C index af26db4cf5126..cf678daa5fdca 100644 --- a/Alignment/OfflineValidation/scripts/makeArrowPlots.C +++ b/Alignment/OfflineValidation/scripts/makeArrowPlots.C @@ -12,7 +12,7 @@ float y_,x_,z_,phi_,r_,dphi_,dr_,dx_,dz_,dy_; int level_,sublevel_; char outputDir_[192]; -void Plot10Mu(char* text,float X, float Y, float size) +void Plot10Mu(const char* text,float X, float Y, float size) { TPaveText* atext = new TPaveText(X,Y,X+size,Y+size); atext->AddText(text); @@ -48,13 +48,8 @@ void DrawRPhiLegend(double xLim, double yLim, double barrelRPhiRescale) normArrow(xTest+dYTest,yTest-4*dYTest-disty,500./10000*barrelRPhiRescale); } -void Write() -{ - output->Write(); -} - -int makeRPhiArrowPlot( TTree* data, char* name, double xLim, double yLim, double level, double sublevel, double zMin, double zMax, double rMin, double rMax, double barrelRPhiRescale){ +int makeRPhiArrowPlot( TTree* data, const char* name, double xLim, double yLim, double level, double sublevel, double zMin, double zMax, double rMin, double rMax, double barrelRPhiRescale){ TCanvas* OBPCanvas = new TCanvas(name,name,1050,875); @@ -80,7 +75,7 @@ int makeRPhiArrowPlot( TTree* data, char* name, double xLim, double yLim, double DrawRPhiLegend( xLim, yLim, barrelRPhiRescale ); char sliceLeg[192]; - sprintf( sliceLeg, "%s: %d < z <= %d", name, zMin, zMax ); + sprintf( sliceLeg, "%s: %f < z <= %f", name, zMin, zMax ); //Plot10Mu( name, xLim/2, yLim, 0.2*xLim ); TPaveText* atext = new TPaveText(0.2*xLim,0.85*yLim,0.66*xLim,0.99*yLim); atext->AddText(sliceLeg); @@ -99,7 +94,7 @@ int makeRPhiArrowPlot( TTree* data, char* name, double xLim, double yLim, double return passcut; } -int makeZPhiArrowPlot( TTree* data, char* name, double zLim, double phiLim, double level, double sublevel, double zMin, double zMax, double rMin, double rMax, double barrelRPhiRescale){ +int makeZPhiArrowPlot( TTree* data, const char* name, double zLim, double phiLim, double level, double sublevel, double zMin, double zMax, double rMin, double rMax, double barrelRPhiRescale){ TCanvas* OBPCanvas = new TCanvas(name,name,1050,875); @@ -125,7 +120,7 @@ int makeZPhiArrowPlot( TTree* data, char* name, double zLim, double phiLim, doub DrawRPhiLegend( zLim, phiLim, barrelRPhiRescale ); char sliceLeg[192]; - sprintf( sliceLeg, "%s: %d < r <= %d", name, rMin, rMax ); + sprintf( sliceLeg, "%s: %f < r <= %f", name, rMin, rMax ); //Plot10Mu( name, xLim/2, yLim, 0.2*xLim ); TPaveText* atext = new TPaveText(0.2*zLim,0.85*phiLim,0.66*zLim,0.99*phiLim); atext->AddText(sliceLeg); @@ -198,7 +193,7 @@ int makeRZArrowPlot( TTree* data, char* name, double zLim, double zLimMax, doubl } */ -void makeArrowPlots(char* filename, char* outputDir) +void makeArrowPlots(const char* filename, const char* outputDir) { fin = new TFile(filename); From 80308618cd0eaa61def6f4c5d819eae627855c49 Mon Sep 17 00:00:00 2001 From: Christian Schomakers <christian.schomakers@rwth-aachen.de> Date: Thu, 21 May 2015 12:08:51 +0200 Subject: [PATCH 20/26] Erased comments and changed Frontier --- .../python/TkAlAllInOneTool/alignment.py | 4 +-- .../geometryComparisonTemplates.py | 33 ++++--------------- 2 files changed, 8 insertions(+), 29 deletions(-) diff --git a/Alignment/OfflineValidation/python/TkAlAllInOneTool/alignment.py b/Alignment/OfflineValidation/python/TkAlAllInOneTool/alignment.py index f3d3d9cc30205..c9c61ddc8aeec 100644 --- a/Alignment/OfflineValidation/python/TkAlAllInOneTool/alignment.py +++ b/Alignment/OfflineValidation/python/TkAlAllInOneTool/alignment.py @@ -7,8 +7,8 @@ class Alignment: def __init__(self, name, config, runGeomComp = "1"): self.condShorts = { "TrackerAlignmentErrorExtendedRcd": - {"zeroAPE":{"connectString": ("frontier://PromptProd" - "/CMS_COND_ALIGN_000"), + {"zeroAPE":{"connectString": ("frontier://FrontierProd" + "/CMS_CONDITIONS"), "tagName": "TrackerAlignmentExtendedErr_2009_v2_express_IOVs", "labelName": ""}}} diff --git a/Alignment/OfflineValidation/python/TkAlAllInOneTool/geometryComparisonTemplates.py b/Alignment/OfflineValidation/python/TkAlAllInOneTool/geometryComparisonTemplates.py index 2e30f413c2bd6..b4508e1cd5402 100644 --- a/Alignment/OfflineValidation/python/TkAlAllInOneTool/geometryComparisonTemplates.py +++ b/Alignment/OfflineValidation/python/TkAlAllInOneTool/geometryComparisonTemplates.py @@ -9,16 +9,11 @@ process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff") process.GlobalTag.globaltag = ".oO[GlobalTag]Oo." -#process.load('Configuration.Geometry.GeometryExtended2015_cff') -#process.TrackerTopologyEP = cms.ESProducer("TrackerTopologyEP") +process.load('Configuration.Geometry.GeometryExtended2015_cff') +process.TrackerTopologyEP = cms.ESProducer("TrackerTopologyEP") -#process.load("Configuration.StandardSequences.Geometry_cff") -process.load("Configuration.Geometry.GeometryRecoDB_cff") -#process.load("Geometry.TrackerNumberingBuilder.trackerNumberingGeometry_cfi") -#process.load("Geometry.TrackerGeometryBuilder.trackerGeometry_cfi") -process.load("Geometry.TrackerGeometryBuilder.trackerGeometryDB_cfi") +process.load("Geometry.TrackerGeometryBuilder.trackerGeometry_cfi") -#process.load("Alignment.CommonAlignmentProducer.GlobalPosition_Frontier_cff") process.load("CondCore.DBCommon.CondDBSetup_cfi") process.MessageLogger = cms.Service("MessageLogger", @@ -36,7 +31,6 @@ input = cms.untracked.int32(1) ) process.dump = cms.EDAnalyzer("TrackerGeometryIntoNtuples", - # outputFile = cms.untracked.string('.oO[workdir]Oo./.oO[alignmentName]Oo.ROOTGeometry.root'), outputFile = cms.untracked.string('.oO[alignmentName]Oo.ROOTGeometry.root'), outputTreename = cms.untracked.string('alignTree') ) @@ -56,18 +50,10 @@ process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff") process.GlobalTag.globaltag = ".oO[GlobalTag]Oo." -#process.load('Configuration.Geometry.GeometryExtended2015_cff') -#process.TrackerTopologyEP = cms.ESProducer("TrackerTopologyEP") +process.load('Configuration.Geometry.GeometryExtended2015_cff') +process.TrackerTopologyEP = cms.ESProducer("TrackerTopologyEP") -#process.load("Configuration.StandardSequences.Geometry_cff") -process.load("Configuration.Geometry.GeometryRecoDB_cff") -#process.load("Geometry.TrackerNumberingBuilder.trackerNumberingGeometry_cfi") -#process.load("Geometry.TrackerGeometryBuilder.trackerGeometry_cfi") -process.load("Geometry.TrackerGeometryBuilder.trackerGeometryDB_cfi") - -#process.load("Alignment.CommonAlignmentProducer.GlobalPosition_Frontier_cff") -# the input .GlobalPosition_Frontier_cff is providing the frontier://FrontierProd/CMS_COND_31X_ALIGNMENT in the release which does not provide the ideal geometry -#process.GlobalPosition.connect = 'frontier://FrontierProd/CMS_COND_31X_FROM21X' +process.load("Geometry.TrackerGeometryBuilder.trackerGeometry_cfi")i") process.load("CondCore.DBCommon.CondDBSetup_cfi") @@ -85,11 +71,8 @@ process.load("DQM.SiStripCommon.TkHistoMap_cfi") process.DQMStore=cms.Service("DQMStore") -#process.TkDetMap = cms.Service("TkDetMap") -#process.SiStripDetInfoFileReader = cms.Service("SiStripDetInfoFileReader") process.load("DQMServices.Core.DQMStore_cfg") -#process.DQMStore=cms.Service("DQMStore") # configuration of the Tracker Geometry Comparison Tool # Tracker Geometry Comparison @@ -98,13 +81,9 @@ process.TrackerGeometryCompare.inputROOTFile1 = '.oO[comparedGeometry]Oo.' process.TrackerGeometryCompare.inputROOTFile2 = '.oO[referenceGeometry]Oo.' -# process.TrackerGeometryCompare.outputFile = ".oO[workdir]Oo./.oO[name]Oo..Comparison_common.oO[common]Oo..root" process.TrackerGeometryCompare.outputFile = ".oO[name]Oo..Comparison_common.oO[common]Oo..root" process.load("CommonTools.UtilAlgos.TFileService_cfi") -#process.TFileService = cms.Service("TFileService", -# fileName = cms.string('TkSurfDeform.root') -# ) process.TFileService.fileName = cms.string("TkSurfDeform_.oO[name]Oo..Comparison_common.oO[common]Oo..root") process.TrackerGeometryCompare.levels = [ .oO[levels]Oo. ] From d47067ce17bec7d140ef8034976d579a89a3b5fe Mon Sep 17 00:00:00 2001 From: mmusich <marco.musich@cern.ch> Date: Thu, 21 May 2015 15:52:18 +0200 Subject: [PATCH 21/26] fixing bug in python configuration --- .../python/TkAlAllInOneTool/geometryComparisonTemplates.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Alignment/OfflineValidation/python/TkAlAllInOneTool/geometryComparisonTemplates.py b/Alignment/OfflineValidation/python/TkAlAllInOneTool/geometryComparisonTemplates.py index b4508e1cd5402..84f15579e7b29 100644 --- a/Alignment/OfflineValidation/python/TkAlAllInOneTool/geometryComparisonTemplates.py +++ b/Alignment/OfflineValidation/python/TkAlAllInOneTool/geometryComparisonTemplates.py @@ -53,7 +53,7 @@ process.load('Configuration.Geometry.GeometryExtended2015_cff') process.TrackerTopologyEP = cms.ESProducer("TrackerTopologyEP") -process.load("Geometry.TrackerGeometryBuilder.trackerGeometry_cfi")i") +process.load("Geometry.TrackerGeometryBuilder.trackerGeometry_cfi") process.load("CondCore.DBCommon.CondDBSetup_cfi") From 56d2bafbffd5575cbdbe8400f085a083e7cb9400 Mon Sep 17 00:00:00 2001 From: Michael <mplaner@cern.ch> Date: Wed, 13 May 2015 16:04:58 +0200 Subject: [PATCH 22/26] updated Higgs->diphoton DQM --- .../Higgs/python/hltHiggsValidator_cfi.py | 24 +++++++++++-------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/HLTriggerOffline/Higgs/python/hltHiggsValidator_cfi.py b/HLTriggerOffline/Higgs/python/hltHiggsValidator_cfi.py index 9b2ac7f9ba0af..2e95e9992c5d3 100644 --- a/HLTriggerOffline/Higgs/python/hltHiggsValidator_cfi.py +++ b/HLTriggerOffline/Higgs/python/hltHiggsValidator_cfi.py @@ -59,10 +59,14 @@ # --- Photons Photon_genCut = cms.string("abs(pdgId) == 22 && status == 1"), - Photon_recCut = cms.string("pt > 20 && abs(eta) < 2.4 && hadronicOverEm < 0.1 && ( r9 < 0.85 || ("+\ - " ( abs(eta) < 1.479 && sigmaIetaIeta < 0.014 || "+\ - " abs(eta) > 1.479 && sigmaIetaIeta < 0.0035 ) && "+\ - " ecalRecHitSumEtConeDR03 < (5.0+0.012*et) && hcalTowerSumEtConeDR03 < (5.0+0.0005*et ) && trkSumPtSolidConeDR03 < (5.0 + 0.0002*et)"+\ + Photon_recCut = cms.string("pt > 20 && abs(eta) < 2.4 && hadronicOverEm < 0.1 && "+\ + " ( abs(eta) < 1.479 && r9 < 0.50 || "+\ + " abs(eta) > 1.479 && r9 < 0.80 ) && "+\ + " ( ( abs(eta) < 1.479 && r9 < 0.85 || "+\ + " abs(eta) > 1.479 && r9 < 0.90 ) || ("+\ + " ( abs(eta) < 1.479 && sigmaIetaIeta < 0.014 || "+\ + " abs(eta) > 1.479 && sigmaIetaIeta < 0.0035 ) && "+\ + " ecalRecHitSumEtConeDR03 < (6.0+0.012*et) && trkSumPtSolidConeDR03 < (6.0 + 0.0002*et)"+\ " )"+")" ), Photon_cutMinPt = cms.double(20), # TO BE DEPRECATED Photon_cutMaxEta = cms.double(2.4),# TO BE DEPRECATED @@ -151,12 +155,12 @@ ), Hgg = cms.PSet( hltPathsToCheck = cms.vstring( - "HLT_Diphoton44_28_R9Id85_OR_Iso50T80LCaloId24b40e_AND_HE10P1_R9Id50b80e_v", - "HLT_Diphoton30_18_R9Id85_OR_Iso50T80LCaloId24b40e_AND_HE10P0_R9Id50b80e_Mass95_v", - "HLT_Diphoton28_14_R9Id85_OR_Iso50T80LCaloId24b40e_AND_HE10P0_R9Id50b80e_Mass50_Eta_1p5_v", - "HLT_Diphoton30_18_R9Id85_AND_Iso50T80LCaloId24b40e_AND_HE10P0_R9Id50b80e_Solid_Mass30_v", - "HLT_Diphoton30_18_R9Id85_AND_Iso50T80LCaloId24b40e_AND_HE10P0_R9Id50b80e_PV_v", - "HLT_Diphoton30_18_R9Id85_AND_Iso50T80LCaloId24b40e_AND_HE10P0_R9Id50b80e_DoublePV_v" + "HLT_Diphoton10_10_R9Id_OR_IsoCaloId_AND_HE_R9Id_Mass10_ForMC_v", + "HLT_Diphoton30_18_R9Id_OR_IsoCaloId_AND_HE_R9Id_Mass95_v", + "HLT_Diphoton30_18_R9Id_OR_IsoCaloId_AND_HE_R9Id_DoublePixelSeedMatch_Mass70_v", + "HLT_Diphoton30PV_18PV_R9Id_AND_IsoCaloId_AND_HE_R9Id_DoublePixelVeto_Mass55_v", + "HLT_Diphoton30_18_Solid_R9Id_AND_IsoCaloId_AND_HE_R9Id_Mass55_v", + "HLT_Diphoton30EB_18EB_R9Id_OR_IsoCaloId_AND_HE_R9Id_DoublePixelVeto_Mass55_v" ), recPhotonLabel = cms.string("photons"), # -- Analysis specific cuts From 20fadc3366d9c716a2b384e86d3770095a3b50a2 Mon Sep 17 00:00:00 2001 From: Michael <mplaner@cern.ch> Date: Mon, 18 May 2015 12:54:15 +0200 Subject: [PATCH 23/26] updated higgs validator for DQM for Hgg paths --- .../Higgs/python/hltHiggsValidator_cfi.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/HLTriggerOffline/Higgs/python/hltHiggsValidator_cfi.py b/HLTriggerOffline/Higgs/python/hltHiggsValidator_cfi.py index 2e95e9992c5d3..2ff2655f45af3 100644 --- a/HLTriggerOffline/Higgs/python/hltHiggsValidator_cfi.py +++ b/HLTriggerOffline/Higgs/python/hltHiggsValidator_cfi.py @@ -60,14 +60,13 @@ # --- Photons Photon_genCut = cms.string("abs(pdgId) == 22 && status == 1"), Photon_recCut = cms.string("pt > 20 && abs(eta) < 2.4 && hadronicOverEm < 0.1 && "+\ - " ( abs(eta) < 1.479 && r9 < 0.50 || "+\ - " abs(eta) > 1.479 && r9 < 0.80 ) && "+\ - " ( ( abs(eta) < 1.479 && r9 < 0.85 || "+\ - " abs(eta) > 1.479 && r9 < 0.90 ) || ("+\ - " ( abs(eta) < 1.479 && sigmaIetaIeta < 0.014 || "+\ - " abs(eta) > 1.479 && sigmaIetaIeta < 0.0035 ) && "+\ - " ecalRecHitSumEtConeDR03 < (6.0+0.012*et) && trkSumPtSolidConeDR03 < (6.0 + 0.0002*et)"+\ - " )"+")" ), + " ( ( abs(eta) < 1.479 && r9 > 0.85 ) || "+\ + " ( abs(eta) > 1.479 && r9 > 0.90 ) || "+\ + " ( abs(eta) < 1.479 && r9 > 0.50 && sigmaIetaIeta < 0.014 && "+\ + " ecalRecHitSumEtConeDR03 < (6.0+0.012*et) && trkSumPtSolidConeDR03 < (6.0 + 0.002*et) ) || "+\ + " ( abs(eta) > 1.479 && r9 > 0.80 && sigmaIetaIeta < 0.035 && "+\ + " ecalRecHitSumEtConeDR03 < (6.0+0.012*et) && trkSumPtSolidConeDR03 < (6.0 + 0.002*et) ) ) " + ), Photon_cutMinPt = cms.double(20), # TO BE DEPRECATED Photon_cutMaxEta = cms.double(2.4),# TO BE DEPRECATED From 9aa5ab5c1be3c8c195afd65ed0d1dfca9d719fbf Mon Sep 17 00:00:00 2001 From: Vladimir <Vladimir.Ivantchenko@cern.ch> Date: Thu, 21 May 2015 20:05:44 +0200 Subject: [PATCH 24/26] added nuclear elastic --- .../NuclearInteractionFTFSimulator.h | 5 + .../src/NuclearInteractionFTFSimulator.cc | 207 ++++++++++++------ 2 files changed, 146 insertions(+), 66 deletions(-) diff --git a/FastSimulation/MaterialEffects/interface/NuclearInteractionFTFSimulator.h b/FastSimulation/MaterialEffects/interface/NuclearInteractionFTFSimulator.h index 1385fe1fdf643..fc5fbdaa935cd 100644 --- a/FastSimulation/MaterialEffects/interface/NuclearInteractionFTFSimulator.h +++ b/FastSimulation/MaterialEffects/interface/NuclearInteractionFTFSimulator.h @@ -31,6 +31,7 @@ class G4ExcitedStringDecay; class G4LundStringFragmentation; class G4GeneratorPrecompoundInterface; class G4CascadeInterface; +class G4DiffuseElastic; class G4PhysicsLogVector; static const int numHadrons = 30; @@ -68,6 +69,7 @@ class NuclearInteractionFTFSimulator : public MaterialEffectsSimulator G4GeneratorPrecompoundInterface* theCascade; G4CascadeInterface* theBertiniCascade; + G4DiffuseElastic* theDiffuseElastic; G4Step* dummyStep; G4Track* currTrack; @@ -85,6 +87,9 @@ class NuclearInteractionFTFSimulator : public MaterialEffectsSimulator double theDistCut; double distMin; + double intLengthElastic; + double intLengthInelastic; + int currIdx; size_t index; unsigned int theDistAlgo; diff --git a/FastSimulation/MaterialEffects/src/NuclearInteractionFTFSimulator.cc b/FastSimulation/MaterialEffects/src/NuclearInteractionFTFSimulator.cc index 1a152f91e1c89..db0ddf76dd30a 100644 --- a/FastSimulation/MaterialEffects/src/NuclearInteractionFTFSimulator.cc +++ b/FastSimulation/MaterialEffects/src/NuclearInteractionFTFSimulator.cc @@ -22,6 +22,7 @@ #include "G4LundStringFragmentation.hh" #include "G4GeneratorPrecompoundInterface.hh" #include "G4CascadeInterface.hh" +#include "G4DiffuseElastic.hh" #include "G4Proton.hh" #include "G4Neutron.hh" @@ -70,8 +71,8 @@ static std::once_flag initializeOnce; const double fact = 1.0/CLHEP::GeV; -// interaction length corrections per particle and energy -const double corrfactors[numHadrons][npoints] = { +// inelastic interaction length corrections per particle and energy +const double corrfactors_inel[numHadrons][npoints] = { {1.0872, 1.1026, 1.111, 1.111, 1.0105, 0.97622, 0.9511, 0.9526, 0.97591, 0.99277, 1.0099, 1.015, 1.0217, 1.0305, 1.0391, 1.0438, 1.0397, 1.0328, 1.0232, 1.0123, 1.0}, {1.0416, 1.1044, 1.1467, 1.1273, 1.026, 0.99085, 0.96572, 0.96724, 0.99091, 1.008, 1.0247, 1.0306, 1.0378, 1.0427, 1.0448, 1.0438, 1.0397, 1.0328, 1.0232, 1.0123, 1.0}, {0.5308, 0.53589, 0.67059, 0.80253, 0.82341, 0.79083, 0.85967, 0.90248, 0.93792, 0.9673, 1.0034, 1.022, 1.0418, 1.0596, 1.0749, 1.079, 1.0704, 1.0576, 1.0408, 1.0214, 1.0}, @@ -104,11 +105,51 @@ const double corrfactors[numHadrons][npoints] = { {0.48729, 0.52742, 0.56668, 0.60442, 0.64006, 0.67336, 0.70482, 0.73571, 0.76754, 0.80086, 0.83455, 0.86665, 0.8959, 0.92208, 0.94503, 0.96437, 0.97967, 0.99072, 0.99756, 1.0005, 1.0}, }; -// interaction length in Silicon at 1 TeV per particle -const double nuclIntLength[numHadrons] = { +// elastic interaction length corrections per particle and energy +const double corrfactors_el[numHadrons][npoints] = { + {0.58834, 1.1238, 1.7896, 1.4409, 0.93175, 0.80587, 0.80937, 0.83954, 0.87453, 0.91082, 0.94713, 0.98195, 1.0134, 1.0397, 1.0593, 1.071, 1.0739, 1.0678, 1.053, 1.03, 1.0}, + {0.40938, 0.92337, 1.3365, 1.1607, 1.008, 0.82206, 0.81163, 0.79489, 0.82919, 0.91812, 0.96688, 1.0225, 1.0734, 1.0833, 1.0874, 1.0854, 1.0773, 1.0637, 1.0448, 1.0235, 1.0}, + {0.43699, 0.42165, 0.46594, 0.64917, 0.85314, 0.80782, 0.83204, 0.91162, 1.0155, 1.0665, 1.0967, 1.1125, 1.1275, 1.1376, 1.1464, 1.1477, 1.1312, 1.1067, 1.0751, 1.039, 1.0}, + {0.3888, 0.39527, 0.43921, 0.62834, 0.8164, 0.79866, 0.82272, 0.90163, 1.0045, 1.055, 1.0849, 1.1005, 1.1153, 1.1253, 1.134, 1.1365, 1.1255, 1.0895, 1.0652, 1.0348, 1.0}, + {0.32004, 0.31119, 0.30453, 0.30004, 0.31954, 0.40148, 0.5481, 0.74485, 0.99317, 1.1642, 1.2117, 1.2351, 1.2649, 1.3054, 1.375, 1.4992, 1.4098, 1.3191, 1.2232, 1.118, 1.0}, + {0.10553, 0.14623, 0.20655, 0.26279, 0.19996, 0.40125, 0.5139, 0.71271, 0.89269, 1.0108, 1.1673, 1.3052, 1.4149, 1.429, 1.4521, 1.4886, 1.4006, 1.3116, 1.2177, 1.1151, 1.0}, + {0.106, 0.14692, 0.20755, 0.26257, 0.20089, 0.40236, 0.51452, 0.71316, 0.89295, 1.0109, 1.1673, 1.3053, 1.4149, 1.429, 1.4521, 1.4886, 1.4006, 1.3116, 1.2177, 1.1151, 1.0}, + {0.31991, 0.31111, 0.30445, 0.30004, 0.31995, 0.40221, 0.54884, 0.74534, 0.99364, 1.1644, 1.2117, 1.2351, 1.265, 1.3054, 1.375, 1.4992, 1.4098, 1.3191, 1.2232, 1.118, 1.0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1.0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1.0}, + {0.37579, 0.39922, 0.37445, 0.32631, 0.39002, 0.42161, 0.54251, 0.69127, 0.90332, 1.0664, 1.1346, 1.1481, 1.1692, 1.2036, 1.2625, 1.3633, 1.2913, 1.2215, 1.1516, 1.0788, 1.0}, + {0.31756, 0.33409, 0.25339, 0.35525, 0.52989, 0.63382, 0.7453, 0.93505, 1.1464, 1.2942, 1.3161, 1.328, 1.3393, 1.3525, 1.374, 1.4051, 1.3282, 1.2523, 1.1745, 1.0916, 1.0}, + {0.38204, 0.39694, 0.36502, 0.33367, 0.39229, 0.43119, 0.54898, 0.70169, 0.91004, 1.0696, 1.1348, 1.1483, 1.1694, 1.2038, 1.2627, 1.3632, 1.2913, 1.2215, 1.1516, 1.0788, 1.0}, + {0.38143, 0.39716, 0.36609, 0.33294, 0.39207, 0.43021, 0.54834, 0.70066, 0.90945, 1.0693, 1.1348, 1.1482, 1.1694, 1.2038, 1.2627, 1.3632, 1.2913, 1.2215, 1.1516, 1.0788, 1.0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1.0}, + {0.29564, 0.32645, 0.29986, 0.30611, 0.48808, 0.59902, 0.71207, 0.8832, 1.1164, 1.2817, 1.3154, 1.3273, 1.3389, 1.3521, 1.3736, 1.4056, 1.3285, 1.2524, 1.1746, 1.0916, 1.0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1.0}, + {0.3265, 0.3591, 0.39232, 0.42635, 0.46259, 0.50365, 0.55244, 0.61014, 0.67446, 0.74026, 0.80252, 0.85858, 0.90765, 0.94928, 0.9827, 1.0071, 1.0221, 1.0279, 1.0253, 1.0155, 1.0}, + {0.13808, 0.15585, 0.17798, 0.2045, 0.22596, 0.25427, 0.33214, 0.44821, 0.5856, 0.74959, 0.89334, 1.0081, 1.0964, 1.1248, 1.173, 1.2548, 1.1952, 1.1406, 1.0903, 1.0437, 1.0}, + {0.20585, 0.23253, 0.26371, 0.28117, 0.30433, 0.35417, 0.44902, 0.58211, 0.73486, 0.90579, 1.0395, 1.1488, 1.2211, 1.2341, 1.2553, 1.2877, 1.2245, 1.1654, 1.1093, 1.0547, 1.0}, + {0.2852, 0.32363, 0.31419, 0.35164, 0.45463, 0.54331, 0.66908, 0.81735, 0.98253, 1.1557, 1.2557, 1.3702, 1.4186, 1.401, 1.374, 1.3325, 1.2644, 1.1991, 1.1348, 1.0694, 1.0}, + {0.20928, 0.23671, 0.2664, 0.28392, 0.30584, 0.35929, 0.45725, 0.5893, 0.74047, 0.9101, 1.0407, 1.1503, 1.2212, 1.2342, 1.2554, 1.2876, 1.2245, 1.1654, 1.1093, 1.0547, 1.0}, + {0.11897, 0.13611, 0.15796, 0.1797, 0.21335, 0.26367, 0.34705, 0.46115, 0.6016, 0.7759, 0.91619, 1.0523, 1.1484, 1.1714, 1.2098, 1.2721, 1.2106, 1.1537, 1.1004, 1.0496, 1.0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1.0}, + {0.26663, 0.30469, 0.32886, 0.33487, 0.41692, 0.51616, 0.63323, 0.78162, 0.95551, 1.1372, 1.2502, 1.3634, 1.4189, 1.4013, 1.3743, 1.3329, 1.2646, 1.1992, 1.1349, 1.0694, 1.0}, + {0.16553, 0.19066, 0.21468, 0.23609, 0.30416, 0.38821, 0.49644, 0.63386, 0.80299, 0.99907, 1.1304, 1.2724, 1.3535, 1.3475, 1.3381, 1.3219, 1.2549, 1.191, 1.1287, 1.0659, 1.0}, + {0.37736, 0.41414, 0.45135, 0.48843, 0.52473, 0.55973, 0.59348, 0.62696, 0.66202, 0.70042, 0.74241, 0.786, 0.82819, 0.86688, 0.90128, 0.93107, 0.95589, 0.97532, 0.98908, 0.99719, 1.0}, + {0.34354, 0.37692, 0.4109, 0.44492, 0.47873, 0.51296, 0.54937, 0.59047, 0.63799, 0.69117, 0.74652, 0.7998, 0.84832, 0.89111, 0.92783, 0.95798, 0.98095, 0.99635, 1.0043, 1.0052, 1.0}, + {0.36364, 0.39792, 0.43277, 0.4676, 0.50186, 0.53538, 0.56884, 0.604, 0.64308, 0.68729, 0.73544, 0.7842, 0.83019, 0.87156, 0.90777, 0.93854, 0.96346, 0.98209, 0.99421, 1, 1.0}, + {0.36362, 0.39791, 0.43276, 0.46759, 0.50185, 0.53537, 0.56883, 0.604, 0.64307, 0.68728, 0.73544, 0.7842, 0.83019, 0.87156, 0.90777, 0.93854, 0.96346, 0.98209, 0.99421, 1, 1.0}, +}; + +// inelastic interaction length in Silicon at 1 TeV per particle +const double nuclInelLength[numHadrons] = { 4.5606, 4.4916, 5.7511, 5.7856, 6.797, 6.8373, 6.8171, 6.8171, 0, 0, 4.6926, 4.6926, 4.6926, 4.6926, 0, 4.6926, 4.6926, 4.3171, 4.3171, 4.6926, 4.6926, 4.6926, 4.6926, 0, 4.6926, 4.6926, 2.509, 2.9048, 2.5479, 2.5479 }; +// elastic interaction length in Silicon at 1 TeV per particle +const double nuclElLength[numHadrons] = { +9.248, 9.451, 11.545, 11.671, 32.081, 34.373, 34.373, 32.081, 0, 0, 15.739, 20.348, 15.739, 15.739, 0, 20.349, 0, 9.7514, 12.864, 15.836, 20.516, 15.836, 15.744, 0, 20.517, 20.44, 4.129, 6.0904, 4.5204, 4.5204 +}; + + NuclearInteractionFTFSimulator::NuclearInteractionFTFSimulator( unsigned int distAlgo, double distCut, double elimit, double eth) : curr4Mom(0.,0.,0.,0.), @@ -136,6 +177,8 @@ NuclearInteractionFTFSimulator::NuclearInteractionFTFSimulator( // Bertini Cascade theBertiniCascade = new G4CascadeInterface(); + theDiffuseElastic = new G4DiffuseElastic(); + // Geant4 particles and cross sections std::call_once(initializeOnce, [this] () { theG4Hadron[0] = G4Proton::Proton(); @@ -185,6 +228,7 @@ NuclearInteractionFTFSimulator::NuclearInteractionFTFSimulator( // local objects vect = new G4PhysicsLogVector(npoints-1,100*MeV,TeV); + intLengthElastic = intLengthInelastic = 0.0; currIdx = 0; index = 0; currTrack = 0; @@ -233,24 +277,32 @@ void NuclearInteractionFTFSimulator::compute(ParticlePropagator& Particle, // fill projectile for Geant4 double mass = currParticle->GetPDGMass(); double ekin = CLHEP::GeV*Particle.momentum().e() - mass; - double ff; + + // check interaction length + intLengthElastic = nuclElLength[currIdx]; + intLengthInelastic = nuclInelLength[currIdx]; + if(0.0 == intLengthInelastic) { return; } + + // apply corrections if(ekin <= vect->Energy(0)) { - ff = corrfactors[currIdx][0]; - } else if(ekin >= vect->Energy(npoints-1)) { - ff = 1.0; - } else { + intLengthElastic *= corrfactors_el[currIdx][0]; + intLengthInelastic *= corrfactors_inel[currIdx][0]; + } else if(ekin < vect->Energy(npoints-1)) { index = vect->FindBin(ekin, index); double e1 = vect->Energy(index); double e2 = vect->Energy(index+1); - ff = (corrfactors[currIdx][index]*(e2 - ekin) + - corrfactors[currIdx][index+1]*(ekin - e1))/(e2 - e1); + intLengthElastic *= ((corrfactors_el[currIdx][index]*(e2 - ekin) + + corrfactors_el[currIdx][index+1]*(ekin - e1))/(e2 - e1)); + intLengthInelastic *= ((corrfactors_inel[currIdx][index]*(e2 - ekin) + + corrfactors_inel[currIdx][index+1]*(ekin - e1))/(e2 - e1)); } /* std::cout << " Primary " << currParticle->GetParticleName() << " E(GeV)= " << e*fact << std::endl; */ - double currInteractionLength = -G4Log(random->flatShoot())*nuclIntLength[currIdx]*ff; + double currInteractionLength = -G4Log(random->flatShoot())*intLengthElastic*intLengthInelastic + /(intLengthElastic + intLengthInelastic); /* std::cout << "*NuclearInteractionFTFSimulator::compute: R(X0)= " << radLengths << " Rnuc(X0)= " << theNuclIntLength[currIdx] << " IntLength(X0)= " @@ -263,7 +315,8 @@ void NuclearInteractionFTFSimulator::compute(ParticlePropagator& Particle, double px = Particle.momentum().px(); double py = Particle.momentum().py(); double pz = Particle.momentum().pz(); - double norm = 1.0/sqrt(px*px + py*py + pz*pz); + double ptot = sqrt(px*px + py*py + pz*pz); + double norm = 1./ptot; G4ThreeVector dir(px*norm, py*norm, pz*norm); /* std::cout << " Primary " << currParticle->GetParticleName() @@ -279,63 +332,85 @@ void NuclearInteractionFTFSimulator::compute(ParticlePropagator& Particle, delete currTrack; G4HadFinalState* result; - // Bertini cascade for low-energy hadrons (except light anti-nuclei) - // FTFP is applied above energy limit and for all anti-hyperons and anti-ions - if(ekin <= theBertiniLimit && currIdx < 17) { - result = theBertiniCascade->ApplyYourself(theProjectile, targetNucleus); + + // elastic interaction + if(random->flatShoot()*(intLengthElastic + intLengthInelastic) > intLengthElastic) { + + result = theDiffuseElastic->ApplyYourself(theProjectile, targetNucleus); + G4ThreeVector dirnew = result->GetMomentumChange().unit(); + double cost = (dir*dirnew); + double sint = std::sqrt((1. - cost)*(1. + cost)); + + curr4Mom.set(ptot*dirnew.x(),ptot*dirnew.y(),ptot*dirnew.z(),Particle.momentum().e()); + + // Always create a daughter if the kink is large engough + if (sint > theDistCut) { + saveDaughter(Particle, curr4Mom, thePid); + } else { + Particle.SetXYZT(curr4Mom.px(), curr4Mom.py(), curr4Mom.pz(), curr4Mom.e()); + } + + // inelastic interaction } else { - result = theHadronicModel->ApplyYourself(theProjectile, targetNucleus); - } - if(result) { - - int nsec = result->GetNumberOfSecondaries(); - if(0 < nsec) { - - result->SetTrafoToLab(theProjectile.GetTrafoToLab()); - _theUpdatedState.clear(); - - //std::cout << " " << nsec << " secondaries" << std::endl; - // Generate angle - double phi = random->flatShoot()*CLHEP::twopi; - theClosestChargedDaughterId = -1; - distMin = 1e99; - - // rotate and store secondaries - for (int j=0; j<nsec; ++j) { - - const G4DynamicParticle* dp = result->GetSecondary(j)->GetParticle(); - int thePid = dp->GetParticleDefinition()->GetPDGEncoding(); - - // rotate around primary direction - curr4Mom = dp->Get4Momentum(); - curr4Mom.rotate(phi, vectProj); - curr4Mom *= result->GetTrafoToLab(); - /* - std::cout << j << ". " << dp->GetParticleDefinition()->GetParticleName() - << " " << thePid - << " " << curr4Mom*fact << std::endl; - */ - // prompt 2-gamma decay for pi0, eta, eta'p - if(111 == thePid || 221 == thePid || 331 == thePid) { - theBoost = curr4Mom.boostVector(); - double e = 0.5*dp->GetParticleDefinition()->GetPDGMass(); - double fi = random->flatShoot()*CLHEP::twopi; - double cth = 2*random->flatShoot() - 1.0; - double sth = sqrt((1.0 - cth)*(1.0 + cth)); - G4LorentzVector lv(e*sth*cos(fi),e*sth*sin(fi),e*cth,e); - lv.boost(theBoost); - saveDaughter(Particle, lv, 22); - curr4Mom -= lv; - if(curr4Mom.e() > theEnergyLimit) { - saveDaughter(Particle, curr4Mom, 22); - } - } else { - if(curr4Mom.e() > theEnergyLimit + dp->GetParticleDefinition()->GetPDGMass()) { - saveDaughter(Particle, curr4Mom, thePid); + + // Bertini cascade for low-energy hadrons (except light anti-nuclei) + // FTFP is applied above energy limit and for all anti-hyperons and anti-ions + if(ekin <= theBertiniLimit && currIdx < 17) { + result = theBertiniCascade->ApplyYourself(theProjectile, targetNucleus); + } else { + result = theHadronicModel->ApplyYourself(theProjectile, targetNucleus); + } + if(result) { + + int nsec = result->GetNumberOfSecondaries(); + if(0 < nsec) { + + result->SetTrafoToLab(theProjectile.GetTrafoToLab()); + _theUpdatedState.clear(); + + //std::cout << " " << nsec << " secondaries" << std::endl; + // Generate angle + double phi = random->flatShoot()*CLHEP::twopi; + theClosestChargedDaughterId = -1; + distMin = 1e99; + + // rotate and store secondaries + for (int j=0; j<nsec; ++j) { + + const G4DynamicParticle* dp = result->GetSecondary(j)->GetParticle(); + int thePid = dp->GetParticleDefinition()->GetPDGEncoding(); + + // rotate around primary direction + curr4Mom = dp->Get4Momentum(); + curr4Mom.rotate(phi, vectProj); + curr4Mom *= result->GetTrafoToLab(); + /* + std::cout << j << ". " << dp->GetParticleDefinition()->GetParticleName() + << " " << thePid + << " " << curr4Mom*fact << std::endl; + */ + // prompt 2-gamma decay for pi0, eta, eta'p + if(111 == thePid || 221 == thePid || 331 == thePid) { + theBoost = curr4Mom.boostVector(); + double e = 0.5*dp->GetParticleDefinition()->GetPDGMass(); + double fi = random->flatShoot()*CLHEP::twopi; + double cth = 2*random->flatShoot() - 1.0; + double sth = sqrt((1.0 - cth)*(1.0 + cth)); + G4LorentzVector lv(e*sth*cos(fi),e*sth*sin(fi),e*cth,e); + lv.boost(theBoost); + saveDaughter(Particle, lv, 22); + curr4Mom -= lv; + if(curr4Mom.e() > theEnergyLimit) { + saveDaughter(Particle, curr4Mom, 22); + } + } else { + if(curr4Mom.e() > theEnergyLimit + dp->GetParticleDefinition()->GetPDGMass()) { + saveDaughter(Particle, curr4Mom, thePid); + } } } + result->Clear(); } - result->Clear(); } } } From 9d708f4d080047d4e24b6f29a5f9b637d5a8a804 Mon Sep 17 00:00:00 2001 From: Martin Grunewald <Martin.Grunewald@cern.ch> Date: Fri, 22 May 2015 08:03:32 +0200 Subject: [PATCH 25/26] Fix FastSim HLT in Matrix (75X) --- HLTrigger/Configuration/python/CustomConfigs.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/HLTrigger/Configuration/python/CustomConfigs.py b/HLTrigger/Configuration/python/CustomConfigs.py index e3823df2f9642..a229c6c079880 100644 --- a/HLTrigger/Configuration/python/CustomConfigs.py +++ b/HLTrigger/Configuration/python/CustomConfigs.py @@ -96,6 +96,8 @@ def MassReplaceInputTag(process,old="rawDataCollector",new="rawDataRepacker",ver from PhysicsTools.PatAlgos.tools.helpers import massSearchReplaceAnyInputTag for s in process.paths_().keys(): massSearchReplaceAnyInputTag(getattr(process,s),old,new,verbose,moduleLabelOnly,skipLabelTest) + for s in process.endpaths_().keys(): + massSearchReplaceAnyInputTag(getattr(process,s),old,new,verbose,moduleLabelOnly,skipLabelTest) return(process) def MassReplaceParameter(process,name="label",old="rawDataCollector",new="rawDataRepacker",verbose=False): @@ -103,6 +105,8 @@ def MassReplaceParameter(process,name="label",old="rawDataCollector",new="rawDat from PhysicsTools.PatAlgos.tools.helpers import massSearchReplaceParam for s in process.paths_().keys(): massSearchReplaceParam(getattr(process,s),name,old,new,verbose) + for s in process.endpaths_().keys(): + massSearchReplaceParam(getattr(process,s),name,old,new,verbose) return(process) def L1REPACK(process): From cd5a10d994b156dcf03289157581f26d7234a9f7 Mon Sep 17 00:00:00 2001 From: David Abdurachmanov <David.Abdurachmanov@cern.ch> Date: Fri, 22 May 2015 12:52:11 +0200 Subject: [PATCH 26/26] TF1::GetParErrors() const returns const Double_t * in ROOT 6.04.00 Update in ROOT 6.04.00 changed return type of TF1::GetParErrors() const to be const. See ROOT commit: 0539de6de4bb7aba2160da0195296aa0d94209ce Signed-off-by: David Abdurachmanov <David.Abdurachmanov@cern.ch> --- DQMServices/ClientConfig/plugins/DQMGenericClient.cc | 2 +- .../MomentumScaleCalibration/plugins/MuScleFitUtils.cc | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/DQMServices/ClientConfig/plugins/DQMGenericClient.cc b/DQMServices/ClientConfig/plugins/DQMGenericClient.cc index 43df72529f116..7c3797c7fbee6 100644 --- a/DQMServices/ClientConfig/plugins/DQMGenericClient.cc +++ b/DQMServices/ClientConfig/plugins/DQMGenericClient.cc @@ -853,7 +853,7 @@ void DQMGenericClient::limitedFit(MonitorElement * srcME, MonitorElement * meanM // histoY->Fit(fitFcn->GetName(),"RME"); double *par = fitFcn->GetParameters(); - double *err = fitFcn->GetParErrors(); + const double *err = fitFcn->GetParErrors(); meanME->setBinContent(i, par[1]); meanME->setBinError(i, err[1]); diff --git a/MuonAnalysis/MomentumScaleCalibration/plugins/MuScleFitUtils.cc b/MuonAnalysis/MomentumScaleCalibration/plugins/MuScleFitUtils.cc index 76c6d9a21a7de..835ca90663ae0 100644 --- a/MuonAnalysis/MomentumScaleCalibration/plugins/MuScleFitUtils.cc +++ b/MuonAnalysis/MomentumScaleCalibration/plugins/MuScleFitUtils.cc @@ -1938,7 +1938,7 @@ std::vector<TGraphErrors*> MuScleFitUtils::fitMass (TH2F* histo) { if (cont>cont_min) { histoY->Fit ("fitFcn", "0", "", 70, 110); double *par = fitFcn->GetParameters(); - double *err = fitFcn->GetParErrors(); + const double *err = fitFcn->GetParErrors(); Ftop.push_back(par[0]); Fwidth.push_back(par[1]); @@ -2047,7 +2047,7 @@ std::vector<TGraphErrors*> MuScleFitUtils::fitReso (TH2F* histo) { if (cont>cont_min) { histoY->Fit ("fitFunc", "0", "", -0.2, 0.2); double *par = fitFcn->GetParameters(); - double *err = fitFcn->GetParErrors(); + const double *err = fitFcn->GetParErrors(); maxs.push_back (par[0]); means.push_back (par[1]);