Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

MuonSelectionTool Class Reference

#include <MuonSelectionTool.h>

Inheritance diagram for MuonSelectionTool:

[legend]
Collaboration diagram for MuonSelectionTool:
[legend]
List of all members.

Public Types

typedef std::vector< double > ValueList
typedef std::vector< const
Analysis::Muon * > 
MuonList
typedef SelectedMuonList::size_type Index
typedef std::vector< IndexIndexList

Public Member Functions

 MuonSelectionTool (std::string, std::string, const IInterface *)
 ~MuonSelectionTool ()
StatusCode initialize ()
bool ignore_requested (MuonRejectionCode irej) const
MuonRejectionCode check_ignore (MuonRejectionCode code, bool allow_ignore) const
void log (std::string msg, MSG::Level level=MSG::WARNING) const
SelectedMuonselectedMuon (const Analysis::Muon &mu, MuonRejectionCode *prej) const
SelectedMuonselectedMuon (const CombinedMuon &mu, MuonRejectionCode *prej) const
SelectedMuonselectedMuon (const Rec::TrackParticle &mu, MuonRejectionCode *prej) const
MuonTrackType trackType (const Analysis::Muon &mu, MuonRejectionCode *prej) const
MuonTrackType trackType (const CombinedMuon &mu, MuonRejectionCode *prej) const
MuonTrackType trackType (const Rec::TrackParticle &trk, MuonRejectionCode *prej) const
MuonRejectionCode check (const SelectedMuon &mu, SelectedMuon *&newsmu) const
MuonRejectionCode check (const SelectedMuon &mu) const
MuonRejectionCode check (const Analysis::Muon &mu, SelectedMuon *&psmu) const
MuonRejectionCode check (const Analysis::Muon &mu) const
MuonRejectionCode check (const CombinedMuon &mu, SelectedMuon *&psmu) const
MuonRejectionCode check (const CombinedMuon &mu) const
MuonRejectionCode check (const Rec::TrackParticle &trk, SelectedMuon *&psmu) const
MuonRejectionCode check (const Rec::TrackParticle &trk) const
MuonRejectionCode checkTrackParameters (const Rec::TrackParticle &trk) const
MuonRejectionCode checkFitQuality (const Trk::FitQuality &fq) const
MuonRejectionCode checkTrackSummary (const Trk::TrackSummary &fq) const
int checkOverlap (const SelectedMuonList &in, MuonRejectionList &rejs, IndexList *poverlaps) const
int select (const SelectedMuonList &in, SelectedMuonList &out, MuonRejectionList &prej) const
int select (const Analysis::MuonContainer &in, SelectedMuonList &out, MuonRejectionList &prej) const
int select (const Analysis::MuonContainer &in, SelectedMuonList &out) const
int select (const CombinedMuonContainer &in, SelectedMuonList &out, MuonRejectionList &prej) const
int select (const CombinedMuonContainer &in, SelectedMuonList &out) const
int select (const Rec::TrackParticleContainer &in, SelectedMuonList &out, MuonRejectionList &rejs) const
int select (const Rec::TrackParticleContainer &in, SelectedMuonList &out) const
void dump (const SelectedMuon &smu) const

Static Public Member Functions

const InterfaceID & interfaceID ()

Private Member Functions

template<class T, class C>
int gselect (const C &in, SelectedMuonList &out, MuonRejectionList &prej) const

Private Attributes

std::string m_label
int m_track_pattern
double m_z0
double m_pt
double m_fit_chi2dof
double m_combined_fit_chi2dof
double m_combined_outer_chi2dof
double m_combined_outer_chi2dof_pt_power
double m_combined_outer_chi2dof_pt_logfac
double m_combined_match_chi2
double m_combined_match_chi2_pt_power
double m_combined_match_chi2_pt_logfac
std::string m_isol_cone_string
double m_isol_energy
double m_isol_match_chi2
double m_isol_fit_chi2dof
int m_total_digit_count
int m_precision_digit_count
int m_phi_digit_count
bool m_overlap_filter
bool m_overlap_track
double m_overlap_dr
std::string m_realm_name
bool m_SpectrometerOverridesExtrapolatedSummary
bool m_CombinedMergeSummary
int m_CombinedFitQuality
std::vector< int > m_norejs_int
MuonRejectionList m_norejs
MuonParameters::ParamDef m_isol_cone
MuonTrackSelector m_tsel
MuonSource::Realm m_realm
MsgStream * m_plog
IToolSvc * m_ptools
TrackIsolationTool * m_pisolTool
int m_dumped
int m_dump_count
ValueList m_dump_coneEts
ValueList m_dump_coneCts
ValueList m_dump_conePts
ValueList m_dump_coneNts

Member Typedef Documentation

typedef std::vector<double> MuonSelectionTool::ValueList
 

Definition at line 24 of file MuonSelectionTool.h.

typedef std::vector<const Analysis::Muon*> IMuonSelectionTool::MuonList [inherited]
 

Definition at line 38 of file IMuonSelectionTool.h.

typedef SelectedMuonList::size_type IMuonSelectionTool::Index [inherited]
 

Definition at line 39 of file IMuonSelectionTool.h.

typedef std::vector<Index> IMuonSelectionTool::IndexList [inherited]
 

Definition at line 40 of file IMuonSelectionTool.h.


Constructor & Destructor Documentation

MuonSelectionTool::MuonSelectionTool std::string  ,
std::string  ,
const IInterface * 
 

Definition at line 63 of file MuonSelectionTool.cxx.

00064 : AlgTool(type, aname, parent), m_realm(MuonSource::UndefinedRealm),
00065   m_plog(0), m_pisolTool(0), m_dumped(0) {
00066 
00067   // Declare interface.
00068   declareInterface<IMuonSelectionTool>(this);
00069 
00070   // Selection job options.
00071   declareProperty("Label",               m_label = "");
00072   declareProperty("TrackPattern",        m_track_pattern = 0);
00073   declareProperty("Pt",                  m_pt = 2000.0);
00074   declareProperty("Z0",                  m_z0 = 500.0);
00075   declareProperty("FitChi2dof",          m_fit_chi2dof = 100.0);
00076   declareProperty("CombinedFitChi2dof",  m_combined_fit_chi2dof = 100.0);
00077   declareProperty("CombinedOuterChi2dof", 
00078                   m_combined_outer_chi2dof = 100.0);
00079   declareProperty("CombinedOuterChi2dofPtPower",
00080                   m_combined_outer_chi2dof_pt_power = 0.0);
00081   declareProperty("CombinedOuterChi2dofPtLogfac",
00082                   m_combined_outer_chi2dof_pt_logfac= 0.0);
00083   declareProperty("CombinedMatchChi2",
00084                   m_combined_match_chi2 = 100.0);
00085   declareProperty("CombinedMatchChi2PtPower",
00086                   m_combined_match_chi2_pt_power = 0.0);
00087   declareProperty("CombinedMatchChi2PtLogfac",
00088                   m_combined_match_chi2_pt_logfac= 0.0);
00089   declareProperty("IsolationCone",       m_isol_cone_string = "etcone");
00090   declareProperty("IsolationEnergy",     m_isol_energy = 9999999999.0);
00091   declareProperty("IsolationFitChi2dof", m_isol_fit_chi2dof = 100.0);
00092   declareProperty("IsolationMatchChi2",  m_isol_match_chi2 = 100.0);
00093   declareProperty("TotalDigitCount",     m_total_digit_count = 0);
00094   declareProperty("PrecisionDigitCount", m_precision_digit_count = 0);
00095   declareProperty("PhiDigitCount",       m_phi_digit_count = 0);
00096   declareProperty("OverlapFilter",       m_overlap_filter = false);
00097   declareProperty("OverlapTrack",        m_overlap_track = false);
00098   declareProperty("OverlapDr",           m_overlap_dr = 0.0);
00099   declareProperty("RejectionOverrides",  m_norejs_int);
00100 
00101   // View job options.
00102   declareProperty("Realm", m_realm_name ="");
00103   declareProperty("SpectrometerOverridesExtrapolatedSummary", 
00104                   m_SpectrometerOverridesExtrapolatedSummary = false);
00105   declareProperty("CombinedMergeSummary", 
00106                   m_CombinedMergeSummary = false);
00107   declareProperty("CombinedFitQuality", 
00108                   m_CombinedFitQuality = 0);
00109 
00110   // Debug job options.
00111   declareProperty("DumpCount", m_dump_count =0);
00112   declareProperty("DumpConeEt", m_dump_coneEts);
00113   declareProperty("DumpConeCt", m_dump_coneCts);
00114   declareProperty("DumpConePt", m_dump_conePts);
00115   declareProperty("DumpConeNt", m_dump_coneNts);
00116 }

