| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

DigiConf.py

Go to the documentation of this file.
00001 """
00002 Configurable for Boole output
00003 """
00004 __version__ = "$Id: DigiConf.py,v 1.2 2009/04/03 15:01:40 cattanem Exp $"
00005 __author__  = "Marco Cattaneo <Marco.Cattaneo@cern.ch>"
00006 
00007 from Gaudi.Configuration import *
00008 import GaudiKernel.ProcessJobOptions
00009 
00010 class DigiConf(ConfigurableUser):
00011     __slots__ = {
00012          "DigiType"       : "Default"
00013        , "Writer"         : "NONE"
00014        , "TAEPrev"        : 0
00015        , "TAENext"        : 0
00016        , "SpilloverPaths" : []
00017          }
00018 
00019     _propertyDocDct = { 
00020         'DigiType'      : """ Type of digi, can be ['Minimal','Default','Extended'] """
00021        ,'Writer'        : """ Name of OutputStream writing the Digi file, if any """
00022        ,'TAEPrev'       : """ Number of Prev Time Alignment Events to write """
00023        ,'TAENext'       : """ Number of Next Time Alignment Events to write """
00024        ,'SpilloverPaths': """ Paths to write out when spillover is enabled """
00025        }
00026 
00027     KnownDigiTypes = ['Minimal','Default','Extended']
00028 
00029     def _doWrite( self ):
00030         """
00031         Define the file content and write it out
00032         """
00033         if self.getProp( "Writer" ) == "NONE":
00034             log.info( "No Writer defined for DIGI" )
00035             return
00036         
00037         dType = self.getProp( "DigiType" ).capitalize()
00038         if dType not in self.KnownDigiTypes:
00039             raise TypeError( "Unknown DIGI type '%s'"%dType )
00040 
00041         items    = []
00042         optItems = []
00043         self._defineOutputData( dType, items, optItems )
00044         
00045         self._doWritePOOL( dType, items, optItems )
00046             
00047 
00048     def _defineOutputData( self, dType, items, optItems ):
00049         """
00050         Define content of the output dataset
00051         """
00052         # Pack pSim containers for the output if not on the input file
00053         DataOnDemandSvc().AlgMap["pSim/MCParticles"] = "PackMCParticle"
00054         DataOnDemandSvc().AlgMap["pSim/MCVertices"]  = "PackMCVertex"
00055 
00056         # Start with minimal content (real data plus pileup info)
00057         items += [ 
00058             # Objects propagated from Gauss
00059               "/Event/Gen/Header#1"
00060             , "/Event/MC/Header#1"
00061 
00062             # Boole header
00063             , "/Event/MC/DigiHeader#1"
00064 
00065             # Real data simulation
00066             , "/Event/DAQ/RawEvent#1" ]
00067 
00068         if dType == "Minimal":
00069             items += [ "/Event/MC/Vertices#1" ] # Filtered, only primary vertices with no daughters
00070 
00071         else:
00072             # Standard DIGI content
00073             items += [ 
00074                 # Objects propagated from Gauss
00075                   "/Event/Gen/Collisions#1"
00076                 , "/Event/Gen/HepMCEvents#1"
00077                 , "/Event/pSim/MCParticles#1"
00078                 , "/Event/pSim/MCVertices#1"
00079  
00080                 # Digitization summaries
00081                 , "/Event/MC/Rich/DigitSummaries#1"
00082                 , "/Event/MC/Muon/DigitsInfo#1"
00083 
00084                 # Links to MCParticles
00085                 , "/Event/Link/Trig/L0/Calo#1"
00086                 , "/Event/Link/Trig/L0/FullCalo#1"
00087                 , "/Event/Link/Raw/Velo/Clusters#1"
00088                 , "/Event/Link/Raw/TT/Clusters#1"
00089                 , "/Event/Link/Raw/IT/Clusters#1"
00090                 , "/Event/Link/Raw/OT/Times#1"
00091                 , "/Event/Link/Raw/Ecal/Digits#1"
00092                 , "/Event/Link/Raw/Hcal/Digits#1"
00093                 , "/Event/Link/Raw/Muon/Digits#1"
00094                 , "/Event/MC/TrackInfo#1"
00095 
00096                 # Links to MCHits
00097                 , "/Event/Link/Raw/Velo/Clusters2MCHits#1"
00098                 , "/Event/Link/Raw/TT/Clusters2MCHits#1"
00099                 , "/Event/Link/Raw/IT/Clusters2MCHits#1"
00100                 , "/Event/Link/Raw/OT/Times2MCHits#1" ]
00101 
00102             # Spillover event structure, copied from .sim if present
00103             for spill in self.getProp("SpilloverPaths"):
00104                 optItems += [ "/Event/%s/MC/Header#1"%spill ]
00105 
00106             # Add TAE RawEvents when enabled
00107             taePrev = self.getProp("TAEPrev")
00108             while taePrev > 0:
00109                 items += ["/Event/Prev%s/DAQ/RawEvent#1"%taePrev]
00110                 taePrev -= 1
00111             taeNext = self.getProp("TAENext")
00112             while taeNext>0:
00113                 items += ["/Event/Next%s/DAQ/RawEvent#1"%taeNext]
00114                 taeNext -= 1
00115 
00116         if dType == "Extended":
00117             # Add the MCHits
00118             items += [
00119                   "/Event/MC/PuVeto/Hits#1"
00120                 , "/Event/MC/Velo/Hits#1"
00121                 , "/Event/MC/TT/Hits#1"
00122                 , "/Event/MC/IT/Hits#1"
00123                 , "/Event/MC/OT/Hits#1"
00124                 , "/Event/MC/Rich/Hits#1"
00125                 , "/Event/MC/Prs/Hits#1"
00126                 , "/Event/MC/Spd/Hits#1"
00127                 , "/Event/MC/Ecal/Hits#1"
00128                 , "/Event/MC/Hcal/Hits#1"
00129                 , "/Event/MC/Muon/Hits#1" ]
00130             
00131 
00132     def _doWritePOOL( self, dType, items, optItems ):
00133         """
00134         Write a file in POOL format
00135         """
00136         writer = OutputStream( self.getProp("Writer") )
00137         ApplicationMgr().OutStream.insert( 0, writer )
00138         writer.Preload = False
00139         writer.ItemList += items
00140         writer.OptItemList += optItems
00141         log.info( "%s.ItemList=%s"%(self.getProp("Writer"),items) )
00142         log.info( "%s.OptItemList=%s"%(self.getProp("Writer"),optItems) )
00143 
00144         # In Minimal case, need to kill some nodes
00145         if dType == "Minimal":
00146             from Configurables import EventNodeKiller
00147             nodeKiller = EventNodeKiller("POOLNodeKiller")
00148             ApplicationMgr().OutStream.insert( 0, nodeKiller )
00149             nodeKiller.Nodes += [ "Link", "pSim" ]
00150             nodeKiller.Nodes += [ "MC/Velo", "MC/PuVeto", "MC/TT", "MC/IT", "MC/OT", "MC/Rich", "MC/Prs", "MC/Spd", "MC/Ecal", "MC/Hcal", "MC/Muon" ]
00151             nodeKiller.Nodes += self.getProp("SpilloverPaths")
00152 
00153     def __apply_configuration__(self):
00154         GaudiKernel.ProcessJobOptions.PrintOn()
00155         self._doWrite()
00156         GaudiKernel.ProcessJobOptions.PrintOff()
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Mon Apr 11 20:04:42 2011 for GaudiConf by doxygen 1.4.7