115 #include "StHbtMaker/Infrastructure/StHbtEvent.hh"
116 #include "StHbtMaker/Infrastructure/StHbtTrack.hh"
117 #include "StHbtMaker/Infrastructure/StHbtV0.hh"
118 #include "StHbtMaker/Infrastructure/StHbtXi.hh"
119 #include "StHbtMaker/Infrastructure/StHbtKink.hh"
120 #include "StHbtMaker/Base/StHbtTrackCut.h"
121 #include "StHbtMaker/Base/StHbtV0Cut.h"
122 #include "StHbtMaker/Base/StHbtXiCut.h"
123 #include "StHbtMaker/Base/StHbtKinkCut.h"
124 #include "PhysicalConstants.h"
125 #include "SystemOfUnits.h"
128 #include "StHbtMaker/Infrastructure/StHbtTTreeEvent.h"
129 #include "StHbtMaker/Infrastructure/StHbtTTreeTrack.h"
130 #include "StHbtMaker/Infrastructure/StHbtTTreeV0.h"
131 #include "StHbtMaker/Infrastructure/StHbtTTreeXi.h"
132 #include "StHbtMaker/Infrastructure/StHbtTTreeKink.h"
136 cout <<
"StHbtEvent::StHbtEvent(const StHbtTTreeEvent* ev)" << endl;
138 mEventNumber = ev->mEventNumber;
139 mRunNumber = ev->mRunNumber;
140 mTpcNhits = ev->mTpcNhits;
141 mNumberOfTracks = ev->mNumberOfTracks;
142 mNumberOfGoodTracks = ev->mNumberOfGoodTracks;
143 mCtbMultiplicity = (
unsigned short) ev->mCtbMultiplicity;
144 mZdcAdc[0] = (
unsigned short) ev->mZdcAdc[0];
145 mZdcAdc[1] = (
unsigned short) ev->mZdcAdc[1];
146 mUncorrectedNumberOfPositivePrimaries = ev->mUncorrectedNumberOfPositivePrimaries;
147 mUncorrectedNumberOfNegativePrimaries = ev->mUncorrectedNumberOfNegativePrimaries;
148 mReactionPlane[0] = ev->mReactionPlane[0];
149 mReactionPlane[1] = ev->mReactionPlane[1];
150 mReactionPlanePtWgt[0] = ev->mReactionPlanePtWgt[0];
151 mReactionPlanePtWgt[1] = ev->mReactionPlanePtWgt[1];
153 mMagneticField = ev->mMagneticField;
154 if (mMagneticField==0) {
156 cout <<
"StHbtEvent::StHbtEvent(const StHbtTTreeEvent* ev) - mMagneticField=" << mMagneticField << endl;
158 mMagneticField = 2.5;
160 cout <<
"StHbtEvent::StHbtEvent(const StHbtTTreeEvent* ev) - B=0 in TTree! WARNING!! PROBABLY SCREWED-UP!!" << endl;
162 mTriggerWord = ev->mTriggerWord;
163 mTriggerActionWord = ev->mTriggerActionWord;
165 mL3TriggerAlgorithm[0] = ev->mL3TriggerAlgorithm;
169 mV0Collection =
new StHbtV0Collection();
170 mXiCollection =
new StHbtXiCollection();
171 mKinkCollection =
new StHbtKinkCollection();
172 mTrackCollection =
new StHbtTrackCollection();
175 for (
unsigned int i=0; i <ev->mNtracks; i++) {
177 mTrackCollection->push_back(trackCopy);
180 for (
unsigned int i=0; i<ev->mNv0s; i++) {
182 mV0Collection->push_back(v0Copy);
185 for (
unsigned int i=0; i<ev->mNxis; i++) {
187 mXiCollection->push_back(xiCopy);
190 for (
unsigned int i=0; i <ev->mNkinks; i++) {
192 mKinkCollection->push_back(kinkCopy);
194 cout <<
"StHbtEvent::StHbtEvent(const StHbtTTreeEvent* ev) - collections:";
195 cout <<
" " << mTrackCollection->size();
196 cout <<
"/" << mV0Collection->size();
197 cout <<
"/" << mXiCollection->size();
198 cout <<
"/" << mKinkCollection->size();
205 #include "StMuDSTMaker/COMMON/StMuDst.h"
206 #include "StMuDSTMaker/COMMON/StMuEvent.h"
207 #include "StMuDSTMaker/COMMON/StMuTrack.h"
208 #include "StMuDSTMaker/COMMON/StMuDebug.h"
211 StHbtEvent::StHbtEvent(
const StMuDst* dst,
int trackType) {
214 mEventNumber = ev->eventNumber();
215 mRunNumber = ev->runNumber();
217 mNumberOfTracks = ev->eventSummary().numberOfTracks();
218 mNumberOfGoodTracks = ev->eventSummary().numberOfGoodTracks();
219 mCtbMultiplicity = (
unsigned short) ev->ctbMultiplicity();
220 mZdcAdc[0] = (
unsigned short) ev->zdcAdcAttentuatedSumWest();
221 mZdcAdc[1] = (
unsigned short) ev->zdcAdcAttentuatedSumEast();
222 mUncorrectedNumberOfPositivePrimaries = ev->
refMultPos();
223 mUncorrectedNumberOfNegativePrimaries = ev->
refMultNeg();
224 mUncorrectedNumberOfPrimaries = ev->
refMult();
225 mReactionPlane[0] = 0;
226 mReactionPlane[1] = 0;
227 mReactionPlanePtWgt[0] = 0;
228 mReactionPlanePtWgt[1] = 0;
229 mPrimVertPos = ev->eventSummary().primaryVertexPosition();
230 mMagneticField = ev->magneticField();
232 mTriggerWord = ev->l0Trigger().triggerWord();
233 mTriggerActionWord = ev->l0Trigger().triggerActionWord();
238 mV0Collection =
new StHbtV0Collection();
239 mXiCollection =
new StHbtXiCollection();
240 mKinkCollection =
new StHbtKinkCollection();
241 mTrackCollection =
new StHbtTrackCollection();
248 default: DEBUGMESSAGE(
"don't know how to handle this track type");
251 DEBUGVALUE2(trackType);
252 int nTracks = tracks->GetEntries();
253 DEBUGVALUE2(tracks->GetEntries());
254 for (
int i=0; i<nTracks; i++) {
256 mTrackCollection->push_back(trackCopy);
262 int nV0s = dst->
v0s()->GetEntries();
263 for (
int i=0; i<nV0s; i++) {
264 dst->
v0s(i)->SetEvent(strangeEvent);
267 mV0Collection->push_back(v0Copy);
270 int nXis = dst->
xis()->GetEntries();
271 for (
int i=0; i<nXis; i++) {
272 dst->
xis(i)->SetEvent(strangeEvent);
274 mXiCollection->push_back(xiCopy);
282 cout <<
"StHbtEvent::StHbtEvent(const StHbtTTreeEvent* ev) - collections:";
283 cout <<
" " << mTrackCollection->size();
284 cout <<
"/" << mV0Collection->size();
285 cout <<
"/" << mXiCollection->size();
286 cout <<
"/" << mKinkCollection->size();
293 StHbtEvent::StHbtEvent(
const StMuDst* dst,
int trackType,
bool readV0Daughters) {
296 mEventNumber = ev->eventNumber();
297 mRunNumber = ev->runNumber();
299 mNumberOfTracks = ev->eventSummary().numberOfTracks();
300 mNumberOfGoodTracks = ev->eventSummary().numberOfGoodTracks();
301 mCtbMultiplicity = (
unsigned short) ev->ctbMultiplicity();
302 mZdcAdc[0] = (
unsigned short) ev->zdcAdcAttentuatedSumWest();
303 mZdcAdc[1] = (
unsigned short) ev->zdcAdcAttentuatedSumEast();
304 mUncorrectedNumberOfPositivePrimaries = ev->
refMultPos();
305 mUncorrectedNumberOfNegativePrimaries = ev->
refMultNeg();
306 mUncorrectedNumberOfPrimaries = ev->
refMult();
307 mReactionPlane[0] = 0;
308 mReactionPlane[1] = 0;
309 mReactionPlanePtWgt[0] = 0;
310 mReactionPlanePtWgt[1] = 0;
311 mPrimVertPos = ev->eventSummary().primaryVertexPosition();
312 mMagneticField = ev->magneticField();
314 mTriggerWord = ev->l0Trigger().triggerWord();
315 mTriggerActionWord = ev->l0Trigger().triggerActionWord();
320 mV0Collection =
new StHbtV0Collection();
321 mXiCollection =
new StHbtXiCollection();
322 mKinkCollection =
new StHbtKinkCollection();
323 mTrackCollection =
new StHbtTrackCollection();
330 default: DEBUGMESSAGE(
"don't know how to handle this track type");
334 DEBUGVALUE2(trackType);
335 int nTracks = tracks->GetEntries();
336 DEBUGVALUE2(tracks->GetEntries());
337 for (
int i=0; i<nTracks; i++) {
340 mTrackCollection->push_back(trackCopy);
346 int nV0s = dst->
v0s()->GetEntries();
350 int nTracks = tracks->GetEntries();
351 TrackToId = (
double*)malloc(
sizeof(
double)*nTracks);
352 for (
int i=0; i<nTracks; i++) {
354 TrackToId[i] = trackCopy->TrackId();
357 for (
int i=0; i<nV0s; i++) {
358 dst->
v0s(i)->SetEvent(strangeEvent);
362 if (readV0Daughters){
364 int nTracks = tracks->GetEntries();
368 for (
int j=0; j<nTracks; j++) {
369 if (TrackToId[j]==v0Copy->idNeg()) {
372 v0Copy->SetHelixNeg(trackCopy->Helix());
375 if (TrackToId[j]==v0Copy->idPos()) {
378 v0Copy->SetHelixPos(trackCopy->Helix());
382 if ((V0PosOk < 0) && (V0NegOk < 0)) {
386 if ((V0PosOk < 0) != (V0NegOk < 0)) {
387 cout <<
"!!! StHbtEvent::At least One V0 daughter is not found !!!" << endl;
389 v0Copy->SetprimaryVertex(ev->eventSummary().primaryVertexPosition());
391 mV0Collection->push_back(v0Copy);
397 int nXis = dst->
xis()->GetEntries();
398 for (
int i=0; i<nXis; i++) {
399 dst->
xis(i)->SetEvent(strangeEvent);
401 mXiCollection->push_back(xiCopy);
409 cout <<
"StHbtEvent::StHbtEvent(const StHbtTTreeEvent* ev) - collections:";
410 cout <<
" " << mTrackCollection->size();
411 cout <<
"/" << mV0Collection->size();
412 cout <<
"/" << mXiCollection->size();
413 cout <<
"/" << mKinkCollection->size();
423 StHbtEvent::StHbtEvent(){
424 mPrimVertPos[0]=-999.0;
425 mPrimVertPos[1]=-999.0;
426 mPrimVertPos[2]=-999.0;
427 mTrackCollection =
new StHbtTrackCollection;
428 mV0Collection =
new StHbtV0Collection;
429 mXiCollection =
new StHbtXiCollection;
430 mKinkCollection =
new StHbtKinkCollection;
436 mEventNumber = ev.mEventNumber;
437 mRunNumber = ev.mRunNumber;
438 mCtbMultiplicity = ev.mCtbMultiplicity;
439 mZdcAdc[0] = ev.mZdcAdc[0];
440 mZdcAdc[1] = ev.mZdcAdc[1];
441 mTpcNhits = ev.mTpcNhits;
442 mNumberOfTracks = ev.mNumberOfTracks;
443 mNumberOfGoodTracks = ev.mNumberOfGoodTracks;
444 mUncorrectedNumberOfPositivePrimaries = ev.mUncorrectedNumberOfPositivePrimaries;
445 mUncorrectedNumberOfNegativePrimaries = ev.mUncorrectedNumberOfNegativePrimaries;
446 mUncorrectedNumberOfPrimaries = ev.mUncorrectedNumberOfPrimaries;
447 mReactionPlane[0] = ev.mReactionPlane[0];
448 mReactionPlane[1] = ev.mReactionPlane[1];
449 mReactionPlanePtWgt[0] = ev.mReactionPlanePtWgt[0];
450 mReactionPlanePtWgt[1] = ev.mReactionPlanePtWgt[1];
451 mPrimVertPos = ev.mPrimVertPos;
452 mMagneticField= ev.mMagneticField;
453 mTriggerWord = ev.mTriggerWord;
454 mTriggerActionWord = ev.mTriggerActionWord;
455 for (
int i=0; i<4; i++) mL3TriggerAlgorithm[i] = ev.mL3TriggerAlgorithm[i];
458 mTrackCollection =
new StHbtTrackCollection;
459 mV0Collection =
new StHbtV0Collection;
460 mXiCollection =
new StHbtXiCollection;
461 mKinkCollection =
new StHbtKinkCollection;
463 for ( StHbtTrackIterator tIter=ev.mTrackCollection->begin(); tIter!=ev.mTrackCollection->end(); tIter++) {
464 if ( !tCut || tCut->Pass(*tIter) ) {
466 mTrackCollection->push_back(trackCopy);
470 for ( StHbtV0Iterator vIter=ev.mV0Collection->begin(); vIter!=ev.mV0Collection->end(); vIter++) {
471 if ( !vCut || vCut->Pass(*vIter) ) {
473 mV0Collection->push_back(v0Copy);
477 for ( StHbtXiIterator xIter=ev.mXiCollection->begin(); xIter!=ev.mXiCollection->end(); xIter++) {
478 if ( !xCut || xCut->Pass(*xIter) ) {
480 mXiCollection->push_back(xiCopy);
484 for ( StHbtKinkIterator kIter=ev.mKinkCollection->begin(); kIter!=ev.mKinkCollection->end(); kIter++) {
485 if ( !kCut || kCut->Pass(*kIter) ) {
488 mKinkCollection->push_back(kinkCopy);
493 StHbtEvent::~StHbtEvent(){
495 cout <<
" StHbtEvent::~StHbtEvent() " << endl;
497 for (StHbtTrackIterator iter=mTrackCollection->begin();iter!=mTrackCollection->end();iter++){
500 mTrackCollection->clear();
501 delete mTrackCollection;
503 for (StHbtV0Iterator V0iter=mV0Collection->begin();V0iter!=mV0Collection->end();V0iter++){
507 for (StHbtXiIterator XiIter=mXiCollection->begin();XiIter!=mXiCollection->end();XiIter++){
510 mXiCollection->clear();
511 delete mXiCollection;
513 for (StHbtKinkIterator kinkIter=mKinkCollection->begin();kinkIter!=mKinkCollection->end();kinkIter++){
516 mKinkCollection->clear();
517 delete mKinkCollection;
520 void StHbtEvent::RotateZ(
const double angle){
522 StHbtTrackIterator iter;
523 StHbtV0Iterator V0iter;
530 mReactionPlane[0] += angle;
531 mReactionPlanePtWgt[0] += angle;
532 cout <<
" StHbtEvent::RotateZ(const double angle) - angle=" << angle <<
" rad ";
533 cout << angle / degree <<
" deg " << endl;
534 for (iter=mTrackCollection->begin();iter!=mTrackCollection->end();iter++){
535 p = (*iter)->P(); p.rotateZ(angle); (*iter)->SetP(p);
536 p= (*iter)->Helix().momentum(mMagneticField*kilogauss);
537 o= (*iter)->Helix().origin();
540 c= (*iter)->Helix().charge(mMagneticField*kilogauss);
542 (*iter)->SetHelix(helix);
544 for (V0iter=mV0Collection->begin();V0iter!=mV0Collection->end();V0iter++){
545 p=(*V0iter)->decayVertexV0(); p.rotateX(angle); (*V0iter)->SetdecayVertexV0(p);
546 p=(*V0iter)->momV0(); p.rotateX(angle); (*V0iter)->SetmomV0(p);
547 p=(*V0iter)->momPos(); p.rotateX(angle); (*V0iter)->SetmomPos(p);
548 p=(*V0iter)->momNeg(); p.rotateX(angle); (*V0iter)->SetmomNeg(p);
553 void StHbtEvent::SetEventNumber(
const unsigned short& event){mEventNumber = event;}
554 void StHbtEvent::SetRunNumber(
const int& runNum){mRunNumber = runNum;}
555 void StHbtEvent::SetCtbMult(
const unsigned short& mult){mCtbMultiplicity = mult;}
556 void StHbtEvent::SetZdcAdcEast(
const unsigned short& adc){mZdcAdc[0]= adc;}
557 void StHbtEvent::SetZdcAdcWest(
const unsigned short& adc){mZdcAdc[1]=adc;}
558 void StHbtEvent::SetNumberOfTpcHits(
const int& nhits){mTpcNhits = nhits;}
559 void StHbtEvent::SetNumberOfTracks(
const unsigned short& tracks){mNumberOfTracks = tracks;}
560 void StHbtEvent::SetNumberOfGoodTracks(
const unsigned short& tracks){mNumberOfGoodTracks = tracks;}
561 void StHbtEvent::SetUncorrectedNumberOfPositivePrimaries(
const unsigned int& tracks){mUncorrectedNumberOfPositivePrimaries = tracks;}
562 void StHbtEvent::SetUncorrectedNumberOfNegativePrimaries(
const unsigned int& tracks){mUncorrectedNumberOfNegativePrimaries = tracks;}
563 void StHbtEvent::SetUncorrectedNumberOfPrimaries(
const unsigned int& tracks){mUncorrectedNumberOfPrimaries = tracks;}
564 void StHbtEvent::SetReactionPlane(
const float& rp,
const int& wgt){
565 (wgt) ? mReactionPlanePtWgt[0]=rp : mReactionPlane[0]=rp;
567 void StHbtEvent::SetReactionPlaneError(
const float& rp,
const int& wgt){ SetReactionPlaneSubEventDifference(rp,wgt); }
568 void StHbtEvent::SetReactionPlaneSubEventDifference(
const float& rp,
const int& wgt){
569 (wgt) ? mReactionPlanePtWgt[1]=rp : mReactionPlane[1]=rp;
571 void StHbtEvent::SetPrimVertPos(
const StHbtThreeVector& vp){mPrimVertPos = vp;}
572 void StHbtEvent::SetMagneticField(
const double& magF){mMagneticField = magF;}
573 void StHbtEvent::SetTriggerWord(
const unsigned int& t){mTriggerWord = t;}
574 void StHbtEvent::SetTriggerActionWord(
const unsigned int& t){mTriggerActionWord = t;}
575 void StHbtEvent::SetL3TriggerAlgorithm(
const unsigned int& i,
const unsigned int& t){mL3TriggerAlgorithm[i] = t;}
577 unsigned short StHbtEvent::EventNumber()
const {
return mEventNumber;}
578 int StHbtEvent::RunNumber()
const {
return mRunNumber;}
579 unsigned short StHbtEvent::CtbMult()
const {
return mCtbMultiplicity;}
580 unsigned short StHbtEvent::ZdcAdcEast()
const {
return mZdcAdc[0];}
581 unsigned short StHbtEvent::ZdcAdcWest()
const {
return mZdcAdc[1];}
582 int StHbtEvent::NumberOfTpcHits()
const {
return mTpcNhits;}
583 unsigned short StHbtEvent::NumberOfTracks()
const {
return mNumberOfTracks;}
584 unsigned short StHbtEvent::NumberOfGoodTracks()
const {
return mNumberOfGoodTracks;}
585 unsigned int StHbtEvent::UncorrectedNumberOfPositivePrimaries()
const {
return mUncorrectedNumberOfPositivePrimaries;}
586 unsigned int StHbtEvent::UncorrectedNumberOfNegativePrimaries()
const {
return mUncorrectedNumberOfNegativePrimaries;}
587 unsigned int StHbtEvent::UncorrectedNumberOfPrimaries()
const {
return mUncorrectedNumberOfPrimaries;}
588 float StHbtEvent::ReactionPlane(
const int& wgt)
const {
589 return (wgt) ? mReactionPlanePtWgt[0] : mReactionPlane[0];
591 float StHbtEvent::ReactionPlaneError(
const int& wgt)
const {
return ReactionPlaneSubEventDifference(wgt);}
592 float StHbtEvent::ReactionPlaneSubEventDifference(
const int& wgt)
const {
593 return (wgt) ? mReactionPlanePtWgt[0] : mReactionPlane[0];
595 StHbtV0Collection* StHbtEvent::V0Collection()
const {
return mV0Collection;}
596 StHbtXiCollection* StHbtEvent::XiCollection()
const {
return mXiCollection;}
597 StHbtKinkCollection* StHbtEvent::KinkCollection()
const {
return mKinkCollection;}
598 StHbtTrackCollection* StHbtEvent::TrackCollection()
const {
return mTrackCollection;}
600 double StHbtEvent::MagneticField()
const {
return mMagneticField;}
601 unsigned int StHbtEvent::TriggerWord()
const {
return mTriggerWord;}
602 unsigned int StHbtEvent::TriggerActionWord()
const {
return mTriggerActionWord;}
603 unsigned int StHbtEvent::L3TriggerAlgorithm(
const unsigned int& i)
const {
return mL3TriggerAlgorithm[i];}
static TObjArray * globalTracks()
returns pointer to the global tracks list
unsigned short refMultNeg(int vtx_id=-1)
Reference multiplicity of negative particles as defined in StEventUtilities/StuRefMult.hh for vertex vtx_id (-1 is default index from StMuDst)
static TClonesArray * v0s()
returns pointer to the v0 list
static StStrangeEvMuDst * strangeEvent()
returns pointer to current StStrangeEvMuDst (class holding the event wise information, e.g. event number, run number)
static TObjArray * primaryTracks()
returns pointer to a list of tracks belonging to the selected primary vertex
unsigned short refMult(int vtx_id=-1)
Reference multiplicity of charged particles as defined in StEventUtilities/StuRefMult.hh for vertex vtx_id (-1 is default index from StMuDst)
static StMuEvent * event()
returns pointer to current StMuEvent (class holding the event wise information, e.g. event number, run number)
static TClonesArray * xis()
returns pointer to the xi list
unsigned short refMultPos(int vtx_id=-1)
Reference multiplicity of positive particles as defined in StEventUtilities/StuRefMult.hh for vertex vtx_id (-1 is default index from StMuDst)