ATLAS Offline Software
Loading...
Searching...
No Matches
TBTrackToCaloAlg Class Reference

This Algorithm is meant to be an example of use of the TrackToCalo tools : More...

#include <TBTrackToCaloAlg.h>

Inheritance diagram for TBTrackToCaloAlg:

Public Member Functions

 TBTrackToCaloAlg (const std::string &name, ISvcLocator *pSvcLocator)
virtual StatusCode initialize () override
virtual StatusCode execute () override
virtual StatusCode finalize () override
bool CreateTrkImpactInCalo ()
ImpactInCaloGetImpactsInCalo (const Trk::Track *track, bool &got_a_track)
void CompareImpactWithCluster ()
void PrintImpact ()
CaloCellListCellsCrossedByTrack (const Trk::Track *trk, const CaloCell_ID::CaloSample sam, int neta, int nphi)
bool PrintCellsCrossed ()
void PrintBeamPosition ()
virtual StatusCode sysInitialize () override
 Override sysInitialize.
virtual const DataObjIDColl & extraOutputDeps () const override
 Return the list of extra output dependencies.
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual StatusCode sysStart () override
 Handle START transition.
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles.
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles.
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T, V, H > &t)
void updateVHKA (Gaudi::Details::PropertyBase &)
MsgStream & msg () const
bool msgLvl (const MSG::Level lvl) const

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed.

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

 TBTrackToCaloAlg ()
 TBTrackToCaloAlg (const TBTrackToCaloAlg &)
TBTrackToCaloAlgoperator= (const TBTrackToCaloAlg &)
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

std::string m_TrackName
const TrackCollectionm_tracks
std::string m_TrackParticleName
const Rec::TrackParticleContainerm_particle
std::string m_trkinput
std::string m_cluster_container
std::string m_cell_container
const CaloCell_IDm_calo_id
std::string m_ImpactInCalosOutputName
TBExtrapolTrackToCaloToolm_toCalo
CaloDepthToolm_calodepth
CaloPhiRange m_phiRange
ICaloCoordinateToolm_calo_tb_coord
SG::ReadCondHandleKey< CaloDetDescrManagerm_caloMgrKey {this,"CaloDetDescrManager", "CaloDetDescrManager"}
DataObjIDColl m_extendedExtraObjects
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default)
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default)
std::vector< SG::VarHandleKeyArray * > m_vhka
bool m_varHandleArraysDeclared

Detailed Description

This Algorithm is meant to be an example of use of the TrackToCalo tools :

  • It loops on a given Track collection ( choosen by jobOption ) and extrapolates all tracks to the layers of the calorimeter.
  • Impacts are stored in an ImpactInCaloCollection, which is then used to fill CBNT
  • An example of primitive Track to Cluster matching is provided, as well as an example of how one can retreive all the CaloCell's around a track extrapolation, using the CaloCellList class ( these 2 are off by default )
  • One can also find an example of usage of the CaloDepthTool methods to define if one should extrapolate to the barrel or to the endcap.

Definition at line 63 of file TBTrackToCaloAlg.h.

Member Typedef Documentation

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< Algorithm > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ TBTrackToCaloAlg() [1/3]

TBTrackToCaloAlg::TBTrackToCaloAlg ( const std::string & name,
ISvcLocator * pSvcLocator )

Definition at line 44 of file TBTrackToCaloAlg.cxx.

45 :
46 AthAlgorithm(name,pSvcLocator),
47 m_TrackName("Tracks"),
48 m_tracks(0),
49 m_calodepth(nullptr)
50{
51 // Get parameter values from jobOptions file
52 declareProperty("TrackName", m_TrackName);
53 declareProperty("TrackParticleName", m_TrackParticleName);
54 declareProperty("ClusterContainerName", m_cluster_container);
55 declareProperty("CaloCellContainerName", m_cell_container);
56 declareProperty("ImpactInCaloContainerName", m_ImpactInCalosOutputName);
57 declareProperty("TrackInputType", m_trkinput);
58 m_calo_id = 0;
60 m_particle = 0;
61 m_toCalo = 0;
62}
AthAlgorithm()
Default constructor:
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
std::string m_cell_container
const Rec::TrackParticleContainer * m_particle
const TrackCollection * m_tracks
std::string m_TrackParticleName
TBExtrapolTrackToCaloTool * m_toCalo
std::string m_ImpactInCalosOutputName
const CaloCell_ID * m_calo_id
std::string m_cluster_container
ICaloCoordinateTool * m_calo_tb_coord
CaloDepthTool * m_calodepth
std::string m_TrackName

◆ TBTrackToCaloAlg() [2/3]

TBTrackToCaloAlg::TBTrackToCaloAlg ( )
private

◆ TBTrackToCaloAlg() [3/3]

TBTrackToCaloAlg::TBTrackToCaloAlg ( const TBTrackToCaloAlg & )
private

Member Function Documentation

◆ CellsCrossedByTrack()

CaloCellList * TBTrackToCaloAlg::CellsCrossedByTrack ( const Trk::Track * trk,
const CaloCell_ID::CaloSample sam,
int neta,
int nphi )