MuonSelectionTool::~MuonSelectionTool  ) 
 

Definition at line 120 of file MuonSelectionTool.cxx.

00120                                       {
00121 }


Member Function Documentation

StatusCode MuonSelectionTool::initialize  ) 
 

Definition at line 125 of file MuonSelectionTool.cxx.

00125                                          {
00126 
00127   // Initialize message log.
00128   // Here instead of ctor to pick up level from job options.
00129   m_plog = new MsgStream(msgSvc(), name());
00130 
00131   // Initialize services:
00132   MsgStream mlog = *m_plog;
00133   mlog << MSG::INFO << "Initializing " << name() << endreq;
00134 
00135   // Interpret job options.
00136   //...isolation cone
00137   m_isol_cone = MuonParameters::etcone;
00138   if ( m_isol_cone_string == "" ) m_isol_cone = MuonParameters::etcone;
00139   else if ( m_isol_cone_string == "etcone" ) m_isol_cone = MuonParameters::etcone;
00140   else if ( m_isol_cone_string == "etcone10" ) m_isol_cone = MuonParameters::etcone10;
00141   else if ( m_isol_cone_string == "etcone20" ) m_isol_cone = MuonParameters::etcone20;
00142   else if ( m_isol_cone_string == "etcone30" ) m_isol_cone = MuonParameters::etcone30;
00143   else if ( m_isol_cone_string == "etcone40" ) m_isol_cone = MuonParameters::etcone40;
00144   else if ( m_isol_cone_string == "etcone50" ) m_isol_cone = MuonParameters::etcone50;
00145   else if ( m_isol_cone_string == "etcone60" ) m_isol_cone = MuonParameters::etcone60;
00146   else if ( m_isol_cone_string == "etcone70" ) m_isol_cone = MuonParameters::etcone70;
00147   else {
00148     mlog << MSG::WARNING << "Invalid value for IsolationCone: ("
00149          << m_isol_cone_string << ") reset to etcone" << endreq;
00150   }
00151   //...overridden rejection codes.
00152   for ( vector<int>::const_iterator irej=m_norejs_int.begin();
00153         irej!=m_norejs_int.end(); ++irej ) {
00154     MuonRejectionCode icode(muon_rejection_code(*irej));
00155     m_norejs.push_back(icode);
00156   }
00157 
00158   // Display muon cuts.
00159   mlog << MSG::INFO << "  Muon selection cuts" << endreq;
00160   mlog << MSG::INFO << "    Label: " << m_label << endreq;
00161   mlog << MSG::INFO << "       track selection pattern: " << m_track_pattern << endreq;
00162   mlog << MSG::INFO << "                  min pT (MeV): " << m_pt << endreq;
00163   mlog << MSG::INFO << "       max |z0| + 3*sigma (mm): " << m_z0 << endreq;
00164   mlog << MSG::INFO << "              max fit chi2/DOF: " << m_fit_chi2dof << endreq;
00165   mlog << MSG::INFO << "    combined total chi2dof max: " << m_combined_fit_chi2dof << endreq;
00166   mlog << MSG::INFO << "    combined outer chi2dof max: "
00167                     << m_combined_outer_chi2dof << endreq;
00168   mlog << MSG::INFO << "  combined outer chi2-pt power: "
00169                     << m_combined_outer_chi2dof_pt_power << endreq;
00170   mlog << MSG::INFO << " combined outer chi2-pt logfac: "
00171                     << m_combined_outer_chi2dof_pt_logfac << endreq;
00172   mlog << MSG::INFO << "       combined match chi2 max: "
00173                     << m_combined_match_chi2 << endreq;
00174   mlog << MSG::INFO << "  combined match chi2-pt power: "
00175                     << m_combined_match_chi2_pt_power << endreq;
00176   mlog << MSG::INFO << " combined match chi2-pt logfac: "
00177                     << m_combined_match_chi2_pt_logfac << endreq;
00178   mlog << MSG::INFO << "                isolation cone: " << m_isol_cone_string << endreq;
00179   mlog << MSG::INFO << "          isolation max energy: " << m_isol_energy << endreq;
00180   mlog << MSG::INFO << "    isolation max fit chi2/DOF: " << m_isol_fit_chi2dof << endreq;
00181   mlog << MSG::INFO << "      isolation max match chi2: " << m_isol_match_chi2 << endreq;
00182   mlog << MSG::INFO << "                  min # digits: " << m_total_digit_count << endreq;
00183   mlog << MSG::INFO << "        min # precision digits: " << m_precision_digit_count << endreq;
00184   mlog << MSG::INFO << "              min # phi digits: " << m_phi_digit_count << endreq;
00185   mlog << MSG::INFO << "               filter overlaps: " << stf(m_overlap_filter) << endreq;
00186   mlog << MSG::INFO << "       shared track is overlap: " << stf(m_overlap_track) << endreq;
00187   mlog << MSG::INFO << "                    overlap dR: " << m_overlap_dr << endreq;
00188   unsigned int nov = m_norejs.size();
00189   if ( nov ) {
00190     mlog << MSG::INFO << "           Rejection overrides:" << endreq;
00191     for ( MuonRejectionList::const_iterator irej=m_norejs.begin();
00192           irej!=m_norejs.end(); ++ irej ) {
00193       mlog << MSG::INFO << "             " << *irej << " ("
00194            << title(*irej) << ")" << endreq;
00195     }
00196   } else {
00197     mlog << MSG::INFO << "        No rejection overrides." << endreq;
00198   }
00199   mlog << MSG::INFO << "  Muon selection view:" << endreq;
00200   mlog << MSG::INFO << "                                  Realm name: "
00201        << m_realm_name << endreq;
00202   mlog << MSG::INFO << "    SpectrometerOverridesExtrapolatedSummary: "
00203        << stf(m_SpectrometerOverridesExtrapolatedSummary) << endreq;
00204   mlog << MSG::INFO << "                        CombinedMergeSummary: "
00205        << stf(m_CombinedMergeSummary) << endreq;
00206   mlog << MSG::INFO << "                          CombinedFitQuality: "
00207        << m_CombinedFitQuality << endreq;
00208   mlog << MSG::INFO << "  Muon selection debugging:." << endreq;
00209   mlog << MSG::INFO << "    Maximum # muons to dump: " << m_dump_count << endreq;
00210   mlog << MSG::INFO << "              ET Cone radii: ";
00211   for ( unsigned int ival=0; ival<m_dump_coneEts.size(); ++ival ) {
00212     mlog << " " << m_dump_coneEts[ival];
00213   }
00214   mlog << endreq;
00215   mlog << MSG::INFO << "              CT Cone radii: ";
00216   for ( unsigned int ival=0; ival<m_dump_coneCts.size(); ++ival ) {
00217     mlog << " " << m_dump_coneCts[ival];
00218   }
00219   mlog << endreq;
00220   mlog << MSG::INFO << "              PT Cone radii: ";
00221   for ( unsigned int ival=0; ival<m_dump_conePts.size(); ++ival ) {
00222     mlog << " " << m_dump_conePts[ival];
00223   }
00224   mlog << endreq;
00225   mlog << MSG::INFO << "              NT Cone radii: ";
00226   for ( unsigned int ival=0; ival<m_dump_coneNts.size(); ++ival ) {
00227     mlog << " " << m_dump_coneNts[ival];
00228   }
00229   mlog << endreq;
00230 
00231   // Check options.
00232   if ( m_track_pattern == 0 ) {
00233     mlog << MSG::ERROR << "Invalid track pattern: " << m_track_pattern
00234          << endreq;
00235     return StatusCode::FAILURE;
00236   }
00237 
00238   // Initialize the track selector.
00239   m_tsel.set_log(m_plog);
00240   m_tsel.set_pattern(m_track_pattern);
00241   m_tsel.set_max_fit_chi2dof(m_combined_fit_chi2dof);
00242   m_tsel.set_max_outer_chi2dof(m_combined_outer_chi2dof);
00243   m_tsel.set_max_outer_chi2dof_pt_power(m_combined_match_chi2_pt_power);
00244   m_tsel.set_max_outer_chi2dof_pt_logfac(m_combined_outer_chi2dof_pt_logfac);
00245   m_tsel.set_max_match_chi2(m_combined_match_chi2);
00246   m_tsel.set_max_match_chi2_pt_power(m_combined_match_chi2_pt_power);
00247   m_tsel.set_max_match_chi2_pt_logfac(m_combined_match_chi2_pt_logfac);
00248 
00249   // Create realm.
00250   m_realm = MuonSource::realm(m_realm_name);
00251   if ( m_realm == MuonSource::UndefinedRealm && m_realm_name.size() ) {
00252     mlog << MSG::ERROR << "  Invalid realm: " << m_realm_name << endreq;
00253   }
00254 
00255   // Find the tool service.
00256   StatusCode sc;
00257   sc = service("ToolSvc", m_ptools);
00258   if ( sc.isFailure() || m_ptools == 0 ) {
00259      mlog << MSG::ERROR << "Unable to retrieve tool service"
00260            << endreq;
00261   }
00262 
00263   // Retrieve the track isolation tool.
00264   if ( m_ptools ) {
00265     IAlgTool* ptool;
00266     sc = m_ptools->retrieveTool("TrackIsolationTool", ptool);
00267     if ( sc.isFailure() || ptool == 0 ) {
00268        mlog << MSG::ERROR << "Unable to retrieve track isolation tool: "
00269             << endreq;
00270     } else {
00271       m_pisolTool = dynamic_cast<TrackIsolationTool*>(ptool);
00272       if ( ! m_pisolTool ) {
00273         mlog << MSG::ERROR << "Unable to cast track isolation tool: "
00274              << endreq;
00275       }
00276     }
00277   }
00278 
00279   mlog << MSG::INFO << "Initialization completed." << endreq;
00280   return StatusCode::SUCCESS;
00281 }

