/[PAMELA software]/pythonModules/L2Interface.py
ViewVC logotype

Annotation of /pythonModules/L2Interface.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1.1.1 - (hide annotations) (download) (as text) (vendor branch)
Mon May 1 13:51:23 2006 UTC (18 years, 7 months ago) by kusanagi
Branch: MAIN
CVS Tags: pythonModules1_00/00, pythonModules1_01/00, HEAD
Changes since 1.1: +0 -0 lines
File MIME type: text/x-python
First import for the NGN python modules.

1 kusanagi 1.1 ############################################################################
2     # Copyright (C) 2006 by Maurizio Nagni #
3     # nagni@roma2.infn.it #
4     # #
5     # This program is free software; you can redistribute it and#or modify #
6     # it under the terms of the GNU General Public License as published by #
7     # the Free Software Foundation; either version 2 of the License, or #
8     # (at your option) any later version. #
9     # #
10     # This program is distributed in the hope that it will be useful, #
11     # but WITHOUT ANY WARRANTY; without even the implied warranty of #
12     # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
13     # GNU General Public License for more details. #
14     # #
15     # You should have received a copy of the GNU General Public License #
16     # along with this program; if not, write to the #
17     # Free Software Foundation, Inc., #
18     # 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #
19     ############################################################################
20     #!/usr/bin/env python
21     # l2manager.py
22     # Author: Maurizio Nagni
23     # Date: 4 February 2006
24     #
25     # Description:
26     # First implementation of the L2Manager for the processing of the
27     # PAMELA RUNs up to Level2 data. To execute from the command line:
28     #
29     # python l2manager.py configFile.conf
30     #
31     # where configFile have to be conform to the structure
32     #
33     # [L2Manager]
34     # l2Manager_log: /pathToLogFile/xxx.log
35     # libyoda_file: /pathToLibYoda/libyoda.so
36    
37    
38     import sys, os, time, logging
39     from ConfigParser import *
40     from ROOT import *
41     from ngn.pamela.L2Manager import L2Manager
42    
43     def main():
44     if len(sys.argv) > 1:
45     confFile = sys.argv[1]
46     if not (os.access(confFile, os.F_OK)):
47     print 'Cannot find configuration file. \n'
48     sys.exit(1)
49     else:
50     print 'Please insert a configuration file path.\n'
51     sys.exit(1)
52    
53     config = ConfigParser()
54     config.read(confFile)
55     try:
56     logfile = config.get('L2Manager', 'l2Manager_log')
57     libPath = config.get('L2Manager', 'libyoda_file')
58     DETECTORS_BRANCHES = ['Trigger', 'Tof']
59     MAIN_TREE = 'Physics'
60     except NoSectionError, detail:
61     print 'Section missing in configuration file: ', detail
62     sys.exit(1)
63     except NoOptionError, detail:
64     print 'Wrong option in configuration file: ', detail
65     sys.exit(1)
66    
67     #initialize the logger
68     logger = logging.getLogger(logfile)
69     hdlr = logging.FileHandler(logfile)
70     formatter = logging.Formatter('%(asctime)s %(levelname)s %(message)s')
71     hdlr.setFormatter(formatter)
72     logger.addHandler(hdlr)
73     logger.setLevel(logging.DEBUG)
74    
75     runs = selectRUNs()
76     manager = L2Manager(runs, libPath, logger, DETECTORS_BRANCHES, MAIN_TREE)
77     manager.processRuns()
78     logger.info('Main terminated \n')
79    
80    
81     #Select RUN from the database according to some rules (???)
82     def selectRUNs():
83     print 'SELECT RUNs!'
84     return [1, 2]
85    
86     #Just for test....
87     main()
88    

  ViewVC Help
Powered by ViewVC 1.1.23