37 {
38
39
40 MsgStream log(
msgSvc(),
"McParticleCnv");
41 log << MSG::DEBUG << "McParticleCnv::TObjectToDataObject" << endreq;
42 StatusCode sc=StatusCode::SUCCESS;
43
44
46 refpObject=mcParticleTdsCol;
47
48
49
50 if (!m_mcParticleCol) return sc;
51 TIter mcParticleIter(m_mcParticleCol);
53
54 vector<int> mothers;
55
56
57 while ((mcParticleRoot = (
TMcParticle*)mcParticleIter.Next())) {
60
64
69
74
79
80
81
82
83
84
85 HepLorentzVector initialMomentum(xInitialMomentum, yInitialMomentum, zInitialMomentum, eInitialMomentum);
86 HepLorentzVector initialPosition(xInitialPosition, yInitialPosition, zInitialPosition, tInitialPosition);
87
88 HepLorentzVector finalPosition(xFinalPosition, yFinalPosition, zFinalPosition, tFinalPosition);
89
90
93
94 mothers.push_back(mother);
95
96
99
100
101 mcParticleTds->
initialize(particleID, statusFlags, initialMomentum, initialPosition);
104
107
108 mcParticleTds->
finalize(finalPosition);
109
110 mcParticleTdsCol->push_back(mcParticleTds);
111 }
112
113
114 McParticleCol::iterator
iter;
115 int i =0;
116 for (
iter = mcParticleTdsCol->begin();
iter != mcParticleTdsCol->end();
iter++,i++){
117
118 if(mothers[i] != -99 ){
119 McParticleCol::iterator mcParticleTds;
120 for (mcParticleTds = mcParticleTdsCol->begin(); mcParticleTds != mcParticleTdsCol->end(); mcParticleTds++) {
121 int trackIndex = (*mcParticleTds)->
trackIndex();
122 if( trackIndex == mothers[i] ){
123 (*iter)->setMother(*mcParticleTds);
124 (*mcParticleTds)->addDaughter(*
iter);
125 break;
126 }
127 }
128 }
129 else{
130 (*iter)->setMother(*
iter);
131 }
132 }
133
134 delete m_mcParticleCol;
135 m_mcParticleCol = 0;
136 return StatusCode::SUCCESS;
137}
void setVertexIndex0(int index0)
methods for setting and getting vertex indexes
void initialize(StdHepId id, unsigned int statusBits, const HepLorentzVector &initialMomentum, const HepLorentzVector &initialPosition, const std::string process="")
Set the initial attributes of the McParticle.
void addStatusFlag(unsigned int flag)
add a new flag to the status flags
void finalize(const HepLorentzVector &finalPosition)
Set the final attributes of the McParticle.
void setVertexIndex1(int index1)
void setTrackIndex(int trackIndex)
Double_t getInitialMomentumX() const
Double_t getFinalPositionT() const
Double_t getFinalPositionX() const
Int_t getVertexIndex0() const
Double_t getInitialPositionX() const
Int_t getParticleID() const
Double_t getInitialMomentumZ() const
Double_t getInitialMomentumY() const
UInt_t getStatusFlags() const
vector< Int_t > getDaughters() const
Double_t getInitialPositionZ() const
Double_t getInitialPositionT() const
Double_t getFinalPositionY() const
Int_t getVertexIndex1() const
Int_t getTrackIndex() const
Double_t getFinalPositionZ() const
Double_t getInitialPositionY() const
Double_t getInitialMomentumE() const
static std::map< const TObject *, const McParticle * > m_rootMcParticleMap