5#include "GaudiKernel/SystemOfUnits.h"
22 return StatusCode::FAILURE;
30 ATH_MSG_ERROR(
"Trying to configure hypo with no pT bins. This is probably a configuration mistake.");
31 return StatusCode::FAILURE;
34 for(
size_t j=0; j<
m_ptBins.size(); j++){
38 return StatusCode::FAILURE;
41 for (std::vector<float>::size_type i=0; i<
m_bins[j];++i) {
57 if(
m_doSA)
m_type = xAOD::Muon::TrackParticleType::ExtrapolatedMuonSpectrometerTrackParticle;
58 else m_type = xAOD::Muon::TrackParticleType::CombinedTrackParticle;
60 return StatusCode::SUCCESS;
65 std::vector<float> fexPt, fexEta, fexPhi, selPt, selEta, selPhi;
72 auto monitorIt =
Monitored::Group(
m_monTool, muonPtMon, muonEtaMon, muonPhiMon, muonPtSelMon, muonEtaSelMon, muonPhiSelMon);
76 ATH_MSG_DEBUG(
"Accept property is set: taking all the events");
86 if (!
m_isFastReco && !muon->trackParticle(xAOD::Muon::TrackParticleType::Primary)) {
92 double pt{0.},
eta{0.},
phi{0.};
98 tr = muon->trackParticle(
m_type);
108 ATH_MSG_DEBUG(
"Retrieved Track track with abs pt "<< pt/Gaudi::Units::GeV <<
" GeV ");
110 fexPt.push_back(pt/Gaudi::Units::GeV);
111 fexEta.push_back(
eta);
112 fexPhi.push_back(
phi);
116 float absEta = std::abs(
eta);
118 for (std::vector<float>::size_type k=0; k<
m_bins[cutIndex]; ++k) {
130 uint8_t nGoodPrcLayers=0;
132 ATH_MSG_DEBUG(
"No numberOfGoodPrecisionLayers variable found; not passing hypo");
135 if(std::abs(
eta) > 1.3) {
137 if(nGoodPrcLayers < 2){
138 ATH_MSG_DEBUG(
"Muon has less than two GoodPrecisionLayers; not passing hypo (requrement loosend according to absence of NSW)");
142 if(nGoodPrcLayers < 3){
143 ATH_MSG_DEBUG(
"Muon has less than three GoodPrecisionLayers; not passing hypo");
147 }
else if (std::abs(
eta) > 1.05) {
148 if(nGoodPrcLayers < 3){
149 ATH_MSG_DEBUG(
"Muon has less than three GoodPrecisionLayers; not passing hypo");
162 selPt.push_back(pt/Gaudi::Units::GeV);
163 selEta.push_back(
eta);
164 selPhi.push_back(
phi);
168 ATH_MSG_DEBUG(
" REGTEST muon pt is " << pt/Gaudi::Units::GeV <<
" GeV "
169 <<
" with Charge " <<
charge
170 <<
" and with d0 " << tr->
d0()
171 <<
" the threshold cut is " <<
threshold/Gaudi::Units::GeV <<
" GeV"
172 <<
" and d0min cut is " <<
m_d0min<<
" mm"
173 <<
" so hypothesis is " << (result?
"true":
"false"));
175 ATH_MSG_DEBUG(
" REGTEST muon pt is " << pt/Gaudi::Units::GeV <<
" GeV "
176 <<
" with Charge " <<
charge
177 <<
" and threshold cut is " <<
threshold/Gaudi::Units::GeV <<
" GeV"
178 <<
" so hypothesis is " << (result?
"true":
"false"));
184 bool passCut =
false;
185 const xAOD::TrackParticle* idtrack = muon->trackParticle( xAOD::Muon::TrackParticleType::InnerDetectorTrackParticle );
186 const xAOD::TrackParticle* metrack = muon->trackParticle( xAOD::Muon::TrackParticleType::ExtrapolatedMuonSpectrometerTrackParticle );
187 float mePt = -999999., idPt = -999999.;
189 float reducedChi2 = -10, qOverPsignif = -10;
191 if(idtrack && metrack) {
192 mePt = metrack->
pt();
193 idPt = idtrack->
pt();
194 float meP = 1.0 / ( sin(metrack->
theta()) / mePt);
195 float idP = 1.0 / ( sin(idtrack->
theta()) / idPt);
197 reducedChi2 = muon->trackParticle(xAOD::Muon::TrackParticleType::Primary)->chiSquared()/muon->trackParticle(xAOD::Muon::TrackParticleType::Primary)->numberDoF();
199 if(std::abs(reducedChi2) < 8.0 && !
m_muonSelTool->isBadMuon(*muon) && qOverPsignif<7.0 && muon->author()==xAOD::Muon::Author::MuidCo) passCut =
true;
206 size_t numTrigger =
m_ptBins.size();
207 size_t numMuon=toolInput.size();
216 return StatusCode::SUCCESS;
219 for (
uint i=0; i<toolInput.size(); i++){
220 auto& tool = toolInput.at(i);
222 bool overlap =
false;
224 for(
uint j=i+1; j<toolInput.size();j++){
225 auto& tool2 = toolInput.at(j);
227 if(tool2.muon->p4()==tool.muon->p4()) overlap=
true;
230 if(overlap)
continue;
239 return StatusCode::SUCCESS;
243 bool passingNscan=
false;
244 for(
size_t cutIndex=0; cutIndex <
m_ptBins.size(); ++cutIndex) {
245 size_t elementIndex{0};
246 for(
auto& tool : toolInput){
249 if(
m_nscan && cutIndex==0 && (!passingNscan)){
252 unsigned int nInCone=0;
253 float muonR = sqrt( pow(tool.muon->eta(),2) +pow(tool.muon->phi(),2));
255 for (
auto& tooltmp : toolInput){
256 ATH_MSG_DEBUG(
">>Testing Muon with pt: "<<tooltmp.muon->pt()/Gaudi::Units::GeV <<
"GeV, eta: "
257 << tooltmp.muon->eta() <<
", phi: " << tooltmp.muon->phi());
258 if (tooltmp.muon->p4() == tool.muon->p4()) {
261 deta = std::abs(tooltmp.muon->eta()-tool.muon->eta());
262 dphi =
getdphi(tooltmp.muon->phi(),tool.muon->phi());
263 if(deta<coneCheck && dphi<coneCheck){
269 ATH_MSG_DEBUG(
">> dR is: " <<sqrt( pow( deta, 2) + pow( dphi, 2) ));
276 ATH_MSG_DEBUG(
"Passes narrow-scan selection Index["<<elementIndex<<
"]");
278 }
else ATH_MSG_DEBUG(
"Does not pass narrow-scan selection Index["<<elementIndex<<
"]");
281 passingSelection[cutIndex].push_back(elementIndex);
290 if (
m_nscan &&(!passingNscan)){
291 ATH_MSG_DEBUG(
"Narrow-scan is required and no muons passed, all muons will be rejected ");
292 return StatusCode::SUCCESS;
295 if(passingSelection[cutIndex].
empty()){
296 ATH_MSG_DEBUG(
"No muons passed the selection "<<cutIndex<<
" rejecting...");
297 return StatusCode::SUCCESS;
300 std::set<size_t> passingIndices;
303 std::set<const xAOD::Muon*> setOfMuons;
304 for (
auto index : comb){
305 setOfMuons.insert(toolInput[
index].muon);
307 return setOfMuons.size()==comb.size();
315 if(passingIndices.empty()){
317 return StatusCode::SUCCESS;
319 for(
auto i : passingIndices){
323 return StatusCode::SUCCESS;
326 float dphi = phi1-phi2;
327 if(dphi > TMath::Pi()) dphi -= TMath::TwoPi();
328 if(dphi < -1*TMath::Pi()) dphi += TMath::TwoPi();
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
#define ATH_CHECK
Evaluate an expression and check for errors.
double charge(const T &p)
Header file to be included by clients of the Monitored infrastructure.
size_t size() const
Number of registered mappings.
static const Attributes_t empty
bool msgLvl(const MSG::Level lvl) const
Group of local monitoring quantities and retain correlation when filling histograms
float theta() const
Returns the parameter, which has range 0 to .
virtual double phi() const override final
The azimuthal angle ( ) of the particle (has range to .).
const ParametersCovMatrix_t definingParametersCovMatrix() const
Returns the 5x5 symmetric matrix containing the defining parameters covariance matrix.
float d0() const
Returns the parameter.
virtual double pt() const override final
The transverse momentum ( ) of the particle.
virtual double eta() const override final
The pseudorapidity ( ) of the particle.
float charge() const
Returns the charge.
It used to be useful piece of code for replacing actual SG with other store of similar functionality ...
void elementsInUniqueCombinations(const Index2DVec &indices, std::set< size_t > &participants, const std::function< bool(const Index1DVec &)> &filter)
std::vector< Index1DVec > Index2DVec
std::vector< size_t > Index1DVec
Unique combinations for case when one can not repeat the index (i.e.
ValuesCollection< T > Collection(std::string name, const T &collection)
Declare a monitored (double-convertible) collection.
bool passed(DecisionID id, const DecisionIDContainer &idSet)
checks if required decision ID is in the set of IDs in the container
void addDecisionID(DecisionID id, Decision *d)
Appends the decision (given as ID) to the decision object.
TrackParticle_v1 TrackParticle
Reference the current persistent version:
Muon_v1 Muon
Reference the current persistent version:
@ numberOfGoodPrecisionLayers
layers with at least 3 hits that are not deweighted [uint8_t]