59 ps.getParameter< edm::InputTag >(
"rpcb"))),
61 ps.getParameter< edm::InputTag >(
"rpcf"))),
63 ps.getParameter< edm::InputTag >(
"g4"))),
65 ps.getParameter< edm::InputTag >(
"rpcdigi")))
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;
254 std::stringstream
ss;
260 std::set<int> hwPlanes;
263 for (detUnitIt=rpcDigis->begin();
264 detUnitIt!=rpcDigis->end();
271 digiIt!=range.second;
274 if (digiIt->bx() == 0) {
280 if (!hasBX0)
continue;
282 const RPCDetId&
id = (*detUnitIt).first;
284 int layer =
id.layer();
290 else if (station == 4)
293 else if (station == 1 && layer == 1)
296 else if (station == 1 && layer == 2)
299 else if (station == 2 && layer == 1)
302 else if (station == 2 && layer == 2)
306 std::cout <<
"??????????????" << std::endl;
311 for (std::set<int>::iterator it= hwPlanes.begin();
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
RPCPhiEff(const edm::ParameterSet &)
double deltaR(const T1 &t1, const T2 &t2)
edm::EDGetTokenT< edm::SimTrackContainer > m_g4Token
std::string fromRaw(const edm::Event &iEvent)
edm::EDGetTokenT< std::vector< L1MuRegionalCand > > m_rpcfToken
Abs< T >::type abs(const T &t)
edm::EDGetTokenT< RPCDigiCollection > m_rpcdigiToken
std::vector< RPCDigi >::const_iterator const_iterator
virtual void analyze(const edm::Event &, const edm::EventSetup &)
edm::EDGetTokenT< std::vector< L1MuRegionalCand > > m_rpcbToken
std::pair< const_iterator, const_iterator > Range
static int towerNumFromEta(const double eta)
std::string fromCones(const edm::Event &iEvent)
std::vector< SimTrack > SimTrackContainer