132 {
133
134 MsgStream log(
msgSvc(),
"EmcMcHitCnv");
135 log << MSG::DEBUG << "EmcMcHitCnv::DataObjectToTObject" << endreq;
136 StatusCode sc=StatusCode::SUCCESS;
137
139 if (!emcMcHitCnvTds) {
140 log << MSG::ERROR << "Could not downcast to EmcMcHitCol" << endreq;
141 return StatusCode::FAILURE;
142 }
143
144 DataObject *evt;
146 if (evt==NULL) {
147 log << MSG::ERROR << "Could not get McEvent in TDS " << endreq;
148 return StatusCode::FAILURE;
149 }
151 if (!devtTds) {
152 log << MSG::ERROR << "EmcMcHitCnv:Could not downcast to TDS McEvent" << endreq;
153 }
154 IOpaqueAddress *addr;
155
158
160 if (!m_emcMcHitCol) return sc;
162 EmcMcHitCol::const_iterator emcMcTds;
163
164 for (emcMcTds = emcMcHitCnvTds->begin(); emcMcTds != emcMcHitCnvTds->end(); emcMcTds++) {
165 UInt_t id = ((*emcMcTds)->identify()).get_value() ;
166 UInt_t trackIndex = (*emcMcTds) ->getTrackIndex();
167
168 int hitEmc = (*emcMcTds) ->getHitEmc();
169 int PDGCode = (*emcMcTds) ->getPDGCode();
170 double PDGCharge = (*emcMcTds) ->getPDGCharge();
171 double time = (*emcMcTds) ->getTime();
172 std::map<Identifier, Double_t> TdshitMap = (*emcMcTds)->getHitMap();
173
174 map<Int_t, Double_t> HitMap;
175 map<Identifier, Double_t>::iterator iHitMap;
176 for(iHitMap=TdshitMap.begin();
177 iHitMap!=TdshitMap.end();
178 iHitMap++) {
179
180 Int_t id(iHitMap->first.get_value());
181 pair<Int_t, Double_t> Hit(id, iHitMap->second);
182 HitMap.insert(Hit);
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198 }
199
200 Double_t xPosition = (*emcMcTds) ->getPositionX() ;
201 Double_t yPosition = (*emcMcTds) ->getPositionY() ;
202 Double_t zPosition = (*emcMcTds) ->getPositionZ() ;
203 Double_t px= (*emcMcTds) ->getPx() ;
204 Double_t py = (*emcMcTds) ->getPy() ;
205 Double_t pz = (*emcMcTds) ->getPz() ;
206 Double_t depositEnergy = (*emcMcTds) ->getDepositEnergy() ;
207
209
210
211 emcMcRoot->
setId(
id);
213
218
219
224 emcMcRoot->
setPx(px);
225 emcMcRoot->
setPy(py);
226 emcMcRoot->
setPz(pz);
228
230 }
231
232 return StatusCode::SUCCESS;
233}
static TMcEvent * getWriteObject()
returns object to be written (maintained here for all DIGI-converters)
IDataProviderSvc * m_eds
pointer to eventdataservice
virtual StatusCode createRep(DataObject *pObject, IOpaqueAddress *&refpAddress)
Convert the transient object to the requested representation.
void setPositionZ(Double_t positionZ)
void setTrackIndex(UInt_t trackIndex)
void setPDGCode(int PDGCode)
void setHitMap(std::map< Int_t, Double_t > hitMap)
void setHitEmc(int hitEmc)
void setPositionY(Double_t positionY)
void setPDGCharge(double PDGCharge)
void setPositionX(Double_t positionX)
void setTime(double time)
void setDepositEnergy(Double_t depositEnergy)
const TObjArray * getEmcMcHitCol() const
void addEmcMc(TEmcMc *mcHit)
Emc.
_EXTERN_ std::string Event
ObjectVector< EmcMcHit > EmcMcHitCol