001 #include "GaudiKernel/ToolFactory.h"
002 #include "GaudiKernel/SmartDataPtr.h"
003 #include "GaudiKernel/IDataProviderSvc.h"
004
005
006 #include "EventInfo/EventInfo.h"
007 #include "EventInfo/EventType.h"
008 #include "EventInfo/EventID.h"
009
010 #include "TrkTrack/Track.h"
011
012
013 #include "Particle/TrackParticleContainer.h"
014
015
016 #include "STACOTools/StacoDumpTrackParticleContainerTool.h"
017
018
019 #include "STACOToolsInterfaces/IStacoEDMHelper.h"
020
021 StacoDumpTrackParticleContainerTool::StacoDumpTrackParticleContainerTool(const std::string& t,
022 const std::string& n,
023 const IInterface* p ):AthAlgTool(t,n,p),
024 p_OwnEDMHelper ( "StacoEDMHelper/ConfiguredStacoEDMHelper" )
025 {
026
027 declareInterface<IStacoDumpTrackParticleContainerTool>(this);
028
029 declareProperty("StacoEDMHelper" , p_OwnEDMHelper ) ;
030
031 }
032
033 StacoDumpTrackParticleContainerTool::~StacoDumpTrackParticleContainerTool(){}
034
035
036 StatusCode StacoDumpTrackParticleContainerTool::initialize(){
037
038 StatusCode sc = StatusCode::SUCCESS;
039
040 sc = AthAlgTool::initialize();
041 if ( sc.isFailure() ) {
042 msg(MSG::FATAL) << " AthAlgTool::initialize() failed" << endreq;
043 return( StatusCode::FAILURE );
044 }
045
046
047 if ( p_OwnEDMHelper.retrieve().isFailure() ) {
048 msg(MSG::FATAL) << "Failed to retrieve tool " << p_OwnEDMHelper << endreq;
049 return StatusCode::FAILURE;
050 }
051 msg(MSG::INFO) << "Retrieved tool " << p_OwnEDMHelper << endreq;
052
053
054 return StatusCode::SUCCESS;
055
056 }
057
058 StatusCode StacoDumpTrackParticleContainerTool::DoDump(
059 std::string TrackParticleContainerLocation,
060 std::ofstream* pOutFile
061 ){
062
063 StatusCode sc = StatusCode::SUCCESS;
064
065 p_OutCurrent = pOutFile ;
066 sc = dump_Container(TrackParticleContainerLocation);
067 if (sc.isFailure()) msg(MSG::WARNING) << "dump_Container failed " << endreq;
068
069 return StatusCode::SUCCESS;
070
071 }
072 StatusCode StacoDumpTrackParticleContainerTool::DoDump(
073 const Rec::TrackParticleContainer * pTrackParticleContainer,
074 std::ofstream* pOutFile
075 ){
076
077 StatusCode sc = StatusCode::SUCCESS;
078
079 p_OutCurrent = pOutFile ;
080 sc = dump_Container(pTrackParticleContainer);
081 if (sc.isFailure()){
082 msg(MSG::WARNING) << "dump_Container(pTrackParticleContainer) failed " << endreq;
083 }
084
085 return StatusCode::SUCCESS;
086
087 }
088
089
090 StatusCode StacoDumpTrackParticleContainerTool::dump_Container(
091 std::string ContainerName
092 ){
093
094 StatusCode sc = StatusCode::SUCCESS;
095
096 const Rec::TrackParticleContainer * pTrackParticleContainer;
097 sc = evtStore()->retrieve(pTrackParticleContainer, ContainerName);
098 if (sc.isFailure()) {
099 msg(MSG::WARNING) << " pTrackParticleContainer not found at " << ContainerName << endreq;
100 return StatusCode::SUCCESS;
101 }
102
103 sc = dump_Container(pTrackParticleContainer);
104 if (sc.isFailure()) {
105 msg(MSG::WARNING) << " dump_Container(pTrackParticleContainer) failed " << endreq;
106 return StatusCode::SUCCESS;
107 }
108
109 return StatusCode::SUCCESS;
110
111 }
112
113
114 StatusCode StacoDumpTrackParticleContainerTool::dump_Container(
115 const Rec::TrackParticleContainer * pTrackParticleContainer
116 ){
117
118 StatusCode sc = StatusCode::SUCCESS;
119
120 if (!pTrackParticleContainer) {
121 msg(MSG::WARNING) << "pTrackParticleContainer is null " << endreq;
122 return StatusCode::SUCCESS;
123 }
124
125 const DataHandle<EventInfo> TheEventInfo;
126 sc = evtStore()->retrieve(TheEventInfo);
127 if ( sc.isFailure() ) {
128 msg(MSG::WARNING) << " retrieve TheEventInfo failed" << endreq;
129 return StatusCode::SUCCESS;
130 }
131
132 *p_OutCurrent
133 << " "
134 <<std::endl;
135 *p_OutCurrent
136 << "* For the event : "
137 << TheEventInfo->event_ID()->event_number()
138 << std::endl;
139
140 int Kounter = 0 ;
141 for (Rec::TrackParticleContainer::const_iterator it = pTrackParticleContainer->begin(); it!=pTrackParticleContainer->end(); ++it){
142
143 const Trk::Track* pTrack = (*it)->originalTrack();
144
145 Kounter = Kounter + 1 ;
146 *p_OutCurrent
147 << " "
148 <<std::endl;
149 *p_OutCurrent
150 << "* Track number "
151 << Kounter
152 <<std::endl;
153
154 *p_OutCurrent << "* dump it " <<std::endl;
155 *p_OutCurrent << *(*it) <<std::endl;
156
157 if (pTrack->measurementsOnTrack()!=0)
158 *p_OutCurrent << "* It has " << pTrack->measurementsOnTrack()->size()<< " RIO_OnTrack(s)"<<std::endl;
159
160 if (pTrack->trackStateOnSurfaces()!=0)
161 *p_OutCurrent << "* It has " << pTrack->trackStateOnSurfaces()->size()<< " TrackStateOnSurface(s)"<<std::endl;
162
163 if (pTrack->trackParameters()!=0)
164 *p_OutCurrent << "* It has " << pTrack->trackParameters()->size() << " tracks parameter(s)"<<std::endl;
165
166 *p_OutCurrent << " -----TrackSummary--------- " << std::endl;
167 if ((*it)->trackSummary()) {
168 *p_OutCurrent <<*((*it)->trackSummary()) << std::endl;
169 }else{
170 *p_OutCurrent << "((*it)->trackSummary()) is zero " << std::endl;
171 }
172
173 double Eloss = 0. ;
174 sc = p_OwnEDMHelper->BackTrackingEloss(pTrack,Eloss) ;
175 if (sc.isSuccess()){
176 *p_OutCurrent << "* Its Eloss is: "
177 << std::setw(12)<<std::setprecision(5)
178 << Eloss
179 << std::endl;
180 }else{
181 *p_OutCurrent << "* Its Eloss can not be computed "
182 << std::endl;
183 }
184
185 sc = p_OwnEDMHelper->dump_TrkTrack(pTrack,p_OutCurrent);
186 if (sc.isFailure()) msg(MSG::WARNING) << "dump_TrkTrack failed" << endreq;
187
188 *p_OutCurrent << "* Its digits are:"<<std::endl;
189 sc = p_OwnEDMHelper->dump_TrkTrackDigits(pTrack,p_OutCurrent);
190 if (sc.isFailure()) msg(MSG::WARNING) << "dump_TrkTrackDigits failed" << endreq;
191
192 }
193
194 return StatusCode::SUCCESS;
195
196 }
197
198 StatusCode StacoDumpTrackParticleContainerTool::finalize(){return StatusCode::SUCCESS;}
| Due to the LXR bug, the updates fail sometimes to remove references to deleted files. The Saturday's full rebuilds fix these problems |
|
This page was automatically generated by the
LXR engine.
|
|