14 #include "GaudiKernel/IToolSvc.h"
26 #include "CaloEvent/CaloCluster.h"
27 #include "CaloEvent/CaloClusterContainer.h"
45 ISvcLocator *pSvcLocator) :
47 m_TrackName(
"Tracks"),
71 IAlgTool* algTool = 0;
73 StatusCode sc = toolSvc()->retrieveTool(
"ExtrapolTrackToCaloTool", algTool,
this);
79 return StatusCode::FAILURE;
83 ATH_CHECK( toolSvc()->retrieveTool(
"TBCaloCoordinate",
tool) );
90 return StatusCode::FAILURE;
94 return StatusCode::SUCCESS;
120 return StatusCode::SUCCESS;
128 return StatusCode::SUCCESS;
135 bool got_a_track =
false;
137 ATH_MSG_DEBUG (
"TBTrackToCaloAlg::CreateTrkImpactInCalo()" );
142 if(
sc != StatusCode::SUCCESS){
168 else ATH_MSG_DEBUG (
" ImpactInCalo pointer not valid for this track");
188 else ATH_MSG_DEBUG (
" ImpactInCalo pointer not valid for this track");
212 ATH_MSG_ERROR (
" No track parameters for this track ??? do nothing " );
217 double trketa_at = 0.;
218 double trkphi_at = 0.;
226 double etaCaloLocal_0 = 0;
227 double phiCaloLocal_0 = 0;
228 double trketa_at_0 = 0.;
229 double trkphi_at_0 = 0.;
234 double etaCaloLocal_1 = 0;
235 double phiCaloLocal_1 = 0;
236 double trketa_at_1 = 0.;
237 double trkphi_at_1 = 0.;
242 double etaCaloLocal_2 = 0;
243 double phiCaloLocal_2 = 0;
244 double trketa_at_2 = 0.;
245 double trkphi_at_2 = 0.;
250 double etaCaloLocal_3 = 0;
251 double phiCaloLocal_3 = 0;
252 double trketa_at_3 = 0.;
253 double trkphi_at_3 = 0.;
255 double x_ctb_tile = 0;
256 double y_ctb_tile = 0;
257 double z_ctb_tile = 0;
258 double etaCaloLocal_tile = 0;
259 double phiCaloLocal_tile = 0;
260 double trketa_at_tile = 0.;
261 double trkphi_at_tile = 0.;
269 ATH_MSG_DEBUG (
" TrackTo ...PS : for eta= " << trketa <<
" dist to Barrel =" << distbar
270 <<
" to endcap =" << distec );
278 pt_calo_ctb,pt_calo_local,trketa_at,trkphi_at);
282 x_ctb_0 = pt_calo_ctb->x();
283 y_ctb_0 = pt_calo_ctb->y();
284 z_ctb_0 = pt_calo_ctb->z();
285 etaCaloLocal_0 = pt_calo_local->eta();
286 phiCaloLocal_0 = pt_calo_local->phi();
287 trketa_at_0 = trketa_at;
288 trkphi_at_0 = trkphi_at;
291 <<
" etaCaloLocal=" << pt_calo_local->eta()
292 <<
" phiCaloLocal=" << pt_calo_local->phi() );
299 ATH_MSG_DEBUG (
" TrackTo ...Strip : for eta= " << trketa <<
" dist to Barrel =" << distbar
300 <<
" to endcap =" << distec );
308 pt_calo_ctb,pt_calo_local,trketa_at,trkphi_at);
312 x_ctb_1 = pt_calo_ctb->x();
313 y_ctb_1 = pt_calo_ctb->y();
314 z_ctb_1 = pt_calo_ctb->z();
315 etaCaloLocal_1 = pt_calo_local->eta();
316 phiCaloLocal_1 = pt_calo_local->phi();
317 trketa_at_1 = trketa_at;
318 trkphi_at_1 = trkphi_at;
321 <<
" etaCaloLocal=" << pt_calo_local->eta()
322 <<
" phiCaloLocal=" << pt_calo_local->phi() );
330 ATH_MSG_DEBUG (
" TrackTo ...Middle : for eta= " << trketa <<
" dist to Barrel =" << distbar
331 <<
" to endcap =" << distec );
339 pt_calo_ctb,pt_calo_local,trketa_at,trkphi_at);
343 x_ctb_2 = pt_calo_ctb->x();
344 y_ctb_2 = pt_calo_ctb->y();
345 z_ctb_2 = pt_calo_ctb->z();
346 etaCaloLocal_2 = pt_calo_local->eta();
347 phiCaloLocal_2 = pt_calo_local->phi();
348 trketa_at_2 = trketa_at;
349 trkphi_at_2 = trkphi_at;
352 <<
" etaCaloLocal=" << pt_calo_local->eta()
353 <<
" phiCaloLocal=" << pt_calo_local->phi() );
368 ATH_MSG_DEBUG (
" TrackTo ...Back : for eta= " << trketa <<
" dist to Barrel =" << distbar
369 <<
" to endcap =" << distec );
377 pt_calo_ctb,pt_calo_local,trketa_at,trkphi_at);
381 x_ctb_3 = pt_calo_ctb->x();
382 y_ctb_3 = pt_calo_ctb->y();
383 z_ctb_3 = pt_calo_ctb->z();
384 etaCaloLocal_3 = pt_calo_local->eta();
385 phiCaloLocal_3 = pt_calo_local->phi();
386 trketa_at_3 = trketa_at;
387 trkphi_at_3 = trkphi_at;
390 <<
" etaCaloLocal=" << pt_calo_local->eta()
391 <<
" phiCaloLocal=" << pt_calo_local->phi() );
398 ATH_MSG_DEBUG (
" TrackTo ...Tile : for eta= " << trketa <<
" dist to Barrel =" << distbar
399 <<
" to endcap =" << distec );
407 pt_calo_ctb,pt_calo_local,trketa_at,trkphi_at);
411 x_ctb_tile = pt_calo_ctb->x();
412 y_ctb_tile = pt_calo_ctb->y();
413 z_ctb_tile = pt_calo_ctb->z();
414 etaCaloLocal_tile = pt_calo_local->eta();
415 phiCaloLocal_tile = pt_calo_local->phi();
416 trketa_at_tile = trketa_at;
417 trkphi_at_tile = trkphi_at;
420 <<
" etaCaloLocal=" << pt_calo_local->eta()
421 <<
" phiCaloLocal=" << pt_calo_local->phi() );
425 ImpactInCalo * imp=
new ImpactInCalo(x_ctb_0, y_ctb_0, z_ctb_0, etaCaloLocal_0, phiCaloLocal_0, trketa_at_0, trkphi_at_0,
426 x_ctb_1, y_ctb_1, z_ctb_1, etaCaloLocal_1, phiCaloLocal_1, trketa_at_1, trkphi_at_1,
427 x_ctb_2, y_ctb_2, z_ctb_2, etaCaloLocal_2, phiCaloLocal_2, trketa_at_2, trkphi_at_2,
428 x_ctb_3, y_ctb_3, z_ctb_3, etaCaloLocal_3, phiCaloLocal_3, trketa_at_3, trkphi_at_3,
429 x_ctb_tile, y_ctb_tile, z_ctb_tile, etaCaloLocal_tile, phiCaloLocal_tile, trketa_at_tile, trkphi_at_tile);
431 if(pt_calo_ctb)
delete pt_calo_ctb;
432 if(pt_calo_local)
delete pt_calo_local;
445 ATH_MSG_DEBUG (
"TBTrackToCaloAlg::CompareImpactWithCluster()" );
455 if(sc1 == StatusCode::SUCCESS && sc2 == StatusCode::SUCCESS ){
458 impact_iterator f_imp = impact_collection->
begin();
459 impact_iterator l_imp = impact_collection->
end();
461 for (
const CaloCluster* cluster : *cluster_container) {
462 double hecluster = cluster->energy()/
GeV;
463 double heta = cluster->eta();
464 double hphi = cluster->phi();
467 <<
"(GeV), etaCaloLocal=" << heta
468 <<
", phiCaloLocal=" << hphi );
470 for ( ; f_imp!=l_imp; ++f_imp){
474 (
"==> Comparison between cluster and impact in Middle : deta="
481 if (sc1 != StatusCode::SUCCESS)
484 if (sc2 != StatusCode::SUCCESS)
503 if(
sc == StatusCode::SUCCESS ){
506 const double impcosPhi =
std::cos(impact->phiCaloLocal_1());
507 const double impeta = impact->etaCaloLocal_1();
509 ATH_MSG_INFO (
"Found an impact in strips : parameters are eta = " << impeta
510 <<
" cosPhi = " << impcosPhi );
528 dynamic_cast<const Trk::Perigee*
>(tr->perigeeParameters());
534 const double trkcosPhi =
cos(aMeasPer->parameters()[
Trk::phi]);
535 const double trketa = aMeasPer->eta();
537 ATH_MSG_INFO (
"Found a Trk::Track : parameters are eta = " << trketa
538 <<
" cosPhi = " << trkcosPhi );
546 ATH_MSG_INFO (
" Now loop on Trk::TrackParticle collection " );
555 ATH_MSG_ERROR (
"Could not get TrkParticle::MeasuredPerigee" );
559 const double partcosPhi =
cos(aMeasPer->parameters()[
Trk::phi]);
560 const double parteta = aMeasPer->eta();
562 ATH_MSG_INFO (
"Found a trackparticle : parameters are eta = " << parteta
563 <<
" cosPhi = " << partcosPhi );
582 if (
sc != StatusCode::SUCCESS )
return 0;
589 double trketa_at = 0.;
590 double trkphi_at = 0.;
594 TrackSeenByCalo(trk,sam,
offset,pt_ctb,pt_local,trketa_at,trkphi_at);
602 double eta = pt_local->eta();
603 double phi = pt_local->phi();
608 int sampling_or_module;
616 double deta =
int(neta/2)*dde->
deta();
617 double dphi =
int(nphi/2)*dde->
dphi();
622 my_list =
new CaloCellList(caloDDMgr, cell_container,subcalo);
636 ATH_MSG_INFO (
"TBTrackToCaloAlg::PrintCellsCrossed()" );
660 dynamic_cast<const Trk::Perigee*
>(tr->perigeeParameters());
665 double d0 = aMeasPer->parameters()[
Trk::d0];
666 double z0 = aMeasPer->parameters()[
Trk::z0];
686 <<
" phi=" <<
cell->phi() <<
" energy=" <<
cell->energy() );
703 ATH_MSG_INFO (
"TBTrackToCaloAlg::PrintBeamPosition()" );
705 ATH_MSG_INFO (
"Just a check... beam direction in calo : " );