CMS 3D CMS Logo

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__ (self, input_files, output_file, **kwargs)
 
def merge (self)
 
- Public Member Functions inherited from mergeLHE.BaseLHEMerger
def __init__ (self, input_files, output_file)
 

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

◆ __init__()

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

Definition at line 304 of file mergeLHE.py.

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

Member Function Documentation

◆ merge()

def mergeLHE.ExternalCppLHEMerger.merge (   self)
Output the merged LHE

Reimplemented from mergeLHE.BaseLHEMerger.

Definition at line 309 of file mergeLHE.py.

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

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.

Member Data Documentation

◆ _merger_script_url

mergeLHE.ExternalCppLHEMerger._merger_script_url
private

Definition at line 306 of file mergeLHE.py.

Referenced by mergeLHE.ExternalCppLHEMerger.merge().

join
static std::string join(char **cmd)
Definition: RemoteFile.cc:17
MatrixUtil.merge
def merge(dictlist, TELL=False)
Definition: MatrixUtil.py:201