9L2OverlapRemoverMon :: L2OverlapRemoverMon(
const std::string& name, ISvcLocator* pSvcLocator )
14StatusCode L2OverlapRemoverMon :: fillVariablesPerChain(
const EventContext &,
const std::string &chain)
const {
20 return StatusCode::SUCCESS;
40 double dRThres = 9999.;
41 double massThres = 9999.;
42 bool isBarrel1 = (*muEL1)->sAddress() != -1;
43 bool isBarrel2 = (*muEL2)->sAddress() != -1;
45 if( isBarrel1 && isBarrel2 ) {
49 else if( (isBarrel1 && ! isBarrel2) || (!isBarrel1 && isBarrel2) ) {
54 double absEta = (std::abs(mu1Pt) > std::abs(mu2Pt)) ? std::abs(mu1Eta) : std::abs(mu2Eta);
55 unsigned int iThres=0;
56 for(
unsigned int i=0; i<(
m_etaBins.size()-1); i++) {
65 bool sameSign = mu1Pt*mu2Pt > 0;
68 float deta = mu1Eta - mu2Eta;
70 dR = sqrt(deta*deta + dphi*dphi);
71 bool dRisClose = dR < dRThres;
74 invMass =
calcinvMass(0., mu1Pt, mu1Eta, mu1Phi, 0., mu2Pt, mu2Eta, mu2Phi);
75 bool massIsClose = invMass < massThres;
78 const float monitor_limit = 1e-4;
79 dRLog10 = ( dR >= monitor_limit ) ? log10(dR) : log10(monitor_limit);
80 invMassLog10 = ( invMass >= monitor_limit ) ? log10(invMass) : log10(monitor_limit);
84 bool overlap = sameSign && dRisClose && massIsClose;
87 fill(
m_group+
"_"+chain, dR, invMass, dRLog10, invMassLog10);
109 double absEta = (std::abs(mu1Pt) > std::abs(mu2Pt)) ? std::abs(mu1Eta) : std::abs(mu2Eta);
110 unsigned int iThres=0;
111 for(
unsigned int i=0; i<(
m_etaBins.size()-1); i++) {
120 bool sameSign = mu1Pt*mu2Pt > 0;
123 float deta = mu1Eta - mu2Eta;
125 dR = sqrt(deta*deta + dphi*dphi);
126 bool dRisClose = dR < dRThres;
129 bool dRbySAisClose =
false;
132 if( muSA1 ==
nullptr || muSA2 ==
nullptr )
return false;
136 float dRBySA = sqrt(deta*deta + dphi*dphi);
137 if( dRBySA < dRbySAThres ) dRbySAisClose =
true;
141 invMass =
calcinvMass(0., mu1Pt, mu1Eta, mu1Phi, 0., mu2Pt, mu2Eta, mu2Phi);
142 bool massIsClose = invMass < massThres;
145 const float monitor_limit = 1e-4;
146 dRLog10 = ( dR >= monitor_limit ) ? log10(dR) : log10(monitor_limit);
147 invMassLog10 = ( invMass >= monitor_limit ) ? log10(invMass) : log10(monitor_limit);
151 bool overlap = sameSign && dRisClose && massIsClose && dRbySAisClose;
154 fill(
m_group+
"_"+chain, dR, invMass, dRLog10, invMassLog10);
164 std::vector<float> vec_RemovedEta, vec_RemovedPhi, vec_RemovedPt;
169 for(i=0; i<featureCont.size(); i++) {
171 if( muResult[i] != i ) {
175 std::vector<unsigned int> others;
176 for(j=0; j<featureCont.size(); j++) {
177 if( muResult[j] == muResult[i] ) others.emplace_back(j);
179 if( others.size() == 1 ) {
185 unsigned int BestMuon = 0;
188 for(k=0; k<others.size(); k++) {
191 float pt = std::abs((*muEL)->pt());
192 float ptRoI = (*muEL)->roiThreshold();
193 if( (ptRoI-maxPtRoI) > 0.1 ) {
198 else if( std::abs(ptRoI-maxPtRoI) < 0.1 ) {
207 for(k=0; k<others.size(); k++) {
209 if( j != BestMuon ) {
211 vec_RemovedPt.push_back( (*muEL)->pt() );
212 vec_RemovedEta.push_back( (*muEL)->etaMS() );
213 vec_RemovedPhi.push_back( (*muEL)->phiMS() );
219 fill(
m_group+
"_"+chain, RemovedEta, RemovedPhi, RemovedPt);
221 return StatusCode::SUCCESS;
228 std::vector<float> vec_RemovedEta, vec_RemovedPhi, vec_RemovedPt;
233 for(i=0; i<featureCont.size(); i++) {
235 if( muResult[i] != i ) {
239 std::vector<unsigned int> others;
240 for(j=0; j<featureCont.size(); j++) {
241 if( muResult[j] == muResult[i] ) others.emplace_back(j);
243 if( others.size() == 1 ) {
249 unsigned int BestMuon = 0;
251 for(k=0; k<others.size(); k++) {
254 float pt = std::abs((*muEL)->pt()/1e3);
261 for(k=0; k<others.size(); k++) {
263 if( j != BestMuon ) {
265 vec_RemovedPt.push_back( (*muEL)->pt()/1e3 * (*muEL)->charge() );
266 vec_RemovedEta.push_back( (*muEL)->eta() );
267 vec_RemovedPhi.push_back( (*muEL)->phi() );
273 fill(
m_group+
"_"+chain, RemovedEta, RemovedPhi, RemovedPt);
275 return StatusCode::SUCCESS;
281 double m2,
double pt2,
double eta2,
double phi2)
285 double theta1 = 2*atan2((
double)exp(-eta1),1.);
286 double theta2 = 2*atan2((
double)exp(-eta2),1.);
288 double fpt1 = fabs(pt1);
289 double fpt2 = fabs(pt2);
291 double px1 = fpt1*cos(phi1);
292 double py1 = fpt1*sin(phi1);
293 double pz1 = fpt1/tan(theta1);
294 double e1 = sqrt(px1*px1+py1*py1+pz1*pz1+m1*m1);
296 double px2 = fpt2*cos(phi2);
297 double py2 = fpt2*sin(phi2);
298 double pz2 = fpt2/tan(theta2);
299 double e2 = sqrt(px2*px2+py2*py2+pz2*pz2+m2*m2);
301 double pxsum = px1 + px2;
302 double pysum = py1 + py2;
303 double pzsum = pz1 + pz2;
304 double esum = e1 + e2;
307 double mass2 = esum*esum - pxsum*pxsum - pysum*pysum - pzsum*pzsum;
315 return std::forward_as_tuple(trig->
pt(), trig->
etaMS(), trig->
phiMS());
319 return std::forward_as_tuple( (trig->
pt()/1e3 * trig->
charge() ), trig->
eta(), trig->
phi());
#define ATH_CHECK
Evaluate an expression and check for errors.
ElementLink implementation for ROOT usage.
Gaudi::Property< std::vector< float > > m_etaBins
Gaudi::Property< float > m_dRSAThresBE
Gaudi::Property< std::vector< float > > m_dRSAThresEC
static std::tuple< float, float, float > L2ORPosForMatchFunc(const xAOD::L2StandAloneMuon *trig)
StatusCode chooseBestMuon(const std::string &chain, const std::vector< TrigCompositeUtils::LinkInfo< xAOD::L2StandAloneMuonContainer > > &featureCont, const std::vector< unsigned int > &muResult) const
Function that choose best muon.
Gaudi::Property< std::vector< float > > m_dRCBThres
Gaudi::Property< std::vector< float > > m_massSAThresEC
static float calcinvMass(double m1, double pt1, double eta1, double phi1, double m2, double pt2, double eta2, double phi2)
Gaudi::Property< std::vector< float > > m_dRbySAThres
Gaudi::Property< float > m_dRSAThresBB
Gaudi::Property< std::vector< float > > m_massCBThres
Gaudi::Property< float > m_massSAThresBB
StatusCode fillVariablesOverlapRemoverPlots(const std::string &chain, std::string &&trigstep) const
Function that fills variables of L2OverlapRemover plots.
Gaudi::Property< float > m_massSAThresBE
Declare a monitored scalar variable.
Gaudi::Property< std::string > m_group
Name of monitored group.
TrigMuonMonitorAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
virtual double eta() const
The pseudorapidity ( ) of the particle.
virtual double phi() const
The azimuthal angle ( ) of the particle.
float charge() const
get seeding muon charge
virtual double pt() const
The transverse momentum ( ) of the particle.
float etaMS() const
Get the eta at muon spectrometer.
float phiMS() const
Get the phi at muon spectrometer.
virtual double pt() const
The transverse momentum ( ) of the particle.
void fill(const ToolHandle< GenericMonitoringTool > &groupHandle, std::vector< std::reference_wrapper< Monitored::IMonitoredVariable > > &&variables) const
Fills a vector of variables to a group by reference.
ValuesCollection< T > Collection(std::string name, const T &collection)
Declare a monitored (double-convertible) collection.
double deltaPhi(double phiA, double phiB)
delta Phi in range [-pi,pi[
L2CombinedMuon_v1 L2CombinedMuon
Define the latest version of the muon CB class.
L2StandAloneMuon_v2 L2StandAloneMuon
Define the latest version of the muon SA class.
Helper to keep a Decision object, ElementLink and ActiveState (with respect to some requested ChainGr...
void fill(H5::Group &out_file, size_t iterations)