CMS 3D CMS Logo

Classes | Functions | Variables
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
 
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::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)
 

Variables

 Config
 

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

◆ add_filter()

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 48 of file helper.py.

48 def add_filter(process, ed_filter):
49  """
50  Adds EDFilter to the supplied cms.Process object and returns complete filter
51  sequence.
52 
53  Arguments:
54  - `process`: cms.Process object
55  - `ed_filter`: EDFilter
56  """
57 
58  if not hasattr(process, "mps_filters"): process.mps_filters = cms.Sequence()
59  process.mps_filters += ed_filter
60  return process.mps_filters

Referenced by MilleSetup.setup().

◆ checked_out_MPS()

def helper.checked_out_MPS ( )
Checks if MPS is checked out locally or taken from the release.

Definition at line 5 of file helper.py.

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

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

◆ ClusterStorer::ClusterHitRecord< SiStripRecHit2D::ClusterRef >rekey()

template<typename RecHitType >
void helper::ClusterStorer::ClusterHitRecord< SiStripRecHit2D::ClusterRef >rekey ( const SiStripRecHit2D::ClusterRef newRef) const

Definition at line 152 of file ClusterStorer.cc.

152  {
153  TrackingRecHit &genericHit = (*hits_)[index_];
154  const std::type_info &hit_type = typeid(genericHit);
155 
156  OmniClusterRef *cluRef = nullptr;
157  if (typeid(SiStripRecHit1D) == hit_type) {
158  cluRef = &static_cast<SiStripRecHit1D &>(genericHit).omniCluster();
159  } else if (typeid(SiStripRecHit2D) == hit_type) {
160  cluRef = &static_cast<SiStripRecHit2D &>(genericHit).omniCluster();
161  } else if (typeid(SiStripMatchedRecHit2D) == hit_type) {
162  SiStripMatchedRecHit2D &mhit = static_cast<SiStripMatchedRecHit2D &>(genericHit);
163  cluRef = (SiStripDetId(detid_).stereo() ? &mhit.stereoClusterRef() : &mhit.monoClusterRef());
164  } else if (typeid(ProjectedSiStripRecHit2D) == hit_type) {
165  cluRef = &static_cast<ProjectedSiStripRecHit2D &>(genericHit).originalHit().omniCluster();
166  }
167 
168  assert(cluRef != nullptr); // to catch missing RecHit types
169  assert(cluRef->key() == ref_.key()); // otherwise something went wrong
170  (*cluRef) = OmniClusterRef(newRef);
171  }

References cms::cuda::assert(), OmniClusterRef::key(), SiStripMatchedRecHit2D::monoClusterRef(), SiStripDetId::stereo(), and SiStripMatchedRecHit2D::stereoClusterRef().

◆ ConfigSectionMap()

def helper.ConfigSectionMap (   section)

Definition at line 12 of file helper.py.

12 def ConfigSectionMap(section):
13  dict1 = {}
14  options = Config.options(section)
15  for option in options:
16  try:
17  dict1[option] = Config.get(section, option)
18  if dict1[option] == -1:
19  DebugPrint("skip: %s" % option)
20  except:
21  print("exception on %s!" % option)
22  dict1[option] = None
23  return dict1

References Config.options, and edm.print().

◆ findEDAnalyzers()

def helper.findEDAnalyzers (   holder)

Definition at line 27 of file helper.py.

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

◆ findEDFilters()

def helper.findEDFilters (   holder)

Definition at line 13 of file helper.py.

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

◆ findEDProducers()

def helper.findEDProducers (   holder)

Definition at line 20 of file helper.py.

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

◆ findModules()

def helper.findModules (   holder)

Definition at line 34 of file helper.py.

34 def findModules(holder):
35  if isinstance(holder, cms.Process):
36  modules = dict()
37  modules.upate(process.analyzers_())
38  modules.upate(process.producers_())
39  modules.upate(process.filters_())
40  return modules
41  else:
42  return dict( (name, module) for name, module in six.iteritems(holder) if isinstance(module, (cms.EDAnalyzer, _cms.EDProducer, _cms.EDFilter)) )
43 
44 

◆ set_pede_option()

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 26 of file helper.py.

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

References FastTimerService_cff.range, and cms::dd.split().

Variable Documentation

◆ Config

helper.Config
FastTimerService_cff.range
range
Definition: FastTimerService_cff.py:34
helper.findEDAnalyzers
def findEDAnalyzers(holder)
Definition: helper.py:27
cms::cuda::assert
assert(be >=bs)
SiStripRecHit2D
Definition: SiStripRecHit2D.h:7
cms::dd::split
std::vector< std::string_view > split(std::string_view, const char *)
OmniClusterRef
Definition: OmniClusterRef.h:12
ProjectedSiStripRecHit2D
Definition: ProjectedSiStripRecHit2D.h:8
helper.findEDProducers
def findEDProducers(holder)
Definition: helper.py:20
helper.set_pede_option
def set_pede_option(process, option, drop=False)
Definition: helper.py:26
SiStripMatchedRecHit2D::stereoClusterRef
OmniClusterRef const & stereoClusterRef() const
Definition: SiStripMatchedRecHit2D.h:34
SiStripRecHit1D
Definition: SiStripRecHit1D.h:8
SiStripMatchedRecHit2D::monoClusterRef
OmniClusterRef const & monoClusterRef() const
Definition: SiStripMatchedRecHit2D.h:35
helper.checked_out_MPS
def checked_out_MPS()
Definition: helper.py:5
edm::print
S & print(S &os, JobReport::InputFile const &f)
Definition: JobReport.cc:66
helper.ConfigSectionMap
def ConfigSectionMap(section)
Definition: helper.py:12
TrackingRecHit
Definition: TrackingRecHit.h:21
helper.findModules
def findModules(holder)
Definition: helper.py:34
SiStripMatchedRecHit2D
Definition: SiStripMatchedRecHit2D.h:8
helper.findEDFilters
def findEDFilters(holder)
Definition: helper.py:13
SiStripDetId
Detector identifier class for the strip tracker.
Definition: SiStripDetId.h:18
helper.add_filter
def add_filter(process, ed_filter)
Definition: helper.py:48
OmniClusterRef::key
unsigned int key() const
Definition: OmniClusterRef.h:70
Config.options
options
Definition: Config.py:9
SiStripDetId::stereo
uint32_t stereo() const
Definition: SiStripDetId.h:168