CDF II
CDF KITS
source navigation ]
diff markup ]
identifier search ]
freetext search ]
file search ]
 
Architecture: i386 ]
Version: 4.10.4 ] [ 4.10.5 ] [ 4.8.4 ] [ 4.8.4l3s ] [ 4.8.5 ] [ 4.9.0 ] [ 4.9.1 ] [ 4.9.1.hpt3 ] [ 4.9.1hpt3 ] [ 4.9.1top1 ] [ 5.0.0 ] [ 5.1.0 ] [ 5.1.0beamonly ] [ 5.1.1 ] [ 5.2.0 ] [ 5.3.0 ] [ 5.3.1 ] [ 5.3.1dsp ] [ 5.3.3 ] [ 5.3.3_nt ] [ 5.3.4 ] [ 6.1.1 ] [ 6.1.1b ] [ 6.1.2 ] [ 6.1.3 ] [ 6.1.4 ] [ 6.1.4int3 ] [ 6.1.4mc ] [ 6.1.4mc_a ] [ 6.1.6 ] [ development ]

001 //--------------------------------------------------------------------------
002 // Description:
003 //      Class VecbosModule
004 //
005 // Wed Jul 11 16:08:15 CDT 2001, G.Velev fix a bug in calculation of PDF set
006 //                               add vegas read/write flag
007 //                               return calls to ybos_init_framework which Lena
008 //                               removed, need to write correctly VECW bank
009 //
010 // rev.  aug 30 2001 lena: added  
011 
012 #include "generatorMods/VecbosModule.hh"
013 
014 #include "Bbos/bank_interface.hh"
015 #include "Framework/APPFramework.hh"
016 #include "ParticleDB/hepevt.hh"
017 #include "vecbos_i/Vecbos.hh"
018 #include "ParticleDB/ParticleDb.hh"
019 #include "evt/Event.hh"
020 #include "r_n/CdfRn.hh"
021 #include <sstream>
022 using std::ostringstream ;
023 
024 const long VecbosModule::_defaultRandomSeed1 = 9228;
025 const long VecbosModule::_defaultRandomSeed2 = 1097;
026 
027 const char* VecbosModule::genId = "VecbosModule";
028 
029 VecbosModule::VecbosModule() : 
030   AbsGenModule( VecbosModule::genId, "Vecbos module"),
031   _debug("debug",this,false),
032   _beam_type("beam",this,1),   
033   _which_boson("wORz",this,1),
034   _decay_boson("decayWorZ",this,true),
035   _charge_of_W("chargeOfW",this,0),
036   _howto_decay_Z("zDecayMode",this,1),
037   _njets("njets",this,3),
038   _structure_function("strFunct",this,6),
039   _pdf_group("pdfGroup",this,3),
040   _pdf_set("pdfSet",this,30),
041   _run_number("runNumber",this,1),
042   _cm_energy("energyCM",this,1960.),
043   _qcd_scale("qcdScale",this,1),
044   _helicity("helicity",this,0),
045   _force_bbbar("bbBar",this,0),
046   _important("important",this,1),
047   _sampling_mode("samplingMode",this,2),
048   _lepton_type("leptonType",this,1),
049   _matrix_ele("matrixElement",this,1),
050   _alpha_jet_generation("AlphaPt",this,0.019),
051   _subprocesses("subprocesses",this,100),
052   _make_jets("makeJets",this,false),
053   _jet_min_pt("jetMinPt",this,8.0),
054   _jet_sum_pt("jetsumPt",this,0.0),
055   _jet_eta_max("jetEtaMax",this,2.5),
056   _jet_eta_separation("jetEtaSep",this,0.4),
057   _boson_min_pt("bosonMinPt",this,0.0),
058   _no_of_leptons("noOfLeptons",this,1),
059   _lep_max_eta("lepMaxEta",this,2.5),
060   _lep_min_pt("lepMinPt",this,12.),
061   _mis_pt_min("misPtMin",this,0.0),
062   _min_weght("minWeigth",this,0.0),
063   _vegas_rw_flag("rwGrid",this,1),
064   _vegas_inp_grid_file("gridInputName",this,"input_test.grid"),
065   _vegas_out_grid_file("gridOutputName",this,"output_test.grid"),
066   _vegas_print("vegasPrint",this,0),
067   _vegas_n_inter("vegasNInter",this,5),
068   _vegas_n_calls1("vegasNCalls1",this,0),
069   _vegas_n_calls2("vegasNCalls2",this,0),
070   _randomSeed1("RandomSeed1",this,VecbosModule::_defaultRandomSeed1),
071   _randomSeed2("RandomSeed2",this,VecbosModule::_defaultRandomSeed2)
072 {       
073  
074   //initialize talk-to
075   _initializeTalkTo();
076 
077   // Initialize the relevant submenu
078   _randomNumberMenu.initialize("RandomNumberMenu",this);
079   _randomNumberMenu.initTitle("Fake event random number menu");
080   commands()->append(&_randomNumberMenu);
081 
082   // Add the commands to the menu
083   _randomNumberMenu.commands()->append(&_randomSeed1);
084   _randomNumberMenu.commands()->append(&_randomSeed2);
085 
086   ostringstream tmpSstream1;
087   ostringstream tmpSstream2;
088 
089   // Describe them
090   tmpSstream1 << "      \t\t\tSeed #1 for the random number generator"
091               << "\n\t\t\t(default " << _randomSeed1.value() << ").";
092   _randomSeed1.addDescription(tmpSstream1.str());
093   tmpSstream2 << "      \t\t\tSeed #2 for the random number generator"
094               << "\n\t\t\t(default " << _randomSeed2.value() << ").";  
095   _randomSeed2.addDescription(tmpSstream2.str());
096 
097 }
098 
099 
100 VecbosModule::~VecbosModule() {
101 }
102 
103 //_____________________________________________________________________________
104 AppResult VecbosModule::genBeginJob() {
105 
106   CdfRn* rn = CdfRn::Instance();
107   if ( !rn->isReadingFromFile() ) {
108     rn->SetEngineSeeds(_randomSeed1.value(), _randomSeed2.value(), "VECBOS");
109   }
110 
111   // initialize FORTRAN VECBOS code
112   Vecbos* fEventGenerator = Vecbos::Instance();
113   fEventGenerator->Init();
114 
115   // communicate with common blocks
116   putParametersToVecbos();
117   getParametersFromVecbos();
118 
119   //->-> end moved
120 
121 //  _hepevt.init();
122   _events = 0;
123                              // init Vecbos Parameters from  Absparms
124   putParametersToVecbos();
125   Vecbos::Instance()->Vecjnk()->NEVENT = _framework->lastEventRequest();
126   return AppResult::OK;
127 }
128 
129 //_____________________________________________________________________________
130 AppResult VecbosModule::genEndJob() {
131  
132   Vecbos::Instance()->RunEnd();
133   Vecbos::Instance()->Fin();
134 
135   return AppResult::OK;
136 }
137 
138 //_____________________________________________________________________________
139 AppResult VecbosModule::genEndRun(AbsEvent* event) {
140 
141   if(event) {
142     ybos_init_framework(event);
143     Vecbos::Instance()->RunEnd();
144     ybos_init_framework(0);
145   }   
146 
147   return AppResult::OK;
148 }
149 
150 //_____________________________________________________________________________
151 AppResult VecbosModule::genBeginRun(AbsEvent* event) {
152   
153   if(event) {
154     ybos_init_framework(event);
155     Vecbos::Instance()->RunBeg();
156     ybos_init_framework(0);
157   }
158   return AppResult::OK;
159 }
160 
161 //_____________________________________________________________________________
162 int VecbosModule::callGenerator(AbsEvent* event) {
163 
164    ybos_init_framework(event);
165    int rc = Vecbos::Instance()->GenerateEvent();
166    ++_events;
167    return rc;
168 }
169 
170 //_____________________________________________________________________________
171 void  VecbosModule::fillHepevt() {
172   // VecbosModule does not fill hepevt
173 }
174 
175 void VecbosModule::putParametersToVecbos() {
176 
177   // puts the AbsParms to the Vecbos common blocks
178   // debug flag
179 
180   int _iflag;
181   int _iflag1;
182 
183   if (_debug.value() ) {
184     Vecbos::Instance()->Bveg1()->NPRN = 1;
185   } 
186   else {
187     Vecbos::Instance()->Bveg1()->NPRN = 0;
188   }
189 
190   // beam 
191   Vecbos::Instance()->Genera()->IPPBAR = _beam_type.value();
192 
193   // W or Z
194   Vecbos::Instance()->Genera()->IVEC = _which_boson.value();
195 
196   // decay the boson 
197   if (!_decay_boson.value()) {
198     std::cout<<" Despite request, W will be decayed!"<<std::endl;
199   }
200         
201   // charge of W ????
202   if(Vecbos::Instance()->Genera()->IVEC == 1) {
203     Vecbos::Instance()->Genera()->IWHICH = 1;
204     _iflag1 = _charge_of_W.value();
205     if(_iflag1 == -1) Vecbos::Instance()->Genera()->IWHICH=2;
206     if(_iflag1 ==  0) Vecbos::Instance()->Genera()->IWHICH=3;
207   }
208   else {
209     Vecbos::Instance()->Genera()->IWHICH = 0;
210   }
211 
212   // Z decay 
213   Vecbos::Instance()->Genera()->IDECAY = _howto_decay_Z.value();
214 
215   // no of jets 
216   Vecbos::Instance()->Genera()->NJET = _njets.value();
217 
218   //  Structure function
219   Vecbos::Instance()->Strucv()->IUSE = _structure_function.value();
220   
221   // PDF group and set 
222   if (_structure_function.value() == 6) {
223     //    Vecbos::Instance()->Vpdfsf()->NUMPDF = 100000 + 1000*_pdf_group.value() + _pdf_set.value();
224     Vecbos::Instance()->Vpdfsf()->NUMPDF = 1000*_pdf_group.value() + _pdf_set.value();
225   }
226   else {
227     Vecbos::Instance()->Vpdfsf()->NUMPDF = -1;
228   } 
229 
230   // Run Number
231   Vecbos::Instance()->Vecrun()->RUNNUM = _run_number.value();
232 
233   // Energy in CM
234   Vecbos::Instance()->Genera()->W = _cm_energy.value();
235 
236   // QCD Scale 
237   Vecbos::Instance()->Genera()->IQCDDS = _qcd_scale.value();
238 
239   // Helicity 
240   Vecbos::Instance()->Genera()->IHELRN = _helicity.value();
241 
242   // Force bbbar in final state 
243   Vecbos::Instance()->Genera()->IMQ = _force_bbbar.value();
244 
245   // use importance sampling for jet Pt
246   _iflag = _important.value();
247   Vecbos::Instance()->Imppar()->IYES = _iflag;
248 
249   // sampling mode 
250   if (_iflag == 1) {
251     Vecbos::Instance()->Imppar()->IS = _sampling_mode.value();
252   }
253   else {
254     Vecbos::Instance()->Imppar()->IS = 0;
255   }
256 
257   // Lepton type 
258   Vecbos::Instance()->Vecjnk()->LEPTON_TYPE = _lepton_type.value();
259 
260   // Matrix element
261   Vecbos::Instance()->Inter()->IMANN1 = _matrix_ele.value();
262 
263   // Alpha jet generaion
264   Vecbos::Instance()->Imppar()->ALPHA = _alpha_jet_generation.value();
265 
266   // Make  jets from boson decay
267   Vecbos::Instance()->Initvg()->MKJTS = _make_jets.value();
268 
269   // Jet minimum Pt
270   Vecbos::Instance()->Cutval()->PTMINJ = _jet_min_pt.value();
271 
272   // Jet sum Pt
273   Vecbos::Instance()->Vecjnk()->ETOTMN = _jet_sum_pt.value();
274 
275   // Jet eta maximum
276   Vecbos::Instance()->Vecjnk()->ETAMAX = _jet_eta_max.value();
277 
278   // Jet eta separation
279   Vecbos::Instance()->Vecjnk()->ETASEP = _jet_eta_separation.value();
280 
281   // Min Pt  of the  boson
282   Vecbos::Instance()->Vhrdct()->BOSPT = _boson_min_pt.value();
283 
284   // No of leptons 
285   Vecbos::Instance()->Vhrdct()->MIN_ELE = _no_of_leptons.value();
286 
287   // Lepton maximum abs(eta)
288   Vecbos::Instance()->Vhrdct()->ELE_ETAMAX = (int)_lep_max_eta.value();
289 
290   // Lepton minimum Pt
291   Vecbos::Instance()->Vhrdct()->ELE_PTMIN = (int)_lep_min_pt.value();
292 
293   // Missing Et(Pt) Cut
294   Vecbos::Instance()->Vhrdct()->MISSPT = (int)_mis_pt_min.value();
295 
296   // Minimal event weight
297   Vecbos::Instance()->Vecjnk()->WT_MIN = _min_weght.value();
298 
299   // Read write vegas grid file  flag
300   _iflag = _vegas_rw_flag.value();
301   Vecbos::Instance()->Vcenct()->I_READIN = _iflag%2;
302   Vecbos::Instance()->Vcenct()->I_WRITEOUT = _iflag/2;
303     
304 
305   // Input file for VEGAS grid 
306   //envir = _vegas_inp_grid_file.value();
307   //setenv("CDFVEGIN",envir);
308   //if (envir != NULL) {
309   //  setenv("CDFVEGIN",envir);
310   //}
311   //else {
312   //  setenv("CDFVEGIN","empty");
313   //}
314 
315   // Output file for VEGAS grid
316   //  envir = _vegas_out_grid_file.value();
317   //  if (envir != NULL) {
318   //    setenv("CDFVEGOUT",envir);
319   // }
320   //else {
321   //  setenv("CDFVEGOUT""empty");
322   //}
323 
324   // VEGAS print 
325   Vecbos::Instance()->Bveg1()->NPRN = _vegas_print.value();
326 
327   // VEGAS no of iterations
328   Vecbos::Instance()->Inter()->ITMX1 = _vegas_n_inter.value();
329 
330   // VEGAS  no of calls 1
331   Vecbos::Instance()->Inter()->NCALL1 = _vegas_n_calls1.value();
332 
333   // VEGAS  no of calls 2
334   Vecbos::Instance()->Inter()->NCALL2 = _vegas_n_calls2.value();  
335 }
336 
337 
338 void VecbosModule::getParametersFromVecbos() {
339   // takes the AbsParms from the Vecbos common blocks
340 
341   int _iflag;
342   int _iflag1;
343   int _iflag2;  
344   char* envir;
345 
346   // debug flag
347   _iflag = Vecbos::Instance()->Bveg1()->NPRN;
348   if (_iflag == 0) {
349     _debug.set(false);
350   } 
351   else {
352     _debug.set(true);
353   }
354 
355   // beam 
356   _beam_type.set(Vecbos::Instance()->Genera()->IPPBAR);
357 
358   // W or Z
359   _iflag = Vecbos::Instance()->Genera()->IVEC;
360   _which_boson.set(_iflag);
361 
362   // decay the boson 
363   _decay_boson.set(true);
364         
365   // charge of W
366   if(_iflag == 1) {
367     _iflag1 = Vecbos::Instance()->Genera()->IWHICH;
368     if(_iflag1 == 2) _iflag1 = -1;
369     if(_iflag1 == 3) _iflag1 = 0; 
370     _charge_of_W.set(_iflag1);
371   }
372   else {
373      _charge_of_W.set(0);
374   }
375 
376   // Z decay 
377   _howto_decay_Z.set(Vecbos::Instance()->Genera()->IDECAY);
378 
379   // no of jets 
380   _njets.set(Vecbos::Instance()->Genera()->NJET);
381 
382   //  Structure function
383   _iflag = Vecbos::Instance()->Strucv()->IUSE;
384   _structure_function.set(_iflag);
385   
386   // PDF group and set
387   if (_iflag == 6) {
388     _iflag2 = (Vecbos::Instance()->Vpdfsf()->NUMPDF)/100000;
389     _iflag1 = ((Vecbos::Instance()->Vpdfsf()->NUMPDF)-_iflag2*100000)/1000;
390     _pdf_group.set(_iflag1);
391     _iflag1 = ((Vecbos::Instance()->Vpdfsf()->NUMPDF)-_iflag2*100000)%1000;
392     _pdf_set.set(_iflag1);
393   }
394   else {
395     _pdf_group.set(-1);
396     _pdf_set.set(-1);
397   } 
398 
399   // Run Number
400   _run_number.set(Vecbos::Instance()->Vecrun()->RUNNUM);
401 
402   // Energy in CM
403   _cm_energy.set(Vecbos::Instance()->Genera()->W);
404 
405   // QCD Scale 
406   _qcd_scale.set(Vecbos::Instance()->Genera()->IQCDDS);
407 
408   // Helicity 
409   _helicity.set(Vecbos::Instance()->Genera()->IHELRN);
410 
411   // Force bbbar in final state 
412   _force_bbbar.set(Vecbos::Instance()->Genera()->IMQ);
413 
414   // use importance sampling for jet Pt
415   _iflag = Vecbos::Instance()->Imppar()->IYES;
416   _important.set(_iflag);
417 
418   // sampling mode 
419   if (_iflag == 1) {
420     _sampling_mode.set(Vecbos::Instance()->Imppar()->IS);
421   }
422   else {
423     _sampling_mode.set(0); 
424   }
425 
426   // Lepton type 
427   _lepton_type.set(Vecbos::Instance()->Vecjnk()->LEPTON_TYPE);
428 
429   // Matrix element
430   _matrix_ele.set(Vecbos::Instance()->Inter()->IMANN1);
431 
432   // Alpha jet generaion
433   _alpha_jet_generation.set(Vecbos::Instance()->Imppar()->ALPHA);
434 
435   // Make  jets from boson decay
436   _iflag = Vecbos::Instance()->Initvg()->MKJTS;
437   _make_jets.set(_iflag);
438 
439   // Jet minimum Pt
440   _jet_min_pt.set(Vecbos::Instance()->Cutval()->PTMINJ);
441 
442   // Jet sum Pt
443   _jet_sum_pt.set(Vecbos::Instance()->Vecjnk()->ETOTMN);
444 
445   // Jet eta maximum
446   _jet_eta_max.set(Vecbos::Instance()->Vecjnk()->ETAMAX);
447 
448   // Jet eta separation
449   _jet_eta_separation.set(Vecbos::Instance()->Vecjnk()->ETASEP);
450 
451   // Min Pt  of the  boson
452   _boson_min_pt.set(Vecbos::Instance()->Vhrdct()->BOSPT);
453 
454   // No of leptons 
455   _no_of_leptons.set(Vecbos::Instance()->Vhrdct()->MIN_ELE);
456 
457   // Lepton maximum abs(eta)
458   _lep_max_eta.set(Vecbos::Instance()->Vhrdct()->ELE_ETAMAX);
459 
460   // Lepton minimum Pt
461   _lep_min_pt.set(Vecbos::Instance()->Vhrdct()->ELE_PTMIN);
462 
463   // Missing Et(Pt) Cut
464   _mis_pt_min.set(Vecbos::Instance()->Vhrdct()->MISSPT);
465 
466   // Minimal event weight
467   _min_weght.set(Vecbos::Instance()->Vecjnk()->WT_MIN);
468 
469    // Read write vegas grid file  flag
470   _iflag  = Vecbos::Instance()->Vcenct()->I_READIN;
471   _iflag1 = Vecbos::Instance()->Vcenct()->I_WRITEOUT;
472   _vegas_rw_flag.set(_iflag+2*_iflag1);
473 
474   // Input file for VEGAS grid 
475   envir = getenv("CDFVEGIN");
476   if (envir != NULL) {
477     _vegas_inp_grid_file.set(envir);
478   }
479   else {
480     _vegas_inp_grid_file.set("empty");
481   }
482 
483    // Output file for VEGAS grid
484   envir = getenv("CDFVEGOUT");
485   if (envir != NULL) {
486     _vegas_out_grid_file.set(envir);
487   }
488   else {
489     _vegas_out_grid_file.set("empty");
490   }
491 
492   // VEGAS print 
493   _iflag = Vecbos::Instance()->Bveg1()->NPRN;
494   _vegas_print.set(_iflag);
495 
496   // VEGAS no of iterations
497   _vegas_n_inter.set(Vecbos::Instance()->Inter()->ITMX1);
498 
499   // VEGAS  no of calls 1
500   _vegas_n_calls1.set(Vecbos::Instance()->Inter()->NCALL1);
501 
502   // VEGAS  no of calls 2
503   _vegas_n_calls2.set(Vecbos::Instance()->Inter()->NCALL2);
504   
505 }
506 

source navigation ] diff markup ] identifier search ] freetext search ] file search ]

This page was automatically generated by the LXR engine.
The LXR team
Valid HTML 4.01!

Send problems or questions to cdfcode@fnal.gov