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)
 
static reco::isodeposit::AbsVetomake (const char *string, reco::isodeposit::EventDependentAbsVeto *&evdep)
 

Detailed Description

Definition at line 7 of file IsoDepositVetoFactory.h.

Member Function Documentation

reco::isodeposit::AbsVeto * IsoDepositVetoFactory::make ( const char *  string)
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 edm::hlt::Exception, and runTheMatrix::ret.

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

73  {
75  std::auto_ptr<reco::isodeposit::AbsVeto> ret(make(string,evdep));
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)
reco::isodeposit::AbsVeto * IsoDepositVetoFactory::make ( const char *  string,
reco::isodeposit::EventDependentAbsVeto *&  evdep 
)
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 edm::hlt::Exception, first, make(), match(), runTheMatrix::ret, and dtT0WireCalibration_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  otherCand("^(.*?):(.*)"),
100  number("^(\\d+\\.?|\\d*\\.\\d*)$");
101  boost::cmatch match;
102 
103  evdep = 0; // by default it does not depend on this
104  if (regex_match(string, match, ecalSwitch)) {
105  return new SwitchingEcalVeto(make(match[2].first), (match[1] == "Barrel") );
106  } else if (regex_match(string, match, threshold)) {
107  return new ThresholdVeto(atof(match[1].first));
108  } else if (regex_match(string, match, thresholdtransverse)) {
109  return new ThresholdVetoFromTransverse(atof(((std::string)match[1]).c_str()));
110  } else if (regex_match(string, match, absthreshold)) {
111  return new AbsThresholdVeto(atof(match[1].first));
112  } else if (regex_match(string, match, absthresholdtransverse)) {
113  return new AbsThresholdVetoFromTransverse(atof(((std::string)match[1]).c_str()));
114  } else if (regex_match(string, match, cone)) {
115  return new ConeVeto(Direction(), atof(match[1].first));
116  } else if (regex_match(string, match, number)) {
117  return new ConeVeto(Direction(), atof(match[1].first));
118  } else if (regex_match(string, match, angleCone)) {
119  return new AngleCone(Direction(), atof(match[1].first));
120  } else if (regex_match(string, match, angleVeto)) {
121  return new AngleConeVeto(Direction(), atof(match[1].first));
122  } else if (regex_match(string, match, rectangularEtaPhiVeto)) {
123  return new RectangularEtaPhiVeto(Direction(),
124  atof(match[1].first), atof(match[2].first),
125  atof(match[3].first), atof(match[4].first));
126  } else if (regex_match(string, match, numCrystal)) {
127  return new NumCrystalVeto(Direction(), atof(match[1].first));
128  } else if (regex_match(string, match, numCrystalEtaPhi)) {
129  return new NumCrystalEtaPhiVeto(Direction(),atof(match[1].first),atof(match[2].first));
130  } else if (regex_match(string, match, otherCandidatesDR)) {
132  atof(match[2].first));
133  evdep = ret;
134  return ret;
135  } else if (regex_match(string, match, otherCand)) {
137  make(match[2].first));
138  evdep = ret;
139  return ret;
140  } else {
141  throw cms::Exception("Not Implemented") << "Veto " << string << " not implemented yet...";
142  }
143 }
bool first
Definition: L1TdeRCT.cc:79
static reco::isodeposit::AbsVeto * make(const char *string)
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:6