10 #include "StThreeVectorF.hh"
11 #include "StThreeVectorD.hh"
12 #include "StEventTypes.h"
13 #include "StMcEventTypes.hh"
14 #include "StAssociationMaker/StAssociationMaker.h"
15 #include "StAssociationMaker/StTrackPairInfo.hh"
16 #include "StEventMaker/StEventMaker.h"
17 #include "StTofUtil/StTofGeometry.h"
18 #include "StTofUtil/tofPathLength.hh"
19 #include "StMessMgr.h"
20 #include "StTofpMcAnalysisMaker.h"
24 const Int_t StTofpMcAnalysisMaker::mPtBin = 50;
25 const Int_t StTofpMcAnalysisMaker::mYBin = 14;
26 const Float_t StTofpMcAnalysisMaker::mPtMin = 0.;
27 const Float_t StTofpMcAnalysisMaker::mPtMax = 5.;
28 const Float_t StTofpMcAnalysisMaker::mYMin = -1.2;
29 const Float_t StTofpMcAnalysisMaker::mYMax = 0.2;
35 mcTrackMapIter i = map->find(mT);
37 if (i != map->end()) rT = (*i).second->partnerTrack();
44 StTofpMcAnalysisMaker::StTofpMcAnalysisMaker(
const char *name,
const char *title):
StMaker(name,title)
48 mOuterTrackGeometry =
true;
93 hTofpSlatHitVecSize = 0;
97 StTofpMcAnalysisMaker::~StTofpMcAnalysisMaker()
100 if (Debug()) LOG_INFO <<
"Inside StTofpMcAnalysisMaker Destructor" << endm;
105 void StTofpMcAnalysisMaker::Clear(
const char*)
118 Int_t StTofpMcAnalysisMaker::Init()
122 hMomResPtPion =
new TH2F(
"momResMomTPion",
"(|pmc| - |p|)/|pmc| as a Function of Pt Pion",mPtBin,mPtMin,mPtMax,200,-1.,1.);
126 hMultRef =
new TH1F(
"multRef",
"Mult Ref",100,0.,1000.);
127 hMultRef->SetXTitle(
"uncorrected negative primary tracks");
130 hMcElectron =
new TH2F(
"mcElectron",
"Mc Electron",mPtBin,mPtMin,mPtMax,mYBin,mYMin,mYMax);
134 hRcElectron =
new TH2F(
"rcElectron",
"RcElectron",mPtBin,mPtMin,mPtMax,mYBin,mYMin,mYMax);
138 hMatchElectron =
new TH2F(
"mElectron",
"TOF matched electron",mPtBin,mPtMin,mPtMax,mYBin,mYMin,mYMax);
144 hMcPionPlus =
new TH2F(
"mcPionPlus",
"Mc Pion Plus",mPtBin,mPtMin,mPtMax,mYBin,mYMin,mYMax);
145 hMcPionPlus->SetXTitle(
"p_{T} (GeV/c)");
146 hMcPionPlus->SetYTitle(
"pseudorapidity");
147 hMcPionPlus->Sumw2();
148 hRcPionPlus =
new TH2F(
"rcPionPlus",
"Rc Pion Plus",mPtBin,mPtMin,mPtMax,mYBin,mYMin,mYMax);
152 hMatchPionPlus =
new TH2F(
"mPionPlus",
"TOF matched pi+",mPtBin,mPtMin,mPtMax,mYBin,mYMin,mYMax);
158 hMcPionMin =
new TH2F(
"mcPionMin",
"Mc Pion Min",mPtBin,mPtMin,mPtMax,mYBin,mYMin,mYMax);
162 hRcPionMin =
new TH2F(
"rcPionMin",
"Rc Pion Min",mPtBin,mPtMin,mPtMax,mYBin,mYMin,mYMax);
166 hMatchPionMin =
new TH2F(
"mPionMin",
"TOF matched pi-",mPtBin,mPtMin,mPtMax,mYBin,mYMin,mYMax);
172 hMcKaonPlus =
new TH2F(
"mcKaonPlus",
"Mc Kaon Plus",mPtBin,mPtMin,mPtMax,mYBin,mYMin,mYMax);
176 hRcKaonPlus =
new TH2F(
"rcKaonPlus",
"Rc Kaon Plus",mPtBin,mPtMin,mPtMax,mYBin,mYMin,mYMax);
180 hMatchKaonPlus =
new TH2F(
"mKaonPlus",
"TOF matched K+",mPtBin,mPtMin,mPtMax,mYBin,mYMin,mYMax);
186 hMcKaonMin =
new TH2F(
"mcKaonMin",
"Mc Kaon Min",mPtBin,mPtMin,mPtMax,mYBin,mYMin,mYMax);
190 hRcKaonMin =
new TH2F(
"rcKaonMin",
"Rc Kaon Min",mPtBin,mPtMin,mPtMax,mYBin,mYMin,mYMax);
194 hMatchKaonMin =
new TH2F(
"mKaonMin",
"TOF matched K-",mPtBin,mPtMin,mPtMax,mYBin,mYMin,mYMax);
200 hMcProton =
new TH2F(
"mcProton",
"Mc Proton",mPtBin,mPtMin,mPtMax,mYBin,mYMin,mYMax);
204 hRcProton =
new TH2F(
"rcProton",
"RcProton",mPtBin,mPtMin,mPtMax,mYBin,mYMin,mYMax);
208 hMatchProton =
new TH2F(
"mProton",
"TOF matched proton",mPtBin,mPtMin,mPtMax,mYBin,mYMin,mYMax);
214 hMcAntiProton =
new TH2F(
"mcAntiProton",
"Mc Antiproton",mPtBin,mPtMin,mPtMax,mYBin,mYMin,mYMax);
218 hRcAntiProton =
new TH2F(
"rcAntiProton",
"Rc Antiproton",mPtBin,mPtMin,mPtMax,mYBin,mYMin,mYMax);
222 hMatchAntiProton =
new TH2F(
"mAntiProton",
"TOF matched pbar",mPtBin,mPtMin,mPtMax,mYBin,mYMin,mYMax);
228 hTofpSlatIdA0 =
new TH1D(
"SlatIdA0",
"events per slat",41,0.5,41.5);
229 hTofpSlatIdA1 =
new TH1D(
"SlatIdA1",
"valid slat",41,0.5,41.5);
230 hTofpSlatIdB1 =
new TH1D(
"SlatIdB1",
"#tracks match valid slat",41,0.5,41.5);
231 hTofpSlatIdD1 =
new TH1D(
"SlatIdD1",
"track match per valid slat",41,0.5,41.5);
232 hTofpSlatIdD2 =
new TH1D(
"SlatIdD2",
"single track match per slat",41,0.5,41.5);
233 hTofpSlatIdE1 =
new TH1D(
"SlatIdE1",
"one slat for one track match",41,0.5,41.5);
234 hTofpSlatIdE2 =
new TH1D(
"SlatIdE2",
"recovered from hitprof-weight",41,0.5,41.5);
235 hTofpSlatIdE3 =
new TH1D(
"SlatIdE3",
"recovered from ss",41,0.5,41.5);
236 hTofpSlatIdE4 =
new TH1D(
"SlatIdE4",
"recovered from closest hitplane",41,0.5,41.5);
237 hTofpSlatIdE5 =
new TH1D(
"SlatIdE5",
"total recovered slat per track match",41,0.5,41.5);
238 hTofpSlatIdF1 =
new TH1D(
"SlatIdF1",
"primary track match per slat",41,0.5,41.5);
240 hTofpHitMap1 =
new TH2D(
"tofpHitMap1",
"valid hit positions", 500,-250,0, 120,-1.23, -1.08);
241 hTofpHitMap2 =
new TH2D(
"tofpHitMap2",
"valid hit positions", 500,-250,0, 120,-1.23, -1.08);
242 hTofpHitMap3 =
new TH2D(
"tofpHitMap3",
"valid hit positions", 500,-250,0, 120,-1.23, -1.08);
243 hTofpHitMap4 =
new TH2D(
"tofpHitMap4",
"valid hit positions", 500,-250,0, 120,-1.23, -1.08);
245 return StMaker::Init();
249 Int_t StTofpMcAnalysisMaker::InitRun(
int runnumber){
250 gMessMgr->Info(
"StTofpMcAnalysisMaker -- reinitializing TofGeometry",
"OS");
256 Int_t StTofpMcAnalysisMaker::FinishRun(
int runnumber){
257 gMessMgr->Info(
"StTofpMcAnalysisMaker -- cleaning up geometry",
"OS" );
271 rEvent = (
StEvent*) GetInputDS(
"StEvent");
281 rcTpcHitMapType* theHitMap = 0;
283 rcTrackMapType* theTrackMap = 0;
284 theTrackMap = assoc->rcTrackMap();
285 mcV0MapType* theMcV0Map = 0;
286 theMcV0Map = assoc->mcV0Map();
289 gMessMgr->Warning() <<
"----------WARNING----------\n"
290 <<
"No Hit Map found for this event!" << endm;
294 mcTrackMapType* mcTrackMap = 0;
295 mcTrackMap = assoc->mcTrackMap();
297 LOG_INFO <<
"No mcTrackMap!!! " << endm;
309 if (rEvent->primaryVertex()) {
310 VertexPos = rEvent->primaryVertex()->position();
311 LOG_INFO <<
"Position of Primary Vertex from StEvent:" << endm;
312 LOG_INFO << VertexPos << endm;
315 LOG_INFO <<
"----------- WARNING ------------" << endm;
316 LOG_INFO <<
"No primary vertex from StEvent!!" << endm;
317 LOG_INFO <<
"Assume it is at (0,0,0) " << endm;
319 LOG_INFO <<
"Position of Primary Vertex from StMcEvent:" << endm;
320 LOG_INFO << mEvent->primaryVertex()->position() << endm;
323 gMessMgr->Warning() <<
"----------WARNING----------\n"
324 <<
"No Track Map found for this event!" << endm;
341 idVector validSlatIdVec;
342 for (
int i=0;i<NTOFP;i++){
343 unsigned short slatId =
mTofGeom->daqToSlatId(i);
346 validSlatIdVec.push_back(slatId);
349 gMessMgr->Info(
"",
"OST") <<
"A: #valid slats: " << validSlatIdVec.size() << endm;
356 tofSlatHitVector allSlatsHitVec;
357 allSlatsHitVec.clear();
358 StSPtrVecTrackNode& nodes =
event->trackNodes();
360 for (
unsigned int iNode=0; iNode<nodes.size(); iNode++){
361 tofSlatHitVector slatHitVec;
363 StTrack *theTrack = nodes[iNode]->track(global);
366 if (validTrack(theTrack)){
372 for (
size_t ii = 0; ii < slatHitVec.size(); ii++) {
373 slatHitVec[ii].trackIdVec.push_back(iNode);
374 allSlatsHitVec.push_back(slatHitVec[ii]);
376 int id =
mTofGeom->slatIdToDaq(slatHitVec[ii].slatIndex);
377 float xhit = slatHitVec[ii].hitPosition.x();
378 float yhit = slatHitVec[ii].hitPosition.y();
379 float zhit = slatHitVec[ii].hitPosition.z();
380 float phihit = atan2(yhit,xhit);
386 LOG_INFO <<
"B: trackid=";
387 idVectorIter ij = slatHitVec[ii].trackIdVec.begin();
388 while (ij != slatHitVec[ii].trackIdVec.end()) {LOG_INFO <<
" " << *ij; ij++;}
389 LOG_INFO <<
"\tind=" <<
mTofGeom->slatIdToDaq(slatHitVec[ii].slatIndex)
390 <<
"\thitprof="<< slatHitVec[ii].hitProfile
391 <<
"\ts="<<slatHitVec[ii].s <<
"\tthxy="<<slatHitVec[ii].theta_xy
392 <<
"\tthzr="<<slatHitVec[ii].theta_zr;
393 if (slatHitVec.size()>1) LOG_INFO <<
" M" << endm;
394 else LOG_INFO << endm;
400 gMessMgr->Info(
"",
"OST") <<
"B: #matched/#avail/#total tracknodes: "
401 <<allSlatsHitVec.size() <<
"/" <<nAllTracks
402 <<
"/" << nodes.size() << endm;
416 int nSingleHitSlats(0);
417 tofSlatHitVector singleHitSlatsVec;
420 tofSlatHitVector tempVec = allSlatsHitVec;
421 tofSlatHitVector erasedVec = tempVec;
422 while (tempVec.size() != 0) {
424 vector<StThreeVectorD> vPosition;
425 vector<vector<StThreeVectorD> > vLayerHitPositions;
426 vector<Int_t> vHitProfile;
427 vector<Float_t> vS, vTheta_xy, vTheta_zr;
430 tofSlatHitVectorIter tempIter=tempVec.begin();
431 tofSlatHitVectorIter erasedIter=erasedVec.begin();
432 while(erasedIter!= erasedVec.end()) {
433 if(tempIter->slatIndex == erasedIter->slatIndex) {
436 trackIdVec.push_back(erasedIter->trackIdVec.back());
437 vPosition.push_back(erasedIter->hitPosition);
438 vLayerHitPositions.push_back(erasedIter->layerHitPositions);
439 vHitProfile.push_back(erasedIter->hitProfile);
440 vS.push_back(erasedIter->s);
441 vTheta_xy.push_back(erasedIter->theta_xy);
442 vTheta_zr.push_back(erasedIter->theta_zr);
445 float xhit = erasedIter->hitPosition.x();
446 float yhit = erasedIter->hitPosition.y();
447 float zhit = erasedIter->hitPosition.z();
448 float phihit = atan2(yhit,xhit);
452 erasedVec.erase(erasedIter);
459 int daqId =
mTofGeom->slatIdToDaq(tempIter->slatIndex);
466 slatHit.slatIndex = tempIter->slatIndex;
467 slatHit.hitPosition = vPosition[0];
468 slatHit.layerHitPositions = vLayerHitPositions[0];
469 slatHit.trackIdVec = trackIdVec;
470 slatHit.hitProfile = vHitProfile[0];
472 slatHit.theta_xy = vTheta_xy[0];
473 slatHit.theta_zr = vTheta_zr[0];
475 singleHitSlatsVec.push_back(slatHit);
478 int daqId =
mTofGeom->slatIdToDaq(tempIter->slatIndex);
479 float xhit = slatHit.hitPosition.x();
480 float yhit = slatHit.hitPosition.y();
481 float zhit = slatHit.hitPosition.z();
482 float phihit = atan2(yhit,xhit);
489 LOG_INFO <<
"D: ind=" <<
mTofGeom->slatIdToDaq(slatHit.slatIndex)
490 <<
"\thitprof="<< slatHit.hitProfile <<
"\ts="<<slatHit.s
491 <<
"\tthxy="<<slatHit.theta_xy <<
"\tthzr="<<slatHit.theta_zr <<
"\ttrackid:";
492 idVectorIter ij=trackIdVec.begin();
493 while (ij != trackIdVec.end()) { LOG_INFO <<
" " << *ij; ij++; }
501 gMessMgr->Warning(
"",
"OST") <<
"D: no tracks extrapolate to matched slat ... should not happen!" << endm;
505 gMessMgr->Info(
"",
"OST") <<
"D: #before/#after: " << allSlatsHitVec.size()
506 <<
"/" << singleHitSlatsVec.size() << endm;
514 tofSlatHitVector allMatchedSlatsVec;
515 tempVec = singleHitSlatsVec;
517 while (tempVec.size() != 0) {
520 vector<StThreeVectorD> vPosition;
521 vector< vector<StThreeVectorD> > vLayerHitPositions;
522 vector<Int_t> vHitProfile;
523 vector<Float_t> vS, vTheta_xy, vTheta_zr;
525 vector<Int_t> slatIndex;
527 tofSlatHitVectorIter tempIter=tempVec.begin();
528 tofSlatHitVectorIter erasedIter=erasedVec.begin();
529 while(erasedIter!= erasedVec.end()) {
530 if(tempIter->trackIdVec.back() == erasedIter->trackIdVec.back()) {
533 slatIndex.push_back(erasedIter->slatIndex);
534 vTrackId.push_back(erasedIter->trackIdVec.back());
535 vPosition.push_back(erasedIter->hitPosition);
536 vLayerHitPositions.push_back(erasedIter->layerHitPositions);
537 vHitProfile.push_back(erasedIter->hitProfile);
538 vS.push_back(erasedIter->s);
539 vTheta_xy.push_back(erasedIter->theta_xy);
540 vTheta_zr.push_back(erasedIter->theta_zr);
542 erasedVec.erase(erasedIter);
551 slatHit.slatIndex = slatIndex[0];
552 slatHit.hitPosition = vPosition[0];
553 slatHit.layerHitPositions = vLayerHitPositions[0];
554 slatHit.trackIdVec.push_back(vTrackId[0]);
555 slatHit.hitProfile = vHitProfile[0];
557 slatHit.theta_xy = vTheta_xy[0];
558 slatHit.theta_zr = vTheta_zr[0];
559 slatHit.matchFlag = 0;
561 allMatchedSlatsVec.push_back(slatHit);
564 int daqId =
mTofGeom->slatIdToDaq(slatIndex[0]);
570 LOG_INFO <<
"E: ind=" <<
mTofGeom->slatIdToDaq(slatHit.slatIndex)
571 <<
"\thitprof="<< slatHit.hitProfile <<
"\ts="<<slatHit.s
572 <<
"\tthxy="<<slatHit.theta_xy <<
"\tthzr="<<slatHit.theta_zr <<
"\ttrackid:";
573 idVectorIter ij=vTrackId.begin();
574 while (ij != vTrackId.end()) { LOG_INFO <<
" " << *ij; ij++; }
579 int thiscandidate(-99);
580 int thisMatchFlag(0);
584 vector<int> weightCandidates;
586 if (Debug()) LOG_INFO <<
"E: find ... weight ";
587 for (
int i=0;i<nSlats;i++){
588 int hitWeight = vLayerHitPositions[i].size();
589 if (Debug()) LOG_INFO <<
mTofGeom->slatIdToDaq(slatIndex[i]) <<
"("<<hitWeight<<
")"<<
" ";
590 if (hitWeight>weight) {
592 weightCandidates.clear();
593 weightCandidates.push_back(i);
594 }
else if (hitWeight == weight)
595 weightCandidates.push_back(i);
597 if (weightCandidates.size()==1){
598 thiscandidate = weightCandidates[0];
599 int daqId =
mTofGeom->slatIdToDaq(slatIndex[thiscandidate]);
601 if (Debug()) LOG_INFO <<
"candidate =" << daqId << endm;
605 if (weightCandidates.size()>1){
607 vector<int> ssCandidates;
609 if (Debug()) LOG_INFO <<
" ss ";
610 for (
unsigned int i=0;i<weightCandidates.size();i++){
611 int ii=weightCandidates[i];
612 if (Debug()) LOG_INFO <<
mTofGeom->slatIdToDaq(slatIndex[ii]) <<
" ";
615 ssCandidates.clear();
616 ssCandidates.push_back(ii);
617 }
else if (vS[ii]==ss)
618 ssCandidates.push_back(ii);
620 if (ssCandidates.size()==1){
621 thiscandidate = ssCandidates[0];
622 int daqId =
mTofGeom->slatIdToDaq(slatIndex[thiscandidate]);
624 if (Debug()) LOG_INFO <<
"candidate =" << daqId << endm;
628 if (ssCandidates.size()>1){
630 vector<int> profileCandidates;
632 if (Debug()) LOG_INFO <<
" hprof ";
633 for (
unsigned int i=0;i<ssCandidates.size();i++){
634 int ii=ssCandidates[i];
635 if (Debug()) LOG_INFO <<
mTofGeom->slatIdToDaq(slatIndex[ii]) <<
" ";
636 if (vHitProfile[ii]>hitprof){
637 hitprof = vHitProfile[ii];
638 profileCandidates.clear();
639 profileCandidates.push_back(ii);
640 }
else if (vHitProfile[ii]==hitprof)
641 profileCandidates.push_back(ii);
643 if (profileCandidates.size()==1){
644 thiscandidate = profileCandidates[0];
645 int daqId =
mTofGeom->slatIdToDaq(slatIndex[thiscandidate]);
647 if (Debug()) LOG_INFO <<
"candidate =" << daqId << endm;
650 if (Debug()) LOG_INFO <<
"none" << endm;
655 if (thiscandidate == -99 && Debug()){
656 LOG_INFO <<
"E: ind=";
657 for (
unsigned int ii=0;ii<slatIndex.size();ii++)
658 LOG_INFO <<
mTofGeom->slatIdToDaq(slatIndex[ii]) <<
" ";
659 LOG_INFO <<
"\ttrkid:" << vTrackId[0] <<
" Unable to decide. ";
660 LOG_INFO <<
"(hitprofs:";
661 for (
unsigned int ii=0;ii<slatIndex.size();ii++)
662 LOG_INFO << vHitProfile[ii] <<
" ";
664 for (
unsigned int ii=0;ii<slatIndex.size();ii++)
665 LOG_INFO << vS[ii] <<
" ";
666 LOG_INFO <<
")" << endm;
672 if (thiscandidate>=0){
673 slatHit.slatIndex = slatIndex[thiscandidate];
674 slatHit.hitPosition = vPosition[thiscandidate];
675 slatHit.layerHitPositions = vLayerHitPositions[thiscandidate];
677 slatHit.trackIdVec.push_back(vTrackId[thiscandidate]);
678 slatHit.hitProfile = vHitProfile[thiscandidate];
679 slatHit.s = vS[thiscandidate];
680 slatHit.theta_xy = vTheta_xy[thiscandidate];
681 slatHit.theta_zr = vTheta_zr[thiscandidate];
682 slatHit.matchFlag = thisMatchFlag;
684 allMatchedSlatsVec.push_back(slatHit);
687 int daqId =
mTofGeom->slatIdToDaq(slatIndex[thiscandidate]);
693 LOG_INFO <<
"E: ind=" <<
mTofGeom->slatIdToDaq(slatHit.slatIndex)
694 <<
"\thitprof="<< slatHit.hitProfile <<
"\ts="<<slatHit.s
695 <<
"\tthxy="<<slatHit.theta_xy <<
"\tthzr="<<slatHit.theta_zr <<
"\ttrackid:"
696 << vTrackId[thiscandidate] << endm;
700 gMessMgr->Warning(
"",
"OS") <<
"E: no slats belong to this track ... should not happen!" << endm;
704 gMessMgr->Info(
"",
"OST") <<
"E: #before/#after: " << singleHitSlatsVec.size()
705 <<
"/" << allMatchedSlatsVec.size() << endm;
720 int nValidSinglePrimHitSlats(0);
722 for (
size_t ii=0; ii < allMatchedSlatsVec.size(); ii++){
723 int daqId =
mTofGeom->slatIdToDaq(allMatchedSlatsVec[ii].slatIndex);
726 if (allMatchedSlatsVec[ii].trackIdVec.size()!=1)
727 gMessMgr->Warning(
"",
"OST") <<
"F: WHAT!?! mult.matched slat in single slat list " << daqId << endm;
733 unsigned int trackNode = allMatchedSlatsVec[ii].trackIdVec[0];
734 StTrack *theTrack = nodes[trackNode]->track(primary);
737 if (validTofTrack(theTrack)){
738 nValidSinglePrimHitSlats++;
740 float xhit = allMatchedSlatsVec[ii].hitPosition.x();
741 float yhit = allMatchedSlatsVec[ii].hitPosition.y();
742 float zhit = allMatchedSlatsVec[ii].hitPosition.z();
743 float phihit = atan2(yhit,xhit);
749 int nHitsPerTrack = theTrack->topologyMap().numberOfHits(kTpcId);
760 double pathLength = tofPathLength(&event->primaryVertex()->position(),
761 &allMatchedSlatsVec[ii].hitPosition,
762 theTrackGeometry->helix().curvature());
769 pInnerLayer = &(*(allMatchedSlatsVec[ii].layerHitPositions.begin()));
770 pOuterLayer = &(*(allMatchedSlatsVec[ii].layerHitPositions.end() - 1));
773 float dedx(0.), cherang(0);
774 int dedx_np(0), cherang_nph(0);
776 StSPtrVecTrackPidTraits& traits = theTrack->pidTraits();
777 for (
unsigned int it=0;it<traits.size();it++){
778 if (traits[it]->detector() == kTpcId){
780 if (pid && pid->method() ==kTruncatedMeanId){
782 dedx_np = pid->numberOfPoints();
784 }
else if (traits[it]->detector() == kRichId){
788 if (pidinfo && pidinfo->getCherenkovPhotons()>2){
789 cherang = pidinfo->getCherenkovAngle();
790 cherang_nph = pidinfo->getCherenkovPhotons();
810 LOG_INFO <<
"F: ind=" <<
mTofGeom->slatIdToDaq(allMatchedSlatsVec[ii].slatIndex)
812 idVectorIter ij=allMatchedSlatsVec[ii].trackIdVec.begin();
813 while (ij != allMatchedSlatsVec[ii].trackIdVec.end()) { LOG_INFO <<
" " << *ij; ij++; }
814 LOG_INFO <<
"\tR=" << 1/(theTrackGeometry->helix().curvature())
815 <<
"\tpT=" << momentum.perp() <<
"\tp=" << momentum.mag()
816 <<
"\thits="<< nHitsPerTrack <<
"\ts="<< pathLength
817 <<
"\t#fitp=" <<theTrack->fitTraits().numberOfFitPoints(kTpcId)
818 <<
"\t#trkp=" <<theTrack->detectorInfo()->numberOfPoints(kTpcId)
819 <<
" \tdedx=" << dedx
820 <<
" \tdca="<< theTrack->geometry()->helix().
distance(event->primaryVertex()->position());
821 if (cherang!=0) LOG_INFO <<
" \trich="<< cherang <<
" (" << cherang_nph <<
")";
840 const StSPtrVecMcTrack& mcTracks = mEvent->primaryVertex()->daughters();
841 if (Debug()) LOG_INFO <<
"mcTrack Loop: "<< mcTracks.size() <<
" entries" << endm;
845 int nRecon(0), nMatch(0);
848 for (StMcTrackConstIterator mcItr = mcTracks.begin(); mcItr != mcTracks.end(); mcItr++) {
851 gMessMgr->Warning() <<
"No McTrack?!? Should not happen!"<<endm;
858 if (mcTrack->particleDefinition()->pdgEncoding()== 11)
hMcElectron->Fill(mcP.perp(),mcP.pseudoRapidity());
859 else if (mcTrack->particleDefinition()->pdgEncoding()== 211) hMcPionPlus->Fill(mcP.perp(),mcP.pseudoRapidity());
860 else if (mcTrack->particleDefinition()->pdgEncoding()==-211)
hMcPionMin->Fill(mcP.perp(),mcP.pseudoRapidity());
861 else if (mcTrack->particleDefinition()->pdgEncoding()== 321)
hMcKaonPlus->Fill(mcP.perp(),mcP.pseudoRapidity());
862 else if (mcTrack->particleDefinition()->pdgEncoding()==-321)
hMcKaonMin->Fill(mcP.perp(),mcP.pseudoRapidity());
863 else if (mcTrack->particleDefinition()->pdgEncoding()== 2212)
hMcProton->Fill(mcP.perp(),mcP.pseudoRapidity());
864 else if (mcTrack->particleDefinition()->pdgEncoding()==-2212)
hMcAntiProton->Fill(mcP.perp(),mcP.pseudoRapidity());
865 else LOG_INFO <<
"mcTracks has wrong pdgEncoding: "<< mcTrack->particleDefinition()->pdgEncoding() << endm;
868 rcTrack = partnerTrack(mcTrackMap,mcTrack);
869 if (!rcTrack)
continue;
870 if (rcTrack->flag()<0)
continue;
873 rcTrack = rcTrack->node()->track(primary);
874 if (!rcTrack)
continue;
884 if (mcTrack->particleDefinition()->pdgEncoding()== 11)
hRcElectron->Fill(rcP.perp(),rcP.pseudoRapidity());
885 else if (mcTrack->particleDefinition()->pdgEncoding()== 211)
hRcPionPlus->Fill(rcP.perp(),rcP.pseudoRapidity());
886 else if (mcTrack->particleDefinition()->pdgEncoding()== -211)
hRcPionMin->Fill(rcP.perp(),rcP.pseudoRapidity());
887 else if (mcTrack->particleDefinition()->pdgEncoding()== 321)
hRcKaonPlus->Fill(rcP.perp(),rcP.pseudoRapidity());
888 else if (mcTrack->particleDefinition()->pdgEncoding()== -321)
hRcKaonMin->Fill(rcP.perp(),rcP.pseudoRapidity());
889 else if (mcTrack->particleDefinition()->pdgEncoding()== 2212)
hRcProton->Fill(rcP.perp(),rcP.pseudoRapidity());
890 else if (mcTrack->particleDefinition()->pdgEncoding()==-2212)
hRcAntiProton->Fill(rcP.perp(),rcP.pseudoRapidity());
891 else LOG_INFO <<
"cannot fill rc histo" << endm;
892 float diff = (mcP.mag()-rcP.mag()) / mcP.mag();
893 if (mcTrack->particleDefinition()->pdgEncoding()==-211)
hMomResPtPion->Fill(mcP.perp(),diff);
901 if (Debug()) LOG_INFO <<
"RC/MC track Id="<< rcTrack->key() <<
"/" << mcTrack->key() << endm;
911 for (tofSlatHitVectorIter matchedSlat=allMatchedSlatsVec.begin();
912 matchedSlat != allMatchedSlatsVec.end(); matchedSlat++){
915 if (matchedSlat->trackIdVec.size()!=1){
916 gMessMgr->Warning() <<
"Slat with " << matchedSlat->trackIdVec.size()
917 <<
"track matches? Should not happen!" << endm;
922 unsigned int thisTrackId = matchedSlat->trackIdVec[0];
923 unsigned int thisKey = nodes[thisTrackId]->track(global)->key();
925 if (Debug()) LOG_INFO <<
" match trackKey (trackId): " << thisKey
926 <<
" (" << thisTrackId <<
")";
928 if (thisKey == rcTrack->key()){
929 if (Debug()) LOG_INFO <<
"RC-MC-TOFp match";
934 if (mcTrack->particleDefinition()->pdgEncoding()== 11)
hMatchElectron->Fill(rcP.perp(),rcP.pseudoRapidity());
935 else if (mcTrack->particleDefinition()->pdgEncoding()== 211)
hMatchPionPlus->Fill(rcP.perp(),rcP.pseudoRapidity());
936 else if (mcTrack->particleDefinition()->pdgEncoding()== -211)
hMatchPionMin->Fill(rcP.perp(),rcP.pseudoRapidity());
937 else if (mcTrack->particleDefinition()->pdgEncoding()== 321)
hMatchKaonPlus->Fill(rcP.perp(),rcP.pseudoRapidity());
938 else if (mcTrack->particleDefinition()->pdgEncoding()== -321)
hMatchKaonMin->Fill(rcP.perp(),rcP.pseudoRapidity());
939 else if (mcTrack->particleDefinition()->pdgEncoding()== 2212)
hMatchProton->Fill(rcP.perp(),rcP.pseudoRapidity());
940 else if (mcTrack->particleDefinition()->pdgEncoding()==-2212)
hMatchAntiProton->Fill(rcP.perp(),rcP.pseudoRapidity());
941 else LOG_INFO <<
"cannot fill match histo" << endm;
943 if (Debug()) LOG_INFO << endm;
995 gMessMgr->Info(
"",
"OST") <<
"Embedding: #mcTrack/#recon/#match: " << mcTracks.size()
996 <<
"/"<< nRecon <<
"/" << nMatch << endm;
1003 bool StTofpMcAnalysisMaker::validTrack(
StTrack *
track){
1005 if (!track)
return false;
1008 if (track->flag()<=0)
return false;
1011 if (track->topologyMap().numberOfHits(kTpcId) < mMinHitsPerTrack)
return false;
1019 bool StTofpMcAnalysisMaker::validTofTrack(
StTrack *track){
1023 if (!track)
return false;
1026 if (!dynamic_cast<StPrimaryTrack*>(track))
return false;
1029 double DCA= track->impactParameter();
1032 double mMaxDCA = 999.;
1033 if (DCA > mMaxDCA) {
1034 gMessMgr->Info(
"",
"OST") <<
"dca>max:" << DCA<< endm;
1044 if (!track)
return 0;
1046 if (mOuterTrackGeometry)
1047 thisTrackGeometry = track->outerGeometry();
1049 thisTrackGeometry = track->geometry();
1050 return thisTrackGeometry;
TH1D * hTofpSlatIdE4
recovered from ss
TH1D * hTofpSlatIdA0
2D tray hit positions (F)
TH1D * hTofpSlatIdB1
valid slat
TH2F * hRcElectron
TPC reconstructed pbar.
TH1F * hMultRef
MC/RC momentum resolution.
TH2F * hRcKaonMin
TPC reconstructed K+.
TH2F * hRcAntiProton
TPC reconstructed p+.
TH2F * hMatchKaonMin
TOF matched K+.
TH1D * hTofpSlatIdE2
one slat for one track match
TH1D * hTofpSlatIdE5
recovered from closest hitplane
StTofGeometry * mTofGeom
slat mult per StTrack
TH2D * hTofpHitMap4
2D tray hit positions (D)
TH1D * hTofpSlatIdA1
events per slat
TH2F * hMcKaonMin
montecarlo K+
TH2D * hTofpHitMap3
2D tray hit positions (pre-D)
virtual void Clear(Option_t *option="")
User defined functions.
TH2F * hMatchPionMin
TOF matched pi+.
TH1D * hTofpSlatHitVecSize
primary track match per slat
TH2F * hMcKaonPlus
montecarlo pi-
TH1D * hTofpSlatIdE1
single track match per slat
TH2F * hMcPionMin
montecarlo pi+
TH1D * hTofpSlatIdD1
#tracks match valid slat
TH2F * hMatchProton
TOF matched K-.
Monte Carlo Track class All information on a simulated track is stored in this class: kinematics...
double distance(const StThreeVector< double > &p, bool scanPeriods=true) const
minimal distance between point and helix
TH2F * hMatchPionPlus
TPC reconstructed e-.
tofSlatHitVector tofHelixToArray(const StPhysicalHelixD &helix, idVector slatIdVec)
finds slats in an array of trays which are crossed by a track-helix.
TH2F * hMatchKaonPlus
TOF matched pi-.
TH2F * hRcProton
TPC reconstructed K-.
TH2F * hMatchElectron
TOF matched pbar.
Time-of-Flight Geometry Utilities.
TH2F * hMcAntiProton
montecarlo p+
TH2D * hTofpHitMap1
multiplicity reference
TH1D * hTofpSlatIdE3
recovered from hitprof-weight
TH2F * hMomResPtPion
TOF matched e-.
TH2F * hRcPionPlus
montecarlo e-
TH2F * hRcPionMin
TPC reconstructed pi+.
TH2F * hMcElectron
montecarlo pbar
TH1D * hTofpSlatIdF1
total recovered slat per track match
TH1D * hTofpSlatIdD2
track match per valid slat
TH2F * hRcKaonPlus
TPC reconstructed pi-.
TH2F * hMatchAntiProton
TOF matched p+.
rcTpcHitMapType * rcTpcHitMap()
Diff btw global r and phi coords of FTPC hits.
Event data structure to hold all information from a Monte Carlo simulation. This class is the interfa...
TH2D * hTofpHitMap2
2D tray hit positions (B)
TH2F * hMcProton
montecarlo K-
void init()
initialize geometry class from XDF file and set-up DAQ/Slat mappings