CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

reco::modules::TrackerTrackHitFilter::Rule Class Reference

List of all members.

Public Member Functions

void apply (DetId detid, bool &verdict) const
 Rule (const std::string &str)

Private Member Functions

int layer (DetId detid) const

Private Attributes

bool keep_
int layer_
int subdet_

Detailed Description

Definition at line 84 of file TrackerTrackHitFilter.cc.


Constructor & Destructor Documentation

reco::modules::TrackerTrackHitFilter::Rule::Rule ( const std::string &  str)

Definition at line 164 of file TrackerTrackHitFilter.cc.

References gather_cfg::cout, Exception, first, keep_, layer_, match(), PixelSubdetector::PixelBarrel, PixelSubdetector::PixelEndcap, edm::second(), subdet_, StripSubdetector::TEC, StripSubdetector::TIB, StripSubdetector::TID, and StripSubdetector::TOB.

                                                    {
    static boost::regex rule("(keep|drop)\\s+([A-Z]+)(\\s+(\\d+))?");
    boost::cmatch match;
    std::string match_1;
    std::string match_2;
    std::string match_3;
    // match and check it works
    if (!regex_match(str.c_str(), match, rule)) {
        throw cms::Exception("Configuration") << "Rule '" << str << "' not understood.\n";
    }
    else{
      std::cout<<"*** Rule Command given to TrackerTrackHitFilter:\t"<<str<<std::endl;

    }
    // Set up fields:
    //  rule type
    keep_  = (strncmp(match[1].first,"keep",4 )== 0);
   
    //  subdet
    subdet_ = -1;
    if      (strncmp(match[2].first, "PXB", 3) == 0) subdet_ = PixelSubdetector::PixelBarrel;
    else if (strncmp(match[2].first, "PXE", 3) == 0) subdet_ = PixelSubdetector::PixelEndcap;
    else if (strncmp(match[2].first, "TIB", 3) == 0) subdet_ = StripSubdetector::TIB;
    else if (strncmp(match[2].first, "TID", 3) == 0) subdet_ = StripSubdetector::TID;
    else if (strncmp(match[2].first, "TOB", 3) == 0) subdet_ = StripSubdetector::TOB;
    else if (strncmp(match[2].first, "TEC", 3) == 0) subdet_ = StripSubdetector::TEC;
    if (subdet_ == -1) {
        throw cms::Exception("Configuration") << "Detector '" << match[2].first << "' not understood. Should be PXB, PXE, TIB, TID, TOB, TEC.\n";
    }
    //   layer (if present)
    if (match[4].first != match[4].second) {
        layer_ = atoi(match[4].first);        
    } else {
        layer_ = 0;
    }
}//end Rule::Rule

Member Function Documentation

void reco::modules::TrackerTrackHitFilter::Rule::apply ( DetId  detid,
bool &  verdict 
) const [inline]

Definition at line 89 of file TrackerTrackHitFilter.cc.

References keep_, layer(), layer_, subdet_, and DetId::subdetId().

                                                    {
        // check detector
        if (detid.subdetId() == subdet_) {
          // check layer
          if ( (layer_ == 0) || (layer_ == layer(detid)) ) {
            // override verdict
            verdict = keep_;
            //  std::cout<<"Verdict is "<<verdict<<" for subdet "<<subdet_<<", layer "<<layer_<<"! "<<std::endl;
          }
          // else std::cout<<"No, sorry, wrong layer.Retry..."<<std::endl;
        }
        //      else{ std::cout<<"No, sorry, wrong subdet.Retry..."<<std::endl;}
      }
int reco::modules::TrackerTrackHitFilter::Rule::layer ( DetId  detid) const [private]

Member Data Documentation

Definition at line 106 of file TrackerTrackHitFilter.cc.

Referenced by apply(), and Rule().

Definition at line 105 of file TrackerTrackHitFilter.cc.

Referenced by apply(), and Rule().

Definition at line 103 of file TrackerTrackHitFilter.cc.

Referenced by apply(), and Rule().