Skip to content
Snippets Groups Projects

Dropped unused class MuonPad2MCTool

Merged Sebastien Ponce requested to merge sponce_cleanupMuonPad2MCTool into master
2 files
+ 0
208
Compare changes
  • Side-by-side
  • Inline
Files
2
/*****************************************************************************\
* (c) Copyright 2000-2018 CERN for the benefit of the LHCb Collaboration *
* *
* This software is distributed under the terms of the GNU General Public *
* Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". *
* *
* In applying this licence, CERN does not waive the privileges and immunities *
* granted to it by virtue of its status as an Intergovernmental Organization *
* or submit itself to any jurisdiction. *
\*****************************************************************************/
#include "Detector/Muon/Layout.h"
#include "Event/IntLink.h"
#include "Event/MCMuonDigit.h"
#include "Event/MuonDigit.h"
#include "GaudiAlg/GaudiTool.h"
#include "Linker/LinkedFrom.h"
#include "Linker/LinkedTo.h"
#include "MCInterfaces/IMuonPad2MCTool.h" // Interface
#include "MuonDet/DeMuonDetector.h"
#include "MuonDet/MuonDAQHelper.h"
//-----------------------------------------------------------------------------
// Implementation file for class : MuonPad2MCTool
//
// 2006-12-06 : Alessia Satta
//-----------------------------------------------------------------------------
/** @class MuonPad2MCTool MuonPad2MCTool.h
*
*
* @author Alessia Satta
* @date 2006-12-06
*/
class MuonPad2MCTool : public extends<GaudiTool, IMuonPad2MCTool> {
public:
/// Standard constructor
using extends::extends;
StatusCode initialize() override;
LHCb::MCParticle* Pad2MC( LHCb::Detector::Muon::TileID value ) const override;
bool isXTalk( LHCb::Detector::Muon::TileID value, LHCb::MCParticle*& pp ) const override;
LHCb::MCParticle* PadNoXtalk2MC( LHCb::Detector::Muon::TileID value ) const override;
private:
void XtalkStrip( LHCb::Detector::Muon::TileID tile, LHCb::MCParticle*& pp ) const;
void XtalkPad( LHCb::Detector::Muon::TileID tile, LHCb::MCParticle*& pp ) const;
DeMuonDetector* m_muonDetector = nullptr;
DataObjectReadHandle<LHCb::IntLink> m_links{this, "IntLinkLocation", LHCb::MCMuonDigitLocation::MCMuonDigit + "Info"};
};
// Declaration of the Tool Factory
DECLARE_COMPONENT( MuonPad2MCTool )
using namespace LHCb;
//=============================================================================
StatusCode MuonPad2MCTool::initialize() {
return extends::initialize().andThen(
[&] { m_muonDetector = getDet<DeMuonDetector>( "/dd/Structure/LHCb/DownstreamRegion/Muon" ); } );
}
MCParticle* MuonPad2MCTool::PadNoXtalk2MC( LHCb::Detector::Muon::TileID tile ) const {
MCParticle* pp = nullptr;
MCParticle* pplink = nullptr;
MCParticle* ppfirst = nullptr;
LinkedTo<LHCb::MCParticle, LHCb::MuonDigit> myLink( evtSvc(), msgSvc(), LHCb::MuonDigitLocation::MuonDigit );
if ( myLink.notFound() ) info() << " my link not found " << endmsg;
auto strips = m_muonDetector->getDAQInfo()->findStrips( tile );
if ( !strips ) return pp;
bool first = true;
bool second = false;
if ( strips->first.isValid() ) {
pplink = myLink.first( strips->first );
if ( first ) {
ppfirst = pplink;
first = false;
}
}
if ( strips->second.isValid() ) {
pplink = myLink.first( strips->second );
if ( first ) {
if ( pplink ) return pplink;
ppfirst = pplink;
first = false;
} else {
second = true;
if ( pplink && pplink == ppfirst ) return pplink;
}
}
return ( !second && ppfirst ) ? ppfirst : pp;
}
MCParticle* MuonPad2MCTool::Pad2MC( LHCb::Detector::Muon::TileID tile ) const {
LinkedTo<LHCb::MCParticle, LHCb::MuonDigit> myLink( evtSvc(), msgSvc(), LHCb::MuonDigitLocation::MuonDigit );
if ( myLink.notFound() ) info() << " my link not found " << endmsg;
auto strips = m_muonDetector->getDAQInfo()->findStrips( tile );
if ( !strips ) return nullptr;
MCParticle* pp = nullptr;
if ( strips->first.isValid() ) {
MCParticle* pplink = myLink.first( strips->first );
if ( pplink ) {
if ( pplink->particleID().abspid() == 13 ) return pplink;
}
if ( pplink ) pp = pplink;
}
return pp;
}
bool MuonPad2MCTool::isXTalk( LHCb::Detector::Muon::TileID tile, MCParticle*& pp ) const {
bool xt = false;
if ( tile.station() == 0 ) {
XtalkPad( tile, pp );
if ( pp ) xt = true;
} else if ( tile.station() == 3 && tile.region() == 0 ) {
XtalkPad( tile, pp );
// if(pp!=NULL)info()<<"found a muon "<<pp->particleID().pid()<<endmsg;
if ( pp ) xt = true;
} else if ( tile.station() == 4 && tile.region() == 0 ) {
XtalkPad( tile, pp );
if ( pp ) xt = true;
} else {
XtalkStrip( tile, pp );
if ( pp ) xt = true;
}
return xt;
}
void MuonPad2MCTool::XtalkPad( LHCb::Detector::Muon::TileID tile, MCParticle*& pp ) const {
auto* link = m_links.get();
int stored = link->link( tile );
MCMuonDigitInfo mc;
mc.setDigitInfo( stored );
if ( mc.isXTalkHit() ) {
auto top = tile.neighbourID( 0, 1 );
auto bottom = tile.neighbourID( 0, -1 );
auto left = tile.neighbourID( -1, 0 );
auto right = tile.neighbourID( 1, 0 );
if ( top.isValid() ) pp = Pad2MC( top );
if ( pp && std::abs( pp->particleID().pid() ) == 13 ) return;
if ( bottom.isValid() ) pp = Pad2MC( bottom );
if ( pp && std::abs( pp->particleID().pid() ) == 13 ) return;
if ( left.isValid() ) pp = Pad2MC( left );
if ( pp && std::abs( pp->particleID().pid() ) == 13 ) return;
if ( right.isValid() ) pp = Pad2MC( right );
if ( pp && std::abs( pp->particleID().pid() ) == 13 ) return;
}
}
void MuonPad2MCTool::XtalkStrip( LHCb::Detector::Muon::TileID tile, MCParticle*& pp ) const {
Detector::Muon::Layout layoutone( m_muonDetector->getLayoutX( 0, tile.station(), tile.region() ),
m_muonDetector->getLayoutY( 0, tile.station(), tile.region() ) );
Detector::Muon::Layout layoutdue( m_muonDetector->getLayoutX( 1, tile.station(), tile.region() ),
m_muonDetector->getLayoutY( 1, tile.station(), tile.region() ) );
auto uno = tile.containerID( layoutone );
auto due = tile.containerID( layoutdue );
auto* link = m_links.get();
// info()<<" link found"<<endmsg;
int storedone = link->link( uno );
// info()<<storedone<<endmsg;
MCMuonDigitInfo mcone;
mcone.setDigitInfo( storedone );
if ( mcone.isXTalkHit() ) {
// info()<<" cross talk hits !!!"<<endmsg;
auto top = uno.neighbourID( 0, 1 );
auto bottom = uno.neighbourID( 0, -1 );
auto left = uno.neighbourID( -1, 0 );
auto right = uno.neighbourID( 1, 0 );
if ( top.isValid() ) pp = Pad2MC( top );
if ( pp && std::abs( pp->particleID().pid() ) == 13 ) return;
if ( bottom.isValid() ) pp = Pad2MC( bottom );
if ( pp && std::abs( pp->particleID().pid() ) == 13 ) return;
if ( left.isValid() ) pp = Pad2MC( left );
if ( pp && std::abs( pp->particleID().pid() ) == 13 ) return;
if ( right.isValid() ) pp = Pad2MC( right );
if ( pp && std::abs( pp->particleID().pid() ) == 13 ) return;
}
int storeddue = link->link( due );
MCMuonDigitInfo mcdue;
mcdue.setDigitInfo( storeddue );
if ( mcdue.isXTalkHit() ) {
// info()<<" cross talk hits !!!"<<endmsg;
auto top = due.neighbourID( 0, 1 );
auto bottom = due.neighbourID( 0, -1 );
auto left = due.neighbourID( -1, 0 );
auto right = due.neighbourID( 1, 0 );
if ( top.isValid() ) pp = Pad2MC( top );
if ( pp && std::abs( pp->particleID().pid() ) == 13 ) return;
if ( bottom.isValid() ) pp = Pad2MC( bottom );
if ( pp && std::abs( pp->particleID().pid() ) == 13 ) return;
if ( left.isValid() ) pp = Pad2MC( left );
if ( pp && std::abs( pp->particleID().pid() ) == 13 ) return;
if ( right.isValid() ) pp = Pad2MC( right );
if ( pp && std::abs( pp->particleID().pid() ) == 13 ) return;
}
}
Loading