Commit bc6f45f3 authored by Andrea Merli's avatar Andrea Merli
Browse files

Boole with LumiTracker

parent 22bc8deb
Pipeline #3376776 failed with stage
in 21 seconds
......@@ -103,7 +103,7 @@ StatusCode VPDepositCreator::initialize() {
// Main execution
//=========================================================================
StatusCode VPDepositCreator::execute() {
if(msgLevel(MSG::DEBUG)) debug() << "==> Execute started" << endmsg;
// Pick up the MC hits.
const LHCb::MCHits* hits = getIfExists<LHCb::MCHits>( m_hitLocation );
if ( !hits ) { return Error( "No hits in " + m_hitLocation ); }
......@@ -118,6 +118,7 @@ StatusCode VPDepositCreator::execute() {
// Sort the MC digits by channel ID.
std::stable_sort( m_digits->begin(), m_digits->end(), VPDataFunctor::Less_by_Channel<const LHCb::MCVPDigit*>() );
if(msgLevel(MSG::DEBUG)) debug() << "==> Execute finished" << endmsg;
return StatusCode::SUCCESS;
}
......@@ -125,11 +126,28 @@ StatusCode VPDepositCreator::execute() {
// Create deposits
//============================================================================
void VPDepositCreator::createDeposits( LHCb::MCHit* hit ) {
if(msgLevel(MSG::VERBOSE))
{
const LHCb::MCParticle* mcpart = hit->mcParticle();
if(mcpart && mcpart->mother() && mcpart->mother()->particleID().abspid()==4122)
verbose() << "Create deposits for hit: particle pid = " << mcpart->particleID().pid()
<< ", sensor = " << hit->sensDetID()
<< endmsg;
}
// Calculate the total number of electrons based on the G4 energy deposit.
const double charge = ( hit->energy() / Gaudi::Units::eV ) / m_eVPerElectron;
// Skip very small deposits.
if ( charge < 100. ) return;
if ( charge < 100. ){
if(msgLevel(MSG::VERBOSE))
{
const LHCb::MCParticle* mcpart = hit->mcParticle();
if(mcpart && mcpart->mother() && mcpart->mother()->particleID().abspid()==4122)
verbose() << "charge deposit under 100. electrons, skipped" << endmsg;
}
return;
}
const double path = hit->pathLength();
// Skip very small path lengths.
if ( path < 1.e-6 ) {
......@@ -199,11 +217,32 @@ void VPDepositCreator::createDeposits( LHCb::MCHit* hit ) {
Gaudi::XYZPoint endpoint = point + Gaudi::XYZVector( dx, dy, 0. );
LHCb::VPChannelID channel;
const bool valid = sensor->pointToChannel( endpoint, true, channel );
if(msgLevel(MSG::VERBOSE))
{
const LHCb::MCParticle* mcpart = hit->mcParticle();
if(mcpart && mcpart->mother() && mcpart->mother()->particleID().abspid()==4122)
{
verbose() << "charge q = " << q << ", endpoit = " << endpoint
<< ", channel" << channel << ", valid = " << valid << endmsg;
}
}
if ( valid ) {
if ( pixels.find( channel ) == pixels.end() ) {
pixels[channel] = q;
if(msgLevel(MSG::VERBOSE))
{
const LHCb::MCParticle* mcpart = hit->mcParticle();
if(mcpart && mcpart->mother() && mcpart->mother()->particleID().abspid()==4122)
verbose() << "Created charge " << q << " in channel " << channel << endmsg;
}
} else {
pixels[channel] += q;
if(msgLevel(MSG::VERBOSE))
{
const LHCb::MCParticle* mcpart = hit->mcParticle();
if(mcpart && mcpart->mother() && mcpart->mother()->particleID().abspid()==4122)
verbose() << "Added charge " << q << " to channel " << channel << endmsg;
}
}
}
if ( m_monitoring ) {
......@@ -225,10 +264,32 @@ void VPDepositCreator::createDeposits( LHCb::MCHit* hit ) {
if ( digit ) {
// MC digit already exists.
digit->addToMcHits( hit, charge );
if(msgLevel(MSG::VERBOSE))
{
const LHCb::MCParticle* mcpart = hit->mcParticle();
if(mcpart && mcpart->mother() && mcpart->mother()->particleID().abspid()==4122)
{
verbose() << "Added hit to MCVPDigit: pid Lc daughter = " << mcpart->particleID().pid()
<< ", sensor = " << id.sensor()
<< ", charge = " << charge << endmsg;
}
}
} else {
digit = new LHCb::MCVPDigit();
digit->addToMcHits( hit, charge );
m_digits->insert( digit, id );
if(msgLevel(MSG::VERBOSE))
{
const LHCb::MCParticle* mcpart = hit->mcParticle();
if(mcpart && mcpart->mother() && mcpart->mother()->particleID().abspid()==4122)
{
verbose() << "Created MCVPDigit: pid Lc daughter = " << mcpart->particleID().pid()
<< ", sensor = " << id.sensor()
<< ", charge = " << charge << endmsg;
}
}
}
}
}
......
......@@ -92,7 +92,8 @@ StatusCode VPDigitCreator::initialize() {
// Main execution
//=============================================================================
StatusCode VPDigitCreator::execute() {
if(msgLevel(MSG::DEBUG)) debug() << "==> Execute started" << endmsg;
if ( m_deadTime ) {
// Update the list of currently inactive pixels.
for ( auto it = m_deadPixels.begin(); it != m_deadPixels.end(); ++it ) {
......@@ -156,5 +157,6 @@ StatusCode VPDigitCreator::execute() {
// Sort the digits by channel ID.
std::stable_sort( digits->begin(), digits->end(), VPDataFunctor::Less_by_Channel<const LHCb::VPDigit*>() );
if(msgLevel(MSG::DEBUG)) debug() << "==> Execute finished" << endmsg;
return StatusCode::SUCCESS;
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment