CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Private Attributes
mergeLHE.ExternalCppLHEMerger Class Reference
Inheritance diagram for mergeLHE.ExternalCppLHEMerger:
mergeLHE.BaseLHEMerger

Public Member Functions

def __init__
 
def merge
 
- Public Member Functions inherited from mergeLHE.BaseLHEMerger
def __init__
 
def merge
 

Private Attributes

 _merger_script_url
 

Additional Inherited Members

- Public Attributes inherited from mergeLHE.BaseLHEMerger
 input_files
 
 output_file
 

Detailed Description

Use the external mergeLheFiles.cpp file to merge LHE files, as introduced in
https://twiki.cern.ch/twiki/bin/view/CMSPublic/SWGuideSubgroupMC#1_2_Using_pLHE_campaigns

Definition at line 299 of file mergeLHE.py.

Constructor & Destructor Documentation

def mergeLHE.ExternalCppLHEMerger.__init__ (   self,
  input_files,
  output_file,
  kwargs 
)

Definition at line 304 of file mergeLHE.py.

305  def __init__(self, input_files, output_file, **kwargs):
306  super(ExternalCppLHEMerger, self).__init__(input_files, output_file)
307  self._merger_script_url = \
308  'https://twiki.cern.ch/twiki/bin/viewfile/CMSPublic/SWGuideSubgroupMC?filename=mergeLheFiles.cpp;rev=2'

Member Function Documentation

def mergeLHE.ExternalCppLHEMerger.merge (   self)

Definition at line 309 of file mergeLHE.py.

References mergeLHE.MG5LOLHEMerger._merger_script_url, mergeLHE.ExternalCppLHEMerger._merger_script_url, mergeLHE.BaseLHEMerger.input_files, DTWorkflow.DTWorkflow.input_files, join(), mergeLHE.BaseLHEMerger.output_file, DTT0WireWorkflow.DTT0WireWorkflow.output_file, DTVdriftWorkflow.DTvdriftWorkflow.output_file, and DTTtrigWorkflow.DTttrigWorkflow.output_file.

310  def merge(self):
311  logging.info(
312  ('Use the external mergeLheFiles.cpp file to merge LHE files.'))
313  os.system('curl -s -o mergeLheFiles.cpp %s' % self._merger_script_url)
314  with open('mergeLheFiles.cpp') as f:
315  script_str = f.read()
316  with open('mergeLheFiles.cpp', 'w') as fw:
317  fw.write(script_str.replace('/tmp/covarell/out.lhe', self.output_file))
318  with open('input_files.txt', 'w') as fw:
319  fw.write('\n'.join(self.input_files) + '\n')
320 
321  os.system('g++ -Wall -o mergeLheFiles mergeLheFiles.cpp')
322  os.system('./mergeLheFiles input_files.txt')
323  os.system('rm mergeLheFiles* input_files.txt')
324 
static std::string join(char **cmd)
Definition: RemoteFile.cc:19

Member Data Documentation

mergeLHE.ExternalCppLHEMerger._merger_script_url
private

Definition at line 306 of file mergeLHE.py.

Referenced by mergeLHE.ExternalCppLHEMerger.merge().