bool MuonSelectionTool::ignore_requested MuonRejectionCode  irej  )  const
 

Definition at line 285 of file MuonSelectionTool.cxx.

00285                                                                      {
00286   return find(m_norejs.begin(), m_norejs.end(), code)
00287          != m_norejs.end();
00288 }

MuonRejectionCode MuonSelectionTool::check_ignore MuonRejectionCode  code,
bool  allow_ignore
const
 

Definition at line 293 of file MuonSelectionTool.cxx.

00293                                                               {
00294   // Ignore is not requested.
00295   if ( ! ignore_requested(code) ) {
00296     if ( m_plog ) {
00297       *m_plog << MSG::VERBOSE
00298               << "Applying rejection "
00299               << code << " (" << title(code) << ")" << endreq;
00300   }
00301     return code;
00302   }
00303   // Ignore is requested but not not allowed.
00304   if ( ! allow_ignore ) {
00305     if ( m_plog ) {
00306       *m_plog << MSG::WARNING
00307               << "Disallowing request to ignore rejection code "
00308               << code << " (" << title(code) << ")" << endreq;
00309     }
00310     return code;
00311   }
00312   // Ignore is requested and allowed.
00313   if ( m_plog ) {
00314     *m_plog << MSG::DEBUG
00315             << "Ignoring rejection code "
00316             << code << " (" << title(code) << ")" << endreq;
00317   }
00318   return MuonReject::ACCEPT;
00319 }

void MuonSelectionTool::log std::string  msg,
MSG::Level  level = MSG::WARNING
const
 

Definition at line 323 of file MuonSelectionTool.cxx.

00323                                                                {
00324   if ( ! m_plog ) return;
00325   *m_plog << level << msg << endreq;
00326 }

SelectedMuon * MuonSelectionTool::selectedMuon const Analysis::Muon &  mu,
MuonRejectionCode prej
const [virtual]
 

Implements IMuonSelectionTool.

Definition at line 359 of file MuonSelectionTool.cxx.

00359                                                                      {
00360   MuonTrackType ttype = trackType(amu, prej);
00361   if ( ttype == MuonTrack::UNDEFINED ) return 0;
00362   *m_plog << MSG::VERBOSE
00363           << "Constructing selected muon from AOD muon" << endreq;
00364   SelectedMuon* psmu = new SelectedMuon(&amu, ttype, m_realm);
00365   psmu->setSpectrometerOverridesExtrapolatedSummary(
00366          m_SpectrometerOverridesExtrapolatedSummary);
00367   psmu->setCombinedMergeSummary(m_CombinedMergeSummary);
00368   psmu->setCombinedFitQuality(m_CombinedFitQuality);
00369   psmu->setIsolationTool(m_pisolTool);
00370   dump(*psmu);
00371   return psmu;
00372 }

SelectedMuon * MuonSelectionTool::selectedMuon const CombinedMuon &  mu,
MuonRejectionCode prej
const [virtual]
 

Implements IMuonSelectionTool.

Definition at line 378 of file MuonSelectionTool.cxx.

00378                                                                      {
00379   MuonTrackType ttype = trackType(amu, prej);
00380   if ( ttype == MuonTrack::UNDEFINED ) return 0;
00381   *m_plog << MSG::VERBOSE
00382           << "Constructing selected muon from ESD muon" << endreq;
00383   SelectedMuon* psmu = new SelectedMuon(&amu, ttype, m_realm);
00384   psmu->setSpectrometerOverridesExtrapolatedSummary(
00385          m_SpectrometerOverridesExtrapolatedSummary);
00386   psmu->setCombinedMergeSummary(m_CombinedMergeSummary);
00387   psmu->setCombinedFitQuality(m_CombinedFitQuality);
00388   psmu->setIsolationTool(m_pisolTool);
00389   dump(*psmu);
00390   return psmu;
00391 }

