#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 ®ion) |
void | initialize () |
void | setProdCuts (const DDLogicalPart lpart, G4LogicalVolume *lvolume) |
Private Attributes | |
std::string | m_KeywordRegion |
int | m_Verbosity |
G4LogicalVolumeToDDLogicalPartMap | map_ |
G4LogicalVolumeToDDLogicalPartMap::Vector | vec_ |
Definition at line 14 of file DDG4ProductionCuts.h.
DDG4ProductionCuts::DDG4ProductionCuts | ( | const G4LogicalVolumeToDDLogicalPartMap & | map, |
int | verb | ||
) |
Definition at line 10 of file DDG4ProductionCuts.cc.
References initialize(), and m_KeywordRegion.
: map_(map), m_Verbosity(verb) { m_KeywordRegion = "CMSCutsRegion"; initialize(); }
DDG4ProductionCuts::~DDG4ProductionCuts | ( | ) |
Definition at line 15 of file DDG4ProductionCuts.cc.
{ }
G4ProductionCuts * DDG4ProductionCuts::getProductionCuts | ( | G4Region * | region | ) | [private] |
Definition at line 148 of file DDG4ProductionCuts.cc.
Referenced by setProdCuts().
{ G4ProductionCuts * prodCuts = reg->GetProductionCuts(); if( !prodCuts ) { prodCuts = new G4ProductionCuts(); reg->SetProductionCuts(prodCuts); } return prodCuts; }
G4Region * DDG4ProductionCuts::getRegion | ( | const std::string & | region | ) | [private] |
Definition at line 143 of file DDG4ProductionCuts.cc.
Referenced by initialize(), and setProdCuts().
{
G4Region * reg = G4RegionStore::GetInstance()->FindOrCreateRegion (regName);
return reg;
}
void DDG4ProductionCuts::initialize | ( | ) | [private] |
Definition at line 53 of file DDG4ProductionCuts.cc.
References DDMapper< KeyType, ValueType >::all(), dd_is_greater(), getRegion(), findQualityFiles::jj, LogDebug, m_KeywordRegion, m_Verbosity, map_, python::multivaluedict::sort(), DDMapper< KeyType, ValueType >::toString(), and vec_.
Referenced by DDG4ProductionCuts().
{ vec_ = map_.all(m_KeywordRegion); // sort all root volumes - to get the same sequence at every run of the application. // (otherwise, the sequence will depend on the pointer (memory address) of the // involved objects, because 'new' does no guarantee that you allways get a // higher (or lower) address when allocating an object of the same type ... sort(vec_.begin(),vec_.end(),&dd_is_greater); if ( m_Verbosity > 0 ) { LogDebug("Physics") <<" DDG4ProductionCuts (New) : starting\n" <<" DDG4ProductionCuts : Got "<<vec_.size() <<" region roots.\n" <<" DDG4ProductionCuts : List of all roots:"; for ( size_t jj=0; jj<vec_.size(); ++jj) LogDebug("Physics") << " DDG4ProductionCuts : root=" << vec_[jj].second.name(); } // Now generate all the regions for (G4LogicalVolumeToDDLogicalPartMap::Vector::iterator tit = vec_.begin(); tit != vec_.end(); tit++) { std::string regionName; unsigned int num= map_.toString(m_KeywordRegion,(*tit).second,regionName); if (num != 1) throw SimG4Exception("DDG4ProductionCuts: Problem with Region tags."); G4Region * region = getRegion(regionName); region->AddRootLogicalVolume((*tit).first); if ( m_Verbosity > 0 ) LogDebug("Physics") << " MakeRegions: added " <<((*tit).first)->GetName() << " to region " << region->GetName(); } }
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_, groupFilesInBlocks::temp, DDMapper< KeyType, ValueType >::toDouble(), and DDMapper< KeyType, ValueType >::toString().
Referenced by update().
{ if ( m_Verbosity > 0 ) LogDebug("Physics") <<" DDG4ProductionCuts: inside setProdCuts"; G4Region * region = 0; std::string regionName; unsigned int num= map_.toString(m_KeywordRegion,lpart,regionName); if (num != 1) throw SimG4Exception("DDG4ProductionCuts: Problem with Region tags."); if ( m_Verbosity > 0 ) LogDebug("Physics") << "Using region " << regionName; region = getRegion(regionName); // // search for production cuts // you must have three of them: e+ e- gamma // double gammacut; double electroncut; double positroncut; int temp = map_.toDouble("ProdCutsForGamma",lpart,gammacut); if (temp != 1){ throw SimG4Exception("DDG4ProductionCuts: Problem with Region tags: no/more than one ProdCutsForGamma."); } temp = map_.toDouble("ProdCutsForElectrons",lpart,electroncut); if (temp != 1){ throw SimG4Exception("DDG4ProductionCuts: Problem with Region tags: no/more than one ProdCutsForElectrons."); } temp = map_.toDouble("ProdCutsForPositrons",lpart,positroncut); if (temp != 1) { throw SimG4Exception("DDG4ProductionCuts: Problem with Region tags: no/more than one ProdCutsForPositrons."); } // // For the moment I assume all of the three are set // G4ProductionCuts * prodCuts = getProductionCuts(region); prodCuts->SetProductionCut( gammacut, idxG4GammaCut ); prodCuts->SetProductionCut( electroncut, idxG4ElectronCut ); prodCuts->SetProductionCut( positroncut, idxG4PositronCut ); if ( m_Verbosity > 0 ) { LogDebug("Physics") << "DDG4ProductionCuts : Setting cuts for " << regionName << "\n Electrons: " << electroncut << "\n Positrons: " << positroncut << "\n Gamma : " << gammacut; } }
void DDG4ProductionCuts::SetVerbosity | ( | int | verb | ) | [inline] |
Definition at line 20 of file DDG4ProductionCuts.h.
References m_Verbosity.
{ m_Verbosity = verb; return ; }
void DDG4ProductionCuts::update | ( | void | ) |
Definition at line 42 of file DDG4ProductionCuts.cc.
References setProdCuts(), and vec_.
Referenced by PhysicsList::SetCuts().
{ // // Loop over all DDLP and provide the cuts for each region // for (G4LogicalVolumeToDDLogicalPartMap::Vector::iterator tit = vec_.begin(); tit != vec_.end(); tit++){ setProdCuts((*tit).second,(*tit).first); } }
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().
Definition at line 29 of file DDG4ProductionCuts.h.
Referenced by initialize(), and setProdCuts().
Definition at line 32 of file DDG4ProductionCuts.h.
Referenced by initialize(), and update().