Skip to content

Commit ca33df9

Browse files
Implemented review comments.
1 parent cc9bb11 commit ca33df9

File tree

5 files changed

+101
-16
lines changed

5 files changed

+101
-16
lines changed

.gitignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,3 @@ __init__.py
55
#*#
66
*~
77
*.pb
8-
*.root
9-
*replace.py

RecoEcal/Configuration/python/RecoEcal_EventContent_cff.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,7 @@
6363
'drop recoSuperClusters_multi5x5SuperClusters_multi5x5BarrelSuperClusters_*')
6464
)
6565
RecoEcalRECO.outputCommands.extend(RecoEcalAOD.outputCommands)
66-
_phase2_hgcal_scCommands = ['keep *_particleFlowSuperClusterHGCal_*_*',
67-
'keep *_particleFlowSuperClusterHGCal_*_*']
66+
_phase2_hgcal_scCommands = ['keep *_particleFlowSuperClusterHGCal_*_*']
6867
phase2_hgcal.toModify(RecoEcalRECO,
6968
outputCommands = RecoEcalRECO.outputCommands + _phase2_hgcal_scCommands)
7069

RecoLocalCalo/Configuration/python/hgcalLocalReco_cff.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
hgcalLayerClusters,
1919
hgcalMultiClusters,
2020
particleFlowRecHitHGC,
21-
particleFlowClusterHGCal,
2221
particleFlowClusterHGCal )
2322

2423
_hfnose_hgcalLocalRecoTask = hgcalLocalRecoTask.copy()

TrackingTools/Configuration/python/TrackingTools_EventContent_cff.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
)
99

1010
from Configuration.Eras.Modifier_phase2_hgcal_cff import phase2_hgcal
11-
phase2_hgcal.toModify( TrackingToolsAOD,
12-
outputCommands = TrackingToolsAOD.outputCommands + ['keep recoGsfTracks_electronGsfTracks_*_*'])
1311

1412
#RECO content
1513
TrackingToolsRECO = cms.PSet(
@@ -22,15 +20,6 @@
2220
)
2321
)
2422
TrackingToolsRECO.outputCommands.extend(TrackingToolsAOD.outputCommands)
25-
_phase2_hgcal_TrackingRECO_tokeep = [
26-
'keep recoGsfTracks_electronGsfTracks_*_*',
27-
'keep recoGsfTrackExtras_electronGsfTracks_*_*',
28-
'keep recoTrackExtras_electronGsfTracks_*_*',
29-
'keep TrackingRecHitsOwned_electronGsfTracks_*_*',
30-
'keep *_electronMergedSeeds_*_*'
31-
]
32-
phase2_hgcal.toModify( TrackingToolsRECO,
33-
outputCommands = TrackingToolsRECO.outputCommands + _phase2_hgcal_TrackingRECO_tokeep)
3423

3524
#FEVT content
3625
TrackingToolsFEVT = cms.PSet(

replace.py

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
#!/usr/bin/env python
2+
3+
import argparse
4+
import os
5+
import subprocess
6+
7+
8+
def main() :
9+
10+
# Argument parser
11+
parser = argparse.ArgumentParser(formatter_class = argparse.RawTextHelpFormatter)
12+
13+
parser.add_argument(
14+
"--sfind",
15+
help = "Find string",
16+
type = str,
17+
required = True,
18+
)
19+
20+
parser.add_argument(
21+
"--srepl",
22+
help = "Replace string",
23+
type = str,
24+
required = True,
25+
)
26+
27+
parser.add_argument(
28+
"--dirs",
29+
help = "Directories to search in",
30+
type = str,
31+
nargs = "*",
32+
required = False,
33+
default = ["./"],
34+
)
35+
36+
parser.add_argument(
37+
"--doreplace",
38+
help = "Perform the replace operation",
39+
default = False,
40+
action = "store_true",
41+
)
42+
43+
args = parser.parse_args()
44+
d_args = vars(args)
45+
46+
47+
dirs = " ".join(args.dirs)
48+
49+
cmd = "grep -Irl --exclude \"*.sh\" %s %s | sort -V" %(args.sfind, dirs)
50+
print(cmd)
51+
cmd_output = subprocess.check_output(cmd, shell = True)
52+
#print(cmd_output)
53+
54+
l_fileName = cmd_output.strip().split()
55+
l_fileName = [fName.strip() for fName in l_fileName]
56+
l_fileName = [fName for fName in l_fileName if len(fName)]
57+
#print(l_fileName)
58+
59+
nFile = len(l_fileName)
60+
61+
print("\n")
62+
print("Replace: %s --> %s" %(args.sfind, args.srepl))
63+
print("\n")
64+
65+
for iFile, fName in enumerate(l_fileName) :
66+
67+
print("File (%d/%d): %s" %(iFile+1, nFile, fName))
68+
69+
cmd = "sed -i \"s#%s#%s#g\" %s" %(args.sfind, args.srepl, fName)
70+
print(cmd)
71+
72+
73+
if (args.doreplace) :
74+
75+
print ("Starting replace operation...")
76+
77+
cmd_ret = os.system(cmd)
78+
79+
if (cmd_ret) :
80+
81+
print("Error.")
82+
exit(1)
83+
84+
print ("Finished replace operation.")
85+
86+
else :
87+
88+
print("Not performing replace operation.")
89+
90+
91+
print("")
92+
93+
94+
95+
return 0
96+
97+
98+
if (__name__ == "__main__") :
99+
100+
main()

0 commit comments

Comments
 (0)