22 constexpr
double barrel_end = 1.05;
23 constexpr
double eifi_boundary = 1.3;
24 constexpr
double endcap_end = 1.9;
25 constexpr
double trigger_end = 2.4;
28 constexpr
int number_of_trigger_sectors_endcap = 48;
29 constexpr
int number_of_trigger_sectors_forward = 24;
32 constexpr
double tgc_coin_phi_small_offset = 0.0001;
35 constexpr
double nsw_rmax = 5000;
36 constexpr
double nsw_rmin = 900;
37 constexpr
double nsw_z = 7824.46;
38 constexpr
double nsw_rindex_div = 255;
39 constexpr
double nsw_rindex_step = ( nsw_rmax - nsw_rmin ) / nsw_rindex_div;
86 std::unique_ptr<TObjArray> monTrigs( Str.Tokenize(
";") );
87 for(
int i = 0 ;
i < monTrigs->GetEntries() ;
i++){
88 TString monTrig = monTrigs->At(
i)->GetName();
89 if(monTrig.IsNull())
continue;
94 std::unique_ptr<TObjArray> monElement( monTrig.Tokenize(
",") );
95 for(
int j = 0 ; j < monElement->GetEntries() ; j++){
96 std::string sysItem = monElement->At(j)->GetName();
97 if(sysItem.empty())
continue;
98 std::string
item = sysItem.substr(4,sysItem.size());
99 if(sysItem.starts_with(
"Tit")){
101 }
else if(sysItem.starts_with(
"Mul")){
103 }
else if(sysItem.starts_with(
"CTP")|| sysItem.starts_with(
"HLT")){
105 }
else if(sysItem.starts_with(
"RPC")){
107 monObj.
rpcR = (
item.find(
'R')!=std::string::npos);
108 monObj.
rpcM = (
item.find(
'M')!=std::string::npos);
109 }
else if(sysItem.starts_with(
"TGC")){
111 monObj.
tgcF = (
item.find(
'F')!=std::string::npos);
112 monObj.
tgcC = (
item.find(
'C')!=std::string::npos);
113 monObj.
tgcH = (
item.find(
'H')!=std::string::npos);
123 std::unique_ptr<TObjArray> arr( Str.Tokenize(
",") );
124 for(
int i = 0 ;
i < arr->GetEntries() ;
i++){
125 std::string
name = arr->At(
i)->GetName();
126 if(!
name.starts_with(
"MU"))
continue;
136 while(getline(fi,
str)){
144 return StatusCode::SUCCESS;
157 return StatusCode::FAILURE;
159 std::set<std::string> available_muon_triggers;
161 if( chainGroup !=
nullptr ){
162 auto triggerList = chainGroup->getListOfTriggers();
163 if( !triggerList.empty() ){
164 for(
const auto &trig : triggerList) {
165 std::string thisTrig = trig;
166 if( thisTrig.find(
"mu")==std::string::npos && thisTrig.find(
"MU")==std::string::npos)
continue;
169 for(
const auto& comb : fc.getCombinations()){
170 auto initRoIs = comb.get<
TrigRoiDescriptor>(
"initialRoI",TrigDefs::alsoDeactivateTEs);
171 for(
const auto& roi : initRoIs){
172 if( roi.empty() )
continue;
173 if( roi.cptr()==nullptr )
continue;
175 available_muon_triggers.insert(thisTrig);
180 for(
const auto& roiLinkInfo : initialRoIs) {
181 if( !roiLinkInfo.isValid() )
continue;
182 auto roiEL = roiLinkInfo.link;
183 if( !roiEL.isValid() )
continue;
185 if( roi==
nullptr )
continue;
187 available_muon_triggers.insert(thisTrig);
193 for(
const auto& trig : available_muon_triggers){
198 return StatusCode::SUCCESS;
201 std::set<std::string>
205 std::set<std::string> list_of_single_muon_triggers;
208 if( chainGroup !=
nullptr ){
209 auto triggerList = chainGroup->getListOfTriggers();
210 if( !triggerList.empty() ){
211 for(
const auto &trig : triggerList) {
212 if( trig.find(
"HLT_mu") != 0 )
continue;
213 if( trig.find(
'-') != std::string::npos )
continue;
214 if( trig.find(
"L1MU") == std::string::npos )
continue;
215 if( trig.find(
"mu") != trig.rfind(
"mu") )
continue;
216 if( trig.find(
"MU") != trig.rfind(
"MU") )
continue;
217 list_of_single_muon_triggers.insert( trig );
222 return list_of_single_muon_triggers;
230 if(primVtxContainer.
isValid()){
231 for(
const auto vtx : *primVtxContainer){
242 std::vector<TgcRawDataMonitorAlgorithm::TimedMuonRoI>
244 std::vector<TimedMuonRoI> AllBCMuonRoIs;
252 for(
const auto roi : *handle.
cptr()){
253 isRun3 = roi->isRun3();
255 AllBCMuonRoIs.push_back(myMuonRoI);
263 for(
const auto roi : *handle.
cptr()){
265 AllBCMuonRoIs.push_back(myMuonRoI);
272 for(
const auto roi : *handle.
cptr()){
274 AllBCMuonRoIs.push_back(myMuonRoI);
281 for(
const auto roi : *handle.
cptr()){
283 AllBCMuonRoIs.push_back(myMuonRoI);
290 for(
const auto roi : *handle.
cptr()){
292 AllBCMuonRoIs.push_back(myMuonRoI);
298 return AllBCMuonRoIs;
304 if( not roiVec.empty() ){
308 roi_variables.push_back(roi_bcid);
310 roi_variables.push_back(roi_pileup);
312 roi_variables.push_back(roi_lumiBlock);
316 roi_variables.push_back(roi_timing);
320 roi_variables.push_back(roi_currentBC);
324 roi_variables.push_back(roi_previousBC);
328 roi_variables.push_back(roi_nextBC);
330 return m.muonRoI->getRoI();
332 roi_variables.push_back(roi_roiNumber);
334 return (
m.muonRoI->getHemisphere() ==
xAOD::MuonRoI::Positive)?(
m.muonRoI->getSectorID()+1):(-1 *
m.muonRoI->getSectorID()-1);
336 roi_variables.push_back(roi_sector);
338 return m.muonRoI->getSectorID()+1;
340 roi_variables.push_back(roi_sectorAbs);
342 return (
m.muonRoI->getBW3Coincidence()) ? ((
m.muonRoI->getHemisphere() ==
xAOD::MuonRoI::Positive)?(
m.muonRoI->getSectorID()+1):(-1 *
m.muonRoI->getSectorID()-1)) : (-999);
344 roi_variables.push_back(roi_sector_wBW3Coin);
346 return (
m.muonRoI->getInnerCoincidence()) ? ((
m.muonRoI->getHemisphere() ==
xAOD::MuonRoI::Positive)?(
m.muonRoI->getSectorID()+1):(-1 *
m.muonRoI->getSectorID()-1)) : (-999);
348 roi_variables.push_back(roi_sector_wInnerCoin);
350 return m.muonRoI->eta();
352 roi_variables.push_back(roi_eta);
356 roi_variables.push_back(roi_eta_rpc);
360 roi_variables.push_back(roi_eta_tgc);
362 return (
m.muonRoI->getSource() !=
xAOD::MuonRoI::Barrel && std::abs(
m.muonRoI->eta()) < 1.3 &&
m.muonRoI->getInnerCoincidence());
364 roi_variables.push_back(roi_wInnerCoinEtaUpTo1p3);
366 return (
m.muonRoI->getSource() !=
xAOD::MuonRoI::Barrel && std::abs(
m.muonRoI->eta()) > 1.3 &&
m.muonRoI->getInnerCoincidence());
368 roi_variables.push_back(roi_wInnerCoinEtaBeyond1p3);
370 return (
m.muonRoI->getInnerCoincidence() &&
m.muonRoI->getSource() !=
xAOD::MuonRoI::Barrel)?(
m.muonRoI->eta()):(-10);
372 roi_variables.push_back(roi_eta_wInnerCoin);
374 return (
m.muonRoI->getBW3Coincidence() &&
m.muonRoI->getSource() !=
xAOD::MuonRoI::Barrel)?(
m.muonRoI->eta()):(-10);
376 roi_variables.push_back(roi_eta_wBW3Coin);
378 return (!
m.muonRoI->getInnerCoincidence() &&
m.muonRoI->getSource() !=
xAOD::MuonRoI::Barrel)?(
m.muonRoI->eta()):(-10);
380 roi_variables.push_back(roi_eta_wInnerCoinVeto);
382 return (!
m.muonRoI->getBW3Coincidence() &&
m.muonRoI->getSource() !=
xAOD::MuonRoI::Barrel)?(
m.muonRoI->eta()):(-10);
384 roi_variables.push_back(roi_eta_wBW3CoinVeto);
386 return m.muonRoI->phi();
388 roi_variables.push_back(roi_phi);
392 roi_variables.push_back(roi_phi_sideA);
396 roi_variables.push_back(roi_phi_sideC);
400 roi_variables.push_back(roi_phi_rpc);
404 roi_variables.push_back(roi_phi_tgc);
406 return (
m.muonRoI->getInnerCoincidence() &&
m.muonRoI->getSource() !=
xAOD::MuonRoI::Barrel)?(
m.muonRoI->phi()):(-10);;
408 roi_variables.push_back(roi_phi_wInnerCoin);
410 return (
m.muonRoI->getBW3Coincidence() &&
m.muonRoI->getSource() !=
xAOD::MuonRoI::Barrel)?(
m.muonRoI->phi()):(-10);;
412 roi_variables.push_back(roi_phi_wBW3Coin);
414 return (!
m.muonRoI->getInnerCoincidence() &&
m.muonRoI->getSource() !=
xAOD::MuonRoI::Barrel)?(
m.muonRoI->phi()):(-10);;
416 roi_variables.push_back(roi_phi_wInnerCoinVeto);
418 return (!
m.muonRoI->getBW3Coincidence() &&
m.muonRoI->getSource() !=
xAOD::MuonRoI::Barrel)?(
m.muonRoI->phi()):(-10);;
420 roi_variables.push_back(roi_phi_wBW3CoinVeto);
424 roi_variables.push_back(roi_phi_wBW3Coin_sideA);
428 roi_variables.push_back(roi_phi_wBW3Coin_sideC);
432 roi_variables.push_back(roi_phi_wBW3CoinVeto_sideA);
436 roi_variables.push_back(roi_phi_wBW3CoinVeto_sideC);
438 return m.muonRoI->getThrNumber();
440 roi_variables.push_back(roi_thr);
444 roi_variables.push_back(roi_rpc);
448 roi_variables.push_back(roi_tgc);
452 roi_variables.push_back(roi_barrel);
456 roi_variables.push_back(roi_endcap);
460 roi_variables.push_back(roi_forward);
464 roi_variables.push_back(roi_phi_barrel);
468 roi_variables.push_back(roi_phi_endcap);
472 roi_variables.push_back(roi_phi_forward);
476 roi_variables.push_back(roi_sideA);
480 roi_variables.push_back(roi_sideC);
482 return m.muonRoI->getThrNumber() == 1;
484 roi_variables.push_back(thrmask1);
486 return m.muonRoI->getThrNumber() == 2;
488 roi_variables.push_back(thrmask2);
490 return m.muonRoI->getThrNumber() == 3;
492 roi_variables.push_back(thrmask3);
494 return m.muonRoI->getThrNumber() == 4;
496 roi_variables.push_back(thrmask4);
498 return m.muonRoI->getThrNumber() == 5;
500 roi_variables.push_back(thrmask5);
502 return m.muonRoI->getThrNumber() == 6;
504 roi_variables.push_back(thrmask6);
506 return m.muonRoI->getThrNumber() == 7;
508 roi_variables.push_back(thrmask7);
510 return m.muonRoI->getThrNumber() == 8;
512 roi_variables.push_back(thrmask8);
514 return m.muonRoI->getThrNumber() == 9;
516 roi_variables.push_back(thrmask9);
518 return m.muonRoI->getThrNumber() == 10;
520 roi_variables.push_back(thrmask10);
522 return m.muonRoI->getThrNumber() == 11;
524 roi_variables.push_back(thrmask11);
526 return m.muonRoI->getThrNumber() == 12;
528 roi_variables.push_back(thrmask12);
530 return m.muonRoI->getThrNumber() == 13;
532 roi_variables.push_back(thrmask13);
534 return m.muonRoI->getThrNumber() == 14;
536 roi_variables.push_back(thrmask14);
538 return m.muonRoI->getThrNumber() == 15;
540 roi_variables.push_back(thrmask15);
544 roi_variables.push_back(roi_charge);
546 return m.muonRoI->getBW3Coincidence();
548 roi_variables.push_back(roi_bw3coin);
552 roi_variables.push_back(roi_bw3coinveto);
554 return m.muonRoI->getInnerCoincidence();
556 roi_variables.push_back(roi_innercoin);
560 roi_variables.push_back(roi_innveto);
562 return m.muonRoI->getGoodMF();
564 roi_variables.push_back(roi_goodmf);
568 roi_variables.push_back(roi_badmf);
570 return m.muonRoI->isMoreCandInRoI();
572 roi_variables.push_back(roi_ismorecand);
576 roi_variables.push_back(roi_posCharge);
580 roi_variables.push_back(roi_negCharge);
590 ATH_MSG_DEBUG(
"Filling histograms for MuonRoIs after trigger decision");
592 std::set<unsigned int> allCands;
593 std::set<unsigned int> ctpMuonCands;
594 std::set<unsigned int> inputMuonCands;
596 bool isRun2Legacy =
false;
599 if(monObj.title.find(
"Run2Legacy")==std::string::npos)
continue;
600 auto fc =
getTrigDecisionTool()->features(monObj.trigItem.data(),TrigDefs::alsoDeactivateTEs);
601 for(
const auto& comb : fc.getCombinations()){
602 auto initRoIs = comb.get<
TrigRoiDescriptor>(
"initialRoI",TrigDefs::alsoDeactivateTEs);
603 for(
const auto& roi : initRoIs){
604 if( roi.empty() )
continue;
605 if( roi.cptr()==nullptr )
continue;
606 ctpMuonCands.insert(roi.cptr()->roiWord());
607 allCands.insert(roi.cptr()->roiWord());
612 for(
const auto& roiLinkInfo : initialRoIs) {
613 if( !roiLinkInfo.isValid() )
continue;
614 auto roiEL = roiLinkInfo.link;
615 if( !roiEL.isValid() )
continue;
617 if( roi==
nullptr )
continue;
618 ctpMuonCands.insert(roi->roiWord());
619 allCands.insert(roi->roiWord());
624 for(
const auto& allBcMuonRoI : roiVec){
634 if(monObj.tgcH && !roi->
getGoodMF())
continue;
636 inputMuonCands.insert(roi->
roiWord());
637 allCands.insert(roi->
roiWord());
639 if(!isRun3 && isRun2Legacy && monObj.title.find(
"Run2Legacy")==std::string::npos)
continue;
640 if(!isRun3 && !isRun2Legacy && (monObj.title.find(
"Run2Legacy")!=std::string::npos||monObj.title.find(
"Run3")!=std::string::npos))
continue;
641 if(isRun3 && monObj.title.find(
"Run3")==std::string::npos)
continue;
643 if(ctpMuonCands.size()==0 && inputMuonCands.size()<monObj.multiplicity)
continue;
645 std::vector<int> roiMatching_CTPin;
646 std::vector<int> roiMatching_CTPout;
648 std::vector<double> roi_Eta;
649 std::vector<double> roi_Phi;
650 std::vector<double> roi_dRmin;
651 std::vector<double> roi_pTdiff;
652 std::vector<int> roi_ThrNum;
653 std::vector<int> roi_Charge;
654 std::vector<int> roi_BW3Coin;
655 std::vector<int> roi_InnerCoin;
656 std::vector<int> roi_GoodMF;
657 std::vector<int> roi_IsMoreCandInRoI;
658 std::vector<int> roi_PhiOverlap;
659 std::vector<int> roi_EtaOverlap;
660 std::vector<int> roi_isVetoed;
661 std::vector<bool> roi_inOk_outOk;
662 std::vector<bool> roi_inOk_outNg;
663 std::vector<bool> roi_inNg_outOk;
665 for(
const auto& allBcMuonRoI : roiVec){
667 bool ctp_in = inputMuonCands.find(roi->
roiWord())!=inputMuonCands.end();
668 bool ctp_out = ctpMuonCands.find(roi->
roiWord())!=ctpMuonCands.end();
669 if(!ctp_in && !ctp_out)
continue;
670 roiMatching_CTPin.push_back(ctp_in?1:0);
671 roiMatching_CTPout.push_back(ctp_out?1:0);
674 for(
const auto& allBcMuonRoI2 : roiVec){
676 if(roi == roi2)
continue;
684 if(dRmin>999) dRmin = -0.05;
685 else if(dRmin>1.0) dRmin = 0.95;
686 roi_Eta.push_back(roi->
eta());
687 roi_Phi.push_back(roi->
phi());
688 roi_dRmin.push_back(dRmin);
689 roi_pTdiff.push_back(pTdiff);
698 roi_isVetoed.push_back(roi->
isVetoed());
699 roi_inOk_outOk.push_back( ctp_in && ctp_out );
700 roi_inOk_outNg.push_back( ctp_in && !ctp_out );
701 roi_inNg_outOk.push_back( !ctp_in && ctp_out );
729 ctpMonVariables.push_back(val_roiMatching_CTPin);
730 ctpMonVariables.push_back(val_roiMatching_CTPout);
731 ctpMonVariables.push_back(val_ctpMultiplicity);
732 ctpMonVariables.push_back(val_rawMultiplicity);
733 ctpMonVariables.push_back(val_countDiff);
734 ctpMonVariables.push_back(val_roi_Eta);
735 ctpMonVariables.push_back(val_roi_Phi);
736 ctpMonVariables.push_back(val_roi_dRmin);
737 ctpMonVariables.push_back(val_roi_pTdiff);
738 ctpMonVariables.push_back(val_roi_ThrNum);
739 ctpMonVariables.push_back(val_roi_Charge);
740 ctpMonVariables.push_back(val_roi_BW3Coin);
741 ctpMonVariables.push_back(val_roi_InnerCoin);
742 ctpMonVariables.push_back(val_roi_GoodMF);
743 ctpMonVariables.push_back(val_roi_IsMoreCandInRoI);
744 ctpMonVariables.push_back(val_roi_PhiOverlap);
745 ctpMonVariables.push_back(val_roi_EtaOverlap);
746 ctpMonVariables.push_back(val_roi_isVetoed);
747 ctpMonVariables.push_back(val_roi_inOk_outOk);
748 ctpMonVariables.push_back(val_roi_inOk_outNg);
749 ctpMonVariables.push_back(val_roi_inNg_outOk);
752 ATH_MSG_DEBUG(
"End filling histograms for MuonRoIs after trigger decision");
766 return StatusCode::FAILURE;
773 return StatusCode::SUCCESS;
780 const bool expressPass =
passBits & TrigDefs::Express_passed;
783 return StatusCode::SUCCESS;
791 return StatusCode::SUCCESS;
801 double primaryVertexZ = (primVertex!=
nullptr)?(primVertex->
z()):(-999);
817 std::map<const xAOD::MuonRoI*,std::set<std::string>> roiAndMenu;
818 std::map<std::string,std::vector<const xAOD::MuonRoI*>> menuAndRoIs;
823 std::vector < const xAOD::Muon* > oflmuons;
824 std::set < const xAOD::Muon* > biasedMuons;
825 std::vector < TimedMuon > mymuons;
826 std::map < std::string, std::vector< ExtPos > > extpositions;
827 std::vector< ExtPos > extpositions_pivot;
828 std::vector<double> deltaR_muons;
829 std::vector<double> deltaR_muons_roi;
830 std::vector<double> deltaR_muons_hlt;
831 std::vector<double> muon2pv_dz;
832 std::vector<double> muon2pv_dca;
833 std::vector<double> mymuon2pv_dz;
834 std::vector<double> mymuon2pv_dca;
839 return StatusCode::SUCCESS;
842 for (
const auto muon : *muons) {
844 if (
muon ==
nullptr)
continue;
846 if (
muon->pt() < 1000.)
continue;
849 if (
muon->muonType() > xAOD::Muon::MuonType::MuonStandAlone )
continue;
851 oflmuons.push_back(
muon);
853 double dz=-999,dca=-999;
859 if(primVertex==
nullptr)
continue;
860 auto trackParticle =
muon->primaryTrackParticle();
861 if(trackParticle!=
nullptr){
862 dz = trackParticle->z0() - primVertex->
z();
863 dca = trackParticle->d0();
865 muon2pv_dz.push_back(dz);
866 muon2pv_dca.push_back(dca);
872 bool isolated =
true;
878 for(
const auto muon2 : *muons){
880 if (muon2 ==
nullptr)
continue;
883 if(
muon == muon2 )
continue;
886 if( muon2->pt() < 1000. )
continue;
890 if ( muon2->muonType() > xAOD::Muon::MuonType::MuonStandAlone )
continue;
894 ( (std::abs(
muon->eta()) < barrel_end && std::abs(muon2->eta()) < barrel_end) ||
895 (std::abs(
muon->eta()) > barrel_end && std::abs(muon2->eta()) > barrel_end) ) )
continue;
899 deltaR_muons.push_back(dr_muons);
910 for (
const auto &trigName : list_of_single_muon_triggers) {
913 const bool expressPass =
passBits & TrigDefs::Express_passed;
914 if(!expressPass)
continue;
918 ATH_MSG_DEBUG(
"This muon trigger, " << trigName <<
", is fired in this event!!");
923 for(
const auto& comb : fc.getCombinations()){
924 if(!comb.active())
continue;
926 for(
const auto& mucont : MuFeatureContainers){
927 if(mucont.empty())
continue;
928 if(mucont.te()==
nullptr)
continue;
929 if(!mucont.te()->getActiveState())
continue;
930 for(
const auto hltmu : *mucont.cptr()){
931 if (hltmu ==
nullptr)
continue;
932 if (hltmu->pt() < 1000.)
continue;
934 deltaR_muons_hlt.push_back(
dr);
938 biasedMuons.insert(muon2);
946 for (
const auto& aaa : features) {
947 if (!aaa.isValid())
continue;
948 auto hltmu_link = aaa.link;
949 if (!hltmu_link.isValid())
continue;
950 auto hltmu = *hltmu_link;
951 if (hltmu ==
nullptr)
continue;
952 if (hltmu->pt() < 1000.)
continue;
954 deltaR_muons_hlt.push_back(
dr);
958 biasedMuons.insert(muon2);
964 if(!probeOK)
continue;
968 double m2 = 2. *
muon->pt() * muon2->pt() * ( std::cosh(
muon->eta() - muon2->eta()) -
std::cos(
muon->phi() - muon2->phi()) );
969 double m = (
m2>0.) ? ( std::sqrt(
m2) ) : (0.);
970 double mdiff = std::abs(
m -
m_zMass );
974 ATH_MSG_DEBUG(
"Final condition of probleOK for this muon is: " << probeOK);
980 if(!probeOK)
continue;
986 if ( std::abs(
muon->eta()) > 0.5
989 if(
muon->eta()<0 &&
z>0 )
continue;
990 if(
muon->eta()>0 &&
z<0 )
continue;
991 xAOD::Muon::TrackParticleType trkPtclType;
999 if(trackParticle==
nullptr)
continue;
1000 auto matrix = std::make_unique<Amg::Transform3D>();
1002 matrix->translation().z() =
z;
1003 auto disc = std::make_unique < Trk::DiscSurface > (*
matrix,
1008 trackParticle->perigeeParameters(),
1013 if(extTrkParams !=
nullptr){
1014 if( std::abs(extTrkParams->position().z() -
z) > 10. )
continue;
1017 ext.extPos = extTrkParams->position();
1018 ext.extVec = extTrkParams->momentum();
1019 Amg::Vector3D extVec(extTrkParams->position().x(),extTrkParams->position().y(),
z);
1022 if( std::abs( std::abs(
z) -
m_M3_Z ) < 10. &&
1023 std::abs(
muon->eta() ) > 1.05 &&
1024 std::abs(
muon->eta() ) < 2.40){
1025 extpositions_pivot.push_back(
ext);
1027 for(
const auto& cham :
ext.passedChambers){
1028 extpositions[cham].push_back(
ext);
1040 if (AllBCMuonRoIs.size()==0) {
1041 ATH_MSG_DEBUG(
"No RoI matching possible as no container has been retrieved");
1042 mymuons.push_back(mymuon);
1045 for(
const auto& allBcMuonRoI : AllBCMuonRoIs){
1048 deltaR_muons_roi.push_back(
dr);
1050 if(roiAndMenu.count(roi)>0)mymuon.
matchedL1Items.insert( roiAndMenu[roi].
begin(), roiAndMenu[roi].
end() );
1061 for (
int ithr = 1; ithr <= 15 ; ++ithr) {
1076 mymuons.push_back(mymuon);
1077 mymuon2pv_dz.push_back(dz);
1078 mymuon2pv_dca.push_back(dca);
1108 oflmuon_num,oflmuon_muonType,oflmuon_author,oflmuon_quality,oflmuon_pt,oflmuon_eta,oflmuon_phi,oflmuon_pvdz,oflmuon_pvdca,
1109 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,
1110 oflmuon_deltaR, oflmuon_deltaR_roi, oflmuon_deltaR_hlt
1116 oflmuon_variables.push_back(oflmuon_num);
1117 oflmuon_variables.push_back(oflmuon_muonType);
1118 oflmuon_variables.push_back(oflmuon_author);
1119 oflmuon_variables.push_back(oflmuon_quality);
1120 oflmuon_variables.push_back(oflmuon_pt);
1121 oflmuon_variables.push_back(oflmuon_eta);
1122 oflmuon_variables.push_back(oflmuon_phi);
1126 return m.muon->charge();
1128 oflmuon_variables.push_back(muon_charge);
1130 return (
m.muon->charge()>0);
1132 oflmuon_variables.push_back(muon_chargePos);
1134 return (
m.muon->charge()<0);
1136 oflmuon_variables.push_back(muon_chargeNeg);
1138 return (
m.muon->pt()>pt_4_cut)?
m.muon->eta():-10;
1140 oflmuon_variables.push_back(muon_eta4gev);
1142 return (
m.muon->pt()>pt_4_cut)?
m.muon->phi():-10;
1144 oflmuon_variables.push_back(muon_phi4gev);
1146 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;
1148 oflmuon_variables.push_back(muon_phi4gev_1p05eta1p3);
1150 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;
1152 oflmuon_variables.push_back(muon_phi4gev_1p05eta1p3A);
1154 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;
1156 oflmuon_variables.push_back(muon_phi4gev_1p05eta1p3C);
1158 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;
1160 oflmuon_variables.push_back(muon_phi4gev_1p3eta2p4);
1162 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;
1164 oflmuon_variables.push_back(muon_phi4gev_1p3eta2p4A);
1166 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;
1168 oflmuon_variables.push_back(muon_phi4gev_1p3eta2p4C);
1170 return (std::abs(
m.muon->eta()) < barrel_end &&
m.muon->pt() > pt_4_cut) ?
m.muon->phi() : -10;
1172 oflmuon_variables.push_back(muon_phi4gev_rpc);
1174 return (std::abs(
m.muon->eta()) < barrel_end &&
m.muon->pt() > pt_4_cut &&
m.muon->eta() > 0) ?
m.muon->phi() : -10;
1176 oflmuon_variables.push_back(muon_phi4gev_rpcA);
1178 return (std::abs(
m.muon->eta()) < barrel_end &&
m.muon->pt() > pt_4_cut &&
m.muon->eta() < 0) ?
m.muon->phi() : -10;
1180 oflmuon_variables.push_back(muon_phi4gev_rpcC);
1182 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;
1184 oflmuon_variables.push_back(muon_phi4gev_tgc);
1186 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;
1188 oflmuon_variables.push_back(muon_phi4gev_tgcA);
1190 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;
1192 oflmuon_variables.push_back(muon_phi4gev_tgcC);
1194 return (std::abs(
m.muon->eta()) > barrel_end && std::abs(
m.muon->eta()) < trigger_end) ?
m.muon->phi() : -10;
1196 oflmuon_variables.push_back(muon_phi0gev_tgc);
1198 return (std::abs(
m.muon->eta()) > barrel_end && std::abs(
m.muon->eta()) < trigger_end &&
m.muon->eta() > 0) ?
m.muon->phi() : -10;
1200 oflmuon_variables.push_back(muon_phi0gev_tgcA);
1202 return (std::abs(
m.muon->eta()) > barrel_end && std::abs(
m.muon->eta()) < trigger_end &&
m.muon->eta() < 0) ?
m.muon->phi() : -10;
1204 oflmuon_variables.push_back(muon_phi0gev_tgcC);
1206 return (
m.muon->pt() > pt_30_cut) ?
m.muon->eta() : -10;
1208 oflmuon_variables.push_back(muon_eta);
1210 return (
m.muon->pt() > pt_30_cut) ?
m.muon->phi() : -10;
1212 oflmuon_variables.push_back(muon_phi);
1214 return (std::abs(
m.muon->eta()) < barrel_end &&
m.muon->pt() > pt_30_cut) ?
m.muon->phi() : -10;
1216 oflmuon_variables.push_back(muon_phi_rpc);
1218 return (std::abs(
m.muon->eta()) < barrel_end &&
m.muon->pt() > pt_30_cut &&
m.muon->eta()>0) ?
m.muon->phi() : -10;
1220 oflmuon_variables.push_back(muon_phi_rpcA);
1222 return (std::abs(
m.muon->eta()) < barrel_end &&
m.muon->pt() > pt_30_cut &&
m.muon->eta()<0) ?
m.muon->phi() : -10;
1224 oflmuon_variables.push_back(muon_phi_rpcC);
1226 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;
1228 oflmuon_variables.push_back(muon_phi_tgc);
1230 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;
1232 oflmuon_variables.push_back(muon_phi_tgcA);
1234 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;
1236 oflmuon_variables.push_back(muon_phi_tgcC);
1240 oflmuon_variables.push_back(muon_pt_rpc);
1242 return (std::abs(
m.muon->eta()) > barrel_end && std::abs(
m.muon->eta()) < trigger_end) ?
m.muon->pt() /
Gaudi::Units::GeV : -10;
1244 oflmuon_variables.push_back(muon_pt_tgc);
1246 return (std::abs(
m.muon->eta()) < barrel_end);
1248 oflmuon_variables.push_back(muon_barrel);
1250 return (std::abs(
m.muon->eta()) > barrel_end && std::abs(
m.muon->eta()) < endcap_end);
1252 oflmuon_variables.push_back(muon_endcap);
1254 return (std::abs(
m.muon->eta()) > endcap_end && std::abs(
m.muon->eta()) < trigger_end);
1256 oflmuon_variables.push_back(muon_forward);
1258 return m.matchedL1ThrInclusiveTGC.find(1) !=
m.matchedL1ThrInclusiveTGC.end();
1260 oflmuon_variables.push_back(muon_l1passThr1TGC);
1262 return m.matchedL1ThrInclusive.find(1) !=
m.matchedL1ThrInclusive.end();
1264 oflmuon_variables.push_back(muon_l1passThr1);
1266 return m.matchedL1ThrInclusive.find(2) !=
m.matchedL1ThrInclusive.end();
1268 oflmuon_variables.push_back(muon_l1passThr2);
1270 return m.matchedL1ThrInclusive.find(3) !=
m.matchedL1ThrInclusive.end();
1272 oflmuon_variables.push_back(muon_l1passThr3);
1274 return m.matchedL1ThrInclusive.find(4) !=
m.matchedL1ThrInclusive.end();
1276 oflmuon_variables.push_back(muon_l1passThr4);
1278 return m.matchedL1ThrInclusive.find(5) !=
m.matchedL1ThrInclusive.end();
1280 oflmuon_variables.push_back(muon_l1passThr5);
1282 return m.matchedL1ThrInclusive.find(6) !=
m.matchedL1ThrInclusive.end();
1284 oflmuon_variables.push_back(muon_l1passThr6);
1286 return m.matchedL1ThrInclusive.find(7) !=
m.matchedL1ThrInclusive.end();
1288 oflmuon_variables.push_back(muon_l1passThr7);
1290 return m.matchedL1ThrInclusive.find(8) !=
m.matchedL1ThrInclusive.end();
1292 oflmuon_variables.push_back(muon_l1passThr8);
1294 return m.matchedL1ThrInclusive.find(9) !=
m.matchedL1ThrInclusive.end();
1296 oflmuon_variables.push_back(muon_l1passThr9);
1298 return m.matchedL1ThrInclusive.find(10) !=
m.matchedL1ThrInclusive.end();
1300 oflmuon_variables.push_back(muon_l1passThr10);
1302 return m.matchedL1ThrInclusive.find(11) !=
m.matchedL1ThrInclusive.end();
1304 oflmuon_variables.push_back(muon_l1passThr11);
1306 return m.matchedL1ThrInclusive.find(12) !=
m.matchedL1ThrInclusive.end();
1308 oflmuon_variables.push_back(muon_l1passThr12);
1310 return m.matchedL1ThrInclusive.find(13) !=
m.matchedL1ThrInclusive.end();
1312 oflmuon_variables.push_back(muon_l1passThr13);
1314 return m.matchedL1ThrInclusive.find(14) !=
m.matchedL1ThrInclusive.end();
1316 oflmuon_variables.push_back(muon_l1passThr14);
1318 return m.matchedL1ThrInclusive.find(15) !=
m.matchedL1ThrInclusive.end();
1320 oflmuon_variables.push_back(muon_l1passThr15);
1322 return m.matchedL1Charge;
1324 oflmuon_variables.push_back(muon_l1passCharge);
1326 return m.passBW3Coin;
1328 oflmuon_variables.push_back(muon_l1passBW3Coin);
1330 return !
m.passBW3Coin;
1332 oflmuon_variables.push_back(muon_l1passBW3CoinVeto);
1334 return m.passInnerCoin;
1336 oflmuon_variables.push_back(muon_l1passInnerCoin);
1338 return !
m.passInnerCoin;
1340 oflmuon_variables.push_back(muon_l1passInnerCoinVeto);
1342 return m.passGoodMF;
1344 oflmuon_variables.push_back(muon_l1passGoodMF);
1346 return !
m.passGoodMF;
1348 oflmuon_variables.push_back(muon_l1passBadMF);
1350 return m.passIsMoreCandInRoI;
1352 oflmuon_variables.push_back(muon_l1passIsMoreCandInRoI);
1355 ATH_MSG_DEBUG(
"End filling offline muon-related histograms");
1374 std::map<int, SG::ReadHandle<Muon::TgcCoinDataContainer> > tgcCoin;
1375 tgcCoin[-1] = tgcCoinPrev;
1376 tgcCoin[0] = tgcCoinCurr;
1377 tgcCoin[+1] = tgcCoinNext;
1380 if(tgcCoinNextNext.
isValid())tgcCoin[+2] = tgcCoinNextNext;
1382 std::vector< TgcTrig > tgcTrigMap_SL;
1383 std::vector< TgcTrig > tgcTrigMap_SL_Endcap;
1384 std::vector< TgcTrig > tgcTrigMap_SL_Forward;
1385 std::vector< TgcTrig > tgcTrigMap_HPT_Wire;
1386 std::vector< TgcTrig > tgcTrigMap_HPT_Endcap_Wire;
1387 std::vector< TgcTrig > tgcTrigMap_HPT_Forward_Wire;
1388 std::vector< TgcTrig > tgcTrigMap_HPT_Strip;
1389 std::vector< TgcTrig > tgcTrigMap_HPT_Endcap_Strip;
1390 std::vector< TgcTrig > tgcTrigMap_HPT_Forward_Strip;
1391 std::vector< TgcTrig > tgcTrigMap_LPT_Wire;
1392 std::vector< TgcTrig > tgcTrigMap_LPT_Endcap_Wire;
1393 std::vector< TgcTrig > tgcTrigMap_LPT_Forward_Wire;
1394 std::vector< TgcTrig > tgcTrigMap_LPT_Strip;
1395 std::vector< TgcTrig > tgcTrigMap_LPT_Endcap_Strip;
1396 std::vector< TgcTrig > tgcTrigMap_LPT_Forward_Strip;
1397 std::vector< TgcTrig > tgcTrigMap_EIFI_Wire;
1398 std::vector< TgcTrig > tgcTrigMap_EIFI_Endcap_Wire;
1399 std::vector< TgcTrig > tgcTrigMap_EIFI_Forward_Wire;
1400 std::vector< TgcTrig > tgcTrigMap_EIFI_Strip;
1401 std::vector< TgcTrig > tgcTrigMap_EIFI_Endcap_Strip;
1402 std::vector< TgcTrig > tgcTrigMap_EIFI_Forward_Strip;
1403 std::vector< TgcTrigTile > tgcTrigTileMap;
1404 std::vector< TgcTrigNsw > tgcTrigNswMap;
1405 std::vector< TgcTrigRpc > tgcTrigRpcMap;
1406 std::vector< TgcTrigEifi > tgcTrigEifiMap;
1407 std::map<TString, TgcTrigNsw > tgcTrigNswMapUnique;
1408 std::vector<int> multiplicity_endcap(number_of_trigger_sectors_endcap*2+1);
1409 std::vector<int> multiplicity_forward(number_of_trigger_sectors_forward*2+1);
1410 std::vector<int> sectors_endcap(number_of_trigger_sectors_endcap*2+1);
1411 std::vector<int> sectors_forward(number_of_trigger_sectors_forward*2+1);
1412 std::iota(sectors_endcap.begin(),sectors_endcap.end(),-number_of_trigger_sectors_endcap);
1413 std::iota(sectors_forward.begin(),sectors_forward.end(),-number_of_trigger_sectors_forward);
1414 int n_TgcCoin_detElementIsNull = 0;
1415 int n_TgcCoin_postOutPtrIsNull = 0;
1416 for (
auto thisCoin : tgcCoin) {
1417 int bunch = thisCoin.first;
1418 for (
const auto tgccnt : *(thisCoin.second)) {
1419 for (
const auto data : *tgccnt) {
1420 if (
data->detectorElementOut() ==
nullptr ) n_TgcCoin_detElementIsNull++;
1421 if (
data->posOutPtr() ==
nullptr ) n_TgcCoin_postOutPtrIsNull++;
1423 int slsector = (
data->isForward()) ? (
data->phi() % number_of_trigger_sectors_forward + 1) : ( (
data->phi() + 1) % number_of_trigger_sectors_endcap + 1);
1424 if(!
data->isAside()) slsector *= -1;
1427 if (
data->isInner() &&
data->isStrip()) {
1431 rpcCoin.
bunch = bunch;
1432 rpcCoin.
currBc = (bunch==0);
1437 tgcTrigRpcMap.push_back(rpcCoin);
1438 }
else if (
data->isInner() && !
data->isStrip()) {
1442 int boardID = (std::abs(nswCoin.
slSector)-1) / 2 + 1;
1447 nswCoin.
bunch = bunch;
1448 nswCoin.
currBc = (bunch==0);
1452 if(nswCoin.
R!=0 && nswCoin.
Phi!=0){
1453 tgcTrigNswMap.push_back(nswCoin);
1455 if(tgcTrigNswMapUnique.find(uniqueinfo)==tgcTrigNswMapUnique.end()){
1456 nswCoin.
bcmask = 0x1 << (1-bunch);
1457 tgcTrigNswMapUnique[uniqueinfo] = nswCoin;
1459 tgcTrigNswMapUnique[uniqueinfo].bcmask |= 0x1 << (1-bunch);
1462 }
else if (!
data->isInner() &&
data->isStrip()) {
1466 tileCoin.
bunch = bunch;
1467 tileCoin.
currBc = (bunch==0);
1470 tgcTrigTileMap.push_back(tileCoin);
1471 }
else if (!
data->isInner() && !
data->isStrip()) {
1474 eifiCoin.
bunch = bunch;
1475 eifiCoin.
currBc = (bunch==0);
1476 tgcTrigEifiMap.push_back(eifiCoin);
1480 if (
data->detectorElementOut() ==
nullptr ||
1481 data->posOutPtr() == nullptr )
continue;
1485 tgcTrig.
x_In = posIn[0];
1486 tgcTrig.
y_In = posIn[1];
1487 tgcTrig.
z_In = posIn[2];
1489 tgcTrig.
x_Out = posOut[0];
1490 tgcTrig.
y_Out = posOut[1];
1491 tgcTrig.
z_Out = posOut[2];
1492 tgcTrig.
eta = posOut.eta();
1493 tgcTrig.
phi = posOut.phi();
1502 for(
const auto&
ext : extpositions_pivot){
1504 if(
data->isAside() &&
ext.extPos.z()<0)
continue;
1505 if(!
data->isAside()&&
ext.extPos.z()>0)
continue;
1512 for (
const auto&
muon : oflmuons) {
1515 if(
dr > max_dr )
continue;
1521 for(
const auto&
muon : biasedMuons){
1524 if(
dr > max_dr )
continue;
1531 if(biasedMuons.size()>=2) tgcTrig.
isBiased = 0;
1541 etaout = std::abs(
int(
m_idHelperSvc->tgcIdHelper().stationEta(tcdidout)));
1545 etain = std::abs(
int(
m_idHelperSvc->tgcIdHelper().stationEta(tcdidin)));
1548 tgcTrig.
etain = etain;
1557 tgcTrig.
sector = slsector;
1563 tgcTrig.
bunch = bunch;
1566 if( !
data->isInner() ){
1568 tgcTrigMap_SL_Endcap.push_back(tgcTrig);
1569 tgcTrigMap_SL.push_back(tgcTrig);
1570 multiplicity_endcap[ slsector + number_of_trigger_sectors_endcap ]++;
1572 tgcTrigMap_SL_Forward.push_back(tgcTrig);
1573 tgcTrigMap_SL.push_back(tgcTrig);
1574 multiplicity_forward[ slsector + number_of_trigger_sectors_forward ]++;
1577 tgcTrigMap_HPT_Endcap_Strip.push_back(tgcTrig);
1578 tgcTrigMap_HPT_Strip.push_back(tgcTrig);
1580 tgcTrigMap_HPT_Endcap_Wire.push_back(tgcTrig);
1581 tgcTrigMap_HPT_Wire.push_back(tgcTrig);
1585 tgcTrigMap_HPT_Forward_Strip.push_back(tgcTrig);
1586 tgcTrigMap_HPT_Strip.push_back(tgcTrig);
1588 tgcTrigMap_HPT_Forward_Wire.push_back(tgcTrig);
1589 tgcTrigMap_HPT_Wire.push_back(tgcTrig);
1593 tgcTrigMap_LPT_Endcap_Strip.push_back(tgcTrig);
1594 tgcTrigMap_LPT_Strip.push_back(tgcTrig);
1596 tgcTrigMap_LPT_Endcap_Wire.push_back(tgcTrig);
1597 tgcTrigMap_LPT_Wire.push_back(tgcTrig);
1601 tgcTrigMap_LPT_Forward_Strip.push_back(tgcTrig);
1602 tgcTrigMap_LPT_Strip.push_back(tgcTrig);
1604 tgcTrigMap_LPT_Forward_Wire.push_back(tgcTrig);
1605 tgcTrigMap_LPT_Wire.push_back(tgcTrig);
1609 tgcTrigMap_EIFI_Endcap_Strip.push_back(tgcTrig);
1610 tgcTrigMap_EIFI_Strip.push_back(tgcTrig);
1612 tgcTrigMap_EIFI_Endcap_Wire.push_back(tgcTrig);
1613 tgcTrigMap_EIFI_Wire.push_back(tgcTrig);
1617 tgcTrigMap_EIFI_Forward_Strip.push_back(tgcTrig);
1618 tgcTrigMap_EIFI_Strip.push_back(tgcTrig);
1620 tgcTrigMap_EIFI_Forward_Wire.push_back(tgcTrig);
1621 tgcTrigMap_EIFI_Wire.push_back(tgcTrig);
1632 for(
auto& sl : tgcTrigMap_SL){
1633 if( sl.bunch != 0 )
continue;
1634 for(
auto& inner : tgcTrigRpcMap){
1635 if( sl.isForward == 1 )
break;
1636 if( sl.sector != inner.slSector )
continue;
1637 inner.roiEta = sl.eta;
1638 inner.roiPhi = sl.phi;
1639 inner.roiNum = sl.roi;
1640 inner.deltaBcid = (sl.bunch==0 && sl.muonMatched==1 && sl.isBiased==0) ? (inner.bcid - sl.bcid) : -999;
1641 inner.deltaTiming = (sl.bunch==0 && sl.muonMatched==1 && sl.isBiased==0) ? (inner.bunch - sl.bunch) : -999;
1642 inner.goodBcid0 = inner.deltaBcid==0;
1643 inner.goodBcid1 = (std::abs(inner.deltaBcid)<=1 || (16-std::abs(inner.deltaBcid))<=1);
1644 inner.goodBcid2 = (std::abs(inner.deltaBcid)<=2 || (16-std::abs(inner.deltaBcid))<=2);
1645 inner.goodTiming = (inner.bunch==sl.bunch && sl.bunch==0 && sl.muonMatched==1 && sl.isBiased==0);
1646 sl.rpc.push_back(&inner);
1648 for(
auto& inner : tgcTrigNswMap){
1649 if( sl.sector != inner.slSector )
continue;
1650 if( sl.isForward != inner.isForward )
continue;
1652 inner.roiEta = sl.eta;
1653 inner.roiPhi = sl.phi;
1654 inner.roiNum = sl.roi;
1656 inner.deltaBcid = (sl.bunch==0 && sl.muonMatched==1 && sl.isBiased==0) ? (inner.bcid - sl.bcid) : -999;
1657 inner.deltaTiming = (sl.bunch==0 && sl.muonMatched==1 && sl.isBiased==0) ? (inner.bunch - sl.bunch) : -999;
1658 inner.goodBcid0 = inner.deltaBcid==0;
1659 inner.goodBcid1 = (std::abs(inner.deltaBcid)<=1 || (16-std::abs(inner.deltaBcid))<=1);
1660 inner.goodBcid2 = (std::abs(inner.deltaBcid)<=2 || (16-std::abs(inner.deltaBcid))<=2);
1661 inner.goodTiming = (inner.bunch==sl.bunch && sl.bunch==0 && sl.muonMatched==1 && sl.isBiased==0);
1662 sl.nsw.push_back(&inner);
1665 for(
auto& inner : tgcTrigNswMapUnique){
1666 if( sl.sector != inner.second.slSector )
continue;
1667 if( sl.isForward != inner.second.isForward )
continue;
1669 inner.second.roiEta = sl.eta;
1670 inner.second.roiPhi = sl.phi;
1671 inner.second.roiNum = sl.roi;
1673 inner.second.deltaBcid = (sl.bunch==0 && sl.muonMatched==1 && sl.isBiased==0) ? (inner.second.bcid - sl.bcid) : -999;
1674 inner.second.deltaTiming = (sl.bunch==0 && sl.muonMatched==1 && sl.isBiased==0) ? (inner.second.bunch - sl.bunch) : -999;
1675 inner.second.goodBcid0 = inner.second.deltaBcid==0;
1676 inner.second.goodBcid1 = (std::abs(inner.second.deltaBcid)<=1 || (16-std::abs(inner.second.deltaBcid))<=1);
1677 inner.second.goodBcid2 = (std::abs(inner.second.deltaBcid)<=2 || (16-std::abs(inner.second.deltaBcid))<=2);
1678 inner.second.goodTiming = (inner.second.bunch==sl.bunch && sl.bunch==0 && sl.muonMatched==1 && sl.isBiased==0);
1679 sl.nsw_unique.push_back(&inner.second);
1682 for(
auto& inner : tgcTrigTileMap){
1683 if( sl.isForward == 1 )
break;
1684 if( sl.sector != inner.slSector )
continue;
1685 inner.roiEta = sl.eta;
1686 inner.roiPhi = sl.phi;
1687 inner.roiNum = sl.roi;
1688 inner.deltaBcid = (sl.bunch==0 && sl.muonMatched==1 && sl.isBiased==0) ? (inner.bcid - sl.bcid) : -999;
1689 inner.deltaTiming = (sl.bunch==0 && sl.muonMatched==1 && sl.isBiased==0) ? (inner.bunch - sl.bunch) : -999;
1690 inner.goodBcid0 = inner.deltaBcid==0;
1691 inner.goodBcid1 = (std::abs(inner.deltaBcid)<=1 || (16-std::abs(inner.deltaBcid))<=1);
1692 inner.goodBcid2 = (std::abs(inner.deltaBcid)<=2 || (16-std::abs(inner.deltaBcid))<=2);
1693 inner.goodTiming = (inner.bunch==sl.bunch && sl.bunch==0 && sl.muonMatched==1 && sl.isBiased==0);
1694 sl.tile.push_back(&inner);
1696 for(
auto& inner : tgcTrigEifiMap){
1697 if( sl.isForward == 1 )
break;
1698 if( sl.sector != inner.slSector )
continue;
1699 inner.roiEta = sl.eta;
1700 inner.roiPhi = sl.phi;
1701 inner.roiNum = sl.roi;
1702 inner.deltaTiming = (sl.bunch==0 && sl.muonMatched==1 && sl.isBiased==0) ? (inner.bunch - sl.bunch) : -999;
1703 inner.goodTiming = (inner.bunch==sl.bunch && sl.bunch==0 && sl.muonMatched==1 && sl.isBiased==0);
1704 sl.eifi.push_back(&inner);
1708 std::vector< TgcTrigTile > tgcTrigTileMap_allmods;
1709 for(
auto& inner : tgcTrigTileMap){
1710 if(inner.roiNum<0)
continue;
1711 for(
int i = 0 ;
i < 12 ;
i++){
1713 if((inner.tmdbDecisions>>
i) & 0x1){
1715 tgcTrigTileMap_allmods.push_back(inner2);
1723 tgcCoin_variables.push_back(mon_bcid);
1724 tgcCoin_variables.push_back(mon_pileup);
1725 tgcCoin_variables.push_back(mon_lb);
1727 auto mon_nTgcCoin_detElementIsNull =
Monitored::Scalar<int>(
"nTgcCoinDetElementIsNull", n_TgcCoin_detElementIsNull);
1728 auto mon_nTgcCoin_postOutPtrIsNull =
Monitored::Scalar<int>(
"nTgcCoinPostOutPtrIsNull", n_TgcCoin_postOutPtrIsNull);
1731 auto mon_multiplicity_endcap =
Monitored::Collection(
"trigger_multiplicity_endcap", multiplicity_endcap);
1732 auto mon_multiplicity_forward =
Monitored::Collection(
"trigger_multiplicity_forward", multiplicity_forward);
1733 tgcCoin_variables.emplace_back(mon_nTgcCoin_detElementIsNull);
1734 tgcCoin_variables.emplace_back(mon_nTgcCoin_postOutPtrIsNull);
1735 tgcCoin_variables.emplace_back(mon_sectors_endcap);
1736 tgcCoin_variables.emplace_back(mon_sectors_forward);
1737 tgcCoin_variables.emplace_back(mon_multiplicity_endcap);
1738 tgcCoin_variables.emplace_back(mon_multiplicity_forward);
1741 std::vector<Monitored::ObjectsCollection<std::vector<TgcTrig>,
double>> vo_coin;
1742 vo_coin.reserve(38 * 21);
1744 fillTgcCoin(
"SL",tgcTrigMap_SL,vo_coin,tgcCoin_variables);
1745 fillTgcCoin(
"SL_Endcap",tgcTrigMap_SL_Endcap,vo_coin,tgcCoin_variables);
1746 fillTgcCoin(
"SL_Forward",tgcTrigMap_SL_Forward,vo_coin,tgcCoin_variables);
1747 fillTgcCoin(
"HPT_Wire",tgcTrigMap_HPT_Wire,vo_coin,tgcCoin_variables);
1748 fillTgcCoin(
"HPT_Endcap_Wire",tgcTrigMap_HPT_Endcap_Wire,vo_coin,tgcCoin_variables);
1749 fillTgcCoin(
"HPT_Forward_Wire",tgcTrigMap_HPT_Forward_Wire,vo_coin,tgcCoin_variables);
1750 fillTgcCoin(
"HPT_Strip",tgcTrigMap_HPT_Strip,vo_coin,tgcCoin_variables);
1751 fillTgcCoin(
"HPT_Endcap_Strip",tgcTrigMap_HPT_Endcap_Strip,vo_coin,tgcCoin_variables);
1752 fillTgcCoin(
"HPT_Forward_Strip",tgcTrigMap_HPT_Forward_Strip,vo_coin,tgcCoin_variables);
1753 fillTgcCoin(
"LPT_Wire",tgcTrigMap_LPT_Wire,vo_coin,tgcCoin_variables);
1754 fillTgcCoin(
"LPT_Endcap_Wire",tgcTrigMap_LPT_Endcap_Wire,vo_coin,tgcCoin_variables);
1755 fillTgcCoin(
"LPT_Forward_Wire",tgcTrigMap_LPT_Forward_Wire,vo_coin,tgcCoin_variables);
1756 fillTgcCoin(
"LPT_Strip",tgcTrigMap_LPT_Strip,vo_coin,tgcCoin_variables);
1757 fillTgcCoin(
"LPT_Endcap_Strip",tgcTrigMap_LPT_Endcap_Strip,vo_coin,tgcCoin_variables);
1758 fillTgcCoin(
"LPT_Forward_Strip",tgcTrigMap_LPT_Forward_Strip,vo_coin,tgcCoin_variables);
1759 fillTgcCoin(
"EIFI_Wire",tgcTrigMap_EIFI_Wire,vo_coin,tgcCoin_variables);
1760 fillTgcCoin(
"EIFI_Endcap_Wire",tgcTrigMap_EIFI_Endcap_Wire,vo_coin,tgcCoin_variables);
1761 fillTgcCoin(
"EIFI_Forward_Wire",tgcTrigMap_EIFI_Forward_Wire,vo_coin,tgcCoin_variables);
1762 fillTgcCoin(
"EIFI_Strip",tgcTrigMap_EIFI_Strip,vo_coin,tgcCoin_variables);
1763 fillTgcCoin(
"EIFI_Endcap_Strip",tgcTrigMap_EIFI_Endcap_Strip,vo_coin,tgcCoin_variables);
1764 fillTgcCoin(
"EIFI_Forward_Strip",tgcTrigMap_EIFI_Forward_Strip,vo_coin,tgcCoin_variables);
1766 std::vector<Monitored::ObjectsCollection<std::vector<ExtTrigInfo>,
double>> vo_exttriginfo;
1767 vo_exttriginfo.reserve(13 * 5);
1768 std::vector<ExtTrigInfo> extTrigInfo_SL;
1769 std::vector<ExtTrigInfo> extTrigInfo_HPT_Wire;
1770 std::vector<ExtTrigInfo> extTrigInfo_HPT_Strip;
1771 std::vector<ExtTrigInfo> extTrigInfo_LPT_Wire;
1772 std::vector<ExtTrigInfo> extTrigInfo_LPT_Strip;
1773 fillTgcCoinEff(
"SL",tgcTrigMap_SL,extpositions_pivot,extTrigInfo_SL,vo_exttriginfo,tgcCoin_variables);
1774 fillTgcCoinEff(
"HPT_Wire",tgcTrigMap_HPT_Wire,extpositions_pivot,extTrigInfo_HPT_Wire,vo_exttriginfo,tgcCoin_variables);
1775 fillTgcCoinEff(
"HPT_Strip",tgcTrigMap_HPT_Strip,extpositions_pivot,extTrigInfo_HPT_Strip,vo_exttriginfo,tgcCoin_variables);
1776 fillTgcCoinEff(
"LPT_Wire",tgcTrigMap_LPT_Wire,extpositions_pivot,extTrigInfo_LPT_Wire,vo_exttriginfo,tgcCoin_variables);
1777 fillTgcCoinEff(
"LPT_Strip",tgcTrigMap_LPT_Strip,extpositions_pivot,extTrigInfo_LPT_Strip,vo_exttriginfo,tgcCoin_variables);
1783 tgcCoin_variables.push_back(coin_inner_tgc_roi);
1785 return (
m.bunch==0 &&
m.muonMatched==1 &&
m.isBiased==0) ? (
m.sector) : -999;
1787 tgcCoin_variables.push_back(coin_inner_tgc_sector);
1789 return (
m.bunch==0 &&
m.muonMatched==0 &&
m.loosemuonMatched==0 &&
m.isBiased==0) ? (
m.sector) : -999;
1791 tgcCoin_variables.push_back(coin_inner_tgc_fake_sector);
1794 return (
m.bunch==0 &&
m.muonMatched==1 &&
m.isBiased==0) ? (
m.eta) : -999;
1796 tgcCoin_variables.push_back(coin_inner_tgc_eta);
1798 return (
m.bunch==0 &&
m.muonMatched==1 &&
m.isBiased==0) ? (
m.phi) : -999;
1800 tgcCoin_variables.push_back(coin_inner_tgc_phi);
1803 return (
m.bunch==0 &&
m.muonMatched==0 &&
m.loosemuonMatched==0 &&
m.isBiased==0) ? (
m.eta) : -999;
1805 tgcCoin_variables.push_back(coin_inner_tgc_fake_eta);
1807 return (
m.bunch==0 &&
m.muonMatched==0 &&
m.loosemuonMatched==0 &&
m.isBiased==0) ? (
m.phi) : -999;
1809 tgcCoin_variables.push_back(coin_inner_tgc_fake_phi);
1812 return m.isForward==1;
1814 tgcCoin_variables.push_back(coin_inner_tgc_forward);
1816 return m.isForward==0;
1818 tgcCoin_variables.push_back(coin_inner_tgc_endcap);
1820 return std::abs(
m.eta) < 1.3;
1822 tgcCoin_variables.push_back(coin_inner_tgc_etaupto1p3);
1824 return std::abs(
m.eta) > 1.3 &&
m.isForward==0;
1826 tgcCoin_variables.push_back(coin_inner_tgc_etafrom1p3_endcap);
1831 tgcCoin_variables.push_back(coin_inner_tgc_coinflagEifi);
1835 tgcCoin_variables.push_back(coin_inner_tgc_coinflagTile);
1839 tgcCoin_variables.push_back(coin_inner_tgc_coinflagRpc);
1843 tgcCoin_variables.push_back(coin_inner_tgc_coinflagNsw);
1847 tgcCoin_variables.push_back(coin_inner_tgc_coinflagC);
1851 return (
m.rpc.size()>0);
1853 tgcCoin_variables.push_back(coin_inner_tgc_anyBcRpc);
1855 for(
const auto& inner :
m.rpc){
1856 if(inner->bunch == -1) return 1.;
1860 tgcCoin_variables.push_back(coin_inner_tgc_prevBcRpc);
1862 for(
const auto& inner :
m.rpc){
1863 if(inner->bunch == 0) return 1.;
1867 tgcCoin_variables.push_back(coin_inner_tgc_currBcRpc);
1869 for(
const auto& inner :
m.rpc){
1870 if(inner->bunch == 0 && inner->goodBcid0 == 1) return 1.;
1874 tgcCoin_variables.push_back(coin_inner_tgc_currBcRpc_goodBcid0);
1876 for(
const auto& inner :
m.rpc){
1877 if(inner->bunch == 0 && inner->goodBcid1 == 1) return 1.;
1881 tgcCoin_variables.push_back(coin_inner_tgc_currBcRpc_goodBcid1);
1883 for(
const auto& inner :
m.rpc){
1884 if(inner->bunch == 0 && inner->goodBcid2 == 1) return 1.;
1888 tgcCoin_variables.push_back(coin_inner_tgc_currBcRpc_goodBcid2);
1890 for(
const auto& inner :
m.rpc){
1891 if(inner->bunch == 1) return 1.;
1895 tgcCoin_variables.push_back(coin_inner_tgc_nextBcRpc);
1897 for(
const auto& inner :
m.rpc){
1898 if(inner->bunch == 2) return 1.;
1902 tgcCoin_variables.push_back(coin_inner_tgc_nextnextBcRpc);
1905 for(
const auto& inner :
m.rpc){
1906 if(inner->bunch == -1 && inner->goodBcid0 == 1) return 1.;
1910 tgcCoin_variables.push_back(coin_inner_tgc_prevBcRpc_goodBcid0);
1912 for(
const auto& inner :
m.rpc){
1913 if(inner->bunch == 1 && inner->goodBcid0 == 1) return 1.;
1917 tgcCoin_variables.push_back(coin_inner_tgc_nextBcRpc_goodBcid0);
1918 auto coin_inner_tgc_nextnextBcRpc_goodBcid0=
Monitored::Collection(
"coin_inner_tgc_nextnextBcRpc_goodBcid0",tgcTrigMap_SL,[](
const TgcTrig&
m){
1919 for(
const auto& inner :
m.rpc){
1920 if(inner->bunch == 2 && inner->goodBcid0 == 1) return 1.;
1924 tgcCoin_variables.push_back(coin_inner_tgc_nextnextBcRpc_goodBcid0);
1928 return (
m.nsw.size()>0);
1930 tgcCoin_variables.push_back(coin_inner_tgc_anyBcNsw);
1932 for(
const auto& inner :
m.nsw){
1933 if(inner->bunch == -1) return 1.;
1937 tgcCoin_variables.push_back(coin_inner_tgc_prevBcNsw);
1939 for(
const auto& inner :
m.nsw){
1940 if(inner->bunch == 0) return 1.;
1944 tgcCoin_variables.push_back(coin_inner_tgc_currBcNsw);
1946 for(
const auto& inner :
m.nsw){
1947 if(inner->bunch == 0 && inner->goodBcid0 == 1) return 1.;
1951 tgcCoin_variables.push_back(coin_inner_tgc_currBcNsw_goodBcid0);
1953 for(
const auto& inner :
m.nsw){
1954 if(inner->bunch == 0 && inner->goodBcid1 == 1) return 1.;
1958 tgcCoin_variables.push_back(coin_inner_tgc_currBcNsw_goodBcid1);
1960 for(
const auto& inner :
m.nsw){
1961 if(inner->bunch == 0 && inner->goodBcid2 == 1) return 1.;
1965 tgcCoin_variables.push_back(coin_inner_tgc_currBcNsw_goodBcid2);
1967 for(
const auto& inner :
m.nsw){
1968 if(inner->bunch == 1) return 1.;
1972 tgcCoin_variables.push_back(coin_inner_tgc_nextBcNsw);
1974 for(
const auto& inner :
m.nsw){
1975 if(inner->bunch == 2) return 1.;
1979 tgcCoin_variables.push_back(coin_inner_tgc_nextnextBcNsw);
1982 for(
const auto& inner :
m.nsw){
1983 if(inner->bunch == -1 && inner->goodBcid0 == 1) return 1.;
1987 tgcCoin_variables.push_back(coin_inner_tgc_prevBcNsw_goodBcid0);
1989 for(
const auto& inner :
m.nsw){
1990 if(inner->bunch == 1 && inner->goodBcid0 == 1) return 1.;
1994 tgcCoin_variables.push_back(coin_inner_tgc_nextBcNsw_goodBcid0);
1995 auto coin_inner_tgc_nextnextBcNsw_goodBcid0=
Monitored::Collection(
"coin_inner_tgc_nextnextBcNsw_goodBcid0",tgcTrigMap_SL,[](
const TgcTrig&
m){
1996 for(
const auto& inner :
m.nsw){
1997 if(inner->bunch == 2 && inner->goodBcid0 == 1) return 1.;
2001 tgcCoin_variables.push_back(coin_inner_tgc_nextnextBcNsw_goodBcid0);
2003 for(
const auto& inner :
m.nsw_unique){
2004 if(inner->bcmask==1) return 1.;
2008 tgcCoin_variables.push_back(coin_inner_tgc_Nsw_bcmask1);
2010 for(
const auto& inner :
m.nsw_unique){
2011 if(inner->bcmask==2) return 1.;
2015 tgcCoin_variables.push_back(coin_inner_tgc_Nsw_bcmask2);
2017 for(
const auto& inner :
m.nsw_unique){
2018 if(inner->bcmask==3) return 1.;
2022 tgcCoin_variables.push_back(coin_inner_tgc_Nsw_bcmask3);
2024 for(
const auto& inner :
m.nsw_unique){
2025 if(inner->bcmask==4) return 1.;
2029 tgcCoin_variables.push_back(coin_inner_tgc_Nsw_bcmask4);
2031 for(
const auto& inner :
m.nsw_unique){
2032 if(inner->bcmask==5) return 1.;
2036 tgcCoin_variables.push_back(coin_inner_tgc_Nsw_bcmask5);
2038 for(
const auto& inner :
m.nsw_unique){
2039 if(inner->bcmask==6) return 1.;
2043 tgcCoin_variables.push_back(coin_inner_tgc_Nsw_bcmask6);
2045 for(
const auto& inner :
m.nsw_unique){
2046 if(inner->bcmask==7) return 1.;
2050 tgcCoin_variables.push_back(coin_inner_tgc_Nsw_bcmask7);
2054 return (
m.tile.size()>0);
2056 tgcCoin_variables.push_back(coin_inner_tgc_anyBcTile);
2058 for(
const auto& inner :
m.tile){
2059 if(inner->bunch == -1) return 1.;
2063 tgcCoin_variables.push_back(coin_inner_tgc_prevBcTile);
2065 for(
const auto& inner :
m.tile){
2066 if(inner->bunch == 0) return 1.;
2070 tgcCoin_variables.push_back(coin_inner_tgc_currBcTile);
2072 for(
const auto& inner :
m.tile){
2073 if(inner->bunch == 0 && inner->goodBcid0 == 1) return 1.;
2077 tgcCoin_variables.push_back(coin_inner_tgc_currBcTile_goodBcid0);
2079 for(
const auto& inner :
m.tile){
2080 if(inner->bunch == 0 && inner->goodBcid1 == 1) return 1.;
2084 tgcCoin_variables.push_back(coin_inner_tgc_currBcTile_goodBcid1);
2086 for(
const auto& inner :
m.tile){
2087 if(inner->bunch == 0 && inner->goodBcid2 == 1) return 1.;
2091 tgcCoin_variables.push_back(coin_inner_tgc_currBcTile_goodBcid2);
2093 for(
const auto& inner :
m.tile){
2094 if(inner->bunch == 1) return 1.;
2098 tgcCoin_variables.push_back(coin_inner_tgc_nextBcTile);
2100 for(
const auto inner :
m.tile){
2101 if(inner->bunch == 2) return 1.;
2105 tgcCoin_variables.push_back(coin_inner_tgc_nextnextBcTile);
2108 for(
const auto& inner :
m.tile){
2109 if(inner->bunch == -1 && inner->goodBcid0 == 1) return 1.;
2113 tgcCoin_variables.push_back(coin_inner_tgc_prevBcTile_goodBcid0);
2115 for(
const auto& inner :
m.tile){
2116 if(inner->bunch == 1 && inner->goodBcid0 == 1) return 1.;
2120 tgcCoin_variables.push_back(coin_inner_tgc_nextBcTile_goodBcid0);
2121 auto coin_inner_tgc_nextnextBcTile_goodBcid0=
Monitored::Collection(
"coin_inner_tgc_nextnextBcTile_goodBcid0",tgcTrigMap_SL,[](
const TgcTrig&
m){
2122 for(
const auto inner :
m.tile){
2123 if(inner->bunch == 2 && inner->goodBcid0 == 1) return 1.;
2127 tgcCoin_variables.push_back(coin_inner_tgc_nextnextBcTile_goodBcid0);
2131 return (
m.eifi.size()>0);
2133 tgcCoin_variables.push_back(coin_inner_tgc_anyBcEifi);
2135 for(
const auto& inner :
m.eifi){
2136 if(inner->bunch == -1) return 1.;
2140 tgcCoin_variables.push_back(coin_inner_tgc_prevBcEifi);
2142 for(
const auto& inner :
m.eifi){
2143 if(inner->bunch == 0) return 1.;
2147 tgcCoin_variables.push_back(coin_inner_tgc_currBcEifi);
2149 for(
const auto& inner :
m.eifi){
2150 if(inner->bunch == 1) return 1.;
2154 tgcCoin_variables.push_back(coin_inner_tgc_nextBcEifi);
2156 for(
const auto inner :
m.eifi){
2157 if(inner->bunch == 2) return 1.;
2161 tgcCoin_variables.push_back(coin_inner_tgc_nextnextBcEifi);
2168 tgcCoin_variables.push_back(coin_inner_rpc_slSector);
2170 return (
m.goodTiming) ?
m.slSector : -999;
2172 tgcCoin_variables.push_back(coin_inner_rpc_slSector_goodTiming);
2176 tgcCoin_variables.push_back(coin_inner_rpc_roiEta);
2180 tgcCoin_variables.push_back(coin_inner_rpc_roiPhi);
2184 tgcCoin_variables.push_back(coin_inner_rpc_roiNum);
2188 tgcCoin_variables.push_back(coin_inner_rpc_deltaBcid);
2190 return m.deltaTiming;
2192 tgcCoin_variables.push_back(coin_inner_rpc_deltaTiming);
2196 tgcCoin_variables.push_back(coin_inner_rpc_rpcEta);
2200 tgcCoin_variables.push_back(coin_inner_rpc_rpcPhi);
2204 tgcCoin_variables.push_back(coin_inner_rpc_rpcDEta);
2208 tgcCoin_variables.push_back(coin_inner_rpc_rpcDPhi);
2212 tgcCoin_variables.push_back(coin_inner_rpc_currBc);
2216 tgcCoin_variables.push_back(coin_inner_rpc_goodBcid0);
2220 tgcCoin_variables.push_back(coin_inner_rpc_goodBcid1);
2224 tgcCoin_variables.push_back(coin_inner_rpc_goodBcid2);
2226 return m.goodTiming;
2228 tgcCoin_variables.push_back(coin_inner_rpc_goodTiming);
2235 tgcCoin_variables.push_back(coin_inner_nsw_deltaR);
2239 tgcCoin_variables.push_back(coin_inner_nsw_slSector);
2241 return (
m.goodTiming) ?
m.slSector : -999;
2243 tgcCoin_variables.push_back(coin_inner_nsw_slSector_goodTiming);
2245 return (std::abs(
m.roiEta)>1.3 &&
m.isForward==0) ?
m.slSector : -999;
2247 tgcCoin_variables.push_back(coin_inner_nsw_slSector_endcap);
2249 return (
m.isForward==1) ?
m.slSector : -999;
2251 tgcCoin_variables.push_back(coin_inner_nsw_slSector_forward);
2253 return (std::abs(
m.roiEta)>1.3 &&
m.isForward==0 &&
m.goodTiming) ?
m.slSector : -999;
2255 tgcCoin_variables.push_back(coin_inner_nsw_slSector_goodTiming_endcap);
2257 return (
m.isForward==1 &&
m.goodTiming) ?
m.slSector : -999;
2259 tgcCoin_variables.push_back(coin_inner_nsw_slSector_goodTiming_forward);
2263 tgcCoin_variables.push_back(coin_inner_nsw_roiEta);
2267 tgcCoin_variables.push_back(coin_inner_nsw_roiPhi);
2271 tgcCoin_variables.push_back(coin_inner_nsw_roiNum);
2275 tgcCoin_variables.push_back(coin_inner_nsw_deltaBcid);
2277 return m.deltaTiming;
2279 tgcCoin_variables.push_back(coin_inner_nsw_deltaTiming);
2283 tgcCoin_variables.push_back(coin_inner_nsw_R);
2287 tgcCoin_variables.push_back(coin_inner_nsw_Phi);
2289 return m.deltaTheta;
2291 tgcCoin_variables.push_back(coin_inner_nsw_deltaTheta);
2293 return m.isForward==1;
2295 tgcCoin_variables.push_back(coin_inner_nsw_isForward);
2297 return m.isForward==0;
2299 tgcCoin_variables.push_back(coin_inner_nsw_isEndcap);
2303 tgcCoin_variables.push_back(coin_inner_nsw_currBc);
2305 return (
m.isForward==0 &&
m.currBc==1);
2307 tgcCoin_variables.push_back(coin_inner_nsw_endcap_currBc);
2309 return (
m.isForward==1 &&
m.currBc==1);
2311 tgcCoin_variables.push_back(coin_inner_nsw_forward_currBc);
2315 tgcCoin_variables.push_back(coin_inner_nsw_goodBcid0);
2319 tgcCoin_variables.push_back(coin_inner_nsw_goodBcid1);
2323 tgcCoin_variables.push_back(coin_inner_nsw_goodBcid2);
2325 return m.goodTiming;
2327 tgcCoin_variables.push_back(coin_inner_nsw_goodTiming);
2330 return m.slInputIndex;
2332 tgcCoin_variables.push_back(coin_inner_nsw_slInputIndex);
2334 return (
m.isAside==1 &&
m.isForward==0) ?
m.slInputIndex : -999;
2336 tgcCoin_variables.push_back(coin_inner_nsw_slInputIndex_AEndcap);
2338 return (
m.isAside==0 &&
m.isForward==0) ?
m.slInputIndex : -999;
2340 tgcCoin_variables.push_back(coin_inner_nsw_slInputIndex_CEndcap);
2342 return (
m.isAside==1 &&
m.isForward==1) ?
m.slInputIndex : -999;
2344 tgcCoin_variables.push_back(coin_inner_nsw_slInputIndex_AForward);
2346 return (
m.isAside==0 &&
m.isForward==1) ?
m.slInputIndex : -999;
2348 tgcCoin_variables.push_back(coin_inner_nsw_slInputIndex_CForward);
2351 return (
m.goodTiming==1 &&
m.goodBcid0==1);
2353 tgcCoin_variables.push_back(coin_inner_nsw_goodTimingBcid0);
2355 return (
m.goodTiming==1 &&
m.goodBcid1==1);
2357 tgcCoin_variables.push_back(coin_inner_nsw_goodTimingBcid1);
2359 return (
m.goodTiming==1 &&
m.goodBcid2==1);
2361 tgcCoin_variables.push_back(coin_inner_nsw_goodTimingBcid2);
2363 return m.deltaTiming==-1;
2365 tgcCoin_variables.push_back(coin_inner_nsw_BcPrev);
2367 return m.deltaTiming==0;
2369 tgcCoin_variables.push_back(coin_inner_nsw_BcCurr);
2371 return m.deltaTiming==1;
2373 tgcCoin_variables.push_back(coin_inner_nsw_BcNext);
2375 return m.deltaTiming==2;
2377 tgcCoin_variables.push_back(coin_inner_nsw_BcNextNext);
2383 tgcCoin_variables.push_back(coin_inner_tile_slSector);
2385 return (
m.goodTiming) ?
m.slSector : -999;
2387 tgcCoin_variables.push_back(coin_inner_tile_slSector_goodTiming);
2391 tgcCoin_variables.push_back(coin_inner_tile_roiEta);
2395 tgcCoin_variables.push_back(coin_inner_tile_roiPhi);
2399 tgcCoin_variables.push_back(coin_inner_tile_roiNum);
2403 tgcCoin_variables.push_back(coin_inner_tile_deltaBcid);
2405 return m.deltaTiming;
2407 tgcCoin_variables.push_back(coin_inner_tile_deltaTiming);
2409 return m.tmdbDecisions;
2411 tgcCoin_variables.push_back(coin_inner_tile_tmdbDecisions);
2415 tgcCoin_variables.push_back(coin_inner_tile_currBc);
2419 tgcCoin_variables.push_back(coin_inner_tile_goodBcid0);
2423 tgcCoin_variables.push_back(coin_inner_tile_goodBcid1);
2427 tgcCoin_variables.push_back(coin_inner_tile_goodBcid2);
2429 return m.goodTiming;
2431 tgcCoin_variables.push_back(coin_inner_tile_goodTiming);
2436 tgcCoin_variables.push_back(coin_inner_tile2_slSector);
2440 tgcCoin_variables.push_back(coin_inner_tile2_currBc);
2442 return m.tmdbDecisions;
2444 tgcCoin_variables.push_back(coin_inner_tile2_tmdbDecisions);
2448 return (
m.goodTiming) ?
m.slSector : -999;
2450 tgcCoin_variables.push_back(coin_inner_eifi_slSector_goodTiming);
2454 tgcCoin_variables.push_back(coin_inner_eifi_slSector);
2458 tgcCoin_variables.push_back(coin_inner_eifi_roiEta);
2462 tgcCoin_variables.push_back(coin_inner_eifi_roiPhi);
2466 tgcCoin_variables.push_back(coin_inner_eifi_roiNum);
2468 return m.deltaTiming;
2470 tgcCoin_variables.push_back(coin_inner_eifi_deltaTiming);
2474 tgcCoin_variables.push_back(coin_inner_eifi_currBc);
2476 return m.goodTiming;
2478 tgcCoin_variables.push_back(coin_inner_eifi_goodTiming);
2489 return StatusCode::SUCCESS;
2493 const std::vector<TgcTrig>& tgcTrigs,
2574 const std::vector<TgcTrig>& tgcTrigs,
2575 const std::vector<ExtPos>& extpositions_pivot,
2576 std::vector<ExtTrigInfo>& extTrigInfoVec,
2579 for(
const auto&
ext : extpositions_pivot){
2582 bool matchedQ =
false;
2583 bool matchedF =
false;
2584 bool matchedC =
false;
2585 bool matchedH =
false;
2586 bool matchedEI =
false;
2587 bool matchedTile =
false;
2588 bool matchedRPC =
false;
2589 bool matchedNSW =
false;
2590 for(
const auto& tgcTrig : tgcTrigs){
2591 if(tgcTrig.bunch!=0)
continue;
2592 if(tgcTrig.isAside==1 &&
ext.extPos.z()<0)
continue;
2593 if(tgcTrig.isAside==0 &&
ext.extPos.z()>0)
continue;
2595 const Amg::Vector3D posOut(tgcTrig.x_Out,tgcTrig.y_Out,tgcTrig.z_Out);
2598 TVector2
vec(tgcTrig.x_Out,tgcTrig.y_Out);
2600 double deltaR =
vec.Mod() - TVector2(
ext.extPos.x(),
ext.extPos.y()).Mod();
2604 int charge = (tgcTrig.isPositiveDeltaR==0) ? (-1) : (+1);
2605 matchedQ |= (
ext.muon->charge()*
charge>0);
2615 extTrigInfo.
eta =
ext.extPos.eta();
2616 extTrigInfo.
phi =
ext.extPos.phi();
2626 extTrigInfoVec.push_back(extTrigInfo);
2658 double rindex = (
r - nsw_rmin) / nsw_rindex_step;
2663 double max_dr = 999;
2675 std::vector<bool>
passed;
2676 passed.reserve(mymuons.size());
2677 for(
const auto& mymuon : mymuons){
2678 passed.push_back( mymuon.matchedL1Items.find(
item) != mymuon.matchedL1Items.end() );
2680 auto passed_rois = menuAndRoIs[
item];
2685 thrMonVariables.push_back(lumiBlock_l1item);
2688 thrMonVariables.push_back(muon_passed_l1item);
2691 return (m.muon->pt() > pt_30_cut) ? m.muon->eta() : -10;
2693 thrMonVariables.push_back(muon_eta_l1item);
2695 return (m.muon->pt() > pt_30_cut) ? m.muon->phi() : -10;
2697 thrMonVariables.push_back(muon_phi_l1item);
2699 return (std::abs(m.muon->eta()) < barrel_end) ? m.muon->pt() / Gaudi::Units::GeV : -10;
2701 thrMonVariables.push_back(muon_pt_rpc_l1item);
2703 return (std::abs(m.muon->eta()) > barrel_end && std::abs(m.muon->eta()) < trigger_end) ? m.muon->pt() / Gaudi::Units::GeV : -10;
2705 thrMonVariables.push_back(muon_pt_tgc_l1item);
2707 return (std::abs(m.muon->eta()) < barrel_end && m.muon->pt() > pt_30_cut) ? m.muon->phi() : -10;
2709 thrMonVariables.push_back(muon_phi_rpc_l1item);
2711 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;
2713 thrMonVariables.push_back(muon_phi_tgc_l1item);
2716 thrMonVariables.push_back(l1item_roi_eta);
2718 thrMonVariables.push_back(l1item_roi_phi);
2720 return (m->getSource()==xAOD::MuonRoI::Barrel)?(m->phi()):(-10);
2723 return (m->getSource()!=xAOD::MuonRoI::Barrel)?(m->phi()):(-10);
2725 thrMonVariables.push_back(l1item_roi_phi_tgc);
2728 return (m->getSource() == xAOD::MuonRoI::Barrel) ? m->phi() : -10;
2730 thrMonVariables.push_back(l1item_roi_phi_barrel);
2732 return (m->getSource() == xAOD::MuonRoI::Endcap) ? m->phi() : -10;
2734 thrMonVariables.push_back(l1item_roi_phi_endcap);
2736 return (m->getSource() == xAOD::MuonRoI::Forward) ? m->phi() : -10;
2738 thrMonVariables.push_back(l1item_roi_phi_forward);
2740 return m->getHemisphere() == xAOD::MuonRoI::Positive;
2742 thrMonVariables.push_back(l1item_roi_sideA);
2744 return m->getHemisphere() == xAOD::MuonRoI::Negative;
2746 thrMonVariables.push_back(l1item_roi_sideC);
2751 thrMonVariables.push_back(l1item_roi_roiNumber);
2754 return (m->getHemisphere() == xAOD::MuonRoI::Positive)?(m->getSectorID()+1):(-1 * m->getSectorID()-1);
2756 thrMonVariables.push_back(l1item_roi_sector);
2758 return m->getSource() == xAOD::MuonRoI::Barrel;
2760 thrMonVariables.push_back(l1item_roi_barrel);
2762 return m->getSource() == xAOD::MuonRoI::Endcap;
2764 thrMonVariables.push_back(l1item_roi_endcap);
2766 return m->getSource() == xAOD::MuonRoI::Forward;
2768 thrMonVariables.push_back(l1item_roi_forward);
2770 return m->getThrNumber();
2772 thrMonVariables.push_back(l1item_roi_thrNumber);
2775 return (m->getSource()==xAOD::MuonRoI::Barrel)?(m->isMoreCandInRoI()):(-1);
2777 thrMonVariables.push_back(l1item_roi_ismorecand);
2779 return (m->getSource()!=xAOD::MuonRoI::Barrel)?(m->getBW3Coincidence()):(-1);
2781 thrMonVariables.push_back(l1item_roi_bw3coin);
2783 return (m->getSource()!=xAOD::MuonRoI::Barrel)?(m->getInnerCoincidence()):(-1);
2785 thrMonVariables.push_back(l1item_roi_innercoin);
2787 return (m->getSource()!=xAOD::MuonRoI::Barrel)?(m->getGoodMF()):(-1);
2789 thrMonVariables.push_back(l1item_roi_goodmf);
2804 std::map<const xAOD::Muon*, std::set<std::string>> map_muon_and_tgchits;
2805 if(tgcPrd.
isValid() && muonMgr!=
nullptr){
2808 std::vector < TGC::TgcHit > tgcHits;
2809 std::map<std::string, std::vector<TGC::TgcHit>> tgcHitsMap;
2810 for (
const auto tgccnt : *tgcPrd) {
2811 for (
const auto data : *tgccnt) {
2821 const int bcmask =
data->getBcBitMap();
2823 shortWidth,longWidth,
length,
2826 if(extpositions.find(tgcHit.
cham_name())!=extpositions.end()){
2827 for(
auto& cham : extpositions[tgcHit.
cham_name()]){
2828 double newX = cham.extPos.x() + cham.extVec.x() / cham.extVec.z() * ( tgcHit.
Z() - cham.extPos.z() );
2829 double newY = cham.extPos.y() + cham.extVec.y() / cham.extVec.z() * ( tgcHit.
Z() - cham.extPos.z() );
2833 double chamPhi = detEle->
center().phi();
2834 TVector2 extPos(newX,newY);
2835 TVector2 hitPos(tgcHit.
X(),tgcHit.
Y());
2836 TVector2 rot_extPos = extPos.Rotate(-chamPhi +
M_PI/2.);
2837 TVector2 rot_hitPos = hitPos.Rotate(-chamPhi +
M_PI/2.);
2838 double res = (tgcHit.
isStrip())?
std::sin( rot_extPos.DeltaPhi( rot_hitPos ) ) * rot_extPos.Mod(): rot_hitPos.Y() - rot_extPos.Y();
2841 cham.chambersHasHit.insert(tgcHit.
type_name());
2842 map_muon_and_tgchits[cham.muon].insert(tgcHit.
channel_name());
2846 tgcHits.push_back(tgcHit);
2847 tgcHitsMap[tgcHit.
cham_name() + ( (tgcHit.
isStrip())?(
"S"):(
"W") )].push_back(tgcHit);
2848 tgcHitsMap[tgcHit.
type_name()].push_back(tgcHit);
2852 std::map<std::string, std::vector<int>> tgcHitPhiMap;
2853 std::map<std::string, std::vector<int>> tgcHitEtaMap;
2854 std::map<std::string, std::vector<int>> tgcHitPhiMapGlobal;
2855 std::map<std::string, std::vector<int>> tgcHitPhiMapOnline;
2856 std::map<std::string, std::vector<int>> tgcHitEtaMapOnline;
2857 std::map<std::string, std::vector<int>> tgcHitPhiMapGlobalOnline;
2858 std::map<std::string, std::vector<int>> tgcHitTiming;
2859 std::map<std::string, std::vector<int>> tgcHitPhiMapGlobalWithTrack;
2860 std::map<std::string, std::vector<int>> tgcHitTimingWithTrack;
2861 std::map<const std::string, std::vector<TGC::TgcHit>> tgcHitBCMaskMap;
2862 std::vector <int> vec_bw24sectors;
2863 std::vector <int> vec_bw24sectors_wire;
2864 std::vector <int> vec_bw24sectors_strip;
2865 std::vector <int> vec_bwfulleta;
2866 std::vector <int> vec_bwfulleta_wire;
2867 std::vector <int> vec_bwfulleta_strip;
2868 std::vector <int> vec_bwtiming;
2869 std::vector <int> vec_bwtiming_wire;
2870 std::vector <int> vec_bwtiming_strip;
2871 std::vector <int> vec_bw24sectors_wTrack;
2872 std::vector <int> vec_bw24sectors_wire_wTrack;
2873 std::vector <int> vec_bw24sectors_strip_wTrack;
2874 std::vector <int> vec_bwfulleta_wTrack;
2875 std::vector <int> vec_bwfulleta_wire_wTrack;
2876 std::vector <int> vec_bwfulleta_strip_wTrack;
2877 std::vector <int> vec_bwtiming_wTrack;
2878 std::vector <int> vec_bwtiming_wire_wTrack;
2879 std::vector <int> vec_bwtiming_strip_wTrack;
2880 for(
const auto& tgcHit : tgcHits){
2881 bool hasAssociatedGoodMuonTrack =
false;
2882 for(
const auto&
res : tgcHit.residuals()){
2884 if(map_muon_and_tgchits[
muon].
find(tgcHit.channel_name()) == map_muon_and_tgchits[
muon].
end())
continue;
2887 for(
const auto& chamHasHit : map_muon_and_tgchits[
muon]){
2888 if( chamHasHit.find(tgcHit.gap_name()) != std::string::npos )
continue;
2889 if( chamHasHit.find(
"M04") != std::string::npos )
continue;
2890 if( chamHasHit.find(
'W') != std::string::npos ) nWhits++;
2891 if( chamHasHit.find(
'S') != std::string::npos ) nShits++;
2895 hasAssociatedGoodMuonTrack =
true;
2903 if(hasAssociatedGoodMuonTrack) tgcHitBCMaskMap[tgcHit.channel_name()].push_back(tgcHit);
2906 int phimap_index = 0;
2907 int etamap_index = 0;
2908 int phimap_global_index = 0;
2909 m_tgcMonTool->getMapIndex(tgcHit,etamap_index,phimap_index,phimap_global_index );
2910 int phimap_index_online = 0;
2911 int etamap_index_online = 0;
2912 int phimap_global_index_online = 0;
2913 m_tgcMonTool->getMapIndexOnline(tgcHit.type_name(),etamap_index_online,phimap_index_online,phimap_global_index_online );
2914 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";
2915 for(
int bunch = -1 ; bunch <= +1 ; bunch++){
2921 tgcHitPhiMapGlobal[
station_name].push_back(phimap_global_index);
2923 tgcHitPhiMapOnline[wire_or_strip].push_back(phimap_index_online);
2924 tgcHitEtaMapOnline[wire_or_strip].push_back(etamap_index_online);
2925 tgcHitPhiMapGlobalOnline[wire_or_strip].push_back(phimap_global_index_online);
2926 if(hasAssociatedGoodMuonTrack){
2927 tgcHitPhiMapGlobalWithTrack[
station_name].push_back(phimap_global_index);
2933 vec_bwfulleta.push_back(tgcHit.iEta());
2934 vec_bwtiming.push_back(bunch);
2935 if(hasAssociatedGoodMuonTrack){
2936 vec_bw24sectors_wTrack.push_back((tgcHit.iSide()==
TGC::TGCSIDE::TGCASIDE)?(tgcHit.iSec()):(-tgcHit.iSec()));
2937 vec_bwfulleta_wTrack.push_back(tgcHit.iEta());
2938 vec_bwtiming_wTrack.push_back(bunch);
2940 if(tgcHit.isStrip()){
2941 vec_bw24sectors_strip.push_back((tgcHit.iSide()==
TGC::TGCSIDE::TGCASIDE)?(tgcHit.iSec()):(-tgcHit.iSec()));
2942 vec_bwfulleta_strip.push_back(tgcHit.iEta());
2943 vec_bwtiming_strip.push_back(bunch);
2944 if(hasAssociatedGoodMuonTrack){
2945 vec_bw24sectors_strip_wTrack.push_back((tgcHit.iSide()==
TGC::TGCSIDE::TGCASIDE)?(tgcHit.iSec()):(-tgcHit.iSec()));
2946 vec_bwfulleta_strip_wTrack.push_back(tgcHit.iEta());
2947 vec_bwtiming_strip_wTrack.push_back(bunch);
2950 vec_bw24sectors_wire.push_back((tgcHit.iSide()==
TGC::TGCSIDE::TGCASIDE)?(tgcHit.iSec()):(-tgcHit.iSec()));
2951 vec_bwfulleta_wire.push_back(tgcHit.iEta());
2952 vec_bwtiming_wire.push_back(bunch);
2953 if(hasAssociatedGoodMuonTrack){
2954 vec_bw24sectors_wire_wTrack.push_back((tgcHit.iSide()==
TGC::TGCSIDE::TGCASIDE)?(tgcHit.iSec()):(-tgcHit.iSec()));
2955 vec_bwfulleta_wire_wTrack.push_back(tgcHit.iEta());
2956 vec_bwtiming_wire_wTrack.push_back(bunch);
2966 hit_variables.push_back(mon_bcid);
2967 hit_variables.push_back(mon_pileup);
2968 hit_variables.push_back(mon_lb);
2971 hit_variables.push_back(hit_n);
2974 hit_variables.push_back(hit_bcmask);
2977 hit_variables.push_back(hit_sideA);
2980 hit_variables.push_back(hit_sideC);
2983 hit_variables.push_back(hit_bw24sectors);
2984 auto hit_bw24sectors_strip=
Monitored::Collection(
"hit_bw24sectors_strip",vec_bw24sectors_strip,[](
const int&
m){
return m;});
2985 hit_variables.push_back(hit_bw24sectors_strip);
2986 auto hit_bw24sectors_wire=
Monitored::Collection(
"hit_bw24sectors_wire",vec_bw24sectors_wire,[](
const int&
m){
return m;});
2987 hit_variables.push_back(hit_bw24sectors_wire);
2989 hit_variables.push_back(hit_bwfulleta);
2990 auto hit_bwfulleta_strip=
Monitored::Collection(
"hit_bwfulleta_strip",vec_bwfulleta_strip,[](
const int&
m){
return m;});
2991 hit_variables.push_back(hit_bwfulleta_strip);
2992 auto hit_bwfulleta_wire=
Monitored::Collection(
"hit_bwfulleta_wire",vec_bwfulleta_wire,[](
const int&
m){
return m;});
2993 hit_variables.push_back(hit_bwfulleta_wire);
2995 hit_variables.push_back(hit_bwtiming);
2996 auto hit_bwtiming_strip=
Monitored::Collection(
"hit_bwtiming_strip",vec_bwtiming_strip,[](
const int&
m){
return m;});
2997 hit_variables.push_back(hit_bwtiming_strip);
2998 auto hit_bwtiming_wire=
Monitored::Collection(
"hit_bwtiming_wire",vec_bwtiming_wire,[](
const int&
m){
return m;});
2999 hit_variables.push_back(hit_bwtiming_wire);
3001 auto hit_bw24sectors_wTrack=
Monitored::Collection(
"hit_bw24sectors_wTrack",vec_bw24sectors_wTrack,[](
const int&
m){
return m;});
3002 hit_variables.push_back(hit_bw24sectors_wTrack);
3003 auto hit_bw24sectors_strip_wTrack=
Monitored::Collection(
"hit_bw24sectors_strip_wTrack",vec_bw24sectors_strip_wTrack,[](
const int&
m){
return m;});
3004 hit_variables.push_back(hit_bw24sectors_strip_wTrack);
3005 auto hit_bw24sectors_wire_wTrack=
Monitored::Collection(
"hit_bw24sectors_wire_wTrack",vec_bw24sectors_wire_wTrack,[](
const int&
m){
return m;});
3006 hit_variables.push_back(hit_bw24sectors_wire_wTrack);
3007 auto hit_bwfulleta_wTrack=
Monitored::Collection(
"hit_bwfulleta_wTrack",vec_bwfulleta_wTrack,[](
const int&
m){
return m;});
3008 hit_variables.push_back(hit_bwfulleta_wTrack);
3009 auto hit_bwfulleta_strip_wTrack=
Monitored::Collection(
"hit_bwfulleta_strip_wTrack",vec_bwfulleta_strip_wTrack,[](
const int&
m){
return m;});
3010 hit_variables.push_back(hit_bwfulleta_strip_wTrack);
3011 auto hit_bwfulleta_wire_wTrack=
Monitored::Collection(
"hit_bwfulleta_wire_wTrack",vec_bwfulleta_wire_wTrack,[](
const int&
m){
return m;});
3012 hit_variables.push_back(hit_bwfulleta_wire_wTrack);
3013 auto hit_bwtiming_wTrack=
Monitored::Collection(
"hit_bwtiming_wTrack",vec_bwtiming_wTrack,[](
const int&
m){
return m;});
3014 hit_variables.push_back(hit_bwtiming_wTrack);
3015 auto hit_bwtiming_strip_wTrack=
Monitored::Collection(
"hit_bwtiming_strip_wTrack",vec_bwtiming_strip_wTrack,[](
const int&
m){
return m;});
3016 hit_variables.push_back(hit_bwtiming_strip_wTrack);
3017 auto hit_bwtiming_wire_wTrack=
Monitored::Collection(
"hit_bwtiming_wire_wTrack",vec_bwtiming_wire_wTrack,[](
const int&
m){
return m;});
3018 hit_variables.push_back(hit_bwtiming_wire_wTrack);
3020 std::vector<Monitored::ObjectsCollection<std::vector<int>,
double>> varowner;
3021 varowner.reserve(tgcHitPhiMap.size() * 2 + tgcHitPhiMapGlobal.size() * 2 + tgcHitPhiMapOnline.size() * 3 + tgcHitPhiMapGlobalWithTrack.size() * 2);
3022 for (
const auto &phimap : tgcHitPhiMap) {
3023 varowner.push_back(
Monitored::Collection(Form(
"hit_x_%s",phimap.first.data()),tgcHitEtaMap[phimap.first],[](
const int&
m){return m;}));
3024 hit_variables.push_back(varowner.back());
3025 varowner.push_back(
Monitored::Collection(Form(
"hit_y_%s", phimap.first.data()),phimap.second,[](
const int&
m){return m;}));
3026 hit_variables.push_back(varowner.back());
3028 for (
const auto &phimap : tgcHitPhiMapOnline) {
3029 varowner.push_back(
Monitored::Collection(Form(
"hit_online_x_%s",phimap.first.data()),tgcHitEtaMapOnline[phimap.first],[](
const int&
m){return m;}));
3030 hit_variables.push_back(varowner.back());
3031 varowner.push_back(
Monitored::Collection(Form(
"hit_online_y_%s", phimap.first.data()),phimap.second,[](
const int&
m){return m;}));
3032 hit_variables.push_back(varowner.back());
3033 varowner.push_back(
Monitored::Collection(Form(
"hit_online_glblphi_%s", phimap.first.data()),tgcHitPhiMapGlobalOnline[phimap.first],[](
const int&
m){return m;}));
3034 hit_variables.push_back(varowner.back());
3037 for (
const auto &phimap : tgcHitPhiMapGlobal) {
3038 varowner.push_back(
Monitored::Collection(Form(
"hit_glblphi_%s", phimap.first.data()),phimap.second,[](
const int&
m){return m;}));
3039 hit_variables.push_back(varowner.back());
3040 varowner.push_back(
Monitored::Collection(Form(
"hit_bunch_%s", phimap.first.data()),tgcHitTiming[phimap.first],[](
const int&
m){return m;}));
3041 hit_variables.push_back(varowner.back());
3043 for (
const auto &phimap : tgcHitPhiMapGlobalWithTrack) {
3044 varowner.push_back(
Monitored::Collection(Form(
"hit_glblphi_wTrack_%s", phimap.first.data()),phimap.second,[](
const int&
m){return m;}));
3045 hit_variables.push_back(varowner.back());
3046 varowner.push_back(
Monitored::Collection(Form(
"hit_bunch_wTrack_%s", phimap.first.data()),tgcHitTimingWithTrack[phimap.first],[](
const int&
m){return m;}));
3047 hit_variables.push_back(varowner.back());
3051 std::map<std::string, std::vector<int>> tgcHitBCMaskGlobalIndex;
3052 std::map<std::string, std::vector<int>> tgcHitBCMask;
3053 std::map<std::string, std::vector<int>> tgcHitBCMaskBWSectors;
3054 std::map<std::string, std::vector<int>> tgcHitBCMaskForBWSectors;
3055 for(
const auto& channelNameAndBCMask : tgcHitBCMaskMap){
3057 std::string chamberNameWithWS = channelNameAndBCMask.first.substr(0,16);
3058 int thisChannel =
std::atoi( channelNameAndBCMask.first.substr(18,3).data() );
3059 std::string prev1ChannelName = Form(
"%sCh%03d",chamberNameWithWS.data(),thisChannel-1);
3060 std::string next1ChannelName = Form(
"%sCh%03d",chamberNameWithWS.data(),thisChannel+1);
3062 if(tgcHitBCMaskMap.find(prev1ChannelName)!=tgcHitBCMaskMap.end())
continue;
3063 if(tgcHitBCMaskMap.find(next1ChannelName)!=tgcHitBCMaskMap.end())
continue;
3064 std::string cham_name = channelNameAndBCMask.first.substr(0,12);
3065 int iLay =
std::atoi( channelNameAndBCMask.first.substr(13,2).data() );
3067 int phimap_index = 0;
3068 int etamap_index = 0;
3069 int phimap_global_index = 0;
3070 if(!
m_tgcMonTool->getMapIndex(cham,iLay,etamap_index,phimap_index,phimap_global_index ))
continue;
3072 for(
const auto& tgcHit : channelNameAndBCMask.second){
3073 tgcHitBCMaskGlobalIndex[
station_name].push_back(phimap_global_index);
3077 tgcHitBCMaskForBWSectors[
"All"].push_back(tgcHit.bcmask());
3078 if(chamberNameWithWS.find(
'W')!=std::string::npos){
3080 tgcHitBCMaskForBWSectors[
"Wire"].push_back(tgcHit.bcmask());
3083 tgcHitBCMaskForBWSectors[
"Strip"].push_back(tgcHit.bcmask());
3088 std::vector<Monitored::ObjectsCollection<std::vector<int>,
double>> varowner_bcmask;
3089 varowner_bcmask.reserve(tgcHitBCMask.size() * 2 + tgcHitBCMaskBWSectors.size() * 2);
3090 for(
const auto& chamType : tgcHitBCMaskBWSectors){
3091 varowner_bcmask.push_back(
Monitored::Collection(Form(
"hit_bcmask_bw24sectors_%s",chamType.first.data()),chamType.second,[](
const int&
m){return m;}));
3092 hit_variables.push_back(varowner_bcmask.back());
3093 varowner_bcmask.push_back(
Monitored::Collection(Form(
"hit_bcmask_for_bw24sectors_%s",chamType.first.data()),tgcHitBCMaskForBWSectors[chamType.first],[](
const int&
m){return m;}));
3094 hit_variables.push_back(varowner_bcmask.back());
3096 for(
const auto& stationNameAndBCMask : tgcHitBCMask){
3097 varowner_bcmask.push_back(
Monitored::Collection(Form(
"hit_bcmask_glblphi_%s",stationNameAndBCMask.first.data()),tgcHitBCMaskGlobalIndex[stationNameAndBCMask.first],[](
const int&
m){return m;}));
3098 hit_variables.push_back(varowner_bcmask.back());
3099 varowner_bcmask.push_back(
Monitored::Collection(Form(
"hit_bcmask_%s",stationNameAndBCMask.first.data()),stationNameAndBCMask.second,[](
const int&
m){return m;}));
3100 hit_variables.push_back(varowner_bcmask.back());
3105 std::map<std::string, std::vector<double>> tgcEffPhiMap_Denominator;
3106 std::map<std::string, std::vector<double>> tgcEffEtaMap_Denominator;
3107 std::map<std::string, std::vector<double>> tgcEffPhiMapGlobal_Denominator;
3108 std::map<std::string, std::vector<double>> tgcEffPhiMap_Numerator;
3109 std::map<std::string, std::vector<double>> tgcEffEtaMap_Numerator;
3110 std::map<std::string, std::vector<double>> tgcEffPhiMapGlobal_Numerator;
3111 std::map<std::string, std::vector<double>> tgcEffPhiMapOnline_Denominator;
3112 std::map<std::string, std::vector<double>> tgcEffEtaMapOnline_Denominator;
3113 std::map<std::string, std::vector<double>> tgcEffPhiMapGlobalOnline_Denominator;
3114 std::map<std::string, std::vector<double>> tgcEffPhiMapOnline_Numerator;
3115 std::map<std::string, std::vector<double>> tgcEffEtaMapOnline_Numerator;
3116 std::map<std::string, std::vector<double>> tgcEffPhiMapGlobalOnline_Numerator;
3117 std::map<std::string, std::vector<double>> tgcEffMapExtX;
3118 std::map<std::string, std::vector<double>> tgcEffMapExtY;
3119 std::map<std::string, std::vector<double>> tgcEffMapHasHit;
3120 for(
const auto& exts : extpositions){
3121 const std::string& cham_name = exts.first;
3126 for(
const auto&
ext : exts.second){
3129 for(
int iLay = 1 ; iLay <= 3 ; iLay++){
3130 int phimap_index = 0;
3131 int etamap_index = 0;
3132 int phimap_global_index = 0;
3133 if(!
m_tgcMonTool->getMapIndex(cham,iLay,etamap_index,phimap_index,phimap_global_index ))
continue;
3135 double newX = extPosLocal.x() - extVecLocal.x() / extVecLocal.z() * extPosLocal.z();
3136 double newY = extPosLocal.y() - extVecLocal.y() / extVecLocal.z() * extPosLocal.z();
3137 for(
int iSorW = 0 ; iSorW < 2 ; iSorW++){
3138 if(cham.
iM()==1 && iLay==2 && iSorW==0)
continue;
3139 std::string gap_name = Form(
"%sL%02d",cham_name.data(),iLay);
3140 std::string type_name = Form(
"%sL%02d%s",cham_name.data(),iLay,(iSorW==0)?(
"S"):(
"W"));
3143 for(
const auto& chamHasHit : map_muon_and_tgchits[
ext.muon]){
3144 if( chamHasHit.find(gap_name) != std::string::npos )
continue;
3145 if( chamHasHit.find(
"M04") != std::string::npos )
continue;
3146 if( chamHasHit.find(
'W') != std::string::npos ) nWhits++;
3147 if( chamHasHit.find(
'S') != std::string::npos ) nShits++;
3152 int phimap_index_online = 0;
3153 int etamap_index_online = 0;
3154 int phimap_global_index_online = 0;
3155 m_tgcMonTool->getMapIndexOnline(type_name,etamap_index_online,phimap_index_online,phimap_global_index_online );
3156 std::string wire_or_strip = (type_name.size()==16) ? Form(
"%c_%s",type_name[0],(type_name[15]==
'W')?(
"wire"):(
"strip")) : (
"null");
3157 tgcEffPhiMap_Denominator[
station_name].push_back(phimap_index);
3158 tgcEffEtaMap_Denominator[
station_name].push_back(etamap_index);
3159 tgcEffPhiMapGlobal_Denominator[
station_name].push_back(phimap_global_index);
3160 tgcEffPhiMapOnline_Denominator[wire_or_strip].push_back(phimap_index_online);
3161 tgcEffEtaMapOnline_Denominator[wire_or_strip].push_back(etamap_index_online);
3162 tgcEffPhiMapGlobalOnline_Denominator[wire_or_strip].push_back(phimap_global_index_online);
3163 tgcEffMapExtX[type_name].push_back(newX);
3164 tgcEffMapExtY[type_name].push_back(newY);
3165 double hitExist = 0;
3166 if(
ext.chambersHasHit.find(type_name) !=
ext.chambersHasHit.end()) hitExist=1;
3167 tgcEffPhiMap_Numerator[
station_name].push_back(hitExist);
3168 tgcEffEtaMap_Numerator[
station_name].push_back(hitExist);
3169 tgcEffPhiMapGlobal_Numerator[
station_name].push_back(hitExist);
3170 tgcEffPhiMapOnline_Numerator[wire_or_strip].push_back(hitExist);
3171 tgcEffEtaMapOnline_Numerator[wire_or_strip].push_back(hitExist);
3172 tgcEffPhiMapGlobalOnline_Numerator[wire_or_strip].push_back(hitExist);
3173 tgcEffMapHasHit[type_name].push_back(hitExist);
3180 std::vector<Monitored::ObjectsCollection<std::vector<double>,
double>> varowner_hiteff;
3181 std::vector<Monitored::ObjectsCollection<std::vector<TGC::TgcHit>,
double>> varowner_eachchamber;
3182 std::vector<Monitored::ObjectsCollection<std::vector<double>,
double>> varowner_eachchamber_double;
3183 std::map<std::string,std::vector<double>> cham_and_res;
3188 varowner_hiteff.reserve(tgcEffPhiMap_Denominator.size() * 4 + tgcEffPhiMapGlobal_Denominator.size() * 2 + tgcEffMapHasHit.size() * 3 + tgcEffPhiMapOnline_Denominator.size() * 6);
3189 for (
const auto &phimap : tgcEffPhiMap_Denominator) {
3190 varowner_hiteff.push_back(
Monitored::Collection(Form(
"hit_effden_x_%s",phimap.first.data()),tgcEffEtaMap_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_effden_y_%s", phimap.first.data()),tgcEffPhiMap_Denominator[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_x_%s",phimap.first.data()),tgcEffEtaMap_Numerator[phimap.first],[](
const double&
m){return m;}));
3195 hit_variables.push_back(varowner_hiteff.back());
3196 varowner_hiteff.push_back(
Monitored::Collection(Form(
"hit_effnum_y_%s", phimap.first.data()),tgcEffPhiMap_Numerator[phimap.first],[](
const double&
m){return m;}));
3197 hit_variables.push_back(varowner_hiteff.back());
3199 for (
const auto &phimap : tgcEffPhiMapGlobal_Denominator) {
3200 varowner_hiteff.push_back(
Monitored::Collection(Form(
"hit_glblphi_effden_%s", phimap.first.data()),tgcEffPhiMapGlobal_Denominator[phimap.first],[](
const double&
m){return m;}));
3201 hit_variables.push_back(varowner_hiteff.back());
3202 varowner_hiteff.push_back(
Monitored::Collection(Form(
"hit_glblphi_effnum_%s", phimap.first.data()),tgcEffPhiMapGlobal_Numerator[phimap.first],[](
const double&
m){return m;}));
3203 hit_variables.push_back(varowner_hiteff.back());
3205 for (
const auto &phimap : tgcEffPhiMapOnline_Denominator) {
3206 varowner_hiteff.push_back(
Monitored::Collection(Form(
"hit_online_effden_x_%s",phimap.first.data()),tgcEffEtaMapOnline_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_effden_y_%s", phimap.first.data()),tgcEffPhiMapOnline_Denominator[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_x_%s",phimap.first.data()),tgcEffEtaMapOnline_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_effnum_y_%s", phimap.first.data()),tgcEffPhiMapOnline_Numerator[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_effden_%s", phimap.first.data()),tgcEffPhiMapGlobalOnline_Denominator[phimap.first],[](
const double&
m){return m;}));
3215 hit_variables.push_back(varowner_hiteff.back());
3216 varowner_hiteff.push_back(
Monitored::Collection(Form(
"hit_online_glblphi_effnum_%s", phimap.first.data()),tgcEffPhiMapGlobalOnline_Numerator[phimap.first],[](
const double&
m){return m;}));
3217 hit_variables.push_back(varowner_hiteff.back());
3219 for(
const auto& hiteffmap : tgcEffMapHasHit){
3220 varowner_hiteff.push_back(
Monitored::Collection(Form(
"hit_localX_effden_%s", hiteffmap.first.data()),tgcEffMapExtX[hiteffmap.first],[](
const double&
m){return m;}));
3221 hit_variables.push_back(varowner_hiteff.back());
3222 varowner_hiteff.push_back(
Monitored::Collection(Form(
"hit_localY_effden_%s", hiteffmap.first.data()),tgcEffMapExtY[hiteffmap.first],[](
const double&
m){return m;}));
3223 hit_variables.push_back(varowner_hiteff.back());
3224 varowner_hiteff.push_back(
Monitored::Collection(Form(
"hit_effnum_%s", hiteffmap.first.data()),tgcEffMapHasHit[hiteffmap.first],[](
const double&
m){return m;}));
3225 hit_variables.push_back(varowner_hiteff.back());
3228 ATH_MSG_DEBUG(
"gap-by-gap occupancy plots and residual plots");
3229 varowner_eachchamber.reserve(tgcHitsMap.size());
3230 varowner_eachchamber_double.reserve(tgcHitsMap.size());
3231 for (
const auto &tgcHitMap : tgcHitsMap) {
3232 auto chanName = tgcHitMap.first;
3233 if(chanName.find(
'L')!=std::string::npos){
3235 hit_variables.push_back(varowner_eachchamber.back());
3237 for(
const auto&tgcHit:tgcHitMap.second){
3238 for(
const auto&tgcRes:tgcHit.residuals()){
3239 cham_and_res[chanName].push_back(tgcRes.second);
3242 varowner_eachchamber_double.push_back(
Monitored::Collection(Form(
"hit_residual_on_%s",chanName.data()),cham_and_res[chanName],[](
const double&
m){return m;}));
3243 hit_variables.push_back(varowner_eachchamber_double.back());
3262 ATH_MSG_DEBUG(
"Filling histograms for MuonRoIs in thresholdPattern");
3282 std::vector<const xAOD::MuonRoI*> passed_rois;
3283 for(
const auto& allBcMuonRoI : AllBCMuonRoIs){
3284 if(allBcMuonRoI.timing!=0)
continue;
3289 passed_rois.push_back(roi);
3291 if(roiAndMenu.count(roi)==0){
3292 std::set<std::string>
items;
3293 roiAndMenu.insert(std::make_pair(roi,
items));
3295 roiAndMenu[roi].insert(
item);
3298 menuAndRoIs.insert(std::make_pair(
item,passed_rois));
3301 ATH_MSG_DEBUG(
"End filling histograms for MuonRoIs in thresholdPattern");