001
002
003
004
005
006
007
008
009
010
011
012
013
014
015
016
017
018
019
020
021
022
023
024
025
026
027
028
029 #include "generatorMods/QQModule.hh"
030
031
032
033
034 #include <iostream>
035 #include <sstream>
036
037
038
039
040 #include "BaBar/Cdf.hh"
041 #include "inc/bcs.h"
042 #include "evt/evt.h"
043 #include "evt/Event.hh"
044 #include "stdhep_i/CdfHepevt.hh"
045 #include "qq_i/QQInterface.hh"
046 #include "stdhep_i/Heplun.hh"
047 #include "r_n/CdfRn.hh"
048
049
050
051
052
053 const char* QQModule::genId = "QQModule";
054 const long QQModule::_defaultRandomSeed1 = 9223591;
055 const long QQModule::_defaultRandomSeed2 = 109736;
056
057
058
059
060
061 QQModule::QQModule()
062 : AbsDecpackModule( QQModule::genId, "AC++ QQ Module" ),
063 _decbud("Decay_B+_and_B0", this, 1),
064 _decbs ("Decay_Bs", this, 1),
065 _decbc ("Decay_Bc", this, 0),
066 _decbb ("Decay_Upsilon", this, 0),
067 _decbyn("Decay_B_Baryons", this,0),
068 _dechrm("Decay_prompt_charm", this,0),
069 _lowest("Decay_only_lowest", this, 0),
070 _lnglif("Decay_K_s_Lambda", this, 0),
071 _nolife("No_lifetime_for_input", this, 0),
072 _forceCP("force_CP" , this, false),
073 _qqI( 0 ),
074 _randomSeed1("RandomSeed1",this,QQModule::_defaultRandomSeed1),
075 _randomSeed2("RandomSeed2",this,QQModule::_defaultRandomSeed2)
076 {
077
078
079 commands( )->append( &_decbud );
080 commands( )->append( &_decbs );
081 commands( )->append( &_decbc );
082 commands( )->append( &_decbb );
083 commands( )->append( &_decbyn );
084 commands( )->append( &_dechrm );
085 commands( )->append( &_lowest );
086 commands( )->append( &_lnglif );
087 commands( )->append( &_nolife );
088 commands( )->append( &_forceCP );
089
090
091 _randomNumberMenu.initialize("RandomNumberMenu",this);
092 _randomNumberMenu.initTitle("Random number menu");
093 commands()->append(&_randomNumberMenu);
094
095
096 _randomNumberMenu.commands()->append(&_randomSeed1);
097 _randomNumberMenu.commands()->append(&_randomSeed2);
098
099 ostringstream tmpSstream1;
100 ostringstream tmpSstream2;
101
102
103 tmpSstream1 << " \t\t\tSeed #1 for the random number generator"
104 << "\n\t\t\t(default " << _randomSeed1.value() << ").";
105 _randomSeed1.addDescription(tmpSstream1.str());
106 tmpSstream2 << " \t\t\tSeed #2 for the random number generator"
107 << "\n\t\t\t(default " << _randomSeed2.value() << ").";
108 _randomSeed2.addDescription(tmpSstream2.str());
109
110
111 }
112
113
114
115
116
117 QQModule::~QQModule() {
118 if (_qqI) delete _qqI;
119 }
120
121
122
123
124
125 AppResult QQModule::genBeginJob()
126 {
127 _qqI = new QQInterface();
128
129 CdfRn* rn = CdfRn::Instance();
130 if ( !rn->isReadingFromFile() ) {
131 rn->SetEngineSeeds(_randomSeed1.value(), _randomSeed2.value(),"QQModule");
132 }
133
134 Heplun heplun;
135 if (!heplun.lnhout()) heplun.lnhout()=6;
136
137
138 _qqI->setDecayBud(_decbud.value());
139 _qqI->setDecayBs( _decbs.value());
140 _qqI->setDecayBc( _decbc.value());
141 _qqI->setDecayUpsilon(_decbb.value());
142 _qqI->setDecayBBaryon(_decbyn.value());
143 _qqI->setDecayPromptCharm(_dechrm.value());
144 _qqI->setDecayOnlyLowest(_lowest.value());
145 _qqI->setDecayKsLambda(_lnglif.value());
146 _qqI->setNoLifeInput(_nolife.value());
147 _qqI->setForceCP(_forceCP.value());
148 _qqI->grandInit();
149 _qqI->dumpParameters();
150 return AppResult::OK;
151 }
152
153 AppResult QQModule::genEndJob()
154 {
155 return AppResult::OK;
156 }
157
158 AppResult QQModule::genBeginRun( AbsEvent* anEvent )
159 {
160 return AppResult::OK;
161 }
162
163 AppResult QQModule::genEndRun( AbsEvent* anEvent )
164 {
165 return AppResult::OK;
166 }
167
168 int QQModule::callGenerator( AbsEvent* anEvent )
169 {
170 _qqI->event();
171 return 1;
172 }
173
174
175
176
Send problems or questions to cdfcode@fnal.gov