CMS 3D CMS Logo

Classes | Functions
helper Namespace Reference

Classes

struct  BFieldIsolationAlgorithmSetup
 
class  CandDecayStoreManager
 
class  ClusterStorer
 
struct  CollectionFilter
 
struct  CollectionFilter< C, S, MinNumberSelector >
 
struct  CollectionFilterTrait
 
struct  CollectionFilterTrait< C, AnySelector, N >
 
struct  CollectionSizeFilter
 
struct  CollectionStoreManager
 
struct  GsfElectronCollectionStoreManager
 
class  GsfElectronSelectorBase
 
struct  IsolationAlgorithmSetup
 
struct  IsolationAlgorithmSetup< CalIsolationAlgo< T1, C2 > >
 
struct  IteratorToObjectConverter
 
struct  IteratorToObjectConverter< edm::OwnVector< T > >
 
struct  IteratorToObjectConverter< edm::PtrVector< T > >
 
struct  IteratorToObjectConverter< edm::RefToBaseVector< T > >
 
struct  IteratorToObjectConverter< edm::RefVector< C > >
 
struct  MasterCollection
 
struct  MasterCollection< edm::View< T > >
 
struct  MuonCollectionStoreManager
 
class  MuonSelectorBase
 
struct  NullIsolationAlgorithmSetup
 
struct  NullPostProcessor
 
struct  ObjectSelectorBase
 
class  Parser
 
struct  PhotonCollectionStoreManager
 
class  PhotonSelectorBase
 
class  ScannerBase
 
struct  SelectCode
 
struct  SelectedOutputCollectionTrait
 
struct  SelectedOutputCollectionTrait< edm::AssociationVector< edm::RefProd< K >, C > >
 
struct  SelectedOutputCollectionTrait< edm::AssociationVector< edm::RefToBaseProd< T >, C > >
 
struct  SelectedOutputCollectionTrait< edm::RefToBaseVector< T > >
 
struct  SelectedOutputCollectionTrait< edm::RefVector< C > >
 
struct  SelectedOutputCollectionTrait< edm::View< T > >
 
struct  SelectionAdderTrait
 
struct  SelectionAdderTrait< edm::AssociationVector< edm::RefProd< K >, C >, edm::RefVector< K > >
 
struct  SelectionAdderTrait< edm::AssociationVector< edm::RefProd< K >, C >, std::vector< const T * > >
 
struct  SelectionAdderTrait< edm::AssociationVector< edm::RefToBaseProd< T >, C >, edm::RefToBaseVector< T > >
 
struct  SelectionAdderTrait< edm::AssociationVector< edm::RefToBaseProd< T >, C >, std::vector< const T * > >
 
struct  SelectionAdderTrait< edm::RefToBaseVector< T >, edm::RefToBaseVector< T > >
 
struct  SelectionAdderTrait< edm::RefToBaseVector< T >, std::vector< const T * > >
 
struct  SelectionAdderTrait< edm::RefVector< C >, edm::RefVector< C > >
 
struct  SelectionAdderTrait< edm::RefVector< C >, std::vector< const T * > >
 
struct  SelectionAdderTrait< edm::View< T >, edm::PtrVector< T > >
 
struct  SelectionAdderTrait< edm::View< T >, edm::RefToBaseVector< T > >
 
struct  SelectionAdderTrait< InputCollection, edm::RefVector< C > >
 
struct  SelectionAdderTrait< InputCollection, std::vector< const T * > >
 
struct  SelectionCopyAdder
 
struct  SelectionFirstPointerAdder
 
struct  SelectionFirstRefAdder
 
struct  SelectionPointerAdder
 
struct  SelectionPointerDerefAdder
 
struct  SelectionPtrViewAdder
 
struct  SelectionRefAdder
 
struct  SelectionRefViewAdder
 
class  SimpleJetTrackAssociator
 
struct  StoreContainerTrait
 
struct  StoreContainerTrait< edm::AssociationVector< R, C > >
 
struct  StoreContainerTrait< edm::PtrVector< T > >
 
struct  StoreContainerTrait< edm::RefToBaseVector< T > >
 
struct  StoreContainerTrait< edm::RefVector< C > >
 
struct  StoreManagerTrait
 
struct  StoreManagerTrait< reco::CandidateCollection, EdmFilter >
 
struct  StoreManagerTrait< reco::GsfElectronCollection >
 