SelectedMuon * MuonSelectionTool::selectedMuon const Rec::TrackParticle &  mu,
MuonRejectionCode prej
const [virtual]
 

Implements IMuonSelectionTool.

Definition at line 397 of file MuonSelectionTool.cxx.

00397                                                                          {
00398   MuonTrackType ttype = trackType(trk, prej);
00399   if ( ttype == MuonTrack::UNDEFINED ) return 0;
00400   *m_plog << MSG::VERBOSE
00401           << "Constructing selected muon from AOD track" << endreq;
00402   SelectedMuon* psmu = new SelectedMuon(&trk, ttype, m_realm);
00403   psmu->setIsolationTool(m_pisolTool);
00404   dump(*psmu);
00405   return psmu;
00406 }

MuonTrackType MuonSelectionTool::trackType const Analysis::Muon &  mu,
MuonRejectionCode prej
const [virtual]
 

Implements IMuonSelectionTool.

Definition at line 331 of file MuonSelectionTool.cxx.

00331                                                                   {
00332   // Use the track selector to determine the track type.
00333   return m_tsel.track_type(amu, prej);
00334 }

MuonTrackType MuonSelectionTool::trackType const CombinedMuon &  mu,
MuonRejectionCode prej
const [virtual]
 

Implements IMuonSelectionTool.

Definition at line 340 of file MuonSelectionTool.cxx.

00340                                                                   {
00341   // Use the track selector to determine the track type.
00342   return m_tsel.track_type(amu, prej);
00343 }

MuonTrackType MuonSelectionTool::trackType const Rec::TrackParticle &  trk,
MuonRejectionCode prej
const [virtual]
 

Implements IMuonSelectionTool.

Definition at line 349 of file MuonSelectionTool.cxx.

00349                                                                       {
00350   // Use the track selector to determine the track type.
00351   return m_tsel.track_type(trk, prej);
00352 }

MuonRejectionCode MuonSelectionTool::check const SelectedMuon mu,
SelectedMuon *&  newsmu
const [virtual]
 

Implements IMuonSelectionTool.

Definition at line 413 of file MuonSelectionTool.cxx.

00413                                                             {
00414   newsmu = new SelectedMuon(smu);
00415   return check(*newsmu);
00416 }

MuonRejectionCode MuonSelectionTool::check const SelectedMuon mu  )  const [virtual]
 

Implements IMuonSelectionTool.

Definition at line 419 of file MuonSelectionTool.cxx.

00419                                      {
00420   MuonRejectionCode rej = MuonReject::ACCEPT;
00421 
00422   // Check the AOD track (track particle).
00423   const Rec::TrackParticle* patr = smu.aodTrack();
00424   if ( patr == 0 ) {
00425     rej = check_ignore(MuonReject::SELECTED_AOD_NULL, false);
00426   } else {
00427     rej = checkTrackParameters(*patr);
00428   }
00429   if ( rej ) return rej;
00430 
00431   // Check the fit quality.
00432   const Trk::FitQuality* pfq = smu.fitQuality();
00433   if ( pfq == 0 ) {
00434     rej = check_ignore(MuonReject::FIT_QUALITY_NULL, true);
00435     *m_plog << MSG::WARNING << "check(smu): Reject muon with null fit quality:" << endreq;
00436     *m_plog << MSG::WARNING << smu << endreq;
00437   } else {
00438     rej = checkFitQuality(*pfq);
00439   }
00440   if ( rej ) return rej;
00441 
00442   // Check the digit counts.
00443   const Trk::TrackSummary* pts = smu.trackSummary();
00444   if ( pts == 0 ) {
00445     rej = check_ignore(MuonReject::TRACK_SUMMARY_NULL, true);
00446   } else {
00447     rej = checkTrackSummary(*pts);
00448   }
00449   if ( rej ) return rej;
00450 
00451   // Check the AOD muon if it exists.
00452   if ( smu.aodMuon() || smu.esdMuon() ) {
00453     // Isolation cut.
00454     // If not isolated, muon must be combined and have fit chi-square/DOF
00455     // and match chi-square below isolation limits.
00456     if ( smu.parameter(m_isol_cone) > m_isol_energy ) {
00457       //...not combined
00458       if ( smu.trackType() !=  MuonTrack::COMBINED ) {
00459         rej = check_ignore(MuonReject::ISOL_TRACK_TYPE_BAD, true);
00460       }
00461       if ( rej ) return rej;
00462       if ( pfq ) { 
00463         int dof = pfq->numberDoF();
00464         //...DOF
00465         if ( dof <= 0 ) {
00466           rej = check_ignore(MuonReject::ISOL_DOF_ZERO, true);
00467         } else {
00468           //...chi2/DOF
00469           double chsq = pfq->chiSquared();
00470           double chdof = chsq/dof;
00471           if ( chdof > m_isol_fit_chi2dof ) {
00472             rej = check_ignore(MuonReject::ISOL_FIT_CHI2DOF_HIGH, true);
00473           }
00474         }
00475         if ( rej ) return rej;
00476       } else {
00477         log("Skipping checks because fit quality is missing");
00478       }
00479       if ( smu.matchChiSquare() > m_isol_match_chi2 ) {
00480         rej = check_ignore(MuonReject::ISOL_MATCH_CHI2_HIGH, true);
00481       }
00482       if ( rej ) return rej;
00483     }
00484   } else {
00485     log("Skipping checks because AOD and ESD muons are missing");
00486   }
00487 
00488   return MuonReject::ACCEPT;
00489 }

MuonRejectionCode MuonSelectionTool::check const Analysis::Muon &  mu,
SelectedMuon *&  psmu
const [virtual]
 

Implements IMuonSelectionTool.

Definition at line 494 of file MuonSelectionTool.cxx.

00494                                                           {
00495   MuonRejectionCode rej = MuonReject::INVALID;
00496   psmu = selectedMuon(amu, &rej);
00497   if ( psmu == 0 ) {
00498     if ( !rej ) rej = MuonReject::TRACK_NOT_FOUND;
00499     return check_ignore(rej, false);
00500   }
00501   rej = check(*psmu);
00502   if ( rej != MuonReject::ACCEPT ) {
00503     delete psmu;
00504     psmu = 0;
00505     return rej;
00506   }
00507   return MuonReject::ACCEPT;
00508 }

MuonRejectionCode MuonSelectionTool::check const Analysis::Muon &  mu  )  const [virtual]
 

Implements IMuonSelectionTool.

Definition at line 513 of file MuonSelectionTool.cxx.

00513                                      {
00514   SelectedMuon* psmu = 0;
00515   MuonRejectionCode rej = check(amu, psmu);
00516   delete psmu;
00517   return rej;
00518 }

MuonRejectionCode MuonSelectionTool::check const CombinedMuon &  mu,
SelectedMuon *&  psmu
const [virtual]
 

Implements IMuonSelectionTool.

Definition at line 524 of file MuonSelectionTool.cxx.

00524                                                           {
00525   MuonRejectionCode rej = MuonReject::INVALID;
00526   psmu = selectedMuon(amu, &rej);
00527   if ( psmu == 0 )  {
00528     if ( !rej ) rej = MuonReject::TRACK_NOT_FOUND;
00529     return check_ignore(rej, false);
00530   }
00531   rej = check(*psmu);
00532   if ( rej != MuonReject::ACCEPT ) {
00533     delete psmu;
00534     psmu = 0;
00535     return rej;
00536   }
00537   return MuonReject::ACCEPT;
00538 }

