CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
DDG4ProductionCuts Class Reference

#include <DDG4ProductionCuts.h>

Public Member Functions

 DDG4ProductionCuts (const G4LogicalVolumeToDDLogicalPartMap &, int, const edm::ParameterSet &p)
 
void SetVerbosity (int verb)
 
void update ()
 
 ~DDG4ProductionCuts ()
 

Private Member Functions

G4ProductionCuts * getProductionCuts (G4Region *region)
 
G4Region * getRegion (const std::string &region)
 
void initialize ()
 
void setProdCuts (const DDLogicalPart lpart, G4LogicalVolume *lvolume)
 

Private Attributes

std::string m_KeywordRegion
 
bool m_protonCut
 
int m_Verbosity
 
G4LogicalVolumeToDDLogicalPartMap map_
 
G4LogicalVolumeToDDLogicalPartMap::Vector vec_
 

Detailed Description

Definition at line 15 of file DDG4ProductionCuts.h.

Constructor & Destructor Documentation

DDG4ProductionCuts::DDG4ProductionCuts ( const G4LogicalVolumeToDDLogicalPartMap map,
int  verb,
const edm::ParameterSet p 
)

Definition at line 11 of file DDG4ProductionCuts.cc.

References edm::ParameterSet::getUntrackedParameter(), initialize(), m_KeywordRegion, and m_protonCut.

12  : map_(map), m_Verbosity(verb) {
13  m_KeywordRegion = "CMSCutsRegion";
14  m_protonCut = p.getUntrackedParameter<bool>("CutsOnProton",true);
15  initialize();
16 }
G4LogicalVolumeToDDLogicalPartMap map_
T getUntrackedParameter(std::string const &, T const &) const
std::string m_KeywordRegion
DDG4ProductionCuts::~DDG4ProductionCuts ( )

Definition at line 18 of file DDG4ProductionCuts.cc.

18  {
19 }

Member Function Documentation

G4ProductionCuts * DDG4ProductionCuts::getProductionCuts ( G4Region *  region)
private

Definition at line 155 of file DDG4ProductionCuts.cc.

Referenced by setProdCuts(), and SetVerbosity().

155  {
156 
157  G4ProductionCuts * prodCuts = reg->GetProductionCuts();
158  if( !prodCuts ) {
159  prodCuts = new G4ProductionCuts();
160  reg->SetProductionCuts(prodCuts);
161  }
162  return prodCuts;
163 }
G4Region * DDG4ProductionCuts::getRegion ( const std::string &  region)
private

Definition at line 150 of file DDG4ProductionCuts.cc.

Referenced by initialize(), setProdCuts(), and SetVerbosity().

150  {
151  G4Region * reg = G4RegionStore::GetInstance()->FindOrCreateRegion (regName);
152  return reg;
153 }
void DDG4ProductionCuts::initialize ( void  )
private

Definition at line 56 of file DDG4ProductionCuts.cc.

References DDMapper< KeyType, ValueType >::all(), dd_is_greater(), Exception, getRegion(), findQualityFiles::jj, LogDebug, m_KeywordRegion, m_Verbosity, map_, pileupDistInMC::num, AlCaHLTBitMon_QueryRunRegistry::string, DDMapper< KeyType, ValueType >::toString(), and vec_.

Referenced by DDG4ProductionCuts(), and SetVerbosity().