struct  StoreManagerTrait< reco::MuonCollection >
 
struct  StoreManagerTrait< reco::PhotonCollection >
 
struct  StoreManagerTrait< reco::TrackCollection, edm::stream::EDFilter<> >
 
struct  TrackCollectionStoreManager
 Class to manage copying of RecHits and Clusters from Tracks. More...
 
class  TrackSelectorBase
 

Functions

def add_filter (process, ed_filter)
 
def checked_out_MPS ()
 
template<typename RecHitType >
void ClusterStorer::ClusterHitRecord< SiStripRecHit2D::ClusterRef >rekey (const SiStripRecHit2D::ClusterRef &newRef) const
 
def ConfigSectionMap (section)
 
def findEDAnalyzers (holder)
 
def findEDFilters (holder)
 
def findEDProducers (holder)
 
def findModules (holder)
 
def set_pede_option (process, option, drop=False)
 

Detailed Description

Helper functions to extract the dictionary with
 - all EDFilters
 - all EDProducers
 - all EDAnalyzers
 - all modules
either from a dictionary (either a cms.Process.__dict__ or from the locals() inside a _cff.py fragment)

Function Documentation

def helper.add_filter (   process,
  ed_filter 
)
Adds EDFilter to the supplied cms.Process object and returns complete filter
sequence.

Arguments:
- `process`: cms.Process object
- `ed_filter`: EDFilter

Definition at line 47 of file helper.py.

Referenced by MilleSetup.setup().

47 def add_filter(process, ed_filter):
48  """
49  Adds EDFilter to the supplied cms.Process object and returns complete filter
50  sequence.
51 
52  Arguments:
53  - `process`: cms.Process object
54  - `ed_filter`: EDFilter
55  """
56 
57  if not hasattr(process, "mps_filters"): process.mps_filters = cms.Sequence()
58  process.mps_filters += ed_filter
59  return process.mps_filters
60 
def add_filter(process, ed_filter)
Definition: helper.py:47
def helper.checked_out_MPS ( )
Checks if MPS is checked out locally or taken from the release.

Definition at line 4 of file helper.py.

Referenced by mps_alisetup.SetupAlignment._construct_paths(), and mps_setup_new_align.main().

5  """Checks if MPS is checked out locally or taken from the release."""
6 
7  checked_out_packages = os.path.join(os.environ["CMSSW_BASE"], "src", ".git",
8  "info", "sparse-checkout")
9  checked_out = False
10  git_initialized = False
11  try:
12  with open(checked_out_packages, "r") as f:
13  packages = ("/Alignment/", "/Alignment/MillePedeAlignmentAlgorithm/")
14  for line in f:
15  if line.strip() in packages:
16  checked_out = True
17  break
18  git_initialized = True # since the sparse checkout file is there
19  except IOError as e:
20  if e.args != (2, 'No such file or directory'): raise
21 
22  return checked_out, git_initialized
23 
24 
def checked_out_MPS()
Definition: helper.py:4
template<typename RecHitType >
void helper::ClusterStorer::ClusterHitRecord< SiStripRecHit2D::ClusterRef >rekey ( const SiStripRecHit2D::ClusterRef newRef) const

Definition at line 168 of file ClusterStorer.cc.

References OmniClusterRef::key(), SiStripMatchedRecHit2D::monoClusterRef(), TrackerSingleRecHit::omniCluster(), SiStripDetId::stereo(), and SiStripMatchedRecHit2D::stereoClusterRef().

169  {
170  TrackingRecHit &genericHit = (*hits_)[index_];
171  const std::type_info &hit_type = typeid(genericHit);
172 
173  OmniClusterRef * cluRef=nullptr;
174  if (typeid(SiStripRecHit1D) == hit_type) {
175  cluRef = &static_cast<SiStripRecHit1D&>(genericHit).omniCluster();
176  } else if (typeid(SiStripRecHit2D) == hit_type) {
177  cluRef = &static_cast<SiStripRecHit2D&>(genericHit).omniCluster();
178  } else if (typeid(SiStripMatchedRecHit2D) == hit_type) {
179  SiStripMatchedRecHit2D &mhit = static_cast<SiStripMatchedRecHit2D&>(genericHit);
180  cluRef = (SiStripDetId(detid_).stereo() ? &mhit.stereoClusterRef() : &mhit.monoClusterRef());
181  } else if (typeid(ProjectedSiStripRecHit2D) == hit_type) {
182  cluRef = &static_cast<ProjectedSiStripRecHit2D&>(genericHit).originalHit().omniCluster();
183  }
184 
185  assert(cluRef != nullptr); // to catch missing RecHit types
186  assert(cluRef->key() == ref_.key()); // otherwise something went wrong
187  (*cluRef) = OmniClusterRef(newRef);
188  }
uint32_t stereo() const
Definition: SiStripDetId.h:160
OmniClusterRef const & stereoClusterRef() const
OmniClusterRef const & omniCluster() const
OmniClusterRef const & monoClusterRef() const
Detector identifier class for the strip tracker.
Definition: SiStripDetId.h:17
unsigned int key() const
def helper.ConfigSectionMap (   section)

