93 #include "StPeCEvent.h"
94 #include "StPeCMaker.h"
95 #include "StEventTypes.h"
96 #include "StPeCEnumerations.h"
97 #include "StMuDSTMaker/COMMON/StMuEvent.h"
98 #include "StMuDSTMaker/COMMON/StMuTrack.h"
99 #include "StMuDSTMaker/COMMON/StMuDstMaker.h"
100 #include "StMuDSTMaker/COMMON/StMuDst.h"
101 #include "StMuDSTMaker/COMMON/StMuPrimaryVertex.h"
102 #include "StMuDSTMaker/COMMON/StMuDebug.h"
103 #include "StPreEclMaker/StPreEclMaker.h"
104 #include "StEmcUtil/geometry/StEmcGeom.h"
105 #include "StEmcUtil/others/emcDetectorName.h"
106 #include "StMuDSTMaker/COMMON/StMuDst2StEventMaker.h"
107 #include "St_db_Maker/St_db_Maker.h"
108 #include "StEpcMaker/StEpcMaker.h"
109 #include "StEmcUtil/projection/StEmcPosition.h"
110 #include "StTofCollection.h"
111 #include "StBTofCollection.h"
112 #include "StMuDSTMaker/COMMON/StMuBTofHitCollection.h"
117 #include "TPolyMarker3D.h"
118 #include "StMuDSTMaker/COMMON/StMuRpsCollection.h"
122 StPeCEvent::
StPeCEvent(
bool useBemc,
bool useTOF,
bool useVertex,
bool useTracks,
bool useRP,
bool readStMuDst,
bool readStEvent,
bool readBothInputs) :
123 muDst(0), eventP(0), treecalo(0), tofHits(0), tofTracks(0), vertices(0) {
125 pPairs =
new TClonesArray (
"StPeCPair", StPeCnMaxTracks);
126 sPairs =
new TClonesArray (
"StPeCPair", StPeCnMaxTracks);
127 tofHits =
new TClonesArray (
"StMuBTofHit",5*StPeCnMaxTracks);
128 if((useTOFlocal = useTOF)){
130 tofTracks =
new TClonesArray (
"StMuTrack",5*StPeCnMaxTracks);
132 LOG_INFO <<
"StPeCEvent constructor: useTOF ---------- " <<useTOF << endm;
134 if((useBemcLocal = useBemc)) {
135 treecalo =
new TClonesArray (
"StEmcCluster",5*StPeCnMaxTracks);
136 LOG_INFO <<
"StPeCEvent constructor: useBemc ---------- " <<useBemc << endm;
139 if((useVertexLocal = useVertex)){
140 vertices =
new TClonesArray (
"StMuPrimaryVertex",5*StPeCnMaxTracks);
141 LOG_INFO <<
"StPeCEvent constructor: useVertex ---------- " <<useVertex << endm;
144 if((useTracksLocal = useTracks)){
146 LOG_INFO <<
"StPeCEvent constructor: useTracks ---------- " <<useTracks << endm;
148 tracks =
new TClonesArray (
"StMuTrack", StPeCnMaxTracks);
150 if((useRPLocal = useRP)){
153 LOG_INFO <<
"StPeCEvent constructor: useRP ---------- " <<useRP << endm;
156 if((readStMuDstLocal = readStMuDst)){
160 }
if((readStEventLocal = readStEvent)){
164 }
if((readBothInputsLocal = readBothInputs)){
166 LOG_INFO <<
"StPeCEvent constructor: both inputs ---------- " <<readBothInputs << endm;
194 nBtofTriggerHitsSum = 0;
198 zdcCoincidenceRateSum = 0;
203 LOG_INFO <<
"StPeCEvent constructor: leaving constructor ---------- " << endm;
207 StPeCEvent::~StPeCEvent() {
220 void StPeCEvent::clear ( ) {
236 nBtofTriggerHitsSum = 0;
240 zdcCoincidenceRateSum = 0;
247 if(useTracksLocal)tracks->Clear();
253 if(useBemcLocal)treecalo->Clear();
254 if(useVertexLocal)vertices->Clear();
258 Int_t StPeCEvent::fill (
StEvent *event ) {
270 StDetectorId
id =
static_cast<StDetectorId
>(0+kBarrelEmcTowerId);
277 StSPtrVecEmcCluster& clusters = coll->clusters();
278 Int_t n = clusters.size();
279 cout<<
" number of clusters in BEMC "<<n<<endl;
280 for(Int_t j = 0;j<n;j++)
288 cout<<
" Number of hits in cluster "<<c->nHits()<<endl;
289 cout<<
" Energy of cluster "<<c->energy()<<endl;
290 cout<<
" eta and phi of cluster "<<c->eta()<<
" "<<c->phi()<<endl;
300 eventN =
event->id() ;
301 runN =
event->runId();
302 cout <<
"StEvent Run ID: " << runN << endl;
303 cout <<
"StEvent ID: " << eventN << endl;
305 bField =
event->summary()->magneticField();
319 StSPtrVecTrackNode& exnode =
event->trackNodes();
320 Int_t nnode=exnode.size();
324 for( Int_t in=0; in<nnode; in++ ) {
325 UInt_t nprim = exnode[in]->entries(primary);
326 UInt_t nglob = exnode[in]->entries(global);
328 if( nprim>1 || nglob>1 ){
329 cout<<
"There could be a problem! nprim= "<<nprim<<
" nglob= "<<nglob<<endl;
333 StTrack *tp = exnode[in]->track(primary);
335 if (! (tp->flag()>0))
continue;
338 float px = tp->geometry()->momentum().x();
339 float py = tp->geometry()->momentum().y();
340 SumPx = SumPx + px; SumPy = SumPy + py;
341 SumQ = SumQ + tp->geometry()->charge();
346 if(fabs(tp->geometry()->momentum().pseudoRapidity())<2.0) {
353 StTrack *tnp = exnode[in]->track(global);
356 if (! (tnp->flag()>0))
continue;
370 if (( nPrimaryTPC > 0 || nPrimaryFTPC>0 ) &&
371 ( nPrimaryTPC < StPeCnMaxTracks && nPrimaryFTPC< StPeCnMaxTracks ) &&( nPrimaryFTPC+nPrimaryTPC>=2 ) ) {
372 cout <<
" analyze event !" << endl;
374 cout <<
" reject event !" << endl;
381 pt = ::sqrt( SumPx*SumPx + SumPy*SumPy );
383 nGlobalTracks= NPrimaries;
384 nPrimaryTracks= NGlobal;
390 cout <<
"Vertex flag " << vtx->flag() << endl;
391 xVertex = vtx->position().x();
392 yVertex = vtx->position().y();
393 zVertex = vtx->position().z();
394 rVertex = ::sqrt(xVertex*xVertex + yVertex*yVertex);
396 if ( infoLevel > 1 ) {
397 cout <<
"StPeCEvent : primary vertex x:" << xVertex <<
" y: " << yVertex <<
" z: " << zVertex <<
" r: " << rVertex <<endl;
404 cout<<
"StPeCEvent: There was no primary vertex!"<<endl;
411 for( Int_t i1=0; i1<nnode-1; i1++ ) {
412 if( exnode[i1]->entries(primary) !=1 ) continue ;
413 trk1 = exnode[i1]->track(primary);
415 if ( trk1->detectorInfo()->numberOfPoints() < 11 )
continue ;
416 for( Int_t i2=i1+1; i2<nnode; i2++ ) {
417 if( exnode[i2]->entries(primary) !=1 )
continue ;
418 trk2 = exnode[i2]->track(primary);
420 if ( trk2->detectorInfo()->numberOfPoints() < 11 )
continue ;
422 if (! (trk1->flag()>0))
continue;
423 if (! (trk2->flag()>0))
continue;
428 lPair =
new((*pPairs)[nPPairs++])
StPeCPair(trk1,trk2,1,event) ;
429 cout<<
"in StPeCEvent lPair written "<<endl;
431 cout <<
"StPeCEvent : Primary Pair : "
432 <<
" sumQ = " << lPair->getSumCharge()
433 <<
" sumPt = " << lPair->getSumPt()
434 <<
" mInv = " << lPair->getMInv(pion)
435 <<
" opening angle = " << lPair->getOpeningAngle()
436 <<
" cos(theta*) = " << lPair->getCosThetaStar(pion) << endl;
446 Int_t StPeCEvent::fill(
StMuDst *mudst) {
448 TObjArray* muTracks = 0;
455 event = muDst->
event();
458 eventN =
event->eventInfo().id();
460 runN =
event->eventInfo().runId();
461 LOG_INFO <<
"StPeCEvent fill(muDst ): useBemc ---------- " <<useBemcLocal << endm;
462 LOG_INFO <<
"StPeCEvent fill(muDst ): useTOF ---------- " <<useTOFlocal << endm;
463 LOG_INFO <<
"StPeCEvent fill(muDst ): useVertex ---------- " <<useVertexLocal << endm;
464 LOG_INFO <<
"StPeCEvent fill(muDst ): useTracks ---------- " <<useTracksLocal << endm;
465 LOG_INFO <<
"StPeCEvent fill(muDst ): useRP ---------- " <<useRPLocal << endm;
466 LOG_INFO <<
"StPeCEvent fill(muDst) : TOF geometry pointer ---------- " << mTOFgeoEv<<endm;
467 LOG_INFO <<
"StMuEvent Run ID: " << runN << endm;
468 LOG_INFO <<
"StMuEvent ID: " << eventN << endm;
470 bField =
event->eventSummary().magneticField();
471 if (fabs(bField)<0.01) LOG_INFO <<
"StPeCEvent fill(muDst ): BField off " << endm;;
472 acceptEvent = kFALSE;
481 Int_t n = emcStEvent->getNClusters(1);
483 LOG_INFO<<
"StPeCEvent::fill(MuDst) number of clusters in BEMC "<<n<<endm;
484 for(Int_t j = 0;j<n;j++)
501 LOG_INFO <<
"StPeCEvent::fill number of btof hits "<<mudst->numberOfBTofHit()<<endm;
502 int nMax = mudst->numberOfBTofHit();
503 int globalTrackCounter = 0;
504 for(
int i=0;i<nMax;i++) {
512 int trayId = aHit->tray();
513 if(trayId<=120&&trayId>=0) {
514 StMuTrack *TofGlobalTrack = aHit->globalTrack();
515 if(!TofGlobalTrack)
continue;
517 globalTrackCounter++;
527 if(!rp) LOG_INFO <<
"StPeCEvent fill(mudst): No Roman Pot collections " << endm;
537 if(vtx.x() !=0 && vtx.y()!=0 && vtx.z()!=0) {
541 rVertex = ::sqrt(xVertex*xVertex + yVertex*yVertex);
551 nGlobalTracks=
event->eventSummary().numberOfGoodTracks();
552 nPrimaryTracks=
event->eventSummary().numberOfGoodPrimaryTracks();
557 muTracks = muDst->primaryTracks();
560 nPrim = nPrimaryTracks;
561 nTot = nGlobalTracks;
562 size_t Nvert = muDst->numberOfPrimaryVertices();
563 LOG_INFO <<
"StPeCEvent::fill(event mudst) #vertices: " <<Nvert<< endm;
564 zdcCoincidenceRateSum = mudst->
event()->runInfo().zdcCoincidenceRate();
569 LOG_ERROR <<
"In StPeCEvent summary: StTriggerData not available in StMuDst "<< endm;
572 lastDSM0Sum = trigData->lastDSM(0);
573 lastDSM1Sum = trigData->lastDSM(1);
575 zdcWestUASum = trigData->zdcAttenuated(west);
576 zdcEastUASum = trigData->zdcAttenuated(east);
578 nBtofTriggerHitsSum = trigData->tofMultiplicity();
579 nTOFtracksSum = globalTrackCounter;
593 for (
size_t verti = 0;verti<Nvert;++verti){
602 LOG_INFO <<
"StPeCEvent:: vertex index: "<<verti<<endm;
604 size_t Ntracks = muDst->primaryTracks()->GetEntries();
608 for (
size_t trackiter = 0;trackiter<Ntracks;trackiter++){
609 tp = (
StMuTrack*)muDst->primaryTracks(trackiter);
611 if (! (tp->
flag()>0))
continue;
613 if(fabs(tp->
eta())<2.0) {
630 if (( nPrimaryTPC > 0 || nPrimaryFTPC>0 ) &&
631 ( nPrimaryTPC < StPeCnMaxTracks && nPrimaryFTPC< StPeCnMaxTracks )&& (nPrimaryFTPC+nPrimaryTPC>=2)) {
632 LOG_INFO <<
" analyze vertex !" << endm;
637 muTracks = muDst->primaryTracks();
638 for(
int i1 = 0; i1 <= muTracks->GetLast(); i1++) {
639 trk1 = (
StMuTrack*)muTracks->UncheckedAt(i1);
640 for(
int i2 = i1+1; i2 <= muTracks->GetLast(); i2++) {
641 trk2 = (
StMuTrack*)muTracks->UncheckedAt(i2);
645 if (! (trk1->
flag()>0))
continue;
646 if (! (trk2->
flag()>0))
continue;
649 lPair =
new((*pPairs)[nPPairs++])
StPeCPair(trk1,trk2,1,event, mTOFgeoEv) ;
654 LOG_INFO <<
" number of pairs " << nPPairs<<
" in vertex index "<<verti<<endm;
656 LOG_INFO <<
" reject vertex !" << endm;
665 muTracks = muDst->globalTracks();
667 for(
int i1 = 0; i1 < nTot; i1++) {
668 muTrk1 = (
StMuTrack*)muTracks->UncheckedAt(i1);
669 for(
int i2 = i1+1; i2 < nTot; i2++) {
670 muTrk2 = (
StMuTrack*)muTracks->UncheckedAt(i2);
672 if (! (muTrk1->
flag()>0))
continue;
673 if (! (muTrk2->
flag()>0))
continue;
677 lPair =
new((*sPairs)[nSPairs++])
StPeCPair(muTrk1,muTrk2,0,event) ;
680 cout <<
"StPeCEvent : Primary Pair : "
681 <<
" sumQ = " << lPair->getSumCharge()
682 <<
" sumPt = " << lPair->getSumPt()
683 <<
" mInv = " << lPair->getMInv(pion)
684 <<
" opening angle = " << lPair->getOpeningAngle()
685 <<
" cos(theta*) = " << lPair->getCosThetaStar(pion) << endl;
702 std::vector<int> StPeCEvent::fill(
StEvent * eventP,
StMuDst *mudst) {
705 TObjArray* muTracks = 0;
711 int countVtxWithTOF = 0;
712 int countRejectVtxWithTOF = 0;
713 int saveNumTracks = 0;
714 float saveRejectedVtxZ = 0.;
715 float saveAccepteVtxZ = 0.;
717 std::vector<int> vector(15);
719 LOG_INFO <<
"StPeCEvent fill(muDst StEvent): useBemc ---------- " <<useBemcLocal << endm;
720 LOG_INFO <<
"StPeCEvent fill(muDst StEvent): useTOF ---------- " <<useTOFlocal << endm;
721 LOG_INFO <<
"StPeCEvent fill(muDst StEvent): useVertex ---------- " <<useVertexLocal << endm;
722 LOG_INFO <<
"StPeCEvent fill(muDst StEvent): useTracks ---------- " <<useTracksLocal << endm;
723 LOG_INFO <<
"StPeCEvent fill(muDst StEvent): useRP ---------- " <<useRPLocal << endm;
724 LOG_INFO <<
"StPeCEvent fill(muDst StEvent): TOF geometry pointer ---------- " << mTOFgeoEv<<endm;
730 if(summary) bFld=summary->magneticField()/10.;
731 if (fabs(bFld)<0.01) LOG_INFO <<
"StPeCEvent fill(muDst StEvent): BField off " << endm;;
732 acceptEvent = kFALSE;
740 StDetectorId
id =
static_cast<StDetectorId
>(0+kBarrelEmcTowerId);
747 StSPtrVecEmcCluster& clusters = coll->clusters();
748 Int_t n = clusters.size();
750 for(Int_t j = 0;j<n;j++)
771 nTOFhitsSum = mudst->numberOfBTofHit();
773 int nMax = mudst->numberOfBTofHit();
774 int globalTrackCounter = 0;
775 for(
int i=0;i<nMax;i++) {
783 int trayId = aHit->tray();
784 if(trayId<=120&&trayId>=0) {
785 StMuTrack *TofGlobalTrack = aHit->globalTrack();
786 if(!TofGlobalTrack)
continue;
788 globalTrackCounter++;
796 if(!rp) LOG_INFO <<
"StPeCEvent fill(mudst StEvent): No Roman Pot collections " << endm;
804 event = muDst->
event();
805 zdcCoincidenceRateSum = mudst->
event()->runInfo().zdcCoincidenceRate();
810 LOG_ERROR <<
"In StPeCEvent summary: StTriggerData not available in StMuDst StEvent"<< endm;
813 lastDSM0Sum = trigData->lastDSM(0);
814 lastDSM1Sum = trigData->lastDSM(1);
816 zdcWestUASum = trigData->zdcAttenuated(west);
817 zdcEastUASum = trigData->zdcAttenuated(east);
819 nBtofTriggerHitsSum = trigData->tofMultiplicity();
820 nTOFtracksSum = globalTrackCounter;
822 eventN =
event->eventInfo().id();
824 runN =
event->eventInfo().runId();
825 LOG_INFO <<
"StEvent StMuEvent Run ID: " << runN <<
" StMuEvent ID: " << eventN << endm;
827 LOG_INFO <<
"Found: " << globalTrackCounter <<
" tracks with TOF hit match" << endm;
829 bField =
event->eventSummary().magneticField();
833 nVertices =
event->eventSummary().numberOfVertices();
836 if(vtx.x() !=0 && vtx.y()!=0 && vtx.z()!=0) {
840 rVertex = ::sqrt(xVertex*xVertex + yVertex*yVertex);
850 nGlobalTracks=
event->eventSummary().numberOfGoodTracks();
851 nPrimaryTracks=
event->eventSummary().numberOfGoodPrimaryTracks();
856 muTracks = muDst->primaryTracks();
859 nPrim = nPrimaryTracks;
860 nTot = nGlobalTracks;
862 size_t Nvert = muDst->numberOfPrimaryVertices();
863 LOG_INFO <<
"StPeCEvent::fill(event mudst) #vertices: " <<Nvert<< endm;
878 for (
size_t verti = 0;verti<Nvert;++verti){
888 LOG_INFO <<
"StPeCEvent:: loop vertices #BEMC match: " <<V->nBEMCMatch()<<
" num tracks used: "<<V->nTracksUsed()<< endm;
891 size_t Ntracks = muDst->primaryTracks()->GetEntries();
892 LOG_INFO <<
"StPeCEvent::fill(ev mudst) #track in vertex : " <<Ntracks<<
" vertex index "<<verti<< endm;
896 for (
int trackiter = 0;trackiter<Ntracks;trackiter++){
897 tp = (
StMuTrack*)muDst->primaryTracks(trackiter);
898 if(tp->index2BTofHit()>-1){
899 LOG_INFO <<
"StPeCEvent:: a tracks with TOF match -----index to global " <<tp->
index2Global()<<
" num BTof hits "<<mudst->numberOfBTofHit()<<endm;
902 if (! (tp->
flag()>0))
continue;
904 if(fabs(tp->
eta())<2.0) {
919 LOG_INFO <<
"Number of primary TPC tracks: " << nPrimaryTPC <<
" FTPC tracks " << nPrimaryFTPC<<endm;
924 if (( nPrimaryTPC > 0 || nPrimaryFTPC>0 ) &&
925 ( nPrimaryTPC < StPeCnMaxTracks && nPrimaryFTPC< StPeCnMaxTracks )&& (nPrimaryFTPC+nPrimaryTPC>=2)) {
931 saveAccepteVtxZ = V->position().z();
933 LOG_INFO <<
" analyze vertex ! " <<countAccVtx<< endm;
937 muTracks = muDst->primaryTracks();
938 for(
int i1 = 0; i1 <= muTracks->GetLast(); i1++) {
939 trk1 = (
StMuTrack*)muTracks->UncheckedAt(i1);
941 for(
int i2 = i1+1; i2 <= muTracks->GetLast(); i2++) {
942 trk2 = (
StMuTrack*)muTracks->UncheckedAt(i2);
945 if (! (trk1->
flag()>0))
continue;
946 if (! (trk2->
flag()>0))
continue;
949 lPair =
new((*pPairs)[nPPairs++])
StPeCPair(trk1,trk2,1,event, eventP, mTOFgeoEv) ;
950 LOG_INFO <<
" wrote the pair ! nPPair: " <<nPPairs<< endm;
955 LOG_INFO <<
" reject vertex !" << endm;
957 countRejectVtxWithTOF++;
958 saveNumTracks = nPrimaryTPC;
959 saveRejectedVtxZ = V->position().z();
972 muTracks = muDst->globalTracks();
974 for(
int i1 = 0; i1 < nTot; i1++) {
975 muTrk1 = (
StMuTrack*)muTracks->UncheckedAt(i1);
976 for(
int i2 = i1+1; i2 < nTot; i2++) {
977 muTrk2 = (
StMuTrack*)muTracks->UncheckedAt(i2);
979 if (! (muTrk1->
flag()>0))
continue;
980 if (! (muTrk2->
flag()>0))
continue;
984 lPair =
new((*sPairs)[nSPairs++])
StPeCPair(muTrk1,muTrk2,0,event) ;
987 cout <<
"StPeCEvent : Primary Pair : "
988 <<
" sumQ = " << lPair->getSumCharge()
989 <<
" sumPt = " << lPair->getSumPt()
990 <<
" mInv = " << lPair->getMInv(pion)
991 <<
" opening angle = " << lPair->getOpeningAngle()
992 <<
" cos(theta*) = " << lPair->getCosThetaStar(pion) << endl;
997 LOG_INFO <<
"Exiting StPeCEvent::fill(StEvent *event, StMuDst *mudst) acceptEvent " << countAccVtx<<endm;
1000 vector[0] = countAccVtx;
1001 vector[1] = countVtxWithTOF;
1002 vector[2] = countRejectVtxWithTOF;
1004 vector[4] = saveNumTracks;
1005 vector[5] = saveRejectedVtxZ;
1006 vector[6] = saveAccepteVtxZ;
1009 matchTOFhitsToTracks(mudst);
1019 StPeCPair* StPeCEvent::getPriPair ( Int_t i ) {
1020 if ( i < 0 || i >= nPPairs )
return 0 ;
1021 TClonesArray &pairs = *pPairs;
1025 StPeCPair* StPeCEvent::getSecPair ( Int_t i ) {
1026 if ( i < 0 || i >= nSPairs )
return 0 ;
1027 TClonesArray &pairs = *sPairs;
1031 void StPeCEvent::reset() {
1043 Long_t StPeCEvent::eventNumber()
const{
return eventN; }
1044 Long_t StPeCEvent::runNumber()
const{
return runN; }
1045 Int_t StPeCEvent::getNTot()
const{
return nTot; }
1046 Int_t StPeCEvent::getNPrim()
const{
return nPrim; }
1047 Int_t StPeCEvent::getQTot()
const{
return qTot; }
1048 Float_t StPeCEvent::getPt()
const{
return pt; }
1049 Float_t StPeCEvent::getXVertex()
const{
return xVertex; }
1050 Float_t StPeCEvent::getYVertex()
const{
return yVertex; }
1051 Float_t StPeCEvent::getZVertex()
const{
return zVertex; }
1058 mptcle = pion_plus_mass_c2;
1061 mptcle = 493.677*MeV;
1064 mptcle = proton_mass_c2;
1067 mptcle = electron_mass_c2;
1070 mptcle = 105.6584*MeV;
1074 StSPtrVecTrackNode& exnode = eventP->trackNodes();
1076 printf (
"StPeCEvent::getEvent4Momentum eventP null \n" ) ;
1079 Int_t nnode=exnode.size();
1081 for( Int_t in=0; in<nnode; in++ ) {
1082 if( exnode[in]->entries(global) != 1 ) continue ;
1083 StTrack* trk = exnode[in]->track(primary);
1085 Float_t energy = p.massHypothesis(mptcle);
1087 p4event = p4event + pfour;
1094 Float_t StPeCEvent::mInv(StPeCSpecies pid)
const{
1101 Float_t StPeCEvent::yRap(StPeCSpecies pid)
const{
1106 return p4event.rapidity();
1109 void StPeCEvent::matchTOFhitsToTracks(
StMuDst *mudst) {
1111 TObjArray* priTracks = 0;
1112 TObjArray* gloTracks = 0;
1115 Int_t snapLimit = 0;
1118 if (gROOT->IsBatch())
return;
1120 event = mudst->
event();
1122 eventN =
event->eventInfo().id();
1124 runN =
event->eventInfo().runId();
1125 LOG_INFO <<
"-------------- got into matchTOFhitsToTracks number of shots "<<shotCount<< endm;
1126 TDirectory * saveDir = gDirectory;
1134 int nMax = mudst->numberOfBTofHit();
1135 if(shotCount<snapLimit && snapLimit >0) {
1140 cSnap =
new TCanvas(
"cSnap",
"Snapshot", 600, 600);
1141 cSnap3D =
new TCanvas(
"cSnap3D",
"Snapshot3D", 600, 600);
1144 gDirectory->cd(
"test1.tree.root:/snapShots/");
1145 LOG_INFO <<
"StPeCEvent::matchTOFhitsToTracks after directory: " << endm;
1148 TH2F * hist = (TH2F*)gDirectory->FindObject(Form(
"snapShot%d",shotCount));
1149 if(!hist)LOG_INFO <<
"FindObject failed " << endm;
1150 LOG_INFO <<
"StPeCEvent::matchTOFhitsToTracks name of hist: " << hist->GetName()<<endm;
1155 hist->SetTitle(Form(
"Run: %d Event number %d Main: %d topo: %d #tof: %d",runN, eventN, ttid.isTrigger(400631), ttid.isTrigger(1), nMax));
1156 cSnap->SetName(Form(
"snapShot%d",shotCount));
1157 cSnap3D->SetName(Form(
"snapShot%d_3D",shotCount));
1171 int globalTrackCounter = 0;
1175 size_t Nvert = mudst->numberOfPrimaryVertices();
1177 gFile->cd(
"test1.tree.root:/snapShots");
1180 TH1F * histV = (TH1F*)gDirectory->FindObject(
"hNumVtx");
1183 LOG_INFO <<
"StPeCEvent::matchTOFhitsToTracks #vertices: " <<Nvert<< endm;
1184 if(shotCount<snapLimit){
1186 Double_t xyz[3]={0.,0.,0.};
1187 Double_t v[3]={0.,0.,0.};
1188 Double_t angularFreq = 0.;
1189 Double_t range[2] = {0., 0.3};
1191 for (
size_t verti = 0;verti<Nvert;++verti){
1192 LOG_INFO <<
"StPeCEvent:: vertex Index: "<<verti<<endm;
1196 for (
size_t trackiter = 0;trackiter<Ntracks;trackiter++){
1199 LOG_INFO <<
"track start-point x : " <<track->
firstPoint().x()<<
" start point y "<< track->
firstPoint().y()<<
" start point z "<< track->
firstPoint().z()<<endm;
1200 LOG_INFO <<
"track charge : " <<track->
charge()<<
" mag field "<<
event->eventSummary().magneticField()<<endm;
1201 LOG_INFO <<
"track momentum x : " <<track->
momentum().x()<<
" p y "<< track->
momentum().y()<<
" p z "<< track->
momentum().z()<<endm;
1202 if(shotCount<snapLimit) {
1204 straightTrack->SetLineColor(verti+1);
1220 angularFreq = track->
charge()*
event->eventSummary().magneticField();
1221 THelix * myHelix =
new THelix(&xyz[0],&v[0],angularFreq, &range[0],kHelixZ);
1222 gPad->SetFillColor(37);
1232 Float_t radTOF = 0.06;
1234 TPolyMarker3D *pm =
new TPolyMarker3D(360, 20);
1235 pm->SetMarkerSize(0.001);
1236 for(
int deg=0;deg<360;deg++){
1237 pm->SetPoint(deg, radTOF*TMath::Cos(deg),radTOF*TMath::Sin(deg),0.);
1241 TPolyMarker3D *pmTOF =
new TPolyMarker3D(60, 20);
1242 pmTOF->SetMarkerSize(0.004);
1243 pmTOF->SetMarkerColor(kBlue);
1245 for(
int i=0;i<nMax;i++) {
1250 int trayId = aHit->tray();
1251 if(trayId<=120&&trayId>=0) {
1252 LOG_INFO <<
"StPeCEvent::matchTOFhitsToTracks tray id: "<<trayId<<
" index i "<<i<<endm;
1254 angleHit = (72-trayId*6)*(3.14/180.);
1257 angleHit = (108+trayId*6)*(3.14/180.);
1259 LOG_INFO <<
"StPeCEvent::matchTOFhitsToTracks angle: "<<angleHit<<endm;
1260 pmTOF->SetPoint(i, radTOF*TMath::Cos(angleHit),radTOF*TMath::Sin(angleHit),0.);
1267 if(shotCount<snapLimit){
1268 gPad->GetViewer3D(
"ogl");
1275 for (
size_t verti = 0;verti<Nvert;++verti){
1280 for (
size_t trackiter = 0;trackiter<Ntracks;trackiter++){
1283 if(shotCount<snapLimit) {
1285 straightTrack->SetLineColor(verti+1);
1286 straightTrack->Draw(
"same");
1290 for(
int i=0;i<nMax;i++) {
1294 int trayId = aHit->tray();
1295 if(trayId<=120&&trayId>=0) {
1296 StMuTrack *TofGlobalTrack = aHit->globalTrack();
1297 if(!TofGlobalTrack)
continue;
1301 int tofHitTrkId = TofGlobalTrack->
id();
1302 if(track->
id()==tofHitTrkId) {
1303 LOG_INFO <<
"StPeCEvent::match GOT MATCH: "<<track->
id()<<
" vertex index: "<<track->
vertexIndex()<<endm;
1304 if(shotCount<snapLimit) {
1306 straightTof->SetLineWidth(3.3);
1307 straightTof->Draw(
"same");
1312 globalTrackCounter++;
1325 LOG_INFO <<
"StPeCEvent::matchTOFhitsToTracks #Global tracks : " <<Gtracks<< endm;
1326 for (
size_t Gtrackiter = 0;Gtrackiter<Gtracks;Gtrackiter++){
1329 if(shotCount<snapLimit) {
1331 straightTrack->SetLineColor(2);
1336 gDirectory = saveDir;
1337 if(shotCount<snapLimit) {
1338 cSnap->SaveAs(Form(
"snapShot%d.pdf",shotCount));
static StMuBTofHit * btofHit(int i)
returns pointer to the i-th muBTofHit
static TObjArray * globalTracks()
returns pointer to the global tracks list
Int_t vertexIndex() const
Returns index of associated primary vertex.
Int_t index2Global() const
Returns index of associated global track. If not in order can be set with StMuDst::fixTrackIndeces() ...
short id() const
Returns the track id(or key), is unique for a track node, i.e. global and primary tracks have the sam...
short flag() const
Returns flag, (see StEvent manual for type information)
Short_t charge() const
Returns charge.
Double_t eta() const
Returns pseudo rapidity at point of dca to primary vertex.
const StThreeVectorF & firstPoint() const
Returns positions of first measured point.
static TObjArray * primaryTracks()
returns pointer to a list of tracks belonging to the selected primary vertex
static StMuEmcCollection * muEmcCollection()
returns pointer to current StMuEmcCollection
static StMuEvent * event()
returns pointer to current StMuEvent (class holding the event wise information, e.g. event number, run number)
const StThreeVectorF & momentum() const
Returns 3-momentum at dca to primary vertex.
const StThreeVectorF & lastPoint() const
Returns positions of last measured point.
#include "StEventTypes.h"
static void setVertexIndex(Int_t vtx_id)
Set the index number of the current primary vertex (used by both primaryTracks() functions and for St...
Collection of trigger ids as stored in MuDst.