56  {
57 
59  // sort all root volumes - to get the same sequence at every run of the application.
60  // (otherwise, the sequence will depend on the pointer (memory address) of the
61  // involved objects, because 'new' does no guarantee that you allways get a
62  // higher (or lower) address when allocating an object of the same type ...
63  sort(vec_.begin(),vec_.end(),&dd_is_greater);
64  if ( m_Verbosity > 0 ) {
65  LogDebug("Physics") <<" DDG4ProductionCuts (New) : starting\n"
66  <<" DDG4ProductionCuts : Got "<<vec_.size()
67  <<" region roots.\n"
68  <<" DDG4ProductionCuts : List of all roots:";
69  for ( size_t jj=0; jj<vec_.size(); ++jj)
70  LogDebug("Physics") << " DDG4ProductionCuts : root="
71  << vec_[jj].second.name();
72  }
73 
74  // Now generate all the regions
75  for (G4LogicalVolumeToDDLogicalPartMap::Vector::iterator tit = vec_.begin();
76  tit != vec_.end(); tit++) {
77 
78  std::string regionName;
79  unsigned int num= map_.toString(m_KeywordRegion,(*tit).second,regionName);
80 
81  if (num != 1) {
82  throw cms::Exception("SimG4CorePhysics", " DDG4ProductionCuts::initialize: Problem with Region tags.");
83  }
84  G4Region * region = getRegion(regionName);
85  region->AddRootLogicalVolume((*tit).first);
86 
87  if ( m_Verbosity > 0 )
88  LogDebug("Physics") << " MakeRegions: added " <<((*tit).first)->GetName()
89  << " to region " << region->GetName();
90  }
91 }
#define LogDebug(id)
G4LogicalVolumeToDDLogicalPartMap map_
bool dd_is_greater(const std::pair< G4LogicalVolume *, DDLogicalPart > &p1, const std::pair< G4LogicalVolume *, DDLogicalPart > &p2)
std::string m_KeywordRegion
unsigned int toString(const std::string &name, const KeyType &key, std::string &value, unsigned int pos=0) const
same as toDouble but for std::string-valued values of named parameters
Definition: DDMapper.h:182
G4LogicalVolumeToDDLogicalPartMap::Vector vec_
G4Region * getRegion(const std::string &region)
Vector all(const std::string &name, const std::string &value) const
get all std::mapped instances which have a specific &#39;name&#39; with value &#39;value&#39;
Definition: DDMapper.h:208
void DDG4ProductionCuts::setProdCuts ( const DDLogicalPart  lpart,
G4LogicalVolume *  lvolume 
)
private

Definition at line 94 of file DDG4ProductionCuts.cc.

References Exception, getProductionCuts(), getRegion(), LogDebug, m_KeywordRegion, m_protonCut, m_Verbosity, map_, pileupDistInMC::num, AlCaHLTBitMon_QueryRunRegistry::string, groupFilesInBlocks::temp, DDMapper< KeyType, ValueType >::toDouble(), and DDMapper< KeyType, ValueType >::toString().

Referenced by SetVerbosity(), and update().

95  {
96 
97  if ( m_Verbosity > 0 )
98  LogDebug("Physics") <<" DDG4ProductionCuts: inside setProdCuts";
99 
100  G4Region * region = nullptr;
101 
102  std::string regionName;
103  unsigned int num= map_.toString(m_KeywordRegion,lpart,regionName);
104 
105  if (num != 1) {
106  throw cms::Exception("SimG4CorePhysics", " DDG4ProductionCuts::setProdCuts: Problem with Region tags.");
107  }
108  if ( m_Verbosity > 0 ) LogDebug("Physics") << "Using region " << regionName;
109 
110  region = getRegion(regionName);
111 
112  //
113  // search for production cuts
114  // you must have four of them: e+ e- gamma proton
115  //
116  double gammacut;
117  double electroncut;
118  double positroncut;
119  double protoncut = 0.0;
120  int temp = map_.toDouble("ProdCutsForGamma",lpart,gammacut);
121  if (temp != 1){
122  throw cms::Exception("SimG4CorePhysics", " DDG4ProductionCuts::setProdCuts: Problem with Region tags - no/more than one ProdCutsForGamma.");
123  }
124  temp = map_.toDouble("ProdCutsForElectrons",lpart,electroncut);
125  if (temp != 1){
126  throw cms::Exception("SimG4CorePhysics", " DDG4ProductionCuts::setProdCuts: Problem with Region tags - no/more than one ProdCutsForElectrons.");
127  }
128  temp = map_.toDouble("ProdCutsForPositrons",lpart,positroncut);
129  if (temp != 1) {
130  throw cms::Exception("SimG4CorePhysics", " DDG4ProductionCuts::setProdCuts: Problem with Region tags - no/more than one ProdCutsForPositrons.");
131  }
132  //
133  // For the moment I assume all of the three are set
134  //
135  G4ProductionCuts * prodCuts = getProductionCuts(region);
136  prodCuts->SetProductionCut( gammacut, idxG4GammaCut );
137  prodCuts->SetProductionCut( electroncut, idxG4ElectronCut );
138  prodCuts->SetProductionCut( positroncut, idxG4PositronCut );
139  // For recoil use the same cut as for e-
140  if(m_protonCut) { protoncut = electroncut; }
141  prodCuts->SetProductionCut( protoncut, idxG4ProtonCut );
142  if ( m_Verbosity > 0 ) {
143  LogDebug("Physics") << "DDG4ProductionCuts : Setting cuts for "
144  << regionName << "\n Electrons: " << electroncut
145  << "\n Positrons: " << positroncut
146  << "\n Gamma : " << gammacut;
147  }
148 }
#define LogDebug(id)
G4LogicalVolumeToDDLogicalPartMap map_
unsigned int toDouble(const std::string &name, const KeyType &key, double &value, unsigned int pos=0) const
returns the number specific parameters named &#39;name&#39; and the corrsponding double
Definition: DDMapper.h:119
std::string m_KeywordRegion
G4ProductionCuts * getProductionCuts(G4Region *region)
unsigned int toString(const std::string &name, const KeyType &key, std::string &value, unsigned int pos=0) const
same as toDouble but for std::string-valued values of named parameters
Definition: DDMapper.h:182
G4Region * getRegion(const std::string &region)
void DDG4ProductionCuts::SetVerbosity ( int  verb)
inline
void DDG4ProductionCuts::update ( )

