ATLAS Offline Software
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 
14 MyArgs, otherHaddArgs = GetCustomAthArgs()
15 
16 
17 from glob import glob
18 InputFiles = []
19 for paths in MyArgs.inputFileNames :
20  for path in paths.split(',') :
21  InputFiles += glob( path )
22 
23 import subprocess
24 
25 cmd_1 = [ 'hadd', '-f', MyArgs.outputFileName ] + InputFiles
26 if otherHaddArgs :
27  cmd_1.insert( 1, ' '.join( otherHaddArgs ) )
28 print( "Running: "+(' '.join( cmd_1 )) )
29 subprocess.run( cmd_1, check=True )
30 
31 
32 if 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 
39 if MyArgs.method != 'None' :
40  cmd_2 = [ 'postProcessIDTPMHistos', MyArgs.outputFileName, MyArgs.method ]
41  print( "Running: "+(' '.join( cmd_2 )) )
42  subprocess.run( cmd_2, check=True )
mergeIDTPM.GetCustomAthArgs
def GetCustomAthArgs()
Definition: mergeIDTPM.py:4
print
void print(char *figname, TCanvas *c1)
Definition: TRTCalib_StrawStatusPlots.cxx:25
TCS::join
std::string join(const std::vector< std::string > &v, const char c=',')
Definition: Trigger/TrigT1/L1Topo/L1TopoCommon/Root/StringUtils.cxx:10