20 ISvcLocator* pSvcLocator ) :
47 return StatusCode::SUCCESS;
53 const EventContext context = getContext();
74 if ( primaryVertex ==
nullptr ) {
76 return StatusCode::FAILURE;
93 std::vector< const xAOD::Jet* > qualityJetCollection;
99 qualityJetCollection.push_back(
jet );
108 int nJetsWithMuon = 0;
115 " eta=" <<
jet->eta() <<
116 " phi=" <<
jet->phi() );
124 std::vector< ElementLink< xAOD::VertexContainer > > SV1_vertex = bTag->
auxdata<std::vector< ElementLink< xAOD::VertexContainer > > >(
"SV1_vertices");
125 if(SV1_vertex.size() >= 1) nJetsWithSV++;
142 std::string flavour =
"DATA_";
143 if ( eventInfo->
eventType(xAOD::EventInfo::EventType::IS_SIMULATION) ) {
145 if (
jet->isAvailable<
int >(
"HadronConeExclTruthLabelID" ) ==
false ) {
146 ATH_MSG_ERROR(
"Input sample is MC but jet has no 'HadronConeExclTruthLabelID' aux data. Something is wrong!" );
147 return StatusCode::FAILURE;
150 int HadronConeExclTruthLabelID =
jet->auxdata<
int >(
"HadronConeExclTruthLabelID");
151 ATH_MSG_DEBUG(
" ** 'HadronConeExclTruthLabelID' is " << HadronConeExclTruthLabelID );
154 if ( HadronConeExclTruthLabelID == 0 ) flavour =
"U_";
155 else if ( HadronConeExclTruthLabelID == 4 ) flavour =
"C_";
156 else if ( HadronConeExclTruthLabelID == 5 ) flavour =
"B_";
165 ATH_CHECK(
fillHistogram(
"fracJetsWithMuon" ,
double(nJetsWithMuon)/
double(qualityJetCollection.size()) ) );
169 return StatusCode::SUCCESS;
174 return StatusCode::SUCCESS;
187 ATH_CHECK( defineHistogram< TH1I >( definitions.at( HISTO::NAME ),
188 definitions.at( HISTO::TITLE ),
189 std::stoi( definitions.at( HISTO::XBINS ) ),
190 std::stoi( definitions.at( HISTO::XMIN ) ),
191 std::stoi( definitions.at( HISTO::XMAX ) ),
193 else if ( definitions.at(
HISTO::TYPE ) ==
"TH1F" )
194 ATH_CHECK( defineHistogram< TH1F >( definitions.at( HISTO::NAME ),
195 definitions.at( HISTO::TITLE ),
196 std::stoi( definitions.at( HISTO::XBINS ) ),
197 std::stof( definitions.at( HISTO::XMIN ) ),
198 std::stof( definitions.at( HISTO::XMAX ) ),
200 else if ( definitions.at(
HISTO::TYPE ) ==
"TH1D" )
201 ATH_CHECK( defineHistogram< TH1D >( definitions.at( HISTO::NAME ),
202 definitions.at( HISTO::TITLE ),
203 std::stoi( definitions.at( HISTO::XBINS ) ),
204 std::stof( definitions.at( HISTO::XMIN ) ),
205 std::stof( definitions.at( HISTO::XMAX ) ),
215 ATH_CHECK( defineHistogram< TH2I >( definitions.at( HISTO::NAME ),
216 definitions.at( HISTO::TITLE ),
217 std::stoi( definitions.at( HISTO::XBINS ) ),
218 std::stoi( definitions.at( HISTO::XMIN ) ),
219 std::stoi( definitions.at( HISTO::XMAX ) ),
220 std::stoi( definitions.at( HISTO::YBINS ) ),
221 std::stoi( definitions.at( HISTO::YMIN ) ),
222 std::stoi( definitions.at( HISTO::YMAX ) ),
224 else if ( definitions.at(
HISTO::TYPE ) ==
"TH2F" )
225 ATH_CHECK( defineHistogram< TH2F >( definitions.at( HISTO::NAME ),
226 definitions.at( HISTO::TITLE ),
227 std::stoi( definitions.at( HISTO::XBINS ) ),
228 std::stof( definitions.at( HISTO::XMIN ) ),
229 std::stof( definitions.at( HISTO::XMAX ) ),
230 std::stoi( definitions.at( HISTO::YBINS ) ),
231 std::stof( definitions.at( HISTO::YMIN ) ),
232 std::stof( definitions.at( HISTO::YMAX ) ),
234 else if ( definitions.at(
HISTO::TYPE ) ==
"TH2D" )
235 ATH_CHECK( defineHistogram< TH2D >( definitions.at( HISTO::NAME ),
236 definitions.at( HISTO::TITLE ),
237 std::stoi( definitions.at( HISTO::XBINS ) ),
238 std::stof( definitions.at( HISTO::XMIN ) ),
239 std::stof( definitions.at( HISTO::XMAX ) ),
240 std::stoi( definitions.at( HISTO::YBINS ) ),
241 std::stof( definitions.at( HISTO::YMIN ) ),
242 std::stof( definitions.at( HISTO::YMAX ) ),
247 return StatusCode::SUCCESS;
252 const std::string& flavour,
253 std::string
chain ) {
286 if ( !bTaggingObject ) {
287 ATH_MSG_ERROR(
"Could not retrieve b-tagging object from selected jet." );
288 return StatusCode::FAILURE;
292 ATH_MSG_ERROR(
"Cannot retrieve 'BTagTrackToJetAssociator' auxdata from b-tagging object!" );
293 return StatusCode::FAILURE;
296 std::vector< ElementLink< xAOD::TrackParticleContainer > > assocTracks = bTaggingObject->
auxdata< std::vector< ElementLink<xAOD::TrackParticleContainer > > >(
"BTagTrackToJetAssociator");
298 ATH_MSG_DEBUG(
" ** nBTagTracksInJet: " << assocTracks.size() );
301 if ( not trackEL.isValid() )
continue;
307 primaryVertex,
chain ) );
312 return StatusCode::SUCCESS;
319 std::string flavour =
jetType + trackType;
322 float jet_pt =
jet->pt();
323 float jet_eta =
jet->eta();
327 float track_pt = trackParticle->
pt();
328 float fracEt = track_pt / jet_pt;
333 float track_eta = trackParticle->
eta();
334 float track_phi = trackParticle->
phi();
336 float deltaEta = fabs( jet_eta - track_eta );
343 float d0 = trackParticle->
d0();
345 float z0 = trackParticle->
z0() + trackParticle->
vz() - primaryVertex->
z();
354 ATH_MSG_DEBUG(
" ** d0 +/- err [significance] = " <<
d0 <<
" +/- " << sigmad0 <<
" [ " <<
d0/sigmad0 <<
" ]" );
355 ATH_MSG_DEBUG(
" ** z0 +/- err [significance] = " <<
z0 <<
" +/- " << sigmaz0 <<
" [ " <<
z0/sigmaz0 <<
" ]" );
357 if (trackType ==
"bTag" || trackType ==
"") {
361 float d0_signed_sig =
accessor.getSignedIp(*trackParticle, *
jet).ip3d_signed_d0_significance;
362 float z0_signed_sig =
accessor.getSignedIp(*trackParticle, *
jet).ip3d_signed_z0_significance;
407 return StatusCode::SUCCESS;
411 const std::string& flavour,
417 float jetEta =
jet->eta();
421 if ( !bTaggingObject ) {
422 ATH_MSG_ERROR(
"Could not retrieve b-tagging object from selected jet." );
423 return StatusCode::FAILURE;
435 bTaggingObject->
pb(
"IP2D",IP2D_pb );
436 bTaggingObject->
pc(
"IP2D",IP2D_pc );
442 ATH_MSG_DEBUG(
" ** IP2D [pu,pb,pc] = [" <<
IP2D_pu <<
"," << IP2D_pb <<
"," << IP2D_pc <<
"]" );
446 std::vector< float > IP2D_weightBOfTracks;
447 std::vector< float > IP2D_weightCOfTracks;
448 std::vector< float > IP2D_weightUOfTracks;
455 bTaggingObject->
variable<
int >(
"IP2D",
"nTrks", IP2D_nTrks );
456 if ( bTaggingObject->
isAvailable< std::vector< float > >(
"IP2D_weightBOfTracks" ) )
457 IP2D_weightBOfTracks = bTaggingObject->
auxdata< std::vector< float > >(
"IP2D_weightBOfTracks" );
458 if ( bTaggingObject->
isAvailable< std::vector< float > >(
"IP2D_weightCOfTracks" ) )
459 IP2D_weightCOfTracks = bTaggingObject->
auxdata< std::vector< float > >(
"IP2D_weightCOfTracks" );
460 if ( bTaggingObject->
isAvailable< std::vector< float > >(
"IP2D_weightUOfTracks" ) )
461 IP2D_weightUOfTracks = bTaggingObject->
auxdata< std::vector< float > >(
"IP2D_weightUOfTracks" );
462 if ( bTaggingObject->
isAvailable< std::vector< int > >(
"IP2D_gradeOfTracks" ) )
477 for (
unsigned int i(0);
i < IP2D_weightBOfTracks.size();
i++ )
479 for (
unsigned int i(0);
i < IP2D_weightCOfTracks.size();
i++ )
481 for (
unsigned int i(0);
i < IP2D_weightUOfTracks.size();
i++ )
498 bTaggingObject->
pu(
"IP3D",IP3D_pu );
499 bTaggingObject->
pb(
"IP3D",IP3D_pb );
500 bTaggingObject->
pc(
"IP3D",IP3D_pc );
506 ATH_MSG_DEBUG(
" ** IP3D [pu,pb,pc] = [" << IP3D_pu <<
"," << IP3D_pb <<
"," << IP3D_pc <<
"]" );
509 std::vector< float > IP3D_weightBOfTracks;
510 std::vector< float > IP3D_weightCOfTracks;
511 std::vector< float > IP3D_weightUOfTracks;
513 std::vector< float > IP3D_D0wrtPVOfTracks;
514 std::vector< float > IP3D_sigD0wrtPVOfTracks;
515 std::vector< float > IP3D_Z0wrtPVOfTracks;
516 std::vector< float > IP3D_sigZ0wrtPVOfTracks;
518 bTaggingObject->
variable<
int >(
"IP3D",
"nTrks", IP3D_nTrks );
519 if ( bTaggingObject->
isAvailable< std::vector< float > >(
"IP3D_weightBOfTracks" ) )
520 IP3D_weightBOfTracks = bTaggingObject->
auxdata< std::vector< float > >(
"IP3D_weightBOfTracks" );
521 if ( bTaggingObject->
isAvailable< std::vector< float > >(
"IP3D_weightCOfTracks" ) )
522 IP3D_weightCOfTracks = bTaggingObject->
auxdata< std::vector< float > >(
"IP3D_weightCOfTracks" );
523 if ( bTaggingObject->
isAvailable< std::vector< float > >(
"IP3D_weightUOfTracks" ) )
524 IP3D_weightUOfTracks = bTaggingObject->
auxdata< std::vector< float > >(
"IP3D_weightUOfTracks" );
525 if ( bTaggingObject->
isAvailable< std::vector< int > >(
"IP3D_gradeOfTracks" ) )
528 if ( bTaggingObject->
isAvailable< std::vector< float > >(
"IP3D_D0wrtPVOfTracks" ) )
529 IP3D_D0wrtPVOfTracks = bTaggingObject->
auxdata< std::vector< float > >(
"IP3D_D0wrtPVOfTracks" );
530 if ( bTaggingObject->
isAvailable< std::vector< float > >(
"IP3D_Z0wrtPVOfTracks" ) )
531 IP3D_Z0wrtPVOfTracks = bTaggingObject->
auxdata< std::vector< float > >(
"IP3D_Z0wrtPVOfTracks" );
532 if ( bTaggingObject->
isAvailable< std::vector< float > >(
"IP3D_sigD0wrtPVOfTracks" ) )
533 IP3D_sigD0wrtPVOfTracks = bTaggingObject->
auxdata< std::vector< float > >(
"IP3D_sigD0wrtPVOfTracks" );
534 if ( bTaggingObject->
isAvailable< std::vector< float > >(
"IP3D_sigZ0wrtPVOfTracks" ) )
535 IP3D_sigZ0wrtPVOfTracks = bTaggingObject->
auxdata< std::vector< float > >(
"IP3D_sigZ0wrtPVOfTracks" );
537 ATH_MSG_DEBUG(
"Size IP3D_gradeOfTracks/_weightBOfTracks/_weightUOfTracks/_D0wrtPVOfTracks/_sigD0wrtPVOfTracks/_Z0wrtPVOfTracks/_sigZ0wrtPVOfTracks: " <<
IP3D_gradeOfTracks.size() <<
", "<< IP3D_weightBOfTracks.size() <<
", " << IP3D_weightUOfTracks.size() <<
", " << IP3D_D0wrtPVOfTracks.size() <<
", " << IP3D_sigD0wrtPVOfTracks.size() <<
", " << IP3D_Z0wrtPVOfTracks.size() <<
", " << IP3D_sigZ0wrtPVOfTracks.size() );
541 for (
unsigned int i(0);
i < IP3D_weightBOfTracks.size();
i++ )
543 for (
unsigned int i(0);
i < IP3D_weightCOfTracks.size();
i++ )
545 for (
unsigned int i(0);
i < IP3D_weightUOfTracks.size();
i++ )
547 for (
unsigned int i(0);
i < IP3D_D0wrtPVOfTracks.size();
i++ )
549 for (
unsigned int i(0);
i < IP3D_sigD0wrtPVOfTracks.size();
i++ )
551 for (
unsigned int i(0);
i < IP3D_Z0wrtPVOfTracks.size();
i++ )
553 for (
unsigned int i(0);
i < IP3D_sigZ0wrtPVOfTracks.size();
i++ )
562 bTaggingObject->
pu(
"SV1",SV1_pu );
563 bTaggingObject->
pb(
"SV1",SV1_pb );
564 bTaggingObject->
pc(
"SV1",SV1_pc );
570 ATH_MSG_DEBUG(
" ** SV1 [pu,pb,pc] = [" << SV1_pu <<
"," << SV1_pb <<
"," << SV1_pc <<
"]" );
574 float SV1_deltaR = -1;
576 float SV1_significance3d = -1;
577 float SV1_energyTrkInJet = -1;
583 bTaggingObject->
variable<
float >(
"SV1",
"deltaR", SV1_deltaR );
585 bTaggingObject->
variable<
float >(
"SV1",
"significance3d", SV1_significance3d );
586 bTaggingObject->
variable<
float >(
"SV1",
"energyTrkInJet", SV1_energyTrkInJet );
588 bTaggingObject->
variable<
float >(
"SV1",
"Lxy", SV1_Lxy );
650 double RNNIP_pu = -1;
651 double RNNIP_pb = -1;
652 double RNNIP_pc = -1;
653 double RNNIP_LLR = -1;
654 bTaggingObject->
pu(
"rnnip",RNNIP_pu );
655 bTaggingObject->
pb(
"rnnip",RNNIP_pb );
656 bTaggingObject->
pc(
"rnnip",RNNIP_pc );
663 ATH_MSG_DEBUG(
" ** RNNIP [pu,pb,pc] = [" << RNNIP_pu <<
"," << RNNIP_pb <<
"," << RNNIP_pc <<
"]" );
669 bTaggingObject->
pu(
"DL1",DL1_pu );
670 bTaggingObject->
pb(
"DL1",DL1_pb );
671 bTaggingObject->
pc(
"DL1",DL1_pc );
680 bTaggingObject->
pu(
"DL1r",DL1r_pu );
681 bTaggingObject->
pb(
"DL1r",DL1r_pb );
682 bTaggingObject->
pc(
"DL1r",DL1r_pc );
684 if ( DL1r_pu == -1 &&
687 bTaggingObject->
pu(
"DL1rnn",DL1r_pu );
688 bTaggingObject->
pb(
"DL1rnn",DL1r_pb );
689 bTaggingObject->
pc(
"DL1rnn",DL1r_pc );
692 float cFraction = 0.03;
694 if ( DL1r_pu != -1 && DL1r_pb != -1 && DL1r_pc != -1 )
695 DL1r =
log( DL1r_pb / ( DL1r_pu * ( 1 - cFraction ) + DL1r_pc * cFraction ) );
697 float bFraction = 0.03;
699 if ( DL1r_pu != -1 && DL1r_pb != -1 && DL1r_pc != -1 )
700 DL1rc =
log( DL1r_pb / ( DL1r_pu * ( 1 - bFraction ) + DL1r_pc * bFraction ) );
708 ATH_MSG_DEBUG(
" ** DL1r [pu,pb,pc] = [" << DL1r_pu <<
"," << DL1r_pb <<
"," << DL1r_pc <<
"]" );
711 double mv2c10_discriminant = -2;
717 return StatusCode::SUCCESS;