diff --git a/GEMValidation/scripts/cuts.py b/GEMValidation/scripts/cuts.py index d7a5c2a2d93cb..4791ed63d196d 100644 --- a/GEMValidation/scripts/cuts.py +++ b/GEMValidation/scripts/cuts.py @@ -1,15 +1,56 @@ from ROOT import * #_______________________________________________________________________________ -def AND(cut1,cut2): +def ANDtwo(cut1,cut2): + """AND of two TCuts in PyROOT""" return TCut("(%s) && (%s)"%(cut1.GetTitle(),cut2.GetTitle())) + #_______________________________________________________________________________ -def OR(cut1,cut2): +def ORtwo(cut1,cut2): + """OR of two TCuts in PyROOT""" return TCut("(%s) || (%s)"%(cut1.GetTitle(),cut2.GetTitle())) #_______________________________________________________________________________ +def AND(*arg): + """AND of any number of TCuts in PyROOT""" + length = len(arg) + if length == 0: + print "ERROR: invalid number of arguments" + return + if length == 1: + return arg[0] + if length==2: + return ANDtwo(arg[0],arg[1]) + if length>2: + result = arg[0] + for i in range(1,len(arg)): + result = ANDtwo(result,arg[i]) + return result + + +#_______________________________________________________________________________ +def OR(*arg): + """OR of any number of TCuts in PyROOT""" + length = len(arg) + if length == 0: + print "ERROR: invalid number of arguments" + return + if length == 1: + return arg[0] + if length==2: + return ORtwo(arg[0],arg[1]) + if length>2: + result = arg[0] + for i in range(1,len(arg)): + result = ORtwo(result,arg[i]) + return result + + +#_______________________________________________________________________________ +nocut = TCut("") + rm1 = TCut("region==-1") rp1 = TCut("region==1") l1 = TCut("layer==1") diff --git a/SimMuL1/plugins/GEMCSCTriggerEfficiency.cc b/SimMuL1/plugins/GEMCSCTriggerEfficiency.cc index 99bcac8a8464c..5248be62a5e77 100644 --- a/SimMuL1/plugins/GEMCSCTriggerEfficiency.cc +++ b/SimMuL1/plugins/GEMCSCTriggerEfficiency.cc @@ -104,7 +104,10 @@ GEMCSCTriggerEfficiency::GEMCSCTriggerEfficiency(const edm::ParameterSet& iConfi doStrictSimHitToTrackMatch_ = iConfig.getUntrackedParameter("doStrictSimHitToTrackMatch", false); matchAllTrigPrimitivesInChamber_ = iConfig.getUntrackedParameter("matchAllTrigPrimitivesInChamber", false); - minNHitsShared_ = iConfig.getUntrackedParameter("minNHitsShared_", -1); + minNHitsShared_ = iConfig.getUntrackedParameter("minNHitsShared", -1); + minNHitsChamber_ = iConfig.getUntrackedParameter("minNHitsChamber", 4); + minNStWithMinNHitsChambers_ = iConfig.getUntrackedParameter< int >("minNStWithMinNHitsChambers", 0); + requireME1With4Hits_ = iConfig.getUntrackedParameter< bool >("requireME1With4Hits",false); minDeltaYAnode_ = iConfig.getUntrackedParameter("minDeltaYAnode", -1.); minDeltaYCathode_ = iConfig.getUntrackedParameter("minDeltaYCathode", -1.); @@ -131,6 +134,7 @@ GEMCSCTriggerEfficiency::GEMCSCTriggerEfficiency(const edm::ParameterSet& iConfi maxSimTrEta_ = iConfig.getUntrackedParameter("maxSimTrEta", 5.); invertSimTrPhiEta_ = iConfig.getUntrackedParameter("invertSimTrPhiEta", false); bestPtMatch_ = iConfig.getUntrackedParameter("bestPtMatch", true); + onlyForwardMuons_ = iConfig.getUntrackedParameter("onlyForwardMuons", true); minBX_ = iConfig.getUntrackedParameter< int >("minBX",-6); maxBX_ = iConfig.getUntrackedParameter< int >("maxBX",6); @@ -170,9 +174,6 @@ GEMCSCTriggerEfficiency::GEMCSCTriggerEfficiency(const edm::ParameterSet& iConfi addGhostLCTs_ = iConfig.getUntrackedParameter< bool >("addGhostLCTs",true); - minNStWith4Hits_ = iConfig.getUntrackedParameter< int >("minNStWith4Hits", 0); - requireME1With4Hits_ = iConfig.getUntrackedParameter< bool >("requireME1With4Hits",false); - minSimTrackDR_ = iConfig.getUntrackedParameter("minSimTrackDR", 0.); edm::ParameterSet stripPSet = iConfig.getParameter("strips"); @@ -261,58 +262,46 @@ GEMCSCTriggerEfficiency::GEMCSCTriggerEfficiency(const edm::ParameterSet& iConfi char label[200]; for (int me=0; memake(label, label, 13,-6.5, 6.5); + + sprintf(label,"h_bx_min__alct_cscdet_%s",csc_type_[me].c_str()); + h_bx_min__alct_cscdet[me] = fs->make(label, label, 13,-6.5, 6.5); - sprintf(label,"h_bx__alct_cscdet_%s",csc_type_[me].c_str()); - h_bx__alct_cscdet[me] = fs->make(label, label, 13,-6.5, 6.5); - - - sprintf(label,"h_bx_min__alct_cscdet_%s",csc_type_[me].c_str()); - h_bx_min__alct_cscdet[me] = fs->make(label, label, 13,-6.5, 6.5); - - - sprintf(label,"h_bx__alctOk_cscdet_%s",csc_type_[me].c_str()); - h_bx__alctOk_cscdet[me] = fs->make(label, label, 13,-6.5, 6.5); - - - sprintf(label,"h_bx__alctOkBest_cscdet_%s",csc_type_[me].c_str()); - h_bx__alctOkBest_cscdet[me] = fs->make(label, label, 13,-6.5, 6.5); - - sprintf(label,"h_bx__clctOkBest_cscdet_%s",csc_type_[me].c_str()); - h_bx__clctOkBest_cscdet[me] = fs->make(label, label, 13,-6.5, 6.5); - - - sprintf(label,"h_wg_vs_bx__alctOkBest_cscdet_%s",csc_type_[me].c_str()); - h_wg_vs_bx__alctOkBest_cscdet[me] = fs->make(label, label, 51, -1, 50, 13,-6.5, 6.5); - - - sprintf(label,"h_bxf__alct_cscdet_%s",csc_type_[me].c_str()); - h_bxf__alct_cscdet[me] = fs->make(label, label, 13,-6.5, 6.5); - - sprintf(label,"h_bxf__alctOk_cscdet_%s",csc_type_[me].c_str()); - h_bxf__alctOk_cscdet[me] = fs->make(label, label, 13,-6.5, 6.5); - - - sprintf(label,"h_dbxbxf__alct_cscdet_%s",csc_type_[me].c_str()); - h_dbxbxf__alct_cscdet[me] = fs->make(label, label, 13,-6.5, 6.5); - - sprintf(label,"h_tf_stub_bx_cscdet_%s",csc_type_[me].c_str()); - h_tf_stub_bx_cscdet[me] = fs->make(label, label, 15,-7.5, 7.5); - - sprintf(label,"h_tf_stub_qu_cscdet_%s",csc_type_[me].c_str()); - h_tf_stub_qu_cscdet[me] = fs->make(label, label, 17,-0.5, 16.5); - - - }//for (int me=0; memake(label, label, 13,-6.5, 6.5); + sprintf(label,"h_bx__alctOkBest_cscdet_%s",csc_type_[me].c_str()); + h_bx__alctOkBest_cscdet[me] = fs->make(label, label, 13,-6.5, 6.5); + + sprintf(label,"h_bx__clctOkBest_cscdet_%s",csc_type_[me].c_str()); + h_bx__clctOkBest_cscdet[me] = fs->make(label, label, 13,-6.5, 6.5); + + sprintf(label,"h_wg_vs_bx__alctOkBest_cscdet_%s",csc_type_[me].c_str()); + h_wg_vs_bx__alctOkBest_cscdet[me] = fs->make(label, label, 51, -1, 50, 13,-6.5, 6.5); + + sprintf(label,"h_bxf__alct_cscdet_%s",csc_type_[me].c_str()); + h_bxf__alct_cscdet[me] = fs->make(label, label, 13,-6.5, 6.5); + + sprintf(label,"h_bxf__alctOk_cscdet_%s",csc_type_[me].c_str()); + h_bxf__alctOk_cscdet[me] = fs->make(label, label, 13,-6.5, 6.5); + + sprintf(label,"h_dbxbxf__alct_cscdet_%s",csc_type_[me].c_str()); + h_dbxbxf__alct_cscdet[me] = fs->make(label, label, 13,-6.5, 6.5); + + sprintf(label,"h_tf_stub_bx_cscdet_%s",csc_type_[me].c_str()); + h_tf_stub_bx_cscdet[me] = fs->make(label, label, 15,-7.5, 7.5); + + sprintf(label,"h_tf_stub_qu_cscdet_%s",csc_type_[me].c_str()); + h_tf_stub_qu_cscdet[me] = fs->make(label, label, 17,-0.5, 16.5); + }//for (int me=0; memake("h_tf_stub_bx","h_tf_stub_bx",15,-7.5, 7.5); h_tf_stub_qu = fs->make("h_tf_stub_qu","h_tf_stub_qu",17,-0.5, 16.5); h_tf_stub_qu_vs_bx = fs->make("h_tf_stub_qu_vs_bx","h_tf_stub_qu_vs_bx",17,-0.5, 16.5,15,-7.5, 7.5); - // h_bx_me1_aclct_ok_lct_no__bx_alct_vs_dbx_ACLCT = fs->make("h_bx_me1_aclct_ok_lct_no__bx_alct_vs_dbx_ACLCT","h_bx_me1_aclct_ok_lct_no__bx_alct_vs_dbx_ACLCT",13,-0.5,12.5, 13, -6.5,6.5); @@ -325,7 +314,6 @@ GEMCSCTriggerEfficiency::GEMCSCTriggerEfficiency(const edm::ParameterSet& iConfi h_tfqu_pt10 = fs->make("h_tfqu_pt10","h_tfqu_pt10",5,-0.5, 4.5); h_tfqu_pt10_no = fs->make("h_tfqu_pt10_no","h_tfqu_pt10_no",5,-0.5, 4.5); - h_nMplct_vs_nDigiMplct = fs->make("h_nMplct_vs_nDigiMplct","h_nMplct_vs_nDigiMplct",9,-.5, 8.5,9,-.5, 8.5); h_qu_vs_nDigiMplct = fs->make("h_qu_vs_nDigiMplct","h_qu_vs_nDigiMplct",5,-0.5, 4.5,9,-.5, 8.5); @@ -1096,75 +1084,74 @@ GEMCSCTriggerEfficiency::analyze(const edm::Event& iEvent, const edm::EventSetup double sim_eta[2], sim_phi[2]; int sim_n=0; - // add a part here to initialize the number of muons in the event - + const bool debugMC(false); + // check MC truch loop for ( size_t ic = 0; ic < cands.size(); ic++ ) { const reco::GenParticle * cand = &(cands[ic]); // is this particle a MC muon? - if ( abs(cand->pdgId()) == 13 && cand->status() == 1 ) + if ( abs(cand->pdgId()) != 13 || cand->status() != 1 ) continue; + + numberMCTr++; + mcpt = cand->pt(); + mceta = cand->eta(); + mcphi = normalizedPhi(cand->phi()); + + h_pt_mctr ->Fill(mcpt); + h_eta_mctr->Fill(mceta); + h_phi_mctr->Fill(mcphi); + + // ignore muons with huge eta + if (fabs(mceta)>10) continue; + + if (debugMC) std::cout << "Is good MC muon: " << numberMCTr << " with pt: " << mcpt << ", eta: " << mceta << ", and phi: " << mcphi << std::endl; + + // match with SimTrack + edm::SimTrackContainer::const_iterator matchSimTr = simTracks.end(); + double minDeltaRSimTr = 999.; + int numberSimTr=0; + for (edm::SimTrackContainer::const_iterator istrk = simTracks.begin(); istrk != simTracks.end(); ++istrk) { - numberMCTr++; - mcpt = cand->pt(); - mceta = cand->eta(); - mcphi = normalizedPhi(cand->phi()); + // sim track is not a muon + if ( abs(istrk->type()) != 13 ) continue; - h_pt_mctr ->Fill(mcpt); - h_eta_mctr->Fill(mceta); - h_phi_mctr->Fill(mcphi); + numberSimTr++; + stpt = sqrt(istrk->momentum().perp2()); + steta = istrk->momentum().eta(); + stphi = normalizedPhi( istrk->momentum().phi() ); - // ignore muons with huge eta - if (fabs(mceta)>10) continue; - - std::cout << "Is good MC muon: " << numberMCTr++ << " with pt: " << mcpt << ", eta: " << mceta << ", and phi: " << mcphi << std::endl; + // ignore muons with very low pt + if (stpt<1.) continue; - // match with SimTrack - edm::SimTrackContainer::const_iterator matchSimTr = simTracks.end(); - double minDeltaRSimTr = 999.; - int numberSimTr=0; - for (edm::SimTrackContainer::const_iterator istrk = simTracks.begin(); istrk != simTracks.end(); ++istrk) - { - // sim track is a muon - if ( abs(istrk->type()) != 13 ) continue; - - numberSimTr++; - stpt = sqrt(istrk->momentum().perp2()); - steta = istrk->momentum().eta(); - stphi = normalizedPhi( istrk->momentum().phi() ); - - // ignore muons with very low pt - if (stpt<1.) continue; - - //charge = static_cast (-itrack->type()/13); //static_cast (itrack->charge()); - if (sim_n<2) { - sim_eta[sim_n] = steta; - sim_phi[sim_n] = stphi; - } - sim_n++; - std::cout << "sim_n " << sim_n << std::endl; - - double dr = deltaR(mceta, mcphi, steta, stphi); - h_DR_mctr_simtr->Fill(dr); - // there is a generator level match! - if (dr < minDeltaRSimTr){ - matchSimTr = istrk; - minDeltaRSimTr = dr; - } + //charge = static_cast (-itrack->type()/13); //static_cast (itrack->charge()); + if (sim_n<2) { + sim_eta[sim_n] = steta; + sim_phi[sim_n] = stphi; } + sim_n++; + if (debugMC) std::cout << "sim_n " << sim_n << std::endl; - h_N_simtr->Fill(numberSimTr); - - if (matchSimTr == simTracks.end()) { - std::cout<<"+++ Warning: no matching sim track for MC track!"<Fill(dr); + // there is a generator level match! + if (dr < minDeltaRSimTr){ + matchSimTr = istrk; + minDeltaRSimTr = dr; } - - if (matchSimTr == simTracks.end()) continue; - h_MinDR_mctr_simtr->Fill(minDeltaRSimTr); - - } // if muon MC ca + } + + h_N_simtr->Fill(numberSimTr); + + if (matchSimTr == simTracks.end()) { + std::cout<<"+++ Warning: no matching sim track for MC track!"<Fill(minDeltaRSimTr); + } // MC cands loop h_N_mctr->Fill(numberMCTr); @@ -1195,38 +1182,39 @@ GEMCSCTriggerEfficiency::analyze(const edm::Event& iEvent, const edm::EventSetup const CSCLayerGeometry* layerGeom = csclayer->geometry(); for (unsigned j=0; jtoGlobal(hitLP); - double hitEta = hitGP.eta(); - double hitPhi = hitGP.phi(); - std::cout<<" "<toGlobal(hitLP); + double hitEta = hitGP.eta(); + double hitPhi = hitGP.phi(); + std::cout<<" "<get(layerId); for (CSCWireDigiCollection::const_iterator digiIt = rwired.first; digiIt != rwired.second; ++digiIt) - { - //int bx_time = (*digiIt).getTimeBin(); - int wiregroup = (*digiIt).getWireGroup(); // counted from 1 - LocalPoint digiLP = layerGeom->localCenterOfWireGroup(wiregroup); // x==0 - GlobalPoint digiGP = csclayer->toGlobal(digiLP); - double eta = digiGP.eta(); - std::cout <<" " << eta <<" "<< (*digiIt)<localCenterOfWireGroup(wiregroup); // x==0 + GlobalPoint digiGP = csclayer->toGlobal(digiLP); + double eta = digiGP.eta(); + std::cout <<" " << eta <<" "<< (*digiIt)<get(layerId); for (CSCComparatorDigiCollection::const_iterator digiIt = rcompd.first; digiIt != rcompd.second; ++digiIt) - { - //int bx_time = (*digiIt).getTimeBin(); - int strip = (*digiIt).getStrip(); - // Position at the center of the strip y==0 - LocalPoint digiLP = layerGeom->topology()->localPosition(strip-0.5); - GlobalPoint digiGP = csclayer->toGlobal(digiLP); - double phi = normalizedPhi ( digiGP.phi() ); - std::cout <<" " << phi <<" strip/comparator/time ="<< (*digiIt)<topology()->localPosition(strip-0.5); + GlobalPoint digiGP = csclayer->toGlobal(digiLP); + double phi = normalizedPhi ( digiGP.phi() ); + std::cout <<" " << phi <<" strip/comparator/time ="<< (*digiIt)<type()) != 13) continue; + + // bad primary vertex + if (istrk->vertIndex() != primaryVert) continue; + + // soft muons + stpt = sqrt(istrk->momentum().perp2()); + if (stpt < minSimTrPt_ ) { + if (debugALLEVENT) std::cout<<" - rejected mu SimTrack: with low pt = "<momentum().eta(); + if (fabs (steta) > maxSimTrEta_ || fabs (steta) < minSimTrEta_ ) { + if (debugALLEVENT) std::cout<<" - rejected mu SimTrack: eta not in CSC eta = "<momentum().phi() ); + if (stphi>maxSimTrPhi_ || stphitrackId()<<" "<simHits.size()<ALCTs.size() - <<" nCLCT: "<CLCTs.size() - <<" nLCT: "<LCTs.size() - <<" nMPLCT: "<MPLCTs.size() - <<" TFTRACKs/All: "<TFTRACKs.size() <<"/"<TFTRACKsAll.size() - <<" TFCANDs/All: "<TFCANDs.size() <<"/"<TFCANDsAll.size() - <<" GMTREGs/All: "<GMTREGCANDs.size()<<"/"<GMTREGCANDsAll.size() - <<" GMTRegBest:"<<(match->GMTREGCANDBest.l1reg != NULL) - <<" GMTs/All: "<GMTCANDs.size()<<"/"<GMTCANDsAll.size() - <<" GMTBest:"<<(match->GMTCANDBest.l1gmt != NULL) - <<" L1EXTRAs/All: "<L1EXTRAs.size()<<"/"<L1EXTRAsAll.size() - <<" L1EXTRABest:"<<(match->L1EXTRABest.l1extra != NULL)< (-itrack->type()/13); //static_cast (itrack->charge()); + std::cout<<"SimTrk\t id eta phi pt nSH: "<trackId()<<" "<simHits.size()<ALCTs.size() + <<" nCLCT: "<CLCTs.size() + <<" nLCT: "<LCTs.size() + <<" nMPLCT: "<MPLCTs.size() + <<" TFTRACKs/All: "<TFTRACKs.size() <<"/"<TFTRACKsAll.size() + <<" TFCANDs/All: "<TFCANDs.size() <<"/"<TFCANDsAll.size() + <<" GMTREGs/All: "<GMTREGCANDs.size()<<"/"<GMTREGCANDsAll.size() + <<" GMTRegBest:"<<(match->GMTREGCANDBest.l1reg != NULL) + <<" GMTs/All: "<GMTCANDs.size()<<"/"<GMTCANDsAll.size() + <<" GMTBest:"<<(match->GMTCANDBest.l1gmt != NULL) + <<" L1EXTRAs/All: "<L1EXTRAs.size()<<"/"<L1EXTRAsAll.size() + <<" L1EXTRABest:"<<(match->L1EXTRABest.l1extra != NULL)<strk->momentum().perp2()); steta = match->strk->momentum().eta(); stphi = normalizedPhi( match->strk->momentum().phi() ); + std::cout << "pt " << stpt << " eta " << steta << " phi " << stphi << std::endl; const bool pt_ok = fabs(stpt) > minSimTrPt_; const bool eta_ok = ( fabs(steta) >= minSimTrEta_ && fabs(steta) <= maxSimTrEta_); @@ -1481,10 +1482,14 @@ GEMCSCTriggerEfficiency::analyze(const edm::Event& iEvent, const edm::EventSetup bool eta_1b = mugeo::isME1bEtaRegion(steta, 1.6, 2.12); bool eta_gem_1b = mugeo::isME1bEtaRegion(steta, 1.64, 2.05); + // get the number of stations with at least minNHitsChamber_ hits in the chamber + unsigned nst_with_hits = match->nStationsWithHits(minNHitsChamber_); - unsigned nst_with_hits = match->nStationsWithHits(); - bool has_hits_in_st[5] = {0, match->hasHitsInStation(1), match->hasHitsInStation(2), - match->hasHitsInStation(3), match->hasHitsInStation(4)}; + // were station 1,2,3 or 4 hit if at least minNHitsChamber_ were required? + bool has_hits_in_st[5] = {0, match->hasHitsInStation(1,minNHitsChamber_), + match->hasHitsInStation(2,minNHitsChamber_), + match->hasHitsInStation(3,minNHitsChamber_), + match->hasHitsInStation(4,minNHitsChamber_)}; bool okME1mplct = 0, okME2mplct = 0, okME3mplct = 0, okME4mplct = 0; int okNmplct = 0; @@ -1506,8 +1511,12 @@ GEMCSCTriggerEfficiency::analyze(const edm::Event& iEvent, const edm::EventSetup } okNmplct = mpcStations.size(); } + + // was an MPC reconstructed in station 1,2,3 or 4? bool has_mpcs_in_st[5] = {0, has_hits_in_st[1] && okME1mplct, has_hits_in_st[2] && okME2mplct, - has_hits_in_st[3] && okME3mplct, has_hits_in_st[4] && okME4mplct}; + has_hits_in_st[3] && okME3mplct, has_hits_in_st[4] && okME4mplct}; + + // total number of stations with reconstructed MPCs unsigned nst_with_mpcs = has_mpcs_in_st[1] + has_mpcs_in_st[2] + has_mpcs_in_st[3] + has_mpcs_in_st[4]; if (pt_ok) { @@ -1574,13 +1583,14 @@ GEMCSCTriggerEfficiency::analyze(const edm::Event& iEvent, const edm::EventSetup bool tffid_ok = false; if ( tfc ) tffid_ok = ( eta_ok && tfc->l1cand->quality_packed() > 1 ); - // require chambers with at least 4 layers with simhits in at least minNStWith4Hits stations - if ( nst_with_hits < minNStWith4Hits_ ) continue; - + // require chambers with at least minNHitsChamber_ layers with + // simhits in at least minNStWithMinNHitsChambers_ stations + if ( nst_with_hits < (unsigned) minNStWithMinNHitsChambers_ ) continue; + // at least one chamber in ME1 with 4 hits if (requireME1With4Hits_ && !has_hits_in_st[1]) continue; - + bool eta_high = ( fabs(steta) >= 2.1 && fabs(steta) <= 2.4 ); @@ -2716,9 +2726,6 @@ GEMCSCTriggerEfficiency::cleanUp() void GEMCSCTriggerEfficiency::propagateToCSCStations(MatchCSCMuL1 *match) { - // do not propagate for hight etas - if (fabs(match->strk->momentum().eta())>2.6) return; - TrajectoryStateOnSurface tsos; // z planes @@ -4596,4 +4603,3 @@ GEMCSCTriggerEfficiency::endJob() {} //define this as a plug-in DEFINE_FWK_MODULE(GEMCSCTriggerEfficiency); - diff --git a/SimMuL1/plugins/GEMCSCTriggerEfficiency.h b/SimMuL1/plugins/GEMCSCTriggerEfficiency.h index c046070e0eb6e..c700b15c76aec 100644 --- a/SimMuL1/plugins/GEMCSCTriggerEfficiency.h +++ b/SimMuL1/plugins/GEMCSCTriggerEfficiency.h @@ -238,6 +238,7 @@ class GEMCSCTriggerEfficiency : public edm::EDAnalyzer bool doStrictSimHitToTrackMatch_; bool matchAllTrigPrimitivesInChamber_; int minNHitsShared_; + int minNHitsChamber_; double minDeltaYAnode_; double minDeltaYCathode_; int minDeltaWire_; @@ -263,6 +264,7 @@ class GEMCSCTriggerEfficiency : public edm::EDAnalyzer double maxSimTrEta_; bool invertSimTrPhiEta_; bool bestPtMatch_; + bool onlyForwardMuons_; int minBX_; int maxBX_; @@ -290,6 +292,7 @@ class GEMCSCTriggerEfficiency : public edm::EDAnalyzer bool addGhostLCTs_; + int minNStWithMinNHitsChambers_; bool minNStWith4Hits_; bool requireME1With4Hits_; diff --git a/SimMuL1/python/GEMCSCTriggerEfficiency_cfi.py b/SimMuL1/python/GEMCSCTriggerEfficiency_cfi.py index 69a28511ffbcb..a405ca94484e4 100644 --- a/SimMuL1/python/GEMCSCTriggerEfficiency_cfi.py +++ b/SimMuL1/python/GEMCSCTriggerEfficiency_cfi.py @@ -6,6 +6,7 @@ doME1a = cms.untracked.bool(True), defaultME1a = cms.untracked.bool(False), gangedME1a = cms.untracked.bool(False), + ## BX windows - about central BX=6 minBxALCT = cms.untracked.int32(5), maxBxALCT = cms.untracked.int32(7), minBxCLCT = cms.untracked.int32(5), @@ -14,27 +15,112 @@ maxBxLCT = cms.untracked.int32(7), minBxMPLCT = cms.untracked.int32(5), maxBxMPLCT = cms.untracked.int32(7), + ## matching doStrictSimHitToTrackMatch = cms.untracked.bool(True), matchAllTrigPrimitivesInChamber = cms.untracked.bool(True), + minDeltaYAnode = cms.untracked.double(-1), + minDeltaYCathode = cms.untracked.double(-1), minDeltaWire = cms.untracked.int32(-2), maxDeltaWire = cms.untracked.int32(2), minDeltaStrip = cms.untracked.int32(2), lightRun = cms.untracked.bool(False), - minNStWith4Hits = cms.untracked.int32(0), + ## looser requirement on the number of chamber hits + minNHitsChamber = cms.untracked.int32(4), + minNStWithMinHitsinChamber = cms.untracked.int32(0), requireME1With4Hits = cms.untracked.bool(False), - gemPTs = cms.vdouble(0., 6., 10., 15., 20., 30., 40.), - gemDPhisOdd = cms.vdouble(1., 0.0182579, 0.01066 , 0.00722795 , 0.00562598 , 0.00416544 , 0.00342827), - gemDPhisEven = cms.vdouble(1., 0.00790009, 0.00483286, 0.0036323, 0.00304879, 0.00253782, 0.00230833), - minSimTrackDR = cms.untracked.double(0.0), + ## bending angles + gemPTs = cms.vdouble(0., 5., 6., 10., 15., 20., 30., 40.), + gemDPhisOdd = cms.vdouble(1., 0.02203511, 0.0182579, 0.01066 , 0.00722795 , 0.00562598 , 0.00416544 , 0.00342827), + gemDPhisEven = cms.vdouble(1., 0.00930056, 0.00790009, 0.00483286, 0.0036323, 0.00304879, 0.00253782, 0.00230833), + ## simtrack cuts minSimTrPt = cms.untracked.double(2.), minSimTrPhi = cms.untracked.double(-3.15), maxSimTrPhi = cms.untracked.double(3.15), minSimTrEta = cms.untracked.double(1.45), maxSimTrEta = cms.untracked.double(2.5), + minSimTrackDR = cms.untracked.double(0.0), invertSimTrPhiEta = cms.untracked.bool(False), + onlyForwardMuons = cms.untracked.bool(True), goodChambersOnly = cms.untracked.bool(False), sectorProcessor = cms.untracked.PSet(), simTrackMatching = SimTrackMatching, strips = cms.untracked.PSet(), - debugINHISTOS = cms.untracked.int32(1) + ## debuggin purposes + debugALLEVENT = cms.untracked.int32(0), + debugINHISTOS = cms.untracked.int32(0), + debugALCT = cms.untracked.int32(0), + debugCLCT = cms.untracked.int32(0), + debugLCT = cms.untracked.int32(1), + debugMPLCT = cms.untracked.int32(0), + debugTFTRACK = cms.untracked.int32(0), + debugTFCAND = cms.untracked.int32(0), + debugGMTCAND = cms.untracked.int32(0), + debugL1EXTRA = cms.untracked.int32(0), + + ## collecting the params per collection + ## not used at the moment + simTrack = cms.untracked.PSet( + minPt = cms.untracked.double(2.), + minPhi = cms.untracked.double(-3.15), + maxPhi = cms.untracked.double(3.15), + minEta = cms.untracked.double(1.45), + maxEta = cms.untracked.double(2.5), + minDR = cms.untracked.double(0.0), + invertPhiEta = cms.untracked.bool(False), + onlyForwardMuons = cms.untracked.bool(True), + doStrictSimHitToTrackMatch = cms.untracked.bool(True), + ), + cscSimhits = cms.untracked.PSet( + debug = cms.untracked.bool(False), + ), + gemSimhits = cms.untracked.PSet( + debug = cms.untracked.bool(False), + ), + wireDigis = cms.untracked.PSet( + debug = cms.untracked.bool(False), + minDelta = cms.untracked.int32(-2), + maxDelta = cms.untracked.int32(2), + gangedME1a = cms.untracked.bool(False), + ), + stripDigis = cms.untracked.PSet( + debug = cms.untracked.bool(False), + ## find out why minDeltaStrip positive is!! + minDelta = cms.untracked.int32(2), + maxDelta = cms.untracked.int32(2), + ), + alcts = cms.untracked.PSet( + debug = cms.untracked.bool(False), + minBX = cms.untracked.int32(5), + maxBX = cms.untracked.int32(7), + ), + clcts = cms.untracked.PSet( + debug = cms.untracked.bool(False), + minBX = cms.untracked.int32(5), + maxBX = cms.untracked.int32(7), + ), + lcts = cms.untracked.PSet( + debug = cms.untracked.bool(False), + minBX = cms.untracked.int32(5), + maxBX = cms.untracked.int32(7), + addGhosts = cms.untracked.bool(True) + ), + mplcts = cms.untracked.PSet( + debug = cms.untracked.bool(False), + minBX = cms.untracked.int32(5), + maxBX = cms.untracked.int32(7), + ), + tfTrack = cms.untracked.PSet( + debug = cms.untracked.bool(False), + ), + tfCand = cms.untracked.PSet( + debug = cms.untracked.bool(False), + ), + gmtCand = cms.untracked.PSet( + debug = cms.untracked.bool(False), + minBX = cms.untracked.int32(-1), + maxBX = cms.untracked.int32(1), + ), + l1Extra = cms.untracked.PSet( + debug = cms.untracked.bool(False), + ), ) diff --git a/SimMuL1/python/GEMCSCTriggerSamplesLib.py b/SimMuL1/python/GEMCSCTriggerSamplesLib.py index 4bcc09a1f5c5e..37668d84c61c7 100644 --- a/SimMuL1/python/GEMCSCTriggerSamplesLib.py +++ b/SimMuL1/python/GEMCSCTriggerSamplesLib.py @@ -122,12 +122,16 @@ '/pnfs/cms/WAX/11/store/user/lpcgem/khotilov/GEM_NuGun_PU100_L1_dphi_pat2_110K/', '/pnfs/cms/WAX/11/store/user/lpcgem/khotilov/GEM_NuGun_PU100_L1_dphi_pat2_128K/'] -files['_gem98_pt2-50_PU0_pt5_new'] = ['/pnfs/cms/WAX/11/store/user/dildick/dildick/SingleMuPt2-50Fwdv2_1M/SingleMuPt2-50Fwdv2_1M_L1_PU0_Pt5/871a2070c5b60d6753827956fe591827/'] -files['_gem98_pt2-50_PU0_pt6_new'] = ['/pnfs/cms/WAX/11/store/user/dildick/dildick/SingleMuPt2-50Fwdv2_1M/SingleMuPt2-50Fwdv2_1M_L1_PU0_Pt6/871a2070c5b60d6753827956fe591827/'] +files['_gem98_pt2-50_PU0_pt0_new'] = ['/pnfs/cms/WAX/11/store/user/dildick/dildick/SingleMuPt2-50Fwdv2_1M/SingleMuPt2-50Fwdv2_1M_L1_PU0_Pt0/871a2070c5b60d6753827956fe591827/'] +files['_gem98_pt2-50_PU0_pt5_new'] = ['/pnfs/cms/WAX/11/store/user/dildick/dildick/SingleMuPt2-50Fwdv2_1M/SingleMuPt2-50Fwdv2_1M_L1_PU0_Pt5/871a2070c5b60d6753827956fe591827/'] +files['_gem98_pt2-50_PU0_pt6_new'] = ['/pnfs/cms/WAX/11/store/user/dildick/dildick/SingleMuPt2-50Fwdv2_1M/SingleMuPt2-50Fwdv2_1M_L1_PU0_Pt6/871a2070c5b60d6753827956fe591827/'] files['_gem98_pt2-50_PU0_pt10_new'] = ['/pnfs/cms/WAX/11/store/user/dildick/dildick/SingleMuPt2-50Fwdv2_1M/SingleMuPt2-50Fwdv2_1M_L1_PU0_Pt10/871a2070c5b60d6753827956fe591827/'] files['_gem98_pt2-50_PU0_pt15_new'] = ['/pnfs/cms/WAX/11/store/user/dildick/dildick/SingleMuPt2-50Fwdv2_1M/SingleMuPt2-50Fwdv2_1M_L1_PU0_Pt15/871a2070c5b60d6753827956fe591827/'] files['_gem98_pt2-50_PU0_pt20_new'] = ['/pnfs/cms/WAX/11/store/user/dildick/dildick/SingleMuPt2-50Fwdv2_1M/SingleMuPt2-50Fwdv2_1M_L1_PU0_Pt20/871a2070c5b60d6753827956fe591827/'] files['_gem98_pt2-50_PU0_pt30_new'] = ['/pnfs/cms/WAX/11/store/user/dildick/dildick/SingleMuPt2-50Fwdv2_1M/SingleMuPt2-50Fwdv2_1M_L1_PU0_Pt30/871a2070c5b60d6753827956fe591827/'] files['_gem98_pt2-50_PU0_pt40_new'] = ['/pnfs/cms/WAX/11/store/user/dildick/dildick/SingleMuPt2-50Fwdv2_1M/SingleMuPt2-50Fwdv2_1M_L1_PU0_Pt40/871a2070c5b60d6753827956fe591827/'] +files['_gem98_pt2-50_PU400_pt0_new'] = ['/pnfs/cms/WAX/11/store/user/dildick/dildick/SingleMuPt2-50Fwdv2_1M/SingleMuPt2-50Fwdv2_1M_L1_PU400_Pt0_v2/778c771068e2388f44bc7bc981a2bd26/'] + + diff --git a/SimMuL1/scripts/mkdir.py b/SimMuL1/scripts/mkdir.py index 0611bc84ba1a9..f0adcaf66d073 100644 --- a/SimMuL1/scripts/mkdir.py +++ b/SimMuL1/scripts/mkdir.py @@ -11,8 +11,10 @@ def mkdir(name = "triggerEffVsEtaPlots_pu100"): day = "%02d" % now[2] month = "%02d" % now[1] year = "%02d" % now[0] - pdir = gSystem.Getenv("PWD") + "/%s_%s%s%s_%s%s%s"%(name, year, month, day, hour, minu, sec) + pdir = gSystem.Getenv("PWD") + "/%s_%s%s%s_%s%s%s/"%(name, year, month, day, hour, minu, sec) if gSystem.AccessPathName(pdir)==0: "Directory already exists!" else: gSystem.MakeDirectory(pdir) + print "Created output directory: ", pdir + return pdir diff --git a/SimMuL1/scripts/triggerEfficiencyVsEtaPlots.py b/SimMuL1/scripts/triggerEfficiencyVsEtaPlots.py index 1ae53c620383d..88b18e29f93f6 100644 --- a/SimMuL1/scripts/triggerEfficiencyVsEtaPlots.py +++ b/SimMuL1/scripts/triggerEfficiencyVsEtaPlots.py @@ -599,30 +599,9 @@ def drawplot_etastep(fname, pu, dname="tf"): ##gStyle.SetStatH(0.08) gStyle.SetStatW(0.07) gStyle.SetStatH(0.06) - gStyle.SetOptStat(0) - gStyle.SetTitleStyle(0) - """ - if (strcmp(dname,"")>0) sprintf(d1,"_%s",dname) - if (strcmp(pu,"")>0) sprintf(d2,"_%s",pu) - sprintf(pdir,"pic%s%s",d1,d2) - - if (interactive){ - if( gSystem.AccessPathName(pdir)==0 ) { - cout<<"directory "< MatchCSCMuL1::detsWithHits() { @@ -150,6 +169,15 @@ MatchCSCMuL1::detsWithHits() //_____________________________________________________________________________ +/* + * Return the chambers with hits in a particular station, ring and with a + * minimum number of simhits + * + * @param station The station number + * @param ring The ring number + * @param minNHits Minimum number of simhits + * @return The chamber numbers + */ std::vector MatchCSCMuL1::chambersWithHits(int station, int ring, unsigned minNHits) { @@ -175,6 +203,10 @@ MatchCSCMuL1::chambersWithHits(int station, int ring, unsigned minNHits) //_____________________________________________________________________________ +/* + * Return the simhits for a particular detId + * INFO: this function is in use + */ std::vector MatchCSCMuL1::layerHits(int detId) { @@ -189,6 +221,9 @@ MatchCSCMuL1::layerHits(int detId) //_____________________________________________________________________________ +/* + * Return the simhits for a particular detId + */ std::vector MatchCSCMuL1::chamberHits(int detId) { @@ -208,6 +243,10 @@ MatchCSCMuL1::chamberHits(int detId) //_____________________________________________________________________________ +/* + * Return all simhits in the event + * Option to return only muon simhits + */ std::vector MatchCSCMuL1::allSimHits() { @@ -221,6 +260,14 @@ MatchCSCMuL1::allSimHits() //_____________________________________________________________________________ +/* + * Return the number of layers with a minimum number of hits in the chamber + * The minimum number of layers is specified elsewhere + * There is an option to only consider muon simhits in the counting of the layers + * + * @param detId The detId + * @return The number of layers with hits + */ int MatchCSCMuL1::numberOfLayersWithHitsInChamber(int detId) { @@ -282,15 +329,32 @@ MatchCSCMuL1::wireGroupAndStripInChamber( int detId ) //_____________________________________________________________________________ +/* + * Has the simtrack at least one chamber with the minimum number of hits + * + * @param st The station number + * @param minNHits The minimum number of hits + * @return True if it has a least one such chamber + */ bool MatchCSCMuL1::hasHitsInStation(int st, unsigned minNHits) // st=0 - any, st=1,2,3,4 - ME1-4 { + // why is ring number by default equal to 0 std::vector chIds = chambersWithHits(st,0,minNHits); - return chIds.size()==0; + return chIds.size()!=0; } //_____________________________________________________________________________ +/* + * Get the number of stations with the minimum number of hits + * @param me1 Station 1 flag + * @param me2 Station 2 flag + * @param me3 Station 3 flag + * @param me4 Station 4 flag + * @param minNHits The minimum number of hits + * @return The number of stations + */ unsigned MatchCSCMuL1::nStationsWithHits(bool me1, bool me2, bool me3, bool me4, unsigned minNHits) { @@ -302,6 +366,9 @@ MatchCSCMuL1::nStationsWithHits(bool me1, bool me2, bool me3, bool me4, unsigned //_____________________________________________________________________________ +/* + * Return the ALCTs in the readout + */ std::vector< MatchCSCMuL1::ALCT > MatchCSCMuL1::ALCTsInReadOut() { @@ -313,6 +380,9 @@ MatchCSCMuL1::ALCTsInReadOut() //_____________________________________________________________________________ +/* + * Return the ALCTs in the readout + */ std::vector< MatchCSCMuL1::ALCT > MatchCSCMuL1::vALCTs(bool readout) { @@ -322,6 +392,10 @@ MatchCSCMuL1::vALCTs(bool readout) //_____________________________________________________________________________ +/* + * Return the chamber Ids with ALCTs + * @param readout Do ALCTs have to be in the readout BX window? + */ std::vector MatchCSCMuL1::chambersWithALCTs(bool readout) { @@ -334,6 +408,11 @@ MatchCSCMuL1::chambersWithALCTs(bool readout) //_____________________________________________________________________________ +/* + * Return the ALCTs for a particular detId + * @param detId The detId + * @param readout Do ALCTs have to be in the readout BX window? + */ std::vector MatchCSCMuL1::chamberALCTs( int detId, bool readout ) { @@ -349,6 +428,11 @@ MatchCSCMuL1::chamberALCTs( int detId, bool readout ) //_____________________________________________________________________________ +/* + * Return the BXs with ALCTs for a particular detId + * @param detId The detId + * @param readout Do ALCTs have to be in the readout BX window? + */ std::vector MatchCSCMuL1::bxsWithALCTs( int detId, bool readout ) { @@ -361,6 +445,14 @@ MatchCSCMuL1::bxsWithALCTs( int detId, bool readout ) //_____________________________________________________________________________ +/* + * Return the ALCTs in a particular chamber for a particular BX + * Specify whether the ALCTs have to be in the readout + * @param detId The detId + * @param bx The BX + * @param readout Do ALCTs have to be in the readout BX window? + * + */ std::vector MatchCSCMuL1::chamberALCTsInBx( int detId, int bx, bool readout ) { @@ -373,6 +465,9 @@ MatchCSCMuL1::chamberALCTsInBx( int detId, int bx, bool readout ) //_____________________________________________________________________________ +/* + * Return the CLCTs in the readout + */ std::vector< MatchCSCMuL1::CLCT > MatchCSCMuL1::CLCTsInReadOut() { @@ -384,6 +479,9 @@ MatchCSCMuL1::CLCTsInReadOut() //_____________________________________________________________________________ +/* + * Return the CLCTs in the readout + */ std::vector< MatchCSCMuL1::CLCT > MatchCSCMuL1::vCLCTs(bool readout) { @@ -393,6 +491,10 @@ MatchCSCMuL1::vCLCTs(bool readout) //_____________________________________________________________________________ +/* + * Return the chamber Ids with CLCTs + * @param readout Do CLCTs have to be in the readout BX window? + */ std::vector MatchCSCMuL1::chambersWithCLCTs( bool readout) { @@ -404,6 +506,11 @@ MatchCSCMuL1::chambersWithCLCTs( bool readout) //_____________________________________________________________________________ +/* + * Return the CLCTs for a particular detId + * @param detId The detId + * @param readout Do CLCTs have to be in the readout BX window? + */ std::vector MatchCSCMuL1::chamberCLCTs( int detId, bool readout ) { @@ -419,6 +526,11 @@ MatchCSCMuL1::chamberCLCTs( int detId, bool readout ) //_____________________________________________________________________________ +/* + * Return the BXs with CLCTs for a particular detId + * @param detId The detId + * @param readout Do CLCTs have to be in the readout BX window? + */ std::vector MatchCSCMuL1::bxsWithCLCTs( int detId, bool readout ) { @@ -430,6 +542,11 @@ MatchCSCMuL1::bxsWithCLCTs( int detId, bool readout ) //_____________________________________________________________________________ +/* + * Return the BXs with CLCTs for a particular detId + * @param detId The detId + * @param readout Do CLCTs have to be in the readout BX window? + */ std::vector MatchCSCMuL1::chamberCLCTsInBx( int detId, int bx, bool readout ) { @@ -442,6 +559,9 @@ MatchCSCMuL1::chamberCLCTsInBx( int detId, int bx, bool readout ) //_____________________________________________________________________________ +/* + * Return the LCTs in the readout + */ std::vector< MatchCSCMuL1::LCT > MatchCSCMuL1::LCTsInReadOut() { @@ -453,6 +573,9 @@ MatchCSCMuL1::LCTsInReadOut() //_____________________________________________________________________________ +/* + * Return the LCTs in the readout + */ std::vector< MatchCSCMuL1::LCT > MatchCSCMuL1::vLCTs(bool readout) { @@ -462,6 +585,10 @@ MatchCSCMuL1::vLCTs(bool readout) //_____________________________________________________________________________ +/* + * Return the chamber Ids with LCTs + * @param readout Do LCTs have to be in the readout BX window? + */ std::vector MatchCSCMuL1::chambersWithLCTs( bool readout ) { @@ -473,6 +600,11 @@ MatchCSCMuL1::chambersWithLCTs( bool readout ) //_____________________________________________________________________________ +/* + * Return the LCTs for a particular detId + * @param detId The detId + * @param readout Do LCTs have to be in the readout BX window? + */ std::vector MatchCSCMuL1::chamberLCTs( int detId, bool readout ) { @@ -488,6 +620,11 @@ MatchCSCMuL1::chamberLCTs( int detId, bool readout ) //_____________________________________________________________________________ +/* + * Return the LCTs for a particular detId + * @param detId The detId + * @param readout Do LCTs have to be in the readout BX window? + */ std::vector MatchCSCMuL1::chamberLCTsp( int detId, bool readout ) { @@ -504,6 +641,11 @@ MatchCSCMuL1::chamberLCTsp( int detId, bool readout ) //_____________________________________________________________________________ +/* + * Return the BXs with LCTs for a particular detId + * @param detId The detId + * @param readout Do LCTs have to be in the readout BX window? + */ std::vector MatchCSCMuL1::bxsWithLCTs( int detId, bool readout ) { @@ -516,6 +658,14 @@ MatchCSCMuL1::bxsWithLCTs( int detId, bool readout ) //_____________________________________________________________________________ +/* + * Return the LCTs in a particular chamber for a particular BX + * Specify whether the LCTs have to be in the readout + * @param detId The detId + * @param bx The BX + * @param readout Do LCTs have to be in the readout BX window? + * + */ std::vector MatchCSCMuL1::chamberLCTsInBx( int detId, int bx, bool readout ) { @@ -528,6 +678,9 @@ MatchCSCMuL1::chamberLCTsInBx( int detId, int bx, bool readout ) //_____________________________________________________________________________ +/* + * Return the MPC LCTs in the readout + */ std::vector< MatchCSCMuL1::MPLCT > MatchCSCMuL1::MPLCTsInReadOut() { @@ -539,6 +692,9 @@ MatchCSCMuL1::MPLCTsInReadOut() //_____________________________________________________________________________ +/* + * Return the MPC LCTs in the readout + */ std::vector< MatchCSCMuL1::MPLCT > MatchCSCMuL1::vMPLCTs(bool readout) { @@ -548,6 +704,10 @@ MatchCSCMuL1::vMPLCTs(bool readout) //_____________________________________________________________________________ +/* + * Return the chamber Ids with MPC LCTs + * @param readout Do MPC LCTs have to be in the readout BX window? + */ std::vector MatchCSCMuL1::chambersWithMPLCTs(bool readout) { @@ -559,6 +719,11 @@ MatchCSCMuL1::chambersWithMPLCTs(bool readout) //_____________________________________________________________________________ +/* + * Return the MPC LCTs for a particular detId + * @param detId The detId + * @param readout Do MPC LCTs have to be in the readout BX window? + */ std::vector MatchCSCMuL1::chamberMPLCTs( int detId, bool readout ) { @@ -574,6 +739,11 @@ MatchCSCMuL1::chamberMPLCTs( int detId, bool readout ) //_____________________________________________________________________________ +/* + * Return the BXs with MPC LCTs for a particular detId + * @param detId The detId + * @param readout Do MPC LCTs have to be in the readout BX window? + */ std::vector MatchCSCMuL1::bxsWithMPLCTs( int detId, bool readout ) { @@ -586,6 +756,14 @@ MatchCSCMuL1::bxsWithMPLCTs( int detId, bool readout ) //_____________________________________________________________________________ +/* + * Return the MPC LCTs in a particular chamber for a particular BX + * Specify whether the MPC LCTs have to be in the readout + * @param detId The detId + * @param bx The BX + * @param readout Do MPC LCTs have to be in the readout BX window? + * + */ std::vector MatchCSCMuL1::chamberMPLCTsInBx( int detId, int bx, bool readout ) { @@ -818,6 +996,10 @@ MatchCSCMuL1::print (const char msg[300], bool psimtr, bool psimh, //_____________________________________________________________________________ +/* + * Get the best ALCT for a particular chamber; best is defined as the ALCT with + * the least difference in wire group number + */ MatchCSCMuL1::ALCT * MatchCSCMuL1::bestALCT(CSCDetId id, bool readout) { @@ -836,6 +1018,10 @@ MatchCSCMuL1::bestALCT(CSCDetId id, bool readout) //_____________________________________________________________________________ +/* + * Get the best CLCT for a particular chamber; best is defined as the CLCT with + * the least difference in strip number + */ MatchCSCMuL1::CLCT * MatchCSCMuL1::bestCLCT(CSCDetId id, bool readout) { @@ -854,12 +1040,16 @@ MatchCSCMuL1::bestCLCT(CSCDetId id, bool readout) //_____________________________________________________________________________ +/* + * Return the best TrackFinder track from a collection of TFTracks + * Option to sort the TFTracks according to pt + */ MatchCSCMuL1::TFTRACK * MatchCSCMuL1::bestTFTRACK(std::vector< TFTRACK > & tracks, bool sortPtFirst) { if (tracks.size()==0) return NULL; -// determine max # of matched stubs + // determine max # of matched stubs in the TFTrack collection int maxNMatchedMPC = 0; for (unsigned i=0; i & tracks, bool sortPtFirst) if (tracks[i].mplcts[s]->deltaOk) nst++; if (nst>maxNMatchedMPC) maxNMatchedMPC = nst; } -// collect tracks with max # of matched stubs + // collect tracks with max # of matched stubs std::vector bestMatchedTracks; for (unsigned i=0; i & tracks, bool sortPtFirst) if (tracks[i].mplcts[s]->deltaOk) nst++; if (nst==maxNMatchedMPC) bestMatchedTracks.push_back(i); } + + // already found the best TFTrack if (bestMatchedTracks.size()==1) return &(tracks[bestMatchedTracks[0]]); -// first sort by quality + // case when you have more than 1 best TFTrack + // first sort by quality double qBase = 1000000.; -// then sort by Pt inside the cone (if sortPtFirst), then sort by DR + // then sort by Pt inside the cone (if sortPtFirst), then sort by DR double ptBase = 0.; if (sortPtFirst) ptBase = 1000.; unsigned maxI = 99; @@ -902,12 +1095,16 @@ MatchCSCMuL1::bestTFTRACK(std::vector< TFTRACK > & tracks, bool sortPtFirst) //_____________________________________________________________________________ +/* + * Return the best TrackFinder candidate from a collection of TFCands + * Option to sort the TFCands according to pt + */ MatchCSCMuL1::TFCAND * MatchCSCMuL1::bestTFCAND(std::vector< TFCAND > & cands, bool sortPtFirst) { if (cands.size()==0) return NULL; -// determine max # of matched stubs + // determine max # of matched stubs int maxNMatchedMPC = 0; for (unsigned i=0; i & cands, bool sortPtFirst) if (cands[i].tftrack->mplcts[s]->deltaOk) nst++; if (nst>maxNMatchedMPC) maxNMatchedMPC = nst; } -// collect tracks with max # of matched stubs + + // collect tracks with max # of matched stubs std::vector bestMatchedTracks; if (maxNMatchedMPC>0) { for (unsigned i=0; i & cands, bool sortPtFirst) if (bestMatchedTracks.size()==1) return &(cands[bestMatchedTracks[0]]); } -// first sort by quality + // first sort by quality double qBase = 1000000.; -// then sort by Pt inside the cone (if sortPtFirst), then sort by DR + // then sort by Pt inside the cone (if sortPtFirst), then sort by DR double ptBase = 0.; if (sortPtFirst) ptBase = 1000.; unsigned maxI = 99; @@ -945,6 +1143,7 @@ MatchCSCMuL1::bestTFCAND(std::vector< TFCAND > & cands, bool sortPtFirst) for (unsigned m=0;mquality_packed() + ptBase*cands[i].l1cand->pt_packed() + 1./(0.01 + cands[i].dr); if (rr > maxRank) { maxRank = rr; maxI = i;} } @@ -954,6 +1153,10 @@ MatchCSCMuL1::bestTFCAND(std::vector< TFCAND > & cands, bool sortPtFirst) //_____________________________________________________________________________ +/* + * Return the best GMT Regional Candidate from a collection of GMT Regional Candidates + * Option to sort the GMT Regional Candidates to pt + */ MatchCSCMuL1::GMTREGCAND * MatchCSCMuL1::bestGMTREGCAND(std::vector< GMTREGCAND > & cands, bool sortPtFirst) { @@ -965,6 +1168,7 @@ MatchCSCMuL1::bestGMTREGCAND(std::vector< GMTREGCAND > & cands, bool sortPtFirst double maxRank = -999999.; for (unsigned i=0; i maxRank) { maxRank = rr; maxI = i;} } @@ -974,6 +1178,10 @@ MatchCSCMuL1::bestGMTREGCAND(std::vector< GMTREGCAND > & cands, bool sortPtFirst //_____________________________________________________________________________ +/* + * Return the best GMT Candidate from a collection of GMT Candidates + * Option to sort the GMT Candidates to pt + */ MatchCSCMuL1::GMTCAND * MatchCSCMuL1::bestGMTCAND(std::vector< GMTCAND > & cands, bool sortPtFirst) { @@ -985,6 +1193,7 @@ MatchCSCMuL1::bestGMTCAND(std::vector< GMTCAND > & cands, bool sortPtFirst) double maxRank = -999999.; for (unsigned i=0; i maxRank) { maxRank = rr; maxI = i;} } @@ -1114,6 +1323,9 @@ MatchCSCMuL1::TFTRACK::init(const csc::L1Track *t, CSCTFPtLUT* ptLUT, //_____________________________________________________________________________ +/* + * Has this TFTrack a stub in station 1,2,3,4 or in the muon barrel? + */ bool MatchCSCMuL1::TFTRACK::hasStub(int st) { @@ -1127,6 +1339,9 @@ MatchCSCMuL1::TFTRACK::hasStub(int st) //_____________________________________________________________________________ +/* + * Has this TFTrack a good CSC stub? + */ bool MatchCSCMuL1::TFTRACK::hasStubCSCOk(int st) { @@ -1140,6 +1355,9 @@ MatchCSCMuL1::TFTRACK::hasStubCSCOk(int st) //_____________________________________________________________________________ +/* + * How many stubs does this TFTrack has? + */ unsigned int MatchCSCMuL1::TFTRACK::nStubs(bool mb1, bool me1, bool me2, bool me3, bool me4) { @@ -1148,6 +1366,9 @@ MatchCSCMuL1::TFTRACK::nStubs(bool mb1, bool me1, bool me2, bool me3, bool me4) //_____________________________________________________________________________ +/* + * How many good CSC stubs does this TFTrack has? + */ unsigned int MatchCSCMuL1::TFTRACK::nStubsCSCOk(bool mb1, bool me1, bool me2, bool me3, bool me4) { @@ -1156,6 +1377,9 @@ MatchCSCMuL1::TFTRACK::nStubsCSCOk(bool mb1, bool me1, bool me2, bool me3, bool //_____________________________________________________________________________ +/* + * Does this track has the necessary number of stubs? + */ bool MatchCSCMuL1::TFTRACK::passStubsMatch(int minLowHStubs, int minMidHStubs, int minHighHStubs) { diff --git a/SimMuL1/test/runCustomMuL1Trigger_cfg.py b/SimMuL1/test/runCustomMuL1Trigger_cfg.py index 84f7ede90a17f..3f7891fd9f5f5 100644 --- a/SimMuL1/test/runCustomMuL1Trigger_cfg.py +++ b/SimMuL1/test/runCustomMuL1Trigger_cfg.py @@ -101,10 +101,8 @@ tmb = process.simCscTriggerPrimitiveDigis.tmbSLHC tmb.gemMatchDeltaEta = cms.untracked.double(0.08) tmb.gemMatchDeltaBX = cms.untracked.int32(1) -lct_store_gemdphi = True -if lct_store_gemdphi: - tmb.gemClearNomatchLCTs = cms.untracked.bool(False) - tmb.gemMatchDeltaPhiOdd = cms.untracked.double(2.) + +lct_keep_soft_stubs = False dphi_lct_pad98 = { 'pt05' : { 'odd' : 0.0220351 , 'even' : 0.00930056 }, 'pt06' : { 'odd' : 0.0182579 , 'even' : 0.00790009 }, @@ -114,8 +112,15 @@ 'pt30' : { 'odd' : 0.00416544 , 'even' : 0.00253782 }, 'pt40' : { 'odd' : 0.00342827 , 'even' : 0.00230833 } } -tmb.gemMatchDeltaPhiOdd = cms.untracked.double(dphi_lct_pad98[ptdphi]['odd']) -tmb.gemMatchDeltaPhiEven = cms.untracked.double(dphi_lct_pad98[ptdphi]['even']) +if ptdphi == 'pt0': + lct_keep_soft_stubs = True +if lct_keep_soft_stubs: + tmb.gemClearNomatchLCTs = cms.untracked.bool(False) + tmb.gemMatchDeltaPhiOdd = cms.untracked.double(2.) + tmb.gemMatchDeltaPhiEven = cms.untracked.double(2.) +else: + tmb.gemMatchDeltaPhiOdd = cms.untracked.double(dphi_lct_pad98[ptdphi]['odd']) + tmb.gemMatchDeltaPhiEven = cms.untracked.double(dphi_lct_pad98[ptdphi]['even']) ## upgrade CSC TrackFinder process.load('L1Trigger.CSCTrackFinder.csctfTrackDigisUngangedME1a_cfi') @@ -130,7 +135,7 @@ process.l1extraParticles.produceCaloParticles = cms.bool(False) process.l1extraParticles.ignoreHtMiss = cms.bool(False) -addPileUp = True +addPileUp = False if addPileUp: # list of MinBias files for pileup has to be provided path = os.getenv( "CMSSW_BASE" ) + "/src/GEMCode/SimMuL1/test/" @@ -153,7 +158,7 @@ process.source = cms.Source("PoolSource", duplicateCheckMode = cms.untracked.string('noDuplicateCheck'), inputCommands = cms.untracked.vstring('keep *_*_*_*'), - fileNames = cms.untracked.vstring('file:out_sim.root') + fileNames = cms.untracked.vstring('file:out_digi.root') ) import os @@ -181,7 +186,7 @@ ## output commands theOutDir = '' -theFileName = 'out_digi.root' +theFileName = 'out_L1.root' process.output = cms.OutputModule("PoolOutputModule", fileName = cms.untracked.string(theOutDir + theFileName), outputCommands = cms.untracked.vstring('keep *_*_*_*') diff --git a/SimMuL1/test/runGEMCSCTriggerEfficiency_cfg.py b/SimMuL1/test/runGEMCSCTriggerEfficiency_cfg.py index 79b2f78efae23..be2659d5ecec0 100644 --- a/SimMuL1/test/runGEMCSCTriggerEfficiency_cfg.py +++ b/SimMuL1/test/runGEMCSCTriggerEfficiency_cfg.py @@ -23,7 +23,7 @@ ## input from GEMCode.SimMuL1.GEMCSCTriggerSamplesLib import files -suffix = '_gem_dphi_pat2_PU0' +suffix = '_gem98_pt2-50_PU0_pt40_new' inputDir = files[suffix] theInputFiles = [] import os @@ -55,8 +55,8 @@ readout_windows = [ [5,10],[1,11],[1,11],[1,11] ] ## output -outputFileName = 'hp_' + sample + "_" + cmssw + "_" + globalTag + "_pu%s"%(pileup) + '_w%d'%(w) + suffix + '_eff.root' -outputFileName = 'gem_trigger_eff_ana.root' +outputFileName = 'hp_' + sample + "_" + cmssw + "_" + globalTag + "_pu%s"%(pileup) + '_w%d'%(w) + suffix + '_eff.test.root' +#outputFileName = 'gem_trigger_eff_ana.root' print "outputFile:", outputFileName # import of standard configurations diff --git a/SimMuL1/test/runSimpleMuon_cfg.py b/SimMuL1/test/runSimpleMuon_cfg.py index bcccace7d87bf..46ae7ba1a2971 100644 --- a/SimMuL1/test/runSimpleMuon_cfg.py +++ b/SimMuL1/test/runSimpleMuon_cfg.py @@ -1,6 +1,57 @@ import FWCore.ParameterSet.Config as cms +import os -process = cms.Process("Demo") +process = cms.Process("SIMMUON") + + +## CMSSW RELEASE +cmssw = os.getenv( "CMSSW_VERSION" ) + +## steering +events = 10000 +defaultEmu = False +ganged = False +pileup='000' +sample='dimu' +globalTag = 'upgrade2019' +#sample='minbias' + +## input +from GEMCode.SimMuL1.GEMCSCTriggerSamplesLib import files +suffix = '_gem98_pt2-50_PU0_pt20_new' +inputDir = files[suffix] +theInputFiles = [] +for d in range(len(inputDir)): + my_dir = inputDir[d] + if not os.path.isdir(my_dir): + print "ERROR: This is not a valid directory: ", my_dir + if d==len(inputDir)-1: + print "ERROR: No input files were selected" + exit() + continue + print "Proceed to next directory" + ls = os.listdir(my_dir) + ## this works only if you pass the location on pnfs - FIXME for files staring with store/user/... + theInputFiles.extend([my_dir[16:] + x for x in ls if x.endswith('root')]) + +##inputFiles = ['file:out_SingleMuPt10Fwd_GEM2019_8PartIncRad_DIGI_L1.root'] +#print "InputFiles: ", theInputFiles + +## readout windows +w=3 +if w==3: + readout_windows = [ [5,7],[5,7],[5,7],[5,7] ] +if w==11: + readout_windows = [ [1,11],[1,11],[1,11],[1,11] ] +if w==7: + readout_windows = [ [5,11],[5,11],[5,11],[5,11] ] +if w==61: + readout_windows = [ [5,10],[1,11],[1,11],[1,11] ] + +## output +outputFileName = 'hp_SimpleMuon_' + sample + "_" + cmssw + "_" + globalTag + "_pu%s"%(pileup) + '_w%d'%(w) + suffix + '_eff.test.root' +#outputFileName = 'gem_trigger_eff_ana.root' +print "outputFile:", outputFileName process.load("FWCore.MessageService.MessageLogger_cfi") process.load('FWCore.MessageService.MessageLogger_cfi') @@ -27,12 +78,12 @@ process.simCsctfTrackDigis.SectorReceiverInput = cms.untracked.InputTag("simCscTriggerPrimitiveDigis","MPCSORTED") process.simCsctfTrackDigis.SectorProcessor.isCoreVerbose = cms.bool(True) -process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(10000) ) +process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(events) ) #inputFile = ['file:/afs/cern.ch/user/d/dildick/work/GEM/CMSSW_6_2_0_SLHC1/src/out_L1_MuonGun_neweta_PU100_Pt20_50k_digi_preTrig2.root'] #inputFile = ['file:/afs/cern.ch/user/d/dildick/work/GEM/CMSSW_6_2_0_SLHC1/src/out_sim_singleMuPt100Fwdv2.root'] #inputFile = ['file:/afs/cern.ch/user/d/dildick/out_digi_1_1_QXc.root'] -inputFile = ['file:/afs/cern.ch/user/d/dildick/out_digi_30_1_mZD.root'] +#inputFile = ['file:/afs/cern.ch/user/d/dildick/out_digi_30_1_mZD.root'] #inputFile = ['file:/afs/cern.ch/user/d/dildick/work/GEM/digiFiles/GEM_NeutrinoGun_pu100_DIGI_L1/out_21_1_NlZ.root'] #inputFile = ['file:../../../../digiFiles/MuonGun_neweta_PU100_Pt20_50k_digi/Muon_DIGI_1632_1_baH.root'] @@ -41,7 +92,7 @@ # replace 'myfile.root' with the source file you want to use fileNames = cms.untracked.vstring( #'file:myfile.root' - *inputFile + *theInputFiles ) ) @@ -59,7 +110,7 @@ process.SimpleMuon.maxBxMPLCT = readout_windows[3][1] """ -outputFileName = 'output.test.root' +#outputFileName = 'output.test.root' process.TFileService = cms.Service("TFileService", fileName = cms.string(outputFileName) )