MuonRejectionCode MuonSelectionTool::check const CombinedMuon &  mu  )  const [virtual]
 

Implements IMuonSelectionTool.

Definition at line 545 of file MuonSelectionTool.cxx.

00545                                      {
00546   SelectedMuon* psmu = 0;
00547   MuonRejectionCode rej = check(amu, psmu);
00548   delete psmu;
00549   return rej;
00550 }

MuonRejectionCode MuonSelectionTool::check const Rec::TrackParticle &  trk,
SelectedMuon *&  psmu
const [virtual]
 

Implements IMuonSelectionTool.

Definition at line 556 of file MuonSelectionTool.cxx.

00556                                                            {
00557   MuonRejectionCode rej = MuonReject::INVALID;
00558   psmu = selectedMuon(trk, &rej);
00559   if ( psmu == 0 ) {
00560     if ( !rej ) rej = MuonReject::TRACK_NOT_FOUND;
00561     return check_ignore(rej, false);
00562   }
00563   rej = check(*psmu);
00564   if ( rej != MuonReject::ACCEPT ) {
00565     delete psmu;
00566     psmu = 0;
00567     return rej;
00568   }
00569   return MuonReject::ACCEPT;
00570 }

MuonRejectionCode MuonSelectionTool::check const Rec::TrackParticle &  trk  )  const [virtual]
 

Implements IMuonSelectionTool.

Definition at line 575 of file MuonSelectionTool.cxx.

00575                                       {
00576   SelectedMuon* psmu = 0;
00577   MuonRejectionCode rej = check(trk, psmu);
00578   delete psmu;
00579   return rej;
00580 }

MuonRejectionCode MuonSelectionTool::checkTrackParameters const Rec::TrackParticle &  trk  )  const [virtual]
 

Implements IMuonSelectionTool.

Definition at line 587 of file MuonSelectionTool.cxx.

00587                                                         {
00588   MuonRejectionCode rej = MuonReject::ACCEPT;
00589   // Check z0.
00590   const Trk::MeasuredPerigee* pper = trk.measuredPerigee();
00591   const Trk::ErrorMatrix& err = pper->localErrorMatrix();
00592   double z0 = pper->parameters()[Trk::z0];
00593   double dz0 = sqrt(err.covValue(Trk::z0));
00594   if ( std::abs(z0) - 3.0*dz0 > m_z0 ) {
00595     rej = check_ignore(MuonReject::Z0_HIGH, true);
00596   }
00597   if ( rej ) return rej;
00598   // Check pt.
00599   if ( trk.pt() < m_pt ) {
00600     rej = check_ignore(MuonReject::PT_LOW, true);
00601   }
00602   return rej;
00603 }

MuonRejectionCode MuonSelectionTool::checkFitQuality const Trk::FitQuality &  fq  )  const [virtual]
 

Implements IMuonSelectionTool.

Definition at line 608 of file MuonSelectionTool.cxx.

00608                                                {
00609   MuonRejectionCode rej = MuonReject::ACCEPT;
00610   if ( m_fit_chi2dof <= 0.0 ) return MuonReject::ACCEPT;
00611   // DOF
00612   int dof = fq.numberDoF();
00613   if ( dof <= 0 ) {
00614     rej = check_ignore(MuonReject::DOF_ZERO, true);
00615   } else {
00616     // chi2/DOF
00617     double chsq = fq.chiSquared();
00618     double chdof = chsq/dof;
00619     if ( chdof > m_fit_chi2dof ) {
00620       rej = check_ignore(MuonReject::FIT_CHI2DOF_HIGH, true);
00621     }
00622   }
00623   return rej;
00624 }

MuonRejectionCode MuonSelectionTool::checkTrackSummary const Trk::TrackSummary &  fq  )  const [virtual]
 

Implements IMuonSelectionTool.

Definition at line 629 of file MuonSelectionTool.cxx.

00629                                                    {
00630   MuonRejectionCode rej = MuonReject::ACCEPT;
00631   int ntot = TrackSummaryHelper::muon_hit_count(ts);
00632   int nprec = TrackSummaryHelper::muon_precision_hit_count(ts);
00633   int nphi = TrackSummaryHelper::muon_phi_hit_count(ts);
00634   if ( ntot < m_total_digit_count ) {
00635     rej = check_ignore(MuonReject::TOTAL_DIGIT_COUNT_LOW, true);
00636   }
00637   if ( rej ) return rej;
00638   if ( nprec < m_precision_digit_count ) {
00639     rej = check_ignore(MuonReject::PRECISION_DIGIT_COUNT_LOW, true);
00640   }
00641   if ( rej ) return rej;
00642   if ( nphi < m_phi_digit_count )  {
00643     rej = check_ignore(MuonReject::PHI_DIGIT_COUNT_LOW, true);
00644   }
00645   return rej;
00646 }

int MuonSelectionTool::checkOverlap const SelectedMuonList in,
MuonRejectionList rejs,
IndexList poverlaps
const [virtual]
 

Implements IMuonSelectionTool.

Definition at line 659 of file MuonSelectionTool.cxx.

