diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTileCal/share/TCAL1.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTileCal/share/TCAL1.py index abc9c78ec221020c193806076b0ebc39e6241b4d..41f0f40f4194988c0da7e3e512146a6b57eb6df7 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTileCal/share/TCAL1.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTileCal/share/TCAL1.py @@ -20,6 +20,14 @@ if not 'TileDerivationPrefix' in dir(): # TRACK TOOLS from DerivationFrameworkTileCal.DerivationFrameworkTileCalConf import TrackTools TCAL1TrackTools = TrackTools() + +## Set the beam type flag: collision or cosmic +from AthenaCommon.JobProperties import jobproperties +if jobproperties.Beam.beamType() == 'collisions': + TCAL1TrackTools.IsCollision = True +else: + TCAL1TrackTools.IsCollision = False + ToolSvc += TCAL1TrackTools @@ -46,7 +54,6 @@ TCAL1TileCellsMuonDecorator = CfgMgr.DerivationFramework__TileCellsMuonDecorator , MaxAbsMuonEta = 1.7 , IsoCone = 0.4) -from AthenaCommon.JobProperties import jobproperties if jobproperties.Beam.beamType() == 'collisions': TCAL1TileCellsMuonDecorator.SelectMuons = True @@ -143,7 +150,7 @@ DerivationFrameworkJob += CfgMgr.DerivationFramework__DerivationKernel("TCAL1Ker from DerivationFrameworkCore.SlimmingHelper import SlimmingHelper TCAL1SlimmingHelper = SlimmingHelper('TCAL1SlimmingHelper') -TCAL1SlimmingHelper.SmartCollections = ['Muons', 'MET_Reference_AntiKt4LCTopo'] +TCAL1SlimmingHelper.SmartCollections = ['Muons', 'MET_Reference_AntiKt4LCTopo', 'PrimaryVertices'] #TCAL1SlimmingHelper.AllVariables = ['Muons'] TCAL1ExtarVariables = 'Muons.' + TCAL1Prefix + 'etrkcone40' diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTileCal/src/TrackTools.cxx b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTileCal/src/TrackTools.cxx index bac1ea3c9f08e3f48db8997c464a5161adc87271..e8282bace5f43e7a90b1379114a39d527f00625f 100755 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTileCal/src/TrackTools.cxx +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTileCal/src/TrackTools.cxx @@ -12,6 +12,8 @@ */ #include "TrackTools.h" +#include "CaloIdentifier/TileID.h" + //============================================= TrackTools::TrackTools(const std::string&type, const std::string&name, const IInterface*parent) : AthAlgTool(type, name, parent) @@ -22,6 +24,7 @@ TrackTools::TrackTools(const std::string&type, const std::string&name, const IIn declareInterface(this); declareProperty("ParticleCaloExtensionTool",m_caloExtensionTool ); + declareProperty("IsCollision",m_isCollision); } // TRACKTOOLS::TRACKTOOLS //======================== @@ -32,9 +35,16 @@ TrackTools::~TrackTools(){ //================================== StatusCode TrackTools::initialize(){ //================================= - + ATH_MSG_INFO( "Initializing TrackTools" ); + if (m_isCollision) { + ATH_MSG_INFO( "Beam type = Collision" ); + } + else { + ATH_MSG_INFO( "Beam type = Cosmic" ); + } + ATH_CHECK(m_caloExtensionTool.retrieve()); return StatusCode::SUCCESS; @@ -227,25 +237,64 @@ double TrackTools::getPathInsideCell(const TRACK *track, const CaloCell *cell){ ATH_MSG_DEBUG("in TrackInCaloTools::getPathInsideCell" ); + CHECK( detStore()->retrieve(m_tileID) ); + // GET CELL DESCRIPTOR AND SAMPLING const CaloDetDescrElement* dde = cell->caloDDE(); if(!dde) return 0.; int sampling = dde->getSampling(); int sampling_entrance = 0; int sampling_exit = 0; - switch(sampling){ - case 12: sampling_entrance = 12; sampling_exit = 14; break; - case 13: sampling_entrance = 12; sampling_exit = 14; break; - case 14: sampling_entrance = 12; sampling_exit = 14; break; - case 15: sampling_entrance = 13; sampling_exit = 14; break; - case 16: sampling_entrance = 12; sampling_exit = 13; break; - case 17: sampling_entrance = 17; sampling_exit = 19; break; - case 18: sampling_entrance = 18; sampling_exit = 20; break; - case 19: sampling_entrance = 18; sampling_exit = 20; break; - case 20: sampling_entrance = 18; sampling_exit = 20; break; - default: return 0.; - } // SWITCH + int cell_tower = m_tileID->tower(cell->ID()); + // The type of physics (collision or cosmic) determines the entrance and exit cell for the muons, therefore these different switches are defined accordingly. + if (m_isCollision) { + switch(sampling){ + case 12: + sampling_entrance = 12; + if (cell_tower>=0 && cell_tower<=7) sampling_exit = 14; + else if (cell_tower>=8 && cell_tower<=9) sampling_exit = 20; // for A9 and A10, the exit is D5 + break; + case 13: + sampling_entrance = 12; + if (cell_tower>=0 && cell_tower<=7) sampling_exit = 14; + else if (cell_tower==8) sampling_exit = 20; // for B9, the exit is D5 + break; + case 14: sampling_entrance = 12; sampling_exit = 14; break; + case 15: sampling_entrance = 12; sampling_exit = 20; break; // for C10, the entrance is A10, the exit is D5 + case 16: sampling_entrance = 12; sampling_exit = 13; break; + case 17: sampling_entrance = 17; sampling_exit = 19; break; + case 18: + sampling_entrance = 18; + if (cell_tower>=11 && cell_tower<=14) sampling_exit = 20; + else if (cell_tower==15) sampling_exit = 19; // for A16, the exit is B15 + break; + case 19: + if (cell_tower==10) {sampling_entrance = 19; sampling_exit = 20;} // for B11, the entrance is B11, the exit is D5 + else if (cell_tower>=11 && cell_tower<=13) {sampling_entrance = 18; sampling_exit = 20;} // for B12-B14, the entrance is EBA cells, the exit is EBD cells + else if (cell_tower==14) {sampling_entrance = 18; sampling_exit = 19;} // for B15, the entrance is A15, the exit is B15 + break; + case 20: + if (cell_tower==10) {sampling_entrance = 19; sampling_exit = 20;} // for D5, the entrance is B11, the exit is D5 + else if (cell_tower==12) {sampling_entrance = 18; sampling_exit = 20;} // for D6, the entrance is A13 cells, the exit is D6 + break; + default: return 0.; + } // SWITCH + } + else { + switch(sampling){ + case 12: sampling_entrance = 12; sampling_exit = 14; break; + case 13: sampling_entrance = 12; sampling_exit = 14; break; + case 14: sampling_entrance = 12; sampling_exit = 14; break; + case 15: sampling_entrance = 13; sampling_exit = 14; break; + case 16: sampling_entrance = 12; sampling_exit = 13; break; + case 17: sampling_entrance = 17; sampling_exit = 19; break; + case 18: sampling_entrance = 18; sampling_exit = 20; break; + case 19: sampling_entrance = 18; sampling_exit = 20; break; + case 20: sampling_entrance = 18; sampling_exit = 20; break; + default: return 0.; + } // SWITCH + } const Trk::TrackParameters *pars_entrance = getTrackInCellSampling(track, (CaloSampling::CaloSample)sampling_entrance); const Trk::TrackParameters *pars_exit = getTrackInCellSampling(track, (CaloSampling::CaloSample)sampling_exit); diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTileCal/src/TrackTools.h b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTileCal/src/TrackTools.h index d3b1386ae7fd05f25e41eca3d61cdf57f96ebf16..50aca2c7dc670a356e3548acd0f5671fcd76ed74 100755 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTileCal/src/TrackTools.h +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTileCal/src/TrackTools.h @@ -14,6 +14,7 @@ #define TrackTools_H #include "ITrackTools.h" +class TileID; //========================================================================================================================== class TrackTools: public AthAlgTool, virtual public ITrackTools{ @@ -47,11 +48,15 @@ class TrackTools: public AthAlgTool, virtual public ITrackTools{ // JOBOPTIONS PROPERTIES std::string m_cellContainerName; + bool m_isCollision; double getPath(const CaloCell* cell, const Trk::TrackParameters *entrance, const Trk::TrackParameters *exit); // DEFAULT CONSTRUCTOR TrackTools(const TrackTools&); TrackTools &operator= (const TrackTools&); + + mutable const TileID* m_tileID; + }; #endif //TrackTools_H