Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

GlobalEventDataMaker.cxx

Go to the documentation of this file.
00001 // ================================================
00002 // GlobalEventDataMaker class Implementation Singleton version 
00003 // ================================================
00004 //
00005 // THIS TEXT TO BE REPLACED BY ATLAS STANDARD FORMAT
00006 //
00007 // Namespace Atlfast
00008 //
00009 #include "AtlfastAlgs/GlobalEventDataMaker.h"
00010 #include "AtlfastAlgs/GlobalEventData.h"
00011 
00012 #include "AtlfastEvent/ParticleCodes.h"
00013 
00014 #include "AtlfastUtils/HeaderPrinter.h"
00015 
00016 // Gaudi includes
00017 #include "GaudiKernel/DataSvc.h"
00018 #include "GaudiKernel/MsgStream.h"
00019 #include <algorithm>
00020 
00021 namespace Atlfast {
00022   using std::sort;
00023   using std::unique;
00024   //--------------------------------
00025   // Constructor 
00026   //--------------------------------
00027   GlobalEventDataMaker::GlobalEventDataMaker ( 
00028       const std::string& name, 
00029       ISvcLocator* pSvcLocator 
00030       )
00031     : Algorithm( name, pSvcLocator )
00032   {
00033     // Set the parameter defaults.
00034     m_lumi              = 1;
00035     m_fieldOn           = true;
00036     m_barrelForwardEta  = 3.2;
00037     m_randSeed          = 12345;
00038     // Declare the paramemters to Gaudi so that
00039     // they can be over-written via the job options file
00040     declareProperty( "Luminosity",       m_lumi );
00041     declareProperty( "Invisibles",       m_invisibles );
00042     declareProperty( "BFieldOn",         m_fieldOn ) ;
00043     declareProperty( "RandomSeed",       m_randSeed ) ;
00044     declareProperty( "BarrelForwardEta", m_barrelForwardEta ) ;
00045   }
00046   
00047   //--------------------
00048   // Destructor
00049   //--------------------
00050   
00051   GlobalEventDataMaker::~GlobalEventDataMaker() {
00052     MsgStream log( messageService(), name() ) ;
00053     log << MSG::INFO << "destructor, Global Event Data" << endreq;
00054  
00055     
00056   }
00057   
00058   //---------------------------------
00059   // initialise() 
00060   //---------------------------------
00061   
00062   StatusCode GlobalEventDataMaker::initialize()
00063   {
00064     MsgStream log( messageService(), name() ) ;
00065     log << MSG::DEBUG << "Initialising" << endreq; 
00066     log << MSG::DEBUG << "Making Invisibles" << endreq; 
00067     m_invisibles.push_back(ParticleCodes::NU_E);
00068     m_invisibles.push_back(ParticleCodes::NU_MU);
00069     m_invisibles.push_back(ParticleCodes::NU_TAU);
00070     std::vector<int>::iterator ibe = m_invisibles.begin();
00071     std::vector<int>::iterator originalEnd = m_invisibles.end();
00072     std::vector<int>::iterator ien;
00073     sort(ibe, originalEnd);
00074     ien=unique(ibe, originalEnd);
00075     m_invisibles.erase(ien, originalEnd);
00076 
00077     if(m_lumi != 1 && m_lumi != 2){
00078       log << MSG::WARNING << "Luminosity set to unknown value: " << m_lumi << endreq; 
00079       log << MSG::WARNING << "Luminosity reset to Low-Lumi == 1" << endreq;
00080       m_lumi = 1;
00081     }
00082     log << MSG::DEBUG << "Making Header" << endreq; 
00083     HeaderPrinter hp("Atlfast GlobalEventData Maker:", log);
00084     hp.add("Invisibles (Neutrinos hardwired invisible): ", ibe, ien);
00085     hp.add("Luminosity:                                 ", m_lumi);
00086     hp.add("Initial Random Number Seed:                 ", m_randSeed);
00087     hp.add("B-field On:                                 ", m_fieldOn);
00088     hp.add("Barrel Forward Eta:                         ", m_barrelForwardEta);
00089     hp.print();
00090     log << MSG::DEBUG << "Calling ged instance" << endreq; 
00091 
00092     //set values of GlobalEventVariables
00093 
00094     
00095     GlobalEventData* ged = GlobalEventData::Instance();
00096 
00097     log << MSG::DEBUG << "Calling ged setValues" << endreq; 
00098     ged->setValues(m_lumi,m_fieldOn,m_barrelForwardEta,m_randSeed,m_invisibles) ;
00099     log << MSG::DEBUG << "Everythng Completed" << endreq;
00100     return StatusCode::SUCCESS ;
00101   }
00102   
00103   //---------------------------------
00104   // finalise() 
00105   //---------------------------------
00106   
00107   StatusCode GlobalEventDataMaker::finalize()
00108   {
00109     
00110     MsgStream log( messageService(), name() ) ;
00111     log << MSG::INFO << "Finalizing" << endreq;  
00112     return StatusCode::SUCCESS ;
00113   }
00114   
00115   
00116   //----------------------------------------------
00117   // execute() method called once per event
00118   //----------------------------------------------
00119   
00120   StatusCode GlobalEventDataMaker::execute( ){
00121     // do nothing in execute
00122     return StatusCode::SUCCESS;
00123   }
00124   
00125 } // end namespace bracket
00126 
00127 
00128 
00129 
00130 
00131 
00132 
00133 
00134 
00135 
00136 
00137 
00138 
00139 
00140 
00141 
00142 

Generated on Tue Mar 18 11:18:23 2003 for AtlfastAlgs by doxygen1.3-rc1