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 = 5;
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 ) {
352 int qualityCode = ( _is7QualityCodes ?
358 bendingAngle, qualityCode,
360 phiChambVector.push_back( chamb );
381 const std::vector< std::pair< TriggerPrimitiveList, TriggerPrimitiveList > >
383 auto rpcPair = rpcPairList.cbegin();
384 auto rpcPairEnd = rpcPairList.cend();
385 for ( ; rpcPair != rpcPairEnd; ++ rpcPair ) {
389 if ( inRpc.empty() && outRpc.empty() )
continue;
392 size_t inSize = inRpc.size();
393 size_t outSize = outRpc.size();
405 for (
size_t i = 0;
i < inSize; ++
i ) {
406 double locPhi = inRpc.at(
i)->getCMSGlobalPhi();
408 avPhiSin +=
sin( locPhi );
409 avPhiCos +=
cos( locPhi );
414 double avPhiIn = atan2( avPhiSin, avPhiCos );
416 double minDist = fabs( inRpc.at(0)->getCMSGlobalPhi() - avPhiIn );
417 for (
size_t i = 1;
i < inSize; ++
i ) {
418 double dist = fabs( inRpc.at(
i)->getCMSGlobalPhi() - avPhiIn );
419 if ( dist < minDist ) {
441 for (
size_t i = 0;
i < outSize; ++
i ) {
442 double locPhi = outRpc.at(
i)->getCMSGlobalPhi();
444 avPhiSin +=
sin( locPhi );
445 avPhiCos +=
cos( locPhi );
451 double avPhiOut = atan2( avPhiSin, avPhiCos );
452 double minDist = fabs( outRpc.at(0)->getCMSGlobalPhi() - avPhiOut );
453 for (
size_t i = 1;
i < outSize; ++
i ) {
454 double dist = fabs( outRpc.at(
i)->getCMSGlobalPhi() - avPhiOut );
455 if ( dist < minDist ) {
501 double bx = combiner.
bx();
502 double Ts2TagCode = 0;
503 double BxCntCode = 0;
506 int qualityCode = ( _is7QualityCodes ?
509 if ( qualityCode >= 0 ) {
512 bendingAngle, qualityCode,
513 Ts2TagCode, BxCntCode );
514 phiChambVector.push_back( chamb );
528 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