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 #include "Particle/TrackParticle.h"
013
014
015 #include "STACOTools/StacoDumpStacoContainerTool.h"
016
017 #include "STACOEvent/StacoObject.h"
018
019
020 #include "STACOEvent/StacoContainer.h"
021 #include "STACOToolsInterfaces/IStacoEDMHelper.h"
022
023
024 StacoDumpStacoContainerTool::StacoDumpStacoContainerTool(const std::string& t,
025 const std::string& n,
026 const IInterface* p ):AthAlgTool(t,n,p),
027 p_OwnEDMHelper ( "StacoEDMHelper/ConfiguredStacoEDMHelper" )
028 {
029
030 declareInterface<IStacoDumpStacoContainerTool>(this);
031
032 declareProperty("StacoEDMHelper" , p_OwnEDMHelper ) ;
033
034 }
035
036 StacoDumpStacoContainerTool::~StacoDumpStacoContainerTool(){}
037
038
039 StatusCode StacoDumpStacoContainerTool::initialize(){
040
041 StatusCode sc = StatusCode::SUCCESS;
042
043
044 sc = AthAlgTool::initialize();
045 if ( sc.isFailure() ) {
046 msg(MSG::FATAL) << " AthAlgTool::initialize() failed" << endreq;
047 return( StatusCode::FAILURE );
048 }
049
050
051
052 if ( p_OwnEDMHelper.retrieve().isFailure() ) {
053 msg(MSG::FATAL) << "Failed to retrieve tool " << p_OwnEDMHelper << endreq;
054 return StatusCode::FAILURE;
055 }
056 msg(MSG::INFO) << "Retrieved tool " << p_OwnEDMHelper << endreq;
057
058
059 return StatusCode::SUCCESS;
060
061 }
062
063 StatusCode StacoDumpStacoContainerTool::DoDump(
064 std::string StacoContainerLocation,
065 std::ofstream* pOutFile
066 ){
067
068 StatusCode sc = StatusCode::SUCCESS;
069
070 p_OutCurrent = pOutFile ;
071 sc = dump_Container(StacoContainerLocation);
072 if (sc.isFailure()){
073 msg(MSG::WARNING) << "dump_Container failed " << endreq;
074 return StatusCode::SUCCESS;
075 }
076
077 return StatusCode::SUCCESS;
078
079 }
080 StatusCode StacoDumpStacoContainerTool::DoDump(
081 const StacoContainer* pStacoContainer,
082 std::ofstream* pOutFile
083 ){
084
085 StatusCode sc = StatusCode::SUCCESS;
086
087 p_OutCurrent = pOutFile ;
088 sc = dump_Container(pStacoContainer);
089 if (sc.isFailure()){
090 msg(MSG::WARNING) << "dump_Container(pStacoContainer) failed " << endreq;
091 return StatusCode::SUCCESS;
092 }
093
094 return StatusCode::SUCCESS;
095
096 }
097
098
099 StatusCode StacoDumpStacoContainerTool::dump_Container(
100 std::string ContainerName
101 ){
102
103 StatusCode sc = StatusCode::SUCCESS;
104
105 const StacoContainer* pStacoContainer;
106 sc = evtStore()->retrieve(pStacoContainer, ContainerName);
107 if (sc.isFailure()) {
108 msg(MSG::WARNING) << " pStacoContainer not found at" << ContainerName << endreq;
109 return StatusCode::SUCCESS;
110 }
111
112 sc = dump_Container(pStacoContainer);
113 if (sc.isFailure()) {
114 msg(MSG::WARNING) << " dump_Container(pStacoContainer) failed " << endreq;
115 return StatusCode::SUCCESS;
116 }
117
118 return StatusCode::SUCCESS;
119
120 }
121
122
123 StatusCode StacoDumpStacoContainerTool::dump_Container(
124 const StacoContainer* pStacoContainer
125 ){
126
127 StatusCode sc = StatusCode::SUCCESS;
128
129 if (!pStacoContainer){
130 msg(MSG::WARNING) << "pStacoContainer null" << endreq;
131 return StatusCode::SUCCESS;
132 }
133
134 const DataHandle<EventInfo> TheEventInfo;
135 sc = evtStore()->retrieve(TheEventInfo);
136 if ( sc.isFailure() ) {
137 msg(MSG::WARNING) << " retrieve TheEventInfo failed" << endreq;
138 return StatusCode::SUCCESS;
139 }
140
141 *p_OutCurrent
142 << " "
143 <<std::endl;
144 *p_OutCurrent
145 << "* For the event : "
146 << TheEventInfo->event_ID()->event_number()
147 << std::endl;
148
149 int Kounter = 0 ;
150 for (StacoContainer::const_iterator it = pStacoContainer->begin(); it!=pStacoContainer->end(); ++it){
151
152 const StacoObject* pStacoObject = (*it);
153
154 Kounter = Kounter + 1 ;
155 *p_OutCurrent
156 << " "
157 <<std::endl;
158 *p_OutCurrent
159 << "* Track number "
160 << Kounter
161 <<std::endl;
162
163 pStacoObject->Print(p_OutCurrent);
164
165 const Rec::TrackParticle* pTrackParticleMS;
166 pTrackParticleMS=pStacoObject->MuSpectro();
167
168 if (pTrackParticleMS){
169 *p_OutCurrent
170 << "* pTrackParticleMS exists "
171 <<std::endl;
172 const Trk::Track* pTrack = pTrackParticleMS->originalTrack();
173
174 if (pTrack->measurementsOnTrack()!=0)
175 *p_OutCurrent << "* It has " << pTrack->measurementsOnTrack()->size()<< " RIO_OnTrack(s)"<<std::endl;
176
177 if (pTrack->trackStateOnSurfaces()!=0)
178 *p_OutCurrent << "* It has " << pTrack->trackStateOnSurfaces()->size()<< " TrackStateOnSurface(s)"<<std::endl;
179
180 sc = p_OwnEDMHelper->dump_TrkTrack(pTrack,p_OutCurrent);
181 if (sc.isFailure()) msg(MSG::ERROR) << "dump_TrkTrack failed" << endreq;
182
183 *p_OutCurrent << "* Its digits are:"<<std::endl;
184 sc = p_OwnEDMHelper->dump_TrkTrackDigits(pTrack,p_OutCurrent);
185 if (sc.isFailure()) msg(MSG::ERROR) << "dump_TrkTrackDigits failed" << endreq;
186 }else{
187 *p_OutCurrent
188 << "* pTrackParticleMS does not exist "
189 <<std::endl;
190 }
191
192
193 const Rec::TrackParticle* pTrackParticleMSOnly;
194 pTrackParticleMSOnly=pStacoObject->MuSpectroMSOnly();
195
196 if (pTrackParticleMSOnly){
197 *p_OutCurrent
198 << "* pTrackParticleMSOnly exists "
199 <<std::endl;
200 const Trk::Track* pTrack = pTrackParticleMSOnly->originalTrack();
201
202 if (pTrack->measurementsOnTrack()!=0)
203 *p_OutCurrent << "* It has " << pTrack->measurementsOnTrack()->size()<< " RIO_OnTrack(s)"<<std::endl;
204
205 if (pTrack->trackStateOnSurfaces()!=0)
206 *p_OutCurrent << "* It has " << pTrack->trackStateOnSurfaces()->size()<< " TrackStateOnSurface(s)"<<std::endl;
207
208 sc = p_OwnEDMHelper->dump_TrkTrack(pTrack,p_OutCurrent);
209 if (sc.isFailure()) msg(MSG::ERROR) << "dump_TrkTrack failed" << endreq;
210
211 *p_OutCurrent << "* Its digits are:"<<std::endl;
212 sc = p_OwnEDMHelper->dump_TrkTrackDigits(pTrack,p_OutCurrent);
213 if (sc.isFailure()) msg(MSG::ERROR) << "dump_TrkTrackDigits failed" << endreq;
214 }else{
215 *p_OutCurrent
216 << "* pTrackParticleMS does not exist "
217 <<std::endl;
218 }
219
220
221 const Rec::TrackParticle* pTrackParticleID;
222 pTrackParticleID=pStacoObject->MuIdet();
223
224 if (pTrackParticleID){
225 *p_OutCurrent
226 << "* pTrackParticleID exists "
227 <<std::endl;
228 const Trk::Track* pTrack = pTrackParticleID->originalTrack();
229
230 if (pTrack->measurementsOnTrack()!=0)
231 *p_OutCurrent << "* It has " << pTrack->measurementsOnTrack()->size()<< " RIO_OnTrack(s)"<<std::endl;
232
233 if (pTrack->trackStateOnSurfaces()!=0)
234 *p_OutCurrent << "* It has " << pTrack->trackStateOnSurfaces()->size()<< " TrackStateOnSurface(s)"<<std::endl;
235
236 sc = p_OwnEDMHelper->dump_TrkTrack(pTrack,p_OutCurrent);
237 if (sc.isFailure()) msg(MSG::ERROR) << "dump_TrkTrack failed" << endreq;
238
239 *p_OutCurrent << "* Its digits are:"<<std::endl;
240 sc = p_OwnEDMHelper->dump_TrkTrackDigits(pTrack,p_OutCurrent);
241 if (sc.isFailure()) msg(MSG::ERROR) << "dump_TrkTrackDigits failed" << endreq;
242 }else{
243 *p_OutCurrent
244 << "* pTrackParticleID does not exist "
245 <<std::endl;
246 }
247
248 }
249
250 return StatusCode::SUCCESS;
251
252 }
253
254
255 StatusCode StacoDumpStacoContainerTool::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.
|
|