00001
00002
00003
00004
00005
00006
00007
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
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
00026
00027 GlobalEventDataMaker::GlobalEventDataMaker (
00028 const std::string& name,
00029 ISvcLocator* pSvcLocator
00030 )
00031 : Algorithm( name, pSvcLocator )
00032 {
00033
00034 m_lumi = 1;
00035 m_fieldOn = true;
00036 m_barrelForwardEta = 3.2;
00037 m_randSeed = 12345;
00038
00039
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
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
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
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
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
00118
00119
00120 StatusCode GlobalEventDataMaker::execute( ){
00121
00122 return StatusCode::SUCCESS;
00123 }
00124
00125 }
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142