ATLAS Offline Software
Loading...
Searching...
No Matches
mergeIDTPM.py
Go to the documentation of this file.
1#!/usr/bin/env python
2# Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3
5 from argparse import ArgumentParser
6 myparser = ArgumentParser( description='Parser for IDTPM merger' )
7 myparser.add_argument( "-i", "--inputFileNames", help="List (comma- or space-separated) of input files. Regex is allowed.", nargs='+', required=True )
8 myparser.add_argument( "-o", "--outputFileName", help="Output file name", default='IDTPM.output.root' )
9 myparser.add_argument( "-s", "--saveNonPostProcessed", help="Enable debugging messages", action="store_true", default=False )
10 myparser.add_argument( "-m", "--method", help="Method for recomputing resolutions", choices=['iterRMS', 'gaussFit', 'iterRMSgaussFit', 'iterGaussFit', 'None'], default='iterRMS' )
11 return myparser.parse_known_args()
12
13
14MyArgs, otherHaddArgs = GetCustomAthArgs()
15
16
17from glob import glob
18InputFiles = []
19for paths in MyArgs.inputFileNames :
20 for path in paths.split(',') :
21 InputFiles += glob( path )
22
23import subprocess
24
25cmd_1 = [ 'hadd', '-f', MyArgs.outputFileName ] + InputFiles
26if otherHaddArgs :
27 cmd_1.insert( 1, ' '.join( otherHaddArgs ) )
28print( "Running: "+(' '.join( cmd_1 )) )
29subprocess.run( cmd_1, check=True )
30
31
32if MyArgs.saveNonPostProcessed :
33 cmd_1a = [ 'cp', MyArgs.outputFileName,
34 MyArgs.outputFileName.replace( ".root", "_nonPP.root" ) ]
35 print( "Running: "+(' '.join( cmd_1a )) )
36 subprocess.run( cmd_1a, check=True )
37
38
39if MyArgs.method != 'None' :
40 cmd_2 = [ 'postProcessIDTPMHistos', MyArgs.outputFileName, MyArgs.method ]
41 print( "Running: "+(' '.join( cmd_2 )) )
42 subprocess.run( cmd_2, check=True )
void print(char *figname, TCanvas *c1)
GetCustomAthArgs()
Definition mergeIDTPM.py:4