CMS 3D CMS Logo

Static Public Member Functions

IsoDepositVetoFactory Class Reference

#include <IsoDepositVetoFactory.h>

List of all members.

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 Exception, and runTheMatrix::ret.

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

                                              {
    reco::isodeposit::EventDependentAbsVeto * evdep = 0;
    std::auto_ptr<reco::isodeposit::AbsVeto> ret(make(string,evdep));
    if (evdep != 0) {
        throw cms::Exception("Configuration") << "The resulting AbsVeto depends on the edm::Event.\n" 
                                              << "Please use the two-arguments IsoDepositVetoFactory::make.\n";
    }
    return ret.release();
}
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 Exception, first, make(), match(), runTheMatrix::ret, and dtT0WireCalibration_cfg::threshold.

                                                                                           {
    using namespace reco::isodeposit;
    static boost::regex 
        ecalSwitch("^Ecal(Barrel|Endcaps):(.*)"),
        threshold("Threshold\\((\\d+\\.\\d+)\\)"),
        thresholdtransverse("ThresholdFromTransverse\\((\\d+\\.\\d+)\\)"),
        absthreshold("AbsThreshold\\((\\d+\\.\\d+)\\)"),
        absthresholdtransverse("AbsThresholdFromTransverse\\((\\d+\\.\\d+)\\)"),
        cone("ConeVeto\\((\\d+\\.\\d+)\\)"),
        angleCone("AngleCone\\((\\d+\\.\\d+)\\)"),
        angleVeto("AngleVeto\\((\\d+\\.\\d+)\\)"),
        rectangularEtaPhiVeto("RectangularEtaPhiVeto\\(([+-]?\\d+\\.\\d+),([+-]?\\d+\\.\\d+),([+-]?\\d+\\.\\d+),([+-]?\\d+\\.\\d+)\\)"),
        numCrystal("NumCrystalVeto\\((\\d+\\.\\d+)\\)"),
        numCrystalEtaPhi("NumCrystalEtaPhiVeto\\((\\d+\\.\\d+),(\\d+\\.\\d+)\\)"),
        otherCandidatesDR("OtherCandidatesByDR\\((\\w+:?\\w*:?\\w*),\\s*(\\d+\\.?|\\d*\\.\\d*)\\)"),
        otherCand("^(.*?):(.*)"),
        number("^(\\d+\\.?|\\d*\\.\\d*)$");
    boost::cmatch match;
    
    evdep = 0; // by default it does not depend on this
    if (regex_match(string, match, ecalSwitch)) {
        return new SwitchingEcalVeto(make(match[2].first), (match[1] == "Barrel") );
    } else if (regex_match(string, match, threshold)) {
        return new ThresholdVeto(atof(match[1].first));
    } else if (regex_match(string, match, thresholdtransverse)) {
        return new ThresholdVetoFromTransverse(atof(((std::string)match[1]).c_str()));
    } else if (regex_match(string, match, absthreshold)) {
        return new AbsThresholdVeto(atof(match[1].first));
    } else if (regex_match(string, match, absthresholdtransverse)) {
        return new AbsThresholdVetoFromTransverse(atof(((std::string)match[1]).c_str()));
    } else if (regex_match(string, match, cone)) {
        return new ConeVeto(Direction(), atof(match[1].first));
    } else if (regex_match(string, match, number)) {
        return new ConeVeto(Direction(), atof(match[1].first));
    } else if (regex_match(string, match, angleCone)) {
        return new AngleCone(Direction(), atof(match[1].first));
    } else if (regex_match(string, match, angleVeto)) {
        return new AngleConeVeto(Direction(), atof(match[1].first));
    } else if (regex_match(string, match, rectangularEtaPhiVeto)) {
        return new RectangularEtaPhiVeto(Direction(), 
                    atof(match[1].first), atof(match[2].first), 
                    atof(match[3].first), atof(match[4].first));
    } else if (regex_match(string, match, numCrystal)) {
        return new NumCrystalVeto(Direction(), atof(match[1].first));
    } else if (regex_match(string, match, numCrystalEtaPhi)) {
        return new NumCrystalEtaPhiVeto(Direction(),atof(match[1].first),atof(match[2].first));
    } else if (regex_match(string, match, otherCandidatesDR)) {
        OtherCandidatesDeltaRVeto *ret = new OtherCandidatesDeltaRVeto(edm::InputTag(match[1]), 
                                                                        atof(match[2].first));
        evdep = ret;
        return ret;
    } else if (regex_match(string, match, otherCand)) {
        OtherCandVeto *ret = new OtherCandVeto(edm::InputTag(match[1]), 
                                                           make(match[2].first));
        evdep = ret;
        return ret;
    } else {
        throw cms::Exception("Not Implemented") << "Veto " << string << " not implemented yet...";
    }
}