20 constexpr
double barrel_end = 1.05;
21 constexpr
double eifi_boundary = 1.3;
22 constexpr
double endcap_end = 1.9;
23 constexpr
double trigger_end = 2.4;
26 constexpr
int number_of_trigger_sectors_endcap = 48;
27 constexpr
int number_of_trigger_sectors_forward = 24;
30 constexpr
double tgc_coin_phi_small_offset = 0.0001;
33 constexpr
double nsw_rmax = 5000;
34 constexpr
double nsw_rmin = 900;
35 constexpr
double nsw_z = 7824.46;
36 constexpr
double nsw_rindex_div = 255;
37 constexpr
double nsw_rindex_step = ( nsw_rmax - nsw_rmin ) / nsw_rindex_div;
84 std::unique_ptr<TObjArray> monTrigs( Str.Tokenize(
";") );
85 for(
int i = 0 ;
i < monTrigs->GetEntries() ;
i++){
86 TString monTrig = monTrigs->At(
i)->GetName();
87 if(monTrig.IsNull())
continue;
92 std::unique_ptr<TObjArray> monElement( monTrig.Tokenize(
",") );
93 for(
int j = 0 ; j < monElement->GetEntries() ; j++){
94 std::string sysItem = monElement->At(j)->GetName();
95 if(sysItem.empty())
continue;
96 std::string
item = sysItem.substr(4,sysItem.size());
97 if(sysItem.starts_with(
"Tit")){
99 }
else if(sysItem.starts_with(
"Mul")){
101 }
else if(sysItem.starts_with(
"CTP")|| sysItem.starts_with(
"HLT")){
103 }
else if(sysItem.starts_with(
"RPC")){
105 monObj.
rpcR = (
item.find(
'R')!=std::string::npos);
106 monObj.
rpcM = (
item.find(
'M')!=std::string::npos);
107 }
else if(sysItem.starts_with(
"TGC")){
109 monObj.
tgcF = (
item.find(
'F')!=std::string::npos);
110 monObj.
tgcC = (
item.find(
'C')!=std::string::npos);
111 monObj.
tgcH = (
item.find(
'H')!=std::string::npos);
121 std::unique_ptr<TObjArray> arr( Str.Tokenize(
",") );
122 for(
int i = 0 ;
i < arr->GetEntries() ;
i++){
123 std::string
name = arr->At(
i)->GetName();
124 if(!
name.starts_with(
"MU"))
continue;
134 while(getline(
fi,
str)){
142 return StatusCode::SUCCESS;
155 return StatusCode::FAILURE;
157 std::set<std::string> available_muon_triggers;
159 if( chainGroup !=
nullptr ){
160 auto triggerList = chainGroup->getListOfTriggers();
161 if( !triggerList.empty() ){
162 for(
const auto &trig : triggerList) {
163 std::string thisTrig = trig;
164 if( thisTrig.find(
"mu")==std::string::npos && thisTrig.find(
"MU")==std::string::npos)
continue;
167 for(
const auto& comb : fc.getCombinations()){
168 auto initRoIs = comb.get<
TrigRoiDescriptor>(
"initialRoI",TrigDefs::alsoDeactivateTEs);
169 for(
const auto& roi : initRoIs){
170 if( roi.empty() )
continue;
171 if( roi.cptr()==nullptr )
continue;
173 available_muon_triggers.insert(thisTrig);
178 for(
const auto& roiLinkInfo : initialRoIs) {
179 if( !roiLinkInfo.isValid() )
continue;
180 auto roiEL = roiLinkInfo.link;
181 if( !roiEL.isValid() )
continue;
183 if( roi==
nullptr )
continue;
185 available_muon_triggers.insert(thisTrig);
191 for(
const auto& trig : available_muon_triggers){
196 return StatusCode::SUCCESS;
199 std::set<std::string>
203 std::set<std::string> list_of_single_muon_triggers;
206 if( chainGroup !=
nullptr ){
207 auto triggerList = chainGroup->getListOfTriggers();
208 if( !triggerList.empty() ){
209 for(
const auto &trig : triggerList) {
210 if( trig.find(
"HLT_mu") != 0 )
continue;
211 if( trig.find(
'-') != std::string::npos )
continue;
212 if( trig.find(
"L1MU") == std::string::npos )
continue;
213 if( trig.find(
"mu") != trig.rfind(
"mu") )
continue;
214 if( trig.find(
"MU") != trig.rfind(
"MU") )
continue;
215 list_of_single_muon_triggers.insert( trig );
220 return list_of_single_muon_triggers;
228 if(primVtxContainer.
isValid()){
229 for(
const auto vtx : *primVtxContainer){
240 std::vector<TgcRawDataMonitorAlgorithm::TimedMuonRoI>
242 std::vector<TimedMuonRoI> AllBCMuonRoIs;
250 for(
const auto roi : *handle.
cptr()){
251 isRun3 = roi->isRun3();
253 AllBCMuonRoIs.push_back(myMuonRoI);
261 for(
const auto roi : *handle.
cptr()){
263 AllBCMuonRoIs.push_back(myMuonRoI);
270 for(
const auto roi : *handle.
cptr()){
272 AllBCMuonRoIs.push_back(myMuonRoI);
279 for(
const auto roi : *handle.
cptr()){
281 AllBCMuonRoIs.push_back(myMuonRoI);
288 for(
const auto roi : *handle.
cptr()){
290 AllBCMuonRoIs.push_back(myMuonRoI);
296 return AllBCMuonRoIs;
302 if( not roiVec.empty() ){
306 roi_variables.push_back(roi_bcid);
308 roi_variables.push_back(roi_pileup);
310 roi_variables.push_back(roi_lumiBlock);
314 roi_variables.push_back(roi_timing);
318 roi_variables.push_back(roi_currentBC);
322 roi_variables.push_back(roi_previousBC);
326 roi_variables.push_back(roi_nextBC);
328 return m.muonRoI->getRoI();
330 roi_variables.push_back(roi_roiNumber);
332 return (
m.muonRoI->getHemisphere() ==
xAOD::MuonRoI::Positive)?(
m.muonRoI->getSectorID()+1):(-1 *
m.muonRoI->getSectorID()-1);
334 roi_variables.push_back(roi_sector);
336 return m.muonRoI->getSectorID()+1;
338 roi_variables.push_back(roi_sectorAbs);
340 return (
m.muonRoI->getBW3Coincidence()) ? ((
m.muonRoI->getHemisphere() ==
xAOD::MuonRoI::Positive)?(
m.muonRoI->getSectorID()+1):(-1 *
m.muonRoI->getSectorID()-1)) : (-999);
342 roi_variables.push_back(roi_sector_wBW3Coin);
344 return (
m.muonRoI->getInnerCoincidence()) ? ((
m.muonRoI->getHemisphere() ==
xAOD::MuonRoI::Positive)?(
m.muonRoI->getSectorID()+1):(-1 *
m.muonRoI->getSectorID()-1)) : (-999);
346 roi_variables.push_back(roi_sector_wInnerCoin);
348 return m.muonRoI->eta();
350 roi_variables.push_back(roi_eta);
354 roi_variables.push_back(roi_eta_rpc);
358 roi_variables.push_back(roi_eta_tgc);
360 return (
m.muonRoI->getSource() !=
xAOD::MuonRoI::Barrel && std::abs(
m.muonRoI->eta()) < 1.3 &&
m.muonRoI->getInnerCoincidence());
362 roi_variables.push_back(roi_wInnerCoinEtaUpTo1p3);
364 return (
m.muonRoI->getSource() !=
xAOD::MuonRoI::Barrel && std::abs(
m.muonRoI->eta()) > 1.3 &&
m.muonRoI->getInnerCoincidence());
366 roi_variables.push_back(roi_wInnerCoinEtaBeyond1p3);
368 return (
m.muonRoI->getInnerCoincidence() &&
m.muonRoI->getSource() !=
xAOD::MuonRoI::Barrel)?(
m.muonRoI->eta()):(-10);
370 roi_variables.push_back(roi_eta_wInnerCoin);
372 return (
m.muonRoI->getBW3Coincidence() &&
m.muonRoI->getSource() !=
xAOD::MuonRoI::Barrel)?(
m.muonRoI->eta()):(-10);
374 roi_variables.push_back(roi_eta_wBW3Coin);
376 return (!
m.muonRoI->getInnerCoincidence() &&
m.muonRoI->getSource() !=
xAOD::MuonRoI::Barrel)?(
m.muonRoI->eta()):(-10);
378 roi_variables.push_back(roi_eta_wInnerCoinVeto);
380 return (!
m.muonRoI->getBW3Coincidence() &&
m.muonRoI->getSource() !=
xAOD::MuonRoI::Barrel)?(
m.muonRoI->eta()):(-10);
382 roi_variables.push_back(roi_eta_wBW3CoinVeto);
384 return m.muonRoI->phi();
386 roi_variables.push_back(roi_phi);
390 roi_variables.push_back(roi_phi_sideA);
394 roi_variables.push_back(roi_phi_sideC);
398 roi_variables.push_back(roi_phi_rpc);
402 roi_variables.push_back(roi_phi_tgc);
404 return (
m.muonRoI->getInnerCoincidence() &&
m.muonRoI->getSource() !=
xAOD::MuonRoI::Barrel)?(
m.muonRoI->phi()):(-10);;
406 roi_variables.push_back(roi_phi_wInnerCoin);
408 return (
m.muonRoI->getBW3Coincidence() &&
m.muonRoI->getSource() !=
xAOD::MuonRoI::Barrel)?(
m.muonRoI->phi()):(-10);;
410 roi_variables.push_back(roi_phi_wBW3Coin);
412 return (!
m.muonRoI->getInnerCoincidence() &&
m.muonRoI->getSource() !=
xAOD::MuonRoI::Barrel)?(
m.muonRoI->phi()):(-10);;
414 roi_variables.push_back(roi_phi_wInnerCoinVeto);
416 return (!
m.muonRoI->getBW3Coincidence() &&
m.muonRoI->getSource() !=
xAOD::MuonRoI::Barrel)?(
m.muonRoI->phi()):(-10);;
418 roi_variables.push_back(roi_phi_wBW3CoinVeto);
422 roi_variables.push_back(roi_phi_wBW3Coin_sideA);
426 roi_variables.push_back(roi_phi_wBW3Coin_sideC);
430 roi_variables.push_back(roi_phi_wBW3CoinVeto_sideA);
434 roi_variables.push_back(roi_phi_wBW3CoinVeto_sideC);
436 return m.muonRoI->getThrNumber();
438 roi_variables.push_back(roi_thr);
442 roi_variables.push_back(roi_rpc);
446 roi_variables.push_back(roi_tgc);
450 roi_variables.push_back(roi_barrel);
454 roi_variables.push_back(roi_endcap);
458 roi_variables.push_back(roi_forward);
462 roi_variables.push_back(roi_phi_barrel);
466 roi_variables.push_back(roi_phi_endcap);
470 roi_variables.push_back(roi_phi_forward);
474 roi_variables.push_back(roi_sideA);
478 roi_variables.push_back(roi_sideC);
480 return m.muonRoI->getThrNumber() == 1;
482 roi_variables.push_back(thrmask1);
484 return m.muonRoI->getThrNumber() == 2;
486 roi_variables.push_back(thrmask2);
488 return m.muonRoI->getThrNumber() == 3;
490 roi_variables.push_back(thrmask3);
492 return m.muonRoI->getThrNumber() == 4;
494 roi_variables.push_back(thrmask4);
496 return m.muonRoI->getThrNumber() == 5;
498 roi_variables.push_back(thrmask5);
500 return m.muonRoI->getThrNumber() == 6;
502 roi_variables.push_back(thrmask6);
504 return m.muonRoI->getThrNumber() == 7;
506 roi_variables.push_back(thrmask7);
508 return m.muonRoI->getThrNumber() == 8;
510 roi_variables.push_back(thrmask8);
512 return m.muonRoI->getThrNumber() == 9;
514 roi_variables.push_back(thrmask9);
516 return m.muonRoI->getThrNumber() == 10;
518 roi_variables.push_back(thrmask10);
520 return m.muonRoI->getThrNumber() == 11;
522 roi_variables.push_back(thrmask11);
524 return m.muonRoI->getThrNumber() == 12;
526 roi_variables.push_back(thrmask12);
528 return m.muonRoI->getThrNumber() == 13;
530 roi_variables.push_back(thrmask13);
532 return m.muonRoI->getThrNumber() == 14;
534 roi_variables.push_back(thrmask14);
536 return m.muonRoI->getThrNumber() == 15;
538 roi_variables.push_back(thrmask15);
542 roi_variables.push_back(roi_charge);
544 return m.muonRoI->getBW3Coincidence();
546 roi_variables.push_back(roi_bw3coin);
550 roi_variables.push_back(roi_bw3coinveto);
552 return m.muonRoI->getInnerCoincidence();
554 roi_variables.push_back(roi_innercoin);
558 roi_variables.push_back(roi_innveto);
560 return m.muonRoI->getGoodMF();
562 roi_variables.push_back(roi_goodmf);
566 roi_variables.push_back(roi_badmf);
568 return m.muonRoI->isMoreCandInRoI();
570 roi_variables.push_back(roi_ismorecand);
574 roi_variables.push_back(roi_posCharge);
578 roi_variables.push_back(roi_negCharge);
588 ATH_MSG_DEBUG(
"Filling histograms for MuonRoIs after trigger decision");
590 std::set<unsigned int> allCands;
591 std::set<unsigned int> ctpMuonCands;
592 std::set<unsigned int> inputMuonCands;
594 bool isRun2Legacy =
false;
597 if(monObj.title.find(
"Run2Legacy")==std::string::npos)
continue;
598 auto fc =
getTrigDecisionTool()->features(monObj.trigItem.data(),TrigDefs::alsoDeactivateTEs);
599 for(
const auto& comb : fc.getCombinations()){
600 auto initRoIs = comb.get<
TrigRoiDescriptor>(
"initialRoI",TrigDefs::alsoDeactivateTEs);
601 for(
const auto& roi : initRoIs){
602 if( roi.empty() )
continue;
603 if( roi.cptr()==nullptr )
continue;
604 ctpMuonCands.insert(roi.cptr()->roiWord());
605 allCands.insert(roi.cptr()->roiWord());
610 for(
const auto& roiLinkInfo : initialRoIs) {
611 if( !roiLinkInfo.isValid() )
continue;
612 auto roiEL = roiLinkInfo.link;
613 if( !roiEL.isValid() )
continue;
615 if( roi==
nullptr )
continue;
616 ctpMuonCands.insert(roi->roiWord());
617 allCands.insert(roi->roiWord());
622 for(
const auto& allBcMuonRoI : roiVec){
632 if(monObj.tgcH && !roi->
getGoodMF())
continue;
634 inputMuonCands.insert(roi->
roiWord());
635 allCands.insert(roi->
roiWord());
637 if(!isRun3 && isRun2Legacy && monObj.title.find(
"Run2Legacy")==std::string::npos)
continue;
638 if(!isRun3 && !isRun2Legacy && (monObj.title.find(
"Run2Legacy")!=std::string::npos||monObj.title.find(
"Run3")!=std::string::npos))
continue;
639 if(isRun3 && monObj.title.find(
"Run3")==std::string::npos)
continue;
641 if(ctpMuonCands.size()==0 && inputMuonCands.size()<monObj.multiplicity)
continue;
643 std::vector<int> roiMatching_CTPin;
644 std::vector<int> roiMatching_CTPout;
646 std::vector<double> roi_Eta;
647 std::vector<double> roi_Phi;
648 std::vector<double> roi_dRmin;
649 std::vector<double> roi_pTdiff;
650 std::vector<int> roi_ThrNum;
651 std::vector<int> roi_Charge;
652 std::vector<int> roi_BW3Coin;
653 std::vector<int> roi_InnerCoin;
654 std::vector<int> roi_GoodMF;
655 std::vector<int> roi_IsMoreCandInRoI;
656 std::vector<int> roi_PhiOverlap;
657 std::vector<int> roi_EtaOverlap;
658 std::vector<int> roi_isVetoed;
659 std::vector<bool> roi_inOk_outOk;
660 std::vector<bool> roi_inOk_outNg;
661 std::vector<bool> roi_inNg_outOk;
663 for(
const auto& allBcMuonRoI : roiVec){
665 bool ctp_in = inputMuonCands.find(roi->
roiWord())!=inputMuonCands.end();
666 bool ctp_out = ctpMuonCands.find(roi->
roiWord())!=ctpMuonCands.end();
667 if(!ctp_in && !ctp_out)
continue;
668 roiMatching_CTPin.push_back(ctp_in?1:0);
669 roiMatching_CTPout.push_back(ctp_out?1:0);
672 for(
const auto& allBcMuonRoI2 : roiVec){
674 if(roi == roi2)
continue;
682 if(dRmin>999) dRmin = -0.05;
683 else if(dRmin>1.0) dRmin = 0.95;
684 roi_Eta.push_back(roi->
eta());
685 roi_Phi.push_back(roi->
phi());
686 roi_dRmin.push_back(dRmin);
687 roi_pTdiff.push_back(pTdiff);
696 roi_isVetoed.push_back(roi->
isVetoed());
697 roi_inOk_outOk.push_back( ctp_in && ctp_out );
698 roi_inOk_outNg.push_back( ctp_in && !ctp_out );
699 roi_inNg_outOk.push_back( !ctp_in && ctp_out );
727 ctpMonVariables.push_back(val_roiMatching_CTPin);
728 ctpMonVariables.push_back(val_roiMatching_CTPout);
729 ctpMonVariables.push_back(val_ctpMultiplicity);
730 ctpMonVariables.push_back(val_rawMultiplicity);
731 ctpMonVariables.push_back(val_countDiff);
732 ctpMonVariables.push_back(val_roi_Eta);
733 ctpMonVariables.push_back(val_roi_Phi);
734 ctpMonVariables.push_back(val_roi_dRmin);
735 ctpMonVariables.push_back(val_roi_pTdiff);
736 ctpMonVariables.push_back(val_roi_ThrNum);
737 ctpMonVariables.push_back(val_roi_Charge);
738 ctpMonVariables.push_back(val_roi_BW3Coin);
739 ctpMonVariables.push_back(val_roi_InnerCoin);
740 ctpMonVariables.push_back(val_roi_GoodMF);
741 ctpMonVariables.push_back(val_roi_IsMoreCandInRoI);
742 ctpMonVariables.push_back(val_roi_PhiOverlap);
743 ctpMonVariables.push_back(val_roi_EtaOverlap);
744 ctpMonVariables.push_back(val_roi_isVetoed);
745 ctpMonVariables.push_back(val_roi_inOk_outOk);
746 ctpMonVariables.push_back(val_roi_inOk_outNg);
747 ctpMonVariables.push_back(val_roi_inNg_outOk);
750 ATH_MSG_DEBUG(
"End filling histograms for MuonRoIs after trigger decision");
764 return StatusCode::FAILURE;
771 return StatusCode::SUCCESS;
778 const bool expressPass =
passBits & TrigDefs::Express_passed;
781 return StatusCode::SUCCESS;
789 return StatusCode::SUCCESS;
799 double primaryVertexZ = (primVertex!=
nullptr)?(primVertex->
z()):(-999);
815 std::map<const xAOD::MuonRoI*,std::set<std::string>> roiAndMenu;
816 std::map<std::string,std::vector<const xAOD::MuonRoI*>> menuAndRoIs;
821 std::vector < const xAOD::Muon* > oflmuons;
822 std::set < const xAOD::Muon* > biasedMuons;
823 std::vector < TimedMuon > mymuons;
824 std::map < std::string, std::vector< ExtPos > > extpositions;
825 std::vector< ExtPos > extpositions_pivot;
826 std::vector<double> deltaR_muons;
827 std::vector<double> deltaR_muons_roi;
828 std::vector<double> deltaR_muons_hlt;
829 std::vector<double> muon2pv_dz;
830 std::vector<double> muon2pv_dca;
831 std::vector<double> mymuon2pv_dz;
832 std::vector<double> mymuon2pv_dca;
837 return StatusCode::SUCCESS;
840 for (
const auto muon : *muons) {
842 if (
muon ==
nullptr)
continue;
844 if (
muon->pt() < 1000.)
continue;
847 if (
muon->muonType() > xAOD::Muon::MuonType::MuonStandAlone )
continue;
849 oflmuons.push_back(
muon);
851 double dz=-999,dca=-999;
857 if(primVertex==
nullptr)
continue;
858 auto trackParticle =
muon->primaryTrackParticle();
859 if(trackParticle!=
nullptr){
860 dz = trackParticle->z0() - primVertex->
z();
861 dca = trackParticle->d0();
863 muon2pv_dz.push_back(dz);
864 muon2pv_dca.push_back(dca);
870 bool isolated =
true;
876 for(
const auto muon2 : *muons){
878 if (muon2 ==
nullptr)
continue;
881 if(
muon == muon2 )
continue;
884 if( muon2->pt() < 1000. )
continue;
888 if ( muon2->muonType() > xAOD::Muon::MuonType::MuonStandAlone )
continue;
892 ( (std::abs(
muon->eta()) < barrel_end && std::abs(muon2->eta()) < barrel_end) ||
893 (std::abs(
muon->eta()) > barrel_end && std::abs(muon2->eta()) > barrel_end) ) )
continue;
897 deltaR_muons.push_back(dr_muons);
908 for (
const auto &trigName : list_of_single_muon_triggers) {
911 const bool expressPass =
passBits & TrigDefs::Express_passed;
912 if(!expressPass)
continue;
916 ATH_MSG_DEBUG(
"This muon trigger, " << trigName <<
", is fired in this event!!");
921 for(
const auto& comb : fc.getCombinations()){
922 if(!comb.active())
continue;
924 for(
const auto& mucont : MuFeatureContainers){
925 if(mucont.empty())
continue;
926 if(mucont.te()==
nullptr)
continue;
927 if(!mucont.te()->getActiveState())
continue;
928 for(
const auto hltmu : *mucont.cptr()){
929 if (hltmu ==
nullptr)
continue;
930 if (hltmu->pt() < 1000.)
continue;
932 deltaR_muons_hlt.push_back(
dr);
936 biasedMuons.insert(muon2);
944 for (
const auto& aaa : features) {
945 if (!aaa.isValid())
continue;
946 auto hltmu_link = aaa.link;
947 if (!hltmu_link.isValid())
continue;
948 auto hltmu = *hltmu_link;
949 if (hltmu ==
nullptr)
continue;
950 if (hltmu->pt() < 1000.)
continue;
952 deltaR_muons_hlt.push_back(
dr);
956 biasedMuons.insert(muon2);
962 if(!probeOK)
continue;
966 double m2 = 2. *
muon->pt() * muon2->pt() * ( std::cosh(
muon->eta() - muon2->eta()) -
std::cos(
muon->phi() - muon2->phi()) );
967 double m = (
m2>0.) ? ( std::sqrt(
m2) ) : (0.);
968 double mdiff = std::abs(
m -
m_zMass );
972 ATH_MSG_DEBUG(
"Final condition of probleOK for this muon is: " << probeOK);
978 if(!probeOK)
continue;
984 if ( std::abs(
muon->eta()) > 0.5
987 if(
muon->eta()<0 &&
z>0 )
continue;
988 if(
muon->eta()>0 &&
z<0 )
continue;
989 xAOD::Muon::TrackParticleType trkPtclType;
997 if(trackParticle==
nullptr)
continue;
998 auto matrix = std::make_unique<Amg::Transform3D>();
1000 matrix->translation().z() =
z;
1001 auto disc = std::make_unique < Trk::DiscSurface > (*
matrix,
1006 trackParticle->perigeeParameters(),
1011 if(extTrkParams !=
nullptr){
1012 if( std::abs(extTrkParams->position().z() -
z) > 10. )
continue;
1015 ext.extPos = extTrkParams->position();
1016 ext.extVec = extTrkParams->momentum();
1017 Amg::Vector3D extVec(extTrkParams->position().x(),extTrkParams->position().y(),
z);
1020 if( std::abs( std::abs(
z) -
m_M3_Z ) < 10. &&
1021 std::abs(
muon->eta() ) > 1.05 &&
1022 std::abs(
muon->eta() ) < 2.40){
1023 extpositions_pivot.push_back(
ext);
1025 for(
const auto& cham :
ext.passedChambers){
1026 extpositions[cham].push_back(
ext);
1038 if (AllBCMuonRoIs.size()==0) {
1039 ATH_MSG_DEBUG(
"No RoI matching possible as no container has been retrieved");
1040 mymuons.push_back(mymuon);
1043 for(
const auto& allBcMuonRoI : AllBCMuonRoIs){
1046 deltaR_muons_roi.push_back(
dr);
1048 if(roiAndMenu.count(roi)>0)mymuon.
matchedL1Items.insert( roiAndMenu[roi].
begin(), roiAndMenu[roi].
end() );
1059 for (
int ithr = 1; ithr <= 15 ; ++ithr) {
1074 mymuons.push_back(mymuon);
1075 mymuon2pv_dz.push_back(dz);
1076 mymuon2pv_dca.push_back(dca);
1106 oflmuon_num,oflmuon_muonType,oflmuon_author,oflmuon_quality,oflmuon_pt,oflmuon_eta,oflmuon_phi,oflmuon_pvdz,oflmuon_pvdca,
1107 oflmuon_probe_num,oflmuon_probe_muonType,oflmuon_probe_author,oflmuon_probe_quality,oflmuon_probe_pt,oflmuon_probe_eta,oflmuon_probe_phi,oflmuon_probe_pvdz,oflmuon_probe_pvdca,
1108 oflmuon_deltaR, oflmuon_deltaR_roi, oflmuon_deltaR_hlt
1114 oflmuon_variables.push_back(oflmuon_num);
1115 oflmuon_variables.push_back(oflmuon_muonType);
1116 oflmuon_variables.push_back(oflmuon_author);
1117 oflmuon_variables.push_back(oflmuon_quality);
1118 oflmuon_variables.push_back(oflmuon_pt);
1119 oflmuon_variables.push_back(oflmuon_eta);
1120 oflmuon_variables.push_back(oflmuon_phi);
1124 return m.muon->charge();
1126 oflmuon_variables.push_back(muon_charge);
1128 return (
m.muon->charge()>0);
1130 oflmuon_variables.push_back(muon_chargePos);
1132 return (
m.muon->charge()<0);
1134 oflmuon_variables.push_back(muon_chargeNeg);
1136 return (
m.muon->pt()>pt_4_cut)?
m.muon->eta():-10;
1138 oflmuon_variables.push_back(muon_eta4gev);
1140 return (
m.muon->pt()>pt_4_cut)?
m.muon->phi():-10;
1142 oflmuon_variables.push_back(muon_phi4gev);
1144 return (
m.muon->pt()>pt_4_cut && std::abs(
m.muon->eta())>barrel_end && std::abs(
m.muon->eta())<eifi_boundary)?
m.muon->phi():-10;
1146 oflmuon_variables.push_back(muon_phi4gev_1p05eta1p3);
1148 return (
m.muon->pt()>pt_4_cut && std::abs(
m.muon->eta())>barrel_end && std::abs(
m.muon->eta())<eifi_boundary &&
m.muon->eta()>0)?
m.muon->phi():-10;
1150 oflmuon_variables.push_back(muon_phi4gev_1p05eta1p3A);
1152 return (
m.muon->pt()>pt_4_cut && std::abs(
m.muon->eta())>barrel_end && std::abs(
m.muon->eta())<eifi_boundary &&
m.muon->eta()<0)?
m.muon->phi():-10;
1154 oflmuon_variables.push_back(muon_phi4gev_1p05eta1p3C);
1156 return (
m.muon->pt()>pt_4_cut && std::abs(
m.muon->eta())>eifi_boundary && std::abs(
m.muon->eta())<trigger_end)?
m.muon->phi():-10;
1158 oflmuon_variables.push_back(muon_phi4gev_1p3eta2p4);
1160 return (
m.muon->pt()>pt_4_cut && std::abs(
m.muon->eta())>eifi_boundary && std::abs(
m.muon->eta())<trigger_end &&
m.muon->eta()>0)?
m.muon->phi():-10;
1162 oflmuon_variables.push_back(muon_phi4gev_1p3eta2p4A);
1164 return (
m.muon->pt()>pt_4_cut && std::abs(
m.muon->eta())>eifi_boundary && std::abs(
m.muon->eta())<trigger_end &&
m.muon->eta()<0)?
m.muon->phi():-10;
1166 oflmuon_variables.push_back(muon_phi4gev_1p3eta2p4C);
1168 return (std::abs(
m.muon->eta()) < barrel_end &&
m.muon->pt() > pt_4_cut) ?
m.muon->phi() : -10;
1170 oflmuon_variables.push_back(muon_phi4gev_rpc);
1172 return (std::abs(
m.muon->eta()) < barrel_end &&
m.muon->pt() > pt_4_cut &&
m.muon->eta() > 0) ?
m.muon->phi() : -10;
1174 oflmuon_variables.push_back(muon_phi4gev_rpcA);
1176 return (std::abs(
m.muon->eta()) < barrel_end &&
m.muon->pt() > pt_4_cut &&
m.muon->eta() < 0) ?
m.muon->phi() : -10;
1178 oflmuon_variables.push_back(muon_phi4gev_rpcC);
1180 return (std::abs(
m.muon->eta()) > barrel_end && std::abs(
m.muon->eta()) < trigger_end &&
m.muon->pt() > pt_4_cut) ?
m.muon->phi() : -10;
1182 oflmuon_variables.push_back(muon_phi4gev_tgc);
1184 return (std::abs(
m.muon->eta()) > barrel_end && std::abs(
m.muon->eta()) < trigger_end &&
m.muon->pt() > pt_4_cut &&
m.muon->eta() > 0) ?
m.muon->phi() : -10;
1186 oflmuon_variables.push_back(muon_phi4gev_tgcA);
1188 return (std::abs(
m.muon->eta()) > barrel_end && std::abs(
m.muon->eta()) < trigger_end &&
m.muon->pt() > pt_4_cut &&
m.muon->eta() < 0) ?
m.muon->phi() : -10;
1190 oflmuon_variables.push_back(muon_phi4gev_tgcC);
1192 return (std::abs(
m.muon->eta()) > barrel_end && std::abs(
m.muon->eta()) < trigger_end) ?
m.muon->phi() : -10;
1194 oflmuon_variables.push_back(muon_phi0gev_tgc);
1196 return (std::abs(
m.muon->eta()) > barrel_end && std::abs(
m.muon->eta()) < trigger_end &&
m.muon->eta() > 0) ?
m.muon->phi() : -10;
1198 oflmuon_variables.push_back(muon_phi0gev_tgcA);
1200 return (std::abs(
m.muon->eta()) > barrel_end && std::abs(
m.muon->eta()) < trigger_end &&
m.muon->eta() < 0) ?
m.muon->phi() : -10;
1202 oflmuon_variables.push_back(muon_phi0gev_tgcC);
1204 return (
m.muon->pt() > pt_30_cut) ?
m.muon->eta() : -10;
1206 oflmuon_variables.push_back(muon_eta);
1208 return (
m.muon->pt() > pt_30_cut) ?
m.muon->phi() : -10;
1210 oflmuon_variables.push_back(muon_phi);
1212 return (std::abs(
m.muon->eta()) < barrel_end &&
m.muon->pt() > pt_30_cut) ?
m.muon->phi() : -10;
1214 oflmuon_variables.push_back(muon_phi_rpc);
1216 return (std::abs(
m.muon->eta()) < barrel_end &&
m.muon->pt() > pt_30_cut &&
m.muon->eta()>0) ?
m.muon->phi() : -10;
1218 oflmuon_variables.push_back(muon_phi_rpcA);
1220 return (std::abs(
m.muon->eta()) < barrel_end &&
m.muon->pt() > pt_30_cut &&
m.muon->eta()<0) ?
m.muon->phi() : -10;
1222 oflmuon_variables.push_back(muon_phi_rpcC);
1224 return (std::abs(
m.muon->eta()) > barrel_end && std::abs(
m.muon->eta()) < trigger_end &&
m.muon->pt() > pt_30_cut) ?
m.muon->phi() : -10;
1226 oflmuon_variables.push_back(muon_phi_tgc);
1228 return (std::abs(
m.muon->eta()) > barrel_end && std::abs(
m.muon->eta()) < trigger_end &&
m.muon->pt() > pt_30_cut &&
m.muon->eta()>0) ?
m.muon->phi() : -10;
1230 oflmuon_variables.push_back(muon_phi_tgcA);
1232 return (std::abs(
m.muon->eta()) > barrel_end && std::abs(
m.muon->eta()) < trigger_end &&
m.muon->pt() > pt_30_cut &&
m.muon->eta()<0) ?
m.muon->phi() : -10;
1234 oflmuon_variables.push_back(muon_phi_tgcC);
1238 oflmuon_variables.push_back(muon_pt_rpc);
1240 return (std::abs(
m.muon->eta()) > barrel_end && std::abs(
m.muon->eta()) < trigger_end) ?
m.muon->pt() /
Gaudi::Units::GeV : -10;
1242 oflmuon_variables.push_back(muon_pt_tgc);
1244 return (std::abs(
m.muon->eta()) < barrel_end);
1246 oflmuon_variables.push_back(muon_barrel);
1248 return (std::abs(
m.muon->eta()) > barrel_end && std::abs(
m.muon->eta()) < endcap_end);
1250 oflmuon_variables.push_back(muon_endcap);
1252 return (std::abs(
m.muon->eta()) > endcap_end && std::abs(
m.muon->eta()) < trigger_end);
1254 oflmuon_variables.push_back(muon_forward);
1256 return m.matchedL1ThrInclusiveTGC.find(1) !=
m.matchedL1ThrInclusiveTGC.end();
1258 oflmuon_variables.push_back(muon_l1passThr1TGC);
1260 return m.matchedL1ThrInclusive.find(1) !=
m.matchedL1ThrInclusive.end();
1262 oflmuon_variables.push_back(muon_l1passThr1);
1264 return m.matchedL1ThrInclusive.find(2) !=
m.matchedL1ThrInclusive.end();
1266 oflmuon_variables.push_back(muon_l1passThr2);
1268 return m.matchedL1ThrInclusive.find(3) !=
m.matchedL1ThrInclusive.end();
1270 oflmuon_variables.push_back(muon_l1passThr3);
1272 return m.matchedL1ThrInclusive.find(4) !=
m.matchedL1ThrInclusive.end();
1274 oflmuon_variables.push_back(muon_l1passThr4);
1276 return m.matchedL1ThrInclusive.find(5) !=
m.matchedL1ThrInclusive.end();
1278 oflmuon_variables.push_back(muon_l1passThr5);
1280 return m.matchedL1ThrInclusive.find(6) !=
m.matchedL1ThrInclusive.end();
1282 oflmuon_variables.push_back(muon_l1passThr6);
1284 return m.matchedL1ThrInclusive.find(7) !=
m.matchedL1ThrInclusive.end();
1286 oflmuon_variables.push_back(muon_l1passThr7);
1288 return m.matchedL1ThrInclusive.find(8) !=
m.matchedL1ThrInclusive.end();
1290 oflmuon_variables.push_back(muon_l1passThr8);
1292 return m.matchedL1ThrInclusive.find(9) !=
m.matchedL1ThrInclusive.end();
1294 oflmuon_variables.push_back(muon_l1passThr9);
1296 return m.matchedL1ThrInclusive.find(10) !=
m.matchedL1ThrInclusive.end();
1298 oflmuon_variables.push_back(muon_l1passThr10);
1300 return m.matchedL1ThrInclusive.find(11) !=
m.matchedL1ThrInclusive.end();
1302 oflmuon_variables.push_back(muon_l1passThr11);
1304 return m.matchedL1ThrInclusive.find(12) !=
m.matchedL1ThrInclusive.end();
1306 oflmuon_variables.push_back(muon_l1passThr12);
1308 return m.matchedL1ThrInclusive.find(13) !=
m.matchedL1ThrInclusive.end();
1310 oflmuon_variables.push_back(muon_l1passThr13);
1312 return m.matchedL1ThrInclusive.find(14) !=
m.matchedL1ThrInclusive.end();
1314 oflmuon_variables.push_back(muon_l1passThr14);
1316 return m.matchedL1ThrInclusive.find(15) !=
m.matchedL1ThrInclusive.end();
1318 oflmuon_variables.push_back(muon_l1passThr15);
1320 return m.matchedL1Charge;
1322 oflmuon_variables.push_back(muon_l1passCharge);
1324 return m.passBW3Coin;
1326 oflmuon_variables.push_back(muon_l1passBW3Coin);
1328 return !
m.passBW3Coin;
1330 oflmuon_variables.push_back(muon_l1passBW3CoinVeto);
1332 return m.passInnerCoin;
1334 oflmuon_variables.push_back(muon_l1passInnerCoin);
1336 return !
m.passInnerCoin;
1338 oflmuon_variables.push_back(muon_l1passInnerCoinVeto);
1340 return m.passGoodMF;
1342 oflmuon_variables.push_back(muon_l1passGoodMF);
1344 return !
m.passGoodMF;
1346 oflmuon_variables.push_back(muon_l1passBadMF);
1348 return m.passIsMoreCandInRoI;
1350 oflmuon_variables.push_back(muon_l1passIsMoreCandInRoI);
1353 ATH_MSG_DEBUG(
"End filling offline muon-related histograms");
1372 std::map<int, SG::ReadHandle<Muon::TgcCoinDataContainer> > tgcCoin;
1373 tgcCoin[-1] = tgcCoinPrev;
1374 tgcCoin[0] = tgcCoinCurr;
1375 tgcCoin[+1] = tgcCoinNext;
1378 if(tgcCoinNextNext.
isValid())tgcCoin[+2] = tgcCoinNextNext;
1380 std::vector< TgcTrig > tgcTrigMap_SL;
1381 std::vector< TgcTrig > tgcTrigMap_SL_Endcap;
1382 std::vector< TgcTrig > tgcTrigMap_SL_Forward;
1383 std::vector< TgcTrig > tgcTrigMap_HPT_Wire;
1384 std::vector< TgcTrig > tgcTrigMap_HPT_Endcap_Wire;
1385 std::vector< TgcTrig > tgcTrigMap_HPT_Forward_Wire;
1386 std::vector< TgcTrig > tgcTrigMap_HPT_Strip;
1387 std::vector< TgcTrig > tgcTrigMap_HPT_Endcap_Strip;
1388 std::vector< TgcTrig > tgcTrigMap_HPT_Forward_Strip;
1389 std::vector< TgcTrig > tgcTrigMap_LPT_Wire;
1390 std::vector< TgcTrig > tgcTrigMap_LPT_Endcap_Wire;
1391 std::vector< TgcTrig > tgcTrigMap_LPT_Forward_Wire;
1392 std::vector< TgcTrig > tgcTrigMap_LPT_Strip;
1393 std::vector< TgcTrig > tgcTrigMap_LPT_Endcap_Strip;
1394 std::vector< TgcTrig > tgcTrigMap_LPT_Forward_Strip;
1395 std::vector< TgcTrig > tgcTrigMap_EIFI_Wire;
1396 std::vector< TgcTrig > tgcTrigMap_EIFI_Endcap_Wire;
1397 std::vector< TgcTrig > tgcTrigMap_EIFI_Forward_Wire;
1398 std::vector< TgcTrig > tgcTrigMap_EIFI_Strip;
1399 std::vector< TgcTrig > tgcTrigMap_EIFI_Endcap_Strip;
1400 std::vector< TgcTrig > tgcTrigMap_EIFI_Forward_Strip;
1401 std::vector< TgcTrigTile > tgcTrigTileMap;
1402 std::vector< TgcTrigNsw > tgcTrigNswMap;
1403 std::vector< TgcTrigRpc > tgcTrigRpcMap;
1404 std::vector< TgcTrigEifi > tgcTrigEifiMap;
1405 std::map<TString, TgcTrigNsw > tgcTrigNswMapUnique;
1406 std::vector<int> multiplicity_endcap(number_of_trigger_sectors_endcap*2+1);
1407 std::vector<int> multiplicity_forward(number_of_trigger_sectors_forward*2+1);
1408 std::vector<int> sectors_endcap(number_of_trigger_sectors_endcap*2+1);
1409 std::vector<int> sectors_forward(number_of_trigger_sectors_forward*2+1);
1410 std::iota(sectors_endcap.begin(),sectors_endcap.end(),-number_of_trigger_sectors_endcap);
1411 std::iota(sectors_forward.begin(),sectors_forward.end(),-number_of_trigger_sectors_forward);
1412 int n_TgcCoin_detElementIsNull = 0;
1413 int n_TgcCoin_postOutPtrIsNull = 0;
1414 for (
auto thisCoin : tgcCoin) {
1415 int bunch = thisCoin.first;
1416 for (
const auto tgccnt : *(thisCoin.second)) {
1417 for (
const auto data : *tgccnt) {
1418 if (
data->detectorElementOut() ==
nullptr ) n_TgcCoin_detElementIsNull++;
1419 if (
data->posOutPtr() ==
nullptr ) n_TgcCoin_postOutPtrIsNull++;
1421 int slsector = (
data->isForward()) ? (
data->phi() % number_of_trigger_sectors_forward + 1) : ( (
data->phi() + 1) % number_of_trigger_sectors_endcap + 1);
1422 if(!
data->isAside()) slsector *= -1;
1425 if (
data->isInner() &&
data->isStrip()) {
1429 rpcCoin.
bunch = bunch;
1430 rpcCoin.
currBc = (bunch==0);
1435 tgcTrigRpcMap.push_back(rpcCoin);
1436 }
else if (
data->isInner() && !
data->isStrip()) {
1440 int boardID = (std::abs(nswCoin.
slSector)-1) / 2 + 1;
1445 nswCoin.
bunch = bunch;
1446 nswCoin.
currBc = (bunch==0);
1450 if(nswCoin.
R!=0 && nswCoin.
Phi!=0){
1451 tgcTrigNswMap.push_back(nswCoin);
1453 if(tgcTrigNswMapUnique.find(uniqueinfo)==tgcTrigNswMapUnique.end()){
1454 nswCoin.
bcmask = 0x1 << (1-bunch);
1455 tgcTrigNswMapUnique[uniqueinfo] = nswCoin;
1457 tgcTrigNswMapUnique[uniqueinfo].bcmask |= 0x1 << (1-bunch);
1460 }
else if (!
data->isInner() &&
data->isStrip()) {
1464 tileCoin.
bunch = bunch;
1465 tileCoin.
currBc = (bunch==0);
1468 tgcTrigTileMap.push_back(tileCoin);
1469 }
else if (!
data->isInner() && !
data->isStrip()) {
1472 eifiCoin.
bunch = bunch;
1473 eifiCoin.
currBc = (bunch==0);
1474 tgcTrigEifiMap.push_back(eifiCoin);
1478 if (
data->detectorElementOut() ==
nullptr ||
1479 data->posOutPtr() == nullptr )
continue;
1483 tgcTrig.
x_In = posIn[0];
1484 tgcTrig.
y_In = posIn[1];
1485 tgcTrig.
z_In = posIn[2];
1487 tgcTrig.
x_Out = posOut[0];
1488 tgcTrig.
y_Out = posOut[1];
1489 tgcTrig.
z_Out = posOut[2];
1490 tgcTrig.
eta = posOut.eta();
1491 tgcTrig.
phi = posOut.phi();
1500 for(
const auto&
ext : extpositions_pivot){
1502 if(
data->isAside() &&
ext.extPos.z()<0)
continue;
1503 if(!
data->isAside()&&
ext.extPos.z()>0)
continue;
1510 for (
const auto&
muon : oflmuons) {
1513 if(
dr > max_dr )
continue;
1519 for(
const auto&
muon : biasedMuons){
1522 if(
dr > max_dr )
continue;
1529 if(biasedMuons.size()>=2) tgcTrig.
isBiased = 0;
1539 etaout = std::abs(
int(
m_idHelperSvc->tgcIdHelper().stationEta(tcdidout)));
1543 etain = std::abs(
int(
m_idHelperSvc->tgcIdHelper().stationEta(tcdidin)));
1546 tgcTrig.
etain = etain;
1555 tgcTrig.
sector = slsector;
1561 tgcTrig.
bunch = bunch;
1564 if( !
data->isInner() ){
1566 tgcTrigMap_SL_Endcap.push_back(tgcTrig);
1567 tgcTrigMap_SL.push_back(tgcTrig);
1568 multiplicity_endcap[ slsector + number_of_trigger_sectors_endcap ]++;
1570 tgcTrigMap_SL_Forward.push_back(tgcTrig);
1571 tgcTrigMap_SL.push_back(tgcTrig);
1572 multiplicity_forward[ slsector + number_of_trigger_sectors_forward ]++;
1575 tgcTrigMap_HPT_Endcap_Strip.push_back(tgcTrig);
1576 tgcTrigMap_HPT_Strip.push_back(tgcTrig);
1578 tgcTrigMap_HPT_Endcap_Wire.push_back(tgcTrig);
1579 tgcTrigMap_HPT_Wire.push_back(tgcTrig);
1583 tgcTrigMap_HPT_Forward_Strip.push_back(tgcTrig);
1584 tgcTrigMap_HPT_Strip.push_back(tgcTrig);
1586 tgcTrigMap_HPT_Forward_Wire.push_back(tgcTrig);
1587 tgcTrigMap_HPT_Wire.push_back(tgcTrig);
1591 tgcTrigMap_LPT_Endcap_Strip.push_back(tgcTrig);
1592 tgcTrigMap_LPT_Strip.push_back(tgcTrig);
1594 tgcTrigMap_LPT_Endcap_Wire.push_back(tgcTrig);
1595 tgcTrigMap_LPT_Wire.push_back(tgcTrig);
1599 tgcTrigMap_LPT_Forward_Strip.push_back(tgcTrig);
1600 tgcTrigMap_LPT_Strip.push_back(tgcTrig);
1602 tgcTrigMap_LPT_Forward_Wire.push_back(tgcTrig);
1603 tgcTrigMap_LPT_Wire.push_back(tgcTrig);
1607 tgcTrigMap_EIFI_Endcap_Strip.push_back(tgcTrig);
1608 tgcTrigMap_EIFI_Strip.push_back(tgcTrig);
1610 tgcTrigMap_EIFI_Endcap_Wire.push_back(tgcTrig);
1611 tgcTrigMap_EIFI_Wire.push_back(tgcTrig);
1615 tgcTrigMap_EIFI_Forward_Strip.push_back(tgcTrig);
1616 tgcTrigMap_EIFI_Strip.push_back(tgcTrig);
1618 tgcTrigMap_EIFI_Forward_Wire.push_back(tgcTrig);
1619 tgcTrigMap_EIFI_Wire.push_back(tgcTrig);
1630 for(
auto& sl : tgcTrigMap_SL){
1631 if( sl.bunch != 0 )
continue;
1632 for(
auto& inner : tgcTrigRpcMap){
1633 if( sl.isForward == 1 )
break;
1634 if( sl.sector != inner.slSector )
continue;
1635 inner.roiEta = sl.eta;
1636 inner.roiPhi = sl.phi;
1637 inner.roiNum = sl.roi;
1638 inner.deltaBcid = (sl.bunch==0 && sl.muonMatched==1 && sl.isBiased==0) ? (inner.bcid - sl.bcid) : -999;
1639 inner.deltaTiming = (sl.bunch==0 && sl.muonMatched==1 && sl.isBiased==0) ? (inner.bunch - sl.bunch) : -999;
1640 inner.goodBcid0 = inner.deltaBcid==0;
1641 inner.goodBcid1 = (std::abs(inner.deltaBcid)<=1 || (16-std::abs(inner.deltaBcid))<=1);
1642 inner.goodBcid2 = (std::abs(inner.deltaBcid)<=2 || (16-std::abs(inner.deltaBcid))<=2);
1643 inner.goodTiming = (inner.bunch==sl.bunch && sl.bunch==0 && sl.muonMatched==1 && sl.isBiased==0);
1644 sl.rpc.push_back(&inner);
1646 for(
auto& inner : tgcTrigNswMap){
1647 if( sl.sector != inner.slSector )
continue;
1648 if( sl.isForward != inner.isForward )
continue;
1650 inner.roiEta = sl.eta;
1651 inner.roiPhi = sl.phi;
1652 inner.roiNum = sl.roi;
1654 inner.deltaBcid = (sl.bunch==0 && sl.muonMatched==1 && sl.isBiased==0) ? (inner.bcid - sl.bcid) : -999;
1655 inner.deltaTiming = (sl.bunch==0 && sl.muonMatched==1 && sl.isBiased==0) ? (inner.bunch - sl.bunch) : -999;
1656 inner.goodBcid0 = inner.deltaBcid==0;
1657 inner.goodBcid1 = (std::abs(inner.deltaBcid)<=1 || (16-std::abs(inner.deltaBcid))<=1);
1658 inner.goodBcid2 = (std::abs(inner.deltaBcid)<=2 || (16-std::abs(inner.deltaBcid))<=2);
1659 inner.goodTiming = (inner.bunch==sl.bunch && sl.bunch==0 && sl.muonMatched==1 && sl.isBiased==0);
1660 sl.nsw.push_back(&inner);
1663 for(
auto& inner : tgcTrigNswMapUnique){
1664 if( sl.sector != inner.second.slSector )
continue;
1665 if( sl.isForward != inner.second.isForward )
continue;
1667 inner.second.roiEta = sl.eta;
1668 inner.second.roiPhi = sl.phi;
1669 inner.second.roiNum = sl.roi;
1671 inner.second.deltaBcid = (sl.bunch==0 && sl.muonMatched==1 && sl.isBiased==0) ? (inner.second.bcid - sl.bcid) : -999;
1672 inner.second.deltaTiming = (sl.bunch==0 && sl.muonMatched==1 && sl.isBiased==0) ? (inner.second.bunch - sl.bunch) : -999;
1673 inner.second.goodBcid0 = inner.second.deltaBcid==0;
1674 inner.second.goodBcid1 = (std::abs(inner.second.deltaBcid)<=1 || (16-std::abs(inner.second.deltaBcid))<=1);
1675 inner.second.goodBcid2 = (std::abs(inner.second.deltaBcid)<=2 || (16-std::abs(inner.second.deltaBcid))<=2);
1676 inner.second.goodTiming = (inner.second.bunch==sl.bunch && sl.bunch==0 && sl.muonMatched==1 && sl.isBiased==0);
1677 sl.nsw_unique.push_back(&inner.second);
1680 for(
auto& inner : tgcTrigTileMap){
1681 if( sl.isForward == 1 )
break;
1682 if( sl.sector != inner.slSector )
continue;
1683 inner.roiEta = sl.eta;
1684 inner.roiPhi = sl.phi;
1685 inner.roiNum = sl.roi;
1686 inner.deltaBcid = (sl.bunch==0 && sl.muonMatched==1 && sl.isBiased==0) ? (inner.bcid - sl.bcid) : -999;
1687 inner.deltaTiming = (sl.bunch==0 && sl.muonMatched==1 && sl.isBiased==0) ? (inner.bunch - sl.bunch) : -999;
1688 inner.goodBcid0 = inner.deltaBcid==0;
1689 inner.goodBcid1 = (std::abs(inner.deltaBcid)<=1 || (16-std::abs(inner.deltaBcid))<=1);
1690 inner.goodBcid2 = (std::abs(inner.deltaBcid)<=2 || (16-std::abs(inner.deltaBcid))<=2);
1691 inner.goodTiming = (inner.bunch==sl.bunch && sl.bunch==0 && sl.muonMatched==1 && sl.isBiased==0);
1692 sl.tile.push_back(&inner);
1694 for(
auto& inner : tgcTrigEifiMap){
1695 if( sl.isForward == 1 )
break;
1696 if( sl.sector != inner.slSector )
continue;
1697 inner.roiEta = sl.eta;
1698 inner.roiPhi = sl.phi;
1699 inner.roiNum = sl.roi;
1700 inner.deltaTiming = (sl.bunch==0 && sl.muonMatched==1 && sl.isBiased==0) ? (inner.bunch - sl.bunch) : -999;
1701 inner.goodTiming = (inner.bunch==sl.bunch && sl.bunch==0 && sl.muonMatched==1 && sl.isBiased==0);
1702 sl.eifi.push_back(&inner);
1706 std::vector< TgcTrigTile > tgcTrigTileMap_allmods;
1707 for(
auto& inner : tgcTrigTileMap){
1708 if(inner.roiNum<0)
continue;
1709 for(
int i = 0 ;
i < 12 ;
i++){
1711 if((inner.tmdbDecisions>>
i) & 0x1){
1713 tgcTrigTileMap_allmods.push_back(inner2);
1721 tgcCoin_variables.push_back(mon_bcid);
1722 tgcCoin_variables.push_back(mon_pileup);
1723 tgcCoin_variables.push_back(mon_lb);
1725 auto mon_nTgcCoin_detElementIsNull =
Monitored::Scalar<int>(
"nTgcCoinDetElementIsNull", n_TgcCoin_detElementIsNull);
1726 auto mon_nTgcCoin_postOutPtrIsNull =
Monitored::Scalar<int>(
"nTgcCoinPostOutPtrIsNull", n_TgcCoin_postOutPtrIsNull);
1729 auto mon_multiplicity_endcap =
Monitored::Collection(
"trigger_multiplicity_endcap", multiplicity_endcap);
1730 auto mon_multiplicity_forward =
Monitored::Collection(
"trigger_multiplicity_forward", multiplicity_forward);
1731 tgcCoin_variables.emplace_back(mon_nTgcCoin_detElementIsNull);
1732 tgcCoin_variables.emplace_back(mon_nTgcCoin_postOutPtrIsNull);
1733 tgcCoin_variables.emplace_back(mon_sectors_endcap);
1734 tgcCoin_variables.emplace_back(mon_sectors_forward);
1735 tgcCoin_variables.emplace_back(mon_multiplicity_endcap);
1736 tgcCoin_variables.emplace_back(mon_multiplicity_forward);
1739 std::vector<Monitored::ObjectsCollection<std::vector<TgcTrig>,
double>> vo_coin;
1740 vo_coin.reserve(38 * 21);
1742 fillTgcCoin(
"SL",tgcTrigMap_SL,vo_coin,tgcCoin_variables);
1743 fillTgcCoin(
"SL_Endcap",tgcTrigMap_SL_Endcap,vo_coin,tgcCoin_variables);
1744 fillTgcCoin(
"SL_Forward",tgcTrigMap_SL_Forward,vo_coin,tgcCoin_variables);
1745 fillTgcCoin(
"HPT_Wire",tgcTrigMap_HPT_Wire,vo_coin,tgcCoin_variables);
1746 fillTgcCoin(
"HPT_Endcap_Wire",tgcTrigMap_HPT_Endcap_Wire,vo_coin,tgcCoin_variables);
1747 fillTgcCoin(
"HPT_Forward_Wire",tgcTrigMap_HPT_Forward_Wire,vo_coin,tgcCoin_variables);
1748 fillTgcCoin(
"HPT_Strip",tgcTrigMap_HPT_Strip,vo_coin,tgcCoin_variables);
1749 fillTgcCoin(
"HPT_Endcap_Strip",tgcTrigMap_HPT_Endcap_Strip,vo_coin,tgcCoin_variables);
1750 fillTgcCoin(
"HPT_Forward_Strip",tgcTrigMap_HPT_Forward_Strip,vo_coin,tgcCoin_variables);
1751 fillTgcCoin(
"LPT_Wire",tgcTrigMap_LPT_Wire,vo_coin,tgcCoin_variables);
1752 fillTgcCoin(
"LPT_Endcap_Wire",tgcTrigMap_LPT_Endcap_Wire,vo_coin,tgcCoin_variables);
1753 fillTgcCoin(
"LPT_Forward_Wire",tgcTrigMap_LPT_Forward_Wire,vo_coin,tgcCoin_variables);
1754 fillTgcCoin(
"LPT_Strip",tgcTrigMap_LPT_Strip,vo_coin,tgcCoin_variables);
1755 fillTgcCoin(
"LPT_Endcap_Strip",tgcTrigMap_LPT_Endcap_Strip,vo_coin,tgcCoin_variables);
1756 fillTgcCoin(
"LPT_Forward_Strip",tgcTrigMap_LPT_Forward_Strip,vo_coin,tgcCoin_variables);
1757 fillTgcCoin(
"EIFI_Wire",tgcTrigMap_EIFI_Wire,vo_coin,tgcCoin_variables);
1758 fillTgcCoin(
"EIFI_Endcap_Wire",tgcTrigMap_EIFI_Endcap_Wire,vo_coin,tgcCoin_variables);
1759 fillTgcCoin(
"EIFI_Forward_Wire",tgcTrigMap_EIFI_Forward_Wire,vo_coin,tgcCoin_variables);
1760 fillTgcCoin(
"EIFI_Strip",tgcTrigMap_EIFI_Strip,vo_coin,tgcCoin_variables);
1761 fillTgcCoin(
"EIFI_Endcap_Strip",tgcTrigMap_EIFI_Endcap_Strip,vo_coin,tgcCoin_variables);
1762 fillTgcCoin(
"EIFI_Forward_Strip",tgcTrigMap_EIFI_Forward_Strip,vo_coin,tgcCoin_variables);
1764 std::vector<Monitored::ObjectsCollection<std::vector<ExtTrigInfo>,
double>> vo_exttriginfo;
1765 vo_exttriginfo.reserve(13 * 5);
1766 std::vector<ExtTrigInfo> extTrigInfo_SL;
1767 std::vector<ExtTrigInfo> extTrigInfo_HPT_Wire;
1768 std::vector<ExtTrigInfo> extTrigInfo_HPT_Strip;
1769 std::vector<ExtTrigInfo> extTrigInfo_LPT_Wire;
1770 std::vector<ExtTrigInfo> extTrigInfo_LPT_Strip;
1771 fillTgcCoinEff(
"SL",tgcTrigMap_SL,extpositions_pivot,extTrigInfo_SL,vo_exttriginfo,tgcCoin_variables);
1772 fillTgcCoinEff(
"HPT_Wire",tgcTrigMap_HPT_Wire,extpositions_pivot,extTrigInfo_HPT_Wire,vo_exttriginfo,tgcCoin_variables);
1773 fillTgcCoinEff(
"HPT_Strip",tgcTrigMap_HPT_Strip,extpositions_pivot,extTrigInfo_HPT_Strip,vo_exttriginfo,tgcCoin_variables);
1774 fillTgcCoinEff(
"LPT_Wire",tgcTrigMap_LPT_Wire,extpositions_pivot,extTrigInfo_LPT_Wire,vo_exttriginfo,tgcCoin_variables);
1775 fillTgcCoinEff(
"LPT_Strip",tgcTrigMap_LPT_Strip,extpositions_pivot,extTrigInfo_LPT_Strip,vo_exttriginfo,tgcCoin_variables);
1781 tgcCoin_variables.push_back(coin_inner_tgc_roi);
1783 return (
m.bunch==0 &&
m.muonMatched==1 &&
m.isBiased==0) ? (
m.sector) : -999;
1785 tgcCoin_variables.push_back(coin_inner_tgc_sector);
1787 return (
m.bunch==0 &&
m.muonMatched==0 &&
m.loosemuonMatched==0 &&
m.isBiased==0) ? (
m.sector) : -999;
1789 tgcCoin_variables.push_back(coin_inner_tgc_fake_sector);
1792 return (
m.bunch==0 &&
m.muonMatched==1 &&
m.isBiased==0) ? (
m.eta) : -999;
1794 tgcCoin_variables.push_back(coin_inner_tgc_eta);
1796 return (
m.bunch==0 &&
m.muonMatched==1 &&
m.isBiased==0) ? (
m.phi) : -999;
1798 tgcCoin_variables.push_back(coin_inner_tgc_phi);
1801 return (
m.bunch==0 &&
m.muonMatched==0 &&
m.loosemuonMatched==0 &&
m.isBiased==0) ? (
m.eta) : -999;
1803 tgcCoin_variables.push_back(coin_inner_tgc_fake_eta);
1805 return (
m.bunch==0 &&
m.muonMatched==0 &&
m.loosemuonMatched==0 &&
m.isBiased==0) ? (
m.phi) : -999;
1807 tgcCoin_variables.push_back(coin_inner_tgc_fake_phi);
1810 return m.isForward==1;
1812 tgcCoin_variables.push_back(coin_inner_tgc_forward);
1814 return m.isForward==0;
1816 tgcCoin_variables.push_back(coin_inner_tgc_endcap);
1818 return std::abs(
m.eta) < 1.3;
1820 tgcCoin_variables.push_back(coin_inner_tgc_etaupto1p3);
1822 return std::abs(
m.eta) > 1.3 &&
m.isForward==0;
1824 tgcCoin_variables.push_back(coin_inner_tgc_etafrom1p3_endcap);
1829 tgcCoin_variables.push_back(coin_inner_tgc_coinflagEifi);
1833 tgcCoin_variables.push_back(coin_inner_tgc_coinflagTile);
1837 tgcCoin_variables.push_back(coin_inner_tgc_coinflagRpc);
1841 tgcCoin_variables.push_back(coin_inner_tgc_coinflagNsw);
1845 tgcCoin_variables.push_back(coin_inner_tgc_coinflagC);
1849 return (
m.rpc.size()>0);
1851 tgcCoin_variables.push_back(coin_inner_tgc_anyBcRpc);
1853 for(
const auto& inner :
m.rpc){
1854 if(inner->bunch == -1) return 1.;
1858 tgcCoin_variables.push_back(coin_inner_tgc_prevBcRpc);
1860 for(
const auto& inner :
m.rpc){
1861 if(inner->bunch == 0) return 1.;
1865 tgcCoin_variables.push_back(coin_inner_tgc_currBcRpc);
1867 for(
const auto& inner :
m.rpc){
1868 if(inner->bunch == 0 && inner->goodBcid0 == 1) return 1.;
1872 tgcCoin_variables.push_back(coin_inner_tgc_currBcRpc_goodBcid0);
1874 for(
const auto& inner :
m.rpc){
1875 if(inner->bunch == 0 && inner->goodBcid1 == 1) return 1.;
1879 tgcCoin_variables.push_back(coin_inner_tgc_currBcRpc_goodBcid1);
1881 for(
const auto& inner :
m.rpc){
1882 if(inner->bunch == 0 && inner->goodBcid2 == 1) return 1.;
1886 tgcCoin_variables.push_back(coin_inner_tgc_currBcRpc_goodBcid2);
1888 for(
const auto& inner :
m.rpc){
1889 if(inner->bunch == 1) return 1.;
1893 tgcCoin_variables.push_back(coin_inner_tgc_nextBcRpc);
1895 for(
const auto& inner :
m.rpc){
1896 if(inner->bunch == 2) return 1.;
1900 tgcCoin_variables.push_back(coin_inner_tgc_nextnextBcRpc);
1903 for(
const auto& inner :
m.rpc){
1904 if(inner->bunch == -1 && inner->goodBcid0 == 1) return 1.;
1908 tgcCoin_variables.push_back(coin_inner_tgc_prevBcRpc_goodBcid0);
1910 for(
const auto& inner :
m.rpc){
1911 if(inner->bunch == 1 && inner->goodBcid0 == 1) return 1.;
1915 tgcCoin_variables.push_back(coin_inner_tgc_nextBcRpc_goodBcid0);
1916 auto coin_inner_tgc_nextnextBcRpc_goodBcid0=
Monitored::Collection(
"coin_inner_tgc_nextnextBcRpc_goodBcid0",tgcTrigMap_SL,[](
const TgcTrig&
m){
1917 for(
const auto& inner :
m.rpc){
1918 if(inner->bunch == 2 && inner->goodBcid0 == 1) return 1.;
1922 tgcCoin_variables.push_back(coin_inner_tgc_nextnextBcRpc_goodBcid0);
1926 return (
m.nsw.size()>0);
1928 tgcCoin_variables.push_back(coin_inner_tgc_anyBcNsw);
1930 for(
const auto& inner :
m.nsw){
1931 if(inner->bunch == -1) return 1.;
1935 tgcCoin_variables.push_back(coin_inner_tgc_prevBcNsw);
1937 for(
const auto& inner :
m.nsw){
1938 if(inner->bunch == 0) return 1.;
1942 tgcCoin_variables.push_back(coin_inner_tgc_currBcNsw);
1944 for(
const auto& inner :
m.nsw){
1945 if(inner->bunch == 0 && inner->goodBcid0 == 1) return 1.;
1949 tgcCoin_variables.push_back(coin_inner_tgc_currBcNsw_goodBcid0);
1951 for(
const auto& inner :
m.nsw){
1952 if(inner->bunch == 0 && inner->goodBcid1 == 1) return 1.;
1956 tgcCoin_variables.push_back(coin_inner_tgc_currBcNsw_goodBcid1);
1958 for(
const auto& inner :
m.nsw){
1959 if(inner->bunch == 0 && inner->goodBcid2 == 1) return 1.;
1963 tgcCoin_variables.push_back(coin_inner_tgc_currBcNsw_goodBcid2);
1965 for(
const auto& inner :
m.nsw){
1966 if(inner->bunch == 1) return 1.;
1970 tgcCoin_variables.push_back(coin_inner_tgc_nextBcNsw);
1972 for(
const auto& inner :
m.nsw){
1973 if(inner->bunch == 2) return 1.;
1977 tgcCoin_variables.push_back(coin_inner_tgc_nextnextBcNsw);
1980 for(
const auto& inner :
m.nsw){
1981 if(inner->bunch == -1 && inner->goodBcid0 == 1) return 1.;
1985 tgcCoin_variables.push_back(coin_inner_tgc_prevBcNsw_goodBcid0);
1987 for(
const auto& inner :
m.nsw){
1988 if(inner->bunch == 1 && inner->goodBcid0 == 1) return 1.;
1992 tgcCoin_variables.push_back(coin_inner_tgc_nextBcNsw_goodBcid0);
1993 auto coin_inner_tgc_nextnextBcNsw_goodBcid0=
Monitored::Collection(
"coin_inner_tgc_nextnextBcNsw_goodBcid0",tgcTrigMap_SL,[](
const TgcTrig&
m){
1994 for(
const auto& inner :
m.nsw){
1995 if(inner->bunch == 2 && inner->goodBcid0 == 1) return 1.;
1999 tgcCoin_variables.push_back(coin_inner_tgc_nextnextBcNsw_goodBcid0);
2001 for(
const auto& inner :
m.nsw_unique){
2002 if(inner->bcmask==1) return 1.;
2006 tgcCoin_variables.push_back(coin_inner_tgc_Nsw_bcmask1);
2008 for(
const auto& inner :
m.nsw_unique){
2009 if(inner->bcmask==2) return 1.;
2013 tgcCoin_variables.push_back(coin_inner_tgc_Nsw_bcmask2);
2015 for(
const auto& inner :
m.nsw_unique){
2016 if(inner->bcmask==3) return 1.;
2020 tgcCoin_variables.push_back(coin_inner_tgc_Nsw_bcmask3);
2022 for(
const auto& inner :
m.nsw_unique){
2023 if(inner->bcmask==4) return 1.;
2027 tgcCoin_variables.push_back(coin_inner_tgc_Nsw_bcmask4);
2029 for(
const auto& inner :
m.nsw_unique){
2030 if(inner->bcmask==5) return 1.;
2034 tgcCoin_variables.push_back(coin_inner_tgc_Nsw_bcmask5);
2036 for(
const auto& inner :
m.nsw_unique){
2037 if(inner->bcmask==6) return 1.;
2041 tgcCoin_variables.push_back(coin_inner_tgc_Nsw_bcmask6);
2043 for(
const auto& inner :
m.nsw_unique){
2044 if(inner->bcmask==7) return 1.;
2048 tgcCoin_variables.push_back(coin_inner_tgc_Nsw_bcmask7);
2052 return (
m.tile.size()>0);
2054 tgcCoin_variables.push_back(coin_inner_tgc_anyBcTile);
2056 for(
const auto& inner :
m.tile){
2057 if(inner->bunch == -1) return 1.;
2061 tgcCoin_variables.push_back(coin_inner_tgc_prevBcTile);
2063 for(
const auto& inner :
m.tile){
2064 if(inner->bunch == 0) return 1.;
2068 tgcCoin_variables.push_back(coin_inner_tgc_currBcTile);
2070 for(
const auto& inner :
m.tile){
2071 if(inner->bunch == 0 && inner->goodBcid0 == 1) return 1.;
2075 tgcCoin_variables.push_back(coin_inner_tgc_currBcTile_goodBcid0);
2077 for(
const auto& inner :
m.tile){
2078 if(inner->bunch == 0 && inner->goodBcid1 == 1) return 1.;
2082 tgcCoin_variables.push_back(coin_inner_tgc_currBcTile_goodBcid1);
2084 for(
const auto& inner :
m.tile){
2085 if(inner->bunch == 0 && inner->goodBcid2 == 1) return 1.;
2089 tgcCoin_variables.push_back(coin_inner_tgc_currBcTile_goodBcid2);
2091 for(
const auto& inner :
m.tile){
2092 if(inner->bunch == 1) return 1.;
2096 tgcCoin_variables.push_back(coin_inner_tgc_nextBcTile);
2098 for(
const auto inner :
m.tile){
2099 if(inner->bunch == 2) return 1.;
2103 tgcCoin_variables.push_back(coin_inner_tgc_nextnextBcTile);
2106 for(
const auto& inner :
m.tile){
2107 if(inner->bunch == -1 && inner->goodBcid0 == 1) return 1.;
2111 tgcCoin_variables.push_back(coin_inner_tgc_prevBcTile_goodBcid0);
2113 for(
const auto& inner :
m.tile){
2114 if(inner->bunch == 1 && inner->goodBcid0 == 1) return 1.;
2118 tgcCoin_variables.push_back(coin_inner_tgc_nextBcTile_goodBcid0);
2119 auto coin_inner_tgc_nextnextBcTile_goodBcid0=
Monitored::Collection(
"coin_inner_tgc_nextnextBcTile_goodBcid0",tgcTrigMap_SL,[](
const TgcTrig&
m){
2120 for(
const auto inner :
m.tile){
2121 if(inner->bunch == 2 && inner->goodBcid0 == 1) return 1.;
2125 tgcCoin_variables.push_back(coin_inner_tgc_nextnextBcTile_goodBcid0);
2129 return (
m.eifi.size()>0);
2131 tgcCoin_variables.push_back(coin_inner_tgc_anyBcEifi);
2133 for(
const auto& inner :
m.eifi){
2134 if(inner->bunch == -1) return 1.;
2138 tgcCoin_variables.push_back(coin_inner_tgc_prevBcEifi);
2140 for(
const auto& inner :
m.eifi){
2141 if(inner->bunch == 0) return 1.;
2145 tgcCoin_variables.push_back(coin_inner_tgc_currBcEifi);
2147 for(
const auto& inner :
m.eifi){
2148 if(inner->bunch == 1) return 1.;
2152 tgcCoin_variables.push_back(coin_inner_tgc_nextBcEifi);
2154 for(
const auto inner :
m.eifi){
2155 if(inner->bunch == 2) return 1.;
2159 tgcCoin_variables.push_back(coin_inner_tgc_nextnextBcEifi);
2166 tgcCoin_variables.push_back(coin_inner_rpc_slSector);
2168 return (
m.goodTiming) ?
m.slSector : -999;
2170 tgcCoin_variables.push_back(coin_inner_rpc_slSector_goodTiming);
2174 tgcCoin_variables.push_back(coin_inner_rpc_roiEta);
2178 tgcCoin_variables.push_back(coin_inner_rpc_roiPhi);
2182 tgcCoin_variables.push_back(coin_inner_rpc_roiNum);
2186 tgcCoin_variables.push_back(coin_inner_rpc_deltaBcid);
2188 return m.deltaTiming;
2190 tgcCoin_variables.push_back(coin_inner_rpc_deltaTiming);
2194 tgcCoin_variables.push_back(coin_inner_rpc_rpcEta);
2198 tgcCoin_variables.push_back(coin_inner_rpc_rpcPhi);
2202 tgcCoin_variables.push_back(coin_inner_rpc_rpcDEta);
2206 tgcCoin_variables.push_back(coin_inner_rpc_rpcDPhi);
2210 tgcCoin_variables.push_back(coin_inner_rpc_currBc);
2214 tgcCoin_variables.push_back(coin_inner_rpc_goodBcid0);
2218 tgcCoin_variables.push_back(coin_inner_rpc_goodBcid1);
2222 tgcCoin_variables.push_back(coin_inner_rpc_goodBcid2);
2224 return m.goodTiming;
2226 tgcCoin_variables.push_back(coin_inner_rpc_goodTiming);
2233 tgcCoin_variables.push_back(coin_inner_nsw_deltaR);
2237 tgcCoin_variables.push_back(coin_inner_nsw_slSector);
2239 return (
m.goodTiming) ?
m.slSector : -999;
2241 tgcCoin_variables.push_back(coin_inner_nsw_slSector_goodTiming);
2243 return (std::abs(
m.roiEta)>1.3 &&
m.isForward==0) ?
m.slSector : -999;
2245 tgcCoin_variables.push_back(coin_inner_nsw_slSector_endcap);
2247 return (
m.isForward==1) ?
m.slSector : -999;
2249 tgcCoin_variables.push_back(coin_inner_nsw_slSector_forward);
2251 return (std::abs(
m.roiEta)>1.3 &&
m.isForward==0 &&
m.goodTiming) ?
m.slSector : -999;
2253 tgcCoin_variables.push_back(coin_inner_nsw_slSector_goodTiming_endcap);
2255 return (
m.isForward==1 &&
m.goodTiming) ?
m.slSector : -999;
2257 tgcCoin_variables.push_back(coin_inner_nsw_slSector_goodTiming_forward);
2261 tgcCoin_variables.push_back(coin_inner_nsw_roiEta);
2265 tgcCoin_variables.push_back(coin_inner_nsw_roiPhi);
2269 tgcCoin_variables.push_back(coin_inner_nsw_roiNum);
2273 tgcCoin_variables.push_back(coin_inner_nsw_deltaBcid);
2275 return m.deltaTiming;
2277 tgcCoin_variables.push_back(coin_inner_nsw_deltaTiming);
2281 tgcCoin_variables.push_back(coin_inner_nsw_R);
2285 tgcCoin_variables.push_back(coin_inner_nsw_Phi);
2287 return m.deltaTheta;
2289 tgcCoin_variables.push_back(coin_inner_nsw_deltaTheta);
2291 return m.isForward==1;
2293 tgcCoin_variables.push_back(coin_inner_nsw_isForward);
2295 return m.isForward==0;
2297 tgcCoin_variables.push_back(coin_inner_nsw_isEndcap);
2301 tgcCoin_variables.push_back(coin_inner_nsw_currBc);
2303 return (
m.isForward==0 &&
m.currBc==1);
2305 tgcCoin_variables.push_back(coin_inner_nsw_endcap_currBc);
2307 return (
m.isForward==1 &&
m.currBc==1);
2309 tgcCoin_variables.push_back(coin_inner_nsw_forward_currBc);
2313 tgcCoin_variables.push_back(coin_inner_nsw_goodBcid0);
2317 tgcCoin_variables.push_back(coin_inner_nsw_goodBcid1);
2321 tgcCoin_variables.push_back(coin_inner_nsw_goodBcid2);
2323 return m.goodTiming;
2325 tgcCoin_variables.push_back(coin_inner_nsw_goodTiming);
2328 return m.slInputIndex;
2330 tgcCoin_variables.push_back(coin_inner_nsw_slInputIndex);
2332 return (
m.isAside==1 &&
m.isForward==0) ?
m.slInputIndex : -999;
2334 tgcCoin_variables.push_back(coin_inner_nsw_slInputIndex_AEndcap);
2336 return (
m.isAside==0 &&
m.isForward==0) ?
m.slInputIndex : -999;
2338 tgcCoin_variables.push_back(coin_inner_nsw_slInputIndex_CEndcap);
2340 return (
m.isAside==1 &&
m.isForward==1) ?
m.slInputIndex : -999;
2342 tgcCoin_variables.push_back(coin_inner_nsw_slInputIndex_AForward);
2344 return (
m.isAside==0 &&
m.isForward==1) ?
m.slInputIndex : -999;
2346 tgcCoin_variables.push_back(coin_inner_nsw_slInputIndex_CForward);
2349 return (
m.goodTiming==1 &&
m.goodBcid0==1);
2351 tgcCoin_variables.push_back(coin_inner_nsw_goodTimingBcid0);
2353 return (
m.goodTiming==1 &&
m.goodBcid1==1);
2355 tgcCoin_variables.push_back(coin_inner_nsw_goodTimingBcid1);
2357 return (
m.goodTiming==1 &&
m.goodBcid2==1);
2359 tgcCoin_variables.push_back(coin_inner_nsw_goodTimingBcid2);
2361 return m.deltaTiming==-1;
2363 tgcCoin_variables.push_back(coin_inner_nsw_BcPrev);
2365 return m.deltaTiming==0;
2367 tgcCoin_variables.push_back(coin_inner_nsw_BcCurr);
2369 return m.deltaTiming==1;
2371 tgcCoin_variables.push_back(coin_inner_nsw_BcNext);
2373 return m.deltaTiming==2;
2375 tgcCoin_variables.push_back(coin_inner_nsw_BcNextNext);
2381 tgcCoin_variables.push_back(coin_inner_tile_slSector);
2383 return (
m.goodTiming) ?
m.slSector : -999;
2385 tgcCoin_variables.push_back(coin_inner_tile_slSector_goodTiming);
2389 tgcCoin_variables.push_back(coin_inner_tile_roiEta);
2393 tgcCoin_variables.push_back(coin_inner_tile_roiPhi);
2397 tgcCoin_variables.push_back(coin_inner_tile_roiNum);
2401 tgcCoin_variables.push_back(coin_inner_tile_deltaBcid);
2403 return m.deltaTiming;
2405 tgcCoin_variables.push_back(coin_inner_tile_deltaTiming);
2407 return m.tmdbDecisions;
2409 tgcCoin_variables.push_back(coin_inner_tile_tmdbDecisions);
2413 tgcCoin_variables.push_back(coin_inner_tile_currBc);
2417 tgcCoin_variables.push_back(coin_inner_tile_goodBcid0);
2421 tgcCoin_variables.push_back(coin_inner_tile_goodBcid1);
2425 tgcCoin_variables.push_back(coin_inner_tile_goodBcid2);
2427 return m.goodTiming;
2429 tgcCoin_variables.push_back(coin_inner_tile_goodTiming);
2434 tgcCoin_variables.push_back(coin_inner_tile2_slSector);
2438 tgcCoin_variables.push_back(coin_inner_tile2_currBc);
2440 return m.tmdbDecisions;
2442 tgcCoin_variables.push_back(coin_inner_tile2_tmdbDecisions);
2446 return (
m.goodTiming) ?
m.slSector : -999;
2448 tgcCoin_variables.push_back(coin_inner_eifi_slSector_goodTiming);
2452 tgcCoin_variables.push_back(coin_inner_eifi_slSector);
2456 tgcCoin_variables.push_back(coin_inner_eifi_roiEta);
2460 tgcCoin_variables.push_back(coin_inner_eifi_roiPhi);
2464 tgcCoin_variables.push_back(coin_inner_eifi_roiNum);
2466 return m.deltaTiming;
2468 tgcCoin_variables.push_back(coin_inner_eifi_deltaTiming);
2472 tgcCoin_variables.push_back(coin_inner_eifi_currBc);
2474 return m.goodTiming;
2476 tgcCoin_variables.push_back(coin_inner_eifi_goodTiming);
2487 return StatusCode::SUCCESS;
2491 const std::vector<TgcTrig>& tgcTrigs,
2572 const std::vector<TgcTrig>& tgcTrigs,
2573 const std::vector<ExtPos>& extpositions_pivot,
2574 std::vector<ExtTrigInfo>& extTrigInfoVec,
2577 for(
const auto&
ext : extpositions_pivot){
2580 bool matchedQ =
false;
2581 bool matchedF =
false;
2582 bool matchedC =
false;
2583 bool matchedH =
false;
2584 bool matchedEI =
false;
2585 bool matchedTile =
false;
2586 bool matchedRPC =
false;
2587 bool matchedNSW =
false;
2588 for(
const auto& tgcTrig : tgcTrigs){
2589 if(tgcTrig.bunch!=0)
continue;
2590 if(tgcTrig.isAside==1 &&
ext.extPos.z()<0)
continue;
2591 if(tgcTrig.isAside==0 &&
ext.extPos.z()>0)
continue;
2593 const Amg::Vector3D posOut(tgcTrig.x_Out,tgcTrig.y_Out,tgcTrig.z_Out);
2596 TVector2
vec(tgcTrig.x_Out,tgcTrig.y_Out);
2598 double deltaR =
vec.Mod() - TVector2(
ext.extPos.x(),
ext.extPos.y()).Mod();
2602 int charge = (tgcTrig.isPositiveDeltaR==0) ? (-1) : (+1);
2603 matchedQ |= (
ext.muon->charge()*
charge>0);
2613 extTrigInfo.
eta =
ext.extPos.eta();
2614 extTrigInfo.
phi =
ext.extPos.phi();
2624 extTrigInfoVec.push_back(extTrigInfo);
2656 double rindex = (
r - nsw_rmin) / nsw_rindex_step;
2661 double max_dr = 999;
2673 std::vector<bool>
passed;
2674 passed.reserve(mymuons.size());
2675 for(
const auto& mymuon : mymuons){
2676 passed.push_back( mymuon.matchedL1Items.find(
item) != mymuon.matchedL1Items.end() );
2678 auto passed_rois = menuAndRoIs[
item];
2683 thrMonVariables.push_back(lumiBlock_l1item);
2686 thrMonVariables.push_back(muon_passed_l1item);
2689 return (m.muon->pt() > pt_30_cut) ? m.muon->eta() : -10;
2691 thrMonVariables.push_back(muon_eta_l1item);
2693 return (m.muon->pt() > pt_30_cut) ? m.muon->phi() : -10;
2695 thrMonVariables.push_back(muon_phi_l1item);
2697 return (std::abs(m.muon->eta()) < barrel_end) ? m.muon->pt() / Gaudi::Units::GeV : -10;
2699 thrMonVariables.push_back(muon_pt_rpc_l1item);
2701 return (std::abs(m.muon->eta()) > barrel_end && std::abs(m.muon->eta()) < trigger_end) ? m.muon->pt() / Gaudi::Units::GeV : -10;
2703 thrMonVariables.push_back(muon_pt_tgc_l1item);
2705 return (std::abs(m.muon->eta()) < barrel_end && m.muon->pt() > pt_30_cut) ? m.muon->phi() : -10;
2707 thrMonVariables.push_back(muon_phi_rpc_l1item);
2709 return (std::abs(m.muon->eta()) > barrel_end && std::abs(m.muon->eta()) < trigger_end && m.muon->pt() > pt_30_cut) ? m.muon->phi() : -10;
2711 thrMonVariables.push_back(muon_phi_tgc_l1item);
2714 thrMonVariables.push_back(l1item_roi_eta);
2716 thrMonVariables.push_back(l1item_roi_phi);
2718 return (m->getSource()==xAOD::MuonRoI::Barrel)?(m->phi()):(-10);
2721 return (m->getSource()!=xAOD::MuonRoI::Barrel)?(m->phi()):(-10);
2723 thrMonVariables.push_back(l1item_roi_phi_tgc);
2726 return (m->getSource() == xAOD::MuonRoI::Barrel) ? m->phi() : -10;
2728 thrMonVariables.push_back(l1item_roi_phi_barrel);
2730 return (m->getSource() == xAOD::MuonRoI::Endcap) ? m->phi() : -10;
2732 thrMonVariables.push_back(l1item_roi_phi_endcap);
2734 return (m->getSource() == xAOD::MuonRoI::Forward) ? m->phi() : -10;
2736 thrMonVariables.push_back(l1item_roi_phi_forward);
2738 return m->getHemisphere() == xAOD::MuonRoI::Positive;
2740 thrMonVariables.push_back(l1item_roi_sideA);
2742 return m->getHemisphere() == xAOD::MuonRoI::Negative;
2744 thrMonVariables.push_back(l1item_roi_sideC);
2749 thrMonVariables.push_back(l1item_roi_roiNumber);
2752 return (m->getHemisphere() == xAOD::MuonRoI::Positive)?(m->getSectorID()+1):(-1 * m->getSectorID()-1);
2754 thrMonVariables.push_back(l1item_roi_sector);
2756 return m->getSource() == xAOD::MuonRoI::Barrel;
2758 thrMonVariables.push_back(l1item_roi_barrel);
2760 return m->getSource() == xAOD::MuonRoI::Endcap;
2762 thrMonVariables.push_back(l1item_roi_endcap);
2764 return m->getSource() == xAOD::MuonRoI::Forward;
2766 thrMonVariables.push_back(l1item_roi_forward);
2768 return m->getThrNumber();
2770 thrMonVariables.push_back(l1item_roi_thrNumber);
2773 return (m->getSource()==xAOD::MuonRoI::Barrel)?(m->isMoreCandInRoI()):(-1);
2775 thrMonVariables.push_back(l1item_roi_ismorecand);
2777 return (m->getSource()!=xAOD::MuonRoI::Barrel)?(m->getBW3Coincidence()):(-1);
2779 thrMonVariables.push_back(l1item_roi_bw3coin);
2781 return (m->getSource()!=xAOD::MuonRoI::Barrel)?(m->getInnerCoincidence()):(-1);
2783 thrMonVariables.push_back(l1item_roi_innercoin);
2785 return (m->getSource()!=xAOD::MuonRoI::Barrel)?(m->getGoodMF()):(-1);
2787 thrMonVariables.push_back(l1item_roi_goodmf);
2802 std::map<const xAOD::Muon*, std::set<std::string>> map_muon_and_tgchits;
2803 if(tgcPrd.
isValid() && muonMgr!=
nullptr){
2806 std::vector < TGC::TgcHit > tgcHits;
2807 std::map<std::string, std::vector<TGC::TgcHit>> tgcHitsMap;
2808 for (
const auto tgccnt : *tgcPrd) {
2809 for (
const auto data : *tgccnt) {
2819 const int bcmask =
data->getBcBitMap();
2821 shortWidth,longWidth,
length,
2824 if(extpositions.find(tgcHit.
cham_name())!=extpositions.end()){
2825 for(
auto& cham : extpositions[tgcHit.
cham_name()]){
2826 double newX = cham.extPos.x() + cham.extVec.x() / cham.extVec.z() * ( tgcHit.
Z() - cham.extPos.z() );
2827 double newY = cham.extPos.y() + cham.extVec.y() / cham.extVec.z() * ( tgcHit.
Z() - cham.extPos.z() );
2831 double chamPhi = detEle->
center().phi();
2832 TVector2 extPos(newX,newY);
2833 TVector2 hitPos(tgcHit.
X(),tgcHit.
Y());
2834 TVector2 rot_extPos = extPos.Rotate(-chamPhi +
M_PI/2.);
2835 TVector2 rot_hitPos = hitPos.Rotate(-chamPhi +
M_PI/2.);
2836 double res = (tgcHit.
isStrip())?
std::sin( rot_extPos.DeltaPhi( rot_hitPos ) ) * rot_extPos.Mod(): rot_hitPos.Y() - rot_extPos.Y();
2839 cham.chambersHasHit.insert(tgcHit.
type_name());
2840 map_muon_and_tgchits[cham.muon].insert(tgcHit.
channel_name());
2844 tgcHits.push_back(tgcHit);
2845 tgcHitsMap[tgcHit.
cham_name() + ( (tgcHit.
isStrip())?(
"S"):(
"W") )].push_back(tgcHit);
2846 tgcHitsMap[tgcHit.
type_name()].push_back(tgcHit);
2850 std::map<std::string, std::vector<int>> tgcHitPhiMap;
2851 std::map<std::string, std::vector<int>> tgcHitEtaMap;
2852 std::map<std::string, std::vector<int>> tgcHitPhiMapGlobal;
2853 std::map<std::string, std::vector<int>> tgcHitPhiMapOnline;
2854 std::map<std::string, std::vector<int>> tgcHitEtaMapOnline;
2855 std::map<std::string, std::vector<int>> tgcHitPhiMapGlobalOnline;
2856 std::map<std::string, std::vector<int>> tgcHitTiming;
2857 std::map<std::string, std::vector<int>> tgcHitPhiMapGlobalWithTrack;
2858 std::map<std::string, std::vector<int>> tgcHitTimingWithTrack;
2859 std::map<const std::string, std::vector<TGC::TgcHit>> tgcHitBCMaskMap;
2860 std::vector <int> vec_bw24sectors;
2861 std::vector <int> vec_bw24sectors_wire;
2862 std::vector <int> vec_bw24sectors_strip;
2863 std::vector <int> vec_bwfulleta;
2864 std::vector <int> vec_bwfulleta_wire;
2865 std::vector <int> vec_bwfulleta_strip;
2866 std::vector <int> vec_bwtiming;
2867 std::vector <int> vec_bwtiming_wire;
2868 std::vector <int> vec_bwtiming_strip;
2869 std::vector <int> vec_bw24sectors_wTrack;
2870 std::vector <int> vec_bw24sectors_wire_wTrack;
2871 std::vector <int> vec_bw24sectors_strip_wTrack;
2872 std::vector <int> vec_bwfulleta_wTrack;
2873 std::vector <int> vec_bwfulleta_wire_wTrack;
2874 std::vector <int> vec_bwfulleta_strip_wTrack;
2875 std::vector <int> vec_bwtiming_wTrack;
2876 std::vector <int> vec_bwtiming_wire_wTrack;
2877 std::vector <int> vec_bwtiming_strip_wTrack;
2878 for(
const auto& tgcHit : tgcHits){
2879 bool hasAssociatedGoodMuonTrack =
false;
2880 for(
const auto&
res : tgcHit.residuals()){
2882 if(map_muon_and_tgchits[
muon].
find(tgcHit.channel_name()) == map_muon_and_tgchits[
muon].
end())
continue;
2885 for(
const auto& chamHasHit : map_muon_and_tgchits[
muon]){
2886 if( chamHasHit.find(tgcHit.gap_name()) != std::string::npos )
continue;
2887 if( chamHasHit.find(
"M04") != std::string::npos )
continue;
2888 if( chamHasHit.find(
'W') != std::string::npos ) nWhits++;
2889 if( chamHasHit.find(
'S') != std::string::npos ) nShits++;
2893 hasAssociatedGoodMuonTrack =
true;
2901 if(hasAssociatedGoodMuonTrack) tgcHitBCMaskMap[tgcHit.channel_name()].push_back(tgcHit);
2904 int phimap_index = 0;
2905 int etamap_index = 0;
2906 int phimap_global_index = 0;
2907 m_tgcMonTool->getMapIndex(tgcHit,etamap_index,phimap_index,phimap_global_index );
2908 int phimap_index_online = 0;
2909 int etamap_index_online = 0;
2910 int phimap_global_index_online = 0;
2911 m_tgcMonTool->getMapIndexOnline(tgcHit.type_name(),etamap_index_online,phimap_index_online,phimap_global_index_online );
2912 std::string wire_or_strip = (tgcHit.type_name().size()==16) ? Form(
"%c_%s",tgcHit.type_name()[0],(tgcHit.type_name()[15]==
'W')?(
"wire"):(
"strip")) :
"null";
2913 for(
int bunch = -1 ; bunch <= +1 ; bunch++){
2919 tgcHitPhiMapGlobal[
station_name].push_back(phimap_global_index);
2921 tgcHitPhiMapOnline[wire_or_strip].push_back(phimap_index_online);
2922 tgcHitEtaMapOnline[wire_or_strip].push_back(etamap_index_online);
2923 tgcHitPhiMapGlobalOnline[wire_or_strip].push_back(phimap_global_index_online);
2924 if(hasAssociatedGoodMuonTrack){
2925 tgcHitPhiMapGlobalWithTrack[
station_name].push_back(phimap_global_index);
2931 vec_bwfulleta.push_back(tgcHit.iEta());
2932 vec_bwtiming.push_back(bunch);
2933 if(hasAssociatedGoodMuonTrack){
2934 vec_bw24sectors_wTrack.push_back((tgcHit.iSide()==
TGC::TGCSIDE::TGCASIDE)?(tgcHit.iSec()):(-tgcHit.iSec()));
2935 vec_bwfulleta_wTrack.push_back(tgcHit.iEta());
2936 vec_bwtiming_wTrack.push_back(bunch);
2938 if(tgcHit.isStrip()){
2939 vec_bw24sectors_strip.push_back((tgcHit.iSide()==
TGC::TGCSIDE::TGCASIDE)?(tgcHit.iSec()):(-tgcHit.iSec()));
2940 vec_bwfulleta_strip.push_back(tgcHit.iEta());
2941 vec_bwtiming_strip.push_back(bunch);
2942 if(hasAssociatedGoodMuonTrack){
2943 vec_bw24sectors_strip_wTrack.push_back((tgcHit.iSide()==
TGC::TGCSIDE::TGCASIDE)?(tgcHit.iSec()):(-tgcHit.iSec()));
2944 vec_bwfulleta_strip_wTrack.push_back(tgcHit.iEta());
2945 vec_bwtiming_strip_wTrack.push_back(bunch);
2948 vec_bw24sectors_wire.push_back((tgcHit.iSide()==
TGC::TGCSIDE::TGCASIDE)?(tgcHit.iSec()):(-tgcHit.iSec()));
2949 vec_bwfulleta_wire.push_back(tgcHit.iEta());
2950 vec_bwtiming_wire.push_back(bunch);
2951 if(hasAssociatedGoodMuonTrack){
2952 vec_bw24sectors_wire_wTrack.push_back((tgcHit.iSide()==
TGC::TGCSIDE::TGCASIDE)?(tgcHit.iSec()):(-tgcHit.iSec()));
2953 vec_bwfulleta_wire_wTrack.push_back(tgcHit.iEta());
2954 vec_bwtiming_wire_wTrack.push_back(bunch);
2964 hit_variables.push_back(mon_bcid);
2965 hit_variables.push_back(mon_pileup);
2966 hit_variables.push_back(mon_lb);
2969 hit_variables.push_back(hit_n);
2972 hit_variables.push_back(hit_bcmask);
2975 hit_variables.push_back(hit_sideA);
2978 hit_variables.push_back(hit_sideC);
2981 hit_variables.push_back(hit_bw24sectors);
2982 auto hit_bw24sectors_strip=
Monitored::Collection(
"hit_bw24sectors_strip",vec_bw24sectors_strip,[](
const int&
m){
return m;});
2983 hit_variables.push_back(hit_bw24sectors_strip);
2984 auto hit_bw24sectors_wire=
Monitored::Collection(
"hit_bw24sectors_wire",vec_bw24sectors_wire,[](
const int&
m){
return m;});
2985 hit_variables.push_back(hit_bw24sectors_wire);
2987 hit_variables.push_back(hit_bwfulleta);
2988 auto hit_bwfulleta_strip=
Monitored::Collection(
"hit_bwfulleta_strip",vec_bwfulleta_strip,[](
const int&
m){
return m;});
2989 hit_variables.push_back(hit_bwfulleta_strip);
2990 auto hit_bwfulleta_wire=
Monitored::Collection(
"hit_bwfulleta_wire",vec_bwfulleta_wire,[](
const int&
m){
return m;});
2991 hit_variables.push_back(hit_bwfulleta_wire);
2993 hit_variables.push_back(hit_bwtiming);
2994 auto hit_bwtiming_strip=
Monitored::Collection(
"hit_bwtiming_strip",vec_bwtiming_strip,[](
const int&
m){
return m;});
2995 hit_variables.push_back(hit_bwtiming_strip);
2996 auto hit_bwtiming_wire=
Monitored::Collection(
"hit_bwtiming_wire",vec_bwtiming_wire,[](
const int&
m){
return m;});
2997 hit_variables.push_back(hit_bwtiming_wire);
2999 auto hit_bw24sectors_wTrack=
Monitored::Collection(
"hit_bw24sectors_wTrack",vec_bw24sectors_wTrack,[](
const int&
m){
return m;});
3000 hit_variables.push_back(hit_bw24sectors_wTrack);
3001 auto hit_bw24sectors_strip_wTrack=
Monitored::Collection(
"hit_bw24sectors_strip_wTrack",vec_bw24sectors_strip_wTrack,[](
const int&
m){
return m;});
3002 hit_variables.push_back(hit_bw24sectors_strip_wTrack);
3003 auto hit_bw24sectors_wire_wTrack=
Monitored::Collection(
"hit_bw24sectors_wire_wTrack",vec_bw24sectors_wire_wTrack,[](
const int&
m){
return m;});
3004 hit_variables.push_back(hit_bw24sectors_wire_wTrack);
3005 auto hit_bwfulleta_wTrack=
Monitored::Collection(
"hit_bwfulleta_wTrack",vec_bwfulleta_wTrack,[](
const int&
m){
return m;});
3006 hit_variables.push_back(hit_bwfulleta_wTrack);
3007 auto hit_bwfulleta_strip_wTrack=
Monitored::Collection(
"hit_bwfulleta_strip_wTrack",vec_bwfulleta_strip_wTrack,[](
const int&
m){
return m;});
3008 hit_variables.push_back(hit_bwfulleta_strip_wTrack);
3009 auto hit_bwfulleta_wire_wTrack=
Monitored::Collection(
"hit_bwfulleta_wire_wTrack",vec_bwfulleta_wire_wTrack,[](
const int&
m){
return m;});
3010 hit_variables.push_back(hit_bwfulleta_wire_wTrack);
3011 auto hit_bwtiming_wTrack=
Monitored::Collection(
"hit_bwtiming_wTrack",vec_bwtiming_wTrack,[](
const int&
m){
return m;});
3012 hit_variables.push_back(hit_bwtiming_wTrack);
3013 auto hit_bwtiming_strip_wTrack=
Monitored::Collection(
"hit_bwtiming_strip_wTrack",vec_bwtiming_strip_wTrack,[](
const int&
m){
return m;});
3014 hit_variables.push_back(hit_bwtiming_strip_wTrack);
3015 auto hit_bwtiming_wire_wTrack=
Monitored::Collection(
"hit_bwtiming_wire_wTrack",vec_bwtiming_wire_wTrack,[](
const int&
m){
return m;});
3016 hit_variables.push_back(hit_bwtiming_wire_wTrack);
3018 std::vector<Monitored::ObjectsCollection<std::vector<int>,
double>> varowner;
3019 varowner.reserve(tgcHitPhiMap.size() * 2 + tgcHitPhiMapGlobal.size() * 2 + tgcHitPhiMapOnline.size() * 3 + tgcHitPhiMapGlobalWithTrack.size() * 2);
3020 for (
const auto &phimap : tgcHitPhiMap) {
3021 varowner.push_back(
Monitored::Collection(Form(
"hit_x_%s",phimap.first.data()),tgcHitEtaMap[phimap.first],[](
const int&
m){return m;}));
3022 hit_variables.push_back(varowner.back());
3023 varowner.push_back(
Monitored::Collection(Form(
"hit_y_%s", phimap.first.data()),phimap.second,[](
const int&
m){return m;}));
3024 hit_variables.push_back(varowner.back());
3026 for (
const auto &phimap : tgcHitPhiMapOnline) {
3027 varowner.push_back(
Monitored::Collection(Form(
"hit_online_x_%s",phimap.first.data()),tgcHitEtaMapOnline[phimap.first],[](
const int&
m){return m;}));
3028 hit_variables.push_back(varowner.back());
3029 varowner.push_back(
Monitored::Collection(Form(
"hit_online_y_%s", phimap.first.data()),phimap.second,[](
const int&
m){return m;}));
3030 hit_variables.push_back(varowner.back());
3031 varowner.push_back(
Monitored::Collection(Form(
"hit_online_glblphi_%s", phimap.first.data()),tgcHitPhiMapGlobalOnline[phimap.first],[](
const int&
m){return m;}));
3032 hit_variables.push_back(varowner.back());
3035 for (
const auto &phimap : tgcHitPhiMapGlobal) {
3036 varowner.push_back(
Monitored::Collection(Form(
"hit_glblphi_%s", phimap.first.data()),phimap.second,[](
const int&
m){return m;}));
3037 hit_variables.push_back(varowner.back());
3038 varowner.push_back(
Monitored::Collection(Form(
"hit_bunch_%s", phimap.first.data()),tgcHitTiming[phimap.first],[](
const int&
m){return m;}));
3039 hit_variables.push_back(varowner.back());
3041 for (
const auto &phimap : tgcHitPhiMapGlobalWithTrack) {
3042 varowner.push_back(
Monitored::Collection(Form(
"hit_glblphi_wTrack_%s", phimap.first.data()),phimap.second,[](
const int&
m){return m;}));
3043 hit_variables.push_back(varowner.back());
3044 varowner.push_back(
Monitored::Collection(Form(
"hit_bunch_wTrack_%s", phimap.first.data()),tgcHitTimingWithTrack[phimap.first],[](
const int&
m){return m;}));
3045 hit_variables.push_back(varowner.back());
3049 std::map<std::string, std::vector<int>> tgcHitBCMaskGlobalIndex;
3050 std::map<std::string, std::vector<int>> tgcHitBCMask;
3051 std::map<std::string, std::vector<int>> tgcHitBCMaskBWSectors;
3052 std::map<std::string, std::vector<int>> tgcHitBCMaskForBWSectors;
3053 for(
const auto& channelNameAndBCMask : tgcHitBCMaskMap){
3055 std::string chamberNameWithWS = channelNameAndBCMask.first.substr(0,16);
3056 int thisChannel =
std::atoi( channelNameAndBCMask.first.substr(18,3).data() );
3057 std::string prev1ChannelName = Form(
"%sCh%03d",chamberNameWithWS.data(),thisChannel-1);
3058 std::string next1ChannelName = Form(
"%sCh%03d",chamberNameWithWS.data(),thisChannel+1);
3060 if(tgcHitBCMaskMap.find(prev1ChannelName)!=tgcHitBCMaskMap.end())
continue;
3061 if(tgcHitBCMaskMap.find(next1ChannelName)!=tgcHitBCMaskMap.end())
continue;
3062 std::string cham_name = channelNameAndBCMask.first.substr(0,12);
3063 int iLay =
std::atoi( channelNameAndBCMask.first.substr(13,2).data() );
3065 int phimap_index = 0;
3066 int etamap_index = 0;
3067 int phimap_global_index = 0;
3068 if(!
m_tgcMonTool->getMapIndex(cham,iLay,etamap_index,phimap_index,phimap_global_index ))
continue;
3070 for(
const auto& tgcHit : channelNameAndBCMask.second){
3071 tgcHitBCMaskGlobalIndex[
station_name].push_back(phimap_global_index);
3075 tgcHitBCMaskForBWSectors[
"All"].push_back(tgcHit.bcmask());
3076 if(chamberNameWithWS.find(
'W')!=std::string::npos){
3078 tgcHitBCMaskForBWSectors[
"Wire"].push_back(tgcHit.bcmask());
3081 tgcHitBCMaskForBWSectors[
"Strip"].push_back(tgcHit.bcmask());
3086 std::vector<Monitored::ObjectsCollection<std::vector<int>,
double>> varowner_bcmask;
3087 varowner_bcmask.reserve(tgcHitBCMask.size() * 2 + tgcHitBCMaskBWSectors.size() * 2);
3088 for(
const auto& chamType : tgcHitBCMaskBWSectors){
3089 varowner_bcmask.push_back(
Monitored::Collection(Form(
"hit_bcmask_bw24sectors_%s",chamType.first.data()),chamType.second,[](
const int&
m){return m;}));
3090 hit_variables.push_back(varowner_bcmask.back());
3091 varowner_bcmask.push_back(
Monitored::Collection(Form(
"hit_bcmask_for_bw24sectors_%s",chamType.first.data()),tgcHitBCMaskForBWSectors[chamType.first],[](
const int&
m){return m;}));
3092 hit_variables.push_back(varowner_bcmask.back());
3094 for(
const auto& stationNameAndBCMask : tgcHitBCMask){
3095 varowner_bcmask.push_back(
Monitored::Collection(Form(
"hit_bcmask_glblphi_%s",stationNameAndBCMask.first.data()),tgcHitBCMaskGlobalIndex[stationNameAndBCMask.first],[](
const int&
m){return m;}));
3096 hit_variables.push_back(varowner_bcmask.back());
3097 varowner_bcmask.push_back(
Monitored::Collection(Form(
"hit_bcmask_%s",stationNameAndBCMask.first.data()),stationNameAndBCMask.second,[](
const int&
m){return m;}));
3098 hit_variables.push_back(varowner_bcmask.back());
3103 std::map<std::string, std::vector<double>> tgcEffPhiMap_Denominator;
3104 std::map<std::string, std::vector<double>> tgcEffEtaMap_Denominator;
3105 std::map<std::string, std::vector<double>> tgcEffPhiMapGlobal_Denominator;
3106 std::map<std::string, std::vector<double>> tgcEffPhiMap_Numerator;
3107 std::map<std::string, std::vector<double>> tgcEffEtaMap_Numerator;
3108 std::map<std::string, std::vector<double>> tgcEffPhiMapGlobal_Numerator;
3109 std::map<std::string, std::vector<double>> tgcEffPhiMapOnline_Denominator;
3110 std::map<std::string, std::vector<double>> tgcEffEtaMapOnline_Denominator;
3111 std::map<std::string, std::vector<double>> tgcEffPhiMapGlobalOnline_Denominator;
3112 std::map<std::string, std::vector<double>> tgcEffPhiMapOnline_Numerator;
3113 std::map<std::string, std::vector<double>> tgcEffEtaMapOnline_Numerator;
3114 std::map<std::string, std::vector<double>> tgcEffPhiMapGlobalOnline_Numerator;
3115 std::map<std::string, std::vector<double>> tgcEffMapExtX;
3116 std::map<std::string, std::vector<double>> tgcEffMapExtY;
3117 std::map<std::string, std::vector<double>> tgcEffMapHasHit;
3118 for(
const auto& exts : extpositions){
3119 const std::string& cham_name = exts.first;
3124 for(
const auto&
ext : exts.second){
3127 for(
int iLay = 1 ; iLay <= 3 ; iLay++){
3128 int phimap_index = 0;
3129 int etamap_index = 0;
3130 int phimap_global_index = 0;
3131 if(!
m_tgcMonTool->getMapIndex(cham,iLay,etamap_index,phimap_index,phimap_global_index ))
continue;
3133 double newX = extPosLocal.x() - extVecLocal.x() / extVecLocal.z() * extPosLocal.z();
3134 double newY = extPosLocal.y() - extVecLocal.y() / extVecLocal.z() * extPosLocal.z();
3135 for(
int iSorW = 0 ; iSorW < 2 ; iSorW++){
3136 if(cham.
iM()==1 && iLay==2 && iSorW==0)
continue;
3137 std::string gap_name = Form(
"%sL%02d",cham_name.data(),iLay);
3138 std::string type_name = Form(
"%sL%02d%s",cham_name.data(),iLay,(iSorW==0)?(
"S"):(
"W"));
3141 for(
const auto& chamHasHit : map_muon_and_tgchits[
ext.muon]){
3142 if( chamHasHit.find(gap_name) != std::string::npos )
continue;
3143 if( chamHasHit.find(
"M04") != std::string::npos )
continue;
3144 if( chamHasHit.find(
'W') != std::string::npos ) nWhits++;
3145 if( chamHasHit.find(
'S') != std::string::npos ) nShits++;
3150 int phimap_index_online = 0;
3151 int etamap_index_online = 0;
3152 int phimap_global_index_online = 0;
3153 m_tgcMonTool->getMapIndexOnline(type_name,etamap_index_online,phimap_index_online,phimap_global_index_online );
3154 std::string wire_or_strip = (type_name.size()==16) ? Form(
"%c_%s",type_name[0],(type_name[15]==
'W')?(
"wire"):(
"strip")) : (
"null");
3155 tgcEffPhiMap_Denominator[
station_name].push_back(phimap_index);
3156 tgcEffEtaMap_Denominator[
station_name].push_back(etamap_index);
3157 tgcEffPhiMapGlobal_Denominator[
station_name].push_back(phimap_global_index);
3158 tgcEffPhiMapOnline_Denominator[wire_or_strip].push_back(phimap_index_online);
3159 tgcEffEtaMapOnline_Denominator[wire_or_strip].push_back(etamap_index_online);
3160 tgcEffPhiMapGlobalOnline_Denominator[wire_or_strip].push_back(phimap_global_index_online);
3161 tgcEffMapExtX[type_name].push_back(newX);
3162 tgcEffMapExtY[type_name].push_back(newY);
3163 double hitExist = 0;
3164 if(
ext.chambersHasHit.find(type_name) !=
ext.chambersHasHit.end()) hitExist=1;
3165 tgcEffPhiMap_Numerator[
station_name].push_back(hitExist);
3166 tgcEffEtaMap_Numerator[
station_name].push_back(hitExist);
3167 tgcEffPhiMapGlobal_Numerator[
station_name].push_back(hitExist);
3168 tgcEffPhiMapOnline_Numerator[wire_or_strip].push_back(hitExist);
3169 tgcEffEtaMapOnline_Numerator[wire_or_strip].push_back(hitExist);
3170 tgcEffPhiMapGlobalOnline_Numerator[wire_or_strip].push_back(hitExist);
3171 tgcEffMapHasHit[type_name].push_back(hitExist);
3178 std::vector<Monitored::ObjectsCollection<std::vector<double>,
double>> varowner_hiteff;
3179 std::vector<Monitored::ObjectsCollection<std::vector<TGC::TgcHit>,
double>> varowner_eachchamber;
3180 std::vector<Monitored::ObjectsCollection<std::vector<double>,
double>> varowner_eachchamber_double;
3181 std::map<std::string,std::vector<double>> cham_and_res;
3186 varowner_hiteff.reserve(tgcEffPhiMap_Denominator.size() * 4 + tgcEffPhiMapGlobal_Denominator.size() * 2 + tgcEffMapHasHit.size() * 3 + tgcEffPhiMapOnline_Denominator.size() * 6);
3187 for (
const auto &phimap : tgcEffPhiMap_Denominator) {
3188 varowner_hiteff.push_back(
Monitored::Collection(Form(
"hit_effden_x_%s",phimap.first.data()),tgcEffEtaMap_Denominator[phimap.first],[](
const double&
m){return m;}));
3189 hit_variables.push_back(varowner_hiteff.back());
3190 varowner_hiteff.push_back(
Monitored::Collection(Form(
"hit_effden_y_%s", phimap.first.data()),tgcEffPhiMap_Denominator[phimap.first],[](
const double&
m){return m;}));
3191 hit_variables.push_back(varowner_hiteff.back());
3192 varowner_hiteff.push_back(
Monitored::Collection(Form(
"hit_effnum_x_%s",phimap.first.data()),tgcEffEtaMap_Numerator[phimap.first],[](
const double&
m){return m;}));
3193 hit_variables.push_back(varowner_hiteff.back());
3194 varowner_hiteff.push_back(
Monitored::Collection(Form(
"hit_effnum_y_%s", phimap.first.data()),tgcEffPhiMap_Numerator[phimap.first],[](
const double&
m){return m;}));
3195 hit_variables.push_back(varowner_hiteff.back());
3197 for (
const auto &phimap : tgcEffPhiMapGlobal_Denominator) {
3198 varowner_hiteff.push_back(
Monitored::Collection(Form(
"hit_glblphi_effden_%s", phimap.first.data()),tgcEffPhiMapGlobal_Denominator[phimap.first],[](
const double&
m){return m;}));
3199 hit_variables.push_back(varowner_hiteff.back());
3200 varowner_hiteff.push_back(
Monitored::Collection(Form(
"hit_glblphi_effnum_%s", phimap.first.data()),tgcEffPhiMapGlobal_Numerator[phimap.first],[](
const double&
m){return m;}));
3201 hit_variables.push_back(varowner_hiteff.back());
3203 for (
const auto &phimap : tgcEffPhiMapOnline_Denominator) {
3204 varowner_hiteff.push_back(
Monitored::Collection(Form(
"hit_online_effden_x_%s",phimap.first.data()),tgcEffEtaMapOnline_Denominator[phimap.first],[](
const double&
m){return m;}));
3205 hit_variables.push_back(varowner_hiteff.back());
3206 varowner_hiteff.push_back(
Monitored::Collection(Form(
"hit_online_effden_y_%s", phimap.first.data()),tgcEffPhiMapOnline_Denominator[phimap.first],[](
const double&
m){return m;}));
3207 hit_variables.push_back(varowner_hiteff.back());
3208 varowner_hiteff.push_back(
Monitored::Collection(Form(
"hit_online_effnum_x_%s",phimap.first.data()),tgcEffEtaMapOnline_Numerator[phimap.first],[](
const double&
m){return m;}));
3209 hit_variables.push_back(varowner_hiteff.back());
3210 varowner_hiteff.push_back(
Monitored::Collection(Form(
"hit_online_effnum_y_%s", phimap.first.data()),tgcEffPhiMapOnline_Numerator[phimap.first],[](
const double&
m){return m;}));
3211 hit_variables.push_back(varowner_hiteff.back());
3212 varowner_hiteff.push_back(
Monitored::Collection(Form(
"hit_online_glblphi_effden_%s", phimap.first.data()),tgcEffPhiMapGlobalOnline_Denominator[phimap.first],[](
const double&
m){return m;}));
3213 hit_variables.push_back(varowner_hiteff.back());
3214 varowner_hiteff.push_back(
Monitored::Collection(Form(
"hit_online_glblphi_effnum_%s", phimap.first.data()),tgcEffPhiMapGlobalOnline_Numerator[phimap.first],[](
const double&
m){return m;}));
3215 hit_variables.push_back(varowner_hiteff.back());
3217 for(
const auto& hiteffmap : tgcEffMapHasHit){
3218 varowner_hiteff.push_back(
Monitored::Collection(Form(
"hit_localX_effden_%s", hiteffmap.first.data()),tgcEffMapExtX[hiteffmap.first],[](
const double&
m){return m;}));
3219 hit_variables.push_back(varowner_hiteff.back());
3220 varowner_hiteff.push_back(
Monitored::Collection(Form(
"hit_localY_effden_%s", hiteffmap.first.data()),tgcEffMapExtY[hiteffmap.first],[](
const double&
m){return m;}));
3221 hit_variables.push_back(varowner_hiteff.back());
3222 varowner_hiteff.push_back(
Monitored::Collection(Form(
"hit_effnum_%s", hiteffmap.first.data()),tgcEffMapHasHit[hiteffmap.first],[](
const double&
m){return m;}));
3223 hit_variables.push_back(varowner_hiteff.back());
3226 ATH_MSG_DEBUG(
"gap-by-gap occupancy plots and residual plots");
3227 varowner_eachchamber.reserve(tgcHitsMap.size());
3228 varowner_eachchamber_double.reserve(tgcHitsMap.size());
3229 for (
const auto &tgcHitMap : tgcHitsMap) {
3230 auto chanName = tgcHitMap.first;
3231 if(chanName.find(
'L')!=std::string::npos){
3233 hit_variables.push_back(varowner_eachchamber.back());
3235 for(
const auto&tgcHit:tgcHitMap.second){
3236 for(
const auto&tgcRes:tgcHit.residuals()){
3237 cham_and_res[chanName].push_back(tgcRes.second);
3240 varowner_eachchamber_double.push_back(
Monitored::Collection(Form(
"hit_residual_on_%s",chanName.data()),cham_and_res[chanName],[](
const double&
m){return m;}));
3241 hit_variables.push_back(varowner_eachchamber_double.back());
3260 ATH_MSG_DEBUG(
"Filling histograms for MuonRoIs in thresholdPattern");
3280 std::vector<const xAOD::MuonRoI*> passed_rois;
3281 for(
const auto& allBcMuonRoI : AllBCMuonRoIs){
3282 if(allBcMuonRoI.timing!=0)
continue;
3287 passed_rois.push_back(roi);
3289 if(roiAndMenu.count(roi)==0){
3290 std::set<std::string>
items;
3291 roiAndMenu.insert(std::make_pair(roi,
items));
3293 roiAndMenu[roi].insert(
item);
3296 menuAndRoIs.insert(std::make_pair(
item,passed_rois));
3299 ATH_MSG_DEBUG(
"End filling histograms for MuonRoIs in thresholdPattern");