Definition at line 572 of file TBTrackToCaloAlg.cxx.

575{
576 CaloCellList* my_list = 0;
577
578 // Retreive CaloCell's from StoreGate :
579
580 const CaloCellContainer* cell_container;
581 StatusCode sc=evtStore()->retrieve(cell_container,m_cell_container);
582 if ( sc != StatusCode::SUCCESS ) return 0;
583
584 SG::ReadCondHandle<CaloDetDescrManager> caloMgrHandle{m_caloMgrKey};
585 const CaloDetDescrManager* caloDDMgr = *caloMgrHandle;
586
587 // Where is the track shooting ?
588 double offset = 0.;
589 double trketa_at = 0.;
590 double trkphi_at = 0.;
591 Amg::Vector3D* pt_ctb = new Amg::Vector3D();
592 Amg::Vector3D* pt_local = new Amg::Vector3D();
593 bool result = m_toCalo->
594 TrackSeenByCalo(trk,sam,offset,pt_ctb,pt_local,trketa_at,trkphi_at);
595
596 if (!result) {
597 delete pt_ctb;
598 delete pt_local;
599 return 0;
600 }
601
602 double eta = pt_local->eta();
603 double phi = pt_local->phi();
604
605 // CaloCellList needs both enums: subCalo and CaloSample
606 CaloCell_ID::SUBCALO subcalo;
607 bool barrel;
608 int sampling_or_module;
609 CaloDetDescrManager::decode_sample (subcalo, barrel, sampling_or_module, sam);
610
611 // Get the corresponding grannularities : needs to know where you are
612 // the easiest is to look for the CaloDetDescrElement
613 const CaloDetDescrElement* dde =
614 caloDDMgr->get_element(subcalo,sampling_or_module,barrel,eta,phi);
615
616 double deta = int(neta/2)*dde->deta();
617 double dphi = int(nphi/2)*dde->dphi();
618
619 //std::cout << "zone is ..." << eta << " " << phi << " "
620 // << deta << " " << dphi << " " << std::endl;
621 // Construct the list :
622 my_list = new CaloCellList(caloDDMgr, cell_container,subcalo);
623 my_list->select(eta,phi,deta,dphi, (int) sam);
624
625 // cleanup
626 delete pt_ctb;
627 delete pt_local;
628
629 return my_list ;
630}
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
static Double_t sc
void select(double eta, double phi, double deta, double dphi)
CaloCell_Base_ID::SUBCALO SUBCALO
Definition CaloCell_ID.h:50
const CaloDetDescrElement * get_element(const Identifier &cellId) const
get element by its identifier
static void decode_sample(CaloCell_ID::SUBCALO &subCalo, bool &barrel, int &sampling_or_module, CaloCell_ID::CaloSample sample)
translate between the 2 ways to label a sub-detector:
SG::ReadCondHandleKey< CaloDetDescrManager > m_caloMgrKey
Eigen::Matrix< double, 3, 1 > Vector3D
::StatusCode StatusCode
StatusCode definition for legacy code.

◆ CompareImpactWithCluster()

void TBTrackToCaloAlg::CompareImpactWithCluster ( )

Definition at line 441 of file TBTrackToCaloAlg.cxx.

