CMS 3D CMS Logo

List of all members | Static Public Member Functions
IsoDepositVetoFactory Class Reference

#include <IsoDepositVetoFactory.h>

Static Public Member Functions

static reco::isodeposit::AbsVetomake (const char *string, edm::ConsumesCollector &iC)
 
static reco::isodeposit::AbsVetomake (const char *string, reco::isodeposit::EventDependentAbsVeto *&evdep, edm::ConsumesCollector &iC)
 

Detailed Description

Definition at line 8 of file IsoDepositVetoFactory.h.

Member Function Documentation

◆ make() [1/2]

reco::isodeposit::AbsVeto * IsoDepositVetoFactory::make ( const char *  string,
edm::ConsumesCollector iC 
)
static

Returns a pointer to an AbsVeto defined by the string. The calling code owns the pointer, and must delete it at the end. An exception will be thrown if the resulting AbsVeto depends on the edm::Event

Definition at line 72 of file IsoDepositVetoFactory.cc.

References Exception, and runTheMatrix::ret.

Referenced by pat::helper::IsoDepositIsolator::IsoDepositIsolator(), make(), CandIsolatorFromDeposits::SingleDeposit::SingleDeposit(), and PFCandIsolatorFromDeposits::SingleDeposit::SingleDeposit().

72  {
74  std::unique_ptr<reco::isodeposit::AbsVeto> ret(make(string, evdep, iC));
75  if (evdep != nullptr) {
76  throw cms::Exception("Configuration") << "The resulting AbsVeto depends on the edm::Event.\n"
77  << "Please use the two-arguments IsoDepositVetoFactory::make.\n";
78  }
79  return ret.release();
80 }
static reco::isodeposit::AbsVeto * make(const char *string, edm::ConsumesCollector &iC)
ret
prodAgent to be discontinued

◆ make() [2/2]

reco::isodeposit::AbsVeto * IsoDepositVetoFactory::make ( const char *  string,
reco::isodeposit::EventDependentAbsVeto *&  evdep,
edm::ConsumesCollector iC 
)
static

As above, but will allow also AbsVetos which depend from the edm::Event If the resulting veto is dependent on the edm::Event, the value of the second pointer will be set to non-zero Note that both pointers will point to the same object, so you have to delete it only once.

Definition at line 82 of file IsoDepositVetoFactory.cc.

References hltPFPuppi_cfi::cone, Exception, dqmdumpme::first, make(), match(), contentValuesFiles::number, runTheMatrix::ret, AlCaHLTBitMon_QueryRunRegistry::string, and DiMuonV_cfg::threshold.

84  {
85  using namespace reco::isodeposit;
86  static const std::regex ecalSwitch("^Ecal(Barrel|Endcaps):(.*)"), threshold("Threshold\\((\\d+\\.\\d+)\\)"),
87  thresholdtransverse("ThresholdFromTransverse\\((\\d+\\.\\d+)\\)"),
88  absthreshold("AbsThreshold\\((\\d+\\.\\d+)\\)"),
89  absthresholdtransverse("AbsThresholdFromTransverse\\((\\d+\\.\\d+)\\)"), cone("ConeVeto\\((\\d+\\.\\d+)\\)"),
90  angleCone("AngleCone\\((\\d+\\.\\d+)\\)"), angleVeto("AngleVeto\\((\\d+\\.\\d+)\\)"),
91  rectangularEtaPhiVeto(
92  "RectangularEtaPhiVeto\\(([+-]?\\d+\\.\\d+),([+-]?\\d+\\.\\d+),([+-]?\\d+\\.\\d+),([+-]?\\d+\\.\\d+)\\)"),
93  numCrystal("NumCrystalVeto\\((\\d+\\.\\d+)\\)"),
94  numCrystalEtaPhi("NumCrystalEtaPhiVeto\\((\\d+\\.\\d+),(\\d+\\.\\d+)\\)"),
95  otherCandidatesDR("OtherCandidatesByDR\\((\\w+:?\\w*:?\\w*),\\s*(\\d+\\.?|\\d*\\.\\d*)\\)"),
96  otherJetConstituentsDR(
97  "OtherJetConstituentsDeltaRVeto\\((\\w+:?\\w*:?\\w*),\\s*(\\d+\\.?|\\d*\\.\\d*),\\s*(\\w+:?\\w*:?\\w*),\\s*("
98  "\\d+\\.?|\\d*\\.\\d*)\\)"),
99  otherCand("^(.*?):(.*)"), number("^(\\d+\\.?|\\d*\\.\\d*)$");
100  std::cmatch match;
101 
102  evdep = nullptr; // by default it does not depend on this
103  if (regex_match(string, match, ecalSwitch)) {
104  return new SwitchingEcalVeto(make(match[2].first, iC), (match[1] == "Barrel"));
105  } else if (regex_match(string, match, threshold)) {
106  return new ThresholdVeto(atof(match[1].first));
107  } else if (regex_match(string, match, thresholdtransverse)) {
108  return new ThresholdVetoFromTransverse(atof(((std::string)match[1]).c_str()));
109  } else if (regex_match(string, match, absthreshold)) {
110  return new AbsThresholdVeto(atof(match[1].first));
111  } else if (regex_match(string, match, absthresholdtransverse)) {
112  return new AbsThresholdVetoFromTransverse(atof(((std::string)match[1]).c_str()));
113  } else if (regex_match(string, match, cone)) {
114  return new ConeVeto(Direction(), atof(match[1].first));
115  } else if (regex_match(string, match, number)) {
116  return new ConeVeto(Direction(), atof(match[1].first));
117  } else if (regex_match(string, match, angleCone)) {
118  return new AngleCone(Direction(), atof(match[1].first));
119  } else if (regex_match(string, match, angleVeto)) {
120  return new AngleConeVeto(Direction(), atof(match[1].first));
121  } else if (regex_match(string, match, rectangularEtaPhiVeto)) {
122  return new RectangularEtaPhiVeto(
123  Direction(), atof(match[1].first), atof(match[2].first), atof(match[3].first), atof(match[4].first));
124  } else if (regex_match(string, match, numCrystal)) {
125  return new NumCrystalVeto(Direction(), atof(match[1].first));
126  } else if (regex_match(string, match, numCrystalEtaPhi)) {
127  return new NumCrystalEtaPhiVeto(Direction(), atof(match[1].first), atof(match[2].first));
128  } else if (regex_match(string, match, otherCandidatesDR)) {
130  evdep = ret;
131  return ret;
132  } else if (regex_match(string, match, otherJetConstituentsDR)) {
134  Direction(), edm::InputTag(match[1]), atof(match[2].first), edm::InputTag(match[3]), atof(match[4].first), iC);
135  evdep = ret;
136  return ret;
137  } else if (regex_match(string, match, otherCand)) {
139  evdep = ret;
140  return ret;
141  } else {
142  throw cms::Exception("Not Implemented") << "Veto " << string << " not implemented yet...";
143  }
144 }
static reco::isodeposit::AbsVeto * make(const char *string, edm::ConsumesCollector &iC)
ret
prodAgent to be discontinued
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:10