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