442{
443 StatusCode sc1, sc2;
444
445 ATH_MSG_DEBUG ( "TBTrackToCaloAlg::CompareImpactWithCluster()" );
446
447 // loop on clusters
448
449 const CaloClusterContainer* cluster_container = nullptr;
450 sc1=evtStore()->retrieve(cluster_container,m_cluster_container);
451
452 const ImpactInCaloCollection* impact_collection;
453 sc2=evtStore()->retrieve(impact_collection,m_ImpactInCalosOutputName);
454
455 if(sc1 == StatusCode::SUCCESS && sc2 == StatusCode::SUCCESS ){
456
457 typedef ImpactInCaloCollection::const_iterator impact_iterator;
458 impact_iterator f_imp = impact_collection->begin();
459 impact_iterator l_imp = impact_collection->end();
460
461 for (const CaloCluster* cluster : *cluster_container) {
462 double hecluster = cluster->energy()/GeV;
463 double heta = cluster->eta();
464 double hphi = cluster->phi();
465
466 ATH_MSG_INFO ( "Found a cluster : E= " << hecluster
467 << "(GeV), etaCaloLocal=" << heta
468 << ", phiCaloLocal=" << hphi );
469
470 for ( ; f_imp!=l_imp; ++f_imp){
471 const ImpactInCalo* impact = (*f_imp);
472
474 ( "==> Comparison between cluster and impact in Middle : deta="
475 << heta-impact->etaCaloLocal_2()
476 << " , dphi=" << hphi-impact->phiCaloLocal_2() );
477 }
478 }
479 }
480 else {
481 if (sc1 != StatusCode::SUCCESS)
482 ATH_MSG_ERROR ("Clusters not found"
484 if (sc2 != StatusCode::SUCCESS)
485 ATH_MSG_ERROR ("ImpactInCalos not found"
487 }
488}
#define ATH_MSG_ERROR(x)
#define ATH_MSG_INFO(x)
#define ATH_MSG_DEBUG(x)
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.
CaloClusterContainer
Definition CaloTPCnv.cxx:21
DataModel_detail::const_iterator< DataVector > const_iterator
Definition DataVector.h:838
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
double etaCaloLocal_2() const
double phiCaloLocal_2() const

◆ CreateTrkImpactInCalo()

bool TBTrackToCaloAlg::CreateTrkImpactInCalo ( )

Definition at line 133 of file TBTrackToCaloAlg.cxx.

134{
135 bool got_a_track = false;
136
137 ATH_MSG_DEBUG ( "TBTrackToCaloAlg::CreateTrkImpactInCalo()" );
138
139 //create and record new ImpactInCalo container
140 ImpactInCaloCollection* outputContainer = new ImpactInCaloCollection();
141 StatusCode sc=evtStore()->record(outputContainer,m_ImpactInCalosOutputName,false); //"false" indicates it can't be modified by another algorithm
142 if(sc != StatusCode::SUCCESS){
143 ATH_MSG_ERROR ( " Could not record ImpactInCaloCollection"
145 return got_a_track ;
146 }
147
148 m_particle = 0;
149 m_tracks = 0;
150
151 if( m_trkinput == "TrackParticleCandidates")
152 {
153 if (m_TrackParticleName == "") {
154 ATH_MSG_ERROR ("m_TrackParticleName not set" );
155 return true;
156 }
157
159
160 if (sc.isFailure()) ATH_MSG_ERROR ("TrackParticle not found: will only play with calo " << m_TrackParticleName );
161 else {
162 ATH_MSG_DEBUG ("TrackParticle found in StoreGate" );
163 for (const Rec::TrackParticle* tp : *m_particle) {
164 const Trk::Track* tr = tp->originalTrack();
165
166 ImpactInCalo * imp = GetImpactsInCalo(tr, got_a_track);
167 if(imp) outputContainer->push_back(imp);
168 else ATH_MSG_DEBUG (" ImpactInCalo pointer not valid for this track");
169 }
170 }
171 }
172
173 else
174 {
175 if (m_TrackName == "") {
176 ATH_MSG_ERROR ("m_TrackName not set" );
177 return true;
178 }
179
180 sc = evtStore()->retrieve(m_tracks, m_TrackName);
181
182 if (sc.isFailure()) ATH_MSG_ERROR ("Tracks not found: will only play with calo " << m_TrackName );
183 else {
184 ATH_MSG_DEBUG ("Tracks found in StoreGate" );
185 for (const Trk::Track* tr : *m_tracks) {
186 ImpactInCalo * imp = GetImpactsInCalo(tr, got_a_track);
187 if(imp) outputContainer->push_back(imp);
188 else ATH_MSG_DEBUG (" ImpactInCalo pointer not valid for this track");
189 }
190 }
191 }
192
193 return got_a_track;
194}
value_type push_back(value_type pElem)
Add an element to the end of the collection.
ImpactInCalo * GetImpactsInCalo(const Trk::Track *track, bool &got_a_track)

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< Algorithm > >::declareGaudiProperty ( Gaudi::Property< T, V, H > & hndl,
const SG::VarHandleKeyType &  )
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158 {
160 hndl.value(),
161 hndl.documentation());
162
163 }

◆ declareProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty ( Gaudi::Property< T, V, H > & t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145 {
146 typedef typename SG::HandleClassifier<T>::type htype;
148 }
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>

◆ detStore()

const ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< Algorithm > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

◆ evtStore()

ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< Algorithm > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

◆ execute()

StatusCode TBTrackToCaloAlg::execute ( )
overridevirtual

Definition at line 98 of file TBTrackToCaloAlg.cxx.

99{
100 ATH_MSG_DEBUG ( "TBTrackToCaloAlg::execute()" );
101
102 // just a simple test ( trick to trigger position reading )
103 // PrintBeamPosition();
104
105 // Create the impacts :
106 /*found_a_track =*/ CreateTrkImpactInCalo();
107
108 // Example 1 : you want to read them and compare to clusters
109
110 /*
111 if (found_a_track) {
112 PrintImpact();
113 //CompareImpactWithCluster();
114 }
115 */
116
117 // Example 2 : you want to know the list of cells crossed by the track
118 // bool found_cells = PrintCellsCrossed();
119 ATH_CHECK(m_caloMgrKey.initialize());
120 return StatusCode::SUCCESS;
121}
#define ATH_CHECK
Evaluate an expression and check for errors.

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< Algorithm > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase & ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ extraOutputDeps()

const DataObjIDColl & AthAlgorithm::extraOutputDeps ( ) const
overridevirtualinherited

Return the list of extra output dependencies.

This list is extended to include symlinks implied by inheritance relations.

Definition at line 50 of file AthAlgorithm.cxx.

51{
52 // If we didn't find any symlinks to add, just return the collection
53 // from the base class. Otherwise, return the extended collection.
54 if (!m_extendedExtraObjects.empty()) {
56 }
57 return Algorithm::extraOutputDeps();
58}
DataObjIDColl m_extendedExtraObjects

◆ finalize()

StatusCode TBTrackToCaloAlg::finalize ( )
overridevirtual

Definition at line 124 of file TBTrackToCaloAlg.cxx.

125{
126 ATH_MSG_DEBUG ( "TBTrackToCaloAlg::finalize()" );
127
128 return StatusCode::SUCCESS;
129}

◆ GetImpactsInCalo()

ImpactInCalo * TBTrackToCaloAlg::GetImpactsInCalo ( const Trk::Track * track,
bool & got_a_track )

Definition at line 196 of file TBTrackToCaloAlg.cxx.

197{
198 Amg::Vector3D* pt_calo_ctb = new Amg::Vector3D;
199 Amg::Vector3D* pt_calo_local = new Amg::Vector3D;
200
201 SG::ReadCondHandle<CaloDetDescrManager> caloMgrHandle{m_caloMgrKey};
202 const CaloDetDescrManager* caloDDMgr = *caloMgrHandle;
203
204 double trketa = 0.;
205 // take the last measured point to find out if I am in barrel or endcap :
206 const DataVector <const Trk::TrackParameters>* paramvec = track->trackParameters();
207 if (paramvec) {
208 for (const Trk::TrackParameters* params : *paramvec)
209 trketa = params->eta();
210 }
211 else
212 ATH_MSG_ERROR ( " No track parameters for this track ??? do nothing " );
213
214 double distbar = 0.;
215 double distec = 0.;
216 double offset = 0.;
217 double trketa_at = 0.;
218 double trkphi_at = 0.;
219 bool result = false;
221
222 // PreSampler :
223 double x_ctb_0 = 0;
224 double y_ctb_0 = 0;
225 double z_ctb_0 = 0;
226 double etaCaloLocal_0 = 0;
227 double phiCaloLocal_0 = 0;
228 double trketa_at_0 = 0.;
229 double trkphi_at_0 = 0.;
230 // Strip :
231 double x_ctb_1 = 0;
232 double y_ctb_1 = 0;
233 double z_ctb_1 = 0;
234 double etaCaloLocal_1 = 0;
235 double phiCaloLocal_1 = 0;
236 double trketa_at_1 = 0.;
237 double trkphi_at_1 = 0.;
238 // Middle :
239 double x_ctb_2 = 0;
240 double y_ctb_2 = 0;
241 double z_ctb_2 = 0;
242 double etaCaloLocal_2 = 0;
243 double phiCaloLocal_2 = 0;
244 double trketa_at_2 = 0.;
245 double trkphi_at_2 = 0.;
246 // Back :
247 double x_ctb_3 = 0;
248 double y_ctb_3 = 0;
249 double z_ctb_3 = 0;
250 double etaCaloLocal_3 = 0;
251 double phiCaloLocal_3 = 0;
252 double trketa_at_3 = 0.;
253 double trkphi_at_3 = 0.;
254 // Tiles :
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.;
262
263 if (paramvec) {
264
265 // PS :
266 distbar = CaloDepthTool::deta(CaloCell_ID::PreSamplerB,trketa,caloDDMgr);
267 distec = CaloDepthTool::deta(CaloCell_ID::PreSamplerE,trketa,caloDDMgr);
268
269 ATH_MSG_DEBUG ( " TrackTo ...PS : for eta= " << trketa << " dist to Barrel =" << distbar
270 << " to endcap =" << distec );
271 if (distbar < 0 ) sample = CaloCell_ID::PreSamplerB;
272 else if (distec < 0 ) sample = CaloCell_ID::PreSamplerE;
273 else if ( distbar < distec) sample = CaloCell_ID::PreSamplerB;
274 else sample = CaloCell_ID::PreSamplerE;
275 ATH_MSG_DEBUG ( " => will shoot in sample " << sample );
276
277 result = m_toCalo->TrackSeenByCalo(track,sample,offset,
278 pt_calo_ctb,pt_calo_local,trketa_at,trkphi_at);
279
280 if (result) {
281 got_a_track=true;
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;
289
290 ATH_MSG_DEBUG ( "Extrapolation to PreSamplerB gives: "
291 << " etaCaloLocal=" << pt_calo_local->eta()
292 << " phiCaloLocal=" << pt_calo_local->phi() );
293 }
294
295 // strip :
296 distbar = CaloDepthTool::deta(CaloCell_ID::EMB1,trketa,caloDDMgr);
297 distec = CaloDepthTool::deta(CaloCell_ID::EME1,trketa,caloDDMgr);
298
299 ATH_MSG_DEBUG ( " TrackTo ...Strip : for eta= " << trketa << " dist to Barrel =" << distbar
300 << " to endcap =" << distec );
301 if (distbar < 0 ) sample = CaloCell_ID::EMB1;
302 else if (distec < 0 ) sample = CaloCell_ID::EME1;
303 else if ( distbar < distec) sample = CaloCell_ID::EMB1;
304 else sample = CaloCell_ID::EME1;
305 ATH_MSG_DEBUG ( " => will shoot in sample " << sample );
306
307 result = m_toCalo->TrackSeenByCalo(track,sample,offset,
308 pt_calo_ctb,pt_calo_local,trketa_at,trkphi_at);
309
310 if (result) {
311 got_a_track=true;
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;
319
320 ATH_MSG_DEBUG ( "Extrapolation to EMB1 gives: "
321 << " etaCaloLocal=" << pt_calo_local->eta()
322 << " phiCaloLocal=" << pt_calo_local->phi() );
323 }
324
325
326 // middle :
327 distbar = CaloDepthTool::deta(CaloCell_ID::EMB2,trketa,caloDDMgr);
328 distec = CaloDepthTool::deta(CaloCell_ID::EME2,trketa,caloDDMgr);
329
330 ATH_MSG_DEBUG ( " TrackTo ...Middle : for eta= " << trketa << " dist to Barrel =" << distbar
331 << " to endcap =" << distec );
332 if (distbar < 0 ) sample = CaloCell_ID::EMB2;
333 else if (distec < 0 ) sample = CaloCell_ID::EME2;
334 else if ( distbar < distec) sample = CaloCell_ID::EMB2;
335 else sample = CaloCell_ID::EME2;
336 ATH_MSG_DEBUG ( " => will shoot in sample " << sample );
337
338 result = m_toCalo->TrackSeenByCalo(track,sample,offset,
339 pt_calo_ctb,pt_calo_local,trketa_at,trkphi_at);
340
341 if (result) {
342 got_a_track=true;
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;
350
351 ATH_MSG_DEBUG ( "Extrapolation to EMB2 gives: "
352 << " etaCaloLocal=" << pt_calo_local->eta()
353 << " phiCaloLocal=" << pt_calo_local->phi() );
354 }
355
356 // Back :
357 //
358 // there is a real gap between 1.35 (end of EMB3) and 1.5 (start of EMEC3)
359 // => for TrackToCalo chooses the closest. One could choose to stay in
360 // barrel as long as not in endcap
361 // In both cases, m_calodepth will see that you are outside the accpetance and
362 // will use the backup solution (egparametrisation right now, rel 10.0.2).
363 //
364
365 distbar = CaloDepthTool::deta(CaloCell_ID::EMB3,trketa,caloDDMgr);
366 distec = CaloDepthTool::deta(CaloCell_ID::EME3,trketa,caloDDMgr);
367
368 ATH_MSG_DEBUG ( " TrackTo ...Back : for eta= " << trketa << " dist to Barrel =" << distbar
369 << " to endcap =" << distec );
370 if (distbar < 0 ) sample = CaloCell_ID::EMB3;
371 else if (distec < 0 ) sample = CaloCell_ID::EME3;
372 else if ( distbar < distec) sample = CaloCell_ID::EMB3;
373 else sample = CaloCell_ID::EME3;
374 ATH_MSG_DEBUG ( " => will shoot in sample " << sample );
375
376 result = m_toCalo->TrackSeenByCalo(track,sample,offset,
377 pt_calo_ctb,pt_calo_local,trketa_at,trkphi_at);
378
379 if (result) {
380 got_a_track=true;
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;
388
389 ATH_MSG_DEBUG ( "Extrapolation to EMB3 gives: "
390 << " etaCaloLocal=" << pt_calo_local->eta()
391 << " phiCaloLocal=" << pt_calo_local->phi() );
392 }
393
394 // Tile or HEC0 :
395 distbar = CaloDepthTool::deta(CaloCell_ID::TileBar0,trketa,caloDDMgr);
396 distec = CaloDepthTool::deta(CaloCell_ID::HEC0,trketa,caloDDMgr);
397
398 ATH_MSG_DEBUG ( " TrackTo ...Tile : for eta= " << trketa << " dist to Barrel =" << distbar
399 << " to endcap =" << distec );
400 if (distbar < 0 ) sample = CaloCell_ID::TileBar0;
401 else if (distec < 0 ) sample = CaloCell_ID::HEC0;
402 else if ( distbar > distec && distec < 10. ) sample = CaloCell_ID::HEC0;
403 else sample = CaloCell_ID::TileBar0;
404 ATH_MSG_DEBUG ( " => will shoot in sample " << sample );
405
406 result = m_toCalo->TrackSeenByCalo(track,sample,offset,
407 pt_calo_ctb,pt_calo_local,trketa_at,trkphi_at);
408
409 if (result) {
410 got_a_track=true;
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;
418
419 ATH_MSG_DEBUG ( "Extrapolation to TileBar0 gives: "
420 << " etaCaloLocal=" << pt_calo_local->eta()
421 << " phiCaloLocal=" << pt_calo_local->phi() );
422 }
423 }
424
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);
430
431 if(pt_calo_ctb) delete pt_calo_ctb;
432 if(pt_calo_local) delete pt_calo_local;
433
434 return imp;
435}
CaloSampling::CaloSample CaloSample
Definition CaloCell_ID.h:53
static double deta(const CaloCell_ID::SUBCALO subcalo, const int sampling_or_module, const bool barrel, const double eta, const CaloDetDescrManager *caloDD)
How far are you (in eta) from a given sample or - if you are in - how far are you from the edge ?
ParametersBase< TrackParametersDim, Charged > TrackParameters

◆ initialize()

StatusCode TBTrackToCaloAlg::initialize ( )
overridevirtual

Definition at line 65 of file TBTrackToCaloAlg.cxx.

66{
67 ATH_MSG_DEBUG ( "TBTrackToCaloAlg::initialize()" );
68
69 ATH_CHECK(detStore()->retrieve(m_calo_id,"CaloCell_ID"));
70
71 IAlgTool* algTool = 0;
72
73 StatusCode sc = toolSvc()->retrieveTool("ExtrapolTrackToCaloTool", algTool,this);
74 //m_toCalo=dynamic_cast<IExtrapolTrackToCaloTool*>(algTool);
75 //m_toCalo=dynamic_cast<IExtrapolateToCaloTool*>(algTool);
76 m_toCalo=dynamic_cast<TBExtrapolTrackToCaloTool*>(algTool);
77 if(sc.isFailure() || !m_toCalo) {
78 ATH_MSG_ERROR ( "Cannot get ExtrapolTrackToCaloTool" );
79 return StatusCode::FAILURE;
80 }
81
82 IAlgTool* tool = 0;
83 ATH_CHECK( toolSvc()->retrieveTool("TBCaloCoordinate", tool) );
84 m_calo_tb_coord = dynamic_cast<ICaloCoordinateTool*>(tool);
85
86 // retrieved via the Extrapolator to make sure that jobOpt setting is consistent.
87 m_calodepth = m_toCalo->getCaloDepth();
88 if (!m_calodepth) {
89 ATH_MSG_ERROR ( "Cannot get CaloDepthTool" );
90 return StatusCode::FAILURE;
91 }
92
93 ATH_MSG_INFO ( "TBTrackToCaloAlg initialisation OK" );
94 return StatusCode::SUCCESS;
95}
const ServiceHandle< StoreGateSvc > & detStore() const
retrieve(aClass, aKey=None)
Definition PyKernel.py:110

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< Algorithm > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ msg()

MsgStream & AthCommonMsg< Algorithm >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24 {
25 return this->msgStream();
26 }

◆ msgLvl()

bool AthCommonMsg< Algorithm >::msgLvl ( const MSG::Level lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30 {
31 return this->msgLevel(lvl);
32 }

◆ operator=()

TBTrackToCaloAlg & TBTrackToCaloAlg::operator= ( const TBTrackToCaloAlg & )
private

◆ outputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< Algorithm > >::outputHandles ( ) const
overridevirtualinherited

Return this algorithm's output handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ PrintBeamPosition()

void TBTrackToCaloAlg::PrintBeamPosition ( )

Definition at line 700 of file TBTrackToCaloAlg.cxx.

701{
702 // Get the messaging service, print where you are
703 ATH_MSG_INFO ( "TBTrackToCaloAlg::PrintBeamPosition()" );
704
705 ATH_MSG_INFO ( "Just a check... beam direction in calo : " );
706 m_calo_tb_coord->read_table_position();
707 Amg::Vector3D beam (1.,0.,0.);
708 beam = ( *(m_calo_tb_coord->transform_ctb_to_calo()) )* beam;
709}

◆ PrintCellsCrossed()

bool TBTrackToCaloAlg::PrintCellsCrossed ( )

Definition at line 632 of file TBTrackToCaloAlg.cxx.

633{
634
635 // Get the messaging service, print where you are
636 ATH_MSG_INFO ( "TBTrackToCaloAlg::PrintCellsCrossed()" );
637
638 // Here we are :
639 CaloCell_ID::CaloSample sam = CaloCell_ID::EMB2;
640 int neta = 5;
641 int nphi = 5;
642
643 // get tracks from TDS
644 if (m_TrackName == "") {
645 ATH_MSG_ERROR ("m_TrackName not set" );
646 return true;
647 }
648
649 StatusCode sc = evtStore()->retrieve(m_tracks, m_TrackName);
650 if (sc.isFailure()){
651 ATH_MSG_ERROR ("Tracks not found: will only play with calo "
652 << m_TrackName );
653 }
654 else{
655 ATH_MSG_DEBUG ("Tracks found in StoreGate" );
656
657 for (const Trk::Track* tr : *m_tracks) {
658
659 const Trk::Perigee *aMeasPer=
660 dynamic_cast<const Trk::Perigee*>(tr->perigeeParameters());
661 if (aMeasPer==0){
662 ATH_MSG_ERROR ( "Could not get Trk::MeasuredPerigee" );
663 }
664 else {
665 double d0 = aMeasPer->parameters()[Trk::d0];
666 double z0 = aMeasPer->parameters()[Trk::z0];
667 double phi0 = aMeasPer->parameters()[Trk::phi0];
668 double theta = aMeasPer->parameters()[Trk::theta];
669 double qOverP = aMeasPer->parameters()[Trk::qOverP];
670 ATH_MSG_INFO ( " " );
671 ATH_MSG_INFO ( "Found a track: parameters are " << d0 << " "
672 << z0 << " " << phi0 << " " << theta << " " << qOverP );
673 }
674
675 // Warning : if anything fails, CellsCrossedByTrack will
676 // simply return a null pointer
677 // if it works, it does a new CaloCellList
678 // ==> the client has to do the delete !!!!
679
680 CaloCellList* my_list = CellsCrossedByTrack(tr, sam, neta, nphi);
681
682 if (my_list) {
683
684 for (const CaloCell* cell : *my_list)
685 ATH_MSG_INFO ( "found cell ! eta=" << cell->eta()
686 << " phi=" << cell->phi() << " energy=" << cell->energy() );
687
688 delete my_list;
689
690 }
691 else
692 ATH_MSG_ERROR (" :-( extrapolation did not work");
693 }
694 }
695
696 return true;
697}
Scalar theta() const
theta method
CaloCellList * CellsCrossedByTrack(const Trk::Track *trk, const CaloCell_ID::CaloSample sam, int neta, int nphi)
@ qOverP
perigee
ParametersT< TrackParametersDim, Charged, PerigeeSurface > Perigee
@ phi0
Definition ParamDefs.h:65
@ theta
Definition ParamDefs.h:66
@ qOverP
perigee
Definition ParamDefs.h:67
@ d0
Definition ParamDefs.h:63
@ z0
Definition ParamDefs.h:64

◆ PrintImpact()

void TBTrackToCaloAlg::PrintImpact ( )

Definition at line 491 of file TBTrackToCaloAlg.cxx.

492{
494
495 ATH_MSG_INFO ( " Method PrintImpacts : " );
496
497 ATH_MSG_INFO ( " " );
498 ATH_MSG_INFO ( " Start with Impacts : " );
499
500 const ImpactInCaloCollection* impact_collection;
501 sc=evtStore()->retrieve(impact_collection,m_ImpactInCalosOutputName);
502
503 if(sc == StatusCode::SUCCESS ){
504
505 for (const ImpactInCalo* impact : *impact_collection) {
506 const double impcosPhi = std::cos(impact->phiCaloLocal_1());
507 const double impeta = impact->etaCaloLocal_1();
508
509 ATH_MSG_INFO ( "Found an impact in strips : parameters are eta = " << impeta
510 << " cosPhi = " << impcosPhi );
511
512 //impact->print();
513 }
514 }
515 else {
516 ATH_MSG_ERROR ("ImpactInCalos not found"
518 }
519
520 if (m_tracks) {
521
522 ATH_MSG_INFO ( " " );
523 ATH_MSG_INFO (" Now loop on Trk::Track collection " );
524 ATH_MSG_INFO ( " " );
525
526 for (const Trk::Track* tr : *m_tracks) {
527 const Trk::Perigee *aMeasPer=
528 dynamic_cast<const Trk::Perigee*>(tr->perigeeParameters());
529 if (aMeasPer==0){
530 ATH_MSG_ERROR ( "Could not get Trk::MeasuredPerigee" );
531 }
532 else {
533
534 const double trkcosPhi = cos(aMeasPer->parameters()[Trk::phi]);
535 const double trketa = aMeasPer->eta();
536
537 ATH_MSG_INFO ( "Found a Trk::Track : parameters are eta = " << trketa
538 << " cosPhi = " << trkcosPhi );
539 }
540 }
541 }
542
543 if (m_particle) {
544
545 ATH_MSG_INFO ( " " );
546 ATH_MSG_INFO (" Now loop on Trk::TrackParticle collection " );
547 ATH_MSG_INFO ( " " );
548
550 itr != m_particle->end(); ++itr )
551 {
552 const Trk::Perigee *aMeasPer=
553 dynamic_cast<const Trk::Perigee*>(((*itr)->originalTrack())->perigeeParameters());
554 if (aMeasPer==0){
555 ATH_MSG_ERROR ( "Could not get TrkParticle::MeasuredPerigee" );
556 }
557 else {
558
559 const double partcosPhi = cos(aMeasPer->parameters()[Trk::phi]);
560 const double parteta = aMeasPer->eta();
561
562 ATH_MSG_INFO ( "Found a trackparticle : parameters are eta = " << parteta
563 << " cosPhi = " << partcosPhi );
564 }
565 }
566 }
567}
double eta() const
Access method for pseudorapidity - from momentum.
@ perigeeParameters
@ phi
Definition ParamDefs.h:75

◆ renounce()

std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > AthCommonDataStore< AthCommonMsg< Algorithm > >::renounce ( T & h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381 {
382 h.renounce();
384 }
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce(T &h)

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< Algorithm > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364 {
366 }

◆ sysInitialize()

StatusCode AthAlgorithm::sysInitialize ( )
overridevirtualinherited

Override sysInitialize.

Override sysInitialize from the base class.

Loop through all output handles, and if they're WriteCondHandles, automatically register them and this Algorithm with the CondSvc

Scan through all outputHandles, and if they're WriteCondHandles, register them with the CondSvc

Reimplemented from AthCommonDataStore< AthCommonMsg< Algorithm > >.

Reimplemented in AthAnalysisAlgorithm, AthFilterAlgorithm, AthHistogramAlgorithm, and PyAthena::Alg.

Definition at line 66 of file AthAlgorithm.cxx.

66 {
68
69 if (sc.isFailure()) {
70 return sc;
71 }
72 ServiceHandle<ICondSvc> cs("CondSvc",name());
73 for (auto h : outputHandles()) {
74 if (h->isCondition() && h->mode() == Gaudi::DataHandle::Writer) {
75 // do this inside the loop so we don't create the CondSvc until needed
76 if ( cs.retrieve().isFailure() ) {
77 ATH_MSG_WARNING("no CondSvc found: won't autoreg WriteCondHandles");
78 return StatusCode::SUCCESS;
79 }
80 if (cs->regHandle(this,*h).isFailure()) {
81 sc = StatusCode::FAILURE;
82 ATH_MSG_ERROR("unable to register WriteCondHandle " << h->fullKey()
83 << " with CondSvc");
84 }
85 }
86 }
87 return sc;
88}
#define ATH_MSG_WARNING(x)
virtual StatusCode sysInitialize() override
Override sysInitialize.
AthCommonDataStore(const std::string &name, T... args)
virtual std::vector< Gaudi::DataHandle * > outputHandles() const override

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< Algorithm > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< Algorithm > >::updateVHKA ( Gaudi::Details::PropertyBase & )
inlineinherited

Definition at line 308 of file AthCommonDataStore.h.

308 {
309 // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310 // << " size: " << m_vhka.size() << endmsg;
311 for (auto &a : m_vhka) {
313 for (auto k : keys) {
314 k->setOwner(this);
315 }
316 }
317 }
std::vector< SG::VarHandleKeyArray * > m_vhka

Member Data Documentation

◆ m_calo_id

const CaloCell_ID* TBTrackToCaloAlg::m_calo_id
private

Definition at line 121 of file TBTrackToCaloAlg.h.

◆ m_calo_tb_coord

ICaloCoordinateTool* TBTrackToCaloAlg::m_calo_tb_coord
private

Definition at line 130 of file TBTrackToCaloAlg.h.

◆ m_calodepth

CaloDepthTool* TBTrackToCaloAlg::m_calodepth
private

Definition at line 126 of file TBTrackToCaloAlg.h.

◆ m_caloMgrKey

SG::ReadCondHandleKey<CaloDetDescrManager> TBTrackToCaloAlg::m_caloMgrKey {this,"CaloDetDescrManager", "CaloDetDescrManager"}
private

Definition at line 132 of file TBTrackToCaloAlg.h.

132{this,"CaloDetDescrManager", "CaloDetDescrManager"};

◆ m_cell_container

std::string TBTrackToCaloAlg::m_cell_container
private

Definition at line 120 of file TBTrackToCaloAlg.h.

◆ m_cluster_container

std::string TBTrackToCaloAlg::m_cluster_container
private

Definition at line 119 of file TBTrackToCaloAlg.h.

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< Algorithm > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< Algorithm > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_extendedExtraObjects

DataObjIDColl AthAlgorithm::m_extendedExtraObjects
privateinherited

Definition at line 79 of file AthAlgorithm.h.

◆ m_ImpactInCalosOutputName

std::string TBTrackToCaloAlg::m_ImpactInCalosOutputName
private

Definition at line 124 of file TBTrackToCaloAlg.h.

◆ m_particle

const Rec::TrackParticleContainer* TBTrackToCaloAlg::m_particle
private

Definition at line 115 of file TBTrackToCaloAlg.h.

◆ m_phiRange

CaloPhiRange TBTrackToCaloAlg::m_phiRange
private

Definition at line 127 of file TBTrackToCaloAlg.h.

◆ m_toCalo

TBExtrapolTrackToCaloTool* TBTrackToCaloAlg::m_toCalo
private

Definition at line 125 of file TBTrackToCaloAlg.h.

◆ m_TrackName

std::string TBTrackToCaloAlg::m_TrackName
private

Definition at line 112 of file TBTrackToCaloAlg.h.

◆ m_TrackParticleName

std::string TBTrackToCaloAlg::m_TrackParticleName
private

Definition at line 114 of file TBTrackToCaloAlg.h.

◆ m_tracks

const TrackCollection* TBTrackToCaloAlg::m_tracks
private

Definition at line 113 of file TBTrackToCaloAlg.h.

◆ m_trkinput

std::string TBTrackToCaloAlg::m_trkinput
private

Definition at line 116 of file TBTrackToCaloAlg.h.

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< Algorithm > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< Algorithm > >::m_vhka
privateinherited

Definition at line 398 of file AthCommonDataStore.h.


The documentation for this class was generated from the following files: