UpdateToNuRandomService.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 # rndm::NuRandomService instead of sim::NuRandomService
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 ("LArSeedService", "NuRandomService")
31  Subst.AddWord ("per_event_seedservice", "per_event_NuRandomService")
32  Subst.AddWord ("standard_seedservice", "standard_NuRandomService")
33  Subst.AddWord ("autoincrement_seedservice", "autoincrement_NuRandomService")
34  Subst.AddWord ("linearmapping_seedservice", "linearmapping_NuRandomService")
35  Subst.AddWord ("random_seedservice", "random_NuRandomService")
36  Subst.AddWord ("autoincrement_seedservice", "autoincrement_NuRandomService")
37 
38  # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
39  # CMakeLists.txt
40  #
42 
43  Subst.AddFileNamePattern("CMakeLists.txt")
44 
45  Subst.AddWord ("larsim_RandomUtils_LArSeedService_service", "nutools_RandomUtils_NuRandomService_service")
46  Subst.AddWord ("SeedService_service", "nutools_RandomUtils_NuRandomService_service")
47  Subst.AddSimplePattern("${SEEDSERVICE_SERVICE}", "nutools_RandomUtils_NuRandomService_service")
48  ##Subst.AddRegExPattern(r"nutools_RandomUtils_NuRandomService_service +# +artextensions", "nutools_RandomUtils_NuRandomService_service")
49 
50 
51  # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
52  # C++ source code (including modules and services)
53  #
55 
56  Subst.AddFileType("h", "cc", "cpp", "cxx")
57 
58  Subst.AddWord ("larsim/RandomUtils/LArSeedService.h", "nutools/RandomUtils/NuRandomService.h")
59  Subst.AddWord ("larsim/RandomUtils/SeedService.hh", "nutools/RandomUtils/NuRandomService.h")
60  Subst.AddWord ("larsim/RandomUtils/ArtState.hh", "nutools/RandomUtils/ArtState.h")
61  Subst.AddRegExPattern(r"larsim/RandomUtils/Providers/([^.]*)\.h?", r"nutools/RandomUtils/Providers/\1.h")
62 
63  Subst.AddWord ("sim::LArSeedService", "rndm::NuRandomService")
64  Subst.AddWord ("sim::SeedMaster", "rndm::SeedMaster")
65 
66  Subst.AddWord ("LArSeedService", "NuRandomService")
67  Subst.AddWord ("LARSIM_RANDOMUTILS_LARSEEDSERVICE_USECLHEP", "NUTOOLS_RANDOMUTILS_NuRandomService_USECLHEP")
68  Subst.AddWord ("LARSIM_RANDOMUTILS_LARSEEDSERVICE_USEROOT", "NUTOOLS_RANDOMUTILS_NuRandomService_USEROOT")
69 
70  # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
71  #############################################################################
72 
73  sys.exit(RunSubstitutor())
74 #
def AddProcessor(processor)