1
################################################################################
3
# Copyright (C) 2012-2016 Eric Conte, Benjamin Fuks
4
# The MadAnalysis development team, email: <ma5team@iphc.cnrs.fr>
6
# This file is part of MadAnalysis 5.
7
# Official website: <https://launchpad.net/madanalysis5>
9
# MadAnalysis 5 is free software: you can redistribute it and/or modify
10
# it under the terms of the GNU General Public License as published by
11
# the Free Software Foundation, either version 3 of the License, or
12
# (at your option) any later version.
14
# MadAnalysis 5 is distributed in the hope that it will be useful,
15
# but WITHOUT ANY WARRANTY; without even the implied warranty of
16
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
# GNU General Public License for more details.
19
# You should have received a copy of the GNU General Public License
20
# along with MadAnalysis 5. If not, see <http://www.gnu.org/licenses/>
22
################################################################################
25
from madanalysis.install.install_manager import InstallManager
28
class DetectorManager():
30
def __init__(self, main):
32
self.forced = self.main.forced
34
def manage(self, detector):
36
# Getting the 'already installed' flags
37
if detector == 'delphes':
38
installed = self.main.archi_info.has_delphes
39
uninstalled = self.main.archi_info.has_delphesMA5tune
40
otherdetector = 'delphesMA5tune'
41
elif detector == 'delphesMA5tune':
42
installed = self.main.archi_info.has_delphesMA5tune
43
uninstalled = self.main.archi_info.has_delphes
44
otherdetector = 'delphes'
47
# Installing / activating if necessary
49
if self.main.fastsim.package == detector and not installed:
50
installer=InstallManager(self.main)
52
if not installer.Deactivate(otherdetector):
53
self.main.forced=self.forced
55
if installer.Activate(detector)==-1:
56
self.main.forced=self.forced
58
self.main.forced=self.forced