diff --git a/Calorimeter/CaloExample/CaloHiveEx/share/CaloHiveExOpts.py b/Calorimeter/CaloExample/CaloHiveEx/share/CaloHiveExOpts.py index a2c8c39bee5a585c9dbd9118dccde6e94a95e552..662bfba9d14085ff57f8b83f655cb4e12b1cadce 100644 --- a/Calorimeter/CaloExample/CaloHiveEx/share/CaloHiveExOpts.py +++ b/Calorimeter/CaloExample/CaloHiveEx/share/CaloHiveExOpts.py @@ -128,14 +128,14 @@ StreamESD=createOutputStream("StreamESD","myESD.pool.root",True) include ("CaloRecEx/CaloRecOutputItemList_jobOptions.py") StreamESD.ItemList+=CaloESDList -print StreamESD.ItemList +print (StreamESD.ItemList) #---------------------------------------------------------------------------------# # MT-specific code if nThreads >=1 : include ( "CaloHiveEx/CaloHiveDeps.py" ) -print "==========================================================================================\n" +print ("==========================================================================================\n") # ## set which Algorithms can be cloned diff --git a/Calorimeter/CaloMonitoring/python/LArCellMonAlg.py b/Calorimeter/CaloMonitoring/python/LArCellMonAlg.py index 7473ec77d583faca03ab1b67b3f867d4655bcfe3..ffc01d00ab4a45d2f2a4140383197e7c394a0612 100644 --- a/Calorimeter/CaloMonitoring/python/LArCellMonAlg.py +++ b/Calorimeter/CaloMonitoring/python/LArCellMonAlg.py @@ -69,7 +69,7 @@ def LArCellMonConfig(inputFlags): algname=algname+'Cosmics' isCosmics = ( inputFlags.Beam.Type == 'cosmics' ) - LArCellMonConfigCore(helper, lArCellMonAlg,inputFlags, isCosmics, inputFlags.Input.isMC) + LArCellMonConfigCore(helper, lArCellMonAlg,inputFlags, isCosmics, inputFlags.Input.isMC, algname) acc=helper.result() @@ -85,10 +85,10 @@ def LArCellMonConfig(inputFlags): return cfg -def LArCellMonConfigCore(helper, alginstance, inputFlags, isCosmics=False, isMC=False): +def LArCellMonConfigCore(helper, algclass, inputFlags, isCosmics=False, isMC=False, algname='LArCellMonAlg'): - LArCellMonAlg = helper.addAlgorithm(alginstance, 'LArCellMonAlg') + LArCellMonAlg = helper.addAlgorithm(algclass, algname) if isCosmics: badChanMaskProblems=["deadReadout","deadPhys","short","sporadicBurstNoise","highNoiseHG","highNoiseMG","highNoiseLG"] diff --git a/Calorimeter/CaloRec/share/ToolConstantsCondAlg_test.ref b/Calorimeter/CaloRec/share/ToolConstantsCondAlg_test.ref index 2b4929198b2512986c7e1f5469ba04e2d4ef5850..307513df7dc226b19b6cda1ba098917074797dda 100644 --- a/Calorimeter/CaloRec/share/ToolConstantsCondAlg_test.ref +++ b/Calorimeter/CaloRec/share/ToolConstantsCondAlg_test.ref @@ -1,52 +1,62 @@ -Py:AutoConfigFlags INFO Obtaining metadata of auto-configuration by peeking into /home/sss/nobackup/referencefiles/Tier0ChainTests/q221/21.0/v1/myRDO.pool.root +Py:AutoConfigFlags INFO Obtaining metadata of auto-configuration by peeking into /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/Tier0ChainTests/q221/21.0/v1/myRDO.pool.root Py:MetaReader INFO Current mode used: peeker -Py:MetaReader INFO Current filenames: ['/home/sss/nobackup/referencefiles/Tier0ChainTests/q221/21.0/v1/myRDO.pool.root'] +Py:MetaReader INFO Current filenames: ['/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/Tier0ChainTests/q221/21.0/v1/myRDO.pool.root'] Py:MetaReader INFO MetaReader is called with the parameter "unique_tag_info_values" set to True. This is a workaround to remove all duplicate values from "/TagInfo" key ApplicationMgr SUCCESS ==================================================================================================================================== - Welcome to ApplicationMgr (GaudiCoreSvc v27r1p99) - running on karma on Mon Jun 15 11:08:19 2020 + Welcome to ApplicationMgr (GaudiCoreSvc v33r1) + running on 1fe14f8366e2 on Tue Jul 21 15:04:16 2020 ==================================================================================================================================== ApplicationMgr INFO Application Manager Configured successfully -PublicTool IOVDbMetaDataTool CoreDumpSvc INFO install f-a-t-a-l handler... (flag = 438) CoreDumpSvc INFO Handling signals: 11(Segmentation fault) 7(Bus error) 4(Illegal instruction) 8(Floating point exception) AthenaEventLoopMgr INFO Initializing AthenaEventLoopMgr - package version AthenaServices-00-00-00 -ClassIDSvc INFO getRegistryEntries: read 25634 CLIDRegistry entries for module ALL +ClassIDSvc INFO getRegistryEntries: read 23453 CLIDRegistry entries for module ALL CondInputLoader INFO Initializing CondInputLoader... PoolSvc INFO io_register[PoolSvc](xmlcatalog_file:PoolFileCatalog.xml) [ok] PoolSvc INFO Set connectionsvc retry/timeout/IDLE timeout to 'ConnectionRetrialPeriod':300/ 'ConnectionRetrialTimeOut':3600/ 'ConnectionTimeOut':5 seconds with connection cleanup disabled PoolSvc INFO Frontier compression level set to 5 -DBReplicaSvc INFO Read replica configuration from /home/sss/atlas/rootaccess/build/share/dbreplica.config +DBReplicaSvc INFO Frontier server at (serverurl=http://atlasfrontier-ai.cern.ch:8000/atlr)(serverurl=http://frontier-atlas.lcg.triumf.ca:3128/ATLAS_frontier)(serverurl=http://ccfrontier.in2p3.fr:23128/ccin2p3-AtlasFrontier)(proxyurl=http://atlasbpfrontier.cern.ch:3127)(proxyurl=http://atlasbpfrontier.fnal.gov:3127) will be considered for COOL data +DBReplicaSvc INFO Read replica configuration from /cvmfs/atlas-nightlies.cern.ch/repo/sw/master_Athena_x86_64-centos7-gcc8-opt/2020-07-20T2135/Athena/22.0.16/InstallArea/x86_64-centos7-gcc8-opt/share/dbreplica.config DBReplicaSvc INFO No specific match for domain found - use default fallback -DBReplicaSvc INFO Total of 1 servers found for host karma [atlas_dd ] +DBReplicaSvc INFO Total of 2 servers found for host 1fe14f8366e2 [ATLF atlas_dd ] PoolSvc INFO Successfully setup replica sorting algorithm PoolSvc INFO Setting up APR FileCatalog and Streams -PoolSvc INFO Resolved path (via ATLAS_POOLCOND_PATH) is /home/sss/atlas/DBRelease/poolcond/PoolFileCatalog.xml -PoolSvc INFO Resolved path (via DATAPATH) is /home/sss/atlas/DBRelease/current/poolcond/PoolCat_oflcond.xml -PoolSvc INFO Resolved path (via DATAPATH) is /home/sss/atlas/DBRelease/current/poolcond/PoolCat_oflcond.xml +PoolSvc INFO Resolved path (via ATLAS_POOLCOND_PATH) is /cvmfs/atlas-condb.cern.ch/repo/conditions/poolcond/PoolFileCatalog.xml +PoolSvc WARNING Unable to locate catalog for prfile:poolcond/PoolCat_oflcond.xml check your ATLAS_POOLCOND_PATH and DATAPATH variables +PoolSvc WARNING Unable to locate catalog for apcfile:poolcond/PoolCat_oflcond.xml check your ATLAS_POOLCOND_PATH and DATAPATH variables PoolSvc INFO POOL WriteCatalog is xmlcatalog_file:PoolFileCatalog.xml DbSession INFO Open DbSession Domain[ROOT_All] INFO > Access DbDomain READ [ROOT_All] IOVDbSvc INFO Opened read transaction for POOL PersistencySvc IOVDbSvc INFO Only 5 POOL conditions files will be open at once +IOVDbSvc INFO Cache alignment will be done in 3 slices IOVDbSvc INFO Global tag: OFLCOND-MC16-SDR-17 set from joboptions IOVDbSvc INFO Initialised with 2 connections and 1 folders IOVDbSvc INFO Service IOVDbSvc initialised successfully MetaDataSvc INFO Initializing MetaDataSvc - package version AthenaServices-00-00-00 AthenaPoolCnvSvc INFO Initializing AthenaPoolCnvSvc - package version AthenaPoolCnvSvc-00-00-00 MetaDataSvc INFO Found MetaDataTools = PublicToolHandleArray(['IOVDbMetaDataTool/IOVDbMetaDataTool']) +OutputStreamSeq... INFO Initializing OutputStreamSequencerSvc - package version AthenaServices-00-00-00 CondProxyProvider INFO Initializing CondProxyProvider - package version EventSelectorAthenaPool-00-00-00 Domain[ROOT_All] INFO -> Access DbDatabase READ [ROOT_All] BC292F26-AE73-9041-BF5C-BCE6C5C651EC -Domain[ROOT_All] INFO /home/sss/atlas/DBRelease/current/poolcond/cond09_mc.000079.gen.COND/cond09_mc.000079.gen.COND._0002.pool.root -RootDatabase.open INFO /home/sss/atlas/DBRelease/current/poolcond/cond09_mc.000079.gen.COND/cond09_mc.000079.gen.COND._0002.pool.root File version:53413 -ClassIDSvc INFO getRegistryEntries: read 1543 CLIDRegistry entries for module ALL +Domain[ROOT_All] INFO /cvmfs/atlas-condb.cern.ch/repo/conditions/cond09/cond09_mc.000079.gen.COND/cond09_mc.000079.gen.COND._0002.pool.root +RootDatabase.open INFO /cvmfs/atlas-condb.cern.ch/repo/conditions/cond09/cond09_mc.000079.gen.COND/cond09_mc.000079.gen.COND._0002.pool.root File version:53413 +ClassIDSvc INFO getRegistryEntries: read 1546 CLIDRegistry entries for module ALL IOVDbSvc INFO Opening COOL connection for COOLOFL_LAR/OFLP200 +warn [frontier.c:1025]: Request 1 on chan 1 failed at Tue Jul 21 15:04:18 2020: -9 [fn-socket.c:107]: network error on connect to 128.142.168.202:3127: No route to host +warn [frontier.c:1125]: Trying next proxy atlasbpfrontier.cern.ch[128.142.33.31] with same server atlasfrontier-ai.cern.ch +warn [frontier.c:1025]: Request 2 on chan 1 failed at Tue Jul 21 15:04:18 2020: -9 [fn-socket.c:107]: network error on connect to 128.142.33.31:3127: No route to host +warn [frontier.c:1125]: Trying next proxy atlasbpfrontier.fnal.gov with same server atlasfrontier-ai.cern.ch +warn [frontier.c:1025]: Request 3 on chan 1 failed at Tue Jul 21 15:04:18 2020: -9 [fn-socket.c:107]: network error on connect to 131.225.188.245:3127: No route to host +warn [frontier.c:1125]: Trying next proxy atlasbpfrontier.fnal.gov[131.225.188.246] with same server atlasfrontier-ai.cern.ch +warn [frontier.c:1025]: Request 4 on chan 1 failed at Tue Jul 21 15:04:18 2020: -9 [fn-socket.c:107]: network error on connect to 131.225.188.246:3127: No route to host +warn [frontier.c:1138]: Trying direct connect to server atlasfrontier-ai.cern.ch IOVSvc INFO No IOVSvcTool associated with store "StoreGateSvc" IOVSvc.IOVSvcTool INFO IOVRanges will be checked at every Event IOVDbSvc INFO Disconnecting from COOLOFL_LAR/OFLP200 IOVDbSvc INFO Added taginfo remove for /LAR/CellCorrOfl/deadOTX -/home/sss/atlas... INFO Database being retired... +/cvmfs/atlas-co... INFO Database being retired... Domain[ROOT_All] INFO -> Deaccess DbDatabase READ [ROOT_All] BC292F26-AE73-9041-BF5C-BCE6C5C651EC Domain[ROOT_All] INFO > Deaccess DbDomain READ [ROOT_All] EventPersistenc... INFO Added successfully Conversion service:McCnvSvc @@ -55,9 +65,9 @@ EventPersistenc... INFO Added successfully Conversion service:AthenaPoolCnvSvc DbSession INFO Open DbSession Domain[ROOT_All] INFO > Access DbDomain READ [ROOT_All] Domain[ROOT_All] INFO -> Access DbDatabase READ [ROOT_All] BC292F26-AE73-9041-BF5C-BCE6C5C651EC -Domain[ROOT_All] INFO /home/sss/atlas/DBRelease/current/poolcond/cond09_mc.000079.gen.COND/cond09_mc.000079.gen.COND._0002.pool.root -RootDatabase.open INFO /home/sss/atlas/DBRelease/current/poolcond/cond09_mc.000079.gen.COND/cond09_mc.000079.gen.COND._0002.pool.root File version:53413 -ClassIDSvc INFO getRegistryEntries: read 118 CLIDRegistry entries for module ALL +Domain[ROOT_All] INFO /cvmfs/atlas-condb.cern.ch/repo/conditions/cond09/cond09_mc.000079.gen.COND/cond09_mc.000079.gen.COND._0002.pool.root +RootDatabase.open INFO /cvmfs/atlas-condb.cern.ch/repo/conditions/cond09/cond09_mc.000079.gen.COND/cond09_mc.000079.gen.COND._0002.pool.root File version:53413 +ClassIDSvc INFO getRegistryEntries: read 110 CLIDRegistry entries for module ALL CondInputLoader INFO Adding base classes: + ( 'CondAttrListCollection' , 'ConditionStore+/LAR/CellCorrOfl/deadOTX' ) -> CondInputLoader INFO Will create WriteCondHandle dependencies for the following DataObjects: @@ -89,6 +99,14 @@ ApplicationMgr INFO Application Manager Started successfully AthenaEventLoopMgr INFO ===>>> start of run 284500 <<<=== AthenaEventLoopMgr INFO ===>>> start processing event #0, run #284500 0 events processed so far <<<=== IOVDbSvc INFO Opening COOL connection for COOLOFL_LAR/OFLP200 +warn [frontier.c:1025]: Request 1 on chan 2 failed at Tue Jul 21 15:04:18 2020: -9 [fn-socket.c:107]: network error on connect to 128.142.168.202:3127: No route to host +warn [frontier.c:1125]: Trying next proxy atlasbpfrontier.cern.ch[128.142.33.31] with same server atlasfrontier-ai.cern.ch +warn [frontier.c:1025]: Request 2 on chan 2 failed at Tue Jul 21 15:04:18 2020: -9 [fn-socket.c:107]: network error on connect to 128.142.33.31:3127: No route to host +warn [frontier.c:1125]: Trying next proxy atlasbpfrontier.fnal.gov with same server atlasfrontier-ai.cern.ch +warn [frontier.c:1025]: Request 3 on chan 2 failed at Tue Jul 21 15:04:18 2020: -9 [fn-socket.c:107]: network error on connect to 131.225.188.246:3127: No route to host +warn [frontier.c:1125]: Trying next proxy atlasbpfrontier.fnal.gov[131.225.188.245] with same server atlasfrontier-ai.cern.ch +warn [frontier.c:1025]: Request 4 on chan 2 failed at Tue Jul 21 15:04:18 2020: -9 [fn-socket.c:107]: network error on connect to 131.225.188.245:3127: No route to host +warn [frontier.c:1138]: Trying direct connect to server atlasfrontier-ai.cern.ch IOVDbFolder INFO HVS tag OFLCOND-MC16-SDR-17 resolved to LARCellCorrOflDeadOTX-000-00 for folder /LAR/CellCorrOfl/deadOTX IOVDbSvc INFO Disconnecting from COOLOFL_LAR/OFLP200 dumper1 INFO dumper.energyCalibrationTypes = [0, 0, 0, -1] @@ -2544,7 +2562,7 @@ dumper.gam55.region = 4 AthenaEventLoopMgr INFO ===>>> done processing event #0, run #284500 1 events processed so far <<<=== -/home/sss/atlas... INFO Database being retired... +/cvmfs/atlas-co... INFO Database being retired... Domain[ROOT_All] INFO -> Deaccess DbDatabase READ [ROOT_All] BC292F26-AE73-9041-BF5C-BCE6C5C651EC Domain[ROOT_All] INFO > Deaccess DbDomain READ [ROOT_All] ApplicationMgr INFO Application Manager Stopped successfully @@ -2553,16 +2571,16 @@ CondInputLoader INFO Finalizing CondInputLoader... IncidentProcAlg2 INFO Finalize EventSelector INFO finalize ToolSvc INFO Removing all tools created by ToolSvc -IOVDbFolder INFO Folder /LAR/CellCorrOfl/deadOTX (AttrListColl) db-read 1/1 objs/chan/bytes 1/1/705 (( 0.07 ))s -IOVDbSvc INFO bytes in (( 0.07 ))s +IOVDbFolder INFO Folder /LAR/CellCorrOfl/deadOTX (AttrListColl) db-read 1/1 objs/chan/bytes 1/1/705 (( 0.73 ))s +IOVDbSvc INFO bytes in (( 0.73 ))s IOVDbSvc INFO Connection sqlite://;schema=mycool.db;dbname=OFLP200 : nConnect: 0 nFolders: 0 ReadTime: (( 0.00 ))s -IOVDbSvc INFO Connection COOLOFL_LAR/OFLP200 : nConnect: 2 nFolders: 1 ReadTime: (( 0.07 ))s +IOVDbSvc INFO Connection COOLOFL_LAR/OFLP200 : nConnect: 2 nFolders: 1 ReadTime: (( 0.73 ))s *****Chrono***** INFO **************************************************************************************************** *****Chrono***** INFO The Final CPU consumption ( Chrono ) Table (ordered) *****Chrono***** INFO **************************************************************************************************** -cObjR_ALL INFO Time User : Tot= 20 [ms] Ave/Min/Max= 6.67(+- 4.71)/ 0/ 10 [ms] #= 3 +cObjR_ALL INFO Time User : Tot= 0 [us] Ave/Min/Max= 0(+- 0)/ 0/ 0 [us] #= 3 cObj_ALL INFO Time User : Tot= 40 [ms] Ave/Min/Max= 13.3(+- 12.5)/ 0/ 30 [ms] #= 3 -ChronoStatSvc INFO Time User : Tot= 290 [ms] #= 1 +ChronoStatSvc INFO Time User : Tot= 0.6 [s] #= 1 *****Chrono***** INFO **************************************************************************************************** ChronoStatSvc.f... INFO Service finalized successfully ApplicationMgr INFO Application Manager Finalized successfully diff --git a/Calorimeter/CaloUtils/share/ToolWithConstants_test.ref b/Calorimeter/CaloUtils/share/ToolWithConstants_test.ref index 66128c494658b61bc0d2fa66a593528234e94828..effb93abb5340053f06f8af040660b34511f2f96 100644 --- a/Calorimeter/CaloUtils/share/ToolWithConstants_test.ref +++ b/Calorimeter/CaloUtils/share/ToolWithConstants_test.ref @@ -5,17 +5,15 @@ Py:MetaReader INFO MetaReader is called with the parameter "unique_tag_in ApplicationMgr SUCCESS ==================================================================================================================================== Welcome to ApplicationMgr (GaudiCoreSvc v33r1) - running on lxplus723.cern.ch on Tue May 26 21:09:45 2020 + running on 1fe14f8366e2 on Tue Jul 21 15:04:26 2020 ==================================================================================================================================== ApplicationMgr INFO Application Manager Configured successfully -PublicTool tool1 -PublicTool tool2 CoreDumpSvc INFO install f-a-t-a-l handler... (flag = 438) CoreDumpSvc INFO Handling signals: 11(Segmentation fault) 7(Bus error) 4(Illegal instruction) 8(Floating point exception) AthenaEventLoopMgr INFO Initializing AthenaEventLoopMgr - package version AthenaServices-00-00-00 PyComponentMgr INFO Initializing PyComponentMgr... TestAlg INFO Initializing TestAlg... -ClassIDSvc INFO getRegistryEntries: read 21188 CLIDRegistry entries for module ALL +ClassIDSvc INFO getRegistryEntries: read 20810 CLIDRegistry entries for module ALL ClassIDSvc INFO getRegistryEntries: read 423 CLIDRegistry entries for module ALL EventSelector INFO Enter McEventSelector Initialization AthenaEventLoopMgr INFO Setup EventSelector service EventSelector diff --git a/Control/AthenaConfiguration/python/ComponentAccumulator.py b/Control/AthenaConfiguration/python/ComponentAccumulator.py index 4d71649ddbbe2517e70d9f9ca9347ee488d63106..a6cff972939920241b535b2bd4f4be43ee07f71d 100644 --- a/Control/AthenaConfiguration/python/ComponentAccumulator.py +++ b/Control/AthenaConfiguration/python/ComponentAccumulator.py @@ -7,6 +7,7 @@ from AthenaCommon.CFElements import isSequence,findSubSequence,findAlgorithm,fla from AthenaConfiguration.ComponentFactory import CompFactory #from AthenaConfiguration.AlgSequence import AthSequencer from AthenaCommon.Debugging import DbgStage +from AthenaCommon.Constants import INFO import GaudiKernel.GaudiHandles as GaudiHandles import GaudiConfig2 @@ -602,141 +603,152 @@ class ComponentAccumulator(object): return - def createApp(self,OutputLevel=3): - from GaudiConfig2._configurables import Configurable - #Convenice hack - Configurable.getFullName = lambda self: "{}/{}".format(self.__cpp_type__,self.name) - - + def createApp(self, OutputLevel=INFO): # Create the Gaudi object early. # Without this here, pyroot can sometimes get confused # and report spurious type mismatch errors about this object. import ROOT ROOT.Gaudi - self._wasMerged=True + appPropsToSet, mspPropsToSet, bshPropsToSet = self.gatherProps(OutputLevel) + + self._wasMerged = True from Gaudi.Main import BootstrapHelper - bsh=BootstrapHelper() - app=bsh.createApplicationMgr() - for (k,v) in six.iteritems(self._theAppProps): - app.setProperty(k,str(v)) + bsh = BootstrapHelper() + app = bsh.createApplicationMgr() + + for k, v in appPropsToSet.items(): + self._msg.debug("Setting property %s : %s", k, v) + app.setProperty(k, v) + + app.configure() + + msp = app.getService("MessageSvc") + for k, v in mspPropsToSet.items(): + self._msg.debug("Setting property %s : %s", k, v) + bsh.setProperty(msp, k.encode(), v.encode()) + + # Feed the jobO service with the remaining options + jos = app.getService("JobOptionsSvc") + for comp, name, value in bshPropsToSet: + self._msg.debug("Adding %s.%s = %s", comp, name, value) + bsh.addPropertyToCatalogue( + jos, comp.encode(), name.encode(), value.encode() + ) - #Assemble createSvc property: - svcToCreate=[] - extSvc=[] + sys.stdout.flush() + return app + + def gatherProps(self, OutputLevel=INFO): + from GaudiConfig2._configurables import Configurable + + # Convenice hack + Configurable.getFullName = lambda self: "{}/{}".format( + self.__cpp_type__, self.name + ) + + appPropsToSet = {} + mspPropsToSet = {} + bshPropsToSet = [] + for (k, v) in six.iteritems(self._theAppProps): + appPropsToSet[k] = str(v) + + svcToCreate = [] + extSvc = [] for svc in self._services: - extSvc+=[svc.getFullJobOptName(),] + extSvc += [ + svc.getFullJobOptName(), + ] if svc.name in self._servicesToCreate: svcToCreate.append(svc.getFullJobOptName()) - extSvc.append('PyAthena::PyComponentMgr/PyComponentMgr') - #print (self._services) - #print (extSvc) - #print (svcToCreate) - app.setProperty("ExtSvc",str(extSvc)) - app.setProperty("CreateSvc",str(svcToCreate)) + extSvc.append("PyAthena::PyComponentMgr/PyComponentMgr") - app.configure() + appPropsToSet["ExtSvc"] = str(extSvc) + appPropsToSet["CreateSvc"] = str(svcToCreate) - msp=app.getService("MessageSvc") - bsh.setProperty(msp,b"OutputLevel",str(OutputLevel).encode()) - #Feed the jobO service with the remaining options - jos=app.getService("JobOptionsSvc") + mspPropsToSet["OutputLevel"] = str(OutputLevel) - def addCompToJos(comp,namePrefix=""): - name=namePrefix+comp.getName() + def getCompsToBeAdded(comp, namePrefix=""): + name = namePrefix + comp.getName() for k, v in comp._properties.items(): - #Handle special cases of properties: - #1.PrivateToolHandles - if isinstance(v,Configurable): - self._msg.debug("Adding private tool "+name+"."+k+" = "+v.getFullName()) - #Add the name of the tool as property to the parent - bsh.addPropertyToCatalogue(jos,name.encode(),k.encode(),v.getFullName().encode()) - #Recursivly add properties of this tool to the JobOptionSvc - addCompToJos(v,namePrefix=name+".") - #2. PrivateToolHandleArray - elif isinstance(v,GaudiHandles.PrivateToolHandleArray): - #Add names of tools as properties to the parent - bsh.addPropertyToCatalogue(jos,name.encode(),k.encode(),str([ v1.getFullName() for v1 in v ]).encode()) - #Recusivly add properties of tools to JobOptionsSvc + # Handle special cases of properties: + # 1.PrivateToolHandles + if isinstance(v, Configurable): + # Add the name of the tool as property to the parent + bshPropsToSet.append((name, k, v.getFullName())) + # Recursivly add properties of this tool to the JobOptionSvc + getCompsToBeAdded(v, namePrefix=name + ".") + # 2. PrivateToolHandleArray + elif isinstance(v, GaudiHandles.PrivateToolHandleArray): + # Add names of tools as properties to the parent + bshPropsToSet.append( + (name, k, str([v1.getFullName() for v1 in v]),) + ) + # Recusivly add properties of tools to JobOptionsSvc for v1 in v: - addCompToJos(v1,namePrefix=name+".") - else: - if not isSequence(comp) and k!="Members": #This property his handled separatly - if v is None: - vstr="" - else: - vstr=str(v) - self._msg.debug("Adding "+name+"."+k+" = "+vstr) - bsh.addPropertyToCatalogue(jos,name.encode(),k.encode(),vstr.encode()) - pass - pass - return + getCompsToBeAdded(v1, namePrefix=name + ".") + elif ( + not isSequence(comp) and k != "Members" + ): # This property his handled separatly + vstr = "" if v is None else str(v) + bshPropsToSet.append((name, k, vstr)) - #Add services for svc in self._services: - if svc.getName()=="MessageSvc": - #Message svc exists already! Needs special treatment - for k, v in svc._properties.items(): - bsh.setProperty(msp,k.encode(),str(v).encode()) + if ( + svc.getName() != "MessageSvc" + ): # MessageSvc will exist already! Needs special treatment + getCompsToBeAdded(svc) else: - addCompToJos(svc) - pass - - #Add tree of algorithm sequences: + for k, v in svc._properties.items(): + mspPropsToSet[k] = str(v) try: from AthenaPython import PyAthenaComps + PyAlg = PyAthenaComps.Alg except ImportError: PyAlg = type(None) - for seqName, algoList in six.iteritems(flatSequencers( self._sequence, algsCollection=self._algorithms )): - self._msg.debug("Members of %s : %s", seqName, str([alg.getFullName() for alg in algoList])) - + for seqName, algoList in six.iteritems( + flatSequencers(self._sequence, algsCollection=self._algorithms) + ): seq = self.getSequence(seqName) for k, v in seq._properties.items(): - if k!="Members": #This property his handled separatly - if v is None: - vstr="" - else: - vstr=str(v) - self._msg.debug("Adding "+seqName+"."+k+" = "+vstr) - bsh.addPropertyToCatalogue(jos,seqName.encode(),k.encode(),vstr.encode()) - pass - - bsh.addPropertyToCatalogue(jos,seqName.encode(),b"Members",str( [alg.getFullName() for alg in algoList]).encode()) + if k != "Members": # This property his handled separatly + vstr = "" if v is None else str(v) + bshPropsToSet.append((seqName, k, vstr)) + bshPropsToSet.append( + (seqName, "Members", str([alg.getFullName() for alg in algoList]),) + ) for alg in algoList: - if isinstance (alg, PyAlg): #Hack for py-algs deriving from old-style configurables - alg._properties=alg.getValuedProperties() - if 'OutputLevel' not in alg._properties: alg._properties['OutputLevel']=0 - pass - addCompToJos(alg) - if isinstance (alg, PyAlg): - alg.setup2() - pass + if isinstance( + alg, PyAlg + ): # Hack for py-algs deriving from old-style configurables + alg._properties = alg.getValuedProperties() + if "OutputLevel" not in alg._properties: + alg._properties["OutputLevel"] = 0 + getCompsToBeAdded(alg) + + if isinstance(alg, PyAlg): + alg.setup2() - condalgseq=[] + condalgseq = [] for alg in self._conditionsAlgs: - addCompToJos(alg) + getCompsToBeAdded(alg) condalgseq.append(alg.getFullName()) - bsh.addPropertyToCatalogue(jos,b"AthCondSeq",b"Members",str(condalgseq).encode()) - if isinstance (alg, PyAlg): + bshPropsToSet.append(("AthCondSeq", "Members", str(condalgseq))) + if isinstance(alg, PyAlg): alg.setup2() - pass - #Public Tools: for pt in self._publicTools: - print ("PublicTool ",pt.name) - pt.name="ToolSvc."+pt.name - addCompToJos(pt) - pass - sys.stdout.flush() + pt.name = "ToolSvc." + pt.name + getCompsToBeAdded(pt) - return app + return appPropsToSet, mspPropsToSet, bshPropsToSet - def run(self,maxEvents=None,OutputLevel=3): + def run(self,maxEvents=None,OutputLevel=INFO): # Make sure python output is flushed before triggering output from Gaudi. # Otherwise, observed output ordering may differ between py2/py3. sys.stdout.flush() diff --git a/Control/AthenaConfiguration/share/new_confTool.py b/Control/AthenaConfiguration/share/new_confTool.py index 495513e37dfacf8b00f90173fd1cbba0d44bfa3b..8f893b9fab8dd3e563fc697e25afad100717c3ca 100644 --- a/Control/AthenaConfiguration/share/new_confTool.py +++ b/Control/AthenaConfiguration/share/new_confTool.py @@ -20,6 +20,19 @@ def main(args): conf = _loadSingleFile(fileName) conf.printConfig(withDetails=True) + if args.toJSON: + if len(args.file) != 1: + sys.exit("ERROR, can convert single file at a time, got: %s" % args.file) + conf = _loadSingleFile(args.file[0]) + with open(args.toJSON, "w") as oFile: + props = conf.gatherProps() + jos_props = props[2] # to make json compatible with old configuration + to_json = {} + for comp, name, value in jos_props: + to_json.setdefault(comp, {})[name] = value + to_json[comp][name] = value + json.dump([[], to_json], oFile) + if args.toPickle: if len(args.file) != 1: sys.exit("ERROR, can convert single file at a time, got: %s" % args.file) diff --git a/Control/AthenaConfiguration/share/old_confTool.py b/Control/AthenaConfiguration/share/old_confTool.py index 23f20d6b3dbdd79d5ab7097d476bb7d1720b87d7..8104bfe637b70843ef7a0a4b0d6ee44e05f7496b 100644 --- a/Control/AthenaConfiguration/share/old_confTool.py +++ b/Control/AthenaConfiguration/share/old_confTool.py @@ -83,6 +83,7 @@ def _loadSingleFile(fname, args): with open(fname, "r") as input_file: conf = json.load(input_file, object_hook=__keepPlainStrings) + print("... Read", len(conf), "items from JSON file: ", fname) else: @@ -226,9 +227,15 @@ def _compareComponent(compRef, compChk, prefix, args, component): refVal, chkVal, "\t" + prefix + ">> ", args, component ) - elif isinstance(compRef, list) and len(compRef) > 1: + elif isinstance(compRef, (list, tuple)) and len(compRef) > 1: + if isinstance(compRef[0], list): # to achieve hashability + compChk = [tuple(el) for el in compRef] + if len(compChk) > 0 and isinstance(compChk[0], list): + compChk = [tuple(el) for el in compChk] + diffRef = list(set(compRef) - set(compChk)) diffChk = list(set(compChk) - set(compRef)) + if diffRef: print( "%s exists only in Ref : \033[92m %s \033[0m \033[91m<< !!!\033[0m" diff --git a/DataQuality/DataQualityConfigurations/config/Global/heavyions_run.config b/DataQuality/DataQualityConfigurations/config/Global/heavyions_run.config index ad0814db3760b46b1aed0a4e9f8d2d6e6c3b728d..1a2c6d9ff9d6291d1b74157f85cc4446c057bbe4 100644 --- a/DataQuality/DataQualityConfigurations/config/Global/heavyions_run.config +++ b/DataQuality/DataQualityConfigurations/config/Global/heavyions_run.config @@ -76,7 +76,7 @@ dir GLOBAL { algorithm = GLOBAL_GatherData/ref dir Luminosity { - reference = CentrallyManagedReferences + reference = CentrallyManagedReferences_HardProbes dir AnyTrigger { output = Global/Luminosity/AnyTrigger hist aveMu_vs_LB { @@ -595,7 +595,7 @@ dir GLOBAL { # } # } dir DQTCaloCluster { - reference = CentrallyManagedReferences + reference = CentrallyManagedReferences_HardProbes dir DQTCaloCluster { output = Global/CaloCluster hist all_in_dir { @@ -603,7 +603,7 @@ dir GLOBAL { } } dir DQTGlobalWZFinder { - reference = CentrallyManagedReferences + reference = CentrallyManagedReferences_HardProbes dir DQTGlobalWZFinder { output = Global/WZFinder hist all_in_dir { @@ -641,7 +641,7 @@ dir GLOBAL { } } dir DQTMuonIDTrack { - reference = CentrallyManagedReferences + reference = CentrallyManagedReferences_HardProbes dir Trk { output = Global/MuonInnerDetector hist all_in_dir { @@ -729,7 +729,7 @@ dir GLOBAL { } } dir DQTRateMonTool { - reference = CentrallyManagedReferences + reference = CentrallyManagedReferences_HardProbes dir DQTRateMonTool { output = Global/DQShift hist e_gm_presence { @@ -762,7 +762,7 @@ dir GLOBAL { } } dir DQTSynch { - reference = CentrallyManagedReferences + reference = CentrallyManagedReferences_HardProbes dir BCID { output = Global/Synchronization/BCID hist m_diff_CTP_SCT_BCID { @@ -1111,7 +1111,7 @@ dir GLOBAL { } dir DQTBackgroundMon { - reference = CentrallyManagedReferences + reference = CentrallyManagedReferences_HardProbes algorithm = BKG_GatherData/ref dir BackgroundMon { output = Global/Background @@ -1187,7 +1187,7 @@ algorithm GLOBAL_GatherData { libname = libdqm_algorithms.so name = GatherData algorithm ref { - reference = CentrallyManagedReferences + reference = CentrallyManagedReferences_HardProbes } } @@ -1195,7 +1195,7 @@ algorithm BKG_GatherData { libname = libdqm_algorithms.so name = GatherData algorithm ref { - reference = CentrallyManagedReferences + reference = CentrallyManagedReferences_HardProbes } } diff --git a/DataQuality/DataQualityConfigurations/config/HLT/HLTtau/collisions_run.config b/DataQuality/DataQualityConfigurations/config/HLT/HLTtau/collisions_run.config index 70d314ca99740b3bae37b12e2b053682ba9d0666..7683d833bd65dfced0c5cd58535e3d4e129d5c19 100644 --- a/DataQuality/DataQualityConfigurations/config/HLT/HLTtau/collisions_run.config +++ b/DataQuality/DataQualityConfigurations/config/HLT/HLTtau/collisions_run.config @@ -17050,6 +17050,7 @@ reference HLT_TauTrigger_ExpressReference { file = data18_13TeV.00362661.express_express.merge.HIST.f993_h325._0001.1 path = run_362661 name = same_name + info = Run 362661, express_express } reference HLT_TauTrigger_MainReference { @@ -17057,4 +17058,5 @@ reference HLT_TauTrigger_MainReference { file = data18_13TeV.00362661.physics_Main.merge.HIST.f993_h325._0001.1 path = run_362661 name = same_name + info = Run 362661, physics_Main } diff --git a/DataQuality/DataQualityConfigurations/config/L1Calo/collisions_run.config b/DataQuality/DataQualityConfigurations/config/L1Calo/collisions_run.config index a2b0be248ccfc07a7343c9433ac4e76e4fc06403..972a9051e514690cde24aa0ef2b97e1bf4cfbd84 100644 --- a/DataQuality/DataQualityConfigurations/config/L1Calo/collisions_run.config +++ b/DataQuality/DataQualityConfigurations/config/L1Calo/collisions_run.config @@ -1,21 +1,3 @@ -# ********************************************************************** -# Id: collisions_run.config 752503 2016-06-03 15:56:33Z jfrost -# ./common/collisions_run.config -# ********************************************************************** - -############# -# Output -############# - -output top_level { - algorithm = WorstCaseSummary -} - -# ********************************************************************** -# Id: collisions_run.config 748046 2016-05-18 14:03:03Z kwhalen -# ./L1Calo/collisions_run.config -# ********************************************************************** - ############# # Output ############# @@ -3640,7 +3622,6 @@ dir HLT { dir L1Calo { hist res_etVsEta@gsEM22VHI { display = StatBox - reference = stream=physics_Main:CentrallyManagedReferences_TriggerMain;CentrallyManagedReferences_Trigger output = L1Calo/.GlobalSummary/EGamma description = Original location HLT/TREG/Expert/L1_EM22VHI/AbsResolutions/L1Calo. https://twiki.cern.ch/twiki/bin/view/Atlas/TrigEgammaDataQualityAndMonitoring } @@ -3650,7 +3631,6 @@ dir HLT { dir L1Calo { hist emClusVsEmIsol@gsEM22VHI { display = StatBox - reference = stream=physics_Main:CentrallyManagedReferences_TriggerMain;CentrallyManagedReferences_Trigger output = L1Calo/.GlobalSummary/EGamma description = Original location HLT/TREG/Expert/L1_EM22VHI/Distributions/L1Calo. https://twiki.cern.ch/twiki/bin/view/Atlas/TrigEgammaDataQualityAndMonitoring } @@ -3660,7 +3640,6 @@ dir HLT { dir L1Calo { hist eff_et@gsEM22VHI { display = StatBox - reference = stream=physics_Main:CentrallyManagedReferences_TriggerMain;CentrallyManagedReferences_Trigger output = L1Calo/.GlobalSummary/EGamma description = Original location HLT/TREG/Expert/L1_EM22VHI/Efficiency/L1Calo } @@ -3672,7 +3651,6 @@ dir HLT { dir L1Calo { hist emClusVsEmIsol@gsEM20VH { display = StatBox - reference = stream=physics_Main:CentrallyManagedReferences_TriggerMain;CentrallyManagedReferences_Trigger output = L1Calo/.GlobalSummary/EGamma description = Original location HLT/TREG/Expert/L1_EM20VH/Distributions/L1Calo. https://twiki.cern.ch/twiki/bin/view/Atlas/TrigEgammaDataQualityAndMonitoring } @@ -3682,7 +3660,6 @@ dir HLT { dir L1Calo { hist eff_et@gsEM20VH { display = StatBox - reference = stream=physics_Main:CentrallyManagedReferences_TriggerMain;CentrallyManagedReferences_Trigger output = L1Calo/.GlobalSummary/EGamma description = Original location HLT/TREG/Expert/L1_EM20VH/Efficiency/L1Calo. https://twiki.cern.ch/twiki/bin/view/Atlas/TrigEgammaDataQualityAndMonitoring } @@ -3696,14 +3673,12 @@ dir HLT { dir lowest_singletau { dir TurnOnCurves { hist TProfRecoL1PtEfficiency_shifter@gs { - reference = stream=physics_Main:CentrallyManagedReferences_TriggerMain;CentrallyManagedReferences_Trigger algorithm = TAU_HistKolmogorovTest_MaxDist display = StatBox output = L1Calo/.GlobalSummary/TAU description = Original location HLT/TRTAU/Shifter/lowest_singletau/TurnOnCurves } hist TProfRecoL1EtaEfficiency_shifter@gs { - reference = stream=physics_Main:CentrallyManagedReferences_TriggerMain;CentrallyManagedReferences_Trigger algorithm = TAU_HistKolmogorovTest_MaxDist display = StatBox output = L1Calo/.GlobalSummary/TAU @@ -3717,7 +3692,7 @@ dir HLT { dir GLOBAL { algorithm = GLOBAL_GatherData/ref - reference = stream=physics_Main:CentrallyManagedReferences_TriggerMain;CentrallyManagedReferences_Trigger + reference = CentrallyManagedReferences_TriggerMain dir Luminosity { dir AnyTrigger { hist aveMu_vs_LB@gs { @@ -3742,7 +3717,7 @@ dir GLOBAL { dir L1Calo { algorithm = L1Calo_GatherData - reference = stream=physics_Main:CentrallyManagedReferences_TriggerMain;CentrallyManagedReferences_Trigger + reference = CentrallyManagedReferences_TriggerMain output = L1Calo dir .GlobalSummary { dir LumiRanges { @@ -5744,7 +5719,7 @@ thresholds L1Calo_JetEfficiencies { dir LVL1_Interfaces { algorithm = LVL1Iface_GatherData - reference = stream=physics_Main:CentrallyManagedReferences_TriggerMain;CentrallyManagedReferences_Trigger + reference = CentrallyManagedReferences_TriggerMain dir L1Topo { hist l1topo_1d_CMXTobs { output = L1Interfaces/L1Topo diff --git a/DataQuality/DataQualityConfigurations/config/L1Calo/cosmics_run.config b/DataQuality/DataQualityConfigurations/config/L1Calo/cosmics_run.config index 6974d91e363a9ec012f9beaff0c39ebb0ff545c8..af64a912dc1b8550fc2dd989de2cde5820a1b9d2 100644 --- a/DataQuality/DataQualityConfigurations/config/L1Calo/cosmics_run.config +++ b/DataQuality/DataQualityConfigurations/config/L1Calo/cosmics_run.config @@ -1,7 +1,3 @@ -# ********************************************************************** -# $Id: cosmics_run.config 778796 2016-10-17 12:48:58Z jbarkelo $ -# ********************************************************************** - ############# # Output ############# @@ -3627,7 +3623,6 @@ dir HLT { dir L1Calo { hist res_etVsEta@gsEM22VHI { display = StatBox - reference = stream=physics_Main:CentrallyManagedReferences_TriggerMain;CentrallyManagedReferences_Trigger output = L1Calo/.GlobalSummary/EGamma description = Original location HLT/TREG/Expert/L1_EM22VHI/AbsResolutions/L1Calo. https://twiki.cern.ch/twiki/bin/view/Atlas/TrigEgammaDataQualityAndMonitoring } @@ -3637,7 +3632,6 @@ dir HLT { dir L1Calo { hist emClusVsEmIsol@gsEM22VHI { display = StatBox - reference = stream=physics_Main:CentrallyManagedReferences_TriggerMain;CentrallyManagedReferences_Trigger output = L1Calo/.GlobalSummary/EGamma description = Original location HLT/TREG/Expert/L1_EM22VHI/Distributions/L1Calo. https://twiki.cern.ch/twiki/bin/view/Atlas/TrigEgammaDataQualityAndMonitoring } @@ -3647,7 +3641,6 @@ dir HLT { dir L1Calo { hist eff_et@gsEM22VHI { display = StatBox - reference = stream=physics_Main:CentrallyManagedReferences_TriggerMain;CentrallyManagedReferences_Trigger output = L1Calo/.GlobalSummary/EGamma description = Original location HLT/TREG/Expert/L1_EM22VHI/Efficiency/L1Calo } @@ -3659,7 +3652,6 @@ dir HLT { dir L1Calo { hist emClusVsEmIsol@gsEM20VH { display = StatBox - reference = stream=physics_Main:CentrallyManagedReferences_TriggerMain;CentrallyManagedReferences_Trigger output = L1Calo/.GlobalSummary/EGamma description = Original location HLT/TREG/Expert/L1_EM20VH/Distributions/L1Calo. https://twiki.cern.ch/twiki/bin/view/Atlas/TrigEgammaDataQualityAndMonitoring } @@ -3669,7 +3661,6 @@ dir HLT { dir L1Calo { hist eff_et@gsEM20VH { display = StatBox - reference = stream=physics_Main:CentrallyManagedReferences_TriggerMain;CentrallyManagedReferences_Trigger output = L1Calo/.GlobalSummary/EGamma description = Original location HLT/TREG/Expert/L1_EM20VH/Efficiency/L1Calo. https://twiki.cern.ch/twiki/bin/view/Atlas/TrigEgammaDataQualityAndMonitoring } @@ -3683,14 +3674,12 @@ dir HLT { dir lowest_singletau { dir TurnOnCurves { hist TProfRecoL1PtEfficiency_shifter@gs { - reference = stream=physics_Main:CentrallyManagedReferences_TriggerMain;CentrallyManagedReferences_Trigger algorithm = GatherData display = StatBox output = L1Calo/.GlobalSummary/TAU description = Original location HLT/TRTAU/Shifter/lowest_singletau/TurnOnCurves } hist TProfRecoL1EtaEfficiency_shifter@gs { - reference = stream=physics_Main:CentrallyManagedReferences_TriggerMain;CentrallyManagedReferences_Trigger algorithm = GatherData display = StatBox output = L1Calo/.GlobalSummary/TAU @@ -3704,7 +3693,7 @@ dir HLT { dir GLOBAL { algorithm = GatherData - reference = stream=physics_Main:CentrallyManagedReferences_TriggerMain;CentrallyManagedReferences_Trigger + reference = CentrallyManagedReferences_TriggerMain dir Luminosity { dir AnyTrigger { hist aveMu_vs_LB@gs { @@ -3733,7 +3722,7 @@ dir GLOBAL { dir L1Calo { algorithm = L1Calo_GatherData - reference = stream=physics_Main:CentrallyManagedReferences_TriggerMain;CentrallyManagedReferences_Trigger + reference = CentrallyManagedReferences_TriggerMain output = L1Calo dir PPM { dir SpareChannels { @@ -5719,7 +5708,7 @@ thresholds L1Calo_JetEfficiencies { dir LVL1_Interfaces { algorithm = LVL1Iface_GatherData - reference = stream=physics_Main:CentrallyManagedReferences_TriggerMain;CentrallyManagedReferences_Trigger + reference = CentrallyManagedReferences_TriggerMain dir L1Topo { hist l1topo_1d_CMXTobs { output = L1Interfaces/L1Topo diff --git a/DataQuality/DataQualityConfigurations/config/L1Calo/heavyions_run.config b/DataQuality/DataQualityConfigurations/config/L1Calo/heavyions_run.config index 8318f55c566682c07235b9eb215b76a5b46424bd..a66aded342333790bd05bc7687a6e4a790d447cb 100644 --- a/DataQuality/DataQualityConfigurations/config/L1Calo/heavyions_run.config +++ b/DataQuality/DataQualityConfigurations/config/L1Calo/heavyions_run.config @@ -1,7 +1,3 @@ -# ********************************************************************** -# $Id: heavyions_run.config 778796 2016-10-17 12:48:58Z jbarkelo $ -# ********************************************************************** - ############# # Output ############# @@ -5734,7 +5730,7 @@ thresholds L1Calo_JetEfficiencies { dir LVL1_Interfaces { algorithm = LVL1Iface_GatherData #reference = stream=physics_Main:CentrallyManagedReferences_TriggerMain;CentrallyManagedReferences_Trigger - reference = stream=physics_Main:CentrallyManagedReferences_TriggerMain;stream=physics_HardProbes:CentrallyManagedReferences_TriggerHardProbes;stream=physics_UPC:CentrallyManagedReferences_TriggerUPC;CentrallyManagedReferences_Trigger + reference = CentrallyManagedReferences_TriggerHardProbes dir L1Topo { hist l1topo_1d_CMXTobs { output = L1Interfaces/L1Topo diff --git a/DataQuality/DataQualityConfigurations/config/TGC/collisions_run.config b/DataQuality/DataQualityConfigurations/config/TGC/collisions_run.config index dedb3230ac751c46265f84de81d84bb8d23114a7..20bd3736fcaf223e7233fa6f6abf2befc4807b4b 100644 --- a/DataQuality/DataQualityConfigurations/config/TGC/collisions_run.config +++ b/DataQuality/DataQualityConfigurations/config/TGC/collisions_run.config @@ -16,12 +16,14 @@ reference TGCShift2015thr_Ref { file = data15_13TeV.00279813.express_express.merge.HIST.f628_h79._0001.1 path = run_279813 name = same_name + info = Run 279813, express_express } reference TGCShift2016thr_Ref { location = /eos/atlas/atlascerngroupdisk/data-dqm/references/,root://eosatlas.cern.ch//eos/atlas/atlascerngroupdisk/data-dqm/references/ file = data16_13TeV.00304008.express_express.merge.HIST.f716_h151._0001.1 path = run_304008 name = same_name + info = Run 304008, express_express } ############# diff --git a/DataQuality/DataQualityConfigurations/config/Tile/collisions_run.config b/DataQuality/DataQualityConfigurations/config/Tile/collisions_run.config index 2b615a28abaec1d3722e52a49f6c32521f35d8c6..9d29a1ecabb707fb0a7aa62839e9d3f542dc8dc8 100644 --- a/DataQuality/DataQualityConfigurations/config/Tile/collisions_run.config +++ b/DataQuality/DataQualityConfigurations/config/Tile/collisions_run.config @@ -40,6 +40,7 @@ reference TileReference { file = data12_8TeV.00214160.express_express.merge.HIST.f486_m1252_harkusha_20150704._0001.1 path = run_214160 name = same_name + info = Run 214160, express_express } ############# diff --git a/DataQuality/DataQualityConfigurations/config/Tile/cosmics_run.config b/DataQuality/DataQualityConfigurations/config/Tile/cosmics_run.config index 1bc98e75c0680d630b4a80facc9c5e58b6634ee5..9440b3a35ccb8211c9fe962fe7dd6a09074ddfdf 100644 --- a/DataQuality/DataQualityConfigurations/config/Tile/cosmics_run.config +++ b/DataQuality/DataQualityConfigurations/config/Tile/cosmics_run.config @@ -31,6 +31,7 @@ reference TileReference { file = data12_cos.00214303.express_express.merge.HIST.f487_m1252_harkusha_20141116._0001.1 path = run_214303 name = same_name + info = Run 214303, express_express } diff --git a/DataQuality/DataQualityConfigurations/config/Tile/heavyions_run.config b/DataQuality/DataQualityConfigurations/config/Tile/heavyions_run.config index 0925ff38e63c473aba09b957af3ac5794865072d..7f91ce916a82efa23ff4e48ee737e9d286cdcf7a 100644 --- a/DataQuality/DataQualityConfigurations/config/Tile/heavyions_run.config +++ b/DataQuality/DataQualityConfigurations/config/Tile/heavyions_run.config @@ -39,6 +39,7 @@ reference TileReference { file = data13_hip.00217999.express_express.merge.HIST.f514_m1291_harkusha_20151029._0001.1 path = run_217999 name = same_name + info = Run 217999, express_express } ############# diff --git a/DataQuality/DataQualityConfigurations/config/common/collisions_run.config b/DataQuality/DataQualityConfigurations/config/common/collisions_run.config index 77dd696f39238633ffb5edae71ef1ee476fd1b14..9da3e17599e6e20302f18274a15c31f8b2d9b23c 100644 --- a/DataQuality/DataQualityConfigurations/config/common/collisions_run.config +++ b/DataQuality/DataQualityConfigurations/config/common/collisions_run.config @@ -1,7 +1,3 @@ -# ********************************************************************** -# $Id: collisions_run.config 778145 2016-10-12 22:16:13Z jfrost $ -# ********************************************************************** - ####################### # References ####################### @@ -127,4 +123,5 @@ compositeAlgorithm GatherData&Chi2NDF { output top_level { algorithm = WorstCaseSummary + reference = CentrallyManagedReferences } diff --git a/DataQuality/DataQualityConfigurations/config/common/cosmics_run.config b/DataQuality/DataQualityConfigurations/config/common/cosmics_run.config index a4d41029c33019fbc876e473ad5c9b0cc3573e9e..3327a54eaed4566a8927d464c52c5187c3e71949 100644 --- a/DataQuality/DataQualityConfigurations/config/common/cosmics_run.config +++ b/DataQuality/DataQualityConfigurations/config/common/cosmics_run.config @@ -1,7 +1,3 @@ -# ********************************************************************** -# $Id$ -# ********************************************************************** - ####################### # References ####################### @@ -119,4 +115,5 @@ compositeAlgorithm GatherData&Chi2NDF { output top_level { algorithm = WorstCaseSummary + reference = CentrallyManagedReferences } diff --git a/DataQuality/DataQualityConfigurations/config/common/heavyions_run.config b/DataQuality/DataQualityConfigurations/config/common/heavyions_run.config index 0920c5e11efec2d42871f017f78565d7e4906f06..51be8d8f9cec6fd2c81b7b06c43915865135d58f 100644 --- a/DataQuality/DataQualityConfigurations/config/common/heavyions_run.config +++ b/DataQuality/DataQualityConfigurations/config/common/heavyions_run.config @@ -1,7 +1,3 @@ -# ********************************************************************** -# $Id$ -# ********************************************************************** - ####################### # References ####################### @@ -38,7 +34,7 @@ reference CentrallyManagedReferences_TriggerMain { name = same_name } -reference CentrallyManagedReference_UPC { +reference CentrallyManagedReferences_UPC { location = /eos/atlas/atlascerngroupdisk/data-dqm/references/,root://eosatlas.cern.ch//eos/atlas/atlascerngroupdisk/data-dqm/references/ file = data18_hi.00365678.physics_UPC.merge.HIST.f1022_h331._0001.1 path = run_365678 @@ -54,7 +50,7 @@ reference CentrallyManagedReferences_TriggerUPC { name = same_name } -reference CentrallyManagedReference_HardProbes { +reference CentrallyManagedReferences_HardProbes { location = /eos/atlas/atlascerngroupdisk/data-dqm/references/,root://eosatlas.cern.ch//eos/atlas/atlascerngroupdisk/data-dqm/references/ file = data18_hi.00365678.physics_HardProbes.merge.HIST.f1021_h331._0001.1 path = run_365678 @@ -150,4 +146,5 @@ compositeAlgorithm GatherData&Chi2NDF { output top_level { algorithm = WorstCaseSummary + reference = CentrallyManagedReferences_HardProbes } diff --git a/DataQuality/DataQualityConfigurations/python/base_data.py b/DataQuality/DataQualityConfigurations/python/base_data.py index 2102ff7f4bae5cda093485090fcc4e9731da0d70..67a8f1e210d62c7b7e42c8b44d66ca9641768de3 100644 --- a/DataQuality/DataQualityConfigurations/python/base_data.py +++ b/DataQuality/DataQualityConfigurations/python/base_data.py @@ -22,7 +22,7 @@ dqconfig.config = "Collisions Data" dqconfig.hcfg = os.environ.get('DQC_HCFG_COLLISIONS_RUN', "%s/collisions_run.hcfg" % hcfg_dir) dqconfig.hcfg_min10 = os.environ.get('DQC_HCFG_COLLISIONS_MINUTES10', "%s/collisions_minutes10.hcfg" % hcfg_dir) dqconfig.hcfg_min30 = os.environ.get('DQC_HCFG_COLLISIONS_MINUTES30', "%s/collisions_minutes30.hcfg" % hcfg_dir) -dqconfig.server = ["aiatlas039.cern.ch", "aiatlas035.cern.ch", "aiatlas133.cern.ch"] if isprod else [] +dqconfig.server = os.environ.get('DQC_SERVERS', "aiatlas009.cern.ch,aiatlas016.cern.ch,aiatlas039.cern.ch").split(',') if isprod else [] dqconfig.eosResultsDir = "root://eosatlas.cern.ch//eos/atlas/atlascerngroupdisk/data-dqm/han_results/tier0/collisions/" if isprod else "" dqconfig.histogramCache = "/afs/cern.ch/user/a/atlasdqm/w1/histogram_web_display_cache" if isprod else '' dqconfig.hanResultsDir = "/dqmdisk0/han_results/tier0/collisions" if isprod else '/afs/cern.ch/user/a/atlasdqm/dqmdisk/han_results/test' diff --git a/DataQuality/DataQualityConfigurations/python/base_data_1beam.py b/DataQuality/DataQualityConfigurations/python/base_data_1beam.py index 5058883b4de20ab1b6700adbb5fb771684d301e3..36b91c68f61086ca5573bdb329977c146106af19 100644 --- a/DataQuality/DataQualityConfigurations/python/base_data_1beam.py +++ b/DataQuality/DataQualityConfigurations/python/base_data_1beam.py @@ -21,7 +21,7 @@ dqconfig.config = "Beam" dqconfig.hcfg = os.environ.get('DQC_HCFG_COLLISIONS_RUN', "%s/collisions_run.hcfg" % hcfg_dir) dqconfig.hcfg_min10 = os.environ.get('DQC_HCFG_COLLISIONS_MINUTES10', "%s/collisions_minutes10.hcfg" % hcfg_dir) dqconfig.hcfg_min30 = os.environ.get('DQC_HCFG_COLLISIONS_MINUTES30', "%s/collisions_minutes30.hcfg" % hcfg_dir) -dqconfig.server = ["aiatlas039.cern.ch", "aiatlas035.cern.ch", "aiatlas133.cern.ch"] if isprod else [] +dqconfig.server = os.environ.get('DQC_SERVERS', "aiatlas009.cern.ch,aiatlas016.cern.ch,aiatlas039.cern.ch").split(',') if isprod else [] dqconfig.eosResultsDir = "root://eosatlas.cern.ch//eos/atlas/atlascerngroupdisk/data-dqm/han_results/tier0/collisions/" if isprod else "" dqconfig.histogramCache = "/afs/cern.ch/user/a/atlasdqm/w1/histogram_web_display_cache" if isprod else '' dqconfig.hanResultsDir = "/dqmdisk0/han_results/tier0/Cosmics08" if isprod else '/afs/cern.ch/user/a/atlasdqm/dqmdisk/han_results/test' diff --git a/DataQuality/DataQualityConfigurations/python/base_data_cos.py b/DataQuality/DataQualityConfigurations/python/base_data_cos.py index 1c481ee56d6dbec3864b1d75a4c6e1580dfea48a..e63ccf1a6a2edb2aa2cea460dbc729b58d3b420e 100644 --- a/DataQuality/DataQualityConfigurations/python/base_data_cos.py +++ b/DataQuality/DataQualityConfigurations/python/base_data_cos.py @@ -21,7 +21,7 @@ dqconfig.config = "Cosmics" dqconfig.hcfg = os.environ.get('DQC_HCFG_COSMICS_RUN', "%s/cosmics_run.hcfg" % hcfg_dir) dqconfig.hcfg_min10 = os.environ.get('DQC_HCFG_COSMICS_MINUTES10', "%s/cosmics_minutes10.hcfg" % hcfg_dir) dqconfig.hcfg_min30 = os.environ.get('DQC_HCFG_COSMICS_MINUTES30', "%s/cosmics_minutes30.hcfg" % hcfg_dir) -dqconfig.server = ["aiatlas039.cern.ch", "aiatlas035.cern.ch", "aiatlas133.cern.ch"] if isprod else [] +dqconfig.server = os.environ.get('DQC_SERVERS', "aiatlas009.cern.ch,aiatlas016.cern.ch,aiatlas039.cern.ch").split(',') if isprod else [] dqconfig.eosResultsDir = "root://eosatlas.cern.ch//eos/atlas/atlascerngroupdisk/data-dqm/han_results/tier0/collisions/" if isprod else "" dqconfig.histogramCache = "/afs/cern.ch/user/a/atlasdqm/w1/histogram_web_display_cache" if isprod else '' dqconfig.hanResultsDir = "/dqmdisk0/han_results/tier0/Cosmics08" if isprod else '/afs/cern.ch/user/a/atlasdqm/dqmdisk/han_results/test' diff --git a/DataQuality/DataQualityConfigurations/python/base_data_hi.py b/DataQuality/DataQualityConfigurations/python/base_data_hi.py index d1199724b590003b669915e161445ba3ef86c63b..72c82c4496e2c748ca83ab63afb7db177b190d14 100644 --- a/DataQuality/DataQualityConfigurations/python/base_data_hi.py +++ b/DataQuality/DataQualityConfigurations/python/base_data_hi.py @@ -22,7 +22,7 @@ dqconfig.config = "Heavy Ion Data" dqconfig.hcfg = os.environ.get('DQC_HCFG_HEAVYIONS_RUN', "%s/heavyions_run.hcfg" % hcfg_dir) dqconfig.hcfg_min10 = os.environ.get('DQC_HCFG_HEAVYIONS_MINUTES10', "%s/heavyions_minutes10.hcfg" % hcfg_dir) dqconfig.hcfg_min30 = os.environ.get('DQC_HCFG_HEAVYIONS_MINUTES30', "%s/heavyions_minutes30.hcfg" % hcfg_dir) -dqconfig.server = ["aiatlas039.cern.ch", "aiatlas035.cern.ch", "aiatlas133.cern.ch"] if isprod else [] +dqconfig.server = os.environ.get('DQC_SERVERS', "aiatlas009.cern.ch,aiatlas016.cern.ch,aiatlas039.cern.ch").split(',') if isprod else [] dqconfig.eosResultsDir = "root://eosatlas.cern.ch//eos/atlas/atlascerngroupdisk/data-dqm/han_results/tier0/collisions/" if isprod else "" dqconfig.histogramCache = "/afs/cern.ch/user/a/atlasdqm/w1/histogram_web_display_cache" if isprod else '' dqconfig.hanResultsDir = "/dqmdisk0/han_results/tier0/collisions" if isprod else '/afs/cern.ch/user/a/atlasdqm/dqmdisk/han_results/test' diff --git a/DataQuality/DataQualityInterfaces/src/HanConfig.cxx b/DataQuality/DataQualityInterfaces/src/HanConfig.cxx index 050601694e4be42aff591568c697f1960ea936e2..3c2addf9f96dfd757faa5b0e0ef0992f7ed928f3 100644 --- a/DataQuality/DataQualityInterfaces/src/HanConfig.cxx +++ b/DataQuality/DataQualityInterfaces/src/HanConfig.cxx @@ -340,10 +340,14 @@ Visit( const MiniConfigTreeNode* node ) const if( fileName != "" && name != "" && name != "same_name" ) { fileName = SplitReference(node->GetAttribute("location"), fileName); std::string refInfo = node->GetAttribute("info"); + if (refInfo == "") { + std::cerr << "INFO: Reference " << name << " is defined without an \"info\" attribute. Consider adding one" + << std::endl; + } std::unique_ptr<TFile> infile( TFile::Open(fileName.c_str()) ); TKey* key = getObjKey( infile.get(), name ); if( key == 0 ) { - std::cerr << "HanConfig::RefVisitor::Visit(): Reference not found: \"" << name << "\"\n"; + std::cerr << "WARNING: HanConfig::RefVisitor::Visit(): Reference not found: \"" << name << "\"\n"; return; } // TDirectory* dir = ChangeOutputDir( m_outfile, name, m_directories ); @@ -495,6 +499,10 @@ GetAlgorithmConfiguration( HanConfigAssessor* dqpar, const std::string& algID, std::string algRefName( m_refConfig.GetStringAttribute(thisRefID,"name") ); std::string algRefPath( m_refConfig.GetStringAttribute(thisRefID,"path") ); std::string algRefInfo( m_refConfig.GetStringAttribute(thisRefID,"info") ); + if (algRefInfo == "") { + std::cerr << "INFO: Reference " << thisRefID << " is defined without an \"info\" attribute. Consider adding one" + << std::endl; + } absAlgRefName = ""; if( algRefPath != "" ) { absAlgRefName += algRefPath; @@ -541,11 +549,9 @@ GetAlgorithmConfiguration( HanConfigAssessor* dqpar, const std::string& algID, auto algRefFileostr = new TObjString(algRefFile.c_str()); m_refsourcedata->Add(new TObjString(newRefId.c_str()), algRefFileostr); - if (algRefInfo != "") { - if (! m_refsourcedata->FindObject(algRefFile.c_str())) { - m_refsourcedata->Add(algRefFileostr, - new TObjString(algRefInfo.c_str())); - } + if (! m_refsourcedata->FindObject(algRefFile.c_str())) { + m_refsourcedata->Add(algRefFileostr, + new TObjString(algRefInfo != "" ? algRefInfo.c_str() : "Reference")); } } //std::cout<<"Writing algref with algrefname= "<<algRefUniqueName<<", newRefId="<<newRefId<<std::endl; @@ -855,18 +861,18 @@ Visit( const MiniConfigTreeNode* node ) const std::string regexflag(histNode->GetAttribute("regex")); if (histNode->GetAttribute("regex") != "") { - std::cerr << "all_in_dir and regex are incompatible; ignoring regex flag for " << histNode->GetPathName() + std::cerr << "WARNING: all_in_dir and regex are incompatible; ignoring regex flag for " << histNode->GetPathName() << "/all_in_dir" << std::endl; } std::string refID( histNode->GetAttribute("reference") ); if( refID == "" ) { - std::cerr << "No \"reference\" defined for " << histNode->GetPathName() << "\n"; + std::cerr << "WARNING: No \"reference\" defined for " << histNode->GetPathName() << "\n"; continue; } std::string refFile( m_refConfig.GetStringAttribute(refID,"file") ); if( refFile == "" ) { - std::cerr << "No \"file\" defined for " << histNode->GetPathName() << "\n"; + std::cerr << "WARNING: No \"file\" defined for " << histNode->GetPathName() << "\n"; continue; } @@ -889,7 +895,7 @@ Visit( const MiniConfigTreeNode* node ) const refPathForSearch += "/dummyName"; basedir = ChangeInputDir( infile.get(), refPathForSearch ); if( basedir == 0 ) { - std::cerr << "Cannot find \"" << refPath << "\" in file\n"; + std::cerr << "INFO: Cannot find path \"" << refPath << "\" in reference file\n"; continue; } } @@ -908,7 +914,7 @@ Visit( const MiniConfigTreeNode* node ) const dir = ChangeInputDir( basedir, histNode->GetPathName() ); if( dir == 0 ) { - std::cerr << "Cannot find \"" << absObjPath << "\" in file\n"; + std::cerr << "INFO: Cannot find path \"" << absObjPath << "\" in reference file\n"; continue; } diff --git a/DataQuality/DataQualityUtils/scripts/DQM_Tier0Wrapper_tf.py b/DataQuality/DataQualityUtils/scripts/DQM_Tier0Wrapper_tf.py index 19d85c4b01fc33ca79aea1cfb488dc18ae55e899..e2dc385808a67f5e70f5656c0ed1c7d060ad8998 100755 --- a/DataQuality/DataQualityUtils/scripts/DQM_Tier0Wrapper_tf.py +++ b/DataQuality/DataQualityUtils/scripts/DQM_Tier0Wrapper_tf.py @@ -45,6 +45,8 @@ ## configuration file paths relative to basename ## 12) 'productionMode': string ('True'/'False', default: 'True') ## ('True': run as if on Tier-0. 'False': Assume testing.) +## 13) 'servers': string with comma-separated server names to override normal config +## (e.g. 'aiatlas009.cern.ch,aiatlas039.cern.ch,aiatlas016.cern.ch') ## ## (C) N. Boelaert, L. Goossens, A. Nairz, P. Onyisi, S. Schaetzel, M. Wilson ## (April 2008 - July 2010) @@ -291,6 +293,10 @@ def dq_combined_trf(jsonfile, outmap): if n_xmlrpc_tries <= MAX_XMLRPC_TRIES: time.sleep(20*2**n_xmlrpc_tries) + # data servers + if 'servers' in parmap and isinstance(parmap['servers'], str): + os.environ['DQC_SERVERS'] = parmap['servers'] + print("Job parameters:\n") print(" Run number: ", runnr) print(" Stream name: ", stream) diff --git a/Database/AthenaPOOL/OutputStreamAthenaPool/python/MultipleStreamManager.py b/Database/AthenaPOOL/OutputStreamAthenaPool/python/MultipleStreamManager.py index 166cbad0165a4d4650e428e832086c84404ddb75..8886c0392837785e5d19f26dc7d6c16b103a56a3 100644 --- a/Database/AthenaPOOL/OutputStreamAthenaPool/python/MultipleStreamManager.py +++ b/Database/AthenaPOOL/OutputStreamAthenaPool/python/MultipleStreamManager.py @@ -272,9 +272,9 @@ class AugmentedByteStream( AugmentedStreamBase ): svcMgr.ToolSvc += self.bsCopyTool #default output directory - import commands + import subprocess cmd='pwd' - (statusCode,outDir) = commands.getstatusoutput(cmd) + (statusCode,outDir) = subprocess.getstatusoutput(cmd) outDir+="/" # BS output Svc diff --git a/Event/PyDumper/bin/sg-dump.py b/Event/PyDumper/bin/sg-dump.py index f0736d745b8f1d0f8be9fdc3a769dc207efdaccb..726682369180e54119aa5ab36bf1e9daee01d147 100755 --- a/Event/PyDumper/bin/sg-dump.py +++ b/Event/PyDumper/bin/sg-dump.py @@ -1,6 +1,6 @@ #!/usr/bin/env python -# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration # @file: PyDumper/bin/sg-dump.py # @purpose: a simple python script to run pyathena and use PySgDumper to dump # a (set of) event(s) from a POOL (esd/aod) file into an ASCII file @@ -154,6 +154,8 @@ if __name__ == "__main__": athena_opts=options.athena_opts, msg=msg ) - except Exception,err: + except Exception as err: msg.error('problem while running sg-dump:\n%s', err) + import traceback + traceback.print_exc() sys.exit(sc) diff --git a/Event/PyDumper/python/Dumpers.py b/Event/PyDumper/python/Dumpers.py index 512000ef2ab703ae29b10893ec8555d589c9c127..7e14295cae9e936986c8482a6716690231e3564e 100644 --- a/Event/PyDumper/python/Dumpers.py +++ b/Event/PyDumper/python/Dumpers.py @@ -40,8 +40,8 @@ etcone10 = 0 nucone10 = 8 # Without these, cling gets confused by forward declarations. -ROOT.xAOD.TrackParticleContainer_v1 -ROOT.xAOD.Jet_v1 +getattr (ROOT.xAOD, 'TrackParticleContainer_v1', None) +getattr (ROOT.xAOD, 'Jet_v1', None) # Work around a cling bug. if hasattr(ROOT,'TrackParticleTruthCollection'): diff --git a/Event/PyDumper/python/PyComps.py b/Event/PyDumper/python/PyComps.py index 775bb2a378ad3afc00ff90a921381093f3037860..e13eedff6eebb6826be99ff63c7a17ccc7189ef4 100644 --- a/Event/PyDumper/python/PyComps.py +++ b/Event/PyDumper/python/PyComps.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration # @file: PyDumper/python/PyComps.py # @purpose: A set of PyAthena components to test reading/writing EDM classes @@ -156,7 +156,7 @@ class PyReader (PyAthena.Alg): str(self.ofile), type(self.ofile)) return StatusCode.Failure - from Dumpers import get_dumper_fct + from PyDuper.Dumpers import get_dumper_fct try: cont_type = getattr(PyAthena, self.cont_type) except AttributeError as err: @@ -268,7 +268,7 @@ class PySgDumper (PyAthena.Alg): str(self.ofile), type(self.ofile)) return StatusCode.Failure - from Dumpers import get_dumper_fct + from PyDumper.Dumpers import get_dumper_fct self._dumper_fct = get_dumper_fct if hasattr(self.ofile, 'name'): @@ -319,9 +319,9 @@ class PySgDumper (PyAthena.Alg): n, clid) _add_fail ((n,clid,'no typename from clid')) - items = [(i[1], i[0]) for i in sg.iteritems() if i[1] != "EventInfo"] + items = [(i[1], i[0]) for i in sg.items() if i[1] != "EventInfo"] items.sort() - evt_info = [(clid, key) for key,clid in sg.iteritems() if clid=="EventInfo"] + evt_info = [(clid, key) for key,clid in sg.items() if clid=="EventInfo"] if len(evt_info)==1: items.insert (0, evt_info[0]) else: @@ -394,7 +394,7 @@ class PySgDumper (PyAthena.Alg): reasons = defaultdict(list) for name,klass,reason in self.failed_dumps: reasons[reason].append ((name,klass)) - for reason in reasons.iterkeys(): + for reason in reasons.keys(): _info (' ==> [%s]', reason) for name,klass in reasons[reason]: _info (" [%s#%s]", klass, name) @@ -490,7 +490,7 @@ class DataProxyLoader(PyAthena.Alg): reasons = defaultdict(list) for name,klass,reason in self.failed_dumps: reasons[reason].append ((name,klass)) - for reason in reasons.iterkeys(): + for reason in reasons.keys(): _info (' ==> [%s]', reason) for name,klass in reasons[reason]: _info (" [%s#%s]", klass, name) diff --git a/Event/PyDumper/python/SgDumpLib.py b/Event/PyDumper/python/SgDumpLib.py index efcce5bbb85276d7e62f065e41496a1550a14a6a..e1380d81380a2c8359da3777e2b0fea55d5c1142 100644 --- a/Event/PyDumper/python/SgDumpLib.py +++ b/Event/PyDumper/python/SgDumpLib.py @@ -9,6 +9,9 @@ from __future__ import with_statement, print_function import sys import os +from future import standard_library +standard_library.install_aliases() + __doc__ = """\ API for the sg-dump script (which dumps an ASCII representation of events in POOL or RAW files @@ -22,7 +25,7 @@ __all__ = [ def _make_jobo(job): import tempfile - jobo = tempfile.NamedTemporaryFile(suffix='-jobo.py') + jobo = tempfile.NamedTemporaryFile(suffix='-jobo.py', mode='w+') import textwrap job = textwrap.dedent (job) jobo.writelines([l+os.linesep for l in job.splitlines()]) @@ -261,8 +264,8 @@ def _run_jobo(job, msg, options): if options.do_clean_up: atexit.register (_cleanup, keep_files) - import commands - sc,out = commands.getstatusoutput ('which athena.py') + import subprocess + sc,out = subprocess.getstatusoutput ('which athena.py') if sc != 0: msg.error("could not locate 'athena.py':\n%s", out) return sc, out @@ -270,13 +273,13 @@ def _run_jobo(job, msg, options): jobo = _make_jobo(job) if options.use_recex_links: - sc,out = commands.getstatusoutput ('RecExCommon_links.sh') + sc,out = subprocess.getstatusoutput ('RecExCommon_links.sh') if sc != 0: msg.error("could not run 'RecExCommon_links.sh':\n%s"%out) return sc, out msg.info ('installed RecExCommon links') - sc,out = commands.getstatusoutput ('which sh') + sc,out = subprocess.getstatusoutput ('which sh') if sc != 0: msg.error("could not locate 'sh':\n%s",out) return sc, out @@ -285,7 +288,8 @@ def _run_jobo(job, msg, options): from time import time logfile = tempfile.NamedTemporaryFile(prefix='sg_dumper_job_', suffix='.logfile.txt', - dir=os.getcwd()) + dir=os.getcwd(), + mode = 'w+') # do not require $HOME to be available for ROOT # see bug #82096 @@ -308,7 +312,7 @@ def _run_jobo(job, msg, options): import time, re pat = re.compile (r'^Py:pyalg .*') evt_pat = re.compile ( - r'^Py:pyalg .*? ==> processing event [[](?P<evtnbr>\d*?)[]].*' + r'^Py:pyalg .*? ==> processing event \[(?P<evtnbr>\d*?)\].*' ) def _monitor(pos): logfile.flush() @@ -342,7 +346,7 @@ def _run_jobo(job, msg, options): if sc != 0: logfile.seek(0) msg.error ('='*80) - from cStringIO import StringIO + from io import StringIO err = StringIO() for l in logfile: print (l, end='') @@ -352,7 +356,7 @@ def _run_jobo(job, msg, options): return sc, err.getvalue() logfile.seek (0) - from cStringIO import StringIO + from io import StringIO out = StringIO() for l in logfile: if pat.match(l): @@ -395,7 +399,7 @@ def run_sg_dump(files, output, msg = L.logging.getLogger('sg-dumper') msg.setLevel(L.logging.INFO) - if isinstance(files, basestring): + if isinstance(files, str): files = files.split() if not isinstance(files, (list,tuple)): @@ -403,7 +407,7 @@ def run_sg_dump(files, output, msg.error(err) raise TypeError(err) - if not isinstance(output, basestring): + if not isinstance(output, str): err = "'output' needs to be a filename" msg.error(err) raise TypeError(err) @@ -450,7 +454,7 @@ def run_sg_dump(files, output, msg.info('file_type: %s', file_type) msg.info('exclude: %s', exclude) - if dump_jobo and isinstance(dump_jobo, basestring): + if dump_jobo and isinstance(dump_jobo, str): try: with open(dump_jobo, 'w') as f: f.write(jobo) diff --git a/Event/xAOD/xAODCoreCnv/CMakeLists.txt b/Event/xAOD/xAODCoreCnv/CMakeLists.txt index d8ebff324602ceebced566842cf229d056f34b6a..d351dd74f77f9f91c99c533208239b3f31078314 100644 --- a/Event/xAOD/xAODCoreCnv/CMakeLists.txt +++ b/Event/xAOD/xAODCoreCnv/CMakeLists.txt @@ -1,28 +1,23 @@ -# $Id$ -################################################################################ -# Package: xAODCoreCnv -################################################################################ +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -# Declare the package name: +# Declare the package's name. atlas_subdir( xAODCoreCnv ) -# Declare the package's dependencies: -atlas_depends_on_subdirs( - PRIVATE - Control/AthContainers - Control/AthContainersInterfaces - Control/AthLinks - Control/AthenaBaseComps - Control/AthenaKernel - Control/SGTools - Event/xAOD/xAODCore - GaudiKernel ) +# External(s). +find_package( ROOT COMPONENTS Core ) + +# Component(s) in the package. +atlas_add_library( xAODCoreCnvLib + xAODCoreCnv/*.h + INTERFACE + PUBLIC_HEADERS xAODCoreCnv + LINK_LIBRARIES GaudiKernel ) -# Component(s) in the package: atlas_add_component( xAODCoreCnv src/*.h src/*.cxx src/components/*.cxx - LINK_LIBRARIES AthContainers AthLinks AthenaBaseComps AthenaKernel SGTools - xAODCore GaudiKernel ) + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} + LINK_LIBRARIES ${ROOT_LIBRARIES} AthContainers AthLinks AthenaBaseComps + AthenaKernel SGTools xAODCore GaudiKernel xAODCoreCnvLib ) -# Install files from the package: +# Install files from the package. atlas_install_joboptions( share/*.py ) diff --git a/Event/xAOD/xAODCoreCnv/share/ROOTHeaderLoaderSvcTest_jobOptions.py b/Event/xAOD/xAODCoreCnv/share/ROOTHeaderLoaderSvcTest_jobOptions.py new file mode 100644 index 0000000000000000000000000000000000000000..02eba950bd764377ff7cd925cbe109dc4b699c5a --- /dev/null +++ b/Event/xAOD/xAODCoreCnv/share/ROOTHeaderLoaderSvcTest_jobOptions.py @@ -0,0 +1,15 @@ +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +# +# Small/simple job testing the behaviour of xAODMaker::ROOTHeaderLoaderSvc. +# + +# Set up the service. +from AthenaCommon.AppMgr import ServiceMgr +ServiceMgr += CfgMgr.xAODMaker__ROOTHeaderLoaderSvc( 'ROOTHeaderLoaderSvc', + HeaderNames = [ + 'xAODEgamma/PhotonContainer.h', + 'xAODTrigEgamma/TrigPhotonContainer.h' ] ) +theApp.CreateSvc += [ 'xAODMaker::ROOTHeaderLoaderSvc/ROOTHeaderLoaderSvc' ] + +# Some final tweaking: +theApp.EvtMax = 1 diff --git a/Event/xAOD/xAODCoreCnv/src/ROOTHeaderLoaderSvc.cxx b/Event/xAOD/xAODCoreCnv/src/ROOTHeaderLoaderSvc.cxx new file mode 100644 index 0000000000000000000000000000000000000000..786d242625c04ba08c57253ca00f7d8e06c2da02 --- /dev/null +++ b/Event/xAOD/xAODCoreCnv/src/ROOTHeaderLoaderSvc.cxx @@ -0,0 +1,46 @@ +// +// Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +// + +// Local include(s). +#include "ROOTHeaderLoaderSvc.h" + +// ROOT include(s). +#include <TInterpreter.h> +#include <TString.h> +#include <TROOT.h> + +namespace xAODMaker { + + StatusCode ROOTHeaderLoaderSvc::initialize() { + + // Load all the configured headers. + for( const std::string& headerName : m_headerNames.value() ) { + ATH_MSG_INFO( "Loading header \"" << headerName << "\"" ); + ATH_CHECK( loadHeader( headerName ) ); + } + + // Return gracefully. + return StatusCode::SUCCESS; + } + + StatusCode + ROOTHeaderLoaderSvc::loadHeader( const std::string& headerName ) const { + + // Load the requested header. + Int_t errorCode = 0; + gROOT->ProcessLine( TString::Format( "#include \"%s\"", + headerName.c_str() ), + &errorCode ); + + // Check if the call succeeded. + if( errorCode != TInterpreter::kNoError ) { + ATH_MSG_FATAL( "Failed to load header \"" << headerName << "\"" ); + return StatusCode::FAILURE; + } + + // Return gracefully. + return StatusCode::SUCCESS; + } + +} // namespace xAODMaker diff --git a/Event/xAOD/xAODCoreCnv/src/ROOTHeaderLoaderSvc.h b/Event/xAOD/xAODCoreCnv/src/ROOTHeaderLoaderSvc.h new file mode 100644 index 0000000000000000000000000000000000000000..b1ef589977622ada4593a2390a4c010038876b94 --- /dev/null +++ b/Event/xAOD/xAODCoreCnv/src/ROOTHeaderLoaderSvc.h @@ -0,0 +1,59 @@ +// Dear emacs, this is -*- c++ -*- +// +// Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +// +#ifndef XAODCORECNV_ROOTHEADERLOADERSVC_H +#define XAODCORECNV_ROOTHEADERLOADERSVC_H + +// Local include(s). +#include "xAODCoreCnv/IROOTHeaderLoaderSvc.h" + +// Framework include(s). +#include "AthenaBaseComps/AthService.h" +#include "GaudiKernel/Property.h" + +// System include(s). +#include <string> +#include <vector> + +namespace xAODMaker { + + /// Service implementing @c xAODMaker::IROOTHeaderLoaderSvc + /// + /// The service simply relies on @c TROOT::ProcessLine(...) to execute + /// '#include "headerName.h"' commands. Forcing ROOT to interpret those + /// headers during the job's initialisation. Allowing us to work around + /// ATR-21753 / ROOT-10940. + /// + /// @author Attila Krasznahorkay <Attila.Krasznahorkay@cern.ch> + /// + class ROOTHeaderLoaderSvc : public extends< AthService, + IROOTHeaderLoaderSvc > { + + public: + // Inherit the base class's constructor(s). + using extends::extends; + + /// Function initialising the service + virtual StatusCode initialize() override; + + /// @name Implementation of the @c xAODMaker::IEventFormatSvc interface + /// @{ + + /// (Force-)Load one particular header + virtual StatusCode + loadHeader( const std::string& headerName ) const override; + + /// @} + + private: + /// Names of the headers to auto-load during initialisation + Gaudi::Property< std::vector< std::string > > m_headerNames{ this, + "HeaderNames", {}, + "Names of the headers to auto-load during initialisation" }; + + }; // class ROOTHeaderLoaderSvc + +} // namespace xAODMaker + +#endif // XAODCORECNV_ROOTHEADERLOADERSVC_H diff --git a/Event/xAOD/xAODCoreCnv/src/components/xAODCoreCnv_entries.cxx b/Event/xAOD/xAODCoreCnv/src/components/xAODCoreCnv_entries.cxx index 372f2e6a2a9c9c37d27401ed7bfeca55810958ae..b9c62416b7f8bd5df0d1292028f723f7a7fc946e 100644 --- a/Event/xAOD/xAODCoreCnv/src/components/xAODCoreCnv_entries.cxx +++ b/Event/xAOD/xAODCoreCnv/src/components/xAODCoreCnv_entries.cxx @@ -1,6 +1,11 @@ +// +// Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +// + #include "../AuxStoreWrapper.h" #include "../ElementLinkResetAlg.h" +#include "../ROOTHeaderLoaderSvc.h" DECLARE_COMPONENT( xAODMaker::AuxStoreWrapper ) DECLARE_COMPONENT( xAODMaker::ElementLinkResetAlg ) - +DECLARE_COMPONENT( xAODMaker::ROOTHeaderLoaderSvc ) diff --git a/Event/xAOD/xAODCoreCnv/xAODCoreCnv/IROOTHeaderLoaderSvc.h b/Event/xAOD/xAODCoreCnv/xAODCoreCnv/IROOTHeaderLoaderSvc.h new file mode 100644 index 0000000000000000000000000000000000000000..a9846bc315d345d14167f9ba6ce8f1fd1eb681c0 --- /dev/null +++ b/Event/xAOD/xAODCoreCnv/xAODCoreCnv/IROOTHeaderLoaderSvc.h @@ -0,0 +1,34 @@ +// Dear emacs, this is -*- c++ -*- +// +// Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +// +#ifndef XAODCORECNV_IROOTHEADERLOADERSVC_H +#define XAODCORECNV_IROOTHEADERLOADERSVC_H + +// Framework include(s). +#include "GaudiKernel/IService.h" +#include "GaudiKernel/StatusCode.h" + +namespace xAODMaker { + + /// Interface to a helper service used for force-loading headers into ROOT + /// + /// This interface may never actually be used by anyone, but I didn't want + /// to introduce a service that would not have any interface whatsoever... + /// + /// @author Attila Krasznahorkay <Attila.Krasznahorkay@cern.ch> + /// + class IROOTHeaderLoaderSvc : public virtual IService { + + public: + /// Declare an interface ID for the class + DeclareInterfaceID( xAODMaker::IROOTHeaderLoaderSvc, 1, 0 ); + + /// (Force-)Load one particular header + virtual StatusCode loadHeader( const std::string& headerName ) const = 0; + + }; // class IROOTHeaderLoaderSvc + +} // namespace xAODMaker + +#endif // XAODCORECNV_IROOTHEADERLOADERSVC_H diff --git a/Generators/BeamHaloGenerator/src/BeamHaloGeneratorSettings.cxx b/Generators/BeamHaloGenerator/src/BeamHaloGeneratorSettings.cxx index 913723d6bede23a66f04e5014f089b9b916f6d98..f3d9825e12fe8be884f97476eefb19941f971795 100644 --- a/Generators/BeamHaloGenerator/src/BeamHaloGeneratorSettings.cxx +++ b/Generators/BeamHaloGenerator/src/BeamHaloGeneratorSettings.cxx @@ -156,20 +156,20 @@ bool BeamHaloGeneratorSettings::checkParticle(BeamHaloParticle *beamHaloParticle // First implement the cuts which are not related to the particle // trajectory. - if(!checkSetting(W_LIMIT, fabs(beamHaloParticle->weight()))) return false; - if(!checkSetting(PX_LIMIT, fabs(beamHaloParticle->fourVector().px()))) return false; - if(!checkSetting(PY_LIMIT, fabs(beamHaloParticle->fourVector().py()))) return false; - if(!checkSetting(PZ_LIMIT, fabs(beamHaloParticle->fourVector().pz()))) return false; - if(!checkSetting(E_LIMIT, fabs(beamHaloParticle->fourVector().e()))) return false; + if(!checkSetting(W_LIMIT, std::abs(beamHaloParticle->weight()))) return false; + if(!checkSetting(PX_LIMIT, std::abs(beamHaloParticle->fourVector().px()))) return false; + if(!checkSetting(PY_LIMIT, std::abs(beamHaloParticle->fourVector().py()))) return false; + if(!checkSetting(PZ_LIMIT, std::abs(beamHaloParticle->fourVector().pz()))) return false; + if(!checkSetting(E_LIMIT, std::abs(beamHaloParticle->fourVector().e()))) return false; if(!checkSetting(PT_LIMIT, beamHaloParticle->fourVector().perp())) return false; - if(!checkSetting(ETA_LIMIT, fabs(beamHaloParticle->fourVector().pseudoRapidity()))) return false; - if(!checkSetting(PHI_LIMIT, fabs(beamHaloParticle->fourVector().phi()))) return false; + if(!checkSetting(ETA_LIMIT, std::abs(beamHaloParticle->fourVector().pseudoRapidity()))) return false; + if(!checkSetting(PHI_LIMIT, std::abs(beamHaloParticle->fourVector().phi()))) return false; // Require the selection at the scoring plane. if(m_shapeRequirement == NONE) { - if(!checkSetting(X_LIMIT, fabs(beamHaloParticle->positionAtScoringPlane().x()))) return false; - if(!checkSetting(Y_LIMIT, fabs(beamHaloParticle->positionAtScoringPlane().y()))) return false; + if(!checkSetting(X_LIMIT, std::abs(beamHaloParticle->positionAtScoringPlane().x()))) return false; + if(!checkSetting(Y_LIMIT, std::abs(beamHaloParticle->positionAtScoringPlane().y()))) return false; if(!checkSetting(R_LIMIT, beamHaloParticle->positionAtScoringPlane().perp())) return false; } else if(m_shapeRequirement == CYLINDER) { diff --git a/Generators/BeamHaloGenerator/src/BeamHaloParticle.cxx b/Generators/BeamHaloGenerator/src/BeamHaloParticle.cxx index 604c4c6ecb2f5b4e9cb9c28500a93eeb90766575..d2fd480d942bde87da3e4f5ac43f066ab92c8b19 100644 --- a/Generators/BeamHaloGenerator/src/BeamHaloParticle.cxx +++ b/Generators/BeamHaloGenerator/src/BeamHaloParticle.cxx @@ -155,7 +155,7 @@ int BeamHaloParticle::fill(const HepPDT::ParticleDataTable *particleDataTable, m_fourVector.setY(flukaParticle->directionalCosines().y() * mod_p); // If the z component of the directional cosine has not been set recalculate it. - if(fabs(flukaParticle->directionalCosines().z()) < 0.0001) { + if(std::abs(flukaParticle->directionalCosines().z()) < 0.0001) { // Calculate pz from sqrt(p^2 - p_T^2) pz = std::sqrt(p_sq - m_fourVector.perp2()); m_fourVector.setZ(pz); // This is always +ve. Corrected during conversion to HepParticle diff --git a/Generators/CavernBkgGenerator/src/MuonBackgroundConverter.cxx b/Generators/CavernBkgGenerator/src/MuonBackgroundConverter.cxx index 1c1070e4d81a8e96331a93e2a508667e1de597c1..fe68fc75494b530b84fcc79f9cc692e188b1c307 100644 --- a/Generators/CavernBkgGenerator/src/MuonBackgroundConverter.cxx +++ b/Generators/CavernBkgGenerator/src/MuonBackgroundConverter.cxx @@ -195,7 +195,7 @@ StatusCode MuonBackgroundConverter::callGenerator() int id = abs (m_evt.at(i).getPdgID() ); bool select = ( (!m_firstHitOnly) || - (m_firstHitOnly && fabs(p_curr-p_prev)>tolerance) ) && ( id != 13 ); + (m_firstHitOnly && std::abs(p_curr-p_prev)>tolerance) ) && ( id != 13 ); if ( select ) { //std::cout << evt << std::endl; diff --git a/Generators/CavernBkgGenerator/src/MuonBackgroundEventParser.cxx b/Generators/CavernBkgGenerator/src/MuonBackgroundEventParser.cxx index c1403c9d3596b09e1334e3ea1a33b0bfd9f1a302..bdca3ae2fb940829280a67acac000f8dc8772cdb 100644 --- a/Generators/CavernBkgGenerator/src/MuonBackgroundEventParser.cxx +++ b/Generators/CavernBkgGenerator/src/MuonBackgroundEventParser.cxx @@ -102,7 +102,7 @@ std::istream& MuonBackgroundEventParser::read( std::istream& is ) m_momentum.setPz( p * pz1 * CLHEP::GeV ); CLHEP::Hep3Vector mom = m_momentum.vect(); - m_momentum.setE( sqrt( mass*mass + mom.mag2() ) ); + m_momentum.setE( std::sqrt( mass*mass + mom.mag2() ) ); } return is; diff --git a/Generators/CosmicGenerator/src/CosmicGenerator.cxx b/Generators/CosmicGenerator/src/CosmicGenerator.cxx index a8cd573dbe8fe264ace04008fc23f13bacee1dc8..b4ba40d23038e143992c38b22481477d4608dbdc 100644 --- a/Generators/CosmicGenerator/src/CosmicGenerator.cxx +++ b/Generators/CosmicGenerator/src/CosmicGenerator.cxx @@ -380,7 +380,7 @@ StatusCode CosmicGenerator::callGenerator() { double beta=direction.angle(center_dir); double alpha=asin(m_radius/center_dir.r()); - if(fabs(beta)<alpha) { + if(std::abs(beta)<alpha) { if(m_exzCut) { // Old optimization code - is it still useful? @@ -782,7 +782,7 @@ double CosmicGenerator::pathLengthInRock(double xgen, double ygen, double zgen, // does trajectory intersect p14 cylinder? double z_mid14 = (x0-p14_x)*sinphi-(z0-p14_z)*cosphi; - double min_dist14 = fabs(z_mid14); //minimum distance of line from center + double min_dist14 = std::abs(z_mid14); //minimum distance of line from center double shaft_distance14 = 0.; if (min_dist14<p14_radius) { @@ -806,7 +806,7 @@ double CosmicGenerator::pathLengthInRock(double xgen, double ygen, double zgen, // does trajectory intersect p16 cylinder? double z_mid16 = (x0-p16_x)*sinphi-(z0-p16_z)*cosphi; - double min_dist16 = fabs(z_mid16); + double min_dist16 = std::abs(z_mid16); double shaft_distance16 = 0.; if (min_dist16<p16_radius) { @@ -850,7 +850,7 @@ bool CosmicGenerator::pointsAtPixels(double xgen, double ygen, double zgen, doub ATH_MSG_VERBOSE("x_pos = " << x_pos << ", z_pos = " << z_pos); - if((fabs(x_pos)<m_pixelplanemaxx)&&(fabs(z_pos)<m_pixelplanemaxz)){ + if((std::abs(x_pos)<m_pixelplanemaxx)&&(std::abs(z_pos)<m_pixelplanemaxz)){ does=true; } diff --git a/Generators/EvgenProdTools/src/SimTimeEstimate.cxx b/Generators/EvgenProdTools/src/SimTimeEstimate.cxx index 1a3d6f223b6e57bb23369f5aaca45797d5f0e085..f3392250e46448fe35feb9a6f47976275f7757da 100644 --- a/Generators/EvgenProdTools/src/SimTimeEstimate.cxx +++ b/Generators/EvgenProdTools/src/SimTimeEstimate.cxx @@ -37,10 +37,10 @@ StatusCode SimTimeEstimate::execute() // Grab the momentum const HepMC::FourVector pmom = part->momentum(); // Only count particles with finite eta - if (pmom.perp()==0 || fabs(pmom.eta())>m_etaMax) continue; + if (pmom.perp()==0 || std::abs(pmom.eta())>m_etaMax) continue; m_particleEtas.push_back(pmom.eta()); // add ID of particle to list - m_particleIDs.push_back(abs(part->pdg_id())); + m_particleIDs.push_back(std::abs(part->pdg_id())); // add energy per particle to get the distribution: m_particleEnergies.push_back(pmom.e()); diff --git a/Generators/EvgenProdTools/src/TestHepMC.cxx b/Generators/EvgenProdTools/src/TestHepMC.cxx index d1498cec589053c11e7bfc56d8597245d25462cb..c8dd06ff725ec59192741a43a6ded449beaa4b4b 100644 --- a/Generators/EvgenProdTools/src/TestHepMC.cxx +++ b/Generators/EvgenProdTools/src/TestHepMC.cxx @@ -300,7 +300,7 @@ StatusCode TestHepMC::execute() { const double sumP = beams.first->momentum().pz() + beams.second->momentum().pz(); cmenergy = std::sqrt(sumE*sumE - sumP*sumP); - if (m_cm_energy > 0 && fabs(cmenergy - m_cm_energy) > m_cme_diff) { + if (m_cm_energy > 0 && std::abs(cmenergy - m_cm_energy) > m_cme_diff) { ATH_MSG_FATAL("Beam particles have incorrect energy: " << m_cm_energy/1000. << " GeV expected, vs. " << cmenergy/1000. << " GeV found"); setFilterPassed(false); if (m_doHist){ @@ -526,7 +526,7 @@ StatusCode TestHepMC::execute() { negEnPart.push_back(pbarcode); ++m_negativeEnergyTachyonicCheckRate; } - const double aener = fabs(pmom.e()); + const double aener = std::abs(pmom.e()); if ( aener+m_accur_margin < std::abs(pmom.px()) || aener+m_accur_margin < std::abs(pmom.py()) || aener+m_accur_margin < std::abs(pmom.pz()) ) { tachyons.push_back(pbarcode); ++m_negativeEnergyTachyonicCheckRate; @@ -601,7 +601,7 @@ StatusCode TestHepMC::execute() { /// @todo Persuade generator authors to set proper generated masses in HepMC, then *really* require mass = 0 if (ppdgid == 22 && pstatus == 1) { const double mass = pitr->generated_mass(); - if (fabs(mass) > 1.0) { // in MeV + if (std::abs(mass) > 1.0) { // in MeV ATH_MSG_WARNING("Photon with non-zero mass found! Mass: " << mass << " MeV, BARCODE=" << pbarcode); ++m_nonZeroPhotonMassCheckRate; } @@ -619,7 +619,7 @@ StatusCode TestHepMC::execute() { } // End of check for interacting particles not known by G4 // Energy balance - double lostE = fabs(totalE - cmenergy); + double lostE = std::abs(totalE - cmenergy); if (lostE > m_energy_diff) { ATH_MSG_WARNING("ENERGY BALANCE FAILED : E-difference = " << lostE << " MeV"); @@ -636,12 +636,12 @@ StatusCode TestHepMC::execute() { } // End of energy balance check // Momentum balance - if ( fabs(totalPx) > m_energy_diff || fabs(totalPy) > m_energy_diff || fabs(totalPz) > m_energy_diff ) { + if ( std::abs(totalPx) > m_energy_diff || std::abs(totalPy) > m_energy_diff || std::abs(totalPz) > m_energy_diff ) { ATH_MSG_WARNING("MOMENTUM BALANCE FAILED : SumPx = " << totalPx << " SumPy = " << totalPy << " SumPz = " << totalPz << " MeV"); if (m_doHist){ - m_h_momentumImbalance_px->Fill(fabs(totalPx)*1.E-03); - m_h_momentumImbalance_py->Fill(fabs(totalPy)*1.E-03); - m_h_momentumImbalance_pz->Fill(fabs(totalPz)*1.E-03); + m_h_momentumImbalance_px->Fill(std::abs(totalPx)*1.E-03); + m_h_momentumImbalance_py->Fill(std::abs(totalPy)*1.E-03); + m_h_momentumImbalance_pz->Fill(std::abs(totalPz)*1.E-03); } if (m_dumpEvent) HepMC::Print::line(std::cout,**itr); if (m_momImbalanceTest) { diff --git a/Generators/EvtGen_i/src/EvtDecay.cxx b/Generators/EvtGen_i/src/EvtDecay.cxx index 5d40740f8b5c534763c7d9acbe66b8f97b4c03f4..efd24a3e0962437e57353ec54760387c8a1f2d9a 100644 --- a/Generators/EvtGen_i/src/EvtDecay.cxx +++ b/Generators/EvtGen_i/src/EvtDecay.cxx @@ -183,7 +183,7 @@ StatusCode EvtDecay::callEvtGen( HepMC::GenEvent* hepMCevt ) { EvtParticle* part=EvtParticleFactory::particleFactory(eid,p_init); - if(fabs(id)==5122 && m_PolarizedLambdab) setLambdabSpinDensityMatrix(part,m_LambdabPol); + if(std::abs(id)==5122 && m_PolarizedLambdab) setLambdabSpinDensityMatrix(part,m_LambdabPol); m_myGen->generateDecay(part); if ( log.level() <= MSG::DEBUG ) part->printTree(); diff --git a/Generators/EvtGen_i/src/EvtInclusiveDecay.cxx b/Generators/EvtGen_i/src/EvtInclusiveDecay.cxx index 1cef870bcb653db1d4f766f6ba8c6eeb5c56b1fc..ed66103f0d02653681dc89864a2efb82c4a8157e 100644 --- a/Generators/EvtGen_i/src/EvtInclusiveDecay.cxx +++ b/Generators/EvtGen_i/src/EvtInclusiveDecay.cxx @@ -648,10 +648,10 @@ bool EvtInclusiveDecay::passesUserSelection(HepMC::GenEvent* hepMC) { for (auto muItr2 = muItr1+1; muItr2 != muons->end(); ++muItr2) { if( m_userSelRequireOppositeSignedMu && (*muItr1)->pdg_id() * (*muItr2)->pdg_id() > 0) continue; - if( !( (*muItr1)->momentum().perp() > m_userSelMu1MinPt && fabs((*muItr1)->momentum().pseudoRapidity()) < m_userSelMu1MaxEta && - (*muItr2)->momentum().perp() > m_userSelMu2MinPt && fabs((*muItr2)->momentum().pseudoRapidity()) < m_userSelMu2MaxEta ) && - !( (*muItr2)->momentum().perp() > m_userSelMu1MinPt && fabs((*muItr2)->momentum().pseudoRapidity()) < m_userSelMu1MaxEta && - (*muItr1)->momentum().perp() > m_userSelMu2MinPt && fabs((*muItr1)->momentum().pseudoRapidity()) < m_userSelMu2MaxEta ) ) + if( !( (*muItr1)->momentum().perp() > m_userSelMu1MinPt && std::abs((*muItr1)->momentum().pseudoRapidity()) < m_userSelMu1MaxEta && + (*muItr2)->momentum().perp() > m_userSelMu2MinPt && std::abs((*muItr2)->momentum().pseudoRapidity()) < m_userSelMu2MaxEta ) && + !( (*muItr2)->momentum().perp() > m_userSelMu1MinPt && std::abs((*muItr2)->momentum().pseudoRapidity()) < m_userSelMu1MaxEta && + (*muItr1)->momentum().perp() > m_userSelMu2MinPt && std::abs((*muItr1)->momentum().pseudoRapidity()) < m_userSelMu2MaxEta ) ) continue; double dimuMass = invMass((*muItr1),(*muItr2)); if( !( dimuMass > m_userSelMinDimuMass && (dimuMass < m_userSelMaxDimuMass || m_userSelMaxDimuMass < 0.) ) ) diff --git a/Generators/EvtGen_i/src/EvtPhotosEngine.cxx b/Generators/EvtGen_i/src/EvtPhotosEngine.cxx index 92818f2c28843b18e81c7aaed356ff738cb046b4..ceb15390b021802fbdfd38d9cb260d0b3936addb 100644 --- a/Generators/EvtGen_i/src/EvtPhotosEngine.cxx +++ b/Generators/EvtGen_i/src/EvtPhotosEngine.cxx @@ -179,7 +179,7 @@ bool EvtPhotosEngine::doDecay(EvtParticle* theMother) { // according to what Photos has modified. However, this will // violate energy conservation (from what Photos has provided). double mass = daugParticle->mass(); - double energy = sqrt(mass*mass + px*px + py*py + pz*pz); + double energy = std::sqrt(mass*mass + px*px + py*py + pz*pz); newP4.set(energy, px, py, pz); // Set the new four-momentum (FSR applied) daugParticle->setP4WithFSR(newP4); @@ -189,7 +189,7 @@ bool EvtPhotosEngine::doDecay(EvtParticle* theMother) { } else { // Extra photon particle. Setup the four-momentum object. - double energy = sqrt(_mPhoton*_mPhoton + px*px + py*py + pz*pz); + double energy = std::sqrt(_mPhoton*_mPhoton + px*px + py*py + pz*pz); newP4.set(energy, px, py, pz); // Create a new photon particle and add it to the list of daughters diff --git a/Generators/FlowAfterburner/share/Plotting_Macros/DrawPlots.C b/Generators/FlowAfterburner/share/Plotting_Macros/DrawPlots.C index a759cfce6a00832747ecdd13f5d89d1d73261d0d..7bfde86160b1aa1ed5d6e1c7e804f93f445da4f9 100644 --- a/Generators/FlowAfterburner/share/Plotting_Macros/DrawPlots.C +++ b/Generators/FlowAfterburner/share/Plotting_Macros/DrawPlots.C @@ -252,12 +252,12 @@ Double_t get_vn(Double_t *x, Double_t *par) if(ihar==2) return v2; if(ihar==3) { - float fb=0.97 +1.06*exp(-0.5*b*b/3.2/3.2); - return pow(fb*sqrt(v2),3); + float fb=0.97 +1.06*std::exp(-0.5*b*b/3.2/3.2); + return std::pow(fb*std::sqrt(v2),3); } - float gb= 1.096 +1.36 *exp(-0.5*b*b/3.0/3.0); - gb=gb*sqrt(v2); - return pow(gb,ihar); + float gb= 1.096 +1.36 *std::exp(-0.5*b*b/3.0/3.0); + gb=gb*std::sqrt(v2); + return std::pow(gb,ihar); } @@ -281,8 +281,8 @@ profile_resolution->Write(); for(int ihar=0;ihar<6;ihar++){ double reso=profile_resolution->GetBinContent(ihar+1); - if (reso >=0) reso= sqrt( reso); - else reso=-sqrt(-reso); + if (reso >=0) reso= std::sqrt( reso); + else reso=-std::sqrt(-reso); for(int ieta=0;ieta<n_etabin;ieta++){ sprintf(name,"profile_pt_dep_reco_%d_eta%d",ihar+1,ieta); prof=(TProfile*)Infile->Get(name); diff --git a/Generators/FlowAfterburner/share/Plotting_Macros/DrawPlots_MB.C b/Generators/FlowAfterburner/share/Plotting_Macros/DrawPlots_MB.C index ddfd15076349bb03be3564b156b3b1c0ed1f7fe7..77b71106f1f70adc921ea068ab4afa1be1acbb33 100644 --- a/Generators/FlowAfterburner/share/Plotting_Macros/DrawPlots_MB.C +++ b/Generators/FlowAfterburner/share/Plotting_Macros/DrawPlots_MB.C @@ -394,8 +394,8 @@ for(int ihar=0;ihar<6;ihar++){ for(int ihar=0;ihar<6;ihar++){ for(int ib_imp=0;ib_imp<n_b_bins;ib_imp++){ double reso=profile_resolution[ihar]->GetBinContent(ib_imp+1); - if (reso >=0) reso= sqrt( reso); - else reso=-sqrt(-reso); + if (reso >=0) reso= std::sqrt( reso); + else reso=-std::sqrt(-reso); for(int ieta=0;ieta<n_etabin;ieta++){ profile_pt_dep_reco [ihar][ib_imp][ieta]->Scale(1.0/reso); diff --git a/Generators/FlowAfterburner/src/AddFlowByShifting.cxx b/Generators/FlowAfterburner/src/AddFlowByShifting.cxx index 8deece141497b6f3c52f0b1fa70fab96110dfa04..b13cd775e762efd262bf3e66c9eb22e4320cc243 100644 --- a/Generators/FlowAfterburner/src/AddFlowByShifting.cxx +++ b/Generators/FlowAfterburner/src/AddFlowByShifting.cxx @@ -264,7 +264,7 @@ StatusCode AddFlowByShifting::execute() { //skip particle if eta is outside implementation range if(m_floweta_sw){ - float eta=fabs(momentum.pseudoRapidity()); + float eta=std::abs(momentum.pseudoRapidity()); if (eta<m_flow_mineta || eta> m_flow_maxeta) continue; } @@ -358,7 +358,7 @@ void AddFlowByShifting::MoveDescendantsToParent ATH_MSG_DEBUG("Processing vertex " << HepMC::barcode(descvtx)); // rotate vertex - if(fabs(phishift) > 1e-7) { + if(std::abs(phishift) > 1e-7) { CLHEP::HepLorentzVector position(descvtx->position().x(), descvtx->position().y(), descvtx->position().z(), @@ -381,7 +381,7 @@ void AddFlowByShifting::MoveDescendantsToParent m_particles_processed++; // rotate particle - if(fabs(phishift) > 1e-7) { + if(std::abs(phishift) > 1e-7) { momentum.rotateZ(phishift*Gaudi::Units::rad); descpart->set_momentum( HepMC::FourVector(momentum.px(),momentum.py(),momentum.pz(),momentum.e()) ); ATH_MSG_DEBUG(" Phi shift = " << phishift<< @@ -488,7 +488,7 @@ double AddFlowByShifting::AddFlowToParent (HepMC::GenParticlePtr parent, const H phishift = phi-phi_0; } - if(fabs(phishift) > 1e-7) { + if(std::abs(phishift) > 1e-7) { momentum.rotateZ(phishift*Gaudi::Units::rad); parent->set_momentum( HepMC::FourVector(momentum.px(),momentum.py(),momentum.pz(),momentum.e()) ); } diff --git a/Generators/FlowAfterburner/src/CheckFlow.cxx b/Generators/FlowAfterburner/src/CheckFlow.cxx index 29c6db3e1c6b5278906a9d2761a1225552ccf058..cc3af1f4af077bd0d4555e3bddcaab833232fb20 100644 --- a/Generators/FlowAfterburner/src/CheckFlow.cxx +++ b/Generators/FlowAfterburner/src/CheckFlow.cxx @@ -221,8 +221,8 @@ StatusCode CheckFlow::execute() { << " Eta = " << rapid << " Phi = " << phi << " PhiR = " << phiR << endmsg; - if( (fabs(rapid) >= m_rapcut_min) && (fabs(rapid) <= m_rapcut_max) && - (fabs(pt) >= m_ptcut_min) && (fabs(pt) <= m_ptcut_max) ) { + if( (std::abs(rapid) >= m_rapcut_min) && (std::abs(rapid) <= m_rapcut_max) && + (std::abs(pt) >= m_ptcut_min) && (std::abs(pt) <= m_ptcut_max) ) { ngenerated++; m_phi->Fill(phi, 1.); double phi_corr = phi - phiR; diff --git a/Generators/FlowAfterburner/src/CheckFlow_New.cxx b/Generators/FlowAfterburner/src/CheckFlow_New.cxx index 9ea7fd0326a412231ffadf6a6340d074dbb629cd..087b4188d005b54de324977a45d93bfcb7857b71 100644 --- a/Generators/FlowAfterburner/src/CheckFlow_New.cxx +++ b/Generators/FlowAfterburner/src/CheckFlow_New.cxx @@ -295,13 +295,13 @@ StatusCode CheckFlow_New::execute() { << " PID = " << pid << " Status = " << p_stat << " Eta = " << rapid << " Phi = " << phi<< endmsg; - if( (fabs(rapid) >= m_rapcut_min) && (fabs(rapid) <= m_rapcut_max) && - (fabs(pt) >= m_ptcut_min) && (fabs(pt) <= m_ptcut_max) ) { + if( (std::abs(rapid) >= m_rapcut_min) && (std::abs(rapid) <= m_rapcut_max) && + (std::abs(pt) >= m_ptcut_min) && (std::abs(pt) <= m_ptcut_max) ) { for(int ihar=0;ihar<6;ihar++){ float temp=(ihar+1)*(phi-Psi_n[ihar]); - int ieta= (int)(fabs(rapid)*n_etabin/eta_bin_max); + int ieta= (int)(std::abs(rapid)*n_etabin/eta_bin_max); if(ieta>=0 && ieta<n_etabin) m_profile_pt_dep [ihar][ieta]->Fill(pt/1000,cos(temp)); diff --git a/Generators/FlowAfterburner/src/CheckFlow_New_Minbias.cxx b/Generators/FlowAfterburner/src/CheckFlow_New_Minbias.cxx index 83e3266694a96e9a427533c8357a1db57d3ebe9b..daeb30c2f5390ab6abb4d4dc3c379c05792ed5d9 100644 --- a/Generators/FlowAfterburner/src/CheckFlow_New_Minbias.cxx +++ b/Generators/FlowAfterburner/src/CheckFlow_New_Minbias.cxx @@ -271,15 +271,15 @@ StatusCode CheckFlow_New_Minbias::execute() { ATH_MSG_DEBUG(" PID = " << pid << " Status = " << p_stat \ << " Eta = " << rapid << " Phi = " << phi); - if( (fabs(rapid) >= m_rapcut_min) && - (fabs(rapid) <= m_rapcut_max) && - (fabs(pt) >= m_ptcut_min ) && - (fabs(pt) <= m_ptcut_max)) { + if( (std::abs(rapid) >= m_rapcut_min) && + (std::abs(rapid) <= m_rapcut_max) && + (std::abs(pt) >= m_ptcut_min ) && + (std::abs(pt) <= m_ptcut_max)) { for(int ihar=0;ihar<6;ihar++){ float temp=(ihar+1)*(phi-Psi_n[ihar]); - int ieta= (int)(fabs(rapid)*n_etabin/eta_bin_max); + int ieta= (int)(std::abs(rapid)*n_etabin/eta_bin_max); if(ieta>=0 && ieta<n_etabin) m_profile_pt_dep [ihar][ib_imp][ieta]->Fill(pt/1000,cos(temp)); @@ -321,7 +321,7 @@ StatusCode CheckFlow_New_Minbias::execute() { sin_ID1[ihar]+=sin((ihar+1)*phi); } } - if(fabs(pt)>=0){ + if(std::abs(pt)>=0){ tot_ID2++; for(int ihar=0;ihar<6;ihar++){ cos_ID2[ihar]+=cos((ihar+1)*phi); @@ -397,15 +397,15 @@ StatusCode CheckFlow_New_Minbias::execute() { double pt = pitr->momentum().perp(); double rapid = pitr->momentum().pseudoRapidity(); double phi = pitr->momentum().phi(); - if( (fabs(rapid) >= m_rapcut_min) && (fabs(rapid) <= m_rapcut_max) && - (fabs(pt) >= m_ptcut_min) && (fabs(pt) <= m_ptcut_max) ) { + if( (std::abs(rapid) >= m_rapcut_min) && (std::abs(rapid) <= m_rapcut_max) && + (std::abs(pt) >= m_ptcut_min) && (std::abs(pt) <= m_ptcut_max) ) { for(int ihar=0;ihar<6;ihar++){ float temp=(ihar+1)*(phi-Psi_n_reco_pos[ihar]); if(rapid>0) temp=(ihar+1)*(phi-Psi_n_reco_neg[ihar]); - int ieta= (int)(fabs(rapid)*n_etabin/eta_bin_max); + int ieta= (int)(std::abs(rapid)*n_etabin/eta_bin_max); if(ieta>=0 && ieta<n_etabin) m_profile_pt_dep_reco [ihar][ib_imp][ieta]->Fill(pt/1000,cos(temp)); float temp_pt=pt/1000; diff --git a/Generators/GenAnalysisTools/ReweightTools/src/PDFReweightTool.cxx b/Generators/GenAnalysisTools/ReweightTools/src/PDFReweightTool.cxx index da5c680795dab48d7cc94d2548dd738ce2e47424..58a6b8b7bb6330faefeb8165d29282fbfbf24bb2 100644 --- a/Generators/GenAnalysisTools/ReweightTools/src/PDFReweightTool.cxx +++ b/Generators/GenAnalysisTools/ReweightTools/src/PDFReweightTool.cxx @@ -436,8 +436,8 @@ StatusCode PDFReweightTool::Reweight(HepMC::GenEvent* evt) { //which is equal to // (cvPDF_new(p1) * cvPDF_new(p2)) / (cvPDF_original(p1) * cvPDF_original(p2)) else { - if (fabs(m_used_pdf1)>0.) m_weightFactor *= f1[fl1+6]/m_used_pdf1; - if (fabs(m_used_pdf2)>0.) m_weightFactor *= f2[fl2+6]/m_used_pdf2; + if (std::abs(m_used_pdf1)>0.) m_weightFactor *= f1[fl1+6]/m_used_pdf1; + if (std::abs(m_used_pdf2)>0.) m_weightFactor *= f2[fl2+6]/m_used_pdf2; //and replace original PDF values this->SetEventPDF1( f1[fl1+6] ); @@ -448,8 +448,8 @@ StatusCode PDFReweightTool::Reweight(HepMC::GenEvent* evt) { //calculate event weight at 'this' error PDF double weight = m_weightFactor; - if (fabs(m_used_pdf1)>0.) weight *= f1[fl1+6]/m_used_pdf1; - if (fabs(m_used_pdf2)>0.) weight *= f2[fl2+6]/m_used_pdf2; + if (std::abs(m_used_pdf1)>0.) weight *= f1[fl1+6]/m_used_pdf1; + if (std::abs(m_used_pdf2)>0.) weight *= f2[fl2+6]/m_used_pdf2; msg(MSG::DEBUG) <<" weight = " << weight diff --git a/Generators/GeneratorFilters/GeneratorFilters/VBFMjjIntervalFilter.h b/Generators/GeneratorFilters/GeneratorFilters/VBFMjjIntervalFilter.h index 04b4519f27d5e1ba942e445cfd512397f27b377b..9318b38e07d88a439e8f67e49c123e509f5c8b19 100644 --- a/Generators/GeneratorFilters/GeneratorFilters/VBFMjjIntervalFilter.h +++ b/Generators/GeneratorFilters/GeneratorFilters/VBFMjjIntervalFilter.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef GENERATORFILTERSVBFMJJINTERVALFILTER_H @@ -48,9 +48,9 @@ private: bool m_taujetoverlap; double m_alpha; - bool checkOverlap(double, double, std::vector<HepMC::GenParticlePtr>); - bool checkOverlap(double, double, std::vector<CLHEP::HepLorentzVector*>); - CLHEP::HepLorentzVector sumDaughterNeutrinos( HepMC::GenParticlePtr ); + bool checkOverlap(double, double, std::vector<HepMC::ConstGenParticlePtr>); + bool checkOverlap(double, double, std::vector<CLHEP::HepLorentzVector>); + CLHEP::HepLorentzVector sumDaughterNeutrinos( HepMC::ConstGenParticlePtr ); public: diff --git a/Generators/GeneratorFilters/GeneratorFilters/VHtoVVDiLepFilter.h b/Generators/GeneratorFilters/GeneratorFilters/VHtoVVDiLepFilter.h index 2886150e441acc47fc2462a4682ce8b0021acc05..3397add11221b5a1493381de6223651a84c3dd8e 100644 --- a/Generators/GeneratorFilters/GeneratorFilters/VHtoVVDiLepFilter.h +++ b/Generators/GeneratorFilters/GeneratorFilters/VHtoVVDiLepFilter.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef GENERATORFILTERS_VHTOVVFILTERDILEP_H @@ -36,7 +36,7 @@ private: int m_nVHtoVV; int m_nGoodVHtoVV; - void findAncestor(const HepMC::GenVertexPtr searchvertex, + void findAncestor(HepMC::ConstGenVertexPtr searchvertex, int targetPDGID, int& n_okPDGChild); }; diff --git a/Generators/GeneratorFilters/doc/GeneratorFilters.tex b/Generators/GeneratorFilters/doc/GeneratorFilters.tex index 831579594cd143c1ca5598c174946b65769d390c..18622cee3aa337c11a38779cfdb23124c234f705 100644 --- a/Generators/GeneratorFilters/doc/GeneratorFilters.tex +++ b/Generators/GeneratorFilters/doc/GeneratorFilters.tex @@ -75,7 +75,7 @@ and rapidity are available. pitr!=genEvt->particles_end(); ++pitr ){ if( ((*pitr)->pdg_id() == 11) || ((*pitr)->pdg_id() == -11) ){ if( ((*pitr)->momentum().perp() >=m_Ptmin) && - fabs((*pitr)->momentum().pseudoRapidity()) <=m_EtaRange){ + std::abs((*pitr)->momentum().pseudoRapidity()) <=m_EtaRange){ return StatusCode::SUCCESS; } \end{verbatim} diff --git a/Generators/GeneratorFilters/src/ATauFilter.cxx b/Generators/GeneratorFilters/src/ATauFilter.cxx index 8abfcf6c5c0ff28746e0d38a9fecf725f3b5020c..bc5e815579c2a4deb297fafc49f44ab9e745876d 100644 --- a/Generators/GeneratorFilters/src/ATauFilter.cxx +++ b/Generators/GeneratorFilters/src/ATauFilter.cxx @@ -169,7 +169,7 @@ StatusCode ATauFilter::filterEvent() { && ( std::abs( ataulep->momentum().pseudoRapidity() ) <= m_EtaRange ) ) { CLHEP::HepLorentzVector mom_taulep(taulep->momentum().px(), taulep->momentum().py(), taulep->momentum().pz(), taulep->momentum().e()); CLHEP::HepLorentzVector mom_ataulep(ataulep->momentum().px(), ataulep->momentum().py(), ataulep->momentum().pz(), ataulep->momentum().e()); - if ( fabs(mom_taulep.vect().deltaPhi(mom_ataulep.vect())) < m_maxdphi ) { + if ( std::abs(mom_taulep.vect().deltaPhi(mom_ataulep.vect())) < m_maxdphi ) { m_eventsllacc++; return StatusCode::SUCCESS; } @@ -183,10 +183,10 @@ StatusCode ATauFilter::filterEvent() { if ( ( ( ( taulep->momentum().perp() >= m_lhPtmine ) && ( taulep->pdg_id() == 11 ) ) || ( ( taulep->momentum().perp() >= m_lhPtminmu ) && ( taulep->pdg_id() == 13 ) ) ) && ( mom_atauprod.perp() >= m_lhPtminh ) - && ( fabs( taulep->momentum().pseudoRapidity() ) <= m_EtaRange ) - && ( fabs( mom_atauprod.pseudoRapidity() ) <= m_EtaRange ) ) { + && ( std::abs( taulep->momentum().pseudoRapidity() ) <= m_EtaRange ) + && ( std::abs( mom_atauprod.pseudoRapidity() ) <= m_EtaRange ) ) { CLHEP::HepLorentzVector mom_taulep(taulep->momentum().px(), taulep->momentum().py(), taulep->momentum().pz(), taulep->momentum().e()); - if ( fabs(mom_taulep.vect().deltaPhi(mom_atauprod.vect())) < m_maxdphi ) { + if ( std::abs(mom_taulep.vect().deltaPhi(mom_atauprod.vect())) < m_maxdphi ) { m_eventslhacc++; return StatusCode::SUCCESS; } @@ -220,7 +220,7 @@ StatusCode ATauFilter::filterEvent() { && ( mom_atauprod.perp() >= m_hhPtmin ) && ( std::abs( mom_tauprod.pseudoRapidity() ) <= m_EtaRange ) // check eta-range && ( std::abs( mom_atauprod.pseudoRapidity() ) <= m_EtaRange ) ) { - if ( fabs(mom_atauprod.vect().deltaPhi(mom_tauprod.vect())) < m_maxdphi ) { + if ( std::abs(mom_atauprod.vect().deltaPhi(mom_tauprod.vect())) < m_maxdphi ) { m_eventshhacc++; m_nPass++; return StatusCode::SUCCESS; diff --git a/Generators/GeneratorFilters/src/AsymJetFilter.cxx b/Generators/GeneratorFilters/src/AsymJetFilter.cxx index 2a55f558044016940d1e55c13ad2a7a408348322..c1558ab2a4e4624da0cd08991733d71bae8438e8 100644 --- a/Generators/GeneratorFilters/src/AsymJetFilter.cxx +++ b/Generators/GeneratorFilters/src/AsymJetFilter.cxx @@ -227,7 +227,7 @@ StatusCode AsymJetFilter::filterEvent() { FoundJet.setPy(jetpy); FoundJet.setPz(jetpz); FoundJet.setE(jete); - if (fabs(FoundJet.pseudoRapidity()) < m_UserEta) { + if (std::abs(FoundJet.pseudoRapidity()) < m_UserEta) { m_Jets.push_back(FoundJet); //OK we found one. add it to the list if its inside the eta region } } diff --git a/Generators/GeneratorFilters/src/BSignalFilter.cxx b/Generators/GeneratorFilters/src/BSignalFilter.cxx index 0b02b70cf50475551028b469016907612b5af1f5..01def0f4ab2cd27936870b8f019c3b9ae2ebf15b 100644 --- a/Generators/GeneratorFilters/src/BSignalFilter.cxx +++ b/Generators/GeneratorFilters/src/BSignalFilter.cxx @@ -360,7 +360,7 @@ StatusCode BSignalFilter::filterEvent() bool BSignalFilter::test_cuts(const double myPT, const double testPT, const double myEta, const double testEta) const { - return ( (myPT >= testPT) && (fabs(myEta) <= testEta) ); + return ( (myPT >= testPT) && (std::abs(myEta) <= testEta) ); } diff --git a/Generators/GeneratorFilters/src/BSubstruct.cxx b/Generators/GeneratorFilters/src/BSubstruct.cxx index c9be0a7f0e957fe3c8b413de39842dbce32b3ff3..13cd4b835007efa329222b7f2cbf42ed62c990da 100644 --- a/Generators/GeneratorFilters/src/BSubstruct.cxx +++ b/Generators/GeneratorFilters/src/BSubstruct.cxx @@ -49,7 +49,7 @@ inline bool BSubstruct::hasCBQuark(int pdgID) const { inline double BSubstruct::deltaPhi(double phi1, double phi2) const { - double dPhi = fabs(fmod(phi1 - phi2, 2*M_PI)); + double dPhi = std::abs(fmod(phi1 - phi2, 2*M_PI)); if (dPhi > M_PI) { dPhi = 2*M_PI - dPhi; } diff --git a/Generators/GeneratorFilters/src/Boosted2DijetFilter.cxx b/Generators/GeneratorFilters/src/Boosted2DijetFilter.cxx index 1b6717e636e42c5b2ca74972e12aba51e885068f..33fd57cb59a8d35edef7d4b07a0f3ff1434bf63a 100644 --- a/Generators/GeneratorFilters/src/Boosted2DijetFilter.cxx +++ b/Generators/GeneratorFilters/src/Boosted2DijetFilter.cxx @@ -108,14 +108,14 @@ StatusCode Boosted2DijetFilter::filterEvent() { //getting a collection of truth jets which pass some cuts for (jitr = (*truthjetTES).begin(); jitr !=(*truthjetTES).end(); ++jitr) { if( (*jitr)->pt() < m_jetPtMin ) continue; - if( fabs( (*jitr)->eta() ) > m_jetEtaMax ) continue; + if( std::abs( (*jitr)->eta() ) > m_jetEtaMax ) continue; jets.push_back(jitr); } //getting the akt8 truth jets for (jitr_akt8 = (*truthjetTES_akt8).begin(); jitr_akt8 !=(*truthjetTES_akt8).end(); ++jitr_akt8) { if( (*jitr_akt8)->pt() < m_akt8PtMin ) continue; - if( fabs( (*jitr_akt8)->eta() ) > m_jetEtaMax ) continue; + if( std::abs( (*jitr_akt8)->eta() ) > m_jetEtaMax ) continue; jets_akt8.push_back(jitr_akt8); } diff --git a/Generators/GeneratorFilters/src/BoostedHadTopAndTopPair.cxx b/Generators/GeneratorFilters/src/BoostedHadTopAndTopPair.cxx index 14ceaf9977d38c3e2425f8c9b917866d3de755b4..27d4df28ce55d1c710f0d465953ef9d83f734e28 100644 --- a/Generators/GeneratorFilters/src/BoostedHadTopAndTopPair.cxx +++ b/Generators/GeneratorFilters/src/BoostedHadTopAndTopPair.cxx @@ -78,8 +78,8 @@ StatusCode BoostedHadTopAndTopPair::filterEvent() { } // particle loop } // event loop - double pTPairList = sqrt( pow( topListMomentum.px() + topbListMomentum.px() , 2 ) + pow( topListMomentum.py() + topbListMomentum.py() , 2 )); - double pTPairChildren = sqrt( pow( topChildrenMomentum.px() + topbChildrenMomentum.px() , 2 ) + pow( topChildrenMomentum.py() + topbChildrenMomentum.py() , 2 )); + double pTPairList = std::sqrt( std::pow( topListMomentum.px() + topbListMomentum.px() , 2 ) + std::pow( topListMomentum.py() + topbListMomentum.py() , 2 )); + double pTPairChildren = std::sqrt( std::pow( topChildrenMomentum.px() + topbChildrenMomentum.px() , 2 ) + std::pow( topChildrenMomentum.py() + topbChildrenMomentum.py() , 2 )); if (m_cutPtOf == 0){ // cut on the pT of top on the truth list if (pTHadTopList >= m_tHadPtMin && pTHadTopList < m_tHadPtMax ) passTopHad = true; diff --git a/Generators/GeneratorFilters/src/ChargedTracksFilter.cxx b/Generators/GeneratorFilters/src/ChargedTracksFilter.cxx index 703ebf8eb836365e2e1de6ea46441df30294e453..47d5a02953c990cac9492bf107a6857d6bd4d1f6 100644 --- a/Generators/GeneratorFilters/src/ChargedTracksFilter.cxx +++ b/Generators/GeneratorFilters/src/ChargedTracksFilter.cxx @@ -34,7 +34,7 @@ StatusCode ChargedTracksFilter::filterEvent() { // Count tracks in specified acceptance const double pT = part->momentum().perp(); const double eta = part->momentum().pseudoRapidity(); - if (pT >= m_Ptmin && fabs(eta) <= m_EtaRange && pCharge != 0) { + if (pT >= m_Ptmin && std::abs(eta) <= m_EtaRange && pCharge != 0) { ATH_MSG_DEBUG("Found particle, " << " pT = " << pT << " eta = " << eta << diff --git a/Generators/GeneratorFilters/src/DecayLengthFilter.cxx b/Generators/GeneratorFilters/src/DecayLengthFilter.cxx index 292fe5f50a2607d75c6a06e1658168855ec9ad84..c6effd523b671982beff0c1947bc931d4d0ec25e 100644 --- a/Generators/GeneratorFilters/src/DecayLengthFilter.cxx +++ b/Generators/GeneratorFilters/src/DecayLengthFilter.cxx @@ -106,6 +106,6 @@ StatusCode DecayLengthFilter::filterEvent() { bool DecayLengthFilter::isAccepted(float distR, float distZ) { - return ( (fabs(distZ)>m_Zmin && fabs(distZ)<m_Zmax && distR<m_Rmax) || // endcaps - (distR>m_Rmin && distR<m_Rmax && fabs(distZ)<m_Zmax) ); // barrel + return ( (std::abs(distZ)>m_Zmin && std::abs(distZ)<m_Zmax && distR<m_Rmax) || // endcaps + (distR>m_Rmin && distR<m_Rmax && std::abs(distZ)<m_Zmax) ); // barrel } diff --git a/Generators/GeneratorFilters/src/DiBjetFilter.cxx b/Generators/GeneratorFilters/src/DiBjetFilter.cxx index 1d4790fac8ea111e8f308dd26cb09b452dcf452f..65929f92ab50be299912a3895e0dd3c0aa3eccf9 100644 --- a/Generators/GeneratorFilters/src/DiBjetFilter.cxx +++ b/Generators/GeneratorFilters/src/DiBjetFilter.cxx @@ -114,7 +114,7 @@ StatusCode DiBjetFilter::filterEvent() { lead_jet_pt = (*jitr)->pt(); } if( (*jitr)->pt() < m_jetPtMin ) continue; - if( fabs( (*jitr)->eta() ) > m_jetEtaMax ) continue; + if( std::abs( (*jitr)->eta() ) > m_jetEtaMax ) continue; jets.push_back(jitr); } diff --git a/Generators/GeneratorFilters/src/DiLeptonMassFilter.cxx b/Generators/GeneratorFilters/src/DiLeptonMassFilter.cxx index 86b09733151760fc2a38d0fbb658fba02b654192..392a484681b135381eae90bf5fe151aa25e735b4 100644 --- a/Generators/GeneratorFilters/src/DiLeptonMassFilter.cxx +++ b/Generators/GeneratorFilters/src/DiLeptonMassFilter.cxx @@ -41,7 +41,7 @@ StatusCode DiLeptonMassFilter::filterEvent() { // Pick electrons or muons with Pt > m_inPt and |eta| < m_maxEta if (abs(pdgId1) == 11 || abs(pdgId1) == 13) { - if ((*pitr1)->momentum().perp() >= m_minPt && fabs((*pitr1)->momentum().pseudoRapidity()) <= m_maxEta){ + if ((*pitr1)->momentum().perp() >= m_minPt && std::abs((*pitr1)->momentum().pseudoRapidity()) <= m_maxEta){ // Loop over all remaining particles in the event auto pitr2 = pitr1; @@ -57,7 +57,7 @@ StatusCode DiLeptonMassFilter::filterEvent() { // If m_allowElecMu is true allow also Z -> emu compinations (with charge requirements as above) if ((m_allowSameCharge && (abs(pdgId2) == abs(pdgId1) || (m_allowElecMu && (abs(pdgId2) == 11 || abs(pdgId2) == 13) ) ) ) || (!m_allowSameCharge && (pdgId2 == -1*pdgId1 || (m_allowElecMu && (pdgId2 == (pdgId1 < 0 ? 1 : -1) * 11 || (pdgId1 < 0 ? 1 : -1) * pdgId2 == 13) ) ) ) ) { - if ((*pitr2)->momentum().perp() >= m_minPt && fabs((*pitr2)->momentum().pseudoRapidity()) <= m_maxEta){ + if ((*pitr2)->momentum().perp() >= m_minPt && std::abs((*pitr2)->momentum().pseudoRapidity()) <= m_maxEta){ // Calculate invariant mass and apply cut HepMC::FourVector vec((*pitr1)->momentum().px() + (*pitr2)->momentum().px(), diff --git a/Generators/GeneratorFilters/src/DiPhotonFilter.cxx b/Generators/GeneratorFilters/src/DiPhotonFilter.cxx index 2c3d5b1812306b86760b1e3c549f7223bb7cc1ac..b3a3d55b36abc7e82bbca13919d1efb1e973e939 100644 --- a/Generators/GeneratorFilters/src/DiPhotonFilter.cxx +++ b/Generators/GeneratorFilters/src/DiPhotonFilter.cxx @@ -93,7 +93,7 @@ StatusCode DiPhotonFilter::filterEvent() { etamax = m_EtaRange_2nd; } if (MCTruthPhotonList[i]->momentum().perp() >= ptmin && - fabs(MCTruthPhotonList[i]->momentum().pseudoRapidity()) <= etamax) { + std::abs(MCTruthPhotonList[i]->momentum().pseudoRapidity()) <= etamax) { MCTruthPhotonList2.push_back(MCTruthPhotonList[i]); } } diff --git a/Generators/GeneratorFilters/src/DirectPhotonFilter.cxx b/Generators/GeneratorFilters/src/DirectPhotonFilter.cxx index 6854950ad8b0969c03493660487d86281b5d5b23..da1d530584a3bc1e19fccc98a475622775776e36 100644 --- a/Generators/GeneratorFilters/src/DirectPhotonFilter.cxx +++ b/Generators/GeneratorFilters/src/DirectPhotonFilter.cxx @@ -93,7 +93,7 @@ StatusCode DirectPhotonFilter::filterEvent() { for (HepMC::GenEvent::particle_const_iterator pitr=genEvt->particles_begin(); pitr!=genEvt->particles_end(); ++pitr) { if (((*pitr)->pdg_id() == 22)) { if( ((*pitr)->momentum().perp() >= m_Ptmin) && ((*pitr)->momentum().perp() <= m_Ptmax) && - fabs((*pitr)->momentum().pseudoRapidity()) <= m_EtaRange){ + std::abs((*pitr)->momentum().pseudoRapidity()) <= m_EtaRange){ ATH_MSG_DEBUG("Generic photon found with status = " << (*pitr)->status() << " " << (*pitr)->barcode()); HepMC::GenVertex* CandProdVertex = (*pitr)->production_vertex(); @@ -120,7 +120,7 @@ StatusCode DirectPhotonFilter::filterEvent() { if ( ((*pitr)->pdg_id() == 22) ){ if( (*pitr)->status() == 1 && ((*pitr)->momentum().perp() >= m_Ptmin) && ((*pitr)->momentum().perp() <= m_Ptmax) && - fabs((*pitr)->momentum().pseudoRapidity()) <= m_EtaRange){ + std::abs((*pitr)->momentum().pseudoRapidity()) <= m_EtaRange){ // The following lines are for cross checking purpose when using different generators HepMC::GenVertex* CandProdVertex = (*pitr)->production_vertex(); diff --git a/Generators/GeneratorFilters/src/DstD0K3piFilter.cxx b/Generators/GeneratorFilters/src/DstD0K3piFilter.cxx index 9e97570368993de111f71bbb30ea3d7f9eaf0995..4c086ac70e359e27a4ff1b55327367772db5cf7f 100644 --- a/Generators/GeneratorFilters/src/DstD0K3piFilter.cxx +++ b/Generators/GeneratorFilters/src/DstD0K3piFilter.cxx @@ -96,7 +96,7 @@ StatusCode DstD0K3piFilter::filterEvent() { // Work only with D* if (std::abs((*pitr)->pdg_id()) != 413) continue; // D*+ if ((*pitr)->momentum().perp() < m_Ptmin) continue; - if (fabs((*pitr)->momentum().pseudoRapidity()) > m_EtaRange) continue; + if (std::abs((*pitr)->momentum().pseudoRapidity()) > m_EtaRange) continue; int nDstChild = 0; HepMC::GenParticle* mcpartDst = *pitr; diff --git a/Generators/GeneratorFilters/src/ElectronFilter.cxx b/Generators/GeneratorFilters/src/ElectronFilter.cxx index 5f8f65f194a7482f7102cd4ed5479cbeb4401579..208248253216ae5d154ab7e3a0c5751d09a4f9f8 100644 --- a/Generators/GeneratorFilters/src/ElectronFilter.cxx +++ b/Generators/GeneratorFilters/src/ElectronFilter.cxx @@ -18,7 +18,7 @@ StatusCode ElectronFilter::filterEvent() { const HepMC::GenEvent* genEvt = *itr; for (auto part: *genEvt) { if (part->status() == 1 && abs(part->pdg_id()) == 11) { // electron - if (part->momentum().perp() >= m_Ptmin && fabs(part->momentum().pseudoRapidity()) <= m_EtaRange) { + if (part->momentum().perp() >= m_Ptmin && std::abs(part->momentum().pseudoRapidity()) <= m_EtaRange) { return StatusCode::SUCCESS; } } diff --git a/Generators/GeneratorFilters/src/FourLeptonInvMassFilter.cxx b/Generators/GeneratorFilters/src/FourLeptonInvMassFilter.cxx index f70572cd14c4b0b0245364d05cab354a13852a2e..829e9cb0a5302f1cd3056ae92f5c5b2d5b736097 100644 --- a/Generators/GeneratorFilters/src/FourLeptonInvMassFilter.cxx +++ b/Generators/GeneratorFilters/src/FourLeptonInvMassFilter.cxx @@ -45,7 +45,7 @@ StatusCode FourLeptonInvMassFilter::filterEvent() { // Pick electrons or muons with Pt > m_inPt and |eta| < m_maxEta int pdgId1((*pitr1)->pdg_id()); if (!(abs(pdgId1) == 11 || abs(pdgId1) == 13)) continue; - if (!((*pitr1)->momentum().perp() >= m_minPt && fabs((*pitr1)->momentum().pseudoRapidity()) <= m_maxEta)) continue; + if (!((*pitr1)->momentum().perp() >= m_minPt && std::abs((*pitr1)->momentum().pseudoRapidity()) <= m_maxEta)) continue; // Loop over all remaining particles in the event auto pitr2 = pitr1; @@ -57,7 +57,7 @@ StatusCode FourLeptonInvMassFilter::filterEvent() { // Pick electrons or muons with Pt > m_inPt and |eta| < m_maxEta int pdgId2((*pitr2)->pdg_id()); if (!(abs(pdgId2) == 11 || abs(pdgId2) == 13)) continue; - if (!((*pitr2)->momentum().perp() >= m_minPt && fabs((*pitr2)->momentum().pseudoRapidity()) <= m_maxEta)) continue; + if (!((*pitr2)->momentum().perp() >= m_minPt && std::abs((*pitr2)->momentum().pseudoRapidity()) <= m_maxEta)) continue; // Loop over all remaining particles in the event auto pitr3 = pitr2; @@ -69,7 +69,7 @@ StatusCode FourLeptonInvMassFilter::filterEvent() { // Pick electrons or muons with Pt > m_inPt and |eta| < m_maxEta int pdgId3((*pitr3)->pdg_id()); if (!(abs(pdgId3) == 11 || abs(pdgId3) == 13)) continue; - if (!((*pitr3)->momentum().perp() >= m_minPt && fabs((*pitr3)->momentum().pseudoRapidity()) <= m_maxEta)) continue; + if (!((*pitr3)->momentum().perp() >= m_minPt && std::abs((*pitr3)->momentum().pseudoRapidity()) <= m_maxEta)) continue; // Loop over all remaining particles in the event auto pitr4 = pitr3; @@ -81,7 +81,7 @@ StatusCode FourLeptonInvMassFilter::filterEvent() { // Pick electrons or muons with Pt > m_inPt and |eta| < m_maxEta int pdgId4((*pitr4)->pdg_id()); if (!(abs(pdgId4) == 11 || abs(pdgId4) == 13)) continue; - if (!((*pitr4)->momentum().perp() >= m_minPt && fabs((*pitr4)->momentum().pseudoRapidity()) <= m_maxEta)) continue; + if (!((*pitr4)->momentum().perp() >= m_minPt && std::abs((*pitr4)->momentum().pseudoRapidity()) <= m_maxEta)) continue; // 4lepton vector HepMC::FourVector vec((*pitr1)->momentum().px() + (*pitr2)->momentum().px() + (*pitr3)->momentum().px() + (*pitr4)->momentum().px(), diff --git a/Generators/GeneratorFilters/src/FourLeptonMassFilter.cxx b/Generators/GeneratorFilters/src/FourLeptonMassFilter.cxx index 39e8afba9d6b6c5cdc92deb63d71b03eae603beb..e7cf205ca5bb97f9a5b63555b10e1a7459e2de6f 100644 --- a/Generators/GeneratorFilters/src/FourLeptonMassFilter.cxx +++ b/Generators/GeneratorFilters/src/FourLeptonMassFilter.cxx @@ -44,7 +44,7 @@ StatusCode FourLeptonMassFilter::filterEvent() { // Pick electrons or muons with Pt > m_inPt and |eta| < m_maxEta int pdgId1((*pitr1)->pdg_id()); if (!(abs(pdgId1) == 11 || abs(pdgId1) == 13)) continue; - if (!((*pitr1)->momentum().perp() >= m_minPt && fabs((*pitr1)->momentum().pseudoRapidity()) <= m_maxEta)) continue; + if (!((*pitr1)->momentum().perp() >= m_minPt && std::abs((*pitr1)->momentum().pseudoRapidity()) <= m_maxEta)) continue; // Loop over all remaining particles in the event auto pitr2 = pitr1; @@ -55,7 +55,7 @@ StatusCode FourLeptonMassFilter::filterEvent() { // Pick electrons or muons with Pt > m_inPt and |eta| < m_maxEta int pdgId2((*pitr2)->pdg_id()); if (!(abs(pdgId2) == 11 || abs(pdgId2) == 13)) continue; - if (!((*pitr2)->momentum().perp() >= m_minPt && fabs((*pitr2)->momentum().pseudoRapidity()) <= m_maxEta)) continue; + if (!((*pitr2)->momentum().perp() >= m_minPt && std::abs((*pitr2)->momentum().pseudoRapidity()) <= m_maxEta)) continue; // Loop over all remaining particles in the event auto pitr3 = pitr2; @@ -66,8 +66,8 @@ StatusCode FourLeptonMassFilter::filterEvent() { // Pick electrons or muons with Pt > m_inPt and |eta| < m_maxEta int pdgId3((*pitr3)->pdg_id()); - if (!(abs(pdgId3) == 11 || abs(pdgId3) == 13)) continue; - if (!((*pitr3)->momentum().perp() >= m_minPt && fabs((*pitr3)->momentum().pseudoRapidity()) <= m_maxEta)) continue; + if (!(std::abs(pdgId3) == 11 || std::abs(pdgId3) == 13)) continue; + if (!((*pitr3)->momentum().perp() >= m_minPt && std::abs((*pitr3)->momentum().pseudoRapidity()) <= m_maxEta)) continue; // Loop over all remaining particles in the event auto pitr4 = pitr3; @@ -79,7 +79,7 @@ StatusCode FourLeptonMassFilter::filterEvent() { // Pick electrons or muons with Pt > m_inPt and |eta| < m_maxEta int pdgId4((*pitr4)->pdg_id()); if (!(abs(pdgId4) == 11 || abs(pdgId4) == 13)) continue; - if (!((*pitr4)->momentum().perp() >= m_minPt && fabs((*pitr4)->momentum().pseudoRapidity()) <= m_maxEta)) continue; + if (!((*pitr4)->momentum().perp() >= m_minPt && std::abs((*pitr4)->momentum().pseudoRapidity()) <= m_maxEta)) continue; decltype(pitr1) apitr[4] = {pitr1,pitr2,pitr3,pitr4}; int pdgIds[4]={pdgId1,pdgId2,pdgId3,pdgId4}; diff --git a/Generators/GeneratorFilters/src/GapJetFilter.cxx b/Generators/GeneratorFilters/src/GapJetFilter.cxx index 76d0ccb601dbf9b2699f2a6c08231a0dcde02237..53eb86942f1e19a9b95d4ba403df7aeeb99e5fbd 100644 --- a/Generators/GeneratorFilters/src/GapJetFilter.cxx +++ b/Generators/GeneratorFilters/src/GapJetFilter.cxx @@ -261,11 +261,11 @@ GapJetFilter::filterEvent() } float rapgap_cl=-100.; - if (fabs(cl_maxeta)<fabs(cl_mineta) && Clustag==1) { + if (std::abs(cl_maxeta)<std::abs(cl_mineta) && Clustag==1) { rapgap_cl = 4.9 - cl_maxeta; } - else if (fabs(cl_maxeta)>fabs(cl_mineta) && Clustag==1) { + else if (std::abs(cl_maxeta)>std::abs(cl_mineta) && Clustag==1) { rapgap_cl = 4.9 + cl_mineta; } diff --git a/Generators/GeneratorFilters/src/HTFilter.cxx b/Generators/GeneratorFilters/src/HTFilter.cxx index 8f161fd3db6ae97e409cdc807241ee464c4e698c..c5a168e0af91422b97c2044e7b7b67127013138a 100644 --- a/Generators/GeneratorFilters/src/HTFilter.cxx +++ b/Generators/GeneratorFilters/src/HTFilter.cxx @@ -89,7 +89,7 @@ StatusCode HTFilter::filterEvent() { double HT = -1; for (xAOD::JetContainer::const_iterator it_truth = (*truthjetTES).begin(); it_truth != (*truthjetTES).end() ; ++it_truth) { if (!(*it_truth)) continue; - if ( (*it_truth)->pt()>m_MinJetPt*CLHEP::GeV && fabs((*it_truth)->eta())<m_MaxJetEta ) { + if ( (*it_truth)->pt()>m_MinJetPt*CLHEP::GeV && std::abs((*it_truth)->eta())<m_MaxJetEta ) { ATH_MSG_VERBOSE("Adding truth jet with pt " << (*it_truth)->pt() << ", eta " << (*it_truth)->eta() << ", phi " << (*it_truth)->phi() diff --git a/Generators/GeneratorFilters/src/HeavyFlavorHadronFilter.cxx b/Generators/GeneratorFilters/src/HeavyFlavorHadronFilter.cxx index a258095fa6308f0e932eeabc871bcff4c49db766..48d368aafa2cd38901117ba91f29b99edcd7fa77 100644 --- a/Generators/GeneratorFilters/src/HeavyFlavorHadronFilter.cxx +++ b/Generators/GeneratorFilters/src/HeavyFlavorHadronFilter.cxx @@ -78,7 +78,7 @@ StatusCode HeavyFlavorHadronFilter::filterEvent() { const xAOD::JetContainer* truthjetTES; CHECK(evtStore()->retrieve( truthjetTES, m_TruthJetContainerName)); for (xAOD::JetContainer::const_iterator j = truthjetTES->begin(); j != truthjetTES->end() ; ++j) { - if ((*j)->pt() > m_jetPtMin && fabs((*j)->eta()) < m_jetEtaMax) { + if ((*j)->pt() > m_jetPtMin && std::abs((*j)->eta()) < m_jetEtaMax) { jets.push_back(j); } } @@ -99,7 +99,7 @@ StatusCode HeavyFlavorHadronFilter::filterEvent() { // of heavy flavor quarks! if (m_Request_bQuark && std::abs(part->pdg_id())==5 && part->momentum().perp()>m_bPtMin && - fabs(part->momentum().pseudoRapidity())<m_bEtaMax) { + std::abs(part->momentum().pseudoRapidity())<m_bEtaMax) { if (m_RequireTruthJet) { HepMC::FourVector tmp = part->momentum(); TLorentzVector genpart(tmp.x(), tmp.y(), tmp.z(), tmp.t()); @@ -121,7 +121,7 @@ StatusCode HeavyFlavorHadronFilter::filterEvent() { if (m_Request_cQuark && std::abs(part->pdg_id())==4 && part->momentum().perp()>m_cPtMin && - fabs(part->momentum().pseudoRapidity())<m_cEtaMax) { + std::abs(part->momentum().pseudoRapidity())<m_cEtaMax) { if (m_RequireTruthJet) { HepMC::FourVector tmp = part->momentum(); TLorentzVector genpart(tmp.x(), tmp.y(), tmp.z(), tmp.t()); @@ -139,7 +139,7 @@ StatusCode HeavyFlavorHadronFilter::filterEvent() { if (m_RequestBottom && isBwithWeakDK(part->pdg_id()) && part->momentum().perp()>m_bottomPtMin && - fabs(part->momentum().pseudoRapidity())<m_bottomEtaMax) { + std::abs(part->momentum().pseudoRapidity())<m_bottomEtaMax) { if (m_RequireTruthJet) { HepMC::FourVector tmp = part->momentum(); TLorentzVector genpart(tmp.x(), tmp.y(), tmp.z(), tmp.t()); @@ -157,7 +157,7 @@ StatusCode HeavyFlavorHadronFilter::filterEvent() { if (m_RequestCharm && isDwithWeakDK(part->pdg_id()) && part->momentum().perp()>m_charmPtMin && - fabs(part->momentum().pseudoRapidity())<m_charmEtaMax) { + std::abs(part->momentum().pseudoRapidity())<m_charmEtaMax) { if (m_RequireTruthJet) { HepMC::FourVector tmp = part->momentum(); TLorentzVector genpart(tmp.x(), tmp.y(), tmp.z(), tmp.t()); @@ -176,7 +176,7 @@ StatusCode HeavyFlavorHadronFilter::filterEvent() { (part->pdg_id() == m_PDGID || (m_PDGAntiParticleToo && std::abs(part->pdg_id()) == m_PDGID)); if (pdgok && part->momentum().perp() > m_PDGPtMin && - fabs(part->momentum().pseudoRapidity()) < m_PDGEtaMax) { + std::abs(part->momentum().pseudoRapidity()) < m_PDGEtaMax) { if (m_RequireTruthJet) { HepMC::FourVector tmp = part->momentum(); TLorentzVector genpart(tmp.x(), tmp.y(), tmp.z(), tmp.t()); diff --git a/Generators/GeneratorFilters/src/JetFilter.cxx b/Generators/GeneratorFilters/src/JetFilter.cxx index 3951a7a25b46a3d185952a1614b4b2b0e756bf34..b6be98a4cef3e910980975da21a6818c2f450e87 100644 --- a/Generators/GeneratorFilters/src/JetFilter.cxx +++ b/Generators/GeneratorFilters/src/JetFilter.cxx @@ -86,7 +86,7 @@ StatusCode JetFilter::filterEvent() { (part->pdg_id() != 12 ) && (part->pdg_id() != -12 ) && (part->pdg_id() != 14 ) && (part->pdg_id() != -14 ) && (part->pdg_id() != 16 ) && (part->pdg_id() != -16 ) && - (fabs(part->momentum().pseudoRapidity()) <= m_emaxeta) ) { // no neutrinos or muons and particles must be in active range + (std::abs(part->momentum().pseudoRapidity()) <= m_emaxeta) ) { // no neutrinos or muons and particles must be in active range int ip, ie; ip = (int) ((m_twopi/2.+ part->momentum().phi())/m_edphi); //phi is in range -CLHEP::pi to CLHEP::pi ie = (int) ((part->momentum().pseudoRapidity()+m_emaxeta)/m_edeta); @@ -201,7 +201,7 @@ StatusCode JetFilter::filterEvent() { FoundJet.setPy(jetpy); FoundJet.setPz(jetpz); FoundJet.setE(jete); - if (fabs(FoundJet.pseudoRapidity()) < m_UserEta) { + if (std::abs(FoundJet.pseudoRapidity()) < m_UserEta) { m_Jets.push_back(FoundJet); //OK we found one. add it to the list if its inside the eta region } } diff --git a/Generators/GeneratorFilters/src/JetFilterWithTruthPhoton.cxx b/Generators/GeneratorFilters/src/JetFilterWithTruthPhoton.cxx index 10ca6430a269386b74dd06ac4a1d3da75cc19033..e2a79e9bd4d82d6e8ef6516fcf70a34aa9cf8938 100644 --- a/Generators/GeneratorFilters/src/JetFilterWithTruthPhoton.cxx +++ b/Generators/GeneratorFilters/src/JetFilterWithTruthPhoton.cxx @@ -140,7 +140,7 @@ StatusCode JetFilterWithTruthPhoton::filterEvent() { &&(part->pdg_id() != 12 ) && (part->pdg_id() != -12 ) &&(part->pdg_id() != 14 ) && (part->pdg_id() != -14 ) &&(part->pdg_id() != 16 ) && (part->pdg_id() != -16 ) - && (fabs(part->momentum().pseudoRapidity()) <= m_emaxeta) + && (std::abs(part->momentum().pseudoRapidity()) <= m_emaxeta) ){ // no neutrinos or muons and particles must be in active range int ip,ie; ip=(int) ((m_twopi/2.+ part->momentum().phi())/m_edphi); //phi is in range -pi to pi @@ -158,7 +158,7 @@ StatusCode JetFilterWithTruthPhoton::filterEvent() { etgrid[ip][ie]=etgrid[ip][ie]+part->momentum().perp(); // fortran had pt here if (part->pdg_id() == 22 && part->momentum().perp() > m_photonPt && - fabs(part->momentum().pseudoRapidity()) < m_photonEta) { + std::abs(part->momentum().pseudoRapidity()) < m_photonEta) { MCTruthPhotonList.push_back(part); } #if 0 @@ -276,7 +276,7 @@ StatusCode JetFilterWithTruthPhoton::filterEvent() { FoundJet.setPy(jetpy); FoundJet.setPz(jetpz); FoundJet.setE(jete); - if(fabs(FoundJet.pseudoRapidity())< m_UserEta && + if(std::abs(FoundJet.pseudoRapidity())< m_UserEta && FoundJet.vect().perp() > m_UserThresh){ int foundPhotons = 0; //std::cout << "# of photons = " << MCTruthPhotonList.size() << std::endl; @@ -284,8 +284,8 @@ StatusCode JetFilterWithTruthPhoton::filterEvent() { if (m_photonSumPt >= 0. && MCTruthPhotonList.size() > 0) { double sumPt = 0.; for (unsigned int ig=0;ig<MCTruthPhotonList.size();++ig) { - double deta = fabs(MCTruthPhotonList[ig]->momentum().pseudoRapidity()-FoundJet.pseudoRapidity()); - double dphi = fabs(MCTruthPhotonList[ig]->momentum().phi()-FoundJet.phi()); + double deta = std::abs(MCTruthPhotonList[ig]->momentum().pseudoRapidity()-FoundJet.pseudoRapidity()); + double dphi = std::abs(MCTruthPhotonList[ig]->momentum().phi()-FoundJet.phi()); if (dphi > M_PI) dphi = 2.*M_PI - dphi; double dR = sqrt(deta*deta+dphi*dphi); if (dR < m_dRphotonjet) { diff --git a/Generators/GeneratorFilters/src/LeadingPhotonFilter.cxx b/Generators/GeneratorFilters/src/LeadingPhotonFilter.cxx index c9f83aa9fd26d2496046e2438ffeb477545d1196..f8a013c6a2fd6f75a1af85055f0a36d9f7fbf927 100644 --- a/Generators/GeneratorFilters/src/LeadingPhotonFilter.cxx +++ b/Generators/GeneratorFilters/src/LeadingPhotonFilter.cxx @@ -18,7 +18,7 @@ StatusCode LeadingPhotonFilter::filterEvent() { double ptmax = 0; for (auto p: *genEvt) { if (p->pdg_id() != 22 || p->status() != 1) continue; - if (fabs(p->momentum().pseudoRapidity()) > m_EtaRange) continue; + if (std::abs(p->momentum().pseudoRapidity()) > m_EtaRange) continue; ptmax = std::max(p->momentum().perp(), ptmax); } setFilterPassed(ptmax >= m_Ptmin && ptmax < m_Ptmax); diff --git a/Generators/GeneratorFilters/src/LeptonFilter.cxx b/Generators/GeneratorFilters/src/LeptonFilter.cxx index 561a35df411312e50842913b3c8345ee1ffa3559..e2762f641beebede5d468d20e30da9172617fdf1 100644 --- a/Generators/GeneratorFilters/src/LeptonFilter.cxx +++ b/Generators/GeneratorFilters/src/LeptonFilter.cxx @@ -50,7 +50,7 @@ StatusCode LeptonFilter::filterEvent() { << ": pT, eta = " << pT << ", " << eta ); // If we've found a stable electron or muon, check eta and pt - if (pT > leading_lepton_pt && fabs(eta) <= m_EtaRange) { + if (pT > leading_lepton_pt && std::abs(eta) <= m_EtaRange) { leading_lepton_pt = pT; } } diff --git a/Generators/GeneratorFilters/src/LeptonPairFilter.cxx b/Generators/GeneratorFilters/src/LeptonPairFilter.cxx index 066e842e310d84eb7bd28d287a7a937a4ef579d8..e10105b1f66cbe3dc5763932b8e4961c8477312d 100644 --- a/Generators/GeneratorFilters/src/LeptonPairFilter.cxx +++ b/Generators/GeneratorFilters/src/LeptonPairFilter.cxx @@ -163,7 +163,7 @@ StatusCode LeptonPairFilter::filterEvent() { ((*pitr)->pdg_id() == 13) || ((*pitr)->pdg_id() == -13) ){ //only consider leptons which satisfy pt and eta requirements - if( ((*pitr)->momentum().perp() >= m_Ptmin) && fabs((*pitr)->momentum().pseudoRapidity()) <=m_EtaRange){ + if( ((*pitr)->momentum().perp() >= m_Ptmin) && std::abs((*pitr)->momentum().pseudoRapidity()) <=m_EtaRange){ if(m_onlyMassiveParents) { auto p = *pitr; diff --git a/Generators/GeneratorFilters/src/MassRangeFilter.cxx b/Generators/GeneratorFilters/src/MassRangeFilter.cxx index f4e383ec1861950247e6a45ff13000cba61c44cc..2f5e92caa28d8c867430e0677e2ce5207e9e9c16 100644 --- a/Generators/GeneratorFilters/src/MassRangeFilter.cxx +++ b/Generators/GeneratorFilters/src/MassRangeFilter.cxx @@ -46,7 +46,7 @@ StatusCode MassRangeFilter::filterEvent() { if ((*pitr1)->status() != m_PartStatus ) continue; //status of the particle if (std::abs((*pitr1)->pdg_id()) != std::abs(m_PartId) ) continue; //PDG ID selection if ((*pitr1)->momentum().perp() < m_Ptmin ) continue; // pT cut - if (fabs((*pitr1)->momentum().pseudoRapidity()) > m_EtaRange) continue; //eta cut + if (std::abs((*pitr1)->momentum().pseudoRapidity()) > m_EtaRange) continue; //eta cut auto pitr2 = genEvt_particles_begin; if (samePDGID) { pitr2 = pitr1; @@ -57,7 +57,7 @@ StatusCode MassRangeFilter::filterEvent() { if ((*pitr2)->status() != m_PartStatus) continue; //status of the particle if (std::abs((*pitr2)->pdg_id()) != std::abs(m_PartId2)) continue; //PDG ID selection if ((*pitr2)->momentum().perp() < m_Ptmin2) continue; // pT cut - if (fabs((*pitr2)->momentum().pseudoRapidity()) > m_EtaRange2) continue;//eta cut + if (std::abs((*pitr2)->momentum().pseudoRapidity()) > m_EtaRange2) continue;//eta cut HepMC::FourVector vec((*pitr1)->momentum().px() + (*pitr2)->momentum().px(), (*pitr1)->momentum().py() + (*pitr2)->momentum().py(), diff --git a/Generators/GeneratorFilters/src/MissingEtFilter.cxx b/Generators/GeneratorFilters/src/MissingEtFilter.cxx index fa478d14add76066edb0514feafa43e4211cc53f..0415f0b50be2e81b2aeff116f43c934542711080 100644 --- a/Generators/GeneratorFilters/src/MissingEtFilter.cxx +++ b/Generators/GeneratorFilters/src/MissingEtFilter.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "GeneratorFilters/MissingEtFilter.h" @@ -24,7 +24,7 @@ StatusCode MissingEtFilter::filterEvent() { for (auto pitr: *genEvt) { if (!MC::isGenStable(pitr)) continue; if (!MC::isNonInteracting(pitr)) continue; - if(!m_useHadronicNu && MC::isNeutrino(pitr) && !(fromWZ(pitr) || fromTau(pitr)) ) continue; + if(!m_useHadronicNu && MC::PID::isNeutrino(pitr->pdg_id()) && !(fromWZ(pitr) || fromTau(pitr)) ) continue; ATH_MSG_VERBOSE("Found noninteracting particle: ID = " << pitr->pdg_id() << " PX = " << pitr->momentum().px() << " PY = "<< pitr->momentum().py()); sumx += pitr->momentum().px(); sumy += pitr->momentum().py(); @@ -32,7 +32,7 @@ StatusCode MissingEtFilter::filterEvent() { } // Now see what the total missing Et is and compare to minimum - double met = sqrt(sumx*sumx + sumy*sumy); + double met = std::sqrt(sumx*sumx + sumy*sumy); ATH_MSG_DEBUG("Totals for event: EX = " << sumx << ", EY = "<< sumy << ", ET = " << met); setFilterPassed(met >= m_METmin); return StatusCode::SUCCESS; @@ -66,7 +66,7 @@ bool MissingEtFilter::fromWZ( HepMC::ConstGenParticlePtr part ) const int parent_pdgid = (*iter)->pdg_id(); if (MC::PID::isW(parent_pdgid) || MC::PID::isZ(parent_pdgid)) return true; if (MC::PID::isHadron( parent_pdgid ) ) return false; - if ( abs( parent_pdgid ) < 9 ) return true; + if ( std::abs( parent_pdgid ) < 9 ) return true; if ( parent_pdgid == part->pdg_id() ) return fromWZ( *iter ); } #endif @@ -89,15 +89,15 @@ bool MissingEtFilter::fromTau( HepMC::ConstGenParticlePtr part ) const for (auto iter: part->production_vertex()->particles_in()){ int parent_pdgid = iter->pdg_id(); if ( std::abs( parent_pdgid ) == 15 && fromWZ(iter)) return true; - if (MC::PID::isHadron( parent_pdgid ) || abs( parent_pdgid ) < 9 ) return false; + if (MC::PID::isHadron( parent_pdgid ) || std::abs( parent_pdgid ) < 9 ) return false; if ( parent_pdgid == part->pdg_id() ) return fromTau( iter ); } #else for (HepMC::GenVertex::particles_in_const_iterator iter=part->production_vertex()->particles_in_const_begin(); iter!=part->production_vertex()->particles_in_const_end();++iter){ int parent_pdgid = (*iter)->pdg_id(); - if ( abs( parent_pdgid ) == 15 && fromWZ(*iter)) return true; - if (MC::PID::isHadron( parent_pdgid ) || abs( parent_pdgid ) < 9 ) return false; + if ( std::abs( parent_pdgid ) == 15 && fromWZ(*iter)) return true; + if (MC::PID::isHadron( parent_pdgid ) || std::abs( parent_pdgid ) < 9 ) return false; if ( parent_pdgid == part->pdg_id() ) return fromTau( *iter ); } #endif diff --git a/Generators/GeneratorFilters/src/MultiElectronFilter.cxx b/Generators/GeneratorFilters/src/MultiElectronFilter.cxx index a733526843827528a954c975c9ea759484454336..5bcb3ff0b18e2c1ea72f2c76b4cd9f44f7d392f8 100644 --- a/Generators/GeneratorFilters/src/MultiElectronFilter.cxx +++ b/Generators/GeneratorFilters/src/MultiElectronFilter.cxx @@ -22,7 +22,7 @@ StatusCode MultiElectronFilter::filterEvent() { for (auto part: *genEvt) { if ( part->status() != 1) continue; if ( abs(part->pdg_id()) != 11) continue; - if ( (part->momentum().perp() >= m_Ptmin) && fabs(part->momentum().pseudoRapidity()) <= m_EtaRange) { + if ( (part->momentum().perp() >= m_Ptmin) && std::abs(part->momentum().pseudoRapidity()) <= m_EtaRange) { numElectrons++; } } diff --git a/Generators/GeneratorFilters/src/MultiLeptonFilter.cxx b/Generators/GeneratorFilters/src/MultiLeptonFilter.cxx index 0e62fc746465bde42b52962ff95b83bdae8a10e2..ceace48f607a8e66dfc1394971713c0d66d18dc5 100644 --- a/Generators/GeneratorFilters/src/MultiLeptonFilter.cxx +++ b/Generators/GeneratorFilters/src/MultiLeptonFilter.cxx @@ -22,7 +22,7 @@ StatusCode MultiLeptonFilter::filterEvent() { for (auto part: *genEvt) { if ( part->status() != 1) continue; if ( abs(part->pdg_id()) == 11 || abs(part->pdg_id()) == 13 ) { - if (part->momentum().perp() >= m_Ptmin && fabs(part->momentum().pseudoRapidity()) <= m_EtaRange) { + if (part->momentum().perp() >= m_Ptmin && std::abs(part->momentum().pseudoRapidity()) <= m_EtaRange) { numLeptons += 1; } } diff --git a/Generators/GeneratorFilters/src/MultiObjectsFilter.cxx b/Generators/GeneratorFilters/src/MultiObjectsFilter.cxx index 9b2d1fb64c4b36dc98b88fa0186b2fa11ec5dde9..9588999fbc5536d801b9db4f2a8accae7b260705 100644 --- a/Generators/GeneratorFilters/src/MultiObjectsFilter.cxx +++ b/Generators/GeneratorFilters/src/MultiObjectsFilter.cxx @@ -62,7 +62,7 @@ StatusCode MultiObjectsFilter::filterEvent() { for (itr = events()->begin(); itr!=events()->end(); ++itr) { const HepMC::GenEvent* genEvt = (*itr); for (auto part: *genEvt) { - if (part->status()==1 && part->momentum().perp() > m_PtCut && fabs(part->momentum().pseudoRapidity()) < m_EtaCut) { + if (part->status()==1 && part->momentum().perp() > m_PtCut && std::abs(part->momentum().pseudoRapidity()) < m_EtaCut) { //electrons if (m_useEle && abs(part->pdg_id()) == 11) { ATH_MSG_DEBUG("Found electron: PT,ETA,PHI " << part->momentum().perp()/Gaudi::Units::GeV << "GeV, " << part->momentum().pseudoRapidity() << " " << part->momentum().phi()); @@ -86,7 +86,7 @@ StatusCode MultiObjectsFilter::filterEvent() { ATH_MSG_DEBUG("xAOD::JetContainer Size = " << truthjetTES->size()); for (xAOD::JetContainer::const_iterator jitr = truthjetTES->begin(); jitr != truthjetTES->end(); ++jitr) { - if ((*jitr)->pt() > m_jetPtCut && fabs((*jitr)->eta()) < m_jetEtaCut) { + if ((*jitr)->pt() > m_jetPtCut && std::abs((*jitr)->eta()) < m_jetEtaCut) { ATH_MSG_DEBUG("Found jet: pT, eta, phi = " << (*jitr)->pt()/Gaudi::Units::GeV << "GeV, " << (*jitr)->eta() << " " << (*jitr)->phi()); pt.push_back((*jitr)->pt()); } diff --git a/Generators/GeneratorFilters/src/PtmissAndOrLeptonFilter.cxx b/Generators/GeneratorFilters/src/PtmissAndOrLeptonFilter.cxx index 3d65fe6c32215ac038d6616dbd860daf83f47a53..83a21e5872399d6a081fce6711430ed920471aa5 100644 --- a/Generators/GeneratorFilters/src/PtmissAndOrLeptonFilter.cxx +++ b/Generators/GeneratorFilters/src/PtmissAndOrLeptonFilter.cxx @@ -90,7 +90,7 @@ StatusCode PtmissAndOrLeptonFilter::filterEvent() { for (auto part: *genEvt){ if (part->status() != 1) continue; const int abspid = abs(part->pdg_id()); - const double abseta = fabs(part->momentum().pseudoRapidity()); + const double abseta = std::abs(part->momentum().pseudoRapidity()); if (abspid == 11 && part->momentum().perp() > m_PtminElectron && abseta <= m_MaxEtaElectron) nelec++; if (abspid == 13 && part->momentum().perp() > m_PtminMuon && abseta <= m_MaxEtaMuon) nmuon++; diff --git a/Generators/GeneratorFilters/src/QCDTruthJetFilter.cxx b/Generators/GeneratorFilters/src/QCDTruthJetFilter.cxx index 2cd7130cb80fbde6aac660e048f64ef37ead5045..a44825b5b5c2a195becb4cf9e3ddc15fa93943d2 100644 --- a/Generators/GeneratorFilters/src/QCDTruthJetFilter.cxx +++ b/Generators/GeneratorFilters/src/QCDTruthJetFilter.cxx @@ -87,8 +87,6 @@ StatusCode QCDTruthJetFilter::filterEvent() { double pt_lead = -1; for (xAOD::JetContainer::const_iterator it_truth = (*truthjetTES).begin(); it_truth != (*truthjetTES).end() ; ++it_truth) { if (!(*it_truth)) continue; -// if (fabs( (*it_truth)->eta() ) > m_MaxEta) continue; -// if ((*it_truth)->eta() > m_MaxEta || (*it_truth)->eta() <= m_MinEta) continue; if ((*it_truth)->eta()>m_MaxEta || ( (*it_truth)->eta()<=m_MinEta && !m_SymEta) || ((*it_truth)->eta()<=m_MinEta && (*it_truth)->eta()>=-m_MinEta && m_SymEta)) continue; if (pt_lead < (*it_truth)->pt()) pt_lead = (*it_truth)->pt(); } diff --git a/Generators/GeneratorFilters/src/QCDTruthMultiJetFilter.cxx b/Generators/GeneratorFilters/src/QCDTruthMultiJetFilter.cxx index 0ef767942286fd9de68de161c7f8839a2b45c7d2..7e6c059af85fcc204421f49ad93f60d5d6e4fed3 100644 --- a/Generators/GeneratorFilters/src/QCDTruthMultiJetFilter.cxx +++ b/Generators/GeneratorFilters/src/QCDTruthMultiJetFilter.cxx @@ -83,7 +83,7 @@ StatusCode QCDTruthMultiJetFilter::filterEvent() { double pt_lead = -1; for (xAOD::JetContainer::const_iterator it_truth = (*truthjetTES).begin(); it_truth != (*truthjetTES).end() ; ++it_truth) { if (!(*it_truth)) continue; - if (fabs( (*it_truth)->eta() ) > m_MaxEta) continue; + if (std::abs( (*it_truth)->eta() ) > m_MaxEta) continue; if ((*it_truth)->pt() > m_NjetMinPt*Gaudi::Units::GeV) Njet++; if (pt_lead < (*it_truth)->pt()) pt_lead = (*it_truth)->pt(); } diff --git a/Generators/GeneratorFilters/src/SoftLeptonFilter.cxx b/Generators/GeneratorFilters/src/SoftLeptonFilter.cxx index afcca0b9690054a1b21f2eb3f1b0d9d28a891828..cab8b4df65e66a76eac92a1e634323707d334f58 100644 --- a/Generators/GeneratorFilters/src/SoftLeptonFilter.cxx +++ b/Generators/GeneratorFilters/src/SoftLeptonFilter.cxx @@ -18,7 +18,7 @@ StatusCode SoftLeptonFilter::filterEvent() { for (auto pitr: genEvt->particles()) { if (pitr->status() != 1) continue; if ( ( 2 != m_LeptonType && 11 == std::abs(pitr->pdg_id()) ) || ( 1 != m_LeptonType && 13 == std::abs(pitr->pdg_id()) )) { - if ((pitr->momentum().perp() >= m_Ptmin) && fabs(pitr->momentum().pseudoRapidity()) <= m_EtaRange) { + if ((pitr->momentum().perp() >= m_Ptmin) && std::abs(pitr->momentum().pseudoRapidity()) <= m_EtaRange) { // select e's from hadrons and from taus that come from hadrons, // and electrons from gammas that come from hadrons... (dalitz decay) auto decayVtx = pitr->production_vertex(); @@ -55,7 +55,7 @@ StatusCode SoftLeptonFilter::filterEvent() { for (HepMC::GenEvent::particle_const_iterator pitr = genEvt->particles_begin(); pitr != genEvt->particles_end(); ++pitr) { if ((*pitr)->status() != 1) continue; if ( ( 2 != m_LeptonType && 11 == abs((*pitr)->pdg_id()) ) || ( 1 != m_LeptonType && 13 == abs((*pitr)->pdg_id()) ) ) { - if ( ((*pitr)->momentum().perp() >= m_Ptmin) && fabs((*pitr)->momentum().pseudoRapidity()) <= m_EtaRange) { + if ( ((*pitr)->momentum().perp() >= m_Ptmin) && std::abs((*pitr)->momentum().pseudoRapidity()) <= m_EtaRange) { // select e's from hadrons and from taus that come from hadrons, // and electrons from gammas that come from hadrons... (dalitz decay) HepMC::GenVertex::particle_iterator firstParent; diff --git a/Generators/GeneratorFilters/src/SoftLeptonInJetFilter.cxx b/Generators/GeneratorFilters/src/SoftLeptonInJetFilter.cxx index 484f0ad4d47ca8460ae3b6d6f1f70f363bcdbdff..cc60593300de6dcb2cfd57f483263935e5ec9d67 100644 --- a/Generators/GeneratorFilters/src/SoftLeptonInJetFilter.cxx +++ b/Generators/GeneratorFilters/src/SoftLeptonInJetFilter.cxx @@ -84,8 +84,8 @@ StatusCode SoftLeptonInJetFilter::filterEvent() { for (int ie=0; ie < NLeptons; ie++ ) { double deltaEta = eta_b[ib]-eta_e[ie]; - double deltaPhi = fabs(phi_b[ib]-phi_e[ie]); - if (deltaPhi > M_PI ) deltaPhi = fabs(deltaPhi-2*M_PI); + double deltaPhi = std::abs(phi_b[ib]-phi_e[ie]); + if (deltaPhi > M_PI ) deltaPhi = std::abs(deltaPhi-2*M_PI); dR = sqrt(deltaEta*deltaEta + deltaPhi*deltaPhi); if (dR < m_jet_cone) { diff --git a/Generators/GeneratorFilters/src/TTbarMassFilter.cxx b/Generators/GeneratorFilters/src/TTbarMassFilter.cxx index 64f2a727c82c89245ba2ca761ac2bfd69ec9e1e1..2ab630d8d255c1f8768d033a419c37ee97f75007 100644 --- a/Generators/GeneratorFilters/src/TTbarMassFilter.cxx +++ b/Generators/GeneratorFilters/src/TTbarMassFilter.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "GeneratorFilters/TTbarMassFilter.h" @@ -20,11 +20,113 @@ StatusCode TTbarMassFilter::filterEvent() { bool isLastTop = false; bool isFirstTop = false; double topPairInvariantMass = 0.; - std::vector<HepMC::GenParticlePtr> tops; - std::vector<HepMC::GenVertexPtr> top_vtxs; + std::vector<HepMC::ConstGenParticlePtr> tops; + std::vector<HepMC::ConstGenVertexPtr> top_vtxs; for (McEventCollection::const_iterator itr = events()->begin(); itr!=events()->end(); ++itr) { const HepMC::GenEvent* genEvt = (*itr); +#ifdef HEPMC3 + for ( auto mcpart: *genEvt) { + // Reset the flag. it become true if the top with a final ('last') status is found + isLastTop = false; + // Reset the flag. becomes true if the top with the initial ('first') status is found + isFirstTop = false; + + // Work only with tops + if (std::abs(mcpart->pdg_id()) == 6) { + // Assume that this is the 'last' top + isLastTop=true; + auto decayVtx = mcpart->end_vertex(); + // Unusual case... + if (!decayVtx) { + ATH_MSG_WARNING("top particle with a status "<<mcpart->status()<<" has no valid decay vertex. "); + ATH_MSG_WARNING("It looks like a Pythia history particle if it has a status=3. Skip this particle "); + continue; + } + + // Find out whether this is the top particle with final statuscode, so, just before its decay. + /// @todo How generator-portable is this status code assumption? + for (auto child_mcpart: decayVtx->particles_out() ) { + if (std::abs(child_mcpart->pdg_id()) == 6) { + // This is not a 'last' top: break the loop over the children, and do nothing with this top particle + isLastTop = false; + break; + } + } + + // Store the 'last' top + if (isLastTop) { + ATH_MSG_DEBUG("Top particle with a status " << mcpart->status() << " is found and stored"); + tops.push_back(mcpart); + } + + // Find and store production vertices for the 'last' tops. This will help to easily couple top and anti-top + // pairs later if there are 2 pairs of them. It's a very rare case but needs to be properly handled. + if (isLastTop) { + // Investigate whether this top particle is the 'first' one. + isFirstTop = false; + // Retrieve the production vertex of the current 'last' top particle + auto prodVtx = mcpart->production_vertex(); + if (!prodVtx) { + ATH_MSG_WARNING("Top particle with a status " << mcpart->status() << " has no valid production vertex"); + //save null pointer for consistency + top_vtxs.push_back(nullptr); + } else { + // Loop until the 'first' top particle production vertex is not reached + while (!isFirstTop && prodVtx) { + // Loop over the top mother particles + for (auto mother_mcpart: prodVtx->particles_in()) { + // One of the mother particles is still top quark. needed to go up in the hierarchy + if (mother_mcpart->pdg_id() == 6) { + isFirstTop = false; + prodVtx = mother_mcpart->production_vertex(); + if (!prodVtx) { + ATH_MSG_WARNING("mother particle is still a top with a status " << mcpart->status() << ", but has no valid production vertex"); + top_vtxs.push_back(nullptr); + } + break; + } else { + // The current (in loop over the mother particles) mother particle is not a top. + // maybe the found top particle is the initial one? set the flag true. it will be + // set false if one of the other mother particles is top quark. + isFirstTop = true; + } + } + } + + //Store the production vertex for the given top particle. it's a production vertex + // of the initial ('first') top particle for the current final ('last') top. + if (isFirstTop) { + top_vtxs.push_back(prodVtx); + } + } + } + + // Investigate how many top and anti-tops are found and make a decision + // to continue or stop looping over GenParticles in the event + if (isLastTop) { + // One more 'last' top particle was stored into the vector --> increment the number of top or anti-top particles. + if (tops[tops.size()-1]->pdg_id() == 6) top++; else topbar++; + + // One top and one ati-top 'last' particles are found. Stop looping + // over the particles + if (top==1 && topbar==1) break; + + // This should not happen. But depends on a style how a given + // generator records the particles. In very rare cases there are more + // than 1 top-pairs created. If occasionally the same signed tops from + // the different couples are ordered first in the generator record, + // then the situation below is possible + if (top > 1 || topbar > 1) ATH_MSG_INFO("More than one top-pair exist in the event."); + + // Both top-pairs are found. don't expect more than that. So, it's + // time to break the loop over particles. this fairly assumes that + // there are no more top-pairs + if (top==2 && topbar==2) break; + } + } + } +#else HepMC::GenEvent::particle_const_iterator pitr = genEvt->particles_begin(); for (; pitr!=genEvt->particles_end(); ++pitr) { // Reset the flag. it become true if the top with a final ('last') status is found @@ -34,7 +136,7 @@ StatusCode TTbarMassFilter::filterEvent() { HepMC::GenParticle* mcpart = (*pitr); // Work only with tops - if (abs(mcpart->pdg_id()) == 6) { + if (std::abs(mcpart->pdg_id()) == 6) { // Assume that this is the 'last' top isLastTop=true; HepMC::GenVertex* decayVtx = mcpart->end_vertex(); @@ -135,6 +237,7 @@ StatusCode TTbarMassFilter::filterEvent() { } } +#endif } // Main case: there is one top-pair in the event @@ -158,7 +261,7 @@ StatusCode TTbarMassFilter::filterEvent() { double topPairInvMass_2=0.; // There must be only two different vertecies out of the four - const HepMC::GenVertexPtr prodVtx = top_vtxs[0]; + auto prodVtx = top_vtxs[0]; int top_11 = 0; int top_12 = -1; int top_21 = -1; diff --git a/Generators/GeneratorFilters/src/TTbarPlusHeavyFlavorFilter.cxx b/Generators/GeneratorFilters/src/TTbarPlusHeavyFlavorFilter.cxx index 681ab365ae0d418373a5504db8cd6e19cf955b0f..5092d2403ce78c454e302ca62946097e09d472a6 100644 --- a/Generators/GeneratorFilters/src/TTbarPlusHeavyFlavorFilter.cxx +++ b/Generators/GeneratorFilters/src/TTbarPlusHeavyFlavorFilter.cxx @@ -160,7 +160,7 @@ bool TTbarPlusHeavyFlavorFilter::passBSelection(HepMC::ConstGenParticlePtr part) const HepMC::FourVector& p4 = part->momentum(); double pt = p4.perp(); - double eta = fabs(p4.eta()); + double eta = std::abs(p4.eta()); if(pt<m_bPtMinCut) return false; if(eta>m_bEtaMaxCut) return false; @@ -173,7 +173,7 @@ bool TTbarPlusHeavyFlavorFilter::passCSelection(HepMC::ConstGenParticlePtr part) const HepMC::FourVector& p4 = part->momentum(); double pt = p4.perp(); - double eta = fabs(p4.eta()); + double eta = std::abs(p4.eta()); if(pt<m_cPtMinCut) return false; if(eta>m_cEtaMaxCut) return false; diff --git a/Generators/GeneratorFilters/src/TTbarPlusJetsFilter.cxx b/Generators/GeneratorFilters/src/TTbarPlusJetsFilter.cxx index 017a6f3172ce1d72a3f2a6815ed2001241520ed1..4da199387439459dcdb1011583255bc603272e1f 100644 --- a/Generators/GeneratorFilters/src/TTbarPlusJetsFilter.cxx +++ b/Generators/GeneratorFilters/src/TTbarPlusJetsFilter.cxx @@ -122,14 +122,14 @@ StatusCode TTbarPlusJetsFilter::filterEvent() { const TLorentzVector jet_tlv = (*jiter)->p4(); const CLHEP::HepLorentzVector jet_hlv(jet_tlv.Px(), jet_tlv.Py(), jet_tlv.Pz(), jet_tlv.E()); - if (jet_tlv.Et() >= m_ptMinJet && fabs(aJet->eta())<= m_etaMaxJet) { + if (jet_tlv.Et() >= m_ptMinJet && std::abs(aJet->eta())<= m_etaMaxJet) { ijet++; ATH_MSG_VERBOSE("-> jet : eta = " << aJet->eta() << " phi = " << aJet->phi() << " pt = " << jet_tlv.Et()); - if (aJet->pt() >= m_ptMinJetB && fabs(aJet->eta()) <= m_etaMaxJetB) { + if (aJet->pt() >= m_ptMinJetB && std::abs(aJet->eta()) <= m_etaMaxJetB) { bool isjet = true; for (unsigned int iele = 0; iele < electronFakingJetCandidates.size(); iele++) { double deltaR = jet_hlv.deltaR( electronFakingJetCandidates[iele] ); - double deltaPt = fabs(jet_tlv.Et() - electronFakingJetCandidates[iele].perp()); + double deltaPt = std::abs(jet_tlv.Et() - electronFakingJetCandidates[iele].perp()); ATH_MSG_VERBOSE("--> matching to electron " << iele << " dR = " << deltaR << " dPt = " << deltaPt << " dPt/Pt = " << deltaPt/jet_tlv.Et()); if (deltaR < 0.4 && deltaPt/jet_tlv.Et() < 0.1) isjet = false; } diff --git a/Generators/GeneratorFilters/src/TauFilter.cxx b/Generators/GeneratorFilters/src/TauFilter.cxx index 774c86810171886dc4d2edc255435cbb273287f7..253607e6d5709464185fd1e979aebfa9f6a7a118 100644 --- a/Generators/GeneratorFilters/src/TauFilter.cxx +++ b/Generators/GeneratorFilters/src/TauFilter.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "GeneratorFilters/TauFilter.h" @@ -58,35 +58,30 @@ CLHEP::HepLorentzVector TauFilter::sumDaughterNeutrinos( HepMC::ConstGenParticle StatusCode TauFilter::filterEvent() { - HepMC::GenParticlePtr tau; CLHEP::HepLorentzVector mom_tauprod; // will contain the momentum of the products of the tau decay CLHEP::HepLorentzVector tauvis; CLHEP::HepLorentzVector nutau; - tau = 0; int ntau = 0; McEventCollection::const_iterator itr; for (itr = events()->begin(); itr!=events()->end(); ++itr) { const HepMC::GenEvent* genEvt = (*itr); - for (HepMC::GenEvent::particle_const_iterator pitr = genEvt->particles_begin(); pitr != genEvt->particles_end(); ++pitr) { + for ( auto tau: *genEvt) { // Look for the first tau with genstat != 3 - if (abs((*pitr)->pdg_id()) == 15 && (*pitr)->status() != 3) { - tau = (*pitr); - ATH_MSG_DEBUG("found tau with barcode " << tau->barcode() << " status " << (*pitr)->status()); + if (std::abs(tau->pdg_id()) != 15 || tau->status() == 3) continue; + ATH_MSG_DEBUG("found tau with barcode " << HepMC::barcode(tau) << " status " << tau->status()); ATH_MSG_DEBUG("pT\t\teta\tphi\tid"); ATH_MSG_DEBUG(tau->momentum().perp() << "\t" << tau->momentum().eta() << "\t" << tau->momentum().phi() << "\t" << tau->pdg_id() << "\t"); - - HepMC::GenVertex::particles_out_const_iterator begin = tau->end_vertex()->particles_out_const_begin(); - HepMC::GenVertex::particles_out_const_iterator end = tau->end_vertex()->particles_out_const_end(); int leptonic = 0; - for ( ; begin != end; begin++ ) { - if ( (*begin)->production_vertex() != tau->end_vertex() ) continue; - if ( abs( (*begin)->pdg_id() ) == 12 ) leptonic = 1; - if ( abs( (*begin)->pdg_id() ) == 14 ) leptonic = 2; - if ( abs( (*begin)->pdg_id() ) == 15 ) leptonic = 11; + if ( tau->production_vertex()) continue; + for (auto beg: *(tau->end_vertex())) { + if ( beg->production_vertex() != tau->end_vertex() ) continue; + if ( std::abs( beg->pdg_id() ) == 12 ) leptonic = 1; + if ( std::abs( beg->pdg_id() ) == 14 ) leptonic = 2; + if ( std::abs( beg->pdg_id() ) == 15 ) leptonic = 11; } if (leptonic == 11) { @@ -108,23 +103,22 @@ StatusCode TauFilter::filterEvent() { if ( leptonic == 1 ) { m_eventse++; if ( tauvis.perp() < m_pTmine ) continue; - if ( fabs( tauvis.eta() ) > m_etaMaxe ) continue; + if ( std::abs( tauvis.eta() ) > m_etaMaxe ) continue; ntau++; m_eventseacc++; } else if ( leptonic == 2 ) { m_eventsmu++; if ( tauvis.perp() < m_pTminmu ) continue; - if ( fabs( tauvis.eta() ) > m_etaMaxmu ) continue; + if ( std::abs( tauvis.eta() ) > m_etaMaxmu ) continue; ntau++; m_eventsmuacc++; } else if ( leptonic == 0 ) { m_eventshad++; if ( tauvis.perp() < m_pTminhad ) continue; - if ( fabs( tauvis.eta() ) > m_etaMaxhad ) continue; + if ( std::abs( tauvis.eta() ) > m_etaMaxhad ) continue; ntau++; m_eventshadacc++; } - } } } diff --git a/Generators/GeneratorFilters/src/TopCKMFilter.cxx b/Generators/GeneratorFilters/src/TopCKMFilter.cxx index 0c8eba4416a5d7b88d75349f9740684b757e8186..6363fc2b8b3849bb2cc5d55d9f877a89b142818c 100644 --- a/Generators/GeneratorFilters/src/TopCKMFilter.cxx +++ b/Generators/GeneratorFilters/src/TopCKMFilter.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "GeneratorFilters/TopCKMFilter.h" @@ -29,6 +29,37 @@ StatusCode TopCKMFilter::filterEvent() { McEventCollection::const_iterator itr; for (itr = events()->begin(); itr!=events()->end(); ++itr) { const HepMC::GenEvent * genEvt = (*itr); +#ifdef HEPMC3 + // Get the number of parents on the event (ttbar --> 2 tops!) + std::vector<HepMC::ConstGenParticlePtr> Parents; + for (auto partItr: *genEvt) if (std::abs(partItr->pdg_id()) == 6) Parents.push_back(partItr); + if (Parents.size() != 2) continue; + // Check that the first and second parents have the corresponding childs + if (!Parents.at(0) || !Parents.at(1)) continue; + int Wbosons[2]={0,0}; + int quarks[2]={0,0}; + bool isTau[2] ={false,false}; + for (int i=0;i<2;i++) + { + for (auto Child: *(Parents.at(i)->end_vertex())) + { + if ((std::abs(Child->pdg_id()) == m_PDGChild[0] || std::abs(Child->pdg_id()) == m_PDGChild[1]) + && (Child->momentum().perp() > m_PtMinChild) + && (std::abs(Child->momentum().eta()) < m_EtaRangeChild)) + quarks[i]=Child->pdg_id(); + if (std::abs(Child->pdg_id()) == 24) + { + Wbosons[i]=Child->pdg_id(); + if (!Child->end_vertex()) continue; + for (auto gChild: *(Child->end_vertex()) if (std::abs(gChild->pdg_id()) == 15) isTau[i] = true; + } + } + } + if ( quarks[0]!=0 && quarks[1]!=0 && Wbosons[0]!=0 && Wbosons[1]!=0 && !isTau[0] && !isTau[1] && (std::abs(quarks[0]) != std::abs(quarks[1])) ) + { + return StatusCode::SUCCESS; + } +#else HepMC::GenEvent::particle_const_iterator part1 = genEvt->particles_begin(); HepMC::GenEvent::particle_const_iterator partItr = part1; HepMC::GenEvent::particle_const_iterator partE = genEvt->particles_end(); @@ -71,23 +102,23 @@ StatusCode TopCKMFilter::filterEvent() { HepMC::GenParticle * wBoson2 = 0; for (firstChildItr = firstChild1; firstChildItr != firstChildE; ++firstChildItr) { - if ((abs((*firstChildItr)->pdg_id()) == m_PDGChild[0] || abs((*firstChildItr)->pdg_id()) == m_PDGChild[1]) + if ((std::abs((*firstChildItr)->pdg_id()) == m_PDGChild[0] || std::abs((*firstChildItr)->pdg_id()) == m_PDGChild[1]) && (*firstChildItr)->momentum().perp() > m_PtMinChild - && fabs((*firstChildItr)->momentum().eta()) < m_EtaRangeChild) { + && std::abs((*firstChildItr)->momentum().eta()) < m_EtaRangeChild) { isOK1 = 1; quark1 = (*firstChildItr); } - if (abs((*firstChildItr)->pdg_id()) == 24) wBoson1 = (*firstChildItr); + if (std::abs((*firstChildItr)->pdg_id()) == 24) wBoson1 = (*firstChildItr); } for (secondChildItr = secondChild1; secondChildItr != secondChildE; ++secondChildItr) { - if ((abs((*secondChildItr)->pdg_id()) == m_PDGChild[0] || abs((*secondChildItr)->pdg_id()) == m_PDGChild[1]) + if ((std::abs((*secondChildItr)->pdg_id()) == m_PDGChild[0] || std::abs((*secondChildItr)->pdg_id()) == m_PDGChild[1]) && (*secondChildItr)->momentum().perp() > m_PtMinChild - && fabs((*secondChildItr)->momentum().eta()) < m_EtaRangeChild){ + && std::abs((*secondChildItr)->momentum().eta()) < m_EtaRangeChild){ isOK2 = 1; quark2 = (*secondChildItr); } - if (abs((*secondChildItr)->pdg_id()) == 24) wBoson2 = (*secondChildItr); + if (std::abs((*secondChildItr)->pdg_id()) == 24) wBoson2 = (*secondChildItr); } // Now avoid the decay W --> tau nu @@ -105,16 +136,17 @@ StatusCode TopCKMFilter::filterEvent() { w2SonE = wVertex2->particles_end(HepMC::children); for (w1SonItr = w1Son1; w1SonItr != w1SonE; ++w1SonItr) { - if (abs((*w1SonItr)->pdg_id()) == 15) isTau1 = 1; + if (std::abs((*w1SonItr)->pdg_id()) == 15) isTau1 = 1; } for (w2SonItr = w2Son1; w2SonItr != w2SonE; ++w2SonItr) { - if (abs((*w2SonItr)->pdg_id()) == 15) isTau2 = 1; + if (std::abs((*w2SonItr)->pdg_id()) == 15) isTau2 = 1; } - if (isOK1 && isOK2 && !isTau1 && !isTau2 && abs(quark1->pdg_id()) != abs(quark2->pdg_id())) { + if (isOK1 && isOK2 && !isTau1 && !isTau2 && std::abs(quark1->pdg_id()) != std::abs(quark2->pdg_id())) { return StatusCode::SUCCESS; } } } +#endif } setFilterPassed(false); return StatusCode::SUCCESS; diff --git a/Generators/GeneratorFilters/src/TopCKMKinFilter.cxx b/Generators/GeneratorFilters/src/TopCKMKinFilter.cxx index 13dc2976d4bb423f9c9a494ef041950b0a2c2009..cd534e9948145ee16e939bc015658c56f29d97f1 100644 --- a/Generators/GeneratorFilters/src/TopCKMKinFilter.cxx +++ b/Generators/GeneratorFilters/src/TopCKMKinFilter.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "GeneratorFilters/TopCKMKinFilter.h" @@ -32,6 +32,44 @@ StatusCode TopCKMKinFilter::filterInitialize() { StatusCode TopCKMKinFilter::filterEvent() { for (McEventCollection::const_iterator itr = events()->begin(); itr!=events()->end(); ++itr) { const HepMC::GenEvent * genEvt = (*itr); +#ifdef HEPMC3 + // Get the number of parents on the event (ttbar --> 2 tops!) + std::vector<HepMC::ConstGenParticlePtr> Parents; + for (auto partItr: *genEvt) if (std::abs(partItr->pdg_id()) == 6) Parents.push_back(partItr); + if (Parents.size() != 2) continue; + // Check that the first and second parents have the corresponding childs + if (!Parents.at(0) || !Parents.at(1)) continue; + int Wbosons[2]={0,0}; + int quarks[2]={0,0}; + bool isTau[2] ={false,false}; + bool isKinLep[2] ={false,false}; + for (int i=0;i<2;i++) + { + for (auto Child: *(Parents.at(i)->end_vertex())) + { + if ((std::abs(Child->pdg_id()) == m_PDGChild[0] || std::abs(Child->pdg_id()) == m_PDGChild[1]) + && (Child->momentum().perp() > m_PtMinChild) + && (std::abs(Child->momentum().eta()) < m_EtaRangeChild)) + quarks[i]=Child->pdg_id(); + if (std::abs(Child->pdg_id()) == 24) + { + Wbosons[i]=Child->pdg_id(); + if (!Child->end_vertex()) continue; + for (auto gChild: *(Child->end_vertex())) + { + if (std::abs(gChild->pdg_id()) == 15) isTau[i] = true; + if (std::abs(gChild->pdg_id()) == 11 || std::abs(gChild->pdg_id()) == 13){ + if (gChild->momentum().perp() > m_PtMinChild && std::abs(gChild->momentum().eta()) < m_EtaRangeChild) isKinLep[i] = true; + } + } + } + } + if (isKinLep[0] && isKinLep[1] && quarks[0]!=0 && quarks[1]!=0 && Wbosons[0]!=0 && Wbosons[1]!=0 && !isTau[0] && !isTau[1] && (std::abs(quarks[0]) != std::abs(quarks[1]))){ + return StatusCode::SUCCESS; + } + + } +#else HepMC::GenEvent::particle_const_iterator part1 = genEvt->particles_begin(); HepMC::GenEvent::particle_const_iterator partItr = part1; HepMC::GenEvent::particle_const_iterator partE = genEvt->particles_end(); @@ -79,7 +117,7 @@ StatusCode TopCKMKinFilter::filterEvent() { for (firstChildItr = firstChild1; firstChildItr != firstChildE; ++firstChildItr){ if ((std::abs((*firstChildItr)->pdg_id()) == m_PDGChild[0] || std::abs((*firstChildItr)->pdg_id()) == m_PDGChild[1]) && (*firstChildItr)->momentum().perp() > m_PtMinChild - && fabs((*firstChildItr)->momentum().eta()) < m_EtaRangeChild){ + && std::abs((*firstChildItr)->momentum().eta()) < m_EtaRangeChild){ isOK1 = 1; quark1 = (*firstChildItr); } @@ -89,7 +127,7 @@ StatusCode TopCKMKinFilter::filterEvent() { for (secondChildItr = secondChild1; secondChildItr != secondChildE; ++secondChildItr){ if ((std::abs((*secondChildItr)->pdg_id()) == m_PDGChild[0] || std::abs((*secondChildItr)->pdg_id()) == m_PDGChild[1]) && (*secondChildItr)->momentum().perp() > m_PtMinChild - && fabs((*secondChildItr)->momentum().eta()) < m_EtaRangeChild){ + && std::abs((*secondChildItr)->momentum().eta()) < m_EtaRangeChild){ isOK2 = 1; quark2 = (*secondChildItr); } @@ -116,14 +154,14 @@ StatusCode TopCKMKinFilter::filterEvent() { for (w1SonItr = w1Son1; w1SonItr != w1SonE; ++w1SonItr){ if (std::abs((*w1SonItr)->pdg_id()) == 15) isTau1 = 1; if (std::abs((*w1SonItr)->pdg_id()) == 11 || std::abs((*w1SonItr)->pdg_id()) == 13){ - if ((*w1SonItr)->momentum().perp() > m_PtMinChild && fabs((*w1SonItr)->momentum().eta()) < m_EtaRangeChild) isKinLep1 = 1; + if ((*w1SonItr)->momentum().perp() > m_PtMinChild && std::abs((*w1SonItr)->momentum().eta()) < m_EtaRangeChild) isKinLep1 = 1; } } for (w2SonItr = w2Son1; w2SonItr != w2SonE; ++w2SonItr){ if (std::abs((*w2SonItr)->pdg_id()) == 15) isTau2 = 1; if (std::abs((*w2SonItr)->pdg_id()) == 11 || std::abs((*w2SonItr)->pdg_id()) == 13){ - if ((*w2SonItr)->momentum().perp() > m_PtMinChild && fabs((*w2SonItr)->momentum().eta()) < m_EtaRangeChild) isKinLep2 = 1; + if ((*w2SonItr)->momentum().perp() > m_PtMinChild && std::abs((*w2SonItr)->momentum().eta()) < m_EtaRangeChild) isKinLep2 = 1; } } @@ -133,6 +171,7 @@ StatusCode TopCKMKinFilter::filterEvent() { } } +#endif } setFilterPassed(false); diff --git a/Generators/GeneratorFilters/src/TrimuMassRangeFilter.cxx b/Generators/GeneratorFilters/src/TrimuMassRangeFilter.cxx index 4a04215961cca72cdcb5216af05620bfe847773a..081e1cfd16540a1c3b8358ba813a5011e56591c2 100644 --- a/Generators/GeneratorFilters/src/TrimuMassRangeFilter.cxx +++ b/Generators/GeneratorFilters/src/TrimuMassRangeFilter.cxx @@ -107,7 +107,7 @@ StatusCode TrimuMassRangeFilter::filterEvent() { if( ( std::abs((*pitr1)->pdg_id()) != std::abs(m_PartId1) && 99999 != std::abs(m_PartId1) ) || //PDG ID selection (*pitr1)->status() != m_PartStatus || //status of the particle (*pitr1)->momentum().perp() < m_Ptmin1 || // pT cut - fabs((*pitr1)->momentum().pseudoRapidity()) > m_EtaRange1 + std::abs((*pitr1)->momentum().pseudoRapidity()) > m_EtaRange1 ) continue;//eta cut ATH_MSG_INFO( " type1 " << (*pitr1)->pdg_id() << " pT1 " << (*pitr1)->momentum().perp() @@ -127,7 +127,7 @@ StatusCode TrimuMassRangeFilter::filterEvent() { if( ( std::abs((*pitr2)->pdg_id()) != std::abs(m_PartId2) && 99999 != std::abs(m_PartId2) ) || //PDG ID selection (*pitr2)->status() != m_PartStatus || //status of the particle (*pitr2)->momentum().perp() < m_Ptmin2 || // pT cut - fabs((*pitr2)->momentum().pseudoRapidity()) > m_EtaRange2 + std::abs((*pitr2)->momentum().pseudoRapidity()) > m_EtaRange2 ) continue;//eta cut if( samePDGID12 && !samePDGID123 && (*pitr1)->pdg_id()==(*pitr2)->pdg_id()) continue; @@ -148,7 +148,7 @@ StatusCode TrimuMassRangeFilter::filterEvent() { if( ( std::abs((*pitr3)->pdg_id()) != std::abs(m_PartId3) && 99999 != std::abs(m_PartId3) ) || //PDG ID selection (*pitr3)->status() != m_PartStatus || //status of the particle (*pitr3)->momentum().perp() < m_Ptmin3 || // pT cut - fabs((*pitr3)->momentum().pseudoRapidity()) > m_EtaRange3 + std::abs((*pitr3)->momentum().pseudoRapidity()) > m_EtaRange3 ) continue;//eta cut ATH_MSG_INFO( " type3 " << (*pitr3)->pdg_id() << " pT3 " << (*pitr3)->momentum().perp() diff --git a/Generators/GeneratorFilters/src/TruthJetFilter.cxx b/Generators/GeneratorFilters/src/TruthJetFilter.cxx index afad534b6ee22a9f8b365a17c718d9b62e009fd0..ba54ce084553f1d6601605a521fa6b5701fa5870 100644 --- a/Generators/GeneratorFilters/src/TruthJetFilter.cxx +++ b/Generators/GeneratorFilters/src/TruthJetFilter.cxx @@ -45,12 +45,12 @@ StatusCode TruthJetFilter::filterEvent() { std::vector<const xAOD::Jet*> listOfSelectedJets; const xAOD::Jet* leadingJet = 0; for (xAOD::JetContainer::const_iterator it_truth = (*truthjetTES).begin(); it_truth != (*truthjetTES).end() ; ++it_truth) { - if ( (*it_truth)->pt() > m_NjetMinPt && fabs( (*it_truth)->eta() ) < m_NjetMaxEta ) { + if ( (*it_truth)->pt() > m_NjetMinPt && std::abs( (*it_truth)->eta() ) < m_NjetMaxEta ) { Njet++; ATH_MSG_INFO("Jet pt " << (*it_truth)->pt()/Gaudi::Units::GeV); if (m_applyDeltaPhiCut) listOfSelectedJets.push_back(*it_truth); } - if ( (*it_truth)->pt() > m_jet_pt1 && fabs( (*it_truth)->eta() ) < m_NjetMaxEta ) { + if ( (*it_truth)->pt() > m_jet_pt1 && std::abs( (*it_truth)->eta() ) < m_NjetMaxEta ) { Njet_pt1++; ATH_MSG_INFO("High jet pt " << (*it_truth)->pt()/Gaudi::Units::GeV); if (m_applyDeltaPhiCut && (!leadingJet || (*it_truth)->pt() > leadingJet->pt())) { @@ -66,7 +66,7 @@ StatusCode TruthJetFilter::filterEvent() { for (unsigned int iJet = 0; iJet < m_Njet; iJet++) { if (listOfSelectedJets[iJet] == leadingJet) continue; double deltaPhi = leadingJet->p4().DeltaPhi((listOfSelectedJets[iJet])->p4()); - double dPi = TMath::Pi() - fabs(deltaPhi); + double dPi = TMath::Pi() - std::abs(deltaPhi); ATH_MSG_DEBUG("deltaPhi = " << deltaPhi << ", dPi = " << dPi << " between leading jet(pt=" << leadingJet->pt() << ",eta=" << leadingJet->eta() << ") and jet(pt=" << (listOfSelectedJets[iJet])->pt() << diff --git a/Generators/GeneratorFilters/src/TtHtoVVDecayFilter.cxx b/Generators/GeneratorFilters/src/TtHtoVVDecayFilter.cxx index b920071b026db39776020431b1d2cac829ad331b..71a088e7b246d899e8cecbc64b1bd89eb2593848 100644 --- a/Generators/GeneratorFilters/src/TtHtoVVDecayFilter.cxx +++ b/Generators/GeneratorFilters/src/TtHtoVVDecayFilter.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "GeneratorFilters/TtHtoVVDecayFilter.h" @@ -64,10 +64,42 @@ StatusCode TtHtoVVDecayFilter::filterEvent() { for (McEventCollection::const_iterator itr = events()->begin(); itr != events()->end(); ++itr) { // Loop over all particles in the event const HepMC::GenEvent* genEvt = (*itr); +#ifdef HEPMC3 + for (auto pitr: *genEvt) { + for (size_t iParent=0; iParent < m_PDGParent.size(); iParent++) { + if ( std::abs(pitr->pdg_id()) == m_PDGParent[iParent] && pitr->status() == m_StatusParent[iParent]) { // if find a parent here + bool isGrandParentOK = false; + for (auto thisMother: pitr->production_vertex()->particles_in()) { // Loop over all grandparent of this founded parent + ATH_MSG_DEBUG("Parent " << pitr->pdg_id() << " barcode = " << HepMC::barcode(pitr) << " status = " << pitr->status()); + ATH_MSG_DEBUG("A parent mother " << thisMother->pdg_id()<< " barcode = " << HepMC::barcode(thisMother)); + for (size_t iGrandParent = 0; iGrandParent < m_PDGGrandParent.size(); iGrandParent++) { // Loop over all Grandparents we want to check + if ( thisMother->pdg_id() == m_PDGGrandParent[iGrandParent] ) isGrandParentOK = true; + } + } + ATH_MSG_DEBUG(" Grandparent is OK? " << isGrandParentOK); + if (!isGrandParentOK) continue; + + ++nGoodParent; // good parent from the indicated GrandParents + const bool okPDGChild = findAncestor(pitr->end_vertex(), m_PDGParent[iParent]); + ATH_MSG_DEBUG("Result " << nGoodParent << " " << okPDGChild ); + if (!(okPDGChild)) continue; + + ++nGoodDecayedParent; // good parent has the indicated child and child2 + if (nGoodDecayedParent == 1) { + if ( pitr->pdg_id() < 0) charge = -1; + else if ( pitr->pdg_id() > 0) charge = 1; + } else { + if (charge == -1 && pitr->pdg_id() > 0) sameCharge = false; + if (charge == 1 && pitr->pdg_id() < 0) sameCharge = false; + } + } + } // End loop over all Parents we want to check + } // End loop over all particles in the event +#else for (HepMC::GenEvent::particle_const_iterator pitr = genEvt->particles_begin(); pitr != genEvt->particles_end(); ++pitr) { for (size_t iParent=0; iParent < m_PDGParent.size(); iParent++) { - if ( abs((*pitr)->pdg_id()) == m_PDGParent[iParent] && (*pitr)->status() == m_StatusParent[iParent]) { // if find a parent here + if ( std::abs((*pitr)->pdg_id()) == m_PDGParent[iParent] && (*pitr)->status() == m_StatusParent[iParent]) { // if find a parent here HepMC::GenVertex::particle_iterator firstMother = (*pitr)->production_vertex()->particles_begin(HepMC::parents); HepMC::GenVertex::particle_iterator endMother = (*pitr)->production_vertex()->particles_end(HepMC::parents); HepMC::GenVertex::particle_iterator thisMother = firstMother; @@ -100,6 +132,7 @@ StatusCode TtHtoVVDecayFilter::filterEvent() { } // End loop over all Parents we want to check } // End loop over all particles in the event +#endif } ATH_MSG_DEBUG("Selected # good parents = " << nGoodParent << "; # good decayed parents = " << nGoodDecayedParent); diff --git a/Generators/GeneratorFilters/src/VBFForwardJetsFilter.cxx b/Generators/GeneratorFilters/src/VBFForwardJetsFilter.cxx index 786b3a2385c9696378e35899ed20ab1286bea647..0c4f88eeeee4b9f0620b4104e8522437a7dd1343 100644 --- a/Generators/GeneratorFilters/src/VBFForwardJetsFilter.cxx +++ b/Generators/GeneratorFilters/src/VBFForwardJetsFilter.cxx @@ -140,13 +140,13 @@ StatusCode VBFForwardJetsFilter::filterEvent() { for (HepMC::GenEvent::particle_const_iterator pitr = genEvt->particles_begin(); pitr != genEvt->particles_end(); ++pitr) { // photon if ( (*pitr)->pdg_id() == 22 && (*pitr)->status() == 1 && - (*pitr)->momentum().perp() >= m_LGMinPt && fabs((*pitr)->momentum().pseudoRapidity()) <= m_LGMaxEta) { + (*pitr)->momentum().perp() >= m_LGMinPt && std::abs((*pitr)->momentum().pseudoRapidity()) <= m_LGMaxEta) { MCTruthPhotonList.push_back((*pitr)); ATH_MSG_INFO("photon pt(Gaudi::Units::GeV) = " << (*pitr)->momentum().perp()/Gaudi::Units::GeV << " eta = " << (*pitr)->momentum().pseudoRapidity()); } // electon if ( abs((*pitr)->pdg_id()) == 11 && (*pitr)->status() == 1 && - (*pitr)->momentum().perp() >= m_LGMinPt && fabs((*pitr)->momentum().pseudoRapidity()) <= m_LGMaxEta) { + (*pitr)->momentum().perp() >= m_LGMinPt && std::abs((*pitr)->momentum().pseudoRapidity()) <= m_LGMaxEta) { MCTruthElectronList.push_back((*pitr)); ATH_MSG_INFO("electron pt(Gaudi::Units::GeV) = " << (*pitr)->momentum().perp()/Gaudi::Units::GeV << " eta = " << (*pitr)->momentum().pseudoRapidity()); } @@ -182,7 +182,7 @@ StatusCode VBFForwardJetsFilter::filterEvent() { // Select TruthJets std::vector<const xAOD::Jet*> jetList; for (xAOD::JetContainer::const_iterator it_truth = truthjetTES->begin(); it_truth != truthjetTES->end(); ++it_truth) { - if ( (*it_truth)->pt() > m_JetMinPt && fabs( (*it_truth)->eta() ) < m_JetMaxEta ) { + if ( (*it_truth)->pt() > m_JetMinPt && std::abs( (*it_truth)->eta() ) < m_JetMaxEta ) { jetList.push_back(*it_truth); ATH_MSG_INFO("jet pt(Gaudi::Units::GeV) = " << (*it_truth)->pt()/Gaudi::Units::GeV << " eta = " << (*it_truth)->eta()); } @@ -203,7 +203,7 @@ StatusCode VBFForwardJetsFilter::filterEvent() { flag1stJet = 0; if (jetList.size() >= 1) { const xAOD::Jet *j1 = jetList[0]; - if (j1->pt() > m_Jet1MinPt && fabs(j1->eta()) < m_Jet1MaxEta) { + if (j1->pt() > m_Jet1MinPt && std::abs(j1->eta()) < m_Jet1MaxEta) { flag1stJet = 1; } } @@ -215,7 +215,7 @@ StatusCode VBFForwardJetsFilter::filterEvent() { flag2ndJet = 0; if (jetList.size() >= 2) { const xAOD::Jet *j2 = jetList[1]; - if (j2->pt() > m_Jet2MinPt && fabs(j2->eta()) < m_Jet2MaxEta) { + if (j2->pt() > m_Jet2MinPt && std::abs(j2->eta()) < m_Jet2MaxEta) { flag2ndJet = 1; } } @@ -241,7 +241,7 @@ StatusCode VBFForwardJetsFilter::filterEvent() { int okMassJJ = m_MassJJ >= 0. ? 0 : 1; for (unsigned i=0;i<jetList.size()-1;++i) { for (unsigned j=i+1;j<jetList.size();++j) { - double dEta = fabs(jetList[i]->eta()-jetList[j]->eta()); + double dEta = std::abs(jetList[i]->eta()-jetList[j]->eta()); double Mjj = (jetList[i]->p4()+jetList[j]->p4()).M(); ATH_MSG_INFO("DeltaEtaJJ = " << dEta << " MassJJ(CLHEP::GeV) = " << Mjj/CLHEP::GeV << " (" << i << ", " << j << ")"); if (okDeltaEtaJJ == 0 && dEta > m_DeltaEtaJJ) okDeltaEtaJJ = 1; @@ -296,7 +296,7 @@ double VBFForwardJetsFilter::getMinDeltaR(const xAOD::Jet *jet, std::vector<HepM if (dphi > M_PI) { dphi -= 2.*M_PI; } if (dphi < -M_PI) { dphi += 2.*M_PI; } double dr = sqrt(deta*deta+dphi*dphi); - double ratio_pt= fabs((jet->pt()-list[i]->momentum().perp())/list[i]->momentum().perp()); + double ratio_pt= std::abs((jet->pt()-list[i]->momentum().perp())/list[i]->momentum().perp()); if (ratio_pt < m_RatioPtJLG && dr < minDR) minDR = dr; } } @@ -313,7 +313,7 @@ double VBFForwardJetsFilter::getMinDeltaR(const xAOD::Jet *jet, std::vector<CLHE if (dphi > M_PI) { dphi -= 2.*M_PI; } if (dphi < -M_PI) { dphi += 2.*M_PI; } double dr = std::sqrt(deta*deta+dphi*dphi); - double ratio_pt= fabs((jet->pt()-list[i].vect().perp())/list[i].vect().perp()); + double ratio_pt= std::abs((jet->pt()-list[i].vect().perp())/list[i].vect().perp()); if (ratio_pt < m_RatioPtJLG && dr < minDR) minDR = dr; } } diff --git a/Generators/GeneratorFilters/src/VBFMjjIntervalFilter.cxx b/Generators/GeneratorFilters/src/VBFMjjIntervalFilter.cxx index 77c431e8ac42c88015a3e14944944bc9da5ffa0f..f7b9c04f81bc60fef946fac09229c0d22d243626 100644 --- a/Generators/GeneratorFilters/src/VBFMjjIntervalFilter.cxx +++ b/Generators/GeneratorFilters/src/VBFMjjIntervalFilter.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ // Header for this module @@ -80,52 +80,48 @@ StatusCode VBFMjjIntervalFilter::filterEvent() { } // Find overlap objects - std::vector<HepMC::GenParticlePtr> MCTruthPhotonList; - std::vector<HepMC::GenParticlePtr> MCTruthElectronList; - std::vector<CLHEP::HepLorentzVector*> MCTruthTauList; + std::vector<HepMC::ConstGenParticlePtr> MCTruthPhotonList; + std::vector<HepMC::ConstGenParticlePtr> MCTruthElectronList; + std::vector<CLHEP::HepLorentzVector> MCTruthTauList; for (McEventCollection::const_iterator itr = events()->begin(); itr != events()->end(); ++itr) { const HepMC::GenEvent* genEvt = (*itr); - for (HepMC::GenEvent::particle_const_iterator pitr = genEvt->particles_begin(); pitr != genEvt->particles_end(); ++pitr) { + for (auto pitr: *genEvt) { if (m_photonjetoverlap==true) { // photon - copied from VBFForwardJetsFilter.cxx - if ( (*pitr)->pdg_id() == 22 && (*pitr)->status() == 1 && - (*pitr)->momentum().perp() >= m_olapPt && - fabs((*pitr)->momentum().pseudoRapidity()) <= m_yMax) { - MCTruthPhotonList.push_back((*pitr)); + if ( pitr->pdg_id() == 22 && pitr->status() == 1 && + pitr->momentum().perp() >= m_olapPt && + std::abs(pitr->momentum().pseudoRapidity()) <= m_yMax) { + MCTruthPhotonList.push_back(pitr); } } if (m_electronjetoverlap==true) { // electron - if (abs((*pitr)->pdg_id()) == 11 && (*pitr)->status() == 1 && - (*pitr)->momentum().perp() >= m_olapPt && - fabs((*pitr)->momentum().pseudoRapidity()) <= m_yMax) { - MCTruthElectronList.push_back((*pitr)); + if (std::abs(pitr->pdg_id()) == 11 && pitr->status() == 1 && + pitr->momentum().perp() >= m_olapPt && + std::abs(pitr->momentum().pseudoRapidity()) <= m_yMax) { + MCTruthElectronList.push_back(pitr); } } if (m_taujetoverlap==true) { // tau - copied from VBFForwardJetsFilter.cxx - if ( abs((*pitr)->pdg_id()) == 15 && (*pitr)->status() != 3 ) { - HepMC::GenParticle *tau = (*pitr); - HepMC::GenVertex::particles_out_const_iterator begin = tau->end_vertex()->particles_out_const_begin(); - HepMC::GenVertex::particles_out_const_iterator end = tau->end_vertex()->particles_out_const_end(); + if ( std::abs(pitr->pdg_id()) == 15 && pitr->status() != 3 ) { + auto tau = pitr; int leptonic = 0; - for ( ; begin != end; begin++ ) { - if ( (*begin)->production_vertex() != tau->end_vertex() ) continue; - if ( abs( (*begin)->pdg_id() ) == 12 ) leptonic = 1; - if ( abs( (*begin)->pdg_id() ) == 14 ) leptonic = 2; - if ( abs( (*begin)->pdg_id() ) == 15 ) leptonic = 11; + for ( auto beg: *(tau->end_vertex()) ) { + if ( beg->production_vertex() != tau->end_vertex() ) continue; + if ( std::abs( beg->pdg_id() ) == 12 ) leptonic = 1; + if ( std::abs( beg->pdg_id() ) == 14 ) leptonic = 2; + if ( std::abs( beg->pdg_id() ) == 15 ) leptonic = 11; } if (leptonic == 0) { CLHEP::HepLorentzVector nutau = sumDaughterNeutrinos( tau ); - CLHEP::HepLorentzVector *tauvis = new CLHEP::HepLorentzVector(tau->momentum().px()-nutau.px(), + CLHEP::HepLorentzVector tauvis = CLHEP::HepLorentzVector(tau->momentum().px()-nutau.px(), tau->momentum().py()-nutau.py(), tau->momentum().pz()-nutau.pz(), tau->momentum().e()-nutau.e()); - if (tauvis->vect().perp() >= m_olapPt && fabs(tauvis->vect().pseudoRapidity()) <= m_yMax) { + if (tauvis.vect().perp() >= m_olapPt && std::abs(tauvis.vect().pseudoRapidity()) <= m_yMax) { MCTruthTauList.push_back(tauvis); - } else { - delete tauvis; } } } @@ -136,7 +132,7 @@ StatusCode VBFMjjIntervalFilter::filterEvent() { // Filter based on rapidity acceptance and sort xAOD::JetContainer filteredJets(SG::VIEW_ELEMENTS); for (xAOD::JetContainer::const_iterator jitr = truthJetCollection->begin(); jitr != truthJetCollection->end(); ++jitr) { - if (fabs( (*jitr)->rapidity() ) < m_yMax && (*jitr)->pt() >= m_olapPt) { + if (std::abs( (*jitr)->rapidity() ) < m_yMax && (*jitr)->pt() >= m_olapPt) { bool JetOverlapsWithPhoton = false; bool JetOverlapsWithElectron = false; bool JetOverlapsWithTau = false; @@ -193,7 +189,7 @@ StatusCode VBFMjjIntervalFilter::filterEvent() { } -bool VBFMjjIntervalFilter::checkOverlap(double eta, double phi, std::vector<HepMC::GenParticlePtr> list) { +bool VBFMjjIntervalFilter::checkOverlap(double eta, double phi, std::vector<HepMC::ConstGenParticlePtr> list) { for (size_t i = 0; i < list.size(); ++i) { double pt = list[i]->momentum().perp(); if (pt > m_olapPt) { @@ -202,7 +198,7 @@ bool VBFMjjIntervalFilter::checkOverlap(double eta, double phi, std::vector<HepM double deta = eta-list[i]->momentum().pseudoRapidity(); if (dphi > M_PI) { dphi -= 2.*M_PI; } if (dphi < -M_PI) { dphi += 2.*M_PI; } - double dr = sqrt(deta*deta+dphi*dphi); + double dr = std::sqrt(deta*deta+dphi*dphi); if (dr < 0.3) return true; } } @@ -211,16 +207,16 @@ bool VBFMjjIntervalFilter::checkOverlap(double eta, double phi, std::vector<HepM -bool VBFMjjIntervalFilter::checkOverlap(double eta, double phi, std::vector<CLHEP::HepLorentzVector*> list) { +bool VBFMjjIntervalFilter::checkOverlap(double eta, double phi, std::vector<CLHEP::HepLorentzVector> list) { for (size_t i = 0; i < list.size(); ++i) { - double pt = list[i]->vect().perp(); + double pt = list[i].vect().perp(); if (pt > m_olapPt) { /// @todo Provide a helper function for this (and similar) - double dphi = phi-list[i]->phi(); - double deta = eta-list[i]->vect().pseudoRapidity(); + double dphi = phi-list[i].phi(); + double deta = eta-list[i].vect().pseudoRapidity(); if (dphi > M_PI) { dphi -= 2.*M_PI; } if (dphi < -M_PI) { dphi += 2.*M_PI; } - double dr = sqrt(deta*deta+dphi*dphi); + double dr = std::sqrt(deta*deta+dphi*dphi); if (dr < 0.3) return true; } } @@ -263,10 +259,10 @@ double VBFMjjIntervalFilter::getEventWeight(xAOD::JetContainer *jets) { } -CLHEP::HepLorentzVector VBFMjjIntervalFilter::sumDaughterNeutrinos( HepMC::GenParticlePtr part ) { +CLHEP::HepLorentzVector VBFMjjIntervalFilter::sumDaughterNeutrinos( HepMC::ConstGenParticlePtr part ) { CLHEP::HepLorentzVector nu( 0, 0, 0, 0); - if ( ( abs( part->pdg_id() ) == 12 ) || ( abs( part->pdg_id() ) == 14 ) || ( abs( part->pdg_id() ) == 16 ) ) { + if ( ( std::abs( part->pdg_id() ) == 12 ) || ( std::abs( part->pdg_id() ) == 14 ) || ( std::abs( part->pdg_id() ) == 16 ) ) { nu.setPx(part->momentum().px()); nu.setPy(part->momentum().py()); nu.setPz(part->momentum().pz()); @@ -274,10 +270,8 @@ CLHEP::HepLorentzVector VBFMjjIntervalFilter::sumDaughterNeutrinos( HepMC::GenPa return nu; } - if ( part->end_vertex() == 0 ) return nu; + if ( !part->end_vertex() ) return nu; - HepMC::GenVertex::particles_out_const_iterator begin = part->end_vertex()->particles_out_const_begin(); - HepMC::GenVertex::particles_out_const_iterator end = part->end_vertex()->particles_out_const_end(); - for ( ; begin != end; begin++ ) nu += sumDaughterNeutrinos( *begin ); + for (auto beg: *(part->end_vertex()) ) nu += sumDaughterNeutrinos( beg ); return nu; } diff --git a/Generators/GeneratorFilters/src/VHtoVVDiLepFilter.cxx b/Generators/GeneratorFilters/src/VHtoVVDiLepFilter.cxx index 0d5372a9979dc085f6a3d7fddae441c6c303689c..0ef5945fc21df91a71ee3d57f4882acd0b671a87 100644 --- a/Generators/GeneratorFilters/src/VHtoVVDiLepFilter.cxx +++ b/Generators/GeneratorFilters/src/VHtoVVDiLepFilter.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "GeneratorFilters/VHtoVVDiLepFilter.h" @@ -48,10 +48,42 @@ StatusCode VHtoVVDiLepFilter::filterEvent() { int nVParent = 0; for (McEventCollection::const_iterator ievt = events()->begin(); ievt != events()->end(); ++ievt) { // Loop over all particles in the event +#ifdef HEPMC3 + for (auto pitr: **ievt) { + + // Loop over particles from the primary interaction that match the PDG Parent + if ( (std::abs(pitr->pdg_id()) == m_PDGParent ||std::abs(pitr->pdg_id()) == m_PDGAssoc) && std::abs(pitr->status()) == m_StatusCode) { + // Check if originated from the Higgs or is the associated vector boson + bool isGrandParentHiggs = false; + bool isGrandParentV = false; + for (auto thisMother: pitr->production_vertex()->particles_in()) { // loop over chain of grandparents + ATH_MSG_DEBUG(" Parent " << pitr->pdg_id() << " barcode = " << HepMC::barcode(pitr) << " status = " << pitr->status() ); + ATH_MSG_DEBUG(" a Parent mother " << thisMother->pdg_id()<< " barc = " << HepMC::barcode(thisMother) ); + if ( thisMother->pdg_id() == m_PDGGrandParent ) isGrandParentHiggs = true; + else isGrandParentV = true; + } + ATH_MSG_DEBUG(" Grand Parent is Higgs? " << isGrandParentHiggs ); + ATH_MSG_DEBUG(" Grand Parent is V? " << isGrandParentV ); + + if (!isGrandParentHiggs && !isGrandParentV) continue; + + if (isGrandParentHiggs) { + ++nHiggsParent; + if (!pitr->end_vertex()) continue; + findAncestor(pitr->end_vertex(), m_PDGParent, n_okPDGHVChildren); + } // end of higgs grandparent loop + + if (isGrandParentV) { + ++nVParent; + findAncestor(pitr->end_vertex(), m_PDGAssoc, n_okPDGAssocVChild); + } // end of v grandparent loop + } // end good parent loop + } +#else for (HepMC::GenEvent::particle_const_iterator pitr = (*ievt)->particles_begin(); pitr != (*ievt)->particles_end(); ++pitr) { // Loop over particles from the primary interaction that match the PDG Parent - if ( (abs((*pitr)->pdg_id()) == m_PDGParent ||abs((*pitr)->pdg_id()) == m_PDGAssoc) && abs((*pitr)->status()) == m_StatusCode) { + if ( (std::abs((*pitr)->pdg_id()) == m_PDGParent ||std::abs((*pitr)->pdg_id()) == m_PDGAssoc) && std::abs((*pitr)->status()) == m_StatusCode) { HepMC::GenVertex::particle_iterator firstMother = (*pitr)->production_vertex()->particles_begin(HepMC::parents); HepMC::GenVertex::particle_iterator endMother = (*pitr)->production_vertex()->particles_end(HepMC::parents); HepMC::GenVertex::particle_iterator thisMother = firstMother; @@ -82,6 +114,7 @@ StatusCode VHtoVVDiLepFilter::filterEvent() { } // end good parent loop } +#endif } ATH_MSG_DEBUG("Result " << nHiggsParent << " " << n_okPDGHVChildren ); @@ -99,24 +132,21 @@ StatusCode VHtoVVDiLepFilter::filterEvent() { return StatusCode::SUCCESS; } -void VHtoVVDiLepFilter::findAncestor(const HepMC::GenVertexPtr searchvertex, +void VHtoVVDiLepFilter::findAncestor(HepMC::ConstGenVertexPtr searchvertex, int targetPDGID, int& n_okPDGChild) { std::vector<int> foundCodes; if (!searchvertex) return; - const HepMC::GenVertex::particles_out_const_iterator firstAncestor = searchvertex->particles_out_const_begin(); - const HepMC::GenVertex::particles_out_const_iterator endAncestor = searchvertex->particles_out_const_end(); - HepMC::GenVertex::particles_out_const_iterator thisAncestor = firstAncestor; - for (; thisAncestor != endAncestor; ++thisAncestor) { - if (abs((*thisAncestor)->pdg_id()) == targetPDGID) { // same particle as parent - findAncestor((*thisAncestor)->end_vertex(), targetPDGID, n_okPDGChild); + for (auto thisAncestor: *searchvertex) { + if (std::abs(thisAncestor->pdg_id()) == targetPDGID) { // same particle as parent + findAncestor(thisAncestor->end_vertex(), targetPDGID, n_okPDGChild); } else { for (size_t i = 0; i < m_PDGChildren.size(); ++i) { - int testPdgID = (*thisAncestor)->pdg_id(); - if (abs(testPdgID) == m_PDGChildren[i]) { + int testPdgID = thisAncestor->pdg_id(); + if (std::abs(testPdgID) == m_PDGChildren[i]) { const bool alreadyFound = (std::find(foundCodes.begin(), foundCodes.end(), testPdgID) != foundCodes.end()); if (!alreadyFound) { n_okPDGChild++; - foundCodes.push_back((*thisAncestor)->pdg_id()); // add to list of found particles and check to avoid double counting + foundCodes.push_back(thisAncestor->pdg_id()); // add to list of found particles and check to avoid double counting } else break; } diff --git a/Generators/GeneratorFilters/src/WZtoLeptonFilter.cxx b/Generators/GeneratorFilters/src/WZtoLeptonFilter.cxx index 0b705e77c3723c6b112f3201eff12b66eab385ae..c91f1f2002fd2175abe2caf3974cbf41a1df31e4 100644 --- a/Generators/GeneratorFilters/src/WZtoLeptonFilter.cxx +++ b/Generators/GeneratorFilters/src/WZtoLeptonFilter.cxx @@ -252,7 +252,7 @@ StatusCode WZtoLeptonFilter::filterEvent() { if ((abslepid == 11 || abslepid == 13) && (*pitr)->status() == 1) { double leppt = (*pitr)->momentum().perp(); - double lepeta = fabs( (*pitr)->momentum().pseudoRapidity() ); + double lepeta = std::abs( (*pitr)->momentum().pseudoRapidity() ); LePrdVrt = (*pitr)->production_vertex(); int anceWZ = 0; diff --git a/Generators/GeneratorUtils/test/StringParse_test.cxx b/Generators/GeneratorUtils/test/StringParse_test.cxx index d31a8d589c6f7c4ba216dbbca85c737522555333..2ecd38919754f40dded64e61798b0f4d81f378ae 100644 --- a/Generators/GeneratorUtils/test/StringParse_test.cxx +++ b/Generators/GeneratorUtils/test/StringParse_test.cxx @@ -34,12 +34,12 @@ int main() { assert(s.piece<string>(2) == "foo"); assert(s.piece(3) == "5.678"); - assert(fabs(s.piece<double>(3) - 5.678) < 1e-6); - assert(fabs(s.numpiece(3) - 5.678) < 1e-6); + assert(std::abs(s.piece<double>(3) - 5.678) < 1e-6); + assert(std::abs(s.numpiece(3) - 5.678) < 1e-6); assert(s.piece<int>(4) != 1234); assert(s.intpiece(4) == -1); - assert(fabs(s.piece<double>(5) + 1) < 1e-6); - assert(fabs(s.numpiece(5) + 1) < 1e-6); + assert(std::abs(s.piece<double>(5) + 1) < 1e-6); + assert(std::abs(s.numpiece(5) + 1) < 1e-6); } diff --git a/Generators/Hijing_i/src/Hijing.cxx b/Generators/Hijing_i/src/Hijing.cxx index 346f0e2097af1a79245e921a4a6f3bfb6cc14cea..c81769b3136f6804bbd2072d92720e7e2e43bd42 100644 --- a/Generators/Hijing_i/src/Hijing.cxx +++ b/Generators/Hijing_i/src/Hijing.cxx @@ -815,16 +815,16 @@ Hijing::randomizeVertex() double ranx, rany, xmax, ymax; double ranz = CLHEP::RandFlat::shoot(engine, -Zmax, Zmax); if( m_wide ){ // Allow the whole pipe - if( fabs(ranz) < Start1 ) { + if( std::abs(ranz) < Start1 ) { xmax = Xmin + Delta1; ymax = xmax; - } else if( fabs(ranz) < Start2 ) { + } else if( std::abs(ranz) < Start2 ) { xmax = Xmin + Delta2; ymax = xmax; - } else if( fabs(ranz) < Start3 ) { + } else if( std::abs(ranz) < Start3 ) { xmax = Xmin + Delta3; ymax = xmax; - } else if ( fabs(ranz) <= Envelope ){ + } else if ( std::abs(ranz) <= Envelope ){ xmax = Xmin; ymax = xmax; } else { diff --git a/Generators/MCTester_i/src/MCTesterAlg.cxx b/Generators/MCTester_i/src/MCTesterAlg.cxx index 9186b82f305a31e4c6c20be29fb7d967964f2bf9..6da18ea11be51284cf3de913e61831a282bcbaae 100644 --- a/Generators/MCTester_i/src/MCTesterAlg.cxx +++ b/Generators/MCTester_i/src/MCTesterAlg.cxx @@ -231,10 +231,10 @@ StatusCode MCTesterAlg::MC_Validate_check4MomentumSum(HepMCEvent * e) { std::vector<double> * sum = e->Sum4Momentum(); - if(fabs(sum->at(0)-m_collision_px)>m_collision_check_sum_margin || - fabs(sum->at(1)-m_collision_py)>m_collision_check_sum_margin || - fabs(sum->at(2)-m_collision_pz)>m_collision_check_sum_margin || - fabs(sum->at(3)-m_collision_E)>m_collision_check_sum_margin) { + if(std::abs(sum->at(0)-m_collision_px)>m_collision_check_sum_margin || + std::abs(sum->at(1)-m_collision_py)>m_collision_check_sum_margin || + std::abs(sum->at(2)-m_collision_pz)>m_collision_check_sum_margin || + std::abs(sum->at(3)-m_collision_E)>m_collision_check_sum_margin) { m_deviation_from_centre_of_mass++; ATH_MSG_WARNING("Event " << e->GetEventNumber() << diff --git a/Generators/ParticleDecayer/src/ParticleDecayer.cxx b/Generators/ParticleDecayer/src/ParticleDecayer.cxx index 1ee6fd0b6c6b9bc2c7299d69e59da7e2becccaf4..cc1eab0707e67c19198c36a1ba6867a88c4d0409 100644 --- a/Generators/ParticleDecayer/src/ParticleDecayer.cxx +++ b/Generators/ParticleDecayer/src/ParticleDecayer.cxx @@ -157,7 +157,7 @@ StatusCode ParticleDecayer::setDecayPosition( HepMC::GenParticlePtr genpart, Hep double distanceToEdge = -999.; if ( theta < m_thetaEndCapBarrel || theta > ( CLHEP::pi - m_thetaEndCapBarrel) ) // Particle escapes through endcap { - distanceToEdge = fabs(m_endCapDistance/cos(theta)); + distanceToEdge = std::abs(m_endCapDistance/cos(theta)); } else // Particle escapes through barrel { @@ -189,12 +189,12 @@ StatusCode ParticleDecayer::setDecayPosition( HepMC::GenParticlePtr genpart, Hep double decayRadius = -999.; if ( theta < m_thetaEndCapBarrel || theta > ( CLHEP::pi - m_thetaEndCapBarrel) ) // Particle escapes through endcap { - double outerLength = fabs(m_endCapDistance/cos(theta)); + double outerLength = std::abs(m_endCapDistance/cos(theta)); double outerRadius = outerLength*sin(theta); - decayRadius = rnd_DoubleRange(0., std::min(outerRadius, fabs(m_barrelRadius)) ); + decayRadius = rnd_DoubleRange(0., std::min(outerRadius, std::abs(m_barrelRadius)) ); }else // Particle escapes through barrel { - decayRadius = rnd_DoubleRange(0., fabs(m_barrelRadius)); + decayRadius = rnd_DoubleRange(0., std::abs(m_barrelRadius)); } double decayLength = decayRadius/sin(theta); diff --git a/Generators/Prophecy4fControl/bin/DRM.C b/Generators/Prophecy4fControl/bin/DRM.C index 655c361d365df7784383ca2fa62e18f556b6c9cb..aa92e060de6e805e2567820fa67b599379dcffa9 100644 --- a/Generators/Prophecy4fControl/bin/DRM.C +++ b/Generators/Prophecy4fControl/bin/DRM.C @@ -199,8 +199,8 @@ void DRM::Merge(){ } double mass1, mass2; - P4_Z[4][0] = sqrt(P4_Z[3][0] * P4_Z[3][0] - P4_Z[0][0] * P4_Z[0][0] - P4_Z[1][0] * P4_Z[1][0] - P4_Z[2][0] * P4_Z[2][0]); - P4_Z[4][1] = sqrt(P4_Z[3][1] * P4_Z[3][1] - P4_Z[0][1] * P4_Z[0][1] - P4_Z[1][1] * P4_Z[1][1] - P4_Z[2][1] * P4_Z[2][1]); + P4_Z[4][0] = std::sqrt(P4_Z[3][0] * P4_Z[3][0] - P4_Z[0][0] * P4_Z[0][0] - P4_Z[1][0] * P4_Z[1][0] - P4_Z[2][0] * P4_Z[2][0]); + P4_Z[4][1] = std::sqrt(P4_Z[3][1] * P4_Z[3][1] - P4_Z[0][1] * P4_Z[0][1] - P4_Z[1][1] * P4_Z[1][1] - P4_Z[2][1] * P4_Z[2][1]); mass1=SetParticleMass(ID_l).first; mass2=SetParticleMass(ID_l).second; diff --git a/Generators/Prophecy4fControl/bin/DRM_Transf.cxx b/Generators/Prophecy4fControl/bin/DRM_Transf.cxx index 5fe60e00b146777cfff68473ba477a44f0c50d41..581de46b787199b8e526be887d67e0d362b3c706 100644 --- a/Generators/Prophecy4fControl/bin/DRM_Transf.cxx +++ b/Generators/Prophecy4fControl/bin/DRM_Transf.cxx @@ -88,7 +88,7 @@ double DRM::alupcm(double em0, double em1, double em2){ ret_val = 0.f; } else{ - ret_val = sqrt((em0 + emd) * (em0 - emd) * (em0 + ems) * (em0 - ems)) * .5f / em0; + ret_val = std::sqrt((em0 + emd) * (em0 - emd) * (em0 + ems) * (em0 - ems)) * .5f / em0; } return ret_val; @@ -123,8 +123,8 @@ int DRM::rescms(double *p, double *p1, double *p2, double m1, double m2){ po2[il] = pcm / pcmo * po2[il]; } - po1[3] = sqrt(pcm*pcm + m1*m1); - po2[3] = sqrt(pcm*pcm + m2*m2); + po1[3] = std::sqrt(pcm*pcm + m1*m1); + po2[3] = std::sqrt(pcm*pcm + m2*m2); po1[4] = m1; po2[4] = m2; diff --git a/Generators/Pythia8B_i/Pythia8B_i/UserSelections.h b/Generators/Pythia8B_i/Pythia8B_i/UserSelections.h index 0774ae030af9aeb2cb4a8c939f6bdc1a103fd0b8..7bc39f5ed693ab02489243a110c5c42e1b8f5518 100644 --- a/Generators/Pythia8B_i/Pythia8B_i/UserSelections.h +++ b/Generators/Pythia8B_i/Pythia8B_i/UserSelections.h @@ -117,7 +117,7 @@ double BsJpsiPhi_PDF(double *params, double *x, bool useHelicity) { // Tagged analysis - if( fabs(tagprob - 0.5) > 1e-6 ){ + if( std::abs(tagprob - 0.5) > 1e-6 ){ ExpGSSinMT = exp(-time * GammaS) * sin(DeltaM * time); @@ -380,7 +380,7 @@ bool Pythia8B_i::userSelection(Pythia8::Event &event, std::string userString, for (int i = 0; i < eventSize; i++) { int pID = event[i].id(); - if (abs(pID) == 531) { //NOTE THIS WILL FIND BS AND ANTIBS + if (std::abs(pID) == 531) { //NOTE THIS WILL FIND BS AND ANTIBS i_Bs = i; std::vector<int> daughterlist = event.daughterList(i); @@ -564,7 +564,7 @@ bool Pythia8B_i::userSelection(Pythia8::Event &event, std::string userString, for (int i = 0; i < eventSize; i++) { const int pID = event[i].id(); - if (abs(pID) == 511) { //NOTE THIS FIND BD and Anti-Bd + if (std::abs(pID) == 511) { //NOTE THIS FIND BD and Anti-Bd i_Bd = i; std::vector<int> daughterlist = event.daughterList(i); @@ -580,11 +580,11 @@ bool Pythia8B_i::userSelection(Pythia8::Event &event, std::string userString, isjpsi = true; i_Jpsi = daughterlist[1]; } - if (abs(event[daughterlist[0]].id()) == 313) { //This will find kstar or KstarBar + if (std::abs(event[daughterlist[0]].id()) == 313) { //This will find kstar or KstarBar iskstar = true; i_Kstar = daughterlist[0]; } - if (abs(event[daughterlist[1]].id()) == 313) { //This will find kstar or KstarBar + if (std::abs(event[daughterlist[1]].id()) == 313) { //This will find kstar or KstarBar iskstar = true; i_Kstar = daughterlist[1]; } @@ -610,9 +610,9 @@ bool Pythia8B_i::userSelection(Pythia8::Event &event, std::string userString, else i_Muplus = 0; - if (abs(event[daughterlistKstar[0]].id()) == 321) + if (std::abs(event[daughterlistKstar[0]].id()) == 321) i_Kplus = daughterlistKstar[0]; - else if (abs(event[daughterlistKstar[1]].id()) == 321) + else if (std::abs(event[daughterlistKstar[1]].id()) == 321) i_Kplus = daughterlistKstar[1]; else i_Kplus = 0; diff --git a/Generators/Pythia8B_i/src/Pythia8B_i.cxx b/Generators/Pythia8B_i/src/Pythia8B_i.cxx index ccaf8ea9d37c3aef287e82a3132f270afd0787cc..f980808d7b046953f8fdf8fc336eefd9dc54b49e 100644 --- a/Generators/Pythia8B_i/src/Pythia8B_i.cxx +++ b/Generators/Pythia8B_i/src/Pythia8B_i.cxx @@ -193,7 +193,7 @@ StatusCode Pythia8B_i::callGenerator(){ if ( (isBQuark && m_selectBQuarks) || ((isCQuark && m_selectCQuarks)) ) { bool passesPtCut(false); bool passesEtaCut(false); std::string accString = " : REJECTED"; - double qpt = event[i].pT(); double qeta = fabs(event[i].eta()); + double qpt = event[i].pT(); double qeta = std::abs(event[i].eta()); if (qpt>m_qPtCut) passesPtCut=true; if (qeta<m_qEtaCut) passesEtaCut=true; if (passesPtCut && passesEtaCut) { @@ -210,7 +210,7 @@ StatusCode Pythia8B_i::callGenerator(){ if ( (isAntiBQuark && m_selectBQuarks) || ((isAntiCQuark && m_selectCQuarks)) ) { bool passesPtCut(false); bool passesEtaCut(false); std::string accString = " : REJECTED"; - double aqpt = event[i].pT(); double aqeta = fabs(event[i].eta()); + double aqpt = event[i].pT(); double aqeta = std::abs(event[i].eta()); if (aqpt>m_aqPtCut) passesPtCut=true; if (aqeta<m_aqEtaCut) passesEtaCut=true; if (passesPtCut && passesEtaCut) { @@ -489,7 +489,7 @@ bool Pythia8B_i::leptonSelect(Pythia8::Event &theEvent, std::vector<double> ptCu double eta = theParticle.eta(); ATH_MSG_DEBUG("Lepton of type " << id << " with pt/eta " << pt << "/" << eta); for (int cutCntr=0; cutCntr<nCuts; ++cutCntr) { - if ( (pt>ptCut[cutCntr]) && (fabs(eta)<etaCut) ) { + if ( (pt>ptCut[cutCntr]) && (std::abs(eta)<etaCut) ) { countGood[cutCntr] += 1; leptonIDs.push_back(i); // remember leptons } @@ -555,17 +555,17 @@ bool Pythia8B_i::pairProperties(Pythia8::Event &theEvent, std::vector<int> lepto double py1=theEvent[*iit].py(); double pz1=theEvent[*iit].pz(); double mass1=theEvent[*iit].mSel(); - double e1=sqrt(px1*px1+py1*py1+pz1*pz1+mass1*mass1); + double e1=std::sqrt(px1*px1+py1*py1+pz1*pz1+mass1*mass1); double px2=theEvent[*iit2].px(); double py2=theEvent[*iit2].py(); double pz2=theEvent[*iit2].pz(); double mass2=theEvent[*iit2].mSel(); - double e2=sqrt(px2*px2+py2*py2+pz2*pz2+mass2*mass2); + double e2=std::sqrt(px2*px2+py2*py2+pz2*pz2+mass2*mass2); double eSum=e1+e2; double pxSum=px1+px2; double pySum=py1+py2; double pzSum=pz1+pz2; - double M=sqrt(eSum*eSum-pxSum*pxSum-pySum*pySum-pzSum*pzSum); + double M=std::sqrt(eSum*eSum-pxSum*pxSum-pySum*pySum-pzSum*pzSum); if (M>massCut) { passesCuts=true; ATH_MSG_DEBUG("Acceptable lepton pair with invariant mass : " << M); @@ -635,7 +635,7 @@ bool Pythia8B_i::passesCuts(std::vector<Pythia8::Particle> theParticles, std::ve unsigned int i(0); for (pItr=theParticles.begin(); pItr!=theParticles.end(); ++pItr,++i) { if (cutType=="PT") {if ((*pItr).pT() < cuts[i]) pass = false;} - if (cutType=="ETA") {if (fabs((*pItr).eta()) > cuts[i]) pass = false;} + if (cutType=="ETA") {if (std::abs((*pItr).eta()) > cuts[i]) pass = false;} if (!pass) break; } diff --git a/Generators/Pythia8_i/src/Pythia8_i.cxx b/Generators/Pythia8_i/src/Pythia8_i.cxx index 0d9ccc5ca737dacf2a0fe2e090edcadc28f52429..c7ddc100abb67a589430fec655a2d49093c8fb9f 100644 --- a/Generators/Pythia8_i/src/Pythia8_i.cxx +++ b/Generators/Pythia8_i/src/Pythia8_i.cxx @@ -406,7 +406,7 @@ StatusCode Pythia8_i::callGenerator(){ double eventWeight = m_pythia->info.mergingWeight()*m_pythia->info.weight(); if(returnCode != StatusCode::FAILURE && - (fabs(eventWeight) < 1.e-18 || + (std::abs(eventWeight) < 1.e-18 || m_pythia->event.size() < 2)){ returnCode = this->callGenerator(); diff --git a/Generators/Pythia8_i/src/UserHooks/GravFlat.cxx b/Generators/Pythia8_i/src/UserHooks/GravFlat.cxx index c7acad93b99a67f304a2dc473468c511e8d141ce..ce332a3ecb40a2053357b213eaf229f659e614ab 100644 --- a/Generators/Pythia8_i/src/UserHooks/GravFlat.cxx +++ b/Generators/Pythia8_i/src/UserHooks/GravFlat.cxx @@ -50,7 +50,7 @@ namespace Pythia8 { double weightBW = pow2(sHat - m2Res) + pow2(sHat * GamMRat); double weightPL = 1; - double rH = sqrt(sHat); + double rH = std::sqrt(sHat); double weight=1; switch(m_energyMode(settingsPtr)){ diff --git a/Generators/Pythia8_i/src/UserHooks/SingleTopWideEta.cxx b/Generators/Pythia8_i/src/UserHooks/SingleTopWideEta.cxx index 16ba8e6cc0351ce5404954d472dd9ba6ac453772..02727fff264d45b558751e97d5566cbb9c86b868 100644 --- a/Generators/Pythia8_i/src/UserHooks/SingleTopWideEta.cxx +++ b/Generators/Pythia8_i/src/UserHooks/SingleTopWideEta.cxx @@ -37,7 +37,7 @@ namespace Pythia8 { double sHat = phaseSpacePtr->sHat(); double flatEta= 1.; - double rH = sqrt(sHat); + double rH = std::sqrt(sHat); if(rH <= 160.){ double c = -5.55578e+01; diff --git a/Generators/Pythia8_i/src/UserHooks/WprimeFlat.cxx b/Generators/Pythia8_i/src/UserHooks/WprimeFlat.cxx index 472f7a1bfc4aacd5341ee8f3b8a050991a347ed3..5cd9eb68b497c03764e451b6024be3bd5a6f74f0 100644 --- a/Generators/Pythia8_i/src/UserHooks/WprimeFlat.cxx +++ b/Generators/Pythia8_i/src/UserHooks/WprimeFlat.cxx @@ -47,7 +47,7 @@ namespace Pythia8 { double GamMRat = wRes/mRes; double sHat = phaseSpacePtr->sHat(); double weightBW = pow2(sHat - m2Res) + pow2(sHat * GamMRat); - double m = sqrt(sHat)/((double)m_energyMode(settingsPtr)*1000.0); + double m = std::sqrt(sHat)/((double)m_energyMode(settingsPtr)*1000.0); switch(m_energyMode(settingsPtr)){ case 8: diff --git a/Generators/Pythia8_i/src/UserHooks/WprimeWZFlat.cxx b/Generators/Pythia8_i/src/UserHooks/WprimeWZFlat.cxx index c27743d2839012872a7dbc620a04c17307a33ab4..1c61b8296b3beaf36d3b4a8b1598b68566f2ac84 100644 --- a/Generators/Pythia8_i/src/UserHooks/WprimeWZFlat.cxx +++ b/Generators/Pythia8_i/src/UserHooks/WprimeWZFlat.cxx @@ -45,7 +45,7 @@ namespace Pythia8 { double sHat = phaseSpacePtr->sHat(); double weightBW = m2Res*m2Res + sHat*sHat*(1 + gamMRat*gamMRat) - 2.*sHat*m2Res; - return weightBW * breitWignerDenom(sqrt(sHat)/8000.0); + return weightBW * breitWignerDenom(std::sqrt(sHat)/8000.0); } private: diff --git a/Generators/TrackRecordGenerator/src/TrackRecordGenerator.cxx b/Generators/TrackRecordGenerator/src/TrackRecordGenerator.cxx index 7cff32d53711289f15e0431672da6f4136b0fc73..3d940788ef0468b46b279a1206da32b4a10e219a 100644 --- a/Generators/TrackRecordGenerator/src/TrackRecordGenerator.cxx +++ b/Generators/TrackRecordGenerator/src/TrackRecordGenerator.cxx @@ -82,10 +82,10 @@ StatusCode TrackRecordGenerator::callGenerator() { particle4Position.setY( particle4Position.y() + CLHEP::RandFlat::shoot(&randomEngine(), -m_smearTR, m_smearTR) ); } else { particle4Position.setZ( particle4Position.z() + CLHEP::RandFlat::shoot(&randomEngine(), -m_smearTR, m_smearTR) ); - double R = sqrt( pow( particle4Position.x(),2 ) + pow(particle4Position.y(),2 ) ); - double dPhi = atan2( m_smearTR, R ); + double R = std::sqrt( std::pow( particle4Position.x(),2 ) + std::pow(particle4Position.y(),2 ) ); + double dPhi = std::atan2( m_smearTR, R ); dPhi = CLHEP::RandFlat::shoot( &randomEngine(), -dPhi, dPhi ); - double theta = atan2( particle4Position.x() , particle4Position.y() ); + double theta = std::atan2( particle4Position.x() , particle4Position.y() ); particle4Position.setX( R*sin( theta + dPhi ) ); particle4Position.setY( R*cos( theta + dPhi ) ); } diff --git a/InnerDetector/InDetAlignAlgs/InDetAlignGenAlgs/CMakeLists.txt b/InnerDetector/InDetAlignAlgs/InDetAlignGenAlgs/CMakeLists.txt index 707a286e4557df403f5078262372fe95fd4698fb..5443feed913c4d8ec19db6c1eb106f8d0bb07025 100644 --- a/InnerDetector/InDetAlignAlgs/InDetAlignGenAlgs/CMakeLists.txt +++ b/InnerDetector/InDetAlignAlgs/InDetAlignGenAlgs/CMakeLists.txt @@ -46,7 +46,7 @@ atlas_add_component( InDetAlignGenAlgs src/*.cxx src/components/*.cxx INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} ${EIGEN_LIBRARIES} AthenaBaseComps GeoPrimitives Identifier EventPrimitives xAODEventInfo GaudiKernel TRT_ConditionsServicesLib TrkParameters TrkFitterUtils AthenaKernel AtlasDetDescr DetDescrConditions IdDictDetDescr InDetIdentifier InDetReadoutGeometry TRT_ReadoutGeometry InDetPrepRawData InDetRIO_OnTrack TrkPseudoMeasurementOnTrack TrkRIO_OnTrack TrkTrack TrkTrackSummary TrkExInterfaces TrkFitterInterfaces TrkToolInterfaces ) + LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} ${EIGEN_LIBRARIES} AthenaBaseComps GeoPrimitives Identifier EventPrimitives xAODEventInfo GaudiKernel TRT_ConditionsServicesLib TrkParameters TrkFitterUtils AthenaKernel AtlasDetDescr DetDescrConditions IdDictDetDescr InDetIdentifier InDetReadoutGeometry TRT_ReadoutGeometry InDetPrepRawData InDetRIO_OnTrack TrkPseudoMeasurementOnTrack TrkRIO_OnTrack TrkTrack TrkTrackSummary TrkExInterfaces TrkFitterInterfaces TrkToolInterfaces InDetAlignGenToolsLib RegistrationServicesLib ) # Install files from the package: atlas_install_headers( InDetAlignGenAlgs ) diff --git a/InnerDetector/InDetCalibEvent/TRT_CalibData/CMakeLists.txt b/InnerDetector/InDetCalibEvent/TRT_CalibData/CMakeLists.txt index a1698decf61648a8d57e7bdd1ac2071f3bd555ae..aa1f239618adc03ac9a0c95812684493b4f673fc 100644 --- a/InnerDetector/InDetCalibEvent/TRT_CalibData/CMakeLists.txt +++ b/InnerDetector/InDetCalibEvent/TRT_CalibData/CMakeLists.txt @@ -13,6 +13,10 @@ atlas_depends_on_subdirs( PUBLIC # External dependencies: find_package( CLHEP ) -# Install files from the package: -atlas_install_headers( TRT_CalibData ) +atlas_add_library( TRT_CalibData + TRT_CalibData/*.h + INTERFACE + PUBLIC_HEADERS TRT_CalibData + LINK_LIBRARIES TRT_ConditionsData InDetIdentifier ) + diff --git a/InnerDetector/InDetConditions/PixelConditionsAlgorithms/python/PixelConditionsConfig.py b/InnerDetector/InDetConditions/PixelConditionsAlgorithms/python/PixelConditionsConfig.py index 9d7affa908bb2673d33fceccf541ac769128ed76..d37d8a0a7350ea84fafd25fcb070086e57ba0003 100644 --- a/InnerDetector/InDetConditions/PixelConditionsAlgorithms/python/PixelConditionsConfig.py +++ b/InnerDetector/InDetConditions/PixelConditionsAlgorithms/python/PixelConditionsConfig.py @@ -26,114 +26,6 @@ def PixelConfigCondAlgCfg(flags, name="PixelConfigCondAlg", **kwargs): UseDCSTemperatureConditions=True, UseTDAQConditions=False, ) - # Digitization parameters - CondArgs.update( - BunchSpace=25.0, - ) - - # RUN-1 and beginning of RUN-2(2015) - if (runNum<284500): - CondArgs.update( -# BarrelAnalogThreshold=[-1,-1,-1,-1], -# EndcapAnalogThreshold=[-1,-1,-1], -# DBMAnalogThreshold=[-1,-1,-1], - BarrelToTThreshold=[-1,3,3,3], - EndcapToTThreshold=[3,3,3], - DBMToTThreshold=[-1,-1,-1], - FEI3BarrelLatency=[-1,256,256,256], - FEI3EndcapLatency=[256,256,256], - FEI3BarrelHitDuplication=[True,True,True,True], - FEI3EndcapHitDuplication=[True,True,True], - FEI3BarrelSmallHitToT=[-1,7,7,7], - FEI3EndcapSmallHitToT=[7,7,7], - FEI3BarrelTimingSimTune=[2015,2015,2015,2015], - FEI3EndcapTimingSimTune=[2015,2015,2015], - FEI4BarrelHitDiscConfig=[0] - ) - - # mc16a and mc16c (2016) - elif (runNum<300000): - CondArgs.update( -# BarrelAnalogThreshold=[-1,-1,-1,-1], -# EndcapAnalogThreshold=[-1,-1,-1], -# DBMAnalogThreshold=[-1,-1,-1], - BarrelToTThreshold=[-1,5,5,5], - EndcapToTThreshold=[5,5,5], - DBMToTThreshold=[-1,-1,-1], - FEI3BarrelLatency=[-1,151,256,256], - FEI3EndcapLatency=[256,256,256], - FEI3BarrelHitDuplication=[False,False,False,False], - FEI3EndcapHitDuplication=[False,False,False], - FEI3BarrelSmallHitToT=[-1, -1, -1, -1], - FEI3EndcapSmallHitToT=[-1, -1, -1], - FEI3BarrelTimingSimTune=[2015,2015,2015,2015], - FEI3EndcapTimingSimTune=[2015,2015,2015], - FEI4BarrelHitDiscConfig=[2] - ) - - # mc16d (2017) - elif (runNum<310000): - CondArgs.update( -# BarrelAnalogThreshold=[-1,-1,-1,-1], -# EndcapAnalogThreshold=[-1,-1,-1], -# DBMAnalogThreshold=[-1,-1,-1], - BarrelToTThreshold=[-1,5,5,5], - EndcapToTThreshold=[5,5,5], - DBMToTThreshold=[-1,-1,-1], - FEI3BarrelLatency=[-1,151,256,256], - FEI3EndcapLatency=[256,256,256], - FEI3BarrelHitDuplication=[False,False,False,False], - FEI3EndcapHitDuplication=[False,False,False], - FEI3BarrelSmallHitToT=[-1, -1, -1, -1], - FEI3EndcapSmallHitToT=[-1, -1, -1], - FEI3BarrelTimingSimTune=[2018,2018,2018,2018], - FEI3EndcapTimingSimTune=[2018,2018,2018], - FEI4BarrelHitDiscConfig=[2] - ) - - # mc16e (2018) - else: - CondArgs.update( -# BarrelAnalogThreshold=[-1,-1,-1,-1], -# EndcapAnalogThreshold=[-1,-1,-1], -# DBMAnalogThreshold=[-1,-1,-1], - BarrelToTThreshold=[-1,3,5,5], - EndcapToTThreshold=[5,5,5], - DBMToTThreshold=[-1,-1,-1], - FEI3BarrelLatency=[-1,151,256,256], - FEI3EndcapLatency=[256,256,256], - FEI3BarrelHitDuplication=[False,False,False,False], - FEI3EndcapHitDuplication=[False,False,False], - FEI3BarrelSmallHitToT=[-1, -1, -1, -1], - FEI3EndcapSmallHitToT=[-1, -1, -1], - FEI3BarrelTimingSimTune=[2018,2018,2018,2018], - FEI3EndcapTimingSimTune=[2018,2018,2018], - FEI4BarrelHitDiscConfig=[2] - ) - - CondArgs.update( - BarrelCrossTalk=[0.06,0.06,0.06,0.06], - BarrelThermalNoise=[160.0,160.0,160.0,160.0], - BarrelNoiseOccupancy=[5e-8,5e-8,5e-8,5e-8], - BarrelDisableProbability=[9e-3,9e-3,9e-3,9e-3], - IBLNoiseShape=[0.0, 0.0330, 0.0, 0.2696, 0.1993, 0.1741, 0.1652, 0.1506, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0078], - BLayerNoiseShape=[0.0, 0.0, 0.0, 0.0, 0.2204, 0.5311, 0.7493, 0.8954, 0.9980, 1.0], - PixelNoiseShape=[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.2418, 0.4397, 0.5858, 0.6949, 0.7737, 0.8414, 0.8959, 0.9414, 0.9828, 1.0], - # Layer-2 noise [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.2129, 0.4016, 0.5477, 0.6599, 0.7435, 0.8160, 0.8779, 0.9340, 0.9798, 1.0], - EndcapCrossTalk=[0.06,0.06,0.06], - EndcapThermalNoise=[160.0,160.0,160.0], -# EndcapNoiseOccupancy=[5e-8,5e-8,5e-8], -# EndcapDisableProbability=[9e-3,9e-3,9e-3], -# EndcapNoiseShape=[[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.1748, 0.3409, 0.4760, 0.5850, 0.6754, 0.7538, 0.8264, 0.8962, 0.9655, 1.0], -# [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.1852, 0.3528, 0.4881, 0.5961, 0.6855, 0.7640, 0.8374, 0.9068, 0.9749, 1.0], -# [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.1735, 0.3380, 0.4733, 0.5829, 0.6730, 0.7516, 0.8234, 0.8916, 0.9595, 1.0]], - DBMCrossTalk=[0.06,0.06,0.06], - DBMThermalNoise=[160.0,160.0,160.0] -# DBMNoiseOccupancy=[5e-8,5e-8,5e-8], -# DBMDisableProbability=[9e-3,9e-3,9e-3], -# DBMNoiseShape=[[0.0,1.0],[0.0,1.0],[0.0,1.0]] - ) - if flags.Beam.Type == "cosmics": CondArgs.update( UseComTime=True, @@ -160,6 +52,138 @@ def PixelConfigCondAlgCfg(flags, name="PixelConfigCondAlg", **kwargs): EndcapTimeOffset=[5.0,5.0,5.0], DBMTimeOffset=[5.0,5.0,5.0] ) + # Digitization parameters + CondArgs.update( + BunchSpace=25.0, + FEI4BarrelHitDiscConfig=[2] + ) + + #==================================================================================== + # Run-dependent SIMULATION(digitization) parameters: + #==================================================================================== + # RUN2 2015/2016 + CondArgs.update( + BarrelToTThreshold2016 = [ -1, 5, 5, 5], + FEI3BarrelLatency2016 = [ 0, 151, 256, 256], + FEI3BarrelHitDuplication2016 = [False,False,False,False], + FEI3BarrelSmallHitToT2016 = [ -1, -1, -1, -1], + FEI3BarrelTimingSimTune2016 = [ -1, 2015, 2015, 2015], + BarrelCrossTalk2016 = [ 0.30, 0.06, 0.06, 0.06], + BarrelNoiseOccupancy2016 = [ 5e-8, 5e-8, 5e-8, 5e-8], + BarrelDisableProbability2016 = [ 9e-3, 9e-3, 9e-3, 9e-3], + EndcapToTThreshold2016 = [ 5, 5, 5], + FEI3EndcapLatency2016 = [ 256, 256, 256], + FEI3EndcapHitDuplication2016 = [False,False,False], + FEI3EndcapSmallHitToT2016 = [ -1, -1, -1], + FEI3EndcapTimingSimTune2016 = [ 2015, 2015, 2015], + EndcapCrossTalk2016 = [ 0.06, 0.06, 0.06], + EndcapNoiseOccupancy2016 = [ 5e-8, 5e-8, 5e-8], + EndcapDisableProbability2016 = [ 9e-3, 9e-3, 9e-3], + DBMToTThreshold2016 = [ -1, -1, -1], + DBMCrossTalk2016 = [ 0.06, 0.06, 0.06], + DBMNoiseOccupancy2016 = [ 5e-8, 5e-8, 5e-8], + DBMDisableProbability2016 = [ 9e-3, 9e-3, 9e-3], + IBLNoiseShape2016 = [0.0, 0.0330, 0.0, 0.3026, 0.5019, 0.6760, 0.8412, 0.9918, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0], + BLayerNoiseShape2016 = [0.0, 0.0, 0.0, 0.0, 0.2204, 0.5311, 0.7493, 0.8954, 0.9980, 1.0], + PixelNoiseShape2016 = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.2418, 0.4397, 0.5858, 0.6949, 0.7737, 0.8414, 0.8959, 0.9414, 0.9828, 1.0], + # Layer-2 noise shape [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.2129, 0.4016, 0.5477, 0.6599, 0.7435, 0.8160, 0.8779, 0.9340, 0.9798, 1.0] + # So far, Gaudi::Property does not support 2D vector. + #EndcapNoiseShape=[[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.1748, 0.3409, 0.4760, 0.5850, 0.6754, 0.7538, 0.8264, 0.8962, 0.9655, 1.0], + # [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.1852, 0.3528, 0.4881, 0.5961, 0.6855, 0.7640, 0.8374, 0.9068, 0.9749, 1.0], + # [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.1735, 0.3380, 0.4733, 0.5829, 0.6730, 0.7516, 0.8234, 0.8916, 0.9595, 1.0]] + ) + #==================================================================================== + # RUN2 2017 + CondArgs.update( + BarrelToTThreshold2017 = [ -1, 5, 5, 5], + FEI3BarrelLatency2017 = [ 0, 151, 256, 256], + FEI3BarrelHitDuplication2017 = [False,False,False,False], + FEI3BarrelSmallHitToT2017 = [ -1, -1, -1, -1], + FEI3BarrelTimingSimTune2017 = [ -1, 2018, 2018, 2018], + BarrelCrossTalk2017 = [ 0.30, 0.06, 0.06, 0.06], + BarrelNoiseOccupancy2017 = [ 5e-8, 5e-8, 5e-8, 5e-8], + BarrelDisableProbability2017 = [ 9e-3, 9e-3, 9e-3, 9e-3], + EndcapToTThreshold2017 = [ 5, 5, 5], + FEI3EndcapLatency2017 = [ 256, 256, 256], + FEI3EndcapHitDuplication2017 = [False,False,False], + FEI3EndcapSmallHitToT2017 = [ -1, -1, -1], + FEI3EndcapTimingSimTune2017 = [ 2018, 2018, 2018], + EndcapCrossTalk2017 = [ 0.06, 0.06, 0.06], + EndcapNoiseOccupancy2017 = [ 5e-8, 5e-8, 5e-8], + EndcapDisableProbability2017 = [ 9e-3, 9e-3, 9e-3], + DBMToTThreshold2017 = [ -1, -1, -1], + DBMCrossTalk2017 = [ 0.06, 0.06, 0.06], + DBMNoiseOccupancy2017 = [ 5e-8, 5e-8, 5e-8], + DBMDisableProbability2017 = [ 9e-3, 9e-3, 9e-3], + IBLNoiseShape2017 = [0.0, 0.0330, 0.0, 0.3026, 0.5019, 0.6760, 0.8412, 0.9918, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0], + BLayerNoiseShape2017 = [0.0, 0.0, 0.0, 0.0, 0.2204, 0.5311, 0.7493, 0.8954, 0.9980, 1.0], + PixelNoiseShape2017 = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.2418, 0.4397, 0.5858, 0.6949, 0.7737, 0.8414, 0.8959, 0.9414, 0.9828, 1.0], + ) + #==================================================================================== + # RUN2 2018 + CondArgs.update( + BarrelToTThreshold2018 = [ -1, 3, 5, 5], + FEI3BarrelLatency2018 = [ 0, 151, 256, 256], + FEI3BarrelHitDuplication2018 = [False,False,False,False], + FEI3BarrelSmallHitToT2018 = [ -1, -1, -1, -1], + FEI3BarrelTimingSimTune2018 = [ -1, 2018, 2018, 2018], + BarrelCrossTalk2018 = [ 0.30, 0.06, 0.06, 0.06], + BarrelNoiseOccupancy2018 = [ 5e-8, 5e-8, 5e-8, 5e-8], + BarrelDisableProbability2018 = [ 9e-3, 9e-3, 9e-3, 9e-3], + EndcapToTThreshold2018 = [ 5, 5, 5], + FEI3EndcapLatency2018 = [ 256, 256, 256], + FEI3EndcapHitDuplication2018 = [False,False,False], + FEI3EndcapSmallHitToT2018 = [ -1, -1, -1], + FEI3EndcapTimingSimTune2018 = [ 2018, 2018, 2018], + EndcapCrossTalk2018 = [ 0.06, 0.06, 0.06], + EndcapNoiseOccupancy2018 = [ 5e-8, 5e-8, 5e-8], + EndcapDisableProbability2018 = [ 9e-3, 9e-3, 9e-3], + DBMToTThreshold2018 = [ -1, -1, -1], + DBMCrossTalk2018 = [ 0.06, 0.06, 0.06], + DBMNoiseOccupancy2018 = [ 5e-8, 5e-8, 5e-8], + DBMDisableProbability2018 = [ 9e-3, 9e-3, 9e-3], + IBLNoiseShape2018 = [0.0, 0.0330, 0.0, 0.3026, 0.5019, 0.6760, 0.8412, 0.9918, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0], + BLayerNoiseShape2018 = [0.0, 0.0, 0.0, 0.0, 0.2204, 0.5311, 0.7493, 0.8954, 0.9980, 1.0], + PixelNoiseShape2018 = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.2418, 0.4397, 0.5858, 0.6949, 0.7737, 0.8414, 0.8959, 0.9414, 0.9828, 1.0], + ) + #==================================================================================== + # RUN1 + CondArgs.update( + BarrelToTThresholdRUN1 = [ 3, 3, 3], + FEI3BarrelLatencyRUN1 = [ 256, 256, 256], + FEI3BarrelHitDuplicationRUN1 = [ True, True, True], + FEI3BarrelSmallHitToTRUN1 = [ 7, 7, 7], + FEI3BarrelTimingSimTuneRUN1 = [ 2009, 2009, 2009], + BarrelCrossTalkRUN1 = [ 0.06, 0.06, 0.06], + BarrelNoiseOccupancyRUN1 = [ 5e-8, 5e-8, 5e-8], + BarrelDisableProbabilityRUN1 = [ 9e-3, 9e-3, 9e-3], + EndcapToTThresholdRUN1 = [ 3, 3, 3], + FEI3EndcapLatencyRUN1 = [ 256, 256, 256], + FEI3EndcapHitDuplicationRUN1 = [ True, True, True], + FEI3EndcapSmallHitToTRUN1 = [ 7, 7, 7], + FEI3EndcapTimingSimTuneRUN1 = [ 2009, 2009, 2009], + EndcapCrossTalkRUN1 = [ 0.06, 0.06, 0.06], + EndcapNoiseOccupancyRUN1 = [ 5e-8, 5e-8, 5e-8], + EndcapDisableProbabilityRUN1 = [ 9e-3, 9e-3, 9e-3], + BLayerNoiseShapeRUN1 = [0.0, 0.0, 0.0, 0.0, 0.2204, 0.5311, 0.7493, 0.8954, 0.9980, 1.0], + PixelNoiseShapeRUN1 = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.2418, 0.4397, 0.5858, 0.6949, 0.7737, 0.8414, 0.8959, 0.9414, 0.9828, 1.0], + ) + #==================================================================================== + # ITK + CondArgs.update( + BarrelToTThresholdITK = [ 3, 3, 3, 3, 3], + BarrelCrossTalkITK = [ 0.06, 0.06, 0.06, 0.06, 0.06], + BarrelNoiseOccupancyITK = [ 5e-8, 5e-8, 5e-8, 5e-8, 5e-8], + BarrelDisableProbabilityITK = [ 9e-3, 9e-3, 9e-3, 9e-3, 9e-3], + EndcapToTThresholdITK = [ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3], + EndcapCrossTalkITK = [ 0.06, 0.06, 0.06, 0.06, 0.06, 0.06, 0.06, 0.06, 0.06, 0.06, 0.06, 0.06, 0.06, 0.06], + EndcapNoiseOccupancyITK = [ 5e-8, 5e-8, 5e-8, 5e-8, 5e-8, 5e-8, 5e-8, 5e-8, 5e-8, 5e-8, 5e-8, 5e-8, 5e-8, 5e-8], + EndcapDisableProbabilityITK = [ 9e-3, 9e-3, 9e-3, 9e-3, 9e-3, 9e-3, 9e-3, 9e-3, 9e-3, 9e-3, 9e-3, 9e-3, 9e-3, 9e-3], + InnermostNoiseShapeITK = [0.0, 1.0], + NextInnermostNoiseShapeITK = [0.0, 1.0], + PixelNoiseShapeITK = [0.0, 1.0] + ) + # Charge calibration parameters CondArgs.update( DefaultCalibrationParameterA=70.2, @@ -215,7 +239,7 @@ def PixelConfigCondAlgCfg(flags, name="PixelConfigCondAlg", **kwargs): elif (runNum >= 222222 and runNum < 289350): # 2015 IdMappingDat="PixelCabling/Pixels_Atlas_IdMapping_Run2.dat" else: - IdMappingDat="PixelCabling/Pixels_Atlas_IdMapping_May08.dat" + IdMappingDat="PixelCabling/Pixels_Atlas_IdMapping_344494.dat" CondArgs.update( UseCablingConditions=useCablingConditions, diff --git a/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/PixelConfigCondAlg.cxx b/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/PixelConfigCondAlg.cxx index 48dc399d4199d550f9a5f0a179bf4a557fb088e5..b6fbbaa61fb03650bcc54e9909535dc685484dcf 100644 --- a/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/PixelConfigCondAlg.cxx +++ b/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/PixelConfigCondAlg.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "PixelConfigCondAlg.h" @@ -9,14 +9,8 @@ #include <sstream> PixelConfigCondAlg::PixelConfigCondAlg(const std::string& name, ISvcLocator* pSvcLocator): - ::AthReentrantAlgorithm(name, pSvcLocator), - m_IBLNoiseShape({0.0,1.0}), - m_BLayerNoiseShape({0.0,1.0}), - m_PixelNoiseShape({0.0,1.0}) + ::AthReentrantAlgorithm(name, pSvcLocator) { - declareProperty("IBLNoiseShape", m_IBLNoiseShape); // This is ad-hoc solution. - declareProperty("BLayerNoiseShape", m_BLayerNoiseShape); - declareProperty("PixelNoiseShape", m_PixelNoiseShape); } StatusCode PixelConfigCondAlg::initialize() { @@ -151,61 +145,9 @@ StatusCode PixelConfigCondAlg::execute(const EventContext& ctx) const { writeCdo -> setDefaultBarrelInTimeThreshold(m_BarrelInTimeThreshold); writeCdo -> setDefaultEndcapInTimeThreshold(m_EndcapInTimeThreshold); writeCdo -> setDefaultDBMInTimeThreshold(m_DBMInTimeThreshold); - writeCdo -> setBarrelToTThreshold(m_BarrelToTThreshold); - writeCdo -> setEndcapToTThreshold(m_EndcapToTThreshold); - writeCdo -> setDBMToTThreshold(m_DBMToTThreshold); - writeCdo -> setBarrelCrossTalk(m_BarrelCrossTalk); - writeCdo -> setEndcapCrossTalk(m_EndcapCrossTalk); - writeCdo -> setDBMCrossTalk(m_DBMCrossTalk); writeCdo -> setBarrelThermalNoise(m_BarrelThermalNoise); writeCdo -> setEndcapThermalNoise(m_EndcapThermalNoise); writeCdo -> setDBMThermalNoise(m_DBMThermalNoise); - writeCdo -> setBarrelNoiseOccupancy(m_BarrelNoiseOccupancy); - writeCdo -> setEndcapNoiseOccupancy(m_EndcapNoiseOccupancy); - writeCdo -> setDBMNoiseOccupancy(m_DBMNoiseOccupancy); - writeCdo -> setBarrelDisableProbability(m_BarrelDisableProbability); - writeCdo -> setEndcapDisableProbability(m_EndcapDisableProbability); - writeCdo -> setDBMDisableProbability(m_DBMDisableProbability); - - for (size_t i=0; i<m_IBLNoiseShape.size(); i++) { writeCdo->setBarrelNoiseShape(0,m_IBLNoiseShape.at(i)); } - for (size_t i=0; i<m_BLayerNoiseShape.size(); i++) { writeCdo->setBarrelNoiseShape(1,m_BLayerNoiseShape.at(i)); } - for (size_t i=0; i<m_PixelNoiseShape.size(); i++) { writeCdo->setBarrelNoiseShape(2,m_PixelNoiseShape.at(i)); } - for (size_t i=0; i<m_PixelNoiseShape.size(); i++) { writeCdo->setBarrelNoiseShape(3,m_PixelNoiseShape.at(i)); } - - for (size_t i=0; i<m_PixelNoiseShape.size(); i++) { writeCdo->setEndcapNoiseShape(0,m_PixelNoiseShape.at(i)); } - for (size_t i=0; i<m_PixelNoiseShape.size(); i++) { writeCdo->setEndcapNoiseShape(1,m_PixelNoiseShape.at(i)); } - for (size_t i=0; i<m_PixelNoiseShape.size(); i++) { writeCdo->setEndcapNoiseShape(2,m_PixelNoiseShape.at(i)); } - - for (size_t i=0; i<m_IBLNoiseShape.size(); i++) { writeCdo->setDBMNoiseShape(0,m_IBLNoiseShape.at(i)); } - for (size_t i=0; i<m_IBLNoiseShape.size(); i++) { writeCdo->setDBMNoiseShape(1,m_IBLNoiseShape.at(i)); } - for (size_t i=0; i<m_IBLNoiseShape.size(); i++) { writeCdo->setDBMNoiseShape(2,m_IBLNoiseShape.at(i)); } - -/* - for (size_t i=0; i<m_BarrelNoiseShape.size(); i++) { - for (size_t j=0; j<m_BarrelNoiseShape[i].size(); j++) { - writeCdo -> setBarrelNoiseShape(i,m_BarrelNoiseShape[i][j]); - } - } - for (size_t i=0; i<m_EndcapNoiseShape.size(); i++) { - for (size_t j=0; j<m_EndcapNoiseShape[i].size(); j++) { - writeCdo -> setEndcapNoiseShape(i,m_EndcapNoiseShape[i][j]); - } - } - for (size_t i=0; i<m_DBMNoiseShape.size(); i++) { - for (size_t j=0; j<m_DBMNoiseShape[i].size(); j++) { - writeCdo -> setDBMNoiseShape(i,m_DBMNoiseShape[i][j]); - } - } -*/ - - writeCdo -> setFEI3BarrelLatency(m_FEI3BarrelLatency); - writeCdo -> setFEI3EndcapLatency(m_FEI3EndcapLatency); - writeCdo -> setFEI3BarrelHitDuplication(m_FEI3BarrelHitDuplication); - writeCdo -> setFEI3EndcapHitDuplication(m_FEI3EndcapHitDuplication); - writeCdo -> setFEI3BarrelSmallHitToT(m_FEI3BarrelSmallHitToT); - writeCdo -> setFEI3EndcapSmallHitToT(m_FEI3EndcapSmallHitToT); - writeCdo -> setFEI3BarrelTimingSimTune(m_FEI3BarrelTimingSimTune); - writeCdo -> setFEI3EndcapTimingSimTune(m_FEI3EndcapTimingSimTune); writeCdo -> setFEI4BarrelHitDiscConfig(m_FEI4BarrelHitDiscConfig); writeCdo -> setFEI4EndcapHitDiscConfig(m_FEI4EndcapHitDiscConfig); @@ -218,10 +160,6 @@ StatusCode PixelConfigCondAlg::execute(const EventContext& ctx) const { writeCdo -> setDefaultBiasVoltage(m_biasVoltage); writeCdo -> setDefaultTemperature(m_temperature); - // Cabling parameters - writeCdo -> setCablingMapToFile(m_cablingMapToFile); - writeCdo -> setCablingMapFileName(m_cablingMapFileName); - // Distortion parameters writeCdo -> setDistortionInputSource(m_distortionInputSource); writeCdo -> setDistortionVersion(m_distortionVersion); @@ -235,6 +173,228 @@ StatusCode PixelConfigCondAlg::execute(const EventContext& ctx) const { writeCdo -> setDistortionWriteToFile(m_distortionWriteToFile); writeCdo -> setDistortionFileName(m_distortionFileName); + // Cabling parameters + writeCdo -> setCablingMapToFile(m_cablingMapToFile); + writeCdo -> setCablingMapFileName(m_cablingMapFileName); + + int currentRunNumber = ctx.eventID().run_number(); + if (currentRunNumber<222222) { + writeCdo -> setBarrelToTThreshold(m_BarrelToTThresholdRUN1); + writeCdo -> setFEI3BarrelLatency(m_FEI3BarrelLatencyRUN1); + writeCdo -> setFEI3BarrelHitDuplication(m_FEI3BarrelHitDuplicationRUN1); + writeCdo -> setFEI3BarrelSmallHitToT(m_FEI3BarrelSmallHitToTRUN1); + writeCdo -> setFEI3BarrelTimingSimTune(m_FEI3BarrelTimingSimTuneRUN1); + writeCdo -> setBarrelCrossTalk(m_BarrelCrossTalkRUN1); + writeCdo -> setBarrelNoiseOccupancy(m_BarrelNoiseOccupancyRUN1); + writeCdo -> setBarrelDisableProbability(m_BarrelDisableProbabilityRUN1); + + writeCdo -> setEndcapToTThreshold(m_EndcapToTThresholdRUN1); + writeCdo -> setFEI3EndcapLatency(m_FEI3EndcapLatencyRUN1); + writeCdo -> setFEI3EndcapHitDuplication(m_FEI3EndcapHitDuplicationRUN1); + writeCdo -> setFEI3EndcapSmallHitToT(m_FEI3EndcapSmallHitToTRUN1); + writeCdo -> setFEI3EndcapTimingSimTune(m_FEI3EndcapTimingSimTuneRUN1); + writeCdo -> setEndcapCrossTalk(m_EndcapCrossTalkRUN1); + writeCdo -> setEndcapNoiseOccupancy(m_EndcapNoiseOccupancyRUN1); + writeCdo -> setEndcapDisableProbability(m_EndcapDisableProbabilityRUN1); + + // This is ad-hoc solution. + for (size_t i=0; i<m_BLayerNoiseShapeRUN1.size(); i++) { writeCdo->setBarrelNoiseShape(0,m_BLayerNoiseShapeRUN1[i]); } + for (size_t i=0; i<m_PixelNoiseShapeRUN1.size(); i++) { + for (size_t layer:{1,2}) { writeCdo->setBarrelNoiseShape(layer,m_PixelNoiseShapeRUN1[i]); } + } + + for (size_t i=0; i<m_PixelNoiseShapeRUN1.size(); i++) { + for (size_t layer:{0,1,2}) { writeCdo->setEndcapNoiseShape(layer,m_PixelNoiseShapeRUN1[i]); } + } + } + else if (currentRunNumber<240000) { // RUN2 + writeCdo -> setBarrelToTThreshold(m_BarrelToTThreshold2016); + writeCdo -> setFEI3BarrelLatency(m_FEI3BarrelLatency2016); + writeCdo -> setFEI3BarrelHitDuplication(m_FEI3BarrelHitDuplication2016); + writeCdo -> setFEI3BarrelSmallHitToT(m_FEI3BarrelSmallHitToT2016); + writeCdo -> setFEI3BarrelTimingSimTune(m_FEI3BarrelTimingSimTune2016); + writeCdo -> setBarrelCrossTalk(m_BarrelCrossTalk2016); + writeCdo -> setBarrelNoiseOccupancy(m_BarrelNoiseOccupancy2016); + writeCdo -> setBarrelDisableProbability(m_BarrelDisableProbability2016); + + writeCdo -> setEndcapToTThreshold(m_EndcapToTThreshold2016); + writeCdo -> setFEI3EndcapLatency(m_FEI3EndcapLatency2016); + writeCdo -> setFEI3EndcapHitDuplication(m_FEI3EndcapHitDuplication2016); + writeCdo -> setFEI3EndcapSmallHitToT(m_FEI3EndcapSmallHitToT2016); + writeCdo -> setFEI3EndcapTimingSimTune(m_FEI3EndcapTimingSimTune2016); + writeCdo -> setEndcapCrossTalk(m_EndcapCrossTalk2016); + writeCdo -> setEndcapNoiseOccupancy(m_EndcapNoiseOccupancy2016); + writeCdo -> setEndcapDisableProbability(m_EndcapDisableProbability2016); + + writeCdo -> setDBMToTThreshold(m_DBMToTThreshold2016); + writeCdo -> setDBMCrossTalk(m_DBMCrossTalk2016); + writeCdo -> setDBMNoiseOccupancy(m_DBMNoiseOccupancy2016); + writeCdo -> setDBMDisableProbability(m_DBMDisableProbability2016); + + /* + So far, Gaudi::Property does not support 2D vector. + for (size_t i=0; i<m_BarrelNoiseShape.size(); i++) { + for (size_t j=0; j<m_BarrelNoiseShape[i].size(); j++) { + writeCdo -> setBarrelNoiseShape(i,m_BarrelNoiseShape[i][j]); + } + } + */ + + // This is ad-hoc solution. + for (size_t i=0; i<m_IBLNoiseShape2016.size(); i++) { writeCdo->setBarrelNoiseShape(0,m_IBLNoiseShape2016[i]); } + for (size_t i=0; i<m_BLayerNoiseShape2016.size(); i++) { writeCdo->setBarrelNoiseShape(1,m_BLayerNoiseShape2016[i]); } + for (size_t i=0; i<m_PixelNoiseShape2016.size(); i++) { + for (size_t layer:{2,3}) { writeCdo->setBarrelNoiseShape(layer,m_PixelNoiseShape2016[i]); } + } + + for (size_t i=0; i<m_PixelNoiseShape2016.size(); i++) { + for (size_t layer:{0,1,2}) { writeCdo->setEndcapNoiseShape(layer,m_PixelNoiseShape2016[i]); } + } + + for (size_t i=0; i<m_IBLNoiseShape2016.size(); i++) { + for (size_t layer:{0,1,2}) { writeCdo->setDBMNoiseShape(layer,m_IBLNoiseShape2016[i]); } + } + } + else if (currentRunNumber<250000) { // RUN4 + writeCdo -> setBarrelToTThreshold(m_BarrelToTThresholdITK); + writeCdo -> setBarrelCrossTalk(m_BarrelCrossTalkITK); + writeCdo -> setBarrelNoiseOccupancy(m_BarrelNoiseOccupancyITK); + writeCdo -> setBarrelDisableProbability(m_BarrelDisableProbabilityITK); + + writeCdo -> setEndcapToTThreshold(m_EndcapToTThresholdITK); + writeCdo -> setEndcapCrossTalk(m_EndcapCrossTalkITK); + writeCdo -> setEndcapNoiseOccupancy(m_EndcapNoiseOccupancyITK); + writeCdo -> setEndcapDisableProbability(m_EndcapDisableProbabilityITK); + + // This is ad-hoc solution. + for (size_t i=0; i<m_InnermostNoiseShapeITK.size(); i++) { writeCdo->setBarrelNoiseShape(0,m_InnermostNoiseShapeITK[i]); } + for (size_t i=0; i<m_NextInnermostNoiseShapeITK.size(); i++) { writeCdo->setBarrelNoiseShape(1,m_NextInnermostNoiseShapeITK[i]); } + for (size_t i=0; i<m_PixelNoiseShapeITK.size(); i++) { + for (size_t layer:{2,3,4}) { writeCdo->setBarrelNoiseShape(layer,m_PixelNoiseShapeITK[i]); } + } + + for (size_t i=0; i<m_EndcapToTThresholdITK.size(); i++) { + for (size_t j=0; j<m_PixelNoiseShapeITK.size(); j++) { writeCdo->setEndcapNoiseShape(i,m_PixelNoiseShapeITK[j]); } + } + } + else if (currentRunNumber<300000) { // RUN2 2015/2016 + writeCdo -> setBarrelToTThreshold(m_BarrelToTThreshold2016); + writeCdo -> setFEI3BarrelLatency(m_FEI3BarrelLatency2016); + writeCdo -> setFEI3BarrelHitDuplication(m_FEI3BarrelHitDuplication2016); + writeCdo -> setFEI3BarrelSmallHitToT(m_FEI3BarrelSmallHitToT2016); + writeCdo -> setFEI3BarrelTimingSimTune(m_FEI3BarrelTimingSimTune2016); + writeCdo -> setBarrelCrossTalk(m_BarrelCrossTalk2016); + writeCdo -> setBarrelNoiseOccupancy(m_BarrelNoiseOccupancy2016); + writeCdo -> setBarrelDisableProbability(m_BarrelDisableProbability2016); + + writeCdo -> setEndcapToTThreshold(m_EndcapToTThreshold2016); + writeCdo -> setFEI3EndcapLatency(m_FEI3EndcapLatency2016); + writeCdo -> setFEI3EndcapHitDuplication(m_FEI3EndcapHitDuplication2016); + writeCdo -> setFEI3EndcapSmallHitToT(m_FEI3EndcapSmallHitToT2016); + writeCdo -> setFEI3EndcapTimingSimTune(m_FEI3EndcapTimingSimTune2016); + writeCdo -> setEndcapCrossTalk(m_EndcapCrossTalk2016); + writeCdo -> setEndcapNoiseOccupancy(m_EndcapNoiseOccupancy2016); + writeCdo -> setEndcapDisableProbability(m_EndcapDisableProbability2016); + + writeCdo -> setDBMToTThreshold(m_DBMToTThreshold2016); + writeCdo -> setDBMCrossTalk(m_DBMCrossTalk2016); + writeCdo -> setDBMNoiseOccupancy(m_DBMNoiseOccupancy2016); + writeCdo -> setDBMDisableProbability(m_DBMDisableProbability2016); + + // This is ad-hoc solution. + for (size_t i=0; i<m_IBLNoiseShape2016.size(); i++) { writeCdo->setBarrelNoiseShape(0,m_IBLNoiseShape2016[i]); } + for (size_t i=0; i<m_BLayerNoiseShape2016.size(); i++) { writeCdo->setBarrelNoiseShape(1,m_BLayerNoiseShape2016[i]); } + for (size_t i=0; i<m_PixelNoiseShape2016.size(); i++) { + for (size_t layer:{2,3}) { writeCdo->setBarrelNoiseShape(layer,m_PixelNoiseShape2016[i]); } + } + + for (size_t i=0; i<m_PixelNoiseShape2016.size(); i++) { + for (size_t layer:{0,1,2}) { writeCdo->setEndcapNoiseShape(layer,m_PixelNoiseShape2016[i]); } + } + + for (size_t i=0; i<m_IBLNoiseShape2016.size(); i++) { + for (size_t layer:{0,1,2}) { writeCdo->setDBMNoiseShape(layer,m_IBLNoiseShape2016[i]); } + } + } + else if (currentRunNumber<310000) { // RUN2 2017 + writeCdo -> setBarrelToTThreshold(m_BarrelToTThreshold2017); + writeCdo -> setFEI3BarrelLatency(m_FEI3BarrelLatency2017); + writeCdo -> setFEI3BarrelHitDuplication(m_FEI3BarrelHitDuplication2017); + writeCdo -> setFEI3BarrelSmallHitToT(m_FEI3BarrelSmallHitToT2017); + writeCdo -> setFEI3BarrelTimingSimTune(m_FEI3BarrelTimingSimTune2017); + writeCdo -> setBarrelCrossTalk(m_BarrelCrossTalk2017); + writeCdo -> setBarrelNoiseOccupancy(m_BarrelNoiseOccupancy2017); + writeCdo -> setBarrelDisableProbability(m_BarrelDisableProbability2017); + + writeCdo -> setEndcapToTThreshold(m_EndcapToTThreshold2017); + writeCdo -> setFEI3EndcapLatency(m_FEI3EndcapLatency2017); + writeCdo -> setFEI3EndcapHitDuplication(m_FEI3EndcapHitDuplication2017); + writeCdo -> setFEI3EndcapSmallHitToT(m_FEI3EndcapSmallHitToT2017); + writeCdo -> setFEI3EndcapTimingSimTune(m_FEI3EndcapTimingSimTune2017); + writeCdo -> setEndcapCrossTalk(m_EndcapCrossTalk2017); + writeCdo -> setEndcapNoiseOccupancy(m_EndcapNoiseOccupancy2017); + writeCdo -> setEndcapDisableProbability(m_EndcapDisableProbability2017); + + writeCdo -> setDBMToTThreshold(m_DBMToTThreshold2017); + writeCdo -> setDBMCrossTalk(m_DBMCrossTalk2017); + writeCdo -> setDBMNoiseOccupancy(m_DBMNoiseOccupancy2017); + writeCdo -> setDBMDisableProbability(m_DBMDisableProbability2017); + + // This is ad-hoc solution. + for (size_t i=0; i<m_IBLNoiseShape2017.size(); i++) { writeCdo->setBarrelNoiseShape(0,m_IBLNoiseShape2017[i]); } + for (size_t i=0; i<m_BLayerNoiseShape2017.size(); i++) { writeCdo->setBarrelNoiseShape(1,m_BLayerNoiseShape2017[i]); } + for (size_t i=0; i<m_PixelNoiseShape2017.size(); i++) { + for (size_t layer:{2,3}) { writeCdo->setBarrelNoiseShape(layer,m_PixelNoiseShape2017[i]); } + } + + for (size_t i=0; i<m_PixelNoiseShape2017.size(); i++) { + for (size_t layer:{0,1,2}) { writeCdo->setEndcapNoiseShape(layer,m_PixelNoiseShape2017[i]); } + } + + for (size_t i=0; i<m_IBLNoiseShape2017.size(); i++) { + for (size_t layer:{0,1,2}) { writeCdo->setDBMNoiseShape(layer,m_IBLNoiseShape2017[i]); } + } + } + else { // RUN2 2018 + writeCdo -> setBarrelToTThreshold(m_BarrelToTThreshold2018); + writeCdo -> setFEI3BarrelLatency(m_FEI3BarrelLatency2018); + writeCdo -> setFEI3BarrelHitDuplication(m_FEI3BarrelHitDuplication2018); + writeCdo -> setFEI3BarrelSmallHitToT(m_FEI3BarrelSmallHitToT2018); + writeCdo -> setFEI3BarrelTimingSimTune(m_FEI3BarrelTimingSimTune2018); + writeCdo -> setBarrelCrossTalk(m_BarrelCrossTalk2018); + writeCdo -> setBarrelNoiseOccupancy(m_BarrelNoiseOccupancy2018); + writeCdo -> setBarrelDisableProbability(m_BarrelDisableProbability2018); + + writeCdo -> setEndcapToTThreshold(m_EndcapToTThreshold2018); + writeCdo -> setFEI3EndcapLatency(m_FEI3EndcapLatency2018); + writeCdo -> setFEI3EndcapHitDuplication(m_FEI3EndcapHitDuplication2018); + writeCdo -> setFEI3EndcapSmallHitToT(m_FEI3EndcapSmallHitToT2018); + writeCdo -> setFEI3EndcapTimingSimTune(m_FEI3EndcapTimingSimTune2018); + writeCdo -> setEndcapCrossTalk(m_EndcapCrossTalk2018); + writeCdo -> setEndcapNoiseOccupancy(m_EndcapNoiseOccupancy2018); + writeCdo -> setEndcapDisableProbability(m_EndcapDisableProbability2018); + + writeCdo -> setDBMToTThreshold(m_DBMToTThreshold2018); + writeCdo -> setDBMCrossTalk(m_DBMCrossTalk2018); + writeCdo -> setDBMNoiseOccupancy(m_DBMNoiseOccupancy2018); + writeCdo -> setDBMDisableProbability(m_DBMDisableProbability2018); + + // This is ad-hoc solution. + for (size_t i=0; i<m_IBLNoiseShape2018.size(); i++) { writeCdo->setBarrelNoiseShape(0,m_IBLNoiseShape2018[i]); } + for (size_t i=0; i<m_BLayerNoiseShape2018.size(); i++) { writeCdo->setBarrelNoiseShape(1,m_BLayerNoiseShape2018[i]); } + for (size_t i=0; i<m_PixelNoiseShape2018.size(); i++) { + for (size_t layer:{2,3}) { writeCdo->setBarrelNoiseShape(layer,m_PixelNoiseShape2018[i]); } + } + + for (size_t i=0; i<m_PixelNoiseShape2018.size(); i++) { + for (size_t layer:{0,1,2}) { writeCdo->setEndcapNoiseShape(layer,m_PixelNoiseShape2018[i]); } + } + + for (size_t i=0; i<m_IBLNoiseShape2018.size(); i++) { + for (size_t layer:{0,1,2}) { writeCdo->setDBMNoiseShape(layer,m_IBLNoiseShape2018[i]); } + } + } + //======================= // Combine time interval //======================= diff --git a/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/PixelConfigCondAlg.h b/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/PixelConfigCondAlg.h index 43800012a500eaa275f1623cec4f6188b3c4bd0a..ebb5a04ad2771622fa90fd8b46ab5ba840cb9657 100644 --- a/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/PixelConfigCondAlg.h +++ b/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/PixelConfigCondAlg.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /** * @file PixelConditionsAlgorithms/PixelConfigCondAlg.h @@ -32,6 +32,10 @@ class PixelConfigCondAlg : public AthReentrantAlgorithm { virtual StatusCode execute(const EventContext& ctx) const override; private: + // Key for basic pixel parameters + SG::WriteCondHandleKey<PixelModuleData> m_writeKey + {this, "WriteKey", "PixelModuleData", "Output key of pixel module data"}; + // Switch parameters Gaudi::Property<bool> m_useCalibConditions {this, "UseCalibConditions", true, "Use conditions DB for charge calibration"}; @@ -66,6 +70,9 @@ class PixelConfigCondAlg : public AthReentrantAlgorithm { double m_ComTime{0.0}; + SG::ReadHandleKey<ComTime> m_ComTimeKey + {this, "ComTimeKey", "ComTime", "Commissioning time for cosmic"}; + Gaudi::Property<std::vector<int>> m_BarrelNumberOfBCID {this, "BarrelNumberOfBCID", {1,1,1,1}, "BCID numbers for barrel pixel layers"}; @@ -93,14 +100,409 @@ class PixelConfigCondAlg : public AthReentrantAlgorithm { Gaudi::Property<std::vector<double>> m_DBMTimeJitter {this, "DBMTimeJitter", {0.0,0.0,0.0}, "Time jitter of DBM layer"}; + // Dead map key. This will be replaced once new deadmap format is validated. + SG::ReadCondHandleKey<CondAttrListCollection> m_readDeadMapKey + {this, "ReadDeadMapKey", "/PIXEL/PixMapOverlay", "Input key of deadmap conditions folder"}; + + //==================================================================================== + // Run-dependent SIMULATION(digitization) parameters: + // + // So far, they are year-granularity (3 entries!), thus they may be still + // controlled via job option. + // + // MC Project: RUN1 RUN2 mc16a RUN2 mc16d RUN2 mc16e + // Year: - 2014 2015/2016 2017 2018 + // Run Number: <222222 284500 300000 310000 + // + // Barrel: + // ToT: [ 3, 3, 3] [ -1, 5, 5, 5] [ -1, 5, 5, 5] [ -1, 3, 5, 5] + // Latency: [ 256, 256, 256] [ -1, 150, 256, 256] [ -1, 150, 256, 256] [ -1, 150, 256, 256] + // Duplicaiton: [ T, T, T] [ N/A, F, F, F] [ N/A, F, F, F] [ N/A, F, F, F] + // SmallHit: [ 7, 7, 7] [ N/A, 0, 0, 0] [ N/A, 0, 0, 0] [ N/A, 0, 0, 0] + // TimingTune: [2009,2009,2009] [ N/A,2015,2015,2015] [ N/A,2018,2018,2018] [ N/A,2018,2018,2018] + // CrossTalk: [0.06,0.06,0.06] [0.30,0.06,0.06,0.06] [0.30,0.06,0.06,0.06] [0.30,0.06,0.06,0.06] + // NoiseOcc.: [5e-8,5e-8,5e-8] [5e-8,5e-8,5e-8,5e-8] [5e-8,5e-8,5e-8,5e-8] [5e-8,5e-8,5e-8,5e-8] + // DisalbePix: [9e-3,9e-3,9e-3] [9e-3,9e-3,9e-3,9e-3] [9e-3,9e-3,9e-3,9e-3] [9e-3,9e-3,9e-3,9e-3] + // NoiseShape: [2018,2018,2018] [2018,2018,2018,2018] [2018,2018,2018,2018] [2018,2018,2018,2018] + // + // Endcap: + // ToT: [ 3, 3, 3] [ 5, 5, 5] [ 5, 5, 5] [ 5, 5, 5] + // Latency: [ 256, 256, 256] [ 256, 256, 256] [ 256, 256, 256] [ 256, 256, 256] + // Duplicaiton: [ T, T, T] [ F, F, F] [ F, F, F] [ F, F, F] + // SmallHit: [ 7, 7, 7] [ 0, 0, 0] [ 0, 0, 0] [ 0, 0, 0] + // TimingTune: [2009,2009,2009] [2015,2015,2015] [2018,2018,2018] [2018,2018,2018] + // CrossTalk: [0.06,0.06,0.06] [0.06,0.06,0.06] [0.06,0.06,0.06] [0.06,0.06,0.06] + // NoiseOcc.: [5e-8,5e-8,5e-8] [5e-8,5e-8,5e-8] [5e-8,5e-8,5e-8] [5e-8,5e-8,5e-8] + // DisalbePix: [9e-3,9e-3,9e-3] [9e-3,9e-3,9e-3] [9e-3,9e-3,9e-3] [9e-3,9e-3,9e-3] + // NoiseShape: [2018,2018,2018] [2018,2018,2018] [2018,2018,2018] [2018,2018,2018] + // + // DBM: + // ToT: [N/A] [ -1, -1, -1] [ -1, -1, -1] [ -1, -1, -1] + // CrossTalk: [N/A] [0.06,0.06,0.06] [0.06,0.06,0.06] [0.06,0.06,0.06] + // NoiseOcc.: [N/A] [5e-8,5e-8,5e-8] [5e-8,5e-8,5e-8] [5e-8,5e-8,5e-8] + // DisalbePix: [N/A] [9e-3,9e-3,9e-3] [9e-3,9e-3,9e-3] [9e-3,9e-3,9e-3] + // + // See https://twiki.cern.ch/twiki/bin/view/Atlas/PixelConditionsRUN2 + // for further details. + // + // + // Upgrade ITk-pixel + // + // MC Project: RUN4 (unknown) + // Year: 2027 + // Run Number: [240000-250000] + // + // Barrel: + // ToT: [ 3, 3, 3, 3, 3] + // CrossTalk: [0.06,0.06,0.06,0.06,0.06] + // NoiseOcc.: [5e-8,5e-8,5e-8,5e-8,5e-8] + // DisalbePix: [9e-3,9e-3,9e-3,9e-3,9e-3] + // NoiseShape: [2018,2018,2018,2018,2018] + // + // Endcap: + // ToT: [ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3] + // CrossTalk: [0.06,0.06,0.06,0.06,0.06,0.06,0.06,0.06,0.06,0.06,0.06,0.06,0.06,0.06] + // NoiseOcc.: [5e-8,5e-8,5e-8,5e-8,5e-8,5e-8,5e-8,5e-8,5e-8,5e-8,5e-8,5e-8,5e-8,5e-8] + // DisalbePix: [9e-3,9e-3,9e-3,9e-3,9e-3,9e-3,9e-3,9e-3,9e-3,9e-3,9e-3,9e-3,9e-3,9e-3] + // NoiseShape: [2018,2018,2018,2018,2018,2018,2018,2018,2018,2018,2018,2018,2018,2018] + // + //==================================================================================== + + // Variable definition is a bit ugly here... + //==================================================================================== + // Barrel RUN2 2015/2016 + Gaudi::Property<std::vector<int>> m_BarrelToTThreshold2016 + {this, "BarrelToTThreshold2016", {-1, 5, 5, 5}, "ToT thresholds for barrel pixel layers in 2015/2016"}; + + Gaudi::Property<std::vector<int>> m_FEI3BarrelLatency2016 + {this, "FEI3BarrelLatency2016", { 0,151,256,256}, "FEI3 latency for barrel pixel layers in 2015/2016"}; + + Gaudi::Property<std::vector<bool>> m_FEI3BarrelHitDuplication2016 + {this, "FEI3BarrelHitDuplication2016", {false,false,false,false}, "Use FEI3 hit-duplicaiton for barrel pixel layers in 2015/2016"}; + + Gaudi::Property<std::vector<int>> m_FEI3BarrelSmallHitToT2016 + {this, "FEI3BarrelSmallHitToT2016", {-1,-1,-1,-1}, "Small hit ToT thresold for FEI3 hit-duplication of barrel pixel layers in 2015/2016"}; + + Gaudi::Property<std::vector<int>> m_FEI3BarrelTimingSimTune2016 + {this, "FEI3BarrelTimingSimTune2016", {-1,2015,2015,2015}, "FEI3 timing tuning set of barrel pixel layers in 2015/2016"}; + + Gaudi::Property<std::vector<double>> m_BarrelCrossTalk2016 + {this, "BarrelCrossTalk2016", {0.30,0.06,0.06,0.06}, "Cross-talk fraction of barrel pixel layers in 2015/2016"}; + + Gaudi::Property<std::vector<double>> m_BarrelNoiseOccupancy2016 + {this, "BarrelNoiseOccupancy2016", {5e-8,5e-8,5e-8,5e-8}, "Noise occupancy of barrel pixel layers in 2015/2016"}; + + Gaudi::Property<std::vector<double>> m_BarrelDisableProbability2016 + {this, "BarrelDisableProbability2016", {9e-3,9e-3,9e-3,9e-3}, "Disable probability of barrel pixel layers in 2015/2016"}; + +// So far, Gaudi::Property does not support 2D vector. +// Gaudi::Property<std::vector<std::vector<float>>> m_BarrelNoiseShape2016 +// {this, "BarrelNoiseShape", {{0.0,1.0},{0.0,1.0},{0.0,1.0},{0.0,1.0}}, "Noise shape of barrel pixel layers"}; + + // This is ad-hoc solution. + Gaudi::Property<std::vector<float>> m_IBLNoiseShape2016 + {this, "IBLNoiseShape2016", {0.0,1.0}, "Noise shape for IBL in 2015/2016"}; + + Gaudi::Property<std::vector<float>> m_BLayerNoiseShape2016 + {this, "BLayerNoiseShape2016", {0.0,1.0}, "Noise shape for b-layer in 2015/2016"}; + + Gaudi::Property<std::vector<float>> m_PixelNoiseShape2016 + {this, "PixelNoiseShape2016", {0.0,1.0}, "Noise shape for PIXEL in 2015/2016"}; + + // Endcap RUN2 2015/2016 + Gaudi::Property<std::vector<int>> m_EndcapToTThreshold2016 + {this, "EndcapToTThreshold2016", { 5, 5, 5}, "ToT thresholds for endcap pixel layers in 2015/2016"}; + + Gaudi::Property<std::vector<int>> m_FEI3EndcapLatency2016 + {this, "FEI3EndcapLatency2016", {256,256,256}, "FEI3 latency for endcap pixel layers in 2015/2016"}; + + Gaudi::Property<std::vector<bool>> m_FEI3EndcapHitDuplication2016 + {this, "FEI3EndcapHitDuplication2016", {false,false,false}, "Use FEI3 hit-duplicaiton for endcap pixel layers in 2015/2016"}; + + Gaudi::Property<std::vector<int>> m_FEI3EndcapSmallHitToT2016 + {this, "FEI3EndcapSmallHitToT2016", {-1,-1,-1}, "Small hit ToT thresold for FEI3 hit-duplication of endcap pixel layers in 2015/2016"}; + + Gaudi::Property<std::vector<int>> m_FEI3EndcapTimingSimTune2016 + {this, "FEI3EndcapTimingSimTune2016", {2015,2015,2015}, "FEI3 timing tuning set of endcap pixel layers in 2015/2016"}; + + Gaudi::Property<std::vector<double>> m_EndcapCrossTalk2016 + {this, "EndcapCrossTalk2016", {0.06,0.06,0.06}, "Cross-talk fraction of barrel endcap layers in 2015/2016"}; + + Gaudi::Property<std::vector<double>> m_EndcapNoiseOccupancy2016 + {this, "EndcapNoiseOccupancy2016", {5e-8,5e-8,5e-8}, "Noise occupancy of endcap pixel layers in 2015/2016"}; + + Gaudi::Property<std::vector<double>> m_EndcapDisableProbability2016 + {this, "EndcapDisableProbability2016", {9e-3,9e-3,9e-3}, "Disable probability of endcap pixel layers in 2015/2016"}; + + // DBM RUN2 2015/2016 + Gaudi::Property<std::vector<int>> m_DBMToTThreshold2016 + {this, "DBMToTThreshold2016", {-1,-1,-1}, "ToT thresholds for DBM layers in 2015/2016"}; + + Gaudi::Property<std::vector<double>> m_DBMCrossTalk2016 + {this, "DBMCrossTalk2016", {0.06,0.06,0.06}, "Cross-talk fraction of barrel DBM layers in 2015/2016"}; + + Gaudi::Property<std::vector<double>> m_DBMNoiseOccupancy2016 + {this, "DBMNoiseOccupancy2016", {5e-8,5e-8,5e-8}, "Noise occupancy of DBM layers in 2015/2016"}; + + Gaudi::Property<std::vector<double>> m_DBMDisableProbability2016 + {this, "DBMDisableProbability2016", {9e-3,9e-3,9e-3}, "Disable probability of DBM pixel layers in 2015/2016"}; + + //==================================================================================== + // Barrel RUN2 2017 + Gaudi::Property<std::vector<int>> m_BarrelToTThreshold2017 + {this, "BarrelToTThreshold2017", {-1, 5, 5, 5}, "ToT thresholds for barrel pixel layers in 2017"}; + + Gaudi::Property<std::vector<int>> m_FEI3BarrelLatency2017 + {this, "FEI3BarrelLatency2017", { 0,151,256,256}, "FEI3 latency for barrel pixel layers in 2017"}; + + Gaudi::Property<std::vector<bool>> m_FEI3BarrelHitDuplication2017 + {this, "FEI3BarrelHitDuplication2017", {false,false,false,false}, "Use FEI3 hit-duplicaiton for barrel pixel layers in 2017"}; + + Gaudi::Property<std::vector<int>> m_FEI3BarrelSmallHitToT2017 + {this, "FEI3BarrelSmallHitToT2017", {-1,-1,-1,-1}, "Small hit ToT thresold for FEI3 hit-duplication of barrel pixel layers in 2017"}; + + Gaudi::Property<std::vector<int>> m_FEI3BarrelTimingSimTune2017 + {this, "FEI3BarrelTimingSimTune2017", {-1,2018,2018,2018}, "FEI3 timing tuning set of barrel pixel layers in 2017"}; + + Gaudi::Property<std::vector<double>> m_BarrelCrossTalk2017 + {this, "BarrelCrossTalk2017", {0.30,0.06,0.06,0.06}, "Cross-talk fraction of barrel pixel layers in 2017"}; + + Gaudi::Property<std::vector<double>> m_BarrelNoiseOccupancy2017 + {this, "BarrelNoiseOccupancy2017", {5e-8,5e-8,5e-8,5e-8}, "Noise occupancy of barrel pixel layers in 2017"}; + + Gaudi::Property<std::vector<double>> m_BarrelDisableProbability2017 + {this, "BarrelDisableProbability2017", {9e-3,9e-3,9e-3,9e-3}, "Disable probability of barrel pixel layers in 2017"}; + + // This is ad-hoc solution. + Gaudi::Property<std::vector<float>> m_IBLNoiseShape2017 + {this, "IBLNoiseShape2017", {0.0,1.0}, "Noise shape for IBL in 2017"}; + + Gaudi::Property<std::vector<float>> m_BLayerNoiseShape2017 + {this, "BLayerNoiseShape2017", {0.0,1.0}, "Noise shape for b-layer in 2017"}; + + Gaudi::Property<std::vector<float>> m_PixelNoiseShape2017 + {this, "PixelNoiseShape2017", {0.0,1.0}, "Noise shape for PIXEL in 2017"}; + + // Endcap RUN2 2017 + Gaudi::Property<std::vector<int>> m_EndcapToTThreshold2017 + {this, "EndcapToTThreshold2017", { 5, 5, 5}, "ToT thresholds for endcap pixel layers in 2017"}; + + Gaudi::Property<std::vector<int>> m_FEI3EndcapLatency2017 + {this, "FEI3EndcapLatency2017", {256,256,256}, "FEI3 latency for endcap pixel layers in 2017"}; + + Gaudi::Property<std::vector<bool>> m_FEI3EndcapHitDuplication2017 + {this, "FEI3EndcapHitDuplication2017", {false,false,false}, "Use FEI3 hit-duplicaiton for endcap pixel layers in 2017"}; + + Gaudi::Property<std::vector<int>> m_FEI3EndcapSmallHitToT2017 + {this, "FEI3EndcapSmallHitToT2017", {-1,-1,-1}, "Small hit ToT thresold for FEI3 hit-duplication of endcap pixel layers in 2017"}; + + Gaudi::Property<std::vector<int>> m_FEI3EndcapTimingSimTune2017 + {this, "FEI3EndcapTimingSimTune2017", {2018,2018,2018}, "FEI3 timing tuning set of endcap pixel layers in 2017"}; + + Gaudi::Property<std::vector<double>> m_EndcapCrossTalk2017 + {this, "EndcapCrossTalk2017", {0.06,0.06,0.06}, "Cross-talk fraction of barrel endcap layers in 2017"}; + + Gaudi::Property<std::vector<double>> m_EndcapNoiseOccupancy2017 + {this, "EndcapNoiseOccupancy2017", {5e-8,5e-8,5e-8}, "Noise occupancy of endcap pixel layers in 2017"}; + + Gaudi::Property<std::vector<double>> m_EndcapDisableProbability2017 + {this, "EndcapDisableProbability2017", {9e-3,9e-3,9e-3}, "Disable probability of endcap pixel layers in 2017"}; + + // DBM RUN2 2017 + Gaudi::Property<std::vector<int>> m_DBMToTThreshold2017 + {this, "DBMToTThreshold2017", {-1,-1,-1}, "ToT thresholds for DBM layers in 2017"}; + + Gaudi::Property<std::vector<double>> m_DBMCrossTalk2017 + {this, "DBMCrossTalk2017", {0.06,0.06,0.06}, "Cross-talk fraction of barrel DBM layers in 2017"}; + + Gaudi::Property<std::vector<double>> m_DBMNoiseOccupancy2017 + {this, "DBMNoiseOccupancy2017", {5e-8,5e-8,5e-8}, "Noise occupancy of DBM layers in 2017"}; + + Gaudi::Property<std::vector<double>> m_DBMDisableProbability2017 + {this, "DBMDisableProbability2017", {9e-3,9e-3,9e-3}, "Disable probability of DBM pixel layers in 2017"}; + + //==================================================================================== + // Barrel RUN2 2018 + Gaudi::Property<std::vector<int>> m_BarrelToTThreshold2018 + {this, "BarrelToTThreshold2018", {-1, 3, 5, 5}, "ToT thresholds for barrel pixel layers in 2018"}; + + Gaudi::Property<std::vector<int>> m_FEI3BarrelLatency2018 + {this, "FEI3BarrelLatency2018", { 0,151,256,256}, "FEI3 latency for barrel pixel layers in 2018"}; + + Gaudi::Property<std::vector<bool>> m_FEI3BarrelHitDuplication2018 + {this, "FEI3BarrelHitDuplication2018", {false,false,false,false}, "Use FEI3 hit-duplicaiton for barrel pixel layers in 2018"}; + + Gaudi::Property<std::vector<int>> m_FEI3BarrelSmallHitToT2018 + {this, "FEI3BarrelSmallHitToT2018", {-1,-1,-1,-1}, "Small hit ToT thresold for FEI3 hit-duplication of barrel pixel layers in 2018"}; + + Gaudi::Property<std::vector<int>> m_FEI3BarrelTimingSimTune2018 + {this, "FEI3BarrelTimingSimTune2018", {-1,2018,2018,2018}, "FEI3 timing tuning set of barrel pixel layers in 2018"}; + + Gaudi::Property<std::vector<double>> m_BarrelCrossTalk2018 + {this, "BarrelCrossTalk2018", {0.30,0.06,0.06,0.06}, "Cross-talk fraction of barrel pixel layers in 2018"}; + + Gaudi::Property<std::vector<double>> m_BarrelNoiseOccupancy2018 + {this, "BarrelNoiseOccupancy2018", {5e-8,5e-8,5e-8,5e-8}, "Noise occupancy of barrel pixel layers in 2018"}; + + Gaudi::Property<std::vector<double>> m_BarrelDisableProbability2018 + {this, "BarrelDisableProbability2018", {9e-3,9e-3,9e-3,9e-3}, "Disable probability of barrel pixel layers in 2018"}; + + // This is ad-hoc solution. + Gaudi::Property<std::vector<float>> m_IBLNoiseShape2018 + {this, "IBLNoiseShape2018", {0.0,1.0}, "Noise shape for IBL in 2018"}; + + Gaudi::Property<std::vector<float>> m_BLayerNoiseShape2018 + {this, "BLayerNoiseShape2018", {0.0,1.0}, "Noise shape for b-layer in 2018"}; + + Gaudi::Property<std::vector<float>> m_PixelNoiseShape2018 + {this, "PixelNoiseShape2018", {0.0,1.0}, "Noise shape for PIXEL in 2018"}; + + // Endcap RUN2 2018 + Gaudi::Property<std::vector<int>> m_EndcapToTThreshold2018 + {this, "EndcapToTThreshold2018", { 5, 5, 5}, "ToT thresholds for endcap pixel layers in 2018"}; + + Gaudi::Property<std::vector<int>> m_FEI3EndcapLatency2018 + {this, "FEI3EndcapLatency2018", {256,256,256}, "FEI3 latency for endcap pixel layers in 2018"}; + + Gaudi::Property<std::vector<bool>> m_FEI3EndcapHitDuplication2018 + {this, "FEI3EndcapHitDuplication2018", {false,false,false}, "Use FEI3 hit-duplicaiton for endcap pixel layers in 2018"}; + + Gaudi::Property<std::vector<int>> m_FEI3EndcapSmallHitToT2018 + {this, "FEI3EndcapSmallHitToT2018", {-1,-1,-1}, "Small hit ToT thresold for FEI3 hit-duplication of endcap pixel layers in 2018"}; + + Gaudi::Property<std::vector<int>> m_FEI3EndcapTimingSimTune2018 + {this, "FEI3EndcapTimingSimTune2018", {2018,2018,2018}, "FEI3 timing tuning set of endcap pixel layers in 2018"}; + + Gaudi::Property<std::vector<double>> m_EndcapCrossTalk2018 + {this, "EndcapCrossTalk2018", {0.06,0.06,0.06}, "Cross-talk fraction of barrel endcap layers in 2018"}; + + Gaudi::Property<std::vector<double>> m_EndcapNoiseOccupancy2018 + {this, "EndcapNoiseOccupancy2018", {5e-8,5e-8,5e-8}, "Noise occupancy of endcap pixel layers in 2018"}; + + Gaudi::Property<std::vector<double>> m_EndcapDisableProbability2018 + {this, "EndcapDisableProbability2018", {9e-3,9e-3,9e-3}, "Disable probability of endcap pixel layers in 2018"}; + + // DBM RUN2 2018 + Gaudi::Property<std::vector<int>> m_DBMToTThreshold2018 + {this, "DBMToTThreshold2018", {-1,-1,-1}, "ToT thresholds for DBM layers in 2018"}; + + Gaudi::Property<std::vector<double>> m_DBMCrossTalk2018 + {this, "DBMCrossTalk2018", {0.06,0.06,0.06}, "Cross-talk fraction of barrel DBM layers in 2018"}; + + Gaudi::Property<std::vector<double>> m_DBMNoiseOccupancy2018 + {this, "DBMNoiseOccupancy2018", {5e-8,5e-8,5e-8}, "Noise occupancy of DBM layers in 2018"}; + + Gaudi::Property<std::vector<double>> m_DBMDisableProbability2018 + {this, "DBMDisableProbability2018", {9e-3,9e-3,9e-3}, "Disable probability of DBM pixel layers in 2018"}; + + //==================================================================================== + // Barrel RUN1 + Gaudi::Property<std::vector<int>> m_BarrelToTThresholdRUN1 + {this, "BarrelToTThresholdRUN1", {3, 3, 3}, "ToT thresholds for barrel pixel layers in RUN1"}; + + Gaudi::Property<std::vector<int>> m_FEI3BarrelLatencyRUN1 + {this, "FEI3BarrelLatencyRUN1", {256,256,256}, "FEI3 latency for barrel pixel layers in RUN1"}; + + Gaudi::Property<std::vector<bool>> m_FEI3BarrelHitDuplicationRUN1 + {this, "FEI3BarrelHitDuplicationRUN1", {true,true,true}, "Use FEI3 hit-duplicaiton for barrel pixel layers in RUN1"}; + + Gaudi::Property<std::vector<int>> m_FEI3BarrelSmallHitToTRUN1 + {this, "FEI3BarrelSmallHitToTRUN1", {7,7,7}, "Small hit ToT thresold for FEI3 hit-duplication of barrel pixel layers in RUN1"}; + + Gaudi::Property<std::vector<int>> m_FEI3BarrelTimingSimTuneRUN1 + {this, "FEI3BarrelTimingSimTuneRUN1", {2009,2009,2009}, "FEI3 timing tuning set of barrel pixel layers in RUN1"}; + + Gaudi::Property<std::vector<double>> m_BarrelCrossTalkRUN1 + {this, "BarrelCrossTalkRUN1", {0.06,0.06,0.06}, "Cross-talk fraction of barrel pixel layers in RUN1"}; + + Gaudi::Property<std::vector<double>> m_BarrelNoiseOccupancyRUN1 + {this, "BarrelNoiseOccupancyRUN1", {5e-8,5e-8,5e-8}, "Noise occupancy of barrel pixel layers in RUN1"}; + + Gaudi::Property<std::vector<double>> m_BarrelDisableProbabilityRUN1 + {this, "BarrelDisableProbabilityRUN1", {9e-3,9e-3,9e-3}, "Disable probability of barrel pixel layers in RUN1"}; + + // This is ad-hoc solution. + Gaudi::Property<std::vector<float>> m_BLayerNoiseShapeRUN1 + {this, "BLayerNoiseShapeRUN1", {0.0,1.0}, "Noise shape for b-layer in RUN1"}; + + Gaudi::Property<std::vector<float>> m_PixelNoiseShapeRUN1 + {this, "PixelNoiseShapeRUN1", {0.0,1.0}, "Noise shape for PIXEL in RUN1"}; + + // Endcap RUN1 + Gaudi::Property<std::vector<int>> m_EndcapToTThresholdRUN1 + {this, "EndcapToTThresholdRUN1", { 3, 3, 3}, "ToT thresholds for endcap pixel layers in RUN1"}; + + Gaudi::Property<std::vector<int>> m_FEI3EndcapLatencyRUN1 + {this, "FEI3EndcapLatencyRUN1", {256,256,256}, "FEI3 latency for endcap pixel layers in RUN1"}; + + Gaudi::Property<std::vector<bool>> m_FEI3EndcapHitDuplicationRUN1 + {this, "FEI3EndcapHitDuplicationRUN1", {true,true,true}, "Use FEI3 hit-duplicaiton for endcap pixel layers in RUN1"}; + + Gaudi::Property<std::vector<int>> m_FEI3EndcapSmallHitToTRUN1 + {this, "FEI3EndcapSmallHitToTRUN1", {7,7,7}, "Small hit ToT thresold for FEI3 hit-duplication of endcap pixel layers in RUN1"}; + + Gaudi::Property<std::vector<int>> m_FEI3EndcapTimingSimTuneRUN1 + {this, "FEI3EndcapTimingSimTuneRUN1", {2009,2009,2009}, "FEI3 timing tuning set of endcap pixel layers in RUN1"}; + + Gaudi::Property<std::vector<double>> m_EndcapCrossTalkRUN1 + {this, "EndcapCrossTalkRUN1", {0.06,0.06,0.06}, "Cross-talk fraction of barrel endcap layers in RUN1"}; + + Gaudi::Property<std::vector<double>> m_EndcapNoiseOccupancyRUN1 + {this, "EndcapNoiseOccupancyRUN1", {5e-8,5e-8,5e-8}, "Noise occupancy of endcap pixel layers in RUN1"}; + + Gaudi::Property<std::vector<double>> m_EndcapDisableProbabilityRUN1 + {this, "EndcapDisableProbabilityRUN1", {9e-3,9e-3,9e-3}, "Disable probability of endcap pixel layers in RUN1"}; + + //==================================================================================== + // Barrel ITK + Gaudi::Property<std::vector<int>> m_BarrelToTThresholdITK + {this, "BarrelToTThresholdITK", {3,3,3,3,3}, "ToT thresholds for barrel pixel layers in ITK"}; + + Gaudi::Property<std::vector<double>> m_BarrelCrossTalkITK + {this, "BarrelCrossTalkITK", {0.06,0.06,0.06,0.06,0.06}, "Cross-talk fraction of barrel pixel layers in ITK"}; + + Gaudi::Property<std::vector<double>> m_BarrelNoiseOccupancyITK + {this, "BarrelNoiseOccupancyITK", {5e-8,5e-8,5e-8,5e-8,5e-8}, "Noise occupancy of barrel pixel layers in ITK"}; + + Gaudi::Property<std::vector<double>> m_BarrelDisableProbabilityITK + {this, "BarrelDisableProbabilityITK", {9e-3,9e-3,9e-3,9e-3,9e-3}, "Disable probability of barrel pixel layers in ITK"}; + + // This is ad-hoc solution. + Gaudi::Property<std::vector<float>> m_InnermostNoiseShapeITK + {this, "InnermostNoiseShapeITK", {0.0,1.0}, "Noise shape for IBL in ITK"}; + + Gaudi::Property<std::vector<float>> m_NextInnermostNoiseShapeITK + {this, "NextInnermostNoiseShapeITK", {0.0,1.0}, "Noise shape for b-layer in ITK"}; + + Gaudi::Property<std::vector<float>> m_PixelNoiseShapeITK + {this, "PixelNoiseShapeITK", {0.0,1.0}, "Noise shape for PIXEL in ITK"}; + + // Endcap ITK + Gaudi::Property<std::vector<int>> m_EndcapToTThresholdITK + {this, "EndcapToTThresholdITK", {3,3,3,3,3,3,3,3,3,3,3,3,3,3}, "ToT thresholds for endcap pixel layers in ITK"}; + + Gaudi::Property<std::vector<double>> m_EndcapCrossTalkITK + {this, "EndcapCrossTalkITK", {0.06,0.06,0.06,0.06,0.06,0.06,0.06,0.06,0.06,0.06,0.06,0.06,0.06,0.06}, "Cross-talk fraction of barrel endcap layers in ITK"}; + + Gaudi::Property<std::vector<double>> m_EndcapNoiseOccupancyITK + {this, "EndcapNoiseOccupancyITK", {5e-8,5e-8,5e-8,5e-8,5e-8,5e-8,5e-8,5e-8,5e-8,5e-8,5e-8,5e-8,5e-8,5e-8}, "Noise occupancy of endcap pixel layers in ITK"}; + + Gaudi::Property<std::vector<double>> m_EndcapDisableProbabilityITK + {this, "EndcapDisableProbabilityITK", {9e-3,9e-3,9e-3,9e-3,9e-3,9e-3,9e-3,9e-3,9e-3,9e-3,9e-3,9e-3,9e-3,9e-3}, "Disable probability of endcap pixel layers in ITK"}; + + //==================================================================================== + // The following parameters are default values which will be overwritten by the one + // from the conditions DB. Otherwise the DB is not retrieved nor available, these + // values are used. + //==================================================================================== Gaudi::Property<std::vector<int>> m_BarrelAnalogThreshold - {this, "DefaultBarrelAnalogThreshold", {2000,4300,3500,3500}, "Default analog thresholds of barrel pixel layers"}; + {this, "DefaultBarrelAnalogThreshold", {-1,-1,-1,-1}, "Default analog thresholds of barrel pixel layers"}; Gaudi::Property<std::vector<int>> m_EndcapAnalogThreshold - {this, "DefaultEndcapAnalogThreshold", {3500,3500,3500}, "Default analog thresholds of endcap pixel layers"}; + {this, "DefaultEndcapAnalogThreshold", {-1,-1,-1}, "Default analog thresholds of endcap pixel layers"}; Gaudi::Property<std::vector<int>> m_DBMAnalogThreshold - {this, "DefaultDBMAnalogThreshold", {2000,2000,2000}, "Default analog thresholds of DBMlayers"}; + {this, "DefaultDBMAnalogThreshold", {-1,-1,-1}, "Default analog thresholds of DBMlayers"}; Gaudi::Property<std::vector<int>> m_BarrelAnalogThresholdSigma {this, "DefaultBarrelAnalogThresholdSigma", {45,35,30,30}, "Default analog threshold sigma of barrel pixel layers"}; @@ -129,24 +531,6 @@ class PixelConfigCondAlg : public AthReentrantAlgorithm { Gaudi::Property<std::vector<int>> m_DBMInTimeThreshold {this, "DefaultDBMInTimeThreshold", {1200,1200,1200}, "Default in-time thresholds of DBM pixel layers"}; - Gaudi::Property<std::vector<int>> m_BarrelToTThreshold - {this, "BarrelToTThreshold", {-1, 3, 5, 5}, "Default ToT thresholds for barrel pixel layers"}; - - Gaudi::Property<std::vector<int>> m_EndcapToTThreshold - {this, "EndcapToTThreshold", { 5, 5, 5}, "Default ToT thresholds for endcap pixel layers"}; - - Gaudi::Property<std::vector<int>> m_DBMToTThreshold - {this, "DBMToTThreshold", {-1,-1,-1}, "Default ToT thresholds for DBM layers"}; - - Gaudi::Property<std::vector<double>> m_BarrelCrossTalk - {this, "BarrelCrossTalk", {0.06,0.06,0.06,0.06}, "Cross-talk fraction of barrel pixel layers"}; - - Gaudi::Property<std::vector<double>> m_EndcapCrossTalk - {this, "EndcapCrossTalk", {0.06,0.06,0.06}, "Cross-talk fraction of barrel endcap layers"}; - - Gaudi::Property<std::vector<double>> m_DBMCrossTalk - {this, "DBMCrossTalk", {0.06,0.06,0.06}, "Cross-talk fraction of barrel DBM layers"}; - Gaudi::Property<std::vector<double>> m_BarrelThermalNoise {this, "BarrelThermalNoise", {160.0,160.0,160.0,160.0}, "Thermal noise of barrel pixel layers"}; @@ -156,79 +540,12 @@ class PixelConfigCondAlg : public AthReentrantAlgorithm { Gaudi::Property<std::vector<double>> m_DBMThermalNoise {this, "DBMThermalNoise", {160.0,160.0,160.0}, "Thermal noise of DBM layers"}; - Gaudi::Property<std::vector<double>> m_BarrelNoiseOccupancy - {this, "BarrelNoiseOccupancy", {5e-8,5e-8,5e-8,5e-8}, "Noise occupancy of barrel pixel layers"}; - - Gaudi::Property<std::vector<double>> m_EndcapNoiseOccupancy - {this, "EndcapNoiseOccupancy", {5e-8,5e-8,5e-8}, "Noise occupancy of endcap pixel layers"}; - - Gaudi::Property<std::vector<double>> m_DBMNoiseOccupancy - {this, "DBMNoiseOccupancy", {5e-8,5e-8,5e-8}, "Noise occupancy of DBM layers"}; - - Gaudi::Property<std::vector<double>> m_BarrelDisableProbability - {this, "BarrelDisableProbability", {9e-3,9e-3,9e-3,9e-3}, "Disable probability of barrel pixel layers"}; - - Gaudi::Property<std::vector<double>> m_EndcapDisableProbability - {this, "EndcapDisableProbability", {9e-3,9e-3,9e-3}, "Disable probability of endcap pixel layers"}; - - Gaudi::Property<std::vector<double>> m_DBMDisableProbability - {this, "DBMDisableProbability", {9e-3,9e-3,9e-3}, "Disable probability of DBM pixel layers"}; - -// -// So far, Gaudi::Property does not support 2D vector. -// -// Gaudi::Property<std::vector<std::vector<float>>> m_BarrelNoiseShape -// {this, "BarrelNoiseShape", {{0.0,1.0},{0.0,1.0},{0.0,1.0},{0.0,1.0}}, "Noise shape of barrel pixel layers"}; - -// Gaudi::Property<std::vector<std::vector<float>>> m_EndcapNoiseShape -// {this, "EndcapNoiseShape", {{0.0,1.0},{0.0,1.0},{0.0,1.0}}, "Noise shape of endcap pixel layers"}; - -// Gaudi::Property<std::vector<std::vector<float>>> m_DBMNoiseShape -// {this, "DBMNoiseShape", {{0.0,1.0},{0.0,1.0},{0.0,1.0}}, "Noise shape of DBM pixel layers"}; - - Gaudi::Property<std::vector<int>> m_FEI3BarrelLatency - {this, "FEI3BarrelLatency", { 0,151,256,256}, "FEI3 latency for barrel pixel layers"}; - - Gaudi::Property<std::vector<int>> m_FEI3EndcapLatency - {this, "FEI3EndcapLatency", {256,256,256}, "FEI3 latency for endcap pixel layers"}; - - Gaudi::Property<std::vector<bool>> m_FEI3BarrelHitDuplication - {this, "FEI3BarrelHitDuplication", {false,false,false,false}, "Use FEI3 hit-duplicaiton for barrel pixel layers"}; - - Gaudi::Property<std::vector<bool>> m_FEI3EndcapHitDuplication - {this, "FEI3EndcapHitDuplication", {false,false,false}, "Use FEI3 hit-duplicaiton for endcap pixel layers"}; - - Gaudi::Property<std::vector<int>> m_FEI3BarrelSmallHitToT - {this, "FEI3BarrelSmallHitToT", {-1,-1,-1,-1}, "Small hit ToT thresold for FEI3 hit-duplication of barrel pixel layers"}; - - Gaudi::Property<std::vector<int>> m_FEI3EndcapSmallHitToT - {this, "FEI3EndcapSmallHitToT", {-1,-1,-1}, "Small hit ToT thresold for FEI3 hit-duplication of endcap pixel layers"}; - - Gaudi::Property<std::vector<int>> m_FEI3BarrelTimingSimTune - {this, "FEI3BarrelTimingSimTune", {2015,2015,2015,2015}, "FEI3 timing tuning set of barrel pixel layers"}; - - Gaudi::Property<std::vector<int>> m_FEI3EndcapTimingSimTune - {this, "FEI3EndcapTimingSimTune", {2015,2015,2015}, "FEI3 timing tuning set of endcap pixel layers"}; - Gaudi::Property<std::vector<int>> m_FEI4BarrelHitDiscConfig {this, "FEI4BarrelHitDiscConfig", {2}, "Set HitDiscConfig parameter for barrel pixel layers"}; Gaudi::Property<std::vector<int>> m_FEI4EndcapHitDiscConfig {this, "FEI4EndcapHitDiscConfig", {2}, "Set HitDiscConfig parameter for endcap pixel layers"}; - std::vector<float> m_IBLNoiseShape; // This is ad-hoc solution. - std::vector<float> m_BLayerNoiseShape; - std::vector<float> m_PixelNoiseShape; - - SG::ReadHandleKey<ComTime> m_ComTimeKey - {this, "ComTimeKey", "ComTime", "Commissioning time for cosmic"}; - - SG::ReadCondHandleKey<CondAttrListCollection> m_readDeadMapKey - {this, "ReadDeadMapKey", "/PIXEL/PixMapOverlay", "Input key of deadmap conditions folder"}; - - SG::WriteCondHandleKey<PixelModuleData> m_writeKey - {this, "WriteKey", "PixelModuleData", "Output key of pixel module data"}; - // Charge calibration parameters Gaudi::Property<float> m_CalibrationParameterA {this, "DefaultCalibrationParameterA", 70.2, "Default charge calibration parameter A"}; @@ -246,13 +563,6 @@ class PixelConfigCondAlg : public AthReentrantAlgorithm { Gaudi::Property<float> m_temperature {this, "DefaultTemperature", -7.0, "Default temperature in Celcius"}; - // Cabling parameters - Gaudi::Property<bool> m_cablingMapToFile - {this, "CablingMapToFile", false, "Dump pixel cabling map into file"}; - - Gaudi::Property<std::string> m_cablingMapFileName - {this, "CablingMapFileName", "PixelCabling/Pixels_Atlas_IdMapping_2016.dat", "Read cabling map from file"}; - // Distortion parameters /** @brief Flag controlling how module distortions are taken into account: case 0 -----> No distorsions implemented; @@ -294,6 +604,13 @@ class PixelConfigCondAlg : public AthReentrantAlgorithm { Gaudi::Property<std::string> m_distortionFileName {this, "DistortionFileName", "PixelSurveyDistortions.txt","Read distortions from this file"}; + // Cabling parameters + Gaudi::Property<bool> m_cablingMapToFile + {this, "CablingMapToFile", false, "Dump pixel cabling map into file"}; + + Gaudi::Property<std::string> m_cablingMapFileName + {this, "CablingMapFileName", "PixelCabling/Pixels_Atlas_IdMapping_2016.dat", "Read cabling map from file"}; + ServiceHandle<ICondSvc> m_condSvc{this, "CondSvc", "CondSvc"}; }; diff --git a/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/share/testFlagged.py b/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/share/testFlagged.py new file mode 100644 index 0000000000000000000000000000000000000000..2c8242ffd39de50277b8e3d3f1393cc3eaa5f0d9 --- /dev/null +++ b/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/share/testFlagged.py @@ -0,0 +1,104 @@ +import AthenaCommon.AtlasUnixStandardJob + +# Setup logger +from AthenaCommon.Logging import logging +msg = logging.getLogger("testBSError") +msg.setLevel(logging.INFO) + +#-------------------------------------------------------------- +# Thread-specific setup +#-------------------------------------------------------------- +from AthenaCommon.ConcurrencyFlags import jobproperties +numThreads = jobproperties.ConcurrencyFlags.NumThreads() +if numThreads > 0: + from AthenaCommon.AlgScheduler import AlgScheduler + AlgScheduler.CheckDependencies( True ) + AlgScheduler.ShowControlFlow( True ) + AlgScheduler.ShowDataDependencies( True ) + +# use auditors +from AthenaCommon.AppMgr import ServiceMgr +from GaudiSvc.GaudiSvcConf import AuditorSvc +ServiceMgr += AuditorSvc() +theAuditorSvc = ServiceMgr.AuditorSvc +theAuditorSvc.Auditors += ["ChronoAuditor"] +theAuditorSvc.Auditors += ["MemStatAuditor"] +theApp.AuditAlgorithms=True + + +#-------------------------------------------------------------- +# Load Geometry +#-------------------------------------------------------------- +from AthenaCommon.GlobalFlags import globalflags +globalflags.DetDescrVersion="ATLAS-R2-2016-01-00-01" +globalflags.DetGeo="atlas" +globalflags.InputFormat="pool" +globalflags.DataSource="data" +msg.info(globalflags) + +#-------------------------------------------------------------- +# Set Detector setup +#-------------------------------------------------------------- +# --- switch on InnerDetector +from AthenaCommon.DetFlags import DetFlags +DetFlags.ID_setOff() +DetFlags.Calo_setOff() +DetFlags.Muon_setOff() +DetFlags.Truth_setOff() +DetFlags.LVL1_setOff() +DetFlags.SCT_setOn() + +# ---- switch parts of ID off/on as follows +#switch off tasks +DetFlags.pileup.all_setOff() +DetFlags.simulate.all_setOff() +DetFlags.makeRIO.all_setOff() +DetFlags.writeBS.all_setOff() +DetFlags.readRDOBS.all_setOff() +DetFlags.readRIOBS.all_setOff() +DetFlags.readRIOPool.all_setOff() +DetFlags.writeRIOPool.all_setOff() + + + +import AtlasGeoModel.SetGeometryVersion +import AtlasGeoModel.GeoModelInit + +from AthenaCommon.AlgSequence import AlgSequence + +job = AlgSequence() + +#-------------------------------------------------------------- +# Load IOVDbSvc +#-------------------------------------------------------------- + +IOVDbSvc = Service("IOVDbSvc") +from IOVDbSvc.CondDB import conddb +IOVDbSvc.GlobalTag="CONDBR2-BLKPA-2018-03" + +from SCT_ConditionsTools.SCT_FlaggedConditionToolSetup import SCT_FlaggedConditionToolSetup +sct_FlaggedConditionToolSetup = SCT_FlaggedConditionToolSetup() +sct_FlaggedConditionToolSetup.setup() +SCT_FlaggedConditionTool = sct_FlaggedConditionToolSetup.getTool() + +SCT_FlaggedConditionTool.OutputLevel=DEBUG + +from SCT_ConditionsAlgorithms.SCT_ConditionsAlgorithmsConf import SCT_FlaggedConditionTestAlg +job+= SCT_FlaggedConditionTestAlg(FlaggedConditionTool=SCT_FlaggedConditionTool) + +from AthenaCommon.AthenaCommonFlags import athenaCommonFlags +if numThreads >= 2: + from SCT_ConditionsAlgorithms.SCTCondAlgCardinality import sctCondAlgCardinality + sctCondAlgCardinality.set(numThreads) + job.SCT_FlaggedConditionTestAlg.Cardinality = numThreads + +import AthenaPoolCnvSvc.ReadAthenaPool +from PoolSvc.PoolSvcConf import PoolSvc +ServiceMgr += PoolSvc() + +athenaCommonFlags.FilesInput = [ "./ESD.pool.root" ] +ServiceMgr.EventSelector.InputCollections = athenaCommonFlags.FilesInput.get_Value() + +theApp.EvtMax = -1 + +ServiceMgr.MessageSvc.Format = "% F%50W%S%7W%R%T %0W%M" diff --git a/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/src/SCT_FlaggedConditionTestAlg.cxx b/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/src/SCT_FlaggedConditionTestAlg.cxx new file mode 100644 index 0000000000000000000000000000000000000000..9671e1a4c05d9e0232f3ed080af201536207d473 --- /dev/null +++ b/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/src/SCT_FlaggedConditionTestAlg.cxx @@ -0,0 +1,47 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +/** + * @file SCT_FlaggedConditionTestAlg.cxx + * + * @brief Class to test SCT_FlaggedConditionTool (implementation) + * + * @author Susumu.Oda@cern.ch + **/ + +#include "SCT_FlaggedConditionTestAlg.h" + +SCT_FlaggedConditionTestAlg::SCT_FlaggedConditionTestAlg(const std::string& name, ISvcLocator* pSvcLocator) : + AthReentrantAlgorithm(name, pSvcLocator) { +} + +//Initialize +StatusCode SCT_FlaggedConditionTestAlg::initialize() { + ATH_MSG_INFO("Calling initialize"); + + // Retrieve flagged condition tool + ATH_CHECK(m_flaggedTool.retrieve()); + + return StatusCode::SUCCESS; +} + +//Execute +StatusCode SCT_FlaggedConditionTestAlg::execute(const EventContext& ctx) const { + ATH_MSG_INFO("Calling execute"); + + ATH_MSG_ALWAYS("------------------------------------------------------------"); + ATH_MSG_ALWAYS(" numBadIds " << m_flaggedTool->numBadIds(ctx)); + const SCT_FlaggedCondData* badIds{m_flaggedTool->getBadIds(ctx)}; + for (const std::pair<IdentifierHash, std::string>& badId : *badIds) { + ATH_MSG_ALWAYS(" Wafer hash " << badId.first << " reason " << badId.second); + } + + return StatusCode::SUCCESS; +} + +//Finalize +StatusCode SCT_FlaggedConditionTestAlg::finalize() { + ATH_MSG_INFO("Calling finalize"); + return StatusCode::SUCCESS; +} diff --git a/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/src/SCT_FlaggedConditionTestAlg.h b/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/src/SCT_FlaggedConditionTestAlg.h new file mode 100644 index 0000000000000000000000000000000000000000..9e7df0ba4f594b320dea1b935090ceb955e2d307 --- /dev/null +++ b/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/src/SCT_FlaggedConditionTestAlg.h @@ -0,0 +1,41 @@ +// -*- C++ -*- + +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +/** + * @file SCT_FlaggedConditionTestAlg.h + * + * @brief Class to test SCT_FlaggedConditionTool (header) + * + * @author Susumu.Oda@cern.ch + **/ + +#ifndef SCT_FlaggedConditionTestAlg_H +#define SCT_FlaggedConditionTestAlg_H + +//Athena +#include "AthenaBaseComps/AthReentrantAlgorithm.h" + +#include "SCT_ConditionsTools//ISCT_FlaggedConditionTool.h" + +//Gaudi +#include "GaudiKernel/ToolHandle.h" + +class SCT_FlaggedConditionTestAlg : public AthReentrantAlgorithm { + public: + SCT_FlaggedConditionTestAlg(const std::string& name, ISvcLocator* pSvcLocator); + virtual ~SCT_FlaggedConditionTestAlg() = default; + + virtual StatusCode initialize() override; + virtual StatusCode execute(const EventContext& ctx) const override; + virtual StatusCode finalize() override; + /** Make this algorithm clonable. */ + virtual bool isClonable() const override { return true; }; + + private: + ToolHandle<ISCT_FlaggedConditionTool> m_flaggedTool{this, "FlaggedConditionTool", "InDetSCT_FlaggedConditionTool", "Tool to retrieve SCT flagged condition"}; +}; + +#endif // SCT_FlaggedConditionTestAlg_H diff --git a/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/src/components/SCT_ConditionsAlgorithms_entries.cxx b/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/src/components/SCT_ConditionsAlgorithms_entries.cxx index 58928ac93b78130ff8c31abb90362219395ef6e7..f64c33a7826e71af30bde65b24d5c3811f19ecf1 100644 --- a/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/src/components/SCT_ConditionsAlgorithms_entries.cxx +++ b/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/src/components/SCT_ConditionsAlgorithms_entries.cxx @@ -10,6 +10,7 @@ #include "../SCT_DCSConditionsTempCondAlg.h" #include "../SCT_DCSConditionsTestAlg.h" #include "../SCT_DetectorElementCondAlg.h" +#include "../SCT_FlaggedConditionTestAlg.h" #include "../SCT_LinkMaskingCondAlg.h" #include "../SCT_LinkMaskingTestAlg.h" #include "../SCT_MajorityCondAlg.h" @@ -47,6 +48,7 @@ DECLARE_COMPONENT( SCT_DCSConditionsStatCondAlg ) DECLARE_COMPONENT( SCT_DCSConditionsTempCondAlg ) DECLARE_COMPONENT( SCT_DCSConditionsTestAlg ) DECLARE_COMPONENT( SCT_DetectorElementCondAlg ) +DECLARE_COMPONENT( SCT_FlaggedConditionTestAlg ) DECLARE_COMPONENT( SCT_LinkMaskingCondAlg ) DECLARE_COMPONENT( SCT_LinkMaskingTestAlg ) DECLARE_COMPONENT( SCT_MajorityCondAlg ) diff --git a/InnerDetector/InDetConditions/SiPropertiesTool/src/SiliconProperties.cxx b/InnerDetector/InDetConditions/SiPropertiesTool/src/SiliconProperties.cxx index b0619a7f1343d4a39aa79c23486d0e51ad0cb9ba..3aee0f1ba61870d50b5c654f1c58b2abc82ad20b 100644 --- a/InnerDetector/InDetConditions/SiPropertiesTool/src/SiliconProperties.cxx +++ b/InnerDetector/InDetConditions/SiPropertiesTool/src/SiliconProperties.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "SiPropertiesTool/SiliconProperties.h" @@ -22,7 +22,7 @@ const double SiliconProperties::s_ehPairsPerEnergyDefault = 1. / (3.62 * CLHEP:: // Constants used in the formula const double elecHallFactZero = 1.13; const double elecHallFact_drdt = 8e-4; -const double elecV_sat_0 = 1.53e9 * CLHEP::cm/CLHEP::s; +const double elecV_sat_0 = 1.43e9 * CLHEP::cm/CLHEP::s; // This number was corrected by ATL-INDET-PUB-2018-001 const double elecV_sat_exp = -0.87; const double elecE_crit_0 = 1.01 * CLHEP::volt/CLHEP::cm; const double elecE_crit_exp = 1.55; diff --git a/InnerDetector/InDetDigitization/PixelDigitization/python/PixelDigitizationConfig.py b/InnerDetector/InDetDigitization/PixelDigitization/python/PixelDigitizationConfig.py index fbe378f9f5028586ec0a296b617a9b90a074fb93..9616e6c23a20473870d3b61d08366c6c25899c77 100644 --- a/InnerDetector/InDetDigitization/PixelDigitization/python/PixelDigitizationConfig.py +++ b/InnerDetector/InDetDigitization/PixelDigitization/python/PixelDigitizationConfig.py @@ -5,6 +5,7 @@ from __future__ import print_function from AthenaCommon import CfgMgr from Digitization.DigitizationFlags import digitizationFlags from AtlasGeoModel.InDetGMJobProperties import InDetGeometryFlags +from AthenaCommon.DetFlags import DetFlags # The earliest bunch crossing time for which interactions will be sent # to the Pixel Digitization code. @@ -115,9 +116,6 @@ def BasicPixelDigitizationTool(name="PixelDigitizationTool", **kwargs): from AthenaCommon.AlgSequence import AthSequencer condSeq = AthSequencer("AthCondSeq") - from RecExConfig.AutoConfiguration import GetRunNumber - runNum = GetRunNumber() - ################# # Module status # ################# @@ -165,137 +163,168 @@ def BasicPixelDigitizationTool(name="PixelDigitizationTool", **kwargs): PixelConfigCondAlg.DBMTimeOffset=[5.0,5.0,5.0] PixelConfigCondAlg.BunchSpace=25.0 - - # RUN-1 and beginning of RUN-2(2015) - if (runNum<284500): - PixelConfigCondAlg.BarrelToTThreshold=[-1,3,3,3] - PixelConfigCondAlg.EndcapToTThreshold=[3,3,3] - PixelConfigCondAlg.FEI3BarrelLatency=[-1,256,256,256] - PixelConfigCondAlg.FEI3EndcapLatency=[256,256,256] - PixelConfigCondAlg.FEI3BarrelHitDuplication=[True,True,True,True] - PixelConfigCondAlg.FEI3EndcapHitDuplication=[True,True,True] - PixelConfigCondAlg.FEI3BarrelSmallHitToT=[-1,7,7,7] - PixelConfigCondAlg.FEI3EndcapSmallHitToT=[7,7,7] - PixelConfigCondAlg.FEI3BarrelTimingSimTune=[2015,2015,2015,2015] - PixelConfigCondAlg.FEI3EndcapTimingSimTune=[2015,2015,2015] - PixelConfigCondAlg.FEI4BarrelHitDiscConfig=[0] - - # mc16a and mc16c (2016) - elif (runNum<300000): - PixelConfigCondAlg.BarrelToTThreshold=[-1,5,5,5] - PixelConfigCondAlg.EndcapToTThreshold=[5,5,5] - PixelConfigCondAlg.FEIBarrelLatency=[-1,151,256,256] - PixelConfigCondAlg.FEIEndcapLatency=[256,256,256] - PixelConfigCondAlg.FEI3BarrelHitDuplication=[False,False,False,False] - PixelConfigCondAlg.FEI3EndcapHitDuplication=[False,False,False] - PixelConfigCondAlg.FEI3BarrelSmallHitToT=[-1, -1, -1, -1] - PixelConfigCondAlg.FEI3EndcapSmallHitToT=[-1, -1, -1] - PixelConfigCondAlg.FEI3BarrelTimingSimTune=[2015,2015,2015,2015] - PixelConfigCondAlg.FEI3EndcapTimingSimTune=[2015,2015,2015] - PixelConfigCondAlg.FEI4BarrelHitDiscConfig=[2] - - # mc16d (2017) - elif (runNum<310000): - PixelConfigCondAlg.BarrelToTThreshold=[-1,5,5,5] - PixelConfigCondAlg.EndcapToTThreshold=[5,5,5] - PixelConfigCondAlg.FEIBarrelLatency=[-1,151,256,256] - PixelConfigCondAlg.FEIEndcapLatency=[256,256,256] - PixelConfigCondAlg.FEI3BarrelHitDuplication=[False,False,False,False] - PixelConfigCondAlg.FEI3EndcapHitDuplication=[False,False,False] - PixelConfigCondAlg.FEI3BarrelSmallHitToT=[-1, -1, -1, -1] - PixelConfigCondAlg.FEI3EndcapSmallHitToT=[-1, -1, -1] - PixelConfigCondAlg.FEI3BarrelTimingSimTune=[2018,2018,2018,2018] - PixelConfigCondAlg.FEI3EndcapTimingSimTune=[2018,2018,2018] - PixelConfigCondAlg.FEI4BarrelHitDiscConfig=[2] - - # mc16e (2018) - else: - PixelConfigCondAlg.BarrelToTThreshold=[-1,3,5,5] - PixelConfigCondAlg.EndcapToTThreshold=[5,5,5] - PixelConfigCondAlg.FEIBarrelLatency=[-1,151,256,256] - PixelConfigCondAlg.FEIEndcapLatency=[256,256,256] - PixelConfigCondAlg.FEI3BarrelHitDuplication=[False,False,False,False] - PixelConfigCondAlg.FEI3EndcapHitDuplication=[False,False,False] - PixelConfigCondAlg.FEI3BarrelSmallHitToT=[-1, -1, -1, -1] - PixelConfigCondAlg.FEI3EndcapSmallHitToT=[-1, -1, -1] - PixelConfigCondAlg.FEI3BarrelTimingSimTune=[2018,2018,2018,2018] - PixelConfigCondAlg.FEI3EndcapTimingSimTune=[2018,2018,2018] - PixelConfigCondAlg.FEI4BarrelHitDiscConfig=[2] - - - PixelConfigCondAlg.BarrelAnalogThreshold=[-1,-1,-1,-1] - PixelConfigCondAlg.BarrelCrossTalk=[0.06,0.06,0.06,0.06] - PixelConfigCondAlg.BarrelThermalNoise=[160.0,160.0,160.0,160.0] - PixelConfigCondAlg.BarrelNoiseOccupancy=[5e-8,5e-8,5e-8,5e-8] - PixelConfigCondAlg.BarrelDisableProbability=[9e-3,9e-3,9e-3,9e-3] - - PixelConfigCondAlg.IBLNoiseShape=[0.0, 0.0330, 0.0, 0.2696, 0.1993, 0.1741, 0.1652, 0.1506, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0078] - PixelConfigCondAlg.BLayerNoiseShape=[0.0, 0.0, 0.0, 0.0, 0.2204, 0.5311, 0.7493, 0.8954, 0.9980, 1.0] - PixelConfigCondAlg.PixelNoiseShape=[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.2418, 0.4397, 0.5858, 0.6949, 0.7737, 0.8414, 0.8959, 0.9414, 0.9828, 1.0] - # Layer-2 noise shape [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.2129, 0.4016, 0.5477, 0.6599, 0.7435, 0.8160, 0.8779, 0.9340, 0.9798, 1.0] - - PixelConfigCondAlg.EndcapAnalogThreshold=[-1,-1,-1,] - PixelConfigCondAlg.EndcapCrossTalk=[0.06,0.06,0.06] - PixelConfigCondAlg.EndcapThermalNoise=[160.0,160.0,160.0] - PixelConfigCondAlg.EndcapNoiseOccupancy=[5e-8,5e-8,5e-8] - PixelConfigCondAlg.EndcapDisableProbability=[9e-3,9e-3,9e-3] - PixelConfigCondAlg.EndcapNoiseShape=[[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.1748, 0.3409, 0.4760, 0.5850, 0.6754, 0.7538, 0.8264, 0.8962, 0.9655, 1.0], - [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.1852, 0.3528, 0.4881, 0.5961, 0.6855, 0.7640, 0.8374, 0.9068, 0.9749, 1.0], - [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.1735, 0.3380, 0.4733, 0.5829, 0.6730, 0.7516, 0.8234, 0.8916, 0.9595, 1.0]] - - PixelConfigCondAlg.DBMAnalogThreshold=[-1,-1,-1] - PixelConfigCondAlg.DBMToTThreshold=[-1,-1,-1] - PixelConfigCondAlg.DBMCrossTalk=[0.06,0.06,0.06] - PixelConfigCondAlg.DBMThermalNoise=[160.0,160.0,160.0] - PixelConfigCondAlg.DBMNoiseOccupancy=[5e-8,5e-8,5e-8] - PixelConfigCondAlg.DBMDisableProbability=[9e-3,9e-3,9e-3] - PixelConfigCondAlg.DBMNoiseShape=[[0.0,1.0],[0.0,1.0],[0.0,1.0]] - PixelConfigCondAlg.FEI4EndcapHitDiscConfig=[2,2,2] + PixelConfigCondAlg.FEI4BarrelHitDiscConfig=[2] + + #==================================================================================== + # Run-dependent SIMULATION(digitization) parameters: + #==================================================================================== + # RUN2 2015/2016 + PixelConfigCondAlg.BarrelToTThreshold2016 = [ -1, 5, 5, 5] + PixelConfigCondAlg.FEI3BarrelLatency2016 = [ 0, 151, 256, 256] + PixelConfigCondAlg.FEI3BarrelHitDuplication2016 = [False,False,False,False] + PixelConfigCondAlg.FEI3BarrelSmallHitToT2016 = [ -1, -1, -1, -1] + PixelConfigCondAlg.FEI3BarrelTimingSimTune2016 = [ -1, 2015, 2015, 2015] + PixelConfigCondAlg.BarrelCrossTalk2016 = [ 0.30, 0.06, 0.06, 0.06] + PixelConfigCondAlg.BarrelNoiseOccupancy2016 = [ 5e-8, 5e-8, 5e-8, 5e-8] + PixelConfigCondAlg.BarrelDisableProbability2016 = [ 9e-3, 9e-3, 9e-3, 9e-3] + + PixelConfigCondAlg.EndcapToTThreshold2016 = [ 5, 5, 5] + PixelConfigCondAlg.FEI3EndcapLatency2016 = [ 256, 256, 256] + PixelConfigCondAlg.FEI3EndcapHitDuplication2016 = [False,False,False] + PixelConfigCondAlg.FEI3EndcapSmallHitToT2016 = [ -1, -1, -1] + PixelConfigCondAlg.FEI3EndcapTimingSimTune2016 = [ 2015, 2015, 2015] + PixelConfigCondAlg.EndcapCrossTalk2016 = [ 0.06, 0.06, 0.06] + PixelConfigCondAlg.EndcapNoiseOccupancy2016 = [ 5e-8, 5e-8, 5e-8] + PixelConfigCondAlg.EndcapDisableProbability2016 = [ 9e-3, 9e-3, 9e-3] + + PixelConfigCondAlg.DBMToTThreshold2016 = [ -1, -1, -1] + PixelConfigCondAlg.DBMCrossTalk2016 = [ 0.06, 0.06, 0.06] + PixelConfigCondAlg.DBMNoiseOccupancy2016 = [ 5e-8, 5e-8, 5e-8] + PixelConfigCondAlg.DBMDisableProbability2016 = [ 9e-3, 9e-3, 9e-3] + + PixelConfigCondAlg.IBLNoiseShape2016 = [0.0, 0.0330, 0.0, 0.3026, 0.5019, 0.6760, 0.8412, 0.9918, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0] + PixelConfigCondAlg.BLayerNoiseShape2016 = [0.0, 0.0, 0.0, 0.0, 0.2204, 0.5311, 0.7493, 0.8954, 0.9980, 1.0] + PixelConfigCondAlg.PixelNoiseShape2016 = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.2418, 0.4397, 0.5858, 0.6949, 0.7737, 0.8414, 0.8959, 0.9414, 0.9828, 1.0] + # Layer-2 noise shape [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.2129, 0.4016, 0.5477, 0.6599, 0.7435, 0.8160, 0.8779, 0.9340, 0.9798, 1.0] + + # So far, Gaudi::Property does not support 2D vector. + #PixelConfigCondAlg.EndcapNoiseShape=[[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.1748, 0.3409, 0.4760, 0.5850, 0.6754, 0.7538, 0.8264, 0.8962, 0.9655, 1.0], + # [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.1852, 0.3528, 0.4881, 0.5961, 0.6855, 0.7640, 0.8374, 0.9068, 0.9749, 1.0], + # [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.1735, 0.3380, 0.4733, 0.5829, 0.6730, 0.7516, 0.8234, 0.8916, 0.9595, 1.0]] + + #==================================================================================== + # RUN2 2017 + PixelConfigCondAlg.BarrelToTThreshold2017 = [ -1, 5, 5, 5] + PixelConfigCondAlg.FEI3BarrelLatency2017 = [ 0, 151, 256, 256] + PixelConfigCondAlg.FEI3BarrelHitDuplication2017 = [False,False,False,False] + PixelConfigCondAlg.FEI3BarrelSmallHitToT2017 = [ -1, -1, -1, -1] + PixelConfigCondAlg.FEI3BarrelTimingSimTune2017 = [ -1, 2018, 2018, 2018] + PixelConfigCondAlg.BarrelCrossTalk2017 = [ 0.30, 0.06, 0.06, 0.06] + PixelConfigCondAlg.BarrelNoiseOccupancy2017 = [ 5e-8, 5e-8, 5e-8, 5e-8] + PixelConfigCondAlg.BarrelDisableProbability2017 = [ 9e-3, 9e-3, 9e-3, 9e-3] + + PixelConfigCondAlg.EndcapToTThreshold2017 = [ 5, 5, 5] + PixelConfigCondAlg.FEI3EndcapLatency2017 = [ 256, 256, 256] + PixelConfigCondAlg.FEI3EndcapHitDuplication2017 = [False,False,False] + PixelConfigCondAlg.FEI3EndcapSmallHitToT2017 = [ -1, -1, -1] + PixelConfigCondAlg.FEI3EndcapTimingSimTune2017 = [ 2018, 2018, 2018] + PixelConfigCondAlg.EndcapCrossTalk2017 = [ 0.06, 0.06, 0.06] + PixelConfigCondAlg.EndcapNoiseOccupancy2017 = [ 5e-8, 5e-8, 5e-8] + PixelConfigCondAlg.EndcapDisableProbability2017 = [ 9e-3, 9e-3, 9e-3] + + PixelConfigCondAlg.DBMToTThreshold2017 = [ -1, -1, -1] + PixelConfigCondAlg.DBMCrossTalk2017 = [ 0.06, 0.06, 0.06] + PixelConfigCondAlg.DBMNoiseOccupancy2017 = [ 5e-8, 5e-8, 5e-8] + PixelConfigCondAlg.DBMDisableProbability2017 = [ 9e-3, 9e-3, 9e-3] + + PixelConfigCondAlg.IBLNoiseShape2017 = [0.0, 0.0330, 0.0, 0.3026, 0.5019, 0.6760, 0.8412, 0.9918, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0] + PixelConfigCondAlg.BLayerNoiseShape2017 = [0.0, 0.0, 0.0, 0.0, 0.2204, 0.5311, 0.7493, 0.8954, 0.9980, 1.0] + PixelConfigCondAlg.PixelNoiseShape2017 = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.2418, 0.4397, 0.5858, 0.6949, 0.7737, 0.8414, 0.8959, 0.9414, 0.9828, 1.0] + + #==================================================================================== + # RUN2 2018 + PixelConfigCondAlg.BarrelToTThreshold2018 = [ -1, 3, 5, 5] + PixelConfigCondAlg.FEI3BarrelLatency2018 = [ 0, 151, 256, 256] + PixelConfigCondAlg.FEI3BarrelHitDuplication2018 = [False,False,False,False] + PixelConfigCondAlg.FEI3BarrelSmallHitToT2018 = [ -1, -1, -1, -1] + PixelConfigCondAlg.FEI3BarrelTimingSimTune2018 = [ -1, 2018, 2018, 2018] + PixelConfigCondAlg.BarrelCrossTalk2018 = [ 0.30, 0.06, 0.06, 0.06] + PixelConfigCondAlg.BarrelNoiseOccupancy2018 = [ 5e-8, 5e-8, 5e-8, 5e-8] + PixelConfigCondAlg.BarrelDisableProbability2018 = [ 9e-3, 9e-3, 9e-3, 9e-3] + + PixelConfigCondAlg.EndcapToTThreshold2018 = [ 5, 5, 5] + PixelConfigCondAlg.FEI3EndcapLatency2018 = [ 256, 256, 256] + PixelConfigCondAlg.FEI3EndcapHitDuplication2018 = [False,False,False] + PixelConfigCondAlg.FEI3EndcapSmallHitToT2018 = [ -1, -1, -1] + PixelConfigCondAlg.FEI3EndcapTimingSimTune2018 = [ 2018, 2018, 2018] + PixelConfigCondAlg.EndcapCrossTalk2018 = [ 0.06, 0.06, 0.06] + PixelConfigCondAlg.EndcapNoiseOccupancy2018 = [ 5e-8, 5e-8, 5e-8] + PixelConfigCondAlg.EndcapDisableProbability2018 = [ 9e-3, 9e-3, 9e-3] + + PixelConfigCondAlg.DBMToTThreshold2018 = [ -1, -1, -1] + PixelConfigCondAlg.DBMCrossTalk2018 = [ 0.06, 0.06, 0.06] + PixelConfigCondAlg.DBMNoiseOccupancy2018 = [ 5e-8, 5e-8, 5e-8] + PixelConfigCondAlg.DBMDisableProbability2018 = [ 9e-3, 9e-3, 9e-3] + + PixelConfigCondAlg.IBLNoiseShape2018 = [0.0, 0.0330, 0.0, 0.3026, 0.5019, 0.6760, 0.8412, 0.9918, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0] + PixelConfigCondAlg.BLayerNoiseShape2018 = [0.0, 0.0, 0.0, 0.0, 0.2204, 0.5311, 0.7493, 0.8954, 0.9980, 1.0] + PixelConfigCondAlg.PixelNoiseShape2018 = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.2418, 0.4397, 0.5858, 0.6949, 0.7737, 0.8414, 0.8959, 0.9414, 0.9828, 1.0] + + #==================================================================================== + # RUN1 + PixelConfigCondAlg.BarrelToTThresholdRUN1 = [ 3, 3, 3] + PixelConfigCondAlg.FEI3BarrelLatencyRUN1 = [ 256, 256, 256] + PixelConfigCondAlg.FEI3BarrelHitDuplicationRUN1 = [ True, True, True] + PixelConfigCondAlg.FEI3BarrelSmallHitToTRUN1 = [ 7, 7, 7] + PixelConfigCondAlg.FEI3BarrelTimingSimTuneRUN1 = [ 2009, 2009, 2009] + PixelConfigCondAlg.BarrelCrossTalkRUN1 = [ 0.06, 0.06, 0.06] + PixelConfigCondAlg.BarrelNoiseOccupancyRUN1 = [ 5e-8, 5e-8, 5e-8] + PixelConfigCondAlg.BarrelDisableProbabilityRUN1 = [ 9e-3, 9e-3, 9e-3] + + PixelConfigCondAlg.EndcapToTThresholdRUN1 = [ 3, 3, 3] + PixelConfigCondAlg.FEI3EndcapLatencyRUN1 = [ 256, 256, 256] + PixelConfigCondAlg.FEI3EndcapHitDuplicationRUN1 = [ True, True, True] + PixelConfigCondAlg.FEI3EndcapSmallHitToTRUN1 = [ 7, 7, 7] + PixelConfigCondAlg.FEI3EndcapTimingSimTuneRUN1 = [ 2009, 2009, 2009] + PixelConfigCondAlg.EndcapCrossTalkRUN1 = [ 0.06, 0.06, 0.06] + PixelConfigCondAlg.EndcapNoiseOccupancyRUN1 = [ 5e-8, 5e-8, 5e-8] + PixelConfigCondAlg.EndcapDisableProbabilityRUN1 = [ 9e-3, 9e-3, 9e-3] + + PixelConfigCondAlg.BLayerNoiseShapeRUN1 = [0.0, 0.0, 0.0, 0.0, 0.2204, 0.5311, 0.7493, 0.8954, 0.9980, 1.0] + PixelConfigCondAlg.PixelNoiseShapeRUN1 = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.2418, 0.4397, 0.5858, 0.6949, 0.7737, 0.8414, 0.8959, 0.9414, 0.9828, 1.0] + + #==================================================================================== + # ITK + PixelConfigCondAlg.BarrelToTThresholdITK = [ 3, 3, 3, 3, 3] + PixelConfigCondAlg.BarrelCrossTalkITK = [ 0.06, 0.06, 0.06, 0.06, 0.06] + PixelConfigCondAlg.BarrelNoiseOccupancyITK = [ 5e-8, 5e-8, 5e-8, 5e-8, 5e-8] + PixelConfigCondAlg.BarrelDisableProbabilityITK = [ 9e-3, 9e-3, 9e-3, 9e-3, 9e-3] + + PixelConfigCondAlg.EndcapToTThresholdITK = [ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3] + PixelConfigCondAlg.EndcapCrossTalkITK = [ 0.06, 0.06, 0.06, 0.06, 0.06, 0.06, 0.06, 0.06, 0.06, 0.06, 0.06, 0.06, 0.06, 0.06] + PixelConfigCondAlg.EndcapNoiseOccupancyITK = [ 5e-8, 5e-8, 5e-8, 5e-8, 5e-8, 5e-8, 5e-8, 5e-8, 5e-8, 5e-8, 5e-8, 5e-8, 5e-8, 5e-8] + PixelConfigCondAlg.EndcapDisableProbabilityITK = [ 9e-3, 9e-3, 9e-3, 9e-3, 9e-3, 9e-3, 9e-3, 9e-3, 9e-3, 9e-3, 9e-3, 9e-3, 9e-3, 9e-3] + + PixelConfigCondAlg.InnermostNoiseShapeITK = [0.0, 1.0] + PixelConfigCondAlg.NextInnermostNoiseShapeITK = [0.0, 1.0] + PixelConfigCondAlg.PixelNoiseShapeITK = [0.0, 1.0] + IdMappingDat="PixelCabling/Pixels_Atlas_IdMapping_2016.dat" - rodIDForSingleLink40=0 - if globalflags.DataSource() == 'geant4': - # ITk: - if geoFlags.isSLHC(): - IdMappingDat = "ITk_Atlas_IdMapping.dat" - if "BrlIncl4.0_ref" == commonGeoFlags.GeoType(): - IdMappingDat = "ITk_Atlas_IdMapping_InclBrl4.dat" - elif "IBrlExt4.0ref" == commonGeoFlags.GeoType(): - IdMappingDat = "ITk_Atlas_IdMapping_IExtBrl4.dat" - elif "BrlExt4.0_ref" == commonGeoFlags.GeoType(): - IdMappingDat = "ITk_Atlas_IdMapping_ExtBrl4.dat" - elif "BrlExt3.2_ref" == commonGeoFlags.GeoType(): - IdMappingDat = "ITk_Atlas_IdMapping_ExtBrl32.dat" - elif (geoFlags.isIBL() == False): - IdMappingDat="PixelCabling/Pixels_Atlas_IdMapping.dat" - else: - # Planar IBL - if (geoFlags.IBLLayout() == "planar"): - if (geoFlags.isDBM() == True): - IdMappingDat="PixelCabling/Pixels_Atlas_IdMapping_inclIBL_DBM.dat" - else: - IdMappingDat="PixelCabling/Pixels_Atlas_IdMapping_inclIBL.dat" - # Hybrid IBL plus DBM - elif (geoFlags.IBLLayout() == "3D"): - IdMappingDat="PixelCabling/Pixels_Atlas_IdMapping_Run2.dat" - elif globalflags.DataSource == 'data': # for data overlay - if (runNum<222222): - IdMappingDat="PixelCabling/Pixels_Atlas_IdMapping_May08.dat" - rodIDForSingleLink40=1300000 - else: - PixelConfigCondAlg.UseCablingConditions = True - rodIDForSingleLink40=1300000 - # Even though we are reading from COOL, set the correct fallback map. - if (runNum >= 344494): - IdMappingDat="PixelCabling/Pixels_Atlas_IdMapping_344494.dat" - elif (runNum >= 314940 and runNum < 344494): - IdMappingDat="PixelCabling/Pixels_Atlas_IdMapping_314940.dat" - elif (runNum >= 289350 and runNum < 314940): # 2016 - IdMappingDat="PixelCabling/Pixels_Atlas_IdMapping_2016.dat" - elif (runNum >= 222222 and runNum < 289350): # 2015 - IdMappingDat="PixelCabling/Pixels_Atlas_IdMapping_Run2.dat" + + # ITk: + if geoFlags.isSLHC(): + IdMappingDat = "ITk_Atlas_IdMapping.dat" + if "BrlIncl4.0_ref" == commonGeoFlags.GeoType(): + IdMappingDat = "ITk_Atlas_IdMapping_InclBrl4.dat" + elif "IBrlExt4.0ref" == commonGeoFlags.GeoType(): + IdMappingDat = "ITk_Atlas_IdMapping_IExtBrl4.dat" + elif "BrlExt4.0_ref" == commonGeoFlags.GeoType(): + IdMappingDat = "ITk_Atlas_IdMapping_ExtBrl4.dat" + elif "BrlExt3.2_ref" == commonGeoFlags.GeoType(): + IdMappingDat = "ITk_Atlas_IdMapping_ExtBrl32.dat" + elif (geoFlags.isIBL() == False): + IdMappingDat="PixelCabling/Pixels_Atlas_IdMapping.dat" + else: + # Planar IBL + if (geoFlags.IBLLayout() == "planar"): + if (geoFlags.isDBM() == True): + IdMappingDat="PixelCabling/Pixels_Atlas_IdMapping_inclIBL_DBM.dat" else: - IdMappingDat="PixelCabling/Pixels_Atlas_IdMapping_May08.dat" + IdMappingDat="PixelCabling/Pixels_Atlas_IdMapping_inclIBL.dat" + # Hybrid IBL plus DBM + elif (geoFlags.IBLLayout() == "3D"): + IdMappingDat="PixelCabling/Pixels_Atlas_IdMapping_Run2.dat" PixelConfigCondAlg.CablingMapFileName=IdMappingDat @@ -374,7 +403,7 @@ def BasicPixelDigitizationTool(name="PixelDigitizationTool", **kwargs): from PixelConditionsAlgorithms.PixelConditionsAlgorithmsConf import PixelCablingCondAlg condSeq += PixelCablingCondAlg(name="PixelCablingCondAlg", MappingFile=IdMappingDat, - RodIDForSingleLink40=rodIDForSingleLink40) + RodIDForSingleLink40=0) if not conddb.folderRequested("/PIXEL/PixReco"): conddb.addFolder("PIXEL_OFL", "/PIXEL/PixReco", className="DetCondCFloat") diff --git a/InnerDetector/InDetDigitization/PixelDigitization/src/FEI3SimTool.cxx b/InnerDetector/InDetDigitization/PixelDigitization/src/FEI3SimTool.cxx index fbfc8f6af30b8e5472fcf3706076244f5d72e3d3..7ed6809a66f56d73d46b5963bda6bd4ce47b34a5 100644 --- a/InnerDetector/InDetDigitization/PixelDigitization/src/FEI3SimTool.cxx +++ b/InnerDetector/InDetDigitization/PixelDigitization/src/FEI3SimTool.cxx @@ -107,7 +107,8 @@ void FEI3SimTool::process(SiChargedDiodeCollection &chargedDiodes,PixelRDO_Colle if (charge>threshold) { int bunchSim = 0; if (diode.totalCharge().fromTrack()) { - if (moduleData->getFEI3TimingSimTune(barrel_ec,layerIndex)==2015) { bunchSim = relativeBunch2015(diode.totalCharge(),barrel_ec,layerIndex,moduleIndex, rndmEngine); } + if (moduleData->getFEI3TimingSimTune(barrel_ec,layerIndex)==2018) { bunchSim = relativeBunch2018(diode.totalCharge(),barrel_ec,layerIndex,moduleIndex, rndmEngine); } + else if (moduleData->getFEI3TimingSimTune(barrel_ec,layerIndex)==2015) { bunchSim = relativeBunch2015(diode.totalCharge(),barrel_ec,layerIndex,moduleIndex, rndmEngine); } else if (moduleData->getFEI3TimingSimTune(barrel_ec,layerIndex)==2009) { bunchSim = relativeBunch2009(threshold,intimethreshold,diode.totalCharge(), rndmEngine); } } else { diff --git a/InnerDetector/InDetEventCnv/InDetEventTPCnv/src/PixelClusterContainerCnv_p2.cxx b/InnerDetector/InDetEventCnv/InDetEventTPCnv/src/PixelClusterContainerCnv_p2.cxx index a69582b243a9b25b349471057e2c00f4e0c2a083..65de22842c21c04b303cff8e9624e2cf8ce9e93b 100644 --- a/InnerDetector/InDetEventCnv/InDetEventTPCnv/src/PixelClusterContainerCnv_p2.cxx +++ b/InnerDetector/InDetEventCnv/InDetEventTPCnv/src/PixelClusterContainerCnv_p2.cxx @@ -34,19 +34,19 @@ void PixelClusterContainerCnv_p2::transToPers(const InDet::PixelClusterContainer // 2) all PRD // // The persistent collections, then only maintain indexes into the - // container's vector of all channels. + // container's vector of all channels. // // So here we loop over all collection and add their channels // to the container's vector, saving the indexes in the - // collection. + // collection. typedef InDet::PixelClusterContainer TRANS; - + // this is the id of the latest collection read in // This starts from the base of the TRT identifiers unsigned int idLast(0); - // + // PixelClusterCnv_p2 chanCnv; TRANS::const_iterator it_Coll = transCont->begin(); TRANS::const_iterator it_CollEnd = transCont->end(); @@ -63,13 +63,13 @@ void PixelClusterContainerCnv_p2::transToPers(const InDet::PixelClusterContainer InDet::InDetPRD_Collection_p2& pcollection = persCont->m_collections[collIndex]; unsigned int deltaId = (collection.identifyHash()-idLast); // unsigned int deltaId = (collection.identify().get_compact()-idLast)/IDJUMP; - // if(deltaId*IDJUMP != collection.identify().get_compact()-idLast ) + // if(deltaId*IDJUMP != collection.identify().get_compact()-idLast ) // log << MSG::FATAL << "THere is a mistake in Identifiers of the collection" << endmsg; // if(deltaId > 0xFFFF) { // log << MSG::FATAL << "Fixme!!! This is too big, something needs to be done " << endmsg; // } // pcollection.m_idDelta = (unsigned short) deltaId; - // idLast = collection.identify().get_compact(); // then update the last identifier + // idLast = collection.identify().get_compact(); // then update the last identifier pcollection.m_hashId = deltaId; idLast=collection.identifyHash(); pcollection.m_size = collection.size(); @@ -85,7 +85,7 @@ void PixelClusterContainerCnv_p2::transToPers(const InDet::PixelClusterContainer // if (log.level() <= MSG::DEBUG) log << MSG::DEBUG << " *** Writing InDet::PixelClusterContainer" << endmsg; } -void PixelClusterContainerCnv_p2::persToTrans(const InDet::PixelClusterContainer_p2* persCont, InDet::PixelClusterContainer* transCont, MsgStream &log) +void PixelClusterContainerCnv_p2::persToTrans(const InDet::PixelClusterContainer_p2* persCont, InDet::PixelClusterContainer* transCont, MsgStream &log) { // The transient model has a container holding collections and the @@ -97,7 +97,7 @@ void PixelClusterContainerCnv_p2::persToTrans(const InDet::PixelClusterContaine // 2) all channels // // The persistent collections, then only maintain indexes into the - // container's vector of all channels. + // container's vector of all channels. // // So here we loop over all collection and extract their channels // from the vector. @@ -124,7 +124,7 @@ void PixelClusterContainerCnv_p2::persToTrans(const InDet::PixelClusterContaine // Create trans collection - in NOT owner of PixelDriftCircle (SG::VIEW_ELEMENTS) // IDet collection don't have the Ownership policy c'tor - const InDet::InDetPRD_Collection_p2& pcoll = persCont->m_collections[icoll]; + const InDet::InDetPRD_Collection_p2& pcoll = persCont->m_collections[icoll]; idLast += pcoll.m_hashId; // Identifier collID= Identifier(idLast); IdentifierHash collIDHash=IdentifierHash((unsigned int) idLast); @@ -142,7 +142,7 @@ void PixelClusterContainerCnv_p2::persToTrans(const InDet::PixelClusterContaine const InDet::PixelCluster_p2* pchan = &(persCont->m_rawdata[ichan + collBegin]); InDet::PixelCluster* chan = new InDet::PixelCluster(); chanCnv.persToTrans(pchan, chan, log); - chan->m_detEl = de; + chan->setDetectorElement(de); // DC Bugfix: Set the hash index! chan->setHashAndIndex(collIDHash, ichan); (*coll)[ichan] = chan; @@ -200,7 +200,7 @@ StatusCode PixelClusterContainerCnv_p2::initialize(MsgStream &log) { if (sc.isFailure()) { log << MSG::FATAL << "DetectorStore service not found !" << endmsg; return StatusCode::FAILURE; - } + } // else { // if (log.level() <= MSG::DEBUG) log << MSG::DEBUG << "Found DetectorStore." << endmsg; // } @@ -210,7 +210,7 @@ StatusCode PixelClusterContainerCnv_p2::initialize(MsgStream &log) { if (sc.isFailure()) { log << MSG::FATAL << "Could not get PixelID helper !" << endmsg; return StatusCode::FAILURE; - } + } // else { // if (log.level() <= MSG::DEBUG) log << MSG::DEBUG << "Found the PixelID helper." << endmsg; // } diff --git a/InnerDetector/InDetExample/InDetRecExample/share/InDetRecConditionsAccess.py b/InnerDetector/InDetExample/InDetRecExample/share/InDetRecConditionsAccess.py index 333dad0ae1bedf67cac77bdc183896bef158f2e5..ed37fd74e2f838ab6dc119fa7a8f79ca972b659f 100644 --- a/InnerDetector/InDetExample/InDetRecExample/share/InDetRecConditionsAccess.py +++ b/InnerDetector/InDetExample/InDetRecExample/share/InDetRecConditionsAccess.py @@ -103,7 +103,7 @@ if DetFlags.pixel_on(): elif (runNum >= 222222 and runNum < 289350): # 2015 IdMappingDat="PixelCabling/Pixels_Atlas_IdMapping_Run2.dat" else: - IdMappingDat="PixelCabling/Pixels_Atlas_IdMapping_May08.dat" + IdMappingDat="PixelCabling/Pixels_Atlas_IdMapping_344494.dat" condSeq += PixelConfigCondAlg(name="PixelConfigCondAlg", UseDeadmapConditions=(not athenaCommonFlags.isOnline()), diff --git a/InnerDetector/InDetExample/InDetTrigRecExample/python/InDetTrigConfigConditions.py b/InnerDetector/InDetExample/InDetTrigRecExample/python/InDetTrigConfigConditions.py index 01112979ea9d538940bdcc5341f7057f5fe12c35..1ff103dde5d954a21722ced454c7e3ffb7f21d3c 100644 --- a/InnerDetector/InDetExample/InDetTrigRecExample/python/InDetTrigConfigConditions.py +++ b/InnerDetector/InDetExample/InDetTrigRecExample/python/InDetTrigConfigConditions.py @@ -124,7 +124,7 @@ class PixelConditionsServicesSetup: elif (runNum >= 222222 and runNum < 289350): # 2015 IdMappingDat="PixelCabling/Pixels_Atlas_IdMapping_Run2.dat" else: - IdMappingDat="PixelCabling/Pixels_Atlas_IdMapping_May08.dat" + IdMappingDat="PixelCabling/Pixels_Atlas_IdMapping_344494.dat" condSeq += PixelConfigCondAlg(name="PixelConfigCondAlg", UseDeadmapConditions=self.usePixMap, diff --git a/InnerDetector/InDetRecEvent/InDetPrepRawData/InDetPrepRawData/SiCluster.h b/InnerDetector/InDetRecEvent/InDetPrepRawData/InDetPrepRawData/SiCluster.h index 9ab9ee26308fbefbb96c8ee3157f1d10902193d2..bd2f5242e2fc2bf1535bdc9619de70a95090fab0 100755 --- a/InnerDetector/InDetRecEvent/InDetPrepRawData/InDetPrepRawData/SiCluster.h +++ b/InnerDetector/InDetRecEvent/InDetPrepRawData/InDetPrepRawData/SiCluster.h @@ -15,14 +15,11 @@ #define TRKPREPRAWDATA_SICLUSTER_H // Base class -#include "TrkPrepRawData/PrepRawData.h" - -#include "CxxUtils/CachedUniquePtr.h" #include "Identifier/Identifier.h" #include "InDetPrepRawData/SiWidth.h" #include "InDetReadoutGeometry/SiDetectorElement.h" // cant be forward declared +#include "TrkPrepRawData/PrepRawData.h" #include "TrkSurfaces/Surface.h" - #include <memory> class PixelClusterContainerCnv; @@ -36,7 +33,7 @@ class SCT_ClusterContainerCnv_p0; class SCT_ClusterContainerCnv_p1; class SiClusterCnv_p1; -namespace InDet{ +namespace InDet { class SiCluster : public Trk::PrepRawData { @@ -55,21 +52,21 @@ class SiCluster : public Trk::PrepRawData //@} public: - /// Constructor without parameter - SiCluster(); + // Used by TPCnv converters + SiCluster() = default; /// Copy constructor - SiCluster(const SiCluster&); + SiCluster(const SiCluster&) = default; /// Move constructor - SiCluster(SiCluster&&); + SiCluster(SiCluster&&) = default; /// Assignment operator - SiCluster& operator=(const SiCluster&); + SiCluster& operator=(const SiCluster&) = default; /// Move assignment operator - SiCluster& operator=(SiCluster&&); + SiCluster& operator=(SiCluster&&) = default; /** * Constructor with parameters using pointer of Amg::MatrixX. - * Last parameter might not be always filled and will be nullptr by default. - * The others including SiDetectorElement have to be given! + * Last parameter might not be always filled and will be nullptr by + * default. The others including SiDetectorElement have to be given! */ SiCluster(const Identifier& RDOId, const Amg::Vector2D& locpos, @@ -107,7 +104,6 @@ public: /// return the flag of this cluster containing a gangedPixel virtual bool gangedPixel() const; - /// return the detector element corresponding to this PRD /// The pointer will be zero if the det el is not defined (i.e. it was not /// passed in by the ctor) @@ -120,21 +116,27 @@ public: virtual MsgStream& dump(MsgStream& stream) const override; /// dump information about the SiCluster virtual std::ostream& dump(std::ostream& stream) const override; - //@} + //@} + + /// Set the m_detEl and calculate globalPostion + //used by TPCnv converters + void setDetectorElement(const InDetDD::SiDetectorElement* detEl); private: + Amg::Vector3D m_globalPosition = Amg::Vector3D::Zero(); /// col, row, and width in mm - InDet::SiWidth m_width; - /// For lazy initialization CxxUtils::CachedUniquePtr is used. - CxxUtils::CachedUniquePtr<const Amg::Vector3D> m_globalPosition; - bool m_gangedPixel; - const InDetDD::SiDetectorElement* m_detEl; + InDet::SiWidth m_width{}; + ///Not owning points (ownned by the store + const InDetDD::SiDetectorElement* m_detEl = nullptr; + bool m_gangedPixel = false; }; MsgStream& operator<<(MsgStream& stream, const SiCluster& prd); std::ostream& operator<<(std::ostream& stream, const SiCluster& prd); + } + #include "InDetPrepRawData/SiCluster.icc" #endif // TRKPREPRAWDATA_SICLUSTER_H diff --git a/InnerDetector/InDetRecEvent/InDetPrepRawData/InDetPrepRawData/SiCluster.icc b/InnerDetector/InDetRecEvent/InDetPrepRawData/InDetPrepRawData/SiCluster.icc index b15f70e333b98720968d73ea524427278f00a0f6..c9b594495747f113b72e18f406e41aaa60e741ed 100644 --- a/InnerDetector/InDetRecEvent/InDetPrepRawData/InDetPrepRawData/SiCluster.icc +++ b/InnerDetector/InDetRecEvent/InDetPrepRawData/InDetPrepRawData/SiCluster.icc @@ -44,4 +44,15 @@ SiCluster::detectorElement() const return m_detEl; } +inline void +SiCluster::setDetectorElement(const InDetDD::SiDetectorElement* detEl) +{ + m_detEl = detEl; + if (m_detEl) { + m_globalPosition = + m_detEl->surface(identify()).localToGlobalPos(localPosition()); + } +} + + } diff --git a/InnerDetector/InDetRecEvent/InDetPrepRawData/src/SiCluster.cxx b/InnerDetector/InDetRecEvent/InDetPrepRawData/src/SiCluster.cxx index 03f781da266e3783628cf35efaa3522015636383..c26c78aa068e634bedd810dfbee899d9b7b3383e 100755 --- a/InnerDetector/InDetRecEvent/InDetPrepRawData/src/SiCluster.cxx +++ b/InnerDetector/InDetRecEvent/InDetPrepRawData/src/SiCluster.cxx @@ -14,168 +14,112 @@ #include "InDetPrepRawData/SiCluster.h" #include "GaudiKernel/MsgStream.h" -namespace InDet{ - +namespace InDet { // Constructor for EF: -SiCluster::SiCluster( - const Identifier &RDOId, - const Amg::Vector2D& locpos, - const std::vector<Identifier>& rdoList, - const InDet::SiWidth& width, - const InDetDD::SiDetectorElement* detEl, - const Amg::MatrixX* locErrMat - ) : - PrepRawData(RDOId, locpos, rdoList, locErrMat), //call base class constructor - m_width(width), - m_globalPosition{}, - m_gangedPixel(0), - m_detEl(detEl) {} - -SiCluster::SiCluster( - const Identifier &RDOId, - const Amg::Vector2D& locpos, - std::vector<Identifier>&& rdoList, - const InDet::SiWidth& width, - const InDetDD::SiDetectorElement* detEl, - std::unique_ptr<const Amg::MatrixX> locErrMat - ) : - PrepRawData(RDOId, locpos, - std::move(rdoList), - std::move(locErrMat)), //call base class constructor - m_width(width), - m_globalPosition{}, - m_gangedPixel(0), - m_detEl(detEl) {} +SiCluster::SiCluster(const Identifier& RDOId, + const Amg::Vector2D& locpos, + const std::vector<Identifier>& rdoList, + const InDet::SiWidth& width, + const InDetDD::SiDetectorElement* detEl, + const Amg::MatrixX* locErrMat) + : // call base class constructor + PrepRawData(RDOId, locpos, rdoList, locErrMat) + , m_width(width) + , m_detEl(detEl) + , m_gangedPixel(false) +{ + if (m_detEl) { + m_globalPosition = + m_detEl->surface(identify()).localToGlobalPos(localPosition()); + } +} + +SiCluster::SiCluster(const Identifier& RDOId, + const Amg::Vector2D& locpos, + std::vector<Identifier>&& rdoList, + const InDet::SiWidth& width, + const InDetDD::SiDetectorElement* detEl, + std::unique_ptr<const Amg::MatrixX> locErrMat) + : // call base class constructor + PrepRawData(RDOId, locpos, std::move(rdoList), std::move(locErrMat)) + , m_width(width) + , m_detEl(detEl) + , m_gangedPixel(false) +{ + if (m_detEl) { + m_globalPosition = + m_detEl->surface(identify()).localToGlobalPos(localPosition()); + } +} // Destructor: SiCluster::~SiCluster() { - // do not delete m_detEl since owned by DetectorStore + // do not delete m_detEl since owned by DetectorStore } -// Default constructor: -SiCluster::SiCluster(): - PrepRawData(), - m_globalPosition{}, - m_gangedPixel(0), - m_detEl(0) -{} - -//copy constructor: -SiCluster::SiCluster(const SiCluster& RIO): - PrepRawData( RIO ), - m_width( RIO.m_width ), - m_globalPosition{}, - m_gangedPixel( RIO.m_gangedPixel ), - m_detEl( RIO.m_detEl ) +MsgStream& +SiCluster::dump(MsgStream& stream) const { - // copy only if it exists - if (RIO.m_globalPosition) { - m_globalPosition.store(std::make_unique<Amg::Vector3D>(*RIO.m_globalPosition)); - } -} + stream << "SiCluster object" << std::endl; -//move constructor: -SiCluster::SiCluster(SiCluster&& RIO): - PrepRawData( std::move(RIO) ), - m_width( std::move(RIO.m_width) ), - m_globalPosition( std::move(RIO.m_globalPosition) ), - m_gangedPixel( RIO.m_gangedPixel ), - m_detEl( RIO.m_detEl ) + // have to do a lot of annoying checking to make sure that PRD is valid. + { + stream << "at global coordinates (x,y,z) = (" << this->globalPosition().x() + << ", " << this->globalPosition().y() << ", " + << this->globalPosition().z() << ")" << std::endl; + } -{ -} + if (gangedPixel()) { + stream << "and is a ganged pixel. " << std::endl; + } else { + stream << "and is not a ganged pixel. " << std::endl; + } -//assignment operator -SiCluster& SiCluster::operator=(const SiCluster& RIO){ - if (&RIO !=this) { - Trk::PrepRawData::operator= (RIO); - m_width = RIO.m_width; - if (RIO.m_globalPosition) { - m_globalPosition.store(std::make_unique<Amg::Vector3D>(*RIO.m_globalPosition)); - } else if (m_globalPosition) { - m_globalPosition.release().reset(); - } - m_gangedPixel = RIO.m_gangedPixel; - m_detEl = RIO.m_detEl ; - } - return *this; -} - -//move operator -SiCluster& SiCluster::operator=(SiCluster&& RIO){ - if (&RIO !=this) { - Trk::PrepRawData::operator= (std::move(RIO)); - m_width = RIO.m_width; - m_globalPosition = std::move(RIO.m_globalPosition); - m_gangedPixel = RIO.m_gangedPixel; - m_detEl = RIO.m_detEl ; - } - return *this; -} - -MsgStream& SiCluster::dump( MsgStream& stream) const -{ - stream << "SiCluster object"<<std::endl; - - // have to do a lot of annoying checking to make sure that PRD is valid. - { - stream << "at global coordinates (x,y,z) = ("<<this->globalPosition().x()<<", " - <<this->globalPosition().y()<<", " - <<this->globalPosition().z()<<")"<<std::endl; - } - - if ( gangedPixel()==true ) - { - stream << "and is a ganged pixel. "<<std::endl; - } else { - stream << "and is not a ganged pixel. "<<std::endl; - } - - stream << "SiWidth: " << m_width << std::endl; - - stream << "Base class (PrepRawData):" << std::endl; - this->PrepRawData::dump(stream); - - return stream; + stream << "SiWidth: " << m_width << std::endl; + + stream << "Base class (PrepRawData):" << std::endl; + this->PrepRawData::dump(stream); + + return stream; } -std::ostream& SiCluster::dump( std::ostream& stream) const +std::ostream& +SiCluster::dump(std::ostream& stream) const { - stream << "SiCluster object"<<std::endl; - { - stream << "at global coordinates (x,y,z) = ("<<this->globalPosition().x()<<", " - <<this->globalPosition().y()<<", " - <<this->globalPosition().z()<<")"<<std::endl; - } - - if ( gangedPixel()==true ) - { - stream << "and is a ganged pixel. "<<std::endl; - } else { - stream << "and is not a ganged pixel. "<<std::endl; - } - - stream << "SiWidth: " << m_width << std::endl; - - stream << "Base Class (PrepRawData): " << std::endl; - this->PrepRawData::dump(stream); - - return stream; -} + stream << "SiCluster object" << std::endl; + { + stream << "at global coordinates (x,y,z) = (" << this->globalPosition().x() + << ", " << this->globalPosition().y() << ", " + << this->globalPosition().z() << ")" << std::endl; + } + + if (gangedPixel()) { + stream << "and is a ganged pixel. " << std::endl; + } else { + stream << "and is not a ganged pixel. " << std::endl; + } + + stream << "SiWidth: " << m_width << std::endl; + stream << "Base Class (PrepRawData): " << std::endl; + this->PrepRawData::dump(stream); - MsgStream& operator << (MsgStream& stream, const SiCluster& prd) - { - return prd.dump(stream); - } + return stream; +} - std::ostream& operator << (std::ostream& stream, const SiCluster& prd) - { - return prd.dump(stream); - } +MsgStream& +operator<<(MsgStream& stream, const SiCluster& prd) +{ + return prd.dump(stream); +} +std::ostream& +operator<<(std::ostream& stream, const SiCluster& prd) +{ + return prd.dump(stream); +} -}//end of ns +} // end of ns diff --git a/InnerDetector/InDetRecTools/InDetRecToolInterfaces/InDetRecToolInterfaces/ISecVertexInJetFinder.h b/InnerDetector/InDetRecTools/InDetRecToolInterfaces/InDetRecToolInterfaces/ISecVertexInJetFinder.h index 2eeac8364243621dba5c70ed92e90b53b776ae69..2eae42fbf6b69f0c68b3151f7b52eacd6fa7d12a 100755 --- a/InnerDetector/InDetRecTools/InDetRecToolInterfaces/InDetRecToolInterfaces/ISecVertexInJetFinder.h +++ b/InnerDetector/InDetRecTools/InDetRecToolInterfaces/InDetRecToolInterfaces/ISecVertexInJetFinder.h @@ -60,10 +60,7 @@ public: return IID_ISecVertexInJetFinder; }; - virtual Trk::VxSecVertexInfo* findSecVertex(const Trk::RecVertex & primaryVertex, - const TLorentzVector & jetMomentum, - const std::vector<const Trk::TrackParticleBase*> & inputTracks) const=0; - + virtual Trk::VxSecVertexInfo* findSecVertex(const xAOD::Vertex & primaryVertex, const TLorentzVector & jetMomentum, const std::vector<const xAOD::IParticle*> & inputTracks) const=0; diff --git a/InnerDetector/InDetRecTools/InDetVKalVxInJetTool/InDetVKalVxInJetTool/InDetTrkInJetType.h b/InnerDetector/InDetRecTools/InDetVKalVxInJetTool/InDetVKalVxInJetTool/InDetTrkInJetType.h index cd8d96797cd8df71efca75d73a43d9a69c23e705..ab46437ce1cc24e5eabd5182aefc6740405a7ac5 100644 --- a/InnerDetector/InDetRecTools/InDetVKalVxInJetTool/InDetVKalVxInJetTool/InDetTrkInJetType.h +++ b/InnerDetector/InDetRecTools/InDetVKalVxInJetTool/InDetVKalVxInJetTool/InDetTrkInJetType.h @@ -10,9 +10,13 @@ 0 - Heavy Flavour (Signal) 1 - Fragmentation tracks (Fragment) 2 - Garbage (Interactions+V0s+Pileup) + The corresponding weights are returned as vector<float> with track type ordering. + Multiclass TMVA is used for classification, then wgt[0]+wgt[1]+wgt[2]=1 always. - The tool works for JetPt<2.5TeV. - Tool is trained using ttbar+Z'(1.5,3,5TeV)+JZ4,5,6 samples + The tool works (calibrated) for 35GeV<JetPt<3.5TeV. + Jets above 3.5TeV and below 35GeV are considered as having 3.5TeV and 35GeV correspondingly. + The tool is trained using ttbar+Z'(2.5,5TeV)+JZ4,6,8 + Gbb7000 samples + The tool uses trkPt vs JetAxis (no any dR cone cut!) therefore the tool can be used for any jet with "reasonable" dR size. Author: Vadim Kostyukhin e-mail: vadim.kostyukhin@cern.ch @@ -32,7 +36,6 @@ class IChronoStatSvc; namespace Rec{ class TrackParticle; } namespace MVAUtils { class BDT; } namespace Trk { class TrkVKalVrtFitter; } -namespace TMVA { class Reader; } namespace InDet { @@ -73,9 +76,8 @@ namespace InDet { private: - TMVA::Reader* m_tmvaReader{}; - MVAUtils::BDT* m_localBDT{}; - IChronoStatSvc * m_timingProfile{}; + std::unique_ptr<MVAUtils::BDT> m_trkClassBDT; + IChronoStatSvc* m_timingProfile{}; int m_trkSctHitsCut{}; int m_trkPixelHitsCut{}; diff --git a/InnerDetector/InDetRecTools/InDetVKalVxInJetTool/InDetVKalVxInJetTool/InDetVKalVxInJetTool.h b/InnerDetector/InDetRecTools/InDetVKalVxInJetTool/InDetVKalVxInJetTool/InDetVKalVxInJetTool.h index 9e3c87fe59902fbdcb0779d1530cc3c1c736dcd4..f0a4d274197e8167295f065a0907626251e7ae7a 100755 --- a/InnerDetector/InDetRecTools/InDetVKalVxInJetTool/InDetVKalVxInJetTool/InDetVKalVxInJetTool.h +++ b/InnerDetector/InDetRecTools/InDetVKalVxInJetTool/InDetVKalVxInJetTool/InDetVKalVxInJetTool.h @@ -90,17 +90,7 @@ namespace InDet { std::vector< std::vector<const xAOD::TrackParticle*> > FoundSecondTracks; std::vector<const xAOD::TrackParticle*> TrkFromV0; }; - - struct workVectorArrREC{ - std::vector<const Rec::TrackParticle*> listJetTracks; - std::vector<const Rec::TrackParticle*> tmpListTracks; - std::vector<const Rec::TrackParticle*> listSecondTracks; - std::vector<const Rec::TrackParticle*> TracksForFit; - std::vector<const Rec::TrackParticle*> InpTrk; - std::vector< std::vector<const Rec::TrackParticle*> > FoundSecondTracks; - std::vector<const Rec::TrackParticle*> TrkFromV0; - }; - + class ATLAS_NOT_THREAD_SAFE InDetVKalVxInJetTool : //This tool should not be used in a reentrant algorithm because of the mutable m_NRefPVTrk public AthAlgTool, virtual public ISecVertexInJetFinder{ @@ -115,11 +105,6 @@ namespace InDet { StatusCode initialize(); StatusCode finalize(); - - Trk::VxSecVertexInfo* findSecVertex(const Trk::RecVertex & primaryVertex, - const TLorentzVector & jetMomentum, - const std::vector<const Trk::TrackParticleBase*> & inputTracks) const; - Trk::VxSecVertexInfo* findSecVertex(const xAOD::Vertex & primaryVertex, const TLorentzVector & jetMomentum, const std::vector<const xAOD::IParticle*> & inputTracks) const; @@ -378,18 +363,12 @@ namespace InDet { std::vector<double> & Results, std::vector<const xAOD::TrackParticle*> & SelSecTrk, std::vector<const xAOD::TrackParticle*> & TrkFromV0) const; - xAOD::Vertex* GetVrtSec(const std::vector<const Rec::TrackParticle*> & InpTrk, - const xAOD::Vertex & PrimVrt, - const TLorentzVector & JetDir, - std::vector<double> & Results, - std::vector<const Rec::TrackParticle*> & SelSecTrk, - std::vector<const Rec::TrackParticle*> & TrkFromV0) const; + std::vector<xAOD::Vertex*> GetVrtSecMulti( - workVectorArrxAOD * , - workVectorArrREC * , - const xAOD::Vertex & PrimVrt, - const TLorentzVector & JetDir, - std::vector<double> & Results) const; + workVectorArrxAOD*, + const xAOD::Vertex& PrimVrt, + const TLorentzVector& JetDir, + std::vector<double>& Results) const; void TrackClassification(std::vector<WrkVrt> *WrkVrtSet, std::vector< std::deque<long int> > *TrkInVrt) const; @@ -466,8 +445,6 @@ namespace InDet { const Trk::Perigee* GetPerigee( const xAOD::TrackParticle* ) const; - const Trk::Perigee* GetPerigee( const Rec::TrackParticle* ) const; - std::vector<const Trk::Perigee*> GetPerigeeVector( const std::vector<const Rec::TrackParticle*>& ) const; std::vector<const Trk::Perigee*> GetPerigeeVector( const std::vector<const Trk::TrackParticleBase*>& ) const; @@ -512,11 +489,7 @@ namespace InDet { Trk::IVKalState& istate, bool ifCovV0) const; - int SelGoodTrkParticle( const std::vector<const Rec::TrackParticle*>& InpPart, - const xAOD::Vertex & PrimVrt, - const TLorentzVector & JetDir, - std::vector<const Rec::TrackParticle*>& SelPart) const; - int SelGoodTrkParticle( const std::vector<const xAOD::TrackParticle*>& InpPart, + int SelGoodTrkParticle( const std::vector<const xAOD::TrackParticle*>& InpPart, const xAOD::Vertex & PrimVrt, const TLorentzVector & JetDir, std::vector<const xAOD::TrackParticle*>& SelPart) const; @@ -541,7 +514,6 @@ namespace InDet { // // template <class Track> // StatusCode VKalVrtFitFastBase(const std::vector<const Track*>& listPart,Amg::Vector3D& Vertex) const; - StatusCode VKalVrtFitFastBase(const std::vector<const Rec::TrackParticle*>& listPart,Amg::Vector3D& Vertex, Trk::IVKalState& istate) const; StatusCode VKalVrtFitFastBase(const std::vector<const xAOD::TrackParticle*>& listPart,Amg::Vector3D& Vertex, Trk::IVKalState& istate) const; template <class Track> @@ -549,25 +521,12 @@ namespace InDet { template <class Track> bool Check1TrVertexInPixel( const Track* p1, Amg::Vector3D &, std::vector<double> & ) const; - void getPixelLayers(const Rec::TrackParticle* Part, int &blHit, int &l1Hit, int &l2Hit, int &nLay) const; void getPixelLayers(const xAOD::TrackParticle* Part, int &blHit, int &l1Hit, int &l2Hit, int &nLay) const; void getPixelDiscs(const xAOD::TrackParticle* Part, int &d0Hit, int &d1Hit, int &d2Hit) const; - void getPixelDiscs(const Rec::TrackParticle* Part, int &d0Hit, int &d1Hit, int &d2Hit) const; void getPixelProblems(const xAOD::TrackParticle* Part, int &splshIBL, int &splshBL ) const; - void getPixelProblems(const Rec::TrackParticle* Part, int &splshIBL, int &splshBL ) const; - - - StatusCode VKalVrtFitBase(const std::vector<const Rec::TrackParticle*> & listPart, - Amg::Vector3D& Vertex, - TLorentzVector& Momentum, - long int& Charge, - std::vector<double>& ErrorMatrix, - std::vector<double>& Chi2PerTrk, - std::vector< std::vector<double> >& TrkAtVrt, - double& Chi2, - Trk::IVKalState& istate, - bool ifCovV0) const; - StatusCode VKalVrtFitBase(const std::vector<const xAOD::TrackParticle*> & listPart, + + + StatusCode VKalVrtFitBase(const std::vector<const xAOD::TrackParticle*> & listPart, Amg::Vector3D& Vertex, TLorentzVector& Momentum, long int& Charge, @@ -578,10 +537,6 @@ namespace InDet { Trk::IVKalState& istate, bool ifCovV0) const; - const std::vector<const Trk::TrackParticleBase*> - PartToBase(const std::vector<const Rec::TrackParticle*> & listPart) const; - const std::vector<const Rec::TrackParticle*> - BaseToPart(const std::vector<const Trk::TrackParticleBase*> & listBase) const; StatusCode GetTrkFitWeights(std::vector<double> & wgt, const Trk::IVKalState& istate) const; }; diff --git a/InnerDetector/InDetRecTools/InDetVKalVxInJetTool/share/InDetTrkInJetType_test.ref b/InnerDetector/InDetRecTools/InDetVKalVxInJetTool/share/InDetTrkInJetType_test.ref index 77006b3a3a7ec824743897b411fae62eee7b84cf..e72e87c11a6c71b14c80ba6ef6b456548d207453 100644 --- a/InnerDetector/InDetRecTools/InDetVKalVxInJetTool/share/InDetTrkInJetType_test.ref +++ b/InnerDetector/InDetRecTools/InDetVKalVxInJetTool/share/InDetTrkInJetType_test.ref @@ -1,31 +1,24 @@ InDetVKalVxInJetTool/InDetTrkInJetType_test -Initializing Gaudi ApplicationMgr using job opts /sps/atlas/s/schaffer/work/work-21.magFieldSvc_9/build/x86_64-centos7-gcc8-opt/jobOptions/InDetVKalVxInJetTool/InDetVKalVxInJetTool_tests.txt -JobOptionsSvc INFO # =======> /sps/atlas/s/schaffer/work/work-21.magFieldSvc_9/build/x86_64-centos7-gcc8-opt/jobOptions/InDetVKalVxInJetTool/InDetVKalVxInJetTool_tests.txt +Initializing Gaudi ApplicationMgr using job opts /afs/cern.ch/user/v/vkost/Workdir/TRKTYPECALIB/build/x86_64-centos7-gcc8-opt/jobOptions/InDetVKalVxInJetTool/InDetVKalVxInJetTool_tests.txt +JobOptionsSvc INFO # =======> /afs/cern.ch/user/v/vkost/Workdir/TRKTYPECALIB/build/x86_64-centos7-gcc8-opt/jobOptions/InDetVKalVxInJetTool/InDetVKalVxInJetTool_tests.txt JobOptionsSvc INFO # (1,1): ApplicationMgr.ExtSvc += ["StoreGateSvc/ConditionStore", "CondSvc"] -JobOptionsSvc INFO Job options successfully read in from /sps/atlas/s/schaffer/work/work-21.magFieldSvc_9/build/x86_64-centos7-gcc8-opt/jobOptions/InDetVKalVxInJetTool/InDetVKalVxInJetTool_tests.txt +JobOptionsSvc INFO Job options successfully read in from /afs/cern.ch/user/v/vkost/Workdir/TRKTYPECALIB/build/x86_64-centos7-gcc8-opt/jobOptions/InDetVKalVxInJetTool/InDetVKalVxInJetTool_tests.txt ApplicationMgr SUCCESS ==================================================================================================================================== - Welcome to ApplicationMgr (GaudiCoreSvc v27r1p99) - running on karma on Fri Jul 26 11:39:59 2019 + Welcome to ApplicationMgr (GaudiCoreSvc v33r1) + running on lxplus770.cern.ch on Thu Jul 23 09:18:15 2020 ==================================================================================================================================== ApplicationMgr INFO Application Manager Configured successfully -ClassIDSvc INFO getRegistryEntries: read 1912 CLIDRegistry entries for module ALL +ClassIDSvc INFO getRegistryEntries: read 1907 CLIDRegistry entries for module ALL EventLoopMgr WARNING Unable to locate service "EventSelector" EventLoopMgr WARNING No events will be processed from external input. ApplicationMgr INFO Application Manager Initialized successfully ApplicationMgr Ready InDetVKalVxInJetTool/InDetTrkInJetType_test initGaudi InDetVKalVxInJetTool/InDetTrkInJetType_test record -create data set info Default - : Booking "BDTG" of type "BDT" from /cvmfs/atlas.cern.ch/repo/sw/database/GroupData/InDetVKalVxInJetTool/TrackClassif_3cl.v02.xml. - : Reading weight file: /cvmfs/atlas.cern.ch/repo/sw/database/GroupData/InDetVKalVxInJetTool/TrackClassif_3cl.v02.xml -<HEADER> DataSetInfo : [Default] : Added class "Signal" -<HEADER> DataSetInfo : [Default] : Added class "Fragment" -<HEADER> DataSetInfo : [Default] : Added class "Garbage" - : Booked classifier "BDTG" of type: "BDT" -ClassIDSvc INFO getRegistryEntries: read 4267 CLIDRegistry entries for module ALL +ClassIDSvc INFO getRegistryEntries: read 4092 CLIDRegistry entries for module ALL ToolSvc.InDet::... INFO TrkVKalVrtFitter initialize() successful InDetVKalVxInJetTool/InDetTrkInJetType_test retrieve tool test1 diff --git a/InnerDetector/InDetRecTools/InDetVKalVxInJetTool/src/BTagVrtSec.cxx b/InnerDetector/InDetRecTools/InDetVKalVxInJetTool/src/BTagVrtSec.cxx index 1b28eaca35269914d4d07ce8cd0b20005c66fc21..07fa0b38ebb1609902f8105ec886e5f79745523b 100755 --- a/InnerDetector/InDetRecTools/InDetVKalVxInJetTool/src/BTagVrtSec.cxx +++ b/InnerDetector/InDetRecTools/InDetVKalVxInJetTool/src/BTagVrtSec.cxx @@ -56,239 +56,6 @@ namespace InDet{ const double c_vrtBCMassLimit=5500.; // Mass limit to consider a vertex not coming from B,C-decays -//inline double cutNDepNorm(int N, double Prb){return TMath::ChisquareQuantile(1.-sqrt(2.*Prb/(N*N-N)),2.);} - - xAOD::Vertex* InDetVKalVxInJetTool::GetVrtSec(const std::vector<const Rec::TrackParticle*>& InpTrk, - const xAOD::Vertex & PrimVrt, - const TLorentzVector & JetDir, - std::vector<double> & Results, - std::vector<const Rec::TrackParticle*> & ListSecondTracks, - std::vector<const Rec::TrackParticle*> & TrkFromV0) - const - { - - if(msgLvl(MSG::DEBUG))msg(MSG::DEBUG) << "GetVrtSec() called with Rec::TrackParticle=" <<InpTrk.size()<< endmsg; - - std::vector<const Rec::TrackParticle*> SelectedTracks; - SelectedTracks.clear(); - ListSecondTracks.clear(); - Results.clear(); - - m_NRefPVTrk=0; - if( InpTrk.size() < 2 ) { return 0;} // 0,1 track => nothing to do! - - - SelGoodTrkParticle( InpTrk, PrimVrt, JetDir, SelectedTracks); - - long int NTracks = (int) (SelectedTracks.size()); - if(m_fillHist){m_hb_ntrkjet->Fill( (double) NTracks, m_w_1); } - if( NTracks < 2 ) { return 0;} // 0,1 selected track => nothing to do! - - if(msgLvl(MSG::DEBUG))msg(MSG::DEBUG) << "Number of selected tracks inside jet= " <<NTracks << endmsg; - - TLorentzVector MomentumJet = TotalMom(GetPerigeeVector(SelectedTracks)); - if(m_fillHist){m_hb_jmom->Fill( MomentumJet.E(), m_w_1); } - - -//-------------------------------------------------------------------------------------------- -// Initial Rec::TrackParticle list ready - - - std::vector<const Rec::TrackParticle*> TracksForFit; - //std::vector<double> InpMass; for(int i=0; i<NTracks; i++){InpMass.push_back(m_massPi);} - std::vector<double> InpMass(NTracks,m_massPi); - - xAOD::Vertex xaodPrimVrt; xaodPrimVrt.setPosition(PrimVrt.position()); - xaodPrimVrt.setCovariancePosition(PrimVrt.covariancePosition()); - Select2TrVrt(SelectedTracks, TracksForFit, xaodPrimVrt, JetDir, InpMass, - TrkFromV0, ListSecondTracks); - m_WorkArray->m_Incomp.clear(); // Not needed for single vertex version -// -//--- Cleaning -// - if( TrkFromV0.size() > 1) { - RemoveDoubleEntries(TrkFromV0); - AnalysisUtils::Sort::pT (&TrkFromV0); - } -//--- - std::vector<const Rec::TrackParticle*> saveSecondTracks(ListSecondTracks); - double Vrt2TrackNumber = (double) ListSecondTracks.size()/2.; - RemoveDoubleEntries(ListSecondTracks); - AnalysisUtils::Sort::pT (&ListSecondTracks); -//--Ranking of selected tracks - std::vector<float> trkRank(0); - for(auto tk : ListSecondTracks) trkRank.push_back( m_trackClassificator->trkTypeWgts(tk, PrimVrt, JetDir)[0] ); -//--- - if(msgLvl(MSG::DEBUG))msg(MSG::DEBUG)<<" Found different tracks in pairs="<< ListSecondTracks.size()<<endmsg; - if(ListSecondTracks.size() < 2 ) { return 0;} // Less than 2 tracks left - -// -//----------------------------------------------------------------------------------------------------- -// Secondary track list is ready -// Now common vertex fit -// - Amg::Vector3D FitVertex; - std::vector<double> ErrorMatrix; - std::vector< std::vector<double> > TrkAtVrt; - TLorentzVector Momentum; - double Signif3D, Signif3DP=0, Signif3DS=0; - std::vector<double> Impact,ImpactError; - - double Chi2 = FitCommonVrt( ListSecondTracks, trkRank, xaodPrimVrt, JetDir, InpMass, FitVertex, ErrorMatrix, Momentum, TrkAtVrt); -// - if( Chi2 < 0) { return 0; } // Vertex not reconstructed -// -// Check jet tracks not in secondary vertex - std::vector<const Rec::TrackParticle*> AdditionalTracks; - VrtVrtDist(PrimVrt, FitVertex, ErrorMatrix, Signif3D); - if(Signif3D>8.){ - for (auto i_ntrk : SelectedTracks) { - std::vector<const Rec::TrackParticle*>::const_iterator i_found = - find( ListSecondTracks.begin(), ListSecondTracks.end(), i_ntrk); - if( i_found != ListSecondTracks.end() ) continue; - Signif3DS = m_fitSvc->VKalGetImpact(i_ntrk, FitVertex , 1, Impact, ImpactError); - if( Signif3DS > 10.) continue; - Signif3DP = m_fitSvc->VKalGetImpact(i_ntrk, PrimVrt.position(), 1, Impact, ImpactError); - if(m_fillHist){ m_hb_diffPS->Fill( Signif3DP-Signif3DS, m_w_1); } - if(Signif3DP-Signif3DS>1.0) AdditionalTracks.push_back(i_ntrk); - } - } -// -// Add found tracks and refit - if( AdditionalTracks.size() > 0){ - for (auto i_ntrk : AdditionalTracks) ListSecondTracks.push_back(i_ntrk); - trkRank.clear(); - for(auto tk : ListSecondTracks) trkRank.push_back( m_trackClassificator->trkTypeWgts(tk, PrimVrt, JetDir)[0] ); - Chi2 = FitCommonVrt( ListSecondTracks, trkRank, xaodPrimVrt, JetDir, InpMass, FitVertex, ErrorMatrix, Momentum, TrkAtVrt); - if( Chi2 < 0) { return 0; } // Vertex not reconstructed - } -// -// Saving of results -// -// VK 15.10.2007 Wrong idea. Kills high Pt jets -// VK 12.02.2008 Idea correct, implementation was wrong!!! Tracks must have BL hits only if vertex is inside BL!! - if( ListSecondTracks.size()==2 ){ // If there are 2 only tracks - int Charge=0, tCnt=0; - int BLshared=0; - int PXshared=0; - for (auto i_ntrk : ListSecondTracks) { - Charge += (int) i_ntrk->charge(); - const Trk::TrackSummary* testSum = i_ntrk->trackSummary(); - if(testSum){ BLshared += testSum->get(Trk::numberOfBLayerSharedHits); - PXshared += testSum->get(Trk::numberOfPixelSharedHits); } - tCnt++; - } - if(m_useVertexCleaning){ - if(!Check2TrVertexInPixel(ListSecondTracks[0],ListSecondTracks[1],FitVertex,ErrorMatrix)) return 0; - double xDif=FitVertex.x()-m_xLayerB, yDif=FitVertex.y()-m_yLayerB ; - double Dist2D=sqrt(xDif*xDif+yDif*yDif); - if (Dist2D < m_rLayerB) { // Inside B-layer - if(m_fillHist){ if(Charge){m_hb_totmass2T1->Fill(Momentum.M(),m_w_1);}else{m_hb_totmass2T0->Fill(Momentum.M(),m_w_1);} } - if(m_fillHist){ m_hb_blshared->Fill((float)BLshared,m_w_1); } - //if(BLshared>m_cutSharedHits) return 0; - } else if(Dist2D > m_rLayerB) { //Outside b-layer - if(m_fillHist){ m_hb_pxshared->Fill((float)PXshared,m_w_1); } - //if(PXshared>m_cutSharedHits) return 0; - } - } // end of 2tr vertex cleaning code -// - if( !Charge && fabs(Momentum.M()-m_massK0)<15. ) { // Final rejection of K0 - TrkFromV0.push_back(ListSecondTracks[0]); - TrkFromV0.push_back(ListSecondTracks[1]); - if( TrkFromV0.size() > 1) { - RemoveDoubleEntries(TrkFromV0); - AnalysisUtils::Sort::pT (&TrkFromV0); - } - return 0; - } - if(m_fillHist){ m_hb_totmass2T2->Fill(Momentum.M(),m_w_1); } - } - - - double JetVrtDir = - JetDir.Px()*(FitVertex.x()-PrimVrt.x()) - + JetDir.Py()*(FitVertex.y()-PrimVrt.y()) - + JetDir.Pz()*(FitVertex.z()-PrimVrt.z()); - if( m_getNegativeTag ) - { if( JetVrtDir>0. ) return 0; } - else if( m_getNegativeTail ) - { ; } - else - { if( JetVrtDir<0. ) return 0; } - - - double xvt=FitVertex.x(); double yvt=FitVertex.y(); - double Dist2DBP=sqrt( (xvt-m_beampipeX)*(xvt-m_beampipeX) + (yvt-m_beampipeY)*(yvt-m_beampipeY) ); - double Dist2DBL=sqrt( (xvt-m_xLayerB)*(xvt-m_xLayerB) + (yvt-m_yLayerB)*(yvt-m_yLayerB) ); - double Dist2DL1=sqrt( (xvt-m_xLayer1)*(xvt-m_xLayer1) + (yvt-m_yLayer1)*(yvt-m_yLayer1) ); - double Dist2DL2=sqrt( (xvt-m_xLayer2)*(xvt-m_xLayer2) + (yvt-m_yLayer2)*(yvt-m_yLayer2) ); - double minDstMat=39.9; - minDstMat=TMath::Min(minDstMat,fabs(Dist2DBP-m_beampipeR)); - minDstMat=TMath::Min(minDstMat,fabs(Dist2DBL-m_rLayerB)); - minDstMat=TMath::Min(minDstMat,fabs(Dist2DL1-m_rLayer1)); - minDstMat=TMath::Min(minDstMat,fabs(Dist2DL2-m_rLayer2)); - if(m_existIBL) minDstMat=TMath::Min(minDstMat,fabs(Dist2DL2-m_rLayer3)); // 4-layer pixel detector - - VrtVrtDist(PrimVrt, FitVertex, ErrorMatrix, Signif3D); - if(JetVrtDir < 0) Signif3D = -Signif3D; - - Amg::Vector3D DirForPt( FitVertex.x()-PrimVrt.x(), - FitVertex.y()-PrimVrt.y(), - FitVertex.z()-PrimVrt.z()); - Results.push_back(Momentum.M()); //1st - double eRatio = Momentum.E()/MomentumJet.E(); - Results.push_back( eRatio<0.99999 ? eRatio : 0.99999); //2nd - Results.push_back(Vrt2TrackNumber); //3rd - Results.push_back((double)NTracks); //4th - Results.push_back((double)ListSecondTracks.size()); //5th - Results.push_back(Signif3D); //6th - Results.push_back(MomentumJet.E()); //7th - Results.push_back(minDstMat); //8th - double nRatio = Momentum.Et(JetDir.Vect())/sqrt(MomentumJet.Perp()); nRatio /= (nRatio+4.); - Results.push_back( nRatio ); //9th New transverse energy ration - Results.push_back((Momentum.M()-2.*m_massPi)*eRatio/m_massB); //10th "Product" variable - Results.push_back((Momentum.Pt()/Momentum.M())*(m_massB/JetDir.Pt()) ); //11th "Boost" variable - - if(m_fillHist){ - if(ListSecondTracks.size()==2) m_hb_r2dc->Fill( FitVertex.perp(), m_w_1); - else m_hb_rNdc->Fill( FitVertex.perp(), m_w_1); - m_hb_mom->Fill( MomentumJet.E(), m_w_1); - m_hb_ratio->Fill( Results[1], m_w_1); - m_hb_totmass->Fill( Results[0], m_w_1); - m_hb_nvrt2->Fill( Results[2], m_w_1); - m_hb_sig3DTot->Fill( Signif3D, m_w_1); - // Find highest track Pt with respect to jet direction - double trackPt, trackPtMax=0.; - for (int tr=0; tr<(int)ListSecondTracks.size(); tr++) { - trackPt=pTvsDir(Amg::Vector3D(JetDir.Vect().X(),JetDir.Vect().Y(),JetDir.Vect().Z()) , TrkAtVrt[tr]); - if(trackPt>trackPtMax)trackPtMax=trackPt; - } - m_hb_trkPtMax->Fill( trackPtMax, m_w_1); - m_pr_effVrt->Fill((float)m_NRefPVTrk,1.); - m_pr_effVrtEta->Fill( JetDir.Eta(),1.); - } - - -//------------------------------------------------------------------------------------- -//Return xAOD::Vertex - xAOD::Vertex * tmpVertex=new xAOD::Vertex(); - tmpVertex->makePrivateStore(); - tmpVertex->setPosition(FitVertex); - std::vector<float> floatErrMtx; floatErrMtx.resize(ErrorMatrix.size()); - for(int i=0; i<(int)ErrorMatrix.size(); i++) floatErrMtx[i]=ErrorMatrix[i]; - tmpVertex->setCovariance(floatErrMtx); - tmpVertex->setFitQuality(Chi2, (float)(ListSecondTracks.size()*2.-3.)); - - std::vector<Trk::VxTrackAtVertex> & tmpVTAV=tmpVertex->vxTrackAtVertex(); tmpVTAV.clear(); - for(int ii=0; ii<(int)ListSecondTracks.size(); ii++) { - AmgSymMatrix(5) *CovMtxP=new AmgSymMatrix(5); (*CovMtxP).setIdentity(); - Trk::Perigee * tmpMeasPer = new Trk::Perigee( 0.,0., TrkAtVrt[ii][0], TrkAtVrt[ii][1], TrkAtVrt[ii][2], - Trk::PerigeeSurface(FitVertex), CovMtxP ); - tmpVTAV.push_back( Trk::VxTrackAtVertex( 1., tmpMeasPer) ); - } - return tmpVertex; - } - @@ -724,7 +491,7 @@ namespace InDet{ std::vector<float> covPV=PrimVrt.covariance(); double SignifR=0.,SignifZ=0.; std::vector<int> hitIBL(NTracks,0), hitBL(NTracks,0); - std::vector<double> TrackSignif(NTracks),TrkSig3D(NTracks); + std::vector<double> TrkSig3D(NTracks); std::vector< std::vector<float> > trkScore(NTracks); AmgVector(5) tmpPerigee; tmpPerigee.setZero(); for (i=0; i<NTracks; i++) { @@ -736,7 +503,6 @@ namespace InDet{ else{ Impact[1] = fabs(Impact[1]);} SignifR = Impact[0]/ sqrt(ImpactError[0]); SignifZ = Impact[1]/ sqrt(ImpactError[2]); - TrackSignif[i] = sqrt( SignifR*SignifR + SignifZ*SignifZ); int hL1=0, nLays=0; getPixelLayers(SelectedTracks[i] , hitIBL[i] , hitBL[i], hL1, nLays ); //---- trkScore[i]=m_trackClassificator->trkTypeWgts(SelectedTracks[i], PrimVrt, JetDir); diff --git a/InnerDetector/InDetRecTools/InDetVKalVxInJetTool/src/BTagVrtSecMulti.cxx b/InnerDetector/InDetRecTools/InDetVKalVxInJetTool/src/BTagVrtSecMulti.cxx index 0b80fcf4533128670a506e2ee2dd3188f4897ae2..4cc23b646f591e9355da988e41f2434febd9bca7 100755 --- a/InnerDetector/InDetRecTools/InDetVKalVxInJetTool/src/BTagVrtSecMulti.cxx +++ b/InnerDetector/InDetRecTools/InDetVKalVxInJetTool/src/BTagVrtSecMulti.cxx @@ -41,201 +41,202 @@ namespace InDet{ const double c_vrtBCMassLimit=5500.; // Mass limit to consider a vertex not coming from B,C-decays -// std::vector<xAOD::Vertex*> InDetVKalVxInJetTool::GetVrtSecMulti( -// const std::vector<const Rec::TrackParticle*>& InpTrk, -// const xAOD::Vertex & PrimVrt, -// const TLorentzVector & JetDir, -// std::vector<double> & Results, -// std::vector< std::vector<const Rec::TrackParticle*> > & FoundSecondTracks, -// std::vector<const Rec::TrackParticle*> & TrkFromV0) - std::vector<xAOD::Vertex*> InDetVKalVxInJetTool::GetVrtSecMulti( workVectorArrxAOD * xAODwrk, - workVectorArrREC * RECwork, - const xAOD::Vertex & PrimVrt, - const TLorentzVector & JetDir, - std::vector<double> & Results) - const - { +std::vector<xAOD::Vertex*> +InDetVKalVxInJetTool::GetVrtSecMulti(workVectorArrxAOD* xAODwrk, + const xAOD::Vertex& PrimVrt, + const TLorentzVector& JetDir, + std::vector<double>& Results) const +{ + + const double probVrtMergeLimit = 0.01; + + m_NRefPVTrk = 0; + int inpNPart = 0; + int i, j; + if (xAODwrk) { + inpNPart = xAODwrk->InpTrk.size(); + xAODwrk->FoundSecondTracks.clear(); // Input clearing for failure return + Results.clear(); // Input clearing for failure return + } + if (msgLvl(MSG::DEBUG)) + msg(MSG::DEBUG) << "InDet GetVrtSecMulti() called with NPart=" << inpNPart + << endmsg; + + std::vector<xAOD::Vertex*> finalVertices(0); + + if (inpNPart < 2) { + return finalVertices; + } // 0,1 track => nothing to do! + + long int NTracks = 0; + TLorentzVector MomentumJet; + if (xAODwrk) { + SelGoodTrkParticle( + xAODwrk->InpTrk, PrimVrt, JetDir, xAODwrk->listJetTracks); + while (xAODwrk->listJetTracks.size() && + xAODwrk->listJetTracks[0]->pt() / JetDir.Pt() > 1.) + xAODwrk->listJetTracks.erase(xAODwrk->listJetTracks.begin()); + NTracks = xAODwrk->listJetTracks.size(); + MomentumJet = TotalMom(xAODwrk->listJetTracks); + } - const double probVrtMergeLimit=0.01; + if (NTracks < 2) { + return finalVertices; + } // 0,1 selected track => nothing to do! - m_NRefPVTrk=0; - int inpNPart=0; - int i,j; - if(xAODwrk){ - inpNPart=xAODwrk->InpTrk.size(); - xAODwrk->FoundSecondTracks.clear(); // Input clearing for failure return - Results.clear(); // Input clearing for failure return - } else if(RECwork){ - inpNPart=RECwork->InpTrk.size(); - RECwork->FoundSecondTracks.clear(); // Input clearing for failure return - Results.clear(); // Input clearing for failure return - } - if(msgLvl(MSG::DEBUG))msg(MSG::DEBUG) << "InDet GetVrtSecMulti() called with NPart=" <<inpNPart<< endmsg; - - //std::vector<const Rec::TrackParticle*> listJetTracks, tmpListTracks, listSecondTracks, TracksForFit; - std::vector<xAOD::Vertex*> finalVertices(0); + + ATH_MSG_DEBUG("Number of selected tracks inside jet= " << NTracks); - if( inpNPart < 2 ) { return finalVertices;} // 0,1 track => nothing to do! - - - long int NTracks = 0; - TLorentzVector MomentumJet; - if (xAODwrk) { SelGoodTrkParticle( xAODwrk->InpTrk, PrimVrt, JetDir, xAODwrk->listJetTracks); - while( xAODwrk->listJetTracks.size() && xAODwrk->listJetTracks[0]->pt()/JetDir.Pt()>1.) - xAODwrk->listJetTracks.erase(xAODwrk->listJetTracks.begin()); - NTracks = xAODwrk->listJetTracks.size(); - MomentumJet = TotalMom(xAODwrk->listJetTracks);} - else if(RECwork) { SelGoodTrkParticle( RECwork->InpTrk, PrimVrt, JetDir, RECwork->listJetTracks); - while( RECwork->listJetTracks.size() && RECwork->listJetTracks[0]->pt()/JetDir.Pt()>1.) - RECwork->listJetTracks.erase(RECwork->listJetTracks.begin()); - NTracks = RECwork->listJetTracks.size(); - MomentumJet = TotalMom(GetPerigeeVector(RECwork->listJetTracks));} - - if( NTracks < 2 ) { return finalVertices;} // 0,1 selected track => nothing to do! - - if(msgLvl(MSG::DEBUG))msg(MSG::DEBUG) << "Number of selected tracks inside jet= " <<NTracks << endmsg; - - if(m_fillHist){m_hb_jmom->Fill( MomentumJet.Perp(), m_w_1); - m_hb_ntrkjet->Fill( (double) NTracks, m_w_1); } + if (m_fillHist) { + m_hb_jmom->Fill(MomentumJet.Perp(), m_w_1); + m_hb_ntrkjet->Fill((double)NTracks, m_w_1); + } -// -// InpTrk[] - input track list -// listJetTracks[] - list of good tracks in jet for vertex search -//------------------------------------------------------------ -// Initial track list ready -// Find 2track vertices -// - - std::vector<double> InpMass(NTracks,m_massPi); - double Vrt2TrackNumber = 0; - - if (xAODwrk){ - Select2TrVrt(xAODwrk->listJetTracks, xAODwrk->TracksForFit, PrimVrt, JetDir, InpMass, xAODwrk->TrkFromV0, xAODwrk->listSecondTracks); - if( xAODwrk->TrkFromV0.size() > 1) { RemoveDoubleEntries(xAODwrk->TrkFromV0); AnalysisUtils::Sort::pT (&(xAODwrk->TrkFromV0));} - Vrt2TrackNumber = (double) xAODwrk->listSecondTracks.size()/2.; - RemoveDoubleEntries(xAODwrk->listSecondTracks); - AnalysisUtils::Sort::pT (&(xAODwrk->listSecondTracks)); - } else if(RECwork) { - Select2TrVrt(RECwork->listJetTracks, RECwork->TracksForFit, PrimVrt, JetDir, InpMass, RECwork->TrkFromV0, RECwork->listSecondTracks); - if( RECwork->TrkFromV0.size() > 1) { RemoveDoubleEntries(RECwork->TrkFromV0); AnalysisUtils::Sort::pT (&(RECwork->TrkFromV0));} - Vrt2TrackNumber = (double) RECwork->listSecondTracks.size()/2.; - RemoveDoubleEntries(RECwork->listSecondTracks); - AnalysisUtils::Sort::pT (&(RECwork->listSecondTracks)); + // + // InpTrk[] - input track list + // listJetTracks[] - list of good tracks in jet for vertex search + //------------------------------------------------------------ + // Initial track list ready + // Find 2track vertices + // + + std::vector<double> InpMass(NTracks, m_massPi); + double Vrt2TrackNumber = 0; + + if (xAODwrk) { + Select2TrVrt(xAODwrk->listJetTracks, + xAODwrk->TracksForFit, + PrimVrt, + JetDir, + InpMass, + xAODwrk->TrkFromV0, + xAODwrk->listSecondTracks); + if (xAODwrk->TrkFromV0.size() > 1) { + RemoveDoubleEntries(xAODwrk->TrkFromV0); + AnalysisUtils::Sort::pT(&(xAODwrk->TrkFromV0)); + } + Vrt2TrackNumber = xAODwrk->listSecondTracks.size()/2.0; + RemoveDoubleEntries(xAODwrk->listSecondTracks); + AnalysisUtils::Sort::pT(&(xAODwrk->listSecondTracks)); + } + // if(m_WorkArray->m_Incomp.size() < 2 ) { return finalVertices;} // + // 0,1 tracks left VVK WRONG!!! + // + //--- + + ATH_MSG_DEBUG(" Found different tracks in pairs=" << Vrt2TrackNumber); + // if(listSecondTracks.size() < 2 ) { return finalVertices;} // 0,1 + // tracks left VVK WRONG !!! + + // + // listSecondTracks[] - list of all tracks which participate in some + // 2-track vertex TrkFromV0[] - "bad" tracks from any + // V0/material/conversion m_Incomp[] - main vector of pointers for + // multivertex search + //----------------------------------------------------------------------------------------------------- + // Secondary track list is ready + // Creation of initial vertex set + // + + std::vector<WrkVrt>* WrkVrtSet = new std::vector<WrkVrt>; + WrkVrt newvrt; + newvrt.Good = true; + std::unique_ptr<Trk::IVKalState> state = m_fitSvc->makeState(); + StatusCode sc; + sc.setChecked(); + long int NPTR = 0, nth = 2; // VK nth=2 to speed up PGRAPH when it's used + + //================================================== Boost version (don't + //forget to uncomment addEdge in Select2TrVrt() + std::vector<std::vector<int>> allCliques; + bron_kerbosch_all_cliques(*m_compatibilityGraph, clique_visitor(allCliques)); + for (int cq = 0; cq < (int)allCliques.size(); cq++) { + newvrt.SelTrk.clear(); + NPTR = allCliques[cq].size(); + for (i = 0; i < NPTR; i++) { + newvrt.SelTrk.push_back(allCliques[cq][i]); + } + //================================================== + if (xAODwrk) + xAODwrk->tmpListTracks.clear(); + for (i = 0; i < NPTR; i++) { + if (xAODwrk) + xAODwrk->tmpListTracks.push_back( + xAODwrk->listJetTracks.at(newvrt.SelTrk[i])); + } + if (xAODwrk) + sc = VKalVrtFitFastBase(xAODwrk->tmpListTracks, newvrt.vertex, *state); + if (sc.isFailure() || + newvrt.vertex.perp() > m_rLayer2 * 2.) { /* No initial estimation */ + m_fitSvc->setApproximateVertex(PrimVrt.x(), + PrimVrt.y(), + PrimVrt.z(), + *state); /*Use as starting point*/ + if (m_multiWithPrimary) + m_fitSvc->setApproximateVertex(0., 0., 0., *state); + } else { + Amg::Vector3D vDist = newvrt.vertex - PrimVrt.position(); + double JetVrtDir = JetDir.Px() * vDist.x() + JetDir.Py() * vDist.y() + + JetDir.Pz() * vDist.z(); + if (m_multiWithPrimary) + JetVrtDir = fabs( + JetVrtDir); /* Always positive when primary vertex is seeked for*/ + if (JetVrtDir > 0.) { /* Good initial estimation */ + m_fitSvc->setApproximateVertex(newvrt.vertex.x(), + newvrt.vertex.y(), + newvrt.vertex.z(), + *state); /*Use as starting point*/ + } else { + m_fitSvc->setApproximateVertex( + PrimVrt.x(), PrimVrt.y(), PrimVrt.z(), *state); } - -// if(m_WorkArray->m_Incomp.size() < 2 ) { return finalVertices;} // 0,1 tracks left VVK WRONG!!! -// -//--- - if(msgLvl(MSG::DEBUG))msg(MSG::DEBUG)<<" Found different tracks in pairs="<< Vrt2TrackNumber<<endmsg; -// if(listSecondTracks.size() < 2 ) { return finalVertices;} // 0,1 tracks left VVK WRONG !!! - - -// -// listSecondTracks[] - list of all tracks which participate in some 2-track vertex -// TrkFromV0[] - "bad" tracks from any V0/material/conversion -// m_Incomp[] - main vector of pointers for multivertex search -//----------------------------------------------------------------------------------------------------- -// Secondary track list is ready -// Creation of initial vertex set -// - - - std::vector<WrkVrt> *WrkVrtSet= new std::vector<WrkVrt>; - WrkVrt newvrt; newvrt.Good=true; - std::unique_ptr<Trk::IVKalState> state = m_fitSvc->makeState(); - StatusCode sc; sc.setChecked(); - long int NPTR=0, nth=2; // VK nth=2 to speed up PGRAPH when it's used - -//================================================ PGRAPH version -// int iRet=0; -// //long int* weit = new long int[m_WorkArray->m_Incomp.size()]; -// //long int* Solution = new long int[NTracks]; -// std::unique_ptr<long int[]> weit = std::unique_ptr<long int[]>(new long int[m_WorkArray->m_Incomp.size()]) -// std::unique_ptr<long int[]> Solution = std::unique_ptr<long int[]>(new long int[NTracks]) -// for(i=0; i<(int)m_WorkArray->m_Incomp.size(); i++) *(weit+i)=(long int) (m_WorkArray->m_Incomp[i]+1); /* +1 is needed for PGRAPH*/ -// long int edges = m_WorkArray->m_Incomp.size()/2; -// while(true) { -// iRet=Trk::pgraphm_( weit, &edges, &NTracks, Solution, &NPTR, &nth); -// if( iRet != 0) { if(msgLvl(MSG::ERROR))msg(MSG::ERROR) << " Error in PGRAPHm iRet=" <<iRet << endmsg;} -// if(NPTR <= 0) break; /* No more solutions */ -// if(NPTR == 1) continue; /* Not a good solution */ -// newvrt.SelTrk.clear(); -// for(i=0;i<NPTR;i++) { newvrt.SelTrk.push_back(Solution[i]-1);}//std::cout<<"Solution="<<Solution[i]<<'\n'; -//================================================== Boost version (don't forget to uncomment addEdge in Select2TrVrt() - std::vector< std::vector<int> > allCliques; - bron_kerbosch_all_cliques(*m_compatibilityGraph, clique_visitor(allCliques)); - for(int cq=0; cq<(int)allCliques.size();cq++){ - newvrt.SelTrk.clear(); - NPTR=allCliques[cq].size(); - for(i=0;i<NPTR;i++){ newvrt.SelTrk.push_back(allCliques[cq][i]);} -//================================================== - if(xAODwrk)xAODwrk->tmpListTracks.clear(); else if(RECwork)RECwork->tmpListTracks.clear(); - for(i=0;i<NPTR;i++) { - if (xAODwrk)xAODwrk->tmpListTracks.push_back( xAODwrk->listJetTracks.at(newvrt.SelTrk[i]) ); - else if(RECwork)RECwork->tmpListTracks.push_back( RECwork->listJetTracks.at(newvrt.SelTrk[i]) ); - } - if (xAODwrk)sc = VKalVrtFitFastBase(xAODwrk->tmpListTracks,newvrt.vertex,*state); - else if(RECwork)sc = VKalVrtFitFastBase(RECwork->tmpListTracks,newvrt.vertex,*state); - if( sc.isFailure() || newvrt.vertex.perp() > m_rLayer2*2. ) { /* No initial estimation */ - m_fitSvc->setApproximateVertex(PrimVrt.x(), PrimVrt.y(), PrimVrt.z(),*state); /*Use as starting point*/ - if( m_multiWithPrimary ) m_fitSvc->setApproximateVertex(0., 0., 0.,*state); - } else { - Amg::Vector3D vDist=newvrt.vertex-PrimVrt.position(); - double JetVrtDir = JetDir.Px()*vDist.x() + JetDir.Py()*vDist.y() + JetDir.Pz()*vDist.z(); - if( m_multiWithPrimary ) JetVrtDir=fabs(JetVrtDir); /* Always positive when primary vertex is seeked for*/ - if( JetVrtDir>0. ) { /* Good initial estimation */ - m_fitSvc->setApproximateVertex(newvrt.vertex.x(),newvrt.vertex.y(),newvrt.vertex.z(),*state); /*Use as starting point*/ - }else{ - m_fitSvc->setApproximateVertex(PrimVrt.x(), PrimVrt.y(), PrimVrt.z(),*state); - } - } -// std::cout<<"FoundAppVrt="<<newvrt.vertex[0]<<", "<<newvrt.vertex[1]<<", "<<newvrt.vertex[2]<<'\n'; - sc = StatusCode::FAILURE; - if (xAODwrk){sc=VKalVrtFitBase(xAODwrk->tmpListTracks, - newvrt.vertex, newvrt.vertexMom, newvrt.vertexCharge, newvrt.vertexCov, - newvrt.Chi2PerTrk, newvrt.TrkAtVrt, newvrt.Chi2, - *state, false);} - else if(RECwork){sc=VKalVrtFitBase(RECwork->tmpListTracks, - newvrt.vertex, newvrt.vertexMom, newvrt.vertexCharge, newvrt.vertexCov, - newvrt.Chi2PerTrk, newvrt.TrkAtVrt, newvrt.Chi2, - *state, false);} -// std::cout << "Res="<<newvrt.Chi2<<", "<<NPTR<<", "<<newvrt.SelTrk[0]<<", "<<newvrt.SelTrk[1]<<'\n'; - if( sc.isFailure() ) continue; /* Bad fit - goto next solution */ - if(NPTR==2 && newvrt.Chi2>10.) continue; /* Bad 2track vertex */ - if(newvrt.Chi2PerTrk.size()==2) newvrt.Chi2PerTrk[0]=newvrt.Chi2PerTrk[1]=newvrt.Chi2/2.; - newvrt.Good = true; - newvrt.nCloseVrt = 0; - newvrt.dCloseVrt = 1000000.; - newvrt.ProjectedVrt=JetProjDist(newvrt.vertex, PrimVrt, JetDir); //3D SV-PV distance - WrkVrtSet->push_back(newvrt); - } -//================================================================================== -// boost::adjacency_list<boost::listS, boost::vecS, boost::undirectedS>::vertex_iterator vertexIt, vertexEnd; -// boost::adjacency_list<boost::listS, boost::vecS, boost::undirectedS>::adjacency_iterator neighbourIt, neighbourEnd; -// tie(vertexIt, vertexEnd) = vertices(*m_compatibilityGraph); -// for (; vertexIt != vertexEnd; ++vertexIt) { std::cout << *vertexIt << " is connected with "; -// tie(neighbourIt, neighbourEnd) = adjacent_vertices(*vertexIt, *m_compatibilityGraph); -// for (; neighbourIt != neighbourEnd; ++neighbourIt) std::cout << *neighbourIt << " "; std::cout << "\n"; } -//================================================================================== -//------------ Debug -// std::vector<const xAOD::TrackParticle*> tempTrk(0); -// for(auto & iv : (*WrkVrtSet)){ if(iv.Good){for(auto & it : iv.SelTrk)tempTrk.push_back(xAODwrk->listJetTracks.at(it));}} -// RemoveDoubleEntries(tempTrk); -// -//========= Initial cleaning of solutions -//-Remove worst track from vertices with very bad Chi2 - bool disassembled=false; - int NSoluI=0; - do{ - disassembled=false; - NSoluI=(*WrkVrtSet).size(); - for(int iv=0; iv<NSoluI; iv++){ - if(!(*WrkVrtSet)[iv].Good || (*WrkVrtSet)[iv].SelTrk.size() == 2 ) continue; - if( TMath::Prob( (*WrkVrtSet)[iv].Chi2, 2*(*WrkVrtSet)[iv].SelTrk.size()-3) <1.e-3){ - //printWrkSet(WrkVrtSet,"BigChi2Vertex present"); - if (xAODwrk)DisassembleVertex(WrkVrtSet,iv,xAODwrk->listJetTracks,*state); - else if(RECwork)DisassembleVertex(WrkVrtSet,iv,RECwork->listJetTracks,*state); - disassembled=true; + } + sc = StatusCode::FAILURE; + if (xAODwrk) { + sc = VKalVrtFitBase(xAODwrk->tmpListTracks, + newvrt.vertex, + newvrt.vertexMom, + newvrt.vertexCharge, + newvrt.vertexCov, + newvrt.Chi2PerTrk, + newvrt.TrkAtVrt, + newvrt.Chi2, + *state, + false); + } + if (sc.isFailure()){ + continue; /* Bad fit - goto next solution */ + } + if (NPTR == 2 && newvrt.Chi2 > 10.){ + continue; /* Bad 2track vertex */ + } + if (newvrt.Chi2PerTrk.size() == 2){ + newvrt.Chi2PerTrk[0] = newvrt.Chi2PerTrk[1] = newvrt.Chi2 / 2.; + } + newvrt.Good = true; + newvrt.nCloseVrt = 0; + newvrt.dCloseVrt = 1000000.; + newvrt.ProjectedVrt = + JetProjDist(newvrt.vertex, PrimVrt, JetDir); // 3D SV-PV distance + WrkVrtSet->push_back(newvrt); + } + // + //========= Initial cleaning of solutions + //-Remove worst track from vertices with very bad Chi2 + bool disassembled = false; + int NSoluI = 0; + do { + disassembled = false; + NSoluI = (*WrkVrtSet).size(); + for (int iv = 0; iv < NSoluI; iv++) { + if (!(*WrkVrtSet)[iv].Good || (*WrkVrtSet)[iv].SelTrk.size() == 2) + continue; + if (TMath::Prob((*WrkVrtSet)[iv].Chi2, + 2 * (*WrkVrtSet)[iv].SelTrk.size() - 3) < 1.e-3) { + // printWrkSet(WrkVrtSet,"BigChi2Vertex present"); + if (xAODwrk) + DisassembleVertex(WrkVrtSet, iv, xAODwrk->listJetTracks, *state); + disassembled = true; } } }while(disassembled); //-Remove vertices fully contained in other vertices @@ -263,9 +264,6 @@ const double c_vrtBCMassLimit=5500.; // Mass limit to consider a vertex not com int nTCom=nTrkCommon( WrkVrtSet, iv, jv); if(!nTCom)continue; vrtWithCommonTrk.emplace(nTCom,std::make_pair(iv,jv)); } } - //============================== DEBUG output - //printWrkSet(WrkVrtSet,"InitialVrts"); - //for(auto ku : vrtWithCommonTrk)std::cout<<" nCom="<<ku.first<<" v1="<<ku.second.first<<" v2="<<ku.second.second<<'\n'; //=========================================== for(icvrt=vrtWithCommonTrk.rbegin(); icvrt!=vrtWithCommonTrk.rend(); ++icvrt){ int nTCom=(*icvrt).first; @@ -273,23 +271,25 @@ const double c_vrtBCMassLimit=5500.; // Mass limit to consider a vertex not com int jv=(*icvrt).second.second; int nTrkI=(*WrkVrtSet)[iv].SelTrk.size(); int nTrkJ=(*WrkVrtSet)[jv].SelTrk.size(); - double probV=-1.; - if (xAODwrk)probV=mergeAndRefitVertices( WrkVrtSet, iv, jv, newvrt, xAODwrk->listJetTracks, *state); - else if(RECwork)probV=mergeAndRefitVertices( WrkVrtSet, iv, jv, newvrt, RECwork->listJetTracks, *state); - ////std::cout<<" ntcommon="<<(*icvrt).first<<" prb="<<probV<<" itrk="<<nTrkI<<" jtrk="<<nTrkJ<<'\n'; - if(probV<probVrtMergeLimit){ - if(nTrkI==2 || nTrkJ==2 || nTCom<2) continue; + double probV = -1.; + if (xAODwrk) { + probV = mergeAndRefitVertices( + WrkVrtSet, iv, jv, newvrt, xAODwrk->listJetTracks, *state); + } + if(probV<probVrtMergeLimit){ + if(nTrkI==2 || nTrkJ==2 || nTCom<2) { + continue; + } if((nTCom>nTrkI-nTCom || nTCom>nTrkJ-nTCom)){ //2 and more common tracks for NTr>=3 vertices. Merge anyway. if (xAODwrk)mergeAndRefitOverlapVertices( WrkVrtSet, iv, jv, xAODwrk->listJetTracks, *state); - else if(RECwork)mergeAndRefitOverlapVertices( WrkVrtSet, iv, jv, RECwork->listJetTracks, *state); break; //Vertex list is changed. Restart merging from scratch. } continue; //Continue merging loop } newvrt.Good = true; (*WrkVrtSet).push_back(newvrt); - (*WrkVrtSet)[iv].Good=false; - (*WrkVrtSet)[jv].Good=false; + (*WrkVrtSet)[iv].Good=false; + (*WrkVrtSet)[jv].Good=false; break; //Merging successful. Break merging loop and remake list of connected vertices } } while( icvrt != vrtWithCommonTrk.rend() ); @@ -324,36 +324,6 @@ const double c_vrtBCMassLimit=5500.; // Mass limit to consider a vertex not com if(xAODwrk){ for(auto &trk : xAODwrk->listJetTracks) trkScore.push_back(m_trackClassificator->trkTypeWgts(trk, PrimVrt, JetDir)); } for( auto &tmpV : (*WrkVrtSet) ) tmpV.ProjectedVrt=JetProjDist(tmpV.vertex, PrimVrt, JetDir); //Setup ProjectedVrt //---------------------------------------------------------------------------- -// Add primary vertex -// -// if (xAODwrk)xAODwrk->tmpListTracks.clear(); else if(RECwork)RECwork->tmpListTracks.clear(); -// newvrt.SelTrk.clear(); -// nth=m_WorkArray->m_Prmtrack.size(); -// int PrmVrtAdded=-1; -// if( nth>1 && WrkVrtSet->size()>0 ){ -// for(i=0;i<nth;i++) { -// newvrt.SelTrk.push_back( m_WorkArray->m_Prmtrack[i] ); -// tmpListTracks.push_back( listJetTracks.at( m_WorkArray->m_Prmtrack[i] ) ); -// } -// sc = VKalVrtFitFastBase(tmpListTracks,newvrt.vertex); -// m_fitSvc->setApproximateVertex(newvrt.vertex[0],newvrt.vertex[1],newvrt.vertex[2]); -// sc=VKalVrtFitBase(tmpListTracks, -// newvrt.vertex, -// newvrt.vertexMom, -// newvrt.vertexCharge, -// newvrt.vertexCov, -// newvrt.Chi2PerTrk, -// newvrt.TrkAtVrt, -// newvrt.Chi2); -// if( sc.isSuccess() ) { -// PrmVrtAdded=WrkVrtSet->size(); /* Primary vertex position in vertices list */ -// WrkVrtSet->push_back(newvrt); /* Good fit - add it */ -// } -// //std::cout<<"PrimVrt="<<nth<<", "<<newvrt.vertex[0]<<", "<<newvrt.vertex[1]<<", "<<newvrt.vertex[2] -// // <<" Chi2="<<newvrt.Chi2<<'\n'; -// } -// -//---------------------------------------------------------------------------- // Here we have the overlapping solutions. // Vertices may have only 1 common track. // Now solution cleaning @@ -369,9 +339,6 @@ const double c_vrtBCMassLimit=5500.; // Mass limit to consider a vertex not com state = m_fitSvc->makeState(); while((foundMaxT=MaxOfShared( WrkVrtSet, TrkInVrt, SelectedTrack, SelectedVertex))>0) { - //std::cout << "MAX="<<foundMaxT<<", "<<SelectedTrack<<", "<<SelectedVertex<<'\n'; - //std::cout << "VRT="<<minVrtVrtDist( WrkVrtSet, foundV1, foundV2)<<", "<<foundV1<<", "<<foundV2<<'\n'; - //printWrkSet(WrkVrtSet,"Iterat"); double foundMinVrtDst = 1000000.; if(foundMaxT<m_trackDetachCut) foundMinVrtDst = minVrtVrtDist( WrkVrtSet, foundV1, foundV2); @@ -384,7 +351,6 @@ const double c_vrtBCMassLimit=5500.; // Mass limit to consider a vertex not com if(foundV1<foundV2) { int tmp=foundV1; foundV1=foundV2; foundV2=tmp;} /*Always drop vertex with smallest number*/ double probV=0.; if (xAODwrk)probV=mergeAndRefitVertices( WrkVrtSet, foundV1, foundV2, newvrt, xAODwrk->listJetTracks, *state); - else if(RECwork)probV=mergeAndRefitVertices( WrkVrtSet, foundV1, foundV2, newvrt, RECwork->listJetTracks, *state); if(probV>probVrtMergeLimit && newvrt.vertexMom.M()<c_vrtBCMassLimit){ // Good merged vertex found double tstDst=JetProjDist(newvrt.vertex, PrimVrt, JetDir); if(tstDst>0.){ // only positive vertex directions are accepted as merging result @@ -409,12 +375,10 @@ const double c_vrtBCMassLimit=5500.; // Mass limit to consider a vertex not com RemoveTrackFromVertex(WrkVrtSet, TrkInVrt, SelectedTrack, SelectedVertex); sc = StatusCode::FAILURE; if (xAODwrk)sc = RefitVertex( WrkVrtSet, SelectedVertex, xAODwrk->listJetTracks, *state, false); - else if(RECwork)sc = RefitVertex( WrkVrtSet, SelectedVertex, RECwork->listJetTracks, *state, false); (*WrkVrtSet)[SelectedVertex].ProjectedVrt=JetProjDist((*WrkVrtSet)[SelectedVertex].vertex, PrimVrt, JetDir); if( sc.isFailure() ) (*WrkVrtSet)[SelectedVertex].Good=false; //bad vertex if( (*WrkVrtSet)[SelectedVertex].ProjectedVrt<0. && (*WrkVrtSet)[SelectedVertex].SelTrk.size()==2 ) (*WrkVrtSet)[SelectedVertex].Good=false; // 2track vertex migrates behind PV - drop it. - //std::cout<<"Dropped v="<<SelectedVertex<<" dst="<<(*WrkVrtSet)[SelectedVertex].ProjectedVrt<<'\n'; } // // Final check/merge for close vertices @@ -424,7 +388,6 @@ const double c_vrtBCMassLimit=5500.; // Mass limit to consider a vertex not com if(foundV1<foundV2) { int tmp=foundV1; foundV1=foundV2; foundV2=tmp;} double probV=0.; if (xAODwrk)probV=mergeAndRefitVertices( WrkVrtSet, foundV1, foundV2, newvrt, xAODwrk->listJetTracks, *state); - else if(RECwork)probV=mergeAndRefitVertices( WrkVrtSet, foundV1, foundV2, newvrt, RECwork->listJetTracks, *state); if(probV>probVrtMergeLimit && newvrt.vertexMom.M()<c_vrtBCMassLimit){ // Good merged vertex found double tstDst=JetProjDist(newvrt.vertex, PrimVrt, JetDir); if(tstDst>0.){ // only positive vertex directions are accepted as merging result @@ -446,7 +409,6 @@ const double c_vrtBCMassLimit=5500.; // Mass limit to consider a vertex not com double tmpProb=TMath::Prob( (*WrkVrtSet)[iv].Chi2, 2*(*WrkVrtSet)[iv].SelTrk.size()-3 ); //Chi2 of the original vertex if(tmpProb<0.001){ if (xAODwrk)tmpProb=improveVertexChi2( WrkVrtSet, iv, xAODwrk->listJetTracks, *state, false); - else if(RECwork)tmpProb=improveVertexChi2( WrkVrtSet, iv, RECwork->listJetTracks, *state, false); if(tmpProb<0.001)(*WrkVrtSet)[iv].Good=false; (*WrkVrtSet)[iv].ProjectedVrt=JetProjDist((*WrkVrtSet)[iv].vertex, PrimVrt, JetDir); } @@ -470,7 +432,6 @@ const double c_vrtBCMassLimit=5500.; // Mass limit to consider a vertex not com if(ntrVrt.detachedTrack==onetVrt.SelTrk[0]){ WrkVrt newV(ntrVrt); newV.SelTrk.push_back(ntrVrt.detachedTrack); if (xAODwrk)vProb = RefitVertex( newV, xAODwrk->listJetTracks, *state, true); - else if(RECwork)vProb = RefitVertex( newV, RECwork->listJetTracks, *state, true); if(vProb>probVrtMergeLimit){ onetVrt.Good=false; ntrVrt=newV; ntrVrt.detachedTrack=-1;} break; } } } @@ -480,7 +441,6 @@ const double c_vrtBCMassLimit=5500.; // Mass limit to consider a vertex not com if(iVrt.detachedTrack==jVrt.SelTrk[0]){ WrkVrt newV(iVrt); newV.SelTrk.push_back(iVrt.detachedTrack); if (xAODwrk)vProb = RefitVertex( newV, xAODwrk->listJetTracks, *state, true); - else if(RECwork)vProb = RefitVertex( newV, RECwork->listJetTracks, *state, true); if(vProb>probVrtMergeLimit){ jVrt.Good=false; iVrt=newV; iVrt.detachedTrack=-1;} break; } } } @@ -490,7 +450,6 @@ const double c_vrtBCMassLimit=5500.; // Mass limit to consider a vertex not com if(onetVrt.detachedTrack==tr){ WrkVrt newV(ntrVrt); newV.SelTrk.push_back(onetVrt.SelTrk[0]); if (xAODwrk)vProb = RefitVertex( newV, xAODwrk->listJetTracks, *state, true); - else if(RECwork)vProb = RefitVertex( newV, RECwork->listJetTracks, *state, true); if(vProb>probVrtMergeLimit){ onetVrt.Good=false; ntrVrt=newV;} } } } } for(auto & curVrt : (*WrkVrtSet) ) { @@ -502,13 +461,11 @@ const double c_vrtBCMassLimit=5500.; // Mass limit to consider a vertex not com VrtVrtDist(PrimVrt,curVrt.vertex, curVrt.vertexCov, Signif3D); //VK non-projected Signif3D is worse double tmpProb=TMath::Prob( curVrt.Chi2, 1); //Chi2 of the original 2tr vertex bool trkGood=false; - if (RECwork)trkGood=Check1TrVertexInPixel(RECwork->listJetTracks[curVrt.SelTrk[0]],curVrt.vertex,curVrt.vertexCov); - else if(xAODwrk)trkGood=Check1TrVertexInPixel(xAODwrk->listJetTracks[curVrt.SelTrk[0]],curVrt.vertex,curVrt.vertexCov); + if(xAODwrk)trkGood=Check1TrVertexInPixel(xAODwrk->listJetTracks[curVrt.SelTrk[0]],curVrt.vertex,curVrt.vertexCov); if(trkGood && tmpProb>0.01){ /* accept only good tracks coming from good 2tr vertex*/ //if( useMaterialRejection && insideMatLayer(curVrt.vertex.x(),curVrt.vertex.y()) ) continue; std::vector<double> Impact,ImpactError; double Signif3DP = 0; if (xAODwrk) Signif3DP=m_fitSvc->VKalGetImpact(xAODwrk->listJetTracks[curVrt.SelTrk[0]],PrimVrt.position(), 1, Impact, ImpactError, *state); - else if(RECwork) Signif3DP=m_fitSvc->VKalGetImpact(RECwork->listJetTracks[curVrt.SelTrk[0]],PrimVrt.position(), 1, Impact, ImpactError, *state); if(m_fillHist&&curVrt.vertex.perp()>20.){m_hb_diffPS->Fill( Signif3DP, m_w_1); } if( Signif3DP>2.*m_trkSigCut && Signif3D>m_sel2VrtSigCut) curVrt.Good=true; // accept only tracks which are far from primary vertex } @@ -526,10 +483,9 @@ const double c_vrtBCMassLimit=5500.; // Mass limit to consider a vertex not com nth=(*WrkVrtSet)[iv].SelTrk.size(); if(nth == 1) continue; // 1track vertices are treated already //Signif3Dproj=VrtVrtDist(PrimVrt, curVrt.vertex, curVrt.vertexCov, JetDir); VrtVrtDist(PrimVrt,curVrt.vertex, curVrt.vertexCov, Signif3D); //VK non-projected Signif3D is worse - if(xAODwrk)xAODwrk->tmpListTracks.resize(nth); else if(RECwork)RECwork->tmpListTracks.resize(nth); + if(xAODwrk)xAODwrk->tmpListTracks.resize(nth); for(i=0;i<nth;i++) { if (xAODwrk)xAODwrk->tmpListTracks[i]=xAODwrk->listJetTracks[curVrt.SelTrk[i]]; - else if(RECwork)RECwork->tmpListTracks[i]=RECwork->listJetTracks[curVrt.SelTrk[i]]; } (*WrkVrtSet)[iv].Good = false; /* Make all vertices bad for futher selection */ if(nth <= 1) continue; /* Definitely bad vertices */ @@ -546,9 +502,7 @@ const double c_vrtBCMassLimit=5500.; // Mass limit to consider a vertex not com // if(PrmVrtAdded && iv==PrmVrtAdded && Dist3D<3.5) continue; /* Skip added primary vertex */ //----------------------------------------------------------------------------------------- if(nth==2 && m_useVertexCleaning){ - if(RECwork){ - if(!Check2TrVertexInPixel(RECwork->tmpListTracks[0],RECwork->tmpListTracks[1],curVrt.vertex,curVrt.vertexCov))continue; - }else if(xAODwrk){ + if(xAODwrk){ if(!Check2TrVertexInPixel(xAODwrk->tmpListTracks[0],xAODwrk->tmpListTracks[1],curVrt.vertex,curVrt.vertexCov))continue; } } @@ -644,7 +598,6 @@ const double c_vrtBCMassLimit=5500.; // Mass limit to consider a vertex not com if(!GoodVertices[iv].Good) continue; if(GoodVertices[iv].SelTrk.size()<2) continue; if( VrtVrtDist(PrimVrt, GoodVertices[iv].vertex, GoodVertices[iv].vertexCov, JetDir) < 10.) continue; //--Too close to PV - if (RECwork)Signif = m_fitSvc->VKalGetImpact(RECwork->listJetTracks[nonusedTrk[it]], GoodVertices[iv].vertex, 1, Impact, ImpactError, *state); else if(xAODwrk)Signif = m_fitSvc->VKalGetImpact(xAODwrk->listJetTracks[nonusedTrk[it]], GoodVertices[iv].vertex, 1, Impact, ImpactError, *state); if(Signif<tmpV.Signif3D){tmpV.Signif3D=Signif; tmpV.indVrt=iv;} } @@ -658,11 +611,9 @@ const double c_vrtBCMassLimit=5500.; // Mass limit to consider a vertex not com if(addTrk.size()>0){ if(atrk->first<4.){newV.SelTrk.push_back(nonusedTrk[atrk->second]);addedT=true;}} if(addTrk.size()>1){++atrk;if(atrk->first<4.){newV.SelTrk.push_back(nonusedTrk[atrk->second]);}} if(addedT){ if (xAODwrk)vProb = RefitVertex( newV, xAODwrk->listJetTracks, *state, true); - else if(RECwork)vProb = RefitVertex( newV, RECwork->listJetTracks, *state, true); if(vProb>0.01)GoodVertices[iv]=newV; else{ std::vector<WrkVrt> TestVertices(1,newV); if (xAODwrk)vProb=improveVertexChi2( &TestVertices, 0, xAODwrk->listJetTracks, *state, true); - else if(RECwork)vProb=improveVertexChi2( &TestVertices, 0, RECwork->listJetTracks, *state, true); if(vProb>0.01)GoodVertices[iv]=TestVertices[0]; } } @@ -678,12 +629,11 @@ const double c_vrtBCMassLimit=5500.; // Mass limit to consider a vertex not com TLorentzVector VertexMom; for(int iv=0; iv<(int)GoodVertices.size(); iv++) { nth=GoodVertices[iv].SelTrk.size(); - if(xAODwrk)xAODwrk->tmpListTracks.clear(); else if(RECwork)RECwork->tmpListTracks.clear(); + if(xAODwrk)xAODwrk->tmpListTracks.clear(); float vrtSumW=0.; for(i=0;i<nth;i++) { j=GoodVertices[iv].SelTrk[i]; /*Track number*/ if (xAODwrk)xAODwrk->tmpListTracks.push_back( xAODwrk->listJetTracks[j] ); - else if(RECwork)RECwork->tmpListTracks.push_back( RECwork->listJetTracks[j] ); if(xAODwrk)vrtSumW+=trkScore[j][0]; } if( m_fillHist ){ @@ -769,9 +719,8 @@ const double c_vrtBCMassLimit=5500.; // Mass limit to consider a vertex not com double eRatio = VertexMom.E()/MomentumJet.E(); Results.push_back( eRatio<1. ? eRatio : 1.); //2nd Results.push_back(Vrt2TrackNumber); //3rd - Results.push_back((double)NTracks); //4th - if (xAODwrk) Results.push_back((double)xAODwrk->listSecondTracks.size()); //5th - else if(RECwork) Results.push_back((double)RECwork->listSecondTracks.size()); //5th + Results.push_back(NTracks); //4th + if (xAODwrk) Results.push_back(xAODwrk->listSecondTracks.size()); //5th Results.push_back(0.); //6th - not clear what to use here -> return 0. Results.push_back(MomentumJet.E()); //7th @@ -1017,7 +966,6 @@ const double c_vrtBCMassLimit=5500.; // Mass limit to consider a vertex not com { int posInVrtFit=0; //Position of SelectedTrack in vertex fit track list. std::deque<long int>::iterator it; -//std::cout<<" In Found ="<<SelectedTrack<<", "<<SelectedVertex<<'\n'; for(it=(*WrkVrtSet).at(SelectedVertex).SelTrk.begin(); it!=(*WrkVrtSet)[SelectedVertex].SelTrk.end(); ++it) { if( (*it) == SelectedTrack ) { @@ -1392,112 +1340,3 @@ const double c_vrtBCMassLimit=5500.; // Mass limit to consider a vertex not com } //end namespace -//For possble future use -/* if( m_multiWithOneTrkVrt && (!m_multiWithPrimary) && nGoodVertices<5){ // Addition of one-track vertices is allowed - double addVrtChi2Cut =5.0; - double addSig3DCut =5.0; - int tmpNTrk=0; if(xAODwrk)tmpNTrk=xAODwrk->listJetTracks.size(); else if(RECwork)tmpNTrk=RECwork->listJetTracks.size(); - std::vector<long int> nonusedTracks; - std::vector<double> Impact,ImpactError; - for(int atr=0; atr<tmpNTrk; atr++){ - int exist=0; - for(int iv=0; iv<(int)GoodVertices.size(); iv++) { - nth=GoodVertices[iv].SelTrk.size(); - for(i=0;i<nth;i++) { if(atr==GoodVertices[iv].SelTrk[i]){exist=1; break;}} - if(exist)break; - } - if(!exist){ - int tmpNBLHits=0, tmpL1=0, tmpL2=0, tmpNLays=0; - double Signif3DP=0.; - if (RECwork) getPixelLayers( RECwork->listJetTracks[atr], tmpNBLHits, tmpL1, tmpL2, tmpNLays); - else if(xAODwrk) getPixelLayers( xAODwrk->listJetTracks[atr], tmpNBLHits, tmpL1, tmpL2, tmpNLays); - if(tmpNBLHits>0){ // accept only tracks with b-layer hit - if (RECwork)Signif3DP = m_fitSvc->VKalGetImpact(RECwork->listJetTracks[atr], PrimVrt.position(), 1, Impact, ImpactError); - else if(xAODwrk)Signif3DP = m_fitSvc->VKalGetImpact(xAODwrk->listJetTracks[atr], PrimVrt.position(), 1, Impact, ImpactError); - if( Signif3DP > m_trkSigCut ) nonusedTracks.push_back(atr); - } - } - } - std::vector<WrkVrt> AddedVertices; - std::vector<WrkVrt> AddedVerticesClean; - if(nonusedTracks.size()>0 ){ - std::vector<double> VKPerigee,CovPerigee; std::vector<double> ErrorMatrix(21,0.); - ErrorMatrix[0]=ErrorMatrix[2]=ErrorMatrix[5]=1.e-2; - for(auto & iv : GoodVertices) { - if(iv.SelTrk.size()<2) continue; - VrtVrtDist(PrimVrt, iv.vertex, iv.vertexCov, Signif3D); - if(Signif3D<10.) continue; //------------------Too close to primary vertex. Direction not robust - Amg::Vector3D tmpVec=iv.vertex-PrimVrt.position(); tmpVec.normalize(); - ErrorMatrix[ 9]=1.e9*tmpVec.x()*tmpVec.x(); - ErrorMatrix[14]=1.e9*tmpVec.y()*tmpVec.y(); - ErrorMatrix[20]=1.e9*tmpVec.z()*tmpVec.z(); - Amg::setMag(tmpVec,1.e5); TLorentzVector Momentum(tmpVec.x(),tmpVec.y(),tmpVec.z(),m_massPi); - //std::copy(iv.vertexCov.begin(),iv.vertexCov.begin()+6,ErrorMatrix.begin()); - //sc=m_fitSvc->VKalVrtCvtTool(iv.vertex,Momentum,ErrorMatrix,0,VKPerigee,CovPerigee,*state); - sc=m_fitSvc->VKalVrtCvtTool(PrimVrt.position(),Momentum,ErrorMatrix,0,VKPerigee,CovPerigee,*state); - if(sc.isSuccess()) { - double distRef=(iv.vertex-PrimVrt.position()).perp(); //Distance of already found vertex - double maxDistRatio=-999.; //For selection of the best candidate for given existing vertex - WrkVrt newvrt; newvrt.Good=true; - Trk::Track* TT(0); Rec::TrackParticle* TP(0); xAOD::TrackParticle * xaodTP(0); - if( RECwork ) { - if( m_trkPartCreator ){ - TT = m_fitSvc->CreateTrkTrack(VKPerigee,CovPerigee,*state); - TP=m_trkPartCreator->createParticle(TT); - RECwork->tmpListTracks.clear(); RECwork->tmpListTracks.push_back(TP); - } - } else if(xAODwrk){ - xaodTP=new xAOD::TrackParticle(); xaodTP->makePrivateStore(); - xaodTP->setDefiningParameters(VKPerigee[0],VKPerigee[1],VKPerigee[2],VKPerigee[3],VKPerigee[4]); - std::vector<float> floatCovPerigee(15,0); for(i=0; i<15; i++)floatCovPerigee[i]=(float)CovPerigee[i]; - xaodTP->setDefiningParametersCovMatrixVec(floatCovPerigee); - xaodTP->setParametersOrigin(0.,0.,0.); - //xaodTP->setRadiusOfFirstHit(25.); - xAODwrk->tmpListTracks.clear(); xAODwrk->tmpListTracks.push_back(xaodTP); - } - // - // - cycle over nonused tracks - for(int add=0; add<(int)nonusedTracks.size(); add++){ - if(RECwork){ - RECwork->tmpListTracks.resize(2); //--VK tmpListTracks[0] always contains the PV-SV track - RECwork->tmpListTracks[1]=RECwork->listJetTracks[nonusedTracks[add]]; - sc=VKalVrtFitBase(RECwork->tmpListTracks, newvrt.vertex, newvrt.vertexMom, newvrt.vertexCharge, - newvrt.vertexCov, newvrt.Chi2PerTrk, newvrt.TrkAtVrt, newvrt.Chi2); - }else if(xAODwrk){ - xAODwrk->tmpListTracks.resize(2); //--VK tmpListTracks[0] always contains the PV-SV track - xAODwrk->tmpListTracks[1]=xAODwrk->listJetTracks[nonusedTracks[add]]; - sc=VKalVrtFitBase(xAODwrk->tmpListTracks, newvrt.vertex, newvrt.vertexMom, newvrt.vertexCharge, - newvrt.vertexCov, newvrt.Chi2PerTrk, newvrt.TrkAtVrt, newvrt.Chi2); - } - if( sc.isSuccess() ) { - if(tmpVec.dot(newvrt.vertex-PrimVrt.position())<0.) continue; - if(newvrt.Chi2>addVrtChi2Cut) continue; - double distRatio=(newvrt.vertex-PrimVrt.position()).perp()/distRef; - if( distRatio < 1./20.) continue; // Too close to primary vertex - VrtVrtDist(PrimVrt, newvrt.vertex, newvrt.vertexCov, Signif3D); - if( Signif3D < addSig3DCut) continue; // Too close to primary vertex - newvrt.Good=true; newvrt.vertexCharge +=1.; //Compensate charge of pseudotrack - newvrt.SelTrk.clear(); newvrt.SelTrk.push_back(nonusedTracks[add]); //Add the only nonused track - newvrt.vertexMom=MomAtVrt(newvrt.TrkAtVrt[1]); //Redefine VertexMom using SINGLE REAL track - if(distRatio > maxDistRatio){ if(maxDistRatio!=-999.)AddedVertices.pop_back(); AddedVertices.push_back(newvrt); maxDistRatio=distRatio;} - } - } - if (RECwork){ RECwork->tmpListTracks.clear(); delete TT; delete TP; } - else if(xAODwrk){ xAODwrk->tmpListTracks.clear(); delete xaodTP; } - } - } - //---------Clean added vertices - for(int add=0; add<(int)nonusedTracks.size(); add++){ - int iBestVrt=-1; - double addChi2Min=999999.; //For selection of the best candidate for given track - for(int iv=0; iv<(int)AddedVertices.size(); iv++){ - if(AddedVertices[iv].SelTrk[0]==nonusedTracks[add]){ //Vertex created by given track - if(AddedVertices[iv].Chi2<addChi2Min){ iBestVrt=iv; addChi2Min=AddedVertices[iv].Chi2;} - } - } - if(addChi2Min<999999.)AddedVerticesClean.push_back(AddedVertices.at(iBestVrt)); - } - if(AddedVertices.size()) for(int iv=0; iv<(int)AddedVerticesClean.size(); iv++) GoodVertices.push_back(AddedVerticesClean[iv]); - } - } //--------------- End of one-track-vertex addition -*/ diff --git a/InnerDetector/InDetRecTools/InDetVKalVxInJetTool/src/CutTrk.cxx b/InnerDetector/InDetRecTools/InDetVKalVxInJetTool/src/CutTrk.cxx index f8905ae52b22a60b28cf53f216fac31bdea1d8d7..33f47742896f2efe4cf47b62cf56d717e843edb2 100755 --- a/InnerDetector/InDetRecTools/InDetVKalVxInJetTool/src/CutTrk.cxx +++ b/InnerDetector/InDetRecTools/InDetVKalVxInJetTool/src/CutTrk.cxx @@ -41,80 +41,6 @@ namespace InDet{ return StatusCode::SUCCESS; } - - - - - int InDetVKalVxInJetTool::SelGoodTrkParticle( const std::vector<const Rec::TrackParticle*>& InpTrk, - const xAOD::Vertex & PrimVrt, - const TLorentzVector & JetDir, - std::vector<const Rec::TrackParticle*> & SelectedTracks) - const - { - - std::vector<const Rec::TrackParticle*>::const_iterator i_ntrk; - AmgVector(5) VectPerig; VectPerig.setZero(); - const Trk::Perigee* mPer; - const Trk::FitQuality* TrkQual; - std::vector<double> Impact,ImpactError; - int NPrimTrk=0; - for (i_ntrk = InpTrk.begin(); i_ntrk < InpTrk.end(); ++i_ntrk) { -// -//-- Perigee in TrackParticle -// - mPer=GetPerigee( (*i_ntrk) ) ; - if( mPer == NULL ) continue; - VectPerig = mPer->parameters(); - TrkQual = (*i_ntrk)->fitQuality(); - if(TrkQual && TrkQual->numberDoF()== 0) continue; //Protection - double trkChi2=1.; if(TrkQual) trkChi2=TrkQual->chiSquared() / TrkQual->numberDoF(); - double CovTrkMtx11 = (*(mPer->covariance()))(0,0); - double CovTrkMtx22 = (*(mPer->covariance()))(1,1); - - if ( CovTrkMtx11 > m_a0TrkErrorCut*m_a0TrkErrorCut ) continue; - if ( CovTrkMtx22 > m_zTrkErrorCut*m_zTrkErrorCut ) continue; - if( ConeDist(VectPerig,JetDir) > m_coneForTag ) continue; - if( (*i_ntrk)->pt() > JetDir.Pt() ) continue; - - double trkP=1./fabs(VectPerig[4]); - double CovTrkMtx55 = (*(mPer->covariance()))(4,4); - if(trkP>10000.){ double trkPErr=sqrt(CovTrkMtx55)*trkP; - if(m_fillHist)m_hb_trkPErr->Fill( trkPErr , m_w_1); - if(trkPErr>0.5) continue; } - - long int PixelHits = 3; - long int SctHits = 9; - long int SharedHits = 0; //Always 0 now - long int BLayHits = 1; -//----------------------------------- Summary tools - const Trk::TrackSummary* testSum = (*i_ntrk)->trackSummary(); - PixelHits = (long int) testSum->get(Trk::numberOfPixelHits); - SctHits = (long int) testSum->get(Trk::numberOfSCTHits); - BLayHits = (long int) testSum->get(Trk::numberOfInnermostPixelLayerHits); - if(PixelHits < 0 ) PixelHits=0; - if(SctHits < 0 ) SctHits=0; - if(BLayHits < 0 ) BLayHits=0; -//std::cout<<"NwTrkSummary="<<PixelHits<<", "<<SctHits<<", "<<BLayHits<<", fitter="<<'\n'; - double ImpactSignif = m_fitSvc->VKalGetImpact((*i_ntrk), PrimVrt.position(), 1, Impact, ImpactError); - double ImpactA0=VectPerig[0]; // Temporary - double ImpactZ=VectPerig[1]-PrimVrt.position().z(); // Temporary - ImpactA0=Impact[0]; - ImpactZ=Impact[1]; -//---- - StatusCode sc = CutTrk( VectPerig[4] , VectPerig[3], - ImpactA0 , ImpactZ, trkChi2, - PixelHits, SctHits, SharedHits, BLayHits); - - - if( sc.isFailure() ) continue; - if(ImpactSignif < 3.)NPrimTrk += 1; - SelectedTracks.push_back(*i_ntrk); - } - AnalysisUtils::Sort::pT (&SelectedTracks); // no equivalent for TrkTrack yet... - return NPrimTrk; - } - - //============================================================================================================== // xAOD based stuff // diff --git a/InnerDetector/InDetRecTools/InDetVKalVxInJetTool/src/InDetTrkInJetType.cxx b/InnerDetector/InDetRecTools/InDetVKalVxInJetTool/src/InDetTrkInJetType.cxx index 5dc403055364cc91752c60e6a8a7e048494de5f2..9774358bb371ceb712ad71ca768e4d37f31772ad 100644 --- a/InnerDetector/InDetRecTools/InDetVKalVxInJetTool/src/InDetTrkInJetType.cxx +++ b/InnerDetector/InDetRecTools/InDetVKalVxInJetTool/src/InDetTrkInJetType.cxx @@ -3,15 +3,14 @@ */ #include "InDetVKalVxInJetTool/InDetTrkInJetType.h" -#include "TMVA/MethodBDT.h" -#include "TMVA/Reader.h" #include "PathResolver/PathResolver.h" #include "TLorentzVector.h" #include "TrkVKalVrtFitter/TrkVKalVrtFitter.h" #include "Particle/TrackParticle.h" -#include "MVAUtils/BDT.h" -#include "MVAUtils/TMVAToMVAUtils.h" +#include "MVAUtils/BDT.h" +#include "TFile.h" +#include "TTree.h" #include "GaudiKernel/IChronoStatSvc.h" // //------------------------------------------------- @@ -22,19 +21,18 @@ InDetTrkInJetType::InDetTrkInJetType(const std::string& type, const std::string& name, const IInterface* parent): base_class(type,name,parent), - m_tmvaReader(nullptr), - m_localBDT(nullptr), + m_trkClassBDT(nullptr), m_trkSctHitsCut(4), m_trkPixelHitsCut(1), m_trkChi2Cut(5.), m_trkMinPtCut(700.), - m_jetMaxPtCut(7000000.), + m_jetMaxPtCut(3500000.), m_jetMinPtCut( 35000.), - m_d0_limLow(-3.), + m_d0_limLow(-5.), m_d0_limUpp( 5.), - m_Z0_limLow(-8.), - m_Z0_limUpp(12.), - m_calibFileName("TrackClassif_3cl.v02.xml") + m_Z0_limLow(-15.), + m_Z0_limUpp( 15.), + m_calibFileName("TrackClassif_3cl.v03.root") { declareProperty("trkSctHits", m_trkSctHitsCut , "Cut on track SCT hits number" ); declareProperty("trkPixelHits", m_trkPixelHitsCut , "Cut on track Pixel hits number" ); @@ -51,48 +49,23 @@ InDetTrkInJetType::InDetTrkInJetType(const std::string& type, //Destructor--------------------------------------------------------------- InDetTrkInJetType::~InDetTrkInJetType(){ - if(m_tmvaReader)delete m_tmvaReader; - if(m_localBDT)delete m_localBDT; ATH_MSG_DEBUG("InDetTrkInJetType destructor called"); } //Initialize--------------------------------------------------------------- StatusCode InDetTrkInJetType::initialize(){ m_initialised = 0; - m_tmvaReader = new TMVA::Reader(); - //m_tmvaReader->AddVariable( "prbS", &m_prbS ); - m_tmvaReader->AddVariable( "Sig3D", &m_Sig3D ); - m_tmvaReader->AddVariable( "prbP", &m_prbP ); - m_tmvaReader->AddVariable( "pTvsJet",&m_pTvsJet ); - //m_tmvaReader->AddVariable( "prodTJ", &m_prodTJ ); - m_tmvaReader->AddVariable( "d0", &m_d0 ); - m_tmvaReader->AddVariable( "SigR", &m_SigR ); - m_tmvaReader->AddVariable( "SigZ", &m_SigZ ); - m_tmvaReader->AddVariable( "ptjet", &m_ptjet ); - m_tmvaReader->AddVariable( "ibl" , &m_ibl ); - m_tmvaReader->AddVariable( "bl" , &m_bl ); - m_tmvaReader->AddVariable( "etatrk", &m_etatrk ); // //-- Calibration file // std::string fullPathToFile = PathResolverFindCalibFile("InDetVKalVxInJetTool/"+m_calibFileName); - if(fullPathToFile != ""){ - if(msgLvl(MSG::DEBUG))msg(MSG::DEBUG) <<"TrackClassification calibration file" << fullPathToFile << endmsg; - m_tmvaReader->BookMVA("BDTG", fullPathToFile); - TMVA::MethodBDT* method_bdt = dynamic_cast<TMVA::MethodBDT*> (m_tmvaReader->FindMVA("BDTG")); - if(!method_bdt){ ATH_MSG_DEBUG("Error! No method_BDT for TrackClassification!"); - return StatusCode::SUCCESS; } - bool useYesNoLeaf = false; - bool isGrad = false; - if(method_bdt->GetOptions().Contains("UseYesNoLeaf=True")) useYesNoLeaf = true; - if(method_bdt->GetOptions().Contains("BoostType=Grad")) isGrad = true; - m_localBDT = TMVAToMVAUtils::convert(method_bdt, isGrad, useYesNoLeaf).release(); - if(!m_localBDT){ ATH_MSG_DEBUG("Error! No_BDT from MVAUtils created"); - return StatusCode::SUCCESS; } - }else{ - ATH_MSG_DEBUG("Error! No calibration for TrackClassification found."); - return StatusCode::SUCCESS; - } + std::unique_ptr<TFile> rootFile(TFile::Open(fullPathToFile.c_str(), "READ")); + if (!rootFile) { + ATH_MSG_ERROR("Can not retrieve TrackClassification calibration root file: " << m_calibFileName); + return StatusCode::FAILURE; + } + std::unique_ptr<TTree> training((TTree*)rootFile->Get("BDT")); + m_trkClassBDT =std::make_unique<MVAUtils::BDT>(training.get()); //------- if (m_fitterSvc.retrieve().isFailure()) { ATH_MSG_DEBUG("Could not find Trk::TrkVKalVrtFitter"); @@ -126,17 +99,17 @@ InDetTrkInJetType::InDetTrkInJetType(const std::string& type, { //-- Track quality checks std::vector<float> safeReturn(3,0.); - if( !m_initialised ) return safeReturn; - if(Jet.Perp() > m_jetMaxPtCut)return safeReturn; - if(Trk->pt() < m_trkMinPtCut) return safeReturn; - if(Trk->pt() > Jet.Pt()) return safeReturn; - if(Trk->numberDoF() == 0) return safeReturn; //Safety + if( !m_initialised ) return safeReturn; + double wrkJetPt= Jet.Perp() < m_jetMaxPtCut ? Jet.Perp() : m_jetMaxPtCut; // Jet above m_jetMaxPtCut is considered as having m_jetMaxPtCut + if(Trk->pt() < m_trkMinPtCut) return safeReturn; // Don't classify track below m_trkMinPtCut + if(Trk->pt() > wrkJetPt) return safeReturn; // Don't classify track with Pt above JetPt + if(Trk->numberDoF() == 0) return safeReturn; // Safety if(Trk->chiSquared()/Trk->numberDoF() > m_trkChi2Cut) return safeReturn; uint8_t PixelHits,SctHits; if( !(Trk->summaryValue(PixelHits,xAOD::numberOfPixelHits)) ) return safeReturn; // No Pixel hits. Bad. if( !(Trk->summaryValue( SctHits,xAOD::numberOfSCTHits)) ) return safeReturn; // No SCT hits. Bad. - if( PixelHits < m_trkPixelHitsCut ) return safeReturn; - if( SctHits < m_trkSctHitsCut ) return safeReturn; + if( PixelHits < m_trkPixelHitsCut ) return safeReturn; + if( SctHits < m_trkSctHitsCut ) return safeReturn; std::vector<double> Impact,ImpactError; float Sig3D=m_fitSvc->VKalGetImpact(Trk, PV.position(), 1, Impact, ImpactError); @@ -147,11 +120,9 @@ InDetTrkInJetType::InDetTrkInJetType(const std::string& type, else{ Impact[1] = fabs(Impact[1]);} double SignifR = Impact[0]/ sqrt(ImpactError[0]); double SignifZ = Impact[1]/ sqrt(ImpactError[2]); - double trkSignif = sqrt( (SignifR+0.6)*(SignifR+0.6) + (SignifZ+0.0)*(SignifZ+0.0) ); //---Calibrated range selection - if(Impact[0]<m_d0_limLow || Impact[0]>m_d0_limUpp) return safeReturn; - if(Impact[0]<m_Z0_limLow || Impact[0]>m_Z0_limUpp) return safeReturn; - if( sqrt(SignifR*SignifR +SignifZ*SignifZ) < 1.) return safeReturn; + if(Impact[1]<m_Z0_limLow || Impact[1]>m_Z0_limUpp) return safeReturn; //Don't classify track far from PV in Z + if( sqrt(SignifR*SignifR +SignifZ*SignifZ) < 1.) return safeReturn; //Don't classify track too close to PV //---IBL/BL hits int hitIBL=0, hitBL=0; uint8_t IBLhit,BLhit,IBLexp,BLexp; @@ -180,36 +151,27 @@ InDetTrkInJetType::InDetTrkInJetType(const std::string& type, */ //====================== BDT weights double coeffPt=10.; - double pfrac=(Trk->pt()-m_trkMinPtCut)/sqrt(Jet.Perp()); + double pfrac=(Trk->pt()-m_trkMinPtCut)/sqrt(wrkJetPt); float prbP= pfrac/(coeffPt+pfrac); float etatrk=Trk->eta(); //--- double coeffSig=1.0; - if(trkSignif<coeffSig) return safeReturn; - float prbS=(trkSignif-coeffSig)/trkSignif; - if(prbS<0.) return safeReturn; + if(Sig3D<coeffSig) return safeReturn; // Safety //--- - float d0=Impact[0]; + float d0=Impact[0]; d0=std::max(d0,m_d0_limLow); d0=std::min(d0,m_d0_limUpp); //Track float SigZ=SignifZ; float SigR=SignifR; //--- - float ptjet=Jet.Perp(); - if(ptjet<m_jetMinPtCut)ptjet=m_jetMinPtCut; //Very low jet pt is replaced by Pt=35GeV -//--- - float ibl = (float)hitIBL; - float bl = (float)hitBL; + float ptjet=wrkJetPt>m_jetMinPtCut ? wrkJetPt : m_jetMinPtCut ; //Very low jet pt is replaced by Pt=35GeV //--- TLorentzVector TLV; TLV.SetPtEtaPhiE(Trk->pt(),Trk->eta(),Trk->phi(),Trk->e()); float pTvsJet=TLV.Perp(Jet.Vect()); -//--- - TLorentzVector normJ; normJ.SetPtEtaPhiM(1.,Jet.Eta(),Jet.Phi(),0.); //--- if(m_timingProfile)m_timingProfile->chronoStart("InDet_TrkInJetType"); - //std::vector<float> weights=m_tmvaReader->EvaluateMulticlass("BDTG"); //-----Use MVAUtils to save CPU - std::vector<float> bdt_vars={Sig3D, prbP, pTvsJet, d0, SigR, SigZ, ptjet, ibl, bl, etatrk}; - std::vector<float> weights=m_localBDT->GetMultiResponse(bdt_vars,3); + std::vector<float> bdt_vars={Sig3D, prbP, pTvsJet, d0, SigR, SigZ, ptjet, (float)hitIBL, (float)hitBL, etatrk}; + std::vector<float> weights=m_trkClassBDT->GetMultiResponse(bdt_vars,3); //----- if(m_timingProfile)m_timingProfile->chronoStop("InDet_TrkInJetType"); return weights; diff --git a/InnerDetector/InDetRecTools/InDetVKalVxInJetTool/src/InDetVKalVxInJetTool.cxx b/InnerDetector/InDetRecTools/InDetVKalVxInJetTool/src/InDetVKalVxInJetTool.cxx index 8b74b0756b2592be5fb07dfd4abfe06152c3b8af..1d9ca38af318cc4d1ecdbeafbd42c8f77380d814 100755 --- a/InnerDetector/InDetRecTools/InDetVKalVxInJetTool/src/InDetVKalVxInJetTool.cxx +++ b/InnerDetector/InDetRecTools/InDetVKalVxInJetTool/src/InDetVKalVxInJetTool.cxx @@ -465,7 +465,7 @@ InDetVKalVxInJetTool::InDetVKalVxInJetTool(const std::string& type, tmpVectxAOD->InpTrk.resize(InpTrk.size()); std::copy(InpTrk.begin(),InpTrk.end(), tmpVectxAOD->InpTrk.begin()); //////listVrtSec = GetVrtSecMulti(InpTrk,PrimVrt,JetDir,Results,SelSecTrkPerVrt,TrkFromV0); - listVrtSec = GetVrtSecMulti(tmpVectxAOD,0,PrimVrt,JetDir,Results); + listVrtSec = GetVrtSecMulti(tmpVectxAOD,PrimVrt,JetDir,Results); SelSecTrkPerVrt.swap(tmpVectxAOD->FoundSecondTracks); xaodTrkFromV0.swap(tmpVectxAOD->TrkFromV0); delete tmpVectxAOD; @@ -508,63 +508,5 @@ InDetVKalVxInJetTool::InDetVKalVxInJetTool(const std::string& type, - Trk::VxSecVertexInfo* InDetVKalVxInJetTool::findSecVertex(const Trk::RecVertex & PrimVrt, - const TLorentzVector & JetDir, - const std::vector<const Trk::TrackParticleBase*> & InpTrkBase) - const { - if(m_timingProfile)m_timingProfile->chronoStart("InDetVKalVxInJetTool"); - std::vector<double> Results; - std::vector<const Rec::TrackParticle*> SelSecTrk; - std::vector< std::vector<const Rec::TrackParticle*> > SelSecTrkPerVrt; - std::vector<const Rec::TrackParticle*> TrkFromV0; - std::vector<xAOD::Vertex*> listVrtSec(0); - std::vector<const Rec::TrackParticle*> InpTrk = BaseToPart(InpTrkBase) ; - double SecVtxMass = 0.; - double RatioE = 0.; - double EnergyJet = 0.; - int N2trVertices = 0 ; - if(m_curTup){ m_curTup->nVrt=0; m_curTup->nTrkInJet=0; m_curTup->nNVrt=0; m_curTup->NTHF=0; } - - xAOD::Vertex xaodPrimVrt; - xaodPrimVrt.setPosition(PrimVrt.position()); - xaodPrimVrt.setCovariancePosition(PrimVrt.covariancePosition()); - - if(m_multiVertex){ - workVectorArrREC * tmpVectREC=new workVectorArrREC(); - tmpVectREC->InpTrk.resize(InpTrk.size()); - std::copy(InpTrk.begin(),InpTrk.end(), tmpVectREC->InpTrk.begin()); - //////listVrtSec = GetVrtSecMulti(InpTrk,xaodPrimVrt,JetDir,Results,SelSecTrkPerVrt,TrkFromV0); - listVrtSec = GetVrtSecMulti(0,tmpVectREC,xaodPrimVrt,JetDir,Results); - SelSecTrkPerVrt.swap(tmpVectREC->FoundSecondTracks); - TrkFromV0.swap(tmpVectREC->TrkFromV0); - delete tmpVectREC; - }else{ - xAOD::Vertex* secVrt = GetVrtSec( InpTrk,xaodPrimVrt,JetDir,Results,SelSecTrk,TrkFromV0); - if(secVrt != 0) listVrtSec.push_back(secVrt); - else if(m_fillHist){ m_pr_effVrt->Fill((float)m_NRefPVTrk,0.); - m_pr_effVrtEta->Fill( JetDir.Eta(),0.);} - } - if(Results.size()<3) { - listVrtSec.clear(); - }else{ - SecVtxMass = Results[0]; - RatioE = Results[1]; - N2trVertices = (int)Results[2]; - EnergyJet = Results[6]; - } - Trk::VxSecVKalVertexInfo* res = - new Trk::VxSecVKalVertexInfo(listVrtSec, SecVtxMass, RatioE, N2trVertices, EnergyJet, PartToBase(TrkFromV0) ); - if(Results.size()>8)res->setDstToMatLay(Results[7]); - - if(m_fillHist){ m_tuple->Fill(); }; - m_compatibilityGraph->clear(); - std::vector<int> zytmp(1000); m_WorkArray->m_Incomp.swap(zytmp); // Deallocate memory - std::vector<int> zwtmp(0); m_WorkArray->m_Prmtrack.swap(zwtmp); // - if(m_timingProfile)m_timingProfile->chronoStop("InDetVKalVxInJetTool"); - return res; - -// return new Trk::VxSecVertexInfo(listVrtSec); - - } } // end InDet namespace diff --git a/InnerDetector/InDetRecTools/InDetVKalVxInJetTool/src/Utilities.cxx b/InnerDetector/InDetRecTools/InDetVKalVxInJetTool/src/Utilities.cxx index b7069acde9af707b46429c02bcee62e83cd9d7aa..056c5fc85fa76e776344addd63cefe0d4da77fe0 100755 --- a/InnerDetector/InDetRecTools/InDetVKalVxInJetTool/src/Utilities.cxx +++ b/InnerDetector/InDetRecTools/InDetVKalVxInJetTool/src/Utilities.cxx @@ -500,40 +500,9 @@ namespace InDet{ double ee = sqrt( px*px + py*py + pz*pz + m_massPi*m_massPi); return TLorentzVector(px,py,pz,ee); } -// -// Get vector of Perigee for kinematical calculations -// - std::vector<const Trk::Perigee*> InDetVKalVxInJetTool::GetPerigeeVector( const std::vector<const Rec::TrackParticle*>& InpTrk) - const - { - std::vector<const Trk::Perigee*> tmp; - for (int i = 0; i < (int)InpTrk.size(); ++i) tmp.push_back( GetPerigee( InpTrk[i] ) ) ; - return tmp; - } - std::vector<const Trk::Perigee*> InDetVKalVxInJetTool::GetPerigeeVector( const std::vector<const Trk::TrackParticleBase*>& InpTrk) - const - { - std::vector<const Trk::Perigee*> tmp; - for (int i = 0; i < (int)InpTrk.size(); ++i) { - const Rec::TrackParticle* tmpP = dynamic_cast<const Rec::TrackParticle*> (InpTrk[i]); - if(tmpP)tmp.push_back( GetPerigee( tmpP ) ) ; - } - return tmp; - } - - - - - // //-- Perigee in Rec::TrackParticle, Trk::Track and xAOD::TrackParticle // - const Trk::Perigee* InDetVKalVxInJetTool::GetPerigee( const Rec::TrackParticle* i_ntrk) - const - { - return i_ntrk->perigee(); - } - const Trk::Perigee* InDetVKalVxInJetTool::GetPerigee( const xAOD::TrackParticle* i_ntrk) const @@ -546,42 +515,16 @@ namespace InDet{ // // Needed translation from Rec::TrackParticle to Trk::TrackParticleBase // - StatusCode InDetVKalVxInJetTool::VKalVrtFitFastBase(const std::vector<const xAOD::TrackParticle*>& listTrk, - Amg::Vector3D & FitVertex, - Trk::IVKalState& istate) - const - { return m_fitSvc->VKalVrtFitFast(listTrk,FitVertex,istate); } - - StatusCode InDetVKalVxInJetTool::VKalVrtFitFastBase(const std::vector<const Rec::TrackParticle*>& listPart, - Amg::Vector3D & FitVertex, - Trk::IVKalState& istate) - const - { - std::vector <const Trk::TrackParticleBase*> listBase; - for(int i=0; i<(int)listPart.size(); i++) { - listBase.push_back( (const Trk::TrackParticleBase*)listPart[i]); - } - return m_fitSvc->VKalVrtFitFast(listBase,FitVertex,istate); /* Fast crude estimation */ - } - - - StatusCode InDetVKalVxInJetTool::VKalVrtFitBase(const std::vector<const Rec::TrackParticle*> & listPart, - Amg::Vector3D& Vertex, - TLorentzVector& Momentum, - long int& Charge, - std::vector<double>& ErrorMatrix, - std::vector<double>& Chi2PerTrk, - std::vector< std::vector<double> >& TrkAtVrt, - double& Chi2, - Trk::IVKalState& istate, - bool ifCovV0) const + StatusCode + InDetVKalVxInJetTool::VKalVrtFitFastBase( + const std::vector<const xAOD::TrackParticle*>& listTrk, + Amg::Vector3D& FitVertex, + Trk::IVKalState& istate) const { - return m_fitSvc->VKalVrtFit( PartToBase(listPart), Vertex, Momentum, Charge, - ErrorMatrix, Chi2PerTrk, TrkAtVrt, Chi2, - istate, ifCovV0 ); - + return m_fitSvc->VKalVrtFitFast(listTrk, FitVertex, istate); } + StatusCode InDetVKalVxInJetTool::VKalVrtFitBase(const std::vector<const xAOD::TrackParticle*> & listPart, Amg::Vector3D& Vertex, TLorentzVector& Momentum, @@ -606,17 +549,6 @@ namespace InDet{ return m_fitSvc->VKalGetTrkWeights(wgt, istate); } /*************************************************************************************************************/ - void InDetVKalVxInJetTool::getPixelLayers(const Rec::TrackParticle* Part, int &blHit, int &l1Hit, int &l2Hit, int &nLays ) const - { - blHit=l1Hit=l2Hit=nLays=0; - const Trk::TrackSummary* testSum = Part->trackSummary(); - if(testSum){ - if(testSum->isHit(Trk::pixelBarrel0))blHit=1; - if(testSum->isHit(Trk::pixelBarrel1))l1Hit=1; - if(testSum->isHit(Trk::pixelBarrel2))l2Hit=1; - } - nLays=blHit+l1Hit+l2Hit; - } void InDetVKalVxInJetTool::getPixelLayers(const xAOD::TrackParticle* Part, int &blHit, int &l1Hit, int &l2Hit, int &nLays ) const { blHit=l1Hit=l2Hit=nLays=0; @@ -677,10 +609,6 @@ namespace InDet{ splshBL=share+split; } } - void InDetVKalVxInJetTool::getPixelProblems(const Rec::TrackParticle* , int &splshIBL, int &splshBL ) const - { - splshIBL=splshBL=0; // Temporary implementation - } void InDetVKalVxInJetTool::getPixelDiscs(const xAOD::TrackParticle* Part, int &d0Hit, int &d1Hit, int &d2Hit) const { uint32_t HitPattern=Part->hitPattern(); @@ -688,40 +616,8 @@ namespace InDet{ d1Hit=0; if( HitPattern&((1<<Trk::pixelEndCap1)) ) d1Hit=1; d2Hit=0; if( HitPattern&((1<<Trk::pixelEndCap2)) ) d2Hit=1; } - void InDetVKalVxInJetTool::getPixelDiscs(const Rec::TrackParticle* Part, int &d0Hit, int &d1Hit, int &d2Hit) const - { - const Trk::TrackSummary* testSum = Part->trackSummary(); - if(testSum){ - if(testSum->isHit(Trk::pixelEndCap0))d0Hit=1; - if(testSum->isHit(Trk::pixelEndCap1))d1Hit=1; - if(testSum->isHit(Trk::pixelEndCap2))d2Hit=1; - } else d0Hit=d1Hit=d2Hit=0; - } /*************************************************************************************************************/ - const std::vector<const Trk::TrackParticleBase*> - InDetVKalVxInJetTool::PartToBase(const std::vector<const Rec::TrackParticle*> & listPart) - const - { - std::vector <const Trk::TrackParticleBase*> listBase; - for(int i=0; i<(int)listPart.size(); i++) { - listBase.push_back( (const Trk::TrackParticleBase*)listPart[i]); - } - return listBase; - } - - const std::vector<const Rec::TrackParticle*> - InDetVKalVxInJetTool::BaseToPart(const std::vector<const Trk::TrackParticleBase*> & listBase) - const - { - std::vector <const Rec::TrackParticle*> listPart; - for(int i=0; i<(int)listBase.size(); i++) { - listPart.push_back( dynamic_cast<const Rec::TrackParticle*> (listBase[i])); - } - return listPart; - } - - Amg::MatrixX InDetVKalVxInJetTool::SetFullMatrix(int NTrk, std::vector<double> & Matrix) const { diff --git a/InnerDetector/InDetRecTools/InDetVKalVxInJetTool/test/InDetTrkInJetType_test.cxx b/InnerDetector/InDetRecTools/InDetVKalVxInJetTool/test/InDetTrkInJetType_test.cxx index fec643bcd22eae65fe8cdb1484087b89e3183987..9026cdf2fe77763b63b82153c6edbe8c12b7ceab 100644 --- a/InnerDetector/InDetRecTools/InDetVKalVxInJetTool/test/InDetTrkInJetType_test.cxx +++ b/InnerDetector/InDetRecTools/InDetVKalVxInJetTool/test/InDetTrkInJetType_test.cxx @@ -100,9 +100,9 @@ void test1 (InDet::IInDetTrkInJetType& tool) std::vector<float> out = tool.trkTypeWgts (&tp, pv, j); assert( out.size() == 3 ); - assert( Athena_test::isEqual (out[0], 0.0946472, 1e-5) ); - assert( Athena_test::isEqual (out[1], 0.479743, 1e-5) ); - assert( Athena_test::isEqual (out[2], 0.42561, 1e-5) ); + assert( Athena_test::isEqual (out[0], 0.107339, 1e-5) ); + assert( Athena_test::isEqual (out[1], 0.851263, 1e-5) ); + assert( Athena_test::isEqual (out[2], 0.0413975, 1e-5) ); std::cout << "test1 is OK\n"; } diff --git a/MuonSpectrometer/MSVertexReconstruction/MSVertexRecoAlg/CMakeLists.txt b/MuonSpectrometer/MSVertexReconstruction/MSVertexRecoAlg/CMakeLists.txt index c736806367ec9f221fcef1d71116fdc93f71ce92..47d231a5e96c53042a0d322f6e0a975fb048fc8b 100644 --- a/MuonSpectrometer/MSVertexReconstruction/MSVertexRecoAlg/CMakeLists.txt +++ b/MuonSpectrometer/MSVertexReconstruction/MSVertexRecoAlg/CMakeLists.txt @@ -17,7 +17,7 @@ atlas_depends_on_subdirs( PUBLIC atlas_add_component( MSVertexRecoAlg src/*.cxx src/components/*.cxx - LINK_LIBRARIES AthenaBaseComps GaudiKernel MSVertexUtils ) + LINK_LIBRARIES AthenaBaseComps GaudiKernel MSVertexUtils MSVertexToolInterfaces ) # Install files from the package: atlas_install_headers( MSVertexRecoAlg ) diff --git a/MuonSpectrometer/MSVertexReconstruction/MSVertexTools/CMakeLists.txt b/MuonSpectrometer/MSVertexReconstruction/MSVertexTools/CMakeLists.txt index d9c0aa3b1d7a09339b954fc3a1a1e6d1326a4304..4f5d282f73ddf65c84d82873c3795f0c383ca789 100644 --- a/MuonSpectrometer/MSVertexReconstruction/MSVertexTools/CMakeLists.txt +++ b/MuonSpectrometer/MSVertexReconstruction/MSVertexTools/CMakeLists.txt @@ -33,4 +33,4 @@ atlas_add_component( MSVertexTools src/*.cxx src/components/*.cxx INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} - LINK_LIBRARIES ${CLHEP_LIBRARIES} ${EIGEN_LIBRARIES} AthenaBaseComps AthenaKernel AthContainers StoreGateLib SGtests GeoPrimitives Identifier EventPrimitives xAODTracking GaudiKernel MSVertexUtils MuonReadoutGeometry MuonIdHelpersLib MuonPrepRawData TrkParameters TrkExInterfaces ) + LINK_LIBRARIES ${CLHEP_LIBRARIES} ${EIGEN_LIBRARIES} AthenaBaseComps AthenaKernel AthContainers StoreGateLib SGtests GeoPrimitives Identifier EventPrimitives xAODTracking GaudiKernel MSVertexUtils MuonReadoutGeometry MuonIdHelpersLib MuonPrepRawData TrkParameters TrkExInterfaces MSVertexToolInterfaces ) diff --git a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibDbAsciiTool/CMakeLists.txt b/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibDbAsciiTool/CMakeLists.txt deleted file mode 100644 index 0ff406b72e7919f56c9d86d08681d7592f38f346..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibDbAsciiTool/CMakeLists.txt +++ /dev/null @@ -1,40 +0,0 @@ -################################################################################ -# Package: MdtCalibDbAsciiTool -################################################################################ - -# Declare the package name: -atlas_subdir( MdtCalibDbAsciiTool ) - -# Declare the package's dependencies: -atlas_depends_on_subdirs( PUBLIC - Control/AthenaBaseComps - GaudiKernel - MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibData - MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibInterfaces - PRIVATE - Control/AthenaKernel - Control/SGTools - Control/StoreGate - DetectorDescription/Identifier - MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibSvc - MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibUtils - MuonSpectrometer/MuonCalib/MuonCalibUtils/MuonCalibStl - MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry - MuonSpectrometer/MuonIdHelpers - Tools/PathResolver ) - -# External dependencies: -find_package( CLHEP ) - -# Component(s) in the package: -atlas_add_component( MdtCalibDbAsciiTool - src/*.cxx - src/components/*.cxx - INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} - LINK_LIBRARIES ${CLHEP_LIBRARIES} AthenaBaseComps GaudiKernel MdtCalibData AthenaKernel SGTools StoreGateLib SGtests Identifier MdtCalibSvcLib MdtCalibUtils MuonReadoutGeometry MuonIdHelpersLib PathResolver ) - -# Install files from the package: -atlas_install_headers( MdtCalibDbAsciiTool ) -atlas_install_joboptions( share/*.py ) -atlas_install_runtime( share/DC2_rt_asciiDb.dat ) - diff --git a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibDbAsciiTool/MdtCalibDbAsciiTool/MdtCalibDbAsciiTool.h b/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibDbAsciiTool/MdtCalibDbAsciiTool/MdtCalibDbAsciiTool.h deleted file mode 100644 index 1bd9bba2773a4b1d6f6eae0c471bfa1806df67a4..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibDbAsciiTool/MdtCalibDbAsciiTool/MdtCalibDbAsciiTool.h +++ /dev/null @@ -1,112 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef MDTCALIBDB_MDTCALIBDBASCIITOOL_H -#define MDTCALIBDB_MDTCALIBDBASCIITOOL_H - -#include "AthenaBaseComps/AthAlgTool.h" -#include "GaudiKernel/ServiceHandle.h" -#include "MdtCalibInterfaces/IMdtCalibDBTool.h" -#include "MdtCalibData/MdtTubeCalibContainerCollection.h" -#include "MdtCalibData/MdtRtRelationCollection.h" -#include "MuonIdHelpers/IMuonIdHelperSvc.h" -#include "MuonReadoutGeometry/MuonDetectorManager.h" - -#include "CLHEP/Random/RandomEngine.h" - -class IAtRndmGenSvc; -class MdtCalibrationRegionSvc; - -namespace MuonCalib { - -class MdtCalibDbAsciiTool: public AthAlgTool, - virtual public IMdtCalibDBTool -{ - -public: - - /** constructor */ - MdtCalibDbAsciiTool(const std::string& type, - const std::string& name, - const IInterface* parent); - - /** required by the IAddressProvider interface */ - virtual StatusCode updateAddress(StoreID::type storeID, - SG::TransientAddress* tad, - const EventContext& ctx); - -private: - - /** Tool initialization */ - StatusCode initialize(); - - /** retrieve from database all the constants: dummy*/ - virtual StatusCode LoadCalibration(IOVSVC_CALLBACK_ARGS); - /** retrieve from database the Rt function(s): dummy*/ - virtual StatusCode loadRt(IOVSVC_CALLBACK_ARGS) {return StatusCode::SUCCESS;}; - /** retrieve from database the T0s: dummy*/ - virtual StatusCode loadTube(IOVSVC_CALLBACK_ARGS) {return StatusCode::SUCCESS;}; - - /** initialize the transient classes for T0s */ - StatusCode defaultT0s(); - /** initialize the transient classes for Rt */ - StatusCode defaultRt(); - /** Build a MuonCalib::MdtTubeCalibContainer for a given Identifier - * @return the MuonCalib::MdtTubeCalibContainer - * @param[in] const reference to the Identifier - */ - MdtTubeCalibContainer * buildMdtTubeCalibContainer(const Identifier& id); - - /** append all rt files from calibration directory */ - void AppendRtFiles(std::vector<std::string> & filenames); - /** interprets file names in the calibration directory */ - bool interpret_chamber_name(const std::string &nm, const char *prefix, std::string & station, int &eta, int & phi) const; - - ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; - - // MuonDetectorManager from the conditions store - SG::ReadCondHandleKey<MuonGM::MuonDetectorManager> m_DetectorManagerKey {this, "DetectorManagerKey", - "MuonDetectorManager", - "Key of input MuonDetectorManager condition data"}; - - MdtCalibrationRegionSvc* m_regionSvc; - mutable MdtTubeCalibContainerCollection * m_tubeData; - mutable MdtRtRelationCollection * m_rtData; - - bool m_doCommissioning; - double m_bilt0; - double m_bist0; - double m_bmlt0; - double m_bmst0; - double m_bolt0; - double m_bost0; - double m_eilt0; - double m_eist0; - double m_emlt0; - double m_emst0; - double m_eolt0; - double m_eost0; - - StringArrayProperty m_RTfileNames; - - std::string m_rtDataLocation; - std::string m_tubeDataLocation; - -//!directory containing calibratino files as written by the standalone_tarball -//!if set to anythin other than NONE, it overrides all other job options. - std::string m_calib_dir; - - double m_t0Shift; - double m_t0Spread; - double m_rtShift; - - IAtRndmGenSvc* p_AtRndmGenSvc; - CLHEP::HepRandomEngine* p_engine; - -}; - -} - -#endif - diff --git a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibDbAsciiTool/MdtCalibDbAsciiTool/StationT0FromFile.h b/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibDbAsciiTool/MdtCalibDbAsciiTool/StationT0FromFile.h deleted file mode 100644 index d091b337360b6d893b3ca32e216efdb07cdadd42..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibDbAsciiTool/MdtCalibDbAsciiTool/StationT0FromFile.h +++ /dev/null @@ -1,70 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -// 01.02.2007, AUTHOR: OLIVER KORTNER -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - -#ifndef MuonCalib_StationT0FromFileH -#define MuonCalib_StationT0FromFileH - -//::::::::::::::::::::::::::::::::: -//:: CLASS StationT0FromFile :: -//::::::::::::::::::::::::::::::::: - -/// \class StationT0FromFile -/// -/// This class is used to read a t0 text file for a given station and to -/// provide the t0s to the user. It is meant to be an auxiliary class for -/// the stand-alone calibration programme. It might be possible in the future -/// to drop this class. -/// -/// \author Oliver.Kortner@CERN.CH -/// -/// \date 01.02.2007 - -//:::::::::::::::::: -//:: HEADER FILES :: -//:::::::::::::::::: - -// STL // -#include <vector> -#include <string> - -namespace MuonCalib { - -class StationT0FromFile { - -public: -// Constructors // - StationT0FromFile(void) { - init(); - } - ///< Default constructor. - -// Methods // -// get methods // - double t0(const unsigned int & ml, const unsigned int & ly, - const unsigned int & tb) const; - ///< get the t0 value of the tube tb - ///< in layer ly of multilayer ml; - ///< tb, ly, ml>0 - -// set methods // - void readT0File(std::istream &infile); - ///< read the t0s stored in the file - ///< "file_name" - -private: -// t0s // - std::vector< std::vector< std::vector <double> > > m_t0; // t0 values - -// private methods // - void init(void); // initialization method - -}; - -} - -#endif diff --git a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibDbAsciiTool/doc/packagedoc.h b/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibDbAsciiTool/doc/packagedoc.h deleted file mode 100644 index 2198f8869ddd92228346c57dfbc6531c705bc384..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibDbAsciiTool/doc/packagedoc.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -/** -@page MdtCalibDbAsciiTool_page MdtCalibDbAsciiTool Package -@author Domizia.Orestano@cern.ch - -@section MdtCalibDbAsciiTool_MdtCalibDbAsciiToolIntro Introduction -This Tool is used by MdtCalibrationDbSvc to retreive some default -calibration constants (from ASCII files declared in jobOptions and from jobOptions), -unpack them and fill the transient classes used by the service. -No IOV is provided for these classes which are intended to be valid for -all the processed events. -For IOV based access to conditions DB please configure MdtCalibrationSvc to use -MdtCalibDbCoolStrTool instead. - -@section MdtCalibDbAsciiTool_MdtCalibDbAsciiToolOverview Class Overview -The package contains a single Tool, -MuonCalib::MdtCalibDbAsciiTool, inheriting from MuonCalib::IMdtCalibDB. -The Tool default options are set in the constructor - -- a single Rt function -for all the MDT chambers taken from the file DC2_rt_asciiDb.dat (default -option for the RT_InputFiles property) - -- all T0s set to 800 ns - -In addition for specific studies on simulated data it is possible to alter the -T0s by shifting them (T0Shift property in ns) and/or smearing them with a -gaussian of given sigma (T0Spread property in ns) and to distort -the default Rt function by a maximum amount in mm (RTShift property). - -For commissioning data (not for commissioning simulation) setting to -true the doCommissioning property sets all T0s to a default which is 150 ns -and enables the usage of the next set of options - -- BMLT0: sets all the BML chambers T0s to the desired value - -- BOLT0: sets all the BOL chambers T0s to the desired value - -- etc...for a large number of types of chambers currently being commissioned -(see the full list in the genConf/MdtCalibDbAsciiToolConf.py file, produced under the root directory of the package after building). - -- RT_InputFiles: if more than one file is listed it is assumed that one -file for each chamber under study will be provided. It is then necessary to -set the penultimate number in the header (first line) -of each file to the hash identifier -of the chamber. To find out the hash identifier XXX of a chamber -do a trial run with few events -setting the OutputLevel to VERBOSE and look in the output for the string -"Adding chamber " followed by "adding tubes at XXX". - - -*/ diff --git a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibDbAsciiTool/share/DC2_rt_asciiDb.dat b/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibDbAsciiTool/share/DC2_rt_asciiDb.dat deleted file mode 100644 index cb36bdba33cf8a0ad845aff286d1d497b8a94a1b..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibDbAsciiTool/share/DC2_rt_asciiDb.dat +++ /dev/null @@ -1,385 +0,0 @@ -v0.0 1 dummy 0 383 -0.0692666 6.68 0.3 -0.0692666 8.52 0.3 -0.106606 10.36 0.3 -0.115798 12.2 0.3 -0.149383 14.04 0.3 -0.194783 15.88 0.3 -0.218959 17.72 0.3 -0.271053 19.56 0.3 -0.346581 21.4 0.3 -0.39999 23.24 0.3 -0.462598 25.08 0.3 -0.540452 26.92 0.3 -0.614479 28.76 0.3 -0.695729 30.6 0.3 -0.761292 32.44 0.3 -0.85107 34.28 0.3 -0.925544 36.12 0.3 -1.04843 37.96 0.3 -1.11038 39.8 0.3 -1.21077 41.64 0.3 -1.27254 43.48 0.298039 -1.37727 45.32 0.286743 -1.45551 47.16 0.279704 -1.56014 49 0.27715 -1.66297 50.84 0.215272 -1.74228 52.68 0.235402 -1.82712 54.52 0.251147 -1.92306 56.36 0.195674 -2.00964 58.2 0.237623 -2.10612 60.04 0.17815 -2.19337 61.88 0.190519 -2.27856 63.72 0.166802 -2.37668 65.56 0.130951 -2.46557 67.4 0.161228 -2.5453 69.24 0.164203 -2.641 71.08 0.130774 -2.73841 72.92 0.123661 -2.83257 74.76 0.119747 -2.91319 76.6 0.117532 -2.9954 78.44 0.115198 -3.08733 80.28 0.121306 -3.17744 82.12 0.112382 -3.26312 83.96 0.11536 -3.35153 85.8 0.112813 -3.43497 87.64 0.111024 -3.51504 89.48 0.113917 -3.60376 91.32 0.103612 -3.69906 93.16 0.109352 -3.77209 95 0.109998 -3.86832 96.84 0.104344 -3.93755 98.68 0.105225 -4.02426 100.52 0.0995542 -4.10341 102.36 0.104592 -4.17975 104.2 0.10635 -4.25542 106.04 0.0986078 -4.34286 107.88 0.0980133 -4.41498 109.72 0.0979933 -4.49335 111.56 0.0973853 -4.56783 113.4 0.0935731 -4.63394 115.24 0.0946994 -4.71302 117.08 0.0798167 -4.78126 118.92 0.0948228 -4.8599 120.76 0.0932177 -4.92562 122.6 0.0912063 -5.00663 124.44 0.0925192 -5.06404 126.28 0.092037 -5.13151 128.12 0.0868296 -5.19989 129.96 0.0923416 -5.27062 131.8 0.0867673 -5.32751 133.64 0.0863303 -5.39187 135.48 0.0903376 -5.46612 137.32 0.0889405 -5.51375 139.16 0.0821907 -5.58699 141 0.0847349 -5.64455 142.84 0.0844367 -5.69487 144.68 0.0837068 -5.77322 146.52 0.0892484 -5.81754 148.36 0.0800767 -5.88264 150.2 0.0842706 -5.93412 152.04 0.0815737 -5.99061 153.88 0.0805264 -6.04939 155.72 0.0818535 -6.10854 157.56 0.0834201 -6.16493 159.4 0.0842525 -6.21937 161.24 0.0803931 -6.26826 163.08 0.0813391 -6.3219 164.92 0.080909 -6.38101 166.76 0.0801943 -6.43175 168.6 0.0780698 -6.48824 170.44 0.083649 -6.53471 172.28 0.0838482 -6.59491 174.12 0.0849841 -6.63795 175.96 0.0815375 -6.69567 177.8 0.0810432 -6.74135 179.64 0.077515 -6.7892 181.48 0.0746774 -6.83742 183.32 0.0762357 -6.89012 185.16 0.0766787 -6.93041 187 0.0753165 -6.98222 188.84 0.0765539 -7.02411 190.68 0.0738602 -7.07541 192.52 0.0751457 -7.12109 194.36 0.0771605 -7.16915 196.2 0.0718856 -7.21595 198.04 0.0749982 -7.26019 199.88 0.0727997 -7.30849 201.72 0.0794686 -7.34632 203.56 0.0702919 -7.38823 205.4 0.0689174 -7.4371 207.24 0.0729357 -7.48421 209.08 0.0733747 -7.52781 210.92 0.0759943 -7.57027 212.76 0.0774237 -7.60875 214.6 0.0818526 -7.64949 216.44 0.0747268 -7.69832 218.28 0.0711351 -7.74153 220.12 0.0769696 -7.78006 221.96 0.0733954 -7.81308 223.8 0.0733518 -7.86271 225.64 0.0765799 -7.90155 227.48 0.0697613 -7.94517 229.32 0.0707408 -7.98909 231.16 0.0687903 -8.02649 233 0.077148 -8.06674 234.84 0.073534 -8.09826 236.68 0.0695646 -8.14654 238.52 0.0695575 -8.17869 240.36 0.0735805 -8.22393 242.2 0.0645211 -8.26675 244.04 0.0734289 -8.29988 245.88 0.0726436 -8.34035 247.72 0.0770289 -8.36605 249.56 0.066324 -8.41348 251.4 0.0712202 -8.45217 253.24 0.0597781 -8.49333 255.08 0.0712224 -8.5286 256.92 0.0691276 -8.56957 258.76 0.0613351 -8.59613 260.6 0.0707979 -8.6293 262.44 0.0683693 -8.66952 264.28 0.0672602 -8.70992 266.12 0.0690251 -8.74059 267.96 0.0678006 -8.78091 269.8 0.0703603 -8.82342 271.64 0.0698592 -8.85444 273.48 0.0635241 -8.88129 275.32 0.068118 -8.92304 277.16 0.0672615 -8.96539 279 0.0669053 -8.98874 280.84 0.0675214 -9.02936 282.68 0.0626561 -9.05146 284.52 0.0618413 -9.09975 286.36 0.067305 -9.13181 288.2 0.0624808 -9.16223 290.04 0.0738317 -9.19764 291.88 0.0640252 -9.23182 293.72 0.0717089 -9.26432 295.56 0.0715905 -9.29571 297.4 0.0656471 -9.32891 299.24 0.0685867 -9.36796 301.08 0.0566036 -9.3924 302.92 0.0623457 -9.43309 304.76 0.0642572 -9.45892 306.6 0.0673392 -9.49039 308.44 0.0606227 -9.52461 310.28 0.0644356 -9.56191 312.12 0.0599978 -9.58996 313.96 0.0663888 -9.61826 315.8 0.0690972 -9.64881 317.64 0.062358 -9.68532 319.48 0.0640343 -9.71346 321.32 0.0596265 -9.74736 323.16 0.0630057 -9.77449 325 0.065062 -9.80807 326.84 0.0624135 -9.83848 328.68 0.0659018 -9.86994 330.52 0.0654728 -9.89882 332.36 0.05925 -9.94066 334.2 0.0702854 -9.96284 336.04 0.0645058 -9.99215 337.88 0.0711629 -10.0287 339.72 0.0638328 -10.0501 341.56 0.0570624 -10.0768 343.4 0.0598413 -10.111 345.24 0.0554331 -10.1422 347.08 0.0613107 -10.1759 348.92 0.061962 -10.2074 350.76 0.0632222 -10.2257 352.6 0.0628338 -10.2596 354.44 0.0624535 -10.2875 356.28 0.0674524 -10.3238 358.12 0.067111 -10.336 359.96 0.0559219 -10.3757 361.8 0.0550264 -10.4119 363.64 0.0620144 -10.439 365.48 0.0595865 -10.4632 367.32 0.0670355 -10.5009 369.16 0.0617812 -10.5198 371 0.0568518 -10.5447 372.84 0.0614797 -10.5763 374.68 0.0637874 -10.6003 376.52 0.0610665 -10.6331 378.36 0.0683924 -10.6585 380.2 0.0551784 -10.6879 382.04 0.0586231 -10.7191 383.88 0.0607409 -10.7368 385.72 0.0595514 -10.7758 387.56 0.0615865 -10.8008 389.4 0.061683 -10.8324 391.24 0.0741212 -10.8506 393.08 0.0622609 -10.8799 394.92 0.0547387 -10.9025 396.76 0.0592907 -10.9353 398.6 0.0575335 -10.9603 400.44 0.0579517 -10.9847 402.28 0.065585 -11.0166 404.12 0.0634519 -11.0428 405.96 0.0602939 -11.0663 407.8 0.0614555 -11.0958 409.64 0.0646793 -11.1205 411.48 0.056908 -11.1488 413.32 0.0608068 -11.168 415.16 0.0593579 -11.2064 417 0.055742 -11.2293 418.84 0.0620603 -11.2436 420.68 0.0580573 -11.2692 422.52 0.0645223 -11.3027 424.36 0.0508573 -11.328 426.2 0.0606757 -11.3558 428.04 0.0611473 -11.3834 429.88 0.0630417 -11.403 431.72 0.0618116 -11.4216 433.56 0.0594204 -11.4584 435.4 0.0605165 -11.4752 437.24 0.0556878 -11.5148 439.08 0.0614793 -11.5338 440.92 0.0612654 -11.562 442.76 0.0654674 -11.5796 444.6 0.0593629 -11.6075 446.44 0.0557512 -11.6309 448.28 0.0594629 -11.6573 450.12 0.0525619 -11.6905 451.96 0.0657882 -11.707 453.8 0.0573068 -11.7301 455.64 0.0586417 -11.753 457.48 0.059997 -11.7794 459.32 0.0596593 -11.8037 461.16 0.0620554 -11.8268 463 0.0641815 -11.8624 464.84 0.0599538 -11.8769 466.68 0.0638894 -11.905 468.52 0.0622804 -11.921 470.36 0.0561567 -11.951 472.2 0.056057 -11.9702 474.04 0.0541234 -12.003 475.88 0.0631467 -12.0252 477.72 0.0596797 -12.0451 479.56 0.0594589 -12.0728 481.4 0.0601396 -12.0963 483.24 0.0602884 -12.1145 485.08 0.0643149 -12.1433 486.92 0.0621962 -12.166 488.76 0.0614328 -12.1868 490.6 0.0618902 -12.2169 492.44 0.0570669 -12.2322 494.28 0.059827 -12.2484 496.12 0.0578224 -12.2865 497.96 0.0543553 -12.313 499.8 0.0567425 -12.3316 501.64 0.0638583 -12.3527 503.48 0.0596887 -12.3786 505.32 0.0560335 -12.4043 507.16 0.058178 -12.4215 509 0.0560923 -12.447 510.84 0.0586515 -12.4682 512.68 0.0576225 -12.4942 514.52 0.0534317 -12.5082 516.36 0.0547767 -12.5429 518.2 0.0578597 -12.5634 520.04 0.0544057 -12.5789 521.88 0.0544399 -12.6059 523.72 0.0580511 -12.625 525.56 0.0585702 -12.6563 527.4 0.0549335 -12.6702 529.24 0.0591612 -12.6963 531.08 0.0586734 -12.7154 532.92 0.0569275 -12.7409 534.76 0.0522496 -12.7664 536.6 0.0630488 -12.7864 538.44 0.0553176 -12.8121 540.28 0.0573302 -12.8326 542.12 0.0577868 -12.8565 543.96 0.0692002 -12.8707 545.8 0.0589065 -12.8956 547.64 0.0572177 -12.9235 549.48 0.0614194 -12.9283 551.32 0.0577733 -12.9552 553.16 0.0619303 -12.9882 555 0.0584705 -13.0048 556.84 0.0548058 -13.0321 558.68 0.0547714 -13.0483 560.52 0.0554582 -13.0663 562.36 0.0524968 -13.0925 564.2 0.0622274 -13.1214 566.04 0.0515883 -13.1395 567.88 0.0560531 -13.1588 569.72 0.0599552 -13.1793 571.56 0.051617 -13.2047 573.4 0.0546262 -13.2217 575.24 0.062275 -13.2394 577.08 0.0496842 -13.268 578.92 0.0560684 -13.2845 580.76 0.0581454 -13.3135 582.6 0.0599693 -13.328 584.44 0.0468703 -13.3497 586.28 0.0579695 -13.3763 588.12 0.0541198 -13.3894 589.96 0.0484466 -13.421 591.8 0.0581987 -13.4376 593.64 0.0595857 -13.4479 595.48 0.0626497 -13.4762 597.32 0.0560775 -13.4946 599.16 0.0518428 -13.5117 601 0.0615928 -13.5373 602.84 0.0539115 -13.5597 604.68 0.0549599 -13.5871 606.52 0.054173 -13.597 608.36 0.0584947 -13.6221 610.2 0.0584645 -13.6436 612.04 0.0597831 -13.6632 613.88 0.0552515 -13.6885 615.72 0.0566402 -13.7071 617.56 0.0502309 -13.7355 619.4 0.0583362 -13.7478 621.24 0.0520739 -13.7562 623.08 0.0535794 -13.7807 624.92 0.0525544 -13.8094 626.76 0.0551214 -13.8358 628.6 0.0632088 -13.843 630.44 0.0518682 -13.8667 632.28 0.0598049 -13.8885 634.12 0.0562164 -13.905 635.96 0.056 -13.9308 637.8 0.056 -13.9531 639.64 0.056 -13.9676 641.48 0.056 -13.9922 643.32 0.056 -14.0027 645.16 0.056 -14.036 647 0.056 -14.0437 648.84 0.056 -14.064 650.68 0.056 -14.0943 652.52 0.056 -14.0961 654.36 0.056 -14.1284 656.2 0.056 -14.1543 658.04 0.056 -14.1677 659.88 0.056 -14.1828 661.72 0.056 -14.2132 663.56 0.056 -14.2257 665.4 0.056 -14.2396 667.24 0.056 -14.2552 669.08 0.056 -14.2805 670.92 0.056 -14.3045 672.76 0.056 -14.3247 674.6 0.056 -14.3395 676.44 0.056 -14.3629 678.28 0.056 -14.3868 680.12 0.056 -14.3994 681.96 0.056 -14.4194 683.8 0.056 -14.4439 685.64 0.056 -14.4495 687.48 0.056 -14.4678 689.32 0.056 -14.4829 691.16 0.056 -14.4986 693 0.056 -14.5108 694.84 0.056 -14.5318 696.68 0.056 -14.5392 698.52 0.056 -14.5462 700.36 0.056 -14.5523 702.2 0.056 -14.5577 704.04 0.056 -14.5618 705.88 0.056 -14.5760 707.72 0.056 -14.6000 709.56 0.056 -14.6000 711.40 0.056 diff --git a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibDbAsciiTool/share/MdtCalibDbAsciiTool.py b/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibDbAsciiTool/share/MdtCalibDbAsciiTool.py deleted file mode 100644 index a6b600a450c91f82cd9f136c691d030e892d43bb..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibDbAsciiTool/share/MdtCalibDbAsciiTool.py +++ /dev/null @@ -1 +0,0 @@ -log.warning("MdtCalibDbAsciiTool/MdtCalibDbAsciiTool.py - This file is obsolete; MdtCalibDbAsciiTool authomatically configured") diff --git a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibDbAsciiTool/src/MdtCalibDbAsciiTool.cxx b/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibDbAsciiTool/src/MdtCalibDbAsciiTool.cxx deleted file mode 100644 index 3e6fc4cf230fa067e7a714dcc0c426e14d6689cb..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibDbAsciiTool/src/MdtCalibDbAsciiTool.cxx +++ /dev/null @@ -1,545 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -#include "SGTools/TransientAddress.h" - -#include "MuonReadoutGeometry/MuonDetectorManager.h" -#include "MuonReadoutGeometry/MdtReadoutElement.h" - -#include "MdtCalibData/CalibFunc.h" -#include "MuonCalibStl/ToString.h" -#include "MdtCalibUtils/RtDataFromFile.h" -#include "PathResolver/PathResolver.h" -#include "MdtCalibData/MdtCalibrationFactory.h" -#include "MdtCalibData/IRtRelation.h" -#include "MdtCalibData/IRtResolution.h" -#include <fstream> -#include <string> -#include <dirent.h> - -#include "MdtCalibSvc/MdtCalibrationRegionSvc.h" - -#include "MdtCalibData/MdtRtRelationCollection.h" -#include "MdtCalibData/MdtTubeCalibContainerCollection.h" -#include "MdtCalibData/MdtCorFuncSetCollection.h" - -//this -#include "MdtCalibDbAsciiTool/MdtCalibDbAsciiTool.h" -#include "MdtCalibDbAsciiTool/StationT0FromFile.h" - -#include "AthenaKernel/IAtRndmGenSvc.h" -#include "CLHEP/Random/RandGaussZiggurat.h" - -namespace MuonCalib { - -MdtCalibDbAsciiTool::MdtCalibDbAsciiTool (const std::string& type, - const std::string& name, - const IInterface* parent) - : AthAlgTool(type, name, parent), - m_tubeData(NULL), - m_rtData(NULL), - m_doCommissioning(false), - m_bilt0(215.), - m_bist0(150.), - m_bmlt0(190.), - m_bmst0(90.), - m_bolt0(150.), - m_bost0(180.), - m_eilt0(850.), - m_eist0(850.), - m_emlt0(850.), - m_emst0(850.), - m_eolt0(850.), - m_eost0(850.), - m_rtDataLocation("RtKey"), - m_tubeDataLocation("TubeKey"), - m_calib_dir("NONE"), - m_t0Shift(0), - m_t0Spread(0), - m_rtShift(0) -{ - - declareInterface< IMdtCalibDBTool >(this) ; - - // the keys are hardcoded in order to be sure to match the ones - // used in regFcn by the Svc - //declareProperty("TubeKey",m_tubeDataLocation); - //declareProperty("RtKey",m_rtDataLocation); - - declareProperty("doCommissioning",m_doCommissioning,"allow setting T0s by chamber type for commissioning and sets default global T0 to 150 ns"); - declareProperty("BILT0",m_bilt0,"for commissioning (doCommissioning True) sets all BIL chambers T0s to a common value"); - declareProperty("BIST0",m_bist0,"for commissioning (doCommissioning True) sets all BIS chambers T0s to a common value"); - declareProperty("BMLT0",m_bmlt0,"for commissioning (doCommissioning True) sets all BML chambers T0s to a common value"); - declareProperty("BMST0",m_bmst0,"for commissioning (doCommissioning True) sets all BMS chambers T0s to a common value"); - declareProperty("BOLT0",m_bolt0,"for commissioning (doCommissioning True) sets all BOL chambers T0s to a common value"); - declareProperty("BOST0",m_bost0,"for commissioning (doCommissioning True) sets all BOS chambers T0s to a common value"); - declareProperty("EILT0",m_eilt0,"for commissioning (doCommissioning True) sets all EIL chambers T0s to a common value"); - declareProperty("EIST0",m_eist0,"for commissioning (doCommissioning True) sets all EIS chambers T0s to a common value"); - declareProperty("EMLT0",m_emlt0,"for commissioning (doCommissioning True) sets all EML chambers T0s to a common value"); - declareProperty("EMST0",m_emst0,"for commissioning (doCommissioning True) sets all EMS chambers T0s to a common value"); - declareProperty("EOLT0",m_eolt0,"for commissioning (doCommissioning True) sets all EOL chambers T0s to a common value"); - declareProperty("EOST0",m_eost0,"for commissioning (doCommissioning True) sets all EOS chambers T0s to a common value"); - - - declareProperty("T0Shift",m_t0Shift,"for simulation: common shift of all T0s, in ns"); - declareProperty("T0Spread",m_t0Spread,"for simulation: sigma for random smeraing of T0s, in ns"); - declareProperty("RTShift",m_rtShift,"for simulations: maximum RT distortion, in mm"); - declareProperty("CalibDir", m_calib_dir, "directory containg calibration files as written from standalone_tarball. If not NONE all other settings are overridden"); - - // is this the simplest way to initialize a list? - std::ostringstream myse; - std::vector<std::string> myord; - myse<< "DC2_rt_asciiDb.dat"; - myord.push_back(myse.str()); - declareProperty("RT_InputFiles",m_RTfileNames=myord,"list of RT input files, see doxygen main page for the case with multiple input files"); - -} - -StatusCode MdtCalibDbAsciiTool::updateAddress(StoreID::type /*storeID*/, - SG::TransientAddress* tad, - const EventContext& /*ctx*/) { - CLID clid = tad->clID(); - std::string key = tad->name(); - if ( 1221928754== clid && m_tubeDataLocation == key) { - ATH_MSG_DEBUG("OK Tube"); - return StatusCode::SUCCESS; - } - if ( 1270996316== clid && m_rtDataLocation == key) { - ATH_MSG_DEBUG("OK Rt"); - return StatusCode::SUCCESS; - } - return StatusCode::FAILURE; -} - -StatusCode MdtCalibDbAsciiTool::initialize() { - ATH_MSG_DEBUG("Initializing"); - - ATH_CHECK(m_idHelperSvc.retrieve()); - ATH_CHECK(m_DetectorManagerKey.initialize()); - - ATH_CHECK(serviceLocator()->service("MdtCalibrationRegionSvc", m_regionSvc)); - ATH_MSG_DEBUG("Retrieved MdtCalibrationRegionSvc"); - - if( m_t0Spread != 0. ) { - static const bool CREATEIFNOTTHERE(true); - ATH_CHECK(service("AtRndmGenSvc", p_AtRndmGenSvc, CREATEIFNOTTHERE)); - if (0 == p_AtRndmGenSvc) { - ATH_MSG_ERROR(" Could not initialize Random Number Service"); - return StatusCode::FAILURE; - } else{ - ATH_MSG_DEBUG(" initialize Random Number Service: running with t0 shift " - << m_t0Shift << " spread " << m_t0Spread << " rt shift " << m_rtShift); - } - // getting our random numbers stream - p_engine = p_AtRndmGenSvc->GetEngine("MDTCALIBDBASCIITOOL"); - } - - // initialize MdtTubeCalibContainers - ATH_CHECK(defaultT0s()); - ATH_CHECK(detStore()->record( m_tubeData, m_tubeDataLocation, true )); - - // Get the TransientAddress from DetectorStore and set "this" as the - // AddressProvider - SG::DataProxy* proxy = detStore()->proxy(ClassID_traits<MdtTubeCalibContainerCollection>::ID(), m_tubeDataLocation); - if (!proxy) { - ATH_MSG_ERROR("Unable to get the proxy for class MdtTubeCalibContainerCollection"); - return StatusCode::FAILURE; - } - - IAddressProvider* addp = this; - proxy->setProvider(addp, StoreID::DETECTOR_STORE); - ATH_MSG_DEBUG("set address provider for MdtTubeCalibContainerCollection"); - - ATH_CHECK(defaultRt()); - ATH_CHECK(detStore()->record( m_rtData, m_rtDataLocation, true )); - - // Get the TransientAddress from DetectorStore and set "this" as the - // AddressProvider - proxy = detStore()->proxy(ClassID_traits<MdtRtRelationCollection>::ID(), m_rtDataLocation); - if (!proxy) { - ATH_MSG_ERROR("Unable to get the proxy for class MdtRtRelationCollection"); - return StatusCode::FAILURE; - } - - addp = this; - proxy->setProvider(addp, StoreID::DETECTOR_STORE); - ATH_MSG_DEBUG("set address provider for MdtRtRelationCollection"); - - return StatusCode::SUCCESS; -} - -StatusCode MdtCalibDbAsciiTool::LoadCalibration(IOVSVC_CALLBACK_ARGS_P(I,keys)) { - ATH_MSG_DEBUG("LoadCalibration has been triggered for the following keys "); - - std::list<std::string>::const_iterator itr; - for (itr=keys.begin(); itr!=keys.end(); ++itr) { - ATH_MSG_DEBUG(*itr << " I="<<I<<" "); - } - - return StatusCode::SUCCESS; - -} - - -StatusCode MdtCalibDbAsciiTool::defaultT0s() { - // create collection - if(m_tubeData) { - delete m_tubeData; m_tubeData=0; - } - m_tubeData = new MdtTubeCalibContainerCollection(); - m_tubeData->resize( m_idHelperSvc->mdtIdHelper().module_hash_max() ); - ATH_MSG_DEBUG(" Created new MdtTubeCalibContainerCollection size " << m_tubeData->size()); - - MdtIdHelper::const_id_iterator it = m_idHelperSvc->mdtIdHelper().module_begin(); - MdtIdHelper::const_id_iterator it_end = m_idHelperSvc->mdtIdHelper().module_end(); - for( ; it!=it_end;++it ) { - - MuonCalib::MdtTubeCalibContainer* tubes=0; - // create a MdtTubeContainer - tubes = buildMdtTubeCalibContainer(*it); - - if(tubes) { - std::string rName=tubes->regionKey(); - std::string stationName(rName,0,3); - double t0 = 800.; - - // special treatment of the t0's for commissioning - if( m_doCommissioning ){ - t0 = 150.; - if( stationName == "BIL" ) { - t0 = m_bilt0; - }else if( stationName == "BIS" ){ - t0 = m_bist0; - }else if( stationName == "BML" ){ - t0 = m_bmlt0; - }else if( stationName == "BMS" ){ - t0 = m_bmst0; - }else if( stationName == "BOL" ){ - t0 = m_bolt0; - }else if( stationName == "BOS" ){ - t0 = m_bost0; - }else if( stationName == "EIL" ){ - t0 = m_eilt0; - }else if( stationName == "EIS" ){ - t0 = m_eist0; - }else if( stationName == "EML" ){ - t0 = m_emlt0; - }else if( stationName == "EMS" ){ - t0 = m_emst0; - }else if( stationName == "EOL" ){ - t0 = m_eolt0; - }else if( stationName == "EOS" ){ - t0 = m_eost0; - } - } - int nml=tubes->numMultilayers(); - int nlayers=tubes->numLayers(); - int ntubes=tubes->numTubes(); - int size = nml*nlayers*ntubes; - //look for calibration file - bool from_file(false); - StationT0FromFile station_t0; - if(m_calib_dir != "NONE") { - std::ifstream t0_file((m_calib_dir + "/t0s/T0" + rName + ".dat").c_str()); - if(t0_file.fail()) { - ATH_MSG_VERBOSE("File '" << (m_calib_dir + "/t0s/" + rName + ".dat") << "' not found!"); - ATH_MSG_VERBOSE("Using default t0 for chamber '" << rName << "'!"); - } else { - ATH_MSG_DEBUG("Reading calibraation for '" << rName << "' from calibration directory."); - from_file=true; - station_t0.readT0File(t0_file); - } - } - ATH_MSG_VERBOSE("Adding chamber " << m_idHelperSvc->mdtIdHelper().print_to_string(*it)); - ATH_MSG_VERBOSE(" size " << size - << " ml " << nml << " l " << nlayers << " t " - << ntubes << " address " << tubes); - for( int ml=0;ml<nml;++ml ){ - for( int l=0;l<nlayers;++l ){ - for( int t=0;t<ntubes;++t ){ - MuonCalib::MdtTubeCalibContainer::SingleTubeCalib data; - double tt = t0; - if(from_file) { - tt = station_t0.t0(ml + 1, l + 1, t + 1); - ATH_MSG_VERBOSE("tt="<<tt); - } - if( m_t0Shift != 0 ) { - tt += m_t0Shift; - ATH_MSG_VERBOSE("T0 shift " << m_t0Shift << " t0 " << tt - << " id " << ml << " " << l << " " << t); - } - if(m_t0Spread != 0 ) { - double sh = CLHEP::RandGaussZiggurat::shoot(p_engine,0.,m_t0Spread); - tt += sh; - ATH_MSG_VERBOSE("T0 spread " << sh << " t0 " << tt - << " id " << ml << " " << l << " " << t); - } - data.t0 = tt; - data.adcCal = 1.; - data.inversePropSpeed = 1./299.792458; - tubes->setCalib( ml,l,t,data ); - } - } - } - } - ATH_MSG_VERBOSE(" set t0's done "); - //MdtBasicRegionHash hash; - IdentifierHash hash; - IdContext idCont = m_idHelperSvc->mdtIdHelper().module_context(); - m_idHelperSvc->mdtIdHelper().get_hash( *it, hash, &idCont ); - - if( hash < m_tubeData->size() ){ - (*m_tubeData)[hash] = tubes; - ATH_MSG_VERBOSE(" adding tubes at " << hash << " current size " << m_tubeData->size()); - }else{ - ATH_MSG_WARNING(" HashId out of range " << hash << " max " << m_tubeData->size()); - delete tubes; tubes=0; - } - - } - ATH_MSG_DEBUG(" Done defaultT0s " << m_tubeData->size()); - - return StatusCode::SUCCESS; -} - -MuonCalib::MdtTubeCalibContainer * MdtCalibDbAsciiTool::buildMdtTubeCalibContainer(const Identifier& id) { - MuonCalib::MdtTubeCalibContainer* tubes = 0; - - SG::ReadCondHandle<MuonGM::MuonDetectorManager> DetectorManagerHandle{m_DetectorManagerKey}; - const MuonGM::MuonDetectorManager* MuonDetMgr = DetectorManagerHandle.cptr(); - if(MuonDetMgr==nullptr){ - ATH_MSG_ERROR("Null pointer to the read MuonDetectorManager conditions object"); - return tubes; - } - - const MuonGM::MdtReadoutElement* detEl = MuonDetMgr->getMdtReadoutElement( m_idHelperSvc->mdtIdHelper().channelID(id,1,1,1) ); - const MuonGM::MdtReadoutElement* detEl2 = 0; - if (m_idHelperSvc->mdtIdHelper().numberOfMultilayers(id) == 2){ - detEl2 = MuonDetMgr->getMdtReadoutElement(m_idHelperSvc->mdtIdHelper().channelID(id,2,1,1) ); - }else{ - ATH_MSG_ERROR("A single multilayer for this station " << m_idHelperSvc->mdtIdHelper().show_to_string(id)); - } - - ATH_MSG_VERBOSE(" new det el " << detEl); - - if( !detEl ){ - ATH_MSG_WARNING("No detEl found for " << m_idHelperSvc->mdtIdHelper().print_to_string(id)); - }else{ - int nml = 2; - if( !detEl2 ) { - nml = 1; - } - - int nlayers = detEl->getNLayers(); - if( detEl2 && detEl2->getNLayers() > nlayers ){ - ATH_MSG_DEBUG("Second multilayer has more layers " << detEl2->getNLayers() << " then first " << nlayers); - nlayers = detEl2->getNLayers(); - } - - int ntubes = detEl->getNtubesperlayer(); - if( detEl2 && detEl2->getNtubesperlayer() > ntubes ){ - ATH_MSG_DEBUG("Second multilayer has more tubes " << detEl2->getNtubesperlayer() << " then first " << ntubes); - ntubes = detEl2->getNtubesperlayer(); - } - - // build the region name in the format STATION_ETA_PHI - std::string rName; - - int stName = m_idHelperSvc->mdtIdHelper().stationName(id); - int stPhi = m_idHelperSvc->mdtIdHelper().stationPhi(id); - int stEta = m_idHelperSvc->mdtIdHelper().stationEta(id); - - std::string seperator("_"); - MuonCalib::ToString ts; - rName = m_idHelperSvc->mdtIdHelper().stationNameString(stName); - rName += seperator + ts( stPhi ) + seperator + ts( stEta ); - tubes=new MuonCalib::MdtTubeCalibContainer( rName,nml, nlayers, ntubes ); - } - - return tubes; -} - -StatusCode MdtCalibDbAsciiTool::defaultRt() { - std::vector<std::string>::const_iterator it = m_RTfileNames.value().begin(); - std::vector<std::string>::const_iterator it_end = m_RTfileNames.value().end(); - -//resolve filenames - std::vector<std::string> resolved_filenames; - for ( ; it != it_end ; ++it) { - std::string fileName = PathResolver::find_file(it->c_str(),"DATAPATH"); - if(fileName.length() == 0) { - ATH_MSG_ERROR("RT Ascii file \"" << it->c_str() << "\" not found"); - continue; - } - resolved_filenames.push_back(fileName); - } - - AppendRtFiles(resolved_filenames); - it = resolved_filenames.begin(); - it_end = resolved_filenames.end(); - - if (it == it_end ) { - ATH_MSG_FATAL("No input RT files found"); - return StatusCode::FAILURE; - } else if (it_end-it>1) { - // many files listed in jobO: assume there is one for each chamber - // people are interested in - m_regionSvc->remapRtRegions("OnePerChamber"); - } - - // create collection - if(m_rtData) { - delete m_rtData; m_rtData=0; - } - m_rtData = new MdtRtRelationCollection(); - m_rtData->resize(m_regionSvc->numberOfRegions()); - ATH_MSG_DEBUG(" Created new MdtRtRelationCollection size " << m_rtData->size()); - - // Loop over RT files - for ( ; it != it_end ; ++it) { - const std::string & fileName(*it); - // Open the Ascii file with the RT relations - std::ifstream inputFile( fileName.c_str() ); - if( !inputFile ) { - ATH_MSG_ERROR("Unable to open RT Ascii file: " << fileName.c_str()); - return StatusCode::FAILURE; - }else{ - ATH_MSG_DEBUG("Opened RT Ascii file: " << fileName.c_str()); - } - RtDataFromFile rts; - rts.read(inputFile); - ATH_MSG_VERBOSE("File contains " << rts.nRts() << " RT relations "); - - int nmax = static_cast <int> (rts.nRts()); - if( nmax > 10000 ) nmax = 10000; //prevent arbirarily large loop range to appease Coverity - for( int n=0; n<nmax; ++n ) { - RtDataFromFile::RtRelation* rt = rts.getRt( n ); - unsigned int regionId = rt->regionId(); - - if( regionId >= m_rtData->size() ){ - ATH_MSG_WARNING(" regionHash out of range: " << regionId << " max " << m_rtData->size()); - delete rt; rt=0; - continue; - } - - const RtDataFromFile::RtRelation::DataVec& times = rt->times(); - const RtDataFromFile::RtRelation::DataVec& radii = rt->radii(); - const RtDataFromFile::RtRelation::DataVec& reso = rt->resolution(); - // check if rt contains data, at least two point on the rt are required - if( times.size() < 2 ) { - ATH_MSG_ERROR(" defaultRt rt table has too few entries"); - continue; - } - - // check if all tables have same size - if( times.size() != radii.size() || times.size() != reso.size() ) { - ATH_MSG_ERROR("defaultRt rt table size mismatch "); - continue; - } - - // check if - double t_min = times[0]; - double bin_size = times[1]-t_min; - - // additional consistency check - if( bin_size <= 0 ) { - ATH_MSG_ERROR("RtCalibrationClassic::defaultRt rt table negative binsize "); - continue; - } - - // create a vector to hold the r values, - // we need two extra fields to store t_min and bin_size - MuonCalib::CalibFunc::ParVec rtPars; - rtPars.push_back( t_min ); - rtPars.push_back( bin_size ); - - if( m_rtShift != 0. ){ - - RtDataFromFile::RtRelation::DataVec::const_iterator rtIt = radii.begin(); - RtDataFromFile::RtRelation::DataVec::const_iterator rtIt_end = radii.end(); - for( ;rtIt!=rtIt_end;++rtIt ){ - double rold = *rtIt; - double rshift = m_rtShift*1.87652e-2*rold*(rold-14.6); - double rnew = rold + rshift; - ATH_MSG_DEBUG("DEFORM RT: old radius " << rold << " new radius " << rnew << " shift " << rshift - << " max shift " << m_rtShift); - rtPars.push_back(rnew); - } - }else{ - // copy r values into vector - rtPars.insert( rtPars.end(), radii.begin(), radii.end() ); - } - - ATH_MSG_DEBUG("defaultRt new MuonCalib::IRtRelation"); - MuonCalib::IRtRelation* rtRel = MuonCalib::MdtCalibrationFactory::createRtRelation( "RtRelationLookUp", rtPars ); - if( !rtRel ){ - ATH_MSG_WARNING("ERROR creating RtRelationLookUp "); - } - - MuonCalib::CalibFunc::ParVec resoPars; - resoPars.push_back( t_min ); - resoPars.push_back( bin_size ); - - // copy r values into vector - resoPars.insert( resoPars.end(), reso.begin(), reso.end() ); - - ATH_MSG_DEBUG("defaultRt new MuonCalib::IRtResolution"); - MuonCalib::IRtResolution* resoRel = MuonCalib::MdtCalibrationFactory::createRtResolution( "RtResolutionLookUp", resoPars ); - if( !rtRel ){ - ATH_MSG_WARNING("ERROR creating RtResolutionLookUp "); - } - - if( resoRel && rtRel ){ - int npoints= rtRel->nPar()-2; - (*m_rtData)[regionId] = new MuonCalib::MdtRtRelation( rtRel, resoRel, 0. ); - ATH_MSG_VERBOSE("defaultRt npoints from rtRel="<< npoints); - - for( int j=0;j<npoints;++j ){ - double t = t_min + j*bin_size; - ATH_MSG_VERBOSE(" " << j << " " << t << " " << rtRel->radius(t) << " " << resoRel->resolution(t)); - } - } - delete rt; rt=0; - - } - } - return StatusCode::SUCCESS; -} - - -void MdtCalibDbAsciiTool::AppendRtFiles(std::vector<std::string> &rt_files) { - DIR *directory(opendir((m_calib_dir + "/rts").c_str())); - if(directory==NULL) return; - struct dirent *dent; - //loop on all files in directory - while((dent=readdir(directory))!=NULL) { - std::string nm(dent->d_name); - std::string station; - int eta, phi; - if(!interpret_chamber_name(nm, "Rt_", station,eta, phi)) continue; - rt_files.push_back(m_calib_dir + "/rts/" + nm); - ATH_MSG_DEBUG("Appending rt file "<<m_calib_dir << "/rts/" << nm); - } - closedir(directory); -} - -bool MdtCalibDbAsciiTool :: interpret_chamber_name(const std::string &nm, const char *prefix, std::string & station, int &eta, int & phi) const { -//check if name begins with the prefix - std::string prefix_st(prefix); - if(nm.find(prefix_st) !=0) return false; - //check if filename ends in .dat - if(static_cast<int>(nm.find(".dat")) <0 || nm.find(".dat")!=nm.size()-4) return false; - //cut prefix and suffix from filename - std::string cutout(nm, prefix_st.size(), nm.size()-4-prefix_st.size()); -//extrect station name - int uscore_pos(cutout.find('_')); - if(uscore_pos<=0) return false; - station=std::string(cutout, 0, uscore_pos); -//get eta and phi - std::string cutout2(cutout, uscore_pos+1); - if(sscanf(cutout2.c_str(), "%80d_%80d", &phi, &eta)!=2) return false; - return true; -} - -} diff --git a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibDbAsciiTool/src/StationT0FromFile.cxx b/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibDbAsciiTool/src/StationT0FromFile.cxx deleted file mode 100644 index 67a7912f7a73c430c0f71daf82669fd0c7e3a34c..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibDbAsciiTool/src/StationT0FromFile.cxx +++ /dev/null @@ -1,98 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -#include <iostream> -#include <fstream> -#include "MdtCalibDbAsciiTool/StationT0FromFile.h" - -using namespace MuonCalib; - -//***************************************************************************** - -//::::::::::::::::: -//:: METHOD init :: -//::::::::::::::::: - -void StationT0FromFile::init(void) { - - m_t0 = std::vector< std::vector< std::vector<double> > >(2); // two multilayers - for (unsigned int k=0; k<m_t0.size(); k++) { - m_t0[k] = std::vector< std::vector<double> >(4); // up to four layers in - // a multilayer - for (unsigned l=0; l<m_t0[k].size(); l++) { - m_t0[k][l] = std::vector<double>(72, 0); - // up to 72 tubes per layer - } - } - - return; - -} - -//***************************************************************************** - -//::::::::::::::: -//:: METHOD t0 :: -//::::::::::::::: - -double StationT0FromFile::t0(const unsigned int & ml, - const unsigned int & ly, - const unsigned int & tb) const { - - return m_t0[ml-1][ly-1][tb-1]; - -} - -//***************************************************************************** - -//::::::::::::::::::::::: -//:: METHOD readT0File :: -//::::::::::::::::::::::: - -void StationT0FromFile::readT0File(std::istream &infile) { - -/////////////// -// VARIABLES // -/////////////// - - std::string sdummy; // auxiliary string for file reading - int idummy; // auxiliary integer for file reading - double dummy; // auxiliary double for file reading - int ml, ly, tb; // multilayer, layer, tube - -////////////////////// -// READ THE t0 FILE // -////////////////////// - -// ignore the first line // - getline(infile, sdummy); - -// read the t0 look-up table // - while (!infile.eof()) { - - // station name // - infile >> sdummy; - if (infile.eof()) { - break; - } - - // eta, phi, technology index // - infile >> idummy >> idummy >> idummy; - - // multilayer, layer, tube // - infile >> ml >> ly >> tb; - - // t0 // - infile >> m_t0[ml-1][ly-1][tb-1]; - - // the rest of the line // - for (unsigned k=0; k<11; k++) { - infile >> dummy; - } - - } - - return; - -} diff --git a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibDbAsciiTool/src/components/MdtCalibDbAsciiTool_entries.cxx b/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibDbAsciiTool/src/components/MdtCalibDbAsciiTool_entries.cxx deleted file mode 100644 index adcf151ab6adcc905c2ac662ff5b7688bea38fd2..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibDbAsciiTool/src/components/MdtCalibDbAsciiTool_entries.cxx +++ /dev/null @@ -1,6 +0,0 @@ -#include "MdtCalibDbAsciiTool/MdtCalibDbAsciiTool.h" - -using namespace MuonCalib; - -DECLARE_COMPONENT( MdtCalibDbAsciiTool ) - diff --git a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibTools/CMakeLists.txt b/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibTools/CMakeLists.txt deleted file mode 100644 index 468c80f29641618c18c9e38b5a4e479be7b5c43b..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibTools/CMakeLists.txt +++ /dev/null @@ -1,35 +0,0 @@ -################################################################################ -# Package: MdtCalibTools -################################################################################ - -# Declare the package name: -atlas_subdir( MdtCalibTools ) - -# Declare the package's dependencies: -atlas_depends_on_subdirs( PUBLIC - Control/AthenaBaseComps - GaudiKernel - MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibITools - MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibInterfaces - MuonSpectrometer/MuonCalib/MuonCalibITools - PRIVATE - Control/StoreGate - MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibEventLoop - MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibFitters - MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibUtils - MuonSpectrometer/MuonCalib/MuonCalibEventBase - MuonSpectrometer/MuonCalib/MuonCalibNtuple - MuonSpectrometer/MuonCalib/MuonCalibUtils/MuonCalibStl - MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry - MuonSpectrometer/MuonIdHelpers ) - -# Component(s) in the package: -atlas_add_component( MdtCalibTools - src/*.cxx - src/components/*.cxx - LINK_LIBRARIES AthenaBaseComps GaudiKernel MuonCalibITools StoreGateLib SGtests MdtCalibEventLoop MdtCalibFitters MdtCalibUtils MuonCalibEventBase MuonCalibNtuple MuonReadoutGeometry MuonIdHelpersLib ) - -# Install files from the package: -atlas_install_headers( MdtCalibTools ) -atlas_install_joboptions( share/*.py ) - diff --git a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibTools/MdtCalibTools/DCSLFitterTool.h b/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibTools/MdtCalibTools/DCSLFitterTool.h deleted file mode 100644 index 3984b2ac6832a2b496113891189e2207efa21cba..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibTools/MdtCalibTools/DCSLFitterTool.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -/////////////////////////////////////////////////////////////////// -// DCSLFitterTool.h -// Header file for class DCSLFitterTool -/////////////////////////////////////////////////////////////////// -// (c) ATLAS Detector software -/////////////////////////////////////////////////////////////////// -// Niels.Van.Eldik@cern.ch, -/////////////////////////////////////////////////////////////////// - - -#ifndef MUONCALIB_DCSLFITTERTOOL_H -#define MUONCALIB_DCSLFITTERTOOL_H - -// Gaudi -#include "AthenaBaseComps/AthAlgTool.h" - -#include "MdtCalibITools/IMdtSegmentFitterTool.h" - - -namespace MuonCalib { - - class IMdtSegmentFitter; - -/**@class DCSLFitterTool - Tool creates an instance of a IMdtSegmentFitter implementation. - - @author Niels.Van.Eldik@cern.ch, -*/ - class DCSLFitterTool : public AthAlgTool, virtual public IMdtSegmentFitterTool { - - public: - /**AlgTool constructor */ - DCSLFitterTool(const std::string&,const std::string&,const IInterface*); - - /**Virtual destructor*/ - virtual ~DCSLFitterTool(){}; - - /** AlgTool initailize method.*/ - StatusCode initialize(); - - /** AlgTool finalize method */ - StatusCode finalize(); - - /** Interface method: return the implementation pointer */ - IMdtSegmentFitter* getImp() { return m_implementation; } - - private: - /** Pointer to the concrete implementation */ - IMdtSegmentFitter* m_implementation; - - - }; - -} - -#endif // diff --git a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibTools/MdtCalibTools/MdtCalibNtupleMakerTool.h b/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibTools/MdtCalibTools/MdtCalibNtupleMakerTool.h deleted file mode 100644 index c27c5a4f75283c55eebce2091acc90205b293cf8..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibTools/MdtCalibTools/MdtCalibNtupleMakerTool.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -/////////////////////////////////////////////////////////////////// -// MdtCalibNtupleMakerTool.h -// Header file for class MdtCalibNtupleMakerTool -/////////////////////////////////////////////////////////////////// -// (c) ATLAS Detector software -/////////////////////////////////////////////////////////////////// -// nveldik@nikhef.nl -/////////////////////////////////////////////////////////////////// - -#ifndef MUONCALIB_MDTCALIBNTUPLEMAKERTOOL_H -#define MUONCALIB_MDTCALIBNTUPLEMAKERTOOL_H - -// Gaudi -#include "AthenaBaseComps/AthAlgTool.h" - -#include "MdtCalibITools/IMdtCalibTool.h" - -#include <string> -#include <vector> - -namespace MuonCalib { - - class IMdtCalibration; - - /**@class MdtCalibNtupleMakerTool - Creates ntuple per calibration region containing segment information - - @author Niels.Van.Eldik@cern.ch, - */ - - class MdtCalibNtupleMakerTool : public AthAlgTool, virtual public IMdtCalibTool { - public: - /**AlgTool constructor */ - MdtCalibNtupleMakerTool(const std::string&,const std::string&,const IInterface*); - - /** AlgTool initailize method.*/ - StatusCode initialize(); - - /** AlgTool finalize method */ - StatusCode finalize(); - - /** Interface method: return the implementation pointer */ - IMdtCalibration* getImp(std::string name); - - /** dummy methode */ - bool writeToDb( const IMdtCalibrationOutput* , std::string ) const { return true; } - - private: - - /** vector to hold pointers to all instances that were created */ - std::vector<IMdtCalibration*> m_instances; - }; - -} - -#endif // - - diff --git a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibTools/MdtCalibTools/MdtCalibTool.h b/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibTools/MdtCalibTools/MdtCalibTool.h deleted file mode 100644 index 1ab21606fcd126cdba799a28c10e567c1e726465..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibTools/MdtCalibTools/MdtCalibTool.h +++ /dev/null @@ -1,118 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -/////////////////////////////////////////////////////////////////// -// MdtCalibTool.h -// Header file for class MdtCalibTool -/////////////////////////////////////////////////////////////////// -// (c) ATLAS Detector software -/////////////////////////////////////////////////////////////////// -// Niels.Van.Eldik@cern.ch, -/////////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////// -// Modifications: -// Tue Feb 28 2006 by Oliver Kortner: segment selection added in -// order to avoid ambiguities, -// by default this selection is -// disabled and must be enabled -// via the job option -// MdtCalibTool.SelectorSwitch=1 -/////////////////////////////////////////////////////////////////// - - -#ifndef MUONCALIB_MDTCALIBTOOL_H -#define MUONCALIB_MDTCALIBTOOL_H - -// Gaudi -#include "AthenaBaseComps/AthAlgTool.h" - -#include "GaudiKernel/ToolHandle.h" -#include "GaudiKernel/ServiceHandle.h" -#include "MuonIdHelpers/IMuonIdHelperSvc.h" - -#include "MuonCalibITools/IMuonCalibTool.h" -#include "MuonCalibITools/IRegionSelectorTool.h" - -#include <map> - -namespace MuonCalib { - - class IMdtCalibTool; - class IMdtSegmentSelectorTool; - class IMdtSegmentSelector; - class MdtCalibEventLoop; - class IMdtCalibrationOutput; - class MuonCalibEvent; - -/**@class MdtCalibTool - Steers MdtCalibration within athena. - - Modification: 28.02.2006 by O.Kortner: - A simple segment selection can be enabled via the job option - MdtCalibTool.SelectorSwitch=1. If the selection is switchted on, - the following selection is applied to chambers with more than one - segment in an event: the segments which have more hits on the - reconstructed track than the others are kept; if two segments have - the same number of track hits, the segment with the smaller chi^2 is - selected. - - @author Niels.Van.Eldik@cern.ch, -*/ - class MdtCalibTool : public AthAlgTool, virtual public IMuonCalibTool { - public: - /**AlgTool constructor */ - MdtCalibTool(const std::string&,const std::string&,const IInterface*); - - /**Virtual destructor*/ - virtual ~MdtCalibTool()=default; - - /** AlgTool initailize method.*/ - StatusCode initialize(); - - /** Interface method: handle MuonCalibPatternCollection */ - // virtual bool handle( const MuonCalibPatternCollection* patterns ); - - virtual bool handleEvent( const MuonCalibEvent* event ); - - /** perform analysis */ - virtual bool analyse(); - - private: - /** for now create a new eventloop for every calibration region */ - typedef std::map< IRegionSelectorTool::RegionKey, MdtCalibEventLoop* > RegionEventMap; - - private: - /** routines to pass segments to event loop */ - void handleMuonSegment( const MuonCalibSegment* seg ); - - /** generate RegionKey from identifier */ - IRegionSelectorTool::RegionKey keyFromIdentifier( const IRegionSelectorTool::id_type& id ) const; - - /** get EventLoop for given region key */ - MdtCalibEventLoop* getEventLoopForRegion( const IRegionSelectorTool::RegionKey& key ); - - /** Map containing the segments (stored in the eventloop) per calibration region */ - RegionEventMap m_segmentsPerRegion; - - /** RtCalibration initialization */ - ToolHandle<IMdtCalibTool> m_mdtCalibTool; //!< RtCalibrationCreator ToolHandle - - /** Switch for the MdtCalibTool internal segment selection **/ - int m_SelectorSwitch; //!< selector switch (is set to 0 by the default) - - /** MdtSegmentSelector initialization */ - ToolHandle<IMdtSegmentSelectorTool> m_segmentSelectorTool; //!< MdtSegmentSelectorTool ToolHandle - const IMdtSegmentSelector* m_segmentSelector; //!< MdtSegmentSelector - - /** RegionSelector initialization */ - ToolHandle<IRegionSelectorTool> m_regionSelector; //!< RegionSelector ToolHandle - - ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; - - }; - -} - -#endif diff --git a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibTools/MdtCalibTools/QuasianalyticLineReconstructionTool.h b/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibTools/MdtCalibTools/QuasianalyticLineReconstructionTool.h deleted file mode 100644 index e4bb24f641df9c7b2939db32a59a237fafbd1359..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibTools/MdtCalibTools/QuasianalyticLineReconstructionTool.h +++ /dev/null @@ -1,77 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -// 07.03.2006, AUTHOR: OLIVER KORTNER -// Modified: 15.07.2006 by O. Kortner, interface to additional functionality -// of QuasianalyticLineReconstruction added. -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - -#ifndef QuasianalyticLineReconstructionToolH -#define QuasianalyticLineReconstructionToolH - -//::::::::::::::::::::::::::::::::::::::::::::::: -//:: CLASS QuasianalyticLineReconstructionTool :: -//::::::::::::::::::::::::::::::::::::::::::::::: - -/// \class QuasianalyticLineReconstructionTool -/// Tool to create an instance of the IMdtSegmentFitter implementation in -/// QuasianalyticLineReconstruction. -/// The user can specify the road width of the pattern recognition in the -/// job-options file by the setting "roadWidth" to the desired value. -/// The user can also request a chi^2 refit at the end of the quasianalytic -/// segment reconstruction. -/// -/// \author Oliver.Kortner@CERN.CH -/// -/// \date 15.07.2006 - -//:::::::::::::::::: -//:: HEADER FILES :: -//:::::::::::::::::: - -// Gaudi // -#include "AthenaBaseComps/AthAlgTool.h" - -// MuonCalib // -#include "MdtCalibITools/IMdtSegmentFitterTool.h" -#include "MdtCalibInterfaces/IMdtSegmentFitter.h" - - -namespace MuonCalib { - -class QuasianalyticLineReconstructionTool : - public AthAlgTool, virtual public IMdtSegmentFitterTool { - -public: -// Constructors // - QuasianalyticLineReconstructionTool(const std::string & type, - const std::string & name, const IInterface *parent); - ///< AlgTool constructor - - virtual ~QuasianalyticLineReconstructionTool(){}; - ///< Virtual destructor - -// Methods // - StatusCode initialize(); - ///< AlgTool initialize method - StatusCode finalize(); - ///< AlgTool finalize method - IMdtSegmentFitter* getImp() { return m_implementation; } - ///< Interface method: return the - ///< implementation pointer - -private: - double m_road_width; // road width used in the pattern recognition of - // QuasianalyticLineReconstruction - bool m_refit; // enable the chi^2 refit at the end of the quasianalytic - // segment reconstruction - IMdtSegmentFitter *m_implementation; // pointer to the concrete - // implementation - -}; - -} - -#endif diff --git a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibTools/MdtCalibTools/SimpleMdtSegmentSelectorTool.h b/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibTools/MdtCalibTools/SimpleMdtSegmentSelectorTool.h deleted file mode 100644 index 06d6abd610ae34e20f109c874f767c3647554868..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibTools/MdtCalibTools/SimpleMdtSegmentSelectorTool.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -/////////////////////////////////////////////////////////////////// -// SimpleMdtSegmentSelectorTool.h -// Header file for class SimpleMdtSegmentSelectorTool -/////////////////////////////////////////////////////////////////// -// (c) ATLAS Detector software -/////////////////////////////////////////////////////////////////// -// Niels.Van.Eldik@cern.ch, -/////////////////////////////////////////////////////////////////// - - -#ifndef MUONCALIB_SIMPLEMDTSEGMENTSELECTORTOOL_H -#define MUONCALIB_SIMPLEMDTSEGMENTSELECTORTOOL_H - -// Gaudi -#include "AthenaBaseComps/AthAlgTool.h" - -#include "MdtCalibITools/IMdtSegmentSelectorTool.h" - - -namespace MuonCalib { - - class IMdtSegmentSelector; - -/**@class SimpleMdtSegmentSelectorTool - Creates an instance of a IMdtSegmentSelector implementation. - - @author Niels.Van.Eldik@cern.ch, -*/ - class SimpleMdtSegmentSelectorTool : public AthAlgTool, virtual public IMdtSegmentSelectorTool { - - public: - /**AlgTool constructor */ - SimpleMdtSegmentSelectorTool(const std::string&, - const std::string&, - const IInterface*); - - /**Virtual destructor*/ - virtual ~SimpleMdtSegmentSelectorTool(){}; - - /** AlgTool initailize method.*/ - StatusCode initialize(); - - /** AlgTool finalize method */ - StatusCode finalize(); - - /** Interface method: return the implementation pointer */ - virtual const IMdtSegmentSelector* getImp() { return m_implementation; } - - private: - /** Pointer to the concrete implementation */ - const IMdtSegmentSelector* m_implementation; - - /** minimum chi2 */ - double m_chi2; - - /** minimum number of HitOnTrack */ - unsigned int m_minHits; - }; - -} - -#endif // diff --git a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibTools/MdtCalibTools/SimplePatternSelectorTool.h b/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibTools/MdtCalibTools/SimplePatternSelectorTool.h deleted file mode 100644 index 2c4914fabf7d6bf0da8b5def2984d8bcdd420aff..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibTools/MdtCalibTools/SimplePatternSelectorTool.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -/////////////////////////////////////////////////////////////////// -// SimplePatternSelectorTool.h -// Header file for class SimplePatternSelectorTool -/////////////////////////////////////////////////////////////////// -// (c) ATLAS Detector software -/////////////////////////////////////////////////////////////////// -// Niels.Van.Eldik@cern.ch, -/////////////////////////////////////////////////////////////////// - - -#ifndef MUONCALIB_SIMPLEPATTERNSELECTORTOOL_H -#define MUONCALIB_SIMPLEPATTERNSELECTORTOOL_H - -// Gaudi -#include "AthenaBaseComps/AthAlgTool.h" - -#include "MdtCalibITools/IPatternSelectorTool.h" - - - -namespace MuonCalib { - - class ICalibPatternSelector; - -/**@class SimplePatternSelectorTool - Creates an instance of a IGlobalPatternSelector implementation. - - @author Niels.Van.Eldik@cern.ch, -*/ - class SimplePatternSelectorTool : public AthAlgTool, virtual public IPatternSelectorTool { - - public: - /**AlgTool constructor */ - SimplePatternSelectorTool(const std::string&, - const std::string&, - const IInterface*); - - /**Virtual destructor*/ - virtual ~SimplePatternSelectorTool(){}; - - /** AlgTool initailize method.*/ - StatusCode initialize(); - - /** AlgTool finalize method */ - StatusCode finalize(); - - /** Interface method: return the implementation pointer */ - virtual const ICalibPatternSelector* getImp() { return m_implementation; } - - private: - /** Pointer to the concrete implementation */ - const ICalibPatternSelector* m_implementation; - - - }; - -} - -#endif // diff --git a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibTools/doc/packagedoc.h b/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibTools/doc/packagedoc.h deleted file mode 100644 index 83eaae904293aaef5d3835ef5b650ffaef35e98f..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibTools/doc/packagedoc.h +++ /dev/null @@ -1,25 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -/** -@page MdtCalibTools_page MdtCalibTools Package -@author Niels.Van.Eldik@cern.ch - -@section MdtCalibTools_MdtCalibToolsIntro Introduction -This package contains the implementation of various tools derived from the -abstract MuonCalib::MdtCalibITools classes. - -@section MdtCalibTools_MdtCalibToolsOverview Class Overview -The MdtCalibTools package contains the following Tools selectable from MuonCalib::MuonCalibAlg jobOptions: -- MuonCalib::MdtCalibNtupleMakerTool: creates ntuple per calibration region containing segment information -- MuonCalib::MdtCalibTool: steers Mdt Calibration within athena - -in addition it also contains the following helper Tools: -- MuonCalib::SimpleMdtSegmentSelectorTool: creates an instance of a MuonCalib::IMdtSegmentSelector implementation -- MuonCalib::SimplePatternSelectorTool: creates an instance of a MuonCalib::IGlobalPatternSelector implementation -- MuonCalib::MuCCaFitterTool: creates an instance of a MuonCalib::IMdtSegmentFitter implementation -- MuonCalib::DCSLFitterTool: creates an instance of a MuonCalib::IMdtSegmentFitter implementation - - -*/ diff --git a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibTools/share/MdtCalibTool.py b/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibTools/share/MdtCalibTool.py deleted file mode 100644 index c3a127d060bd08a7c796a976557fa95603796480..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibTools/share/MdtCalibTool.py +++ /dev/null @@ -1,24 +0,0 @@ -theApp.Dlls += ["MdtCalibTools"] - -ToolSvc = Service( "ToolSvc" ) -MdtCalibTool = Service( "ToolSvc.MuonCalib_MdtCalibTool" ) - -MdtCalibTool.MdtSegmentSelectorToolType = "MuonCalib::SimpleMdtSegmentSelectorTool" -MdtCalibTool.MdtSegmentSelectorToolName = "MdtCalib_SimpleMdtSegmentSelectorTool" -MdtCalib_SimpleMdtSegmentSelectorTool = Service("ToolSvc.MdtCalib_SimpleMdtSegmentSelectorTool" ) -#modify here MdtCalib_SimpleMdtSegmentSelectorTool properties -#MdtCalib_SimpleMdtSegmentSelectorTool.MinHitsOntrack=3. -#MdtCalib_SimpleMdtSegmentSelectorTool.MaxChi2=10. - -if doMuonCalibAtlas: - include( "MuonCalibTools/AtlasRegionSelectorTool.py" ) - MdtCalibTool.RegionSelectorType = "MuonCalib::AtlasRegionSelectorTool" - MdtCalibTool.RegionSelectorName = "MdtCalib_AtlasRegionSelectorTool" - MdtCalib_AtlasRegionSelectorTool = Service("ToolSvc.MdtCalib_AtlasRegionSelectorTool" ) - #modify here MdtCalib_AtlasRegionSelectorTool properties - #MdtCalib_AtlasRegionSelectorTool.Split = 1 -else : - include( "MuonCalibTools/TestbeamRegionSelectorTool.py" ) - MdtCalibTool.RegionSelectorType = "MuonCalib::TestbeamRegionSelectorTool" - MdtCalibTool.RegionSelectorName = "MdtCalib_TestbeamRegionSelectorTool" - MdtCalib_TestbeamRegionSelectorTool = Service("ToolSvc.MdtCalib_TestbeamRegionSelectorTool" ) diff --git a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibTools/src/DCSLFitterTool.cxx b/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibTools/src/DCSLFitterTool.cxx deleted file mode 100644 index 4b2dede519db0a40c43f907c1d2924a23473a2b3..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibTools/src/DCSLFitterTool.cxx +++ /dev/null @@ -1,43 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#include "MdtCalibTools/DCSLFitterTool.h" - -// gaudi -#include "GaudiKernel/MsgStream.h" - -#include "MdtCalibFitters/DCSLFitter.h" - -namespace MuonCalib { - - DCSLFitterTool::DCSLFitterTool(const std::string& t, const std::string& n, const IInterface* p) : - AthAlgTool(t,n,p) - { - declareInterface< IMdtSegmentFitterTool >(this) ; - } - - - StatusCode DCSLFitterTool::initialize() - { - MsgStream log(msgSvc(), name()); - log << MSG::INFO << "initialize " << endmsg; - - // create an instance of DCSLFitter - m_implementation = new DCSLFitter(); - - return StatusCode::SUCCESS; - } - - StatusCode DCSLFitterTool::finalize() - { - MsgStream log(msgSvc(), name()); - log << MSG::INFO << "finalize " << endmsg; - - // delete instance - delete m_implementation; - - return StatusCode::SUCCESS; - } - -} diff --git a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibTools/src/MdtCalibNtupleMakerTool.cxx b/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibTools/src/MdtCalibNtupleMakerTool.cxx deleted file mode 100644 index 3e4aa0bdec83bd57ea3b432fda07f04d7885e9ef..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibTools/src/MdtCalibNtupleMakerTool.cxx +++ /dev/null @@ -1,50 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#include "MdtCalibTools/MdtCalibNtupleMakerTool.h" - -// gaudi -#include "GaudiKernel/MsgStream.h" - -// calibration -#include "MuonCalibNtuple/MdtCalibNtupleMaker.h" -#include "MuonCalibStl/DeleteObject.h" - -namespace MuonCalib { - - MdtCalibNtupleMakerTool::MdtCalibNtupleMakerTool(const std::string& t, - const std::string& n, - const IInterface* p) - : AthAlgTool(t,n,p) - { - declareInterface< IMdtCalibTool >(this) ; - } - - StatusCode MdtCalibNtupleMakerTool::initialize() - { - MsgStream log(msgSvc(), name()); - log << MSG::INFO << "Initialisation started " << endmsg; - - return StatusCode::SUCCESS; - } - - StatusCode MdtCalibNtupleMakerTool::finalize() - { - MsgStream log(msgSvc(), name()); - log << MSG::INFO << "finalize started " << endmsg; - // delete instances - std::for_each( m_instances.begin(), m_instances.end(), DeleteObject() ); - - return StatusCode::SUCCESS; - } - - IMdtCalibration* MdtCalibNtupleMakerTool::getImp(std::string name){ - - // Create instance of MdtCalibNtupleMaker - IMdtCalibration* implementation = new MdtCalibNtupleMaker( name ); - m_instances.push_back( implementation ); - return implementation; - } - -} diff --git a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibTools/src/MdtCalibTool.cxx b/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibTools/src/MdtCalibTool.cxx deleted file mode 100644 index b652e28f32ebbf86b75856db37b02420509f2e2a..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibTools/src/MdtCalibTool.cxx +++ /dev/null @@ -1,248 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -#include "MdtCalibTools/MdtCalibTool.h" - -// gaudi -#include "GaudiKernel/MsgStream.h" - -// calibration -#include "MuonCalibEventBase/MuonCalibSegment.h" -#include "MuonCalibEventBase/MuonCalibPattern.h" -#include "MdtCalibITools/IMdtCalibTool.h" -#include "MdtCalibITools/IMdtSegmentSelectorTool.h" -#include "MuonCalibEventBase/MuonCalibEvent.h" -#include "MdtCalibInterfaces/IMdtSegmentSelector.h" - -#include "MdtCalibEventLoop/MdtCalibEventLoop.h" - -#include "MuonIdHelpers/MdtIdHelper.h" - -#include <algorithm> -#include <fstream> - -namespace MuonCalib { - - MdtCalibTool::MdtCalibTool(const std::string& t, const std::string& n, const IInterface* p) : - AthAlgTool(t,n,p), - m_mdtCalibTool("MuonCalib::MdtCalibNtupleMakerTool"), - m_segmentSelectorTool("MuonCalib::SimpleMdtSegmentSelectorTool"), - m_regionSelector("MuonCalib::AtlasRegionSelectorTool") - { - declareInterface< IMuonCalibTool >(this) ; - - declareProperty("MdtCalibTool", m_mdtCalibTool); - declareProperty("SelectorSwitch", m_SelectorSwitch=0); - declareProperty("MdtSegmentSelectorTool", m_segmentSelectorTool); - declareProperty("RegionSelector", m_regionSelector); - } - - StatusCode MdtCalibTool::initialize() - { - ATH_CHECK(AthAlgTool::initialize()); - ATH_CHECK(m_mdtCalibTool.retrieve()); - ATH_MSG_DEBUG("Retrieved" << m_mdtCalibTool); - ATH_CHECK(m_segmentSelectorTool.retrieve()); - ATH_MSG_DEBUG("Retrieved" << m_segmentSelectorTool); - m_segmentSelector = m_segmentSelectorTool->getImp(); - ATH_CHECK(m_regionSelector.retrieve()); - ATH_MSG_DEBUG("Retrieved" << m_regionSelector); - ATH_CHECK(m_idHelperSvc.retrieve()); - return StatusCode::SUCCESS; - } - - bool MdtCalibTool::handleEvent( const MuonCalibEvent* event ) - { - unsigned int nb_segments(0); - std::vector<MuonCalibSegment *> selected_segment; - bool segment_found; - bool segment_rejected; - ATH_MSG_DEBUG("handleEvent(events) with patSize " << event->numberOfPatterns()); - - // loop over patterns - MuonCalibEvent::MCPVecCit pat_it = event->patternBegin(); - MuonCalibEvent::MCPVecCit pat_it_end = event->patternEnd(); - for( ;pat_it!=pat_it_end; ++pat_it ){ - // loop over segments in pattern - - ATH_MSG_DEBUG("New pattern with segments " << (*pat_it)->muonSegments()); - - MuonCalibPattern::MuonSegCit seg_it = (*pat_it)->muonSegBegin(); - MuonCalibPattern::MuonSegCit seg_it_end = (*pat_it)->muonSegEnd(); - for( ;seg_it!=seg_it_end;++seg_it ){ - MuonCalibSegment* seg = *seg_it; - // protect against null pointer - if (!seg) { - ATH_MSG_WARNING("Got Segment nullptr"); - continue; - } - // Only process segments with MDT hits - if ( seg->mdtHOT().empty() ) { - continue; - } - -// if no internal selection is requested, pass the segment to the algorithm // - if (m_SelectorSwitch==0 && seg) { - handleMuonSegment( seg ); - continue; - } - -// segment selection // - - // reject all segments which contain hits from different chambers // - MuonFixedId id1(seg->mdtHOT()[0]->identify()); - segment_rejected = false; - for (unsigned int k=1; k<seg->mdtHitsOnTrack(); k++) { - MuonFixedId id2(seg->mdtHOT()[k]->identify()); - if (id1.stationName()!=id2.stationName() || id1.eta()!=id2.eta() || - id1.phi()!=id2.phi()) { - segment_rejected = true; - } - } - if (segment_rejected) { - continue; - } - - // if a segment is accepted, only keep it if it has more hits than // - // another segment in the same chamber; if two segments in a chamber have // - // the same number of hits, take the one with the better chi^2 // - segment_found = false; - for (unsigned int k=0; k<nb_segments; k++) { - MuonFixedId id2(selected_segment[k]->mdtHOT()[0]->identify()); - if (id1.stationName()==id2.stationName() && id1.eta()==id2.eta() && - id1.phi()==id2.phi()) { - segment_found = true; - if (selected_segment[k]->mdtHitsOnTrack() < - seg->mdtHitsOnTrack()) { - selected_segment[k] = seg; - break; - } - if (selected_segment[k]->mdtHitsOnTrack() == - seg->mdtHitsOnTrack()) { - if (selected_segment[k]->chi2() > seg->chi2()) { - selected_segment[k] = seg; - break; - } - } - } - } - if (!segment_found) { - selected_segment.push_back(seg); - nb_segments++; - } - } // loop over segments - - } // loop over patterns - - if (m_SelectorSwitch!=0) { - for (unsigned int k=0; k<nb_segments; k++) { - if (selected_segment[k]!=0) { - handleMuonSegment( selected_segment[k] ); - } - } - } - return true; - } - - bool MdtCalibTool::analyse() - { - // loop over all regions - ATH_MSG_INFO("Performing loop over regions: " << m_segmentsPerRegion.size()); - - RegionEventMap::iterator it = m_segmentsPerRegion.begin(); - RegionEventMap::iterator it_end = m_segmentsPerRegion.end(); - for( ; it!=it_end; ++it ){ - ATH_MSG_DEBUG("Performing analysis for region "); - - // create new calibration instance - IMdtCalibration* calibImp = m_mdtCalibTool->getImp( it->first ); - - // set rt calibration implementation - it->second->setCalibImp( calibImp ); - - // perform calibration - it->second->performAnalysis(); - - // get results - const IMdtCalibrationOutput* result = it->second->calibrationResults(); - - // write result to db - m_mdtCalibTool->writeToDb( result, it->first ); - } - - ATH_MSG_INFO("End of calibration started "); - return true; - } - - void MdtCalibTool::handleMuonSegment( const MuonCalibSegment* seg ) - { - // subdivide segment into regions and get key - IRegionSelectorTool::RegionVec rvec = m_regionSelector->splitIntoRegions( seg ); - - ATH_MSG_VERBOSE("RegionSelector produced " << rvec.size() << " subregions for segment "); - - // loop over different region - IRegionSelectorTool::RegionVec::iterator it = rvec.begin(); - IRegionSelectorTool::RegionVec::iterator it_end = rvec.end(); - - for( ; it!=it_end; ++it ){ - - // decompose pair - const MuonCalibSegment * sseg = it->first; - IRegionSelectorTool::RegionKey key = it->second; - - if( !m_segmentSelector->select(*sseg) ){ - ATH_MSG_VERBOSE(" ssegment rejected by selector "); - // return; this prevents the second ML from being accepted! - continue; - } - - // check if region should be calibrated - if( m_regionSelector->useRegion( key ) ){ - - ATH_MSG_VERBOSE("handleMuonSegment with region key " << key); - - // pointer to current event loop - MdtCalibEventLoop* loop = getEventLoopForRegion( key ); - - // fill current ssegment into event loop - loop->handleSegment( sseg ); - }else{ - ATH_MSG_VERBOSE("MuonSegment not selected by RegionSelector " << key); - } - } - } - - - IRegionSelectorTool::RegionKey MdtCalibTool::keyFromIdentifier( const IRegionSelectorTool::id_type& id ) const - { - ATH_MSG_VERBOSE(" keyFromIdentifier "); - return m_regionSelector->getRegionKey(id); - } - - - MdtCalibEventLoop* MdtCalibTool::getEventLoopForRegion( const IRegionSelectorTool::RegionKey& key ) - { - MdtCalibEventLoop* loop = nullptr; - // look up key in map - RegionEventMap::iterator sit = m_segmentsPerRegion.find(key); - - // if not found create new entry in map - if( sit == m_segmentsPerRegion.end() ){ - ATH_MSG_VERBOSE("created new entry in region map for key " << key); - - // create new event loop - loop = new MdtCalibEventLoop( key ); - - // add loop to RegionMap - m_segmentsPerRegion.insert( sit, std::make_pair( key, loop ) ); - }else{ - // get event loop from RegionMap - loop = sit->second; - } - return loop; - } - - -} diff --git a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibTools/src/QuasianalyticLineReconstructionTool.cxx b/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibTools/src/QuasianalyticLineReconstructionTool.cxx deleted file mode 100644 index 84af831690cdfbe1c54531b0218b276700d9ca38..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibTools/src/QuasianalyticLineReconstructionTool.cxx +++ /dev/null @@ -1,74 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -#include "MdtCalibTools/QuasianalyticLineReconstructionTool.h" -#include "GaudiKernel/MsgStream.h" -#include "MdtCalibFitters/QuasianalyticLineReconstruction.h" - -using namespace MuonCalib; - -//:::::::::::::::::::::::::::::::::::::::::::::::::::: -//:: IMPLEMENTATION OF METHODS DEFINED IN THE CLASS :: -//:: QuasianalyticLineReconstructionTool :: -//:::::::::::::::::::::::::::::::::::::::::::::::::::: - -//***************************************************************************** - -//::::::::::::::::: -//:: CONSTRUCTOR :: -//::::::::::::::::: - -QuasianalyticLineReconstructionTool::QuasianalyticLineReconstructionTool( - const std::string & type, const std::string & name, - const IInterface *parent) : AthAlgTool(type, name, parent) { - - declareInterface< IMdtSegmentFitterTool>(this); - - m_road_width = 0.5; - declareProperty("roadWidth", m_road_width); - - m_refit = false; - declareProperty("refit", m_refit); - - return; - -} - -//***************************************************************************** - -//::::::::::::::::::::::: -//:: METHOD initialize :: -//::::::::::::::::::::::: - -StatusCode QuasianalyticLineReconstructionTool::initialize() { - ATH_CHECK(AthAlgTool::initialize()); - ATH_MSG_INFO("initialize "); - -// create an instance of QuasianalyticLineReconstruction // - m_implementation = new QuasianalyticLineReconstruction(m_road_width); - - if (m_refit) { - static_cast<QuasianalyticLineReconstruction*>(m_implementation - )->switchOnRefit(); - } else { - static_cast<QuasianalyticLineReconstruction*>(m_implementation - )->switchOffRefit(); - } - - return StatusCode::SUCCESS; - -} - -//***************************************************************************** - -//::::::::::::::::::::: -//:: METHOD finalize :: -//::::::::::::::::::::: - -StatusCode QuasianalyticLineReconstructionTool::finalize() { - ATH_MSG_INFO("finalize "); - delete m_implementation; - ATH_CHECK(AthAlgTool::finalize()); - return StatusCode::SUCCESS; -} diff --git a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibTools/src/SimpleMdtSegmentSelectorTool.cxx b/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibTools/src/SimpleMdtSegmentSelectorTool.cxx deleted file mode 100644 index 31f5f411e17f8546fbca210ff249e795a1bc60bc..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibTools/src/SimpleMdtSegmentSelectorTool.cxx +++ /dev/null @@ -1,43 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#include "MdtCalibTools/SimpleMdtSegmentSelectorTool.h" - -#include "MdtCalibUtils/SimpleMdtSegmentSelector.h" - -namespace MuonCalib { - - SimpleMdtSegmentSelectorTool::SimpleMdtSegmentSelectorTool(const std::string& t, - const std::string& n, - const IInterface* p) : - AthAlgTool(t,n,p) - { - declareInterface< IMdtSegmentSelectorTool >(this) ; - - // chi2 and #hits cuts - m_minHits = 6; - m_chi2 = 10.; - - declareProperty("MinHitsOntrack", m_minHits); - declareProperty("MaxChi2" , m_chi2); - } - - - StatusCode SimpleMdtSegmentSelectorTool::initialize() - { - // Create instance of type SimpleMdtSegmentSelector - m_implementation = new SimpleMdtSegmentSelector(m_chi2,m_minHits); - - return StatusCode::SUCCESS; - } - - StatusCode SimpleMdtSegmentSelectorTool::finalize() - { - // delete instance - delete m_implementation; - - return StatusCode::SUCCESS; - } - -} diff --git a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibTools/src/SimplePatternSelectorTool.cxx b/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibTools/src/SimplePatternSelectorTool.cxx deleted file mode 100644 index a5b1ead5ab3c2792cb135da5021316afe7a2ff85..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibTools/src/SimplePatternSelectorTool.cxx +++ /dev/null @@ -1,46 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#include "MdtCalibTools/SimplePatternSelectorTool.h" - -#include "MdtCalibUtils/SimplePatternSelector.h" - -namespace MuonCalib { - - SimplePatternSelectorTool::SimplePatternSelectorTool(const std::string& t, - const std::string& n, - const IInterface* p) : - AthAlgTool(t,n,p) - { - declareInterface< IPatternSelectorTool >(this) ; - - } - - - StatusCode SimplePatternSelectorTool::initialize() - { - // set maximum chi2 of segment - double chi2_max = 1000.; - - // set minimum number of mdt segments - unsigned int mdt_min = 1; - - // set minimum number of phi segments - unsigned int phi_min = 1; - - // create an instance of SimplePatternSelector - m_implementation = new SimplePatternSelector(chi2_max,mdt_min,phi_min); - - return StatusCode::SUCCESS; - } - - StatusCode SimplePatternSelectorTool::finalize() - { - // delete pointer - delete m_implementation; - - return StatusCode::SUCCESS; - } - -} diff --git a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibTools/src/components/MdtCalibTools_entries.cxx b/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibTools/src/components/MdtCalibTools_entries.cxx deleted file mode 100644 index cf6f4bd8323a7dd28a0709cf59dc24e61870e6f2..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibTools/src/components/MdtCalibTools_entries.cxx +++ /dev/null @@ -1,17 +0,0 @@ -#include "MdtCalibTools/DCSLFitterTool.h" -#include "MdtCalibTools/QuasianalyticLineReconstructionTool.h" -#include "MdtCalibTools/MdtCalibTool.h" -#include "MdtCalibTools/SimpleMdtSegmentSelectorTool.h" -#include "MdtCalibTools/SimplePatternSelectorTool.h" -#include "MdtCalibTools/MdtCalibNtupleMakerTool.h" - - -using namespace MuonCalib; - -DECLARE_COMPONENT( DCSLFitterTool ) -DECLARE_COMPONENT( QuasianalyticLineReconstructionTool ) -DECLARE_COMPONENT( MdtCalibTool ) -DECLARE_COMPONENT( SimpleMdtSegmentSelectorTool ) -DECLARE_COMPONENT( SimplePatternSelectorTool ) -DECLARE_COMPONENT( MdtCalibNtupleMakerTool ) - diff --git a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibValidation/CMakeLists.txt b/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibValidation/CMakeLists.txt deleted file mode 100644 index ba08fcd0e334bf17a645ddce72da77e43adbe641..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibValidation/CMakeLists.txt +++ /dev/null @@ -1,39 +0,0 @@ -################################################################################ -# Package: MdtCalibValidation -################################################################################ - -# Declare the package name: -atlas_subdir( MdtCalibValidation ) - -# Declare the package's dependencies: -atlas_depends_on_subdirs( PUBLIC - Control/AthenaBaseComps - Control/StoreGate - GaudiKernel - MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibData - PRIVATE - MuonSpectrometer/MuonCalib/MuonCalibDbOperations - MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneBase - MuonSpectrometer/MuonCalib/MuonCalibUtils/MuonCalibMath - MuonSpectrometer/MuonCalib/MuonCalibUtils/MuonCalibStl - MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry - MuonSpectrometer/MuonIdHelpers ) - -# External dependencies: -find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread Graf Graf3d Gpad Html Postscript Gui GX11TTF GX11 ) - -# tag NEEDS_CORAL_BASE was not recognized in automatic conversion in cmt2cmake - -# Component(s) in the package: -atlas_add_library( MdtCalibValidationLib - src/*.cxx - PUBLIC_HEADERS MdtCalibValidation - INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaBaseComps GaudiKernel MdtCalibData StoreGateLib SGtests MuonCalibDbOperationsLib MuonCalibStandAloneBaseLib MuonIdHelpersLib - PRIVATE_LINK_LIBRARIES MuonCalibMath MuonReadoutGeometry ) - -atlas_add_component( MdtCalibValidation - src/components/*.cxx - INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaBaseComps StoreGateLib SGtests GaudiKernel MdtCalibData MuonCalibDbOperationsLib MuonCalibStandAloneBaseLib MuonCalibMath MuonReadoutGeometry MuonIdHelpersLib MdtCalibValidationLib ) - diff --git a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibValidation/MdtCalibValidation/FixRtEnds.h b/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibValidation/MdtCalibValidation/FixRtEnds.h deleted file mode 100644 index d9f27a53ef06c98c69e4bbea55841bf17bd38049..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibValidation/MdtCalibValidation/FixRtEnds.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef MuonCalib_FixRtEnds_h -#define MuonCalib_FixRtEnds_h - -//std -#include "vector" - -namespace MuonCalib { - -//MuonCalibMath -class SamplePoint; - -class FixRtEnds { - public: -//=============================constructor - destructor========================= - inline FixRtEnds() {} - inline ~FixRtEnds() {} -//=============================public member functions ========================= - //fix the rt ends for monoton - int FixEnds(std::vector<SamplePoint> & points); -//===========================static const ====================================== - //return values for FixEnds - static const int NO_FIX_NEEDED = 0, - FIX_APPLIED = 1, - FIX_FAILED = 2; - private: -//==========================private functions=================================== - bool checkMono(const std::vector<SamplePoint> & points, bool & fix_begin, bool & fix_end) const; - inline bool fixBegin(std::vector<SamplePoint> & points); - inline bool fixEnd(std::vector<SamplePoint> & points); -}; - -} //namespace MuonCalib -#endif diff --git a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibValidation/MdtCalibValidation/MdtValidationAlg.h b/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibValidation/MdtCalibValidation/MdtValidationAlg.h deleted file mode 100644 index 9ba13b110eeaf7734b7df4f60e352dd7ba92fe4e..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibValidation/MdtCalibValidation/MdtValidationAlg.h +++ /dev/null @@ -1,173 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef _MDTVALIDATIONALG_H -#define _MDTVALIDATIONALG_H - -// c - c++ - system -#include "vector" -#include "map" -#include <iostream> -#include <fstream> -#include <sstream> -#include <string> -#include <stdio.h> -#include <sys/time.h> - -//root -#include "TFile.h" -#include "TList.h" -#include "TH1.h" -#include "TH2.h" -#include "TList.h" -#include "TF1.h" - -//athena -#include "AthenaBaseComps/AthAlgorithm.h" -#include "GaudiKernel/ServiceHandle.h" - -//MdtCalibData -#include "MdtCalibData/MdtTubeFitContainer.h" - -#include "MuonIdHelpers/IMuonIdHelperSvc.h" -#include "MuonReadoutGeometry/MuonDetectorManager.h" -#include "MuonCalibStandAloneBase/NtupleStationId.h" - -class RegionSelectionSvc; - -namespace MuonCalib { - - class SamplePoint; - class CalibDbConnection; - class RtFullInfo; - class CalibRtDbOperations; - class CalibT0DbOperations; - class CalibHeadOperations; - - class MdtValidationAlg : public AthAlgorithm { - //=========================================== - public: - /** Algorithm Constructor */ - MdtValidationAlg(const std::string& name, ISvcLocator* pSvcLocator); - /** Algorithm destrucrtor*/ - ~MdtValidationAlg()=default; - /** Is called at the beginning of the analysis */ - StatusCode initialize(); - /** execute function NOTE: This will read all events at once*/ - StatusCode execute(); - /** finalize functions */ - StatusCode finalize(); - - void filltubeT0(); - void ValidateTubeT0 (const MdtTubeFitContainer::SingleTubeFit *fit, int & validflag); - - int CheckT0Parameters (const MdtTubeFitContainer::SingleTubeFit *fit); - int CheckRtParameters (std::vector<SamplePoint> & points, const RtFullInfo * full_info); - - void SummaryReport(int success); - //// void ValidateTubeT0AllTimes(bool something_done); - - StatusCode ValidateChamberT0(NtupleStationId & id); - - //// void ValidateChamberT0AllTimes(bool something_done); - - StatusCode ValidateRegionRt(const NtupleStationId & id); - const char* NameSelectedChamber(); - bool ReadLimitsFile(); - bool ComputeLimits(); - bool Histos(NtupleStationId & id, const std::vector<int> & validflags = std::vector<int>(0)); - bool RootFile(bool good_tubes=false); - - //============================================ - private: - // Methods - //======== - /** Calibration DataBase handling methods */ - StatusCode ConnectDb(); - - /** */ - double getLeftLimit(TH1F * histo); - double getRightLimit(TH1F * histo); - - //std::vector <MdtOracleTubeTable *> refinelist(std::vector <MdtOracleTubeTable *> tubelist); - -/** check if tube exists */ - inline bool exists(NtupleStationId & id, int ml, int ly, int tb); - - // Attributes - //=========== - - //! pointer to region selection service - RegionSelectionSvc *p_reg_sel_svc; - - std::vector<MuonCalib::NtupleStationId> m_region_ids; - - MdtTubeFitContainer * m_tube_chamber; - - // helpers // - std::string m_MDT_ID_helper; // name of the MDT ID helper - - ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; - - // MuonDetectorManager from the conditions store - SG::ReadCondHandleKey<MuonGM::MuonDetectorManager> m_DetectorManagerKey {this, "DetectorManagerKey", - "MuonDetectorManager", - "Key of input MuonDetectorManager condition data"}; - - CalibDbConnection * m_db; - CalibT0DbOperations * m_t0_op; - CalibRtDbOperations * m_rt_op; - CalibHeadOperations * m_head_ops; - CalibDbConnection * m_data_connection; - int m_fitter; - bool m_writeToDbEnable ; - int m_limitslevel; - int m_makeHistos; - int m_lastdate; - std::string m_validationTask; - - std::string m_db_ConnectionString; - std::string m_writer_ConnectionString; - std::string m_db_WorkingSchema; - std::string m_defaultRtFile; - std::string m_reader_account, m_reader_password; - std::string m_writer_account, m_writer_password; - timeval m_t0,m_t1,m_result; - - - /** limits for T0 acceptance */ - double m_minSlope; - double m_maxSlope; - double m_minT0; - double m_maxT0; - double m_minTmax; - double m_maxTmax; - double m_minTtot; - double m_maxTtot; - double m_minPP; - double m_maxPP; - - /** limits for Rt acceptance */ - int m_minSegs; - double m_minDAngle; - - float m_summary[50] ; - std::string m_limitsFile ; - //! output file - TFile* m_Histos; - TList* m_HistosList; - - int m_headid,m_lowrun,m_uprun; - std::string m_sitename; - - bool m_ComputeLimits; - std::string m_chamber; - int m_debug; - int m_tube; - int m_eta; - int m_phi; - }; - -} -#endif diff --git a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibValidation/doc/README b/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibValidation/doc/README deleted file mode 100755 index 68407845bd926f4a71a9b49de04e121d4fdb47ba..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibValidation/doc/README +++ /dev/null @@ -1,6 +0,0 @@ -Validation of Mdt calibration constants in ORACLE Calibration DBs -author T.Baroncelli - -customization: to run Test.exe -you should specify your DB, the schema name and the password in -authentication.xml and in test.cxx diff --git a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibValidation/exe/test.cxx b/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibValidation/exe/test.cxx deleted file mode 100755 index 0b0e7aaa6d5611a57e432fbf046039d413101345..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibValidation/exe/test.cxx +++ /dev/null @@ -1,18 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -/** - * main program for the Validation - */ -#include "MdtCalibValidation/MdtT0ValidationHandler.h" - -int main() -{ - -// construct the default CalibrationManager - MdtT0ValidationHandler* ValHandl = new MdtT0ValidationHandler::MdtT0ValidationHandler; - ValHandl->initialize(); - ValHandl->execute(); - ValHandl->finalize(); - } diff --git a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibValidation/run/Validation.datacards b/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibValidation/run/Validation.datacards deleted file mode 100755 index 0ed4ad4c8f4e4ca9ff2345a4b24a95004d2b1fb0..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibValidation/run/Validation.datacards +++ /dev/null @@ -1,12 +0,0 @@ -# Validation datacards for BIL -WriteToDbEnable 1 -Chamber BIL -LastDate 11533 -GetLimits 10 -makeHistos 1 -DebugLevel 2 -Phi 3 -Eta 4 -Layer 0 -MultiLayer 0 -Tube 0 diff --git a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibValidation/src/FixRtEnds.cxx b/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibValidation/src/FixRtEnds.cxx deleted file mode 100644 index c751aae14c3c6c294891efcb24d7300ade52f3d4..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibValidation/src/FixRtEnds.cxx +++ /dev/null @@ -1,143 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -#include "MdtCalibValidation/FixRtEnds.h" -#include "MuonCalibMath/SamplePoint.h" -#include "GaudiKernel/MsgStream.h" -#include "AthenaKernel/getMessageSvc.h" - -#include "TGraph.h" -#include "TF1.h" - -namespace MuonCalib { - -int FixRtEnds::FixEnds(std::vector<SamplePoint> & points) { -//check monotony - bool fix_begin, fix_end; - if(!checkMono(points, fix_begin, fix_end)) { - MsgStream log(Athena::getMessageSvc(),"FixRtEnds"); - log<<MSG::WARNING<<"Monotonic check failed!"<<endmsg; - return FIX_FAILED; - } - if(fix_begin || fix_end) { - TGraph *gr=new TGraph(points.size()); - for(unsigned int i=0; i<points.size(); i++) { - gr->SetPoint(i, points[i].x1(), points[i].x2()); - } - gr->Write("bevor_fix"); - } - if(!fix_begin && !fix_end) { - MsgStream log(Athena::getMessageSvc(),"FixRtEnds"); - log<<MSG::DEBUG<<"Rt relation is monotonic. Ok."<<endmsg; - return NO_FIX_NEEDED; - } - if(fix_begin) { - if(!fixBegin(points)) { - MsgStream log(Athena::getMessageSvc(),"FixRtEnds"); - log<<MSG::WARNING<<"Fix failed!"<<endmsg; - return FIX_FAILED; - } - } - if(fix_end) { - if(!fixEnd(points)) { - MsgStream log(Athena::getMessageSvc(),"FixRtEnds"); - log<<MSG::WARNING<<"Fix failed!"<<endmsg; - return FIX_FAILED; - } - } - TGraph *gr=new TGraph(points.size()); - for(unsigned int i=0; i<points.size(); i++) { - gr->SetPoint(i, points[i].x1(), points[i].x2()); - } - gr->Write("after_fix"); - if(!checkMono(points, fix_begin, fix_end)) { - MsgStream log(Athena::getMessageSvc(),"FixRtEnds"); - log<<MSG::WARNING<<"Monotonic check failed!"<<endmsg; - return FIX_FAILED; - } - if(fix_begin || fix_end) { - MsgStream log(Athena::getMessageSvc(),"FixRtEnds"); - log<<MSG::WARNING<<"Still not monotonic"<<endmsg; - return FIX_FAILED; - } - return FIX_APPLIED; -} - -bool FixRtEnds::checkMono(const std::vector<SamplePoint> & points, bool & fix_begin, bool & fix_end) const { - double last_r(-9e9); - fix_begin=false; fix_end=false; - for(std::vector<SamplePoint>::const_iterator it=points.begin(); it!=points.end(); it++) { - if(it->x2()<last_r) { - if(it->x2()<2.0) { - fix_begin=true; - } else if(it->x2()>13) { - fix_end=true; - } else { //cannot fic if it is in the middle - return false; - } - } - last_r= it->x2(); - } - return true; -} - -inline bool FixRtEnds::fixBegin(std::vector<SamplePoint> & points) { - std::vector<double> r(1, 0.0) ,t(1, 0.0); - int i_max(10000); - for(unsigned int i=0; i<points.size(); i++) { - if(points[i].x2()<2 && r.size()!=0) { - r.clear(); - r.push_back(0.0); - t.clear(); - t.push_back(0.0); - } - if(points[i].x2()>2 && points[i].x2() <4) { - t.push_back(points[i].x1()); - r.push_back(points[i].x2()); - } - if(points[i].x2()<4) i_max=i; - } - if(t.size()<4) return false; - TGraph *fit_gr=new TGraph(r.size()); - for(unsigned int i=0; i<r.size(); i++) { - fit_gr->SetPoint(i, t[i], r[i]); - } - fit_gr->Fit("pol2"); - fit_gr->Write("fix_begin"); - TF1 * fun=fit_gr->GetFunction("pol2"); - if(!fun) return false; - for(int i=0; i<=i_max; i++) { - points[i].set_x2(fun->Eval(points[i].x1())); - } - return true; -} - -inline bool FixRtEnds::fixEnd(std::vector<SamplePoint> & points) { - std::vector<double> r ,t; - int i_min(10000); - for(unsigned int i=0; i<points.size(); i++) { - if(points[i].x2()>12 && points[i].x2() <13) { - t.push_back(points[i].x1()); - r.push_back(points[i].x2()); - } - if(points[i].x2()>12 && i_min==10000) i_min=i; - } - t.push_back(points[points.size()-1].x1()); - r.push_back(14.6); - if(t.size()<4) return false; - TGraph *fit_gr=new TGraph(r.size()); - for(unsigned int i=0; i<r.size(); i++) { - fit_gr->SetPoint(i, t[i], r[i]); - } - fit_gr->Fit("pol2"); - fit_gr->Write("fix_end"); - TF1 * fun=fit_gr->GetFunction("pol2"); - if(!fun) return false; - for(unsigned int i=i_min; i<points.size(); i++) { - points[i].set_x2(fun->Eval(points[i].x1())); - } - return true; -} - -} //namespace MuonCalib diff --git a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibValidation/src/MdtValidationAlg.cxx b/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibValidation/src/MdtValidationAlg.cxx deleted file mode 100644 index 190bcfcdce108f1e29b0322983afcc66ef03c756..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibValidation/src/MdtValidationAlg.cxx +++ /dev/null @@ -1,671 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -#include "MdtCalibValidation/MdtValidationAlg.h" -#include "MdtCalibValidation/FixRtEnds.h" - -//MuonCalibStandAloneBase -#include "MuonCalibStandAloneBase/RegionSelectionSvc.h" - -//MuonCalibStl -#include "MuonCalibStl/ToString.h" - -//MuonCalibDbOperations -#include "MuonCalibDbOperations/CalibDbConnection.h" -#include "MuonCalibDbOperations/CalibRtDbOperations.h" -#include "MuonCalibDbOperations/CalibT0DbOperations.h" -#include "MuonCalibDbOperations/CalibHeadOperations.h" - -//MdtCalibData -#include "MdtCalibData/MdtTubeFitContainer.h" -#include "MdtCalibData/RtFullInfo.h" - -//MuonCalibMath -#include "MuonCalibMath/SamplePoint.h" - - -namespace MuonCalib { - -MdtValidationAlg::MdtValidationAlg(const std::string& name, ISvcLocator* pSvcLocator) : AthAlgorithm(name, pSvcLocator), -p_reg_sel_svc(NULL), m_tube_chamber(NULL), m_db(NULL), m_t0_op(NULL), m_rt_op(NULL), m_head_ops(NULL), -m_fitter(1), m_writeToDbEnable(true), m_limitslevel(0), m_makeHistos(0), m_lastdate(0), -m_validationTask(""), m_db_ConnectionString(""),m_db_WorkingSchema(""),m_defaultRtFile("./RT_default_comm.dat"), -m_minSegs(-1), m_minDAngle(-999.), m_Histos(NULL), m_HistosList(NULL), -m_lowrun(-1), m_uprun(-1), m_ComputeLimits(false), m_debug(-1), m_tube(-1), m_eta(-1), m_phi(-1) -{ - declareProperty("FitterFlag",m_fitter); - declareProperty("WriteToDbEnable",m_writeToDbEnable); - declareProperty("GetLimits",m_limitslevel); - declareProperty("makeHistos",m_makeHistos); - declareProperty("LastDate",m_lastdate); - declareProperty("ConnectionString",m_db_ConnectionString); - declareProperty("WriterConnectionString",m_writer_ConnectionString); - declareProperty("WorkingSchema",m_db_WorkingSchema); - declareProperty("ValidationTask",m_validationTask); - declareProperty("defaulRtFile", m_defaultRtFile); - declareProperty("SiteName", m_sitename); - m_headid=-1; //take most recent header - declareProperty("HeadId", m_headid); - m_minSlope=-9e9; - declareProperty("MinSlope", m_minSlope); - m_maxSlope=9e9; - declareProperty("MaxSlope", m_maxSlope); - m_minT0=-9e9; - declareProperty("MinT0", m_minT0); - m_maxT0=9e9; - declareProperty("MaxT0", m_maxT0); - m_minTmax=-9e9; - declareProperty("MinTmax", m_minTmax); - m_maxTmax=9e9; - declareProperty("MaxTmax", m_maxTmax); - m_minTtot=-9e9; - declareProperty("MinTtot", m_minTtot); - m_maxTtot=9e9; - declareProperty("MaxTtot", m_maxTtot); - m_minPP=-9e9; - declareProperty("MinPP", m_minPP); - m_maxPP=-9e9; - declareProperty("MaxPP", m_maxPP); - m_db=NULL; - m_data_connection=NULL; - declareProperty("ReaderAccount", m_reader_account); - declareProperty("ReaderPassword", m_reader_password); - declareProperty("WriterAccount", m_writer_account); - declareProperty("WriterPassword", m_writer_password); - m_t0.tv_sec = 0; - m_t0.tv_usec = 0; - m_t1.tv_sec = 0; - m_t1.tv_usec = 0; - m_result.tv_sec = 0; - m_result.tv_usec = 0; -} - -StatusCode MdtValidationAlg::initialize() { - ATH_MSG_INFO("Thank you for using MdtValidationAlg!"); - - ATH_CHECK(m_idHelperSvc.retrieve()); - ATH_CHECK(m_DetectorManagerKey.initialize()); - ATH_CHECK(serviceLocator()->service("RegionSelectionSvc", p_reg_sel_svc)); - m_region_ids=p_reg_sel_svc->GetStationsInRegions(); - ATH_MSG_INFO(" MdtValidationAlg::initialize() - number of selected regions: "<<m_region_ids.size()); - gettimeofday(&m_t0,NULL); - - m_debug=0; -//db connection - StatusCode sc=ConnectDb(); - m_head_ops = new CalibHeadOperations(*m_db); - if(!sc.isSuccess()) return sc; -//get head id if not given - if(m_headid<0) { - m_headid=m_head_ops->GetLatestHeadId(); - if(m_headid<0) { - ATH_MSG_FATAL("Cannot get head_id for '"<<m_sitename<<"'!"); - return StatusCode::FAILURE; - } - } - m_data_connection=m_head_ops->GetDataConnection(m_headid, true, m_writer_ConnectionString, m_writer_account, m_writer_password); - if(m_data_connection==NULL) { - ATH_MSG_FATAL("Cannot get data connection!"); - return StatusCode::FAILURE; - } - m_data_connection->OpenConnection(); -//database opertations classes - m_t0_op=new CalibT0DbOperations(*m_data_connection); - m_rt_op=new CalibRtDbOperations(*m_data_connection); - - ATH_MSG_INFO("Validating for header="<<m_headid<<"/"<<m_sitename); - return StatusCode::SUCCESS; -} - -StatusCode MdtValidationAlg::execute() { - /** execute function */ - ATH_MSG_INFO(" MdtValidationAlg::execute "); - - m_ComputeLimits = 0; - if (m_limitslevel) m_ComputeLimits = 1; - - //loop on all the ids in the selected calibration region - for (std::vector<MuonCalib::NtupleStationId>::const_iterator it=m_region_ids.begin(); it!=m_region_ids.end(); it++) { - if(m_db==NULL) { - ATH_MSG_ERROR(" MdtValidationAlg::execute - no DB connection defined "); - return StatusCode::FAILURE; - } - m_Histos = TFile::Open(((*it).regionId() + ".root").c_str(), "recreate"); - - if(m_validationTask=="T0Val") { - /** Manage Limits file and output RootFile */ - m_chamber = it->regionId(); - m_eta = it->GetEta(); - m_phi = it->GetPhi(); - - RootFile(); - - ATH_MSG_INFO("Reading t0s for region " << it->regionId() <<""); - - m_tube_chamber = m_t0_op->LoadT0Validation(*it, m_headid, m_sitename); - if(m_tube_chamber==NULL) { - ATH_MSG_FATAL("Cannot load t0s for "<<(*it).regionId()); - m_Histos->Close(); - return StatusCode::FAILURE; - } - ATH_MSG_INFO("Validating "<<m_tube_chamber->numMultilayers() * m_tube_chamber-> numLayers() * m_tube_chamber->numTubes() <<" tubes."); - // end reading t0s // - - NtupleStationId id(*it); - Histos(id); - -// T0 Validation limits can be set in MuonCalibJobTransforms/share/skeleton.mdt_calib_validate.py, -// computed from measurements, or read from a limits file - if(m_ComputeLimits) { - ComputeLimits(); - // keep default limits - } - ATH_CHECK(ValidateChamberT0(id)); - int success = -1; - if (m_debug >0) SummaryReport(success); - - m_HistosList->Write(); - delete m_HistosList; - - } else if (m_validationTask=="RtVal"){ - m_minSegs = 1000; - m_minDAngle = 0.0; - ATH_CHECK(ValidateRegionRt(*it)); - - } else { - ATH_MSG_ERROR(" No ValidationTask selected"); - return StatusCode::FAILURE; - } - m_Histos->Close(); - } - return StatusCode::SUCCESS; -} - -StatusCode MdtValidationAlg::finalize() { - /** finalize function */ - ATH_MSG_INFO(" MdtValidationAlg::finalize "); - - gettimeofday(&m_t1,NULL); - timersub(&m_t1,&m_t0,&m_result); - ATH_MSG_INFO("ValidationAlg execution time= "<<m_result.tv_sec+m_result.tv_usec*0.000001<<" seconds"); - - return StatusCode::SUCCESS; -} - -StatusCode MdtValidationAlg::ConnectDb() { - ATH_MSG_INFO("Connecting to "<<m_db_ConnectionString<<" "<<m_db_WorkingSchema); - m_db=new CalibDbConnection(m_db_ConnectionString, m_db_WorkingSchema); - m_db->SetLogin(m_reader_account, m_reader_password); - if(!m_db->OpenConnection()) { - return StatusCode::FAILURE; - } - return StatusCode::SUCCESS; -} - -bool MdtValidationAlg::RootFile(bool good_tubes) { - if(!good_tubes) m_HistosList = new TList(); - TH1F *hslope; - TH1F *ht0; - TH1F *htmax; - TH1F *httot; - TH1F *hsummary; - if(good_tubes) { - hslope = new TH1F("hslope_gd","slope parameter", 90, m_minSlope, m_maxSlope); - ht0 = new TH1F("ht0_gd","T0",800,m_minT0,m_maxT0); - htmax = new TH1F("htmax_gd", "Tmax", 800, m_minTmax, m_maxTmax); - httot = new TH1F("httot_gd", "Total Drift Length", 300, m_minTtot, m_maxTtot); - hsummary = new TH1F("hsummary_gd", "Summary", 50, -0.5, 49.5); - } else { - hslope = new TH1F("hslope","slope parameter", 90, m_minSlope, m_maxSlope); - ht0 = new TH1F("ht0","T0",800,m_minT0,m_maxT0); - htmax = new TH1F("htmax", "Tmax", 800, m_minTmax, m_maxTmax); - httot = new TH1F("httot", "Total Drift Length", 300, m_minTtot, m_maxTtot); - hsummary = new TH1F("hsummary", "Summary", 50, -0.5, 49.5); - } - m_HistosList->Add(hslope) ; - m_HistosList->Add(ht0) ; - m_HistosList->Add(htmax) ; - m_HistosList->Add(httot) ; - m_HistosList->Add(hsummary); - return true; -} - -// Read T0, Tmax, T0slope limits from a file. -// NOT USED (commented out above) -bool MdtValidationAlg::ReadLimitsFile() { - ToString ts; - std::string prefix="Limits_" ; - std::string suffix= ".dat" ; - std::string chambName(m_chamber) ; - std::string middle("_"+ts(m_phi)+"_"+ts(m_eta)) ; - std::string limitsfile(prefix+chambName+middle+suffix) ; - m_limitsFile = limitsfile ; - - std::ifstream LimitsFile(m_limitsFile.c_str()); - - if (LimitsFile) { - char option[20]; - char chComm[] = "#"; - std::string c; - - while( LimitsFile >> option) { - ATH_MSG_INFO(" while while .... "); - while (strncmp(option,chComm,1)==0) { - ATH_MSG_INFO(" ignore .... "); - LimitsFile.ignore(500,'\n'); - LimitsFile>>option; - } - if (strncmp(option,"SLOPE",5)==0 ) { - LimitsFile >> m_minSlope; - LimitsFile >> m_maxSlope; - ATH_MSG_INFO("Slope Limits : " <<m_minSlope << " -- " << m_maxSlope); - } - if (strncmp(option,"T0",2)==0 ) { - LimitsFile >> m_minT0; - LimitsFile >> m_maxT0; - ATH_MSG_INFO("T0 Limits : " << m_minT0 << " -- "<< m_maxT0); - } - if (strncmp(option,"TMAX",4)==0 ) { - LimitsFile >> m_minTmax; - LimitsFile >> m_maxTmax; - ATH_MSG_INFO("TMax Limits : "<< m_minTmax << " -- " << m_maxTmax); - } - if (strncmp(option,"TTOT",4)==0 ) { - LimitsFile >> m_minTtot; - LimitsFile >> m_maxTtot; - ATH_MSG_INFO("TTot Limits : "<<m_minTtot<<" -- "<< m_maxTtot); - } - if (strncmp(option,"PP",2)==0 ) { - LimitsFile >> m_minPP; - LimitsFile >> m_maxPP; - ATH_MSG_INFO("Peak / Plateau Limits : "<<m_minPP<<" -- "<< m_maxPP); - } - } - LimitsFile.close(); - ATH_MSG_INFO("LimitsFile closed : "); - return true; - } - return false; -} - -bool MdtValidationAlg::ComputeLimits() { - - MsgStream log(msgSvc(), name()); - - //TH1F * hchamber = (TH1F *) m_HistosList->FindObject("hchamber") ; - TH1F * ht0 = (TH1F *) m_HistosList->FindObject("ht0") ; - TH1F * hslope = (TH1F *) m_HistosList->FindObject("hslope") ; - TH1F * htmax = (TH1F *) m_HistosList->FindObject("htmax") ; - TH1F * httot = (TH1F *) m_HistosList->FindObject("httot") ; - - if (m_limitslevel == 10 ) { - - /* - m_summary[20] = hslope->GetMean() ; - m_summary[21] = hslope->GetRMS() ; - - m_summary[20] = hslope->GetMean() ; - m_summary[21] = hslope->GetRMS() ; - m_summary[22] = ht0->GetMean() ; - m_summary[23] = ht0->GetRMS() ; - m_summary[24] = htmax->GetMean() ; - m_summary[25] = htmax->GetRMS() ; - m_summary[26] = httot->GetMean() ; - m_summary[27] = httot->GetRMS() ; - */ - m_minSlope = hslope->GetMean() - 3.*hslope->GetRMS(); - m_maxSlope = hslope->GetMean() + 3.*hslope->GetRMS(); - m_minT0 = ht0->GetMean() - 3.*ht0->GetRMS(); - m_maxT0 = ht0->GetMean() + 3.*ht0->GetRMS(); - m_minTmax = htmax->GetMean() - 3.*htmax->GetRMS(); - m_maxTmax = htmax->GetMean() + 3.*htmax->GetRMS(); - m_minTtot = httot->GetMean() - 3.*httot->GetRMS(); - m_maxTtot = httot->GetMean() + 3.*httot->GetRMS(); - } - - if (m_limitslevel>0 && m_limitslevel<10 ) { - m_minSlope = getLeftLimit(hslope); - m_maxSlope = getRightLimit(hslope); - m_minTmax = getLeftLimit(htmax); - m_maxTmax = getRightLimit(htmax); - m_minTtot = getLeftLimit(httot); - m_maxTtot = getRightLimit(httot); - m_minT0 = getLeftLimit(ht0); - m_maxT0 = getRightLimit(ht0); - } - m_minPP = 0. ; - m_maxPP = 10000. ; - - log<<MSG::INFO<<"slope min/max "<<m_minSlope<<"/"<<m_maxSlope<<" Tmax min/max "<<m_minTmax <<"/"<<m_maxTmax<<" Ttot min/max "<<m_minTtot<<"/"<<m_maxTtot<<" T0 min/max "<<m_minT0<<"/"<<m_maxT0<<endmsg; - - return true; -} - -bool MdtValidationAlg::Histos(NtupleStationId & id, const std::vector<int> & validflags){ - //TH1F * hchamber = (TH1F *) m_HistosList->FindObject("hchamber") ; - TH1F *ht0; - TH1F *hslope; - TH1F *htmax; - TH1F *httot; - if(validflags.size()==0) { - ht0 = (TH1F *) m_HistosList->FindObject("ht0"); - hslope = (TH1F *) m_HistosList->FindObject("hslope"); - htmax = (TH1F *) m_HistosList->FindObject("htmax"); - httot = (TH1F *) m_HistosList->FindObject("httot"); - } else { - ht0 = (TH1F *) m_HistosList->FindObject("ht0_gd"); - hslope = (TH1F *) m_HistosList->FindObject("hslope_gd"); - htmax = (TH1F *) m_HistosList->FindObject("htmax_gd"); - httot = (TH1F *) m_HistosList->FindObject("httot_gd"); - } - - unsigned int count(0); - for(unsigned int ml=0; ml<m_tube_chamber->numMultilayers(); ml++) { - for(int ly=0; ly<static_cast<int>(m_tube_chamber->numLayers()); ly++) { - for(int tb=0; tb<static_cast<int>(m_tube_chamber->numTubes()); tb++) { -//check if tube really exists - if (!exists(id, ml, ly, tb)) continue; - count++; - if(count-1 < validflags.size()) { - if(validflags[count-1] != 3) continue; - } - ht0->Fill(m_tube_chamber->getFit(ml, ly, tb)->par[4]); - hslope->Fill(m_tube_chamber->getFit(ml, ly, tb)->par[6]); - htmax->Fill(m_tube_chamber->getFit(ml, ly, tb)->par[5]); - httot->Fill(m_tube_chamber->getFit(ml, ly, tb)->par[5]-m_tube_chamber->getFit(ml, ly, tb)->par[4]); - } //end loop over tubes - } //end loop over layers - } //end loop over ML - - return true; -} - -///////////////////////////////////////////////////////////////////////////// -StatusCode MdtValidationAlg::ValidateChamberT0(NtupleStationId & id) { - MsgStream log(msgSvc(), name()); - log<<MSG::INFO<<"Entering ValidateChamberT0" <<endmsg; - std::vector<int> validflags; - int validflag; - bool all_ok(true); - - for(unsigned int ml=0; ml<m_tube_chamber->numMultilayers(); ml++) { - for(unsigned int ly=0; ly<m_tube_chamber->numLayers(); ly++) { - for(unsigned int tb=0; tb<m_tube_chamber->numTubes(); tb++) { - if(!exists(id, ml, ly, tb)) { //check for dummy tubes - log<<MSG::INFO<< " tube ("<<ml+1<<","<<ly+1<<","<<tb+1<<") is a dummy tube!"<<endmsg; - validflags.push_back(5); - } else { - ValidateTubeT0(m_tube_chamber->getFit(ml, ly, tb), validflag); - validflags.push_back(validflag); - if(validflag !=3) { - all_ok = false; - } - } - } //end loop over tubes - } //end loop over layers - } //end loop over ML - if(!all_ok) { -//fill new histograms with good tubes only - RootFile(true); - Histos(id, validflags); - int count(0); - //for failed tubes set mean values - for(unsigned int ml=0; ml<m_tube_chamber->numMultilayers(); ml++) { - for(unsigned int ly=0; ly<m_tube_chamber->numLayers(); ly++) { - for(unsigned int tb=0; tb<m_tube_chamber->numTubes(); tb++) { - if(validflags[count]!=3 && validflags[count]!=5) { - TH1F * ht0 = (TH1F *) m_HistosList->FindObject("ht0_gd"); - TH1F * hslope = (TH1F *) m_HistosList->FindObject("hslope_gd"); - TH1F * htmax = (TH1F *) m_HistosList->FindObject("htmax_gd"); - m_tube_chamber->getFit(ml, ly, tb)->par[4]=ht0->GetMean(); - m_tube_chamber->getFit(ml, ly, tb)->par[5]=htmax->GetMean(); - m_tube_chamber->getFit(ml, ly, tb)->par[6]=hslope->GetMean(); - m_tube_chamber->getCalib(ml, ly, tb)->t0=ht0->GetMean(); - m_tube_chamber->getFit(ml, ly, tb)->group_by="VAL_FIX"; - log<<MSG::INFO<< " tube ("<<ml+1<<","<<ly+1<<","<<tb+1<<") validated with flag = "<<validflag<<endmsg; - } - count++; - } //end loop over tubes - } //end loop over layers - } //end loop over ML - } - for(std::vector<int>::iterator it=validflags.begin(); it!=validflags.end(); it++) { - ATH_MSG_INFO(*it<<" "); - } - if( m_writeToDbEnable ) { - if(!m_t0_op->WriteT0Chamber(id, m_tube_chamber, validflags, m_headid, m_sitename)) { - log<<MSG::FATAL<<" Cannot write Chamber!"<<endmsg; - return StatusCode::FAILURE; - } - } - return StatusCode::SUCCESS; -} - -///////////////////////////////////////////////////////////////////////////// -void MdtValidationAlg::ValidateTubeT0 (const MdtTubeFitContainer::SingleTubeFit *fit, int &validflag) { -///////////////////////////////////////////////////////////////////////////// - - MsgStream log(msgSvc(), name()); - log<<MSG::INFO<<"Entering ValidateTubeT0" <<endmsg; - - int T0flag = CheckT0Parameters(fit); - - if (T0flag) { - validflag=3; - } else { - validflag=4; - } -} - -///////////////////////////////////////////////////////////////////////////// -int MdtValidationAlg::CheckT0Parameters (const MdtTubeFitContainer::SingleTubeFit *fit) { -///////////////////////////////////////////////////////////////////////////// - MsgStream log(msgSvc(), name()); - log<<MSG::INFO<<"Entering CheckT0Parameters" <<endmsg; - - double t0 = fit->par[4]; - double slope = fit->par[6]; - double tmax = fit->par[5]; - double ttot = tmax-t0; - - bool bsl = (slope >= m_minSlope && slope <= m_maxSlope ); - bool bt0 = (t0 >= m_minT0 && t0 <= m_maxT0); - bool btmax = (tmax >= m_minTmax && tmax <= m_maxTmax); - bool btt = (ttot >= m_minTtot && ttot <= m_maxTtot); -// bool bPP = true ; //what is this? get rid if it below - - int T0flag = 0; - if (bsl && bt0 && btmax && btt ) {T0flag=1;} - - log<<MSG::INFO<<"Result of CheckT0Parameters: T0flag=" << T0flag <<" (T0flag=0 fail, =1 ok) T0_Limits="<<bt0<<" Slope_Limits="<<bsl<<" Tmax_Limits="<<btmax<<" Total_Drifttime_Limits="<<btt <<endmsg; - - return T0flag; -} - - -///////////////////////////////////////////////////////////////////////////// -StatusCode MdtValidationAlg::ValidateRegionRt(const NtupleStationId & id) { -///////////////////////////////////////////////////////////////////////////// - MsgStream log(msgSvc(), name()); - log<<MSG::INFO<< " Entering ValidateRegionRt" <<endmsg; - - RtFullInfo full_info; - std::vector<SamplePoint> points_in; - - if(!m_rt_op->LoadRt(id, m_headid, false, m_sitename, points_in, &full_info)) { - log<<MSG::FATAL<<"Cannot read chamber!"<<endmsg; - return StatusCode::FAILURE; - } - std::vector<SamplePoint> points; - for(std::vector<SamplePoint>::const_iterator it=points_in.begin(); it!=points_in.end(); it++) { - if(it->x2()>-99.) points.push_back(*it); - } - /** any logic for rt validation!!!!!!!! */ - int good1=CheckRtParameters(points, &full_info); -//if rt relation is good - if (good1==1) { - if(m_writeToDbEnable) { - if(!m_rt_op->SetValidflag(3)) { - log<<MSG::FATAL<<"Cannot set validflag for rt!"<<endmsg; - return StatusCode::FAILURE; - } - } -//rt is bad or has been fixed - } else { - //load default rt - int v_flag=5; - if(good1==0) { - //open file - std::ifstream infile(m_defaultRtFile.c_str()); - if(infile.fail()) { - log << MSG::ERROR << "Cannot open file '" << m_defaultRtFile << "' for reading!" << endmsg; - return StatusCode::FAILURE; - } - //sample points - float t,r,s; - std::string sdummy; - float dummy(0); - points.clear(); - //ignore the first line - getline(infile, sdummy); - //read table - while (!(infile.eof() || infile.fail())) { - infile >> r; - if (infile.eof() || infile.fail() || dummy > 15.0) break; - infile >> t; - infile >> s; - SamplePoint p(t,r,s); - points.push_back(p); - } - v_flag=4; - } - if(m_writeToDbEnable) { - if(!m_rt_op->SetValidflag(1, false)) { - log << MSG::FATAL << "Cannot set validflag!"<<endmsg; - return StatusCode::FAILURE; - } - full_info.setImplementation("Validation"); - if(!m_rt_op->WriteUpdateRt(id, m_headid, m_sitename, points, v_flag, &full_info)) { - log << MSG::FATAL << "Cannot write rt-relation!"<<endmsg; - return StatusCode::FAILURE; - } - } - } - return StatusCode::SUCCESS; -} - -///////////////////////////////////////////////////////////////////////////// -int MdtValidationAlg::CheckRtParameters (std::vector<SamplePoint> & points, const RtFullInfo * full_info) { -///////////////////////////////////////////////////////////////////////////// - - MsgStream log(msgSvc(), name()); - log<<MSG::INFO<<"Entering CheckRtParameters" <<endmsg; - - double nsegs = full_info->numSeg(); - double aveangle = full_info->rmsAng(); - - bool bseg = ( nsegs >= m_minSegs ); - bool baveangle = ( aveangle >= m_minDAngle ); - - int RTflag = 0; - if (bseg && baveangle ) {RTflag=1;} - - log<<MSG::INFO<<"Result of CheckRtParameters is: RTflag=" << RTflag <<" (RTflag=0 fail, =1 ok) Number_Segments_Check="<<bseg<<" Ave_Angle_Check="<<baveangle<<endmsg; - - if(RTflag==0) { - return 0; - } - - FixRtEnds fix_end; - int ret=fix_end.FixEnds(points); - log<<MSG::INFO<<"Fix End points returned "<<ret<<endmsg; - switch(ret) { - case FixRtEnds::NO_FIX_NEEDED: - return 1; - break; - case FixRtEnds::FIX_APPLIED: - return 2; - break; - case FixRtEnds::FIX_FAILED: - return 0; - } - return RTflag; -} - -///////////////////////////////////////////////////////////////////////////// -void MdtValidationAlg::SummaryReport(int success) { -///////////////////////////////////////////////////////////////////////////// - ATH_MSG_INFO("======================Validation Summary Report =================="); - ATH_MSG_INFO(" Success in saving Calibration data is "<<success<<" (0=fail, 1=ok), chamber is " <<m_chamber); -} - -double MdtValidationAlg::getLeftLimit(TH1F * histo) { - int ibin; - double left_integral; - double left_limit=0; - double histoIntegral = histo->Integral(); - int nbins = histo->GetNbinsX(); - - double r_limit = .03; - if (m_limitslevel==2){r_limit = .05;} - if (m_limitslevel==3){r_limit = .1;} - - for(ibin=1;ibin<nbins;ibin++) { - left_integral = histo->Integral(1,ibin); - left_limit = histo->GetBinCenter(ibin); - double r = left_integral/histoIntegral; - if(r>r_limit) break; - } - - return left_limit ; -} - -double MdtValidationAlg::getRightLimit(TH1F * histo) { - int ibin; - double right_integral; - double right_limit=0; - double histoIntegral = histo->Integral(); - int nbins = histo->GetNbinsX(); - - double r_limit = .03; - if (m_limitslevel==2){r_limit = .05;} - if (m_limitslevel==3){r_limit = .1;} - for(ibin=nbins;ibin>0;ibin--) { - right_integral = histo->Integral(ibin,nbins); - right_limit = histo->GetBinCenter(ibin); - double r = right_integral/histoIntegral; - if(r>r_limit) break; - } - return right_limit ; -} - -// Check if tube is a real or dummy tube (inserted as placeholder in COOL text blob) -inline bool MdtValidationAlg::exists(NtupleStationId &id, int ml, int ly, int tb) { - - SG::ReadCondHandle<MuonGM::MuonDetectorManager> DetectorManagerHandle{m_DetectorManagerKey}; - const MuonGM::MuonDetectorManager* MuonDetMgr = DetectorManagerHandle.cptr(); - if(MuonDetMgr==nullptr){ - ATH_MSG_ERROR("Null pointer to the read MuonDetectorManager conditions object"); - return false; - } - - if(!id.InitializeGeometry(m_idHelperSvc->mdtIdHelper(), MuonDetMgr)) { - return false; - } - if(ml+1>id.NMultilayers()) { - ATH_MSG_INFO(ml+1<<" "<<id.NMultilayers()); - return false; - } - if(ly+1>id.NLayers(ml)) { - ATH_MSG_INFO(ly+1<<" "<<id.NLayers(ml+1)); - return false; - } - if(tb+1>id.NTubes(ml)) { - ATH_MSG_INFO(tb+1<<" "<<id.NTubes(ml+1)); - return false; - } - return true; -} - -} //namespace MuonCalib diff --git a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibValidation/src/components/MdtValidationAlg_entries.cxx b/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibValidation/src/components/MdtValidationAlg_entries.cxx deleted file mode 100644 index 1bc8abee6dbb1346c65d5826c2eeccf752db602a..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibValidation/src/components/MdtValidationAlg_entries.cxx +++ /dev/null @@ -1,3 +0,0 @@ -#include "MdtCalibValidation/MdtValidationAlg.h" - -DECLARE_COMPONENT( MuonCalib::MdtValidationAlg ) diff --git a/MuonSpectrometer/MuonCalib/MuonCalibAlgs/CMakeLists.txt b/MuonSpectrometer/MuonCalib/MuonCalibAlgs/CMakeLists.txt deleted file mode 100644 index 18fe1fb75e029ba20365a2f0d3edab3d344b9f77..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibAlgs/CMakeLists.txt +++ /dev/null @@ -1,61 +0,0 @@ -################################################################################ -# Package: MuonCalibAlgs -################################################################################ - -# Declare the package name: -atlas_subdir( MuonCalibAlgs ) - -# Declare the package's dependencies: -atlas_depends_on_subdirs( PUBLIC - Control/AthenaBaseComps - GaudiKernel - MuonSpectrometer/MuonCalib/MuonCalibEventBase - MuonSpectrometer/MuonCnv/MuonPrdSelector - PRIVATE - Control/StoreGate - DetectorDescription/GeoPrimitives - Event/EventInfo - Event/xAOD/xAODEventInfo - Generators/GeneratorObjects - LArCalorimeter/LArRecEvent - MuonSpectrometer/MuonCalib/MuonCalibEvent - MuonSpectrometer/MuonCalib/MuonCalibITools - MuonSpectrometer/MuonCalib/MuonCalibIdentifier - MuonSpectrometer/MuonCalib/MuonCalibNtuple - MuonSpectrometer/MuonCalib/MuonCalibUtils/MuonCalibStl - MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry - MuonSpectrometer/MuonDigitContainer - MuonSpectrometer/MuonIdHelpers - MuonSpectrometer/MuonRDO - MuonSpectrometer/MuonReconstruction/MuonDataPrep/CscClusterization - MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonPrepRawData - MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonTrigCoinData - MuonSpectrometer/MuonSimData - Simulation/G4Sim/TrackRecord - TileCalorimeter/TileEvent - TileCalorimeter/TileIdentifier - Tracking/TrkEvent/TrkEventPrimitives - Trigger/TrigT1/TrigT1Result - Generators/AtlasHepMC ) - -# External dependencies: -find_package( CLHEP ) -find_package( Eigen ) - -# Component(s) in the package: -atlas_add_library( MuonCalibAlgsLib - src/*.cxx - PUBLIC_HEADERS MuonCalibAlgs - PRIVATE_INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} - PRIVATE_DEFINITIONS ${CLHEP_DEFINITIONS} - LINK_LIBRARIES AthenaBaseComps GaudiKernel MuonCalibEventBase StoreGateLib SGtests MuonIdHelpersLib CscClusterizationLib MuonPrdSelectorLib - PRIVATE_LINK_LIBRARIES ${CLHEP_LIBRARIES} AtlasHepMCLib ${EIGEN_LIBRARIES} GeoPrimitives EventInfo xAODEventInfo GeneratorObjects LArRecEvent MuonCalibEvent MuonCalibITools MuonCalibIdentifier MuonCalibNtuple MuonReadoutGeometry MuonDigitContainer MuonRDO MuonPrepRawData MuonTrigCoinData MuonSimData TileEvent TileIdentifier TrkEventPrimitives TrigT1Result TrackRecordLib ) - -atlas_add_component( MuonCalibAlgs - src/components/*.cxx - INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} - LINK_LIBRARIES ${CLHEP_LIBRARIES} AtlasHepMCLib ${EIGEN_LIBRARIES} AthenaBaseComps GaudiKernel MuonCalibEventBase StoreGateLib SGtests GeoPrimitives EventInfo xAODEventInfo GeneratorObjects LArRecEvent MuonCalibEvent MuonCalibITools MuonCalibIdentifier MuonCalibNtuple MuonReadoutGeometry MuonDigitContainer MuonIdHelpersLib MuonRDO CscClusterizationLib MuonPrepRawData MuonTrigCoinData MuonSimData TileEvent TileIdentifier TrkEventPrimitives TrigT1Result MuonCalibAlgsLib ) - -# Install files from the package: -atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) -atlas_install_joboptions( share/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} --extend-ignore=F401,F821 ) diff --git a/MuonSpectrometer/MuonCalib/MuonCalibAlgs/MuonCalibAlgs/MuonCalibAlg.h b/MuonSpectrometer/MuonCalib/MuonCalibAlgs/MuonCalibAlgs/MuonCalibAlg.h deleted file mode 100644 index c0e890f6a8e5724e9863c97a5e06d8376f93e556..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibAlgs/MuonCalibAlgs/MuonCalibAlg.h +++ /dev/null @@ -1,152 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef MUONCALIB_MUONCALIBALG_H -#define MUONCALIB_MUONCALIBALG_H - -#include "AthenaBaseComps/AthAlgorithm.h" -#include "GaudiKernel/ToolHandle.h" -#include "GaudiKernel/ServiceHandle.h" - -#include "MuonCalibEventBase/MuonCalibEvent.h" -#include "MuonPrdSelector/MuonIdCutTool.h" -#include "MuonIdHelpers/IMuonIdHelperSvc.h" -#include "MuonReadoutGeometry/MuonDetectorManager.h" -#include "CscClusterization/ICscStripFitter.h" -#include "MuonCalibITools/IMuonCalibTool.h" -#include "MuonCalibITools/IIdToFixedIdTool.h" - -class TileTBID; - -namespace Muon { - class RpcPrepData; -} - -namespace MuonCalib { - - class MuonCalibEventInfo; - class MuonCalibTriggerTimeInfo; - class MuonCalibTruthCollection; - class MuonCalibRawHitCollection; - class MuonCalibRawTriggerHitCollection; - class MuonCalibRawRpcHit; - - /** - @class MuonCalibAlg - ATHENA Algorithm retrieving the ingredients for a MuonCalibEvent from storegate and passing them to a calibration tool. - - @author Niels.Van.Eldik@cern.ch, Zdenko.Van.Kesteren@cern.ch - */ - class MuonCalibAlg : public AthAlgorithm { - public: - /** - Algorithm constructor declaring all properties and opening a ROOT file - */ - MuonCalibAlg(const std::string& name, ISvcLocator* pSvcLocator); - - /** - Algorithm destructor (closing the ROOT file) - */ - ~MuonCalibAlg()=default; - - /** - Algorithm initialize: - - retrieves MuonCalibTool - - retrieves auxillairy classes to construct Calib EDM classes (IdHelpers, IdToFixedIdTool) - - */ - StatusCode initialize(); - - /** Algorithm execute, called once per event. It performs the following tasks: - - retrieve MuonCalibEvent - - feeds MuonCalibEvent to chosen MuonCalibTool - */ - StatusCode execute(); - - /** Algorithm finalize - Calls finalize routine of the MuonCalibTool - */ - StatusCode finalize(); - - private: - /** create a MuonCalibRawRpcHit from a RpcPrepData */ - MuonCalibRawRpcHit* createRawRpcHit( const Muon::RpcPrepData& prd ) const; - - /** retrieve patterns, truth, eventinfo and raw hits and store in MuonCalibEvent */ - const MuonCalibEvent* retrieveEvent() const; - - /** retrieve PrepRawData of all technologies, convert them to MuonCalibRawXxxHits and store them on MuonCalibRawHitCollection */ - const MuonCalibRawHitCollection* retrieveRawHits( const MuonCalibEvent::MCPVec &patterns ) const; - - /** retrieve RawTriggerData convert them to MuonCalibRawTriggerXxxHits and store them on MuonCalibRawTriggerHitCollection */ - const MuonCalibRawTriggerHitCollection* retrieveRawTriggerHits() const; - - /** retrieve patterns and segments from storegate */ - const MuonCalibEvent::MCPVec retrievePatterns() const; - - /** retrieve truth information from storegate and convert to MuonCalibTruthCollection */ - const MuonCalibTruthCollection* retrieveTruthCollection() const; - - /** retrieve event information from storegate and convert to MuonCalibEventInfo */ - MuonCalibEventInfo retrieveEventInfo() const; - - /** retrieve event trigger time information from storegate and convert to MuonCalibTriggerTimeInfo */ - const MuonCalibTriggerTimeInfo* retrieveTriggerTimeInfo() const; - - /** retrieve MuonDetectorManager from the conditions store */ - SG::ReadCondHandleKey<MuonGM::MuonDetectorManager> m_DetectorManagerKey {this, "DetectorManagerKey", - "MuonDetectorManager", - "Key of input MuonDetectorManager condition data"}; - - std::string m_globalPatternLocation; //!< Location of the MuonCalibPattern in StoreGate - - /* RtCalibration initialization */ - ToolHandle<MuonCalib::IMuonCalibTool> m_muonCalibTool; //!< pointer to RtCalibrationCreator - unsigned int m_eventNumber; //!< counter keeping track of the event - std::string m_eventTag; //!< tag of the event, describing reconstruction mechanism - std::string m_ntupleName; //!< name of the ntuple - - /* IdentifierTool initialization */ - ToolHandle<IIdToFixedIdTool> m_idToFixedIdTool; //!< pointer to IdToFixedIdtool - - // Strip fitter to fit - // time samples and extract strip charge - ToolHandle<ICscStripFitter> m_stripFitter; - - // Tool to cut on identifiers - ToolHandle<IMuonIdCutTool> m_muonIdCutTool; - - ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; - - std::vector <const MuonCalibEvent*> m_events; //!< vector holding pointers to events, for deletion at finalize - - bool m_doTruth; //!< property toggeling if truth info is stored on ntuple - bool m_doTruthMuonOnly; //!< property toggeling to store ONLY muon truth data on ntuple for cavern background - bool m_doRawData ; //!< property toggeling if raw hits are stored on ntuple - bool m_doDeleteEvent; //!< property toggling if event deleted at execute or at finalize, false = delete at finalize (default) - bool m_createRootFile; //!< property toggeling if the ntuple is created - bool m_addTriggerTag; //!< property toggling if the Trigger type should be added to the EventTag - bool m_mdt_tdc_cut; //!< property toggling if a tdc cut should be applied for MDT data - mutable bool m_trigger_waning_printed; - mutable bool m_lar_waning_printed; - mutable bool m_mbts_warning_printed; - bool m_doPrdSelect; //!< property turning on cuts on truth hits if the global flag doPrdSelect = True - bool m_doMDTs; //!< Process MDTs or not - bool m_doCSCs; //!< Process CSCs or not - bool m_doRPCs; //!< Process RPCs or not - bool m_doTGCs; //!< Process TGCs or not - bool m_doRPCCoin; //!< Process Coin RPCs or not - bool m_doTGCCoin; //!< Process Coin TGCs or not - bool m_doRpcSectorLogic; //!< Process rpc sector logic - bool m_doRPCTriggerHits; //!< Process rpc trigger hit info - float m_mbts_threshold; //!< MBTS threshold - const TileTBID* m_tileTBID; //!< TileTBID - bool m_ntupFileOpen; - }; - -} - -#endif - - diff --git a/MuonSpectrometer/MuonCalib/MuonCalibAlgs/doc/Doxyfile b/MuonSpectrometer/MuonCalib/MuonCalibAlgs/doc/Doxyfile deleted file mode 100644 index 7da36d2e9833458ca748c877d924a42a7df93b50..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibAlgs/doc/Doxyfile +++ /dev/null @@ -1,215 +0,0 @@ -# Doxyfile 1.3.9.1 - -#--------------------------------------------------------------------------- -# Project related configuration options -#--------------------------------------------------------------------------- -PROJECT_NAME = MuonCalibAlgs -PROJECT_NUMBER = MuonCalibAlgs-01-01-21 -OUTPUT_DIRECTORY = /afs/cern.ch/user/z/zvankest/project/documentation/InstallArea/doc/MuonCalibAlgs -CREATE_SUBDIRS = NO -OUTPUT_LANGUAGE = English -USE_WINDOWS_ENCODING = YES -BRIEF_MEMBER_DESC = YES -REPEAT_BRIEF = YES -ABBREVIATE_BRIEF = -ALWAYS_DETAILED_SEC = NO -INLINE_INHERITED_MEMB = YES -FULL_PATH_NAMES = YES -STRIP_FROM_PATH = -STRIP_FROM_INC_PATH = -SHORT_NAMES = NO -JAVADOC_AUTOBRIEF = NO -MULTILINE_CPP_IS_BRIEF = NO -DETAILS_AT_TOP = NO -INHERIT_DOCS = YES -DISTRIBUTE_GROUP_DOC = NO -TAB_SIZE = 8 -ALIASES = -OPTIMIZE_OUTPUT_FOR_C = NO -OPTIMIZE_OUTPUT_JAVA = NO -SUBGROUPING = YES -#--------------------------------------------------------------------------- -# Build related configuration options -#--------------------------------------------------------------------------- -EXTRACT_ALL = YES -EXTRACT_PRIVATE = YES -EXTRACT_STATIC = YES -EXTRACT_LOCAL_CLASSES = YES -EXTRACT_LOCAL_METHODS = NO -HIDE_UNDOC_MEMBERS = NO -HIDE_UNDOC_CLASSES = NO -HIDE_FRIEND_COMPOUNDS = NO -HIDE_IN_BODY_DOCS = NO -INTERNAL_DOCS = NO -CASE_SENSE_NAMES = YES -HIDE_SCOPE_NAMES = NO -SHOW_INCLUDE_FILES = YES -INLINE_INFO = YES -SORT_MEMBER_DOCS = NO -SORT_BRIEF_DOCS = NO -SORT_BY_SCOPE_NAME = NO -GENERATE_TODOLIST = YES -GENERATE_TESTLIST = YES -GENERATE_BUGLIST = YES -GENERATE_DEPRECATEDLIST= YES -ENABLED_SECTIONS = -MAX_INITIALIZER_LINES = 30 -SHOW_USED_FILES = YES -SHOW_DIRECTORIES = YES -#--------------------------------------------------------------------------- -# configuration options related to warning and progress messages -#--------------------------------------------------------------------------- -QUIET = NO -WARNINGS = YES -WARN_IF_UNDOCUMENTED = YES -WARN_IF_DOC_ERROR = YES -WARN_FORMAT = "$file:$line: $text" -WARN_LOGFILE = -#--------------------------------------------------------------------------- -# configuration options related to the input files -#--------------------------------------------------------------------------- -INPUT = ../src ../MuonCalibAlgs ../doc ../share -FILE_PATTERNS = *.cxx *.h *.py *.xml *.mk -RECURSIVE = YES -EXCLUDE = -EXCLUDE_SYMLINKS = NO -EXCLUDE_PATTERNS = -EXAMPLE_PATH = ../doc ../cmt ../share -EXAMPLE_PATTERNS = *.cxx *.html requirements *.py -EXAMPLE_RECURSIVE = YES -IMAGE_PATH = -INPUT_FILTER = -FILTER_PATTERNS = -FILTER_SOURCE_FILES = NO -#--------------------------------------------------------------------------- -# configuration options related to source browsing -#--------------------------------------------------------------------------- -SOURCE_BROWSER = YES -INLINE_SOURCES = YES -STRIP_CODE_COMMENTS = YES -REFERENCED_BY_RELATION = NO -REFERENCES_RELATION = NO -VERBATIM_HEADERS = NO -#--------------------------------------------------------------------------- -# configuration options related to the alphabetical class index -#--------------------------------------------------------------------------- -ALPHABETICAL_INDEX = NO -COLS_IN_ALPHA_INDEX = 5 -IGNORE_PREFIX = -#--------------------------------------------------------------------------- -# configuration options related to the HTML output -#--------------------------------------------------------------------------- -GENERATE_HTML = YES -HTML_OUTPUT = html -HTML_FILE_EXTENSION = .html -HTML_HEADER = -HTML_FOOTER = -HTML_STYLESHEET = -HTML_ALIGN_MEMBERS = YES -GENERATE_HTMLHELP = NO -CHM_FILE = -HHC_LOCATION = -GENERATE_CHI = NO -BINARY_TOC = NO -TOC_EXPAND = NO -DISABLE_INDEX = NO -ENUM_VALUES_PER_LINE = 4 -GENERATE_TREEVIEW = NO -TREEVIEW_WIDTH = 250 -#--------------------------------------------------------------------------- -# configuration options related to the LaTeX output -#--------------------------------------------------------------------------- -GENERATE_LATEX = NO -LATEX_OUTPUT = latex -LATEX_CMD_NAME = latex -MAKEINDEX_CMD_NAME = makeindex -COMPACT_LATEX = NO -PAPER_TYPE = a4wide -EXTRA_PACKAGES = -LATEX_HEADER = -PDF_HYPERLINKS = NO -USE_PDFLATEX = NO -LATEX_BATCHMODE = NO -LATEX_HIDE_INDICES = NO -#--------------------------------------------------------------------------- -# configuration options related to the RTF output -#--------------------------------------------------------------------------- -GENERATE_RTF = NO -RTF_OUTPUT = rtf -COMPACT_RTF = NO -RTF_HYPERLINKS = NO -RTF_STYLESHEET_FILE = -RTF_EXTENSIONS_FILE = -#--------------------------------------------------------------------------- -# configuration options related to the man page output -#--------------------------------------------------------------------------- -GENERATE_MAN = NO -MAN_OUTPUT = man -MAN_EXTENSION = .3 -MAN_LINKS = NO -#--------------------------------------------------------------------------- -# configuration options related to the XML output -#--------------------------------------------------------------------------- -GENERATE_XML = YES -XML_OUTPUT = xml -XML_SCHEMA = -XML_DTD = -XML_PROGRAMLISTING = YES -#--------------------------------------------------------------------------- -# configuration options for the AutoGen Definitions output -#--------------------------------------------------------------------------- -GENERATE_AUTOGEN_DEF = NO -#--------------------------------------------------------------------------- -# configuration options related to the Perl module output -#--------------------------------------------------------------------------- -GENERATE_PERLMOD = NO -PERLMOD_LATEX = NO -PERLMOD_PRETTY = YES -PERLMOD_MAKEVAR_PREFIX = -#--------------------------------------------------------------------------- -# Configuration options related to the preprocessor -#--------------------------------------------------------------------------- -ENABLE_PREPROCESSING = YES -MACRO_EXPANSION = NO -EXPAND_ONLY_PREDEF = NO -SEARCH_INCLUDES = YES -INCLUDE_PATH = -INCLUDE_FILE_PATTERNS = -PREDEFINED = -EXPAND_AS_DEFINED = -SKIP_FUNCTION_MACROS = YES -#--------------------------------------------------------------------------- -# Configuration::additions related to external references -#--------------------------------------------------------------------------- -TAGFILES = /afs/cern.ch/user/z/zvankest/project/documentation/InstallArea/doc/MuonCalibEventBase.tag /afs/cern.ch/user/z/zvankest/project/documentation/InstallArea/doc/MuonCalibEvent.tag -GENERATE_TAGFILE = /afs/cern.ch/user/z/zvankest/project/documentation/InstallArea/doc/MuonCalibAlgs.tag -ALLEXTERNALS = NO -EXTERNAL_GROUPS = YES -PERL_PATH = /usr/bin/perl -#--------------------------------------------------------------------------- -# Configuration options related to the dot tool -#--------------------------------------------------------------------------- -CLASS_DIAGRAMS = YES -HIDE_UNDOC_RELATIONS = YES -HAVE_DOT = YES -CLASS_GRAPH = YES -COLLABORATION_GRAPH = YES -UML_LOOK = YES -TEMPLATE_RELATIONS = YES -INCLUDE_GRAPH = YES -INCLUDED_BY_GRAPH = YES -CALL_GRAPH = NO -GRAPHICAL_HIERARCHY = YES -DOT_IMAGE_FORMAT = gif -DOT_PATH = -DOTFILE_DIRS = -MAX_DOT_GRAPH_WIDTH = 1024 -MAX_DOT_GRAPH_HEIGHT = 1024 -MAX_DOT_GRAPH_DEPTH = 0 -GENERATE_LEGEND = YES -DOT_CLEANUP = YES -#--------------------------------------------------------------------------- -# Configuration::additions related to the search engine -#--------------------------------------------------------------------------- -SEARCHENGINE = NO - diff --git a/MuonSpectrometer/MuonCalib/MuonCalibAlgs/doc/packagedoc.h b/MuonSpectrometer/MuonCalib/MuonCalibAlgs/doc/packagedoc.h deleted file mode 100644 index 413586cb30bb3280986fcc424452c82ef63e1c33..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibAlgs/doc/packagedoc.h +++ /dev/null @@ -1,21 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -/** - -@page MuonCalibAlgs_page MuonCalibAlgs Package -@author Niels.Van.Eldik@cern.ch - -@section MuonCalibAlgs_MuonCalibAlgsIntro Introduction -This package contains the ATHENA algorithms that are common for all muon -technologies. - -@section MuonCalibAlgs_MuonCalibAlgsOverview Class Overview -The MuonCalibAlgs package contains the following class - -- MuonCalib::MuonCalibAlg: ATHENA Algorithm retrieving the 'ingredients' to construct a MuonCalibEvent from storegate and passing them to a calibration tool. See the MuonCalibEvent class description for the content of a MuonCalibEvent. - - - -*/ diff --git a/MuonSpectrometer/MuonCalib/MuonCalibAlgs/python/MuonCalib.py b/MuonSpectrometer/MuonCalib/MuonCalibAlgs/python/MuonCalib.py deleted file mode 100644 index e0c0a09980d95d4ca454e9a16c877547a59cb469..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibAlgs/python/MuonCalib.py +++ /dev/null @@ -1,230 +0,0 @@ -# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration - -from __future__ import print_function - -from AthenaCommon.AlgSequence import AlgSequence -from AthenaCommon.Logging import logging -# flags -from MuonCnvExample.MuonCalibFlags import muonCalibFlags -from MuonRecExample.MuonRecFlags import muonRecFlags -from RecExConfig.RecFlags import rec as recFlags -from AthenaCommon.BeamFlags import jobproperties -beamFlags = jobproperties.Beam - -import os - -log = logging.getLogger("MuonCalib") - -muonCalibFlags.setDefaults() - -topSequence = AlgSequence() - -MuonSegmentToCalibSegment = None -MuonCalibAlg = None -MuonCalibTool = None -MdtCalibTool = None -MuonCalibExtraTreeAlg = None - - -class MuonCalibConfig: - """Configuration object holding the info of the MuonCalibration inputs and outputs""" - __slots__ = ( 'eventTag', 'segmentsKey', 'segmentCombisKey', 'doPhi', 'doTracks', - 'patternsKey', 'tracksKey' ) - def __init__(self,**kwargs): - for n,v in kwargs.items(): - setattr(self,n,v) - - def __str__(self): - """Print the attributes that have been set. One per line""" - lines = [] - for n in self.__slots__: - try: - v = getattr(self,n) - lines.append( "%s=%r" % (n,v) ) - except AttributeError: - pass - return os.linesep.join(lines) - -# end of class MuonCalibConfig - -# -# A list of standard configurations -# -MoMuConfig = MuonCalibConfig( - eventTag = "MoMu", - segmentCombisKey = "MdtSegmentCombinations", - doPhi = True, - doTracks = True, - patternsKey = "MuonHoughPatternCombinations", - tracksKey = "MooreTracks" ) - -MooreConfig = MuonCalibConfig( - eventTag = "Moore", - segmentsKey = "MooreSegments_", - doPhi = True, - doTracks = True, - patternsKey = "phi_patterns_", - tracksKey = "ConvertedMooreTracks" ) - -MuonboyConfig = MuonCalibConfig( - eventTag = "Muonboy", - segmentsKey = "ConvertedMBoySegments", - doPhi = False, - doTracks = True, - patternsKey = "????", - tracksKey = "ConvertedMBoyMuonSpectroOnlyTracks" ) - -MoMuMooreConfig = MuonCalibConfig( - eventTag = "MoMuMoore", - segmentCombisKey = "MdtSegmentCombinations", - doPhi = True, - doTracks = True, - patternsKey = "MuonHoughPatternCombinations", - tracksKey = "ConvertedMooreTracks" ) - - -def configure(config): - """Configure the calibration input and output. - If both segmentsKey and segmentCombisKey are defined, segmentsKey has priority.""" - from AthenaCommon.AppMgr import ToolSvc - global topSequence,MdtCalibTool, MuonSegmentToCalibSegment, MuonCalibAlg, MuonCalibTool, MuonCalibExtraTreeAlg - log.info("Configuring with %s", config) - - calibMode = muonCalibFlags.Mode() - # - # Configure MuonSegmentToCalibSegment - # - try: - MuonSegmentToCalibSegment = topSequence.MuonSegmentToCalibSegment - except AttributeError: - from MuonCalibPatRec.MuonCalibPatRecConf import MuonCalib__MuonSegmentToCalibSegment - MuonSegmentToCalibSegment = MuonCalib__MuonSegmentToCalibSegment("MuonSegmentToCalibSegment") - topSequence += MuonSegmentToCalibSegment - MuonSegmentToCalibSegment.UseCscSegments = muonRecFlags.doCSCs() - - # segmentsKey - try: - segmentsKey = config.segmentsKey - except AttributeError: - MuonSegmentToCalibSegment.ReadSegments = False - else: - MuonSegmentToCalibSegment.SegmentLocation = segmentsKey - MuonSegmentToCalibSegment.ReadSegments = True - # segmentCombisKey - try: - segmentCombisKey = config.segmentCombisKey - except AttributeError: - pass - else: - MuonSegmentToCalibSegment.SegmentCombiLocation = segmentCombisKey - - # - # MuonCalibAlg - # - try: - MuonCalibAlg = topSequence.MuonCalibAlg - except AttributeError: - from MuonCalibAlgs.MuonCalibAlgsConf import MuonCalib__MuonCalibAlg - MuonCalibAlg = MuonCalib__MuonCalibAlg( "MuonCalibAlg" ) - topSequence += MuonCalibAlg - if beamFlags.beamType() == 'singlebeam' or beamFlags.beamType() == 'cosmics': - MuonCalibAlg.addTriggerTag = False - else: - MuonCalibAlg.addTriggerTag = recFlags.doTrigger() - MuonCalibAlg.doMDTs = muonRecFlags.doMDTs() - MuonCalibAlg.doCSCs = muonRecFlags.doCSCs() - MuonCalibAlg.doRPCs = muonRecFlags.doRPCs() - MuonCalibAlg.doTGCs = muonRecFlags.doTGCs() - try: - eventTag = config.eventTag - except AttributeError: - pass - else: - MuonCalibAlg.EventTag = eventTag - - MuonCalibAlg.doTruth = recFlags.doTruth() - - - if calibMode == 'ntuple' or calibMode == 'trackNtuple': - from MuonCalibTools.MuonCalibToolsConf import MuonCalib__PatternNtupleMaker - MuonCalibTool = MuonCalib__PatternNtupleMaker() - if calibMode == 'trackNtuple': - if muonRecFlags.doSegmentsOnly(): - log.warning("Making ntuple instead of trackNtuple because making segments only") - muonCalibFlags.Mode = 'ntuple' - else: - MuonCalibTool.DelayFinish = True - try: - MuonCalibExtraTreeAlg = topSequence.MuonCalibExtraTreeAlg - except AttributeError: - from MuonCalibExtraTreeAlg.MuonCalibExtraTreeAlgConf import MuonCalib__MuonCalibExtraTreeAlg - MuonCalibExtraTreeAlg = MuonCalib__MuonCalibExtraTreeAlg("MuonCalibExtraTreeAlg") - MuonCalibExtraTreeAlg.NtupleName = "PatternNtupleMaker" - topSequence += MuonCalibExtraTreeAlg - - # doPhi - try: - doPhi = config.doPhi - except AttributeError: - doPhi = False - MuonCalibExtraTreeAlg.doPhi = doPhi - # doTracks - try: - doTracks = config.doTracks - except AttributeError: - doTracks = False - MuonCalibExtraTreeAlg.doTracks = doTracks - # patternsKey - try: - patternsKey = config.patternsKey - except AttributeError: - pass - else: - MuonCalibExtraTreeAlg.PatternLocation = patternsKey - # tracksKey - try: - tracksKey = config.tracksKey - except AttributeError: - pass - else: - MuonCalibExtraTreeAlg.TrackLocation = tracksKey - - else: # other calib modes - from MdtCalibTools.MdtCalibToolsConf import MuonCalib__MdtCalibTool - MuonCalibTool = MuonCalib__MdtCalibTool() - if calibMode == 'regionNtuple': - from MdtCalibTools.MdtCalibToolsConf import MuonCalib__MdtCalibNtupleMakerTool - MdtCalibTool = MuonCalib__MdtCalibNtupleMakerTool() - else: - raise RuntimeError( "Unknown Muon Calibration Mode: %r" % calibMode ) - - ToolSvc += MdtCalibTool - MuonCalibTool.MdtCalibTool = MdtCalibTool - - ToolSvc += MuonCalibTool - MuonCalibAlg.MuonCalibTool = MuonCalibTool - - - -def printConfig(): - global MuonSegmentToCalibSegment,MuonCalibAlg,MuonCalibTool,MdtCalibTool,MuonCalibExtraTreeAlg - - print (MuonSegmentToCalibSegment) - print (MuonCalibAlg) - print (MuonCalibTool) - print (MdtCalibTool) - print (MuonCalibExtraTreeAlg) - - -# -# Activate default based on muonCalibFlags.EventTag -# -eventTag = muonCalibFlags.EventTag() -for c in vars().values(): - if isinstance(c,MuonCalibConfig) and c.eventTag == eventTag: - configure(c) - break -else: - log.warning("No standard configuration for muonCalibFlags.EventTag = %r. User needs to call MuonCalib.configure() by hand.", eventTag) -del c -del eventTag diff --git a/MuonSpectrometer/MuonCalib/MuonCalibAlgs/share/MuonCalibAlgs.py b/MuonSpectrometer/MuonCalib/MuonCalibAlgs/share/MuonCalibAlgs.py deleted file mode 100644 index c534bb0c7bee7883f5585c392b2a1bbe73e76094..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibAlgs/share/MuonCalibAlgs.py +++ /dev/null @@ -1,17 +0,0 @@ -# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration - -from AthenaCommon.Logging import logging - -log = logging.getLogger("MuonCalibAlgs") - -log.warning("""include(\"MuonCalibAlgs/MuonCalibAlgs.py\") is deprecated. -use instead: from MuonCalibAlgs import MuonCalib -This is temporarily done for you now, and should be backwards compatible""" ) - -from MuonCalibAlgs.MuonCalib import MuonSegmentToCalibSegment,MuonCalibAlg - -# MuonCalibExtraTreeAlg may or may not be there, depending on the settings -try: - from MuonCalibAlgs.MuonCalib import MuonCalibExtraTreeAlg -except ImportError: - pass diff --git a/MuonSpectrometer/MuonCalib/MuonCalibAlgs/src/MuonCalibAlg.cxx b/MuonSpectrometer/MuonCalib/MuonCalibAlgs/src/MuonCalibAlg.cxx deleted file mode 100644 index 1d6f3aa1a05f7a2799e890b847e824bcd611511c..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibAlgs/src/MuonCalibAlg.cxx +++ /dev/null @@ -1,1523 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -#include "MuonCalibAlgs/MuonCalibAlg.h" - -// gaudi -#include "xAODEventInfo/EventInfo.h" -#include "EventInfo/TagInfo.h" -#include "TrackRecord/TrackRecordCollection.h" -#include "TileEvent/TileContainer.h" -#include "TileIdentifier/TileTBID.h" -#include "LArRecEvent/LArCollisionTime.h" -#include "MuonPrepRawData/MuonPrepDataContainer.h" -#include "MuonTrigCoinData/TgcCoinDataContainer.h" -#include "MuonTrigCoinData/RpcCoinDataContainer.h" -#include "MuonDigitContainer/TgcDigit.h" -#include "MuonPrepRawData/CscStripPrepDataContainer.h" -#include "TrkEventPrimitives/ParamDefs.h" -#include "MuonReadoutGeometry/MdtReadoutElement.h" -#include "MuonSimData/MuonSimData.h" -#include "MuonSimData/MuonSimDataCollection.h" -#include "MuonSimData/CscSimDataCollection.h" -#include "GeneratorObjects/McEventCollection.h" -#include "AtlasHepMC/GenEvent.h" -#include "CLHEP/Vector/LorentzVector.h" -#include "GeoPrimitives/GeoPrimitives.h" - -// calibration -#include "MuonCalibEvent/MuonCalibPatternCollection.h" -#include "MuonCalibNtuple/RootFileManager.h" -#include "MuonCalibIdentifier/MuonFixedId.h" -#include "MuonCalibStl/DeleteObject.h" -#include "MuonCalibEventBase/MuonCalibRawMdtHit.h" -#include "MuonCalibEventBase/MuonCalibRawRpcHit.h" -#include "MuonCalibEventBase/MuonCalibRawCscHit.h" -#include "MuonCalibEventBase/MuonCalibRawTgcHit.h" -#include "MuonCalibEventBase/MuonCalibRawTgcCoin.h" -#include "MuonCalibEventBase/MuonCalibRawRpcCoin.h" -#include "MuonCalibEventBase/MuonCalibRawRpcTriggerHit.h" -#include "MuonCalibEventBase/MuonCalibTruth.h" -#include "MuonCalibEventBase/MuonCalibMdtTruthHit.h" -#include "MuonCalibEventBase/MuonCalibRpcTruthHit.h" -#include "MuonCalibEventBase/MuonCalibTgcTruthHit.h" -#include "MuonCalibEventBase/MuonCalibCscTruthHit.h" -#include "MuonCalibEventBase/MuonCalibSegment.h" -#include "MuonCalibEventBase/MuonCalibEventInfo.h" -#include "MuonCalibEventBase/MuonCalibTriggerTimeInfo.h" -#include "MuonCalibEventBase/MuonCalibEvent.h" -#include "MuonCalibEventBase/MuonCalibTruthCollection.h" -#include "MuonCalibEventBase/MuonCalibRawHitCollection.h" -#include "MuonCalibEventBase/MuonCalibRawTriggerHitCollection.h" -#include "MuonCalibEventBase/MuonCalibPattern.h" - -// trigger includes: -#include "TrigT1Result/CTP_RDO.h" -#include "TrigT1Result/CTP_Decoder.h" - -#include "MuonRDO/RpcPad.h" -#include "MuonRDO/RpcPadContainer.h" -#include "MuonRDO/RpcSectorLogicContainer.h" - -#include <algorithm> -#include <iostream> -#include "iomanip" -#include <map> - -namespace MuonCalib { - - MuonCalibAlg::MuonCalibAlg(const std::string& name, ISvcLocator* pSvcLocator) : - AthAlgorithm(name, pSvcLocator), - m_muonCalibTool("MuonCalib::MdtCalibTool/MdtCalibTool"), - m_idToFixedIdTool("MuonCalib::IdToFixedIdTool"), - m_stripFitter("CalibCscStripFitter/CalibCscStripFitter"), - m_muonIdCutTool("MuonIdCutTool/MuonIdCutTool"), - m_tileTBID(nullptr), - m_ntupFileOpen(false) - { - // Contents in the ntuple: with or without truth? - declareProperty("doTruth", m_doTruth = true); - - declareProperty("doTruthMuonOnly", m_doTruthMuonOnly = true); - - // pattern and mdtsegment location in storegate - declareProperty("GlobalPatternLocation", m_globalPatternLocation="PatternsForCalibration"); - - declareProperty("MuonCalibTool", m_muonCalibTool); - - declareProperty("EventTag", m_eventTag = "MoMu"); - - declareProperty("DoRawData", m_doRawData = true); - - // Delete event at end of execute or at finalize, event needed if immediate calibration performed - declareProperty("deleteEvent", m_doDeleteEvent = true); - - declareProperty("addTriggerTag", m_addTriggerTag = true); - - declareProperty("MDT_TDC_cut",m_mdt_tdc_cut = true); - - // set by job options to turn on or off cuts on truth - declareProperty("DoPrdSelect", m_doPrdSelect = false); - - //for Trigger time info - declareProperty("MBTS_Threshold", m_mbts_threshold = 40.0/222.0 ); // Value in pC - - // flags for ntuple production - m_createRootFile = true; - //declareProperty("CreateFile",m_createRootFile); - - declareProperty("NtupleName",m_ntupleName="CalibrationNtuple.root"); - - declareProperty("doMDTs", m_doMDTs = true ); - - declareProperty("doCSCs", m_doCSCs = true ); - declareProperty("CSCStripFitter", m_stripFitter); - - declareProperty("doRPCs", m_doRPCs = true ); - declareProperty("doTGCs", m_doTGCs = true ); - declareProperty("doRPCCoinData", m_doRPCCoin = true ); - declareProperty("doTGCCoinData", m_doTGCCoin = true ); - declareProperty("doRPCSectorLogic", m_doRpcSectorLogic = true ); - declareProperty("doRPCTriggerHits", m_doRPCTriggerHits = true ); - - m_trigger_waning_printed=false; - m_lar_waning_printed=false; - m_mbts_warning_printed=false; - m_eventNumber=0; - } - - StatusCode MuonCalibAlg::initialize() - { - //----------------------------------------------------- - - ATH_MSG_INFO("Initialisation started "); - ATH_MSG_INFO("================================"); - ATH_MSG_INFO("= Proprieties are:"); - ATH_MSG_INFO("= GlobalPatternLocation " << m_globalPatternLocation); - ATH_MSG_INFO("= MdtCalibTool " << m_muonCalibTool); - ATH_MSG_INFO("= NtupleName " << m_ntupleName << " write " << m_createRootFile); - if(m_doTruth) ATH_MSG_INFO("= Truth information stored on ntuple"); - else ATH_MSG_INFO("= Truth information NOT stored on ntuple"); - if(m_doRawData) ATH_MSG_INFO("= Raw Hit information stored on ntuple"); - else ATH_MSG_INFO("= Raw Hit information NOT stored on ntuple"); - ATH_MSG_INFO("================================"); - - ATH_CHECK(m_idHelperSvc.retrieve()); - - if (!m_stripFitter.empty()) { - if (!m_idHelperSvc->hasCSC()) ATH_MSG_WARNING("The current layout does not have any CSC chamber but you gave a CSCStripFitter, ignoring it, but double-check configuration"); - else ATH_CHECK( m_stripFitter.retrieve() ); - } - if (m_doCSCs && !m_idHelperSvc->hasCSC()) { - ATH_MSG_WARNING("The current layout does not have any CSC chamber but you have set doCSCs to true, setting it to false, but double-check configuration"); - m_doCSCs = false; - } - - m_eventNumber = 0; - - ATH_CHECK( m_idToFixedIdTool.retrieve() ); - - ATH_CHECK( m_muonIdCutTool.retrieve() ); - - // retrieve TileTBID helper - // (The MBTS was added to the Test Beam (TB) list.) - if(detStore()->retrieve(m_tileTBID).isFailure()) { - ATH_MSG_WARNING("Unable to retrieve TileTBID helper from DetectorStore"); - } - - // retrieve MuonDetectorManager from the conditions store - ATH_CHECK(m_DetectorManagerKey.initialize()); - - ATH_MSG_INFO("Initialization ended "); - return StatusCode::SUCCESS; - } - - // Execute - StatusCode MuonCalibAlg::execute(){ - if( m_createRootFile ) { - if(!m_ntupFileOpen) { - // create the root file: - // was originally in the constructor - from where it was not possible to - // configure the file name - please let me know if in some use-case - // having it here causes troubles - domizia.orestano@cern.ch - RootFileManager::getInstance()->openFile(m_ntupleName); - m_ntupFileOpen=true; - ATH_CHECK(m_muonCalibTool.retrieve()); - } - - ATH_MSG_INFO("Write metadata"); - const TagInfo* tagInfo = nullptr; - StatusCode sc = detStore()->retrieve(tagInfo); - if (sc.isFailure() || !tagInfo) { - ATH_MSG_FATAL("No TagInfo in DetectorStore"); - return StatusCode::FAILURE; - } - TagInfo::NameTagPairVec tags; - tagInfo->getTags(tags); - std::map<std::string, std::string> metadata; - for (TagInfo::NameTagPairVec::const_iterator it=tags.begin(); it!=tags.end(); it++) metadata[it->first]=it->second; - RootFileManager::getInstance()->WriteMetaData(metadata, m_ntupleName); - m_createRootFile=false; - } - - const MuonCalibEvent* event = retrieveEvent(); - m_muonCalibTool->handleEvent( event ) ; - if (m_doDeleteEvent == true) delete event; - else m_events.push_back(event); - return StatusCode::SUCCESS; - } - - StatusCode MuonCalibAlg::finalize(){ - ATH_MSG_INFO("Finalisation started "); - - if(m_ntupFileOpen) { - // perform analysis - m_muonCalibTool->analyse(); - - std::for_each(m_events.begin(),m_events.end(),DeleteObject()); - - // close root file - if( m_createRootFile ) RootFileManager::getInstance()->closeFile(); - } - - return StatusCode::SUCCESS; - } - - const MuonCalibEvent::MCPVec MuonCalibAlg::retrievePatterns() const - { - MuonCalibEvent::MCPVec patternVec; - // retrieve MuonCalibPatternCollection - if (!evtStore()->contains<MuonCalibPatternCollection>(m_globalPatternLocation)) { - ATH_MSG_DEBUG("MuonCalibPatternCollection not contained in StoreGate at:" << m_globalPatternLocation); - return patternVec; - } - const MuonCalibPatternCollection* pats = 0; - StatusCode sc = evtStore()->retrieve(pats,m_globalPatternLocation); - if (sc.isFailure()) { - ATH_MSG_WARNING("Could not find MuonCalibPatternCollection at " << m_globalPatternLocation); - }else{ - ATH_MSG_DEBUG("retrieved MuonCalibPatternCollection " << pats->size()); - patternVec.reserve(pats->size()); - - MuonCalibPatternCollection::const_iterator pat_it = pats->begin(); - MuonCalibPatternCollection::const_iterator pat_it_end = pats->end(); - for( ;pat_it!=pat_it_end; ++pat_it ){ - MuonCalibPattern* pat = new MuonCalibPattern(*(*pat_it)) ; - - patternVec.push_back( pat ); - } - } - - return patternVec; - } - - const MuonCalibTruthCollection* MuonCalibAlg::retrieveTruthCollection() const - { - const TrackRecordCollection* truthCollection = nullptr; - std::string location = "MuonEntryLayer"; - bool found = false; - bool filled = false; - if ( evtStore()->contains<TrackRecordCollection>(location) ) found = true ; - if( found ) { - if (evtStore()->retrieve(truthCollection,location).isFailure()) { - ATH_MSG_WARNING("MuonCalibAlg::retrieveTruthCollection: could not retrieve TrackRecordCollection "<<location<<", trying MuonEntryRecord next"); - } - if( truthCollection->size() == 0 ) filled = false ; - else filled = true ; - } else { - ATH_MSG_DEBUG("location " << location << " discarded"); - } - - if(!found){ - location ="MuonEntryRecord"; - if ( evtStore()->contains<TrackRecordCollection>(location) ) found = true ; - if( found ) { - if (evtStore()->retrieve(truthCollection,location).isFailure()) { - ATH_MSG_WARNING("MuonCalibAlg::retrieveTruthCollection: could not retrieve TrackRecordCollection "<<location); - } - if( truthCollection->size() == 0 ) filled = false ; - else filled = true ; - } else { - ATH_MSG_DEBUG("location " << location << " discarded"); - } - } - - if(found && filled){ - ATH_MSG_DEBUG("TracksRecordCollections collected at location: " << location); - } - if(!found){ - ATH_MSG_DEBUG("TracksRecordCollections nowhere to found in Storegate, nor filled"); - } - if(found && !filled){ - ATH_MSG_DEBUG("TracksRecordCollections collected at location: " << location << " are empty "); - } - - MuonCalibTruthCollection* MCtruthCollection = new MuonCalibTruthCollection(); - - std::set < int > muonBarCode; - bool muonfound = false; - if(found && filled ){ - const McEventCollection* mcEventCollection = 0; - std::string MClocation = "TruthEvent"; - if(evtStore()->contains<McEventCollection>(MClocation)) { - StatusCode scmc = evtStore()->retrieve(mcEventCollection, MClocation); - if (StatusCode::SUCCESS == scmc ){ - ATH_MSG_DEBUG(" McEventCollection collection retrieved "); - } - - ATH_MSG_DEBUG("retrieved TrackRecordCollection " << truthCollection->size()); - //Convert TrackRecordCollection to MuonCalibTruthCollection - - TrackRecordConstIterator tr_it = truthCollection->begin(); - TrackRecordConstIterator tr_it_end = truthCollection->end(); - for(;tr_it!=tr_it_end; ++tr_it){ - Amg::Vector3D pos( (*tr_it).GetPosition().x(), (*tr_it).GetPosition().y(), (*tr_it).GetPosition().z() ); - Amg::Vector3D mom( (*tr_it).GetMomentum().x(), (*tr_it).GetMomentum().y(), (*tr_it).GetMomentum().z() ); - double kinEnergy( (*tr_it).GetEnergy() ) ; - int PDGCode( (*tr_it).GetPDGCode() ) ; - int barcode((*tr_it).GetBarCode() ); - double prec = std::sqrt(mom[0]*mom[0]+mom[1]*mom[1]+mom[2]*mom[2]); - int newbarcode = 0; - if (std::abs(PDGCode) == 13 ) { - muonfound = true; - - // Barcode is not set correctly in TrackRecordCollection for earlier versions before June 2006 - // Do matching with MC event collection - - double dotprodbest=-1.; - - if (StatusCode::SUCCESS == scmc ) { - const HepMC::GenEvent* myGenEvent = *(mcEventCollection -> begin()); - HepMC::GenEvent::particle_const_iterator particle = myGenEvent->particles_begin(); - HepMC::GenEvent::particle_const_iterator particle_end = myGenEvent->particles_end(); - for(; particle!=particle_end;++particle){ - if( (*particle)->pdg_id() == PDGCode ) { - Amg::Vector3D moms( (*particle)->momentum().x(), (*particle)->momentum().y(), (*particle)->momentum().z() ); - double dotprod = moms[0]*mom[0] + moms[1]*mom[1] + moms[2]*mom[2]; - double psim = std::sqrt(moms[0]*moms[0]+moms[1]*moms[1]+moms[2]*moms[2]); - psim =std::sqrt(psim); - dotprod = dotprod/(psim*prec); - if (dotprod > 0.5&&dotprod > dotprodbest) { - dotprodbest = dotprod; - newbarcode = (*particle)->barcode(); - } - } - } - } - } - // barcode from TrackRecord - MuonCalibTruth* truth = new MuonCalibTruth(); - truth->setPosition(pos); - truth->setMomentum(mom); - truth->setKinEnergy(kinEnergy); - truth->setPDGCode(PDGCode); - truth->setBarCode(barcode); - //will destroyed in MuonCalibTruthCollection destructor - MCtruthCollection->addTruth(truth); - muonBarCode.insert(barcode); - // Store also newbarcode from MCEvent (negative value); - if (newbarcode>0 && barcode != newbarcode) { - truth = new MuonCalibTruth(); - truth->setPosition(pos); - truth->setMomentum(mom); - truth->setKinEnergy(kinEnergy); - truth->setPDGCode(PDGCode); - truth->setBarCode(-newbarcode); - MCtruthCollection->addTruth(truth); - muonBarCode.insert(newbarcode); - } - } - } - } - bool addmuonatIP = true; - if (!muonfound||addmuonatIP) { //retrieve truth track by other means: via McEventCollection... - - const McEventCollection* mcEventCollection = nullptr; - std::string MClocation = "TruthEvent"; - if(evtStore()->contains<McEventCollection>(MClocation)) { - StatusCode sc = evtStore()->retrieve(mcEventCollection, MClocation); - - if (StatusCode::SUCCESS == sc ) { - ATH_MSG_DEBUG(" McEventCollection collection retrieved "); - - const HepMC::GenEvent* myGenEvent = *(mcEventCollection -> begin()); - HepMC::GenEvent::particle_const_iterator particle = myGenEvent->particles_begin(); - HepMC::GenEvent::particle_const_iterator particle_end = myGenEvent->particles_end(); - for(; particle!=particle_end;++particle){ - if( std::abs( (*particle)->pdg_id() ) == 13) { - CLHEP::HepLorentzVector p((*particle)->momentum().px(), - (*particle)->momentum().py(), - (*particle)->momentum().pz(), - (*particle)->momentum().e()); - Amg::Vector3D pos(999.,999.,999.); - if ((*particle)->production_vertex()) { - pos[0] = (*particle)->production_vertex()->position().x(); - pos[1] = (*particle)->production_vertex()->position().y(); - pos[2] = (*particle)->production_vertex()->position().z(); - } - Amg::Vector3D mom( (*particle)->momentum().x(), (*particle)->momentum().y(), (*particle)->momentum().z() ); - double kinEnergy( p[3] ) ; - int PDGCode( (*particle)->pdg_id() ) ; - - MuonCalibTruth* truth = new MuonCalibTruth(); - - truth->setPosition(pos); - truth->setMomentum(mom); - truth->setKinEnergy(kinEnergy); - truth->setPDGCode(PDGCode); - int barcode = (*particle)->barcode(); - truth->setBarCode(barcode); - MCtruthCollection->addTruth(truth); - muonBarCode.insert(barcode); - } - } - } else { - ATH_MSG_WARNING(" McEventCollection collection NOT retrieved "); - } - }//retrieved other MCtruth - } - - SG::ReadCondHandle<MuonGM::MuonDetectorManager> DetectorManagerHandle{m_DetectorManagerKey}; - const MuonGM::MuonDetectorManager* MuonDetMgr = DetectorManagerHandle.cptr(); - if(MuonDetMgr==nullptr){ - ATH_MSG_ERROR("Null pointer to the read MuonDetectorManager conditions object"); - return 0; - } - - std::string sdoKey; - const MuonSimDataCollection* sdoContainer = 0; - if ( m_doMDTs ) { - //Retrieving MDT truth hits from MDT_SDO container and store them in MuonCalibMdtTruthHits - // and feed MuonCalibMdtTruthHits into MuonCalibTruhtCollection - sdoKey= "MDT_SDO"; - bool addDummy = false; - if(!evtStore()->contains<MuonSimDataCollection>(sdoKey)) { - addDummy = true; - }else{ - if (!evtStore()->retrieve(sdoContainer,sdoKey).isSuccess()) { - ATH_MSG_DEBUG("No MDT Sdo Container found"); - addDummy = true; - } - } - - if( addDummy ){ - // Store one entry with zero's to recognize it offline - MuonCalibMdtTruthHit* mdtTruth = new MuonCalibMdtTruthHit(); - mdtTruth->setBarCode(0) ; - mdtTruth->setDriftRadius(0.) ; - mdtTruth->setPositionAlongTube(0.); - MCtruthCollection->addTruth( mdtTruth ); - } else { - ATH_MSG_DEBUG("MDT Sdo Container found"); - MuonSimDataCollection::const_iterator mdt_it = sdoContainer->begin(); - MuonSimDataCollection::const_iterator mdt_it_end = sdoContainer->end(); - bool drop = false; - int nmdtSDO = 0; - int nsdo =0; - for( ; mdt_it!=mdt_it_end; ++mdt_it ){ - std::vector< MuonSimData::Deposit >::const_iterator deposits_it = (*mdt_it).second.getdeposits().begin() ; - std::vector< MuonSimData::Deposit >::const_iterator deposits_it_end = (*mdt_it).second.getdeposits().end() ; - for( ; deposits_it!= deposits_it_end; ++deposits_it) { - int barcode = (*deposits_it).first.barcode(); - if (muonBarCode.count(barcode+10000)!=1&&muonBarCode.count(barcode)!=1&&muonBarCode.count(barcode%10000)!=1&&m_doTruthMuonOnly) continue; - if (nmdtSDO>999) drop = true; - if (!drop || (drop && (*deposits_it).first.barcode() != 0)) { - nmdtSDO++; - - const Identifier& id = (*mdt_it).first; - MuonFixedId mfi = m_idToFixedIdTool->idToFixedId( id ); - if( m_doPrdSelect && m_muonIdCutTool->isCut(mfi) ) continue; - - MuonCalibMdtTruthHit* mdtTruth = new MuonCalibMdtTruthHit(); - mdtTruth->setBarCode( (*deposits_it).first.barcode() ) ; - mdtTruth->setIdentifier( mfi ) ; - nsdo++; - mdtTruth->setDriftRadius( (*deposits_it).second.firstEntry() ) ; - double posAlongAMDB = (*deposits_it).second.secondEntry(); - Amg::Vector3D geoModelLocPos(0.,0.,posAlongAMDB); - const MuonGM::MdtReadoutElement* detEl = MuonDetMgr->getMdtReadoutElement(id); - if( detEl ) { - Amg::Vector3D gpos = detEl->localToGlobalCoords(geoModelLocPos,id); - Amg::Vector3D localAMDBPos = detEl->GlobalToAmdbLRSTransform()*gpos; - posAlongAMDB = localAMDBPos.x(); - } - mdtTruth->setPositionAlongTube( posAlongAMDB ); - mdtTruth->identify(); - MCtruthCollection->addTruth( mdtTruth ); - } - } - } - } - } // if ( m_doMDTs ) - - if ( m_doRPCs ) { - //Retrieving RPC truth hits from RPC_SDO container and store them in MuonCalibRpcTruthHits - // and feed MuonCalibRpcTruthHits into MuonCalibTruthCollection - sdoKey= "RPC_SDO"; - bool addDummy = false; - if(!evtStore()->contains<MuonSimDataCollection>(sdoKey)) { - addDummy = true; - }else{ - if (!evtStore()->retrieve(sdoContainer,sdoKey).isSuccess()) { - addDummy = true; - } - } - - if(addDummy) { - ATH_MSG_DEBUG("No RPC Sdo Container found"); - - // Store one entry with zero's to recognize it offline - - MuonCalibRpcTruthHit* rpcTruth = new MuonCalibRpcTruthHit(); - rpcTruth->setBarCode(0) ; - rpcTruth->setTime(0.) ; - MCtruthCollection->addTruth( rpcTruth ); - } else { - ATH_MSG_DEBUG("RPC Sdo Container found"); - MuonSimDataCollection::const_iterator rpc_it = sdoContainer->begin(); - MuonSimDataCollection::const_iterator rpc_it_end = sdoContainer->end(); - bool drop = false; - int nrpcSDO = 0; - for( ; rpc_it!=rpc_it_end; ++rpc_it ){ - std::vector< MuonSimData::Deposit >::const_iterator deposits_it = (*rpc_it).second.getdeposits().begin() ; - std::vector< MuonSimData::Deposit >::const_iterator deposits_it_end = (*rpc_it).second.getdeposits().end() ; - for( ; deposits_it!= deposits_it_end; ++deposits_it) { - int barcode = (*deposits_it).first.barcode(); - // Check that deposit is from truth muon - if (muonBarCode.count(barcode)!=1&&muonBarCode.count(barcode%10000)!=1&&m_doTruthMuonOnly) continue; - - if (nrpcSDO>999) drop = true; - if (!drop || (drop && (*deposits_it).first.barcode() != 0)) { - nrpcSDO++; - - MuonFixedId mfi = m_idToFixedIdTool->idToFixedId( (*rpc_it).first ); - if( m_doPrdSelect && m_muonIdCutTool->isCut(mfi) ) continue; - - MuonCalibRpcTruthHit* rpcTruth = new MuonCalibRpcTruthHit(); - rpcTruth->setBarCode( (*deposits_it).first.barcode() ) ; - rpcTruth->setIdentifier( mfi ) ; - rpcTruth->setTime( (*deposits_it).second.firstEntry() ) ; - MCtruthCollection->addTruth( rpcTruth ); - } - } - } - } - } // if ( m_doRPCs ) - - if ( m_doTGCs ) { - //Retrieving TGC truth hits from TGC_SDO container and store them in MuonCalibTgcTruthHits - // and feed MuonCalibTgcTruthHits into MuonCalibTruthCollection - sdoKey= "TGC_SDO"; - bool addDummy = false; - if(!evtStore()->contains<MuonSimDataCollection>(sdoKey)) { - addDummy = true; - }else{ - if (!evtStore()->retrieve(sdoContainer,sdoKey).isSuccess()) { - ATH_MSG_DEBUG("No TGC Sdo Container found"); - addDummy = true; - } - } - if (addDummy) { - - // Store one entry with zero's to recognize it offline - - MuonCalibTgcTruthHit* tgcTruth = new MuonCalibTgcTruthHit(); - tgcTruth->setBarCode(0) ; - tgcTruth->setTime(0.) ; - MCtruthCollection->addTruth( tgcTruth ); - } else { - ATH_MSG_DEBUG("Sdo TGC Container found"); - MuonSimDataCollection::const_iterator tgc_it = sdoContainer->begin(); - MuonSimDataCollection::const_iterator tgc_it_end = sdoContainer->end(); - bool drop = false; - int ntgcSDO = 0; - for( ; tgc_it!=tgc_it_end; ++tgc_it ){ - std::vector< MuonSimData::Deposit >::const_iterator deposits_it = (*tgc_it).second.getdeposits().begin() ; - std::vector< MuonSimData::Deposit >::const_iterator deposits_it_end = (*tgc_it).second.getdeposits().end() ; - for( ; deposits_it!= deposits_it_end; ++deposits_it) { - int barcode = (*deposits_it).first.barcode(); - // Check that deposit is from truth muon - if (muonBarCode.count(barcode+10000)!=1&&muonBarCode.count(barcode)!=1&&muonBarCode.count(barcode%10000)!=1&&m_doTruthMuonOnly) continue; - if (ntgcSDO>999) drop = true; - if (!drop || (drop && (*deposits_it).first.barcode() != 0)) { - - MuonFixedId mfi = m_idToFixedIdTool->idToFixedId( (*tgc_it).first ); - if( m_doPrdSelect && m_muonIdCutTool->isCut(mfi) ) continue; - - ntgcSDO++; - MuonCalibTgcTruthHit* tgcTruth = new MuonCalibTgcTruthHit(); - tgcTruth->setBarCode( (*deposits_it).first.barcode() ) ; - tgcTruth->setIdentifier( mfi ) ; - tgcTruth->setTime( (*deposits_it).second.firstEntry() ) ; - MCtruthCollection->addTruth( tgcTruth ); - } - } - } - } - } // if ( m_doTGCs ) - - - if ( m_doCSCs ) { - //Retrieving CSC truth hits from CSC_SDO container and store them in MuonCalibCscTruthHits - // and feed MuonCalibCscTruthHits into MuonCalibTruthCollection - sdoKey= "CSC_SDO"; - if (evtStore()->contains<MuonSimDataCollection>(sdoKey)) - { - if (evtStore()->retrieve(sdoContainer,sdoKey).isSuccess()) { - ATH_MSG_DEBUG("CSC Sdo Container found"); - MuonSimDataCollection::const_iterator csc_it = sdoContainer->begin(); - MuonSimDataCollection::const_iterator csc_it_end = sdoContainer->end(); - bool drop = false; - int ncscSDO = 0; - for( ; csc_it!=csc_it_end; ++csc_it ){ - std::vector< MuonSimData::Deposit >::const_iterator deposits_it = (*csc_it).second.getdeposits().begin() ; - std::vector< MuonSimData::Deposit >::const_iterator deposits_it_end = (*csc_it).second.getdeposits().end() ; - for( ; deposits_it!= deposits_it_end; ++deposits_it) { - int barcode = (*deposits_it).first.barcode(); - // Check that deposit is from truth muon - if (muonBarCode.count(barcode+10000)!=1&&muonBarCode.count(barcode)!=1&&muonBarCode.count(barcode%10000)!=1&&m_doTruthMuonOnly) continue; - if (ncscSDO>999) drop = true; - if (!drop || (drop && (*deposits_it).first.barcode() != 0)) { - ncscSDO++; - MuonFixedId mfi = m_idToFixedIdTool->idToFixedId( (*csc_it).first ); - if( m_doPrdSelect && m_muonIdCutTool->isCut(mfi) ) continue; - - MuonCalibCscTruthHit* cscTruth = new MuonCalibCscTruthHit(); - cscTruth->setBarCode( (*deposits_it).first.barcode() ) ; - cscTruth->setIdentifier( mfi ) ; - cscTruth->setTime( (*deposits_it).second.firstEntry() ) ; - MCtruthCollection->addTruth( cscTruth ); - } - } - } - } - } else { - ATH_MSG_DEBUG("No CSC MuonSimHit Sdo Container found"); - - const CscSimDataCollection* cscSdoContainer; - bool addDummy = false; - if(!evtStore()->contains<CscSimDataCollection>(sdoKey)) { - addDummy = true; - }else{ - if (!evtStore()->retrieve(cscSdoContainer,sdoKey).isSuccess()) { - addDummy = true; - } - } - if (addDummy) { - ATH_MSG_DEBUG("No CSC Sdo Container found"); - - // Store one entry with zero's to recognize it offline - - MuonCalibCscTruthHit* cscTruth = new MuonCalibCscTruthHit(); - cscTruth->setBarCode(0) ; - cscTruth->setTime(0.) ; - MCtruthCollection->addTruth( cscTruth ); - } else { - ATH_MSG_DEBUG("CSC Sdo Container found"); - CscSimDataCollection::const_iterator csc_it = cscSdoContainer->begin(); - CscSimDataCollection::const_iterator csc_it_end = cscSdoContainer->end(); - bool drop = false; - int ncscSDO = 0; - for( ; csc_it!=csc_it_end; ++csc_it ){ - std::vector< CscSimData::Deposit >::const_iterator deposits_it = (*csc_it).second.getdeposits().begin() ; - std::vector< CscSimData::Deposit >::const_iterator deposits_it_end = (*csc_it).second.getdeposits().end() ; - for( ; deposits_it!= deposits_it_end; ++deposits_it) { - int barcode = (*deposits_it).first.barcode(); - // Check that deposit is from truth muon - if (muonBarCode.count(barcode)!=1&&muonBarCode.count(barcode%10000)!=1&&m_doTruthMuonOnly) continue; - if (ncscSDO>999) drop = true; - if (!drop || (drop && (*deposits_it).first.barcode() != 0)) { - ncscSDO++; - Identifier id = (*csc_it).first; - const MuonGM::CscReadoutElement* detEl = MuonDetMgr->getCscReadoutElement(id); - if( !detEl ){ - ATH_MSG_WARNING("Found CSC Identifier which seems to have no readout element " - << m_idHelperSvc->mdtIdHelper().print_to_string(id)); - continue; - } - MuonFixedId mfi = m_idToFixedIdTool->idToFixedId(id); - if( m_doPrdSelect && m_muonIdCutTool->isCut(mfi) ) continue; - - MuonCalibCscTruthHit* cscTruth = new MuonCalibCscTruthHit(); - cscTruth->setBarCode( (*deposits_it).first.barcode() ) ; - cscTruth->setIdentifier( mfi ) ; - double ypos_local = (*deposits_it).second.ypos() ; - double zpos_local = (*deposits_it).second.zpos() ; - const Amg::Vector3D locpos3d = Amg::Vector3D(0.,ypos_local, zpos_local); - const Amg::Vector3D globalPos = (detEl->transform())*locpos3d; - double phipos = std::atan2(globalPos.y(),globalPos.x()); - // use cscTime for phi, since time is no longer set for new SDO format!! - cscTruth->setTime( phipos ) ; - MCtruthCollection->addTruth( cscTruth ); - } - } - } - } - } - } // m_doCSCs - - ATH_MSG_DEBUG("retrieved MCtruthCollection size " << MCtruthCollection->numberOfTruth()); - - return MCtruthCollection; - } - - MuonCalibEventInfo MuonCalibAlg::retrieveEventInfo() const - { - const xAOD::EventInfo* eventInfo=nullptr; - MuonCalibEventInfo MCeventInfo; - StatusCode sc = evtStore()->retrieve(eventInfo); - if ( sc.isFailure() ) { - ATH_MSG_ERROR("Could not find eventInfo "); - return MCeventInfo; - }else{ - ATH_MSG_DEBUG("retrieved eventInfo"); - } - - //Cast eventID into MuonCalibEventInfo class: - - MCeventInfo.setRunNumber( eventInfo->runNumber() ) ; - MCeventInfo.setEventNumber( eventInfo->eventNumber() ); - MCeventInfo.setTimeStamp( eventInfo->timeStamp() ); - MCeventInfo.setLumiBlock( eventInfo->lumiBlock() ); - MCeventInfo.setBcId( eventInfo->bcid() ); - std::string eventTag=m_eventTag; - MCeventInfo.setTag( eventTag ); - if ( m_addTriggerTag ) { - const DataHandle< CTP_RDO > ctpRDO; - if ( ! evtStore()->contains(ctpRDO, "CTP_RDO") ) - { - if(!m_trigger_waning_printed) - { - ATH_MSG_INFO("No trigger info, not added to EventTag"); - m_trigger_waning_printed=true; - } - else - { - ATH_MSG_DEBUG("No trigger info, not added to EventTag"); - } - - return MCeventInfo; - } - if ( evtStore()->retrieve( ctpRDO, "CTP_RDO" ).isFailure() ) { - if(!m_trigger_waning_printed) - { - ATH_MSG_INFO("CTP_RDO trigger info missing, not added to EventTag"); - m_trigger_waning_printed=true; - } - else - { - ATH_MSG_DEBUG("CTP_RDO trigger info missing, not added to EventTag"); - } - return MCeventInfo; - } - CTP_Decoder ctp; - ctp.setRDO(ctpRDO); - uint16_t l1aPos = ctpRDO->getL1AcceptBunchPosition(); - if(l1aPos >= ctp.getBunchCrossings().size()) return MCeventInfo; - const CTP_BC& bunch = ctp.getBunchCrossings().at(l1aPos); - MCeventInfo.setNumberOfTriggerBits(bunch.getTAV().size() + bunch.getTAP().size()); - int nth_bit(0); - for(unsigned int i=0; i<bunch.getTAV().size(); i++) - { - MCeventInfo.setTriggerBit(nth_bit, bunch.getTAV().test(i)); - nth_bit++; - } - for(unsigned int i=0; i<bunch.getTAP().size(); i++) - { - MCeventInfo.setTriggerBit(nth_bit, bunch.getTAP().test(i)); - nth_bit++; - } - } - return MCeventInfo; - } - - /// - const MuonCalibTriggerTimeInfo* MuonCalibAlg::retrieveTriggerTimeInfo() const - { - MuonCalibTriggerTimeInfo trigTimeInfo; - /////////////////////////////////////////////////////// - // MBTS word - copied from: - // http://alxr.usatlas.bnl.gov/lxr/source/atlas/TriggerAlgorithms/TrigT2MinBias/src/T2MbtsFex.cxx - const DataHandle<TileCellContainer> tileCellCnt; - uint32_t mbtsBits = 0; - float timeA = 0.F; - float timeC = 0.F; - int countA = 0; - int countC = 0; - - if(evtStore()->contains(tileCellCnt, "MBTSContainer")) - { - StatusCode sc=evtStore()->retrieve(tileCellCnt, "MBTSContainer"); - if (!sc.isFailure()) { - - uint32_t ibit, bit_pos = 0; - float charge = 0; - // Discriminate the signals - TileCellContainer::const_iterator itr = tileCellCnt->begin(); - TileCellContainer::const_iterator itr_end = tileCellCnt->end(); - for(; itr != itr_end; ++itr) { - charge = (*itr)->energy(); - ATH_MSG_DEBUG("Energy =" << charge << "pC"); - if(charge > m_mbts_threshold) { - Identifier id=(*itr)->ID(); - // cache type, module and channel - // MBTS Id type is "side" +/- 1 - int type_id = m_tileTBID->type(id); - // MBTS Id module is "phi" 0-7 - int module_id = m_tileTBID->module(id); - // MBTS Id channel is "eta" 0-1 zero is closer to beam pipe - int channel_id = m_tileTBID->channel(id); - - if (type_id > 0) { - timeA += (*itr)->time(); - countA++ ; - } else { - timeC += (*itr)->time(); - countC++; - } - - // Catch errors - if( std::abs(type_id) != 1 ){ - ATH_MSG_WARNING("MBTS identifier type is out of range"); - continue; - } - if( channel_id < 0 || channel_id > 1 ){ - ATH_MSG_WARNING("MBTS identifier channel is out of range"); - continue; - } - if( module_id < 0 || module_id > 7 ){ - ATH_MSG_WARNING("MBTS identifier module is out of range"); - continue; - } - bit_pos = 0; // The position of the bit - if(type_id == -1) { - bit_pos += 16; - } - bit_pos += channel_id*8; - bit_pos += module_id; - ibit = 1; // The mbts bit for this TileCell - ibit <<= bit_pos; - mbtsBits += ibit; - } - } - }} - else - { - if(!m_mbts_warning_printed) - { - ATH_MSG_INFO("No MBTS info in store gate"); - m_mbts_warning_printed=true; - } - } - - float timeDiff = -999.; // Or whatever default you want - if (countA > 1 && countC > 1) timeDiff = (timeA/countA) - (timeC/countC); - - //LAr time diff - float LArECtimeDiff=-999.; -// LArCollisionTime* tps; - const DataHandle< LArCollisionTime > tps; - if ( evtStore()->contains(tps, "LArCollisionTime") ) - { - StatusCode sc = evtStore()->retrieve(tps,"LArCollisionTime"); - if (!sc.isFailure()) { - const int nMin=2; - if (tps->ncellA() > nMin && tps->ncellC() > nMin) LArECtimeDiff = tps->timeA()-tps->timeC(); - } - } - else - { - if(!m_lar_waning_printed) - { - ATH_MSG_INFO("LArCollisionTime not in store gate."); - m_lar_waning_printed=true; - } - } - //Cast eventID into MuonCalibEventInfo class: - trigTimeInfo.setdMbtsTime( timeDiff ) ; - trigTimeInfo.setdLarTime( LArECtimeDiff ) ; - - MuonCalibTriggerTimeInfo* ttInfo = new MuonCalibTriggerTimeInfo(trigTimeInfo); - - return ttInfo; - } - //// - - const MuonCalibRawHitCollection* MuonCalibAlg::retrieveRawHits( const MuonCalibEvent::MCPVec &patterns ) const{ - MuonCalibRawHitCollection* rawHits = new MuonCalibRawHitCollection(); - - //First, construct maps of the hits on segment. They are ordered by MuonFixedId, - //keeping track on how many times they're assigned to a segment. - std::map<MuonFixedId,int> mdtMap, rpcMap, tgcMap, cscMap ; - - MuonCalibEvent::MCPVecCit pat_it = patterns.begin(); - MuonCalibEvent::MCPVecCit pat_it_end = patterns.end(); - for( ;pat_it!=pat_it_end; ++pat_it ){ - MuonCalibPattern::MuonSegCit seg_it = (*pat_it)->muonSegBegin(); - MuonCalibPattern::MuonSegCit seg_it_end = (*pat_it)->muonSegEnd(); - for( ;seg_it!=seg_it_end;++seg_it ){ - - //Filling the mdtMap with the hits - MuonCalibSegment::MdtHitCit mdt_it = (*seg_it)->mdtHOTBegin(); - MuonCalibSegment::MdtHitCit mdt_it_end = (*seg_it)->mdtHOTEnd(); - for( ;mdt_it!=mdt_it_end;++mdt_it){ - std::map<MuonFixedId, int>::iterator position = mdtMap.find( (*mdt_it)->identify() ); - if(position == mdtMap.end() ){ - mdtMap[ (*mdt_it)->identify() ] = 1; - } else { - ++mdtMap[ (*mdt_it)->identify() ] ; - } - } - - //Filling the rpcMap with the hits - MuonCalibSegment::RpcHitCit rpc_it = (*seg_it)->rpcHOTBegin(); - MuonCalibSegment::RpcHitCit rpc_it_end = (*seg_it)->rpcHOTEnd(); - for( ;rpc_it!=rpc_it_end;++rpc_it){ - std::map<MuonFixedId, int>::iterator position = rpcMap.find( (*rpc_it)->identify() ); - if(position == rpcMap.end() ){ - rpcMap[ (*rpc_it)->identify() ] = 1; - } else { - ++rpcMap[ (*rpc_it)->identify() ] ; - } - } - - //Filling the tgcMap with the hits - MuonCalibSegment::TgcHitCit tgc_it = (*seg_it)->tgcHOTBegin(); - MuonCalibSegment::TgcHitCit tgc_it_end = (*seg_it)->tgcHOTEnd(); - for( ;tgc_it!=tgc_it_end;++tgc_it){ - std::map<MuonFixedId, int>::iterator position = tgcMap.find( (*tgc_it)->identify() ); - if(position == tgcMap.end() ){ - tgcMap[ (*tgc_it)->identify() ] = 1; - } else { - ++tgcMap[ (*tgc_it)->identify() ] ; - } - } - - //Filling the cscMap with the hits - MuonCalibSegment::CscHitCit csc_it = (*seg_it)->cscHOTBegin(); - MuonCalibSegment::CscHitCit csc_it_end = (*seg_it)->cscHOTEnd(); - for( ;csc_it!=csc_it_end;++csc_it){ - std::map<MuonFixedId, int>::iterator position = cscMap.find( (*csc_it)->identify() ); - if(position == cscMap.end() ){ - cscMap[ (*csc_it)->identify() ] = 1; - } else { - ++cscMap[ (*csc_it)->identify() ] ; - } - } - } - } - - //Now, get PRDs from storegate, cast them into MuonCalibRawHits and use the maps - //constructed above to decide which 'occupancy' flag they hold. - - StatusCode sc; - sc.ignore(); - if ( m_doMDTs ) { - //MDT raw hits.... - - std::vector<const Muon::MdtPrepDataCollection*> mdtCols; - const Muon::MdtPrepDataContainer* mdtPrds = 0; - if( !evtStore()->contains<Muon::MdtPrepDataContainer>("MDT_DriftCircles")){ - ATH_MSG_DEBUG("MdtPrepDataContainer MDT_DriftCircles not contained in SG"); - }else if( evtStore()->retrieve(mdtPrds,"MDT_DriftCircles").isFailure() ){ - ATH_MSG_DEBUG("Cannot retrieve MdtPrepDataContainer MDT_DriftCircles"); - }else{ - - ATH_MSG_DEBUG("Retrieved MdtPrepDataContainer "); - - mdtCols.reserve(mdtPrds->size()); // number of mdt chambers - Muon::MdtPrepDataContainer::const_iterator it = mdtPrds->begin(); - Muon::MdtPrepDataContainer::const_iterator it_end = mdtPrds->end(); - for( ; it!=it_end; ++it ) { - mdtCols.push_back( *it ); - } - } - - std::vector< const Muon::MdtPrepDataCollection*>::const_iterator mdtCollection = mdtCols.begin(); - std::vector< const Muon::MdtPrepDataCollection*>::const_iterator mdtlastColl = mdtCols.end(); - for ( ; mdtCollection != mdtlastColl ; ++mdtCollection ) - { - Amg::Transform3D globalToStation; - - Muon::MdtPrepDataCollection::const_iterator mdt_it = (*mdtCollection)->begin(); - Muon::MdtPrepDataCollection::const_iterator mdt_it_end = (*mdtCollection)->end(); - bool amdbtransform = false; - for( ; mdt_it!=mdt_it_end; ++ mdt_it) - { - if (m_mdt_tdc_cut == true && (*mdt_it)->status()==Muon::MdtStatusMasked) continue; - if((*mdt_it)->localPosition()[Trk::locR]==0) continue; - - MuonCalibRawMdtHit* rawMdtHit = new MuonCalibRawMdtHit(); - MuonFixedId fID = m_idToFixedIdTool->idToFixedId( (*mdt_it)->identify() ) ; - - if ( amdbtransform == false ) { // shouldn't this be done all the time? since there are 2 detector elements (one for each ml) per collection! - const MuonGM::MdtReadoutElement* detEl = (*mdt_it)->detectorElement() ; - globalToStation = detEl->GlobalToAmdbLRSTransform(); - amdbtransform = true; - } - - Amg::Vector3D tubePos = (*mdt_it)->globalPosition(); - Amg::Vector3D tubePosLoc = globalToStation*tubePos; - - rawMdtHit->setId( fID ); - rawMdtHit->setLocalPosition( tubePosLoc ); - rawMdtHit->setGlobalPosition( tubePos ); - rawMdtHit->setAdc( (*mdt_it)->adc() ); - rawMdtHit->setTdc( (*mdt_it)->tdc() ); - rawMdtHit->setDriftTime( 0. ); - rawMdtHit->setDriftRadius( (*mdt_it)->localPosition()[Trk::locR] ); - rawMdtHit->setDriftRadiusError( 1./std::sqrt((*mdt_it)->localCovariance()(Trk::locR,Trk::locR)) ); - - int occupancy = 0; - std::map<MuonFixedId, int>::const_iterator position = mdtMap.find( fID ); - - if( position == mdtMap.end() ) - occupancy = -1; //ID of RawHit not found on any segment - else - occupancy = position->second; //ID of RawHit found n times on a segment in this event - rawMdtHit->setOccupancy(occupancy); - - rawHits->addMuonCalibRawHit( rawMdtHit ); - } - } - } // if ( m_doMDTs ) - - if ( m_doRPCs ) { - //RPC raw hits... - - std::vector<const Muon::RpcPrepDataCollection*> rpcCols; - const Muon::RpcPrepDataContainer* rpcPrds = 0; - if( !evtStore()->contains<Muon::RpcPrepDataContainer>("RPC_Measurements") ){ - ATH_MSG_DEBUG("RpcPrepDataContainer RPC_Measurements not contained in SG"); - }else if(evtStore()->retrieve(rpcPrds,"RPC_Measurements").isFailure()) { - ATH_MSG_DEBUG("Cannot retrieve RpcPrepDataContainer RPC_Measurements"); - }else{ - ATH_MSG_DEBUG("Retrieved RpcPrepDataContainer "); - - rpcCols.reserve(rpcPrds->size()); // number of rpc chambers - Muon::RpcPrepDataContainer::const_iterator it = rpcPrds->begin(); - Muon::RpcPrepDataContainer::const_iterator it_end = rpcPrds->end(); - for( ; it!=it_end; ++it ) { - rpcCols.push_back( *it ); - } - } - - std::vector< const Muon::RpcPrepDataCollection*>::const_iterator rpcCollection = rpcCols.begin(); - std::vector< const Muon::RpcPrepDataCollection*>::const_iterator rpclastColl = rpcCols.end(); - for ( ; rpcCollection != rpclastColl ; ++rpcCollection ) - { - Muon::RpcPrepDataCollection::const_iterator rpc_it = (*rpcCollection)->begin(); - Muon::RpcPrepDataCollection::const_iterator rpc_it_end = (*rpcCollection)->end(); - for( ; rpc_it!=rpc_it_end; ++ rpc_it){ - - MuonCalibRawRpcHit* rawRpcHit = createRawRpcHit(**rpc_it); - - int occupancy = 0; - std::map<MuonFixedId, int>::const_iterator position = rpcMap.find( rawRpcHit->identify() ); - if( position == rpcMap.end() ) occupancy = -1; //ID of RawHit not found on any segment - else occupancy = position->second; //ID of RawHit found n times on a segment in this event - rawRpcHit->setOccupancy(occupancy); - - rawHits->addMuonCalibRawHit( rawRpcHit ); - } - } - } // if ( m_doRPCs ) - - if ( m_doCSCs ) { - //CSC raw hits... - - std::vector<const Muon::CscStripPrepDataCollection*> cscCols; - const Muon::CscStripPrepDataContainer* cscPrds = 0; - if( !evtStore()->contains<Muon::CscStripPrepDataContainer>("CSC_Measurements") ){ - ATH_MSG_DEBUG("CscPrepDataContainer CSC_Measurements not contained in SG"); - }else if(evtStore()->retrieve(cscPrds,"CSC_Measurements").isFailure()) { - ATH_MSG_DEBUG("Cannot retrieve CscPrepDataContainer CSC_Measurements"); - }else{ - ATH_MSG_DEBUG("Retrieved CscPrepDataContainer "); - - cscCols.reserve(cscPrds->size()); - Muon::CscStripPrepDataContainer::const_iterator it = cscPrds->begin(); - Muon::CscStripPrepDataContainer::const_iterator it_end = cscPrds->end(); - for( ; it!=it_end; ++it ) { - cscCols.push_back( *it ); - } - } - - std::vector< const Muon::CscStripPrepDataCollection*>::const_iterator cscCollection = cscCols.begin(); - std::vector< const Muon::CscStripPrepDataCollection*>::const_iterator csclastColl = cscCols.end(); - - for ( ; cscCollection != csclastColl ; ++cscCollection ) - { - Muon::CscStripPrepDataCollection::const_iterator csc_it = (*cscCollection)->begin(); - Muon::CscStripPrepDataCollection::const_iterator csc_it_end = (*cscCollection)->end(); - for( ; csc_it!=csc_it_end; ++ csc_it){ - - MuonCalibRawCscHit* rawCscHit = new MuonCalibRawCscHit(); - MuonFixedId fID = m_idToFixedIdTool->idToFixedId( (*csc_it)->identify() ) ; - rawCscHit->setGlobalPosition( (*csc_it)->globalPosition() ); - rawCscHit->setId( fID ); - // time of first sample is not very useful. we need fitted time - // invoke fitter first and then set the time - int measuresPhi = m_idHelperSvc->cscIdHelper().measuresPhi((*csc_it)->identify()); - int chamberLayer = m_idHelperSvc->cscIdHelper().chamberLayer((*csc_it)->identify()); - float stripWidth = (*csc_it)->detectorElement()->cathodeReadoutPitch( chamberLayer, measuresPhi ); - rawCscHit->setWidth( stripWidth ); - // invoke the strip fitter to fit the time samples (which is a vector of 4 elements) - // fitter outputs the sample charge, time etc. which we can store here - ICscStripFitter::Result fitres; // fit result will be here - fitres = m_stripFitter->fit(**csc_it); - rawCscHit->setCharge(fitres.charge); - rawCscHit->setT(fitres.time); - - int occupancy = 0; - std::map<MuonFixedId, int>::const_iterator position = cscMap.find( fID ); - if( position == cscMap.end() ) occupancy = -1; //ID of RawHit not found on any segment - else occupancy = position->second; //ID of RawHit found n times on a segment in this event - rawCscHit->setOccupancy(occupancy); - - rawHits->addMuonCalibRawHit( rawCscHit ); - } - } - } // if ( m_doCSCs ) - - if ( m_doTGCs ) { - //TGC raw hits... - - std::vector<const Muon::TgcPrepDataCollection*> tgcCols; - const Muon::TgcPrepDataContainer* tgcPrds[3] = { 0, 0, 0 }; - - for(int ibc=0; ibc<3; ibc++){ - int bcTag=ibc+1; - std::ostringstream location; - location << "TGC_Measurements" << (bcTag==TgcDigit::BC_PREVIOUS ? "PriorBC" : "") - << (bcTag==TgcDigit::BC_NEXT ? "NextBC" : ""); - - if( !evtStore()->contains<Muon::TgcPrepDataContainer>(location.str()) ){ - ATH_MSG_DEBUG("Cannot retrieve TgcPrepDataContainer " << location.str()); - }else if(evtStore()->retrieve(tgcPrds[ibc],location.str()).isFailure()) { - ATH_MSG_DEBUG("Cannot retrieve TgcPrepDataContainer " << location.str()); - }else{ - ATH_MSG_DEBUG("Retrieved TgcPrepDataContainer " << location.str()); - - tgcCols.clear(); - tgcCols.reserve(tgcPrds[ibc]->size()); // number of tgc chambers - Muon::TgcPrepDataContainer::const_iterator it = tgcPrds[ibc]->begin(); - Muon::TgcPrepDataContainer::const_iterator it_end = tgcPrds[ibc]->end(); - for( ; it!=it_end; ++it ) { - tgcCols.push_back( *it ); - } - } - - std::vector< const Muon::TgcPrepDataCollection*>::const_iterator tgcCollection = tgcCols.begin(); - std::vector< const Muon::TgcPrepDataCollection*>::const_iterator tgclastColl = tgcCols.end(); - for ( ; tgcCollection != tgclastColl ; ++tgcCollection ) - { - Muon::TgcPrepDataCollection::const_iterator tgc_it = (*tgcCollection)->begin(); - Muon::TgcPrepDataCollection::const_iterator tgc_it_end = (*tgcCollection)->end(); - for( ; tgc_it!=tgc_it_end; ++ tgc_it){ - MuonCalibRawTgcHit* rawTgcHit = new MuonCalibRawTgcHit(); - MuonFixedId fID = m_idToFixedIdTool->idToFixedId( (*tgc_it)->identify() ) ; - bool measuresPhi = (bool) m_idHelperSvc->tgcIdHelper().isStrip((*tgc_it)->identify()); - int gasGap = m_idHelperSvc->tgcIdHelper().gasGap((*tgc_it)->identify()); - int channel = m_idHelperSvc->tgcIdHelper().channel((*tgc_it)->identify()); - - const MuonGM::TgcReadoutElement* detEl = (*tgc_it)->detectorElement(); - double width = -999.; - double short_width = -999.; - double long_width = -999.; - double length = -999.; - if(measuresPhi){ - width = detEl->stripWidth(gasGap,channel); - short_width = detEl->stripShortWidth(gasGap, channel); - long_width = detEl->stripLongWidth(gasGap, channel); - length = detEl->stripLength(gasGap, channel); - }else{ //measures Eta: gangs, not strips - width = detEl->gangLength(gasGap,channel); - short_width = detEl->gangShortWidth(gasGap, channel); - long_width = detEl->gangLongWidth(gasGap, channel); - length = detEl->gangThickness(gasGap, channel); - } - - rawTgcHit->setId( fID ); - rawTgcHit->setGlobalPosition( (*tgc_it)->globalPosition() ); - rawTgcHit->setStation( m_idHelperSvc->tgcIdHelper().stationName((*tgc_it)->identify()) ); - rawTgcHit->setEta( m_idHelperSvc->tgcIdHelper().stationEta((*tgc_it)->identify()) ); - rawTgcHit->setPhi( m_idHelperSvc->tgcIdHelper().stationPhi((*tgc_it)->identify()) ); - rawTgcHit->setGasGap( gasGap ); - rawTgcHit->setIsStrip( static_cast<int>(measuresPhi) ); - rawTgcHit->setChannel( channel ); - rawTgcHit->setBcTag( bcTag ); - - rawTgcHit->setWidth( width ); - rawTgcHit->setShortWidth( short_width ); - rawTgcHit->setLongWidth( long_width ); - rawTgcHit->setLength( length ); - - int occupancy = 0; - std::map<MuonFixedId, int>::const_iterator position = tgcMap.find( fID ); - if( position == tgcMap.end() ) occupancy = -1; //ID of RawHit not found on any segment - else occupancy = position->second; //ID of RawHit found n times on a segment in this event - rawTgcHit->setOccupancy(occupancy);//Will be filled after loop over hits assigned to segment; - - rawHits->addMuonCalibRawHit( rawTgcHit ); - - } - } - } - } // if ( m_doTGCs ) - - // TGC raw coin... - if( m_doTGCCoin ){ - std::vector<const Muon::TgcCoinDataCollection*> tgcCoinCols; - const Muon::TgcCoinDataContainer* tgcCoinPrds[3] = { 0, 0, 0 }; - - for(int ibc=0; ibc<3; ibc++){ - int bcTag=ibc+1; - std::ostringstream location; - location << "TrigT1CoinDataCollection" << (bcTag==TgcDigit::BC_PREVIOUS ? "PriorBC" : "") - << (bcTag==TgcDigit::BC_NEXT ? "NextBC" : ""); - if( !evtStore()->contains<Muon::TgcCoinDataContainer>(location.str()) ){ - ATH_MSG_DEBUG("TgcCoinDataContainer not contained in SG at" << location.str()); - }else if(evtStore()->retrieve(tgcCoinPrds[ibc],location.str()).isFailure()) { - ATH_MSG_DEBUG("Cannot retrieve TgcCoinDataContainer" << location.str()); - }else{ - ATH_MSG_DEBUG("Retrieved TgcCoinDataContainer " << location.str()); - - tgcCoinCols.clear(); - tgcCoinCols.reserve(tgcCoinPrds[ibc]->size()); // number of tgcCoin chambers - Muon::TgcCoinDataContainer::const_iterator it = tgcCoinPrds[ibc]->begin(); - Muon::TgcCoinDataContainer::const_iterator it_end = tgcCoinPrds[ibc]->end(); - for( ; it!=it_end; ++it ) { - tgcCoinCols.push_back( *it ); - } - } - - std::vector< const Muon::TgcCoinDataCollection*>::const_iterator tgcCoinCollection = tgcCoinCols.begin(); - std::vector< const Muon::TgcCoinDataCollection*>::const_iterator tgcCoinlastColl = tgcCoinCols.end(); - - for ( ; tgcCoinCollection != tgcCoinlastColl ; ++tgcCoinCollection ) - { - Muon::TgcCoinDataCollection::const_iterator tgcCoin_it = (*tgcCoinCollection)->begin(); - Muon::TgcCoinDataCollection::const_iterator tgcCoin_it_end = (*tgcCoinCollection)->end(); - for( ; tgcCoin_it!=tgcCoin_it_end; ++ tgcCoin_it){ - - if((*tgcCoin_it)->type()==Muon::TgcCoinData::TYPE_UNKNOWN || - (*tgcCoin_it)->type()==Muon::TgcCoinData::TYPE_TRACKLET_EIFI) continue; - - MuonCalibRawTgcCoin* rawTgcCoin = new MuonCalibRawTgcCoin(); - MuonFixedId fID = m_idToFixedIdTool->idToFixedId( (*tgcCoin_it)->identify() ) ; - rawTgcCoin->setId( fID ); - - //*** calculation of sector ***// - int sector=-1; - if((*tgcCoin_it)->isForward()){//forward - sector=(*tgcCoin_it)->phi()/2+1;//(phi,sector)= (1,1), (2,2), (3,2), (4,3) - }else{//endcap - sector=((*tgcCoin_it)->phi()+1)/4+1;//(phi,sector)= (1,1), (2,1), (3,2), (4,2) - } - if(sector>12)sector=1; - //*** calculation of sector end ***// - - if((*tgcCoin_it)->type()==Muon::TgcCoinData::TYPE_TRACKLET){ - rawTgcCoin->setGlobalPositionIn((*tgcCoin_it)->globalposIn()); - rawTgcCoin->setGlobalPositionOut((*tgcCoin_it)->globalposOut()); - rawTgcCoin->setType(0); - rawTgcCoin->setEta(m_idHelperSvc->tgcIdHelper().stationEta((*tgcCoin_it)->identify())); - rawTgcCoin->setPhi((*tgcCoin_it)->phi()); - rawTgcCoin->setSector(sector); - rawTgcCoin->setIsForward(static_cast<int>((*tgcCoin_it)->isForward())); - rawTgcCoin->setIsStrip(static_cast<int>((*tgcCoin_it)->isStrip())); - rawTgcCoin->setTrackletId((*tgcCoin_it)->trackletId()); - rawTgcCoin->setTrackletIdStrip(0); - rawTgcCoin->setBcTag(bcTag); - rawTgcCoin->setWidthIn((*tgcCoin_it)->widthIn()); - rawTgcCoin->setWidthOut((*tgcCoin_it)->widthOut()); - rawTgcCoin->setWidthR(0); - rawTgcCoin->setWidthPhi(0); - rawTgcCoin->setDelta((*tgcCoin_it)->delta()); - rawTgcCoin->setRoi(0); - rawTgcCoin->setPt(0); - rawTgcCoin->setSub((*tgcCoin_it)->sub()); - rawTgcCoin->setIsPositiveDeltaR(0); - } else if((*tgcCoin_it)->type()==Muon::TgcCoinData::TYPE_HIPT){ - rawTgcCoin->setGlobalPositionIn((*tgcCoin_it)->globalposIn()); - rawTgcCoin->setGlobalPositionOut((*tgcCoin_it)->globalposOut()); - rawTgcCoin->setType(1); - rawTgcCoin->setEta(m_idHelperSvc->tgcIdHelper().stationEta((*tgcCoin_it)->identify())); - rawTgcCoin->setPhi((*tgcCoin_it)->phi()); - rawTgcCoin->setSector(sector); - rawTgcCoin->setIsForward(static_cast<int>((*tgcCoin_it)->isForward())); - rawTgcCoin->setIsStrip(static_cast<int>((*tgcCoin_it)->isStrip())); - rawTgcCoin->setTrackletId((*tgcCoin_it)->trackletId()); - rawTgcCoin->setTrackletIdStrip(0); - rawTgcCoin->setBcTag(bcTag); - rawTgcCoin->setWidthIn((*tgcCoin_it)->widthIn()); - rawTgcCoin->setWidthOut((*tgcCoin_it)->widthOut()); - rawTgcCoin->setWidthR(0); - rawTgcCoin->setWidthPhi(0); - rawTgcCoin->setDelta((*tgcCoin_it)->delta()); - rawTgcCoin->setRoi(0); - rawTgcCoin->setPt(0); - rawTgcCoin->setSub((*tgcCoin_it)->sub()); - rawTgcCoin->setIsPositiveDeltaR(0); - } else if((*tgcCoin_it)->type()==Muon::TgcCoinData::TYPE_SL){ - Amg::Vector3D tmp(0.0,0.0,0.0); - rawTgcCoin->setGlobalPositionIn(tmp); - rawTgcCoin->setGlobalPositionOut((*tgcCoin_it)->globalposOut()); - rawTgcCoin->setType(2); - rawTgcCoin->setEta(m_idHelperSvc->tgcIdHelper().stationEta((*tgcCoin_it)->identify())); - rawTgcCoin->setPhi((*tgcCoin_it)->phi()); - rawTgcCoin->setSector(sector); - rawTgcCoin->setIsForward(static_cast<int>((*tgcCoin_it)->isForward())); - rawTgcCoin->setIsStrip(static_cast<int>((*tgcCoin_it)->isStrip())); - rawTgcCoin->setTrackletId((*tgcCoin_it)->trackletId()); - rawTgcCoin->setTrackletIdStrip((*tgcCoin_it)->trackletIdStrip()); - rawTgcCoin->setBcTag(bcTag); - rawTgcCoin->setWidthIn(0); - rawTgcCoin->setWidthOut(0); - double w1 = 1./std::sqrt((*tgcCoin_it)->errMat()(Trk::loc1,Trk::loc2)); - double w2 = 1./std::sqrt((*tgcCoin_it)->errMat()(Trk::loc2,Trk::loc2)); - rawTgcCoin->setWidthR(w1); - rawTgcCoin->setWidthPhi(w2); - rawTgcCoin->setDelta(0); - rawTgcCoin->setRoi((*tgcCoin_it)->roi()); - rawTgcCoin->setPt((*tgcCoin_it)->pt()); - rawTgcCoin->setSub(0); - rawTgcCoin->setIsPositiveDeltaR((*tgcCoin_it)->isPositiveDeltaR()); - } - - rawHits->addMuonCalibRawHit( rawTgcCoin ); - } - } - } - } // if ( m_doTGCCoin ) - - if( m_doRPCCoin ){ - const Muon::RpcCoinDataContainer* rpcCoinContainer = 0; - if( !evtStore()->contains<Muon::RpcCoinDataContainer>("RPC_triggerHits") ){ - ATH_MSG_DEBUG("RpcCoinDataContainer not contained in SG"); - }else if(evtStore()->retrieve(rpcCoinContainer,"RPC_triggerHits").isFailure()) { - ATH_MSG_DEBUG("Cannot retrieve RpcCoinDataContainer"); - }else{ - - ATH_MSG_DEBUG("Retrieved RpcCoinDataContainer " << rpcCoinContainer->numberOfCollections()); - - Muon::RpcCoinDataContainer::const_iterator it = rpcCoinContainer->begin(); - Muon::RpcCoinDataContainer::const_iterator it_end = rpcCoinContainer->end(); - for( ; it!=it_end; ++it ) { - const Muon::RpcCoinDataCollection* col = *it; - if( !col ) continue; - Muon::RpcCoinDataCollection::const_iterator cit = col->begin(); - Muon::RpcCoinDataCollection::const_iterator cit_end = col->end(); - for( ;cit!=cit_end;++cit ){ - if( !*cit ) continue; - const Muon::RpcCoinData& coinData = **cit; - MuonCalibRawRpcHit* rawRpc = createRawRpcHit(coinData); - if( !rawRpc ) continue; - bool lowPtCm = coinData.isLowPtCoin(); - MuonCalibRawRpcCoin* rawRpcCoin = new MuonCalibRawRpcCoin(*rawRpc, - coinData.ijk(), - coinData.threshold(), - coinData.overlap(), - coinData.parentCmId(), - coinData.parentPadId(), - coinData.parentSectorId(), - lowPtCm); - rawHits->addMuonCalibRawHit(rawRpcCoin); - - if(msgLvl(MSG::DEBUG)){ - MuonCalibRawRpcCoin& hit = *rawRpcCoin; - ATH_MSG_DEBUG(" RpcCoinData: sector " << hit.parentSectorId() << " pad " << hit.parentPadId() - << " CLHEP::cm " << hit.parentCmId() << " ijk " << hit.ijk() << " lowPT " << hit.lowPtCm() - << " overlap " << hit.overlap() << " time " << hit.t() - << " eta " << hit.globalPosition().eta() - << " phi " << hit.globalPosition().phi()); - } - delete rawRpc; - } - } - } - } // if( m_doRPCCoin ) - - return rawHits; - } - - const MuonCalibRawTriggerHitCollection* MuonCalibAlg::retrieveRawTriggerHits() const{ - // Rpc trigger hits - const RpcPadContainer* rpcRDO = nullptr; - const RpcPad* rdoColl = nullptr; - MuonCalibRawTriggerHitCollection* rawTriggerHits = new MuonCalibRawTriggerHitCollection(); - if( !evtStore()->contains<RpcPadContainer>("RPCPAD") ){ - ATH_MSG_DEBUG("RpcPadContainer not contained in SG"); - }else if(evtStore()->retrieve(rpcRDO,"RPCPAD").isFailure()) { - ATH_MSG_DEBUG("Cannot retrieve RpcPadContainer"); - }else{ - ATH_MSG_VERBOSE("Retrieved RawRpcTriggerDataContainer " << rpcRDO->numberOfCollections()); - for (RpcPadContainer::const_iterator rdoColli = rpcRDO->begin(); rdoColli!=rpcRDO->end(); ++rdoColli){ - rdoColl = *rdoColli; - // Now loop on the RDO - if ( (rdoColl)->size() != 0 ) { // number of cma/pad - // for each pad, loop over cma - RpcPad::const_iterator it_cma = (rdoColl)->begin(); - RpcPad::const_iterator it_cma_end = (rdoColl)->end(); - for (; it_cma!=it_cma_end; ++it_cma) { - const RpcCoinMatrix * cma = (*it_cma); - //for each cma loop over fired channels - ATH_MSG_DEBUG("Number of fired channels for this CM is " << (cma)->size()); - RpcCoinMatrix::const_iterator it_chan = (*it_cma)->begin(); - RpcCoinMatrix::const_iterator it_chan_end = (*it_cma)->end(); - for (; it_chan!=it_chan_end; ++it_chan) { - const RpcFiredChannel * fChannel = (*it_chan); - //Make a new trigger hit - MuonCalibRawRpcTriggerHit* rawRpcTriggerHit = new MuonCalibRawRpcTriggerHit( (rdoColl)->sector(), - (rdoColl)->onlineId(), - (rdoColl)->status(), - (rdoColl)->errorCode(), - cma->onlineId(), - cma->fel1Id(), - cma->febcId(), - cma->crc(), - fChannel->bcid(), - fChannel->time(), - fChannel->ijk(), - fChannel->channel(), - fChannel->ijk() == 7 ? fChannel->ovl() : -1, - fChannel->ijk() == 7 ? fChannel->thr() : -1 ); - //and push it back! - rawTriggerHits->addMuonCalibRawTriggerHit(rawRpcTriggerHit); - } - } - } - } //for (RpcPadContainer::const_iterator rdoColli.... - } - ATH_MSG_VERBOSE("rawTriggerHits for this event has " << rawTriggerHits->numberOfMuonCalibRawRpcTriggerHits() << " RPC trigger hits "); - return rawTriggerHits; - } - - const MuonCalibEvent* MuonCalibAlg::retrieveEvent() const { - //Retrieve all ingredients needed to build an MuonCalibEvent - MuonCalibEventInfo eventInfo = retrieveEventInfo(); - - const MuonCalibEvent::MCPVec patterns = retrievePatterns(); - - MuonCalibEvent* event = new MuonCalibEvent( patterns ); - - const MuonCalibTriggerTimeInfo* triggerTimeInfo = retrieveTriggerTimeInfo(); - if(triggerTimeInfo) event->setMuonCalibTriggerTimeInfo( triggerTimeInfo ); - - if(m_doRawData){ - //After constructing the patternVector, use this to set occupancy values - //of the raw hits in the MuonCalibRawHitCollection. - const MuonCalibRawHitCollection* rawHits = retrieveRawHits( patterns ); - event->setMuonCalibRawHitCollection( rawHits ); - } else event->setMuonCalibRawHitCollection( 0 ); - - if( m_doRPCTriggerHits ){ - const MuonCalibRawTriggerHitCollection* trighits = retrieveRawTriggerHits(); - event->setMuonCalibRawTriggerHitCollection( trighits ); - } else event->setMuonCalibRawTriggerHitCollection( 0 ); - - if(m_doTruth){ - const MuonCalibTruthCollection* truth = retrieveTruthCollection(); - event->setMuonCalibTruthCollection( truth ); - } else event->setMuonCalibTruthCollection( 0 ); - - if( m_doRpcSectorLogic ){ - const RpcSectorLogicContainer* slLogic = nullptr; - if( !evtStore()->contains<RpcSectorLogicContainer>("") ){ - ATH_MSG_DEBUG(" RpcSectorLogicContainer not contained in SG"); - }else if(evtStore()->retrieve(slLogic).isFailure()) { - ATH_MSG_DEBUG("Cannot retrieve RpcSectorLogicContainer"); - } - event->setRpcSectorLogicContainer(slLogic); - - if( slLogic ){ - const RpcSectorLogicContainer& slContainer = *slLogic; - // loop over container - RpcSectorLogicContainer::const_iterator slit = slContainer.begin(); - RpcSectorLogicContainer::const_iterator slit_end = slContainer.end(); - for( ;slit!=slit_end;++slit ){ - const RpcSectorLogic& slLogic = **slit; - if( slLogic.empty() ) continue; - ATH_MSG_DEBUG(" RpcSectorLogic: sector " << slLogic.sectorId() - << " felId " << slLogic.fel1Id() - << " bcId " << slLogic.bcid() - << " errCode " << slLogic.errorCode() - << " crc " << slLogic.crc()); - RpcSectorLogic::const_iterator hitIt = slLogic.begin(); - RpcSectorLogic::const_iterator hitIt_end = slLogic.end(); - for( ;hitIt != hitIt_end; ++hitIt ){ - const RpcSLTriggerHit& slHit = **hitIt; - ATH_MSG_DEBUG(" hit: rowinBcid " << slHit.rowinBcid() - << " padId " << slHit.padId() - << " ptid " << slHit.ptId() - << " roi " << slHit.roi() - << " outerPlane" << slHit.outerPlane() - << " overlapPhi " << slHit.overlapPhi() - << " overlapEta " << slHit.overlapEta() - << " triggerBcid " << slHit.triggerBcid() - << " isInput" << slHit.isInput()); - } - } - } - } - event->setMuonCalibEventInfo( eventInfo ); - return event; - } - - MuonCalibRawRpcHit* MuonCalibAlg::createRawRpcHit( const Muon::RpcPrepData& prd ) const { - MuonCalibRawRpcHit* rawRpcHit = new MuonCalibRawRpcHit(); - MuonFixedId fID = m_idToFixedIdTool->idToFixedId( prd.identify() ) ; - rawRpcHit->setGlobalPosition( prd.globalPosition() ); - rawRpcHit->setId( fID ); - rawRpcHit->setT( prd.time() ); - // get detector element - const MuonGM::RpcReadoutElement* detEl = prd.detectorElement(); - rawRpcHit->setWidth( detEl->StripWidth( m_idHelperSvc->rpcIdHelper().measuresPhi(prd.identify()) ) ); - rawRpcHit->setLength( detEl->StripLength(m_idHelperSvc->rpcIdHelper().measuresPhi(prd.identify()))); - return rawRpcHit; - } - -}//end namespace MuonCalib - diff --git a/MuonSpectrometer/MuonCalib/MuonCalibAlgs/src/components/MuonCalibAlgs_entries.cxx b/MuonSpectrometer/MuonCalib/MuonCalibAlgs/src/components/MuonCalibAlgs_entries.cxx deleted file mode 100644 index 4b3c23806a4479a05644fd5f428ab1f56df3bb73..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibAlgs/src/components/MuonCalibAlgs_entries.cxx +++ /dev/null @@ -1,6 +0,0 @@ -#include "MuonCalibAlgs/MuonCalibAlg.h" - -using namespace MuonCalib; - -DECLARE_COMPONENT( MuonCalibAlg ) - diff --git a/MuonSpectrometer/MuonCalib/MuonCalibJobTransforms/CMakeLists.txt b/MuonSpectrometer/MuonCalib/MuonCalibJobTransforms/CMakeLists.txt deleted file mode 100644 index 60a7de2ec5133eb94b6371ce6fed1c69480714d6..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibJobTransforms/CMakeLists.txt +++ /dev/null @@ -1,15 +0,0 @@ -################################################################################ -# Package: MuonCalibJobTransforms -################################################################################ - -# Declare the package name: -atlas_subdir( MuonCalibJobTransforms ) - -# Declare the package's dependencies: -atlas_depends_on_subdirs( PUBLIC - Tools/PyJobTransformsCore ) - -# Install files from the package: -atlas_install_python_modules( python/*.py ) -atlas_install_runtime( share/RT_default_comm.dat ) - diff --git a/MuonSpectrometer/MuonCalib/MuonCalibJobTransforms/python/GetFitBy.py b/MuonSpectrometer/MuonCalib/MuonCalibJobTransforms/python/GetFitBy.py deleted file mode 100644 index 0cb344b271308795ca69889bac3703dc66b9b2b5..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibJobTransforms/python/GetFitBy.py +++ /dev/null @@ -1,39 +0,0 @@ -# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration - -from __future__ import print_function - -import os - -def GetFitBy(region_string, joblist="joblist.txt", default="CHAMBER"): - if not os.path.exists(joblist): - print ("WARNING", joblist, "does not exist. Using defalut", default) - return default - reg_items=region_string.replace("[", "").replace("]", "").split(",") - if len(reg_items)!=3: - print ("WARNING Cannot interpret region string for GetFitBy. Using default", default) - return default - try: - station_nm=reg_items[0].strip() - station_phi=int(reg_items[1]) - station_eta=int(reg_items[2]) - except ValueError: - print ("WARNING Failed to interpret region string for GetFitBy. Using default", default) - return default - - inf=open(joblist) - inf.readline() - for line in inf.readlines(): - items=line.split() - if not len(items)==4: - continue - try: - ln_station=items[0] - ln_eta=int(items[1]) - ln_phi=int(items[2]) - except ValueError: - continue - if station_nm==ln_station and station_phi==ln_phi and station_eta==ln_eta: - return items[3] - - print ("WARNING", region_string, "not found in joblist. Using default ", default) - return default diff --git a/MuonSpectrometer/MuonCalib/MuonCalibJobTransforms/python/MDTCalibFitConfig.py b/MuonSpectrometer/MuonCalib/MuonCalibJobTransforms/python/MDTCalibFitConfig.py deleted file mode 100644 index 68e805b4cb7fd3a8992dbaeda3dc74b9fbc80602..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibJobTransforms/python/MDTCalibFitConfig.py +++ /dev/null @@ -1,344 +0,0 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration - -import os -__all__ = [] - -from PyJobTransformsCore.TransformConfig import * -import PyJobTransformsCore.basic_trfarg as trfarg - -# define configuration properties -class MDTCalibFitConfig(TransformConfig): - # prevent any mistypings by not allowing dynamic members - __slots__ = () - - # list of attributes - postOptions = String("jobOptions fragment to be appended at the end of the skeleton", None) - CalibrationSite = String("Calibration Site", "NONE") - PostProcessCalibration = Boolean("Set to true if you want to insert the calibration constants to the database", True) - NoRecalculation = Boolean("If set to true no drift ties and drift radii will be recalculated. Use this for validation", False) - SelectStation = String("Select Station", "BIL") - SelectEta = Integer("Select Eta", 3) - SelectPhi = Integer("Select Phi", 3) - CalibInputLocation = String("Input Location", None) - outputLocation = String("Output Location", None) - - def __init__(self,name='mdtCalibFitConfig',metaData=None): - TransformConfig.__init__(self,name,metaData) - self.maxeventsstrategy = 'ABORT' - - -class CalibrationAlgorithmArg(trfarg.StringChoicesArg): - """choose here the calibration algorithm to use""" - def __init__(self, choices, caseSensitive=False, help='calibration algorithm to be used', name='calibrationAlgorithm'): - trfarg.StringChoicesArg.__init__(self, choices, help, name, caseSensitive) - def isFullArgument(self): - return True - -class SelectChamberArg(trfarg.StringArg): - """chamber selection""" - def __init__(self, help='select the chamber to be used', name='selectChamber'): - trfarg.StringArg.__init__(self, help, name) - def isFullArgument(self): - return True - -class CalibNtupleFileListArg(trfarg.StringArg): - """calibration ntuple file list name""" - def __init__(self, help='calibration ntuple file list to be used', name='calibNtupleFileList'): - trfarg.StringArg.__init__(self, help, name) - def isFullArgument(self): - return True - -class CalibSiteArg(trfarg.StringArg): - """calibration site name""" - def __init__(self, help='select the calibration site name', name='calibSite'): - trfarg.StringArg.__init__(self, help, name) - def isFullArgument(self): - return True - -class WriteToDBArg(trfarg.BoolArg): - """If set to false, write only to calibration files""" - def __init__(self, help='If set to false, write only to calibration files', name='writeToDB'): - trfarg.BoolArg.__init__(self, help, name) - def isFullArgument(self): - return True - -class T0FitByArg(trfarg.StringChoicesArg): - """set the tube grouping for the t0 fit""" - def __init__(self, help="set the tube grouping for the t0 fit", name='t0FitBy'): - trfarg.StringChoicesArg.__init__(self, ['AUTO','TUBE', 'LAYER', 'MULTILAYER', 'MEZZ_CARD', 'TUBE'], help, name, True) - def isFullArgument(self): - return True - -class MuonRecoArg(trfarg.IntegerArg): - """select muon reconstruction alg 3=Muonboy 4=Moore""" - def __init__(self, help="select muon reconstruction alg 3=Muonboy 4=Moore", name='MuonReco'): - trfarg.IntegerArg.__init__(self, help, name) - def isFullArgument(self): - return True - -class ADCFitByArg(trfarg.StringChoicesArg): - """set the tube grouping for the adc fit""" - def __init__(self, help="set the tube grouping for the adc fit", name='adcFitBy'): - trfarg.StringChoicesArg.__init__(self, ['TUBE', 'LAYER', 'MULTILAYER', 'MEZZ_CARD', 'TUBE'], help, name, True) - def isFullArgument(self): - return True - -class RefineT0Arg(trfarg.BoolArg): - """ """ - def __init__(self, help=' ', name='refineT0'): - trfarg.BoolArg.__init__(self, help, name) - def isFullArgument(self): - return True - -class SegmentRefitArg(trfarg.BoolArg): - """perform a segment refit - not for algorithms like MTT0, Integration, RunScan.. """ - def __init__(self, help='perform a segment refit - not for algorithms like MTT0, Integration, RunScan..', name='segmentRefit'): - trfarg.BoolArg.__init__(self, help, name) - def isFullArgument(self): - return True - -class InputFromDBArg(trfarg.BoolArg): - """ """ - def __init__(self, help='', name='inputFromDB'): - trfarg.BoolArg.__init__(self, help, name) - def isFullArgument(self): - return True - -class InputFromFileArg(trfarg.BoolArg): - """ """ - def __init__(self, help='', name='inputFromFile'): - trfarg.BoolArg.__init__(self, help, name) - def isFullArgument(self): - return True - -class OutputToDBArg(trfarg.BoolArg): - """ """ - def __init__(self, help='', name='outputToDB'): - trfarg.BoolArg.__init__(self, help, name) - def isFullArgument(self): - return True - -class HeadIdArg(trfarg.IntegerArg): - """ calibration DB header used (if -1 take the last one) """ - def __init__(self, help='', name='headId'): - trfarg.IntegerArg.__init__(self, help, name) - def isFullArgument(self): - return True - -class OutputToFileArg(trfarg.BoolArg): - """ """ - def __init__(self, help='', name='outputToFile'): - trfarg.BoolArg.__init__(self, help, name) - def isFullArgument(self): - return True - -class MdtDqaFileArg(trfarg.StringArg): - """ """ - def __init__(self, help='', name='mdtDqaFile'): - trfarg.StringArg.__init__(self, help, name) - def isFullArgument(self): - return True - -class FillHistosArg(trfarg.BoolArg): - """ """ - def __init__(self, help='', name='fillHistos'): - trfarg.BoolArg.__init__(self, help, name) - def isFullArgument(self): - return True - -class DoFinalizeArg(trfarg.BoolArg): - """ """ - def __init__(self, help='', name='doFinalize'): - trfarg.BoolArg.__init__(self, help, name) - def isFullArgument(self): - return True - -class DoEfficiencyArg(trfarg.BoolArg): - """ """ - def __init__(self, help='', name='doEfficiency'): - trfarg.BoolArg.__init__(self, help, name) - def isFullArgument(self): - return True - -class DoGlobalTimeFitArg(trfarg.BoolArg): - """ """ - def __init__(self, help='', name='doGlobalTimeFit'): - trfarg.BoolArg.__init__(self, help, name) - def isFullArgument(self): - return True - -class SuppressRecalibrationArg(trfarg.BoolArg): - """ suppress any refit of the segments """ - def __init__(self, help='', name='suppressRecalibration'): - trfarg.BoolArg.__init__(self, help, name) - def isFullArgument(self): - return True - -class SegsFromRawArg(trfarg.BoolArg): - """ Compute segments from raw hits """ - def __init__(self, help='', name='segsFromRaw'): - trfarg.BoolArg.__init__(self, help, name) - def isFullArgument(self): - return True - -class CurvedSegsArg(trfarg.BoolArg): - """ Use curved traks to fit hits """ - def __init__(self, help='', name='curvedSegs'): - trfarg.BoolArg.__init__(self, help, name) - def isFullArgument(self): - return True - -class BfieldCorrArg(trfarg.BoolArg): - """ Apply Bfield corrections """ - def __init__(self, help='', name='bfieldCorr'): - trfarg.BoolArg.__init__(self, help, name) - def isFullArgument(self): - return True - -class HitResidArg(trfarg.BoolArg): - """ MdtDqa: residuals vs radius """ - def __init__(self, help='', name='hitResid'): - trfarg.BoolArg.__init__(self, help, name) - def isFullArgument(self): - return True - -class DeadElAlgArg(trfarg.IntegerArg): - """ MdtDqa: Dead Element calculation algorithm """ - def __init__(self, help='', name='DeadElAlg'): - trfarg.IntegerArg.__init__(self, help, name) - def isFullArgument(self): - return True - -class ADCcutArg(trfarg.FloatArg): - """ MdtDqa: ADC cut value """ - def __init__(self, help='', name='ADCcut'): - trfarg.FloatArg.__init__(self, help, name) - def isFullArgument(self): - return True - -class EffNsigArg(trfarg.FloatArg): - """ MdtDqa: N sigma cut for efficiency calculation """ - def __init__(self, help='', name='EffNsig'): - trfarg.FloatArg.__init__(self, help, name) - def isFullArgument(self): - return True - -class EffChiCutArg(trfarg.FloatArg): - """ MdtDqa: chi2 cut in efficiency calculation """ - def __init__(self, help='', name='EffChiCut'): - trfarg.FloatArg.__init__(self, help, name) - def isFullArgument(self): - return True - -class EffUseDefResArg(trfarg.BoolArg): - """ MdtDqa: choose default resolution """ - def __init__(self, help='', name='EffUseDefRes'): - trfarg.BoolArg.__init__(self, help, name) - def isFullArgument(self): - return True - - -class EffiGtfArg(trfarg.BoolArg): - """ MdtDqa: use GTF in efficiency calculation """ - def __init__(self, help='', name='effiGtf'): - trfarg.BoolArg.__init__(self, help, name) - def isFullArgument(self): - return True - -class EffiReCalArg(trfarg.BoolArg): - """ MdtDqa: recalibrate hits in efficiency calculation """ - def __init__(self, help='', name='effiReCal'): - trfarg.BoolArg.__init__(self, help, name) - def isFullArgument(self): - return True - -class EffiTimeCorrArg(trfarg.BoolArg): - """ MdtDqa: use timing corrections in efficiency calculation """ - def __init__(self, help='', name='effiTimeCorr'): - trfarg.BoolArg.__init__(self, help, name) - def isFullArgument(self): - return True - -class TrackPCut(trfarg.FloatArg): - """ TrackPCut <=-2: No segmen t on track selection - -2<TrackPCut<=-1: Select segments on any track - -1<TrackPCut<=0: Select segments on a track with a valid momentum measurement - TrackPCut>0: Select segments on a track with the given p-cut. """ - def __init__(self, help="""TrackPCut <=-2: No segmen t on track selection - -2<TrackPCut<=-1: Select segments on any track - -1<TrackPCut<=0: Select segments on a track with a valid momentum measurement - TrackPCut>0: Select segments on a track with the given p-cut. """, name='trackPCut'): - trfarg.FloatArg.__init__(self, help, name) - def isFullArgument(self): - return True - -class FastTrackMatch(trfarg.BoolArg): - """ Use faster tsegment to track matching """ - def __init__(self, help="Use faster segment to track matching", name="fastTrackMatch"): - trfarg.BoolArg.__init__(self, help, name) - def isFullArgument(self): - return True - -class SuperFastTrackMatch(trfarg.BoolArg): - """ Use segment on track info in ntuple """ - def __init__(self, help="Use faster segment to track matching", name="superFastTrackMatch"): - trfarg.BoolArg.__init__(self, help, name) - def isFullArgument(self): - return True - -class ApplyTimeSlewingCorrection(trfarg.BoolArg): - """ Apply Time Slewing Corrections """ - def __init__(self, help=" Apply Time Slewing Corrections", name="applyTimeSlewingCorrection"): - trfarg.BoolArg.__init__(self, help, name) - def isFullArgument(self): - return True - -class ApplyRtScaling(trfarg.BoolArg): - """Apply multilayerwise rt scaling""" - def __init__(self, help= "Apply multilayerwise rt scaling", name="applyRtScaling"): - trfarg.BoolArg.__init__(self, help, name) - def isFullArgument(self) : - return True - -class SplitterStoreRaw(trfarg.BoolArg): - """Store raw branches in splitter""" - def __init__(self, help= "Store raw branches in splitter", name="splitterStoreRaw"): - trfarg.BoolArg.__init__(self, help, name) - def isFullArgument(self) : - return True - -class SplitterStoreTracks(trfarg.BoolArg): - """Store track branches in splitter""" - def __init__(self, help= "Store track branches in splitter", name="splitterStoreTracks"): - trfarg.BoolArg.__init__(self, help, name) - def isFullArgument(self) : - return True - -class SplitterSplitLevel(trfarg.StringChoicesArg): - """ntuple split level""" - def __init__(self, help="ntuple slpit level", name='splitLevel'): - trfarg.StringChoicesArg.__init__(self, ['NONE', "NAME", "NAME_PHI", "NAME_PHI_ETA"], help, name, True) - def isFullArgument(self): - return True - -class SplitterADCCut(trfarg.IntegerArg): - """ADC cut on rawdata""" - def __init__(self, help='ADC cut on rawdata', name='splitterADCCut'): - trfarg.IntegerArg.__init__(self, help, name) - def isFullArgument(self): - return True - -class SplitterMergeOutputFiles(trfarg.StringArg): - """List of files into which output files are merged""" - def __init__(self, help='List of files into which output files are merged', name='splitterMergeOutputFiles'): - trfarg.StringArg.__init__(self, help, name) - def isFullArgument(self): - return True - def setValue(self, value): - if value and self.value(): - value=self.value() + "," + str(value) - trfarg.StringArg.setValue(self, value) - - -# make configuration object -mdtCalibFitConfig = MDTCalibFitConfig() diff --git a/MuonSpectrometer/MuonCalib/MuonCalibJobTransforms/python/MDTCalibFitValConfig.py b/MuonSpectrometer/MuonCalib/MuonCalibJobTransforms/python/MDTCalibFitValConfig.py deleted file mode 100644 index 3fcb695bb914393624e3d01d3ad4ae8f2317782b..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibJobTransforms/python/MDTCalibFitValConfig.py +++ /dev/null @@ -1,34 +0,0 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration - -import os -__all__ = [] - -from PyJobTransformsCore.TransformConfig import * -import PyJobTransformsCore.basic_trfarg as trfarg - -# define configuration properties -class MDTCalibFitValConfig(TransformConfig): - # prevent any mistypings by not allowing dynamic members - __slots__ = () - - # list of attributes - CalibrationSite = String("Calibration Site", "NONE") - PostProcessCalibration = Boolean("Set to true if you want to insert the calibration constants to the database", True) - NoRecalculation = Boolean("If set to true no drift ties and drift radii will be recalculated. Use this for validation", False) - SelectStation = String("Select Station", "BIL") - SelectEta = Integer("Select Eta", 3) - SelectPhi = Integer("Select Phi", 3) - CalibInputLocation = String("Input Location", None) - outputLocation = String("Output Location", None) - postOptionsFitT0 = String("jobOptions fragment to be appended at the end of the T0 fit", None) - postOptionsValT0 = String("jobOptions fragment to be appended at the end of the T0 validation", None) - postOptionsFitRT = String("jobOptions fragment to be appended at the end of the RT fit", None) - postOptionsValRT = String("jobOptions fragment to be appended at the end of the RT validation", None) - - def __init__(self,name='mdtCalibFitValConfig',metaData=None): - TransformConfig.__init__(self,name,metaData) - self.maxeventsstrategy = 'ABORT' - - -# make configuration object -mdtCalibFitValConfig = MDTCalibFitValConfig() diff --git a/MuonSpectrometer/MuonCalib/MuonCalibJobTransforms/python/MDTCalibNtupleConfig.py b/MuonSpectrometer/MuonCalib/MuonCalibJobTransforms/python/MDTCalibNtupleConfig.py deleted file mode 100644 index 01c85cec0f769d48940161a903ef3088fd49fdb6..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibJobTransforms/python/MDTCalibNtupleConfig.py +++ /dev/null @@ -1,145 +0,0 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration - -import os -__all__ = [] - -from PyJobTransformsCore.TransformConfig import * -import PyJobTransformsCore.basic_trfarg as trfarg - -# define configuration properties -class MDTCalibNtupleConfig(TransformConfig): - # prevent any mistypings by not allowing dynamic members - __slots__ = () - - # list of attributes - postOptions = String("jobOptions fragment to be appended at the end of the skeleton", None) - #doMScombined = Boolean("Use MScombined", False) - #doMDT = Boolean("Process MDT hits", True) - #doRPC = Boolean("Process RPC hits", True) - #doMoMu = Boolean("Use NIKHEF cosmic pattern", True) - #doMoore = Boolean("Use Moore reconstruction", False) - ##doMuonBoy = Boolean("Use Muonboy reconstruction", False) - - def __init__(self,name='mdtCalibNtupleConfig',metaData=None): - TransformConfig.__init__(self,name,metaData) - self.maxeventsstrategy = 'ABORT' - -class DbT0TagArg(trfarg.StringArg): - """MDT T0 DB folder tag to be used, overwriting the one - from the global tag, set to 'DEFAULT' to keep global tag""" - def __init__(self, help='DB tag for T0', name='dbT0Tag'): - trfarg.StringArg.__init__(self, help, name) - def isFullArgument(self): - return 'DEFAULT' - -class DbRTTagArg(trfarg.StringArg): - """MDT RT DB folder tag to be used, overwriting the one - from the global tag, set to 'DEFAULT' to keep global tag""" - def __init__(self, help='DB tag for RT', name='dbRTTag'): - trfarg.StringArg.__init__(self, help, name) - def isFullArgument(self): - return 'DEFAULT' - -class DbT0SqlArg(trfarg.StringArg): - """SQLite file containing the MDT T0 folder to be used, overwriting default - COOL DB for that folder, set to 'DEFAULT' to keep default""" - def __init__(self, help='SQLite file for T0', name='dbT0Sql'): - trfarg.StringArg.__init__(self, help, name) - def isFullArgument(self): - return 'DEFAULT' - -class DbRTSqlArg(trfarg.StringArg): - """SQLite file containing the MDT RT folder to be used, overwriting default - COOL DB for that folder, set to 'DEFAULT' to keep default""" - def __init__(self, help='SQLite file for RT', name='dbRTSql'): - trfarg.StringArg.__init__(self, help, name) - def isFullArgument(self): - return 'DEFAULT' - -class UseAlignArg(trfarg.BoolArg): - """run segment reconstruction and not tracks""" - def __init__(self, help='run only segment reconstruction', name='useAlign'): - trfarg.BoolArg.__init__(self, help, name) - def isFullArgument(self): - return True - -class SegOnlyArg(trfarg.BoolArg): - """run segment reconstruction and not tracks""" - def __init__(self, help='run only segment reconstruction', name='segOnly'): - trfarg.BoolArg.__init__(self, help, name) - def isFullArgument(self): - return True - -class MooreArg(trfarg.BoolArg): - """select Moore for the reconstruction run before filling the calibration ntuple""" - def __init__(self, help='selected muon reconstruction', name='moore'): - trfarg.BoolArg.__init__(self, help, name) - def isFullArgument(self): - return True - -class MboyArg(trfarg.BoolArg): - """select Mboy for the reconstruction run before filling the calibration ntuple""" - def __init__(self, help='selected muon reocnstruction', name='mboy'): - trfarg.BoolArg.__init__(self, help, name) - def isFullArgument(self): - return True - -class StandaloneArg(trfarg.BoolArg): - """select 3rd chain for the reconstruction run before filling the calibration ntuple""" - def __init__(self, help='selected muon reocnstruction', name='standalone'): - trfarg.BoolArg.__init__(self, help, name) - def isFullArgument(self): - return True - -class DoSegmentT0FitArg(trfarg.BoolArg): - """ use the T0 refinement """ - def __init__(self, help='selected muon reocnstruction', name='doSegmentT0Fit'): - trfarg.BoolArg.__init__(self, help, name) - def isFullArgument(self): - return True - -class CalibNtupleDoSimArg(trfarg.BoolArg): - """process simulated data for the calibration ntuple""" - def __init__(self, help='process simulated data', name='doSim'): - trfarg.BoolArg.__init__(self, help, name) - def isFullArgument(self): - return True - -class DoCSCArg(trfarg.BoolArg): - """process CSC data""" - def __init__(self, help='process CSC data', name='doCSC'): - trfarg.BoolArg.__init__(self, help, name) - def isFullArgument(self): - return True - -class RawTgcArg(trfarg.BoolArg): - """put rawTgc and rawTgcCoin branches in calib ntuple""" - def __init__(self, help='put rawTgc and rawTgcCoin branches in calib ntuple', name='rawTgc'): - trfarg.BoolArg.__init__(self, help, name) - def isFullArgument(self): - return True - -class LumiBlockNumberFromCool(trfarg.BoolArg): - """get lumi block number from coditions database according to time-stamp """ - def __init__(self, help='get lumi block number from coditions database according to time-stamp', name='lumiBlockNumberFromCool'): - trfarg.BoolArg.__init__(self, help, name) - def isFullArgument(self): - return True - -class RunNumberFromCool(trfarg.BoolArg): - """get run number from coditions database according to time-stamp """ - def __init__(self, help='get run number from coditions database according to time-stamp', name='runNumberFromCool'): - trfarg.BoolArg.__init__(self, help, name) - def isFullArgument(self): - return True - -class CosmicRun(trfarg.BoolArg): - """Set to true if the run is a cosmic run. TOF will be set to 0 and time slewing correction will be applied""" - def __init__(self, help='Set to true if the run is a cosmic run. TOF will be set to 0 and time slewing correction will be applied', name='cosmicRun'): - trfarg.BoolArg.__init__(self, help, name) - def isFullArgument(self): - return True - - -# make configuration object -mdtCalibNtupleConfig = MDTCalibNtupleConfig() diff --git a/MuonSpectrometer/MuonCalib/MuonCalibJobTransforms/python/MDTCalibValConfig.py b/MuonSpectrometer/MuonCalib/MuonCalibJobTransforms/python/MDTCalibValConfig.py deleted file mode 100644 index a8fbd50589c2bdb3b5a7ae606a9e0bb9285df9bb..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibJobTransforms/python/MDTCalibValConfig.py +++ /dev/null @@ -1,52 +0,0 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration - -import os -__all__ = [] - -from PyJobTransformsCore.TransformConfig import * -import PyJobTransformsCore.basic_trfarg as trfarg - -# define configuration properties -class MDTCalibValConfig(TransformConfig): - # prevent any mistypings by not allowing dynamic members - __slots__ = () - - # list of attributes - WriterConnectionString = String("Calibration Db Writer Connection String", "oracle://atlas-oracle-01.roma1.infn.it/atlrome.roma1.infn.it/atlas_muoncalib_rome") - ReaderConnectionString = String("Calibration Db Reader Connection String", "oracle://atlas-oracle-01.roma1.infn.it/atlrome.roma1.infn.it/atlas_muoncalib_rome") - ReaderWorkingSchema = String("Calibration Db Reader Working Schema", "atlas_muoncalib_rome") - - def __init__(self,name='mdtCalibValConfig',metaData=None): - TransformConfig.__init__(self,name,metaData) - self.maxeventsstrategy = 'ABORT' - -class ValAlgorithmArg(trfarg.StringChoicesArg): - """choose here the calibration algorithm to use""" - def __init__(self, choices, caseSensitive=False, help='calibration algorithm to be used', name='calibrationAlgorithm'): - trfarg.StringChoicesArg.__init__(self, choices, help, name, caseSensitive) - def isFullArgument(self): - return True - -class SelectChamberArg(trfarg.StringArg): - """chamber selection""" - def __init__(self, help='select the chamber to be used', name='selectChamber'): - trfarg.StringArg.__init__(self, help, name) - def isFullArgument(self): - return True - -class CalibSiteArg(trfarg.StringArg): - """calibration site name""" - def __init__(self, help='select the calibration site name', name='calibSite'): - trfarg.StringArg.__init__(self, help, name) - def isFullArgument(self): - return True - -class HeaderIdArg(trfarg.IntegerArg): - """DB header to validate""" - def __init__(self, help='select the calibration ID to validate', name='headId'): - trfarg.IntegerArg.__init__(self, help, name) - def isFullArgument(self): - return True - -# make configuration object -mdtCalibValConfig = MDTCalibValConfig() diff --git a/MuonSpectrometer/MuonCalib/MuonCalibJobTransforms/python/RPCCalibNtupleConfig.py b/MuonSpectrometer/MuonCalib/MuonCalibJobTransforms/python/RPCCalibNtupleConfig.py deleted file mode 100644 index f17e99be0e6aa4fea6000a22a395888508c1d98d..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibJobTransforms/python/RPCCalibNtupleConfig.py +++ /dev/null @@ -1,76 +0,0 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration - -import os -__all__ = [] - -from PyJobTransformsCore.TransformConfig import * -import PyJobTransformsCore.basic_trfarg as trfarg - -# define configuration properties -class RPCCalibNtupleConfig(TransformConfig): - # prevent any mistypings by not allowing dynamic members - __slots__ = () - - # list of attributes - postOptions = String("jobOptions fragment to be appended at the end of the skeleton", None) - doExtrapolNtuple = Boolean("Dump extrapolations to ntuple", True) - clusterTimeSpread = Float("Cluster time spread", 15) - fieldMask = String("defines which parts of the field are on","111") - conditionsTag = String("conditions tag","COMCOND-REPC-001-03") - - def __init__(self,name='rpcCalibNtupleConfig',metaData=None): - TransformConfig.__init__(self,name,metaData) - self.maxeventsstrategy = 'ABORT' - -# make configuration object -rpcCalibNtupleConfig = RPCCalibNtupleConfig() - -class ConditionsTagArg(trfarg.StringArg): - """choose here the IOVDb global tag, i.e. the misalignemnts db""" - def __init__(self, help='IOVDb global tag', name='conditionsTag'): - trfarg.StringArg.__init__(self, help, name) - def isFullArgument(self): - return True - -class FieldMaskArg(trfarg.StringArg): - """choose which fields must be turned on""" - def __init__(self, help='field mask', name='fieldMask'): - trfarg.StringArg.__init__(self, help, name) - def isFullArgument(self): - return True - -class trigNtupleArg(trfarg.BoolArg): - """turns on trig ntuple""" - def __init__(self, help='trigger ntuple', name='trigNtuple'): - trfarg.BoolArg.__init__(self, help, name) - def isFullArgument(self): - return True - -class resNtupleArg(trfarg.BoolArg): - """turns on rpc res ntuple""" - def __init__(self, help='residuals ntuple', name='resNtuple'): - trfarg.BoolArg.__init__(self, help, name) - def isFullArgument(self): - return True - -class extrNtupleArg(trfarg.BoolArg): - """turns on rpc extr ntuple""" - def __init__(self, help='extrapolations ntuple', name='extrNtuple'): - trfarg.BoolArg.__init__(self, help, name) - def isFullArgument(self): - return True - - -class PRDNtupleArg(trfarg.BoolArg): - """turns on trig ntuple""" - def __init__(self, help='rpc prd ntuple', name='prdNtuple'): - trfarg.BoolArg.__init__(self, help, name) - def isFullArgument(self): - return True - - -class recoAlgArg(trfarg.StringChoicesArg): - def __init__(self, choices, caseSensitive=False, help='reco algorithm to be used', name='recoAlg'): - trfarg.StringChoicesArg.__init__(self, choices, help, name, caseSensitive) - def isFullArgument(self): - return True diff --git a/MuonSpectrometer/MuonCalib/MuonCalibJobTransforms/scripts/__init__.py b/MuonSpectrometer/MuonCalib/MuonCalibJobTransforms/scripts/__init__.py deleted file mode 100644 index 1e5bbb9c47f7305f8d2e4255438afc6f1043cc06..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibJobTransforms/scripts/__init__.py +++ /dev/null @@ -1,3 +0,0 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration - -# Auto-generated by /mnt/classis03/home3/calib/splitter/trf/AtlasProduction/12.0.6.4/Tools/PyJobTransformsCore/share/ensure_init.py -s=../scripts mdt_calib*_trf.py diff --git a/MuonSpectrometer/MuonCalib/MuonCalibJobTransforms/scripts/mdt_calib_fit_trf.py b/MuonSpectrometer/MuonCalib/MuonCalibJobTransforms/scripts/mdt_calib_fit_trf.py deleted file mode 100755 index 56ad2e391ae68a23e30dd5bdb7a869ebab400b6d..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibJobTransforms/scripts/mdt_calib_fit_trf.py +++ /dev/null @@ -1,161 +0,0 @@ -#!/usr/bin/env python - -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration - -__doc__ = """Produce calibration fits. -Take the calibration ntuples as input files and produce fitted data.""" - -from PyJobTransformsCore.trf import * -from PyJobTransformsCore.full_trfarg import * -from PyJobTransformsCore.trfutil import * -from MuonCalibJobTransforms.MDTCalibFitConfig import mdtCalibFitConfig -from MuonCalibJobTransforms.MDTCalibFitConfig import CalibrationAlgorithmArg -from MuonCalibJobTransforms.MDTCalibFitConfig import SelectChamberArg -from MuonCalibJobTransforms.MDTCalibFitConfig import CalibNtupleFileListArg -from MuonCalibJobTransforms.MDTCalibFitConfig import CalibSiteArg -from MuonCalibJobTransforms.MDTCalibFitConfig import WriteToDBArg -from MuonCalibJobTransforms.MDTCalibFitConfig import T0FitByArg -from MuonCalibJobTransforms.MDTCalibFitConfig import ADCFitByArg -from MuonCalibJobTransforms.MDTCalibFitConfig import MuonRecoArg -from MuonCalibJobTransforms.MDTCalibFitConfig import RefineT0Arg -from MuonCalibJobTransforms.MDTCalibFitConfig import SegmentRefitArg -from MuonCalibJobTransforms.MDTCalibFitConfig import InputFromDBArg -from MuonCalibJobTransforms.MDTCalibFitConfig import InputFromFileArg -from MuonCalibJobTransforms.MDTCalibFitConfig import OutputToDBArg -from MuonCalibJobTransforms.MDTCalibFitConfig import OutputToFileArg -from MuonCalibJobTransforms.MDTCalibFitConfig import HeadIdArg -from MuonCalibJobTransforms.MDTCalibFitConfig import MdtDqaFileArg -from MuonCalibJobTransforms.MDTCalibFitConfig import FillHistosArg -from MuonCalibJobTransforms.MDTCalibFitConfig import DoFinalizeArg -from MuonCalibJobTransforms.MDTCalibFitConfig import DoEfficiencyArg -from MuonCalibJobTransforms.MDTCalibFitConfig import DoGlobalTimeFitArg -from MuonCalibJobTransforms.MDTCalibFitConfig import SuppressRecalibrationArg -from MuonCalibJobTransforms.MDTCalibFitConfig import SegsFromRawArg -from MuonCalibJobTransforms.MDTCalibFitConfig import CurvedSegsArg -from MuonCalibJobTransforms.MDTCalibFitConfig import BfieldCorrArg -from MuonCalibJobTransforms.MDTCalibFitConfig import HitResidArg -from MuonCalibJobTransforms.MDTCalibFitConfig import DeadElAlgArg -from MuonCalibJobTransforms.MDTCalibFitConfig import ADCcutArg -from MuonCalibJobTransforms.MDTCalibFitConfig import EffNsigArg -from MuonCalibJobTransforms.MDTCalibFitConfig import EffChiCutArg -from MuonCalibJobTransforms.MDTCalibFitConfig import EffUseDefResArg -from MuonCalibJobTransforms.MDTCalibFitConfig import EffiGtfArg -from MuonCalibJobTransforms.MDTCalibFitConfig import EffiReCalArg -from MuonCalibJobTransforms.MDTCalibFitConfig import EffiTimeCorrArg -from MuonCalibJobTransforms.MDTCalibFitConfig import TrackPCut -from MuonCalibJobTransforms.MDTCalibFitConfig import FastTrackMatch -from MuonCalibJobTransforms.MDTCalibFitConfig import SuperFastTrackMatch -from MuonCalibJobTransforms.MDTCalibFitConfig import ApplyTimeSlewingCorrection -from MuonCalibJobTransforms.MDTCalibFitConfig import ApplyRtScaling -from MuonCalibJobTransforms.MDTCalibFitConfig import SplitterStoreRaw, SplitterSplitLevel,SplitterADCCut,SplitterMergeOutputFiles,SplitterStoreTracks - -class MDTCalibFitJobTransform( JobTransform ): - def __init__(self): - JobTransform.__init__(self, - authors = [ Author('Alessandro De Salvo','alessandro.desalvo@roma1.infn.it'), - Author('Fabrizio Petrucci','fabrizio.petrucci@roma3.infn.it') ] , - skeleton='MuonCalibJobTransforms/skeleton.mdt_calib_fit.py', - help = __doc__, - config=mdtCalibFitConfig ) - - #add arguments - self.add( CalibNtupleFileListArg() ) - self.add( MaxEventsArg() ) - self.add( SkipEventsArg() ) - self.add( GeometryVersionArg() ) - self.add( CalibrationAlgorithmArg(['RunScan','ClassicT0','MTT0','Integration', 'ClassicAutocal', 'AnalyticAutocal', 'CurvedAutocal', 'SimpleResolution', 'Chi2Resolution', 'Efficiency', 'RpcTiming', 'ControlHistograms', 'MDTChamberGeometryDetermination', 'MdtDqa', 'Splitter', 'TimeSlewing', 'ResidualVsTimeTool', 'Display']), default='ClassicT0' ) - self.add( SelectChamberArg(), default='[BML,4, 4]' ) - - self.add( CalibSiteArg(), default='RM' ) - self.add( JobConfigArg(package='MuonCalibJobTransforms'), default='NONE' ) - self.add( DBReleaseArg(), default='NONE' ) - - self.add(WriteToDBArg(), default="True") - self.add(T0FitByArg(), default='MEZZ_CARD') - self.add(MuonRecoArg(), default='4' ) - self.add(ADCFitByArg(), default='MEZZ_CARD') - self.add(RefineT0Arg(), default='True') - self.add(SegmentRefitArg(), default='False') - self.add(InputFromDBArg(), default='False') - self.add(InputFromFileArg(), default='True') - self.add(OutputToDBArg(), default='False') - self.add(OutputToFileArg(), default='True') - self.add(HeadIdArg(), default='-1') - self.add(MdtDqaFileArg(), default='MdtDqa') - self.add(FillHistosArg(), default='True') - self.add(DoFinalizeArg(), default='False') - self.add(DoEfficiencyArg(), default='True') - self.add(DoGlobalTimeFitArg(), default='False') - self.add(SuppressRecalibrationArg(), default='True') - self.add(SegsFromRawArg(), default='False') - self.add(CurvedSegsArg(), default='False') - self.add(BfieldCorrArg(), default='False') - self.add(HitResidArg(), default='False') - - self.add(DeadElAlgArg(), default='1') - self.add(ADCcutArg(), default='70.') - self.add(EffNsigArg(), default='-1') - self.add(EffChiCutArg(), default='5.') - self.add(EffUseDefResArg(), default='True') - - self.add(EffiGtfArg(), default='False') - self.add(EffiReCalArg(), default='False') - self.add(EffiTimeCorrArg(), default='False') - self.add(TrackPCut(), default=-3.0) - self.add(FastTrackMatch(), default=True) - self.add(SuperFastTrackMatch(), default=False) - self.add(ApplyTimeSlewingCorrection(), default=True) - self.add(ApplyRtScaling(), default=False) - self.add(SplitterStoreRaw(), default=False) - self.add(SplitterStoreTracks(), default=True) - self.add(SplitterSplitLevel(name="splitterFileSplitLevel"), default="NONE") - self.add(SplitterSplitLevel(name="splitterNtupleSplitLevel"), default="NONE") - self.add(SplitterADCCut(), default=0) - self.add(SplitterMergeOutputFiles(), default="") - - #add other features - self.add( SQLiteSupport() ) - -# execute it if not imported -if __name__ == '__main__': - trf = MDTCalibFitJobTransform() - exit_code=trf.exeSysArgs().exitCode() - if not trf.runArgs().splitterMergeOutputFiles or exit_code!=0: - sys.exit(exit_code) - import glob - import shutil - import subprocess - for output in trf.runArgs().splitterMergeOutputFiles.split(","): - out_items=output.split(":") - if len(out_items)>2: - sys.stderr.write("WARNING: Malformed outfile arg " + output + "\n") - continue - glob_string="OutNtuple*.root" - target_file=output - if len(out_items)==2: - glob_string="OutNtuple_" + out_items[0] + "*.root" - target_file = out_items[1] - infiles=glob.glob(glob_string) - if not infiles: - prev_argv=sys.argv[:] - sys.argv=[sys.argv[0], '-b'] - from ROOT import * - dummy_outfile=TFile.Open(target_file, "RECREATE") - dummy_outfile.Write() - sys.argv=prev_argv - continue - if len(infiles)==1: - shutil.move(infiles[0], target_file) - continue - #merge one by one to avoid disk-space restrictions - file1=infiles[0] - for next_file in infiles[1:]: - if subprocess.call(["hadd", target_file, file1, next_file]): - sys.stderr.write("WARNING: hadd failed!\n") - subprocess.call(["rm", next_file, file1]) - if not next_file==infiles[-1]: - shutil.move(target_file, "tmp." + target_file) - file1="tmp." + target_file - - sys.exit(exit_code) - diff --git a/MuonSpectrometer/MuonCalib/MuonCalibJobTransforms/scripts/mdt_calib_fit_val_trf.py b/MuonSpectrometer/MuonCalib/MuonCalibJobTransforms/scripts/mdt_calib_fit_val_trf.py deleted file mode 100755 index 5e0ce8e3853705d97e1e36f803de188d28612481..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibJobTransforms/scripts/mdt_calib_fit_val_trf.py +++ /dev/null @@ -1,70 +0,0 @@ -#!/usr/bin/env python - -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration - -__doc__ = """Produce calibration fits and validate them in 4 steps. -Take the calibration ntuples as input files and produce fitted data.""" - -from PyJobTransformsCore.trf import * -from PyJobTransformsCore.full_trfarg import * -from PyJobTransformsCore.trfutil import * -from MuonCalibJobTransforms.mdt_calib_fit_trf import MDTCalibFitJobTransform -from MuonCalibJobTransforms.mdt_calib_val_trf import MDTCalibValJobTransform - - -class MDTCalibFitValJobTransform( JobTransform ): - def __init__(self): - JobTransform.__init__(self, - authors = [ Author('Alessandro De Salvo','alessandro.desalvo@roma1.infn.it'), - Author('Fabrizio Petrucci','fabrizio.petrucci@roma3.infn.it') ] , - help = __doc__ ) - - #add arguments - self.add( CalibNtupleFileListArg() ) - self.add( MaxEventsArg() ) - self.add( SkipEventsArg() ) - self.add( SelectChamberArg(), default='[BML,4, 4]' ) - self.add( JobConfigArg(package='MuonCalibJobTransforms'), default='NONE' ) - - def runJob(self): - # get the list of arguments to be used in sub-transforms - argDict = self.argumentOriginalDict() - # Fit T0 phase - t0fit = MDTCalibFitJobTransform() - t0fit.setJobReportOptions('None') - argDict['calibrationAlgorithm'] = argDict['ClassicT0'] - report = t0fit.exeArgDict( argDict ) - # only run t0 validation if the T0 making was successfull - if (report.exitCode() == 0): - # print out short report on first stage - t0fit.dumpReport('Summary,Errors') - # T0 validation phase - t0val = MDTCalibValJobTransform() - t0val.setJobReportOptions('Summary') - argDict['calibrationAlgorithm'] = argDict['T0Val'] - reportT0val = t0val.exeArgDict( argDict ) - report.addReport( reportT0val ) - # Fit RT phase - rtfit = MDTCalibFitJobTransform() - rtfit.setJobReportOptions('None') - argDict['calibrationAlgorithm'] = argDict['ClassicAutocal'] - reportRT = rtfit.exeArgDict( argDict ) - report.addReport( reportRT ) - # only run rt validation if the rt making was successfull - if (reportRT.exitCode() == 0): - # print out short report on first stage - rtfit.dumpReport('Summary,Errors') - # rt validation phase - rtval = MDTCalibValJobTransform() - rtval.setJobReportOptions('Summary') - argDict['calibrationAlgorithm'] = argDict['RtVal'] - reportRTval = rtval.exeArgDict( argDict ) - report.addReport( reportRTval ) - - return report - - -# execute it if not imported -if __name__ == '__main__': - trf = MDTCalibFitJobTransform() - sys.exit(trf.exeSysArgs().exitCode()) diff --git a/MuonSpectrometer/MuonCalib/MuonCalibJobTransforms/scripts/mdt_calib_ntuple_tf.py b/MuonSpectrometer/MuonCalib/MuonCalibJobTransforms/scripts/mdt_calib_ntuple_tf.py deleted file mode 100755 index 4099882aaf10f7ef73f4acd0eba02c07a829c63b..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibJobTransforms/scripts/mdt_calib_ntuple_tf.py +++ /dev/null @@ -1,116 +0,0 @@ -#!/usr/bin/env python - -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration - -__doc__ = """mdt_calib_ntuple_tf.py: Produce calibration ntuples for MDT calibrations. -Use calibration stream as input file and produce calibrations ntuples as output files.""" - -import sys -import time - -import logging - -# Setup core logging here -from PyJobTransforms.trfLogger import msg -msg.info('logging set in %s' % sys.argv[0]) - -from PyJobTransforms.transform import transform -from PyJobTransforms.trfExe import athenaExecutor -from PyJobTransforms.trfArgs import addAthenaArguments, addDetectorArguments -from PyJobTransforms.trfDecorators import stdTrfExceptionHandler, sigUsrStackTrace - -import PyJobTransforms.trfArgClasses as trfArgClasses -from PyJobTransforms.trfArgClasses import argFactory - -@stdTrfExceptionHandler -@sigUsrStackTrace -def main(): - - msg.info('This is %s' % sys.argv[0]) - - trf = getTransform() - trf.parseCmdLineArgs(sys.argv[1:]) - trf.execute() - trf.generateReport() - - msg.info("%s stopped at %s, trf exit code %d" % (sys.argv[0], time.asctime(), trf.exitCode)) - sys.exit(trf.exitCode) - -def getTransform(): - executorSet = set() - executorSet.add(athenaExecutor(name='MDTCalibNtuple', skeletonFile='MuonCalibJobTransforms/skeleton.mdt_calib_ntuple_tf.py' )) -# possibly (?) one should specify input/output formats to the transform can check them, however, adding this -# info causes transform to fail. Of course transform does not know about calibstream bytestream, though -# in principle it knows about calib ntuples. -#', inData=['BS'], outData=['NTUP_MUONCALIB'] #specify input/output file formats. - trf = transform(executor = executorSet) - -# for maxEvents skipEvents - actually skipEvents do not work with calibstream -# so do not use addAthenaArguments, but make own arguments for these. -# addAthenaArguments(trf.parser) -# for runNumber geometryVersion DBRelease conditionsTag - addDetectorArguments(trf.parser) -# for parameters specific to calib ntuple production - addMyArgs(trf.parser) - return trf - -def addMyArgs(parser): - # Use arggroup to get these arguments in their own sub-section (of --help) - parser.defineArgGroup('mdt_calib_ntuple_tf', 'MDT calib ntuple job specific options') - parser.add_argument('--inputCSFiles', type=argFactory(trfArgClasses.argList), - help='Input calibration stream file(s)', group='mdt_calib_ntuple_tf') - parser.add_argument('--ntupleFile', type=argFactory(trfArgClasses.argString), - help='Output calib ntuple', group='mdt_calib_ntuple_tf') - -# Cannot use normal maxEvents and skipEvents because these seem to be -# reserved for special use by transform framework, hence use different argument names. - parser.add_argument("--Events", group="mdt_calib_ntuple_tf", - default=trfArgClasses.argInt(-1, runarg=True), - help="the number of events to process", - type=trfArgClasses.argFactory(trfArgClasses.argInt, runarg=True)) - parser.add_argument("--Skip", group="mdt_calib_ntuple_tf", - default=trfArgClasses.argInt(0, runarg=True), - help="the number of events to skip at beginning of the file", - type=trfArgClasses.argFactory(trfArgClasses.argInt, runarg=True)) - - parser.add_argument('--dbT0Tag', type=argFactory(trfArgClasses.argString), default='DEFAULT', - help='Specify T0 Tag', group='mdt_calib_ntuple_tf') - parser.add_argument('--dbRTTag', type=argFactory(trfArgClasses.argString), default='DEFAULT', - help='Specify RT Tag', group='mdt_calib_ntuple_tf') - parser.add_argument('--dbT0Sql', type=argFactory(trfArgClasses.argString), default='DEFAULT', - help='Specify SQLite file for T0s', group='mdt_calib_ntuple_tf') - parser.add_argument('--dbRTSql', type=argFactory(trfArgClasses.argString), default='DEFAULT', - help='Specify SQLite file for RTs', group='mdt_calib_ntuple_tf') -# Transform boolean variables will not be created in runArgs unless you specify them on command line -# Hence, in the skeleton you need to check if they exist before you use them. - parser.add_argument('--useAlign', type=argFactory(trfArgClasses.argBool), - help='Use Alignment corrections', group='mdt_calib_ntuple_tf') -# segOnly False results in calib ntuple not being filled -# parser.add_argument('--segOnly', type=argFactory(trfArgClasses.argBool), -# help='Segments only', group='mdt_calib_ntuple_tf') -# Only standalone exists anymore and is enabled by default so there is no reason to set it anymore -# parser.add_argument('--moore', type=argFactory(trfArgClasses.argBool), -# help='Use Moore segments + tracks', group='mdt_calib_ntuple_tf') -# parser.add_argument('--mboy', type=argFactory(trfArgClasses.argBool), -# help='Use Muonboy segments + tracks', group='mdt_calib_ntuple_tf') -# parser.add_argument('--standalone', type=argFactory(trfArgClasses.argBool), -# help='Use Standalone tracks', group='mdt_calib_ntuple_tf') - parser.add_argument('--doSegmentT0Fit', type=argFactory(trfArgClasses.argBool), - help='Do Segment T0 Fits', group='mdt_calib_ntuple_tf') - parser.add_argument('--doCSC', type=argFactory(trfArgClasses.argBool), - help='Do CSC', group='mdt_calib_ntuple_tf') - parser.add_argument('--rawTgc', type=argFactory(trfArgClasses.argBool), - help='put rawTgc and rawTgcCoin branches in calib ntuple', group='mdt_calib_ntuple_tf') -# doSim is not even used in the skeleton, so skip it. -# parser.add_argument('--doSim', type=argFactory(trfArgClasses.argBool), -# help='Do Simulated data (whatever that means)', group='mdt_calib_ntuple_tf') -# Not sure what the use case is for these, but leave them be. - parser.add_argument('--lumiBlockNumberFromCool', type=argFactory(trfArgClasses.argBool), - help='Fetch Lumiblock Number from COOL', group='mdt_calib_ntuple_tf') - parser.add_argument('--runNumberFromCool', type=argFactory(trfArgClasses.argBool), - help='Fetch Run Number from COOL (?)', group='mdt_calib_ntuple_tf') -# Old TRF had this but I do not think it is needed anymore -# self.add( JobConfigArg(package='MuonCalibJobTransforms'), default='NONE' ) - -if __name__ == '__main__': - main() diff --git a/MuonSpectrometer/MuonCalib/MuonCalibJobTransforms/scripts/mdt_calib_ntuple_trf.py b/MuonSpectrometer/MuonCalib/MuonCalibJobTransforms/scripts/mdt_calib_ntuple_trf.py deleted file mode 100755 index 53b260bdeb5c05e19eb3d9e569701264ae865d9a..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibJobTransforms/scripts/mdt_calib_ntuple_trf.py +++ /dev/null @@ -1,74 +0,0 @@ -#!/usr/bin/env python - -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration - -__doc__ = """Produce calibration ntuples for fitting. -Take the calibration bytestream as input file and produce ntuples as output files.""" - -from PyJobTransformsCore.trf import * -from PyJobTransformsCore.full_trfarg import * -from PyJobTransformsCore.trfutil import * -from MuonCalibJobTransforms.MDTCalibNtupleConfig import mdtCalibNtupleConfig -from MuonCalibJobTransforms.MDTCalibNtupleConfig import DbT0TagArg -from MuonCalibJobTransforms.MDTCalibNtupleConfig import DbRTTagArg -from MuonCalibJobTransforms.MDTCalibNtupleConfig import DbT0SqlArg -from MuonCalibJobTransforms.MDTCalibNtupleConfig import DbRTSqlArg -from MuonCalibJobTransforms.MDTCalibNtupleConfig import UseAlignArg -from MuonCalibJobTransforms.MDTCalibNtupleConfig import SegOnlyArg -from MuonCalibJobTransforms.MDTCalibNtupleConfig import MooreArg -from MuonCalibJobTransforms.MDTCalibNtupleConfig import MboyArg -from MuonCalibJobTransforms.MDTCalibNtupleConfig import StandaloneArg -from MuonCalibJobTransforms.MDTCalibNtupleConfig import CalibNtupleDoSimArg -from MuonCalibJobTransforms.MDTCalibNtupleConfig import DoSegmentT0FitArg -from MuonCalibJobTransforms.MDTCalibNtupleConfig import DoCSCArg -from MuonCalibJobTransforms.MDTCalibNtupleConfig import RawTgcArg -from MuonCalibJobTransforms.MDTCalibNtupleConfig import LumiBlockNumberFromCool -from MuonCalibJobTransforms.MDTCalibNtupleConfig import RunNumberFromCool -from MuonCalibJobTransforms.MDTCalibNtupleConfig import CosmicRun - -class MDTCalibNtupleJobTransform( JobTransform ): - def __init__(self): - JobTransform.__init__(self, - authors = [ Author('Alessandro De Salvo','alessandro.desalvo@roma1.infn.it'), - Author('Fabrizio Petrucci','fabrizio.petrucci@roma3.infn.it') ] , - skeleton='MuonCalibJobTransforms/skeleton.mdt_calib_ntuple.py', - help = __doc__, - config=mdtCalibNtupleConfig ) - - #add arguments - self.add( InputBSFileArg() ) - self.add( NtupleFileArg() ) - self.add( RunNumberArg() ) - self.add( MaxEventsArg() ) - self.add( SkipEventsArg() ) - self.add( GeometryVersionArg() ) - self.add( ConditionsTagArg() ) - self.add( DbT0TagArg(), default='DEFAULT' ) - self.add( DbRTTagArg(), default='DEFAULT' ) - self.add( DbT0SqlArg(), default='DEFAULT' ) - self.add( DbRTSqlArg(), default='DEFAULT' ) - self.add( UseAlignArg(), default='True' ) - self.add( SegOnlyArg(), default='True' ) - self.add( MooreArg(), default='True' ) - self.add( MboyArg(), default='False' ) - self.add( StandaloneArg(), default='False' ) - self.add( DoSegmentT0FitArg(), default='False' ) - - self.add( JobConfigArg(package='MuonCalibJobTransforms'), default='NONE' ) - self.add( CalibNtupleDoSimArg(), default='False' ) - self.add( DBReleaseArg(), default='NONE' ) - - self.add( DoCSCArg(), default='False' ) - self.add( RawTgcArg(), default='False' ) - - self.add( LumiBlockNumberFromCool(), default='False' ) - self.add( RunNumberFromCool(), default='False' ) - - #add other features - self.add( SQLiteSupport() ) - self.add( CosmicRun(), default='False') - -# execute it if not imported -if __name__ == '__main__': - trf = MDTCalibNtupleJobTransform() - sys.exit(trf.exeSysArgs().exitCode()) diff --git a/MuonSpectrometer/MuonCalib/MuonCalibJobTransforms/scripts/mdt_calib_val_trf.py b/MuonSpectrometer/MuonCalib/MuonCalibJobTransforms/scripts/mdt_calib_val_trf.py deleted file mode 100755 index cf676f9246a9357fcf284cf09d05333ed40adc28..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibJobTransforms/scripts/mdt_calib_val_trf.py +++ /dev/null @@ -1,42 +0,0 @@ -#!/usr/bin/env python - -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration - -__doc__ = """Validate calibration fits. -Reads the calibration database and validaes the constants therein""" - -from PyJobTransformsCore.trf import * -from PyJobTransformsCore.full_trfarg import * -from PyJobTransformsCore.trfutil import * -from MuonCalibJobTransforms.MDTCalibValConfig import mdtCalibValConfig -from MuonCalibJobTransforms.MDTCalibValConfig import ValAlgorithmArg -from MuonCalibJobTransforms.MDTCalibValConfig import SelectChamberArg -from MuonCalibJobTransforms.MDTCalibValConfig import CalibSiteArg -from MuonCalibJobTransforms.MDTCalibValConfig import HeaderIdArg - -class MDTCalibValJobTransform( JobTransform ): - def __init__(self): - JobTransform.__init__(self, - authors = [ Author('Alessandro De Salvo','alessandro.desalvo@roma1.infn.it'), - Author('Fabrizio Petrucci','fabrizio.petrucci@roma3.infn.it') ] , - skeleton='MuonCalibJobTransforms/skeleton.mdt_calib_validate.py', - help = __doc__, - config=mdtCalibValConfig ) - - #add arguments - self.add( SelectChamberArg()) - self.add( MaxEventsArg() ) - self.add( GeometryVersionArg() ) - self.add( ValAlgorithmArg(['T0Val','RtVal']), default='T0Val' ) - self.add( CalibSiteArg(), default='RM' ) - self.add( JobConfigArg(package='MuonCalibJobTransforms'), default='NONE' ) - self.add( DBReleaseArg(), default='NONE' ) - self.add( HeaderIdArg(), default='-1' ) - - #add other features - self.add( SQLiteSupport() ) - -# execute it if not imported -if __name__ == '__main__': - trf = MDTCalibValJobTransform() - sys.exit(trf.exeSysArgs().exitCode()) diff --git a/MuonSpectrometer/MuonCalib/MuonCalibJobTransforms/scripts/rpc_calib_ntuple_ESD_trf.py b/MuonSpectrometer/MuonCalib/MuonCalibJobTransforms/scripts/rpc_calib_ntuple_ESD_trf.py deleted file mode 100755 index a386590b603b171fd747eeda10c727ff5290eee2..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibJobTransforms/scripts/rpc_calib_ntuple_ESD_trf.py +++ /dev/null @@ -1,39 +0,0 @@ -#!/usr/bin/env python - -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration - -__doc__ = """Produce calibration ntuples -Take ESD as input file and produce ntuples as output files.""" - -from PyJobTransformsCore.trf import * -from PyJobTransformsCore.full_trfarg import * -from PyJobTransformsCore.trfutil import * -from MuonCalibJobTransforms.RPCCalibNtupleConfig import rpcCalibNtupleConfig,FieldMaskArg,ConditionsTagArg,resNtupleArg, recoAlgArg, trigNtupleArg,PRDNtupleArg,extrNtupleArg - -class RPCCalibNtupleJobTransform( JobTransform ): - def __init__(self): - JobTransform.__init__(self, - authors = [ Author('Andrea Di Simone','andrea.di.simone@cern.ch')] , - skeleton='MuonCalibJobTransforms/skeleton.rpc_calib_ntuple_ESD.py', - help = __doc__, - config=rpcCalibNtupleConfig ) - - #add arguments - self.add( InputESDFileArg() ) - self.add( NtupleFileArg() ) - self.add( RunNumberArg() ) - self.add( MaxEventsArg() ) - self.add( SkipEventsArg() ) - self.add( GeometryVersionArg() ) - self.add( FieldMaskArg(), default="111") - self.add( ConditionsTagArg(),default="COMCOND-REPC-001-03") - self.add( DBReleaseArg(), default='NONE' ) - self.add( resNtupleArg(), default=True) - self.add( PRDNtupleArg(), default=False) - self.add( extrNtupleArg(), default=False) - self.add( JobConfigArg(package='MuonCalibJobTransforms'), default='NONE' ) - -# execute it if not imported -if __name__ == '__main__': - trf = RPCCalibNtupleJobTransform() - sys.exit(trf.exeSysArgs().exitCode()) diff --git a/MuonSpectrometer/MuonCalib/MuonCalibJobTransforms/scripts/rpc_calib_ntuple_fullStream_trf.py b/MuonSpectrometer/MuonCalib/MuonCalibJobTransforms/scripts/rpc_calib_ntuple_fullStream_trf.py deleted file mode 100755 index 878822bd5ab773a0acc56260665378bf25cd0b44..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibJobTransforms/scripts/rpc_calib_ntuple_fullStream_trf.py +++ /dev/null @@ -1,41 +0,0 @@ -#!/usr/bin/env python - -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration - -__doc__ = """Produce calibration ntuples -Take the calibration bytestream as input file and produce ntuples as output files.""" - -from PyJobTransformsCore.trf import * -from PyJobTransformsCore.full_trfarg import * -from PyJobTransformsCore.trfutil import * -from MuonCalibJobTransforms.RPCCalibNtupleConfig import rpcCalibNtupleConfig,FieldMaskArg,ConditionsTagArg, resNtupleArg, recoAlgArg, trigNtupleArg,PRDNtupleArg,extrNtupleArg - -class RPCCalibNtupleJobTransform( JobTransform ): - def __init__(self): - JobTransform.__init__(self, - authors = [ Author('Andrea Di Simone','andrea.di.simone@cern.ch')] , - skeleton='MuonCalibJobTransforms/skeleton.rpc_calib_ntuple_fullStream.py', - help = __doc__, - config=rpcCalibNtupleConfig ) - - #add arguments - self.add( InputBSFileArg() ) - self.add( NtupleFileArg() ) - self.add( RunNumberArg() ) - self.add( MaxEventsArg() ) - self.add( SkipEventsArg() ) - self.add( GeometryVersionArg() ) - self.add( FieldMaskArg(), default="111") - self.add( ConditionsTagArg(),default="COMCOND-REPC-001-03") - self.add( DBReleaseArg(), default='NONE' ) - self.add( resNtupleArg(), default=True) - self.add( trigNtupleArg(), default=False) - self.add( PRDNtupleArg(), default=False) - self.add( extrNtupleArg(), default=False) - self.add( recoAlgArg(['Moore','MuonBoy']), default='MuonBoy' ) - self.add( JobConfigArg(package='MuonCalibJobTransforms'), default='NONE' ) - -# execute it if not imported -if __name__ == '__main__': - trf = RPCCalibNtupleJobTransform() - sys.exit(trf.exeSysArgs().exitCode()) diff --git a/MuonSpectrometer/MuonCalib/MuonCalibJobTransforms/scripts/rpc_calib_ntuple_trf.py b/MuonSpectrometer/MuonCalib/MuonCalibJobTransforms/scripts/rpc_calib_ntuple_trf.py deleted file mode 100755 index 20d5253cea6a9f7188d82e5ddd2a0752d95f5789..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibJobTransforms/scripts/rpc_calib_ntuple_trf.py +++ /dev/null @@ -1,41 +0,0 @@ -#!/usr/bin/env python - -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration - -__doc__ = """Produce calibration ntuples -Take the calibration bytestream as input file and produce ntuples as output files.""" - -from PyJobTransformsCore.trf import * -from PyJobTransformsCore.full_trfarg import * -from PyJobTransformsCore.trfutil import * -from MuonCalibJobTransforms.RPCCalibNtupleConfig import rpcCalibNtupleConfig,FieldMaskArg,ConditionsTagArg,resNtupleArg, recoAlgArg, trigNtupleArg,PRDNtupleArg,extrNtupleArg - -class RPCCalibNtupleJobTransform( JobTransform ): - def __init__(self): - JobTransform.__init__(self, - authors = [ Author('Andrea Di Simone','andrea.di.simone@cern.ch')] , - skeleton='MuonCalibJobTransforms/skeleton.rpc_calib_ntuple.py', - help = __doc__, - config=rpcCalibNtupleConfig ) - - #add arguments - self.add( InputBSFileArg() ) - self.add( NtupleFileArg() ) - self.add( RunNumberArg() ) - self.add( MaxEventsArg() ) - self.add( SkipEventsArg() ) - self.add( GeometryVersionArg() ) - self.add( FieldMaskArg(), default="111") - self.add( ConditionsTagArg(),default="COMCOND-REPC-001-03") - self.add( DBReleaseArg(), default='NONE' ) - self.add( resNtupleArg(), default=True) - self.add( trigNtupleArg(), default=False) - self.add( PRDNtupleArg(), default=False) - self.add( extrNtupleArg(), default=False) - self.add( recoAlgArg(['Moore','MuonBoy']), default='MuonBoy' ) - self.add( JobConfigArg(package='MuonCalibJobTransforms'), default='NONE' ) - -# execute it if not imported -if __name__ == '__main__': - trf = RPCCalibNtupleJobTransform() - sys.exit(trf.exeSysArgs().exitCode()) diff --git a/MuonSpectrometer/MuonCalib/MuonCalibJobTransforms/share/RT_default_comm.dat b/MuonSpectrometer/MuonCalib/MuonCalibJobTransforms/share/RT_default_comm.dat deleted file mode 100644 index f2d5d7a9f11fa548f06ed78e74ed7a0fe890a5df..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibJobTransforms/share/RT_default_comm.dat +++ /dev/null @@ -1,101 +0,0 @@ -v0.0 1 dummy 0 100 -0.006 -3.75 1 -0.08 3.75 1 -0.12 11.25 1 -0.2 18.75 1 -0.329471 26.25 1 -0.891593 33.75 1 -1.26313 41.25 1 -1.61735 48.75 1 -1.95691 56.25 1 -2.3246 63.75 1 -2.69977 71.25 1 -3.06085 78.75 1 -3.39283 86.25 1 -3.73301 93.75 1 -4.0958 101.25 1 -4.40873 108.75 1 -4.71978 116.25 1 -5.01734 123.75 1 -5.27703 131.25 1 -5.54612 138.75 1 -5.7883 146.25 1 -6.0291 153.75 1 -6.25856 161.25 1 -6.47283 168.75 1 -6.69762 176.25 1 -6.90866 183.75 1 -7.10841 191.25 1 -7.29428 198.75 1 -7.47281 206.25 1 -7.65395 213.75 1 -7.83293 221.25 1 -7.99895 228.75 1 -8.16799 236.25 1 -8.32981 243.75 1 -8.49947 251.25 1 -8.64711 258.75 1 -8.80435 266.25 1 -8.94599 273.75 1 -9.09739 281.25 1 -9.23126 288.75 1 -9.38432 296.25 1 -9.51813 303.75 1 -9.65211 311.25 1 -9.76734 318.75 1 -9.90211 326.25 1 -10.0359 333.75 1 -10.1689 341.25 1 -10.2999 348.75 1 -10.3994 356.25 1 -10.5221 363.75 1 -10.6322 371.25 1 -10.7712 378.75 1 -10.8966 386.25 1 -11.023 393.75 1 -11.1243 401.25 1 -11.2325 408.75 1 -11.34 416.25 1 -11.443 423.75 1 -11.5491 431.25 1 -11.6699 438.75 1 -11.7648 446.25 1 -11.8627 453.75 1 -11.9555 461.25 1 -12.0428 468.75 1 -12.1561 476.25 1 -12.2449 483.75 1 -12.3672 491.25 1 -12.456 498.75 1 -12.5592 506.25 1 -12.652 513.75 1 -12.7501 521.25 1 -12.8264 528.75 1 -12.9499 536.25 1 -13.0109 543.75 1 -13.1288 551.25 1 -13.231 558.75 1 -13.309 566.25 1 -13.4132 573.75 1 -13.4872 581.25 1 -13.5871 588.75 1 -13.6684 596.25 1 -13.7587 603.75 1 -13.8251 611.25 1 -13.9379 618.75 1 -13.9877 626.25 1 -14.0801 633.75 1 -14.1629 641.25 1 -14.2375 648.75 1 -14.3356 656.25 1 -14.3797 663.75 1 -14.441 671.25 1 -14.4219 678.75 1 -14.5433 686.25 1 -14.5433 693.75 1 -14.5433 701.25 1 -14.5433 708.75 1 -14.5433 716.25 1 -14.5433 723.75 1 -14.5433 731.25 1 -14.5433 738.75 1 diff --git a/MuonSpectrometer/MuonCalib/MuonCalibJobTransforms/share/flags.py b/MuonSpectrometer/MuonCalib/MuonCalibJobTransforms/share/flags.py deleted file mode 100644 index bfc7232ef554277a7280c9ad5d50ee1edb8f5dc5..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibJobTransforms/share/flags.py +++ /dev/null @@ -1,132 +0,0 @@ -# -# Basic class with all the flags to run on cosmics -# -# -include.block("MuonCommissioning/MuDetCosmicFlags_jobOptions.py") -class MuDetCosmicFlags: - # ---- data type (if simulated doSim=True) - EvtMax = 1000 ############## modificabile - SkipEvents = 00000 ############## modificabile - doSim = False - - # --- Flag for M4 runs - doM4 = True - # --- Flag for M3 runs - doM3 = False - # --- Flag for activating the special data format of sector13 2006 runs - doSector13Data = False - - FullFileName = ["input.data"]############## modificabile - NumFile = [] - - doSimpleFile = False - if doM4: - doSimpleFile = True - # --- data specific flags (choose the directory and data file to run) - doMDTRPC = False - doMDTonly = False - doRPConly = False - dooldruns = False - -###----> FLAGS FOR CONVERTERS BS->RDO->PRD - - # --- ROB numbers for MDT/RPC/TGC - doMdtROBNumber = False - doRpcROBNumber = False - doTgcROBNumber = False - MdtSpecialROBNumber = 0x610009 - RpcSpecialROBNumber = 0x000000 - TgcSpecialROBNumber = 0 - - #RDO-->PREPDATA flags - doMDTRDOPRD = False - doRPCRDOPRD = True - doTGCRDOPRD = True - if doRPCRDOPRD: - doRPCPRDphi = True - else: - doRPCPRDphi = False - - # --- digits to prepdata conversion, for 12.0.X - doDigitsToPrepData = False - - #Turn on/off the filter of PRDs (for the moment, for simulation only ) - doSelectPRD = False - #if doSim: - # doSelectPRD = True - - # --- LVL1 Trigger flags - doMUCTPI = False - doCTP = False - - # --- Select data on sector/side of Muon Spectro - Sector = 13 - Side = 1 - doSelectSector = False - -###---> FLAGS FOR DETECTOR DESCRIPTION - - BarrelnoBF = True - BarrelwithBF = False - -###---> FLAGS FOR RECONSTRUCTION - - # ---- Reconstruction packages options - doMoore = False - doMuonboy = False - doMoMu = True - - # ----Conditions database options - doCalibCOOL2 = False ############## modificabile - doCalibCOOLprod= False ############## modificabile - doCalibCOOL13 = False - doAlignCOOLprod = False - - # ----Write ESD - doESD = False - PoolOutputFile = "MuDetRec_cosmics.pool.root" - - # ----Produce calibration Ntuple - doCalibFillNt = True - - # ---- make truth - if doSim: - doTruth = True - else: - doTruth = False - -###---> FLAGS FOR OUTPUT (NTUPLE, MONITORING,GRAPHICS) - - # --- write CBNT ntuple - doNtuple = True - doCBNTAthenaAware = False #default for 13.0.X releases - - # --- Fill ntuple with specific blocks - doMdtRawNt = False - doRpcRawNt = False - doCscRawNt = False - doTgcRawNt = False - if not doM4: - doTgcRawNt = False - - # --- Monitoring - doMonitoring = False - - # --- Graphics - doGraphics = False - JiveXML = False - OnlineJiveXML = False - if doGraphics: - doAtlantis = True - doPersint = True - if doMuonboy: - doNoReco = False - else: - doNoReco = True - else: - doAtlantis = False - doPersint = False - doNoReco = False - - # --- write Atlantis geometry xml file (JiveXML needs to be set True) - AtlantisGeometry = False diff --git a/MuonSpectrometer/MuonCalib/MuonCalibJobTransforms/share/rpc_trigNtuple.py b/MuonSpectrometer/MuonCalib/MuonCalibJobTransforms/share/rpc_trigNtuple.py deleted file mode 100644 index aa8ddc0c340ea67cb14d1c59fb6b341702a8eefc..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibJobTransforms/share/rpc_trigNtuple.py +++ /dev/null @@ -1,8 +0,0 @@ -from MuonCalibAlgs.MuonCalib import MuonCalibAlg - -MuonCalibAlg.doMDTs = False -MuonCalibAlg.doCSCs = False -MuonCalibAlg.doRPCs = True -MuonCalibAlg.doTGCs = False - -MuonCalibAlg.doTGCCoinData = False diff --git a/MuonSpectrometer/MuonCalib/MuonCalibJobTransforms/share/skeleton.mdt_calib_fit.py b/MuonSpectrometer/MuonCalib/MuonCalibJobTransforms/share/skeleton.mdt_calib_fit.py deleted file mode 100644 index f0ee53a573958e5f87773ebe8446af50c29dc6f2..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibJobTransforms/share/skeleton.mdt_calib_fit.py +++ /dev/null @@ -1,519 +0,0 @@ - - -# get the logger -from AthenaCommon.Logging import * -from MuonCalibJobTransforms.GetFitBy import * -mdtCalibFitlog = logging.getLogger('mdtCalibFit') - -def GetGroupByList(finest): - if finest=="LAYER": - return ["CHAMBER", "MULTILAYER", "LAYER"] - ret=[] - for group_by in ["CHAMBER", "MULTILAYER", "MEZZ_CARD", "TUBE"]: - ret.append(group_by) - if finest==group_by: - return ret - raise ValueError("Illegal group by parameter " + finest) - return [] - - - -mdtCalibFitlog.info('************** STARTING MDT CalibFit !!!!**************') -#============================================================== -# Job definition parameters: -#============================================================== - -filelist=runArgs.calibNtupleFileList -#file list -if runArgs.calibNtupleFileList[:4].upper() == "CSL:": - import tempfile - fl=tempfile.NamedTemporaryFile(mode="w", dir=".", delete=False) - filelist = fl.name - for inf in runArgs.calibNtupleFileList[4:].split(","): - fl.write(inf) - fl.write("\n") - del fl - - -EvtMax = runArgs.maxEvents -SkipEvents = runArgs.skipEvents -CalibSite = runArgs.calibSite -geover = runArgs.geometryVersion -if geover.upper()=="AUTO": - from CalibNtupleAnalysisAlg.CalibNtupleMetaData import * - meta_data=CalibNtupleMetaData(filelist) - if not 'GeoAtlas' in meta_data.MetaData: - mdtCalibFitlog.fatal("geometry version not found in meta data") - geover="INVALID" - else: - geover=meta_data.MetaData['GeoAtlas'] - mdtCalibFitlog.info("Set Geo-Version to " + geover) - - -if geover.find('NF') >=0: - fieldoff=True -else: - fieldoff=False - -mdtCalibFitlog.info( '**** Transformation run arguments ****' ) -mdtCalibFitlog.info( str(runArgs) ) - -#============================================================== -# Job Configuration parameters: -#============================================================== -from MuonCalibJobTransforms.MDTCalibFitConfig import mdtCalibFitConfig -for cf in runArgs.jobConfig: - include(cf) -mdtCalibFitlog.info( '**** Transformation configuration arguments ****' ) -mdtCalibFitlog.info( str(mdtCalibFitConfig) ) - -### Setup Athena common flags -#include ("AthenaCommon/AthenaCommonFlags.py") -#include.block("AthenaCommon/AthenaCommonFlags.py") - -#include( "IOVDbSvc/IOVRecExCommon.py" ) - -doMuonCalibAtlas=True - -from AthenaCommon.AppMgr import ServiceMgr - -from AthenaCommon.AppMgr import ToolSvc -from CalibNtupleAnalysisAlg.CalibNtupleAnalysisConfig import * -from MuonCalibStandAloneExtraTools.CalibExtraNtupleAnalysisConfig import * -from AthenaCommon.GlobalFlags import globalflags -#GlobalFlags.DetGeo.set_atlas() -#GlobalFlags.DataSource.set_data() -#GlobalFlags.Print() -globalflags.DetGeo.set_Value_and_Lock('atlas') -ToolSvc = Service( "ToolSvc" ) -globalflags.DataSource.set_Value_and_Lock('data') - -from AthenaCommon.DetFlags import DetFlags -DetFlags.detdescr.Muon_setOn() -DetFlags.detdescr.ID_setOff() -DetFlags.detdescr.LAr_setOff() -DetFlags.detdescr.Tile_setOff() - - - -#Set geometry tag -from AtlasGeoModel import SetGeometryVersion, GeoModelInit - -GeoModelSvc = ServiceMgr.GeoModelSvc -GeoModelSvc.AtlasVersion = geover - -#Config=CalibNtupleAnalysisConfig() - -if runArgs.calibrationAlgorithm == "MdtDqa" or (runArgs.calibrationAlgorithm == "Splitter" and runArgs.splitterStoreTracks) or runArgs.trackPCut > -2: - Config=CalibExtraNtupleAnalysisConfig() -else: - Config=CalibNtupleAnalysisConfig() - -#=============================================================================== -#Begin User Settings - -#calibratino algorithm to run: -#select calibration algoritm -# scan run for chambers RunScan -# t0-Fitters: ClassicT0, MTT0 -# create rt by integration Integration -# autocalibration ClassicAutocal, AnalyticAutocal, -# CurvedAutocal -# resolution SimpleResolution, Chi2Resolution -# efficiency Efficiency -# event display Display -# rpc timing RpcTiming -# control histograms ControlHistograms -# MDT DQA MdtDqa -Config.CalibrationAlgorithm = runArgs.calibrationAlgorithm - -Config.FileList = filelist - -#crete segments from the rawdata part -Config.SegmentsFromRawdata=runArgs.segsFromRaw - -#select segment author - 3=MuonBoy 4=Moore - Unused if SegmentsFromRawdata=True -Config.SegmentAuthor=runArgs.MuonReco - -#select only segments on tracks -if hasattr(Config, "SelectTrackSegments"): - Config.SelectTrackSegments= (runArgs.trackPCut >= -1) - -#apply 2nd coordinate of tracks to the segment - only works if SelectTrackSegments=True -if hasattr(Config, "TrackSecondCoordinate"): - Config.TrackSecondCoordinate=False - -if hasattr(Config, "MomentumCut"): - Config.MomentumCut = runArgs.trackPCut - -if hasattr(Config, "FastTrackMatch"): - Config.FastTrackMatch = runArgs.fastTrackMatch - -if hasattr(Config, "SuperFastTrackMatch"): - Config.SuperFastTrackMatch = runArgs.superFastTrackMatch - -#first and last event to analyse -Config.FirstEvent=SkipEvents -Config.LastEvent=EvtMax - -#number of segments to collect -#Config.NumberOfSegments=20000 - -#maximum number of segments for certain algorithms (e.g. Autocalibration) -Config.AutoLimitSegments = 20000 - -#calibration region -if Config.CalibrationAlgorithm != "RunScan": - Config.CalibrationRegion = runArgs.selectChamber - -#perform a segment refit - not for algorithms likr MTT0, Integration, RunScan.. -Config.SegmentRefit=runArgs.segmentRefit - -#segemtn refit parametersConfig. -Config.RefineT0=runArgs.refineT0 -Config.CurvedSegments= runArgs.curvedSegs -Config.RefitRoadWidth=3.0 -Config.RefitTimeOut=2 -Config.RefitMinSegmentHits=4 -Config.RefitMaxSegmentHits=-1 - -#calibrate with b-field -Config.BFieldCorrection=runArgs.bfieldCorr - -#recalculate second coordinate -Config.Recalc2ndCoordinate = False - -#select calibration input -Config.CalibInputFromDB=runArgs.inputFromDB -Config.CalibInputFromFile=runArgs.inputFromFile - -#select calibration output -Config.CalibOutputToDB=runArgs.outputToDB -Config.CalibOutputToFile=runArgs.outputToFile - -#output calibration directory - set None if you do not want to output to diredctory -Config.CalibDir="calibration" - -#output to database - MP/RM/MI/NONE -Config.CalibDB=CalibSite - -#initial data quality list - suppress Tubes -if Config.CalibrationAlgorithm != "RunScan": - Config.InitialDQList = None - -#if set to true no segment recalibraiton will be done, independent on the tool -Config.SuppressRecalibration=runArgs.suppressRecalibration - - -Config.ApplyTimeSlewingCorrections=runArgs.applyTimeSlewingCorrection - -Config.ApplyRtScaling=runArgs.applyRtScaling - -#=============================================================================== -Config.RPCTimingCorr= False -Config.AutoConfig() -if hasattr(Config, "RpcTiming"): - Config.RpcTiming.OffsetFile = 'rpc_offsets.root' -#=============================================================================== - -#set username and passwd and head_id -if hasattr(Config, "DbIoTool"): - Config.DbIoTool.HeadId=runArgs.headId - -if hasattr(Config, "TrackSecondCoordinateTool"): - Config.TrackSecondCoordinateTool.ControlHistograms = False - -if hasattr(Config, "CalibNtupleLoader"): - Config.CalibNtupleLoader.NtupleType = "NORMAL" -# Config.CalibNtupleLoader.NtupleType = "AUTO" -# Config.CalibNtupleLoader.NtupleType = "REGION" - -#++++++++++++++++++Algoritm specific settings+++++++++++++++++++++++++++++++++++ -#-----------------for MdtDqa ---------------------------------------------- -if Config.CalibrationAlgorithm == "MdtDqa": - #----------- jobOptions for MdtDqaNtupleAnalysis : - Config.CalibrationTool.MdtDqaFileName = runArgs.mdtDqaFile - Config.CalibrationTool.Verbose = False - Config.CalibrationTool.FillHistos = runArgs.fillHistos - Config.CalibrationTool.doFinalize = runArgs.doFinalize - Config.CalibrationTool.doSegHitResidsVsRadius = runArgs.hitResid - Config.CalibrationTool.doTracks = False - Config.CalibrationTool.TrkAuthor = 0 - Config.CalibrationTool.DeadElementsAlgorithm = runArgs.DeadElAlg #0=Toni,1=Marco - Config.CalibrationTool.ADCCUT=runArgs.ADCcut - #----------- jobOptions for MdtDqaTubeEfficiency : - Config.CalibrationTool.doEfficiency = runArgs.doEfficiency - Config.CalibrationTool.EffiNSigma = runArgs.EffNsig - Config.CalibrationTool.EffiChi2Cut = runArgs.EffChiCut - Config.CalibrationTool.EffiUseDefaultResolution = runArgs.EffUseDefRes - Config.CalibrationTool.EffiHitADCCut = 0. - Config.CalibrationTool.EffiGTFitON = runArgs.effiGtf - Config.CalibrationTool.EffiUseNewCalibConstants = runArgs.effiReCal - Config.CalibrationTool.EffiUseTimeCorrections = runArgs.effiTimeCorr - - #----------- jobOptions for MdtDqaGlobalTimeFit : - Config.CalibrationTool.doGlobalTimeFit = runArgs.doGlobalTimeFit - Config.CalibrationTool.rtDefaultBfieldON = 0 - Config.CalibrationTool.GTFitSeg_minNumHits = 5 - Config.CalibrationTool.GTFitSeg_maxNumHits = 10 - Config.CalibrationTool.GTFitSeg_chi2Cut = 15.0 - Config.CalibrationTool.GTFitDebug = False - -#------------------------------------for run scan------------------------------- -if Config.CalibrationAlgorithm == "RunScan": -# CalibNtupleAnalysisAlg.RefitSegments = False - #minimum number of hits per fit - Config.CalibrationTool.MinHits = 10000 - #maximum rate of bad hits per chamber - Config.CalibrationTool.MaxBadFits = 0.9999 - #if set to true ommit output for chambers which are not to be fitted - Config.CalibrationTool.SuppressNofit = True - #san all chambers -# CalibNtupleAnalysisAlg.InitialDQList="NONE" -#------------------------------------for MT t0 fitter--------------------------- -if Config.CalibrationAlgorithm == "MTT0" : - #add fitted function to histogram - Config.CalibrationTool.AddFitFun = True - #create TDirectory contining some debugging graphs - Config.CalibrationTool.DrawDebugGraphs = True - #range of histogram ind 25/32 bins - Config.CalibrationTool.NumberOfNegativeBins = 1000 - Config.CalibrationTool.NumberOfPositiveBins = 3000 - #Fit for group of tubes - # TUBE one spectrum per tube - # LAYER one spectrum per layer - # MULTILAYER one spectrum per multilayer - # CHAMBER one spectrum per chamber - # MEZZ_CARD one spectrum per mezzanine card - if type(Config.CalibrationTool.GroupBy) is list: - fit_by=runArgs.t0FitBy - if fit_by=="AUTO": - fit_by=GetFitBy(runArgs.selectChamber) - Config.CalibrationTool.GroupBy=GetGroupByList(fit_by) - Config.CalibrationTool.ADCGroupBy = GetGroupByList(runArgs.adcFitBy) - Config.CalibrationTool.MinumumEntriesPerTimeFit=10000 - Config.CalibrationTool.MinumumEntriesPerADCFit=1000 - else: - if runArgs.t0FitBy=="AUTO": - Config.CalibrationTool.GroupBy = GetFitBy(runArgs.selectChamber) - else: - Config.CalibrationTool.GroupBy = runArgs.t0FitBy - Config.CalibrationTool.ADCGroupBy = runArgs.adcFitBy - Config.CalibrationTool.UseTopChi2 = True - Config.CalibrationTool.ScrambleThreshold = 2 - Config.CalibrationTool.SclicingThreshold = 3 - -#------------------------------for classic t0 fitter---------------------------- -if Config.CalibrationAlgorithm == "ClassicT0": - CalibNtupleAnalysisAlg.RefitSegments = runArgs.segmentRefit - CalibNtupleAnalysisAlg.RefineT0 = runArgs.refineT0 - #range and binning of adc spectrum - Config.CalibrationTool.NAdcBins = 100 - Config.CalibrationTool.MinAdc = 0.0 - Config.CalibrationTool.MaxAdc = 300.0 - #range and binning of the time spectrum - Config.CalibrationTool.NTimeBins = 1280 - Config.CalibrationTool.TimeMin = 0.0 - Config.CalibrationTool.TimeMax = 2000.0 - #switch on/off fitting of time spectrum - Config.CalibrationTool.FitTimeSpectrum = True - #Minimum number of entries - Config.CalibrationTool.MinEntries = 2000 - #InitParam 1 = automatic search for initial fit parameters - Config.CalibrationTool.InitParam = 1 - #maximum chi^2 - Config.CalibrationTool.MaxChi2 = 10.0 - -#----------------------------for integration method----------------------------- -if Config.CalibrationAlgorithm == "Integration": - #mazimum drift time - Config.CalibrationTool.TMaxInt = 710 - #set to true if close hits are stored in the ntuple - Config.CalibrationTool.HaseCloseHits = False - #the inner radius of the drift tube - Config.CalibrationTool.InnerTubeRadius = 14.6 - #write out default resolution - Config.MdtCalibOutputDbSvc.ForceDefaultResolution = True - #set the lower and upper radius of the parabolic at the end of the r-t - Config.CalibrationTool.LowerExtrapolationRadius = 13.0; - Config.CalibrationTool.UpperExtrapolationRadius = 14.0; - Config.CalibrationTool.StoreMultilayerTmaxDiff = runArgs.applyRtScaling - -# --------------------for classical autocalibration----------------------------- -if Config.CalibrationAlgorithm == "ClassicAutocal" : - #range for the number of hits - Config.CalibrationTool.MinimumNumberOfHits = 5 - Config.CalibrationTool.MaximumNumberOfHits = 10 - #maximum number of iterations - Config.CalibrationTool.NumberOfIterations = 10 - #chi2 cuts - ? - Config.CalibrationTool.Chi2CutVec = [ 50, 40, 30, 20, 10, 10, 10, 5, 5, 5 ] - Config.CalibrationTool.Chi2Cut = 10.0 - - -#-------------------for analytic autocalibration-------------------------------- -if Config.CalibrationAlgorithm == "AnalyticAutocal": - #accuracy of the initial rt relation - Config.CalibrationTool.Accuracy = 2.0 - #type of the correction function LEGENDRE|CHEBYSHEV|POLYGON - Config.CalibrationTool.FunctionType = "LEGENDRE" - #order of the correction function - Config.CalibrationTool.FunctionOrder = 10 - #use the full matrix - ? - Config.CalibrationTool.FullMatrix = True - # fix minimum/maximum - Config.CalibrationTool.FixMin = True # fix r(t0) - Config.CalibrationTool.FixMax = False # do not fix r(tmax) - #maximum number of iterations - Config.CalibrationTool.MaximumIterations = 10 - # split the segments up according the multilayers - Config.CalibrationTool.Split = True - # smoothening using the conventional approach after autocalibration - # WARNING: if Split = True and the whole chamber is selected as calibration - # region, curved segments over the whole chambers are - # fitted in the smoothening procedure which cause no smoothening in - # case of a multilayer as calibration region - Config.CalibrationTool.ConventionalSmoothening = False - # parabolic extrapolation for small and large radii; - # set variable to True for parabolic extrapolation - Config.CalibrationTool.ParabolicExtrapolation = True - # control histograms - Config.CalibrationTool.ControlHistograms=True - -#-------------------for curved autocalibration---------------------------------- -if Config.CalibrationAlgorithm == "CurvedAutocal": - #accuracy of the initial rt relation - Config.CalibrationTool.Accuracy = 2.0 - #type of the correction function LEGENDRE|CHEBYSHEV|POLYGON - Config.CalibrationTool.FunctionType = "LEGENDRE" - #order of the correction function - Config.CalibrationTool.FunctionOrder = 10 - # fix minimum/maximum - Config.CalibrationTool.FixMin = True # fix r(t0) - Config.CalibrationTool.FixMax = False # do not fix r(tmax) - #maximum number of iterations - Config.CalibrationTool.MaximumIterations = 10 - # parabolic extrapolation for small and large radii; - # set variable to True for parabolic extrapolation - Config.CalibrationTool.ParabolicExtrapolation = True - #control histograms - Config.CalibrationTool.ControlHistograms=True - Config.CalibrationTool.MultilayerRtScale = runArgs.applyRtScaling - -#-----------------for simple resolution----------------------------------------- -#--select NumberOfSegments=10000 -#--switch on RefineT0 and use HistFitMethod for commissioning data -if Config.CalibrationAlgorithm == "SimpleResolution": - Config.CalibrationTool.CurvedFit = True #use a curved track fit (set it to true - #for data with magnetic field) -#selection criteria - Config.CalibrationTool.RejectLow = 0.1 #default 0.1 - Config.CalibrationTool.RejectTop = 0.40 #default 0.30 -#convergence - Config.CalibrationTool.DeltaConv = 0.06 #default 0.05 - Config.CalibrationTool.DiffMax = 0.007 #default 0.006 microns - Config.CalibrationTool.MaximumIterations = 20 #default 20 -#Replace initial spatial resoluton with flat one (=0.3mm). Used for validation. - Config.CalibrationTool.InitialFlatResolution = False -#Obtain resolution using histogram fitting. Usefull in case of 'noisy' residuals. - Config.CalibrationTool.HistFitMethod = True -#Remove hits with large residuals (outliers). -# Config.CalibrationTool.SuppressOutliers = True -# Config.CalibrationTool.SuppressionLow = 0.17 -# Config.CalibrationTool.SuppressionTop = 0.17 - Config.CalibrationTool.OutputResolutionFunction = "spr_out.root" - - -#-----------------for RCP Timing------------------------------------------------ -if Config.CalibrationAlgorithm == "RpcTiming": - CalibNtupleAnalysisAlg.RefineT0 = runArgs.refineT0 - #analysis cue - defaults to "MODULE", "DOUBLET", "STATION", "PAIRS", "MEAN", "ALLSPEC" -# Config.CalibrationTool.Cue = [ "MODULE" ] - #output and input file for timing constants - #NONE: do not read/ write file - #AUTO: filename is rpc_timing<run_nr>.txt - Config.CalibrationTool.TimingInfile = "NONE" - Config.CalibrationTool.TimingOutfile = "AUTO" - #automatically select all stations for this analysis - CalibNtupleAnalysisAlg.SelectStation = "ANY" - CalibNtupleAnalysisAlg.SelectEta = 0 - CalibNtupleAnalysisAlg.SelectPhi = -1 - -#-----------------for control histograms---------------------------------------- -if Config.CalibrationAlgorithm == "ControlHistograms": - #name of the ROOT output file - Config.CalibrationTool.ROOTFileName = "NtupleControlHistogramsTool.root" - -#-----------------for MDT chamber geometry determination------------------------ -if Config.CalibrationAlgorithm == "MDTChamberGeometryDetermination": - #write out a ROOT control file - Config.CalibrationTool.writeControlHistograms = True - #name of this ROOT file - Config.CalibrationTool.ROOTFileName = "NtupleMDTChamberGeometryDeterminationTool.root" - #granularity: "TUBE", "LAYER", "MULTILAYER" - Config.CalibrationTool.granularity = "MULTILAYER" - #reference multilayer (1 or 2) - Config.CalibrationTool.referenceMultilayer = 1 - #road width for pattern recognition in mm - #(also used in the misalignment cuts) - Config.CalibrationTool.roadWidth = 2.0 - #geometry file tag for the output of the initial and final geometry - Config.CalibrationTool.geometryFileName = "MDTgeom" - #store gate keys - Config.CalibrationTool.detectorStore = "DetectorStore" - Config.CalibrationTool.MDTIdHelper = "MDTIDHELPER" - Config.CalibrationTool.idToFixedIdToolType = "MuonCalib::IdToFixedIdTool" - Config.CalibrationTool.idToFixedIdToolName = "MuonCalib_IdToFixedIdTool" - -#-----------------for efficiencies---------------------------------------------- -if Config.CalibrationAlgorithm == "Efficiency": - Config.CalibrationTool.nSegmentHits = 5 - Config.CalibrationTool.roadWidth = 2.0 - Config.CalibrationTool.fileName = "TubeEfficiencies" - Config.CalibrationTool.Debug = False - Config.CalibrationTool.Chi2Cut = 10 - Config.CalibrationTool.excludeLayer = False - -#-----------------for display--------------------------------------------------- -if Config.CalibrationAlgorithm == "Display": - Config.CalibrationTool.nSegmentHits = 5 - Config.CalibrationTool.roadWidth = 2.0 - Config.CalibrationTool.adcCut = CalibNtupleAnalysisAlg.RawdataAdcCut - #Config.CalibrationTool.displayEvent = 123 - #Config.CalibrationTool.scaleDisplay = 0.5 - -#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++### Setup Athena common flags -if Config.CalibrationAlgorithm == "Splitter": - levels={"NONE":0, "NAME":1, "NAME_PHI":2, "NAME_PHI_ETA":3} - if runArgs.splitterStoreTracks: - Config.CalibrationTool.FillTrackAuthors = [-1] - if hasattr(Config, "RegionSelection"): - if hasattr(Config.RegionSelection, "TrackAutors"): - if len(Config.RegionSelection.TrackAutors): - Config.CalibrationTool.FillTrackAuthors = Config.RegionSelection.TrackAutors - if hasattr(Config.RegionSelection, "MomentumCut"): - Config.CalibrationTool.TrackPCut = Config.RegionSelection.MomentumCut - Config.CalibrationTool.FileSplitLevel =levels[runArgs.splitterFileSplitLevel] - Config.CalibrationTool.NtupleSplitLevel =levels[runArgs.splitterNtupleSplitLevel] - Config.CalibrationTool.FilenamePrefix="OutNtuple" - Config.CalibrationTool.MaxPatterns=200000 - Config.CalibrationTool.StoreTruth=False - Config.CalibrationTool.StoreMdtRawdata=runArgs.splitterStoreRaw - Config.CalibrationTool.StoreRpcRawdata=runArgs.splitterStoreRaw - Config.CalibrationTool.StoreTgcRawdata=runArgs.splitterStoreRaw - Config.CalibrationTool.TriggerForSegmentStationOnly=True - Config.CalibrationTool.AdcCut=runArgs.splitterADCCut - from MuonCalibStandAloneTools.MuonCalibStandAloneToolsConf import MuonCalib__NtupleRunScanTool - Config.CalibrationTool2 = MuonCalib__NtupleRunScanTool() - ToolSvc += Config.CalibrationTool2 - Config.CalibrationTool2.MinHits = 10000 - #maximum rate of bad hits per chamber - Config.CalibrationTool2.MaxBadFits = 0.9999 - #if set to true ommit output for chambers which are not to be fitted - Config.CalibrationTool2.SuppressNofit = True - Config.CalibrationTool.ToolToRun=Config.CalibrationTool2 -printfunc (AlgSequence()) -printfunc (ToolSvc) -printfunc (ServiceMgr) -from ROOT import gROOT, TCanvas, TF1 -theApp.EvtMax = 1 diff --git a/MuonSpectrometer/MuonCalib/MuonCalibJobTransforms/share/skeleton.mdt_calib_ntuple.py b/MuonSpectrometer/MuonCalib/MuonCalibJobTransforms/share/skeleton.mdt_calib_ntuple.py deleted file mode 100644 index f918325b833af999846632f30a7e7c45334f170c..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibJobTransforms/share/skeleton.mdt_calib_ntuple.py +++ /dev/null @@ -1,216 +0,0 @@ -# get the logger - -from RecExConfig.RecFlags import rec as recFlags -recFlags.doFloatingPointException.set_Value_and_Lock(False) - -from AthenaCommon.Logging import * -mdtCalibNtuplelog = logging.getLogger('mdtCalibNtuple') - -mdtCalibNtuplelog.info('************** STARTING MDT CalibNtuple **************') -#============================================================== -# Job definition parameters: -#============================================================== -EvtMax = runArgs.maxEvents -SkipEvents = runArgs.skipEvents -InputFiles = runArgs.inputBSFile -RunNumber = runArgs.runNumber -NtupleFile = runArgs.ntupleFile -doSim = runArgs.doSim -geover = runArgs.geometryVersion -#new params to be implemented -globalTag = runArgs.conditionsTag -useAlign = runArgs.useAlign -dbT0Tag = runArgs.dbT0Tag -dbRTTag = runArgs.dbRTTag -dbT0Sql = runArgs.dbT0Sql -dbRTSql = runArgs.dbRTSql -segOnly = runArgs.segOnly -moore = runArgs.moore -mboy = runArgs.mboy -standalone = runArgs.standalone -doCSC = runArgs.doCSC -rawTgc = runArgs.rawTgc -cosmicRun = runArgs.cosmicRun -doSegmentT0Fit = runArgs.doSegmentT0Fit or cosmicRun -lumiBlockNumberFromCool = runArgs.lumiBlockNumberFromCool -runNumberFromCool = runArgs.runNumberFromCool - -if geover.find('NF') >=0: - field=False -else: - field=True - -mdtCalibNtuplelog.info( '**** Transformation run arguments ****' ) -mdtCalibNtuplelog.info( str(runArgs) ) - -#============================================================== -# Job Configuration parameters: -#============================================================== -from MuonCalibJobTransforms.MDTCalibNtupleConfig import mdtCalibNtupleConfig -for cf in runArgs.jobConfig: - include(cf) -mdtCalibNtuplelog.info( '**** Transformation configuration arguments ****' ) -mdtCalibNtuplelog.info( str(mdtCalibNtupleConfig) ) - -#============================================================== -# Job options file for MDT Calib Ntuple creation -#============================================================== - - -# ####################################################################### -# TopOptions to process calibration stream -# ####################################################################### - -from AthenaCommon.BeamFlags import jobproperties -from AthenaCommon.GlobalFlags import globalflags - - -globalflags.DatabaseInstance.set_Value_and_Lock('CONDBR2') #Fabrizio -globalflags.DataSource.set_Value_and_Lock('data') -if globalflags.DataSource() == 'data': - if cosmicRun: - jobproperties.Beam.beamType.set_Value_and_Lock("cosmics") - globalflags.DetGeo.set_Value_and_Lock('commis') - else: - globalflags.DetGeo.set_Value_and_Lock('atlas') - globalflags.DetDescrVersion.set_Value_and_Lock(geover) - recFlags.doTruth.set_Value_and_Lock(False) - -from AthenaCommon.BFieldFlags import jobproperties -if field: - jobproperties.BField.solenoidOn.set_Value_and_Lock(True) - jobproperties.BField.barrelToroidOn.set_Value_and_Lock(True) - jobproperties.BField.endcapToroidOn.set_Value_and_Lock(True) -else: - jobproperties.BField.solenoidOn.set_Value_and_Lock(False) - jobproperties.BField.barrelToroidOn.set_Value_and_Lock(False) - jobproperties.BField.endcapToroidOn.set_Value_and_Lock(False) - - -from AthenaCommon.AlgSequence import AlgSequence -from RecExConfig.RecFlags import rec #Ben (avoid Run1, COMP200 selection) -rec.projectName="calb15_um" #Ben -from MuonRecExample import MuonRecStandaloneFlags -from MuonRecExample import MuonRecStandaloneOnlySetup -from MuonRecExample.MuonRecFlags import muonRecFlags -from AthenaCommon.DetFlags import DetFlags - -from AthenaCommon.AthenaCommonFlags import athenaCommonFlags -athenaCommonFlags.PoolRDOInput.set_Value_and_Lock([]) -athenaCommonFlags.RuntimeStrictness.set_Value_and_Lock("none") - -# Run on CSC data or not -muonRecFlags.doCSCs=doCSC - -globalflags.ConditionsTag.set_Value_and_Lock(globalTag)##### SET VIA COMMAND LINE IN THE TRF -from IOVDbSvc.CondDB import conddb -if globalflags.ConditionsTag(): - conddb.setGlobalTag(globalflags.ConditionsTag()) -printfunc (globalflags) -DetFlags.Calo_setOff() -DetFlags.TRT_setOff() -DetFlags.ID_setOff() -from AtlasGeoModel import SetGeometryVersion -from AtlasGeoModel import GeoModelInit - -# Run Moore -muonRecFlags.doMoore = moore #### SET VIA COMMAND LINE IN THE TRF -# Run Muonboy -#muonRecFlags.doMuonboy = (mboy or standalone) #### SET VIA COMMAND LINE IN THE TRF -muonRecFlags.doMuonboy = mboy -#NOTE: In 17.2 the 3rd chain cannot run w/o muonboy. -#turn on/off track reconstruction -muonRecFlags.doSegmentsOnly = segOnly #### SET VIA COMMAND LINE IN THE TRF -muonRecFlags.doStandalone = standalone #3rd chain - - -# for MDT calibration constants -muonRecFlags.dataPeriod.set_Value_and_Lock('LHC') - -# Switch on the alignment corrections -muonRecFlags.useAlignmentCorrections = useAlign##### SET VIA COMMAND LINE IN THE TRF - -# calibration ntuple -muonRecFlags.doCalib = False -muonRecFlags.doCalibNtuple = True -muonRecFlags.calibNtupleOutput=NtupleFile ##### SET VIA COMMAND LINE IN THE TRF -muonRecFlags.calibNtupleSegments = True -muonRecFlags.calibNtupleTracks = True -muonRecFlags.calibNtupleRawTGC = rawTgc ##### SET VIA COMMAND LINE IN THE TRF - -# Switch off the T0 fit (on by default for data) -#muonRecFlags.doSegmentT0Fit = False -muonRecFlags.doSegmentT0Fit = doSegmentT0Fit - -topSequence = AlgSequence() -if muonRecFlags.doMDTs: - DetFlags.makeRIO.MDT_setOff() -if muonRecFlags.doRPCs: - DetFlags.makeRIO.RPC_setOn() -if muonRecFlags.doTGCs: - DetFlags.makeRIO.TGC_setOn() - -#Set up new cabling. -from MuonMDT_Cabling.MuonMDT_CablingConf import MuonMDT_CablingSvc -#svcMgr += MuonMDT_CablingSvc(name="MuonMDT_CablingSvc", false , false) -#svcMgr.MuonMDT_CablingSvc.doCalStreamInit=True -svcMgr += MuonMDT_CablingSvc(name="MuonMDT_CablingSvc", UseOldCabling=False, ForcedUse=False, doCalStreamInit=True) -#svcMgr.MuonMDT_CablingSvc.doCalStreamInit=True -printfunc ('skeleton: setting doCalStreamInit true') - -include("MuonRecExample/MuonRDO_to_PRD_jobOptions.py") - -# to alter DB options -#overwriting the tag -if dbT0Tag!='DEFAULT': - if dbT0Sql!='DEFAULT': - conddb.blockFolder("/MDT/T0BLOB") - conddb.addFolder(dbT0Sql,"/MDT/T0BLOB <tag>"+dbT0Tag+"</tag>",True) - else: - conddb.addOverride("/MDT/T0BLOB",dbT0Tag) -if dbRTTag!='DEFAULT': - if dbRTSql!='DEFAULT': - conddb.blockFolder("/MDT/RTBLOB") - conddb.addFolder(dbRTSql,"/MDT/RTBLOB <tag>"+dbRTTag+"</tag>",True) - else: - conddb.addOverride("/MDT/RTBLOB",dbRTTag) - -include ("MuonCalibStreamCnvSvc/MuonCalibStream_jobOptions.py") -theApp.EvtMax = EvtMax ##### SET VIA COMMAND LINE IN THE TRF -EventSelectorMuonCalibStream.SkipEvents=SkipEvents ##### SET VIA COMMAND LINE IN THE TRF -svcMgr.MuonCalibStreamDataProviderSvc.RunNumber=RunNumber ##### SET VIA COMMAND LINE IN THE TRF -svcMgr.MuonCalibStreamFileInputSvc.InputFiles = InputFiles ##### SET VIA COMMAND LINE IN THE TRF - -svcMgr.MuonCalibStreamDataProviderSvc.LumiBlockNumberFromCool=lumiBlockNumberFromCool -svcMgr.MuonCalibStreamDataProviderSvc.RunNumberFromCool=runNumberFromCool - -printfunc (topSequence) - -# obselete -#include ("BFieldAth/BFieldAth_jobOptions.py") -import MagFieldServices.SetupField - -# lock all flags. Very important! -muonRecFlags.lock_JobProperties() - -# Enable conversion of old eventInfo to xAOD eventInfo (Dongliang) -from xAODEventInfoCnv.xAODEventInfoCnvConf import xAODMaker__EventInfoCnvAlg -topSequence += xAODMaker__EventInfoCnvAlg('EventInfoCnvAlg') -topSequence.EventInfoCnvAlg.AODKey='MuonCalibStreamEventInfo' - -include ("MuonRecExample/MuonRec_jobOptions.py") -try: - ToolSvc.CscSegmentUtilTool.Add2hitSegments = True -except AttributeError: - pass - -#ToolSvc.CscSegmentUtilTool.OutputLevel = VERBOSE -#ToolSvc.MooTrackSteering.DumpCombinatorics = True -svcMgr += CfgMgr.MessageSvc( Format = "% F%50W%S%7W%R%T %0W%M", - defaultLimit=1000000, OutputLevel =INFO) - -#if not mboy and not segOnly and hasattr(topSequence.MuonCalibExtraTreeAlg, "Track2MELocation"): -# topSequence.MuonCalibExtraTreeAlg.Track2MELocation="" - -from AthenaCommon.ConfigurationShelve import saveToAscii -saveToAscii("config.txt") diff --git a/MuonSpectrometer/MuonCalib/MuonCalibJobTransforms/share/skeleton.mdt_calib_ntuple_tf.py b/MuonSpectrometer/MuonCalib/MuonCalibJobTransforms/share/skeleton.mdt_calib_ntuple_tf.py deleted file mode 100644 index 88b004cf0dcfb24fd76ae26a4d9fdb73e21b86aa..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibJobTransforms/share/skeleton.mdt_calib_ntuple_tf.py +++ /dev/null @@ -1,226 +0,0 @@ -from RecExConfig.RecFlags import rec as recFlags -recFlags.doFloatingPointException.set_Value_and_Lock(False) - -# get the logger -import logging -mdtCalibNtuplelog = logging.getLogger('mdt_calib_ntuple') -mdtCalibNtuplelog.info('************** STARTING MDTCalibNtuple **************') -mdtCalibNtuplelog.info( '**** Transformation run arguments ****' ) -mdtCalibNtuplelog.info( str(runArgs) ) - -#============================================================== -# Job definition parameters: -#============================================================== -# Set defaults for boolean variables in runArgs -# Boolean variables do not exist in runArgs if they are not on the command line -# so check if they exist before using them -#doSim = runArgs.doSim #Never used so skip it -useAlign = True -# If segOnly = True ntuple has no variables filled which is pointless -#segOnly = False -#moore = False -#mboy = False -# If standalone = False all ntuple variables are filled with zeros which is pointless -#standalone = True -doSegmentT0Fit = False -doCSC = True -rawTgc = False -cosmicRun = False -lumiBlockNumberFromCool = False -runNumberFromCool = False - -if hasattr(runArgs,'useAlign'): - useAlign = runArgs.useAlign -#if hasattr(runArgs,'segOnly'): -# segOnly = runArgs.segOnly -#if hasattr(runArgs,'moore'): -# moore = runArgs.moore -#if hasattr(runArgs,'nboy'): -# mboy = runArgs.mboy -#if hasattr(runArgs,'standalone'): -# standalone = runArgs.standalone -if hasattr(runArgs,'doCSC'): - doCSC = runArgs.doCSC -if hasattr(runArgs,'rawTgc'): - rawTgc = runArgs.rawTgc -if hasattr(runArgs,'cosmicRun'): - cosmicRun = runArgs.cosmicRun -if hasattr(runArgs,'doSegmentT0Fit'): - doSegmentT0Fit = runArgs.doSegmentT0Fit or cosmicRun -if hasattr(runArgs,'lumiBlockNumberFromCool'): - lumiBlockNumberFromCool = runArgs.lumiBlockNumberFromCool -if hasattr(runArgs,'runNumberFromCool'): - runNumberFromCool = runArgs.runNumberFromCool - -#============================================================== -# Job Configuration parameters: -#============================================================== -from MuonCalibJobTransforms.MDTCalibNtupleConfig import mdtCalibNtupleConfig -# hardcode UseOracle.py which enables use of Frontier DB replicas. -# As far as I can see you always want to do this. -include("RecJobTransforms/UseOracle.py") -# UseOracle.py used to be loaded here via be commandline argument -#for cf in runArgs.jobConfig: -# include(cf) -mdtCalibNtuplelog.info( '**** Transformation configuration arguments ****' ) -mdtCalibNtuplelog.info( str(mdtCalibNtupleConfig) ) - -#============================================================== -# Job options file for MDT Calib Ntuple creation -#============================================================== - -from AthenaCommon.BeamFlags import jobproperties -from AthenaCommon.GlobalFlags import globalflags - -globalflags.DataSource.set_Value_and_Lock('data') -# This if is sort of silly since 'data' is the only option. -if globalflags.DataSource() == 'data': - if cosmicRun: - jobproperties.Beam.beamType.set_Value_and_Lock("cosmics") - globalflags.DetGeo.set_Value_and_Lock('commis') - else: - globalflags.DetGeo.set_Value_and_Lock('atlas') - globalflags.DetDescrVersion.set_Value_and_Lock(runArgs.geometryVersion) - recFlags.doTruth.set_Value_and_Lock(False) - -# Check if Bfield is on -from AthenaCommon.BFieldFlags import jobproperties -if runArgs.geometryVersion.find('NF') >=0: #no field - jobproperties.BField.solenoidOn.set_Value_and_Lock(False) - jobproperties.BField.barrelToroidOn.set_Value_and_Lock(False) - jobproperties.BField.endcapToroidOn.set_Value_and_Lock(False) -else: - jobproperties.BField.solenoidOn.set_Value_and_Lock(True) - jobproperties.BField.barrelToroidOn.set_Value_and_Lock(True) - jobproperties.BField.endcapToroidOn.set_Value_and_Lock(True) - -# CONDBR2 (Run2 COOL instance) will be selected by default -# If processing Run1 calibstream force COMP200 selection by setting -# a project name which has the digits "12" so Athena knows this is Run1 -if runArgs.runNumber < 220000: #Run1 - from RecExConfig.RecFlags import rec - rec.projectName="calb12_um" #Force Run1, COMP200 selection -from MuonRecExample import MuonRecStandaloneFlags -from MuonRecExample import MuonRecStandaloneOnlySetup -from MuonRecExample.MuonRecFlags import muonRecFlags -from AthenaCommon.DetFlags import DetFlags - -from AthenaCommon.AthenaCommonFlags import athenaCommonFlags -athenaCommonFlags.PoolRDOInput.set_Value_and_Lock([]) -athenaCommonFlags.RuntimeStrictness.set_Value_and_Lock("none") - -# Run on CSC data or not (why would you not want to?) -muonRecFlags.doCSCs=doCSC - -# Add rawTgc and rawTgcCoin branches to calib ntuple -muonRecFlags.calibNtupleRawTGC = rawTgc - -globalflags.ConditionsTag.set_Value_and_Lock(runArgs.conditionsTag) -from IOVDbSvc.CondDB import conddb -if globalflags.ConditionsTag(): - conddb.setGlobalTag(globalflags.ConditionsTag()) -printfunc (globalflags) - -# Turn off detectors which are not present in calibstream -DetFlags.Calo_setOff() -DetFlags.TRT_setOff() -DetFlags.ID_setOff() - -from AtlasGeoModel import SetGeometryVersion -from AtlasGeoModel import GeoModelInit - -# No longer needed, standalone is the only option set True by default. -# ntuple variables will be filled with zero's if it is set False -# Run Moore -#muonRecFlags.doMoore = moore #### SET VIA COMMAND LINE IN THE TRF -# Run Muonboy -#muonRecFlags.doMuonboy = (mboy or standalone) #### SET VIA COMMAND LINE IN THE TRF -#muonRecFlags.doMuonboy = mboy -#NOTE: In 17.2 the 3rd chain cannot run w/o muonboy. -#turn on/off track reconstruction -#muonRecFlags.doSegmentsOnly = segOnly #### SET VIA COMMAND LINE IN THE TRF -#muonRecFlags.doStandalone = standalone #3rd chain - -# for MDT calibration constants -muonRecFlags.dataPeriod.set_Value_and_Lock('LHC') - -# Switch for alignment corrections (on by default) -muonRecFlags.useAlignmentCorrections = useAlign - -# calibration ntuple -muonRecFlags.doCalib = False -muonRecFlags.doCalibNtuple = True -muonRecFlags.calibNtupleOutput = runArgs.ntupleFile -muonRecFlags.calibNtupleSegments = True -muonRecFlags.calibNtupleTracks = True - -# Switch for T0 segment fit (on by default) -muonRecFlags.doSegmentT0Fit = doSegmentT0Fit - -from AthenaCommon.AlgSequence import AlgSequence -topSequence = AlgSequence() -if muonRecFlags.doMDTs: - DetFlags.makeRIO.MDT_setOff() -if muonRecFlags.doRPCs: - DetFlags.makeRIO.RPC_setOn() -if muonRecFlags.doTGCs: - DetFlags.makeRIO.TGC_setOn() - -#Set up cabling which is different for Run1/Run2. -from MuonMDT_Cabling.MuonMDT_CablingConf import MuonMDT_CablingSvc -if runArgs.runNumber > 220000: #Run2 - svcMgr += MuonMDT_CablingSvc(name="MuonMDT_CablingSvc", UseOldCabling=False, ForcedUse=False, doCalStreamInit=True) -else: - svcMgr += MuonMDT_CablingSvc(name="MuonMDT_CablingSvc", UseOldCabling=True, ForcedUse=False, doCalStreamInit=True) - -include("MuonRecExample/MuonRDO_to_PRD_jobOptions.py") - -# Options to select tag for T0/RT or to read from SQLite files. -# If reading from SQLite, you must specify the tag used in the SQLite file -if runArgs.dbT0Tag!='DEFAULT': - if runArgs.dbT0Sql!='DEFAULT': - conddb.blockFolder("/MDT/T0BLOB") - conddb.addFolder(runArgs.dbT0Sql,"/MDT/T0BLOB <tag>"+runArgs.dbT0Tag+"</tag>",True) - else: - conddb.addOverride("/MDT/T0BLOB",runArgs.dbT0Tag) -if runArgs.dbRTTag!='DEFAULT': - if runArgs.dbRTSql!='DEFAULT': - conddb.blockFolder("/MDT/RTBLOB") - conddb.addFolder(runArgs.dbRTSql,"/MDT/RTBLOB <tag>"+runArgs.dbRTTag+"</tag>",True) - else: - conddb.addOverride("/MDT/RTBLOB",runArgs.dbRTTag) - -# This code disables the ordinary Athena event loop and installs the calibstream event loop -include ("MuonCalibStreamCnvSvc/MuonCalibStream_jobOptions.py") - -theApp.EvtMax = runArgs.Events -EventSelectorMuonCalibStream.SkipEvents = runArgs.Skip -svcMgr.MuonCalibStreamDataProviderSvc.RunNumber = runArgs.runNumber -svcMgr.MuonCalibStreamFileInputSvc.InputFiles = runArgs.inputCSFiles - -svcMgr.MuonCalibStreamDataProviderSvc.LumiBlockNumberFromCool = lumiBlockNumberFromCool -svcMgr.MuonCalibStreamDataProviderSvc.RunNumberFromCool = runNumberFromCool - -printfunc (topSequence) - -import MagFieldServices.SetupField - -# lock all flags. Very important! -muonRecFlags.lock_JobProperties() - -# Enable conversion of old eventInfo to xAOD eventInfo (Dongliang) -from xAODEventInfoCnv.xAODEventInfoCnvConf import xAODMaker__EventInfoCnvAlg -topSequence += xAODMaker__EventInfoCnvAlg('EventInfoCnvAlg') -topSequence.EventInfoCnvAlg.AODKey='MuonCalibStreamEventInfo' - -include ("MuonRecExample/MuonRec_jobOptions.py") -try: - ToolSvc.CscSegmentUtilTool.Add2hitSegments = True -except AttributeError: - pass - -svcMgr += CfgMgr.MessageSvc( Format = "% F%50W%S%7W%R%T %0W%M", - defaultLimit=1000000, OutputLevel =INFO) - -from AthenaCommon.ConfigurationShelve import saveToAscii -saveToAscii("config.txt") diff --git a/MuonSpectrometer/MuonCalib/MuonCalibJobTransforms/share/skeleton.mdt_calib_validate.py b/MuonSpectrometer/MuonCalib/MuonCalibJobTransforms/share/skeleton.mdt_calib_validate.py deleted file mode 100644 index 615724890cf1b94eb10fdfd098274994fa71d127..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibJobTransforms/share/skeleton.mdt_calib_validate.py +++ /dev/null @@ -1,113 +0,0 @@ -# get the logger -from AthenaCommon.Logging import * -mdtCalibFitlog = logging.getLogger('mdtCalibFit') - -mdtCalibFitlog.info('************** STARTING MDT CalibFit !!!!**************') -#============================================================== -# Job definition parameters: -#============================================================== -CalibSite = runArgs.calibSite -geover = runArgs.geometryVersion -mdtCalibFitlog.info( '**** Transformation run arguments ****' ) -#mdtCalibFitlog.info( str(runArgs) ) - -#============================================================== -# Job Configuration parameters: -#============================================================== -from MuonCalibJobTransforms.MDTCalibFitConfig import mdtCalibFitConfig -#for cf in runArgs.jobConfig: -# include(cf) -mdtCalibFitlog.info( '**** Transformation configuration arguments ****' ) -mdtCalibFitlog.info( str(mdtCalibFitConfig) ) - -### Setup Athena common flags -#include ("AthenaCommon/AthenaCommonFlags.py") -#include.block("AthenaCommon/AthenaCommonFlags.py") - -#include( "IOVDbSvc/IOVRecExCommon.py" ) - -#load atlas geometry -from AthenaCommon.GlobalFlags import globalflags -#GlobalFlags.DetGeo.set_atlas() -#GlobalFlags.DataSource.set_data() -#GlobalFlags.Print() -globalflags.DetGeo.set_Value_and_Lock('atlas') -ToolSvc = Service( "ToolSvc" ) -globalflags.DataSource.set_Value_and_Lock('data') - -from AthenaCommon.DetFlags import DetFlags -DetFlags.detdescr.Muon_setOn() -DetFlags.detdescr.ID_setOff() -DetFlags.detdescr.LAr_setOff() -DetFlags.detdescr.Tile_setOff() -DetFlags.Print() -#Set geometry tag -from AtlasGeoModel import SetGeometryVersion, GeoModelInit -GeoModelSvc = ServiceMgr.GeoModelSvc -GeoModelSvc.AtlasVersion = geover - -from AthenaCommon.AppMgr import ServiceMgr -from AthenaCommon.AppMgr import ToolSvc - -from MdtCalibValidation.MdtCalibValidationConf import MuonCalib__MdtValidationAlg -MdtValidationAlg = MuonCalib__MdtValidationAlg() - -from AthenaCommon.AlgSequence import AlgSequence -topSequence = AlgSequence() -topSequence += MdtValidationAlg - -theApp.EvtMax = 1 - -from MuonCalibStandAloneBase.MuonCalibStandAloneBaseConf import RegionSelectionSvc -RegionSelectionSvc = RegionSelectionSvc() -RegionSelectionSvc.PrintList = True -ServiceMgr += RegionSelectionSvc -#RegionSelectionSvc.Region = "[BIL,4,6]" -RegionSelectionSvc.Region = runArgs.selectChamber - -MdtValidationAlg.SiteName=CalibSite -if (CalibSite == "MP"): -# MPI - MdtValidationAlg.ConnectionString = "oracle://oracle01.mppmu.mpg.de/ATLMPI.mppmu.mpg.de/atlas_muoncalib_mpi" - MdtValidationAlg.WorkingSchema = "atlas_muoncalib_mpi" -elif (CalibSite == "MP_NEW"): -# MPI - MdtValidationAlg.ConnectionString = "oracle://oracle01.mppmu.mpg.de/ATLMPI.mppmu.mpg.de/ATLAS_MUONCALIB_READER" - MdtValidationAlg.WorkingSchema = "ATLAS_MUONCALIB_MPI_META" - MdtValidationAlg.WriterConnectionString = "oracle://oracle01.mppmu.mpg.de/ATLMPI.mppmu.mpg.de/ATLAS_MUONCALIB_WRITER" -elif (CalibSite == "MI"): -# Michigan - VlidationAlgalidationAlg.ConnectionString = "oracle://umors.grid.umich.edu/muoncal.grid.umich.edu/atlas_muoncalib_mich" - MdtValidationAlg.WorkingSchema = "atlas_muoncalib_mich" -elif (CalibSite == "MI_NEW"): -# Michigan - MdtValidationAlg.ConnectionString = "oracle://umors.grid.umich.edu/muoncal.grid.umich.edu/ATLAS_MUONCALIB_READER" - MdtValidationAlg.WorkingSchema = "ATLAS_MUONCALIB_UMICH" - MdtValidationAlg.WriterConnectionString = "oracle://umors.grid.umich.edu/muoncal.grid.umich.edu/ATLAS_MUONCALIB_WRITER" -elif (CalibSite == "RM"): -# ROMA - MdtValidationAlg.ConnectionString = "oracle://atlas-oracle-01.roma1.infn.it/atlrome.roma1.infn.it/atlas_muoncalib_rome" - MdtValidationAlg.WorkingSchema = "atlas_muoncalib_rome" -elif (CalibSite == "RM_NEW"): -# ROMA - MdtValidationAlg.ConnectionString = "oracle://atlas-cluster.cr.cnaf.infn.it:1521/atlcnafsrv.cr.cnaf.infn.it/ATLAS_MUONCALIB_READER" - MdtValidationAlg.WorkingSchema = "ATLAS_MUONCALIB_RM_META" - MdtValidationAlg.WriterConnectionString = "oracle://atlas-cluster.cr.cnaf.infn.it:1521/atlcnafsrv.cr.cnaf.infn.it/ATLAS_MUONCALIB_WRITER" - -MdtValidationAlg.GetLimits = 0 -MdtValidationAlg.MinSlope = 1. -MdtValidationAlg.MaxSlope = 5 -# Run2 Values -MdtValidationAlg.MinT0 = -100 -MdtValidationAlg.MaxT0 = 400 -#MdtValidationAlg.MinT0 = 190 -#MdtValidationAlg.MaxT0 = 850 -MdtValidationAlg.HeadId = runArgs.headId -#MdtValidationAlg.GetLimits = runArgs.getLimits - -#MdtValidationAlg.ValidationTask = "RtVal" -#MdtValidationAlg.ValidationTask = "T0Val" -MdtValidationAlg.ValidationTask = runArgs.calibrationAlgorithm - -if mdtCalibFitConfig.postOptions is not None: - include(mdtCalibFitConfig.postOptions) diff --git a/MuonSpectrometer/MuonCalib/MuonCalibJobTransforms/share/skeleton.rpc_calib_ntuple.py b/MuonSpectrometer/MuonCalib/MuonCalibJobTransforms/share/skeleton.rpc_calib_ntuple.py deleted file mode 100644 index 14754fe3117f7c92fc591796cef284a8afc371f0..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibJobTransforms/share/skeleton.rpc_calib_ntuple.py +++ /dev/null @@ -1,279 +0,0 @@ -# get the logger -from AthenaCommon.Logging import * -rpcCalibNtuplelog = logging.getLogger('rpcCalibNtuple') - -rpcCalibNtuplelog.info('************** STARTING RPC CalibNtuple **************') -#============================================================== -# Job definition parameters: -#============================================================== -EvtMax = runArgs.maxEvents -SkipEvents = runArgs.skipEvents -InputFiles = runArgs.inputBSFile -RunNumber = runArgs.runNumber -NtupleFile = runArgs.ntupleFile -FieldMask = runArgs.fieldMask -condTag = runArgs.conditionsTag -trignt = runArgs.trigNtuple -resnt = runArgs.resNtuple -prdnt = runArgs.prdNtuple -extrnt = runArgs.extrNtuple -recoalg = runArgs.recoAlg - -GeoVersion=runArgs.geometryVersion - -rpcCalibNtuplelog.info( '**** Transformation run arguments ****' ) -rpcCalibNtuplelog.info( str(runArgs) ) - -from RecExConfig.RecFlags import rec as recFlags -recFlags.doFloatingPointException.set_Value_and_Lock(False) - - -#============================================================== -# Job Configuration parameters: -#============================================================== - -include("RecJobTransforms/UseOracle.py") - - -from MuonCalibJobTransforms.RPCCalibNtupleConfig import rpcCalibNtupleConfig -for cf in runArgs.jobConfig: - include(cf) -rpcCalibNtuplelog.info( '**** Transformation configuration arguments ****' ) -rpcCalibNtuplelog.info( str(rpcCalibNtupleConfig) ) - -rpcClusterTimeSpread=rpcCalibNtupleConfig.clusterTimeSpread - -from AthenaCommon.AthenaCommonFlags import athenaCommonFlags -from AthenaCommon.BeamFlags import jobproperties -from AthenaCommon.GlobalFlags import globalflags -from AthenaCommon.BFieldFlags import jobproperties -from AthenaCommon.AlgSequence import AlgSequence -from AthenaCommon.DetFlags import DetFlags -from AthenaCommon.AppMgr import ServiceMgr as svcMgr -from AthenaCommon.AppMgr import ToolSvc - -from RecExConfig.RecFlags import rec -from RecExConfig.RecConfFlags import recConfFlags - -# in Standalone mode, don't allow any configuration errors -athenaCommonFlags.AllowIgnoreConfigError = False - -# For Trigger MBTS and L1 Calo we need the Tile Calorimeter -# the algorithm: MuonCalibExtraTreeTriggerAlg stores trigger info -#DetFlags.makeRIO.Calo_setOn() - -#DetFlags.detdescr.LVL1_setOn() -#DetFlags.readRDOBS.LVL1_setOn() - -#DetFlags.Calo_setOff() - -# Max number of events to run, number of events to skip -#athenaCommonFlags.EvtMax.set_Value_and_Lock(EvtMax) -#athenaCommonFlags.SkipEvents.set_Value_and_Lock(0) - -theApp.EvtMax = EvtMax - -# input BS file -athenaCommonFlags.PoolRDOInput.set_Value_and_Lock([]) -athenaCommonFlags.RuntimeStrictness.set_Value_and_Lock("none") - -# Set properly beam type, DataSource, InputFormat, Detector Description, Conditions Tag -globalflags.DataSource.set_Value_and_Lock('data') -globalflags.DetGeo.set_Value_and_Lock('commis') -globalflags.DetDescrVersion.set_Value_and_Lock(GeoVersion) -globalflags.ConditionsTag.set_Value_and_Lock(condTag) - -# field ++++ uncomment if you want to set them by hand +++++ -fieldFlag=[bool(int(FieldMask[0])),bool(int(FieldMask[1])),bool(int(FieldMask[2]))] - -jobproperties.BField.solenoidOn.set_Value_and_Lock(fieldFlag[0]) -jobproperties.BField.barrelToroidOn.set_Value_and_Lock(fieldFlag[1]) -jobproperties.BField.endcapToroidOn.set_Value_and_Lock(fieldFlag[2]) - -from MuonRecExample import MuonRecStandaloneFlags -from MuonRecExample import MuonRecStandaloneOnlySetup -from MuonRecExample.MuonRecFlags import muonRecFlags -from AthenaCommon.DetFlags import DetFlags - -from IOVDbSvc.CondDB import conddb -if globalflags.ConditionsTag(): - conddb.setGlobalTag(globalflags.ConditionsTag()) - - -from AtlasGeoModel import SetGeometryVersion -from AtlasGeoModel import GeoModelInit - - -topSequence = AlgSequence() - - -##################################################### - -# Start at formation of PRDs only -#muonRecFlags.Enabled = False - -# Disable MDTs +++ set to True also to permit the track reconstruction algos to run +++ -muonRecFlags.doMDTs=True - -# Disable RPCs -muonRecFlags.doRPCs=True - -# Disable TGCs -muonRecFlags.doTGCs=False - -# Run on CSC data or not -muonRecFlags.doCSCs.set_Value_and_Lock(False) - -muonRecFlags.doCalib.set_Value_and_Lock(False) - -muonRecFlags.doCalibNtuple.set_Value_and_Lock(False) - -# Stop Muonboy at segment level -#muonboyFlags.doSegmentsOnly = False - -# Stop Moore at segment level -#mooreFlags.doSegmentsOnly = False - -muonRecFlags.doSegmentsOnly = False - -muonRecFlags.dataPeriod.set_Value_and_Lock('LHC') - -if(trignt or prdnt): - muonRecFlags.doRPCs = True - -if recoalg=='Moore': - # Run Moore - muonRecFlags.doMoore = True -else: - muonRecFlags.doMoore = False - -if recoalg=='MuonBoy': - # Run Muonboy - muonRecFlags.doMuonboy = True -else: - muonRecFlags.doMuonboy = False - - -if muonRecFlags.doMDTs: - DetFlags.makeRIO.MDT_setOff() -if muonRecFlags.doRPCs: - DetFlags.makeRIO.RPC_setOn() -if muonRecFlags.doTGCs: - DetFlags.makeRIO.TGC_setOn() - - -# for MDT calibration constants -muonRecFlags.dataPeriod.set_Value_and_Lock('LHC') - -include("MuonRecExample/MuonRDO_to_PRD_jobOptions.py") - - -############ -## specific tuning for calib stream -############ - -include ("MuonCalibStreamCnvSvc/MuonCalibStream_jobOptions.py") -svcMgr.MuonCalibStreamDataProviderSvc.RunNumber=RunNumber -svcMgr.MuonCalibStreamFileInputSvc.InputFiles = InputFiles ##### SET VIA COMMAND LINE IN THE TRF -EventSelectorMuonCalibStream.SkipEvents=SkipEvents - -include ("BFieldAth/BFieldAth_jobOptions.py") - -# lock all flags. Very important! -muonRecFlags.lock_JobProperties() - -#rec.readRDO.set_Value_and_Lock(False) - - -### General Reco flags jobproperties -#from RecExConfig.RecFlags import rec -## -### no truth when running on data -#rec.doTruth = False -# -#rec.doMuon=True -# -## -### Switch Perfmon studies -#rec.doPerfMon = False -#rec.doDetailedPerfMon = False -#rec.doNameAuditor = False -# -# -#muonRecFlags.lock_JobProperties() -#rec.lock_JobProperties() -# -include ("MuonRecExample/MuonRec_jobOptions.py") - -include("MuonRecExample/MuonCBNT_jobOptions.py") - - -#include ("RecExCommon/RecExCommon_topOptions.py") - -#from CBNT_Athena.CBNT_AthenaConf import CBNT_AthenaAware -#topSequence += CBNT_AthenaAware() - -THistSvc = CfgMgr.THistSvc() -ServiceMgr += THistSvc -outputString="AANT DATAFILE=\'"+NtupleFile+"\' OPT=\'RECREATE\'" -THistSvc.Output = [outputString] - -try: - topSequence.AANTupleStream.OutputName=NtupleFile - -except AttributeError: - topSequence += CfgMgr.AANTupleStream(ExtraRefNames = [ "" ], - OutputName = NtupleFile, - ExistDataHeader = False ) - - -# activate RPC-specific ntuples - -if(extrnt): - include('RpcCalibAlgs/RpcExtrapolNtuple_jobOptions.py' ) - -if(resnt): - include('RpcCalibAlgs/RpcResidualsNtuple_jobOptions.py') - if recoalg=='Moore': - topSequence.CBNT_AthenaAware.RpcResidualsNtuple.TrackCollection = "MooreTracks" - -if(prdnt): - - topSequence.CBNT_AthenaAware.RpcPrepRawDataNtuple.Hit=True - topSequence.CBNT_AthenaAware.RpcPrepRawDataNtuple.Enable=True -else: - try: - topSequence.CBNT_AthenaAware.RpcPrepRawDataNtuple.Enable=False - except AttributeError: - pass - -if(trignt): - include('MuonCalibJobTransforms/rpc_trigNtuple.py') -else: - try: - topSequence.CBNT_AthenaAware.RpcRawDataNtuple.Enable=False - except AttributeError: - pass -try: - topSequence.CBNT_AthenaAware.MdtPrepRawDataNtuple.Enable=False -except AttributeError: - pass -try: - topSequence.CBNT_AthenaAware.MdtRawDataNtuple.Enable=False -except AttributeError: - pass -try: - topSequence.CBNT_AthenaAware.CBNTAA_Muon.Enable=False -except AttributeError: - pass -try: - topSequence.CBNT_AthenaAware.CBNTAA_Audit.Enable=False -except AttributeError: - pass -try: - topSequence.CBNT_AthenaAware.RpcRawDataNtuple.Enable=False -except AttributeError: - pass - -ServiceMgr.MessageSvc.infoLimit=10000000 -#ServiceMgr.MessageSvc.OutputLevel = DEBUG diff --git a/MuonSpectrometer/MuonCalib/MuonCalibJobTransforms/share/skeleton.rpc_calib_ntuple_ESD.py b/MuonSpectrometer/MuonCalib/MuonCalibJobTransforms/share/skeleton.rpc_calib_ntuple_ESD.py deleted file mode 100644 index 09577664447eeeb30f32ba4f7f7c04c724e71036..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibJobTransforms/share/skeleton.rpc_calib_ntuple_ESD.py +++ /dev/null @@ -1,165 +0,0 @@ -# get the logger -from AthenaCommon.Logging import * -rpcCalibNtuplelog = logging.getLogger('rpcCalibNtuple') - -rpcCalibNtuplelog.info('************** STARTING RPC CalibNtuple **************') -#============================================================== -# Job definition parameters: -#============================================================== - -EvtMax = runArgs.maxEvents -SkipEvents = runArgs.skipEvents -InputFiles = runArgs.inputESDFile -RunNumber = runArgs.runNumber -NtupleFile = runArgs.ntupleFile -FieldMask = runArgs.fieldMask -condTag = runArgs.conditionsTag -trignt = runArgs.trigNtuple -resnt = runArgs.resNtuple -prdnt = runArgs.prdNtuple -extrnt = runArgs.extrNtuple -recoalg = runArgs.recoAlg - -GeoVersion=runArgs.geometryVersion -rpcCalibNtuplelog.info( '**** Transformation run arguments ****' ) -rpcCalibNtuplelog.info( str(runArgs) ) - -#============================================================== -# Job Configuration parameters: -#============================================================== -from MuonCalibJobTransforms.RPCCalibNtupleConfig import rpcCalibNtupleConfig -for cf in runArgs.jobConfig: - include(cf) -rpcCalibNtuplelog.info( '**** Transformation configuration arguments ****' ) -rpcCalibNtuplelog.info( str(rpcCalibNtupleConfig) ) - -rpcClusterTimeSpread=rpcCalibNtupleConfig.clusterTimeSpread -doSim=rpcCalibNtupleConfig.doSim - - - -from AthenaCommon.AlgSequence import AlgSequence -from RecExConfig.RecFlags import rec -from AthenaCommon.BeamFlags import jobproperties -from AthenaCommon.AthenaCommonFlags import athenaCommonFlags -from AthenaCommon.GlobalFlags import globalflags -from AthenaCommon.BFieldFlags import jobproperties - - - -from AthenaCommon.DetFlags import DetFlags - -topSequence = AlgSequence() - -##################### -## common/global config -##################### - - -DetFlags.detdescr.Muon_setOn() -DetFlags.detdescr.ID_setOn() -DetFlags.detdescr.LAr_setOff() -DetFlags.detdescr.Tile_setOff() -DetFlags.Print() - -#Minimally required flags for commissioning -#include("RecExCommission/MinimalCommissioningSetup.py") - -athenaCommonFlags.PoolESDInput.set_Value_and_Lock(InputFiles) -athenaCommonFlags.SkipEvents.set_Value_and_Lock(SkipEvents) -athenaCommonFlags.EvtMax.set_Value_and_Lock(EvtMax) - -globalflags.DetDescrVersion.set_Value_and_Lock(GeoVersion) -globalflags.ConditionsTag.set_Value_and_Lock(condTag) - -# field -fieldFlag=[bool(int(FieldMask[0])),bool(int(FieldMask[1])),bool(int(FieldMask[2]))] - -jobproperties.BField.solenoidOn.set_Value_and_Lock(fieldFlag[0]) -jobproperties.BField.barrelToroidOn.set_Value_and_Lock(fieldFlag[1]) -jobproperties.BField.endcapToroidOn.set_Value_and_Lock(fieldFlag[2]) - - -##################### -## rec config -##################### - -rec.doJetMissingETTag.set_Value_and_Lock(False) -from JetRec.JetRecFlags import jetFlags -jetFlags.Enabled.set_Value_and_Lock(False) -from RecExConfig.RecAlgsFlags import recAlgs -recAlgs.doMissingET.set_Value_and_Lock(False) -rec.doTau.set_Value_and_Lock(False) -recAlgs.doMuonSpShower.set_Value_and_Lock(False) - -rec.doHist.set_Value_and_Lock(False) -# don't want CBNT from RecExCommon. Will config it ourselves -rec.doCBNT.set_Value_and_Lock(False) -rec.doWriteTAGCOM.set_Value_and_Lock(False) -rec.doWriteTAG.set_Value_and_Lock(False) -rec.doWriteAOD.set_Value_and_Lock(False) -rec.doAOD.set_Value_and_Lock(False) -rec.doMonitoring.set_Value_and_Lock(False) - -rec.readESD.set_Value_and_Lock(True) -rec.doESD.set_Value_and_Lock(False) -rec.doWriteESD.set_Value_and_Lock(False) -globalflags.InputFormat.set_Value_and_Lock('pool') - -################### -## specific config -################### - -# add RPC clusterization at the beginning - -from RpcClusterization.RpcClusterizationConf import RpcClusterBuilderPRD -topSequence+=RpcClusterBuilderPRD(ClusterTimeSpread = 10000, OutputLevel = FATAL) - -#-------------------------------------------------------------- -# ntuple config -#-------------------------------------------------------------- -theApp.HistogramPersistency = "ROOT" - -THistSvc = CfgMgr.THistSvc() -ServiceMgr += THistSvc -outputString="AANT DATAFILE=\'"+NtupleFile+"\' OPT=\'RECREATE\'" -THistSvc.Output = [outputString] -topSequence += CfgMgr.AANTupleStream(ExtraRefNames = [ "" ], - OutputName = NtupleFile, - ExistDataHeader = False ) - -include( "CBNT_Athena/CBNT_AthenaAware_jobOptions.py" ) -include( "CBNT_Athena/CBNT_EventInfo_jobOptions.py" ) -from CBNT_Athena.CBNT_AthenaConf import CBNTAA_Audit -CBNT_AthenaAware += CBNTAA_Audit() - -# activate RPC-specific ntuples - -if(extrnt): - include('RpcCalibAlgs/RpcExtrapolNtuple_jobOptions.py' ) - -if(resnt): - include('RpcCalibAlgs/RpcResidualsNtuple_jobOptions.py') - if recoalg=='Moore': - CBNT_AthenaAware.RpcResidualsNtuple.TrackCollection = "MooreTracks" -if(prdnt): - - CBNT_AthenaAware.RpcPrepRawDataNtuple.Hit=False - CBNT_AthenaAware.RpcPrepRawDataNtuple.Enable=True -else: - try: - CBNT_AthenaAware.RpcPrepRawDataNtuple.Enable=False - except AttributeError: - pass - - -#load muon rec tools -include ("MuonRecExample/MuonRecLoadTools.py") - - -# the main jobOpt -include("RecExCommission/RecExCommission.py") - -include ("RecExCommon/RecExCommon_topOptions.py") - - diff --git a/MuonSpectrometer/MuonCalib/MuonCalibJobTransforms/share/skeleton.rpc_calib_ntuple_fullStream.py b/MuonSpectrometer/MuonCalib/MuonCalibJobTransforms/share/skeleton.rpc_calib_ntuple_fullStream.py deleted file mode 100644 index 42c9ed92adc7161f74b95818e59f0d57a8dacd06..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibJobTransforms/share/skeleton.rpc_calib_ntuple_fullStream.py +++ /dev/null @@ -1,213 +0,0 @@ -# get the logger -from AthenaCommon.Logging import * -rpcCalibNtuplelog = logging.getLogger('rpcCalibNtuple') - -rpcCalibNtuplelog.info('************** STARTING RPC CalibNtuple **************') -#============================================================== -# Job definition parameters: -#============================================================== -EvtMax = runArgs.maxEvents -SkipEvents = runArgs.skipEvents -InputFiles = runArgs.inputBSFile -RunNumber = runArgs.runNumber -NtupleFile = runArgs.ntupleFile -FieldMask = runArgs.fieldMask -condTag = runArgs.conditionsTag -trignt = runArgs.trigNtuple -resnt = runArgs.resNtuple -prdnt = runArgs.prdNtuple -extrnt = runArgs.extrNtuple -recoalg = runArgs.recoAlg - -GeoVersion=runArgs.geometryVersion - -rpcCalibNtuplelog.info( '**** Transformation run arguments ****' ) -rpcCalibNtuplelog.info( str(runArgs) ) - -#============================================================== -# Job Configuration parameters: -#============================================================== -from MuonCalibJobTransforms.RPCCalibNtupleConfig import rpcCalibNtupleConfig -for cf in runArgs.jobConfig: - include(cf) -rpcCalibNtuplelog.info( '**** Transformation configuration arguments ****' ) -rpcCalibNtuplelog.info( str(rpcCalibNtupleConfig) ) - -rpcClusterTimeSpread=rpcCalibNtupleConfig.clusterTimeSpread - -from AthenaCommon.AlgSequence import AlgSequence -from AthenaCommon.AppMgr import ToolSvc,ServiceMgr -from AthenaCommon import CfgMgr - -from AthenaCommon.AthenaCommonFlags import athenaCommonFlags -from AthenaCommon.BeamFlags import jobproperties -from AthenaCommon.GlobalFlags import globalflags -from AthenaCommon.BFieldFlags import jobproperties -from AthenaCommon.AlgSequence import AlgSequence -from AthenaCommon.DetFlags import DetFlags - -from RecExConfig.RecFlags import rec as recFlags - -from MuonRecExample.MuonCBNTFlags import muonCBNT -from MuonRecExample.MuonRecFlags import muonRecFlags -from MuonCalibAlgs.MuonCalibFlags import muonCalibFlags - -from MuonRecExample import MuonRecStandaloneOnlySetup - -topSequence = AlgSequence() - - -##################### -## common/global config -##################### - -# For Trigger MBTS and L1 Calo we need the Tile Calorimeter -# the algorithm: MuonCalibExtraTreeTriggerAlg stores trigger info -DetFlags.makeRIO.Calo_setOn() -DetFlags.detdescr.LVL1_setOn() -DetFlags.readRDOBS.LVL1_setOn() - -# Max number of events to run, number of events to skip -athenaCommonFlags.EvtMax.set_Value_and_Lock(EvtMax) -athenaCommonFlags.SkipEvents.set_Value_and_Lock(SkipEvents) - -athenaCommonFlags.BSRDOInput.set_Value_and_Lock(InputFiles) - -globalflags.DataSource.set_Value_and_Lock('data') -jobproperties.Beam.beamType.set_Value_and_Lock("cosmics") -globalflags.InputFormat.set_Value_and_Lock('bytestream') -globalflags.DetDescrVersion.set_Value_and_Lock(GeoVersion) -globalflags.ConditionsTag.set_Value_and_Lock(condTag) - -# field -fieldFlag=[bool(int(FieldMask[0])),bool(int(FieldMask[1])),bool(int(FieldMask[2]))] - -jobproperties.BField.solenoidOn.set_Value_and_Lock(fieldFlag[0]) -jobproperties.BField.barrelToroidOn.set_Value_and_Lock(fieldFlag[1]) -jobproperties.BField.endcapToroidOn.set_Value_and_Lock(fieldFlag[2]) - -############################ -## muon specific -############################ - -# we want tracks, not just segments -muonRecFlags.doSegmentsOnly = False - -################################################################################ -# Set your user flags here -################################################################################ - -muonCBNT.doMdtRaw = False -muonCBNT.doRpcRaw = False -muonCBNT.doCscRaw = False -muonCBNT.doTgcRaw = False -muonCBNT.doMuonboy = False -muonCBNT.doMoore = False - -if(trignt or prdnt): - muonCBNT.doRpcRaw = True - -if recoalg=='Moore': - # Run Moore - muonRecFlags.doMoore = True -else: - muonRecFlags.doMoore = False - -if recoalg=='MuonBoy': - # Run Muonboy - muonRecFlags.doMuonboy = True -else: - muonRecFlags.doMuonboy = False - -# Run on CSC data or not -muonRecFlags.doCSCs=False - -# Switch on the alignment corrections -muonRecFlags.useAlignmentCorrections = True -muonRecFlags.doCalib = False - -recFlags.doTruth = False - -#rec.doCBNT = True -recFlags.doESD.set_Value_and_Lock( False ) -recFlags.doWriteESD.set_Value_and_Lock( False ) -recFlags.Commissioning = True - -from GeoModelSvc.GeoModelSvcConf import GeoModelSvc -GeoModelSvc = GeoModelSvc() -GeoModelSvc.MuonVersionOverride = "MuonSpectrometer-R.03.02.Initial.Light.BML.S13.Patch" - -# the following two lines are needed to remove annoying file ESD.pool.root -include("RecExCommission/RecExCommissionFlags_jobOptions.py") -ATLASCosmicFlags.doFilteredESD=False - -recFlags.lock_JobProperties() -muonRecFlags.lock_JobProperties() - - -# The main jobOption file -include("RecExCommission/RecExCommission.py") -include ("RecExCommon/RecExCommon_topOptions.py") - -# Tune RPC clusterization - -CfgMgr.RpcClusterBuilderPRD.ClusterTimeSpread = 10000 -CfgMgr.RpcClusterBuilderPRD.OutputLevel = FATAL - -##-------------------------------------------------------------- -## Ntuple configuration -##-------------------------------------------------------------- -#theApp.HistogramPersistency = "ROOT" -# -THistSvc = CfgMgr.THistSvc() -ServiceMgr += THistSvc -outputString="AANT DATAFILE=\'"+NtupleFile+"\' OPT=\'RECREATE\'" -THistSvc.Output = [outputString] - -try: - topSequence.AANTupleStream.OutputName=NtupleFile - -except AttributeError: - topSequence += CfgMgr.AANTupleStream(ExtraRefNames = [ "" ], - OutputName = NtupleFile, - ExistDataHeader = False ) - -# activate RPC-specific ntuples - -if(extrnt): - include('RpcCalibAlgs/RpcExtrapolNtuple_jobOptions.py' ) - -if(resnt): - include('RpcCalibAlgs/RpcResidualsNtuple_jobOptions.py') - if recoalg=='Moore': - CBNT_AthenaAware.RpcResidualsNtuple.TrackCollection = "MooreTracks" -if(prdnt): - - CBNT_AthenaAware.RpcPrepRawDataNtuple.Hit=False - CBNT_AthenaAware.RpcPrepRawDataNtuple.Enable=True -else: - try: - CBNT_AthenaAware.RpcPrepRawDataNtuple.Enable=False - except AttributeError: - pass - -if(trignt): - include('MuonCalibJobTransforms/rpc_trigNtuple.py') -else: - try: - CBNT_AthenaAware.RpcRawDataNtuple.Enable=False - except AttributeError: - pass - -#CBNT_AthenaAware.TgcRawDataNtuple.Enable=False -#CBNT_AthenaAware.RpcRawDataNtuple.Enable=False -#CBNT_AthenaAware.MdtRawDataNtuple.Enable=False -#CBNT_AthenaAware.MdtPrepRawDataNtuple.Enable=False -#CBNT_AthenaAware.RpcPrepRawDataNtuple.Enable=True -#CBNT_AthenaAware.RpcPrepRawDataNtuple.Hit=False -#CBNT_AthenaAware.CBNTAA_Muon.Enable=True -#CBNT_AthenaAware.MuonMakeTrackNtuple.Enable=False -#CBNT_AthenaAware.MuonMakeSegmentNtuple.Enable=False - -#if(resnt): -# topSequence.AANTupleStream.FilterAlgs+=['RpcResidualsNtuple/RpcResidualsNtuple'] diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/CMakeLists.txt b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/CMakeLists.txt deleted file mode 100644 index 0f364468ef86a6970f2ca1af02506b32a0e8dc94..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/CMakeLists.txt +++ /dev/null @@ -1,61 +0,0 @@ -################################################################################ -# Package: CalibNtupleAnalysisAlg -################################################################################ - -# Declare the package name: -atlas_subdir( CalibNtupleAnalysisAlg ) - -# Declare the package's dependencies: -atlas_depends_on_subdirs( PUBLIC - Control/AthenaBaseComps - DataQuality/GoodRunsLists - DetectorDescription/GeoPrimitives - GaudiKernel - MagneticField/MagFieldElements - MagneticField/MagFieldConditions - MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibData - MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MdtCalibIOSvc - MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneBase - MuonSpectrometer/MuonIdHelpers - PRIVATE - Control/StoreGate - DetectorDescription/GeoModel/GeoModelInterfaces - Event/EventInfo - MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibFitters - MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibRt - MuonSpectrometer/MuonCalib/MuonCalibEventBase - MuonSpectrometer/MuonCalib/MuonCalibITools - MuonSpectrometer/MuonCalib/MuonCalibIdentifier - MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleReader - MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry ) - -# External dependencies: -find_package( CLHEP ) -find_package( CORAL COMPONENTS CoralBase CoralKernel RelationalAccess ) -find_package( Eigen ) -find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread ) - -# Component(s) in the package: -atlas_add_library( CalibNtupleAnalysisAlgLib - src/*.cxx - PUBLIC_HEADERS CalibNtupleAnalysisAlg - INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} - PRIVATE_INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CORAL_INCLUDE_DIRS} - DEFINITIONS ${CLHEP_DEFINITIONS} - LINK_LIBRARIES ${CLHEP_LIBRARIES} ${EIGEN_LIBRARIES} AthenaBaseComps GeoPrimitives GaudiKernel MagFieldElements MagFieldConditions MdtCalibData GoodRunsListsLib MdtCalibIOSvcLib MuonCalibStandAloneBaseLib MuonIdHelpersLib StoreGateLib SGtests - PRIVATE_LINK_LIBRARIES ${ROOT_LIBRARIES} ${CORAL_LIBRARIES} EventInfo MdtCalibFitters MdtCalibRt MuonCalibEventBase MuonCalibITools MuonCalibIdentifier CalibNtupleReader MuonReadoutGeometry ) - -atlas_add_component( CalibNtupleAnalysisAlg - src/components/*.cxx - INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CORAL_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} ${CORAL_LIBRARIES} ${CLHEP_LIBRARIES} ${EIGEN_LIBRARIES} AthenaBaseComps GoodRunsListsLib GeoPrimitives GaudiKernel MagFieldElements MagFieldConditions MdtCalibData MdtCalibIOSvcLib MuonCalibStandAloneBaseLib MuonIdHelpersLib StoreGateLib SGtests EventInfo MdtCalibFitters MdtCalibRt MuonCalibEventBase MuonCalibITools MuonCalibIdentifier CalibNtupleReader MuonReadoutGeometry CalibNtupleAnalysisAlgLib ) - -atlas_add_dictionary( CalibNtupleAnalysisAlgDict - CalibNtupleAnalysisAlg/GeoDraw.h - CalibNtupleAnalysisAlg/selection.xml - INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CORAL_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} ${CORAL_LIBRARIES} ${CLHEP_LIBRARIES} ${EIGEN_LIBRARIES} AthenaBaseComps GoodRunsListsLib GeoPrimitives GaudiKernel MagFieldElements MagFieldConditions MdtCalibData MdtCalibIOSvcLib MuonCalibStandAloneBaseLib MuonIdHelpersLib StoreGateLib SGtests EventInfo MdtCalibFitters MdtCalibRt MuonCalibEventBase MuonCalibITools MuonCalibIdentifier CalibNtupleReader MuonReadoutGeometry CalibNtupleAnalysisAlgLib ) - -# Install files from the package: -atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) -atlas_install_joboptions( share/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} --extend-ignore=F401,F821 ) diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/CalibNtupleAnalysisAlg/ApplyRawTimes.h b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/CalibNtupleAnalysisAlg/ApplyRawTimes.h deleted file mode 100644 index c44bae8dac0b3d1abde4a86c9e32d694c22ff722..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/CalibNtupleAnalysisAlg/ApplyRawTimes.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef MuonCalib_ApplyRawTimes_H -#define MuonCalib_ApplyRawTimes_H - -//Gaudi -#include "GaudiKernel/ServiceHandle.h" -#include "AthenaBaseComps/AthAlgTool.h" - -//MuonCalibStandAloneBase -#include "MuonCalibStandAloneBase/CalibSegmentPreparationTool.h" - -class RegionSelectionSvc; - -namespace MuonCalib { -class IIdToFixedIdTool; - -class ApplyRawTimes : public AthAlgTool, virtual public CalibSegmentPreparationTool { - public: -//=========================constructor========================================== - ApplyRawTimes(const std::string &t, const std::string &n, const IInterface *p); - inline ~ApplyRawTimes()=default; -//=========================public member functions============================== - StatusCode initialize(void); - //load event - void prepareSegments(const MuonCalibEvent *&event, std::map<NtupleStationId, MuonCalibSegment *> &segments); - private: -//=========================private data========================================= - //! pointer to regino selectin service - ServiceHandle<RegionSelectionSvc> m_reg_sel_svc; - -}; - -}//namespace MuonCalib -#endif diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/CalibNtupleAnalysisAlg/BFieldCorrectionUpdateTool.h b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/CalibNtupleAnalysisAlg/BFieldCorrectionUpdateTool.h deleted file mode 100644 index b9b7242debb5f6d5bf7c2129a9263dbf4827a625..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/CalibNtupleAnalysisAlg/BFieldCorrectionUpdateTool.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef MuonCalib_BFieldCorrectionUpdateToolH -#define MuonCalib_BFieldCorrectionUpdateToolH - -//:::::::::::::::::::::::::::::::::::::: -//:: CLASS BFieldCorrectionUpdateTool :: -//:::::::::::::::::::::::::::::::::::::: - -/// \class BFieldCorrectionUpdateTool -/// -/// This class can be used to add the Lorentz angle effect to simulated drift -/// times for Monte-Carlo data without the Lorentz angle effect. The main -/// purpose of this class is to test the Lorentz angle correction in combination -/// with calibration algorithms. -/// -/// \author Oliver.Kortner@CERN.CH -/// -/// \date 02.02.2009 - -//:::::::::::::::::: -//:: HEADER FILES :: -//:::::::::::::::::: - - -// MuonCalib // -#include "MuonCalibStandAloneBase/CalibSegmentPreparationTool.h" -#include "MdtCalibData/BFieldCorFunc.h" -#include "AthenaBaseComps/AthAlgTool.h" - -namespace MuonCalib { - -class BFieldCorrectionUpdateTool : public AthAlgTool, virtual public CalibSegmentPreparationTool { - public: - // Constructor // - BFieldCorrectionUpdateTool(const std::string &t, const std::string &n, const IInterface *p); - ///< Constructor of the tool. - - ~BFieldCorrectionUpdateTool()=default; - ///< Destructor of the tool. - -// Methods // -// methods required by the base classes // - StatusCode initialize(void); - - void prepareSegments( - const MuonCalibEvent *& /*event*/, - std::map<NtupleStationId, MuonCalibSegment *> &segments); - ///< Method to add the Lorentz effect to the - ///< measured drift times. - - private: - std::string m_rt_file_name; // name of the r-t files to be used for the - // B field correction - IRtRelation *m_rt; // pointer to the reference r-t relationship at B=0 - BFieldCorFunc *m_corr_func; // pointer to the B field correction function - - bool initialize_BFieldCorFunc(void); // method to initialize the Lorentz angle correction - -}; - -} //namespace MuonCalib -#endif diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/CalibNtupleAnalysisAlg/BarrelSecondCoordinatePreparationTool.h b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/CalibNtupleAnalysisAlg/BarrelSecondCoordinatePreparationTool.h deleted file mode 100644 index 8c7d1564b58a77f67dc94240ea0e0a686737400f..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/CalibNtupleAnalysisAlg/BarrelSecondCoordinatePreparationTool.h +++ /dev/null @@ -1,88 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef MuonCalib_BarrelSecondCoordinatePreparationToolH -#define MuonCalib_BarrelSecondCoordinatePreparationToolH - -//::::::::::::::::::::::::::::::::::::::::::::::::: -//:: CLASS BarrelSecondCoordinatePreparationTool :: -//::::::::::::::::::::::::::::::::::::::::::::::::: - -/// \class BarrelSecondCoordinatePreparationTool -/// -/// This class can be used to recalculate the second coordinates of MDT hits -/// using raw RPC hits. It is limited to the application to barrel MDT chambers. -/// -/// \author Oliver.Kortner@CERN.CH -/// -/// \date 23.01.2009 - -//:::::::::::::::::: -//:: HEADER FILES :: -//:::::::::::::::::: - -// MuonCalib // -#include "MuonCalibStandAloneBase/CalibSegmentPreparationTool.h" -#include "AthenaBaseComps/AthAlgTool.h" -#include "MuonReadoutGeometry/MuonDetectorManager.h" - -// AtlasCore // -// AtlasConditions // - -//CLHEP -#include "CLHEP/Matrix/Matrix.h" -#include "CLHEP/Matrix/Vector.h" - -namespace MuonCalib { - -class IIdToFixedIdTool; -class MuonCalibRawRpcHit; -class BarrelSecondCoordinatePreparationTool : public AthAlgTool, virtual public CalibSegmentPreparationTool { - - public: -// Constructor // - BarrelSecondCoordinatePreparationTool(const std::string &t, - const std::string &n, const IInterface *p); - -// Destructor // - ~BarrelSecondCoordinatePreparationTool()=default; - -// Methods // -// methods required by the base classes // - StatusCode initialize(void); - ///< initialization of the tools - StatusCode finalize(void); - ///< finalization of the tool - void prepareSegments( const MuonCalibEvent *&event, std::map<NtupleStationId, MuonCalibSegment *> &segments); - ///< Method to calculate the second coordinate of - ///< MDT hits in the barrel based on RPC hits. - ///< \param event Current event (contains raw hits - ///< and other useful objects). - ///> \param segments Vector of segments to be - ///> prepared. - - bool handleRPChits(MuonCalibSegment &MDT_segment, std::vector<MuonCalibRawRpcHit *> &raw_hits); - - int rpcFit(std::vector<CLHEP::HepVector> &RPC_hits, std::vector<int> in_sect, - std::vector<int> num_same, double max_r, CLHEP::HepVector &tr_par, double &angle_err); - - private: - - // MuonDetectorManager from the conditions store - SG::ReadCondHandleKey<MuonGM::MuonDetectorManager> m_DetectorManagerKey {this, "DetectorManagerKey", - "MuonDetectorManager", - "Key of input MuonDetectorManager condition data"}; - - const MuonCalib::IIdToFixedIdTool *m_id_tool; // identifier converter - - FILE* m_rpcHitsFile; //File to store RPC entries - bool m_write_rpc_hits; - -// RPCTrackAssociator m_RPC_track_associator; // tool for the determination of - // the second coordinates of MDT hits - -}; - -} //namespace MuonCalib -#endif diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/CalibNtupleAnalysisAlg/CalibNtupleAnalysisAlg2.h b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/CalibNtupleAnalysisAlg/CalibNtupleAnalysisAlg2.h deleted file mode 100644 index 02727eb795f5932878e8429e73f5e815b605c994..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/CalibNtupleAnalysisAlg/CalibNtupleAnalysisAlg2.h +++ /dev/null @@ -1,70 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef _CALIBRATIONNTUPLEANALYSISALG2_H -#define _CALIBRATIONNTUPLEANALYSISALG2_H - -// c - c++ -#include "string" - -//athena -#include "AthenaBaseComps/AthAlgorithm.h" -#include "GaudiKernel/ToolHandle.h" -#include "GaudiKernel/ServiceHandle.h" - -//MuonCalibStandAloneBase -#include "MuonCalibStandAloneBase/CalibSegmentPreparationTool.h" -#include "MdtCalibIOSvc/MdtCalibInputSvc.h" - -// segment preparation tools - -class MdtCalibOutputDbSvc; -/** -@class CalibNtupleAnalysis -Port of the calibration_programme as an Athena Algorithm -Read calibration N-tuples and performs the calibration of the MDT chambers -*/ - -class MdtCalibInputSvc; -class RegionSelectionSvc; - -namespace MuonCalib { -class NtupleCalibrationTool; - -class CalibNtupleAnalysisAlg2 : public AthAlgorithm { -//=========================================== - public: -/** Algorithm Constructor */ - CalibNtupleAnalysisAlg2(const std::string &name, ISvcLocator *pSvcLocator); -/** Algorithm destrucrtor*/ - ~CalibNtupleAnalysisAlg2(); -/** Is called at the beginning of the analysis */ - StatusCode initialize(); -/** execute function NOTE: This will read all events at once*/ - StatusCode execute(); -/** finalize functions */ - StatusCode finalize(); -//============================================ - private: -//! segment preparation tools - ToolHandleArray<CalibSegmentPreparationTool> m_seg_prep_tool_handles; - ToolHandle<NtupleCalibrationTool> m_calib_tool_handle; -//! number of segments to process - int m_num_segments; -//!output db service - ServiceHandle<MdtCalibOutputDbSvc> m_dbservice; -//! calibration input service - ServiceHandle<MdtCalibInputSvc> m_calib_input_svc; -//! Calibration tool - NtupleCalibrationTool *p_calib_tool; -//! Crash job, if no segments are read - bool m_crash_if_no_segments; -//! stored segments - std::vector<MuonCalibSegment *> m_stored_segment; -//!internal event counter - int m_eventnumber; -}; - -} //namespace MuonCalib -#endif diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/CalibNtupleAnalysisAlg/CalibNtupleLoader.h b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/CalibNtupleAnalysisAlg/CalibNtupleLoader.h deleted file mode 100644 index 167300a84b7397845c57864bbe2cd954b87576f8..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/CalibNtupleAnalysisAlg/CalibNtupleLoader.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef MuonCalib_CalibNtupleLoader_h -#define MuonCalib_CalibNtupleLoader_h - -//Gaudi -#include "AthenaBaseComps/AthAlgTool.h" -#include "GaudiKernel/ServiceHandle.h" - -//MuonCalibStandAloneBase -#include "MuonCalibStandAloneBase/CalibSegmentPreparationTool.h" - -//c - c++ -#include "string" - -class RegionSelectionSvc; -class IIncidentSvc ; -class TChain; - -namespace MuonCalib { - -class NTReader; - -//load events from CalibrationNtuple - -class CalibNtupleLoader: public AthAlgTool, virtual public CalibSegmentPreparationTool { - public: -//=========================constructor========================================== - CalibNtupleLoader(const std::string &t, const std::string &n, const IInterface *p); - ~CalibNtupleLoader()=default; -//=========================public member functions============================== - StatusCode initialize(void); - //load event - void prepareSegments(const MuonCalibEvent *&event, std::map<NtupleStationId, MuonCalibSegment *> &segments); - private: -//=========================private data========================================= - //!path to the file list - job option - std::string m_filelist; - //! type of ntuple - AUTO/NORMAL/REGION - - //! NOTE: Do not use auto if you are directly reading ntuples from - //! castor or dcache. In this case all files have to be opened at initialisation. - std::string m_ntuple_type; - int m_ntuple_type_num; - //! skip double events (event numbers) - job options - bool m_skip_double_events; - //!prev event number - int m_prev_event_nr; - //! prev run number - unsigned int m_prev_run_nr ; - - //! first event - jobOption - int m_first; - //! last event - jobOption - int m_last; - //! ntuple reader - NTReader *m_reader; - //! pointer to region selection service - ServiceHandle<RegionSelectionSvc> m_reg_sel_svc; - //! ntuple chain - TChain *m_chain; - - //! pointer to IncidentSvc to fire Incidents for IOV changes - ServiceHandle<IIncidentSvc> m_incSvc ; - inline StatusCode read_dictionary(std::istream &fl, int &tot_count); - -}; - -} //namespace MuonCalib -#endif diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/CalibNtupleAnalysisAlg/GeoDraw.h b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/CalibNtupleAnalysisAlg/GeoDraw.h deleted file mode 100644 index 414271f407065073f348d92485825bfc483b3eaf..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/CalibNtupleAnalysisAlg/GeoDraw.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef MuonCalib__GeoDraw_h -#define MuonCalib__GeoDraw_h - -#include "map" - -namespace MuonCalib { - -class GeoDraw_Data; - -class GeoDraw { - public: - static void Load(const char *filename); - - static double PosX(unsigned int tube_id); - static double PosY(unsigned int tube_id); - static double PosZ(unsigned int tube_id); - - static double GPosX(unsigned int tube_id); - static double GPosY(unsigned int tube_id); - static double GPosZ(unsigned int tube_id); - - static double LocalToGlobalX(unsigned int id, double x, double y, double z); - static double LocalToGlobalY(unsigned int id, double x, double y, double z); - static double LocalToGlobalZ(unsigned int id, double x, double y, double z); - - static double GlobalToLocalX(unsigned int id, double x, double y, double z); - static double GlobalToLocalY(unsigned int id, double x, double y, double z); - static double GlobalToLocalZ(unsigned int id, double x, double y, double z); - - private: - static GeoDraw_Data *s_data; -}; - -} //namespace MuonCalib -#endif diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/CalibNtupleAnalysisAlg/GoodRunListFilter.h b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/CalibNtupleAnalysisAlg/GoodRunListFilter.h deleted file mode 100644 index 78686c6c332db7a62ed7c000079b322d3cda730e..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/CalibNtupleAnalysisAlg/GoodRunListFilter.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef MuonCalib__GoodRunListFilter_h -#define MuonCalib__GoodRunListFilter_h - -//Gaudi -#include "GaudiKernel/ServiceHandle.h" -#include "GaudiKernel/ToolHandle.h" -#include "AthenaBaseComps/AthAlgTool.h" - -//MuonCalibStandAloneBase -#include "MuonCalibStandAloneBase/CalibSegmentPreparationTool.h" - -//GoodRunsLists -#include "GoodRunsLists/IGoodRunsListSelectorTool.h" - -namespace MuonCalib { - -class GoodRunListFilter: public AthAlgTool, virtual public CalibSegmentPreparationTool { - public: -//=========================constructor========================================== - GoodRunListFilter(const std::string &t, const std::string &n, const IInterface *p); - ~GoodRunListFilter()=default; -//=========================public member functions============================== - StatusCode initialize(void); - //load event - void prepareSegments(const MuonCalibEvent *& /*event*/, std::map<NtupleStationId, MuonCalibSegment *> &segments); - private: - ToolHandle<IGoodRunsListSelectorTool> m_good_runlist_tool; - }; - -} //namespace MuonCalib -#endif diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/CalibNtupleAnalysisAlg/InitialDqFilter.h b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/CalibNtupleAnalysisAlg/InitialDqFilter.h deleted file mode 100644 index 0c1a5cbb0e69536b5dac5c0ba8d31635c667f5a0..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/CalibNtupleAnalysisAlg/InitialDqFilter.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef MuonCalib__InitialDqFilter_h -#define MuonCalib__InitialDqFilter_h - -//Gaudi -#include "AthenaBaseComps/AthAlgTool.h" -#include "GaudiKernel/ServiceHandle.h" - -//MuonCalibStandAloneBase -#include "MuonCalibStandAloneBase/CalibSegmentPreparationTool.h" - -//c- c++ -#include "set" - -class RegionSelectionSvc; - -namespace MuonCalib { - -class InitialDqFilter: public AthAlgTool, virtual public CalibSegmentPreparationTool { - public: -//=========================constructor========================================== - InitialDqFilter(const std::string &t, const std::string &n, const IInterface *p); - ~InitialDqFilter()=default; -//=========================public member functions============================== - StatusCode initialize(void); - //load event - void prepareSegments(const MuonCalibEvent *& /*event*/, std::map<NtupleStationId, MuonCalibSegment *> &segments); - private: -//=========================private data========================================= - //location of initial dq file - jo - std::string m_initial_dq_path; - //list of suppressed tubes - std::set<MuonFixedId> m_suppressed_tubes; - ServiceHandle<RegionSelectionSvc> m_reg_sel_svc; - }; - -} //namespace MuonCalib -#endif diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/CalibNtupleAnalysisAlg/MuonCalibGeometryDumper.h b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/CalibNtupleAnalysisAlg/MuonCalibGeometryDumper.h deleted file mode 100644 index 6f45e6933f842ab725ecffac48a70c93e7baf702..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/CalibNtupleAnalysisAlg/MuonCalibGeometryDumper.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef MuonCalibGeometryDumper_h -#define MuonCalibGeometryDumper_h - -//athena -#include "AthenaBaseComps/AthAlgorithm.h" -#include "GaudiKernel/ServiceHandle.h" - - -namespace coral { - class IRelationalDomain; - class AttributeList; - class IConnection; - class ISession; - class Context; - class ITableDataEditor; -} - -#include "MuonIdHelpers/IMuonIdHelperSvc.h" -namespace MuonGM { - class MuonDetectorManager; - class MdtReadoutElement; -} - -class TFile; -class TTree; -#include "CLHEP/Geometry/Transform3D.h" -namespace ROOT { - namespace Math{ - class Transform3D; - } -} - -namespace MuonCalib { - -class IIdToFixedIdTool; -class MdtTubeGeomertyRow; -class MdtChamberGeometryRow; - -class MuonCalibGeometryDumper : public AthAlgorithm { - public: -//=============================constructor - destructor========================= - /** Algorithm Constructor */ - MuonCalibGeometryDumper(const std::string& name, ISvcLocator *pSvcLocator); - /** Algorithm destrucrtor*/ - ~MuonCalibGeometryDumper()=default; -//=============================public members=================================== - /** Is called at the beginning of the analysis */ - StatusCode initialize(); - /** execute function NOTE: This will read all events at once*/ - inline StatusCode execute() { - return StatusCode::SUCCESS; - } -//============================private members=================================== - private: - void loadServices(); - std::string m_rootFile; - std::string m_idToFixedIdToolType; // type of the muon fixed id tool - std::string m_idToFixedIdToolName; // name of the muon fixed id tool - ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; - const MuonGM::MuonDetectorManager *m_detMgr; // pointer to the muon detector manager - const IIdToFixedIdTool *m_id_tool; // identifier converter - inline bool dump_mdt_geometry(); - inline void fillLayer(const Identifier &ch_id, const MuonGM::MdtReadoutElement *detEl, MdtTubeGeomertyRow &row, TTree *tree, const int &ml, const int &ly); - inline void init_root_transform(ROOT::Math::Transform3D &local_to_global, const HepGeom::Transform3D &hep_transform); -}; - -}//namespace MuonCalib -#endif //code guard diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/CalibNtupleAnalysisAlg/SegmentRawdataSelector.h b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/CalibNtupleAnalysisAlg/SegmentRawdataSelector.h deleted file mode 100644 index 9c2d8f652a5b02c7a10b5342a83d11d97f90ebf7..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/CalibNtupleAnalysisAlg/SegmentRawdataSelector.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef MuonCalib_SegmentRawdataSelector_h -#define MuonCalib_SegmentRawdataSelector_h - -//Gaudi -#include "AthenaBaseComps/AthAlgTool.h" -#include "GaudiKernel/ServiceHandle.h" - -//MuonCalibStandAloneBase -#include "MuonCalibStandAloneBase/CalibSegmentPreparationTool.h" - -#include "set" - -#include "GeoPrimitives/GeoPrimitives.h" - -#include "MuonIdHelpers/IMuonIdHelperSvc.h" -#include "MuonReadoutGeometry/MuonDetectorManager.h" - -class RegionSelectionSvc; - -namespace MuonCalib { -class IIdToFixedIdTool; -class MuonCalibRawMdtHit; -class MuonCalibRawHitCollection; - -class SegmentRawdataSelector : public AthAlgTool, virtual public CalibSegmentPreparationTool { - public: -//=========================constructor========================================== - SegmentRawdataSelector(const std::string &t, const std::string &n, const IInterface *p); - inline ~SegmentRawdataSelector()=default; -//=========================public member functions============================== - StatusCode initialize(); - - //load event - void prepareSegments(const MuonCalibEvent *&event, std::map<NtupleStationId, MuonCalibSegment *> &segments); - private: -//=========================private data========================================= - //minimum and maximum number of segment hits - int m_min_hits, m_max_hits; - //adc cut on raw hits - int m_adc_cut; - //! pointer to region selection service - ServiceHandle<RegionSelectionSvc> m_reg_sel_svc; - // helpers // - std::string m_idToFixedIdToolType; // type of the muon fixed id tool - std::string m_idToFixedIdToolName; // name of the muon fixed id tool - ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; - - // MuonDetectorManager from the conditions store - SG::ReadCondHandleKey<MuonGM::MuonDetectorManager> m_DetectorManagerKey {this, "DetectorManagerKey", - "MuonDetectorManager", - "Key of input MuonDetectorManager condition data"}; - - const MuonCalib::IIdToFixedIdTool *m_id_tool;// identifier converter - //store segments, because we have to delete them - std::set<MuonCalibSegment *> m_segments; -/** get a the position of the raw hit - search for matching rpc-hits in order to get the x coordinate */ - inline const Amg::Vector3D get_raw_position(const MuonCalibRawMdtHit *hit, const MuonCalibRawHitCollection *coll, const Amg::Transform3D &local_to_global) const; - -}; - -} //namespace MuonCalib -#endif diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/CalibNtupleAnalysisAlg/SegmentRecalibration.h b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/CalibNtupleAnalysisAlg/SegmentRecalibration.h deleted file mode 100644 index 72a2ecc4bcdfda4e4b33566c26491a09c5cce7fc..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/CalibNtupleAnalysisAlg/SegmentRecalibration.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef MuonCalib_SegmentRecalibration_h -#define MuonCalib_SegmentRecalibration_h - -//Gaudi -#include "GaudiKernel/ServiceHandle.h" -#include "AthenaBaseComps/AthAlgTool.h" - -//MuonCalibStandAloneBase -#include "MuonCalibStandAloneBase/CalibSegmentPreparationTool.h" - -class MdtCalibInputSvc; -namespace MuonCalib { -class IMdtSlewCorFunc; - -class SegmentRecalibration : public AthAlgTool, virtual public CalibSegmentPreparationTool { - public: -//=========================constructor========================================== - SegmentRecalibration(const std::string &t, const std::string &n, const IInterface *p); - ~SegmentRecalibration()=default; -//=========================public member functions============================== - StatusCode initialize(void); - //load event - void prepareSegments(const MuonCalibEvent *& /*event*/, std::map<NtupleStationId, MuonCalibSegment *> &segments); - private: -//=========================private data========================================= - //! switches for tube by tube correction - //! LEAVE: Take it as it is in calibraition file - //! UNAPPLY: Add correction which is stored in the ntuple - //! FILE: Read correction from file or recalculate - this entails UNAPPLY - std::string m_t0_switch; - std::string m_B_corr_switch; - std::string m_time_slwing_corr_switch; - std::string m_rt_scaling_switch; - //! numeric values for the switches - //! 0=LEAVE - //! 1=UNAPPLY - //! 2=FILE - int m_t0_numswitch, m_B_corr_numswitch, m_time_slwing_numswitch, m_rt_scaling_numswitch; - //! switches for recalculation of r and dr OFF|ON - bool m_recalc_r_switch; - //! replace drift radius by true radius (mc only) - jo - bool m_use_true_r; - //! undo segmentwise fitted t0 - //! <0: Automatic - //! 0: Don't - //! 1: Do - int m_undo_refitted_t0; - float m_prop_factor; - //! calibration input service - ServiceHandle<MdtCalibInputSvc> m_calib_input_svc; - IMdtSlewCorFunc *p_ts_corr_func; - //convert text switches to numerical values - inline bool convert_switch(const std::string &s_switch, int &num_switch, const char *switchname) const; -}; - -} //namespace MuonCalib - -#endif diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/CalibNtupleAnalysisAlg/SegmentRefitter.h b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/CalibNtupleAnalysisAlg/SegmentRefitter.h deleted file mode 100644 index bb53fb2e9367f741987c86f6bee8ac855fa98205..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/CalibNtupleAnalysisAlg/SegmentRefitter.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef MuonCalib_SegmentRefitter_h -#define MuonCalib_SegmentRefitter_h - -//Gaudi -#include "AthenaBaseComps/AthAlgTool.h" -#include "GaudiKernel/ServiceHandle.h" - -//MuonCalibStandAloneBase -#include "MuonCalibStandAloneBase/CalibSegmentPreparationTool.h" - -class MdtCalibInputSvc; - -namespace MuonCalib { - -class IMdtPatRecFitter; -class T0Refinement; - -class SegmentRefitter : public AthAlgTool, virtual public CalibSegmentPreparationTool { - public: -//=========================constructor========================================== - SegmentRefitter(const std::string &t, const std::string &n, const IInterface *p); - ~SegmentRefitter()=default; -//=========================public member functions============================== - StatusCode initialize(void); - //load event - void prepareSegments(const MuonCalibEvent *& /*event*/, std::map<NtupleStationId, MuonCalibSegment *> &segments); - private: -//=========================private data========================================= - //! if set to true, curved segments are fitted - jo - bool m_curved; - //! if set to true fitting with t0-refinement is activated - jo - bool m_t0_refine; - //! if set to true,the hit selection will be refined. - bool m_refine_hit_selection; - //! road width for segment fitting - jo - double m_road_width; - //! abort fitting if it takes longer that m_time_out seconds - double m_time_out; - //! minimum and maximum number of hits after the segment refit - int m_min_hits, m_max_hits; - //! fitter class (no t0 refinement) - IMdtPatRecFitter *p_qfitter; - //! t0 refinement - T0Refinement *p_t0_refinement; - //! calibration input service - ServiceHandle<MdtCalibInputSvc> m_calib_input_svc; - //refine t0 - inline bool refine_t0(MuonCalibSegment *&segment); - -}; - -} //namespace MuonCalib -#endif diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/CalibNtupleAnalysisAlg/SegmentRegionSelector.h b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/CalibNtupleAnalysisAlg/SegmentRegionSelector.h deleted file mode 100644 index b44ae94948548f81cf605394a3b6df4855984312..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/CalibNtupleAnalysisAlg/SegmentRegionSelector.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef MuonCalib_SegmentRegionSelector_h -#define MuonCalib_SegmentRegionSelector_h - -//Gaudi -#include "AthenaBaseComps/AthAlgTool.h" -#include "GaudiKernel/ServiceHandle.h" - -//MuonCalibStandAloneBase -#include "MuonCalibStandAloneBase/CalibSegmentPreparationTool.h" - -class RegionSelectionSvc; - -namespace MuonCalib { - -class SegmentRegionSelector : public AthAlgTool, virtual public CalibSegmentPreparationTool { - public: -//=========================constructor========================================== - SegmentRegionSelector(const std::string &t, const std::string &n, const IInterface *p); - ~SegmentRegionSelector()=default; -//=========================public member functions============================== - StatusCode initialize(void); - //load event - void prepareSegments(const MuonCalibEvent *&event, std::map<NtupleStationId, MuonCalibSegment *> &segments); - private: -//=========================private data========================================= - //if set to true, segments which are not completely in the selected calibration region will be dropped - job options - bool m_exclusive_segments; - //minimum and maximum number of segment hits - int m_min_hits, m_max_hits; - //select segment author - int m_select_seg_author; - //adc cut - int m_adc_cut; - //! pointer to region selection service - ServiceHandle<RegionSelectionSvc> m_reg_sel_svc; - - }; - -} //namespace MuonCalib -#endif diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/CalibNtupleAnalysisAlg/UpdateBField.h b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/CalibNtupleAnalysisAlg/UpdateBField.h deleted file mode 100644 index 83bd001e61c9f3bcca3fe99b5e8783b82d5f42bb..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/CalibNtupleAnalysisAlg/UpdateBField.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef MuonCalib_UpdateBField_h -#define MuonCalib_UpdateBField_h - -#include "MuonCalibStandAloneBase/CalibSegmentPreparationTool.h" -#include "AthenaBaseComps/AthAlgTool.h" -#include "StoreGate/ReadCondHandleKey.h" -#include "MagFieldConditions/AtlasFieldCacheCondObj.h" - -namespace MuonCalib { - - class UpdateBField: public AthAlgTool, virtual public CalibSegmentPreparationTool { - public: -//===========================constructor - destructor=========================== - UpdateBField(const std::string &t, const std::string &n, const IInterface *p); - ~UpdateBField()=default; -//===========================public member functions============================ - StatusCode initialize(); - void prepareSegments(const MuonCalibEvent *& /*event*/, std::map<NtupleStationId, MuonCalibSegment *> &segments); - private: - SG::ReadCondHandleKey<AtlasFieldCacheCondObj> m_fieldCondObjInputKey {this, "AtlasFieldCacheCondObj", "fieldCondObj"}; - }; //class - -} //namespace MuonCalib -#endif diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/CalibNtupleAnalysisAlg/WriteMdtGeometry.h b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/CalibNtupleAnalysisAlg/WriteMdtGeometry.h deleted file mode 100644 index 82ee8cc66452d4751489905d8e776b7a6945783f..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/CalibNtupleAnalysisAlg/WriteMdtGeometry.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef WriteMdtGeometry_h -#define WriteMdtGeometry_h - -//athena -#include "AthenaBaseComps/AthAlgorithm.h" -#include "GaudiKernel/ServiceHandle.h" -#include "MuonIdHelpers/IMuonIdHelperSvc.h" - -namespace coral { - class IRelationalDomain; - class AttributeList; - class ISessionProxy; - class Context; - class ITableDataEditor; -} - -namespace MuonGM { - class MuonDetectorManager; - class MdtReadoutElement; -} - -namespace MuonCalib { - -class IIdToFixedIdTool; - -class WriteMdtGeometry : public AthAlgorithm { - public: -//=============================constructor - destructor========================= - /** Algorithm Constructor */ - WriteMdtGeometry(const std::string &name, ISvcLocator *pSvcLocator); - /** Algorithm destrucrtor*/ - ~WriteMdtGeometry()=default; -//=============================public members=================================== - /** Is called at the beginning of the analysis */ - StatusCode initialize(); - /** execute function NOTE: This will read all events at once*/ - inline StatusCode execute() { - return StatusCode::SUCCESS; - } -//============================private members=================================== - private: - coral::Context *m_context; - coral::IRelationalDomain& domain( const std::string &connectionString ); - void loadServices(); - - std::string m_connectionString; - std::string m_WorkingSchema; - std::string m_username, m_password; - std::string m_idToFixedIdToolType; // type of the muon fixed id tool - std::string m_idToFixedIdToolName; // name of the muon fixed id tool - ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; - coral::ISessionProxy *m_session; - const MuonGM::MuonDetectorManager *m_detMgr; // pointer to the muon - const IIdToFixedIdTool *m_id_tool; // identifier converter - - inline bool fill_db(coral::ITableDataEditor& editor); - inline void fillLayer(const MuonGM::MdtReadoutElement *detEl, coral::AttributeList &rowBuffer, const int &ml, const int &ly); - - void OpenConnection(); - void CloseConnection(bool commit); -}; - -}//namespace MuonCalib -#endif //code guard diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/CalibNtupleAnalysisAlg/selection.xml b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/CalibNtupleAnalysisAlg/selection.xml deleted file mode 100644 index dc4948517a56ee0b3d4c4ff53dd9aac9c5efb62a..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/CalibNtupleAnalysisAlg/selection.xml +++ /dev/null @@ -1,5 +0,0 @@ -<lcgdict> - - <class name="MuonCalib::GeoDraw" /> - -</lcgdict> diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/python/CalibNtupleAnalysisConfig.py b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/python/CalibNtupleAnalysisConfig.py deleted file mode 100644 index dc3c551565c35911b70360ec8c98083a29a93adf..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/python/CalibNtupleAnalysisConfig.py +++ /dev/null @@ -1,398 +0,0 @@ -# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration - -from __future__ import print_function - -from CalibNtupleAnalysisAlg.CalibNtupleAnalysisAlgConf import (MuonCalib__ApplyRawTimes, - MuonCalib__CalibNtupleAnalysisAlg2, - MuonCalib__CalibNtupleLoader, - MuonCalib__UpdateBField, - MuonCalib__GoodRunListFilter, - MuonCalib__InitialDqFilter, - MuonCalib__BarrelSecondCoordinatePreparationTool, - MuonCalib__SegmentRawdataSelector, - MuonCalib__SegmentRefitter, - MuonCalib__SegmentRecalibration, - MuonCalib__SegmentRegionSelector) - -from MuonCalibStandAloneBase.MuonCalibStandAloneBaseConf import MuonCalib__CalibrationTeeIOTool, RegionSelectionSvc -from MdtCalibIOSvc.MdtCalibIOSvcConf import MdtCalibOutputDbSvc, MdtCalibInputSvc, MuonCalib__CalibrationFileIOTool -from MuonCalibDbOperations.MuonCalibDbOperationsConf import MuonCalib__CalibrationDbIOTool -from AthenaCommon.AppMgr import ServiceMgr, ToolSvc -from AthenaCommon.AlgSequence import AlgSequence -from CalibNtupleAnalysisAlg.CalibNtupleMetaData import CalibNtupleMetaData -import MuonCalibStandAloneTools.MuonCalibStandAloneToolsConfig as calibtools - -import sys - -class CalibNtupleAnalysisConfig: - -#--------------------------------------user settings---------------------------- -#calibration algorithm to run: -#select calibration algoritm -# scan run for chambers RunScan -# t0-Fitters: ClassicT0, MTT0 -# create rt by integration Integration -# autocalibration ClassicAutocal, AnalyticAutocal, -# CurvedAutocal -# resolution SimpleResolution, Chi2Resolution -# efficiency Efficiency -# event display Display -# rpc timing RpcTiming -# control histograms ControlHistograms - - CalibrationAlgorithm = "RunScan" - -#file list - FileList="fl.txt" - -#create segments from the rawdata part - SegmentsFromRawdata=False - -#replace drift times by raw times in existing segments - ApplyRawTimes=False - -#update the magnetic field values in the segments - UpdateBField=False - RefitAfterBFieldUpdate=False - -#select segment author - 3=MuonBoy 4=Moore - Unused if SegmentsFromRawdata=True - SegmentAuthor=4 - -#first and last event to analyse - FirstEvent=0 - LastEvent=-1 - -#number of segments to collect - NumberOfSegments=-1 - -#maximum number of segments for certain algorithms (e.g. Autocalibration) - AutoLimitSegments = 20000 - -#calibration region - CalibrationRegion = "" - -#adc cut - ADCCut = 0 - -#minimum and maximum number of hits BEFORE refit - MinSegmentHits = 0 - MaxSegmentHits = -1 - -#perform a segment refit - not for algorithms likr MTT0, Integration, RunScan.. - SegmentRefit=False - -#segment refit parameters - RefineT0=False - CurvedSegments=False - RefitRoadWidth=2.0 - RefitTimeOut=2 - RefitMinSegmentHits=4 - RefitMaxSegmentHits=-1 - -#calibrate with b-field - BFieldCorrection=False - -#apply RPC Timing Correction - RPCTimingCorr=False - -#recalculate second coordinate - Recalc2ndCoordinate = False - -#select calibration input - CalibInputFromDB=False - CalibInputFromFile=True - -#select calibration output - CalibOutputToDB=False - CalibOutputToFile=True - -#output calibration directory - set None if you do not want to output to diredctory - CalibDir="calibration" - -#output to database - MP/RM/MI/NONE - CalibDB=None - -#initial data quality list - suppress Tubes - InitialDQList = None - -#if set to true no segment recalibraiton will be done, independent on the tool - SuppressRecalibration=False - -#use good run list to filter events - GoodRunList=None - -#apply time slewing corrections - ApplyTimeSlewingCorrections=False - -#apply multilayer rt-scaling - ApplyRtScaling=True - - sToolSvc= ToolSvc - sServiceMgr = ServiceMgr - - SegmentRecalibration={} - SegmentRefitter={} - - def AutoConfig(self): - self.metadata=CalibNtupleMetaData(self.FileList) - if 'GeoAtlas' in self.metadata.MetaData: - self.sServiceMgr.GeoModelSvc.AtlasVersion = self.metadata.MetaData['GeoAtlas'] - self._create_CalibNtupleAnalysisAlg() - #ntuple loader - self.CalibNtupleLoader = MuonCalib__CalibNtupleLoader() - self.sToolSvc += self.CalibNtupleLoader - self.CalibNtupleLoader.FileList = self.FileList - self.CalibNtupleLoader.FirstEvent = self.FirstEvent - self.CalibNtupleLoader.LastEvent = self.LastEvent - self.CalibNtupleLoader.NtupleType = "AUTO" - self.CalibNtupleAnalysisAlg.CalibSegmentPreparationTools.append( self.CalibNtupleLoader) - #region selection - self._region_selection() - #good run list selection - self._good_run_list_filter() - #raw times - if self.ApplyRawTimes: - self.RawTimesReplacement=MuonCalib__ApplyRawTimes() - self.sToolSvc += self.RawTimesReplacement - self.CalibNtupleAnalysisAlg.CalibSegmentPreparationTools.append(self.RawTimesReplacement) - #initial DQ list - self._initial_DQ_list() - #apply RPC Timing Correction - if self.RPCTimingCorr: - from CalibNtupleAnalysisAlg.CalibNtupleAnalysisAlgConf import MuonCalib__RpcTimingCorr - self.RpcTiming=MuonCalib__RpcTimingCorr() - self.sToolSvc += self.RpcTiming - self.CalibNtupleAnalysisAlg.CalibSegmentPreparationTools.append(self.RpcTiming) - #recalculate 2nd coordinate: - self._second_coordinate() - #segment recalibration - if not self.SuppressRecalibration: - self._configure_segment_recalibration("SegmentRecalibration") - #segment refitter - if self.SegmentRefit: - self._config_segment_refitter() - #B field updater - if self.UpdateBField: - self._config_UpdateBField() - self._configure_segment_recalibration("SegmentRecalibration2") - if self.SegmentRefit and self.RefitAfterBFieldUpdate: - self._config_segment_refitter("SegmentRefitter2") - #calibration IO - self._config_calibIO() - #create tool - self._create_calib_tool() - -#-----------------------protected functions------------------------------------ - def _create_CalibNtupleAnalysisAlg(self): - topSequence = AlgSequence() - self.CalibNtupleAnalysisAlg = MuonCalib__CalibNtupleAnalysisAlg2() - self.CalibNtupleAnalysisAlg.NumberOfSegments = self.NumberOfSegments - if self.CalibrationAlgorithm in calibtools.LimitSegmentsFor: - self.CalibNtupleAnalysisAlg.NumberOfSegments = self.AutoLimitSegments - topSequence += self.CalibNtupleAnalysisAlg - - def _good_run_list_filter(self): - if not self.GoodRunList: - return - from GoodRunsLists.GoodRunsListsConf import GoodRunsListSelectorTool - self.__good_run_list_tool=GoodRunsListSelectorTool() - self.sToolSvc += self.__good_run_list_tool - self.__good_run_list_tool.GoodRunsListVec = [self.GoodRunList] - self.__good_run_list_filter=MuonCalib__GoodRunListFilter() - self.__good_run_list_filter.GoodRunListTool = self.__good_run_list_tool - self.sToolSvc +=self.__good_run_list_filter - self.CalibNtupleAnalysisAlg.CalibSegmentPreparationTools.append( self.__good_run_list_filter ) -# self.__good_run_list_tool.EventSelectorMode = True - self.__good_run_list_tool.PassThrough = False - - def _initial_DQ_list(self): - if self.InitialDQList: - if self.InitialDQList.upper()=="NONE": - return - self.InitialDqFilter = MuonCalib__InitialDqFilter() - self.InitialDqFilter.InitialDqFile = self.InitialDQList - self.sToolSvc += self.InitialDqFilter - self.CalibNtupleAnalysisAlg.CalibSegmentPreparationTools.append( self.InitialDqFilter) - - def _region_selection(self): - if self.SegmentsFromRawdata: - self.RegionSelection = MuonCalib__SegmentRawdataSelector() - else: - self.RegionSelection = MuonCalib__SegmentRegionSelector() - self.RegionSelection.SelectSegmentAuthor = self.SegmentAuthor - self.sToolSvc += self.RegionSelection - self.CalibNtupleAnalysisAlg.CalibSegmentPreparationTools.append( self.RegionSelection ) - self.RegionSelectionSvc = RegionSelectionSvc() - self.RegionSelectionSvc.Region = self.CalibrationRegion - self.RegionSelectionSvc.PrintList = True - self.RegionSelection.AdcCut = self.ADCCut - self.RegionSelection.MinHits = self.MinSegmentHits - self.RegionSelection.MaxHits = self.MaxSegmentHits - self.sServiceMgr += self.RegionSelectionSvc - - def _second_coordinate(self): - if self.Recalc2ndCoordinate: - self.BarrelSecondCoordinatePreparationTool = MuonCalib__BarrelSecondCoordinatePreparationTool() - self.sToolSvc += self.BarrelSecondCoordinatePreparationTool - self.CalibNtupleAnalysisAlg.CalibSegmentPreparationTools.append( self.BarrelSecondCoordinatePreparationTool) - - def _configure_segment_recalibration(self, ToolName=""): - #tools that do not need segment recalibration - if self.CalibrationAlgorithm in calibtools.NoRecalibration: - return - if ToolName: - self.SegmentRecalibration[ToolName] = MuonCalib__SegmentRecalibration(ToolName) - else: - ToolName = "default" - self.SegmentRecalibration[ToolName] = MuonCalib__SegmentRecalibration() - self.sToolSvc += self.SegmentRecalibration[ToolName] - self.CalibNtupleAnalysisAlg.CalibSegmentPreparationTools.append( self.SegmentRecalibration[ToolName] ) - if self.ApplyTimeSlewingCorrections: - self.SegmentRecalibration[ToolName].TimeSlewingSwitch='FILE' - else: - self.SegmentRecalibration[ToolName].TimeSlewingSwitch='UNAPPLY' - #tools that revert all calibrations - if self.CalibrationAlgorithm in calibtools.RevertT0: - self.SegmentRecalibration[ToolName].T0Switch = "UNAPPLY" - self.SegmentRecalibration[ToolName].BSwitch = "LEAVE" - self.SegmentRecalibration[ToolName].RecalcR = False - if self.CalibrationAlgorithm in calibtools.RecalibT0 : - self.SegmentRecalibration[ToolName].T0Switch = "FILE" - self.SegmentRecalibration[ToolName].BSwitch = "LEAVE" - self.SegmentRecalibration[ToolName].RecalcR = False - if self.CalibrationAlgorithm in calibtools.RecalibAll: - self.SegmentRecalibration[ToolName].T0Switch = "FILE" - self.SegmentRecalibration[ToolName].BSwitch = "LEAVE" - self.SegmentRecalibration[ToolName].RecalcR = True - #id b-field should be corrected, set BSwitch either to "UNAPPLY" or to "FILE" - if self.CalibrationAlgorithm in calibtools.RevertRtScaling: - self.SegmentRecalibration[ToolName].RtMultilayerScaling = "UNAPPLY" - if self.CalibrationAlgorithm in calibtools.ApplRtScaling and self.ApplyRtScaling: - self.SegmentRecalibration[ToolName].RtMultilayerScaling = "FILE" - if self.BFieldCorrection: - if self.SegmentRecalibration[ToolName].RecalcR: - self.SegmentRecalibration[ToolName].BSwitch = "FILE" -# else: -# self.SegmentRecalibration[ToolName].BSwitch = "UNAPPLY" - - def _config_UpdateBField(self): - if self.UpdateBField in calibtools.NoSegmentRefit: - self.UpdateBField = None - return - self.UpdateBField = MuonCalib__UpdateBField() - self.sToolSvc += self.UpdateBField - self.CalibNtupleAnalysisAlg.CalibSegmentPreparationTools.append( self.UpdateBField ) - - def _config_segment_refitter(self, ToolName=""): - if self.CalibrationAlgorithm in calibtools.NoSegmentRefit: - return - if ToolName: - self.SegmentRefitter[ToolName] = MuonCalib__SegmentRefitter(ToolName) - else: - ToolName = "default" - self.SegmentRefitter[ToolName] = MuonCalib__SegmentRefitter(ToolName) - self.sToolSvc += self.SegmentRefitter[ToolName] - self.CalibNtupleAnalysisAlg.CalibSegmentPreparationTools.append( self.SegmentRefitter[ToolName] ) - self.SegmentRefitter[ToolName].Curved = self.CurvedSegments - self.SegmentRefitter[ToolName].RefineT0 = self.RefineT0 - self.SegmentRefitter[ToolName].RoadWidth = self.RefitRoadWidth - self.SegmentRefitter[ToolName].TimeOut = self.RefitTimeOut - self.SegmentRefitter[ToolName].MinSegmentHits = self.RefitMinSegmentHits - self.SegmentRefitter[ToolName].MaxSegmentHits = self.RefitMaxSegmentHits - - def _config_calibIO(self): - if self.CalibDir: - self.CalibrationFileIOTool = MuonCalib__CalibrationFileIOTool() - self.sToolSvc += self.CalibrationFileIOTool - self.CalibrationFileIOTool.outputLocation = self.CalibDir - if self.CalibDB and not self.CalibDB.upper()=="NONE": - self.DbIoTool = MuonCalib__CalibrationDbIOTool() - self.sToolSvc += MuonCalib__CalibrationDbIOTool() - if not self.__set_db(): - print ("Unknown database location " + str(self.CalibOutputDB)) - sys.exit(1) - - self.MdtCalibOutputDbSvc = MdtCalibOutputDbSvc() - self.MdtCalibOutputDbSvc.PostprocessCalibration = True - self.sServiceMgr += self.MdtCalibOutputDbSvc - if self.CalibOutputToDB and self.CalibOutputToFile: - self.TeeIoTool=MuonCalib__CalibrationTeeIOTool() - self.sToolSvc += self.TeeIoTool - self.TeeIoTool.IOTool2 = self.CalibrationFileIOTool - self.TeeIoTool.IOTool1 = self.DbIoTool - self.MdtCalibOutputDbSvc.OutputTool=self.TeeIoTool - elif self.CalibOutputToFile: - self.MdtCalibOutputDbSvc.OutputTool = self.CalibrationFileIOTool - elif self.CalibOutputToDB: - self.CalibOutputDB = self.DbIoTool - self.MdtCalibOutputDbSvc.OutputTool=self.DbIoTool - #input - self.MdtCalibInputSvc = MdtCalibInputSvc() - self.sServiceMgr += self.MdtCalibInputSvc - if self.CalibInputFromDB: - if not self.DbIoTool: - print ("Set calibratino database location!") - sys.exit(1) - self.MdtCalibInputSvc.CalibrationInputTool = self.DbIoTool - if self.CalibInputFromFile: - if not self.CalibrationFileIOTool: - print ("give a calibdir!") - sys.exit(1) - self.MdtCalibInputSvc.CalibrationInputTool = self.CalibrationFileIOTool - - def _create_calib_tool(self): - self.CalibrationTool=calibtools.CreateCalibTool(self.CalibrationAlgorithm) - if self.CalibrationTool: - self.sToolSvc += self.CalibrationTool - self.CalibNtupleAnalysisAlg.CalibrationTool = self.CalibrationTool - -#------------------------------------------------------------ - def __set_db(self): - self.DbIoTool.SiteName = self.CalibDB - self.DbIoTool.UseValidaedT0 = self.CalibrationAlgorithm in calibtools.ValidatedT0 - self.DbIoTool.UseValidaedRt = self.CalibrationAlgorithm in calibtools.ValidatedRt - if (self.CalibDB == "MP"): - self.DbIoTool.ConnectionString = "oracle://oracle01.mppmu.mpg.de/ATLMPI.mppmu.mpg.de/ATLAS_MUONCALIB_MPI" - self.DbIoTool.WorkingSchema = "ATLAS_MUONCALIB_MPI" - elif (self.CalibDB == "MP_NEW"): - # MPI - self.DbIoTool.ConnectionString = "oracle://oracle01.mppmu.mpg.de/ATLMPI.mppmu.mpg.de/ATLAS_MUONCALIB_READER" - self.DbIoTool.WorkingSchema = "ATLAS_MUONCALIB_MPI_META" - self.DbIoTool.WriterConnectionString = "oracle://oracle01.mppmu.mpg.de/ATLMPI.mppmu.mpg.de/ATLAS_MUONCALIB_WRITER" - elif (self.CalibDB == "MP_INTR"): - # MPI - self.DbIoTool.ConnectionString = "oracle://INTR/ATLAS_MUONCALIB_READER" - self.DbIoTool.WorkingSchema = "ATLAS_MUONCALIB_MPI_META" - self.DbIoTool.WriterConnectionString = "oracle://INVALID/ATLAS_MUONCALIB_WRITER" - elif (self.CalibDB == "MI"): - # Michigan - self.DbIoTool.ConnectionString = "oracle://umors.grid.umich.edu/muoncal.grid.umich.edu/atlas_muoncalib_mich" - self.DbIoTool.WorkingSchema = "atlas_muoncalib_mich" - elif (self.CalibDB == "MI_NEW"): - # Michigan - self.DbIoTool.ConnectionString = "oracle://umors.grid.umich.edu/muoncal.grid.umich.edu/ATLAS_MUONCALIB_READER" - self.DbIoTool.WorkingSchema = "ATLAS_MUONCALIB_UMICH" - self.DbIoTool.WriterConnectionString = "oracle://umors.grid.umich.edu/muoncal.grid.umich.edu/ATLAS_MUONCALIB_WRITER" - elif (self.CalibDB == "MI_INTR"): - # Michigan - self.DbIoTool.ConnectionString = "oracle://INTR/ATLAS_MUONCALIB_READER" - self.DbIoTool.WorkingSchema = "ATLAS_MUONCALIB_UM_META" - self.DbIoTool.WriterConnectionString = "oracle://INVALID/ATLAS_MUONCALIB_WRITER" - elif (self.CalibDB == "RM_NEW"): - # ROMA - self.DbIoTool.ConnectionString = "oracle://atlas-cluster.cr.cnaf.infn.it:1521/atlcnafsrv.cr.cnaf.infn.it/ATLAS_MUONCALIB_READER" - self.DbIoTool.WorkingSchema = "ATLAS_MUONCALIB_RM_META" - #self.DbIoTool.WorkingSchema = "ATLAS_MUONCALIB_RM_2012" - self.DbIoTool.WriterConnectionString = "oracle://atlas-cluster.cr.cnaf.infn.it:1521/atlcnafsrv.cr.cnaf.infn.it/ATLAS_MUONCALIB_WRITER" - elif (self.CalibDB == "RM_INTR"): - # ROMA - self.DbIoTool.ConnectionString = "oracle://INTR/ATLAS_MUONCALIB_READER" - self.DbIoTool.WorkingSchema = "ATLAS_MUONCALIB_RM_META" - self.DbIoTool.WriterConnectionString = "oracle://INVALID/ATLAS_MUONCALIB_WRITER" - elif (self.CalibDB == "RM"): - # ROMA - self.DbIoTool.ConnectionString = "oracle://atlas-cluster.cr.cnaf.infn.it/atlcnaf.cr.cnaf.infn.it//atlas_muoncalib_rome" - self.DbIoTool.WorkingSchema = "atlas_muoncalib_rome" - else: - return False - return True diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/python/CalibNtupleMetaData.py b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/python/CalibNtupleMetaData.py deleted file mode 100644 index 7858f4574c955e605079c72510832e9810986ca6..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/python/CalibNtupleMetaData.py +++ /dev/null @@ -1,46 +0,0 @@ -# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration - -from __future__ import print_function - -from ROOT import TFile -import sys - -class CalibNtupleMetaData: - - def __init__(self, filelist): - self.MetaData={} - fl=open(filelist) - root_file=None - inf=None - for line in fl.readlines(): - items=line.replace('\n', '').split() - print (line.replace('\n', ''), items) - if len(items)==0 or items[0][0]=="#": - continue - if items[0]=="[": - if len(items)<2: - continue - root_file=items[1] - else: - root_file=items[0] - inf=TFile.Open(root_file) - if not inf: - sys.stderr.write("CalibNtupleMetaData WARNING: cannot open first file in filelist\n") - continue - - if not inf: - sys.stderr.write("CalibNtupleMetaData WARNING: find an input file in filelist\n") - return - - tree=inf.Get("meta_data") - if not tree: - sys.stderr.write("CalibNtupleMetaData WARNING: input file does not contain meta_data\n") - return - - i=0 - while tree.GetEntry(i): - i+=1 - self.MetaData[str(tree.key)] = str(tree.value) - print ("Found meta data:") - for k in self.MetaData: - print (k, self.MetaData[k]) diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/share/dump_muon_geometry.py b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/share/dump_muon_geometry.py deleted file mode 100644 index 2474f83a3312f58e83829d342d56526f507647e1..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/share/dump_muon_geometry.py +++ /dev/null @@ -1,41 +0,0 @@ -# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration - -### Setup Athena common flags -include ("AthenaCommon/AthenaCommonFlags.py") -include.block("AthenaCommon/AthenaCommonFlags.py") - -include( "IOVDbSvc/IOVRecExCommon.py" ) - -doMuonCalibAtlas=True - - -from AthenaCommon.AppMgr import ServiceMgr -#need to load atlas geometry for the efficiency determination -from AthenaCommon.GlobalFlags import GlobalFlags -GlobalFlags.DetGeo.set_atlas() -GlobalFlags.DataSource.set_data() -GlobalFlags.Print() -from AthenaCommon.DetFlags import DetFlags -DetFlags.detdescr.Muon_setOn() -DetFlags.detdescr.ID_setOff() -DetFlags.detdescr.LAr_setOff() -DetFlags.detdescr.Tile_setOff() -DetFlags.Print() - - -from CalibNtupleAnalysisAlg.CalibNtupleAnalysisAlgConf import MuonCalib__MuonCalibGeometryDumper - -MuonCalibGeometryDumper = MuonCalib__MuonCalibGeometryDumper() - -from AthenaCommon.AlgSequence import AlgSequence -topSequence = AlgSequence() -topSequence += MuonCalibGeometryDumper -#Set geometry tag -from AtlasGeoModel import SetGeometryVersion, GeoModelInit - -GeoModelSvc = ServiceMgr.GeoModelSvc -GeoModelSvc.AtlasVersion = "ATLAS-GEO-16-00-01" - - -MuonCalibGeometryDumper.RootFile = "geom.root" -theApp.EvtMax = 1 diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/share/write_geometry.py b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/share/write_geometry.py deleted file mode 100644 index e9e6b1304dc81672137be3dfe55f4beacffbe056..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/share/write_geometry.py +++ /dev/null @@ -1,41 +0,0 @@ -# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration - -### Setup Athena common flags -include ("AthenaCommon/AthenaCommonFlags.py") -include.block("AthenaCommon/AthenaCommonFlags.py") - -include( "IOVDbSvc/IOVRecExCommon.py" ) - -doMuonCalibAtlas=True - - -from AthenaCommon.AppMgr import ServiceMgr -#need to load atlas geometry for the efficiency determination -from AthenaCommon.GlobalFlags import GlobalFlags -GlobalFlags.DetGeo.set_atlas() -GlobalFlags.DataSource.set_data() -GlobalFlags.Print() -from AthenaCommon.DetFlags import DetFlags -DetFlags.detdescr.Muon_setOn() -DetFlags.detdescr.ID_setOff() -DetFlags.detdescr.LAr_setOff() -DetFlags.detdescr.Tile_setOff() -DetFlags.Print() - - -from CalibNtupleAnalysisAlg.CalibNtupleAnalysisAlgConf import MuonCalib__WriteMdtGeometry - -WriteMdtGeometry = MuonCalib__WriteMdtGeometry() - -from AthenaCommon.AlgSequence import AlgSequence -topSequence = AlgSequence() -topSequence += WriteMdtGeometry -#Set geometry tag -from AtlasGeoModel import SetGeometryVersion, GeoModelInit - -GeoModelSvc = ServiceMgr.GeoModelSvc -GeoModelSvc.AtlasVersion = "ATLAS-GEO-16-00-01" - - -WriteMdtGeometry.ConnectionString = "sqlite_file:empty_geometry.db" -theApp.EvtMax = 1 diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/src/ApplyRawTimes.cxx b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/src/ApplyRawTimes.cxx deleted file mode 100644 index 1ecf2bd839cdb0e8eed74f590e5decbe41e3a2fe..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/src/ApplyRawTimes.cxx +++ /dev/null @@ -1,77 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -//this -#include "CalibNtupleAnalysisAlg/ApplyRawTimes.h" - -//MuonCalibStandAloneBase -#include "MuonCalibStandAloneBase/RegionSelectionSvc.h" - -//MuonCalibEventBase -#include "MuonCalibEventBase/MuonCalibEvent.h" -#include "MuonCalibEventBase/MuonCalibSegment.h" -#include "MuonCalibEventBase/MuonCalibRawHitCollection.h" -#include "MuonCalibEventBase/MuonCalibRawMdtHit.h" -#include "MuonCalibEventBase/MdtCalibHitBase.h" - -//MuonCalibIdentifier -#include "MuonCalibIdentifier/MuonFixedId.h" - - -#include "map" -#include "set" - - -namespace MuonCalib { - -ApplyRawTimes::ApplyRawTimes(const std::string &t, const std::string &n, const IInterface *p) - : AthAlgTool(t, n, p), m_reg_sel_svc("RegionSelectionSvc", n) { - declareInterface< CalibSegmentPreparationTool >(this); - declareProperty("RegionSelectionSvc", m_reg_sel_svc); -} - -StatusCode ApplyRawTimes::initialize(void) { - ATH_CHECK( m_reg_sel_svc.retrieve() ); - return StatusCode::SUCCESS; -} - -void ApplyRawTimes::prepareSegments(const MuonCalibEvent *&event, std::map<NtupleStationId, MuonCalibSegment *> &segments) { - std::map<MuonFixedId, std::set<int> > raw_times; - const MuonCalibRawHitCollection *raw_coll(event->rawHitCollection()); - for(MuonCalibRawHitCollection::MuonCalibRawMdtHitVecCit it=raw_coll->rawMdtHitCollectionBegin(); it!=raw_coll->rawMdtHitCollectionEnd(); it++) { - if(m_reg_sel_svc->isInRegion((*it)->identify())) - raw_times[(*it)->identify()].insert((*it)->tdcCount()); - } - std::set<NtupleStationId> to_delete; - for(std::map<NtupleStationId, MuonCalibSegment *>::iterator it=segments.begin(); it!=segments.end(); it++) { - MuonCalibSegment::MdtHitCit h_it(it->second->mdtHOTBegin()); - for(; h_it!=it->second->mdtHOTEnd(); h_it++) { - if(raw_times.find((*h_it)->identify()) == raw_times.end()) { - ATH_MSG_WARNING( "No Raw time found for this hit!" ); - to_delete.insert(it->first); - break; - } - int tdc(*(raw_times[(*h_it)->identify()].begin())); - (*h_it)->setDriftTime((25.0/32.0) * tdc); - (*h_it)->setDriftRadius(0.0, 0.0); - (*h_it)->setDistanceToTrack(0.0, 0.0); - (*h_it)->setTimeFromTrackDistance(0.0, 0.0); - (*h_it)->setSlewingTime(0.0); - (*h_it)->setBFieldTime(0.0); - (*h_it)->setPropagationTime(0.0); - (*h_it)->setTimeOfFlight(0.0); - (*h_it)->setWiresagTime(0.0); - (*h_it)->setTemperatureTime(0.0); - (*h_it)->setBackgroundTime(0.0); - (*h_it)->setTubeT0(0.0); - (*h_it)->setTdc(tdc); - } - it->second->setFittedT0(0.0); - } - for(std::set<NtupleStationId>::iterator it=to_delete.begin(); it!=to_delete.end(); it++) { - segments.erase(segments.find(*it)); - } -} //end ApplyRawTimes::prepareSegments - -} //namespace MuonCalib diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/src/BFielCorrectionUpdateTool.cxx b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/src/BFielCorrectionUpdateTool.cxx deleted file mode 100644 index d457919d2319972a501d451df095b9911afca0e3..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/src/BFielCorrectionUpdateTool.cxx +++ /dev/null @@ -1,152 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -#include <iostream> -#include <fstream> - -#include "MdtCalibData/RtSpline.h" -#include "CalibNtupleAnalysisAlg/BFieldCorrectionUpdateTool.h" - -using namespace MuonCalib; - -//***************************************************************************** - -//::::::::::::::::: -//:: CONSTRUCTOR :: -//::::::::::::::::: -BFieldCorrectionUpdateTool::BFieldCorrectionUpdateTool( - const std::string &t, - const std::string &n, - const IInterface *p) : AthAlgTool(t, n, p) { - -///////////////// -// JOB OPTIONS // -///////////////// - m_rt_file_name = std::string("truth_rt.dat"); - declareProperty("rtFile", m_rt_file_name); - -/////////////////////// -// DECLARE INTERFACE // -/////////////////////// - declareInterface< CalibSegmentPreparationTool >(this); - -//////////////////// -// RESET POINTERS // -//////////////////// - m_rt = 0; -} - -//***************************************************************************** - -//::::::::::::::::::::::: -//:: METHOD initialize :: -//::::::::::::::::::::::: -StatusCode BFieldCorrectionUpdateTool::initialize(void) { - -///////////// -// OBJECTS // -///////////// - -///////////// -// MESSAGE // -///////////// - ATH_MSG_INFO( "Initializing tool..." ); - -///////////////////////////////////////////////////////////////// -// READ r-t RELATIONSHIP AND INITIALIZE THE B-FIELD CORRECTION // -///////////////////////////////////////////////////////////////// - if (!initialize_BFieldCorFunc()) { - ATH_MSG_FATAL( "Could not initialize the magnetic field correction!" ); - return StatusCode::FAILURE; - } - - return StatusCode::SUCCESS; -} //end BFieldCorrectionUpdateTool::initialize - -//***************************************************************************** - -//:::::::::::::::::::::::::::: -//:: METHOD prepareSegments :: -//:::::::::::::::::::::::::::: -void BFieldCorrectionUpdateTool::prepareSegments( - const MuonCalibEvent *& /*event*/, - std::map<NtupleStationId, MuonCalibSegment *> &segments) { - -////////////////////////////////////////////////////////////////////////////// -// LOOP OVER THE SEGMENTS AND THEIR HITS TO ADD THE LORENTZ ANGLE EFFECT TO // -// THE MEASURED DRIFT TIMES // -////////////////////////////////////////////////////////////////////////////// - for (std::map<NtupleStationId, MuonCalibSegment *> :: iterator it= - segments.begin(); it!= segments.end(); it++) { - - for (unsigned int k=0; k<it->second->mdtHOT().size(); k++) { - MdtCalibHitBase *hit = it->second->mdtHOT()[k]; - hit->setDriftTime(hit->driftTime() + - m_corr_func->correction_to_B(hit->driftTime(), hit->bFieldPara(), hit->bFieldPerp())); - } - - } - - return; -} //end BFieldCorrectionUpdateTool::prepareSegments - -//***************************************************************************** - -//::::::::::::::::::::::::::::::::::::: -//:: METHOD initialize_BFieldCorFunc :: -//::::::::::::::::::::::::::::::::::::: -bool BFieldCorrectionUpdateTool::initialize_BFieldCorFunc(void) { - -///////////// -// OBJECTS // -///////////// - std::ifstream rt_file; - char s[255]; // auxiliary character pointer - double dummy; // auxiliary double - std::vector<double> r,t; // entries in the r-t table - std::vector<double> B_corr_param(2); - -////////////////////////////////////////////// -// OPEN THE r-t FILE AND READ THE r-t TABLE // -////////////////////////////////////////////// - -// check that the file exists // - rt_file.open(m_rt_file_name.c_str()); - if (rt_file.fail()) { - ATH_MSG_FATAL( "Could not open file '" << m_rt_file_name << "'!" ); - return false; - } - -// read the file // - rt_file.getline(s, 255); - - while (!rt_file.eof()) { - rt_file >> dummy; - if (rt_file.eof()) { - break; - } - r.push_back(dummy); - rt_file >> dummy; t.push_back(dummy); - rt_file >> dummy; - } - -// create a spline r-t relationship // - std::vector<double> param(2*r.size()); - for (unsigned int k=0; k<r.size(); k++) { - param[2*k] = t[k]; - param[2*k+1] = r[k]; - } - - m_rt = new RtSpline(param); - -//////////////////////////////////////////// -// CREATE THE B FIELD CORRECTION FUNCTION // -//////////////////////////////////////////// - B_corr_param[0] = 3080.0; - B_corr_param[1] = 0.11; - - m_corr_func = new BFieldCorFunc("high", B_corr_param, m_rt); - - return true; -} //end BFieldCorrectionUpdateTool::initialize_BFieldCorFunc diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/src/BarrelSecondCoordinatePreparationTool.cxx b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/src/BarrelSecondCoordinatePreparationTool.cxx deleted file mode 100644 index c6880673600487433380cc7a6e0389404b489d4d..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/src/BarrelSecondCoordinatePreparationTool.cxx +++ /dev/null @@ -1,421 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -#include <iostream> -#include <fstream> - -#include "CalibNtupleAnalysisAlg/BarrelSecondCoordinatePreparationTool.h" -#include "MuonReadoutGeometry/MdtReadoutElement.h" -#include "MuonCalibITools/IIdToFixedIdTool.h" -#include "MuonCalibEventBase/MuonCalibRawRpcHit.h" -#include "MuonCalibEventBase/MuonCalibRawHitCollection.h" - -using namespace MuonCalib; - -//***************************************************************************** - -//::::::::::::::::: -//:: CONSTRUCTOR :: -//::::::::::::::::: -BarrelSecondCoordinatePreparationTool::BarrelSecondCoordinatePreparationTool( - const std::string &t, - const std::string &n, - const IInterface *p) : AthAlgTool(t, n, p) { - -/////////////////////// -// DECLARE INTERFACE // -/////////////////////// - declareInterface< CalibSegmentPreparationTool >(this); -} - -//***************************************************************************** - -/////////////////////// -// METHOD initialize // -/////////////////////// -StatusCode BarrelSecondCoordinatePreparationTool::initialize(void) { - -///////////// -// OBJECTS // -///////////// - -///////////// -// MESSAGE // -///////////// - ATH_MSG_INFO( "Initializing tool..." ); - -//retrieve detector manager from the conditions store - ATH_CHECK(m_DetectorManagerKey.initialize()); - -// muon fixed id tool // - ATH_CHECK( toolSvc()->retrieveTool("MuonCalib::IdToFixedIdTool", - "MuonCalib_IdToFixedIdTool", m_id_tool) ); - - m_write_rpc_hits = false; - - if((m_rpcHitsFile=fopen("RpcHits.txt","w"))==NULL) { - ATH_MSG_INFO( "can't open file" ); - } - - return StatusCode::SUCCESS; -} //end BarrelSecondCoordinatePreparationTool - -//***************************************************************************** - -///////////////////// -// METHOD finalize // -///////////////////// -StatusCode BarrelSecondCoordinatePreparationTool::finalize(void) { - -///////////// -// OBJECTS // -///////////// - -///////////// -// MESSAGE // -///////////// - ATH_MSG_INFO( "Finalizing tool..." ); - fclose(m_rpcHitsFile); - - return StatusCode::SUCCESS; -} //end BarrelSecondCoordinatePreparationTool::finalize - -//***************************************************************************** - -//////////////////////////// -// METHOD prepareSegments // -//////////////////////////// -void BarrelSecondCoordinatePreparationTool::prepareSegments( - const MuonCalibEvent *&event, std::map<NtupleStationId, MuonCalibSegment *> &segments) { - -///////////// -// OBJECTS // -///////////// - std::vector<MuonCalibRawRpcHit*>::const_iterator raw_RPC_begin_it( - event->rawHitCollection()->rawRpcHitCollectionBegin()); - std::vector<MuonCalibRawRpcHit*>::const_iterator raw_RPC_end_it( - event->rawHitCollection()->rawRpcHitCollectionEnd()); - -/////////////////////////////////////////////////////////////////////////////// -// LOOP OVER THE SEGMENTS AND PASS THE BARREL SEGMENTS TO THE 2ND COORDINATE // -// RECONSTRUCTION TOOL // -/////////////////////////////////////////////////////////////////////////////// - std::set<NtupleStationId> to_delete; - for (std::map<NtupleStationId, MuonCalibSegment *> :: iterator it= - segments.begin(); it!= segments.end(); it++) { - -// ignore end-cap chambers // - if (it->second->mdtHOT()[0]->identify().stationNameString()[0]!='B') { - continue; - } - -// COLLECT RAW RPC HITS - std::vector<MuonCalibRawRpcHit *> raw_hits; - for (std::vector<MuonCalibRawRpcHit *>::const_iterator it1=raw_RPC_begin_it; it1!=raw_RPC_end_it; it1++) { - raw_hits.push_back(*it1); - } - - if(m_write_rpc_hits) fprintf(m_rpcHitsFile,"START %i %s %i %i\n", - event->eventInfo().eventNumber(), - it->second->mdtHOT()[0]->identify().stationNameString().c_str(), - it->second->mdtHOT()[0]->identify().phi(), - it->second->mdtHOT()[0]->identify().eta()); - -// reconstruct the second coordinate // - if (!handleRPChits(*(it->second), raw_hits)) { - to_delete.insert(it->first); - } - - } - - for(std::set<NtupleStationId> :: const_iterator it=to_delete.begin(); it!=to_delete.end(); it++) { - segments.erase(segments.find(*it)); - } - - return; -} //end BarrelSecondCoordinatePreparationTool::prepareSegments - -//:::::::::::::::::::::::::: -//:: METHOD handleRPChits :: -//:::::::::::::::::::::::::: -bool BarrelSecondCoordinatePreparationTool::handleRPChits(MuonCalibSegment & MDT_segment, - std::vector<MuonCalibRawRpcHit *> & raw_hits) { - //Segment parameters - MuonFixedId seg_ID(MDT_segment.mdtHOT()[0]->identify()); - - Amg::Vector3D seg_pos(MDT_segment.position()); - Amg::Vector3D seg_dir(MDT_segment.direction()); - - Amg::Transform3D Segment2Global(MDT_segment.localToGlobal()); - Amg::Transform3D Global2Segment((MDT_segment.localToGlobal()).inverse()); - - if(m_write_rpc_hits) { - Amg::Vector3D old_point = Amg::Vector3D(seg_pos.x(), 0.0, seg_pos.z()); - Amg::Vector3D old_vector = Amg::Vector3D(seg_dir.x()/seg_dir.z(), 0, 1.0); - old_point = Segment2Global*old_point; - old_vector = Segment2Global.linear()*old_vector; - - fprintf(m_rpcHitsFile,"old_line: x=%11.3f y=%11.3f a=%10.5f\n", - old_point.x(), old_point.y(), old_vector.x()/old_vector.y()); - } - - int seg_sector_ind; //hardware phi-index - if(seg_ID.stationNameString()[2]=='L' || seg_ID.stationNameString()[2]=='R' || - seg_ID.stationNameString()[2]=='M') { - seg_sector_ind = 2*seg_ID.phi() - 1; - } else { - seg_sector_ind = 2*seg_ID.phi(); - } - - seg_pos[0]=0.; - if(std::isnan(seg_dir.y())) return false; - seg_dir[0]=0.; - seg_dir = seg_dir.unit(); - - /////////////////// - //Handle RPC hits// - /////////////////// - int old_name(0); - int old_phi(0); - int old_eta(0); - int old_R(0); - int num_total(0); - int num_current(0); - - std::vector<CLHEP::HepVector> RPChits; - std::vector<int> in_seg_sector; - std::vector<int> num_hits_same_layer; - - SG::ReadCondHandle<MuonGM::MuonDetectorManager> DetectorManagerHandle{m_DetectorManagerKey}; - const MuonGM::MuonDetectorManager* MuonDetMgr = DetectorManagerHandle.cptr(); - if(MuonDetMgr==nullptr){ - ATH_MSG_ERROR("Null pointer to the read MuonDetectorManager conditions object"); - return false; - } - - std::vector<MuonCalibRawRpcHit *>::iterator raw_it = raw_hits.begin(); - while (raw_it != raw_hits.end()) { - bool bad_hit = false; - MuonFixedId ID((*raw_it)->identify()); - if(ID.rpcMeasuresPhi() != 1) bad_hit = true; - - int sector_ind; //hardware phi-index - if(ID.stationNameString()[2]=='L' || ID.stationNameString()[2]=='R' || - ID.stationNameString()[2]=='M') { - sector_ind = 2*ID.phi() - 1; - } else { - sector_ind = 2*ID.phi(); - } - - int in_sector(2);//0-in the same sector; 1-in the adjacent sector; 2-other sectors - if(sector_ind==seg_sector_ind) in_sector=0; - if(std::abs(sector_ind-seg_sector_ind)==1) in_sector=1; - if(std::abs(sector_ind-seg_sector_ind)==15) in_sector=1; - - //RPC hits positions - Amg::Vector3D glb_pos((*raw_it)->globalPosition()); - Amg::Vector3D hit_pos(Global2Segment*glb_pos); - - CLHEP::HepVector p_x(3,0); - p_x[0] = hit_pos.x(); - p_x[1] = hit_pos.z(); - p_x[2] = ((*raw_it)->width())/3.464; - - //r-phi pattern - double diff; - diff = hit_pos.y() - (seg_pos.y() + (hit_pos.z()-seg_pos.z())*seg_dir.y()/seg_dir.z()); - if(!(std::abs(diff)<((*raw_it)->length()+400.0))) bad_hit = true; - - if(m_write_rpc_hits){ - if(ID.rpcMeasuresPhi()==1){ - fprintf(m_rpcHitsFile,"%i %i %i x=%11.3f y=%11.3f z=%11.3f %i\n", - ID.stationName(), ID.phi(), ID.eta(), glb_pos.x(), - glb_pos.y(), glb_pos.z(), int(bad_hit)); - } - } - - if(bad_hit) { - raw_it=raw_hits.erase(raw_it); - } else { - raw_it++; - RPChits.push_back(p_x); - in_seg_sector.push_back(in_sector); - //calculate number of hits in the same RPC layer (for downweighting) - num_hits_same_layer.push_back(1); - if(ID.stationName()==old_name && ID.phi()==old_phi && ID.eta()==old_eta && - ID.rpcDoubletR()==old_R) { - num_current++; - } else { - if(num_total) { - num_current++; - for(int m=(num_total-num_current); m<num_total; m++) { - num_hits_same_layer[m] = num_current; - } - } - num_current=0; - old_name = ID.stationName(); - old_phi = ID.phi(); - old_eta = ID.eta(); - old_R = ID.rpcDoubletR(); - } - num_total++; - } - } - - if(num_total) { - num_current++; - for(int m=(num_total-num_current); m<num_total; m++) { - num_hits_same_layer[m] = num_current; - } - } - - bool x_fit = false; - CLHEP::HepVector alph(2,0); - double ang_err(100.0); - if(!rpcFit(RPChits, in_seg_sector, num_hits_same_layer, 25.0, alph, ang_err) - && ang_err<0.05) x_fit=true; - - if(!x_fit) return false; - - // update second coordinate for MDT hits - for (unsigned int l=0; l<MDT_segment.mdtHOT().size(); l++) { - MuonFixedId ID(MDT_segment.mdtHOT()[l]->identify()); - Identifier atl_id = m_id_tool->fixedIdToId(ID); - const MuonGM::MdtReadoutElement *MdtRoEl = MuonDetMgr->getMdtReadoutElement(atl_id); - double tube_length(MdtRoEl->tubeLength(atl_id)); - - Amg::Vector3D loc_position(MDT_segment.mdtHOT()[l]->localPosition()); - double x_loc = alph[0] + alph[1]*loc_position.z(); - if(std::abs(x_loc)>(0.5*tube_length + 300.0)) { - return false; - } - if(std::abs(x_loc) > 0.5*tube_length) { - x_loc = 0.5*(std::abs(x_loc)/x_loc)*tube_length; - } - - loc_position[0]=(x_loc); - MDT_segment.mdtHOT()[l]->setLocalPos(loc_position); - MDT_segment.mdtHOT()[l]->setGlobalPos(Segment2Global*loc_position); - //set signal propagatino time - MDT_segment.mdtHOT()[l]->setDriftTime( MDT_segment.mdtHOT()[l]->driftTime() + MDT_segment.mdtHOT()[l]->propagationTime()); - MDT_segment.mdtHOT()[l]->setDistanceToReadout(MdtRoEl-> distanceFromRO( MDT_segment.mdtHOT()[l]->globalPosition(), atl_id)); - MDT_segment.mdtHOT()[l]->setPropagationTime( (MDT_segment.mdtHOT()[l]->distanceToReadout() - tube_length/2.0) * 0.0033356409519815205); - MDT_segment.mdtHOT()[l]->setDriftTime( MDT_segment.mdtHOT()[l]->driftTime() - MDT_segment.mdtHOT()[l]->propagationTime()); - - } - - // update second coordinate for MDT segment - seg_pos[0]=(alph[0] + alph[1]*seg_pos.z()); - - seg_dir[0]=(alph[1]); - seg_dir[1]=(seg_dir.y()/seg_dir.z()); - seg_dir[2]=1.0; - - MDT_segment.set(MDT_segment.chi2(), seg_pos, seg_dir); - - if(m_write_rpc_hits) { - Amg::Vector3D fit_point = Amg::Vector3D(alph[0], 0, 0); - Amg::Vector3D fit_vector = Amg::Vector3D(alph[1], 0, 1.0); - fit_point = Segment2Global*fit_point; - fit_vector = Segment2Global*fit_vector; - - fprintf(m_rpcHitsFile,"fit_line: x=%11.3f y=%11.3f a=%10.5f\n", - fit_point.x(), fit_point.y(), fit_vector.x()/fit_vector.y()); - } - - return true; -} //end BarrelSecondCoordinatePreparationTool::handleRPChits - - -///////////////////////////////////////////// -// Fit by RPC hits // -///////////////////////////////////////////// -int BarrelSecondCoordinatePreparationTool::rpcFit(std::vector<CLHEP::HepVector> &RPC_hits, - std::vector<int> in_sect, std::vector<int> num_same, double max_r, - CLHEP::HepVector &tr_par, double &angle_err) { - int ierr(0); // Status of Matrix Inversion - - if(RPC_hits.size()<2) return -1; - - CLHEP::HepMatrix Gmm = CLHEP::HepMatrix(2,2,0); - CLHEP::HepVector bth = CLHEP::HepVector(2,0); - for(unsigned int j=0;j<RPC_hits.size();j++) { - CLHEP::HepVector dlt = CLHEP::HepVector(2,0); - dlt[0] = 1.0; - dlt[1] = RPC_hits[j][1]; - if(RPC_hits[j][2]<=0) RPC_hits[j][2]=10000.0; - double wght = 1.0/(RPC_hits[j][2]*RPC_hits[j][2]); - wght = wght/(double(num_same[j])); - if(in_sect[j]==1) wght = wght/4.0; - if(in_sect[j]==2) wght = wght/25.0; - if(in_sect[j]==3) wght = wght/100.0; - Gmm += wght*dlt*dlt.T(); - bth += wght*RPC_hits[j][0]*dlt; - } - - Gmm.invert(ierr); - if(ierr) { - ATH_MSG_ERROR( "Gmm matrix inversion ERROR:"<<ierr<<" Can't invert matrix" ); - return -1; - } - - tr_par = Gmm*bth; - - double tmp_cut(800.0); - int count(0); - - while(count!=2) { - bth[0]=0.0; - bth[1]=0.0; - Gmm[0][0]=0.0; - Gmm[0][1]=0.0; - Gmm[1][0]=0.0; - Gmm[1][1]=0.0; - - for(unsigned int j=0;j<RPC_hits.size();j++) { - double res = (tr_par[0] + tr_par[1]*RPC_hits[j][1] - RPC_hits[j][0])/RPC_hits[j][2]; - - double c_norm = 1.345; - double addweight; - if(std::abs(res)<c_norm) addweight=1; - else addweight=c_norm/std::abs(res); - - CLHEP::HepVector dlt = CLHEP::HepVector(2,0); - dlt[0] = 1.0; - dlt[1] = RPC_hits[j][1]; - if(RPC_hits[j][2]<=0) RPC_hits[j][2]=10000.0; - double wght = 1.0/(RPC_hits[j][2]*RPC_hits[j][2]); - wght = wght/(double(num_same[j])); - wght = wght*addweight; - if(in_sect[j]==1) wght = wght/4.0; - if(in_sect[j]==2) wght = wght/25.0; - if(in_sect[j]==3) wght = wght/100.0; - Gmm += wght*dlt*dlt.T(); - bth += wght*RPC_hits[j][0]*dlt; - } - - Gmm.invert(ierr); - if(ierr) { - ATH_MSG_ERROR( "Gmm matrix inversion ERROR:"<<ierr<<" Can't invert matrix" ); - return -1; - } - tr_par = Gmm*bth; - - for(unsigned int j=0;j<RPC_hits.size();j++) { - double res = (tr_par[0] + tr_par[1]*RPC_hits[j][1] - RPC_hits[j][0])/RPC_hits[j][2]; - if(std::abs(res)>3.0*tmp_cut && std::abs(res)>max_r) { - RPC_hits[j][2]=100000.0; - } - } - if(tmp_cut<=max_r) { - count++; - } - tmp_cut = 0.5*tmp_cut; - } - - if(Gmm[1][1]<0) return -2; - angle_err = std::sqrt(Gmm[1][1]); - - return 0; -} //end BarrelSecondCoordinatePreparationTool::rpcFit diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/src/CalibNtupleAnalysisAlg2.cxx b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/src/CalibNtupleAnalysisAlg2.cxx deleted file mode 100644 index b6d2a77fae8fa65a42fc17eb27a8378b10b87e6e..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/src/CalibNtupleAnalysisAlg2.cxx +++ /dev/null @@ -1,138 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -//MuonCalibEventBase -#include "MuonCalibEventBase/MuonCalibSegment.h" -#include "MuonCalibEventBase/MuonCalibEvent.h" - -//MdrCalibRt -#include "MdtCalibRt/RtCalibrationOutput.h" - -//this -#include "CalibNtupleAnalysisAlg/CalibNtupleAnalysisAlg2.h" - -//MuonCalibStandAloneBase -#include "MuonCalibStandAloneBase/NtupleCalibrationTool.h" -#include "MuonCalibStandAloneBase/MdtStationT0Container.h" -#include "MuonCalibStandAloneBase/NtupleCalibrationTool.h" - -//MdtCalibIOSvc -#include "MdtCalibIOSvc/MdtCalibOutputDbSvc.h" -#include "MdtCalibIOSvc/MdtCalibInputSvc.h" - -namespace MuonCalib { - -CalibNtupleAnalysisAlg2::CalibNtupleAnalysisAlg2(const std::string &name, ISvcLocator *pSvcLocator) : AthAlgorithm(name, pSvcLocator), -m_calib_tool_handle("MuonCalib::NtupleRunScanTool"), m_num_segments(-1), m_dbservice("MdtCalibOutputDbSvc", name), -m_calib_input_svc("MdtCalibInputSvc", name), p_calib_tool(NULL), m_crash_if_no_segments(false), m_eventnumber(0) { - declareProperty("CalibrationTool", m_calib_tool_handle); - declareProperty("CalibSegmentPreparationTools", m_seg_prep_tool_handles); - declareProperty("NumberOfSegments", m_num_segments); - declareProperty("CrashIfNoSegments", m_crash_if_no_segments); - declareProperty("MdtCalibOutputDbSvc", m_dbservice); - declareProperty("MdtCalibInputSvc", m_calib_input_svc); -} - -CalibNtupleAnalysisAlg2::~CalibNtupleAnalysisAlg2() { -} - -StatusCode CalibNtupleAnalysisAlg2::initialize() { -//greet user -// ATH_MSG_INFO( "Thank you for using CalibNtupleAnalysisAlg2!" ); -//get MdtCalibOutptSvc - ATH_CHECK( m_dbservice.retrieve() ); - ATH_MSG_INFO( "Retrieved MdtCalibOutputDbSvc"); -//get MdtCalibInputSvc - ATH_CHECK( m_calib_input_svc.retrieve() ); - ATH_MSG_INFO( "Retrieved MdtCalibInputSvc"); -//create the segment preparation tools - ATH_CHECK( m_seg_prep_tool_handles.retrieve() ); - for (unsigned int k=0; k<m_seg_prep_tool_handles.size(); k++) { - ATH_MSG_INFO( m_seg_prep_tool_handles[k].type() << " retrieved" ); - } - ATH_CHECK( m_calib_tool_handle.retrieve(p_calib_tool) ); - ATH_MSG_INFO( "Retrieved Tool " << m_calib_tool_handle.type() ); - - return StatusCode::SUCCESS; -} //end CalibNtupleAnalysisAlg2::initialize - -StatusCode CalibNtupleAnalysisAlg2::execute() { -////////////////////////////////////////////// -//run calibration segment preparation tools // -////////////////////////////////////////////// - const MuonCalibEvent *event(NULL); - std::map<NtupleStationId, MuonCalibSegment *> segments; - m_eventnumber = 0; - while(1) { -// Print number of segments every 1k events for first 20k events, then every 10k to avoid maxing out number of allowed messages - if( (m_eventnumber < 20000 && m_eventnumber%1000 == 0) || m_eventnumber%10000 == 0 ) { - ATH_MSG_INFO( m_eventnumber << " events read, " << m_stored_segment.size() << " segments collected" ); - } - if (static_cast<int>(m_stored_segment.size()) >= m_num_segments && m_num_segments>=0) { - ATH_MSG_INFO( "Enough segments collected!" ); - return StatusCode::SUCCESS; - } - segments.clear(); - for (unsigned int k=0; k<m_seg_prep_tool_handles.size(); k++) { - m_seg_prep_tool_handles[k]->prepareSegments(event, segments); - if(event==NULL) { - return StatusCode::SUCCESS; - } - } - int current_pos = m_stored_segment.size(); - for(std::map<NtupleStationId, MuonCalibSegment *>::const_iterator it=segments.begin(); it!= segments.end(); it++) { - if(p_calib_tool->KeepSegments()) { - m_stored_segment.push_back(new MuonCalibSegment(*(it->second))); - } else { - m_stored_segment.push_back(it->second); - } - } - ATH_CHECK( p_calib_tool->handleEvent(*event, m_eventnumber, m_stored_segment, current_pos) ); - m_eventnumber++; - } - return StatusCode::SUCCESS; -} //end CalibNtupleAnalysisAlg2::execute - -StatusCode CalibNtupleAnalysisAlg2::finalize() { - if(m_stored_segment.size()==0) { - if(m_crash_if_no_segments) { - ATH_MSG_FATAL("No Segments found!"); - return StatusCode::FAILURE; - } else { - ATH_MSG_WARNING("No Segments found!"); - return StatusCode::SUCCESS; - } - } -// Final tally of events/segments - ATH_MSG_INFO( m_eventnumber << " events read, " << m_stored_segment.size() << " segments collected" ); - - ATH_CHECK( p_calib_tool->analyseSegments(m_stored_segment) ); -//special sausage for resolution fitters - const IRtResolution *resolution(p_calib_tool->getResolution()); - if(resolution != NULL) { - ATH_MSG_INFO( "Storing resolution calibration!" ); - const IRtRelation *rt_rel(m_calib_input_svc->GetRtRelation()); - if(rt_rel == NULL) { - ATH_MSG_FATAL( "Cannot store a resolution without an rt-relation!" ); - return StatusCode::FAILURE; - } - RtCalibrationOutput *output(new RtCalibrationOutput(rt_rel, new RtFullInfo(std::string("Resolution"), 1, m_stored_segment.size(), 0.0, 0.0, 0.0, 0.0))); - m_dbservice->memorize(output, resolution); - } else { - ATH_MSG_INFO( "Storing calibration!" ); - const IMdtCalibrationOutput *calib_res(p_calib_tool->getResults()); - if(calib_res == NULL) { - ATH_MSG_WARNING( "Calibration Tool returned NULL-Pointer to Calibration Results!" ); - return StatusCode::SUCCESS; - } - if(! m_dbservice.empty() ) { - m_dbservice->memorize(p_calib_tool->getResults()); - } - } -// ATH_MSG_INFO( "Bye!" ); -// m_calibration_programme->endOfData(); - return StatusCode::SUCCESS; -} //end CalibNtupleAnalysisAlg2::finalize - -} //namespace MuonCalib diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/src/CalibNtupleLoader.cxx b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/src/CalibNtupleLoader.cxx deleted file mode 100644 index c07cf88bc700d572631e07750a3f8fbf9b227a4b..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/src/CalibNtupleLoader.cxx +++ /dev/null @@ -1,244 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -//this -#include "CalibNtupleAnalysisAlg/CalibNtupleLoader.h" - -//CalibNtupleReader -#include "CalibNtupleReader/NTReader.h" - -//MuonCalibStandAloneBase -#include "MuonCalibStandAloneBase/RegionSelectionSvc.h" - -//MuonCalibEventBase -#include "MuonCalibEventBase/MuonCalibEventInfo.h" - -// StoreGateSvc, IncidentSvc -#include "GaudiKernel/IIncidentSvc.h" -#include "GaudiKernel/Incident.h" -#include "GaudiKernel/ThreadLocalContext.h" - -// Athena EventInfo -#include "EventInfo/EventType.h" -#include "EventInfo/EventInfo.h" -#include "EventInfo/EventID.h" - -//root -#include "TChain.h" -#include "TFile.h" -#include "TKey.h" - -//c - c++ -#include "fstream" - -namespace MuonCalib { - -/////////////////////// -// CalibNtupleLoader // -/////////////////////// -CalibNtupleLoader::CalibNtupleLoader(const std::string &t, const std::string &n, const IInterface *p): - AthAlgTool(t, n, p), m_prev_event_nr(-1), m_prev_run_nr(0), m_reg_sel_svc("RegionSelectionSvc", n), - m_incSvc("IncidentSvc", n) { - m_filelist="file_list.txt"; - declareProperty("FileList", m_filelist); - m_first = 0; - declareProperty("FirstEvent", m_first); - m_last = -1; - declareProperty("LastEvent", m_last); - m_ntuple_type="AUTO"; - declareProperty("NtupleType", m_ntuple_type); - m_skip_double_events = false; - declareProperty("SkipDoubleEvents", m_skip_double_events); - declareProperty("RegionSelectionSvc", m_reg_sel_svc); - declareProperty("IncidentSvc", m_incSvc); - declareInterface< CalibSegmentPreparationTool >(this); -} - -//////////////// -// initialize // -//////////////// -StatusCode CalibNtupleLoader::initialize(void) { - ATH_MSG_INFO( "Filelist is '"<<m_filelist<<"'" ); - //convert Ntuple Type - if(m_ntuple_type == "AUTO") { - m_ntuple_type_num = 0; - } else if (m_ntuple_type == "NORMAL") { - m_ntuple_type_num = 1; - } else if (m_ntuple_type == "REGION") { - m_ntuple_type_num = 2; - } else { - ATH_MSG_FATAL("Invalid ntuple type. Must be AUTO/NORMAL/REGION!"); - return StatusCode::FAILURE; - } -//read filelist an build chain - m_chain = new TChain("/PatternNtupleMaker/Segments"); - std::string sdummy; - int count(0); - std::ifstream fl(m_filelist.c_str()); - if(fl.fail()) { - ATH_MSG_INFO( "Cannot open file '"<<m_filelist<<"' for reading!" ); - return StatusCode::FAILURE; - } - while (!fl.eof()) { - fl >> sdummy; - if (fl.eof()) break; - if (sdummy=="[") { - ATH_CHECK( read_dictionary(fl,count) ); - continue; - } - bool is_region(false); - if(m_ntuple_type_num == 2) is_region = true; - if(m_ntuple_type_num == 0) { - TFile *testf=TFile::Open(sdummy.c_str()); - if(!testf) { - ATH_MSG_WARNING( "Cannot open file '"<<sdummy.c_str()<<"'" ); - continue; - } - if(testf->GetKey("PatternNtupleMaker") == NULL) { - is_region = true; - } else { - is_region = false; - } - delete testf; - } - if (is_region) { - std::list<std::string> dummy_lst; - if(m_reg_sel_svc.empty()) { - ATH_CHECK( m_reg_sel_svc.retrieve() ); - } - ATH_MSG_INFO( "Added "<<m_reg_sel_svc->AddRegionNtuples(sdummy.c_str(), m_chain, dummy_lst)<<" regions from file "<<sdummy ); - } else { - m_chain->AddFile(sdummy.c_str()); - ATH_MSG_INFO( "Added file '"<<sdummy<<"' to filelist!" ); - } - count++; - } - if(count==0) { - ATH_MSG_FATAL( "No files in filelist!" ); - return StatusCode::FAILURE; - } - m_reader = new NTReader(m_chain); - - // retrieve IncidentService to fire Incidents after changing EventInfo - ATH_CHECK( m_incSvc.retrieve() ) ; - - return StatusCode::SUCCESS; -} //end CalibNtupleLoader::initialize - -///////////////////// -// prepareSegments // -///////////////////// -void CalibNtupleLoader::prepareSegments(const MuonCalibEvent *&event, std::map<NtupleStationId, MuonCalibSegment *> & /*segments*/) { - if(m_last>0 && m_last<=m_first) { - ATH_MSG_INFO( "Enough events read!" ); - event=NULL; - return; - } - event = &(m_reader->getEvent(m_first)); - if (event->rawHitCollection()==NULL) { - ATH_MSG_INFO( "End of file reached" ); - event=NULL; - return; - } - if(m_skip_double_events) { - while(static_cast<int>(event->eventInfo().eventNumber()) == m_prev_event_nr) { - m_first++; - if(m_last>0 && m_last<=m_first) { - ATH_MSG_INFO( "Enough events read!" ); - event=NULL; - return; - } - event = &(m_reader->getEvent(m_first)); - if (event->rawHitCollection()==NULL) { - ATH_MSG_INFO( "End of file reached" ); - event=NULL; - return; - } - } - } - m_prev_event_nr = event->eventInfo().eventNumber(); - m_first++; - - // get the current EventInfo from StoreGateSvc - const EventInfo *currentEvent(NULL) ; - StatusCode sc = evtStore()->retrieve(currentEvent) ; - if ( sc.isFailure() ) { - ATH_MSG_INFO( "Couldnt retrieve EventInfo from StoreGateSvc" ); - event = NULL ; - return ; - } - - // Fire the EndEvent incident; this is normally done by the - // AthenaEventLoopMgr after calling the "execute" method of all - // Algorithms - m_incSvc->fireIncident(Incident(name(),IncidentType::EndEvent,Gaudi::Hive::currentContext())); - - // Change the EventInfo in StoreGate to the correct info from - // the event in the ntuple - EventInfo *nonconst_currentEvent = - const_cast<EventInfo*>(currentEvent) ; - nonconst_currentEvent->event_ID()->set_run_number(event->eventInfo().runNumber()); - nonconst_currentEvent->event_ID()->set_event_number(event->eventInfo().eventNumber()); - nonconst_currentEvent->event_ID()->set_time_stamp(event->eventInfo().timeStamp()); - - ATH_MSG_DEBUG( "Hacked Run.Event,Time: " - << "[" << currentEvent->event_ID()->run_number() - << "." << currentEvent->event_ID()->event_number() - << "," << currentEvent->event_ID()->time_stamp() - << "]" ); - - // Fire EndRun and BeginRun Incidents if the run number changed - if ( event->eventInfo().runNumber() != m_prev_run_nr ) { - m_prev_run_nr = event->eventInfo().runNumber() ; - m_incSvc->fireIncident(Incident(name(),"EndRun")); - m_incSvc->fireIncident(Incident(name(),IncidentType::BeginRun,Gaudi::Hive::currentContext())); - } - - // Fire BeginEvent Incident - m_incSvc->fireIncident(Incident(name(),IncidentType::BeginEvent,Gaudi::Hive::currentContext())); - -} //end CalibNtupleLoader::prepareSegments - -inline StatusCode CalibNtupleLoader::read_dictionary(std::istream &fl, int &tot_count) { - MsgStream log(msgSvc(), name()); - std::string filename; - fl>>filename; - if(fl.eof()) { - ATH_MSG_FATAL( "Filelist has wrong format" ); - return StatusCode::FAILURE; - } -//read regions - int count=0; - std::list<std::string> regions; - while(1) { - std::string region; - fl>>region; - if(region=="]") { - break; - } - if(fl.eof()) { - ATH_MSG_FATAL( "Filelist has wrong format" ); - return StatusCode::FAILURE; - } - if (region=="PatternNtupleMaker") { - m_chain->AddFile(filename.c_str()); - count++; - } else { - regions.push_back(region); - } - } - if(regions.size()>0) { - if(m_reg_sel_svc.empty()) { - ATH_CHECK( m_reg_sel_svc.retrieve() ); - } - count+=m_reg_sel_svc->AddRegionNtuples(filename.c_str(), m_chain, regions); - } - if (count>0) { - ATH_MSG_INFO( "Added " << count << " regions from "<< filename ); - } - tot_count+=count; - return StatusCode::SUCCESS; -} //end CalibNtupleLoader::read_dictionary - -} //namespace MuonCalib diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/src/GeoDraw.cxx b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/src/GeoDraw.cxx deleted file mode 100644 index 2b3e5f723b2127a33a5e3374b66e46c8a27aef06..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/src/GeoDraw.cxx +++ /dev/null @@ -1,179 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -#include "CalibNtupleAnalysisAlg/GeoDraw.h" -#include "MuonCalibIdentifier/MuonFixedId.h" -#include "CLHEP/Geometry/Transform3D.h" -#include "CLHEP/Geometry/Point3D.h" -#include "MdtStationGeometryRow.h" -#include "GaudiKernel/MsgStream.h" -#include "AthenaKernel/getMessageSvc.h" - -#include "TTree.h" -#include "TFile.h" -#include "TDirectory.h" -#include "MdtStationGeometryRow.h" -#include "iostream" - -namespace MuonCalib { - -inline unsigned int get_station_id(unsigned int &tube_id) { - MuonFixedId id(tube_id); - return id.mdtChamberId().getIdInt(); -} - -class GeoDraw_Data { -public: - std::map<unsigned int, HepGeom::Point3D<double> > tube_positions; - std::map<unsigned int, HepGeom::Transform3D> local_to_global; - std::map<unsigned int, HepGeom::Transform3D> global_to_local; -}; - -GeoDraw_Data *GeoDraw::s_data = NULL; - -void GeoDraw::Load(const char *filename) { - if(s_data) delete s_data; - s_data = new GeoDraw_Data(); - TDirectory *lastdir=gDirectory; - TFile inf(filename); - TTree *mdt_tubes=dynamic_cast<TTree *>(inf.Get("mdt_tubes")); - if(!mdt_tubes) return; - UInt_t id; - Float_t pos_x, pos_y, pos_z; - mdt_tubes->SetBranchAddress("id", &id); - mdt_tubes->SetBranchAddress("pos_x", &pos_x); - mdt_tubes->SetBranchAddress("pos_y", &pos_y); - mdt_tubes->SetBranchAddress("pos_z", &pos_z); - TNamed *ATLASVersion = dynamic_cast<TNamed *>(inf.Get("ATLASVersion")); - MsgStream log(Athena::getMessageSvc(),"GeoDraw"); - if (ATLASVersion) log<<MSG::INFO<<"Reading geometry "<<ATLASVersion->GetTitle()<<endmsg; - log<<MSG::INFO<<"Loading "<<mdt_tubes->GetEntries()<<" tubes"<<endmsg; - for(int i=0; i<mdt_tubes->GetEntries(); i++) { - mdt_tubes->GetEntry(i); - s_data->tube_positions[id].setX(pos_x); - s_data->tube_positions[id].setY(pos_y); - s_data->tube_positions[id].setZ(pos_z); - } - - TTree *mdt_station=dynamic_cast<TTree *>(inf.Get("mdt_station")); - if (!mdt_station) return; - MdtStationGeometryRow row; - row.SetBranchAddress(mdt_station); - mdt_station->SetBranchAddress("id", &id); - log<<MSG::INFO<<"Loading "<<mdt_station->GetEntries()<<" stations"<<endmsg; - for(int i=0; i<mdt_station->GetEntries(); i++) { - mdt_station->GetEntry(i); - s_data->local_to_global[id] = row.GetTransform(); - s_data->global_to_local[id] = s_data->local_to_global[i].inverse(); - } - lastdir->cd(); -} //end GeoDraw::Load - -double GeoDraw::PosX(unsigned int tube_id) { - std::map<unsigned int, HepGeom::Point3D<double> >::const_iterator it(s_data->tube_positions.find(tube_id)); - if(it==s_data->tube_positions.end()) { - MsgStream log(Athena::getMessageSvc(),"GeoDraw"); - log<<MSG::WARNING<<"Tube not found"<<endmsg; - return 9e9; - } - return it->second.x(); -} - -double GeoDraw::PosY(unsigned int tube_id) { - std::map<unsigned int, HepGeom::Point3D<double> >::const_iterator it(s_data->tube_positions.find(tube_id)); - if(it==s_data->tube_positions.end()) { - MsgStream log(Athena::getMessageSvc(),"GeoDraw"); - log<<MSG::WARNING<<"Tube not found"<<endmsg; - return 9e9; - } - return it->second.y(); -} - -double GeoDraw::PosZ(unsigned int tube_id) { - std::map<unsigned int, HepGeom::Point3D<double> >::const_iterator it(s_data->tube_positions.find(tube_id)); - if(it==s_data->tube_positions.end()) { - MsgStream log(Athena::getMessageSvc(),"GeoDraw"); - log<<MSG::WARNING<<"Tube not found"<<endmsg; - return 9e9; - } - return it->second.z(); -} - -double GeoDraw::GPosX(unsigned int tube_id) { - unsigned int station_id(get_station_id(tube_id)); - std::map<unsigned int, HepGeom::Transform3D>::const_iterator tr_it(s_data->local_to_global.find(station_id)); - if(tr_it==s_data->local_to_global.end()) return -9e9; - std::map<unsigned int, HepGeom::Point3D<double> >::const_iterator it(s_data->tube_positions.find(tube_id)); - if(it==s_data->tube_positions.end()) return 9e9; - return (tr_it->second * it->second).x(); -} - -double GeoDraw::GPosY(unsigned int tube_id) { - unsigned int station_id(get_station_id(tube_id)); - std::map<unsigned int, HepGeom::Transform3D>::const_iterator tr_it(s_data->local_to_global.find(station_id)); - if(tr_it==s_data->local_to_global.end()) return -9e9; - std::map<unsigned int, HepGeom::Point3D<double> - >::const_iterator it(s_data->tube_positions.find(tube_id)); - if(it==s_data->tube_positions.end()) return 9e9; - return (tr_it->second * it->second).y(); -} - -double GeoDraw::GPosZ(unsigned int tube_id) { - unsigned int station_id(get_station_id(tube_id)); - std::map<unsigned int, HepGeom::Transform3D>::const_iterator tr_it(s_data->local_to_global.find(station_id)); - if(tr_it==s_data->local_to_global.end()) return -9e9; - std::map<unsigned int, HepGeom::Point3D<double> >::const_iterator it(s_data->tube_positions.find(tube_id)); - if(it==s_data->tube_positions.end()) return 9e9; - return (tr_it->second * it->second).z(); -} - -double GeoDraw::LocalToGlobalX(unsigned int id, double x, double y, double z) { - unsigned int station_id(get_station_id(id)); - std::map<unsigned int, HepGeom::Transform3D>::const_iterator tr_it(s_data->local_to_global.find(station_id)); - if(tr_it==s_data->local_to_global.end()) return -9e9; - HepGeom::Point3D<double> p(x, y, z); - return (tr_it->second * p).x(); -} - -double GeoDraw::LocalToGlobalY(unsigned int id, double x, double y, double z) { - unsigned int station_id(get_station_id(id)); - std::map<unsigned int, HepGeom::Transform3D>::const_iterator tr_it(s_data->local_to_global.find(station_id)); - if(tr_it==s_data->local_to_global.end()) return -9e9; - HepGeom::Point3D<double> p(x, y, z); - return (tr_it->second * p).y(); -} - -double GeoDraw::LocalToGlobalZ(unsigned int id, double x, double y, double z) { - unsigned int station_id(get_station_id(id)); - std::map<unsigned int, HepGeom::Transform3D>::const_iterator tr_it(s_data->local_to_global.find(station_id)); - if(tr_it==s_data->local_to_global.end()) return -9e9; - HepGeom::Point3D<double> p(x, y, z); - return (tr_it->second * p).z(); -} - -double GeoDraw::GlobalToLocalX(unsigned int id, double x, double y, double z) { - unsigned int station_id(get_station_id(id)); - std::map<unsigned int, HepGeom::Transform3D>::const_iterator tr_it(s_data->global_to_local.find(station_id)); - if(tr_it==s_data->global_to_local.end()) return -9e9; - HepGeom::Point3D<double> p(x, y, z); - return (tr_it->second * p).x(); -} - -double GeoDraw::GlobalToLocalY(unsigned int id, double x, double y, double z) { - unsigned int station_id(get_station_id(id)); - std::map<unsigned int, HepGeom::Transform3D>::const_iterator tr_it(s_data->global_to_local.find(station_id)); - if(tr_it==s_data->global_to_local.end()) return -9e9; - HepGeom::Point3D<double> p(x, y, z); - return (tr_it->second * p).y(); -} - -double GeoDraw::GlobalToLocalZ(unsigned int id, double x, double y, double z) { - unsigned int station_id(get_station_id(id)); - std::map<unsigned int, HepGeom::Transform3D>::const_iterator tr_it(s_data->global_to_local.find(station_id)); - if(tr_it==s_data->global_to_local.end()) return -9e9; - HepGeom::Point3D<double> p(x, y, z); - return (tr_it->second * p).z(); -} - -} //namespace MuonCalib diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/src/GoodRunListFilter.cxx b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/src/GoodRunListFilter.cxx deleted file mode 100644 index 593baceb749ed79a34e2d2e5df780bce4a7ee238..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/src/GoodRunListFilter.cxx +++ /dev/null @@ -1,33 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -//this -#include "CalibNtupleAnalysisAlg/GoodRunListFilter.h" - -//GoodRunsLists -#include "GoodRunsLists/IGoodRunsListSelectorTool.h" - -//MuonCalibEventBase -#include "MuonCalibEventBase/MuonCalibEvent.h" -#include "MuonCalibEventBase/MuonCalibEventInfo.h" -namespace MuonCalib { - -GoodRunListFilter::GoodRunListFilter(const std::string &t, const std::string &n, const IInterface *p): AthAlgTool(t, n, p) { - declareProperty("GoodRunListTool", m_good_runlist_tool); - declareInterface< CalibSegmentPreparationTool >(this); -} - -StatusCode GoodRunListFilter::initialize(void) { - ATH_CHECK( m_good_runlist_tool.retrieve() ); - return StatusCode::SUCCESS; -} - -void GoodRunListFilter::prepareSegments(const MuonCalibEvent *&event, std::map<NtupleStationId, MuonCalibSegment *> &segments) { - const MuonCalibEventInfo &event_info=event->eventInfo(); - if(!m_good_runlist_tool->passRunLB(event_info.runNumber(), event_info.lumiBlock())) { - segments.clear(); - } -} - -} //namespace MuonCalib diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/src/InitialDqFilter.cxx b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/src/InitialDqFilter.cxx deleted file mode 100644 index 9334f30678e3b8142248fc3beccf616fad0671c0..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/src/InitialDqFilter.cxx +++ /dev/null @@ -1,105 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -//this -#include "CalibNtupleAnalysisAlg/InitialDqFilter.h" - -//MuonCalibStandAloneBase -#include "MuonCalibStandAloneBase/RegionSelectionSvc.h" - -//MuonCalibEventBase -#include "MuonCalibEventBase/MuonCalibSegment.h" -#include "MuonCalibEventBase/MdtCalibHitBase.h" - -//MuonCalibIdentifier -#include "MuonCalibIdentifier/MuonFixedId.h" - -//c- c++ -#include "fstream" - - -namespace MuonCalib { - -InitialDqFilter::InitialDqFilter(const std::string &t, const std::string &n, const IInterface *p): AthAlgTool(t, n, p), m_reg_sel_svc("RegionSelectionSvc", n) { - m_initial_dq_path = "initial_dq.txt"; - declareProperty("RegionSelectionSvc", m_reg_sel_svc); - declareProperty("InitialDqFile", m_initial_dq_path); - declareInterface< CalibSegmentPreparationTool >(this); -} - -StatusCode InitialDqFilter::initialize(void) { -//get region selection svc - ATH_CHECK( m_reg_sel_svc.retrieve() ); -//read initial dq list - std::ifstream lst(m_initial_dq_path.c_str()); - if(!lst.good()) return StatusCode::FAILURE; - std::string station, s_name; - int ml, ly, tb, severity, dummy, eta, phi; - //read line - while(1) { - lst>>station; - if(!lst.good()) break; - lst>>ml; - if(!lst.good()) break; - lst>>ly; - if(!lst.good()) break; - lst>>tb; - if(!lst.good()) break; - lst>>severity; - if(!lst.good()) break; - lst>>dummy; - if(!lst.good()) break; - lst>>dummy; - if(!lst.good()) break; - if(severity<2) continue; - MuonFixedId id; - id.set_mdt(); - for(unsigned int i=0; i<station.size(); i++) - if(station[i]=='_') station[i]=' '; - std::istringstream st_stream(station); - st_stream>>s_name; - st_stream>>phi; - st_stream>>eta; - id.setStationName(id.stationStringToFixedStationNumber(s_name)); - id.setStationEta(eta); - id.setStationPhi(phi); - id.setMdtMultilayer(ml); - id.setMdtTubeLayer(ly); - id.setMdtTube(tb); - //only insert relevant tubes - if(!m_reg_sel_svc->isInRegion(id)) continue; - ATH_MSG_INFO( "Suppressing "<<s_name<<","<<phi<<","<<eta<<" ml="<<ml<<" ly="<<ly<<" tb="<<tb ); - m_suppressed_tubes.insert(id); - } - return StatusCode::SUCCESS; -} //end InitialDqFilter::initialize - -void InitialDqFilter::prepareSegments(const MuonCalibEvent *& /*event*/, -std::map<NtupleStationId, MuonCalibSegment *> &segments) { -//reject empty segments - std::set<NtupleStationId> empty_segments; - for(std::map<NtupleStationId, MuonCalibSegment *>::iterator it=segments.begin(); it!=segments.end(); it++) { - std::vector<unsigned int> new_selection; - bool is_empty(true); - for(MuonCalibSegment::MdtHitIt h_it=(it->second)->mdtHOTBegin(); h_it!=(it->second)->mdtHOTEnd(); h_it++) { - if (m_suppressed_tubes.find((*h_it)->identify()) == m_suppressed_tubes.end()) { - is_empty = false; - new_selection.push_back(0); - } else { - new_selection.push_back(1); - } - } - if(is_empty) { - empty_segments.insert(it->first); - } else { - it->second->refineMdtSelection(new_selection); - } - } - for(std::set<NtupleStationId> ::iterator it=empty_segments.begin(); it!=empty_segments.end(); it++) { - if(segments.find(*it)!=segments.end()) - segments.erase(segments.find(*it)); - } -} //end InitialDqFilter::prepareSegments - -}//namespace MuonClib diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/src/MdtStationGeometryRow.h b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/src/MdtStationGeometryRow.h deleted file mode 100644 index fe33c4fa81196a5ef56e3751f375b0766c03993d..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/src/MdtStationGeometryRow.h +++ /dev/null @@ -1,83 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef MuonCalib_MdtStationGeometryRow_h -#define MuonCalib_MdtStationGeometryRow_h - -#include "CLHEP/Geometry/Transform3D.h" -#include "CLHEP/Vector/Rotation.h" -#include "CLHEP/Vector/ThreeVector.h" -#include "GeoPrimitives/GeoPrimitives.h" -#include "TTree.h" - -namespace MuonCalib { - -class MdtStationGeometryRow { - public: - Float_t xx, xy, xz, - yx, yy, yz, - zx, zy, zz; - Float_t dx, dy, dz; - - inline void CreateBranches(TTree * tree) { - tree->Branch("xx", &xx, "xx/F"); - tree->Branch("xy", &xy, "xy/F"); - tree->Branch("xz", &xz, "xz/F"); - tree->Branch("yx", &yx, "yx/F"); - tree->Branch("yy", &yy, "yy/F"); - tree->Branch("yz", &yz, "yz/F"); - tree->Branch("zx", &zx, "zx/F"); - tree->Branch("zy", &zy, "zy/F"); - tree->Branch("zz", &zz, "zz/F"); - tree->Branch("dx", &dx, "dx/F"); - tree->Branch("dy", &dy, "dy/F"); - tree->Branch("dz", &dz, "dz/F"); - } - - inline void ReadHepTransform(const Amg::Transform3D &hep_transform) { - Amg::RotationMatrix3D hep_rot(hep_transform.rotation()); - Amg::Vector3D hep_trans(hep_transform.translation()); - xx = hep_rot.col(0).x(); - xy = hep_rot.col(0).y(); - xz = hep_rot.col(0).z(); - yx = hep_rot.col(1).x(); - yy = hep_rot.col(1).y(); - yz = hep_rot.col(1).z(); - zx = hep_rot.col(2).x(); - zy = hep_rot.col(2).y(); - zz = hep_rot.col(2).z(); - dx = hep_trans.x(); - dy = hep_trans.y(); - dz = hep_trans.z(); - } - - inline void SetBranchAddress(TTree * tree) { - tree->SetBranchAddress("xx", &xx); - tree->SetBranchAddress("xy", &xy); - tree->SetBranchAddress("xz", &xz); - tree->SetBranchAddress("yx", &yx); - tree->SetBranchAddress("yy", &yy); - tree->SetBranchAddress("yz", &yz); - tree->SetBranchAddress("zx", &zx); - tree->SetBranchAddress("zy", &zy); - tree->SetBranchAddress("zz", &zz); - tree->SetBranchAddress("dx", &dx); - tree->SetBranchAddress("dy", &dy); - tree->SetBranchAddress("dz", &dz); - } - - inline HepGeom::Transform3D GetTransform() { - CLHEP::Hep3Vector colx( xx ,xy, xz ); - CLHEP::Hep3Vector coly( yx, yy, yz ); - CLHEP::Hep3Vector colz( zx, zy, zz ); - CLHEP::HepRotation rotation( colx, coly, colz ); - CLHEP::Hep3Vector translation(dx, dy, dz); - HepGeom::Transform3D trans( rotation, translation ); - return trans; - } - -}; - -} //namespace MuonCalib -#endif diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/src/MdtTubeGeomertyRow.h b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/src/MdtTubeGeomertyRow.h deleted file mode 100644 index 228deff6d7d347f6c6187ae9f7fb057a90f4fd16..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/src/MdtTubeGeomertyRow.h +++ /dev/null @@ -1,20 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef MuonCalib__MdtTubeGeomertyRow_h -#define MuonCalib__MdtTubeGeomertyRow_h - -#include "TTree.h" - -namespace MuonCalib { - -class MdtTubeGeomertyRow { - public: - UInt_t tube_id; - Float_t pos_x, pos_y, pos_z; -}; - -} //namespace MuonCalib - -#endif diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/src/MuonCalibGeometryDumper.cxx b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/src/MuonCalibGeometryDumper.cxx deleted file mode 100644 index 185919a2438a9e6742794aea1fa0fd6227be58cb..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/src/MuonCalibGeometryDumper.cxx +++ /dev/null @@ -1,123 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -//this -#include "CalibNtupleAnalysisAlg/MuonCalibGeometryDumper.h" -#include "MdtTubeGeomertyRow.h" -#include "MdtStationGeometryRow.h" - - -#include <stdexcept> - -// MuonReadoutGeometry // -#include "MuonReadoutGeometry/MdtReadoutElement.h" -#include "MuonReadoutGeometry/MuonDetectorManager.h" - -#include "MuonCalibIdentifier/MuonFixedId.h" -#include "MuonCalibITools/IIdToFixedIdTool.h" - -//geomodel -#include "GeoModelInterfaces/IGeoModelSvc.h" - -//root -#include "TFile.h" -#include "TTree.h" -#include "TNamed.h" - - -namespace MuonCalib { - -MuonCalibGeometryDumper::MuonCalibGeometryDumper(const std::string &name, ISvcLocator *pSvcLocator) : - AthAlgorithm(name, pSvcLocator), - m_detMgr(nullptr), - m_id_tool(nullptr) { - - m_idToFixedIdToolType = std::string("MuonCalib::IdToFixedIdTool"); - declareProperty("idToFixedIdToolType", m_idToFixedIdToolType); - - m_idToFixedIdToolName = std::string("MuonCalib_IdToFixedIdTool"); - declareProperty("idToFixedIdToolName", m_idToFixedIdToolName); - - m_rootFile = "geom.root"; - declareProperty("RootFile", m_rootFile); - -} //end MuonCalibGeometryDumper::MuonCalibGeometryDumper - -StatusCode MuonCalibGeometryDumper::initialize() { - - ATH_CHECK(m_idHelperSvc.retrieve()); -// muon detector manager // - ATH_CHECK(detStore()->retrieve(m_detMgr)); - -// muon fixed id tool // - ATH_CHECK( toolSvc()->retrieveTool(m_idToFixedIdToolType, m_idToFixedIdToolName, m_id_tool)); - - const IGeoModelSvc *geoModel=nullptr; - ATH_CHECK( service ("GeoModelSvc", geoModel) ); - if (!geoModel) { - ATH_MSG_FATAL("Could not retrieve GeoModelSvc"); - return StatusCode::FAILURE; - } - - TFile *output_file = new TFile(m_rootFile.c_str(), "RECREATE"); - TNamed geometry_version("ATLASVersion", geoModel->atlasVersion().c_str()); - geometry_version.Write(); - dump_mdt_geometry(); - output_file->Write(); - return StatusCode::SUCCESS; -} //end MuonCalibGeometryDumper::initialize - -inline bool MuonCalibGeometryDumper::dump_mdt_geometry() { - MdtTubeGeomertyRow row; - TTree * mdt_tubes=new TTree("mdt_tubes", "mdt tubes"); - mdt_tubes->Branch("id", &row.tube_id, "id/i"); - mdt_tubes->Branch("pos_x", &row.pos_x, "pos_x/F"); - mdt_tubes->Branch("pos_y", &row.pos_y, "pos_y/F"); - mdt_tubes->Branch("pos_z", &row.pos_z, "pos_z/F"); - MdtStationGeometryRow station_row; - UInt_t station_id; - TTree * mdt_station = new TTree ("mdt_station", "mdt station"); - mdt_station->Branch("id", &station_id, "id/i"); - station_row.CreateBranches(mdt_station); -//loop on chambers - MdtIdHelper::const_id_iterator it = m_idHelperSvc->mdtIdHelper().module_begin(); - MdtIdHelper::const_id_iterator it_end = m_idHelperSvc->mdtIdHelper().module_end(); - for( ; it!=it_end;++it ) { - const MuonGM::MdtReadoutElement *detEl = m_detMgr->getMdtReadoutElement( m_idHelperSvc->mdtIdHelper().channelID(*it,1,1,1)); - if(!detEl) continue; - station_row.ReadHepTransform(detEl->AmdbLRSToGlobalTransform()); - MuonFixedId fixed_id(m_id_tool->idToFixedId(*it)); - station_id=fixed_id.mdtChamberId().getIdInt(); - mdt_station->Fill(); - //get number of mls; - int n_mls=m_idHelperSvc->mdtIdHelper().numberOfMultilayers(*it); - //loop on multilayers - for(int ml=1; ml<=n_mls; ml++) { - const MuonGM::MdtReadoutElement *detEl_ml = m_detMgr->getMdtReadoutElement(m_idHelperSvc->mdtIdHelper().channelID(*it,ml ,1,1)); - int n_layers=detEl_ml->getNLayers(); - for(int ly=1; ly<=n_layers; ly++) { - fillLayer(*it, detEl_ml, row, mdt_tubes, ml, ly); - } - } - } - return true; -} //end MuonCalibGeometryDumper::dump_mdt_geometry - -inline void MuonCalibGeometryDumper::fillLayer(const Identifier &ch_id, -const MuonGM::MdtReadoutElement *detEl, MdtTubeGeomertyRow &row, TTree *tree, const int &ml, const int &ly) { - int n_tubes=detEl->getNtubesperlayer(); - for(int tb=1; tb<=n_tubes; tb++) { - Identifier tid(m_idHelperSvc->mdtIdHelper().channelID(ch_id ,ml ,ly, tb)); - MuonFixedId fixed_id(m_id_tool->idToFixedId(tid)); - row.tube_id=fixed_id.getIdInt(); - Amg::Vector3D tube_pos_g=detEl->tubePos(ml, ly, tb); - Amg::Vector3D tube_pos_l=detEl->GlobalToAmdbLRSCoords(tube_pos_g); - row.pos_x=tube_pos_l.x(); - row.pos_y=tube_pos_l.y(); - row.pos_z=tube_pos_l.z(); - tree->Fill(); - } -} //end MuonCalibGeometryDumper::fillLayer - -} //namespace MuonCalib diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/src/SegmentRawdataSelector.cxx b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/src/SegmentRawdataSelector.cxx deleted file mode 100644 index c4babaddd65b46e374364fcf24d4e3025c2f694c..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/src/SegmentRawdataSelector.cxx +++ /dev/null @@ -1,160 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -//this -#include "CalibNtupleAnalysisAlg/SegmentRawdataSelector.h" - -//MuonCalibStandAloneBase -#include "MuonCalibStandAloneBase/RegionSelectionSvc.h" - -//MuonCalibEventBase -#include "MuonCalibEventBase/MuonCalibEvent.h" -#include "MuonCalibEventBase/MuonCalibSegment.h" -#include "MuonCalibEventBase/MuonCalibEvent.h" -#include "MuonCalibEventBase/MuonCalibPattern.h" -#include "MuonCalibEventBase/MuonCalibRawHitCollection.h" -#include "MuonCalibEventBase/MuonCalibRawMdtHit.h" -#include "MuonCalibEventBase/MuonCalibRawRpcHit.h" - -// MuonReadoutGeometry // -#include "MuonReadoutGeometry/MdtReadoutElement.h" - -// MuonCalib // -#include "MuonCalibITools/IIdToFixedIdTool.h" -namespace MuonCalib { - -/////////////////////////// -// SegmentRawdataSelector // -/////////////////////////// -SegmentRawdataSelector::SegmentRawdataSelector(const std::string &t, const std::string &n, const IInterface *p): - AthAlgTool(t, n, p), m_reg_sel_svc("RegionSelectionSvc", n), m_id_tool(nullptr) { - m_min_hits = 1; - declareProperty("MinHits", m_min_hits); - m_max_hits = -1; - declareProperty("MaxHits", m_max_hits); - m_adc_cut = 0; - declareProperty("AdcCut", m_adc_cut); - declareInterface< CalibSegmentPreparationTool >(this); - - m_idToFixedIdToolType = std::string("MuonCalib::IdToFixedIdTool"); - declareProperty("idToFixedIdToolType", m_idToFixedIdToolType); - - m_idToFixedIdToolName = std::string("MuonCalib_IdToFixedIdTool"); - declareProperty("idToFixedIdToolName", m_idToFixedIdToolName); - declareProperty("RegionSelectionSvc", m_reg_sel_svc); -} //end SegmentRawdataSelector::SegmentRawdataSelector - -//////////////// -// initialize // -//////////////// -StatusCode SegmentRawdataSelector::initialize(void) { - - ATH_CHECK(m_reg_sel_svc.retrieve()); - ATH_CHECK(m_idHelperSvc.retrieve()); - ATH_CHECK(m_DetectorManagerKey.initialize()); - ATH_CHECK(toolSvc()->retrieveTool(m_idToFixedIdToolType, m_idToFixedIdToolName, m_id_tool)); - - return StatusCode::SUCCESS; -} //end SegmentRawdataSelector::initialize - -void SegmentRawdataSelector::prepareSegments(const MuonCalibEvent *&event, std::map<NtupleStationId, MuonCalibSegment *> & segments) { - - SG::ReadCondHandle<MuonGM::MuonDetectorManager> DetectorManagerHandle{m_DetectorManagerKey}; - const MuonGM::MuonDetectorManager* MuonDetMgr = DetectorManagerHandle.cptr(); - if(MuonDetMgr==nullptr){ - ATH_MSG_ERROR("Null pointer to the read MuonDetectorManager conditions object"); - return; - } - -//delete old segments - for(std::set<MuonCalibSegment *>::iterator it=m_segments.begin(); it!=m_segments.end(); it++) { - delete (*it); - } - m_segments.clear(); - segments.clear(); - double TDC_to_ns(0.78125); - const MuonCalibRawHitCollection *raw_hits(event->rawHitCollection()); -// loop over the raw hits // - for (MuonCalibRawHitCollection::MuonCalibRawMdtHitVecCit it= - raw_hits->rawMdtHitCollectionBegin(); - it!=raw_hits->rawMdtHitCollectionEnd(); ++it) { - MuonCalibRawMdtHit *hit(*it); - //check for adc cut - if (hit->adcCount() < m_adc_cut) continue; - // get the raw hit and check whether it is in the calibration region // - if(!m_reg_sel_svc->isInRegion(hit->identify())) continue; - NtupleStationId station_identifier(hit->identify()); - station_identifier.SetMultilayer(0); - Identifier station_id = m_id_tool->fixedIdToId(hit->identify()); - const MuonGM::MdtReadoutElement *MdtRoEl = - MuonDetMgr->getMdtReadoutElement(m_idHelperSvc->mdtIdHelper().channelID(station_id, - hit->identify().mdtMultilayer(),hit->identify().mdtTubeLayer(),hit->identify().mdtTube())); - - if (MdtRoEl==0) { - continue; - } - // create a segment if necessary // - if (segments.find(station_identifier)==segments.end()) { - Amg::Vector3D local_pos=get_raw_position(hit, raw_hits, MdtRoEl-> GlobalToAmdbLRSTransform()); - segments[station_identifier] = - new MuonCalibSegment(1.0, - local_pos, - Amg::Vector3D(0.0, 0.0, 1.0), - MdtRoEl->AmdbLRSToGlobalTransform()); - } - Amg::Vector3D hit_position=hit->localPosition(); - hit_position[0]=(segments[station_identifier]->position()[0]); - MdtCalibHitBase *MDT_calib_hit(new MdtCalibHitBase( - hit->tdcCount(),hit->adcCount(),hit->globalPosition(),hit_position)); - MDT_calib_hit->setDriftTime(TDC_to_ns*hit->tdcCount()); - MDT_calib_hit->setTubeT0(0.0); - MDT_calib_hit->setDriftRadius(0.02*TDC_to_ns*hit->tdcCount(),0.2); - MDT_calib_hit->setIdentifier(hit->identify()); - MDT_calib_hit->setDistanceToReadout(0.0); - MDT_calib_hit->setPropagationTime(0.0); - segments[station_identifier]->addHitOnTrack(MDT_calib_hit); - } - std::set<NtupleStationId> to_delte; - for(std::map<NtupleStationId, MuonCalibSegment *>::iterator it=segments.begin(); it!=segments.end(); it++) { - if((static_cast<int>(it->second->hitsOnTrack()) > m_max_hits && m_max_hits>0)|| static_cast<int>(it->second->hitsOnTrack()) < m_min_hits) { - to_delte.insert(it->first); - } else { - m_segments.insert(it->second); - } - } - for(std::set<NtupleStationId> ::iterator it=to_delte.begin(); it!=to_delte.end(); it++) { - std::map<NtupleStationId, MuonCalibSegment *>::iterator map_it(segments.find(*it)); - if(map_it!=segments.end()) { - delete map_it->second; - segments.erase(map_it); - } - } -} //end SegmentRawdataSelector::prepareSegments - -inline const Amg::Vector3D SegmentRawdataSelector::get_raw_position(const MuonCalibRawMdtHit *hit, -const MuonCalibRawHitCollection *coll, const Amg::Transform3D &global_to_local) const { - double x_pos=0.0; - int n_rpc_hits=0; - int mdt_station=hit->identify().stationName(); - int mdt_eta=hit->identify().eta(); - int mdt_phi=hit->identify().phi(); - for(MuonCalibRawHitCollection::MuonCalibRawRpcHitVecCit it = coll->rawRpcHitCollectionBegin(); it != coll->rawRpcHitCollectionEnd(); it++) { - MuonCalibRawRpcHit *rpc_hit(*it); - //check that rpc and mdt hit are in the same chamber - if(mdt_station != rpc_hit->identify().stationName() || mdt_eta != rpc_hit->identify().eta() || mdt_phi != rpc_hit->identify().phi()) { - continue; - } - //we need only phi strips - if(rpc_hit->identify().rpcMeasuresPhi() == 0) continue; - Amg::Vector3D local_strip_pos = global_to_local*rpc_hit->globalPosition(); - x_pos += local_strip_pos.x(); - n_rpc_hits++; - } - if(n_rpc_hits>0) { - x_pos /= static_cast<double>(n_rpc_hits); - } - return Amg::Vector3D(x_pos, hit->localPosition().y(), hit->localPosition().z()); -} //end SegmentRawdataSelector::get_raw_position - -} // namespace Muoncalib diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/src/SegmentRecalibration.cxx b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/src/SegmentRecalibration.cxx deleted file mode 100644 index 17b8bff28ace0240c387f9dde46f606209af088d..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/src/SegmentRecalibration.cxx +++ /dev/null @@ -1,206 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -//this -#include "CalibNtupleAnalysisAlg/SegmentRecalibration.h" - -//MdtCalibData -#include "MdtCalibData/BFieldCorFunc.h" -#include "MdtCalibData/IRtResolution.h" -#include "MdtCalibData/IRtRelation.h" -#include "MdtCalibData/MdtSlewCorFuncHardcoded.h" -#include "MdtCalibData/RtScaleFunction.h" - - -//MuonCalibEventBase -#include "MuonCalibEventBase/MuonCalibSegment.h" -#include "MuonCalibEventBase/MuonCalibEvent.h" -#include "MuonCalibEventBase/MdtCalibHitBase.h" -#include "MuonCalibEventBase/MuonCalibTruthCollection.h" -#include "MuonCalibEventBase/MuonCalibMdtTruthHit.h" - -//MdtCalibIOSvc -#include "MdtCalibIOSvc/MdtCalibInputSvc.h" - -//MuonCalibStandAloneBase -#include "MuonCalibStandAloneBase/MdtStationT0Container.h" - -namespace MuonCalib { - -SegmentRecalibration::SegmentRecalibration(const std::string &t, const std::string &n, const IInterface *p): AthAlgTool(t, n, p), -m_calib_input_svc("MdtCalibInputSvc", n) { - m_t0_switch="LEAVE"; - declareProperty("T0Switch", m_t0_switch); - m_B_corr_switch="LEAVE"; - declareProperty("BSwitch", m_B_corr_switch); - m_recalc_r_switch=false; - declareProperty("RecalcR", m_recalc_r_switch); - m_use_true_r=false; - declareProperty("UseTrueR", m_use_true_r); - m_undo_refitted_t0 = -1; - declareProperty("UndoRefittedT0", m_undo_refitted_t0); - m_time_slwing_corr_switch="FILE"; - declareProperty("TimeSlewingSwitch", m_time_slwing_corr_switch); - m_rt_scaling_switch="LEAVE"; - declareProperty("RtMultilayerScaling", m_rt_scaling_switch); - p_ts_corr_func=NULL; - m_prop_factor=1.0; - declareProperty("PrpagationFactor", m_prop_factor); - declareProperty("MdtCalibInputSvc", m_calib_input_svc); - declareInterface< CalibSegmentPreparationTool >(this); -} //end SegmentRecalibration::SegmentRecalibration - -StatusCode SegmentRecalibration::initialize(void) { - //get calibration input service - ATH_CHECK( m_calib_input_svc.retrieve() ); -//convert threefold switch settings - if(!convert_switch(m_t0_switch, m_t0_numswitch, "t0")) { - return StatusCode::FAILURE; - } - if(!convert_switch(m_B_corr_switch, m_B_corr_numswitch, "B-field")) { - return StatusCode::FAILURE; - } - if(!convert_switch(m_time_slwing_corr_switch, m_time_slwing_numswitch, "time-slewing")) { - return StatusCode::FAILURE; - } - if(!convert_switch(m_rt_scaling_switch, m_rt_scaling_numswitch, "multilayer-scaling")) { - return StatusCode::FAILURE; - } - if(m_time_slwing_numswitch==2) { - CalibFunc::ParVec pv; - p_ts_corr_func = static_cast<IMdtSlewCorFunc *>(new MdtSlewCorFuncHardcoded(pv)); - } - return StatusCode::SUCCESS; -} //end SegmentRecalibration::SegmentRecalibration - -void SegmentRecalibration::prepareSegments(const MuonCalibEvent *&event, std::map<NtupleStationId, MuonCalibSegment *> &segments) { - const MdtStationT0Container *t0(NULL); - const BFieldCorFunc *B_corr(NULL); - const IRtResolution *spat_res(NULL); - const IRtRelation *rt_relation(NULL); - for(std::map<NtupleStationId, MuonCalibSegment *>::const_iterator it= segments.begin(); it!= segments.end(); it++) { - for(unsigned int j=0; j<it->second->mdtHitsOnTrack(); j++) { - //pointer and references - MdtCalibHitBase *hit = it->second->mdtHOT()[j]; - if(m_time_slwing_numswitch>0) { - hit->setDriftTime(hit->driftTime() + hit->slewingTime()); - hit->setSlewingTime(0); - } - if(m_prop_factor!=1.0) { - float old_prop_time(hit->propagationTime()); - float new_prop_time(old_prop_time/m_prop_factor); - hit->setPropagationTime(new_prop_time); - hit->setDriftTime(hit->driftTime() + old_prop_time - new_prop_time); - } - if(m_time_slwing_numswitch==2) { - hit->setSlewingTime(p_ts_corr_func->correction( hit->driftTime(), hit->adcCount())); - hit->setDriftTime(hit->driftTime() - hit->slewingTime()); - } - if(m_rt_scaling_numswitch>0 && hit->TemperatureTime() != MdtCalibHitBase::kNoValue) { - hit->setDriftTime(hit->driftTime() + hit->TemperatureTime()); - hit->setTemperatureTime(0); - } - const MuonFixedId & id(hit->identify()); - //undo refitted t0 - if((m_undo_refitted_t0<0 && hit->segmentT0Applied()) || m_undo_refitted_t0>0) { - hit->setDriftTime(hit->driftTime() + it->second->fittedT0()); - } - //overwrite t0 correction - if(m_t0_numswitch > 0 && hit->tubeT0() != MdtCalibHitBase::kNoValue) { - hit->setDriftTime(hit->driftTime() + hit->tubeT0()); - hit->setTubeT0(0.0); - } - if(m_t0_numswitch ==2) { - //get t0 if it was not already selected for this station - if((t0=m_calib_input_svc->GetT0(id)) == NULL) { - ATH_MSG_FATAL( "No t0 correction loaded for this chamber!" ); - event = NULL; - return; - } - hit->setDriftTime(hit->driftTime() - t0->t0(id.mdtMultilayer(), id.mdtTubeLayer(), id.mdtTube())); - hit->setTubeT0(t0-> t0(id.mdtMultilayer(), id.mdtTubeLayer(), id.mdtTube())); - } - //overwrite magnetic field correction of selected - if(m_B_corr_numswitch > 0 && hit->bFieldTime() != MdtCalibHitBase::kNoValue) { - hit->setDriftTime(hit->driftTime() + hit->bFieldTime()); - } - if(m_B_corr_numswitch == 2) { - if((B_corr = m_calib_input_svc->GetBCorr(id)) == NULL) { - ATH_MSG_FATAL( "No rt relation loaded for this chamber!" ); - event=NULL; - return; - } - hit->setBFieldTime(B_corr-> correction(hit->driftTime(), hit->bFieldPara(), hit->bFieldPerp())); - hit->setDriftTime(hit->driftTime() - hit->bFieldTime()); - } - if(m_rt_scaling_numswitch==2) { - if((rt_relation = m_calib_input_svc->GetRtRelation(id)) == NULL) { - ATH_MSG_FATAL( "No rt relation loaded for this chamber! Needed for scaling!" ); - event=NULL; - return; - } - double corr_val=RtScaleFunction(hit->driftTime(), id.mdtMultilayer()==2, *rt_relation); - hit->setTemperatureTime(corr_val); - hit->setDriftTime(hit->driftTime() - corr_val); - } - - //overwrite drift radius if selected - if(m_recalc_r_switch) { - if((rt_relation = m_calib_input_svc->GetRtRelation(id)) == NULL) { - ATH_MSG_FATAL( "No rt relation loaded for this chamber!" ); - event=NULL; - return; - } - if((spat_res = m_calib_input_svc->GetResolution(id)) == NULL) { - ATH_MSG_FATAL( "No rt relation loaded for this chamber!" ); - event=NULL; - return; - } - double dt=hit->driftTime(); - hit->setDriftRadius( rt_relation->radius(dt), spat_res->resolution(dt)); - } else { - //if drift radius is not recalculated re,ove sign from radius - hit-> setDriftRadius(std::abs(hit-> driftRadius()), hit->sigmaDriftRadius()); - } - if (m_use_true_r) { - double r=9e9; - const MuonCalibTruthCollection* tk= event->calibTruthCollection(); - for(MuonCalibTruthCollection::MdtTruthVecCit t_it=tk->mdtTruthCollectionBegin(); t_it!=tk->mdtTruthCollectionEnd(); t_it++) { - const MuonCalibMdtTruthHit *thit=*t_it; - if(hit->identify() == thit->identify()) { - r=thit->driftRadius(); - break; - } - } - if(r<8e8) { - hit->setDriftRadius(std::abs(r), hit->sigmaDriftRadius()); - } else { - hit->setDriftRadius(9e9, 9e9); - } - } - } - if(m_undo_refitted_t0) { - it->second->setFittedT0(0.0); - } - } -} //end SegmentRecalibration::prepareSegments - -inline bool SegmentRecalibration::convert_switch(const std::string &s_switch, int &num_switch, const char *switchname) const { - if(s_switch=="LEAVE") { - num_switch=0; - return true; - } - if(s_switch=="UNAPPLY") { - num_switch=1; - return true; - } - if(s_switch=="FILE") { - num_switch=2; - return true; - } - ATH_MSG_FATAL( "Invalid switch setting "<<s_switch<< " for "<< switchname<<"!" ); - return false; -} //end SegmentRecalibration::convert_switch - -} //namespace MuonCalib diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/src/SegmentRefitter.cxx b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/src/SegmentRefitter.cxx deleted file mode 100644 index cde7dd683290965be913eb1dfebfd7399ba379ef..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/src/SegmentRefitter.cxx +++ /dev/null @@ -1,109 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -//this -#include "CalibNtupleAnalysisAlg/SegmentRefitter.h" - -//MdtCalibFitters -#include "MdtCalibFitters/QuasianalyticLineReconstruction.h" -#include "MdtCalibFitters/StraightPatRec.h" - -//MuonCalibStandAloneBase -#include "MuonCalibStandAloneBase/T0Refinement.h" - -//MdtCalibData -#include "MdtCalibData/IRtResolution.h" - -//MdtCalibIOSvc -#include "MdtCalibIOSvc/MdtCalibInputSvc.h" - -//c - c++ -#include "set" -#include "iostream" - -namespace MuonCalib { - -SegmentRefitter::SegmentRefitter(const std::string &t, const std::string &n, const IInterface *p): AthAlgTool(t, n, p), -m_calib_input_svc("MdtCalibInputSvc", n) { - m_curved = false; - declareProperty("Curved", m_curved); - m_t0_refine = false; - declareProperty("RefineT0", m_t0_refine); - m_refine_hit_selection = true; - declareProperty("RefineHitSelection", m_refine_hit_selection); - m_road_width = 2.0; - declareProperty("RoadWidth", m_road_width); - m_time_out = 2.0; - declareProperty("TimeOut", m_time_out); - m_min_hits=0; - declareProperty("MinSegmentHits", m_min_hits); - m_max_hits=-1; - declareProperty("MaxSegmentHits", m_max_hits); - declareProperty("MdtCalibInputSvc", m_calib_input_svc); - declareInterface< CalibSegmentPreparationTool >(this); -} - -StatusCode SegmentRefitter::initialize(void) { - if(m_t0_refine) { - p_t0_refinement = new T0Refinement(); - p_t0_refinement->setTimeOut(m_time_out); - p_t0_refinement->setRoadWidth(m_road_width); - } else { - if(m_curved) { - CurvedPatRec *cfitter=new CurvedPatRec(); - cfitter->setTimeOut(m_time_out); - p_qfitter = cfitter; - } else { - p_qfitter = new StraightPatRec(); - } - p_qfitter->setRoadWidth(m_road_width); - p_qfitter->SetRefineSegmentFlag(m_refine_hit_selection); - } - ATH_CHECK( m_calib_input_svc.retrieve() ); - return StatusCode::SUCCESS; -} //end SegmentRefitter::initialize - -void SegmentRefitter::prepareSegments(const MuonCalibEvent *& /*event*/, std::map<NtupleStationId, MuonCalibSegment *> &segments) { - std::set<NtupleStationId> dropped_segments; - for(std::map<NtupleStationId, MuonCalibSegment *>::iterator it=segments.begin(); it!= segments.end(); it++) { - if(m_t0_refine) { - if(!refine_t0(it->second)) { - dropped_segments.insert(it->first); - } - } else { - if(!p_qfitter->fit(*it->second)) { - dropped_segments.insert(it->first); - } - } - int n_hits(static_cast<int>(it->second->hitsOnTrack())); - if((m_max_hits>0 && n_hits>m_max_hits) || n_hits<m_min_hits) { - dropped_segments.insert(it->first); - } - } - for(std::set<NtupleStationId>::iterator it=dropped_segments.begin(); it!=dropped_segments.end(); it++) { - std::map<NtupleStationId, MuonCalibSegment *>::iterator map_it(segments.find(*it)); - if(map_it!=segments.end()) { - segments.erase(map_it); - } - } -} //end SegmentRefitter::prepareSegments - -inline bool SegmentRefitter::refine_t0(MuonCalibSegment *&segment) { - double err; - bool failed; - p_t0_refinement->setRoadWidth(1.25*m_road_width); - p_t0_refinement->getDeltaT0(segment, m_calib_input_svc->GetRtRelation(segment->mdtHOT()[0]->identify()), true, err, failed, m_curved); - if (failed) return false; - p_t0_refinement->setRoadWidth(m_road_width); - p_t0_refinement->getDeltaT0(segment, m_calib_input_svc->GetRtRelation(segment->mdtHOT()[0]->identify()), true, err, failed, m_curved); - if (failed) return false; - for (unsigned int h=0; h<segment->mdtHitsOnTrack(); h++) { - const IRtResolution *resol( m_calib_input_svc->GetResolution( segment->mdtHOT()[h]->identify())); - double radius(segment->mdtHOT()[h]->driftRadius()); - segment->mdtHOT()[h]->setDriftRadius(radius, resol->resolution(segment->mdtHOT()[h]->driftTime())); - } - return true; -} //end SegmentRefitter::refine_t0 - -} //namespace MuonCalib diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/src/SegmentRegionSelector.cxx b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/src/SegmentRegionSelector.cxx deleted file mode 100644 index 00e7465529c70247211ed6c298b4e50656ebd6d3..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/src/SegmentRegionSelector.cxx +++ /dev/null @@ -1,103 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -//this -#include "CalibNtupleAnalysisAlg/SegmentRegionSelector.h" - -//MuonCalibStandAloneBase -#include "MuonCalibStandAloneBase/RegionSelectionSvc.h" - -//MuonCalibEventBase -#include "MuonCalibEventBase/MuonCalibEvent.h" -#include "MuonCalibEventBase/MuonCalibSegment.h" -#include "MuonCalibEventBase/MuonCalibEvent.h" -#include "MuonCalibEventBase/MuonCalibPattern.h" - -namespace MuonCalib { - -/////////////////////////// -// SegmentRegionSelector // -/////////////////////////// -SegmentRegionSelector::SegmentRegionSelector(const std::string &t, const std::string &n, const IInterface *p): AthAlgTool(t, n, p), -m_reg_sel_svc("RegionSelectionSvc", n) { - m_exclusive_segments = false; - declareProperty("ExclusiveSegments", m_exclusive_segments); - m_min_hits = 1; - declareProperty("MinHits", m_min_hits); - m_max_hits = 0; - declareProperty("MaxHits", m_max_hits); - m_select_seg_author = 4; - declareProperty("SelectSegmentAuthor", m_select_seg_author); - m_adc_cut = 0; - declareProperty("AdcCut", m_adc_cut); - declareProperty("RegionSelectionSvc", m_reg_sel_svc); - declareInterface< CalibSegmentPreparationTool >(this); -} - -//////////////// -// initialize // -//////////////// -StatusCode SegmentRegionSelector::initialize(void) { - ATH_CHECK( m_reg_sel_svc.retrieve() ); - return StatusCode :: SUCCESS; -} - -void SegmentRegionSelector::prepareSegments(const MuonCalibEvent *&event, std::map<NtupleStationId, MuonCalibSegment *> &segments) { - segments.clear(); - std::vector<unsigned int> calib_region_hit_map; -//---------------------loop on all patterns------------------------------------- - MuonCalibEvent::MCPVecCit pat_it = event->patternBegin(); - MuonCalibEvent::MCPVecCit pat_it_end = event->patternEnd(); - for( ;pat_it!=pat_it_end; ++pat_it) { -//--------------------loop on all segemnts-------------------------------------- - MuonCalibPattern::MuonSegmentVec::const_iterator seg_it = (*pat_it)->muonSegBegin(); - MuonCalibPattern::MuonSegmentVec::const_iterator seg_it_end = (*pat_it)->muonSegEnd(); - for ( ; seg_it!=seg_it_end; ++seg_it) { - MuonCalibSegment *seg = *seg_it; - if(m_select_seg_author>0 && seg->author()>0) - if (m_select_seg_author != seg->author()) - continue; - //check count hits in the calibration region and remove others - calib_region_hit_map.clear(); - bool reject(false); - int count(0); - for(MuonCalibSegment::MdtHitCit hit_it=seg->mdtHOTBegin(); hit_it!=seg->mdtHOTEnd(); hit_it++) { - unsigned int is_in_region(static_cast<unsigned int>(!m_reg_sel_svc->isInRegion((*hit_it)->identify())));// || m_suppressed_tubes.find((*hit_it)->identify())!=m_suppressed_tubes.end())); - if(is_in_region!=0 && m_exclusive_segments) { - reject=true; - break; - } - if((*hit_it)->adcCount()<m_adc_cut) is_in_region=1; - calib_region_hit_map.push_back(is_in_region); - if(is_in_region==0) count++; - } - if(reject) continue; - if(count<m_min_hits || (count>m_max_hits && m_max_hits>0)) continue; - if(count==0) continue; - seg->refineMdtSelection(calib_region_hit_map); - NtupleStationId id(seg->mdtHOT()[0]->identify()); - id.SetMultilayer(0); - //store segment if it is the first in the station - if(segments[id] == NULL) { - segments[id] = seg; - continue; - } - //overwrite segment if this has more hits than the stored segment - MuonCalibSegment *stored(segments[id]); - if(stored->mdtHitsOnTrack() < seg->mdtHitsOnTrack()) { - segments[id] = seg; - continue; - } - if(stored->mdtHitsOnTrack() > seg->mdtHitsOnTrack()) { - continue; - } - //overwrite segment if the new one has a better chi^2 - if(stored->chi2() > seg->chi2()) { - segments[id] = seg; - } - } - } -} //end SegmentRegionSelector::prepareSegments - -} // namespace Muoncalib diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/src/UpdateBField.cxx b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/src/UpdateBField.cxx deleted file mode 100644 index 2819ec2108b069c4ee4a149729cf50550eda24df..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/src/UpdateBField.cxx +++ /dev/null @@ -1,51 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -#include "CalibNtupleAnalysisAlg/UpdateBField.h" -#include <TString.h> // for Form - -namespace MuonCalib { - -UpdateBField::UpdateBField(const std::string &t, const std::string &n, const IInterface *p) : - AthAlgTool(t, n, p) { - declareInterface< CalibSegmentPreparationTool >(this); -} - -StatusCode UpdateBField::initialize() { - ATH_CHECK(AthAlgTool::initialize()); - ATH_CHECK(m_fieldCondObjInputKey.initialize()); - return StatusCode::SUCCESS; -} - -void UpdateBField::prepareSegments(const MuonCalibEvent *& /*event*/, std::map<NtupleStationId, MuonCalibSegment *> &segments) { - /// magnetic field - MagField::AtlasFieldCache fieldCache; - SG::ReadCondHandle<AtlasFieldCacheCondObj> readHandle{m_fieldCondObjInputKey, Gaudi::Hive::currentContext()}; - const AtlasFieldCacheCondObj* fieldCondObj{*readHandle}; - if (!fieldCondObj) { - throw std::runtime_error(Form("File: %s, Line: %d\nUpdateBField::prepareSegments() - Failed to retrieve AtlasFieldCacheCondObj with key %s", __FILE__, __LINE__, (m_fieldCondObjInputKey.key()).c_str())); - } - fieldCondObj->getInitializedCache(fieldCache); - - for(std::map<NtupleStationId, MuonCalibSegment *>::iterator it = segments.begin(); it!=segments.end(); it++) { - for(unsigned int j=0; j<it->second->mdtHitsOnTrack(); j++) { - MdtCalibHitBase *hit = it->second->mdtHOT()[j]; - Amg::Transform3D gToStation= it->second->localToGlobal().inverse(); - double XYZ[3], BGXYZ[3]; - XYZ[0] = hit->globalPosition().x(); - XYZ[1] = hit->globalPosition().y(); - XYZ[2] = hit->globalPosition().z(); - fieldCache.getField(XYZ,BGXYZ); - Amg::Vector3D B_global(BGXYZ[0], BGXYZ[1], BGXYZ[2]); - Amg::Vector3D B_loc(gToStation.linear()*B_global); - hit->setBFieldPara(B_loc.x()); - Amg::Vector3D dir(0.0, - it->second->direction().y(), - it->second->direction().z()); - hit->setBFieldPerp(B_loc. dot(dir.unit())); - } - } -} //end UpdateBField::prepareSegments - -}//namespace MuonCalib diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/src/WriteMdtGeometry.cxx b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/src/WriteMdtGeometry.cxx deleted file mode 100644 index b9c5d46331695a98b6ff31c2c30e5181ae61be64..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/src/WriteMdtGeometry.cxx +++ /dev/null @@ -1,175 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -//this -#include "CalibNtupleAnalysisAlg/WriteMdtGeometry.h" - -//coral -#include "RelationalAccess/IRelationalService.h" -#include "RelationalAccess/IConnectionService.h" -#include "RelationalAccess/ConnectionService.h" -#include "RelationalAccess/ISessionProxy.h" -#include "RelationalAccess/IRelationalDomain.h" -#include "RelationalAccess/ITransaction.h" -#include "RelationalAccess/IQuery.h" - -#include "RelationalAccess/ISchema.h" -#include "RelationalAccess/ICursor.h" -#include "RelationalAccess/ITable.h" -#include "RelationalAccess/ITableDataEditor.h" -#include "RelationalAccess/IAuthenticationService.h" -#include "RelationalAccess/IAuthenticationCredentials.h" -#include "RelationalAccess/SchemaException.h" -#include "CoralBase/AttributeList.h" -#include "CoralBase/Attribute.h" -#include "CoralBase/AttributeSpecification.h" -#include "CoralKernel/Context.h" - -#include <stdexcept> - -#include "MuonReadoutGeometry/MdtReadoutElement.h" -#include "MuonReadoutGeometry/MuonDetectorManager.h" - -#include "MuonCalibIdentifier/MuonFixedId.h" -#include "MuonCalibITools/IIdToFixedIdTool.h" - -namespace MuonCalib { - -WriteMdtGeometry::WriteMdtGeometry(const std::string &name, ISvcLocator *pSvcLocator) : - AthAlgorithm(name, pSvcLocator), - m_context( &coral::Context::instance() ), - m_idToFixedIdToolType("MuonCalib::IdToFixedIdTool"), - m_idToFixedIdToolName("MuonCalib_IdToFixedIdTool"), - m_session(nullptr), - m_detMgr(nullptr), - m_id_tool(nullptr) { - - declareProperty("idToFixedIdToolType", m_idToFixedIdToolType); - declareProperty("idToFixedIdToolName", m_idToFixedIdToolName); - declareProperty("ConnectionString", m_connectionString); - declareProperty("WorkingSchema", m_WorkingSchema); - -} //end WriteMdtGeometry::WriteMdtGeometry - -StatusCode WriteMdtGeometry::initialize() { - ATH_CHECK(m_idHelperSvc.retrieve()); - ATH_CHECK(detStore()->retrieve(m_detMgr)); - ATH_CHECK(toolSvc()->retrieveTool(m_idToFixedIdToolType, m_idToFixedIdToolName, m_id_tool)); - - loadServices(); - - try { - OpenConnection(); - coral::ITableDataEditor &editor = m_session->nominalSchema().tableHandle("MDT_CHAMBER").dataEditor(); - if (!fill_db(editor)) { - CloseConnection(false); - return StatusCode::FAILURE; - } - CloseConnection(true); - } - catch ( coral::SchemaException &e ) { - ATH_MSG_ERROR( "Schema exception : " << e.what() ); - CloseConnection(false); - return StatusCode::FAILURE; - } - ATH_MSG_INFO( "Initialisation done!" ); - return StatusCode::SUCCESS; -} //end WriteMdtGeometry::initialize - -void WriteMdtGeometry::loadServices() { - coral::IHandle<coral::IConnectionService> lookSvcH = m_context->query<coral::IConnectionService>(); - if (!lookSvcH.isValid()) { - m_context->loadComponent( "CORAL/Services/ConnectionService" ); - lookSvcH = m_context->query<coral::IConnectionService>(); - } - if (!lookSvcH.isValid()) { - throw std::runtime_error( "Could not locate the connection service" ); - } - m_context->loadComponent( "CORAL/Services/XMLAuthenticationService" ); - m_context->loadComponent( "CORAL/Services/RelationalService" ); -} //end WriteMdtGeometry::loadServices - -inline bool WriteMdtGeometry::fill_db(coral::ITableDataEditor &editor) { - ATH_MSG_INFO( "Filling db" ); - coral::AttributeList rowBuffer; - rowBuffer.extend<int>("CHAMBER"); - rowBuffer.extend<int>("LY"); - rowBuffer.extend<int>("ML"); - rowBuffer.extend<int>("N_TUBES"); - rowBuffer.extend<float>("LOC_Y"); - rowBuffer.extend<float>("LOC_Z"); - rowBuffer.extend<float>("Y_SPACING"); - //loop on chambers - MdtIdHelper::const_id_iterator it = m_idHelperSvc->mdtIdHelper().module_begin(); - MdtIdHelper::const_id_iterator it_end = m_idHelperSvc->mdtIdHelper().module_end(); - for( ; it!=it_end;++it ) { - const MuonGM::MdtReadoutElement *detEl = m_detMgr->getMdtReadoutElement( m_idHelperSvc->mdtIdHelper().channelID(*it,1,1,1)); - if(!detEl) continue; - //get number of mls; - int n_mls=m_idHelperSvc->mdtIdHelper().numberOfMultilayers(*it); - //fixed id - MuonFixedId fixed_id(m_id_tool->idToFixedId(*it)); - rowBuffer["CHAMBER"].data<int>() = fixed_id.mdtChamberId().getIdInt(); - //loop on multilayers - for(int ml=1; ml<=n_mls; ml++) { - rowBuffer["ML"].data<int>()=ml; - const MuonGM::MdtReadoutElement *detEl_ml = m_detMgr->getMdtReadoutElement(m_idHelperSvc->mdtIdHelper().channelID(*it,ml ,1,1)); - int n_layers=detEl_ml->getNLayers(); - int n_tubes=detEl_ml->getNtubesperlayer(); - rowBuffer["N_TUBES"].data<int>()=n_tubes; - for(int ly=1; ly<=n_layers; ly++) { - rowBuffer["LY"].data<int>()=ly; - fillLayer(detEl_ml, rowBuffer, ml, ly); - editor.insertRow(rowBuffer); - } - } - } - return true; -} //end WriteMdtGeometry::fill_db - -inline void WriteMdtGeometry::fillLayer(const MuonGM::MdtReadoutElement *detEl, coral::AttributeList &rowBuffer, const int &ml, const int &ly) { - Amg::Vector3D TubePos1 = detEl->GlobalToAmdbLRSCoords(detEl->tubePos(ml,ly,1)); - Amg::Vector3D TubePos2 = detEl->GlobalToAmdbLRSCoords(detEl->tubePos(ml,ly,2)); - rowBuffer["LOC_Y"].data<float>()=TubePos1.y(); - rowBuffer["LOC_Z"].data<float>()=TubePos1.z(); - rowBuffer["Y_SPACING"].data<float>()=TubePos2.y() - TubePos1.y(); -} //end WriteMdtGeometry::fillLayer - -void WriteMdtGeometry::OpenConnection() { - coral::ConnectionService connSvc; - m_session = connSvc.connect( m_connectionString ); -} - -void WriteMdtGeometry::CloseConnection(bool commit) { - if(m_session != NULL) { - if(commit) - m_session->transaction().commit(); - else - m_session->transaction().rollback(); - } - m_session=NULL; -} - -coral::IRelationalDomain& WriteMdtGeometry::domain( const std::string &connectionString ) { - coral::IHandle<coral::IRelationalService> relationalService= m_context->query<coral::IRelationalService>(); - if ( !relationalService.isValid() ) { - throw std::runtime_error( "Could not locate the relational service" ); - } - if(connectionString.find("sqlite")!=0) { - coral::IHandle<coral::IAuthenticationService> authenticationService= m_context->query<coral::IAuthenticationService>(); - if ( !authenticationService.isValid() ) { - throw std::runtime_error( "Could not locate the authentication service" ); - } - - const coral::IAuthenticationCredentials &credentials = authenticationService->credentials( connectionString ); - m_username = credentials.valueForItem( "user" ); - m_password = credentials.valueForItem( "password" ); - } else { - m_username=""; - m_password=""; - } - return relationalService->domainForConnection( connectionString ); -} //end WriteMdtGeometry::domain - -} //namespace MuonCalib diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/src/components/CalibNtupleAnalysisAlg_entries.cxx b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/src/components/CalibNtupleAnalysisAlg_entries.cxx deleted file mode 100644 index 62d3acb077fcad0fa5d783ecbc700f7fe9172d47..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/src/components/CalibNtupleAnalysisAlg_entries.cxx +++ /dev/null @@ -1,35 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -#include "CalibNtupleAnalysisAlg/CalibNtupleAnalysisAlg2.h" -#include "CalibNtupleAnalysisAlg/BarrelSecondCoordinatePreparationTool.h" -#include "CalibNtupleAnalysisAlg/BFieldCorrectionUpdateTool.h" -#include "CalibNtupleAnalysisAlg/WriteMdtGeometry.h" -#include "CalibNtupleAnalysisAlg/UpdateBField.h" -#include "CalibNtupleAnalysisAlg/CalibNtupleLoader.h" -#include "CalibNtupleAnalysisAlg/SegmentRegionSelector.h" -#include "CalibNtupleAnalysisAlg/SegmentRawdataSelector.h" -#include "CalibNtupleAnalysisAlg/SegmentRecalibration.h" -#include "CalibNtupleAnalysisAlg/SegmentRefitter.h" -#include "CalibNtupleAnalysisAlg/InitialDqFilter.h" -#include "CalibNtupleAnalysisAlg/ApplyRawTimes.h" -#include "CalibNtupleAnalysisAlg/GoodRunListFilter.h" -#include "CalibNtupleAnalysisAlg/MuonCalibGeometryDumper.h" - -using namespace MuonCalib; - -DECLARE_COMPONENT( CalibNtupleAnalysisAlg2 ) -DECLARE_COMPONENT( WriteMdtGeometry ) -DECLARE_COMPONENT( MuonCalibGeometryDumper ) -DECLARE_COMPONENT( BarrelSecondCoordinatePreparationTool ) -DECLARE_COMPONENT( BFieldCorrectionUpdateTool ) -DECLARE_COMPONENT( UpdateBField ) -DECLARE_COMPONENT( CalibNtupleLoader ) -DECLARE_COMPONENT( SegmentRegionSelector ) -DECLARE_COMPONENT( SegmentRawdataSelector ) -DECLARE_COMPONENT( SegmentRecalibration ) -DECLARE_COMPONENT( InitialDqFilter ) -DECLARE_COMPONENT( SegmentRefitter ) -DECLARE_COMPONENT( ApplyRawTimes ) -DECLARE_COMPONENT( GoodRunListFilter ) diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/CMakeLists.txt b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/CMakeLists.txt deleted file mode 100644 index 8157722ec6a954a2057a70da3594f66c6e895e1f..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/CMakeLists.txt +++ /dev/null @@ -1,50 +0,0 @@ -################################################################################ -# Package: MuonCalibStandAloneExtraTools -################################################################################ - -# Declare the package name: -atlas_subdir( MuonCalibStandAloneExtraTools ) - -# Declare the package's dependencies: -atlas_depends_on_subdirs( PUBLIC - Control/AthenaBaseComps - GaudiKernel - MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibData - MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibFitters - MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibUtils - MuonSpectrometer/MuonCalib/MuonCalibEventBase - MuonSpectrometer/MuonCalib/MuonCalibExtraTree/MuonCalibExtraTreeEvent - MuonSpectrometer/MuonCalib/MuonCalibIdentifier - MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MdtCalibIOSvc - MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneBase - PRIVATE - Control/StoreGate - DetectorDescription/Identifier - MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibInterfaces - MuonSpectrometer/MuonCalib/MuonCalibExtraTree/MuonCalibExtraNtuple - MuonSpectrometer/MuonCalib/MuonCalibExtraTree/MuonCalibExtraTreeAlg - MuonSpectrometer/MuonCalib/MuonCalibITools - MuonSpectrometer/MuonCalib/MuonCalibNtuple - MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleUtils - MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry - MuonSpectrometer/MuonIdHelpers ) - -# External dependencies: -find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread MathMore Minuit Minuit2 Matrix Physics HistPainter Rint Graf Graf3d Gpad Html Postscript Gui GX11TTF GX11 ) - -# Component(s) in the package: -atlas_add_library( MuonCalibStandAloneExtraToolsLib - src/*.cxx - PUBLIC_HEADERS MuonCalibStandAloneExtraTools - INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaBaseComps GaudiKernel MdtCalibData MdtCalibFitters MdtCalibUtils MuonCalibEventBase MuonCalibExtraTreeEvent MuonCalibIdentifier MdtCalibIOSvcLib MuonCalibStandAloneBaseLib StoreGateLib SGtests MuonCalibExtraTreeAlgLib MuonIdHelpersLib - PRIVATE_LINK_LIBRARIES Identifier MuonCalibExtraNtuple MuonCalibITools MuonCalibNtuple CalibNtupleUtils MuonReadoutGeometry ) - -atlas_add_component( MuonCalibStandAloneExtraTools - src/components/*.cxx - INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaBaseComps GaudiKernel MdtCalibData MdtCalibFitters MdtCalibUtils MuonCalibEventBase MuonCalibExtraTreeEvent MuonCalibIdentifier MdtCalibIOSvcLib MuonCalibStandAloneBaseLib StoreGateLib SGtests Identifier MuonCalibExtraNtuple MuonCalibExtraTreeAlgLib MuonCalibITools MuonCalibNtuple CalibNtupleUtils MuonReadoutGeometry MuonIdHelpersLib MuonCalibStandAloneExtraToolsLib ) - -# Install files from the package: -atlas_install_python_modules( python/*.py ) - diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/MuonCalibStandAloneExtraTools/CalibExtraNtupleLoader.h b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/MuonCalibStandAloneExtraTools/CalibExtraNtupleLoader.h deleted file mode 100644 index 5691b050e5cc65742cd7233c84697bb90cc10d63..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/MuonCalibStandAloneExtraTools/CalibExtraNtupleLoader.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef MuonCalib_CalibExtraNtupleLoader_h -#define MuonCalib_CalibExtraNtupleLoader_h - -//Gaudi -#include "GaudiKernel/ServiceHandle.h" -#include "AthenaBaseComps/AthAlgTool.h" - -//MuonCalibStandAloneBase -#include "MuonCalibStandAloneBase/CalibSegmentPreparationTool.h" - -//c - c++ -#include "string" - -class RegionSelectionSvc; -class TChain; - -namespace MuonCalib { - -class NTReader_E; - -//load events from CalibrationNtuple - -class CalibExtraNtupleLoader: public AthAlgTool, virtual public CalibSegmentPreparationTool { - public: -//=========================constructor========================================== - CalibExtraNtupleLoader(const std::string &t, const std::string &n, const IInterface *p); - ~CalibExtraNtupleLoader()=default; -//=========================public member functions============================== - StatusCode initialize(void); - - //load event - void prepareSegments(const MuonCalibEvent *&event, std::map<NtupleStationId, MuonCalibSegment *> &segments); - private: -//=========================private data========================================= - //!path to the file list - job option - std::string m_filelist; - //! type of ntuple - AUTO/NORMAL/REGION - //! NOTE: Do not use auto if you are directly reading ntuples from castor or dcache. - //! In this case all files have to be opened at initialisation. - std::string m_ntuple_type; - int m_ntuple_type_num; - //! first event - jobOption - int m_first; - //! last event - jobOption - int m_last; - //! ntuple reader - NTReader_E *m_reader; - //! pointer to region selection service - RegionSelectionSvc *p_reg_sel_svc; - //! ntuple chain - TChain *m_chain; -}; - -} //namespace MuonCalib - -#endif diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/MuonCalibStandAloneExtraTools/ExtraRegionSelector.h b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/MuonCalibStandAloneExtraTools/ExtraRegionSelector.h deleted file mode 100644 index 48570352cc6a687aa23e69a88df01ea80815f66b..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/MuonCalibStandAloneExtraTools/ExtraRegionSelector.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef MuonCalib_ExtraRegionSelector_h -#define MuonCalib_ExtraRegionSelector_h - -//Gaudi -#include "GaudiKernel/ServiceHandle.h" -#include "AthenaBaseComps/AthAlgTool.h" - -//MuonCalibStandAloneBase -#include "MuonCalibStandAloneBase/CalibSegmentPreparationTool.h" - -//MuonCalibExtraTreeEvent -#include "MuonCalibExtraTreeEvent/EventHandler.h" - -class RegionSelectionSvc; - -class TFile; -class TH1F; - -namespace MuonCalib { - -class MuonCalibSegment; - -class ExtraRegionSelector : public AthAlgTool, virtual public CalibSegmentPreparationTool { - public: -//=========================constructor========================================== - ExtraRegionSelector(const std::string & t, const std::string & n, const IInterface *p); - inline ~ExtraRegionSelector() {} -//=========================public member functions============================== - //initialize and finalize - StatusCode initialize(void); - StatusCode finalize(void); - //load event - void prepareSegments(const MuonCalibEvent *&event, std::map<NtupleStationId, MuonCalibSegment *> &segments); - private: -//=========================private data========================================= - //if set to true, segments wich are not completely in the selected calibration region will be dropped - job options - bool m_exclusive_segments; - //if true select muonboy tracks, else moore - bool m_muonboy; - //minimum and maximum number of segment hits - int m_min_hits, m_max_hits; - //select segment author - int m_select_seg_author; - //momentum cut - float m_momentum_cut; - //if set to true, an debug root file is created - bool m_do_debug_file; - //! pointer to region selection service - RegionSelectionSvc *p_reg_sel_svc; - //track author id; - int m_track_author_id; - //Event handler for generating ExtraEvents - EventHandler m_evt_handler; - inline void process_segment(MuonCalibSegment *seg); //debug root file - TFile *m_debug_file; - TH1F *m_all_p; - TH1F *m_selected_p_by_track; - TH1F *m_selected_p_by_segment; - -}; - -} //namespace MuonCalib - -#endif diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/MuonCalibStandAloneExtraTools/ExtraRegionSelectorFast.h b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/MuonCalibStandAloneExtraTools/ExtraRegionSelectorFast.h deleted file mode 100644 index 5fc899503c10d21e0eddfe0f279e0e654bec080e..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/MuonCalibStandAloneExtraTools/ExtraRegionSelectorFast.h +++ /dev/null @@ -1,74 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef MuonCalib_ExtraRegionSelectorFast_h -#define MuonCalib_ExtraRegionSelectorFast_h - -//Gaudi -#include "GaudiKernel/ServiceHandle.h" -#include "AthenaBaseComps/AthAlgTool.h" - -//MuonCalibStandAloneBase -#include "MuonCalibStandAloneBase/CalibSegmentPreparationTool.h" - -#include "set" -#include "list" - -class RegionSelectionSvc; - -class TFile; -class TH1F; -class TH2F; - -namespace MuonCalib { - -class MuonCalibSegment; -class MuonFixedId; - -class ExtraRegionSelectorFast : public AthAlgTool, virtual public CalibSegmentPreparationTool { - public: -//=========================constructor========================================== - ExtraRegionSelectorFast(const std::string &t, const std::string &n, const IInterface *p); - inline ~ExtraRegionSelectorFast() {} -//=========================public member functions============================== - //initialize and finalize - StatusCode initialize(void); - StatusCode finalize(void); - //load event - void prepareSegments(const MuonCalibEvent *&event, std::map<NtupleStationId, MuonCalibSegment *> &segments); - private: -//=========================private data========================================= - //if set to true, segments wich are not completely in the selected calibration region will be dropped - job options - bool m_exclusive_segments; - //minimum and maximum number of segment hits - int m_min_hits, m_max_hits; - //select segment author - std::set<int> m_track_author; - std::vector<int> m_track_author_vec; - int m_select_seg_author; - //momentum cut - float m_momentum_cut; - //minimum number of segment hits on track - int m_min_hits_on_track; - //maximum number of hits not on track - int m_max_hits_not_on_track; - //if set to true, an debug root file is created - bool m_do_debug_file; - //! pointer to region selection service - RegionSelectionSvc *p_reg_sel_svc; - //track author id; - int m_track_author_id; - //Event handler for generating ExtraEvents - inline void process_segment(MuonCalibSegment *seg); //debug root file - TFile *m_debug_file; - TH1F *m_all_p; - TH1F *m_selected_p_by_track; - TH1F *m_selected_p_by_segment; - TH2F *m_n_match_vs_missing; - inline bool isOnTrack(const MuonCalibSegment &seg, const std::list<std::set<MuonFixedId> > &track_hits); -}; - -} //namespace MuonCalib - -#endif diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/MuonCalibStandAloneExtraTools/ExtraRegionSelectorSuperFast.h b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/MuonCalibStandAloneExtraTools/ExtraRegionSelectorSuperFast.h deleted file mode 100644 index 51064dade9f87b188594e931d9734c07839f1c30..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/MuonCalibStandAloneExtraTools/ExtraRegionSelectorSuperFast.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef MuonCalib_ExtraRegionSelectorSuperFast_h -#define MuonCalib_ExtraRegionSelectorSuperFast_h - -//Gaudi -#include "GaudiKernel/ServiceHandle.h" -#include "AthenaBaseComps/AthAlgTool.h" - -//MuonCalibStandAloneBase -#include "MuonCalibStandAloneBase/CalibSegmentPreparationTool.h" - -#include "set" -#include "list" - -class RegionSelectionSvc; - -class TFile; -class TH1F; -class TH2F; - -namespace MuonCalib { - -class MuonCalibSegment; -class MuonFixedId; - -class ExtraRegionSelectorSuperFast : public AthAlgTool, virtual public CalibSegmentPreparationTool { - public: -//=========================constructor========================================== - ExtraRegionSelectorSuperFast(const std::string &t, const std::string &n, const IInterface *p); - inline ~ExtraRegionSelectorSuperFast() {} -//=========================public member functions============================== - //initialize and finalize - StatusCode initialize(void); - StatusCode finalize(void); - //load event - void prepareSegments(const MuonCalibEvent *&event, std::map<NtupleStationId, MuonCalibSegment *> &segments); - private: - //=========================private data========================================= - //if set to true, segments wich are not completely in the selected calibration region will be dropped - job options - bool m_exclusive_segments; - //minimum and maximum number of segment hits - int m_min_hits, m_max_hits; - //select segment author - std::set<int> m_track_author; - std::vector<int> m_track_author_vec; - //momentum cut - float m_momentum_cut; - //if set to true, an debug root file is created - bool m_do_debug_file; - //! pointer to region selection service - RegionSelectionSvc *p_reg_sel_svc; - //Event handler for generating ExtraEvents - inline void process_segment(MuonCalibSegment *seg); //debug root file - TFile *m_debug_file; - TH1F *m_all_p; - TH1F *m_selected_p_by_track; - TH1F *m_selected_p_by_segment; - TH2F *m_n_match_vs_missing; -}; - -} //namespace MuonCalib - -#endif diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/MuonCalibStandAloneExtraTools/HistogramManager.h b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/MuonCalibStandAloneExtraTools/HistogramManager.h deleted file mode 100644 index df57373bb447c3311a1e5531331774be2c90a1ad..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/MuonCalibStandAloneExtraTools/HistogramManager.h +++ /dev/null @@ -1,139 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef SRC_HISTOGRAMMANAGER_H -#define SRC_HISTOGRAMMANAGER_H - -#include <string.h> -#include <stdio.h> - -#include <sstream> -#include <iostream> -#include <fstream> - -#include <TFile.h> -#include <TString.h> -#include <vector> -#include "TH1.h" -#include "TH2.h" -#include "TH3.h" -#include "TObjArray.h" - -#include "MuonCalibStandAloneExtraTools/StringUtil.h" -#include "MuonCalibStandAloneExtraTools/MDTName.h" -#include "MuonIdHelpers/MdtIdHelper.h" - -#define UPDATETIME 2000 - -class MdtChamber { -public: - std::string m_region; - std::string m_side; - int m_sector; - int m_absEta; - int m_eta_id; - int m_phi_id; - std::string m_chamberType; - std::string m_chamberName; - std::string m_athenaChamberName; - - void Fill(std::string region, std::string side, int sector, std::string chamberType, int absEta_id) { - ToString ts; - std::string sectorString=ts(sector); - if(sector<10) sectorString="0"+sectorString; - m_region = region; - m_side = side; - m_sector = sector; - m_chamberType = chamberType; - m_absEta = absEta_id; - int eta_id = absEta_id; - if (side=="C") eta_id = -absEta_id; - m_eta_id = eta_id; - int phi_id = (int) (sector+1)/2; - m_phi_id = phi_id; - std::string chName = chamberType+ts(absEta_id)+side+sectorString; - m_chamberName = chName; - std::string chAthenaName = chamberType+"_"+ts(phi_id)+"_"+ts(eta_id); - m_athenaChamberName = chAthenaName; - return; - } -}; - -struct sortMdtChambersByName { - bool operator()(MuonCalib::MDTName a ,MuonCalib::MDTName b) { - std::string t1=a.getOnlineName(); - std::string t2=b.getOnlineName(); - return (t1 < t2); - } -}; - -class HistogramManager { -public: - HistogramManager(); - HistogramManager(const Muon::IMuonIdHelperSvc *idHelper); - ~HistogramManager()=default; - void buildGlobalHistos(); - void buildTrackHistos(); - void buildDebugHistos(); - void buildTopLevel(std::string region, std::string side, int sectorMin, int sectorMax); - void buildSector(std::string region,std::string side, int sector); - void buildChamberHistos(MuonCalib::MDTName); - - void setChamberCutOut(std::string chamber, TH1F *href ); - void setChamberDisconnectedTubes(std::string chamber, TH1F *href ); - int GetTubeOffsetML1(std::string chamberName); - int GetTubeOffsetAtEndML1(std::string chamberName); - - std::vector<MuonCalib::MDTName> GetChamberList(std::string region, std::string side, int sector); - - bool openOutputFile(std::string filename); - bool openReadOnlyFile(std::string filename); - bool openUpdateFile(std::string filename); - void WriteAndCloseFile(); - - void SetDoTracks(bool); - - TObject * GetMdtHisto(std::string histo_name); - TObject * GetMdtHisto(std::string histo_name, std::string region, std::string side); - TObject * GetMdtHisto(std::string histo_name, std::string region, std::string side, int sector); - TObject * GetMdtHisto(std::string histo_name, MuonCalib::MDTName); - - std::string GetMdtDirectoryName(); - std::string GetMdtDirectoryName(std::string region, std::string side); - std::string GetMdtDirectoryName(std::string region, std::string side, int sector); - std::string GetMdtDirectoryName(std::string region, std::string side, int sector, std::string chamberType, int eta); - std::string GetMdtDirectoryName(MuonCalib::MDTName); - - TObject * GetTDaqHisto(std::string histo_name, std::string region); - TObject * GetTDaqHisto(std::string histo_name, std::string region, std::string side); - TObject * GetTDaqHisto(std::string histo_name, std::string region, std::string side, int sector); - TObject * GetTDaqHisto(std::string histo_name, std::string region, std::string side, int sector, std::string chamberType, int eta); - - std::string GetTDaqDirectoryName(std::string region); - std::string GetTDaqDirectoryName(std::string region, std::string side); - std::string GetTDaqDirectoryName(std::string region, std::string side, int sector); - std::string GetTDaqDirectoryName(std::string region, std::string side, int sector, std::string chamberType, int eta); - - TObject* GetHisto(std::string main_dir, std::string histo_name); - - void ReadChamberMapFile (std::string chamberName, int *chamberGeoParams, int numParams); - int GetChamberNumOfML (std::string chamberName); - int GetChamberNumOfMezzPerML (std::string chamberName); - int GetChamberTubesPerMezz (std::string chamberName); - - int GetEtaMax(std::string region, std::string side, int sector, std::string chamberType); - - TFile* rootFile(){return m_rootfile;}; - TFile *m_rootfile; - - private: - TObjArray m_hList; - const MdtIdHelper* m_mdtIdHelper; - - bool m_doTracks; - -}; - -#endif //SRC_HISTOMANAGER_H - diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/MuonCalibStandAloneExtraTools/MDTDeadElementsAnalysis.h b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/MuonCalibStandAloneExtraTools/MDTDeadElementsAnalysis.h deleted file mode 100644 index a6e2fe68f315fc441d9ab9c0a2ed2483908bc157..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/MuonCalibStandAloneExtraTools/MDTDeadElementsAnalysis.h +++ /dev/null @@ -1,143 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef SRC_MDTTUBEANA_H -#define SRC_MDTTUBEANA_H - -#include <string> -#include <stdio.h> -#include <vector> -#include "RtypesCore.h" // for Double_t etc. - -class TH1; -class TH1I; -class TH1F; -class TF1; -class TFile; -class TString; - -static const int nmmax=100; -static const int ntmax=600; -Double_t polnml3(Double_t *x, Double_t *parf); -double completefunc(double *x, double *parf); -class MDTDeadElementsAnalysis { - public: - MDTDeadElementsAnalysis(); - ~MDTDeadElementsAnalysis()=default; - - TF1 *polfunc ; - std::string chamberName; - TH1I *deadTubesMap; - TH1I *geo; - // static const int nmmax=20; - int ndeadmezz; - double deadmezz[nmmax]; - double deadmezzMLay[nmmax]; - - std::vector<TString> noisyChamber; - - std::vector<TString> deadChamber; - - std::vector<int> deadLayer; - std::vector<TString> deadLayerChamber; - - std::vector<int> deadMultilayer; - std::vector<TString> deadMLChamber; - std::vector<double> deadMLCounts; - std::vector<double> deadMLLevel; - - std::vector<int> deadMezz; - std::vector<int> deadMezz_red; - std::vector<int> deadMezz_csm; - std::vector<TString> deadMezzChamber; - std::vector<int> deadMezzML; - std::vector<double> deadMezzEffi; - std::vector<double> deadMezzErrEffi; - std::vector<double> deadMezzChi2; - - std::vector<TString> deadTubeChamber; - std::vector<int> deadTube; - std::vector<int> deadTubeId; - std::vector<double> deadTubeHistoBin; - std::vector<int> deadTubeLay; - std::vector<int> deadTubeML; - std::vector<double> deadTubeChi2; - std::vector<double> deadTubeEffi; - std::vector<double> deadTubeErrEffi; - - int ndeadtubes; - - int position_spikes[ntmax]; - double deadtube[ntmax]; - double deadtubeseed[ntmax]; - double deadtubeLay[ntmax]; - double deadtubeML[ntmax]; - double deadtubelen[ntmax]; - double deadtubechi2[ntmax]; - double deadtubeeffi[ntmax]; - double deadtubeerr[ntmax]; - double deadtubestat[ntmax][3]; - - bool verbose; - bool drawPlots; - bool writeResultsToAsciFile; - - bool deadMezzDone; - bool deadTubesDone; - bool deadMultilayerDone; - - void histogramScanGnam(std::string rootfile); - void histogramScanCalibCenters(TFile * rootfile); - void getBasicGeometry(TH1F* geo, std::string chambname); - void getBasicGeometry(TH1F* geo, int nlayers_ml, std::string chambname); - void deadElementsAnalysis(TH1F* idh1, TH1F* geo, TH1F* deadTubesMap, int nlayers_ml, std::string chambname); - void deadElementsAnalysis(TH1F* idh1, TH1F* geo, TH1F* deadTubesMap, int nlayers_ml, - std::string chambname, int convert_mezzanine[20]); - void deadChambers(TH1F* idh1, TH1F* HRef, TH1F* deadTubesMap, std::string chambname); - void deadLayers(TH1F* idh1,TH1F* HRef, TH1F* deadTubesMap, std::string chambname); - void Clear(int ntubes); - void ClearList(); - void deadTubes(TH1F *idh1 , TH1F* HRef, TH1F* deadTubesMap, std::string chambername); - void getAverageLevelInInterval(TH1F*, int firsttube, int lasttube); - void getSpikesInInterval(TH1F*, int firsttube, int lasttube, TF1 *polfunc); - void getHolesInInterval(TH1F*, int firsttube, int lasttube, int ntubes, TF1 *polfunc); - void getHolesInInterval_strategy5(TH1F*, int firsttube, int lasttube, int ntubes, TF1 *polfunc); - std::string validateDeadTubes(double chi2cut, TH1F* HRef, TH1F* deadTubesMap, std::string chambname); - void deadMezzanines(TH1F *idh1, TH1F* HRef, TH1F* deadTubesMap, std::string chambername); - void deadMezzanines(TH1F *idh1, TH1F* HRef, TH1F* deadTubesMap, - std::string chambernamee, int convert_mezzanine[20]); - void deadMultilayers(TH1F *idh1 , TH1F* HRef, TH1F* deadTubesMap, std::string chambername); - bool NoisyChamber(TH1F *idh1, std::string chambername); - void setVerbose(); - void setNoVerbose(); - void setChamberName(std::string chambname); - std::string getChamberName(); - void printSummary(); - void printSummaryToAsciFile(); - void printCompactSummaryToAsciFile(); - void WriteAsciFile(); - - // Basic chamber geometry - std::string schamber; - std::string chtype; - int nlayers; - int nbins_per_layer[2]; - int nlayers_per_ml; - int ntubes[2]; - double tstep[2]; - int nmezz[2]; - int ntubes_per_mezz; - int firstbinML[2]; - int lastbinML[2]; - double chi2poly; - double polyparf[4]; - double average_entry; - double n_entry; - int holes[100]; - int nholes; - double eff_hole[100]; - int position_holes[1000]; -}; //MDTDeadElementsAnalysis - -#endif diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/MuonCalibStandAloneExtraTools/MDTDqaDeadElements.h b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/MuonCalibStandAloneExtraTools/MDTDqaDeadElements.h deleted file mode 100644 index 4d7590a3c9a97a51a02666d19af574cca4afc7a5..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/MuonCalibStandAloneExtraTools/MDTDqaDeadElements.h +++ /dev/null @@ -1,287 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -//Author Marco Vanadia mvanadia@cern.ch -//Class based on algorithms introduced by Philipp Fleischmann in GnaMon - -#ifndef MUONCALIBSTANDALONEEXTRATOOLS_MDTDQADEADELEMENTS_H -#define MUONCALIBSTANDALONEEXTRATOOLS_MDTDQADEADELEMENTS_H - - -#include <cmath> -#include <iostream> -#include <algorithm> -#include <fstream> -#include <TFile.h> -#include <TH1.h> -#include <TH2.h> -#include <TKey.h> -#include <vector> - -namespace MuonCalib{ - -class Tube; -class Layer; -class Mezzanine; -class Multilayer; -class MDTChamber; -class MDTDqaDeadElementsAnalysis; - -//class Tube////////////////////////////////////////////////////////////////////////////////////// - -class Tube{ - - private: - int m_status; - int m_value; - int m_position; - int m_layer; - int m_ml; - Layer *m_parent_layer; - - public: - Tube(int,int, Layer*); - - int getStatus(); - int getValue(); - int getLayer(); - int getML(); - int getPosition(); - void setValue(int); - void setStatus(int); - void setPosition(int); - void setLayer(int); - void setML(int); - - Layer* getParentLayer(); - - }; -//end of class Tube//////////////////////////////////////////////////////////////////////////////// - -//class Layer////////////////////////////////////////////////////////////////////////////////////// - - class Layer{ - - private: - int m_ntubes; - double m_entries; - int m_status; - double m_median; - double m_median_deviation; - std::vector<Tube*> m_tubes; - - public: - Layer(); - - Tube* addTube(int,int); - Tube* getTube(int); - - int getNtubes(); - double getEntries(); - int getStatus(); - double getMedian(); - double getMedianDeviation(); - - void setStatus(int); - void addEntries(double); - - void calculateStatistics(); - int getNrealtubes(); - - }; -//end of class Layer//////////////////////////////////////////////////////////////////////////// - -//class Mezzanine////////////////////////////////////////////////////////////////////////////// - - class Mezzanine{ - - private: - int m_ntubes; - double m_entries; - int m_status; - double m_median; - double m_median_deviation; - std::vector<Tube*> m_tubes; - int m_70min; - int m_70max; - - public: - Mezzanine(); - - void addTube(Tube*); - Tube* getTube(int); - - int getNtubes(); - double getEntries(); - int getStatus(); - double getMedian(); - double getMedianDeviation(); - int get70min(); - int get70max(); - - void addEntries(double); - void setStatus(int); - - void calculateStatistics(); - - }; - -//End of class Mezzanine///////////////////////////////////////////////////////////////////////////////////////// - -//class Multilayer/////////////////////////////////////////////////////////////////////////////////////////////// - - class Multilayer{ - - private: - int m_nlayers; - int m_nmezzanines; - double m_entries; - int m_status; - double m_median; - double m_median_deviation; - - std::vector<Layer*> m_layers; - std::vector<Mezzanine*> m_mezzanines; - - public: - Multilayer(); - - void addLayer(); - Tube* addTube(int,int,int); - Layer* getLayer(int); - Mezzanine* addMezzanine(); - Mezzanine* getMezzanine(int); - - int getNlayers(); - int getNmezzanines(); - double getEntries(); - int getStatus(); - double getMedian(); - double getMedianDeviation(); - - void setStatus(int); - void addEntries(double the_entries); - - void calculateStatistics(); - }; - -//End of class Multilayer////////////////////////////////////////////////////////////////////////////////// - -//Class MDTChamber///////////////////////////////////////////////////////////////////////////////////////// - - class MDTChamber{ - - private: - int m_nmultilayers; - - double m_entries; - int m_status; - double m_median; - double m_median_deviation; - double m_mean; - double m_standard_deviation; - int m_90min; - int m_90max; - int m_70; - - TString m_name; - - std::vector<Multilayer*> m_multilayers; - - public: - - MDTChamber(TH1*,TString); - - void addMultilayer(); - Multilayer* getMultilayer(int); - Tube* addTube(int,int,int,int); - - int getNmultilayers(); - double getEntries(); - int getStatus(); - double getMedian(); - double getMedianDeviation(); - double getMean(); - double getStandardDeviation(); - TString getName(); - int get90min(); - int get90max(); - int get70(); - - - void setStatus(int); - void addEntries(double); - - void buildMezzanines(); - void calculateStatistics(); - void updateStatistics(); - - void Print(); - - }; - -//End of class MDTChamber//////////////////////////////////////////////////////////////////////////////// - -//class MDTDqaDeadElements/////////////////////////////////////////////////////////////////////////////// - - class MDTDqaDeadElements{ - - private: - bool m_verbose; - bool m_write_report; - bool m_write_compact_report; - bool m_do_analysis; - bool m_print_chambers; - bool m_write_list_of_dead_tubes; - bool m_do_noisy; - std::ofstream m_file_report; - std::ofstream m_comp_report; - std::ofstream m_filelistofdeads; - int m_deadtubes; - int m_deadmezzanines; - int m_deadlayers; - int m_deadmultilayers; - int m_deadchambers; - int m_noisytubes; - int m_lowstatmezzanines; - int m_lowstatisticschambers; - int m_lowstatisticsfortubeschambers; - int m_ntubes; - - int m_dead_tubes_per_sector; - int m_dead_mezzanines_per_sector; - int m_dead_layers_per_sector; - int m_dead_multilayers_per_sector; - int m_dead_chambers_per_sector; - int m_lowstat_chambers_per_sector; - - public: - MDTDqaDeadElements(); - void setVerbose(bool); - void setWriteReport(bool); - void setWriteCompactReport(bool); - void setDoAnalysis(bool); - void setPrintChambers(bool); - void setDoNoisy(bool); - void setWriteListOfDeadTubes(bool); - - void MDTDqaDeadElementsAnalysis(TFile*); - - void fillChamber(MDTChamber*, TH1*); - void fillDeadMap(MDTChamber*, TH2F*, TH2F*,TH1F*, TDirectory*,TDirectory*); - - void doAnalysis(MDTChamber*); - void analyseMultilayers(MDTChamber*); - void analyseLayers(MDTChamber*); - void analyseMezzanines(MDTChamber*); - void reanalyseMezzanines(MDTChamber*); - void analyseTubes(MDTChamber*); - - void PrintListOfDeadTubes(MDTChamber*); - - }; - -}//namespace MuonCalib - -#endif diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/MuonCalibStandAloneExtraTools/MDTName.h b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/MuonCalibStandAloneExtraTools/MDTName.h deleted file mode 100644 index 08643ba1fc2b47dc52e80133e20bb275622ddae0..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/MuonCalibStandAloneExtraTools/MDTName.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -/* Author: Marco Vanadia vanadiam@roma1.infn.it*/ - -#ifndef MUONCALIBSTANDALONEEXTRATOOLS_MDTNAME_H -#define MUONCALIBSTANDALONEEXTRATOOLS_MDTNAME_H - -#include "MuonCalibIdentifier/MuonFixedId.h" -#include <string> -#include <sstream> -#include <stdlib.h> -#include "TString.h" - -namespace MuonCalib{ - -class MDTName{ - -private: - TString m_name; - int m_eta_on; - int m_eta_off; - int m_sector_on; - int m_sector_off; - char m_side; - -public: - MDTName(); - MDTName(const MuonFixedId&); - MDTName(const TString&); - MDTName(const char*); - MDTName(const std::string&); - MDTName(const std::string&,const int,const int); - MDTName(const std::string&,const int,const std::string&,const int); - void MDTName_init(const TString&); - std::string getOnlineName(); - std::string getOfflineName(); - bool isBarrel(); - bool isEndcap(); - bool isInner(); - bool isMiddle(); - bool isOuter(); - bool isExtra(); - bool isForward(); - bool isBackward(); - bool isLarge(); - bool isSmall(); - int getOnlineSector(); - int getOfflineSector(); - int getOnlineEta(); - int getOfflineEta(); - std::string getRegion(); - std::string getStation(); - std::string getSize(); - std::string getSide(); - std::string getName(); - TString OnlineToOfflineName(const TString&); - TString OnlineToOfflineName(const char*); - TString OnlineToOfflineName(const std::string&); - TString OfflineToOnlineName(const TString&); - TString OfflineToOnlineName(const char*); - TString OfflineToOnlineName(const std::string&); - -}; - -} //namespace MuonCalib - -#endif diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/MuonCalibStandAloneExtraTools/MdtDqaDb.h b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/MuonCalibStandAloneExtraTools/MdtDqaDb.h deleted file mode 100644 index 1fe3f5ebb7f054aacea1bb8af6055e8bbc789214..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/MuonCalibStandAloneExtraTools/MdtDqaDb.h +++ /dev/null @@ -1,73 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef MDTDQADB_H -#define MDTDQADB_H - -#include <iostream> -#include <fstream> -#include <sstream> -#include <map> -#include <string.h> -#include <vector> - -class MdtDqaDb { - std::string m_chamberName; - int m_timeFlag, m_deadFlag; - float m_t0ML1, m_t0ML2, m_tdriftML1, m_tdriftML2; - float m_chi2ndofML1, m_chi2ndofML2, m_t0errML1, m_t0errML2; - float m_tdrifterrML1, m_tdrifterrML2; - int m_numDeadML, m_numDeadMezz, m_numDeadTube; - int m_numNoisyMezz, m_numNoisyTube; - std::vector<int> m_listDeadML, m_listDeadMezz, m_listDeadTube; - std::vector<std::pair<int,float> > m_listNoisyMezz, m_listNoisyTube; - -public: - MdtDqaDb(std::string chamName); - MdtDqaDb(); - virtual ~MdtDqaDb(); - void Clear(); - void Print(); //method to print to screen - void Print(std::ofstream *outfile); //print to file - void FillDb(/*some db info*/);//method to fill the cool tables - - //Set methods - void SetChamberName(std::string chamName); - void SetTimeFlag(int timeFlag); //method to update the time flag by hand - void SetDeadFlag(int deadFlag); //method to update the dead flag by hand - void SetML1(float t0, float tdrift, float chi2ndof, float t0err, float tdrifterr); - void SetML2(float t0, float tdrift, float chi2ndof, float t0err, float tdrifterr); - void SetDeadML(std::vector<int> deadML); - void SetDeadMezz(std::vector<int> deadMezz); - void SetDeadTube(std::vector<int> deadTube); - void SetNoisyMezz(std::vector<std::pair<int,float> > noisyMezz); - void SetNoisyTube(std::vector<std::pair<int,float> > noisyTube); - - //get methods - std::string getChamberName(); - int getTimeFlag(); - int getDeadFlag(); - int getNumDeadML(); - int getNumDeadMezz(); - int getNumDeadTube(); - int getNumNoisyMezz(); - int getNumNoisyTube(); - float getT0ML1(); - float getT0ML2(); - float getTdriftML1(); - float getTdriftML2(); - float getChi2ndofML1(); - float getChi2ndofML2(); - float getT0errML1(); - float getT0errML2(); - float getTdrifterrML1(); - float getTdrifterrML2(); - std::vector<int> getDeadML(); - std::vector<int> getDeadMezz(); - std::vector<int> getDeadTube(); - std::vector<std::pair<int,float> > getNoisyMezz(); - std::vector<std::pair<int,float> > getNoisyTube(); -}; - -#endif diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/MuonCalibStandAloneExtraTools/MdtDqaGlobalTimeFit.h b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/MuonCalibStandAloneExtraTools/MdtDqaGlobalTimeFit.h deleted file mode 100644 index 7c87f18f208b1618f85deda61fa960da54ce8a28..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/MuonCalibStandAloneExtraTools/MdtDqaGlobalTimeFit.h +++ /dev/null @@ -1,107 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef MuonCalib_MdtDqaGlobalTimeFitH -#define MuonCalib_MdtDqaGlobalTimeFitH - -//:::::::::::::::::::::::::::::::::::: -//:: CLASS MdtDqaGlobalTimeFit :: -//:::::::::::::::::::::::::::::::::::: - -/// \class MdtDqaGlobalTimeFit -/// -/// This class determines -/// -/// \author mauro.iodice@roma3.infn.it -/// -/// \date 05.09.2008 - -//:::::::::::::::::: -//:: HEADER FILES :: -//:::::::::::::::::: - -#include "MdtCalibData/IRtRelation.h" -#include "MdtCalibData/RtRelationLookUp.h" -#include "MdtCalibData/MdtCalibrationFactory.h" - -#include "MdtCalibUtils/GlobalTimeFitter.h" - -class RegionSelectionSvc; -class HistogramManager; - -//root -class TFile; -class TNtuple; -class TH1F; -class TH1I; - -namespace MuonGM{ - class MuonDetectorManager; -} - -namespace MuonCalib { - -class QuasianalyticLineReconstruction; -class IIdToFixedIdTool; -class MuonCalibSegment; -class NtupleStationId; -class MuonCalibEvent; - -// NOT MAINTAINED ANYMORE -- class MuCCaFitter; -class DCSLFitter; - -class MdtDqaGlobalTimeFit { - - public: - // Constructors // - MdtDqaGlobalTimeFit(int nbHitsMin, int nbHitsMax, float chi2cut, int BfieldON, bool debug); - ~MdtDqaGlobalTimeFit()=default; - - // Methods // - - /** tool initialize */ - StatusCode initialize(const MuonGM::MuonDetectorManager*, const MuonCalib::IIdToFixedIdTool *,RegionSelectionSvc *, HistogramManager *); - - StatusCode handleEvent(const MuonCalibEvent &event, int evnt_nr, const std::vector<MuonCalibSegment *> &segments, unsigned int position); - ///< analysis of the given segment of - ///< event eventnumber, event contains - ///< the raw hits - StatusCode analyseSegments(const std::vector<MuonCalibSegment *> & /*segemnts*/); - ///< analysis at the end of the data - ///< file - inline bool KeepSegments() const { - return false; - } - - IRtRelation *getDefaultRtRelation(int BfieldON); - - private: - const MuonGM::MuonDetectorManager *m_detMgr; - const MuonCalib::IIdToFixedIdTool *m_id_tool; - // pointer to region selection service - RegionSelectionSvc *p_reg_sel_svc; - - HistogramManager *m_histoManager; - std::string m_chamberAthenaName; - std::string m_chamberHardwareName; - - std::string m_file_name; //root file name - int m_minNumHits; //minimum number of hits in segment - int m_maxNumHits; //maximum number of hits in segment - float m_chi2_cut; //track chi2 cut; - int m_BfieldON; // BField was ON (1) or OFF (0) used for rtDefault choice; - bool m_debug; //write debugging rootfile - - // line reconstruction // - IRtRelation *m_rtRel; - //QuasianalyticLineReconstruction *m_qfitter; - // NOT MAINTAINED ANYMORE MuCCaFitter * m_muFitter; - DCSLFitter *m_muFitter; - GlobalTimeFitter *m_GTFitter; - -}; - -} //namespace MuonCalib - -#endif diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/MuonCalibStandAloneExtraTools/MdtDqaNtupleAnalysis.h b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/MuonCalibStandAloneExtraTools/MdtDqaNtupleAnalysis.h deleted file mode 100644 index 8d20c20e17addb4e9a6e755eaaf79dbff34b5ee9..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/MuonCalibStandAloneExtraTools/MdtDqaNtupleAnalysis.h +++ /dev/null @@ -1,70 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef SRC_MDTDQANTUPLEANALYSIS_H -#define SRC_MDTDQANTUPLEANALYSIS_H - -#include "GaudiKernel/Algorithm.h" -#include "MuonCalibStandAloneExtraTools/StringUtil.h" -#include "MuonCalibStandAloneExtraTools/HistogramManager.h" -#include "MuonCalibStandAloneExtraTools/MdtDqaDb.h" -#include "MuonCalibStandAloneExtraTools/MDTDqaDeadElements.h" -#include "MuonCalibStandAloneBase/RegionSelectionSvc.h" - -#include <iostream> -#include <vector> -#include <math.h> -#include <fstream> -#include <string> -#include <iomanip> -#include <sstream> - -#include "TFile.h" - -namespace MuonCalib { - - class MuonCalibEvent; - class MuonCalibSegment; - - /** - @class NtupleAnalysis - An example analysis class. One can use this class as a skeleton analysis. See the description of the separate methods for the possibilites of the Calib-EDM and standalone analysis (such as the use of Display and MuonCalib::T0Fitter) - @author Zdenko.Van.Kesteren@cern.ch - */ - class MdtDqaNtupleAnalysis { - public: - MdtDqaNtupleAnalysis(bool verbose, std::string outputFileName); //!< default constructor - virtual ~MdtDqaNtupleAnalysis()=default; - - StatusCode initialize(RegionSelectionSvc *, HistogramManager *, int, float); - - void handleEvent(const MuonCalibEvent &event, int eventnumber, const std::vector<MuonCalibSegment *> &segments, unsigned int position ); - void histogramAnalysis(TFile * rootfile); - - int segmentStation(MuonCalibSegment *segment ); - int segmentEta(MuonCalibSegment *segment ); - int segmentPhi(MuonCalibSegment *segment ); - - private: - RegionSelectionSvc *p_reg_sel_svc; - HistogramManager *m_histoManager; - bool m_verbose; - int m_DeadElementsAlgorithm; - int m_SectorMin; - int m_SectorMax; - bool m_analyseBarrel; - bool m_analyseEndcapA; - bool m_analyseEndcapC; - - float m_ADCCUT; - int m_evtCounter; - - std::string m_outputFileName; - std::vector<MdtDqaDb*> m_MdtDqaDbList; - - }; - -} //namespace MuonCalib - -#endif // MdtDqaNtupleAnalysis_h diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/MuonCalibStandAloneExtraTools/MdtDqaTrackAnalysis.h b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/MuonCalibStandAloneExtraTools/MdtDqaTrackAnalysis.h deleted file mode 100644 index 4f902ed94a6df59899d38879f16cfd43cd4f4679..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/MuonCalibStandAloneExtraTools/MdtDqaTrackAnalysis.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef MuonCalib_TrackAnalysisH -#define MuonCalib_TrackAnalysisH - -#include <iostream> -#include <vector> -#include <math.h> -#include <fstream> -#include <string> -#include <iomanip> -#include <sstream> - -#include "MuonCalibExtraTreeEvent/MuonCalibExtendedTrack.h" -#include "MuonCalibExtraTreeEvent/MuonCalibExtendedSegment.h" -#include "MuonCalibExtraTreeEvent/EventHandler.h" -#include "MuonCalibExtraTreeEvent/MuonCalibTrack_E.h" -#include "MuonCalibExtraTreeEvent/MuonCalibEvent_E.h" -#include "MuonCalibExtraTreeEvent/MuonCalibHit_E.h" -#include "MuonCalibExtraTreeEvent/MuonCalibSelector.h" -#include "MuonCalibExtraTreeEvent/MuonCalibHit_E.h" -#include "MuonCalibExtraTreeEvent/MuonCalibCaloHit.h" -#include "MuonCalibExtraTreeEvent/MuonCalibTrackSummary.h" -#include "MuonCalibExtraTreeEvent/MuonCalibSelector.h" -#include "MuonCalibExtraTreeEvent/MuonCalibTriggerInfo.h" -#include "MuonCalibEventBase/MuonCalibRawHitCollection.h" -#include "MuonCalibEventBase/MuonCalibRawMdtHit.h" -#include "MuonCalibEventBase/MuonCalibSegment.h" -#include "MdtCalibFitters/QuasianalyticLineReconstruction.h" -#include "MuonCalibEventBase/MuonCalibEvent.h" -#include "MuonCalibEventBase/MuonCalibPattern.h" -#include "MuonCalibEventBase/MuonCalibRawHitCollection.h" -#include "MuonCalibEventBase/MuonCalibTruthCollection.h" -#include "MuonCalibStandAloneExtraTools/HistogramManager.h" -#include "MuonCalibStandAloneExtraTools/SegmentAnalysis.h" -#include "MuonCalibStandAloneBase/RegionSelectionSvc.h" - -namespace MuonCalib{ - -class MdtDqaTrackAnalysis{ - - private: - int m_TrkAuthor; - HistogramManager *m_histoManager; - bool m_verbose; - // pointer to region selection service - RegionSelectionSvc *p_reg_sel_svc; - int number_IDhits(MuonCalibSelector::TrackVec::const_iterator, int); - int cutflow(MuonCalibSelector::TrackVec::const_iterator, double , int , int , int , int ); - int MDTtiming(const std::vector<const MuonCalibExtendedSegment*> &segments); - //void MDTtiming(const std::vector<MuonCalibSegment*>&); - - public: - MdtDqaTrackAnalysis(RegionSelectionSvc*,int, HistogramManager*, bool); - void handleEvent(const MuonCalibEvent&, int , const std::vector<MuonCalibSegment*>&, unsigned int); - -}; - -} //namespace MuonCalib - -#endif - diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/MuonCalibStandAloneExtraTools/MdtDqaTubeEfficiency.h b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/MuonCalibStandAloneExtraTools/MdtDqaTubeEfficiency.h deleted file mode 100644 index cf459178ef9df7efa0645d4e38834d05890f2f90..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/MuonCalibStandAloneExtraTools/MdtDqaTubeEfficiency.h +++ /dev/null @@ -1,137 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -// 13.08.2008, AUTHOR: MAURO IODICE -// ALGORITHM TAKEN FROM STEFFEN KAISER slightly modified -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - -#ifndef MuonCalib_MdtDqaTubeEfficiencyH -#define MuonCalib_MdtDqaTubeEfficiencyH - -//:::::::::::::::::::::::::::::::::::: -//:: CLASS MdtDqaTubeEfficiency :: -//:::::::::::::::::::::::::::::::::::: - -/// \class MdtDqaTubeEfficiency -/// -/// This class determines the single tube efficiencies and fakerates -/// and writes them to a TubeEfficiencies_<regionId>.txt and .root file. -/// (The fakerate only compares the raw hits to the tubes traversed by -/// one segment.) -/// -/// The combined efficiencies for the layer, multilayer and chamber are -/// calculated as weighted mean of the single tube efficiencies, according to -/// -/// eff = (Sum_i 1/sigma_i^2 * eff_i)/(Sum_i 1/sigma_i^2) -/// sigma = Sqrt( 1/(Sum_i 1/sigma_i^2) ) -/// -/// \author Steffen.Kaiser@cern.ch -/// -/// \date 10.04.2007 - -//:::::::::::::::::: -//:: HEADER FILES :: -//:::::::::::::::::: - -// this -#include "MdtCalibIOSvc/MdtCalibInputSvc.h" -class RegionSelectionSvc; -class HistogramManager; - -//root -class TFile; -class TNtuple; -class TH1F; -class TH1I; - -namespace Muon { - class IMuonIdHelperSvc; -} - -namespace MuonGM{ - class MuonDetectorManager; -} - -namespace MuonCalib { - -class QuasianalyticLineReconstruction; -class IIdToFixedIdTool; -class MuonCalibSegment; -class NtupleStationId; -class MuonCalibEvent; - - -class MdtDqaTubeEfficiency { - - public: - // Constructors // - MdtDqaTubeEfficiency(float nsigma, float chi2Cut, - bool defaultResol, float adcCut, bool GTFitON, bool useNewCalibConstants, bool useTimeCorrections ); - - ///< Default constructor. - inline ~MdtDqaTubeEfficiency(){} - ///< Destructor - - // Methods // - - /** tool initialize */ - StatusCode initialize(const Muon::IMuonIdHelperSvc*, const MuonGM::MuonDetectorManager*, const MuonCalib::IIdToFixedIdTool *, - RegionSelectionSvc *, MdtCalibInputSvc *, HistogramManager *); - - StatusCode handleEvent(const MuonCalibEvent &event, int evnt_nr, const std::vector<MuonCalibSegment *> &segments, unsigned int position); - ///< analysis of the given segment of - ///< event eventnumber, event contains - ///< the raw hits - StatusCode analyseSegments(const std::vector<MuonCalibSegment *> & /*segemnts*/); - ///< analysis at the end of the data - ///< file - inline bool KeepSegments() const { - return false; - } - - inline double defaultResolution(double radius) { - double P0 = 2.887916e-01 ; - double P1 = -4.391942e-02 ; - double P2 = 3.207732e-03 ; - double P3 = -1.593081e-04 ; - double P4 = 9.127890e-06 ; - double P5 = -2.565923e-07 ; - double resol = P0+P1*radius+P2*std::pow(radius,2)+P3*std::pow(radius,3)+P4*std::pow(radius,4)+P5*std::pow(radius,5); - return resol ; - } ; - - private: - const Muon::IMuonIdHelperSvc* m_idHelper; - const MuonGM::MuonDetectorManager *m_detMgr; - const MuonCalib::IIdToFixedIdTool *m_id_tool; - // pointer to region selection service - RegionSelectionSvc *p_reg_sel_svc; - MdtCalibInputSvc *p_calib_input_svc; - - HistogramManager *m_histoManager ; - std::string m_chamberAthenaName; - std::string m_chamberHardwareName; - - std::string m_file_name; // root file name - float m_nsigma; // efficiency at nsigma*resol(r) - float m_chi2Cut; // segment chi2/ndof cut; - bool m_defaultResol; // use default resolution instead of that found in the hit - float m_adcCut; // only consider hit above adcCut ; - bool m_GTFitON; // refit with GlobalTimeFitter the initial segment - bool m_useNewCalibConstants; - bool m_useTimeCorrections; - - // line reconstruction // - QuasianalyticLineReconstruction *m_qfitter; - - // counter/numbers // - int m_nb_stations ; - int m_nb_layers_tubes[1500][4] ; - -}; - -} //namespace MuonCalib - -#endif diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/MuonCalibStandAloneExtraTools/NtupleMdtDqaTool.h b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/MuonCalibStandAloneExtraTools/NtupleMdtDqaTool.h deleted file mode 100644 index 01b3e795f0edacc9cd9539785ffce21d75260ad2..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/MuonCalibStandAloneExtraTools/NtupleMdtDqaTool.h +++ /dev/null @@ -1,196 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -// 13.08.2008, AUTHOR: MAURO IODICE -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - -#ifndef MuonCalib_NtupleMdtDqaToolH -#define MuonCalib_NtupleMdtDqaToolH - -//:::::::::::::::::::::::::::::::::::: -//:: CLASS NtupleMdtDqaTool :: -//:::::::::::::::::::::::::::::::::::: - -/// \class NtupleMdtDqaTool -/// -/// This class performs low level MdtDqa analysis mainly focusing on -/// hits occupancies and segment quality. -/// -/// \author Mauro.Iodice@cern.ch -/// -/// \date 13.08.2008 - -//:::::::::::::::::: -//:: HEADER FILES :: -//:::::::::::::::::: - -#include "MuonCalibStandAloneBase/NtupleCalibrationTool.h" - -#include "MuonCalibStandAloneExtraTools/StringUtil.h" -#include "MuonCalibStandAloneExtraTools/HistogramManager.h" -#include "MuonCalibStandAloneExtraTools/MdtDqaDb.h" -#include "MuonCalibStandAloneExtraTools/MdtDqaNtupleAnalysis.h" -#include "MuonCalibStandAloneExtraTools/MdtDqaTubeEfficiency.h" -#include "MuonCalibStandAloneExtraTools/MdtDqaGlobalTimeFit.h" -#include "MuonCalibStandAloneExtraTools/MdtDqaTrackAnalysis.h" -#include "MuonCalibStandAloneExtraTools/SegmentAnalysis.h" - -#include "AthenaBaseComps/AthAlgTool.h" -#include "GaudiKernel/ServiceHandle.h" -#include "MuonIdHelpers/IMuonIdHelperSvc.h" - -class RegionSelectionSvc; -class MdtCalibInputSvc; - -class HistogramManager; - -//root -class TFile; -class TNtuple; -class TH1F; -class TH1I; - -namespace MuonGM{ -class MuonDetectorManager; -} - -namespace MuonCalib { - -class QuasianalyticLineReconstruction; -class IIdToFixedIdTool; -class MuonCalibSegment; -class NtupleStationId; -class MuonCalibEvent; - -class NtupleMdtDqaTool : public AthAlgTool, virtual public NtupleCalibrationTool { - - public: - // Constructors // - NtupleMdtDqaTool(const std::string& t, const std::string& n, const IInterface* p); - - ~NtupleMdtDqaTool()=default; - - // Methods // - - /** tool initialize */ - StatusCode initialize(); - - /** tool finalize */ - StatusCode finalize(); - - StatusCode handleEvent(const MuonCalibEvent &event, int evnt_nr, const std::vector<MuonCalibSegment *> &segments, unsigned int position); - ///< analysis of the given segment of - ///< event eventnumber, event contains - ///< the raw hits - - // StatusCode analyseSegments(const std::vector<MuonCalibSegment *> & /*segemnts*/); - StatusCode analyseSegments(const std::vector<MuonCalibSegment *> &segments); - - ///< analysis at the end of the data - ///< file - inline bool KeepSegments() const { - return false; - } - - private: - ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; - const MuonGM::MuonDetectorManager *m_detMgr; - const MuonCalib::IIdToFixedIdTool *m_id_tool; - - // pointer to region selection service - RegionSelectionSvc* p_reg_sel_svc; - - // pointer to the calibration service - MdtCalibInputSvc* p_calib_input_svc; - // Manager tools // - HistogramManager* m_histoManager; - - // Analysis tools and variables : // - // - // MdtDqaNtupleAnalysis - // - MdtDqaNtupleAnalysis *m_ntupleAna; - MdtDqaTrackAnalysis *m_trackAnalyzer; - SegmentAnalysis *m_segmentAnalyzer; - bool m_verbose; - bool m_fillHistos; - bool m_doFinalize; - std::string m_MdtDqa_file_name; // .root and .txt are root and text file names - bool m_doHitResids; // Toggle between calculating the hit(or fit) residuals for SegResidVsRadius instead - - float m_ADCCUT; - - // - // MdtDqaTubeEfficiency - // - bool m_doEfficiency; - MdtDqaTubeEfficiency * m_tubeEffi; - float m_EffiNSigma; // efficiency at nsigma*resol(r) - float m_EffiChi2Cut; // segment chi2/ndof cut; - bool m_EffiUseDefaultResolution; //use default resolution instead of that found in the hit - float m_EffiHitADCCut; // only consider hit above adcCut; - bool m_EffiGTFitON; // refit with GlobalTimeFitter the initial segment - bool m_EffiUseNewCalibConstants; - bool m_EffiUseTimeCorrections; - - // - // MdtDqaGlobalTimeFit - // - bool m_doGlobalTimeFit; - // bool m_doGTFit_t0Refit; // TO BE IMPLEMENTED - MdtDqaGlobalTimeFit * m_globalTimeFit; - int m_rtDefaultBfieldON; - float m_GTFitSeg_chi2Cut; - int m_GTFitSeg_minNumHits; - int m_GTFitSeg_maxNumHits; - bool m_GTFitDebug; - - // TRACK ANALYSIS - bool m_doTracks; - //bool m_quickTrack; - int m_TrkAuthor; - - //Dead Tube analysis - int m_DeadElementsAlgorithm; - - // calibration region// - //const NtupleStationId *m_cal_region; - - // line reconstruction // - //QuasianalyticLineReconstruction *m_qfitter; - - // counter/numbers // - //int m_nb_trigger; - //int m_nb_multilayers; - //int m_nb_layers; - //int m_nb_tubes; - - // histograms // - //TH1F *h_distance; - //TH1I *h_nb_hit_tubes; - -/* - std::vector< std::vector< std::vector<TH1F*> > > h_efficiency; - std::vector< std::vector< std::vector<TH1F*> > > h_fakerate; - - std::vector< std::vector<TH1F*> > h_tube_efficiency; - std::vector< std::vector<TH1F*> > h_tube_fakerate; - - std::vector< std::vector<TH1F*> > h_tube_entries_efficiency; - std::vector< std::vector<TH1F*> > h_tube_entries_fakerate; -*/ - //TH1F *h_layer_efficiency; - //TH1F *h_layer_fakerate; - - //TH1F *h_chamber_efficiency; - //TH1F *h_chamber_fakerate; - - //TH1F *h_chi2; - -}; - -} //namespace MuonCalib - -#endif diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/MuonCalibStandAloneExtraTools/PhiEtaUtils.h b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/MuonCalibStandAloneExtraTools/PhiEtaUtils.h deleted file mode 100644 index 42f6754ccca5c219f67f73df4c2c1bea9bb6c823..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/MuonCalibStandAloneExtraTools/PhiEtaUtils.h +++ /dev/null @@ -1,122 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef SRC_PHIETAUTIL_H -#define SRC_PHIETAUTIL_H - -#include "MuonCalibIdentifier/MuonFixedId.h" -#include "MuonCalibStandAloneExtraTools/StringUtil.h" - -class PhiEtaNameConverter { - - public: - PhiEtaNameConverter() {}; //!< default constructor - ~PhiEtaNameConverter() {}; //!< destructor - - inline std::string chamberHardwareName(int stationId, int phi, int eta){ - std::string chamberName = "UNDEFINED" ; - MuonCalib::MuonFixedId id(stationId) ; - ToString ts ; - if (!id.is_mdt() ) return chamberName ; - chamberName = id.stationNumberToFixedStationString(stationId); - int absoluteEta = std::abs(eta) ; - std::string side = "A"; - if(eta<0) side="C"; - int sector = phi_8to16(stationId, phi) ; - std::string sectorString ; - if(sector<10) sectorString = "0"+ts(sector); - if(sector>=10) sectorString = ts(sector); - chamberName += ts(absoluteEta)+side+sectorString ; - return chamberName ; - } - - inline std::string chamberAthenaName(int stationId, int phi, int eta){ - std::string chamberName = "UNDEFINED" ; - MuonCalib::MuonFixedId id(stationId) ; - ToString ts ; - if (!id.is_mdt() ) return chamberName ; - chamberName = id.stationNumberToFixedStationString(stationId); - chamberName += "_"+ts(phi)+"_"+ts(eta) ; - return chamberName ; - } - - inline int phi_8to16(int station, int phi8){ - // ENDCAP : - if (station>13 && station<25) { - if (station==15 || station==16 ||station==19 ||station==22) { - return phi8*2-1 ; - } else { - return phi8*2 ; - } - } - - //large BIL,BML,BOL - if(station==1||station==3||station==5 - || station==8 //BIR - || station==13 //BIM - || station==12 //BME - ){ - return phi8*2-1; - } - //small. BIS,BMS,BOS - if(station==2||station==4||station==6 - || station==7 //BEE - || station==9 //BMF - || station==10 //BOF - || station==11 //BOG - || station==35 //BMG - ){ - return phi8*2; - } - - if( station%2 == 0 ){ - return phi8*2; - } - return phi8*2-1; - } //end phi_8to16 - - inline int phi_16to8(int station, int phi16){ - if(station==1||station==3||station==5 - || station==8 //BIR - || station==13 //BIM - || station==12 //BME - ){ - return (phi16+1)/2; - } - if(station==2||station==4||station==6 - || station==7 //BEE - || station==9 //BMF - || station==10 //BOF - || station==11 //BOG - || station==35 //BMG - ){ - return phi16/2; - } - - if(phi16%2 == 0 ){ - return phi16/2; - } - - return (phi16+1)/2; - - } //end phi_16to8 - -// CHE E' STA ROBBBA ???? -// -inline int eta_atlas2loc(int eta){ - int eta2= eta+7; - if(eta<0) eta2=eta+8; - return eta2; -} - -inline int eta_loc2atlas(int eta){ - int eta2; - if(eta<=7) eta2=eta-8; - if(eta>=8) eta2=eta-7; - return eta2; -} - -}; - -#endif // SRC_PHIETAUTIL_H diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/MuonCalibStandAloneExtraTools/SegmentAnalysis.h b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/MuonCalibStandAloneExtraTools/SegmentAnalysis.h deleted file mode 100644 index c9c11354374141634484f9b3645efc8ead1cfef6..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/MuonCalibStandAloneExtraTools/SegmentAnalysis.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef MuonCalib_SegmentAnalysisH -#define MuonCalib_SegmentAnalysisH - -#include <iostream> -#include <vector> -#include <math.h> -#include <fstream> -#include <string> -#include <iomanip> -#include <sstream> - -#include "MuonCalibEventBase/MuonCalibRawHitCollection.h" -#include "MuonCalibEventBase/MuonCalibRawMdtHit.h" -#include "MuonCalibEventBase/MuonCalibSegment.h" -#include "MdtCalibFitters/QuasianalyticLineReconstruction.h" -#include "MuonCalibEventBase/MuonCalibEvent.h" - -#include "MuonCalibStandAloneExtraTools/HistogramManager.h" -#include "MuonCalibStandAloneBase/RegionSelectionSvc.h" - -namespace MuonCalib{ - -class SegmentAnalysis{ - - private: - HistogramManager *m_histoManager; - // pointer to region selection service - RegionSelectionSvc *p_reg_sel_svc; - bool m_verbose; - int multiChambSeg( MuonCalibSegment *segment ); - int segmentStation( MuonCalibSegment *segment ); - int segmentEta( MuonCalibSegment *segment ); - int segmentPhi( MuonCalibSegment *segment ); - - int m_SectorMin; - int m_SectorMax; - - bool m_doHitResids; - - public: - SegmentAnalysis(RegionSelectionSvc*,HistogramManager*, bool, bool); - void handleEvent(const MuonCalibEvent&, int , const std::vector<MuonCalibSegment*>&, unsigned int position); -}; - -} - -#endif diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/MuonCalibStandAloneExtraTools/StringUtil.h b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/MuonCalibStandAloneExtraTools/StringUtil.h deleted file mode 100644 index 4c3304ef205be380a1140fd5c2f6b04b4249da3f..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/MuonCalibStandAloneExtraTools/StringUtil.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef SRC_STRINGUTIL_H -#define SRC_STRINGUTIL_H - -class ToString{ - public: - template< class T > std::string operator()( const T& i ) { - std::ostringstream os; - os << i; - return os.str(); - } -}; - -/* -class ToChar { - public: - char* operator()( const string i ) - { - return i.c_str(); - } - char* operator()( const int i ) - { - ToString ts; - return ts(i).c_str(); - } - char* operator()( const float i ) - { - ToString ts; - return ts(i).c_str(); - } - char* operator()( const char * i ) - { - return i; - } - -}; -*/ - -#endif // SRC_STRINGUTIL_H diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/MuonCalibStandAloneExtraTools/TimeAndAdcFitter.h b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/MuonCalibStandAloneExtraTools/TimeAndAdcFitter.h deleted file mode 100644 index c0efdcd5e8f945415ac67a12e8f811b5e250f97a..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/MuonCalibStandAloneExtraTools/TimeAndAdcFitter.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef SRC_TIMEANDADCFITTER_H -#define SRC_TIMEANDADCFITTER_H - -#include <string.h> -#include <stdio.h> - -#include <sstream> -#include <iostream> -#include <fstream> - -#include <TFile.h> -#include <TString.h> -#include <vector> -#include "TH1.h" -#include "TObjArray.h" - -class TimeAndAdcFitter { -public: - TimeAndAdcFitter() : m_verbose(0) {}; - ~TimeAndAdcFitter() {}; - void doTimeFit(TH1F * h, const int nParams, double * pfit, double * errfit, double* chi2, int* ndof ) ; - // void doTimeFit(TH1F * h); - void doAdcFit(TH1F * h, const int nAdcParams, double * Adcpfit, double * errAdcpfit, double* chi2Adc, int* ndofAdc ) ; - void searchParams(TH1 * h, double * p, int np); - void setVerbose(int lvl) { m_verbose = lvl; } - -private: - int m_verbose; - -}; - -//////////////////////////////////////////////////////////////////// -// -// UTILITIES of General use -// -/* -class ToString { - public: - template< class T > - std::string operator()( const T& i ) - { - std::ostringstream os; - os << i; - return os.str(); - } -}; -*/ -#endif diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/MuonCalibStandAloneExtraTools/TrackSecondCoordinateToSegment.h b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/MuonCalibStandAloneExtraTools/TrackSecondCoordinateToSegment.h deleted file mode 100644 index 21e059790ddfa5e95abdf7383a3a4f95ce0dbd8d..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/MuonCalibStandAloneExtraTools/TrackSecondCoordinateToSegment.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef MuonCalib_TrackSecondCoordinateToSegment_h -#define MuonCalib_TrackSecondCoordinateToSegment_h - -//Gaudi -#include "GaudiKernel/ServiceHandle.h" -#include "AthenaBaseComps/AthAlgTool.h" - -//MuonCalibStandAloneBase -#include "MuonCalibStandAloneBase/CalibSegmentPreparationTool.h" - -//root -class TFile; -class TH1F; -class TH2F; -namespace MuonCalib { - -class MuonCalibSegment; -class MuonCalibExtendedTrack; - -class TrackSecondCoordinateToSegment : public AthAlgTool, virtual public CalibSegmentPreparationTool { - public: -//=========================constructor========================================== - TrackSecondCoordinateToSegment(const std::string &t, const std::string &n, const IInterface *p); - inline ~TrackSecondCoordinateToSegment() {} -//=========================public member functions============================== - //initialize and finalize - StatusCode initialize(void); - StatusCode finalize(void); - //load event - void prepareSegments(const MuonCalibEvent *& /*event*/, std::map<NtupleStationId, MuonCalibSegment *> &segments); - private: -//=========================private data========================================= - //control histrograms - plot changes of x coordinate - bool m_control_histos; - TFile *m_root_file; - TH1F *m_delta_x; - TH1F *m_delta_sx; - TH1F *m_delta_hit_x; - inline void apply_2n_coordinate(const MuonCalibExtendedTrack *track, MuonCalibSegment *segment) const; - inline void updatePosition(Amg::Vector3D & position, const Amg::Vector3D & seg_pos, const Amg::Vector3D &seg_dir) const; - // inline void updatePosition(HepGeom::Point3D<double> &position, const HepGeom::Point3D<double> &seg_pos, const HepGeom::Vector3D<double> &seg_dir) const; -}; - -} //namespace MuonCalib - -#endif diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/python/CalibExtraNtupleAnalysisConfig.py b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/python/CalibExtraNtupleAnalysisConfig.py deleted file mode 100644 index 3c0db0a2392946e58f376daed55ee4493c589beb..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/python/CalibExtraNtupleAnalysisConfig.py +++ /dev/null @@ -1,154 +0,0 @@ -# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration - -from __future__ import print_function - -from MuonCalibStandAloneExtraTools.MuonCalibStandAloneExtraToolsConfig import * -print ("NoRecalibration=", NoRecalibration) -from CalibNtupleAnalysisAlg.CalibNtupleAnalysisConfig import * -print ("NoRecalibration=", NoRecalibration) -from MuonCalibStandAloneExtraTools.MuonCalibStandAloneExtraToolsConf import * -print ("NoRecalibration=", NoRecalibration) -#ToolSvc = Service( "ToolSvc" ) - - -def GenTrackAuthorCodes(author, primary_only=False, combined_only=False, stand_alone_only=False): -# With this section commented out, code will not work on Run1 calib ntuples -# Maybe, can have both Run1 and Run2 tracks authors in list, need to check. -# Athena <=17, Run1 calib ntuples -# track_types=range(0, 5) -# if combined_only: -# track_types=[2,3] -# if stand_alone_only: -# track_types=[0] - -# ret=[] -# for tp in track_types: -# ret.append(tp + 100* author + 10) -# if not primary_only: -# for tp in track_types: -# ret.append(tp + 100* author) -# Athena >= 20, Run2 ntuples -# Calibstream has track author 200 only -# Raw data (Reco_tf.py) has track authors 206 (standalone), 208 (combined) - track_types=range(0, 1) - if combined_only: - track_types=[8] - if stand_alone_only: - track_types=[0,6] - - ret=[] - for tp in track_types: - ret.append(tp + 200) -# if not primary_only: -# for tp in track_types: -# ret.append(tp + 100* author) - - return ret - -class CalibExtraNtupleAnalysisConfig(CalibNtupleAnalysisConfig): - LoadExtraNtuple=True - SelectTrackSegments=True - TrackSecondCoordinate=True #THIS IS OVERWRITTEN in skeleton.mdt_calib_ntuple_trf.py - need to modify that to run TrackSecondCoordinate - MomentumCut=-1.0 - FastTrackMatch=True - SuperFastTrackMatch=False - - def AutoConfig(self): - self._create_CalibNtupleAnalysisAlg() - #ntuple loader - if self.LoadExtraNtuple: - self.CalibNtupleLoader = MuonCalib__CalibExtraNtupleLoader() - else: - self.CalibNtupleLoader = MuonCalib__CalibNtupleLoader() - self.sToolSvc += self.CalibNtupleLoader - self.CalibNtupleLoader.FileList = self.FileList - self.CalibNtupleLoader.FirstEvent = self.FirstEvent - self.CalibNtupleLoader.LastEvent = self.LastEvent - if not self.LoadExtraNtuple: - self.CalibNtupleLoader.NtupleType = "AUTO" - self.CalibNtupleAnalysisAlg.CalibSegmentPreparationTools.append( self.CalibNtupleLoader) - #region selection - if not self.SelectTrackSegments or not self.LoadExtraNtuple: - self._region_selection() - else: - self._track_region_selection() - #raw times - self._good_run_list_filter() - if self.ApplyRawTimes: - self.RawTimesReplacement=MuonCalib__ApplyRawTimes() - self.sToolSvc += self.RawTimesReplacement - self.CalibNtupleAnalysisAlg.CalibSegmentPreparationTools.append(self.RawTimesReplacement) - #initial DQ list - self._initial_DQ_list() - #apply RPC Timing Correction - if self.RPCTimingCorr: - self.RpcTiming=MuonCalib__RpcTimingCorr() - self.sToolSvc += self.RpcTiming - self.CalibNtupleAnalysisAlg.CalibSegmentPreparationTools.append(self.RpcTiming) - #correct segment second coordinate using tracks - if self.SelectTrackSegments and self.TrackSecondCoordinate and self.LoadExtraNtuple: - self.TrackSecondCoordinateTool = MuonCalib__TrackSecondCoordinateToSegment() - self.TrackSecondCoordinateTool.ControlHistograms=True - self.sToolSvc += self.TrackSecondCoordinateTool - self.CalibNtupleAnalysisAlg.CalibSegmentPreparationTools.append(self.TrackSecondCoordinateTool) - #recalculate 2nd coordinate: - self._second_coordinate() - #segment recalibration - if not self.SuppressRecalibration: - self._configure_segment_recalibration("SegmentRecalibration") - #segment refitter - if self.SegmentRefit: - self._config_segment_refitter() - #B field updater - if self.UpdateBField: - self._config_UpdateBField() - self._configure_segment_recalibration("SegmentRecalibration2") - if self.SegmentRefit and self.RefitAfterBFieldUpdate: - self._config_segment_refitter("SegmentRefitter2") - #calibration IO - self._config_calibIO() - #create tool - self._create_calib_tool_extra() - -#------------------------------------------------------------------------------ - def _create_calib_tool_extra(self): - self._create_calib_tool() - if self.CalibrationTool: - return - self.CalibrationTool=CreateCalibExtraTool(self.CalibrationAlgorithm) - if self.CalibrationTool: - self.sToolSvc += self.CalibrationTool - self.CalibNtupleAnalysisAlg.CalibrationTool = self.CalibrationTool - - def _track_region_selection(self): - if self.SuperFastTrackMatch: - self.RegionSelection = MuonCalib__ExtraRegionSelectorSuperFast() - if self.SegmentAuthor == 3: #Muonboy, Athena <= 17 only - self.RegionSelection.TrackAutors=GenTrackAuthorCodes(1) - elif self.SegmentAuthor == 4: #Moore, Run1+Run2 - self.RegionSelection.TrackAutors=GenTrackAuthorCodes(0) - elif self.SegmentAuthor == 5: #what is this? - self.RegionSelection.TrackAutors=GenTrackAuthorCodes(2) - - elif self.FastTrackMatch: - self.RegionSelection = MuonCalib__ExtraRegionSelectorFast() - self.RegionSelection.SelectSegmentAuthor = self.SegmentAuthor - if self.SegmentAuthor == 3: - self.RegionSelection.TrackAutors=GenTrackAuthorCodes(1) - elif self.SegmentAuthor == 4: - self.RegionSelection.TrackAutors=GenTrackAuthorCodes(0) - elif self.SegmentAuthor == 5: - self.RegionSelection.TrackAutors=GenTrackAuthorCodes(2) - else: - self.RegionSelection = MuonCalib__ExtraRegionSelector() - self.RegionSelection.MuonBoyTracks = (self.SegmentAuthor == 3) - self.RegionSelection.SelectSegmentAuthor = self.SegmentAuthor - self.RegionSelectionSvc = RegionSelectionSvc() - self.RegionSelectionSvc.Region = self.CalibrationRegion - self.RegionSelection.MomentumCut = self.MomentumCut - self.RegionSelection.MinHits = self.MinSegmentHits - self.RegionSelection.MaxHits = self.MaxSegmentHits - self.sToolSvc += self.RegionSelection - self.CalibNtupleAnalysisAlg.CalibSegmentPreparationTools.append( self.RegionSelection ) - RegionSelectionSvc.PrintList = True - self.sServiceMgr += self.RegionSelectionSvc diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/python/MuonCalibStandAloneExtraToolsConfig.py b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/python/MuonCalibStandAloneExtraToolsConfig.py deleted file mode 100644 index 13449cc99bfd844ee50ef2ba91b906523bd9d7eb..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/python/MuonCalibStandAloneExtraToolsConfig.py +++ /dev/null @@ -1,41 +0,0 @@ -# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration - -from __future__ import print_function - -from MuonCalibStandAloneTools.MuonCalibStandAloneToolsConfig import * -from MuonCalibStandAloneExtraTools.MuonCalibStandAloneExtraToolsConf import * - -#list tools that do not need any recalibration -NoRecalibration += ["Splitter"] - -#list tools that needs the t0 reverted -#RevertT0 += [] - -#list tools, that needs the t0 recalibrated -#RecalibT0 += [] - -#list tools that need all recalibrated -#RecalibAll += [] - -#algorithms for which no segment refit should be done, even if requested by user -NoSegmentRefit += ["Splitter"] - -#algorithms fotr which the number of read segments should be limited -#LimitSegmentsFor += [] - -#algorithms, that need validated t0 and rt -ValidatedT0 += [ "MdtDqa", "Splitter" ] - -ValidatedRt += [ "MdtDqa", "Splitter" ] - - -def CreateCalibExtraTool(CalibrationTool): - dir() - if CalibrationTool == "MdtDqa": - return MuonCalib__NtupleMdtDqaTool() - if CalibrationTool == "Splitter": - return MuonCalib__NtupleSplitterTool() - else: - print ("WARNING: Unknown tool name '" + CalibrationTool + "'!") - return None - diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/src/CalibExtraNtupleLoader.cxx b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/src/CalibExtraNtupleLoader.cxx deleted file mode 100644 index 120d0031cccb6da96c39e8e5991c05fe1e94bf67..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/src/CalibExtraNtupleLoader.cxx +++ /dev/null @@ -1,125 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -//this -#include "MuonCalibStandAloneExtraTools/CalibExtraNtupleLoader.h" - -//CalibNtupleReader -#include "MuonCalibExtraNtuple/NTReader_E.h" - -//MuonCalibExtraTreeEvent -#include "MuonCalibExtraTreeEvent/MuonCalibEvent_E.h" - -//MuonCalibStandAloneBase -#include "MuonCalibStandAloneBase/RegionSelectionSvc.h" - -//root -#include "TChain.h" -#include "TFile.h" -#include "TKey.h" - -//c - c++ -#include "fstream" - -namespace MuonCalib { - -/////////////////////// -// CalibExtraNtupleLoader // -/////////////////////// -CalibExtraNtupleLoader::CalibExtraNtupleLoader(const std::string &t, const std::string &n, const IInterface *p): - AthAlgTool(t, n, p), p_reg_sel_svc(NULL) { - m_filelist="file_list.txt"; - declareProperty("FileList", m_filelist); - m_first = 0; - declareProperty("FirstEvent", m_first); - m_last = -1; - declareProperty("LastEvent", m_last); - m_ntuple_type="AUTO"; - declareProperty("NtupleType", m_ntuple_type); - declareInterface< CalibSegmentPreparationTool >(this); -} - -//////////////// -// initialize // -//////////////// -StatusCode CalibExtraNtupleLoader::initialize(void) { - ATH_MSG_INFO( "Filelist is '"<<m_filelist<<"'" ); - //convert Ntuple Type - if(m_ntuple_type == "AUTO") { - m_ntuple_type_num = 0; - } else if (m_ntuple_type == "NORMAL") { - m_ntuple_type_num = 1; - } else if (m_ntuple_type == "REGION") { - m_ntuple_type_num = 2; - } else { - ATH_MSG_FATAL("Invalid ntuple type. Must be AUTO/NORMAL/REGION!"); - return StatusCode::FAILURE; - } -//read filelist an build chain - m_chain = new TChain("/PatternNtupleMaker/Segments"); - std::string sdummy; - int count(0); - std::ifstream fl(m_filelist.c_str()); - if(fl.fail()) { - ATH_MSG_INFO("Cannot open file '"<<m_filelist<<"' for reading!"); - return StatusCode::FAILURE; - } - while (!fl.eof()) { - fl >> sdummy; - if (fl.eof()) - break; - bool is_region(false); - if(m_ntuple_type_num == 3) - is_region = true; - if(m_ntuple_type_num == 0) { - TFile testf(sdummy.c_str()); - if(testf.GetKey("PatternNtupleMaker") == NULL){ - is_region = true; - } else { - is_region = false; - } - } - if (is_region) { - if(p_reg_sel_svc == NULL) { - StatusCode sc=service("RegionSelectionSvc", p_reg_sel_svc); - if(!sc.isSuccess()) { - ATH_MSG_ERROR("Cannot retrieve RegionSelectionSvc!"); - return sc; - } - } - ATH_MSG_INFO("Added "<<p_reg_sel_svc->AddRegionNtuples(sdummy.c_str(), m_chain)<<" regions from file "<<sdummy); - } else { - m_chain->Add(sdummy.c_str()); - ATH_MSG_INFO("Added file '"<<sdummy<<"' to filelist!"); - } - count++; - } - if(count==0){ - ATH_MSG_FATAL("No files in filelist!"); - return StatusCode::FAILURE; - } - m_reader = new NTReader_E(m_chain); - return StatusCode::SUCCESS; -} //end CalibExtraNtupleLoader::initialize - -///////////////////// -// prepareSegments // -///////////////////// -void CalibExtraNtupleLoader::prepareSegments(const MuonCalibEvent *&event, std::map<NtupleStationId, MuonCalibSegment *> & /*segments*/){ - if(m_last>0 && m_last<=m_first) { - ATH_MSG_INFO("Enough events read!"); - event=NULL; - return; - } - const MuonCalibEvent_E &evt = m_reader->getEvent(m_first); - event = static_cast<const MuonCalibEvent *>(&evt); - if( event->rawHitCollection() == NULL ) { - ATH_MSG_INFO("End of file reached"); - event=NULL; - return; - } - m_first++; -} //end CalibExtraNtupleLoader::prepareSegments - -} //namespace MuonCalib diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/src/ExtraRegionSelector.cxx b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/src/ExtraRegionSelector.cxx deleted file mode 100644 index c142f61cb8854c6ef439b96f575aee804512f275..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/src/ExtraRegionSelector.cxx +++ /dev/null @@ -1,157 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -//this -#include "MuonCalibStandAloneExtraTools/ExtraRegionSelector.h" - -//MuonCalibStandAloneBase -#include "MuonCalibStandAloneBase/RegionSelectionSvc.h" - -//MuonCalibExtraTreeEvent -#include "MuonCalibExtraTreeEvent/MuonCalibEvent_E.h" -#include "MuonCalibExtraTreeEvent/MuonCalibExtendedSegment.h" -#include "MuonCalibExtraTreeEvent/MuonCalibExtendedTrack.h" - -#include "MuonCalibEventBase/MuonCalibEvent.h" - -#include "TFile.h" -#include "TH1.h" -#include "TDirectory.h" - -namespace MuonCalib { - -/////////////////////////// -// ExtraRegionSelector // -/////////////////////////// -ExtraRegionSelector::ExtraRegionSelector(const std::string &t, const std::string &n, const IInterface *p): AthAlgTool(t, n, p) { - m_exclusive_segments = false; - declareProperty("ExclusiveSegments", m_exclusive_segments); - m_muonboy = false; - declareProperty("MuonBoyTracks", m_muonboy); - m_min_hits = 1; - declareProperty("MinHits", m_min_hits); - m_max_hits = 0; - declareProperty("MaxHits", m_max_hits); - m_select_seg_author = 4; - declareProperty("SelectSegmentAuthor", m_select_seg_author); - m_momentum_cut=-1.5; - declareProperty("MomentumCut", m_momentum_cut); - m_do_debug_file=false; - declareProperty("DoDebugFile", m_do_debug_file); - m_debug_file=NULL; - m_all_p=NULL; - m_selected_p_by_track=NULL; - m_selected_p_by_segment=NULL; - declareInterface< CalibSegmentPreparationTool >(this); -} //end ExtraRegionSelector::ExtraRegionSelector - -//////////////// -// initialize // -//////////////// -StatusCode ExtraRegionSelector::initialize(void) { - MsgStream log(msgSvc(), name()); - StatusCode sc=service("RegionSelectionSvc", p_reg_sel_svc); - if(!sc.isSuccess()) { - log << MSG::ERROR <<"Cannot retrieve RegionSelectionSvc!" <<endmsg; - } - if(m_muonboy) { - m_track_author_id = m_evt_handler.muonboyIndices().track; - } else { - m_track_author_id = m_evt_handler.mooreIndices().track; - } - if(m_do_debug_file) { - TDirectory *prev_dir=gDirectory; - m_debug_file = new TFile("ExtraRegionSelector.root", "RECREATE"); - m_all_p = new TH1F("all_p", "" ,20000, -100000, 100000); - m_selected_p_by_track = new TH1F("selected_p_by_track", "" ,20000, -100000, 100000); - m_selected_p_by_segment = new TH1F("selected_p_by_segment", "" ,20000, -100000, 100000); - prev_dir->cd(); - } - return sc; -} //end ExtraRegionSelector::initialize - -StatusCode ExtraRegionSelector::finalize(void) { - if(m_do_debug_file) { - m_debug_file->Write(); - delete m_all_p; - delete m_selected_p_by_track; - delete m_selected_p_by_segment; - delete m_debug_file; - } - return StatusCode::SUCCESS; -} - -void ExtraRegionSelector::prepareSegments(const MuonCalibEvent *&event, std::map<NtupleStationId, MuonCalibSegment *> &segments) { - MsgStream log(msgSvc(), name()); - if(event==NULL) { - log << MSG::FATAL << "event=NULL"<<endmsg; - event=NULL; - return; - } - const MuonCalibEvent *e(event); - const MuonCalibEvent_E *e_event=dynamic_cast<const MuonCalibEvent_E *>(e); - if(e_event==NULL) { - log << MSG::FATAL << "This tool works only with extra events!"<<endmsg; - event=NULL; - return; - } - segments.clear(); - m_evt_handler.setEvent(*e_event); - std::vector<unsigned int> calib_region_hit_map; - const EventHandler::TrackVec& e_trks(m_evt_handler.extendedTracks(m_track_author_id)); - for(EventHandler::TrkCit tit = e_trks.begin(); tit!=e_trks.end(); tit++) { - const MuonCalibExtendedTrack *trk(*tit); - const std::vector<const MuonCalibExtendedSegment*> &segs(trk->associatedSegments()); - if(m_all_p) m_all_p->Fill(trk->p()); - if (m_momentum_cut>-1) { - if(trk->p()>1e8) continue; - if(m_momentum_cut>=0 && std::abs(trk->p())<m_momentum_cut) continue; - } - if(m_selected_p_by_track) m_selected_p_by_track->Fill(trk->p()); - for(std::vector<const MuonCalibExtendedSegment*>::const_iterator seg_it=segs.begin(); seg_it!=segs.end(); seg_it++) { - MuonCalibExtendedSegment *seg = const_cast<MuonCalibExtendedSegment *>(*seg_it); - //check count hits in the calibration region and remove others - calib_region_hit_map.clear(); - bool reject(false); - int count(0); - for(MuonCalibSegment::MdtHitCit hit_it=seg->mdtHOTBegin(); hit_it!=seg->mdtHOTEnd(); hit_it++){ - unsigned int is_in_region(static_cast<unsigned int>(!p_reg_sel_svc->isInRegion((*hit_it)->identify())));// || m_suppressed_tubes.find((*hit_it)->identify())!=m_suppressed_tubes.end())); - calib_region_hit_map.push_back(is_in_region); - if(is_in_region!=0 && m_exclusive_segments){ - reject=true; - break; - } - if(is_in_region==0) - count++; - } - if(reject) continue; - if(count<m_min_hits || (count>m_max_hits && m_max_hits>0)) continue; - if(count==0) continue; - seg->refineMdtSelection(calib_region_hit_map); - NtupleStationId id(seg->mdtHOT()[0]->identify()); - id.SetMultilayer(0); - if(m_selected_p_by_segment) m_selected_p_by_segment->Fill(trk->p()); - //store segment if it is the first in the station - if(segments[id] == NULL) { - segments[id] = seg; - continue; - } - //overwrite segment if this has more hits than the stored segment - MuonCalibSegment *stored(segments[id]); - if(stored->mdtHitsOnTrack() < seg->mdtHitsOnTrack()) { - segments[id] = seg; - continue; - } - if(stored->mdtHitsOnTrack() > seg->mdtHitsOnTrack()) { - continue; - } - //overwrite segment if the new one has a better chi^2 - if(stored->chi2() > seg->chi2()){ - segments[id] = seg; - } - } - } -} //end ExtraRegionSelector::prepareSegments - -} // namespace Muoncalib diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/src/ExtraRegionSelectorFast.cxx b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/src/ExtraRegionSelectorFast.cxx deleted file mode 100644 index cebfdd019aa2abac53228915b834c39ba2835f41..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/src/ExtraRegionSelectorFast.cxx +++ /dev/null @@ -1,217 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -//this -#include "MuonCalibStandAloneExtraTools/ExtraRegionSelectorFast.h" - -//MuonCalibStandAloneBase -#include "MuonCalibStandAloneBase/RegionSelectionSvc.h" - -//MuonCalibExtraTreeEvent -#include "MuonCalibExtraTreeEvent/MuonCalibEvent_E.h" -#include "MuonCalibExtraTreeEvent/MuonCalibTrack_E.h" -#include "MuonCalibExtraTreeEvent/MuonCalibHit_E.h" - -#include "MuonCalibEventBase/MuonCalibEvent.h" -#include "MuonCalibEventBase/MuonCalibSegment.h" -#include "MuonCalibEventBase/MuonCalibPattern.h" - -#include "TFile.h" -#include "TH1.h" -#include "TH2.h" -#include "TDirectory.h" -#include <algorithm> - -namespace MuonCalib { - -inline void fill_histogram(TH1F *&hist, const Double_t &val) { - if (hist) hist->Fill(val); -} - -inline bool ExtraRegionSelectorFast::isOnTrack(const MuonCalibSegment &seg, const std::list<std::set<MuonFixedId> > &track_hits) { - int n_max_match(0); - int max_missing(seg.mdtHitsOnTrack() - m_max_hits_not_on_track); - int n_min_hits_on_track(max_missing<m_min_hits_on_track ? m_min_hits_on_track : max_missing); - for(std::list<std::set<MuonFixedId> >::const_iterator it=track_hits.begin(); it!=track_hits.end(); it++) { - int n_match(0); - for(MuonCalibSegment::MdtHitCit hit_it=seg.mdtHOTBegin(); hit_it!=seg.mdtHOTEnd(); hit_it++) { - if(it->find((*hit_it)->identify()) != it->end()) { - n_match++; - } - if((!m_n_match_vs_missing) && n_match>=n_min_hits_on_track) return true; - } - if(n_max_match<n_match) { - n_max_match=n_match; - } - } - if(m_n_match_vs_missing) { - m_n_match_vs_missing->Fill(seg.mdtHitsOnTrack() - n_max_match, n_max_match); - if(n_max_match>=n_min_hits_on_track) return true; - } - return false; -} //end ExtraRegionSelectorFast::isOnTrack - -/////////////////////////// -// ExtraRegionSelectorFast // -/////////////////////////// -ExtraRegionSelectorFast::ExtraRegionSelectorFast(const std::string &t, const std::string &n, const IInterface *p): AthAlgTool(t, n, p) { - m_exclusive_segments = false; - declareProperty("ExclusiveSegments", m_exclusive_segments); - declareProperty("TrackAutors", m_track_author_vec); - m_min_hits = 1; - declareProperty("MinHits", m_min_hits); - m_max_hits = 0; - declareProperty("MaxHits", m_max_hits); - m_select_seg_author = 4; - declareProperty("SelectSegmentAuthor", m_select_seg_author); - m_momentum_cut=-1.5; - declareProperty("MomentumCut", m_momentum_cut); - m_min_hits_on_track=3; - declareProperty("MinHitsOnTrack", m_min_hits_on_track); - m_max_hits_not_on_track=1; - declareProperty("MaxHitsNotOnTrack", m_max_hits_not_on_track); - m_do_debug_file=false; - declareProperty("DoDebugFile", m_do_debug_file); - m_debug_file=NULL; - m_all_p=NULL; - m_selected_p_by_track=NULL; - m_selected_p_by_segment=NULL; - m_n_match_vs_missing=NULL; - declareInterface< CalibSegmentPreparationTool >(this); -} //end ExtraRegionSelectorFast::ExtraRegionSelectorFast - -//////////////// -// initialize // -//////////////// -StatusCode ExtraRegionSelectorFast::initialize(void) { - MsgStream log(msgSvc(), name()); - StatusCode sc=service("RegionSelectionSvc", p_reg_sel_svc); - if(!sc.isSuccess()) { - log << MSG::ERROR <<"Cannot retrieve RegionSelectionSvc!" <<endmsg; - } - if(m_do_debug_file) { - TDirectory *prev_dir=gDirectory; - m_debug_file = new TFile("ExtraRegionSelectorFast.root", "RECREATE"); - m_all_p = new TH1F("all_p", "" ,20000, -100000, 100000); - m_selected_p_by_track = new TH1F("selected_p_by_track", "" ,20000, -100000, 100000); - m_selected_p_by_segment = new TH1F("selected_p_by_segment", "" ,20000, -100000, 100000); - m_n_match_vs_missing = new TH2F("n_match", "", 30, -0.5, 29.5, 30, -0.5, 29.5); - prev_dir->cd(); - } - m_track_author.clear(); - m_track_author.insert(m_track_author_vec.begin(), m_track_author_vec.end()); - return sc; -} //end ExtraRegionSelectorFast::initialize - -StatusCode ExtraRegionSelectorFast::finalize(void) { - if(m_do_debug_file) { - m_debug_file->Write(); - delete m_all_p; - delete m_selected_p_by_track; - delete m_selected_p_by_segment; - delete m_debug_file; - } - return StatusCode::SUCCESS; -} - -void ExtraRegionSelectorFast::prepareSegments(const MuonCalibEvent *&event, std::map<NtupleStationId, MuonCalibSegment *> &segments) { - MsgStream log(msgSvc(), name()); - if(event==NULL) { - log << MSG::FATAL << "event=NULL"<<endmsg; - event=NULL; - return; - } - const MuonCalibEvent *e(event); - const MuonCalibEvent_E *e_event=dynamic_cast<const MuonCalibEvent_E *>(e); - if(e_event==NULL) { - log << MSG::FATAL << "This tool works only with extra events!"<<endmsg; - event=NULL; - return; - } - segments.clear(); - std::list<std::set<MuonFixedId> > track_hits; - for(MuonCalibEvent_E::TrackVec::const_iterator tit=e_event->beginTrack(); tit!=e_event->endTrack(); tit++){ - const MuonCalibTrack_E *trk(*tit); - if (m_track_author.size()>0 && m_track_author.find(trk->author())==m_track_author.end()) - continue; - fill_histogram(m_all_p, 1.0/trk->qOverP()); - if (m_momentum_cut>-1) { - if(trk->qOverP()==0 || trk->p()>1e8) continue; - if(m_momentum_cut>=0 && std::abs(trk->p())<m_momentum_cut) continue; - } - fill_histogram(m_selected_p_by_segment, 1.0/trk->qOverP()); - std::set<MuonFixedId> selected_hits; - bool has_hits_in_region(false); - for(MuonCalibTrack_E::HitVector::const_iterator hitit=trk->beginHit(); hitit!=trk->endHit(); hitit++) { - const MuonCalibHit_E *hit(*hitit); - const MuonFixedId id(hit->identify()); - if(!id.is_mdt()) continue; - if(!has_hits_in_region && p_reg_sel_svc->isInRegion(id)){ - has_hits_in_region=true; - } - selected_hits.insert(id); - } - if(selected_hits.size()>0 && has_hits_in_region) - track_hits.push_back(selected_hits); - } - if(track_hits.size()==0) - return; - std::vector<unsigned int> calib_region_hit_map; -//---------------------loop on all patterns------------------------------------- - MuonCalibEvent::MCPVecCit pat_it = event->patternBegin(); - MuonCalibEvent::MCPVecCit pat_it_end = event->patternEnd(); - for( ;pat_it!=pat_it_end; ++pat_it) { - //--------------------loop on all segments-------------------------------------- - MuonCalibPattern::MuonSegmentVec::const_iterator seg_it = (*pat_it)->muonSegBegin(); - MuonCalibPattern::MuonSegmentVec::const_iterator seg_it_end = (*pat_it)->muonSegEnd(); - for ( ; seg_it!=seg_it_end; ++seg_it) { - MuonCalibSegment *seg = *seg_it; - if (m_select_seg_author && m_select_seg_author!=seg->author()) - continue; - if(!isOnTrack(*seg, track_hits)) - continue; - //check count hits in the calibration region and remove others - calib_region_hit_map.clear(); - bool reject(false); - int count(0); - for(MuonCalibSegment::MdtHitCit hit_it=seg->mdtHOTBegin(); hit_it!=seg->mdtHOTEnd(); hit_it++){ - unsigned int is_in_region(static_cast<unsigned int>(!p_reg_sel_svc->isInRegion((*hit_it)->identify())));// || m_suppressed_tubes.find((*hit_it)->identify())!=m_suppressed_tubes.end())); - calib_region_hit_map.push_back(is_in_region); - if(is_in_region!=0 && m_exclusive_segments) { - reject=true; - break; - } - if(is_in_region==0) - count++; - } - if(reject) continue; - if(count<m_min_hits || (count>m_max_hits && m_max_hits>0)) continue; - if(count==0) continue; - seg->refineMdtSelection(calib_region_hit_map); - NtupleStationId id(seg->mdtHOT()[0]->identify()); - id.SetMultilayer(0); - id.SetAuthor(seg->author()); - //store segment if it is the first in the station - if(segments[id] == NULL){ - segments[id] = seg; - continue; - } - //overwrite segment if this has more hits than the stored segment - MuonCalibSegment *stored(segments[id]); - if(stored->mdtHitsOnTrack() < seg->mdtHitsOnTrack()) { - segments[id] = seg; - continue; - } - if(stored->mdtHitsOnTrack() > seg->mdtHitsOnTrack()) { - continue; - } - //overwrite segment if the new one has a better chi^2 - if(stored->chi2() > seg->chi2()){ - segments[id] = seg; - } - } - } -} //end ExtraRegionSelectorFast::prepareSegments - -} // namespace Muoncalib diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/src/ExtraRegionSelectorSuperFast.cxx b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/src/ExtraRegionSelectorSuperFast.cxx deleted file mode 100644 index e48691238722f67c07f515bc649ad7ae6645c939..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/src/ExtraRegionSelectorSuperFast.cxx +++ /dev/null @@ -1,169 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -//this -#include "MuonCalibStandAloneExtraTools/ExtraRegionSelectorSuperFast.h" - -//MuonCalibStandAloneBase -#include "MuonCalibStandAloneBase/RegionSelectionSvc.h" - -//MuonCalibExtraTreeEvent -#include "MuonCalibExtraTreeEvent/MuonCalibEvent_E.h" -#include "MuonCalibExtraTreeEvent/MuonCalibTrack_E.h" -#include "MuonCalibExtraTreeEvent/MuonCalibHit_E.h" - -#include "MuonCalibEventBase/MuonCalibEvent.h" -#include "MuonCalibEventBase/MuonCalibSegment.h" -#include "MuonCalibEventBase/MuonCalibPattern.h" - -#include "TFile.h" -#include "TH1.h" -#include "TH2.h" -#include "TDirectory.h" -#include <algorithm> - -namespace MuonCalib { - - inline void fill_histogram(TH1F * & hist, const Double_t & val) { - if (hist) hist->Fill(val); - } - - -/////////////////////////// -// ExtraRegionSelectorSuperFast // -/////////////////////////// - -ExtraRegionSelectorSuperFast::ExtraRegionSelectorSuperFast(const std::string &t, const std::string &n, const IInterface *p): AthAlgTool(t, n, p) { - m_exclusive_segments = false; - declareProperty("ExclusiveSegments", m_exclusive_segments); - declareProperty("TrackAutors", m_track_author_vec); - m_min_hits = 1; - declareProperty("MinHits", m_min_hits); - m_max_hits = 0; - declareProperty("MaxHits", m_max_hits); - m_momentum_cut=-1.5; - declareProperty("MomentumCut", m_momentum_cut); - m_do_debug_file=false; - declareProperty("DoDebugFile", m_do_debug_file); - m_debug_file=NULL; - m_all_p=NULL; - m_selected_p_by_track=NULL; - m_selected_p_by_segment=NULL; - m_n_match_vs_missing=NULL; - declareInterface< CalibSegmentPreparationTool >(this); -} - -//////////////// -// initialize // -//////////////// -StatusCode ExtraRegionSelectorSuperFast::initialize(void) { - MsgStream log(msgSvc(), name()); - StatusCode sc=service("RegionSelectionSvc", p_reg_sel_svc); - if(!sc.isSuccess()) { - log << MSG::ERROR <<"Cannot retrieve RegionSelectionSvc!" <<endmsg; - } - if(m_do_debug_file) { - TDirectory *prev_dir=gDirectory; - m_debug_file = new TFile("ExtraRegionSelectorSuperFast.root", "RECREATE"); - m_all_p = new TH1F("all_p", "" ,20000, -100000, 100000); - m_selected_p_by_track = new TH1F("selected_p_by_track", "" ,20000, -100000, 100000); - m_selected_p_by_segment = new TH1F("selected_p_by_segment", "" ,20000, -100000, 100000); - m_n_match_vs_missing = new TH2F("n_match", "", 30, -0.5, 29.5, 30, -0.5, 29.5); - prev_dir->cd(); - } - m_track_author.clear(); - m_track_author.insert(m_track_author_vec.begin(), m_track_author_vec.end()); - return sc; -} - -StatusCode ExtraRegionSelectorSuperFast::finalize(void) { - if(m_do_debug_file) { - m_debug_file->Write(); - delete m_all_p; - delete m_selected_p_by_track; - delete m_selected_p_by_segment; - delete m_debug_file; - } - return StatusCode::SUCCESS; -} - -void ExtraRegionSelectorSuperFast::prepareSegments(const MuonCalibEvent *&event, std::map<NtupleStationId, MuonCalibSegment *> &segments) { - MsgStream log(msgSvc(), name()); - if(event==NULL) { - log << MSG::FATAL << "event=NULL"<<endmsg; - event=NULL; - return; - } - const MuonCalibEvent *e(event); - const MuonCalibEvent_E *e_event=dynamic_cast<const MuonCalibEvent_E *>(e); - if(e_event==NULL) { - log << MSG::FATAL << "This tool works only with extra events!"<<endmsg; - event=NULL; - return; - } - segments.clear(); - std::list<const MuonCalibSegment *> track_segments; - for(MuonCalibEvent_E::TrackVec::const_iterator tit=e_event->beginTrack(); tit!=e_event->endTrack(); tit++) { - const MuonCalibTrack_E *trk(*tit); - if (m_track_author.size()>0 && m_track_author.find(trk->author())==m_track_author.end()) - continue; - fill_histogram(m_all_p, 1.0/trk->qOverP()); - if (m_momentum_cut>-1) { - if(trk->qOverP()==0 || trk->p()>1e8) continue; - if(m_momentum_cut>=0 && std::abs(trk->p())<m_momentum_cut) continue; - } - const std::vector<const MuonCalibSegment *> &trkseg(trk->segmetnsOnTrack()); - for(unsigned int i=0; i<trkseg.size(); i++) { - track_segments.push_back(trkseg[i]); - } - fill_histogram(m_selected_p_by_segment, 1.0/trk->qOverP()); - } - if(track_segments.size()==0) - return; - std::vector<unsigned int> calib_region_hit_map; -//--------------------loop on all segemnts-------------------------------------- - for (std::list<const MuonCalibSegment *>::iterator seg_it=track_segments.begin() ; seg_it!=track_segments.end(); ++seg_it) { - MuonCalibSegment *seg = const_cast<MuonCalibSegment *>(*seg_it); - //check count hits in the calibration region and remove others - calib_region_hit_map.clear(); - bool reject(false); - int count(0); - for(MuonCalibSegment::MdtHitCit hit_it=seg->mdtHOTBegin(); hit_it!=seg->mdtHOTEnd(); hit_it++) { - unsigned int is_in_region(static_cast<unsigned int>(!p_reg_sel_svc->isInRegion((*hit_it)->identify())));// || m_suppressed_tubes.find((*hit_it)->identify())!=m_suppressed_tubes.end())); - calib_region_hit_map.push_back(is_in_region); - if(is_in_region!=0 && m_exclusive_segments) { - reject=true; - break; - } - if(is_in_region==0) count++; - } - if(reject) continue; - if(count<m_min_hits || (count>m_max_hits && m_max_hits>0)) continue; - if(count==0) continue; - seg->refineMdtSelection(calib_region_hit_map); - NtupleStationId id(seg->mdtHOT()[0]->identify()); - id.SetMultilayer(0); - id.SetAuthor(seg->author()); - //store segment if it is the first in the station - if(segments[id] == NULL) { - segments[id] = seg; - continue; - } - //overwrite segment if this has more hits than the stored segment - MuonCalibSegment *stored(segments[id]); - if(stored->mdtHitsOnTrack() < seg->mdtHitsOnTrack()) { - segments[id] = seg; - continue; - } - if(stored->mdtHitsOnTrack() > seg->mdtHitsOnTrack()) { - continue; - } - //overwrite segment if the new one has a better chi^2 - if(stored->chi2() > seg->chi2()) { - segments[id] = seg; - } - } -} //end ExtraRegionSelectorSuperFast::prepareSegments - -} // namespace Muoncalib diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/src/HistogramManager.cxx b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/src/HistogramManager.cxx deleted file mode 100644 index 91c2ab6259c16944caf8251e9e24490b2d6abd86..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/src/HistogramManager.cxx +++ /dev/null @@ -1,2073 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -#include "MuonCalibStandAloneExtraTools/HistogramManager.h" -#include "MuonCalibStandAloneExtraTools/MDTName.h" - -#include "MuonReadoutGeometry/MdtReadoutElement.h" -#include <array> - -namespace { - template<int n> - inline void - setArray(const std::array<int,n> & a, TH1F * href){ - for (const auto & i:a){ - href->SetBinContent(i,0); - } - } - const std::vector<int> bir4={1,2,3, 31,32,33, 61,62,63, 91,92,93}; - const std::vector<int> bir2={28,29,30, 58,59,60, 88,89,90, 118,119,120}; - const std::vector<int> bir1={1,2,3,4,5,6, 31,32,33,34,35,36, 61,62,63,64,65,66, 91,92,93,94,95,96}; - const std::vector<int> bir5={22,23,24, 46,47,48, 70,71,72, 94,95,96}; - const std::vector<int> bir3={34,35,36, 70,71,72, 106,107,108, 142,143,144, 178,179,180, 214,215,216, 250,251,252, 286,287,288}; - - const std::vector<int> bms4or6={41,42,43,44,45,46,47, 89,90,91,92,93,94,95,96, 137,138,139,140,141,142,143,144}; - const std::map<const std::string, const std::vector<int> & > string2Vec ={ - {"BIR2A11", bir2}, - {"BIR1A11", bir1}, - {"BIR2A15", bir2}, - {"BIR1A15", bir1}, - {"BIR4A11", bir4}, - //{"BIR3A11", bir3}, - {"BIR4A15", bir4}, - //{"BIR3A15", bir3}, - {"BMS4A02", bms4or6}, - {"BMS4A04", bms4or6}, - {"BMS4A06", bms4or6}, - {"BMS4A08", bms4or6}, - {"BMS4A10", bms4or6}, - {"BMS4A16", bms4or6}, - {"BIR5A11", bir5}, - {"BIR5A15", bir5}, - {"BMS6A02", bms4or6}, - {"BMS6A04", bms4or6}, - {"BMS6A06", bms4or6}, - {"BMS6A08", bms4or6}, - {"BMS6A10", bms4or6}, - {"BMS6A16", bms4or6}, - {"BIR2C11", bir2}, - {"BIR1C11", bir1}, - {"BIR2C15", bir2}, - {"BIR1C15", bir1}, - {"BIR4C11", bir4}, - //{"BIR3C11", bir3}, - {"BIR4C15", bir4}, - //{"BIR3C15, bir3}, - {"BMS4C02", bms4or6}, - {"BMS4C04", bms4or6}, - {"BMS4C06", bms4or6}, - {"BMS4C08", bms4or6}, - {"BMS4C10", bms4or6}, - {"BMS4C16", bms4or6}, - {"BIR5C11", bir5}, - {"BIR5C15", bir5}, - {"BMS6C02", bms4or6}, - {"BMS6C04", bms4or6}, - {"BMS6C06", bms4or6}, - {"BMS6C08", bms4or6}, - {"BMS6C10", bms4or6}, - {"BMS6C16", bms4or6} - }; - const - std::map<std::string,std::vector<std::pair<int, int> > > disconnected={ - {"BIL1C09",{ {219,41} } }, - {"BIL2A05",{ {144,-41} } }, - {"BIL2C01",{ {207,21} } }, - {"BIL3C09",{ {151,21} } }, - {"BIL4A07",{ {185,21} } }, - {"BIL5A01",{ {151,21} } }, - {"BIL5A13",{ {222,41} } }, - {"BIL5C03",{ {223,41} } }, - {"BIL5C09",{ {25,-11}, {73,-31}, {88,-31} } }, - {"BIL6A01",{ {37,-21} } }, - {"BIR4A11",{ {34,-21} } }, - {"BIR4C11",{ {79,-31}, {80,-31}, {81,-31} } }, - {"BIS1A14",{ {152,11} } }, - {"BIS1C08",{ {190,21} } }, - {"BIS1C12",{ {61,-21}, {108,-31}, {136,-41} } }, - {"BIS2C02",{ {77,-31} } }, - {"BIS2C04",{ {30,-11}, {240,41} } }, - {"BIS2C08",{ {1,-11}, {10,-11}, {127,11}, {202,31} } }, - {"BIS2C10",{ {94,-41}, {96,-41} } }, - {"BIS3A02",{ {188,31}, {195,31} } }, - {"BIS3A12",{ {184,31}, {185,31}, {214,41}, {215,41} } }, - {"BIS3C06",{ {140,11} } }, - {"BIS3C10",{ {90,-31} } }, - {"BIS3C16",{ {90,-31} } }, - {"BIS4C06",{ {3,-11} } }, - {"BIS4C08",{ {4,-11}, {214,41} } }, - {"BIS5A10",{ {181,31} } }, - {"BIS6A14",{ {60,-21}, {68,-31}, {76,-31} } }, - {"BIS7A08",{ {157,21} } }, - {"BMF1A12",{ {273,11} } }, - {"BMF1A14",{ {217,11}, {218,11}, {219,11} } }, - {"BMF1C14",{ {10,-11}, {55,-11}, {142,-21}, {231,11} } }, - {"BMF2A12",{ {184,-31} } }, - {"BMF2A14",{ {339,31} } }, - {"BMF2C12",{ {208,11}, {217,11}, {223,11}, {241,11} } }, - {"BMF2C14",{ {30,-11}, {60,-11}, {92,-21}, {97,-21}, {103,-21}, {245,11} } }, - {"BMF3C12",{ {38,-11} } }, - {"BML1A01",{ {250,21} } }, - {"BML1A09",{ {14,-11} } }, - {"BML1C03",{ {52,-21} } }, - {"BML2A01",{ {100,-21}, {236,21}, {295,31}, {304,31} } }, - {"BML2A07",{ {237,21}, {240,21} } }, - {"BML2A09",{ {57,-21} } }, - {"BML2C03",{ {68,-21} } }, - {"BML2C05",{ {42,-11}, {164,-31} } }, - {"BML2C07",{ {134,-31}, {221,11}, {234,21} } }, - {"BML2C15",{ {138,-31}, {162,-31} } }, - {"BML3A13",{ {302,31} } }, - {"BML3A15",{ {225,21} } }, - {"BML3C01",{ {322,31} } }, - {"BML3C15",{ {62,-21} } }, - {"BML4A01",{ {5,-11} } }, - {"BML4A03",{ {36,-11} } }, - {"BML4A11",{ {90,-31} } }, - {"BML4C05",{ {107,-31} } }, - {"BML4C09",{ {99,-31} } }, - {"BML4C15",{ {107,-31} } }, - {"BML5A11",{ {207,31} } }, - {"BML6A07",{ {162,11} } }, - {"BML6A09",{ {132,-31} } }, - {"BML6C07",{ {182,11} } }, - {"BML6C13",{ {200,21} } }, - {"BMS1A02",{ {1,-11}, {56,-11} } }, - {"BMS1A06",{ {248,21} } }, - {"BMS1C10",{ {244,21} } }, - {"BMS1C16",{ {264,21} } }, - {"BMS2A08",{ {63,-21} } }, - {"BMS2A10",{ {25,-11} } }, - {"BMS2A16",{ {49,-21}, {133,-31} } }, - {"BMS2C02",{ {240,21} } }, - {"BMS3A02",{ {86,-21} } }, - {"BMS3A04",{ {150,11}, {261,31} } }, - {"BMS3A06",{ {117,-31}, {175,11} } }, - {"BMS3A16",{ {1,-11} } }, - {"BMS3C08",{ {249,31} } }, - {"BMS3C10",{ {3,-11} } }, - {"BMS4A08",{ {199,21} } }, - {"BMS4A16",{ {127,-31} } }, - {"BMS4C02",{ {28,-11} } }, - {"BMS4C04",{ {184,11} } }, - {"BMS5C02",{ {22,-11} } }, - {"BMS5C04",{ {44,-21} } }, - {"BMS6A06",{ {56,-21} } }, - {"BMS6A10",{ {115,-31} } }, - {"BMS6C02",{ {102,-31} } }, - {"BOF1A12",{ {146,-31}, {225,11}, {249,11} } }, - {"BOF1A14",{ {188,-31}, {278,11} } }, - {"BOF3A12",{ {147,-31}, {345,31}, {370,31} } }, - {"BOF5A14",{ {1,-11} } }, - {"BOF5C14",{ {163,11}, {189,11} } }, - {"BOF7C12",{ {104,-31} } }, - {"BOG2C12",{ {148,11}, {197,21} } }, - {"BOL1A01",{ {32,-11}, {189,-31} } }, - {"BOL1A13",{ {1,-11}, {49,-11} } }, - {"BOL1C09",{ {52,-11} } }, - {"BOL2A01",{ {81,-21} } }, - {"BOL2A05",{ {389,31} } }, - {"BOL2A07",{ {72,-11} } }, - {"BOL3A13",{ {31,-11}, {41,-11} } }, - {"BOL3C15",{ {235,21} } }, - {"BOL4C01",{ {241,11}, {242,11}, {380,31}, {381,31} } }, - {"BOL5A01",{ {204,-31} } }, - {"BOL6A03",{ {19,-11} } }, - {"BOL6A11",{ {147,-31}, {148,-31}, {149,-31}, {150,-31} } }, - {"BOL6A13",{ {281,31} } }, - {"BOS1A02",{ {323,21} } }, - {"BOS1A08",{ {99,-31} } }, - {"BOS1C06",{ {44,-11} } }, - {"BOS1C16",{ {72,-11} } }, - {"BOS2C02",{ {145,-31}, {180,-31} } }, - {"BOS2C08",{ {54,-11}, {154,-31}, {209,-31} } }, - {"BOS2C10",{ {392,31} } }, - {"BOS2C16",{ {360,21} } }, - {"BOS3A08",{ {117,-21} } }, - {"BOS3A16",{ {369,31} } }, - {"BOS3C02",{ {217,11} } }, - {"BOS3C06",{ {305,21} } }, - {"BOS3C08",{ {227,11} } }, - {"BOS3C16",{ {55,-11} } }, - {"BOS4A04",{ {310,21} } }, - {"BOS4A06",{ {204,-31} } }, - {"BOS4A08",{ {432,31} } }, - {"BOS4A10",{ {2,-11} } }, - {"BOS4A16",{ {20,-11} } }, - {"BOS4C16",{ {145,-31} } }, - {"BOS5A04",{ {21,-11}, {28,-11} } }, - {"BOS5A08",{ {50,-11}, {122,-21}, {243,11} } }, - {"BOS5A16",{ {147,-31} } }, - {"BOS5C10",{ {417,31} } }, - {"BOS6A02",{ {21,-11} } }, - {"BOS6A10",{ {337,31}, {362,31} } }, - {"BOS6A16",{ {384,31} } }, - {"EIL1A01",{ {267,41} } }, - {"EIL4A13",{ {247,11}, {393,41} } }, - {"EIL4C13",{ {432,41} } }, - {"EIL5A01",{ {191,11} } }, - {"EIL5C01",{ {169,11} } }, - {"EIS1A14",{ {51,-21} } }, - {"EIS1C04",{ {322,41}, {323,41} } }, - {"EML1C03",{ {113,-31} } }, - {"EML1C09",{ {319,31} } }, - {"EML1C11",{ {36,-11} } }, - {"EML2A13",{ {76,-21} } }, - {"EML2A15",{ {330,31} } }, - {"EML2C07",{ {185,-31}, {190,-31}, {191,-31}, {192,-31} } }, - {"EML2C15",{ {161,-31} } }, - {"EML3C05",{ {235,11} } }, - {"EML3C07",{ {291,21} } }, - {"EML3C09",{ {60,-11} } }, - {"EML4A03",{ {199,11}, {321,31} } }, - {"EML4A05",{ {8,-11} } }, - {"EML4A07",{ {326,31}, {327,31} } }, - {"EML4A09",{ {100,-21}, {102,-21}, {103,-21}, {255,11}, {256,11}, {257,21}, {320,21} } }, - {"EML4A11",{ {30,-11}, {69,-21}, {91,-21}, {140,-31}, {198,11}, {259,21}, {260,21}, {261,21} } }, - {"EML4A13",{ {162,-31}, {228,11}, {271,21}, {359,31} } }, - {"EML4C03",{ {296,21}, {335,31} } }, - {"EML4C05",{ {158,-31} } }, - {"EMS2A08",{ {219,11} } }, - {"EMS2C14",{ {64,-11}, {90,-21} } }, - {"EMS3A02",{ {187,-31} } }, - {"EMS3A12",{ {1,-11} } }, - {"EMS3C04",{ {252,11} } }, - {"EMS3C12",{ {142,-31} } }, - {"EMS3C16",{ {54,-11}, {357,31} } }, - {"EMS4A12",{ {119,-21} } }, - {"EMS5A02",{ {336,31} } }, - {"EMS5A06",{ {109,-21}, {191,-31} } }, - {"EMS5A08",{ {112,-21} } }, - {"EMS5A12",{ {236,11} } }, - {"EOL3A01",{ {74,-21}, {159,11}, {216,21} } }, - {"EOL3A15",{ {167,11}, {168,11} } }, - {"EOL4C01",{ {177,11}, {178,11} } }, - {"EOL5A05",{ {42,-11}, {67,-21} } }, - {"EOL5C07",{ {152,11} } }, - {"EOL6A03",{ {4,-11} } }, - {"EOL6A11",{ {38,-11} } }, - {"EOS4A12",{ {191,11}, {233,21} } }, - {"EOS5A02",{ {11,-11} } }, - {"EOS5C14",{ {176,11} } }, - {"EOS6C04",{ {203,21} } } - }; - -} - -using namespace MuonCalib; - -HistogramManager::HistogramManager() { - m_idHelper = nullptr; - m_rootfile = nullptr; - m_hList(0); - m_doTracks = false; -} -HistogramManager::HistogramManager(const Muon::IMuonIdHelperSvc* idHelper) { - m_idHelper = idHelper; - m_rootfile = nullptr; - m_hList(0); - m_doTracks = false; -} - -void HistogramManager::SetDoTracks(bool the_tracks) { - m_doTracks=the_tracks; -} - -void HistogramManager::buildGlobalHistos() { - - if (!m_rootfile->IsOpen()){ - std::string defaultOutputFile="outDQA.root"; - openOutputFile(defaultOutputFile); - } - - m_rootfile->cd(); - - std::string dir_name; - // Building Base directory : - // /GLOBAL/ - dir_name="/GLOBAL"; - if (!m_rootfile->GetDirectory(dir_name.c_str())) { - // A new TDirectoryFile gets owned by the current directory (side effect). - new TDirectoryFile("GLOBAL","GLOBAL"); - } - - m_rootfile->cd("/GLOBAL"); - - TH2F * globalOccupancy; - - // Inner,Middle,Outer,(extra) chambers of the region (BA/BC/EA/EC) : - - globalOccupancy = new TH2F("Global_HitsPerML_Inner","Global HitsPerML Inner", - 45, -22.5, 22.5, 32, 0.5, 16.5 ); - globalOccupancy->GetXaxis()->SetTitle("Chamber_etaId"); - globalOccupancy->GetYaxis()->SetTitle("sectors"); - - globalOccupancy = new TH2F("Global_HitsPerML_Middle","Global HitsPerML Middle", - 45, -22.5, 22.5, 32, 0.5, 16.5 ); - globalOccupancy->GetXaxis()->SetTitle("Chamber_etaId"); - globalOccupancy->GetYaxis()->SetTitle("sectors"); - - globalOccupancy = new TH2F("Global_HitsPerML_Outer","Global HitsPerML Outer", - 45, -22.5, 22.5, 32, 0.5, 16.5 ); - globalOccupancy->GetXaxis()->SetTitle("Chamber_etaId"); - globalOccupancy->GetYaxis()->SetTitle("sectors"); - - TH2F * phiVseta; - phiVseta = new TH2F("phi_vs_eta","Global Segment_phi Vs Segment_eta", - 40, -4., 4., 90, -180., 180. ); - phiVseta->GetYaxis()->SetTitle("Segment_phi (deg)"); - phiVseta->GetXaxis()->SetTitle("Segment_eta"); - -} - // TRACK Histograms .... -void HistogramManager::buildTrackHistos() { - - if (!m_rootfile->IsOpen()){ - std::string defaultOutputFile="outDQA.root"; - openOutputFile(defaultOutputFile); - } - - m_rootfile->cd(); - std::string dir_name; - dir_name="TRACKS"; - if (!m_rootfile->GetDirectory(dir_name.c_str())) { - // A new TDirectoryFile gets owned by the current directory (side effect). - new TDirectoryFile("TRACKS","TRACKS"); - } - - m_rootfile->cd("/TRACKS"); - - TH1F * tmbts1; - tmbts1=new TH1F("mbts1_time","Time mbts 1 (plus)",200,-100.,100.); - tmbts1->GetXaxis()->SetTitle("time (ns)"); - - TH1F * tmbts2; - tmbts2=new TH1F("mbts2_time","Time mbts 2 (minus)",200,-100.,100.); - tmbts2->GetXaxis()->SetTitle("time (ns)"); - - TH2F * tmbts12; - tmbts12=new TH2F("mbts1VSmbts2","Time mbts 1 VS 2 ",200,-100.,100., 200,-100.,100.); - tmbts12->GetXaxis()->SetTitle("time (ns)"); - tmbts12->GetYaxis()->SetTitle("time (ns)"); - - TH1F * Dtmbts; - Dtmbts=new TH1F("mbts_Dtime","Time difference mbts",200,-100.,100.); - Dtmbts->GetXaxis()->SetTitle("#Delta t (ns)"); - - TH1F * trkIDmult; - trkIDmult=new TH1F("trk_ID_mult","ID Tracks per Event",51,-0.5,50.5); - trkIDmult->GetXaxis()->SetTitle("num_ID_Tracks_per_event"); - - TH1F * seg_nb; - seg_nb=new TH1F("seg_nb","Segments per Track",12,-1.5,10.5); - seg_nb->GetXaxis()->SetTitle("Associated Segments per track"); - - TH1F * trk_nb; - trk_nb=new TH1F("trk_nb","Tracks per Event",10,-0.5,9.5); - trk_nb->GetXaxis()->SetTitle("numTracks_per_event"); - - TH1F * trk_nb_sel; - trk_nb_sel=new TH1F("trk_nb_sel","Tracks per Event",10,-0.5,9.5); - trk_nb_sel->GetXaxis()->SetTitle("numTracks_per_event"); - - TH1F * trk_author1; - trk_author1=new TH1F("trk_authorMoore","Track Author Moore",14,-0.5,13.5); - trk_author1->GetXaxis()->SetBinLabel(1,"ID"); - trk_author1->GetXaxis()->SetBinLabel(2,"Moore"); - trk_author1->GetXaxis()->SetBinLabel(3,"ExtrSA nocalo"); - trk_author1->GetXaxis()->SetBinLabel(4,"ExtrSA calo"); - trk_author1->GetXaxis()->SetBinLabel(5,"MuidSA"); - trk_author1->GetXaxis()->SetBinLabel(6,"MuidCB"); - trk_author1->GetXaxis()->SetBinLabel(7,"MuonCombined?"); - trk_author1->GetXaxis()->SetBinLabel(8,"MuTagIMO"); - trk_author1->GetXaxis()->SetBinLabel(9,"MuGirl"); - trk_author1->GetXaxis()->SetBinLabel(10,"AODMuidSA"); - trk_author1->GetXaxis()->SetBinLabel(11,"AODMuidCB"); - trk_author1->GetXaxis()->SetBinLabel(12,"AODMuTagIMO"); - trk_author1->GetXaxis()->SetBinLabel(13,"AODMuGirl"); - - TH1F * trk_author2; - trk_author2=new TH1F("trk_authorMuBoy","Track Author MuonBoy",14,-0.5,13.5); - trk_author2->GetXaxis()->SetBinLabel(1,"ID"); - trk_author2->GetXaxis()->SetBinLabel(2,"MuonBoy"); - trk_author2->GetXaxis()->SetBinLabel(3,"Staco"); - trk_author2->GetXaxis()->SetBinLabel(4,"MuTagTracks"); - trk_author2->GetXaxis()->SetBinLabel(5,"StacoMuonSA"); - trk_author2->GetXaxis()->SetBinLabel(6,"StacoMuonCB"); - trk_author2->GetXaxis()->SetBinLabel(7,"StacoMuonTag"); - - new TH1F("trk_pt","; pt (GeV)",1000,0.,1000.); - - new TH1F("trk_eta","; #eta",80,-4.,4.); - new TH1F("trk_phi","; #phi",80,-4.,4.); - new TH2F("trk_etaVSphi",";#eta; #phi",80,-4.,4.,80,-4.,4.); - new TH2F("trk_d0VSz0",";d0(mm); z0(mm)",2000,-5000.,5000.,200,-500.,500.); - TH2F * h2 = new TH2F("trk_yVSx","y Vs x",1000,-15000.,15000.,1000,-15000.,15000.); - h2->GetXaxis()->SetTitle("x(mm)"); - h2->GetYaxis()->SetTitle("y(mm)"); - new TH1F("trk_qOverP","; Q over P",1000,-0.001,0.001); - new TH1F("trk_chi2dof","; #chi^{2}/ndof",100,0.,10.); - new TH2F("trk_chi2dof_VS_author","; #chi^{2}/ndof; Track Author",100,0.,10., 2220,-10.,1100.); - new TH2F("trk_chi2dof_VS_eta",";#eta; #chi^{2}/ndof",80, -4.,4.,100,0.,10.); - new TH1F("trk_d0","; d0 ",200,-500.,500.); - new TH1F("trk_z0ip","; z0ip (mm)",2000,-5000.,5000.); - new TH2F("trk_mdthits_VS_eta",";#eta; nr hits per track",80, -4.,4.,100,-0.5,99.5); - new TH2F("trk_mdthits_VS_phi",";#phi; nr hits per track",80, -4.,4.,100,-0.5,99.5); - new TH1F("hit_driftR","; drift Radius (mm)",300,-15.,15.); - new TH1F("hit_pull","; pull (mm)",200,-10.,10.); - new TH1F("hit_mdt","; mdt hits per track", 50, -0.5, 49.5); - new TH2F("hit_mdtVSrpc","; rpc hits; mdt hits", 50, -0.5, 49.5, 50, -0.5, 49.5); - new TH1F("hit_rpc","; rpc hits per track", 50, -0.5, 49.5); - new TH1F("hit_tgc","; tgc hits per track", 50, -0.5, 49.5); - new TH1F("hit_csc","; csc hits per track", 50, -0.5, 49.5); - - TH1F * h1 = new TH1F("trk_ID_ntrack","ID tracks",20,-0.5,19.5); - h1->GetXaxis()->SetTitle("nb ID tracks"); - h1 = new TH1F("trk_ID_npixel","Pixel Hits in the Inner Tracker",50,-0.5,49.5); - h1->GetXaxis()->SetTitle("Pixel Hits"); - h1 = new TH1F("trk_ID_nsct","SCT Hits in the Inner Tracker",50,-0.5,49.5); - h1->GetXaxis()->SetTitle("SCT Hits"); - h1 = new TH1F("trk_ID_ntrt","TRT Hits in the Inner Tracker",50,-0.5,49.5); - h1->GetXaxis()->SetTitle("TRT Hits"); - new TH1F("trk_ID_p","P in the Inner Tracker; p (GeV)",200,0.,100.); - new TH1F("trk_Ev_trkveto","TRACK VETO in the Inner Tracker; TRACK VETO",20,-0.5,19.5); - h1 = new TH1F("trk_Ev_pveto","P VETO in the Inner Tracker",20,-0.5,19.5); - h1->GetXaxis()->SetTitle("PVETO"); - new TH2F("trk_ID_pixsctVStrt","pix+sct VS trt; npixel + nsct; ntrt",105,-5.5,99.5,105,-5.5,99.5); - new TH2F("trk_ID_pixVSsct","pix VS sct; npixel; nsct",55,-5.5,49.5,55,-5.5,49.5); - - h1 = new TH1F("trk_SA_ntrack","SA tracks",20,-0.5,19.5); - h1->GetXaxis()->SetTitle("nb SA tracks"); - - h1=new TH1F("trk_SAIP_ntrack","SAIP tracks",20,-0.5,19.5); - h1->GetXaxis()->SetTitle("nb SAIP tracks"); - - h1 = new TH1F("trk_Tag_ntrack","nb Tag tracks",20,-0.5,19.5); - h1->GetXaxis()->SetTitle("nb Tag tracks"); - h1=new TH1F("trk_Tag_npixel","Pixel Hits in the Inner Tracker",50,-0.5,49.5); - h1->GetXaxis()->SetTitle("Pixel Hits"); - h1=new TH1F("trk_Tag_nsct","SCT Hits in the Inner Tracker",50,-0.5,49.5); - h1->GetXaxis()->SetTitle("SCT Hits"); - h1 = new TH1F("trk_Tag_ntrt","TRT Hits in the Inner Tracker",50,-0.5,49.5); - h1->GetXaxis()->SetTitle("TRT Hits"); - h1 = new TH1F("trk_Tag_pveto","P VETO in the Inner Tracker",20,-0.5,19.5); - h1->GetXaxis()->SetTitle("PVETO"); - new TH2F("trk_Tag_pixsctVStrt","pix+sct VS trt; npixel + nsct; ntrt",55,-5.5,49.5,55,-5.5,49.5); - new TH2F("trk_Tag_pixVSsct","pix VS sct; npixel; nsct",55,-5.5,49.5,55,-5.5,49.5); - - - h1 = new TH1F("trk_CB_ntrack","CB tracks",20,-0.5,19.5); - h1->GetXaxis()->SetTitle("nb CB tracks"); - h1=new TH1F("trk_CB_npixel","Pixel Hits in the Inner Tracker",50,-0.5,49.5); - h1->GetXaxis()->SetTitle("Pixel Hits"); - h1=new TH1F("trk_CB_nsct","SCT Hits in the Inner Tracker",50,-0.5,49.5); - h1->GetXaxis()->SetTitle("SCT Hits"); - h1=new TH1F("trk_CB_ntrt","TRT Hits in the Inner Tracker",50,-0.5,49.5); - h1->GetXaxis()->SetTitle("TRT Hits"); - h1=new TH1F("trk_CB_pveto","P VETO in the Inner Tracker",20,-0.5,19.5); - h1->GetXaxis()->SetTitle("PVETO"); - new TH2F("trk_CB_pixsctVStrt","pix+sct VS trt; npixel + nsct; ntrt",55,-5.5,49.5,55,-5.5,49.5); - new TH2F("trk_CB_pixVSsct","pix VS sct; npixel; nsct",55,-5.5,49.5,55,-5.5,49.5); - - TH2F * trk_cutflow; - trk_cutflow=new TH2F("trk_cutflow","cut flow",5,0.5,5.5,9,-0.5,8.5); - trk_cutflow->GetXaxis()->SetBinLabel(1,"ID"); - trk_cutflow->GetXaxis()->SetBinLabel(2,"SA"); - trk_cutflow->GetXaxis()->SetBinLabel(3,"SA_IP"); - trk_cutflow->GetXaxis()->SetBinLabel(4,"Tag"); - trk_cutflow->GetXaxis()->SetBinLabel(5,"CB"); - trk_cutflow->GetYaxis()->SetBinLabel(1,"no cut"); - trk_cutflow->GetYaxis()->SetBinLabel(2,"cut 1"); - trk_cutflow->GetYaxis()->SetBinLabel(3,"cut 2"); - trk_cutflow->GetYaxis()->SetBinLabel(4,"cut 3"); - trk_cutflow->GetYaxis()->SetBinLabel(5,"cut 4"); - trk_cutflow->GetYaxis()->SetBinLabel(6,"cut 5"); - trk_cutflow->GetYaxis()->SetBinLabel(7,"cut 6"); - trk_cutflow->GetYaxis()->SetBinLabel(8,"cut 7"); - trk_cutflow->GetYaxis()->SetBinLabel(9,"cut 8"); - - new TH1F("trk_selected_cut5_pt","; pt (GeV)",200,0.,100.); - new TH1F("trk_selected_cut5_p","; p (GeV)",200,0.,100.); - new TH2F("trk_selected_cut5_etaVSphi","#eta; #phi",90,-4.5,4.5,90,-4.5,4.5); - - new TH1F("trk_selected_pt","; pt (GeV)",200,0.,100.); - new TH1F("trk_selected_p","; p (GeV)",200,0.,100.); - new TH1F("trk_selected_eta","; #eta",90,-4.5,4.5); - new TH1F("trk_selected_phi","; #phi",90,-4.5,4.5); - new TH2F("trk_selected_etaVSphi","#eta; #phi",90,-4.5,4.5,90,-4.5,4.5); - - new TH1F("trk_associated_Deltapt","; pt (GeV)",200,-10.,10.); - new TH1F("trk_associated_Deltap","; p (GeV)",200,-10.,10.); - - new TH1F("trk_associatedIP_Deltapt","; pt (GeV)",200,-10.,10.); - new TH1F("trk_associatedIP_Deltap","; p (GeV)",200,-10.,10.); - - buildDebugHistos(); - -} - -void HistogramManager::buildDebugHistos() { - - - if (!m_rootfile->IsOpen()){ - std::string defaultOutputFile="outDQA.root"; - openOutputFile(defaultOutputFile); - } - - m_rootfile->cd(); - std::string dir_name; - // Building Base directory : - // /DEBUG/ - dir_name=GetMdtDirectoryName(); - if (!m_rootfile->GetDirectory(dir_name.c_str())) { - // A new TDirectoryFile gets owned by the current directory (side effect). - new TDirectoryFile("DEBUG","DEBUG"); - } - m_rootfile->cd("/DEBUG"); - - TH1F * h1 = new TH1F("nSegPerTrack","n Segments",21,-0.5,20.5); - h1->GetXaxis()->SetTitle("nSegments"); - TH2F * h2 = new TH2F("nSegPerTrack_HitCut","; Sector n.; nSegments",16,0.5,16.5,21,-0.5,20.5); - h2->SetTitle("Segment Per Track"); - - new TH2F("t0_BI","; Sector n.; t0Refit_BI (ns)",16,0.5,16.5,400,-200.,200.); - new TH2F("t0_BM","; Sector n.; t0Refit_BM (ns)",16,0.5,16.5,400,-200.,200.); - new TH2F("t0_BO","; Sector n.; t0Refit_BO (ns)",16,0.5,16.5,400,-200.,200.); - new TH2F("t0_BO_BM","; Sector n.; t0Refit_BO-BM (ns)",16,0.5,16.5,400,-200.,200.); - new TH2F("t0_BO_BI","; Sector n.; t0Refit_BO-BI (ns)",16,0.5,16.5,400,-200.,200.); - new TH2F("t0_BM_BI","; Sector n.; t0Refit_BM-BI (ns)",16,0.5,16.5,400,-200.,200.); - - new TH2F("t0_EI","; Sector n.; t0Refit_EI (ns)",16,0.5,16.5,400,-200.,200.); - new TH2F("t0_EM","; Sector n.; t0Refit_EM (ns)",16,0.5,16.5,400,-200.,200.); - new TH2F("t0_EO","; Sector n.; t0Refit_EO (ns)",16,0.5,16.5,400,-200.,200.); - new TH2F("t0_EO_EM","; Sector n.; t0Refit_EO-EM (ns)",16,0.5,16.5,400,-200.,200.); - new TH2F("t0_EO_EI","; Sector n.; t0Refit_EO-EI (ns)",16,0.5,16.5,400,-200.,200.); - new TH2F("t0_EM_EI","; Sector n.; t0Refit_EM-EI (ns)",16,0.5,16.5,400,-200.,200.); - - new TH2F("trk_d0VSz0_GoodTime","d0(mm); z0(mm)",2000,-5000.,5000.,200,-500.,500.); - new TH2F("trk_d0VSz0_BadTime","d0(mm); z0(mm)",2000,-5000.,5000.,200,-500.,500.); - new TH2F("trk_d0VSz0_noSeg","d0(mm); z0(mm)",2000,-5000.,5000.,200,-500.,500.); -} - - -void HistogramManager::buildTopLevel(std::string region, std::string side,int sectorMin, int sectorMax) { - - std::string regionSide = region+"_"+side; - std::string dir_name="none"; - - if (!m_rootfile->IsOpen()){ - std::string defaultOutputFile="outDQA.root"; - openOutputFile(defaultOutputFile); - } - - m_rootfile->cd(); - - // if not already created building directory "GLOBAL" - dir_name="/GLOBAL"; - TDirectoryFile * global_dir=0; - if (!m_rootfile->GetDirectory(dir_name.c_str())) { - global_dir = new TDirectoryFile("GLOBAL","GLOBAL"); - } else { - global_dir = (TDirectoryFile *) m_rootfile->GetDirectory(dir_name.c_str()); - } - - global_dir->cd(); - - TH2F * globalOccupancy; - - // all chambers of the region (BA/BC) : - if (region=="Barrel") { - globalOccupancy = (TH2F*) GetHisto("GLOBAL","Global_HitsPerML_Barrel"); - if (!globalOccupancy) { - globalOccupancy = new TH2F("Global_HitsPerML_Barrel","Global HitsPerML Barrel", - 81, -40.5, 40.5, 32, 0.5, 16.5 ); - globalOccupancy->GetXaxis()->SetTitle("Chamber_etaId (Inn,Mid,Out)"); - globalOccupancy->GetYaxis()->SetTitle("sectors"); - globalOccupancy->SetNdivisions(16,"Y"); - if (side=="A") { - globalOccupancy->SetAxisRange(0.5,40.5,"X"); - globalOccupancy->SetTitle("Global HitsPerML BA"); - } - if (side=="C") { - globalOccupancy->SetAxisRange(-40.5,-0.5,"X"); - globalOccupancy->SetTitle("Global HitsPerML BC"); - } - } else { - globalOccupancy->SetAxisRange(-40.5,40.5,"X"); - globalOccupancy->SetTitle("Global HitsPerML Barrel"); - } - } - // all chambers of the region (EA/EC) : - if (region=="Endcap") { - globalOccupancy = (TH2F*) GetHisto("GLOBAL","Global_HitsPerML_Endcap"); - if (!globalOccupancy) { - globalOccupancy = new TH2F("Global_HitsPerML_Endcap","Global HitsPerML Endcap", - 81, -40.5, 40.5, 32, 0.5, 16.5 ); - globalOccupancy->GetXaxis()->SetTitle("Chamber_etaId (Inn,Mid,Out,Extra)"); - globalOccupancy->GetYaxis()->SetTitle("sectors"); - globalOccupancy->SetNdivisions(16,"Y"); - if (side=="A") { - globalOccupancy->SetAxisRange(0.5,40.5,"X"); - globalOccupancy->SetTitle("Global HitsPerML EA"); - } - if (side=="C") { - globalOccupancy->SetAxisRange(-40.5,-0.5,"X"); - globalOccupancy->SetTitle("Global HitsPerML EC"); - } - } else { - globalOccupancy->SetAxisRange(-40.5,40.5,"X"); - globalOccupancy->SetTitle("Global HitsPerML Endcap"); - } - } - - m_rootfile->cd(); - // Building Base directory : - // /MDT/ - dir_name=GetMdtDirectoryName(); - if (!m_rootfile->GetDirectory(dir_name.c_str())) { - // A new TDirectoryFile gets owned by the current directory (side effect). - new TDirectoryFile("MDT","MDT"); - } - // Building Base directory : - // /MDTvsRPC/ (for Barrel) - /MDTvsTGC/ (for Endcap) - dir_name = GetTDaqDirectoryName(region); - std::string MDTvsTriggerChambers="Undefined"; - if (region == "Barrel") MDTvsTriggerChambers="MDTvsRPC"; - if (region == "Endcap") MDTvsTriggerChambers="MDTvsTGC"; - if (!m_rootfile->GetDirectory(dir_name.c_str())) { - // A new TDirectoryFile gets owned by the current directory (side effect). - new TDirectoryFile(MDTvsTriggerChambers.c_str(),MDTvsTriggerChambers.c_str()); - } - - // Building <region-side> (ex. Barrel_A) directories : - // motherdir = /MDT/; - std::string motherdir; - motherdir = GetMdtDirectoryName(); - m_rootfile->cd(motherdir.c_str()); - dir_name=GetMdtDirectoryName(region,side); - if (!m_rootfile->GetDirectory(dir_name.c_str())) { - TDirectoryFile * mdt_region = new TDirectoryFile(regionSide.c_str(),regionSide.c_str()); - mdt_region->cd(); - TH1F * h; - TH2F * h2; - float t0Min=200.; - float t0Max=1200.; - int t0Nbins = 250; - float tdriftMin=600.; - float tdriftMax=800.; - int tdriftNbins = 100; - - std::string histoType; - std::string histoTitle; - // - histoType="t0PerSector_Inner"; - histoTitle = histoType; - h2 = new TH2F(histoType.c_str(),histoTitle.c_str(),16,0.5,16.5,t0Nbins,t0Min,t0Max); - h2->GetXaxis()->SetTitle("Sector nr."); - h2->GetYaxis()->SetTitle("t0 per ML (ns)"); - - histoType="t0PerSector_Middle"; - histoTitle = histoType; - h2 = new TH2F(histoType.c_str(),histoTitle.c_str(),16,0.5,16.5,t0Nbins,t0Min,t0Max); - h2->GetXaxis()->SetTitle("Sector nr."); - h2->GetYaxis()->SetTitle("t0 per ML (ns)"); - - histoType="t0PerSector_Outer"; - histoTitle = histoType; - h2 = new TH2F(histoType.c_str(),histoTitle.c_str(),16,0.5,16.5,t0Nbins,t0Min,t0Max); - h2->GetXaxis()->SetTitle("Sector nr."); - h2->GetYaxis()->SetTitle("t0 per ML (ns)"); - - if(region=="Endcap") - { - histoType="t0PerSector_extra"; - histoTitle = histoType; - h2 = new TH2F(histoType.c_str(),histoTitle.c_str(),16,0.5,16.5,t0Nbins,t0Min,t0Max); - h2->GetXaxis()->SetTitle("Sector nr."); - h2->GetYaxis()->SetTitle("t0 per ML (ns)"); - } - - histoType="tdriftPerSector_Inner"; - histoTitle = histoType; - h2 = new TH2F(histoType.c_str(),histoTitle.c_str(),16,0.5,16.5,tdriftNbins,tdriftMin,tdriftMax); - h2->GetXaxis()->SetTitle("Sector nr."); - h2->GetYaxis()->SetTitle("tdrift per ML (ns)"); - - histoType="tdriftPerSector_Middle"; - histoTitle = histoType; - h2 = new TH2F(histoType.c_str(),histoTitle.c_str(),16,0.5,16.5,tdriftNbins,tdriftMin,tdriftMax); - h2->GetXaxis()->SetTitle("Sector nr."); - h2->GetYaxis()->SetTitle("tdrift per ML (ns)"); - - histoType="tdriftPerSector_Outer"; - histoTitle = histoType; - h2 = new TH2F(histoType.c_str(),histoTitle.c_str(),16,0.5,16.5,tdriftNbins,tdriftMin,tdriftMax); - h2->GetXaxis()->SetTitle("Sector nr."); - h2->GetYaxis()->SetTitle("tdrift per ML (ns)"); - - if(region=="Endcap") - { - histoType="tdriftPerSector_extra"; - histoTitle = histoType; - h2 = new TH2F(histoType.c_str(),histoTitle.c_str(),16,0.5,16.5,tdriftNbins,tdriftMin,tdriftMax); - h2->GetXaxis()->SetTitle("Sector nr."); - h2->GetYaxis()->SetTitle("tdrift per ML (ns)"); - } - - histoType="time_Fit_t0"; - histoTitle = histoType; - h = new TH1F(histoType.c_str(),histoTitle.c_str(),t0Nbins,t0Min,t0Max); - h->GetXaxis()->SetTitle("t0 (ns)"); - - histoType="time_Fit_tdrift"; - histoTitle = histoType; - h = new TH1F(histoType.c_str(),histoTitle.c_str(),tdriftNbins,tdriftMin,tdriftMax); - h->GetXaxis()->SetTitle("tDrift (ns)"); - - histoType="time_Fit_tslope"; - histoTitle = histoType; - h = new TH1F(histoType.c_str(),histoTitle.c_str(),40,0.,40.); - h->GetXaxis()->SetTitle("tSlope (ns)"); - - histoType="time_Fit_chi2"; - histoTitle = histoType; - h = new TH1F(histoType.c_str(),histoTitle.c_str(),200,0.,50.); - h->GetXaxis()->SetTitle("tChi2perDof (ns)"); - - histoType="adc_Fit_peak"; - histoTitle = histoType; - h = new TH1F(histoType.c_str(),histoTitle.c_str(),150,0.,300.); - h->GetXaxis()->SetTitle("ADC counts"); - - histoType="adc_Fit_width"; - histoTitle = histoType; - h = new TH1F(histoType.c_str(),histoTitle.c_str(),50,0.,50.); - h->GetXaxis()->SetTitle("ADC counts"); - - histoType="hits_perML_belowADCCUT"; - histoTitle = histoType; - h = new TH1F(histoType.c_str(),histoTitle.c_str(),100,0.,1.); - h->GetXaxis()->SetTitle("Fraction of Hits"); - - histoType="TubeEfficiency_Inner"; - histoTitle = histoType; - h = new TH1F(histoType.c_str(),histoTitle.c_str(),100,0.,1.1); - h->GetXaxis()->SetTitle("TubeEfficiency"); - - histoType="TubeEfficiency_Middle"; - histoTitle = histoType; - h = new TH1F(histoType.c_str(),histoTitle.c_str(),100,0.,1.1); - h->GetXaxis()->SetTitle("TubeEfficiency"); - - histoType="TubeEfficiency_Outer"; - histoTitle = histoType; - h = new TH1F(histoType.c_str(),histoTitle.c_str(),100,0.,1.1); - h->GetXaxis()->SetTitle("TubeEfficiency"); - - if(region=="Endcap") - { - histoType="TubeEfficiency_extra"; - histoTitle = histoType; - h = new TH1F(histoType.c_str(),histoTitle.c_str(),100,0.,1.1); - h->GetXaxis()->SetTitle("TubeEfficiency"); - } - - histoType="ResidualsWidth"; - histoTitle = histoType+" Vs Radius"; - h2 = new TH2F(histoType.c_str(),histoTitle.c_str(),15,-15,15,100,0.,1.0); - h2->GetXaxis()->SetTitle("Radius (mm)"); - h2->GetYaxis()->SetTitle("Residuals width (mm)"); - - histoType="ResidualsMean"; - histoTitle = histoType+" Vs Radius"; - h2 = new TH2F(histoType.c_str(),histoTitle.c_str(),15,-15,15,100,-1.0,1.0); - h2->GetXaxis()->SetTitle("Radius (mm)"); - h2->GetYaxis()->SetTitle("Residuals mean (mm)"); - - histoType="DeadElements"; - histoTitle = histoType; - h2 = new TH2F(histoType.c_str(),histoTitle.c_str(),16,0.5,16.5, 6,0.5,6.5); - h2->GetYaxis()->SetBinLabel(1,"Low_Stat_Ch"); - h2->GetYaxis()->SetBinLabel(2,"dead_Chamber"); - h2->GetYaxis()->SetBinLabel(3,"dead_ML"); - h2->GetYaxis()->SetBinLabel(4,"dead_Layer"); - h2->GetYaxis()->SetBinLabel(5,"dead_Mezz"); - h2->GetYaxis()->SetBinLabel(6,"dead_Tube"); - h2->GetXaxis()->SetTitle("Sector Id"); - h2->SetMarkerSize(1.6); - - // Here the Overview occupancy plots per chamber in Sector_Vs_Eta view for Barrel and Endcap - if ( region == "Barrel" ) { - histoType="A_HitsPerML_Inner"; - histoTitle="HitsPerML_B"+side+"_Inner"; - h2 = new TH2F(histoType.c_str(),histoTitle.c_str(),12,-0.5,11.5,32,0.5,16.5); - h2->GetXaxis()->SetTitle("eta_id"); - h2->GetYaxis()->SetTitle("Sector nr."); - h2->SetAxisRange(0.5,11.5,"X"); // same range as the others but better display - - histoType="A_HitsPerML_Middle"; - histoTitle="HitsPerML_B"+side+"_Middle"; - h2 = new TH2F(histoType.c_str(),histoTitle.c_str(),12,-0.5,11.5,32,0.5,16.5); - h2->GetXaxis()->SetTitle("eta_id"); - h2->GetYaxis()->SetTitle("Sector nr."); - h2->SetAxisRange(0.5,6.5,"X"); // same range as the others but better display - - histoType="A_HitsPerML_Outer"; - histoTitle="HitsPerML_B"+side+"_Outer"; - h2 = new TH2F(histoType.c_str(),histoTitle.c_str(),12,-0.5,11.5,32,0.5,16.5); - h2->GetXaxis()->SetTitle("eta_id"); - h2->GetYaxis()->SetTitle("Sector nr."); - h2->SetAxisRange(-0.5,8.5,"X"); // same range as the others but better display - } - if ( region == "Endcap" ) { - // - // CHECK IF THIS IS CORRECT !!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - // - histoType="A_HitsPerML_Inner"; - histoTitle="HitsPerML_E"+side+"_Inner"; - h2 = new TH2F(histoType.c_str(),histoTitle.c_str(),8,0.5,8.5,32,0.5,16.5); - h2->GetXaxis()->SetTitle("eta_id"); - h2->GetYaxis()->SetTitle("Sector nr."); - - histoType="A_HitsPerML_Middle"; - histoTitle="HitsPerML_E"+side+"_Middle"; - h2 = new TH2F(histoType.c_str(),histoTitle.c_str(),6,0.5,6.5,32,0.5,16.5); - h2->GetXaxis()->SetTitle("eta_id"); - h2->GetYaxis()->SetTitle("Sector nr."); - - histoType="A_HitsPerML_Outer"; - histoTitle="HitsPerML_E"+side+"_Outer"; - h2 = new TH2F(histoType.c_str(),histoTitle.c_str(),6,0.5,6.5,32,0.5,16.5); - h2->GetXaxis()->SetTitle("eta_id"); - h2->GetYaxis()->SetTitle("Sector nr."); - - histoType="A_HitsPerML_extra"; - histoTitle="HitsPerML_E"+side+"_extra"; - h2 = new TH2F(histoType.c_str(),histoTitle.c_str(),4,0.5,4.5,32,0.5,16.5); - h2->GetXaxis()->SetTitle("eta_id"); - h2->GetYaxis()->SetTitle("Sector nr."); - } - // End of Overview occupancy plots - } - - - // motherdir = /TrigDaq/; - motherdir = GetTDaqDirectoryName(region); - m_rootfile->cd(motherdir.c_str()); - dir_name = GetTDaqDirectoryName(region,side); - if (!m_rootfile->GetDirectory(dir_name.c_str())) { - // A new TDirectoryFile gets owned by the current directory (side effect). - new TDirectoryFile(regionSide.c_str(),regionSide.c_str()); - } - - // Build Sectors : - for (int sector=sectorMin; sector<=sectorMax; sector++) { // LOOP on Sectors - buildSector(region,side,sector); - } -} - - -void HistogramManager::buildSector(std::string region, std::string side, int sector) { - - std::string sectordir=GetMdtDirectoryName(region, side, sector); - if (m_rootfile->GetDirectory(sectordir.c_str())) { - return; - } - - std::vector<MDTName> chamberList = GetChamberList(region, side, sector); - - // Sort Chambers By chamberType - std::stable_sort(chamberList.begin(), chamberList.end(), sortMdtChambersByName() ) ; - int numTotChambers=chamberList.size(); - - std::string previousChamberType = "XXX"; - std::vector<MDTName> chamberListPerType[7]; - int totChamberTypes = 0; - for (int ichamber = 0; ichamber<numTotChambers; ichamber++ ) { - if ( chamberList[ichamber].getName() != previousChamberType) { - previousChamberType = chamberList[ichamber].getName(); - totChamberTypes++; - } - chamberListPerType[totChamberTypes-1].push_back(chamberList[ichamber]); - } - - - ToString ts; - std::string sectorString=ts(sector); - if(sector<10) sectorString="0"+sectorString; - std::string sector_name="Sector"+sectorString; - std::string sector_title="Sector "+sectorString; - - std::string motherdir= GetMdtDirectoryName(region,side); - m_rootfile->cd(motherdir.c_str()); - TH1F * h; - TH1F * h1; - TH2F * h2; - - TDirectoryFile * sector_dir = new TDirectoryFile(sector_name.c_str(),sector_title.c_str()); - TDirectoryFile * overview = new TDirectoryFile("OVERVIEW","OVERVIEW","",sector_dir); - - overview->cd(); - std::string histoTitPart2 = region+"_"+side+" Sector "+sectorString; - std::string histoType; - std::string histoTitle; - - int nbinMultipl=50; - float xminMultipl=0.5; - float xmaxMultipl=50.5; - /////////////////////////////////////////////////////////////////////// - // DEFINITION OF HISTOGRAMS in directory /MDT/<region>_{A,C}/SectorXX/OVERVIEW : - // - Occupancies - // - histoType="z_HitsVsMezzanine"; - histoTitle = "HitsVsMezzanine "+histoTitPart2; - TH2F * HitsVsMezzanine = new TH2F(histoType.c_str(),histoTitle.c_str(), - numTotChambers,0.,(float)numTotChambers,20,-0.5,19.5); - HitsVsMezzanine->GetYaxis()->SetTitle("Mezzanine nr."); - - std::string chamberType; - for (int ichamber = 0; ichamber<numTotChambers; ichamber++ ) { - std::string chamberName = chamberList[ichamber].getOnlineName(); - HitsVsMezzanine->GetXaxis()->SetBinLabel(ichamber+1,chamberName.c_str()); - } - - float TDCmin=0.; - float TDCmax=3000.; - int nbinTDC=300; - // - histoType="TDC_AllChambers_Inner"; - histoTitle = histoType+" "+histoTitPart2; - h = new TH1F(histoType.c_str(),histoTitle.c_str(),nbinTDC,TDCmin,TDCmax); - h->GetXaxis()->SetTitle("TDC counts"); - // - histoType="TDC_AllChambers_Middle"; - histoTitle = histoType+" "+histoTitPart2; - h = new TH1F(histoType.c_str(),histoTitle.c_str(),nbinTDC,TDCmin,TDCmax); - h->GetXaxis()->SetTitle("TDC counts"); - // - histoType="TDC_AllChambers_Outer"; - histoTitle = histoType+" "+histoTitPart2; - h = new TH1F(histoType.c_str(),histoTitle.c_str(),nbinTDC,TDCmin,TDCmax); - h->GetXaxis()->SetTitle("TDC counts"); - // - if(region=="Endcap") { - histoType="TDC_AllChambers_extra"; - histoTitle = histoType+" "+histoTitPart2; - h = new TH1F(histoType.c_str(),histoTitle.c_str(),nbinTDC,TDCmin,TDCmax); - h->GetXaxis()->SetTitle("TDC counts"); - } - // - if(region=="Barrel") { - histoType="z_MDT_RPC"; - histoTitle = "Distance BM Segment to RPC "+histoTitPart2; - h = new TH1F(histoType.c_str(),histoTitle.c_str(),100,-50.,50.); - h->GetXaxis()->SetTitle("Distance MDT segment to RPC hit (mm)"); - } - - if(region=="Endcap") { - histoType="z_MDT_TGC"; - histoTitle = "Distance EM Segment to TGC "+histoTitPart2; - h = new TH1F(histoType.c_str(),histoTitle.c_str(),100,-50.,50.); - h->GetXaxis()->SetTitle("Distance MDT segment to TGC hit (mm)"); - } - - int etaMinI = 99; // Inner chambers - int etaMaxI = -99; - int etaMinM = 99; // Middle - int etaMaxM = -99; - int etaMinO = 99; // Outer - int etaMaxO = -99; - int etaMinE = 99; // Extra - int etaMaxE = -99; - - int tubeMaxBM[10]; - for (int i=0;i<10;i++) tubeMaxBM[i]=1; - int etaMinBM = 99; - int etaMaxBM = -99; - int tubeMaxEM[10]; - for (int i=0;i<10;i++) tubeMaxEM[i]=1; - int etaMinEM = 99; - int etaMaxEM = -99; - int etaBins=98; - float fetaMin=-24.5; - float fetaMax=24.5; - for (int ichamber=1; ichamber<=totChamberTypes; ichamber++){ - chamberType=chamberListPerType[ichamber-1].at(0).getName(); - // - // check if it is a reasonable name ! - // - if ( !(chamberType.substr(0,1)=="B" || chamberType.substr(0,1)=="E") ) { - continue; - } - // - // FIND HERE etaMin and etaMax from the list chamberListPerType[ichamber-1] - // - int etaMin = 9; - int etaMax = -9; - - for (unsigned int ic=0; ic<chamberListPerType[ichamber-1].size(); ic++){ - int etaic = chamberListPerType[ichamber-1].at(ic).getOnlineEta(); - if (etaic < etaMin ) etaMin = etaic; - if (etaic > etaMax ) etaMax = etaic; - if (chamberType.substr(0,2)=="BM" ) { - if (etaic < etaMinBM ) etaMinBM = etaic; - if (etaic > etaMaxBM ) etaMaxBM = etaic; - tubeMaxBM[etaic]=56; // HERE SUBSTITUTE WITH tubeMax OBTAINED FROM MdtChamber - } - if (chamberType.substr(0,2)=="EM" ) { - if (etaic < etaMinEM ) etaMinEM = etaic; - if (etaic > etaMaxEM ) etaMaxEM = etaic; - tubeMaxEM[etaic]=64; // HERE SUBSTITUTE WITH tubeMax OBTAINED FROM MdtChamber - } - if (chamberType.substr(1,1)=="I" ) { - if (etaic < etaMinI ) etaMinI = etaic; - if (etaic > etaMaxI ) etaMaxI = etaic; - } - if (chamberType.substr(1,1)=="M" ) { - if (etaic < etaMinM ) etaMinM = etaic; - if (etaic > etaMaxM ) etaMaxM = etaic; - } - if (chamberType.substr(1,1)=="O" ) { - if (etaic < etaMinO ) etaMinO = etaic; - if (etaic > etaMaxO ) etaMaxO = etaic; - } - if (chamberType.substr(1,1)=="E" ) { - if (etaic < etaMinE ) etaMinE = etaic; - if (etaic > etaMaxE ) etaMaxE = etaic; - } - } - - etaBins = 2*(etaMax-etaMin+1); - fetaMin = (float)etaMin-0.5; - fetaMax = (float)etaMax+0.5; - histoType="HitsOnSegment"+chamberType; - histoTitle = histoType+" "+histoTitPart2; - h = new TH1F(histoType.c_str(),histoTitle.c_str(),nbinMultipl, xminMultipl, xmaxMultipl); - h->SetAxisRange(xminMultipl,20.5); - // - if ( (chamberType=="BOG" || chamberType=="BOF") ) { - histoType="t0PerMLBOGBOF"; - histoTitle = histoType+" "+histoTitPart2; - if (side=="A") h = new TH1F(histoType.c_str(),histoTitle.c_str(),18,-0.5,8.5); // BOG0 only for side A - if (side=="C") h = new TH1F(histoType.c_str(),histoTitle.c_str(),16,0.5,8.5); - h->GetXaxis()->SetTitle("eta_id"); - h->GetYaxis()->SetTitle("t0 (ns)"); - h->SetAxisRange(200.,1000.,"Y"); - h->SetMarkerStyle(20); - h->SetMarkerSize(1.0); - // - histoType="tdriftPerMLBOGBOF"; - histoTitle = histoType+" "+histoTitPart2; - if (side=="A") h = new TH1F(histoType.c_str(),histoTitle.c_str(),18,-0.5,8.5); // BOG0 only for side A - if (side=="C") h = new TH1F(histoType.c_str(),histoTitle.c_str(),16,0.5,8.5); - h->GetXaxis()->SetTitle("eta_id"); - h->GetYaxis()->SetTitle("tdrift (ns)"); - h->SetAxisRange(600.,800.,"Y"); - h->SetMarkerStyle(20); - h->SetMarkerSize(1.0); - - } else { - histoType="t0PerML"+chamberType; - histoTitle = histoType+" "+histoTitPart2; - h = new TH1F(histoType.c_str(),histoTitle.c_str(),etaBins,fetaMin,fetaMax); - h->GetXaxis()->SetTitle("eta_id"); - h->GetYaxis()->SetTitle("t0 (ns)"); - h->SetAxisRange(200.,1000.,"Y"); - h->SetMarkerStyle(20); - h->SetMarkerSize(1.0); - // - histoType="tdriftPerML"+chamberType; - histoTitle = histoType+" "+histoTitPart2; - h = new TH1F(histoType.c_str(),histoTitle.c_str(),etaBins,fetaMin,fetaMax); - h->GetXaxis()->SetTitle("eta_id"); - h->GetYaxis()->SetTitle("tdrift (ns)"); - h->SetAxisRange(600.,800.,"Y"); - h->SetMarkerStyle(20); - h->SetMarkerSize(1.0); - } - }//ichamber - - int etaBinsX; - float fetaMinX; - float fetaMaxX; - - etaBinsX = 2*(etaMaxI-etaMinI+1); - fetaMinX = (float)etaMinI-0.5; - fetaMaxX = (float)etaMaxI+0.5; - histoType="HitsPerML_Inner"; - histoTitle = histoType+" "+histoTitPart2; - h = new TH1F(histoType.c_str(),histoTitle.c_str(),etaBinsX,fetaMinX,fetaMaxX); - h->GetXaxis()->SetTitle("eta_id"); - // - etaBinsX = 2*(etaMaxM-etaMinM+1); - fetaMinX = (float)etaMinM-0.5; - fetaMaxX = (float)etaMaxM+0.5; - histoType="HitsPerML_Middle"; - histoTitle = histoType+" "+histoTitPart2; - h = new TH1F(histoType.c_str(),histoTitle.c_str(),etaBinsX,fetaMinX,fetaMaxX); - h->GetXaxis()->SetTitle("eta_id"); - // - etaBinsX = 2*(etaMaxO-etaMinO+1); - fetaMinX = (float)etaMinO-0.5; - fetaMaxX = (float)etaMaxO+0.5; - histoType="HitsPerML_Outer"; - histoTitle = histoType+" "+histoTitPart2; - h = new TH1F(histoType.c_str(),histoTitle.c_str(),etaBinsX,fetaMinX,fetaMaxX); - h->GetXaxis()->SetTitle("eta_id"); - - if(region=="Endcap") - { - etaBinsX = 2*(etaMaxE-etaMinE+1); - fetaMinX = (float)etaMinE-0.5; - fetaMaxX = (float)etaMaxE+0.5; - histoType="HitsPerML_extra"; - histoTitle = histoType+" "+histoTitPart2; - h = new TH1F(histoType.c_str(),histoTitle.c_str(),etaBinsX,fetaMinX,fetaMaxX); - h->GetXaxis()->SetTitle("eta_id"); - } - /////////////////////////////////////////////////////////////////////// - // - /////////////////////////////////////////////////////////////////////// - // DEFINITION OF HISTOGRAMS in directory /MDTvsRPC/Barrel_{A,C}/SectorXX : - // - if (region=="Barrel") { - motherdir= GetTDaqDirectoryName(region,side); - m_rootfile->cd(motherdir.c_str()); - - TDirectoryFile * sector_tdaqdir = new TDirectoryFile(sector_name.c_str(),sector_title.c_str()); - sector_tdaqdir->cd(); - histoType="MDT_RPC"; - histoTitle = "Distance Segment to RPC "+histoTitPart2; - h = new TH1F(histoType.c_str(),histoTitle.c_str(),100,-50.,50.); - h->GetXaxis()->SetTitle("Distance MDT segment to RPC hit (mm)"); - - // GLOBAL TIME FIT HISTOGRAMS : - // - - histoType="ResidualsVsRadius"; - histoTitle = "Residuals Vs Radius "+histoTitPart2; - h2 = new TH2F(histoType.c_str(),histoTitle.c_str(),30,-15,15.,200,-5.,5.); - h2->GetXaxis()->SetTitle("Radius (mm)"); - h2->GetYaxis()->SetTitle("Residuals (mm)"); - - histoType="Segment_chi2"; - histoTitle = "eta_id Vs Segment_chi2 "+histoTitPart2; - h2 = new TH2F(histoType.c_str(),histoTitle.c_str(),50, 0.,50.,6,0.5,6.5); - h2->GetXaxis()->SetTitle("chi2/DoF"); - h2->GetYaxis()->SetTitle("BM chamber eta_id"); - - histoType="Segment_ProbChi2"; - histoTitle = "Segment_ProbChi2 "+histoTitPart2; - h1 = new TH1F(histoType.c_str(),histoTitle.c_str(),50,0.,1.); - h1->GetXaxis()->SetTitle("Prob(chi2,DoF)"); - - histoType="Residuals"; - histoTitle = "eta_id Vs Residuals "+histoTitPart2; - h2 = new TH2F(histoType.c_str(),histoTitle.c_str(),200,-5.,5.,6,0.5,6.5); - h2->GetXaxis()->SetTitle("Residuals (mm)"); - h2->GetYaxis()->SetTitle("BM chamber eta_id"); - - histoType="HitsOnSegment"; - histoTitle = "eta_id Vs HitsOnSegment "+histoTitPart2; - h2 = new TH2F(histoType.c_str(),histoTitle.c_str(),10,0.5,10.5,6,0.5,6.5); - h2->GetXaxis()->SetTitle("nr. of hits on Segment"); - h2->GetYaxis()->SetTitle("BM chamber eta_id"); - - histoType="HitRadius"; - histoTitle = "Hit Radius "+histoTitPart2; - h = new TH1F(histoType.c_str(),histoTitle.c_str(),80,-20.,20.); - h->GetXaxis()->SetTitle("Hit Radius (mm)"); - - for (int ic=etaMinBM; ic<=etaMaxBM; ic++){ - histoType="TrigTime_BM_eta_"+ts(ic); - histoTitle = histoType+" "+histoTitPart2; - h = new TH1F(histoType.c_str(),histoTitle.c_str(),768,0.,1200.); - h->GetXaxis()->SetTitle("TriggerTime (ns)"); - - histoType="TrigTimeVsROdistance_BM_eta_"+ts(ic); - histoTitle = histoType+" "+histoTitPart2; - h2 = new TH2F(histoType.c_str(),histoTitle.c_str(),72, 0.,3600.,192,0.,1200.); - h2->GetXaxis()->SetTitle("Position along the wires (mm)"); - h2->GetYaxis()->SetTitle("TriggerTime (ns)"); - - histoType="TriggerCoverage_BM_eta_"+ts(ic); - histoTitle = histoType+" "+histoTitPart2; - - h2 = new TH2F(histoType.c_str(),histoTitle.c_str(),72, 0.,3600., - tubeMaxBM[ic],0.5,(float)tubeMaxBM[ic]+0.5); - h2->GetXaxis()->SetTitle("Position along the wires (mm)"); - h2->GetYaxis()->SetTitle("Position perp to the wires (mm)"); - } - // DEBUG HISTOGRAMS TO BE REMOVED ! - bool detailedAnalysis = false; - if (detailedAnalysis) { - histoType="a_old_Vs_a_new"; - histoTitle = histoType; - h2 = new TH2F(histoType.c_str(),histoTitle.c_str(),200,-4.,4.,200,-4.,4.); - h2->GetXaxis()->SetTitle("aSegment_new"); - h2->GetYaxis()->SetTitle("aSegment_old"); - - histoType="b_old_Vs_b_new"; - histoTitle = histoType; - h2 = new TH2F(histoType.c_str(),histoTitle.c_str(),500,-50.,200.,500,-50.,200.); - h2->GetXaxis()->SetTitle("bSegment_new"); - h2->GetYaxis()->SetTitle("bSegment_old"); - - histoType="a_diff"; - histoTitle = histoType; - h1 = new TH1F(histoType.c_str(),histoTitle.c_str(),1000,-0.5,0.5); - h1->GetXaxis()->SetTitle("aSegment_new-aSegment_old"); - - histoType="b_diff"; - histoTitle = histoType; - h1 = new TH1F(histoType.c_str(),histoTitle.c_str(),1000,-10.,10.); - h1->GetXaxis()->SetTitle("bSegment_new-bSegment_old"); - - } - } - - - /////////////////////////////////////////////////////////////////////// - // - /////////////////////////////////////////////////////////////////////// - // DEFINITION OF HISTOGRAMS in directory /MDTvsTGC/Endcap_{A,C}/SectorXX : - // - if (region=="Endcap") { - motherdir= GetTDaqDirectoryName(region,side); - m_rootfile->cd(motherdir.c_str()); - - TDirectoryFile * sector_tdaqdir = new TDirectoryFile(sector_name.c_str(),sector_title.c_str()); - sector_tdaqdir->cd(); - histoType="MDT_TGC"; - histoTitle = "Distance Segment to TGC "+histoTitPart2; - h = new TH1F(histoType.c_str(),histoTitle.c_str(),100,-50.,50.); - h->GetXaxis()->SetTitle("Distance MDT segment to TGC hit (mm)"); - // - // histoType="MDT_TGC_Vs_Event"; - // histoTitle = "Distance Segment to TGC Vs Event "+histoTitPart2; - // h2 = new TH2F(histoType.c_str(),histoTitle.c_str(),200,0.,2000000.,100,-50.,50.); - // - // GLOBAL TIME FIT HISTOGRAMS : - // - - histoType="Track_chi2"; - histoTitle = "eta_id Vs Track_chi2 "+histoTitPart2; - h2 = new TH2F(histoType.c_str(),histoTitle.c_str(),50, 0.,50.,6,0.5,6.5); - h2->GetXaxis()->SetTitle("chi2/DoF"); - h2->GetYaxis()->SetTitle("EM chamber eta_id"); - - histoType="Residuals"; - histoTitle = "eta_id Vs Residuals "+histoTitPart2; - h2 = new TH2F(histoType.c_str(),histoTitle.c_str(),200,-5.,5.,6,0.5,6.5); - h2->GetXaxis()->SetTitle("Residuals (mm)"); - h2->GetYaxis()->SetTitle("EM chamber eta_id"); - - histoType="Hit_Res_Chi2DoF"; - histoTitle = "eta_id Vs Hit Residuals Chi2/DoF"+histoTitPart2; - h2 = new TH2F(histoType.c_str(),histoTitle.c_str(),100,0.,50.,6,0.5,6.5); - h2->GetXaxis()->SetTitle("Hit Residuals Chi2/DoF"); - h2->GetYaxis()->SetTitle("EM chamber eta_id"); - - histoType="HitsOnSegment"; - histoTitle = "eta_id Vs HitsOnSegment "+histoTitPart2; - h2 = new TH2F(histoType.c_str(),histoTitle.c_str(),10,0.5,10.5,6,0.5,6.5); - h2->GetXaxis()->SetTitle("nr. of hits on Segment"); - h2->GetYaxis()->SetTitle("EM chamber eta_id"); - - histoType="HitRadius"; - histoTitle = "Hit Radius "+histoTitPart2; - h = new TH1F(histoType.c_str(),histoTitle.c_str(),80,-20.,20.); - h->GetXaxis()->SetTitle("Hit Radius (mm)"); - - for (int ic=etaMinEM; ic<=etaMaxEM; ic++){ - histoType="TrigTime_EM_eta_"+ts(ic); - histoTitle = histoType+" "+histoTitPart2; - h = new TH1F(histoType.c_str(),histoTitle.c_str(),768,0.,1200.); - h->GetXaxis()->SetTitle("TriggerTime (ns)"); - - histoType="TrigTimeVsROdistance_EM_eta_"+ts(ic); - histoTitle = histoType+" "+histoTitPart2; - h2 = new TH2F(histoType.c_str(),histoTitle.c_str(),72, 0.,3600.,192,0.,1200.); - h2->GetXaxis()->SetTitle("Position along the wires (mm)"); - h2->GetYaxis()->SetTitle("TriggerTime (ns)"); - - histoType="TriggerCoverage_EM_eta_"+ts(ic); - histoTitle = histoType+" "+histoTitPart2; - - h2 = new TH2F(histoType.c_str(),histoTitle.c_str(),72, 0.,3600., - tubeMaxEM[ic],0.5,(float)tubeMaxEM[ic]+0.5); - h2->GetXaxis()->SetTitle("Position along the wires (mm)"); - h2->GetYaxis()->SetTitle("Position perp to the wires (mm)"); - } - } -} - -void HistogramManager::buildChamberHistos(MDTName chamb) { - - - int eta_id = chamb.getOfflineEta(); - int phi_id = chamb.getOfflineSector(); - int sector=chamb.getOnlineSector(); - - ToString ts; - - std::string sectorString=ts(sector); - if(sector<10) sectorString="0"+sectorString; - std::string sector_name="Sector"+sectorString; - std::string sector_title="Sector "+sectorString; - - std::string region=chamb.getRegion(); - std::string side=chamb.getSide(); - - std::string chamberName=chamb.getOnlineName(); - std::string chamberType=chamb.getName(); - - std::string motherdir=GetMdtDirectoryName(region, side, sector); - m_rootfile->cd(motherdir.c_str()); - - TDirectoryFile * chamber_dir = new TDirectoryFile(chamberName.c_str(),chamberName.c_str()); - TDirectoryFile * occupancy_dir = new TDirectoryFile("Occupancy","occupancy","",chamber_dir); - TDirectoryFile * efficiency_dir = new TDirectoryFile("Efficiency","efficiency","",chamber_dir); - TDirectoryFile * deadStatus_dir = new TDirectoryFile("DeadStatus","DeadStatus","",chamber_dir); - TDirectoryFile * expert_dir = new TDirectoryFile("Expert","Expert","",chamber_dir); - TDirectoryFile * noiseStatus_dir = new TDirectoryFile("NoiseStatus","NoiseStatus","",chamber_dir); - chamber_dir->cd(); - - // - // The following values should be read in from a Chamber Layout File - - int numTubesPerLayer[2], numOfMezzPerML[2]; - numTubesPerLayer[0] = 0; - numTubesPerLayer[1] = 0; - numOfMezzPerML[0] = 0; - numOfMezzPerML[1] = 0; - int numLayersPerML, numML, numTubesPerMezz, numMezzanines, numMaxTubesPerLayer; - int numTotTubesML[2]; - int tubeNumberOffsetML[2]; - // - // tubeNumberOffsetML1, tubeNumberOffsetML1 MUST BE SET to match online tube numbering - // I think a method in HistogramManager could be used. (or in phi_eta_utils......) - // for the moment do not add any offset: - tubeNumberOffsetML[0] = GetTubeOffsetML1(chamberName); - tubeNumberOffsetML[1] = 0; - - if ( m_idHelper ) { - Identifier station_id = m_mdtIdHelper->elementID(chamberType, eta_id, phi_id); - numML = m_mdtIdHelper->numberOfMultilayers(station_id); - Identifier MdtML1_id = m_mdtIdHelper->multilayerID(station_id,1); - Identifier MdtML2_id; - if ( numML>1) MdtML2_id = m_mdtIdHelper->multilayerID(station_id,2); - numLayersPerML = m_mdtIdHelper->tubeLayerMax(MdtML1_id) - m_mdtIdHelper->tubeLayerMin(MdtML1_id) + 1; - if (chamberName.substr(0,4)=="BIS8") numLayersPerML=3; // PATCH TO MdtIdHelper BUG (should be fixed in next release) - numTubesPerLayer[0] = m_mdtIdHelper->tubeMax(MdtML1_id) - m_mdtIdHelper->tubeMin(MdtML1_id) + 1; - - if ( numML>1 ) numTubesPerLayer[1] = m_mdtIdHelper->tubeMax(MdtML2_id) - m_mdtIdHelper->tubeMin(MdtML2_id) + 1; - - numMaxTubesPerLayer = numTubesPerLayer[0]; - if (numTubesPerLayer[1]>numTubesPerLayer[0]) numMaxTubesPerLayer = numTubesPerLayer[1]; - numTubesPerMezz = 8; - if (numLayersPerML==4) numTubesPerMezz = 6; - numOfMezzPerML[0] = numTubesPerLayer[0]/numTubesPerMezz; - numOfMezzPerML[1] = numTubesPerLayer[1]/numTubesPerMezz; - numMezzanines = numOfMezzPerML[0]+numOfMezzPerML[1]; - } else { - numLayersPerML=3; - numML = GetChamberNumOfML(chamberName); - numTubesPerMezz = GetChamberTubesPerMezz(chamberName); - numOfMezzPerML[0] = GetChamberNumOfMezzPerML(chamberName); - if (numML>1) numOfMezzPerML[1] = numOfMezzPerML[0]; - if (numTubesPerMezz==6) numLayersPerML=4; - numTubesPerLayer[0]=numTubesPerMezz*numOfMezzPerML[0]; - numTubesPerLayer[1]=numTubesPerMezz*numOfMezzPerML[1]; - numMaxTubesPerLayer = numTubesPerLayer[0]; - if (numTubesPerLayer[1]>numTubesPerLayer[0]) numMaxTubesPerLayer = numTubesPerLayer[1]; - numMezzanines = numOfMezzPerML[0]+numOfMezzPerML[1]; - } - numTotTubesML[0]=numLayersPerML*numTubesPerLayer[0]; - numTotTubesML[1]=numLayersPerML*numTubesPerLayer[1]; - - float allTubesMin = 0.5; - float allTubesMax = (float) numTotTubesML[0]; - if (numTotTubesML[0]<numTotTubesML[1]) allTubesMax = (float) numTotTubesML[1]; - if (numML>1) allTubesMax = 2.*allTubesMax; - allTubesMax = allTubesMax + 0.5; - int nbinAllTubes = (int) (allTubesMax-allTubesMin); - - int nbinMultipl=50; - float xminMultipl=0.; - float xmaxMultipl=50.; - - float TDCmin=0.; - float TDCmax=3000.; - int nbinTDC=300; - int nbinTDCcoarse=60; - - float ADCmin=0.; - float ADCmax=400.; - int nbinADC=200; - int nbinADCcoarse=40; - - TH1F * h; - TH1F * h1; - TH2F * h2; - - std::string histoTitPart2=chamberName; - std::string histoType; - std::string histoTitle; - /////////////////////////////////////////////////////////////////////////////// - // - // DEFINITION OF HISTOGRAMS in directory /MDT/Barrel_{A,C}/SectorXX/<chamber> : - // - // - Multiplicities - // - histoType="B_ChamberHitMultiplicity"; - histoTitle = "ChamberHitMultiplicity "+histoTitPart2; - TH1F * HitMult = new TH1F(histoType.c_str(),histoTitle.c_str(),nbinMultipl, xminMultipl, xmaxMultipl); - HitMult->GetXaxis()->SetTitle("Chamber tot nr. hits"); - - histoType="D_ChamberHitsOnSegment"; - histoTitle = "ChamberHitsOnSegment "+histoTitPart2; - TH1F * HitsOnSeg = new TH1F(histoType.c_str(),histoTitle.c_str(),nbinMultipl, xminMultipl, xmaxMultipl); - HitsOnSeg->GetXaxis()->SetTitle("nr. hits on segment"); - HitsOnSeg->SetAxisRange(xminMultipl,20.5); - - // - occupancies - // - - histoType="b_DeadTubeStatus"; - histoTitle = "DeadTubeStatus "+histoTitPart2; - TH1F * DeadTubeStatus = new TH1F(histoType.c_str(),histoTitle.c_str(),nbinAllTubes,allTubesMin,allTubesMax); - DeadTubeStatus->GetXaxis()->SetTitle("Tube_id"); - - histoType="a_ChamberHitOccupancy"; - histoTitle = "ChamberHitOccupancy "+histoTitPart2; - TH2F * ChamberHits = new TH2F(histoType.c_str(),histoTitle.c_str(), - numMaxTubesPerLayer,0.5,numMaxTubesPerLayer+0.5,10,0.5,10.5); - ChamberHits->GetXaxis()->SetTitle("Tube nr."); - ChamberHits->GetYaxis()->SetTitle("Layer"); - // - - histoType="a_HitsPerTube"; - histoTitle = "HitsPerTube "+histoTitPart2; - TH1F * HitsPerTube = new TH1F(histoType.c_str(),histoTitle.c_str(),nbinAllTubes,allTubesMin,allTubesMax); - HitsPerTube->GetXaxis()->SetTitle("Tube_id"); - // - histoType="a_HitsPerTubeAdcCut"; - histoTitle = "HitsPerTubeAdcCut "+histoTitPart2; - TH1F * HitsPerTubeAdcCut = new TH1F(histoType.c_str(),histoTitle.c_str(),nbinAllTubes,allTubesMin,allTubesMax); - HitsPerTubeAdcCut->GetXaxis()->SetTitle("Tube_id"); - // - // - efficiencies - - histoType="b_EfficiencyPerTube"; - histoTitle = "EfficiencyPerTube "+histoTitPart2; - TH1F * EfficiencyPerTube = new TH1F(histoType.c_str(),histoTitle.c_str(),nbinAllTubes,allTubesMin,allTubesMax); - EfficiencyPerTube->GetXaxis()->SetTitle("Tube_id"); - EfficiencyPerTube->GetYaxis()->SetTitle("efficiency"); - EfficiencyPerTube->SetMarkerStyle(20); - EfficiencyPerTube->SetMarkerSize(1.0); - EfficiencyPerTube->Sumw2(); - - - // - // - RESIDUALS - // - histoType="b_SegResidVsRadius"; - histoTitle = "Residuals Vs Radius "+histoTitPart2; - h2 = new TH2F(histoType.c_str(),histoTitle.c_str(),30,-15,15.,200,-5.,5.); - h2->GetXaxis()->SetTitle("Radius (mm)"); - h2->GetYaxis()->SetTitle("Residuals (mm)"); - // - histoType="b_SegmentResidual"; - histoTitle = "Segment Residuals "+histoTitPart2; - h1 = new TH1F(histoType.c_str(),histoTitle.c_str(),200,-5.,5.); - h1->GetXaxis()->SetTitle("Residuals (mm)"); - // - // - Segment Prob(chi2,ndeg) - // - histoType="c_Segment_ProbChi2"; - histoTitle = "Segment_ProbChi2 "+histoTitPart2; - h1 = new TH1F(histoType.c_str(),histoTitle.c_str(),50,0.,1.); - h1->GetXaxis()->SetTitle("Prob(chi2,DoF)"); - - // - // - TDC and ADC - // - histoType="A_TDC_ML1"; - histoTitle = "TDC_ML1 "+histoTitPart2; - TH1F * TDC_ML1 = new TH1F(histoType.c_str(),histoTitle.c_str(),nbinTDC,TDCmin,TDCmax); - TDC_ML1->GetXaxis()->SetTitle("TDC counts"); - // - histoType="A_TDC_ML2"; - histoTitle = "TDC_ML2 "+histoTitPart2; - TH1F * TDC_ML2 = new TH1F(histoType.c_str(),histoTitle.c_str(),nbinTDC,TDCmin,TDCmax); - TDC_ML2->GetXaxis()->SetTitle("TDC counts"); - // - histoType="C_ADC_ML1"; - histoTitle = "ADC_ML1 "+histoTitPart2; - TH1F * ADC_ML1 = new TH1F(histoType.c_str(),histoTitle.c_str(),nbinADC,ADCmin,ADCmax); - ADC_ML1->GetXaxis()->SetTitle("ADC counts"); - // - histoType="C_ADC_ML2"; - histoTitle = "ADC_ML2 "+histoTitPart2; - TH1F * ADC_ML2 = new TH1F(histoType.c_str(),histoTitle.c_str(),nbinADC,ADCmin,ADCmax); - ADC_ML2->GetXaxis()->SetTitle("ADC counts"); - // - // - TDC Vs ADC spectra per Mezzanine : - // - for (int imezz=0; imezz<numMezzanines; imezz++) { - histoType="tdc_Vs_adc_mezz_"+ts(imezz); - histoTitle = histoType+" "+histoTitPart2; - h2 = new TH2F(histoType.c_str(),histoTitle.c_str(),nbinADCcoarse,ADCmin,ADCmax,nbinTDCcoarse,TDCmin,TDCmax); - h2->GetXaxis()->SetTitle("ADC counts"); - h2->GetYaxis()->SetTitle("TDC counts"); - } - - - //////////////////////////////////////////////////////////////////////////////// - // - // Histograms in the subdirectories: ...... - // - - /*::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/ - /*:::::::::::::::::::::::EXPERT:::::::::::::::::::::::::::*/ - /*::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/ - expert_dir->cd(); - - histoType="ChamberYZOccupancy"; - histoTitle = histoType+" "+histoTitPart2; - TH2F * ChamberHitsYZ = new TH2F(histoType.c_str(),histoTitle.c_str(), - 220,0.,2200.,100,0.,1000.); - ChamberHitsYZ->GetXaxis()->SetTitle("Hit_y (mm) "); - ChamberHitsYZ->GetYaxis()->SetTitle("Hit_z (mm) "); - // - - histoType="DeadTubeRefMap"; - histoTitle = histoType+" "+histoTitPart2; - TH1F * href = new TH1F(histoType.c_str(),histoTitle.c_str(),nbinAllTubes,allTubesMin,allTubesMax); - href->GetXaxis()->SetTitle("Tube_id"); - int tubesMLextended = nbinAllTubes/2; - if (numTubesPerLayer[1]==0) tubesMLextended = nbinAllTubes; - int tubesLayerExtended = tubesMLextended/numLayersPerML; - for (int ibin=1;ibin<=nbinAllTubes;ibin++) { - - int binSign, layercode; - if (ibin<=tubesMLextended) { - binSign = -1; - layercode = ((ibin-1)/tubesLayerExtended) + 1; - layercode = layercode*10*binSign; - } else { - binSign = 1; - layercode = ((ibin-tubesMLextended-1)/tubesLayerExtended) + 1; - layercode = layercode*10*binSign; - } - - href->SetBinContent(ibin,layercode); - } - - setChamberCutOut(chamberName, href ); - - histoType="DeadTubeMap"; - histoTitle = histoType+" "+histoTitPart2; - - h = (TH1F*) href->Clone(histoType.c_str()); - h->SetTitle(histoTitle.c_str()); - - histoType="ChamberDeadChannels"; - histoTitle = histoType+" "+histoTitPart2; - h2 = new TH2F(histoType.c_str(),histoTitle.c_str(), - numMaxTubesPerLayer,0.5,numMaxTubesPerLayer+0.5,10,0.5,10.5); - h2->GetXaxis()->SetTitle("Tube nr."); - h2->GetYaxis()->SetTitle("Layer"); - // - - histoType="EffiResidVsRadius"; - histoTitle = histoType+" "+histoTitPart2; - h2 = new TH2F(histoType.c_str(),histoTitle.c_str(), - 30,0.,15.,640,-16.,16.); - h2->GetXaxis()->SetTitle("Segment distance from wire (mm)"); - h2->GetYaxis()->SetTitle("Residual (mm)"); - // - histoType="EfficiencyEntries"; - histoTitle = histoType+" "+histoTitPart2; - h = new TH1F(histoType.c_str(),histoTitle.c_str(),nbinAllTubes,allTubesMin,allTubesMax); - h->GetXaxis()->SetTitle("Tube_id"); - h->GetYaxis()->SetTitle("Nr of events the tube should fire"); - - histoType="EfficiencyCounts"; - histoTitle = histoType+" "+histoTitPart2; - h = new TH1F(histoType.c_str(),histoTitle.c_str(),nbinAllTubes,allTubesMin,allTubesMax); - h->GetXaxis()->SetTitle("Tube_id"); - h->GetYaxis()->SetTitle("Nr. of events the tube HAS fired"); - - - /*::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/ - /*::::::::::::::::::::DEADSTATUS::::::::::::::::::::::::::*/ - /*::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/ - deadStatus_dir->cd(); - - histoType="ChamberDeadTubes"; - histoTitle = histoType+" "+histoTitPart2; - h2 = new TH2F(histoType.c_str(),histoTitle.c_str(),numMaxTubesPerLayer,0.5,numMaxTubesPerLayer+0.5,10,0.5,10.5); - h2->GetXaxis()->SetTitle("Tube nr."); - h2->GetYaxis()->SetTitle("Layer"); - - for (int ML=1;ML<=numML;ML++){ - for (int layer=1; layer<=numLayersPerML; layer++){ - int nbin=numTubesPerLayer[ML-1]; - float xmin = 0.5 + (float)tubeNumberOffsetML[ML-1]; - float xmax = (float)numTubesPerLayer[ML-1] + xmin; - - occupancy_dir->cd(); - histoType="HitsPerTube_ML"+ts(ML)+"_L"+ts(layer); - histoTitle = histoType+" "+histoTitPart2; - h = new TH1F(histoType.c_str(),histoTitle.c_str(),nbin,xmin,xmax); - h->GetXaxis()->SetTitle("Tube nr."); - - efficiency_dir->cd(); - histoType="EffiPerTube_ML"+ts(ML)+"_L"+ts(layer); - histoTitle = histoType+" "+histoTitPart2; - h = new TH1F(histoType.c_str(),histoTitle.c_str(),nbin,xmin,xmax); - h->GetXaxis()->SetTitle("Tube nr."); - h->SetMarkerStyle(20); - h->SetMarkerSize(1.0); - deadStatus_dir->cd(); - histoType="DeadTubes_ML"+ts(ML)+"_L"+ts(layer); - histoTitle = histoType+" "+histoTitPart2; - h = new TH1F(histoType.c_str(),histoTitle.c_str(),nbin,xmin,xmax); - h->GetXaxis()->SetTitle("Tube nr."); - noiseStatus_dir->cd(); - histoType="NoisePerTube_ML"+ts(ML)+"_L"+ts(layer); - histoTitle = histoType+" "+histoTitPart2; - h = new TH1F(histoType.c_str(),histoTitle.c_str(),nbin,xmin,xmax); - h->GetXaxis()->SetTitle("Tube nr."); - } - } - - /////////////////////////////////////////////////////////////////////// -} - - -void HistogramManager::setChamberCutOut(std::string chamber, TH1F * href ) { - //find the 'setBinContent' vector corresponding to the chamber name - auto pvecPair = string2Vec.find(chamber); - if (pvecPair != string2Vec.end()){ - for(const auto & i:pvecPair->second) - href->SetBinContent(i,0); - } //if not found, do nothing. -} - -void HistogramManager::setChamberDisconnectedTubes(std::string chamber, TH1F * href ) { - auto pdisconnectedVectorOfPairs = disconnected.find(chamber); - if (pdisconnectedVectorOfPairs != disconnected.end()){ - for(const auto & thisPair:pdisconnectedVectorOfPairs->second){ - href->SetBinContent(thisPair.first,thisPair.second); - } - } - -} - - -int HistogramManager::GetTubeOffsetML1(std::string chamber){ - int tubeOffset=0; - if (chamber=="BIR1A11" ) tubeOffset=6; - if (chamber=="BIR1A15" ) tubeOffset=6; - if (chamber=="BIR4A11" ) tubeOffset=3; - if (chamber=="BIR4A15" ) tubeOffset=3; - if (chamber=="BIR1C11" ) tubeOffset=6; - if (chamber=="BIR1C15" ) tubeOffset=6; - if (chamber=="BIR4C11" ) tubeOffset=3; - if (chamber=="BIR4C15" ) tubeOffset=3; - return tubeOffset; -} - -int HistogramManager::GetTubeOffsetAtEndML1(std::string chamber){ - int tubeOffset=0; - if (chamber.substr(0,4)=="BMS4") tubeOffset=8; - if (chamber.substr(0,4)=="BMS6") tubeOffset=8; - if (chamber=="BIR2A11" ) tubeOffset=3; - if (chamber=="BIR2A15" ) tubeOffset=3; - if (chamber=="BIR5A11" ) tubeOffset=3; - if (chamber=="BIR5A15" ) tubeOffset=3; - if (chamber=="BIR2C11" ) tubeOffset=3; - if (chamber=="BIR2C15" ) tubeOffset=3; - if (chamber=="BIR5C11" ) tubeOffset=3; - if (chamber=="BIR5C15" ) tubeOffset=3; - return tubeOffset; -} - -////////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////// -TObject * HistogramManager::GetMdtHisto(std::string histo_name) { - TObject * h = NULL; - std::string dir_name=GetMdtDirectoryName(); - TDirectory* dir = m_rootfile->GetDirectory(dir_name.c_str()); - if(dir) h = dir->FindObjectAny(histo_name.c_str()); - return h; -} -TObject * HistogramManager::GetMdtHisto(std::string histo_name, std::string region, std::string side) { - TObject * h = NULL; - std::string dir_name=GetMdtDirectoryName(region, side); - TDirectory* dir = m_rootfile->GetDirectory(dir_name.c_str()); - if(dir) h = dir->FindObjectAny(histo_name.c_str()); - return h; -} -TObject * HistogramManager::GetMdtHisto(std::string histo_name,std::string region, std::string side, int sector) { - TObject * h = NULL; - - std::string dir_name=GetMdtDirectoryName(region,side,sector); - dir_name+="/OVERVIEW"; - TDirectory* dir = m_rootfile->GetDirectory(dir_name.c_str()); - if(dir) h = dir->FindObjectAny(histo_name.c_str()); - return h; -} - -TObject * HistogramManager::GetMdtHisto(std::string histo_name, MDTName chamb) { - - - TObject * h = NULL; - std::string dir_name=GetMdtDirectoryName(chamb); - - if(histo_name.substr(0,14)=="HitsPerTube_ML"){ - dir_name += "/Occupancy"; - } - if(histo_name.substr(0,18)=="ActivityPerTube_ML"){ - dir_name += "/DeadStatus"; - } - if(histo_name.substr(0,15)=="NoisePerTube_ML"){ - dir_name += "/NoiseStatus"; - } - if(histo_name.substr(0,14)=="EffiPerTube_ML"){ - dir_name=dir_name+"/Efficiency"; - } - if(histo_name=="EffiResidVsRadius"){ - dir_name=dir_name+"/Expert"; - } - TDirectory* dir = m_rootfile->GetDirectory(dir_name.c_str()); - if(dir) h = dir->FindObjectAny(histo_name.c_str()); - return h; -} - -std::string HistogramManager::GetMdtDirectoryName() { - std::string Mdt_dirName="/MDT"; - return Mdt_dirName; -} - -std::string HistogramManager::GetMdtDirectoryName(std::string region, std::string side) { - std::string Mdt_dirName="/MDT/"+region+"_"+side; - return Mdt_dirName; -} - -std::string HistogramManager::GetMdtDirectoryName(std::string region, std::string side, int sector) { - ToString ts; - std::string sectorString=ts(sector); - if(sector<10) sectorString="0"+sectorString; - std::string Mdt_dirName="/MDT/"+region+"_"+side+"/Sector"+sectorString; - return Mdt_dirName; -} - -std::string HistogramManager::GetMdtDirectoryName(std::string region, std::string side, int sector, std::string chamberType, int eta) { - ToString ts; - std::string sectorString=ts(sector); - if(sector<10) sectorString="0"+sectorString; - std::string chamberName = chamberType+ts(eta)+side+sectorString; - std::string Mdt_dirName="/MDT/"+region+"_"+side+"/Sector"+sectorString+"/"+chamberName; - return Mdt_dirName; -} - -std::string HistogramManager::GetMdtDirectoryName(MDTName chamb) { - - int sector=chamb.getOnlineSector(); - ToString ts; - std::string sectorString=ts(sector); - if(sector<10) sectorString="0"+sectorString; - std::string Mdt_dirName="/MDT/"+chamb.getRegion()+"_"+chamb.getSide()+"/Sector"+sectorString+"/"+chamb.getOnlineName(); - return Mdt_dirName; - -} - -TObject * HistogramManager::GetTDaqHisto(std::string histo_name, std::string region) { - TObject * h = NULL; - std::string dir_name=GetTDaqDirectoryName(region); - TDirectory* dir = m_rootfile->GetDirectory(dir_name.c_str()); - if (dir) h = dir->FindObjectAny(histo_name.c_str()); - return h; -} -TObject * HistogramManager::GetTDaqHisto(std::string histo_name, std::string region, std::string side) { - TObject * h = NULL; - std::string dir_name=GetTDaqDirectoryName(region, side); - TDirectory* dir = m_rootfile->GetDirectory(dir_name.c_str()); - if (dir) h = dir->FindObjectAny(histo_name.c_str()); - return h; -} -TObject * HistogramManager::GetTDaqHisto(std::string histo_name, std::string region, std::string side, int sector) { - TObject * h = NULL; - std::string dir_name=GetTDaqDirectoryName(region, side,sector); - TDirectory* dir = m_rootfile->GetDirectory(dir_name.c_str()); - if (dir) h = dir->FindObjectAny(histo_name.c_str()); - return h; -} -TObject * HistogramManager::GetTDaqHisto(std::string histo_name, std::string region, std::string side, int sector, std::string chamberType, int eta) { - TObject * h = NULL; - std::string dir_name=GetTDaqDirectoryName(region,side,sector,chamberType,eta); - TDirectory* dir = m_rootfile->GetDirectory(dir_name.c_str()); - if (dir) h = dir->FindObjectAny(histo_name.c_str()); - return h; -} - -std::string HistogramManager::GetTDaqDirectoryName(std::string region) { - std::string TDaq_dirName="Undefined"; - if (region=="Barrel") TDaq_dirName="/MDTvsRPC"; - if (region=="Endcap") TDaq_dirName="/MDTvsTGC"; - return TDaq_dirName; -} - -std::string HistogramManager::GetTDaqDirectoryName(std::string region, std::string side) { - std::string TDaq_dirName="undefined"; - if (region=="Barrel") TDaq_dirName="/MDTvsRPC/"+region+"_"+side; - if (region=="Endcap") TDaq_dirName="/MDTvsTGC/"+region+"_"+side; - return TDaq_dirName; -} - -std::string HistogramManager::GetTDaqDirectoryName(std::string region, std::string side, int sector) { - ToString ts; - std::string sectorString=ts(sector); - if(sector<10) sectorString="0"+sectorString; - std::string TDaq_dirName="undefined"; - if (region=="Barrel") TDaq_dirName="/MDTvsRPC/"+region+"_"+side+"/Sector"+sectorString; - if (region=="Endcap") TDaq_dirName="/MDTvsTGC/"+region+"_"+side+"/Sector"+sectorString; - return TDaq_dirName; -} - -std::string HistogramManager::GetTDaqDirectoryName(std::string region, std::string side, int sector, std::string chamberType, int eta) { - ToString ts; - std::string sectorString=ts(sector); - if(sector<10) sectorString="0"+sectorString; - std::string chamberName = chamberType+ts(eta)+side+sectorString; - std::string TDaq_dirName="undefined"; - if (region=="Barrel") TDaq_dirName="/MDTvsRPC/"+region+"_"+side+"/Sector"+sectorString+"/"+chamberName; - if (region=="Endcap") TDaq_dirName="/MDTvsTGC/"+region+"_"+side+"/Sector"+sectorString+"/"+chamberName; - return TDaq_dirName; -} - -TObject * HistogramManager::GetHisto(std::string main_dir, std::string histo_name) { - TObject * h = NULL; - TDirectory* dir = m_rootfile->GetDirectory(main_dir.c_str()); - if(dir) h = dir->FindObjectAny(histo_name.c_str()); - return h; -} -//////////////////////////////////////////////////////////////////////////////// - -bool HistogramManager::openOutputFile(std::string outFileName) { - m_rootfile = new TFile(outFileName.c_str(),"recreate"); - if (!m_rootfile) { - return false; - } else { - return true; - } -} - -bool HistogramManager::openReadOnlyFile(std::string outFileName) { - m_rootfile = new TFile(outFileName.c_str(),"readonly"); - if (!m_rootfile) { - return false; - } else { - return true; - } -} - -bool HistogramManager::openUpdateFile(std::string outFileName) { - m_rootfile = new TFile(outFileName.c_str(),"update"); - if (!m_rootfile) { - return false; - } else { - return true; - } -} - -void HistogramManager::WriteAndCloseFile() { - // m_rootfile->Write(); - m_rootfile->Write("",TObject::kOverwrite); - m_rootfile->Close(); -} - -//////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// - -int HistogramManager::GetEtaMax(std::string /* region*/, std::string /*side*/, int /*sector*/, std::string /*chamberType*/) { - int etaMax = 6; - return etaMax; -} -//////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// -std::vector<MDTName> HistogramManager::GetChamberList(std::string region, std::string side, int sector) { - - //ToString ts; - std::vector<MDTName> chamberList; - - if ( m_mdtIdHelper ) { - MdtIdHelper::const_id_iterator it = m_mdtIdHelper->module_begin(); - MdtIdHelper::const_id_iterator it_end = m_mdtIdHelper->module_end(); - for(; it!=it_end;++it ) { - - if ( !m_mdtIdHelper->is_mdt(*it) ) continue; - int station_index = m_mdtIdHelper->stationName(*it); - std::string stationName = m_mdtIdHelper->stationNameString(station_index); - int phi_id = m_mdtIdHelper->stationPhi(*it); - int eta_id = m_mdtIdHelper->stationEta(*it); - - MDTName chamber(stationName,phi_id,eta_id); - - if(chamber.getRegion()!=region) continue; - if(chamber.getOnlineSector()!=sector) continue; - if(chamber.getSide()!=side) continue; - - //Problem with BML in sector13, it should be automatically treated by MDTName, but it gives some problem - //only here, I don't know why. This line should resolve it, check if it shows in other part of the code - //It seems like the problem is in MdtIdHelper however. - - if((chamber.getName()=="BML")&&(chamber.getOnlineEta()==7)) continue; - - chamberList.push_back(chamber); - - } // loop over MdtID_iterator - } // if m_MdtHelper - - return chamberList; -} -//////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// -int HistogramManager::GetChamberNumOfML (std::string chamberName){ - int numOfML=0; - const int numParams=10; - int chamberGeo[numParams]; - for (int i=0;i<=9;i++) chamberGeo[i]=0; - ReadChamberMapFile(chamberName,chamberGeo,numParams); - numOfML=chamberGeo[0]; - return numOfML; -} -int HistogramManager::GetChamberNumOfMezzPerML (std::string chamberName){ - int numOfMezzPerML=0; - const int numParams=10; - int chamberGeo[numParams]; - for (int i=0;i<=9;i++) chamberGeo[i]=0; - ReadChamberMapFile(chamberName,chamberGeo,numParams); - numOfMezzPerML=chamberGeo[1]; - return numOfMezzPerML; -} -int HistogramManager::GetChamberTubesPerMezz (std::string chamberName){ - int numOfTubesPerMezz=0; - const int numParams=10; - int chamberGeo[numParams]; - for (int i=0;i<=9;i++) chamberGeo[i]=0; - ReadChamberMapFile(chamberName,chamberGeo,numParams); - numOfTubesPerMezz=chamberGeo[2]; - return numOfTubesPerMezz; -} - -void HistogramManager::ReadChamberMapFile(std::string chamberName, int * chamberGeoParams, int numParams) { - - for (int i=0; i<numParams; i++) chamberGeoParams[i]=0; - std::string s; - std::ifstream inf("ChambersLayout.txt"); - - if(!inf.good()){ - return; - } - - // scanning of map file - while(getline(inf,s)){ - - // bool test=false; - std::string name, tag; - std::istringstream is(s); - is>>tag; - - if(tag=="name"){ //scan chamber block - - if(!(is>>name).good()){//1. take the name - break; - } - - /* - Check if any chamber on the mapfile is a chamber to test; - it's the best way to scan the mapfile just one time. - */ - - if(name!=chamberName){ - //if what I find in file is NOT a chamber to be tested - continue; - } else { //3. read full information - unsigned int ReadInfo=0; - - for(int i=0;i<20;i++){ - //chamber block is supposed to be shorter than 20 lines - - if(!getline(inf,s).good()){ - continue; - } - if(s.c_str()[0]=='#') { - continue; - } - if(s=="END_CHAMBER") { - break; //out of "for" over 20 lines - } - - std::istringstream is(s); - is>>tag; - - if (tag=="MLayers"){ - if (!(is>>chamberGeoParams[0]).good()) { - break; - } - ReadInfo++; - } - - if(tag=="MezzPerML"){ - if (!(is>>chamberGeoParams[1]).good()) { - break; - } - ReadInfo++; - } - - if(tag=="MezzTypeML1"){ - int mezzType=0; - int tubesPerMezz=0; - is>>mezzType; - if (mezzType<1 || mezzType>4) { - break; - } - if (mezzType==1 || mezzType==2) tubesPerMezz=8; - if (mezzType==3 || mezzType==4) tubesPerMezz=6; - chamberGeoParams[2]=tubesPerMezz; - ReadInfo++; - } - - if(tag=="MezzTypeML2"){ - ReadInfo++; - } - - if(tag=="IncreaseWithZ"){ - ReadInfo++; - } - - if(tag=="ZeroMezzML"){ - ReadInfo++; - break; //out of "for" over 20 lines - } - - }// end for over 20 lines - - break; //out of "for" loop on ChambList - }// else if(name...) - - }// end if tag=name - - } // end while - - return; -} diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/src/MDTDeadElementsAnalysis.cxx b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/src/MDTDeadElementsAnalysis.cxx deleted file mode 100644 index 91e7313c5f4717f4495d7f3913d685fb1440d1e6..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/src/MDTDeadElementsAnalysis.cxx +++ /dev/null @@ -1,2229 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -#include "MuonCalibStandAloneExtraTools/MDTDeadElementsAnalysis.h" -#include "GaudiKernel/MsgStream.h" -#include "AthenaKernel/getMessageSvc.h" - -#include <cmath> -#include <fstream> -#include <sstream> -#include <iostream> -#include <TH1F.h> -#include <TH2F.h> -#include <TF1.h> -#include <TFile.h> -#include <TKey.h> -#include <TCanvas.h> -#include <TStyle.h> - -class ToString { -public: - template< class T > - std::string operator()( const T &i ) { - std::ostringstream os; - os << i; - return os.str(); - } -}; - -MDTDeadElementsAnalysis::MDTDeadElementsAnalysis() : - polfunc(NULL), deadTubesMap(NULL), geo(NULL), ndeadmezz(-1), ndeadtubes(-1), - deadMezzDone(false), deadTubesDone(false), deadMultilayerDone(false), - nlayers(-1), nlayers_per_ml(-1), ntubes_per_mezz(-1), chi2poly(-1.), - average_entry(-1.), n_entry(-1.), nholes(-1) { - verbose=false; - drawPlots=false; - writeResultsToAsciFile=false; -} - -// ============================================================================== -// -// MDTDeadElementsAnalysis::histogramScanCalibCenters -// -// ============================================================================== - -void MDTDeadElementsAnalysis::histogramScanCalibCenters(TFile *rootfile) { - - int nregionsanalysed=0; - int nsectorsanalysed=0; - - if(rootfile->IsZombie()) { - return; - } - - int n_processed_chambers=0; - - std::string sector; - std::string chamber; - - TH1F* hadccut; - TH1F* hgeom; - TH1F* hdeadmap; - TH2F* hdeadchannels; - TH2F* hsummary; - - for (int iregion=1; iregion<=4; iregion++) { - std::string region_name; - if (iregion==1) region_name="Barrel_A"; - if (iregion==2) region_name="Barrel_C"; - if (iregion==3) region_name="Endcap_A"; - if (iregion==4) region_name="Endcap_C"; - std::string regiondir_name="/MDT/"+region_name; - - TDirectory* regiondir=(TDirectory*)rootfile->Get(regiondir_name.c_str()); - if(!regiondir) { - continue; - } - - hsummary = (TH2F*) regiondir->Get("DeadElements"); - if(hsummary) hsummary->Reset(); - - nregionsanalysed++; - - for (int isector=1; isector<=16; isector++) { - - TString sector_name=(isector<10)?("Sector0"):("Sector"); - sector_name+=isector; - TDirectory* sectordir=(TDirectory*)regiondir->Get((const char*)sector_name); - - nsectorsanalysed++; - - TIter next(sectordir->GetListOfKeys()); - TKey *key; - while ( (key = (TKey*)next()) ) { - std::string chamber_name=key->GetName(); - if (chamber_name=="OVERVIEW") continue; - - TDirectory* chamberdir=(TDirectory*)sectordir->Get(chamber_name.c_str()); - TDirectory* deadstatusdir=(TDirectory*)sectordir->Get((chamber_name+"/DeadStatus").c_str()); - TDirectory* expertdir=(TDirectory*)sectordir->Get((chamber_name+"/Expert").c_str()); - - if(!chamberdir) { - continue; - } - - if(!deadstatusdir) { - continue; - } - - if(!expertdir) { - continue; - } - - hadccut = (TH1F*) chamberdir->Get("a_HitsPerTubeAdcCut"); - hgeom = (TH1F*) expertdir->Get("DeadTubeRefMap"); - hdeadmap = (TH1F*) expertdir->Get("DeadTubeMap"); - - // RESET hdeadmap and make it a copy of hgeom : - // - int nbinshref=hgeom->GetNbinsX(); - int nbinshres=hdeadmap->GetNbinsX(); - if (nbinshref!=nbinshres) { - continue; - } - hdeadmap->Reset(); - for (int bin=1;bin<=nbinshref;bin++){ - hdeadmap->SetBinContent(bin,hgeom->GetBinContent(bin)); - } - - // Clone a_HitsPerTubeAdcCut - // - TH1F *HhitsCopy = (TH1F*)hadccut->Clone(); - getBasicGeometry(hgeom,chamber_name); - deadElementsAnalysis(HhitsCopy,hgeom,hdeadmap,4,chamber_name); - - HhitsCopy->Delete(); - n_processed_chambers++; - - // report here the results in the 2D chamber view histogram: - TH1F *hdeadtubestatus=(TH1F*)chamberdir->FindObjectAny("b_DeadTubeStatus"); - if(hdeadtubestatus) hdeadtubestatus->Reset(); - - TH2F *hdeadtubes=(TH2F*) deadstatusdir->FindObjectAny("ChamberDeadTubes"); - hdeadtubes->Reset(); - - hdeadchannels = (TH2F*) expertdir->Get("ChamberDeadChannels"); - - hdeadchannels->Reset(); - hdeadchannels->SetMinimum(0); - hdeadchannels->SetMaximum(10); - int totBins = hdeadmap->GetNbinsX(); - - std::vector<int> ntubes_per_layer; - for(int j=1; j<=2;j++){ - ntubes_per_layer.push_back(nbins_per_layer[j-1]); - } - - if( chamber_name =="BIR1A11") ntubes_per_layer[0] = 30; - if( chamber_name =="BIR4A11") ntubes_per_layer[0] = 30; - if( chamber_name =="BIR1A15") ntubes_per_layer[0] = 30; - if( chamber_name =="BIR4A15") ntubes_per_layer[0] = 30; - - - for(int jML=1; jML<=2;jML++){ - - for(int jLay=1; jLay<=nlayers_per_ml;jLay++){ - - TString deadlayername="DeadTubes_ML"; - deadlayername+=jML; - deadlayername+="_L"; - deadlayername+=jLay; - - TH1F *hdeadperlayer =(TH1F*)deadstatusdir->FindObjectAny((const char*)deadlayername); - if(hdeadperlayer) hdeadperlayer->Reset(); - - - int bincounter=0; - - // for(int jbin=1; jbin<=nbins_per_layer[jML-1];jbin++){ - for(int jbin=1; jbin<=ntubes_per_layer[jML-1];jbin++){ - - int alltubes = (jML-1)*(nlayers_per_ml)*(ntubes_per_layer[jML-1]) + (jLay-1)*(ntubes_per_layer[jML-1])+jbin; - - int ires = (int)hdeadmap->GetBinContent(alltubes); - - if (ires==0) continue; -// int iML = 1; -// if (ires>0) iML = 2; -// int iLy = (jbin-1)/(int)ntubes_per_layer[jML-1] + 1; -// if (iML==2) iLy = iLy+1; -// int iTube = (jbin-1)%ntubes_per_layer[jML-1] + 1; - int icode = ires%10; - - if (icode<0) icode=-icode; - if (icode==0) icode=10; - - double contr=0; - - if(icode==0){ - } else if(icode==10){ - contr=1; - } else if(icode==7 ){ - } else{ - } - double contr2=contr; - if(icode!=0 && contr==0) contr2=0.1; - - bincounter++; - if(hdeadperlayer) hdeadperlayer->SetBinContent(bincounter,contr2); - } - } - } - - for (int bin=1;bin<=totBins;bin++){ - int ires = (int)hdeadmap->GetBinContent(bin); - if (ires==0) continue; - int iML = 1; - if (ires>0) iML = 2; - // int iLy = (bin-1)/(int)nbins_per_layer[iML-1] + 1; - int iLy = (bin-1)/(int)ntubes_per_layer[iML-1] + 1; - if (iML==2) iLy = iLy+1; - // int iTube = (bin-1)%nbins_per_layer[iML-1] + 1; - int iTube = (bin-1)%ntubes_per_layer[iML-1] + 1; - int icode = ires%10; - - if (icode<0) icode=-icode; - if (icode==0) icode=10; - hdeadchannels->SetBinContent(iTube,iLy,(float)icode); - - int Lay_offset = 0; - if(nlayers_per_ml ==3) Lay_offset = 1; - iLy = iLy + Lay_offset; - - double contr=0; - - if(icode==0){ - hdeadtubes->SetBinContent(iTube,iLy,1); //white - } else if(icode==10){ - contr=1; - hdeadtubes->SetBinContent(iTube,iLy,2); //green - } else if(icode==7 ){ - hdeadtubes->SetBinContent(iTube,iLy,3); // yellow - } else { - hdeadtubes->SetBinContent(iTube,iLy,4); // red - } - double contr2=contr; - if(icode!=0 && contr==0) contr2=0.1; - - if(hdeadtubestatus) hdeadtubestatus->SetBinContent(bin,contr2); - - } - - if (hsummary){ - hsummary->Fill(isector,2, (float) deadChamber.size() ); - hsummary->Fill(isector,3, (float) deadMultilayer.size() ); - hsummary->Fill(isector,4, (float) deadLayer.size() ); - hsummary->Fill(isector,5, (float) deadMezz.size() ); - hsummary->Fill(isector,6, (float) deadTube.size() ); - } - } // end loop on chambers - } // end loop over sectors - } // end loop over regions BA/BC/EA/EC -} //end MDTDeadElementsAnalysis::histogramScanCalibCenters - -// ============================================================================== -// -// MDTDeadElementsAnalysis::histogramScanGnam -// -// ============================================================================== - -void MDTDeadElementsAnalysis::histogramScanGnam(std::string rootfile){ - - TFile f(rootfile.c_str()); - - if(f.IsZombie()) { - return; - } - - MDTDeadElementsAnalysis *mdtTubeAna = new MDTDeadElementsAnalysis; - - f.cd("MDT"); - TDirectory *dir = gDirectory; - TIter next(dir->GetListOfKeys()); - TKey *key; - int n_processed_chambers=0; - - while ((key=(TKey*)next())) { - TString chambname=key->GetName(); - if(chambname!="Overview"){ - TString path1 = "BARREL_A" + chambname + "/HitsPerTube_gt_100_ADC_counts"; - TString path2 = "DEBUG/MDT/" + chambname + "/HitsPerTube<AdcCut"; - n_processed_chambers++; - }//if !OVERVIEW - }//key while - - - mdtTubeAna->printSummary(); - - // --------- - f.Close(); - - delete mdtTubeAna; mdtTubeAna=0; - return; -} //end MDTDeadElementsAnalysis::histogramScanGnam - -// ============================================================================== -// -// MDTDeadElementsAnalysis::WriteAsciFile -// -// ============================================================================== -void MDTDeadElementsAnalysis::WriteAsciFile(){ - writeResultsToAsciFile = true; -} // WriteAsciFile - -// ============================================================================== -// -// MDTDeadElementsAnalysis::getChamberName() -// -// ============================================================================== -std::string MDTDeadElementsAnalysis::getChamberName(){ - return chamberName; -} // getChamberName - -// ============================================================================== -// -// MDTDeadElementsAnalysis::setChamberName(string chambname) -// -// ============================================================================== -void MDTDeadElementsAnalysis::setChamberName(std::string chambname){ - chamberName = chambname; -} // setChamberName - -// ============================================================================== -// -// MDTDeadElementsAnalysis::setVerbose -// -// ============================================================================== -void MDTDeadElementsAnalysis::setVerbose(){ - verbose = true; -} // setVerbose - -// ============================================================================== -// -// MDTDeadElementsAnalysis::setNoVerbose -// -// ============================================================================== -void MDTDeadElementsAnalysis::setNoVerbose(){ - verbose = false; -} // setNoVerbose - -// ============================================================================== -// -// MDTDeadElementsAnalysis::deadElementsAnalysis -// -// ============================================================================== -void MDTDeadElementsAnalysis::deadElementsAnalysis(TH1F *idh1, TH1F *HRef, TH1F *deadTubesMap, int /*nlayers_ml*/, std::string chambname) { - - getBasicGeometry(HRef,chambname); - // Initialization - - ClearList(); - int total_bins= (int) idh1->GetNbinsX(); - Clear(total_bins); - setChamberName(chambname); - // Processing - chamberName=chambname; - deadChambers(idh1,HRef, deadTubesMap, chambname); - if (deadChamber.size()==0) deadMultilayers(idh1,HRef, deadTubesMap, chambname); - if (deadChamber.size()==0) deadLayers(idh1,HRef, deadTubesMap, chambname); - if (deadChamber.size()==0) deadMezzanines(idh1,HRef, deadTubesMap, chambname); - if (deadChamber.size()==0) deadTubes(idh1,HRef, deadTubesMap, chambname); - - // Finalize - if(verbose) { - printSummary(); - if (drawPlots) { - TCanvas *c1 = new TCanvas(); - c1->cd(); - deadTubesMap->Draw(); - } - } - if (writeResultsToAsciFile){ - printCompactSummaryToAsciFile(); - } - - return; -}// deadElementsAnalysis - -// ============================================================================== -// -// MDTDeadElementsAnalysis::deadElementsAnalysis -// -// ============================================================================== -void MDTDeadElementsAnalysis::deadElementsAnalysis(TH1F* idh1, TH1F* HRef, TH1F* deadTubesMap, - int /*nlayers_ml*/, std::string chambname, int convert_mezzanine[20]){ - - getBasicGeometry(HRef,chambname); - // Initialization - ClearList(); - int total_bins= (int) idh1->GetNbinsX(); - Clear(total_bins); - setChamberName(chambname); - // Processing - chamberName=chambname; - deadChambers(idh1,HRef, deadTubesMap, chambname); - if (deadChamber.size()==0) deadMultilayers(idh1,HRef, deadTubesMap, chambname); - if (deadChamber.size()==0) deadLayers(idh1,HRef, deadTubesMap, chambname); - if (deadChamber.size()==0) deadMezzanines(idh1,HRef, deadTubesMap, chambname, convert_mezzanine); - if (deadChamber.size()==0) deadTubes(idh1,HRef, deadTubesMap, chambname); - - // Finalize - if(verbose) { - printSummary(); - if (drawPlots) { - TCanvas * c1 = new TCanvas(); - c1->cd(); - deadTubesMap->Draw(); - } - } - if (writeResultsToAsciFile){ - printSummaryToAsciFile(); - } - - return; -}// deadElementsAnalysis - -// ============================================================================== -// -// MDTDeadElementsAnalysis::deadChambers -// -// ============================================================================== -void MDTDeadElementsAnalysis::deadChambers(TH1F *idh1, TH1F */*HRef*/, TH1F */*deadTubesMap*/, std::string chambname){ - if (idh1->GetEntries() == 0.) deadChamber.push_back(chambname); -}// deadChambers - - -// ============================================================================== -// -// MDTDeadElementsAnalysis::deadLayers -// -// ============================================================================== -void MDTDeadElementsAnalysis::deadLayers(TH1F* idh1,TH1F* HRef, TH1F* deadTubesMap, std::string chambname){ - double layer_content[8]; - int layer_non_zero_bins[8]; - for(int ii=0; ii<8; ii++){ - layer_content[ii] = 0.; - layer_non_zero_bins[ii] = 0; - } - int binstart = 1; - int binend = nbins_per_layer[0]; - int indlayer=0; - for(int ml=1;ml<3;ml++){ - // protection if only 1 ml - if (nbins_per_layer[ml-1]==0) continue; - for(int l=1;l<=nlayers_per_ml;l++){ - layer_content[indlayer]=0.; - layer_non_zero_bins[indlayer-1]=0; - for(int bin=binstart;bin<=binend;bin++){ - double c=idh1->GetBinContent(bin); - layer_content[indlayer-1]=layer_content[indlayer-1]+c; - if(c>0.)layer_non_zero_bins[indlayer-1]++; - } - binstart=binstart+nbins_per_layer[0]; - binend=binend+nbins_per_layer[0]; - indlayer++; - } // loop layers of 1 ml - } // loop 2 multilayers - - // analysis now: 1) minimum & average - - int minimum_position=1; - int minimum_content=layer_non_zero_bins[0]; - double average_non_zero_bins=0.; - for(int l=1;l<indlayer-1;l++){ - if(layer_non_zero_bins[l-1]<minimum_content){ - minimum_position=l; - minimum_content=layer_non_zero_bins[l-1]; - } - average_non_zero_bins = average_non_zero_bins + - double(layer_non_zero_bins[l-1]); - } - average_non_zero_bins = average_non_zero_bins - minimum_content; - average_non_zero_bins = average_non_zero_bins / double(indlayer-1-1); - - // analysis 2) rms - - double rms_non_zero_bins=0.; - for(int l=1;l<indlayer;l++){ - if(l!=minimum_position){ - rms_non_zero_bins = std::pow(average_non_zero_bins - double(layer_non_zero_bins[l-1]),2) - + rms_non_zero_bins; - } - } - rms_non_zero_bins = std::pow(rms_non_zero_bins/double(indlayer-1),0.5); - if(rms_non_zero_bins<1.) rms_non_zero_bins=1.; - - // analysis 3) spot dead layer when average-3*rms/(layers-1)>content of minimum && rms!=1 - // analysys 4) average bin content < 20. - float average_bin_content = (float)layer_content[minimum_position-1]/(float)nbins_per_layer[0]; - bool test = average_non_zero_bins-8.*rms_non_zero_bins/std::pow(double(indlayer-1),0.5)>minimum_content - &&rms_non_zero_bins!=1.&&average_bin_content<10.; - if(test) { - int tubestart = (minimum_position-1)*nbins_per_layer[0]+1; - int tubeend = minimum_position*nbins_per_layer[0]; - deadLayer.push_back(minimum_position); - deadLayerChamber.push_back(chambname); - for(int j=tubestart;j<=tubeend;j++){ - Double_t cgeo = HRef->GetBinContent(j); - Double_t signML = cgeo/std::abs(cgeo); - int igeo = (int) cgeo; - Int_t refquantity = igeo%10; - if(std::abs(cgeo)!=0.&& refquantity == 0){ - deadTubesMap->Fill(j,4.*signML); - } - } - } - // verbose=false; -}// deadLayers - -// ============================================================================== -// -// MDTDeadElementsAnalysis::getBasicGeometry -// -// ============================================================================== - -void MDTDeadElementsAnalysis::getBasicGeometry(TH1F* HRef, int nlayers_ml, std::string chambname){ - int nbins=HRef->GetNbinsX(); - schamber = chambname; - chtype = schamber.substr(1,1); - nlayers_per_ml = nlayers_ml; - int firstbinML1=1; - int firstbinML2=10000; - int lastbinML1=-1; - int lastbinML2=-1; - for(int bin=1;bin<=nbins;bin++){ - float content = HRef->GetBinContent(bin); - if(content<0.) { - if(bin>lastbinML1) lastbinML1 = bin; - } - if(content>0.) { - if(bin<firstbinML2) firstbinML2 = bin; - if(bin>lastbinML2) lastbinML2 = bin; - } - } - - firstbinML[0]=firstbinML1; - firstbinML[1]=firstbinML2; - lastbinML[0]=lastbinML1; - lastbinML[1]=lastbinML2; - - nbins_per_layer[0] = (lastbinML[0]-firstbinML[0]+1)/nlayers_ml; - nbins_per_layer[1] = (lastbinML[1]-firstbinML[1]+1)/nlayers_ml; - ntubes_per_mezz=6; - if(chtype=="O" || chtype=="M") { - nlayers=6; - ntubes_per_mezz=8; - } - for(int MultiLayer=0;MultiLayer<2;MultiLayer++){ - nmezz[MultiLayer]=nbins_per_layer[MultiLayer]/ntubes_per_mezz; - // Algos parameters - ntubes[MultiLayer]=15; - tstep[MultiLayer]=5.; - if(nbins_per_layer[MultiLayer]==36){ - ntubes[MultiLayer]=18; - tstep[MultiLayer]=6.; - } - if(nbins_per_layer[MultiLayer]==72){ - ntubes[MultiLayer]=12; - tstep[MultiLayer]=6.; - } - if(nbins_per_layer[MultiLayer]==64){ - ntubes[MultiLayer]=16; - tstep[MultiLayer]=8.; - } - if(nbins_per_layer[MultiLayer]==48){ - ntubes[MultiLayer]=16; - tstep[MultiLayer]=8.; - } - if(nbins_per_layer[MultiLayer]==56){ - ntubes[MultiLayer]=14; - tstep[MultiLayer]=7.; - } - } -} // getBasicGeometry - - // ============================================================================== - // - // MDTDeadElementsAnalysis::getBasicGeometry - // - // ============================================================================== - -void MDTDeadElementsAnalysis::getBasicGeometry(TH1F* HRef, std::string chambname){ - int nbins=HRef->GetNbinsX(); - schamber = chambname; - chtype = schamber.substr(1,1); - int firstbinML1=10000; - int firstbinML2=10000; - int lastbinML1=-1; - int lastbinML2=-1; - int nlayers_ml1=0; - int nlayers_ml2=0; - for(int bin=1;bin<=nbins;bin++){ - float content = HRef->GetBinContent(bin); - if(content<0.) { - float f_level=std::abs(content)/10.; - int i_level= (int) f_level; - if(i_level==(int) f_level && i_level>nlayers_ml1) { - nlayers_ml1=i_level; - } - if(i_level<(int) f_level && i_level+1>nlayers_ml1) { - nlayers_ml1=i_level+1; - } - if(bin<firstbinML1) firstbinML1 = bin; - if(bin>lastbinML1) lastbinML1 = bin; - } - if(content>0.) { - float f_level=std::abs(content)/10.; - int i_level= (int) f_level; - if(i_level==(int) f_level && i_level>nlayers_ml2) { - nlayers_ml2=i_level; - } - if(i_level<(int) f_level && i_level+1>nlayers_ml2) { - nlayers_ml2=i_level+1; - } - if(bin<firstbinML2) firstbinML2 = bin; - if(bin>lastbinML2) lastbinML2 = bin; - } - } - if(nlayers_ml1>0&&nlayers_ml2>0){ - // two real multilayers - if(lastbinML1+1!=firstbinML2){ - // cut out multilayer - lastbinML1=nbins/2; - firstbinML2=lastbinML1+1; - } - } - firstbinML[0]=firstbinML1; - firstbinML[1]=firstbinML2; - lastbinML[0]=lastbinML1; - lastbinML[1]=lastbinML2; - nbins_per_layer[0]=0; - nbins_per_layer[1]=0; - if(nlayers_ml1>0){ - nbins_per_layer[0] = (lastbinML[0]-firstbinML[0]+1)/nlayers_ml1; - } - if(nlayers_ml2>0){ - nbins_per_layer[1] = (lastbinML[1]-firstbinML[1]+1)/nlayers_ml2; - } - ntubes_per_mezz=6; - nlayers_per_ml=nlayers_ml1; - if(chtype=="O" || chtype=="M") { - nlayers=6; - ntubes_per_mezz=8; - } - for(int MultiLayer=0;MultiLayer<2;MultiLayer++){ - nmezz[MultiLayer]=nbins_per_layer[MultiLayer]/ntubes_per_mezz; - // Algos parameters - ntubes[MultiLayer]=15; - tstep[MultiLayer]=5.; - if(nbins_per_layer[MultiLayer]==36){ - ntubes[MultiLayer]=18; - tstep[MultiLayer]=6.; - } - if(nbins_per_layer[MultiLayer]==72){ - ntubes[MultiLayer]=12; - tstep[MultiLayer]=6.; - } - if(nbins_per_layer[MultiLayer]==64){ - ntubes[MultiLayer]=16; - tstep[MultiLayer]=8.; - } - if(nbins_per_layer[MultiLayer]==56){ - ntubes[MultiLayer]=14; - tstep[MultiLayer]=7.; - } - } - -} // getBasicGeometry - - // ============================================================================== - // - // MDTDeadElementsAnalysis::printSummary - // - // ============================================================================== - -void MDTDeadElementsAnalysis::printSummary(){ - -}// printSummary -// ============================================================================== -// -// MDTDeadElementsAnalysis::printSummaryToAsciFile -// -// ============================================================================== - -void MDTDeadElementsAnalysis::printSummaryToAsciFile(){ - std::ofstream deadAna; - deadAna.open("deadana.dat",std::ios::app); - - unsigned im=0; - if(noisyChamber.size()+deadMultilayer.size()+deadLayer.size()+deadMezz.size()+deadTube.size()>0) - deadAna<<"Examine chamber "<<chamberName<<std::endl; - - if(noisyChamber.size()>0){ - deadAna<<"number of noisy chambers "<<noisyChamber.size()<<std::endl; - for(im=0;im<noisyChamber.size();im++){ - deadAna<<" "<<noisyChamber[im]<<std::endl; - } - } - - if(deadMultilayer.size()>0){ - deadAna<<"number of dead MultiLayers "<<deadMultilayer.size()<<std::endl; - for(im=0;im<deadMultilayer.size();im++){ - deadAna<<" dead MultiLayer "<<deadMultilayer[im]<<" found in chamber "<<deadMLChamber[im]<<std::endl; - } - } - - if(deadLayer.size()>0){ - deadAna<<"number of dead Layers "<<deadLayer.size()<<std::endl; - for(im=0;im<deadLayer.size();im++){ - deadAna<<" dead Layer "<<deadLayer[im]<<" found in chamber "<<deadLayerChamber[im]<<std::endl; - } - } - - if(deadMezz.size()>0){ - deadAna<<"number of dead mezz "<<deadMezz.size()<<std::endl; - for(im=0;im<deadMezz.size();im++){ - deadAna <<" chamber "<<deadMezzChamber[im]<<" mezzanine "<<deadMezz[im]<< - " reduced numbering mezzanine "<<deadMezz_red[im]<< - " csm mezzanine "<<deadMezz_csm[im]<< - " dead in layer "<<deadMezzML[im]<<std::endl; - } - } - - if(deadTube.size()>0){ - deadAna<<"number of dead tubes "<<deadTube.size()<<std::endl; - for(im=0;im<deadTube.size();im++){ - deadAna<<" "<<deadTubeChamber[im]<<" "<<deadTube[im]<<" "<<deadTubeML[im]<<" "<<deadTubeLay[im]<<std::endl; - } - } - -}// printSummaryToAsciFile - -// ============================================================================== -// -// MDTDeadElementsAnalysis::printCompactSummaryToAsciFile -// -// ============================================================================== - - -void MDTDeadElementsAnalysis::printCompactSummaryToAsciFile(){ - - std::ofstream deadAna; - deadAna.open("deadana.dat",std::ios::app); - - unsigned im=0; - - if(deadChamber.size()>0){ - deadAna<<chamberName<< " dead_CHAMBER "<<std::endl; - } - - if(deadMultilayer.size()>0){ - for(im=0;im<deadMultilayer.size();im++){ - deadAna<<deadMLChamber[im]<< " dead_MULTILAYER "<<deadMultilayer[im]<<std::endl; - } - } - - if(deadLayer.size()>0){ - for(im=0;im<deadLayer.size();im++){ - int lay=deadLayer[im]; - int ml=1; - if (lay>nlayers_per_ml) { - lay=lay-nlayers_per_ml; - ml=2; - } - deadAna<<deadLayerChamber[im]<< " dead_LAYER "<<ml<<" "<<lay<<std::endl; - } - } - - if(deadMezz.size()>0){ - for(im=0;im<deadMezz.size();im++){ - deadAna <<deadMezzChamber[im]<<" dead_MEZZANINE "<<deadMezz[im]<< - " reduced numbering mezzanine "<<deadMezz_red[im]<< - " csm mezzanine "<<deadMezz_csm[im]<< - " dead in MultiLayer "<<deadMezzML[im]<<std::endl; - } - } - - if(deadTube.size()>0){ - for(im=0;im<deadTube.size();im++){ - deadAna<<deadTubeChamber[im]<<" dead_TUBE "<<deadTubeML[im]<<" "<<deadTubeLay[im]<<" "<<deadTube[im]<<std::endl; - } - } - -}// printCompactSummaryToAsciFile -// ============================================================================== -// -// MDTDeadElementsAnalysis::NoisyChamber -// -// ============================================================================== - -bool MDTDeadElementsAnalysis::NoisyChamber(TH1F* idh1, std::string chambname){ - - double binsbelow2=0; - double binsabove1=0; - int nbins=idh1->GetNbinsX(); - int Entries=0; - for(int bin=1;bin<=nbins;bin++){ - Entries = Entries + (int) idh1->GetBinContent(bin); - } - double bins = (double) nbins; - for (int nb=1;nb<=nbins;nb++){ - if (idh1->GetBinContent(nb)<2.) { - binsbelow2++; - } else { - binsabove1++; - } - } - - double ratio=0.; - - if (Entries>0) { - ratio= binsbelow2 / bins;} - bool Noise=false; - if (ratio>0.5) { - Noise=true; - noisyChamber.push_back(chambname); - } - - return Noise; - -}// NoisyChamber - -// ============================================================================== -// -// MDTDeadElementsAnalysis::ClearList -// -// ============================================================================== - -void MDTDeadElementsAnalysis::ClearList(){ - - noisyChamber.clear(); - deadChamber.clear(); - deadLayer.clear(); - deadLayerChamber.clear(); - deadMLChamber.clear(); - deadMLCounts.clear(); - deadMLLevel.clear(); - deadMultilayer.clear(); - deadMezzChamber.clear(); - deadMezz.clear(); - deadMezzML.clear(); - deadMezz_csm.clear(); - deadMezz_red.clear(); - deadMezzEffi.clear(); - deadMezzErrEffi.clear(); - deadMezzChi2.clear(); - deadTube.clear(); - deadTubeId.clear(); - deadTubeHistoBin.clear(); - deadTubeChamber.clear(); - deadTubeLay.clear(); - deadTubeML.clear(); - deadTubeChi2.clear(); - deadTubeEffi.clear(); - deadTubeErrEffi.clear(); - -} // ClearList - - // ============================================================================== - // - // MDTDeadElementsAnalysis::Clear - // - // ============================================================================== - -void MDTDeadElementsAnalysis::Clear(int ntubes){ - - chamberName="NULL"; - deadMezzDone=false; - deadTubesDone=false; - ndeadmezz=0; - for(int i=0;i<nmmax;i++){ - deadmezz[i]=0; - deadmezzMLay[i]=0; - } - ndeadtubes=0; - if(ntubes>ntmax || ntubes<0) ntubes=ntmax; - for (int i=0;i<ntubes;i++){ - deadtube[i]=0; - deadtubeseed[i]=0.; - deadtubelen[i]=0.; - deadtubeLay[i]=0; - deadtubeML[i]=0; - deadtubechi2[i]=0; - deadtubeeffi[i]=0; - deadtubeerr[i]=0; - for(int j=0;j<3;j++) deadtubestat[i][j]=0; - } - -}// Clear - -// ============================================================================== -// -// MDTDeadElementsAnalysis::deadTubes -// -// ============================================================================== - -void MDTDeadElementsAnalysis::deadTubes(TH1F* idh, TH1F* HRef, TH1F* deadTubesMap, std::string chambname){ - - std::string codepart="MDTDeadElementsAnalysis"; - std::string option="Q"; - - TH1F * idh1 = (TH1F*)idh->Clone(); - - int tottubes= (int) idh1->GetNbinsX(); - for (int nb=1;nb<=tottubes;nb++){ - if(idh1->GetBinContent(nb)==0.) { - // test test test - float cref=HRef->GetBinContent(nb); - if(cref!=0.) { - idh1->SetBinError(nb,2.3); - } - } - } - - MDTDeadElementsAnalysis::deadTubesDone=true; - - int nbins=idh1->GetNbinsX(); - int Entries=0; - for(int bin=1;bin<=nbins;bin++){ - Entries = Entries + (int) idh1->GetBinContent(bin); - } - float averageEntries = float(Entries) / float(nbins); - if(Entries>4000 || averageEntries > 10.){ - - double chi2cut=30.; - if(Entries>50000.) { - chi2cut=60.; - } - - std::vector<double> parf(7, 0.0); - polfunc = new TF1("fit0",polnml3,1.,(double)2.*ntubes[0],4); - TF1 *fitfunc = new TF1("fit1",completefunc,1.,(double)2.*ntubes[0],7); - - // loop over ML's - for(int ML=0;ML<2;ML++){ - if (nbins_per_layer[ML]==0) continue; - /* - Make sure not to loop over a dead ML - */ - bool MLdead = false; - for(unsigned int im=0;im<deadMultilayer.size();im++){ - if(deadMultilayer[im]==ML+1) MLdead = true; - } - if(MLdead) { - break; - } - double tubestart=1.+ML*(firstbinML[1]-1); - fitfunc->SetParameters(-51.,180.,-10.,0.,9.,1.,0.5); - - for (int nlay=1; nlay<=nlayers_per_ml;nlay++){ - double tube0 = (nlay-1)*nbins_per_layer[ML]+1+ML*nbins_per_layer[1]*nlayers_per_ml; - double tube1 = tube0 + nbins_per_layer[ML]-1; - - for (tubestart = tube0; tubestart <=tube1-ntubes[ML]+1; tubestart=tubestart+tstep[ML]) { - // here the scan starts; you have a sliding fit interval which goes from - // t0start to t0start + ntubes[0] - - // if a polnml3 fit gives a good chi2 -> no dead tube - // - - option="Q"; - if(verbose) { - option=""; - } - if (verbose){ - idh1->SetMinimum(0.); - idh1->SetAxisRange(tubestart-2.5,tubestart+ntubes[ML]+1.5); - idh1->Fit(polfunc,option.c_str(),"",(double)tubestart,(double)tubestart+ntubes[ML]-1); - if (drawPlots) { - TCanvas *c1 = new TCanvas(); - c1->WaitPrimitive(); - int inutile; - std::cin>>inutile; - } - } else { - idh1->Fit(polfunc,option.c_str(),"",(double)tubestart,(double)tubestart+ntubes[ML]-1); - } - double chi2pol3=polfunc->GetChisquare(); - for (int n=0;n<=3;n++) polyparf[n]=polfunc->GetParameter(n); - if(chi2pol3<chi2cut) continue; - - double chi2min=99999999.; - double xbinmin; - int ibinmin = 0; - - average_entry=0.; - n_entry=0.; - - int firsttube = int (tubestart); - int mtubes = int(ntubes[ML]); - getSpikesInInterval(idh1,firsttube,firsttube+mtubes-1,polfunc); - getHolesInInterval(idh1,firsttube,firsttube+mtubes-1,mtubes, polfunc); - getHolesInInterval_strategy5(idh1,firsttube,firsttube+mtubes-1,mtubes, polfunc); - - std::string oldoption=option; - // setVerbose(); - if(average_entry==0) continue; - - double err[10]; - // remove all holes from the fit! - for(int nh=0;nh<nholes;nh++){ - // put error=0.-> bin does not count in fit - err[nh]=idh1->GetBinError(holes[nh]); - idh1->SetBinError(holes[nh],0.); - } - // loop over all holes ! - - for(int nh=0;nh<nholes;nh++){ - option="Q"; - if(verbose) { - option=""; - } - // stop analysis if eff_hole is > .4 - if(eff_hole[nh]>0.4) continue; - for(int i=0;i<4;i++){ - fitfunc->SetParameter(i,polyparf[i]); - } - ibinmin = holes[nh]; - xbinmin=idh1->GetBinCenter(ibinmin); - if(err[nh]>0.) idh1->SetBinError(ibinmin,err[nh]); - if(err[nh]==0.) idh1->SetBinError(ibinmin,2.3); - idh1->SetBinError(ibinmin,2.3); - fitfunc->SetParameter(6,1.); - fitfunc->SetParameter(4,xbinmin); - fitfunc->SetParameter(5,1.); - fitfunc->SetParLimits(4,0.,36.); - fitfunc->SetParLimits(6,-2.,2.); // TEST TEST - chi2min = 99999999999999.; - double lenmin; - double effimin; - double errmin; - double binminfit; - double len=1.; - // prepare complete fit - for(int ipar=0;ipar<4;ipar++){ - fitfunc->SetParameter(ipar,polyparf[ipar]); - } - fitfunc->SetParameter(4,xbinmin); - fitfunc->FixParameter(4,xbinmin); - fitfunc->SetParameter(5,len); - fitfunc->FixParameter(5,len); - fitfunc->SetParameter(6,eff_hole[nh]); - option = option+"B"; - idh1->Fit("fit1",option.c_str(),"",(double)tubestart-0.5,(double)tubestart+ntubes[0]-0.5); - if(verbose){ - idh1->SetMinimum(0.); - } - double chi2 = fitfunc->GetChisquare(); - double deltachi2=chi2pol3-chi2; - if((chi2<chi2cut&&fitfunc->GetParError(6)>.1)||deltachi2/chi2pol3>.3){ - option = option+"E"; // TEST TEST - if(average_entry<50.) option=option+"L"; - // if error on hole efficiency if > 5% refine fit using option 'E' - - if(verbose){ - idh1->Fit("fit1",option.c_str(),"",(double)tubestart-0.5,(double)tubestart+ntubes[ML]-0.5); - } else { - idh1->Fit("fit1",option.c_str(),"",(double)tubestart-0.5,(double)tubestart+ntubes[ML]-0.5); - } - option = oldoption; - } - - chi2min=chi2; - if(average_entry<50.) chi2min=-chi2min; - lenmin=len; - effimin=fitfunc->GetParameter(6); - errmin=fitfunc->GetParError(6); - binminfit=fitfunc->GetParameter(4); - - // the command below (->Wait) is very usefull - // corresponds to the 'wait' of PAW - - if(verbose&&effimin<0.9){ - idh1->SetAxisRange(tubestart-2.5,tubestart+ntubes[ML]+1.5); - if (drawPlots) { - TCanvas *c1 = new TCanvas(); - idh1->Draw(); - c1->WaitPrimitive(); - int inutile; - std::cin>>inutile; - } - } - - // every fit gives a dead tube by definition - // the selection of real dead tubes is done afterward - - // count dead tubes candidates & fill vectors - - int ib=(int) (binminfit);//round it to next integer - binminfit=float(ib)+0.5;//put it in the middle of the bin! - ndeadtubes++; - deadtubeseed[ndeadtubes-1]=ibinmin; - deadtube[ndeadtubes-1]=binminfit; - deadtubelen[ndeadtubes-1]=lenmin; - deadtubechi2[ndeadtubes-1]=chi2min; - deadtubeeffi[ndeadtubes-1]=effimin; - deadtubeerr[ndeadtubes-1]=errmin; - - // compute now difference between polynomial at the position of the dead tube - // and compute [poly-hist(dead-tube)]/stat-error - - // double mrtest=0.; - - double mrtest=0.; - - for(double mr=deadtube[ndeadtubes-1];mr<deadtube[ndeadtubes-1]+deadtubelen[ndeadtubes-1];mr++){ - double emr=idh1->GetBinError(int(mr)); - if(emr==0.) emr=2.3; - double cmr=idh1->GetBinContent(int(mr)); - double pol=parf[0] - +mr*parf[1] - +mr*mr*parf[2] - +mr*mr*mr*parf[3]; - double diff = pol-cmr; - if(diff>0.)mrtest=diff; - if(emr!=0.){mrtest=diff/emr;} - int index=(int) (mr-deadtube[ndeadtubes-1]); - deadtubestat[ndeadtubes-1][index]=mrtest; - }//for mr= - - // put back stat error of the hole to 0 - idh1->SetBinError(ibinmin,0.); - } // end loop holes - // put back error! - for(int nh=0;nh<nholes;nh++){ - idh1->SetBinError(ibinmin,err[nh]); - } - - // end complete fit ================== - - }// loop tubestart - } //loop nlayers - - } // end loop over ML's - - //gabri - validateDeadTubes(chi2cut,HRef,deadTubesMap,chambname); - } //if(Entries>0) - delete idh1; -}// deadTubes - -// ============================================================================== -// -// MDTDeadElementsAnalysis::validateDeadTubes -// -// ============================================================================== - -std::string MDTDeadElementsAnalysis::validateDeadTubes(double chi2cut, TH1F *HRef, TH1F *deadTubesMap, std::string chambname){ - for (int nd=0;nd<ndeadtubes;nd++){ - Double_t cgeo = HRef->GetBinContent(int(deadtube[nd])); - bool stat_significance = ((1.- deadtubeeffi[nd])/deadtubeerr[nd] > 7.)|| - (deadtubestat[nd][0]>5.); - if (deadtubeerr[nd]==0.) continue; - double effective_cut=chi2cut; - if(deadtubechi2[nd])effective_cut=chi2cut*6.; - if (std::abs(deadtubechi2[nd])< effective_cut && stat_significance &&deadtubeeffi[nd]<=0.2 - && cgeo !=0.){ - for(int nt=0;nt<1;nt++){ - int nlay = (int)(((int) deadtube[nd]-1)/nbins_per_layer[0])+1; - int ML=(int)((nlay-1)/nlayers_per_ml)+1; - int tube_in_layer=((int) deadtube[nd])-(nlay-1)*nbins_per_layer[0]; - if(nlay>nlayers_per_ml) nlay=nlay-nlayers_per_ml; - bool alreadyFound = false; - Double_t cdead = deadTubesMap->GetBinContent(int(deadtube[nd])); - // already found in deadTubesMap - int idead = (int) cdead; - Int_t deadquantity = idead%10; - if (deadTubeHistoBin.size()>0) { - if ( deadtube[nd] == deadTubeHistoBin.back() ){ - alreadyFound = true; - } - } - if (!alreadyFound&& deadquantity==0) { - deadTubeHistoBin.push_back(deadtube[nd]); - deadTube.push_back(tube_in_layer); - deadTubeId.push_back(ML*1000+nlay*100+tube_in_layer); - deadTubeChamber.push_back(chambname); - deadTubeLay.push_back(nlay); - deadTubeML.push_back(ML); - deadTubeEffi.push_back(deadtubeeffi[nd]); - deadTubeErrEffi.push_back(deadtubeerr[nd]); - deadTubeChi2.push_back(deadtubechi2[nd]); - Double_t c = (Double_t) deadtube[nd]; - Double_t cgeo = HRef->GetBinContent(int(c)); - Double_t signML = cgeo/std::abs(cgeo); - int igeo = (int) cgeo; - Int_t refquantity = igeo%10; - if(std::abs(cgeo)!=0.&& refquantity ==0){ - deadTubesMap->Fill(int(c),2.*signML); - } - } - - } //for mt = bin - }// end first test ================== - } // for nd=0, dead tubes - return "end processing"; -}//deadTubes - -// ============================================================================== -// -// MDTDeadElementsAnalysis::getHolesInInterval_strategy5 -// -// ============================================================================== - -void MDTDeadElementsAnalysis::getHolesInInterval_strategy5(TH1F* idh1, int firsttube, int lasttube, int /*ntubes*/, TF1 * /*polfunc*/){ - TH1F * distr_of_entries = new TH1F("","",1000,0.,1000.); - for(int ib=firsttube; ib<=lasttube;ib++){ - float cont = idh1->GetBinContent(ib); - distr_of_entries->Fill(cont); -} - MsgStream log(Athena::getMessageSvc(),"MDTDeadElementsAnalysis"); - TF1 *f1 = new TF1("f1", "gaus", 1, 1000); - distr_of_entries->Fit("f1", "RLQ0"); - double mean = f1->GetParameter(2); - double sigma = f1->GetParameter(3); - for(int ib=1;ib<=mean-3.*sigma;ib++){ - double cont = distr_of_entries->GetBinContent(ib); - if(cont!=0) { - for(int ib2=firsttube; ib2<=lasttube;ib2++){ - float cont2 = idh1->GetBinContent(ib2); - if(cont2==float(ib-1)) { - log<<MSG::WARNING<<"bin "<<ib2<<"is dead or inefficient"<<endmsg; - } - } - } - } - -} // getHolesInInterval -// ============================================================================== -// -// MDTDeadElementsAnalysis::getHolesInInterval -// -// ============================================================================== - -void MDTDeadElementsAnalysis::getHolesInInterval(TH1F* idh1, int firsttube, int lasttube, int ntubes, TF1 *polfunc){ - double better_average=average_entry; - double better_entry =n_entry; - std::vector<double> parf(7, 0.0); - std::string codepart="GetHolesInInterval"; - double bestchi2 = 1000000.; - chi2poly=0.; - polfunc->SetParameter(0,polyparf[0]); - polfunc->SetParameter(1,polyparf[1]); - polfunc->SetParameter(2,polyparf[2]); - polfunc->SetParameter(3,polyparf[3]); - idh1->Fit(polfunc,"Q","",(double)firsttube,(double)lasttube); - polyparf[0]=polfunc->GetParameter(0); - polyparf[1]=polfunc->GetParameter(1); - polyparf[2]=polfunc->GetParameter(2); - polyparf[3]=polfunc->GetParameter(3); - double chi2_pol=polfunc->GetChisquare(); - nholes=0; - - // ================== start strategy average > 100 && chi2_pol<100. - // first try comparing wrt average entry - - if(average_entry>100.&& chi2_pol<100.){ - - polyparf[0]=average_entry; - polyparf[1]=0.; - polyparf[2]=0.; - polyparf[3]=0.; - double olderror[10]; - for(int j=0;j<10;j++){holes[j]=0;} - for(int ibin=firsttube;ibin<=lasttube;ibin++){ - double xbin=double(ibin); - double c=idh1->GetBinContent(ibin); - double cerr=idh1->GetBinError(ibin); - double polinomial=polyparf[0] - +xbin*polyparf[1] - +xbin*xbin*polyparf[2] - +xbin*xbin*xbin*polyparf[3]; - double residual = c-average_entry; - // new def!! Use pol fit with all points unless chi2 is very bad - residual=c-polinomial; - if(residual<-3.*cerr&&nholes<10&&c/average_entry<0.9){ - if(nholes<10) nholes++; - olderror[nholes-1]=cerr; - holes[nholes-1]=(int) xbin; - eff_hole[nholes-1]=c/average_entry; - idh1->SetBinError(ibin,0.); - } - } //for(ibin - for(int ih=0;ih<nholes;ih++){ - int holepos=holes[ih]; - double cerr=olderror[ih]; - idh1->SetBinError(holepos,cerr); - } - - } - - // ================== end strategy average > 100 - - // ================== refine strategy average > 100 if chi2>50 - - if(average_entry>100.&& chi2_pol>50.){ - nholes=0; - for(int j=0;j<10;j++){holes[j]=0;} - idh1->Fit(polfunc,"Q","",(double)firsttube,(double)lasttube); - chi2poly = polfunc->GetChisquare(); - bestchi2 = chi2poly; - int bestposition = 0; - double besteff = 1.; - for(int ibin=firsttube;ibin<=lasttube;ibin++){ - double xbin=double(ibin); - double olderr = idh1->GetBinError(ibin); - idh1->SetBinError(ibin,0.); - idh1->Fit(polfunc,"Q","",(double)firsttube,(double)lasttube); - chi2_pol = polfunc->GetChisquare(); - if(bestchi2>chi2_pol){ - bestchi2 = chi2_pol; - bestposition = ibin; - parf[0]=polfunc->GetParameter(0); - parf[1]=polfunc->GetParameter(1); - parf[2]=polfunc->GetParameter(2); - parf[3]=polfunc->GetParameter(3); - double polinomial=parf[0] - +xbin*parf[1] - +xbin*xbin*parf[2] - +xbin*xbin*xbin*parf[3]; - double c=idh1->GetBinContent(ibin); - besteff=c/polinomial; - for(int i=0;i<4;i++){polyparf[i]=parf[i];} - } //if(bestchi2 ... - idh1->SetBinError(ibin,olderr); - } //for (int bin - if(bestchi2<350.){ - nholes=1; - holes[0]=bestposition; - eff_hole[0]=besteff; - } //if(effi ... - } - - // - // INSERT HERE NEW PATCH FOR TWO TUBES !!!! - // - // if still bad try removing two bins ... - - // if(average_entry>100.&& chi2_pol>50.){ - if(average_entry>100.&& bestchi2>50.){ - nholes=0; - int bestposition1 = 0; - double besteff1 = 1.; - int bestposition2 = 0; - double besteff2 = 1.; - - for(int j=0;j<10;j++){holes[j]=0;} - idh1->Fit(polfunc,"Q","",(double)firsttube,(double)lasttube); - chi2poly = polfunc->GetChisquare(); - bestchi2 = chi2poly; - for(int ibin=firsttube;ibin<lasttube;ibin++){ - double xbin1=double(ibin); - double olderr1 = idh1->GetBinError(ibin); - idh1->SetBinError(ibin,0.); - for(int lbin=ibin+1;lbin<=lasttube;lbin++){ - double xbin2=double(lbin); - double olderr2 = idh1->GetBinError(lbin); - idh1->SetBinError(lbin,0.); - - idh1->Fit(polfunc,"Q","",(double)firsttube,(double)lasttube); - chi2_pol = polfunc->GetChisquare(); - if(bestchi2>chi2_pol){ - bestchi2 = chi2_pol; - bestposition1 = ibin; - bestposition2 = lbin; - parf[0]=polfunc->GetParameter(0); - parf[1]=polfunc->GetParameter(1); - parf[2]=polfunc->GetParameter(2); - parf[3]=polfunc->GetParameter(3); - double polinomial=parf[0] - +xbin1*parf[1] - +xbin1*xbin1*parf[2] - +xbin1*xbin1*xbin1*parf[3]; - double c=idh1->GetBinContent(ibin); - besteff1=c/polinomial; - polinomial=parf[0] - +xbin2*parf[1] - +xbin2*xbin2*parf[2] - +xbin2*xbin2*xbin2*parf[3]; - c=idh1->GetBinContent(lbin); - besteff2=c/polinomial; - for(int i=0;i<4;i++){polyparf[i]=parf[i];} - } - idh1->SetBinError(lbin,olderr2); - } - if(bestchi2<50.){ - nholes=2; - holes[0]=bestposition1; - eff_hole[0]=besteff1; - holes[1]=bestposition2; - eff_hole[1]=besteff2; - } - idh1->SetBinError(ibin,olderr1); - } - } //if(average>100.&&chi2poly>50.) - - - - // ================== end refine strategy average > 100 if chi2>50 - // - // INSERT HERE NEW PATCH FOR THREE TUBES IN SEQUENCE !!!! - // - // if still bad try removing three bins ... - if(average_entry>100.&& bestchi2>50.){ - //================================================== - nholes=0; - int bestposition1 = 0; - double besteff1 = 1.; - int bestposition2 = 0; - double besteff2 = 1.; - int bestposition3 = 0; - double besteff3 = 1.; - for(int j=0;j<10;j++){holes[j]=0;} - idh1->Fit(polfunc,"Q","",(double)firsttube,(double)lasttube); - chi2poly = polfunc->GetChisquare(); - bestchi2 = chi2poly; - double initial_pol_chi2= chi2poly; - double olderr1(0.0); - double olderr2(0.0); - double olderr3(0.0); - for(int ibin=firsttube;ibin<lasttube-3;ibin++){ - double xbin1=double(ibin); - olderr1 = idh1->GetBinError(ibin); - double xbin2=double(ibin+1); - olderr2 = idh1->GetBinError(ibin+1); - double xbin3=double(ibin+2); - olderr3 = idh1->GetBinError(ibin+2); - idh1->SetBinError(ibin,0.); - idh1->SetBinError(ibin+1,0.); - idh1->SetBinError(ibin+2,0.); - idh1->Fit(polfunc,"Q","",(double)firsttube,(double)lasttube); - chi2_pol = polfunc->GetChisquare(); - if(bestchi2>chi2_pol){ - bestchi2 = chi2_pol; - bestposition1 = ibin; - bestposition2 = ibin+1; - bestposition3 = ibin+2; - parf[0]=polfunc->GetParameter(0); - parf[1]=polfunc->GetParameter(1); - parf[2]=polfunc->GetParameter(2); - parf[3]=polfunc->GetParameter(3); - - double polinomial=parf[0] - +xbin1*parf[1] - +xbin1*xbin1*parf[2] - +xbin1*xbin1*xbin1*parf[3]; - double c=idh1->GetBinContent(ibin); - besteff1=c/polinomial; - polinomial=parf[0] - +xbin2*parf[1] - +xbin2*xbin2*parf[2] - +xbin2*xbin2*xbin2*parf[3]; - c=idh1->GetBinContent(ibin+1); - besteff2=c/polinomial; - c=idh1->GetBinContent(ibin); - besteff1=c/polinomial; - polinomial=parf[0] - +xbin3*parf[1] - +xbin3*xbin3*parf[2] - +xbin3*xbin3*xbin3*parf[3]; - c=idh1->GetBinContent(ibin+2); - besteff3=c/polinomial; - for(int i=0;i<4;i++){polyparf[i]=parf[i];} - } - if(bestchi2<50.){ - if(besteff1<0.2&&besteff2<0.2&&besteff3<0.2){ - nholes=3; - holes[0]=bestposition1; - eff_hole[0]=besteff1; - holes[1]=bestposition2; - eff_hole[1]=besteff2; - holes[2]=bestposition3; - eff_hole[2]=besteff3; - } - } - idh1->SetBinError(ibin,olderr1); - idh1->SetBinError(ibin+1,olderr2); - idh1->SetBinError(ibin+2,olderr3); - } //for (int ibin - //================================================== - double gain = bestchi2/initial_pol_chi2; - if(gain<0.3) { - int ibin1=bestposition1; - idh1->SetBinError(ibin1,0.); - idh1->SetBinError(ibin1+1,0.); - idh1->SetBinError(ibin1+2,0.); - - for(int ibin=firsttube;ibin<lasttube;ibin++){ - if(ibin<ibin1||ibin>ibin1+2){ - idh1->Fit(polfunc,"Q","",(double)firsttube,(double)lasttube); - chi2_pol = polfunc->GetChisquare(); - if(bestchi2>chi2_pol){ - bestchi2 = chi2_pol; - parf[0]=polfunc->GetParameter(0); - parf[1]=polfunc->GetParameter(1); - parf[2]=polfunc->GetParameter(2); - parf[3]=polfunc->GetParameter(3); - double xbin1=double(ibin); - double polinomial=parf[0] - +xbin1*parf[1] - +xbin1*xbin1*parf[2] - +xbin1*xbin1*xbin1*parf[3]; - double c=idh1->GetBinContent(ibin); - besteff1=c/polinomial; - - for(int i=0;i<4;i++){polyparf[i]=parf[i];} - } - idh1->SetBinError(ibin,olderr1); - idh1->SetBinError(ibin+1,olderr2); - idh1->SetBinError(ibin+2,olderr3); - }//if(ibin<ibin1 ... - } //for (int ibin - - } - } //if(average>100.&&chi2poly>50.) - - - - // ================== end refine strategy average > 100 if chi2>50 for 3 tubes in sequence - - - // ================== start strategy average < 100 - - if(average_entry<100.){ - nholes=0; - for(int j=0;j<10;j++){holes[j]=0;} - better_average=0.; - better_entry =0.; - for(int nb=firsttube;nb<=lasttube;nb++){ - double c=idh1->GetBinContent(nb); - double cerr=idh1->GetBinError(nb); - /* - tag 'holes' candidates using criterium c deviates from average by more than 4stat-errors - remember not to use bins of dead mezzanines tagged using SetBinError(nb,0.) in deadMezz - */ - if((average_entry-c)>3.5*std::sqrt(average_entry)&&n_entry>double(ntubes)-3.){ - position_holes[nb]=1; - if(nholes<10){ - // this is one dead tube candidate! - // remember eff_hole, to cut on it - nholes++; - holes[nholes-1]=nb; - eff_hole[nholes-1]=c/average_entry; - } - }else { - if(cerr>0.){ - better_average=better_average+c; - better_entry++; - } - } - } // for int=nb.. - if(better_entry>0.) better_average = better_average/better_entry; - polyparf[0]=better_average; - for(int i=1;i<4;i++){polyparf[i]=0.;} - } // else if average_entry<100. - - // ================== end strategy average < 100 - average_entry=better_average; -} // getHolesInInterval - - // ============================================================================== - // - // MDTDeadElementsAnalysis::getAverageInInterval - // - // ============================================================================== - -void MDTDeadElementsAnalysis::getAverageLevelInInterval(TH1F* idh1, int firsttube, int lasttube){ - average_entry=0.; - n_entry=0.; - for(int nb=firsttube;nb<=lasttube;nb++){ - average_entry=average_entry+idh1->GetBinContent(nb); - n_entry++; - } - average_entry=average_entry/n_entry; -} -// ============================================================================== -// -// MDTDeadElementsAnalysis::getSpikesInInterval -// -// ============================================================================== - -void MDTDeadElementsAnalysis::getSpikesInInterval(TH1F* idh1, int firsttube, int lasttube, TF1 * /*polfunc*/){ - - average_entry=0.; - n_entry=0.; - for(int nb=firsttube;nb<=lasttube;nb++){ - average_entry=average_entry+idh1->GetBinContent(nb); - n_entry++; - } - - average_entry=average_entry/n_entry; - // look for max entries - - // int position_spikes[1000]; - for(int index=0; index<ntmax; index++){position_spikes[index]=0;} - double old_average=average_entry; - - while(1) { - // remove bins 'well' above average until average gets stable - // if a bin has been removed already position_spikes[nb]=1 - double largest_num_entries=0.; - int pos_largest_num_entries=0; - for(int nb=firsttube;nb<=lasttube;nb++){ - double c=idh1->GetBinContent(nb); - if(c>largest_num_entries&&position_spikes[nb]!=1){ - largest_num_entries=c; - pos_largest_num_entries=nb; - } - } - // check average when bin with max entries is removed! - // if largest bin accounts for more than 80% of total -> spike - - if(largest_num_entries>1.5*average_entry) { - position_spikes[pos_largest_num_entries]=1; - average_entry=(average_entry*n_entry-largest_num_entries)/(n_entry-1.); - n_entry--; - // if error of one bin is put to zero-> bin not used in the fit - idh1->SetBinError(pos_largest_num_entries,0.); - } - double ratio=99999.; - if(old_average>0.) ratio=average_entry/old_average; - if( ratio>0.8 || n_entry<=6 ) break; - - old_average=average_entry; - - }//end while -} - -// ============================================================================== -// -// Polnml3 -// -// ============================================================================== -Double_t polnml3(Double_t * x, Double_t * parf) { - - Double_t poly=parf[0] - +x[0]*parf[1] - +x[0]*x[0]*parf[2] - +x[0]*x[0]*x[0]*parf[3]; - - return poly; -}//polnml3 - -// ============================================================================== -// -// completefunc -// -// ============================================================================== - -double completefunc(double * x, double * parf) { - - double poly=parf[0] - +x[0]*parf[1] - +x[0]*x[0]*parf[2] - +x[0]*x[0]*x[0]*parf[3]; - - double eff=1.; - int tubefit = (int) parf[4]; - double par4=tubefit; - if(x[0]>par4-0.5 && x[0]<par4+std::abs(parf[5])-0.5) { - eff=parf[6]; - } - double value=poly*eff; - - return value; -}//completefunc - -// ============================================================================== -// -// MDTDeadElementsAnalysis::deadMezzanines -// -// ============================================================================== - -void MDTDeadElementsAnalysis::deadMezzanines(TH1F* idh, TH1F* HRef, TH1F* deadTubesMap, std::string chambname){ - - TH1F * idh1 = (TH1F*)idh->Clone(); - - MDTDeadElementsAnalysis::deadMezzDone=true; - - int Entries=0; - int nbins=idh1->GetNbinsX(); - for(int bin=1;bin<=nbins;bin++){ - Entries = Entries + (int) idh1->GetBinContent(bin); - } - - std::ostringstream deadAna; - double cmax = -1.; - int pos_maximum = -1; - for(int ib=1; ib<=nbins; ib++){ - double cont=idh1->GetBinContent(ib); - if(cont>cmax) { - cmax=cont; - pos_maximum = ib; - } - } - - if(Entries-cmax>1000) { - TH1F * hmezz = new TH1F("hmezz","hmezz", - nbins_per_layer[0]+nbins_per_layer[1],0.5, - nbins_per_layer[0]+nbins_per_layer[1]+0.5); - TH1F * hmezzRef = new TH1F("hmezzRef","hmezzRef", - nbins_per_layer[0]+nbins_per_layer[1],0.5, - nbins_per_layer[0]+nbins_per_layer[1]+0.5); - hmezz->SetTitle(chambname.c_str()); - hmezzRef->SetTitle(chambname.c_str()); - for(int MultiLayer=0;MultiLayer<2;MultiLayer++){ - if (nbins_per_layer[MultiLayer]==0) continue; - int ibstart = (MultiLayer)*nbins_per_layer[0]*nlayers_per_ml+1; - int ibend = (MultiLayer)*nbins_per_layer[0]*nlayers_per_ml - +nbins_per_layer[MultiLayer]*nlayers_per_ml; - for(int ib=ibstart; ib<=ibend; ib++){ - int nlay = (ib-firstbinML[MultiLayer])/nbins_per_layer[MultiLayer]+1; - int ML=MultiLayer+1; - int tube_in_layer=ib-(nlay-1)*nbins_per_layer[MultiLayer]-firstbinML[MultiLayer]; - if(nlay>nlayers_per_ml) nlay=nlay-nlayers_per_ml; - double cont=idh1->GetBinContent(ib); - double contRef=HRef->GetBinContent(ib); - hmezz->Fill(tube_in_layer+(ML-1)*nbins_per_layer[MultiLayer]+1,cont); - hmezzRef->Fill(tube_in_layer+(ML-1)*nbins_per_layer[MultiLayer]+1,contRef); - } - } - // treat correctly zeros & compute average - // remember bins with zero entries (I should rather say zero error!) are NOT included in a chi2 fit - // thus to take them into account you need to give them a non zero error - - average_entry=0.; - n_entry=0.; - for (int nb=1;nb<=nbins_per_layer[0]*2;nb++){ - average_entry=average_entry+hmezz->GetBinContent(nb); - n_entry++; - double contRef=std::abs(hmezzRef->GetBinContent(nb)); - if (hmezz->GetBinContent(nb)==0.&&contRef!=nlayers_per_ml&&contRef!=0.) { - hmezz->SetBinError(nb,2.3); - } - } - average_entry=average_entry/n_entry; - // look for max entries - - for(int index=0; index<ntmax; index++){position_spikes[index]=0;} - double old_average=average_entry; - - while(1) { - // remove bins 'well' above average until average gets stable - // if a bin has been removed already position_spikes[nb]=1 - double largest_num_entries=0.; - int pos_largest_num_entries=0; - for (int nb=1;nb<=nbins_per_layer[0]*2;nb++){ - double c=hmezz->GetBinContent(nb); - if (c>largest_num_entries&&position_spikes[nb]!=1){ - largest_num_entries=c; - pos_largest_num_entries=nb; - } - } - // check average when bin with max entries is removed! - // if largest bin accounts for more than 80% of total -> spike - - if(largest_num_entries>1.5*average_entry) { - position_spikes[pos_largest_num_entries]=1; - average_entry=(average_entry*n_entry-largest_num_entries)/(n_entry-1.); - n_entry--; - // if error of one bin is put to zero-> bin not used in the fit - hmezz->SetBinError(pos_largest_num_entries,0.); - } - double ratio=99999.; - if(old_average>0.) ratio=average_entry/old_average; - if( ratio>0.8 || n_entry<=6 ) break; - - old_average=average_entry; - - }//end while - - double chi2cut=30.; - if(Entries>50000.) chi2cut=60.; - TF1 *fitfunc = new TF1("fit1",completefunc,1.,(double)2.*ntubes[0],7); - polfunc = new TF1("fit0",polnml3,1.,(double)2.*ntubes[0],4); - fitfunc->SetParameters(-51.,180.,-10.,0.,9.,1.,0.5); - for(int ml=1;ml<=2;ml++){ - if (nbins_per_layer[ml-1]==0) continue; - double fit_start=1.+(ml-1)*nbins_per_layer[1]; - double fit_end=nbins_per_layer[0]+(ml-1)*nbins_per_layer[1]; - if(verbose){ - hmezz->Fit(polfunc,"","",(double)fit_start,(double)fit_end); - } else { - hmezz->Fit(polfunc,"Q","",(double)fit_start,(double)fit_end); - } - hmezz->SetMinimum(0.); - hmezz->SetMaximum(500.); - double chi2 = polfunc->GetChisquare(); - double ndf= nbins_per_layer[0]-4; - if(chi2/ndf > 10 ) { - hmezz->SetBinError(pos_maximum,0.); - if(verbose) { - hmezz->Fit(polfunc,"","",(double)fit_start,(double)fit_end); - } else { - hmezz->Fit(polfunc,"Q","",(double)fit_start,(double)fit_end); - } - - double olderr[8]; - for(int ii=0; ii<8; ii++) olderr[ii] = 0.; - for (int imezz=1+(ml-1)*nmezz[1];imezz<=nmezz[0]+(ml-1)*nmezz[1];imezz++){ - for (int ic=(imezz-1)*ntubes_per_mezz+1+(ml-1)*nbins_per_layer[1]; - ic<=(imezz)*ntubes_per_mezz+(ml-1)*nbins_per_layer[1];ic++){ - int index = (ic-1)%8; - olderr[index]=hmezz->GetBinError(ic); - hmezz->SetBinError(ic,0.); - } - hmezz->Fit(polfunc,"Q","",(double)fit_start,(double)fit_end); - if(verbose){ - if (drawPlots) { - TCanvas *c1 = new TCanvas(); - hmezz->Draw(); - c1->WaitPrimitive(); - int inutile; - std::cin>>inutile; - } - } - // chi2 = poly->GetChisquare(); - chi2 = polfunc->GetChisquare(); - fitfunc->SetParameter(0,polfunc->GetParameter(0)); - fitfunc->SetParameter(1,polfunc->GetParameter(1)); - fitfunc->SetParameter(2,polfunc->GetParameter(2)); - fitfunc->SetParameter(3,polfunc->GetParameter(3)); - fitfunc->FixParameter(4,(imezz-1)*ntubes_per_mezz+1.); - fitfunc->FixParameter(5,ntubes_per_mezz); - fitfunc->SetParameter(6,.1); - fitfunc->SetParLimits(6,-2.,2.); - - for(int ic=(imezz-1)*ntubes_per_mezz+1+(ml-1)*nbins_per_layer[0] - ;ic<=(imezz)*ntubes_per_mezz+(ml-1)*nbins_per_layer[0];ic++){ - int index = (ic-1)%8; - hmezz->SetBinError(ic,olderr[index]); - } - - if(!verbose){ - hmezz->Fit("fit1","BQ","",(double)fit_start,(double)fit_end); - } else { - hmezz->Fit("fit1","B","",(double)fit_start,(double)fit_end); - if (drawPlots) { - TCanvas *c1 = new TCanvas(); - hmezz->Draw(); - c1->WaitPrimitive(); - int inutile; - std::cin>>inutile; - } - } - double chi2 = fitfunc->GetChisquare(); - double efficiency = fitfunc->GetParameter(6); - double err_efficiency = fitfunc->GetParError(6); - if(err_efficiency>0.05) { - if(verbose){ - hmezz->Fit("fit1","BEL","",(double)fit_start,(double)fit_end); - } else { - hmezz->Fit("fit1","BQEL","",(double)fit_start,(double)fit_end); - } - efficiency = fitfunc->GetParameter(6); - err_efficiency = fitfunc->GetParError(6); - } - if(chi2/ndf<chi2cut&&(1.-efficiency)/err_efficiency>7&&efficiency<0.3){ - - - deadMezz.push_back(imezz); - int imezz_red=imezz%(nmezz[ml-1]+1); - deadMezz_red.push_back(imezz_red); - deadMezzChamber.push_back(chambname); - deadMezzML.push_back(ml); - deadMezzEffi.push_back(efficiency); - deadMezzErrEffi.push_back(err_efficiency); - deadMezzChi2.push_back(chi2); - deadMezz_csm.push_back(-1); - int layer_start=(ml-1)*nlayers_per_ml+1; - int layer_end=nlayers_per_ml*ml; - for(int l=layer_start;l<=layer_end;l++){ - int tube_start=1+(imezz-1)*ntubes_per_mezz+(l-1)*nbins_per_layer[0]; - int tube_end=tube_start+ntubes_per_mezz-1; - for(int t=tube_start;t<=tube_end;t++){ - Double_t cgeo = HRef->GetBinContent(t); - Double_t signML = cgeo/std::abs(cgeo); - int igeo = (int) cgeo; - Int_t refquantity = igeo%10; - if(std::abs(cgeo)!=0. && refquantity==0){ - idh1->SetBinError(t,0.); - - deadTubesMap->Fill(t,3.*signML); - } - } - } - } - } // for mezz - } // if(chi2) - } // for ml - hmezz->Delete(); - hmezzRef->Delete(); - } // if(Entries.. - - delete idh1; - - return; - -}//deadMezzanines - - -// ============================================================================== -// -// MDTDeadElementsAnalysis::deadMezzanines -// -// ============================================================================== - -void MDTDeadElementsAnalysis::deadMezzanines(TH1F* idh, TH1F* HRef, TH1F* deadTubesMap, - std::string chambname, int /*convert_mezzanine*/[20]){ - - TH1F * idh1 = (TH1F*)idh->Clone(); - - MDTDeadElementsAnalysis::deadMezzDone=true; - - int Entries=0; - int nbins=idh1->GetNbinsX(); - for(int bin=1;bin<=nbins;bin++){ - Entries = Entries + (int) idh1->GetBinContent(bin); - } - - std::ostringstream deadAna; - double cmax = -1.; - int pos_maximum = -1; - for(int ib=1; ib<=nbins; ib++){ - double cont=idh1->GetBinContent(ib); - if(cont>cmax) { - cmax=cont; - pos_maximum = ib; - } - } - - if(Entries-cmax>1000) { - TH1F * hmezz = new TH1F("hmezz","hmezz", - nbins_per_layer[0]+nbins_per_layer[1],0.5, - nbins_per_layer[0]+nbins_per_layer[1]+0.5); - TH1F * hmezzRef = new TH1F("hmezzRef","hmezzRef", - nbins_per_layer[0]+nbins_per_layer[1],0.5, - nbins_per_layer[0]+nbins_per_layer[1]+0.5); - hmezz->SetTitle(chambname.c_str()); - hmezzRef->SetTitle(chambname.c_str()); - for(int MultiLayer=0;MultiLayer<2;MultiLayer++){ - if (nbins_per_layer[MultiLayer]==0) continue; - int ibstart = (MultiLayer)*nbins_per_layer[0]*nlayers_per_ml+1; - int ibend = (MultiLayer)*nbins_per_layer[0]*nlayers_per_ml - +nbins_per_layer[MultiLayer]*nlayers_per_ml; - for(int ib=ibstart; ib<=ibend; ib++){ - int nlay = (ib-firstbinML[MultiLayer])/nbins_per_layer[MultiLayer]+1; - int ML=MultiLayer+1; - int tube_in_layer=ib-(nlay-1)*nbins_per_layer[MultiLayer]-firstbinML[MultiLayer]; - if(nlay>nlayers_per_ml) nlay=nlay-nlayers_per_ml; - double cont=idh1->GetBinContent(ib); - double contRef=HRef->GetBinContent(ib); - hmezz->Fill(tube_in_layer+(ML-1)*nbins_per_layer[MultiLayer]+1,cont); - hmezzRef->Fill(tube_in_layer+(ML-1)*nbins_per_layer[MultiLayer]+1,contRef); - } - } - // treat correctly zeros & compute average - // remember bins with zero entries (I should rather say zero error!) are NOT included in a chi2 fit - // thus to take them into account you need to give them a non zero error - - average_entry=0.; - n_entry=0.; - for (int nb=1;nb<=nbins_per_layer[0]*2;nb++){ - average_entry=average_entry+hmezz->GetBinContent(nb); - n_entry++; - double contRef=std::abs(hmezzRef->GetBinContent(nb)); - if (hmezz->GetBinContent(nb)==0.&&contRef!=nlayers_per_ml&&contRef!=0.) { - hmezz->SetBinError(nb,2.3); - } - } - average_entry=average_entry/n_entry; - // look for max entries - - for(int index=0; index<ntmax; index++){position_spikes[index]=0;} - double old_average=average_entry; - - while(1) { - // remove bins 'well' above average until average gets stable - // if a bin has been removed already position_spikes[nb]=1 - double largest_num_entries=0.; - int pos_largest_num_entries=0; - for (int nb=1;nb<=nbins_per_layer[0]*2;nb++){ - double c=hmezz->GetBinContent(nb); - if (c>largest_num_entries&&position_spikes[nb]!=1){ - largest_num_entries=c; - pos_largest_num_entries=nb; - } - } - // check average when bin with max entries is removed! - // if largest bin accounts for more than 80% of total -> spike - - if(largest_num_entries>1.5*average_entry) { - position_spikes[pos_largest_num_entries]=1; - average_entry=(average_entry*n_entry-largest_num_entries)/(n_entry-1.); - n_entry--; - // if error of one bin is put to zero-> bin not used in the fit - hmezz->SetBinError(pos_largest_num_entries,0.); - } - double ratio=99999.; - if(old_average>0.) ratio=average_entry/old_average; - if( ratio>0.8 || n_entry<=6 ) break; - - old_average=average_entry; - - }//end while - double chi2cut=30.; - if(Entries>50000.) chi2cut=60.; - - polfunc = new TF1("fit0",polnml3,1.,(double)2.*ntubes[0],4); - TF1 *fitfunc = new TF1("fit1",completefunc,1.,(double)2.*ntubes[0],7); - fitfunc->SetParameters(-51.,180.,-10.,0.,9.,1.,0.5); - for(int ml=1;ml<=2;ml++){ - if (nbins_per_layer[ml-1]==0) continue; - double fit_start=1.+(ml-1)*nbins_per_layer[1]; - double fit_end=nbins_per_layer[0]+(ml-1)*nbins_per_layer[1]; - if(verbose){ - hmezz->Fit(polfunc,"","",(double)fit_start,(double)fit_end); - } else { - hmezz->Fit(polfunc,"Q","",(double)fit_start,(double)fit_end); - } - hmezz->SetMinimum(0.); - hmezz->SetMaximum(500.); - double chi2 = polfunc->GetChisquare(); - double ndf= nbins_per_layer[0]-4; - if(chi2/ndf > 10 ) { - hmezz->SetBinError(pos_maximum,0.); - if(verbose) { - hmezz->Fit(polfunc,"","",(double)fit_start,(double)fit_end); - } else { - hmezz->Fit(polfunc,"Q","",(double)fit_start,(double)fit_end); - } - - double olderr[8]; - for(int ii=0; ii<8; ii++) olderr[ii] = 0.; - for (int imezz=1+(ml-1)*nmezz[1];imezz<=nmezz[0]+(ml-1)*nmezz[1];imezz++){ - for (int ic=(imezz-1)*ntubes_per_mezz+1+(ml-1)*nbins_per_layer[1]; - ic<=(imezz)*ntubes_per_mezz+(ml-1)*nbins_per_layer[1];ic++){ - int index = (ic-1)%8; - olderr[index]=hmezz->GetBinError(ic); - hmezz->SetBinError(ic,0.); - } - hmezz->Fit(polfunc,"Q","",(double)fit_start,(double)fit_end); - if(verbose){ - if (drawPlots) { - TCanvas *c1 = new TCanvas(); - hmezz->Draw(); - c1->WaitPrimitive(); - } - } - chi2 = polfunc->GetChisquare(); - fitfunc->SetParameter(0,polfunc->GetParameter(0)); - fitfunc->SetParameter(1,polfunc->GetParameter(1)); - fitfunc->SetParameter(2,polfunc->GetParameter(2)); - fitfunc->SetParameter(3,polfunc->GetParameter(3)); - fitfunc->FixParameter(4,(imezz-1)*ntubes_per_mezz+1.); - fitfunc->FixParameter(5,ntubes_per_mezz); - fitfunc->SetParameter(6,.1); - fitfunc->SetParLimits(6,-2.,2.); - - for(int ic=(imezz-1)*ntubes_per_mezz+1+(ml-1)*nbins_per_layer[0] - ;ic<=(imezz)*ntubes_per_mezz+(ml-1)*nbins_per_layer[0];ic++){ - int index = (ic-1)%8; - hmezz->SetBinError(ic,olderr[index]); - } - - if(!verbose){ - hmezz->Fit("fit1","BQ","",(double)fit_start,(double)fit_end); - } else { - hmezz->Fit("fit1","B","",(double)fit_start,(double)fit_end); - if (drawPlots) { - TCanvas *c1 = new TCanvas(); - hmezz->Draw(); - c1->WaitPrimitive(); - } - } - double chi2 = fitfunc->GetChisquare(); - double efficiency = fitfunc->GetParameter(6); - double err_efficiency = fitfunc->GetParError(6); - if(err_efficiency>0.05) { - if(verbose){ - hmezz->Fit("fit1","BEL","",(double)fit_start,(double)fit_end); - } else { - hmezz->Fit("fit1","BQEL","",(double)fit_start,(double)fit_end); - } - efficiency = fitfunc->GetParameter(6); - err_efficiency = fitfunc->GetParError(6); - } - if(chi2/ndf<chi2cut&&(1.-efficiency)/err_efficiency>7&&efficiency<0.3){ - - - deadMezz.push_back(imezz); - int imezz_red=imezz%(nmezz[ml-1]+1); - deadMezz_red.push_back(imezz_red); - deadMezzChamber.push_back(chambname); - deadMezzML.push_back(ml); - deadMezzEffi.push_back(efficiency); - deadMezzErrEffi.push_back(err_efficiency); - deadMezzChi2.push_back(chi2); - deadMezz_csm.push_back(-1); - int layer_start=(ml-1)*nlayers_per_ml+1; - int layer_end=nlayers_per_ml*ml; - for(int l=layer_start;l<=layer_end;l++){ - int tube_start=1+(imezz-1)*ntubes_per_mezz+(l-1)*nbins_per_layer[0]; - int tube_end=tube_start+ntubes_per_mezz-1; - for(int t=tube_start;t<=tube_end;t++){ - Double_t cgeo = HRef->GetBinContent(t); - Double_t signML = cgeo/std::abs(cgeo); - int igeo = (int) cgeo; - Int_t refquantity = igeo%10; - if(std::abs(cgeo)!=0. && refquantity==0){ - idh1->SetBinError(t,0.); - - deadTubesMap->Fill(t,3.*signML); - } - } - } - } - } // for mezz - } // if(chi2) - } // for ml - hmezz->Delete(); - hmezzRef->Delete(); - } // if(Entries.. - - delete idh1; - - return; - -}//deadMezzanines - -// ============================================================================== -// -// MDTDeadElementsAnalysis::deadMultilayers -// -// ============================================================================== - -void MDTDeadElementsAnalysis::deadMultilayers(TH1F *idh1, TH1F *HRef, TH1F *deadTubesMap, std::string chambname){ - - MDTDeadElementsAnalysis::deadMultilayerDone=true; - std::ostringstream deadAna; - int nbins=idh1->GetNbinsX(); - - int nML = 2; - if ( nbins_per_layer[1]==0 ) nML=1; - int binsML1 = nbins/nML; - int binsML2 = binsML1; - if ( nML==1 ) { - deadAna << "DeadMultilayers Analysis SKIPPED since chamber "<<chambname<<" has 1 ML only "<<std::endl; - return ; - } - - polfunc = new TF1("fit0",polnml3,1.,(double)2.*ntubes[0],4); - getSpikesInInterval(idh1,1,binsML1,polfunc); - float isolatedCountsML1 = 0.; - float nonisolatedCountsML1 = 0.; - float averageLevelML1 = average_entry; - for(int j=2;j<binsML1;j++){ - if(position_spikes[j]!=1) { - if(idh1->GetBinContent(j-1)==0&&idh1->GetBinContent(j+1)==0)isolatedCountsML1++; - if(idh1->GetBinContent(j-1)>0&&idh1->GetBinContent(j+1)>0)nonisolatedCountsML1++; - } - } - - getSpikesInInterval(idh1,binsML1+1,binsML1+binsML2,polfunc); - float isolatedCountsML2 = 0.; - float nonisolatedCountsML2 = 0.; - float averageLevelML2 = average_entry; - for(int j=binsML1+2;j<binsML1+binsML2;j++){ - if(position_spikes[j]!=1) { - if(idh1->GetBinContent(j-1)==0&&idh1->GetBinContent(j+1)==0)isolatedCountsML2++; - if(idh1->GetBinContent(j-1)>0&&idh1->GetBinContent(j+1)>0)nonisolatedCountsML2++; - } - } - // ML1 - - if(float(nonisolatedCountsML1)/float(binsML1)<.2|| - std::abs(averageLevelML1/averageLevelML2)<0.1) { - deadAna <<" dead MultiLayer 1 found in chamber "<<chambname<<std::endl; - deadMultilayer.push_back(1); - deadMLChamber.push_back(chambname); - deadMLCounts.push_back(nonisolatedCountsML1); - deadMLLevel.push_back(averageLevelML1); - for(int j=1;j<=binsML1;j++){ - Double_t cgeo = HRef->GetBinContent(j); - Double_t signML = cgeo/std::abs(cgeo); - int igeo = (int) cgeo; - Int_t refquantity = igeo%10; - if(std::abs(cgeo)!=0.&& refquantity==0){ - deadTubesMap->Fill(j,5.*signML); - } - } - - } else { - deadAna << " MultiLayer 1 in chamber is alive"<<std::endl; - } - // ML2 - - if(float(nonisolatedCountsML2)/float(binsML2)<.2|| - std::abs(averageLevelML2/averageLevelML1)<0.1) { - deadAna <<" dead MultiLayer 2 found in chamber "<<chambname<<std::endl; - deadMultilayer.push_back(2); - deadMLChamber.push_back(chambname); - deadMLCounts.push_back(nonisolatedCountsML2); - deadMLLevel.push_back(averageLevelML2); - for(int j=binsML1+1;j<=binsML1+binsML2;j++){ - Double_t cgeo = HRef->GetBinContent(j); - Double_t signML = cgeo/std::abs(cgeo); - int igeo = (int) cgeo; - Int_t refquantity = igeo%10; - if(std::abs(cgeo)!=0.&& refquantity==0){ - deadTubesMap->Fill(j,5.*signML); - } - } - } else { - deadAna << " MultiLayer 2 in chamber is alive"<<std::endl; - } - return; -}//deadMultilayers diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/src/MDTDqaDeadElements.cxx b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/src/MDTDqaDeadElements.cxx deleted file mode 100644 index 4f196f0cc8f9d65378a64ca7f51361e0c43fa250..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/src/MDTDqaDeadElements.cxx +++ /dev/null @@ -1,1646 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -//Author Marco Vanadia vanadiam@roma1.infn.it -//Class based on algorithms introduced by Philipp Fleischmann in GnaMon - -//Be careful that in order to preserve a chamber-like structure, the first tube in a layer is tube #1 -//the first layer in a ML is layer#1, the first ML in a chamber is ML #1, but the first mezzanine in a -//ML is mezzanine #0. So to get the first tube in a layer you've got to use the method Layer::getTube(1), -//to get the first Mezzanine in a ML you've got to use the method Multilayer::getMezzanine(0); -//further more, loops involving tubes, layers and multilayer must have ending conditions like -// i<=Ntubes, while loops involving Mezzanines must have ending conditions like i<Nmezzanines - -//In chambers with ML1 shorter than ML2, -//empty spaces are treated just like tubes, but a special status value NOTUBE is assigned to them, -//and they are ignored in the rest of the analysis. In this way the real tubes are assigned to the -//right positions in the layer. -//So the method Layer::getNtubes() returns the number of both real and fake tubes, that is the right number -//to use in loops; if you want the number of REAL tubes in layer, use Layer::getNrealtubes(); - -//#include "./MDTDqaDeadElements.h" -#include "MuonCalibStandAloneExtraTools/MDTDqaDeadElements.h" - -#define NOTUBE 0 //Used for chambers with ML1 smaller than ML2 -#define DEADCHAMBER 1 -#define LOWSTATISTICSCHAMBER 7 -#define DEADML 2 -#define INEFFICIENTML 2 -#define DEADLAYER 3 -#define NOISYLAYER 8 -#define INEFFICIENTLAYER 3 -#define DEADMEZZANINE 4 -#define NOISYMEZZANINE 8 -#define LOWSTATMEZZANINE 7 -#define INEFFICIENTMEZZANINE 10 -#define DEADTUBE 5 -#define NOISYTUBE 8 - -namespace MuonCalib { - -/////////////////////////////////////////////////////////////////////////////////////////////////////// - //methods of class Tube - - Tube::Tube(int the_status, int the_position, Layer *the_layer) { - m_status=the_status; - m_position=the_position; - m_value=-999; //Arbitrary, it makes easier to find tubes which were not filled - m_parent_layer=the_layer; - m_layer=-1; - m_ml=-1; - } - - int Tube::getStatus() { - return m_status; - } - int Tube::getValue() { - return m_value; - } - int Tube::getPosition() { - return m_position; - } - int Tube::getLayer() { - return m_layer; - } - int Tube::getML() { - return m_ml; - } - void Tube::setStatus(int the_status) { - m_status=the_status; - } - void Tube::setValue(int the_value) { - m_value=the_value; - } - void Tube::setPosition(int the_position) { - m_position=the_position; - } - Layer* Tube::getParentLayer() { - return m_parent_layer; - } - void Tube::setLayer(int the_layer) { - m_layer=the_layer; - } - void Tube::setML(int the_ml) { - m_ml=the_ml; - } -////////////////////////////////////////////////////////////////////////////////////////////////////// - //methods of class Layer - - Layer::Layer() { - m_ntubes=0; - m_entries=0; - m_status=10; - m_median=-1; - m_median_deviation=-1; - } - - Tube* Layer::addTube(int the_status, int the_position) { - Tube *t = new Tube(the_status, the_position, this); - m_tubes.push_back(t); - m_ntubes++; - return t; - } - - Tube* Layer::getTube(int the_position) { - return m_tubes[the_position-1]; - } - - int Layer::getNtubes() { - return m_ntubes; - } - - double Layer::getEntries() { - return m_entries; - } - - int Layer::getStatus() { - return m_status; - } - - double Layer::getMedian() { - return m_median; - } - - double Layer::getMedianDeviation() { - return m_median_deviation; - } - - void Layer::setStatus(int the_status) { - m_status=the_status; - for(int i=1; i<=getNtubes(); i++) { - Tube *t=getTube(i); - if(t->getStatus()==0) continue; - t->setStatus(the_status); - } - } - - void Layer::addEntries(double the_entries) { - m_entries+=the_entries; - } - - void Layer::calculateStatistics() { - //calculateStatistics only calculate median and median deviation of the object, not of its sub-objects - //to calculate these values for the whole chamber and its sub-parts, use the method MDTChamber::updateStatistics() - - std::vector<double> values; - - for(int k=1; k<=this->getNtubes(); k++) { - Tube *t= getTube(k); - if((t->getStatus())!=10) continue; - values.push_back(t->getValue()); - - } - //Calculate median - int size=values.size(); - if(size==0) return; - sort(values.begin(), values.end()); - if((size%2)==1) m_median=values[(size-1)/2]; - else m_median=(double)(values[size/2]+values[(size/2)-1])/2.; - - //Calculate median absolute deviation - - for(int i=0; i<size; i++) values[i]=std::abs(values[i]-m_median); - - sort(values.begin(), values.end()); - - if((size%2)==1) m_median_deviation=values[(size-1)/2]; - else m_median_deviation=(double)(values[size/2]+values[(size/2)-1])/2.; - - return; - } - - int Layer::getNrealtubes() { - int ntubes=0; - for(int i=1; i<=getNtubes(); i++) { - Tube *t=getTube(i); - if(t->getStatus()==0) continue; - ntubes++; - } - return ntubes; - } - -////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //methods of class Mezzanine - - Mezzanine::Mezzanine() { - m_entries=0; - m_ntubes=0; - m_status=10; - m_median=-1; - m_median_deviation=-1; - m_70min=-999; - m_70max=-999; - } - void Mezzanine::addTube(Tube *t) { - m_tubes.push_back(t); - m_ntubes++; - } - Tube* Mezzanine::getTube(int the_position) { - return m_tubes[the_position-1]; - } - - int Mezzanine::getNtubes() { - return m_ntubes; - } - int Mezzanine::get70min() { - return m_70min; - } - int Mezzanine::get70max() { - return m_70max; - } - - double Mezzanine::getEntries() { - return m_entries; - } - - int Mezzanine::getStatus() { - return m_status; - } - - double Mezzanine::getMedian() { - return m_median; - } - - double Mezzanine::getMedianDeviation() { - return m_median_deviation; - } - - void Mezzanine::addEntries(double the_entries) { - m_entries+=the_entries; - } - - void Mezzanine::setStatus(int the_status) { - m_status=the_status; - for(int i=1; i<=getNtubes(); i++) { - Tube *t=getTube(i); - if(t->getStatus()==0) continue; - t->setStatus(the_status); - } - } - - void Mezzanine::calculateStatistics() { - //calculateStatistics only calculate median and median deviation of the object, not of its sub-objects - //to calculate these values for the whole chamber and its sub-parts, use the method MDTChamber::updateStatistics() - - //Here we must also compute the entries in mezzanine, because of the way we built it - - std::vector<double> values; - for(int k=1; k<=this->getNtubes(); k++) { - Tube *t= getTube(k); - if((t->getStatus())==0) continue; //Double check just not to lose entries; - this->addEntries(t->getValue()); - if((t->getStatus())!=10) continue; - values.push_back(t->getValue()); - } - //Calculate median - - int size=values.size(); - if(size==0) return; - sort(values.begin(), values.end()); - - m_70min=(int)values[(int)(3.0*(double)size/10.)]; - m_70max=(int)values[(int)(7.0*((double)size/10.))]; - - if((size%2)==1) m_median=values[(size-1)/2]; - else m_median=(double)(values[size/2]+values[(size/2)-1])/2.; - - //Calculate median absolute deviation - - for(int i=0; i<size; i++) values[i]=std::abs(values[i]-m_median); - - sort(values.begin(), values.end()); - - if((size%2)==1) m_median_deviation=values[(size-1)/2]; - else m_median_deviation=(double)(values[size/2]+values[(size/2)-1])/2.; - - return; - } //end Mezzanine::calculateStatistics - - //////////////////////////////////////////////////////////////////////////////////////////////////// - //methods of class Multilayer - - Multilayer::Multilayer() { - m_nlayers=0; - m_entries=0; - m_nmezzanines=0; - m_status=10; - m_median=-1; - m_median_deviation=-1; - } - - void Multilayer::addLayer() { - Layer *l= new Layer(); - m_layers.push_back(l); - m_nlayers++; - } - - Tube* Multilayer::addTube(int the_layer, int the_status, int the_position) { - while(the_layer>getNlayers()) addLayer(); - return (getLayer(the_layer))->addTube(the_status, the_position); - } - Layer* Multilayer::getLayer(int the_position) { - return m_layers[the_position-1]; - } - - Mezzanine* Multilayer::addMezzanine() { - Mezzanine *mezz=new Mezzanine(); - m_mezzanines.push_back(mezz); - m_nmezzanines++; - return mezz; - } - - Mezzanine* Multilayer::getMezzanine(int pos) { - if(pos>=static_cast<int>(m_mezzanines.size())) return NULL; - return m_mezzanines[pos]; - } - - int Multilayer::getNlayers() { - return m_nlayers; - } - int Multilayer::getNmezzanines() { - return m_nmezzanines; - } - double Multilayer::getEntries() { - return m_entries; - } - int Multilayer::getStatus() { - return m_status; - } - double Multilayer::getMedian() { - return m_median; - } - double Multilayer::getMedianDeviation() { - return m_median_deviation; - } - - void Multilayer::setStatus(int the_status) { - m_status=the_status; - for(int i=1; i<=getNlayers(); i++) { - Layer *l=getLayer(i); - l->setStatus(the_status); - } - for(int i=0; i<getNmezzanines(); i++) { - Mezzanine *mezz=getMezzanine(i); - mezz->setStatus(the_status); - } - - } - - void Multilayer::addEntries(double the_entries) { - m_entries+=the_entries; - } - - void Multilayer::calculateStatistics() { - //calculateStatistics only calculate median and median deviation of the object, not of its sub-objects - //to calculate these values for the whole chamber and its sub-parts, use the method MDTChamber::updateStatistics() - - std::vector<double> values; - - for(int j=1; j<=getNlayers(); j++) { - Layer *l=getLayer(j); - for(int k=1; k<=l->getNtubes(); k++) { - Tube *t= l->getTube(k); - if((t->getStatus())!=10) continue; - values.push_back(t->getValue()); - } - } - //Calculate median - - int size=values.size(); - if(size==0) return; - sort(values.begin(), values.end()); - if((size%2)==1) m_median=values[(size-1)/2]; - else m_median=(double)(values[size/2]+values[(size/2)-1])/2.; - - //Calculate median absolute deviation - - for(int i=0; i<size; i++) values[i]=std::abs(values[i]-m_median); - - sort(values.begin(), values.end()); - - if((size%2)==1) m_median_deviation=values[(size-1)/2]; - else m_median_deviation=(double)(values[size/2]+values[(size/2)-1])/2.; - - return; - } //end Multilayer::calculateStatistics - -/////////////////////////////////////////////////////////////////////////////////////////////////////// -//Methods of Class MDTChamber - -//This method reads the reference histograms and builds the chamber with the correct geometry - - MDTChamber::MDTChamber(TH1 *href, TString the_name) : - m_mean(-999.), m_standard_deviation(-999.), m_90min(-1), m_90max(-1), m_70(-1) { - m_nmultilayers=0; - m_entries=0; - m_status=10; - m_name=the_name; - m_median=-1; - m_median_deviation=-1; - - //Now we use a complicated strategy to read the Reference histogram in the correct way; - //the main difficulty is in chambers that have layers smaller than others, so we have to understand - //whether an empty space must be assigned to the end of the previous layer or to the beginning of the - //next one. - //Empty spaces are treated just like tubes, but a special status value NOTUBE is assigned to them, - //and they are ignored in the rest of the analysis. In this way the real tubes are assigned to the - //right positions in the layers. - - int the_multilayer=1; - int the_layer=1; - - int nbins=href->GetNbinsX(); - - int old_layer=the_layer; - bool holesx=false; - int pos=1; - bool newml=true; - bool afterfirstempty=false; - int lastbin=-1; - - for(int bin=1; bin<=nbins; bin++) { - int bincontent=(int)href->GetBinContent(bin); - if((bincontent==0)&&(bin==1)) holesx=true; - if((bincontent!=0)&&(!afterfirstempty))afterfirstempty=true; - if((lastbin!=0)&&(bincontent==0)&&holesx) pos=1; - lastbin=bincontent; - - if(bincontent==0) { - if(holesx==true) { - if(afterfirstempty) { - addTube(the_multilayer,the_layer+1,NOTUBE,pos++); - old_layer=the_layer+1; - } else { - addTube(the_multilayer,the_layer,NOTUBE,pos++); - } - continue; - } else { - addTube(the_multilayer,the_layer, NOTUBE, pos++); - continue; - } - } - if((bincontent>0)&&(newml)) { - the_multilayer=2; - pos=1; - newml=false; - holesx=false; - } - bincontent=std::abs(bincontent); - the_layer=(int)floor(((double)bincontent)/10.); - if(old_layer!=the_layer) { - pos=1; - } - - int the_status; - if((bincontent%10)==0) the_status=10; - else the_status=bincontent%10; - addTube(the_multilayer, the_layer, the_status, pos++); - old_layer=the_layer; - } - //Here we build the mezzanine structure of the chamber - buildMezzanines(); - } - //end MDTChamber::MDTChamber - - void MDTChamber::addMultilayer() { - Multilayer *ml=new Multilayer(); - m_multilayers.push_back(ml); - m_nmultilayers++; - } - Multilayer* MDTChamber::getMultilayer(int the_position) { - return m_multilayers[the_position-1]; - } - Tube* MDTChamber::addTube(int the_multilayer, int the_layer, int the_status, int the_position) { - while(the_multilayer>getNmultilayers()) addMultilayer(); - Tube *t= getMultilayer(the_multilayer)->addTube(the_layer, the_status, the_position); - - if(t!=NULL) { - t->setLayer(the_layer); - t->setML(the_multilayer); - } - return t; - } - - int MDTChamber::getNmultilayers() { - return m_nmultilayers; - } - - double MDTChamber::getEntries() { - return m_entries; - } - - int MDTChamber::getStatus() { - return m_status; - } - - double MDTChamber::getMedian() { - return m_median; - } - - double MDTChamber::getMedianDeviation() { - return m_median_deviation; - } - - double MDTChamber::getMean() { - return m_mean; - } - - double MDTChamber::getStandardDeviation() { - return m_standard_deviation; - } - - TString MDTChamber::getName() { - return m_name; - } - - // These three values are explained later in the tube analysis - int MDTChamber::get90min() { - return m_90min; - } - - int MDTChamber::get90max() { - return m_90max; - } - - int MDTChamber::get70() { - return m_70; - } - - void MDTChamber::setStatus(int the_status) { - m_status=the_status; - for(int i=1; i<=getNmultilayers(); i++) { - Multilayer *ml=getMultilayer(i); - ml->setStatus(the_status); - } - } - - void MDTChamber::addEntries(double the_entries) { - m_entries+=the_entries; - } - - void MDTChamber::buildMezzanines() { - int ntubespermezzanine=0; - int mezzanine=0; - - for(int i=1; i<=getNmultilayers(); i++) { - Multilayer *ml=getMultilayer(i); - for(int j=1; j<=ml->getNlayers();j++) { - if(ml->getNlayers()==3) ntubespermezzanine=8; - if(ml->getNlayers()==4) ntubespermezzanine=6; - if((i==1)&&(getName().Contains("BIR4"))) ntubespermezzanine=3; - //BIR wiht eta=4 are the only chambers with the - Layer *l=ml->getLayer(j); //FIRST mezzanine made off rows of only 4 tubes - int tubeinmezzanine=0; - mezzanine=0; - - for(int k=1; k<=l->getNtubes();k++) { - Tube *t=l->getTube(k); - if((t->getStatus()==0)) continue; - while((mezzanine+1)>ml->getNmezzanines()) ml->addMezzanine(); - Mezzanine *mezz=ml->getMezzanine(mezzanine); - mezz->addTube(t); - //DEBUG - //t->setStatus(mezzanine+1); - // - tubeinmezzanine++; - if(tubeinmezzanine==ntubespermezzanine) { - mezzanine++; - tubeinmezzanine=0; - if(getName().Contains("BIR4")) ntubespermezzanine=6; //Same as before - } - - } - } - } - - return; - } //end MDTChamber::buildMezzanines - - void MDTChamber::calculateStatistics() { - //calculateStatistics only calculate median and median deviation of the object, not of its sub-objects - //to calculate these values for the whole chamber and its sub-parts, use the method MDTChamber::updateStatistics() - - std::vector<double> values; - double sum=0; - int ntubes=0; - for(int i=1; i<=getNmultilayers(); i++) { - Multilayer *ml=getMultilayer(i); - for(int j=1; j<=ml->getNlayers(); j++) { - Layer *l=ml->getLayer(j); - - for(int k=1; k<=l->getNtubes(); k++) { - Tube *t= l->getTube(k); - if((t->getStatus())!=10) continue; - sum+=t->getValue(); - ntubes++; - values.push_back(t->getValue()); - - } - } - } - int size=values.size(); - if(size==0) return; - - //Calculate mean - - if(ntubes!=0) m_mean=sum/(double)ntubes; - else m_mean = -1.; - - //Calulate standard deviation - - double SD =0; - for(int i=0; i<size;i++) SD+=std::pow(m_mean-values[i],2); - m_standard_deviation=std::sqrt(SD/(double)size); - - //Calculate median - sort(values.begin(), values.end()); - - //Here I use this vector to calculate the minumum tube value calculated without the 10% less popoulated tube - //and the maximum tube value calulated without the 10% more popoulated tubes - //and also the maximum tube value calulated without the 30% more popoulated tubes; - //These values are used in the tube analysis - m_90min=(int)values[(int)((double)size/10.)]; - m_90max=(int)values[(int)(9.*((double)size/10.))]; - m_70=(int)values[(int)(7.*((double)size/10.))]; - - if((size%2)==1) m_median=values[(size-1)/2]; - else m_median=(double)(values[size/2]+values[(size/2)-1])/2.; - - - //Calculate median absolute deviation - - for(int i=0; i<size; i++) { - values[i]=std::abs(values[i]-m_median); - } - sort(values.begin(), values.end()); - - if((size%2)==1) m_median_deviation=values[(size-1)/2]; - else m_median_deviation=(values[size/2]+values[(size/2)-1])/2; - - return; - } //end MDTChamber::calculateStatistics - - void MDTChamber::updateStatistics() { - //Recalculate statistics for the whole object and its sub-parts - - this->calculateStatistics(); - - for(int i=1; i<=getNmultilayers(); i++) - { - Multilayer *ml=getMultilayer(i); - for(int j=1; j<=ml->getNlayers(); j++) - { - Layer *l=ml->getLayer(j); - l->calculateStatistics(); - } - for(int j=0; j<ml->getNmezzanines(); j++) - { - Mezzanine *mezz=ml->getMezzanine(j); - mezz->calculateStatistics(); - } - ml->calculateStatistics(); - } - this->calculateStatistics(); - } - - void MDTChamber::Print() { - } //end MDTChamber::Print - - //////////////////////////////////////////////////////////////////////////////////////////////// - //Methods of class MDTDqaDeadElements - - MDTDqaDeadElements::MDTDqaDeadElements() { - m_verbose=false; - m_write_report=true; //Set to true to have a debug report with all the values needed for the analysis - m_write_compact_report=true; //Set to true to have a compact report on dead/noisy objects found - m_do_analysis=true; //Set to true to do the analysis - m_print_chambers=false; //Set to true to print the chambers layout in stdout, usually for debug - m_write_list_of_dead_tubes=false; //Set to true to get in output a list of dead tubes; It doesn't matter - //whether they are in a dead ML, L, mezzanine or they are single dead tubes, - //they are presented one by one in output. - m_do_noisy=false; //Set to true to do the analisys for noisy objects - //Be careful, at the moment it is not well tuned yet - - m_deadtubes=0; - m_deadmezzanines=0; - m_deadlayers=0; - m_deadmultilayers=0; - m_deadchambers=0; - m_lowstatisticschambers=0; - m_lowstatisticsfortubeschambers=0; - m_noisytubes=0; - m_ntubes=0; - m_lowstatmezzanines=0; - - m_dead_tubes_per_sector=0; - m_dead_mezzanines_per_sector=0; - m_dead_layers_per_sector=0; - m_dead_multilayers_per_sector=0; - m_dead_chambers_per_sector=0; - m_lowstat_chambers_per_sector=0; - } - - void MDTDqaDeadElements::setVerbose(bool the_verbose) { - m_verbose=the_verbose; - } - - void MDTDqaDeadElements::setWriteReport(bool the_write_report) { - m_write_report=the_write_report; - } - void MDTDqaDeadElements::setWriteCompactReport(bool the_write_compact_report) { - m_write_compact_report=the_write_compact_report; - } - - void MDTDqaDeadElements::setDoAnalysis(bool the_do_analysis) { - m_do_analysis=the_do_analysis; - } - - void MDTDqaDeadElements::setPrintChambers(bool the_print_chambers) { - m_print_chambers=the_print_chambers; - } - - void MDTDqaDeadElements::setDoNoisy(bool the_do_noisy) { - m_do_noisy=the_do_noisy; - } - - void MDTDqaDeadElements::setWriteListOfDeadTubes(bool the_write_list_of_dead_tubes) { - m_write_list_of_dead_tubes=the_write_list_of_dead_tubes; - } - - void MDTDqaDeadElements::MDTDqaDeadElementsAnalysis(TFile *f) { - //This is the "main" method of the class, it controls the reading, the analysis and the writing of histograms - //calling the appropriate method - - int nregionsanalysed=0; - int nsectorsanalysed=0; - int nchambersanalysed=0; - - if(m_write_report) { - TString filename=f->GetName(); - filename+="_DeadElementsAnalysis_Report.txt"; - m_file_report.open((const char*)filename); - } - if(m_write_compact_report) { - TString filename=f->GetName(); - filename+="_DeadElementsAnalysis_CompactReport.txt"; - m_comp_report.open((const char*)filename); - } - if(m_write_list_of_dead_tubes) { - TString filename=f->GetName(); - filename+="_ListOfDeadTubes.txt"; - m_filelistofdeads.open((const char*)filename); - } - for(int iregion=1; iregion<=4; iregion++) { - std::string region_name; - if(iregion==1) region_name="Barrel_A"; - if(iregion==2) region_name="Barrel_C"; - if(iregion==3) region_name="Endcap_A"; - if(iregion==4) region_name="Endcap_C"; - std::string regiondir_name="/MDT/"+region_name; - - TDirectory* regiondir=(TDirectory*)f->Get(regiondir_name.c_str()); - if(!regiondir) { - continue; - } - TH2F *hsummary=(TH2F*)regiondir->FindObjectAny("DeadElements"); - if(!hsummary) { - continue; - } - hsummary->Reset(); - - if(m_do_analysis)nregionsanalysed++; - - for(int isector=1; isector<=16; isector++) { - //These values are necessary to fill the summary plot "DeadElements" in the region folder - m_dead_tubes_per_sector=0; - m_dead_mezzanines_per_sector=0; - m_dead_layers_per_sector=0; - m_dead_multilayers_per_sector=0; - m_dead_chambers_per_sector=0; - m_lowstat_chambers_per_sector=0; - - TString sector_name=(isector<10)?("Sector0"):("Sector"); - sector_name+=isector; - TDirectory *sectordir=(TDirectory*)regiondir->Get((const char*)sector_name); - - if(!sectordir) { - continue; - } - if(m_do_analysis)nsectorsanalysed++; - - TIter next(sectordir->GetListOfKeys()); - TKey *key; - while((key=(TKey*)next())) { - std::string chamber_name=key->GetName(); - if(chamber_name=="OVERVIEW") continue; - TDirectory *chamberdir=(TDirectory*)sectordir->Get(chamber_name.c_str()); - TDirectory *deadstatusdir=(TDirectory*)sectordir->Get((chamber_name+"/DeadStatus").c_str()); - TDirectory *expertdir=(TDirectory*)sectordir->Get((chamber_name+"/Expert").c_str()); - - if(!chamberdir) { - continue; - } - - if(!deadstatusdir) { - continue; - } - - if(!expertdir) { - continue; - } - - TH1F *hgeom=(TH1F*)expertdir->FindObjectAny("DeadTubeRefMap"); - if(!hgeom) { - continue; - } - MDTChamber *chamber= new MDTChamber(hgeom,TString(chamber_name)); - - TH1F *hadccut=(TH1F*)chamberdir->FindObjectAny("a_HitsPerTubeAdcCut"); - if(!hadccut) { - delete chamber; chamber=0; - continue; - } - TH2F *hdeadchannels=(TH2F*) expertdir->FindObjectAny("ChamberDeadChannels"); - if(!hdeadchannels) { - delete chamber; chamber=0; - continue; - } - TH2F *hdeadtubes=(TH2F*) deadstatusdir->FindObjectAny("ChamberDeadTubes"); - if(!hdeadtubes) { - delete chamber; chamber=0; - continue; - } - TH1F *hdeadmap=(TH1F*) expertdir->FindObjectAny("DeadTubeMap"); - if(!hdeadmap) { - delete chamber; chamber=0; - continue; - } - fillChamber(chamber,hadccut); - - hdeadmap->Reset(); - hdeadchannels->Reset(); - hdeadtubes->Reset(); - - if(m_do_analysis)doAnalysis(chamber); - if(m_print_chambers) chamber->Print(); - if(m_do_analysis) nchambersanalysed++; - - //To fix the correct values in the output histograms - hdeadchannels->SetMinimum(0); - hdeadchannels->SetMaximum(10); - hdeadtubes->SetMinimum(0); - hdeadtubes->SetMaximum(4); - hdeadmap->SetMinimum(-50); - hdeadmap->SetMaximum(50); - - fillDeadMap(chamber,hdeadchannels,hdeadtubes,hdeadmap,deadstatusdir,chamberdir); - - if(m_write_list_of_dead_tubes) PrintListOfDeadTubes(chamber); - delete chamber; chamber=0; - - } - - hsummary->SetBinContent(isector,1,m_lowstat_chambers_per_sector); - hsummary->SetBinContent(isector,2,m_dead_chambers_per_sector); - hsummary->SetBinContent(isector,3,m_dead_multilayers_per_sector); - hsummary->SetBinContent(isector,4,m_dead_layers_per_sector); - hsummary->SetBinContent(isector,5,m_dead_mezzanines_per_sector); - hsummary->SetBinContent(isector,6,m_dead_tubes_per_sector); - - }//end of loop on sectors - }//end of loop on regions - - if(m_write_report) { - m_file_report.close(); - } - if(m_write_compact_report) { - m_comp_report.close(); - } - if(m_write_list_of_dead_tubes) { - m_filelistofdeads.close(); - } - - if(m_write_list_of_dead_tubes) { - TString filename=f->GetName(); - filename+="_DeadElementsAnalysis_Report.txt"; - } - f->Write(); - return; - } //end MDTDqaDeadElements::MDTDqaDeadElementsAnalysis - - void MDTDqaDeadElements::fillChamber(MDTChamber *chamber, TH1 *h) { - //This method fills tubes values - - int nbins=1; - - for(int i=1; i<=chamber->getNmultilayers(); i++) { - int bincontent=-1; - - Multilayer *ml=chamber->getMultilayer(i); - - for(int j=1; j<=ml->getNlayers(); j++) { - Layer *l=ml->getLayer(j); - - for(int k=1; k<=l->getNtubes(); k++) { - Tube *t= l->getTube(k); - bincontent=(int)h->GetBinContent(nbins++); - t->setValue(bincontent); - - //Here we equalize the answer from BOG0,1,2,3 shorter tubes; - - if(((chamber->getName()).Contains("BOG"))&&(!((chamber->getName()).Contains("BOG8")))) { - if(k<=6) t->setValue(t->getValue()*2); - if(k>(l->getNtubes()-6)) t->setValue((int)(t->getValue()*2.2)); - } - - //Add entries to ml,l, chamber; it is necessary to do it - //manually because you first build chamber structure, than you fill it; - //The mezzanine entries are updated later, when you call the mezzanine->calculateStatistics(); - chamber->addEntries(bincontent); - ml->addEntries(bincontent); - l->addEntries(bincontent); - - } - - } - } - } //end MDTDqaDeadElements::fillChamber - - void MDTDqaDeadElements::fillDeadMap(MDTChamber *chamber, TH2F *hdeadchannels, TH2F *hdeadtubes, TH1F *hdeadmap, TDirectory *deadstatusdir, TDirectory *chamberdir ) { - //This method, after the analysis, fills the output histograms - - int ntubes=1; - TH1F *hdeadtubestatus=(TH1F*)chamberdir->FindObjectAny("b_DeadTubeStatus"); - if(!hdeadtubestatus) { - return; - } - hdeadtubestatus->Reset(); - - for(int i=1; i<=chamber->getNmultilayers(); i++) { - Multilayer *ml=chamber->getMultilayer(i); - for(int j=1; j<=ml->getNlayers(); j++) { - Layer *l=ml->getLayer(j); - TString deadlayername="DeadTubes_ML"; - deadlayername+=i; - deadlayername+="_L"; - deadlayername+=j; - int ntubeslayer=1; - - TH1F *hdeadperlayer=(TH1F*)deadstatusdir->FindObjectAny((const char*)deadlayername); - if(!hdeadperlayer) { - continue; - } - hdeadperlayer->Reset(); - - for(int k=1; k<=l->getNtubes(); k++) { - Tube *t= l->getTube(k); - - int iML = i ; - int iLy = j ; - int iTube = k ; - int ibin = (iML-1)*(ml->getNlayers())*(l->getNtubes()) + (iLy-1)*(l->getNtubes())+iTube ; - - if(t->getStatus()==NOTUBE) { - hdeadmap->SetBinContent(ntubes,0); - } else { - int ml; - if(i==1) ml=-1; - else ml=1; - int layer=j; - hdeadmap->SetBinContent(ntubes,ml*(10*layer+(t->getStatus())%10)); - hdeadchannels->SetBinContent(k,j+5*(i-1),t->getStatus()); - double contr=0; - if(t->getStatus()==7) { // status 7 used for lowstat obj - contr=0.5; - } - if(t->getStatus()==0) { // status 0 used for no tube in chamber - hdeadtubes->SetBinContent(k,j+5*(i-1),1); //white - } else if(t->getStatus()==10) { // status 10 used for working obj - contr=1; - hdeadtubes->SetBinContent(k,j+5*(i-1),2); //green - } else if(t->getStatus()==7 ) { - hdeadtubes->SetBinContent(k,j+5*(i-1),3); // yellow - } else { - hdeadtubes->SetBinContent(k,j+5*(i-1),4); // red - } - double contr2=contr ; - if(t->getStatus()!=0 && contr==0) contr2=0.1 ; - if(hdeadperlayer) hdeadperlayer->SetBinContent(ntubeslayer,contr2); - if(hdeadtubestatus) hdeadtubestatus->SetBinContent(ibin,contr2); - ntubeslayer++; - } - ntubes++; - - } - } - } - } //end MDTDqaDeadElements::fillDeadMap - - void MDTDqaDeadElements::doAnalysis(MDTChamber *chamber) { - //This methods decides whether the chamber seems dead as it has MINENTRIES entries, or the chamber has not enough - //statistics to be analysed, or the chamber can be analysed; in the latter case, this method starts the - //analysis on MLs, Layers, Mezzanines, Tubes - - const int MINENTRIES=0; //number of entries under or equal to the chamber is considered empty - const int MINMEDIAN=10; //median of chamber under or equal to you looks to the ratio to decide if you have enough - // statistics - const int MAXRATIO=3; //median/median_dev value; if you are under or equal to MAXRATIO and - //under or equal to MINMEDIAN, the - //chamber has too low statistics and too high fluctuations to be analysed; - - if(m_write_report) m_file_report<<std::endl<<"Analysing Chamber "<<chamber->getName()<<"------------------------"<<std::endl; - - if(chamber->getEntries()<=MINENTRIES) { - chamber->setStatus(DEADCHAMBER); - if(m_write_report) m_file_report<<chamber->getName()<<" Appears to be dead chamber as it has no entries"<<std::endl<<std::endl; - if(m_write_compact_report) m_comp_report<<chamber->getName()<<" dead_CHAMBER"<<std::endl; - m_deadchambers++; - m_dead_chambers_per_sector++; - return; - } - - chamber->calculateStatistics(); - - double median=chamber->getMedian(); - double median_deviation=chamber->getMedianDeviation(); - - double ratio=10; - if((median!=0)&&(median_deviation==0)) ratio=-1; - if((median!=0)&&(median_deviation!=0)) ratio=median/median_deviation; - if(m_write_report) m_file_report<<"entries="<<chamber->getEntries(); - if(m_write_report) m_file_report<<" median= "<<median<<"; median_dev= "<<median_deviation<<"; ratio="<<ratio<<std::endl; - - if((median<=MINMEDIAN)&&(ratio<=MAXRATIO)) { - chamber->setStatus(LOWSTATISTICSCHAMBER); - if(m_write_report) m_file_report<<chamber->getName()<<" Has Low Statistics, it won't be analysed"<<std::endl; - if(m_write_compact_report) m_comp_report<<chamber->getName()<<" LOW STATISTICS"<<std::endl; - m_lowstatisticschambers++; - m_lowstat_chambers_per_sector++; - return; - } - if(m_write_report) m_file_report<<chamber->getName()<<" Has enough statistics, starting other analysis"<<std::endl; - - //Here you start with chamber's sub-parts analysis - - analyseMultilayers(chamber); - analyseLayers(chamber); - analyseMezzanines(chamber); - - chamber->updateStatistics(); //It is necessary to update the chamber statistics because - //dead elements you've found before this point must not be considered - //in median and median deviation value of the chamber in order to analyse the tubes - analyseTubes(chamber); - //reanalyseMezzanines(chamber); - //this method sets a mezzanine as dead if more than 50% of its tubes are dead. For the moment keep it diasbled until the dead tube analysis is fixed - - if(m_write_report) m_file_report<<std::endl<<"END OF ANALYSIS "<<chamber->getName()<<"------------------------"<<std::endl; - if(m_write_report) m_file_report<<std::endl<<std::endl; - /*DEBUG for mezzanines - for(int i=1; i<=chamber->getNmultilayers(); i++) - { - Multilayer *ml=chamber->getMultilayer(i); - for(int j=0; j<ml->getNmezzanines(); j++) - { - (ml->getMezzanine(j))->setStatus(j+1); - } - - } - */ - - } //end MDTDqaDeadElements::doAnalysis - - void MDTDqaDeadElements::analyseMultilayers(MDTChamber *chamber) { - //This method decides whether both multilayers have to low statistics to be compared one with the other one, - //or one of the multilayer gives so much less hits than the other than it is dead or inefficient - //ot the two multilayers gives similar responses, so we assume that they ar both ok; - //If one ML is noisy and the other is ok, the noisy one will appear ok, the other one inefficient or dead; - //here we're assuming that the higher is the better; - - const int MIN_MAXMEDIAN_ML=2; //The low statistic condition is: higher median of the two MLs below MIN_MAXMEDIAN_ML; - - const int MIN_ML_MED=1; //Dead condition is {[(mlmed<MIN_ML_MED)OR(10*mlmed<ml2med)] - const int SPREADDEAD=3; // AND[(mlmed1-mlmed2)/meanmeddev]<-SPREADDEAD - // AND[higher mezzanine med of ml< ml2med-SPREADDEAD*meanmeddev]} - - //The check on the mezzanines is beacuse some chambers have MLs with only 1 mezzanine - //working properly - - const int SPREADINEFFICIENT=5; //Inefficient condition is {[(mlmed-ml2med)/meanmeddev)<-SPREADINEFFICIENT] - // AND[higher mezzanine med of ml< ml2med-SPREADINEFFICIENT*meanmeddev]; - - double maxMLmedian=0; - - for(int i=1; i<=chamber->getNmultilayers(); i++) { - Multilayer *ml=chamber->getMultilayer(i); - ml->calculateStatistics(); - double med=ml->getMedian(); - if(med>maxMLmedian) maxMLmedian=med; - } - if(m_write_report) m_file_report<<"MLs MAXMEDIAN="<<maxMLmedian<<std::endl; - if(maxMLmedian<MIN_MAXMEDIAN_ML) { - if(m_write_report) m_file_report<<"MLs have not enough statistics to be analized"<<std::endl; - return; - } - if(chamber->getNmultilayers()==1) { - if(m_write_report) m_file_report<<"Only 1ML in chamber; ML analysis ok;"<< std::endl; - return; - } - for(int i=1; i<=chamber->getNmultilayers(); i++) { - Multilayer *ml=chamber->getMultilayer(i); - Multilayer *ml2; - if(i==1) ml2=chamber->getMultilayer(i+1); - else ml2=chamber->getMultilayer(i-1); - - double maxMezzMed=0; - - for(int j=0; j<ml->getNmezzanines(); j++) { - Mezzanine *mezz=ml->getMezzanine(j); - mezz->calculateStatistics(); - double medmezz=mezz->getMedian(); - if(medmezz>maxMezzMed) maxMezzMed=medmezz; - } - - double meanMedDev=(ml->getMedianDeviation()+ml2->getMedianDeviation())/2.; - double diff=ml->getMedian()-ml2->getMedian(); - - double diffToOther=diff/meanMedDev; - if(m_write_report) m_file_report<<"ML"<<i<<"entries="<<ml->getEntries(); - if(m_write_report) m_file_report<<"; median="<<ml->getMedian()<<"; diffToOther="<<diffToOther<<"; "; - if(m_write_report) m_file_report<<"maxMezzMed="<<maxMezzMed<<std::endl; - - int contr=0; - if((ml->getMedian()<=MIN_ML_MED)||((10*ml->getMedian())<ml2->getMedian())) { - if(diffToOther<-SPREADDEAD) { - if(maxMezzMed<(ml2->getMedian()-SPREADDEAD*meanMedDev)) { - if(m_write_report) m_file_report<<"ML "<<i<<" seems to be dead ML"<<std::endl; - if(m_write_compact_report) m_comp_report<<chamber->getName()<<" dead_MULTILAYER "<<i<<std::endl; - ml->setStatus(DEADML); - m_deadmultilayers++; - m_dead_multilayers_per_sector++; - contr=1; - } - } - } else if((diffToOther<-SPREADINEFFICIENT)&&(maxMezzMed<(ml2->getMedian()-SPREADINEFFICIENT*meanMedDev))) { - if(m_write_report) m_file_report<<"ML "<<i<<" seems to be inefficient ML"<<std::endl; - if(m_write_compact_report) m_comp_report<<chamber->getName()<<" inefficient_MULTILAYER "<<i<<std::endl; - ml->setStatus(INEFFICIENTML); - m_deadmultilayers++; - m_dead_multilayers_per_sector++; - contr=1; - } - - if(contr==0) {if(m_write_report) m_file_report<<"ML "<<i<<" OK"<<std::endl;} - - } - return; - } //end MDTDqaDeadElements::analyseMultilayers - - void MDTDqaDeadElements::analyseLayers(MDTChamber *chamber) { - //This method first of all decides if layers have or not enough statistics to be analysed; - //then it compares layers with all other layers of the whole chamber in order to find dead or inefficient ones - - const int MIN_MAXLAYER_MED=2; //If max median of layers is below this value, the statistics is too low to analyze them; - - const int MIN_LAYER_MED=2; //Dead condition is {[ lmed<MINLAYERMED]} - const int SPREADDEAD=3; // AND{[(lmed-medofotherlayersmed)/medofotherlayersmeddev]<-SPREADDEAD - const int MIN_OTHERMEDIANS_DEAD=50; // OR[medianofothermedians>MIN_OTHERMEDIANS_DEAD]} - // AND{[maxMezzMedian<(medofothermed-SPREADDEAD*medofothermeddev)] - // OR[maxMezzMedian<=MIN_OTHERMEDIANS_DEAD]} - - - const int SPREADINEFFICIENT=5; // Inefficient condition is - // {[(lmed-medofotherlayersmed)/medofotherlayersmeddev]<-SPREADINEFFICIENT} - // AND {maxMezzMedian<(medofothermed-SPREADINEFFICIENT*medofothermeddev)} - - const int SPREADHOT=100; //These values used for the hot layers analysis need to be tuned - const int MINMEDHOT=100; - - double maxMedianLayers=0; - - for(int i=1; i<=chamber->getNmultilayers(); i++) { - Multilayer *ml=chamber->getMultilayer(i); - if(ml->getStatus()!=10) continue; - for(int j=1; j<=ml->getNlayers(); j++) { - Layer *l=ml->getLayer(j); - l->calculateStatistics(); - double med=l->getMedian(); - if(med>maxMedianLayers) maxMedianLayers=med; - } - - } - if(maxMedianLayers<MIN_MAXLAYER_MED) { - if(m_write_report) m_file_report<<"Layers without enough statistics, not analysed"<<std::endl; - return; - } - - for(int i=1; i<=chamber->getNmultilayers(); i++) { - Multilayer *ml=chamber->getMultilayer(i); - if(ml->getStatus()!=10) continue; - for(int j=1; j<=ml->getNlayers(); j++) { - Layer *l=ml->getLayer(j); - //double med=l->getMedian(); - double medianOfOtherMedians=0; - double medianOfOtherMediansDevs=0; - - std::vector<double> values; - std::vector<double> values_dev; - - double maxMezzMedian=0; - - for(int k=0; k<ml->getNmezzanines(); k++) { - Mezzanine *mezz=ml->getMezzanine(k); - std::vector<double> values_mezz; - for(int y=1; y<=mezz->getNtubes(); y++) { - Tube *t=mezz->getTube(y); - if(t->getStatus()!=10) continue; - if(t->getParentLayer()!=l) continue; - values_mezz.push_back(t->getValue()); - } - int size_mezz=values_mezz.size(); - double mezzmed; - sort(values_mezz.begin(), values_mezz.end()); - if((size_mezz%2)==1) mezzmed=values_mezz[(size_mezz-1)/2]; - else mezzmed=(double)(values_mezz[size_mezz/2]+values_mezz[(size_mezz/2)-1])/2.; - if (mezzmed>maxMezzMedian) maxMezzMedian=mezzmed; - } - for(int k=1; k<=chamber->getNmultilayers(); k++) { - Multilayer *ml2=chamber->getMultilayer(k); - for(int t=1; t<=ml2->getNlayers(); t++) { - Layer *l2=ml->getLayer(t); - if (l2==l) continue; - values.push_back(l2->getMedian()); - values_dev.push_back(l2->getMedianDeviation()); - } - } - - int size=values.size(); - sort(values.begin(), values.end()); - if((size%2)==1) medianOfOtherMedians=values[(size-1)/2]; - else medianOfOtherMedians=(double)(values[size/2]+values[(size/2)-1])/2.; - - int size_dev=values_dev.size(); - sort(values_dev.begin(), values_dev.end()); - if((size_dev%2)==1) medianOfOtherMediansDevs=values_dev[(size_dev-1)/2]; - else medianOfOtherMediansDevs=(values_dev[size_dev/2]+values_dev[(size_dev/2)-1])/2.; - - int contr=0; - double diff=l->getMedian()-medianOfOtherMedians; - double diffToOthers; - if(diff==0) diffToOthers=0; - else { - if(medianOfOtherMediansDevs==0) diffToOthers=100; - else diffToOthers=diff/medianOfOtherMediansDevs; - } - if(m_write_report) m_file_report<<"Layer"<<j<<" entries= "<<l->getEntries()<<" median="<<l->getMedian()<<"; diffToOther="<<diffToOthers<<"; "; - if(m_write_report) m_file_report<<"medianOfOthersMedian="<<medianOfOtherMedians<<"; "; - if(m_write_report) m_file_report<<"medianOfOthersMedianDev="<<medianOfOtherMediansDevs<<"; "; - if(m_write_report) m_file_report<<"maxMezzMedian="<<maxMezzMedian<<std::endl; - - if((diffToOthers>SPREADHOT)&&(l->getMedian()>MINMEDHOT)) { - if(!m_do_noisy) continue; - - if(m_write_report) m_file_report<<"ML "<<i<<" Layer "<<j<<" seems to be noisy layer"<<std::endl; - if(m_write_compact_report) m_comp_report<<chamber->getName()<<" noisy_LAYER "<<i<<" "<<j<<std::endl; - l->setStatus(NOISYLAYER); - contr=1; - } - - if(l->getMedian()<MIN_LAYER_MED) { - if((diffToOthers<=-SPREADDEAD)||(medianOfOtherMedians>MIN_OTHERMEDIANS_DEAD)) { - if((maxMezzMedian<(medianOfOtherMedians-SPREADDEAD*medianOfOtherMediansDevs))||(maxMezzMedian<=MIN_OTHERMEDIANS_DEAD)) { - if(m_write_report) m_file_report<<"ML "<<i<<" Layer "<<j<<" seems to be dead layer"<<std::endl; - if(m_write_compact_report) m_comp_report<<chamber->getName()<<" dead_LAYER "<<i<<" "<<j<<std::endl; - l->setStatus(DEADLAYER); - m_deadlayers++; - m_dead_layers_per_sector++; - contr=1; - } - } - } else if((diffToOthers<-SPREADINEFFICIENT)&&(maxMezzMedian<(medianOfOtherMedians-SPREADINEFFICIENT*medianOfOtherMediansDevs))) { - if(m_write_report) m_file_report<<"ML "<<i<<" Layer "<<j<<" seems to be inefficient layer"<<std::endl; - if(m_write_compact_report) m_comp_report<<chamber->getName()<<" inefficient_LAYER "<<i<<" "<<j<<std::endl; - l->setStatus(INEFFICIENTLAYER); - m_deadlayers++; - m_dead_layers_per_sector++; - contr=1; - } - if(contr==0) {if(m_write_report) m_file_report<<"ML "<<i<<" Layer "<<j<<" ok"<<std::endl;} - - } - } - - return; - - } //end MDTDqaDeadElements::analyseLayers - - void MDTDqaDeadElements::reanalyseMezzanines(MDTChamber *chamber) { - for(int i=1; i<=chamber->getNmultilayers(); i++) { - Multilayer *ml=chamber->getMultilayer(i); - if(ml->getStatus()!=10) continue; - for(int j=0; j<ml->getNmezzanines(); j++) { - Mezzanine *mezz=ml->getMezzanine(j); - int ntubes=0; - int ndeadtubes=0; - for(int k=1; k<=mezz->getNtubes(); k++) { - Tube *t=mezz->getTube(k); - if(t->getStatus()==0) continue; - ntubes++; - if(t->getStatus()==DEADTUBE) ndeadtubes++; - } - if(ntubes==0) continue; - else if((double)((double)ndeadtubes/(double)ntubes)>0.5) { - if(m_write_report) m_file_report<<"ML "<<i<<" Mezzanine "<<j<<" appears to be dead mezzanine"<<std::endl; - if(m_write_compact_report) m_comp_report<<chamber->getName()<<" dead_MEZZANINE_rean "<<i<<" "<<j<<std::endl; - mezz->setStatus(DEADMEZZANINE); - //m_dead_tubes_per_sector-=ntubes; - m_dead_tubes_per_sector-=ndeadtubes; - // m_deadtubes-=ntubes; - m_deadtubes-=ndeadtubes; - m_dead_mezzanines_per_sector++; - m_deadmezzanines++; - - } - } - } - - } //end MDTDqaDeadElements::reanalyseMezzanines - - void MDTDqaDeadElements::analyseMezzanines(MDTChamber *chamber) { - //This method first of all decides if mezzanines have or not enough statistics to be analysed; - //then it compares mezzanines with all other mezzanines of the whole chamber in order to find dead or inefficient ones; - //Because of some chambers that suffers of complex geometry/trigger effects, showing very uneven distributions - //here we define a flatness value, and use different strategy for "normal" chambers and "strang" chambers; - - //Chamber flatness is a value defined as medianDeviationOfMezzanineMedians/medianOfMezzanineMediansDeviation - //A chamber is considered flat if this value is <=1; - - const int MIN_MAXMEDIAN=2; //If max median of mezzanines is below this value, the statistics is to low to analyze them - - -// const int MIN_ENTRIES=1; //Dead condition: {[mezz.entries<=MINENTRIES] -// const int SPREADDEAD=5; // AND[diffToOthers<-SPREADDEAD]} - -// const int SPREADINEFFICIENT=10; //Inefficient condition: - //flat chambers: [diffToOthers<=-SPREADINEFFICIENT]; - //unflat chambers: [diffToOthers<=-SPREADINEFFICIENT*chamberflatness]; - //chamber with flatness>5 not analyzed - -// const int SPREADHOT=10; //The noisy mezzanine analysis needs to be tuned - - double maxMedianMezzanines=0; - - double medianOfMedians=0; - double medianOfMediansDeviation=0; - double medianDeviationOfMedians=0; - - std::vector<double> values; - std::vector<double> values_dev; - - for(int i=1; i<=chamber->getNmultilayers(); i++) { - Multilayer *ml=chamber->getMultilayer(i); - if(ml->getStatus()!=10) continue; - for(int j=0; j<ml->getNmezzanines(); j++) { - Mezzanine *mezz=ml->getMezzanine(j); - mezz->calculateStatistics(); //It is necessary to recalculate the statistics in order to exclude dead layers - double med=mezz->getMedian(); - values.push_back(med); - values_dev.push_back(mezz->getMedianDeviation()); - if(med>maxMedianMezzanines) maxMedianMezzanines=med; - } - - } - int size=values.size(); - sort(values.begin(), values.end()); - if((size%2)==1) medianOfMedians=values[(size-1)/2]; - else medianOfMedians=(double)(values[size/2]+values[(size/2)-1])/2.; - - for(int l=0; l<size; l++) values[l]=std::abs(values[l]-medianOfMedians); - sort(values.begin(), values.end()); - if((size%2)==1) medianDeviationOfMedians=values[(size-1)/2]; - else medianDeviationOfMedians=(double)(values[size/2]+values[(size/2)-1])/2.; - - int size_dev=values_dev.size(); - sort(values_dev.begin(), values_dev.end()); - if((size_dev%2)==1) medianOfMediansDeviation=values_dev[(size_dev-1)/2]; - else medianOfMediansDeviation=(double)(values_dev[size_dev/2]+values_dev[(size_dev/2)-1])/2.; - - double chamberFlatness=medianDeviationOfMedians/medianOfMediansDeviation; - - if(maxMedianMezzanines<MIN_MAXMEDIAN) { - if(m_write_report) m_file_report<<"Mezzanines without enough statistics, not analysed"<<std::endl; - return; - } - if(m_write_report) m_file_report<<"ChamberFlatness="<<chamberFlatness<<std::endl; - - for(int i=1; i<=chamber->getNmultilayers(); i++) { - Multilayer *ml=chamber->getMultilayer(i); - Multilayer *other_ml=NULL; - if(chamber->getNmultilayers()>1) { - if(i==1) other_ml=chamber->getMultilayer(2); - if(i==2) other_ml=chamber->getMultilayer(1); - } - - if(ml->getStatus()!=10) continue; - - for(int j=0; j<ml->getNmezzanines(); j++) { - Mezzanine *mezz=ml->getMezzanine(j); - if(mezz->getNtubes()==0) continue; - double med=mezz->getMedian(); - double meddev=mezz->getMedianDeviation(); - double medianOfOtherMedians=0; - double medianOfOtherMediansDevs=0; - - std::vector<double> values; - std::vector<double> values_dev; - - double minOtherLargerMedians=-1; - - for(int k=1; k<=chamber->getNmultilayers(); k++) { - Multilayer *ml2=chamber->getMultilayer(k); - if(ml2->getStatus()!=10) continue; - - for(int t=0; t<ml2->getNmezzanines(); t++) { - - Mezzanine *mezz2=ml2->getMezzanine(t); - if (mezz2==mezz) continue; - values.push_back(mezz2->getMedian()); - values_dev.push_back(mezz2->getMedianDeviation()); - if((minOtherLargerMedians==-1)||((mezz2->getMedian()>med)&&(mezz2->getMedian()<minOtherLargerMedians))) { - minOtherLargerMedians=mezz2->getMedian(); - } - } - } - - int size=values.size(); - sort(values.begin(), values.end()); - if((size%2)==1) medianOfOtherMedians=values[(size-1)/2]; - else medianOfOtherMedians=(double)(values[size/2]+values[(size/2)-1])/2.; - - int size_dev=values_dev.size(); - sort(values_dev.begin(), values_dev.end()); - if((size_dev%2)==1) medianOfOtherMediansDevs=values_dev[(size_dev-1)/2]; - else medianOfOtherMediansDevs=(values_dev[size_dev/2]+values_dev[(size_dev/2)-1])/2.; - - //int contr=0; - double diff=mezz->getMedian()-medianOfOtherMedians; - double diffToOthers; - diffToOthers=diff/(std::max(1.,std::max(mezz->getMedianDeviation(),medianOfOtherMediansDevs))); - - std::vector<Mezzanine*> near_mezz; - - //lowstat case - bool isLowStat=false; - if(med>0&&meddev>0&&((med-1.5*meddev)<0)) isLowStat=true; - if(isLowStat) { - mezz->setStatus(LOWSTATMEZZANINE); - m_lowstatmezzanines++; - continue; - } - - if(j>0) { - if(ml->getMezzanine(j-1)!=NULL) { - near_mezz.push_back(ml->getMezzanine(j-1)); - } - } - if(j<(ml->getNmezzanines()-1)) { - if(ml->getMezzanine(j+1)!=NULL) { - near_mezz.push_back(ml->getMezzanine(j+1)); - } - } - if(other_ml!=NULL) { - if(other_ml->getMezzanine(j)!=NULL) { - near_mezz.push_back(other_ml->getMezzanine(j)); - } - } - - if(near_mezz.size()>0) { - bool isDead=false; - bool OneGood=false; - double lower_limit=9999999; - for(unsigned int k=0; k<near_mezz.size(); k++) { - double other_min70=near_mezz[k]->get70min(); - OneGood=true; - if(other_min70<lower_limit) lower_limit=other_min70; - } - - double max70= mezz->get70max(); - if(OneGood&&max70<(lower_limit/5.)&&(lower_limit>5)&&med==0) isDead=true; - if(isDead) { - if(m_write_report) m_file_report<<chamber->getName()<<" ML "<<i<<" Mezzanine "<<j<<" appears to be dead_mezzanine; low_limit="<<lower_limit<<" median="<<med<<std::endl; - if(m_write_compact_report) m_comp_report<<chamber->getName()<<" dead_MEZZANINE "<<i<<" "<<j<<std::endl; - mezz->setStatus(DEADMEZZANINE); - m_deadmezzanines++; - m_dead_mezzanines_per_sector++; - } - - } - if(mezz->getStatus()==10 && med<10) { //med=10 is compatible with 0! - mezz->setStatus(LOWSTATMEZZANINE); - m_lowstatmezzanines++; - continue; - } - if(m_write_report) m_file_report<<"ML"<<i<<" mezz"<<j<<": med="<<mezz->getMedian()<<"; "<<" mad="<<mezz->getMedianDeviation(); - if(m_write_report) m_file_report<<"medev"<<medianOfOtherMediansDevs<<"; "; - if(m_write_report) m_file_report<<"entries="<<mezz->getEntries()<<"; diffToOthers="<<diffToOthers<<"; "; - if(m_write_report) m_file_report<<"minlargermed="<<minOtherLargerMedians<<std::endl; - if(m_write_report) m_file_report<<"inefficient if med below="; - if(m_write_report) m_file_report<<(minOtherLargerMedians-5*medianOfOtherMediansDevs)<<std::endl; - - } - } - - return; - - } //end MDTDqaDeadElements::analyseMezzanines - - void MDTDqaDeadElements::analyseTubes(MDTChamber *chamber) { - //This method first of all decides if the chamber has enough statistics to analyze single tubes - //then it search for dead tubes - - //There are chambers which looks completely dead except one mezzanine; finding them using median criteria is impossible - //they just looks like LOW STATISTICS chambers; so, before the low statistics check, I' ve implemented another one - //If, after ML, L, Mezz analysis, more than 70% of chambers tubes has 0 entries and there is a mezzanine - //with a median.=50, than the chamber is signed as DEAD, to show that there is a big problem. - - const int MINCHAMBERMED=20; //chambers with med<MINCHAMBERMED are considered to have - //too low statistics to analyze single tubes - - const int SPREADDEAD=5; //Dead condition {[tube.entries<(chambermed-SPREADDEAD*chambermemddev)] - // AND[tube.entries<(chambermed/10)]AND[chambermed>=MINCHAMBERMED]} - // OR{tube.entries==0 AND chambermed>=50} - - //Because of chambers with geometry/trigger effects, some tubes which actually are dead - //cannot be found (this is whem chambermeddev is very high) - //So, I've added a new check: a tube is considered dead also if it has less than - //10% entries respect to the tube with the minimum value of the chamber calculated excluding - //the 10% less popoulate tubes of the chamber; - - //The noisy tubes analysis is not used for now - - int ndeadtubes=0; - int nnoisytubes=0; - if(m_write_report) m_file_report<<"Starting Tube Analysis"<<std::endl; - - double median=chamber->getMedian(); - //double median_deviation=chamber->getMedianDeviation(); - double standard_deviation=chamber->getStandardDeviation(); - - double maxMezzMed=0; - - for(int i=1; i<=chamber->getNmultilayers(); i++) { - Multilayer *ml=chamber->getMultilayer(i); - if(ml->getStatus()!=10) continue; - for(int j=0; j<ml->getNmezzanines(); j++) { - Mezzanine *mezz=ml->getMezzanine(j); - if(mezz->getMedian()>maxMezzMed) maxMezzMed=mezz->getMedian(); - } - - } - if((maxMezzMed>=50)&&(chamber->get70()==0)) { - chamber->setStatus(DEADCHAMBER); - if(m_write_report) m_file_report<<chamber->getName()<<" Appears to be a chamber with only few live tubes"<<std::endl<<std::endl; - if(m_write_compact_report) m_comp_report<<chamber->getName()<<" strange_CHAMBER"<<std::endl; - m_deadchambers++; - m_dead_chambers_per_sector++; - return; - - } - - if(median<MINCHAMBERMED) { - m_lowstatisticsfortubeschambers++; - m_lowstat_chambers_per_sector++; - if(m_write_report) m_file_report<<"This chamber has too low statistics to analyze single tubes"<<std::endl; - if(m_write_compact_report) m_comp_report<<chamber->getName()<<" LOW STATISTICS FOR TUBES"<<std::endl; - for(int i=1; i<=chamber->getNmultilayers(); i++) { - Multilayer *ml=chamber->getMultilayer(i); - if(ml->getStatus()!=10) continue; - for(int j=1; j<=ml->getNlayers(); j++) { - Layer *l=ml->getLayer(j); - if(l->getStatus()!=10) continue; - for(int k=1; k<=l->getNtubes(); k++) { - Tube *t=l->getTube(k); - if(t->getStatus()!=10) continue; - t->setStatus(LOWSTATISTICSCHAMBER); - } - } - } - - return; - } - - double marco_limit=0.1*(chamber->get90min())-1.; - - for(int i=1; i<=chamber->getNmultilayers(); i++) { - Multilayer *ml=chamber->getMultilayer(i); - if(ml->getStatus()!=10) continue; - double medML=ml->getMedian(); - double medDevML=ml->getMedianDeviation(); - double limit=medML-SPREADDEAD*medDevML; - - if(m_write_report) { - m_file_report<<"ML"<<i<<" Tube Limit="<<limit<<"; medML="<<medML<<" ;medDevML="<<medDevML<<"; medML/10="<<((double)medML/10.)<<"; tube noisy over="<<(10*standard_deviation+median)<<" marcolimit="<<marco_limit<<std::endl; - } - - for(int j=0; j<ml->getNmezzanines(); j++) { - Mezzanine *mezz=ml->getMezzanine(j); - if(mezz->getStatus()!=10) continue; - double marco_limitMezz=0.1*mezz->get70min()-1; - for(int k=1; k<=mezz->getNtubes(); k++) { - - Tube *t=mezz->getTube(k); - if(t->getStatus()!=10) continue; - m_ntubes++; - int value=t->getValue(); - if(value<marco_limitMezz) { - if(m_write_compact_report) m_comp_report<<chamber->getName()<<" dead_TUBE "<<t->getML()<<" "<<t->getLayer()<<" "<<t->getPosition()<<std::endl; - t->setStatus(DEADTUBE); - ndeadtubes++; - m_deadtubes++; - m_dead_tubes_per_sector++; - } - } - } - } - if(m_write_report) m_file_report<<"End of tube analysis; "<<ndeadtubes<<"dead tubes found"<<nnoisytubes<<"noisy tubes found"<<std::endl; - - } //end MDTDqaDeadElements::analyseTubes - - void MDTDqaDeadElements::PrintListOfDeadTubes(MDTChamber *chamber) { - - for(int i=1; i<=chamber->getNmultilayers(); i++) { - Multilayer *ml=chamber->getMultilayer(i); - for(int j=1; j<=ml->getNlayers(); j++) { - Layer *l=ml->getLayer(j); - for(int k=1; k<=l->getNtubes(); k++) { - Tube *t=l->getTube(k); - if((t->getStatus()==10)||(t->getStatus()==0)) continue; - m_filelistofdeads<<"Chamber "<<chamber->getName()<<" ML "<<i<<" L "<<j<<" Tube "<<k<<" DEAD"<<std::endl; - } - } - } - return; - } //end MDTDqaDeadElements::PrintListOfDeadTubes - -} //namespace MuonCalib - diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/src/MDTName.cxx b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/src/MDTName.cxx deleted file mode 100644 index ca1c4d701472569054884616af827fe92a39e3ae..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/src/MDTName.cxx +++ /dev/null @@ -1,306 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -#include "MuonCalibStandAloneExtraTools/MDTName.h" - -namespace MuonCalib { - - MDTName::MDTName() : m_eta_on(-1), m_eta_off(-1), m_sector_on(-1), m_sector_off(-1), m_side('X') - {} - - MDTName::MDTName(const MuonFixedId& the_id) { - m_name=TString(the_id.stationNameString()); - m_eta_off=the_id.eta(); - m_eta_on=std::abs(m_eta_off); - if(m_eta_off<0) m_side='C'; - if(m_eta_off>=0) m_side='A'; - //Here chambers with eta=0 are included in m_side A; - m_sector_off=the_id.phi(); - if((m_name[2]=='L')||(m_name[2]=='M')||(m_name[2]=='R')) m_sector_on=((the_id.phi())*2)-1; - else m_sector_on=((the_id.phi())*2); - if((m_name=="BML")&&(m_sector_on==13)&&(m_eta_off>3)) m_eta_on++; - if((m_name=="BML")&&(m_sector_on==13)&&(m_eta_off<(-3))) m_eta_on++; - if(((m_sector_on==12)||(m_sector_on==14))&&(m_name=="BOF")) { - m_eta_on=m_eta_on*2-1; - } - if(((m_sector_on==12)||(m_sector_on==14))&&(m_name=="BOG")){ - m_eta_on=m_eta_on*2; - } - if((m_name=="EIL")&&((m_sector_on==1)||(m_sector_on==9))&&((m_eta_on==4)||(m_eta_on==5))) { - if(m_eta_on==4) m_eta_on=5; - else m_eta_on=4; - } - if((m_name=="EEL")&&(m_sector_on==5)&&(m_eta_on==1)) { - m_eta_on=2; - } - } - - MDTName::MDTName(const std::string& the_name) { - TString s(the_name); - MDTName_init(s); - } - - MDTName::MDTName(const char *the_name) { - TString s(the_name); - MDTName_init(s); - } - - MDTName::MDTName(const TString& the_name) { - MDTName_init(the_name); - } - - MDTName::MDTName(const std::string& the_name, const int sector, const int eta) { - TString temp=the_name; - temp+="_"; - temp+=sector; - temp+="_"; - temp+=eta; - MDTName_init(temp); - } - - MDTName::MDTName(const std::string& the_name, const int eta, const std::string& side, const int sector) { - TString temp=the_name; - temp+=eta; - temp+=side; - temp+=sector; - MDTName_init(temp); - } - - void MDTName::MDTName_init(const TString& name) { - TString the_name(name); - the_name.ToUpper(); - m_name=the_name(0,3); - if(the_name.Contains('_')) { - the_name.Remove(0,4); - m_sector_off=(TString(the_name(0,1))).Atoi(); - the_name.Remove(0,2); - if(the_name.Contains('-')) { - m_eta_off=the_name.Atoi(); - m_side='C'; - m_eta_on=std::abs(m_eta_off); - } else { - m_eta_off=the_name.Atoi(); - m_side='A'; - //Here chambers with eta=0 are included in m_side A; - //if(m_eta_off==0) m_side='B'; - m_eta_on=m_eta_off; - } - - if((m_name[2]=='L')||(m_name[2]=='M')||(m_name[2]=='R')) m_sector_on=(m_sector_off*2)-1; - else m_sector_on=2*m_sector_off; - - if((m_name=="BML")&&(m_sector_on==13)&&(m_eta_off>3)) m_eta_on++; - if((m_name=="BML")&&(m_sector_on==13)&&(m_eta_off<-3)) m_eta_on++; - - if(((m_sector_on==12)||(m_sector_on==14))&&(m_name=="BOF")) { - m_eta_on=m_eta_on*2-1; - } - if(((m_sector_on==12)||(m_sector_on==14))&&(m_name=="BOG")) { - m_eta_on=m_eta_on*2; - } - if((m_name=="EIL")&&((m_sector_on==1)||(m_sector_on==9))&&((m_eta_on==4)||(m_eta_on==5))) { - if(m_eta_on==4) m_eta_on=5; - else m_eta_on=4; - } - if((m_name=="EEL")&&(m_sector_on==5)&&(m_eta_on==1)) { - m_eta_on=2; - } - - } else { - the_name.Remove(0,3); - m_eta_on=(TString(the_name(0,1))).Atoi(); - the_name.Remove(0,1); - m_side=the_name[0]; - the_name.Remove(0,1); - m_sector_on=the_name.Atoi(); - - if((m_name[2]=='L')||(m_name[2]=='M')||(m_name[2]=='R')) m_sector_off=(m_sector_on+1)/2; - else m_sector_off=m_sector_on/2; - if(m_side=='C') m_eta_off=-m_eta_on; - else m_eta_off=m_eta_on; - - if((m_name=="BML")&&(m_sector_on==13)&&(m_eta_on>4)&&(m_side=='A')) m_eta_off--; - if((m_name=="BML")&&(m_sector_on==13)&&(m_eta_on>4)&&(m_side=='C')) m_eta_off++; - - if((m_name=="EEL")&&(m_sector_on==5)&&(m_eta_on==2)) { - if(m_side=='A') m_eta_off=1; - if(m_side=='C') m_eta_off=-1; - } - - if(((m_sector_on==12)||(m_sector_on==14))&&(m_name=="BOF")) { - if(m_side=='A') { - m_eta_off=(m_eta_on+1)/2; - } else { - m_eta_off=-(m_eta_on+1)/2; - } - } - if(((m_sector_on==12)||(m_sector_on==14))&&(m_name=="BOG")) { - if(m_side=='A') { - m_eta_off=(m_eta_on)/2; - } else { - m_eta_off=-(m_eta_on)/2; - } - } - if((m_name=="EIL")&&((m_sector_on==1)||(m_sector_on==9))&&((m_eta_on==4)||(m_eta_on==5))) { - if(m_side=='A') { - if(m_eta_on==4) m_eta_off=5; - else m_eta_off=4; - } else { - if(m_eta_on==4) m_eta_off=-5; - else m_eta_off=-4; - } - } - - } - } //end MDTName::MDTName_init - - std::string MDTName::getOnlineName() { - TString the_name(m_name); - the_name+=m_eta_on; - the_name+=m_side; - if(m_sector_on<10) the_name+="0"; - the_name+=m_sector_on; - return (std::string)the_name; - } - - std::string MDTName::getOfflineName() { - TString the_name(m_name); - the_name+='_'; - the_name+=m_sector_off; - the_name+='_'; - the_name+=m_eta_off; - return (std::string)the_name; - } - - bool MDTName::isBarrel() { - if((m_name=="BIS")&&(m_eta_on==7)) return false; - if((m_name=="BIS")&&(m_eta_on==8)) return false; - if((m_name=="BEE")) return false; - if(m_name[0]=='B') return true; - return false; - } - - bool MDTName::isEndcap() { - if(m_name[0]=='E') return true; - if((m_name=="BIS")&&(m_eta_on==7)) return true; - if((m_name=="BIS")&&(m_eta_on==8)) return true; - if((m_name=="BEE")) return true; - return false; - } - - bool MDTName::isInner() { - if(m_name[1]=='I') return true; - return false; - } - - bool MDTName::isMiddle() { - if(m_name[1]=='M') return true; - return false; - } - - bool MDTName::isOuter() { - if(m_name[1]=='O') return true; - return false; - } - - bool MDTName::isExtra() { - if(m_name[1]=='E') return true; - return false; - } - - bool MDTName::isForward() { - if (m_eta_off>=0) return true; //Here chambers with eta=0 are treated as Forward - return false; - } - - bool MDTName::isBackward() { - if(m_eta_off<0) return true; - return false; - } - - bool MDTName::isLarge() { - if(m_name[2]=='L') return true; - return false; - } - - bool MDTName::isSmall() { - if(m_name[2]=='S') return true; - return false; - } - - int MDTName::getOnlineSector() { - return m_sector_on; - } - - int MDTName::getOfflineSector() { - return m_sector_off; - } - - int MDTName::getOnlineEta() { - return m_eta_on; - } - - int MDTName::getOfflineEta() { - return m_eta_off; - } - - std::string MDTName::getRegion() { - std::string temp="Barrel"; - if(this->isEndcap()) temp="Endcap"; - return temp; - } - - std::string MDTName::getStation() { - std::string temp=""; - temp+=m_name[1]; - return temp; - } - - std::string MDTName::getSize() { - std::string temp=""; - temp+=m_name[2]; - return temp; - } - - std::string MDTName::getSide() { - std::string temp=""; - temp+=m_side; - return temp; - } - - std::string MDTName::getName() { - return (std::string)m_name; - } - - TString MDTName::OnlineToOfflineName(const TString& the_name) { - MDTName temp(the_name); - return temp.getOfflineName(); - } - - TString MDTName::OnlineToOfflineName(const char *the_name) { - MDTName temp(the_name); - return temp.getOfflineName(); - } - - TString MDTName::OnlineToOfflineName(const std::string& the_name) { - MDTName temp(the_name); - return temp.getOfflineName(); - } - - TString MDTName::OfflineToOnlineName(const TString& the_name) { - MDTName temp(the_name); - return temp.getOnlineName(); - } - - TString MDTName::OfflineToOnlineName(const char* the_name) { - MDTName temp(the_name); - return temp.getOnlineName(); - } - - TString MDTName::OfflineToOnlineName(const std::string& the_name) { - MDTName temp(the_name); - return temp.getOnlineName(); - } - -} //namespace MuonCalib diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/src/MdtDqaDb.cxx b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/src/MdtDqaDb.cxx deleted file mode 100644 index aa55ef10b14cad889012753e96f849b7c13e6b0c..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/src/MdtDqaDb.cxx +++ /dev/null @@ -1,179 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -#include "MuonCalibStandAloneExtraTools/MdtDqaDb.h" - -#include <iostream> -#include <fstream> -#include <sstream> -#include <map> -#include <string.h> -#include <vector> - -MdtDqaDb::MdtDqaDb(std::string chamName) : m_numNoisyMezz(-1), m_numNoisyTube(-1) { - Clear(); - m_chamberName = chamName; -} -MdtDqaDb::MdtDqaDb() : m_numNoisyMezz(-1), m_numNoisyTube(-1) { - Clear(); -} - -MdtDqaDb::~MdtDqaDb() {} - -void MdtDqaDb::Clear() { - m_listDeadML.clear(); - m_listDeadMezz.clear(); - m_listDeadTube.clear(); - m_listNoisyMezz.clear(); - m_listNoisyTube.clear(); - m_chamberName = ""; - m_t0ML1 = -1; - m_t0ML2 = -1; - m_tdriftML1 = -1; - m_tdriftML2 = -1; - m_chi2ndofML1 = -1; - m_chi2ndofML2 = -1; - m_t0errML1 = -1; - m_t0errML2 = -1; - m_tdrifterrML1 = -1; - m_tdrifterrML2 = -1; - m_numDeadML = -1; - m_numDeadMezz = -1; - m_numDeadTube = -1; - m_timeFlag = -1; - m_deadFlag = -1; -} - -void MdtDqaDb::Print(std::ofstream *outputFile) { - *outputFile << " ==================================================== " << std::endl ; - *outputFile << " MdtDqaDb output: ---- Chamber name : " << m_chamberName << std::endl ; - *outputFile << " timeFlag : " << getTimeFlag() << std::endl ; - *outputFile << " deadFlag : " << getDeadFlag() << std::endl ; - *outputFile << " chi2 per dof ML1 : " << m_chi2ndofML1 << std::endl ; - *outputFile << " chi2 per dof ML2 : " << m_chi2ndofML2 << std::endl ; - *outputFile << " t0 ML1 (ns) " << m_t0ML1 << " +/- " << m_t0errML1 << std::endl ; - *outputFile << " t0 ML2 (ns) " << m_t0ML2 << " +/- " << m_t0errML2 << std::endl ; - *outputFile << " tdrift ML1 (ns) " << m_tdriftML1 << " +/- " << m_tdrifterrML1 << std::endl ; - *outputFile << " tdrift ML2 (ns) " << m_tdriftML2 << " +/- " << m_tdrifterrML2 << std::endl ; - - *outputFile << " Number of Dead ML : " << m_numDeadML << " ---- list of dead/inefficient Multilayers : " << std::endl ; - for ( int n=0 ; n< m_numDeadML ; n++ ) *outputFile << m_listDeadML[n] << std::endl ; - *outputFile << " Number of Dead Mezzanine : " << m_numDeadMezz << " ---- list of dead/inefficient Mezzanine : " << std::endl ; - for ( int n=0 ; n< m_numDeadMezz ; n++ ) *outputFile << m_listDeadMezz[n] << std::endl ; - *outputFile << " Number of Dead Tubes : " << m_numDeadTube << " ---- list of dead/inefficient Tubes : " << std::endl ; - for ( int n=0 ; n< m_numDeadTube ; n++ ) *outputFile << m_listDeadTube[n] << std::endl ; - - *outputFile << std::endl ; -} - -void MdtDqaDb::Print() { -} - -void MdtDqaDb::SetChamberName(std::string chamName) { - m_chamberName = chamName; -} - -void MdtDqaDb::SetTimeFlag(int timeFlag) { - m_timeFlag = timeFlag; -} - -void MdtDqaDb::SetDeadFlag(int deadFlag) { - m_deadFlag = deadFlag; -} - -void MdtDqaDb::SetML1(float t0, float tdrift, float chi2ndof, float t0err, float tdrifterr) { - m_t0ML1 = t0; - m_tdriftML1 = tdrift; - m_chi2ndofML1 = chi2ndof; - m_t0errML1 = t0err; - m_tdrifterrML1 = tdrifterr; -} - -void MdtDqaDb::SetML2(float t0, float tdrift, float chi2ndof, float t0err, float tdrifterr) { - m_t0ML2 = t0; - m_tdriftML2 = tdrift; - m_chi2ndofML2 = chi2ndof; - m_t0errML2 = t0err; - m_tdrifterrML2 = tdrifterr; -} - -void MdtDqaDb::SetDeadML(std::vector<int> deadML) { - m_listDeadML = deadML; - m_numDeadML = m_listDeadML.size(); -} - -void MdtDqaDb::SetDeadMezz(std::vector<int> deadMezz) { - m_listDeadMezz = deadMezz; - m_numDeadMezz = m_listDeadMezz.size(); -} - -void MdtDqaDb::SetDeadTube(std::vector<int> deadTube) { - m_listDeadTube = deadTube; - m_numDeadTube = m_listDeadTube.size(); -} - -void MdtDqaDb::SetNoisyMezz(std::vector<std::pair<int,float> > noisyMezz) { - m_listNoisyMezz = noisyMezz; - m_numNoisyMezz = m_listNoisyMezz.size(); -} - -void MdtDqaDb::SetNoisyTube(std::vector<std::pair<int, float> > noisyTube) { - m_listNoisyTube = noisyTube; - m_numNoisyTube = m_listNoisyTube.size(); -} - -//Get methods -std::string MdtDqaDb::getChamberName() { return m_chamberName; } - -int MdtDqaDb::getTimeFlag() { - if(m_timeFlag == -1) { //calculate m_timeFlag if needed - int timeFlag = 0 ; - // HERE the LIMITS are ...CARVED OUT OF THE ROCK ! - float limit_chi2Min = 0.1 ; - float limit_chi2Max = 10. ; - float limit_tdriftMin = 600. ; - float limit_tdriftMax = 760. ; - - if (m_chi2ndofML1 < limit_chi2Min || m_chi2ndofML1 > limit_chi2Max ) timeFlag++ ; - if (m_chi2ndofML2 < limit_chi2Min || m_chi2ndofML2 > limit_chi2Max ) timeFlag++ ; - if (m_tdriftML1 < limit_tdriftMin || m_tdriftML1 > limit_tdriftMax ) timeFlag++ ; // HERE also the error should be taken into account - if (m_tdriftML2 < limit_tdriftMin || m_tdriftML2 > limit_tdriftMax ) timeFlag++ ; // HERE also the error should be taken into account - - m_timeFlag = timeFlag ; - } - return m_timeFlag; -} //end MdtDqaDb::getTimeFlag - -int MdtDqaDb::getDeadFlag() { - if(m_deadFlag == -1) { - int deadFlag = 0 ; - // HERE the LIMITS are ...CARVED OUT OF THE ROCK ! - if ( m_numDeadML > 0 || m_numDeadMezz > 0 || m_numDeadTube > 0 ) deadFlag = 1 ; - - m_deadFlag = deadFlag ; - } - return m_deadFlag ; -} - -int MdtDqaDb::getNumDeadML() { return m_numDeadML; } -int MdtDqaDb::getNumDeadMezz() { return m_numDeadMezz; } -int MdtDqaDb::getNumDeadTube() { return m_numDeadTube; } -int MdtDqaDb::getNumNoisyMezz() { return m_numNoisyMezz; } -int MdtDqaDb::getNumNoisyTube() { return m_numNoisyTube; } -float MdtDqaDb::getT0ML1() { return m_t0ML1; } -float MdtDqaDb::getT0ML2() { return m_t0ML2; } -float MdtDqaDb::getTdriftML1() { return m_tdriftML1; } -float MdtDqaDb::getTdriftML2() { return m_tdriftML2; } -float MdtDqaDb::getChi2ndofML1() { return m_chi2ndofML1; } -float MdtDqaDb::getChi2ndofML2() { return m_chi2ndofML2; } -float MdtDqaDb::getT0errML1() { return m_t0errML1; } -float MdtDqaDb::getT0errML2() { return m_t0errML2; } -float MdtDqaDb::getTdrifterrML1() { return m_tdrifterrML1; } -float MdtDqaDb::getTdrifterrML2() { return m_tdrifterrML2; } -std::vector<int> MdtDqaDb::getDeadML() { return m_listDeadML; } -std::vector<int> MdtDqaDb::getDeadMezz() { return m_listDeadMezz; } -std::vector<int> MdtDqaDb::getDeadTube() { return m_listDeadTube; } -std::vector<std::pair<int,float> > MdtDqaDb::getNoisyMezz() { return m_listNoisyMezz; } -std::vector<std::pair<int,float> > MdtDqaDb::getNoisyTube() { return m_listNoisyTube; } - diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/src/MdtDqaGlobalTimeFit.cxx b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/src/MdtDqaGlobalTimeFit.cxx deleted file mode 100644 index d8af9658827956c1ecd1cac94e87fb7cf9d1dace..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/src/MdtDqaGlobalTimeFit.cxx +++ /dev/null @@ -1,482 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -// standard C++ // -#include <iostream> -#include <fstream> -#include <string> -#include <vector> -#include <cstdlib> - -// MuonReadoutGeometry // -#include "MuonReadoutGeometry/MuonDetectorManager.h" -#include "MuonReadoutGeometry/MdtReadoutElement.h" - -#include "MuonCalibITools/IIdToFixedIdTool.h" -#include "MdtCalibInterfaces/IMdtSegmentFitter.h" - -#include "MuonCalibStandAloneExtraTools/HistogramManager.h" -#include "MuonCalibStandAloneExtraTools/MdtDqaGlobalTimeFit.h" -#include "MuonCalibStandAloneExtraTools/PhiEtaUtils.h" - -// MuonCalib // -#include "MuonCalibEventBase/MuonCalibRawHitCollection.h" -#include "MuonCalibEventBase/MuonCalibRawMdtHit.h" -#include "MuonCalibEventBase/MuonCalibSegment.h" -#include "MdtCalibFitters/QuasianalyticLineReconstruction.h" -#include "MuonCalibEventBase/MuonCalibEvent.h" - -// Rt stuff ------ -#include "MdtCalibData/IRtRelation.h" -#include "MdtCalibUtils/GlobalTimeFitter.h" - -#include "MdtCalibData/RtRelationLookUp.h" -#include "MdtCalibData/RtFullInfo.h" -#include "MdtCalibData/MdtCalibrationFactory.h" - -#include "MdtCalibFitters/LocalSegmentResolver.h" -#include "MdtCalibFitters/DCSLFitter.h" - -//this -#include "MuonCalibStandAloneBase/NtupleStationId.h" -#include "MuonCalibStandAloneBase/RegionSelectionSvc.h" - -//root -#include "TFile.h" -#include "TH1.h" -#include "TNtuple.h" -#include "TString.h" -#include "TDirectory.h" -#include "TMath.h" // for TMath::Prob() - -//:::::::::::::::::::::::: -//:: NAMESPACE SETTINGS :: -//:::::::::::::::::::::::: - -namespace MuonCalib { - -//***************************************************************************** - -MdtDqaGlobalTimeFit::MdtDqaGlobalTimeFit(int nbHitsMin, int nbHitsMax, float chi2cut, int BfieldON, bool debug) : - m_detMgr(nullptr), - m_id_tool(nullptr), - p_reg_sel_svc(nullptr), - m_histoManager(nullptr), - m_rtRel(nullptr), - m_muFitter(nullptr), - m_GTFitter(nullptr) -{ - m_minNumHits = nbHitsMin; - m_maxNumHits = nbHitsMax; - m_chi2_cut = chi2cut; - m_BfieldON = BfieldON; - m_debug = debug; -} - -//::::::::::::::::: -//:: METHOD init :: -//::::::::::::::::: - -StatusCode MdtDqaGlobalTimeFit::initialize(const MuonGM::MuonDetectorManager *detMgr, - const MuonCalib::IIdToFixedIdTool *id_tool, RegionSelectionSvc *reg_sel_svc, - HistogramManager *histoManager) { - - m_detMgr = detMgr; - m_id_tool = id_tool; - p_reg_sel_svc = reg_sel_svc; - m_histoManager = histoManager; - - m_muFitter = new DCSLFitter(); - - m_rtRel = getDefaultRtRelation(m_BfieldON); - m_GTFitter = new GlobalTimeFitter(m_muFitter, m_rtRel); - - return StatusCode::SUCCESS; -} //end MdtDqaGlobalTimeFit::initialize - -//***************************************************************************** - - //:::::::::::::::::::::::: - //:: METHOD handleEvent :: - //:::::::::::::::::::::::: - -StatusCode MdtDqaGlobalTimeFit::handleEvent( const MuonCalibEvent & /*event*/, - int /*eventnumber*/, - const std::vector<MuonCalibSegment *> &segments, - unsigned int position) { - - if (segments.size()<=position) return StatusCode::SUCCESS; - for (unsigned int k=position; k<segments.size(); k++) { // LOOP OVER SEGMENTS - - MuonCalibSegment segment(*segments[k]); - - //---------------// - //-- Variables --// - //---------------// - - int nhits = (int) segment.mdtHitsOnTrack(); - bool REFIT_GTFIT = true; // THIS SHOULD BE PASSED VIA JOBOPTIONS !!!!!!!!!!!!! - // station identifiers // - - MuonFixedId Mid((segment.mdtHOT()[0])->identify()); - - //this has to be set in order to get the m_detMgr->getMdtReadoutElement() method working correctly - //otherwise also for the first multilayer, the second is returned - Mid.setMdtMultilayer(1); - - //----------// - //-- Hits --// - //----------// - - if(nhits<m_minNumHits || nhits>m_maxNumHits) continue; - - // - // Get REGION and STATION of the segment : - // - // and access to MdtDqa histograms - // - // TFile * mdtDqaRoot = m_histoManager->rootFile(); - ToString ts; - int stationNameId = Mid.stationName(); - int phi = Mid.phi(); - int eta = Mid.eta(); - int absEta = eta; - if (eta<0) absEta=-eta; - std::string stationNameStr = Mid.stationNameString(); - - // - // HERE WE LIMIT THE ANALYSIS TO BM(L,S) and EM(L,S) CHAMBERS : - // - if ( !(stationNameStr.substr(0,2)=="BM" || stationNameStr.substr(0,2)=="EM") ) continue; - - std::string region = "Barrel"; - if ( stationNameStr.substr(0,1) == "E" ) region = "Endcap"; - std::string side = "A"; - if (eta<0) side = "C"; - - PhiEtaNameConverter phiEtaConverter; - std::string chamberType = stationNameStr; - - std::string fullStationName = chamberType+"_"+ts(phi)+"_"+ts(eta); - - int sector = phiEtaConverter.phi_8to16(stationNameId,phi); - - TH1F *h1; - TH2F *h2; - - float toffset(999.); - if ( REFIT_GTFIT ) toffset =m_GTFitter->GTFit(&segment); - - float SegChi2DoF = segment.chi2(); - int DoF = segment.mdtHitsOnTrack() - 2; - if ( REFIT_GTFIT ) DoF = DoF-1; - float SegChi2 = SegChi2DoF*((float)DoF); - - - if (SegChi2DoF<=m_chi2_cut){ // chi2DoF cut - // get MDT coordinates from first hit - // (this can be changed in future by averaging over the hit for example) - - // TRY THE FOLLOWING - float distRO = (segment.mdtHOT()[0])->distanceToReadout(); // along the tube - float tube = (float) ((segment.mdtHOT()[0])->identify()).mdtTube(); - - // FILLING Histograms - // - std::string histoType; - - std::string station = "undefined"; - if ( region == "Barrel" )station = "BM"; - if ( region == "Endcap" )station = "EM"; - - histoType="TrigTime_"+station+"_eta_"+ts(absEta); - h1 = (TH1F*) m_histoManager->GetTDaqHisto(histoType,region,side,sector); - if (h1) { - h1->Fill(toffset); - } - - histoType="TrigTimeVsROdistance_"+station+"_eta_"+ts(absEta); - - h2 = (TH2F*) m_histoManager->GetTDaqHisto(histoType,region,side,sector); - if (h2) h2->Fill(distRO,toffset); - - histoType="TriggerCoverage_"+station+"_eta_"+ts(absEta); - h2 = (TH2F*) m_histoManager->GetTDaqHisto(histoType,region,side,sector); - if (h2) h2->Fill(distRO,tube); - - histoType="Segment_chi2"; - h2 = (TH2F*) m_histoManager->GetTDaqHisto(histoType,region,side,sector); - if (h2) h2->Fill(SegChi2DoF,absEta); - - histoType="Segment_ProbChi2"; - h1 = (TH1F*) m_histoManager->GetTDaqHisto(histoType,region,side,sector); - if (h1) h1->Fill(TMath::Prob(SegChi2,DoF)); - - histoType="HitsOnSegment"; - h2 = (TH2F*) m_histoManager->GetTDaqHisto(histoType,region,side,sector); - if (h2) h2->Fill(segment.mdtHitsOnTrack(),absEta); - - histoType="HitRadius"; - h1 = (TH1F*) m_histoManager->GetTDaqHisto(histoType,region,side,sector); - for (std::vector<MdtCalibHitBase*>::iterator it =segment.mdtHOTBegin(); - it!=segment.mdtHOTEnd();++it) { - - float radius=(*it)->driftRadius(); - - if ((*it)->signedDistanceToTrack()<0.) radius=-radius; - if (h1) h1->Fill(radius); - } - - histoType="Residuals"; - h2 = (TH2F*) m_histoManager->GetTDaqHisto(histoType,region,side,sector); - for (std::vector<MdtCalibHitBase*>::iterator it =segment.mdtHOTBegin(); - it!=segment.mdtHOTEnd();++it) { - float resid=(*it)->radialResidual(); - if (h2) h2->Fill(resid,absEta); - } - - histoType="ResidualsVsRadius"; - h2 = (TH2F*) m_histoManager->GetTDaqHisto(histoType,region,side,sector); - for (std::vector<MdtCalibHitBase*>::iterator it =segment.mdtHOTBegin(); - it!=segment.mdtHOTEnd();++it) { - float resid=(*it)->radialResidual(); - float radius=(*it)->driftRadius(); - if ((*it)->signedDistanceToTrack()<0.) radius=-radius; - if (h2) h2->Fill(radius,resid); - } - - } // End if over chi2DoF - } // end LOOP OVER SEGMENTS - - return StatusCode::SUCCESS; -} //end MdtDqaGlobalTimeFit::handleEvent - -//***************************************************************************** - - //:::::::::::::::::::::::::::: - //:: METHOD analyseSegments :: - //:::::::::::::::::::::::::::: -StatusCode MdtDqaGlobalTimeFit::analyseSegments(const std::vector<MuonCalibSegment *> & /*segments*/) { - return StatusCode::SUCCESS; -} - -IRtRelation *MdtDqaGlobalTimeFit::getDefaultRtRelation(int BfieldON ) { - MuonCalib::CalibFunc::ParVec rtPars; - rtPars.push_back( -50. ); // t_Start - rtPars.push_back( 8. ); // t_binSize - - // B field is OFF : - if ( BfieldON == 0) { - rtPars.push_back(0.2); // r(-50) - rtPars.push_back(0.2); // r(-50+8) - rtPars.push_back(0.2); // ... - rtPars.push_back(0.25); - rtPars.push_back(0.294403); - rtPars.push_back(0.311703); - rtPars.push_back(0.485873); - rtPars.push_back(0.804235); - rtPars.push_back(1.19624); - rtPars.push_back(1.5562); - rtPars.push_back(1.91466); - rtPars.push_back(2.3147); - rtPars.push_back(2.66996); - rtPars.push_back(3.05436); - rtPars.push_back(3.40371); - rtPars.push_back(3.80574); - rtPars.push_back(4.13506); - rtPars.push_back(4.45473); - rtPars.push_back(4.77338); - rtPars.push_back(5.05294); - rtPars.push_back(5.33755); - rtPars.push_back(5.58459); - rtPars.push_back(5.8718); - rtPars.push_back(6.09389); - rtPars.push_back(6.37129); - rtPars.push_back(6.56824); - rtPars.push_back(6.73359); - rtPars.push_back(6.96923); - rtPars.push_back(7.16944); - rtPars.push_back(7.38872); - rtPars.push_back(7.55627); - rtPars.push_back(7.73885); - rtPars.push_back(7.86403); - rtPars.push_back(8.07223); - rtPars.push_back(8.26818); - rtPars.push_back(8.39531); - rtPars.push_back(8.54069); - rtPars.push_back(8.69377); - rtPars.push_back(8.86487); - rtPars.push_back(9.01724); - rtPars.push_back(9.16516); - rtPars.push_back(9.24791); - rtPars.push_back(9.45596); - rtPars.push_back(9.56237); - rtPars.push_back(9.69553); - rtPars.push_back(9.80647); - rtPars.push_back(9.9432); - rtPars.push_back(10.039); - rtPars.push_back(10.207); - rtPars.push_back(10.2884); - rtPars.push_back(10.3977); - rtPars.push_back(10.6045); - rtPars.push_back(10.6181); - rtPars.push_back(10.7883); - rtPars.push_back(10.9057); - rtPars.push_back(10.9908); - rtPars.push_back(11.1615); - rtPars.push_back(11.2359); - rtPars.push_back(11.3409); - rtPars.push_back(11.4451); - rtPars.push_back(11.5412); - rtPars.push_back(11.6896); - rtPars.push_back(11.7487); - rtPars.push_back(11.8853); - rtPars.push_back(11.9571); - rtPars.push_back(12.0381); - rtPars.push_back(12.1739); - rtPars.push_back(12.2601); - rtPars.push_back(12.3892); - rtPars.push_back(12.4406); - rtPars.push_back(12.5809); - rtPars.push_back(12.6297); - rtPars.push_back(12.7495); - rtPars.push_back(12.8314); - rtPars.push_back(12.9463); - rtPars.push_back(13.0487); - rtPars.push_back(13.1337); - rtPars.push_back(13.2417); - rtPars.push_back(13.2706); - rtPars.push_back(13.3917); - rtPars.push_back(13.5107); - rtPars.push_back(13.60); - rtPars.push_back(13.69); - rtPars.push_back(13.71); - rtPars.push_back(13.8088); - rtPars.push_back(13.8577); - rtPars.push_back(14.0212); - rtPars.push_back(14.0671); - rtPars.push_back(14.1225); - rtPars.push_back(14.2112); - rtPars.push_back(14.3113); - rtPars.push_back(14.3747); - rtPars.push_back(14.3531); - rtPars.push_back(14.4799); - rtPars.push_back(14.458); - rtPars.push_back(14.516); - rtPars.push_back(14.8312); - rtPars.push_back(14.85); - rtPars.push_back(14.86); - rtPars.push_back(14.87); - - } - // B field is ON : - if ( BfieldON == 1) { - rtPars.push_back(0.2); - rtPars.push_back(0.2); - rtPars.push_back(0.2); - rtPars.push_back(0.22); - rtPars.push_back(0.27); - rtPars.push_back(0.33); - rtPars.push_back(0.37); - rtPars.push_back(0.460902); - rtPars.push_back(0.805728); - rtPars.push_back(1.10767); - rtPars.push_back(1.53996); - rtPars.push_back(1.9101); - rtPars.push_back(2.36668); - rtPars.push_back(2.71068); - rtPars.push_back(3.06689); - rtPars.push_back(3.41867); - rtPars.push_back(3.78364); - rtPars.push_back(4.11741); - rtPars.push_back(4.41084); - rtPars.push_back(4.73491); - rtPars.push_back(5.02635); - rtPars.push_back(5.24373); - rtPars.push_back(5.5519); - rtPars.push_back(5.80729); - rtPars.push_back(5.98834); - rtPars.push_back(6.26835); - rtPars.push_back(6.42993); - rtPars.push_back(6.62648); - rtPars.push_back(6.85403); - rtPars.push_back(6.99663); - rtPars.push_back(7.21787); - rtPars.push_back(7.32455); - rtPars.push_back(7.64958); - rtPars.push_back(7.73685); - rtPars.push_back(7.90371); - rtPars.push_back(8.0533); - rtPars.push_back(8.18414); - rtPars.push_back(8.44938); - rtPars.push_back(8.60877); - rtPars.push_back(8.65394); - rtPars.push_back(8.84461); - rtPars.push_back(8.95214); - rtPars.push_back(9.14024); - rtPars.push_back(9.24901); - rtPars.push_back(9.37823); - rtPars.push_back(9.5724); - rtPars.push_back(9.60793); - rtPars.push_back(9.74432); - rtPars.push_back(9.89992); - rtPars.push_back(10.0009); - rtPars.push_back(10.1321); - rtPars.push_back(10.187); - rtPars.push_back(10.3244); - rtPars.push_back(10.4858); - rtPars.push_back(10.6038); - rtPars.push_back(10.7109); - rtPars.push_back(10.8385); - rtPars.push_back(10.8563); - rtPars.push_back(10.977); - rtPars.push_back(11.0865); - rtPars.push_back(11.2767); - rtPars.push_back(11.3279); - rtPars.push_back(11.4734); - rtPars.push_back(11.5325); - rtPars.push_back(11.6352); - rtPars.push_back(11.793); - rtPars.push_back(11.8545); - rtPars.push_back(11.9321); - rtPars.push_back(12.0367); - rtPars.push_back(12.091); - rtPars.push_back(12.1884); - rtPars.push_back(12.3246); - rtPars.push_back(12.3793); - rtPars.push_back(12.5348); - rtPars.push_back(12.6328); - rtPars.push_back(12.7038); - rtPars.push_back(12.7699); - rtPars.push_back(12.9211); - rtPars.push_back(12.9866); - rtPars.push_back(13.0501); - rtPars.push_back(13.1832); - rtPars.push_back(13.2441); - rtPars.push_back(13.2971); - rtPars.push_back(13.4107); - rtPars.push_back(13.562); - rtPars.push_back(13.5098); - rtPars.push_back(13.6794); - rtPars.push_back(13.7281); - rtPars.push_back(13.8953); - rtPars.push_back(13.9238); - rtPars.push_back(14.0338); - rtPars.push_back(14.0898); - rtPars.push_back(14.1931); - rtPars.push_back(14.2 ); - rtPars.push_back(14.4053); - rtPars.push_back(14.41 ); - rtPars.push_back(14.4481); - rtPars.push_back(14.4606); - rtPars.push_back(14.49); - rtPars.push_back(14.5283); - } - - IRtRelation *rt = MuonCalib::MdtCalibrationFactory::createRtRelation( "RtRelationLookUp", rtPars ); - - return rt; -} //end MdtDqaGlobalTimeFit::getDefaultRtRelation - -} // namespace MuonCalib diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/src/MdtDqaNtupleAnalysis.cxx b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/src/MdtDqaNtupleAnalysis.cxx deleted file mode 100644 index 52ca5b25428f4fde34e81f3dfb0fbdb806c595e2..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/src/MdtDqaNtupleAnalysis.cxx +++ /dev/null @@ -1,1018 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -#include "MuonCalibStandAloneExtraTools/MdtDqaNtupleAnalysis.h" - -#include "MuonCalibStandAloneExtraTools/PhiEtaUtils.h" -#include "MuonCalibStandAloneExtraTools/MDTName.h" - -#include "MuonCalibStandAloneExtraTools/HistogramManager.h" -#include "MuonCalibStandAloneExtraTools/MDTDeadElementsAnalysis.h" -#include "MuonCalibStandAloneExtraTools/MDTDqaDeadElements.h" -#include "MuonCalibStandAloneExtraTools/TimeAndAdcFitter.h" - -//CalibNtupleAnalysis container classes -#include "CalibNtupleUtils/TimedSegment.h" -#include "MuonCalibEventBase/MuonCalibEvent.h" -#include "MuonCalibEventBase/MdtCalibHitBase.h" -#include "MuonCalibEventBase/MuonCalibRawHitCollection.h" -#include "MuonCalibEventBase/MuonCalibTruthCollection.h" -#include "MuonCalibEventBase/MuonCalibTruth.h" -#include "MuonCalibEventBase/MuonCalibMdtTruthHit.h" -#include "MuonCalibEventBase/MuonCalibRawMdtHit.h" - -//MuonCalib container classes -#include "MuonCalibEventBase/MuonCalibPattern.h" -#include "MuonCalibEventBase/MuonCalibSegment.h" - -#include "TKey.h" -#include "TF1.h" -#include "TH1F.h" -#include "TH2F.h" - -namespace MuonCalib { - -//==================================================================================== -MdtDqaNtupleAnalysis::MdtDqaNtupleAnalysis(bool verbose, std::string outputFileName) : - m_histoManager(NULL), m_DeadElementsAlgorithm(-1), m_SectorMin(-1), m_SectorMax(-1), - m_analyseBarrel(false), m_analyseEndcapA(false), m_analyseEndcapC(false), m_ADCCUT(-1.) { - m_verbose = verbose ; - m_outputFileName = outputFileName ; - p_reg_sel_svc = NULL ; -} - -//==================================================================================== -StatusCode MdtDqaNtupleAnalysis::initialize(RegionSelectionSvc *reg_sel_svc, HistogramManager *histoManager, int DeadElementsAlgorithm, float ADCCUT) { - p_reg_sel_svc = reg_sel_svc; - m_histoManager = histoManager; - m_DeadElementsAlgorithm = DeadElementsAlgorithm; - m_ADCCUT=ADCCUT; - - PhiEtaNameConverter phiEtaConverter; - std::string testName="BIL1A01"; - MDTName NameConverter(testName); - m_SectorMin = 20; - m_SectorMax = 0; - const std::vector<MuonCalib::NtupleStationId> stationsInRegion = p_reg_sel_svc->GetStationsInRegions(); - std::vector<MuonCalib::NtupleStationId>::const_iterator itstation; - for (itstation = stationsInRegion.begin(); itstation!=stationsInRegion.end(); itstation++) { - int stationNameId = itstation->GetStation(); - int phi = itstation->GetPhi(); - int sector = phiEtaConverter.phi_8to16(stationNameId,phi); - if(sector>m_SectorMax) m_SectorMax = sector; - if(sector<m_SectorMin) m_SectorMin = sector; - } - - m_evtCounter=0; - - return StatusCode::SUCCESS; -} - -//==================================================================================== -void MdtDqaNtupleAnalysis::handleEvent( const MuonCalibEvent& event, int /*eventnumber*/, -const std::vector<MuonCalibSegment *> &/*segments*/,unsigned int /*position*/){ - - std::string histoType; - - TFile *mdtDqaRoot = m_histoManager->rootFile(); - - float ADCCUT=m_ADCCUT; - - if( !p_reg_sel_svc){ - return; - } - - ToString ts; - PhiEtaNameConverter phiEtaConverter; - - //Event counting - m_evtCounter++; - - // Some checks. ..... ----------------------- - int minNumberHits = 0; - int maxNumberHits = 1000000; - int minEventCounter = 0; - int maxEventCounter = 10000000; - - const MuonCalibRawHitCollection* rawColl = event.rawHitCollection(); - - // SELECT RANGE IN EVENT COUNTER !!!!!! - if( m_evtCounter<minEventCounter || m_evtCounter>maxEventCounter ) return; - - if( rawColl->numberOfMuonCalibRawMdtHits() + event.numberOfHits() > maxNumberHits) return; - if( rawColl->numberOfMuonCalibRawMdtHits() + event.numberOfHits() < minNumberHits) return; - //------------------------------------------------------------------------------ - - MuonCalibRawHitCollection::MuonCalibRawMdtHitVecCit rmdt_hit_it = rawColl->rawMdtHitCollectionBegin(); - MuonCalibRawHitCollection::MuonCalibRawMdtHitVecCit rmdt_hit_it_end = rawColl->rawMdtHitCollectionEnd(); - - //===== RAW HITS LOOP =========================================================== - - const int nStations=36; - const int nEta=8; - const int nSectors=16; - const int nSides=2; - int chamberMulti[nSides][nSectors][nStations][nEta]; - int chamberMultiAdcCut[nSides][nSectors][nStations][nEta]; - - for(int iside=0;iside<nSides;iside++){ - for(int isec=0;isec<nSectors;isec++){ - for(int istation=0;istation<nStations;istation++){ - for(int ieta=0;ieta<nEta;ieta++){ - chamberMulti[iside][isec][istation][ieta]=0; - chamberMultiAdcCut[iside][isec][istation][ieta]=0; - }}}} - - // === RAW HITS LOOP START ======================================================= - for(; rmdt_hit_it!=rmdt_hit_it_end; ++rmdt_hit_it){ - - if (p_reg_sel_svc->isInRegion((*rmdt_hit_it)->identify())) { - - MuonFixedId id = (*rmdt_hit_it)->identify(); - - MDTName chamb(id); - - int rawCharge = (*rmdt_hit_it)->adcCount(); - int rawTime = (*rmdt_hit_it)->tdcCount(); - - int rstn=id.stationName(); - int rphi2=chamb.getOnlineSector(); - - double localPos_y = (*rmdt_hit_it)->localPosition().y(); - double localPos_z = (*rmdt_hit_it)->localPosition().z(); - - bool doSector=false; - if(rphi2>= m_SectorMin && rphi2<=m_SectorMax) doSector=true; - if(!doSector) continue; - - std::string region = chamb.getRegion(); - // THE FOLLOWING ASSIGNMENT TO Endcap Chambers can change if, - // for example, BEE or BIS7,8 chambers have to be assigned to Endcap - - std::string stn = id.stationNumberToFixedStationString(rstn); - std::string side=chamb.getSide(); - int rside = 1; - if(chamb.isBackward()) rside=-1; - - std::string phisec; - if(rphi2<10) phisec = "0"+ts(rphi2); - if(rphi2>=10) phisec = ts(rphi2); - - int absEta=chamb.getOnlineEta(); - //format BIL5A03 - std::string chamberName = chamb.getOnlineName(); - - //-- Multiplicity - int iside = 1; - if(chamb.isBackward()) iside=0; - chamberMulti[iside][rphi2-1][rstn-1][absEta-1]++; //Controllare!!!! - if(rawCharge > ADCCUT) chamberMultiAdcCut[iside][rphi2-1][rstn-1][absEta-1]++; - - //---------------------- - int tubestot; - int tubesPerLayer; - int imezz = 0; - int tubeOffset[2]; - tubeOffset[0]=m_histoManager->GetTubeOffsetML1(chamberName) ; - tubeOffset[1]=0; - - int itubeLong=0; - - int nLayersPerML=3; - if(stn.substr(0,2)=="BI" || stn.substr(0,2)=="EI" || stn.substr(0,3)=="BEE") { // CHECK THIS FURTHER !!!!!!!!! - nLayersPerML=4; - } - - int nLayers=nLayersPerML*2; - - if(stn.substr(0,3)=="BIS" && absEta==8) { - nLayersPerML=3; - nLayers=nLayersPerML; - } - - if(stn.substr(0,3)=="BEE") nLayers=nLayersPerML; - - // hit tube : - int tube = id.mdtTube(); - int layer = id.mdtTubeLayer(); - int Mlayer= id.mdtMultilayer(); - if (Mlayer==1) tube = tube+tubeOffset[0]; // this conver OFFLINE to ONLINE tube numbering - if (Mlayer==2) tube = tube+tubeOffset[1]; // this conver OFFLINE to ONLINE tube numbering - - TH1F *h; - TH2F *h2; - - // Chamber Hit occupancy - histoType = "a_ChamberHitOccupancy"; - h2 = (TH2F*) m_histoManager->GetMdtHisto(histoType,chamb); - if (h2 && rawCharge > ADCCUT) { - float layMl = layer + (Mlayer-1)*6; - h2->Fill( (float)tube, layMl ); - } - - std::string chamberDirName = m_histoManager->GetMdtDirectoryName(chamb); - std::string expertDirName = chamberDirName+"/Expert"; - TDirectory *expertRootDir = mdtDqaRoot->GetDirectory(expertDirName.c_str()); - - expertRootDir->cd(); - - // moved to Expert folder by Dani 01.03.2010 - histoType = "ChamberYZOccupancy"; - h2 = (TH2F*) expertRootDir->FindObjectAny(histoType.c_str()); - if (h2 && rawCharge > ADCCUT) { - h2->Fill( (float)localPos_y, (float)localPos_z ); - } - - // Hits per tube - histoType = "a_HitsPerTube"; - h = (TH1F*) m_histoManager->GetMdtHisto(histoType,chamb); - if (h) { - tubestot=h->GetNbinsX(); - tubesPerLayer=tubestot/nLayers; - imezz=(id.mdtMezzanine())%100; - itubeLong=tube+tubesPerLayer*(layer-1)+tubesPerLayer*nLayersPerML*(Mlayer-1); - h->Fill( itubeLong*1. ); - } - histoType = "a_HitsPerTubeAdcCut"; - h = (TH1F*) m_histoManager->GetMdtHisto(histoType,chamb); - if( (*rmdt_hit_it)->adcCount() > ADCCUT){ - if (h) h->Fill( itubeLong*1. ); - } - - //Hits per tube ML 1,2 - histoType = "HitsPerTube_ML"+ts(Mlayer)+"_L"+ts(layer); - h = (TH1F*) m_histoManager->GetMdtHisto(histoType,chamb); - if(rawCharge > ADCCUT){ - if(h) h->Fill( tube*1.); - } - - //tdc ML 1,2 - histoType = "A_TDC_ML"+ts(Mlayer); - h = (TH1F*) m_histoManager->GetMdtHisto(histoType,chamb); - if(h && rawCharge > ADCCUT) h->Fill( rawTime ); - - //adc ML 1,2 - histoType = "C_ADC_ML"+ts(Mlayer); - h = (TH1F*) m_histoManager->GetMdtHisto(histoType,chamb); - if(h) h->Fill( rawCharge ); - - //tdc vs adc mezz - histoType = "tdc_Vs_adc_mezz_"+ts(imezz); - if(imezz<20) { - h2 = (TH2F*) m_histoManager->GetMdtHisto(histoType,chamb); - if(h2) h2->Fill( rawCharge, rawTime ); - } - - // OVERVIEW - // region Overview plot - std::string stationLayer = "UNDEFINED"; - if(chamb.isInner()) stationLayer = "Inner"; - if(chamb.isMiddle()) stationLayer = "Middle"; - if(chamb.isOuter()) stationLayer = "Outer"; - if(chamb.isExtra()) stationLayer = "extra"; //for now, extra station stored in middle station histogram - - std::string title2=""; - if(region=="Barrel") title2+="B"; - else title2+="E"; - - title2+=side; - title2+="_"; - - histoType = "A_HitsPerML_"+stationLayer; - h2 = (TH2F*) m_histoManager->GetMdtHisto(histoType,region,side); - float xbin = absEta; - if (stn == "BIM" ) xbin=absEta+6; - if (stn == "EEL") xbin=absEta+2; - if (stn == "EES") xbin=absEta+2; - if(h2 && rawCharge > ADCCUT) h2->Fill( xbin , rphi2 + 0.25*(2*Mlayer-3) ); - - // GLOBAL plot --- All Chambers together - if(region=="Barrel") histoType = "Global_HitsPerML_Barrel"; - if(region=="Endcap") histoType = "Global_HitsPerML_Endcap"; - h2 = (TH2F*) m_histoManager->GetHisto("GLOBAL",histoType); - float shiftGlobalEta(0); - if(stationLayer=="Inner") shiftGlobalEta = 0; - if(stationLayer=="Middle") shiftGlobalEta = 14; - if(stationLayer=="Outer") shiftGlobalEta = 24; - if(stationLayer=="extra") shiftGlobalEta = 34; - float xbinGlobal = (xbin+shiftGlobalEta)*rside; - if(h2 && rawCharge > ADCCUT) h2->Fill( xbinGlobal , rphi2 + 0.25*(2*Mlayer-3) ); - - // GLOBAL plot --- Chambers divided in Inner,Middle,Outer stations (extra goes with Middle) - histoType = "Global_HitsPerML_"+stationLayer; - if(stationLayer=="extra") histoType = "Global_HitsPerML_Middle"; - h2 = (TH2F*) m_histoManager->GetHisto("GLOBAL",histoType); - xbinGlobal = xbin*rside; - if (stn.substr(0,1)=="E") xbinGlobal = rside*(absEta+14); - if (chamb.getName()=="BEE") xbinGlobal= rside*(absEta+8); - if (chamb.getName()=="EEL") xbinGlobal= rside*(absEta+11); - if (chamb.getName()=="EES") xbinGlobal= rside*(absEta+11); - - if(h2 && rawCharge > ADCCUT) h2->Fill( xbinGlobal , rphi2 + 0.25*(2*Mlayer-3) ); - - histoType = "HitsPerML_"+stationLayer; - h = (TH1F*) m_histoManager->GetMdtHisto(histoType,region,side,rphi2); - if(h && rawCharge > ADCCUT) h->Fill( absEta + 0.1*(2*Mlayer-3) ); - - histoType = "TDC_AllChambers_"+stationLayer; - h = (TH1F*) m_histoManager->GetMdtHisto(histoType,region,side,rphi2); - if(h && rawCharge > ADCCUT) h->Fill( rawTime ); - - histoType = "z_HitsVsMezzanine"; - h2 = (TH2F*) m_histoManager->GetMdtHisto(histoType,region,side,rphi2); - if( h2 && rawCharge > ADCCUT) h2->Fill(chamberName.c_str(),imezz,1); - - } // p_reg -> hit IsInRegion - }//for - - //---- Fill Multiplicity --------- - TH1F *hmulti; - - std::string side="C"; - std::string region = "Barrel"; - - for (int nregions=0;nregions<2;nregions++) { - if (nregions==1) region = "Endcap"; - for (int iside=0;iside<nSides;iside++){ - if (iside==1) side="A"; - for (int isec=0;isec<nSectors;isec++){ - float sectorMulti = 0; - float sectorMultiAdcCut = 0; - for (int istation=0;istation<nStations;istation++){ - // THE FOLLOWING ASSIGNMENT TO Endcap Chambers can change if, - // for example, BEE or BIS7,8 chambers have to be assigned to Endcap - if ( nregions==0 && istation+1 > 13 ) continue; // the loop was on the barrel - if ( nregions==1 && istation+1 <= 13 ) continue; // the loop was on the endcap - - for (int ieta=0;ieta<nEta;ieta++){ - sectorMulti += chamberMulti[iside][isec][istation][ieta]; - sectorMultiAdcCut += chamberMultiAdcCut[iside][isec][istation][ieta]; - - double multi = chamberMulti[iside][isec][istation][ieta]; - double multiAdcCut = chamberMultiAdcCut[iside][isec][istation][ieta]; - - if (multi !=0 ){ - MuonFixedId id; - std::string stn=id.stationNumberToFixedStationString(istation+1); - - MDTName chamb_mult(stn,ieta+1,side,isec+1); - - histoType="B_ChamberHitMultiplicity"; - hmulti = (TH1F*) m_histoManager->GetMdtHisto(histoType,chamb_mult); - if(hmulti) hmulti->Fill(multiAdcCut); - - }// if multi!=0 - }// loop on eta - }//loop on chamber - }//sector - }//side - }//regions - - -} //end MdtDqaNtupleAnalysis::handleEvent - -void MdtDqaNtupleAnalysis::histogramAnalysis(TFile *f) { - - bool WriteMdtDqaDbToTextFile = false; - - ToString ts; - - if(f->IsZombie()) return; - - bool doDeadElementsAnalysis = true; - bool doTubeEfficiency = true; - bool doTDCADCfitting = true; - bool doResidualsFit = true; - - if (doDeadElementsAnalysis) { - if(m_DeadElementsAlgorithm==0) { - MDTDeadElementsAnalysis *mdtTubeAna = new MDTDeadElementsAnalysis(); - mdtTubeAna->setNoVerbose(); - mdtTubeAna->WriteAsciFile(); - mdtTubeAna->histogramScanCalibCenters(f); - delete mdtTubeAna; mdtTubeAna=0; - } else { - MDTDqaDeadElements *mdtTubeAna = new MDTDqaDeadElements(); - mdtTubeAna->setVerbose(false); - mdtTubeAna->setWriteReport(false); // this is for debug - mdtTubeAna->setWriteCompactReport(true); - mdtTubeAna->setWriteListOfDeadTubes(false); - mdtTubeAna->setDoNoisy(false); - mdtTubeAna->MDTDqaDeadElementsAnalysis(f); - delete mdtTubeAna; mdtTubeAna=0; - } - } - - if (doTubeEfficiency) { - // LOOP over chambers and apply algorithms per chamber. - std::string region; - std::string sector; - std::string chamber; - std::string regionDirName; - std::string sectorDirName; - std::string chamberDirName; - std::string deadStatusDirName; - std::string expertDirName; - std::string effiDirName; - TDirectory *RegionDir; - TDirectory *SectorDir; - TDirectory *ChamberDir; - TDirectory *DeadStatusDir; - TDirectory *ExpertDir; - TDirectory *EffiDir; - - for (int iregion=1; iregion<=4; iregion++) { - if (iregion==1) region="Barrel_A"; - if (iregion==2) region="Barrel_C"; - if (iregion==3) region="Endcap_A"; - if (iregion==4) region="Endcap_C"; - - regionDirName = "/MDT/"+region; - RegionDir = (TDirectory*)f->Get(regionDirName.c_str()); - if (!RegionDir) continue; - - // reset output histograms - TH1F *hgI = (TH1F*) RegionDir->Get("TubeEfficiency_Inner"); - TH1F *hgM = (TH1F*) RegionDir->Get("TubeEfficiency_Middle"); - TH1F *hgO = (TH1F*) RegionDir->Get("TubeEfficiency_Outer"); - - TH1F *hgE(NULL); - if(iregion>2) hgE = (TH1F*) RegionDir->Get("TubeEfficiency_extra"); - if(hgI) hgI->Reset(); - if(hgM) hgM->Reset(); - if(hgO) hgO->Reset(); - if(iregion>2 && hgE) hgE->Reset(); - - for (int isector=1; isector<=16; isector++) { - - if (isector<10) sector="0"+ts(isector); - if (isector>=10) sector=ts(isector); - sectorDirName = "/MDT/"+region+"/Sector"+sector; - - SectorDir = (TDirectory*)f->Get(sectorDirName.c_str()); - if (!SectorDir) continue; - TIter next(SectorDir->GetListOfKeys()); - TKey *key; - while ( (key = (TKey*)next()) ) { - chamber=key->GetName(); - if (chamber=="OVERVIEW") continue; - - MDTName chamb(chamber); - - chamberDirName = sectorDirName+"/"+chamber; - effiDirName = chamberDirName+"/Efficiency"; - deadStatusDirName = chamberDirName+"/DeadStatus"; - expertDirName = chamberDirName+"/Expert"; - - ChamberDir = (TDirectory*)f->Get(chamberDirName.c_str()); - EffiDir = (TDirectory*)f->Get(effiDirName.c_str()); - DeadStatusDir = (TDirectory*)f->Get(deadStatusDirName.c_str()); - ExpertDir = (TDirectory*)f->Get(expertDirName.c_str()); - - if (!ChamberDir) continue; - if (!EffiDir) { - continue; - } - if (!DeadStatusDir) { - continue; - } - if (!ExpertDir) { - continue; - } - - // - // APPLY ALGORITHMS TO chamber histograms HERE - // - std::string histoName; - - TH1F *heffiEntries; - TH1F *heffiCounts; - TH1F *heffi; - TH1F *heffiPerLy; - TH1F *hg; - - ExpertDir->cd(); - - histoName = "EfficiencyEntries"; - heffiEntries = (TH1F*) ExpertDir->Get(histoName.c_str()); - histoName = "EfficiencyCounts"; - heffiCounts = (TH1F*) ExpertDir->Get(histoName.c_str()); - - ChamberDir->cd(); - histoName = "b_EfficiencyPerTube"; - heffi = (TH1F*) ChamberDir->Get(histoName.c_str()); - - if (!heffiEntries || !heffiCounts || !heffi) { - continue; - } - - histoName = "UNDEFINED"; - if (chamb.isInner()) histoName = "TubeEfficiency_Inner"; - if (chamb.isMiddle()) histoName = "TubeEfficiency_Middle"; - if (chamb.isOuter()) histoName = "TubeEfficiency_Outer"; - if (chamb.isExtra()) histoName = "TubeEfficiency_extra"; - hg = (TH1F*) RegionDir->Get(histoName.c_str()); - if (!hg) { - continue; - } - - // reset output histograms - heffi->Reset(); - - // Now we use this strange strategy to obtain chamber layout parameters: - EffiDir->cd(); - int numberOfML=0; - int numberOfLayers=0; - int numberOfTubesPerLy[2]; - numberOfTubesPerLy[0]=0; - numberOfTubesPerLy[1]=0; - - int tubeOffset[2]; - tubeOffset[0]=m_histoManager->GetTubeOffsetML1(chamber) ; - tubeOffset[1]=0; - - int tubeOffset_atend[2]; - tubeOffset_atend[0]=m_histoManager->GetTubeOffsetAtEndML1(chamber) ; - tubeOffset_atend[1]=0; - - for (int ML=1; ML<=2; ML++) { - for (int Ly=1; Ly<=4; Ly++) { - histoName = "EffiPerTube_ML"+ts(ML)+"_L"+ts(Ly); - heffiPerLy= (TH1F*) EffiDir->FindObjectAny(histoName.c_str()); - if (heffiPerLy) { - numberOfML = ML; - numberOfLayers = Ly; - if (ML==1 && !numberOfTubesPerLy[0] ) numberOfTubesPerLy[0] = heffiPerLy->GetNbinsX(); - if (ML==2 && !numberOfTubesPerLy[1] ) numberOfTubesPerLy[1] = heffiPerLy->GetNbinsX(); - } - } - } - - ChamberDir->cd(); - - // HERE NOW COMPUTE EFFICIENCIES, ERRORS AND FILL THE HISTOGRAMS - if (heffiEntries->GetEntries() != 0 ) { - //loop over multilayers - for (int k=0; k<numberOfML; k++) { - //loop over layers - for (int l=0; l<numberOfLayers; l++) { - //loop over tubes - for (int m=0; m<numberOfTubesPerLy[k]; m++) { - int iML = k+1; - int iLy = l+1; - int iTube = m+1; - - // THE FOLLOWING HAS TO BE FIXED AFTER THE EfficiencyPerTube HISTOGRAM HAS BEEN FIXED! - // FOR NOW WE CONSIDER OFFSET AT 0 ....WHICH IS WRONG ! - iTube = iTube + tubeOffset[iML-1]; - - int ibin = (iML-1)*numberOfLayers*numberOfTubesPerLy[k]+(iLy-1)*(numberOfTubesPerLy[k]+tubeOffset[iML-1]+tubeOffset_atend[iML-1])+iTube; - //calculate efficiency and errors - - // HERE WE USE THE Efficiency definition and Error using the Bayesian Statistics: - float entries = heffiEntries->GetBinContent(ibin); - float counts = heffiCounts->GetBinContent(ibin); - float efficiency = (counts+1.)/(entries+2.); - float error = std::sqrt(efficiency*(1-efficiency))/std::sqrt(entries+3.); - - // Fill MdtDqa Histos - heffi->SetBinContent(ibin,efficiency); - heffi->SetBinError(ibin,error); - // Filling Global plots - if (hg && efficiency>0. && error >0. && entries>40) { - hg->Fill(efficiency); - } - } // loop over tube - } // loop over Layer - } // loop over ML - } - - // Now we should fill the histograms histoName = "EffiPerTube_ML"+ts(iML)+"_L"+ts(iLy); - EffiDir->cd(); - //loop over multilayers - for (int ML=1; ML<=numberOfML; ML++) { - //loop over layers - for (int Ly=1; Ly<=numberOfLayers; Ly++) { - histoName = "EffiPerTube_ML"+ts(ML)+"_L"+ts(Ly); - heffiPerLy= (TH1F*) EffiDir->FindObjectAny(histoName.c_str()); - if (!heffiPerLy) continue; - // reset output histograms - heffiPerLy->Reset(); - //loop over tubes - for (int TubeBin=1; TubeBin<=numberOfTubesPerLy[ML-1]; TubeBin++) { - - if (heffiPerLy) { - // THE FOLLOWING HAS TO BE FIXED AFTER THE EfficiencyPerTube HISTOGRAM HAS BEEN FIXED! - // FOR NOW WE CONSIDER OFFSET AT 0 ....WHICH IS WRONG ! - int Tube = TubeBin + tubeOffset[ML-1]; - - // AND ATTENTION WHEN THE EfficiencyPerTube WILL BE OK YOU MUST UNCOMMENT THE FOLLOWING LINE !!!! - int ibin = (ML-1)*numberOfLayers*numberOfTubesPerLy[ML-1]+(Ly-1)*(numberOfTubesPerLy[ML-1]+tubeOffset[ML-1]+tubeOffset_atend[ML-1])+Tube; - - // get from heffi(ibin) and put in heffiPerLy(TubeBin) - heffiPerLy->SetBinContent(TubeBin, heffi->GetBinContent(ibin)); - heffiPerLy->SetBinError(TubeBin, heffi->GetBinError(ibin)); - } - } // loop over tube - } // loop over Layer - } // loop over ML - - } // end of chambers loop - } //end of sectors loop - } //end of regions loop - - } //end if doTubeEfficiency - - // - if (doTDCADCfitting ) { - TimeAndAdcFitter *myFitter = new TimeAndAdcFitter(); - float tdc2ns = 0.78125; - - double minEntries = 1000.; - double entries(0); - - std::string histoName; - TH1F *hh; - TH1F *htpar; - TH1F *hapar; - const int nParams = 8; - double pdefault[nParams]; - pdefault[0]= 0.; - pdefault[1]= 100.; - pdefault[2]= 5.; - pdefault[3]= 100.; - pdefault[4]= 600.; - pdefault[5]= 1300.; - pdefault[6]= 10.; - pdefault[7]= 10.; - - const int nParamsAdc = 4; - double AdcpfitDefault[nParamsAdc]; - AdcpfitDefault[0]= 0.; - AdcpfitDefault[1]= 0.; - AdcpfitDefault[2]= 0.; - AdcpfitDefault[3]= 0.; - - std::string region; - std::string sector; - std::string chamber; - std::string chamberType; - std::string regionDirName; - std::string sectorDirName; - std::string chamberDirName; - TDirectory *RegionDir; - TDirectory *SectorDir; - TDirectory *ChamberDir; - - for (int iregion=1; iregion<=4; iregion++) { - if (iregion==1) region="Barrel_A"; - if (iregion==2) region="Barrel_C"; - if (iregion==3) region="Endcap_A"; - if (iregion==4) region="Endcap_C"; - - std::string Region="Barrel"; - std::string Side="A"; - if (iregion==3||iregion==4 ) Region="Endcap"; - if (iregion==2||iregion==4 ) Side="C"; - - regionDirName = "/MDT/"+region; - RegionDir = (TDirectory*)f->Get(regionDirName.c_str()); - if (!RegionDir) continue; - - for (int isector=1; isector<=16; isector++) { - if (isector<10) sector="0"+ts(isector); - if (isector>=10) sector=ts(isector); - sectorDirName = "/MDT/"+region+"/Sector"+sector; - - SectorDir = (TDirectory*)f->Get(sectorDirName.c_str()); - if (!SectorDir) continue; - - // - // APPLY ALGORITHMS TO SECTOR histograms HERE - // - int KMAX=3; - if(iregion>2) KMAX=4; - for (int k=1;k<=KMAX;k++) { - std::string stationLayer; - if (k==1) stationLayer = "Inner"; - if (k==2) stationLayer = "Middle"; - if (k==3) stationLayer = "Outer"; - if (k==4) stationLayer = "extra"; - histoName = "TDC_AllChambers_"+stationLayer; - hh = (TH1F*) m_histoManager->GetMdtHisto(histoName,Region,Side,isector); - - if (!hh) { - continue; - } - - entries = hh->GetEntries(); - if ( entries >= minEntries ) { - double *pfit = new double[nParams]; - double *errfit = new double[nParams]; - double chi2 = 0.; - int ndof = 0; - for ( int ii=0; ii<nParams; ii++ ) errfit[ii]=0.; - for ( int ii=0; ii<nParams; ii++ ) pfit[ii]=pdefault[ii]; - - myFitter->doTimeFit(hh,nParams,&pfit[0],&errfit[0],&chi2,&ndof ); - - } - } - - // - // Now go inside the SectorDir to loop over chambers - // - TIter next(SectorDir->GetListOfKeys()); - TKey *key; - while ( (key = (TKey*)next()) ) { - chamber=key->GetName(); - if (chamber=="OVERVIEW") continue; - chamberDirName = sectorDirName+"/"+chamber; - ChamberDir = (TDirectory*)f->Get(chamberDirName.c_str()); - if (!ChamberDir) continue; - ChamberDir->cd(); - chamberType = chamber.substr(0,3); - MDTName chamb(chamber); - std::string side = chamb.getSide(); - std::string stationLayer = "UNDEFINED"; - if(chamb.isInner()) stationLayer = "Inner"; - if(chamb.isMiddle()) stationLayer = "Middle"; - if(chamb.isOuter()) stationLayer = "Outer"; - if(chamb.isExtra()) stationLayer = "extra"; - std::string hnamet0Sect=regionDirName+"/t0PerSector_"+stationLayer; - std::string hnametdriftSect=regionDirName+"/tdriftPerSector_"+stationLayer; - TH2F *ht0Sect = (TH2F*) f->Get(hnamet0Sect.c_str()); - TH2F *htdriftSect = (TH2F*) f->Get(hnametdriftSect.c_str()); - - int eta_id = atoi((chamber.substr(3,1).c_str())); - // - // APPLY ALGORITHMS TO chamber histograms HERE - // - MdtDqaDb *chamberDqaDb = new MdtDqaDb(chamber); - for (int ML=1; ML<=2; ML++) { // loop over ML - // start the TDC FIT : - if (ML==1) histoName = "A_TDC_ML1"; - if (ML==2) histoName = "A_TDC_ML2"; - hh = (TH1F*) ChamberDir->Get(histoName.c_str()); - if (!hh) { - continue; - } - - entries=hh->GetEntries(); - if ( entries >= minEntries ) { - double *pfit = new double[nParams]; - double *errfit = new double[nParams]; - double chi2 = 0.; - int ndof = 0; - for ( int ii=0; ii<nParams; ii++ ) errfit[ii]=0.; - for ( int ii=0; ii<nParams; ii++ ) pfit[ii]=pdefault[ii]; - - myFitter->doTimeFit(hh,nParams,&pfit[0],&errfit[0],&chi2,&ndof ); - - float t0 = pfit[4]*tdc2ns; - float t0slope = pfit[6]*tdc2ns; - float tdrift = (pfit[5]-pfit[4])*tdc2ns; - float chi2ndof = chi2/ndof; - float t0err = errfit[4]*tdc2ns; - float tdrifterr = std::pow(errfit[4]*errfit[4] + errfit[5]*errfit[5], 0.5)*tdc2ns; - if (ML==1) chamberDqaDb->SetML1(t0,tdrift,chi2ndof,t0err,tdrifterr ); - if (ML==2) chamberDqaDb->SetML2(t0,tdrift,chi2ndof,t0err,tdrifterr ); - // here add t0 and tdrift to the Sector OVERVIEW histograms : - std::string hnamet0=sectorDirName+"/OVERVIEW/t0PerML"+chamberType; - std::string hnametdrift=sectorDirName+"/OVERVIEW/tdriftPerML"+chamberType; - if (chamberType=="BOG" || chamberType=="BOF") { - hnamet0=sectorDirName+"/OVERVIEW/t0PerMLBOGBOF"; - hnametdrift=sectorDirName+"/OVERVIEW/tdriftPerMLBOGBOF"; - } - TH1F *ht0 = (TH1F*) f->Get(hnamet0.c_str()); - TH1F *htdrift = (TH1F*) f->Get(hnametdrift.c_str()); - - if (!ht0) { - continue; - } - if (!htdrift) { - continue; - } - int ibin = eta_id*2-1; - if (ML==2) ibin = eta_id*2; - if ((chamberType=="BOG" || chamberType=="BOF") && side=="A") ibin = ibin+2; - - float MLshift = 0.; - if (ML==1) MLshift = -0.25; - if (ML==2) MLshift = 0.25; - - int truebin = ht0->FindBin(eta_id+MLshift); - - ht0->SetBinContent(truebin,t0); - ht0->SetBinError(truebin,t0err); - htdrift->SetBinContent(truebin,tdrift); - htdrift->SetBinError(truebin,tdrifterr); - - if (ht0Sect) ht0Sect->Fill(float(isector),t0); - if (htdriftSect) htdriftSect->Fill(float(isector),tdrift); - - htpar = (TH1F*) m_histoManager->GetMdtHisto("time_Fit_t0",Region,Side); - if (htpar) htpar->Fill(t0); - htpar = (TH1F*) m_histoManager->GetMdtHisto("time_Fit_tdrift",Region,Side); - if (htpar) htpar->Fill(tdrift); - htpar = (TH1F*) m_histoManager->GetMdtHisto("time_Fit_tslope",Region,Side); - if (htpar) htpar->Fill(t0slope); - htpar = (TH1F*) m_histoManager->GetMdtHisto("time_Fit_chi2",Region,Side); - if(chi2ndof > 49.) chi2ndof=49.; - if (htpar) htpar->Fill(chi2ndof); - } - - // TDC FIT DONE - - // - // start the ADC FIT - if (ML==1) histoName = "C_ADC_ML1"; - if (ML==2) histoName = "C_ADC_ML2"; - hh = (TH1F*) ChamberDir->Get(histoName.c_str()); - if (!hh) { - continue; - } - float ADCCUT= m_ADCCUT; // MUST BE SET BY JOB OPTION ! - - entries =hh->GetEntries(); - int binADCCUT = hh->GetXaxis()->FindBin(ADCCUT); - double belowADCCUT = hh->Integral(1,binADCCUT); - hapar = (TH1F*) m_histoManager->GetMdtHisto("hits_perML_belowADCCUT",Region,Side); - if (hapar && entries>0) hapar->Fill(belowADCCUT/entries); - - if ( entries >= minEntries ) { - double *Adcpfit = new double[nParamsAdc]; - double *errAdcpfit = new double[nParamsAdc]; - double chi2Adc = 0.; - int ndofAdc = 0; - for ( int ii=0; ii<nParamsAdc; ii++ ) errAdcpfit[ii]=0.; - for ( int ii=0; ii<nParamsAdc; ii++ ) Adcpfit[ii]=AdcpfitDefault[ii]; - - myFitter->doAdcFit(hh,nParamsAdc,&Adcpfit[0],&errAdcpfit[0],&chi2Adc,&ndofAdc ); - hapar = (TH1F*) m_histoManager->GetMdtHisto("adc_Fit_peak",Region,Side); - if (hapar) hapar->Fill((float)Adcpfit[1]); - hapar = (TH1F*) m_histoManager->GetMdtHisto("adc_Fit_width",Region,Side); - if (hapar) hapar->Fill((float)Adcpfit[2]); - - } - // ADC FIT DONE - } // end loop over ML - - if ( WriteMdtDqaDbToTextFile ) m_MdtDqaDbList.push_back(chamberDqaDb); - - } // endo of chambers loop - } //end of sectors loop - } //end of regions loop - - } // close if doTDCADCfitting - - if (doResidualsFit) { - // LOOP over chambers and apply algorithms per chamber. - // - std::string region; - std::string sector; - std::string chamber; - std::string regionDirName; - std::string sectorDirName; - std::string chamberDirName; - TDirectory *RegionDir; - TDirectory *SectorDir; - TDirectory *ChamberDir; - - for (int iregion=1; iregion<=4; iregion++) { - if (iregion==1) region="Barrel_A"; - if (iregion==2) region="Barrel_C"; - if (iregion==3) region="Endcap_A"; - if (iregion==4) region="Endcap_C"; - - regionDirName = "/MDT/"+region; - RegionDir = (TDirectory*)f->Get(regionDirName.c_str()); - if (!RegionDir) continue; - - // reset output histograms - TH1F *hMean = (TH1F*) RegionDir->Get("ResidualsMean"); - TH1F *hWidth = (TH1F*) RegionDir->Get("ResidualsWidth"); - if(hMean) hMean->Reset(); - if(hWidth) hWidth->Reset(); - - for (int isector=1; isector<=16; isector++) { - - if (isector<10) sector="0"+ts(isector); - if (isector>=10) sector=ts(isector); - sectorDirName = "/MDT/"+region+"/Sector"+sector; - - SectorDir = (TDirectory*)f->Get(sectorDirName.c_str()); - if (!SectorDir) continue; - TIter next(SectorDir->GetListOfKeys()); - TKey *key; - while ( (key = (TKey*)next()) ) { - chamber=key->GetName(); - if (chamber=="OVERVIEW") continue; - chamberDirName = sectorDirName+"/"+chamber; - ChamberDir = (TDirectory*)f->Get(chamberDirName.c_str()); - if (!ChamberDir) continue; - ChamberDir->cd(); - - // - // APPLY ALGORITHMS TO chamber histograms HERE - // - std::string histoName; - - TH2F *hsegResid; - - histoName = "b_SegResidVsRadius"; - hsegResid = (TH2F*) ChamberDir->Get(histoName.c_str()); - - if (!hsegResid) { - continue; - } - - // HERE make Projection and Fit Residuals with double gaussian - if (hsegResid->GetEntries() != 0 ) { - TH1D *hresidProx = hsegResid->ProjectionX("ResidProx"); - - // PREPARE LOOP OVER Radius Slices - int nbins = hresidProx->GetNbinsX(); - int binStart = 1; - int groupBins = 2; - int nsteps = (nbins-binStart)/groupBins + 1; - int bin1; - int bin2 = binStart-1; - for (int n=0; n<nsteps; n++){ - bin1 = bin2+1; - bin2 = bin1+groupBins-1; - float r1 = hresidProx->GetBinCenter(bin1); - float r2 = hresidProx->GetBinCenter(bin2); - float radius = (r1+r2)/2.; - TH1D *hres = hsegResid->ProjectionY("Residuals",bin1,bin2); - if (hres->GetEntries() < 100.) { - hres->Delete(); - continue; - } - -// FIT Constant+Gaussian : - - TF1 *func = new TF1("cgaus","pol0(0)+gaus(1)"); - double hmax = hres->GetMaximum(); - int binMax = hres->GetMaximumBin(); - double hmean = hres->GetBinCenter(binMax); - double hrms = hres->GetRMS(); - func->SetParameter(0,hmax/20.); - func->SetParameter(1,hmax); - func->SetParameter(2,hmean); - func->SetParameter(3,0.2); - double xmin = hmean - hrms; - double xmax = hmean + hrms; - hres->Fit("cgaus","Q,0","",xmin,xmax); - double amplitNoise = func->GetParameter(0); - double amplitNarrow = func->GetParameter(1); - double meanNarrow = func->GetParameter(2); - double widthNarrow = func->GetParameter(3); - - bool badChi2 = (func->GetChisquare())/(func->GetNDF()) > 20.; - bool badWidths = (widthNarrow>1.); - bool badMean = (meanNarrow<-1.) || (meanNarrow>1.); - bool badNoise = (amplitNoise>hmax/3.) || (amplitNoise>amplitNarrow/2. ); - - if (badChi2 || badWidths || badMean || badNoise ) { - widthNarrow = 0.9; - meanNarrow = 0.9; - } - - if(hWidth) hWidth->Fill(radius,(float)widthNarrow); - if(hMean) hMean->Fill(radius,(float)meanNarrow); - - hres->Delete(); - } //END LOOP over SLICES - hresidProx->Delete(); - - } // Entries > 0 - - } // endo of chambers loop - } //end of sectors loop - } //end of regions loop - } // end doResidualsFit - - // HERE is the OUTPUT to stdOutput and to TEXT file and EVENTUALLY to DataBase - // TO BE ACTIVATED VIA JOB_OPTION - still to do - // - if ( WriteMdtDqaDbToTextFile ) { - std::string mdtDqaTextFileName = m_outputFileName+".txt"; - std::ofstream outputFile(mdtDqaTextFileName.c_str()); - std::vector<MdtDqaDb*>::iterator it; - for (it = m_MdtDqaDbList.begin(); - it!=m_MdtDqaDbList.end();++it) { - (*it)-> Print(); - (*it)-> Print(&outputFile); - } - outputFile.close(); - } - - // Clean (reset) m_MdtDqaDbList - - return; -} // MdtDqaNtupleAnalysis::histogramAnalysis - -}//namespace MuonCalib - diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/src/MdtDqaTrackAnalysis.cxx b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/src/MdtDqaTrackAnalysis.cxx deleted file mode 100644 index 3443ed7637c32d814b854fb16c86a56c6b99d169..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/src/MdtDqaTrackAnalysis.cxx +++ /dev/null @@ -1,990 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef MuonCalib_TrackAnalysisCXX -#define MuonCalib_TrackAnalysisCXX - -#include "MuonCalibStandAloneExtraTools/MdtDqaTrackAnalysis.h" -#include "MuonCalibStandAloneExtraTools/MDTName.h" -#include "TH1.h" -#include "TProfile.h" - -namespace MuonCalib { - -MdtDqaTrackAnalysis::MdtDqaTrackAnalysis(RegionSelectionSvc *punt, int trkauthor, HistogramManager *histoman, bool verbose) { - m_TrkAuthor=trkauthor; - m_histoManager=histoman; - p_reg_sel_svc=punt; - m_verbose=verbose; -} - -void MdtDqaTrackAnalysis::handleEvent(const MuonCalibEvent &event, int /*evnt_nr*/, const std::vector<MuonCalibSegment *> &segments, unsigned int position) { - - std::string histoType; - - const MuonCalibEvent_E& extra_event(dynamic_cast<const MuonCalibEvent_E&>(event)); - - /*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/ - /*:::::::::::::::::::: ... preparing histos ::::::::::::::::::::::::::::::*/ - /*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/ - histoType="mbts1_time"; TH1F *h1tmbts1 = (TH1F*) m_histoManager->GetHisto("TRACKS",histoType); - histoType="mbts2_time"; TH1F *h1tmbts2 = (TH1F*) m_histoManager->GetHisto("TRACKS",histoType); - histoType="mbts1VSmbts2"; TH2F *h2mbts1VSmbts2 = (TH2F*) m_histoManager->GetHisto("TRACKS",histoType); - histoType="mbts_Dtime"; TH1F *h1Dtmbts = (TH1F*) m_histoManager->GetHisto("TRACKS",histoType); - - histoType="trk_ID_mult"; TH1F *h1trkIDmult = (TH1F*) m_histoManager->GetHisto("TRACKS",histoType); - - histoType="seg_nb"; TH1F *h1segments = (TH1F*) m_histoManager->GetHisto("TRACKS",histoType); - histoType="trk_nb"; TH1F *h1tracks = (TH1F*) m_histoManager->GetHisto("TRACKS",histoType); - histoType="trk_nb_sel"; TH1F *h1tracks_sel = (TH1F*) m_histoManager->GetHisto("TRACKS",histoType); - histoType="trk_authorMoore"; TH1F *h1author1 = (TH1F*) m_histoManager->GetHisto("TRACKS",histoType); - histoType="trk_authorMuBoy"; TH1F *h1author2 = (TH1F*) m_histoManager->GetHisto("TRACKS",histoType); - histoType="trk_pt"; TH1F *h1pt = (TH1F*) m_histoManager->GetHisto("TRACKS",histoType); - histoType="trk_eta"; TH1F *h1eta = (TH1F*) m_histoManager->GetHisto("TRACKS",histoType); - histoType="trk_phi"; TH1F *h1phi = (TH1F*) m_histoManager->GetHisto("TRACKS",histoType); - histoType="trk_etaVSphi"; TH2F *h2etaVSphi = (TH2F*) m_histoManager->GetHisto("TRACKS",histoType); - histoType="trk_d0VSz0"; TH2F *h2d0VSz0 = (TH2F*) m_histoManager->GetHisto("TRACKS",histoType); - histoType="trk_yVSx"; TH2F *h2yVSx = (TH2F*) m_histoManager->GetHisto("TRACKS",histoType); - histoType="trk_qOverP"; TH1F *h1qoverp = (TH1F*) m_histoManager->GetHisto("TRACKS",histoType); - histoType="trk_chi2dof"; TH1F *h1chi2dof = (TH1F*) m_histoManager->GetHisto("TRACKS",histoType); - histoType="trk_chi2dof_VS_author"; TH2F *h2chi2dof_VS_author = (TH2F*) m_histoManager->GetHisto("TRACKS",histoType); - histoType="trk_chi2dof_VS_eta"; TH2F *h2chi2dof_VS_eta = (TH2F*) m_histoManager->GetHisto("TRACKS",histoType); - histoType="trk_d0"; TH1F *h1d0 = (TH1F*) m_histoManager->GetHisto("TRACKS",histoType); - histoType="trk_z0ip"; TH1F *h1z0ip = (TH1F*) m_histoManager->GetHisto("TRACKS",histoType); - histoType="trk_mdthits_VS_eta"; TH2F *h2mdthits_VS_eta = (TH2F*) m_histoManager->GetHisto("TRACKS",histoType); - histoType="trk_mdthits_VS_phi"; TH2F *h2mdthits_VS_phi = (TH2F*) m_histoManager->GetHisto("TRACKS",histoType); - histoType="hit_mdt"; TH1F *h1mdt = (TH1F*) m_histoManager->GetHisto("TRACKS",histoType); - histoType="hit_rpc"; TH1F *h1rpc = (TH1F*) m_histoManager->GetHisto("TRACKS",histoType); - histoType="hit_mdtVSrpc"; TH2F *h2mdtVSrpc = (TH2F*) m_histoManager->GetHisto("TRACKS",histoType); - histoType="hit_tgc"; TH1F *h1tgc = (TH1F*) m_histoManager->GetHisto("TRACKS",histoType); - histoType="hit_csc"; TH1F *h1csc = (TH1F*) m_histoManager->GetHisto("TRACKS",histoType); - histoType="hit_driftR"; TH1F *h1driftR = (TH1F*) m_histoManager->GetHisto("TRACKS",histoType); - histoType="hit_pull"; TH1F *h1pull = (TH1F*) m_histoManager->GetHisto("TRACKS",histoType); - - histoType="trk_Ev_pveto"; TH1F *h1_Ev_pveto = (TH1F*) m_histoManager->GetHisto("TRACKS",histoType); - histoType="trk_Ev_trkveto"; TH1F *h1_Ev_trkveto = (TH1F*) m_histoManager->GetHisto("TRACKS",histoType); - histoType="trk_ID_p"; TH1F *h1_ID_p = (TH1F*) m_histoManager->GetHisto("TRACKS",histoType); - histoType="trk_ID_ntrack"; TH1F *h1_ID_ntrack = (TH1F*) m_histoManager->GetHisto("TRACKS",histoType); - histoType="trk_ID_npixel"; TH1F *h1_ID_npixel = (TH1F*) m_histoManager->GetHisto("TRACKS",histoType); - histoType="trk_ID_nsct"; TH1F *h1_ID_nsct = (TH1F*) m_histoManager->GetHisto("TRACKS",histoType); - histoType="trk_ID_ntrt"; TH1F *h1_ID_ntrt = (TH1F*) m_histoManager->GetHisto("TRACKS",histoType); - histoType="trk_ID_pixsctVStrt"; TH2F *h2_ID_pixsctVStrt = (TH2F*) m_histoManager->GetHisto("TRACKS",histoType); - histoType="trk_ID_pixVSsct"; TH2F *h2_ID_pixVSsct = (TH2F*) m_histoManager->GetHisto("TRACKS",histoType); - histoType="trk_Tag_ntrack"; TH1F *h1_Tag_ntrack = (TH1F*) m_histoManager->GetHisto("TRACKS",histoType); - histoType="trk_Tag_npixel"; TH1F *h1_Tag_npixel = (TH1F*) m_histoManager->GetHisto("TRACKS",histoType); - histoType="trk_Tag_nsct"; TH1F *h1_Tag_nsct = (TH1F*) m_histoManager->GetHisto("TRACKS",histoType); - histoType="trk_Tag_ntrt"; TH1F *h1_Tag_ntrt = (TH1F*) m_histoManager->GetHisto("TRACKS",histoType); - histoType="trk_Tag_pixsctVStrt"; TH2F *h2_Tag_pixsctVStrt = (TH2F*) m_histoManager->GetHisto("TRACKS",histoType); - histoType="trk_Tag_pixVSsct"; TH2F *h2_Tag_pixVSsct = (TH2F*) m_histoManager->GetHisto("TRACKS",histoType); - histoType="trk_SA_ntrack"; TH1F *h1_SA_ntrack = (TH1F*) m_histoManager->GetHisto("TRACKS",histoType); - histoType="trk_SAIP_ntrack"; TH1F *h1_SAIP_ntrack = (TH1F*) m_histoManager->GetHisto("TRACKS",histoType); - histoType="trk_CB_ntrack"; TH1F *h1_CB_ntrack = (TH1F*) m_histoManager->GetHisto("TRACKS",histoType); - histoType="trk_CB_npixel"; TH1F *h1_CB_npixel = (TH1F*) m_histoManager->GetHisto("TRACKS",histoType); - histoType="trk_CB_nsct"; TH1F *h1_CB_nsct = (TH1F*) m_histoManager->GetHisto("TRACKS",histoType); - histoType="trk_CB_ntrt"; TH1F *h1_CB_ntrt = (TH1F*) m_histoManager->GetHisto("TRACKS",histoType); - histoType="trk_CB_pixsctVStrt"; TH2F *h2_CB_pixsctVStrt = (TH2F*) m_histoManager->GetHisto("TRACKS",histoType); - histoType="trk_CB_pixVSsct"; TH2F *h2_CB_pixVSsct = (TH2F*) m_histoManager->GetHisto("TRACKS",histoType); - - histoType="trk_cutflow"; TH2F *h2_cutflow = (TH2F*) m_histoManager->GetHisto("TRACKS",histoType); - - histoType="trk_selected_cut5_pt"; TH1F *h1_selected_cut5_pt = (TH1F*) m_histoManager->GetHisto("TRACKS",histoType); - histoType="trk_selected_cut5_p"; TH1F *h1_selected_cut5_p = (TH1F*) m_histoManager->GetHisto("TRACKS",histoType); - histoType="trk_selected_cut5_etaVSphi"; TH2F *h2_selected_cut5_etaVSphi = (TH2F*) m_histoManager->GetHisto("TRACKS",histoType); - - histoType="trk_selected_pt"; TH1F *h1_selected_pt = (TH1F*) m_histoManager->GetHisto("TRACKS",histoType); - histoType="trk_selected_p"; TH1F *h1_selected_p = (TH1F*) m_histoManager->GetHisto("TRACKS",histoType); - histoType="trk_selected_eta"; TH1F *h1_selected_eta = (TH1F*) m_histoManager->GetHisto("TRACKS",histoType); - histoType="trk_selected_phi"; TH1F *h1_selected_phi = (TH1F*) m_histoManager->GetHisto("TRACKS",histoType); - histoType="trk_selected_etaVSphi"; TH2F *h2_selected_etaVSphi = (TH2F*) m_histoManager->GetHisto("TRACKS",histoType); - - histoType="trk_associated_Deltapt"; TH1F *h1_associated_Deltapt = (TH1F*) m_histoManager->GetHisto("TRACKS",histoType); - histoType="trk_associated_Deltap"; TH1F *h1_associated_Deltap = (TH1F*) m_histoManager->GetHisto("TRACKS",histoType); - histoType="trk_associatedIP_Deltapt"; TH1F *h1_associatedIP_Deltapt = (TH1F*) m_histoManager->GetHisto("TRACKS",histoType); - histoType="trk_associatedIP_Deltap"; TH1F *h1_associatedIP_Deltap = (TH1F*) m_histoManager->GetHisto("TRACKS",histoType); - histoType="trk_SAIP_Deltapt"; TH1F *h1_SAIP_Deltapt = (TH1F*) m_histoManager->GetHisto("TRACKS",histoType); - histoType="trk_SAIP_Deltap"; TH1F *h1_SAIP_Deltap = (TH1F*) m_histoManager->GetHisto("TRACKS",histoType); - histoType="trk_SAIP2_Deltapt"; TH1F *h1_SAIP2_Deltapt = (TH1F*) m_histoManager->GetHisto("TRACKS",histoType); - histoType="trk_SAIP2_Deltap"; TH1F *h1_SAIP2_Deltap = (TH1F*) m_histoManager->GetHisto("TRACKS",histoType); - - /*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/ - /*:::::::::::::comparison MuID(id<100) and STACO (id>=100)::::::::::::::::*/ - /*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/ - /*:::::::::::::MuonBoy <-> Moore::::::::::::::::::::::::::::::::*/ - /*:::::::::::::StacoMuonSA <-> MuidSA:::::::::::::::::::::::::::::::*/ - /*:::::::::::::StacoMuonTag <-> MuTagIMO:::::::::::::::::::::::::::::*/ - /*:::::::::::::StacoMuonCombined <-> MuidCB:::::::::::::::::::::::::::::::*/ - /*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/ - /*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/ - - MuonCalibEvent_E::TrackVec::const_iterator trk=extra_event.beginTrack(); - MuonCalibEvent_E::TrackVec::const_iterator trk_end=extra_event.endTrack(); - - EventHandler EventHandler; - EventHandler.setEvent(extra_event); - - MuonCalibSelector::TrackVec trk_selected = EventHandler.extendedTracks(m_TrkAuthor); - MuonCalibSelector::TrackVec trk_inner = EventHandler.extendedTracks(1000); - MuonCalibSelector::TrkCit track_it = trk_selected.begin(); - MuonCalibSelector::TrkCit track_it_end = trk_selected.end(); - - int Id_TrackID = 1000 ; // ID Track - int Id_TrackSA = 0 ; // Moore (Moore - Default) - int Id_TrackSA_IP = 10; // MuidSA (Moore - Default) - int Id_TrackTag = 30; // MuTagIMO (Moore - Default) - int Id_TrackCB = 20; // MuidCB (Moore - Default) - if (m_TrkAuthor==100) { - Id_TrackSA = 100; // MuonBoy - Id_TrackSA_IP = 141; // StacoMuonSA - Id_TrackTag = 142; // StacoMuonTag - Id_TrackCB = 140; // StacoMuonCB - } - - MuonCalibSelector::TrackVec trk_ID = EventHandler.extendedTracks(Id_TrackID); - MuonCalibSelector::TrackVec trk_SA = EventHandler.extendedTracks(Id_TrackSA); - MuonCalibSelector::TrackVec trk_SA_IP = EventHandler.extendedTracks(Id_TrackSA_IP); - MuonCalibSelector::TrackVec trk_Tag = EventHandler.extendedTracks(Id_TrackTag); - MuonCalibSelector::TrackVec trk_CB = EventHandler.extendedTracks(Id_TrackCB); - - MuonCalibSelector::TrkCit trk_ID_it = trk_ID.begin(); - MuonCalibSelector::TrkCit trk_ID_end = trk_ID.end(); - MuonCalibSelector::TrkCit trk_SA_it = trk_SA.begin(); - MuonCalibSelector::TrkCit trk_SA_end = trk_SA.end(); - MuonCalibSelector::TrkCit trk_SAIP_it = trk_SA_IP.begin(); - MuonCalibSelector::TrkCit trk_SAIP_end = trk_SA_IP.end(); - MuonCalibSelector::TrkCit trk_Tag_it = trk_Tag.begin(); - MuonCalibSelector::TrkCit trk_Tag_end = trk_Tag.end(); - MuonCalibSelector::TrkCit trk_CB_it = trk_CB.begin(); - MuonCalibSelector::TrkCit trk_CB_end = trk_CB.end(); - - MuonCalibSelector::TrkCit trk_ID_it2 = trk_ID.begin(); - MuonCalibSelector::TrkCit trk_ID_end2 = trk_ID.end(); - MuonCalibSelector::TrkCit trk_SA_it2 = trk_SA.begin(); - MuonCalibSelector::TrkCit trk_SA_end2 = trk_SA.end(); - MuonCalibSelector::TrkCit trk_SAIP_it2 = trk_SA_IP.begin(); - MuonCalibSelector::TrkCit trk_SAIP_end2 = trk_SA_IP.end(); - MuonCalibSelector::TrkCit trk_Tag_it2 = trk_Tag.begin(); - MuonCalibSelector::TrkCit trk_Tag_end2 = trk_Tag.end(); - MuonCalibSelector::TrkCit trk_CB_it2 = trk_CB.begin(); - MuonCalibSelector::TrkCit trk_CB_end2 = trk_CB.end(); - - MuonCalibSelector::TrkCit trk_SAIP_it3 = trk_SA_IP.begin(); - MuonCalibSelector::TrkCit trk_SAIP_end3 = trk_SA_IP.end(); - - int i_trk_sel = 0; - - /*::::::::::::::::::::::::::::::::::::::::::*/ - /*:::info from scintillators::::::::::::::::*/ - /*::::::::::::::::::::::::::::::::::::::::::*/ - MuonCalibEvent_E::MBTSVec::const_iterator mbhit = extra_event.beginMBTS(); - MuonCalibEvent_E::MBTSVec::const_iterator mbhit_end = extra_event.endMBTS(); - int nMBTS1 = 0; - double chargeMBTS1[100]; - double timeMBTS1[100]; - int nMBTS2 = 0; - double chargeMBTS2[100]; - double timeMBTS2[100]; - Amg::Vector3D posMBTS(0.,0.,0.); - - for(; mbhit != mbhit_end; ++mbhit ){ // Loop over MBTS hits - if ( (*mbhit)->charge() > 0.) { - posMBTS = (*mbhit)->position(); - if( posMBTS.z() > 1000. ) { - chargeMBTS1[nMBTS1] = (*mbhit)->charge(); - timeMBTS1[nMBTS1] = (*mbhit)->time(); - nMBTS1++; - } - if( posMBTS.z() < -1000. ) { - chargeMBTS2[nMBTS2] = (*mbhit)->charge(); - timeMBTS2[nMBTS2] = (*mbhit)->time(); - nMBTS2++; - } - // if (h1tmbts) h1tmbts->Fill( timeMBTS ); - } - } // end loop over MBTS hits - - double time1_mean = 0.; - double chargeWeight1 = 0.; - for (int i=0; i<nMBTS1; i++){ - time1_mean += timeMBTS1[i]*chargeMBTS1[i]; - chargeWeight1 += chargeMBTS1[i]; - } - time1_mean = time1_mean/chargeWeight1; - - double time2_mean = 0.; - double chargeWeight2 = 0.; - for (int i=0; i<nMBTS2; i++){ - time2_mean += timeMBTS2[i]*chargeMBTS2[i]; - chargeWeight2 += chargeMBTS2[i]; - } - time2_mean = time2_mean/chargeWeight2; - - double dTimeMBTS = -1000.; - if (nMBTS1>0 && h1tmbts1 ) h1tmbts1->Fill(time1_mean); - if (nMBTS2>0 && h1tmbts2 ) h1tmbts2->Fill(time2_mean); - if (nMBTS1>0 && nMBTS2>0) { - if (h2mbts1VSmbts2) h2mbts1VSmbts2->Fill(time2_mean,time1_mean); - dTimeMBTS = time1_mean-time2_mean; - if (h1Dtmbts) h1Dtmbts->Fill(dTimeMBTS); - } - - /*:::::::::::::::::::::::::::::::::::::::::::*/ - /*:::::::loop to check the authors:::::::::::*/ - /*:::::::::::::::::::::::::::::::::::::::::::*/ - - for(;trk!=trk_end;++trk) { - if(*trk) { - - if (h1author1) { - if ((*trk)->author() == 1000) h1author1->Fill(0.); // ID - if ((*trk)->author() == 0) h1author1->Fill(1.); // Moore - if ((*trk)->author() == 1) h1author1->Fill(2.); // BackExtrapolated SA - if ((*trk)->author() == 2) h1author1->Fill(3.); // BackExtrapolated SA calo energy correction - if ((*trk)->author() == 10) h1author1->Fill(4.); // MuidSA - if ((*trk)->author() == 20) h1author1->Fill(5.); // MuidCB - if ((*trk)->author() == 25) h1author1->Fill(6.); // MuonCombined ??? - if ((*trk)->author() == 30) h1author1->Fill(7.); // MuTagIMO - if ((*trk)->author() == 35) h1author1->Fill(8.); // MuGirl - if ((*trk)->author() == 41) h1author1->Fill(9.); // AODMuidSA - if ((*trk)->author() == 40) h1author1->Fill(10.); // AODMuidCB - if ((*trk)->author() == 42) h1author1->Fill(11.); // AODMuTagIMO - if ((*trk)->author() == 43) h1author1->Fill(12.); // AODMuGirl - } - - if (h1author2) { - if ((*trk)->author() == 1000) h1author2->Fill(0.); // ID - if ((*trk)->author() == 100) h1author2->Fill(1.); // MuonBoy - if ((*trk)->author() == 120) h1author2->Fill(2.); // Staco - if ((*trk)->author() == 130) h1author2->Fill(3.); // MuTagTracks - if ((*trk)->author() == 141) h1author2->Fill(4.); // StacoMuonSA - if ((*trk)->author() == 140) h1author2->Fill(5.); // StacoMuonCB - if ((*trk)->author() == 142) h1author2->Fill(6.); // StacoMuonTag - } - if (h2chi2dof_VS_author) h2chi2dof_VS_author->Fill( (*trk)->chi2()/(*trk)->ndof(),(*trk)->author() ); - } - } - - if (h1trkIDmult) h1trkIDmult->Fill(trk_ID.size()); - - /*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/ - /*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/ - /*:::::::::::::::::::::::ALGORITHM DEPENDENT (MUID or STACO)::::::::::::::::::::*/ - /*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/ - /*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/ - - int ID_ntrack = 0; - int SA_ntrack = 0; - int SAIP_ntrack = 0; - int Tag_ntrack = 0; - int CB_ntrack = 0; - int Ev_pveto = 0; - int Ev_ngoodtrack = 0; - int Ev_npixel_veto = 0; - int Ev_nsct_veto = 0; - int ID_npixel = 0; - int ID_nsct = 0; - int ID_ntrt = 0; - // int ID_ntrtb = 0; - int Tag_npixel= 0; - int Tag_nsct = 0; - int Tag_ntrt = 0; - // int Tag_ntrtb = 0; - int CB_npixel = 0; - int CB_nsct = 0; - int CB_ntrt = 0; - // int CB_ntrtb = 0; - - /*:::::::::::::::::::::::::::::::::::::::::::::::*/ - /*:::::::::::::INNER DETECTOR :::::::::::::::::::*/ - /*:::::::::::::::::::::::::::::::::::::::::::::::*/ - for(; trk_ID_it != trk_ID_end; ++trk_ID_it ){ - ID_ntrack++; - ID_npixel = 0; - ID_nsct = 0; - ID_ntrt = 0; - // ID_ntrtb = 0; - ID_npixel = number_IDhits( trk_ID_it, 1); - ID_nsct = number_IDhits( trk_ID_it, 2); - ID_ntrt = number_IDhits( trk_ID_it, 3); - // ID_ntrtb = number_IDhits( trk_ID_it, 4); - - if(ID_npixel>0) Ev_npixel_veto++; - if(ID_nsct>5) Ev_nsct_veto++; - if(ID_npixel>0 && ID_nsct>5) Ev_ngoodtrack++; - if( h1_ID_npixel ) h1_ID_npixel->Fill(ID_npixel); - if( h1_ID_nsct ) h1_ID_nsct->Fill(ID_nsct); - if( h1_ID_ntrt ) h1_ID_ntrt->Fill(ID_ntrt); - if( h2_ID_pixsctVStrt ) h2_ID_pixsctVStrt->Fill(ID_npixel+ID_nsct, ID_ntrt); - if( h2_ID_pixVSsct ) h2_ID_pixVSsct->Fill(ID_npixel,ID_nsct); - - float ID_p = (*trk_ID_it)->p()/1000.; - if(h1_ID_p) h1_ID_p->Fill(ID_p); - if(ID_p>4) Ev_pveto++; - } // end loop on tracks - if ( h1_ID_ntrack ) h1_ID_ntrack->Fill(ID_ntrack); - if ( h1_Ev_pveto ) h1_Ev_pveto->Fill(Ev_pveto); - if ( h1_Ev_trkveto ) h1_Ev_trkveto->Fill(Ev_ngoodtrack); - - /*:::::::::::::::::::::::::::::::::::::::::::::::*/ - /*::::::MUON SPECTROMETER STANDALONE:::::::::::::*/ - /*:::::::::::::::::::::::::::::::::::::::::::::::*/ - - for(; trk_SA_it != trk_SA_end; ++trk_SA_it ){ - SA_ntrack++; - } - if ( h1_SA_ntrack ) h1_SA_ntrack->Fill(SA_ntrack); - - /*:::::::::::::::::::::::::::::::::::::::::::::::*/ - /*::::::MUON SPECTROMETER STANDALONE IP:::::::::*/ - /*:::::::::::::::::::::::::::::::::::::::::::::::*/ - - for(; trk_SAIP_it != trk_SAIP_end; ++trk_SAIP_it ){ - SAIP_ntrack++; - } - if ( h1_SAIP_ntrack ) h1_SAIP_ntrack->Fill(SAIP_ntrack); - - /*:::::::::::::::::::::::::::::::::::::::::::::::*/ - /*:::::: TAG (ID + segment in the SM)::::::::::::*/ - /*:::::::::::::::::::::::::::::::::::::::::::::::*/ - - for(; trk_Tag_it != trk_Tag_end; ++trk_Tag_it ){ - Tag_ntrack++; - Tag_npixel = 0; - Tag_nsct = 0; - Tag_ntrt = 0; - // Tag_ntrtb = 0; - Tag_npixel = number_IDhits( trk_Tag_it, 1); - Tag_nsct = number_IDhits( trk_Tag_it, 2); - Tag_ntrt = number_IDhits( trk_Tag_it, 3); - // Tag_ntrtb = number_IDhits( trk_Tag_it, 4); - - if ( h1_Tag_npixel ) h1_Tag_npixel->Fill(Tag_npixel); - if ( h1_Tag_nsct ) h1_Tag_nsct->Fill(Tag_nsct); - if ( h1_Tag_ntrt ) h1_Tag_ntrt->Fill(Tag_ntrt); - if( h2_Tag_pixsctVStrt ) h2_Tag_pixsctVStrt->Fill(Tag_npixel+Tag_nsct, Tag_ntrt); - if( h2_Tag_pixVSsct ) h2_Tag_pixVSsct->Fill(Tag_npixel,Tag_nsct); - - } - if ( h1_Tag_ntrack ) h1_Tag_ntrack->Fill(Tag_ntrack); - - /*:::::::::::::::::::::::::::::::::::::::::::::::*/ - /*:::::::::::::::COMBINED MUONS::::::::::::::::::*/ - /*:::::::::::::::::::::::::::::::::::::::::::::::*/ - - for(; trk_CB_it != trk_CB_end; ++trk_CB_it ){ - CB_ntrack++; - CB_npixel = 0; - CB_nsct = 0; - CB_ntrt = 0; - // CB_ntrtb = 0; - CB_npixel = number_IDhits( trk_CB_it, 1); - CB_nsct = number_IDhits( trk_CB_it, 2); - CB_ntrt = number_IDhits( trk_CB_it, 3); - // CB_ntrtb = number_IDhits( trk_CB_it, 4); - - if ( h1_CB_npixel ) h1_CB_npixel->Fill(CB_npixel); - if ( h1_CB_nsct ) h1_CB_nsct->Fill(CB_nsct); - if ( h1_CB_ntrt ) h1_CB_ntrt->Fill(CB_ntrt); - if( h2_CB_pixsctVStrt ) h2_CB_pixsctVStrt->Fill(CB_npixel+CB_nsct,CB_ntrt); - if( h2_CB_pixVSsct ) h2_CB_pixVSsct->Fill(CB_npixel,CB_nsct); - if ( h1_CB_ntrack ) h1_CB_ntrack->Fill(CB_ntrack); - } - - /*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/ - /*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/ - /*:::::::::::::::CUT FLOW:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/ - /*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/ - /*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/ - - bool IsCombined = false; - // MuonCalibSelector::TrkCit trk_ID_it3 = trk_ID.begin(); - // MuonCalibSelector::TrkCit trk_ID_end3 = trk_ID.end(); - - for(; trk_CB_it2 != trk_CB_end2; ++trk_CB_it2 ) { - double eta = 0; - double phi = 0; - double pt = 0; - double p = 0; - - phi = (*trk_CB_it2)->phi(); - eta = -std::log(std::tan((*trk_CB_it2)->theta()/2.)); - pt = (*trk_CB_it2)->pt()/1000; - p = (*trk_CB_it2)->p()/1000; - int CB_npixel = 0; - int CB_nsct = 0; - CB_npixel = number_IDhits( trk_CB_it2, 1); - CB_nsct = number_IDhits( trk_CB_it2, 2); - int CB_HasCutLevel = -10; - CB_HasCutLevel = cutflow( trk_CB_it2, dTimeMBTS, Ev_ngoodtrack, Ev_pveto, CB_npixel, CB_nsct); - for(int i =0;i<=CB_HasCutLevel;i++){ - if(h2_cutflow) h2_cutflow->Fill(5,i); - } - /*:::: BASIC DISTRIBUTIONS OF THE SELECTED COMBINED MUON :::::::::::::::::::::::::::::::*/ - if(CB_HasCutLevel>4){ - if(h1_selected_cut5_pt) h1_selected_cut5_pt->Fill(pt); - if(h1_selected_cut5_p) h1_selected_cut5_p->Fill(p); - if(h2_selected_cut5_etaVSphi) h2_selected_cut5_etaVSphi->Fill(phi,eta); - } - if(CB_HasCutLevel>6){ - if(h1_selected_pt) h1_selected_pt->Fill(pt); - if(h1_selected_p) h1_selected_p->Fill(p); - if(h1_selected_eta) h1_selected_eta->Fill(eta); - if(h1_selected_phi) h1_selected_phi->Fill(phi); - if(h2_selected_etaVSphi) h2_selected_etaVSphi->Fill(phi,eta); - IsCombined = true; - } - - if(CB_HasCutLevel>0 && m_TrkAuthor==0 && (*trk_CB_it2)->getAssociatedTrack(Id_TrackTag) && (*trk_CB_it2)->getAssociatedTrack(Id_TrackSA) ){ - if(h1_associated_Deltapt ) h1_associated_Deltapt->Fill( - ( (*trk_CB_it2)->getAssociatedTrack(Id_TrackTag)->pt() - (*trk_CB_it2)->getAssociatedTrack(Id_TrackSA)->pt())/1000. ); - if(h1_associated_Deltap) h1_associated_Deltap->Fill( - ( (*trk_CB_it2)->getAssociatedTrack(Id_TrackTag)->p() - (*trk_CB_it2)->getAssociatedTrack(Id_TrackSA)->p())/1000. ); - } - if(CB_HasCutLevel>0 && m_TrkAuthor==0 && (*trk_CB_it2)->getAssociatedTrack(Id_TrackTag) && (*trk_CB_it2)->getAssociatedTrack(Id_TrackSA_IP) ){ - if(h1_associatedIP_Deltapt ) h1_associatedIP_Deltapt->Fill( - ( (*trk_CB_it2)->getAssociatedTrack(Id_TrackTag)->pt() - (*trk_CB_it2)->getAssociatedTrack(Id_TrackSA_IP)->pt())/1000. ); - if(h1_associatedIP_Deltap) h1_associatedIP_Deltap->Fill( - ( (*trk_CB_it2)->getAssociatedTrack(Id_TrackTag)->p() - (*trk_CB_it2)->getAssociatedTrack(Id_TrackSA_IP)->p())/1000. ); - } - - for(; trk_SAIP_it3 != trk_SAIP_end3; ++trk_SAIP_it3 ){ - if(CB_HasCutLevel>0 && m_TrkAuthor==0 && (*trk_CB_it2)->getAssociatedTrack(Id_TrackTag) && (*trk_CB_it2)->getAssociatedTrack(Id_TrackSA) && (*trk_SAIP_it3) ){ - if(h1_SAIP_Deltapt ) h1_SAIP_Deltapt->Fill( - ( (*trk_CB_it2)->getAssociatedTrack(Id_TrackTag)->pt() - (*trk_SAIP_it3)->pt())/1000. ); - if(h1_SAIP_Deltap) h1_SAIP_Deltap->Fill( - ( (*trk_CB_it2)->getAssociatedTrack(Id_TrackTag)->p() - (*trk_SAIP_it3)->p())/1000. ); - } - if(CB_HasCutLevel>0 && m_TrkAuthor==0 && (*trk_CB_it2)->getAssociatedTrack(Id_TrackTag) && (*trk_SAIP_it3) ){ - if(h1_SAIP2_Deltapt ) h1_SAIP2_Deltapt->Fill( - ( (*trk_CB_it2)->getAssociatedTrack(Id_TrackTag)->pt() - (*trk_SAIP_it3)->pt())/1000. ); - if(h1_SAIP2_Deltap) h1_SAIP2_Deltap->Fill( - ( (*trk_CB_it2)->getAssociatedTrack(Id_TrackTag)->p() - (*trk_SAIP_it3)->p())/1000. ); - } - } - - } - - for(; trk_ID_it2 != trk_ID_end2; ++trk_ID_it2 ){ - int ID_npixel = 0; - int ID_nsct = 0; - ID_npixel = number_IDhits( trk_ID_it2, 1); - ID_nsct = number_IDhits( trk_ID_it2, 2); - int ID_HasCutLevel = -10; - ID_HasCutLevel = cutflow( trk_ID_it2, dTimeMBTS, Ev_ngoodtrack, Ev_pveto, ID_npixel, ID_nsct); - for(int i =0;i<=ID_HasCutLevel;i++){ - if(h2_cutflow) h2_cutflow->Fill(1,i); - } - if(ID_HasCutLevel>1 && IsCombined){ - } - } - - for(; trk_SA_it2 != trk_SA_end2; ++trk_SA_it2 ){ - int SA_npixel = 0; - int SA_nsct = 0; - SA_npixel = number_IDhits( trk_SA_it2, 1); - SA_nsct = number_IDhits( trk_SA_it2, 2); - int SA_HasCutLevel = -10; - SA_HasCutLevel = cutflow( trk_SA_it2, dTimeMBTS, Ev_ngoodtrack, Ev_pveto, SA_npixel, SA_nsct); - - for(int i =0;i<=SA_HasCutLevel;i++){ - if(h2_cutflow) h2_cutflow->Fill(2,i); - } - } - - for(; trk_SAIP_it2 != trk_SAIP_end2; ++trk_SAIP_it2 ){ - int SAIP_npixel = 0; - int SAIP_nsct = 0; - SAIP_npixel = number_IDhits( trk_SAIP_it2, 1); - SAIP_nsct = number_IDhits( trk_SAIP_it2, 2); - int SAIP_HasCutLevel = -10; - SAIP_HasCutLevel = cutflow( trk_SAIP_it2, dTimeMBTS, Ev_ngoodtrack, Ev_pveto, SAIP_npixel, SAIP_nsct); - for(int i =0;i<=SAIP_HasCutLevel;i++){ - if(h2_cutflow) h2_cutflow->Fill(3,i); - } - } - - for(; trk_Tag_it2 != trk_Tag_end2; ++trk_Tag_it2 ) { - int Tag_npixel = 0; - int Tag_nsct = 0; - Tag_npixel = number_IDhits( trk_Tag_it2, 1); - Tag_nsct = number_IDhits( trk_Tag_it2, 2); - int Tag_HasCutLevel = -10; - Tag_HasCutLevel = cutflow( trk_Tag_it2, dTimeMBTS, Ev_ngoodtrack, Ev_pveto, Tag_npixel, Tag_nsct); - for(int i =0;i<=Tag_HasCutLevel;i++){ - if(h2_cutflow) h2_cutflow->Fill(4,i); - } - } - - /*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/ - /*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/ - /*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/ - /*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/ - - int i_mdt = 0; // mdt hits for each track - int i_rpc = 0; // rpc hits for each track - int i_csc = 0; // csc hits for each track - int i_tgc = 0; // tgc hits for each track - - // MODIFICATIONS INTRODUCED FOR MUON VETO ANALYSIS WITH SEGMENTS refitted-t0 - - bool CollisionEvent = false; - if(std::abs(dTimeMBTS)<10 && Ev_ngoodtrack>2 && Ev_pveto>0 ) CollisionEvent=true; - - // ----------- Choose datacards here according to your analysis ----- - // HERE DECIDE WHETHER THE EVENT MUST BE A COLLISION CANDIDATE OR NOT : - bool goodEvent = true; - goodEvent = CollisionEvent; // IN CASE YOU WANT ALL EVENTS, just COMMENT THIS LINE - - // HERE SELECT THE TRACK TYPE - std::string TrackMDTtime_selection = "SA"; - - - // HERE SELECT THE CUT THE TRACK MUST PASS - // int PASSEDCUT = 0; // if goodEvent = CollisionEvent is enables - // PASSEDCUT = 0,1,2,3 is equivalent to PASSEDCUT = 4 - int PASSEDCUT = 0; - // ----------- END of datacards according to your analysis ----- - - if (goodEvent) { - - histoType="trk_d0VSz0_GoodTime"; TH2F *h2d0VSz0_goodT = (TH2F*) m_histoManager->GetHisto("DEBUG",histoType); - histoType="trk_d0VSz0_BadTime"; TH2F *h2d0VSz0_badT = (TH2F*) m_histoManager->GetHisto("DEBUG",histoType); - histoType="trk_d0VSz0_noSeg"; TH2F *h2d0VSz0_noSeg = (TH2F*) m_histoManager->GetHisto("DEBUG",histoType); - - MuonCalibSelector::TrkCit trkMDTtime_it; - MuonCalibSelector::TrkCit trkMDTtime_it_end; - - if (TrackMDTtime_selection == "SA") { - trkMDTtime_it = trk_SA.begin(); - trkMDTtime_it_end = trk_SA.end(); - } - if (TrackMDTtime_selection == "SA_IP") { - trkMDTtime_it = trk_SA.begin(); - trkMDTtime_it_end = trk_SA.end(); - } - if (TrackMDTtime_selection == "Tag") { - trkMDTtime_it = trk_Tag.begin(); - trkMDTtime_it_end = trk_Tag.end(); - } - if (TrackMDTtime_selection == "CB") { - trkMDTtime_it = trk_CB.begin(); - trkMDTtime_it_end = trk_CB.end(); - } - - if (TrackMDTtime_selection == "NONE") { - std::vector<const MuonCalibExtendedSegment*> segs; - - for (unsigned int k=position; k<segments.size(); k++) { // LOOP OVER SEGMENTS - MuonCalibSegment *segment(segments[k]); - - const MuonCalibExtendedSegment *segext = (const MuonCalibExtendedSegment* ) segment; - segs.push_back(segext); - } - - } else { - for(;trkMDTtime_it!=trkMDTtime_it_end;++trkMDTtime_it){ - - int iMDTtime = -99; - int TRACK_npixel = 0; - int TRACK_nsct = 0; - TRACK_npixel = number_IDhits( trkMDTtime_it, 1); - TRACK_nsct = number_IDhits( trkMDTtime_it, 2); - int TRACK_HasCutLevel = -10; - TRACK_HasCutLevel = cutflow( trkMDTtime_it, dTimeMBTS, Ev_ngoodtrack, Ev_pveto, TRACK_npixel, TRACK_nsct); - if (TRACK_HasCutLevel<PASSEDCUT) { - continue; - } - const std::vector<const MuonCalibExtendedSegment*> assoSegments = (*trkMDTtime_it)->associatedSegments(); - bool additionalCut = true; - if (assoSegments.size()>0 && additionalCut ) iMDTtime = MDTtiming(assoSegments); - if (iMDTtime==1) { - if (h2d0VSz0_goodT) { - h2d0VSz0_goodT->Fill( (*trkMDTtime_it)->z0ip(), (*trkMDTtime_it)->d0()); - } - } - if (iMDTtime==0) { - if (h2d0VSz0_badT) { - h2d0VSz0_badT->Fill( (*trkMDTtime_it)->z0ip(), (*trkMDTtime_it)->d0()); - } - } - if (iMDTtime==-1) { - if (h2d0VSz0_noSeg) { - h2d0VSz0_noSeg->Fill( (*trkMDTtime_it)->z0ip(), (*trkMDTtime_it)->d0()); - } - } - } - } - } // close IF goodEvent - // - // END MODIFICATIONS INTRODUCED FOR MUON VETO ANALYSIS WITH SEGMENTS refitted-t0 - - /*::::::::::::::::::::::::::::::::::::::::::::::*/ - /*:::::::loop on non cut tracks :::::::*/ - /*::::::::::::::::::::::::::::::::::::::::::::::*/ - for(;track_it!=track_it_end;++track_it) { - - double eta = -std::log ( std::tan ( (*track_it)->theta()/2)); - - i_trk_sel++; - - if (h1pt) h1pt->Fill( (*track_it)->pt()/1000. ); // in GeV - if (h1eta) h1eta->Fill( eta ); - if (h1phi) h1phi->Fill( (*track_it)->phi() ); - if (h2etaVSphi) h2etaVSphi->Fill( eta, (*track_it)->phi()); - if (h1d0) h1d0->Fill( (*track_it)->d0()); - if (h1z0ip) h1z0ip->Fill( (*track_it)->z0ip()); - if (h2d0VSz0) h2d0VSz0->Fill( (*track_it)->z0ip(), (*track_it)->d0()); - if (h2yVSx) h2yVSx->Fill( (*track_it)->x0() , (*track_it)->y0() ); - if (h1qoverp) h1qoverp->Fill( (*track_it)->qOverP()*1000. ); // in Gev^-1 - if (h1chi2dof) h1chi2dof->Fill( (*track_it)->chi2()/(*track_it)->ndof() ); - if (h2chi2dof_VS_eta) h2chi2dof_VS_eta->Fill( eta, (*track_it)->chi2()/(*track_it)->ndof() ); - if (h1segments) h1segments->Fill( (*track_it)->associatedSegments().size() ); - - MuonCalibTrack_E::HitVector::const_iterator hit=(*track_it)->beginHit(); - MuonCalibTrack_E::HitVector::const_iterator hit_end=(*track_it)->endHit(); - - for(;hit!=hit_end;++hit){ - - MuonFixedId identifier = (*hit)->identify(); - - if( identifier.is_mdt() ){ // MDT hits - if (h1pull) h1pull->Fill( (*hit)->pull()); - if (h1driftR) h1driftR->Fill( (*hit)->driftRadius()); - i_mdt++; - } - if( identifier.is_rpc() ){ // RPC hits - i_rpc++; - } - if( identifier.is_tgc() ){ // TGC hits - i_tgc++; - } - if( identifier.is_csc() ){ // CSC hits - i_csc++; - } - } - - if(i_mdt>0){ - if (h1mdt) h1mdt->Fill(i_mdt); - } - if(i_rpc>0){ - if (h1rpc) h1rpc->Fill(i_rpc); - if(i_mdt>0){ - if (h2mdtVSrpc) h2mdtVSrpc->Fill(i_rpc,i_mdt); - } - } - if(i_tgc>0){ - if (h1tgc) h1tgc->Fill(i_tgc); - } - if(i_csc>0){ - if (h1csc) h1csc->Fill(i_csc); - } - - if (h2mdthits_VS_eta) h2mdthits_VS_eta->Fill( eta,i_mdt ); - if (h2mdthits_VS_phi) h2mdthits_VS_phi->Fill((*track_it)->phi() ,i_mdt ); - - // if(i_tgc>0 || i_rpc>0){ - // } - } - - /********************************************************************************************/ - - if (h1tracks) h1tracks->Fill(extra_event.nrTracks()); // including all authors - if (h1tracks_sel) h1tracks_sel->Fill( i_trk_sel ); // only selected author - - return; -} //end MdtDqaTrackAnalysis::handleEvent - -int MdtDqaTrackAnalysis::number_IDhits(MuonCalibSelector::TrackVec::const_iterator track, int detector){ - int npixel = 0; - int nsct = 0; - int ntrt = 0; - int ntrtb = 0; - int nhit = 0; - MuonCalibTrack_E::HitVector::const_iterator it_hit = (*track)->beginHit(); - MuonCalibTrack_E::HitVector::const_iterator it_hit_end = (*track)->endHit(); - for (;it_hit != it_hit_end; ++it_hit) { - if ((*it_hit)->type() != 1) continue; - if ((*it_hit)->position().perp() < 200.) { - npixel++; - if(detector ==1) nhit++; - } else if ((*it_hit)->position().perp() < 540.) { - nsct++; - if(detector ==2) nhit++; - } else if ((*it_hit)->position().perp() < 1100.) { - ntrt++; - if(detector ==3) nhit++; - if(std::abs((*it_hit)->position().z()) < 750.){ - ntrtb++; - if(detector ==4) nhit++; - } - } - } - - return nhit; -} //end MdtDqaTrackAnalysis::number_IDhits - -int MdtDqaTrackAnalysis::cutflow(MuonCalibSelector::TrackVec::const_iterator track, double dTimeMBTS, int Ev_ngoodtrack, int Ev_pveto, int npixel, int nsct) { - int HasPassedLevel = -10; - - double eta = 0; - double pt = 0; - double p = 0; - eta = -std::log(std::tan((*track)->theta()/2.)); - pt = (*track)->pt()/1000; - p = (*track)->p()/1000; - - HasPassedLevel = 0; - HasPassedLevel = 1; - if(HasPassedLevel == 1 && std::abs(dTimeMBTS)<10) HasPassedLevel = 2; - if(HasPassedLevel == 2 && Ev_ngoodtrack>2) HasPassedLevel = 3; - if(HasPassedLevel == 3 && Ev_pveto>0) HasPassedLevel = 4; - if(HasPassedLevel == 4) HasPassedLevel = 5; - if(HasPassedLevel == 5 && std::abs(eta)<2.5 && pt>2.5) HasPassedLevel = 6; - if(HasPassedLevel == 6 && p>4.) HasPassedLevel = 7; - if(HasPassedLevel == 7 && npixel>0 && nsct>5) HasPassedLevel = 8; - - return HasPassedLevel; -} //end MdtDqaTrackAnalysis::cutflow - -int MdtDqaTrackAnalysis::MDTtiming(const std::vector<const MuonCalibExtendedSegment*> &segments ){ - // - // MODIFICATIONS INTRODUCED FOR MUON VETO ANALYSIS WITH SEGMENTS refitted-t0 - // - std::string histoType; - histoType="nSegPerTrack"; TH1F *h1_nSegAll = (TH1F*) m_histoManager->GetHisto("DEBUG",histoType); - histoType="nSegPerTrack_HitCut"; TH2F *h2_nSegHitCut = (TH2F*) m_histoManager->GetHisto("DEBUG",histoType); - - histoType="t0_BI"; TH2F *h2_t0BI = (TH2F*) m_histoManager->GetHisto("DEBUG",histoType); - histoType="t0_BM"; TH2F *h2_t0BM = (TH2F*) m_histoManager->GetHisto("DEBUG",histoType); - histoType="t0_BO"; TH2F *h2_t0BO = (TH2F*) m_histoManager->GetHisto("DEBUG",histoType); - histoType="t0_EI"; TH2F *h2_t0EI = (TH2F*) m_histoManager->GetHisto("DEBUG",histoType); - histoType="t0_EM"; TH2F *h2_t0EM = (TH2F*) m_histoManager->GetHisto("DEBUG",histoType); - histoType="t0_EO"; TH2F *h2_t0EO = (TH2F*) m_histoManager->GetHisto("DEBUG",histoType); - - histoType="t0_BO_BM"; TH2F *h2_t0BOBM = (TH2F*) m_histoManager->GetHisto("DEBUG",histoType); - histoType="t0_BO_BI"; TH2F *h2_t0BOBI = (TH2F*) m_histoManager->GetHisto("DEBUG",histoType); - histoType="t0_BM_BI"; TH2F *h2_t0BMBI = (TH2F*) m_histoManager->GetHisto("DEBUG",histoType); - histoType="t0_EO_EM"; TH2F *h2_t0EOEM = (TH2F*) m_histoManager->GetHisto("DEBUG",histoType); - histoType="t0_EO_EI"; TH2F *h2_t0EOEI = (TH2F*) m_histoManager->GetHisto("DEBUG",histoType); - histoType="t0_EM_EI"; TH2F *h2_t0EMEI = (TH2F*) m_histoManager->GetHisto("DEBUG",histoType); - - // bool debug_seg = false; - - if(h1_nSegAll) h1_nSegAll->Fill(segments.size()); - - const int NSEGMAX = 20; // Maximum of Segments in the same Layer (Inner, Middle, Outer) - float t0acceptedSeg[NSEGMAX]; - int nAcceptedSeg=0; - float t0refit_BI[NSEGMAX][2]; - float t0refit_BM[NSEGMAX][2]; - float t0refit_BO[NSEGMAX][2]; - float t0refit_EI[NSEGMAX][2]; - float t0refit_EM[NSEGMAX][2]; - float t0refit_EO[NSEGMAX][2]; - int nseg_BI = 0; - int nseg_BM = 0; - int nseg_BO = 0; - int nseg_EI = 0; - int nseg_EM = 0; - int nseg_EO = 0; - for (int i=0; i<NSEGMAX; i++) { - t0refit_BI[i][0] = 99999.; - t0refit_BM[i][0] = 99999.; - t0refit_BO[i][0] = 99999.; - t0refit_EI[i][0] = 99999.; - t0refit_EM[i][0] = 99999.; - t0refit_EO[i][0] = 99999.; - } - - unsigned int MINNUMHITS = 5; - int nseg_hitCut = 0; - std::vector<const MuonCalibExtendedSegment*>::const_iterator seg_it; - for (seg_it = segments.begin(); seg_it!=segments.end(); seg_it++) { // START LOOP ON SEGMENTS - if ((*seg_it)->mdtHitsOnTrack() >= MINNUMHITS) { // IF segment has >= MINNUMHITS - nseg_hitCut++; - if ( nseg_hitCut >=NSEGMAX ) { - continue; - } - - // MDT hits on segment - std::vector<MdtCalibHitBase*>::const_iterator aHit_it = (*seg_it)->mdtHOTBegin(); - std::vector<MdtCalibHitBase*>::const_iterator aHit_it_end = (*seg_it)->mdtHOTEnd(); - - float t0refit = (*seg_it)->fittedT0(); - - if (t0refit!= 0.) { - int hitCount(0); - std::string chamberName_firstHit; - int chamberEta_firstHit(0); - bool sameChamber = true; - bool adjacentChamber = false; - int sectorid(0.0); - for (; aHit_it != aHit_it_end; ++aHit_it){ // start loop over hits - hitCount++; - MuonFixedId id = (*aHit_it)->identify(); - MDTName chamb(id); - std::string chamberName = chamb.getOnlineName(); - if (hitCount==1) { - chamberName_firstHit = chamberName; - chamberEta_firstHit = chamb.getOnlineEta(); - sectorid = chamb.getOnlineSector(); - } else { - if (chamberName!=chamberName_firstHit) { - sameChamber = false; - if (!(chamberName.substr(0,3)==chamberName_firstHit.substr(0,3) - && chamb.getOnlineSector()==sectorid)) adjacentChamber = false; - if (chamberName.substr(0,3)==chamberName_firstHit.substr(0,3) && chamb.getOnlineSector()==sectorid){ - if (chamb.getOnlineEta()==chamberEta_firstHit+1 || chamb.getOnlineEta()==chamberEta_firstHit-1) adjacentChamber = true; - } - - } - } - } // end loop over hits - - if (sameChamber || adjacentChamber) { // IF all hits are in the same or adjacent Chamber - t0acceptedSeg[nAcceptedSeg]=t0refit; - nAcceptedSeg++; - if (chamberName_firstHit.substr(0,2) == "BI") { - t0refit_BI[nseg_BI][0] = t0refit; - t0refit_BI[nseg_BI][1] = sectorid; - nseg_BI++; - } - if (chamberName_firstHit.substr(0,2) == "BM") { - t0refit_BM[nseg_BM][0] = t0refit; - t0refit_BM[nseg_BM][1] = sectorid; - nseg_BM++; - } - if (chamberName_firstHit.substr(0,2) == "BO") { - t0refit_BO[nseg_BO][0] = t0refit; - t0refit_BO[nseg_BO][1] = sectorid; - nseg_BO++; - } - if (chamberName_firstHit.substr(0,2) == "EI") { - t0refit_EI[nseg_EI][0] = t0refit; - t0refit_EI[nseg_EI][1] = sectorid; - nseg_EI++; - } - if (chamberName_firstHit.substr(0,2) == "EM") { - t0refit_EM[nseg_EM][0] = t0refit; - t0refit_EM[nseg_EM][1] = sectorid; - nseg_EM++; - } - if (chamberName_firstHit.substr(0,2) == "EO") { - t0refit_EO[nseg_EO][0] = t0refit; - t0refit_EO[nseg_EO][1] = sectorid; - nseg_EO++; - } - } // end IF same or adjacent Chamber - } // end IF t0refit != 0 - } // end IF segment has >= MINNUMHITS - } // END LOOP ON SEGMENTS - - int sectorWithSegments[17]; - for (int i=0;i<17;i++) sectorWithSegments[i]=0; - - for (int n=0;n<nseg_BI;n++) { - h2_t0BI->Fill(t0refit_BI[n][1],t0refit_BI[n][0]); - sectorWithSegments[(int)t0refit_BI[n][1]]++; - } - for (int n=0;n<nseg_BM;n++) { - h2_t0BM->Fill(t0refit_BM[n][1],t0refit_BM[n][0]); - sectorWithSegments[(int)t0refit_BM[n][1]]++; - } - for (int n=0;n<nseg_BO;n++) { - h2_t0BO->Fill(t0refit_BO[n][1],t0refit_BO[n][0]); - sectorWithSegments[(int)t0refit_BO[n][1]]++; - } - for (int n=0;n<nseg_EI;n++) { - h2_t0EI->Fill(t0refit_EI[n][1],t0refit_EI[n][0]); - sectorWithSegments[(int)t0refit_EI[n][1]]++; - } - for (int n=0;n<nseg_EM;n++) { - h2_t0EM->Fill(t0refit_EM[n][1],t0refit_EM[n][0]); - sectorWithSegments[(int)t0refit_EM[n][1]]++; - } - for (int n=0;n<nseg_EO;n++) { - h2_t0EO->Fill(t0refit_EO[n][1],t0refit_EO[n][0]); - sectorWithSegments[(int)t0refit_EO[n][1]]++; - } - - int topnSegInSector = 0; - int sectorWithHighestNseg = 0; - for (int i=1;i<17;i++) { - if (sectorWithSegments[i]>topnSegInSector) { - topnSegInSector=sectorWithSegments[i]; - sectorWithHighestNseg = i; - } - } - h2_nSegHitCut->Fill( (float)sectorWithHighestNseg, (float)topnSegInSector ); - if (topnSegInSector>1) { - // look for combinations BO-BM - for (int n1=0;n1<nseg_BO;n1++) { - for (int n2=0;n2<nseg_BM;n2++) { - if (t0refit_BO[n1][1]==(float)sectorWithHighestNseg && t0refit_BM[n2][1]==(float)sectorWithHighestNseg) { - float deltat0_BOBM = t0refit_BO[n1][0]-t0refit_BM[n2][0]; - h2_t0BOBM->Fill((float)sectorWithHighestNseg,deltat0_BOBM); - } - } - } - // look for combinations BO-BI - for (int n1=0;n1<nseg_BO;n1++) { - for (int n2=0;n2<nseg_BI;n2++) { - if (t0refit_BO[n1][1]==(float)sectorWithHighestNseg && t0refit_BI[n2][1]==(float)sectorWithHighestNseg) { - float deltat0_BOBI = t0refit_BO[n1][0]-t0refit_BI[n2][0]; - h2_t0BOBI->Fill((float)sectorWithHighestNseg,deltat0_BOBI); - } - } - } - // look for combinations BM-BI - for (int n1=0;n1<nseg_BM;n1++) { - for (int n2=0;n2<nseg_BI;n2++) { - if (t0refit_BM[n1][1]==(float)sectorWithHighestNseg && t0refit_BI[n2][1]==(float)sectorWithHighestNseg) { - float deltat0_BMBI = t0refit_BM[n1][0]-t0refit_BI[n2][0]; - h2_t0BMBI->Fill((float)sectorWithHighestNseg,deltat0_BMBI); - } - } - } - - // look for combinations EO-EM - for (int n1=0;n1<nseg_EO;n1++) { - for (int n2=0;n2<nseg_EM;n2++) { - if (t0refit_EO[n1][1]==(float)sectorWithHighestNseg && t0refit_EM[n2][1]==(float)sectorWithHighestNseg) { - float deltat0_EOEM = t0refit_EO[n1][0]-t0refit_EM[n2][0]; - h2_t0EOEM->Fill((float)sectorWithHighestNseg,deltat0_EOEM); - } - } - } - // look for combinations EO-EI - for (int n1=0;n1<nseg_EO;n1++) { - for (int n2=0;n2<nseg_EI;n2++) { - if (t0refit_EO[n1][1]==(float)sectorWithHighestNseg && t0refit_EI[n2][1]==(float)sectorWithHighestNseg) { - float deltat0_EOEI = t0refit_EO[n1][0]-t0refit_EI[n2][0]; - h2_t0EOEI->Fill((float)sectorWithHighestNseg,deltat0_EOEI); - } - } - } - // look for combinations EM-EI - for (int n1=0;n1<nseg_EM;n1++) { - for (int n2=0;n2<nseg_EI;n2++) { - if (t0refit_EM[n1][1]==(float)sectorWithHighestNseg && t0refit_EI[n2][1]==(float)sectorWithHighestNseg) { - float deltat0_EMEI = t0refit_EM[n1][0]-t0refit_EI[n2][0]; - h2_t0EMEI->Fill((float)sectorWithHighestNseg,deltat0_EMEI); - } - } - } - } // CLOSE IF topnSegInSector>1 - - int iMDTtime = -99; - if (nAcceptedSeg==0) iMDTtime = -1; - int nacc=0; - for (int ns=0; ns<nAcceptedSeg; ns++) { - if (t0acceptedSeg[ns]>-50. && t0acceptedSeg[ns]<30.) nacc++; - } - if (nAcceptedSeg>0 && nacc==nAcceptedSeg) iMDTtime = 1; // THIS CONDITION is verified if ALL segments are good ! - if (nAcceptedSeg>0 && nacc<nAcceptedSeg) iMDTtime = 0; - - return iMDTtime; -} //end MdtDqaTrackAnalysis::MDTtiming - -} //namespace MuonCalib -#endif diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/src/MdtDqaTubeEfficiency.cxx b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/src/MdtDqaTubeEfficiency.cxx deleted file mode 100644 index f24b9441971e9ade66c5e6e693429a767c553b53..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/src/MdtDqaTubeEfficiency.cxx +++ /dev/null @@ -1,699 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -#include <iostream> -#include <fstream> -#include <string> -#include <vector> -#include <cstdlib> - -#include "MuonIdHelpers/IMuonIdHelperSvc.h" -#include "MuonReadoutGeometry/MuonDetectorManager.h" -#include "MuonReadoutGeometry/MdtReadoutElement.h" -#include "MuonCalibITools/IIdToFixedIdTool.h" -#include "MdtCalibInterfaces/IMdtSegmentFitter.h" - -#include "MdtCalibUtils/GlobalTimeFitter.h" -#include "MuonCalibStandAloneExtraTools/HistogramManager.h" -#include "MuonCalibStandAloneExtraTools/PhiEtaUtils.h" -#include "MuonCalibEventBase/MuonCalibRawHitCollection.h" -#include "MuonCalibEventBase/MuonCalibRawMdtHit.h" -#include "MuonCalibEventBase/MuonCalibSegment.h" -#include "MdtCalibFitters/QuasianalyticLineReconstruction.h" -#include "MdtCalibFitters/DCSLFitter.h" -#include "MuonCalibEventBase/MuonCalibEvent.h" -#include "MuonCalibStandAloneExtraTools/MdtDqaTubeEfficiency.h" - -#include "MuonCalibStandAloneBase/NtupleStationId.h" -#include "MuonCalibStandAloneBase/RegionSelectionSvc.h" -#include "MuonCalibStandAloneBase/MdtStationT0Container.h" - -#include "MdtCalibData/IRtResolution.h" - -#include "TFile.h" -#include "TH1.h" -#include "TNtuple.h" -#include "TString.h" -#include "TDirectory.h" - -namespace MuonCalib { - -//***************************************************************************** -// constructor -MdtDqaTubeEfficiency::MdtDqaTubeEfficiency(float nsigma, float chi2Cut, - bool defaultResol, float adcCut, bool GTFitON, - bool useNewCalibConstants, bool useTimeCorrections) : - m_idHelper(nullptr), - m_detMgr(nullptr), - m_id_tool(nullptr), - p_reg_sel_svc(nullptr), - p_calib_input_svc(nullptr), - m_histoManager(nullptr), - m_qfitter(nullptr), - m_nb_stations(-1) -{ - m_nsigma = nsigma; - m_chi2Cut = chi2Cut; - m_defaultResol = defaultResol; - m_adcCut = adcCut; - m_GTFitON = GTFitON; - m_useNewCalibConstants = useNewCalibConstants; - m_useTimeCorrections = useTimeCorrections; -} - -//::::::::::::::::: -//:: METHOD init :: -//::::::::::::::::: -StatusCode MdtDqaTubeEfficiency::initialize(const Muon::IMuonIdHelperSvc *idHelper, const MuonGM::MuonDetectorManager *detMgr, - const MuonCalib::IIdToFixedIdTool *id_tool, RegionSelectionSvc *reg_sel_svc, - MdtCalibInputSvc *calib_input_svc, HistogramManager *histoManager) { - m_idHelper = idHelper; - m_detMgr = detMgr; - m_id_tool = id_tool; - p_reg_sel_svc = reg_sel_svc; - p_calib_input_svc = calib_input_svc; - m_histoManager = histoManager; - - std::string RegionName = p_reg_sel_svc->GetRegionSelection(); - - const std::vector<MuonCalib::NtupleStationId> stationsInRegion = p_reg_sel_svc->GetStationsInRegions(); - - //----------------------------------// - //-- Create Root Files and Histos --// - //----------------------------------// - - m_qfitter = NULL; - - // loop over stations in region - m_nb_stations = stationsInRegion.size(); - for (int istation=0;istation<m_nb_stations;istation++) { - for (int k=0;k<4;k++) m_nb_layers_tubes[istation][k] = -1; - } - - for (int istation=0;istation<m_nb_stations;istation++) { - std::string stationNameString = stationsInRegion.at(istation).regionId(); - std::string chamberType = stationNameString.substr(0,3); - int phi_id = stationsInRegion.at(istation).GetPhi(); - int eta_id = stationsInRegion.at(istation).GetEta(); - - Identifier station_id = m_idHelper->mdtIdHelper().elementID(chamberType, eta_id, phi_id); - int stationIntId = static_cast<int>(station_id.get_identifier32().get_compact()); - int numberOfML = m_idHelper->mdtIdHelper().numberOfMultilayers(station_id); - - for (int multilayer=1;multilayer<=numberOfML; multilayer++) { - Identifier MdtML = m_idHelper->mdtIdHelper().multilayerID(station_id, multilayer); - int layerMin = m_idHelper->mdtIdHelper().tubeLayerMin(MdtML); - int layerMax = m_idHelper->mdtIdHelper().tubeLayerMax(MdtML); - int tubeMin = m_idHelper->mdtIdHelper().tubeMin(MdtML); - int tubeMax = m_idHelper->mdtIdHelper().tubeMax(MdtML); - m_nb_layers_tubes[istation][0] = stationIntId; - m_nb_layers_tubes[istation][1] = layerMax-layerMin+1; - m_nb_layers_tubes[istation][1+multilayer] = tubeMax-tubeMin+1; - } - } //end loop on stations - - return StatusCode::SUCCESS; -} //end MdtDqaTubeEfficiency::initialize - -//***************************************************************************** - -//:::::::::::::::::::::::: -//:: METHOD handleEvent :: -//:::::::::::::::::::::::: -StatusCode MdtDqaTubeEfficiency::handleEvent( const MuonCalibEvent &event, - int /*eventnumber*/, - const std::vector<MuonCalibSegment *> &segments, - unsigned int position) { - - bool RPCTimeCorrection = false; // SHOULD BE SETVIA jobOption if useful in the future! - bool t0RefinementTimeCorrection = true; // SHOULD BE SET VIA jobOption if useful in the future! - if( RPCTimeCorrection && t0RefinementTimeCorrection ) return StatusCode::FAILURE; - - if (segments.size()<=position) return StatusCode::SUCCESS; - - DCSLFitter *fitter = new DCSLFitter(); - GlobalTimeFitter *GTFitter = new GlobalTimeFitter(fitter); - const IRtRelation *calibRt(0); - const IRtRelation *GTFitRt(0); - if ( m_GTFitON ) { - if (!m_useNewCalibConstants ) { - GTFitRt = GTFitter->getDefaultRtRelation(); - GTFitter->setRtRelation(GTFitRt); - } - } - - for (unsigned int k=position; k<segments.size(); k++) { // LOOP OVER SEGMENTS - - MuonCalibSegment segment(*segments[k]); - - //---------------// - //-- Variables --// - //---------------// - - int nb_hits; - - // station identifiers // - - MuonFixedId Mid((segment.mdtHOT()[0])->identify()); - MDTName chamb(Mid); - - //this has to be set in order to get the m_detMgr->getMdtReadoutElement() method working correctly - //otherwise also for the first multilayer, the second is returned - // - // M.I. ----> ???? TO CHECK FURTHER ! - Mid.setMdtMultilayer(1); - - // - // Get REGION and STATION of the first hit of the segment : - // - int phi = Mid.phi(); - int eta = Mid.eta(); - std::string stationNameStr = Mid.stationNameString(); - - // - // Check that all the hits in the segment belongs to the same chamber : - // - bool segInOneChamber = true; - for (unsigned int l=0; l<segment.mdtHitsOnTrack(); l++) { - bool samestation( ((segment.mdtHOT()[l])->identify()).stationNameString()==stationNameStr ); - bool samephi( ((segment.mdtHOT()[l])->identify()).phi()==phi ); - bool sameeta( ((segment.mdtHOT()[l])->identify()).eta()==eta ); - bool sameChamber = samestation && samephi && sameeta; - if (!sameChamber){ - segInOneChamber = false; - // REINCLUDE THE BREAK ! - break; - } - } - - // WE SHOULD DECIDE IF A SEGMENT BUILT ON ADJACIENT CHAMBERS SHOULD BE SKIPPED - // ...now skipped - if (!segInOneChamber) continue; - - // - // Get numberOfMultiLayers, numberOfLayers, numberOfTubes : - // - int stationIntId = static_cast<int>(m_idHelper->mdtIdHelper(). elementID(stationNameStr,eta,phi).get_compact()); - Identifier station_id = m_id_tool->fixedIdToId(Mid); - - int numberOfML, numberOfLayers, numberOfTubes[2]; - numberOfML = 0; - numberOfLayers = 0; - numberOfTubes[0] = 0; - numberOfTubes[1] = 0; - - for (int ii=0; ii<m_nb_stations; ++ii) { - if (m_nb_layers_tubes[ii][0] == stationIntId) { - numberOfLayers = m_nb_layers_tubes[ii][1]; - numberOfTubes[0] = m_nb_layers_tubes[ii][2]; - numberOfTubes[1] = m_nb_layers_tubes[ii][3]; - if (numberOfTubes[0]>0 || numberOfTubes[1]>0 ) numberOfML = 1; - if (numberOfTubes[0]>0 && numberOfTubes[1]>0 ) numberOfML = 2; - break; - } - } - - if (numberOfML == 1 ) continue; // GO TO NEXT SEGMENT - - int minNumOfHits = numberOfLayers*2 - 1; - - if((int)segment.mdtHitsOnTrack()<minNumOfHits) continue; // GO TO NEXT SEGMENT - - // Get Histograms - TFile *mdtDqaRoot = m_histoManager->rootFile(); - std::string region = chamb.getRegion(); - std::string side = chamb.getSide(); - - PhiEtaNameConverter phiEtaConverter; - std::string chamberType = chamb.getName(); - - std::string chamberDirName = m_histoManager->GetMdtDirectoryName(chamb); - std::string effiDirName = chamberDirName+"/Efficiency"; - std::string expertDirName = chamberDirName+"/Expert"; - - TDirectory *chamberRootDir = mdtDqaRoot->GetDirectory(chamberDirName.c_str()); - TDirectory *effiRootDir = mdtDqaRoot->GetDirectory(effiDirName.c_str()); - TDirectory *expertRootDir = mdtDqaRoot->GetDirectory(expertDirName.c_str()); - - if ( !chamberRootDir || !effiRootDir ) { - delete GTFitter; GTFitter=0; - return StatusCode::FAILURE; - } - - std::string histoName; - TH1F* heffiEntries; - TH1F* heffiCounts; - TH2F* heffiVsRadius; - - expertRootDir->cd(); - histoName = "EfficiencyEntries"; - heffiEntries = (TH1F*) expertRootDir->FindObjectAny(histoName.c_str()); - histoName = "EfficiencyCounts"; - heffiCounts = (TH1F*) expertRootDir->FindObjectAny(histoName.c_str()); - if (!heffiEntries || !heffiCounts ) { - delete GTFitter; GTFitter=0; - return StatusCode::FAILURE; - } - - histoName = "EffiResidVsRadius"; - heffiVsRadius = (TH2F*) m_histoManager->GetMdtHisto(histoName,chamb); - - chamberRootDir->cd(); - float toffset(-9999.); - float timeCorrection(-9999.); - - if( m_useTimeCorrections && RPCTimeCorrection ) timeCorrection = segment.mdtHOT()[0]->timeOfFlight(); - if( m_useTimeCorrections && t0RefinementTimeCorrection ) timeCorrection = segment.fittedT0(); - - if ( m_GTFitON ) { - MdtCalibHitBase *segHit = segment.mdtHOT()[0]; - MuonFixedId id(segHit->identify()); - if (m_useNewCalibConstants ) { - calibRt = p_calib_input_svc->GetRtRelation(id); - if (calibRt==NULL ) { - continue; - } - GTFitRt = calibRt; - GTFitter->setRtRelation(GTFitRt); - // here a method on GTFitter should be implemented to setResolution ! - // something like - } - - toffset = GTFitter->GTFit(&segment); - if ((int)segment.mdtHitsOnTrack() < minNumOfHits ) continue; - - // Recalibrate all rawhits on this chamber - const MuonCalibRawHitCollection *raw_hits(event.rawHitCollection()); - for (MuonCalibRawHitCollection::MuonCalibRawMdtHitVecCit it= - raw_hits->rawMdtHitCollectionBegin(); - it!=raw_hits->rawMdtHitCollectionEnd(); ++it) { // LOOP OVER RawHitCollection - - if (GTFitRt==NULL) { - continue; - } - MuonCalibRawMdtHit *hit = *it; - bool samestation( (hit->identify()).stationNameString()==stationNameStr ); - bool samephi( (hit->identify()).phi()==phi ); - bool sameeta( (hit->identify()).eta()==eta ); - bool sameChamber = samestation && samephi && sameeta; - if (p_reg_sel_svc->isInRegion(hit->identify()) && sameChamber ){ - int rawTime = hit->tdcCount(); - double newDriftTime = (double)rawTime*25./32. - toffset; - double newRadius = GTFitRt->radius(newDriftTime); - double newResol(9999.); - if (m_defaultResol) newResol = defaultResolution(newRadius); - if (!m_defaultResol) newResol = GTFitter->getDefaultResolution(newRadius); //it is in fact the same - hit->setDriftTime(newDriftTime); - hit->setDriftRadius(newRadius); - hit->setDriftRadiusError(newResol); - - } // close IF the hit is in the same chamber - } // END LOOP OVER RawHitCollection - } //END IF GTFIT ON - - // RECALIBRATION with NEW CALIB CONSTANTS if GTFIT is OFF - if (m_useNewCalibConstants && !m_GTFitON ) { - // Recalibrate all MdtCalibHitBase on the segment - // (in case calibrations used now are different from those of original segments) - for (unsigned int l=0; l<segment.mdtHitsOnTrack(); l++) { // LOOP OVER MdtCalibHitBase in the segment - MdtCalibHitBase * segHit = segment.mdtHOT()[l]; - MuonFixedId id(segHit->identify()); - const MdtStationT0Container *t0=p_calib_input_svc->GetT0(id); - const IRtRelation *rt_relation = p_calib_input_svc->GetRtRelation(id); - const IRtResolution *spat_res = p_calib_input_svc->GetResolution(id); - if (t0==NULL || rt_relation==NULL || spat_res==NULL) { - continue; - } - - unsigned short rawTime = segHit->tdcCount(); - double newDriftTime = (double)rawTime*25./32. - t0->t0(id.mdtMultilayer(),id.mdtTubeLayer(),id.mdtTube()); - if( m_useTimeCorrections ) newDriftTime = newDriftTime - timeCorrection; - double newRadius = rt_relation->radius(newDriftTime); - double newResol(9999.); - if (!m_defaultResol) newResol = spat_res->resolution(newDriftTime); - if (m_defaultResol) newResol = defaultResolution(newRadius); - segHit->setDriftTime(newDriftTime); - segHit->setDriftRadius(newRadius, newResol); - } // END OVER MdtCalibHitBase in the segment - - // Recalibrate all rawhits on this chamber - const MuonCalibRawHitCollection *raw_hits(event.rawHitCollection()); - for (MuonCalibRawHitCollection::MuonCalibRawMdtHitVecCit it= - raw_hits->rawMdtHitCollectionBegin(); - it!=raw_hits->rawMdtHitCollectionEnd(); ++it) { // LOOP OVER RawHitCollection - - MuonCalibRawMdtHit *hit = *it; - bool samestation( (hit->identify()).stationNameString()==stationNameStr ); - bool samephi( (hit->identify()).phi()==phi ); - bool sameeta( (hit->identify()).eta()==eta ); - bool sameChamber = samestation && samephi && sameeta; - if (p_reg_sel_svc->isInRegion(hit->identify()) && sameChamber ) { - const MuonFixedId & id(hit->identify()); - const MdtStationT0Container *t0=p_calib_input_svc->GetT0(id); - const IRtRelation *rt_relation = p_calib_input_svc->GetRtRelation(id); - const IRtResolution *spat_res = p_calib_input_svc->GetResolution(id); - - if (t0==NULL || rt_relation==NULL || spat_res==NULL) { - continue; - } - - int rawTime = hit->tdcCount(); - double newDriftTime = (double)rawTime*25./32. - t0->t0(id.mdtMultilayer(),id.mdtTubeLayer(),id.mdtTube()); - newDriftTime = newDriftTime - timeCorrection; - double newRadius = rt_relation->radius(newDriftTime); - double newResol(9999.); - if (!m_defaultResol) newResol = spat_res->resolution(newDriftTime); - if (m_defaultResol) newResol = defaultResolution(newRadius); - hit->setDriftTime(newDriftTime); - hit->setDriftRadius(newRadius); - hit->setDriftRadiusError(newResol); - - } // close IF the hit is in the same chamber - } // END LOOP OVER RawHitCollection - } // CLOSE If m_useNewCalibConstants - // END RECALIBRATION with NEW CALIB CONSTANTS - - - // Now everything is recalibrated and segments are ready. - // Will start to remove one hit per layer - MTStraightLine track0; - track0 = MTStraightLine(segment.position(),segment.direction(), - Amg::Vector3D(0,0,0), Amg::Vector3D(0,0,0)); - - // loop over MultiLayers - for (int multilayer=1; multilayer<=numberOfML; multilayer++) { // LOOP OVER MULTILAYERS - - const MuonGM::MdtReadoutElement *MdtRoEl = - m_detMgr->getMdtReadoutElement( m_idHelper->mdtIdHelper().channelID(station_id,multilayer,1,1) ); - - //loop over layers - for (int layer=1; layer<=numberOfLayers; layer++) { // LOOP OVER LAYERS - - nb_hits = 0; - - // hit selection vector for refits: - // Exclude hit in the current layer - IMdtSegmentFitter::HitSelection - hit_selection = IMdtSegmentFitter::HitSelection(segment.mdtHitsOnTrack()); - - for (unsigned int l=0; l<segment.mdtHitsOnTrack(); l++) { - MuonFixedId id((segment.mdtHOT()[l])->identify()); - if (id.mdtMultilayer() == multilayer && - id.mdtTubeLayer() == layer) { - hit_selection[l] = 1; - } else { - hit_selection[l] = 0; - nb_hits = nb_hits+1; - } - } - - if (nb_hits<minNumOfHits) continue; // GO TO NEXT LAYER - - fitter->fit(segment,hit_selection); - - if ((int)segment.mdtHitsOnTrack() < minNumOfHits ) continue; - if (segment.chi2()>m_chi2Cut) continue; - - // counts the hits per Layers in the segment with the excluded layer - int hit_ML_Ly[2][4]; - int totLayersWithHits = 0; - for (int iml=0; iml<2; iml++) { - for (int il=0; il<4; il++) hit_ML_Ly[iml][il]= 0; - } - - for (unsigned int l=0; l<segment.mdtHitsOnTrack(); l++) { - MuonFixedId id((segment.mdtHOT()[l])->identify()); - hit_ML_Ly[id.mdtMultilayer()-1][id.mdtTubeLayer()-1]++; - } - for (int iml=0; iml<2; iml++) { - for (int il=0; il<4; il++) if (hit_ML_Ly[iml][il]>0) totLayersWithHits++; - } - if ( totLayersWithHits < minNumOfHits ) continue; - - // NOW WE HAVE A SELECTED SEGMENT WITH EXCLUDED HIT - - MTStraightLine track1; - track1 = MTStraightLine(segment.position(),segment.direction(), - Amg::Vector3D(0,0,0), Amg::Vector3D(0,0,0)); - - std::vector<int> traversed_tube(0); - std::vector<int> hit_tube(0); - std::vector<int> hit_found(0); - double distanceTraversedTube(0); - - // find tubes which have been traversed by the track // - for (int k=0; k<numberOfTubes[multilayer-1]; k++) { - Amg::Vector3D TubePos = - MdtRoEl->GlobalToAmdbLRSCoords(MdtRoEl->tubePos(multilayer,layer,k+1)); - - Amg::Vector3D tube_position = Amg::Vector3D(TubePos.x(), TubePos.y(), TubePos.z()); - Amg::Vector3D tube_direction = Amg::Vector3D(1,0,0); - - MTStraightLine tube = MTStraightLine( tube_position, tube_direction, - Amg::Vector3D(0,0,0), Amg::Vector3D(0,0,0) ); - - double distance = std::abs(track1.signDistFrom(tube)); - - if ( distance < (MdtRoEl->innerTubeRadius()) ){ - int traversedTube = k+1; - traversed_tube.push_back(k+1); - distanceTraversedTube = distance; - - // TRAVERSED TUBE FOUND! NOW CHECK WHETHER THERE IS A HIT IN THIS TUBE FROM THE RAW HIT COLLECTION: - - bool hitFound = false; - const MuonCalibRawHitCollection *raw_hits(event.rawHitCollection()); - for (MuonCalibRawHitCollection::MuonCalibRawMdtHitVecCit it= - raw_hits->rawMdtHitCollectionBegin(); - it!=raw_hits->rawMdtHitCollectionEnd(); ++it) { // LOOP OVER RawHitCollection - - MuonCalibRawMdtHit *hit = *it; - bool samestation( (hit->identify()).stationNameString()==stationNameStr ); - bool samephi( (hit->identify()).phi()==phi ); - bool sameeta( (hit->identify()).eta()==eta ); - bool sameChamber = samestation && samephi && sameeta; - if (p_reg_sel_svc->isInRegion(hit->identify()) && sameChamber && - (hit->identify()).mdtMultilayer() == multilayer && - (hit->identify()).mdtTubeLayer() == layer) { - - if ( hit->adcCount() < m_adcCut ) continue; - - int tubeHit = (hit->identify()).mdtTube(); - - if (tubeHit == traversedTube) { // THE HIT IS FOUND - // check if the same hit was already found - bool alreadyThere = false; - //loop over hit tubes - for (unsigned int j=0; j<hit_found.size(); j++) { - if (tubeHit==hit_found[j]){ - alreadyThere=true; - break; - } - } - - if (!alreadyThere) { // A NEW HIT HAS BEEN FOUND - hitFound = true; - hit_found.push_back( tubeHit ); - if ( m_nsigma < 0 ) hit_tube.push_back( tubeHit ); - - Amg::Vector3D TubePos = - MdtRoEl->GlobalToAmdbLRSCoords(MdtRoEl->tubePos(multilayer,layer,tubeHit)); - - Amg::Vector3D tube_position = Amg::Vector3D(TubePos.x(), TubePos.y(), TubePos.z()); - Amg::Vector3D tube_direction = Amg::Vector3D(1,0,0); - - MTStraightLine tube = MTStraightLine( tube_position, tube_direction, - Amg::Vector3D(0,0,0), Amg::Vector3D(0,0,0) ); - - double distance = std::abs(track1.signDistFrom(tube)); - double hitRadius = std::abs(hit->driftRadius()); - double resol = hit->driftRadiusError(); - double resid = distance-hitRadius; - if(heffiVsRadius) heffiVsRadius->Fill(distance, resid); - float averageExtrapolError = 0.090; // ..an educated guess! - float sig = std::hypot(resol, averageExtrapolError); - - if ( m_nsigma>0. && std::abs(resid) < m_nsigma*sig ) hit_tube.push_back( tubeHit ); - } // END NEW HIT FOUND - } // close IF the Hit is found - } // close IF the hit is in the same chamber, same layer - } // END LOOP OVER RawHitCollection - if (!hitFound) if(heffiVsRadius) heffiVsRadius->Fill(distanceTraversedTube,15.5); - - } // Close IF Traversed Tube Found - } // END LOOP OVER ALL TUBES IN THE LAYER - - // Efficiencies // - - //loop over traversed tubes - for (unsigned int k=0; k<traversed_tube.size(); k++) { - int hit_flag = 0; - //loop over hit tubes - for (unsigned int j=0; j<hit_tube.size(); j++) { - if(traversed_tube[k]==hit_tube[j]){ - hit_flag = 1; - break; - } - } - int offset=0; - if(multilayer==1) offset= m_histoManager->GetTubeOffsetML1(chamb.getOnlineName()); - - int offset_atend=0; - if(multilayer==1) offset_atend= m_histoManager->GetTubeOffsetAtEndML1(chamb.getOnlineName()); - - float iTube = traversed_tube[k]; - float ibin = (multilayer-1)*numberOfLayers*numberOfTubes[multilayer-1]+ - (layer-1)*(numberOfTubes[multilayer-1]+offset+offset_atend)+iTube+offset; - heffiEntries->Fill(ibin); - if ( hit_flag) heffiCounts->Fill(ibin); - } - } //end of loop over layers - } //end of loop over multilayers - - } // end LOOP OVER SEGMENTS - - delete fitter; - delete GTFitter; - - return StatusCode::SUCCESS; -} //end MdtDqaTubeEfficiency::handleEvent - -//***************************************************************************** - -//:::::::::::::::::::::::::::: -//:: METHOD analyseSegments :: -//:::::::::::::::::::::::::::: - -StatusCode MdtDqaTubeEfficiency::analyseSegments(const std::vector<MuonCalibSegment *> & /*segments*/) { - - TFile *mdtDqaRoot = m_histoManager->rootFile(); - const std::vector<MuonCalib::NtupleStationId> stationsInRegion = - p_reg_sel_svc->GetStationsInRegions(); - - ToString ts; - //loop over stations in region - for ( int istation=0; istation<m_nb_stations; istation++ ) { - int phi = stationsInRegion.at(istation).GetPhi(); - int eta = stationsInRegion.at(istation).GetEta(); - std::string stationNameString = stationsInRegion.at(istation).regionId(); - std::string chamberType = stationNameString.substr(0,3); - - MDTName chamb(chamberType,phi,eta); - - // In the following lines the numberOfML, numberOfLayers, numberOfTubes - // are extracted RELYING on the order of the vector m_nb_layers_tubes[istation][] - // with istation following the same order of stationsInRegion.at(istation) - // ...if this is not the case, then the service m_mdtIdHelper should be used - // matching the stationIntId : - int numberOfML = 0; - int numberOfTubes[2]; - int numberOfLayers = m_nb_layers_tubes[istation][1]; - numberOfTubes[0] = m_nb_layers_tubes[istation][2]; - numberOfTubes[1] = m_nb_layers_tubes[istation][3]; - if (numberOfTubes[0]>0 || numberOfTubes[1]>0 ) numberOfML = 1; - if (numberOfTubes[0]>0 && numberOfTubes[1]>0 ) numberOfML = 2; - - std::string region= chamb.getRegion(); - std::string side=chamb.getSide(); - - PhiEtaNameConverter phiEtaConverter; - std::string chamberDirName = m_histoManager->GetMdtDirectoryName(chamb); - - std::string effiDirName = chamberDirName+"/Efficiency"; - std::string expertDirName = chamberDirName+"/Expert"; - TDirectory *chamberRootDir = mdtDqaRoot->GetDirectory(chamberDirName.c_str()); - TDirectory *effiRootDir = mdtDqaRoot->GetDirectory(effiDirName.c_str()); - TDirectory *expertRootDir = mdtDqaRoot->GetDirectory(expertDirName.c_str()); - - if ( !chamberRootDir || !effiRootDir ) { - return StatusCode::FAILURE; - } - - std::string histoName; - TH1F *heffiEntries; - TH1F *heffiCounts; - - expertRootDir->cd(); - histoName = "EfficiencyEntries"; - heffiEntries = (TH1F*) expertRootDir->FindObjectAny(histoName.c_str()); - histoName = "EfficiencyCounts"; - heffiCounts = (TH1F*) expertRootDir->FindObjectAny(histoName.c_str()); - if (!heffiEntries || !heffiCounts ) { - return StatusCode::FAILURE; - } - - chamberRootDir->cd(); - TH1F *hg; - histoName = "UNDEFINED"; - if (stationNameString.substr(1,1) == "I" ) histoName = "TubeEfficiency_Inner"; - if (stationNameString.substr(1,1) == "M" ) histoName = "TubeEfficiency_Middle"; - if (stationNameString.substr(1,1) == "O" ) histoName = "TubeEfficiency_Outer"; - hg = (TH1F*) m_histoManager->GetMdtHisto(histoName,region,side); - - // HERE NOW COMPUTE EFFICIENCY ERRORS AND FILL THE HISTOGRAMS - - if (heffiEntries->GetEntries() != 0 ) { - //loop over multilayers - for (int k=0; k<numberOfML; k++) { - - //loop over layers - for (int l=0; l<numberOfLayers; l++) { - - //loop over tubes - for (int m=0; m<numberOfTubes[k]; m++) { - int iML = k+1; - int iLy = l+1; - int iTube = m+1; - int ibin = (iML-1)*numberOfLayers*numberOfTubes[k]+(iLy-1)*numberOfTubes[k]+iTube; - //calculate efficiency and errors - - // HERE WE USE THE Efficiency definition and Error using the Bayesian Statistics: - // - float entries = heffiEntries->GetBinContent(ibin); - float counts = heffiCounts->GetBinContent(ibin); - float efficiency = (counts+1.)/(entries+2.); - float error = std::sqrt(efficiency*(1-efficiency))/std::sqrt(entries+3.); - // - // Fill MdtDqa Histos - // - - std::string histoName; - TH1F *heffi; - chamberRootDir->cd(); - histoName = "b_EfficiencyPerTube"; - heffi = (TH1F*) chamberRootDir->FindObjectAny(histoName.c_str()); - if (!heffi) { - continue; - } - heffi->SetBinContent(ibin,efficiency); - heffi->SetBinError(ibin,error); - - histoName = "EffiPerTube_ML"+ts(iML)+"_L"+ts(iLy); - effiRootDir->cd(); - heffi= (TH1F*) effiRootDir->FindObjectAny(histoName.c_str()); - if (!heffi) { - continue; - } - heffi->SetBinContent(iTube,efficiency); - heffi->SetBinError(iTube,error); - - // Filling Global plots - if (hg && efficiency>0. && error >0. && error<0.05) hg->Fill(efficiency); - - // HERE WE MUST ADD THE EFFICIENCY PER MULTILAYER - // and in case per chamber to put in a NEW overview plot! - // ... - // - - } // loop over tube - } // loop over Layer - } // loop over ML - } - - } //LOOP on istation - - return StatusCode::SUCCESS; -} //end MdtDqaTubeEfficiency::analyseSegments - -} // namespace MuonCalib diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/src/NtupleMdtDqaTool.cxx b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/src/NtupleMdtDqaTool.cxx deleted file mode 100644 index 93c00b1246a303dd8181cc4d05ed4c8c1ddeca1d..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/src/NtupleMdtDqaTool.cxx +++ /dev/null @@ -1,360 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -//:: IMPLEMENTATION OF METHODS DEFINED IN THE CLASS NtupleMdtDqaTool :: -//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - -//:::::::::::::::::: -//:: HEADER FILES :: -//:::::::::::::::::: - -// standard C++ // -#include <iostream> -#include <fstream> -#include <string> -#include <vector> -#include <cstdlib> - -// MuonReadoutGeometry // -#include "MuonReadoutGeometry/MuonDetectorManager.h" -#include "MuonReadoutGeometry/MdtReadoutElement.h" -#include "MuonCalibITools/IIdToFixedIdTool.h" -#include "MdtCalibInterfaces/IMdtSegmentFitter.h" - -// MuonCalib // -#include "MuonCalibEventBase/MuonCalibRawHitCollection.h" -#include "MuonCalibEventBase/MuonCalibRawMdtHit.h" -#include "MuonCalibEventBase/MuonCalibSegment.h" -#include "MdtCalibFitters/QuasianalyticLineReconstruction.h" -#include "MuonCalibEventBase/MuonCalibEvent.h" - -// NtupleMdtDqaTool // -#include "MuonCalibStandAloneExtraTools/NtupleMdtDqaTool.h" -#include "MuonCalibStandAloneExtraTools/PhiEtaUtils.h" -#include "MuonCalibStandAloneExtraTools/MDTName.h" - -//this -#include "MuonCalibStandAloneBase/NtupleStationId.h" -#include "MuonCalibStandAloneBase/RegionSelectionSvc.h" - -#include "MdtCalibIOSvc/MdtCalibInputSvc.h" - -//root -#include "TFile.h" -#include "TH1.h" -#include "TNtuple.h" -#include "TString.h" -#include "TDirectory.h" - -namespace MuonCalib { - -//***************************************************************************** - -// constructor -// -// a parte le declareProperty ....come deve essere fatto questo costruttore? che sono qui "t" "n" e "p" ??? -// -// - -NtupleMdtDqaTool::NtupleMdtDqaTool( const std::string &t, const std::string &n, - const IInterface *p) : AthAlgTool(t, n, p) { - - declareInterface< NtupleCalibrationTool >(this); - - m_MdtDqa_file_name = std::string("MdtDqa"); - declareProperty("MdtDqaFileName", m_MdtDqa_file_name); - - m_verbose = false; - declareProperty("Verbose", m_verbose); - - m_doHitResids = true; - declareProperty("doSegHitResidsVsRadius", m_doHitResids); - - m_fillHistos = true; - declareProperty("FillHistos", m_fillHistos); - - m_doFinalize = true; - declareProperty("doFinalize", m_doFinalize); - - m_doEfficiency = true; - declareProperty("doEfficiency", m_doEfficiency); - - m_ADCCUT=70.; - declareProperty("ADCCUT", m_ADCCUT); - - m_EffiNSigma = -1.; // set a negative value for Hardware Eficiency - declareProperty("EffiNSigma", m_EffiNSigma); - - m_EffiChi2Cut = 5.; // cut on chi2/dof - declareProperty("EffiChi2Cut", m_EffiChi2Cut); - - m_EffiHitADCCut = 0.; - declareProperty("EffiHitADCCut", m_EffiHitADCCut); - - m_EffiUseDefaultResolution = false; - declareProperty("EffiUseDefaultResolution", m_EffiUseDefaultResolution); - - m_EffiGTFitON = false; - declareProperty("EffiGTFitON", m_EffiGTFitON); - - m_EffiUseNewCalibConstants = false; - declareProperty("EffiUseNewCalibConstants", m_EffiUseNewCalibConstants); - - m_EffiUseTimeCorrections = false; - declareProperty("EffiUseTimeCorrections", m_EffiUseTimeCorrections); - - // - // MdtDqaGlobalTimeFit jobOptions : - // - m_doGlobalTimeFit = true; - declareProperty("doGlobalTimeFit", m_doGlobalTimeFit); - - m_rtDefaultBfieldON = 0; - declareProperty("rtDefaultBfieldON",m_rtDefaultBfieldON); - - m_GTFitSeg_chi2Cut = 15.; - declareProperty("GTFitSeg_chi2Cut",m_GTFitSeg_chi2Cut); - - m_GTFitSeg_minNumHits = 4; - declareProperty("GTFitSeg_minNumHits",m_GTFitSeg_minNumHits); - - m_GTFitSeg_maxNumHits = 10; - declareProperty("GTFitSeg_maxNumHits",m_GTFitSeg_maxNumHits); - - m_GTFitDebug = false; - declareProperty("GTFitDebug",m_GTFitDebug); - - // DO TRACK ANALYSIS - m_doTracks = false; - declareProperty("doTracks",m_doTracks); - - m_TrkAuthor = -1; - declareProperty("TrkAuthor",m_TrkAuthor); - - m_DeadElementsAlgorithm= 1; //1 = analysis by Marco, 0 = analysis by Toni - declareProperty("DeadElementsAlgorithm",m_DeadElementsAlgorithm); -} - -//::::::::::::::::: -//:: METHOD init :: -//::::::::::::::::: -StatusCode NtupleMdtDqaTool::initialize() { - - ATH_MSG_INFO("Initializing NtupleMdtDqaTool"); - - ATH_CHECK(m_idHelperSvc.retrieve()); - - ATH_CHECK(detStore()->retrieve(m_detMgr)); - - //retrieve fixed id tool - std::string idToFixedIdToolType("MuonCalib::IdToFixedIdTool"); - std::string idToFixedIdToolName("MuonCalib_IdToFixedIdTool"); - - ATH_CHECK(toolSvc()->retrieveTool(idToFixedIdToolType, idToFixedIdToolName, m_id_tool)); - - //get region selection service - ATH_CHECK(service("RegionSelectionSvc", p_reg_sel_svc)); - - //get pointer to Calibration input service - ATH_CHECK(service("MdtCalibInputSvc", p_calib_input_svc)); - - //------------------------------------------------------// - //-- Check Region and book histograms --// - //------------------------------------------------------// - - PhiEtaNameConverter phiEtaConverter; - - // loop on stations to find SectorMin and SectorMax - int barrelEndCap; // 1 = Barrel ; 2 = EndCap - int iside; // iside = 1 => "A" ; iside = 2 => "C" - - int sectorMin = 20; - int sectorMax = 0; - int SectorMin[2][2] ; - int SectorMax[2][2] ; - int SectorMinMax[2][2][2]; - std::string spectrometerRegion[2]; - std::string spectrometerSide[2]; - spectrometerRegion[0] = "Barrel"; - spectrometerRegion[1] = "Endcap"; - spectrometerSide[0] = "A"; - spectrometerSide[1] = "C"; - for (int i=0;i<=1;i++) { - for (int j=0;j<=1;j++) { - SectorMin[i][j] = 20; - SectorMax[i][j] = 0; - SectorMinMax[i][j][0] = 20; - SectorMinMax[i][j][1] = 0; - } - } - - const std::vector<MuonCalib::NtupleStationId> stationsInRegion = p_reg_sel_svc->GetStationsInRegions(); - std::vector<MuonCalib::NtupleStationId>::const_iterator itstation; - for (itstation = stationsInRegion.begin(); itstation!=stationsInRegion.end(); itstation++) { - std::string stationName = itstation->regionId(); - std::string chamberType = stationName.substr(0,3); - int phi = itstation->GetPhi(); - int eta = itstation->GetEta(); - - MDTName chamb(chamberType,phi,eta); - int sector=chamb.getOnlineSector(); - iside = 1; - if (chamb.isBackward()) iside = 2; - barrelEndCap = 1; - if ( chamb.isEndcap() ) barrelEndCap = 2; - if(sector>SectorMax[barrelEndCap-1][iside-1]) SectorMax[barrelEndCap-1][iside-1] = sector; - if(sector<SectorMin[barrelEndCap-1][iside-1]) SectorMin[barrelEndCap-1][iside-1] = sector; - if(sector>sectorMax) sectorMax = sector; - if(sector<sectorMin) sectorMin = sector; - - if(sector<SectorMinMax[barrelEndCap-1][iside-1][0]) SectorMinMax[barrelEndCap-1][iside-1][0] = sector; - if(sector>SectorMinMax[barrelEndCap-1][iside-1][1]) SectorMinMax[barrelEndCap-1][iside-1][1] = sector; - } - - - //------------------------------------------------------------// - // Attach chamber name to output file name, // - // only if 1 chamber is analysed and filling is requested // - //------------------------------------------------------------// - if (stationsInRegion.size() ==1 && m_fillHistos ) - m_MdtDqa_file_name +="_"+stationsInRegion.at(0).regionId(); - - //-----------------------------------------------------------// - //-- Create Histogram Manager, Root Files and Book Histos --// - //-----------------------------------------------------------// - - // m_histoManager = new HistogramManager(); - - // use HistogramManager constructor with MdtIdHelper to retrieve the chamber geometry - m_histoManager = new HistogramManager(m_idHelperSvc.get()); - m_histoManager->SetDoTracks(m_doTracks); - - std::string mdtDqaRootFileName = m_MdtDqa_file_name+".root"; - if (m_fillHistos || m_doTracks) { - if(!m_histoManager->openOutputFile(mdtDqaRootFileName)) return StatusCode::FAILURE; - } - - if(m_doTracks) m_histoManager->buildTrackHistos(); - - if (m_fillHistos) { - // - // loop over REGIONS and Book TopLevel histograms : - // - // here below we should replace the use of SectorMin[i][j] with : SectorMinMax[i][j][0,1] - // - m_histoManager->buildGlobalHistos(); - for (int i=0;i<=1;i++) { - for (int j=0;j<=1;j++) { - int secMin = SectorMin[i][j]; - int secMax = SectorMax[i][j]; - if (secMin>0&&secMin<=16 && secMax>0&&secMax<=16 && secMin<=secMax ) { - m_histoManager->buildTopLevel(spectrometerRegion[i],spectrometerSide[j], secMin, secMax); - } - } - } - // - // loop over stations and Book Chamber histograms : - // - for (itstation = stationsInRegion.begin(); itstation!=stationsInRegion.end(); itstation++) { - // int stationNameId = itstation->GetStation(); - std::string stationName = itstation->regionId(); - std::string chamberType = stationName.substr(0,3); - int phi = itstation->GetPhi(); - int eta = itstation->GetEta(); - - MDTName chamb(chamberType,phi,eta); - std::string region = chamb.getRegion(); - std::string side = chamb.getSide(); - m_histoManager->buildChamberHistos(chamb); - } - } - - // put a protection if file is not open! - if (!(m_fillHistos || m_doTracks)) { - if (!m_histoManager->openUpdateFile(mdtDqaRootFileName)) return StatusCode::FAILURE; - } - - //------------------------------------------------------// - //-- Create Analysis Tools --// - //------------------------------------------------------// - - m_ntupleAna = new MdtDqaNtupleAnalysis(m_verbose, m_MdtDqa_file_name); - if(!m_ntupleAna->initialize(p_reg_sel_svc, m_histoManager, m_DeadElementsAlgorithm, m_ADCCUT).isSuccess()) { - return StatusCode::FAILURE; - } - - m_segmentAnalyzer=new SegmentAnalysis(p_reg_sel_svc,m_histoManager,m_verbose,m_doHitResids); - - if (m_doEfficiency) { - m_tubeEffi = new MdtDqaTubeEfficiency(m_EffiNSigma, m_EffiChi2Cut, - m_EffiUseDefaultResolution, m_EffiHitADCCut, m_EffiGTFitON, - m_EffiUseNewCalibConstants, m_EffiUseTimeCorrections); - if(!m_tubeEffi->initialize(m_idHelperSvc.get(), m_detMgr, m_id_tool, p_reg_sel_svc, p_calib_input_svc, m_histoManager).isSuccess()) return StatusCode::FAILURE; - } - - if (m_doGlobalTimeFit) { - m_globalTimeFit = new MdtDqaGlobalTimeFit(m_GTFitSeg_minNumHits,m_GTFitSeg_maxNumHits,m_GTFitSeg_chi2Cut, - m_rtDefaultBfieldON, m_GTFitDebug); - if(!m_globalTimeFit->initialize(m_detMgr, m_id_tool, p_reg_sel_svc, m_histoManager).isSuccess()) return StatusCode::FAILURE; - } - //FOR THE TRACK ANALYSIS - if (m_doTracks) { - m_trackAnalyzer=new MdtDqaTrackAnalysis(p_reg_sel_svc,m_TrkAuthor, m_histoManager,m_verbose); - } - return StatusCode::SUCCESS; -} - -//***************************************************************************** - -//::::::::::::::::::::: -//:: METHOD finalize :: -//::::::::::::::::::::: - -StatusCode NtupleMdtDqaTool::finalize(void) { - - ATH_MSG_INFO("Finalizing NtupleMdtDqaTool"); - - if (m_doFinalize) { - ATH_MSG_INFO("Executing MdtDqaNtupleAnalysis::histogramAnalysis "); - m_ntupleAna->histogramAnalysis(m_histoManager->rootFile()); - } - - m_histoManager->WriteAndCloseFile(); - return StatusCode::SUCCESS; -} //end NtupleMdtDqaTool::initialize - -//***************************************************************************** - -//:::::::::::::::::::::::: -//:: METHOD handleEvent :: -//:::::::::::::::::::::::: -StatusCode NtupleMdtDqaTool::handleEvent( const MuonCalibEvent &event, - int eventnumber, - const std::vector<MuonCalibSegment *> &segments, - unsigned int position) { - - if ( m_fillHistos) m_ntupleAna->handleEvent(event, eventnumber,segments,position); - if ( m_fillHistos) m_segmentAnalyzer->handleEvent(event, eventnumber, segments, position); - if ( m_doEfficiency) - if(!m_tubeEffi->handleEvent(event, eventnumber, segments, position).isSuccess()) return StatusCode::FAILURE; - if ( m_doGlobalTimeFit) - if(!m_globalTimeFit->handleEvent(event, eventnumber, segments, position).isSuccess()) return StatusCode::FAILURE; - if (m_doTracks) { - m_trackAnalyzer->handleEvent(event, eventnumber, segments, position); - } - return StatusCode::SUCCESS; -} - -//***************************************************************************** - -//:::::::::::::::::::::::::::: -//:: METHOD analyseSegments :: -//:::::::::::::::::::::::::::: -StatusCode NtupleMdtDqaTool::analyseSegments(const std::vector<MuonCalibSegment *> &/*segments*/) { - ATH_MSG_INFO("NtupleMdtDqaTool::analyseSegments ...it does nothing analysis moved elsewhere"); - return StatusCode::SUCCESS; -} - -} //namespace MuonCalib diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/src/NtupleSplitterTool.cxx b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/src/NtupleSplitterTool.cxx deleted file mode 100644 index 25308b11b6f5aa2c94f62ffeed54f788281ae814..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/src/NtupleSplitterTool.cxx +++ /dev/null @@ -1,430 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -//c - c++ -#include "iostream" -#include "fstream" -#include "sstream" -#include <string.h> - -//root -#include "TFile.h" -#include "TTree.h" - - -//MuonCalibEventBase -#include "MuonCalibEventBase/MuonCalibSegment.h" -#include "MuonCalibEventBase/MuonCalibEvent.h" -#include "MuonCalibEventBase/MuonCalibPattern.h" -#include "MuonCalibEventBase/MuonCalibTruthCollection.h" -#include "MuonCalibEventBase/MuonCalibTruth.h" -#include "MuonCalibEventBase/MuonCalibMdtTruthHit.h" -#include "MuonCalibEventBase/MuonCalibRpcTruthHit.h" -#include "MuonCalibEventBase/MuonCalibTgcTruthHit.h" -#include "MuonCalibEventBase/MuonCalibCscTruthHit.h" -#include "MuonCalibEventBase/MuonCalibRawHitCollection.h" -#include "MuonCalibEventBase/MuonCalibRawMdtHit.h" -#include "MuonCalibEventBase/MuonCalibRawRpcHit.h" -#include "MuonCalibEventBase/MuonCalibRawTgcHit.h" - -//MuonCalibExtraTreeAlg -#include "MuonCalibExtraTreeAlg/MuonCalibHit_EBranch.h" -#include "MuonCalibExtraTreeAlg/MuonCalibTrack_EBranch.h" - -//MuonCalibExtraTreeEvent -#include "MuonCalibExtraTreeEvent/MuonCalibEvent_E.h" -#include "MuonCalibExtraTreeEvent/MuonCalibHit_E.h" -#include "MuonCalibExtraTreeEvent/MuonCalibTrack_E.h" - - -//MuonCalibIdentifier -#include "MuonCalibIdentifier/MuonFixedId.h" - -//MuonCalibNtuple -#include "MuonCalibNtuple/MuonCalibBranchNtuple.h" -#include "MuonCalibNtuple/RootFileManager.h" - -//MuonCalibStandAloneBase -#include "MuonCalibStandAloneBase/RegionSelectionSvc.h" - -//this -#include "NtupleSplitterTool.h" - - -namespace MuonCalib { - -NtupleSplitterTool::NtupleSplitterTool(const std::string &t, const std::string &n, const IInterface *p): - AthAlgTool(t, n, p), m_split_level(1), m_ntuple_split_level(2), - m_calib_tool_handle("MuonCalib::NtupleRunScanTool"), m_file_number(0), m_stored_patterns(0) { - declareInterface< NtupleCalibrationTool >(this); - declareProperty("FileSplitLevel",m_split_level ); - declareProperty("NtupleSplitLevel", m_ntuple_split_level); - declareProperty("ToolToRun", m_calib_tool_handle); - m_max_patterns=0; - declareProperty("MaxPatterns", m_max_patterns); - m_filename_prefix="Ntuple"; - declareProperty("FilenamePrefix", m_filename_prefix); - m_store_truth = false; - declareProperty("StoreTruth", m_store_truth); - m_store_mdt_rawdata = false; - declareProperty("StoreMdtRawdata", m_store_mdt_rawdata); - m_adc_cut =0; - declareProperty("AdcCut", m_adc_cut); - m_store_rpc_rawdata=false; - declareProperty("StoreRpcRawdata", m_store_rpc_rawdata); - m_store_tgc_rawdata=false; - declareProperty("StoreTgcRawdata", m_store_tgc_rawdata); - m_trigger_only_segment_stations = true; - declareProperty("TriggerForSegmentStationOnly", m_trigger_only_segment_stations); - m_store_raw_triger = false; - declareProperty("StoreRawTriggerData", m_store_raw_triger); - declareProperty("FillTrackAuthors", m_track_authors); - m_all_fill_tracks=false; - m_track_p_cut=-3.; - declareProperty("TrackPCut", m_track_p_cut); -} //end NtupleSplitterTool::NtupleSplitterTool - -StatusCode NtupleSplitterTool::initialize() { -//get region selection service - StatusCode sc=service("RegionSelectionSvc", p_reg_sel_svc); - if(!sc.isSuccess()) { - ATH_MSG_ERROR("Cannot retrieve RegionSelectionSvc!"); - return sc; - } - sc = m_calib_tool_handle.retrieve(); - if (m_ntuple_split_level<m_split_level) { - ATH_MSG_WARNING("Setting ntuple split level to file split level!"); - m_ntuple_split_level = m_split_level; - } - for(std::vector<int>::iterator it=m_track_authors.begin(); it!=m_track_authors.end(); it++) { - if ((*it)<0) { - m_all_fill_tracks=true; - break; - } - m_track_authors_set.insert(*it); - } - return sc; -} //end NtupleSplitterTool::initialize - -StatusCode NtupleSplitterTool::finalize() { - RootFileManager * rfm=RootFileManager::getInstance(); - rfm->closeFile(); - return StatusCode::SUCCESS; -} - -StatusCode NtupleSplitterTool::handleEvent(const MuonCalibEvent &event, int evnt_nr, const std::vector<MuonCalibSegment *> &segments, unsigned int position) { -//loop over al lnew segments - m_stations_with_seg_hits.clear(); - std::map<NtupleStationId, MuonCalibPattern *> region_patterns; - for (unsigned int i=position; i<segments.size(); i++) { - MuonCalibSegment *segment=segments[i]; - //get list of regions - std::set<NtupleStationId> current_regions; - for(MuonCalibSegment::MdtHitCit it=segment->mdtHOTBegin(); it!=segment->mdtHOTEnd(); it++) { - NtupleStationId c_id((*it)->identify()); - c_id.SetMultilayer(0); - m_stations_with_seg_hits.insert(c_id); - c_id=ntuple_region_id((*it)->identify()); - //create new pattern if needed - if(region_patterns[c_id]==NULL) { - region_patterns[c_id] = new MuonCalibPattern(); - } - //fill segment in patttern, if it is not already inserted - if(current_regions.find(c_id)==current_regions.end()) { - region_patterns[c_id]->addMuonSegment(new MuonCalibSegment(*segment)); - current_regions.insert(c_id); - } - } - } - -//fill patterns - m_ntuples_initialized.clear(); - for(std::map<NtupleStationId,MuonCalibPattern * >::iterator it=region_patterns.begin(); it!=region_patterns.end(); it++) { - m_stored_patterns++; - MuonCalibBranchNtuple *ntpl(get_ntuple(it->first)); - m_ntuples_initialized.insert(it->first); - ntpl->fillEventToTree(event.eventInfo()); - ntpl->handlePattern(*(it->second)); - } - -//fill rawdata collections - const MuonCalibRawHitCollection *raw_hit_coll(event.rawHitCollection()); - if(raw_hit_coll!=NULL) { - m_rawdata_collections.clear(); - //mdt hits - if(m_store_mdt_rawdata) - process_rawdata<MuonCalibRawMdtHit>( raw_hit_coll->rawMdtHitCollectionBegin(), raw_hit_coll->rawMdtHitCollectionEnd()); - if(m_store_rpc_rawdata) - process_rawdata<MuonCalibRawRpcHit>( raw_hit_coll->rawRpcHitCollectionBegin(), raw_hit_coll->rawRpcHitCollectionEnd()); - if(m_store_tgc_rawdata) - process_rawdata<MuonCalibRawTgcHit>( raw_hit_coll->rawTgcHitCollectionBegin(), raw_hit_coll->rawTgcHitCollectionEnd()); - - for(std::map<NtupleStationId, MuonCalibRawHitCollection *>::iterator it = m_rawdata_collections.begin(); it!= m_rawdata_collections.end(); it++) { - MuonCalibBranchNtuple *ntpl(get_ntuple(it->first)); - if(m_ntuples_initialized.find(it->first) == m_ntuples_initialized.end()) { - m_ntuples_initialized.insert(it->first); - ntpl->fillEventToTree(event.eventInfo()); - } - ntpl->handleRawHits(*(it->second)); - } - } - -//loop on truth - const MuonCalibTruthCollection *truth(event.calibTruthCollection()); - if(truth != NULL && m_store_truth) { - m_truth_ntuples.clear(); -//fill mdt truth - fill_truth(truth->mdtTruthCollectionBegin(), truth->mdtTruthCollectionEnd(), event); -//fill rpc truth - fill_truth(truth->rpcTruthCollectionBegin(), truth->rpcTruthCollectionEnd(), event); -//fill tgc truth - fill_truth(truth->tgcTruthCollectionBegin(), truth->tgcTruthCollectionEnd(), event); -//fill csc truth - fill_truth(truth->cscTruthCollectionBegin(), truth->cscTruthCollectionEnd(), event); - }//if(truth != NULL && m_store_truth) -//fill ntuples - -//fill tracks - if(m_track_authors.size()) { - try { - const MuonCalibEvent_E & extra_event = dynamic_cast<const MuonCalibEvent_E &>(event); - fillTrackNtuple(extra_event); - } - catch(const std::bad_cast& exp) { - ATH_MSG_WARNING("Not reading extra tree, but track writing is requested!"); - m_track_authors.clear(); - } - } - - for(std::set<NtupleStationId>::const_iterator it=m_ntuples_initialized.begin(); it != m_ntuples_initialized.end(); it++) { - MuonCalibBranchNtuple *ntpl(m_ntuples[*it]); - if(!ntpl) continue; - if(m_store_raw_triger) - ntpl->handleRawTriggerHits( *event.rawTriggerHitCollection() ); - ntpl->finishEvent(); - } -//clear - for(std::map<NtupleStationId,MuonCalibPattern * >::iterator it=region_patterns.begin(); it!=region_patterns.end(); it++) { - delete it->second; - } - for(std::map<NtupleStationId, MuonCalibRawHitCollection *>::iterator it = m_rawdata_collections.begin(); it!= m_rawdata_collections.end(); it++) { - delete it->second; - } - return m_calib_tool_handle->handleEvent(event, evnt_nr, segments, position); -} //end NtupleSplitterTool::handleEvent - -inline void NtupleSplitterTool::fillTrackNtuple(const MuonCalibEvent_E &extra_event) { - for(std::map<NtupleStationId, MuonCalibHit_EBranch *>::iterator it=m_track_hit_branch.begin(); it!=m_track_hit_branch.end(); it++) - (it->second)->reset(); - for(std::map<NtupleStationId, MuonCalibTrack_EBranch *>::iterator it=m_track_branch.begin(); it!=m_track_branch.end(); it++) - (it->second)->reset(); - - for(MuonCalibEvent_E::TrackVec::const_iterator t_it = extra_event.beginTrack(); t_it!=extra_event.endTrack(); t_it++) { - const MuonCalibTrack_E *track(*t_it); - if(!m_all_fill_tracks && m_track_authors_set.find(track->author()) == m_track_authors_set.end()) { - continue; - } - if (m_track_p_cut>-1) { - if(track->qOverP()==0 || track->p()>1e8) { - continue; - } - if(m_track_p_cut>=0 && std::abs(track->p())<m_track_p_cut) { - continue; - } - } - std::list<MuonCalibHit_EBranch *> hit_branches; - std::list<MuonCalibTrack_EBranch *> track_branches; - std::set<NtupleStationId> station_ids; - - for(MuonCalibTrack_E::HitVector::const_iterator h_it=track->beginHit(); h_it!=track->endHit(); h_it++) { - const MuonCalibHit_E *hit(*h_it); - if(hit->type()!=1) continue; - const MuonFixedId &id(hit->identify()); - if(!p_reg_sel_svc->isInRegion(id)) continue; - for(std::map<NtupleStationId, MuonCalibHit_EBranch *>::const_iterator map_it=m_track_hit_branch.begin(); map_it!=m_track_hit_branch.end(); map_it++) { - if(station_ids.find(map_it->first) != station_ids.end()) - continue; - if(map_it->first == id) { - station_ids.insert(map_it->first); - hit_branches.push_back(map_it->second); - track_branches.push_back( m_track_branch[map_it->first] ); - m_ntuples_initialized.insert(map_it->first); - } - } - } - std::list<MuonCalibHit_EBranch *>::iterator hb_it=hit_branches.begin(); - std::list<MuonCalibTrack_EBranch *>::iterator tb_it=track_branches.begin(); - while (hb_it!=hit_branches.end() && tb_it!=track_branches.end()) { - if(!(*tb_it)->fillBranch(*track)) { - ATH_MSG_WARNING("Overfull track branch!"); - hb_it++; - tb_it++; - continue; - } - for(MuonCalibTrack_E::HitVector::const_iterator h_it=track->beginHit(); h_it!=track->endHit(); h_it++) { - const MuonCalibHit_E *hit(*h_it); - if(!((*hb_it)->fillBranch(*hit, 0., (*tb_it)->getBranchEntries() - 1))) { - ATH_MSG_WARNING("Overfull hit branch! "<<(*hb_it)->getBranchEntries()); - } - } - hb_it++; - tb_it++; - } - } -} //end NtupleSplitterTool::fillTrackNtuple - -inline MuonCalibBranchNtuple* NtupleSplitterTool::get_ntuple(const NtupleStationId &id) { - if(m_max_patterns>0 && m_stored_patterns>=m_max_patterns) { - RootFileManager *rfm=RootFileManager::getInstance(); - rfm->closeFile(); - for(std::map<NtupleStationId, MuonCalibBranchNtuple *>::iterator it=m_ntuples.begin(); it!=m_ntuples.end(); it++) - delete it->second; - m_ntuples.clear(); - m_stored_patterns=0; - m_file_number++; - } - if(m_ntuples[id]==NULL) { - RootFileManager *rfm=RootFileManager::getInstance(); - //generate file name - MuonFixedId fixid; - std::ostringstream filename; - filename<<m_filename_prefix; - if (m_split_level>0) { - filename<<"_"<<fixid.stationNumberToFixedStationString( id.GetStation()); - } - if (m_split_level>1) { - filename<<"_"<<id.GetPhi(); - } - if (m_split_level>2) { - filename<<"_"<<id.GetEta(); - } - filename<<"."<<m_file_number<<".root"; - rfm->openFile(filename.str()); - //generate region id - std::ostringstream region_id; - if (m_ntuple_split_level<1) { - region_id<<"PatternNtupleMaker"; - } else { - region_id<<fixid.stationNumberToFixedStationString( id.GetStation()); - } - if(m_ntuple_split_level>1) { - region_id<<"_"<<id.GetPhi(); - } - if(m_ntuple_split_level>2) { - region_id<<"_"<<id.GetEta(); - } - MuonCalibBranchNtuple *ntup=new MuonCalibBranchNtuple(region_id.str()); - m_ntuples[id] = ntup; - MuonCalibHit_EBranch *h_br=new MuonCalibHit_EBranch(); - h_br->createBranch(ntup->getTTree()); - m_track_hit_branch[id] = h_br; - MuonCalibTrack_EBranch *t_br=new MuonCalibTrack_EBranch(); - t_br->createBranch(ntup->getTTree()); - m_track_branch[id] = t_br; - } - return m_ntuples[id]; -} //end NtupleSplitterTool::get_ntuple - -inline NtupleStationId NtupleSplitterTool::ntuple_region_id(const MuonFixedId &id) { - if (m_ntuple_split_level<1) { - NtupleStationId c_id; - return c_id; - } - NtupleStationId c_id(id); - c_id.SetMultilayer(0); - if (m_ntuple_split_level<3) - c_id.SetEta(-99); - if (m_ntuple_split_level<2) - c_id.SetPhi(-1); - return c_id; -} - -inline void NtupleSplitterTool::add_truth(const MuonCalibTruthCollection *truth, MuonCalibBranchNtuple *ntpl) { - for(MuonCalibTruthCollection::TruthVecCit it=truth->truthCollectionBegin(); it!=truth->truthCollectionEnd(); it++) { - ntpl->fillTruthToTree(**it); - } -} - -inline MuonCalibBranchNtuple * NtupleSplitterTool ::get_ntuple_for_truth(const NtupleStationId &c_id, const MuonCalibEvent &event) { - const MuonCalibTruthCollection *truth(event.calibTruthCollection()); - MuonCalibBranchNtuple *ntpl=m_truth_ntuples[c_id]; - if(ntpl==NULL) { - ntpl = get_ntuple(c_id); - m_truth_ntuples[c_id] = ntpl; - add_truth(truth, ntpl); - if(m_ntuples_initialized.find(c_id) == m_ntuples_initialized.end()) { - ntpl->fillEventToTree(event.eventInfo()); - m_ntuples_initialized.insert(c_id); - m_truth_ntuples[c_id] = ntpl; - } - } - return ntpl; -} - -template<typename T, typename Tit> -void NtupleSplitterTool ::process_rawdata(Tit begin, Tit end) { - for(Tit it = begin; it != end; it++) { - if(!p_reg_sel_svc->isInRegion((*it)->identify())) - continue; - if(!rawdata_selector(**it)) continue; - NtupleStationId c_id(ntuple_region_id((*it)->identify())); - MuonCalibRawHitCollection * coll(m_rawdata_collections[c_id]); - if (coll==NULL) { - coll = new MuonCalibRawHitCollection(); - m_rawdata_collections[c_id] =coll; - } - coll->addMuonCalibRawHit(new T(**it)); - } -} - -inline bool NtupleSplitterTool ::rawdata_selector(const MuonCalibRawMdtHit &hit) { - return hit.adcCount() >= m_adc_cut; -} - -inline bool NtupleSplitterTool ::rawdata_selector(const MuonCalibRawRpcHit &hit) { - if(!m_trigger_only_segment_stations) - return true; - - const MuonFixedId &id(hit.identify()); - NtupleStationId s_id(id.stationNameString(), id.eta(), id.phi()); - return m_stations_with_seg_hits.find(s_id) != m_stations_with_seg_hits.end(); -} - -inline bool NtupleSplitterTool ::rawdata_selector(const MuonCalibRawTgcHit &hit) { - if(!m_trigger_only_segment_stations) - return true; - - const MuonFixedId &id(hit.identify()); - NtupleStationId s_id(id.stationNameString(), id.eta(), id.phi()); - return m_stations_with_seg_hits.find(s_id) != m_stations_with_seg_hits.end(); -} - -template<typename Tit> -void NtupleSplitterTool ::fill_truth(Tit begin, Tit end, const MuonCalibEvent &event) { - for (Tit it=begin; it!=end; it++) { - if(!p_reg_sel_svc->isInRegion((*it)->identify())) - continue; - NtupleStationId c_id(ntuple_region_id((*it)->identify())); - MuonCalibBranchNtuple *ntpl=get_ntuple_for_truth(c_id, event); - fill_truth_hit(**it, ntpl); - } -} - -inline void NtupleSplitterTool ::fill_truth_hit(const MuonCalibMdtTruthHit &it, MuonCalibBranchNtuple *ntpl) { - ntpl->fillMdtTruthToTree(it); -} - -inline void NtupleSplitterTool ::fill_truth_hit(const MuonCalibRpcTruthHit &it, MuonCalibBranchNtuple *ntpl) { - ntpl->fillRpcTruthToTree(it); -} - -inline void NtupleSplitterTool ::fill_truth_hit(const MuonCalibTgcTruthHit &it, MuonCalibBranchNtuple *ntpl) { - ntpl->fillTgcTruthToTree(it); -} - -inline void NtupleSplitterTool ::fill_truth_hit(const MuonCalibCscTruthHit &it, MuonCalibBranchNtuple *ntpl) { - ntpl->fillCscTruthToTree(it); -} - -} //namespace MuonCalib diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/src/NtupleSplitterTool.h b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/src/NtupleSplitterTool.h deleted file mode 100644 index 82b4c2f1689bd488cfe668b69a4c98d76c07db03..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/src/NtupleSplitterTool.h +++ /dev/null @@ -1,139 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef _NtupleSplitterTool_H -#define _NtupleSplitterTool_H - -//c - c++ -#include "map" - -//Gaudi -#include "GaudiKernel/ToolHandle.h" -#include "AthenaBaseComps/AthAlgTool.h" -//this -#include "MuonCalibStandAloneBase/NtupleCalibrationTool.h" -#include "MuonCalibStandAloneBase/NtupleStationId.h" - -//root -class TFile; - -//MuonCalibStandAloneBase -class RegionSelectionSvc; - -namespace MuonCalib { - -class MuonCalibBranchNtuple; -class MuonCalibTruthCollection; -class MuonCalibRawMdtHit; -class MuonCalibRawRpcHit; -class MuonCalibRawTgcHit; -class MuonCalibMdtTruthHit; -class MuonCalibRpcTruthHit; -class MuonCalibTgcTruthHit; -class MuonCalibCscTruthHit; -class MuonCalibHit_EBranch; -class MuonCalibTrack_EBranch; -class MuonCalibEvent_E; - -/** @class NtupleSplitterTool -Scans a run and checks for present chambers and number of hits -@author rauscher@cern.ch -*/ - -class NtupleSplitterTool: public AthAlgTool, virtual public NtupleCalibrationTool { - public: -//============================================================================== - /** Tool Constructor*/ - NtupleSplitterTool(const std::string &t, const std::string &n, const IInterface *p); - /** tool initialization */ - StatusCode initialize(); - /** tool finalization */ - StatusCode finalize(); - /**analyse event - fill hits into specra*/ - StatusCode handleEvent(const MuonCalibEvent &/*event*/, int /*evnt_nr*/, const std::vector<MuonCalibSegment *> &segments, unsigned int position); - /** we dont need to keep the segments*/ - bool KeepSegments() const { - return m_calib_tool_handle->KeepSegments(); - } - inline StatusCode analyseSegments(const std::vector<MuonCalibSegment *> &segments) { - return m_calib_tool_handle->analyseSegments(segments); - } - inline const IMdtCalibrationOutput* getResults() const { - return m_calib_tool_handle->getResults(); - } - inline const IRtResolution* getResolution() const { - return m_calib_tool_handle->getResolution(); - } - -//============================================================================== - private: - /** vector with ntuples*/ - std::map<NtupleStationId, MuonCalibBranchNtuple *> m_ntuples; - std::map<NtupleStationId, MuonCalibHit_EBranch *> m_track_hit_branch; - std::map<NtupleStationId, MuonCalibTrack_EBranch *> m_track_branch; - /** file split by level: <1 do not split file - 1 split by station - 2 split by station and phi - >2 split by station and phi and eta*/ - int m_split_level; - /** ntuple split level - minimum is split by station*/ - int m_ntuple_split_level; - /** create new files after given number of patterns */ - int m_max_patterns; - /** store truth information - jo*/ - bool m_store_truth; - /** store rawdata - jo */ - bool m_store_mdt_rawdata; - /** store rpc rawdata */ - bool m_store_rpc_rawdata; - bool m_store_tgc_rawdata; - /** store rpc data only for stations with segments */ - bool m_trigger_only_segment_stations; - /** store raw trigger data */ - bool m_store_raw_triger; - /** fill track branches - job-option */ - std::vector<int> m_track_authors; - std::set<int> m_track_authors_set; - bool m_all_fill_tracks; - double m_track_p_cut; - int m_adc_cut; - /** filename prefix **/ - std::string m_filename_prefix; - /** calibration tool to run while splitting */ - ToolHandle<NtupleCalibrationTool> m_calib_tool_handle; - //book keeping - std::map<NtupleStationId, MuonCalibBranchNtuple *> m_truth_ntuples; - std::set<NtupleStationId> m_ntuples_initialized; - //rawdata collections - std::map<NtupleStationId, MuonCalibRawHitCollection *> m_rawdata_collections; - //stations with segment hits - std::set<NtupleStationId> m_stations_with_seg_hits; - /** current file number and number of stored patterns */ - // calibration region // - RegionSelectionSvc *p_reg_sel_svc; - int m_file_number; - int m_stored_patterns; - inline MuonCalibBranchNtuple* get_ntuple(const NtupleStationId &id); - inline NtupleStationId ntuple_region_id(const MuonFixedId &id); - inline void add_truth(const MuonCalibTruthCollection *truth, MuonCalibBranchNtuple *ntpl); - inline MuonCalibBranchNtuple* get_ntuple_for_truth(const NtupleStationId &id, const MuonCalibEvent &event); - - template<typename T, typename Tit> - void process_rawdata(Tit begin, Tit end); - inline bool rawdata_selector(const MuonCalibRawMdtHit &hit); - inline bool rawdata_selector(const MuonCalibRawRpcHit &hit); - inline bool rawdata_selector(const MuonCalibRawTgcHit &hit); - - template<typename Tit> - void fill_truth(Tit begin, Tit end, const MuonCalibEvent &event); - inline void fill_truth_hit(const MuonCalibMdtTruthHit &it, MuonCalibBranchNtuple *ntpl); - inline void fill_truth_hit(const MuonCalibRpcTruthHit &it, MuonCalibBranchNtuple *ntpl); - inline void fill_truth_hit(const MuonCalibTgcTruthHit &it, MuonCalibBranchNtuple *ntpl); - inline void fill_truth_hit(const MuonCalibCscTruthHit &it, MuonCalibBranchNtuple *ntpl); - inline void fillTrackNtuple(const MuonCalibEvent_E &extra_event); -}; - -} //namespace MuonCalib - -#endif diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/src/SegmentAnalysis.cxx b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/src/SegmentAnalysis.cxx deleted file mode 100644 index a0d7dbf2d474181bc9b94b3936dc90679133c210..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/src/SegmentAnalysis.cxx +++ /dev/null @@ -1,388 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef MuonCalib_SegmentAnalysisCXX -#define MuonCalib_SegmentAnalysisCXX - -#include "MuonCalibStandAloneExtraTools/SegmentAnalysis.h" -#include "TH1.h" -#include "TMath.h" // for TMath::Prob() -#include <cmath> - -#include "MdtCalibFitters/DCSLFitter.h" -#include "MuonCalibStandAloneExtraTools/PhiEtaUtils.h" -#include "MuonCalibStandAloneExtraTools/StringUtil.h" -#include "MuonCalibStandAloneExtraTools/MDTName.h" - -namespace MuonCalib{ - -SegmentAnalysis::SegmentAnalysis(RegionSelectionSvc *punt, HistogramManager *histoman, bool verbose, bool dohitresids) { - m_histoManager=histoman; - p_reg_sel_svc=punt; - m_verbose=verbose; - m_doHitResids=dohitresids; - - PhiEtaNameConverter phiEtaConverter; - std::string testName="BIL1A01" ; - MDTName NameConverter(testName) ; - m_SectorMin = 20 ; - m_SectorMax = 0 ; - const std::vector<MuonCalib::NtupleStationId> stationsInRegion = p_reg_sel_svc->GetStationsInRegions() ; - std::vector<MuonCalib::NtupleStationId>::const_iterator itstation ; - for (itstation = stationsInRegion.begin() ; itstation!=stationsInRegion.end(); itstation++) { - int stationNameId = itstation->GetStation() ; - int phi = itstation->GetPhi() ; - int sector = phiEtaConverter.phi_8to16(stationNameId,phi); - if(sector>m_SectorMax) m_SectorMax = sector ; - if(sector<m_SectorMin) m_SectorMin = sector ; - } -} //end SegmentAnalysis::SegmentAnalysis - -void SegmentAnalysis::handleEvent(const MuonCalibEvent &event, int /*evnt_nr*/, const std::vector<MuonCalibSegment *> &segments, unsigned int position) { - - float CHI2CUT=50. ; - - //Event number - int evtNumber = event.eventInfo().eventNumber() ; - - ToString ts; - PhiEtaNameConverter phiEtaConverter; - - if( !p_reg_sel_svc){ - return; - } - - std::string histoType="seg"; - TH1F *h1seg = (TH1F*) m_histoManager->GetHisto("GLOBAL",histoType); - float NumOfSeg = (float) segments.size() - position ; - if (h1seg) h1seg->Fill( NumOfSeg ); - - //=========================================================================== - - // ==== SEGMENT LOOP ========================================================= - //Looping over all segments in the event - // - TH1F * hseg; - TH2F * h2; - - for (unsigned int k=position; k<segments.size(); k++) { // LOOP OVER SEGMENTS - MuonCalibSegment *segment(segments[k]); - - unsigned int MinNumOfHitsPerSegment = 4 ; - - if ( segment->mdtHitsOnTrack()==0) { - continue; - } - - if ( segment->mdtHitsOnTrack()<MinNumOfHitsPerSegment) { - continue; - } - - std::vector<MdtCalibHitBase*>::const_iterator hit_it ; - std::vector<MdtCalibHitBase*>::const_iterator hit_it_start = segment->mdtHOTBegin(); - std::vector<MdtCalibHitBase*>::const_iterator hit_it_end = segment->mdtHOTEnd(); - - bool segmentIsInRegion = false ; - for (hit_it=hit_it_start; hit_it != hit_it_end; ++hit_it) { - if (p_reg_sel_svc->isInRegion((*hit_it)->identify())) segmentIsInRegion = true ; - } - if (!segmentIsInRegion) { - continue; - } - - //========= - int crossing = multiChambSeg(segment); - if (crossing) { - continue; - } - - int segStation = segmentStation(segment); - int segEta = segmentEta(segment); - int segPhi = segmentPhi(segment); - - int segPhi2=phiEtaConverter.phi_8to16(segStation,segPhi); - - bool doSector=false; - if(segPhi2>=m_SectorMin && segPhi2<=m_SectorMax) doSector=true; - if(!doSector) continue; - - //== build chamber name - - MuonFixedId id; - std::string segstn = id.stationNumberToFixedStationString(segStation); - MDTName chambseg(segstn,segPhi,segEta); - - std::string chamberName = chambseg.getOnlineName(); - std::string side=chambseg.getSide(); - std::string region=chambseg.getRegion(); - - // Fill HitsOnSegments and Prob(chi2,ndeg) - // - float hitsOnSeg = (float) segment->mdtHitsOnTrack() ; - float SegChi2DoF = segment->chi2() ; // this returns the reduced chi2. - // Hopefully the correct nDoF is considered when t0-refit is active! - float nSegParams = 2. ; - if (segment->hasFittedT0()) nSegParams = 3. ; - float DoF = hitsOnSeg - nSegParams ; - float SegChi2 = SegChi2DoF*DoF ; - - histoType="HitsOnSegment"+segstn; - hseg = (TH1F*) m_histoManager->GetMdtHisto(histoType,region,side,segPhi2); - if(hseg) hseg->Fill(hitsOnSeg); - - histoType="D_ChamberHitsOnSegment"; - hseg = (TH1F*) m_histoManager->GetMdtHisto(histoType,chambseg); - if(hseg) hseg->Fill(hitsOnSeg); - - histoType="c_Segment_ProbChi2"; - hseg = (TH1F*) m_histoManager->GetMdtHisto(histoType,chambseg); - if (hseg) hseg->Fill(TMath::Prob(SegChi2,(int)DoF)); - // - // HIT and FIT Residuals (HIT: hit included in segment ; FIT: hit excluded ) - // - // NIR. REPLACED BY HITRESID vs Radius - ///////////////////// SNIP BEGIN - - float hitsOnSeg2 = 0; - - histoType="b_SegResidVsRadius"; - h2 = (TH2F*) m_histoManager->GetMdtHisto(histoType,chambseg); - histoType="b_SegmentResidual"; - hseg = (TH1F*) m_histoManager->GetMdtHisto(histoType,chambseg); - - MuonCalib::DCSLFitter dcslFitter; - IMdtSegmentFitter::HitSelection ref_hitsel(segment->mdtHitsOnTrack(), 0); // Reference hit selection, containing 0 for all hits in segment - for (std::vector<MdtCalibHitBase*>::iterator hit_it =segment->mdtHOTBegin() ; - hit_it!=segment->mdtHOTEnd(); ++hit_it) { // Loop on all hits on tracks - - hitsOnSeg2++; - - float resid = 0.0; // residual - float radius = 0.0; // hit drift radius - if (m_doHitResids) { // Do hit residuals vs radius - unsigned int iHit = hit_it-segment->mdtHOTBegin(); - IMdtSegmentFitter::HitSelection hitsel = ref_hitsel; - // Ignore hit iHit; - hitsel[iHit] = 1; - // Clone segment: - MuonCalibSegment segmentClone(*segment); - dcslFitter.fit(segmentClone, hitsel); - - //Get the residual of the ignored hit: - resid = segmentClone.mdtHOT()[iHit]->radialResidual(); - radius = segmentClone.mdtHOT()[iHit]->driftRadius(); - - } else { // Do fit residuals vs radius - resid = (*hit_it)->radialResidual(); - radius = (*hit_it)->driftRadius(); - } - if (radius<0) radius = -radius ; // First take the absolute value of radius - if ((*hit_it)->signedDistanceToTrack()<0.) radius=-radius ; // Then assign the sign of signedDistanceToTrack - - if (h2) h2->Fill(radius,resid); - if (hseg) hseg->Fill(resid); - - } // End loop over hits - ///////////////////// SNIP END - - - //==================================================================================== - //==================================================================================== - // GLOBAL segment_Phi Vs segment_Eta plot - // - float gdirX = segment->globalDirection().x(); - float gdirY = segment->globalDirection().y(); - float gdirZ = segment->globalDirection().z(); - float globalPhi = std::atan2(gdirY,gdirX)* 180./M_PI; ; - float globalTheta = std::acos(gdirZ) ; - float globalEta = -std::log(std::tan(globalTheta/2.)) ; - histoType="phi_vs_eta"; - - h2 = (TH2F*) m_histoManager->GetHisto("GLOBAL",histoType); - if(h2) h2->Fill( globalEta, globalPhi ); - - //==================================================================================== - //==================================================================================== - // slope corr - Still here but no Histograms Filled anymore !!! - // - - //==================================================================================== - //==================================================================================== - // MDT-RPC Correlations FOR THE BARREL - // - if ( region=="Barrel") { - TH1F *hrpc; - TH2F *h2rpc; - std::vector<RpcCalibHitBase*>::const_iterator rpc_hit_it = segment->rpcHOTBegin(); - std::vector<RpcCalibHitBase*>::const_iterator rpc_hit_it_end = segment->rpcHOTEnd(); - for(; rpc_hit_it != rpc_hit_it_end; ++rpc_hit_it){ - //local - double y = (*rpc_hit_it)->localPosition().y(); - double z = (*rpc_hit_it)->localPosition().z(); - MuonFixedId ID = (*rpc_hit_it)->identify(); - std::string cname = ID.stationNumberToFixedStationString( ID.stationName() ) ; - if(segment->chi2() > CHI2CUT ) continue; - int eta=ID.eta(); - int phi2=phiEtaConverter.phi_8to16(segStation,segPhi); - std::string side="A"; - if(eta<0) side="C"; - std::string phisec=ts(phi2); - if(phi2<10) phisec="0"+phisec; - - bool doSector=false; - if(phi2>=m_SectorMin && phi2<=m_SectorMax) doSector=true; - if(!doSector) continue; - //local - double dirY=segment->direction().y(); - double dirZ=segment->direction().z(); - double posY=segment->position().y(); - double posZ=segment->position().z(); - double aseg=0.; - double bseg=0.; - if(dirZ !=0. ) { - aseg=dirY/dirZ; - bseg= posY - aseg*posZ; - } - double dist=(-1*aseg*z+y-bseg)/std::sqrt(aseg*aseg+1); - - - histoType="MDT_RPC"; - hrpc = (TH1F*) m_histoManager->GetTDaqHisto(histoType,region,side,phi2); - if(hrpc)hrpc->Fill(dist); - - histoType="z_MDT_RPC"; - hrpc = (TH1F*) m_histoManager->GetMdtHisto(histoType,region,side,phi2); - if(hrpc)hrpc->Fill(dist); - - histoType="MDT_RPC_Vs_Event"; - h2rpc = (TH2F*) m_histoManager->GetTDaqHisto(histoType,region,side,phi2); - if(h2rpc) h2rpc->Fill((float)evtNumber,dist); - - } // end RPC hit loop - } // end if region == Barrel - - //==================================================================================== - //==================================================================================== - // MDT-TGC Correlations FOR THE ENDCAP - // added by D. Levin,march 18, 2009 - if ( region=="Endcap") { - - TH1F *htgc; - TH2F *h2tgc; - - std::vector<TgcCalibHitBase*>::const_iterator tgc_hit_it = segment->tgcHOTBegin(); - std::vector<TgcCalibHitBase*>::const_iterator tgc_hit_it_end = segment->tgcHOTEnd(); - - for(; tgc_hit_it != tgc_hit_it_end; ++tgc_hit_it){ - - //local - double y = (*tgc_hit_it)->localPosition().y(); - double z = (*tgc_hit_it)->localPosition().z(); - - MuonFixedId ID = (*tgc_hit_it)->identify(); - std::string cname = ID.stationNumberToFixedStationString( ID.stationName() ) ; - - if(segment->chi2() > CHI2CUT ) continue; - - int eta=ID.eta(); - int phi2=phiEtaConverter.phi_8to16(segStation,segPhi); - std::string side="A"; - if(eta<0) side="C"; - std::string phisec=ts(phi2); - if(phi2<10) phisec="0"+phisec; - - bool doSector=false; - if(phi2>=m_SectorMin && phi2<=m_SectorMax) doSector=true; - if(!doSector) continue; - - //local - double dirY=segment->direction().y(); - double dirZ=segment->direction().z(); - double posY=segment->position().y(); - double posZ=segment->position().z(); - - double aseg=0.; - double bseg=0.; - if(dirZ !=0. ) { - aseg=dirY/dirZ; - bseg= posY - aseg*posZ; - } - double dist=(-1*aseg*z+y-bseg)/std::sqrt(aseg*aseg+1); - - - histoType="MDT_TGC"; - htgc = (TH1F*) m_histoManager->GetTDaqHisto(histoType,region,side,phi2); - if(htgc)htgc->Fill(dist); - - histoType="z_MDT_TGC"; - htgc = (TH1F*) m_histoManager->GetMdtHisto(histoType,region,side,phi2); - if(htgc)htgc->Fill(dist); - - histoType="MDT_TGC_Vs_Event"; - h2tgc = (TH2F*) m_histoManager->GetTDaqHisto(histoType,region,side,phi2); - if(h2tgc) h2tgc->Fill((float)evtNumber,dist); - - } // end TGC hit loop - } // end if region == Endcpa - - }//End LOOP over Segments - - return; -} //end SegmentAnalysis::handleEvent - -int SegmentAnalysis::multiChambSeg( MuonCalibSegment *segment ){ - - int flag = false; - - if(segment->mdtHitsOnTrack()<=0) return flag; - - std::vector<MdtCalibHitBase*>::const_iterator hit_it = segment->mdtHOTBegin(); - std::vector<MdtCalibHitBase*>::const_iterator hit_it_end = segment->mdtHOTEnd(); - - MuonFixedId ID1; - ID1 = (*hit_it)->identify() ; - - MuonFixedId ID; - - //Loop over all hits in the segment - for(; hit_it != hit_it_end; ++hit_it) { - - ID = (*hit_it)->identify(); - - if(ID.eta()!=ID1.eta()) flag= true; - if(ID.stationName()!=ID1.stationName()) flag= true; - if(ID.phi()!=ID1.phi()) flag= true; - - if(flag) { - return flag; - } - - }//loop - - return flag; -} //end SegmentAnalysis::multiChambSeg - -int SegmentAnalysis::segmentStation( MuonCalibSegment *segment ){ - std::vector<MdtCalibHitBase*>::const_iterator hit_it = segment->mdtHOTBegin(); - MuonFixedId ID; - ID = (*hit_it)->identify() ; - return ID.stationName(); -} - -int SegmentAnalysis::segmentEta( MuonCalibSegment *segment ){ - std::vector<MdtCalibHitBase*>::const_iterator hit_it = segment->mdtHOTBegin(); - MuonFixedId ID; - ID = (*hit_it)->identify() ; - return ID.eta(); -} - -int SegmentAnalysis::segmentPhi( MuonCalibSegment *segment ){ - std::vector<MdtCalibHitBase*>::const_iterator hit_it = segment->mdtHOTBegin(); - MuonFixedId ID; - ID = (*hit_it)->identify() ; - return ID.phi(); -} - -}//namespace MuonCalib -#endif diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/src/TimeAndAdcFitter.cxx b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/src/TimeAndAdcFitter.cxx deleted file mode 100644 index 2825ce47ffba6f59fe2160966336ff71b4f0c235..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/src/TimeAndAdcFitter.cxx +++ /dev/null @@ -1,172 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -#include "MuonCalibStandAloneExtraTools/TimeAndAdcFitter.h" -#include "TF1.h" - -void TimeAndAdcFitter::doTimeFit(TH1F *h, const int nParams, double *pfit, double *errfit, double *pchi2, int *pndof ) { - - double minTime = 0.; - double maxTime = 2000.; - - double chi2; - int ndof; - - TF1 *TimeSpectrum = new TF1("TimeSpectrum", - "[0]+([1]*(1+[2]*exp(-(x-[4])/[3])))/((1+exp((-x+[4])/[6]))*(1+exp((x-[5])/[7]))) ", - minTime,maxTime); - TimeSpectrum->SetLineColor(3); - - searchParams(h,&pfit[0],nParams); - - TimeSpectrum->SetParameters(pfit); - TimeSpectrum->SetParLimits(0,0.,100.); - TimeSpectrum->SetParLimits(1,0.,10000.); - TimeSpectrum->SetParLimits(2,0.,40.); - TimeSpectrum->SetParLimits(3,50.,400.); - TimeSpectrum->SetParLimits(4,0.,1500.); - // 5 parameters fit - TimeSpectrum->SetParLimits(5,pfit[5],pfit[5]); - TimeSpectrum->SetParLimits(6,pfit[6],pfit[6]); - TimeSpectrum->SetParLimits(7,pfit[7],pfit[7]); - h->Fit("TimeSpectrum","QLB"); - // 6 parameters fit - TimeSpectrum->SetParLimits(5,500.,2000.); - TimeSpectrum->SetParLimits(6,pfit[6],pfit[6]); - TimeSpectrum->SetParLimits(7,pfit[7],pfit[7]); - h->Fit("TimeSpectrum","QLB"); - // 7 parameters fit - TimeSpectrum->SetParLimits(6,4.,30.); - h->Fit("TimeSpectrum","QLB"); - // final 8 parameters fit - TimeSpectrum->SetParLimits(6,4.,30.); - TimeSpectrum->SetParLimits(7,4.,30.); - double xmin = h->GetBinLowEdge(1); - double xmax = TimeSpectrum->GetParameter(5)+250.; - h->Fit("TimeSpectrum","QLB","",xmin,xmax); - - for (int i=0; i<nParams; i++){ - pfit[i] = TimeSpectrum->GetParameter(i); - errfit[i] = TimeSpectrum->GetParError(i); - } - chi2 = TimeSpectrum->GetChisquare(); // total chi2 - ndof = TimeSpectrum->GetNDF(); // number of degrees of freedom - - *pchi2 = chi2; - *pndof = ndof; - return; -} //end TimeAndAdcFitter::doTimeFit - -void TimeAndAdcFitter::doAdcFit(TH1F *h, const int /*nAdcParams*/, double *Adcpfit, double *errAdcpfit, double* /*chi2Adc*/, int* /*ndofAdc*/ ) { - - double adcThreshold = 50.; - double minAdc = 80.; - double maxAdc = 300.; - - double m=h->GetMean(); - double r=h->GetRMS(); - double maxval=h->GetMaximum(); - double adcpar[4]; - adcpar[0] = maxval*2.; - adcpar[1] = m; - adcpar[2] = r; - adcpar[3] = r/3.; - - TF1 *AdcSpectrum = new TF1("AdcSpectrum"," ([0]*exp((x-[1])/[2]))/ (1.+exp((x-[1])/[3])) ", minAdc,maxAdc ); - AdcSpectrum->SetLineColor(3); - AdcSpectrum->SetParameters(adcpar); - double fitMin = m-(3*r); - double fitMax = m+(3*r); - if (fitMin<adcThreshold) fitMin = adcThreshold; - if (fitMax>maxAdc ) fitMax = maxAdc; - h->Fit("AdcSpectrum","Q"," ",fitMin,fitMax); - for (int i=0; i<4; i++) { - Adcpfit[i] = AdcSpectrum->GetParameter(i); - errAdcpfit[i] = AdcSpectrum->GetParError(i); - } - // THE NEW HISTOGRAM HAS BEEN FIT - - return; -} //end TimeAndAdcFitter::doAdcFit - -void TimeAndAdcFitter::searchParams(TH1 *h, double *p, int /*nParams*/) { - double sizeX = h->GetBinWidth(1); - double oldSizeX=sizeX; - int RebinFactor = (int) (10./sizeX); - // extract starting values for fit params p[nParams] from the Time Spectrum h - TH1 *hnew = h->Rebin(RebinFactor,"hnew"); // creates a new histogram hnew - //merging 5 bins of h1 in one bin - float minDeriv(9999.); - int minDerivBin(0); - sizeX = hnew->GetBinWidth(1); - int newbins = hnew->GetNbinsX(); - for(int i=0; i<newbins-1; ++i) { - if(hnew->GetBinContent(i)-hnew->GetBinContent(i+1) - <minDeriv) { - minDeriv = hnew->GetBinContent(i)-hnew->GetBinContent(i+1); - minDerivBin = i; - } - } - float t0guess = hnew->GetBinCenter(minDerivBin); - if (minDerivBin<newbins-1) { - t0guess += (hnew->GetBinCenter(minDerivBin+1)-hnew->GetBinCenter(minDerivBin))/2.; - } - // - // =================== Noise level search =================================== - // - float noise(0); - int numOfBins(10), numOfBinsOffset(3); - int imin, imax; - if (minDerivBin>numOfBins+numOfBinsOffset) { - imin = minDerivBin-numOfBins-numOfBinsOffset; - imax = minDerivBin-numOfBinsOffset; - } else { - imin = 0; - if (minDerivBin>numOfBinsOffset) { - imax = minDerivBin-numOfBinsOffset; - } else { - imax = minDerivBin; - } - } - int icount(0); - for (int i=imin; i<=imax; ++i) { - noise += hnew->GetBinContent(i); - icount++; - } - - noise = noise/(float)(icount); - // - // =================== Normalization ========================================= - // - int t0bin = minDerivBin; - int ix1 = t0bin+(int)(50/sizeX); - int ix2 = t0bin+(int)(500/sizeX); - float P1=p[1]; - float P2=p[2]; - float P3=p[3]; - p[0]=noise; - p[4]=t0guess; - p[5]=p[4]+700; - p[1]=20.; - p[2]=10.; - if (0<ix1 && ix1<newbins && 0<ix2 && ix2<newbins ) { - float a1=hnew->GetBinCenter(ix1); - float a2=hnew->GetBinCenter(ix2); - float cont1=hnew->GetBinContent(ix1); - float cont2=hnew->GetBinContent(ix2); - if (cont1>0. && cont2>0. ){ - float A1=std::exp(-(a1-t0guess)/P3); - float A2=std::exp(-(a2-t0guess)/P3); - // do not forget rebinning! - P2 = (cont1/cont2-1.)/(A1-cont1/cont2*A2); - P1 = cont1/(1+P2*A1); - P1=P1*oldSizeX/sizeX; - P2=P2*oldSizeX/sizeX; - p[1]=P1; - p[2]=P2; - } - } - delete hnew; - return; -} //end TimeAndAdcFitter::searchParams diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/src/TrackSecondCoordinateToSegment.cxx b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/src/TrackSecondCoordinateToSegment.cxx deleted file mode 100644 index c256164f0af0803fb5bba3e58adf84379e79affe..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/src/TrackSecondCoordinateToSegment.cxx +++ /dev/null @@ -1,128 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -//this -#include "MuonCalibStandAloneExtraTools/TrackSecondCoordinateToSegment.h" - -//MuonCalibExtraTreeEvent -#include "MuonCalibExtraTreeEvent/MuonCalibExtendedSegment.h" -#include "MuonCalibExtraTreeEvent/MuonCalibExtendedTrack.h" - -//root -#include "TFile.h" -#include "TH1.h" - -namespace MuonCalib { - -TrackSecondCoordinateToSegment::TrackSecondCoordinateToSegment(const std::string &t, const std::string &n, const IInterface *p): - AthAlgTool(t, n, p), m_root_file(NULL), m_delta_x(NULL), m_delta_sx(NULL), m_delta_hit_x(NULL) { - m_control_histos = true; - declareProperty("ControlHistograms", m_control_histos); - declareInterface< CalibSegmentPreparationTool >(this); -} - -//////////////// -// initialize // -//////////////// -StatusCode TrackSecondCoordinateToSegment::initialize(void) { - if(m_control_histos) { - m_root_file = new TFile("TrackSecondCoordinateToSegment.root", "RECREATE"); - m_delta_x = new TH1F("delta_x", "", 4000, -8000, 8000); - m_delta_sx = new TH1F("delta_sx", "", 100, -10, 10); - m_delta_hit_x= new TH1F("delta_hit_x", "", 4000, -8000, 8000); - } - return StatusCode::SUCCESS; -} - -StatusCode TrackSecondCoordinateToSegment::finalize(void) { - if(m_root_file != NULL) { - m_root_file->Write(); - } - return StatusCode::SUCCESS; -} - -void TrackSecondCoordinateToSegment::prepareSegments(const MuonCalibEvent *&event, std::map<NtupleStationId, MuonCalibSegment *> &segments) { - ATH_MSG_INFO("START TrackSecondCoordinateToSegment::prepareSegments"); - //loop over segments - for(std::map<NtupleStationId, MuonCalibSegment *>::iterator it=segments.begin(); it!= segments.end(); it++) { - MuonCalibExtendedSegment *e_segment(dynamic_cast<MuonCalibExtendedSegment *>(it->second)); - if(e_segment==NULL) { - ATH_MSG_FATAL("This tool only works with MuonCalibExtendedSegment!"); - event = NULL; - return; - } - //select best track - const MuonCalibExtendedTrack *track(NULL); - for(std::vector<const MuonCalibExtendedTrack*>::const_iterator t_it=e_segment->associatedTracks().begin(); t_it != e_segment->associatedTracks().end(); t_it++) { - if(track==NULL) { - track = *t_it; - continue; - } - if(track->nrHits() < (*t_it)->nrHits()) { - track = *t_it; - continue; - } - if(track->nrHits() > (*t_it)->nrHits()) { - continue; - } - double prev_chi2 = track->chi2()/static_cast<double>(track->ndof()); - double cur_chi2 = (*t_it)->chi2()/static_cast<double>((*t_it)->ndof()); - if(cur_chi2 < prev_chi2) { - track = *t_it; - } - } - if(track==NULL) { - ATH_MSG_WARNING("No track assigned to segment!"); - continue; - } - - apply_2n_coordinate(track, e_segment); - } -} //end TrackSecondCoordinateToSegment::prepareSegments - -inline void TrackSecondCoordinateToSegment::apply_2n_coordinate(const MuonCalibExtendedTrack *track, MuonCalibSegment *segment) const { - //get transformations - Amg::Transform3D global_to_local((segment->localToGlobal()).inverse()); - Amg::Transform3D local_to_global((segment->localToGlobal())); - //transform track position and direction to local coordinates - const Amg::Vector3D trk_pos(global_to_local *track->position()); - const Amg::Vector3D trk_dir(global_to_local *track->direction()); - //get local track parameters - const Amg::Vector3D &seg_pos(segment->position()); - const Amg::Vector3D &seg_dir(segment->direction()); - //fit 2nd coordinate in to existing parameters - double new_x = trk_pos.x() + ((seg_pos.z() - trk_pos.z())/trk_dir.z()) * trk_dir.x(); - double new_dx = (trk_dir.x()/trk_dir.z()) * seg_dir.z(); - //update track position and direction - Amg::Vector3D new_pos(new_x, seg_pos.y(), seg_pos.z()); - Amg::Vector3D new_dir(new_dx, seg_dir.y(), seg_dir.z()); - if(m_root_file != NULL) { - m_delta_x->Fill(new_pos.x() - seg_pos.x()); - m_delta_sx->Fill(new_dir.x()/seg_dir.z() - seg_dir.x()/seg_dir.z()); - } - segment->SetSegment(new_pos, new_dir); - //update mdt hit positions - for(MuonCalibSegment::MdtHitVec::iterator h_it = segment->mdtHOTBegin(); h_it != segment->mdtHOTEnd(); h_it++) { - MdtCalibHitBase &hit(*(*h_it)); - Amg::Vector3D local_position(hit.localPosition()); - updatePosition(local_position, new_pos, new_dir); - if(m_delta_hit_x) { - m_delta_hit_x->Fill(local_position.x() - hit.localPosition().x()); - } - hit.setLocalPos(local_position); - hit.setGlobalPos(local_to_global *local_position); - Amg::Vector3D point_of_closest_ap( hit.localPointOfClosestApproach() ); - updatePosition(point_of_closest_ap, new_pos, new_dir); - hit.setLocalPointOfClosestApproach(point_of_closest_ap); - hit.setGlobalPointOfClosestApproach( local_to_global*point_of_closest_ap); - } -} //end TrackSecondCoordinateToSegment::apply_2n_coordinate - -inline void TrackSecondCoordinateToSegment::updatePosition(Amg::Vector3D &position, const Amg::Vector3D &seg_pos, const Amg::Vector3D &seg_dir) const { - double new_x = seg_pos.x() + ((position.z() - seg_pos.z())/seg_dir.z()) * seg_dir.x(); - //position.setX(new_x); - position=Amg::Vector3D(new_x, position.y(), position.z()); -} - -} //namespace MuonCalib diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/src/components/MuonCalibStandAloneExtraTools_entries.cxx b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/src/components/MuonCalibStandAloneExtraTools_entries.cxx deleted file mode 100644 index 2a4cb2212d0768496787afd0701a73db83fd6a85..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/src/components/MuonCalibStandAloneExtraTools_entries.cxx +++ /dev/null @@ -1,18 +0,0 @@ -#include "MuonCalibStandAloneExtraTools/CalibExtraNtupleLoader.h" -#include "MuonCalibStandAloneExtraTools/ExtraRegionSelector.h" -#include "MuonCalibStandAloneExtraTools/ExtraRegionSelectorSuperFast.h" -#include "MuonCalibStandAloneExtraTools/ExtraRegionSelectorFast.h" -#include "MuonCalibStandAloneExtraTools/TrackSecondCoordinateToSegment.h" -#include "MuonCalibStandAloneExtraTools/NtupleMdtDqaTool.h" -#include "../NtupleSplitterTool.h" - -using namespace MuonCalib; - -DECLARE_COMPONENT( CalibExtraNtupleLoader ) -DECLARE_COMPONENT( ExtraRegionSelector ) -DECLARE_COMPONENT( ExtraRegionSelectorFast ) -DECLARE_COMPONENT( ExtraRegionSelectorSuperFast ) -DECLARE_COMPONENT( TrackSecondCoordinateToSegment ) -DECLARE_COMPONENT( NtupleMdtDqaTool ) -DECLARE_COMPONENT( NtupleSplitterTool ) - diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/CMakeLists.txt b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/CMakeLists.txt deleted file mode 100644 index 6e001bddcf50c2eab09908cb610f8a3c225908a8..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/CMakeLists.txt +++ /dev/null @@ -1,50 +0,0 @@ -################################################################################ -# Package: MuonCalibStandAloneTools -################################################################################ - -# Declare the package name: -atlas_subdir( MuonCalibStandAloneTools ) - -# Declare the package's dependencies: -atlas_depends_on_subdirs( PUBLIC - Control/AthenaBaseComps - MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibFitters - MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibInterfaces - MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibT0 - MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibUtils - MuonSpectrometer/MuonCalib/MuonCalibEventBase - MuonSpectrometer/MuonCalib/MuonCalibITools - MuonSpectrometer/MuonCalib/MuonCalibIdentifier - MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MdtCalibIOSvc - MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneBase - MuonSpectrometer/MuonIdHelpers - PRIVATE - DetectorDescription/Identifier - GaudiKernel - MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibData - MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibRt - MuonSpectrometer/MuonCalib/MuonCalibUtils/MuonCalibStl - MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry ) - -# External dependencies: -find_package( CLHEP ) -find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread MathMore Minuit Minuit2 Matrix Physics HistPainter Rint Graf Graf3d Gpad Html Postscript Gui GX11TTF GX11 ) - -# Component(s) in the package: -atlas_add_library( MuonCalibStandAloneToolsLib - src/*.cxx - PUBLIC_HEADERS MuonCalibStandAloneTools - INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} - DEFINITIONS ${CLHEP_DEFINITIONS} - LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} AthenaBaseComps MdtCalibFitters MdtCalibT0 MdtCalibUtils MuonCalibEventBase MuonCalibITools MuonCalibIdentifier MdtCalibIOSvcLib MuonCalibStandAloneBaseLib MuonIdHelpersLib - PRIVATE_LINK_LIBRARIES Identifier GaudiKernel MdtCalibData MdtCalibRt MuonReadoutGeometry ) - -atlas_add_component( MuonCalibStandAloneTools - src/components/*.cxx - INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} AthenaBaseComps MdtCalibFitters MdtCalibT0 MdtCalibUtils MuonCalibEventBase MuonCalibITools MuonCalibIdentifier MdtCalibIOSvcLib MuonCalibStandAloneBaseLib MuonIdHelpersLib Identifier GaudiKernel MdtCalibData MdtCalibRt MuonReadoutGeometry MuonCalibStandAloneToolsLib ) - -# Install files from the package: -atlas_install_python_modules( python/*.py ) -atlas_install_joboptions( share/*.py ) - diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/MuonCalibStandAloneTools/HitCounter.h b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/MuonCalibStandAloneTools/HitCounter.h deleted file mode 100644 index f0794889758d66c752f040af24bc578684b4d1a4..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/MuonCalibStandAloneTools/HitCounter.h +++ /dev/null @@ -1,159 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef HitCounter_H -#define HitCounter_H - -//c - c++ -#include "map" -#include "string" - -//root -class TH1F; -class TDirectory; -#include "MuonCalibStandAloneBase/NtupleStationId.h" - -namespace MuonCalib { - - -class MuonCalibSegment; - - -/** @class HitCounter -Counts hits per tube, mezzanine, multilayer and layer, and decides how the chambers are to be fitted -@author rauscher@cern.ch -*/ - - -class HitCounter - { - public: - /** id classes*/ - class TubeId - { - public: - inline TubeId():ml(0),ly(0),tb(0) {} - int ml, ly, tb; - inline bool operator < (const TubeId &other) const - { - if(ml != other.ml) return (ml < other.ml); - if(ly != other.ly) return (ly < other.ly); - return (tb < other.tb); - } - }; - class MezzId - { - public: - inline MezzId():ml(0),mezz(0) {} - int ml, mezz; - inline bool operator < (const MezzId & other) const - { - if(ml != other.ml) return (ml < other.ml); - return mezz < other.mezz; - } - }; - class DQInfo - { - public: - inline DQInfo(): m_severity(0), m_noisy(false), m_dead(false) - {} - inline void SetNoisy() - { - if(m_severity<2) - m_severity=2; - m_noisy=true; - } - inline void SetDead() - { - if(m_severity<1) - m_severity=1; - m_dead=true; - } - inline const int & GetSeverity() const - { - return m_severity; - } - inline const bool & GetNoisy() const - { - return m_noisy; - } - inline const bool & GetDead() const - { - return m_dead; - } - private: - int m_severity; - bool m_noisy; - bool m_dead; - }; -//============================================================================== - /** default constructor */ - inline HitCounter() : m_is_initialized(false), m_per_chamber(0), m_n_dead_tubes(0), - m_n_dead_mezz(0), m_n_dead_ml(0), m_fit_by_int(0), m_hits_per_segments(NULL), - m_wd(NULL) - { - } - /** initialize class */ - bool Initialize(const NtupleStationId &id); - /** process segment */ - void ProcessSegment(const MuonCalibSegment & segment); - /** decide on how to fit */ - const std::string & FittingBy(int min_hits, double bad_fit_rate); - /** return true if class is initialized */ - inline bool IsInitialized() - { - return m_is_initialized; - } - inline int FitByInt() const - { - return m_fit_by_int; - } - inline int NHits() const - { - return m_per_chamber; - } - /** return number of dead tubes - mezzanines - multilayers */ - inline int NDeadTubes() const - { - return m_n_dead_tubes; - } - inline int NDeadMezzanines() const - { - return m_n_dead_mezz; - } - inline int NDeadMultilayers() const - { - return m_n_dead_ml; - } - std::map<HitCounter::TubeId, HitCounter::DQInfo> InitialDQ(int noisy_tube_factor) const; - private: -//============================================================================== - //! is true if class is initialized - bool m_is_initialized; - //! name string - std::string m_name; - //! hit counter - std::map<TubeId, int> m_per_tube; - std::map<MezzId, int> m_per_mezz; - std::map<int, int> m_per_ml; - int m_per_chamber; - //! number of dead tubes - dead mezzanines - dead tubs - int m_n_dead_tubes; - int m_n_dead_mezz; - int m_n_dead_ml; - //! number of tubes per layer and mezzanine - std::map<int,int> m_mezz_width; - //! fitt by - std::string m_fit_by; - int m_fit_by_int; - //!root histograms - TH1F *m_hits_per_segments; - TDirectory *m_wd; - //! station id to which this counter applies - NtupleStationId m_id; - }; - -} - -#endif diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/MuonCalibStandAloneTools/NtupleAnalyticAutocalibrationTool.h b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/MuonCalibStandAloneTools/NtupleAnalyticAutocalibrationTool.h deleted file mode 100644 index 5d4c3404ea704a1b4daeb8ebb5bf8407ac88972a..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/MuonCalibStandAloneTools/NtupleAnalyticAutocalibrationTool.h +++ /dev/null @@ -1,81 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef NtupleAnalyticAutocalibrationTool_H -#define NtupleAnalyticAutocalibrationTool_H - -//this -#include "MuonCalibStandAloneBase/NtupleCalibrationTool.h" -#include "AthenaBaseComps/AthAlgTool.h" -#include "GaudiKernel/ServiceHandle.h" -class MdtCalibInputSvc; - -namespace MuonCalib { - -class RtCalibrationAnalytic; - -/** @class NtupleAnalyticAutocalibrationTool - Interface tool for the Integration Method for finding an initial r-t - relation. - @author rauscher@cern.ch -*/ - - -class NtupleAnalyticAutocalibrationTool : public AthAlgTool, virtual public NtupleCalibrationTool - { - public: -//============================================================================== - /** Tool Constructor */ - NtupleAnalyticAutocalibrationTool(const std::string& t, const std::string& n, const IInterface* p); - /** Tool initialization */ - StatusCode initialize(); - - /** analyze segments */ - StatusCode analyseSegments(const std::vector<MuonCalibSegment *> & segemnts); - /** set calibratino region */ - void setRegion(); - /** get calibration results */ - const IMdtCalibrationOutput * getResults() const; -//============================================================================== - private: - //! pointer to algoritm - RtCalibrationAnalytic *m_autocalibration; - //! estimateted initial rt acuracy - job option - double m_rt_accuracy; - //! the type of the correction function (LEGENDRE|CHEBYSHEV|POLYGON - job option - std::string m_func_type; - //! the function type as a numeric value - //! = 1: Legendre polynomial, - //! = 2: Chebyshev polynomial - //! = 3: polygon equidistant in r - int m_func_type_num; - //! order of the correctio nfunctino - int m_order; - //! restrict segments to mutilayers - job option - bool m_split; - //! lets the algorithm use the full matrix - job option - bool m_full_matrix; - //! fix_min, fix_max=true: fix r(t_min), r(t_max) - job option - bool m_fix_min, m_fix_max; - //! maximum number of iterations. - job otion - int m_max_it; - //! force monotonuous rt relation - job option - bool m_force_mono; - //! control histogram output - job option - bool m_control_histograms; - //! calibratin input service - ServiceHandle<MdtCalibInputSvc> m_calib_input_svc; - //! is set to true if the analysis failed - bool m_failed; - //! is set to true if r(t) should be smoothened using the conventional - //! autocalibration - bool m_smoothening; - //! is set to true if parabolic extrapolation should be performed for small - //! and large radii - bool m_parabolic_extrapolation; - }; - -#endif - -} diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/MuonCalibStandAloneTools/NtupleCalibADCTool.h b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/MuonCalibStandAloneTools/NtupleCalibADCTool.h deleted file mode 100644 index a3807fbb385e6412fb3816eac536a8aefb0a49f6..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/MuonCalibStandAloneTools/NtupleCalibADCTool.h +++ /dev/null @@ -1,207 +0,0 @@ -/* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration -*/ - -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -// 20.06.2007, AUTHOR: Zhen YAN -// Used for ADC data studies and product the ADC parameters for time slewing -// 2009.01.14 new Tool NtupleCalibADCTool -// 2009.01.21 Empty frame is working in Athena frame -// 2009.01.22 Add ADC plot for ADC data studies -// 2009.02.26 Add new array histogram for radius range analysis -// 2009.03.06 Add new array histogram for studing the ADC varation with differnet segment AngleXZ -// 2009.06.22 Test the current version in new package, working on the producting of timeslewing coefficient -// 2009.07.02 v320 input_svc ->T0 and RT , slewing factor from r_MDT_residual_vs_ADC[15] -// 2009.07.15 v330 TS_factor[15] change range. Range 0 to 0.5, 0.5~1.5£¬13.5~15 -// 2009.07.23 v400 introduce the TS_cor and reset the driftRadius before the refit. new plot Residual_vs_Radius[3] -// 2009.08.27 v440 new plot radius_vs_distanceTowire ->> check the bugs on the NTUP filling -// 2009.08.31 v500 running version except r_MDT_residual_vs_ADC[15] -// 2009.09.02 v510 new ADC correction array, compile ok -// -// Todo list 1) Try to use GTFitter for the segment refit -// 2) Introduce TrRelation() class in CalibData -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - -#ifndef MuonCalib_NtupleCalibADCToolH -#define MuonCalib_NtupleCalibADCToolH - -//::::::::::::::::::::::::::::::::::::::: -//:: CLASS NtupleCalibADCTool :: -//::::::::::::::::::::::::::::::::::::::: - -/// \class NtupleCalibADCTool - -//:::::::::::::::::: -//:: HEADER FILES :: -//:::::::::::::::::: - -// STL // -#include <string> -#include <map> - -// ROOT // -#include "TFile.h" -#include "TH1.h" -#include "TH2.h" -class TF1; -class TTree; -class TProfile; - -#include "AthenaBaseComps/AthAlgTool.h" -#include "GaudiKernel/ServiceHandle.h" - -// MuonCalib // -#include "MuonCalibEventBase/MuonCalibEvent.h" -#include "MdtCalibFitters/QuasianalyticLineReconstruction.h" -#include "MuonCalibStandAloneBase/NtupleCalibrationTool.h" -#include "MuonCalibStandAloneBase/NtupleStationId.h" -#include "MuonCalibITools/IIdToFixedIdTool.h" -#include "MdtCalibFitters/CurvedPatRec.h" -#include "MuonCalibStandAloneBase/T0Refinement.h" -#include "MdtCalibUtils/GlobalTimeFitter.h" -#include "MdtCalibFitters/DCSLFitter.h" -#include "MdtCalibIOSvc/MdtCalibInputSvc.h" -#include "MuonReadoutGeometry/MuonDetectorManager.h" - -class RegionSelectionSvc; - -namespace MuonCalib { - -class T0MTHistos; - -class NtupleCalibADCTool : public AthAlgTool, - virtual public NtupleCalibrationTool { - -public: -// Constructors // - NtupleCalibADCTool(const std::string & t, - const std::string & n, const IInterface * p); - ///< Constructor of the tool. - - ~NtupleCalibADCTool(void); - ///< Destructor of the tool. - -// Methods // -// methods required by the base classes // - StatusCode initialize(void); - ///< initialization of the tool - StatusCode finalize(void); - ///< finilization of the tool - StatusCode handleEvent(const MuonCalibEvent & event, int evnt_nb, - const std::vector<MuonCalibSegment *> & segments, - unsigned int position); - ///< analysis of the event, - ///< raw data and segment histograms - ///< are filled - bool KeepSegments(void) const; - ///< returns true, if segments should - ///< be stored in memory, false - ///< otherwise - -private: -// job options // - bool m_refit_segments; // = true, if the segments should be refitted, - // = false, if the segments are not refitted - bool m_Recalc2ndCoordinate; // use for certifate ADC_vs_distX and ADC_vs_DirXYZ - bool m_curved_fits; // = true, if curved segment fits should be performed, - // = false, if straight segment fits should be performed - double m_time_out; // time out for pattern finding - double m_road_width; // road width for pattern recognition - std::string m_MDT_ID_helper; // name of the MDT ID helper - std::string m_RPC_ID_helper; // name of the RPC ID helper - std::string m_idToFixedIdToolType; // type of the muon fixed id tool - std::string m_idToFixedIdToolName; // name of the muon fixed id tool - std::string m_ROOT_file_name; // name of the output ROOT file - //std::string m_group_by; // name of the output ROOT file -// double RA_table[30]; - -// ROOT file // - TFile *m_tfile; // pointer to the ROOT file in which the data have to - // be stored - -// calibration region // - ServiceHandle<RegionSelectionSvc> m_reg_sel_svc; -// calibration parameters // - ServiceHandle<MdtCalibInputSvc> m_input_service; // pointer to the calibration input - // service -// chamber parameters // - std::map<NtupleStationId, unsigned int> m_nb_ml; // number of - // multilayers - std::map<NtupleStationId, unsigned int> m_nb_ly; // number of layers per - // multilayer - std::map<NtupleStationId, unsigned int> m_nb_tb; // number of tubes per - // layer - - -// event data // - // number of raw MDT hits in - // the chambers - unsigned int m_nb_events; - // number of events - // strips [rDoublet][zDoublett] -// straight-line fitter // - QuasianalyticLineReconstruction *m_qfitter; - -// curved-line fitter // - CurvedPatRec *m_cfitter; - -// t0 refinement // - T0Refinement *m_t0_refinement; - -// histograms // - // segment histograms // -// ########## Group 1, the histograms for generating ADC correction factor ############### - - std::map<NtupleStationId, TH2F *> m_MDT_adc_vs_radius; - std::map<NtupleStationId, TH2F *> m_MDT_adc_vs_pathD; - std::map<NtupleStationId, TH2F *> m_MDT_adc_vs_residual; - std::map<NtupleStationId, TH2F *> m_MDT_adc_vs_posX; - std::map<NtupleStationId, TH2F *> m_MDT_adc_vs_DistanceToSegmentTrack; - std::map<NtupleStationId, TH2F *> m_MDT_radius_vs_t; - std::map<NtupleStationId, TH2F *> m_MDT_radius_vs_DistanceToSegmentTrack; - - - std::map<NtupleStationId, TH2F*> m_r_MDT_residual_vs_adc[15]; - - std::map<NtupleStationId, TH1F *> m_MDT_segment_localangle_YZ; //local incidence angle XZ, YZ distributions of the segments - std::map<NtupleStationId, TH1F *> m_MDT_segment_localangle_XZ; - -// ########## Group 2, Histograms for compare the refit inprovement ############### - - std::map<NtupleStationId, TH2F *> m_MDT_residual_vs_radius[3]; - std::map<NtupleStationId, TH1F *> m_MDT_segment_hits[3]; - std::map<NtupleStationId, TH1F *> m_MDT_segment_chi2[3]; - std::map<NtupleStationId, TH1F *> m_MDT_segment_delta_chi2; -// std::map<NtupleStationId, TH1F *> m_MDT_segment_delta_residual; - - -// ########## Group 3, Histograms for ADC specify checking ############### -// 3.1 double hits -> ADC distribution v440 - std::map<NtupleStationId, TH2F *> m_MDT_SiHitAdc; - std::map<NtupleStationId, TH2F *> m_MDT_fhit_adc; -// 3.2 big residual hits -> working on - -// helpers // -// - - - const MdtIdHelper *m_MdtIdHelper; // pointer to the MDT ID helper - const RpcIdHelper *m_RpcIdHelper; // pointer to the RPC ID helper - - // MuonDetectorManager from the conditions store - SG::ReadCondHandleKey<MuonGM::MuonDetectorManager> m_DetectorManagerKey {this, "DetectorManagerKey", - "MuonDetectorManager", - "Key of input MuonDetectorManager condition data"}; - - const MuonCalib::IIdToFixedIdTool *m_id_tool; // identifier converter - -// private methods // - void createMaps(const MuonFixedId & id); - // create the histograms for the - // given station id if they do not - // exist -}; - -} - -#endif diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/MuonCalibStandAloneTools/NtupleChisqResolutionTool.h b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/MuonCalibStandAloneTools/NtupleChisqResolutionTool.h deleted file mode 100644 index 25129ff28c30529db4d4d6f062d55fc03759c10d..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/MuonCalibStandAloneTools/NtupleChisqResolutionTool.h +++ /dev/null @@ -1,78 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef NtupleChisqResolutionTool_H -#define NtupleChisqResolutionTool_H - -//c - c++ -#include <vector> -#include <map> - -// root -class TMinuit; -class TH1F; -class TH2F; -class TFile; - -//this -#include "MuonCalibStandAloneBase/NtupleCalibrationTool.h" -#include "AthenaBaseComps/AthAlgTool.h" -#include "GaudiKernel/ServiceHandle.h" -class MdtCalibInputSvc; - -namespace MuonCalib { - -//muoncalib -class IRtRelation; -class MuonCalibSegment; -class IRtResolution; - - -class NtupleChisqResolutionTool : public AthAlgTool, virtual public NtupleCalibrationTool - { - public: -//===============================public section================================= - /** Tool constructor */ - NtupleChisqResolutionTool(const std::string& t, const std::string& n, const IInterface* p); - /** Destructor */ - ~NtupleChisqResolutionTool()=default; - /** tool initialize */ - StatusCode initialize(); - /** tool finalize */ - StatusCode finalize(); - /** analyse the segments */ - StatusCode analyseSegments(const std::vector<MuonCalibSegment *> & segemnts); - /** set calibration region */ - void setRegion(); - /** get the resolution */ - const IRtResolution * getResolution() const; - //!? - inline void fcn(int &/*npar*/, double */*gin*/, double &f, double *par, int /*iflag*/); - private: -//============================private section=================================== - //!? - inline double recalculate(double *par); - //!? - const std::vector<MuonCalibSegment*> *m_seg; - //! some root stuff - TMinuit *m_minuit; - TH1F *m_prob_dist; - int m_minuitoutputlevel; - TFile * m_resolfile; - //! Calibration input service - ServiceHandle<MdtCalibInputSvc> m_calib_input_svc; - //! the rt relation - const IRtRelation *p_rt_rel; - - IRtResolution *m_final_resolution; // final resolution curve - inline double t_from_r(const double & r, const IRtRelation * rt_rel); - // get t(r) for the r-t relationship rt_rel, - // the method is auxiliary and not optimized; - // it will disappear when the t(r) will be - // available in the MuonCalib framework; - - }; -} - -#endif diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/MuonCalibStandAloneTools/NtupleClassicT0Tool.h b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/MuonCalibStandAloneTools/NtupleClassicT0Tool.h deleted file mode 100644 index d36919d2a1a3e13e879ebf6609d3940a90323552..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/MuonCalibStandAloneTools/NtupleClassicT0Tool.h +++ /dev/null @@ -1,77 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef _NtupleClassicT0Tool_H -#define _NtupleClassicT0Tool_H - - -//this -#include "MuonCalibStandAloneBase/NtupleCalibrationTool.h" -#include "AthenaBaseComps/AthAlgTool.h" -#include "GaudiKernel/ServiceHandle.h" -class RegionSelectionSvc; - -//t0 algorithm -#include "MdtCalibT0/T0CalibrationClassic.h" - - -namespace MuonCalib { - -/** @class NtupleClassicT0Tool - Interface tool for the MT T0-Fitter - @author rauscher@cern.ch - */ - -class NtupleClassicT0Tool: public AthAlgTool, virtual public NtupleCalibrationTool - { - public: -//============================================================================== - /** Tool Constructor*/ - NtupleClassicT0Tool(const std::string& t, const std::string& n, const IInterface* p); - /** tool initialization */ - StatusCode initialize(); - - /**analyse event - fill hits into specra*/ - StatusCode handleEvent(const MuonCalibEvent &/*event*/, int /*evnt_nr*/, const std::vector<MuonCalibSegment *> &segments, unsigned int position); - /** analyze segments */ - StatusCode analyseSegments(const std::vector<MuonCalibSegment *> & /*segments*/); - /** set calibratino region */ - void setRegion(); - /** get calibration results */ - const IMdtCalibrationOutput * getResults() const; - /** we dont need to keep the segments*/ - inline bool KeepSegments() const - { - return false; - } -//============================================================================== - private: - //! pointer to algorithm - T0CalibrationClassic * p_alg; - //! settings class - T0ClassicSettings *m_settings; - //! pointe rto region selectin service - ServiceHandle<RegionSelectionSvc> m_reg_sel_svc; - //! number of adc bins - int m_adcBins; - //! adc range - double m_minAdc, m_maxAdc; - //! number of time bins - int m_timeBins; - //! time range - double m_minTime, m_maxTime; - //! if true fit time - bool m_fitTime; - //! minimum number of entries - int m_minEntries; - //! init param marameter - int m_initParam; - //! maximum value for chi2 - double m_chiMax; - }; - -} - - -#endif diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/MuonCalibStandAloneTools/NtupleControlHistogramsTool.h b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/MuonCalibStandAloneTools/NtupleControlHistogramsTool.h deleted file mode 100644 index 7c773f659547ecb4432781cef401304792dec6aa..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/MuonCalibStandAloneTools/NtupleControlHistogramsTool.h +++ /dev/null @@ -1,257 +0,0 @@ -/* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration -*/ - -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -// 20.06.2007, AUTHOR: OLIVER KORTNER -// Modified: 26.06.2007 by O. Kortner, new naming convention for directories: -// station-phi-eta. -// 26.06.2007 by O. Kortner, new histograms added. -// 19.07.2007 by O. Kortner, no t0 refinement without r-t calibration. -// 18.08.2008 by O. Kortner, curved track fit + time-out option added. -// 03.11.2008 by O. Kortner, allow the user to turn off the t0 -// refinement histograms. -// 21.02.2009 by O. Kortner, additional residual histograms -// after t0 refinement. -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - -#ifndef MuonCalib_NtupleControlHistogramsToolH -#define MuonCalib_NtupleControlHistogramsToolH - -//::::::::::::::::::::::::::::::::::::::: -//:: CLASS NtupleControlHistogramsTool :: -//::::::::::::::::::::::::::::::::::::::: - -/// \class NtupleControlHistogramsTool -/// -/// This class makes control histograms for the calibration regions selected -/// by the user. The user can ask for a refit of the segments with the -/// r-t relationship as loaded by the master stand-alone programme via -/// job options. -/// -/// \author Oliver.Kortner@CERN.CH -/// -/// \date 20.06.2007 - -//:::::::::::::::::: -//:: HEADER FILES :: -//:::::::::::::::::: - -// STL // -#include <string> -#include <map> - -// ROOT // -#include "TFile.h" -#include "TH1.h" -#include "TH2.h" -class TF1; -class TTree; -class TProfile; - -namespace MuonGM { -class RpcDetectorElement; -} -class RpcIdHelper; - -// MuonCalib // -#include "MuonCalibEventBase/MuonCalibEvent.h" -#include "MdtCalibFitters/StraightPatRec.h" -#include "MuonCalibStandAloneBase/NtupleCalibrationTool.h" -#include "MuonCalibStandAloneBase/NtupleStationId.h" -#include "MuonCalibITools/IIdToFixedIdTool.h" -#include "MdtCalibFitters/StraightPatRec.h" -#include "MdtCalibFitters/CurvedPatRec.h" -#include "MuonCalibStandAloneBase/T0Refinement.h" -#include "AthenaBaseComps/AthAlgTool.h" -#include "GaudiKernel/ServiceHandle.h" -#include "MuonReadoutGeometry/MuonDetectorManager.h" - -class RegionSelectionSvc; -class MdtCalibInputSvc; - -namespace MuonCalib { - -class T0MTHistos; - -class NtupleControlHistogramsTool : public AthAlgTool, - virtual public NtupleCalibrationTool { - -public: -// Constructors // - NtupleControlHistogramsTool(const std::string & t, - const std::string & n, const IInterface * p); - ///< Constructor of the tool. - - ~NtupleControlHistogramsTool(void); - ///< Destructor of the tool. - -// Methods // -// methods required by the base classes // - StatusCode initialize(void); - ///< initialization of the tool - StatusCode finalize(void); - ///< finilization of the tool - StatusCode handleEvent(const MuonCalibEvent & event, int evnt_nb, - const std::vector<MuonCalibSegment *> & segments, - unsigned int position); - ///< analysis of the event, - ///< raw data and segment histograms - ///< are filled - bool KeepSegments(void) const; - ///< returns true, if segments should - ///< be stored in memory, false - ///< otherwise - -private: -// job options // - bool m_refit_segments; // = true, if the segments should be refitted, - // = false, if the segments are not refitted - bool m_curved_fits; // = true, if curved segment fits should be performed, - // = false, if straight segment fits should be performed - bool m_refine_t0; // = true, if t0 refinement plots should be made, - // = false otherwise - double m_time_out; // time out for pattern finding - double m_road_width; // road width for pattern recognition - std::string m_MDT_ID_helper; // name of the MDT ID helper - std::string m_RPC_ID_helper; // name of the RPC ID helper - std::string m_idToFixedIdToolType; // type of the muon fixed id tool - std::string m_idToFixedIdToolName; // name of the muon fixed id tool - std::string m_ROOT_file_name; // name of the output ROOT file - -// ROOT file // - TFile *m_tfile; // pointer to the ROOT file in which the data have to - // be stored - -// calibration region // - ServiceHandle<RegionSelectionSvc> m_reg_sel_svc; -// calibration parameters // - ServiceHandle<MdtCalibInputSvc> m_input_service; // pointer to the calibration input - // service - -// chamber parameters // - std::map<NtupleStationId, unsigned int> m_nb_ml; // number of - // multilayers - std::map<NtupleStationId, unsigned int> m_nb_ly; // number of layers per - // multilayer - std::map<NtupleStationId, unsigned int> m_nb_tb; // number of tubes per - // layer - std::map<NtupleStationId, unsigned int> m_nb_totalEtaStrips; // number of eta strips - std::map<NtupleStationId, unsigned int> m_nb_totalEtaStrips2; // number of eta strips in - // RDoublet=2 rpcs - -// event data // - std::map<NtupleStationId, unsigned int> m_nb_raw_MDT_hits; - // number of raw MDT hits in - // the chambers - unsigned int m_nb_events; - // number of events - int m_nb_etaStrips[2][4]; // number of rpc eta - // strips [rDoublet][zDoublett] -// straight-line fitter // - StraightPatRec *m_qfitter; - -// curved-line fitter // - CurvedPatRec *m_cfitter; - -// t0 refinement // - T0Refinement *m_t0_refinement; - -// histograms // - // raw-data histograms // - std::map<NtupleStationId, TH1F *> m_MDT_raw_nb_hits; - // number of raw hits per MDT chamber - std::map<NtupleStationId, TH1F *> m_MDT_raw_hit_distribution; - // distribution of raw hits per MDT chamber - std::map<NtupleStationId, TH1F *> m_MDT_raw_TDC; - // raw TDC spectrum per MDT chamber - std::map<NtupleStationId, TH1F *> m_MDT_raw_ADC; - // raw ADC spectrum per MDT chamber - //histograms to check mdt-rpc correlations - std::map<NtupleStationId, TH1F *> m_RPC_raw_etaStrip; - std::map<NtupleStationId, TH2F *> m_MDT_RPC_raw_tubeStripCor; - std::map<NtupleStationId, TH2F *> m_MDT_RPC_raw_tubeStripCor_adcCut; - std::map<NtupleStationId, TH2F *> m_MDT_RPC_raw_tubeStripCorVsEvent; - std::map<NtupleStationId, TH2F *> m_MDT_RPC_raw_tubeStripCorVsEvent_adcCut; - std::map<NtupleStationId, TH1F *> m_RPC_raw_etaStrip2; - std::map<NtupleStationId, TH2F *> m_MDT_RPC_raw_tubeStripCor2; - std::map<NtupleStationId, TH2F *> m_MDT_RPC_raw_tubeStripCor_adcCut2; - std::map<NtupleStationId, TH2F *> m_MDT_RPC_raw_tubeStripCorVsEvent2; - std::map<NtupleStationId, TH2F *> m_MDT_RPC_raw_tubeStripCorVsEvent_adcCut2; - - //histograms to check db - std::map<NtupleStationId, TH1F *> m_t0_diff; - // t0 from tuple minus t0 from file - std::map<NtupleStationId, TH1F *> m_r_mintrt; - // r minus r(t) - TH1F *m_t0_diff_global, *m_r_mintrt_global; - TH2F *m_r_minrt_vs_r; - - // segment histograms // - std::map<NtupleStationId, TH1F *> m_MDT_segment_hits; - // number of hits on the MDT segment - std::map<NtupleStationId, TH1F *> m_MDT_segment_hist_to_raw_hits_ratio; - // number of hits on the MDT segment divided - // by the number of raw hits in the MDT chamber - std::map<NtupleStationId, TH1F *> m_MDT_segment_CL; - // confidence level distribution of the segment - // fits - std::map<NtupleStationId, TH1F *> m_MDT_segment_TDC; - // TDC spectra of hits in the segments - std::map<NtupleStationId, T0MTHistos *> m_MDT_segment_tspec_ml[3]; - //fitter for segment spectra - per multilayer; - std::map<NtupleStationId, TH1F *> m_MDT_segment_t; - // drift-time spectra of hits in the segments - std::map<NtupleStationId, TH1F *> m_MDT_segment_r; - // drift-radius spectra of hits in the segments - std::map<NtupleStationId, TH1F *> m_MDT_segment_hit_dis; - // drift-radius spectra of hits in the segments - std::map<NtupleStationId, TH1F *> m_MDT_segment_ADC; - // ADC spectra of hits in the segments - std::map<NtupleStationId, TH1F *> m_MDT_segment_slope; - // slope distributions of the segments - std::map<NtupleStationId, TH2F *> m_MDT_residuals; - std::map<NtupleStationId, TH2F *> m_MDT_residuals_vs_x; - std::map<NtupleStationId, TH2F *> m_MDT_r_vs_rtrack; - std::map<NtupleStationId, TH2F *> m_MDT_t_vs_rtrack; - - // residual distribution per MDT chamber - std::map<NtupleStationId, TH2F *> m_MDT_residuals_ml1; - // residual distribution in multilayer 1 - std::map<NtupleStationId, TH2F *> m_MDT_residuals_ml2; - // residual distribution in multilayer 1 - std::map<NtupleStationId, TH1F *> m_MDT_t0_refinement; - // delta t0 from track fit - std::map<NtupleStationId, TH1F *> m_MDT_t_refined; - // t0 corrected drift time spectrum - std::map<NtupleStationId, TH2F *> m_MDT_residuals_t0_refined; - // residuals after t0 refinement - std::map<NtupleStationId, TH2F *> m_MDT_residuals_t0_refined_gt4hits; - // residuals after t0 refinement for segments with >4 hitss - -//for root tree -//pointer to root tree - TTree *m_chamber_tree; -// helpers // - const MdtIdHelper *m_MdtIdHelper; // pointer to the MDT ID helper - const RpcIdHelper *m_RpcIdHelper; // pointer to the RPC ID helper - - // MuonDetectorManager from the conditions store - SG::ReadCondHandleKey<MuonGM::MuonDetectorManager> m_DetectorManagerKey {this, "DetectorManagerKey", - "MuonDetectorManager", - "Key of input MuonDetectorManager condition data"}; - - const MuonCalib::IIdToFixedIdTool *m_id_tool; // identifier converter - -// private methods // - void createMaps(const MuonFixedId & id); - // create the histograms for the - // given station id if they do not - // exist - inline double getChi2(const TF1 *fun, const TH1F *hist) const; - inline double getResidualChi2(TProfile *px) const; -}; - -} - -#endif diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/MuonCalibStandAloneTools/NtupleCurvedAutocalibrationTool.h b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/MuonCalibStandAloneTools/NtupleCurvedAutocalibrationTool.h deleted file mode 100644 index 7407769e5a460ba97cc1435526827d4e2bf2e9cf..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/MuonCalibStandAloneTools/NtupleCurvedAutocalibrationTool.h +++ /dev/null @@ -1,80 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef NtupleCurvedAutocalibrationTool_H -#define NtupleCurvedAutocalibrationTool_H - -//this -#include "MuonCalibStandAloneBase/NtupleCalibrationTool.h" -#include "AthenaBaseComps/AthAlgTool.h" -#include "GaudiKernel/ServiceHandle.h" - -class MdtCalibInputSvc; - -namespace MuonCalib { - -class RtCalibrationCurved; - -/** @class NtupleCurvedAutocalibrationTool - Interface tool for the Integration Method for finding an initial r-t - relation. - @author rauscher@cern.ch -*/ - - -class NtupleCurvedAutocalibrationTool : public AthAlgTool, virtual public NtupleCalibrationTool - { - public: -//============================================================================== - /** Tool Constructor */ - NtupleCurvedAutocalibrationTool(const std::string& t, const std::string& n, const IInterface* p); - /** Tool initialization */ - StatusCode initialize(); - - /** analyze segments */ - StatusCode analyseSegments(const std::vector<MuonCalibSegment *> & segemnts); - /** set calibratino region */ - void setRegion(); - /** get calibration results */ - const IMdtCalibrationOutput * getResults() const; -//============================================================================== - private: - //! pointer to algoritm - RtCalibrationCurved *m_autocalibration; - //! estimateted initial rt acuracy - job option - double m_rt_accuracy; - //! the type of the correction function (LEGENDRE|CHEBYSHEV|POLYGON - job option - std::string m_func_type; - //! the function type as a numeric value - //! = 1: Legendre polynomial, - //! = 2: Chebyshev polynomial - //! = 3: polygon equidistant in r - int m_func_type_num; - //! order of the correctio nfunctino - int m_order; - //! fix_min, fix_max=true: fix r(t_min), r(t_max) - job option - bool m_fix_min, m_fix_max; - //! maximum number of iterations. - job otion - int m_max_it; - //! force monotonuous rt relation - job option - bool m_force_mono; - //! control histogram output - job option - bool m_control_histograms; - //! calibratin input service - ServiceHandle<MdtCalibInputSvc> m_calib_input_svc; - //! is set to true if the analysis failed - bool m_failed; - //! is set to true if parabolic extrapolation should be performed for small - //! and large radii - bool m_parabolic_extrapolation; - //! is set to true if r(t) should be smoothened using the conventional - //! autocalibration - bool m_smoothing; - //! if set to true multilayer rt scale will be deterined - bool m_multilayer_rt_difference; - }; - -#endif - -} diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/MuonCalibStandAloneTools/NtupleDBCheckTool.h b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/MuonCalibStandAloneTools/NtupleDBCheckTool.h deleted file mode 100644 index 555a7c22ea088403e03c30dd06180d2a54080e59..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/MuonCalibStandAloneTools/NtupleDBCheckTool.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef NtupleDbCheckTool_h -#define NtupleDbCheckTool_h - -//root -#include "TTree.h" -#include "TFile.h" - -//MuonCalibStandAloneBase -#include "MuonCalibStandAloneBase/NtupleCalibrationTool.h" -#include "AthenaBaseComps/AthAlgTool.h" -#include "GaudiKernel/ServiceHandle.h" -//MdtCalibIoSvc -class MdtCalibInputSvc; - -namespace MuonCalib { - - -class NtupleDbCheckTool : public AthAlgTool, virtual public NtupleCalibrationTool - { - public: - //contructor - NtupleDbCheckTool(const std::string & t, -const std::string & n, const IInterface * p); - ~NtupleDbCheckTool(); - - //initialize - finalize - StatusCode initialize(void); - StatusCode finalize(void); - //handle event - StatusCode handleEvent(const MuonCalibEvent & /*event*/, int /*evnt_nb*/, const std::vector<MuonCalibSegment *> & segments, unsigned int position); - //keep seg - inline bool KeepSegments() const - { - return false; - } - - private: - TFile * m_outfile; - TTree * m_outtree; - Int_t m_station, m_eta, m_phi; - Double_t m_ntuple_t0, m_calib_t0; - Double_t m_ntuple_r, m_calib_r; - - //calibration input service - ServiceHandle<MdtCalibInputSvc> m_input_service; - }; //class - - -} //namespace MuonCalib - -#endif diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/MuonCalibStandAloneTools/NtupleDisplayTool.h b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/MuonCalibStandAloneTools/NtupleDisplayTool.h deleted file mode 100644 index 8f1fd8eb8e0de9a9cabb39deaba2eb7dd5c5c15d..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/MuonCalibStandAloneTools/NtupleDisplayTool.h +++ /dev/null @@ -1,185 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef MuonCalib_NtupleDisplayToolH -#define MuonCalib_NtupleDisplayToolH - -//::::::::::::::::::::::::::::: -//:: CLASS NtupleDisplayTool :: -//::::::::::::::::::::::::::::: - -/// \class NtupleDisplayTool -/// -/// This class serves as display of events in mdt chambers. -/// -/// \author Steffen.Kaiser@cern.ch -/// -/// \date 19.10.2007 - -//:::::::::::::::::: -//:: HEADER FILES :: -//:::::::::::::::::: - -// this -#include "MuonCalibStandAloneBase/NtupleCalibrationTool.h" -#include "AthenaBaseComps/AthAlgTool.h" -#include "GaudiKernel/ServiceHandle.h" - -//root -#include "TEllipse.h" -class TCanvas; -class TControlBar; -class TApplication; - -// STL // -#include <string> - -// MuonCalib -#include "MdtCalibInterfaces/IMdtPatRecFitter.h" - -#include "MuonIdHelpers/IMuonIdHelperSvc.h" -#include "MuonReadoutGeometry/MuonDetectorManager.h" - -class RegionSelectionSvc; - -namespace MuonCalib { - -class IIdToFixedIdTool; -class MuonCalibSegment; -class NtupleStationId; -class MuonCalibEvent; - -class TubeCircle; - -class NtupleDisplayTool : public AthAlgTool, virtual public NtupleCalibrationTool - { - - public: - // Constructors // - NtupleDisplayTool(const std::string& t, const std::string& n, const IInterface* p); - - ~NtupleDisplayTool()=default; - ///< Destructor - - /** tool initialize */ - StatusCode initialize(); - - StatusCode handleEvent(const MuonCalibEvent & event, int evnt_nr, const std::vector<MuonCalibSegment *> &segments, unsigned int position); - ///< analysis of the given segment of - ///< event eventnumber, event contains - ///< the raw hits - StatusCode analyseSegments(const std::vector<MuonCalibSegment *> & /*segemnts*/); - ///< analysis at the end of the data - ///< file - inline bool KeepSegments() const - { - return false; - } - - private: - ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; - - // MuonDetectorManager from the conditions store - SG::ReadCondHandleKey<MuonGM::MuonDetectorManager> m_DetectorManagerKey {this, "DetectorManagerKey", - "MuonDetectorManager", - "Key of input MuonDetectorManager condition data"}; - - const MuonCalib::IIdToFixedIdTool *m_id_tool; - - - TApplication *m_root; //to display graphics within athena - TControlBar *m_bar; //the control bar - - TCanvas *m_canvas; //canvas for chamber display - TCanvas *m_canvas_leg; //canvas for legend - - - std::string m_fitter_name; // name of the track fitter - unsigned int m_nb_hits; //minimum number of hits in displayed segment - double m_road_width; //road width for pattern recognition - int m_chosen_event; //to chose a single event - double m_scalefactor; //scale factor for the size of the display - double m_adc_cut; //adc cut to define noise hits - - // calibration region // - ServiceHandle<RegionSelectionSvc> m_reg_sel_svc; - // line reconstruction // - IMdtPatRecFitter *m_qfitter; - - // numbers // - int m_nb_multilayers; - int m_nb_layers; - int m_nb_tubes; - - - std::vector<int> m_colors; //vector of colors to be used - - // vectors of tube circles // - std::vector< std::vector< std::vector<TubeCircle*> > > m_tube_circle; - //used for identification of the tubes - - std::vector<TubeCircle*> m_tube_circle_lin; - //used for drawing and resetting - - }; - - - class TubeCircle : public TEllipse { - - public: - - // Constructors // - TubeCircle(); - ///< Default constructor. - TubeCircle(std::vector<int> colors, double m_adc_cut = 50.); - ///< constructor which sets to vector of colors and the adc cut - TubeCircle(Amg::Vector3D TubePos, std::vector<int> colors, double m_adc_cut = 50.); - ///< constructor which sets to vector of colors, the adc cut and the tube position - - void setPosition(Amg::Vector3D TubePos); - ///< set the tube position - void setColors(std::vector<int> colors); - ///< set the vector of colors to be used (size=5), - ///< 0: segment hit, 1: raw hit, 2: drift radius > 14.6, - ///< 3: adc < 70, 4: drift time < 0 - void setAdcCut(double adc_cut); - ///< set adc cut to define noise hit - - void setUsedFlag(bool flag); ///<set used flag - bool isUsed(void); ///<get used flag - - void setSegmentHit(double radius, double time, double adc); - ///< set segment hit(drift radius, drift time, adc) - - bool hasSegmentHit(void); - ///< return flag if the tube has a segment hit - - void setRawHit(double radius, double time, double adc); - ///< set raw hit(drift radius, drift time, adc) - - bool hasRawHit(void); - ///< return flag if the tube has a raw hit - - - void reset(void); - ///< reset the tube to a clean and empty tube - - int tube, layer, multilayer; - private: - - void setRadius(double radius, double time, double adc, int hit); - //set the properties of the hit (drift radius, drift time, adc), - //hit = 0: segment hit, = 1: raw hit - - bool m_used_flag; //is the tube used - bool m_rawhit_flag; //has the tube a raw hit - bool m_segmenthit_flag; //has the tube a segment hit - double m_adc_cut; //adc cut to define noi - std::vector<int> m_colors; //vector of colors to be used - - }; - -} - -#endif diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/MuonCalibStandAloneTools/NtupleIntegrationTool.h b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/MuonCalibStandAloneTools/NtupleIntegrationTool.h deleted file mode 100644 index 4a9478ae391c118f72aeb8c679be41eeb8b21f5f..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/MuonCalibStandAloneTools/NtupleIntegrationTool.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef NtupleIntegrationTool_H -#define NtupleIntegrationTool_H - -//this -#include "MuonCalibStandAloneBase/NtupleCalibrationTool.h" -#include "AthenaBaseComps/AthAlgTool.h" - -//root -class TFile; - -namespace MuonCalib { - -class RtCalibrationIntegration; - -/** @class NtupleIntegrationTool - Interface tool for the Integration Method for finding an initial r-t - relation. - @author rauscher@cern.ch -*/ - - -class NtupleIntegrationTool : public AthAlgTool, virtual public NtupleCalibrationTool - { - public: -//============================================================================== - /** Tool Constructor */ - NtupleIntegrationTool(const std::string& t, - const std::string& n, - const IInterface* p); - /** Tool initialization */ - StatusCode initialize(); - /** Tool finalization */ - StatusCode finalize(); - /**analyse event - fill hits into specra*/ - StatusCode handleEvent(const MuonCalibEvent &/*event*/, int /*evnt_nr*/, const std::vector<MuonCalibSegment *> &segments, unsigned int position); - /** end of events analysis */ - StatusCode analyseSegments(const std::vector<MuonCalibSegment *> & /*segemnts*/); - /** get calibration results */ - const IMdtCalibrationOutput * getResults() const; - /** we dont need to keep the segments*/ - inline bool KeepSegments() const - { - return false; - } -//============================================================================== - private: - //! pointer to algoritm - RtCalibrationIntegration *m_integration; - //! tmax for integration - job option - double m_t_max_int; - //! is true if close hits are filled - job option - bool m_has_close_hits; - //! inner tube radius - job option - double m_inner_tube_radius; - //! lower radius for parabolic extrapolation at the upper end of the r-t - double m_lower_extrapolation_radius; - //! higher radius for parabolic extrapolation at the upper end of the r-t - double m_upper_extrapolation_radius; - //! write multilayer t_max-difference - bool m_multilayer_tmax_diff; - //! root file - TFile *p_file; - }; - -#endif - -} diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/MuonCalibStandAloneTools/NtupleMTT0Tool.h b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/MuonCalibStandAloneTools/NtupleMTT0Tool.h deleted file mode 100644 index e4af5a0585f62bc43231f408ab68bf58ddff812c..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/MuonCalibStandAloneTools/NtupleMTT0Tool.h +++ /dev/null @@ -1,78 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef _NtupleMTT0Tool_H -#define _NtupleMTT0Tool_H - - -//this -#include "MuonCalibStandAloneBase/NtupleCalibrationTool.h" -#include "AthenaBaseComps/AthAlgTool.h" -#include "GaudiKernel/ServiceHandle.h" -class RegionSelectionSvc; - -//t0 algorithm -#include "MdtCalibT0/T0CalibrationMT.h" -#include "MdtCalibT0/T0MTSettings.h" - -namespace MuonCalib { - -/** @class NtupleMTT0Tool - Interface tool for the MT T0-Fitter - @author rauscher@cern.ch - */ - -class NtupleMTT0Tool: public AthAlgTool, virtual public NtupleCalibrationTool - { - public: -//============================================================================== - /** Tool Constructor*/ - NtupleMTT0Tool(const std::string& t, const std::string& n, const IInterface* p); - /** tool initialization */ - StatusCode initialize(); - - /**analyse event - fill hits into specra*/ - StatusCode handleEvent(const MuonCalibEvent &/*event*/, int /*evnt_nr*/, const std::vector<MuonCalibSegment *> &segments, unsigned int position); - /** end of events analysis */ - StatusCode analyseSegments(const std::vector<MuonCalibSegment *> & /*segemnts*/); - /** set calibratino region */ - void setRegion(); - /** get calibration results */ - const IMdtCalibrationOutput * getResults() const; - /** we dont need to keep the segments*/ - inline bool KeepSegments() const - { - return false; - } -//============================================================================== - private: - //! pointer to algorithm - T0CalibrationMT * p_alg; - //! settings class - T0MTSettings m_settings; - //! pointe rto region selectin service - ServiceHandle<RegionSelectionSvc> m_reg_sel_svc; - //! number of negative and positive bins - int m_n_bins_neg, m_n_bins_pos; - //! use top chi2 instead of the normal one - bool m_use_top_chi2; - //! threshold for the application of the scrambling method - double m_scramble_thresh, m_sclicing_thresh; - //! minimum number of entries per fit - int m_min_entries_time, m_min_entries_adc; - //! group by - std::vector<std::string> m_group_by; - std::vector<int> m_sort_by; - std::vector<std::string> m_adc_group_by; - std::vector<int> m_adc_sort_by; - //! correct for relative t0 - bool m_correct_rel_t0; - - inline bool eval_group_by(const std::string & group_by, int & sort_by); - }; - -} - - -#endif diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/MuonCalibStandAloneTools/NtupleResidualTool.h b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/MuonCalibStandAloneTools/NtupleResidualTool.h deleted file mode 100644 index 0fe9af020038f16c968f79ccb6916ece85576d3c..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/MuonCalibStandAloneTools/NtupleResidualTool.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef _NtupleResidualTool_H -#define _NtupleResidualTool_H - -//this -#include "MuonCalibStandAloneBase/NtupleCalibrationTool.h" -#include "AthenaBaseComps/AthAlgTool.h" - -//root -class TH2F; -class TH1F; -class TFile; -#include "TTree.h" - -namespace MuonCalib { - - -class QuasianalyticLineReconstruction; - -/** @class NtupleResidualTool - Interface tool for the MT T0-Fitter - @author rauscher@cern.ch - */ - -class NtupleResidualTool: public AthAlgTool, virtual public NtupleCalibrationTool - { - public: -//============================================================================== - /** Tool Constructor*/ - NtupleResidualTool(const std::string& t, const std::string& n, const IInterface* p); - /** tool initialization */ - StatusCode initialize(); - /** tool finalization */ - StatusCode finalize(); - /**analyse event - fill hits into specra*/ - StatusCode handleEvent(const MuonCalibEvent &/*event*/, int /*evnt_nr*/, const std::vector<MuonCalibSegment *> &segments, unsigned int position); - /** we dont need to keep the segments*/ - inline bool KeepSegments() const - { - return false; - } -//============================================================================== - private: - TH2F *m_residual_distribution; - TH1F *m_r_spec; - TFile *m_outfile; - TH1F *m_chi2; - TH1F *m_nhits; - //quasianalytic fitter - QuasianalyticLineReconstruction *m_fitter; - - }; - -} - - -#endif diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/MuonCalibStandAloneTools/NtupleResidualVsTimeTool.h b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/MuonCalibStandAloneTools/NtupleResidualVsTimeTool.h deleted file mode 100644 index 5029357d17ed21eee8ff2b81aa460f90b86f42e0..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/MuonCalibStandAloneTools/NtupleResidualVsTimeTool.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef _NtupleResidualVsTimeTool_H -#define _NtupleResidualVsTimeTool_H - -//this -#include "MuonCalibStandAloneBase/NtupleCalibrationTool.h" -#include "AthenaBaseComps/AthAlgTool.h" - - -//root -class TH2F; -class TFile; -#include <map> - -namespace MuonCalib { - - -class IMdtPatRecFitter; - -/** @class NtupleResidualVsTimeTool - Interface tool for the MT T0-Fitter - @author rauscher@cern.ch - */ - -class NtupleResidualVsTimeTool: public AthAlgTool, virtual public NtupleCalibrationTool - { - public: -//============================================================================== - /** Tool Constructor*/ - NtupleResidualVsTimeTool(const std::string& t, const std::string& n, const IInterface* p); - /** tool initialization */ - StatusCode initialize(); - /** tool finalization */ - StatusCode finalize(); - /**analyse event - fill hits into specra*/ - StatusCode handleEvent(const MuonCalibEvent &event, int /*evnt_nr*/, const std::vector<MuonCalibSegment *> &segments, unsigned int position); - /** we dont need to keep the segments*/ - inline bool KeepSegments() const - { - return false; - } -//============================================================================== - private: - bool m_curved_segments; - int m_min_hits; - std::map<std::pair<unsigned int, unsigned int> ,TH2F *> m_residual_distribution; - TH2F *m_last_residual_distribution; - TFile *m_outfile; - //quasianalytic fitter - IMdtPatRecFitter *m_fitter; - std::pair<unsigned int, unsigned int> m_last_lumiblock; - - }; - -} - - -#endif diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/MuonCalibStandAloneTools/NtupleRunScanTool.h b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/MuonCalibStandAloneTools/NtupleRunScanTool.h deleted file mode 100644 index 1a60f0e423da9f1d3d46002c3745b0d8c3050b9d..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/MuonCalibStandAloneTools/NtupleRunScanTool.h +++ /dev/null @@ -1,78 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef _NtupleRunScanTool_H -#define _NtupleRunScanTool_H - -//c - c++ -#include "map" - -//this -#include "MuonCalibStandAloneBase/NtupleCalibrationTool.h" -#include "MuonCalibStandAloneBase/NtupleStationId.h" -#include "MuonCalibStandAloneTools/HitCounter.h" - -#include "AthenaBaseComps/AthAlgTool.h" -#include "GaudiKernel/ServiceHandle.h" -#include "MuonIdHelpers/IMuonIdHelperSvc.h" -#include "MuonReadoutGeometry/MuonDetectorManager.h" - -class TFile; - -namespace MuonCalib { - - -/** @class NtupleRunScanTool -Scans a run and checks for present chambers and number of hits -@author rauscher@cern.ch -*/ - -class NtupleRunScanTool: public AthAlgTool, virtual public NtupleCalibrationTool - { - public: -//============================================================================== - /** Tool Constructor*/ - NtupleRunScanTool(const std::string& t, const std::string& n, const IInterface* p); - ~NtupleRunScanTool()=default; - /** tool initialization */ - StatusCode initialize(); - /**analyse event - fill hits into specra*/ - StatusCode handleEvent(const MuonCalibEvent &event, int /*evnt_nr*/, const std::vector<MuonCalibSegment *> &segments, unsigned int position); - /** end of events analysis - segemnts are not used here*/ - StatusCode analyseSegments(const std::vector<MuonCalibSegment *> & /*segemnts*/); - /** we dont need to keep the segments*/ - inline bool KeepSegments() const - { - return false; - } -//============================================================================== - private: - //! minimum number of hits per drift time spectrum - job option - int m_min_hits; - //! maximum rate of bad fits - job option - double m_max_bad_fits; - //! suppress output for chambers which should not be fitted - bool m_suppress_nofit; - //! noisy tube factor: A tube is considered noisy, if n_hits > <n_hits> * m_noisy_tube_factor * n_tubes - int m_noisy_tube_factor; - //! hit counter classes - sortet by station - std::map<NtupleStationId, HitCounter> m_hit_counters; - //!access to geomodel - ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; - - // MuonDetectorManager from the conditions store - SG::ReadCondHandleKey<MuonGM::MuonDetectorManager> m_DetectorManagerKey {this, "DetectorManagerKey", - "MuonDetectorManager", - "Key of input MuonDetectorManager condition data"}; - - //!iov informatino - unsigned int m_time_min, m_time_max; - unsigned int m_run_min, m_run_max; - //! output file - TFile *p_outfile; - }; - -} - -#endif diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/MuonCalibStandAloneTools/NtupleSimpleresolutionTool.h b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/MuonCalibStandAloneTools/NtupleSimpleresolutionTool.h deleted file mode 100644 index 3dca009b1d61397c823704cabb54fe424ffbed20..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/MuonCalibStandAloneTools/NtupleSimpleresolutionTool.h +++ /dev/null @@ -1,148 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef NtupleSimpleResolutionToolH -#define NtupleSimpleResolutionToolH - -#include "MuonCalibStandAloneBase/NtupleCalibrationTool.h" -#include "MuonCalibStandAloneBase/RegionSelectionSvc.h" -#include "AthenaBaseComps/AthAlgTool.h" -#include "GaudiKernel/ServiceHandle.h" - -#include "string" -#include "vector" - -#define RBIN 30 - -/* ROOT */ -class TFile; -class TH2F; -class TF1; -class TGraphErrors; - -class MdtCalibInputSvc; - -namespace MuonCalib { - -class MuonCalibSegment; -class IRtRelation; - -class NtupleSimpleResolutionTool : public AthAlgTool, virtual public NtupleCalibrationTool - { -public: -/** Constructors **/ - NtupleSimpleResolutionTool(const std::string& t, const std::string& n, const IInterface* p); - - virtual ~NtupleSimpleResolutionTool()=default; - -/** Tool initialize **/ - StatusCode initialize(); - -/** Is called at the end of the analysis - The argumet is only there to overload the interface function*/ - StatusCode analyseSegments(const std::vector<MuonCalibSegment *> & segemnts); - - void handle_segment(MuonCalibSegment & seg, double *par_lim_low, double - *par_lim_upp); - -/** get the final resolution after the algorithm has been run **/ - inline const IRtResolution * getResolution() const - { - return m_final_resolution; - } - -/** set calibratino region */ - void setRegion(); - -protected: - static const unsigned int MAXNUMHITS; - -private: - - void end_of_data(const IRtRelation * rt_rel); -/* resolution curves */ - IRtResolution *m_final_resolution; // final resolution curve - -/* segments */ - unsigned int m_number_of_segments; // number of selected segments - std::vector<MuonCalibSegment *> m_refitted_segment; - /* vector with the refitted segments - (used to store the segments for the autocalibration iteration) */ - - unsigned int m_MINNUMHITS; -/* bining and ranges for Histograms*/ - static const unsigned int SBIN = 500; - static const unsigned int RESBIN = 60; - static constexpr float SRANGE = 2.0; - static constexpr float RRANGE = 15.0; - static constexpr float RESRANGE = 6.0; - - -/* JOB OPTION PARAMETERS */ -/* do curved track fit - job option */ - bool m_curved; -/* track error entries limit - job optins */ - float m_REJ_LOW, m_REJ_TOP; -/* Relative difference betwen iterations for convergence. - job optins */ - float m_DELTA_CONV, m_DIFF_MAX; -/* maximimum number of iteration - job options */ - int m_MAX_NUM_IT; - bool m_hist_fit_method; - bool m_replace_with_flat; -/* Name of output file with resolution curve */ - std::string m_spr_out_name; -/* Outlier removal */ - bool m_suppress_outliers; - float m_SUPPRESS_LOW, m_SUPPRESS_TOP; - float m_low[RBIN], m_top[RBIN]; - -/* Calibration input service */ - ServiceHandle<MdtCalibInputSvc> m_calib_input_svc; -/* calibration region */ - ServiceHandle<RegionSelectionSvc> m_reg_sel_svc; - -/* rt relation */ - const IRtRelation *m_rt_relation; - -/* is true if initialize is called - needed for genvonf */ - bool m_is_initialized; - - TFile *m_outfile; - - TH2F *m_residual; - TH2F *m_residual0; - TH2F *m_residual2; - TH2F *m_residual3; - - TH2F *m_sigma_track; - TH2F *m_sigma_track_lim; - - TF1 *m_sprfun; // - TF1 *m_sprfun_r; // - TGraphErrors *m_sprgr; - TGraphErrors *m_sprgr_r; - -/* private methods */ - void destruct(void); /* destruction routine */ - - int trackFit(int num_hit, double *dist_hit, double *y, - double *sigma2_hit, double &shift, double &sigma_track); - - int trkErrorFix(double *par_l, double *par_u); - - int spResCalc(bool SfromR); - - double t_from_r(const double & r, const IRtRelation * rt_rel); - /* //get t(r) for the r-t relationship rt_rel, - // the method is auxiliary and not optimized; - // it will disappear when the t(r) will be - // available in the MuonCalib framework; */ - -/* Functions for Root Fitting */ - static double ttt(double *x, double *par); - static double ttt0(double *x, double *par); -}; - -} - -#endif diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/MuonCalibStandAloneTools/NtupleTubeEfficiencyTool.h b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/MuonCalibStandAloneTools/NtupleTubeEfficiencyTool.h deleted file mode 100644 index f930c92a109efa3b0f718e2e8843bfa28843ec7e..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/MuonCalibStandAloneTools/NtupleTubeEfficiencyTool.h +++ /dev/null @@ -1,148 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -// 10.04.2007, AUTHOR: STEFFEN KAISER -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - -#ifndef MuonCalib_NtupleTubeEfficiencyToolH -#define MuonCalib_NtupleTubeEfficiencyToolH - -//:::::::::::::::::::::::::::::::::::: -//:: CLASS NtupleTubeEfficiencyTool :: -//:::::::::::::::::::::::::::::::::::: - -/// \class NtupleTubeEfficiencyTool -/// -/// This class determines the single tube efficiencies and fakerates -/// and writes them to a TubeEfficiencies_<regionId>.txt and .root file. -/// (The fakerate only compares the raw hits to the tubes traversed by -/// one segment.) -/// -/// The combined efficiencies for the layer, multilayer and chamber are -/// calculated as weighted mean of the single tube efficiencies, according to -/// -/// eff = (Sum_i 1/sigma_i^2 * eff_i)/(Sum_i 1/sigma_i^2) -/// sigma = Sqrt( 1/(Sum_i 1/sigma_i^2) ) -/// -/// \author Steffen.Kaiser@cern.ch -/// -/// \date 10.04.2007 - -//:::::::::::::::::: -//:: HEADER FILES :: -//:::::::::::::::::: - -// this -#include "MuonCalibStandAloneBase/NtupleCalibrationTool.h" -#include "AthenaBaseComps/AthAlgTool.h" -#include "GaudiKernel/ServiceHandle.h" -#include "MuonIdHelpers/IMuonIdHelperSvc.h" -#include "MuonReadoutGeometry/MuonDetectorManager.h" - -class RegionSelectionSvc; - -//root -class TFile; -class TNtuple; -class TH1F; -class TH1I; - -namespace MuonCalib { - -class QuasianalyticLineReconstruction; -class IIdToFixedIdTool; -class MuonCalibSegment; -class NtupleStationId; -class MuonCalibEvent; - - -class NtupleTubeEfficiencyTool : public AthAlgTool, virtual public NtupleCalibrationTool - { - - public: - // Constructors // - NtupleTubeEfficiencyTool(const std::string& t, const std::string& n, const IInterface* p); - - ~NtupleTubeEfficiencyTool()=default; - ///< Destructor - - /** tool initialize */ - StatusCode initialize(); - - /** tool finalize */ - StatusCode finalize(); - - StatusCode handleEvent(const MuonCalibEvent & event, int evnt_nr, const std::vector<MuonCalibSegment *> &segments, unsigned int position); - ///< analysis of the given segment of - ///< event eventnumber, event contains - ///< the raw hits - StatusCode analyseSegments(const std::vector<MuonCalibSegment *> & /*segemnts*/); - ///< analysis at the end of the data - ///< file - inline bool KeepSegments() const - { - return false; - } - private: - - ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; - - // MuonDetectorManager from the conditions store - SG::ReadCondHandleKey<MuonGM::MuonDetectorManager> m_DetectorManagerKey {this, "DetectorManagerKey", - "MuonDetectorManager", - "Key of input MuonDetectorManager condition data"}; - - const MuonCalib::IIdToFixedIdTool *m_id_tool; - - // ROOT file and analysis ntuples/trees // - TFile *m_tfile; // ROOT file - TFile *m_tfile_debug; // ROOT file for debug purposes - TNtuple *m_hit_ntuple; // hit ntuple - - std::string m_file_name; //root file name - double m_nb_hits; //minimum number of hits in segment - double m_road_width; //road width for pattern recognition - bool m_debug; //write debugging rootfile - double m_chi2_cut; //track chi2 cut; - bool m_exclude_layer; //exclude layer and refit for eff determination - - // calibration region// - //const NtupleStationId * m_cal_region; - - // line reconstruction // - QuasianalyticLineReconstruction *m_qfitter; - //! pointe rto region selectin service - ServiceHandle<RegionSelectionSvc> m_reg_sel_svc; - - // counter/numbers // - int m_nb_trigger; - int m_nb_multilayers; - int m_nb_layers; - int m_nb_tubes; - - // histograms // - TH1F *m_h_distance; - TH1I *m_h_nb_hit_tubes; - - std::vector< std::vector< std::vector<TH1F*> > > m_h_efficiency; - std::vector< std::vector< std::vector<TH1F*> > > m_h_fakerate; - - std::vector< std::vector<TH1F*> > m_h_tube_efficiency; - std::vector< std::vector<TH1F*> > m_h_tube_fakerate; - - std::vector< std::vector<TH1F*> > m_h_tube_entries_efficiency; - std::vector< std::vector<TH1F*> > m_h_tube_entries_fakerate; - - TH1F *m_h_layer_efficiency; - - TH1F *m_h_chamber_efficiency; - - TH1F *m_h_chi2; - - }; - -} - -#endif diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/MuonCalibStandAloneTools/NtupleWireCentricityTool.h b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/MuonCalibStandAloneTools/NtupleWireCentricityTool.h deleted file mode 100644 index e92b55bb778bed64249611dc480cd20f9f25bd1f..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/MuonCalibStandAloneTools/NtupleWireCentricityTool.h +++ /dev/null @@ -1,97 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef MUONCALIBSTANDALONETOOLS_NTUPLEWIRECENTRICITYTOOL_H -#define MUONCALIBSTANDALONETOOLS_NTUPLEWIRECENTRICITYTOOL_H - - -//c - c++ -#include "map" - -//root -class TFile; -class TH1F; -#include "TTree.h" - -//MuonCalibIdentifier -#include "MuonCalibIdentifier/MuonFixedId.h" - -//this -#include "MuonCalibStandAloneBase/NtupleCalibrationTool.h" -#include "AthenaBaseComps/AthAlgTool.h" -#include "GaudiKernel/ServiceHandle.h" - -class MdtCalibInputSvc; - -namespace MuonCalib { - -class MuonCalibHitBase; - -/** @class NtupleWireCentricityTool - Checks for the centricity of the anode wire - @author rauscher@cern.ch - - */ - -class NtupleWireCentricityTool : public AthAlgTool, virtual public NtupleCalibrationTool - { - public: -//============================================================================== - /** Tool Constructor*/ - NtupleWireCentricityTool(const std::string& t, const std::string& n, const IInterface* p); - /** tool initialization */ - StatusCode initialize(); - - /**analyse event - fill hits into specra*/ - StatusCode handleEvent(const MuonCalibEvent &/*event*/, int /*evnt_nr*/, const std::vector<MuonCalibSegment *> &segments, unsigned int position); - /** end of events analysis */ - StatusCode analyseSegments(const std::vector<MuonCalibSegment *> & /*segemnts*/); - /** we dont need to keep the segments*/ - inline bool KeepSegments() const - { - return false; - } - void setRegion(); -//============================================================================== - private: - //! minimum track track slope - job option - double m_min_track_slope; - //! width of region in the middle of the tube tobe analysed - job option - double m_region_width; - //! root file - TFile *p_root_file; - //! drift time spectra for left and right side of the wire - TH1F *p_dt_spec_left, *p_dt_spec_right; - //! drift time spectra for tracks above, and below the wire - TH1F *p_dt_spec_above, *p_dt_spec_below; - //! track slope - TH1F *p_track_slope; - //! track slope - TH1F *p_track_slope_cut; - //! x coordinate - TH1F *m_x_coordinate; - //! track radius - TH1F *m_track_radius; - //! calibration input service - ServiceHandle<MdtCalibInputSvc> m_calib_input_svc; - //! drift velocity for large radii - Double_t m_drift_velocity; - //! region id - Int_t m_station, m_eta, m_phi, m_hw_phi; - //!tree data - Double_t m_mean_track_slope; - Int_t m_n_hits; - -//============================================================================== - inline void process_hit(const MdtCalibHitBase * hit, const double & track_slope); - }; - - - - -} - - - -#endif diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/python/MuonCalibStandAloneToolsConfig.py b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/python/MuonCalibStandAloneToolsConfig.py deleted file mode 100644 index 979f3b50551056c0099a6e399ddb33c967e14975..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/python/MuonCalibStandAloneToolsConfig.py +++ /dev/null @@ -1,77 +0,0 @@ -# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration - -from __future__ import print_function - -from MuonCalibStandAloneTools.MuonCalibStandAloneToolsConf import * - -#list tools that do not need any reclaibration -NoRecalibration = [ "RunScan", "DbCheck", "MTT0", "ResidualVsTimeTool" ] -#list tools that needs the t0 revertetd -RevertT0 = [ "ClassicT0" ] -#list tools, that needs the t0 recalibrated -RecalibT0 = [ "Integration" ] -#list tools that need all recalibrated -RecalibAll = [ "CalibADC", "ClassicAutocal", "AnalyticAutocal", "CurvedAutocal", "SimpleResolution", "Chi2Resolution", "Efficiency", "Display", "RPCTiming", "ControlHistograms", "MDTChamberGeometryDetermination", "MdtDqa"] -#list tools for which rt-scaling is to be reverted -RevertRtScaling = [ "Integration", "MTT0" ] -#list tools for which rt-scaling is to be reapplied -ApplRtScaling = RecalibAll[:] - - -#algorithms for which no segment refit should be done, even if requested by user -NoSegmentRefit = [ "RunScan", "DbCheck", "MTT0", "ClassicT0", "Integration"] - -#algorithms fotr which the number of read segments should be limited -LimitSegmentsFor = ["ClassicAutocal", "AnalyticAutocal", "CurvedAutocal", "SimpleResolution"] - -#algorithms, that need validated t0 and rt -ValidatedT0 = [ "CalibADC", "Integration", "ClassicAutocal", "AnalyticAutocal", "CurvedAutocal", "SimpleResolution", "Chi2Resolution", "Efficiency", "Display", "RPCTiming", "ControlHistograms", "MDTChamberGeometryDetermination" , "DbCheck"] - -ValidatedRt = [ "CalibADC", "ControlHistograms", "DbCheck", "RPCTiming", "Display"] - -def CreateCalibTool(CalibrationTool): - if CalibrationTool=="MTT0": - return MuonCalib__NtupleMTT0Tool() - if CalibrationTool=="CalibADC": - return MuonCalib__NtupleCalibADCTool() - elif CalibrationTool=="ClassicT0": - return MuonCalib__NtupleClassicT0Tool() - elif CalibrationTool=="Integration": - return MuonCalib__NtupleIntegrationTool() - elif CalibrationTool=="AnalyticAutocal": - return MuonCalib__NtupleAnalyticAutocalibrationTool() - elif CalibrationTool=="ClassicAutocal": - return MuonCalib__NtupleClassicAutocalibrationTool() - elif CalibrationTool=="CurvedAutocal": - return MuonCalib__NtupleCurvedAutocalibrationTool() - elif CalibrationTool=="SimpleResolution": - return MuonCalib__NtupleSimpleResolutionTool() - elif CalibrationTool=="Chi2Resolution": - return MuonCalib__NtupleChi2ResolutionTool() - elif CalibrationTool=="Efficiency": - return MuonCalib__NtupleEfficiencyTool() - elif CalibrationTool=="RunScan": - return MuonCalib__NtupleRunScanTool() - elif CalibrationTool=="ControlHistograms": - CalibrationTool = MuonCalib__NtupleControlHistogramsTool() - #store gate keys - CalibrationTool.detectorStore = "DetectorStore" - CalibrationTool.MDTIdHelper = "MDTIDHELPER" - CalibrationTool.idToFixedIdToolType = "MuonCalib::IdToFixedIdTool" - CalibrationTool.idToFixedIdToolName = "MuonCalib_IdToFixedIdTool" - return CalibrationTool - elif CalibrationTool=="MDTChamberGeometryDetermination": - return MuonCalib__NtupleMDTChamberGeometryDeterminationTool() - elif CalibrationTool=="Display": - return MuonCalib__NtupleDisplayTool() - elif CalibrationTool=="WireCentricity": - return MuonCalib__NtupleWireCentricityTool() - elif CalibrationTool == "DbCheck": - return MuonCalib__NtupleDbCheckTool() - elif CalibrationTool == "RPCTiming": - return MuonCalib__NtupleRPCTimingTool() - elif CalibrationTool == "ResidualVsTimeTool": - return MuonCalib__NtupleResidualVsTimeTool() - else: - print ("WARNING: Unnknown tool name '" + CalibrationTool + "'!") - return None diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/share/Calib2_MdtDqa.py b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/share/Calib2_MdtDqa.py deleted file mode 100755 index fdea2468f440b3264452257f37a562636a84541e..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/share/Calib2_MdtDqa.py +++ /dev/null @@ -1,338 +0,0 @@ -### Setup Athena common flags -include ("AthenaCommon/AthenaCommonFlags.py") -include.block("AthenaCommon/AthenaCommonFlags.py") - -include( "IOVDbSvc/IOVRecExCommon.py" ) - -doMuonCalibAtlas=True - -from AthenaCommon.AppMgr import ServiceMgr -from MuonCalibStandAloneBase.MuonCalibStandAloneBaseConf import RegionSelectionSvc -RegionSelectionSvc = RegionSelectionSvc() -#RegionSelectionSvc.Region = "[B??,5] & !([BEE])" -#RegionSelectionSvc.Region = "[BML,4,1]" -RegionSelectionSvc.Region = "[B??]" -# RegionSelectionSvc.Region = "[BIR,6,1]" -RegionSelectionSvc.PrintList = True -ServiceMgr += RegionSelectionSvc -printfunc (RegionSelectionSvc) -##################################USER SETTINGS################################# - -#select calibration algoritm -# scan run for chambers RunScan -# t0-Fitters: ClassicT0, MTT0 -# create rt by integration Integration -# autocalibration ClassicAutocal, AnalyticAutocal -# resolution SimpleResolution, Chi2Resolution -# efficiency Efficiency -# MDT DQA MdtDqa -# event display Display -# rpc timing RpcTiming -# control histograms ControlHistograms -# MDT chamber geometry determination MDTChamberGeometryDetermination -CalibrationAlgorithm = "MdtDqa" - -#select calibration site for the database access NONE|ROMA -#for different sites, you will have to edit -#CalibNtupleAnalysisAlg/CalibNtupleAnalysisAlg2.py -CalibrationSite = "NONE" - -#if set to true no drift ties and drift radii will be recalculated -#use this for validaion -NoRecalculation = False - -####################DO NOT CHANGE THS ############################# -include( "CalibNtupleAnalysisAlg/CalibNtupleAnalysisAlg13.py" ) ## -include( "MdtCalibIOSvc/MdtCalibIOSvc.py" ) ## -include( "MuonCalibStandAloneTools/MuonCalibStandAloneTools.py" )## -#include( "RpcTimingTool/RpcTimingTool.py") ## -from MuonCalibStandAloneBase.MuonCalibStandAloneBaseConf import MuonCalib__CalibrationTeeIOTool -CalibrationTeeIOTool = MuonCalib__CalibrationTeeIOTool() ## -ToolSvc += CalibrationTeeIOTool ## -################################################################### - -#set to true if you want to insert the calibration constants to the database -MdtCalibOutputDbSvc.PostprocessCalibration = True - -# list on files to be read in -CalibNtupleAnalysisAlg.FileList = "file_list.txt" - -#first event to be read in -CalibNtupleAnalysisAlg.FirstEvent = 0 - -#Trigger bit selection -#CalibNtupleAnalysisAlg.RequestedTAV = [ 53 ] -#CalibNtupleAnalysisAlg.VetoedTAV = [ 54 ] -#CalibNtupleAnalysisAlg.RequestedTAP = [ 53 ] -#CalibNtupleAnalysisAlg.VetoedTAP = [ 53 ] - - -#last event to be read in -#CalibNtupleAnalysisAlg.LastEvent = 20000 - -#number of segments needed for calibration -#reading of tuple will stop when number of segments are read -#an error will occur when not enough segments are read -#CalibNtupleAnalysisAlg.NumberOfSegments = 2000 - -#select output location for file io -#CalibrationFileIOTool.outputLocation = "calib_alt" - -#use a flat resolution as default -#MdtCalibOutputDbSvc.FlatDefaultResolution=0.5 - -#reject segments which extend over more than one station -CalibNtupleAnalysisAlg.RejectMultistationTracks = True - -#use mdt raw tdc as drift time -#CalibNtupleAnalysisAlg.TakeMdtRaw = False - -#set to true if you -CalibNtupleAnalysisAlg.segmentsFromRawData = False - -#refit segments -CalibNtupleAnalysisAlg.RefitSegments = False -CalibNtupleAnalysisAlg.RefitRoadwidth = 2 -#refine t0 -CalibNtupleAnalysisAlg.RefineT0 = False -#limit the number of rawdata hits which are converted to one segemnt -CalibNtupleAnalysisAlg.MaxRawdataHits = 16 -CalibNtupleAnalysisAlg.RawdataAdcCut = 0 - -#Minimum number of hits per segment -CalibNtupleAnalysisAlg.MinSegmentHits=3 - -#Request hits in both multilayers -CalibNtupleAnalysisAlg.HitsInBothMultilayers = False - -#get b-field from service -CalibNtupleAnalysisAlg.UseMagFieldSvc = True - -#MdtCalibInputSvc.CalibrationInputTool = CalibrationFileIOTool - -#read calibration constants from this directory -if CalibrationAlgorithm != "MTT0" and CalibrationAlgorithm != "ClassicT0" and CalibrationAlgorithm != "RunScan" and not NoRecalculation: - MdtCalibInputSvc.CalibrationInputTool = CalibrationFileIOTool - - -#Set geometry tag -from AthenaCommon.AppMgr import ServiceMgr -from AtlasGeoModel import SetGeometryVersion, GeoModelInit - -GeoModelSvc = ServiceMgr.GeoModelSvc -#GeoModelSvc.AtlasVersion = "ATLAS-CSC-01-02-00" - - -#select output tool -CalibrationTeeIOTool.IOTool1=CalibrationFileIOTool -CalibrationTeeIOTool.IOTool2=CalibrationOracleFileIOTool -MdtCalibOutputDbSvc.OutputTool=CalibrationTeeIOTool - -#++++++++++++++++++Algoritm specific settings+++++++++++++++++++++++++++++++++++ - -#------------------------------------for run scan------------------------------- -if CalibrationAlgorithm == "RunScan": - CalibNtupleAnalysisAlg.RefitSegments = False - #minimum number of hits per fit - CalibrationTool.MinHits = 2000 - #maximum rate of bad hits per chamber - CalibrationTool.MaxBadFits = 0.05 - #if set to true ommit output for chambers which are not to be fitted - CalibrationTool.SuppressNofit = True - #san all chambers - RegionSelectionSvc.Region = "" -#------------------------------------for MT t0 fitter--------------------------- -if CalibrationAlgorithm == "MTT0" : - CalibNtupleAnalysisAlg.RefitSegments = False - CalibNtupleAnalysisAlg.RefineT0 = False - #add fitted function to histogram - CalibrationTool.AddFitFun = True - #create TDirectory contining some debugging graphs - CalibrationTool.DrawDebugGraphs = True - #range of histogram ind 25/32 bins - CalibrationTool.NumberOfNegativeBins = 1000 - CalibrationTool.NumberOfPositiveBins = 3000 - #Fit for group of tubes - # TUBE one spectrum per tube - # LAYER one spectrum per layer - # MULTILAYER one spectrum per multilayer - # CHAMBER one spectrum per chamber - # MEZZ_CARD one spectrum per mezzanine card - CalibrationTool.GroupBy = "MEZZ_CARD" - -#------------------------------for classic t0 fitter---------------------------- -if CalibrationAlgorithm == "ClassicT0": - CalibNtupleAnalysisAlg.RefitSegments = False - CalibNtupleAnalysisAlg.RefineT0 = False - #range and binning of adc spectrum - CalibrationTool.NAdcBins = 100 - CalibrationTool.MinAdc = 0.0 - CalibrationTool.MaxAdc = 300.0 - #range and binning of the time spectrum - CalibrationTool.NTimeBins = 1280 - CalibrationTool.TimeMin = 0.0 - CalibrationTool.TimeMax = 2000.0 - #switch on/off fitting of time spectrum - CalibrationTool.FitTimeSpectrum = True - #Minimum number of entries - CalibrationTool.MinEntries = 2000 - #? - CalibrationTool.InitParam = 1 - #maximum chi^2 - CalibrationTool.MaxChi2 = 10.0 - -#----------------------------for integration method----------------------------- -if CalibrationAlgorithm == "Integration": - CalibNtupleAnalysisAlg.RefineT0 = False - #mazimum drift time - CalibrationTool.TMaxInt = 710 - #set to true if close hits are stored in the ntuple - CalibrationTool.HaseCloseHits = False - #the inner radius of the drift tube - CalibrationTool.InnerTubeRadius = 14.6 - -# --------------------for classical autocalibration----------------------------- -if CalibrationAlgorithm == "ClassicAutocal" : - #range for the number of hits - CalibrationTool.MinimumNumberOfHits = 5 - CalibrationTool.MaximumNumberOfHits = 10 - #maximum number of iterations - CalibrationTool.NumberOfIterations = 10 - #chi2 cuts - ? - CalibrationTool.Chi2CutVec = [ 50, 40, 30, 20, 10, 10, 10, 5, 5, 5 ] - CalibrationTool.Chi2Cut = 10.0 - - -#-------------------for analytic autocalibration-------------------------------- -if CalibrationAlgorithm == "AnalyticAutocal": - #accuracy of the initial rt relation - CalibrationTool.Accuracy = 0.5 - #type of the correction function LEGENDRE|CHEBYSHEV|POLYGON - CalibrationTool.FunctionType = "LEGENDRE" - #order of the correction function - CalibrationTool.FunctionOrder = 15 - #use the full matrix - ? - CalibrationTool.FullMatrix = True - # fix minimum/maximum - CalibrationTool.FixMin = True # fix r(t0) - CalibrationTool.FixMax = False # do not fix r(tmax) - #maximum number of iterations - CalibrationTool.MaximumIterations = 15 - -#-----------------for simple resolution----------------------------------------- -#--select NumberOfSegments=10000 -#--switch on RefineT0 and use HistFitMethod for commissioning data -if CalibrationAlgorithm == "SimpleResolution": - CalibrationTool.CurvedFit = False #use a curved track fit (set it to true - #for data with magnetic field) -#selection criteria - CalibrationTool.RejectLow = 0.1 #default 0.1 - CalibrationTool.RejectTop = 0.40 #default 0.30 -#convergence - CalibrationTool.DeltaConv = 0.06 #default 0.05 - CalibrationTool.DiffMax = 0.007 #default 0.006 microns - CalibrationTool.MaximumIterations = 20 #default 20 -#Replace initial spatial resoluton with flat one (=0.3mm). Used for validation. - CalibrationTool.InitialFlatResolution = False -#Obtain resolution using histogram fitting. Usefull in case of 'noisy' residuals. - CalibrationTool.HistFitMethod = True -#Remove hits with large residuals (outliers). -# CalibrationTool.SuppressOutliers = True -# CalibrationTool.SuppressionLow = 0.17 -# CalibrationTool.SuppressionTop = 0.17 - CalibrationTool.OutputResolutionFunction = "spr_out.root" - - -#-----------------for RCP Timing------------------------------------------------ -if CalibrationAlgorithm == "RpcTiming": - CalibNtupleAnalysisAlg.RefineT0 = False - #analysis cue - defaults to "MODULE", "DOUBLET", "STATION", "PAIRS", "MEAN", "ALLSPEC" -# CalibrationTool.Cue = [ "MODULE" ] - #output and input file for timing constants - #NONE: do not read/ write file - #AUTO: filename is rpc_timing<run_nr>.txt - CalibrationTool.TimingInfile = "NONE" - CalibrationTool.TimingOutfile = "AUTO" - #automatically select all stations for this analysis - CalibNtupleAnalysisAlg.SelectStation = "ANY" - CalibNtupleAnalysisAlg.SelectEta = 0 - CalibNtupleAnalysisAlg.SelectPhi = -1 - -#-----------------for control histograms---------------------------------------- -if CalibrationAlgorithm == "ControlHistograms": - #refit segments with the given calibration - CalibrationTool.segmentRefit = True - #road width for segment refit in mm - CalibrationTool.roadWidth = 1 - #store gate keys - CalibrationTool.detectorStore = "DetectorStore" - CalibrationTool.MDTIdHelper = "MDTIDHELPER" - CalibrationTool.idToFixedIdToolType = "MuonCalib::IdToFixedIdTool" - CalibrationTool.idToFixedIdToolName = "MuonCalib_IdToFixedIdTool" - #name of the ROOT output file - CalibrationTool.ROOTFileName = "NtupleControlHistogramsTool.root" - -#-----------------for MDT chamber geometry determination------------------------ -if CalibrationAlgorithm == "MDTChamberGeometryDetermination": - #write out a ROOT control file - CalibrationTool.writeControlHistograms = True - #name of this ROOT file - CalibrationTool.ROOTFileName = "NtupleMDTChamberGeometryDeterminationTool.root" - #granularity: "TUBE", "LAYER", "MULTILAYER" - CalibrationTool.granularity = "MULTILAYER" - #reference multilayer (1 or 2) - CalibrationTool.referenceMultilayer = 1 - #road width for pattern recognition in mm - #(also used in the misalignment cuts) - CalibrationTool.roadWidth = 2.0 - #geometry file tag for the output of the initial and final geometry - CalibrationTool.geometryFileName = "MDTgeom" - #store gate keys - CalibrationTool.detectorStore = "DetectorStore" - CalibrationTool.MDTIdHelper = "MDTIDHELPER" - CalibrationTool.idToFixedIdToolType = "MuonCalib::IdToFixedIdTool" - CalibrationTool.idToFixedIdToolName = "MuonCalib_IdToFixedIdTool" - -#-----------------for efficiencies---------------------------------------------- -if CalibrationAlgorithm == "Efficiency": - CalibrationTool.nSegmentHits = 5 - CalibrationTool.roadWidth = 2.0 - CalibrationTool.fileName = "TubeEfficiencies" - CalibrationTool.Debug = False - CalibrationTool.Chi2Cut = 10 - CalibrationTool.excludeLayer = False - -#-----------------for MdtDqa ---------------------------------------------- -if CalibrationAlgorithm == "MdtDqa": - #----------- jobOptions for MdtDqaNtupleAnalysis : - CalibrationTool.MdtDqaFileName = "MdtDqa" - CalibrationTool.Verbose = False - CalibrationTool.FillHistos = True - CalibrationTool.doFinalize = True - CalibrationTool.doEfficiency = True - #----------- jobOptions for NtupleTubeEfficiency : - CalibrationTool.fileName = "TubeEfficiency" - CalibrationTool.nSegmentHits = 5 - CalibrationTool.roadWidth = 2.0 - CalibrationTool.Chi2Cut = 10 - CalibrationTool.excludeLayer = False - CalibrationTool.Debug = False - -#-----------------for display--------------------------------------------------- -if CalibrationAlgorithm == "Display": - CalibrationTool.nSegmentHits = 5 - CalibrationTool.roadWidth = 2.0 - CalibrationTool.adcCut = CalibNtupleAnalysisAlg.RawdataAdcCut - #CalibrationTool.displayEvent = 123 - #CalibrationTool.scaleDisplay = 0.5 - -#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++### Setup Athena common flags - - -printfunc (CalibrationTool) -printfunc (MdtCalibOutputDbSvc) -printfunc (ServiceMgr) -printfunc (MdtCalibInputSvc) -printfunc (AlgSequence()) -from ROOT import gROOT, TCanvas, TF1 - diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/share/spr_root.C b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/share/spr_root.C deleted file mode 100644 index fcfcb2e7d01b7edeecc4a1960bdd25138c0f9f90..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/share/spr_root.C +++ /dev/null @@ -1,81 +0,0 @@ -// ROOTSYS/tutorials -{ - const unsigned int SBIN=500, RESBIN=60, RBIN=30; - const float RESRANGE=6.0, SRANGE=0.75, RRANGE=15.0; - -gStyle->SetCanvasColor(10); -gStyle->SetPadColor(10); -gStyle->SetCanvasBorderMode(0); -gStyle->SetPadBorderMode(0); - -TCanvas *c2 = new TCanvas("c2","c2",1000,1000); -c2->Divide(2,3); -gStyle->SetOptStat(1); -gStyle->SetOptFit(1); - - TFile *top = 0; -// top = new TFile("run_26462/sprBOL5.root","read"); - top = new TFile("../spr_out.root","read"); - if(!top->IsOpen()) { - printf("no such file\n"); - return 0; - } - -// TTree *tree = 0; -// tree = (TTree *)top->Get("ntuple"); - - c2->cd(1); gPad->SetGrid(); - TH2F *residuals2 = 0; - residuals2 = (TH2F *)top->Get("m_residual2"); - residuals2->SetTitle("INITIAL RESIDUALS"); - residuals2->Draw(); - - - TH2F *sigma_track ; - sigma_track = (TH2F *)top->Get("m_sigma_track"); - - gStyle->SetOptStat(1); - c2->cd(3); gPad->SetGrid(); - - sigma_track->SetTitle("TRACK FIT ERROR"); - sigma_track->Draw(); - - c2->cd(4); gPad->SetGrid(); - TH2F *sigma_track_lim = (TH2F *)top->Get("m_sigma_track_lim"); - TProfile *tr_lim_prf = (TProfile *)sigma_track_lim->ProfileX(); - sigma_track_lim->SetTitle("TRACK FIT ERROR (SELECTED REGION)"); - sigma_track_lim->Draw(); - tr_lim_prf->SetLineColor(7); - tr_lim_prf->SetLineWidth(3); - tr_lim_prf->Draw("SAME"); - - c2->cd(5); gPad->SetGrid(); - TH2F *residuals = 0; - residuals = (TH2F *)top->Get("m_residual"); - residuals->SetTitle("RESIDUALS AFTER REFIT (hit excluded)"); - residuals->Draw(); - - c2->cd(6); gPad->SetGrid(); - TH2D *empty = new TH2D("empty","Resolution",1000, 0.0, RRANGE,1000, 0, SRANGE); - empty->SetTitle("RESOLUTION vs DRIFT RADIUS"); - empty->DrawCopy(); -// tree->Draw("SigmaDriftRadius:DriftRadius>>empty","","SAME P"); - TGraphErrors *sprgr_r=0; - sprgr_r = (TGraphErrors*)top->Get("sprgr_r"); - sprgr_r->SetMarkerStyle(20); - sprgr_r->SetMarkerSize(0.7); - sprgr_r->SetMarkerColor(6); - sprgr_r->Draw("P SAME"); - TF1 *sprf_r = 0; - sprf_r = (TF1*)top->Get("sprfun_r"); - sprf_r->SetLineColor(6); - sprf_r->DrawCopy("SAME"); -/* -TCanvas *c1 = new TCanvas("c1","c1",1024,800); - c1->cd(); gPad->SetGrid(); - TH2F *residuals2 = 0; - residuals2 = (TH2F *)top->Get("m_residual2"); - residuals2->SetTitle("RESIDUALS vs DRIFT RADIUS"); - residuals2->Draw(); -*/ -} diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/src/HitCounter.cxx b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/src/HitCounter.cxx deleted file mode 100644 index 5cd36156b70354f7251748af99efc769e88f252a..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/src/HitCounter.cxx +++ /dev/null @@ -1,200 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -#include "MuonCalibEventBase/MuonCalibSegment.h" -#include "MuonCalibEventBase/MdtCalibHitBase.h" -#include "MuonCalibStandAloneTools/HitCounter.h" -#include "GaudiKernel/MsgStream.h" -#include "AthenaKernel/getMessageSvc.h" - -#include "iostream" -#include "TDirectory.h" -#include "TH1.h" - -namespace MuonCalib { - -bool HitCounter::Initialize(const NtupleStationId &id) { - m_id=id; - if(id.NMultilayers() == -1) { - MsgStream log(Athena::getMessageSvc(),"HitCounter"); - log<<MSG::WARNING<<"HitCounter::Initialize:Geometry for idenifier not initialized!"<<endmsg; - return false; - } - m_per_chamber=0; - for(int i=0; i<id.NMultilayers(); i++) - { - m_per_ml[i]=0; - m_mezz_width[i]=8; - if(id.NLayers(i)==4) m_mezz_width[i]=6; - TubeId tid; - tid.ml=i; - for(tid.ly=0; tid.ly<id.NLayers(i); tid.ly++) - for(tid.tb=0; tid.tb<id.NTubes(i); tid.tb++) - { - m_per_tube[tid]=0; - } - MezzId mid; - mid.ml=i; - for(mid.mezz=0; mid.mezz<id.NTubes(i)/m_mezz_width[i]; mid.mezz++) - { - m_per_mezz[mid]=0; - } - } - m_n_dead_tubes=0; - m_n_dead_mezz=0; - m_n_dead_ml=0; - m_name = id.regionId(); - m_is_initialized=true; - m_wd = gDirectory->mkdir(m_name.c_str(), m_name.c_str()); - m_wd->cd(); - m_hits_per_segments = new TH1F("hits_per_segments", "", 433, -0.5, 432.5); - return true; - } - - -void HitCounter::ProcessSegment(const MuonCalibSegment & segment) - { - m_hits_per_segments->Fill(static_cast<Axis_t>(segment.hitsOnTrack())); - MuonCalibSegment::MdtHitCit it(segment.mdtHOTBegin()); - for(; it!=segment.mdtHOTEnd(); it++) - { - m_per_chamber++; - TubeId tid; - if (!(m_id==(*it)->identify())) continue; - NtupleStationId id((*it)->identify()); - tid.ml = (*it)->identify().mdtMultilayer()-1; - tid.ly = (*it)->identify().mdtTubeLayer()-1; - tid.tb = (*it)->identify().mdtTube()-1; - m_per_tube[tid]=m_per_tube[tid]+1; - MezzId mid; - mid.ml=tid.ml; - mid.mezz=tid.tb/m_mezz_width[tid.ml]; - m_per_mezz[mid]=m_per_mezz[mid]+1; - m_per_ml[tid.ml]=m_per_ml[tid.ml]+1; - } - } - -const std::string & HitCounter::FittingBy(int min_hits, double bad_fit_rate) - { - m_wd->cd(); -//try per tube - double n_bad(0.0), n_total(0.0); - Axis_t index(0.0); - TH1F *tubes = new TH1F("Tubes", "Tubes", m_per_tube.size(), -0.5, m_per_tube.size() - 0.5); - TH1F *tubes_index = new TH1F("tubes_index", "", 576, -0.5,575.5); - for (int i=1; i<=576; i++) - tubes_index->SetBinContent(i, -1.0); - m_fit_by_int = -1; - for(std::map<TubeId, int>::const_iterator it=m_per_tube.begin(); it!=m_per_tube.end(); it++) - { - if(it->second>0) - { - n_total++; - if(it->second<min_hits) n_bad++; - } - else - { - m_n_dead_tubes++; - } - tubes->Fill(index, it->second); - index++; - int fix_index = it->first.tb + 72*(it->first.ly) + 288*(it->first.ml); - tubes_index->SetBinContent(fix_index + 1, it->second); - } - tubes->SetEntries(m_per_chamber); - if(n_bad/n_total <= bad_fit_rate) - { - m_fit_by="TUBE"; - m_fit_by_int = 1; - } -//try per mezzanine - n_bad=0; n_total=0; - index=0.0; - TH1F *mezzanaines = new TH1F("Mezzanine", "Mezzanine", m_per_mezz.size(), -0.5, m_per_mezz.size() - 0.5); - for(std::map<MezzId, int>::const_iterator it=m_per_mezz.begin(); it!=m_per_mezz.end(); it++) - { - if(it->second > 0) - { - n_total++; - if(it->second<min_hits) n_bad++; - } - else - { - m_n_dead_mezz++; - } - mezzanaines->Fill(index, it->second); - index++; - } - mezzanaines->SetEntries(m_per_chamber); - if(n_bad/n_total <= bad_fit_rate && m_fit_by_int == -1) - { - m_fit_by="MEZZ_CARD"; - m_fit_by_int=2; - } -//try per multilayer - n_bad=0; n_total=0; - index=0.0; - TH1F *mls = new TH1F("Multilayers", "Mulitlayers", m_per_ml.size(), -0.5, m_per_ml.size() - 0.5); - for(std::map<int, int>::const_iterator it=m_per_ml.begin(); it!=m_per_ml.end(); it++) - { - if(it->second > 0) - { - n_total++; - if(it->second<min_hits) n_bad++; - } - else - { - m_n_dead_ml++; - } - mls->Fill(index, it->second); - index++; - } - mls->SetEntries(m_per_chamber); - if(n_bad/n_total <= bad_fit_rate && m_fit_by_int == -1) - { - m_fit_by="MULTILAYER"; - m_fit_by_int = 3; - } -// m_wd->Write(); -//try total - if(m_per_chamber>=min_hits &&m_fit_by_int == -1 ) - { - m_fit_by="CHAMBER"; - m_fit_by_int = 4; - return m_fit_by; - } - if(m_fit_by_int == -1) - { - m_fit_by="NOFIT"; - } - return m_fit_by; - } - -std::map<HitCounter::TubeId, HitCounter::DQInfo> HitCounter::InitialDQ(int noisy_tube_factor) const - { - double mean_nhits(0.0); - double n(0.0); - for(std::map<TubeId, int>::const_iterator it=m_per_tube.begin(); it!=m_per_tube.end(); it++) - { - if(it->second>0) - { - mean_nhits+=1.0/static_cast<double>(it->second); - n++; - } - } - mean_nhits=n/mean_nhits; - std::map<TubeId, DQInfo> ret; - for(std::map<TubeId, int>::const_iterator it=m_per_tube.begin(); it!=m_per_tube.end(); it++) - { - if(it->second == 0) - ret[it->first].SetDead(); - if(it->second > n * noisy_tube_factor * mean_nhits) - { - ret[it->first].SetNoisy(); - } - } - return ret; - } - -} diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/src/NtupleAnalyticAutocalibrationTool.cxx b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/src/NtupleAnalyticAutocalibrationTool.cxx deleted file mode 100644 index e1a438441789a688da881265ab3e41f7d9d99f4a..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/src/NtupleAnalyticAutocalibrationTool.cxx +++ /dev/null @@ -1,137 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -//MdtCalibRt -#include "MdtCalibRt/RtCalibrationAnalytic.h" -#include "MdtCalibRt/RtCalibrationOutput.h" - - -//MdtCalibData -#include "MdtCalibData/RtFullInfo.h" -//this -#include "MuonCalibStandAloneTools/NtupleAnalyticAutocalibrationTool.h" -#include "MuonCalibStandAloneBase/NtupleStationId.h" -#include "MdtCalibIOSvc/MdtCalibInputSvc.h" - -namespace MuonCalib { - -NtupleAnalyticAutocalibrationTool :: NtupleAnalyticAutocalibrationTool(const std::string& t, const std::string& n, const IInterface* p): - AthAlgTool(t, n, p), - m_autocalibration(NULL), - m_rt_accuracy(0.5), - m_func_type("LEGENDRE"), - m_order(15), - m_split(false), - m_full_matrix(true), - m_fix_min(true), - m_fix_max(false), - m_max_it(100), - m_force_mono(false), - m_control_histograms(false), - m_calib_input_svc("MdtCalibInputSvc", n), - m_failed(false), - m_smoothening(false), - m_parabolic_extrapolation(false) - { - declareInterface< NtupleCalibrationTool >(this); - declareProperty("Accuracy", m_rt_accuracy); - declareProperty("FunctionType", m_func_type); - declareProperty("FunctionOrder", m_order); - declareProperty("Split", m_split); - declareProperty("FullMatrix", m_full_matrix); - declareProperty("FixMin", m_fix_min); - declareProperty("FixMax", m_fix_max); - declareProperty("MaximumIterations", m_max_it); - declareProperty("ForceMonotonous", m_force_mono); - declareProperty("ControlHistograms", m_control_histograms); - declareProperty("ConventionalSmoothening", m_smoothening); - declareProperty("ParabolicExtrapolation", m_parabolic_extrapolation); - declareProperty("MdtCalibInputSvc", m_calib_input_svc); - } - -StatusCode NtupleAnalyticAutocalibrationTool :: initialize() - { - ATH_MSG_INFO( "initialize()" ); -//interpret functino type - if(m_func_type == "LEGENDRE") - { - m_func_type_num = 1; - } - else if (m_func_type == "CHEBYSHEV") - { - m_func_type_num = 2; - } - else if (m_func_type == "POLYGON") - { - m_func_type_num = 3; - } - else - { - ATH_MSG_FATAL( "Invalid function type '" << m_func_type << "'!" ); - return StatusCode ::FAILURE; - } - if(m_force_mono) - { - ATH_MSG_INFO( "Forcing monotonous rt-relation" ); - } -//get pointer to Calibration input service - ATH_CHECK( m_calib_input_svc.retrieve() ); - setRegion(); - return StatusCode :: SUCCESS; - } - -void NtupleAnalyticAutocalibrationTool :: setRegion() - { -//retrieve rt-relationid - const IRtRelation *rt_relation(m_calib_input_svc->GetRtRelation()); - if(rt_relation == NULL) - { - ATH_MSG_FATAL( "No rt-relation stored for this region!" ); - return; - } -//create objects - ATH_MSG_INFO( "Creating RtCalibrationAnalytic!" ); - m_autocalibration = new RtCalibrationAnalytic("RT", m_rt_accuracy, m_func_type_num, m_order, m_split, m_full_matrix, m_fix_min, m_fix_max, m_max_it, m_smoothening, m_parabolic_extrapolation); - ATH_MSG_INFO( "setInput!" ); - m_autocalibration->setInput(new RtCalibrationOutput(rt_relation, new RtFullInfo())); - if(m_force_mono) - { - m_autocalibration->forceMonotony(); - } - if(m_control_histograms) - { - m_autocalibration-> switch_on_control_histograms("AnalyticAutocalibration.root"); - } - } - -StatusCode NtupleAnalyticAutocalibrationTool :: analyseSegments(const std::vector<MuonCalibSegment *> & segemnts) - { - if(m_autocalibration == NULL) - { - ATH_MSG_FATAL( "Algorithm not created!" ); - m_failed=true; - return StatusCode::FAILURE; - } - if(m_autocalibration->analyseSegments(segemnts)==NULL) - { - m_autocalibration->switch_off_control_histograms(); - m_failed=true; - return StatusCode :: FAILURE; - } - m_autocalibration->switch_off_control_histograms(); - return StatusCode::SUCCESS; - } - -const IMdtCalibrationOutput * NtupleAnalyticAutocalibrationTool :: getResults() const - { - if(m_autocalibration == NULL) - { - ATH_MSG_FATAL( "Algorithm not created!" ); - return NULL; - } - if (m_failed) return NULL; - return m_autocalibration->getResults(); - } - -} diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/src/NtupleCalibADCTool.cxx b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/src/NtupleCalibADCTool.cxx deleted file mode 100644 index b17989955f06bd79f4f0b5b2ac0310a4ab9d3cab..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/src/NtupleCalibADCTool.cxx +++ /dev/null @@ -1,767 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -// 14.04.2009, AUTHOR: Zhen YAN -// Use for ADC parameters studies. -// -// 2009.09.02 v510 1) Study double hits ( second peak in TDC spectrum ) -// 2) Get the ADC normalize parameter and ADC correction factors -// 3) validate the Residual_vs_Radius by applying ADC correction -// -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - -//:::::::::::::::::::::::::::::::::::::::::::::::::::::::: -//:: IMPLEMENTATION OF THE METHODS DEFINED IN THE CLASS :: -//:: NtupleCalibADCTool :: -//:::::::::::::::::::::::::::::::::::::::::::::::::::::::: - -// standard C++ // -#include <iostream> -#include <fstream> - -// CLHEP // -#include "CLHEP/GenericFunctions/CumulativeChiSquare.hh" - -// MuonGeoModel // -#include "MuonReadoutGeometry/MdtReadoutElement.h" -#include "MuonReadoutGeometry/RpcReadoutElement.h" - -// MuonCalib // -#include "MdtCalibUtils/GlobalTimeFitter.h" -#include "MdtCalibFitters/DCSLFitter.h" -// -#include "MuonCalibStandAloneTools/NtupleCalibADCTool.h" -#include "MuonCalibEventBase/MuonCalibRawHitCollection.h" -#include "MuonCalibEventBase/MuonCalibRawMdtHit.h" -#include "MuonCalibEventBase/MuonCalibRawRpcHit.h" -#include "MuonCalibStl/ToString.h" -#include "MuonCalibIdentifier/MuonFixedId.h" -#include "MdtCalibT0/T0MTHistos.h" -#include "MuonCalibStandAloneBase/RegionSelectionSvc.h" - -#include "TF1.h" -#include "TTree.h" -#include "TProfile.h" -#include <stdio.h> - -//:::::::::::::::::::::::: -//:: NAMESPACE SETTINGS :: -//:::::::::::::::::::::::: -using namespace MuonCalib; - -//***************************************************************************** - -//::::::::::::::::: -//:: CONSTRUCTOR :: -//::::::::::::::::: - -NtupleCalibADCTool::NtupleCalibADCTool(const std::string & t, - const std::string & n, const IInterface * p) : AthAlgTool(t, n, p), - m_reg_sel_svc("RegionSelectionSvc", n), m_input_service("MdtCalibInputSvc", n) { - -///////////////// -// JOB OPTIONS // -///////////////// - - declareProperty("RegionSelectionSvc", m_reg_sel_svc); - declareProperty("MdtCalibInputSvc", m_input_service); - - m_refit_segments = true ; // by default refit the segments - declareProperty("segmentRefit", m_refit_segments); - - m_Recalc2ndCoordinate = false ; // check this flag to dicide if ADC_vs_DistanceToReadout can be use or not - declareProperty("Recalc2ndCoordinate", m_Recalc2ndCoordinate); - - m_curved_fits = false ; // by default straight refits of the segments - declareProperty("curvedSegmentRefit", m_curved_fits); - - m_time_out = 2.0; // by default 2 s time-out for pattern finding - declareProperty("timeOut", m_time_out); - - m_road_width = 3.0; // by default road width = 1 mm - declareProperty("roadWidth", m_road_width); - - m_MDT_ID_helper = std::string("MDTIDHELPER"); - declareProperty("MDTIdHelper", m_MDT_ID_helper); - - m_RPC_ID_helper = std::string("RPCIDHELPER"); - declareProperty("RPCIdHelper", m_RPC_ID_helper); - - m_idToFixedIdToolType = std::string("MuonCalib::IdToFixedIdTool"); - declareProperty("idToFixedIdToolType", m_idToFixedIdToolType); - - m_idToFixedIdToolName = std::string("MuonCalib_IdToFixedIdTool"); - declareProperty("idToFixedIdToolName", m_idToFixedIdToolName); - - m_ROOT_file_name = std::string("NtupleCalibADCTool.root"); - declareProperty("ROOTFileName", m_ROOT_file_name); - -///////////////////////////// -// RESET PRIVATE VARIABLES // -///////////////////////////// - m_MDT_adc_vs_radius.clear(); - m_MDT_adc_vs_pathD.clear(); - m_MDT_adc_vs_residual.clear(); - m_MDT_adc_vs_posX.clear(); - m_MDT_adc_vs_DistanceToSegmentTrack.clear(); - m_MDT_radius_vs_DistanceToSegmentTrack.clear(); - m_MDT_radius_vs_t.clear(); - m_MDT_segment_localangle_YZ.clear(); //local incidence angle XZ, YZ distributions of the segments - m_MDT_segment_localangle_XZ.clear(); - // mc_MDT_adc_vs_radius.clear(); - // m_MDT_adc_vs_tdc.clear(); - // m_MDT_adc_vs_t.clear(); - // m_MDT_posX_vs_radius.clear(); - // m_MDT_Revadc_vs_residual.clear(); - // m_MDT_radius_vs_residual.clear(); - // m_MDT_posX_vs_residual.clear(); - // m_MDT_pathD_vs_residual.clear(); - - // m_MDT_adc_vs_segment_localangle_YZ.clear(); //local incidence angle XZ, YZ distributions of the segments - // m_MDT_adc_vs_segment_localangle_XZ.clear(); - // m_MDT_adc_vs_segment_globalangle_YZ.clear(); //global incidence angle XZ, YZ distributions of the segments - // m_MDT_adc_vs_segment_globalangle_XZ.clear(); - - // v410 -for(int i=0;i<3;++i) -{ - m_MDT_residual_vs_radius[i].clear(); - m_MDT_segment_hits[i].clear(); - m_MDT_segment_chi2[i].clear(); -} - m_MDT_segment_delta_chi2.clear(); - // m_MDT_residual_vs_radius_NoRefit.clear(); - // m_MDT_residual_vs_radius_Refit.clear(); - // m_MDT_residual_vs_radius_TimeSlewing.clear(); - for(int i=0;i<15;++i) -{ - m_r_MDT_residual_vs_adc[i].clear(); -} - -/*for(int i=0;i<6;++i) - { -// a_MDT_adc_vs_posX[i].clear(); -// a_MDT_adc_vs_residual[i].clear(); - a_MDT_adc_vs_radius_XZ[i].clear(); - a_MDT_adc_vs_radius_YZ[i].clear(); - } -*/ -m_MDT_fhit_adc.clear(); -m_MDT_SiHitAdc.clear(); - - // Other parameter - m_nb_events = 0; - m_MdtIdHelper = 0; - m_RpcIdHelper = 0; - m_id_tool = 0; - - m_qfitter = new QuasianalyticLineReconstruction(); - m_cfitter = new CurvedPatRec(); - m_t0_refinement = new T0Refinement(); - - declareInterface< NtupleCalibrationTool >(this); - -} - -//***************************************************************************** - -//:::::::::::::::: -//:: DESTRUCTOR :: -//:::::::::::::::: - -NtupleCalibADCTool::~NtupleCalibADCTool(void) { - -} - -//***************************************************************************** - -//::::::::::::::::::::::: -//:: METHOD initialize :: -//::::::::::::::::::::::: - -StatusCode NtupleCalibADCTool::initialize(void) { - -/////////////// -// VARIABLES // -/////////////// - - -///////////// -// MESSAGE // -///////////// - - ATH_MSG_INFO( "Initializing tool..." ); - -//////////////////////////////////////////////////// -// STORE GATE AND GEOMODEL RELATED INITIALIZATION // -//////////////////////////////////////////////////// - -// MDT ID helper // - ATH_CHECK( detStore()->retrieve(m_MdtIdHelper, m_MDT_ID_helper) ); - -// RPC ID helper // - ATH_CHECK( detStore()->retrieve(m_RpcIdHelper, m_RPC_ID_helper) ); - -//retrieve detector manager from the conditions store - ATH_CHECK(m_DetectorManagerKey.initialize()); - -// muon fixed id tool // - ATH_CHECK( toolSvc()->retrieveTool(m_idToFixedIdToolType, - m_idToFixedIdToolName, m_id_tool) ); - -// calibration input service // - ATH_CHECK( m_input_service.retrieve() ); - -//////////////////////// -// OPEN THE ROOT FILE // -//////////////////////// - - m_tfile = new TFile(m_ROOT_file_name.c_str(), "RECREATE"); - -///////////////////////////////// -// SET UP STRAIGHT-LINE FITTER // -///////////////////////////////// - - m_qfitter->setRoadWidth(m_road_width); - m_qfitter->switchOnRefit(); - m_qfitter->setTimeOut(m_time_out); - m_cfitter->setRoadWidth(m_road_width); - m_cfitter->setTimeOut(m_time_out); - -//get region selection service - ATH_CHECK( m_reg_sel_svc.retrieve() ); - - return StatusCode::SUCCESS; - -} - -//***************************************************************************** - -//::::::::::::::::::::: -//:: METHOD finalize :: -//::::::::::::::::::::: - -StatusCode NtupleCalibADCTool::finalize(void) { - -/////////////// -// VARIABLES // -/////////////// - - -///////////// -// MESSAGE // -///////////// - - ATH_MSG_INFO( "Finalizing tool..." ); -//the summary tree creation crashes if the refit option is not set -- To be fixed! - if (!m_refit_segments) - { - m_tfile->Write(); - - return StatusCode::SUCCESS; - } - -/////////////////////////////// -// Postprocess histogramms // -/////////////////////////////// - m_tfile->cd(); -//station id - -///////////////////////// -// WRITE THE ROOT FILE // -///////////////////////// - - m_tfile->Write(); - - return StatusCode::SUCCESS; - -} - -//***************************************************************************** - -//:::::::::::::::::::::::: -//:: METHOD handleEvent :: -//:::::::::::::::::::::::: - -StatusCode NtupleCalibADCTool::handleEvent( - const MuonCalibEvent & event, - int /*evnt_nb*/, - const std::vector<MuonCalibSegment *> & segments, - unsigned int position) { - -/////////////// -// VARIABLES // -/////////////// -0.00205705 for BML4A05 only -/* double cor[15] = {0,-0.00354407,-0.00306112,-0.00193288,-0.00109093,-0.000831173,-0.00066971,-0.000611956,-0.000610348,-0.00048119,-0.00045121,-0.000412511,-0.000346831,-0.00027503,0.000124506 }; - double low_bin[15] = {48.8971,53.4205,63.7885,74.7095,79.9586,81.4944,81.2939,79.9401,79.2682,77.0589,75.6614,74.56,73.1008,71.8534,64.8691 }; - double high_bin[15] = {241.69,242.37,260.751,270.535,275.781,276.369,272.933,269.351,261.99,258.231,251.039,242.985,235.595,226.821,219.6 }; - double ADC0[15]={-49.9848,131.757,168.377,180.345,168.991,174.58,209.455,230.637,214.304,200.673,200.648,199.065,163.635,161.754,89.7234 }; -*/ -double cor[15] = {-0.00427636,-0.00594769,-0.00331729,-0.0026683,-0.00112401,-0.000616045,-0.000536907,-0.000297823,-4.62138e-005,0.000156364,0.000120936,-7.1578e-005,0.000259177,-0.000340251,5.11028e-005 } ; -double ADC0[15] = {73.7515,110.755,103.724,122.37,136.487,195.278,221.442,296.233,1432.72,-166.977,-182.321,577.875,-23.6606,195.662,-187.745 } ; -// ADCmean[15] = {125.011,135.959,149.799,156.222,159.417,158.154,156.026,153.048,149.845,146.659,142.953,138.728,134.282,130.304,120.176 } ; -double high_bin[15] = {197.886,212.367,226.685,232.567,236.377,233.817,230.829,225.595,221.07,216.012,210.1,203.221,195.506,188.455,178.88 } ; -double low_bin[15] = {52.1363,59.5508,72.9139,79.8775,82.4582,82.4905,81.2233,80.5007,78.6199,77.3049,75.8061,74.2353,73.0578,72.1533,61.4726 } ; - -// const MuonCalibRawHitCollection *raw_hits(event.rawHitCollection()); -// const MuonCalibSegment *rpcHits(event.rpcHitCollection()); -// unsigned int ml, ly, tb; // multilayer, layer, tube/ -// unsigned int ndof; // number of degrees of freedom of the segment fit -// int strip, strip2; // rpc strip -// double r, d; // drift radius and track distance from the wire -// int mdt_close_layer, mdt_close_multi; - IMdtPatRecFitter *segment_fitter(0); // pointer to the segment fitter - IMdtPatRecFitter *segment_fitter2(0); // pointer to the segment fitter - if (m_curved_fits) { - segment_fitter = m_cfitter; - segment_fitter2 = m_cfitter; - } else { - segment_fitter = m_qfitter; - segment_fitter2 = m_qfitter; - } - // DCSLFitter * betterFitter = new DCSLFitter(); -/* GlobalTimeFitter * GTFitter = new GlobalTimeFitter(betterFitter) ; - if ( m_refit_segments ) { - IRtRelation * defaultRt = GTFitter->getDefaultRtRelation() ; - GTFitter->setRtRelation(defaultRt) ; - } -*/ - -//////////////////// -// RESET COUNTERS // -//////////////////// -//setEvent(event); -// cor[0] = {0} ;-0.00205705 - - - -////////////////////////////// -// FILL RAW DATA HISTOGRAMS // -////////////////////////////// -// -// -// -//Loop RAW data -> hitselection -> udpate segment by ADC correction factor -//Increase hitsOnTracks? -//v500 will -// - -/////////////////////////////// -// Validate the Segment hits // -/////////////////////////////// - -// loop over the raw hits // - for (unsigned int k=position; k<segments.size(); k++) { - - // get the first hit to check if it is in the calibration region // - if(!m_reg_sel_svc->isInRegion(segments[k]->mdtHOT()[0] ->identify())) continue; - NtupleStationId station_identifier((segments[k]->mdtHOT()[0])->identify()); - station_identifier.SetMultilayer(0); - - createMaps((segments[k]->mdtHOT()[0])->identify()); -//const MdtStationT0Container *t0(m_input_service->GetT0(station_identifier)); -// const IRtRelation *rt=m_input_service->GetRtRelation(station_identifier); -// rt->t_from_r(r); - -//////############################################################################################## -///////// step 1 check the MDT with - -// segments selection -// -// 1) segment hits in same chamber -// 2) segment hits no double hits -// bool NoDoubleHitsSegments = true; -// int Event_counter =0; -// int Segment_counter =0; - - const MuonCalibRawHitCollection *raw_hits(event.rawHitCollection()); - // const MuonCalibSegment *rpcHits(event.rpcHitCollection()); - int ml, ly, tb; // multilayer, layer, tube - - for (MuonCalibRawHitCollection::MuonCalibRawMdtHitVecCit it=raw_hits->rawMdtHitCollectionBegin(); - it!=raw_hits->rawMdtHitCollectionEnd(); ++it) { - - // get the raw hit and check whether it is in the calibration region // - MuonCalibRawMdtHit *hit(*it); - - if(!m_reg_sel_svc->isInRegion(hit->identify())) continue; - ml = (hit->identify()).mdtMultilayer(); - ly = (hit->identify()).mdtTubeLayerIndex()+1; - tb = (hit->identify()).mdtTubeIndex(); - // tdc0 = (hit->.tdcCount(); - //second loop - //int counter = 0; - // while(it!=raw_hits->rawMdtHitCollectionEnd()) { - for (MuonCalibRawHitCollection::MuonCalibRawMdtHitVecCit it2=raw_hits->rawMdtHitCollectionBegin(); - it2!=raw_hits->rawMdtHitCollectionEnd(); ++it2) { - MuonCalibRawMdtHit *hit2(*it2); - if(!m_reg_sel_svc->isInRegion(hit2->identify())) continue; - bool same_ml(ml==(hit2->identify()).mdtMultilayer()); - bool same_ly(ly==(hit2->identify()).mdtTubeLayerIndex()); - bool same_tb(tb==(hit2->identify()).mdtTubeIndex()); - bool sameTubeHit=same_ml && same_ly && same_tb; - if(!sameTubeHit) continue; - if(hit2->tdcCount()==hit->tdcCount()) continue; - if(!((hit2->adcCount()>50)&&(hit->adcCount()>50))) continue; - if(hit2->tdcCount()>hit->tdcCount()) { - m_MDT_fhit_adc[station_identifier]->Fill(hit->tdcCount(),hit->adcCount(),1.0); - m_MDT_SiHitAdc[station_identifier]->Fill(hit2->tdcCount(),hit2->adcCount(),1.0); - } - else { - m_MDT_fhit_adc[station_identifier]->Fill(hit2->tdcCount(),hit2->adcCount(),1.0); - m_MDT_SiHitAdc[station_identifier]->Fill(hit->tdcCount(),hit->adcCount(),1.0); - } - } - } //end raw Mdthit loop - - -//////############################################################################################## -// Selection segment - - if (m_refit_segments) { - Double_t slopeYZ=57.30*std::atan((segments[k]->direction()).y()/(segments[k]->direction()).z()); - Double_t slopeXZ=57.30*std::atan((segments[k]->direction()).x()/(segments[k]->direction()).z()); - m_MDT_segment_localangle_YZ[station_identifier]->Fill(slopeYZ,1.0); - m_MDT_segment_localangle_XZ[station_identifier]->Fill(slopeXZ,1.0); - - for (unsigned int l=0; l<segment_fitter->numberOfTrackHits();l++) { - Int_t adcCount = (segment_fitter->trackHits())[l]->adcCount(); - if(adcCount<50) continue; - Double_t r = (segment_fitter->trackHits())[l]->driftRadius(); - Double_t d = (segment_fitter->trackHits())[l]->signedDistanceToTrack(); - Double_t t = (segment_fitter->trackHits())[l]->driftTime() ; - Double_t distX=(segment_fitter->trackHits())[l]->distanceToReadout(); - if((std::abs(d)>15.0)||(std::abs(r)>15.0)) continue; - m_MDT_radius_vs_DistanceToSegmentTrack[station_identifier]->Fill(d,r,1.0); - m_MDT_radius_vs_t[station_identifier]->Fill(t, r,1.0); - m_MDT_adc_vs_radius[station_identifier]->Fill(r, adcCount,1.0); - m_MDT_adc_vs_DistanceToSegmentTrack[station_identifier]->Fill(d, adcCount,1.0); - Double_t resi = std::abs(r)-std::abs(d); - m_MDT_adc_vs_residual[station_identifier]->Fill(resi, adcCount,1.0); - if((m_Recalc2ndCoordinate)&&(std::abs(slopeXZ)<80.0)) { - m_MDT_adc_vs_posX[station_identifier]->Fill(distX, adcCount,1.0); - Double_t lenD=2.0*std::sqrt(225.0-d*d)/std::cos(std::abs(slopeXZ)/57.30); - m_MDT_adc_vs_pathD[station_identifier]->Fill(lenD, adcCount,1.0); - - } - } - } - else { // aux line for no refit segment - Double_t slopeYZ=57.30*std::atan((segments[k]->direction()).y()/(segments[k]->direction()).z()); - Double_t slopeXZ=57.30*std::atan((segments[k]->direction()).x()/(segments[k]->direction()).z()); - m_MDT_segment_localangle_YZ[station_identifier]->Fill(slopeYZ,1.0); - m_MDT_segment_localangle_XZ[station_identifier]->Fill(slopeXZ,1.0); - - } - -//////############################################################################################## - -// Loop all hits in segments[k] and update the driftRadius by ADC correction v500 -// only for the segments-chi2() < 5.0 segments -// Refit one more time to check if refit did same function -// next hold a vector for compare the residual and radius - if(segments[k]->chi2() > 5.0) continue; - if(segments[k]->hitsOnTrack() < 5 ) continue; - m_MDT_segment_hits[0][station_identifier]->Fill(segments[k]->hitsOnTrack(),1.0); - m_MDT_segment_chi2[0][station_identifier]->Fill(segments[k]->chi2(),1.0); - for (unsigned int l=0; l<segment_fitter->numberOfTrackHits();l++) { - Double_t r0 = (segment_fitter->trackHits())[l]->driftRadius(); - Double_t d0 = (segment_fitter->trackHits())[l]->signedDistanceToTrack(); - m_MDT_residual_vs_radius[0][station_identifier]->Fill(r0,std::abs(r0)-std::abs(d0),1.0); - } - - if( !(segment_fitter->fit(*(segments[k])) ) ) ATH_MSG_WARNING( "Segment fit failed. Just going on." ); - Double_t oldchi2 = segments[k]->chi2() ; - m_MDT_segment_hits[1][station_identifier]->Fill(segment_fitter->numberOfTrackHits(), 1.0); - m_MDT_segment_chi2[1][station_identifier]->Fill(segments[k]->chi2(),1.0); - for (unsigned int l=0; l<segment_fitter->numberOfTrackHits();l++) { - Double_t r1 = (segment_fitter->trackHits())[l]->driftRadius(); - Double_t d1 = (segment_fitter->trackHits())[l]->signedDistanceToTrack(); - m_MDT_residual_vs_radius[1][station_identifier]->Fill(r1,std::abs(r1)-std::abs(d1),1.0); - Int_t radius=static_cast<int>(std::abs(r1)); - if(radius>14) radius = 14; - Int_t adcCount = (segment_fitter->trackHits())[l]->adcCount(); - m_r_MDT_residual_vs_adc[radius][station_identifier]->Fill(adcCount,std::abs(r1)-std::abs(d1),1.0); // remove the delta ray - } - - /////////////////////////////////////////////////////////////////////////////////////////////////////////// - bool goodSeg = true; - for (unsigned int l=0; l<segments[k]->hitsOnTrack();l++) { - Double_t oldr=(segments[k]->mdtHOT())[l]->driftRadius(); - Double_t oldrsigma=(segments[k]->mdtHOT())[l]->sigmaDriftRadius(); - Int_t binr=static_cast<int>(oldr); - if(binr>14) break; - if((((segments[k]->mdtHOT())[l]->adcCount())>low_bin[binr])&&(((segments[k]->mdtHOT())[l]->adcCount())<high_bin[binr])) { - // if ADCcount inside the range, update the Radius by ADC value - Double_t dr=(((segments[k]->mdtHOT())[l]->adcCount())-ADC0[binr])*cor[binr]; - Double_t newr=oldr-dr; - if(newr<0.0) newr = 0.0; - (segments[k]->mdtHOT())[l]->setDriftRadius(newr, oldrsigma); - } - - } - - if(goodSeg && (segment_fitter2->fit(*(segments[k])))) { -// 2nd Segment Refit, see the residual improvement - m_MDT_segment_hits[2][station_identifier]->Fill(segment_fitter2->numberOfTrackHits(), 1.0); - Double_t newchi2 = segments[k]->chi2() ; - m_MDT_segment_chi2[2][station_identifier]->Fill(newchi2,1.0); - m_MDT_segment_delta_chi2[station_identifier]->Fill(oldchi2 - newchi2 , 1.0); - for (unsigned int l=0; l<segment_fitter2->numberOfTrackHits();l++) { - Double_t r2 = (segment_fitter2->trackHits())[l]->driftRadius(); - Double_t d2 = (segment_fitter2->trackHits())[l]->signedDistanceToTrack(); - m_MDT_residual_vs_radius[2][station_identifier]->Fill(r2,std::abs(r2)-std::abs(d2),1.0); - } - } - - - } //end of segment loop - - return StatusCode::SUCCESS; - -} - - - - - - -//***************************************************************************** - -// statusCode NtupleCalibADCTool::analyseSegments(const std::vector<MuonCalibSegment *> & /*segments*/) { -// v600 start to analysis plot and output ADC coefficiency factor -// -// -// -// -// -// -//::::::::::::::::::::::::: -//:: METHOD KeepSegments :: -//::::::::::::::::::::::::: - -bool NtupleCalibADCTool::KeepSegments(void) const { - - return false; - -} - -//***************************************************************************** - -//::::::::::::::::::::::: -//:: METHOD createMaps :: -//::::::::::::::::::::::: - -void NtupleCalibADCTool::createMaps(const MuonFixedId & id) { - -/////////////// -// VARIABLES // -/////////////// - - NtupleStationId station_identifier(id); - station_identifier.SetMultilayer(0); - std::map<NtupleStationId, unsigned int>::iterator end_it = - m_nb_ml.end(); - -//////////////////////////////////// -// FIND THE IDENTIFIER IN m_nb_ml // -//////////////////////////////////// - - if (m_nb_ml.find(station_identifier)!=end_it) { - return; - } - -/////////////////////////////////////////// -// GET THE GEOMETRY OF THE GIVEN CHAMBER // -/////////////////////////////////////////// - - SG::ReadCondHandle<MuonGM::MuonDetectorManager> DetectorManagerHandle{m_DetectorManagerKey}; - const MuonGM::MuonDetectorManager* MuonDetMgr = DetectorManagerHandle.cptr(); - if(MuonDetMgr==nullptr){ - ATH_MSG_ERROR("Null pointer to the read MuonDetectorManager conditions object"); - return; - } - - Identifier station_id = m_id_tool->fixedIdToId(id); - const MuonGM::MdtReadoutElement *MdtRoEl =MuonDetMgr->getMdtReadoutElement(m_MdtIdHelper->channelID(station_id,1,1,1)); - - m_nb_ml[station_identifier] = m_MdtIdHelper->numberOfMultilayers(station_id); - m_nb_ly[station_identifier] = MdtRoEl->getNLayers(); - m_nb_tb[station_identifier] = MdtRoEl->getNtubesperlayer(); - - -/////////////////////////////// -// CREATE THE REMAINING MAPS // -/////////////////////////////// - -// counter // - -// histograms // - ToString tostring; - std::string file_dir(id.stationNumberToFixedStationString(id.stationName()) - +"_"+tostring(id.phi())+"_"+tostring(id.eta())); - std::string tempside=(id.eta()>0)?"A":"C"; - std::string tempeta=std::to_string(std::abs(id.eta())); - int tempphi=(file_dir.substr(2,1)=="L")?(2*(id.phi())-1):(2*(id.phi())); - char sphi[4]; - snprintf(sphi,sizeof(sphi),"%02d",tempphi); - std::string chambername=file_dir.substr(0,3)+tempeta+tempside+sphi; - - m_tfile->mkdir(file_dir.c_str()); - m_tfile->cd(file_dir.c_str()); - - - //v2.0 move const char* category[5]={"CalibSeg","Muonboy","Moore","Mean140","CalibSegCalibADC"}; - char radc[100],/*mc_radc[100],*//*m_tadc[100],*//*m_tdcadc[100],*/resiadc[100],rt[100],/*m_posXresi[100],*/pathadc[100],posXadc[100],/*m_Revadcresi[100],*/resir[100],/*m_pathresi[100],*//*m_posXr[100],*/dadc[100],dr[200]; - // char m_hit_dis[100],m_localXZ[100],m_localYZ[100],m_globalXZ[100],m_globalYZ[100]; - char XZ[100],YZ[100]; - sprintf(pathadc,"%.7s_ADC_vs_PathLength",chambername.c_str()); - sprintf(resiadc,"%.7s_ADC_vs_Residual",chambername.c_str()); - sprintf(radc,"%.7s_ADC_vs_Radius",chambername.c_str()); - sprintf(dadc,"%.7s_ADC_vs_DistanceToSegmentTrack",chambername.c_str()); - sprintf(dr,"%.7s_Radius_vs_DistanceToSegmentTrack",chambername.c_str()); - sprintf(posXadc,"%.7s_ADC_vs_DistanceToReadout",chambername.c_str()); - sprintf(resir,"%.7s_Residual_vs_Radius",chambername.c_str()); - sprintf(rt,"%.7s_Radius_vs_DriftTime",chambername.c_str()); - m_MDT_adc_vs_pathD[station_identifier]= new TH2F(pathadc,pathadc,1000,0, 100, 350, 50, 400); - m_MDT_adc_vs_pathD[station_identifier]->SetXTitle("PathLength(mm)"); - m_MDT_adc_vs_pathD[station_identifier]->SetYTitle("ADC count(ns)"); - m_MDT_adc_vs_posX[station_identifier]= new TH2F(posXadc,posXadc,600,0, 6000, 350, 50, 400); - m_MDT_adc_vs_posX[station_identifier]->SetXTitle("DistanceToReadout(mm)"); - m_MDT_adc_vs_posX[station_identifier]->SetYTitle("ADC count(ns)"); - m_MDT_adc_vs_DistanceToSegmentTrack[station_identifier]= new TH2F(dadc,dadc,300,-15,15,350, 50, 400); - m_MDT_adc_vs_DistanceToSegmentTrack[station_identifier]->SetXTitle("DistanceToSegmentTrack(mm)"); - m_MDT_adc_vs_DistanceToSegmentTrack[station_identifier]->SetYTitle("ADC count(ns)"); - m_MDT_adc_vs_radius[station_identifier]= new TH2F(radc,radc,150,0, 15, 350, 50, 400); - m_MDT_adc_vs_radius[station_identifier]->SetXTitle("Radius(mm)"); - m_MDT_adc_vs_radius[station_identifier]->SetYTitle("ADC count(ns)"); - m_MDT_adc_vs_residual[station_identifier]= new TH2F(resiadc,resiadc,300,-15, 15, 350, 50, 400); - m_MDT_adc_vs_residual[station_identifier]->SetXTitle("Residual(mm)"); - m_MDT_adc_vs_residual[station_identifier]->SetYTitle("ADC count(ns)"); - - m_MDT_radius_vs_DistanceToSegmentTrack[station_identifier]= new TH2F(dr,dr,300,-15,15,300,-15,15); - m_MDT_radius_vs_DistanceToSegmentTrack[station_identifier]->SetXTitle("DistanceToSegmentTrack(mm)"); - m_MDT_radius_vs_DistanceToSegmentTrack[station_identifier]->SetYTitle("Radius(mm)"); - m_MDT_radius_vs_t[station_identifier]= new TH2F(rt,rt,1000, -100, 900, 150,0,15); - m_MDT_radius_vs_t[station_identifier]->SetYTitle("Radius(mm)"); - m_MDT_radius_vs_t[station_identifier]->SetXTitle("DriftTime(ns)"); - sprintf(XZ,"%.7s_LocalAngle_XZ",chambername.c_str()); - sprintf(YZ,"%.7s_LocalAngle_YZ",chambername.c_str()); - m_MDT_segment_localangle_YZ[station_identifier] =new TH1F(YZ,YZ,180, -90, 90); - m_MDT_segment_localangle_YZ[station_identifier]->SetXTitle("Incidence Angle at local YZ plane(degrees)"); - m_MDT_segment_localangle_XZ[station_identifier] =new TH1F(XZ,XZ,180, -90, 90); - m_MDT_segment_localangle_XZ[station_identifier]->SetXTitle("Incidence Angle at local XZ plane(degrees)"); - // 1D plot - /* - mc_MDT_adc_vs_radius[station_identifier]= new TH2F(mc_radc,mc_radc,1500,0, 15, 350, 50, 400); - mc_MDT_adc_vs_radius[station_identifier]->SetXTitle("Radius(mm)"); - mc_MDT_adc_vs_radius[station_identifier]->SetYTitle("CalibADC count(ns)"); - sprintf(m_localXZ,"%.7s_ADC_vs_LocalAngle_XZ",chambername.c_str()); - sprintf(m_localYZ,"%.7s_ADC_vs_LocalAngle_YZ",chambername.c_str()); - sprintf(m_globalXZ,"%.7s_ADC_vs_GlobalAngle_XZ",chambername.c_str()); - sprintf(m_globalYZ,"%.7s_ADC_vs_GlobalAngle_YZ",chambername.c_str()); - m_MDT_adc_vs_segment_localangle_YZ[station_identifier] =new TH2F(m_localYZ,m_localYZ,1800, -90, 90,350,50,400); - m_MDT_adc_vs_segment_localangle_YZ[station_identifier]->SetXTitle("Incidence Angle at local YZ plane(degrees)"); - m_MDT_adc_vs_segment_localangle_YZ[station_identifier]->SetYTitle("ADC count(ns)"); - m_MDT_adc_vs_segment_localangle_XZ[station_identifier] =new TH2F(m_localXZ,m_localXZ,1800, -90, 90,350,50,400); - m_MDT_adc_vs_segment_localangle_XZ[station_identifier]->SetXTitle("Incidence Angle at local XZ plane(degrees)"); - m_MDT_adc_vs_segment_localangle_XZ[station_identifier]->SetYTitle("ADC count(ns)"); - m_MDT_adc_vs_segment_globalangle_YZ[station_identifier] =new TH2F(m_globalYZ,m_globalYZ,1800, -90, 90,350,50,400); - m_MDT_adc_vs_segment_globalangle_YZ[station_identifier]->SetXTitle("Incidence Angle at global YZ plane(degrees)"); - m_MDT_adc_vs_segment_globalangle_YZ[station_identifier]->SetYTitle("ADC count(ns)"); - m_MDT_adc_vs_segment_globalangle_XZ[station_identifier] =new TH2F(m_globalXZ,m_globalXZ,1800, -90, 90,350,50,400); - m_MDT_adc_vs_segment_globalangle_XZ[station_identifier]->SetXTitle("Incidence Angle at global XZ plane(degrees)"); - m_MDT_adc_vs_segment_globalangle_YZ[station_identifier]->SetYTitle("ADC count(ns)"); - - sprintf(XZ,"%.7s_LocalAngle_XZ",chambername.c_str()); - sprintf(YZ,"%.7s_LocalAngle_YZ",chambername.c_str()); - m_MDT_segment_localangle_YZ[station_identifier] =new TH1F(YZ,YZ,1800, -90, 90); - m_MDT_segment_localangle_YZ[station_identifier]->SetXTitle("Incidence Angle at local YZ plane(degrees)"); - m_MDT_segment_localangle_XZ[station_identifier] =new TH1F(XZ,XZ,1800, -90, 90); - m_MDT_segment_localangle_XZ[station_identifier]->SetXTitle("Incidence Angle at local XZ plane(degrees)"); - - sprintf(m_pathresi,"%.7s_Residual_vs_PathLength",chambername.c_str()); - sprintf(radc,"%.7s_ADC_vs_Radius",chambername.c_str()); - sprintf(dadc,"%.7s_ADC_vs_DistanceToSegmentTrack",chambername.c_str()); - sprintf(posXadc,"%.7s_ADC_vs_DistanceToReadout",chambername.c_str()); - - m_MDT_Revadc_vs_residual[station_identifier]= new TH2F(m_Revadcresi,m_Revadcresi,200,0, 20, 3000,-15, 15); - m_MDT_Revadc_vs_residual[station_identifier]->SetYTitle("Residual(mm)"); - m_MDT_Revadc_vs_residual[station_identifier]->SetXTitle("Reverse ADC count(1/ns)"); - m_MDT_radius_vs_residual[station_identifier]= new TH2F(resir,resir, 1500,0,15,3000,-15, 15); - m_MDT_radius_vs_residual[station_identifier]->SetXTitle("Radius(mm)"); - m_MDT_radius_vs_residual[station_identifier]->SetYTitle("Residual(mm)"); - m_MDT_pathD_vs_residual[station_identifier]= new TH2F(m_pathresi,m_pathresi,2000,0, 100, 3000, -15, 15); - m_MDT_pathD_vs_residual[station_identifier]->SetXTitle("PathLength(mm)"); - m_MDT_pathD_vs_residual[station_identifier]->SetYTitle("Residual(mm)"); - m_MDT_posX_vs_residual[station_identifier]= new TH2F(m_posXresi,m_posXresi,6000,0, 6000, 3000,-15,15); - m_MDT_posX_vs_residual[station_identifier]->SetXTitle("DistanceToReadout(mm)"); - m_MDT_posX_vs_residual[station_identifier]->SetYTitle("Residual(mm)"); - m_MDT_posX_vs_radius[station_identifier]= new TH2F(m_posXr,m_posXr,6000,0, 6000, 1500,0,15); - m_MDT_posX_vs_radius[station_identifier]->SetXTitle("DistanceToReadout(mm)"); - m_MDT_posX_vs_radius[station_identifier]->SetYTitle("Radius(mm)"); - m_MDT_adc_vs_tdc[station_identifier]= new TH2F(m_tdcadc,m_tdcadc,2500,0, 2500, 350, 50, 400); - m_MDT_adc_vs_tdc[station_identifier]->SetXTitle("TDC count(ns)"); - m_MDT_adc_vs_tdc[station_identifier]->SetYTitle("ADC count(ns)"); - m_MDT_adc_vs_t[station_identifier]= new TH2F(m_tadc,m_tadc,1000,-100, 900, 350, 50, 400); - m_MDT_adc_vs_t[station_identifier]->SetXTitle("DriftTime(ns)"); - m_MDT_adc_vs_t[station_identifier]->SetYTitle("ADC count(ns)"); - // - // v400 new residual - char m_resir1[100]; - sprintf(m_resir1,"%.7s_Residual_vs_Radius_NoRefit",chambername.c_str()); - m_MDT_residual_vs_radius_NoRefit[station_identifier]= new TH2F(m_resir1,m_resir1, 1500,0,15,3000,-15, 15); - m_MDT_residual_vs_radius_NoRefit[station_identifier]->SetXTitle("Radius(mm)"); - m_MDT_residual_vs_radius_NoRefit[station_identifier]->SetYTitle("Residual(mm)"); - char m_resir2[100]; - sprintf(m_resir2,"%.7s_Residual_vs_Radius_Refit",chambername.c_str()); - m_MDT_residual_vs_radius_Refit[station_identifier]= new TH2F(m_resir2,m_resir2, 1500,0,15,3000,-15, 15); - m_MDT_residual_vs_radius_Refit[station_identifier]->SetXTitle("Radius(mm)"); - m_MDT_residual_vs_radius_Refit[station_identifier]->SetYTitle("Residual(mm)"); - char m_resir3[100]; - sprintf(m_resir3,"%.7s_Residual_vs_Radius_TimeSlewing",chambername.c_str()); - m_MDT_residual_vs_radius_TimeSlewing[station_identifier]= new TH2F(m_resir3,m_resir3, 1500,0,15,3000,-15, 15); - m_MDT_residual_vs_radius_TimeSlewing[station_identifier]->SetXTitle("Radius(mm)"); - m_MDT_residual_vs_radius_TimeSlewing[station_identifier]->SetYTitle("Residual(mm)"); - */ - for(int i=0;i<15;i++) { - char r_adcresi[200]; - sprintf(r_adcresi,"%.7s_Radius%02d_Residual_vs_ADC",chambername.c_str(),i); - m_r_MDT_residual_vs_adc[i][station_identifier]= new TH2F(r_adcresi,r_adcresi,350,50, 400,300 ,-15, 15); - m_r_MDT_residual_vs_adc[i][station_identifier]->SetYTitle("Residual(mm)"); - m_r_MDT_residual_vs_adc[i][station_identifier]->SetXTitle("ADC Count(ns)"); - } - const char* FitFlag[3] = {"NoRefit","Refit","TimeSlewing"}; - char hits[100],chi2[100],rresi[100]; - for(int i=0;i<3;i++) { - sprintf(hits,"%.7s_Segment_hits_%s",chambername.c_str(),FitFlag[i]); - m_MDT_segment_hits[i][station_identifier] =new TH1F(hits,hits,100, 0, 100); - m_MDT_segment_hits[i][station_identifier]->SetXTitle("Hits per segment"); - sprintf(chi2,"%.7s_Segment_chi2_%s",chambername.c_str(),FitFlag[i]); - m_MDT_segment_chi2[i][station_identifier] =new TH1F(chi2,chi2,500, 0, 50); - m_MDT_segment_chi2[i][station_identifier]->SetXTitle("Segment chi2/ndf"); - sprintf(rresi,"%.7s_Residual_vs_Radius_%s",chambername.c_str(),FitFlag[i]); - m_MDT_residual_vs_radius[i][station_identifier] = new TH2F(rresi,rresi, 1500,0,15,3000,-15, 15); - m_MDT_residual_vs_radius[i][station_identifier]->SetXTitle("Radius(mm)"); - m_MDT_residual_vs_radius[i][station_identifier]->SetYTitle("Residual(mm)"); - } - char delta_chi2[100]; - sprintf(delta_chi2,"%.7s_Segment_delta_chi2",chambername.c_str()); - m_MDT_segment_delta_chi2[station_identifier]= new TH1F(delta_chi2,delta_chi2,100,-5,5); - m_MDT_segment_delta_chi2[station_identifier]->SetXTitle("Delta_Segment_chi2()"); - char fhit[100],SiHit[100]; - sprintf(fhit,"%.7s_fristHit_ADC_vs_TDC",chambername.c_str()); - sprintf(SiHit,"%.7s_secondHit_ADC_vs_TDC",chambername.c_str()); - m_MDT_fhit_adc[station_identifier]= new TH2F(fhit,SiHit,3000, 0,3000,500, 0, 500); - m_MDT_fhit_adc[station_identifier]->SetXTitle("ADC count(ns)"); - m_MDT_fhit_adc[station_identifier]->SetYTitle("TDC count(ns)"); - m_MDT_SiHitAdc[station_identifier]= new TH2F(SiHit,SiHit,3000,0,3000, 500, 0, 500); - m_MDT_SiHitAdc[station_identifier]->SetXTitle("ADC count(ns)"); - m_MDT_SiHitAdc[station_identifier]->SetYTitle("TDC count(ns)"); - - m_tfile->cd(".."); - return; - -} diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/src/NtupleChisqResolutionTool.cxx b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/src/NtupleChisqResolutionTool.cxx deleted file mode 100644 index 4e5ead47b5240df2d2c287787ec5a89092e91c97..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/src/NtupleChisqResolutionTool.cxx +++ /dev/null @@ -1,279 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -//c - c++ -#include "iostream" - -//MdtCalibFitters -#include "MdtCalibFitters/DCSLFitter.h" - -//MuonCalibStl -#include "MuonCalibStl/ToString.h" - -//MuonCalibEventBase -#include "MuonCalibEventBase/MuonCalibSegment.h" - -//MuonCalibData -#include "MdtCalibData/RtResolutionFromPoints.h" -#include "MdtCalibData/RtChebyshev.h" -#include "MdtCalibData/RtRelationLookUp.h" -#include "MdtCalibData/IRtResolution.h" - -//MuonCalibEventBase -#include "MuonCalibEventBase/MuonCalibSegment.h" - -//MuonCalibStandAloneTools -#include "MuonCalibStandAloneTools/NtupleChisqResolutionTool.h" -#include "MdtCalibIOSvc/MdtCalibInputSvc.h" - -//root -#include "TFile.h" -#include "TH1.h" -#include "TMinuit.h" -#include "TString.h" -#include "TF1.h" -#include "TMath.h" // for TMath::Prob() -#include <TString.h> // for Form - -namespace MuonCalib { - - //****************************************************************************** - static NtupleChisqResolutionTool* static_NtupleChisqResolutionTool_pointer = nullptr; - - inline void NtupleChisqResolutionTool_fcn_wrapper(int &npar, double *gin, double &f, double *par, int iflag) { - if(!static_NtupleChisqResolutionTool_pointer) { - throw std::runtime_error(Form("File: %s, Line: %d\nNtupleChisqResolutionTool_fcn_wrapper() - ERROR: static_NtupleChisqResolutionTool_pointer is nullptr", __FILE__, __LINE__)); - } - static_NtupleChisqResolutionTool_pointer->fcn(npar, gin, f, par, iflag); - } - - //**************************************************************************** - - NtupleChisqResolutionTool::NtupleChisqResolutionTool(const std::string& t, const std::string& n, const IInterface* p) : AthAlgTool(t, n, p), m_calib_input_svc("MdtCalibInputSvc", n), m_final_resolution(NULL) - { - declareInterface< NtupleCalibrationTool >(this) ; - declareProperty("MdtCalibInputSvc", m_calib_input_svc); - } - - //****************************************************************************** - - StatusCode NtupleChisqResolutionTool::initialize() - { - ATH_MSG_INFO( "initialize()" ); - ATH_CHECK( m_calib_input_svc.retrieve() ); - return StatusCode::SUCCESS; - } - - //****************************************************************************** - - StatusCode NtupleChisqResolutionTool::finalize() - { - m_resolfile->Write(); - return StatusCode::SUCCESS; - } - - - //****************************************************************************** - - - void NtupleChisqResolutionTool::setRegion() - { - //try to get rt relation - p_rt_rel = m_calib_input_svc->GetRtRelation(); - //root stuff - m_resolfile = TFile::Open("resolfile.root","RECREATE"); - m_prob_dist = new TH1F("egment_probability_distribution" ,"segment probability distribution",50,0.,1.); - } - - //****************************************************************************** - - StatusCode NtupleChisqResolutionTool::analyseSegments(const std::vector<MuonCalibSegment *> & segemnts) - { - if(p_rt_rel == NULL) - { - ATH_MSG_FATAL( "Rt relation not set!" ); - return StatusCode::FAILURE; - } - m_seg=&segemnts; - // double *par; - // recalculate(par); - m_minuit = new TMinuit(3); //initialize TMinuit with 3 parameters - static_NtupleChisqResolutionTool_pointer = this; - m_minuit->SetFCN(NtupleChisqResolutionTool_fcn_wrapper); - m_minuitoutputlevel=1; - Double_t vstart[3]={.1,-.3,.05}; - Double_t step[3]={.01,.01,.01}; - double arglist[10]; - int ierflg=0; - m_minuit->mnparm(0,"resol_0", vstart[0], step[0], .01, .5, ierflg); - m_minuit->mnparm(1,"tauexp", vstart[1], step[1], .01, .8, ierflg); - m_minuit->mnparm(2,"resol_1", vstart[2], step[2], .05, .2, ierflg); - arglist[0]=1; - m_minuit->mnexcm("SET ERR",arglist,1,ierflg); - arglist[0]=0; - m_minuit->mnexcm("SET STR",arglist,1,ierflg); - arglist[0]=1.e11; - arglist[1]=0.1; - m_minuit->mnexcm("SIMPLEX",arglist,2,ierflg); - - //formerly finalize - TString name[3] = {"resol_0", "tauexp", "resol_1"}; - double fitpar[3]; - double dummy1, dummy2, dummy3; - int idummy; - m_minuit->mnpout(0, name[0], fitpar[0], dummy1, dummy2, dummy3, idummy); - m_minuit->mnpout(1, name[1], fitpar[1], dummy1, dummy2, dummy3, idummy); - m_minuit->mnpout(2, name[2], fitpar[2], dummy1, dummy2, dummy3, idummy); - - // get minimum and maximum drift time // - RtResolutionFromPoints res_from_points; - double t_min=0, t_max=800; - const RtChebyshev *rt_Chebyshev(dynamic_cast<const RtChebyshev *>(p_rt_rel)); - const RtRelationLookUp *rt_LookUp( - dynamic_cast<const RtRelationLookUp *>(p_rt_rel)); - // RtChebyshev // - if (rt_Chebyshev!=0) { - t_min = rt_Chebyshev->tLower(); - t_max = rt_Chebyshev->tUpper(); - } - - // RtRelationLookUp, dangerous implementation, but the only way right now // - if (rt_LookUp!=0) { - t_min = rt_LookUp->par(0); - t_max = rt_LookUp->par(1)*(rt_LookUp->nPar()-2); - } - - // perform sigma-t fit // - std::vector<SamplePoint> point(31); - double r_min(p_rt_rel->radius(t_min)); - double r_max(p_rt_rel->radius(t_max)); - double bin_width((r_max-r_min)/static_cast<double>(point.size()-1)); - for (unsigned int k=0; k<point.size(); k++) { - double radius(r_min+k*bin_width); - point[k].set_x1(t_from_r(radius, p_rt_rel)); - point[k].set_x2(fitpar[0]*std::exp(-fitpar[1]*radius)+fitpar[2]); - point[k].set_error(1.0); - } - m_final_resolution = new RtResolutionChebyshev( - (res_from_points.getRtResolutionChebyshev( - point, 8))); - - return StatusCode::SUCCESS; - } - - - - void NtupleChisqResolutionTool::fcn(int&/*npar*/, double * /*gin*/, double &f, double *par, int iflag) - { - ATH_MSG_INFO( "entering fcn"<<" iflag ="<<iflag ); - m_prob_dist->Reset("ICE"); - f = recalculate(par); - m_prob_dist->Print("all"); - m_prob_dist->Fit("pol0","L","L",0.02,1.); - TF1 *pol0fit = m_prob_dist->GetFunction("pol0"); - double chidue = pol0fit->GetChisquare(); - /* - now account for first bin - */ - Double_t first_bin = m_prob_dist->GetBinContent(1); - Double_t total_sum = m_prob_dist->Integral(); - double expected_first_bin = total_sum/50.; - double ratio = (first_bin / expected_first_bin)*5.; - f=chidue+ratio*100.; - } - double NtupleChisqResolutionTool::recalculate(double *par) - { - double r; - for (unsigned int k=0; k<m_seg->size(); k++) { - - for(std::vector<MdtCalibHitBase*>::iterator it =(m_seg->at(k))->mdtHOTBegin() ; - it!=(m_seg->at(k))->mdtHOTEnd();++it) - { - r=(*it)->driftRadius(); - double newResol = par[0]*std::exp(-par[1]*r)+par[2]; - (*it)->setDriftRadius(r,newResol); - } - - DCSLFitter fitter; - fitter.fit(*(m_seg->at(k))); - double redchi2=(m_seg->at(k))->chi2(); - int nmdthits=(m_seg->at(k))->hitsOnTrack(); - - float probability=(float) TMath::Prob(redchi2 * (nmdthits-2),nmdthits-2); - - m_prob_dist->Fill(probability); - } - - return 1.; - } - - - //************************************************************ - - ///////////////////// - // METHOD t_from_r // - ///////////////////// - - double NtupleChisqResolutionTool::t_from_r(const double & r, - const IRtRelation * rt_rel) { - - /////////////// - // VARIABLES // - /////////////// - - double precision(0.010); // spatial precision of the inversion - double t_max(0.0); // upper time search limit - double t_min(1000.0); // lower time search limit - - /////////////////////////////// - // DETERMINE t_min and t_max // - /////////////////////////////// - - const RtChebyshev *rt_Chebyshev( - dynamic_cast<const RtChebyshev *>(rt_rel)); - const RtRelationLookUp *rt_LookUp( - dynamic_cast<const RtRelationLookUp *>(rt_rel)); - // RtChebyshev // - if (rt_Chebyshev!=0) { - t_min = rt_Chebyshev->tLower(); - t_max = rt_Chebyshev->tUpper(); - } - - // RtRelationLookUp, dangerous implementation, but the only way right now // - if (rt_LookUp!=0) { - t_min = rt_LookUp->par(0); - t_max = rt_LookUp->par(1)*(rt_LookUp->nPar()-2); - } - - ///////////////////////////////////////////// - // SEARCH FOR THE CORRESPONDING DRIFT TIME // - ///////////////////////////////////////////// - - while (t_max-t_min>0.1 && - std::abs(rt_rel->radius(0.5*(t_min+t_max))-r)>precision) { - - if (rt_rel->radius(0.5*(t_min+t_max))>r) { - t_max = 0.5*(t_min+t_max); - } else { - t_min = 0.5*(t_min+t_max); - } - - } - - return 0.5*(t_min+t_max); - - } - - - const IRtResolution * NtupleChisqResolutionTool::getResolution() const - { - if(m_final_resolution == 0) - { - ATH_MSG_FATAL( "No resolution Calculated!" ); - } - return m_final_resolution; - } - - -} diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/src/NtupleClassicT0Tool.cxx b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/src/NtupleClassicT0Tool.cxx deleted file mode 100644 index 4369a16019fe47a7385ff36f3d626899576f23ec..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/src/NtupleClassicT0Tool.cxx +++ /dev/null @@ -1,109 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -//MdtCalibData -#include "MdtCalibData/MdtTubeFitContainer.h" - -//MdtCalibT0 -#include "MdtCalibT0/T0CalibrationOutput.h" - -//this -#include "MuonCalibStandAloneTools/NtupleClassicT0Tool.h" -#include "MuonCalibStandAloneBase/NtupleStationId.h" -#include "MuonCalibStandAloneBase/RegionSelectionSvc.h" - -namespace MuonCalib{ - -NtupleClassicT0Tool::NtupleClassicT0Tool(const std::string& t, const std::string& n, const IInterface* p): AthAlgTool(t, n, p), m_reg_sel_svc("RegionSelectionSvc", n), m_adcBins(100), m_minAdc(0.0), m_maxAdc(300.0), m_timeBins(500), m_minTime(0.0), m_maxTime(1000.0), m_fitTime(true), m_minEntries(1000), m_initParam(1), m_chiMax(5.0) - { - declareInterface< NtupleCalibrationTool >(this) ; - declareProperty("NAdcBins", m_adcBins); - declareProperty("MinAdc", m_minAdc); - declareProperty("MaxAdc", m_maxAdc); - declareProperty("NTimeBins", m_timeBins); - declareProperty("TimeMin", m_minTime); - declareProperty("TimeMax", m_maxTime); - declareProperty("FitTimeSpectrum", m_fitTime); - declareProperty("MinEntries", m_minEntries); - declareProperty("InitParam", m_initParam); - declareProperty("MaxChi2", m_chiMax); - declareProperty("RegionSelectionSvc", m_reg_sel_svc); - } - - -StatusCode NtupleClassicT0Tool::initialize() - { - ATH_MSG_INFO( "Initializing MT T0 Tool" ); - double *params = new double[8]; - params[0] = 0. ;/* initial parameters for spectrum fit */ - params[1] = 9. ; - params[2] = 3. ; - params[3] = 200. ; - params[4] = 800. ; - params[5] = 1470. ; - params[6] = 5. ; - params[7] = 10. ; - - m_settings = new T0ClassicSettings( - m_minAdc, - m_maxAdc, - m_adcBins, - m_minTime, - m_maxTime, - m_timeBins, - m_fitTime, - m_minEntries, - m_initParam, - 8, params, - m_chiMax, 4 - ); -//get region selection service - ATH_CHECK( m_reg_sel_svc.retrieve() ); - return StatusCode :: SUCCESS; - } - -StatusCode NtupleClassicT0Tool::handleEvent(const MuonCalibEvent &/*event*/, int /*evnt_nr*/, const std::vector<MuonCalibSegment *> &segments, unsigned int position) - { - if(p_alg == NULL) - { - ATH_MSG_FATAL( "Not correctly initialized!" ); - return StatusCode :: FAILURE; - } - for(unsigned int i=position; i<segments.size(); i++) - { - if(!p_alg->handleSegment((*segments[i]))) return StatusCode::FAILURE; - } - return StatusCode::SUCCESS; - } - - -StatusCode NtupleClassicT0Tool::analyseSegments(const std::vector<MuonCalibSegment *> & /*segments*/) - { - if(p_alg == NULL) - { - ATH_MSG_FATAL( "Not correctly initialized!" ); - return StatusCode :: FAILURE; - } - if(p_alg->analyse()) return StatusCode :: SUCCESS; - return StatusCode :: FAILURE; - } - - -void NtupleClassicT0Tool::setRegion() - { - p_alg = new T0CalibrationClassic(std::string("Classic_t0_fitter"), m_settings); - p_alg->setInput(new T0CalibrationOutput(new MdtTubeFitContainer(m_reg_sel_svc->GetRegionSelection(), 2, 4, 72))); - } - -const IMdtCalibrationOutput * NtupleClassicT0Tool::getResults() const - { - if(p_alg == NULL) - { - ATH_MSG_FATAL( "Not correctly initialized!" ); - return NULL; - } - return p_alg->getResults(); - } - -} diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/src/NtupleControlHistogramsTool.cxx b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/src/NtupleControlHistogramsTool.cxx deleted file mode 100644 index 4c275fe09487a27938c69d6af0e1147d1cedcc4a..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/src/NtupleControlHistogramsTool.cxx +++ /dev/null @@ -1,1357 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -// 20.06.2007, AUTHOR: OLIVER KORTNER -// Modified: 26.06.2007 by O. Kortner, new naming convention for directories: -// station-phi-eta -// 26.06.2007 by O. Kortner, new histograms added. -// 19.07.2007 by O. Kortner, no t0 refinement without r-t calibration. -// 18.08.2008 by O. Kortner, curved track fit + time-out option added. -// 03.11.2008 by O. Kortner, allow the user to turn off the t0 -// refinement histograms. -// 21.02.2009 by O. Kortner, additional residual histograms -// after t0 refinement. -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - -//:::::::::::::::::::::::::::::::::::::::::::::::::::::::: -//:: IMPLEMENTATION OF THE METHODS DEFINED IN THE CLASS :: -//:: NtupleControlHistogramsTool :: -//:::::::::::::::::::::::::::::::::::::::::::::::::::::::: - -// standard C++ // -#include <iostream> -#include <fstream> - -// CLHEP // -#include "CLHEP/GenericFunctions/CumulativeChiSquare.hh" - -#include "MuonReadoutGeometry/MdtReadoutElement.h" -#include "MuonReadoutGeometry/RpcReadoutElement.h" -#include "MuonCalibStandAloneTools/NtupleControlHistogramsTool.h" -#include "MuonCalibEventBase/MuonCalibRawHitCollection.h" -#include "MuonCalibEventBase/MuonCalibRawMdtHit.h" -#include "MuonCalibEventBase/MuonCalibRawRpcHit.h" -#include "MuonCalibStl/ToString.h" -#include "MuonCalibStandAloneBase/MdtStationT0Container.h" -#include "MuonCalibIdentifier/MuonFixedId.h" -#include "MdtCalibT0/T0MTHistos.h" -#include "MuonCalibStandAloneBase/RegionSelectionSvc.h" -#include "MdtCalibIOSvc/MdtCalibInputSvc.h" -#include "TF1.h" -#include "TTree.h" -#include "TProfile.h" - -using namespace MuonCalib; - -//***************************************************************************** - -//::::::::::::::::: -//:: CONSTRUCTOR :: -//::::::::::::::::: - -NtupleControlHistogramsTool::NtupleControlHistogramsTool(const std::string & t, - const std::string & n, const IInterface * p) : AthAlgTool(t, n, p), - m_reg_sel_svc("RegionSelectionSvc", n), m_input_service("MdtCalibInputSvc",n) { - -///////////////// -// JOB OPTIONS // -///////////////// - declareProperty("RegionSelectionSvc", m_reg_sel_svc); - declareProperty("MdtCalibInputSvc", m_input_service); - - m_refit_segments = false; // by default refit the segments - declareProperty("segmentRefit", m_refit_segments); - - m_curved_fits = false; // by default straight refits of the segments - declareProperty("curvedSegmentRefit", m_curved_fits); - - m_refine_t0 = false; // by default t0 refinement plots are made - declareProperty("t0RefinementPlots", m_refine_t0); - - m_time_out = 2.0; // by default 2 s time-out for pattern finding - declareProperty("timeOut", m_time_out); - - m_road_width = 1.0; // by default road width = 1 mm - declareProperty("roadWidth", m_road_width); - - m_MDT_ID_helper = std::string("MDTIDHELPER"); - declareProperty("MDTIdHelper", m_MDT_ID_helper); - - m_RPC_ID_helper = std::string("RPCIDHELPER"); - declareProperty("RPCIdHelper", m_RPC_ID_helper); - - m_idToFixedIdToolType = std::string("MuonCalib::IdToFixedIdTool"); - declareProperty("idToFixedIdToolType", m_idToFixedIdToolType); - - m_idToFixedIdToolName = std::string("MuonCalib_IdToFixedIdTool"); - declareProperty("idToFixedIdToolName", m_idToFixedIdToolName); - - m_ROOT_file_name = std::string("NtupleControlHistogramsTool.root"); - declareProperty("ROOTFileName", m_ROOT_file_name); - -///////////////////////////// -// RESET PRIVATE VARIABLES // -///////////////////////////// - - m_MDT_raw_nb_hits.clear(); - m_MDT_raw_hit_distribution.clear(); - m_MDT_raw_TDC.clear(); - m_MDT_raw_ADC.clear(); - m_t0_diff.clear(); - m_r_mintrt.clear(); - m_MDT_segment_hits.clear(); - m_MDT_segment_hist_to_raw_hits_ratio.clear(); - m_MDT_segment_CL.clear(); - m_MDT_segment_t.clear(); - m_MDT_segment_r.clear(); - m_MDT_segment_TDC.clear(); - m_MDT_segment_ADC.clear(); - m_MDT_segment_slope.clear(); - m_MDT_residuals.clear(); - m_MDT_residuals_vs_x.clear(); - m_MDT_residuals_ml1.clear(); - m_MDT_residuals_ml2.clear(); - m_MDT_t0_refinement.clear(); - m_MDT_t_refined.clear(); - m_MDT_residuals_t0_refined.clear(); - m_MDT_residuals_t0_refined_gt4hits.clear(); - m_MDT_RPC_raw_tubeStripCorVsEvent.clear(); - - m_nb_ml.clear(); - m_nb_ly.clear(); - m_nb_tb.clear(); - m_nb_totalEtaStrips.clear(); - m_nb_totalEtaStrips2.clear(); - m_nb_raw_MDT_hits.clear(); - m_nb_events = 0; - m_MdtIdHelper = 0; - m_RpcIdHelper = 0; - m_id_tool = 0; - - m_qfitter = new StraightPatRec(); - m_cfitter = new CurvedPatRec(); - m_t0_refinement = new T0Refinement(); - - declareInterface< NtupleCalibrationTool >(this); - -} - -//***************************************************************************** - -//:::::::::::::::: -//:: DESTRUCTOR :: -//:::::::::::::::: - -NtupleControlHistogramsTool::~NtupleControlHistogramsTool(void) { - -} - -//***************************************************************************** - -//::::::::::::::::::::::: -//:: METHOD initialize :: -//::::::::::::::::::::::: - -StatusCode NtupleControlHistogramsTool::initialize(void) { - -/////////////// -// VARIABLES // -/////////////// - -///////////// -// MESSAGE // -///////////// - - ATH_MSG_INFO( "Initializing tool..." ); - -//////////////////////////////////////////////////// -// STORE GATE AND GEOMODEL RELATED INITIALIZATION // -//////////////////////////////////////////////////// - -// MDT ID helper // - ATH_CHECK( detStore()->retrieve(m_MdtIdHelper, m_MDT_ID_helper) ); - -// RPC ID helper // - ATH_CHECK( detStore()->retrieve(m_RpcIdHelper, m_RPC_ID_helper) ); - -//retrieve detector manager from the conditions store - ATH_CHECK(m_DetectorManagerKey.initialize()); - -// muon fixed id tool // - ATH_CHECK( toolSvc()->retrieveTool(m_idToFixedIdToolType, - m_idToFixedIdToolName, m_id_tool) ); - -// calibration input service // - ATH_CHECK( m_input_service.retrieve() ); - -//////////////////////// -// OPEN THE ROOT FILE // -//////////////////////// - - m_tfile = new TFile(m_ROOT_file_name.c_str(), "RECREATE"); - - m_t0_diff_global = new TH1F("mt_t0_diff_global", "", 201, -100.5, 100.5); - m_r_mintrt_global = new TH1F ("r_min_rt_global", "", 101, -0.1, 0.1); - - m_r_minrt_vs_r = new TH2F ("m_r_minrt_vs_r", "", 100, 0.0, 15.0, 101, -0.1, 0.1); -///////////////////////////////// -// SET UP STRAIGHT-LINE FITTER // -///////////////////////////////// - - m_qfitter->setRoadWidth(m_road_width); - m_qfitter->switchOnRefit(); -// m_qfitter->switchOffRefit(); - m_qfitter->setTimeOut(m_time_out); - m_cfitter->setRoadWidth(m_road_width); - m_cfitter->setTimeOut(m_time_out); - -//get region selection service - ATH_CHECK( m_reg_sel_svc.retrieve() ); - - return StatusCode::SUCCESS; - -} - -//***************************************************************************** - -//::::::::::::::::::::: -//:: METHOD finalize :: -//::::::::::::::::::::: - -StatusCode NtupleControlHistogramsTool::finalize(void) { - -/////////////// -// VARIABLES // -/////////////// - - -///////////// -// MESSAGE // -///////////// - - ATH_MSG_INFO( "Finalizing tool..." ); -//the summary tree creation crashes if the refit option is not set -- To be fixed! - if (!m_refit_segments) - { - m_tfile->Write(); - - return StatusCode::SUCCESS; - } - -/////////////////////////////// -// Postprocess histogramms // -/////////////////////////////// - m_tfile->cd(); -//station id - Int_t station_eta, station_phi, station_name; - char station_name_str[10]; - char software_id[100]; - char hardware_id[100]; -//t0 tmax fit information - Double_t t0[3], T0[3], tmax[3], Tmax[3], chi2_t0[3], chi2_tmax[3]; - Double_t t0_err[3], T0_err[3], tmax_err[3], Tmax_err[3]; - Int_t n_hits[3], ml_nr[3]; - for(int i=0; i<3; i++) - { - ml_nr[i]=i; - } -//residual information - Double_t res_chi2, res_chi2_t0_improved; - - m_chamber_tree = new TTree("chamber_tree", "Summary information listed by chamber"); - m_chamber_tree->Branch("station_eta", &station_eta, "station_eta/I"); - m_chamber_tree->Branch("station_phi", &station_phi, "station_phi/I"); - m_chamber_tree->Branch("station_name", &station_name, "station_name/I"); - m_chamber_tree->Branch("station_name_str", &station_name_str, "station_name_str/C"); - m_chamber_tree->Branch("software_id", &software_id, "software_id/C"); - m_chamber_tree->Branch("hardware_id", &hardware_id, "hardware_id/C"); - m_chamber_tree->Branch("t0", &t0, "t0[3]/D"); - m_chamber_tree->Branch("t0_err", &t0_err, "t0_err[3]/D"); - m_chamber_tree->Branch("T0", &T0, "T0[3]/D"); - m_chamber_tree->Branch("T0_err", &T0_err, "T0_err[3]/D"); - m_chamber_tree->Branch("tmax", &tmax, "tmax[3]/D"); - m_chamber_tree->Branch("tmax_err", &tmax_err, "tmax_err[3]/D"); - m_chamber_tree->Branch("Tmax", &Tmax, "Tmax[3]/D"); - m_chamber_tree->Branch("Tmax_err", &Tmax_err, "Tmax_err[3]/D"); - m_chamber_tree->Branch("chi2_t0", &chi2_t0, "chi2_t0[3]/D"); - m_chamber_tree->Branch("chi2_tmax", &chi2_tmax, "chi2_tmax[3]/D"); - m_chamber_tree->Branch("ml_nr", &ml_nr, "ml_nr[3]/I"); - m_chamber_tree->Branch("n_hits", &n_hits, "n_hits[3]/I"); - m_chamber_tree->Branch("res_chi2", &res_chi2, "res_chi2/D"); - m_chamber_tree->Branch("res_chi2_t0_improved", &res_chi2_t0_improved, "res_chi2_t0_improved/D"); - MuonFixedId id; -//loop on all chambers - for(std::map<NtupleStationId, T0MTHistos *>::iterator it = m_MDT_segment_tspec_ml[0].begin(); it!=m_MDT_segment_tspec_ml[0].end(); it++) - { - //chamber id - station_eta = it->first.GetEta(); - station_phi = it->first.GetPhi(); - station_name = it->first.GetStation(); - strncpy(station_name_str, id.stationNumberToFixedStationString(it->first.GetStation()).c_str(), 9); - std::ostringstream sw_id; - std::ostringstream hw_id; - hw_id<<station_name_str<<std::abs(station_eta); - if(station_eta>0) - hw_id<<"A"; - else - hw_id<<"C"; - int hw_phi=station_phi*2; - if(station_name_str[2]=='L') - hw_phi-=1; - if(hw_phi<10) - hw_id<<0; - hw_id<<hw_phi; - sw_id<<station_name_str<<" #eta"<<station_eta<<" #phi"<<station_phi; - strncpy(software_id, sw_id.str().c_str(), 99); - strncpy(hardware_id, hw_id.str().c_str(), 99); - - //specra fit - for(int i=0; i<3; i++) { - T0MTHistos *histo=m_MDT_segment_tspec_ml[i][it->first]; - n_hits[i] = static_cast<Int_t>(histo->GetTSpec()->GetEntries()); - if(n_hits[i]<2000) - { - t0[i]=9e9; - t0_err[i]=9e9; - T0[i]=9e9; - T0_err[i]=9e9; - tmax[i]=9e9; - tmax_err[i]=9e9; - Tmax[i]=9e9; - Tmax_err[i]=9e9; - chi2_t0[i]=9e9; - chi2_tmax[i]=9e9; - } - else { - if(!histo->FitT0()) - { - ATH_MSG_WARNING( " T0 fit faild for " << it->first.regionId() ); - t0[i]=9e9; - t0_err[i]=9e9; - T0[i]=9e9; - T0_err[i]=9e9; - tmax[i]=9e9; - tmax_err[i]=9e9; - Tmax[i]=9e9; - Tmax_err[i]=9e9; - chi2_t0[i]=9e9; - chi2_tmax[i]=9e9; - } - else - { - const TF1 *t0_fun=histo->GetT0Function(); - t0[i]=t0_fun->GetParameter(T0MTHistos::T0_PAR_NR_T0); - t0_err[i]=t0_fun->GetParError(T0MTHistos :: T0_PAR_NR_T0); - T0[i]=t0_fun->GetParameter(T0MTHistos::T0_PAR_NR_T); - T0_err[i]=t0_fun->GetParError(T0MTHistos :: T0_PAR_NR_T); - chi2_t0[i]=getChi2(t0_fun, it->second->GetTSpec()); - if(!histo->FitTmax()) - { - ATH_MSG_WARNING( " TMax fit faild for " << it->first.regionId() ); - tmax[i]=9e9; - tmax_err[i]=9e9; - Tmax[i]=9e9; - Tmax_err[i]=9e9; - chi2_tmax[i]=9e9; - } - else - { - const TF1 *tmax_fun=histo->GetTMaxFunction(); - tmax[i]=tmax_fun-> GetParameter(T0MTHistos :: TMAX_PAR_NR_TMAX); - tmax_err[i]=tmax_fun-> GetParError(T0MTHistos :: TMAX_PAR_NR_TMAX); - Tmax[i]=tmax_fun-> GetParameter(T0MTHistos :: TMAX_PAR_NR_T); - Tmax_err[i]=tmax_fun-> GetParError(T0MTHistos :: TMAX_PAR_NR_T); - chi2_tmax[i]=getChi2(tmax_fun, it->second->GetTSpec()); - } - } - } - } - //residual analysis - TProfile *px=m_MDT_residuals[it->first]->ProfileX(); - res_chi2=getResidualChi2(px); - px=m_MDT_residuals_t0_refined[it->first]->ProfileX(); - res_chi2_t0_improved=getResidualChi2(px); - m_chamber_tree->Fill(); - } - - -///////////////////////// -// WRITE THE ROOT FILE // -///////////////////////// - - m_tfile->Write(); - - return StatusCode::SUCCESS; - -} - -//***************************************************************************** - -//:::::::::::::::::::::::: -//:: METHOD handleEvent :: -//:::::::::::::::::::::::: - -StatusCode NtupleControlHistogramsTool::handleEvent( - const MuonCalibEvent & event, - int evnt_nb, - const std::vector<MuonCalibSegment *> & segments, - unsigned int position) { - -/////////////// -// VARIABLES // -/////////////// - - const MuonCalibRawHitCollection *raw_hits(event.rawHitCollection()); - unsigned int ml, ly, tb; // multilayer, layer, tube - unsigned int ndof; // number of degrees of freedom of the segment fit - int strip, strip2; // rpc strip - double r, d; // drift radius and track distance from the wire - int mdt_close_layer, mdt_close_multi; - IMdtPatRecFitter *segment_fitter(0); // pointer to the segment fitter - if (m_curved_fits) { - segment_fitter = m_cfitter; - } else { - segment_fitter = m_qfitter; - } - -//////////////////// -// RESET COUNTERS // -//////////////////// - - m_nb_raw_MDT_hits.clear(); - -////////////////////////////// -// FILL RAW DATA HISTOGRAMS // -////////////////////////////// - - -// loop over the raw hits // - for (MuonCalibRawHitCollection::MuonCalibRawMdtHitVecCit it= - raw_hits->rawMdtHitCollectionBegin(); - it!=raw_hits->rawMdtHitCollectionEnd(); ++it) { - - // get the raw hit and check whether it is in the calibration region // - MuonCalibRawMdtHit *hit(*it); - - if(!m_reg_sel_svc->isInRegion(hit->identify())) continue; - - - // create maps if necessary // - NtupleStationId station_identifier(hit->identify()); - station_identifier.SetMultilayer(0); - createMaps(hit->identify()); - - // calculate the number of raw MDT hits per chamber // - m_nb_raw_MDT_hits[station_identifier]++; - - // fill raw histograms as far as possible // - // raw MDT hit distribution // - ml = (hit->identify()).mdtMultilayer(); - ly = (hit->identify()).mdtTubeLayerIndex()+1; - tb = (hit->identify()).mdtTubeIndex(); - - m_MDT_raw_hit_distribution[station_identifier]->Fill( - tb+(ly-1)*m_nb_tb[station_identifier] - +(ml-1)*m_nb_tb[station_identifier]* - m_nb_ly[station_identifier], 1.0); - - // raw MDT TDC spectrum // - m_MDT_raw_TDC[station_identifier]->Fill(hit->tdcCount(), 1.0); - - // raw MDT ADC spectra // - m_MDT_raw_ADC[station_identifier]->Fill(hit->adcCount(), 1.0); - - } - - // fill histograms with number of raw MDT hits // - std::map<NtupleStationId, unsigned int>::iterator it = - m_nb_raw_MDT_hits.begin(); - std::map<NtupleStationId, unsigned int>::iterator end_it = - m_nb_raw_MDT_hits.end(); - - while(it!=end_it) { - m_MDT_raw_nb_hits[(*it).first]->Fill((*it).second, 1.0); - ++it; - }; - -// Loop over the raw rpc hits - - for (MuonCalibRawHitCollection::MuonCalibRawRpcHitVecCit rit= - raw_hits->rawRpcHitCollectionBegin(); - rit!=raw_hits->rawRpcHitCollectionEnd(); ++rit){ - mdt_close_multi=0; //ML next to RPC - mdt_close_layer=0; //Layer next to RPC - strip = -1; // tmp var for the right strip number - strip2 = -1; // tmp var for the right strip number in r doublet 2 rpc - - - // get the raw rpc hit and check whether it is in the calibration region // - MuonCalibRawRpcHit *rhit(*rit); - - if(!m_reg_sel_svc->isInRegion(rhit->identify())) continue; - - // create maps if necessary // - NtupleStationId station_identifier(rhit->identify()); - station_identifier.SetMultilayer(0); - createMaps(rhit->identify()); - - // select hits on eta strips - if ( (rhit->identify()).rpcMeasuresPhiIndex() ){ - continue; - } - - //find and select closest mdt layer to the hit rpc - //BML / BMS - if ( (rhit->identify()).stationNameIndex() == 2 - || (rhit->identify()).stationNameIndex() ==3 ){ - // the BMx chambers have two rpcs, select by the R doublet - switch ( (rhit->identify()).rpcDoubletRIndex() ){ - case (0): - mdt_close_multi = 1; - mdt_close_layer = 1; - // add offset if there is a second rpc Z doublet - if (! (rhit->identify()).rpcDoubletZIndex() ){ - strip = (rhit->identify()).rpcStripIndex(); - } - else{ - strip = (rhit->identify()).rpcStripIndex() - + m_nb_etaStrips[0][0]; - } - break; - - case (1): - mdt_close_multi = 2; - mdt_close_layer = 3; - // add offset if there is a second rpc Z doublet - if (! (rhit->identify()).rpcDoubletZIndex() ){ - strip2 = (rhit->identify()).rpcStripIndex(); - } - else{ - strip2 = (rhit->identify()).rpcStripIndex() - + m_nb_etaStrips[1][0]; - } - break; - - default: - ATH_MSG_INFO( "no second rpc found for chambertype: " << - (rhit->identify()).stationNameIndex() ); - break; - } - - } - // BOL - else if ( (rhit->identify()).stationNameIndex() == 4 ){ - mdt_close_multi = 2; - mdt_close_layer = 3; - - // add offset if there is a second rpc Z doublet - if (! (rhit->identify()).rpcDoubletZIndex() ){ - strip = (rhit->identify()).rpcStripIndex(); - } - else{ - strip = (rhit->identify()).rpcStripIndex() - + m_nb_etaStrips[0][0]; - } - } - // BOS - else if ( (rhit->identify()).stationNameIndex() == 5 ){ - mdt_close_multi = 1; - mdt_close_layer = 1; - - // add offset if there is a second rpc Z doublet - if (! (rhit->identify()).rpcDoubletZIndex() ){ - strip = (rhit->identify()).rpcStripIndex(); - } - else{ - strip = (rhit->identify()).rpcStripIndex() - + m_nb_etaStrips[0][0]; - } - - } - else{ - ATH_MSG_WARNING( "MDT close layer could no be set for rpc with stationNameIndex: " - << (rhit->identify()).stationNameIndex() ); - } - - //now loop over all raw mdt hits in the layer which is next to the rpc - for (MuonCalibRawHitCollection::MuonCalibRawMdtHitVecCit it= - raw_hits->rawMdtHitCollectionBegin(); - it!=raw_hits->rawMdtHitCollectionEnd(); ++it) { - // get the raw mdt hit and check whether it is in the same chamber as the rpc hit // - MuonCalibRawMdtHit *hit(*it); - - if ( (hit->identify()).stationName() != (rhit->identify()).stationName() ){ - continue; - } - if ( (hit->identify()).etaIndex() != (rhit->identify()).etaIndex() ){ - continue; - } - if ( (hit->identify()).phiIndex() != (rhit->identify()).phiIndex() ){ - continue; - } - // select layer next to the rpc - if ( (hit->identify()).mdtMultilayerIndex()+1 != mdt_close_multi ){ - continue; - } - if ( (hit->identify()).mdtTubeLayerIndex()+1 != mdt_close_layer ){ - continue; - } - if (strip != -1){ - m_RPC_raw_etaStrip[station_identifier]->Fill(strip); - m_MDT_RPC_raw_tubeStripCor[station_identifier]->Fill( - (hit->identify()).mdtTubeIndex() + 1, - strip + 1 - ); - m_MDT_RPC_raw_tubeStripCorVsEvent[station_identifier]->Fill( - evnt_nb, - ((hit->identify()).mdtTubeIndex()) - strip - ); - - if (hit->adcCount() > 80 ){ // to cut elx noise - m_MDT_RPC_raw_tubeStripCor_adcCut[station_identifier]->Fill( - (hit->identify()).mdtTubeIndex() + 1,strip + 1); - m_MDT_RPC_raw_tubeStripCorVsEvent_adcCut[station_identifier]->Fill( - evnt_nb, ((hit->identify()).mdtTubeIndex()) - strip ); - } - } - - // Fill histos for 2nd rpc r doublet if BMx chamber - if (m_nb_totalEtaStrips2[station_identifier] - && strip2 != -1){ - m_RPC_raw_etaStrip2[station_identifier]->Fill(strip2); - m_MDT_RPC_raw_tubeStripCor2[station_identifier]->Fill( - (hit->identify()).mdtTubeIndex() + 1, - strip2 + 1 - ); - m_MDT_RPC_raw_tubeStripCorVsEvent2[station_identifier]->Fill( - evnt_nb, - ((hit->identify()).mdtTubeIndex()) - strip2 - ); - if (hit->adcCount() > 80 ){ // to cut elx noise - m_MDT_RPC_raw_tubeStripCor_adcCut2[station_identifier]->Fill( - (hit->identify()).mdtTubeIndex() + 1,strip2 + 1); - m_MDT_RPC_raw_tubeStripCorVsEvent_adcCut2[station_identifier]->Fill( - evnt_nb, ((hit->identify()).mdtTubeIndex()) - strip2 ); - } - - } - - } - - } - - -//////////////////////// -// SEGMENT HISTOGRAMS // -//////////////////////// - -// loop over the segments // - for (unsigned int k=position; k<segments.size(); k++) { - - - // get the first hit to check if it is in the calibration region // - if(!m_reg_sel_svc->isInRegion(segments[k]->mdtHOT()[0] ->identify())) continue; - - // create maps if necessary // - NtupleStationId station_identifier((segments[k]->mdtHOT()[0])->identify()); - station_identifier.SetMultilayer(0); - createMaps((segments[k]->mdtHOT()[0])->identify()); - - // perform a refit if requested // - if (m_refit_segments) { - if(!segment_fitter->fit(*(segments[k]))) return StatusCode :: SUCCESS; - } - - // number of hits on the segment // - if (m_refit_segments) { - m_MDT_segment_hits[station_identifier]->Fill( - segment_fitter->numberOfTrackHits(), 1.0); - } else { - m_MDT_segment_hits[station_identifier]->Fill( - segments[k]->mdtHitsOnTrack(), 1.0); - } - - // ratio of hits on the segment and the number of raw MDT hits // - if (m_refit_segments) { - m_MDT_segment_hist_to_raw_hits_ratio[station_identifier - ]->Fill(segment_fitter->numberOfTrackHits()/ - static_cast<double>(m_nb_raw_MDT_hits[ - station_identifier]), 1.0); - } else { - m_MDT_segment_hist_to_raw_hits_ratio[station_identifier - ]->Fill(segments[k]->mdtHitsOnTrack()/ - static_cast<double>(m_nb_raw_MDT_hits[ - station_identifier]), 1.0); - } - - // CL of the segment fit // - if (m_refit_segments) { - if (m_curved_fits) { - ndof = segment_fitter->numberOfTrackHits()-3; - } else { - ndof = segment_fitter->numberOfTrackHits()-2; - } - } else { - ndof = segments[k]->mdtHitsOnTrack()-2; - } - if (ndof>0 && !std::isnan(segments[k]->chi2())) { - Genfun::CumulativeChiSquare one_minus_CL(ndof); - m_MDT_segment_CL[station_identifier]->Fill( - 1.0-one_minus_CL(std::abs(segments[k]->chi2())), - 1.0); - } - - // drift-time and ADC spectra // - if (m_refit_segments) { - for (unsigned int l=0; l<segment_fitter->numberOfTrackHits(); - l++) { - m_MDT_segment_t[station_identifier]->Fill( - (segment_fitter->trackHits())[l - ]->driftTime(), 1.0); - m_MDT_segment_r[station_identifier]->Fill( - (segment_fitter->trackHits())[l - ]->driftRadius(), 1.0); - const MuonFixedId &h_id((segment_fitter-> trackHits())[l]-> identify()); - m_MDT_segment_hit_dis[station_identifier]-> Fill((h_id.mdtMultilayer() - 1) * 216 + (h_id.mdtTubeLayer() - 1) * 72 + h_id.mdtTube() -1); - m_MDT_segment_tspec_ml[0][station_identifier]-> - FillT((segment_fitter->trackHits())[l - ]->driftTime()); - MuonFixedId id((segment_fitter->trackHits())[l - ]->identify()); - m_MDT_segment_tspec_ml[id.mdtMultilayer()] [station_identifier]-> FillT((segment_fitter->trackHits())[l]->driftTime()); - m_MDT_segment_TDC[station_identifier]->Fill( - (segment_fitter->trackHits())[l - ]->tdcCount(), 1.0); - m_MDT_segment_ADC[station_identifier]->Fill( - (segment_fitter->trackHits())[l - ]->adcCount(), 1.0); - - } - } else { - for (unsigned int l=0; l<segments[k]->hitsOnTrack(); - l++) { - const MuonFixedId &h_id((segments[k]->mdtHOT())[l]-> identify()); - m_MDT_segment_hit_dis[station_identifier]-> Fill((h_id.mdtMultilayer() - 1) * 216 + (h_id.mdtTubeLayer() - 1) * 72 + h_id.mdtTube() -1); - m_MDT_segment_t[station_identifier]->Fill( - (segments[k]->mdtHOT())[l - ]->driftTime(), 1.0); - m_MDT_segment_r[station_identifier]->Fill( - (segments[k]->mdtHOT())[l - ]->driftRadius(), 1.0); - m_MDT_segment_TDC[station_identifier]->Fill( - (segments[k]->mdtHOT())[l - ]->tdcCount(), 1.0); - m_MDT_segment_ADC[station_identifier]->Fill( - (segments[k]->mdtHOT())[l - ]->adcCount(), 1.0); - } - } - - // segment slopes // - m_MDT_segment_slope[station_identifier]->Fill( - 57.30*std::atan((segments[k]->direction()).y()/ - (segments[k]->direction()).z()), 1.0); - - // track residuals // - if (m_refit_segments) { - if (ndof>0 && !std::isnan(segments[k]->chi2())) { - for (unsigned int l=0; l<segment_fitter->numberOfTrackHits(); - l++) { - r = std::abs((segment_fitter->trackHits())[l - ]->driftRadius()); - d = (segment_fitter->trackHits())[l - ]->signedDistanceToTrack(); - double t = (segment_fitter->trackHits())[l] -> driftTime(); - m_MDT_residuals[station_identifier]->Fill( - std::abs(d), r-std::abs(d), 1.0); - m_MDT_residuals_vs_x[station_identifier]->Fill( - (segment_fitter->trackHits())[l - ]->localPosition().x(), r-std::abs(d), 1.0); - m_MDT_r_vs_rtrack[station_identifier]->Fill( - d, r, 1.0); - m_MDT_t_vs_rtrack[station_identifier]->Fill( - d, t, 1.0); - - MuonFixedId id((segment_fitter->trackHits())[l - ]->identify()); - if (id.mdtMultilayer()==1) { - m_MDT_residuals_ml1[station_identifier - ]->Fill(d, r-std::abs(d), 1.0); - } else { - m_MDT_residuals_ml2[station_identifier - ]->Fill(d, r-std::abs(d), 1.0); - } - } - } - } else { - for (unsigned int l=0; l<segments[k]->hitsOnTrack(); - l++) { - r = std::abs((segments[k]->mdtHOT())[l - ]->driftRadius()); - d = (segments[k]->mdtHOT())[l - ]->signedDistanceToTrack(); - double xx = (segments[k]->mdtHOT())[l] -> localPosition().x(); - m_MDT_residuals[station_identifier]->Fill( - std::abs(d), r-std::abs(d), 1.0); - m_MDT_residuals_vs_x[station_identifier]->Fill( xx, r-std::abs(d), 1.0); - - MuonFixedId id((segments[k]->mdtHOT())[l - ]->identify()); - if (id.mdtMultilayer()==1) { - m_MDT_residuals_ml1[station_identifier - ]->Fill(d, r-std::abs(d), 1.0); - } else { - m_MDT_residuals_ml2[station_identifier - ]->Fill(d, r-std::abs(d), 1.0); - } - } - } - - -//test histograms - const MdtStationT0Container *t0(m_input_service->GetT0(station_identifier)); - const IRtRelation *rt=m_input_service->GetRtRelation( - station_identifier); - if(t0!=NULL) - for (unsigned int l=0; l<segments[k]->hitsOnTrack();l++) - { - const MdtCalibHitBase *hot((segments[k]->mdtHOT())[l]); - const MuonFixedId &id(hot->identify()); - m_t0_diff[station_identifier]->Fill(hot->tubeT0() - t0->t0(id.mdtMultilayer(), id.mdtTubeLayer(), id.mdtTube())); - m_t0_diff_global->Fill(hot->tubeT0() - t0->t0(id.mdtMultilayer(), id.mdtTubeLayer(), id.mdtTube())); - } - if(rt!=NULL) - for (unsigned int l=0; l<segments[k]->hitsOnTrack();l++) - { - const MdtCalibHitBase *hot((segments[k]->mdtHOT())[l]); - m_r_mintrt[station_identifier]-> Fill(std::abs(hot->driftRadius()) - std::abs(rt->radius(hot->driftTime()))); - m_r_mintrt_global->Fill(std::abs(hot->driftRadius()) - std::abs(rt->radius(hot->driftTime()))); - m_r_minrt_vs_r ->Fill(std::abs(hot->driftRadius()), std::abs(hot->driftRadius()) - std::abs(rt->radius(hot->driftTime()))); - } - -// t0 refinement // - MuonCalibSegment seg(*segments[k]); - if (!m_refine_t0 || !m_refit_segments) { - m_MDT_t0_refinement[station_identifier]->Fill(seg.fittedT0()); - for (unsigned int l=0; l<seg.hitsOnTrack();l++) - { - double t = (seg.mdtHOT())[l]->driftTime() + seg.fittedT0(); - m_MDT_t_refined[station_identifier]->Fill(t); - } - } - - if (!m_refit_segments) { - continue; - } - if (rt==0) { - continue; - } - if (!m_refine_t0) { - continue; - } - - - double error; - bool fail; - m_t0_refinement->SetDeltaT0(12.5); - double delta(m_t0_refinement->getDeltaT0(&seg, rt, true, - error, fail)); - if (!fail) { - m_MDT_t0_refinement[station_identifier]->Fill( - delta, 1.0); - - // refit the segment // - if (m_refit_segments) { - if(!segment_fitter->fit(*(segments[k]))) return StatusCode :: SUCCESS; - } - - for (unsigned int l=0; l<seg.hitsOnTrack();l++) { - r = std::abs((seg.mdtHOT())[l - ]->driftRadius()); - d = std::abs((seg.mdtHOT())[l - ]->signedDistanceToTrack()); - double t = (seg.mdtHOT())[l - ]->driftTime(); - m_MDT_residuals_t0_refined[station_identifier - ]->Fill(d, r-d, 1.0); - if (seg.hitsOnTrack()>4) { - m_MDT_residuals_t0_refined_gt4hits[station_identifier - ]->Fill(d, r-d, 1.0); - } - m_MDT_t_refined[station_identifier]->Fill(t); - } - } - } - - return StatusCode::SUCCESS; - -} - - - -//***************************************************************************** - -//::::::::::::::::::::::::: -//:: METHOD KeepSegments :: -//::::::::::::::::::::::::: - -bool NtupleControlHistogramsTool::KeepSegments(void) const { - - return false; - -} - -//***************************************************************************** - -//::::::::::::::::::::::: -//:: METHOD createMaps :: -//::::::::::::::::::::::: - -void NtupleControlHistogramsTool::createMaps(const MuonFixedId & id) { - -/////////////// -// VARIABLES // -/////////////// - - NtupleStationId station_identifier(id); - station_identifier.SetMultilayer(0); - std::map<NtupleStationId, unsigned int>::iterator end_it = - m_nb_ml.end(); - -//////////////////////////////////// -// FIND THE IDENTIFIER IN m_nb_ml // -//////////////////////////////////// - - if (m_nb_ml.find(station_identifier)!=end_it) { - return; - } - -/////////////////////////////////////////// -// GET THE GEOMETRY OF THE GIVEN CHAMBER // -/////////////////////////////////////////// - - SG::ReadCondHandle<MuonGM::MuonDetectorManager> DetectorManagerHandle{m_DetectorManagerKey}; - const MuonGM::MuonDetectorManager* MuonDetMgr = DetectorManagerHandle.cptr(); - if(MuonDetMgr==nullptr){ - ATH_MSG_ERROR("Null pointer to the read MuonDetectorManager conditions object"); - return; - } - - Identifier station_id = m_id_tool->fixedIdToId(id); - const MuonGM::MdtReadoutElement *MdtRoEl = - MuonDetMgr->getMdtReadoutElement( - m_MdtIdHelper->channelID(station_id,1,1,1)); - - m_nb_ml[station_identifier] = m_MdtIdHelper->numberOfMultilayers( - station_id); - m_nb_ly[station_identifier] = MdtRoEl->getNLayers(); - m_nb_tb[station_identifier] = MdtRoEl->getNtubesperlayer(); - - // get the rpc geom information - - // loop over possible R doublets - m_nb_totalEtaStrips[station_identifier]=0; - m_nb_totalEtaStrips2[station_identifier]=0; - for (int r_doublet=0; r_doublet<2; r_doublet++){ - // loop over possible Z doublets - for (int z_doublet=0; z_doublet<4; z_doublet++){ - const MuonGM::RpcReadoutElement *RpcRoEl = - MuonDetMgr->getRpcRElement_fromIdFields( - m_MdtIdHelper -> stationName(station_id),// int stationName, - m_MdtIdHelper -> stationEta(station_id), // int stationEta, - m_MdtIdHelper -> stationPhi(station_id), // int stationPhi - r_doublet+1,z_doublet+1,1// int doubletR, int doubletZ, int doubletPhi - ); - - //save nuber of eta strips per doublet, if there is one - if (RpcRoEl){ - m_nb_etaStrips[r_doublet][z_doublet] = RpcRoEl->NetaStrips(); - } - else { - m_nb_etaStrips[r_doublet][z_doublet] = 0; - } - - //save the total number of eta strips for the two different R doublets - if (!r_doublet){ - m_nb_totalEtaStrips[station_identifier] = m_nb_totalEtaStrips[station_identifier] - + m_nb_etaStrips[r_doublet][z_doublet]; - } - else{ - m_nb_totalEtaStrips2[station_identifier] = m_nb_totalEtaStrips2[station_identifier] - + m_nb_etaStrips[r_doublet][z_doublet]; - } - } - - } - - -/////////////////////////////// -// CREATE THE REMAINING MAPS // -/////////////////////////////// - -// counter // - m_nb_raw_MDT_hits[station_identifier] = 0; - -// histograms // - ToString tostring; - std::string file_dir(id.stationNumberToFixedStationString(id.stationName()) - +"_"+tostring(id.phi())+"_"+tostring(id.eta())); - m_tfile->mkdir(file_dir.c_str()); - m_tfile->cd(file_dir.c_str()); - - m_MDT_raw_nb_hits[station_identifier] = - new TH1F("MDT_raw_nb_hits", - "Number of Raw MDT Hits", - 1+m_nb_ml[station_identifier]*( - m_nb_ly[station_identifier]* - m_nb_tb[station_identifier]), - -0.5, - 0.5+m_nb_ml[station_identifier]*( - m_nb_ly[station_identifier]* - m_nb_tb[station_identifier])); - m_MDT_raw_nb_hits[station_identifier - ]->SetXTitle("Number of Hits"); - m_MDT_raw_nb_hits[station_identifier - ]->SetYTitle("Entries / 1"); - - - m_MDT_raw_hit_distribution[station_identifier] = - new TH1F("MDT_raw_hit_distribution", - "Raw MDT Hit Profile", - m_nb_ml[station_identifier]*( - m_nb_ly[station_identifier]* - m_nb_tb[station_identifier]), - 0.5, - 0.5+m_nb_ml[station_identifier]*( - m_nb_ly[station_identifier]* - m_nb_tb[station_identifier])); - m_MDT_raw_hit_distribution[station_identifier - ]->SetXTitle("Channel"); - m_MDT_raw_hit_distribution[station_identifier - ]->SetYTitle("Entries / Channel"); - - m_MDT_raw_TDC[station_identifier] = - new TH1F("MDT_raw_TDC", - "Raw MDT TDC Counts", - 2*4096+1, -4096.5, 4096.5); - m_MDT_raw_TDC[station_identifier]->SetXTitle("TDC Count"); - m_MDT_raw_TDC[station_identifier - ]->SetYTitle("Entries / (0.78125 ns)"); - - m_MDT_raw_ADC[station_identifier] = - new TH1F("MDT_raw_ADC", - "Raw MDT ADC Counts", - 4096+1, -0.5, 4096.5); - m_MDT_raw_ADC[station_identifier]->SetXTitle("ADC count"); - m_MDT_raw_ADC[station_identifier - ]->SetYTitle("Entries / (0.78125 ns)"); - if (m_nb_totalEtaStrips[station_identifier]){ - m_RPC_raw_etaStrip[station_identifier] = - new TH1F("RPC_raw_etaStrip", - "Raw Hits: RPC Eta Strip; RPC Eta Strip; Entries / Strip", - m_nb_totalEtaStrips[station_identifier], - 0.5, - 0.5 + m_nb_totalEtaStrips[station_identifier]); - m_MDT_RPC_raw_tubeStripCor[station_identifier] = - new TH2F("MDT_RPC_raw_tubeStripCor", - "Raw Hits: RPC Eta Strip vs. Raw MDT Tube; MDT Tube; RPC Eta Strip", - m_nb_tb[station_identifier], - 0.5, - 0.5+m_nb_tb[station_identifier], - m_nb_totalEtaStrips[station_identifier], - 0.5, - 0.5+m_nb_totalEtaStrips[station_identifier]); - m_MDT_RPC_raw_tubeStripCorVsEvent[station_identifier] = - new TH2F("MDT_RPC_raw_tubeStripCorVsEvent", - "Raw Hits: (MDT Tube - RPC Strip) vs. First 100k Events; Event ; (MDT Tube - RPC strip)", - 1000, - 0.5, - 100000, - 2 * m_nb_tb[station_identifier], - -0.5 - m_nb_tb[station_identifier], - 0.5+m_nb_tb[station_identifier]); - m_MDT_RPC_raw_tubeStripCorVsEvent_adcCut[station_identifier] = - new TH2F("MDT_RPC_raw_tubeStripCorVsEvent_adcCut", - "Raw Hits: (MDT Tube - RPC Strip) vs. first 100k Events (MDT ADC > 80); Event ; (MDT Tube - RPC strip)", - 1000, - 0.5, - 100000, - 2 * m_nb_tb[station_identifier], - -0.5 - m_nb_tb[station_identifier], - 0.5+m_nb_tb[station_identifier]); - m_MDT_RPC_raw_tubeStripCor_adcCut[station_identifier] = - new TH2F("MDT_RPC_raw_tubeStripCor_adcCut", - "Raw RPC Eta Strip vs. Raw MDT Tube (MDT ADC > 80); MDT Tube; RPC Eta Strip", - m_nb_tb[station_identifier], - 0.5, - 0.5+m_nb_tb[station_identifier], - m_nb_totalEtaStrips[station_identifier], - 0.5, - 0.5+m_nb_totalEtaStrips[station_identifier]); - - if (m_nb_totalEtaStrips2[station_identifier]){ - m_RPC_raw_etaStrip2[station_identifier] = - new TH1F("RPC_raw_etaStrip2", - "Raw Hits: RPC Eta Strip (2nd RDoublet); RPC Eta Strip; Entries / Strip", - m_nb_totalEtaStrips2[station_identifier], - 0.5, - 0.5 + m_nb_totalEtaStrips2[station_identifier]); - m_MDT_RPC_raw_tubeStripCor2[station_identifier] = - new TH2F("MDT_RPC_raw_tubeStripCor2", - "Raw Hits: RPC Eta Strip vs. Raw MDT Tube (2nd RDoublet); MDT Tube; RPC Eta Strip", - m_nb_tb[station_identifier], - 0.5, - 0.5+m_nb_tb[station_identifier], - m_nb_totalEtaStrips2[station_identifier], - 0.5, - 0.5+m_nb_totalEtaStrips2[station_identifier]); - m_MDT_RPC_raw_tubeStripCorVsEvent2[station_identifier] = - new TH2F("MDT_RPC_raw_tubeStripCorVsEvent2", - "Raw Hits: (MDT Tube - RPC Strip) vs. First 100k Events (2nd RDoublet); Event ; (MDT Tube - RPC strip)", - 1000, - 0.5, - 100000, - 2 * m_nb_tb[station_identifier], - -0.5 - m_nb_tb[station_identifier], - 0.5+m_nb_tb[station_identifier]); - m_MDT_RPC_raw_tubeStripCorVsEvent_adcCut2[station_identifier] = - new TH2F("MDT_RPC_raw_tubeStripCorVsEvent_adcCut2", - "Raw Hits: (MDT Tube - RPC Strip) vs. first 100k Events (MDT ADC > 80) (2nd RDoublet); Event ; (MDT Tube - RPC strip)", - 1000, - 0.5, - 100000, - 2 * m_nb_tb[station_identifier], - -0.5 - m_nb_tb[station_identifier], - 0.5+m_nb_tb[station_identifier]); - m_MDT_RPC_raw_tubeStripCor_adcCut2[station_identifier] = - new TH2F("MDT_RPC_raw_tubeStripCor_adcCut2", - "Raw RPC Eta Strip vs. Raw MDT Tube (MDT ADC > 80) (2nd RDoublet); MDT Tube; RPC Eta Strip", - m_nb_tb[station_identifier], - 0.5, - 0.5+m_nb_tb[station_identifier], - m_nb_totalEtaStrips2[station_identifier], - 0.5, - 0.5+m_nb_totalEtaStrips2[station_identifier]); - - } - - } - m_t0_diff[station_identifier] = new TH1F ("t0_diff", "", 201, -100.5, 100.5); - m_r_mintrt[station_identifier] = new TH1F ("r_min_rt", "", 101, -0.1, 0.1); - m_MDT_segment_hits[station_identifier] = - new TH1F("MDT_segments_hits", - "Number of MDT Segment Hits", - 31, -0.5, 30.5); - m_MDT_segment_hits[station_identifier - ]->SetXTitle("Number of Hits"); - m_MDT_segment_hits[station_identifier - ]->SetYTitle("Entries / Hit"); - - m_MDT_segment_hist_to_raw_hits_ratio[station_identifier] = - new TH1F("MDT_segment_hist_to_raw_hits_ratio", - "Ratio of the Number of Segments and Raw MDT Hits", - 100, -0.1, 2.1); - m_MDT_segment_hits[station_identifier - ]->SetXTitle("Ratio"); - - m_MDT_segment_CL[station_identifier] = - new TH1F("MDT_segment_CL", - "Segment Confidence Level Distribution", - 120, -0.1, 1.1); - m_MDT_segment_CL[station_identifier - ]->SetXTitle("confidence level"); - m_MDT_segment_CL[station_identifier - ]->SetYTitle("dn/dCL (1/0.01)"); - - m_MDT_segment_TDC[station_identifier] = - new TH1F("MDT_segment_TDC", - "Segment MDT Hit TDC Counts", - 2*4096+1, -4096.5, 4096.5); - m_MDT_raw_TDC[station_identifier]->SetXTitle("TDC count"); - m_MDT_raw_TDC[station_identifier - ]->SetYTitle("entries/(TDC count)"); - m_MDT_raw_TDC[station_identifier]->SetXTitle("drift time (ns)"); - m_MDT_raw_TDC[station_identifier - ]->SetYTitle("entries/(0.78125 ns)"); - - T0MTSettings *settings = new T0MTSettings; - settings->NBinsTime()=2*4096+1; - settings->TimeMin()=-4096.5*0.78125; - settings->TimeMax()=4096.5*0.78125; - settings->AddFitfun()=true; - for(unsigned int i=0; i<3; i++) - { - m_MDT_segment_tspec_ml[i][station_identifier]= new T0MTHistos(); - std::ostringstream name; - name<<"segments_ml"<<i+1; - m_MDT_segment_tspec_ml[i][station_identifier]->Initialize(i, settings, name.str().c_str()); - } - m_MDT_segment_t[station_identifier] = new TH1F("MDT_segment_t", - "Segment MDT Hit TDC Counts", - 2*4096+1, -4096.5*0.78125, 4096.5*0.78125); - m_MDT_segment_r[station_identifier] = new TH1F("MDT_segment_r", - "Segment Drift radius", - 200, -15.0, 15.0); - m_MDT_segment_hit_dis[station_identifier] = new TH1F("MDT_segment_hit_dis", - "hit distribution", - 432, -0.5, 431.5); - m_MDT_segment_t[station_identifier]->SetXTitle("Drift Time (ns)"); - m_MDT_segment_t[station_identifier - ]->SetYTitle("Entries / ns"); - - m_MDT_segment_ADC[station_identifier] = - new TH1F("MDT_segment_ADC", - "Segment MDT Hit ADC Counts", - 4096+1, -0.5, 4096.5); - m_MDT_raw_ADC[station_identifier]->SetXTitle("ADC count"); - m_MDT_raw_ADC[station_identifier - ]->SetYTitle("entries/(ADC count)"); - - m_MDT_segment_slope[station_identifier] = - new TH1F("MDT_segment_slope", - "Segment Slopes", - 181, -90.5, 90.5); - m_MDT_raw_ADC[station_identifier]->SetXTitle("slope (degrees)"); - m_MDT_raw_ADC[station_identifier - ]->SetYTitle("dn/dslope (1/degree)"); - - m_MDT_residuals[station_identifier] = - new TH2F("MDT_residuals", - "MDT residuals", - 152, -0.1, 15.1, 200, -1.0, 1.0); - m_MDT_residuals[station_identifier - ]->SetXTitle("r (mm)"); - m_MDT_residuals[station_identifier - ]->SetYTitle("residual (mm)"); - m_MDT_residuals_vs_x[station_identifier] = - new TH2F("MDT_residuals_vs_x", - "MDT residuals versus the local x coordinate", - 500, -3100.0, 3100.0, 200, -1.0, 1.0); - m_MDT_residuals_vs_x[station_identifier - ]->SetXTitle("x (mm)"); - m_MDT_residuals_vs_x[station_identifier - ]->SetYTitle("residual (mm)"); - m_MDT_r_vs_rtrack[station_identifier] = - new TH2F("MDT_r_vs_rtrack", - "MDT MDT_r_vs_rtrack", - 4000, -15.1, 15.1, 2000, 0, 15.1); - m_MDT_residuals[station_identifier - ]->SetXTitle("r (mm)"); - m_MDT_residuals[station_identifier - ]->SetYTitle("residual (mm)"); - m_MDT_t_vs_rtrack[station_identifier] = - new TH2F("MDT_t_vs_rtrack", - "MDT MDT_t_vs_rtrack", - 1000, -15.1, 15.1, 1000, -100, 800); - m_MDT_residuals[station_identifier - ]->SetXTitle("r (mm)"); - m_MDT_residuals[station_identifier - ]->SetYTitle("residual (mm)"); - - m_MDT_residuals_ml1[station_identifier] = - new TH2F("MDT_residuals_ml1", - "MDT residuals in multilayer 1", - 302, -15.1, 15.1, 200, -1.0, 1.0); - m_MDT_residuals_ml1[station_identifier - ]->SetXTitle("r (mm)"); - m_MDT_residuals_ml1[station_identifier - ]->SetYTitle("residual (mm)"); - - m_MDT_residuals_ml2[station_identifier] = - new TH2F("MDT_residuals_ml2", - "MDT residuals in multilayer 2", - 302, -15.1, 15.1, 200, -1.0, 1.0); - m_MDT_residuals_ml2[station_identifier - ]->SetXTitle("r (mm)"); - m_MDT_residuals_ml2[station_identifier - ]->SetYTitle("residual (mm)"); - - m_MDT_t0_refinement[station_identifier] = - new TH1F("MDT_t0_refinement", - "#Delta t_{0} from Segment Fit", - 901, -150.5, 150.5); - m_MDT_t0_refinement[station_identifier - ]->SetXTitle("#Delta t_{0} (ns)"); - m_MDT_t0_refinement[station_identifier - ]->SetYTitle("entries (1/ns)"); - - if(!m_refine_t0) - { - m_MDT_t_refined[station_identifier] = new - TH1F("m_MDT_t_unrefined", - "Segment MDT t without t0 refinement", - 2*4096+1, -4096.5*0.78125, 4096.5*0.78125); - - } - if (m_refine_t0) { - m_MDT_t_refined[station_identifier] = new - TH1F("m_MDT_t_refined", - "Segment MDT t t0 refined", - 2*4096+1, -4096.5*0.78125, 4096.5*0.78125); - - m_MDT_residuals_t0_refined[station_identifier] = - new TH2F("MDT_residuals_t0_refined", - "MDT residuals after t_{0} refinement", - 152, -0.1, 15.1, 200, -1.0, 1.0); - m_MDT_residuals[station_identifier - ]->SetXTitle("r (mm)"); - m_MDT_residuals[station_identifier - ]->SetYTitle("residual (mm)"); - - m_MDT_residuals_t0_refined_gt4hits[station_identifier] = - new TH2F("MDT_residuals_t0_refined_gt4hits", - "MDT residuals after t_{0} refinement for segments with more than 4 hits", - 152, -0.1, 15.1, 200, -1.0, 1.0); - m_MDT_residuals[station_identifier - ]->SetXTitle("r (mm)"); - m_MDT_residuals[station_identifier - ]->SetYTitle("residual (mm)"); - } - - m_tfile->cd(".."); - - return; - -} - - -inline double NtupleControlHistogramsTool :: getChi2(const TF1 *fun, const TH1F *hist) const - { - double chi2=0; - int n_bins_used=0; - Double_t x_min, x_max; - fun->GetRange(x_min, x_max); - for(int i=1; i<=hist->GetNbinsX(); i++) - { - double x=hist->GetBinCenter(i); - if(x<x_min || x>x_max) continue; - double diff=hist->GetBinContent(i) - fun->Eval(x); - double error=hist->GetBinError(i); - if(error<1.0) continue; - chi2+=(diff*diff)/(error*error); - n_bins_used++; - } - if(n_bins_used==0) return 9e9; - return chi2/n_bins_used; - } - - -inline double NtupleControlHistogramsTool :: getResidualChi2(TProfile *px) const - { -//loop over all bins - double chi2=0.0; - int n_bins_used=0; - for(int i=1; i<=px->GetNbinsX(); i++) - { - if(px->GetBinCenter(i)<1.0 || px->GetBinCenter(i)>14) continue; - double x = px->GetBinContent(i); - double error = px->GetBinError(i); - if(error < 1e-6 ) continue; - chi2+=x*x/(error*error); - n_bins_used++; - } - if(n_bins_used==0) return 9e9; - return chi2/n_bins_used; - } diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/src/NtupleCurvedAutocalibrationTool.cxx b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/src/NtupleCurvedAutocalibrationTool.cxx deleted file mode 100644 index 65dcf0a15d52031ba3e7e600c76008bff50e6715..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/src/NtupleCurvedAutocalibrationTool.cxx +++ /dev/null @@ -1,139 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -//MdtCalibRt -#include "MdtCalibRt/RtCalibrationCurved.h" -#include "MdtCalibRt/RtCalibrationOutput.h" -//MdtCalibData -#include "MdtCalibData/RtFullInfo.h" - -//this -#include "MuonCalibStandAloneTools/NtupleCurvedAutocalibrationTool.h" -#include "MuonCalibStandAloneBase/NtupleStationId.h" -#include "MdtCalibIOSvc/MdtCalibInputSvc.h" - -namespace MuonCalib { - -NtupleCurvedAutocalibrationTool :: NtupleCurvedAutocalibrationTool(const std::string& t, const std::string& n, const IInterface* p): - AthAlgTool(t, n, p), - m_autocalibration(NULL), - m_rt_accuracy(0.5), - m_func_type("LEGENDRE"), - m_order(15), - m_fix_min(true), - m_fix_max(false), - m_max_it(100), - m_force_mono(false), - m_control_histograms(false), - m_calib_input_svc("MdtCalibInputSvc", n), - m_failed(false), - m_parabolic_extrapolation(false), - m_smoothing(false), - m_multilayer_rt_difference(false) - { - declareInterface< NtupleCalibrationTool >(this); - declareProperty("Accuracy", m_rt_accuracy); - declareProperty("FunctionType", m_func_type); - declareProperty("FunctionOrder", m_order); - declareProperty("FixMin", m_fix_min); - declareProperty("FixMax", m_fix_max); - declareProperty("MaximumIterations", m_max_it); - declareProperty("ForceMonotonous", m_force_mono); - declareProperty("ControlHistograms", m_control_histograms); - declareProperty("ParabolicExtrapolation", m_parabolic_extrapolation); - declareProperty("ConventionalSmoothing", m_smoothing); - declareProperty("MultilayerRtScale", m_multilayer_rt_difference); - declareProperty("MdtCalibInputSvc", m_calib_input_svc); - } - -StatusCode NtupleCurvedAutocalibrationTool :: initialize() - { - ATH_MSG_INFO( "initialize()" ); -//interpret functino type - if(m_func_type == "LEGENDRE") - { - m_func_type_num = 1; - } - else if (m_func_type == "CHEBYSHEV") - { - m_func_type_num = 2; - } - else if (m_func_type == "POLYGON") - { - m_func_type_num = 3; - } - else - { - ATH_MSG_FATAL( "Invalid function type '" << m_func_type << "'!" ); - return StatusCode ::FAILURE; - } - if(m_force_mono) - { - ATH_MSG_INFO( "Forcing monotonous rt-relation" ); - } -//get pointer to Calibration input service - ATH_CHECK( m_calib_input_svc.retrieve() ); - setRegion(); - return StatusCode :: SUCCESS; - } - -void NtupleCurvedAutocalibrationTool :: setRegion() - { -//retrieve rt-relationid - const IRtRelation *rt_relation(m_calib_input_svc->GetRtRelation()); - if(rt_relation == NULL) - { - ATH_MSG_FATAL( "No rt-relation stored for this region!" ); - return; - } -//create objects - ATH_MSG_INFO( "Creating RtCalibrationCurved!" ); - m_autocalibration = new RtCalibrationCurved("RT", m_rt_accuracy, - m_func_type_num, m_order, - m_fix_min, m_fix_max, m_max_it, - m_parabolic_extrapolation, - m_smoothing, - m_multilayer_rt_difference); - ATH_MSG_INFO( "setInput!" ); - m_autocalibration->setInput(new RtCalibrationOutput(rt_relation, new RtFullInfo())); - if(m_force_mono) - { - m_autocalibration->forceMonotony(); - } - if(m_control_histograms) - { - m_autocalibration-> switch_on_control_histograms("CurvedAutocalibration.root"); - } - } - -StatusCode NtupleCurvedAutocalibrationTool :: analyseSegments(const std::vector<MuonCalibSegment *> & segemnts) - { - if(m_autocalibration == NULL) - { - ATH_MSG_FATAL( "Algorithm not created!" ); - m_failed=true; - return StatusCode::FAILURE; - } - if(m_autocalibration->analyseSegments(segemnts)==NULL) - { - m_autocalibration->switch_off_control_histograms(); - m_failed=true; - return StatusCode :: FAILURE; - } - m_autocalibration->switch_off_control_histograms(); - return StatusCode::SUCCESS; - } - -const IMdtCalibrationOutput * NtupleCurvedAutocalibrationTool :: getResults() const - { - if(m_autocalibration == NULL) - { - ATH_MSG_FATAL( "Algorithm not created!" ); - return NULL; - } - if (m_failed) return NULL; - return m_autocalibration->getResults(); - } - -} diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/src/NtupleDBCheckTool.cxx b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/src/NtupleDBCheckTool.cxx deleted file mode 100644 index 75eabd82d7dc1c6a7bb8ffffa6d062d3b53ebbb1..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/src/NtupleDBCheckTool.cxx +++ /dev/null @@ -1,107 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -//this -#include "MuonCalibStandAloneTools/NtupleDBCheckTool.h" - -//MdtCalibIoSvc -#include "MdtCalibIOSvc/MdtCalibInputSvc.h" - -//MuonCalibEventBase -#include "MuonCalibEventBase/MuonCalibSegment.h" -#include "MuonCalibEventBase/MdtCalibHitBase.h" - -//MuonCalibIdentifier -#include "MuonCalibIdentifier/MuonFixedId.h" - -//MuonCalibStandAloneBase -#include "MuonCalibStandAloneBase/NtupleStationId.h" -#include "MuonCalibStandAloneBase/MdtStationT0Container.h" -# -//MdtCalibIOSvc -#include "MdtCalibIOSvc/MdtCalibInputSvc.h" - - -//MdtCalibData -#include "MdtCalibData/IRtRelation.h" - -namespace MuonCalib { - -NtupleDbCheckTool::NtupleDbCheckTool(const std::string & t, const std::string & n, const IInterface * p) - : AthAlgTool(t, n, p), m_input_service("MdtCalibInputSvc", n) - { - declareProperty("MdtCalibInputSvc", m_input_service); - declareInterface< NtupleCalibrationTool >(this); - } - - -NtupleDbCheckTool::~NtupleDbCheckTool() - { - } - -StatusCode NtupleDbCheckTool::initialize(void) - { - m_outfile = new TFile("NtupleDbCheckTool.root", "RECREATE"); - m_outtree = new TTree("tree", "tree"); - - m_outtree->Branch("station", &m_station, "station/I"); - m_outtree->Branch("eta", &m_eta, "eta/I"); - m_outtree->Branch("phi", &m_phi, "phi/I"); - m_outtree->Branch("ntuple_t0", &m_ntuple_t0, "ntuple_t0/D"); - m_outtree->Branch("calib_t0", &m_calib_t0, "calib_t0/D"); - m_outtree->Branch("ntuple_r", &m_ntuple_r, "ntuple_r/D"); - m_outtree->Branch("calib_r", &m_calib_r, "calib_r/D"); -// calibration input service // - ATH_CHECK( m_input_service.retrieve() ); - return StatusCode::SUCCESS; - } - - -StatusCode NtupleDbCheckTool::handleEvent(const MuonCalibEvent & /*event*/, int /*evnt_nb*/, const std::vector<MuonCalibSegment *> & segments, unsigned int position) - { - for(unsigned int i=position; i<segments.size(); i++) - { - MuonCalibSegment seg(*segments[i]); - for(MuonCalibSegment::MdtHitCit it=segments[i]->mdtHOTBegin(); it!= segments[i]->mdtHOTEnd(); it++) - { - const MdtCalibHitBase *hit(*it); - const MuonFixedId &hit_id(hit->identify()); - const NtupleStationId st_id(hit_id); - m_station=st_id.GetStation(); - m_eta=st_id.GetEta(); - m_phi=st_id.GetPhi(); - m_ntuple_t0=hit->tubeT0(); - const MdtStationT0Container *t0(m_input_service->GetT0(st_id)); - if(t0!=NULL) - { - m_calib_t0 = t0->t0(hit_id.mdtMultilayer(), hit_id.mdtTubeLayer(), hit_id.mdtTube()); - } - else - { - m_calib_t0=9e9; - } - const IRtRelation *rt=m_input_service-> GetRtRelation(st_id); - if(rt!=NULL) - { - m_calib_r = std::abs(rt->radius(hit->driftTime())); - } - else - { - m_calib_r = 9e9; - } - m_ntuple_r = std::abs(hit->driftRadius()); - m_outtree->Fill(); - } - } - return StatusCode::SUCCESS; - } - -StatusCode NtupleDbCheckTool::finalize(void) - { - m_outfile->Write(); - m_outfile->Close(); - return StatusCode::SUCCESS; - } - -} //namespace MuonCalib diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/src/NtupleDisplayTool.cxx b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/src/NtupleDisplayTool.cxx deleted file mode 100644 index 8e247286f64ebc41be65bf9a66036ee37b09e809..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/src/NtupleDisplayTool.cxx +++ /dev/null @@ -1,748 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -// standard C++ // -#include <iostream> -#include <fstream> -#include <string> -#include <vector> -#include <cstdlib> -#include <sstream> - -// MuonReadoutGeometry // -#include "MuonReadoutGeometry/MdtReadoutElement.h" - -#include "MuonCalibITools/IIdToFixedIdTool.h" -#include "MdtCalibInterfaces/IMdtSegmentFitter.h" - -// MuonCalib // -#include "MuonCalibEventBase/MuonCalibRawHitCollection.h" -#include "MuonCalibEventBase/MuonCalibRawMdtHit.h" -#include "MuonCalibEventBase/MuonCalibSegment.h" -#include "MdtCalibFitters/QuasianalyticLineReconstruction.h" -#include "MdtCalibFitters/StraightPatRec.h" -#include "MuonCalibEventBase/MuonCalibEvent.h" - -// NtupleDisplayTool // -#include "MuonCalibStandAloneTools/NtupleDisplayTool.h" - -//this -#include "MuonCalibStandAloneBase/NtupleStationId.h" -#include "MuonCalibStandAloneBase/RegionSelectionSvc.h" - -//root -#include "TCanvas.h" -#include "TControlBar.h" -#include "TApplication.h" -#include "TLine.h" -#include "TPaveText.h" -#include "TLatex.h" - -// STL // -#include <string> - -namespace MuonCalib { - -//***************************************************************************** - -// constructor -NtupleDisplayTool::NtupleDisplayTool( const std::string& t, - const std::string& n, - const IInterface* p) : - AthAlgTool(t, n, p), - m_reg_sel_svc("RegionSelectionSvc", n){ - - declareInterface< NtupleCalibrationTool >(this); - declareProperty("RegionSelectionSvc", m_reg_sel_svc); - - //-----------------// - //-- Job Options --// - //-----------------// - - m_fitter_name = std::string("QuasianalyticLineReconstruction"); - declareProperty("fitterName", m_fitter_name); - - m_nb_hits = 5; - declareProperty("nSegmentHits", m_nb_hits); - - m_road_width = 2.0; - declareProperty("roadWidth", m_road_width); - - m_adc_cut = 50.; - declareProperty("adcCut", m_adc_cut); - - m_chosen_event = -1; - declareProperty("displayEvent", m_chosen_event); - - m_scalefactor = 1; - declareProperty("scaleDisplay", m_scalefactor); - -} - -//::::::::::::::::::::::: -//:: METHOD initialize :: -//::::::::::::::::::::::: - -StatusCode NtupleDisplayTool::initialize() { - - ATH_MSG_INFO( "Initializing NtupleDisplayTool" ); - - - //----------------------// - //-- Set the Graphics --// - //----------------------// - - m_root = new TApplication("m_root", 0, 0, NULL, 0); - m_canvas = NULL; - m_canvas_leg = NULL; - - m_bar = new TControlBar("vertical","Display Control"); - m_bar->AddButton(" Next Event ","gApplication->Terminate()", "Go to the next event"); - m_bar->AddButton("Exit",".qqqqqqq", "Exit athena"); - - - //-----------------------------// - //-- Get the StoreGate Stuff --// - //-----------------------------// - - ATH_CHECK(m_idHelperSvc.retrieve()); - - //retrieve detector manager from the conditions store - ATH_CHECK(m_DetectorManagerKey.initialize()); - - //retrieve fixed id tool - std::string idToFixedIdToolType("MuonCalib::IdToFixedIdTool"); - std::string idToFixedIdToolName("MuonCalib_IdToFixedIdTool"); - - ATH_CHECK( toolSvc()->retrieveTool(idToFixedIdToolType, idToFixedIdToolName, m_id_tool) ); - - //---------------// - //-- Variables --// - //---------------// - - m_qfitter = NULL; - - m_nb_multilayers = -1; - m_nb_layers = -1; - m_nb_tubes = -1; - - //vector of colors to be used - m_colors = std::vector<int>(5); - m_colors[0] = 3; //segment hit - m_colors[1] = 14; //raw hit - m_colors[2] = 1; //drift radius>14.6 - m_colors[3] = 2; //adc<m_adc_cut - m_colors[4] = 0; //drift time<0 - - // tube circles - m_tube_circle = std::vector< std::vector< std::vector<TubeCircle*> > >(2); //up to two multilayers - - for (unsigned int k=0; k<m_tube_circle.size(); k++) { - - m_tube_circle[k] = std::vector< std::vector<TubeCircle*> >(4); // up to four layers per multilayer - for (unsigned int l=0; l<m_tube_circle[k].size(); l++) { - - m_tube_circle[k][l] = std::vector<TubeCircle*>(72); // up to 72 tubes per layer - for (unsigned int m=0; m<m_tube_circle[k][l].size(); m++) { - - m_tube_circle[k][l][m] = new TubeCircle(m_colors,m_adc_cut); - - } - } - } - -//get region selection service - ATH_CHECK( m_reg_sel_svc.retrieve() ); - - return StatusCode::SUCCESS; - -} - -//***************************************************************************** - -//:::::::::::::::::::::::: -//:: METHOD handleEvent :: -//:::::::::::::::::::::::: - -StatusCode -NtupleDisplayTool::handleEvent( const MuonCalibEvent & event, - int eventnumber, - const std::vector<MuonCalibSegment *> &segments, - unsigned int position) { - - if(segments.size()<=position) return StatusCode::SUCCESS; - - MuonCalibSegment segment(*segments[position]); - - //if displaying only one event - if(m_chosen_event!=-1){ - if(eventnumber!=m_chosen_event){ - return StatusCode::SUCCESS; - } - } - - - //---------------// - //-- VARIABLES --// - //---------------// - - if(m_qfitter==NULL){ - if (m_fitter_name==std::string("QuasianalyticLineReconstruction")) { - m_qfitter = new QuasianalyticLineReconstruction(); - } - if (m_fitter_name==std::string("StraightPatRec")) { - m_qfitter = new StraightPatRec(); - } - if (m_fitter_name!=std::string("QuasianalyticLineReconstruction") && - m_fitter_name!=std::string("StraightPatRec")) { - ATH_MSG_FATAL( "Unknown track fitter!" ); - return StatusCode::FAILURE; - } - } - - - // station identifiers // - - MuonFixedId Mid((segment.mdtHOT()[0])->identify()); - - //this has to be set in order to get the m_detMgr->getMdtReadoutElement() method - //working correctly, otherwise also for the first multilayer, the second is returned - Mid.setMdtMultilayer(1); - - SG::ReadCondHandle<MuonGM::MuonDetectorManager> DetectorManagerHandle{m_DetectorManagerKey}; - const MuonGM::MuonDetectorManager* MuonDetMgr = DetectorManagerHandle.cptr(); - if(MuonDetMgr==nullptr){ - ATH_MSG_ERROR("Null pointer to the read MuonDetectorManager conditions object"); - return StatusCode::FAILURE; - } - - Identifier station_id = m_id_tool->fixedIdToId(Mid); - NtupleStationId st_id((segment.mdtHOT()[0])->identify()); - st_id.SetMultilayer(0); - if (!st_id.InitializeGeometry(m_idHelperSvc->mdtIdHelper(), MuonDetMgr)) - return StatusCode::SUCCESS; - - if(m_nb_multilayers<0){ - m_nb_multilayers = m_idHelperSvc->mdtIdHelper().numberOfMultilayers(station_id); - } - - - //----------------------------// - //-- Determine the Geometry --// - //----------------------------// - - double y_min(1e6); - double z_min(1e6); - double y_max(-1e6); - double z_max(-1e6); - - if(m_tube_circle_lin.size()<1){ - - //loop over multilayers - for (int multilayer=1; multilayer<m_nb_multilayers+1; multilayer++) { - - const MuonGM::MdtReadoutElement* MdtRoEl = - MuonDetMgr->getMdtReadoutElement( m_idHelperSvc->mdtIdHelper().channelID(station_id,multilayer,1,1) ); - - //loop over layers - for (int layer=st_id.LayerMin(multilayer-1); layer<=st_id.LayerMax(multilayer-1); layer++) { - - for (int k=st_id.TubeMin(multilayer-1); k<=st_id.TubeMax(multilayer-1); k++) { - - Amg::Vector3D TubePos = - MdtRoEl->GlobalToAmdbLRSCoords(MdtRoEl->tubePos(multilayer,layer,k)); - - //set the tube position - m_tube_circle[multilayer-1][layer-1][k-1] ->setPosition(TubePos); - m_tube_circle[multilayer-1][layer-1][k-1]->multilayer= multilayer; - m_tube_circle[multilayer-1][layer-1][k-1]->layer= layer; - m_tube_circle[multilayer-1][layer-1][k-1]->tube= k; - - m_tube_circle_lin.push_back( m_tube_circle[multilayer-1][layer-1][k-1]); - - //determine the size of the chamber - if(TubePos.y()<y_min){ - y_min = TubePos.y(); - } - if(TubePos.z()<z_min){ - z_min = TubePos.z(); - } - if(TubePos.y()>y_max){ - y_max = TubePos.y(); - } - if(TubePos.z()>z_max){ - z_max = TubePos.z(); - } - - } //for: tube - - } //for: layers - - } //for: multilayers - - } //if: size<1 - - //set the display canvas - if(m_canvas==NULL){ - - double scale(1); - if(m_nb_tubes<60){ - scale = 0.85; - } - else{ - scale = 0.56; - } - scale *= m_scalefactor; - - int canvas_size_x = std::round((y_max - y_min)*scale); //1200x500 72er 0.56, 0.71 //48er 0.85, 1.08 - int canvas_size_y = std::round((z_max - z_min)*scale*1.2); - m_canvas = new TCanvas("mdt_display", - "MDT Chamber Display" , - canvas_size_x,canvas_size_y); - m_canvas->Range(y_min-20, z_min-20.0, y_max+20.0, z_max+20.0); - m_canvas->SetFillColor(0); - m_canvas->Clear(); - m_canvas->Update(); - - //draw the control bar - m_bar->Show(); - } - - - //------------------// - //-- Segment Hits --// - //------------------// - - //check if segment has at least m_nb_hits hits (set in the job options) - if(segment.mdtHitsOnTrack()<m_nb_hits){ - return StatusCode::SUCCESS; - } - - for (unsigned int k=0; k<segment.mdtHitsOnTrack(); k++) { - - MuonFixedId id((segment.mdtHOT()[k])->identify()); - - int ml(id.mdtMultilayer()); - int ly(id.mdtTubeLayer()); - int tu(id.mdtTube()); - double radius((segment.mdtHOT()[k])->driftRadius()); - double time((segment.mdtHOT()[k])->driftTime()); - double adc((segment.mdtHOT()[k])->adcCount()); - - m_tube_circle[ml-1][ly-1][tu-1]->setSegmentHit(radius, time, adc); - - } - - - //--------------// - //-- Raw Hits --// - //--------------// - - const MuonCalibRawHitCollection *raw_hits(event.rawHitCollection()); - - for (MuonCalibRawHitCollection::MuonCalibRawMdtHitVecCit it= - raw_hits->rawMdtHitCollectionBegin(); - it!=raw_hits->rawMdtHitCollectionEnd(); ++it) { - - MuonCalibRawMdtHit *hit = *it; - MuonFixedId id(hit->identify()); - - if (m_reg_sel_svc->isInRegion(hit->identify())){ - - int ml(id.mdtMultilayer()); - int ly(id.mdtTubeLayer()); - int tu(id.mdtTube()); - double radius(hit->driftRadius()); - double time(hit->driftTime()); - double adc(hit->adcCount()); - - m_tube_circle[ml-1][ly-1][tu-1]->setRawHit(radius, time, adc); - - } - } - - - //-----------// - //-- Track --// - //-----------// - - //get track from segment - MTStraightLine track = MTStraightLine(segment.position(),segment.direction(), - Amg::Vector3D(0,0,0), Amg::Vector3D(0,0,0) - ); - - double y1, z1, y2, z2; - z1 = z_min-15; - z2 = z_max+15; - y1 = track.a_x2()*z1+track.b_x2(); - y2 = track.a_x2()*z2+track.b_x2(); - - TLine* line = new TLine(y1, z1, y2, z2); - line->SetLineWidth(2); - line->SetLineColor(m_colors.at(0)); - - //refit segment - bool fit_success(false); - if(m_qfitter) - { - m_qfitter->setRoadWidth(m_road_width); //0.65 - m_qfitter->switchOnRefit(); - - - fit_success = m_qfitter->fit(segment); - } - MTStraightLine track_refit(segment.position(),segment.direction(), - Amg::Vector3D(0,0,0), Amg::Vector3D(0,0,0)); - - y1 = track_refit.a_x2()*z1+track_refit.b_x2(); - y2 = track_refit.a_x2()*z2+track_refit.b_x2(); - - TLine* line_refit = new TLine(y1, z1, y2, z2); - line_refit->SetLineWidth(2); - line_refit->SetLineColor(4); - - - //------------------// - //-- Build Legend --// - //------------------// - - if(m_canvas_leg==NULL){ - - - int c_x_max = 220; - int c_y_max = 260; - - double x_max = 1.6*c_x_max; - double y_max = 1.6*c_y_max; - - m_canvas_leg = new TCanvas("mdt_display_legend", "Display Legend",c_x_max,c_y_max); - m_canvas_leg->Range(0, 0, x_max, y_max); - m_canvas_leg->SetFillColor(0); - m_canvas_leg->Clear(); - m_canvas_leg->Update(); - - int offset = 40; - int leftspace = 40; - int tleftspace = 70; - double tsize = 0.065; - - TubeCircle* circle1 = new TubeCircle(m_colors,m_adc_cut); - circle1->setPosition(Amg::Vector3D(0,leftspace,y_max-offset)); - circle1->setSegmentHit(11, 1, 2*m_adc_cut); - circle1->Draw(); - - TubeCircle* circle2 = new TubeCircle(m_colors,m_adc_cut); - circle2->setPosition(Amg::Vector3D(0,leftspace,y_max-2*offset)); - circle2->setRawHit(11, 1, 2*m_adc_cut); - circle2->Draw(); - - TubeCircle* circle3 = new TubeCircle(m_colors,m_adc_cut); - circle3->setPosition(Amg::Vector3D(0,leftspace,y_max-4*offset)); - circle3->setSegmentHit(20, 1, 2*m_adc_cut); - circle3->Draw(); - - TubeCircle* circle4 = new TubeCircle(m_colors,m_adc_cut); - circle4->setPosition(Amg::Vector3D(0,leftspace,y_max-5*offset)); - circle4->setSegmentHit(14.6, -1, 2*m_adc_cut); - circle4->Draw(); - - TubeCircle* circle5 = new TubeCircle(m_colors,m_adc_cut); - circle5->setPosition(Amg::Vector3D(0,leftspace,y_max-6*offset)); - circle5->setSegmentHit(14.6, 1, 0.5*m_adc_cut); - circle5->Draw(); - m_canvas_leg->Update(); - - TLine* line_leg = new TLine(leftspace-15,y_max-8*offset,leftspace+15,y_max-8*offset); - line_leg->SetLineWidth(2); - line_leg->SetLineColor(m_colors.at(0)); - line_leg->Draw(); - - TLine* line_refit_leg = new TLine(leftspace-15,y_max-9*offset,leftspace+15,y_max-9*offset); - line_refit_leg->SetLineWidth(2); - line_refit_leg->SetLineColor(line_refit->GetLineColor()); - line_refit_leg->Draw(); - - TLine* line1_leg = new TLine(0.5*leftspace,y_max-3*offset,x_max-0.5*leftspace,y_max-3*offset); - line1_leg->SetLineWidth(1); - line1_leg->SetLineColor(16); - line1_leg->SetLineStyle(2); - line1_leg->Draw(); - - TLine* line2_leg = new TLine(0.5*leftspace,y_max-7*offset,x_max-0.5*leftspace,y_max-7*offset); - line2_leg->SetLineWidth(1); - line2_leg->SetLineColor(16); - line2_leg->SetLineStyle(2); - line2_leg->Draw(); - - - TPaveText* text1 = new TPaveText(tleftspace, y_max-offset-15, x_max, y_max-offset+15); - text1->SetFillColor(0); // text is black on white - text1->SetTextSize(tsize); - text1->SetTextAlign(12); - text1->SetBorderSize(0); - text1->AddText("Segment Hit"); - text1->Draw(); - - TPaveText* text2 = new TPaveText(tleftspace, y_max-2*offset-15, x_max, y_max-2*offset+15); - text2->SetFillColor(0); - text2->SetTextSize(tsize); - text2->SetTextAlign(12); - text2->SetBorderSize(0); - text2->AddText("Raw Hit"); - text2->Draw(); - - TPaveText* text3 = new TPaveText(tleftspace, y_max-4*offset-15, x_max, y_max-4*offset+15); - text3->SetFillColor(0); - text3->SetTextSize(tsize); - text3->SetTextAlign(12); - text3->SetBorderSize(0); - text3->AddText("Drift Radius > 14.6 mm"); - text3->Draw(); - - TPaveText* text4 = new TPaveText(tleftspace, y_max-5*offset-15, x_max, y_max-5*offset+15); - text4->SetFillColor(0); - text4->SetTextSize(tsize); - text4->SetTextAlign(12); - text4->SetBorderSize(0); - text4->AddText("Drift Time < 0"); - text4->Draw(); - - TPaveText* text5 = new TPaveText(tleftspace, y_max-6*offset-15, x_max, y_max-6*offset+15); - text5->SetFillColor(0); - text5->SetTextSize(tsize); - text5->SetTextAlign(12); - text5->SetBorderSize(0); - text5->AddText(Form("ADC < %.1f",m_adc_cut)); - text5->Draw(); - - TPaveText* text6 = new TPaveText(tleftspace, y_max-8*offset-15, x_max, y_max-8*offset+15); - text6->SetFillColor(0); - text6->SetTextSize(tsize); - text6->SetTextAlign(12); - text6->SetBorderSize(0); - text6->AddText("Track (Segment)"); - text6->Draw(); - - TPaveText* text7 = new TPaveText(tleftspace, y_max-9*offset-15, x_max, y_max-9*offset+15); - text7->SetFillColor(0); - text7->SetTextSize(tsize); - text7->SetTextAlign(12); - text7->SetBorderSize(0); - text7->AddText("Refitted Track"); - text7->Draw(); - - } - - m_canvas_leg->Update(); - m_canvas->cd(); - - - //---------------------// - //-- Draw Everything --// - //---------------------// - - ATH_MSG_INFO( "Event: " << eventnumber ); - - for (unsigned int k=0; k<m_tube_circle_lin.size(); k++) { - m_tube_circle_lin[k]->Draw(); - if(m_tube_circle_lin[k]->tube==1) - { - std::ostringstream ostr; - ostr << m_tube_circle_lin[k]->multilayer << "/" << m_tube_circle_lin[k]->layer << "/" <<m_tube_circle_lin[k]->tube; - TLatex *txt=new TLatex( m_tube_circle_lin[k]->GetX1() - 2* m_tube_circle_lin[k]->GetR1(), m_tube_circle_lin[k]->GetY1(), ostr.str().c_str()); - txt->Draw(); - ATH_MSG_INFO( ostr.str() ); - } - - } - line->Draw(); - - if(fit_success){ - line_refit->Draw(); - } - else{ - ATH_MSG_WARNING( "refit not successfull!" ); - } - - m_canvas->Update(); - m_root->Run(true); //run the TApplication - - //------------------// - //-- Reset Canvas --// - //------------------// - - //reset tube circles - for (unsigned int k=0; k<m_tube_circle_lin.size(); k++) { - m_tube_circle_lin[k]->reset(); - } - m_canvas->Clear(); - - - return StatusCode::SUCCESS; - -} - - -//***************************************************************************** - -//:::::::::::::::::::::::::::: -//:: METHOD analyseSegments :: -//:::::::::::::::::::::::::::: - -StatusCode -NtupleDisplayTool::analyseSegments(const std::vector<MuonCalibSegment *> & /*segemnts*/) { - - return StatusCode::SUCCESS; - -} - -//***************************************************************************** - -//:::::::::::::::::::::: -//:: CLASS TubeCircle :: -//:::::::::::::::::::::: - -TubeCircle::TubeCircle(void) : TEllipse(){ - - layer=0; multilayer=0; tube=0; - - this->reset(); - this->setColors(std::vector<int>(5,1)); - this->setAdcCut(50.); - - -} - -TubeCircle::TubeCircle(std::vector<int> colors, double adc_cut) : TEllipse(){ - layer=0; multilayer=0; tube=0; - - this->reset(); - this->setColors(colors); - this->setAdcCut(adc_cut); -} - - -TubeCircle::TubeCircle(Amg::Vector3D TubePos, std::vector<int> colors, double adc_cut) : TEllipse(){ - - layer=0; multilayer=0; tube=0; - this->reset(); - this->setPosition(TubePos); - this->setColors(colors); - this->setAdcCut(adc_cut); - -} - -void -TubeCircle::reset(void){ - - m_used_flag=0; - m_rawhit_flag=0; - m_segmenthit_flag=0; - - this->SetR1(14.6); - this->SetR2(14.6); - this->SetPhimin(0.0); - this->SetPhimax(360.0); - this->SetFillColor(0); - this->SetLineColor(1); - this->SetLineWidth(2); - -} - -void -TubeCircle::setPosition(Amg::Vector3D TubePos){ - - this->SetX1(TubePos.y()); - this->SetY1(TubePos.z()); - -} - -void -TubeCircle::setColors(std::vector<int> colors){ - - m_colors = colors; -} - -void -TubeCircle::setAdcCut(double adc_cut){ - - m_adc_cut = adc_cut; -} - - -void -TubeCircle::setUsedFlag(bool flag){ - - m_used_flag = flag; -} - -bool -TubeCircle::isUsed(void){ - - return m_used_flag; -} - -void -TubeCircle::setSegmentHit(double radius, double time, double adc){ - - m_segmenthit_flag = true; - this->setRadius(radius, time, adc, 0); - -} - -bool -TubeCircle::hasSegmentHit(void){ - - return m_segmenthit_flag; -} - -void -TubeCircle::setRawHit(double radius, double time, double adc){ - - m_rawhit_flag = true; - - if(!this->hasSegmentHit()){ - this->setRadius(radius, time, adc, 1); - } -} - -bool -TubeCircle::hasRawHit(void){ - - return m_rawhit_flag; -} - -void -TubeCircle::setRadius(double radius, double time, double adc, int hit){ - - if(adc<m_adc_cut){ - this->SetFillColor(m_colors.at(3)); - this->SetLineColor(m_colors.at(hit)); - } - else if(time<0){ - this->SetFillColor(m_colors.at(4)); - this->SetLineColor(m_colors.at(hit)); - } - else if(radius>14.6){ - this->SetFillColor(m_colors.at(hit)); - this->SetLineColor(m_colors.at(2)); - } - else{ - this->SetR1(radius); - this->SetR2(radius); - this->SetLineWidth(0); - this->SetLineColor(m_colors.at(hit)); - this->SetFillColor(m_colors.at(hit)); - } - - //set minimum visible radius - if(radius<2){ - this->SetR1(2); - this->SetR2(2); - } - -} - -} - diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/src/NtupleIntegrationTool.cxx b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/src/NtupleIntegrationTool.cxx deleted file mode 100644 index 9261a6a83b8cf060e242e821022e4c70632c05b8..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/src/NtupleIntegrationTool.cxx +++ /dev/null @@ -1,92 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -//RtCalibrationIntegration -#include "MdtCalibRt/RtCalibrationIntegration.h" - -//root -#include "TFile.h" - -//this -#include "MuonCalibStandAloneTools/NtupleIntegrationTool.h" -#include "MuonCalibStandAloneBase/NtupleStationId.h" - -namespace MuonCalib { - - NtupleIntegrationTool::NtupleIntegrationTool(const std::string& t, - const std::string& n, - const IInterface* p):AthAlgTool(t, n, p), - m_t_max_int(710.0), - m_has_close_hits(false), - m_inner_tube_radius(14.6), - m_lower_extrapolation_radius(13.0), - m_upper_extrapolation_radius(14.0), -m_multilayer_tmax_diff(false), -p_file(NULL) - { - declareInterface< NtupleCalibrationTool >(this); - declareProperty("TMaxInt", m_t_max_int); - declareProperty("HaseCloseHits",m_has_close_hits); - declareProperty("InnerTubeRadius", m_inner_tube_radius); - declareProperty("LowerExtrapolationRadius", m_lower_extrapolation_radius); - declareProperty("UpperExtrapolationRadius", m_upper_extrapolation_radius); - declareProperty("StoreMultilayerTmaxDiff", m_multilayer_tmax_diff); - } - - -StatusCode NtupleIntegrationTool::initialize() - { - ATH_MSG_INFO( "Initializing Integration Tool" ); -//create algorithm - m_integration = new RtCalibrationIntegration("IM", - m_has_close_hits, - m_inner_tube_radius, - m_lower_extrapolation_radius, - m_upper_extrapolation_radius, m_multilayer_tmax_diff); - p_file = new TFile("Integration.root", "RECREATE"); - return StatusCode :: SUCCESS; - } - - -StatusCode NtupleIntegrationTool::handleEvent(const MuonCalibEvent &/*event*/, int /*evnt_nr*/, const std::vector<MuonCalibSegment *> &segments, unsigned int position) - { - if(m_integration == NULL) - { - ATH_MSG_FATAL( "Not correctly initialized!" ); - return StatusCode :: FAILURE; - } - for(unsigned int i=position; i<segments.size(); i++) - { - if(!m_integration->handleSegment((*segments[i]))) return StatusCode::FAILURE; - } - return StatusCode::SUCCESS; - } - - - -StatusCode NtupleIntegrationTool::analyseSegments(const std::vector<MuonCalibSegment *> & /*segemnts*/) - { - if(m_integration == NULL) - { - ATH_MSG_FATAL( "Not correctly initialized!" ); - return StatusCode :: FAILURE; - } - if(m_integration->analyse()) - return StatusCode :: SUCCESS; - else - return StatusCode :: FAILURE; - } - -const IMdtCalibrationOutput * NtupleIntegrationTool :: getResults() const - { - return m_integration->getResults(); - } - - -StatusCode NtupleIntegrationTool :: finalize() - { - p_file->Write(); - return StatusCode::SUCCESS; - } -} diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/src/NtupleMTT0Tool.cxx b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/src/NtupleMTT0Tool.cxx deleted file mode 100644 index cc950c792f70415213a555970e34416c128661fd..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/src/NtupleMTT0Tool.cxx +++ /dev/null @@ -1,173 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -//MdtCalibData -#include "MdtCalibData/MdtTubeFitContainer.h" - -//MdtCalibT0 -#include "MdtCalibT0/T0CalibrationOutput.h" -#include "MdtCalibT0/HistogramId.h" - -//this -#include "MuonCalibStandAloneTools/NtupleMTT0Tool.h" -#include "MuonCalibStandAloneBase/NtupleStationId.h" -#include "MuonCalibStandAloneBase/RegionSelectionSvc.h" - - -namespace MuonCalib{ - -NtupleMTT0Tool::NtupleMTT0Tool(const std::string& t, const std::string& n, const IInterface* p) - : AthAlgTool(t, n, p), p_alg(NULL), m_reg_sel_svc("RegionSelectionSvc", n) - { - declareInterface< NtupleCalibrationTool >(this) ; - m_settings.AddFitfun()=true; - m_settings.DrawDebugGraphs()=true; - m_n_bins_neg=1000; - m_n_bins_pos=2000; - m_min_entries_time=10000; - m_min_entries_adc=1000; - declareProperty("AddFitFun", m_settings.AddFitfun()); - declareProperty("DrawDebugGraphs", m_settings.DrawDebugGraphs()); - declareProperty("NumberOfNegativeBins", m_n_bins_neg); - declareProperty("NumberOfPositiveBins", m_n_bins_pos); - declareProperty("GroupBy", m_group_by); - declareProperty("ADCGroupBy", m_adc_group_by); - m_use_top_chi2=true; - declareProperty("UseTopChi2", m_use_top_chi2); - m_scramble_thresh=2.0; - declareProperty("ScrambleThreshold", m_scramble_thresh); - m_sclicing_thresh=3.0; - declareProperty("SclicingThreshold", m_sclicing_thresh); - declareProperty("MinumumEntriesPerTimeFit", m_min_entries_time); - declareProperty("MinumumEntriesPerADCFit", m_min_entries_adc); - m_correct_rel_t0=true; - declareProperty("CorrectForRelativeT0", m_correct_rel_t0); - declareProperty("RegionSelectionSvc", m_reg_sel_svc); - } - - - -StatusCode NtupleMTT0Tool::initialize() - { - ATH_MSG_INFO( "Initializing MT T0 Tool" ); -//complete settings class - m_settings.NBinsTime()=m_n_bins_neg+m_n_bins_pos; - m_settings.TimeMin()= (25.0/32.0)*(0.5 - m_n_bins_neg); - m_settings.TimeMax()= (25.0/32.0)*(0.5 + m_n_bins_pos); - m_settings.T0Settings()->UseTopChi2() = m_use_top_chi2; - m_settings.T0Settings()->ScrambleThreshold() = m_scramble_thresh; - m_settings.T0Settings()->SlicingThreshold() = m_sclicing_thresh; - m_settings.T0Settings()->CorrectRelT0s() = m_correct_rel_t0; - m_settings.MinEntriesTime() = m_min_entries_time; - m_settings.MinEntriesADC() = m_min_entries_adc; - -//evaluate sort by arguments - m_sort_by.resize(m_group_by.size()); - for(unsigned int i=0; i<m_group_by.size(); i++) - { - if(!eval_group_by(m_group_by[i], m_sort_by[i])) - { - ATH_MSG_FATAL( "Invalid GroupBy option!" ); - return StatusCode :: FAILURE; - } - } - m_adc_sort_by.resize(m_adc_group_by.size()); - for(unsigned int i=0; i<m_adc_group_by.size(); i++) - { - if(!eval_group_by(m_adc_group_by[i], m_adc_sort_by[i])) - { - ATH_MSG_FATAL( "Invalid ADCGroupBy option!" ); - return StatusCode :: FAILURE; - } - } -//get region selection service - ATH_CHECK( m_reg_sel_svc.retrieve() ); - setRegion(); - return StatusCode :: SUCCESS; - } - -StatusCode NtupleMTT0Tool::handleEvent(const MuonCalibEvent &/*event*/, int /*evnt_nr*/, const std::vector<MuonCalibSegment *> &segments, unsigned int position) - { - if(p_alg == NULL) - { - ATH_MSG_FATAL( "Not correctly initialized!" ); - return StatusCode :: FAILURE; - } - for(unsigned int i=position; i<segments.size(); i++) - { - if(!p_alg->handleSegment((*segments[i]))) return StatusCode::FAILURE; - } - return StatusCode::SUCCESS; - } - - - -StatusCode NtupleMTT0Tool::analyseSegments(const std::vector<MuonCalibSegment *> & /*segemnts*/) - { - if(p_alg == NULL) - { - ATH_MSG_FATAL( "Not correctly initialized!" ); - return StatusCode :: FAILURE; - } - if(p_alg->analyse()) - return StatusCode :: SUCCESS; - else - return StatusCode :: FAILURE; - } - - -void NtupleMTT0Tool::setRegion() - { - p_alg = new T0CalibrationMT("MT_t0_fitter", &m_settings, m_sort_by, m_adc_sort_by); - T0CalibrationOutput input(NULL); - for(std::vector<MuonCalib :: NtupleStationId> :: const_iterator it=m_reg_sel_svc->GetStationsInRegions().begin(); it!=m_reg_sel_svc->GetStationsInRegions().end(); it++) - { - input.GetMap()[*it]=new MdtTubeFitContainer(it->regionId(), 2, 4, 78); - } - p_alg->setInput(&input); - } - -const IMdtCalibrationOutput * NtupleMTT0Tool::getResults() const - { - if(p_alg == NULL) - { - ATH_MSG_FATAL( "Not correctly initialized!" ); - return NULL; - } - return p_alg->getResults(); - } - -inline bool NtupleMTT0Tool::eval_group_by(const std::string & group_by, int & sort_by) - { - sort_by=-99; - if(group_by == "TUBE") - { - sort_by = HistogramId :: TUBE; - return true; - } - if(group_by == "LAYER") - { - sort_by = HistogramId :: LAYER; - return true; - } - if(group_by == "MULTILAYER") - { - sort_by = HistogramId :: MULTILAYER; - return true; - } - if(group_by == "CHAMBER") - { - sort_by = HistogramId :: CHAMBER; - return true; - } - if(group_by == "MEZZ_CARD") - { - sort_by = HistogramId :: MEZZ_CARD; - return true; - } - return false; - } - - -} diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/src/NtupleResidualTool.cxx b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/src/NtupleResidualTool.cxx deleted file mode 100644 index ce2572d5f28d96a92a64fe9c6351941f1e9f7f59..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/src/NtupleResidualTool.cxx +++ /dev/null @@ -1,69 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -//MuonCalibEventBase -#include "MuonCalibEventBase/MuonCalibSegment.h" -#include "MuonCalibEventBase/MdtCalibHitBase.h" - -//MdtCalibFitters -#include "MdtCalibFitters/QuasianalyticLineReconstruction.h" - - -//this -#include "MuonCalibStandAloneTools/NtupleResidualTool.h" -//root -#include "TFile.h" -#include "TH2.h" -#include "TH1.h" - -namespace MuonCalib{ - -NtupleResidualTool::NtupleResidualTool(const std::string& t, const std::string& n, const IInterface* p): AthAlgTool(t, n, p) - { - declareInterface< NtupleCalibrationTool >(this) ; - } - - - -StatusCode NtupleResidualTool::initialize() - { - m_outfile=new TFile("Residuals.root", "RECREATE"); - m_residual_distribution = new TH2F ("residual", "residuals" , 152, -0.1, 15.1, 200, -1.0, 1.0); - m_r_spec=new TH1F("r_spec", "r_spec", 100, 0, 15); - m_chi2=new TH1F("chi2", "chi^{2}", 100, 0, 50); - m_nhits=new TH1F("nhits", "nhits", 20, -0.5, 19.5); - m_fitter=new QuasianalyticLineReconstruction(1.0); - m_fitter->switchOnRefit(); - return StatusCode::SUCCESS; - } - - -StatusCode NtupleResidualTool::handleEvent(const MuonCalibEvent &/*event*/, int /*evnt_nr*/, const std::vector<MuonCalibSegment *> &segments, unsigned int position) - { -//loop on segewmnts - for(unsigned int i=position; i<segments.size(); i++) - { - m_fitter->fit(*(segments[i])); - //loop on hits - for(std::vector<const MdtCalibHitBase*>::const_iterator it = m_fitter->trackHits().begin(); it!=m_fitter->trackHits().end(); it++) - { - double track_residual(std::abs((*it)->signedDistanceToTrack()) - (*it)->driftRadius()); - m_residual_distribution -> Fill(static_cast<Axis_t>(std::abs((*it)->signedDistanceToTrack())), static_cast<Axis_t>(track_residual)); - m_r_spec->Fill( static_cast<Axis_t>((*it)->driftRadius())); - } - m_chi2->Fill(segments[i]->chi2()); - m_nhits->Fill(segments[i]->hitsOnTrack()); - } - return StatusCode::SUCCESS; - } - -StatusCode NtupleResidualTool::finalize() - { - m_outfile->Write(); - return StatusCode::SUCCESS; - } - - - -} diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/src/NtupleResidualVsTimeTool.cxx b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/src/NtupleResidualVsTimeTool.cxx deleted file mode 100644 index 63e2406db9004e23dc7df47f63c00b977fea06da..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/src/NtupleResidualVsTimeTool.cxx +++ /dev/null @@ -1,103 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -//MuonCalibEventBase -#include "MuonCalibEventBase/MuonCalibSegment.h" -#include "MuonCalibEventBase/MdtCalibHitBase.h" -#include "MuonCalibEventBase/MuonCalibEvent.h" -#include "MuonCalibEventBase/MuonCalibEventInfo.h" - -//MdtCalibFitters -#include "MdtCalibFitters/StraightPatRec.h" -#include "MdtCalibFitters/CurvedPatRec.h" - -//this -#include "MuonCalibStandAloneTools/NtupleResidualVsTimeTool.h" -//root -#include "TFile.h" -#include "TH2.h" -#include "cmath" - -namespace MuonCalib{ - -NtupleResidualVsTimeTool::NtupleResidualVsTimeTool(const std::string& t, const std::string& n, const IInterface* p): AthAlgTool(t, n, p) - { - declareInterface< NtupleCalibrationTool >(this) ; - m_curved_segments=false; - declareProperty("CurvedSegment", m_curved_segments); - m_min_hits=5; - declareProperty("MinHits", m_min_hits); - m_last_lumiblock=std::pair<unsigned int, unsigned int>(0,0); - m_last_residual_distribution=NULL; - } - - - -StatusCode NtupleResidualVsTimeTool::initialize() - { - m_outfile=new TFile("Residuals.root", "RECREATE"); - if(m_curved_segments) - { - CurvedPatRec *cfitter=new CurvedPatRec(); - cfitter->setTimeOut(2); - m_fitter=cfitter; - } - else - { - m_fitter=new StraightPatRec(); - } - m_fitter->setRoadWidth(2.); - return StatusCode::SUCCESS; - } - - -StatusCode NtupleResidualVsTimeTool::handleEvent(const MuonCalibEvent &event, int /*evnt_nr*/, const std::vector<MuonCalibSegment *> &segments, unsigned int position) - { - std::pair<unsigned int, unsigned int> current(event.eventInfo().runNumber(), event.eventInfo().lumiBlock()); -//create new histogram if needed - if(current != m_last_lumiblock || !m_last_residual_distribution) - { - m_last_lumiblock=current; - std::map<std::pair<unsigned int, unsigned int> ,TH2F *>::iterator it=m_residual_distribution.find(m_last_lumiblock); - if(it==m_residual_distribution.end()) - { - std::ostringstream nm; - nm<<"residual_r"<<m_last_lumiblock.first<<"_lb"<<m_last_lumiblock.second; - m_last_residual_distribution = new TH2F(nm.str().c_str(), "", 15, 0, 15, 200, -1.0, 1.0); - m_residual_distribution[m_last_lumiblock] = m_last_residual_distribution; - } - else - { - m_last_residual_distribution=it->second; - } - } -//loop on segewmnts - for(unsigned int i=position; i<segments.size(); i++) - { - MuonCalibSegment *seg=segments[i]; - if(seg->hitsOnTrack() < static_cast<unsigned int>(m_min_hits)) - continue; - IMdtSegmentFitter::HitSelection sel(segments[i]->hitsOnTrack(), 0); - for(unsigned int j=0; j<seg->hitsOnTrack(); j++) - { - if(j>0) - sel[j-1]=0; - sel[j]=1; - m_fitter->fit(*seg, sel); - MdtCalibHitBase *hit(seg->mdtHOT()[j]); - m_last_residual_distribution->Fill(std::abs(hit->signedDistanceToTrack()) , hit->trackResidual()); - } - } - return StatusCode::SUCCESS; - } - -StatusCode NtupleResidualVsTimeTool::finalize() - { - m_outfile->Write(); - return StatusCode::SUCCESS; - } - - - -} diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/src/NtupleRunScanTool.cxx b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/src/NtupleRunScanTool.cxx deleted file mode 100644 index d05afe571c5bf431392a4771b2543422119e23fb..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/src/NtupleRunScanTool.cxx +++ /dev/null @@ -1,196 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -//c - c++ -#include "iostream" -#include "fstream" -#include "sstream" -#include "set" -#include <string.h> - -//root -#include "TFile.h" -#include "TTree.h" -#include "TNtuple.h" - -//MuonCalibEventBase -#include "MuonCalibEventBase/MuonCalibSegment.h" -#include "MuonCalibEventBase/MuonCalibEventInfo.h" -#include "MuonCalibEventBase/MuonCalibEvent.h" - -// MuonReadoutGeometry // -#include "MuonReadoutGeometry/MdtReadoutElement.h" - -//MuonCalibIdentifier -#include "MuonCalibIdentifier/MuonFixedId.h" - -//this -#include "MuonCalibStandAloneTools/NtupleRunScanTool.h" - -namespace MuonCalib{ - -NtupleRunScanTool::NtupleRunScanTool(const std::string& t, const std::string& n, const IInterface* p): AthAlgTool(t, n, p), m_min_hits(2000), m_max_bad_fits(0.1), m_suppress_nofit(false), m_noisy_tube_factor(1), m_time_min(std::numeric_limits<unsigned int>::max()), m_time_max(0), m_run_min(std::numeric_limits<unsigned int>::max()), m_run_max(0) - { - declareInterface< NtupleCalibrationTool >(this); - declareProperty("MinHits", m_min_hits); - declareProperty("MaxBadFits", m_max_bad_fits); - declareProperty("SuppressNofit", m_suppress_nofit); - declareProperty("NoisyTubeFactor", m_noisy_tube_factor); - } - - -StatusCode NtupleRunScanTool::initialize() - { - if(m_max_bad_fits<0 || m_max_bad_fits>1) - { - ATH_MSG_FATAL( "MaxBadFits must be between 0 and 1!" ); - return StatusCode::FAILURE; - } - ATH_CHECK(m_idHelperSvc.retrieve()); - - //retrieve detector manager from the conditions store - ATH_CHECK(m_DetectorManagerKey.initialize()); - - p_outfile = new TFile("RunScan.root", "RECREATE"); - return StatusCode :: SUCCESS; - } - - -StatusCode NtupleRunScanTool::handleEvent(const MuonCalibEvent &event, int /*evnt_nr*/, const std::vector<MuonCalibSegment *> &segments, unsigned int position) - { -//iov - SG::ReadCondHandle<MuonGM::MuonDetectorManager> DetectorManagerHandle{m_DetectorManagerKey}; - const MuonGM::MuonDetectorManager* MuonDetMgr = DetectorManagerHandle.cptr(); - if(MuonDetMgr==nullptr){ - ATH_MSG_ERROR("Null pointer to the read MuonDetectorManager conditions object"); - return StatusCode::FAILURE; - } - - const MuonCalibEventInfo & eventinfo(event.eventInfo()); - if(eventinfo.timeStamp()<m_time_min) - { - m_time_min=eventinfo.timeStamp(); - } - if(eventinfo.timeStamp()>m_time_max) - { - m_time_max=eventinfo.timeStamp(); - } - if(eventinfo.runNumber()<m_run_min) - { - m_run_min=eventinfo.runNumber(); - } - if(eventinfo.runNumber()>m_run_max) - { - m_run_max=eventinfo.runNumber(); - } - for(unsigned int i=position; i<segments.size(); i++) - { - std::set<NtupleStationId> hit_stations; - MuonCalibSegment :: MdtHitCit it(segments[i]->mdtHOTBegin()); - for(; it!=segments[i]->mdtHOTEnd(); it++) - { - NtupleStationId id((*(segments[i]->mdtHOTBegin()))->identify()); - id.SetMultilayer(0); - hit_stations.insert(id); - HitCounter &counter(m_hit_counters[id]); - if(!counter.IsInitialized()) - { - if(!id.InitializeGeometry(m_idHelperSvc->mdtIdHelper(), MuonDetMgr)) - { - ATH_MSG_FATAL( "Cannot initialize Geometry!" ); - return StatusCode::FAILURE; - } - p_outfile->cd(); - counter.Initialize(id); - } - } - for(std::set<NtupleStationId> :: iterator it=hit_stations.begin(); it!=hit_stations.end(); it++) - m_hit_counters[*it].ProcessSegment(*segments[i]); - } - return StatusCode::SUCCESS; - } - - -StatusCode NtupleRunScanTool::analyseSegments(const std::vector<MuonCalibSegment *> & /*segemnts*/) - { - std::ofstream header_insert_sql("header_insert.sql"); - header_insert_sql<<"insert into MDT_HEAD (implementation, lowrun, uprun, luminosity, rootfile, lowtime, uptime) values ('xX_IMPLEMENTATION_Xx', "<<m_run_min<<", "<< m_run_max <<", 1, 'xX_ROOT_FILE_Xx', "<< m_time_min <<", "<< m_time_max <<");"<<std::endl; - p_outfile->cd(); - ATH_MSG_INFO( "Location: "<<gDirectory->GetName() ); - TTree *statistics_tree=new TTree("statistics_tree", "statistics tree"); - MuonFixedId id; -//statistics tree - Int_t station, eta, phi; - char station_str[100]; - Int_t n_hits, fit_by; - char fit_by_str[100]; - Int_t n_dead_tubes, n_dead_mezz, n_dead_ml; - char software_id[100], hardware_id[100]; - statistics_tree->Branch("station", &station, "station/I"); - statistics_tree->Branch("eta", &eta, "eta/I"); - statistics_tree->Branch("phi", &phi, "phi/I"); - statistics_tree->Branch("n_hits", &n_hits, "n_hits/I"); - statistics_tree->Branch("fit_by", &fit_by, "fit_by/I"); - statistics_tree->Branch("station_str", &station_str, "station_str/C"); - statistics_tree->Branch("fit_by_str", &fit_by_str, "fit_by_str/C"); - statistics_tree->Branch("n_dead_tubes", &n_dead_tubes, "n_dead_tubes/I"); - statistics_tree->Branch("n_dead_mezz", &n_dead_mezz, "n_dead_mezz/I"); - statistics_tree->Branch("n_dead_ml", &n_dead_ml, "n_dead_ml/I"); - statistics_tree->Branch("software_id", &software_id, "software_id/C"); - statistics_tree->Branch("hardware_id", &hardware_id, "hardware_id/C"); - std::ofstream joblist("joblist.txt"); - std::ofstream initial_dq_file("initial_dq.txt"); - joblist<<"xX_STATION_Xx xX_ETA_Xx xX_PHI_Xx xX_SORT_BY_Xx"<<std::endl; - for(std::map<NtupleStationId, HitCounter> :: iterator it=m_hit_counters.begin(); it!= m_hit_counters.end(); it++) - { - p_outfile->cd(); - const std::string &output(it->second.FittingBy(m_min_hits, m_max_bad_fits)); - std::map<HitCounter::TubeId, HitCounter::DQInfo> dqinfo(it->second.InitialDQ(m_noisy_tube_factor)); - for(std::map<HitCounter::TubeId, HitCounter::DQInfo> :: const_iterator jt=dqinfo.begin(); jt!=dqinfo.end(); jt++) - { - if(jt->second.GetSeverity()>0) - { - initial_dq_file<<it->first.regionId()<<" "<< - jt->first.ml+1<<" "<<jt->first.ly+1<<" "<<jt->first.tb+1<<" "<<jt->second.GetSeverity()<<" "<<jt->second.GetNoisy()<<" "<<jt->second.GetDead()<<std::endl; - } - } - if(!m_suppress_nofit || output!="NOFIT") - joblist << id.stationNumberToFixedStationString(it->first.GetStation()) << " " << it->first.GetEta() << " " << it->first.GetPhi() << " " << output<<std::endl; - //fill tree - station = it->first.GetStation(); - strncpy(station_str, id.stationNumberToFixedStationString(it->first.GetStation()).c_str(), 99); - strncpy(fit_by_str, output.c_str(), 99); - eta = it->first.GetEta(); - phi = it->first.GetPhi(); - fit_by = it->second.FitByInt(); - n_hits = it->second.NHits(); - n_dead_tubes = it->second.NDeadTubes(); - n_dead_mezz = it->second.NDeadMezzanines(); - n_dead_ml = it->second.NDeadMultilayers(); - std::ostringstream sw_id; - std::ostringstream hw_id; - hw_id<<station_str<<std::abs(eta); - if(eta>0) - hw_id<<"A"; - else - hw_id<<"C"; - int hw_phi=phi*2; - if(station_str[2]=='L') - hw_phi-=1; - if(hw_phi<10) - hw_id<<0; - hw_id<<hw_phi; - sw_id<<station_str<<" #eta"<<eta<<" #phi"<<phi; - strncpy(software_id, sw_id.str().c_str(), 99); - strncpy(hardware_id, hw_id.str().c_str(), 99); - statistics_tree->Fill(); - } - p_outfile->cd(); - TNtuple *ntup=new TNtuple("run_range", "Range of the runs", "min:max"); - ntup->Fill(m_time_min, m_time_max); - ntup->Fill(m_run_min, m_run_max); - p_outfile->Write(); - return StatusCode::SUCCESS; - } -} diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/src/NtupleSimpleResolutionTool.cxx b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/src/NtupleSimpleResolutionTool.cxx deleted file mode 100644 index 8df0822cdbcd5ec9538ec3e69042efd501d4665c..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/src/NtupleSimpleResolutionTool.cxx +++ /dev/null @@ -1,827 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -// standard C++ // -#include <iostream> -#include <fstream> -#include <string> -#include <vector> -#include <cstdlib> - -// MuonCalib classes // -#include "MuonCalibEventBase/MuonCalibPattern.h" -#include "MuonCalibEventBase/MuonCalibSegment.h" -#include "MuonCalibEventBase/MdtCalibHitBase.h" -#include "MdtCalibData/RtResolutionFromPoints.h" -#include "MdtCalibData/RtChebyshev.h" -#include "MdtCalibData/RtRelationLookUp.h" - -// NtupleSimpleResolutionTool // -#include "MuonCalibStandAloneTools/NtupleSimpleresolutionTool.h" -#include "MdtCalibIOSvc/MdtCalibInputSvc.h" - -//root -#include "TFile.h" -#include "TH1.h" -#include "TH2.h" -#include "TF1.h" -#include "TGraphErrors.h" -#include "TTree.h" -#include "TProfile.h" -// HEP MATRIX // -#include "CLHEP/Matrix/Matrix.h" -#include "CLHEP/Matrix/Vector.h" - -namespace MuonCalib { - -const unsigned int NtupleSimpleResolutionTool::MAXNUMHITS=50; - -///////////////// -// Constructor // -///////////////// - -NtupleSimpleResolutionTool :: NtupleSimpleResolutionTool(const std::string& t, const std::string& -n, const IInterface* p) : AthAlgTool(t, n, p), m_final_resolution(NULL), -m_calib_input_svc("MdtCalibInputSvc", n), m_reg_sel_svc("RegionSelectionSvc", n), m_is_initialized(false) - { - declareInterface< NtupleCalibrationTool >(this); - declareProperty("MdtCalibInputSvc", m_calib_input_svc); - declareProperty("RegionSelectionSvc", m_reg_sel_svc); - m_curved = true; - declareProperty("CurvedFit", m_curved); - m_REJ_LOW = 0.1; - declareProperty("RejectLow", m_REJ_LOW); - m_REJ_TOP = 0.3; - declareProperty("RejectTop", m_REJ_TOP); - m_DELTA_CONV = 0.05; - declareProperty("DeltaConv", m_DELTA_CONV); - m_DIFF_MAX = 0.006; - declareProperty("DiffMax", m_DIFF_MAX); - m_MAX_NUM_IT = 20; - declareProperty("MaximumIterations" ,m_MAX_NUM_IT); - m_replace_with_flat = false; - declareProperty("InitialFlatResolution", m_replace_with_flat); - m_hist_fit_method = false; - declareProperty("HistFitMethod", m_hist_fit_method); - m_suppress_outliers = false; - declareProperty("SuppressOutliers", m_suppress_outliers); - m_SUPPRESS_LOW = 0.2; - declareProperty("SuppressionLow", m_SUPPRESS_LOW); - m_SUPPRESS_TOP = 0.2; - declareProperty("SuppressionTop", m_SUPPRESS_TOP); - m_spr_out_name = std::string("spr_out.root"); - declareProperty("OutputResolutionFunction", m_spr_out_name); - } - - -/////////////////////// -// METHOD initialize // -/////////////////////// - -StatusCode NtupleSimpleResolutionTool::initialize() - { - - ATH_MSG_INFO( "Initializing Simple resolution Tool" ); - //StatusCode sc; - -//get pointer to Calibration input service - ATH_CHECK( m_calib_input_svc.retrieve() ); -//get pointer to region selection service - ATH_CHECK( m_reg_sel_svc.retrieve() ); - -///////////////////// -// OTHER VARIABLES // -///////////////////// - m_MINNUMHITS = 4; - if(m_curved) m_MINNUMHITS = 5; - - m_sprgr=0; - m_sprgr_r=0; - m_number_of_segments = 0; - -//////////////////////////////////////////////////////// -// DECLARATION OF HISTOGRAMS AND NTUPLES // -//////////////////////////////////////////////////////// -// histograms // - m_residual = new TH2F("m_residual", "RESIDUALS", - RBIN, 0.0, RRANGE, RESBIN, -0.5*RESRANGE, 0.5*RESRANGE); - m_residual0 = new TH2F("m_residual0", "RESIDUALS", - RBIN, 0.0, RRANGE, RESBIN, -0.5*RESRANGE, 0.5*RESRANGE); - - m_residual2 = new TH2F("m_residual2", "RESIDUALS2", - RBIN, 0.0, RRANGE, RESBIN, -0.5*RESRANGE, 0.5*RESRANGE); - - m_residual3 = new TH2F("m_residual3", "RESIDUALS3", - RBIN, 0.0, RRANGE, RESBIN, -0.5*RESRANGE, 0.5*RESRANGE); - - m_sigma_track = new TH2F("m_sigma_track", "SIGMA OF TRACK FIT", - RBIN, 0.0, RRANGE, SBIN, 0, SRANGE); - m_sigma_track_lim = new TH2F("m_sigma_track_lim", - "SIGMA OF TRACK FIT (LIMITED)", RBIN, 0.0, RRANGE, SBIN, 0, SRANGE); - - m_is_initialized=true; - setRegion(); - return StatusCode::SUCCESS; -} - -//****************************************************************************** - -////////////////////// -// METHOD setRegion // -////////////////////// - - -void NtupleSimpleResolutionTool :: setRegion() - { - - m_rt_relation = m_calib_input_svc->GetRtRelation(); - if(m_rt_relation == NULL) - { - ATH_MSG_FATAL( "Cannot find rt-relatino for this region" ); - return; - } - } - - - -//***************************************************************************** - -/////////////////////// -// METHOD destruct // -/////////////////////// - -void NtupleSimpleResolutionTool::destruct(void) { - - if(!m_is_initialized) return; - - return; -} - -//********************************************************************* - -//////////////////////////// -// METHOD analyseSegments // -//////////////////////////// -StatusCode NtupleSimpleResolutionTool::analyseSegments(const std::vector<MuonCalibSegment *> & segments) -{ -if(segments.size() == 0) - { - ATH_MSG_FATAL( "No Segments collected!" ); - return StatusCode :: FAILURE; - } - -for(unsigned int i=0; i<segments.size(); i++) { - const MuonCalibSegment *seg=segments[i]; - - if (seg->mdtHitsOnTrack()<m_MINNUMHITS) continue; - - bool seg_rej = false; - for (unsigned int l=0;l<seg->mdtHitsOnTrack();l++) { - if (std::abs(seg->mdtHOT()[l]->driftRadius())>15.0 || - std::abs(seg->mdtHOT()[l]->driftRadius())<0.0) { - seg_rej = true; - continue; - } - } - if(seg_rej) continue; - - for (unsigned int l=0;l<seg->mdtHitsOnTrack();l++) { - if(std::abs(seg->mdtHOT()[l]->radialResidual())<0.5*RESRANGE) { - m_residual2->Fill(std::abs(seg->mdtHOT()[l]->driftRadius()), - seg->mdtHOT()[l]->radialResidual(), 1.0); - } - -// replace initial space resolution with flat 0.3 - if(m_replace_with_flat) { - seg->mdtHOT()[l]->setDriftRadius(std::abs(seg->mdtHOT()[l]->driftRadius()),0.3); - } - - } - m_number_of_segments = m_refitted_segment.size(); - m_refitted_segment.push_back(new MuonCalibSegment(*(seg))); - } - end_of_data(m_rt_relation); - - return StatusCode :: SUCCESS; -} - -//******************************************************** - -/////////////////////////// -// METHOD handle_segment // -/////////////////////////// - -void NtupleSimpleResolutionTool::handle_segment(MuonCalibSegment &seg, double *par_lim_low, -double *par_lim_upp) { - - if(seg.mdtHitsOnTrack()<m_MINNUMHITS || seg.mdtHitsOnTrack()>MAXNUMHITS) return; - bool seg_rej = false; - for (unsigned int l=0; l<seg.mdtHitsOnTrack();l++) { - if (std::abs(seg.mdtHOT()[l]->driftRadius())>15.0 || - std::abs(seg.mdtHOT()[l]->driftRadius())<0.0) { - seg_rej = true; - continue; - } - } - if(seg_rej) return; - - double dir = (seg.direction ()[1])/(seg.direction ()[2]); - for (unsigned int l=0; l<seg.mdtHitsOnTrack();l++) { - double z_exhit, y_exhit, dtty; // Locale coordinates of excluded hit - dtty=(seg.position ()[1]+dir*(seg.mdtHOT()[l]->localPosition ()[2])- - seg.mdtHOT()[l]->localPosition ()[1])/(1.0+std::pow(dir,2)); - y_exhit=seg.mdtHOT()[l]->localPosition ()[1]+dtty; - z_exhit=seg.mdtHOT()[l]->localPosition ()[2]-dtty*dir; - - double d_hit[MAXNUMHITS]; - double s2_hit[MAXNUMHITS]; - double delta_hit[MAXNUMHITS]; - bzero(d_hit, MAXNUMHITS*sizeof(double)); - bzero(s2_hit, MAXNUMHITS*sizeof(double)); - bzero(delta_hit, MAXNUMHITS*sizeof(double)); - - for (unsigned int i=0;i<seg.mdtHitsOnTrack();i++) { - if(i!=l) { - double z_hit, y_hit; // Local coordinates of hits used in refit - dtty=(seg.position ()[1]+dir*(seg.mdtHOT()[i]->localPosition ()[2])- - seg.mdtHOT()[i]->localPosition ()[1])/(1.0+std::pow(dir,2)); - y_hit=seg.mdtHOT()[i]->localPosition ()[1]+dtty; - z_hit=seg.mdtHOT()[i]->localPosition ()[2]-dtty*dir; - - d_hit[i]=std::sqrt((z_hit-z_exhit)*(z_hit-z_exhit)+(y_hit-y_exhit)*(y_hit-y_exhit))* - ((z_hit-z_exhit)/std::abs(z_hit-z_exhit)); - s2_hit[i]=seg.mdtHOT()[i]->sigma2DriftRadius(); - } - else { - d_hit[i] = 0.0; - s2_hit[i] = 100.0; // Exclusion of a hit under consideration from a track fit - } - double dtt=seg.mdtHOT()[i]->signedDistanceToTrack(); - double drad=std::abs(seg.mdtHOT()[i]->driftRadius()); - delta_hit[i]=(drad-std::abs(dtt))*dtt/std::abs(dtt); - // Exclusion of hits with huge residuals from a track fit - if(std::abs(seg.mdtHOT()[i]->radialResidual())>1.0) s2_hit[i] = 100.0; - } - - double dr_radius(0), dist_to_track(0), rad_residual(0); - double trk_sigma(0), dist_diff(0); - dr_radius = std::abs(seg.mdtHOT()[l]->driftRadius()); - dist_to_track = seg.mdtHOT()[l]->signedDistanceToTrack(); - -// Track refit (hit under consideration is excluded) - - if(trackFit(seg.mdtHitsOnTrack(), d_hit, - delta_hit, s2_hit, dist_diff, trk_sigma)) continue; - - dist_to_track = dist_to_track + dist_diff; - rad_residual = dr_radius - std::abs(dist_to_track); - double dist = std::abs(dist_to_track); - - double lim_low(0), lim_upp(0); - for(int i=0;i<6;i++) { - lim_low += par_lim_low[i]*std::pow(dist,i); - lim_upp += par_lim_upp[i]*std::pow(dist,i); - } - - if(trk_sigma<SRANGE&&dist<RRANGE&&dr_radius>0&&dr_radius<RRANGE) { - m_sigma_track->Fill(dist, trk_sigma, 1.0); - if(std::abs(rad_residual)<0.5*RESRANGE) { - m_residual3->Fill(dr_radius, rad_residual, 1.0); - } - if(trk_sigma>lim_low&&trk_sigma<lim_upp){ - m_sigma_track_lim->Fill(dist, trk_sigma, 1.0); - int nbin = int (RBIN*dist/RRANGE); - if(rad_residual>m_low[nbin] && rad_residual<m_top[nbin]) { - m_residual->Fill(dr_radius, rad_residual, 1.0); - m_residual0->Fill(dist, rad_residual, 1.0); - } - } - } - - } - - return; -} - -//***************************************************************************** - -//////////////////////// -// METHOD end_of_data // -//////////////////////// - -void NtupleSimpleResolutionTool::end_of_data(const IRtRelation * rt_rel) { - -/////////////// -// VARIABLES // -/////////////// - // double t_min(0.0), t_max(1000.0); // minimum and maximum drift time - RtResolutionFromPoints res_from_points; // class to convert look-up - // table for resolution - // functions into any existing - // format - m_sprfun = new TF1("sprfun",ttt0,0.0,RRANGE,7); - m_sprfun_r = new TF1("sprfun_r",ttt0,0.0,RRANGE,7); - -// TF1 *sprfun_old = new TF1("sprfun_old",ttt0,0.001,RRANGE,5); - TF1 *sprfun_old = new TF1("sprfun_old",ttt0,0.001,RRANGE,7); - - double delta_conv = 100; - double r_conv = 0; - unsigned int iteration(0); - - for(int it=0; (delta_conv>m_DELTA_CONV)&&(it<m_MAX_NUM_IT); it++) { - - double par_low[6] = {0,0,0,0,0,0}; - double par_upp[6] = {SRANGE,0,0,0,0,0}; - -//////////////////////////////////////////////////// -// First cycle by segments (TrkError calculation) // -//////////////////////////////////////////////////// - m_sigma_track->Reset(); - m_residual0->Reset(); - m_residual->Reset(); - - for(unsigned int j=0;j<RBIN;j++) { - m_low[j]=-0.5*RESRANGE; - m_top[j]= 0.5*RESRANGE; - } - - for (unsigned int k=0; k<m_refitted_segment.size(); k++) { - - handle_segment(*(m_refitted_segment[k]), par_low, par_upp); - - } - - trkErrorFix(par_low, par_upp); - - if(m_suppress_outliers) { - for(unsigned int j=0;j<RBIN;j++) { -// TH1D *proj_y = m_residual0->ProjectionY("_y", j+1,j+1); - TH1D *proj_y = m_residual->ProjectionY("_y", j+1,j+1); - Double_t num(0), sum_low(0), sum_top(0); - - for(unsigned int i=0;i<RESBIN;i++) { - num += proj_y->GetBinContent(i+1); - } - for(int i=0;sum_low<m_SUPPRESS_LOW*num;i++) { - sum_low += proj_y->GetBinContent(i+1); - m_low[j]= -0.5*RESRANGE + RESRANGE*i/float(RESBIN); - } - for(int i=0;sum_top<(1-m_SUPPRESS_TOP)*num;i++) { - sum_top += proj_y->GetBinContent(i+1); - m_top[j]= -0.5*RESRANGE + RESRANGE*i/float(RESBIN); - } - } - } - -/////////////////////////////////////////////////////// -// Second cycle by segments (Resolution calculation) // -/////////////////////////////////////////////////////// - m_sigma_track->Reset(); - m_sigma_track_lim->Reset(); - m_residual->Reset(); - m_residual0->Reset(); - m_residual3->Reset(); - - for (unsigned int k=0; k<m_refitted_segment.size(); k++) { - handle_segment(*(m_refitted_segment[k]), par_low, par_upp); - } - - spResCalc(true); - - for (unsigned int k=0; k<m_refitted_segment.size(); k++) { - for(unsigned int l=0;l<m_refitted_segment[k]->mdtHitsOnTrack();l++) { - double dr_radi = std::abs(m_refitted_segment[k]->mdtHOT()[l]->driftRadius()); - double sp_resol = m_sprfun_r->Eval(dr_radi); - if(sp_resol < 0.050) sp_resol = 0.050; - m_refitted_segment[k]->mdtHOT()[l]->setDriftRadius(dr_radi, sp_resol); - } - } - - if(it>0) { - delta_conv = 0; - r_conv = 0; - Double_t x[RBIN]; - for(unsigned int j=1;j<RBIN-2;j++) { - x[j]=RRANGE*(j+0.5)/float(RBIN); - double diff = std::abs((m_sprfun_r->Eval(x[j]))-(sprfun_old->Eval(x[j]))); - double d_diff = diff/std::abs(m_sprfun_r->Eval(x[j])); - if(d_diff>delta_conv && diff> m_DIFF_MAX) { - delta_conv=d_diff; - r_conv=x[j]; - } - } - } - - m_sprfun_r->Copy(*sprfun_old); - iteration=it; - ATH_MSG_INFO( "Iteration "<<iteration<<" conv "<<delta_conv<<" r_conv "<<r_conv << "\n" ); - - } - -// SpRes from DistToTrack calculation: - spResCalc(false); - - std::ofstream outfile("spr.out", std::ios::app); - outfile<<m_reg_sel_svc->GetRegionSelection()<<": NumIt-s ="<<std::setw(3)<<iteration<< - " conv ="<<std::setw(6)<<std::setprecision(2)<<delta_conv<< - " r_conv ="<<std::setw(6)<<std::setprecision(2)<<r_conv<< - " NumOfSegments ="<<std::setw(6)<<m_refitted_segment.size()<<std::endl; - outfile.close(); - - delete sprfun_old; - - ATH_MSG_INFO( m_reg_sel_svc->GetRegionSelection()<<" NumOfSegments: " - <<m_refitted_segment.size() ); - ATH_MSG_INFO( "NumOfIts "<<iteration<<" convergence "<<delta_conv<<" r_conv "<<r_conv ); - -///////////////////////////////////// writing output -// m_sfile->Write(); - - m_outfile = new TFile(m_spr_out_name.c_str(), "RECREATE"); - m_sprfun_r->Write(); - m_sprgr_r->Write(); - m_sigma_track->Write(); - m_sigma_track_lim->Write(); - m_residual->Write(); - m_residual0->Write(); - m_residual2->Write(); - - m_outfile->Close(); - if (rt_rel==NULL) - { - return; - } - -///////////////////////////////////////////////////////////////////////////// -// CONVERT THE RESOLUTION FUNCTION INTO A RESOLUTION FUNCTION DEPENDING ON // -// TIME. // -///////////////////////////////////////////////////////////////////////////// - -// get minimum and maximum drift time // - // const RtChebyshev *rt_Chebyshev( - // dynamic_cast<const RtChebyshev *>(rt_rel)); - // const RtRelationLookUp *rt_LookUp( - // dynamic_cast<const RtRelationLookUp *>(rt_rel)); - // RtChebyshev // - // if (rt_Chebyshev!=0) { - // t_min = rt_Chebyshev->tLower(); - // t_max = rt_Chebyshev->tUpper(); - // } - - // RtRelationLookUp, dangerous implementation, but the only way right now // - // if (rt_LookUp!=0) { - // t_min = rt_LookUp->par(0); - // t_max = rt_LookUp->par(1)*(rt_LookUp->nPar()-2); - // } - -// perform sigma-t fit // - std::vector<SamplePoint> point(31); - double r_min(rt_rel->radius(rt_rel->tLower())); - double r_max(rt_rel->radius(rt_rel->tUpper())); - double bin_width((r_max-r_min)/static_cast<double>(point.size()-1)); - - for (unsigned int k=0; k<point.size(); k++) { -// double sp_res_out = m_sprfun->Eval(r_min+k*bin_width); - double sp_res_out = m_sprfun_r->Eval(r_min+k*bin_width); - if(sp_res_out<0.050) sp_res_out = 0.050; - point[k].set_x2(sp_res_out); - point[k].set_error(sp_res_out); - if (k==0) { - point[k].set_x1(rt_rel->tLower()-0.2); - } else { - point[k].set_x1(t_from_r(r_min+k*bin_width, rt_rel)); - } - if (k==point.size()-1) { - point[k].set_x1(rt_rel->tUpper()+0.2); - } - } - - m_final_resolution = new RtResolutionChebyshev( - (res_from_points.getRtResolutionChebyshev( - point, 8))); - - return; -} -//*********************************************************** - -////////////////////////////////////// -// trkErrorFix // -// TrackError region selection // -////////////////////////////////////// - -int NtupleSimpleResolutionTool::trkErrorFix(double *par_l, double *par_u) { - - Double_t x[RBIN], x_err[RBIN], y_low[RBIN],y_top[RBIN], y_err[RBIN]; - TF1 *func1 = new TF1("fitf1","pol5"); - TF1 *func2 = new TF1("fitf2","pol5"); - - for(unsigned int j=0;j<RBIN;j++) { - TH1D *proj_y = m_sigma_track->ProjectionY("_y", j+1,j+1); - Double_t num(0), sum_low(0), sum_top(0); - float thr_low(0),thr_top(0); - - for(unsigned int i=0;i<SBIN;i++) { - num += proj_y->GetBinContent(i+1); - } - for(int i=0;sum_low<m_REJ_LOW*num;i++) { - sum_low += proj_y->GetBinContent(i+1); - thr_low=SRANGE*i/float(SBIN); - } - for(int i=0;sum_top<m_REJ_TOP*num;i++) { - sum_top += proj_y->GetBinContent(i+1); - thr_top=SRANGE*i/float(SBIN); - } - - if(std::abs(thr_top-thr_low)<0.006) { - thr_low=0.5*(thr_low+thr_top)-0.003; - thr_top=0.5*(thr_low+thr_top)+0.003; - } - - y_err[j]=thr_top-thr_low; - - x[j]=RRANGE*(j+0.5)/float(RBIN); - x_err[j]=(RRANGE/RBIN)/std::sqrt(12.0); - - y_low[j]=thr_low; - y_top[j]=thr_top; - - } - - TGraphErrors *gr1 = new TGraphErrors (RBIN,x,y_low,x_err,y_err); - gr1->Fit(func1,"Q","",0.001*RRANGE,0.97*RRANGE); - - TGraphErrors *gr2 = new TGraphErrors (RBIN,x,y_top,x_err,y_err); - gr2->Fit(func2,"Q","",0.001*RRANGE,0.97*RRANGE); - - func1->GetParameters (par_l); - func2->GetParameters (par_u); - - delete gr1; - delete gr2; - delete func1; - delete func2; - - return 0; -} - -//*********************************************************************** - -////////////////////////////////////// -// spResCalc // -// Spatial resolution calculation // -////////////////////////////////////// - -int NtupleSimpleResolutionTool::spResCalc(bool SfromR) { - - Double_t sigma_dr[RBIN], sigma_dr_err[RBIN]; - Double_t x[RBIN], x_err[RBIN]; - - for(unsigned int j=0;j<RBIN;j++) { - sigma_dr[j]=0.0; - sigma_dr_err[j]=0.0; - x[j]=RRANGE*(j+0.5)/float(RBIN); - x_err[j]=(RRANGE/RBIN)/std::sqrt(12.0); - } - for(unsigned int j=0;j<RBIN-1;j++) { - - TH1D *dr_y = 0; - if(SfromR) dr_y = m_residual->ProjectionY("dry_y", j+1,j+1); - else dr_y = m_residual0->ProjectionY("dry_y", j+1,j+1); - double rms_f = 0; - double sigma_tr, sigma_r, s_dr, s_tr; - Double_t entr = 0; - - if(m_hist_fit_method) { - - for(unsigned int k=0;k<RESBIN;k++) { - dr_y->SetBinError(k+1,1.0); - } - - dr_y->Fit("gaus","Q","", -1.0, 1.0); - - rms_f = dr_y->GetFunction("gaus")->GetParameter(2); - if(rms_f<0.0001) rms_f=0.0001; - - sigma_tr = m_sigma_track_lim->ProfileX()->GetBinContent(j+1); - sigma_r = rms_f*rms_f-sigma_tr*sigma_tr; - if(sigma_r<0.0001) sigma_r=0.0001; - sigma_r=std::sqrt(sigma_r); - - s_dr = dr_y->GetFunction("gaus")->GetParError(2); - s_dr = std::sqrt(s_dr*s_dr + 0.01*0.01); - s_tr = m_sigma_track_lim->ProjectionY("str_y", j+1,j+1)->GetRMS(); - - } else { - - for(unsigned int k=0;k<RESBIN;k++) { - float x_x =(float(k)+0.5-0.5*RESBIN)*(RESRANGE/RESBIN); - rms_f += x_x*x_x*(dr_y->GetBinContent(k+1)); - entr += dr_y->GetBinContent(k+1); - } - if(entr==0||rms_f==0) rms_f=0.0001; - else rms_f = std::sqrt(rms_f/entr); - - float xx_cut = 5*rms_f; - - rms_f=0; - entr = 0; - for(unsigned int k=0;k<RESBIN;k++) { - float x_x =(float(k)+0.5-0.5*RESBIN)*(RESRANGE/RESBIN); - if(std::abs(x_x)<xx_cut) { - rms_f += x_x*x_x*(dr_y->GetBinContent(k+1)); - entr += dr_y->GetBinContent(k+1); - } - } - - if(entr==0||rms_f==0) rms_f=0.0001; - else rms_f = std::sqrt(rms_f/entr); - sigma_tr = m_sigma_track_lim->ProfileX()->GetBinContent(j+1); - sigma_r = rms_f*rms_f-sigma_tr*sigma_tr; - if(sigma_r<0.0001) sigma_r=0.0001; - sigma_r=std::sqrt(sigma_r); - - s_dr = dr_y->GetRMSError(); - if(s_dr<0.00001) s_dr=0.5; - s_tr = m_sigma_track_lim->ProjectionY("str_y", j+1,j+1)->GetRMS(); - - } - - sigma_dr[j] = sigma_r; - sigma_dr_err[j] = std::sqrt(s_dr*s_dr+s_tr*s_tr); - - if(sigma_dr[j]<=0.050) sigma_dr[j]=0.050; - } - if(SfromR) { - if(m_sprgr_r) delete m_sprgr_r; - m_sprgr_r = new TGraphErrors (RBIN,x,sigma_dr,x_err,sigma_dr_err); - m_sprgr_r->SetName("sprgr_r"); - - m_sprfun_r->SetParameter(0,0.3); - m_sprfun_r->SetParLimits(0,0.1,2.0); - float rlim = 1.0/RRANGE; - m_sprfun_r->SetParameter(1,0.0); - m_sprfun_r->SetParLimits(1,0.0,2.0*rlim); - rlim = rlim/RRANGE; - m_sprfun_r->SetParameter(2,0.0); - m_sprfun_r->SetParLimits(2,-10.0*rlim,10.0*rlim); - rlim = rlim/RRANGE; - m_sprfun_r->SetParameter(3,0.0); - m_sprfun_r->SetParLimits(3,-10.0*rlim,10.0*rlim); - m_sprfun_r->SetParameter(4,4.0); - m_sprfun_r->SetParLimits(4,1.0,10.0); - m_sprfun_r->SetParameter(5,0.1); - m_sprfun_r->SetParLimits(5,0.01,2.0); - m_sprfun_r->SetParameter(6,3.0); - m_sprfun_r->SetParLimits(6,0.0,6.0); - - m_sprgr_r->Fit(m_sprfun_r,"Q","0",RRANGE*1.0/30.0,RRANGE*29.0/30.0); - } - else { - if(m_sprgr) delete m_sprgr; - m_sprgr = new TGraphErrors (RBIN,x,sigma_dr,x_err,sigma_dr_err); - m_sprgr->SetName("sprgr"); - - m_sprfun->SetParameter(0,0.3); - m_sprfun->SetParLimits(0,0.1,2.0); - float rlim = 1.0/RRANGE; - m_sprfun->SetParameter(1,0.0); - m_sprfun->SetParLimits(1,0.0,2.0*rlim); - rlim = rlim/RRANGE; - m_sprfun->SetParameter(2,0.0); - m_sprfun->SetParLimits(2,-10.0*rlim,10.0*rlim); - rlim = rlim/RRANGE; - m_sprfun->SetParameter(3,0.0); - m_sprfun->SetParLimits(3,-10.0*rlim,10.0*rlim); - m_sprfun->SetParameter(4,4.0); - m_sprfun->SetParLimits(4,1.0,10.0); - m_sprfun->SetParameter(5,0.1); - m_sprfun->SetParLimits(5,0.01,2.0); - m_sprfun->SetParameter(6,3.0); - m_sprfun->SetParLimits(6,0.0,6.0); - - m_sprgr->Fit(m_sprfun,"Q","0",RRANGE*1.0/30.0,RRANGE*29.0/30.0); - } - - return 0; -} - - - -//************************************************************ - -///////////////////// -// METHOD t_from_r // -///////////////////// - -double NtupleSimpleResolutionTool::t_from_r(const double & r, - const IRtRelation * rt_rel) { - -/////////////// -// VARIABLES // -/////////////// - - double precision(0.010); // spatial precision of the inversion - double t_max(0.0); // upper time search limit - double t_min(1000.0); // lower time search limit - -/////////////////////////////// -// DETERMINE t_min and t_max // -/////////////////////////////// - - const RtChebyshev *rt_Chebyshev( - dynamic_cast<const RtChebyshev *>(rt_rel)); - const RtRelationLookUp *rt_LookUp( - dynamic_cast<const RtRelationLookUp *>(rt_rel)); - // RtChebyshev // - if (rt_Chebyshev!=0) { - t_min = rt_Chebyshev->tLower(); - t_max = rt_Chebyshev->tUpper(); - } - - // RtRelationLookUp, dangerous implementation, but the only way right now // - if (rt_LookUp!=0) { - t_min = rt_LookUp->par(0); - t_max = rt_LookUp->par(1)*(rt_LookUp->nPar()-2); - } - -///////////////////////////////////////////// -// SEARCH FOR THE CORRESPONDING DRIFT TIME // -///////////////////////////////////////////// - - while (t_max-t_min>0.1 && - std::abs(rt_rel->radius(0.5*(t_min+t_max))-r)>precision) { - - if (rt_rel->radius(0.5*(t_min+t_max))>r) { - t_max = 0.5*(t_min+t_max); - } else { - t_min = 0.5*(t_min+t_max); - } - - } - - return 0.5*(t_min+t_max); - -} - -//************************************************************ - -////////////////////////////////////////// -// Functions for root histogram fitting // -////////////////////////////////////////// - -double NtupleSimpleResolutionTool::ttt(double *x, double *par) { - double y; - - y=0.025+x[0]*(par[4]*std::exp(-x[0]/ - (par[0]*(1+par[1]*x[0]+par[2]*x[0]*x[0]+par[3]*x[0]*x[0]*x[0])))+ - par[5]*std::exp(-x[0]*x[0]/(par[6]*par[6]))); - return y; -} - -double NtupleSimpleResolutionTool::ttt0(double *x, double *par) { - double y; - y=(par[0]-(par[0]-par[5])/(1.0+std::exp(-(x[0]-par[6])/par[4])))* - (1+par[1]*x[0]+par[2]*x[0]*x[0]+par[3]*x[0]*x[0]*x[0]); - return y; -} - -//************************************************************ - -///////////////////////////////////////////////////////////////////// -// Track Fitting Function. Calculates position of a track (shift) // -//and track error (sigma_track) at the point under consideration // -///////////////////////////////////////////////////////////////////// - -int NtupleSimpleResolutionTool::trackFit(int num_hit, double *dist_hit, double *y, - double *sigma2_hit, double &shift, double &sigma_track) { - - int NLC=2; - if(m_curved) NLC=3; - CLHEP::HepMatrix Gamma = CLHEP::HepMatrix(NLC,NLC,0); - CLHEP::HepVector betha = CLHEP::HepVector(NLC,0); - CLHEP::HepVector alpha = CLHEP::HepVector(NLC,0); - CLHEP::HepVector delta = CLHEP::HepVector(NLC,0); - - for(int k=0;k<num_hit;k++) { - if(sigma2_hit[k]<=0) return 1; - for(int i=0;i<NLC;i++) delta[i] = std::pow(dist_hit[k],i); - Gamma += (delta*delta.T())/sigma2_hit[k]; - betha += y[k]*delta/sigma2_hit[k]; - } - - int ierr(0); // Status of Matrix Inversion - Gamma.invert(ierr); - if(ierr) return 2; - alpha = Gamma*betha; - - if(std::isnan(alpha[0]) || std::isnan(Gamma[0][0])) return 2; - if(Gamma[0][0]<=0) return 2; - shift = alpha[0]; - sigma_track = std::sqrt(Gamma[0][0]); - - return 0; -} - -} diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/src/NtupleTubeEfficiencyTool.cxx b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/src/NtupleTubeEfficiencyTool.cxx deleted file mode 100644 index 08c487e3cacd383195356e5a8b9ec392113806d0..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/src/NtupleTubeEfficiencyTool.cxx +++ /dev/null @@ -1,774 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -// standard C++ // -#include <iostream> -#include <fstream> -#include <string> -#include <vector> -#include <cstdlib> - -// MuonReadoutGeometry // -#include "MuonReadoutGeometry/RpcReadoutElement.h" -#include "MuonReadoutGeometry/MdtReadoutElement.h" - -#include "MuonCalibITools/IIdToFixedIdTool.h" -#include "MdtCalibInterfaces/IMdtSegmentFitter.h" - -// MuonCalib // -#include "MuonCalibEventBase/MuonCalibRawHitCollection.h" -#include "MuonCalibEventBase/MuonCalibRawMdtHit.h" -#include "MuonCalibEventBase/MuonCalibSegment.h" -#include "MdtCalibFitters/QuasianalyticLineReconstruction.h" -#include "MuonCalibEventBase/MuonCalibEvent.h" - -// NtupleTubeEfficiencyTool // -#include "MuonCalibStandAloneTools/NtupleTubeEfficiencyTool.h" - -//this -#include "MuonCalibStandAloneBase/NtupleStationId.h" -#include "MuonCalibStandAloneBase/RegionSelectionSvc.h" - -//root -#include "TFile.h" -#include "TH1.h" -#include "TNtuple.h" -#include "TString.h" -#include "TDirectory.h" - -namespace MuonCalib { - -//***************************************************************************** - -// constructor - -NtupleTubeEfficiencyTool::NtupleTubeEfficiencyTool( const std::string& t, - const std::string& n, - const IInterface* p) : - AthAlgTool(t, n, p), m_reg_sel_svc("RegionSelectionSvc", n) { - - declareInterface< NtupleCalibrationTool >(this); - declareProperty("RegionSelectionSvc", m_reg_sel_svc); - - m_nb_hits = 5; - declareProperty("nSegmentHits", m_nb_hits); - - m_road_width = 2.0; - declareProperty("roadWidth", m_road_width); - - m_debug = false; - declareProperty("Debug", m_debug); - - m_file_name = std::string("TubeEfficiencies"); - declareProperty("fileName", m_file_name); - - m_chi2_cut = 10.0; - declareProperty("Chi2Cut", m_chi2_cut); - - m_exclude_layer = false; - declareProperty("excludeLayer", m_exclude_layer); - -} - -//::::::::::::::::: -//:: METHOD init :: -//::::::::::::::::: - -StatusCode NtupleTubeEfficiencyTool::initialize() { - - ATH_MSG_INFO( "Initializing NtupleTubeEfficiencyTool" ); - - //-----------------------------// - //-- Get the StoreGate Stuff --// - //-----------------------------// - - ATH_CHECK( m_idHelperSvc.retrieve() ); - - //retrieve detector manager from the conditions store - ATH_CHECK(m_DetectorManagerKey.initialize()); - - //retrieve fixed id tool - std::string idToFixedIdToolType("MuonCalib::IdToFixedIdTool"); - std::string idToFixedIdToolName("MuonCalib_IdToFixedIdTool"); - - ATH_CHECK( toolSvc()->retrieveTool(idToFixedIdToolType, idToFixedIdToolName, m_id_tool) ); - - //get region selection service - ATH_CHECK( m_reg_sel_svc.retrieve() ); - - //----------------------------------// - //-- Create Root Files and Histos --// - //----------------------------------// - - TDirectory* workdir = gDirectory; - m_tfile = new TFile(TString(m_file_name)+".root", "RECREATE"); - - if(m_debug){ - - m_tfile_debug = new TFile(TString(m_file_name)+"_debug.root", "RECREATE"); - - ATH_MSG_INFO( "NtupleTubeEfficiencyTool: Debug mode is switched on" ); - - m_hit_ntuple = new TNtuple("hit_ntuple", "MDT HIT NTUPLE", - "event_nb:station:eta:phi:ml:layer:tube:w_x:w_y:w_z:x:t:r:d"); - } - - - m_qfitter = NULL; - - m_nb_trigger = 0; - - m_nb_multilayers = -1; - m_nb_layers = -1; - m_nb_tubes = -1; - - if(m_debug){ - m_tfile_debug->cd(); - } - else{ - workdir->cd(); - } - - //control histos - - m_h_chi2 = new TH1F("h_chi2", "", 500, 0, 100); - - m_h_distance = new TH1F("h_distance", - "distance between track and wire", - 150, 0, 15); - m_h_nb_hit_tubes = new TH1I("h_nb_hit_tubes", - "nb of hit tubes in exluded layer", - 51, 0, 50); - - - //efficiency and fakerate histos (per tube) - - m_h_efficiency = std::vector< std::vector< std::vector<TH1F*> > >(2); //up to two multilayers - - for (unsigned int k=0; k<m_h_efficiency.size(); k++) { - - m_h_efficiency[k] = std::vector< std::vector<TH1F*> >(4); // up to four layers per multilayer - for (unsigned int l=0; l<m_h_efficiency[k].size(); l++) { - - m_h_efficiency[k][l] = std::vector<TH1F*>(72); // up to 72 tubes per layer - for (unsigned int m=0; m<m_h_efficiency[k][l].size(); m++) { - - m_h_efficiency[k][l][m] - = new TH1F( Form("efficiency_%i_%i_%i",k+1,l+1,m+1), - "Efficiency", 2, -0.5, 1.5) ; - } - } - } - - - m_h_fakerate = std::vector< std::vector< std::vector<TH1F*> > >(2); //up to two multilayers - - for (unsigned int k=0; k<m_h_fakerate.size(); k++) { - - m_h_fakerate[k] = std::vector< std::vector<TH1F*> >(4); // up to four layers per multilayer - for (unsigned int l=0; l<m_h_fakerate[k].size(); l++) { - - m_h_fakerate[k][l] = std::vector<TH1F*>(72); // up to 72 tubes per layer - for (unsigned int m=0; m<m_h_fakerate[k][l].size(); m++) { - - m_h_fakerate[k][l][m] - = new TH1F( Form("fakerate_%i_%i_%i",k+1,l+1,m+1), - "Fakerate", 2, -0.5, 1.5) ; - - } - } - } - - //efficiency and fakerate histos (per layer) - - m_tfile->cd(); - - m_h_tube_efficiency = std::vector< std::vector<TH1F*> >(2); //up to two multilayers - for (unsigned int k=0; k<m_h_tube_efficiency.size(); k++) { - - m_h_tube_efficiency[k] = std::vector<TH1F*>(4); // up to four layers per multilayer - for (unsigned int l=0; l<m_h_tube_efficiency[k].size(); l++) { - - m_h_tube_efficiency[k][l] - = new TH1F( Form("tube_efficiency_%i_%i",k+1,l+1), - "Tube Efficiency", 72, 0.5, 72.5) ; - - m_h_tube_efficiency[k][l]->GetXaxis()->SetTitle("Tube"); - m_h_tube_efficiency[k][l]->GetYaxis()->SetTitle("Efficiency"); - m_h_tube_efficiency[k][l]->SetMarkerStyle(8); - } - } - - m_h_tube_fakerate = std::vector< std::vector<TH1F*> >(2); //up to two multilayers - for (unsigned int k=0; k<m_h_tube_fakerate.size(); k++) { - - m_h_tube_fakerate[k] = std::vector<TH1F*>(4); // up to four layers per multilayer - for (unsigned int l=0; l<m_h_tube_fakerate[k].size(); l++) { - - m_h_tube_fakerate[k][l] - = new TH1F( Form("tube_fakerate_%i_%i",k+1,l+1), - "Tube Fakerate", 72, 0.5, 72.5) ; - - m_h_tube_fakerate[k][l]->GetXaxis()->SetTitle("Tube"); - m_h_tube_fakerate[k][l]->GetYaxis()->SetTitle("Fakerate"); - m_h_tube_fakerate[k][l]->SetMarkerStyle(8); - - } - } - - - //entry histos (per layer) - - m_h_tube_entries_efficiency = std::vector< std::vector<TH1F*> >(2); //up to two multilayers - for (unsigned int k=0; k<m_h_tube_entries_efficiency.size(); k++) { - - m_h_tube_entries_efficiency[k] = std::vector<TH1F*>(4); // up to four layers per multilayer - for (unsigned int l=0; l<m_h_tube_entries_efficiency[k].size(); l++) { - - m_h_tube_entries_efficiency[k][l] - = new TH1F( Form("tube_entries_efficiency_%i_%i",k+1,l+1), - "Tube Entries Efficiency", 72, 0.5, 72.5) ; - - m_h_tube_entries_efficiency[k][l]->GetXaxis()->SetTitle("Tube"); - m_h_tube_entries_efficiency[k][l]->GetYaxis()->SetTitle("Entries"); - } - } - - m_h_tube_entries_fakerate = std::vector< std::vector<TH1F*> >(2); //up to two multilayers - for (unsigned int k=0; k<m_h_tube_entries_fakerate.size(); k++) { - - m_h_tube_entries_fakerate[k] = std::vector<TH1F*>(4); // up to four layers per multilayer - for (unsigned int l=0; l<m_h_tube_entries_fakerate[k].size(); l++) { - - m_h_tube_entries_fakerate[k][l] - = new TH1F( Form("tube_entries_fakerate_%i_%i",k+1,l+1), - "Tube Entries Fakerate", 72, 0.5, 72.5) ; - - m_h_tube_entries_fakerate[k][l]->GetXaxis()->SetTitle("Tube"); - m_h_tube_entries_fakerate[k][l]->GetYaxis()->SetTitle("Entries"); - } - } - - - //efficiency and fakerate histos (per chamber) - - m_h_layer_efficiency = new TH1F("layer_efficiency", "Layer Efficiency", 8, 0.5, 8.5); - m_h_chamber_efficiency = new TH1F("chamber_efficiency", "Chamber Efficiency", 3, -0.5, 2.5); - - m_h_layer_efficiency->GetXaxis()->SetTitle("Layer"); - m_h_layer_efficiency->GetYaxis()->SetTitle("Efficiency"); - m_h_layer_efficiency->SetMarkerStyle(8); - - m_h_chamber_efficiency->GetYaxis()->SetTitle("Efficiency"); - m_h_chamber_efficiency->SetMarkerStyle(8); - - return StatusCode::SUCCESS; - -} - -//***************************************************************************** - -//::::::::::::::::::::: -//:: METHOD finalize :: -//::::::::::::::::::::: - -StatusCode NtupleTubeEfficiencyTool::finalize(void) { - - ATH_MSG_INFO( "Finalizing NtupleTubeEfficiencyTool" ); - - m_tfile->Write(); - if(m_debug){ - m_tfile_debug->Write(); - } - - return StatusCode::SUCCESS; - -} - -//***************************************************************************** - -//:::::::::::::::::::::::: -//:: METHOD handleEvent :: -//:::::::::::::::::::::::: - -StatusCode -NtupleTubeEfficiencyTool::handleEvent( const MuonCalibEvent & event, - int eventnumber, - const std::vector<MuonCalibSegment *> &segments, - unsigned int position) { - - if(segments.size()<=position) return StatusCode::SUCCESS; - - MuonCalibSegment segment(*segments[position]); - - //---------------// - //-- Variables --// - //---------------// - - m_nb_trigger++; - - if(m_qfitter==NULL){ - m_qfitter = new QuasianalyticLineReconstruction(); - } - - - int nb_hits; - - // station identifiers // - - MuonFixedId Mid((segment.mdtHOT()[0])->identify()); - - //this has to be set in order to get the m_detMgr->getMdtReadoutElement() method working correctly - //otherwise also for the first multilayer, the second is returned - Mid.setMdtMultilayer(1); - - Identifier station_id = m_id_tool->fixedIdToId(Mid); - - - if(m_nb_multilayers<0){ - m_nb_multilayers = m_idHelperSvc->mdtIdHelper().numberOfMultilayers(station_id); - } - - - //----------// - //-- Hits --// - //----------// - - if(segment.mdtHitsOnTrack()<m_nb_hits){ - return StatusCode::SUCCESS; - } - - if(m_debug){ - - for (unsigned int k=0; k<segment.mdtHitsOnTrack(); k++) { - - MuonFixedId id((segment.mdtHOT()[k])->identify()); - - m_hit_ntuple->Fill(eventnumber, - id.stationName(), id.eta(), id.phi(), - id.mdtMultilayer(), id.mdtTubeLayer(), - id.mdtTube(), - (segment.mdtHOT()[k])->localPosition().x(), - (segment.mdtHOT()[k])->localPosition().y(), - (segment.mdtHOT()[k])->localPosition().z(), - (segment.mdtHOT()[k])->distanceToReadout(), - (segment.mdtHOT()[k])->driftTime(), - (segment.mdtHOT()[k])->driftRadius(), - (segment.mdtHOT()[k])->signedDistanceToTrack()); - - } - } - - //----------------// - //-- Efficiency --// - //----------------// - - m_qfitter->setRoadWidth(m_road_width); //0.65 - m_qfitter->switchOnRefit(); - - SG::ReadCondHandle<MuonGM::MuonDetectorManager> DetectorManagerHandle{m_DetectorManagerKey}; - const MuonGM::MuonDetectorManager* MuonDetMgr = DetectorManagerHandle.cptr(); - if(MuonDetMgr==nullptr){ - ATH_MSG_ERROR("Null pointer to the read MuonDetectorManager conditions object"); - return StatusCode::FAILURE; - } - - //loop over multilayers - for (int multilayer=1; multilayer<m_nb_multilayers+1; multilayer++) { - - const MuonGM::MdtReadoutElement* MdtRoEl = - MuonDetMgr->getMdtReadoutElement( m_idHelperSvc->mdtIdHelper().channelID(station_id,multilayer,1,1) ); - - if(m_nb_layers<0) m_nb_layers = MdtRoEl->getNLayers(); - if(m_nb_tubes<0) m_nb_tubes = MdtRoEl->getNtubesperlayer(); - - //loop over layers - for (int layer=1; layer<m_nb_layers+1; layer++) { - - nb_hits = 0; - - // hit selection vector for refits - IMdtSegmentFitter::HitSelection - hit_selection = IMdtSegmentFitter::HitSelection(segment.mdtHitsOnTrack()); - - - //exclude layer: layer in multilayer: multilayer // - - for (unsigned int l=0; l<segment.mdtHitsOnTrack(); l++) { - - MuonFixedId id((segment.mdtHOT()[l])->identify()); - - if (id.mdtMultilayer() == multilayer && - id.mdtTubeLayer() == layer) { - - hit_selection[l] = 1; - - } else { - - hit_selection[l] = 0; - nb_hits = nb_hits+1; - } - } - - if(m_exclude_layer){ - - m_h_chi2->Fill(m_qfitter->chi2PerDegreesOfFreedom()); - - if (!m_qfitter->fit(segment, hit_selection)) { - continue; - } - if (m_qfitter->numberOfTrackHits()<3) { - continue; - } - if(m_qfitter->chi2PerDegreesOfFreedom()>m_chi2_cut){ - continue; - } - - }else{ - - m_h_chi2->Fill(segment.chi2()); - - if(segment.chi2()>m_chi2_cut){ - continue; - } - } - - // find tube which has been traversed by the track // - - MTStraightLine track; - - if(m_exclude_layer){ - track = m_qfitter->track(); - } - else{ - track = MTStraightLine(segment.position(),segment.direction(), - Amg::Vector3D(0,0,0), Amg::Vector3D(0,0,0) - ); - } - - std::vector<int> traversed_tube(0); - - for (int k=0; k<m_nb_tubes; k++) { - - Amg::Vector3D TubePos = - MdtRoEl->GlobalToAmdbLRSCoords(MdtRoEl->tubePos(multilayer,layer,k+1)); - - Amg::Vector3D tube_position = Amg::Vector3D(TubePos.x(), TubePos.y(), TubePos.z()); - Amg::Vector3D tube_direction = Amg::Vector3D(1,0,0); - - MTStraightLine tube = MTStraightLine( tube_position, tube_direction, - Amg::Vector3D(0,0,0), Amg::Vector3D(0,0,0) - ); - - double distance = std::abs(track.signDistFrom(tube)); - - if ( distance < (MdtRoEl->innerTubeRadius()) ){ - traversed_tube.push_back(k+1); - m_h_distance->Fill(distance); - } - } - - m_h_nb_hit_tubes->Fill(traversed_tube.size()); - - - // check whether the traversed tubes give a hit // - - //collect raw hits in the excluded layer // - const MuonCalibRawHitCollection *raw_hits(event.rawHitCollection()); - - std::vector<int> hit_tube(0); - - for (MuonCalibRawHitCollection::MuonCalibRawMdtHitVecCit it= - raw_hits->rawMdtHitCollectionBegin(); - it!=raw_hits->rawMdtHitCollectionEnd(); ++it) { - - MuonCalibRawMdtHit *hit = *it; - - if (m_reg_sel_svc->isInRegion(hit->identify()) && - (hit->identify()).mdtMultilayer() == multilayer && - (hit->identify()).mdtTubeLayer() == layer) { - - hit_tube.push_back( (hit->identify()).mdtTube() ); - - } - } - - // Efficiencies // - - //loop over traversed tubes - for (unsigned int k=0; k<traversed_tube.size(); k++) { - - int hit_flag = 0; - - //loop over hit tubes - for (unsigned int j=0; j<hit_tube.size(); j++) { - - if(traversed_tube[k]==hit_tube[j]){ - hit_flag = 1; - break; - } - } - - m_h_efficiency[multilayer-1][layer-1][ traversed_tube[k]-1 ]->Fill(hit_flag); - } - - - // Fakerate // - - //loop over hit tubes - for (unsigned int k=0; k<hit_tube.size(); k++) { - - int fake_flag = 0; - - //loop over traversed tubes - for (unsigned int j=0; j<traversed_tube.size(); j++) { - - if(hit_tube[k]!=traversed_tube[j]){ - fake_flag = 1; - } - } - - m_h_fakerate[multilayer-1][layer-1][ hit_tube[k]-1 ]->Fill(fake_flag); - } - - - } //end of loop over layers - - } //end of loop over multilayers - - return StatusCode::SUCCESS; - -} - -//***************************************************************************** - -//:::::::::::::::::::::::::::: -//:: METHOD analyseSegments :: -//:::::::::::::::::::::::::::: - -StatusCode -NtupleTubeEfficiencyTool::analyseSegments(const std::vector<MuonCalibSegment *> & /*segemnts*/) { - - std::string outfilename = m_file_name + ".txt"; - - std::ofstream outfile(outfilename.c_str()); - outfile << "ml \t ly \t tube \t efficiency \t error \t fakerate \t ferror" << std::endl; - - //initialize summary variables - - int chamber_ntubes; - double chamber_efficiency; - double chamber_error; - double chamber_entries; - - std::vector<int> multilayer_ntubes(m_nb_multilayers); - std::vector<double> multilayer_efficiency(m_nb_multilayers); - std::vector<double> multilayer_error(m_nb_multilayers); - std::vector<double> multilayer_entries(m_nb_multilayers); - - std::vector<std::vector<int> > layer_ntubes(m_nb_multilayers, std::vector<int>(m_nb_layers)); - std::vector<std::vector<double> > layer_efficiency(m_nb_multilayers, std::vector<double>(m_nb_layers)); - std::vector<std::vector<double> > layer_error(m_nb_multilayers, std::vector<double>(m_nb_layers)); - std::vector<std::vector<double> > layer_entries(m_nb_multilayers, std::vector<double>(m_nb_layers)); - - chamber_ntubes = 0; - chamber_efficiency = 0.; - chamber_error = 0.; - chamber_entries = 0; - - for (int k=0; k<m_nb_multilayers; k++) { - - multilayer_ntubes[k] = 0; - multilayer_efficiency[k] = 0.; - multilayer_error[k] = 0.; - multilayer_entries[k] = 0; - - for (int l=0; l<m_nb_layers; l++) { - layer_ntubes[k][l] = 0; - layer_efficiency[k][l] = 0.; - layer_error[k][l] = 0.; - layer_entries[k][l] = 0; - } - } - - //calculate and fill tube efficiencies - - //loop over multilayers - for (int k=0; k<m_nb_multilayers; k++) { - - //loop over layers - for (int l=0; l<m_nb_layers; l++) { - - //loop over tubes - for (int m=0; m<m_nb_tubes; m++) { - - //calculate efficiency, fakerate and errors - - double efficiency = m_h_efficiency[k][l][m]->GetMean(); - double entries = m_h_efficiency[k][l][m]->GetEntries(); - double error = 0.; - - if(entries!=0){ - error = ( 1/std::sqrt(entries) ) * std::sqrt( efficiency*(1-efficiency) ); - } - - double fakerate = m_h_fakerate[k][l][m]->GetMean() / (double)m_nb_trigger; - double fentries = m_h_fakerate[k][l][m]->GetEntries(); - double ferror = 0; - - if(fentries!=0){ - ferror = ( 1/std::sqrt(fentries) ) * std::sqrt( fakerate*(1-fakerate) ); - } - - - //fill histos - - TString title = "Tube Efficiency "; - title += TString(m_reg_sel_svc->GetRegionSelection()); - title += Form(" (ml%i, ly%i)",k+1,l+1); - - m_h_tube_efficiency[k][l]->SetTitle(title); - m_h_tube_fakerate[k][l]->SetTitle(title.ReplaceAll("Efficiency","Fakerate")); - - m_h_tube_efficiency[k][l]->SetBinContent(m+1,efficiency); - m_h_tube_efficiency[k][l]->SetBinError(m+1,error); - - m_h_tube_fakerate[k][l]->SetBinContent(m+1,fakerate); - m_h_tube_fakerate[k][l]->SetBinError(m+1,ferror); - - m_h_tube_efficiency[k][l]->GetXaxis()->SetRange(1,m_nb_tubes); - m_h_tube_fakerate[k][l]->GetXaxis()->SetRange(1,m_nb_tubes); - - - //write text file - - outfile << k+1 << "\t" << l+1 << "\t" << m+1 << "\t" - << Form("%1.3f",efficiency) << "\t" - << Form("%1.3f",error) << "\t" - << Form("%1.8f",fakerate) << "\t" - << Form("%1.3f",ferror) << std::endl; - - - //entry histos - - TString entry_title = "Tube Entries (Efficiency) "; - entry_title += TString(m_reg_sel_svc->GetRegionSelection()); - entry_title += Form(" (ml%i, ly%i)",k+1,l+1); - - m_h_tube_entries_efficiency[k][l]->SetTitle(entry_title); - m_h_tube_entries_fakerate[k][l]->SetTitle(entry_title.ReplaceAll("Efficiency","Fakerate")); - - m_h_tube_entries_efficiency[k][l]->SetBinContent(m+1,entries); - m_h_tube_entries_fakerate[k][l]->SetBinContent(m+1,fentries); - - m_h_tube_entries_efficiency[k][l]->GetXaxis()->SetRange(1,m_nb_tubes); - m_h_tube_entries_fakerate[k][l]->GetXaxis()->SetRange(1,m_nb_tubes); - - //summarized efficiencies - if(error>0){ - - layer_ntubes[k][l]++; - layer_efficiency[k][l] += 1./std::pow(error,2)*efficiency; - layer_error[k][l] += 1./std::pow(error,2); - layer_entries[k][l] += entries; - - multilayer_ntubes[k]++; - multilayer_efficiency[k] += 1./std::pow(error,2)*efficiency; - multilayer_error[k] += 1./std::pow(error,2); - multilayer_entries[k] += entries; - - chamber_ntubes++; - chamber_efficiency += 1./std::pow(error,2)*efficiency; - chamber_error += 1./std::pow(error,2); - chamber_entries += entries; - - } - } - } - } - - //fill summary histos - TString layer_title = "Layer Efficiency "; - layer_title += TString(m_reg_sel_svc->GetRegionSelection()); - - m_h_layer_efficiency->SetTitle(layer_title); - m_h_layer_efficiency->GetXaxis()->SetRange(1,m_nb_multilayers*m_nb_layers); - - TString chamber_title = "Efficiency "; - chamber_title += TString(m_reg_sel_svc->GetRegionSelection()); - - m_h_chamber_efficiency->SetTitle(chamber_title); - m_h_chamber_efficiency->GetXaxis()->SetRange(1,m_nb_multilayers+1); - - int layer_bin = 1; - int chamber_bin = 2; - - for (int k=0; k<m_nb_multilayers; k++) { - - for (int l=0; l<m_nb_layers; l++) { - - double layer_eff = 0.; - double layer_err = 0.; - - if(layer_error[k][l]>0){ - layer_eff = layer_efficiency[k][l]/layer_error[k][l]; - layer_err = std::sqrt(1./layer_error[k][l]); - } - - m_h_layer_efficiency->SetBinContent(layer_bin, layer_eff); - m_h_layer_efficiency->SetBinError(layer_bin, layer_err); - - layer_bin++; - } - - double ml_eff = 0.; - double ml_err = 0.; - - if(multilayer_error[k]>0){ - ml_eff = multilayer_efficiency[k]/multilayer_error[k]; - ml_err = std::sqrt(1./multilayer_error[k]); - } - - m_h_chamber_efficiency->SetBinContent(chamber_bin, ml_eff); - m_h_chamber_efficiency->SetBinError(chamber_bin, ml_err); - m_h_chamber_efficiency->GetXaxis()->SetBinLabel(chamber_bin, TString(Form("ml%i",k+1)).Data()); - - chamber_bin++; - } - - double ch_eff = 0.; - double ch_err = 0.; - - if(chamber_error>0){ - ch_eff = chamber_efficiency/chamber_error; - ch_err = std::sqrt(1./chamber_error); - } - - m_h_chamber_efficiency->SetBinContent(1, ch_eff); - m_h_chamber_efficiency->SetBinError(1, ch_err); - m_h_chamber_efficiency->GetXaxis()->SetBinLabel(1,"chamber"); - m_h_chamber_efficiency->LabelsOption("d"); - - - //delete not used histos - - for (int k=0; k<2; k++) { //multilayers - - for (int l=0; l<4; l++) { //layers - - if(k>m_nb_multilayers-1 || l>m_nb_layers-1){ - delete m_h_tube_efficiency[k][l]; - delete m_h_tube_fakerate[k][l]; - delete m_h_tube_entries_efficiency[k][l]; - delete m_h_tube_entries_fakerate[k][l]; - } - } - } - - - return StatusCode::SUCCESS; - -} - -} diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/src/NtupleWireCentricity.cxx b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/src/NtupleWireCentricity.cxx deleted file mode 100644 index 925c391bb7b7d3243b62f23ad40056931bd5edad..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/src/NtupleWireCentricity.cxx +++ /dev/null @@ -1,214 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -// standard C++ // -#include <iostream> -#include <fstream> - -//root -#include "TFile.h" -#include "TH1.h" -#include "TF1.h" - -// MuonCalibEventBase // -#include "MuonCalibEventBase/MuonCalibSegment.h" -#include "MuonCalibEventBase/MdtCalibHitBase.h" - -//this - #include "MuonCalibStandAloneTools/NtupleWireCentricityTool.h" - - -//MdtCalibT0 -#include "MdtCalibT0/T0MTHistos.h" -#include "MdtCalibT0/T0MTSettings.h" - - -//MdtCalibIOSvc -#include "MdtCalibIOSvc/MdtCalibInputSvc.h" - -//MdtcalibData -#include "MdtCalibData/IRtRelation.h" - - -namespace MuonCalib { - -///////////////// -// Constructor // -///////////////// - -NtupleWireCentricityTool :: NtupleWireCentricityTool(const std::string& t, const std::string& n, const IInterface* p) : AthAlgTool(t, n, p), m_min_track_slope(0.6), m_region_width(8e8), m_calib_input_svc("MdtCalibInputSvc", n) - { - declareInterface< NtupleCalibrationTool >(this) ; - declareProperty("MinTrackSlope", m_min_track_slope); - declareProperty("RegionWidth", m_region_width); - declareProperty("MdtCalibInputSvc", m_calib_input_svc); - } - - -//////////////// -// initialize // -//////////////// - -StatusCode NtupleWireCentricityTool :: initialize() - { - ATH_MSG_INFO( "Initializing NtupleWireCentricityTool" ); - - -//create root file and histograms - p_root_file = new TFile("WireCentricity.root", "RECREATE"); - p_dt_spec_left = new TH1F("p_dt_spec_left", "", 1701, -200.5 * (25.0 / 32.0), 1500.5 * (25.0 / 32.0)); - p_dt_spec_right = new TH1F("p_dt_spec_right", "", 1701, -200.5 * (25.0 / 32.0), 1500.5 * (25.0 / 32.0)); - p_dt_spec_above = new TH1F("p_dt_spec_above", "", 1701, -200.5 * (25.0 / 32.0), 1500.5 * (25.0 / 32.0)); - p_dt_spec_below = new TH1F("p_dt_spec_below", "", 1701, -200.5 * (25.0 / 32.0), 1500.5 * (25.0 / 32.0)); - m_track_radius = new TH1F("track_radius", "", 200, -16.0, 16.0); - p_track_slope_cut = new TH1F("track_slope_cut", "", 1000, 0, 3); - p_track_slope = new TH1F("track_slope", "", 1000, -3, 3); - m_x_coordinate = new TH1F("x_coordinate", "", 4000, -2000, 2000); - - ATH_MSG_INFO( "tool initialized." ); -//get calibration input service - ATH_CHECK( m_calib_input_svc.retrieve() ); - setRegion(); - return StatusCode::SUCCESS; - } - - -///////////////// -// handleEvent // -///////////////// - -StatusCode NtupleWireCentricityTool :: handleEvent(const MuonCalibEvent &/*event*/, int /*evnt_nr*/, const std::vector<MuonCalibSegment *> &segments, unsigned int position) - { - for(unsigned int i=position; i<segments.size(); i++) - { - //chaeck for minimal track inclination - // !!not valid for end-cap chambers!! - const MuonCalibSegment *seg(segments[i]); - double track_slope(seg->direction().y() / seg->direction().z()); - if(std::isnan(track_slope)) continue; - p_track_slope->Fill(track_slope); - - //loop on all track hits - for(MuonCalibSegment::MdtHitCit it = seg->mdtHOTBegin(); it!=seg->mdtHOTEnd(); it++) - { - const MdtCalibHitBase *hit=(*it); - process_hit(hit, track_slope); - } - for(MuonCalibSegment::MdtHitCit it = seg->mdtCloseHitsBegin(); it!=seg->mdtCloseHitsEnd(); it++) - { - const MdtCalibHitBase *hit=(*it); - process_hit(hit, track_slope); - } - } - return StatusCode::SUCCESS; - } - - -//////////////////// -//analyseSegments // -//////////////////// - -StatusCode NtupleWireCentricityTool :: analyseSegments(const std::vector<MuonCalibSegment *> & /*segemnts*/) - { - T0MTHistos histos; - T0MTSettings settings; - settings.AddFitfun()=true; - settings.DrawDebugGraphs()=true; - std::ofstream summary_file; -//create summary tree - TTree *summary_tree=new TTree("summary_tree", ""); - summary_tree->Branch("station", &m_station, "station/I"); - summary_tree->Branch("eta", &m_eta, "eta/I"); - summary_tree->Branch("phi", &m_phi, "phi/I"); - summary_tree->Branch("hw_phi", &m_hw_phi, "hw_phi/I"); - summary_tree->Branch("mean_track_slope", &m_mean_track_slope, "mean_track_slope/D"); - summary_tree->Branch("n_hits", &m_n_hits, "n_hits/I"); - summary_tree->Branch("drift_velocity", &m_drift_velocity, "drift_velocity/D"); - Double_t l_above(9e9), l_below(9e9); - summary_tree->Branch("l_above", &l_above, "l_above/D"); - summary_tree->Branch("l_below", &l_below, "l_below/D"); - - Double_t mean_x(m_x_coordinate->GetMean()); - Double_t all_mean_slope(p_track_slope->GetMean()); - summary_tree->Branch("mean_x", &mean_x, "mean_x/D"); - summary_tree->Branch("all_mean_slope", &all_mean_slope, "all_mean_slope/D"); - Int_t n_hits_above(static_cast<Int_t>(p_dt_spec_above->GetEntries())), n_hits_below(static_cast<Int_t>(p_dt_spec_below->GetEntries())); - summary_tree->Branch("n_hits_above", &n_hits_above, "n_hits_above/I"); - summary_tree->Branch("n_hits_below", &n_hits_below, "n_hits_below/I"); - - Double_t l_left(9e9), l_right(9e9); - summary_tree->Branch("l_left", &l_left, "l_left/D"); - summary_tree->Branch("l_right", &l_right, "l_right/D"); - - m_n_hits = static_cast<Int_t>(p_track_slope_cut->GetEntries()); - m_mean_track_slope = p_track_slope_cut->GetMean(); - histos.SetTSpec(0, p_dt_spec_left, &settings); - if(histos.FitT0()) - { - if(histos.FitTmax()) - l_left=histos.GetTMaxFunction()-> GetParameter(T0MTHistos :: TMAX_PAR_NR_TMAX) - histos.GetT0Function()->GetParameter(T0MTHistos :: T0_PAR_NR_T0); - } - histos.SetTSpec(1, p_dt_spec_right, &settings); - if(histos.FitT0()) - { - if(histos.FitTmax()) - l_right=histos.GetTMaxFunction()-> GetParameter(T0MTHistos :: TMAX_PAR_NR_TMAX) - histos.GetT0Function()->GetParameter(T0MTHistos :: T0_PAR_NR_T0); - } - histos.SetTSpec(2, p_dt_spec_below, &settings); - if(histos.FitT0()) - { - if(histos.FitTmax()) - l_above=histos.GetTMaxFunction()-> GetParameter(T0MTHistos :: TMAX_PAR_NR_TMAX) - histos.GetT0Function()->GetParameter(T0MTHistos :: T0_PAR_NR_T0); - } - histos.SetTSpec(3, p_dt_spec_above, &settings); - if(histos.FitT0()) - { - if(histos.FitTmax()) - l_below=histos.GetTMaxFunction()-> GetParameter(T0MTHistos :: TMAX_PAR_NR_TMAX) - histos.GetT0Function()->GetParameter(T0MTHistos :: T0_PAR_NR_T0); - } - ATH_MSG_INFO( "Summary:" ); - ATH_MSG_INFO( "left/right: "<<l_left - l_right <<" ns " << (l_left - l_right)*m_drift_velocity << "mm: slope is "<<p_track_slope->GetMean() ); - ATH_MSG_INFO( "above/below: "<<l_above - l_below <<" ns " << (l_above - l_below)*m_drift_velocity << "mm: slope is "<<m_mean_track_slope ); - summary_tree->Fill(); - p_root_file->Write(); - - return StatusCode::SUCCESS; - } - -void NtupleWireCentricityTool :: setRegion() - { - const IRtRelation *rtrel=m_calib_input_svc->GetRtRelation(); - if(rtrel==NULL) return; - m_drift_velocity = rtrel->driftvelocity(rtrel->tUpper() - 50); - ATH_MSG_INFO( "Drift velocity is "<<m_drift_velocity ); - } - -inline void NtupleWireCentricityTool :: process_hit(const MdtCalibHitBase * hit, const double & track_slope) - { - double r_track=hit->signedDistanceToTrack(); - m_track_radius->Fill(r_track); - m_x_coordinate->Fill(hit->localPosition().x()); - if(std::abs(hit->localPosition().x())>m_region_width/2) return; - //fill right left histograms - if(r_track<0) - p_dt_spec_left->Fill(static_cast<Axis_t>(hit-> driftTime())); - else - p_dt_spec_right->Fill(static_cast<Axis_t>(hit-> driftTime())); - //check for track slope - if(std::abs(track_slope) < m_min_track_slope) return; - if((r_track < 0 && track_slope < 0) || (r_track > 0 && track_slope > 0)) - { - p_dt_spec_below->Fill(static_cast<Axis_t>(hit-> driftTime())); - } - else - { - p_dt_spec_above->Fill(static_cast<Axis_t>(hit-> driftTime())); - } - p_track_slope_cut->Fill(std::abs(track_slope)); - m_station=hit->identify().stationName(); - m_eta=hit->identify().eta(); - m_phi=hit->identify().phi(); - m_hw_phi=m_phi * 2 - (m_station % 2); - } -} diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/src/components/MuonCalibStandAloneTools_entries.cxx b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/src/components/MuonCalibStandAloneTools_entries.cxx deleted file mode 100644 index 1df9a40a0b5b3a2a2b8d21ed46a3cb3cd466d370..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/src/components/MuonCalibStandAloneTools_entries.cxx +++ /dev/null @@ -1,36 +0,0 @@ -#include "MuonCalibStandAloneTools/NtupleMTT0Tool.h" -#include "MuonCalibStandAloneTools/NtupleCalibADCTool.h" -#include "MuonCalibStandAloneTools/NtupleClassicT0Tool.h" -#include "MuonCalibStandAloneTools/NtupleIntegrationTool.h" -#include "MuonCalibStandAloneTools/NtupleAnalyticAutocalibrationTool.h" -#include "MuonCalibStandAloneTools/NtupleSimpleresolutionTool.h" -#include "MuonCalibStandAloneTools/NtupleChisqResolutionTool.h" -#include "MuonCalibStandAloneTools/NtupleTubeEfficiencyTool.h" -#include "MuonCalibStandAloneTools/NtupleRunScanTool.h" -#include "MuonCalibStandAloneTools/NtupleControlHistogramsTool.h" -#include "MuonCalibStandAloneTools/NtupleResidualTool.h" -#include "MuonCalibStandAloneTools/NtupleDisplayTool.h" -#include "MuonCalibStandAloneTools/NtupleWireCentricityTool.h" -#include "MuonCalibStandAloneTools/NtupleCurvedAutocalibrationTool.h" -#include "MuonCalibStandAloneTools/NtupleDBCheckTool.h" -#include "MuonCalibStandAloneTools/NtupleResidualVsTimeTool.h" - -using namespace MuonCalib; - -DECLARE_COMPONENT( NtupleMTT0Tool ) -DECLARE_COMPONENT( NtupleCalibADCTool ) -DECLARE_COMPONENT( NtupleClassicT0Tool ) -DECLARE_COMPONENT( NtupleIntegrationTool ) -DECLARE_COMPONENT( NtupleAnalyticAutocalibrationTool ) -DECLARE_COMPONENT( NtupleChisqResolutionTool ) -DECLARE_COMPONENT( NtupleSimpleResolutionTool ) -DECLARE_COMPONENT( NtupleTubeEfficiencyTool ) -DECLARE_COMPONENT( NtupleRunScanTool ) -DECLARE_COMPONENT( NtupleControlHistogramsTool ) -DECLARE_COMPONENT( NtupleResidualTool ) -DECLARE_COMPONENT( NtupleDisplayTool ) -DECLARE_COMPONENT( NtupleWireCentricityTool ) -DECLARE_COMPONENT( NtupleCurvedAutocalibrationTool ) -DECLARE_COMPONENT( NtupleDbCheckTool ) -DECLARE_COMPONENT( NtupleResidualVsTimeTool ) - diff --git a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/STGC_DigitToRDO.cxx b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/STGC_DigitToRDO.cxx index f30e3d92a5e5c2eb039f383d2076fd6594341af6..7da306246ab6551d7b8d4d86044dbe32d05d848e 100644 --- a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/STGC_DigitToRDO.cxx +++ b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/STGC_DigitToRDO.cxx @@ -54,7 +54,8 @@ StatusCode STGC_DigitToRDO::execute(const EventContext& ctx) const uint16_t bcTag = digit->bcTag(); // keep the time as a float for now, but it should also become an int float time = digit->time(); - uint16_t charge = (uint16_t) digit->charge_10bit(); + //uint16_t charge = (uint16_t) digit->charge_10bit(); + uint16_t charge = (uint16_t) digit->charge(); // 10bit charge conversion to PDO is done else where as a quick fix for now; correct version incoming in the next few days bool isDead = digit->isDead(); STGC_RawData* rdo = new STGC_RawData(id, bcTag, time, charge, isDead); coll->push_back(rdo); diff --git a/MuonSpectrometer/MuonDigitization/sTGC_Digitization/share/sTGC_Digitization_VMM.config b/MuonSpectrometer/MuonDigitization/sTGC_Digitization/share/sTGC_Digitization_VMM.config index ddb55a4577ddcb3f3a35ed7c9e71d7b6d51e74f8..f74723dcaa1dc16db822d0ec6bb9b76bbaafd8ad 100644 --- a/MuonSpectrometer/MuonDigitization/sTGC_Digitization/share/sTGC_Digitization_VMM.config +++ b/MuonSpectrometer/MuonDigitization/sTGC_Digitization/share/sTGC_Digitization_VMM.config @@ -1,4 +1,4 @@ neighborON 1 -mainThreshold 0.05 +mainThreshold 0.02 neighborThreshold 0.0 -readoutTick 1 \ No newline at end of file +readoutTick 1 diff --git a/MuonSpectrometer/MuonDigitization/sTGC_Digitization/src/sTgcDigitMaker.cxx b/MuonSpectrometer/MuonDigitization/sTGC_Digitization/src/sTgcDigitMaker.cxx index 83e62ecae4c011e17d55f21736a8dad8db1006a9..596d29c1d5d597d4a2c118a06b000f6c788078d7 100644 --- a/MuonSpectrometer/MuonDigitization/sTGC_Digitization/src/sTgcDigitMaker.cxx +++ b/MuonSpectrometer/MuonDigitization/sTGC_Digitization/src/sTgcDigitMaker.cxx @@ -275,10 +275,18 @@ sTgcDigitCollection* sTgcDigitMaker::executeDigi(const sTGCSimHit* hit, const fl int NumberOfStrips = detEl->numberOfStrips(newId); double stripHalfWidth = detEl->channelPitch(newId)*0.5; // 3.2/2 = 1.6 mm + //************************************ conversion of energy to charge ************************************** + + // Constant determined from ionization study within Garfield + // Note titled Charge Energy Relation which outlines conversion can be found here https://cernbox.cern.ch/index.php/apps/files/?dir=/__myshares/Documents (id:274113) + double ionized_charge = (5.65E-6)*energyDeposit/CLHEP::keV; // initial ionized charge in pC per keV deposited + double gain = 1.6E5; // mean value for total gain due to E field; needs to be verified; statistical flucuation calculation incoming + double total_charge = gain*ionized_charge; // total charge after avalanche using average gain of 2E5 + //************************************ spread charge among readout element ************************************** //spread charge to a gaussian distribution float charge_width = CLHEP::RandGauss::shoot(m_engine, m_GausMean, m_GausSigma); - float norm = 1000. * energyDeposit/(charge_width*std::sqrt(2.*M_PI)); //normalization: 1Kev --> Intergral=1 + float norm = 0.5*total_charge/(charge_width*std::sqrt(2.*M_PI)); // each readout plane reads about half the total charge produced on the wire TF1 *charge_spread = new TF1("fgaus", "gaus(0)", -1000., 1000.); charge_spread->SetParameters(norm, posOnSurf_strip.x(), charge_width); diff --git a/MuonSpectrometer/MuonDigitization/sTGC_Digitization/src/sTgcDigitizationTool.cxx b/MuonSpectrometer/MuonDigitization/sTGC_Digitization/src/sTgcDigitizationTool.cxx index 2d3c42d5d3a61554d6f7345a93cdf24ad4a26570..ab7c01b86386dae168175ce88c20520d0c31f25f 100644 --- a/MuonSpectrometer/MuonDigitization/sTGC_Digitization/src/sTgcDigitizationTool.cxx +++ b/MuonSpectrometer/MuonDigitization/sTGC_Digitization/src/sTgcDigitizationTool.cxx @@ -988,6 +988,13 @@ StatusCode sTgcDigitizationTool::doDigitization(const EventContext& ctx) { if ( acceptDigit ) { + if ( m_idHelperSvc->stgcIdHelper().channelType(it_digit->identify()) == 1 ) { + //Only strips since strips are readout in PDO counts and not charge + chargeAfterSmearing = 1000*chargeAfterSmearing; // VMM gain setting for conversion from charge to potential, 1mV=1fC; from McGill cosmics tests + chargeAfterSmearing = chargeAfterSmearing*1.0304 + 59.997; // conversion from potential to PDO for VMM1 configuration, mV*1.0304 + 59.997; from Shandong cosmics tests + // link to study outlining conversion https://doi.org/10.1016/j.nima.2019.02.061 + } + std::unique_ptr<sTgcDigit> finalDigit = std::make_unique<sTgcDigit>(it_digit->identify(), it_digit->bcTag(), it_digit->time(), diff --git a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/CscClusterization/src/CscPeakThresholdClusterBuilderTool.cxx b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/CscClusterization/src/CscPeakThresholdClusterBuilderTool.cxx index 6bbeef220936b1b897fb29c323cab0a3970d9567..70746b9da01c0a1ff47f622f97b19fcfb41e89fa 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/CscClusterization/src/CscPeakThresholdClusterBuilderTool.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/CscClusterization/src/CscPeakThresholdClusterBuilderTool.cxx @@ -9,7 +9,6 @@ #include "MuonPrepRawData/CscStripPrepDataContainer.h" #include "MuonPrepRawData/CscStripPrepData.h" #include "MuonReadoutGeometry/CscReadoutElement.h" -#include "MuonReadoutGeometry/MuonDetectorManager.h" #include "TrkSurfaces/Surface.h" #include "MuonPrepRawData/CscClusterStatus.h" @@ -67,7 +66,7 @@ CscPeakThresholdClusterBuilderTool(const std::string &type, const std::string &a m_pfitter_def("SimpleCscClusterFitter/SimpleCscClusterFitter"), m_pfitter_prec("QratCscClusterFitter/QratCscClusterFitter"), m_pfitter_split("CscSplitClusterFitter/CscSplitClusterFitter"), - m_pmuon_detmgr(0), m_phelper(0), m_fullEventDone(false) + m_fullEventDone(false) { declareInterface<ICscClusterBuilder>(this); @@ -138,14 +137,9 @@ StatusCode CscPeakThresholdClusterBuilderTool::initialize(){ } ATH_MSG_DEBUG ( "Retrieved CSC split cluster fitting tool" ); - if ( detStore()->retrieve(m_pmuon_detmgr).isFailure() ) { - ATH_MSG_FATAL ( " Cannot retrieve MuonGeoModel " ); - return StatusCode::FAILURE; - } - ATH_MSG_DEBUG ( "Retrieved geometry." ); - - m_phelper = m_pmuon_detmgr->cscIdHelper(); - + // retrieve MuonDetectorManager from the conditions store + ATH_CHECK(m_DetectorManagerKey.initialize()); + ATH_CHECK(m_idHelperSvc.retrieve()); return StatusCode::SUCCESS; } @@ -159,7 +153,7 @@ StatusCode CscPeakThresholdClusterBuilderTool::getClusters(std::vector<Identifie if (!m_cluster_handle.isPresent()) { /// clean up the PrepRawData container - auto object = std::make_unique<CscPrepDataContainer>(m_phelper->module_hash_max()); + auto object = std::make_unique<CscPrepDataContainer>(m_idHelperSvc->cscIdHelper().module_hash_max()); /// record the container in storeGate if ( m_cluster_handle.record(std::move(object)).isFailure() ) { @@ -234,9 +228,9 @@ StatusCode CscPeakThresholdClusterBuilderTool::getClusters(IdentifierHash givenH ATH_MSG_DEBUG ( "Retrieved " << col->size() << " CSC Strip PrepDatas." ); Identifier colid = col->identify(); - int istation = m_phelper->stationName(colid) - 49; - int zsec = m_phelper->stationEta(colid); - int phisec = m_phelper->stationPhi(colid); + int istation = m_idHelperSvc->cscIdHelper().stationName(colid) - 49; + int zsec = m_idHelperSvc->cscIdHelper().stationEta(colid); + int phisec = m_idHelperSvc->cscIdHelper().stationPhi(colid); ATH_MSG_DEBUG ( " Strip collection " << chamber(istation, zsec, phisec) << " has " << col->size() << " strips" ); @@ -245,6 +239,14 @@ StatusCode CscPeakThresholdClusterBuilderTool::getClusters(IdentifierHash givenH vector<const CscStripPrepData*> strips[8]; int maxstrip[8] = {0, 0, 0, 0, 0, 0, 0, 0}; + // retrieve MuonDetectorManager from the conditions store + SG::ReadCondHandle<MuonGM::MuonDetectorManager> DetectorManagerHandle{m_DetectorManagerKey}; + const MuonGM::MuonDetectorManager* MuonDetMgr = DetectorManagerHandle.cptr(); + if(MuonDetMgr==nullptr){ + ATH_MSG_ERROR("Null pointer to the MuonDetectorManager conditions object"); + return StatusCode::FAILURE; + } + IdentifierHash hash; // Loop over digits and fill these arrays. for ( CscStripPrepDataCollection::const_iterator idig=col->begin(); @@ -252,9 +254,9 @@ StatusCode CscPeakThresholdClusterBuilderTool::getClusters(IdentifierHash givenH const CscStripPrepData& dig = **idig; Identifier did = dig.identify(); hash=dig.collectionHash(); - const CscReadoutElement* pro = m_pmuon_detmgr->getCscReadoutElement(did); - int wlay = m_phelper->wireLayer(did); - int measphi = m_phelper->measuresPhi(did); + const CscReadoutElement* pro = MuonDetMgr->getCscReadoutElement(did); + int wlay = m_idHelperSvc->cscIdHelper().wireLayer(did); + int measphi = m_idHelperSvc->cscIdHelper().measuresPhi(did); int idx = 2*(wlay-1) + measphi; // First entry for a cathode plane, initialize. if ( maxstrip[idx] == 0 ) { @@ -262,7 +264,7 @@ StatusCode CscPeakThresholdClusterBuilderTool::getClusters(IdentifierHash givenH for ( int istrip=0; istrip<maxstrip[idx]; ++istrip ) strips[idx].push_back(0); } - int istrip = m_phelper->strip(did) - 1; + int istrip = m_idHelperSvc->cscIdHelper().strip(did) - 1; if ( istrip<0 || istrip>=maxstrip[idx] ) { ATH_MSG_WARNING ( "Invalid strip number" ); continue; @@ -315,9 +317,9 @@ StatusCode CscPeakThresholdClusterBuilderTool::getClusters(std::vector<Identifie icol!=con.end(); ++icol) { const CscStripPrepDataCollection& col = **icol; Identifier colid = col.identify(); - int istation = m_phelper->stationName(colid) - 49; - int zsec = m_phelper->stationEta(colid); - int phisec = m_phelper->stationPhi(colid); + int istation = m_idHelperSvc->cscIdHelper().stationName(colid) - 49; + int zsec = m_idHelperSvc->cscIdHelper().stationEta(colid); + int phisec = m_idHelperSvc->cscIdHelper().stationPhi(colid); ATH_MSG_DEBUG ( " Strip collection " << chamber(istation, zsec, phisec) << " has " << col.size() << " strips" ); @@ -325,6 +327,14 @@ StatusCode CscPeakThresholdClusterBuilderTool::getClusters(std::vector<Identifie vector<const CscStripPrepData*> strips[8]; int maxstrip[8] = {0, 0, 0, 0, 0, 0, 0, 0}; + // retrieve MuonDetectorManager from the conditions store + SG::ReadCondHandle<MuonGM::MuonDetectorManager> DetectorManagerHandle{m_DetectorManagerKey}; + const MuonGM::MuonDetectorManager* MuonDetMgr = DetectorManagerHandle.cptr(); + if(MuonDetMgr==nullptr){ + ATH_MSG_ERROR("Null pointer to the MuonDetectorManager conditions object"); + return StatusCode::FAILURE; + } + IdentifierHash hash; // Loop over digits and fill these arrays. for ( CscStripPrepDataCollection::const_iterator idig=col.begin(); @@ -332,9 +342,9 @@ StatusCode CscPeakThresholdClusterBuilderTool::getClusters(std::vector<Identifie const CscStripPrepData& dig = **idig; Identifier did = dig.identify(); hash=dig.collectionHash(); - const CscReadoutElement* pro = m_pmuon_detmgr->getCscReadoutElement(did); - int wlay = m_phelper->wireLayer(did); - int measphi = m_phelper->measuresPhi(did); + const CscReadoutElement* pro = MuonDetMgr->getCscReadoutElement(did); + int wlay = m_idHelperSvc->cscIdHelper().wireLayer(did); + int measphi = m_idHelperSvc->cscIdHelper().measuresPhi(did); int idx = 2*(wlay-1) + measphi; // First entry for a cathode plane, initialize. if ( maxstrip[idx] == 0 ) { @@ -342,7 +352,7 @@ StatusCode CscPeakThresholdClusterBuilderTool::getClusters(std::vector<Identifie for ( int istrip=0; istrip<maxstrip[idx]; ++istrip ) strips[idx].push_back(0); } - int istrip = m_phelper->strip(did) - 1; + int istrip = m_idHelperSvc->cscIdHelper().strip(did) - 1; if ( istrip<0 || istrip>=maxstrip[idx] ) { ATH_MSG_WARNING ( "Invalid strip number" ); continue; @@ -415,7 +425,7 @@ make_clusters(bool measphi, const vector<const CscStripPrepData*>& strips,CscPre if ( pstrip ) { if (!newCollection) { - Identifier elementId = m_phelper->elementID(pstrip->identify()); + Identifier elementId = m_idHelperSvc->cscIdHelper().elementID(pstrip->identify()); cscHashId=pstrip->collectionHash(); newCollection = new CscPrepDataCollection(cscHashId); newCollection->setIdentifier(elementId); @@ -539,6 +549,14 @@ make_clusters(bool measphi, const vector<const CscStripPrepData*>& strips,CscPre } } + // retrieve MuonDetectorManager from the conditions store + SG::ReadCondHandle<MuonGM::MuonDetectorManager> DetectorManagerHandle{m_DetectorManagerKey}; + const MuonGM::MuonDetectorManager* MuonDetMgr = DetectorManagerHandle.cptr(); + if(MuonDetMgr==nullptr){ + ATH_MSG_ERROR("Null pointer to the MuonDetectorManager conditions object"); + return 0; + } + // Check results. unsigned int nresults = results.size(); for (unsigned int ire=0; ire<nresults; ++ire) { @@ -574,11 +592,11 @@ make_clusters(bool measphi, const vector<const CscStripPrepData*>& strips,CscPre // Create ATLAS CSC cluster. Identifier cluster_id = pstrip_id->identify(); IdentifierHash cluster_hash = pstrip_id->collectionHash(); - int zsec = m_phelper->stationEta(cluster_id); - int wlay = m_phelper->wireLayer(cluster_id); + int zsec = m_idHelperSvc->cscIdHelper().stationEta(cluster_id); + int wlay = m_idHelperSvc->cscIdHelper().wireLayer(cluster_id); // This local position is in the muon (not tracking) coordinate system. // const CscReadoutElement* pro = pstrip_id->detectorElement(); - const CscReadoutElement* pro = m_pmuon_detmgr->getCscReadoutElement(cluster_id); + const CscReadoutElement* pro = MuonDetMgr->getCscReadoutElement(cluster_id); Amg::Vector3D local_pos = pro->nominalLocalClusterPos(zsec, wlay, measphi, pos); Amg::MatrixX* cov = new Amg::MatrixX(1,1); (*cov)(0,0) = err*err; diff --git a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/CscClusterization/src/CscPeakThresholdClusterBuilderTool.h b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/CscClusterization/src/CscPeakThresholdClusterBuilderTool.h index 69e9d61c6a3ac6f158121f4d4a7e1f1b3f31de95..6d6d5ad1bf78f4a3616c66eca59aed9e9cdfa3c1 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/CscClusterization/src/CscPeakThresholdClusterBuilderTool.h +++ b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/CscClusterization/src/CscPeakThresholdClusterBuilderTool.h @@ -61,11 +61,9 @@ #include "CscClusterization/ICscClusterFitter.h" #include "CscClusterization/ICscClusterBuilder.h" +#include "MuonReadoutGeometry/MuonDetectorManager.h" +#include "MuonIdHelpers/IMuonIdHelperSvc.h" -namespace MuonGM { - class MuonDetectorManager; -} -class CscIdHelper; namespace Muon { class CscPrepData; class CscStripPrepData; @@ -125,12 +123,11 @@ private: // data ToolHandle<ICscClusterFitter> m_pfitter_prec; ToolHandle<ICscClusterFitter> m_pfitter_split; - // Pointer to muon geometry manager. - const MuonGM::MuonDetectorManager* m_pmuon_detmgr; - + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; - // Geometry helper. - const CscIdHelper* m_phelper; + /** retrieve MuonDetectorManager from the conditions store */ + SG::ReadCondHandleKey<MuonGM::MuonDetectorManager> m_DetectorManagerKey {this, "DetectorManagerKey", + "MuonDetectorManager", "Key of input MuonDetectorManager condition data"}; // keep track of full event being already processed bool m_fullEventDone; diff --git a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/CscClusterization/src/CscThresholdClusterBuilderTool.cxx b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/CscClusterization/src/CscThresholdClusterBuilderTool.cxx index 2067a000b74366cbf8e6a655e5f21039bcfc417f..5e4ed65d17a1e636f48b74b07dffb94cf468499b 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/CscClusterization/src/CscThresholdClusterBuilderTool.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/CscClusterization/src/CscThresholdClusterBuilderTool.cxx @@ -11,7 +11,6 @@ #include "MuonPrepRawData/CscStripPrepDataContainer.h" #include "MuonPrepRawData/CscStripPrepData.h" #include "MuonReadoutGeometry/CscReadoutElement.h" -#include "MuonReadoutGeometry/MuonDetectorManager.h" #include "TrkSurfaces/Surface.h" #include "MuonPrepRawData/CscClusterStatus.h" @@ -72,7 +71,7 @@ CscThresholdClusterBuilderTool(const std::string &type, const std::string &aname m_pfitter_def("SimpleCscClusterFitter/SimpleCscClusterFitter"), m_pfitter_prec("QratCscClusterFitter/QratCscClusterFitter"), m_pfitter_split("CscSplitClusterFitter/CscSplitClusterFitter"), - m_pmuon_detmgr(0), m_phelper(0), m_fullEventDone(false){ + m_fullEventDone(false){ declareInterface<ICscClusterBuilder>(this); @@ -160,15 +159,10 @@ StatusCode CscThresholdClusterBuilderTool::initialize(){ return StatusCode::RECOVERABLE; } ATH_MSG_DEBUG ( "Retrieved CSC split cluster fitting tool" ); - - if ( detStore()->retrieve(m_pmuon_detmgr).isFailure() ) { - ATH_MSG_ERROR ( " Cannot retrieve MuonGeoModel " ); - return StatusCode::RECOVERABLE; - } - ATH_MSG_DEBUG ( "Retrieved geometry." ); - - m_phelper = m_pmuon_detmgr->cscIdHelper(); + // retrieve MuonDetectorManager from the conditions store + ATH_CHECK(m_DetectorManagerKey.initialize()); + ATH_CHECK(m_idHelperSvc.retrieve()); return StatusCode::SUCCESS; } @@ -180,7 +174,7 @@ StatusCode CscThresholdClusterBuilderTool::getClusters(std::vector<IdentifierHas // clear output vector of selected data collections containing data decodedIds.clear(); SG::WriteHandle<Muon::CscPrepDataContainer> wh_pclusters(m_pclusters); - CscPrepDataContainer *object = new CscPrepDataContainer(m_phelper->module_hash_max()); + CscPrepDataContainer *object = new CscPrepDataContainer(m_idHelperSvc->cscIdHelper().module_hash_max()); if (!wh_pclusters.isPresent()) { /// record the container in storeGate @@ -258,9 +252,9 @@ StatusCode CscThresholdClusterBuilderTool::getClusters(IdentifierHash givenHashI ATH_MSG_DEBUG ( "Retrieved " << col->size() << " CSC Strip PrepDatas." ); Identifier colid = col->identify(); - int istation = m_phelper->stationName(colid) - 49; - int zsec = m_phelper->stationEta(colid); - int phisec = m_phelper->stationPhi(colid); + int istation = m_idHelperSvc->cscIdHelper().stationName(colid) - 49; + int zsec = m_idHelperSvc->cscIdHelper().stationEta(colid); + int phisec = m_idHelperSvc->cscIdHelper().stationPhi(colid); ATH_MSG_DEBUG ( " Strip collection " << chamber(istation, zsec, phisec) << " has " << col->size() << " strips" ); @@ -269,6 +263,14 @@ StatusCode CscThresholdClusterBuilderTool::getClusters(IdentifierHash givenHashI vector<const CscStripPrepData*> strips[8]; int maxstrip[8] = {0, 0, 0, 0, 0, 0, 0, 0}; + // retrieve MuonDetectorManager from the conditions store + SG::ReadCondHandle<MuonGM::MuonDetectorManager> DetectorManagerHandle{m_DetectorManagerKey}; + const MuonGM::MuonDetectorManager* MuonDetMgr = DetectorManagerHandle.cptr(); + if(MuonDetMgr==nullptr){ + ATH_MSG_ERROR("Null pointer to the MuonDetectorManager conditions object"); + return StatusCode::FAILURE; + } + IdentifierHash hash; // Loop over digits and fill these arrays. for ( CscStripPrepDataCollection::const_iterator idig=col->begin(); @@ -276,9 +278,9 @@ StatusCode CscThresholdClusterBuilderTool::getClusters(IdentifierHash givenHashI const CscStripPrepData& dig = **idig; Identifier did = dig.identify(); hash=dig.collectionHash(); - const CscReadoutElement* pro = m_pmuon_detmgr->getCscReadoutElement(did); - int wlay = m_phelper->wireLayer(did); - int measphi = m_phelper->measuresPhi(did); + const CscReadoutElement* pro = MuonDetMgr->getCscReadoutElement(did); + int wlay = m_idHelperSvc->cscIdHelper().wireLayer(did); + int measphi = m_idHelperSvc->cscIdHelper().measuresPhi(did); int idx = 2*(wlay-1) + measphi; // First entry for a cathode plane, initialize. if ( maxstrip[idx] == 0 ) { @@ -286,7 +288,7 @@ StatusCode CscThresholdClusterBuilderTool::getClusters(IdentifierHash givenHashI for ( int istrip=0; istrip<maxstrip[idx]; ++istrip ) strips[idx].push_back(0); } - int istrip = m_phelper->strip(did) - 1; + int istrip = m_idHelperSvc->cscIdHelper().strip(did) - 1; if ( istrip<0 || istrip>=maxstrip[idx] ) { ATH_MSG_WARNING ( "Invalid strip number" ); continue; @@ -344,16 +346,24 @@ StatusCode CscThresholdClusterBuilderTool::getClusters(std::vector<IdentifierHas continue; } Identifier colid = col.identify(); - int istation = m_phelper->stationName(colid) - 49; - int zsec = m_phelper->stationEta(colid); - int phisec = m_phelper->stationPhi(colid); - ATH_MSG_DEBUG ( "**Strip collection " << chamber(istation, zsec, phisec) << " sector " << m_phelper->sector(colid) + int istation = m_idHelperSvc->cscIdHelper().stationName(colid) - 49; + int zsec = m_idHelperSvc->cscIdHelper().stationEta(colid); + int phisec = m_idHelperSvc->cscIdHelper().stationPhi(colid); + ATH_MSG_DEBUG ( "**Strip collection " << chamber(istation, zsec, phisec) << " sector " << m_idHelperSvc->cscIdHelper().sector(colid) << " has " << col.size() << " strips" ); // Create arrays to hold digits and cathode plane parameters. vector<const CscStripPrepData*> strips[8]; int maxstrip[8] = {0, 0, 0, 0, 0, 0, 0, 0}; + // retrieve MuonDetectorManager from the conditions store + SG::ReadCondHandle<MuonGM::MuonDetectorManager> DetectorManagerHandle{m_DetectorManagerKey}; + const MuonGM::MuonDetectorManager* MuonDetMgr = DetectorManagerHandle.cptr(); + if(MuonDetMgr==nullptr){ + ATH_MSG_ERROR("Null pointer to the MuonDetectorManager conditions object"); + return StatusCode::FAILURE; + } + IdentifierHash hash; // Loop over digits and fill these arrays. for ( CscStripPrepDataCollection::const_iterator idig=col.begin(); @@ -361,9 +371,9 @@ StatusCode CscThresholdClusterBuilderTool::getClusters(std::vector<IdentifierHas const CscStripPrepData& dig = **idig; Identifier did = dig.identify(); hash=dig.collectionHash(); - const CscReadoutElement* pro = m_pmuon_detmgr->getCscReadoutElement(did); - int wlay = m_phelper->wireLayer(did); - int measphi = m_phelper->measuresPhi(did); + const CscReadoutElement* pro = MuonDetMgr->getCscReadoutElement(did); + int wlay = m_idHelperSvc->cscIdHelper().wireLayer(did); + int measphi = m_idHelperSvc->cscIdHelper().measuresPhi(did); int idx = 2*(wlay-1) + measphi; // First entry for a cathode plane, initialize. if ( maxstrip[idx] == 0 ) { @@ -371,7 +381,7 @@ StatusCode CscThresholdClusterBuilderTool::getClusters(std::vector<IdentifierHas for ( int istrip=0; istrip<maxstrip[idx]; ++istrip ) strips[idx].push_back(0); } - int istrip = m_phelper->strip(did) - 1; + int istrip = m_idHelperSvc->cscIdHelper().strip(did) - 1; if ( istrip<0 || istrip>=maxstrip[idx] ) { ATH_MSG_WARNING ( "Invalid strip number" ); continue; @@ -386,7 +396,7 @@ StatusCode CscThresholdClusterBuilderTool::getClusters(std::vector<IdentifierHas int idx = 2*(wlay-1) + measphi; if ( maxstrip[idx] ) { ATH_MSG_DEBUG ("*** " << chamber(istation, zsec, phisec) << " sector " - << m_phelper->sector(colid) << " " << wlay << "th layer "); + << m_idHelperSvc->cscIdHelper().sector(colid) << " " << wlay << "th layer "); make_clusters(measphi, strips[idx], newCollection); } } @@ -449,7 +459,7 @@ make_clusters(bool measphi, const vector<const CscStripPrepData*>& strips, bool isBadChannel = false; if ( pstrip ) { if (!newCollection) { - Identifier elementId = m_phelper->elementID(pstrip->identify()); + Identifier elementId = m_idHelperSvc->cscIdHelper().elementID(pstrip->identify()); cscHashId=pstrip->collectionHash(); newCollection = new CscPrepDataCollection(cscHashId); newCollection->setIdentifier(elementId); @@ -459,7 +469,7 @@ make_clusters(bool measphi, const vector<const CscStripPrepData*>& strips, IdentifierHash stripHash; Identifier stripId = pstrip->identify(); - if (m_phelper->get_channel_hash(stripId, stripHash)){ + if (m_idHelperSvc->cscIdHelper().get_channel_hash(stripId, stripHash)){ ATH_MSG_WARNING ( "Unable to get CSC striphash id " << " the identifier is " ); stripId.show(); } @@ -935,10 +945,17 @@ make_clusters(bool measphi, const vector<const CscStripPrepData*>& strips, // Create ATLAS CSC cluster. Identifier cluster_id = pstrip_id->identify(); IdentifierHash cluster_hash = pstrip_id->collectionHash(); - int zsec = m_phelper->stationEta(cluster_id); - int wlay = m_phelper->wireLayer(cluster_id); + int zsec = m_idHelperSvc->cscIdHelper().stationEta(cluster_id); + int wlay = m_idHelperSvc->cscIdHelper().wireLayer(cluster_id); // This local position is in the muon (not tracking) coordinate system. - const CscReadoutElement* pro = m_pmuon_detmgr->getCscReadoutElement(cluster_id); + // retrieve MuonDetectorManager from the conditions store + SG::ReadCondHandle<MuonGM::MuonDetectorManager> DetectorManagerHandle{m_DetectorManagerKey}; + const MuonGM::MuonDetectorManager* MuonDetMgr = DetectorManagerHandle.cptr(); + if(MuonDetMgr==nullptr){ + ATH_MSG_ERROR("Null pointer to the MuonDetectorManager conditions object"); + return 0; + } + const CscReadoutElement* pro = MuonDetMgr->getCscReadoutElement(cluster_id); //Amg::Vector3D local_pos = pro->localClusterPos(zsec, wlay, measphi, pos); Amg::Vector3D localTrk_pos = pro->nominalLocalClusterPos(zsec, wlay, measphi, pos); diff --git a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/CscClusterization/src/CscThresholdClusterBuilderTool.h b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/CscClusterization/src/CscThresholdClusterBuilderTool.h index ef02cd258cb6ab2b74fa445649a5dce75ac4d2c4..1343046d4351c8db5d22e8a67a2d089d6ebe7bef 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/CscClusterization/src/CscThresholdClusterBuilderTool.h +++ b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/CscClusterization/src/CscThresholdClusterBuilderTool.h @@ -61,14 +61,13 @@ #include "MuonPrepRawData/CscPrepDataContainer.h" #include "MuonPrepRawData/CscStripPrepDataContainer.h" +#include "MuonReadoutGeometry/MuonDetectorManager.h" +#include "MuonIdHelpers/IMuonIdHelperSvc.h" + class ICscCalibTool; class ICscStripFitter; class ICscClusterFitter; -namespace MuonGM { - class MuonDetectorManager; -} -class CscIdHelper; namespace Muon { class CscPrepData; class CscStripPrepData; @@ -137,11 +136,11 @@ private: // data ToolHandle<ICscClusterFitter> m_pfitter_prec; ToolHandle<ICscClusterFitter> m_pfitter_split; - // Pointer to muon geometry manager. - const MuonGM::MuonDetectorManager* m_pmuon_detmgr; + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; - // Geometry helper. - const CscIdHelper* m_phelper; + /** retrieve MuonDetectorManager from the conditions store */ + SG::ReadCondHandleKey<MuonGM::MuonDetectorManager> m_DetectorManagerKey {this, "DetectorManagerKey", + "MuonDetectorManager", "Key of input MuonDetectorManager condition data"}; // keep track of full event being already processed bool m_fullEventDone; diff --git a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/CscClusterization/src/ParabolaCscClusterFitter.cxx b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/CscClusterization/src/ParabolaCscClusterFitter.cxx index 2c7272b261d8741c7a9ef7d3bfd28e1cbdc21873..ffc195ba6e61e1ae77ced28f6721e150dc6bac8d 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/CscClusterization/src/ParabolaCscClusterFitter.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/CscClusterization/src/ParabolaCscClusterFitter.cxx @@ -8,7 +8,6 @@ #include "MuonPrepRawData/CscStripPrepData.h" #include "MuonPrepRawData/CscPrepData.h" #include "MuonReadoutGeometry/CscReadoutElement.h" -#include "MuonReadoutGeometry/MuonDetectorManager.h" #include "TrkEventPrimitives/ParamDefs.h" #include "TrkEventPrimitives/LocalDirection.h" #include "EventPrimitives/EventPrimitives.h" @@ -100,8 +99,7 @@ double ParabolaCscClusterFitter::ParabolaCorrection(CscPlane &plane, double &raw //************************************************************************* ParabolaCscClusterFitter::ParabolaCscClusterFitter(std::string type, std::string aname, const IInterface* parent) : - AthAlgTool(type, aname, parent), - m_detMgr(nullptr) { + AthAlgTool(type, aname, parent) { declareInterface<ICscClusterFitter>(this); m_max_width.push_back(5); // CSS eta m_max_width.push_back(5); // CSL eta @@ -121,7 +119,6 @@ StatusCode ParabolaCscClusterFitter::initialize() { ATH_MSG_VERBOSE ( "Initalizing " << name() ); - ATH_CHECK(detStore()->retrieve(m_detMgr,"Muon")); ATH_CHECK(m_idHelperSvc.retrieve()); ATH_MSG_DEBUG ( "Properties for " << name() << ":" ); @@ -130,6 +127,8 @@ StatusCode ParabolaCscClusterFitter::initialize() { ATH_MSG_DEBUG ( " CSS eta pos-slope slope: " << m_xtan_css_eta_slope ); ATH_MSG_DEBUG ( " CSL eta pos-slope offset: " << m_xtan_csl_eta_offset ); ATH_MSG_DEBUG ( " CSL eta pos-slope slope: " << m_xtan_csl_eta_slope ); + // retrieve MuonDetectorManager from the conditions store + ATH_CHECK(m_DetectorManagerKey.initialize()); return StatusCode::SUCCESS; } @@ -185,7 +184,16 @@ Results ParabolaCscClusterFitter::fit(const StripFitList& sfits, double tantheta // Use the first strip to extract the layer parameters. const CscStripPrepData* pstrip = sfits[0].strip; Identifier idStrip0 = pstrip->identify(); - const CscReadoutElement* pro = m_detMgr->getCscReadoutElement(idStrip0); + + // retrieve MuonDetectorManager from the conditions store + SG::ReadCondHandle<MuonGM::MuonDetectorManager> DetectorManagerHandle{m_DetectorManagerKey}; + const MuonGM::MuonDetectorManager* MuonDetMgr = DetectorManagerHandle.cptr(); + if(MuonDetMgr==nullptr){ + ATH_MSG_ERROR("Null pointer to the MuonDetectorManager conditions object"); + return results; + } + const CscReadoutElement* pro = MuonDetMgr->getCscReadoutElement(idStrip0); + // const CscReadoutElement* pro = pstrip->detectorElement(); fixed by Woochun bool measphi = m_idHelperSvc->cscIdHelper().CscIdHelper::measuresPhi(idStrip0); double pitch = pro->cathodeReadoutPitch(0, measphi); diff --git a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/CscClusterization/src/ParabolaCscClusterFitter.h b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/CscClusterization/src/ParabolaCscClusterFitter.h index 2831cf1eda4d3a68b8a2de3fdec791cd12417721..daee9ce0116e70c49e1a4bf61f3c2b2ce05d935b 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/CscClusterization/src/ParabolaCscClusterFitter.h +++ b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/CscClusterization/src/ParabolaCscClusterFitter.h @@ -16,14 +16,12 @@ May 2009 #include "AthenaBaseComps/AthAlgTool.h" #include "GaudiKernel/ServiceHandle.h" +#include "MuonReadoutGeometry/MuonDetectorManager.h" #include "MuonIdHelpers/IMuonIdHelperSvc.h" namespace Muon { class CscPrepData; } -namespace MuonGM { - class MuonDetectorManager; -} enum CscStation { UNKNOWN_STATION, CSS, CSL }; enum CscPlane { CSS_ETA, CSL_ETA, CSS_PHI, CSL_PHI, UNKNOWN_PLANE }; @@ -79,9 +77,11 @@ private: /** threshold multiplier for cluster peak finding */ double m_multi; - const MuonGM::MuonDetectorManager* m_detMgr; - ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; + /** retrieve MuonDetectorManager from the conditions store */ + SG::ReadCondHandleKey<MuonGM::MuonDetectorManager> m_DetectorManagerKey {this, "DetectorManagerKey", + "MuonDetectorManager", "Key of input MuonDetectorManager condition data"}; + }; #endif diff --git a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/CscClusterization/src/QratCscClusterFitter.cxx b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/CscClusterization/src/QratCscClusterFitter.cxx index fa3e9750b5ef5c50269d85e352f363061da4492b..d75e378db937b025a5c103ea33ccb69a24169a4c 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/CscClusterization/src/QratCscClusterFitter.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/CscClusterization/src/QratCscClusterFitter.cxx @@ -8,7 +8,6 @@ #include "MuonPrepRawData/CscStripPrepData.h" #include "MuonPrepRawData/CscPrepData.h" #include "MuonReadoutGeometry/CscReadoutElement.h" -#include "MuonReadoutGeometry/MuonDetectorManager.h" #include "TrkEventPrimitives/ParamDefs.h" #include "TrkEventPrimitives/LocalDirection.h" #include "EventPrimitives/EventPrimitives.h" @@ -211,7 +210,6 @@ int qrat_atanh(const double a, const double b, double c, const double x0, QratCscClusterFitter::QratCscClusterFitter(std::string type, std::string aname, const IInterface* parent) : AthAlgTool(type, aname, parent), - m_detMgr(nullptr), m_alignmentTool("CscAlignmentTool/CscAlignmentTool", this) { declareInterface<ICscClusterFitter>(this); @@ -263,7 +261,9 @@ StatusCode QratCscClusterFitter::initialize() { ATH_MSG_VERBOSE ( "Initalizing " << name() ); - ATH_CHECK(detStore()->retrieve(m_detMgr,"Muon")); + // retrieve MuonDetectorManager from the conditions store + ATH_CHECK(m_DetectorManagerKey.initialize()); + ATH_CHECK(m_idHelperSvc.retrieve()); if ( m_alignmentTool.retrieve().isFailure() ) { @@ -374,7 +374,15 @@ Results QratCscClusterFitter::fit(const StripFitList& sfits, double tantheta) co const CscStripPrepData* pstrip = sfits[0].strip; Identifier idStrip0 = pstrip->identify(); - const CscReadoutElement* pro = m_detMgr->getCscReadoutElement(idStrip0); + // retrieve MuonDetectorManager from the conditions store + SG::ReadCondHandle<MuonGM::MuonDetectorManager> DetectorManagerHandle{m_DetectorManagerKey}; + const MuonGM::MuonDetectorManager* MuonDetMgr = DetectorManagerHandle.cptr(); + if(MuonDetMgr==nullptr){ + ATH_MSG_ERROR("Null pointer to the MuonDetectorManager conditions object"); + return results; + } + const CscReadoutElement* pro = MuonDetMgr->getCscReadoutElement(idStrip0); + bool measphi = m_idHelperSvc->cscIdHelper().CscIdHelper::measuresPhi(idStrip0); double pitch = pro->cathodeReadoutPitch(0, measphi); unsigned int maxstrip = pro->maxNumberOfStrips(measphi); diff --git a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/CscClusterization/src/QratCscClusterFitter.h b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/CscClusterization/src/QratCscClusterFitter.h index 4108bed62de018139f70ee94172e8726b2271932..ff962f4c1b07567314d26e114487f0fd68a74a33 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/CscClusterization/src/QratCscClusterFitter.h +++ b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/CscClusterization/src/QratCscClusterFitter.h @@ -15,6 +15,7 @@ #include "GaudiKernel/ServiceHandle.h" #include "GaudiKernel/ToolHandle.h" +#include "MuonReadoutGeometry/MuonDetectorManager.h" #include "MuonIdHelpers/IMuonIdHelperSvc.h" #include "MuonPrepRawData/CscClusterStatus.h" #include "CscClusterization/ICscAlignmentTool.h" @@ -22,9 +23,6 @@ namespace Muon { class CscPrepData; } -namespace MuonGM { - class MuonDetectorManager; -} class QratCscClusterFitter : virtual public ICscClusterFitter, public AthAlgTool { @@ -77,7 +75,9 @@ private: double m_dposmin; // MS: minimum position error in mm - const MuonGM::MuonDetectorManager* m_detMgr; + /** retrieve MuonDetectorManager from the conditions store */ + SG::ReadCondHandleKey<MuonGM::MuonDetectorManager> m_DetectorManagerKey {this, "DetectorManagerKey", + "MuonDetectorManager", "Key of input MuonDetectorManager condition data"}; ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; diff --git a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/CscClusterization/src/SimpleCscClusterFitter.cxx b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/CscClusterization/src/SimpleCscClusterFitter.cxx index 2a1688d539432412369bee81843cc93cc4a11ed6..65eec9561b4aa5712c24b9d302ef8687f223f9c1 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/CscClusterization/src/SimpleCscClusterFitter.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/CscClusterization/src/SimpleCscClusterFitter.cxx @@ -8,7 +8,6 @@ #include "MuonPrepRawData/CscPrepData.h" #include "MuonPrepRawData/CscStripPrepData.h" #include "MuonReadoutGeometry/CscReadoutElement.h" -#include "MuonReadoutGeometry/MuonDetectorManager.h" #include <sstream> #include <iomanip> @@ -26,7 +25,6 @@ enum CscPlane { CSS_R, CSL_R, CSS_PHI, CSL_PHI, UNKNOWN_PLANE }; SimpleCscClusterFitter::SimpleCscClusterFitter(std::string type, std::string aname, const IInterface* parent) : AthAlgTool(type, aname, parent), - m_detMgr(nullptr), m_alignmentTool("CscAlignmentTool/CscAlignmentTool", this) { declareInterface<ICscClusterFitter>(this); @@ -59,6 +57,8 @@ StatusCode SimpleCscClusterFitter::initialize() { } else { ATH_MSG_DEBUG ( name() << ": retrieved " << m_alignmentTool ); } + // retrieve MuonDetectorManager from the conditions store + ATH_CHECK(m_DetectorManagerKey.initialize()); return StatusCode::SUCCESS; } @@ -93,7 +93,16 @@ Results SimpleCscClusterFitter::fit(const StripFitList& sfits) const { return results; } Identifier idStrip0 = pstrip->identify(); - const CscReadoutElement* pro = m_detMgr->getCscReadoutElement(idStrip0); + + // retrieve MuonDetectorManager from the conditions store + SG::ReadCondHandle<MuonGM::MuonDetectorManager> DetectorManagerHandle{m_DetectorManagerKey}; + const MuonGM::MuonDetectorManager* MuonDetMgr = DetectorManagerHandle.cptr(); + if(MuonDetMgr==nullptr){ + ATH_MSG_ERROR("Null pointer to the MuonDetectorManager conditions object"); + return results; + } + const CscReadoutElement* pro = MuonDetMgr->getCscReadoutElement(idStrip0); + bool measphi = m_idHelperSvc->cscIdHelper().CscIdHelper::measuresPhi(idStrip0); double pitch = pro->cathodeReadoutPitch(0, measphi); int maxstrip = pro->maxNumberOfStrips(measphi); diff --git a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/CscClusterization/src/SimpleCscClusterFitter.h b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/CscClusterization/src/SimpleCscClusterFitter.h index c78f77eae9ffbf4b5ef5ad789bcb3bee1085fe0a..7421986bb8b1cc3e65f24911c39b45b827072675 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/CscClusterization/src/SimpleCscClusterFitter.h +++ b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/CscClusterization/src/SimpleCscClusterFitter.h @@ -15,6 +15,7 @@ #include "GaudiKernel/ServiceHandle.h" #include "GaudiKernel/ToolHandle.h" +#include "MuonReadoutGeometry/MuonDetectorManager.h" #include "MuonIdHelpers/IMuonIdHelperSvc.h" #include "MuonPrepRawData/CscClusterStatus.h" #include "CscClusterization/ICscAlignmentTool.h" @@ -22,9 +23,6 @@ namespace Muon { class CscPrepData; } -namespace MuonGM { - class MuonDetectorManager; -} class SimpleCscClusterFitter : virtual public ICscClusterFitter, public AthAlgTool { @@ -54,6 +52,10 @@ private: ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; + /** retrieve MuonDetectorManager from the conditions store */ + SG::ReadCondHandleKey<MuonGM::MuonDetectorManager> m_DetectorManagerKey {this, "DetectorManagerKey", + "MuonDetectorManager", "Key of input MuonDetectorManager condition data"}; + ToolHandle<ICscAlignmentTool> m_alignmentTool; }; #endif diff --git a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/share/VFitZmmOnAOD_jobOptions_AutoConfig.py b/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/share/VFitZmmOnAOD_jobOptions_AutoConfig.py deleted file mode 100644 index 5cd2807f4dead3a39a25b5647566eb48815c5fc2..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/share/VFitZmmOnAOD_jobOptions_AutoConfig.py +++ /dev/null @@ -1,79 +0,0 @@ -# Author: Shuwei YE -# BNL, September 2009 -# Modified by Vivek Jain, Feb 2010 - -# This file uses AutoConfig to peek at the input file, and set Geometry tag, etc., correctly -# you don't need to set Geometry tags anymore. They are read from the file itself. - -# here give the full path of a file that you run over locally -# if you are running on the grid, it will ignore what you set here, and do the right thing -# if you want to run over multiple files locally, use glob as shown below - -from AthenaCommon.AthenaCommonFlags import jobproperties as jp -jp.AthenaCommonFlags.FilesInput = ['/afs/cern.ch/atlas/maxidisk/d49/AOD.191045._001937.pool.root.1'] - -#DATAPATH = '/afs/cern.ch/atlas/maxidisk/d49/' -#from glob import glob -#INPUT = glob(DATAPATH + 'AOD*.root*') -#print INPUT -#jp.AthenaCommonFlags.FilesInput = INPUT - -# -from RecExConfig.RecFlags import rec - -# import the data types -import EventKernel.ParticleDataType - -# get a handle on the ServiceManager which holds all the services -from AthenaCommon.AppMgr import ServiceMgr - -include ("RecExCond/RecExCommon_flags.py") -include( "RecExCond/AllDet_detDescr.py" ) -include( "AthenaPoolCnvSvc/ReadAthenaPool_jobOptions.py" ) - - -# The input file already specified near the top of this file -ServiceMgr.EventSelector.InputCollections = jp.AthenaCommonFlags.FilesInput() - -from AthenaCommon.AlgSequence import AlgSequence -topSequence = AlgSequence() - -from AnalysisExamples.AnalysisExamplesConf import VFitZmmOnAOD -topSequence += VFitZmmOnAOD() - -# The user analysis cuts - default values to changed by the user as needed - -# set the names of the particle containers to be retrieved from StoreGate -# must be the same name used to build the AOD container -# do not touch these if you do know what you are doing - -# Muon Parameters -topSequence.VFitZmmOnAOD.MuonContainer = "MuidMuonCollection" -topSequence.VFitZmmOnAOD.MuonEtCut = 6.0*GeV -topSequence.VFitZmmOnAOD.MuonEtaCut = 2.5 - -# message level for VFitZmmOnAOD -topSequence.VFitZmmOnAOD.OutputLevel = INFO - -# Set output level threshold (2=DEBUG, 3=INFO, 4=WARNING, 5=ERROR, 6=FATAL ) -ServiceMgr.MessageSvc.OutputLevel = INFO -# print out all messages. may need to increase it -ServiceMgr.MessageSvc.defaultLimit = 9999999 - -# Number of Events to process -theApp.EvtMax = -1 - -# setup TTree registration Service -# save ROOT histograms and Tuple -from GaudiSvc.GaudiSvcConf import THistSvc -ServiceMgr += THistSvc() -ServiceMgr.THistSvc.Output = ["AANT DATAFILE='VFitZmmOnAOD.root' OPT='RECREATE'"] -from AnalysisTools.AthAnalysisToolsConf import AANTupleStream -topSequence += AANTupleStream() -topSequence.AANTupleStream.ExtraRefNames = [ "StreamESD","Stream1" ] -topSequence.AANTupleStream.OutputName = 'VFitZmmOnAOD.root' -topSequence.AANTupleStream.WriteInputDataHeader = True -topSequence.AANTupleStream.OutputLevel = WARNING -# Root Ntuple output file and name -#theApp.HistogramPersistency = "ROOT" -#theApp.HistogramPersistencySvc.OutputFile = "VFitZmmOnAOD.root" diff --git a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/share/VFitZmmOnAOD_jobOptions_NEW.py b/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/share/VFitZmmOnAOD_jobOptions_NEW.py deleted file mode 100644 index bc0fca40f19cbba24afcc70fe3e1b1f8560e0f51..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/share/VFitZmmOnAOD_jobOptions_NEW.py +++ /dev/null @@ -1,49 +0,0 @@ -# Author: Shuwei YE -# BNL, September 2009 -# modified by Vivek Jain, Oct. 30, 2009 -# Run this through AnalysisMaster.py -# -# get a handle on the ServiceManager which holds all the services -from AthenaCommon.AppMgr import ServiceMgr - -# the POOL converters -include( "ParticleBuilderOptions/AOD_PoolCnv_jobOptions.py" ) -include( "ParticleBuilderOptions/McAOD_PoolCnv_jobOptions.py" ) - -# The input file already specified near the top of this file -ServiceMgr.EventSelector.InputCollections = jp.AthenaCommonFlags.FilesInput() - -from AthenaCommon.AlgSequence import AlgSequence -topSequence = AlgSequence() - -from AnalysisExamples.AnalysisExamplesConf import VFitZmmOnAOD -topSequence += VFitZmmOnAOD() - -# The user analysis cuts - default values to changed by the user as needed - -# set the names of the particle containers to be retrieved from StoreGate -# must be the same name used to build the AOD container -# do not touch these if you do know what you are doing - -# Muon Parameters -topSequence.VFitZmmOnAOD.MuonContainer = "MuidMuonCollection" -topSequence.VFitZmmOnAOD.MuonEtCut = 6.0*GeV -topSequence.VFitZmmOnAOD.MuonEtaCut = 2.5 - -# message level for VFitZmmOnAOD -topSequence.VFitZmmOnAOD.OutputLevel = INFO - -# setup TTree registration Service -# save ROOT histograms and Tuple -from GaudiSvc.GaudiSvcConf import THistSvc -ServiceMgr += THistSvc() -ServiceMgr.THistSvc.Output = ["AANT DATAFILE='VFitZmmOnAOD.root' OPT='RECREATE'"] -from AnalysisTools.AnalysisToolsConf import AANTupleStream -topSequence += AANTupleStream() -topSequence.AANTupleStream.ExtraRefNames = [ "StreamESD","Stream1" ] -topSequence.AANTupleStream.OutputName = 'VFitZmmOnAOD.root' -topSequence.AANTupleStream.WriteInputDataHeader = True -topSequence.AANTupleStream.OutputLevel = WARNING -# Root Ntuple output file and name -#theApp.HistogramPersistency = "ROOT" -#theApp.HistogramPersistencySvc.OutputFile = "VFitZmmOnAOD.root" diff --git a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/src/VFitZmmOnAOD.cxx b/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/src/VFitZmmOnAOD.cxx deleted file mode 100644 index cea34c4e7500f098d02a6b7203be1d04b5ca8f25..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/src/VFitZmmOnAOD.cxx +++ /dev/null @@ -1,695 +0,0 @@ -/* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration -*/ - -#include "GaudiKernel/MsgStream.h" -#include "GaudiKernel/IToolSvc.h" - - -#include "TH1.h" -#include "TH2.h" - -// The Muon -#include "muonEvent/Muon.h" - -// #include "TrkParticleBase/TrackParticleBase.h" - -// PDT particle property -#include "GaudiKernel/IPartPropSvc.h" -#include "HepPDT/ParticleDataTable.hh" -#include "HepPDT/ParticleData.hh" - -// Constituent navigation -#include "Navigation/NavigationToken.h" - -// common implementation of all particles -#include "ParticleEvent/ParticleBaseContainer.h" - -// vertex -#include "VxVertex/VxContainer.h" -#include "VxVertex/RecVertex.h" - -// xAOD vertex -#include "xAODTracking/VertexContainer.h" - -// the composite particle -#include "ParticleEvent/CompositeParticle.h" - -// particle jets -#include "JetEvent/JetCollection.h" - -// analysis tools -#include "AnalysisUtils/AnalysisCombination.h" - -// Event Info -#include "xAODEventInfo/EventInfo.h" - -// the header file -#include "VFitZmmOnAOD.h" - -#include <stdint.h> -#include <algorithm> -#include <math.h> -#include <functional> - -// static const double mMuon = 105.658369; -static double mMuon = 105.66; // MeV - -const xAOD::Vertex* primVtx=NULL; - -using namespace Analysis; - - -////////////////////////////////////////////////////////////////////////////////////// -// Constructor - -VFitZmmOnAOD::VFitZmmOnAOD(const std::string& name,ISvcLocator* pSvcLocator): - AthAlgorithm(name, pSvcLocator), - m_analysisTools( "AnalysisTools", this ), - m_thistSvc(nullptr), - m_VKVrtFitter("Trk::TrkVKalVrtFitter", this), - m_tree_Zll(nullptr), - m_v0_x(0), - m_v0_y(0), - m_v0_z(0), - m_nZ(0), - m_Zmode(nullptr), - m_Zm_vkfit(nullptr), - m_Zchi2_vkfit(nullptr), - m_Zdxy_vkfit(nullptr), - m_Zdz_vkfit(nullptr), - m_Zm(nullptr), - m_Zpt(nullptr), - m_Zpx(nullptr), - m_Zpy(nullptr), - m_Zpz(nullptr), - m_Zp(nullptr), - m_Ze(nullptr), - m_Zeta(nullptr), - m_L1pt_vkfit(nullptr), - m_L1pt(nullptr), - m_L1px(nullptr), - m_L1py(nullptr), - m_L1pz(nullptr), - m_L1p(nullptr), - m_L1e(nullptr), - m_L1eta(nullptr), - m_L2pt_vkfit(nullptr), - m_L2pt(nullptr), - m_L2px(nullptr), - m_L2py(nullptr), - m_L2pz(nullptr), - m_L2p(nullptr), - m_L2e(nullptr), - m_L2eta(nullptr), - m_runNumber(0), - m_eventNumber(0), - m_eventTime(0), - m_lumiBlock(0), - m_bCID(0), - m_lVL1ID(0), - m_eventWeight(0), - m_aod_muon_pt(nullptr), - m_aod_muon_eta(nullptr), - m_aod_muon_chi2(nullptr), - m_aod_zmm_mass_hist(nullptr), - m_aod_muon_charge(nullptr) -{ - // switches to control the analysis through job options :: these are the default - // to changed in the job options - - // The Electron AOD container name & selection cuts - declareProperty( "AnalysisTools", m_analysisTools ); - - // The Muon AOD container name & selection cuts - declareProperty("MuonContainer", m_muonContainerName = "MuonCollection"); - declareProperty("MuonEtCut", m_etMuonCut = 6.0*CLHEP::GeV); - declareProperty("MuonEtaCut", m_etaMuonCut = 2.5); - - // Name of the Vertex container - declareProperty("VxContainer", m_VxContainerName= "VxPrimaryCandidate", - "Name of the Vertex container"); - - // vertex fitter - declareProperty("TrkVKalVrtFitterTool", m_ToolIVrtFitter); - - } - - -///////////////////////////////////////////////////////////////////////////////////// -// Destructor - check up memory allocation -// delete any memory allocation on the heap - -VFitZmmOnAOD::~VFitZmmOnAOD() {} - -//////////////////////////////////////////////////////////////////////////////////// -// Initialize -// get a handle on the analysis tools -// book histograms - -StatusCode VFitZmmOnAOD::initialize() { - - ATH_MSG_INFO("Initializing VFitZmmOnAOD"); - - // get tool svc - // - IToolSvc* toolSvc; - StatusCode sc = service("ToolSvc",toolSvc); - if (StatusCode::SUCCESS != sc) { - ATH_MSG_ERROR("Unable to retrieve ToolSvc"); - return StatusCode::FAILURE; - } - - -// VKalVrt vertex fitter - if (m_VKVrtFitter.retrieve().isFailure()) { - ATH_MSG_WARNING("Can't find Trk::TrkVKalVrtFitter"); - return StatusCode::SUCCESS; - } else { - ATH_MSG_INFO("Trk::TrkVKalVrtFitter found"); - } - - // get Particle Property service - IPartPropSvc* p_PartPropSvc = 0; - sc = service("PartPropSvc", p_PartPropSvc, true); - if ( sc.isFailure() || 0 == p_PartPropSvc) { - ATH_MSG_ERROR("Unable to initialize Particle Properties Service"); - return StatusCode::FAILURE; - } - const HepPDT::ParticleDataTable* particleTable = p_PartPropSvc->PDT(); - const HepPDT::ParticleData* muonPDT = particleTable->particle(13); - ATH_MSG_DEBUG(":muonPDT: mass=" << muonPDT->mass() << ", id=" << muonPDT->pid() << ", name=" << muonPDT->name() ); - mMuon = muonPDT->mass(); - - // get a handle on the analysis tools - sc = m_analysisTools.retrieve(); - if ( sc.isFailure() ) { - ATH_MSG_ERROR("Can't get handle on analysis tools"); - return sc; - } - - // Return a pointer to THistSvc - sc = service("THistSvc", m_thistSvc); - if(sc.isFailure() ){ - ATH_MSG_ERROR("Unable to retrieve pointer to THistSvc"); - return sc; - } - m_Zmode = new std::vector<int>; - - m_Zm_vkfit = new std::vector<double>; - m_Zchi2_vkfit = new std::vector<double>; - m_Zdxy_vkfit = new std::vector<double>; - m_Zdz_vkfit = new std::vector<double>; - - m_Zm = new std::vector<double>; - m_Zpt = new std::vector<double>; - m_Zpx = new std::vector<double>; - m_Zpy = new std::vector<double>; - m_Zpz = new std::vector<double>; - m_Zp = new std::vector<double>; - m_Ze = new std::vector<double>; - m_Zeta = new std::vector<double>; - - m_L1pt_vkfit = new std::vector<double>; - m_L1pt = new std::vector<double>; - m_L1px = new std::vector<double>; - m_L1py = new std::vector<double>; - m_L1pz = new std::vector<double>; - m_L1e = new std::vector<double>; - m_L1p = new std::vector<double>; - m_L1eta = new std::vector<double>; - - m_L2pt_vkfit = new std::vector<double>; - m_L2pt = new std::vector<double>; - m_L2px = new std::vector<double>; - m_L2py = new std::vector<double>; - m_L2pz = new std::vector<double>; - m_L2e = new std::vector<double>; - m_L2p = new std::vector<double>; - m_L2eta = new std::vector<double>; - // - // event info variables - /* - // remove. see comment in addEventInfo() - m_lvl1TriggerInfo = new std::vector<unsigned int>; - m_lvl2TriggerInfo = new std::vector<unsigned int>; - m_evtFilterInfo = new std::vector<unsigned int>; - m_streamTagName = new std::vector<std::string>; - m_streamTagType = new std::vector<std::string>; - */ - // the TTree - m_tree_Zll = new TTree("tree_Zll","TTree of Z->l+l-"); - sc = m_thistSvc->regTree("/AANT/tree_Zll", m_tree_Zll); - - // first add Event info stuff - m_tree_Zll->Branch("Run", &m_runNumber, "Run/I"); // run number - m_tree_Zll->Branch("Event",&m_eventNumber, "Event/I"); // event number - m_tree_Zll->Branch("Time", &m_eventTime, "Time/I"); // time stamp - m_tree_Zll->Branch("LumiBlock", &m_lumiBlock,"LumiBlock/I"); // lum block num - m_tree_Zll->Branch("BCID", &m_bCID,"BCID/I"); // bunch crossing ID - m_tree_Zll->Branch("LVL1ID", &m_lVL1ID,"LVL1ID/I"); // trigger LVL1 ID - m_tree_Zll->Branch("Weight", &m_eventWeight, "Weight/D"); // weight - - /* - // remove. see comment in addEventInfo() - m_tree_Zll->Branch("StatusElement", &m_statusElement, "StatusElement/I"); - m_tree_Zll->Branch("LVL1TriggerType", &m_lvl1TriggerType, "LVL1TriggerType/I"); - m_tree_Zll->Branch("LVL1TriggerInfo",&m_lvl1TriggerInfo); - m_tree_Zll->Branch("LVL2TriggerInfo",&m_lvl2TriggerInfo); - m_tree_Zll->Branch("EventFilterInfo",&m_evtFilterInfo); - m_tree_Zll->Branch("StreamTagName",&m_streamTagName); - m_tree_Zll->Branch("StreamTagType",&m_streamTagType); - */ - // now variables from algorithm - m_tree_Zll->Branch("v0_x", &m_v0_x, "v0_x/D"); - m_tree_Zll->Branch("v0_y", &m_v0_y, "v0_y/D"); - m_tree_Zll->Branch("v0_z", &m_v0_z, "v0_z/D"); - - m_tree_Zll->Branch("nZ", &m_nZ, "nZ/I"); - m_tree_Zll->Branch("Zmode", &m_Zmode); - - m_tree_Zll->Branch("Zm_vkfit", &m_Zm_vkfit); - m_tree_Zll->Branch("Zchi2_vkfit", &m_Zchi2_vkfit); - m_tree_Zll->Branch("Zdxy_vkfit", &m_Zdxy_vkfit); - m_tree_Zll->Branch("Zdz_vkfit", &m_Zdz_vkfit); - - m_tree_Zll->Branch("Zm", &m_Zm); - m_tree_Zll->Branch("Zpt", &m_Zpt); - m_tree_Zll->Branch("Zpx", &m_Zpx); - m_tree_Zll->Branch("Zpy", &m_Zpy); - m_tree_Zll->Branch("Zpz", &m_Zpz); - m_tree_Zll->Branch("Ze", &m_Ze); - m_tree_Zll->Branch("Zp", &m_Zp); - m_tree_Zll->Branch("Zeta", &m_Zeta); - - m_tree_Zll->Branch("L1pt_vkfit", &m_L1pt_vkfit); - m_tree_Zll->Branch("L1pt", &m_L1pt); - m_tree_Zll->Branch("L1px", &m_L1px); - m_tree_Zll->Branch("L1py", &m_L1py); - m_tree_Zll->Branch("L1pz", &m_L1pz); - m_tree_Zll->Branch("L1e", &m_L1e); - m_tree_Zll->Branch("L1p", &m_L1p); - m_tree_Zll->Branch("L1eta", &m_L1eta); - - m_tree_Zll->Branch("L2pt_vkfit", &m_L2pt_vkfit); - m_tree_Zll->Branch("L2pt", &m_L2pt); - m_tree_Zll->Branch("L2px", &m_L2px); - m_tree_Zll->Branch("L2py", &m_L2py); - m_tree_Zll->Branch("L2pz", &m_L2pz); - m_tree_Zll->Branch("L2e", &m_L2e); - m_tree_Zll->Branch("L2p", &m_L2p); - m_tree_Zll->Branch("L2eta", &m_L2eta); - - // the histograms - - // Muon histogram booking - m_aod_muon_pt = new TH1F("aod_muon_pt","aod pt mu",50,0,250.*CLHEP::GeV); - sc = m_thistSvc->regHist("/AANT/Muon/aod_muon_pt", m_aod_muon_pt); - m_aod_muon_eta = new TH1F("aod_muon_eta","aod eta mu",70,-3.5,3.5); - sc = m_thistSvc->regHist("/AANT/Muon/aod_muon_eta", m_aod_muon_eta); - m_aod_muon_chi2 = new TH1F("aod_muon_chi2","aod chi2 mu",200,0.0,1000.0); - sc = m_thistSvc->regHist("/AANT/Muon/aod_muon_chi2", m_aod_muon_chi2); - m_aod_zmm_mass_hist = new TH1F("Mmm","Mmm",50,0,250.*CLHEP::GeV); - sc = m_thistSvc->regHist("/AANT/Muon/Mmm", m_aod_zmm_mass_hist); - m_aod_muon_charge = new TH1F("Muon_charge","Muon_charge",10,-5,5); - sc = m_thistSvc->regHist("/AANT/Muon/Muon_charge", m_aod_muon_charge); - - if( sc.isFailure() ){ - ATH_MSG_ERROR("ROOT Hist aod_zmm_mass_hist registration failed"); - return sc; - } - return StatusCode::SUCCESS; -} - -/////////////////////////////////////////////////////////////////////////////////// -// Finalize - delete any memory allocation from the heap - -StatusCode VFitZmmOnAOD::finalize() { - return StatusCode::SUCCESS; - -} - -/////////////////////////////////////////////////////////////////////////////////// -// initialization before processing a new event -StatusCode VFitZmmOnAOD::initEvent() { - - ATH_MSG_DEBUG("initEvent()"); - - m_v0_x = -99; - m_v0_y = -99; - m_v0_z = -99; - - m_nZ = 0; - - m_Zmode->clear(); - - m_Zm_vkfit->clear(); - m_Zchi2_vkfit->clear(); - m_Zdxy_vkfit->clear(); - m_Zdz_vkfit->clear(); - - m_Zm->clear(); - m_Zpt->clear(); - m_Zpx->clear(); - m_Zpy->clear(); - m_Zpz->clear(); - m_Zp->clear(); - m_Ze->clear(); - m_Zeta->clear(); - - m_L1pt_vkfit->clear(); - m_L1pt->clear(); - m_L1px->clear(); - m_L1py->clear(); - m_L1pz->clear(); - m_L1p->clear(); - m_L1e->clear(); - m_L1eta->clear(); - - m_L2pt_vkfit->clear(); - m_L2pt->clear(); - m_L2px->clear(); - m_L2py->clear(); - m_L2pz->clear(); - m_L2p->clear(); - m_L2e->clear(); - m_L2eta->clear(); - - // - m_runNumber=0; - m_eventNumber=0; - m_eventTime=0; - m_lumiBlock=0; - m_bCID=0; - m_lVL1ID=0; - m_eventWeight=0; - /* - // remove. see comment in addEventInfo() - m_statusElement=0; - m_lvl1TriggerType=0; - m_lvl1TriggerInfo->clear(); - m_lvl2TriggerInfo->clear(); - m_evtFilterInfo->clear(); - m_streamTagName->clear(); - m_streamTagType->clear(); - */ - // - - return StatusCode::SUCCESS; -} - -////////////////////////////////////////////////////////////////////////////////// -// Execute - called by the event loop on event by event - -StatusCode VFitZmmOnAOD::execute() { - - ATH_MSG_DEBUG("execute()"); - - StatusCode sc = StatusCode::SUCCESS; - - // initialize first before processing each event - sc = initEvent(); - if ( sc.isFailure() ) { - ATH_MSG_WARNING("initEvent failed. Continue"); - } - - // add event info to ntuple - sc = addEventInfo(); - if ( sc.isFailure() ) { - ATH_MSG_WARNING("could not get EventInfo. Continue"); - } - - // Get primary vertex from StoreGate - const xAOD::VertexContainer* vxCont(0); - sc = evtStore()->retrieve(vxCont,m_VxContainerName); - if (sc.isFailure() ) { - ATH_MSG_WARNING("No Vertex conainter with key " - << m_VxContainerName << " found in StoreGate. Continue"); - } else { - ATH_MSG_VERBOSE("Found primary vertex info: " << m_VxContainerName); - if(vxCont) { - // int npvx = vxCont->size(); - xAOD::VertexContainer::const_iterator fz = vxCont->begin(); - primVtx = (*fz); - m_v0_x = primVtx->position().x(); - m_v0_y = primVtx->position().y(); - m_v0_z = primVtx->position().z(); - } - } - - // do the Z->mm reconstruction on AOD - sc = zmm_on_aod(); - if ( sc.isFailure() ) { - ATH_MSG_WARNING("Z->mm reconstruction on AOD failed"); - return StatusCode::SUCCESS; - } - - m_tree_Zll->Fill(); - // - if(sc.isFailure()) sc = StatusCode::SUCCESS; - return sc; - -} - - -////////////////////////////////////////////////////////////////////////////////// -// zmm on aod: called by execute() - -StatusCode VFitZmmOnAOD::zmm_on_aod() { - - ATH_MSG_DEBUG("zmm_on_aod()"); - - StatusCode sc = StatusCode::SUCCESS; - - // retrieve the user container of pre selected muon from TDS - const MuonContainer* muonTDS=0; - sc= evtStore()->retrieve( muonTDS, m_muonContainerName); - if( sc.isFailure() || !muonTDS ) { - ATH_MSG_WARNING("No AOD muon container of muons found in TDS"); - return StatusCode::SUCCESS; - } - ATH_MSG_DEBUG("MuonContainer successfully retrieved"); - - // iterators over the container - MuonContainer::const_iterator muonItr = muonTDS->begin(); - MuonContainer::const_iterator muonItrE = muonTDS->end(); - int imuon=0; - for (; muonItr != muonItrE; ++muonItr) { - imuon++; - m_aod_muon_charge->Fill( (*muonItr)->charge() ); - m_aod_muon_pt->Fill( (*muonItr)->pt(), 1.); - m_aod_muon_eta->Fill( (*muonItr)->eta(), 1.); - m_aod_muon_chi2->Fill( (*muonItr)->matchChi2OverDoF(), 1.); - ATH_MSG_DEBUG("imuon=" <<imuon<< ", AthenaBarCode=" << (*muonItr)->getAthenaBarCode()); - } - - // get the size of the selected muon container - int nMuons = muonTDS->size(); - - // if there are more than one muon in this container - // then find Z candidate as a composite particle of 2 muons - if (nMuons > 1) { - - // inputs for vertex fitter - std::vector<const Rec::TrackParticle *> myTracks; - std::vector<const Trk::TrackParticleBase *> myTrackBases; - std::vector<double> myMuonMasses; - - xAOD::Vertex primaryVtx = *primVtx; - - Amg::Vector3D primVtxPos(primVtx->position().x(), primVtx->position().y(), primVtx->position().z()); - - // select 2 muons from container - // check that they have opposite charges - // then construct the Z as a composite of 2 muons - AnalysisUtils::Combination<const MuonContainer> comb(muonTDS,2); - MuonVect muonPair; - while (comb.goodOnes(this, muonPair, ::selectMuon)) { - // create the Z candidate as a composite of 2 muons - CompositeParticle* Zmm = new CompositeParticle; - Zmm->add(INav4MomLink (muonPair[0], *muonTDS), - INav4MomLink (muonPair[1], *muonTDS) ); - Zmm->set_charge(0); - Zmm->set_pdgId(PDG::Z0); - double mZmm = Zmm->m(); - m_aod_zmm_mass_hist->Fill(mZmm); - - myTracks.clear(); - myTracks.push_back(muonPair[0]->track()); - myTracks.push_back(muonPair[1]->track()); - - ATH_MSG_DEBUG("AthenaBarCode(mu[0])= " << muonPair[0]->track()->getAthenaBarCode()<< ", AthenaBarCode(mu[1])= " << muonPair[1]->track()->getAthenaBarCode()); - - myTrackBases.clear(); - myTrackBases.push_back(muonPair[0]->track()); - myTrackBases.push_back(muonPair[1]->track()); - - myMuonMasses.clear(); - myMuonMasses.push_back(mMuon); - myMuonMasses.push_back(mMuon); - - // vertex contrained to the primary vertex - std::unique_ptr<Trk::IVKalState> state = m_VKVrtFitter->makeState(); - m_VKVrtFitter->setVertexForConstraint(primaryVtx, *state); - m_VKVrtFitter->setMassInputParticles(myMuonMasses, *state); - - // define variables returned by the vertex fit - Amg::Vector3D retVtxPos; - TLorentzVector retMom4; - long int retQ = 0; - std::vector<double> errMatrix,chi2PerTrk; // Fit error matrix and chi2 per track - std::vector< std::vector<double> > trkAtVrt; // "True" tracks passing through vertex [phi, theta, q/pt*sin(theta)] - double pt_vk_mu1=-1, pt_vk_mu2=-1; - double fitChi2_vk=0.; - double invMass_VKFit=0; - double dxy_vk=0, dz_vk=0; - - sc = m_VKVrtFitter->VKalVrtFit(myTrackBases, retVtxPos,retMom4,retQ,errMatrix,chi2PerTrk,trkAtVrt,fitChi2_vk,*state); - - if (sc.isSuccess()) { - invMass_VKFit = retMom4.M(); - - pt_vk_mu1 = fabs(1./(trkAtVrt[0][2])) * sin(trkAtVrt[0][1]); - // double px_vk_mu1 = pt_vk_mu1*cos(trkAtVrt[0][0]); - // double py_vk_mu1 = pt_vk_mu1*sin(trkAtVrt[0][0]); - // double pz_vk_mu1 = fabs(1./(trkAtVrt[0][2])); - pt_vk_mu2 = fabs(1./(trkAtVrt[1][2])) * sin(trkAtVrt[1][1]); - - auto vDist_vk = retVtxPos-primVtxPos; - dxy_vk = (vDist_vk.x()*retMom4.Px() + vDist_vk.y()*retMom4.Py()) / - retMom4.Perp(); - dz_vk = vDist_vk.z()*retMom4.Pz() / fabs(retMom4.Pz()); - - ATH_MSG_DEBUG("VKalVrtFit result: m()= " << invMass_VKFit << ", chi2= " << fitChi2_vk - << "\n, original muon-1, pt= " << myTracks[0]->pt() - << ", after vertex fit, pt= " << pt_vk_mu1 - << "\n, original muon-2, pt= " << myTracks[1]->pt() - << ", after vertex fit, pt= " << pt_vk_mu2); - } - - ATH_MSG_DEBUG("Fill tree-variables of Z->mm"); - m_nZ++; - m_Zmode->push_back(2); - - m_Zm_vkfit->push_back(invMass_VKFit); - m_Zchi2_vkfit->push_back(fitChi2_vk); - m_Zdxy_vkfit->push_back( dxy_vk ); - m_Zdz_vkfit->push_back( dz_vk ); - - m_Zm->push_back(mZmm); - m_Zpx->push_back( Zmm->px() ); - m_Zpy->push_back( Zmm->py() ); - m_Zpz->push_back( Zmm->pz() ); - m_Ze->push_back( Zmm->e() ); - m_Zp->push_back( Zmm->p() ); - m_Zpt->push_back( Zmm->pt() ); - m_Zeta->push_back( Zmm->eta() ); - - m_L1pt_vkfit->push_back( pt_vk_mu1 ); - - m_L1px->push_back( muonPair[0]->px() ); - m_L1py->push_back( muonPair[0]->py() ); - m_L1pz->push_back( muonPair[0]->pz() ); - m_L1e->push_back( muonPair[0]->e() ); - m_L1p->push_back( muonPair[0]->p() ); - m_L1pt->push_back( muonPair[0]->pt() ); - m_L1eta->push_back( muonPair[0]->eta() ); - - m_L2pt_vkfit->push_back( pt_vk_mu1 ); - - m_L2px->push_back( muonPair[1]->px() ); - m_L2py->push_back( muonPair[1]->py() ); - m_L2pz->push_back( muonPair[1]->pz() ); - m_L2e->push_back( muonPair[1]->e() ); - m_L2p->push_back( muonPair[1]->p() ); - m_L2pt->push_back( muonPair[1]->pt() ); - m_L2eta->push_back( muonPair[1]->eta() ); - } - } - - return StatusCode::SUCCESS; - -} - -// muon selection function -bool selectMuon(VFitZmmOnAOD *self, const MuonVect &ll) { - bool test1 = ll[0]->charge() == -(ll[1]->charge()); - bool test2 = (ll[0]->pt() > self->m_etMuonCut) && - (ll[1]->pt() > self->m_etMuonCut); - bool test3 = ( fabs(ll[0]->eta()) < self->m_etaMuonCut ) && - ( fabs(ll[1]->eta()) < self->m_etaMuonCut ); - return (test1 && test2 && test3); -} - -/// -StatusCode VFitZmmOnAOD::addEventInfo() { - - // this code has been taken from CBNT_execute - // Reconstruction/CBNT_Athena/src/CBNTAA_EventInfo.cxx - // Need this in the ntuple, but don't want to invoke the CBNT class - // I have the actual EventNumber, but skipped the sequential count of event # - // - - //get EventInfo for run and event number - - const xAOD::EventInfo* eventInfo; - StatusCode sc = evtStore()->retrieve(eventInfo); - - if (sc.isFailure()) - { - ATH_MSG_WARNING("Could not retrieve event info"); - return sc; - } - - // - m_runNumber=eventInfo->runNumber(); - m_eventNumber=eventInfo->eventNumber(); - m_eventTime=eventInfo->timeStamp() ; - m_lumiBlock=eventInfo->lumiBlock() ; - m_bCID=eventInfo->bcid(); - m_eventWeight=eventInfo->mcEventWeight(); - - /* Remove this information from the ntuple. This is non-optimal. VJ Mar 29, 2012 - // Got this impression by talking to Attila K. - - const TriggerInfo* myTriggerInfo=eventInfo->trigger_info(); - if (myTriggerInfo!=0) { - m_lVL1ID=myTriggerInfo->extendedLevel1ID(); - m_statusElement=myTriggerInfo->statusElement(); - m_lvl1TriggerType=myTriggerInfo->level1TriggerType(); - - std::vector<TriggerInfo::number_type>::const_iterator lvl1TrigIt=myTriggerInfo->level1TriggerInfo().begin(); - std::vector<TriggerInfo::number_type>::const_iterator lvl1TrigIt_e=myTriggerInfo->level1TriggerInfo().end(); - for (;lvl1TrigIt!=lvl1TrigIt_e;lvl1TrigIt++) - m_lvl1TriggerInfo->push_back(*lvl1TrigIt); - - - std::vector<TriggerInfo::number_type>::const_iterator lvl2TrigIt=myTriggerInfo->level2TriggerInfo().begin(); - std::vector<TriggerInfo::number_type>::const_iterator lvl2TrigIt_e=myTriggerInfo->level2TriggerInfo().end(); - for (;lvl2TrigIt!=lvl2TrigIt_e;lvl2TrigIt++) - m_lvl2TriggerInfo->push_back(*lvl2TrigIt); - - std::vector<TriggerInfo::number_type>::const_iterator evtFilterIt=myTriggerInfo->eventFilterInfo().begin(); - std::vector<TriggerInfo::number_type>::const_iterator evtFilterIt_e=myTriggerInfo->eventFilterInfo().end(); - for (;evtFilterIt!=evtFilterIt_e;evtFilterIt++) - m_evtFilterInfo->push_back(*evtFilterIt); - - - std::vector<TriggerInfo::StreamTag>::const_iterator streamInfoIt=myTriggerInfo->streamTags().begin(); - std::vector<TriggerInfo::StreamTag>::const_iterator streamInfoIt_e=myTriggerInfo->streamTags().end(); - for (;streamInfoIt!=streamInfoIt_e;streamInfoIt++) { - m_streamTagName->push_back(streamInfoIt->name()); - m_streamTagType->push_back(streamInfoIt->type()); - } - - }else - { - m_lVL1ID=0; - m_statusElement=0; - m_lvl1TriggerType=0; - } - - */ - return StatusCode::SUCCESS; - -} diff --git a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/src/VFitZmmOnAOD.h b/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/src/VFitZmmOnAOD.h deleted file mode 100644 index d29395755cc3b5681d9edf43f1aec9c87128cb8f..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/src/VFitZmmOnAOD.h +++ /dev/null @@ -1,168 +0,0 @@ -// dear emacs, this is -*- C++ -*- - -/* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef ANALYSISEXAMPLES_VFITZMMONAOD_H -#define ANALYSISEXAMPLES_VFITZMMONAOD_H 1 - -///////////////////////////////////////////////////////////////////////////////////////////////////// -// Name : VFitZmmOnAOD.h -// Package : offline/PhysicsAnalysis/AnalysisCommon/AnalysisExamples -// Author : Shuwei YE -// Created : September 2009 -// Modifed from ZeeZmmOnAOD in AnalysisExamples -// -// DESCRIPTION: -// -// Example of Vertex Fitting on Z->mumu with AOD -// using TrkVKalVrtFitter -// -/////////////////////////////////////////////////////////////////////////////////////////////////////// - -#include "GaudiKernel/ToolHandle.h" -//#include "GaudiKernel/Algorithm.h" -#include "GaudiKernel/ObjectVector.h" -#include "GaudiKernel/ITHistSvc.h" -#include "CLHEP/Units/SystemOfUnits.h" -#include "AnalysisTools/AnalysisTools.h" -#include "AthenaBaseComps/AthAlgorithm.h" - -#include "muonEvent/MuonContainer.h" - -#include "TrkVKalVrtFitter/TrkVKalVrtFitter.h" - -#include <string> -#include <vector> - -#include "TH1.h" -#include "TH2.h" -#include "TNtuple.h" -#include "TROOT.h" - -typedef std::vector<const Analysis::MuonContainer::base_value_type*> MuonVect; - -// forwards -class VFitZmmOnAOD; - -// the selection function for muons -bool selectMuon(VFitZmmOnAOD *self, const MuonVect &ll); - -class VFitZmmOnAOD : public AthAlgorithm { - - public: - - VFitZmmOnAOD(const std::string& name, ISvcLocator* pSvcLocator); - ~VFitZmmOnAOD(); - - StatusCode initialize(); - StatusCode execute(); - StatusCode initEvent(); - StatusCode finalize(); - - private: - - /// the selection function for electrons - friend bool selectMuon(VFitZmmOnAOD *self, const MuonVect &ll); - - /// Z->mumu reconstruction with Z as composite particles - StatusCode zmm_on_aod(); - - /// add event info to ntuple - StatusCode addEventInfo(); - - - private: - - /// get a handle to the tool helper - ToolHandle<AnalysisTools> m_analysisTools; - - /// a handle on the Hist/TTree registration service - ITHistSvc * m_thistSvc; - - // for handling Trk::TrkVKalVrtFitter - ToolHandle<Trk::IVertexFitter> m_ToolIVrtFitter; - ToolHandle<Trk::ITrkVKalVrtFitter> m_VKVrtFitter; - - /// the AOD muon container to retrieve - std::string m_muonContainerName; - - // the vertex container - std::string m_VxContainerName; - - /// use selection cuts - for muons - /// to be modified thru job options - double m_etMuonCut; - double m_etaMuonCut; - - // variables for "tree_Zll" - TTree* m_tree_Zll; - double m_v0_x, m_v0_y, m_v0_z; - int m_nZ; - std::vector<int>* m_Zmode; - - std::vector<double>* m_Zm_vkfit; - std::vector<double>* m_Zchi2_vkfit; - std::vector<double>* m_Zdxy_vkfit; - std::vector<double>* m_Zdz_vkfit; - - std::vector<double>* m_Zm; - std::vector<double>* m_Zpt; - std::vector<double>* m_Zpx; - std::vector<double>* m_Zpy; - std::vector<double>* m_Zpz; - std::vector<double>* m_Zp; - std::vector<double>* m_Ze; - std::vector<double>* m_Zeta; - - std::vector<double>* m_L1pt_vkfit; - std::vector<double>* m_L1pt; - std::vector<double>* m_L1px; - std::vector<double>* m_L1py; - std::vector<double>* m_L1pz; - std::vector<double>* m_L1p; - std::vector<double>* m_L1e; - std::vector<double>* m_L1eta; - - std::vector<double>* m_L2pt_vkfit; - std::vector<double>* m_L2pt; - std::vector<double>* m_L2px; - std::vector<double>* m_L2py; - std::vector<double>* m_L2pz; - std::vector<double>* m_L2p; - std::vector<double>* m_L2e; - std::vector<double>* m_L2eta; - - /// variables to store Event Info stuff - - unsigned int m_runNumber; - unsigned int m_eventNumber; - unsigned int m_eventTime; - unsigned int m_lumiBlock; - unsigned int m_bCID; - unsigned int m_lVL1ID; - double m_eventWeight; - /* - // remove from ntuple - // see comment in addEventInfo() - - unsigned int m_statusElement; - unsigned int m_lvl1TriggerType; - std::vector<unsigned int>* m_lvl1TriggerInfo; - std::vector<unsigned int>* m_lvl2TriggerInfo; - std::vector<unsigned int>* m_evtFilterInfo; - std::vector<std::string>* m_streamTagName; - std::vector<std::string>* m_streamTagType; - */ - /// the muon histograms - TH1F* m_aod_muon_pt; - TH1F* m_aod_muon_eta; - TH1F* m_aod_muon_chi2; - TH1F* m_aod_zmm_mass_hist; - TH1F* m_aod_muon_charge; - -}; - -#endif // VFITZMMONAOD_H - diff --git a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/src/components/AnalysisExamples_entries.cxx b/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/src/components/AnalysisExamples_entries.cxx index 45622f1f8a07ca861b9a801a91a7d95ae0691418..cca89bfb1e563e23a795bef1030fc3f31fa51e43 100644 --- a/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/src/components/AnalysisExamples_entries.cxx +++ b/PhysicsAnalysis/AnalysisCommon/AnalysisExamples/src/components/AnalysisExamples_entries.cxx @@ -4,7 +4,6 @@ #include "../ZeeOnESD.h" #include "../JetTagAna.h" #include "../MiscellaneousExamples.h" -#include "../VFitZmmOnAOD.h" #include "../PileUpTruthExample.h" #include "../TrigAnalysisExample.h" #include "../AthExReadD3pdEvtStore.h" @@ -16,7 +15,6 @@ DECLARE_COMPONENT( WriteTruthParticles ) DECLARE_COMPONENT( ReadTruthParticles ) DECLARE_COMPONENT( TrackExample ) DECLARE_COMPONENT( ZeeOnESD ) -DECLARE_COMPONENT( VFitZmmOnAOD ) DECLARE_COMPONENT( JetTagAna ) DECLARE_COMPONENT( PileUpTruthExample ) DECLARE_COMPONENT( TrigAnalysisExample ) diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkCore/python/ContentHandler.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkCore/python/ContentHandler.py index ec06698675312608c874ef6d919c9f38b025c2c1..5c4ebc5b73499d1bfb5e9fde0c41fe51dd496092 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkCore/python/ContentHandler.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkCore/python/ContentHandler.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration from AthenaCommon import CfgMgr from AthenaCommon.AlgSequence import AlgSequence @@ -15,7 +15,7 @@ class ContentHandler: self.ContainersForExpansion = ContainersForExpansion def mainContainerLine(self,containerName): - theDictionary = dict(self.NamesAndTypes.items() + self.AppendToDictionary.items()) + theDictionary = dict(list(self.NamesAndTypes.items()) + list(self.AppendToDictionary.items())) line = '' if containerName in theDictionary.keys(): line = theDictionary[containerName]+"#"+containerName diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkCore/python/SlimmingHelper.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkCore/python/SlimmingHelper.py index 3607b1624b45c553fae09bb439b3fec82770e80d..c67cd00f1f4c9bffd841bf6cc4482426e0981462 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkCore/python/SlimmingHelper.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkCore/python/SlimmingHelper.py @@ -232,7 +232,7 @@ class SlimmingHelper: for item in mainEntries: Stream.AddItem(item) for item in auxEntries.keys(): - theDictionary = dict(self.NamesAndTypes.items() + self.AppendToDictionary.items()) + theDictionary = dict(list(self.NamesAndTypes.items()) + list(self.AppendToDictionary.items())) if item in theDictionary.keys(): if (theDictionary[item]=='xAOD::JetAuxContainer'): entry = "xAOD::JetAuxContainer#"+item+"." diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkPhys/share/PHYS.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkPhys/share/PHYS.py index 2519c8ce238caeccae5dd51a97ddd142aaa5c04f..d605a59b3d5de3faf26a045fc4ba943fb295b6a3 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkPhys/share/PHYS.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkPhys/share/PHYS.py @@ -13,6 +13,8 @@ from DerivationFrameworkInDet.InDetCommon import * from DerivationFrameworkJetEtMiss.JetCommon import * from DerivationFrameworkJetEtMiss.ExtendedJetCommon import * from DerivationFrameworkJetEtMiss.METCommon import * +from DerivationFrameworkEGamma.EGammaCommon import * +from DerivationFrameworkEGamma.ElectronsCPDetailedContent import * from DerivationFrameworkMuons.MuonsCommon import * from TriggerMenu.api.TriggerAPI import TriggerAPI from TriggerMenu.api.TriggerEnums import TriggerPeriod, TriggerType @@ -186,6 +188,18 @@ addQGTaggerTool(jetalg="AntiKt4EMPFlow",sequence=SeqPHYS,algname="QGTaggerToolPF # fJVT # getPFlowfJVT(jetalg='AntiKt4EMPFlow',sequence=SeqPHYS, algname='PHYSJetForwardPFlowJvtToolAlg') +#==================================================================== +# EGAMMA +#==================================================================== + +if DerivationFrameworkIsMonteCarlo: + # Schedule the two energy density tools for running after the pseudojets are created. + for alg in ['EDTruthCentralAlg', 'EDTruthForwardAlg']: + if hasattr(topSequence, alg): + edtalg = getattr(topSequence, alg) + delattr(topSequence, alg) + SeqPHYS += edtalg + #==================================================================== # Add our sequence to the top sequence #==================================================================== diff --git a/PhysicsAnalysis/HeavyIonPhys/HIEventUtils/CMakeLists.txt b/PhysicsAnalysis/HeavyIonPhys/HIEventUtils/CMakeLists.txt index c1575f96e9810095c07118e94bb50071638e904e..3e5f6f51f0d60a0aec6977dee66ae2f2f3af597d 100644 --- a/PhysicsAnalysis/HeavyIonPhys/HIEventUtils/CMakeLists.txt +++ b/PhysicsAnalysis/HeavyIonPhys/HIEventUtils/CMakeLists.txt @@ -30,7 +30,7 @@ atlas_add_library( HIEventUtilsLib Root/*.cxx PUBLIC_HEADERS HIEventUtils INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} CaloGeoHelpers AsgTools xAODCaloEvent xAODEventInfo xAODForward xAODHIEvent xAODTracking xAODTrigL1Calo PathResolver PATCoreLib + LINK_LIBRARIES ${ROOT_LIBRARIES} CaloGeoHelpers AsgTools xAODCaloEvent xAODEventInfo xAODForward xAODHIEvent xAODTracking xAODTrigL1Calo PathResolver PATCoreLib InDetTrackSelectionToolLib PRIVATE_LINK_LIBRARIES CxxUtils ) if (NOT XAOD_STANDALONE) diff --git a/PhysicsAnalysis/PrimaryDPDMaker/python/LogicalFilterCombiner.py b/PhysicsAnalysis/PrimaryDPDMaker/python/LogicalFilterCombiner.py index 50de75cb42d3d21bc40cca4b5d5a80f169695f4a..bfa191a6f1a62dfd6e9dd9ef37bdfb26a50c592e 100644 --- a/PhysicsAnalysis/PrimaryDPDMaker/python/LogicalFilterCombiner.py +++ b/PhysicsAnalysis/PrimaryDPDMaker/python/LogicalFilterCombiner.py @@ -23,7 +23,7 @@ from AthenaCommon.AlgSequence import AlgSequence from AthenaCommon.Logging import logging import tokenize -from cStringIO import StringIO +from io import StringIO class LogicalFilterCombiner( PyAthena.AthFilterAlgorithm ): diff --git a/PhysicsAnalysis/PrimaryDPDMaker/share/DAOD_IDNCB.py b/PhysicsAnalysis/PrimaryDPDMaker/share/DAOD_IDNCB.py index 82b573e8dfb7cabce731a0629996cc2277440720..15d0452613e74b9847b05d22fbd72c531e093325 100644 --- a/PhysicsAnalysis/PrimaryDPDMaker/share/DAOD_IDNCB.py +++ b/PhysicsAnalysis/PrimaryDPDMaker/share/DAOD_IDNCB.py @@ -90,8 +90,8 @@ if dumpPixInfo: PixelChargeToTConversionSetter = PixelChargeToTConversion(name = "NCBPixelChargeToTConversionSetter") topSequence += PixelChargeToTConversionSetter if (printIdTrkDxAODConf): - print PixelChargeToTConversionSetter - print PixelChargeToTConversionSetter.properties() + print(PixelChargeToTConversionSetter) + print(PixelChargeToTConversionSetter.properties()) #Setup SCT extension efficiency algorithm if running pixel tracklets #if InDetFlags.doTrackSegmentsPixel(): @@ -111,8 +111,8 @@ if dumpTrtInfo: topSequence += xAOD_TRT_PrepDataToxAOD if (printIdTrkDxAODConf): - print xAOD_TRT_PrepDataToxAOD - print xAOD_TRT_PrepDataToxAOD.properties() + print(xAOD_TRT_PrepDataToxAOD) + print(xAOD_TRT_PrepDataToxAOD.properties()) if dumpSctInfo: from InDetPrepRawDataToxAOD.InDetPrepRawDataToxAODConf import SCT_PrepDataToxAOD @@ -126,8 +126,8 @@ if dumpSctInfo: topSequence += xAOD_SCT_PrepDataToxAOD if (printIdTrkDxAODConf): - print xAOD_SCT_PrepDataToxAOD - print xAOD_SCT_PrepDataToxAOD.properties() + print(xAOD_SCT_PrepDataToxAOD) + print(xAOD_SCT_PrepDataToxAOD.properties()) if dumpPixInfo: from InDetPrepRawDataToxAOD.InDetPrepRawDataToxAODConf import PixelPrepDataToxAOD @@ -144,8 +144,8 @@ if dumpPixInfo: topSequence += xAOD_PixelPrepDataToxAOD if (printIdTrkDxAODConf): - print xAOD_PixelPrepDataToxAOD - print xAOD_PixelPrepDataToxAOD.properties() + print(xAOD_PixelPrepDataToxAOD) + print(xAOD_PixelPrepDataToxAOD.properties()) ################# @@ -179,8 +179,8 @@ ToolSvc += DFIDNCB augmentationTools+=[DFIDNCB] if (printIdTrkDxAODConf): - print DFIDNCB - print DFIDNCB.properties() + print(DFIDNCB) + print(DFIDNCB.properties()) # Add BS error augmentation tool if dumpBytestreamErrors: @@ -192,8 +192,8 @@ if dumpBytestreamErrors: ToolSvc += DFEI augmentationTools+=[DFEI] if (printIdTrkDxAODConf): - print DFEI - print DFEI.properties() + print(DFEI) + print(DFEI.properties()) # Add Unassociated hits augmentation tool if dumpUnassociatedHits: @@ -205,8 +205,8 @@ if dumpUnassociatedHits: TRTDriftCircleContainer = "TRT_DriftCircles") ToolSvc += unassociatedHitsGetterTool if (printIdTrkDxAODConf): - print unassociatedHitsGetterTool - print unassociatedHitsGetterTool.properties() + print(unassociatedHitsGetterTool) + print(unassociatedHitsGetterTool.properties()) from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__UnassociatedHitsDecorator unassociatedHitsDecorator = DerivationFramework__UnassociatedHitsDecorator (name ='NCBunassociatedHitsDecorator', @@ -218,8 +218,8 @@ if dumpUnassociatedHits: augmentationTools+=[unassociatedHitsDecorator] if (printIdTrkDxAODConf): - print unassociatedHitsDecorator - print unassociatedHitsDecorator.properties() + print(unassociatedHitsDecorator) + print(unassociatedHitsDecorator.properties()) # Add LArCollisionTime augmentation tool if dumpLArCollisionTime: @@ -236,8 +236,8 @@ if dumpLArCollisionTime: augmentationTools+=[lArCollisionTimeDecorator] if (printIdTrkDxAODConf): - print lArCollisionTimeDecorator - print lArCollisionTimeDecorator.properties() + print(lArCollisionTimeDecorator) + print(lArCollisionTimeDecorator.properties()) #==================================================================== @@ -304,8 +304,8 @@ DerivationFrameworkJob += CfgMgr.DerivationFramework__DerivationKernel("DFIDNCB_ topSequence += DerivationFrameworkJob if (printIdTrkDxAODConf): - print DerivationFrameworkJob - print DerivationFrameworkJob.properties() + print(DerivationFrameworkJob) + print(DerivationFrameworkJob.properties()) ################# ### Steer output file content @@ -381,4 +381,4 @@ if dumpTriggerInfo: IDNCBStream.AddItem("xAOD::TrigNavigationAuxInfo#TrigNavigationAux.") if (printIdTrkDxAODConf): - print IDNCBStream + print(IDNCBStream) diff --git a/PhysicsAnalysis/PrimaryDPDMaker/share/DAOD_IDPIXLUMI.py b/PhysicsAnalysis/PrimaryDPDMaker/share/DAOD_IDPIXLUMI.py index 072ceeee75090ee54612cfff48dcfd5a11f29337..73a2fecc20e04d910cfdac064ad81f6898e95e00 100644 --- a/PhysicsAnalysis/PrimaryDPDMaker/share/DAOD_IDPIXLUMI.py +++ b/PhysicsAnalysis/PrimaryDPDMaker/share/DAOD_IDPIXLUMI.py @@ -25,8 +25,8 @@ if dumpPixInfo: PixelChargeToTConversionSetter = PixelChargeToTConversion(name = "PixelChargeToTConversionSetter") topSequence += PixelChargeToTConversionSetter if (printIdTrkDxAODConf): - print PixelChargeToTConversionSetter - print PixelChargeToTConversionSetter.properties() + print(PixelChargeToTConversionSetter) + print(PixelChargeToTConversionSetter.properties()) ################# @@ -48,8 +48,8 @@ if dumpPixInfo: topSequence += xAOD_PixelPrepDataToxAOD if (printIdTrkDxAODConf): - print xAOD_PixelPrepDataToxAOD - print xAOD_PixelPrepDataToxAOD.properties() + print(xAOD_PixelPrepDataToxAOD) + print(xAOD_PixelPrepDataToxAOD.properties()) ################# @@ -127,8 +127,8 @@ DerivationFrameworkJob += CfgMgr.DerivationFramework__DerivationKernel("DFTSOS_K OutputLevel =INFO) if (printIdTrkDxAODConf): - print DerivationFrameworkJob - print DerivationFrameworkJob.properties() + print(DerivationFrameworkJob) + print(DerivationFrameworkJob.properties()) #==================================================================== @@ -147,4 +147,4 @@ IDPIXLUMISlimmingHelper.AppendContentToStream(IDPIXLUMIStream) # Add trigger information if (printIdTrkDxAODConf): - print IDPIXLUMIStream + print(IDPIXLUMIStream) diff --git a/PhysicsAnalysis/PrimaryDPDMaker/share/DAOD_IDTRKLUMI.py b/PhysicsAnalysis/PrimaryDPDMaker/share/DAOD_IDTRKLUMI.py index e4007db644df1c437c67b76e5f5718d40db4cdf7..036a1b11728bdda2212a3022f91ae9e302f88aa5 100644 --- a/PhysicsAnalysis/PrimaryDPDMaker/share/DAOD_IDTRKLUMI.py +++ b/PhysicsAnalysis/PrimaryDPDMaker/share/DAOD_IDTRKLUMI.py @@ -54,8 +54,8 @@ if dumpPixInfo: PixelChargeToTConversionSetter = PixelChargeToTConversion(name = "PixelChargeToTConversionSetter") topSequence += PixelChargeToTConversionSetter if (printIdTrkDxAODConf): - print PixelChargeToTConversionSetter - print PixelChargeToTConversionSetter.properties() + print(PixelChargeToTConversionSetter) + print(PixelChargeToTConversionSetter.properties()) #Setup SCT extension efficiency algorithm if running pixel tracklets #if InDetFlags.doTrackSegmentsPixel(): @@ -78,8 +78,8 @@ if dumpSctInfo: topSequence += xAOD_SCT_PrepDataToxAOD if (printIdTrkDxAODConf): - print xAOD_SCT_PrepDataToxAOD - print xAOD_SCT_PrepDataToxAOD.properties() + print(xAOD_SCT_PrepDataToxAOD) + print(xAOD_SCT_PrepDataToxAOD.properties()) if dumpPixInfo: from InDetPrepRawDataToxAOD.InDetPrepRawDataToxAODConf import PixelPrepDataToxAOD @@ -95,8 +95,8 @@ if dumpPixInfo: topSequence += xAOD_PixelPrepDataToxAOD if (printIdTrkDxAODConf): - print xAOD_PixelPrepDataToxAOD - print xAOD_PixelPrepDataToxAOD.properties() + print(xAOD_PixelPrepDataToxAOD) + print(xAOD_PixelPrepDataToxAOD.properties()) ################# @@ -130,8 +130,8 @@ DFTSOS = DerivationFramework__TrackStateOnSurfaceDecorator(name = "DFTrackStateO ToolSvc += DFTSOS augmentationTools+=[DFTSOS] if (printIdTrkDxAODConf): - print DFTSOS - print DFTSOS.properties() + print(DFTSOS) + print(DFTSOS.properties()) # Add BS error augmentation tool @@ -144,8 +144,8 @@ if dumpBytestreamErrors: ToolSvc += DFEI augmentationTools+=[DFEI] if (printIdTrkDxAODConf): - print DFEI - print DFEI.properties() + print(DFEI) + print(DFEI.properties()) # Add Unassociated hits augmentation tool if dumpUnassociatedHits: @@ -157,8 +157,8 @@ if dumpUnassociatedHits: TRTDriftCircleContainer = "TRT_DriftCircles") ToolSvc += unassociatedHitsGetterTool if (printIdTrkDxAODConf): - print unassociatedHitsGetterTool - print unassociatedHitsGetterTool.properties() + print(unassociatedHitsGetterTool) + print(unassociatedHitsGetterTool.properties()) from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__UnassociatedHitsDecorator unassociatedHitsDecorator = DerivationFramework__UnassociatedHitsDecorator (name ='unassociatedHitsDecorator', @@ -169,8 +169,8 @@ if dumpUnassociatedHits: ToolSvc += unassociatedHitsDecorator augmentationTools+=[unassociatedHitsDecorator] if (printIdTrkDxAODConf): - print unassociatedHitsDecorator - print unassociatedHitsDecorator.properties() + print(unassociatedHitsDecorator) + print(unassociatedHitsDecorator.properties()) # Add LArCollisionTime augmentation tool if dumpLArCollisionTime: @@ -188,8 +188,8 @@ if dumpLArCollisionTime: ToolSvc += lArCollisionTimeDecorator augmentationTools+=[lArCollisionTimeDecorator] if (printIdTrkDxAODConf): - print lArCollisionTimeDecorator - print lArCollisionTimeDecorator.properties() + print(lArCollisionTimeDecorator) + print(lArCollisionTimeDecorator.properties()) @@ -201,8 +201,8 @@ DerivationFrameworkJob += CfgMgr.DerivationFramework__CommonAugmentation("DFTSOS topSequence += DerivationFrameworkJob if (printIdTrkDxAODConf): - print DerivationFrameworkJob - print DerivationFrameworkJob.properties() + print(DerivationFrameworkJob) + print(DerivationFrameworkJob.properties()) ################# ### Steer output file content @@ -263,4 +263,4 @@ if dumpTriggerInfo: IDTRKLUMIStream.AddItem("xAOD::TrigT2MbtsBitsAuxContainer#HLT_xAOD__TrigT2MbtsBitsContainer_T2MbtsAux.") if (printIdTrkDxAODConf): - print IDTRKLUMIStream + print(IDTRKLUMIStream) diff --git a/PhysicsAnalysis/PrimaryDPDMaker/share/DESD_DEDX.py b/PhysicsAnalysis/PrimaryDPDMaker/share/DESD_DEDX.py index 52f4a7e451cb9dcb2543835636c9acfa0dc84e2b..2d9c6e1d3b5d273022073d6a3f550062dc990621 100644 --- a/PhysicsAnalysis/PrimaryDPDMaker/share/DESD_DEDX.py +++ b/PhysicsAnalysis/PrimaryDPDMaker/share/DESD_DEDX.py @@ -35,7 +35,7 @@ DESD_DEDX_SkimmingTool = DerivationFramework__xAODStringSkimmingTool(name = "DES expression = selection) ToolSvc += DESD_DEDX_SkimmingTool -print DESD_DEDX_SkimmingTool +print(DESD_DEDX_SkimmingTool) # Kernel algorithm from DerivationFrameworkCore.DerivationFrameworkCoreConf import DerivationFramework__DerivationKernel diff --git a/PhysicsAnalysis/PrimaryDPDMaker/share/DRAW_EGJPSI.py b/PhysicsAnalysis/PrimaryDPDMaker/share/DRAW_EGJPSI.py index d4ea9dff565f7492b4c6176d09085dd356f4ef0c..b1f280a35552762ce291288c003e67866637a19d 100644 --- a/PhysicsAnalysis/PrimaryDPDMaker/share/DRAW_EGJPSI.py +++ b/PhysicsAnalysis/PrimaryDPDMaker/share/DRAW_EGJPSI.py @@ -42,7 +42,7 @@ DRAW_EGJPSI_SkimmingTool = DerivationFramework__xAODStringSkimmingTool(name = "D expression = draw_egcalib) ToolSvc += DRAW_EGJPSI_SkimmingTool -print DRAW_EGJPSI_SkimmingTool +print(DRAW_EGJPSI_SkimmingTool) # Kernel algorithm from DerivationFrameworkCore.DerivationFrameworkCoreConf import DerivationFramework__DerivationKernel diff --git a/PhysicsAnalysis/PrimaryDPDMaker/share/DRAW_EGZ.py b/PhysicsAnalysis/PrimaryDPDMaker/share/DRAW_EGZ.py index 18a056377df5462b1407f25024f98363e4cbadd9..4ee120f2a5e4b6d87a8168e8f0d53bbd2cd3df2b 100644 --- a/PhysicsAnalysis/PrimaryDPDMaker/share/DRAW_EGZ.py +++ b/PhysicsAnalysis/PrimaryDPDMaker/share/DRAW_EGZ.py @@ -57,7 +57,7 @@ DRAW_EGZ_SkimmingTool = DerivationFramework__xAODStringSkimmingTool(name = "DRAW expression = draw_egz) ToolSvc += DRAW_EGZ_SkimmingTool -print DRAW_EGZ_SkimmingTool +print(DRAW_EGZ_SkimmingTool) # Kernel algorithm from DerivationFrameworkCore.DerivationFrameworkCoreConf import DerivationFramework__DerivationKernel diff --git a/PhysicsAnalysis/PrimaryDPDMaker/share/DRAW_EMU.py b/PhysicsAnalysis/PrimaryDPDMaker/share/DRAW_EMU.py index 09ea6f473113b108b6340b5ab092454a2187ca72..c106e817be9373801e2e699c50ebeca99cac6b65 100644 --- a/PhysicsAnalysis/PrimaryDPDMaker/share/DRAW_EMU.py +++ b/PhysicsAnalysis/PrimaryDPDMaker/share/DRAW_EMU.py @@ -24,7 +24,7 @@ DRAW_EMU_SkimmingTool = DerivationFramework__xAODStringSkimmingTool(name = "DRAW expression = draw_emu) ToolSvc += DRAW_EMU_SkimmingTool -print DRAW_EMU_SkimmingTool +print(DRAW_EMU_SkimmingTool) # Kernel algorithm from DerivationFrameworkCore.DerivationFrameworkCoreConf import DerivationFramework__DerivationKernel diff --git a/PhysicsAnalysis/PrimaryDPDMaker/share/DRAW_TAUMUH.py b/PhysicsAnalysis/PrimaryDPDMaker/share/DRAW_TAUMUH.py index 9456be84fea2045c4a87677f6dabeeb783ea860a..241181895fe8545ebc7ce29c79cc295f98697717 100644 --- a/PhysicsAnalysis/PrimaryDPDMaker/share/DRAW_TAUMUH.py +++ b/PhysicsAnalysis/PrimaryDPDMaker/share/DRAW_TAUMUH.py @@ -41,14 +41,14 @@ TAUMUH_DeltaRTool = DerivationFramework__DeltaRTool( name = StoreGateEntryName = "TAUMUH_DeltaR" ) ToolSvc += TAUMUH_DeltaRTool -print TAUMUH_DeltaRTool +print(TAUMUH_DeltaRTool) # Event selection tool from DerivationFrameworkTools.DerivationFrameworkToolsConf import DerivationFramework__xAODStringSkimmingTool DRAW_TAUMUH_SkimmingTool = DerivationFramework__xAODStringSkimmingTool(name = "DRAW_TAUMUH_SkimmingTool", expression = draw_taumuh) ToolSvc += DRAW_TAUMUH_SkimmingTool -print DRAW_TAUMUH_SkimmingTool +print(DRAW_TAUMUH_SkimmingTool) # Kernel algorithm diff --git a/PhysicsAnalysis/PrimaryDPDMaker/share/DRAW_TOPSLMU.py b/PhysicsAnalysis/PrimaryDPDMaker/share/DRAW_TOPSLMU.py index 0dffbd16a48519c326336cbac0446f7c36c2a4a6..97d58317dd4e807f0cce4f4b4d6ff99938fcfbd5 100644 --- a/PhysicsAnalysis/PrimaryDPDMaker/share/DRAW_TOPSLMU.py +++ b/PhysicsAnalysis/PrimaryDPDMaker/share/DRAW_TOPSLMU.py @@ -33,8 +33,8 @@ muTriggers = ['HLT_mu20_iloose_L1MU15','HLT_mu24_ivarmedium','HLT_mu24_imedium'] # Event selection string: draw_ttbar = '( count('+sel_muon+')==1 && count('+sel_jet+')>=3 && count('+sel_bjet+')>=1 && count('+sel_el+') == 0 && count('+met+') >=1 ) && (' + " || ".join(muTriggers) + ')' -print "This is the selection string that will be used for DRAW_TOPSLMU:" -print draw_ttbar +print("This is the selection string that will be used for DRAW_TOPSLMU:") +print(draw_ttbar) # Event selection tool from DerivationFrameworkTools.DerivationFrameworkToolsConf import DerivationFramework__xAODStringSkimmingTool @@ -43,8 +43,8 @@ DRAW_TOPSLMU_SkimmingTool = DerivationFramework__xAODStringSkimmingTool(name = " ToolSvc += DRAW_TOPSLMU_SkimmingTool -print "Skimming tool:" -print DRAW_TOPSLMU_SkimmingTool +print("Skimming tool:") +print(DRAW_TOPSLMU_SkimmingTool) # Kernel algorithm from DerivationFrameworkCore.DerivationFrameworkCoreConf import DerivationFramework__DerivationKernel diff --git a/PhysicsAnalysis/PrimaryDPDMaker/share/DRAW_ZMUMU.py b/PhysicsAnalysis/PrimaryDPDMaker/share/DRAW_ZMUMU.py index e51d461b707c48f18ec1d2942bb2ab53d4be65dc..8e19571da344332decba26c505d272272ca4eeb8 100644 --- a/PhysicsAnalysis/PrimaryDPDMaker/share/DRAW_ZMUMU.py +++ b/PhysicsAnalysis/PrimaryDPDMaker/share/DRAW_ZMUMU.py @@ -43,7 +43,7 @@ goodMuonTool.MuQuality = 3 # turn of the momentum correction which is not needed for IDHits cut and Preselection goodMuonTool.TurnOffMomCorr = True ToolSvc += goodMuonTool -print goodMuonTool +print(goodMuonTool) from PrimaryDPDMaker.PrimaryDPDMakerConf import DerivationFramework__DRAW_ZMUMUSkimmingTool goodMuonSkimmingTool = DerivationFramework__DRAW_ZMUMUSkimmingTool(name = "DRAW_ZMUMU_GoodMuon_SkimmingTool", MuonContainerKey = "Muons", @@ -54,8 +54,8 @@ ToolSvc += goodMuonSkimmingTool periods = TriggerPeriod.future | TriggerPeriod.y2015 | TriggerPeriod.y2016 | TriggerPeriod.y2017 allUnprescaledTriggers = TriggerAPI.getLowestUnprescaledAnyPeriod(periods, TriggerType.mu) -print "DRAW_ZMUMU: will skim on an OR of the following muon triggers (list provided at run-time by the TriggerAPI):" -print allUnprescaledTriggers +print("DRAW_ZMUMU: will skim on an OR of the following muon triggers (list provided at run-time by the TriggerAPI):") +print(allUnprescaledTriggers) from DerivationFrameworkTools.DerivationFrameworkToolsConf import DerivationFramework__TriggerSkimmingTool triggerSkimmingTool = DerivationFramework__TriggerSkimmingTool(name = "DRAWZMUMUTriggerSkimmingTool", TriggerListOR = allUnprescaledTriggers) @@ -68,7 +68,7 @@ DRAW_ZMUMU_SkimmingTool = DerivationFramework__FilterCombinationAND( name = "DRA goodMuonSkimmingTool, triggerSkimmingTool] ) ToolSvc += DRAW_ZMUMU_SkimmingTool -print DRAW_ZMUMU_SkimmingTool +print(DRAW_ZMUMU_SkimmingTool) # Kernel algorithm from DerivationFrameworkCore.DerivationFrameworkCoreConf import DerivationFramework__DerivationKernel diff --git a/PhysicsAnalysis/PrimaryDPDMaker/share/PerfDESDM_MS.py b/PhysicsAnalysis/PrimaryDPDMaker/share/PerfDESDM_MS.py index 7f781b8683497e168aa2a87df479154eab03ef52..ad5c959959a81636c7265d95f0449310a5369bd6 100644 --- a/PhysicsAnalysis/PrimaryDPDMaker/share/PerfDESDM_MS.py +++ b/PhysicsAnalysis/PrimaryDPDMaker/share/PerfDESDM_MS.py @@ -34,7 +34,7 @@ from OutputStreamAthenaPool.MultipleStreamManager import MSMgr ##==================================================================== if rec.OutputLevel() <= DEBUG: muonDPDStream_msg.info('Values of all PerfDESDM_MS flags:') - print primDPDAlignTrigMu + print(primDPDAlignTrigMu) pass # ============================================================================ @@ -86,18 +86,18 @@ MuonNoAlgTrig_TriggerSkimmingTool = DerivationFramework__TriggerSkimmingTool( "HLT_noalg_L1MU11","HLT_noalg_L1MU15","HLT_noalg_L1MU20", "HLT_noalg_L12MU4","HLT_noalg_L12MU6","HLT_noalg_L12MU10"] ) ToolSvc += MuonNoAlgTrig_TriggerSkimmingTool -print MuonNoAlgTrig_TriggerSkimmingTool +print(MuonNoAlgTrig_TriggerSkimmingTool) MuonNoAlgTrig_PrescaleSkimmingTool = DerivationFramework__PrescaleTool ( name = "MuonNoAlgTrig_PrescaleSkimmingTool", Prescale = 1) ToolSvc += MuonNoAlgTrig_PrescaleSkimmingTool -print MuonNoAlgTrig_PrescaleSkimmingTool +print(MuonNoAlgTrig_PrescaleSkimmingTool) MuonNoAlgTrig_EventSkimmingTool = DerivationFramework__FilterCombinationAND(name="MuonNoAlgTrig_EventSkimmingTool",FilterList=[MuonNoAlgTrig_TriggerSkimmingTool, MuonNoAlgTrig_PrescaleSkimmingTool]) ToolSvc += MuonNoAlgTrig_EventSkimmingTool -print MuonNoAlgTrig_EventSkimmingTool +print(MuonNoAlgTrig_EventSkimmingTool) # ------------------------------------------------ # Orthogonal triggers (RPC needs) @@ -122,7 +122,7 @@ ideta|smooth)_(HLTCalo|iloose|L1EM[0-9]*VH|L1EM[0-9]*)", "HLT_mb.*"] ) ToolSvc += OrthoTrig_TriggerSkimmingTool -print OrthoTrig_TriggerSkimmingTool +print(OrthoTrig_TriggerSkimmingTool) # ------------------------------------------------ # Offline orthogonal trigger selection (low pT) @@ -130,17 +130,17 @@ print OrthoTrig_TriggerSkimmingTool OrthoTrig_LowpTMuonEventStringSkimmingTool = DerivationFramework__xAODStringSkimmingTool(name = "OrthoTrig_LowpTMuonEventStringSkimmingTool", expression = "(count(Muons.muonType == 0 && Muons.pt > 4*GeV && Muons.pt < 15*GeV) > 0)") ToolSvc += OrthoTrig_LowpTMuonEventStringSkimmingTool -print OrthoTrig_LowpTMuonEventStringSkimmingTool +print(OrthoTrig_LowpTMuonEventStringSkimmingTool) OrthoTrig_LowpTMuonPrescaleSkimmingTool = DerivationFramework__PrescaleTool( name = "OrthoTrig_LowpTMuonPrescaleSkimmingTool", Prescale = 10) ToolSvc += OrthoTrig_LowpTMuonPrescaleSkimmingTool -print OrthoTrig_LowpTMuonPrescaleSkimmingTool +print(OrthoTrig_LowpTMuonPrescaleSkimmingTool) OrthoTrig_LowpTMuonEventSkimmingTool = DerivationFramework__FilterCombinationAND(name="OrthoTrig_LowpTMuonEventSkimmingTool",FilterList=[OrthoTrig_LowpTMuonEventStringSkimmingTool, OrthoTrig_LowpTMuonPrescaleSkimmingTool]) ToolSvc += OrthoTrig_LowpTMuonEventSkimmingTool -print OrthoTrig_LowpTMuonEventSkimmingTool +print(OrthoTrig_LowpTMuonEventSkimmingTool) # ------------------------------------------------ # Offline orthogonal trigger selection (mid pT) @@ -149,17 +149,17 @@ OrthoTrig_MidpTMuonEventStringSkimmingTool = DerivationFramework__xAODStringSkim expression = "(count(Muons.muonType == 0 && Muons.pt >= 15*GeV) > 0)") ToolSvc += OrthoTrig_MidpTMuonEventStringSkimmingTool -print OrthoTrig_MidpTMuonEventStringSkimmingTool +print(OrthoTrig_MidpTMuonEventStringSkimmingTool) OrthoTrig_MidpTMuonPrescaleSkimmingTool = DerivationFramework__PrescaleTool ( name = "OrthoTrig_MidpTMuonPrescaleSkimmingTool", Prescale = 1) ToolSvc += OrthoTrig_MidpTMuonPrescaleSkimmingTool -print OrthoTrig_MidpTMuonPrescaleSkimmingTool +print(OrthoTrig_MidpTMuonPrescaleSkimmingTool) OrthoTrig_MidpTMuonEventSkimmingTool = DerivationFramework__FilterCombinationAND(name="OrthoTrig_MidpTMuonEventSkimmingTool",FilterList=[OrthoTrig_MidpTMuonEventStringSkimmingTool, OrthoTrig_MidpTMuonPrescaleSkimmingTool]) ToolSvc += OrthoTrig_MidpTMuonEventSkimmingTool -print OrthoTrig_MidpTMuonEventSkimmingTool +print(OrthoTrig_MidpTMuonEventSkimmingTool) # ------------------------------------------------ # Ortho trig events accepted if there is: @@ -168,12 +168,12 @@ print OrthoTrig_MidpTMuonEventSkimmingTool OrthoTrig_pTMuonEventSkimmingTool=DerivationFramework__FilterCombinationOR(name="OrthoTrig_pTMuonEventSkimmingTool",FilterList=[OrthoTrig_LowpTMuonEventSkimmingTool, OrthoTrig_MidpTMuonEventSkimmingTool]) ToolSvc += OrthoTrig_pTMuonEventSkimmingTool -print OrthoTrig_pTMuonEventSkimmingTool +print(OrthoTrig_pTMuonEventSkimmingTool) OrthoTrig_EventSkimmingTool=DerivationFramework__FilterCombinationAND(name="OrthoTrig_EventSkimmingTool",FilterList=[OrthoTrig_pTMuonEventSkimmingTool, OrthoTrig_TriggerSkimmingTool]) ToolSvc += OrthoTrig_EventSkimmingTool -print OrthoTrig_EventSkimmingTool +print(OrthoTrig_EventSkimmingTool) # ------------------------------------------------ # JPsi Trigger selection @@ -184,12 +184,12 @@ JPsiTrig_TriggerSkimmingTool = DerivationFramework__TriggerSkimmingTool( name "HLT_mu6_bJpsi_Trkloose", "HLT_mu18_bJpsi_Trkloose", "HLT_mu4_bJpsi_Trkloose", "HLT_mu20_msonly_mu6noL1_msonly_nscan05"] ) ToolSvc += JPsiTrig_TriggerSkimmingTool -print JPsiTrig_TriggerSkimmingTool +print(JPsiTrig_TriggerSkimmingTool) JPsiTrig_PrescaleSkimmingTool = DerivationFramework__PrescaleTool( name = "JPsiTrig_PrescaleSkimmingTool", Prescale = 2) ToolSvc += JPsiTrig_PrescaleSkimmingTool -print JPsiTrig_PrescaleSkimmingTool +print(JPsiTrig_PrescaleSkimmingTool) # ------------------------------------------------ # Jpsi trig events accepted if there is: @@ -197,7 +197,7 @@ print JPsiTrig_PrescaleSkimmingTool JpsiTrig_EventSkimmingTool = DerivationFramework__FilterCombinationAND(name="JpsiTrig_EventSkimmingTool",FilterList=[JPsiTrig_PrescaleSkimmingTool, JPsiTrig_TriggerSkimmingTool]) ToolSvc += JpsiTrig_EventSkimmingTool -print JpsiTrig_EventSkimmingTool +print(JpsiTrig_EventSkimmingTool) # ------------------------------------------------ #For TGC, Muon HLT triggers: @@ -207,51 +207,51 @@ MuonHLTTrig_TriggerSkimmingTool = DerivationFramework__TriggerSkimmingTool( na TriggerListOR = ["HLT_mu.*"] ) ToolSvc += MuonHLTTrig_TriggerSkimmingTool -print MuonHLTTrig_TriggerSkimmingTool +print(MuonHLTTrig_TriggerSkimmingTool) # ------------------------------------------------ # Dimuon selection MuonHLTTrig_DiMuonEventStringSkimmingTool = DerivationFramework__xAODStringSkimmingTool(name = "MuonHLTTrig_DiMuonEventStringSkimmingTool", expression = "( (count(Muons.muonType == 0 && Muons.pt > 25*GeV) > 0) && (count(Muons.muonType == 0 && Muons.pt > 10*GeV) > 1) )") ToolSvc += MuonHLTTrig_DiMuonEventStringSkimmingTool -print MuonHLTTrig_DiMuonEventStringSkimmingTool +print(MuonHLTTrig_DiMuonEventStringSkimmingTool) MuonHLTTrig_DiMuonEventPrescaleSkimmingTool = DerivationFramework__PrescaleTool( name = "MuonHLTTrig_DiMuonEventPrescaleSkimmingTool", Prescale = 1) ToolSvc += MuonHLTTrig_DiMuonEventPrescaleSkimmingTool -print MuonHLTTrig_DiMuonEventPrescaleSkimmingTool +print(MuonHLTTrig_DiMuonEventPrescaleSkimmingTool) MuonHLTTrig_DiMuonEventSkimmingTool = DerivationFramework__FilterCombinationAND(name="MuonHLTTrig_DiMuonEventSkimmingTool",FilterList=[MuonHLTTrig_DiMuonEventStringSkimmingTool,\ MuonHLTTrig_DiMuonEventPrescaleSkimmingTool]) ToolSvc += MuonHLTTrig_DiMuonEventSkimmingTool -print MuonHLTTrig_DiMuonEventSkimmingTool +print(MuonHLTTrig_DiMuonEventSkimmingTool) # ------------------------------------------------ # Mid pT muon selection MuonHLTTrig_MidpTEventStringSkimmingTool = DerivationFramework__xAODStringSkimmingTool(name = "MuonHLTTrig_MidpTEventStringSkimmingTool", expression = "(count(Muons.muonType == 0 && Muons.pt > 25*GeV) > 0)") ToolSvc += MuonHLTTrig_MidpTEventStringSkimmingTool -print MuonHLTTrig_MidpTEventStringSkimmingTool +print(MuonHLTTrig_MidpTEventStringSkimmingTool) MuonHLTTrig_MidpTMuonPrescaleSkimmingTool = DerivationFramework__PrescaleTool( name = "MuonHLTTrig_MidpTMuonPrescaleSkimmingTool", Prescale = 2) #okay with 2 ToolSvc += MuonHLTTrig_MidpTMuonPrescaleSkimmingTool -print MuonHLTTrig_MidpTMuonPrescaleSkimmingTool +print(MuonHLTTrig_MidpTMuonPrescaleSkimmingTool) MuonHLTTrig_MidpTMuonEventSkimmingTool=DerivationFramework__FilterCombinationAND(name="MuonHLTTrig_MidpTMuonEventSkimmingTool",FilterList=[MuonHLTTrig_MidpTEventStringSkimmingTool, MuonHLTTrig_MidpTMuonPrescaleSkimmingTool]) ToolSvc += MuonHLTTrig_MidpTMuonEventSkimmingTool -print MuonHLTTrig_MidpTMuonEventSkimmingTool +print(MuonHLTTrig_MidpTMuonEventSkimmingTool) # ------------------------------------------------ # Muon HLT selection with combined logic MuonHLTTrig_pTMuonEventSkimmingTool=DerivationFramework__FilterCombinationOR(name="MuonHLTTrig_pTMuonEventSkimmingTool",FilterList=[MuonHLTTrig_MidpTMuonEventSkimmingTool, MuonHLTTrig_DiMuonEventSkimmingTool]) ToolSvc += MuonHLTTrig_pTMuonEventSkimmingTool -print MuonHLTTrig_pTMuonEventSkimmingTool +print(MuonHLTTrig_pTMuonEventSkimmingTool) MuonHLTTrig_EventSkimmingTool=DerivationFramework__FilterCombinationAND(name="MuonHLTTrig_EventSkimmingTool",FilterList=[MuonHLTTrig_pTMuonEventSkimmingTool, MuonHLTTrig_TriggerSkimmingTool]) ToolSvc += MuonHLTTrig_EventSkimmingTool -print MuonHLTTrig_EventSkimmingTool +print(MuonHLTTrig_EventSkimmingTool) # ================================================ # ------------------------------------------------ @@ -264,7 +264,7 @@ if primDPDAlignTrigMu.doAlignmentFormat(): expression = "(count(Muons.muonType == 0 && Muons.pt > 5*GeV) > 0)") ToolSvc += AlignmentEventStringSkimmingTool - print AlignmentEventStringSkimmingTool + print(AlignmentEventStringSkimmingTool) desdAlignmentTriggerMuonSequence+=CfgMgr.DerivationFramework__DerivationKernel("EventSkimmingKernel", SkimmingTools=[AlignmentEventStringSkimmingTool]) else: @@ -283,7 +283,7 @@ if hasMuons: filAlg_CT=muonTrkTrackThinTool("muonTrkTrackThinTool_CT", TrackCollectionKey = "CombinedMuonTracks") desdAlignmentTriggerMuonSequence+=filAlg_CT pass -print topSequence +print(topSequence) ##==================================================================== ## Define this Muon DPD output stream diff --git a/PhysicsAnalysis/PrimaryDPDMaker/share/PerfDESDM_TILEMU.py b/PhysicsAnalysis/PrimaryDPDMaker/share/PerfDESDM_TILEMU.py index 085cc497eae4bab929cd984c6bc50ee9692cbe1f..72bfad7160453ee7e7a662e2150f85aa2db1056e 100644 --- a/PhysicsAnalysis/PrimaryDPDMaker/share/PerfDESDM_TILEMU.py +++ b/PhysicsAnalysis/PrimaryDPDMaker/share/PerfDESDM_TILEMU.py @@ -1,199 +1,199 @@ -##---------------------------------------------------------------------- -## Name: PerfDESDM_TILEMU.py -## -## Author: Tomoe Kishimoto -## Email: Tomoe.Kishimoto@cern.ch -## -## Description: This defines the content of the commissioning stream for -## Tile-Muon trigger -## -##---------------------------------------------------------------------- - -# If this file is already included, don't include it again -include.block("PrimaryDPDMaker/PerfDESDM_TILEMU.py") - -## for messaging -from AthenaCommon.Logging import logging -muonDPDStream_msg = logging.getLogger( 'PerfDESDM_TILEMUStream' ) - -## Import the module that allows to use named units, e.g. GeV -import AthenaCommon.SystemOfUnits as Units - -## Include the job property flags for this package -from PrimaryDPDMaker.PrimaryDPDFlags import primDPD -from PrimaryDPDMaker.PrimaryDPDHelpers import buildFileName -from RecExConfig.RecFlags import rec - -## Include the job property flags for this package -from PrimaryDPDMaker.PrimaryDESDMFlags_TileMu import primDESDMTileMu - -## This handels multiple output streams -from OutputStreamAthenaPool.MultipleStreamManager import MSMgr - -##====================================================================== -## Write the used options to the log file -##====================================================================== -if rec.OutputLevel() <= DEBUG: - muonDPDStream_msg.info('Values of all PerfDESDM_TileMu flags:') - print primDESDMTileMu - pass - -# ====================================================================== -# Create a sub-sequence where all needed algorithms will run in -# ====================================================================== -import AthenaCommon.CfgMgr as CfgMgr -desdTileMuonSequence = CfgMgr.AthSequencer('DESDM_TILEMU_Sequence', - StopOverride = True ) -topSequence += desdTileMuonSequence - -##====================================================================== -## Define the skimming for the DESDM_TILEMU output stream -##====================================================================== -from PrimaryDPDMaker.LogicalFilterCombiner import LogicalFilterCombiner -from PrimaryDPDMaker.PrimaryDPDMakerConf import PrimaryDPDPrescaler - -from RecExConfig.ObjKeyStore import objKeyStore -muonDPDStream_msg.debug("Items in objKeyStore[transient]: %s" % - objKeyStore['transient'].list() ) - -# ---------------------------------------------------------------------- -# String based reduction -# ---------------------------------------------------------------------- -from DerivationFrameworkTools.DerivationFrameworkToolsConf import DerivationFramework__xAODStringSkimmingTool -from DerivationFrameworkTools.DerivationFrameworkToolsConf import DerivationFramework__FilterCombinationOR -from DerivationFrameworkTools.DerivationFrameworkToolsConf import DerivationFramework__FilterCombinationAND -from DerivationFrameworkCore.DerivationFrameworkCoreConf import DerivationFramework__DerivationKernel - -# ---------------------------------------------------------------------- -# Muon HLT triggers: -# ---------------------------------------------------------------------- -from DerivationFrameworkTools.DerivationFrameworkToolsConf import DerivationFramework__TriggerSkimmingTool -TileMuTriggerSkimmingTool = DerivationFramework__TriggerSkimmingTool(name = "TileMuTriggerSkimmingTool", - TriggerListOR = ["HLT_mu.*"] ) - -ToolSvc += TileMuTriggerSkimmingTool -print TileMuTriggerSkimmingTool - -# ---------------------------------------------------------------------- -# Muon selection -# ---------------------------------------------------------------------- -muon_type = '(Muons.muonType == 0)' -muon_pt = '(Muons.pt > 13*GeV)' -muon_eta = '((abs(Muons.eta) < 1.5) && (abs(Muons.eta) > 0.8))' - -muon_expression = '(count('+muon_type+' && '+muon_pt+' && '+muon_eta+') > 0)' - -TileMuEventSkimmingTool = DerivationFramework__xAODStringSkimmingTool(name = "TileMuEventSkimmingTool", - expression = muon_expression) - -ToolSvc += TileMuEventSkimmingTool -print TileMuEventSkimmingTool - -# ---------------------------------------------------------------------- -# Final logical selection -# ---------------------------------------------------------------------- -TileMuEventFilterTool = DerivationFramework__FilterCombinationAND(name="TileMuEventFilterTool", - FilterList=[TileMuTriggerSkimmingTool, TileMuEventSkimmingTool]) - -ToolSvc += TileMuEventFilterTool -print TileMuEventFilterTool - - -##====================================================================== -## Define the thinning for the DESDM_TILEMU output stream -##====================================================================== -from CaloRec.CaloRecConf import CaloThinCellsBySamplingAlg -TileMuCaloCellThinningAlg = CaloThinCellsBySamplingAlg \ - ('TileMuCaloCellThinningAlg', - StreamName = primDPD.WriteDESDM_TILEMUStream.StreamName, - Cells = 'AllCalo', - SamplingCellsName = ['TileBar0', 'TileBar1', 'TileBar2', # Tile cells - 'TileGap1', 'TileGap1', 'TileGap3', - 'TileExt0', 'TileExt1', 'TileExt2', - ]) -desdTileMuonSequence += TileMuCaloCellThinningAlg - -from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__MuonTrackParticleThinning -TileMuMuonTPThinningTool = DerivationFramework__MuonTrackParticleThinning(name = "TileMuMuonTPThinningTool", - StreamName = primDPD.WriteDESDM_TILEMUStream.StreamName, - MuonKey = "Muons", - InDetTrackParticlesKey = "InDetTrackParticles") -ToolSvc += TileMuMuonTPThinningTool - - -##====================================================================== -## CREATE THE DERIVATION KERNEL ALGORITHM AND PASS THE ABOVE TOOLS -##====================================================================== -desdTileMuonSequence += CfgMgr.DerivationFramework__DerivationKernel("TileMuKernel", - SkimmingTools = [TileMuEventFilterTool], - ThinningTools = [TileMuMuonTPThinningTool]) - -##====================================================================== -## Define this Muon DPD output stream -##====================================================================== -streamName = primDPD.WriteDESDM_TILEMUStream.StreamName -fileName = buildFileName( primDPD.WriteDESDM_TILEMUStream ) -algsToBookkeep = [] - -if primDPD.WriteDESDM_TILEMUStream.isVirtual or primDPD.isVirtual() : - TileMuStream = MSMgr.NewVirtualStream( streamName, fileName ) - pass -else: - TileMuStream = MSMgr.NewPoolStream( streamName, fileName ) - # Add the per-event bookkeeping - TileMuStream.AddOtherAlgsToBookkeep( algsToBookkeep ) - pass - -if primDESDMTileMu.ApplySkimming(): - TileMuStream.AcceptAlgs(["TileMuKernel"]) - pass - -augStream = MSMgr.GetStream(streamName) -evtStream = augStream.GetEventStream() - -#----------------------------------------------------------------------- -# Add the containers to the output stream -#----------------------------------------------------------------------- -from PrimaryDPDMaker import PrimaryDPD_OutputDefinitions as dpdOutput -ExcludeList=[] - -#dpdOutput.addAllItemsFromInputExceptExcludeList(streamName,ExcludeList) - -trackParticleAuxExclusions="-caloExtension.-cellAssociation.-clusterAssociation.-trackParameterCovarianceMatrices.-parameterX.-parameterY.-parameterZ.-parameterPX.-parameterPY.-parameterPZ.-parameterPosition" - - -TileMuStream.AddItem(["xAOD::EventInfo#*"]) -TileMuStream.AddItem(["xAOD::EventAuxInfo#*"]) - -TileMuStream.AddItem(["xAOD::MuonContainer#Muons"]) -TileMuStream.AddItem(["xAOD::MuonAuxContainer#MuonsAux."]) - -TileMuStream.AddItem(["xAOD::TrigNavigation#TrigNavigation"]) -TileMuStream.AddItem(["xAOD::TrigNavigationAuxInfo#TrigNavigationAux."]) -TileMuStream.AddItem(["xAOD::TrigDecision#xTrigDecision"]) -TileMuStream.AddItem(["xAOD::TrigDecisionAuxInfo#xTrigDecisionAux."]) - -TileMuStream.AddItem(["xAOD::MuonRoIContainer#LVL1MuonRoIs"]) -TileMuStream.AddItem(["xAOD::MuonRoIAuxContainer#LVL1MuonRoIsAux."]) -TileMuStream.AddItem(["MuCTPI_RDO#MUCTPI_RDO"]) - -TileMuStream.AddItem(["Muon::TgcCoinDataContainer#TrigT1CoinDataCollectionPriorBC"]) -TileMuStream.AddItem(["Muon::TgcCoinDataContainer#TrigT1CoinDataCollectionNextBC"]) -TileMuStream.AddItem(["Muon::TgcCoinDataContainer#TrigT1CoinDataCollection"]) - -TileMuStream.AddItem(["TileDigitsContainer#MuRcvDigitsCnt"]) -TileMuStream.AddItem(["TileRawChannelContainer#MuRcvRawChCnt"]) -TileMuStream.AddItem(["TileMuonReceiverContainer#TileMuRcvCnt"]) -TileMuStream.AddItem(["CaloCellContainer#AllCalo"]) - -TileMuStream.AddItem(["xAOD::MuonContainer#HLT_xAOD__MuonContainer_MuonEFInfo"]) -TileMuStream.AddItem(["xAOD::MuonAuxContainer#HLT_xAOD__MuonContainer_MuonEFInfoAux."]) - -TileMuStream.AddItem(["xAOD::TrackParticleContainer#MuonSpectrometerTrackParticles"]) -TileMuStream.AddItem(["xAOD::TrackParticleAuxContainer#MuonSpectrometerTrackParticlesAux."+trackParticleAuxExclusions]) -TileMuStream.AddItem(["xAOD::TrackParticleContainer#CombinedMuonTrackParticles"]) -TileMuStream.AddItem(["xAOD::TrackParticleAuxContainer#CombinedMuonTrackParticlesAux."+trackParticleAuxExclusions]) -TileMuStream.AddItem(["xAOD::TrackParticleContainer#ExtrapolatedMuonTrackParticles"]) -TileMuStream.AddItem(["xAOD::TrackParticleAuxContainer#ExtrapolatedMuonTrackParticlesAux."+trackParticleAuxExclusions]) -TileMuStream.AddItem(["xAOD::TrackParticleContainer#InDetTrackParticles"]) -TileMuStream.AddItem(["xAOD::TrackParticleAuxContainer#InDetTrackParticlesAux."+trackParticleAuxExclusions]) +##---------------------------------------------------------------------- +## Name: PerfDESDM_TILEMU.py +## +## Author: Tomoe Kishimoto +## Email: Tomoe.Kishimoto@cern.ch +## +## Description: This defines the content of the commissioning stream for +## Tile-Muon trigger +## +##---------------------------------------------------------------------- + +# If this file is already included, don't include it again +include.block("PrimaryDPDMaker/PerfDESDM_TILEMU.py") + +## for messaging +from AthenaCommon.Logging import logging +muonDPDStream_msg = logging.getLogger( 'PerfDESDM_TILEMUStream' ) + +## Import the module that allows to use named units, e.g. GeV +import AthenaCommon.SystemOfUnits as Units + +## Include the job property flags for this package +from PrimaryDPDMaker.PrimaryDPDFlags import primDPD +from PrimaryDPDMaker.PrimaryDPDHelpers import buildFileName +from RecExConfig.RecFlags import rec + +## Include the job property flags for this package +from PrimaryDPDMaker.PrimaryDESDMFlags_TileMu import primDESDMTileMu + +## This handels multiple output streams +from OutputStreamAthenaPool.MultipleStreamManager import MSMgr + +##====================================================================== +## Write the used options to the log file +##====================================================================== +if rec.OutputLevel() <= DEBUG: + muonDPDStream_msg.info('Values of all PerfDESDM_TileMu flags:') + print(primDESDMTileMu) + pass + +# ====================================================================== +# Create a sub-sequence where all needed algorithms will run in +# ====================================================================== +import AthenaCommon.CfgMgr as CfgMgr +desdTileMuonSequence = CfgMgr.AthSequencer('DESDM_TILEMU_Sequence', + StopOverride = True ) +topSequence += desdTileMuonSequence + +##====================================================================== +## Define the skimming for the DESDM_TILEMU output stream +##====================================================================== +from PrimaryDPDMaker.LogicalFilterCombiner import LogicalFilterCombiner +from PrimaryDPDMaker.PrimaryDPDMakerConf import PrimaryDPDPrescaler + +from RecExConfig.ObjKeyStore import objKeyStore +muonDPDStream_msg.debug("Items in objKeyStore[transient]: %s" % + objKeyStore['transient'].list() ) + +# ---------------------------------------------------------------------- +# String based reduction +# ---------------------------------------------------------------------- +from DerivationFrameworkTools.DerivationFrameworkToolsConf import DerivationFramework__xAODStringSkimmingTool +from DerivationFrameworkTools.DerivationFrameworkToolsConf import DerivationFramework__FilterCombinationOR +from DerivationFrameworkTools.DerivationFrameworkToolsConf import DerivationFramework__FilterCombinationAND +from DerivationFrameworkCore.DerivationFrameworkCoreConf import DerivationFramework__DerivationKernel + +# ---------------------------------------------------------------------- +# Muon HLT triggers: +# ---------------------------------------------------------------------- +from DerivationFrameworkTools.DerivationFrameworkToolsConf import DerivationFramework__TriggerSkimmingTool +TileMuTriggerSkimmingTool = DerivationFramework__TriggerSkimmingTool(name = "TileMuTriggerSkimmingTool", + TriggerListOR = ["HLT_mu.*"] ) + +ToolSvc += TileMuTriggerSkimmingTool +print(TileMuTriggerSkimmingTool) + +# ---------------------------------------------------------------------- +# Muon selection +# ---------------------------------------------------------------------- +muon_type = '(Muons.muonType == 0)' +muon_pt = '(Muons.pt > 13*GeV)' +muon_eta = '((abs(Muons.eta) < 1.5) && (abs(Muons.eta) > 0.8))' + +muon_expression = '(count('+muon_type+' && '+muon_pt+' && '+muon_eta+') > 0)' + +TileMuEventSkimmingTool = DerivationFramework__xAODStringSkimmingTool(name = "TileMuEventSkimmingTool", + expression = muon_expression) + +ToolSvc += TileMuEventSkimmingTool +print(TileMuEventSkimmingTool) + +# ---------------------------------------------------------------------- +# Final logical selection +# ---------------------------------------------------------------------- +TileMuEventFilterTool = DerivationFramework__FilterCombinationAND(name="TileMuEventFilterTool", + FilterList=[TileMuTriggerSkimmingTool, TileMuEventSkimmingTool]) + +ToolSvc += TileMuEventFilterTool +print(TileMuEventFilterTool) + + +##====================================================================== +## Define the thinning for the DESDM_TILEMU output stream +##====================================================================== +from CaloRec.CaloRecConf import CaloThinCellsBySamplingAlg +TileMuCaloCellThinningAlg = CaloThinCellsBySamplingAlg \ + ('TileMuCaloCellThinningAlg', + StreamName = primDPD.WriteDESDM_TILEMUStream.StreamName, + Cells = 'AllCalo', + SamplingCellsName = ['TileBar0', 'TileBar1', 'TileBar2', # Tile cells + 'TileGap1', 'TileGap1', 'TileGap3', + 'TileExt0', 'TileExt1', 'TileExt2', + ]) +desdTileMuonSequence += TileMuCaloCellThinningAlg + +from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__MuonTrackParticleThinning +TileMuMuonTPThinningTool = DerivationFramework__MuonTrackParticleThinning(name = "TileMuMuonTPThinningTool", + StreamName = primDPD.WriteDESDM_TILEMUStream.StreamName, + MuonKey = "Muons", + InDetTrackParticlesKey = "InDetTrackParticles") +ToolSvc += TileMuMuonTPThinningTool + + +##====================================================================== +## CREATE THE DERIVATION KERNEL ALGORITHM AND PASS THE ABOVE TOOLS +##====================================================================== +desdTileMuonSequence += CfgMgr.DerivationFramework__DerivationKernel("TileMuKernel", + SkimmingTools = [TileMuEventFilterTool], + ThinningTools = [TileMuMuonTPThinningTool]) + +##====================================================================== +## Define this Muon DPD output stream +##====================================================================== +streamName = primDPD.WriteDESDM_TILEMUStream.StreamName +fileName = buildFileName( primDPD.WriteDESDM_TILEMUStream ) +algsToBookkeep = [] + +if primDPD.WriteDESDM_TILEMUStream.isVirtual or primDPD.isVirtual() : + TileMuStream = MSMgr.NewVirtualStream( streamName, fileName ) + pass +else: + TileMuStream = MSMgr.NewPoolStream( streamName, fileName ) + # Add the per-event bookkeeping + TileMuStream.AddOtherAlgsToBookkeep( algsToBookkeep ) + pass + +if primDESDMTileMu.ApplySkimming(): + TileMuStream.AcceptAlgs(["TileMuKernel"]) + pass + +augStream = MSMgr.GetStream(streamName) +evtStream = augStream.GetEventStream() + +#----------------------------------------------------------------------- +# Add the containers to the output stream +#----------------------------------------------------------------------- +from PrimaryDPDMaker import PrimaryDPD_OutputDefinitions as dpdOutput +ExcludeList=[] + +#dpdOutput.addAllItemsFromInputExceptExcludeList(streamName,ExcludeList) + +trackParticleAuxExclusions="-caloExtension.-cellAssociation.-clusterAssociation.-trackParameterCovarianceMatrices.-parameterX.-parameterY.-parameterZ.-parameterPX.-parameterPY.-parameterPZ.-parameterPosition" + + +TileMuStream.AddItem(["xAOD::EventInfo#*"]) +TileMuStream.AddItem(["xAOD::EventAuxInfo#*"]) + +TileMuStream.AddItem(["xAOD::MuonContainer#Muons"]) +TileMuStream.AddItem(["xAOD::MuonAuxContainer#MuonsAux."]) + +TileMuStream.AddItem(["xAOD::TrigNavigation#TrigNavigation"]) +TileMuStream.AddItem(["xAOD::TrigNavigationAuxInfo#TrigNavigationAux."]) +TileMuStream.AddItem(["xAOD::TrigDecision#xTrigDecision"]) +TileMuStream.AddItem(["xAOD::TrigDecisionAuxInfo#xTrigDecisionAux."]) + +TileMuStream.AddItem(["xAOD::MuonRoIContainer#LVL1MuonRoIs"]) +TileMuStream.AddItem(["xAOD::MuonRoIAuxContainer#LVL1MuonRoIsAux."]) +TileMuStream.AddItem(["MuCTPI_RDO#MUCTPI_RDO"]) + +TileMuStream.AddItem(["Muon::TgcCoinDataContainer#TrigT1CoinDataCollectionPriorBC"]) +TileMuStream.AddItem(["Muon::TgcCoinDataContainer#TrigT1CoinDataCollectionNextBC"]) +TileMuStream.AddItem(["Muon::TgcCoinDataContainer#TrigT1CoinDataCollection"]) + +TileMuStream.AddItem(["TileDigitsContainer#MuRcvDigitsCnt"]) +TileMuStream.AddItem(["TileRawChannelContainer#MuRcvRawChCnt"]) +TileMuStream.AddItem(["TileMuonReceiverContainer#TileMuRcvCnt"]) +TileMuStream.AddItem(["CaloCellContainer#AllCalo"]) + +TileMuStream.AddItem(["xAOD::MuonContainer#HLT_xAOD__MuonContainer_MuonEFInfo"]) +TileMuStream.AddItem(["xAOD::MuonAuxContainer#HLT_xAOD__MuonContainer_MuonEFInfoAux."]) + +TileMuStream.AddItem(["xAOD::TrackParticleContainer#MuonSpectrometerTrackParticles"]) +TileMuStream.AddItem(["xAOD::TrackParticleAuxContainer#MuonSpectrometerTrackParticlesAux."+trackParticleAuxExclusions]) +TileMuStream.AddItem(["xAOD::TrackParticleContainer#CombinedMuonTrackParticles"]) +TileMuStream.AddItem(["xAOD::TrackParticleAuxContainer#CombinedMuonTrackParticlesAux."+trackParticleAuxExclusions]) +TileMuStream.AddItem(["xAOD::TrackParticleContainer#ExtrapolatedMuonTrackParticles"]) +TileMuStream.AddItem(["xAOD::TrackParticleAuxContainer#ExtrapolatedMuonTrackParticlesAux."+trackParticleAuxExclusions]) +TileMuStream.AddItem(["xAOD::TrackParticleContainer#InDetTrackParticles"]) +TileMuStream.AddItem(["xAOD::TrackParticleAuxContainer#InDetTrackParticlesAux."+trackParticleAuxExclusions]) diff --git a/PhysicsAnalysis/PrimaryDPDMaker/share/PerfDPD_EGamma.py b/PhysicsAnalysis/PrimaryDPDMaker/share/PerfDPD_EGamma.py index b0dcb559080a7a69dacf35de6fb0232b3ca03c9d..b576012a036352925d9bc92211b444dc5949467e 100644 --- a/PhysicsAnalysis/PrimaryDPDMaker/share/PerfDPD_EGamma.py +++ b/PhysicsAnalysis/PrimaryDPDMaker/share/PerfDPD_EGamma.py @@ -125,13 +125,13 @@ DESDM_EGAMMAJPsiTrigSkimmingTool = DerivationFramework__TriggerSkimmingTool( n ToolSvc += DESDM_EGAMMAJPsiTrigSkimmingTool -print DESDM_EGAMMAJPsiTrigSkimmingTool +print(DESDM_EGAMMAJPsiTrigSkimmingTool) # Final event selection filter : DESDM_EGAMMAEventFilterTool=DerivationFramework__FilterCombinationOR(name="DESDM_EGAMMAEventFilterTool",FilterList=[DESDM_EGAMMA_SkimmingTool,DESDM_EGAMMAJPsiTrigSkimmingTool]) ToolSvc+=DESDM_EGAMMAEventFilterTool -print DESDM_EGAMMAEventFilterTool +print(DESDM_EGAMMAEventFilterTool) # ================================================================================= # Agmentation starts here diff --git a/PhysicsAnalysis/PrimaryDPDMaker/share/PerfDPD_Jet.py b/PhysicsAnalysis/PrimaryDPDMaker/share/PerfDPD_Jet.py index 9e313a0f48c3d301a5076232f4f2bbb8b84ede36..da717197d28255526a76477bfa98326c5eb1f3cc 100644 --- a/PhysicsAnalysis/PrimaryDPDMaker/share/PerfDPD_Jet.py +++ b/PhysicsAnalysis/PrimaryDPDMaker/share/PerfDPD_Jet.py @@ -166,7 +166,7 @@ filter_list += TauCombTools DESDM_CALJET_ORTool = DerivationFramework__FilterCombinationOR( name="TauCalTauTool", FilterList=filter_list) ToolSvc += DESDM_CALJET_ORTool -print DESDM_CALJET_ORTool +print(DESDM_CALJET_ORTool) diff --git a/PhysicsAnalysis/PrimaryDPDMaker/share/PrimaryDPDMaker.py b/PhysicsAnalysis/PrimaryDPDMaker/share/PrimaryDPDMaker.py index 5e71b5fa94706ea23c1a3aaa84013921280ba7e0..cbe7e459f694b52b0c5179822d21ce23680c8f01 100644 --- a/PhysicsAnalysis/PrimaryDPDMaker/share/PrimaryDPDMaker.py +++ b/PhysicsAnalysis/PrimaryDPDMaker/share/PrimaryDPDMaker.py @@ -55,7 +55,7 @@ if len( primDPD.OutputDirectoryName() ) >= 1 and not primDPD.OutputDirectoryName if rec.OutputLevel() <= INFO: primaryDPD_msg.info('Values of all PrimaryDPD flags:') - print primDPD + print(primDPD) ##============================================================================= diff --git a/PhysicsAnalysis/PrimaryDPDMaker/share/aodtodpd.py b/PhysicsAnalysis/PrimaryDPDMaker/share/aodtodpd.py index 0278f478b855d87663f8e2e724e2acbe33085ec1..435cdfddb47ab96a04ea490be1b3a59a2a2531c3 100644 --- a/PhysicsAnalysis/PrimaryDPDMaker/share/aodtodpd.py +++ b/PhysicsAnalysis/PrimaryDPDMaker/share/aodtodpd.py @@ -33,7 +33,7 @@ rec.readRDO = False rec.DPDMakerScripts.append("PrimaryDPDMaker/PrimaryDPDMaker.py") ## Write the used options to the log file -print rec +print(rec) # The job starts here! include ("RecExCommon/RecExCommon_topOptions.py") diff --git a/PhysicsAnalysis/PrimaryDPDMaker/share/esdtodpd.py b/PhysicsAnalysis/PrimaryDPDMaker/share/esdtodpd.py index 4097329b490ba9368e8c0d8ebf7be77c18bd5dda..209cbd0324fdd8d69e2ad424303277a9fc1e4352 100644 --- a/PhysicsAnalysis/PrimaryDPDMaker/share/esdtodpd.py +++ b/PhysicsAnalysis/PrimaryDPDMaker/share/esdtodpd.py @@ -82,8 +82,8 @@ rec.readRDO = False rec.DPDMakerScripts.append("PrimaryDPDMaker/PrimaryDPDMaker.py") ## Write the used options to the log file -print AODFlags -print rec +print(AODFlags) +print(rec) # The job starts here! include ("RecExCommon/RecExCommon_topOptions.py") diff --git a/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/python/PrimaryDPDFlags_RPVLLStream.py b/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/python/PrimaryDPDFlags_RPVLLStream.py index 21050a2415a6fa0a60249ec0a4d1b550242e02d9..1ee10967382cfb7218348aba9aacab55e2106408 100644 --- a/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/python/PrimaryDPDFlags_RPVLLStream.py +++ b/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/python/PrimaryDPDFlags_RPVLLStream.py @@ -32,18 +32,18 @@ jobproperties.add_Container(PrimaryDPDFlags_RPVLLStream) primRPVLLDESDM=jobproperties.PrimaryDPDFlags_RPVLLStream -import DiLepFlags -import DVFlags -import KinkedTrackFlags -import EmergingFlags -import StoppedFlags -import VH_DVFlags -import QuirksFlags -import HipsFlags -import HNLFlags -import HVFlags -import SmpCaloIdFlags -import SmpMsFlags +from LongLivedParticleDPDMaker import DiLepFlags +from LongLivedParticleDPDMaker import DVFlags +from LongLivedParticleDPDMaker import KinkedTrackFlags +from LongLivedParticleDPDMaker import EmergingFlags +from LongLivedParticleDPDMaker import StoppedFlags +from LongLivedParticleDPDMaker import VH_DVFlags +from LongLivedParticleDPDMaker import QuirksFlags +from LongLivedParticleDPDMaker import HipsFlags +from LongLivedParticleDPDMaker import HNLFlags +from LongLivedParticleDPDMaker import HVFlags +from LongLivedParticleDPDMaker import SmpCaloIdFlags +from LongLivedParticleDPDMaker import SmpMsFlags #=============================================================== # Set specific properties for each of the analysis selections diff --git a/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/run/compileRPVLLRates.py b/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/run/compileRPVLLRates.py index 6713bdf2b65645eebcb30d3e512c94ca79428752..1fc61612877314a2439dad06bfb3b4e75d189264 100644 --- a/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/run/compileRPVLLRates.py +++ b/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/run/compileRPVLLRates.py @@ -150,7 +150,7 @@ for lb1 in first_line.split("._"): if "lb" in lb1: first_lb = int(lb1[2:]) current_lb = first_lb last_lb = 2500 # will change based on data in file -print "FIRST LB:", first_lb, current_lb +print("FIRST LB:", first_lb, current_lb) # initialize list to hold total number of processed events per lumiblock procEvents = [] @@ -192,10 +192,10 @@ procEvents.append(lbEventList[0]) ## RATE / EFFICIENCY CALCULATIONS ## totalEvents = eventList[0] totalRPVLLpass = eventList[nft-1] -print 'Events passing RPVLL filters:', totalRPVLLpass, 'out of', totalEvents -print 'RPVLL filter efficiency:', float(totalRPVLLpass)/float(totalEvents) * 100., '%' -print 'RPVLL normalized average rate: ', float(totalRPVLLpass)/float(totalEvents) * 1000., 'Hz' -print '' +print('Events passing RPVLL filters:', totalRPVLLpass, 'out of', totalEvents) +print('RPVLL filter efficiency:', float(totalRPVLLpass)/float(totalEvents) * 100., '%') +print('RPVLL normalized average rate: ', float(totalRPVLLpass)/float(totalEvents) * 1000., 'Hz') +print('') # calculate fraction of events passing each indidivual filter fracList_total = [0] * nf # fraction of ALL events passing filter @@ -203,36 +203,36 @@ fracList_RPVLL = [0] * nf # fraction of RPVLL events passing filter filterEvents = [0] * nf closureTest = 0 -print 'FRACTION OF (RPVLL | TOTAL) EVENTS PASSING EACH FILTER:' +print('FRACTION OF (RPVLL | TOTAL) EVENTS PASSING EACH FILTER:') for filterNo in range(0,nf): closureTest += eventList[filterNo*2+1] fracList_total[filterNo] = float(eventList[filterNo*2+1])/float(totalEvents) fracList_RPVLL[filterNo] = float(eventList[filterNo*2+1])/float(totalRPVLLpass) filterEvents[filterNo] = eventList[filterNo*2+1] if filterNo != n_aug: - print filterNames[filterNo], ' -- ', '%.2E' % Decimal(fracList_RPVLL[filterNo]), ' | ', '%.2E' % Decimal(fracList_total[filterNo]) -print '' + print(filterNames[filterNo], ' -- ', '%.2E' % Decimal(fracList_RPVLL[filterNo]), ' | ', '%.2E' % Decimal(fracList_total[filterNo])) +print('') -print 'NORMALIZED (to 1 kHz) AVERAGE FILTER RATE:' +print('NORMALIZED (to 1 kHz) AVERAGE FILTER RATE:') for filterNo in range(0,nf): if filterNo != n_aug: - print filterNames[filterNo], ' -- ', '%.2f' % (fracList_total[filterNo]*1000), 'Hz' -print '' + print(filterNames[filterNo], ' -- ', '%.2f' % (fracList_total[filterNo]*1000), 'Hz') +print('') # subtract away events corresponding to DVAugmentationKernel -- NOT A FILTER # closureTest_mAug will always be larger than totalRPVLLpass because of overlap # --> some RPVLL events will pass multiple filters and thus be added multiple times closureTest_mAug = closureTest - filterEvents[n_aug] -print 'Total number of events passing filters / total number of events passing RPVLL: ', closureTest_mAug, '/', totalRPVLLpass, '=', float(closureTest_mAug)/float(totalRPVLLpass) * 100., '%' -print '' +print('Total number of events passing filters / total number of events passing RPVLL: ', closureTest_mAug, '/', totalRPVLLpass, '=', float(closureTest_mAug)/float(totalRPVLLpass) * 100., '%') +print('') # printout for easy copy-paste into google spreadsheet for n in filterNames_mAug: - print n, -print '' + print(n,) +print('') for n in range(0,nf): - if n != n_aug: print filterEvents[n], -print '' + if n != n_aug: print(filterEvents[n],) +print('') @@ -258,7 +258,7 @@ for lineNo,line in enumerate(lbList): lbScaleHist.SetBinError(lbScaleHist.FindBin(float(line.split()[0])), 0) #print "TEST: ", line.split()[0], procEvents[l], scale[l], l, lineNo, len(procEvents) l += 1 -print '' +print('') ## DRAW + PRINT PLOTS ## diff --git a/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/run/compileRPVLLRates_emergingFilterTest.py b/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/run/compileRPVLLRates_emergingFilterTest.py index 039eb0f76560d404284123b59485fdbf47963593..70cc77a6fa49f404b2a2ea83b345e862aaf9ae17 100644 --- a/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/run/compileRPVLLRates_emergingFilterTest.py +++ b/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/run/compileRPVLLRates_emergingFilterTest.py @@ -140,11 +140,11 @@ filterNames_di_pt100 = [fn for fn in filterNames_pt100 if 'DiJet' in fn] emFilterList = [fn for fn in filterNames_pt100 if 'DiJet' not in fn] + [fn for fn in filterNames_pt120 if 'DiJet' not in fn] + [fn for fn in filterNames_pt130 if 'DiJet' not in fn] + [fn for fn in filterNames_pt140 if 'DiJet' not in fn] + [fn for fn in filterNames_pt150 if 'DiJet' not in fn] dijetFilterList = [fn for fn in filterNames_pt100 if 'DiJet' in fn] + [fn for fn in filterNames_pt120 if 'DiJet' in fn] + [fn for fn in filterNames_pt130 if 'DiJet' in fn] + [fn for fn in filterNames_pt140 if 'DiJet' in fn] + [fn for fn in filterNames_pt150 if 'DiJet' in fn] for i in emFilterList: - print i -print '' + print(i) +print('') for i in dijetFilterList: - print i -print '' + print(i) +print('') @@ -156,8 +156,8 @@ nft = nf*2+1 # number of lines per lumiblock ix_dv = filterNames.index('DVAugmentationKernel') ix_em = filterNames.index('EmergingFilterKernel') ix_dj = filterNames.index('EmergingDiJet110FilterKernel') -print nf, nft, ix_dv, ix_em, ix_dj -print '' +print(nf, nft, ix_dv, ix_em, ix_dj) +print('') @@ -269,10 +269,10 @@ procEvents.append(lbEventList[0]) ## RATE / EFFICIENCY CALCULATIONS ## totalEvents = eventList[0] totalRPVLLpass = eventList[nft-1] -print 'Events passing RPVLL filters: ', totalRPVLLpass, 'out of ', totalEvents -print 'RPVLL filter efficiency: ', float(totalRPVLLpass)/float(totalEvents) * 100., '%' -print 'RPVLL normalized average rate: ', float(totalRPVLLpass)/float(totalEvents) * 1000., 'Hz' -print '' +print('Events passing RPVLL filters: ', totalRPVLLpass, 'out of ', totalEvents) +print('RPVLL filter efficiency: ', float(totalRPVLLpass)/float(totalEvents) * 100., '%') +print('RPVLL normalized average rate: ', float(totalRPVLLpass)/float(totalEvents) * 1000., 'Hz') +print('') # calculate fraction of events passing each individual filter fracList_total = [0] * nf # fraction of ALL events passing filter @@ -280,7 +280,7 @@ fracList_RPVLL = [0] * nf # fraction of RPVLL events passing filter filterEvents = [0] * nf closureTest = 0 -print 'FRACTION OF (RPVLL | TOTAL) EVENTS PASSING EACH FILTER:' +print('FRACTION OF (RPVLL | TOTAL) EVENTS PASSING EACH FILTER:') for filterNo in range(0, nf): closureTest += eventList[filterNo*2+1] # add up all filter-passing events fracList_total[filterNo] = float(eventList[filterNo*2+1])/float(totalEvents) @@ -290,11 +290,11 @@ for filterNo in range(0, nf): # print filterNames[filterNo], ' -- ', '%.2E' % Decimal(fracList_RPVLL[filterNo]), ' | ', '%.2E' % Decimal(fracList_total[filterNo]) #print '' -print 'NORMALIZED (to 1 kHz) AVERAGE FILTER RATE:' +print('NORMALIZED (to 1 kHz) AVERAGE FILTER RATE:') for filterNo in range(0, nf): if filterNo != ix_dv: - print filterNames[filterNo], ' -- ', '%.2f' % (fracList_total[filterNo]*1000), 'Hz' -print '' + print(filterNames[filterNo], ' -- ', '%.2f' % (fracList_total[filterNo]*1000), 'Hz') +print('') ## subtract away events corresponding to DVAugmentationKernel -- NOT A FILTER ## closureTest_mAug will always be larger than totalRPVLLpass because of overlap @@ -325,7 +325,7 @@ for lineNo,line in enumerate(lbList): if (float(line.split()[0]) >= first_lb and float(line.split()[0]) <= last_lb): lbEventHist.Fill(float(line.split()[0]), procEvents[l]) lbEventHist.SetBinError(lbEventHist.FindBin(float(line.split()[0])), 0) - if (len(line.split()) > 3: + if (len(line.split()) > 3): lbFullEventHist.Fill(float(line.split()[0]), float(line.split()[3])) lbFullEventHist.SetBinError(lbFullEventHist.FindBin(float(line.split()[0])), 0) scale.append(float(line.split()[3])/float(procEvents[l])) @@ -334,9 +334,9 @@ for lineNo,line in enumerate(lbList): scale.append(1) lbScaleHist.Fill(float(line.split()[0]), scale[l]) lbScaleHist.SetBinError(lbScaleHist.FindBin(float(line.split()[0])), 0) - print line.split()[0], procEvents[l], line.split()[3], scale[l] + print(line.split()[0], procEvents[l], line.split()[3], scale[l]) l += 1 -print '' +print('') diff --git a/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/run/readFiles.py b/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/run/readFiles.py index aa9041bac07a9d7dff2e4e166a1798cd25299001..dd01e375d863457ca7426380f0578168efb6ccbf 100644 --- a/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/run/readFiles.py +++ b/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/run/readFiles.py @@ -14,7 +14,7 @@ mypath = sys.argv[2] # get list of log files w/in directory passed as argument onlyfiles = [f for f in listdir(mypath) if isfile(join(mypath, f))] -print 'About to loop through files!' +print('About to loop through files!') for f in onlyfiles: badName = False #sometimes ls files from mounted eos gives funny results. This should fix that! @@ -25,7 +25,7 @@ for f in onlyfiles: openFile = open(mypath+'.'.join(f.split('.')[3:16])) else: openFile = open(mypath+f) - print f + print(f) for line in openFile: # changed from 'RAWtoESD' to 'RAWtoALL' in R21 if re.match('RAWtoALL.*RPVLL.*Events',line) or re.match('RAWtoALL.*BSESOutputSvcStreamDRAW_RPVLL.*events',line): diff --git a/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/run/readGridFiles.py b/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/run/readGridFiles.py index 602e5b758d042fbb0011f82c60d3f626644c45fe..1811fd0e0e3f08d565e07553294b52e669ff4593 100644 --- a/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/run/readGridFiles.py +++ b/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/run/readGridFiles.py @@ -20,7 +20,7 @@ tgzs = [t for t in listdir(mypath) if isfile(join(mypath, t))] os.chdir(mypath) # loop through tarballs and untar -print 'About to loop through tarballs!' +print('About to loop through tarballs!') for t in tgzs: tar = tarfile.open(t, "r:gz") tar.extractall() diff --git a/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/share/LongLivedParticleDPDMaker.py b/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/share/LongLivedParticleDPDMaker.py index 3a177744d23734932b951ff824eee1bc667049a3..78b9942bf5e8c8920ce6863aca35161f11191de8 100644 --- a/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/share/LongLivedParticleDPDMaker.py +++ b/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/share/LongLivedParticleDPDMaker.py @@ -48,7 +48,7 @@ if len( llDPD.OutputDirectoryName() ) >= 1 and not llDPD.OutputDirectoryName().e if rec.OutputLevel() <= INFO: llDPD_msg.info('Values of all LongLivedDPD flags:') - print llDPD + print(llDPD) pass ##============================================================================= diff --git a/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/share/PhysDESDM_KinkedTrack.py b/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/share/PhysDESDM_KinkedTrack.py index d3053c4a4900a412dad2defed3d51621b88870a7..0adb6123512eb4f548c5092fbfbc69ddb0a60f96 100644 --- a/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/share/PhysDESDM_KinkedTrack.py +++ b/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/share/PhysDESDM_KinkedTrack.py @@ -68,7 +68,7 @@ KinkTrkSingleJetMetFilterTool = DerivationFramework__KinkTrkSingleJetMetFilterTo LeptonPtCut = primRPVLLDESDM.KinkedTrack_singleJetMetFilterFlags.leptonPtMax, LeptonEtaMax = primRPVLLDESDM.KinkedTrack_singleJetMetFilterFlags.leptonEtaMax) -print KinkTrkSingleJetMetFilterTool +print(KinkTrkSingleJetMetFilterTool) ToolSvc += KinkTrkSingleJetMetFilterTool @@ -102,7 +102,7 @@ KinkTrkMultiJetFilterTool = DerivationFramework__KinkTrkSingleJetMetFilterTool(n LeptonPtCut = primRPVLLDESDM.KinkedTrack_singleJetMetFilterFlags.leptonPtMax, LeptonEtaMax = primRPVLLDESDM.KinkedTrack_singleJetMetFilterFlags.leptonEtaMax) -print KinkTrkMultiJetFilterTool +print(KinkTrkMultiJetFilterTool) ToolSvc += KinkTrkMultiJetFilterTool @@ -136,7 +136,7 @@ KinkTrkStubletFilterTool = DerivationFramework__KinkTrkSingleJetMetFilterTool(na LeptonPtCut = primRPVLLDESDM.KinkedTrack_singleJetMetFilterFlags.leptonPtMax, LeptonEtaMax = primRPVLLDESDM.KinkedTrack_singleJetMetFilterFlags.leptonEtaMax) -print KinkTrkStubletFilterTool +print(KinkTrkStubletFilterTool) ToolSvc += KinkTrkStubletFilterTool KinkTrkStubletPrescaleTool = DerivationFramework__PrescaleTool(name = "KinkTrkStubletPrescaleTool", @@ -172,7 +172,7 @@ KinkTrkZeeTagTool = DerivationFramework__KinkTrkZeeTagTool(name DeltaPhiMax = primRPVLLDESDM.KinkedTrack_ZeeFilterFlags.deltaPhiMax, StoreGateKeyPrefix = "KinkTrk") -print KinkTrkZeeTagTool +print(KinkTrkZeeTagTool) ToolSvc += KinkTrkZeeTagTool from LongLivedParticleDPDMaker.LongLivedParticleDPDMakerConf import DerivationFramework__KinkTrkZmumuTagTool @@ -192,7 +192,7 @@ KinkTrkZmumuTagTool = DerivationFramework__KinkTrkZmumuTagTool(name = DeltaPhiMax = primRPVLLDESDM.KinkedTrack_ZmumuFilterFlags.deltaPhiMax, StoreGateKeyPrefix = "KinkTrk") -print KinkTrkZmumuTagTool +print(KinkTrkZmumuTagTool) ToolSvc += KinkTrkZmumuTagTool ## Kernel for the augmentation tools diff --git a/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/share/PhysDESDM_SmpCaloId.py b/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/share/PhysDESDM_SmpCaloId.py index d3fe39470f6e7df0c28cd99eb847e7afb386e27f..e350da9a2d16682c436b8375fd69d7be2b9d1ddc 100644 --- a/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/share/PhysDESDM_SmpCaloId.py +++ b/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/share/PhysDESDM_SmpCaloId.py @@ -130,7 +130,7 @@ for offlineFilterName in offlineObjectFilterNames : cmdstring += offlineFilterName offlineFilterCounter += 1 pass -print "NICK cmdstring of OfflineObjectFilter is ",cmdstring +print("NICK cmdstring of OfflineObjectFilter is ",cmdstring) topSequence.SmpCaloId_CombinedOfflineFilter.cmdstring=cmdstring filtersToBookkeep+=["SmpCaloId_CombinedOfflineFilter"] #=#=#=#= diff --git a/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/share/PhysDESDM_Stopped.py b/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/share/PhysDESDM_Stopped.py index 8e356407f6548a5c5d4c2828391b7b41e3af8583..699be2943aa33cc3af34cfd85a6fa509f2ee6aa7 100644 --- a/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/share/PhysDESDM_Stopped.py +++ b/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/share/PhysDESDM_Stopped.py @@ -110,7 +110,7 @@ cmdstring = jetFilterName+" and "+segFilterName; if primRPVLLDESDM.Stopped_muonSegmentFilterFlags.addPrescaledLooseFilter: cmdstring = jetFilterName+" and ("+segFilterName+" or "+prescaledMuSegFilterName+")" -print 'Josh\'s Stopped_CombinedOfflineFilter: %s' % cmdstring +print('Josh\'s Stopped_CombinedOfflineFilter: %s' % cmdstring) topSequence.Stopped_CombinedOfflineFilter.cmdstring=cmdstring filtersToBookkeep+=["Stopped_CombinedOfflineFilter"] diff --git a/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/share/PhysDRAW_RPVLL.py b/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/share/PhysDRAW_RPVLL.py index 5740a3d5e723870967276400d931cf9c4c07586f..4d6fbe44dbae4fd40c8085e6453b698b2423ca63 100644 --- a/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/share/PhysDRAW_RPVLL.py +++ b/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/share/PhysDRAW_RPVLL.py @@ -20,10 +20,10 @@ from LongLivedParticleDPDMaker.LongLivedDPDFlags import WriteRPVLLStream from LongLivedParticleDPDMaker.PrimaryDPDFlags_RPVLLStream import primRPVLLDESDM -print dir(primRPVLLDESDM) -print primRPVLLDESDM.__module__ -print primRPVLLDESDM.__name__ -print primRPVLLDESDM +print(dir(primRPVLLDESDM)) +print(primRPVLLDESDM.__module__) +print(primRPVLLDESDM.__name__) +print(primRPVLLDESDM) RPVLL_augmentationKernels = [] diff --git a/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/share/TestRPVLLRates_topOptions.py b/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/share/TestRPVLLRates_topOptions.py index ed9fa90d9c9ca60cdd7133bd3c564676f1bc37dc..7a7cfc21266f3403c8c9ed54bf3a73e58d328bb0 100755 --- a/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/share/TestRPVLLRates_topOptions.py +++ b/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/share/TestRPVLLRates_topOptions.py @@ -25,7 +25,7 @@ topSequence=AlgSequence() from LongLivedParticleDPDMaker.LongLivedParticleDPDMakerConf import RPVLLTestRates topSequence += RPVLLTestRates() -print topSequence.RPVLLTestRates +print(topSequence.RPVLLTestRates) from GaudiSvc.GaudiSvcConf import THistSvc ServiceMgr += THistSvc() diff --git a/Projects/Athena/package_filters.txt b/Projects/Athena/package_filters.txt index e4bfa72fa677aeb520df2040746d9f0216b176c7..5530f3b9e71993f334456547ea88cabe95ab926a 100644 --- a/Projects/Athena/package_filters.txt +++ b/Projects/Athena/package_filters.txt @@ -63,13 +63,3 @@ # Old packages that don't work with AthenaMT - LArCalorimeter/LArSim - PhysicsAnalysis/HiggsPhys/HSG5/HSG5DPDUtils - -# some MDT calibration tools which might be removed from athena, disable compilation -- MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibDbAsciiTool -- MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibTools -- MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibValidation -- MuonSpectrometer/MuonCalib/MuonCalibAlgs -- MuonSpectrometer/MuonCalib/MuonCalibJobTransforms -- MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg -- MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools -- MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools diff --git a/Reconstruction/HeavyIonRec/HIJetRec/CMakeLists.txt b/Reconstruction/HeavyIonRec/HIJetRec/CMakeLists.txt index 5cc125d1bad19068b0652c33738aabe4193bb941..0f6fbbb31b319bbab257654cd2f20e0a69c4d704 100644 --- a/Reconstruction/HeavyIonRec/HIJetRec/CMakeLists.txt +++ b/Reconstruction/HeavyIonRec/HIJetRec/CMakeLists.txt @@ -1,50 +1,23 @@ -# $Id: CMakeLists.txt 804522 2017-05-09 17:32:26Z angerami $ -################################################################################ -# Package: HIJetRec -################################################################################ +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration # Declare the package name: atlas_subdir( HIJetRec ) -# Declare the package's dependencies: -atlas_depends_on_subdirs( - PUBLIC - Control/AthToolSupport/AsgTools - Event/FourMomUtils - Event/xAOD/xAODBase - Event/xAOD/xAODCaloEvent - Event/xAOD/xAODHIEvent - Event/xAOD/xAODJet - Event/xAOD/xAODEventInfo - PhysicsAnalysis/HeavyIonPhys/HIEventUtils - Reconstruction/Jet/JetInterface - Reconstruction/Jet/JetRec - PRIVATE - Control/CxxUtils - Event/xAOD/xAODCore - Tools/PathResolver - Control/Navigation - Control/AthenaBaseComps - Event/NavFourMom - Calorimeter/CaloEvent - Calorimeter/CaloInterface - Calorimeter/CaloRec - Calorimeter/CaloUtils - GaudiKernel ) - # External dependencies: find_package( ROOT COMPONENTS Core MathCore Hist Physics ) # Component(s) in the package: +atlas_add_library( HIJetRecLib + HIJetRec/*.h + INTERFACE + PUBLIC_HEADERS HIJetRec + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} + LINK_LIBRARIES ${ROOT_LIBRARIES} AsgTools FourMomUtils HIEventUtilsLib xAODBase xAODCaloEvent xAODHIEvent xAODJet ) + atlas_add_component( HIJetRec - HIJetRec/*.h Root/*.cxx src/*.h src/*.cxx src/components/*.cxx - INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} CaloEvent CaloRecLib CaloUtilsLib - AsgTools AthenaBaseComps Navigation FourMomUtils NavFourMom xAODBase - xAODCaloEvent xAODHIEvent xAODJet GaudiKernel HIEventUtilsLib - JetInterface JetRecLib CxxUtils xAODCore PathResolver ) + Root/*.cxx src/*.h src/*.cxx src/components/*.cxx + LINK_LIBRARIES AthenaBaseComps CaloEvent CaloInterfaceLib CaloRecLib CaloUtilsLib CxxUtils HIJetRecLib JetInterface JetRecLib NavFourMom Navigation PathResolver StoreGateLib xAODCore xAODEventInfo xAODTracking ) # Install files from the package: -atlas_install_headers( HIJetRec ) -atlas_install_python_modules( python/*.py ) +atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) atlas_install_joboptions( share/*.py ) diff --git a/Reconstruction/HeavyIonRec/HIJetRec/Root/HIEventShapeJetIteration.cxx b/Reconstruction/HeavyIonRec/HIJetRec/Root/HIEventShapeJetIteration.cxx index 555e6036eff2215d5ccea43cc13bfcfa447ef053..6c3e4f1a3bf7138ff47257786131de027c226c90 100644 --- a/Reconstruction/HeavyIonRec/HIJetRec/Root/HIEventShapeJetIteration.cxx +++ b/Reconstruction/HeavyIonRec/HIJetRec/Root/HIEventShapeJetIteration.cxx @@ -2,7 +2,7 @@ Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -#include "HIJetRec/HIEventShapeJetIteration.h" +#include "HIEventShapeJetIteration.h" #include "xAODHIEvent/HIEventShape.h" #include "xAODHIEvent/HIEventShapeAuxContainer.h" #include "HIEventUtils/HIEventShapeMap.h" diff --git a/Reconstruction/HeavyIonRec/HIJetRec/HIJetRec/HIEventShapeJetIteration.h b/Reconstruction/HeavyIonRec/HIJetRec/Root/HIEventShapeJetIteration.h similarity index 100% rename from Reconstruction/HeavyIonRec/HIJetRec/HIJetRec/HIEventShapeJetIteration.h rename to Reconstruction/HeavyIonRec/HIJetRec/Root/HIEventShapeJetIteration.h diff --git a/Reconstruction/HeavyIonRec/HIJetRec/Root/HIJetClusterIndexAssociationTool.cxx b/Reconstruction/HeavyIonRec/HIJetRec/Root/HIJetClusterIndexAssociationTool.cxx index bc57d1213fdcc339d0437e9e7aca878229131599..eaf5fd53452617ed4c434b3eba86b4269827ff06 100644 --- a/Reconstruction/HeavyIonRec/HIJetRec/Root/HIJetClusterIndexAssociationTool.cxx +++ b/Reconstruction/HeavyIonRec/HIJetRec/Root/HIJetClusterIndexAssociationTool.cxx @@ -2,7 +2,7 @@ Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration */ -#include "HIJetRec/HIJetClusterIndexAssociationTool.h" +#include "HIJetClusterIndexAssociationTool.h" #include "HIEventUtils/HIEventDefs.h" #include <iomanip> diff --git a/Reconstruction/HeavyIonRec/HIJetRec/HIJetRec/HIJetClusterIndexAssociationTool.h b/Reconstruction/HeavyIonRec/HIJetRec/Root/HIJetClusterIndexAssociationTool.h similarity index 100% rename from Reconstruction/HeavyIonRec/HIJetRec/HIJetRec/HIJetClusterIndexAssociationTool.h rename to Reconstruction/HeavyIonRec/HIJetRec/Root/HIJetClusterIndexAssociationTool.h diff --git a/Reconstruction/HeavyIonRec/HIJetRec/Root/HIJetClusterSubtractorTool.cxx b/Reconstruction/HeavyIonRec/HIJetRec/Root/HIJetClusterSubtractorTool.cxx index 8349780f227b04182dd990448a362ac1a3d491e1..bc4fae0c1f23b241e12bef5da1302372e487b217 100644 --- a/Reconstruction/HeavyIonRec/HIJetRec/Root/HIJetClusterSubtractorTool.cxx +++ b/Reconstruction/HeavyIonRec/HIJetRec/Root/HIJetClusterSubtractorTool.cxx @@ -2,7 +2,7 @@ Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -#include "HIJetRec/HIJetClusterSubtractorTool.h" +#include "HIJetClusterSubtractorTool.h" #include "xAODCaloEvent/CaloCluster.h" #include "xAODEventInfo/EventInfo.h" #include "HIEventUtils/HIEventShapeIndex.h" diff --git a/Reconstruction/HeavyIonRec/HIJetRec/HIJetRec/HIJetClusterSubtractorTool.h b/Reconstruction/HeavyIonRec/HIJetRec/Root/HIJetClusterSubtractorTool.h similarity index 100% rename from Reconstruction/HeavyIonRec/HIJetRec/HIJetRec/HIJetClusterSubtractorTool.h rename to Reconstruction/HeavyIonRec/HIJetRec/Root/HIJetClusterSubtractorTool.h diff --git a/Reconstruction/HeavyIonRec/HIJetRec/Root/HIJetConstituentModifierTool.cxx b/Reconstruction/HeavyIonRec/HIJetRec/Root/HIJetConstituentModifierTool.cxx index 7230177af05af31871d3a574b77ba357eab772ca..42848551542859073c24ff846a1821752edb52aa 100644 --- a/Reconstruction/HeavyIonRec/HIJetRec/Root/HIJetConstituentModifierTool.cxx +++ b/Reconstruction/HeavyIonRec/HIJetRec/Root/HIJetConstituentModifierTool.cxx @@ -2,7 +2,7 @@ Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration */ -#include "HIJetRec/HIJetConstituentModifierTool.h" +#include "HIJetConstituentModifierTool.h" #include "HIJetRec/HIJetRecDefs.h" #include "xAODJet/JetConstituentVector.h" #include "xAODCaloEvent/CaloClusterContainer.h" diff --git a/Reconstruction/HeavyIonRec/HIJetRec/HIJetRec/HIJetConstituentModifierTool.h b/Reconstruction/HeavyIonRec/HIJetRec/Root/HIJetConstituentModifierTool.h similarity index 100% rename from Reconstruction/HeavyIonRec/HIJetRec/HIJetRec/HIJetConstituentModifierTool.h rename to Reconstruction/HeavyIonRec/HIJetRec/Root/HIJetConstituentModifierTool.h diff --git a/Reconstruction/HeavyIonRec/HIJetRec/Root/HIJetConstituentSubtractionTool.cxx b/Reconstruction/HeavyIonRec/HIJetRec/Root/HIJetConstituentSubtractionTool.cxx index f8dc7966ce4030afcede4eb0934907909665d31e..98c4cf47c57a545a031b403b5de79cc3392e015b 100644 --- a/Reconstruction/HeavyIonRec/HIJetRec/Root/HIJetConstituentSubtractionTool.cxx +++ b/Reconstruction/HeavyIonRec/HIJetRec/Root/HIJetConstituentSubtractionTool.cxx @@ -2,7 +2,7 @@ Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -#include "HIJetRec/HIJetConstituentSubtractionTool.h" +#include "HIJetConstituentSubtractionTool.h" #include "HIJetRec/HIJetRecDefs.h" #include "xAODJet/JetConstituentVector.h" #include "xAODHIEvent/HIEventShapeContainer.h" diff --git a/Reconstruction/HeavyIonRec/HIJetRec/HIJetRec/HIJetConstituentSubtractionTool.h b/Reconstruction/HeavyIonRec/HIJetRec/Root/HIJetConstituentSubtractionTool.h similarity index 100% rename from Reconstruction/HeavyIonRec/HIJetRec/HIJetRec/HIJetConstituentSubtractionTool.h rename to Reconstruction/HeavyIonRec/HIJetRec/Root/HIJetConstituentSubtractionTool.h diff --git a/Reconstruction/HeavyIonRec/HIJetRec/Root/HIJetDRAssociationTool.cxx b/Reconstruction/HeavyIonRec/HIJetRec/Root/HIJetDRAssociationTool.cxx index b7474c71224c6229f436ad3557c5f52a7b952533..c3448243fb7fbe23d3e148dd442bcce400e0b707 100644 --- a/Reconstruction/HeavyIonRec/HIJetRec/Root/HIJetDRAssociationTool.cxx +++ b/Reconstruction/HeavyIonRec/HIJetRec/Root/HIJetDRAssociationTool.cxx @@ -2,7 +2,7 @@ Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration */ -#include "HIJetRec/HIJetDRAssociationTool.h" +#include "HIJetDRAssociationTool.h" #include <iomanip> //********************************************************************** diff --git a/Reconstruction/HeavyIonRec/HIJetRec/HIJetRec/HIJetDRAssociationTool.h b/Reconstruction/HeavyIonRec/HIJetRec/Root/HIJetDRAssociationTool.h similarity index 100% rename from Reconstruction/HeavyIonRec/HIJetRec/HIJetRec/HIJetDRAssociationTool.h rename to Reconstruction/HeavyIonRec/HIJetRec/Root/HIJetDRAssociationTool.h diff --git a/Reconstruction/HeavyIonRec/HIJetRec/Root/HIJetDiscriminatorTool.cxx b/Reconstruction/HeavyIonRec/HIJetRec/Root/HIJetDiscriminatorTool.cxx index 5047bf2a50bdaedab81ec0b0a764d611b41d6191..65eeba287f088a272b22d33e45e72631cb947d8f 100644 --- a/Reconstruction/HeavyIonRec/HIJetRec/Root/HIJetDiscriminatorTool.cxx +++ b/Reconstruction/HeavyIonRec/HIJetRec/Root/HIJetDiscriminatorTool.cxx @@ -2,7 +2,7 @@ Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration */ -#include "HIJetRec/HIJetDiscriminatorTool.h" +#include "HIJetDiscriminatorTool.h" namespace{ struct Discrim{ diff --git a/Reconstruction/HeavyIonRec/HIJetRec/HIJetRec/HIJetDiscriminatorTool.h b/Reconstruction/HeavyIonRec/HIJetRec/Root/HIJetDiscriminatorTool.h similarity index 100% rename from Reconstruction/HeavyIonRec/HIJetRec/HIJetRec/HIJetDiscriminatorTool.h rename to Reconstruction/HeavyIonRec/HIJetRec/Root/HIJetDiscriminatorTool.h diff --git a/Reconstruction/HeavyIonRec/HIJetRec/Root/HIJetMaxOverMeanTool.cxx b/Reconstruction/HeavyIonRec/HIJetRec/Root/HIJetMaxOverMeanTool.cxx index 72cd911bc7a18d9e444a7ed15d08b372e1aa7981..c1cced1abc24f6136d2588a5c9d0ac4583cf8926 100644 --- a/Reconstruction/HeavyIonRec/HIJetRec/Root/HIJetMaxOverMeanTool.cxx +++ b/Reconstruction/HeavyIonRec/HIJetRec/Root/HIJetMaxOverMeanTool.cxx @@ -3,7 +3,7 @@ */ #include "StoreGate/WriteDecorHandle.h" -#include "HIJetRec/HIJetMaxOverMeanTool.h" +#include "HIJetMaxOverMeanTool.h" HIJetMaxOverMeanTool::HIJetMaxOverMeanTool(const std::string& t) : asg::AsgTool(t) { diff --git a/Reconstruction/HeavyIonRec/HIJetRec/HIJetRec/HIJetMaxOverMeanTool.h b/Reconstruction/HeavyIonRec/HIJetRec/Root/HIJetMaxOverMeanTool.h similarity index 100% rename from Reconstruction/HeavyIonRec/HIJetRec/HIJetRec/HIJetMaxOverMeanTool.h rename to Reconstruction/HeavyIonRec/HIJetRec/Root/HIJetMaxOverMeanTool.h diff --git a/Reconstruction/HeavyIonRec/HIJetRec/Root/HIJetSignificanceTool.cxx b/Reconstruction/HeavyIonRec/HIJetRec/Root/HIJetSignificanceTool.cxx index 4195a81f156e7d89463b824c1efb8b0bf7c33012..f11df4e4f6c067cc1295b9afeb9097c2a908aee4 100644 --- a/Reconstruction/HeavyIonRec/HIJetRec/Root/HIJetSignificanceTool.cxx +++ b/Reconstruction/HeavyIonRec/HIJetRec/Root/HIJetSignificanceTool.cxx @@ -4,7 +4,7 @@ #include "StoreGate/WriteDecorHandle.h" -#include "HIJetRec/HIJetSignificanceTool.h" +#include "HIJetSignificanceTool.h" #include "xAODCaloEvent/CaloCluster.h" HIJetSignificanceTool::HIJetSignificanceTool(const std::string& name) diff --git a/Reconstruction/HeavyIonRec/HIJetRec/HIJetRec/HIJetSignificanceTool.h b/Reconstruction/HeavyIonRec/HIJetRec/Root/HIJetSignificanceTool.h similarity index 100% rename from Reconstruction/HeavyIonRec/HIJetRec/HIJetRec/HIJetSignificanceTool.h rename to Reconstruction/HeavyIonRec/HIJetRec/Root/HIJetSignificanceTool.h diff --git a/Reconstruction/HeavyIonRec/HIJetRec/Root/HIUEModulatorTool.cxx b/Reconstruction/HeavyIonRec/HIJetRec/Root/HIUEModulatorTool.cxx index 9a7d3803c72d46bc47009d46ee8d418e0043a3c4..3033c69287ccb38c37e4f9d40397de9e31b18e15 100644 --- a/Reconstruction/HeavyIonRec/HIJetRec/Root/HIUEModulatorTool.cxx +++ b/Reconstruction/HeavyIonRec/HIJetRec/Root/HIUEModulatorTool.cxx @@ -2,7 +2,7 @@ Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration */ -#include "HIJetRec/HIUEModulatorTool.h" +#include "HIUEModulatorTool.h" #include "CxxUtils/sincos.h" #include "xAODHIEvent/HIEventShapeContainer.h" diff --git a/Reconstruction/HeavyIonRec/HIJetRec/HIJetRec/HIUEModulatorTool.h b/Reconstruction/HeavyIonRec/HIJetRec/Root/HIUEModulatorTool.h similarity index 100% rename from Reconstruction/HeavyIonRec/HIJetRec/HIJetRec/HIUEModulatorTool.h rename to Reconstruction/HeavyIonRec/HIJetRec/Root/HIUEModulatorTool.h diff --git a/Reconstruction/HeavyIonRec/HIJetRec/python/HIJetRecTools.py b/Reconstruction/HeavyIonRec/HIJetRec/python/HIJetRecTools.py index 22597feaa019599645f09ab4c3afba0a91b2bb27..44b0b4b84ae279e55219076906de8637ec70266d 100644 --- a/Reconstruction/HeavyIonRec/HIJetRec/python/HIJetRecTools.py +++ b/Reconstruction/HeavyIonRec/HIJetRec/python/HIJetRecTools.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration from HIJetRec.HIJetRecFlags import HIJetFlags from JetRec.JetRecFlags import jetFlags @@ -10,10 +10,7 @@ import AthenaCommon.SystemOfUnits as Units from InDetTrackSelectionTool.InDetTrackSelectionToolConf import InDet__InDetTrackSelectionTool from JetRec.JetRecConf import PseudoJetAlgorithm from JetRecTools.JetRecToolsConf import JetTrackSelectionTool -from JetRecTools.JetRecToolsConf import SimpleJetTrackSelectionTool from JetRecTools.JetRecToolsConf import TrackVertexAssociationTool -from JetMomentTools.JetMomentToolsConf import JetCaloQualityTool -from JetMomentTools.JetMomentToolsConf import JetCaloCellQualityTool #select the tracks #if jetFlags.Enabled() : HIJetFlags.UseHITracks.set_Value_and_Lock(False) @@ -170,11 +167,11 @@ if HIJetFlags.ApplyEtaJESCalibration() : from JetCalibTools.JetCalibToolsConf import JetCalibrationTool for R in HIJetFlags.AntiKtRValues() : #non existing calibration for R=1.0 jets, R=0.4 jet calibration to be used (GetHIModifierList) - if int(10*R) is 10 : continue + if int(10*R) == 10 : continue calib_seq='EtaJES' JES_is_data=True if jetFlags.useTruth(): JES_is_data=False - elif R is 0.4 : calib_seq='EtaJES_Insitu' #only do in situ for R=0.4 jets in data + elif R == 0.4 : calib_seq='EtaJES_Insitu' #only do in situ for R=0.4 jets in data #elif R is 1.0 : R = 0.4 calib_tool=JetCalibrationTool('HICalibToolR%d' % int(10*R),JetCollection='AntiKt%dHI' % int(10*R), ConfigFile='JES_MC15c_HI_Nov2016.config',CalibSequence=calib_seq,IsData=JES_is_data) diff --git a/Reconstruction/HeavyIonRec/HIJetRec/python/SubtractedCellGetter.py b/Reconstruction/HeavyIonRec/HIJetRec/python/SubtractedCellGetter.py index 4a85a2d8b85b5d57b92e98d44c056b4e7cd397d6..bf2e2d09812ee3d1aaf9d74681c6bb2a484ab378 100644 --- a/Reconstruction/HeavyIonRec/HIJetRec/python/SubtractedCellGetter.py +++ b/Reconstruction/HeavyIonRec/HIJetRec/python/SubtractedCellGetter.py @@ -1,10 +1,9 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration # specifies Calo cell making # so far only handle the RawChannel->CaloCell step # not all possibility of CaloCellMaker_jobOptions.py integrated yet -from AthenaCommon.Constants import * from RecExConfig.Configured import Configured class SubtractedCellGetter ( Configured ) : @@ -43,7 +42,7 @@ class SubtractedCellGetter ( Configured ) : cellMaker.CaloCellMakerToolNames = [cellCopyTool,cellSubtrTool,cellFinalizerTool] from AthenaCommon.AlgSequence import AlgSequence topSequence = AlgSequence() - topSequence+=cellMaker; + topSequence+=cellMaker return True diff --git a/Reconstruction/HeavyIonRec/HIJetRec/src/components/HIJetRec_entries.cxx b/Reconstruction/HeavyIonRec/HIJetRec/src/components/HIJetRec_entries.cxx index e34a0313363b73fcf0f14d017830f3b1ec06fc5b..d5179ceab2dc78ba8ce5c378807122279dfe1449 100644 --- a/Reconstruction/HeavyIonRec/HIJetRec/src/components/HIJetRec_entries.cxx +++ b/Reconstruction/HeavyIonRec/HIJetRec/src/components/HIJetRec_entries.cxx @@ -5,15 +5,15 @@ #include "../HISubtractedCellMakerTool.h" #endif -#include "HIJetRec/HIEventShapeJetIteration.h" -#include "HIJetRec/HIJetClusterSubtractorTool.h" -#include "HIJetRec/HIJetConstituentSubtractionTool.h" -#include "HIJetRec/HIJetConstituentModifierTool.h" -#include "HIJetRec/HIJetDRAssociationTool.h" -#include "HIJetRec/HIJetMaxOverMeanTool.h" -#include "HIJetRec/HIJetDiscriminatorTool.h" -#include "HIJetRec/HIJetSignificanceTool.h" -#include "HIJetRec/HIUEModulatorTool.h" +#include "../../Root/HIEventShapeJetIteration.h" +#include "../../Root/HIJetClusterSubtractorTool.h" +#include "../../Root/HIJetConstituentSubtractionTool.h" +#include "../../Root/HIJetConstituentModifierTool.h" +#include "../../Root/HIJetDRAssociationTool.h" +#include "../../Root/HIJetMaxOverMeanTool.h" +#include "../../Root/HIJetDiscriminatorTool.h" +#include "../../Root/HIJetSignificanceTool.h" +#include "../../Root/HIUEModulatorTool.h" #ifndef XAOD_ANALYSIS DECLARE_COMPONENT( HIClusterMaker ) diff --git a/Reconstruction/Jet/JetRec/python/JetRecFlags.py b/Reconstruction/Jet/JetRec/python/JetRecFlags.py index d0ae00271fa4fb38ba4ec10c8d0db22014b3a422..da956e946dc57c959e77487132587af9e81f8dfa 100644 --- a/Reconstruction/Jet/JetRec/python/JetRecFlags.py +++ b/Reconstruction/Jet/JetRec/python/JetRecFlags.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration # JetRecFlags.py # @@ -167,6 +167,14 @@ class defaultCalibOpt(JobProperty): allowedTypes = ['str'] # type StoredValue = "" # default value +class useCalibJetThreshold(JobProperty): + """ If true, jets are filtered based on their calibrated jet pT (15 GeV for cluster-based jets, 10 GeV for PFlow) + If false, only pT threshold at constituent-scale is applied (5 GeV for cluster-based and PFlow jets) + """ + statusOn = True + allowedTypes = ['bool'] # type + StoredValue = True # default value + class containerNamePrefix(JobProperty): """ Prefix for jet collection names """ @@ -251,6 +259,7 @@ jobproperties.JetRecFlags.add_JobProperty(useBTagging) jobproperties.JetRecFlags.add_JobProperty(skipTools) jobproperties.JetRecFlags.add_JobProperty(additionalTopoGetters) jobproperties.JetRecFlags.add_JobProperty(defaultCalibOpt) +jobproperties.JetRecFlags.add_JobProperty(useCalibJetThreshold) jobproperties.JetRecFlags.add_JobProperty(containerNamePrefix) jobproperties.JetRecFlags.add_JobProperty(separateJetAlgs) jobproperties.JetRecFlags.add_JobProperty(timeJetToolRunner) diff --git a/Reconstruction/Jet/JetRec/share/JetRec_jobOptions.py b/Reconstruction/Jet/JetRec/share/JetRec_jobOptions.py index 5eec0142a406c156541123bd87c100500ecc0e35..4cf0cfa8e8a601e33d0907363b044afeabeebec4 100644 --- a/Reconstruction/Jet/JetRec/share/JetRec_jobOptions.py +++ b/Reconstruction/Jet/JetRec/share/JetRec_jobOptions.py @@ -30,14 +30,21 @@ if not jetFlags.useVertices(): calibopt = "aj" jetlog.info(myname + "No vertices -- switch calibopt to " + calibopt) +ptminFilter_topo = 15000 +ptminFilter_pFlow = 10000 +if not jetFlags.useCalibJetThreshold: + ptminFilter_topo = 1 + ptminFilter_pFlow = 1 + jetlog.info(myname + "Switching off the jet pT threshold applied at the calibrated scale") + # Finders. if jetFlags.detailLevel()==JetContentDetail.Reduced: if jetFlags.useTopo(): - jtm.addJetFinder("AntiKt4EMTopoJets", "AntiKt", 0.4, "emtopo_reduced", "emtopo_ungroomed", ghostArea=0.01, ptmin= 5000, ptminFilter= 15000, calibOpt=calibopt) - jtm.addJetFinder("AntiKt4LCTopoJets", "AntiKt", 0.4, "lctopo_reduced", "lctopo_ungroomed", ghostArea=0.01, ptmin= 5000, ptminFilter= 15000, calibOpt=calibopt) + jtm.addJetFinder("AntiKt4EMTopoJets", "AntiKt", 0.4, "emtopo_reduced", "emtopo_ungroomed", ghostArea=0.01, ptmin= 5000, ptminFilter=ptminFilter_topo, calibOpt=calibopt) + jtm.addJetFinder("AntiKt4LCTopoJets", "AntiKt", 0.4, "lctopo_reduced", "lctopo_ungroomed", ghostArea=0.01, ptmin= 5000, ptminFilter=ptminFilter_topo, calibOpt=calibopt) jtm.addJetFinder("AntiKt10LCTopoJets", "AntiKt", 1.0, "lctopo_reduced", "lctopo_ungroomed", ghostArea=0.01, ptmin= 40000, ptminFilter=50000, calibOpt="none") if jetFlags.usePFlow(): - jtm.addJetFinder("AntiKt4EMPFlowJets", "AntiKt", 0.4, "empflow_reduced", "pflow_ungroomed", ghostArea=0.01, ptmin= 5000, ptminFilter= 10000, calibOpt=calibopt+":pflow") + jtm.addJetFinder("AntiKt4EMPFlowJets", "AntiKt", 0.4, "empflow_reduced", "pflow_ungroomed", ghostArea=0.01, ptmin= 5000, ptminFilter= ptminFilter_pFlow, calibOpt=calibopt+":pflow") if jetFlags.useTruth(): jtm.addJetFinder("AntiKt4TruthJets", "AntiKt", 0.4, "truth", ptmin= 5000) elif jetFlags.detailLevel()>=JetContentDetail.Full: @@ -50,11 +57,11 @@ elif jetFlags.detailLevel()>=JetContentDetail.Full: jtm.addJetFinder("AntiKt2PV0TrackJets", "AntiKt", 0.2, "pv0track", ptmin= 2000) jtm.addJetFinder("AntiKt4PV0TrackJets", "AntiKt", 0.4, "pv0track", ptmin= 2000) if jetFlags.useTopo(): - jtm.addJetFinder("AntiKt4EMTopoJets", "AntiKt", 0.4, "emtopo", "emtopo_ungroomed", ghostArea=0.01, ptmin= 5000, ptminFilter= 15000, calibOpt=calibopt) - jtm.addJetFinder("AntiKt4LCTopoJets", "AntiKt", 0.4, "lctopo", "lctopo_ungroomed", ghostArea=0.01, ptmin= 5000, ptminFilter= 15000, calibOpt=calibopt) + jtm.addJetFinder("AntiKt4EMTopoJets", "AntiKt", 0.4, "emtopo", "emtopo_ungroomed", ghostArea=0.01, ptmin= 5000, ptminFilter=ptminFilter_topo, calibOpt=calibopt) + jtm.addJetFinder("AntiKt4LCTopoJets", "AntiKt", 0.4, "lctopo", "lctopo_ungroomed", ghostArea=0.01, ptmin= 5000, ptminFilter=ptminFilter_topo, calibOpt=calibopt) jtm.addJetFinder("AntiKt10LCTopoJets", "AntiKt", 1.0, "lctopo", "lctopo_ungroomed", ghostArea=0.01, ptmin= 40000, ptminFilter=50000, calibOpt="none") if jetFlags.usePFlow(): - jtm.addJetFinder("AntiKt4EMPFlowJets", "AntiKt", 0.4, "empflow", "pflow_ungroomed", ghostArea=0.01, ptmin= 5000, ptminFilter= 10000, calibOpt=calibopt+":pflow") + jtm.addJetFinder("AntiKt4EMPFlowJets", "AntiKt", 0.4, "empflow", "pflow_ungroomed", ghostArea=0.01, ptmin= 5000, ptminFilter=ptminFilter_pFlow, calibOpt=calibopt+":pflow") if jetFlags.detailLevel()==JetContentDetail.Validation: jtm.addJetTrimmer( "AntiKt10LCTopoTrimmedPtFrac5SmallR20Jets", rclus=0.2, ptfrac=0.05, input="AntiKt10LCTopoJets", modifiersin="lctopo_groomed" ) diff --git a/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/CMakeLists.txt b/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/CMakeLists.txt index 6824d354531b85bf64a0e11de6ccb31cabdc5ff3..a7bc85d6ea2fa3cf389ec60beb1ed3ea14fdf56c 100644 --- a/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/CMakeLists.txt +++ b/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/CMakeLists.txt @@ -45,5 +45,5 @@ atlas_depends_on_subdirs( PUBLIC atlas_add_component( MuonCombinedTrackFindingTools src/*.cxx src/components/*.cxx - LINK_LIBRARIES GaudiKernel AthenaBaseComps EventPrimitives xAODTracking xAODTruth MdtCalibData MdtCalibSvcLib MuonDetDescrUtils MuonIdHelpersLib MuonStationIndexLib MuonClusterizationLib MuonHoughPatternToolsLib MuonCompetingRIOsOnTrack MuonLayerEvent MuonRIO_OnTrack MuonSegment MuonRecHelperToolsLib MuonRecToolInterfaces MuonLayerHough MuidInterfaces MuonCombinedEvent MuonCombinedToolInterfaces MuonPrepRawDataProviderToolsLib TrkEventPrimitives TrkParameters TrkTrack TrkExInterfaces TrkToolInterfaces TrkDriftCircleMath MuonRecHelperToolsLib ) + LINK_LIBRARIES GaudiKernel AthenaBaseComps EventPrimitives xAODTracking xAODTruth MdtCalibData MdtCalibSvcLib MuonDetDescrUtils MuonIdHelpersLib MuonStationIndexLib MuonClusterizationLib MuonHoughPatternToolsLib MuonCompetingRIOsOnTrack MuonLayerEvent MuonRIO_OnTrack MuonSegment MuonRecHelperToolsLib MuonRecToolInterfaces MuonLayerHough MuidInterfaces MuonCombinedEvent MuonCombinedToolInterfaces MuonPrepRawDataProviderToolsLib TrkEventPrimitives TrkParameters TrkTrack TrkExInterfaces TrkToolInterfaces TrkDriftCircleMath MuonRecHelperToolsLib MuonSegmentMakerToolInterfaces MuonSegmentTaggerToolInterfaces ) diff --git a/Reconstruction/tauRecTools/Root/TauRecToolBase.cxx b/Reconstruction/tauRecTools/Root/TauRecToolBase.cxx index 576467c47f4f3d56964aa9e39b6b6cb47e6908b3..90cc2dd212ca6130e35322a5a19da78781cc40ad 100644 --- a/Reconstruction/tauRecTools/Root/TauRecToolBase.cxx +++ b/Reconstruction/tauRecTools/Root/TauRecToolBase.cxx @@ -174,7 +174,7 @@ StatusCode TauRecToolBase::executeRNNTrackClassifier(xAOD::TauJet&, xAOD::TauTra return StatusCode::FAILURE; } -StatusCode TauRecToolBase::executeShotFinder(xAOD::TauJet& /*pTau*/, xAOD::CaloClusterContainer& /*shotClusterContainer*/, xAOD::PFOContainer& /*PFOContainer*/ ) { +StatusCode TauRecToolBase::executeShotFinder(xAOD::TauJet& /*pTau*/, xAOD::CaloClusterContainer& /*shotClusterContainer*/, xAOD::PFOContainer& /*PFOContainer*/ ) const { ATH_MSG_ERROR("function not implemented"); return StatusCode::FAILURE; } diff --git a/Reconstruction/tauRecTools/src/TauShotFinder.cxx b/Reconstruction/tauRecTools/src/TauShotFinder.cxx index a95a09b78ba71aacef948e463ad5e4eb69ad38e0..86bcd2660353fce4fb1ec567c7ec39d982f2414e 100644 --- a/Reconstruction/tauRecTools/src/TauShotFinder.cxx +++ b/Reconstruction/tauRecTools/src/TauShotFinder.cxx @@ -61,7 +61,7 @@ StatusCode TauShotFinder::finalize() } StatusCode TauShotFinder::executeShotFinder(xAOD::TauJet& pTau, xAOD::CaloClusterContainer& tauShotClusterContainer, - xAOD::PFOContainer& tauShotPFOContainer) { + xAOD::PFOContainer& tauShotPFOContainer) const { ATH_MSG_DEBUG("execute"); // Any tau needs to have shot PFO vectors. Set empty vectors before nTrack cut @@ -103,7 +103,7 @@ StatusCode TauShotFinder::executeShotFinder(xAOD::TauJet& pTau, xAOD::CaloCluste if( !( samp == CaloCell_ID::EMB1 || samp == CaloCell_ID::EME1 ) ) continue; cells.push_back(*cellItr); } - // sort cells in descending pt + // sort cells in descending pt std::sort(cells.begin(),cells.end(),ptSort(*this)); //--------------------------------------------------------------------- @@ -268,8 +268,8 @@ StatusCode TauShotFinder::executeShotFinder(xAOD::TauJet& pTau, xAOD::CaloCluste } std::vector<const CaloCell*> TauShotFinder::getNeighbours(const CaloCellContainer* pCellContainer, - const CaloCell* cell, - int maxDepth) + const CaloCell* cell, + int maxDepth) const { std::vector<const CaloCell*> cells; this->addNeighbours(pCellContainer,cell,cells,0,maxDepth,true); //next @@ -282,7 +282,7 @@ void TauShotFinder::addNeighbours(const CaloCellContainer* pCellContainer, std::vector<const CaloCell*>& cells, int depth, int maxDepth, - bool next) + bool next) const { depth++; if( depth > maxDepth ) return; @@ -306,7 +306,7 @@ void TauShotFinder::addNeighbours(const CaloCellContainer* pCellContainer, } } -bool TauShotFinder::isPhiNeighbour(IdentifierHash cell1Hash, IdentifierHash cell2Hash, bool next){ +bool TauShotFinder::isPhiNeighbour(IdentifierHash cell1Hash, IdentifierHash cell2Hash, bool next) const{ std::vector<IdentifierHash> neigHashes; if( next ) m_calo_id->get_neighbours(cell1Hash,LArNeighbours::nextInPhi,neigHashes); else m_calo_id->get_neighbours(cell1Hash,LArNeighbours::prevInPhi,neigHashes); @@ -317,7 +317,7 @@ bool TauShotFinder::isPhiNeighbour(IdentifierHash cell1Hash, IdentifierHash cell return false; } -float TauShotFinder::getEtaBin(float seedEta){ +float TauShotFinder::getEtaBin(float seedEta) const { float absSeedEta=std::abs(seedEta); if(absSeedEta < 0.80) return 0; // Central Barrel else if(absSeedEta<1.39) return 1; // Outer Barrel @@ -326,7 +326,7 @@ float TauShotFinder::getEtaBin(float seedEta){ else return 4; // endcap, coarse granularity } -float TauShotFinder::getNPhotons(int etaBin, float seedEnergy) { +float TauShotFinder::getNPhotons(int etaBin, float seedEnergy) const { // no photon counting in crack region, e.g. [1.39, 1.51] if(etaBin==2) return 0; diff --git a/Reconstruction/tauRecTools/src/TauShotFinder.h b/Reconstruction/tauRecTools/src/TauShotFinder.h index 3ad67adf06a31f57da0d3923b549a82f49fe97ce..b0a70569b20ecbfefd917d990a0389bfa7b8733f 100644 --- a/Reconstruction/tauRecTools/src/TauShotFinder.h +++ b/Reconstruction/tauRecTools/src/TauShotFinder.h @@ -21,7 +21,7 @@ public: virtual ~TauShotFinder(); virtual StatusCode initialize() override; - virtual StatusCode executeShotFinder(xAOD::TauJet& pTau, xAOD::CaloClusterContainer& tauShotCaloClusContainer, xAOD::PFOContainer& tauShotPFOContainer) override; + virtual StatusCode executeShotFinder(xAOD::TauJet& pTau, xAOD::CaloClusterContainer& tauShotCaloClusContainer, xAOD::PFOContainer& tauShotPFOContainer) const override; virtual StatusCode finalize() override; private: @@ -42,23 +42,23 @@ private: }; /** @brief get neighbour cells */ - std::vector<const CaloCell*> getNeighbours(const CaloCellContainer*,const CaloCell*,int /*maxDepth*/); + std::vector<const CaloCell*> getNeighbours(const CaloCellContainer*,const CaloCell*,int /*maxDepth*/) const; void addNeighbours(const CaloCellContainer*, const CaloCell* cell, std::vector<const CaloCell*>& cells, int depth, int maxDepth, - bool next); + bool next) const; - bool isPhiNeighbour(IdentifierHash cell1Hash, IdentifierHash cell2Hash, bool next); + bool isPhiNeighbour(IdentifierHash cell1Hash, IdentifierHash cell2Hash, bool next) const; /** @brief get eta bin */ - float getEtaBin(float /*seedEta*/); + float getEtaBin(float /*seedEta*/) const; /** @brief get NPhotons in shot */ float getNPhotons(int /*etaBin*/, - float /*seedEnergy*/); + float /*seedEnergy*/) const; // number of cells in eta Gaudi::Property<int> m_nCellsInEta {this, "NCellsInEta"}; diff --git a/Reconstruction/tauRecTools/src/TauShotVariableHelpers.cxx b/Reconstruction/tauRecTools/src/TauShotVariableHelpers.cxx index f19902846e3b338a77f89a11dae950c119c021d3..3b2ef8c1dc49c3eacaa6f04b1d7e45d8362d5d03 100644 --- a/Reconstruction/tauRecTools/src/TauShotVariableHelpers.cxx +++ b/Reconstruction/tauRecTools/src/TauShotVariableHelpers.cxx @@ -144,7 +144,7 @@ namespace TauShotVariableHelpers { } - float mean_eta(vector<vector<const CaloCell*> > shotCells, ToolHandle<IHadronicCalibrationTool>& caloWeightTool){ + float mean_eta(vector<vector<const CaloCell*> > shotCells, const ToolHandle<IHadronicCalibrationTool>& caloWeightTool){ float sumEta=0.; float sumWeight=0.; vector<vector<const CaloCell*> >::iterator itrPhi = shotCells.begin(); @@ -160,7 +160,7 @@ namespace TauShotVariableHelpers { return sumEta/sumWeight; } - float mean_pt(vector<vector<const CaloCell*> > shotCells, ToolHandle<IHadronicCalibrationTool>& caloWeightTool){ + float mean_pt(vector<vector<const CaloCell*> > shotCells, const ToolHandle<IHadronicCalibrationTool>& caloWeightTool){ float sumPt=0.; int nCells = 0; vector<vector<const CaloCell*> >::iterator itrPhi = shotCells.begin(); @@ -176,7 +176,7 @@ namespace TauShotVariableHelpers { return sumPt/nCells; } - float ptWindow(vector<vector<const CaloCell*> > shotCells, int windowSize, ToolHandle<IHadronicCalibrationTool>& caloWeightTool){ + float ptWindow(vector<vector<const CaloCell*> > shotCells, int windowSize, const ToolHandle<IHadronicCalibrationTool>& caloWeightTool){ // window size should be odd and noti be larger than eta window of shotCells int nCells_eta = shotCells.at(0).size(); int seedIndex = nCells_eta/2; @@ -191,7 +191,7 @@ namespace TauShotVariableHelpers { return ptWindow; } - float ws5(vector<vector<const CaloCell*> > shotCells, ToolHandle<IHadronicCalibrationTool>& caloWeightTool){ + float ws5(vector<vector<const CaloCell*> > shotCells, const ToolHandle<IHadronicCalibrationTool>& caloWeightTool){ int nCells_eta = shotCells.at(0).size(); int seedIndex = nCells_eta/2; float sumWeight=0.; @@ -208,7 +208,7 @@ namespace TauShotVariableHelpers { return sqrt( sumDev2 / sumWeight ); } - float sdevEta_WRTmean(vector<vector<const CaloCell*> > shotCells, ToolHandle<IHadronicCalibrationTool>& caloWeightTool){ + float sdevEta_WRTmean(vector<vector<const CaloCell*> > shotCells, const ToolHandle<IHadronicCalibrationTool>& caloWeightTool){ float mean = mean_eta(shotCells, caloWeightTool); float sumWeight=0.; float sumDev2=0.; @@ -225,7 +225,7 @@ namespace TauShotVariableHelpers { return sqrt( sumDev2 / sumWeight ); } - float sdevEta_WRTmode(vector<vector<const CaloCell*> > shotCells, ToolHandle<IHadronicCalibrationTool>& caloWeightTool){ + float sdevEta_WRTmode(vector<vector<const CaloCell*> > shotCells, const ToolHandle<IHadronicCalibrationTool>& caloWeightTool){ int nCells_eta = shotCells.at(0).size(); int seedIndex = nCells_eta/2; float mode = shotCells.at(0).at(seedIndex)->eta(); @@ -244,7 +244,7 @@ namespace TauShotVariableHelpers { return sqrt( sumDev2 / sumWeight ); } - float sdevPt(vector<vector<const CaloCell*> > shotCells, ToolHandle<IHadronicCalibrationTool>& caloWeightTool){ + float sdevPt(vector<vector<const CaloCell*> > shotCells, const ToolHandle<IHadronicCalibrationTool>& caloWeightTool){ float mean = mean_pt(shotCells, caloWeightTool); float sumWeight=0.; float sumDev2=0.; @@ -261,7 +261,7 @@ namespace TauShotVariableHelpers { return sqrt(sumDev2)/sumWeight; } - float deltaPt12_min(vector<vector<const CaloCell*> > shotCells, ToolHandle<IHadronicCalibrationTool>& caloWeightTool){ + float deltaPt12_min(vector<vector<const CaloCell*> > shotCells, const ToolHandle<IHadronicCalibrationTool>& caloWeightTool){ int nCells_eta = shotCells.at(0).size(); int seedIndex = nCells_eta/2; bool haveLeft = false; @@ -293,7 +293,7 @@ namespace TauShotVariableHelpers { } - float Fside(vector<vector<const CaloCell*> > shotCells, int largerWindow, int smallerWindow, ToolHandle<IHadronicCalibrationTool>& caloWeightTool){ + float Fside(vector<vector<const CaloCell*> > shotCells, int largerWindow, int smallerWindow, const ToolHandle<IHadronicCalibrationTool>& caloWeightTool){ // window sizes should be odd and windows should be not larger than eta window of shotCells int nCells_eta = shotCells.at(0).size(); int seedIndex = nCells_eta/2; @@ -314,7 +314,7 @@ namespace TauShotVariableHelpers { return (pt_largerWindow-pt_smallerWindow)/pt_smallerWindow; } - float fracSide(vector<vector<const CaloCell*> > shotCells, int largerWindow, int smallerWindow, ToolHandle<IHadronicCalibrationTool>& caloWeightTool){ + float fracSide(vector<vector<const CaloCell*> > shotCells, int largerWindow, int smallerWindow, const ToolHandle<IHadronicCalibrationTool>& caloWeightTool){ // window sizes should be odd and windows should be not larger than eta window of shotCells int nCells_eta = shotCells.at(0).size(); int seedIndex = nCells_eta/2; @@ -335,7 +335,7 @@ namespace TauShotVariableHelpers { return (pt_largerWindow-pt_smallerWindow)/pt_largerWindow; } - float ptWindowFrac(vector<vector<const CaloCell*> > shotCells, int largerWindow, int smallerWindow, ToolHandle<IHadronicCalibrationTool>& caloWeightTool){ + float ptWindowFrac(vector<vector<const CaloCell*> > shotCells, int largerWindow, int smallerWindow, const ToolHandle<IHadronicCalibrationTool>& caloWeightTool){ // window sizes should be odd and windows should be not larger than eta window of shotCells int nCells_eta = shotCells.at(0).size(); int seedIndex = nCells_eta/2; diff --git a/Reconstruction/tauRecTools/src/TauShotVariableHelpers.h b/Reconstruction/tauRecTools/src/TauShotVariableHelpers.h index 3b4919ed12e39410aad6298d11869c6afeb97e3f..fdc21ce85d0941f815d48d1e9de3e75c2aaa44ca 100644 --- a/Reconstruction/tauRecTools/src/TauShotVariableHelpers.h +++ b/Reconstruction/tauRecTools/src/TauShotVariableHelpers.h @@ -25,42 +25,42 @@ namespace TauShotVariableHelpers { /** @brief mean eta, used by other functions */ float mean_eta(std::vector<std::vector<const CaloCell*> > /*shotCells*/, - ToolHandle<IHadronicCalibrationTool>& /*caloWeightTool*/); + const ToolHandle<IHadronicCalibrationTool>& /*caloWeightTool*/); /** @brief mean pt, used by other functions */ float mean_pt(std::vector<std::vector<const CaloCell*> > /*shotCells*/, - ToolHandle<IHadronicCalibrationTool>& /*caloWeightTool*/); + const ToolHandle<IHadronicCalibrationTool>& /*caloWeightTool*/); /** @brief pt in windows */ float ptWindow(std::vector<std::vector<const CaloCell*> > /*shotCells*/, int /*windowSize*/, - ToolHandle<IHadronicCalibrationTool>& /*caloWeightTool*/); + const ToolHandle<IHadronicCalibrationTool>& /*caloWeightTool*/); /** @brief ws5 variable (egamma) */ float ws5(std::vector<std::vector<const CaloCell*> > /*shotCells*/, - ToolHandle<IHadronicCalibrationTool>& /*caloWeightTool*/); + const ToolHandle<IHadronicCalibrationTool>& /*caloWeightTool*/); /** @brief standard deviation in eta WRT mean */ float sdevEta_WRTmean(std::vector<std::vector<const CaloCell*> > /*shotCells*/, - ToolHandle<IHadronicCalibrationTool>& /*caloWeightTool*/); + const ToolHandle<IHadronicCalibrationTool>& /*caloWeightTool*/); /** @brief standard deviation in eta WRT mode */ float sdevEta_WRTmode(std::vector<std::vector<const CaloCell*> > /*shotCells*/, - ToolHandle<IHadronicCalibrationTool>& /*caloWeightTool*/); + const ToolHandle<IHadronicCalibrationTool>& /*caloWeightTool*/); /** @brief normalized standard deviation in pt */ float sdevPt(std::vector<std::vector<const CaloCell*> > /*shotCells*/, - ToolHandle<IHadronicCalibrationTool>& /*caloWeightTool*/); + const ToolHandle<IHadronicCalibrationTool>& /*caloWeightTool*/); /** @brief pT diff b/w lead and sub-lead cell */ float deltaPt12_min(std::vector<std::vector<const CaloCell*> > /*shotCells*/, - ToolHandle<IHadronicCalibrationTool>& /*caloWeightTool*/); + const ToolHandle<IHadronicCalibrationTool>& /*caloWeightTool*/); /** @brief Fside variable (egamma) */ float Fside(std::vector<std::vector<const CaloCell*> > /*shotCells*/, int /*largerWindow*/, int /*smallerWindow*/, - ToolHandle<IHadronicCalibrationTool>& /*caloWeightTool*/); + const ToolHandle<IHadronicCalibrationTool>& /*caloWeightTool*/); /** @brief similar than Fside but in unit of eta instead of number of cells */ float fracSide(std::vector<std::vector<const CaloCell*> > /*shotCells*/, @@ -72,7 +72,7 @@ namespace TauShotVariableHelpers { float ptWindowFrac(std::vector<std::vector<const CaloCell*> > /*shotCells*/, int /*largerWindow*/, int /*smallerWindow*/, - ToolHandle<IHadronicCalibrationTool>& /*caloWeightTool*/); + const ToolHandle<IHadronicCalibrationTool>& /*caloWeightTool*/); } #endif // TAUSHOTVARIABLEHELPERS_H diff --git a/Reconstruction/tauRecTools/tauRecTools/ITauToolBase.h b/Reconstruction/tauRecTools/tauRecTools/ITauToolBase.h index 7eaf8a88137d3672ee926e1817b2ae973dd6fa11..d5f277423d64c1ee72a2bcce43d631adba27ca3d 100644 --- a/Reconstruction/tauRecTools/tauRecTools/ITauToolBase.h +++ b/Reconstruction/tauRecTools/tauRecTools/ITauToolBase.h @@ -54,9 +54,9 @@ class ITauToolBase : virtual public asg::IAsgTool virtual StatusCode executeTrackFinder(xAOD::TauJet& pTau, xAOD::TauTrackContainer& tauTrackContainer, const xAOD::TrackParticleContainer* trackContainer = nullptr) const = 0; virtual StatusCode executeTrackClassifier(xAOD::TauJet& pTau, xAOD::TauTrackContainer& tauTrackContainer) const = 0; virtual StatusCode executeRNNTrackClassifier(xAOD::TauJet& pTau, xAOD::TauTrackContainer& tauTrackContainer) = 0; - virtual StatusCode executeShotFinder(xAOD::TauJet& pTau, xAOD::CaloClusterContainer& shotClusterContainer, xAOD::PFOContainer& PFOContainer ) = 0; + virtual StatusCode executeShotFinder(xAOD::TauJet& pTau, xAOD::CaloClusterContainer& shotClusterContainer, xAOD::PFOContainer& PFOContainer ) const = 0; virtual StatusCode executePi0ClusterCreator(xAOD::TauJet& pTau, xAOD::PFOContainer& neutralPFOContainer, - xAOD::PFOContainer& hadronicPFOContainer, + xAOD::PFOContainer& hadronicPFOContainer, xAOD::CaloClusterContainer& caloClusterContainer, const xAOD::CaloClusterContainer& pCaloClusterContainer ) = 0; virtual StatusCode executeVertexVariables(xAOD::TauJet& pTau, xAOD::VertexContainer& vertexContainer ) const = 0; diff --git a/Reconstruction/tauRecTools/tauRecTools/TauRecToolBase.h b/Reconstruction/tauRecTools/tauRecTools/TauRecToolBase.h index 1498f49d9f2de2c896769a6c91640d757820fcd3..855de21662e00cf5ba622b7fe80993837735b08d 100644 --- a/Reconstruction/tauRecTools/tauRecTools/TauRecToolBase.h +++ b/Reconstruction/tauRecTools/tauRecTools/TauRecToolBase.h @@ -51,7 +51,7 @@ class TauRecToolBase : public asg::AsgTool, virtual public ITauToolBase { virtual StatusCode executeTrackFinder(xAOD::TauJet& pTau, xAOD::TauTrackContainer& tauTrackContainer, const xAOD::TrackParticleContainer* trackContainer = nullptr) const override; virtual StatusCode executeTrackClassifier(xAOD::TauJet& pTau, xAOD::TauTrackContainer& tauTrackContainer) const override; virtual StatusCode executeRNNTrackClassifier(xAOD::TauJet& pTau, xAOD::TauTrackContainer& tauTrackContainer) override; - virtual StatusCode executeShotFinder(xAOD::TauJet& pTau, xAOD::CaloClusterContainer& shotClusterContainer, xAOD::PFOContainer& PFOContainer ) override; + virtual StatusCode executeShotFinder(xAOD::TauJet& pTau, xAOD::CaloClusterContainer& shotClusterContainer, xAOD::PFOContainer& PFOContainer ) const override; virtual StatusCode executePi0ClusterCreator(xAOD::TauJet& pTau, xAOD::PFOContainer& neutralPFOContainer, xAOD::PFOContainer& hadronicPFOContainer, xAOD::CaloClusterContainer& caloClusterContainer, diff --git a/Simulation/FastShower/FastCaloSim/FastCaloSim/FastShowerCellBuilderTool.h b/Simulation/FastShower/FastCaloSim/FastCaloSim/FastShowerCellBuilderTool.h index d9a5fb4bdbd8a0b5a401bfaf7eed73ea72bec5cb..8ef69ac05ff519816278eaeb56e42c917cdf0266 100755 --- a/Simulation/FastShower/FastCaloSim/FastCaloSim/FastShowerCellBuilderTool.h +++ b/Simulation/FastShower/FastCaloSim/FastCaloSim/FastShowerCellBuilderTool.h @@ -93,8 +93,7 @@ public: StatusCode caloAligned( IOVSVC_CALLBACK_ARGS ); typedef std::map<int,int> MCdo_simul_state; - typedef std::vector<const HepMC::GenParticle*> MCparticleCollection ; - typedef MCparticleCollection::const_iterator MCparticleCollectionCIter ; + typedef std::vector<HepMC::ConstGenParticlePtr> MCparticleCollection ; private: void LoadParametrizationsFromDir(std::string dir); @@ -187,11 +186,11 @@ private: // extrapolation through Calo std::vector<Trk::HitInfo>* caloHits(const HepMC::GenParticle& part ) const; - bool Is_ID_Vertex(HepMC::GenVertex* ver) const; + bool Is_ID_Vertex(HepMC::ConstGenVertexPtr ver) const; std::vector< double > m_ID_cylinder_r; std::vector< double > m_ID_cylinder_z; - bool Is_EM_Vertex(HepMC::GenVertex* ver) const; - flag_simul_sate Is_below_v14_truth_cuts_Vertex(HepMC::GenVertex* ver) const; + bool Is_EM_Vertex(HepMC::ConstGenVertexPtr ver) const; + flag_simul_sate Is_below_v14_truth_cuts_Vertex(HepMC::ConstGenVertexPtr ver) const; void MC_remove_out_of_ID(MCdo_simul_state& do_simul_state,const MCparticleCollection& particles) const; void MC_remove_out_of_EM(MCdo_simul_state& do_simul_state,const MCparticleCollection& particles) const; void MC_remove_below_v14_truth_cuts(MCdo_simul_state& do_simul_state,const MCparticleCollection& particles) const; diff --git a/Simulation/FastShower/FastCaloSim/src/FastShowerCellBuilderTool.cxx b/Simulation/FastShower/FastCaloSim/src/FastShowerCellBuilderTool.cxx index 6807a7257de59bd67f4697963a0fcba920321a4c..82a9eb83dd789055e217bc9f6626d77358b778fb 100755 --- a/Simulation/FastShower/FastCaloSim/src/FastShowerCellBuilderTool.cxx +++ b/Simulation/FastShower/FastCaloSim/src/FastShowerCellBuilderTool.cxx @@ -81,15 +81,15 @@ #include <sstream> #include <limits> -typedef std::vector<const HepMC::GenParticle*> MCparticleCollection ; +typedef std::vector<HepMC::ConstGenParticlePtr > MCparticleCollection ; //This is a copy of the previous isGenSimulStable which depended on TruthHelper -bool FastCaloSimIsGenSimulStable(const HepMC::GenParticle* p) { +bool FastCaloSimIsGenSimulStable(HepMC::ConstGenParticlePtr p) { int status=p->status(); auto vertex = p->end_vertex(); // we want to keep primary particle with status==2 but without vertex in HepMC int vertex_barcode=-999999; - if (vertex) vertex_barcode=vertex->barcode(); + if (vertex) vertex_barcode=HepMC::barcode(vertex); return ( (status%1000 == 1) || @@ -1974,7 +1974,7 @@ FastShowerCellBuilderTool::process_particle(CaloCellContainer* theCellContainer, } -bool FastShowerCellBuilderTool::Is_ID_Vertex(HepMC::GenVertex* ver) const +bool FastShowerCellBuilderTool::Is_ID_Vertex(HepMC::ConstGenVertexPtr ver) const { if(ver) { double inr=ver->position().perp(); @@ -1989,17 +1989,20 @@ bool FastShowerCellBuilderTool::Is_ID_Vertex(HepMC::GenVertex* ver) const } } -bool FastShowerCellBuilderTool::Is_EM_Vertex(HepMC::GenVertex* ver) const +bool FastShowerCellBuilderTool::Is_EM_Vertex(HepMC::ConstGenVertexPtr ver) const { if(ver) { +#ifdef HEPMC3 + for(auto par:ver->particles_in()) { +#else for(HepMC::GenVertex::particles_in_const_iterator pin=ver->particles_in_const_begin();pin!=ver->particles_in_const_end();++pin) { const HepMC::GenParticle* par=*pin; +#endif int absid=abs(par->pdg_id()); if(!(absid==11 || absid==22)) return false; } - for(HepMC::GenVertex::particles_out_const_iterator pout=ver->particles_out_const_begin();pout!=ver->particles_out_const_end();++pout) { - const HepMC::GenParticle* par=*pout; - int absid=abs(par->pdg_id()); + for(auto par_out: *ver) { + int absid=std::abs(par_out->pdg_id()); if(!(absid==11 || absid==22)) return false; } } else { @@ -2008,14 +2011,18 @@ bool FastShowerCellBuilderTool::Is_EM_Vertex(HepMC::GenVertex* ver) const return true; } -FastShowerCellBuilderTool::flag_simul_sate FastShowerCellBuilderTool::Is_below_v14_truth_cuts_Vertex(HepMC::GenVertex* ver) const +FastShowerCellBuilderTool::flag_simul_sate FastShowerCellBuilderTool::Is_below_v14_truth_cuts_Vertex(HepMC::ConstGenVertexPtr ver) const { if(ver) { int nin=0; int id_in=0; +#ifdef HEPMC3 + for(auto par_in:ver->particles_in()) { +#else const HepMC::GenParticle* par_in=0; for(HepMC::GenVertex::particles_in_const_iterator pin=ver->particles_in_const_begin();pin!=ver->particles_in_const_end();++pin) { par_in=*pin; +#endif id_in=par_in->pdg_id(); ++nin; } @@ -2024,9 +2031,8 @@ FastShowerCellBuilderTool::flag_simul_sate FastShowerCellBuilderTool::Is_below_v int nele=0; int ngamma=0; int nother=0; - for(HepMC::GenVertex::particles_out_const_iterator pout=ver->particles_out_const_begin();pout!=ver->particles_out_const_end();++pout) { - const HepMC::GenParticle* par=*pout; - int absid=std::abs(par->pdg_id()); + for( auto par_out: *ver) { + int absid=std::abs(par_out->pdg_id()); if(absid==22) { ++ngamma; } else { @@ -2035,7 +2041,7 @@ FastShowerCellBuilderTool::flag_simul_sate FastShowerCellBuilderTool::Is_below_v } ++nout; } - if(abs(id_in)==11 && nout<=2 && nele==1 && nother==0) { + if(std::abs(id_in)==11 && nout<=2 && nele==1 && nother==0) { //Bremsstrahlung, but bremsphoton might not be stored if(par_in->momentum().e()<500) return v14_truth_brems; } @@ -2051,51 +2057,52 @@ FastShowerCellBuilderTool::flag_simul_sate FastShowerCellBuilderTool::Is_below_v typedef FastShowerCellBuilderTool::MCdo_simul_state MCdo_simul_state; typedef FastShowerCellBuilderTool::MCparticleCollection MCparticleCollection ; -typedef FastShowerCellBuilderTool::MCparticleCollectionCIter MCparticleCollectionCIter ; void MC_init_particle_simul_state(MCdo_simul_state& do_simul_state,const MCparticleCollection& particles) { - MCparticleCollectionCIter ip; - for(ip=particles.begin();ip<particles.end();++ip){ - const HepMC::GenParticle* par=*ip; + for(auto par: particles){ if(par) { - do_simul_state[par->barcode()]=1; + do_simul_state[HepMC::barcode(par)]=1; auto outver=par->end_vertex(); auto inver =par->production_vertex(); if(outver) { - do_simul_state[outver->barcode()]=1; + do_simul_state[HepMC::barcode(outver)]=1; } if(inver) { - do_simul_state[inver->barcode()]=1; + do_simul_state[HepMC::barcode(inver)]=1; } } } } -void MC_recursive_remove_out_particles(MCdo_simul_state& do_simul_state,HepMC::GenVertex* ver,FastShowerCellBuilderTool::flag_simul_sate simul_state) +void MC_recursive_remove_out_particles(MCdo_simul_state& do_simul_state,HepMC::ConstGenVertexPtr ver,FastShowerCellBuilderTool::flag_simul_sate simul_state) { if(ver) { - do_simul_state[ver->barcode()]=simul_state; - for(HepMC::GenVertex::particles_out_const_iterator pout=ver->particles_out_const_begin();pout!=ver->particles_out_const_end();++pout) { - const HepMC::GenParticle* par=*pout; - do_simul_state[par->barcode()]=simul_state; - HepMC::GenVertex* outver=par->end_vertex(); + do_simul_state[HepMC::barcode(ver)]=simul_state; + for(auto par_out: *ver) { + do_simul_state[HepMC::barcode(par_out)]=simul_state; + auto outver=par_out->end_vertex(); if(outver) MC_recursive_remove_out_particles(do_simul_state,outver,simul_state); } } } -void MC_recursive_remove_in_particles(MCdo_simul_state& do_simul_state,HepMC::GenVertex* ver,FastShowerCellBuilderTool::flag_simul_sate simul_state) +void MC_recursive_remove_in_particles(MCdo_simul_state& do_simul_state,HepMC::ConstGenVertexPtr ver,FastShowerCellBuilderTool::flag_simul_sate simul_state) { if(ver) { - if(do_simul_state[ver->barcode()]==simul_state) { + if(do_simul_state[HepMC::barcode(ver)]==simul_state) { return; } - do_simul_state[ver->barcode()]=simul_state; + do_simul_state[HepMC::barcode(ver)]=simul_state; +#ifdef HEPMC3 + for(auto par:ver->particles_in()) { +#else + for(HepMC::GenVertex::particles_in_const_iterator pin=ver->particles_in_const_begin();pin!=ver->particles_in_const_end();++pin) { const HepMC::GenParticle* par=*pin; - do_simul_state[par->barcode()]=simul_state; - HepMC::GenVertex* inver=par->production_vertex(); +#endif + do_simul_state[HepMC::barcode(par)]=simul_state; + auto inver=par->production_vertex(); if(inver) MC_recursive_remove_in_particles(do_simul_state,inver,simul_state); } } @@ -2104,20 +2111,22 @@ void MC_recursive_remove_in_particles(MCdo_simul_state& do_simul_state,HepMC::Ge void FastShowerCellBuilderTool::MC_remove_out_of_ID(MCdo_simul_state& do_simul_state,const MCparticleCollection& particles) const { - MCparticleCollectionCIter ip; - for(ip=particles.begin();ip<particles.end();++ip){ - const HepMC::GenParticle* par=*ip; + for(auto par: particles){ if(par) { - if(do_simul_state[par->barcode()]<=0) continue; + if(do_simul_state[HepMC::barcode(par)]<=0) continue; auto inver =par->production_vertex(); if(inver) { if(!Is_ID_Vertex(inver)) { int nin=0; +#ifdef HEPMC3 + for(auto invpar:inver->particles_in()) { +#else for(HepMC::GenVertex::particles_in_const_iterator pin=inver->particles_in_const_begin();pin!=inver->particles_in_const_end();++pin) { const HepMC::GenParticle* invpar=*pin; +#endif if(invpar) { - if(do_simul_state[invpar->barcode()]>0) { + if(do_simul_state[HepMC::barcode(invpar)]>0) { ++nin; break; } @@ -2135,15 +2144,13 @@ void FastShowerCellBuilderTool::MC_remove_out_of_ID(MCdo_simul_state& do_simul_s void FastShowerCellBuilderTool::MC_remove_out_of_EM(MCdo_simul_state& do_simul_state,const MCparticleCollection& particles) const { - MCparticleCollectionCIter ip; - for(ip=particles.begin();ip<particles.end();++ip){ - const HepMC::GenParticle* par=*ip; - if(par) { - if(do_simul_state[par->barcode()]<=0) continue; + for(auto par_out: particles){ + if(par_out) { + if(do_simul_state[HepMC::barcode(par_out)]<=0) continue; - HepMC::GenVertex* outver =par->end_vertex(); + auto outver =par_out->end_vertex(); if(outver) { - if(outver->barcode()>=-200000) continue; + if(HepMC::barcode(outver)>=-200000) continue; if(!Is_EM_Vertex(outver)) { MC_recursive_remove_out_particles(do_simul_state,outver,non_EM_vertex); @@ -2155,15 +2162,13 @@ void FastShowerCellBuilderTool::MC_remove_out_of_EM(MCdo_simul_state& do_simul_s void FastShowerCellBuilderTool::MC_remove_below_v14_truth_cuts(MCdo_simul_state& do_simul_state,const MCparticleCollection& particles) const { - MCparticleCollectionCIter ip; - for(ip=particles.begin();ip<particles.end();++ip){ - const HepMC::GenParticle* par=*ip; - if(par) { - if(do_simul_state[par->barcode()]<=0) continue; + for(auto par_out: particles){ + if(par_out) { + if(do_simul_state[HepMC::barcode(par_out)]<=0) continue; - auto outver =par->end_vertex(); + auto outver =par_out->end_vertex(); if(outver) { - if(outver->barcode()>=-200000) continue; + if(HepMC::barcode(outver)>=-200000) continue; flag_simul_sate reason=Is_below_v14_truth_cuts_Vertex(outver); if(reason<0) { @@ -2176,13 +2181,11 @@ void FastShowerCellBuilderTool::MC_remove_below_v14_truth_cuts(MCdo_simul_state& void MC_remove_decay_to_simul(MCdo_simul_state& do_simul_state,const MCparticleCollection& particles) { - MCparticleCollectionCIter ip; - for(ip=particles.begin();ip<particles.end();++ip){ - const HepMC::GenParticle* par=*ip; - if(par) { - if(do_simul_state[par->barcode()]<=0) continue; + for(auto par_out: particles){ + if(par_out) { + if(do_simul_state[HepMC::barcode(par_out)]<=0) continue; - auto inver =par->production_vertex(); + auto inver =par_out->production_vertex(); if(inver) { MC_recursive_remove_in_particles(do_simul_state,inver,FastShowerCellBuilderTool::mother_particle); } @@ -2254,8 +2257,13 @@ FastShowerCellBuilderTool::process (CaloCellContainer* theCellContainer, if (mcCollptr->size() >0) { +#ifdef HEPMC3 + auto istart = mcCollptr->at(0)->particles().begin(); + auto iend = mcCollptr->at(0)->particles().end(); +#else HepMC::GenEvent::particle_const_iterator istart = mcCollptr->at(0)->particles_begin(); HepMC::GenEvent::particle_const_iterator iend = mcCollptr->at(0)->particles_end(); +#endif for ( ; istart!= iend; ++istart) { particles.push_back(*istart); @@ -2284,40 +2292,38 @@ FastShowerCellBuilderTool::process (CaloCellContainer* theCellContainer, if(m_simul_EM_geant_only) MC_remove_out_of_EM(do_simul_state,particles); MC_remove_decay_to_simul(do_simul_state,particles); - MCparticleCollectionCIter ip; int indpar=0; ATH_MSG_DEBUG("start finding partilces n="<<particles.size()); - for(ip=particles.begin();ip<particles.end();++ip){ - const HepMC::GenParticle* par=*ip; - if(par->pdg_id()==0) do_simul_state[par->barcode()]=pdg_id_unkown; + for(auto par: particles){ + if(par->pdg_id()==0) do_simul_state[HepMC::barcode(par)]=pdg_id_unkown; // Do not treat nuclei - if((!m_simul_heavy_ions) && par->pdg_id() > 1000000000) do_simul_state[par->barcode()]=heavy_ion; + if((!m_simul_heavy_ions) && par->pdg_id() > 1000000000) do_simul_state[HepMC::barcode(par)]=heavy_ion; for(unsigned int i=0;i<m_invisibles.size();++i) { if(abs(par->pdg_id())==m_invisibles[i]) { - do_simul_state[par->barcode()]=invisibleArray; + do_simul_state[HepMC::barcode(par)]=invisibleArray; break; } if(m_invisibles[i]==0) { if(MC::isNonInteracting(par)) { - do_simul_state[par->barcode()]=invisibleTruthHelper; + do_simul_state[HepMC::barcode(par)]=invisibleTruthHelper; break; } } } if(abs(par->pdg_id())==13 && MuonEnergyMap) { - std::pair<BarcodeEnergyDepositMap::const_iterator,BarcodeEnergyDepositMap::const_iterator> range=MuonEnergyMap->equal_range(par->barcode()); + std::pair<BarcodeEnergyDepositMap::const_iterator,BarcodeEnergyDepositMap::const_iterator> range=MuonEnergyMap->equal_range(HepMC::barcode(par)); if(range.first==range.second) { - do_simul_state[par->barcode()]=0; - ATH_MSG_DEBUG("#="<<indpar<<": id="<<par->pdg_id()<<" stat="<<par->status()<<" bc="<<par->barcode() + do_simul_state[HepMC::barcode(par)]=0; + ATH_MSG_DEBUG("#="<<indpar<<": id="<<par->pdg_id()<<" stat="<<par->status()<<" bc="<<HepMC::barcode(par) <<" pt="<<par->momentum().perp()<<" eta="<<par->momentum().eta()<<" phi="<<par->momentum().phi() << " : no calo energy deposit"); } else { if(msgLvl(MSG::DEBUG)) { for(BarcodeEnergyDepositMap::const_iterator i=range.first;i!=range.second;++i) { - msg(MSG::DEBUG)<<"#="<<indpar<<": id="<<par->pdg_id()<<" stat="<<par->status()<<" bc="<<par->barcode() + msg(MSG::DEBUG)<<"#="<<indpar<<": id="<<par->pdg_id()<<" stat="<<par->status()<<" bc="<<HepMC::barcode(par) <<" pt="<<par->momentum().perp()<<" eta="<<par->momentum().eta()<<" phi="<<par->momentum().phi() <<" : layer="<<i->second.sample<<" eta="<<i->second.position.eta()<<" phi="<<i->second.position.phi() <<" d="<<i->second.position.mag(); @@ -2330,16 +2336,16 @@ FastShowerCellBuilderTool::process (CaloCellContainer* theCellContainer, if(msgLvl(MSG::DEBUG)) { std::string reason="---"; - if(do_simul_state[par->barcode()]<=0) { - if(do_simul_state[par->barcode()]==out_of_ID) reason="-ID"; - if(do_simul_state[par->barcode()]==non_EM_vertex) reason="-EM"; - if(do_simul_state[par->barcode()]==heavy_ion) reason="-HI"; - if(do_simul_state[par->barcode()]==pdg_id_unkown) reason="-PI"; - if(do_simul_state[par->barcode()]==invisibleArray) reason="-IA"; - if(do_simul_state[par->barcode()]==invisibleTruthHelper) reason="-IT"; - if(do_simul_state[par->barcode()]==mother_particle) reason="-MO"; - if(do_simul_state[par->barcode()]==v14_truth_brems) reason="-BR"; - if(do_simul_state[par->barcode()]==v14_truth_conv) reason="-CO"; + if(do_simul_state[HepMC::barcode(par)]<=0) { + if(do_simul_state[HepMC::barcode(par)]==out_of_ID) reason="-ID"; + if(do_simul_state[HepMC::barcode(par)]==non_EM_vertex) reason="-EM"; + if(do_simul_state[HepMC::barcode(par)]==heavy_ion) reason="-HI"; + if(do_simul_state[HepMC::barcode(par)]==pdg_id_unkown) reason="-PI"; + if(do_simul_state[HepMC::barcode(par)]==invisibleArray) reason="-IA"; + if(do_simul_state[HepMC::barcode(par)]==invisibleTruthHelper) reason="-IT"; + if(do_simul_state[HepMC::barcode(par)]==mother_particle) reason="-MO"; + if(do_simul_state[HepMC::barcode(par)]==v14_truth_brems) reason="-BR"; + if(do_simul_state[HepMC::barcode(par)]==v14_truth_conv) reason="-CO"; } else { reason="+OK"; } @@ -2351,26 +2357,29 @@ FastShowerCellBuilderTool::process (CaloCellContainer* theCellContainer, if(inver) { double inr=inver->position().perp(); double inz=inver->position().z(); - msg()<<" ; bc="<<inver->barcode()<<" r="<<inr<<" z="<<inz<<" phi="<<inver->position().phi()<<" ; "; + msg()<<" ; bc="<<HepMC::barcode(inver)<<" r="<<inr<<" z="<<inz<<" phi="<<inver->position().phi()<<" ; "; bool sep=false; +#ifdef HEPMC3 + for(auto invpar:inver->particles_in()) { +#else for(HepMC::GenVertex::particles_in_const_iterator pin=inver->particles_in_const_begin();pin!=inver->particles_in_const_end();++pin) { const HepMC::GenParticle* invpar=*pin; +#endif if(invpar) { if(sep) msg()<<","; - msg()<<invpar->barcode(); + msg()<<HepMC::barcode(invpar); sep=true; } } } - msg()<<"->"<<par->barcode(); + msg()<<"->"<<HepMC::barcode(par); if(outver) { msg()<<"->"; bool sep=false; - for(HepMC::GenVertex::particles_out_const_iterator pout=outver->particles_out_const_begin();pout!=outver->particles_out_const_end();++pout) { - const HepMC::GenParticle* outpar=*pout; + for(auto outpar: *outver) { if(outpar) { if(sep) msg()<<","; - msg()<<outpar->barcode(); + msg()<<HepMC::barcode(outpar); sep=true; } } @@ -2378,7 +2387,7 @@ FastShowerCellBuilderTool::process (CaloCellContainer* theCellContainer, msg()<<endmsg; } - if(do_simul_state[par->barcode()]<=0) { + if(do_simul_state[HepMC::barcode(par)]<=0) { continue; } @@ -2401,25 +2410,22 @@ FastShowerCellBuilderTool::process (CaloCellContainer* theCellContainer, fastShowerInfoContainer = std::make_unique<FastShowerInfoContainer>(); } - MCparticleCollectionCIter fpart = Simulparticles.begin(); - MCparticleCollectionCIter lpart = Simulparticles.end(); - Stats stats; int stat_npar=0; int stat_npar_OK=0; int stat_npar_nOK=0; - for(MCparticleCollectionCIter part=fpart;part<lpart;++part) { + for(auto part: Simulparticles) { - std::vector<Trk::HitInfo>* hitVector = caloHits(*(*part)); + std::vector<Trk::HitInfo>* hitVector = caloHits(*part); - Amg::Vector3D mom((*part)->momentum().x(),(*part)->momentum().y(),(*part)->momentum().z()); + Amg::Vector3D mom(part->momentum().x(),part->momentum().y(),part->momentum().z()); if(process_particle(theCellContainer, hitVector, mom, - (*part)->generated_mass(), - (*part)->pdg_id(), - (*part)->barcode(), + part->generated_mass(), + part->pdg_id(), + HepMC::barcode(part), fastShowerInfoContainer.get(), rndm, stats, diff --git a/TileCalorimeter/TileSimAlgs/python/TileDigitsGetter.py b/TileCalorimeter/TileSimAlgs/python/TileDigitsGetter.py index f63cbfd73bd28d51485be565172ccfe73b403b2c..0d940792485799641310aa9231faf52a62f11cb0 100644 --- a/TileCalorimeter/TileSimAlgs/python/TileDigitsGetter.py +++ b/TileCalorimeter/TileSimAlgs/python/TileDigitsGetter.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration # Author: J. Poveda (Ximo.Poveda@cern.ch) # TileDigits creation from TileHit @@ -64,7 +64,10 @@ class TileDigitsGetter ( Configured ) : theTileDigitsMaker.CalibrationRun=False # Save integer numbers in digits vector if not pile-up premixing - theTileDigitsMaker.IntegerDigits = not digitizationFlags.PileUpPremixing() + theTileDigitsMaker.IntegerDigits = not digitizationFlags.PileUpPremixing() + + from TileConditions.TileConditionsConf import TileCondToolNoiseSample + theTileDigitsMaker.TileCondToolNoiseSample = TileCondToolNoiseSample (TileOnlineSampleNoise = '') # sets output key if digitizationFlags.PileUpPremixing and 'OverlayMT' in digitizationFlags.experimentalDigi(): diff --git a/TileCalorimeter/TileSimAlgs/share/TileDigiCommon_jobOptions.py b/TileCalorimeter/TileSimAlgs/share/TileDigiCommon_jobOptions.py index 7f4997c3b43b6ce5e066aa7c59d5bfb3776c37ae..98d2650d2b2c60fa6c4981aa36c98d2a180a8e14 100644 --- a/TileCalorimeter/TileSimAlgs/share/TileDigiCommon_jobOptions.py +++ b/TileCalorimeter/TileSimAlgs/share/TileDigiCommon_jobOptions.py @@ -157,6 +157,7 @@ if doTileDigitToRawChannel: theTileRawChannelGetter_DigiHSTruth.TileRawChannelContainer = "TileRawChannelCnt_DigiHSTruth" TileRChMaker = theTileRawChannelGetter.TileRChMaker() + if digitizationFlags.PileUpPremixing and 'OverlayMT' in digitizationFlags.experimentalDigi(): TileRChMaker.TileDigitsContainer = overlayFlags.bkgPrefix() + 'TileDigitsCnt' diff --git a/TileCalorimeter/TileSimAlgs/share/TileMuonReceiver_jobOptions.py b/TileCalorimeter/TileSimAlgs/share/TileMuonReceiver_jobOptions.py index 5137a1aaf6bff61e3a9698721c6a78fcc3de95ca..74e380ace937e2d20815a9b0ffec09686474ae7a 100644 --- a/TileCalorimeter/TileSimAlgs/share/TileMuonReceiver_jobOptions.py +++ b/TileCalorimeter/TileSimAlgs/share/TileMuonReceiver_jobOptions.py @@ -1,5 +1,5 @@ # -# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration # # **************************************************************************** @@ -45,13 +45,15 @@ from AthenaCommon.AlgSequence import AlgSequence topSequence = AlgSequence() # Set up TilePulseForTileMuonReceiver +from TileConditions.TileConditionsConf import TileCondToolNoiseSample topSequence += CfgMgr.TilePulseForTileMuonReceiver('TilePulseForTileMuonReceiver' # , OutputLevel = VERBOSE , IntegerDigits = not jobproperties.Digitization.PileUpPremixing() , UseCoolPedestal = False , UseCoolPulseShapes = True , TileCondToolPulseShape = TileCondToolMuRcvPulseShape - , TileRawChannelBuilderMF = TileMuRcvRawChannelBuilderMF) + , TileRawChannelBuilderMF = TileMuRcvRawChannelBuilderMF + , TileCondToolNoiseSample = TileCondToolNoiseSample (TileOnlineSampleNoise = '')) if jobproperties.Digitization.PileUpPremixing and 'OverlayMT' in jobproperties.Digitization.experimentalDigi(): from OverlayCommonAlgs.OverlayFlags import overlayFlags topSequence.TilePulseForTileMuonReceiver.MuonReceiverDigitsContainer = overlayFlags.bkgPrefix() + "MuRcvDigitsCnt" diff --git a/Tools/AthDataQuality/test/test_dqconfig.sh b/Tools/AthDataQuality/test/test_dqconfig.sh index c0b57d28f608ea72b77d0cb91d47f7eb3c76f42c..f2fbee9d8c16e875e0af4659f653f79fa4601516 100755 --- a/Tools/AthDataQuality/test/test_dqconfig.sh +++ b/Tools/AthDataQuality/test/test_dqconfig.sh @@ -5,25 +5,6 @@ # art-ci: 21.0 # art-include: 21.0/AthDataQuality -#Check the hcfg file for git hash -check_hcfg_hash() -{ - hcfg_file=$1 - - grep -q "hash = $" /tmp/hcfg_out.txt - if [ $? -eq 0 ]; then - return 1 - fi -} -#check that the config file contains no histograms in top_level -check_hcfg_top_level() -{ - hcfg_file=$1 - grep -q "BEGIN ASSESSMENTS of \"top_level\"" /tmp/hcfg_out.txt - if [ $? -eq 0 ]; then - return 1 - fi -} #Run a test webdisplay of the new config run_test_display() { @@ -41,7 +22,7 @@ run_test() if [[ $hcfg_dir == "" ]]; then echo hcfg path not found echo Tests failed - return 0 + return 1 fi cd $hcfg_dir @@ -80,7 +61,7 @@ run_test() fi echo Tests passed - return 1 + return 0 } run_test diff --git a/Tools/PROCTools/data/master_q221_AOD_digest.ref b/Tools/PROCTools/data/master_q221_AOD_digest.ref index 4be2ccf40c734f8bf20a03c125c1d702945a66f5..8b781f017800f6471fc9c3e442e398e80285782f 100644 --- a/Tools/PROCTools/data/master_q221_AOD_digest.ref +++ b/Tools/PROCTools/data/master_q221_AOD_digest.ref @@ -1,26 +1,26 @@ run event nTopo nIdTracks nJets nMuons nElec nTrueElec nFakeElec nPhot nTruePhot nFakePhot 284500 87473001 118 128 4 1 9 2 7 7 4 3 284500 87473014 85 80 6 0 9 1 8 7 4 3 - 284500 87473022 38 29 4 0 5 1 4 4 3 1 + 284500 87473022 38 29 4 0 5 1 4 3 2 1 284500 87473032 27 33 4 1 9 4 5 2 1 1 - 284500 87473037 60 39 7 0 11 2 9 5 3 2 - 284500 87473040 101 94 9 0 17 1 16 6 4 2 - 284500 87473051 142 110 12 1 13 1 12 23 16 7 + 284500 87473037 60 39 7 0 10 2 8 6 4 2 + 284500 87473040 101 96 9 0 17 1 16 7 4 3 + 284500 87473051 142 112 12 1 13 1 12 23 16 7 284500 87473063 62 76 5 2 6 2 4 6 4 2 284500 87473068 26 35 1 1 0 0 0 0 0 0 - 284500 87473075 72 84 6 0 5 0 5 5 4 1 - 284500 87473084 83 85 7 2 14 1 13 10 5 5 + 284500 87473075 72 85 6 0 5 0 5 5 4 1 + 284500 87473084 83 86 7 2 15 1 14 9 4 5 284500 87473091 43 49 3 0 2 1 1 5 2 3 - 284500 87473096 72 75 3 2 2 0 2 3 2 1 + 284500 87473096 72 76 3 2 2 0 2 3 2 1 284500 87473104 61 63 6 0 6 1 5 5 4 1 - 284500 87473114 93 79 7 2 13 1 12 8 5 3 + 284500 87473114 93 78 7 2 13 1 12 8 5 3 284500 87473121 93 100 6 3 16 4 12 6 5 1 284500 87473132 81 60 9 1 10 0 10 5 5 0 284500 87473137 81 71 8 3 15 0 15 6 6 0 - 284500 87473144 83 69 7 1 6 0 6 8 5 3 - 284500 87473154 89 88 7 0 9 1 8 8 4 4 + 284500 87473144 83 67 7 1 6 0 6 8 5 3 + 284500 87473154 89 88 7 0 10 2 8 8 4 4 284500 87473162 52 52 3 0 7 0 7 3 2 1 284500 87473167 74 54 6 3 12 2 10 13 8 5 284500 87473171 82 70 8 3 4 2 2 5 3 2 - 284500 87473184 74 87 5 2 7 1 6 9 5 4 + 284500 87473184 74 86 5 2 7 1 6 9 5 4 284500 87473192 54 52 4 1 7 4 3 5 4 1 diff --git a/Tools/PROCTools/data/master_q431_AOD_digest.ref b/Tools/PROCTools/data/master_q431_AOD_digest.ref index 4de62b1e01b98efc8f62b86ac595a27fd377a122..ca6ae0b120c9fb784d931f82a897cee95cbf8370 100644 --- a/Tools/PROCTools/data/master_q431_AOD_digest.ref +++ b/Tools/PROCTools/data/master_q431_AOD_digest.ref @@ -1,12 +1,12 @@ run event nTopo nIdTracks nJets nMuons 330470 1183722158 1 0 0 0 - 330470 1183722342 394 414 20 0 - 330470 1183727953 532 571 13 4 - 330470 1183732647 467 452 13 1 + 330470 1183722342 394 415 18 0 + 330470 1183727953 532 570 13 4 + 330470 1183732647 467 452 12 1 330470 1183733040 381 285 6 1 330470 1183734651 361 363 14 3 330470 1183735332 406 372 9 1 - 330470 1183736475 741 652 17 2 + 330470 1183736475 741 654 17 3 330470 1183738728 1 0 0 0 330470 1183738949 368 419 9 1 330470 1183742489 152 125 2 1 @@ -19,7 +19,7 @@ 330470 1183754806 470 406 14 0 330470 1183769295 342 317 8 1 330470 1183769939 348 341 11 3 - 330470 1183773832 307 197 7 0 + 330470 1183773832 307 198 7 0 330470 1183775209 57 0 0 0 330470 1183787124 431 361 11 2 330470 1183787946 321 310 5 1 diff --git a/Tools/PROCTools/python/RunTier0TestsTools.py b/Tools/PROCTools/python/RunTier0TestsTools.py index 7c55c782bfa0e829e17e75d65bd3ab5caeeef0c5..1550daabc9b3abedf19379469f004816cf949755 100644 --- a/Tools/PROCTools/python/RunTier0TestsTools.py +++ b/Tools/PROCTools/python/RunTier0TestsTools.py @@ -28,7 +28,7 @@ ciRefFileMap = { 's3505-22.0' : 'v5', # OverlayTier0Test_required-test 'overlay-d1498-21.0' : 'v2', - 'overlay-d1498-22.0' : 'v32', + 'overlay-d1498-22.0' : 'v33', 'overlay-bkg-21.0' : 'v1', 'overlay-bkg-22.0' : 'v4', } diff --git a/Tools/PathResolver/Root/PathResolver.cxx b/Tools/PathResolver/Root/PathResolver.cxx index 3f8361b21cf55f870544cd18cc31a7f9f6712626..e531ba8b46e0bdf586f95f1a266d52029b5cda8d 100644 --- a/Tools/PathResolver/Root/PathResolver.cxx +++ b/Tools/PathResolver/Root/PathResolver.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "PathResolver/PathResolver.h" @@ -203,6 +203,12 @@ PathResolver::find_file(const std::string& logical_file_name, System::getEnv(search_path, path_list); #endif +#ifndef XAOD_ANALYSIS + if (!logical_file_name.empty() && logical_file_name[0]=='/') { + msg(MSG::ERROR) << "Use of an absolute file name: " << logical_file_name << endmsg; + } +#endif + return (find_file_from_list (logical_file_name, path_list, search_type)); } diff --git a/Tools/PathResolver/test/PathResolver.xml b/Tools/PathResolver/test/PathResolver.xml deleted file mode 100644 index 87c9745b2369f70ce4dee30cc36dfb41a6f0bf73..0000000000000000000000000000000000000000 --- a/Tools/PathResolver/test/PathResolver.xml +++ /dev/null @@ -1,16 +0,0 @@ -<?xml version="1.0"?> -<atn> - <TEST name="PathResolverTest" type="makecheck" suite="Examples"> - <package>Tools/PathResolver</package> - <timelimit>40</timelimit> - <author> Paolo Calafiura </author> - <mailto> pcalafiura@lbl.gov, snyder@bnl.gov, binet@cern.ch</mailto> - <expectations> - <errorMessage>Athena exited abnormally</errorMessage> - <errorMessage>differ</errorMessage> - <warningMessage> # WARNING_MESSAGE : post.sh> ERROR</warningMessage> - <successMessage>check ok</successMessage> - <returnValue>0</returnValue> - </expectations> - </TEST> -</atn> diff --git a/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/Surface.h b/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/Surface.h index 9d0bfc4c8f50119f7c218f60667e25ff8e67fac9..e7fb5be7fc50a37590237962276f38eee6515f79 100644 --- a/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/Surface.h +++ b/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/Surface.h @@ -16,10 +16,10 @@ #include "TrkEventPrimitives/LocalParameters.h" #include "TrkEventPrimitives/ParamDefs.h" #include "TrkEventPrimitives/PropDirection.h" +#include "TrkEventPrimitives/SurfaceUniquePtrT.h" #include "TrkParametersBase/Charged.h" #include "TrkParametersBase/Neutral.h" #include "TrkParametersBase/ParametersBase.h" -#include "TrkParametersBase/SurfaceUniquePtrT.h" #include "TrkSurfaces/BoundaryCheck.h" #include "TrkSurfaces/DistanceSolution.h" // Amg diff --git a/Tracking/TrkEvent/TrkCaloClusterROI/src/CaloClusterROI.cxx b/Tracking/TrkEvent/TrkCaloClusterROI/src/CaloClusterROI.cxx index d5c714aafc8e46289176a6cab86626b04548d0c3..f0ef20cc0fababfb93fa1a9b6a81732f8fd203ea 100644 --- a/Tracking/TrkEvent/TrkCaloClusterROI/src/CaloClusterROI.cxx +++ b/Tracking/TrkEvent/TrkCaloClusterROI/src/CaloClusterROI.cxx @@ -24,7 +24,6 @@ Trk::CaloClusterROI::CaloClusterROI( const Trk::LocalParameters* locpars, m_etaWidth( widtheta ) { m_surface = surface.isFree() ? surface.clone() : &surface; - this->globalPosition(); } // Destructor: @@ -78,11 +77,10 @@ Trk::CaloClusterROI& Trk::CaloClusterROI::operator=(const Trk::CaloClusterROI& c Amg::Vector3D Trk::CaloClusterROI::globalPosition() const { if(m_localParams){ - std::unique_ptr<const Amg::Vector3D> tmp_global(m_surface->localToGlobal(*m_localParams)); - return *tmp_global; // return "copy" + return m_surface->localToGlobalPos(*m_localParams); } if(m_surface){ - return Amg::Vector3D(m_surface->center()); + return m_surface->center(); } return Amg::Vector3D(); } diff --git a/Tracking/TrkEvent/TrkParametersBase/TrkParametersBase/SurfaceUniquePtrT.h b/Tracking/TrkEvent/TrkEventPrimitives/TrkEventPrimitives/SurfaceUniquePtrT.h similarity index 79% rename from Tracking/TrkEvent/TrkParametersBase/TrkParametersBase/SurfaceUniquePtrT.h rename to Tracking/TrkEvent/TrkEventPrimitives/TrkEventPrimitives/SurfaceUniquePtrT.h index bf72b97f5c5e11fb7bc88ecb7d71dcf755c98f13..6d6cca610f9820eae328a7886535a75b1a98d9d9 100644 --- a/Tracking/TrkEvent/TrkParametersBase/TrkParametersBase/SurfaceUniquePtrT.h +++ b/Tracking/TrkEvent/TrkEventPrimitives/TrkEventPrimitives/SurfaceUniquePtrT.h @@ -13,13 +13,11 @@ */ -#ifndef TRKPARAMETERSBASE_SURFACEUNIQUEPTRT_H -#define TRKPARAMETERSBASE_SURFACEUNIQUEPTRT_H - +#ifndef TRKEVENTPRIMITIVES_SURFACEUNIQUEPTRT_H +#define TRKEVENTPRIMITIVES_SURFACEUNIQUEPTRT_H namespace Trk { - template <class S> class SurfaceDeleter { @@ -29,12 +27,9 @@ public: } }; - template <class S> using SurfaceUniquePtrT = std::unique_ptr<S, SurfaceDeleter<S> >; - } // namespace Trk - -#endif // not TRKPARAMETERSBASE_SURFACEUNIQUEPTRT_H +#endif diff --git a/Tracking/TrkEvent/TrkParametersBase/TrkParametersBase/CurvilinearParametersT.h b/Tracking/TrkEvent/TrkParametersBase/TrkParametersBase/CurvilinearParametersT.h index 718216f5848dc4ba5387ec42981de17b7ef1511a..4c725f27ef6e9757124ce69bdb948ef8f9392632 100644 --- a/Tracking/TrkEvent/TrkParametersBase/TrkParametersBase/CurvilinearParametersT.h +++ b/Tracking/TrkEvent/TrkParametersBase/TrkParametersBase/CurvilinearParametersT.h @@ -9,17 +9,14 @@ #ifndef TRKPARAMETERSBASE_CURVILINEARPARAMETERS_T_H #define TRKPARAMETERSBASE_CURVILINEARPARAMETERS_T_H -// STL -#include <memory> +#include "TrkParametersBase/ParametersBase.h" -// Amg #include "EventPrimitives/EventPrimitives.h" #include "GeoPrimitives/GeoPrimitives.h" -// Tracking includes #include "TrkEventPrimitives/CurvilinearUVT.h" -#include "TrkParametersBase/ParametersBase.h" -#include "TrkParametersBase/SurfaceUniquePtrT.h" +#include "TrkEventPrimitives/SurfaceUniquePtrT.h" +#include <memory> class MsgStream; namespace Trk { diff --git a/Tracking/TrkEvent/TrkParametersBase/TrkParametersBase/ParametersT.h b/Tracking/TrkEvent/TrkParametersBase/TrkParametersBase/ParametersT.h index 422614b040054b247ba6560be39b8b81da400e5d..348e3ad828166cbf5699ae832088770082b6ac67 100644 --- a/Tracking/TrkEvent/TrkParametersBase/TrkParametersBase/ParametersT.h +++ b/Tracking/TrkEvent/TrkParametersBase/TrkParametersBase/ParametersT.h @@ -9,12 +9,10 @@ #ifndef TRKPARAMETERSBASE_PARAMETERS_T_H #define TRKPARAMETERSBASE_PARAMETERS_T_H -// Trk includes #include "TrkParametersBase/ParametersBase.h" -// Amg #include "EventPrimitives/EventPrimitives.h" #include "GeoPrimitives/GeoPrimitives.h" -#include "TrkParametersBase/SurfaceUniquePtrT.h" +#include "TrkEventPrimitives/SurfaceUniquePtrT.h" /* * Needed for persistency diff --git a/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/IMultiStateExtrapolator.h b/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/IMultiStateExtrapolator.h index d7e0a75b14615ed3233ec68643e91279fddb49f9..3d2d7084c795959a9dcc744144a6aa63a7ded006 100644 --- a/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/IMultiStateExtrapolator.h +++ b/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/IMultiStateExtrapolator.h @@ -75,6 +75,8 @@ public: * * The is owned by the tools that call the extrapolatator (Currently the GSFSmoother or Forward fitter) * and it not exposed to the caller of the track fitter. + * Caller of the GSF Extrapolator is needs to ensure that there is one cache per thread + * to ensure thread safety. * */ struct Cache { diff --git a/Tracking/TrkFitter/TrkGaussianSumFilter/src/GsfMaterialMixtureConvolutionLM.cxx b/Tracking/TrkFitter/TrkGaussianSumFilter/src/GsfMaterialMixtureConvolutionLM.cxx index 3f8405742c5811a5d415ed0fcc7d8097ba3fd43f..6a1e0184f32ee99f44229d99322a1f9e66e8696b 100644 --- a/Tracking/TrkFitter/TrkGaussianSumFilter/src/GsfMaterialMixtureConvolutionLM.cxx +++ b/Tracking/TrkFitter/TrkGaussianSumFilter/src/GsfMaterialMixtureConvolutionLM.cxx @@ -250,12 +250,13 @@ Trk::MultiComponentState Trk::GsfMaterialMixtureConvolutionLM::update( direction, particleHypothesis); - // check all vectors have the same size + // check vectors have the same size if (caches[i].weights.size() != caches[i].deltaPs.size()) { ATH_MSG_ERROR("Inconsistent number of components in the updator!!! no material effect will be applied"); caches[i].resetAndAddDummyValues(); } + // Apply material effects to input state and store results in cache for( size_t j(0); j < caches[i].weights.size(); ++j){ if (measuredCov) { caches[i].deltaCovariances[j] += *measuredCov; @@ -271,8 +272,12 @@ Trk::MultiComponentState Trk::GsfMaterialMixtureConvolutionLM::update( } // Store component weight caches[i].weights[j] *= inputState[i].second; + // Ensure weight of component is not too small to save us from potential FPE's + // Value chosen to be sufficiently small so that the final state will not be impacted + if( caches[i].weights[j] < 1e-12 ){ + caches[i].weights[j] = 1e-12; + } } - n += caches[i].weights.size(); } @@ -294,15 +299,15 @@ Trk::MultiComponentState Trk::GsfMaterialMixtureConvolutionLM::update( if( !measuredCov ){ componentWithoutMeasurement = true; } + components[k].mean = caches[i].deltaParameters[j][Trk::qOverP]; components[k].cov = cov; components[k].invCov = cov > 0 ? 1. / cov : 1e10; - components[k].weight = caches[i].weights[j] ; + components[k].weight = caches[i].weights[j]; indices[k] = {i,j}; ++k; } } - if(componentWithoutMeasurement){ auto result = std::max_element(components.begin(), @@ -350,38 +355,47 @@ Trk::MultiComponentState Trk::GsfMaterialMixtureConvolutionLM::update( std::vector<bool> isMerged( n, false); for (const auto& mergePair : merges) { const int32_t mini = mergePair.first; - const int32_t minj = mergePair.second; - - - - // Build the first TP + const int32_t minj = mergePair.second; + if( isMerged[minj] ){ + ATH_MSG_WARNING( "Component is already merged " << minj); + for (const auto& mergePair2 : merges) { + ATH_MSG_DEBUG( "Pairs that should be merged together: " << mergePair2.first << " "<< mergePair2.second ); + } + continue; + } + // Get the first TP size_t stateIndex = indices[mini].first; size_t materialIndex = indices[mini].second; AmgVector(5)& stateVector = caches[stateIndex].deltaParameters[materialIndex]; AmgSymMatrix(5)& measuredCov = caches[stateIndex].deltaCovariances[materialIndex]; - // Build the second TP + // Get the second TP size_t stateIndex2 = indices[minj].first; size_t materialIndex2 = indices[minj].second; + // Some values for sanity checks ++nMerges; - + isMerged[minj] = true; + + // Copy weight and first parameters as they are needed later on const AmgVector(5) firstParameters = stateVector; const double firstWeight = caches[stateIndex].weights[materialIndex]; - + + // Update first parameters and weight Trk::MultiComponentStateCombiner::combineParametersWithWeight( caches[stateIndex].deltaParameters[materialIndex], caches[stateIndex].weights[materialIndex], caches[stateIndex2].deltaParameters[materialIndex2], caches[stateIndex2].weights[materialIndex2] ); - + // Update first cov Trk::MultiComponentStateCombiner::combineCovWithWeight( firstParameters, measuredCov, firstWeight, caches[stateIndex2].deltaParameters[materialIndex2], caches[stateIndex2].deltaCovariances[materialIndex2], caches[stateIndex2].weights[materialIndex2] ); - - isMerged[minj] = true; + + + // Reset 2nd parameters values just for clarity caches[stateIndex2].deltaParameters[materialIndex2].setZero(); caches[stateIndex2].deltaCovariances[materialIndex2].setZero(); @@ -413,7 +427,7 @@ Trk::MultiComponentState Trk::GsfMaterialMixtureConvolutionLM::update( } if( nMerges + assemblerCache.multiComponentState.size() != n ){ - ATH_MSG_ERROR("Combining complete but merger size is incompatible: " << n << " " << nMerges << " " << assemblerCache.multiComponentState.size() ); + ATH_MSG_WARNING("Combining complete but merger size is incompatible: " << n << " " << nMerges << " " << assemblerCache.multiComponentState.size() ); } // Check all weights diff --git a/Tracking/TrkVertexFitter/TrkVKalVrtFitter/TrkVKalVrtFitter/ITrkVKalVrtFitter.h b/Tracking/TrkVertexFitter/TrkVKalVrtFitter/TrkVKalVrtFitter/ITrkVKalVrtFitter.h index a2cf878f004f989fef872eabaa24fa39445f7f2a..c9dd4ea722f8c75c5e7b9ea7e01ecbdb3ac142a4 100755 --- a/Tracking/TrkVertexFitter/TrkVKalVrtFitter/TrkVKalVrtFitter/ITrkVKalVrtFitter.h +++ b/Tracking/TrkVertexFitter/TrkVKalVrtFitter/TrkVKalVrtFitter/ITrkVKalVrtFitter.h @@ -10,8 +10,7 @@ //--------------------------------------------------------------- #ifndef TRKVKALVRTFITTER_ITRKVKALVRTFITTER_H #define TRKVKALVRTFITTER_ITRKVKALVRTFITTER_H -// Normal STL and physical vectors -#include <vector> +//Pphysical vectors #include "GeoPrimitives/GeoPrimitives.h" #include "EventPrimitives/EventPrimitives.h" // Gaudi includes @@ -21,11 +20,11 @@ // #include "TrkVKalVrtFitter/IVKalState.h" #include "TrkTrack/Track.h" -#include "TrkParticleBase/TrackParticleBase.h" #include "xAODTracking/TrackParticleContainer.h" #include "xAODTracking/NeutralParticleContainer.h" #include "xAODTracking/VertexContainer.h" +#include <vector> namespace MagField{ class IMagFieldSvc; } @@ -33,9 +32,7 @@ namespace MagField{ namespace Trk{ - - class IExtrapolator; - +class IExtrapolator; //------------------------------------------------------------------------ static const InterfaceID IID_ITrkVKalVrtFitter("ITrkVKalVrtFitter", 1, 0); @@ -52,78 +49,84 @@ namespace Trk{ virtual std::unique_ptr<IVKalState> makeState(const EventContext& ctx) const = 0; /* - * For non-migrated clients whcih should always use the context aware method + * For non-migrated clients which should always use the context aware method */ - virtual std::unique_ptr<IVKalState> makeState() const - { - return makeState(Gaudi::Hive::currentContext()); - } - - - virtual StatusCode VKalVrtFit(const std::vector<const xAOD::TrackParticle*> & listC, - const std::vector<const xAOD::NeutralParticle*> & listN, - Amg::Vector3D& Vertex, - TLorentzVector& Momentum, - long int& Charge, - std::vector<double>& ErrorMatrix, - std::vector<double>& Chi2PerTrk, - std::vector< std::vector<double> >& TrkAtVrt, - double& Chi2, - IVKalState& istate, - bool ifCovV0 = false) const =0; - virtual StatusCode VKalVrtFit(const std::vector<const Track*> & list, - Amg::Vector3D& Vertex, - TLorentzVector& Momentum, - long int& Charge, - std::vector<double>& ErrorMatrix, - std::vector<double>& Chi2PerTrk, - std::vector< std::vector<double> >& TrkAtVrt, - double& Chi2, - IVKalState& istate, - bool ifCovV0 = false) const =0; - virtual StatusCode VKalVrtFit(const std::vector<const TrackParticleBase*> & list, - Amg::Vector3D& Vertex, - TLorentzVector& Momentum, - long int& Charge, - std::vector<double>& ErrorMatrix, - std::vector<double>& Chi2PerTrk, - std::vector< std::vector<double> >& TrkAtVrt, - double& Chi2, - IVKalState& istate, - bool ifCovV0 = false) const =0; - virtual StatusCode VKalVrtFit(const std::vector<const TrackParameters*> & listC, - const std::vector<const NeutralParameters*>& listN, - Amg::Vector3D& Vertex, - TLorentzVector& Momentum, - long int& Charge, - std::vector<double>& ErrorMatrix, - std::vector<double>& Chi2PerTrk, - std::vector< std::vector<double> >& TrkAtVrt, - double& Chi2, - IVKalState& istate, - bool ifCovV0 = false) const =0; -//------ + virtual std::unique_ptr<IVKalState> makeState() const + { + return makeState(Gaudi::Hive::currentContext()); + } + + virtual StatusCode VKalVrtFit( + const std::vector<const xAOD::TrackParticle*>& listC, + const std::vector<const xAOD::NeutralParticle*>& listN, + Amg::Vector3D& Vertex, + TLorentzVector& Momentum, + long int& Charge, + std::vector<double>& ErrorMatrix, + std::vector<double>& Chi2PerTrk, + std::vector<std::vector<double>>& TrkAtVrt, + double& Chi2, + IVKalState& istate, + bool ifCovV0 = false) const = 0; + + virtual StatusCode VKalVrtFit(const std::vector<const Track*>& list, + Amg::Vector3D& Vertex, + TLorentzVector& Momentum, + long int& Charge, + std::vector<double>& ErrorMatrix, + std::vector<double>& Chi2PerTrk, + std::vector<std::vector<double>>& TrkAtVrt, + double& Chi2, + IVKalState& istate, + bool ifCovV0 = false) const = 0; + + virtual StatusCode VKalVrtFit( + const std::vector<const TrackParameters*>& listC, + const std::vector<const NeutralParameters*>& listN, + Amg::Vector3D& Vertex, + TLorentzVector& Momentum, + long int& Charge, + std::vector<double>& ErrorMatrix, + std::vector<double>& Chi2PerTrk, + std::vector<std::vector<double>>& TrkAtVrt, + double& Chi2, + IVKalState& istate, + bool ifCovV0 = false) const = 0; + + //------ virtual StatusCode VKalVrtCvtTool(const Amg::Vector3D& Vertex, - const TLorentzVector& Momentum, - const std::vector<double>& CovVrtMom, - const long int& Charge, - std::vector<double>& Perigee, - std::vector<double>& CovPerigee, - IVKalState& istate) const =0; -//......................................................................................... - virtual StatusCode VKalVrtFitFast(const std::vector<const Track*>& list,Amg::Vector3D& Vertex, IVKalState& istate) const =0; - virtual StatusCode VKalVrtFitFast(const std::vector<const xAOD::TrackParticle*>& list, Amg::Vector3D& Vertex, IVKalState& istate) const =0; - virtual StatusCode VKalVrtFitFast(const std::vector<const TrackParticleBase*>& list, Amg::Vector3D& Vertex, IVKalState& istate) const =0; - virtual StatusCode VKalVrtFitFast(const std::vector<const TrackParameters*>& list, Amg::Vector3D& Vertex, IVKalState& istate) const =0; -//......................................................................................... - - - virtual Track* CreateTrkTrack(const std::vector<double>& VKPerigee, const std::vector<double>& VKCov, const IVKalState& istate) const =0; + const TLorentzVector& Momentum, + const std::vector<double>& CovVrtMom, + const long int& Charge, + std::vector<double>& Perigee, + std::vector<double>& CovPerigee, + IVKalState& istate) const = 0; + //......................................................................................... + + virtual StatusCode VKalVrtFitFast(const std::vector<const Track*>& list, + Amg::Vector3D& Vertex, + IVKalState& istate) const = 0; + virtual StatusCode VKalVrtFitFast( + const std::vector<const xAOD::TrackParticle*>& list, + Amg::Vector3D& Vertex, + IVKalState& istate) const = 0; + + virtual StatusCode VKalVrtFitFast( + const std::vector<const TrackParameters*>& list, + Amg::Vector3D& Vertex, + IVKalState& istate) const = 0; + //......................................................................................... + + virtual Track* CreateTrkTrack(const std::vector<double>& VKPerigee, + const std::vector<double>& VKCov, + const IVKalState& istate) const = 0; virtual StatusCode VKalGetTrkWeights(std::vector<double>& Weights, - const IVKalState& istate) const =0; + const IVKalState& istate) const = 0; + virtual StatusCode VKalGetFullCov(long int, std::vector<double>& CovMtx, const IVKalState& istate, bool = false) const =0; + virtual StatusCode VKalGetMassError(double& Mass, double& MassError, const IVKalState& istate) const =0; @@ -131,45 +134,56 @@ namespace Trk{ IVKalState& istate) const =0; virtual void setMassForConstraint(double, IVKalState& istate) const =0; + virtual void setMassForConstraint(double, const std::vector<int>&, IVKalState& istate) const =0; + virtual void setRobustness(int, IVKalState& istate) const =0; + virtual void setRobustScale(double, IVKalState& istate) const =0; + virtual void setCnstType(int, IVKalState& istate) const =0; + virtual void setVertexForConstraint(const xAOD::Vertex &, IVKalState& istate) const=0; + virtual void setVertexForConstraint(double,double,double, IVKalState& istate) const =0; + virtual void setCovVrtForConstraint(double,double,double, double,double,double, IVKalState& istate) const=0; + virtual void setMassInputParticles( const std::vector<double>&, IVKalState& istate) const=0; -// -// Interface with ATLAS reconstruction software -// -// virtual void setAthenaField(MagField::IMagFieldSvc*)=0; -// virtual void setAthenaPropagator(const IExtrapolator*)=0; //---------------------------------------------------------------------------------------------------- - virtual double VKalGetImpact(const xAOD::TrackParticle*,const Amg::Vector3D& Vertex, const long int Charge, - std::vector<double>& Impact,std::vector<double>& ImpactError, - IVKalState& istate) const = 0; - virtual double VKalGetImpact(const TrackParticleBase*,const Amg::Vector3D& Vertex, const long int Charge, - std::vector<double>& Impact,std::vector<double>& ImpactError, - IVKalState& istate) const = 0; - virtual double VKalGetImpact(const Track*,const Amg::Vector3D& Vertex, const long int Charge, - std::vector<double>& Impact,std::vector<double>& ImpactError, + virtual double VKalGetImpact(const xAOD::TrackParticle*, + const Amg::Vector3D& Vertex, + const long int Charge, + std::vector<double>& Impact, + std::vector<double>& ImpactError, IVKalState& istate) const = 0; - virtual double VKalGetImpact(const xAOD::TrackParticle*,const Amg::Vector3D& Vertex, const long int Charge, - std::vector<double>& Impact,std::vector<double>& ImpactError) const = 0; - virtual double VKalGetImpact(const TrackParticleBase*,const Amg::Vector3D& Vertex, const long int Charge, - std::vector<double>& Impact,std::vector<double>& ImpactError) const = 0; - virtual double VKalGetImpact(const Track*,const Amg::Vector3D& Vertex, const long int Charge, - std::vector<double>& Impact,std::vector<double>& ImpactError) const = 0; -//---------------------------------------------------------------------------------------------------- + virtual double VKalGetImpact(const Track*, + const Amg::Vector3D& Vertex, + const long int Charge, + std::vector<double>& Impact, + std::vector<double>& ImpactError, + IVKalState& istate) const = 0; + virtual double VKalGetImpact(const xAOD::TrackParticle*, + const Amg::Vector3D& Vertex, + const long int Charge, + std::vector<double>& Impact, + std::vector<double>& ImpactError) const = 0; + + virtual double VKalGetImpact(const Track*, + const Amg::Vector3D& Vertex, + const long int Charge, + std::vector<double>& Impact, + std::vector<double>& ImpactError) const = 0; + //---------------------------------------------------------------------------------------------------- }; } //end of namespace diff --git a/Tracking/TrkVertexFitter/TrkVKalVrtFitter/TrkVKalVrtFitter/TrkVKalVrtFitter.h b/Tracking/TrkVertexFitter/TrkVKalVrtFitter/TrkVKalVrtFitter/TrkVKalVrtFitter.h index 3af241eb0c9d0bb8791bf81ced1fa309413e6423..1f2d063778a3f87d0e6026380f56dae694a36283 100755 --- a/Tracking/TrkVertexFitter/TrkVKalVrtFitter/TrkVKalVrtFitter/TrkVKalVrtFitter.h +++ b/Tracking/TrkVertexFitter/TrkVKalVrtFitter/TrkVKalVrtFitter/TrkVKalVrtFitter.h @@ -23,9 +23,6 @@ // MagField cache #include "MagFieldConditions/AtlasFieldCacheCondObj.h" // -#include <thread> -#include <mutex> -// class IChronoStatSvc; namespace Trk{ @@ -74,8 +71,8 @@ namespace Trk{ using Trk::IVertexFitter::fit; using Trk::ITrkVKalVrtFitter::makeState; - virtual StatusCode initialize() override; - virtual StatusCode finalize() override; + virtual StatusCode initialize() override final; + virtual StatusCode finalize() override final; TrkVKalVrtFitter(const std::string& t, const std::string& name, const IInterface* parent); virtual ~TrkVKalVrtFitter(); @@ -86,47 +83,47 @@ namespace Trk{ virtual xAOD::Vertex* fit( const std::vector<const TrackParameters*>& perigeeList, - const Amg::Vector3D& startingPoint) const override; + const Amg::Vector3D& startingPoint) const override final; virtual xAOD::Vertex* fit( const std::vector<const TrackParameters*>& perigeeList, const std::vector<const NeutralParameters*>& /*neutralPerigeeList*/, - const Amg::Vector3D& startingPoint) const override; + const Amg::Vector3D& startingPoint) const override final; virtual xAOD::Vertex* fit( const std::vector<const TrackParameters*>& perigeeList, - const xAOD::Vertex& constraint) const override; + const xAOD::Vertex& constraint) const override final; virtual xAOD::Vertex* fit( const std::vector<const TrackParameters*>& perigeeList, const std::vector<const NeutralParameters*>& /*neutralPerigeeList*/, - const xAOD::Vertex& constraint) const override; + const xAOD::Vertex& constraint) const override final; virtual std::unique_ptr<xAOD::Vertex> fit( const EventContext& ctx, const std::vector<const xAOD::TrackParticle*>& vectorTrk, - const Amg::Vector3D& startingPoint) const override; + const Amg::Vector3D& startingPoint) const override final; virtual xAOD::Vertex* fit( const std::vector<const xAOD::TrackParticle*>& vectorTrk, - const xAOD::Vertex& constraint) const override; + const xAOD::Vertex& constraint) const override final; virtual xAOD::Vertex* fit( const std::vector<const xAOD::TrackParticle*>& vectorTrk, const std::vector<const xAOD::NeutralParticle*>& vectorNeu, - const Amg::Vector3D& startingPoint) const override; + const Amg::Vector3D& startingPoint) const override final; virtual xAOD::Vertex* fit( const std::vector<const xAOD::TrackParticle*>& vectorTrk, const std::vector<const xAOD::NeutralParticle*>& vectorNeu, - const xAOD::Vertex& constraint) const override; + const xAOD::Vertex& constraint) const override final; virtual xAOD::Vertex* fit( - const std::vector<const TrackParameters*>&) const override; + const std::vector<const TrackParameters*>&) const override final; virtual xAOD::Vertex* fit( const std::vector<const TrackParameters*>&, - const std::vector<const Trk::NeutralParameters*>&) const override; + const std::vector<const Trk::NeutralParameters*>&) const override final; /*-------------- Additional xAOD interfaces -------------*/ @@ -139,190 +136,233 @@ namespace Trk{ // // Cascade fitter interface // - VertexID startVertex(const std::vector<const xAOD::TrackParticle*> & list, - const std::vector<double>& particleMass, - IVKalState& istate, - double massConstraint = 0.) const override; + VertexID startVertex( + const std::vector<const xAOD::TrackParticle*>& list, + const std::vector<double>& particleMass, + IVKalState& istate, + double massConstraint = 0.) const override final; + + VertexID nextVertex(const std::vector<const xAOD::TrackParticle*>& list, + const std::vector<double>& particleMass, + IVKalState& istate, + double massConstraint = 0.) const override final; + + VertexID nextVertex(const std::vector<const xAOD::TrackParticle*>& list, + const std::vector<double>& particleMass, + const std::vector<VertexID>& precedingVertices, + IVKalState& istate, + double massConstraint = 0.) const override final; + + VxCascadeInfo* fitCascade(IVKalState& istate, + const Vertex* primVertex = 0, + bool FirstDecayAtPV = false) const override final; + + StatusCode addMassConstraint( + VertexID Vertex, + const std::vector<const xAOD::TrackParticle*>& tracksInConstraint, + const std::vector<VertexID>& verticesInConstraint, + IVKalState& istate, + double massConstraint) const override final; + + //------ specific VKalVrt staff + + virtual std::unique_ptr<IVKalState> makeState( + const EventContext& ctx) const override final; + + virtual StatusCode VKalVrtFit( + const std::vector<const xAOD::TrackParticle*>&, + const std::vector<const xAOD::NeutralParticle*>&, + Amg::Vector3D& Vertex, + TLorentzVector& Momentum, + long int& Charge, + dvect& ErrorMatrix, + dvect& Chi2PerTrk, + std::vector<std::vector<double>>& TrkAtVrt, + double& Chi2, + IVKalState& istate, + bool ifCovV0 = false) const override final; + + virtual StatusCode VKalVrtFit( + const std::vector<const Track*>&, + Amg::Vector3D& Vertex, + TLorentzVector& Momentum, + long int& Charge, + dvect& ErrorMatrix, + dvect& Chi2PerTrk, + std::vector<std::vector<double>>& TrkAtVrt, + double& Chi2, + IVKalState& istate, + bool ifCovV0 = false) const override final; + + virtual StatusCode VKalVrtFit( + const std::vector<const TrackParameters*>&, + const std::vector<const NeutralParameters*>&, + Amg::Vector3D& Vertex, + TLorentzVector& Momentum, + long int& Charge, + dvect& ErrorMatrix, + dvect& Chi2PerTrk, + std::vector<std::vector<double>>& TrkAtVrt, + double& Chi2, + IVKalState& istate, + bool ifCovV0 = false) const override final; + //------ + virtual StatusCode VKalVrtCvtTool(const Amg::Vector3D& Vertex, + const TLorentzVector& Momentum, + const dvect& CovVrtMom, + const long int& Charge, + dvect& Perigee, + dvect& CovPerigee, + IVKalState& istate) const override final; + //----- + virtual StatusCode VKalVrtFitFast(const std::vector<const Trk::Track*>&, + Amg::Vector3D& Vertex, + IVKalState& istate) const override final; + virtual StatusCode VKalVrtFitFast( + const std::vector<const xAOD::TrackParticle*>&, + Amg::Vector3D& Vertex, + IVKalState& istate) const override final; - VertexID nextVertex(const std::vector<const xAOD::TrackParticle*> & list, - const std::vector<double>& particleMass, - IVKalState& istate, - double massConstraint = 0.) const override; + virtual StatusCode VKalVrtFitFast( + const std::vector<const TrackParameters*>&, + Amg::Vector3D& Vertex, + IVKalState& istate) const override final; + //----- + virtual + Trk::Track* CreateTrkTrack(const std::vector<double>& VKPerigee, + const std::vector<double>& VKCov, + const IVKalState& istate) const override final; + + virtual StatusCode VKalGetTrkWeights( + dvect& Weights, + const IVKalState& istate) const override final; + + virtual StatusCode VKalGetFullCov(long int, + dvect& CovMtx, + const IVKalState& istate, + bool = false) const override final; + + virtual StatusCode VKalGetMassError( + double& Mass, + double& MassError, + const IVKalState& istate) const override final; + + virtual void setApproximateVertex(double X, + double Y, + double Z, + IVKalState& istate) const override final; + + virtual void setMassForConstraint(double Mass, + IVKalState& istate) const override final; + + virtual void setMassForConstraint(double Mass, + const std::vector<int>&, + IVKalState& istate) const override final; + + virtual void setRobustness(int, IVKalState& istate) const override final; - VertexID nextVertex(const std::vector<const xAOD::TrackParticle*> & list, - const std::vector<double>& particleMass, - const std::vector<VertexID> &precedingVertices, - IVKalState& istate, - double massConstraint = 0.) const override; - VxCascadeInfo * fitCascade(IVKalState& istate, - const Vertex * primVertex = 0, bool FirstDecayAtPV = false ) const override; + virtual void setRobustScale(double, IVKalState& istate) const override final; - StatusCode addMassConstraint(VertexID Vertex, - const std::vector<const xAOD::TrackParticle*> & tracksInConstraint, - const std::vector<VertexID> &verticesInConstraint, - IVKalState& istate, - double massConstraint ) const override; + virtual void setCnstType(int, IVKalState& istate) const override final; -//------ Personal VKalVrt staff + virtual void setVertexForConstraint(const xAOD::Vertex&, + IVKalState& istate) const override final; - virtual std::unique_ptr<IVKalState> makeState(const EventContext& ctx) const override; + virtual void setVertexForConstraint(double X, + double Y, + double Z, + IVKalState& istate) const override final; - virtual - StatusCode VKalVrtFit(const std::vector<const xAOD::TrackParticle*>&, - const std::vector<const xAOD::NeutralParticle*>&, - Amg::Vector3D& Vertex, - TLorentzVector& Momentum, - long int& Charge, - dvect& ErrorMatrix, - dvect& Chi2PerTrk, - std::vector< std::vector<double> >& TrkAtVrt, - double& Chi2, - IVKalState& istate, - bool ifCovV0 = false) const override; - virtual - StatusCode VKalVrtFit(const std::vector<const Track*>&, - Amg::Vector3D& Vertex, - TLorentzVector& Momentum, - long int& Charge, - dvect& ErrorMatrix, - dvect& Chi2PerTrk, - std::vector< std::vector<double> >& TrkAtVrt, - double& Chi2, - IVKalState& istate, - bool ifCovV0 = false) const override; - virtual - StatusCode VKalVrtFit(const std::vector<const TrackParticleBase*>&, - Amg::Vector3D& Vertex, - TLorentzVector& Momentum, - long int& Charge, - dvect& ErrorMatrix, - dvect& Chi2PerTrk, - std::vector< std::vector<double> >& TrkAtVrt, - double& Chi2, - IVKalState& istate, - bool ifCovV0 = false) const override; - virtual - StatusCode VKalVrtFit(const std::vector<const TrackParameters*>&, - const std::vector<const NeutralParameters*>&, - Amg::Vector3D& Vertex, - TLorentzVector& Momentum, - long int& Charge, - dvect& ErrorMatrix, - dvect& Chi2PerTrk, - std::vector< std::vector<double> >& TrkAtVrt, - double& Chi2, - IVKalState& istate, - bool ifCovV0 = false) const override; -//------ - virtual - StatusCode VKalVrtCvtTool(const Amg::Vector3D& Vertex, - const TLorentzVector& Momentum, - const dvect& CovVrtMom, - const long int& Charge, - dvect& Perigee, - dvect& CovPerigee, - IVKalState& istate) const override; -//----- - virtual StatusCode VKalVrtFitFast(const std::vector<const Trk::Track*>&, Amg::Vector3D& Vertex, IVKalState& istate) const override; - virtual StatusCode VKalVrtFitFast(const std::vector<const xAOD::TrackParticle*>&, Amg::Vector3D& Vertex, IVKalState& istate) const override; - virtual StatusCode VKalVrtFitFast(const std::vector<const TrackParticleBase*>&, Amg::Vector3D& Vertex, IVKalState& istate) const override; - virtual StatusCode VKalVrtFitFast(const std::vector<const TrackParameters*>&, Amg::Vector3D& Vertex, IVKalState& istate) const override; -//----- - virtual - Trk::Track* CreateTrkTrack(const std::vector<double>& VKPerigee, - const std::vector<double>& VKCov, - const IVKalState& istate) const override; - virtual StatusCode VKalGetTrkWeights(dvect& Weights, - const IVKalState& istate) const override; - virtual StatusCode VKalGetFullCov(long int, dvect& CovMtx, - const IVKalState& istate, - bool = false) const override; - - virtual StatusCode VKalGetMassError(double& Mass, double& MassError, - const IVKalState& istate) const override; - -// VxCandidate * makeVxCandidate( int , -// const Amg::Vector3D& , const std::vector<double> & , -// const std::vector<double> & , const std::vector< std::vector<double> >& , double, const State& state ); -//----- - - virtual void setApproximateVertex(double,double,double, - IVKalState& istate) const override; - virtual void setMassForConstraint(double, - IVKalState& istate) const override; - virtual void setMassForConstraint(double, const std::vector<int>&, - IVKalState& istate) const override; - virtual void setRobustness(int, IVKalState& istate) const override; - virtual void setRobustScale(double, IVKalState& istate) const override; - virtual void setCnstType(int, IVKalState& istate) const override; - virtual void setVertexForConstraint(const xAOD::Vertex &, IVKalState& istate ) const override; - virtual void setVertexForConstraint(double,double,double, IVKalState& istate) const override; - virtual void setCovVrtForConstraint(double,double,double,double,double,double, IVKalState& istate) const override; - - virtual void setMassInputParticles( const std::vector<double>&, - IVKalState& istate) const override; - virtual double VKalGetImpact(const xAOD::TrackParticle*,const Amg::Vector3D& Vertex, const long int Charge, - dvect& Impact, dvect& ImpactError, IVKalState& istate) const override; - virtual double VKalGetImpact(const TrackParticleBase*,const Amg::Vector3D& Vertex, const long int Charge, - dvect& Impact, dvect& ImpactError, IVKalState& istate) const override; - virtual double VKalGetImpact(const Track*,const Amg::Vector3D& Vertex, const long int Charge, - dvect& Impact, dvect& ImpactError, IVKalState& istate) const override; - virtual double VKalGetImpact(const xAOD::TrackParticle*,const Amg::Vector3D& Vertex, const long int Charge, - dvect& Impact, dvect& ImpactError) const override; - virtual double VKalGetImpact(const TrackParticleBase*,const Amg::Vector3D& Vertex, const long int Charge, - dvect& Impact, dvect& ImpactError) const override; - virtual double VKalGetImpact(const Track*,const Amg::Vector3D& Vertex, const long int Charge, - dvect& Impact, dvect& ImpactError) const override; + virtual void setCovVrtForConstraint(double XX, + double XY, + double YY, + double XZ, + double YZ, + double ZZ, + IVKalState& istate) const override final; + virtual void setMassInputParticles(const std::vector<double>&, + IVKalState& istate) const override final; + + virtual double VKalGetImpact(const xAOD::TrackParticle*, + const Amg::Vector3D& Vertex, + const long int Charge, + dvect& Impact, + dvect& ImpactError, + IVKalState& istate) const override final; + + virtual double VKalGetImpact(const Track*, + const Amg::Vector3D& Vertex, + const long int Charge, + dvect& Impact, + dvect& ImpactError, + IVKalState& istate) const override final; + + virtual double VKalGetImpact(const xAOD::TrackParticle*, + const Amg::Vector3D& Vertex, + const long int Charge, + dvect& Impact, + dvect& ImpactError) const override final; + + virtual double VKalGetImpact(const Track*, + const Amg::Vector3D& Vertex, + const long int Charge, + dvect& Impact, + dvect& ImpactError) const override final; -// -// ATLAS related code -// - private: - - SimpleProperty<int> m_Robustness; - SimpleProperty<double> m_RobustScale; - SimpleProperty<double> m_cascadeCnstPrecision; - SimpleProperty<double> m_massForConstraint; - SimpleProperty<int> m_IterationNumber; - SimpleProperty<double> m_IterationPrecision; - SimpleProperty<double> m_IDsizeR; - SimpleProperty<double> m_IDsizeZ; - std::vector<double> m_c_VertexForConstraint; - std::vector<double> m_c_CovVrtForConstraint; - std::vector<double> m_c_MassInputParticles; - - ToolHandle < IExtrapolator > m_extPropagator; //External propagator - ////ServiceHandle<MagField::IMagFieldSvc> m_magFieldAthenaSvc; //Athena magnetic field - //Read handle for conditions object to get the field cache - SG::ReadCondHandleKey<AtlasFieldCacheCondObj> m_fieldCacheCondObjInputKey {this, "AtlasFieldCacheCondObj", "fieldCondObj", "Name of the Magnetic Field key"}; - SimpleProperty<bool> m_firstMeasuredPoint; - SimpleProperty<bool> m_firstMeasuredPointLimit; - SimpleProperty<bool> m_makeExtendedVertex; - SimpleProperty<bool> m_useFixedField; - - bool m_isAtlasField; - - bool m_useAprioriVertex ; - bool m_useThetaCnst; - bool m_usePhiCnst; - bool m_usePointingCnst; - bool m_useZPointingCnst; - bool m_usePassNear; - bool m_usePassWithTrkErr; - void initCnstList(); - -// Track material effects control -// - struct TrkMatControl{ - Amg::Vector3D trkRefGlobPos; // Track reference point(hit) in global ATLAS frame - int extrapolationType; - int TrkID; + // + // ATLAS related code + // + private: + SimpleProperty<int> m_Robustness; + SimpleProperty<double> m_RobustScale; + SimpleProperty<double> m_cascadeCnstPrecision; + SimpleProperty<double> m_massForConstraint; + SimpleProperty<int> m_IterationNumber; + SimpleProperty<double> m_IterationPrecision; + SimpleProperty<double> m_IDsizeR; + SimpleProperty<double> m_IDsizeZ; + std::vector<double> m_c_VertexForConstraint; + std::vector<double> m_c_CovVrtForConstraint; + std::vector<double> m_c_MassInputParticles; + + ToolHandle<IExtrapolator> m_extPropagator; // External propagator + ////ServiceHandle<MagField::IMagFieldSvc> m_magFieldAthenaSvc; //Athena + ///magnetic field + // Read handle for conditions object to get the field cache + SG::ReadCondHandleKey<AtlasFieldCacheCondObj> + m_fieldCacheCondObjInputKey{ this, + "AtlasFieldCacheCondObj", + "fieldCondObj", + "Name of the Magnetic Field key" }; + SimpleProperty<bool> m_firstMeasuredPoint; + SimpleProperty<bool> m_firstMeasuredPointLimit; + SimpleProperty<bool> m_makeExtendedVertex; + SimpleProperty<bool> m_useFixedField; + + bool m_isAtlasField; + + bool m_useAprioriVertex; + bool m_useThetaCnst; + bool m_usePhiCnst; + bool m_usePointingCnst; + bool m_useZPointingCnst; + bool m_usePassNear; + bool m_usePassWithTrkErr; + void initCnstList(); + + // Track material effects control + // + struct TrkMatControl + { + // Track reference point(hit) in global ATLAS frame + Amg::Vector3D trkRefGlobPos; + int extrapolationType; + int TrkID; const TrackParameters* TrkPnt; - double prtMass; - Amg::Vector3D trkSavedLocalVertex; // Local VKalVrtCore vertex - }; - + double prtMass; + Amg::Vector3D trkSavedLocalVertex; // Local VKalVrtCore vertex + }; class CascadeState { @@ -336,16 +376,14 @@ namespace Trk{ std::vector<cascadeV> m_cascadeVList; // list of cascade vertex objects }; - - class State - : public IVKalState + class State : public IVKalState { public: // // Origin of global reference frame. - // (0,0,0) by default but can be changed by input tracks + // (0,0,0) by default but can be changed by input tracks // - double m_refFrameX = 0, m_refFrameY = 0, m_refFrameZ = 0 ; + double m_refFrameX = 0, m_refFrameY = 0, m_refFrameZ = 0; std::vector < TrkMatControl > m_trkControl; // @@ -401,8 +439,6 @@ namespace Trk{ } }; - - //----------------------------------------------------------------- // Cascade related stuff // @@ -447,45 +483,82 @@ namespace Trk{ Amg::MatrixX * GiveFullMatrix(int NTrk, std::vector<double>&) const; bool convertAmg5SymMtx(const AmgSymMatrix(5)*, double[] ) const; - void VKalTransform( double MAG,double A0V,double ZV,double PhiV,double ThetaV,double PInv, double[], - long int & Charge, double[], double[]) const; - - - xAOD::Vertex * makeXAODVertex( int, const Amg::Vector3D&, - const dvect&, const dvect&, const std::vector< dvect >&, double, - const State& state) const; - - StatusCode CvtTrkTrack(const std::vector<const Track*>& list, int& ntrk, State& state) const; - StatusCode CvtTrackParticle(const std::vector<const TrackParticleBase*>& list, int& ntrk, State& state) const; - StatusCode CvtTrackParticle(const std::vector<const xAOD::TrackParticle*>& list, int& ntrk, State& state) const; - StatusCode CvtNeutralParticle(const std::vector<const xAOD::NeutralParticle*>& list,int& ntrk, State& state) const; - StatusCode CvtTrackParameters(const std::vector<const TrackParameters*>& InpTrk, int& ntrk, State& state) const; - StatusCode CvtNeutralParameters(const std::vector<const NeutralParameters*>& InpTrk, int& ntrk, State& state) const; + void VKalTransform(double MAG, + double A0V, + double ZV, + double PhiV, + double ThetaV, + double PInv, + double[], + long int& Charge, + double[], + double[]) const; + + xAOD::Vertex* makeXAODVertex(int, + const Amg::Vector3D&, + const dvect&, + const dvect&, + const std::vector<dvect>&, + double, + const State& state) const; + + StatusCode CvtTrkTrack(const std::vector<const Track*>& list, + int& ntrk, + State& state) const; + + StatusCode CvtTrackParticle( + const std::vector<const xAOD::TrackParticle*>& list, + int& ntrk, + State& state) const; + + StatusCode CvtNeutralParticle( + const std::vector<const xAOD::NeutralParticle*>& list, + int& ntrk, + State& state) const; + + StatusCode CvtTrackParameters( + const std::vector<const TrackParameters*>& InpTrk, + int& ntrk, + State& state) const; + + StatusCode CvtNeutralParameters( + const std::vector<const NeutralParameters*>& InpTrk, + int& ntrk, + State& state) const; void VKalVrtConfigureFitterCore(int NTRK, State& state) const; - void VKalToTrkTrack( double, double , double , double , double& , double& , double& ) const; - //This is safe as long as the tool is not called from multiple threads or reentrantly - int VKalVrtFit3 ( int ntrk, Amg::Vector3D& Vertex, TLorentzVector& Momentum, - long int& Charge, dvect& ErrorMatrix, dvect& Chi2PerTrk, - std::vector< std::vector<double> >& TrkAtVrt, double& Chi2, - State& state, - bool ifCovV0) const; + void VKalToTrkTrack(double curBMAG, + double vp1, + double vp2, + double vp3, + double& tp1, + double& tp2, + double& tp3) const; + + int VKalVrtFit3(int ntrk, + Amg::Vector3D& Vertex, + TLorentzVector& Momentum, + long int& Charge, + dvect& ErrorMatrix, + dvect& Chi2PerTrk, + std::vector<std::vector<double>>& TrkAtVrt, + double& Chi2, + State& state, + bool ifCovV0) const; + + Perigee* CreatePerigee(double Vx, + double Vy, + double Vz, + const std::vector<double>& VKPerigee, + const std::vector<double>& VKCov, + const State& state) const; - Perigee * CreatePerigee(double , double , double , - const std::vector<double>& VKPerigee, - const std::vector<double>& VKCov, - const State& state) const; - -// -// - const Perigee* GetPerigee( const TrackParticleBase* i_ntrk) const; - const Perigee* GetPerigee( const TrackParameters* i_ntrk) const; - const TrackParameters* GetFirstPoint(const Trk::TrackParticleBase* i_ntrk) const; - /*const TrackParameters* GetFirstPoint(const xAOD::TrackParticle* i_ntrk); //VK Cannot be implemented. xAOD::TrackParticle - //returns local copy(!!!) of first point */ + // + // + const Perigee* GetPerigee(const TrackParameters* i_ntrk) const; - int VKalGetNDOF(const State& state) const; + int VKalGetNDOF(const State& state) const; }; } //end of namespace diff --git a/Tracking/TrkVertexFitter/TrkVKalVrtFitter/src/CvtTrackParticle.cxx b/Tracking/TrkVertexFitter/TrkVKalVrtFitter/src/CvtTrackParticle.cxx index 1f7363cc9f7bfef26eadad5418c57e4535860646..ee8c62907a60fd35866cdc165e8de5234349769a 100755 --- a/Tracking/TrkVertexFitter/TrkVKalVrtFitter/src/CvtTrackParticle.cxx +++ b/Tracking/TrkVertexFitter/TrkVKalVrtFitter/src/CvtTrackParticle.cxx @@ -233,149 +233,6 @@ namespace Trk { return StatusCode::SUCCESS; } - - - -//-------------------------------------------------------------------- -// Extract Trk::TrackParticlesBase -// - - StatusCode - TrkVKalVrtFitter::CvtTrackParticle(const std::vector<const TrackParticleBase*>& InpTrk, - int& ntrk, - State& state) const - { - - std::vector<const TrackParticleBase*>::const_iterator i_ntrk; - AmgVector(5) VectPerig; VectPerig.setZero(); - const Trk::Perigee* mPer=nullptr; - double CovVertTrk[15]; std::fill(CovVertTrk,CovVertTrk+15,0.); - double tmp_refFrameX=0, tmp_refFrameY=0, tmp_refFrameZ=0; - double fx,fy,BMAG_FIXED; -// -// ----- Set reference frame to (0.,0.,0.) == ATLAS frame -// ----- Magnetic field is taken in reference point -// - state.m_refFrameX=state.m_refFrameY=state.m_refFrameZ=0.; - state.m_fitField.setAtlasMagRefFrame( 0., 0., 0.); -// -// Cycle to determine common reference point for the fit -// - int counter =0; - Amg::Vector3D perGlobalPos; - state.m_trkControl.clear(); state.m_trkControl.reserve(InpTrk.size()); - for (i_ntrk = InpTrk.begin(); i_ntrk < InpTrk.end(); ++i_ntrk) { -//-- (Measured)Perigee in TrackParticle - mPer = GetPerigee(*i_ntrk); - if( mPer==nullptr ) continue; // No perigee!!! - perGlobalPos = mPer->position(); //Global position of perigee point - if(fabs(perGlobalPos.z()) > m_IDsizeZ)return StatusCode::FAILURE; // Crazy user protection - if( perGlobalPos.perp() > m_IDsizeR)return StatusCode::FAILURE; - tmp_refFrameX += perGlobalPos.x() ; // Reference system calculation - tmp_refFrameY += perGlobalPos.y() ; // Use hit position itself to get more precise - tmp_refFrameZ += perGlobalPos.z() ; // magnetic field - TrkMatControl tmpMat; - tmpMat.trkRefGlobPos=Amg::Vector3D( perGlobalPos.x(), perGlobalPos.y(), perGlobalPos.z()); - tmpMat.extrapolationType=2; // Perigee point strategy - tmpMat.TrkPnt=mPer; - tmpMat.prtMass = 139.5702; - if(counter<(int)state.m_MassInputParticles.size())tmpMat.prtMass = state.m_MassInputParticles[counter]; - tmpMat.TrkID=counter; state.m_trkControl.push_back(tmpMat); - counter++; - } - if(counter == 0) return StatusCode::FAILURE; - tmp_refFrameX /= counter; // Reference frame for the fit - tmp_refFrameY /= counter; - tmp_refFrameZ /= counter; -// -//std::cout.setf( std::ios::scientific); std::cout.precision(5); -//std::cout<<" VK ref.frame="<<tmp_refFrameX<<", "<<tmp_refFrameY<<", "<<tmp_refFrameZ<<'\n'; -// -// Common reference frame is ready. Start extraction of parameters for fit. -// - - Amg::Vector3D perGlobalVrt; - for (i_ntrk = InpTrk.begin(); i_ntrk < InpTrk.end(); ++i_ntrk) { - long int TrkID=ntrk; -// -//-- (Measured)Perigee in TrackParticle -// - mPer = GetPerigee(*i_ntrk); - if( mPer==nullptr ) continue; // No perigee!!! - VectPerig = mPer->parameters(); - perGlobalVrt = mPer->associatedSurface().center(); //Global position of reference point - perGlobalPos = mPer->position(); //Global position of perigee point - if( !convertAmg5SymMtx(mPer->covariance(), CovVertTrk) ) return StatusCode::FAILURE; //VK no good covariance matrix!; - state.m_refFrameX=state.m_refFrameY=state.m_refFrameZ=0.; state.m_fitField.setAtlasMagRefFrame( 0., 0., 0.); //restore ATLAS frame - state.m_fitField.getMagFld( perGlobalPos.x(), perGlobalPos.y(), perGlobalPos.z(), // Magnetic field - fx, fy, BMAG_FIXED); // at track perigee point - if(fabs(BMAG_FIXED) < 0.01) BMAG_FIXED=0.01; - - - VKalTransform( BMAG_FIXED, (double)VectPerig[0], (double)VectPerig[1], - (double)VectPerig[2], (double)VectPerig[3], (double)VectPerig[4], CovVertTrk, - state.m_ich[ntrk],&state.m_apar[ntrk][0],&state.m_awgt[ntrk][0]); -//std::cout<< "New="<<state.m_awgt[ntrk][0]<<", "<<state.m_awgt[ntrk][1]<<", "<<state.m_awgt[ntrk][2]<<", "<<state.m_awgt[ntrk][3]<<'\n'; -//std::cout<< "New="<<state.m_awgt[ntrk][11]<<", "<<state.m_awgt[ntrk][12]<<", "<<state.m_awgt[ntrk][13]<<", "<<state.m_awgt[ntrk][14]<<'\n'; -//std::cout<<"-------------------------------------"<<'\n'; -// -// -// Check if propagation to common reference point is needed and make it - state.m_refFrameX=perGlobalVrt.x(); // initial track reference position - state.m_refFrameY=perGlobalVrt.y(); - state.m_refFrameZ=perGlobalVrt.z(); - state.m_fitField.setAtlasMagRefFrame( state.m_refFrameX, state.m_refFrameY, state.m_refFrameZ); - double dX=tmp_refFrameX-perGlobalVrt.x(); // Track shift for VKalVrtCore - double dY=tmp_refFrameY-perGlobalVrt.y(); - double dZ=tmp_refFrameZ-perGlobalVrt.z(); - if(fabs(dX)+fabs(dY)+fabs(dZ) != 0.) { - double pari[5],covi[15]; double vrtini[3]={0.,0.,0.}; double vrtend[3]={dX,dY,dZ}; - for(int i=0; i<5; i++) pari[i]=state.m_apar[ntrk][i]; - for(int i=0; i<15;i++) covi[i]=state.m_awgt[ntrk][i]; - myPropagator.Propagate( TrkID, state.m_ich[ntrk], pari, covi, vrtini, vrtend,&state.m_apar[ntrk][0],&state.m_awgt[ntrk][0],&state.m_vkalFitControl); - } - - ntrk++; if(ntrk>=NTrMaxVFit) return StatusCode::FAILURE; - } -//-------------- Finally setting new reference frame common for ALL tracks - state.m_refFrameX=tmp_refFrameX; - state.m_refFrameY=tmp_refFrameY; - state.m_refFrameZ=tmp_refFrameZ; - state.m_fitField.setAtlasMagRefFrame( state.m_refFrameX, state.m_refFrameY, state.m_refFrameZ); - - return StatusCode::SUCCESS; - } - - - -//------------------------------------------------------------------------------------------------------ -//-- (Measured)Perigee in Trk::TrackParticleBase. Trk::Track has ->perigeeParameters() member function. -// - - const Perigee* TrkVKalVrtFitter::GetPerigee( const TrackParticleBase* i_ntrk) const - { - const Perigee* mPer = nullptr; - if( i_ntrk->definingParameters().associatedSurface().type() == Surface::Perigee - && i_ntrk->definingParameters().covariance() != nullptr ) - mPer = dynamic_cast<const Perigee*> (&(i_ntrk->definingParameters())); - return mPer ; - } - const TrackParameters* TrkVKalVrtFitter::GetFirstPoint(const Trk::TrackParticleBase* i_ntrk) const - { - std::vector<const TrackParameters*>::const_iterator vpb = i_ntrk->trackParameters().begin(); - std::vector<const TrackParameters*>::const_iterator vpe = i_ntrk->trackParameters().end(); - const TrackParameters* res=nullptr; - double minDst=1000000.; - for(;vpb != vpe; ++vpb) { - if((*vpb)->position().perp()<25.)continue; - if((*vpb)->position().perp()<minDst){ minDst=(*vpb)->position().perp(); res= (*vpb); } - } - if(!res) res=&(i_ntrk->definingParameters()); //if nothing is found - then use track defining parameters - // Perigee presumably - return res; - } - - //---------------------------------------------------------------------------------------------------------- const Perigee* TrkVKalVrtFitter::GetPerigee( const TrackParameters* i_ntrk) const diff --git a/Tracking/TrkVertexFitter/TrkVKalVrtFitter/src/VKalGetImpact.cxx b/Tracking/TrkVertexFitter/TrkVKalVrtFitter/src/VKalGetImpact.cxx index a6ace3c6bb3097ba9de7b1fc0c02b81358982f66..5ed75ce70926ecd7d4ec2a6bf26a327aad98587d 100755 --- a/Tracking/TrkVertexFitter/TrkVKalVrtFitter/src/VKalGetImpact.cxx +++ b/Tracking/TrkVertexFitter/TrkVKalVrtFitter/src/VKalGetImpact.cxx @@ -69,59 +69,6 @@ namespace Trk{ } - - - - - double TrkVKalVrtFitter::VKalGetImpact(const TrackParticleBase* InpTrk,const Amg::Vector3D& Vertex,const long int Charge, - std::vector<double>& Impact, std::vector<double>& ImpactError) const - { - State state; - initState (state); - return VKalGetImpact (InpTrk, Vertex, Charge, Impact, ImpactError, state); - } - - - double TrkVKalVrtFitter::VKalGetImpact(const TrackParticleBase* InpTrk,const Amg::Vector3D& Vertex,const long int Charge, - std::vector<double>& Impact, std::vector<double>& ImpactError, - IVKalState& istate) const - { - State& state = dynamic_cast<State&> (istate); -// -//------ Variables and arrays needed for fitting kernel -// - double SIGNIF=0.; - std::vector<const TrackParticleBase*> InpTrkList; - InpTrkList.push_back(InpTrk); - - -// -//------ extract information about selected tracks -// - int ntrk=0; - StatusCode sc = CvtTrackParticle(InpTrkList,ntrk,state); - if(sc.isFailure() || ntrk != 1) { //Something is wrong in conversion - Impact.assign(5,1.e10); - ImpactError.assign(3,1.e20); - return 1.e10; - } - long int vkCharge=state.m_ich[0]; - if(Charge==0)vkCharge=0; -// -// Target vertex in ref.frame defined by track itself -// - double VrtInp[3]={Vertex.x() -state.m_refFrameX, Vertex.y() -state.m_refFrameY, Vertex.z() -state.m_refFrameZ}; - double VrtCov[6]={0.,0.,0.,0.,0.,0.}; -// -// - Impact.resize(5); ImpactError.resize(3); - Trk::cfimp( 0, vkCharge, 0, &state.m_apar[0][0], &state.m_awgt[0][0], &VrtInp[0], &VrtCov[0], Impact.data(), ImpactError.data(), &SIGNIF, &state.m_vkalFitControl); - - - return SIGNIF; - - } - double TrkVKalVrtFitter::VKalGetImpact(const xAOD::TrackParticle* InpTrk,const Amg::Vector3D& Vertex,const long int Charge, std::vector<double>& Impact, std::vector<double>& ImpactError) const { diff --git a/Tracking/TrkVertexFitter/TrkVKalVrtFitter/src/VKalVrtFitFastSvc.cxx b/Tracking/TrkVertexFitter/TrkVKalVrtFitter/src/VKalVrtFitFastSvc.cxx index 98502edd8582931cbc6096f8fb4bdcd61fb54d38..3388279b89cfe73532a9877c207fe35f64a669ca 100755 --- a/Tracking/TrkVertexFitter/TrkVKalVrtFitter/src/VKalVrtFitFastSvc.cxx +++ b/Tracking/TrkVertexFitter/TrkVKalVrtFitter/src/VKalVrtFitFastSvc.cxx @@ -159,70 +159,6 @@ namespace Trk{ } - StatusCode TrkVKalVrtFitter::VKalVrtFitFast(const std::vector<const TrackParticleBase*>& InpTrk, - Amg::Vector3D& Vertex, - IVKalState& istate) const - { - State& state = dynamic_cast<State&> (istate); -// -// Convert particles and setup reference frame -// - int ntrk=0; - StatusCode sc = CvtTrackParticle(InpTrk,ntrk,state); - if(sc.isFailure() || ntrk<1 ) return StatusCode::FAILURE; - double fx,fy,BMAG_CUR; - state.m_fitField.getMagFld(0.,0.,0.,fx,fy,BMAG_CUR); - if(fabs(BMAG_CUR) < 0.1) BMAG_CUR=0.1; -// -//------ Variables and arrays needed for fitting kernel -// - double out[3]; - int i,j; - std::vector<double> xx,yy,zz; - Vertex[0]=Vertex[1]=Vertex[2]=0.; -// -// - double xyz0[3]={ -state.m_refFrameX, -state.m_refFrameY, -state.m_refFrameZ}; - if(ntrk==2){ - //Trk::vkvfast_(&state.m_apar[0][0],&state.m_apar[1][0],&BMAG_CUR,out); - Trk::vkvFastV(&state.m_apar[0][0],&state.m_apar[1][0], xyz0, BMAG_CUR, out); - } else { - for( i=0; i<ntrk-1; i++){ - for( j=i+1; j<ntrk; j++){ - //Trk::vkvfast_(&state.m_apar[i][0],&state.m_apar[j][0],&BMAG_CUR,out); - Trk::vkvFastV(&state.m_apar[i][0],&state.m_apar[j][0], xyz0, BMAG_CUR, out); - xx.push_back(out[0]); - yy.push_back(out[1]); - zz.push_back(out[2]); - } - } - int n=xx.size(); - std::sort(xx.begin(), xx.end()); - std::sort(yy.begin(), yy.end()); - std::sort(zz.begin(), zz.end()); - - std::vector<double>::iterator it1,it2; - it1=it2=xx.begin(); - for(i=0; i<((n+1)/2); ++i,++it1){}; for(i=0; i<(n/2+1);++i,++it2){}; - out[0]=0.5*( (*it1) + (*it2) ); - - it1=it2=yy.begin(); - for(i=0; i<((n+1)/2); ++i,++it1){}; for(i=0; i<(n/2+1);++i,++it2){}; - out[1]=0.5*( (*it1) + (*it2) ); - - it1=it2=zz.begin(); - for(i=0; i<((n+1)/2); ++i,++it1){}; for(i=0; i<(n/2+1);++i,++it2){}; - out[2]=0.5*( (*it1) + (*it2) ); - - } - Vertex[0]= out[0] + state.m_refFrameX; - Vertex[1]= out[1] + state.m_refFrameY; - Vertex[2]= out[2] + state.m_refFrameZ; - - - return StatusCode::SUCCESS; - } - StatusCode TrkVKalVrtFitter::VKalVrtFitFast(const std::vector<const TrackParameters*>& InpTrk, Amg::Vector3D& Vertex, diff --git a/Tracking/TrkVertexFitter/TrkVKalVrtFitter/src/VKalVrtFitSvc.cxx b/Tracking/TrkVertexFitter/TrkVKalVrtFitter/src/VKalVrtFitSvc.cxx index 2edd3239fd63bd7e11b47135a55c3e9171eed3a7..9da932d296715b16e238d2498540c2adcff747d3 100755 --- a/Tracking/TrkVertexFitter/TrkVKalVrtFitter/src/VKalVrtFitSvc.cxx +++ b/Tracking/TrkVertexFitter/TrkVKalVrtFitter/src/VKalVrtFitSvc.cxx @@ -162,44 +162,6 @@ StatusCode TrkVKalVrtFitter::VKalVrtFit(const std::vector<const xAOD::TrackParti } - -StatusCode TrkVKalVrtFitter::VKalVrtFit(const std::vector<const TrackParticleBase*>& InpTrk, - Amg::Vector3D& Vertex, - TLorentzVector& Momentum, - long int& Charge, - dvect& ErrorMatrix, - dvect& Chi2PerTrk, - std::vector< std::vector<double> >& TrkAtVrt, - double& Chi2, - IVKalState& istate, - bool ifCovV0 /*= false*/) const -{ - State& state = dynamic_cast<State&> (istate); - -// -//------ extract information about selected tracks -// - int ntrk=0; - StatusCode sc; - std::vector<const TrackParameters*> baseInpTrk; - if(m_firstMeasuredPoint){ //First measured point strategy - std::vector<const TrackParticleBase*>::const_iterator i_ntrk; - for (i_ntrk = InpTrk.begin(); i_ntrk < InpTrk.end(); ++i_ntrk) baseInpTrk.push_back(GetFirstPoint(*i_ntrk)); - sc=CvtTrackParameters(baseInpTrk,ntrk,state); - if(sc.isFailure()){ntrk=0; sc=CvtTrackParticle(InpTrk,ntrk,state);} - }else{ - sc=CvtTrackParticle(InpTrk,ntrk,state); - } - if(sc.isFailure())return StatusCode::FAILURE; - - int ierr = VKalVrtFit3( ntrk, Vertex, Momentum, Charge, ErrorMatrix, - Chi2PerTrk, TrkAtVrt,Chi2, state, ifCovV0 ) ; - if (ierr) return StatusCode::FAILURE; - return StatusCode::SUCCESS; -} - - - StatusCode TrkVKalVrtFitter::VKalVrtFit(const std::vector<const TrackParameters*> & InpTrkC, const std::vector<const NeutralParameters*> & InpTrkN, Amg::Vector3D& Vertex, diff --git a/Tracking/TrkVertexFitter/TrkVertexBilloirTools/CMakeLists.txt b/Tracking/TrkVertexFitter/TrkVertexBilloirTools/CMakeLists.txt index d34084f35f7070bac975c5f76fd6434ff5eab08d..4e3b1fd183c8da82a2178e1476bf3ba29eccf122 100644 --- a/Tracking/TrkVertexFitter/TrkVertexBilloirTools/CMakeLists.txt +++ b/Tracking/TrkVertexFitter/TrkVertexBilloirTools/CMakeLists.txt @@ -20,13 +20,17 @@ atlas_depends_on_subdirs( PUBLIC Tracking/TrkEvent/TrkParticleBase Tracking/TrkEvent/TrkTrack Tracking/TrkEvent/VxVertex - Tracking/TrkExtrapolation/TrkExInterfaces) + Tracking/TrkExtrapolation/TrkExInterfaces + Control/CxxUtils + ) + # Component(s) in the package: atlas_add_component( TrkVertexBilloirTools src/*.cxx src/components/*.cxx - LINK_LIBRARIES AthenaBaseComps xAODTracking GaudiKernel TrkParameters TrkVertexFitterInterfaces EventPrimitives TrkDetDescrUtils TrkSurfaces TrkLinks TrkParticleBase TrkTrack VxVertex TrkExInterfaces ) + LINK_LIBRARIES AthenaBaseComps xAODTracking GaudiKernel TrkParameters TrkVertexFitterInterfaces EventPrimitives TrkDetDescrUtils + TrkSurfaces TrkLinks TrkParticleBase TrkTrack VxVertex TrkExInterfaces CxxUtils) # Install files from the package: atlas_install_headers( TrkVertexBilloirTools ) diff --git a/Tracking/TrkVertexFitter/TrkVertexBilloirTools/TrkVertexBilloirTools/ATLAS_CHECK_THREAD_SAFETY b/Tracking/TrkVertexFitter/TrkVertexBilloirTools/TrkVertexBilloirTools/ATLAS_CHECK_THREAD_SAFETY new file mode 100644 index 0000000000000000000000000000000000000000..40ad131463bcd6d102394e2f802ba4d7fa260560 --- /dev/null +++ b/Tracking/TrkVertexFitter/TrkVertexBilloirTools/TrkVertexBilloirTools/ATLAS_CHECK_THREAD_SAFETY @@ -0,0 +1 @@ +Tracking/TrkVertexFitter/TrkVertexBilloirTools diff --git a/Tracking/TrkVertexFitter/TrkVertexBilloirTools/TrkVertexBilloirTools/FastVertexFitter.h b/Tracking/TrkVertexFitter/TrkVertexBilloirTools/TrkVertexBilloirTools/FastVertexFitter.h index 4b34b26270be6a5ccfcbd45a671fb8a0e2faa37f..ba763e34b386ed511853fe778bd3a4f9d6f537e6 100755 --- a/Tracking/TrkVertexFitter/TrkVertexBilloirTools/TrkVertexBilloirTools/FastVertexFitter.h +++ b/Tracking/TrkVertexFitter/TrkVertexBilloirTools/TrkVertexBilloirTools/FastVertexFitter.h @@ -6,6 +6,7 @@ #define TRKVERTEXFITTERBILLOIR_FASTVERTEXFITTER_H #include "AthenaBaseComps/AthAlgTool.h" +#include "CxxUtils/checker_macros.h" #include "GaudiKernel/ToolHandle.h" #include "TrkParameters/TrackParameters.h" #include "TrkVertexFitterInterfaces/IVertexFitter.h" @@ -32,7 +33,8 @@ EDM Migration to xAOD - from Trk::VxCandidate to xAOD::Vertex, from Trk::Vertex to Amg::Vector3D */ -class FastVertexFitter : public extends<AthAlgTool, IVertexFitter> +class ATLAS_NOT_THREAD_SAFE FastVertexFitter //const_cast the extrapolator result + : public extends<AthAlgTool, IVertexFitter> { public: // The following 'using' can be removed when IVertexFitter::fit has been fully diff --git a/Trigger/TrigAlgorithms/TrigHIRec/CMakeLists.txt b/Trigger/TrigAlgorithms/TrigHIRec/CMakeLists.txt index df67c33e97f8c1d71ef396612fe02c42798bd308..5f6b0d2222a8fb3c6cd3181849dec9443e30144d 100644 --- a/Trigger/TrigAlgorithms/TrigHIRec/CMakeLists.txt +++ b/Trigger/TrigAlgorithms/TrigHIRec/CMakeLists.txt @@ -1,41 +1,13 @@ -################################################################################ -# Package: TrigHIRec -################################################################################ +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration # Declare the package name: atlas_subdir( TrigHIRec ) -# Declare the package's dependencies: -atlas_depends_on_subdirs( PUBLIC - GaudiKernel - Trigger/TrigEvent/TrigCaloEvent - PRIVATE - Calorimeter/CaloEvent - Calorimeter/CaloUtils - Control/AthToolSupport/AsgTools - Control/Navigation - Control/StoreGate - Event/NavFourMom - Event/xAOD/xAODCaloEvent - Event/xAOD/xAODCore - Event/xAOD/xAODHIEvent - Event/xAOD/xAODJet - PhysicsAnalysis/HeavyIonPhys/HIEventUtils - Reconstruction/HeavyIonRec/HIGlobal - Reconstruction/HeavyIonRec/HIJetRec - Reconstruction/Jet/JetInterface - Trigger/TrigSteer/TrigInterfaces ) - -# External dependencies: -find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread ) - # Component(s) in the package: atlas_add_component( TrigHIRec src/*.cxx src/components/*.cxx - INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} GaudiKernel TrigCaloEvent CaloEvent CaloUtilsLib AsgTools Navigation StoreGateLib SGtests NavFourMom xAODCaloEvent xAODCore xAODHIEvent xAODJet HIEventUtilsLib JetInterface TrigInterfacesLib ) + LINK_LIBRARIES AsgTools CaloEvent CaloUtilsLib GaudiKernel HIEventUtilsLib HIGlobalLib HIJetRecLib JetInterface NavFourMom Navigation TrigInterfacesLib TrigParticle xAODCaloEvent xAODCore xAODHIEvent xAODJet ) # Install files from the package: -atlas_install_python_modules( python/*.py ) - +atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} --extend-extensions=ATL900,ATL901 ) diff --git a/Trigger/TrigAlgorithms/TrigHIRec/python/TrigHICaloRec.py b/Trigger/TrigAlgorithms/TrigHIRec/python/TrigHICaloRec.py index 4b8d457eebc4bb97b57f4f8a7c9108e0edf4d181..59670d3065665a5808d25751e869afc4e450cc0f 100644 --- a/Trigger/TrigAlgorithms/TrigHIRec/python/TrigHICaloRec.py +++ b/Trigger/TrigAlgorithms/TrigHIRec/python/TrigHICaloRec.py @@ -1,13 +1,11 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -from AthenaCommon.Constants import INFO,ERROR,FALSE,TRUE,DEBUG,VERBOSE -from AthenaCommon.SystemOfUnits import GeV,MeV,deg -from AthenaCommon.Logging import logging +from AthenaCommon.SystemOfUnits import MeV +from AthenaCommon.Constants import ERROR from TrigHIRec.TrigHIRecConf import TrigHIClusterMaker from TrigHIRec.TrigHIRecConf import TrigHIEventShapeMaker -from TrigCaloRec.TrigCaloRecConf import TrigCaloTowerMaker from TrigCaloRec.TrigCaloRecConfig import TrigCaloTowerMakerBase class TrigCaloTowerMaker_hijet (TrigCaloTowerMakerBase): @@ -18,7 +16,7 @@ class TrigCaloTowerMaker_hijet (TrigCaloTowerMakerBase): #input to TileTowerBuilder: cells in TILE try: from TileRecUtils.TileRecUtilsConf import TileTowerBuilderTool - except: + except Exception: #mlog.error("could not get handle to TileTowerBuilderTool Quit") #print traceback.format_exc() return False @@ -26,13 +24,13 @@ class TrigCaloTowerMaker_hijet (TrigCaloTowerMakerBase): # input to LArTowerBuilder: cells in LArEM and LARHEC try: from LArRecUtils.LArRecUtilsConf import LArTowerBuilderTool,LArFCalTowerBuilderTool - except: + except Exception: #mlog.error("TrigCaloTowerMaker: could not get handle to LArTowerBuilderTool or/and LArFCalTowerBuilderTool. Quit") #print traceback.format_exc() return False - larcmbtwrbldr = LArTowerBuilderTool("LArCmbTwrBldr", + larcmbtwrbldr = LArTowerBuilderTool("LArCmbTwrBldr", # noqa: ATL900 (assigning OutputLevel) CellContainerName = "AllCalo", IncludedCalos = [ "LAREM", "LARHEC" ], OutputLevel=ERROR @@ -42,7 +40,7 @@ class TrigCaloTowerMaker_hijet (TrigCaloTowerMakerBase): #larcmbtwrbldr.IncludedCalos = [ "LAREM", "LARHEC" ] #larcmbtwrbldr.OutputLevel=ERROR - fcalcmbtwrbldr = LArFCalTowerBuilderTool("FCalCmbTwrBldr", + fcalcmbtwrbldr = LArFCalTowerBuilderTool("FCalCmbTwrBldr", # noqa: ATL900 (assigning OutputLevel) CellContainerName = "AllCalo", MinimumEt = 0.*MeV, OutputLevel=ERROR diff --git a/Trigger/TrigAlgorithms/TrigHIRec/python/TrigHLTHIJetRecConfig.py b/Trigger/TrigAlgorithms/TrigHIRec/python/TrigHLTHIJetRecConfig.py index 41f793cac704ff2de0869a6a89bfa6898bdebb37..73381cc599006f2efaa9f3ba95208d305188f42c 100644 --- a/Trigger/TrigAlgorithms/TrigHIRec/python/TrigHLTHIJetRecConfig.py +++ b/Trigger/TrigAlgorithms/TrigHIRec/python/TrigHLTHIJetRecConfig.py @@ -1,31 +1,9 @@ -# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration - -from __future__ import print_function +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration from AthenaCommon.SystemOfUnits import GeV -from AthenaCommon.SystemOfUnits import MeV - -from JetRec.JetRecConf import JetRecTool -from JetRec.JetRecConf import (JetFromPseudojet, - JetFinder) -from JetRec.JetRecFlags import jetFlags -from JetRec.JetRecStandard import jtm -from JetRec.JetRecCalibrationFinder import jrcf - - -from GaudiKernel.Constants import (DEBUG, - INFO, - ERROR) from HIJetRec.HIJetRecFlags import HIJetFlags -#from HIJetRec.HIJetRecUtils import GetNullModulator -from HIGlobal.HIGlobalFlags import jobproperties - -#from TrigHLTJetRec import TrigHLTJetRecConf -#from TrigHLTJetRecConf import TrigHLTJetRecFromCluster from TrigHLTJetRec.TrigHLTJetRecConf import TrigHLTJetRecFromCluster -from TrigHLTJetRec.TrigHLTJetRecConf import TriggerPseudoJetGetter - #def _getTriggerHIPseudoJetGetter(hicluster_name): # # Build a new list of jet inputs. original: mygetters = [jtm.lcget] @@ -320,7 +298,6 @@ class TrigHLTHIJetRecFromHICluster(TrigHLTJetRecFromCluster): #self.inputTool = inputTool #self.doInputs = False self.jetBuildTool = jetBuildTool - print (jetBuildTool) else : from TrigHLTJetRec.TrigHLTJetRecConfig import _getJetBuildTool self.jetBuildTool = _getJetBuildTool( diff --git a/Trigger/TrigAnalysis/TrigMuonCoinHierarchy/CMakeLists.txt b/Trigger/TrigAnalysis/TrigMuonCoinHierarchy/CMakeLists.txt index 503fcc40d3ef216581b31344c935977907ebd5b0..d5c6a8a9e4455fff9f5caf389cd721e8ef5aa74a 100644 --- a/Trigger/TrigAnalysis/TrigMuonCoinHierarchy/CMakeLists.txt +++ b/Trigger/TrigAnalysis/TrigMuonCoinHierarchy/CMakeLists.txt @@ -1,47 +1,16 @@ -################################################################################ -# Package: TrigMuonCoinHierarchy -################################################################################ +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration # Declare the package name: atlas_subdir( TrigMuonCoinHierarchy ) -# Declare the package's dependencies: -atlas_depends_on_subdirs( PUBLIC - Control/AthenaBaseComps - GaudiKernel - MuonSpectrometer/MuonRDO - MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonPrepRawData - MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonTrigCoinData - PhysicsAnalysis/AnalysisTrigger/AnalysisTriggerEvent - PRIVATE - Event/EventInfo - MuonSpectrometer/MuonCablings/TGCcablingInterface - MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry - MuonSpectrometer/MuonIdHelpers - Reconstruction/MuonIdentification/muonEvent - Tools/PathResolver - Tracking/TrkEvent/TrkCompetingRIOsOnTrack - Tracking/TrkEvent/TrkEventUtils - Tracking/TrkEvent/TrkRIO_OnTrack - Tracking/TrkEvent/TrkTrack - Trigger/TrigT1/TrigT1Result ) - # External dependencies: -find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread ) +find_package( ROOT COMPONENTS Core Hist ) # Component(s) in the package: -atlas_add_library( TrigMuonCoinHierarchyLib - src/*.cxx - PUBLIC_HEADERS TrigMuonCoinHierarchy - PRIVATE_INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES AthenaBaseComps GaudiKernel MuonRDO MuonPrepRawData MuonTrigCoinData AnalysisTriggerEvent TGCcablingInterfaceLib MuonIdHelpersLib - PRIVATE_LINK_LIBRARIES ${ROOT_LIBRARIES} EventInfo MuonReadoutGeometry muonEvent PathResolver TrkCompetingRIOsOnTrack TrkEventUtils TrkRIO_OnTrack TrkTrack TrigT1Result ) - atlas_add_component( TrigMuonCoinHierarchy - src/components/*.cxx + src/*.cxx src/components/*.cxx INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaBaseComps GaudiKernel MuonRDO MuonPrepRawData MuonTrigCoinData AnalysisTriggerEvent EventInfo TGCcablingInterfaceLib MuonReadoutGeometry MuonIdHelpersLib muonEvent PathResolver TrkCompetingRIOsOnTrack TrkEventUtils TrkRIO_OnTrack TrkTrack TrigT1Result TrigMuonCoinHierarchyLib ) + LINK_LIBRARIES ${ROOT_LIBRARIES} AnalysisTriggerEvent AthenaBaseComps EventInfo GaudiKernel MuonIdHelpersLib MuonPrepRawData MuonRDO MuonReadoutGeometry MuonTrigCoinData PathResolver TGCcablingInterfaceLib TrigT1Result TrkCompetingRIOsOnTrack TrkEventUtils TrkRIO_OnTrack TrkTrack muonEvent ) # Install files from the package: atlas_install_runtime( share/mask2/*.txt ) - diff --git a/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauEmulation/CMakeLists.txt b/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauEmulation/CMakeLists.txt index efeaa5c73714f72367cd27db5b41db1e01bd58fa..31778656a7627a26d9070d7d53fc342277cc1afd 100644 --- a/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauEmulation/CMakeLists.txt +++ b/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauEmulation/CMakeLists.txt @@ -1,29 +1,8 @@ -################################################################################ -# Package: TrigTauEmulation -################################################################################ +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration # Declare the package name: atlas_subdir( TrigTauEmulation ) -# Declare the package's dependencies: -atlas_depends_on_subdirs( - PUBLIC - Control/AthToolSupport/AsgTools - Event/xAOD/xAODEventInfo - Event/xAOD/xAODTau - Event/xAOD/xAODTracking - Event/xAOD/xAODTrigger - PhysicsAnalysis/AnalysisCommon/PATCore - PhysicsAnalysis/AnalysisCommon/PATInterfaces - Trigger/TrigAnalysis/TrigDecisionTool - PRIVATE - Control/AthContainers - Control/AthenaBaseComps - Event/xAOD/xAODBase - Event/xAOD/xAODCore - Event/xAOD/xAODJet - GaudiKernel ) - # External dependencies: find_package( ROOT COMPONENTS Core MathCore Hist ) @@ -38,13 +17,12 @@ atlas_add_library( TrigTauEmulationLib atlas_add_component( TrigTauEmulation src/*.h src/*.cxx src/components/*.cxx - LINK_LIBRARIES GaudiKernel AthenaBaseComps xAODJet xAODTau xAODTrigger - xAODTracking TrigTauEmulationLib ) + LINK_LIBRARIES AthenaBaseComps GaudiKernel TrigTauEmulationLib xAODJet ) atlas_add_dictionary( TrigTauEmulationDict TrigTauEmulation/TrigTauEmulationDict.h TrigTauEmulation/selection.xml - LINK_LIBRARIES AsgTools TrigTauEmulationLib ) + LINK_LIBRARIES TrigTauEmulationLib ) # Install files from the package: atlas_install_python_modules( python/*.py ) diff --git a/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauMatching/CMakeLists.txt b/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauMatching/CMakeLists.txt index 3f081b31ec0e558a92ddde7586ffab0b6d277359..45bb50d197d34eabf2ea4b11728b261dcb79db13 100644 --- a/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauMatching/CMakeLists.txt +++ b/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauMatching/CMakeLists.txt @@ -1,28 +1,8 @@ -# $Id: CMakeLists.txt 781031 2016-10-28 15:10:31Z krasznaa $ +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration # The name of the package: atlas_subdir( TrigTauMatching ) -# Extra dependencies, based on the build environment: -set( extra_deps ) -if( XAOD_STANDALONE ) - set( extra_deps Control/xAODRootAccess ) -else() - set( extra_deps Control/AthenaBaseComps GaudiKernel ) -endif() - -# The dependencies of the package: -atlas_depends_on_subdirs( - PUBLIC - Control/AthToolSupport/AsgTools - Event/xAOD/xAODTau - Event/xAOD/xAODTrigger - Trigger/TrigAnalysis/TrigDecisionTool - PRIVATE - Event/xAOD/xAODCore - Trigger/TrigConfiguration/TrigConfxAOD - ${extra_deps} ) - # External(s) the package uses: find_package( ROOT COMPONENTS Core Hist Tree RIO ) diff --git a/Trigger/TrigConfiguration/TrigConfigSvc/python/TrigConfigSvcConfig.py b/Trigger/TrigConfiguration/TrigConfigSvc/python/TrigConfigSvcConfig.py index 2c91474e14c9f483ec7678b1f0baf3359bccba36..aa9e51a3481cb7d87dc6e387c9669d5721885f73 100755 --- a/Trigger/TrigConfiguration/TrigConfigSvc/python/TrigConfigSvcConfig.py +++ b/Trigger/TrigConfiguration/TrigConfigSvc/python/TrigConfigSvcConfig.py @@ -357,7 +357,7 @@ class SetupTrigConfigSvc(object): if TriggerFlags.doLVL2() or TriggerFlags.doEF() or TriggerFlags.doHLT() or TriggerFlags.configForStartup()=='HLToffline': self.mlog.info( "setup HLTConfigSvc and add instance to ServiceMgr (xml file="+self.hltXmlFile+")" ) hlt = HLTConfigSvc("HLTConfigSvc") - hlt.XMLMenuFile = findFileInXMLPATH(self.hltXmlFile) + hlt.XMLMenuFile = self.hltXmlFile hlt.doMergedHLT = TriggerFlags.doHLT() ServiceMgr += hlt else: @@ -366,12 +366,12 @@ class SetupTrigConfigSvc(object): self.mlog.info( "setup LVL1ConfigSvc and add instance to ServiceMgr (xml file="+self.l1XmlFile+")" ) l1 = LVL1ConfigSvc("LVL1ConfigSvc") - l1.XMLMenuFile = findFileInXMLPATH(self.l1XmlFile) + l1.XMLMenuFile = self.l1XmlFile ServiceMgr += l1 self.mlog.info( "setup L1TopoConfigSvc and add instance to ServiceMgr (xml file="+self.l1topoXmlFile+")" ) l1topo = L1TopoConfigSvc() - l1topo.XMLMenuFile = findFileInXMLPATH(self.l1topoXmlFile) + l1topo.XMLMenuFile = self.l1topoXmlFile ServiceMgr += l1topo diff --git a/Trigger/TrigConfiguration/TrigConfigSvc/src/ConfigSvcBase.cxx b/Trigger/TrigConfiguration/TrigConfigSvc/src/ConfigSvcBase.cxx index 0dc5122f8e3af9c49a5ccfaaccc7cf6f2a8ce345..e95800d08b30ce2391c00355127c0f9eaab05972 100644 --- a/Trigger/TrigConfiguration/TrigConfigSvc/src/ConfigSvcBase.cxx +++ b/Trigger/TrigConfiguration/TrigConfigSvc/src/ConfigSvcBase.cxx @@ -8,7 +8,9 @@ #include "TrigConfStorage/StorageMgr.h" #include "TrigConfStorage/XMLStorageMgr.h" -#include "boost/algorithm/string/case_conv.hpp" +#include "PathResolver/PathResolver.h" + +#include "boost/algorithm/string.hpp" #include "boost/lexical_cast.hpp" using namespace std; @@ -123,8 +125,13 @@ ConfigSvcBase::initStorageMgr() { ATH_MSG_ERROR("If you need the configuration and ConfigSource is 'XML', you need to specify a menu xml file"); return StatusCode::FAILURE; } - ATH_MSG_INFO("XML file: " << m_xmlFile); - m_storageMgr = new XMLStorageMgr( { m_xmlFile } ); + std::string resolvedXMLfile(m_xmlFile); + if( boost::algorithm::ends_with(m_xmlFile, ".xml") && ! boost::algorithm::starts_with(m_xmlFile, "./") ) { + resolvedXMLfile = PathResolver::find_file( m_xmlFile, "XMLPATH" ); + } + ATH_MSG_INFO("Unresolved XML file: " << m_xmlFile); + ATH_MSG_INFO("Resolved XML file: " << resolvedXMLfile); + m_storageMgr = new XMLStorageMgr( { resolvedXMLfile } ); } return StatusCode::SUCCESS; } diff --git a/Trigger/TrigConfiguration/TrigConfigSvc/src/LVL1ConfigSvc.cxx b/Trigger/TrigConfiguration/TrigConfigSvc/src/LVL1ConfigSvc.cxx index 929c33cd19452dd11dd335b1c5c9fc868e30c27b..3decc4264caa66a2ddee0957a917d80a5c0f701b 100644 --- a/Trigger/TrigConfiguration/TrigConfigSvc/src/LVL1ConfigSvc.cxx +++ b/Trigger/TrigConfiguration/TrigConfigSvc/src/LVL1ConfigSvc.cxx @@ -7,8 +7,6 @@ // Athena/Gaudi includes: -#include "PathResolver/PathResolver.h" - #include "GaudiKernel/ServiceHandle.h" #include "GaudiKernel/IIncidentSvc.h" #include "GaudiKernel/Incident.h" @@ -145,11 +143,7 @@ TrigConf::LVL1ConfigSvc::initializeRun2StyleMenu() { if ( m_configSourceString == "none" ) { ATH_MSG_INFO("Run 2 style menu has been disabled"); m_xmlFile = ""; - } else if( m_configSourceString == "xml") { - if( boost::algorithm::ends_with(m_xmlFile, ".xml") && ! boost::algorithm::starts_with(m_xmlFile, "./") ) { - m_xmlFile = PathResolver::find_file( m_xmlFile, "XMLPATH" ); - } - } else { + } else if( m_configSourceString != "xml") { TrigDBConnectionConfig::DBType dbtype(TrigDBConnectionConfig::DBLookup); if (m_configSourceString == "oracle") { dbtype = TrigDBConnectionConfig::Oracle; } else if (m_configSourceString == "mysql") { dbtype = TrigDBConnectionConfig::MySQL; } diff --git a/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigEFBMuMuFex.cxx b/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigEFBMuMuFex.cxx index 92114749a94e8a5180e3e13ebbf7387d2293d457..f0190d1a12f4f73a30345f86837f0de8c9566625 100644 --- a/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigEFBMuMuFex.cxx +++ b/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigEFBMuMuFex.cxx @@ -1,7 +1,7 @@ // -*- C++ -*- /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /************************************************************************** @@ -331,7 +331,7 @@ HLT::ErrorCode TrigEFBMuMuFex::acceptInputs(HLT::TEConstVec& inputTE, bool& pass // print debug info if(msgLvl() <= MSG::DEBUG) { int ic(0); - for ( const auto muelv : vec_elv_muons) { + for ( const auto& muelv : vec_elv_muons) { // loop over the vector of muon containers msg() << MSG::DEBUG << "MuonContainer, Got MuonEF " << ic << " Feature, size = " << muelv.size() << endmsg; int i(0); @@ -360,7 +360,7 @@ HLT::ErrorCode TrigEFBMuMuFex::acceptInputs(HLT::TEConstVec& inputTE, bool& pass ++ic; } // for muons ic =0; - for ( const auto tpelv : vec_elv_tps) { + for ( const auto& tpelv : vec_elv_tps) { msg() << MSG::DEBUG << "SATrackParticleContainer, Got MUSA " << ic << " Feature, size = " << tpelv.size() << endmsg; int i(0); for ( const auto tpel: tpelv) { diff --git a/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigEFMultiMuFex.cxx b/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigEFMultiMuFex.cxx index b2697df0c15f4a8440a55650a46a2c2c83ccda6a..4cc889324b06e87bffc999a5db30467673dad2ac 100644 --- a/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigEFMultiMuFex.cxx +++ b/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigEFMultiMuFex.cxx @@ -1,7 +1,7 @@ // -*- C++ -*- /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /************************************************************************** @@ -256,7 +256,7 @@ void TrigEFMultiMuFex::processTriMuon(HLT::TEConstVec& inputTE, xAOD::TrigBphysC if(msgLvl() <= MSG::DEBUG) { int ic(0); - for ( const auto muelv : vec_elv_muons) { + for ( const auto& muelv : vec_elv_muons) { // loop over the vector of muon containers msg() << MSG::DEBUG << "MuonContainer, Got MuonEF " << ic << " Feature, size = " << muelv.size() << endmsg; int i(0); @@ -289,7 +289,7 @@ void TrigEFMultiMuFex::processTriMuon(HLT::TEConstVec& inputTE, xAOD::TrigBphysC std::vector<const xAOD::Muon*> uniqueMuons; // add all the unique muons into a single container - for ( const auto muelv : vec_elv_muons) { + for ( const auto& muelv : vec_elv_muons) { for ( const auto muel : muelv ) { m_bphysHelperTool->addUnique( *muel, uniqueMuons, 0.005,0.005,10,xAOD::Muon::InnerDetectorTrackParticle); } // loop over muonEL in each roi diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/MultijetFlowNetworkBuilder.cxx b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/MultijetFlowNetworkBuilder.cxx index 0d286b048b55140f3643d4507f179338a6eaf8c3..253997a38a8ec100f92a63875138c501dbad3482 100644 --- a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/MultijetFlowNetworkBuilder.cxx +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/MultijetFlowNetworkBuilder.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "./MultijetFlowNetworkBuilder.h" @@ -72,7 +72,7 @@ MultijetFlowNetworkBuilder::make_flowEdges(const HypoJetGroupCIter& groups_b, //obtain a list of job groups without duplicits: std::set<int> u_jgroups; - for(const auto jgis: *matches){u_jgroups.insert(jgis.begin(), jgis.end());} + for(const auto& jgis: *matches){u_jgroups.insert(jgis.begin(), jgis.end());} // a jet may appear inmore than one matched job group. Ensure it recieves // one node number. diff --git a/Trigger/TrigHypothesis/TrigMuonHypo/src/MucombHypo.cxx b/Trigger/TrigHypothesis/TrigMuonHypo/src/MucombHypo.cxx index ae805695173f95f9ffdacbdea4f175c421ec7be8..6e2c375a679e7254750eb4101710fd8dbad60d6f 100755 --- a/Trigger/TrigHypothesis/TrigMuonHypo/src/MucombHypo.cxx +++ b/Trigger/TrigHypothesis/TrigMuonHypo/src/MucombHypo.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "GaudiKernel/MsgStream.h" @@ -193,7 +193,7 @@ HLT::ErrorCode MucombHypo::hltExecute(const HLT::TriggerElement* outputTE, bool m_id_Z0 = pMuon->idTrack()->z0(); //Get the Pt cut for that eta bin - float threshold = (m_id_eta != -9999) ? 0 : 99999999; + float threshold = (m_id_eta != -9999) ? 0 : 999999; float absEta = fabs(m_id_eta); for (std::vector<float>::size_type i = 0; i < m_bins; ++i) if (absEta > m_ptBins[i] && absEta < m_ptBins[i + 1]) threshold = m_ptThresholds[i]; diff --git a/Trigger/TrigHypothesis/TrigMuonHypo/src/MucombStauHypo.cxx b/Trigger/TrigHypothesis/TrigMuonHypo/src/MucombStauHypo.cxx index e15bdf7e1b67a18b917d4ae425e60e9910eb86f0..0b0755bcc7f724fd1a584eb89a181030e3bb14ec 100755 --- a/Trigger/TrigHypothesis/TrigMuonHypo/src/MucombStauHypo.cxx +++ b/Trigger/TrigHypothesis/TrigMuonHypo/src/MucombStauHypo.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "GaudiKernel/MsgStream.h" @@ -218,7 +218,7 @@ HLT::ErrorCode MucombStauHypo::hltExecute(const HLT::TriggerElement* outputTE, m_id_Z0 = (track)? track->param()->z0()/10. : -9999; //Get the Pt cut for that eta bin - float threshold = (m_id_eta!=-9999)? 0 : 99999999; + float threshold = (m_id_eta!=-9999)? 0 : 999999; float absEta = fabs(m_id_eta); for (std::vector<float>::size_type i=0; i<m_bins; ++i) if ( absEta > m_ptBins[i] && absEta < m_ptBins[i+1] ) threshold = m_ptThresholds[i]; diff --git a/Trigger/TrigHypothesis/TrigMuonHypoMT/src/TrigmuCombHypoTool.cxx b/Trigger/TrigHypothesis/TrigMuonHypoMT/src/TrigmuCombHypoTool.cxx index 241fdda0aabfb10e8084b77e1040aeacd77a2ebd..b5ae07ca846df9d0d5680638e6244e67a259e0e9 100644 --- a/Trigger/TrigHypothesis/TrigMuonHypoMT/src/TrigmuCombHypoTool.cxx +++ b/Trigger/TrigHypothesis/TrigMuonHypoMT/src/TrigmuCombHypoTool.cxx @@ -132,7 +132,7 @@ bool TrigmuCombHypoTool::decideOnSingleObject(TrigmuCombHypoTool::CombinedMuonIn idZ0 = pMuon->idTrack()->z0(); //Get the Pt cut for that eta bin - float threshold = (idEta != -9999) ? 0 : 99999999; + float threshold = (idEta != -9999) ? 0 : 999999; float absEta = fabs(idEta); for (std::vector<float>::size_type i = 0; i < m_bins[cutIndex]; ++i) { if (absEta > m_ptBins[cutIndex][i] && absEta < m_ptBins[cutIndex][i + 1]) threshold = m_ptThresholds[cutIndex][i]; diff --git a/Trigger/TrigHypothesis/TrigTauHypo/src/EFTauTauCombHypo.cxx b/Trigger/TrigHypothesis/TrigTauHypo/src/EFTauTauCombHypo.cxx index aa2ec525177684627d403710a0a193f8e04cf4a7..cdc55ad28b0270d1d400c1728a4347ea8597d71a 100644 --- a/Trigger/TrigHypothesis/TrigTauHypo/src/EFTauTauCombHypo.cxx +++ b/Trigger/TrigHypothesis/TrigTauHypo/src/EFTauTauCombHypo.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /************************************************************************** @@ -142,13 +142,13 @@ HLT::ErrorCode EFTauTauCombHypo::hltExecute(const HLT::TriggerElement* outputTE, m_monDRAll=dr; m_monMassAll = mass; m_monVxState = VX_state; - m_moncombtype=0; -if(VX_state==1515) - m_moncombtype=1; -if(VX_state==1513) - m_moncombtype=2; -if(VX_state==1511) - m_moncombtype=3; + m_moncombtype=0; + if(VX_state==1515) + m_moncombtype=1; + if(VX_state==1513) + m_moncombtype=2; + if(VX_state==1511) + m_moncombtype=3; // if(m_oppositeCharge && !oppositeCharge) // { // if(msgLvl() <= MSG::VERBOSE) { diff --git a/Trigger/TrigHypothesis/TrigTauHypo/src/T2TauTauCombHypo.cxx b/Trigger/TrigHypothesis/TrigTauHypo/src/T2TauTauCombHypo.cxx index a69fc5e8f2c739f5bf380d8237175772f2a54f54..78bd9466f2be04dd8191a8a8a816c9168acc2412 100644 --- a/Trigger/TrigHypothesis/TrigTauHypo/src/T2TauTauCombHypo.cxx +++ b/Trigger/TrigHypothesis/TrigTauHypo/src/T2TauTauCombHypo.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /************************************************************************** @@ -160,13 +160,13 @@ HLT::ErrorCode T2TauTauCombHypo::hltExecute(const HLT::TriggerElement* inputTE, m_monDRAll=dr; m_monDEtaAll=deta; m_monMassAll = mass; -m_moncombtype=0; -if(VX_state==1515) - m_moncombtype=1; -if(VX_state==1513) - m_moncombtype=2; -if(VX_state==1511) - m_moncombtype=3; + m_moncombtype=0; + if(VX_state==1515) + m_moncombtype=1; + if(VX_state==1513) + m_moncombtype=2; + if(VX_state==1511) + m_moncombtype=3; // if(m_oppositeCharge && !oppositeCharge) diff --git a/Trigger/TrigMonitoring/TrigBjetMonitoring/src/HLTBjetMonTool.cxx b/Trigger/TrigMonitoring/TrigBjetMonitoring/src/HLTBjetMonTool.cxx index bcef5e4e6041a97b7a833633b120042a9fdac950..52d4c28860d8a108b9ddc189644892995403afac 100755 --- a/Trigger/TrigMonitoring/TrigBjetMonitoring/src/HLTBjetMonTool.cxx +++ b/Trigger/TrigMonitoring/TrigBjetMonitoring/src/HLTBjetMonTool.cxx @@ -1075,7 +1075,7 @@ StatusCode HLTBjetMonTool::book(){ std::vector< TrigCompositeUtils::LinkInfo<xAOD::JetContainer> > onlinejets = m_trigDec->features<xAOD::JetContainer>(trigItem, TrigDefs::Physics, m_onlineBjetContainerKey); // TM 240320 int ijet = 0; int itrack = 0; - for(const auto jetLinkInfo : onlinejets) { + for(const auto& jetLinkInfo : onlinejets) { // jetPt const xAOD::Jet* jet = *(jetLinkInfo.link); ATH_MSG_DEBUG(" - pt/eta/phi: " << (jet->pt())*1.e-3 << " / " << jet->eta() << " / " << jet->phi()); diff --git a/Trigger/TrigMonitoring/TrigBjetMonitoring/src/TrigBjetMonitorAlgorithm.cxx b/Trigger/TrigMonitoring/TrigBjetMonitoring/src/TrigBjetMonitorAlgorithm.cxx index 503e71ac1b32747c319d37732f41e02aa974ae25..c714e534bcd70b7318be4a0ef16993c80e5d8571 100644 --- a/Trigger/TrigMonitoring/TrigBjetMonitoring/src/TrigBjetMonitorAlgorithm.cxx +++ b/Trigger/TrigMonitoring/TrigBjetMonitoring/src/TrigBjetMonitorAlgorithm.cxx @@ -348,7 +348,7 @@ StatusCode TrigBjetMonitorAlgorithm::fillHistograms( const EventContext& ctx ) c auto nJet = Monitored::Scalar<int>(nJetH,0.0); nJet = onlinejets.size(); fill("TrigBjetMonitor",nJet); - for(const auto jetLinkInfo : onlinejets) { + for(const auto& jetLinkInfo : onlinejets) { // jetPt const xAOD::Jet* jet = *(jetLinkInfo.link); std::string NameH = "jetPt_"+trigName; diff --git a/Trigger/TrigMonitoring/TrigEgammaMonitoring/python/TrigEgammaMonitCategory.py b/Trigger/TrigMonitoring/TrigEgammaMonitoring/python/TrigEgammaMonitCategory.py index ff025422247407ec430ad1b416fe97a7771f339f..8b7b1dd7603148f8e1066e21fb707a1d5f994319 100644 --- a/Trigger/TrigMonitoring/TrigEgammaMonitoring/python/TrigEgammaMonitCategory.py +++ b/Trigger/TrigMonitoring/TrigEgammaMonitoring/python/TrigEgammaMonitCategory.py @@ -7,7 +7,7 @@ #Important to keep lists updated primary_single_ele = ['HLT_e24_lhtight_nod0','HLT_e26_lhtight_nod0','HLT_e28_lhtight_nod0','HLT_e60_lhmedium_nod0_L1EM24VHI','HLT_e80_lhmedium_nod0_L1EM24VHI','HLT_e140_lhloose_nod0_L1EM24VHI'] primary_single_ele_iso =['HLT_e24_lhtight_nod0_ivarloose','HLT_e26_lhtight_nod0_ivarloose',] -monitoring_Zee = ['HLT_e26_lhtight_nod0_e15_etcut_L1EM7_Zee'] +monitoring_Zee = ['HLT_e26_lhtight_nod0_ivarloose', 'HLT_e26_lhtight_nod0_e15_etcut_L1EM7_Zee'] monitoring_Jpsiee = ['HLT_e5_lhtight_nod0_e4_etcut','HLT_e5_lhtight_nod0_e4_etcut_Jpsiee'] primary_single_pho = ['HLT_g140_tight','HLT_g200_loose'] @@ -63,7 +63,9 @@ monitoring_L1Calo = [] commission_electron = [] monitoring_electron = ['HLT_e60_lhmedium_nod0_L1EM22VHI', + 'HLT_e60_lhmedium_nod0_L1EM24VHI', 'HLT_e140_lhloose_nod0_L1EM22VHI' + 'HLT_e140_lhloose_nod0_L1EM24VHI' ] # monitoring_electron += commission_electron @@ -74,7 +76,10 @@ commissionTP_electron = [ 'HLT_e24_lhvloose_nod0_sc_gsf'] monitoringTP_electron = [ + 'HLT_e15_lhloose_nod0', + 'HLT_e24_lhmedium_nod0_L1EM20VH', 'HLT_e26_lhtight_nod0_ivarloose', + 'HLT_e28_lhtight_idperf', 'HLT_e28_lhtight_nod0_ivarloose', 'HLT_e24_lhvloose_nod0_L1EM20VH' ] @@ -83,9 +88,12 @@ monitoringTP_electron += commissionTP_electron monitoringTP_Jpsiee = ["HLT_e5_lhtight_nod0"] monitoring_photon = ['HLT_g25_medium_L1EM20VH', - 'HLT_g25_medium_sc_L1EM20VH', + 'HLT_g25_loose_L1EM20VH', + 'HLT_g35_loose_L1EM20VH', 'HLT_g20_tight_icalovloose_L1EM15VHI', - 'HLT_g200_loose'] + 'HLT_g120_loose' + 'HLT_g200_loose' + ] #Add the Menu-Aware monitoring; maps a trigger to a category monitoring_mam = {'primary_single_ele_iso':'HLT_e26_lhtight_nod0_ivarloose', diff --git a/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/TrigEgammaMonitorAnalysisAlgorithm.cxx b/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/TrigEgammaMonitorAnalysisAlgorithm.cxx index 19b477ba66ae40f91bd7329282d2f63c4e3fa2eb..811d0af23de6d6829b779c48524563724285d19e 100644 --- a/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/TrigEgammaMonitorAnalysisAlgorithm.cxx +++ b/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/TrigEgammaMonitorAnalysisAlgorithm.cxx @@ -88,12 +88,12 @@ void TrigEgammaMonitorAnalysisAlgorithm::fillEfficiencies( std::vector< std::pai if( m_detailedHists ){ - for( const auto pid : m_isemname ){ + for( const auto& pid : m_isemname ){ fillEfficiency( "HLT_" + pid, "HLT", "is"+pid, info, pair_vec ); fillEfficiency( "HLT_" + pid + "Iso", "HLT", "is"+pid, info, pair_iso_vec ); } - for( const auto pid : m_lhname ){ + for( const auto& pid : m_lhname ){ fillEfficiency( "HLT_" + pid, "HLT", "is"+pid, info, pair_vec ); fillEfficiency( "HLT_" + pid + "Iso", "HLT", "is"+pid, info, pair_iso_vec ); } diff --git a/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/TrigEgammaMonitorBaseAlgorithm.cxx b/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/TrigEgammaMonitorBaseAlgorithm.cxx index a3b0cffeca07b72352ec71f21abbde3153655dca..ec025a2ece38cb454e5d8475ef0f60f1fa6d0138 100644 --- a/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/TrigEgammaMonitorBaseAlgorithm.cxx +++ b/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/TrigEgammaMonitorBaseAlgorithm.cxx @@ -140,7 +140,7 @@ asg::AcceptData TrigEgammaMonitorBaseAlgorithm::setAccept( const TrigCompositeUt asg::AcceptInfo accept; - for(const auto cut:m_trigLevel) accept.addCut(cut,cut); + for(const auto& cut:m_trigLevel) accept.addCut(cut,cut); asg::AcceptData acceptData (&accept); diff --git a/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/TrigEgammaMonitorElectronAlgorithm.cxx b/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/TrigEgammaMonitorElectronAlgorithm.cxx index 914408c551b37eaa315a37f5b7e4d20704e3508b..f5c083022d6c91e036d96a50af49012e70386c46 100644 --- a/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/TrigEgammaMonitorElectronAlgorithm.cxx +++ b/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/TrigEgammaMonitorElectronAlgorithm.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "TrigEgammaMonitorElectronAlgorithm.h" @@ -23,7 +23,7 @@ StatusCode TrigEgammaMonitorElectronAlgorithm::initialize() ATH_CHECK(m_offElectronKey.initialize()); - for(const auto trigName:m_trigInputList) + for(const auto& trigName:m_trigInputList) { if(getTrigInfoMap().count(trigName) != 0){ ATH_MSG_WARNING("Trigger already booked, removing from trigger list " << trigName); @@ -52,7 +52,7 @@ StatusCode TrigEgammaMonitorElectronAlgorithm::fillHistograms( const EventContex ATH_MSG_DEBUG("Chains for Analysis " << m_trigList); - for(const auto trigger : m_trigList){ + for(const auto& trigger : m_trigList){ const TrigInfo info = getTrigInfo(trigger); diff --git a/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/TrigEgammaMonitorPhotonAlgorithm.cxx b/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/TrigEgammaMonitorPhotonAlgorithm.cxx index 78f5a2655640cc1b796af7781352dd60590e1fd5..4534a87769c72c1f9b741345ace79609ab18a365 100644 --- a/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/TrigEgammaMonitorPhotonAlgorithm.cxx +++ b/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/TrigEgammaMonitorPhotonAlgorithm.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "TrigEgammaMonitorPhotonAlgorithm.h" @@ -24,7 +24,7 @@ StatusCode TrigEgammaMonitorPhotonAlgorithm::initialize() ATH_CHECK(m_offPhotonKey.initialize()); - for(const auto trigName:m_trigInputList) + for(const auto& trigName:m_trigInputList) { if(getTrigInfoMap().count(trigName) != 0){ ATH_MSG_WARNING("Trigger already booked, removing from trigger list " << trigName); @@ -52,7 +52,7 @@ StatusCode TrigEgammaMonitorPhotonAlgorithm::fillHistograms( const EventContext& ATH_MSG_DEBUG("Chains for Analysis " << m_trigList); - for(const auto trigger : m_trigList){ + for(const auto& trigger : m_trigList){ const TrigInfo info = getTrigInfo(trigger); diff --git a/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/TrigEgammaMonitorTagAndProbeAlgorithm.cxx b/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/TrigEgammaMonitorTagAndProbeAlgorithm.cxx index 732925f052bfd5d65afa0ac6ed769957608f05a8..ce9673abc711690fa88191dd7c8919393f7b510d 100644 --- a/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/TrigEgammaMonitorTagAndProbeAlgorithm.cxx +++ b/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/TrigEgammaMonitorTagAndProbeAlgorithm.cxx @@ -52,7 +52,7 @@ StatusCode TrigEgammaMonitorTagAndProbeAlgorithm::initialize() { ATH_MSG_INFO("Now configuring chains for analysis: " << name() ); std::vector<std::string> chains = tdt()->getListOfTriggers("HLT_e.*, L1_EM.*, HLT_g.*"); - for(const auto trigName:m_trigInputList) + for(const auto& trigName:m_trigInputList) { if(getTrigInfoMap().count(trigName) != 0){ ATH_MSG_WARNING("Trigger already booked, removing from trigger list " << trigName); diff --git a/Trigger/TrigMonitoring/TrigIDtrkMonitoring/python/TrigIDPhysValMonitoringConfig.py b/Trigger/TrigMonitoring/TrigIDtrkMonitoring/python/TrigIDPhysValMonitoringConfig.py index aee6764431719e1c78b6bb130e89a56cb7bc73de..998080e7548778716a8bd56cd7e43a73eb4dea6e 100644 --- a/Trigger/TrigMonitoring/TrigIDtrkMonitoring/python/TrigIDPhysValMonitoringConfig.py +++ b/Trigger/TrigMonitoring/TrigIDtrkMonitoring/python/TrigIDPhysValMonitoringConfig.py @@ -156,8 +156,8 @@ def TrigIDPhysValMonitoringTool( legacy_monitoring=False ): useHighestPT = True if mt_chains: chainnames = [ - "HLT_tau.*idperf.*tracktwo.*:key=HLT_IDTrack_TauCore_FTF", - "HLT_tau.*idperf.*tracktwo.*:key=HLT_IDTrack_TauIso_FTF", + "HLT_tau.*idperf.*tracktwo.*:key=HLT_IDTrack_TauCore_FTF:roi=HLT_Roi_TauCore", + "HLT_tau.*idperf.*tracktwo.*:key=HLT_IDTrack_TauIso_FTF:roi=HLT_Roi_TauIso", "HLT_tau.*idperf.*tracktwo.*:key=HLT_IDTrack_Tau_IDTrig", "HLT_tau.*idperf.*tracktwo.*:key=HLT_IDTrack_Tau_FTF" ] @@ -179,8 +179,8 @@ def TrigIDPhysValMonitoringTool( legacy_monitoring=False ): useOffline=True if mt_chains: chainnames = [ - "HLT_tau.*idperf.*tracktwo.*:key=HLT_IDTrack_TauCore_FTF", - "HLT_tau.*idperf.*tracktwo.*:key=HLT_IDTrack_TauIso_FTF", + "HLT_tau.*idperf.*tracktwo.*:key=HLT_IDTrack_TauCore_FTF:roi=HLT_Roi_TauCore", + "HLT_tau.*idperf.*tracktwo.*:key=HLT_IDTrack_TauIso_FTF:roi=HLT_Roi_TauIso", "HLT_tau.*idperf.*tracktwo.*:key=HLT_IDTrack_Tau_IDTrig", "HLT_tau.*idperf.*tracktwo.*:key=HLT_IDTrack_Tau_FTF" ] diff --git a/Trigger/TrigMonitoring/TrigIDtrkMonitoring/python/TrigIDtrkMonitoringConfig.py b/Trigger/TrigMonitoring/TrigIDtrkMonitoring/python/TrigIDtrkMonitoringConfig.py index 55bd062918373294cd0de0d2bd72cab802146d23..b6e3d58fd04059c91ae1a71ef956910adf07979a 100644 --- a/Trigger/TrigMonitoring/TrigIDtrkMonitoring/python/TrigIDtrkMonitoringConfig.py +++ b/Trigger/TrigMonitoring/TrigIDtrkMonitoring/python/TrigIDtrkMonitoringConfig.py @@ -255,8 +255,8 @@ def TrigIDtrkMonitoringTool( legacy_monitoring=False ): if mt_chains: tidatau.ntupleChainNames += [ "Offline", - "HLT_tau.*idperf.*:key=HLT_IDTrack_TauCore_FTF:roi=HLT_TAURoI", - "HLT_tau.*idperf.*:key=HLT_IDTrack_TauIso_FTF:roi=HLT_TAURoI", + "HLT_tau.*idperf.*:key=HLT_IDTrack_TauCore_FTF:roi=HLT_Roi_TauCore", + "HLT_tau.*idperf.*:key=HLT_IDTrack_TauIso_FTF:roi=HLT_Roi_TauIso", "HLT_tau.*idperf.*:key=HLT_IDTrack_Tau_FTF:roi=HLT_TAURoI", "HLT_tau.*idperf.*:key=HLT_IDTrack_Tau_IDTrig:roi=HLT_TAURoI" ] diff --git a/Trigger/TrigMonitoring/TrigMonitorBase/src/TrigGenericMonitoringTool.cxx b/Trigger/TrigMonitoring/TrigMonitorBase/src/TrigGenericMonitoringTool.cxx index ecf8882c31b9f8ee1084b65822c2b2d1065e59a0..59a2448f11ca34bbb2a32feeba9af03cd9d7f8ba 100755 --- a/Trigger/TrigMonitoring/TrigMonitorBase/src/TrigGenericMonitoringTool.cxx +++ b/Trigger/TrigMonitoring/TrigMonitorBase/src/TrigGenericMonitoringTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include <iostream> @@ -379,7 +379,7 @@ StatusCode TrigGenericMonitoringTool<M,P>::fillHists() { template <class M, class P> StatusCode TrigGenericMonitoringTool<M,P>::finalHists() { - for ( const auto i : m_histogramCategory ) { + for ( const auto& i : m_histogramCategory ) { delete i.second; } m_histogramCategory.clear(); diff --git a/Trigger/TrigMonitoring/TrigMuonMonitoring/src/MuCombMon.cxx b/Trigger/TrigMonitoring/TrigMuonMonitoring/src/MuCombMon.cxx index ca4d3afb1467a85cf6297e5ed263ec3d34977d30..1b76f4e564bfdade71bd07ff6072f616374485fd 100644 --- a/Trigger/TrigMonitoring/TrigMuonMonitoring/src/MuCombMon.cxx +++ b/Trigger/TrigMonitoring/TrigMuonMonitoring/src/MuCombMon.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /** @Afile HLTMuonMonTool.cxx @@ -408,11 +408,11 @@ StatusCode HLTMuonMonTool::fillMuCombDQA() error = true; } if(!error){ - hist("muComb_MF_error", m_histdirmucomb)->Fill(0); + hist("muComb_MF_error", m_histdirmucomb)->Fill(0); } - else continue; + else continue; - //Plot muComb eta vs phi for standard chain + //Plot muComb eta vs phi for standard chain float mc_pt = cb_cont->at(0)->pt(); float mc_eta = cb_cont->at(0)->eta(); float mc_phi = cb_cont->at(0)->phi(); diff --git a/Trigger/TrigMonitoring/TrigSteerMonitor/src/TrigRoIMoni.cxx b/Trigger/TrigMonitoring/TrigSteerMonitor/src/TrigRoIMoni.cxx index e14b1fe3851b5ac7b6eb28f5fe583f1868166c87..4d48083c06b2d9d6d14548275d514b6b742ba578 100644 --- a/Trigger/TrigMonitoring/TrigSteerMonitor/src/TrigRoIMoni.cxx +++ b/Trigger/TrigMonitoring/TrigSteerMonitor/src/TrigRoIMoni.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include <vector> @@ -637,7 +637,7 @@ void TrigRoIMoni::FillEtaPhiPlots() const std::vector< HLT::JetEnergyRoI >& jetERoIs = m_lvl1Tool->createJetEnergyThresholds(*result, false); // MM: safe to set this to false? - for (const HLT::JetEnergyRoI jetERoI : jetERoIs) { + for (const HLT::JetEnergyRoI& jetERoI : jetERoIs) { if (jetERoI.type() == HLT::JetRoI || jetERoI.type() == HLT::ForwardJetRoI) { diff --git a/Trigger/TrigSteer/TrigSteering/TrigSteering/Signature.h b/Trigger/TrigSteer/TrigSteering/TrigSteering/Signature.h index d775f6a83f26c0f00fd2b51ac8b7b9b16cb94ce0..8c0256518027131e73ccfd408dc3534d8fe6df4a 100755 --- a/Trigger/TrigSteer/TrigSteering/TrigSteering/Signature.h +++ b/Trigger/TrigSteer/TrigSteering/TrigSteering/Signature.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /********************************************************************************** @@ -121,6 +121,7 @@ namespace HLT { */ struct RequiredTEs{ RequiredTEs(int mult, HLT::Sequence* seq): multiplicity(mult), sequence(seq) {} + RequiredTEs(const RequiredTEs& r) = default; RequiredTEs& operator=(const RequiredTEs& r) { const_cast<unsigned int&>((this->multiplicity)) = r.multiplicity; sequence = r.sequence; diff --git a/Trigger/TrigSteer/TrigSteering/src/EventInfoAccessTool.cxx b/Trigger/TrigSteer/TrigSteering/src/EventInfoAccessTool.cxx index ff014d8d76bd9a89abe8d3ef8ef9ba98ae70307e..06a220e8fa972384c7ad759596f9a0646b0ced1b 100644 --- a/Trigger/TrigSteer/TrigSteering/src/EventInfoAccessTool.cxx +++ b/Trigger/TrigSteer/TrigSteering/src/EventInfoAccessTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /********************************************************************************** @@ -69,7 +69,7 @@ StatusCode HLT::EventInfoAccessTool::getStreamTags(std::vector< xAOD::EventInfo: ATH_MSG_DEBUG("[xAOD::EventInfo] Event has no trigger streams"); } else { ATH_MSG_DEBUG("[xAOD::EventInfo] Event has " << streams.size() << " stream(s)"); - for(const xAOD::EventInfo::StreamTag st : streams ) { + for(const xAOD::EventInfo::StreamTag& st : streams ) { ATH_MSG_DEBUG("xAOD::EventInfo::StreamTag stream = "<<st.name()<<" type = "<< st.type()); } } @@ -148,7 +148,7 @@ StatusCode HLT::EventInfoAccessTool::setStreamTags(const std::vector< xAOD::Even ATH_MSG_VERBOSE("Updated xAOD::StreamTags in xAOD::EventInfo:"); ATH_MSG_DEBUG("After update, event has " << xeventInfo->streamTags().size() << " stream(s) in xAOD::EventInfo"); - for(const xAOD::EventInfo::StreamTag st : set_streams ) { + for(const xAOD::EventInfo::StreamTag& st : set_streams ) { ATH_MSG_DEBUG("xAOD::EventInfo::StreamTag stream = "<<st.name()<<" type = "<< st.type()); } @@ -169,7 +169,7 @@ StatusCode HLT::EventInfoAccessTool::setStreamTags(const std::vector< xAOD::Even triggerInfo->setStreamTags(StreamTags); ATH_MSG_VERBOSE("Updated TriggerInfo::StreamTags in EventInfo:"); ATH_MSG_DEBUG("Back compatiblity: After update, event has " << triggerInfo->streamTags().size() << " stream(s) in EventInfo"); - for(const TriggerInfo::StreamTag st : StreamTags ) { + for(const TriggerInfo::StreamTag& st : StreamTags ) { ATH_MSG_DEBUG("TriggerInfo::StreamTag stream = "<<st.name()<<" type = "<< st.type()); } @@ -212,13 +212,13 @@ StatusCode HLT::EventInfoAccessTool::updateStreamTag(const std::vector<SteeringC // check if the stream is already in bool already_in=false; - for(const xAOD::EventInfo::StreamTag st : streams ) { + for(const xAOD::EventInfo::StreamTag& st : streams ) { if(stream_to_add == st.name()) { already_in=true; break; } } - for(const xAOD::EventInfo::StreamTag st : new_streams ) { + for(const xAOD::EventInfo::StreamTag& st : new_streams ) { if(stream_to_add == st.name()) { already_in=true; break; diff --git a/Trigger/TrigT1/L1Common/CMakeLists.txt b/Trigger/TrigT1/L1Common/CMakeLists.txt index 13af140ac92b3f748419df595e8c9a8bbf514063..103f49390cb417bafc15ab9509a54324179428e6 100644 --- a/Trigger/TrigT1/L1Common/CMakeLists.txt +++ b/Trigger/TrigT1/L1Common/CMakeLists.txt @@ -1,8 +1,4 @@ -################################################################################ -# Package: L1Common -################################################################################ -# Author: ruth.poettgen@cern.ch -################################################################################ +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration # The name of the package: atlas_subdir( L1Common ) diff --git a/Trigger/TrigT1/TrigT1CTMonitoring/CMakeLists.txt b/Trigger/TrigT1/TrigT1CTMonitoring/CMakeLists.txt index 040331a13fb91c8e4aa6f8fa3fc95f1fca3dfe93..96e3d3713e3b2978af8c0855468c2df2446ef135 100644 --- a/Trigger/TrigT1/TrigT1CTMonitoring/CMakeLists.txt +++ b/Trigger/TrigT1/TrigT1CTMonitoring/CMakeLists.txt @@ -1,33 +1,8 @@ -# $Id: CMakeLists.txt 767189 2016-08-10 09:17:01Z krasznaa $ -################################################################################ -# Package: TrigT1CTMonitoring -################################################################################ +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration # Declare the package name: atlas_subdir( TrigT1CTMonitoring ) -# Declare the package's dependencies: -atlas_depends_on_subdirs( - PUBLIC - GaudiKernel - PRIVATE - Trigger/TrigConfiguration/TrigConfInterfaces - Control/AthenaBaseComps - Trigger/TrigT1/TrigT1Interfaces - Control/AthenaMonitoring - Database/AthenaPOOL/AthenaPoolUtilities - Database/CoraCool - Event/EventInfo - Tools/LWHists - Trigger/TrigConfiguration/TrigConfL1Data - Trigger/TrigConfiguration/TrigConfStorage - Trigger/TrigT1/TrigT1CTP - Trigger/TrigT1/TrigT1CaloEvent - Trigger/TrigT1/TrigT1Result - MuonSpectrometer/MuonDigitContainer - MuonSpectrometer/MuonRDO - MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonTrigCoinData ) - # External dependencies: find_package( Boost ) find_package( COOL COMPONENTS CoolKernel ) @@ -37,13 +12,8 @@ find_package( ROOT COMPONENTS Core MathCore Hist ) # Component(s) in the package: atlas_add_component( TrigT1CTMonitoring src/*.h src/*.cxx src/components/*.cxx - INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${COOL_INCLUDE_DIRS} ${CORAL_INCLUDE_DIRS} - ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES ${Boost_LIBRARIES} ${COOL_LIBRARIES} ${CORAL_LIBRARIES} - ${ROOT_LIBRARIES} AthenaBaseComps AthenaMonitoringLib GaudiKernel - TrigT1Interfaces MuonTrigCoinData AthenaPoolUtilities CoraCool EventInfo - LWHists TrigConfL1Data TrigConfStorage TrigT1CaloEventLib TrigT1Result - MuonDigitContainer MuonRDO ) + INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${COOL_INCLUDE_DIRS} ${CORAL_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} + LINK_LIBRARIES ${Boost_LIBRARIES} ${COOL_LIBRARIES} ${CORAL_LIBRARIES} ${ROOT_LIBRARIES} AthenaBaseComps AthenaMonitoringLib AthenaPoolUtilities CoraCool EventInfo GaudiKernel LWHists MuonDigitContainer MuonRDO MuonTrigCoinData TrigConfInterfaces TrigConfL1Data TrigConfStorage TrigT1CaloEventLib TrigT1Interfaces TrigT1Result ) # Install files from the package: atlas_install_python_modules( python/*.py ) diff --git a/Trigger/TrigT1/TrigT1CTP/TrigT1CTP/ATLAS_CHECK_THREAD_SAFETY b/Trigger/TrigT1/TrigT1CTP/ATLAS_CHECK_THREAD_SAFETY similarity index 100% rename from Trigger/TrigT1/TrigT1CTP/TrigT1CTP/ATLAS_CHECK_THREAD_SAFETY rename to Trigger/TrigT1/TrigT1CTP/ATLAS_CHECK_THREAD_SAFETY diff --git a/Trigger/TrigT1/TrigT1CTP/CMakeLists.txt b/Trigger/TrigT1/TrigT1CTP/CMakeLists.txt index 0bcd2c4101cab3c8d896eae6fc9f2e272712fb31..848b147db386f268297d88af023d4c71f03be85b 100644 --- a/Trigger/TrigT1/TrigT1CTP/CMakeLists.txt +++ b/Trigger/TrigT1/TrigT1CTP/CMakeLists.txt @@ -1,46 +1,23 @@ -################################################################################ -# Package: TrigT1CTP -################################################################################ +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration # Declare the package name: atlas_subdir( TrigT1CTP ) -# Declare the package's dependencies: -atlas_depends_on_subdirs( PUBLIC - Control/AthenaBaseComps - Control/StoreGate - GaudiKernel - Trigger/TrigConfiguration/TrigConfInterfaces - Trigger/TrigConfiguration/TrigConfL1Data - Trigger/TrigConfiguration/TrigConfData - Trigger/TrigSteer/TrigInterfaces - PRIVATE - Control/AthenaKernel - Database/AthenaPOOL/AthenaPoolUtilities - Event/EventInfo - Tools/PathResolver - Trigger/TrigConfiguration/TrigConfStorage - Trigger/TrigT1/L1Topo/L1TopoConfig - Trigger/TrigT1/TrigT1Interfaces - Trigger/TrigT1/TrigT1Result - Trigger/TrigT1/TrigT1CaloUtils ) - # External dependencies: -find_package( Boost COMPONENTS filesystem thread system ) +find_package( Boost ) find_package( CLHEP ) -find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread ) -find_package( tdaq-common COMPONENTS CTPfragment ) +find_package( ROOT COMPONENTS Core Tree Hist ) +find_package( tdaq-common COMPONENTS eformat ) # Component(s) in the package: atlas_add_component( TrigT1CTP src/*.cxx src/components/*.cxx INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} ${TDAQ-COMMON_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} - LINK_LIBRARIES ${Boost_LIBRARIES} ${ROOT_LIBRARIES} ${TDAQ-COMMON_LIBRARIES} ${CLHEP_LIBRARIES} AthenaBaseComps StoreGateLib SGtests GaudiKernel TrigConfData TrigConfL1Data TrigInterfacesLib AthenaKernel AthenaPoolUtilities EventInfo PathResolver TrigConfStorage L1TopoConfig TrigT1Interfaces TrigT1Result TrigT1CaloUtilsLib AthenaMonitoringLib ) + LINK_LIBRARIES ${CLHEP_LIBRARIES} ${ROOT_LIBRARIES} ${TDAQ-COMMON_LIBRARIES} AthenaBaseComps AthenaKernel AthenaMonitoringKernelLib GaudiKernel StoreGateLib TrigConfData TrigConfInterfaces TrigConfL1Data TrigT1CaloUtilsLib TrigT1Interfaces TrigT1Result xAODTrigCalo xAODTrigger ) # Install files from the package: -atlas_install_headers( TrigT1CTP ) -atlas_install_python_modules( python/*.py ) +atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) atlas_install_joboptions( share/*.py ) atlas_install_generic( data/*.cfg DESTINATION share/TrigT1CTP diff --git a/Trigger/TrigT1/TrigT1CTP/python/TrigT1CTPAlgorithmConfig.py b/Trigger/TrigT1/TrigT1CTP/python/TrigT1CTPAlgorithmConfig.py deleted file mode 100755 index 803cd5412c970a8f756a9ef716e53cc0b3eada0c..0000000000000000000000000000000000000000 --- a/Trigger/TrigT1/TrigT1CTP/python/TrigT1CTPAlgorithmConfig.py +++ /dev/null @@ -1,28 +0,0 @@ -# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration - -## get a handle to the default top-level algorithm sequence -from AthenaCommon.AlgSequence import AlgSequence -topSequence = AlgSequence() -## get a handle to the ApplicationManager -from AthenaCommon.AppMgr import theApp -## get a handle to the ServiceManager -from AthenaCommon.AppMgr import ServiceMgr as svcMgr - -## to decode the MuCTPI bytestream -from TrigT1ResultByteStream.TrigT1ResultByteStreamConf import CTPByteStreamTool,RecCTPByteStreamTool - -if not hasattr( svcMgr, "THistSvc" ): - from GaudiSvc.GaudiSvcConf import THistSvc - svcMgr += THistSvc() -#svcMgr.THistSvc.Output = ["file1 DATAFILE='HistFile.root' OPT='RECREATE'"]; - -if not hasattr( theApp.Dlls, "RootHistCnv" ): - theApp.Dlls += [ "RootHistCnv" ] - theApp.HistogramPersistency = "ROOT" - -if not hasattr( svcMgr, "NTupleSvc" ): - from GaudiSvc.GaudiSvcConf import NTupleSvc - svcMgr += NTupleSvc() -#svcMgr.NTupleSvc.Output = [ "FILE1 DATAFILE='NtupleFile.root' OPT='NEW'" ] - -#print topSequence diff --git a/Trigger/TrigT1/TrigT1CTP/python/TrigT1CTPConfig.py b/Trigger/TrigT1/TrigT1CTP/python/TrigT1CTPConfig.py index 89bd2e4c6edbb4874d0bbf5a6445c9b1480947f3..852d6910bd13d3a6126efe8fb4fa22a32b2c6bb1 100755 --- a/Trigger/TrigT1/TrigT1CTP/python/TrigT1CTPConfig.py +++ b/Trigger/TrigT1/TrigT1CTP/python/TrigT1CTPConfig.py @@ -1,7 +1,6 @@ -# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -from TrigT1CTP.TrigT1CTPConf import * -from AthenaCommon.Constants import DEBUG, INFO +from TrigT1CTP.TrigT1CTPConf import LVL1CTP__CTPSimulation class DefaultCTPSimulation(LVL1CTP__CTPSimulation): @@ -13,8 +12,6 @@ class DefaultCTPSimulation(LVL1CTP__CTPSimulation): self.AthenaMonTools = [] - self.OutputLevel = INFO - def setDefaultRandomService(self, rndmSvc = 'AtRanluxGenSvc'): # Random service is not needed anymore in Run 3 for CTP pass diff --git a/Trigger/TrigT1/TrigT1CTP/python/__init__.py b/Trigger/TrigT1/TrigT1CTP/python/__init__.py index a06fe23f11180c418edab295e19512ef9b1bcc8d..f2f0fc1b7b487784e8781d2a41e43908019e0a7d 100755 --- a/Trigger/TrigT1/TrigT1CTP/python/__init__.py +++ b/Trigger/TrigT1/TrigT1CTP/python/__init__.py @@ -1,8 +1 @@ -# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration - -# -# $Id: __init__.py,v 1.4 2008-06-10 13:48:37 efeld Exp $ -# -__version__ = '1.0.0' -__author__ = 'Wolfgang.Ehrenfeld@desy.de,berge@cern.ch' -__all__ = [ 'TrigT1CTPConfig', 'TrigT1CTPMonitoring', 'TrigT1CTPAlgorithmConfig' ] +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration diff --git a/Trigger/TrigT1/TrigT1CaloByteStream/CMakeLists.txt b/Trigger/TrigT1/TrigT1CaloByteStream/CMakeLists.txt index 0995d67f2333316b0fe3dfcb73fd3a6747b1c1dd..b725b4445bfacc97cfa7e06ff27364ed6ddf8318 100644 --- a/Trigger/TrigT1/TrigT1CaloByteStream/CMakeLists.txt +++ b/Trigger/TrigT1/TrigT1CaloByteStream/CMakeLists.txt @@ -1,33 +1,9 @@ -################################################################################ -# Package: TrigT1CaloByteStream -################################################################################ +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration # Declare the package name: atlas_subdir( TrigT1CaloByteStream ) -# Declare the package's dependencies: -atlas_depends_on_subdirs( PUBLIC - Control/AthToolSupport/AsgTools - Control/AthContainers - Event/xAOD/xAODTrigL1Calo - GaudiKernel - PRIVATE - Control/AthenaBaseComps - Control/AthenaKernel - Control/SGTools - Control/StoreGate - Control/CxxUtils - Event/ByteStreamCnvSvcBase - Event/ByteStreamData - Event/EventInfo - ForwardDetectors/ZDC/ZdcCnv/ZdcByteStream - Trigger/TrigT1/TrigT1CaloEvent - Trigger/TrigT1/TrigT1CaloToolInterfaces - Trigger/TrigT1/TrigT1CaloUtils - Trigger/TrigT1/TrigT1Interfaces ) - # External dependencies: -find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread ) find_package( tdaq-common COMPONENTS eformat_write ) # Component(s) in the package: @@ -41,14 +17,13 @@ atlas_add_component( TrigT1CaloByteStream src/*.cxx src/xaod/*.cxx src/components/*.cxx - INCLUDE_DIRS ${TDAQ-COMMON_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES ${TDAQ-COMMON_LIBRARIES} ${ROOT_LIBRARIES} AsgTools AthContainers xAODTrigL1Calo GaudiKernel AthenaBaseComps AthenaKernel SGTools StoreGateLib SGtests ByteStreamCnvSvcBaseLib ByteStreamData ByteStreamData_test EventInfo ZdcByteStreamLib TrigT1CaloEventLib TrigT1CaloUtilsLib TrigT1Interfaces CxxUtils ) + INCLUDE_DIRS ${TDAQ-COMMON_INCLUDE_DIRS} + LINK_LIBRARIES ${TDAQ-COMMON_LIBRARIES} AthenaBaseComps AthenaKernel ByteStreamCnvSvcBaseLib ByteStreamData CxxUtils SGTools StoreGateLib TrigT1CaloByteStreamLib TrigT1CaloEventLib TrigT1CaloToolInterfaces TrigT1CaloUtilsLib TrigT1Interfaces ZdcByteStreamLib ) atlas_add_dictionary( TrigT1CaloByteStreamDict TrigT1CaloByteStream/TrigT1CaloByteStreamDict.h TrigT1CaloByteStream/selection.xml - INCLUDE_DIRS ${TDAQ-COMMON_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES ${TDAQ-COMMON_LIBRARIES} ${ROOT_LIBRARIES} AsgTools AthContainers xAODTrigL1Calo GaudiKernel AthenaBaseComps AthenaKernel SGTools StoreGateLib SGtests ByteStreamCnvSvcBaseLib ByteStreamData ByteStreamData_test EventInfo ZdcByteStreamLib TrigT1CaloEventLib TrigT1CaloUtilsLib TrigT1Interfaces ) + LINK_LIBRARIES TrigT1CaloByteStreamLib ) # Install files from the package: atlas_install_joboptions( share/*.py ) diff --git a/Trigger/TrigT1/TrigT1CaloEvent/CMakeLists.txt b/Trigger/TrigT1/TrigT1CaloEvent/CMakeLists.txt index fc100534344c10e8ef7100221969d23721eda8e9..d8ca249c6ec73224506d44f8809dca1b006b4289 100644 --- a/Trigger/TrigT1/TrigT1CaloEvent/CMakeLists.txt +++ b/Trigger/TrigT1/TrigT1CaloEvent/CMakeLists.txt @@ -1,37 +1,15 @@ -################################################################################ -# Package: TrigT1CaloEvent -################################################################################ +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration # Declare the package name: atlas_subdir( TrigT1CaloEvent ) -# Declare the package's dependencies: -atlas_depends_on_subdirs( PUBLIC - Control/AthenaKernel - Control/AthContainers - Control/AthLinks - GaudiKernel - Trigger/TrigT1/TrigT1Interfaces ) - -# External dependencies: -find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread ) - # Component(s) in the package: atlas_add_library( TrigT1CaloEventLib src/*.cxx PUBLIC_HEADERS TrigT1CaloEvent - PRIVATE_INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES AthContainers AthLinks GaudiKernel TrigT1Interfaces - PRIVATE_LINK_LIBRARIES ${ROOT_LIBRARIES} ) - -atlas_add_component( TrigT1CaloEvent - src/components/*.cxx - INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} AthContainers AthLinks GaudiKernel TrigT1Interfaces TrigT1CaloEventLib ) + LINK_LIBRARIES AthContainers AthLinks AthenaKernel GaudiKernel TrigT1Interfaces ) atlas_add_dictionary( TrigT1CaloEventDict TrigT1CaloEvent/TrigT1CaloEventDict.h TrigT1CaloEvent/selection.xml - INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} AthContainers AthLinks GaudiKernel TrigT1Interfaces TrigT1CaloEventLib ) - + LINK_LIBRARIES TrigT1CaloEventLib ) diff --git a/Trigger/TrigT1/TrigT1CaloEvent/src/components/TrigT1CaloEvent_entries.cxx b/Trigger/TrigT1/TrigT1CaloEvent/src/components/TrigT1CaloEvent_entries.cxx deleted file mode 100644 index 8b137891791fe96927ad78e64b0aad7bded08bdc..0000000000000000000000000000000000000000 --- a/Trigger/TrigT1/TrigT1CaloEvent/src/components/TrigT1CaloEvent_entries.cxx +++ /dev/null @@ -1 +0,0 @@ - diff --git a/Trigger/TrigT1/TrigT1Monitoring/CMakeLists.txt b/Trigger/TrigT1/TrigT1Monitoring/CMakeLists.txt index a1f70dad6fbe953335845690fbda485f11e67215..aceadc0afa16aa850deac3ca85cdf50ace9297ad 100644 --- a/Trigger/TrigT1/TrigT1Monitoring/CMakeLists.txt +++ b/Trigger/TrigT1/TrigT1Monitoring/CMakeLists.txt @@ -1,45 +1,13 @@ -################################################################################ -# Package: TrigT1Monitoring -################################################################################ +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration # Declare the package name: atlas_subdir( TrigT1Monitoring ) -# Declare the package's dependencies: -atlas_depends_on_subdirs( PRIVATE - Calorimeter/CaloDetDescr - Calorimeter/CaloEvent - Calorimeter/CaloIdentifier - Calorimeter/CaloTriggerTool - Control/AthenaMonitoring - Control/AthContainers - DetectorDescription/Identifier - Event/xAOD/xAODTrigL1Calo - GaudiKernel - TileCalorimeter/TileCalib/TileCalibBlobObjs - TileCalorimeter/TileConditions - TileCalorimeter/TileEvent - TileCalorimeter/TileIdentifier - LArCalorimeter/LArElecCalib - - Tools/LWHists - Trigger/TrigConfiguration/TrigConfInterfaces - Trigger/TrigConfiguration/TrigConfL1Data - Trigger/TrigT1/L1Topo/L1TopoRDO - Trigger/TrigT1/TrigT1CaloCalibConditions - Trigger/TrigT1/TrigT1CaloCalibToolInterfaces - Trigger/TrigT1/TrigT1CaloCondSvc - Trigger/TrigT1/TrigT1CaloEvent - Trigger/TrigT1/TrigT1CaloMonitoringTools - Trigger/TrigT1/TrigT1CaloToolInterfaces - Trigger/TrigT1/TrigT1Interfaces - Trigger/TrigT1/TrigT1Result ) - # Component(s) in the package: atlas_add_component( TrigT1Monitoring src/*.cxx src/components/*.cxx - LINK_LIBRARIES CaloDetDescrLib CaloEvent CaloIdentifier CaloTriggerToolLib AthenaMonitoringLib AthContainers Identifier xAODTrigL1Calo GaudiKernel TileCalibBlobObjs TileConditionsLib TileEvent TileIdentifier LWHists TrigConfL1Data L1TopoRDO TrigT1CaloCalibConditions TrigT1CaloCalibToolInterfaces TrigT1CaloEventLib TrigT1CaloMonitoringToolsLib TrigT1CaloToolInterfaces TrigT1Interfaces TrigT1Result TrigT1CaloCondSvcLib ) + LINK_LIBRARIES AthContainers AthenaMonitoringLib CaloDetDescrLib CaloEvent CaloIdentifier CaloTriggerToolLib EventInfo GaudiKernel Identifier L1TopoRDO LArCablingLib LArElecCalib LWHists StoreGateLib TileCalibBlobObjs TileConditionsLib TileEvent TileIdentifier TrigConfInterfaces TrigConfL1Data TrigT1CaloCalibConditions TrigT1CaloCalibToolInterfaces TrigT1CaloCondSvcLib TrigT1CaloEventLib TrigT1CaloMonitoringToolsLib TrigT1CaloToolInterfaces TrigT1Interfaces TrigT1Result xAODTrigL1Calo ) # Install files from the package: atlas_install_joboptions( share/*.py ) diff --git a/Trigger/TrigT1/TrigT1Muctpi/CMakeLists.txt b/Trigger/TrigT1/TrigT1Muctpi/CMakeLists.txt index 66d27de792b354dfa6902be44eebb82aced4311d..7d0f2f78350472f4f62d6b011a5c21bc02e652b0 100644 --- a/Trigger/TrigT1/TrigT1Muctpi/CMakeLists.txt +++ b/Trigger/TrigT1/TrigT1Muctpi/CMakeLists.txt @@ -1,25 +1,8 @@ -################################################################################ -# Package: TrigT1Muctpi -################################################################################ +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration # Declare the package name: atlas_subdir( TrigT1Muctpi ) -# Declare the package's dependencies: -atlas_depends_on_subdirs( PUBLIC - Control/AthenaBaseComps - PRIVATE - Control/AthenaKernel - GaudiKernel - PhysicsAnalysis/AnalysisTrigger/AnalysisTriggerEvent - Tools/PathResolver - Control/CxxUtils - Trigger/TrigConfiguration/TrigConfInterfaces - Trigger/TrigConfiguration/TrigConfL1Data - Trigger/TrigConfiguration/TrigConfMuctpi - Trigger/TrigT1/TrigT1Interfaces - Trigger/TrigT1/TrigT1Result ) - # External dependencies: find_package( XercesC ) @@ -34,8 +17,7 @@ atlas_add_component( TrigT1Muctpi src/Mirod/*.cxx src/components/*.cxx INCLUDE_DIRS ${XERCESC_INCLUDE_DIRS} - LINK_LIBRARIES ${XERCESC_LIBRARIES} AthenaBaseComps AthenaKernel GaudiKernel AnalysisTriggerEvent PathResolver TrigConfL1Data TrigConfMuctpi TrigT1Interfaces TrigT1Result ) + LINK_LIBRARIES ${XERCESC_LIBRARIES} AnalysisTriggerEvent AthenaBaseComps AthenaKernel CxxUtils GaudiKernel PathResolver StoreGateLib TrigConfInterfaces TrigConfL1Data TrigConfMuctpi TrigT1Interfaces TrigT1Result ) # Install files from the package: -atlas_install_python_modules( python/*.py ) - +atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) diff --git a/Trigger/TrigT1/TrigT1Muctpi/python/TrigT1MuctpiAlgorithmConfig.py b/Trigger/TrigT1/TrigT1Muctpi/python/TrigT1MuctpiAlgorithmConfig.py deleted file mode 100644 index 92083d42c15a02620f26ac7678c0589a10d31f26..0000000000000000000000000000000000000000 --- a/Trigger/TrigT1/TrigT1Muctpi/python/TrigT1MuctpiAlgorithmConfig.py +++ /dev/null @@ -1,65 +0,0 @@ -# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration - -## get a handle to the default top-level algorithm sequence -from AthenaCommon.AlgSequence import AlgSequence -topSequence = AlgSequence() -## get a handle to the ServiceManager -from AthenaCommon.AppMgr import ServiceMgr as svcMgr -## get a handle to the ApplicationManager -from AthenaCommon.AppMgr import theApp - -## to decode the MuCTPI bytestream -from TrigT1ResultByteStream.TrigT1ResultByteStreamConf import MuCTPIByteStreamTool,RecMuCTPIByteStreamTool -from TrigT1Muctpi.TrigT1MuctpiConf import CBNTAA_ReadMuCTPI_RDO -from TrigT1Muctpi.TrigT1MuctpiConf import CBNTAA_ReadMuCTPI_RIO -from TrigT1Muctpi.TrigT1MuctpiConf import CBNTAA_MuctpiRoI - -if not hasattr( svcMgr, "THistSvc" ): - from GaudiSvc.GaudiSvcConf import THistSvc - svcMgr += THistSvc() -#svcMgr.THistSvc.Output = ["file1 DATAFILE='HistFile.root' OPT='RECREATE'"]; - -if not hasattr( theApp.Dlls, "RootHistCnv" ): - theApp.Dlls += [ "RootHistCnv" ] - theApp.HistogramPersistency = "ROOT" - -if not hasattr( svcMgr, "NTupleSvc" ): - from GaudiSvc.GaudiSvcConf import NTupleSvc - svcMgr += NTupleSvc() -#svcMgr.NTupleSvc.Output = [ "FILE1 DATAFILE='NtupleFile.root' OPT='NEW'" ] - -if not hasattr( topSequence, "CBNT_AthenaAware" ): - from CBNT_Athena.CBNT_AthenaConf import * - from CBNT_Utils.CBNT_UtilsConf import * - CBNT_AthenaAware = CBNT_AthenaAware() -# CBNT_AthenaAware.OutputLevel = 2 - topSequence += CBNT_AthenaAware - -if not "CBNTAA_EventInfo" in topSequence.CBNT_AthenaAware.Members : - from CBNT_Athena.CBNT_AthenaConf import * - from CBNT_Utils.CBNT_UtilsConf import * - topSequence.CBNT_AthenaAware.Members += ["CBNTAA_EventInfo"] - -if not "CBNTAA_ReadMuCTPI_RDO" in topSequence.CBNT_AthenaAware.Members : - CBNTAA_ReadMuCTPI_RDO = CBNTAA_ReadMuCTPI_RDO() - CBNTAA_ReadMuCTPI_RDO.StoreRawData = False - topSequence.CBNT_AthenaAware.Members += ["CBNTAA_ReadMuCTPI_RDO"] - -if not "CBNTAA_ReadMuCTPI_RIO" in topSequence.CBNT_AthenaAware.Members : - topSequence.CBNT_AthenaAware.Members += ["CBNTAA_ReadMuCTPI_RIO"] - -if not "CBNTAA_MuctpiRoI" in topSequence.CBNT_AthenaAware.Members : - CBNTAA_MuctpiRoI = CBNTAA_MuctpiRoI() - # CBNT_MuctpiRoI.RoISource = "roi" - topSequence.CBNT_AthenaAware.Members += ["CBNTAA_MuctpiRoI"] - -# print topSequence - -# class CBNTAA_Algorithms(): -# """ -# Configurable module to setup ntuple-producing algorithms -# """ -# def __init__( self, name = "CBNTAA_Algorithms" ): -# # -# # CBNT part -# # diff --git a/Trigger/TrigT1/TrigT1Muctpi/python/TrigT1MuctpiConfig.py b/Trigger/TrigT1/TrigT1Muctpi/python/TrigT1MuctpiConfig.py index 6a210fbca2147ea9e2c503b23ddad1729f21f8cf..598f1242f0afebc63b3ab79cf1eb42a1cb277b2f 100644 --- a/Trigger/TrigT1/TrigT1Muctpi/python/TrigT1MuctpiConfig.py +++ b/Trigger/TrigT1/TrigT1Muctpi/python/TrigT1MuctpiConfig.py @@ -1,6 +1,5 @@ -# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -# $Id: TrigT1MuctpiConfig.py 794528 2017-01-30 12:36:33Z fwinkl $ # Local (generated) configurable(s): from TrigT1Muctpi.TrigT1MuctpiConf import LVL1MUCTPI__L1Muctpi @@ -32,14 +31,14 @@ class DefaultL1Muctpi( LVL1MUCTPI__L1Muctpi ): from AtlasGeoModel.CommonGMJobProperties import CommonGeometryFlags as commonGeoFlags from AtlasGeoModel.InDetGMJobProperties import InDetGeometryFlags as geoFlags if ( commonGeoFlags.Run() == "RUN1" ) or ( ( commonGeoFlags.Run() == "UNDEFINED" ) and - ( geoFlags.isIBL() == False ) ): + ( geoFlags.isIBL() is False ) ): self.LUTXMLFile = "TrigConfMuctpi/data10_7TeV.periodI.physics_Muons.MuCTPI_LUT.NoBEOverlaps_composedEF.v002.xml" self.RunPeriod = "RUN1" logger.info( "Configuring MuCTPI simulation with Run 1 configuration file:" ) logger.info( " TrigConfMuctpi/data10_7TeV.periodI.physics_Muons.MuCTPI_LUT.NoBEOverlaps_composedEF.v002.xml" ) logger.info( " with a RunPeriod=RUN1" ) elif ( commonGeoFlags.Run() == "RUN2" ) or ( ( commonGeoFlags.Run() == "UNDEFINED" ) and - ( geoFlags.isIBL() == True ) ): + ( geoFlags.isIBL() is True ) ): self.LUTXMLFile = "TrigConfMuctpi/data10_7TeV.periodI.physics_Muons.MuCTPI_LUT.NoBEOverlaps_composedEF.v002_modifiedBB.xml" self.RunPeriod = "RUN2" logger.info( "Configuring MuCTPI simulation with Run 2 configuration file:" ) @@ -88,10 +87,6 @@ class L1Muctpi( DefaultL1Muctpi ): self.InputSource = "DIGITIZATION" - from AthenaCommon.GlobalFlags import globalflags - from RecExConfig.RecFlags import rec - pass - class L1Muctpi_on_RDO( DefaultL1Muctpi ): """ @@ -178,14 +173,14 @@ class DefaultL1MuctpiTool( LVL1MUCTPI__L1MuctpiTool ): from AtlasGeoModel.CommonGMJobProperties import CommonGeometryFlags as commonGeoFlags from AtlasGeoModel.InDetGMJobProperties import InDetGeometryFlags as geoFlags if ( commonGeoFlags.Run() == "RUN1" ) or ( ( commonGeoFlags.Run() == "UNDEFINED" ) and - ( geoFlags.isIBL() == False ) ): + ( geoFlags.isIBL() is False ) ): self.LUTXMLFile = "TrigConfMuctpi/data10_7TeV.periodI.physics_Muons.MuCTPI_LUT.NoBEOverlaps_composedEF.v002.xml" self.RunPeriod = "RUN1" logger.info( "Configuring MuCTPI simulation with Run 1 configuration file:" ) logger.info( " TrigConfMuctpi/data10_7TeV.periodI.physics_Muons.MuCTPI_LUT.NoBEOverlaps_composedEF.v002.xml" ) logger.info( " with a RunPeriod=RUN1" ) elif ( commonGeoFlags.Run() == "RUN2" ) or ( ( commonGeoFlags.Run() == "UNDEFINED" ) and - ( geoFlags.isIBL() == True ) ): + ( geoFlags.isIBL() is True ) ): self.LUTXMLFile = "TrigConfMuctpi/data10_7TeV.periodI.physics_Muons.MuCTPI_LUT.NoBEOverlaps_composedEF.v002_modifiedBB.xml" self.RunPeriod = "RUN2" logger.info( "Configuring MuCTPI simulation with Run 2 configuration file:" ) @@ -234,10 +229,6 @@ class L1MuctpiTool( DefaultL1MuctpiTool ): self.InputSource = "DIGITIZATION" - from AthenaCommon.GlobalFlags import globalflags - from RecExConfig.RecFlags import rec - pass - class L1MuctpiTool_on_RDO( DefaultL1MuctpiTool ): """ diff --git a/Trigger/TrigT1/TrigT1MuctpiPhase1/CMakeLists.txt b/Trigger/TrigT1/TrigT1MuctpiPhase1/CMakeLists.txt index 394e17c2262fd4f1d3b7422cc8f5807e083961e4..b6d5d0e6957b00c7cf5bec2e0362e6aae7336cbd 100644 --- a/Trigger/TrigT1/TrigT1MuctpiPhase1/CMakeLists.txt +++ b/Trigger/TrigT1/TrigT1MuctpiPhase1/CMakeLists.txt @@ -1,36 +1,17 @@ -################################################################################ -# Package: TrigT1MuctpiPhase1 -################################################################################ +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration # Declare the package name: atlas_subdir( TrigT1MuctpiPhase1 ) -# Declare the package's dependencies: -atlas_depends_on_subdirs( PUBLIC - Control/AthenaBaseComps - PRIVATE - Control/AthenaKernel - GaudiKernel - PhysicsAnalysis/AnalysisTrigger/AnalysisTriggerEvent - Tools/PathResolver - Control/CxxUtils - Event/xAOD/xAODTrigger - Trigger/TrigConfiguration/TrigConfInterfaces - Trigger/TrigConfiguration/TrigConfL1Data - Trigger/TrigConfiguration/TrigConfMuctpi - Trigger/TrigT1/TrigT1Interfaces - Trigger/TrigT1/TrigT1Result ) - -# External dependencies: -find_package( XercesC ) +# External pacakge dependencies: +find_package( Boost ) # Component(s) in the package: atlas_add_component( TrigT1MuctpiPhase1 src/*.cxx src/components/*.cxx - INCLUDE_DIRS ${XERCESC_INCLUDE_DIRS} - LINK_LIBRARIES ${XERCESC_LIBRARIES} AthenaBaseComps AthenaKernel GaudiKernel AnalysisTriggerEvent PathResolver TrigConfL1Data TrigConfMuctpi TrigT1Interfaces TrigT1Result xAODTrigger ) + INCLUDE_DIRS ${Boost_INCLUDE_DIRS} + LINK_LIBRARIES AnalysisTriggerEvent AthenaBaseComps CxxUtils GaudiKernel PathResolver StoreGateLib TrigConfInterfaces TrigConfL1Data TrigConfMuctpi TrigT1Interfaces TrigT1Result xAODTrigger ) # Install files from the package: -atlas_install_headers( TrigT1MuctpiPhase1 ) -atlas_install_python_modules( python/*.py ) +atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) diff --git a/Trigger/TrigT1/TrigT1MuctpiPhase1/python/TrigT1MuctpiPhase1Config.py b/Trigger/TrigT1/TrigT1MuctpiPhase1/python/TrigT1MuctpiPhase1Config.py index 32939555cffc9227979d7890857285854c6126e2..b83cd57f11138ca25d4e15aca2c18c27e24c1f5f 100644 --- a/Trigger/TrigT1/TrigT1MuctpiPhase1/python/TrigT1MuctpiPhase1Config.py +++ b/Trigger/TrigT1/TrigT1MuctpiPhase1/python/TrigT1MuctpiPhase1Config.py @@ -1,6 +1,5 @@ # Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -# $Id: TrigT1MuctpiPhase1Config.py 794528 2017-01-30 12:36:33Z fwinkl $ # Local (generated) configurable(s): from TrigT1MuctpiPhase1.TrigT1MuctpiPhase1Conf import LVL1MUCTPIPHASE1__MUCTPI_AthAlg @@ -16,9 +15,6 @@ class DefaultL1MuctpiPhase1( LVL1MUCTPIPHASE1__MUCTPI_AthAlg ): LVL1MUCTPIPHASE1__MUCTPI_AthAlg.__init__( self, name ) - # Create a logger: - from AthenaCommon.Logging import logging - logger = logging.getLogger( "MUCTPI_AthAlg" ) class L1MuctpiPhase1( DefaultL1MuctpiPhase1 ): @@ -32,10 +28,6 @@ class L1MuctpiPhase1( DefaultL1MuctpiPhase1 ): DefaultL1MuctpiPhase1.__init__( self, name ) - from AthenaCommon.GlobalFlags import globalflags - from RecExConfig.RecFlags import rec - pass - class L1MuctpiPhase1_on_RDO( DefaultL1MuctpiPhase1 ): """ @@ -124,14 +116,14 @@ class DefaultL1MuctpiPhase1Tool( LVL1MUCTPIPHASE1__MUCTPI_AthTool ): from AtlasGeoModel.CommonGMJobProperties import CommonGeometryFlags as commonGeoFlags from AtlasGeoModel.InDetGMJobProperties import InDetGeometryFlags as geoFlags if ( commonGeoFlags.Run() == "RUN1" ) or ( ( commonGeoFlags.Run() == "UNDEFINED" ) and - ( geoFlags.isIBL() == False ) ): + ( geoFlags.isIBL() is False ) ): self.LUTXMLFile = "TrigConfMuctpi/data10_7TeV.periodI.physics_Muons.MuCTPI_LUT.NoBEOverlaps_composedEF.v002.xml" self.RunPeriod = "RUN1" logger.info( "Configuring MuCTPI simulation with Run 1 configuration file:" ) logger.info( " TrigConfMuctpi/data10_7TeV.periodI.physics_Muons.MuCTPI_LUT.NoBEOverlaps_composedEF.v002.xml" ) logger.info( " with a RunPeriod=RUN1" ) elif ( commonGeoFlags.Run() == "RUN2" ) or ( ( commonGeoFlags.Run() == "UNDEFINED" ) and - ( geoFlags.isIBL() == True ) ): + ( geoFlags.isIBL() is True ) ): self.LUTXMLFile = "TrigConfMuctpi/data10_7TeV.periodI.physics_Muons.MuCTPI_LUT.NoBEOverlaps_composedEF.v002_modifiedBB.xml" self.RunPeriod = "RUN2" logger.info( "Configuring MuCTPI simulation with Run 2 configuration file:" ) @@ -168,10 +160,6 @@ class L1MuctpiPhase1Tool( DefaultL1MuctpiPhase1Tool ): self.InputSource = "DIGITIZATION" - from AthenaCommon.GlobalFlags import globalflags - from RecExConfig.RecFlags import rec - pass - class L1MuctpiPhase1Tool_on_RDO( DefaultL1MuctpiPhase1Tool ): """ diff --git a/Trigger/TrigT1/TrigT1MuctpiPhase1/src/MUCTPI_AthAlg.cxx b/Trigger/TrigT1/TrigT1MuctpiPhase1/src/MUCTPI_AthAlg.cxx index 77aaae13aaec444def7435695e47b9f5626c3883..8eab7c6895326f4a9a5b19451bf7c9b6651ae249 100644 --- a/Trigger/TrigT1/TrigT1MuctpiPhase1/src/MUCTPI_AthAlg.cxx +++ b/Trigger/TrigT1/TrigT1MuctpiPhase1/src/MUCTPI_AthAlg.cxx @@ -12,11 +12,6 @@ namespace LVL1MUCTPIPHASE1 { AthAlgorithm(name, pSvcLocator), m_muctpiTool("LVL1MUCTPIPHASE1__MUCTPI_AthTool/MUCTPI_AthTool") { - // Init message - ATH_MSG_INFO( "=======================================" ); - ATH_MSG_INFO( "Constructor for MUCTPI_AthAlg." ); - ATH_MSG_INFO( "=======================================" ); - declareProperty( "MUCTPI_AthTool", m_muctpiTool, "Tool to steer the MUCTPI simulation"); } diff --git a/Trigger/TrigT1/TrigT1NSW/CMakeLists.txt b/Trigger/TrigT1/TrigT1NSW/CMakeLists.txt index 507f018301f44df09a76ad3c121ab1b4b7df8c26..f0581d9cdca62086df6a818778127a2d5834ab6b 100644 --- a/Trigger/TrigT1/TrigT1NSW/CMakeLists.txt +++ b/Trigger/TrigT1/TrigT1NSW/CMakeLists.txt @@ -1,38 +1,19 @@ -################################################################################ -# Package: TrigT1NSW -################################################################################ +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration # Declare the package name: atlas_subdir( TrigT1NSW ) -# Declare the package's dependencies: -atlas_depends_on_subdirs( PUBLIC - Control/AthenaBaseComps - GaudiKernel - MuonSpectrometer/MuonRDO - Trigger/TrigSteer/TrigInterfaces - Trigger/TrigT1/TrigT1NSWSimTools - PRIVATE - Control/AthenaMonitoring - Control/StoreGate - Event/EventInfo ) - # External dependencies: -find_package( Boost ) -find_package( TBB ) -find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread ) +find_package( ROOT COMPONENTS Tree ) # Component(s) in the package: atlas_add_component( TrigT1NSW src/*.cxx src/components/*.cxx - INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} ${TBB_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} ${Boost_LIBRARIES} ${TBB_LIBRARIES} - AthenaBaseComps GaudiKernel TrigInterfacesLib TrigT1NSWSimToolsLib AthenaMonitoringLib - StoreGateLib SGtests EventInfo ) + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} + LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaBaseComps AthenaMonitoringLib CxxUtils EventInfo GaudiKernel MuonRDO TrigInterfacesLib TrigT1NSWSimToolsLib ) # Install files from the package: -atlas_install_headers( TrigT1NSW ) -atlas_install_python_modules( python/*.py ) +atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) atlas_install_joboptions( share/*.py ) diff --git a/Trigger/TrigT1/TrigT1NSW/TrigT1NSW/ATLAS_CHECK_THREAD_SAFETY b/Trigger/TrigT1/TrigT1NSW/TrigT1NSW/ATLAS_CHECK_THREAD_SAFETY new file mode 100644 index 0000000000000000000000000000000000000000..d16a7f1713b44de2f7885aa469f4c7d86179a54f --- /dev/null +++ b/Trigger/TrigT1/TrigT1NSW/TrigT1NSW/ATLAS_CHECK_THREAD_SAFETY @@ -0,0 +1 @@ +Trigger/TrigT1/TrigT1NSW diff --git a/Trigger/TrigT1/TrigT1NSW/python/TrigT1NSWAlgorithmConfig.py b/Trigger/TrigT1/TrigT1NSW/python/TrigT1NSWAlgorithmConfig.py deleted file mode 100644 index 366e0ac76372301bd5152215e6dd9f1ee3a909cf..0000000000000000000000000000000000000000 --- a/Trigger/TrigT1/TrigT1NSW/python/TrigT1NSWAlgorithmConfig.py +++ /dev/null @@ -1,26 +0,0 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration - -## get a handle to the default top-level algorithm sequence -from AthenaCommon.AlgSequence import AlgSequence -topSequence = AlgSequence() -## get a handle to the ApplicationManager -from AthenaCommon.AppMgr import theApp -## get a handle to the ServiceManager -from AthenaCommon.AppMgr import ServiceMgr as svcMgr - - -if not hasattr( svcMgr, "THistSvc" ): - from GaudiSvc.GaudiSvcConf import THistSvc - svcMgr += THistSvc() -#svcMgr.THistSvc.Output = ["file1 DATAFILE='HistFile.root' OPT='RECREATE'"]; - -if not hasattr( theApp.Dlls, "RootHistCnv" ): - theApp.Dlls += [ "RootHistCnv" ] - theApp.HistogramPersistency = "ROOT" - -if not hasattr( svcMgr, "NTupleSvc" ): - from GaudiSvc.GaudiSvcConf import NTupleSvc - svcMgr += NTupleSvc() -#svcMgr.NTupleSvc.Output = [ "FILE1 DATAFILE='NtupleFile.root' OPT='NEW'" ] - -#print topSequence diff --git a/Trigger/TrigT1/TrigT1NSW/python/TrigT1NSWConfig.py b/Trigger/TrigT1/TrigT1NSW/python/TrigT1NSWConfig.py index 543053b567bad921b79f5b7fb4c866644f9526aa..a6abc329ce02101b5828023681f48746c4945fb7 100755 --- a/Trigger/TrigT1/TrigT1NSW/python/TrigT1NSWConfig.py +++ b/Trigger/TrigT1/TrigT1NSW/python/TrigT1NSWConfig.py @@ -1,7 +1,6 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration - -from TrigT1NSW.TrigT1NSWConf import * +from TrigT1NSW.TrigT1NSWConf import NSWL1__NSWL1Simulation class DefaultNSWL1Simulation(NSWL1__NSWL1Simulation): __slots__ = [] @@ -9,10 +8,6 @@ class DefaultNSWL1Simulation(NSWL1__NSWL1Simulation): def __init__(self, name = "DefaultNSWL1Simulation"): super( DefaultNSWL1Simulation, self ).__init__( name ) - from AthenaCommon.Logging import logging - log = logging.getLogger( 'NSWL1Simulation' ) - - # set steering properties self.DoOffline = True # so far only offline simulation is available diff --git a/Trigger/TrigT1/TrigT1NSW/python/__init__.py b/Trigger/TrigT1/TrigT1NSW/python/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..f2f0fc1b7b487784e8781d2a41e43908019e0a7d --- /dev/null +++ b/Trigger/TrigT1/TrigT1NSW/python/__init__.py @@ -0,0 +1 @@ +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration diff --git a/Trigger/TrigT1/TrigT1NSW/src/NSWL1Simulation.cxx b/Trigger/TrigT1/TrigT1NSW/src/NSWL1Simulation.cxx index 09dd550ba4010e38ef810fd1465380cb19bcffc0..e483a36398009de9d4630d90f2e7e345f79b1638 100644 --- a/Trigger/TrigT1/TrigT1NSW/src/NSWL1Simulation.cxx +++ b/Trigger/TrigT1/TrigT1NSW/src/NSWL1Simulation.cxx @@ -13,7 +13,7 @@ // root includes #include "TTree.h" // Local includes -#include "TrigT1NSW/NSWL1Simulation.h" +#include "NSWL1Simulation.h" #include "MuonRDO/NSW_TrigRawDataContainer.h" #include <vector> diff --git a/Trigger/TrigT1/TrigT1NSW/TrigT1NSW/NSWL1Simulation.h b/Trigger/TrigT1/TrigT1NSW/src/NSWL1Simulation.h similarity index 94% rename from Trigger/TrigT1/TrigT1NSW/TrigT1NSW/NSWL1Simulation.h rename to Trigger/TrigT1/TrigT1NSW/src/NSWL1Simulation.h index deeddbcbc6b9d3722fea8ffaa06dd5aec1af9e27..33cfef43f5f99080dbd79402697af7f34ab9863c 100644 --- a/Trigger/TrigT1/TrigT1NSW/TrigT1NSW/NSWL1Simulation.h +++ b/Trigger/TrigT1/TrigT1NSW/src/NSWL1Simulation.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef TRIGT1NSW_NSWL1SIMULATION_H @@ -7,10 +7,10 @@ // Basic includes #include "AthenaBaseComps/AthAlgorithm.h" +#include "CxxUtils/checker_macros.h" #include "GaudiKernel/ServiceHandle.h" #include "GaudiKernel/ToolHandle.h" #include "GaudiKernel/Property.h" -//#include "StoreGate/DataHandle.h" // monitoring from HLT #include "TrigInterfaces/IMonitoredAlgo.h" @@ -49,11 +49,11 @@ namespace NSWL1 { * * @authors Alessandro Di Mattia <dimattia@cern.ch>, Geraldine Conti <geraldine.conti@cern.ch> * - * @version \$Id: NSWL1Simulation.h,v 1.20 2013-01-29 21:14:24 efeld Exp $ * */ - class NSWL1Simulation: public AthAlgorithm, public IMonitoredAlgo { + class ATLAS_NOT_THREAD_SAFE // use of TTree in execute + NSWL1Simulation: public AthAlgorithm, public IMonitoredAlgo { public: diff --git a/Trigger/TrigT1/TrigT1NSW/src/components/TrigT1NSW_entries.cxx b/Trigger/TrigT1/TrigT1NSW/src/components/TrigT1NSW_entries.cxx index ccf0c1f2130d18cfa5c12dc4094a6a7febceeaed..f063d6de3e6cce183f0b820339678c2fc6b4ff4f 100755 --- a/Trigger/TrigT1/TrigT1NSW/src/components/TrigT1NSW_entries.cxx +++ b/Trigger/TrigT1/TrigT1NSW/src/components/TrigT1NSW_entries.cxx @@ -1,4 +1,4 @@ -#include "TrigT1NSW/NSWL1Simulation.h" +#include "../NSWL1Simulation.h" using NSWL1::NSWL1Simulation; diff --git a/Trigger/TrigT1/TrigT1NSWSimTools/CMakeLists.txt b/Trigger/TrigT1/TrigT1NSWSimTools/CMakeLists.txt index 17c1265efd0db7ebb39154ef53e4aad083168e88..2b00061e32c04208d9a53ea0c63c85a8f2bfc8e7 100644 --- a/Trigger/TrigT1/TrigT1NSWSimTools/CMakeLists.txt +++ b/Trigger/TrigT1/TrigT1NSWSimTools/CMakeLists.txt @@ -1,56 +1,25 @@ -################################################################################ -# Package: TrigT1NSWSimTools -################################################################################ +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration # Declare the package name: atlas_subdir( TrigT1NSWSimTools ) -# Declare the package's dependencies: -atlas_depends_on_subdirs( PUBLIC - GaudiKernel - PRIVATE - Control/AthenaBaseComps - Control/AthenaKernel - DetectorDescription/AGDD/AGDDKernel - DetectorDescription/GeoPrimitives - DetectorDescription/Identifier - Event/EventInfo - DetectorDescription/RegSelLUT - MuonSpectrometer/MuonDetDescr/MuonRegionSelector - MuonSpectrometer/MuonDetDescr/MuonAGDDDescription - MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry - MuonSpectrometer/MuonDigitContainer - MuonSpectrometer/MuonIdHelpers - MuonSpectrometer/MuonSimEvent - MuonSpectrometer/MuonSimData - MuonSpectrometer/MuonRDO - Simulation/G4Sim/TrackRecord - Tools/PathResolver - Generators/AtlasHepMC ) # External dependencies: find_package( Boost ) -find_package( TBB ) find_package( CLHEP ) -find_package( Eigen ) -find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread MathMore Minuit Minuit2 Matrix Physics HistPainter Rint ) +find_package( ROOT COMPONENTS Core Tree MathCore ) # Library in the package atlas_add_library( TrigT1NSWSimToolsLib - src/*.cxx - PUBLIC_HEADERS TrigT1NSWSimTools - INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} ${TBB_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} ${EIGEN_LIBRARIES} ${Boost_LIBRARIES} ${TBB_LIBRARIES} AtlasHepMCLib - SGTools GaudiKernel AthenaBaseComps AthenaKernel AGDDKernel GeoPrimitives Identifier EventInfo MuonAGDDDescription MuonReadoutGeometry - MuonDigitContainer MuonIdHelpersLib MuonSimEvent MuonSimData MuonRDO RegSelLUT PathResolver - PRIVATE_LINK_LIBRARIES TrackRecordLib MuonRegionSelectorLib ) - + src/*.cxx + PUBLIC_HEADERS TrigT1NSWSimTools + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} + LINK_LIBRARIES ${Boost_LIBRARIES} ${ROOT_LIBRARIES} AthenaBaseComps AthenaKernel GaudiKernel GeoPrimitives Identifier MuonDigitContainer MuonIdHelpersLib MuonRDO MuonReadoutGeometry MuonSimData MuonSimEvent RegSelLUT TrkSurfaces + PRIVATE_LINK_LIBRARIES ${CLHEP_LIBRARIES} AGDDKernel AtlasHepMCLib EventInfo GeneratorObjects MuonAGDDDescription MuonRegionSelectorLib PathResolver StoreGateLib TrackRecordLib ) # Component(s) in the package: atlas_add_component( TrigT1NSWSimTools src/components/*.cxx LINK_LIBRARIES TrigT1NSWSimToolsLib ) - # Install files from the package: -atlas_install_headers( TrigT1NSWSimTools ) -atlas_install_runtime( share/* ) +atlas_install_runtime( share/*.dat ) diff --git a/Trigger/TrigT1/TrigT1RPCRecRoiSvc/CMakeLists.txt b/Trigger/TrigT1/TrigT1RPCRecRoiSvc/CMakeLists.txt index 1cf12c27789051fe5a5db3579225e0c458fa9927..69fcc1ae659ecbd085de5c9706d33aa666b311fc 100644 --- a/Trigger/TrigT1/TrigT1RPCRecRoiSvc/CMakeLists.txt +++ b/Trigger/TrigT1/TrigT1RPCRecRoiSvc/CMakeLists.txt @@ -1,33 +1,20 @@ -################################################################################ -# Package: TrigT1RPCRecRoiSvc -################################################################################ +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration # Declare the package name: atlas_subdir( TrigT1RPCRecRoiSvc ) -# Declare the package's dependencies: -atlas_depends_on_subdirs( PUBLIC - MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry - Trigger/TrigT1/TrigT1Interfaces - PRIVATE - Control/StoreGate - DetectorDescription/Identifier - GaudiKernel - MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling - MuonSpectrometer/MuonCablings/RPCcablingInterface ) - # Component(s) in the package: atlas_add_library( TrigT1RPCRecRoiSvcLib src/*.cxx PUBLIC_HEADERS TrigT1RPCRecRoiSvc - LINK_LIBRARIES MuonReadoutGeometry TrigT1Interfaces StoreGateLib SGtests RPCcablingInterfaceLib RPC_CondCablingLib - PRIVATE_LINK_LIBRARIES Identifier GaudiKernel ) + LINK_LIBRARIES GaudiKernel MuonIdHelpersLib MuonReadoutGeometry RPC_CondCablingLib StoreGateLib TrigT1Interfaces + PRIVATE_LINK_LIBRARIES RPCcablingInterfaceLib ) atlas_add_component( TrigT1RPCRecRoiSvc src/components/*.cxx - LINK_LIBRARIES MuonReadoutGeometry TrigT1Interfaces StoreGateLib SGtests Identifier GaudiKernel RPCcablingInterfaceLib TrigT1RPCRecRoiSvcLib RPC_CondCablingLib) + LINK_LIBRARIES TrigT1RPCRecRoiSvcLib ) # Install files from the package: -atlas_install_python_modules( python/*.py ) +atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) atlas_install_joboptions( share/*.txt share/*.py ) diff --git a/Trigger/TrigT1/TrigT1RPCRecRoiSvc/python/TrigT1RPCRecRoiConfig.py b/Trigger/TrigT1/TrigT1RPCRecRoiSvc/python/TrigT1RPCRecRoiConfig.py index 48e20ff24f9a0b768520cf2fcd19a7505060c17d..015cb96e5ef87347a27d14da8b9a708165a5408b 100755 --- a/Trigger/TrigT1/TrigT1RPCRecRoiSvc/python/TrigT1RPCRecRoiConfig.py +++ b/Trigger/TrigT1/TrigT1RPCRecRoiSvc/python/TrigT1RPCRecRoiConfig.py @@ -1,6 +1,5 @@ -# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -# $Id: TrigT1RPCRecRoiConfig.py 301203 2010-05-26 12:08:22Z krasznaa $ # # To use the LVL1RPC::RPCRecRoiSvc, one has to import this module simply # like: @@ -8,8 +7,9 @@ # import TrigT1RPCRecRoiSvc.TrigT1RPCRecRoiConfig # -from TrigT1RPCRecRoiSvc.TrigT1RPCRecRoiSvcConf import * +from TrigT1RPCRecRoiSvc.TrigT1RPCRecRoiSvcConf import LVL1RPC__RPCRecRoiSvc from AthenaCommon.AppMgr import ServiceMgr +from AthenaCommon.Configurable import Configurable # Create a logger: from AthenaCommon.Logging import logging @@ -22,7 +22,7 @@ class RPCRecRoiConfig( LVL1RPC__RPCRecRoiSvc ): # Configure the cabling. Let the cabling configurable set up the services based # on the conditions. -import MuonCnvExample.MuonCablingConfig +import MuonCnvExample.MuonCablingConfig # noqa: F401 logger.debug( "Configured the cabling services" ) # Add the RPCRecRoiSvc to the service manager: diff --git a/Trigger/TrigT1/TrigT1RPCRecRoiSvc/share/TrigT1RPCRecRoiSvcJobOptions.txt b/Trigger/TrigT1/TrigT1RPCRecRoiSvc/share/TrigT1RPCRecRoiSvcJobOptions.txt deleted file mode 100755 index 3a176571cdc224f98630dac42ec14e149d54fe62..0000000000000000000000000000000000000000 --- a/Trigger/TrigT1/TrigT1RPCRecRoiSvc/share/TrigT1RPCRecRoiSvcJobOptions.txt +++ /dev/null @@ -1,4 +0,0 @@ -ApplicationMgr.DLLs += { "TrigT1RPCRecRoiSvc" }; - -// RoI reconstruction service -ApplicationMgr.ExtSvc += {"LVL1RPC::RPCRecRoiSvc"}; diff --git a/Trigger/TrigT1/TrigT1RPChardware/CMakeLists.txt b/Trigger/TrigT1/TrigT1RPChardware/CMakeLists.txt index 1bfa60e13a57512fb33125c9a85bcf0419d59bed..4cfbb09439e08441e58de8a894b33489bbcc5abd 100644 --- a/Trigger/TrigT1/TrigT1RPChardware/CMakeLists.txt +++ b/Trigger/TrigT1/TrigT1RPChardware/CMakeLists.txt @@ -1,30 +1,10 @@ -################################################################################ -# Package: TrigT1RPChardware -################################################################################ +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration # Declare the package name: atlas_subdir( TrigT1RPChardware ) -# Declare the package's dependencies: -atlas_depends_on_subdirs( PUBLIC - MuonSpectrometer/MuonCablings/MuonCablingTools - PRIVATE - GaudiKernel ) - # Component(s) in the package: -atlas_add_library( RPChardware - src/*.cxx - PUBLIC_HEADERS TrigT1RPChardware - LINK_LIBRARIES MuonCablingTools CablingTools - PRIVATE_LINK_LIBRARIES GaudiKernel ) - atlas_add_library( TrigT1RPChardwareLib src/*.cxx PUBLIC_HEADERS TrigT1RPChardware - LINK_LIBRARIES MuonCablingTools CablingTools RPChardware - PRIVATE_LINK_LIBRARIES GaudiKernel ) - -atlas_add_component( TrigT1RPChardware - src/components/*.cxx - LINK_LIBRARIES MuonCablingTools CablingTools GaudiKernel RPChardware TrigT1RPChardwareLib ) - + LINK_LIBRARIES MuonCablingTools ) diff --git a/Trigger/TrigT1/TrigT1RPChardware/src/components/TrigT1RPChardware_entries.cxx b/Trigger/TrigT1/TrigT1RPChardware/src/components/TrigT1RPChardware_entries.cxx deleted file mode 100644 index 8b137891791fe96927ad78e64b0aad7bded08bdc..0000000000000000000000000000000000000000 --- a/Trigger/TrigT1/TrigT1RPChardware/src/components/TrigT1RPChardware_entries.cxx +++ /dev/null @@ -1 +0,0 @@ - diff --git a/Trigger/TrigT1/TrigT1RPClogic/CMakeLists.txt b/Trigger/TrigT1/TrigT1RPClogic/CMakeLists.txt index 3253c437ed0c8b2ac821b02c45d0d3d1c0627665..9f591871a78f8a93fad2ae897a1a9f5c7a356f80 100644 --- a/Trigger/TrigT1/TrigT1RPClogic/CMakeLists.txt +++ b/Trigger/TrigT1/TrigT1RPClogic/CMakeLists.txt @@ -1,25 +1,10 @@ -################################################################################ -# Package: TrigT1RPClogic -################################################################################ +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration # Declare the package name: atlas_subdir( TrigT1RPClogic ) -# Declare the package's dependencies: -atlas_depends_on_subdirs( PUBLIC - GaudiKernel - MuonSpectrometer/MuonCablings/MuonCablingTools - MuonSpectrometer/MuonCablings/RPCcablingInterface - MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling - Trigger/TrigT1/TrigT1RPChardware ) - # Component(s) in the package: atlas_add_library( TrigT1RPClogicLib src/*.cxx PUBLIC_HEADERS TrigT1RPClogic - LINK_LIBRARIES GaudiKernel MuonCablingTools CablingTools RPCcablingInterfaceLib TrigT1RPChardwareLib RPChardware RPC_CondCablingLib) - -atlas_add_component( TrigT1RPClogic - src/components/*.cxx - LINK_LIBRARIES GaudiKernel MuonCablingTools CablingTools RPCcablingInterfaceLib TrigT1RPChardwareLib RPChardware TrigT1RPClogicLib RPC_CondCablingLib) - + LINK_LIBRARIES CablingTools GaudiKernel RPC_CondCablingLib RPCcablingInterfaceLib TrigT1RPChardwareLib ) diff --git a/Trigger/TrigT1/TrigT1RPClogic/TrigT1RPClogic/CMApatterns.h b/Trigger/TrigT1/TrigT1RPClogic/TrigT1RPClogic/CMApatterns.h index 7bae5e67a308ded9671d0b1d002dd6ed5c18e78c..0e76ea9da9520860aedc12e5e9e18832d2e511c5 100755 --- a/Trigger/TrigT1/TrigT1RPClogic/TrigT1RPClogic/CMApatterns.h +++ b/Trigger/TrigT1/TrigT1RPClogic/TrigT1RPClogic/CMApatterns.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef CMAPATTERNS_H @@ -21,7 +21,7 @@ class CMApatterns : public RPCtrigDataObject { public: typedef std::pair < float, float > TRIGdistance; - static TRIGdistance no_distance; + static const TRIGdistance no_distance; typedef std::list < CMAtrigger > TRIGlist; typedef std::priority_queue< CMAtrigger > TrigSigns; diff --git a/Trigger/TrigT1/TrigT1RPClogic/TrigT1RPClogic/foot.h b/Trigger/TrigT1/TrigT1RPClogic/TrigT1RPClogic/foot.h index 01ab3ac6253d85b25dc138d80c6e9417d697b6ff..1f58eb755de0d9f4ce1e8e372bec9f88c495d46c 100755 --- a/Trigger/TrigT1/TrigT1RPClogic/TrigT1RPClogic/foot.h +++ b/Trigger/TrigT1/TrigT1RPClogic/TrigT1RPClogic/foot.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef ATRIG_FOOT_H @@ -11,7 +11,7 @@ #endif -static float Foot_win[THRES][NBINS][BOUND]={ +static const float Foot_win[THRES][NBINS][BOUND]={ { diff --git a/Trigger/TrigT1/TrigT1RPClogic/TrigT1RPClogic/large.h b/Trigger/TrigT1/TrigT1RPClogic/TrigT1RPClogic/large.h index 1fe7ad2eff16b6a87dca143f89c5722490c39fcb..d9d2f9a3d4b9f525c81b1e07f06a8b5a63996ed7 100755 --- a/Trigger/TrigT1/TrigT1RPClogic/TrigT1RPClogic/large.h +++ b/Trigger/TrigT1/TrigT1RPClogic/TrigT1RPClogic/large.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef ATRIG_LARGE_H @@ -9,7 +9,7 @@ #include "windows.h" #endif -static float Large_win[THRES][NBINS][BOUND]={ +static const float Large_win[THRES][NBINS][BOUND]={ { { 0.00 , 0.00 }, // Large , thres = 6.0 GeV, eta = -1.078 { -19.22 , 26.52 }, // Large , thres = 6.0 GeV, eta = -1.034 diff --git a/Trigger/TrigT1/TrigT1RPClogic/TrigT1RPClogic/small.h b/Trigger/TrigT1/TrigT1RPClogic/TrigT1RPClogic/small.h index fd87eb5ddb61444f8a2fee9d740413ad7a8b8b79..8e60229df7637b5468d3b9833a7ecf964b561f32 100755 --- a/Trigger/TrigT1/TrigT1RPClogic/TrigT1RPClogic/small.h +++ b/Trigger/TrigT1/TrigT1RPClogic/TrigT1RPClogic/small.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef ATRIG_SMALL_H @@ -11,7 +11,7 @@ #endif -static float Small_win[THRES][NBINS][BOUND]={ +static const float Small_win[THRES][NBINS][BOUND]={ { diff --git a/Trigger/TrigT1/TrigT1RPClogic/TrigT1RPClogic/windows.h b/Trigger/TrigT1/TrigT1RPClogic/TrigT1RPClogic/windows.h index 9f86c542a50fe5c758befbb2a2b56f24df4ab597..ec14d030177f28730117b679e88d59ae61534769 100755 --- a/Trigger/TrigT1/TrigT1RPClogic/TrigT1RPClogic/windows.h +++ b/Trigger/TrigT1/TrigT1RPClogic/TrigT1RPClogic/windows.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef WINDOWS_H @@ -10,7 +10,7 @@ #define BOUND 2 // boundaries of the Z-Trigger windows -int give_nearest_bin(float(*)[NBINS][BOUND],int,int,int,int); +int give_nearest_bin(const float(*)[NBINS][BOUND],int,int,int,int); int windows(float,float,int,int); diff --git a/Trigger/TrigT1/TrigT1RPClogic/src/CMApatterns.cxx b/Trigger/TrigT1/TrigT1RPClogic/src/CMApatterns.cxx index 26012cf99eb56e5d71c35063104fb539145fa1ec..66ab27293626637ce6c461514602e6d404e68d29 100755 --- a/Trigger/TrigT1/TrigT1RPClogic/src/CMApatterns.cxx +++ b/Trigger/TrigT1/TrigT1RPClogic/src/CMApatterns.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include <math.h> @@ -10,8 +10,8 @@ /////////////////////////////////////////////////////////////////////////////// -CMApatterns::TRIGdistance CMApatterns::no_distance = - TRIGdistance(99999.,99999.); +const CMApatterns::TRIGdistance CMApatterns::no_distance = + TRIGdistance(99999.,99999.); /////////////////////////////////////////////////////////////////////////////// diff --git a/Trigger/TrigT1/TrigT1RPClogic/src/components/TrigT1RPClogic_entries.cxx b/Trigger/TrigT1/TrigT1RPClogic/src/components/TrigT1RPClogic_entries.cxx deleted file mode 100644 index 8b137891791fe96927ad78e64b0aad7bded08bdc..0000000000000000000000000000000000000000 --- a/Trigger/TrigT1/TrigT1RPClogic/src/components/TrigT1RPClogic_entries.cxx +++ /dev/null @@ -1 +0,0 @@ - diff --git a/Trigger/TrigT1/TrigT1RPClogic/src/windows.cxx b/Trigger/TrigT1/TrigT1RPClogic/src/windows.cxx index 37ba75d6a9db484f9193bb783a9d910eed64a847..2960e6b69e58736456294936fc12ba4860cb1c16 100755 --- a/Trigger/TrigT1/TrigT1RPClogic/src/windows.cxx +++ b/Trigger/TrigT1/TrigT1RPClogic/src/windows.cxx @@ -1,7 +1,7 @@ /* // -*- C++ -*- */ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ @@ -23,7 +23,7 @@ int windows(float distance,float eta_pivot,int thr,int sector) int sector_type=((sector + 1)/2)%2; - float (*window)[NBINS][BOUND] = 0; + const float (*window)[NBINS][BOUND] = 0; if (sector_type == 0) @@ -62,7 +62,7 @@ int windows(float distance,float eta_pivot,int thr,int sector) return s; } -int give_nearest_bin(float (*window)[NBINS][BOUND],int thr,int bin,int bound, +int give_nearest_bin(const float (*window)[NBINS][BOUND],int thr,int bin,int bound, int step) { int previous = (bin <= NBINS/2)? bin + step : bin - step; diff --git a/Trigger/TrigT1/TrigT1RPCsteering/ATLAS_CHECK_THREAD_SAFETY b/Trigger/TrigT1/TrigT1RPCsteering/ATLAS_CHECK_THREAD_SAFETY new file mode 100644 index 0000000000000000000000000000000000000000..cfec69cee331ff95f5de595f526b5cc6923f4e77 --- /dev/null +++ b/Trigger/TrigT1/TrigT1RPCsteering/ATLAS_CHECK_THREAD_SAFETY @@ -0,0 +1 @@ +Trigger/TrigT1/TrigT1RPCsteering diff --git a/Trigger/TrigT1/TrigT1RPCsteering/CMakeLists.txt b/Trigger/TrigT1/TrigT1RPCsteering/CMakeLists.txt index de0e7a17c787b4c25f5c1571b788643afbcaecf3..2f2d9215481bd961427533b45b028fcd7e7bb5df 100644 --- a/Trigger/TrigT1/TrigT1RPCsteering/CMakeLists.txt +++ b/Trigger/TrigT1/TrigT1RPCsteering/CMakeLists.txt @@ -1,38 +1,14 @@ -################################################################################ -# Package: TrigT1RPCsteering -################################################################################ +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration # Declare the package name: atlas_subdir( TrigT1RPCsteering ) -# Declare the package's dependencies: -atlas_depends_on_subdirs( PUBLIC - Control/AthenaBaseComps - Control/StoreGate - DetectorDescription/Identifier - GaudiKernel - MuonSpectrometer/MuonCablings/RPCcablingInterface - MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry - Trigger/TrigT1/TrigT1RPClogic - PRIVATE - Generators/GeneratorObjects - Generators/AtlasHepMC - MuonSpectrometer/MuonDigitContainer - MuonSpectrometer/MuonIdHelpers - Trigger/TrigT1/TrigT1Interfaces - Trigger/TrigT1/TrigT1RPChardware ) - -# External dependencies: - # Component(s) in the package: atlas_add_component( TrigT1RPCsteering src/*.cxx src/components/*.cxx - INCLUDE_DIRS - LINK_LIBRARIES AtlasHepMCLib AthenaBaseComps StoreGateLib SGtests Identifier GaudiKernel RPCcablingInterfaceLib MuonReadoutGeometry TrigT1RPClogicLib GeneratorObjects MuonDigitContainer MuonIdHelpersLib TrigT1Interfaces TrigT1RPChardwareLib RPChardware ) + LINK_LIBRARIES AthenaBaseComps AtlasHepMCLib GaudiKernel GeneratorObjects MuonDigitContainer MuonIdHelpersLib MuonReadoutGeometry RPC_CondCablingLib RPCcablingInterfaceLib TrigT1RPChardwareLib StoreGateLib TrigT1Interfaces TrigT1RPClogicLib ) # Install files from the package: -atlas_install_headers( TrigT1RPCsteering ) -atlas_install_python_modules( python/*.py ) -atlas_install_joboptions( share/*.txt share/*.py ) - +atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) +atlas_install_joboptions( share/*.py ) diff --git a/Trigger/TrigT1/TrigT1RPCsteering/python/TrigT1RPCsteeringConfig.py b/Trigger/TrigT1/TrigT1RPCsteering/python/TrigT1RPCsteeringConfig.py index a6f4c47406183c71b9e28ebe8949c11197e7b87e..ea472f495721a9c609531235357071793ba9bd49 100755 --- a/Trigger/TrigT1/TrigT1RPCsteering/python/TrigT1RPCsteeringConfig.py +++ b/Trigger/TrigT1/TrigT1RPCsteering/python/TrigT1RPCsteeringConfig.py @@ -1,7 +1,7 @@ # Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -from TrigT1RPCsteering.TrigT1RPCsteeringConf import * -from AthenaCommon.GlobalFlags import globalflags +from TrigT1RPCsteering.TrigT1RPCsteeringConf import TrigT1RPC +from AthenaCommon.Configurable import Configurable from AthenaCommon.AppMgr import theApp from AthenaCommon.AlgSequence import AlgSequence diff --git a/Trigger/TrigT1/TrigT1RPCsteering/share/LVL1RpcRunJobOptions.txt b/Trigger/TrigT1/TrigT1RPCsteering/share/LVL1RpcRunJobOptions.txt deleted file mode 100755 index 8458cbc48f1d21f463153c681a123bd89b814f6e..0000000000000000000000000000000000000000 --- a/Trigger/TrigT1/TrigT1RPCsteering/share/LVL1RpcRunJobOptions.txt +++ /dev/null @@ -1,130 +0,0 @@ -//############################################################## -// -// Example Job options irunning the LVL1 simulation from ZebraTDR events. -// It produces the ntuple for efficiency computation. -// -//============================================================== - -//use ZebraEventSelector -#include "AthenaCommon/Atlas_ZebraTDR.UnixStandardJob.txt" -#include "PartPropSvc/PartPropSvc.txt" - -//-------------------------------------------------------------- -// Private Application Configuration options -//-------------------------------------------------------------- -// use detector store conversion service -#include "MuonDetMgrDetDescrCnv/MuonDetMgrDetDescrCnv_joboptions.txt" - -// load the fragment for Amdb package -#include "AmdbAth/AmdbAth_jobOptions.txt" -#include "AmdcAth/AmdcAth_jobOptions.txt" - -//load relevant libraries -ApplicationMgr.DLLs += { "MuonZebraCnvTest", "MuonDigitZebraCnv" }; - -ApplicationMgr.DLLs += { "RPCgeometry" }; -ApplicationMgr.DLLs += { "RPCcabling" }; -ApplicationMgr.DLLs += { "TrigT1RPChardware" }; -ApplicationMgr.DLLs += { "TrigT1RPCsteering" }; -ApplicationMgr.DLLs += { "TrigT1RPCmonitoring" }; - -ApplicationMgr.ExtSvc += { "RPCgeometrySvc" }; -ApplicationMgr.ExtSvc += { "RPCcablingSvc" }; - - -// Genzkine->HepMc converter -ApplicationMgr.DLLs += { "GenzModule" }; -ApplicationMgr.TopAlg += { "GenzModule" }; - - -//top algorithms to be run -ApplicationMgr.TopAlg += { "TrigT1RPC" }; - -//-------------------------------------------------------------- -// Set output level threshold (2=DEBUG, 3=INFO, 4=WARNING, 5=ERROR, 6=FATAL ) -//-------------------------------------------------------------- - -MessageSvc.OutputLevel = 4; -TrigT1RPC.OutputLevel = 2; - -StoreGateSvc.Dump = false; //true will dump data store contents - - - -//-------------------------------------------------------------- -// Define Printout,Debug and Dump flags for RPC geometry service -//-------------------------------------------------------------- -RPCgeometrySvc.DumpRPCGeometry = false; -RPCgeometrySvc.DumpRPCStations = false; -RPCgeometrySvc.Debug = false; -RPCgeometrySvc.DumpLVL1conf = false; -RPCgeometrySvc.DumpFileName = "LVL1conf.dump"; - - -//-------------------------------------------------------------- -// Define configuration file for cabling service -//-------------------------------------------------------------- -RPCcablingSvc.ConfFileName = "LVL1conf.data"; - -//-------------------------------------------------------------- -// Event related parameters -//-------------------------------------------------------------- - -// Number of events to be processed (default is 10) -ApplicationMgr.EvtSel = "EventSelector"; -ApplicationMgr.EvtMax = 4; - -//EventSelector.EventNumbers = " 1806 " ; - -EventSelector.firstRun=1; -EventSelector.lastRun=10000; -EventSelector.directConversion = true; - -// Switch off detectors not needed -EventSelector.readHits = false; -EventSelector.readDigits = false; -EventSelector.calos = false; -EventSelector.muons = false; -EventSelector.mdt = false; -EventSelector.rpc = false; -EventSelector.tgc = false; -EventSelector.trt = false; -EventSelector.sct = false; -EventSelector.pixel = false; - -//-------------------------------------------------------------- -// Algorithms Private Options -//-------------------------------------------------------------- - - -//-------------------------------------------------------------- -// Define configuration file for Level-1 Muon Barrel Trigger -//-------------------------------------------------------------- -TrigT1RPC.Hardware = true; -TrigT1RPC.DataDetail = false; -TrigT1RPC.RPCbytestream = false; -TrigT1RPC.RPCbytestreamFile = ""; -TrigT1RPC.EffMonitor = true; -TrigT1RPC.MaxMuon = 100; -TrigT1RPC.MaxRoI = 100; - -//TrigT1RPC.DetailedTW = true; - - -//--------------------------------------------------------------- -// Ntuple service output -//--------------------------------------------------------------- -ApplicationMgr.HistogramPersistency="HBOOK"; -NTupleSvc.Output = { "FILE1 DATAFILE='trigger.ntup' OPT='NEW'" }; -HistogramPersinstencySvc.OutputFile = "trigger.hbook"; -HbookHistSvc.OutputFile = "trigger.his"; - -//============================================================== -// -// End of AthExStoreGateExample job options file -// -//############################################################## - - - - diff --git a/Trigger/TrigT1/TrigT1RPCsteering/share/TrigT1RpcJobOptions.txt b/Trigger/TrigT1/TrigT1RPCsteering/share/TrigT1RpcJobOptions.txt deleted file mode 100755 index 1b552e75b2b50676dad5abf39873115af7993b7f..0000000000000000000000000000000000000000 --- a/Trigger/TrigT1/TrigT1RPCsteering/share/TrigT1RpcJobOptions.txt +++ /dev/null @@ -1,48 +0,0 @@ -//-------------------------------------------------------------- -// Private Application Configuration options -//-------------------------------------------------------------- -// use detector store conversion service -#include "MuonDetMgrDetDescrCnv/MuonDetMgrDetDescrCnv_joboptions.txt" - -// use Partcile Properties service -#include "PartPropSvc/PartPropSvc.txt" - - -//load relevant libraries -ApplicationMgr.DLLs += { "MuonZebraCnvTest", "MuonDigitZebraCnv" }; - -ApplicationMgr.DLLs += { "RPCgeometry" , "AmdbAth"}; -ApplicationMgr.DLLs += { "RPCcabling" }; -ApplicationMgr.DLLs += { "TrigT1RPChardware" }; -ApplicationMgr.DLLs += { "TrigT1RPCsteering" }; -ApplicationMgr.DLLs += { "TrigT1RPCmonitoring" }; - -ApplicationMgr.ExtSvc += { "AmdbsimrecAthenaSvc", "RPCgeometrySvc" }; -ApplicationMgr.ExtSvc += { "RPCcablingSvc" }; - -//top algorithms to be run -ApplicationMgr.TopAlg += { "TrigT1RPC" }; - -//-------------------------------------------------------------- -// Define Printout,Debug and Dump flags for RPC geometry service -//-------------------------------------------------------------- -RPCgeometrySvc.DumpRPCGeometry = false; -RPCgeometrySvc.DumpRPCStations = false; -RPCgeometrySvc.Debug = false; -RPCgeometrySvc.DumpLVL1conf = false; -RPCgeometrySvc.DumpFileName = "LVL1conf.dump"; - - -//-------------------------------------------------------------- -// Define configuration file for cabling service -//-------------------------------------------------------------- -RPCcablingSvc.ConfFileName = "LVL1conf.data"; - -//-------------------------------------------------------------- -// Define configuration file for Level-1 Muon Barrel Trigger -//-------------------------------------------------------------- -TrigT1RPC.Hardware = true; -TrigT1RPC.DataDetail = false; -TrigT1RPC.RPCbytestream = false; -TrigT1RPC.RPCbytestreamFile = ""; - diff --git a/Trigger/TrigT1/TrigT1RPCsteering/share/jobOfragment_TrigT1RPCsteering.py b/Trigger/TrigT1/TrigT1RPCsteering/share/jobOfragment_TrigT1RPCsteering.py deleted file mode 100755 index 72dea60723b9675d251f4e305ace4a48e6dc9f6b..0000000000000000000000000000000000000000 --- a/Trigger/TrigT1/TrigT1RPCsteering/share/jobOfragment_TrigT1RPCsteering.py +++ /dev/null @@ -1,14 +0,0 @@ -#-------------------------------------------------------------- -# Private Application Configuration options -#-------------------------------------------------------------- -theApp.Dlls += [ "TrigT1RPCsteering" ] -#top algorithms to be run -theApp.TopAlg += [ "TrigT1RPC" ] -#-------------------------------------------------------------- -# Define configuration file for Level-1 Muon Barrel Trigger -#-------------------------------------------------------------- -TrigT1RPC = Algorithm( "TrigT1RPC" ) -TrigT1RPC.Hardware = TRUE -TrigT1RPC.DataDetail = FALSE -TrigT1RPC.RPCbytestream = FALSE -TrigT1RPC.RPCbytestreamFile = "" diff --git a/Trigger/TrigT1/TrigT1RPCsteering/share/jobOfragment_TrigT1RPCsteering.txt b/Trigger/TrigT1/TrigT1RPCsteering/share/jobOfragment_TrigT1RPCsteering.txt deleted file mode 100755 index 2220335b0dc05301998f6de39be6bc500fd5ffaa..0000000000000000000000000000000000000000 --- a/Trigger/TrigT1/TrigT1RPCsteering/share/jobOfragment_TrigT1RPCsteering.txt +++ /dev/null @@ -1,17 +0,0 @@ -//-------------------------------------------------------------- -// Private Application Configuration options -//-------------------------------------------------------------- - -ApplicationMgr.DLLs += { "TrigT1RPCsteering" }; - -//top algorithms to be run -ApplicationMgr.TopAlg += { "TrigT1RPC" }; - -//-------------------------------------------------------------- -// Define configuration file for Level-1 Muon Barrel Trigger -//-------------------------------------------------------------- -TrigT1RPC.Hardware = true; -TrigT1RPC.DataDetail = false; -TrigT1RPC.RPCbytestream = false; -TrigT1RPC.RPCbytestreamFile = ""; - diff --git a/Trigger/TrigT1/TrigT1RPCsteering/src/TrigT1RPC.cxx b/Trigger/TrigT1/TrigT1RPCsteering/src/TrigT1RPC.cxx index cd5d5e053d1b4f08f3f330668847a4aaee4cfb55..f5dbbbbce2f0c3fac71b6921f69b41646275c675 100755 --- a/Trigger/TrigT1/TrigT1RPCsteering/src/TrigT1RPC.cxx +++ b/Trigger/TrigT1/TrigT1RPCsteering/src/TrigT1RPC.cxx @@ -2,7 +2,7 @@ Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -#include "TrigT1RPCsteering/TrigT1RPC.h" +#include "TrigT1RPC.h" #include "GeneratorObjects/McEventCollection.h" #include "AtlasHepMC/GenEvent.h" @@ -21,9 +21,6 @@ #include <algorithm> #include <cmath> -static int digit_num = 0; -static int digit_out = 0; - ///////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// @@ -328,9 +325,6 @@ StatusCode TrigT1RPC::fill_RPCdata(RPCsimuData& data, const RpcCablingCondData* xyz[0] = rpcDigit->time(); //time of digits - ++digit_num; - if(xyz[0]<0. || xyz[0]>25.) ++digit_out; - int param[3] = {0,0,0}; RPCsimuDigit digit(0,strip_code_cab,param,xyz); diff --git a/Trigger/TrigT1/TrigT1RPCsteering/TrigT1RPCsteering/TrigT1RPC.h b/Trigger/TrigT1/TrigT1RPCsteering/src/TrigT1RPC.h similarity index 100% rename from Trigger/TrigT1/TrigT1RPCsteering/TrigT1RPCsteering/TrigT1RPC.h rename to Trigger/TrigT1/TrigT1RPCsteering/src/TrigT1RPC.h diff --git a/Trigger/TrigT1/TrigT1RPCsteering/src/components/TrigT1RPCsteering_entries.cxx b/Trigger/TrigT1/TrigT1RPCsteering/src/components/TrigT1RPCsteering_entries.cxx index 85c28afa3ba9f496b638067c819fbf7e86b127f1..c273a5dd81803fe9ba14ca7093581e92cf91c98b 100644 --- a/Trigger/TrigT1/TrigT1RPCsteering/src/components/TrigT1RPCsteering_entries.cxx +++ b/Trigger/TrigT1/TrigT1RPCsteering/src/components/TrigT1RPCsteering_entries.cxx @@ -1,4 +1,4 @@ -#include "TrigT1RPCsteering/TrigT1RPC.h" +#include "../TrigT1RPC.h" DECLARE_COMPONENT( TrigT1RPC ) diff --git a/Trigger/TrigT1/TrigT1TGC/CMakeLists.txt b/Trigger/TrigT1/TrigT1TGC/CMakeLists.txt index f5967da5dfc2c5856a0f1534fb5f09193397390e..998b0b26fdab157f659272b60691224ccf0858f4 100644 --- a/Trigger/TrigT1/TrigT1TGC/CMakeLists.txt +++ b/Trigger/TrigT1/TrigT1TGC/CMakeLists.txt @@ -1,49 +1,20 @@ -################################################################################ -# Package: TrigT1TGC -################################################################################ +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration # Declare the package name: atlas_subdir( TrigT1TGC ) -# Declare the package's dependencies: -atlas_depends_on_subdirs( PUBLIC - Control/AthenaBaseComps - Control/AthenaKernel - Control/StoreGate - DetectorDescription/Identifier - GaudiKernel - Trigger/TrigT1/TrigT1Interfaces - PRIVATE - MuonSpectrometer/MuonCablings/TGCcablingInterface - MuonSpectrometer/MuonDigitContainer - MuonSpectrometer/MuonIdHelpers - MuonSpectrometer/MuonRDO - MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondInterface - MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondSvc - Database/AthenaPOOL/AthenaPoolUtilities - TileCalorimeter/TileEvent - Tools/PathResolver - Trigger/TrigConfiguration/TrigConfInterfaces - Trigger/TrigConfiguration/TrigConfL1Data ) - -# External dependencies: -find_package( CLHEP ) - # Component(s) in the package: atlas_add_library( TrigT1TGCLib src/*.cxx PUBLIC_HEADERS TrigT1TGC - PRIVATE_INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} - PRIVATE_DEFINITIONS ${CLHEP_DEFINITIONS} - LINK_LIBRARIES AthenaBaseComps AthenaKernel Identifier GaudiKernel TrigT1Interfaces StoreGateLib SGtests TGCcablingInterfaceLib MuonIdHelpersLib - PRIVATE_LINK_LIBRARIES ${CLHEP_LIBRARIES} MuonDigitContainer MuonRDO MuonCondInterface MuonCondSvcLib AthenaPoolUtilities TileEvent PathResolver TrigConfL1Data ) + LINK_LIBRARIES AthenaBaseComps AthenaKernel GaudiKernel Identifier MuonCondSvcLib MuonDigitContainer MuonRDO StoreGateLib TileEvent TrigT1Interfaces + PRIVATE_LINK_LIBRARIES AthenaPoolUtilities MuonCondInterface PathResolver TGCcablingInterfaceLib TrigConfL1Data ) atlas_add_component( TrigT1TGC src/components/*.cxx - INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} - LINK_LIBRARIES ${CLHEP_LIBRARIES} AthenaBaseComps AthenaKernel StoreGateLib SGtests Identifier GaudiKernel TrigT1Interfaces TGCcablingInterfaceLib MuonDigitContainer MuonIdHelpersLib MuonRDO MuonCondInterface MuonCondSvcLib AthenaPoolUtilities TileEvent PathResolver TrigConfL1Data TrigT1TGCLib ) + LINK_LIBRARIES TrigT1TGCLib ) # Install files from the package: -atlas_install_python_modules( python/*.py ) +atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) atlas_install_joboptions( share/TrigT1TGCJobOptions.py share/TrigT1TGC_jobOptions.py ) atlas_install_runtime( share/TrigT1TGCMaskedChannel*.db ) diff --git a/Trigger/TrigT1/TrigT1TGC/python/TrigT1TGCConfig.py b/Trigger/TrigT1/TrigT1TGC/python/TrigT1TGCConfig.py index 8668631cab609340fbb2af39e9b39e60552100a0..0cde794b04b43e28798df9324932804b7c307e54 100755 --- a/Trigger/TrigT1/TrigT1TGC/python/TrigT1TGCConfig.py +++ b/Trigger/TrigT1/TrigT1TGC/python/TrigT1TGCConfig.py @@ -1,6 +1,6 @@ # Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -from TrigT1TGC.TrigT1TGCConf import * +from TrigT1TGC.TrigT1TGCConf import LVL1TGCTrigger__LVL1TGCTrigger from AthenaCommon.AlgSequence import AlgSequence from AthenaCommon.GlobalFlags import globalflags from IOVDbSvc.CondDB import conddb diff --git a/Trigger/TrigT1/TrigT1TGC/src/TGCASDOut.cxx b/Trigger/TrigT1/TrigT1TGC/src/TGCASDOut.cxx index 4f63fcb752d98325ca545ff6319fce0e31f0ad1f..c911cda4e3ebf10f94854fcfda233bf2922d0d1d 100644 --- a/Trigger/TrigT1/TrigT1TGC/src/TGCASDOut.cxx +++ b/Trigger/TrigT1/TrigT1TGC/src/TGCASDOut.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ // ==================================================================== @@ -12,7 +12,7 @@ #include <iostream> #include <iomanip> -#include "CLHEP/Units/SystemOfUnits.h" +#include "GaudiKernel/SystemOfUnits.h" #include "TrigT1TGC/TGCASDOut.h" namespace LVL1TGCTrigger { @@ -98,7 +98,7 @@ void TGCASDOut::Print() const m_tgcReadoutIndex.Print(); std::cout << "::" << std::setw(9) << strsig[m_signalType] << ":: ID=" << std::setw(3) << m_hitID - << ", tof=" << std::setw(5) << std::setprecision(1) << m_hitToF/CLHEP::ns << "ns" + << ", tof=" << std::setw(5) << std::setprecision(1) << m_hitToF/Gaudi::Units::ns << "ns" << std::setprecision(6) << std::endl; } diff --git a/Trigger/TrigT1/TrigT1TGCRecRoiSvc/CMakeLists.txt b/Trigger/TrigT1/TrigT1TGCRecRoiSvc/CMakeLists.txt index e442f634bcc78245f71dc885f2c41cbec0a0d954..22cb432188aa07adad48ccd771ddc6f5b9df0ee1 100644 --- a/Trigger/TrigT1/TrigT1TGCRecRoiSvc/CMakeLists.txt +++ b/Trigger/TrigT1/TrigT1TGCRecRoiSvc/CMakeLists.txt @@ -1,33 +1,20 @@ -################################################################################ -# Package: TrigT1TGCRecRoiSvc -################################################################################ +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration # Declare the package name: atlas_subdir( TrigT1TGCRecRoiSvc ) -# Declare the package's dependencies: -atlas_depends_on_subdirs( PUBLIC - MuonSpectrometer/MuonCablings/TGCcablingInterface - MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry - Trigger/TrigT1/TrigT1Interfaces - PRIVATE - Control/StoreGate - DetectorDescription/Identifier - GaudiKernel - MuonSpectrometer/MuonIdHelpers ) - # Component(s) in the package: atlas_add_library( TrigT1TGCRecRoiSvcLib src/*.cxx PUBLIC_HEADERS TrigT1TGCRecRoiSvc - LINK_LIBRARIES MuonReadoutGeometry TrigT1Interfaces TGCcablingInterfaceLib StoreGateLib SGtests MuonIdHelpersLib - PRIVATE_LINK_LIBRARIES Identifier GaudiKernel ) + LINK_LIBRARIES GaudiKernel MuonIdHelpersLib MuonReadoutGeometry TGCcablingInterfaceLib TrigT1Interfaces + PRIVATE_LINK_LIBRARIES Identifier StoreGateLib ) atlas_add_component( TrigT1TGCRecRoiSvc src/components/*.cxx - LINK_LIBRARIES TGCcablingInterfaceLib MuonReadoutGeometry TrigT1Interfaces StoreGateLib SGtests Identifier GaudiKernel MuonIdHelpersLib TrigT1TGCRecRoiSvcLib ) + LINK_LIBRARIES TrigT1TGCRecRoiSvcLib ) # Install files from the package: -atlas_install_python_modules( python/*.py ) +atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) atlas_install_joboptions( share/*.txt share/*.py ) diff --git a/Trigger/TrigT1/TrigT1TGCRecRoiSvc/python/TrigT1TGCRecRoiConfig.py b/Trigger/TrigT1/TrigT1TGCRecRoiSvc/python/TrigT1TGCRecRoiConfig.py index bc4e2a37f869c4ad43a267c7a1880ce635a1a179..8730ea617ccdc13f4c4728cc7cab13ee95ea0225 100755 --- a/Trigger/TrigT1/TrigT1TGCRecRoiSvc/python/TrigT1TGCRecRoiConfig.py +++ b/Trigger/TrigT1/TrigT1TGCRecRoiSvc/python/TrigT1TGCRecRoiConfig.py @@ -1,6 +1,5 @@ -# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -# $Id: TrigT1TGCRecRoiConfig.py 301207 2010-05-26 12:16:53Z krasznaa $ # # To use the LVL1TGC::TGCRecRoiSvc, one has to import this module simply # like: @@ -8,8 +7,9 @@ # import TrigT1TGCRecRoiSvc.TrigT1TGCRecRoiConfig # -from TrigT1TGCRecRoiSvc.TrigT1TGCRecRoiSvcConf import * +from TrigT1TGCRecRoiSvc.TrigT1TGCRecRoiSvcConf import LVL1TGC__TGCRecRoiSvc from AthenaCommon.AppMgr import ServiceMgr +from AthenaCommon.Configurable import Configurable # Create a logger: from AthenaCommon.Logging import logging @@ -22,7 +22,7 @@ class TGCRecRoiConfig( LVL1TGC__TGCRecRoiSvc ): # Configure the cabling. Let the cabling configurable set up the services based # on the conditions. -import MuonCnvExample.MuonCablingConfig +import MuonCnvExample.MuonCablingConfig # noqa: F401 logger.debug( "Configured the cabling services" ) # Add the TGCRecRoiSvc to the service manager: diff --git a/Trigger/TrigT1/TrigT1TGCRecRoiSvc/share/TrigT1TGCRecRoiSvcJobOptions.txt b/Trigger/TrigT1/TrigT1TGCRecRoiSvc/share/TrigT1TGCRecRoiSvcJobOptions.txt deleted file mode 100755 index 7d81b65e1b02d647e0b30d61215c4721be563721..0000000000000000000000000000000000000000 --- a/Trigger/TrigT1/TrigT1TGCRecRoiSvc/share/TrigT1TGCRecRoiSvcJobOptions.txt +++ /dev/null @@ -1,4 +0,0 @@ -ApplicationMgr.DLLs += { "TrigT1TGCRecRoiSvc" }; - -// RoI reconstruction service -ApplicationMgr.ExtSvc += {"LVL1TGC::TGCRecRoiSvc"}; diff --git a/Trigger/TrigValidation/TrigAnalysisTest/share/ref_RDOtoRDOTrig_mt1_build.ref b/Trigger/TrigValidation/TrigAnalysisTest/share/ref_RDOtoRDOTrig_mt1_build.ref index c05895523842d734d919df0e820f1c6d6f4a4e39..9b8991fec9d67eb540cdd28f8b91ba538287f4c3 100644 --- a/Trigger/TrigValidation/TrigAnalysisTest/share/ref_RDOtoRDOTrig_mt1_build.ref +++ b/Trigger/TrigValidation/TrigAnalysisTest/share/ref_RDOtoRDOTrig_mt1_build.ref @@ -1,6 +1,6 @@ TrigSignatureMoniMT INFO HLT_2e17_etcut_L12EM15VH #3136730292 TrigSignatureMoniMT INFO -- #3136730292 Events 2 2 2 2 2 - - - 2 -TrigSignatureMoniMT INFO -- #3136730292 Features 12 298 14 - - - +TrigSignatureMoniMT INFO -- #3136730292 Features 12 294 14 - - - TrigSignatureMoniMT INFO HLT_2e17_lhvloose_L12EM15VH #2280638160 TrigSignatureMoniMT INFO -- #2280638160 Events 2 2 0 0 0 0 - - 0 TrigSignatureMoniMT INFO -- #2280638160 Features 0 0 0 0 - - @@ -9,7 +9,7 @@ TrigSignatureMoniMT INFO -- #1767768251 Events TrigSignatureMoniMT INFO -- #1767768251 Features 0 0 0 0 - - TrigSignatureMoniMT INFO HLT_2e3_etcut_L12EM3 #2613484113 TrigSignatureMoniMT INFO -- #2613484113 Events 20 20 20 20 20 - - - 20 -TrigSignatureMoniMT INFO -- #2613484113 Features 342 3696 780 - - - +TrigSignatureMoniMT INFO -- #2613484113 Features 342 3682 780 - - - TrigSignatureMoniMT INFO HLT_2g20_tight_L12EM15VH #3837353071 TrigSignatureMoniMT INFO -- #3837353071 Events 2 2 0 0 0 0 - - 0 TrigSignatureMoniMT INFO -- #3837353071 Features 0 0 0 0 - - @@ -38,11 +38,11 @@ TrigSignatureMoniMT INFO HLT_2mu15_L12MU10 #55720 TrigSignatureMoniMT INFO -- #557204938 Events 3 3 3 1 1 1 - - 1 TrigSignatureMoniMT INFO -- #557204938 Features 12 4 4 4 - - TrigSignatureMoniMT INFO HLT_2mu4_bDimu_L12MU4 #1730084172 -TrigSignatureMoniMT INFO -- #1730084172 Events 4 4 4 4 4 4 - - 1 -TrigSignatureMoniMT INFO -- #1730084172 Features 16 16 24 19 - - +TrigSignatureMoniMT INFO -- #1730084172 Events 4 4 4 4 4 4 - - 0 +TrigSignatureMoniMT INFO -- #1730084172 Features 16 16 24 18 - - TrigSignatureMoniMT INFO HLT_2mu4_bJpsimumu_L12MU4 #4276347155 -TrigSignatureMoniMT INFO -- #4276347155 Events 4 4 4 4 4 4 - - 1 -TrigSignatureMoniMT INFO -- #4276347155 Features 16 16 24 19 - - +TrigSignatureMoniMT INFO -- #4276347155 Events 4 4 4 4 4 4 - - 0 +TrigSignatureMoniMT INFO -- #4276347155 Features 16 16 24 18 - - TrigSignatureMoniMT INFO HLT_2mu4_bUpsimumu_L12MU4 #4008168535 TrigSignatureMoniMT INFO -- #4008168535 Events 4 4 4 4 4 4 - - 0 TrigSignatureMoniMT INFO -- #4008168535 Features 16 16 24 18 - - @@ -102,22 +102,22 @@ TrigSignatureMoniMT INFO -- #4128870680 Events TrigSignatureMoniMT INFO -- #4128870680 Features 0 0 0 0 - - TrigSignatureMoniMT INFO HLT_e17_lhloose_mu14_L1EM15VH_MU10 #899946230 TrigSignatureMoniMT INFO -- #899946230 Events 3 3 2 2 2 2 - - 2 -TrigSignatureMoniMT INFO -- #899946230 Features 2 46 4 2 - - +TrigSignatureMoniMT INFO -- #899946230 Features 2 45 4 2 - - TrigSignatureMoniMT INFO HLT_e17_lhvloose_nod0_L1EM15VH #140779220 TrigSignatureMoniMT INFO -- #140779220 Events 8 8 6 6 6 5 - - 5 -TrigSignatureMoniMT INFO -- #140779220 Features 6 79 10 5 - - +TrigSignatureMoniMT INFO -- #140779220 Features 6 78 10 5 - - TrigSignatureMoniMT INFO HLT_e26_etcut_L1EM22VHI #1703681121 TrigSignatureMoniMT INFO -- #1703681121 Events 6 6 6 6 6 - - - 6 -TrigSignatureMoniMT INFO -- #1703681121 Features 7 134 7 - - - +TrigSignatureMoniMT INFO -- #1703681121 Features 7 133 7 - - - TrigSignatureMoniMT INFO HLT_e26_lhtight_L1EM22VHI #1995263521 -TrigSignatureMoniMT INFO -- #1995263521 Events 6 6 5 5 5 3 - - 3 -TrigSignatureMoniMT INFO -- #1995263521 Features 5 65 8 3 - - +TrigSignatureMoniMT INFO -- #1995263521 Events 6 6 5 5 5 4 - - 4 +TrigSignatureMoniMT INFO -- #1995263521 Features 5 64 8 4 - - TrigSignatureMoniMT INFO HLT_e26_lhtight_nod0_L1EM22VHI #939763520 -TrigSignatureMoniMT INFO -- #939763520 Events 6 6 5 5 5 3 - - 3 -TrigSignatureMoniMT INFO -- #939763520 Features 5 65 8 3 - - +TrigSignatureMoniMT INFO -- #939763520 Events 6 6 5 5 5 4 - - 4 +TrigSignatureMoniMT INFO -- #939763520 Features 5 64 8 4 - - TrigSignatureMoniMT INFO HLT_e26_lhtight_nod0_L1EM24VHI #4227411116 -TrigSignatureMoniMT INFO -- #4227411116 Events 6 6 5 5 5 3 - - 3 -TrigSignatureMoniMT INFO -- #4227411116 Features 5 65 8 3 - - +TrigSignatureMoniMT INFO -- #4227411116 Events 6 6 5 5 5 4 - - 4 +TrigSignatureMoniMT INFO -- #4227411116 Features 5 64 8 4 - - TrigSignatureMoniMT INFO HLT_e300_etcut_L1EM22VHI #2128128255 TrigSignatureMoniMT INFO -- #2128128255 Events 6 6 0 0 0 - - - 0 TrigSignatureMoniMT INFO -- #2128128255 Features 0 0 0 - - - @@ -129,34 +129,34 @@ TrigSignatureMoniMT INFO -- #2086577378 Events TrigSignatureMoniMT INFO -- #2086577378 Features 3 - - - - - TrigSignatureMoniMT INFO HLT_e3_etcut_L1EM3 #683953566 TrigSignatureMoniMT INFO -- #683953566 Events 20 20 20 20 20 - - - 20 -TrigSignatureMoniMT INFO -- #683953566 Features 171 1848 390 - - - +TrigSignatureMoniMT INFO -- #683953566 Features 171 1841 390 - - - TrigSignatureMoniMT INFO HLT_e5_etcut_L1EM3 #324908483 TrigSignatureMoniMT INFO -- #324908483 Events 20 20 20 20 20 - - - 20 -TrigSignatureMoniMT INFO -- #324908483 Features 137 1657 190 - - - +TrigSignatureMoniMT INFO -- #324908483 Features 137 1651 190 - - - TrigSignatureMoniMT INFO HLT_e5_lhloose_noringer_L1EM3 #1053337356 TrigSignatureMoniMT INFO -- #1053337356 Events 20 20 17 17 17 4 - - 4 -TrigSignatureMoniMT INFO -- #1053337356 Features 56 656 116 5 - - +TrigSignatureMoniMT INFO -- #1053337356 Features 56 653 116 5 - - TrigSignatureMoniMT INFO HLT_e5_lhmedium_noringer_L1EM3 #176627878 TrigSignatureMoniMT INFO -- #176627878 Events 20 20 16 16 16 4 - - 4 -TrigSignatureMoniMT INFO -- #176627878 Features 48 534 93 5 - - +TrigSignatureMoniMT INFO -- #176627878 Features 48 533 93 5 - - TrigSignatureMoniMT INFO HLT_e5_lhtight_noringer_L1EM3 #2758326765 -TrigSignatureMoniMT INFO -- #2758326765 Events 20 20 16 16 16 3 - - 3 -TrigSignatureMoniMT INFO -- #2758326765 Features 45 516 84 4 - - +TrigSignatureMoniMT INFO -- #2758326765 Events 20 20 16 16 16 4 - - 4 +TrigSignatureMoniMT INFO -- #2758326765 Features 45 515 84 5 - - TrigSignatureMoniMT INFO HLT_e5_lhtight_noringer_nod0_L1EM3 #1690619419 -TrigSignatureMoniMT INFO -- #1690619419 Events 20 20 16 16 16 3 - - 3 -TrigSignatureMoniMT INFO -- #1690619419 Features 45 516 84 4 - - +TrigSignatureMoniMT INFO -- #1690619419 Events 20 20 16 16 16 4 - - 4 +TrigSignatureMoniMT INFO -- #1690619419 Features 45 515 84 5 - - TrigSignatureMoniMT INFO HLT_e60_lhmedium_L1EM22VHI #298591874 TrigSignatureMoniMT INFO -- #298591874 Events 6 6 2 2 2 2 - - 2 -TrigSignatureMoniMT INFO -- #298591874 Features 2 34 4 2 - - +TrigSignatureMoniMT INFO -- #298591874 Features 2 33 4 2 - - TrigSignatureMoniMT INFO HLT_e60_lhmedium_nod0_L1EM22VHI #4115486024 TrigSignatureMoniMT INFO -- #4115486024 Events 6 6 2 2 2 2 - - 2 -TrigSignatureMoniMT INFO -- #4115486024 Features 2 34 4 2 - - +TrigSignatureMoniMT INFO -- #4115486024 Features 2 33 4 2 - - TrigSignatureMoniMT INFO HLT_e7_etcut_L1EM3 #1959043579 TrigSignatureMoniMT INFO -- #1959043579 Events 20 20 20 20 20 - - - 20 -TrigSignatureMoniMT INFO -- #1959043579 Features 89 1136 112 - - - +TrigSignatureMoniMT INFO -- #1959043579 Features 89 1130 112 - - - TrigSignatureMoniMT INFO HLT_e7_lhmedium_mu24_L1MU20 #2970063918 TrigSignatureMoniMT INFO -- #2970063918 Events 8 8 7 5 5 1 - - 1 -TrigSignatureMoniMT INFO -- #2970063918 Features 9 72 14 1 - - +TrigSignatureMoniMT INFO -- #2970063918 Features 9 71 14 1 - - TrigSignatureMoniMT INFO HLT_g140_etcut_L1EM22VHI #3879926061 TrigSignatureMoniMT INFO -- #3879926061 Events 6 6 0 0 0 - - - 0 TrigSignatureMoniMT INFO -- #3879926061 Features 0 0 0 - - - @@ -258,12 +258,12 @@ TrigSignatureMoniMT INFO -- #2938374624 Events TrigSignatureMoniMT INFO -- #2938374624 Features 19 - - - - - TrigSignatureMoniMT INFO HLT_j45_ftf_subjesgscIS_059jvt_L1J15 #1593009344 TrigSignatureMoniMT INFO -- #1593009344 Events 20 20 12 - - - - - 12 -TrigSignatureMoniMT INFO -- #1593009344 Features 19 - - - - - +TrigSignatureMoniMT INFO -- #1593009344 Features 18 - - - - - TrigSignatureMoniMT INFO HLT_j45_ftf_subjesgscIS_L1J15 #3341539267 TrigSignatureMoniMT INFO -- #3341539267 Events 20 20 19 - - - - - 19 TrigSignatureMoniMT INFO -- #3341539267 Features 51 - - - - - TrigSignatureMoniMT INFO HLT_j45_ftf_subjesgscIS_bmv2c1070_split_L1J20 #991419339 -TrigSignatureMoniMT INFO -- #991419339 Events 19 19 19 4 - - - - 4 +TrigSignatureMoniMT INFO -- #991419339 Events 19 19 19 4 - - - - 4 TrigSignatureMoniMT INFO -- #991419339 Features 50 8 - - - - TrigSignatureMoniMT INFO HLT_j45_ftf_subjesgscIS_boffperf_split_L1J20 #1961149049 TrigSignatureMoniMT INFO -- #1961149049 Events 19 19 19 19 - - - - 19 @@ -624,7 +624,7 @@ TrigSignatureMoniMT INFO -- #1433975745 Events TrigSignatureMoniMT INFO -- #1433975745 Features 22 15 7 - - - TrigSignatureMoniMT INFO HLT_tau25_mediumRNN_tracktwoMVA_L1TAU12IM #2222894847 TrigSignatureMoniMT INFO -- #2222894847 Events 14 14 12 11 7 - - - 7 -TrigSignatureMoniMT INFO -- #2222894847 Features 22 15 10 - - - +TrigSignatureMoniMT INFO -- #2222894847 Features 22 15 9 - - - TrigSignatureMoniMT INFO HLT_tau25_mediumRNN_tracktwo_L1TAU12IM #698603885 TrigSignatureMoniMT INFO -- #698603885 Events 14 14 12 11 0 - - - 0 TrigSignatureMoniMT INFO -- #698603885 Features 22 15 0 - - - @@ -648,7 +648,7 @@ TrigSignatureMoniMT INFO -- #1275052132 Events TrigSignatureMoniMT INFO -- #1275052132 Features 22 15 0 - - - TrigSignatureMoniMT INFO HLT_tau35_mediumRNN_tracktwoMVA_L1TAU12IM #2456480859 TrigSignatureMoniMT INFO -- #2456480859 Events 14 14 11 10 6 - - - 6 -TrigSignatureMoniMT INFO -- #2456480859 Features 20 14 9 - - - +TrigSignatureMoniMT INFO -- #2456480859 Features 20 14 8 - - - TrigSignatureMoniMT INFO HLT_tilecalib_laser_TilePEB_L1CALREQ2 #1063154655 TrigSignatureMoniMT INFO -- #1063154655 Events 0 0 0 - - - - - 0 TrigSignatureMoniMT INFO -- #1063154655 Features 0 - - - - - @@ -665,8 +665,8 @@ TrigSignatureMoniMT INFO HLT_xe100_tcpufit_L1XE50 TrigSignatureMoniMT INFO -- #2803198799 Events 10 10 6 - - - - - 6 TrigSignatureMoniMT INFO -- #2803198799 Features 6 - - - - - TrigSignatureMoniMT INFO HLT_xe100_trkmht_L1XE50 #1055916731 -TrigSignatureMoniMT INFO -- #1055916731 Events 10 10 4 - - - - - 4 -TrigSignatureMoniMT INFO -- #1055916731 Features 4 - - - - - +TrigSignatureMoniMT INFO -- #1055916731 Events 10 10 5 - - - - - 5 +TrigSignatureMoniMT INFO -- #1055916731 Features 5 - - - - - TrigSignatureMoniMT INFO HLT_xe110_mht_L1XE50 #3030733259 TrigSignatureMoniMT INFO -- #3030733259 Events 10 10 6 - - - - - 6 TrigSignatureMoniMT INFO -- #3030733259 Features 6 - - - - - diff --git a/Trigger/TrigValidation/TrigInDetValidation/share/TrigInDetValidation_AODtoTrkNtuple.py b/Trigger/TrigValidation/TrigInDetValidation/share/TrigInDetValidation_AODtoTrkNtuple.py index ea582118a42bb7af56d2da79ac9693df055ef556..cdccd5e14d484967ec637fa9e52794fa7246a10f 100644 --- a/Trigger/TrigValidation/TrigInDetValidation/share/TrigInDetValidation_AODtoTrkNtuple.py +++ b/Trigger/TrigValidation/TrigInDetValidation/share/TrigInDetValidation_AODtoTrkNtuple.py @@ -162,6 +162,8 @@ if ( True ) : "HLT_tau.*_idperf.*:HLT_IDTrack_TauCore_FTF", "HLT_tau.*_idperf.*:HLT_IDTrack_TauIso_FTF", + "HLT_tau.*_idperf.*:HLT_IDTrack_TauCore_FTF:HLT_Roi_TauCore", + "HLT_tau.*_idperf.*:HLT_IDTrack_TauIso_FTF:HLT_Roi_TauIso", "HLT_tau.*_idperf.*:HLT_IDTrack_Tau_IDTrig", "HLT_tau.*_idperf.*:HLT_IDTrack_Tau_FTF" diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_all_ttbar_pu80_grid.py b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_all_ttbar_pu80_grid.py index 88499f733101b676d551cb3dae2cd1cb7de63343..dcbb230d96a5fe191589e8c1e5bb4445b247d7e8 100755 --- a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_all_ttbar_pu80_grid.py +++ b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_all_ttbar_pu80_grid.py @@ -3,7 +3,6 @@ # art-description: art job for all_ttbar_pu80_grid # art-type: grid # art-include: master/Athena -# art-input: mc15_13TeV.410000.PowhegPythiaEvtGen_P2012_ttbar_hdamp172p5_nonallhad.recon.RDO.e3698_s2608_s2183_r7195 # art-input-nfiles: 3 # art-athena-mt: 4 # art-output: *.txt @@ -16,10 +15,8 @@ # art-output: *.json # art-output: *.root # art-output: *.check* -# art-output: HLTEF-plots -# art-output: HLTL2-plots -# art-output: times -# art-output: times-FTF +# art-output: HLT* +# art-output: times* # art-output: cost-perCall # art-output: cost-perEvent # art-output: cost-perCall-chain @@ -105,11 +102,7 @@ rdo2aod.concurrent_events = 1 # TODO: change to 4 rdo2aod.perfmon = False rdo2aod.timeout = 18*3600 rdo2aod.args = '--outputAODFile=AOD.pool.root --steering="doRDO_TRIG" ' -if local: - rdo2aod.input = 'ttbar_pu80' ## This isn't the same sample as the grid test but for not lets use it. -else: - rdo2aod.input = '' - rdo2aod.args += '--inputRDOFile=$ArtInFile ' +rdo2aod.input = 'ttbar_pu80' rdo2aod.args += ' --preExec "RDOtoRDOTrigger:{:s};" "all:{:s};" "RAWtoESD:{:s};" "ESDtoAOD:{:s};"'.format( preexec_trig, preexec_all, preexec_reco, preexec_aod) diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_all_ttbar_pu80_mt_grid.py b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_all_ttbar_pu80_mt_grid.py index 19ba137045c02c905eac2614fc66a40403af595d..56571d8086a90c9d2b5199e799886458bdb125b0 100755 --- a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_all_ttbar_pu80_mt_grid.py +++ b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_all_ttbar_pu80_mt_grid.py @@ -3,7 +3,6 @@ # art-description: art job for all_ttbar_pu80_mp_grid # art-type: grid # art-include: master/Athena -# art-input: mc15_13TeV.410000.PowhegPythiaEvtGen_P2012_ttbar_hdamp172p5_nonallhad.recon.RDO.e3698_s2608_s2183_r7195 # art-input-nfiles: 3 # art-athena-mt: 4 # art-output: *.txt @@ -96,11 +95,7 @@ rdo2aod.threads = 1 # TODO: change to 4 rdo2aod.concurrent_events = 4 rdo2aod.perfmon = False rdo2aod.args = '--outputAODFile=AOD.pool.root --steering="doRDO_TRIG" ' -if local: - rdo2aod.input = 'ttbar_pu80' ## This isn't the same sample as the grid test but for not lets use it. -else: - rdo2aod.input = '' - rdo2aod.args += '--inputRDOFile=$ArtInFile ' +rdo2aod.input = 'ttbar_pu80' ## This isn't the same sample as the grid test but for not lets use it. rdo2aod.args += ' --preExec "RDOtoRDOTrigger:{:s};" "all:{:s};" "RAWtoESD:{:s};" "ESDtoAOD:{:s};"'.format( preexec_trig, preexec_all, preexec_reco, preexec_aod) diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_mu_zmumu_pu40_grid.py b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_mu_zmumu_pu40_grid.py index c2e327c3dfa4d54f06a733e08b92a58ee6548a78..f725eeab71541be73fd43b775abc34d48648e5d7 100755 --- a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_mu_zmumu_pu40_grid.py +++ b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_mu_zmumu_pu40_grid.py @@ -16,10 +16,8 @@ # art-output: *.json # art-output: *.root # art-output: *.check* -# art-output: HLTEF-plots -# art-output: HLTL2-plots -# art-output: times -# art-output: times-FTF +# art-output: HLT* +# art-output: times* # art-output: cost-perCall # art-output: cost-perEvent # art-output: cost-perCall-chain diff --git a/Trigger/TrigValidation/TrigP1Test/test/test_trigP1_CalibPeb_build.py b/Trigger/TrigValidation/TrigP1Test/test/test_trigP1_CalibPeb_build.py index 36508b956e0d4b51fb74224ba0e427c77b6e1a4d..5b0ccc15fa8935fe89b64af71769e7acc6ad8736 100755 --- a/Trigger/TrigValidation/TrigP1Test/test/test_trigP1_CalibPeb_build.py +++ b/Trigger/TrigValidation/TrigP1Test/test/test_trigP1_CalibPeb_build.py @@ -19,7 +19,9 @@ test.exec_steps = [ex] test.check_steps = CheckSteps.default_check_steps(test) # Make RootComp step required -test.get_step('RootComp').required = True +rc = test.get_step('RootComp') +rc.required = True +rc.args += ' --sortLabels' import sys sys.exit(test.run()) diff --git a/Trigger/TrigValidation/TrigP1Test/test/test_trigP1_CalibPeb_concurrent_build.py b/Trigger/TrigValidation/TrigP1Test/test/test_trigP1_CalibPeb_concurrent_build.py index 2e842357485b6420fa432b60674fb94c11358185..1043e78e28ab4d911a7bc5ab21b1af96ddfa5be5 100755 --- a/Trigger/TrigValidation/TrigP1Test/test/test_trigP1_CalibPeb_concurrent_build.py +++ b/Trigger/TrigValidation/TrigP1Test/test/test_trigP1_CalibPeb_concurrent_build.py @@ -23,7 +23,9 @@ test.exec_steps = [ex] test.check_steps = CheckSteps.default_check_steps(test) # Make RootComp step required -test.get_step('RootComp').required = True +rc = test.get_step('RootComp') +rc.required = True +rc.args += ' --sortLabels' import sys sys.exit(test.run()) diff --git a/Trigger/TrigValidation/TrigP1Test/test/test_trigP1_CalibPeb_concurrent_grid.py b/Trigger/TrigValidation/TrigP1Test/test/test_trigP1_CalibPeb_concurrent_grid.py index 6b42cdbc2d9787dc37aa3914f9fe927e4f8d7654..ffa5df4a1f53077aac4b6e1e59e042773b01ecda 100755 --- a/Trigger/TrigValidation/TrigP1Test/test/test_trigP1_CalibPeb_concurrent_grid.py +++ b/Trigger/TrigValidation/TrigP1Test/test/test_trigP1_CalibPeb_concurrent_grid.py @@ -35,7 +35,9 @@ test.exec_steps = [ex] test.check_steps = CheckSteps.default_check_steps(test) # Make RootComp step required -test.get_step('RootComp').required = True +rc = test.get_step('RootComp') +rc.required = True +rc.args += ' --sortLabels' import sys sys.exit(test.run()) diff --git a/Trigger/TrigValidation/TrigP1Test/test/test_trigP1_CalibPeb_highForkAndMT_build.py b/Trigger/TrigValidation/TrigP1Test/test/test_trigP1_CalibPeb_highForkAndMT_build.py index dbb65dda3667a3ef9d1315e2ef8bc07b65417721..37815facdd13cbc37d5a958ec83567c69f264813 100755 --- a/Trigger/TrigValidation/TrigP1Test/test/test_trigP1_CalibPeb_highForkAndMT_build.py +++ b/Trigger/TrigValidation/TrigP1Test/test/test_trigP1_CalibPeb_highForkAndMT_build.py @@ -22,7 +22,9 @@ test.exec_steps = [ex] test.check_steps = CheckSteps.default_check_steps(test) # Make RootComp step required -test.get_step('RootComp').required = True +rc = test.get_step('RootComp') +rc.required = True +rc.args += ' --sortLabels' import sys sys.exit(test.run()) diff --git a/Trigger/TrigValidation/TrigValTools/TrigValTools/TRootCompare.h b/Trigger/TrigValidation/TrigValTools/TrigValTools/TRootCompare.h index f97bea0bd7cab35b60f5ce98150037f02e277d05..0bb36a0f1aa734d5c84ca800250b717dce5c2d23 100644 --- a/Trigger/TrigValidation/TrigValTools/TrigValTools/TRootCompare.h +++ b/Trigger/TrigValidation/TrigValTools/TrigValTools/TRootCompare.h @@ -45,6 +45,7 @@ class TRootCompare : public TFileLooper { } void drawNormalized(Bool_t norm = kTRUE) { m_drawNormalized = norm; } void drawDiff(Bool_t diff = kTRUE) { m_drawDiff = diff; } + void sortLabels(Bool_t sort = kTRUE) { m_sortLabels = sort; } Int_t matchingHist() const { return m_histMatch; } Int_t totalHist() const { return m_histTotal; } @@ -52,6 +53,7 @@ class TRootCompare : public TFileLooper { private: Bool_t compareHist(const TH1& h, const TH1& href); + void sortAndDeflate(TH1& h); void createDirectory(TFile* f, const char* dirpath); void printCanvas(const char* filename); @@ -69,6 +71,7 @@ class TRootCompare : public TFileLooper { Int_t m_histMissing; Bool_t m_drawNormalized; Bool_t m_drawDiff; + Bool_t m_sortLabels; std::vector<std::string> m_noMatch; diff --git a/Trigger/TrigValidation/TrigValTools/bin/rootcomp.py b/Trigger/TrigValidation/TrigValTools/bin/rootcomp.py index ad13c7842a8f22fb6110e90bf55625455dbf0248..56e0221bfa870f1df7fac36a47300560ef563be4 100755 --- a/Trigger/TrigValidation/TrigValTools/bin/rootcomp.py +++ b/Trigger/TrigValidation/TrigValTools/bin/rootcomp.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration # @file: rootcomp.py # @purpose: Script to compare the histograms in two root files # @author: Frank Winklmeier, Will Buttinger @@ -62,6 +62,10 @@ def main(): action = "store_true", help = "use axis comparison instead of bin-by-bin") + parser.add_option("-l", "--sortLabels", + action = "store_true", default=False, + help = "sort/deflate alphanumeric axis before comparing") + parser.add_option("-t", "--threshold", action = "store", type="float", help = "threshold for bin or chi2 comparison (default: 1e-6 or 0.95)") @@ -225,7 +229,7 @@ def main(): else: valid.setPsFile(opts.outFile+".ps") - + valid.sortLabels(opts.sortLabels) valid.drawNormalized(opts.norm) valid.drawDiff(not opts.noDiff) diff --git a/Trigger/TrigValidation/TrigValTools/src/TRootCompare.cxx b/Trigger/TrigValidation/TrigValTools/src/TRootCompare.cxx index e34e56a967ed0c7e0054a0d7d53d3377a4c834c0..e50f653e9e0dc567b15ef2563d7db5ea31e5e03f 100644 --- a/Trigger/TrigValidation/TrigValTools/src/TRootCompare.cxx +++ b/Trigger/TrigValidation/TrigValTools/src/TRootCompare.cxx @@ -153,6 +153,13 @@ void TRootCompare::processKey(TDirectory& dir, TKey& key) if (obj->IsA()->InheritsFrom("TH1")) { TH1& h = *((TH1*)obj.get()); TH1& href = *((TH1*)refObj); + + // For alphanumeric axes, sort and deflate + if (m_sortLabels) { + sortAndDeflate(h); + sortAndDeflate(href); + } + Bool_t match = compareHist(h,href); m_histTotal++; if (match) { @@ -451,6 +458,18 @@ Bool_t TRootCompare::compareHist(const TH1& h, const TH1& href) return result; } +// sort histogram axes and deflate +void TRootCompare::sortAndDeflate(TH1& h) +{ + if (h.GetXaxis()->IsAlphanumeric()) { + h.GetXaxis()->LabelsOption("a"); + h.LabelsDeflate("X"); + } + if (h.GetYaxis()->IsAlphanumeric()) { + h.GetYaxis()->LabelsOption("a"); + h.LabelsDeflate("Y"); + } +} // Create all directories in dirpath void TRootCompare::createDirectory(TFile* f, const char* dirpath) diff --git a/Trigger/TrigValidation/TriggerTest/share/ref_data_v1Dev_build.ref b/Trigger/TrigValidation/TriggerTest/share/ref_data_v1Dev_build.ref index 1805c7dbd0bead32fa34d3aab273de3824c5c67e..aefe8df858b8bebf7d5017226054045e3d231ef7 100644 --- a/Trigger/TrigValidation/TriggerTest/share/ref_data_v1Dev_build.ref +++ b/Trigger/TrigValidation/TriggerTest/share/ref_data_v1Dev_build.ref @@ -9,7 +9,7 @@ TrigSignatureMoniMT INFO -- #1767768251 Events TrigSignatureMoniMT INFO -- #1767768251 Features 0 0 0 0 - - TrigSignatureMoniMT INFO HLT_2e3_etcut_L12EM3 #2613484113 TrigSignatureMoniMT INFO -- #2613484113 Events 20 20 13 13 13 - - - 13 -TrigSignatureMoniMT INFO -- #2613484113 Features 92 322 178 - - - +TrigSignatureMoniMT INFO -- #2613484113 Features 92 324 178 - - - TrigSignatureMoniMT INFO HLT_2g20_tight_L12EM15VH #3837353071 TrigSignatureMoniMT INFO -- #3837353071 Events 20 20 0 0 0 0 - - 0 TrigSignatureMoniMT INFO -- #3837353071 Features 0 0 0 0 - - @@ -129,10 +129,10 @@ TrigSignatureMoniMT INFO -- #2086577378 Events TrigSignatureMoniMT INFO -- #2086577378 Features 0 - - - - - TrigSignatureMoniMT INFO HLT_e3_etcut_L1EM3 #683953566 TrigSignatureMoniMT INFO -- #683953566 Events 20 20 15 14 14 - - - 14 -TrigSignatureMoniMT INFO -- #683953566 Features 48 162 90 - - - +TrigSignatureMoniMT INFO -- #683953566 Features 48 163 90 - - - TrigSignatureMoniMT INFO HLT_e5_etcut_L1EM3 #324908483 TrigSignatureMoniMT INFO -- #324908483 Events 20 20 13 13 13 - - - 13 -TrigSignatureMoniMT INFO -- #324908483 Features 41 147 49 - - - +TrigSignatureMoniMT INFO -- #324908483 Features 41 148 49 - - - TrigSignatureMoniMT INFO HLT_e5_lhloose_noringer_L1EM3 #1053337356 TrigSignatureMoniMT INFO -- #1053337356 Events 20 20 10 10 10 1 - - 1 TrigSignatureMoniMT INFO -- #1053337356 Features 15 48 31 1 - - @@ -686,8 +686,8 @@ TrigSignatureMoniMT INFO HLT_xe30_mht_L1XE10 #36 TrigSignatureMoniMT INFO -- #3626903018 Events 20 20 16 - - - - - 16 TrigSignatureMoniMT INFO -- #3626903018 Features 16 - - - - - TrigSignatureMoniMT INFO HLT_xe30_pfsum_L1XE10 #998713382 -TrigSignatureMoniMT INFO -- #998713382 Events 20 20 4 - - - - - 4 -TrigSignatureMoniMT INFO -- #998713382 Features 4 - - - - - +TrigSignatureMoniMT INFO -- #998713382 Events 20 20 3 - - - - - 3 +TrigSignatureMoniMT INFO -- #998713382 Features 3 - - - - - TrigSignatureMoniMT INFO HLT_xe30_tcpufit_L1XE10 #1583719916 TrigSignatureMoniMT INFO -- #1583719916 Events 20 20 6 - - - - - 6 TrigSignatureMoniMT INFO -- #1583719916 Features 6 - - - - - diff --git a/Trigger/TriggerCommon/TrigEDMConfig/CMakeLists.txt b/Trigger/TriggerCommon/TrigEDMConfig/CMakeLists.txt index 3b36f0d08e4217af16dc1af41463f9e2b6de9a01..8dc62437d9bb928c507056c0bb05cec885e6ed2f 100644 --- a/Trigger/TriggerCommon/TrigEDMConfig/CMakeLists.txt +++ b/Trigger/TriggerCommon/TrigEDMConfig/CMakeLists.txt @@ -1,17 +1,10 @@ -################################################################################ -# Package: TrigEDMConfig -################################################################################ +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration # Declare the package name: atlas_subdir( TrigEDMConfig ) # Install files from the package: -atlas_install_python_modules( python/*.py ) +atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} --extend-extensions=ATL900,ATL901 ) atlas_add_test( UnitTest SCRIPT python/testEDM.py ) atlas_add_test( UnitTestRun3 SCRIPT python/testEDMRun3.py ) - -# Check python code: -atlas_add_test( flake8 - SCRIPT flake8 --select=ATL,F,E7,E9,W6 --enable-extension=ATL900,ATL901 --extend-ignore=E701,E741 ${CMAKE_CURRENT_SOURCE_DIR}/python - POST_EXEC_SCRIPT nopost.sh ) diff --git a/Trigger/TriggerCommon/TrigEDMConfig/python/TriggerEDMRun1.py b/Trigger/TriggerCommon/TrigEDMConfig/python/TriggerEDMRun1.py index f72f6dc52556c6b3f93d711af838211584954c60..674a659fe2ae737f9044a80bc90dcff62cb56848 100644 --- a/Trigger/TriggerCommon/TrigEDMConfig/python/TriggerEDMRun1.py +++ b/Trigger/TriggerCommon/TrigEDMConfig/python/TriggerEDMRun1.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration # ************************* WARNING *************************** # @@ -252,8 +252,8 @@ TriggerEFList = [ ('CaloCellContainer#HLT_TrigCaloCellLoF', 'BS ESD', 'Calo') # category? # - # examples for the configuration of a collection that goes *only* into a data-scouting streams - # but not into the full event (flag with 'DS') + # examples for the configuration of a collection that goes *only* into a data-scouting streams + # but not into the full event (flag with 'DS') # ('TrackCollection#HLT_InDetTrigTracksIDCalib', 'DS ESD AODFULL AODSLIM', 'EgammaDS'), # ('TrigRoiDescriptor#HLT_secondaryRoI_EF', 'DS ESD AODFULL AODSLIM', 'EgammaDS'), ] diff --git a/Trigger/TriggerCommon/TrigEDMConfig/python/TriggerEDMRun2.py b/Trigger/TriggerCommon/TrigEDMConfig/python/TriggerEDMRun2.py index d6255cd1c5c065fe8da98b37823eee27311a0eb4..cccc53d349e40c4ad9924664295b4828e3fa87d1 100644 --- a/Trigger/TriggerCommon/TrigEDMConfig/python/TriggerEDMRun2.py +++ b/Trigger/TriggerCommon/TrigEDMConfig/python/TriggerEDMRun2.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration # ********************* WARNING ********************** # @@ -1547,18 +1547,18 @@ EDMLibraries = [ 'TrigSteeringEvent', 'TrigMuonEvent', 'TrigInDetEvent', 'TrigParticle', 'TrigMissingEtEvent', 'TrigDecisionEvent', 'TrigMonitoringEvent', - 'TrigTopoEvent' , 'TrigCombinedEvent', - 'TrigMonitoringEventTPCnv', 'RecTPCnv', + 'TrigTopoEvent' , 'TrigCombinedEvent', + 'TrigMonitoringEventTPCnv', 'RecTPCnv', 'TrigCaloEventTPCnv', 'TrigDecisionEventTPCnv', 'TrigInDetEventTPCnv', 'TrigMissingEtEventTPCnv', 'TrigMuonEventTPCnv', 'TrigParticleTPCnv', 'TrigSteeringEventTPCnv', - 'TrigTopoEventTPCnv', 'TrigCombinedEventTPCnv', - 'tauEventTPCnvDict', 'RecTPCnvDict', - 'TrigMonitoringEventTPCnvDict', - 'OLD_RecTPCnvDict', + 'TrigTopoEventTPCnv', 'TrigCombinedEventTPCnv', + 'tauEventTPCnvDict', 'RecTPCnvDict', + 'TrigMonitoringEventTPCnvDict', + 'OLD_RecTPCnvDict', # - #'TrigCombinedEventTPCnv1Dict', 'TrigCaloEventTPCnv1Dict', + #'TrigCombinedEventTPCnv1Dict', 'TrigCaloEventTPCnv1Dict', #'TrigDecisionEventTPCnv1Dict', 'TrigInDetEventTPCnv1Dict', #'TrigMissingEtEventTPCnv1Dict', 'TrigMuonEventTPCnv1Dict', #'TrigParticleTPCnv1Dict', 'TrigSteeringEventTPCnv1Dict', @@ -1568,17 +1568,17 @@ EDMLibraries = [ 'TrigSteeringEvent', 'TrigMuonEvent', 'xAODCaloEvent', 'xAODEgamma', 'xAODTracking', 'xAODMuon', 'xAODTau', 'xAODJet', 'xAODTrigBphys', 'xAODTrigMissingET', 'xAODTrigEgamma', 'xAODTrigMuon', 'xAODTrigCalo', 'xAODTrigMinBias', 'xAODBTagging', 'xAODTrigRinger', - 'xAODHIEvent', + 'xAODHIEvent', 'xAODCaloEventDict', 'xAODEgammaDict', 'xAODTrackingDict', 'xAODMuonDict', 'xAODTauDict', 'xAODJetDict', 'xAODTrigBphysDict', 'xAODTrigMissingETDict', 'xAODTrigEgammaDict', 'xAODTrigMuonDict', 'xAODTrigCaloDict', 'xAODTrigMinBiasDict', 'xAODBTaggingDict', - 'xAODHIEventDict' - #'ARA_TrigMonitoringEventTPCnvDict', + 'xAODHIEventDict' + #'ARA_TrigMonitoringEventTPCnvDict', #'ARA_TrigCaloEventTPCnv1Dict', #'ARA_TrigDecisionEventTPCnv1Dict', #'ARA_TrigInDetEventTPCnv1Dict', #'ARA_TrigMissingEtEventTPCnv1Dict', 'ARA_TrigMuonEventTPCnv1Dict', #'ARA_TrigParticleTPCnv1Dict', #'ARA_TrigSteeringEventTPCnv1Dict', - #'ARA_RecTPCnvDict', 'ARA_tauEventTPCnvDict' + #'ARA_RecTPCnvDict', 'ARA_tauEventTPCnvDict' ] diff --git a/Trigger/TriggerCommon/TriggerJobOpts/share/decodeBS.py b/Trigger/TriggerCommon/TriggerJobOpts/share/decodeBS.py index 1478eb45848f6df0ba64b2fb74c0582fab9bb515..dbcd0275982f8d342a28660db28c63eec7533398 100644 --- a/Trigger/TriggerCommon/TriggerJobOpts/share/decodeBS.py +++ b/Trigger/TriggerCommon/TriggerJobOpts/share/decodeBS.py @@ -76,3 +76,15 @@ if len(ItemList) == 0: ItemList += [ 'xAOD::TrigCompositeAuxContainer#*' ] StreamESD.ItemList = list(set(ItemList)) outSequence += StreamESD + +# Set up a temporary workaround for ROOT-10940 / ATR-21753. +from AthenaCommon.AppMgr import theApp, ServiceMgr as svcMgr +from xAODCoreCnv.xAODCoreCnvConf import xAODMaker__ROOTHeaderLoaderSvc +svcMgr += xAODMaker__ROOTHeaderLoaderSvc( 'ROOTHeaderLoaderSvc', + HeaderNames = [ 'xAODEgamma/PhotonContainer.h', + 'xAODTrigEgamma/TrigPhotonContainer.h', + 'xAODMuon/MuonContainer.h', + 'xAODTrigMuon/L2StandAloneMuonContainer.h', + 'xAODJet/JetContainer.h', + 'xAODTau/TauJetContainer.h' ] ) +theApp.CreateSvc += [ 'xAODMaker::ROOTHeaderLoaderSvc/ROOTHeaderLoaderSvc' ] diff --git a/Trigger/TriggerCommon/TriggerJobOpts/share/runHLT_standalone.py b/Trigger/TriggerCommon/TriggerJobOpts/share/runHLT_standalone.py index 8d4cc9c5028a88da83b6224973ac74526c931275..90c6ec6935797664d56cb5a1d7a0d865d07255f7 100644 --- a/Trigger/TriggerCommon/TriggerJobOpts/share/runHLT_standalone.py +++ b/Trigger/TriggerCommon/TriggerJobOpts/share/runHLT_standalone.py @@ -83,7 +83,7 @@ for option in defaultOptions: if option in globals(): setattr(opt, option, globals()[option]) print(' %20s = %s' % (option, getattr(opt, option))) - else: + else: print(' %20s = (Default) %s' % (option, getattr(opt, option))) @@ -194,7 +194,7 @@ ConfigFlags.Trigger.enableL1CaloLegacy = opt.enableL1CaloLegacy # To turn off HLT for athena running TriggerFlags.doHLT = bool(opt.doHLT) - + # To extract the Trigger configuration TriggerFlags.Online.doDBConfig = bool(opt.doDBConfig) if opt.trigBase is not None: @@ -247,7 +247,7 @@ TriggerFlags.doCalo = opt.doCalo modifierList=[] from TrigConfigSvc.TrigConfMetaData import TrigConfMetaData meta = TrigConfMetaData() - + for mod in dir(TriggerJobOpts.Modifiers): if not hasattr(getattr(TriggerJobOpts.Modifiers,mod),'preSetup'): continue @@ -361,7 +361,7 @@ else: topSequence.SGInputLoader.Load += [( 'xAOD::EventInfo' , 'StoreGateSvc+EventInfo' )] # ---------------------------------------------------------------- -# Detector geometry +# Detector geometry # ---------------------------------------------------------------- # Always enable AtlasFieldSvc from AthenaCommon.DetFlags import DetFlags @@ -407,12 +407,12 @@ if globalflags.InputFormat.is_pool(): import AthenaPoolCnvSvc.ReadAthenaPool # noqa svcMgr.AthenaPoolCnvSvc.PoolAttributes = [ "DEFAULT_BUFFERSIZE = '2048'" ] svcMgr.PoolSvc.AttemptCatalogPatch=True - # enable transient BS + # enable transient BS if TriggerFlags.doTransientByteStream(): log.info("setting up transient BS") include( "TriggerJobOpts/jobOfragment_TransBS_standalone.py" ) - - + + # ---------------------------------------------------------------- # ByteStream input # ---------------------------------------------------------------- @@ -425,6 +425,17 @@ elif globalflags.InputFormat.is_bytestream() and not ConfigFlags.Trigger.Online. from ByteStreamCnvSvc.ByteStreamConfig import ByteStreamReadCfg CAtoGlobalWrapper(ByteStreamReadCfg, ConfigFlags) +# Set up a temporary workaround for ROOT-10940 / ATR-21753. +from xAODCoreCnv.xAODCoreCnvConf import xAODMaker__ROOTHeaderLoaderSvc +svcMgr += xAODMaker__ROOTHeaderLoaderSvc( 'ROOTHeaderLoaderSvc', + HeaderNames = [ 'xAODEgamma/PhotonContainer.h', + 'xAODTrigEgamma/TrigPhotonContainer.h', + 'xAODMuon/MuonContainer.h', + 'xAODTrigMuon/L2StandAloneMuonContainer.h', + 'xAODJet/JetContainer.h', + 'xAODTau/TauJetContainer.h' ] ) +theApp.CreateSvc += [ 'xAODMaker::ROOTHeaderLoaderSvc/ROOTHeaderLoaderSvc' ] + # --------------------------------------------------------------- # Trigger config # --------------------------------------------------------------- @@ -503,7 +514,7 @@ if not opt.createHLTMenuExternally: if (opt.selectChains): menu.selectChainsForTesting = opt.selectChains - # generating the HLT structure requires + # generating the HLT structure requires # the L1Decoder to be defined in the topSequence menu.generateMT() @@ -544,7 +555,7 @@ if hasattr(svcMgr.THistSvc, "Output"): #------------------------------------------------------------- # Conditions overrides -#------------------------------------------------------------- +#------------------------------------------------------------- if len(opt.condOverride)>0: for folder,tag in opt.condOverride.iteritems(): log.warning('Overriding folder %s with tag %s', folder, tag) diff --git a/Trigger/TriggerCommon/TriggerMenu/python/api/TriggerAPI.py b/Trigger/TriggerCommon/TriggerMenu/python/api/TriggerAPI.py index b72fe0cc984387a35d051690cf8b690b86dd22a5..c180566af52842409c4389e3a445f8d7a1898e95 100644 --- a/Trigger/TriggerCommon/TriggerMenu/python/api/TriggerAPI.py +++ b/Trigger/TriggerCommon/TriggerMenu/python/api/TriggerAPI.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration from __future__ import print_function @@ -35,7 +35,7 @@ class TriggerAPI: cls.pickleread = True if cls.centralPickleFile: try: - with open(cls.centralPickleFile, 'r') as f: + with open(cls.centralPickleFile, 'rb') as f: cls.log.info("Reading cached information from: "+cls.centralPickleFile) cls.dbQueries = pickle.load(f) except (pickle.PickleError, ValueError): @@ -44,7 +44,7 @@ class TriggerAPI: else: cls.dbQueries = {} try: - with open(cls.privatePickleFile, 'r') as f: + with open(cls.privatePickleFile, 'rb') as f: cls.privatedbQueries = pickle.load(f) cls.dbQueries.update(cls.privatedbQueries) except (pickle.PickleError, ValueError):