00660                                          {
00661   if ( rejs.size() != smus.size() ) return 1;
00662   if ( poverlaps && poverlaps->size() != smus.size() ) return 2;
00663   if ( smus.size() == 0 ) return 0;
00664   if ( ! m_overlap_filter ) return 0;
00665 
00666   // Should we check that accepted selected and aod muons and tracks
00667   // are not null before overlap removal?
00668 
00669   // Loop over combined muons.
00670   // If two combined muons share a combined, inner or standalone track, then
00671   // the one with larger match chi-square is dropped.
00672   // Standalone, inner or split muons that share a track with or kinematically
00673   // overlap a combined muon are dropped.
00674   for ( unsigned int imu=0; imu<smus.size(); ++imu ) {
00675     if ( rejs[imu] != MuonReject::ACCEPT ) continue;
00676     const SelectedMuon& smui = *smus[imu];
00677     const Rec::TrackParticle trki = *smui.aodTrack();
00678     if ( smui.trackType() != MuonTrack::COMBINED ) continue;
00679     for ( unsigned int jmu=0; jmu<smus.size(); ++jmu ) {
00680       if ( jmu == imu ) continue;
00681       if (  rejs[jmu] != MuonReject::ACCEPT ) continue;
00682       const SelectedMuon& smuj = *smus[jmu];
00683       if ( ! smuj.aodMuon() ) continue;
00684       const Rec::TrackParticle trkj = *smuj.aodTrack();
00685       bool inner = smuj.trackType() == MuonTrack::INNER;
00686       bool standalone = smuj.trackType() == MuonTrack::STANDALONE;
00687       bool combined = smuj.trackType() == MuonTrack::COMBINED;
00688       if ( jmu > imu && combined ) continue;
00689       bool split = smuj.trackType() == MuonTrack::SPLIT;
00690       if ( m_overlap_track ) {
00691         // Determine if the muons share a constituent track.
00692         // We would like to extend this to check if the outer tracks share hits.
00693         bool share = false;   // Muons share a track.
00694         if ( inner || combined || split ) 
00695           share |= smui.innerAodTrack() == smuj.innerAodTrack();
00696         if ( standalone || combined || split ) {
00697           share |= smui.spectrometerAodTrack() == smuj.spectrometerAodTrack();
00698           share |= smui.outerAodTrack() != 0 &&
00699                    smui.outerAodTrack() == smuj.outerAodTrack();
00700         }
00701         if ( combined )
00702           share |= smui.combinedAodTrack() == smuj.combinedAodTrack();
00703         // If tracks share a track, then one is rejected.
00704         if ( share ) {
00705           // For now (release 12), for combined tracks, we keep muid over staco
00706           // because fits are better. Otherwise use match chi-square to decide.
00707           if ( combined ) {
00708             bool keepj = false;
00709             if ( smui.source().algorithm() == MuonSource::Muid &&
00710                  smuj.source().algorithm() == MuonSource::Staco ) {
00711               keepj = false;
00712             } else if ( smuj.source().algorithm() == MuonSource::Muid &&
00713                         smui.source().algorithm() == MuonSource::Staco ) {
00714               keepj = true;
00715             } else {
00716               keepj = smui.matchChiSquare() > smuj.matchChiSquare();
00717             }
00718             if ( keepj ) {
00719               rejs[imu] = check_ignore(MuonReject::OVERLAP_COMBINED_COMBINED, false);
00720               if ( poverlaps && rejs[imu] ) (*poverlaps)[imu] = jmu;
00721               break;
00722             } else {
00723               rejs[jmu] = check_ignore(MuonReject::OVERLAP_COMBINED_COMBINED, false);
00724               if ( poverlaps && rejs[jmu] ) (*poverlaps)[jmu] = imu;
00725             }
00726           } else if ( inner ) {
00727             rejs[jmu] = check_ignore(MuonReject::OVERLAP_COMBINED_INNER, false);
00728             if ( poverlaps && rejs[jmu] ) (*poverlaps)[jmu] = imu;
00729           } else if ( standalone ) {
00730             rejs[jmu] = check_ignore(MuonReject::OVERLAP_COMBINED_STANDALONE, false);
00731             if ( poverlaps && rejs[jmu] ) (*poverlaps)[jmu] = imu;
00732           } else if ( split ) {
00733             rejs[jmu] = check_ignore(MuonReject::OVERLAP_COMBINED_SPLIT, false);
00734             if ( poverlaps && rejs[jmu] ) (*poverlaps)[jmu] = imu;
00735           } else abort();
00736           continue;
00737         }
00738       }
00739       if ( m_overlap_dr && calc_dr(trki,trkj) < m_overlap_dr ) {
00740         if ( inner ) {
00741           rejs[jmu] = check_ignore(MuonReject::OVERLAP_COMBINED_INNER, false);
00742           if ( poverlaps && rejs[jmu] ) (*poverlaps)[jmu] = imu;
00743         } else if ( standalone ) {
00744           rejs[jmu] = check_ignore(MuonReject::OVERLAP_COMBINED_STANDALONE, false);
00745           if ( poverlaps && rejs[jmu] ) (*poverlaps)[jmu] = imu;
00746         } else if ( split ) {
00747           rejs[jmu] = check_ignore(MuonReject::OVERLAP_COMBINED_SPLIT, false);
00748           if ( poverlaps ) (*poverlaps)[jmu] = imu;
00749         }
00750       }
00751     }  // end inner muon loop
00752   }  // end outer muon loop
00753 
00754   // Loop over inner, standalone and split muons.
00755   // Reject:
00756   //   inner-inner sharing a track
00757   //   standalone-standalone sharing a track or kinematically overlapped
00758   //              Like to extend former to include shared hits.
00759   //   inner-standalone kinematically overlapped
00760   for ( unsigned int imu=0; imu<smus.size()-1; ++imu ) {
00761     if ( rejs[imu] != MuonReject::ACCEPT ) continue;
00762     const SelectedMuon& smui = *smus[imu];
00763     if ( smui.trackType() == MuonTrack::COMBINED ) continue;
00764     if ( ! smui.aodMuon() ) continue;
00765     const Analysis::Muon& amui = *smui.aodMuon();
00766     const Rec::TrackParticle trki = *smui.aodTrack();
00767     const Trk::FitQuality fqi = *smui.fitQuality();
00768     bool iin = smui.trackType() == MuonTrack::INNER;
00769     bool iou = smui.trackType() == MuonTrack::STANDALONE;
00770     bool isp = smui.trackType() == MuonTrack::SPLIT;
00771     for ( unsigned int jmu=imu+1; jmu<smus.size(); ++jmu ) {
00772       if (  rejs[jmu] != MuonReject::ACCEPT ) continue;
00773       const SelectedMuon& smuj = *smus[jmu];
00774       if ( smui.trackType() == MuonTrack::COMBINED ) continue;
00775       if ( ! smuj.aodMuon() ) continue;
00776       const Analysis::Muon& amuj = *smuj.aodMuon();
00777       const Rec::TrackParticle trkj = *smuj.aodTrack();
00778       const Trk::FitQuality fqj = *smuj.fitQuality();
00779       bool jin = smuj.trackType() == MuonTrack::INNER;
00780       bool jou = smuj.trackType() == MuonTrack::STANDALONE;
00781       bool jsp = smuj.trackType() == MuonTrack::SPLIT;
00782       bool share = false;   // Muons share a track.
00783       if ( m_overlap_track ) {
00784         if ( (iin || isp) && (jin || jsp) )
00785           share |= amui.inDetTrackParticle() == amuj.inDetTrackParticle();
00786         if ( (iou || isp) && (jou || jsp) ) {
00787           share |= amui.muonSpectrometerTrackParticle() == amuj.muonSpectrometerTrackParticle();
00788           share |= amui.muonExtrapolatedTrackParticle() != 0 &&
00789                   amui.muonExtrapolatedTrackParticle() == amuj.muonExtrapolatedTrackParticle();
00790         }
00791       }
00792       bool close = false;
00793       if ( m_overlap_dr && (iou || jou) ) close = calc_dr(trki,trkj) < m_overlap_dr;
00794       if ( share ) {
00795         *m_plog << MSG::WARNING << "Removing shared track overlap" << endreq;
00796         *m_plog << MSG::WARNING << smui << endreq;
00797         *m_plog << MSG::WARNING << smuj << endreq;
00798       }
00799       if ( share || close ) {
00800         bool keepi = true;
00801         // If both are inner/split or outer, prefer Muid and then test chi-square/DOF.
00802         // In release 12, Moore has better fits than Muonboy.
00803         // Fit should be the same for MuGirl and MuTag: both use only the inner track.
00804         if ( ( (iin || isp) && (jin || jsp) ) || (iou && jou) ) {
00805           if ( smui.source().realm() == MuonSource::MooreRealm &&
00806                smuj.source().realm() == MuonSource::MuonboyRealm ) {
00807             keepi = true;
00808           } else if ( smuj.source().realm() == MuonSource::MooreRealm &&
00809                       smui.source().realm() == MuonSource::MuonboyRealm ) {
00810             keepi = false;
00811           } else {
00812             double chsqi = fqi.chiSquared();
00813             int dofi = fqi.numberDoF();
00814             double chdofi = dofi ? chsqi/dofi : 999999999.;
00815             double chsqj = fqj.chiSquared();
00816             int dofj = fqj.numberDoF();
00817             double chdofj = dofj ? chsqj/dofj : 999999999.;
00818             keepi = chdofi <= chdofj;
00819           }
00820         // Otherwise, keep the inner/split track.
00821         } else {
00822           keepi = jou;
00823         }
00824         if ( keepi ) {
00825           MuonRejectionCode rej = check_ignore(MuonReject::OVERLAP_BAD, false);
00826           if ( jin ) rej = check_ignore(MuonReject::OVERLAP_INNER, false);
00827           if ( jou ) rej = check_ignore(MuonReject::OVERLAP_STANDALONE, false);
00828           if ( jsp ) rej = check_ignore(MuonReject::OVERLAP_SPLIT, false);
00829           rejs[jmu] = rej;
00830           if ( poverlaps && rej ) (*poverlaps)[jmu] = imu;
00831           continue;
00832         } else {
00833           MuonRejectionCode rej = check_ignore(MuonReject::OVERLAP_BAD, false);
00834           if ( iin ) rej = check_ignore(MuonReject::OVERLAP_INNER, false);
00835           if ( iou ) rej = check_ignore(MuonReject::OVERLAP_STANDALONE, false);
00836           if ( isp ) rej = check_ignore(MuonReject::OVERLAP_SPLIT, false);
00837           rejs[imu] = rej;
00838           if ( poverlaps && rej ) (*poverlaps)[imu] = jmu;
00839           break;
00840         }
00841       }
00842     }  // end inner muon loop
00843   }  // end outer muon loop
00844 
00845   return 0;
00846 
00847 }

