Skip to content

Commit

Permalink
Add a function that counts showers per muon + cosmetics
Browse files Browse the repository at this point in the history
  • Loading branch information
Carlo Battilana committed Apr 5, 2019
1 parent 495186e commit 4ad4961
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
2 changes: 2 additions & 0 deletions DataFormats/MuonReco/interface/Muon.h
Expand Up @@ -268,6 +268,8 @@ namespace reco {
/// index 0-1-2-3 = DT stations 1-2-3-4
/// index 4-5-6-7 = CSC stations 1-2-3-4
bool hasShowerInStation( int index, int nDtDigisCut = 20, int nCscDigisCut = 36 ) const;
/// count the number of showers along a muon track
int numberOfShowers( int nDtDigisCut = 20, int nCscDigisCut = 36 ) const;

/// muon type - type of the algorithm that reconstructed this muon
/// multiple algorithms can reconstruct the same muon
Expand Down
20 changes: 16 additions & 4 deletions DataFormats/MuonReco/src/Muon.cc
Expand Up @@ -348,7 +348,7 @@ int Muon::nDigisInStation( int index ) const
int nDigisInCh = match.nDigisInRange;
int iStation = match.detector() == MuonSubdetId::CSC ? index - 3 : index + 1;

if( match.detector() == MuonSubdetId::CSC && iStation == 1)
if( match.detector() == MuonSubdetId::CSC && iStation == 1 )
{
CSCDetId id(match.id.rawId());

Expand All @@ -358,7 +358,7 @@ int Muon::nDigisInStation( int index ) const

if ( station == 1 && (ring == 1 || ring == 4) ) // merge ME1/1a and ME1/1b digis
{
if(me11DigisPerCh.find(chamber) == me11DigisPerCh.end())
if( me11DigisPerCh.find(chamber) == me11DigisPerCh.end() )
me11DigisPerCh[chamber] = 0;

me11DigisPerCh[chamber] += nDigisInCh;
Expand All @@ -367,11 +367,11 @@ int Muon::nDigisInStation( int index ) const
}
}

if( iStation == match.station() && nDigisInCh > nDigis)
if( iStation == match.station() && nDigisInCh > nDigis )
nDigis = nDigisInCh;
}

for (const auto & me11DigisInCh : me11DigisPerCh)
for ( const auto & me11DigisInCh : me11DigisPerCh )
{
int nMe11DigisInCh = me11DigisInCh.second;
if (nMe11DigisInCh > nDigis)
Expand All @@ -389,6 +389,18 @@ bool Muon::hasShowerInStation( int index, int nDtDigisCut, int nCscDigisCut ) co
return hasShower;
}

int Muon::numberOfShowers( int nDtDigisCut, int nCscDigisCut ) const
{
int nShowers = 0;
for ( int iCh = 0; iCh < 8; ++iCh )
{
if ( hasShowerInStation(iCh,nDtDigisCut,nCscDigisCut) )
nShowers++;
}

return nShowers;
}

int Muon::numberOfSegments( int station, int muonSubdetId, ArbitrationType type ) const
{
int segments(0);
Expand Down

0 comments on commit 4ad4961

Please sign in to comment.