Definition at line 11 of file helper.py.

References reco.print().

11 def ConfigSectionMap(section):
12  dict1 = {}
13  options = Config.options(section)
14  for option in options:
15  try:
16  dict1[option] = Config.get(section, option)
17  if dict1[option] == -1:
18  DebugPrint("skip: %s" % option)
19  except:
20  print("exception on %s!" % option)
21  dict1[option] = None
22  return dict1
23 
def ConfigSectionMap(section)
Definition: helper.py:11
std::string print(const Track &, edm::Verbosity=edm::Concise)
Track print utility.
Definition: print.cc:10
def helper.findEDAnalyzers (   holder)

Definition at line 26 of file helper.py.

References cmsPerfStripChart.dict.

26 def findEDAnalyzers(holder):
27  if isinstance(holder, cms.Process):
28  return process.analyzers_()
29  else:
30  return dict( (name, module) for name, module in holder.iteritems() if isinstance(module, cms.EDAnalyzer) )
31 
32 
def findEDAnalyzers(holder)
Definition: helper.py:26
def helper.findEDFilters (   holder)

Definition at line 12 of file helper.py.

References cmsPerfStripChart.dict.

12 def findEDFilters(holder):
13  if isinstance(holder, cms.Process):
14  return process.filters_()
15  else:
16  return dict( (name, module) for name, module in holder.iteritems() if isinstance(module, cms.EDFilter) )
17 
18 
def findEDFilters(holder)
Definition: helper.py:12
def helper.findEDProducers (   holder)

Definition at line 19 of file helper.py.

References cmsPerfStripChart.dict.

19 def findEDProducers(holder):
20  if isinstance(holder, cms.Process):
21  return process.producers_()
22  else:
23  return dict( (name, module) for name, module in holder.iteritems() if isinstance(module, cms.EDProducer) )
24 
25 
def findEDProducers(holder)
Definition: helper.py:19
def helper.findModules (   holder)

Definition at line 33 of file helper.py.

References cmsPerfStripChart.dict.

33 def findModules(holder):
34  if isinstance(holder, cms.Process):
35  modules = dict()
36  modules.upate(process.analyzers_())
37  modules.upate(process.producers_())
38  modules.upate(process.filters_())
39  return modules
40  else:
41  return dict( (name, module) for name, module in holder.iteritems() if isinstance(module, (cms.EDAnalyzer, _cms.EDProducer, _cms.EDFilter)) )
42 
43 
44 
def findModules(holder)
Definition: helper.py:33
def helper.set_pede_option (   process,
  option,
  drop = False 
)
Utility function to set or override pede `option` defined in `process`.

Arguments:
- `process`: cms.Process object
- `option`: option string
- `drop`: if set to 'True' the `option` is dropped completely

Definition at line 25 of file helper.py.

References split.

25 def set_pede_option(process, option, drop = False):
26  """Utility function to set or override pede `option` defined in `process`.
27 
28  Arguments:
29  - `process`: cms.Process object
30  - `option`: option string
31  - `drop`: if set to 'True' the `option` is dropped completely
32  """
33 
34  existing_options = process.AlignmentProducer.algoConfig.pedeSteerer.options
35 
36  exists = False
37  for i in xrange(len(existing_options)):
38  if existing_options[i].split()[0] == option.split()[0]:
39  existing_options[i] = option.strip()
40  exists = True
41  if drop: existing_options.pop(i)
42  break
43 
44  if not exists and not drop: existing_options.append(option.strip())
45 
46 
def set_pede_option(process, option, drop=False)
Definition: helper.py:25
double split
Definition: MVATrainer.cc:139