102 std::vector< edm::Handle<std::vector<L1MuRegionalCand> > > handleVec;
103 handleVec.push_back( rpcBarrel );
104 handleVec.push_back( rpcForward );
110 float etaGen = 0, phiGen = 0, ptGen = 0;
113 int noOfRecMuons = 0;
114 int noOfMatchedRecMuons = 0;
116 bool firstRunForMuonMatchingCnt =
true;
119 double deltarMin = -1;
120 edm::SimTrackContainer::const_iterator simTrk = simTracks->begin();
121 for (; simTrk != simTracks->end(); ++simTrk) {
123 if (simTrk->type() != -13 && simTrk->type()!=13)
continue;
125 edm::SimTrackContainer::const_iterator simTrk2 = simTrk;
127 for (; simTrk2 != simTracks->end(); ++simTrk2) {
128 if (simTrk2->type() != -13 && simTrk2->type()!=13)
continue;
129 double drCand =
reco::deltaR(simTrk2->momentum(), simTrk->momentum());
130 if (drCand < deltarMin || deltarMin < 0) deltarMin = drCand;
137 if (deltarMin < 0.7 && deltarMin > 0)
return;
139 simTrk = simTracks->begin();
140 for (; simTrk != simTracks->end(); simTrk++) {
141 int type = simTrk->type();
142 if (type == 13 || type == -13) {
145 etaGen = momentum.eta();
146 ptGen = momentum.Pt();
147 phiGen = momentum.phi();
150 bool matched =
false;
160 for ( std::vector<
edm::Handle<std::vector<L1MuRegionalCand> > >::iterator it = handleVec.begin();
161 it != handleVec.end();
164 std::vector<L1MuRegionalCand>::const_iterator itRPC;
165 for (itRPC=(*it)->begin(); itRPC!=(*it)->end(); itRPC++){
166 int ptCode = itRPC->pt_packed();
169 if (firstRunForMuonMatchingCnt) ++noOfRecMuons;
171 phiRec=itRPC->phi_packed();
172 qual = itRPC->quality();
173 towerRec = itRPC->eta_packed();
175 towerRec = - ( (~towerRec & 63) + 1);
178 float pi = 3.14159265;
180 float phiScaled = phiGen;
181 if (phiScaled<0) phiScaled += 2*
pi;
182 int phiHwGen = (phiScaled)/2/pi*144;
192 ++noOfMatchedRecMuons;
193 m_outfileR << etaGen <<
" " << phiGen <<
" " << ptGen
194 <<
" " << towerRec <<
" " << phiRec <<
" " << ptCodeRec <<
" " << qual
201 firstRunForMuonMatchingCnt=
false;
203 m_outfileR << etaGen <<
" " << phiGen <<
" " << ptGen
204 <<
" " << 0 <<
" " << 0 <<
" " << 0 <<
" " << 0
218 if (noOfMatchedRecMuons!=noOfRecMuons) {
219 edm::LogInfo(
"RPCEffWarn") <<
" MuonCands " << noOfRecMuons
220 <<
" matched " << noOfMatchedRecMuons
221 <<
" in run " << rnNum
222 <<
" event " << evNum;
EventNumber_t event() const
ROOT::Math::LorentzVector< ROOT::Math::PxPyPzE4D< double > > XYZTLorentzVectorD
Lorentz vector with cylindrical internal representation using pseudorapidity.
unsigned int EventNumber_t
bool getByToken(EDGetToken token, Handle< PROD > &result) const
edm::EDGetTokenT< edm::SimTrackContainer > m_g4Token
edm::EDGetTokenT< std::vector< L1MuRegionalCand > > m_rpcfToken
Abs< T >::type abs(const T &t)
auto deltaR(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
edm::EDGetTokenT< std::vector< L1MuRegionalCand > > m_rpcbToken
static int towerNumFromEta(const double eta)