CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
reco::modules::TrackerTrackHitFilter::Rule Class Reference

Public Member Functions

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

Private Member Functions

int layer (DetId detid, const TrackerTopology *tTopo) const
 

Private Attributes

bool keep_
 
int layer_
 
int subdet_
 

Detailed Description

Definition at line 83 of file TrackerTrackHitFilter.cc.

Constructor & Destructor Documentation

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

Definition at line 165 of file TrackerTrackHitFilter.cc.

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

165  {
166  static const boost::regex rule("(keep|drop)\\s+([A-Z]+)(\\s+(\\d+))?");
167  boost::cmatch match;
168  std::string match_1;
169  std::string match_2;
170  std::string match_3;
171  // match and check it works
172  if (!regex_match(str.c_str(), match, rule)) {
173  throw cms::Exception("Configuration") << "Rule '" << str << "' not understood.\n";
174  }
175  else{
176  edm::LogInfo("TrackerTrackHitFilter") << "*** Rule Command given to TrackerTrackHitFilter:\t"<<str;
177 
178  }
179  // Set up fields:
180  // rule type
181  keep_ = (strncmp(match[1].first,"keep",4 )== 0);
182 
183  // subdet
184  subdet_ = -1;
185  if (strncmp(match[2].first, "PXB", 3) == 0) subdet_ = PixelSubdetector::PixelBarrel;
186  else if (strncmp(match[2].first, "PXE", 3) == 0) subdet_ = PixelSubdetector::PixelEndcap;
187  else if (strncmp(match[2].first, "TIB", 3) == 0) subdet_ = StripSubdetector::TIB;
188  else if (strncmp(match[2].first, "TID", 3) == 0) subdet_ = StripSubdetector::TID;
189  else if (strncmp(match[2].first, "TOB", 3) == 0) subdet_ = StripSubdetector::TOB;
190  else if (strncmp(match[2].first, "TEC", 3) == 0) subdet_ = StripSubdetector::TEC;
191  if (subdet_ == -1) {
192  throw cms::Exception("Configuration") << "Detector '" << match[2].first << "' not understood. Should be PXB, PXE, TIB, TID, TOB, TEC.\n";
193  }
194  // layer (if present)
195  if (match[4].first != match[4].second) {
196  layer_ = atoi(match[4].first);
197  } else {
198  layer_ = 0;
199  }
200 }//end Rule::Rule
U second(std::pair< T, U > const &p)
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:10

Member Function Documentation

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

Definition at line 88 of file TrackerTrackHitFilter.cc.

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

Referenced by heavyIonTools.ConfigureHeavyIons::__call__(), editorTools.UserCodeTool::__call__(), HiCoreTools.RestrictInputToAOD::__call__(), coreTools.RunOnData::__call__(), trackTools.MakeAODTrackCandidates::__call__(), runJetUncertainties.RunJetUncertainties::__call__(), metTools.AddMETCollection::__call__(), heavyIonTools.ProductionDefaults::__call__(), editorTools.ChangeSource::__call__(), HiCoreTools.RemoveMCMatching::__call__(), coreTools.RemoveMCMatching::__call__(), trackTools.MakePATTrackCandidates::__call__(), trigTools.SwitchOnTrigger::__call__(), heavyIonTools.SelectionDefaults::__call__(), HiCoreTools.RemoveAllPATObjectsBut::__call__(), heavyIonTools.DisbaleMonteCarloDeps::__call__(), HiCoreTools.RemoveSpecificPATObjects::__call__(), trigTools.SwitchOnTriggerStandAlone::__call__(), trackTools.MakeTrackCandidates::__call__(), trigTools.SwitchOnTriggerMatching::__call__(), HiCoreTools.RemoveCleaning::__call__(), HiCoreTools.AddCleaning::__call__(), jetTools.AddJetCollection::__call__(), tauTools.AddTauCollection::__call__(), trigTools.SwitchOnTriggerMatchingStandAlone::__call__(), trigTools.SwitchOnTriggerMatchEmbedding::__call__(), jetTools.SwitchJetCollection::__call__(), jetTools.UpdateJetCollection::__call__(), jetTools.AddJetID::__call__(), and jetTools.SetTagInfos::__call__().

88  {
89  // check detector
90  if (detid.subdetId() == subdet_) {
91  // check layer
92  if ( (layer_ == 0) || (layer_ == layer(detid, tTopo)) ) {
93  // override verdict
94  verdict = keep_;
95  // std::cout<<"Verdict is "<<verdict<<" for subdet "<<subdet_<<", layer "<<layer_<<"! "<<std::endl;
96  }
97  // else std::cout<<"No, sorry, wrong layer.Retry..."<<std::endl;
98  }
99  // else{ std::cout<<"No, sorry, wrong subdet.Retry..."<<std::endl;}
100  }
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:37
int layer(DetId detid, const TrackerTopology *tTopo) const
int reco::modules::TrackerTrackHitFilter::Rule::layer ( DetId  detid,
const TrackerTopology tTopo 
) const
private

Definition at line 202 of file TrackerTrackHitFilter.cc.

References TrackerTopology::layer().

Referenced by apply(), geometryXMLparser.DTAlignable::index(), and geometryXMLparser.CSCAlignable::index().

202  {
203  return tTopo->layer(detid);
204 }
unsigned int layer(const DetId &id) const

Member Data Documentation

bool reco::modules::TrackerTrackHitFilter::Rule::keep_
private

Definition at line 105 of file TrackerTrackHitFilter.cc.

Referenced by apply(), and Rule().

int reco::modules::TrackerTrackHitFilter::Rule::layer_
private

Definition at line 104 of file TrackerTrackHitFilter.cc.

Referenced by apply(), and Rule().

int reco::modules::TrackerTrackHitFilter::Rule::subdet_
private

Definition at line 102 of file TrackerTrackHitFilter.cc.

Referenced by apply(), and Rule().