ATLAS Offline Software
IDTPMcnv.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 # Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 
4 
6 
7 import argparse, ROOT, os
8 
9 # Parsing arguments
10 parser = argparse.ArgumentParser( description = "MakePlots.py options:" )
11 parser.add_argument( "-i", "--inputFile", help="IDPVM input file" )
12 parser.add_argument( "-c", "--config", help="config file" )
13 
14 MyArgs = parser.parse_args()
15 
16 inFileName = MyArgs.inputFile
17 inFile = ROOT.TFile.Open( inFileName , "READ" )
18 
19 outFile = ROOT.TFile.Open( inFileName.replace( "root", "IDTPMcnv.root" ) , "RECREATE" )
20 
21 configFileName = MyArgs.config
22 configFile = open( configFileName, 'r' )
23 lines = configFile.readlines()
24 
25 for line in lines:
26  parsed = line.strip().split()
27  htype = parsed[0]
28  hidpvm = parsed[1]
29  hidtpm = parsed[2]
30 
31 
32  inFile.cd()
33  obj = inFile.Get( hidpvm )
34  obj.SetDirectory(0)
35 
36 
37  outFile.cd()
38  hidtpm_dir = os.path.dirname( hidtpm )
39  hidtpm_name = os.path.basename( hidtpm )
40  if( not outFile.GetDirectory( hidtpm_dir ) ):
41  outFile.mkdir( hidtpm_dir, hidtpm_dir )
42  outFile.cd( hidtpm_dir )
43  obj.SetName( hidtpm_name )
44  obj.Write()
45 
46 inFile.Close()
47 outFile.Close()
Trk::open
@ open
Definition: BinningType.h:40
if
if(febId1==febId2)
Definition: LArRodBlockPhysicsV0.cxx:567
Trk::split
@ split
Definition: LayerMaterialProperties.h:38