int MuonSelectionTool::select const SelectedMuonList in,
SelectedMuonList out,
MuonRejectionList prej
const [virtual]
 

Implements IMuonSelectionTool.

Definition at line 854 of file MuonSelectionTool.cxx.

00855                                       {
00856   *m_plog << MSG::DEBUG << "select:             # input AOD muons: "
00857           << in.size() << endreq;
00858   return gselect<SelectedMuon, SelectedMuonList>(in, out, rejs);
00859 }

int MuonSelectionTool::select const Analysis::MuonContainer &  in,
SelectedMuonList out,
MuonRejectionList prej
const [virtual]
 

Implements IMuonSelectionTool.

int MuonSelectionTool::select const Analysis::MuonContainer &  in,
SelectedMuonList out
const [virtual]
 

Implements IMuonSelectionTool.

int MuonSelectionTool::select const CombinedMuonContainer &  in,
SelectedMuonList out,
MuonRejectionList prej
const [virtual]
 

Implements IMuonSelectionTool.

Definition at line 883 of file MuonSelectionTool.cxx.

00884                                       {
00885   return gselect<CombinedMuon, CombinedMuonContainer>(in, out, rejs);
00886 }

int MuonSelectionTool::select const CombinedMuonContainer &  in,
SelectedMuonList out
const [virtual]
 

Implements IMuonSelectionTool.

Definition at line 893 of file MuonSelectionTool.cxx.

00893                                                                      {
00894   MuonRejectionList rejs;
00895   return select(in, out, rejs);
00896 }

int MuonSelectionTool::select const Rec::TrackParticleContainer &  in,
SelectedMuonList out,
MuonRejectionList rejs
const [virtual]
 

Implements IMuonSelectionTool.

Definition at line 902 of file MuonSelectionTool.cxx.

00903                                       {
00904   *m_plog << MSG::DEBUG << "select:             # input AOD tracks: "
00905           << in.size() << endreq;
00906   return gselect<TrackParticle, TrackParticleContainer>(in, out, rejs);
00907 }

int MuonSelectionTool::select const Rec::TrackParticleContainer &  in,
SelectedMuonList out
const [virtual]
 

Implements IMuonSelectionTool.

Definition at line 912 of file MuonSelectionTool.cxx.

00912                                                                       {
00913   MuonRejectionList rejs;
00914   return select(in, out, rejs);
00915 }

void MuonSelectionTool::dump const SelectedMuon smu  )  const
 

Definition at line 921 of file MuonSelectionTool.cxx.

00921                                                           {
00922   if ( m_dumped > m_dump_count ) return;
00923   if ( m_dumped++ == m_dump_count ) {
00924     *m_plog << MSG::INFO
00925             << "Dump limit reached--no more tracks will be dumped" << endreq;
00926     return;
00927   }
00928   *m_plog << MSG::INFO << "Dumping selected track;" << endreq;
00929   ostringstream sout;
00930   sout << smu;
00931   sout.setf(ios_base::fixed);
00932   sout.precision(0);
00933   sout << "\nIsolation:";
00934   for ( unsigned int icon=0; icon<m_dump_coneEts.size(); ++icon ) {
00935     double r = m_dump_coneEts[icon];
00936     double etsum = smu.coneEt(r);
00937     sout << "\n  Cone " << setprecision(3) << r
00938          << " calo ET sum =" << setprecision(0) << setw(6) << etsum;
00939     const CaloEnergy* pecal = smu.caloEnergy();
00940     if ( pecal ) {
00941       double eloss = pecal->energyDeposit();
00942       sout << ", isolation = " << etsum - eloss;
00943     }
00944   }
00945   for ( unsigned int icon=0; icon<m_dump_conePts.size(); ++icon ) {
00946     double r = m_dump_conePts[icon];
00947     double ptsum = smu.conePt(r);
00948     sout << "\n  Cone " << setprecision(3) << r
00949          << " track PT sum ="<< setprecision(0) << setw(6) << ptsum;
00950     if ( smu.innerAodTrack() ) {
00951       sout << ", isolation = " << ptsum - smu.innerAodTrack()->pt();
00952     }
00953   }
00954   for ( unsigned int icon=0; icon<m_dump_coneNts.size(); ++icon ) {
00955     double r = m_dump_coneNts[icon];
00956     int ntsum = smu.coneNt(r);
00957     sout << "\n  Cone " << setprecision(3) << r
00958          << " track count sum = " << setw(2) << ntsum;
00959     if ( smu.innerAodTrack() ) {
00960       sout << ", isolation = " << ntsum - 1;
00961     }
00962   }
00963   for ( unsigned int icon=0; icon<m_dump_coneCts.size(); ++icon ) {
00964     double r = m_dump_coneCts[icon];
00965     double etsum = smu.coneCt(r);
00966     sout << "\n  Cone " << setprecision(3) << r
00967          << " Alternative sum = " << setprecision(0) << setw(6) << etsum;
00968   }
00969   *m_plog << MSG::INFO << sout.str() << endreq;
00970 }

template<class T, class C>
int MuonSelectionTool::gselect const C &  in,
SelectedMuonList out,
MuonRejectionList prej
const [private]
 

Definition at line 978 of file MuonSelectionTool.cxx.