Definition at line 45 of file DDG4ProductionCuts.cc.

References setProdCuts(), and vec_.

Referenced by progressbar.ProgressBar::__next__(), MatrixUtil.Matrix::__setitem__(), MatrixUtil.Steps::__setitem__(), Vispa.Gui.VispaWidget.VispaWidget::autosize(), Vispa.Views.LineDecayView.LineDecayContainer::createObject(), Vispa.Views.LineDecayView.LineDecayContainer::deselectAllObjects(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::deselectAllWidgets(), Vispa.Gui.VispaWidget.VispaWidget::enableAutosizing(), progressbar.ProgressBar::finish(), Vispa.Gui.MenuWidget.MenuWidget::leaveEvent(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseMoveEvent(), Vispa.Gui.MenuWidget.MenuWidget::mouseMoveEvent(), Vispa.Views.LineDecayView.LineDecayContainer::mouseMoveEvent(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseReleaseEvent(), Vispa.Views.LineDecayView.LineDecayContainer::objectMoved(), MatrixUtil.Steps::overwrite(), Vispa.Views.LineDecayView.LineDecayContainer::removeObject(), Vispa.Gui.ConnectableWidget.ConnectableWidget::removePorts(), Vispa.Gui.FindDialog.FindDialog::reset(), Vispa.Gui.PortConnection.PointToPointConnection::select(), Vispa.Gui.VispaWidget.VispaWidget::select(), Vispa.Views.LineDecayView.LineDecayContainer::select(), Vispa.Gui.VispaWidget.VispaWidget::setText(), Vispa.Gui.VispaWidget.VispaWidget::setTitle(), Vispa.Gui.ZoomableWidget.ZoomableWidget::setZoom(), Vispa.Views.LineDecayView.LineDecayContainer::setZoom(), and Vispa.Gui.PortConnection.PointToPointConnection::updateConnection().

45  {
46  //
47  // Loop over all DDLP and provide the cuts for each region
48  //
49  for (G4LogicalVolumeToDDLogicalPartMap::Vector::iterator tit = vec_.begin();
50  tit != vec_.end(); tit++){
51  setProdCuts((*tit).second,(*tit).first);
52  }
53 }
void setProdCuts(const DDLogicalPart lpart, G4LogicalVolume *lvolume)
G4LogicalVolumeToDDLogicalPartMap::Vector vec_

Member Data Documentation

std::string DDG4ProductionCuts::m_KeywordRegion
private

Definition at line 32 of file DDG4ProductionCuts.h.

Referenced by DDG4ProductionCuts(), initialize(), and setProdCuts().

bool DDG4ProductionCuts::m_protonCut
private

Definition at line 34 of file DDG4ProductionCuts.h.

Referenced by DDG4ProductionCuts(), and setProdCuts().

int DDG4ProductionCuts::m_Verbosity
private

Definition at line 33 of file DDG4ProductionCuts.h.

Referenced by initialize(), setProdCuts(), and SetVerbosity().

G4LogicalVolumeToDDLogicalPartMap DDG4ProductionCuts::map_
private

Definition at line 31 of file DDG4ProductionCuts.h.

Referenced by initialize(), and setProdCuts().

G4LogicalVolumeToDDLogicalPartMap::Vector DDG4ProductionCuts::vec_
private

Definition at line 35 of file DDG4ProductionCuts.h.

Referenced by initialize(), and update().