CMS 3D CMS Logo

twikiExport::Material Class Reference

List of all members.

Public Member Functions

def __init__
def __str__
def addConstituent
def getMass
def getRealValues
def getSimValues

Public Attributes

 theComment
 theConstituents
 theDescription
 theMcVolume
 theName


Detailed Description

Definition at line 23 of file twikiExport.py.


Member Function Documentation

def twikiExport::Material::__init__ (   self,
  matString,
  comment 
)

Definition at line 24 of file twikiExport.py.

00024                                           :
00025         if matString == "" or not matString[0] == "#":
00026             raise StandardError , "not a valid material Definition: "+matString
00027         line = matString[1:]
00028 
00029         if    len( line.split('"') ) < 5 or len( line.split('"')[4].split() ) < 2:
00030             raise StandardError , "not a well formed Material Definition: "+matString            
00031         self.theDescription = line.split('"')[1]
00032         self.theName = line.split('"')[3]
00033         self.theMcVolume = float(line.split('"')[4].split()[0])
00034         self.theComment = comment
00035         self.theConstituents = []
00036     
    def getRealValues(self):

def twikiExport::Material::__str__ (   self  ) 

Definition at line 83 of file twikiExport.py.

00083                      :
00084         result = "[ "+self.theName+" Description: "+self.theDescription+" MC-Volume:"+str(self.theMcVolume)+"\n"
00085         result += "Comments:\n"+self.theComment
00086         return result
00087 
00088 #parses the .in File
def parseInFile(inFile, predefinedMaterials, config):

def twikiExport::Material::addConstituent (   self,
  constString,
  predefinedMaterials 
)

Definition at line 73 of file twikiExport.py.

00073                                                               :
00074         if constString  == "" or not constString[0] == "*":
00075             raise StandardError , "not a valid Constituent: "+constString
00076         line = constString[1:]
00077         self.theConstituents.append( Constituent(line, predefinedMaterials) )
00078 
00079         number = int( line.split('"')[0].split()[0] )
00080         if not len(self.theConstituents) == number:
00081             raise StandardError, "Constituent Number mismatch for "+str(len(self.theConstituents))+" in: "+line
00082     
    def __str__(self):

def twikiExport::Material::getMass (   self  ) 

Definition at line 67 of file twikiExport.py.

00067                      :
00068         result = 0
00069         for con in self.theConstituents:
00070             result += con.theMass * con.theCount
00071         return result
00072         
    def addConstituent(self, constString, predefinedMaterials):

def twikiExport::Material::getRealValues (   self  ) 

Definition at line 37 of file twikiExport.py.

00037                            :
00038         result = {}
00039         result["Volume"] = 0
00040         result["X0"] = 0
00041         result["L0"] = 0
00042         
00043         totMass =  self.getMass()
00044         invX0 = 0
00045         invL0 = 0
00046         for con in self.theConstituents:
00047             pWeight = con.theVolume * con.theDensity / totMass
00048             invX0 += pWeight / con.theX0
00049             invL0 += pWeight / con.theL0
00050             result["Volume"] += con.theVolume 
00051         result["Density"] = self.getMass() / result["Volume"]            
00052         result["X0"] = 1 / ( invX0 * result["Density"] )
00053         result["L0"] = 1 / ( invL0 * result["Density"] )
00054         
00055         return result
00056     
    def getSimValues(self):

def twikiExport::Material::getSimValues (   self  ) 

Definition at line 57 of file twikiExport.py.

00057                           :
00058         result = self.getRealValues()
00059         fraction = self.theMcVolume / result["Volume"]
00060         result["Volume"] = self.theMcVolume
00061         result["Density"] = self.getMass() / self.theMcVolume
00062         result["X0"] *= fraction
00063         result["L0"] *= fraction
00064     
00065         return result
00066    
    def getMass(self):


Member Data Documentation

twikiExport::Material::theComment

Definition at line 34 of file twikiExport.py.

twikiExport::Material::theConstituents

Definition at line 35 of file twikiExport.py.

twikiExport::Material::theDescription

Definition at line 31 of file twikiExport.py.

twikiExport::Material::theMcVolume

Definition at line 33 of file twikiExport.py.

twikiExport::Material::theName

Definition at line 32 of file twikiExport.py.


The documentation for this class was generated from the following file:
Generated on Tue Jun 9 18:53:12 2009 for CMSSW by  doxygen 1.5.4