33 using namespace L1TwinMux;
34 using namespace L1TMuon;
41 inline virtual std::auto_ptr<L1MuDTChambPhContainer> produce(
const edm::EventSetup&);
52 std::vector<TriggerPrimitiveRef>::const_iterator it = rpc.begin();
53 std::vector<TriggerPrimitiveRef>::const_iterator
end = rpc.end();
54 for ( ; it !=
end ; ++it ) out << (*it)->getCMSGlobalPhi() <<
'\t';
64 : mbltContainer(_mbltContainer)
77 const int _qualityRemappingMode = 2;
78 const int _useRpcBxForDtBelowQuality = 8;
79 const bool _is7QualityCodes =
true;
85 std::vector<L1MuDTChambPhDigi> phiChambVector;
94 std::vector<L1MuDTChambPhDigi> phiVector;
96 for ( ; st != stend; ++st ) {
102 int wheel = mbltStation.
wheel();
103 int sector = mbltStation.
sector();
108 std::vector<size_t> uncorrelated;
109 std::vector<size_t> correlated;
110 for (
size_t iDt = 0; iDt < dtListSize; ++iDt ) {
112 int dtquality = dt->getDTData().qualityCode;
130 switch ( dtquality ) {
134 case 2 : uncorrelated.push_back( iDt );
continue;
135 case 3 : uncorrelated.push_back( iDt );
continue;
136 case 4 : correlated.push_back( iDt );
continue;
137 case 5 : correlated.push_back( iDt );
continue;
138 case 6 : correlated.push_back( iDt );
continue;
149 size_t cSize = correlated.size();
150 for (
size_t idxDt = 0; idxDt < cSize; ++idxDt ) {
152 int iDt = correlated.at(idxDt);
153 if ( iDt < 0 )
continue;
157 size_t rpcInMatchSize = rpcInMatch.size();
158 size_t rpcOutMatchSize = rpcOutMatch.size();
159 if ( rpcInMatchSize && rpcOutMatchSize ) {
168 }
else if (rpcInMatchSize){
174 else if (rpcOutMatchSize){
181 int newBx=dt.
getBX();
187 if ( ! _is7QualityCodes ) {
190 case 4 : qualityCode = 14;
break;
191 case 5 : qualityCode = 15;
break;
192 case 6 : qualityCode = 15;
break;
201 phiChambVector.push_back( chamb );
206 size_t uncSize = uncorrelated.size();
207 for (
size_t idxDt = 0; idxDt < uncSize; ++idxDt ) {
209 int iDt = uncorrelated.at(idxDt);
210 if ( iDt < 0 )
continue;
216 double minDeltaPhiDt = 9999999999;
217 for (
size_t jdxDt = idxDt+1; jdxDt < uncSize; ++jdxDt ) {
219 int jDt = uncorrelated.at(jdxDt);
220 if ( jDt < 0 )
continue;
227 if ( deltaPhiDt < minDeltaPhiDt ) {
230 minDeltaPhiDt=deltaPhiDt;
236 if ( closest > 0 && minDeltaPhiDt < 0.05 ) {
245 int bendingAngle = 0;
248 combiner.
addDt( dt );
252 uncorrelated[closestIdx] = -1;
263 if ( match == MBLTCollection::INMATCH ) {
270 }
else if ( match == MBLTCollection::OUTMATCH ) {
277 }
else if ( match == MBLTCollection::FULLMATCH ) {
291 size_t rpcInMatchSize = rpcInMatch.size();
292 size_t rpcOutMatchSize = rpcOutMatch.size();
295 if ( rpcInMatchSize && rpcOutMatchSize ) {
314 }
else if ( rpcInMatchSize ) {
322 }
else if ( rpcOutMatchSize ) {
347 int qualityCode = ( _is7QualityCodes ?
353 bendingAngle, qualityCode,
355 phiChambVector.push_back( chamb );
376 const std::vector< std::pair< TriggerPrimitiveList, TriggerPrimitiveList > >
378 auto rpcPair = rpcPairList.cbegin();
379 auto rpcPairEnd = rpcPairList.cend();
380 for ( ; rpcPair != rpcPairEnd; ++ rpcPair ) {
384 if ( inRpc.empty() && outRpc.empty() )
continue;
387 size_t inSize = inRpc.size();
388 size_t outSize = outRpc.size();
400 for (
size_t i = 0;
i < inSize; ++
i ) {
401 double locPhi = inRpc.at(
i)->getCMSGlobalPhi();
403 avPhiSin +=
sin( locPhi );
404 avPhiCos +=
cos( locPhi );
409 double avPhiIn = atan2( avPhiSin, avPhiCos );
411 double minDist = fabs( inRpc.at(0)->getCMSGlobalPhi() - avPhiIn );
412 for (
size_t i = 1;
i < inSize; ++
i ) {
413 double dist = fabs( inRpc.at(
i)->getCMSGlobalPhi() - avPhiIn );
414 if ( dist < minDist ) {
436 for (
size_t i = 0;
i < outSize; ++
i ) {
437 double locPhi = outRpc.at(
i)->getCMSGlobalPhi();
439 avPhiSin +=
sin( locPhi );
440 avPhiCos +=
cos( locPhi );
446 double avPhiOut = atan2( avPhiSin, avPhiCos );
447 double minDist = fabs( outRpc.at(0)->getCMSGlobalPhi() - avPhiOut );
448 for (
size_t i = 1;
i < outSize; ++
i ) {
449 double dist = fabs( outRpc.at(
i)->getCMSGlobalPhi() - avPhiOut );
450 if ( dist < minDist ) {
496 double bx = combiner.
bx();
497 double Ts2TagCode = 0;
498 double BxCntCode = 0;
501 int qualityCode = ( _is7QualityCodes ?
504 if ( qualityCode >= 0 ) {
507 bendingAngle, qualityCode,
508 Ts2TagCode, BxCntCode );
509 phiChambVector.push_back( chamb );
523 out->setContainer( phiChambVector );
int wheel() const
returns wheel
int getUncorrelatedQuality7() const
FIXME END.
int getUncorrelatedQuality16() const
const DTData getDTData() const
void addRpcIn(const TriggerPrimitive &prim)
a struct useful for resulution info sharing
Sin< T >::type sin(const T &t)
virtual std::auto_ptr< L1MuDTChambPhContainer > produce(const edm::EventSetup &)
bool isValid() const
valid if we have at least: 1 rpc; 1 dt + 1 any
bxMatch haveCommonRpc(size_t dt1, size_t dt2) const
std::vector< std::pair< TriggerPrimitiveList, TriggerPrimitiveList > > getUnassociatedRpcClusters(double minRpcPhi) const
RPC unassociated clusters.
std::auto_ptr< MBLTContainer > mbltContainer
std::ostream & operator<<(std::ostream &out, const ALILine &li)
void combine()
do combine the primitives
const double getCMSGlobalPhi() const
TriggerPrimitiveList getRpcInAssociatedStubs(size_t dtIndex) const
rpc inner layer hits associated to a given dt station
Cos< T >::type cos(const T &t)
Abs< T >::type abs(const T &t)
~L1ITMuonBarrelPrimitiveProducer()
int sector() const
returns sector
double deltaPhi(double phi1, double phi2)
void addRpcOut(const TriggerPrimitive &prim)
std::vector< TriggerPrimitiveRef > TriggerPrimitiveList
int bx() const
output result variables
int station() const
returns station
void addDt(const TriggerPrimitive &prim)
feed the combiner with the available primitives
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
void setCMSGlobalPhi(const double phi)
TriggerPrimitiveList getRpcOutAssociatedStubs(size_t dtIndex) const
rpc outer layer hits associated to a given dt station
L1ITMuonBarrelPrimitiveProducer(std::auto_ptr< MBLTContainer > _mbltContainer)
const TriggerPrimitiveList & getDtSegments() const
return a reference to the DT only segments
edm::ESHandle< DTGeometry > _muonGeom