SND@LHC Software
Loading...
Searching...
No Matches
run_anaEcal.py
Go to the documentation of this file.
1#!/usr/bin/env python
2from __future__ import print_function
3import ROOT,os,sys,getopt,time
4import shipunit as u
5import shipRoot_conf
6import ShipGeoConfig
7
8
9inFile ="geant.root"
10outFile="ana.root"
11# Parameter file name
12parFile="params.root"
13nEvents=2000
14# In general, the following parts need not be touched
15# ========================================================================
16
17# -----Timer--------------------------------------------------------
18timer=ROOT.TStopwatch()
19timer.Start()
20# ------------------------------------------------------------------------
22# -----Create analysis run------------------------------------------
23run=ROOT.FairRunAna()
24run.SetInputFile(inFile) # Input file
25run.SetOutputFile(outFile) # Output file
26# -----Calorimeter part --------------------------------------------
27# Creates. exports and fills calorimeter structure
28ecalFiller=ROOT.ecalStructureFiller("ecalFiller", 1, "ecal.geo")
29ecalFiller.SetUseMCPoints(ROOT.kTRUE)
30ecalFiller.StoreTrackInformation()
31run.AddTask(ecalFiller)
32# Simple analysis
33ecalAna=ROOT.ecalAnalysisSimple("simpleAna",0)
34run.AddTask(ecalAna)
35# -----Runtime database---------------------------------------------
36rtdb=run.GetRuntimeDb()
37kParameterMerged = ROOT.kTRUE
38parIo1=ROOT.FairParRootFileIo()
39parIo1.open(parFile)
40rtdb.setFirstInput(parIo1)
41rtdb.setOutput(parIo1)
42rtdb.saveOutput() # for the moment, it blocks when using Genie, no idea why
43rtdb.printParamContexts()
44# -----Start run----------------------------------------------------
45run.Init()
46run.Run(0,nEvents)
47# ------------------------------------------------------------------------
48#run.CreateGeometryFile("geofile_full."+tag+".root")
49# -----Finish-------------------------------------------------------
50timer.Stop()
51rtime = timer.RealTime()
52ctime = timer.CpuTime()
53print(' ')
54print("Macro finished succesfully.")
55print("Output file is ", outFile)
56print("Parameter file is ",parFile)
57print("Real time ",rtime, " s, CPU time ",ctime,"s")
58
59# ------------------------------------------------------------------------
configure(darkphoton=None)