Commit 1886380b authored by Walter Lampl's avatar Walter Lampl
Browse files

Merge branch 'calorecex_cleanup' into 'master'

CaloRecEx: delete obsolete package

See merge request atlas/athena!47200
parents d9b4a658 830be03e
......@@ -123,7 +123,7 @@ logRecoOutputItemList_jobOptions = logging.getLogger( 'py:RecoOutputItemList_job
from OutputStreamAthenaPool.CreateOutputStreams import createOutputStream
StreamESD=createOutputStream("StreamESD","myESD.pool.root",True)
include ("CaloRecEx/CaloRecOutputItemList_jobOptions.py")
include ("CaloRec/CaloRecOutputItemList_jobOptions.py")
StreamESD.ItemList+=CaloESDList
print (StreamESD.ItemList)
......
......@@ -97,7 +97,7 @@ logRecoOutputItemList_jobOptions = logging.getLogger( 'py:RecoOutputItemList_job
from OutputStreamAthenaPool.CreateOutputStreams import createOutputStream
StreamESD=createOutputStream("StreamESD","myESD.pool.root",True)
include ("CaloRecEx/CaloRecOutputItemList_jobOptions.py")
include ("CaloRec/CaloRecOutputItemList_jobOptions.py")
StreamESD.ItemList+=CaloESDList
print StreamESD.ItemList
......
......@@ -239,7 +239,7 @@ logRecoOutputItemList_jobOptions = logging.getLogger( 'py:RecoOutputItemList_job
from OutputStreamAthenaPool.CreateOutputStreams import createOutputStream
StreamESD=createOutputStream("StreamESD","myESD.pool.root",True)
include ("CaloRecEx/CaloRecOutputItemList_jobOptions.py")
include ("CaloRec/CaloRecOutputItemList_jobOptions.py")
StreamESD.ItemList+=CaloESDList
print StreamESD.ItemList
......
################################################################################
# Package: CaloRecEx
################################################################################
# Declare the package name:
atlas_subdir( CaloRecEx )
# Install files from the package:
atlas_install_joboptions( share/*.py )
atlas_install_runtime( share/*.C share/*.css share/CaloRecEx_HistoComparison.txt share/*Checks.py )
CaloRecEx is a testing (ATN and RTT) package for the reconstruction in the Calorimeter.
The RTT use :
- didAnyTestFail.py : check the results of the tests (CaloRecEx_histComp.C,CaloRecEx_truth.C) and send an email to the people defined in http://marwww.in2p3.fr/~kbernard/caloperf/CaloRecEx_mails.txt
- extractRec.py : extract cputime, memory, file size informations, memory leaks. It sends an email with the results of the tests. A test is defined like
Name of the test : reference logfile
1103_T1_McAtNLO_top:reflogRec1103_T1_McAtNLO_top
and you have to add a line
print "BEGIN_RTTINFO = 1103_T1_McAtNLO_top"
in the jobOption of this test.
- CaloRecEx_histComp.C : comparison of histograms
- CaloRecEx_truth.C : plots for truth
CaloRecEx_histComp.C and CaloRecEx_truth.C need paramaters which are defined in a file 1103_T1_McAtNLO_top.par (for the test 1103_T1_McAtNLO_top) stored in http://marwww.in2p3.fr/~kbernard/caloperf/
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
/**
@page CaloRecEx_page CaloRecEx Package
This package is mainly used to test (ATN, RTT) reconstruction in the calorimeter (only ntuple).
@author Karim Bernardet bernardet@cppm.in2p3.fr
@section CaloRecEx_FragOpt jobOptions fragments
CaloRecOutputItemList_jobOptions.py : list of the calo objects written in the ESD/AOD
*/
###############################################################
#
# Job options file to run Digitization for CTB Calo only
#
#==============================================================
from AthenaCommon.DetFlags import DetFlags
from AthenaCommon.GlobalFlags import GlobalFlags
GlobalFlags.DetGeo.set_ctbh8()
GlobalFlags.DataSource.set_geant4()
DetFlags.detdescr.all_setOn()
DetFlags.ID_setOff()
DetFlags.Calo_setOn()
DetFlags.Muon_setOff()
DetFlags.makeRIO.Calo_setOn()
include( "AthenaPoolCnvSvc/ReadAthenaPool_jobOptions.py" )
include( "PartPropSvc/PartPropSvc.py" )
#
# Pool Converters
#
include( "EventAthenaPool/EventAthenaPool_joboptions.py" )
include( "GeneratorObjectsAthenaPool/GeneratorObjectsAthenaPool_joboptions.py" )
include( "LArAthenaPool/LArAthenaPool_joboptions.py" )
include( "TileEventAthenaPool/TileEventAthenaPool_joboptions.py" )
include( "G4SimAthenaPOOL/G4SimAthenaPOOL_joboptions.py" )
#
# Pool input
#
from AthenaCommon.AppMgr import ServiceMgr as svcMgr
svcMgr.EventSelector.InputCollections = [
"ctb_CaloDigit.pool.root"
]
# the Tile, LAr and Calo detector description package
from AtlasGeoModel import SetGeometryVersion
from GeoModelSvc.GeoModelSvcConf import GeoModelSvc
GeoModelSvc = GeoModelSvc()
GeoModelSvc.AtlasVersion = "ATLAS-CTB-01"
CTBforTTCellMap=True
from AtlasGeoModel import GeoModelInit
#configure LAr to read from OFLP200
from LArConditionsCommon.LArCondFlags import larCondFlags
larCondFlags.LArDBConnection="<dbConnection>COOLONL_LAR/OFLP200</dbConnection>"
include("LArDetDescr/LArDetDescr_H8_joboptions.py")
from AthenaCommon.GlobalFlags import jobproperties
jobproperties.Global.DetDescrVersion='CTB'
DetDescrVersion = "CTB"
# difference is in the IDET tag which is not defined from the jo above and which is found in the input file
ServiceMgr.GeoModelSvc.IgnoreTagDifference = True
# conditions
include("LArConditionsCommon/LArConditionsCommon_MC_jobOptions.py")
include( "TileConditions/TileTBConditions_jobOptions.py" )
from RecExConfig.ObjKeyStore import objKeyStore
objKeyStore.readInputFile('RecExPers/OKS_streamRDO.py')
# calo reco
# produces cells and TB 3x3 clusters
from CaloRec.CaloRecFlags import jobproperties
jobproperties.CaloRecFlags.doEmCluster = False
jobproperties.CaloRecFlags.doCaloTopoCluster = False
jobproperties.CaloRecFlags.doCaloEMTopoCluster = False
jobproperties.CaloRecFlags.doTileMuId = False
from TileRecUtils.TileRecFlags import jobproperties
jobproperties.TileRecFlags.TileRawChannelContainer = "TileRawChannelFit"
include ("CaloRec/CaloRec_jobOptions.py")
from AthenaCommon.AlgSequence import AlgSequence
topSequence = AlgSequence()
if hasattr(topSequence, "TileRawChannelToL2"):
from TileL2Algs.TileL2AlgsConf import TileL2Builder
TileL2Builder = TileL2Builder("TileL2Builder")
TileL2Builder.TileRawChannelContainer = "TileRawChannelFit"
topSequence.TileRawChannelToL2.TileL2Builder = TileL2Builder
from CaloRec.CaloRecConf import CaloClusterMaker
LArTBClusterMaker = CaloClusterMaker("LArTBClusterMaker")
LArTBClusterMaker.ClustersOutputName="LArClusterTBEM"
from LArClusterRec.LArClusterRecConf import LArTBClusterBuilder
theLArTBClusterBuilder = LArTBClusterBuilder("theLArTBClusterBuilder")
theLArTBClusterBuilder.EtaSize=3.
theLArTBClusterBuilder.PhiSize=3.
theLArTBClusterBuilder.CellContainers="AllCalo"
theLArTBClusterBuilder.EnergyThreshold=-1000000.*MeV
theLArTBClusterBuilder.ClusterNbr=1
theLArTBClusterBuilder.LArCaloRegion="BARREL"
ToolSvc += theLArTBClusterBuilder
LArTBClusterMaker.ClusterMakerTools = [ ToolSvc.theLArTBClusterBuilder.getFullName() ]
topSequence += LArTBClusterMaker
#--------------------------------------------------------------
# Set output level threshold (2=DEBUG, 3=INFO, 4=WARNING, 5=ERROR, 6=FATAL )
#--------------------------------------------------------------
MessageSvc = Service( "MessageSvc" )
MessageSvc.OutputLevel = INFO
#--------------------------------------------------------------
# Event related parameters
#--------------------------------------------------------------
# Number of events to be processed (default is 10)
theApp.EvtMax = 20
theApp.EvtSel = "EventSelector"
# Use auditors
theApp.Dlls += [ "GaudiAud" ]
#
# write out a summary of the time spent
#
from GaudiCommonSvc.GaudiCommonSvcConf import AuditorSvc
svcMgr += AuditorSvc()
from GaudiCommonSvc.GaudiCommonSvcConf import ChronoStatSvc
svcMgr += ChronoStatSvc()
from GaudiCoreSvc.GaudiCoreSvcConf import MessageSvc
svcMgr += MessageSvc( defaultLimit = 100000000 )
from AthenaPoolCnvSvc.WriteAthenaPool import AthenaPoolOutputStream
Stream1 = AthenaPoolOutputStream("Stream1")
Stream1.OutputFile = "ctb_CaloESD.pool.root"
Stream1.ItemList+=["EventInfo#*"]
Stream1.ItemList+=["McEventCollection#*"]
Stream1.ItemList += ["CaloCalibrationHitContainer#*"]
from AthenaCommon.Logging import logging
logRecoOutputItemList_jobOptions = logging.getLogger( 'py:RecoOutputItemList_jobOptions' )
include ("CaloRecEx/CaloRecOutputItemList_jobOptions.py")
Stream1.ItemList += CaloESDList
theKey = "LArClusterTBEM"
Stream1.ItemList+=["CaloClusterContainer#"+theKey]
Stream1.ItemList+=["CaloCellLinkContainer#"+theKey+"_Link"]
Stream1.ItemList+=["CaloShowerContainer#"+theKey+"_Data"]
This diff is collapsed.
#!/usr/bin/env python
import os,commands,sys,logging,math
import ROOT
import string
class myHist:
def __init__(self,histName,histComment,histBins,histMinX,histMaxX,histFormula,histCondForm):
self.histName=histName
self.histComment=histComment
self.histMinX=histMinX
self.histMaxX=histMaxX
self.histFormula=histFormula
self.histCondForm=histCondForm
self.histBins=histBins
def setHistName(self,name):
self.histName=name
def setHistComment(self,Comment):
self.histComment=Comment
def setHistFormula(self,form):
self.histFormula=form
def setHistCondForm(self,condform):
self.histCondForm=condform
def setHistXmin(self,minX):
self.HistMinx=minX
def setHistXmax(self,maxX):
self.histMaxX=maxX
def setHistBins(self,nbins):
self.histBins=nbins
def getHistName(self):
return self.histName
def getHistComment(self):
return self.histComment
def getHistMinX(self):
return self.histMinX
def getHistMaxX(self):
return self.histMaxX
def getHistBins(self):
return self.histBins
def getHistFormula(self):
return self.histFormula
def getHistCondForm(self):
return self.histCondForm
class HistosComparison:
def __init__(self,log,logLevel):
if log=='':
self.logger = logging.getLogger('HistosComparison')
hdlr = logging.FileHandler('HistosComparison.log',"w")
formatter = logging.Formatter('%(asctime)s %(levelname)s %(message)s')
hdlr.setFormatter(formatter)
self.logger.addHandler(hdlr)
self.logger.setLevel(logLevel)
else:
self.logger = log
self.filePar="filePar"
def normH(self,m_hist):
if m_hist.GetEntries() != 0 :
scale = 1/m_hist.GetEntries()
m_hist.Scale(scale)
else:
self.logger.error("No entries in ",m_hist.GetTitle())
def getPar(self,name,par):
com="grep \"RTTParm_almostIdentical_"+name+"_"+par+"\" "+self.filePar+ "| cut -d= -f2 | tail -n1"
print com
res,val=commands.getstatusoutput(com)
if val=="":
val="notfound"
if res!=0:
self.logger.error('Problem to get the par of '+name+' : '+max)
val="notfound"
return val
def makeHist(self,ROOTntuple):
ROOT.gStyle.SetMarkerStyle(8)
ROOT.gStyle.SetStatW(0.4)
ROOT.gStyle.SetStatFontSize(0.12)
ROOT.gStyle.SetLabelSize(0.06)
ROOT.gStyle.SetOptStat(111110)
ROOT.gStyle.SetCanvasBorderMode(0)
ROOT.gStyle.SetPadBorderMode(0)
ROOT.gStyle.SetPadColor(0)
ROOT.gStyle.SetCanvasColor(0)
ROOT.gStyle.SetTitleColor(0)
ROOT.gStyle.SetStatColor(0)
# only 3 digits
ROOT.TGaxis.SetMaxDigits(3);
myCanvas = ROOT.TCanvas("myCanvas","Cluster",1)
myCanvas.Divide(2,8)
file=open('CaloRecEx_HistoComparison.txt','r')
hists=[]
n=0
for line in file:
i=+1
myCanvas.cd(n)
tmp=line.strip().split(',')
name2=""
for i in tmp[1]:
if i==' ':
i='_'
if i=='(':
i='z'
if i==')':
i='z'
name2+=i
# check bin x
xmin=self.getPar(name2,"xmin")
if xmin=="notfound":
xmin=tmp[3]
xmax=self.getPar(name2,"xmax")
if xmax=="notfound":
xmax=tmp[4]
print "XMIN =", xmin
print "XMAX =", xmax
if len(tmp)==7:
h=myHist(tmp[0],tmp[1],tmp[2],xmin,xmax,tmp[5],tmp[6])
else:
h=myHist(tmp[0],tmp[1],tmp[2],xmin,xmax,tmp[5],'')
hists.append(h)
file.close()
rootFile = ROOT.TFile(ROOTntuple,'READ')
mytree = ROOT.gDirectory.Get('CollectionTree')
mytree.UseCurrentStyle()
hfile = ROOT.TFile("Cluster.hist","RECREATE","Clusters hist")
for h in hists:
self.logger.debug(h.getHistName(),',',h.getHistComment(),',',h.getHistBins(),',',h.getHistMinX(),',',h.getHistBins(),',',h.getHistMaxX())
m_h = ROOT.TH1F(h.getHistName(),h.getHistComment(),int(h.getHistBins()),float(h.getHistMinX()),float(h.getHistMaxX()))
mytree.Draw(h.getHistFormula(),h.getHistCondForm())
mytree.Draw(h.getHistFormula()+'>>'+h.getHistName(),h.getHistCondForm())
self.normH(m_h)
hfile.Write()
rootFile.Close()
def getFilePar(self):
com="grep RTTINFO MYRTTINFOS.txt | cut -d= -f2 | tail -n1"
res,testName=commands.getstatusoutput(com)
if res!=0 :
self.logger.error(testName)
return -1
nTestName=''
for i in testName:
if i !=' ':
nTestName+=i;
filePar=nTestName+".par";
com="wget http://cern.ch/CaloRTT/"+filePar;
print com
res,out=commands.getstatusoutput(com)
if res!=0 :
self.logger.error(out)
return -1
return filePar
def getFileRef(self):
#lnk++
com = "cat env.log|grep AtlasArea"
res,tmp1=commands.getstatusoutput(com)
tmpFind="nightlies/"
i1 = string.find(tmp1,tmpFind)+len(tmpFind)
tmp2 = tmp1[i1:]
i2 = string.find(tmp2,"/")
branch2 = tmp2[:i2]
print " The branch is", branch2
file=open('Branch.txt','a')
file.write(""+branch2+'')
file.close()
#lnk--
com="grep RTTINFO MYRTTINFOS.txt | cut -d= -f2 | tail -n1"
res,testName=commands.getstatusoutput(com)
if res!=0 :
self.logger.error(testName)
return -1
nTestName=''
for i in testName:
if i !=' ':
nTestName+=i;
fileRef='ref'+nTestName+".hist"
#lnk+++ Added different branch2 (dev,devval,pcache) reference histos
com="wget http://cern.ch/CaloRTT/"+branch2+'/'+fileRef
#lnk---
res,out=commands.getstatusoutput(com)
if res!=0 :
self.logger.error(out)
return -1
return fileRef
def initHTMLDraw(self):
f=open("DrawHistos.html","w")
f.write("<html><head><title>Draw</title><link rel=\"StyleSheet\" href=\"CaloRecEx.ss\" type=\"text/css\" /><meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\"><meta http-equiv=\"Content-Language\" content=\"en\"></head>")
f.write("<body>")
f.close();
def closeHTMLDraw(self):
f=open("DrawHistos.html","a")
f.write("</body>")
f.write("</html>")
def initHTMLComparison(self):
f=open("Comparison.html","w")
f.write("<html><head><title>Draw</title><link rel=\"StyleSheet\" href=\"CaloRecEx.ss\" type=\"text/css\" /><meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\"><meta http-equiv=\"Content-Language\" content=\"en\"></head>")
f.write("<body>")
f.close();
def closeHTMLComparison(self):
f=open("Comparison.html","a")
f.write("</body>")
f.write("</html>")
def Draw(self,histFile):
self.initHTMLDraw()
file = ROOT.TFile(histFile)
for i in file.GetListOfKeys():
self.DrawHisto(i.ReadObj())
file.Close()
self.closeHTMLDraw()
def DrawHisto(self,hist):
f=open("DrawHistos.html","a")
tmp=hist.GetTitle()
name=""
for i in tmp:
if i==' ':
i='_'
if i=='(':
i='z'
if i==')':
i='z'
name+=i
ROOT.gStyle.SetOptStat(ROOT.kFALSE)
can=ROOT.TCanvas()
hist.Draw()
legend=ROOT.TLegend(0.7,0.7,0.89,0.85)
legend.SetTextFont(72)
legend.SetTextSize(0.04)
legend.AddEntry(hist,"NEW","l")
legend.Draw()
can.Modified()
can.Update()
epsname=name+".eps"
gifname=name+".gif"
can.SaveAs(epsname)
com1='pstopnm -ppm -xborder 0 -yborder 0 -portrait '+epsname
com2='ppmtogif '+epsname+'001.ppm >'+gifname
os.system(com1)
os.system(com2)
f.write("<CENTER><BR>")
f.write("Name : "+hist.GetTitle()+'<BR>')
f.write("<BR>")
f.write("<TABLE border=1>")
f.write("<TR>")
f.write("<TD>Entries</TD>")
f.write("<TD>"+str(hist.GetEntries())+'</TD>')
f.write("</TR>")
f.write("<TR>")
f.write("<TD>Mean</TD>")
f.write("<TD>"+str(hist.GetMean())+'</TD>')
f.write("</TR>")
f.write("<TR>")
f.write("<TD>RMS</TD>")
f.write('<TD>'+str(hist.GetRMS())+'</TD>')
f.write("</TR>")
f.write("</TABLE>")
f.write("<IMG SRC=\""+gifname+'\"><BR>')
f.write('<HR><BR>')
f.close()
def almostIdentical(self,hist,refhist):
f=open("Comparison.html","a")
tmp=hist.GetTitle()
name=""
for i in tmp:
if i==' ':
i='_'
if i=='(':
i='z'
if i==')':
i='z'
name+=i
ROOT.gStyle.SetOptStat(ROOT.kFALSE)
can=ROOT.TCanvas()
can.SetLogy()
hist.SetLineColor(2)
hist.SetLineStyle(2)
hist.Draw()
if hist:
refhist.Draw("sames")
else:
refhist.Draw()
legend=ROOT.TLegend(0.7,0.7,0.89,0.85)
legend.SetTextFont(72)
legend.SetTextSize(0.04)
legend.AddEntry(hi