All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
UpdateToLArSeedService.py
Go to the documentation of this file.
1 #!/usr/bin/env python2
2 #
3 # This script changes C++ code, CMake files and FHiCL configuration to use
4 # sim::LArSeedService instead of artext::SeedService
5 #
6 # Change log:
7 # 20160426 (petrillo@fnal.gov)
8 # original version
9 # 20160427 (petrillo@fnal.gov)
10 # added replacement for LARSIM_RANDOMUTILS_LARSEEDSERVICE_USExxx macros
11 #
12 
13 import sys, re
14 
15 import SerialSubstitution
16 from SerialSubstitution import AddProcessor, RunSubstitutor
17 
18 
19 ################################################################################
20 if __name__ == "__main__":
21 
22  #############################################################################
23  # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
24  # FHiCL configuration
25  #
27 
28  Subst.AddFileType("fcl")
29 
30  Subst.AddWord ("SeedService", "LArSeedService")
31 
32  # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
33  # CMakeLists.txt
34  #
36 
37  Subst.AddFileNamePattern("CMakeLists.txt")
38 
39  Subst.AddWord ("artextensions_SeedService_service", "larsim_RandomUtils_LArSeedService_service")
40  Subst.AddWord ("SeedService_service", "larsim_RandomUtils_LArSeedService_service")
41  Subst.AddSimplePattern("${SEEDSERVICE_SERVICE}", "larsim_RandomUtils_LArSeedService_service")
42  Subst.AddRegExPattern(r"larsim_RandomUtils_LArSeedService_service +# +artextensions", "larsim_RandomUtils_LArSeedService_service")
43 
44 
45  # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
46  # C++ source code (including modules and services)
47  #
49 
50  Subst.AddFileType("h", "cc", "cpp", "cxx")
51 
52  Subst.AddWord ("artextensions/SeedService/SeedService.hh", "larsim/RandomUtils/LArSeedService.h")
53  Subst.AddWord ("artextensions/SeedService/ArtState.hh", "larsim/RandomUtils/ArtState.h")
54  Subst.AddRegExPattern(r"artextensions/SeedService/([^.]*)\.hh?", r"larsim/RandomUtils/Providers/\1.h")
55 
56  Subst.AddWord ("artext::SeedService", "sim::LArSeedService")
57  Subst.AddWord ("artext::SeedMaster", "sim::SeedMaster")
58 
59  Subst.AddWord ("SeedService", "LArSeedService")
60  Subst.AddWord ("SEEDSERVICE_USECLHEP", "LARSIM_RANDOMUTILS_LARSEEDSERVICE_USECLHEP")
61  Subst.AddWord ("SEEDSERVICE_USEROOT", "LARSIM_RANDOMUTILS_LARSEEDSERVICE_USEROOT")
62 
63  # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
64  #############################################################################
65 
66  sys.exit(RunSubstitutor())
67 #