test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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

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 73 of file IsoDepositVetoFactory.cc.

References Exception, and runTheMatrix::ret.

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

73  {
75  std::auto_ptr<reco::isodeposit::AbsVeto> ret(make(string,evdep, iC));
76  if (evdep != 0) {
77  throw cms::Exception("Configuration") << "The resulting AbsVeto depends on the edm::Event.\n"
78  << "Please use the two-arguments IsoDepositVetoFactory::make.\n";
79  }
80  return ret.release();
81 }
static reco::isodeposit::AbsVeto * make(const char *string, edm::ConsumesCollector &iC)
tuple ret
prodAgent to be discontinued
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 84 of file IsoDepositVetoFactory.cc.

References Exception, plotBeamSpotDB::first, make(), match(), contentValuesFiles::number, runTheMatrix::ret, AlCaHLTBitMon_QueryRunRegistry::string, and dtDQMClient_cfg::threshold.

84  {
85  using namespace reco::isodeposit;
86  static boost::regex
87  ecalSwitch("^Ecal(Barrel|Endcaps):(.*)"),
88  threshold("Threshold\\((\\d+\\.\\d+)\\)"),
89  thresholdtransverse("ThresholdFromTransverse\\((\\d+\\.\\d+)\\)"),
90  absthreshold("AbsThreshold\\((\\d+\\.\\d+)\\)"),
91  absthresholdtransverse("AbsThresholdFromTransverse\\((\\d+\\.\\d+)\\)"),
92  cone("ConeVeto\\((\\d+\\.\\d+)\\)"),
93  angleCone("AngleCone\\((\\d+\\.\\d+)\\)"),
94  angleVeto("AngleVeto\\((\\d+\\.\\d+)\\)"),
95  rectangularEtaPhiVeto("RectangularEtaPhiVeto\\(([+-]?\\d+\\.\\d+),([+-]?\\d+\\.\\d+),([+-]?\\d+\\.\\d+),([+-]?\\d+\\.\\d+)\\)"),
96  numCrystal("NumCrystalVeto\\((\\d+\\.\\d+)\\)"),
97  numCrystalEtaPhi("NumCrystalEtaPhiVeto\\((\\d+\\.\\d+),(\\d+\\.\\d+)\\)"),
98  otherCandidatesDR("OtherCandidatesByDR\\((\\w+:?\\w*:?\\w*),\\s*(\\d+\\.?|\\d*\\.\\d*)\\)"),
99  otherJetConstituentsDR("OtherJetConstituentsDeltaRVeto\\((\\w+:?\\w*:?\\w*),\\s*(\\d+\\.?|\\d*\\.\\d*),\\s*(\\w+:?\\w*:?\\w*),\\s*(\\d+\\.?|\\d*\\.\\d*)\\)"),
100  otherCand("^(.*?):(.*)"),
101  number("^(\\d+\\.?|\\d*\\.\\d*)$");
102  boost::cmatch match;
103 
104  //std::cout << "<IsoDepositVetoFactory::make>:" << std::endl;
105  //std::cout << " string = " << string << std::endl;
106 
107  evdep = 0; // by default it does not depend on this
108  if (regex_match(string, match, ecalSwitch)) {
109  return new SwitchingEcalVeto(make(match[2].first, iC), (match[1] == "Barrel") );
110  } else if (regex_match(string, match, threshold)) {
111  return new ThresholdVeto(atof(match[1].first));
112  } else if (regex_match(string, match, thresholdtransverse)) {
113  return new ThresholdVetoFromTransverse(atof(((std::string)match[1]).c_str()));
114  } else if (regex_match(string, match, absthreshold)) {
115  return new AbsThresholdVeto(atof(match[1].first));
116  } else if (regex_match(string, match, absthresholdtransverse)) {
117  return new AbsThresholdVetoFromTransverse(atof(((std::string)match[1]).c_str()));
118  } else if (regex_match(string, match, cone)) {
119  return new ConeVeto(Direction(), atof(match[1].first));
120  } else if (regex_match(string, match, number)) {
121  return new ConeVeto(Direction(), atof(match[1].first));
122  } else if (regex_match(string, match, angleCone)) {
123  return new AngleCone(Direction(), atof(match[1].first));
124  } else if (regex_match(string, match, angleVeto)) {
125  return new AngleConeVeto(Direction(), atof(match[1].first));
126  } else if (regex_match(string, match, rectangularEtaPhiVeto)) {
127  return new RectangularEtaPhiVeto(Direction(),
128  atof(match[1].first), atof(match[2].first),
129  atof(match[3].first), atof(match[4].first));
130  } else if (regex_match(string, match, numCrystal)) {
131  return new NumCrystalVeto(Direction(), atof(match[1].first));
132  } else if (regex_match(string, match, numCrystalEtaPhi)) {
133  return new NumCrystalEtaPhiVeto(Direction(),atof(match[1].first),atof(match[2].first));
134  } else if (regex_match(string, match, otherCandidatesDR)) {
136  atof(match[2].first),
137  iC);
138  evdep = ret;
139  return ret;
140  } else if (regex_match(string, match, otherJetConstituentsDR)) {
142  edm::InputTag(match[1]), atof(match[2].first),
143  edm::InputTag(match[3]), atof(match[4].first),
144  iC);
145  evdep = ret;
146  return ret;
147  } else if (regex_match(string, match, otherCand)) {
149  make(match[2].first, iC), iC);
150  evdep = ret;
151  return ret;
152  } else {
153  throw cms::Exception("Not Implemented") << "Veto " << string << " not implemented yet...";
154  }
155 }
static reco::isodeposit::AbsVeto * make(const char *string, edm::ConsumesCollector &iC)
tuple 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