Report problems to ATLAS LXR Team (with time and IP address indicated)

The LXR Cross Referencer

source navigation ]
diff markup ]
identifier search ]
general search ]
 
 
Architecture: linux ]
Version: head ] [ nightly ] [ GaudiDev ]
  Links to LXR source navigation pages for stable releases [ 12.*.* ]   [ 13.*.* ]   [ 14.*.* ] 

001 // ------------------------------------------------------------- 
002 // File:Herwig.cxx
003 // Generators/Herwig.cxx Description: Allows the user
004 // to generate Herwig events and store the result in the
005 // Transient Store.
006 //
007 // AuthorList:
008 // Ian Hinchliffe:  Initial Code October : 2000
009 // Modeled after the CDF code by Marge Shapriro and Jeremy Lys
010 // Modified for Version 6.4 Jan 2002-- Ian Hinchliffe
011 // AcerMC 1.x interface added by Borut Paul Kersevan (February 2003)
012 // TAUOLA/PHOTOS interface added by Borut Paul Kersevan (October 2003)
013 // Jimmy merged in by Jon Butterworth (Feb 2007)
014 // Removed lots, but not all, of the irrelevant CDF stuff (JMB, Nov 2008) 
015 // Header for this module:-
016 
017 #include "Herwig_i/Herwig.h"
018 #include "GeneratorModules/GeneratorName.h"
019 
020 // Framework Related Headers:-
021 #include "GaudiKernel/MsgStream.h"
022 
023 // Other classes used by this class:-
024 
025 #include "Herwig_i/herwig6510.h"
026 #include "Charybdis_i/CharybdisInterface.h"
027 #include "HepMC/IO_HERWIG.h"
028 #include "HepMC/IO_HEPEVT.h"
029 #include "HepMC/IO_Ascii.h"
030 #include "HepMC/HEPEVT_Wrapper.h"
031 #include "GeneratorUtils/StringParse.h"
032 #include <stdlib.h>
033 #include "CLHEP/Random/RandFlat.h"
034 #include "AthenaKernel/IAtRndmGenSvc.h"
035 #include "StoreGate/StoreGateSvc.h"
036 
037 //-------------------------------
038 
039 #define evtcon evtcon_
040 
041 extern struct
042 {
043   int istg;
044 } evtcon;
045 
046 // Pointer On AtRndmGenSvc
047 IAtRndmGenSvc*  p_AtRndmGenSvc;
048 namespace {
049   static std::string   herwig_stream   =       "HERWIG_INIT";
050 }
051 extern "C" double atl_hwrgen_( int* idummy )
052 {
053   CLHEP::HepRandomEngine* engine = p_AtRndmGenSvc->GetEngine(herwig_stream);
054   return CLHEP::RandFlat::shoot(engine);
055 }
056 
057 // calls to fortran routines
058 extern "C" double atl_phoran_( int* /*idummy*/ )
059 {
060   CLHEP::HepRandomEngine* engine = p_AtRndmGenSvc->GetEngine("PHOTOS");
061   return CLHEP::RandFlat::shoot(engine);
062 }
063 
064 extern "C" float atl_ranmar_()
065 {
066   CLHEP::HepRandomEngine* engine = p_AtRndmGenSvc->GetEngine("TAUOLA");
067   return (float) CLHEP::RandFlat::shoot(engine);
068 }
069 
070 void InitHerwigCommonBlocks();
071 
072 // calls to fortran routines
073 extern "C" {
074   //  void stdhepctb_();
075   // In Herwig_i  area:
076   void herwiginterface_(int* itopd);
077   //  void cdfreadsusy_(char* file,int *syunit);
078   void cdfreadsusy_(const char* ,int * , int);
079   //  In Herwig 
080   //susy
081   void hwissp_(int *syunit);
082 
083   // added for RPV 4-body decays
084   // Sebastian Fleischmann/JMB
085   void hwirpv_();
086   // NB: if the RPV code is not linked, a dummy version is called.
087     
088   void hwuinc_();
089   //  void hwusta(int *tstab);
090   //  void hwabeg_();
091   void hweini_();
092   void hwuine_();
093   void hwupro_();
094   void hwepro_();
095   void hwbgen_();
096   void hwdhob_();
097   void hwcfor_();
098   void hwcdec_();
099   void hwdhad_();
100   void hwdhvy_();
101   void hwmevt_();
102   void hwufne_(); 
103   void hwefin_();
104   void hwanal_(int *ihwcod);
105   void hwmsct_(int *abort);
106   void hwgpdg_(int *mconv);
107   void extproc_(int*);
108 
109   void upveto_(int*);
110 
111   void jminit_();
112   void jmefin_();
113 
114   //charybdis fix 
115   void charybdfix_();
116 
117   // PDF information
118   void hwpdfinfo_();
119   
120 }
121 //-----------------------------------
122 
123 using HepMC::IO_HERWIG;
124 using HepMC::IO_HEPEVT;
125 using HepMC::IO_Ascii;
126 
127 // File scope declarations:-
128 
129 // set pointer to zero at start
130 Atlas_HEPEVT*  Herwig::atlas_HEPEVT = new Atlas_HEPEVT();
131 
132 //--------------------------------------------------------------------------
133 Herwig::Herwig(const std::string& name, 
134                ISvcLocator* pSvcLocator): GenModule(name,pSvcLocator)
135 {
136   //--------------------------------------------------------------------------  
137   declareProperty("HerwigCommand", m_herwigCommandVector);
138 }
139 //--------------------------------------------------------------------------
140 Herwig::~Herwig(){
141   //--------------------------------------------------------------------------
142 }
143 //-------------------------------------------------------------
144 AcerMC_acset& Herwig::acermc_acset() {
145   return m_acermc_acset;
146 }
147 
148 //---------------------------------------------------------------------------
149 StatusCode Herwig::genInitialize() {
150   //---------------------------------------------------------------------------
151   // Initialise the listing output, parameter and decay data input streams
152   //
153   MsgStream log(messageService(), name());
154   log << MSG:: INFO << " HERWIG INITIALISING.  \n"  << endreq;
155   
156   static const bool CREATEIFNOTTHERE(true);
157   StatusCode RndmStatus = service("AtRndmGenSvc", p_AtRndmGenSvc, CREATEIFNOTTHERE);
158   if (!RndmStatus.isSuccess() || 0 == p_AtRndmGenSvc)
159     {
160       log << MSG::ERROR << " Could not initialize Random Number Service" << endreq;
161       return RndmStatus;
162     }   
163 
164   m_noshower_Parm=false;
165   m_nohadroniz_Parm=false;
166   // default is to shower and hadronize
167 
168   HepMC::HEPEVT_Wrapper::set_sizeof_int(sizeof(int));
169   HepMC::HEPEVT_Wrapper::set_sizeof_real(8);
170   HepMC::HEPEVT_Wrapper::set_max_number_entries(10000); 
171   // Map Herwig Common blocks to global C structures
172   InitHerwigCommonBlocks();
173 
174   // Default the top decay, beams and beam energies
175   gHwproc->pbeam1=7000.;  // beam energies
176   gHwproc->pbeam2=7000.;  // beam energies
177   m_itopd = 0;
178   strncpy(gHwbmch->part1,"P       ",8);
179   strncpy(gHwbmch->part2,"P       ",8);
180   // ALL other settings should be given after the call to hwigin (in herwiginterface)
181 
182   // Special loop over the input parameters to load iproc, beam type and beam energy 
183   // before the call to herwiginterface_()
184   CommandVector::const_iterator ic              =       m_herwigCommandVector.begin();
185   do {
186     StringParse mystring(*ic);
187     string myvar=mystring.piece(1);
188     int myint1=mystring.intpiece(2);
189     double  myfl1=mystring.numpiece(2);
190     string myvar2 = mystring.piece(2);
191     myvar2.resize(8,' ');
192 
193     if(myvar=="iproc") {
194       gHwproc->iproc             =       myint1;
195     } 
196     else if(myvar=="beam1energy") {
197       gHwproc->pbeam1             =       myfl1;
198     }
199     else if(myvar=="beam2energy") {
200       gHwproc->pbeam2             =       myfl1;
201     }
202     else if(myvar=="topdec") {
203       m_itopd             =       myint1;
204     }
205     else if(myvar=="beam1type") {
206       strncpy(gHwbmch->part1,myvar2.c_str(),8);      
207    }
208     else if(myvar=="beam2type") {
209       strncpy(gHwbmch->part2,myvar2.c_str(),8);      
210     }
211     ic++;
212   } while (ic != m_herwigCommandVector.end());
213 
214   
215   // Call Fortran Routine to Initialize Herwig Common Block
216   herwiginterface_(&m_itopd);
217 
218   // set timeout and maximum number of errors to sensibe defaults
219   gHwevnt->maxer = 10000000;
220   gHwevnt->tlout = -10000000.0;
221 
222 
223   m_ExternalProcess = 0;
224 
225   // No hardcoded defaults here!! 
226   //
227   // Anything different from generator default should
228   // be set in job options.
229 
230   //now read in all the parameter changes from the user
231   for (size_t i = 0; i < m_herwigCommandVector.size(); i++) {
232     log << MSG:: INFO  << " Command is: " << m_herwigCommandVector[i] << endreq;
233     StringParse mystring(m_herwigCommandVector[i]);
234     string myvar=mystring.piece(1);
235     string myvar1=mystring.piece(2);
236     int myint1=mystring.intpiece(2);
237     int myint2=mystring.intpiece(3);
238     double  myfl1=mystring.numpiece(2);
239     double  myfl2=mystring.numpiece(3);
240     if (  myvar== "beam1type" || myvar== "beam2type" || myvar== "beam1energy" ||
241           myvar== "beam2energy") { 
242       // Beam types and energy already done.
243     }
244     // process number for external processes set here.
245     else if(myvar=="iproc"){
246       if (myvar1 == "charybdis") {
247         gHwproc->iproc=-200;
248         m_ExternalProcess = CHARYBDIS;
249       } else if (myvar1 == "acermc") {
250         gHwproc->iproc=-600;
251         m_ExternalProcess = ACERMC;
252       } else if(myvar1 == "alpgen") {
253         gHwproc->iproc=-1400;
254         m_ExternalProcess = ALPGEN;
255         if (myint2 > 0) {
256           gHwproc->iproc-=myint2;
257         }
258       } else if (myvar1 == "madgraph") {
259         gHwproc->iproc=-950;
260         m_ExternalProcess = MADGRAPH;
261       } else if (myvar1 == "madcup") {
262         gHwproc->iproc=-800;
263         m_ExternalProcess = MADCUP;
264       } else if(myvar1 == "lhaext") {
265         gHwproc->iproc=-900;
266         m_ExternalProcess = LHAEXT;
267       } else if (myvar1 == "mcatnlo") {
268         gHwproc->iproc=-700;
269         m_ExternalProcess = MCATNLO;
270       } else if (myvar1 == "lhef") {
271         gHwproc->iproc=-100;
272         m_ExternalProcess = LHEF;
273       } else if (myvar1 == "horace") {
274         gHwproc->iproc=-300;
275         m_ExternalProcess = HORACE;
276       } else {gHwproc->iproc=myint1;}
277       extproc_(&m_ExternalProcess);
278     }
279     // AcerMC tt~ decay mode switching
280     else if(myvar=="acset12") {
281       if (gHwproc->iproc==-600) {
282         this->acermc_acset().acset12()=myint1;
283       }
284     }
285 
286     // ------- HWHARD common block
287     // kinematic limits    
288     else if(myvar=="ptmin"){gHwhard->ptmin=myfl1;}
289     else if(myvar=="ptmax"){gHwhard->ptmax=myfl1;}
290     else if(myvar=="emmin"){gHwhard->emmin=myfl1;}
291     else if(myvar=="emmax"){gHwhard->emmax=myfl1;}
292     else if(myvar=="q2min"){gHwhard->q2min=myfl1;}
293 
294     // ------- HWDIST common block
295     else if(myvar=="pltcut"){ gHwdist->pltcut=myfl1;}
296     else if(myvar=="mixing"){ gHwdist->mixing=myint1;}
297 
298     // -------  HWPRAM common block
299     else if (myvar=="ispac") { gHwpram->ispac=myint1;}
300     else if (myvar=="qspac") { gHwpram->qspac=myfl1;}
301 
302     else if(myvar=="azsoft"){
303       if(myvar1=="false"){
304         gHwpram->azsoft=false;
305       } else { 
306         gHwpram->azsoft=true;
307       }
308     }
309     else if(myvar=="azspin"){
310       if(myvar1=="false"){
311         gHwpram->azspin=false;
312       } else { 
313         gHwpram->azspin=true;
314       }
315     }
316     else if(myvar=="nospac"){
317       if(myvar1=="false"){
318         gHwpram->nospac=false;
319       } else { 
320         gHwpram->nospac=true;
321       }
322     }
323     else if(myvar=="hardme"){
324       if(myvar1=="false"){
325         gHwpram->hardme=false;
326       } else { 
327         gHwpram->hardme=true;
328       }
329     }
330     else if(myvar=="softme"){
331       if(myvar1=="false"){
332         gHwpram->softme=false;
333       } else { 
334         gHwpram->softme=true;
335       }
336     }
337 
338 
339 
340     // weak paramters and widths
341     else if (myvar=="ncolo") { gHwpram->ncolo=myint1;}
342     else if (myvar=="nflav") { gHwpram->nflav=myint1;}
343     else if (myvar=="swein") { gHwpram->swein=myfl1;}
344     else if (myvar=="scabi") { gHwpram->scabi=myfl1;}
345 
346     // print options
347     else if (myvar=="prvtx"){ gHwpram->prvtx=myint1;}
348     else if (myvar=="prndef"){ gHwpram->prndef=myint1;}
349     else if (myvar=="prntex"){ gHwpram->prntex=myint1;}
350     else if (myvar=="prnweb"){ gHwpram->prnweb=myint1;}
351     else if (myvar=="nprfmt"){ gHwpram->nprfmt=myint1;}
352     else if (myvar=="iprint"){ gHwpram->iprint=myint1;}
353 
354     else if (myvar=="gamh") { gHwpram->gamh=myfl1;}
355     else if (myvar=="gamw") { gHwpram->gamw=myfl1;}
356     else if (myvar=="gamz") { gHwpram->gamz=myfl1;}
357     // Zprime width 
358     else if(myvar=="gamzp"){ gHwpram->gamzp=myfl1;}
359 
360 
361     else if(myvar=="zprime"){
362       if(myvar1=="false"){
363         gHwpram->zprime=false;
364       } else { 
365         gHwpram->zprime=true;
366       }
367     }
368 
369     else if (myvar=="effmin") { gHwpram->effmin=myfl1;}
370     else if (myvar=="psplt") { 
371       gHwpram->psplt[0]=myfl1;
372       gHwpram->psplt[1]=myfl2;
373     }
374     else if (myvar=="cldir") { 
375       gHwpram->cldir[0]=myint1;
376       gHwpram->cldir[1]=myint2;
377     }
378     else if (myvar=="clsmr") { 
379       gHwpram->clsmr[0]=myfl1;
380       gHwpram->clsmr[1]=myfl2;
381     }
382     else if (myvar=="ensof") { gHwpram->ensof=myfl1;}
383     else if (myvar=="qcdlam"){ gHwpram->qcdlam=myfl1;}
384     else if (myvar=="clpow") { gHwpram->clpow=myfl1;}
385     else if (myvar=="prsof") { gHwpram->prsof=myfl1;}
386     else if (myvar=="ptrms") { gHwpram->ptrms=myfl1;}
387     else if (myvar=="vgcut") { gHwpram->vgcut=myfl1;}
388     else if (myvar=="vqcut") { gHwpram->vqcut=myfl1;}
389     else if (myvar=="vpcut") { gHwpram->vpcut=myfl1;}
390     // allow user to set different PDF for each beam. Might
391     // be need for none LHC runs or photoproduction
392     else if(myvar=="modpdf1"){ gHwpram->modpdf[0]=myint1;}
393     else if(myvar=="modpdf2"){ gHwpram->modpdf[1]=myint1;}
394     // if beam id not specified, assume both are the same PDF.
395     else if(myvar=="modpdf"){ 
396       gHwpram->modpdf[0]=myint1;
397       gHwpram->modpdf[1]=myint1;
398     }
399 
400     // HWPRCH common block
401     else if(myvar=="autpdf"){
402       string autlocal = myvar1;
403       int nch = (autlocal.size()<20) ? autlocal.size() : 19;  
404       for(int i=0; i<20; i++) {
405         if(i<nch) {
406           gHwprch->autpdf[0][i] = autlocal.data()[i];
407           gHwprch->autpdf[1][i] = autlocal.data()[i];
408         }    else {
409           gHwprch->autpdf[0][i] = ' ';
410           gHwprch->autpdf[1][i] = ' ';
411         }
412       }
413     }
414 
415     // output control and random numbers
416     else if(myvar=="maxer"){gHwevnt->maxer=myint1;}
417     else if(myvar=="maxpr"){gHwevnt->maxpr=myint1;}
418 
419     else if(myvar=="nrn"){
420       if(myint1==1){gHwevnt ->nrn[0]=myint2;}
421       else if(myint1==2){ gHwevnt->nrn[1]=myint2;}
422     }
423     else if(myvar=="nowgt"){
424       if(myvar1=="false"){gHwevnt->nowgt=false;}
425     }
426     else if(myvar=="wgtmax"){gHwevnt->wgtmax=myfl1;}
427     else if(myvar=="tlout"){gHwevnt->tlout=myfl1;}
428 
429     // particle masses
430     else if(myvar=="rmass"){
431       if (myint1>0 && myint1<501){
432         gHwprop->rmass[myint1]=myfl2;
433       }
434     }
435 
436     // particle stability
437     else if(myvar=="rstab"){
438       if (myint1>0 && myint1<501){
439         gHwupdt->rstab[myint1]=myint2;
440       }
441     }
442 
443     // boson decay modes
444     else if(myvar=="modbos") {
445       if(myint1>0 && myint1<10) {
446         gHwbosc->modbos[myint1-1]=myint2;
447       }
448     }
449 
450     // susy filename 
451     else if(myvar=="susyfile"){m_read_Filesusy=myvar1;}
452 
453 
454     // version 6.3 
455     // graviton stuff
456 
457     else if(myvar=="grvlam"){gHwgrav->grvlam=myfl1;}
458     else if(myvar=="emgrv") {gHwgrav ->emgrv=myfl1;}
459     else if(myvar=="gamgrv"){gHwgrav ->gamgrv=myfl1;}
460 
461     // version 6.506 stuff
462     else if(myvar=="pdfx0"){gHw6506->pdfx0=myfl1;}
463     else if(myvar=="pdfpow"){gHw6506->pdfpow=myfl1;}
464 
465     // version 6.510 stuff
466     else if(myvar=="ndetry"){m_ndetry=myint1;}
467 
468     // tauola switch
469     else if(myvar=="taudec"){
470       int nch = (myvar1.size()<7) ? myvar1.size() : 6;
471       for(int i=0; i<6; i++) {
472         if(i<nch) {
473           gHwdspn->taudec[i] = myvar1.data()[i];
474         }
475       }
476     }
477 
478     // Spin correlations menu
479     else if(myvar=="syspin"){gHwdspn->syspin=myint1;}
480     else if(myvar=="spcopt"){gHwspin->spcopt=myint1;}
481 
482     // Jimmy common blocks
483     else if(myvar=="msflag"){gJmparm->msflag=myint1;}
484 
485     else if(myvar=="jmbug") {gJmparm->jmbug=myint1;}
486     else if(myvar=="ptjim") {gJmparm->ptjim=(double)myfl1;}
487     else if(myvar=="jmueo") {gJmparm->jmueo=myint1;}
488     else if(myvar=="jmrad"){
489       if (myint1 > 0 && myint1 < 264) { gJmparm->jmrad[myint1-1] = myfl2; }
490       else {  log << MSG:: ERROR << " JMRAD ARRAY HAS ONLY 264 elements [1 to 264]" << endreq; }
491     } 
492     
493     // Charybdis Parameters - added by nick brett - 04-02-05
494     else if(myvar=="charyb"){::WriteCharybdisParam(myint1,myint2,(double)myfl2);}
495     
496     // Colour singlet exchange parameters - added by James Monk 25.Apr.2008
497     else if(myvar =="asfixd"){gHwhard ->asfixd=myfl1;}
498     else if(myvar =="omega0"){gHwhard ->omega0=myfl1;}
499 
500     else {
501       if (myvar!="topdec") log << MSG::WARNING << " ERROR in HERWIG PARAMETERS   " << myvar << " is not a variable name that I recognize. it could be a typo on your part or a mistake on mine. Not all variables are changeable" << endreq;
502     }
503   }
504 
505   // Save the HERWIG_INIT stream seeds....
506   CLHEP::HepRandomEngine* engine = p_AtRndmGenSvc->GetEngine(herwig_stream);
507   const long*   sip     =       engine->getSeeds();
508   long  int     si1     =       sip[0];
509   long  int     si2     =       sip[1];
510 
511   // Special settings for Alpgen
512   if ( m_ExternalProcess == ALPGEN ) gHwevnt->maxpr=4;
513 
514   // now for susy
515   if((gHwproc->iproc >= 3000 && gHwproc->iproc < 5000) || (gHwproc->iproc >= 13000 && gHwproc->iproc < 15000)){
516     int syunit = 66;
517     ////    cdfreadsusy_(const_cast<char*>(_read_Filesusy.value().c_str()),&syunit); 
518     const string& fileName = m_read_Filesusy; 
519     cdfreadsusy_(fileName.c_str(),&syunit,fileName.size()); 
520     hwissp_(&syunit);
521   }     
522   
523   // added for RPV 4-body decays
524   // Sebastian Fleischmann/JMB
525   hwirpv_();
526   // NB: if the RPV code is not linked, a dummy version is called.
527 
528   hwuinc_(); // calculate herwig constants
529   hweini_(); // initialise herwig event.
530   jminit_(); // initialise jimmy event.
531 
532   
533   // ... and set them back to the stream for proper save
534   p_AtRndmGenSvc->CreateStream(si1, si2, herwig_stream);
535   herwig_stream = "HERWIG";
536 
537   return StatusCode::SUCCESS;
538 }
539 
540 //---------------------------------------------------------------------------
541 StatusCode Herwig::callGenerator() {
542   //---------------------------------------------------------------------------
543   MsgStream log(messageService(), name());
544   log << MSG::DEBUG << " HERWIG generating.  \n"  << endreq;
545 
546   bool goodev = false;
547   int abort = 1;
548 
549   // Save the random number seeds in the event
550   CLHEP::HepRandomEngine*       engine  =       p_AtRndmGenSvc->GetEngine(herwig_stream);
551   const long*           s       =       engine->getSeeds();
552   m_seeds.clear();
553   m_seeds.push_back(s[0]);
554   m_seeds.push_back(s[1]);
555 
556   while(!goodev && abort==1){
557     hwuine_();  // Initialize event
558     if ( m_ExternalProcess == ALPGEN) {
559       log << MSG::DEBUG << " HERWIG/ALPGEN  \n"  << endreq;
560       hwepro_();
561       // Store info for PDFInfo
562       hwpdfinfo_();
563 
564       // matching-driven veto
565       int ipveto = 0;
566       upveto_(&ipveto);
567       if(ipveto != 0) {
568         gHwevnt->ierror = -1;
569         log << MSG::INFO << " EVENT KILLED BY UPVETO. EXECUTION CONTINUES" << endreq;
570       }
571 
572       
573       if (evtcon.istg <= 0) {
574         hwbgen_();  // Generate parton cascade
575         // Do Jimmy underlying event if required.
576         abort = 0;
577         if (gJmparm->msflag == 1) { hwmsct_(&abort); }
578         if (abort == 0) {
579           hwdhob_();  // Do heavy quark decays 
580           hwcfor_();  // Do cluster formation
581           hwcdec_();  // Do cluster decays
582           hwdhad_();  // Do unstable particle decays
583           hwdhvy_();  // Do heavy flavor decays
584           hwmevt_();  // Add soft underlying event
585         }
586       }
587     } else {
588       hwepro_();  // Generate Hard Process      
589       // Store info for PDFInfo
590       hwpdfinfo_();
591 
592       if (gHwproc->iproc == -200 ) {
593         charybdfix_(); //reset hard cms code to BH=40
594       }
595       if ( evtcon.istg <= 0 ) {
596         if(! m_noshower_Parm) {
597           hwbgen_();  // Generate parton cascade
598           abort = 0;
599           if (gJmparm->msflag == 1) { hwmsct_(&abort); }
600           if (abort == 0) {
601             hwdhob_();  // Do heavy quark decays 
602             if(! m_nohadroniz_Parm) {
603               hwcfor_();  // Do cluster formation
604               hwcdec_();  // Do cluster decays
605               hwdhad_();  // Do unstable particle decays
606               hwdhvy_();  // Do heavy flavor decays
607               hwmevt_();  // Add soft underlying event
608             }
609           }
610         }
611       }
612     } 
613     // User event analysis if wanted
614     if ( evtcon.istg > 0 ) {
615       std::cout << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << std::endl;
616       std::cout << "!! " << generator_name(m_ExternalProcess) << " TERMINATES NORMALLY: NO MORE EVENTS IN FILE !!!" << std::endl;
617       std::cout << "!! PLEASE IGNORE ANY ATHENA ERROR MESSAGES LIKE                              !!" << std::endl;
618       std::cout << "!! AthenaEventLoopMgr  ERROR Terminating event processing loop due to errors !!" << std::endl;
619       std::cout << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << std::endl;
620       return StatusCode::FAILURE;
621     }
622     
623     if (abort == 0) {
624       hwufne_();  // Finish event
625       
626       int ihwcod = 1;
627       hwanal_(&ihwcod);
628       if(gHwevnt->ierror == 0){
629         goodev=true;
630       } else { //modified by T.Sasaki
631         goodev=false; //explicit , not necessary;
632         abort=1; //for loop again
633       }
634     }
635   }
636 
637   return StatusCode::SUCCESS;  
638   log << MSG::DEBUG << " HERWIG generating done.  \n"  << endreq;
639 }
640 
641 //---------------------------------------------------------------------------
642 StatusCode Herwig::genFinalize() {
643   //---------------------------------------------------------------------------
644   MsgStream log(messageService(), name());
645   log << MSG:: INFO << " HERWIG Ending.  \n"  << endreq;
646   // Don't call this again for AlpGen
647   if ( m_ExternalProcess != ALPGEN ) {
648     // Don't do this for ALPGEN.
649     log << MSG::INFO <<"Call HWEFIN and HWAEND at endRun" << endreq;
650     hwefin_();
651   }
652   if (gJmparm->msflag == 1) { jmefin_(); }
653   // User terminal calculations if wanted
654   std::cout << "MetaData: cross-section (nb)= " << gHwevnt->avwgt << std::endl;
655   // hwaend_();
656   return StatusCode::SUCCESS;
657 }
658 //---------------------------------------------------------------------------
659 StatusCode Herwig::fillEvt(GenEvent* evt) {
660   //---------------------------------------------------------------------------
661   MsgStream log(messageService(), name());
662 
663   log << MSG::DEBUG << " HERWIG Atlas_HEPEVT Filling.  \n"  << endreq;
664   store_Atlas_HEPEVT();
665 
666   log << MSG::DEBUG << " HERWIG Filling.  \n"  << endreq;
667   HepMC::IO_HERWIG hepio;
668   //  hepio.set_trust_mothers_before_daughters(0);
669   //hepio.set_print_inconsistency_errors(0);
670   //HepMC::HEPEVT_Wrapper::check_hepevt_consistency(); 
671   //HepMC::IO_Ascii output("dump.dat",ios::out);
672   //  int i = 1;
673   // Fill event into HepMC and transient store
674   hepio.fill_next_event(evt);
675   int pr_id = HERWIG + m_ExternalProcess + gHwproc->iproc;
676   if (gHwproc->iproc < 0) pr_id = HERWIG + m_ExternalProcess;
677   string taustring;
678   taustring.assign(gHwdspn->taudec,6);
679   if ( taustring == "TAUOLA") pr_id += TAUOLA_PHOTOS;
680   evt->set_signal_process_id(pr_id);
681   evt->set_random_states(m_seeds);
682 
683   int id1=gHrwpdf->id1;
684   int id2=gHrwpdf->id2;
685   double x1=gHrwpdf->x1;
686   double x2=gHrwpdf->x2;
687   double q=gHrwpdf->q;
688   double pdf1=gHrwpdf->idpdf1;
689   double pdf2=gHrwpdf->idpdf2;
690   HepMC::PdfInfo tmp_pdi(id1,id2,x1,x2,q,pdf1,pdf2);
691   evt->set_pdf_info(tmp_pdi);
692   /*
693   std::cout << "pdfinfo:"<<  evt->pdf_info()->id1() << std::endl;
694   std::cout << "pdfinfo:"<<  evt->pdf_info()->id2() << std::endl;
695   std::cout << "pdfinfo:"<<  evt->pdf_info()->x1() << std::endl;
696   std::cout << "pdfinfo:"<<  evt->pdf_info()->x2() << std::endl;
697   std::cout << "pdfinfo:"<<  evt->pdf_info()->scalePDF() << std::endl;
698   std::cout << "pdfinfo:"<<  (int)evt->pdf_info()->pdf1() << std::endl;
699   std::cout << "pdfinfo:"<<  (int)evt->pdf_info()->pdf2() << std::endl; 
700   */
701 
702   if (gHwevnt->evwgt < 0.) evt->weights().push_back(-1.);
703   if (gHwevnt->evwgt > 0.) evt->weights().push_back(1.);
704   if (gHwevnt->evwgt == 0.) log << MSG::WARNING << " EVENT WEIGHT = 0 !!!!!! \n" << endreq;
705   //  cout << " ----------------- Print evt " << endl;
706   //    evt -> print();
707   //  cout << " ----------------- END " << endl;
708   
709   //  output << evt;
710   
711   // Convert cm->mm and GeV->MeV
712   //   cmTomm(evt);
713   GeVToMeV(evt);
714   
715   return StatusCode::SUCCESS;
716 }
717 
718 
719 void
720 Herwig::store_Atlas_HEPEVT(void)
721 {
722   MsgStream log(messageService(), name());
723 
724   // std::cout << "atlas_HEPEVT------" << atlas_HEPEVT->nhep()  << std::endl;
725   //std::cout << "atlas_HEPEVT------" << atlas_HEPEVT->isthep(10)  << std::endl;
726   //std::cout << "atlas_HEPEVT------" << atlas_HEPEVT->idhep(10)  << std::endl;
727   //std::cout << "atlas_HEPEVT------" << atlas_HEPEVT->jmohep(1,10)  << std::endl;
728   //std::cout << "atlas_HEPEVT------" << atlas_HEPEVT->jdahep(2,10)  << std::endl;
729 
730   atlas_HEPEVT->fill();
731 
732   Atlas_HEPEVT* Ahep = new Atlas_HEPEVT();
733   *(Ahep)=*(atlas_HEPEVT);
734   std::string keyid = "Herwig";
735   StatusCode sc = m_sgSvc->record(Ahep, keyid);
736   if (!sc.isSuccess()) log << MSG::WARNING << " Could not record Atlas_HEPEVT" << endreq;
737 
738 }

source navigation ] diff markup ] identifier search ] general search ]

Due to the LXR bug, the updates fail sometimes to remove references to deleted files. The Saturday's full rebuilds fix these problems
This page was automatically generated by the LXR engine. Valid HTML 4.01!