52 #include "StEvent/StEvent.h"
53 #include "StMcEventMaker/StMcEventMaker.h"
54 #include "StAssociationMaker/StAssociationMaker.h"
55 #include "StAssociationMaker/StTrackPairInfo.hh"
57 #include "StGlobalTrack.h"
58 #include "StV0Vertex.h"
59 #include "StV0MuDst.hh"
61 #include "StMcEventTypes.hh"
62 #include "StParticleDefinition.hh"
63 #include "StTrackDetectorInfo.h"
65 #include "StStrangeControllerInclude.h"
73 StV0Controller::~StV0Controller() {
76 Int_t StV0Controller::MakeReadDst() {
81 for (j = 0; j<entries; j++) {
85 PrintNumCand(
"read",entries);
90 Int_t mc_entries = GetNMc();
91 for (j = 0; j<mc_entries; j++) {
103 StSPtrVecV0Vertex& v0Vertices =
event.v0Vertices();
104 entries = v0Vertices.size();
105 Int_t asize = dataArray->GetSize();
106 if (entries > asize) dataArray->Expand(entries+increment);
109 for (Int_t i=0; i<entries; i++) {
111 if ((v0Vertex) && (v0Vertex->dcaParentToPrimaryVertex() >= 0))
112 new((*dataArray)[j++])
StV0MuDst(v0Vertex,ev);
115 PrintNumCand(
"found",entries);
121 Int_t StV0Controller::MakeCreateMcDst(
StMcVertex* mcVert) {
123 mcV0MapType* theMcV0Map = 0;
124 mcTrackMapType* theMcTrackMap = 0;
126 theMcV0Map = assocMaker->mcV0Map();
127 theMcTrackMap = assocMaker->mcTrackMap();
129 if (!((assocMaker)&&(theMcV0Map)&&(theMcTrackMap)))
return kStOk;
134 Int_t indexRecoArray = -1;
135 Int_t count = theMcV0Map->count(mcVert);
138 pair<mcV0MapIter,mcV0MapIter> mcV0Bounds = theMcV0Map->equal_range(mcVert);
139 rcV0Partner = (*mcV0Bounds.first).second;
140 float x, y, z, delta, xd, yd, zd;
141 x = mcVert->position().x();
142 y = mcVert->position().y();
143 z = mcVert->position().z();
144 xd = x - rcV0Partner->position().x();
145 yd = y - rcV0Partner->position().y();
146 zd = z - rcV0Partner->position().z();
147 delta = xd*xd + yd*yd + zd*zd;
150 for(mcV0MapIter mcV0MapIt = mcV0Bounds.first;
151 mcV0MapIt != mcV0Bounds.second; ++mcV0MapIt) {
153 if (temp != rcV0Partner) {
154 xd = x - temp->position().x();
155 yd = y - temp->position().y();
156 zd = z - temp->position().z();
157 float delta2 = xd*xd + yd*yd + zd*zd;
158 if (delta2 < delta) { rcV0Partner = temp; delta = delta2; }
161 x = rcV0Partner->position().x();
162 y = rcV0Partner->position().y();
163 z = rcV0Partner->position().z();
165 for(Int_t i = 0; i < GetN(); i++) {
167 if( fabs(x - tmpV0->decayVertexV0X()) < 0.00001 &&
168 fabs(y - tmpV0->decayVertexV0Y()) < 0.00001 &&
170 { indexRecoArray = i;
break; }
174 StSPtrVecMcTrack& Daughters = mcVert->daughters();
175 for (StMcTrackIterator DTrackIt = Daughters.begin();
176 DTrackIt != Daughters.end(); DTrackIt++) {
177 switch ((Int_t)(*DTrackIt)->particleDefinition()->charge()) {
179 Pos = (*DTrackIt);
break;
181 Neg = (*DTrackIt);
break;
186 StV0Mc* v0Mc =
new((*mcArray)[mcEntries++])
StV0Mc(mcVert,Pos,Neg,ev);
187 if((assocMaker)&&(indexRecoArray!=-1)) {
188 new((*assocArray)[assocEntries++])
191 pair<mcTrackMapIter,mcTrackMapIter> mcTrackBounds =
192 theMcTrackMap->equal_range(Pos);
194 {
for(mcTrackMapIter mcMapIt = mcTrackBounds.first;
195 mcMapIt != mcTrackBounds.second; ++mcMapIt) {
196 if ((*mcMapIt).second->commonTpcHits() > bestPairInfo->commonTpcHits())
197 bestPairInfo = (*mcMapIt).second;
199 if (mcTrackBounds.first != mcTrackBounds.second) {
200 v0Mc->SetHitInfoPositive(bestPairInfo->commonTpcHits());
204 mcTrackBounds = theMcTrackMap->equal_range(Neg);
206 bestPairInfo = (*mcTrackBounds.first).second;
208 {
for(mcTrackMapIter mcMapIt = mcTrackBounds.first;
209 mcMapIt != mcTrackBounds.second; ++mcMapIt) {
210 if ((*mcMapIt).second->commonTpcHits() > bestPairInfo->commonTpcHits())
211 bestPairInfo = (*mcMapIt).second;
213 if (mcTrackBounds.first != mcTrackBounds.second) {
214 v0Mc->SetHitInfoNegative(bestPairInfo->commonTpcHits());
Monte Carlo Track class All information on a simulated track is stored in this class: kinematics...
StStrangeEvMuDst * GetMcEvent()
Event information.
virtual void SetEvent(StStrangeEvMuDst *)
Set pointer to event information.
Float_t decayVertexV0Z() const
Coordinates of decay vertex.
Int_t event() const
Event number.