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
DDG4ProductionCuts Class Reference

#include <DDG4ProductionCuts.h>

Public Member Functions

 DDG4ProductionCuts (const G4LogicalVolumeToDDLogicalPartMap &, int)
 
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
 
int m_Verbosity
 
G4LogicalVolumeToDDLogicalPartMap map_
 
G4LogicalVolumeToDDLogicalPartMap::Vector vec_
 

Detailed Description

Definition at line 14 of file DDG4ProductionCuts.h.

Constructor & Destructor Documentation

DDG4ProductionCuts::DDG4ProductionCuts ( const G4LogicalVolumeToDDLogicalPartMap map,
int  verb 
)

Definition at line 10 of file DDG4ProductionCuts.cc.

References initialize(), and m_KeywordRegion.

10  : map_(map), m_Verbosity(verb) {
11  m_KeywordRegion = "CMSCutsRegion";
12  initialize();
13 }
G4LogicalVolumeToDDLogicalPartMap map_
std::string m_KeywordRegion
DDG4ProductionCuts::~DDG4ProductionCuts ( )

Definition at line 15 of file DDG4ProductionCuts.cc.

15  {
16 }

Member Function Documentation

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

Definition at line 148 of file DDG4ProductionCuts.cc.

Referenced by setProdCuts().

148  {
149 
150  G4ProductionCuts * prodCuts = reg->GetProductionCuts();
151  if( !prodCuts ) {
152  prodCuts = new G4ProductionCuts();
153  reg->SetProductionCuts(prodCuts);
154  }
155  return prodCuts;
156 }
G4Region * DDG4ProductionCuts::getRegion ( const std::string &  region)
private

Definition at line 143 of file DDG4ProductionCuts.cc.

Referenced by initialize(), and setProdCuts().

143  {
144  G4Region * reg = G4RegionStore::GetInstance()->FindOrCreateRegion (regName);
145  return reg;
146 }
void DDG4ProductionCuts::initialize ( )
private

Definition at line 53 of file DDG4ProductionCuts.cc.

References DDMapper< KeyType, ValueType >::all(), dd_is_greater(), getRegion(), LogDebug, m_KeywordRegion, m_Verbosity, map_, python.multivaluedict::sort(), DDMapper< KeyType, ValueType >::toString(), and vec_.

Referenced by DDG4ProductionCuts().

53  {
54 
56  // sort all root volumes - to get the same sequence at every run of the application.
57  // (otherwise, the sequence will depend on the pointer (memory address) of the
58  // involved objects, because 'new' does no guarantee that you allways get a
59  // higher (or lower) address when allocating an object of the same type ...
60  sort(vec_.begin(),vec_.end(),&dd_is_greater);
61  if ( m_Verbosity > 0 ) {
62  LogDebug("Physics") <<" DDG4ProductionCuts (New) : starting\n"
63  <<" DDG4ProductionCuts : Got "<<vec_.size()
64  <<" region roots.\n"
65  <<" DDG4ProductionCuts : List of all roots:";
66  for ( size_t jj=0; jj<vec_.size(); ++jj)
67  LogDebug("Physics") << " DDG4ProductionCuts : root="
68  << vec_[jj].second.name();
69  }
70 
71  // Now generate all the regions
72  for (G4LogicalVolumeToDDLogicalPartMap::Vector::iterator tit = vec_.begin();
73  tit != vec_.end(); tit++) {
74 
75  std::string regionName;
76  unsigned int num= map_.toString(m_KeywordRegion,(*tit).second,regionName);
77 
78  if (num != 1)
79  throw SimG4Exception("DDG4ProductionCuts: Problem with Region tags.");
80 
81  G4Region * region = getRegion(regionName);
82  region->AddRootLogicalVolume((*tit).first);
83 
84  if ( m_Verbosity > 0 )
85  LogDebug("Physics") << " MakeRegions: added " <<((*tit).first)->GetName()
86  << " to region " << region->GetName();
87  }
88 }
#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_
long long int num
Definition: procUtils.cc:71
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 91 of file DDG4ProductionCuts.cc.

References getProductionCuts(), getRegion(), LogDebug, m_KeywordRegion, m_Verbosity, map_, cond::rpcobtemp::temp, DDMapper< KeyType, ValueType >::toDouble(), and DDMapper< KeyType, ValueType >::toString().

Referenced by update().

