21 ISvcLocator* pSvcLocator ) :
48 return StatusCode::SUCCESS;
54 const EventContext context = getContext();
75 if ( primaryVertex ==
nullptr ) {
77 return StatusCode::FAILURE;
94 std::vector< const xAOD::Jet* > qualityJetCollection;
100 qualityJetCollection.push_back(
jet );
109 int nJetsWithMuon = 0;
116 " eta=" <<
jet->eta() <<
117 " phi=" <<
jet->phi() );
126 std::vector< ElementLink< xAOD::VertexContainer > > SV1_vertex = SV1_verticesAcc(*bTag);
127 if(SV1_vertex.size() >= 1) nJetsWithSV++;
145 std::string flavour =
"DATA_";
146 if ( eventInfo->
eventType(xAOD::EventInfo::EventType::IS_SIMULATION) ) {
149 if ( HadronConeExclTruthLabelIDAcc.
isAvailable( *
jet ) ==
false ) {
150 ATH_MSG_ERROR(
"Input sample is MC but jet has no 'HadronConeExclTruthLabelID' aux data. Something is wrong!" );
151 return StatusCode::FAILURE;
154 int HadronConeExclTruthLabelID = HadronConeExclTruthLabelIDAcc(*
jet);
155 ATH_MSG_DEBUG(
" ** 'HadronConeExclTruthLabelID' is " << HadronConeExclTruthLabelID );
158 if ( HadronConeExclTruthLabelID == 0 ) flavour =
"U_";
159 else if ( HadronConeExclTruthLabelID == 4 ) flavour =
"C_";
160 else if ( HadronConeExclTruthLabelID == 5 ) flavour =
"B_";
169 ATH_CHECK(
fillHistogram(
"fracJetsWithMuon" ,
double(nJetsWithMuon)/
double(qualityJetCollection.size()) ) );
173 return StatusCode::SUCCESS;
178 return StatusCode::SUCCESS;
191 ATH_CHECK( defineHistogram< TH1I >( definitions.at( HISTO::NAME ),
192 definitions.at( HISTO::TITLE ),
193 std::stoi( definitions.at( HISTO::XBINS ) ),
194 std::stoi( definitions.at( HISTO::XMIN ) ),
195 std::stoi( definitions.at( HISTO::XMAX ) ),
197 else if ( definitions.at(
HISTO::TYPE ) ==
"TH1F" )
198 ATH_CHECK( defineHistogram< TH1F >( definitions.at( HISTO::NAME ),
199 definitions.at( HISTO::TITLE ),
200 std::stoi( definitions.at( HISTO::XBINS ) ),
201 std::stof( definitions.at( HISTO::XMIN ) ),
202 std::stof( definitions.at( HISTO::XMAX ) ),
204 else if ( definitions.at(
HISTO::TYPE ) ==
"TH1D" )
205 ATH_CHECK( defineHistogram< TH1D >( definitions.at( HISTO::NAME ),
206 definitions.at( HISTO::TITLE ),
207 std::stoi( definitions.at( HISTO::XBINS ) ),
208 std::stof( definitions.at( HISTO::XMIN ) ),
209 std::stof( definitions.at( HISTO::XMAX ) ),
219 ATH_CHECK( defineHistogram< TH2I >( definitions.at( HISTO::NAME ),
220 definitions.at( HISTO::TITLE ),
221 std::stoi( definitions.at( HISTO::XBINS ) ),
222 std::stoi( definitions.at( HISTO::XMIN ) ),
223 std::stoi( definitions.at( HISTO::XMAX ) ),
224 std::stoi( definitions.at( HISTO::YBINS ) ),
225 std::stoi( definitions.at( HISTO::YMIN ) ),
226 std::stoi( definitions.at( HISTO::YMAX ) ),
228 else if ( definitions.at(
HISTO::TYPE ) ==
"TH2F" )
229 ATH_CHECK( defineHistogram< TH2F >( definitions.at( HISTO::NAME ),
230 definitions.at( HISTO::TITLE ),
231 std::stoi( definitions.at( HISTO::XBINS ) ),
232 std::stof( definitions.at( HISTO::XMIN ) ),
233 std::stof( definitions.at( HISTO::XMAX ) ),
234 std::stoi( definitions.at( HISTO::YBINS ) ),
235 std::stof( definitions.at( HISTO::YMIN ) ),
236 std::stof( definitions.at( HISTO::YMAX ) ),
238 else if ( definitions.at(
HISTO::TYPE ) ==
"TH2D" )
239 ATH_CHECK( defineHistogram< TH2D >( definitions.at( HISTO::NAME ),
240 definitions.at( HISTO::TITLE ),
241 std::stoi( definitions.at( HISTO::XBINS ) ),
242 std::stof( definitions.at( HISTO::XMIN ) ),
243 std::stof( definitions.at( HISTO::XMAX ) ),
244 std::stoi( definitions.at( HISTO::YBINS ) ),
245 std::stof( definitions.at( HISTO::YMIN ) ),
246 std::stof( definitions.at( HISTO::YMAX ) ),
251 return StatusCode::SUCCESS;
256 const std::string& flavour,
257 std::string
chain ) {
290 if ( !bTaggingObject ) {
291 ATH_MSG_ERROR(
"Could not retrieve b-tagging object from selected jet." );
292 return StatusCode::FAILURE;
296 if ( not BTagTrackToJetAssociatorAcc.
isAvailable(*bTaggingObject) ) {
297 ATH_MSG_ERROR(
"Cannot retrieve 'BTagTrackToJetAssociator' auxdata from b-tagging object!" );
298 return StatusCode::FAILURE;
301 std::vector< ElementLink< xAOD::TrackParticleContainer > > assocTracks = BTagTrackToJetAssociatorAcc(*bTaggingObject);
303 ATH_MSG_DEBUG(
" ** nBTagTracksInJet: " << assocTracks.size() );
306 if ( not trackEL.isValid() )
continue;
312 primaryVertex,
chain ) );
317 return StatusCode::SUCCESS;
324 std::string flavour =
jetType + trackType;
327 float jet_pt =
jet->pt();
328 float jet_eta =
jet->eta();
332 float track_pt = trackParticle->
pt();
333 float fracEt = track_pt / jet_pt;
338 float track_eta = trackParticle->
eta();
339 float track_phi = trackParticle->
phi();
341 float deltaEta = fabs( jet_eta - track_eta );
348 float d0 = trackParticle->
d0();
350 float z0 = trackParticle->
z0() + trackParticle->
vz() - primaryVertex->
z();
359 ATH_MSG_DEBUG(
" ** d0 +/- err [significance] = " <<
d0 <<
" +/- " << sigmad0 <<
" [ " <<
d0/sigmad0 <<
" ]" );
360 ATH_MSG_DEBUG(
" ** z0 +/- err [significance] = " <<
z0 <<
" +/- " << sigmaz0 <<
" [ " <<
z0/sigmaz0 <<
" ]" );
362 if (trackType ==
"bTag" || trackType ==
"") {
366 float d0_signed_sig =
accessor.getSignedIp(*trackParticle, *
jet).ip3d_signed_d0_significance;
367 float z0_signed_sig =
accessor.getSignedIp(*trackParticle, *
jet).ip3d_signed_z0_significance;
412 return StatusCode::SUCCESS;
416 const std::string& flavour,
422 float jetEta =
jet->eta();
426 if ( !bTaggingObject ) {
427 ATH_MSG_ERROR(
"Could not retrieve b-tagging object from selected jet." );
428 return StatusCode::FAILURE;
439 bTaggingObject->
pb(
"IP2D",IP2D_pb );
440 bTaggingObject->
pc(
"IP2D",IP2D_pc );
445 ATH_MSG_DEBUG(
" ** IP2D [pu,pb,pc] = [" <<
IP2D_pu <<
"," << IP2D_pb <<
"," << IP2D_pc <<
"]" );
449 std::vector< float > IP2D_weightBOfTracks;
450 std::vector< float > IP2D_weightCOfTracks;
451 std::vector< float > IP2D_weightUOfTracks;
454 bTaggingObject->
variable<
int >(
"IP2D",
"nTrks", IP2D_nTrks );
457 IP2D_weightBOfTracks = IP2D_weightBOfTracksAcc.withDefault(*bTaggingObject, std::vector< float >());
460 IP2D_weightCOfTracks = IP2D_weightCOfTracksAcc.
withDefault(*bTaggingObject, std::vector< float >());
463 IP2D_weightUOfTracks = IP2D_weightUOfTracksAcc.
withDefault(*bTaggingObject, std::vector< float >());
471 for (
unsigned int i(0);
i < IP2D_weightBOfTracks.size();
i++ )
473 for (
unsigned int i(0);
i < IP2D_weightCOfTracks.size();
i++ )
475 for (
unsigned int i(0);
i < IP2D_weightUOfTracks.size();
i++ )
483 bTaggingObject->
pu(
"IP3D",IP3D_pu );
484 bTaggingObject->
pb(
"IP3D",IP3D_pb );
485 bTaggingObject->
pc(
"IP3D",IP3D_pc );
491 ATH_MSG_DEBUG(
" ** IP3D [pu,pb,pc] = [" << IP3D_pu <<
"," << IP3D_pb <<
"," << IP3D_pc <<
"]" );
494 std::vector< float > IP3D_weightBOfTracks;
495 std::vector< float > IP3D_weightCOfTracks;
496 std::vector< float > IP3D_weightUOfTracks;
498 std::vector< float > IP3D_D0wrtPVOfTracks;
499 std::vector< float > IP3D_sigD0wrtPVOfTracks;
500 std::vector< float > IP3D_Z0wrtPVOfTracks;
501 std::vector< float > IP3D_sigZ0wrtPVOfTracks;
503 bTaggingObject->
variable<
int >(
"IP3D",
"nTrks", IP3D_nTrks );
506 IP3D_weightBOfTracks = IP3D_weightBOfTracksAcc.withDefault(*bTaggingObject, std::vector< float >());
509 IP3D_weightCOfTracks = IP3D_weightCOfTracksAcc.
withDefault(*bTaggingObject, std::vector< float >());
512 IP3D_weightUOfTracks = IP3D_weightUOfTracksAcc.
withDefault(*bTaggingObject, std::vector< float >());
518 IP3D_D0wrtPVOfTracks = IP3D_D0wrtPVOfTracksAcc.
withDefault(*bTaggingObject, std::vector< float >());
521 IP3D_Z0wrtPVOfTracks = IP3D_Z0wrtPVOfTracksAcc.
withDefault(*bTaggingObject, std::vector< float >());
524 IP3D_sigD0wrtPVOfTracks = IP3D_sigD0wrtPVOfTracksAcc.
withDefault(*bTaggingObject, std::vector< float >());
527 IP3D_sigZ0wrtPVOfTracks = IP3D_sigZ0wrtPVOfTracksAcc.
withDefault(*bTaggingObject, std::vector< float >());
529 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() );
533 for (
unsigned int i(0);
i < IP3D_weightBOfTracks.size();
i++ )
535 for (
unsigned int i(0);
i < IP3D_weightCOfTracks.size();
i++ )
537 for (
unsigned int i(0);
i < IP3D_weightUOfTracks.size();
i++ )
539 for (
unsigned int i(0);
i < IP3D_D0wrtPVOfTracks.size();
i++ )
541 for (
unsigned int i(0);
i < IP3D_sigD0wrtPVOfTracks.size();
i++ )
543 for (
unsigned int i(0);
i < IP3D_Z0wrtPVOfTracks.size();
i++ )
545 for (
unsigned int i(0);
i < IP3D_sigZ0wrtPVOfTracks.size();
i++ )
553 bTaggingObject->
pu(
"SV1",SV1_pu );
554 bTaggingObject->
pb(
"SV1",SV1_pb );
555 bTaggingObject->
pc(
"SV1",SV1_pc );
560 ATH_MSG_DEBUG(
" ** SV1 [pu,pb,pc] = [" << SV1_pu <<
"," << SV1_pb <<
"," << SV1_pc <<
"]" );
564 float SV1_deltaR = -1;
566 float SV1_significance3d = -1;
567 float SV1_energyTrkInJet = -1;
573 bTaggingObject->
variable<
float >(
"SV1",
"deltaR", SV1_deltaR );
575 bTaggingObject->
variable<
float >(
"SV1",
"significance3d", SV1_significance3d );
576 bTaggingObject->
variable<
float >(
"SV1",
"energyTrkInJet", SV1_energyTrkInJet );
578 bTaggingObject->
variable<
float >(
"SV1",
"Lxy", SV1_Lxy );
630 double RNNIP_pu = -1;
631 double RNNIP_pb = -1;
632 double RNNIP_pc = -1;
633 double RNNIP_LLR = -1;
634 bTaggingObject->
pu(
"rnnip",RNNIP_pu );
635 bTaggingObject->
pb(
"rnnip",RNNIP_pb );
636 bTaggingObject->
pc(
"rnnip",RNNIP_pc );
643 ATH_MSG_DEBUG(
" ** RNNIP [pu,pb,pc] = [" << RNNIP_pu <<
"," << RNNIP_pb <<
"," << RNNIP_pc <<
"]" );
649 bTaggingObject->
pu(
"DL1",DL1_pu );
650 bTaggingObject->
pb(
"DL1",DL1_pb );
651 bTaggingObject->
pc(
"DL1",DL1_pc );
660 bTaggingObject->
pu(
"DL1r",DL1r_pu );
661 bTaggingObject->
pb(
"DL1r",DL1r_pb );
662 bTaggingObject->
pc(
"DL1r",DL1r_pc );
664 if ( DL1r_pu == -1 &&
667 bTaggingObject->
pu(
"DL1rnn",DL1r_pu );
668 bTaggingObject->
pb(
"DL1rnn",DL1r_pb );
669 bTaggingObject->
pc(
"DL1rnn",DL1r_pc );
672 float cFraction = 0.03;
674 if ( DL1r_pu != -1 && DL1r_pb != -1 && DL1r_pc != -1 )
675 DL1r =
log( DL1r_pb / ( DL1r_pu * ( 1 - cFraction ) + DL1r_pc * cFraction ) );
677 float bFraction = 0.03;
679 if ( DL1r_pu != -1 && DL1r_pb != -1 && DL1r_pc != -1 )
680 DL1rc =
log( DL1r_pb / ( DL1r_pu * ( 1 - bFraction ) + DL1r_pc * bFraction ) );
688 ATH_MSG_DEBUG(
" ** DL1r [pu,pb,pc] = [" << DL1r_pu <<
"," << DL1r_pb <<
"," << DL1r_pc <<
"]" );
691 double mv2c10_discriminant = -2;
697 return StatusCode::SUCCESS;