00978                                                                            {
00979 
00980   out.erase(out.begin(), out.end());
00981   rejs.erase(rejs.begin(), rejs.end());
00982 
00983   // Loop over the input and fill the output muons and rejections.
00984   // We need to maintain matching list of const and mutable selected
00985   // muons. The former is used for checking and overlap removal and
00986   // the latter is used to make the overlap assignments.
00987   int ngood = 0;
00988   SelectedMuonList cons;
00989   MutableSelectedMuonList muts;
00990   for ( typename C::const_iterator imu=in.begin();
00991         imu!=in.end(); ++imu ) {
00992     const T* pamu = *imu;
00993     if ( pamu == 0 ) {
00994       muts.push_back(0);
00995       cons.push_back(0);
00996       rejs.push_back(check_ignore(MuonReject::CONTAINER_AOD_NULL, false));
00997       continue;
00998     }
00999     const T& amu = *pamu;
01000     // Check the muon.
01001     SelectedMuon* psmu = 0;
01002     MuonRejectionCode rej = check(amu, psmu);
01003     cons.push_back(psmu);
01004     muts.push_back(psmu);
01005     rejs.push_back(rej);
01006     if ( rej == MuonReject::ACCEPT ) ++ngood;
01007   }
01008   *m_plog << MSG::DEBUG << "select: # selected muons after checks: "
01009           << ngood << endreq;
01010 
01011   // Find overlaps.
01012   IndexList overlaps(muts.size(), muts.size());
01013   int stat = checkOverlap(cons, rejs, &overlaps);
01014   if ( stat != 0 || rejs.size() != cons.size()
01015        || overlaps.size() != cons.size() ) {
01016     *m_plog << MSG::ERROR << "Overlap removal failed." << endreq;
01017     cons.erase(cons.begin(), cons.end());
01018     return 3;
01019   }
01020 
01021   // Assign overlaps to the muon that rejected them.
01022   for ( Index idrop=0; idrop<overlaps.size(); ++idrop ) {
01023     Index ikeep = overlaps[idrop];
01024     // If this muon is rejected, find the overlapping muon that is not.
01025     if ( ikeep < muts.size() ) {
01026       while ( overlaps[ikeep] < muts.size() ) ikeep = overlaps[ikeep];
01027       SelectedMuon* pkeep = muts[ikeep];
01028       const SelectedMuon* pdrop = muts[idrop];
01029       pkeep->addOverlap(pdrop);
01030     }
01031   }
01032   // For rejected tracks, copy overlaps to the track
01033 
01034   // Fill output list with updated selected muons.
01035   for ( Index iin=0; iin<muts.size(); ++iin ) {
01036     if ( rejs[iin] == MuonReject::ACCEPT ) {
01037       out.push_back(muts[iin]);
01038     }
01039   }
01040   *m_plog << MSG::DEBUG << "select:       # after overlap removal: "
01041           << out.size() << endreq;
01042   
01043   return stat;
01044 }

const InterfaceID & IMuonSelectionTool::interfaceID  )  [static, inherited]
 

Definition at line 5 of file IMuonSelectionTool.cxx.

00005                                                    { 
00006   return IID_IMuonSelectionTool; 
00007 }


Member Data Documentation

std::string MuonSelectionTool::m_label [private]
 

Definition at line 104 of file MuonSelectionTool.h.

int MuonSelectionTool::m_track_pattern [private]
 

Definition at line 106 of file MuonSelectionTool.h.

double MuonSelectionTool::m_z0 [private]
 

Definition at line 107 of file MuonSelectionTool.h.

double MuonSelectionTool::m_pt [private]
 

Definition at line 108 of file MuonSelectionTool.h.

double MuonSelectionTool::m_fit_chi2dof [private]
 

Definition at line 109 of file MuonSelectionTool.h.

double MuonSelectionTool::m_combined_fit_chi2dof [private]
 

Definition at line 110 of file MuonSelectionTool.h.

double MuonSelectionTool::m_combined_outer_chi2dof [private]
 

Definition at line 111 of file MuonSelectionTool.h.

double MuonSelectionTool::m_combined_outer_chi2dof_pt_power [private]
 

Definition at line 112 of file MuonSelectionTool.h.

double MuonSelectionTool::m_combined_outer_chi2dof_pt_logfac [private]
 

Definition at line 113 of file MuonSelectionTool.h.

double MuonSelectionTool::m_combined_match_chi2 [private]
 

Definition at line 114 of file MuonSelectionTool.h.

double MuonSelectionTool::m_combined_match_chi2_pt_power [private]
 

Definition at line 115 of file MuonSelectionTool.h.

double MuonSelectionTool::m_combined_match_chi2_pt_logfac [private]
 

Definition at line 116 of file MuonSelectionTool.h.

std::string MuonSelectionTool::m_isol_cone_string [private]
 

Definition at line 117 of file MuonSelectionTool.h.

double MuonSelectionTool::m_isol_energy [private]
 

Definition at line 118 of file MuonSelectionTool.h.

double MuonSelectionTool::m_isol_match_chi2 [private]
 

Definition at line 119 of file MuonSelectionTool.h.

double MuonSelectionTool::m_isol_fit_chi2dof [private]
 

Definition at line 120 of file MuonSelectionTool.h.

int MuonSelectionTool::m_total_digit_count [private]
 

Definition at line 121 of file MuonSelectionTool.h.

int MuonSelectionTool::m_precision_digit_count [private]
 

Definition at line 122 of file MuonSelectionTool.h.

int MuonSelectionTool::m_phi_digit_count [private]
 

Definition at line 123 of file MuonSelectionTool.h.

bool MuonSelectionTool::m_overlap_filter [private]
 

Definition at line 124 of file MuonSelectionTool.h.

bool MuonSelectionTool::m_overlap_track [private]
 

Definition at line 125 of file MuonSelectionTool.h.

double MuonSelectionTool::m_overlap_dr [private]
 

Definition at line 126 of file MuonSelectionTool.h.

std::string MuonSelectionTool::m_realm_name [private]
 

Definition at line 128 of file MuonSelectionTool.h.

bool MuonSelectionTool::m_SpectrometerOverridesExtrapolatedSummary [private]
 

Definition at line 129 of file MuonSelectionTool.h.

bool MuonSelectionTool::m_CombinedMergeSummary [private]
 

Definition at line 130 of file MuonSelectionTool.h.

int MuonSelectionTool::m_CombinedFitQuality [private]
 

Definition at line 131 of file MuonSelectionTool.h.

std::vector<int> MuonSelectionTool::m_norejs_int [private]
 

Definition at line 134 of file MuonSelectionTool.h.

MuonRejectionList MuonSelectionTool::m_norejs [private]
 

Definition at line 135 of file MuonSelectionTool.h.

MuonParameters::ParamDef MuonSelectionTool::m_isol_cone [private]
 

Definition at line 138 of file MuonSelectionTool.h.

MuonTrackSelector MuonSelectionTool::m_tsel [private]
 

Definition at line 141 of file MuonSelectionTool.h.

MuonSource::Realm MuonSelectionTool::m_realm [private]
 

Definition at line 144 of file MuonSelectionTool.h.

MsgStream* MuonSelectionTool::m_plog [mutable, private]
 

Definition at line 146 of file MuonSelectionTool.h.

IToolSvc* MuonSelectionTool::m_ptools [private]
 

Definition at line 149 of file MuonSelectionTool.h.

TrackIsolationTool* MuonSelectionTool::m_pisolTool [private]
 

Definition at line 150 of file MuonSelectionTool.h.

int MuonSelectionTool::m_dumped [mutable, private]
 

Definition at line 153 of file MuonSelectionTool.h.

int MuonSelectionTool::m_dump_count [private]
 

Definition at line 154 of file MuonSelectionTool.h.

ValueList MuonSelectionTool::m_dump_coneEts [private]
 

Definition at line 155 of file MuonSelectionTool.h.

ValueList MuonSelectionTool::m_dump_coneCts [private]
 

Definition at line 156 of file MuonSelectionTool.h.

ValueList MuonSelectionTool::m_dump_conePts [private]
 

Definition at line 157 of file MuonSelectionTool.h.

ValueList MuonSelectionTool::m_dump_coneNts [private]
 

Definition at line 158 of file MuonSelectionTool.h.


The documentation for this class was generated from the following files:
Generated on Fri Jun 29 17:53:54 2007 for MuonSelectionTools by  doxygen 1.3.9.1