Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:12:45

0001 void generate_hepmc_bjet(
0002         int flavor = -1,
0003         char *output = "",
0004         int nevents = 100
0005         )
0006 {
0007     //gSystem->Load("libfun4all.so");   // framework + reco modules
0008     //gSystem->Load("libPHPythiaEventGen.so");
0009     //gSystem->Load("libPHPythiaJet.so");
0010     //gSystem->Load("libPHJetBackgroundSubtract.so");
0011     //gSystem->Load("libHFJetAnalyzer.so");
0012     //gSystem->Load("libPythiaDumper.so");
0013     //gSystem->Load("libPHDetectorResponse.so");
0014     //gSystem->Load("libPHPythia.so");
0015     //gSystem->Load("libPHPyTrigger.so");       // For PHPyTrigger derived classes
0016     //gSystem->Load("libPHPyParticleSelect.so");    // For PHPyParticleSelect derived classes
0017     //gSystem->Load("libsimreco.so");   // framework + reco modules
0018 
0019     gSystem->Load("libPHPythia8.so");
0020     gSystem->Load("libfun4all.so");
0021     gSystem->Load("libphhepmc.so");
0022 
0023     recoConsts *rc = recoConsts::instance();
0024     rc->set_IntFlag("RUNNUMBER",0);
0025 
0026     /////////////////////////////////////////////////////////////////
0027     //  Server...
0028     Fun4AllServer *se = Fun4AllServer::instance();
0029 
0030     /////////////////////////////////////////////////////////////////
0031     //  Reconstruction Modules...
0032 
0033     //SubsysReco *sync = new SyncSimreco();
0034     //se->registerSubsystem(sync);
0035 
0036     PHPy8JetTrigger *theTrigger = new PHPy8JetTrigger();
0037     //theTrigger->Verbosity(10);
0038     theTrigger->SetEtaHighLow(-1, 1);
0039     theTrigger->SetJetR(.4);
0040     theTrigger->SetMinJetPt(20);
0041 
0042     PHPythia8* pythia8 = new PHPythia8();
0043     // see coresoftware/generators/PHPythia8 for example config
0044     if (flavor == 0) pythia8->set_config_file("phpythia8_ljet.cfg"); 
0045     if (flavor == 1) pythia8->set_config_file("phpythia8_cjet.cfg"); 
0046     if (flavor == 2) pythia8->set_config_file("phpythia8_bjet.cfg"); 
0047     pythia8->register_trigger(theTrigger);
0048     se->registerSubsystem(pythia8);
0049 
0050 
0051     //PHPythia *phpythia = new PHPythia();
0052     //phpythia->ReadConfig(  phpythiaconfig );  
0053     //se->registerSubsystem(phpythia);
0054 
0055     //PHPyJetParticleAcceptor *inpythia = new PHPyJetParticleAcceptInPerfect(3.0);
0056     //PHJetTowerAcceptor *inupgrade = new PHJetTowerAcceptInDetector(2.0);
0057 
0058     //PHPyJetMaker *PythiaJets_Antikt04 = new PHPyJetMaker("anti-kt",0.4,"PythiaJets_Antikt04",inpythia,"PHPythia");
0059     //PythiaJets_Antikt02->SetPtCut(10.0);
0060     //se->registerSubsystem(PythiaJets_Antikt04);
0061 
0062     //PythiaDumper *hfjt = new PythiaDumper();
0063     //se->registerSubsystem( hfjt );
0064     /*
0065          PHMakeTowers *pythiatowermaker = new PHMakeTowers("PythiaTowerMaker","PHPythia","","PythiaTowers");
0066     //pythiatowermaker->SetResolutionParameters(0,0,ecal_sqrte,0);
0067     //pythiatowermaker->SetResolutionParameters(1,hcal_const,hcal_sqrte,hcal_e);
0068     se->registerSubsystem(pythiatowermaker);
0069 
0070     PHTowerJetMaker *pythiatowerreco2 = new PHTowerJetMaker("anti-kt",0.2,"PythiaTowerJets_Antikt02",inupgrade,"PythiaTowers");
0071     //pythiatowerreco2->Verbosity(verbosity+2);
0072     pythiatowerreco2->SetPtCut(10.0);
0073     se->registerSubsystem(pythiatowerreco2);
0074     */
0075 
0076 
0077     //** You can force the generated particles to use a vertex read from a file,
0078     //** in place of the default (z=0) value
0079     //** this is needed for instance when you want to have matching vertices between 
0080     //** different types of simulated files, prior to sending that to PISA
0081     // se->registerSubsystem( new PHPyVertexShift( "PHPyVertexShift", "./events.txt") );
0082 
0083     //** You can use dedicated triggers, derived from the PHPyTrigger base class
0084     // se->registerSubsystem( new PHPyJPsiMuonTrigger() );
0085 
0086     //** You can select only particular particles to write out
0087     //PHPyParticleSelect *pselect = new PHPyParticleSelect();
0088     //se->registerSubsystem( pselect );
0089 
0090     //** A dummy (null) input is needed for the Fun4All framework
0091     Fun4AllDummyInputManager *in1 = new Fun4AllDummyInputManager("DSTin1", "DST");
0092     se->registerInputManager(in1);
0093 
0094 
0095     // DST output manager
0096     Fun4AllDstOutputManager *dst_output_mgr  = new Fun4AllDstOutputManager("PHPYTHIA", "temp.root" );
0097     dst_output_mgr->AddNode("Sync");
0098     dst_output_mgr->AddNode("PHPythiaHeader");
0099     dst_output_mgr->AddNode("PHPythia");
0100 
0101     Fun4AllHepMCOutputManager *hepmc;
0102     hepmc = new Fun4AllHepMCOutputManager("HEPMCOUT", output );
0103     /*
0104          if (flavor == 0) hepmc = new Fun4AllHepMCOutputManager("HEPMCOUT", "output/hepmc_ljet_10k.txt" );
0105          if (flavor == 1) hepmc = new Fun4AllHepMCOutputManager("HEPMCOUT", "output/hepmc_cjet_10k.txt" );
0106          if (flavor == 2) hepmc = new Fun4AllHepMCOutputManager("HEPMCOUT", "output/hepmc_bjet_10k.txt" );
0107          */
0108     se->registerOutputManager( hepmc );
0109 
0110     //dst_output_mgr->AddNode("PythiaTowers");
0111     //dst_output_mgr->AddNode("PythiaJets_Antikt04");
0112     //dst_output_mgr->AddNode("PythiaTowerJets_Antikt02");
0113 
0114     //  se->registerOutputManager(dst_output_mgr);
0115 
0116     // OSCAR output manager
0117     // with following output manager, one can write the PHPythia output in an oscar formated output text file
0118     // PHPyOscarOutputManager *oscar_manager  = new PHPyOscarOutputManager( "OSCAR", oscar_outputname );
0119     // se->registerOutputManager(oscar_manager);
0120 
0121     // run over all events
0122     se->run( nevents );  
0123     se->End();
0124 }
0125