14 const std::string&
name,
25 ATH_CHECK( m_nswPatternFinder.retrieve() );
27 return StatusCode::SUCCESS;
35 int StationName = mdtHit.
name;
40 int Tube = mdtHit.
Tube;
42 ATH_MSG_DEBUG(
"...StationName/StationEta/StationPhi/Multilayer/Layer/Tube="
43 << StationName <<
"/" << StationEta <<
"/" << StationPhi <<
"/" << Multilayer <<
"/"
44 <<
Layer <<
"/" << Tube);
46 Identifier id = ( mdtHit.
Id.
is_valid() ) ? mdtHit.
Id : m_idHelperSvc->mdtIdHelper().channelID(StationName,StationEta,
47 StationPhi,Multilayer,
Layer,Tube);
50 int adcCounts = mdtHit.
Adc;
54 const double cosDphi =
std::cos(std::abs(track_phi -
phi0));
55 double InCo = cosDphi ? 1./ cosDphi: 0;
63 ATH_MSG_DEBUG(
"... MDT hit raw digit tdcCounts/adcCounts=" << tdcCounts <<
"/" << adcCounts);
65 ATH_MSG_DEBUG(
"... MDT hit position X/Y/Z/track_phi/Multilayer/Layer/Tube="
66 <<
Amg::toString(point, 2) <<
"/" << track_phi <<
"/" << Multilayer <<
"/" <<
Layer <<
"/" << Tube);
68 MdtCalibOutput calibOut = m_mdtCalibrationTool->calibrate(Gaudi::Hive::currentContext(), calHit,
false);
72 ATH_MSG_DEBUG(
"... MDT hit calibrated driftSpace/driftSigma=" << driftSpace <<
"/" << driftSigma);
95 std::vector<TrigL2MuonSA::TrackPattern>& v_trackPatterns)
const
97 ATH_CHECK( findPatterns(muonRoad, mdtHits, v_trackPatterns) );
98 ATH_CHECK( m_nswPatternFinder->findPatterns(muonRoad, stgcHits, mmHits, v_trackPatterns.back()) );
100 for(
unsigned int i_hit=0; i_hit<v_trackPatterns.back().stgcSegment.size(); i_hit++) {
101 ATH_MSG_DEBUG(
"PatternFinder: output sTGC hits global eta/phi/r/z/layer/channelType/isOutlier " << v_trackPatterns.back().stgcSegment[i_hit].eta <<
"/" << v_trackPatterns.back().stgcSegment[i_hit].phi <<
"/" << v_trackPatterns.back().stgcSegment[i_hit].r <<
"/" << v_trackPatterns.back().stgcSegment[i_hit].z <<
"/" << v_trackPatterns.back().stgcSegment[i_hit].layerNumber <<
"/" << v_trackPatterns.back().stgcSegment[i_hit].channelType <<
"/" << v_trackPatterns.back().stgcSegment[i_hit].isOutlier);
104 for(
unsigned int i_hit=0; i_hit<v_trackPatterns.back().mmSegment.size(); i_hit++) {
105 ATH_MSG_DEBUG(
"PatternFinder: output MM hits global eta/phi/r/z/layer/isOutlier " << v_trackPatterns.back().mmSegment[i_hit].eta <<
"/" << v_trackPatterns.back().mmSegment[i_hit].phi <<
"/" << v_trackPatterns.back().mmSegment[i_hit].r <<
"/" << v_trackPatterns.back().mmSegment[i_hit].z <<
"/" << v_trackPatterns.back().mmSegment[i_hit].layerNumber <<
"/" << v_trackPatterns.back().mmSegment[i_hit].isOutlier);
108 return StatusCode::SUCCESS;
115 std::vector<TrigL2MuonSA::TrackPattern>& v_trackPatterns)
const
119 v_trackPatterns.clear();
126 const unsigned int MAX_STATION = 11;
127 const unsigned int MAX_LAYER = 12;
131 for(
unsigned int i_station=0; i_station<MAX_STATION; i_station++) {
132 for(
unsigned int i_layer=0; i_layer<MAX_LAYER; i_layer++) {
133 v_mdtLayerHits[i_station][i_layer].
ntot = 0;
134 v_mdtLayerHits[i_station][i_layer].ntot_all = 0;
135 v_mdtLayerHits[i_station][i_layer].ndigi = 0;
136 v_mdtLayerHits[i_station][i_layer].ndigi_all = 0;
137 v_mdtLayerHits[i_station][i_layer].ResSum = 0.;
141 unsigned int i_layer_max = 0;
142 unsigned int chamber_max = 0;
147 for(
unsigned int i_hit=0; i_hit<mdtHits.size(); i_hit++) {
149 unsigned int chamber = mdtHits[i_hit].Chamber;
156 double Z = mdtHits[i_hit].Z;
157 double R = mdtHits[i_hit].R;
159 double residual = calc_residual(aw,bw,Z,R);
160 mdtHits[i_hit].R = R;
162 mdtHits[i_hit].isOutlier = 0;
163 unsigned int i_layer = mdtHits[i_hit].Layer;
167 <<
chamber <<
"/" << Z <<
"/" << R <<
"/" << aw <<
"/" << bw <<
"/" <<
residual <<
"/" << rWidth);
169 int stationPhi = mdtHits[i_hit].StationPhi;
170 std::string
name = m_idHelperSvc->mdtIdHelper().stationNameString(mdtHits[i_hit].
name);
171 int chamber_this = 99;
172 int sector_this = 99;
176 mdtHits[i_hit].isOutlier = 3;
181 mdtHits[i_hit].isOutlier = 2;
186 if( mdtHits[i_hit].TubeLayer < 1 || i_layer > (MAX_LAYER-1) ) {
188 return StatusCode::FAILURE;
190 if( i_layer > i_layer_max ) i_layer_max = i_layer;
192 v_mdtLayerHits[
chamber][i_layer].indexes.push_back(i_hit);
193 v_mdtLayerHits[
chamber][i_layer].ndigi++;
194 v_mdtLayerHits[
chamber][i_layer].ndigi_all++;
195 v_mdtLayerHits[
chamber][0].ntot++;
196 v_mdtLayerHits[
chamber][0].ntot_all++;
201 const double DeltaMin = 0.025;
215 unsigned int layer = 999999;
218 unsigned int i_hit_max = 999999;
219 ResMed = (v_mdtLayerHits[
chamber][0].ntot!=0)?
220 v_mdtLayerHits[
chamber][0].ResSum/v_mdtLayerHits[
chamber][0].ntot : 0.;
221 for(
unsigned int i_layer=0; i_layer<=i_layer_max; i_layer++) {
222 for(
unsigned int idigi=0; idigi<v_mdtLayerHits[
chamber][i_layer].ndigi_all;idigi++) {
224 unsigned int i_hit = v_mdtLayerHits[
chamber][i_layer].indexes[idigi];
225 if(mdtHits[i_hit].isOutlier > 0)
continue;
226 double DistMed = std::abs(mdtHits[i_hit].
Residual - ResMed);
227 if(DistMed>=DistMax) {
235 ATH_MSG_DEBUG(
"ResMed=" << ResMed <<
": DistMax/layer/i_hit_max/ntot="
236 << DistMax <<
"/" <<
layer <<
"/" << i_hit_max <<
"/" << v_mdtLayerHits[
chamber][0].ntot);
238 if(
layer == 999999)
break;
241 double Delta = 2.*std::abs((ResMed - Mednew)/(ResMed + Mednew));
242 ATH_MSG_DEBUG(
"Mednew/Delta/DeltaMin=" << Mednew <<
"/" << Delta <<
"/" << DeltaMin);
243 if(Delta<=DeltaMin)
break;
247 v_mdtLayerHits[
chamber][0].ntot--;
249 mdtHits[i_hit_max].isOutlier = 2;
259 for(
unsigned int i_layer=0; i_layer<=i_layer_max; i_layer++) {
264 while( v_mdtLayerHits[
chamber][i_layer].ndigi>=2 ) {
266 unsigned int i_hit_max = 999999;
267 for(
unsigned int idigi=0;idigi<v_mdtLayerHits[
chamber][i_layer].ndigi_all;idigi++) {
268 unsigned int i_hit = v_mdtLayerHits[
chamber][i_layer].indexes[idigi];
269 if( mdtHits[i_hit].isOutlier > 0 )
continue;
270 if( std::abs(mdtHits[i_hit].
Residual) >= ResMax ) {
271 ResMax = std::abs(mdtHits[i_hit].
Residual);
275 ATH_MSG_DEBUG(
"ResMax=" << ResMax <<
": i_hit_max=" << i_hit_max);
276 if( i_hit_max == 999999 )
break;
277 v_mdtLayerHits[
chamber][0].ResSum = v_mdtLayerHits[
chamber][0].ResSum - ResMax;
278 v_mdtLayerHits[
chamber][0].ntot--;
279 v_mdtLayerHits[
chamber][i_layer].ndigi--;
280 mdtHits[i_hit_max].isOutlier = 1;
284 for(
unsigned int i_digi=0; i_digi< v_mdtLayerHits[
chamber][i_layer].ndigi_all; i_digi++) {
285 unsigned int i_hit = v_mdtLayerHits[
chamber][i_layer].indexes[i_digi];
286 if (i_layer==0)
phi0 = mdtHits[i_hit].cPhi0;
287 doMdtCalibration(mdtHits[i_hit], trigger_phi,
phi0, muonRoad.
isEndcap);
288 if (mdtHits[i_hit].isOutlier > 1)
continue;
289 mdtSegment.push_back(mdtHits[i_hit]);
294 ATH_MSG_DEBUG(
"nr of hits in segment=" << mdtSegment.size());
299 v_trackPatterns.push_back(trackPattern);
301 return StatusCode::SUCCESS;
313 double dz =
x - (
y-bw)*ia;
314 return dz/std::sqrt(1.+iaq);