92  {
93 
94  if ( m_Verbosity > 0 )
95  LogDebug("Physics") <<" DDG4ProductionCuts: inside setProdCuts";
96 
97  G4Region * region = 0;
98 
99  std::string regionName;
100  unsigned int num= map_.toString(m_KeywordRegion,lpart,regionName);
101 
102  if (num != 1)
103  throw SimG4Exception("DDG4ProductionCuts: Problem with Region tags.");
104 
105  if ( m_Verbosity > 0 ) LogDebug("Physics") << "Using region " << regionName;
106 
107  region = getRegion(regionName);
108 
109  //
110  // search for production cuts
111  // you must have three of them: e+ e- gamma
112  //
113  double gammacut;
114  double electroncut;
115  double positroncut;
116  int temp = map_.toDouble("ProdCutsForGamma",lpart,gammacut);
117  if (temp != 1){
118  throw SimG4Exception("DDG4ProductionCuts: Problem with Region tags: no/more than one ProdCutsForGamma.");
119  }
120  temp = map_.toDouble("ProdCutsForElectrons",lpart,electroncut);
121  if (temp != 1){
122  throw SimG4Exception("DDG4ProductionCuts: Problem with Region tags: no/more than one ProdCutsForElectrons.");
123  }
124  temp = map_.toDouble("ProdCutsForPositrons",lpart,positroncut);
125  if (temp != 1) {
126  throw SimG4Exception("DDG4ProductionCuts: Problem with Region tags: no/more than one ProdCutsForPositrons.");
127  }
128  //
129  // For the moment I assume all of the three are set
130  //
131  G4ProductionCuts * prodCuts = getProductionCuts(region);
132  prodCuts->SetProductionCut( gammacut, idxG4GammaCut );
133  prodCuts->SetProductionCut( electroncut, idxG4ElectronCut );
134  prodCuts->SetProductionCut( positroncut, idxG4PositronCut );
135  if ( m_Verbosity > 0 ) {
136  LogDebug("Physics") << "DDG4ProductionCuts : Setting cuts for "
137  << regionName << "\n Electrons: " << electroncut
138  << "\n Positrons: " << positroncut
139  << "\n Gamma : " << gammacut;
140  }
141 }
#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
long long int num
Definition: procUtils.cc:71
G4Region * getRegion(const std::string &region)
void DDG4ProductionCuts::SetVerbosity ( int  verb)
inline

Definition at line 20 of file DDG4ProductionCuts.h.

References m_Verbosity, and mathSSE::return().

20 { m_Verbosity = verb; return ; }
return((rh^lh)&mask)
void DDG4ProductionCuts::update ( void  )

Definition at line 42 of file DDG4ProductionCuts.cc.

References setProdCuts(), and vec_.

Referenced by python.Vispa.Gui.VispaWidget.VispaWidget::autosize(), python.Vispa.Views.LineDecayView.LineDecayContainer::createObject(), python.Vispa.Views.LineDecayView.LineDecayContainer::deselectAllObjects(), python.Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::deselectAllWidgets(), python.Vispa.Gui.VispaWidget.VispaWidget::enableAutosizing(), python.Vispa.Gui.MenuWidget.MenuWidget::leaveEvent(), python.Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseMoveEvent(), python.Vispa.Gui.MenuWidget.MenuWidget::mouseMoveEvent(), python.Vispa.Views.LineDecayView.LineDecayContainer::mouseMoveEvent(), python.Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseReleaseEvent(), python.Vispa.Views.LineDecayView.LineDecayContainer::objectMoved(), python.Vispa.Views.LineDecayView.LineDecayContainer::removeObject(), python.Vispa.Gui.ConnectableWidget.ConnectableWidget::removePorts(), python.Vispa.Gui.FindDialog.FindDialog::reset(), python.Vispa.Gui.PortConnection.PointToPointConnection::select(), python.Vispa.Gui.VispaWidget.VispaWidget::select(), python.Vispa.Views.LineDecayView.LineDecayContainer::select(), PhysicsList::SetCuts(), python.Vispa.Gui.VispaWidget.VispaWidget::setText(), python.Vispa.Gui.VispaWidget.VispaWidget::setTitle(), python.Vispa.Gui.ZoomableWidget.ZoomableWidget::setZoom(), python.Vispa.Views.LineDecayView.LineDecayContainer::setZoom(), and python.Vispa.Gui.PortConnection.PointToPointConnection::updateConnection().

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

Member Data Documentation

std::string DDG4ProductionCuts::m_KeywordRegion
private

Definition at line 30 of file DDG4ProductionCuts.h.

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

int DDG4ProductionCuts::m_Verbosity
private

Definition at line 31 of file DDG4ProductionCuts.h.

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

G4LogicalVolumeToDDLogicalPartMap DDG4ProductionCuts::map_
private

Definition at line 29 of file DDG4ProductionCuts.h.

Referenced by initialize(), and setProdCuts().

G4LogicalVolumeToDDLogicalPartMap::Vector DDG4ProductionCuts::vec_
private

Definition at line 32 of file DDG4ProductionCuts.h.

Referenced by initialize(), and update().