6 #if ROOT_VERSION_CODE < 331013
12 #include "TBaseClass.h"
13 #include "TDataMember.h"
15 #include "TMethodArg.h"
16 #include "TDataType.h"
17 #include "TMemberInspector.h"
19 #include "TCollection.h"
23 #include "TPoints3DABC.h"
32 #include "StGlobalTrack.h"
33 #include "StTrackNode.h"
35 #include "StTrackGeometry.h"
36 #include "StTrackDetectorInfo.h"
39 #include "StarClassLibrary/BetheBloch.h"
41 #include "StBichsel/Bichsel.h"
43 #include "StEvent/StDedxPidTraits.h"
45 #include "StEventTypes.h"
46 #include "StProbPidTraits.h"
47 #include "StTpcDedxPidAlgorithm.h"
48 #include "THelixTrack.h"
50 #define __EVENTHELPER_ONLY__
51 #include "StEventHelper.h"
52 #include "StEventHitIter.h"
53 #undef __EVENTHELPER_ONLY__
56 #include "StRnDHitCollection.h"
57 #include "StEtrHitCollection.h"
59 void Break(){printf(
"InBreak\n");}
61 std::map<long,long> myMap;
62 typedef std::pair <long,long> MyPair;
63 std::map <long,long> :: const_iterator myFinder;
65 #if ROOT_VERSION_CODE >= ROOT_VERSION(5,34,29)
66 typedef TMemberInspector StEventInspector;
69 class StEventInspector :
public TMemberInspector {
71 StEventInspector(TExMap *map,Int_t &count,
const char *opt=
"");
72 virtual ~StEventInspector(){
delete fSkip;};
73 virtual void Inspect(TClass* cl,
const char* parent,
const char* name,
const void* addr);
74 void CheckIn(TObject *obj,
const char *bwname=
"");
83 StEventInspector::StEventInspector(TExMap *map,Int_t &count,
const char *opt):fCount(count)
88 if (fOpt.Length()) fSkip =
new TRegexp(fOpt.Data());
91 void StEventInspector::Inspect(TClass* kl,
const char* tit ,
const char* name,
const void* addr)
93 if(tit && strchr(tit,
'.')) return ;
98 if (name[0] ==
'*') name++;
99 int ln = strcspn(name,
"[ ");
100 TString iname(name,ln);
101 const char *iName=iname.Data();
102 if (iName[1]==
'P' && strcmp(iName,
"fParent" )==0)
return;
103 if (iName[0]==
'G' && strcmp(iName,
"G__virtualinfo")==0)
return;
105 G__ClassInfo *classInfo = (G__ClassInfo *)kl->GetClassInfo();
106 if (!classInfo)
return;
107 G__ClassInfo &cl = *classInfo;
111 G__DataMemberInfo m(cl);
116 if (mName[1] != iName[1])
continue;
117 if (strcmp(mName,iName) )
continue;
125 long prop = m.Property() | m.Type()->Property();
126 if (prop & G__BIT_ISFUNDAMENTAL)
return;
127 if (prop & G__BIT_ISSTATIC)
return;
128 if (prop & G__BIT_ISENUM)
return;
129 if (strcmp(m.Type()->Fullname(),
"TObject") && !m.Type()->IsBase(
"TObject"))
132 int size =
sizeof(
void*);
133 if (!(prop&G__BIT_ISPOINTER)) size = m.Type()->Size();
136 if (prop & G__BIT_ISARRAY) {
137 for (
int dim = 0; dim < m.ArrayDim(); dim++) nmax *= m.MaxIndex(dim);
140 for(
int i=0; i<nmax; i++) {
141 char *ptr = (
char*)addr + i*size;
142 TObject *obj = (prop&G__BIT_ISPOINTER) ? *((TObject**)ptr) : (TObject*)ptr;
144 const char *bwname = obj->ClassName();
145 if (!bwname[0] || strcmp(bwname,obj->ClassName())==0) {
147 int l = strcspn(bwname,
"[ ");
148 if (bwname[l]==
'[') {
149 char cbuf[12]; sprintf(cbuf,
"[%02d]",i);
150 ts.Replace(0,999,bwname,l);
152 bwname = (
const char*)ts;
162 void StEventInspector::CheckIn(TObject *obj,
const char *bwname)
166 if (obj->InheritsFrom(StRefArray::Class()))
return;
167 if (obj->InheritsFrom( StObjLink::Class()))
return;
169 if (fSkip && (fSkip->Index(obj->ClassName(),&n)>=0))
return;
171 if (obj->InheritsFrom(TCollection::Class())){
172 TCollection *tcol = (TCollection*)obj;
174 while ((inobj=next())) {CheckIn(inobj);}
178 if (obj->InheritsFrom(StXRef::Class())){
179 LongKey_t &inmap = (*fMap)(TMath::Hash(&obj,
sizeof(
void*)),(Long_t)obj);
180 myFinder = myMap.find((
long)obj);
181 assert((inmap==0) == (myFinder==myMap.end()));
184 myMap.insert(MyPair((
long)obj,1));
188 if (obj->InheritsFrom(StStrArray::Class())){
193 LongKey_t &inmap = (*fMap)(TMath::Hash(&obj,
sizeof(
void*)),(Long_t)obj);
194 myFinder = myMap.find((
long)obj);
195 assert((inmap==0) == (myFinder==myMap.end()));
197 myMap.insert(MyPair((
long)obj,2));
200 int vecobj = ( obj->IsA() == StSPtrVecObject::Class());
203 int sz = arr->size();
204 for (
int idx=0;idx<sz; idx++) {
205 inobj = arr->at(idx);
206 Int_t count = fCount;
208 if (count==fCount && !vecobj)
break;
212 StEventInspector insp(fMap,fCount);
213 #if ROOT_VERSION_CODE < 334597
214 char cbuf[1000];*cbuf=0;
215 obj->ShowMembers(insp,cbuf);
217 obj->ShowMembers(insp);
226 fMap =
new TExMap(10000);
232 StEventHelper::~StEventHelper()
239 void StEventHelper::Clear(Option_t *opt)
243 void StEventHelper::Reset(
const TObject *evt,
const char *opt)
245 fObject = (TObject *)evt;
249 #if ROOT_VERSION_CODE < ROOT_VERSION(5,34,29)
250 if (!fObject)
return;
252 StEventInspector insp(fMap,kount,opt);
253 #if ROOT_VERSION_CODE < 334597
255 fObject->ShowMembers(insp,cbuf);
257 fObject->ShowMembers(insp);
262 int StEventHelper::Kind(
const TObject *to)
264 static TClass *klass=0;
267 TClass *myClass=to->IsA();
268 if (myClass!=klass) {
269 klass = myClass; who = 0;
270 if (klass->InheritsFrom( StHit::Class())) { who=kHIT;}
271 else if (klass->InheritsFrom( StTrack::Class())) { who=kTRK;}
272 else if (klass->InheritsFrom(StPtrVecHit::Class())) { who=kHRR;}
273 else if (klass->InheritsFrom( StVertex::Class())) { who=kVTX;}
274 else if (klass->InheritsFrom( TObjArray::Class())) { who=kTRR;}
279 if (hh.IsUsed()) {kind|=kUSE;}
else {kind|=kUNU;}
280 if (hh.IsFit ()) kind|=kFIT;
287 void StEventHelper::ls(Option_t* option)
const
289 typedef struct {
int nb;
int sz;
const char *tenant; } QWE;
295 while( it.Next(key,val) ) {
296 if (val != 2)
continue;
298 LongKey_t &cnt = map((Long_t)a->IsA());
303 qwe->nb=0; qwe->sz=0;qwe->tenant=0;
306 qwe->nb++; qwe->sz += a->size();
307 if (qwe->tenant==0 && a->size()) {
308 TObject *to = a->front();
309 if (to) qwe->tenant = to->ClassName();
313 TExMapIter itt(&map);
314 printf(
"\n StEvent(%p)\n",(
void*)fObject);
316 while( itt.Next(key,val) ) {
317 TObject *kl = (TObject *)key;
319 printf (
"%8d(%8d) - %s (%s)\n",qwe->nb,qwe->sz,kl->GetName(),qwe->tenant);
326 TObjArray *StEventHelper::SelConts(
const char *sel)
328 TObjArray *tarr =
new TObjArray;
333 while( it.Next(key,val) ) {
334 if (val == 1)
continue;
336 if(a->size()==0)
continue;
338 if (reg.Index(a->ClassName(),&n)<0)
continue;
344 TObjArray *StEventHelper::SelTracks(
const char*,
int flag)
346 int trackTypes[]= {global, primary, tpt, secondary, estGlobal, estPrimary,-1};
348 TObjArray *conts = SelConts(
"^StSPtrVecTrackNode$");
349 TObjArray *traks =
new TObjArray();
350 Int_t ilast = conts->GetLast();
351 for (
int idx=0;idx<=ilast;idx++) {
354 int ntrk = arr->size();
356 for (
int itrk=0;itrk<ntrk;itrk++) {
359 StTrack *trk = 0;
int ity;
int bty=kTGB;
360 for (
int jty=0;(ity=trackTypes[jty])>=0;jty++,bty<<=1){
361 if (!(flag&bty))
continue;
364 if (trk->IsZombie())
continue;
366 if ((flag&kMark2Draw) && !trk->TestBit(kMark2Draw))
continue;
375 TObjArray *StEventHelper::SelHits(
const char *RegEx, Int_t un, Int_t flag)
379 TObjArray *conts = SelConts(RegEx);
380 TObjArray *hits =
new TObjArray();
381 Int_t ilast = conts->GetLast();
383 for (
int idx=0;idx<=ilast;idx++) {
386 int sz = arr->size();
388 if (!arr->at(0)->InheritsFrom(StHit::Class()))
continue;
389 for(
int ih=0;ih<sz; ih++) {
392 if (hit->IsZombie())
continue;
394 if ((flag&kMark2Draw) && !hit->TestBit(kMark2Draw))
continue;
395 int used = (hit->trackReferenceCount()!=0);
397 if ( used && (un&kUSE)) take++;
398 if (!used && (un&kUNU)) take++;
399 if (take) hits->Add(hit);
406 TObjArray *StEventHelper::SelVertex(
const char *sel,Int_t flag)
409 TObjArray *conts = SelConts(sel);
410 TObjArray *verts =
new TObjArray();
411 Int_t ilast = conts->GetLast();
413 for (
int idx=0;idx<=ilast;idx++) {
416 int sz = arr->size();
418 for (
int ivx=0; ivx<sz; ivx++) {
421 if (vx->IsZombie())
continue;
423 if ((flag&kMark2Draw) && !vx->TestBit(kMark2Draw))
continue;
424 verts->Add(vx);nvtx++;
431 TObjArray *StEventHelper::ExpandAndFilter(
const TObject *eObj,
int flag, TObjArray *out)
434 if (!out) {out =
new TObjArray;}
435 TObject *eobj = (TObject*)eObj;
437 int kind = Kind(eobj);
439 if (!(flag&kHIT))
return out;
440 int take=kind & (kUSE|kUNU|kFIT) &flag;
441 if (take) out->Add(eobj);
447 if (flag&kTRK) out->Add(eobj);
448 if (!(flag&kHRR))
return out;
451 out->Add((TObject*)trkh.GetHits());
457 if (flag&kVTX) out->Add(eobj);
459 if (!(flag&(kTRK|kHRR)))
return out;
461 int n = vtxh.GetNTracks();
462 for (
int i=-1;i<n;i++) {
463 const TObject *to = vtxh.GetTrack(i);
465 ExpandAndFilter(to,flag,out);
472 TObjArray *inp = (TObjArray *)eobj;
474 int nbjs = inp->GetLast()+1;
476 for (
int i=0;i<nbjs;i++) {
477 ExpandAndFilter(inp->At(i),flag,out);
484 if (!(flag&kHRR))
return out;
491 TObjArray *StEventHelper::MakePoints(TObjArray *inp,
int flag)
493 static const Color_t plitra[]={kRed,kGreen,kBlue,kMagenta, kCyan};
494 static const int nlitra =
sizeof(plitra)/
sizeof(Color_t);
497 int nbjs = inp->GetLast()+1;
499 TObjArray *out =
new TObjArray;out->SetOwner();
501 for (
int i=0;i<nbjs;i++) {
502 TObject *to = inp->At(i);
504 if (!(kind&kHRR)) { ilitra++; ilitra = ilitra%nlitra; }
505 int take = (kind&flag);
512 else if (kind&kHRR && ((StPtrVecHit*)to)->size())
521 for (
int j=0;j<np;j++){p[j]->SetUniqueID(plitra[ilitra]); out->Add(p[j]);}
527 void StEventHelper::Break(
int kase)
529 fprintf(stderr,
"Break(%d)\n",kase);
532 void StEventHelper::Remove(
StEvent *ev,
const char *className)
534 StSPtrVecObject& V = ev->content();
536 for (
int i=0; i<n; i++) {
539 if (!strstr(to->ClassName(),className))
continue;
548 int n = add->fSize + fSize;
550 if (n < fN*2) n = fN*2;
551 Float_t *arr =
new Float_t[n*3];
552 memcpy(arr, fXYZ, fSize*3*
sizeof(Float_t));
553 delete [] fXYZ; fXYZ = arr; fN = n;
555 memcpy(fXYZ+fSize*3,add->fXYZ,add->fSize*3*
sizeof(Float_t));
567 void StTrackPoints::Init()
572 fXYZ = th.GetPoints(fSize);
574 if (!fSize) { MakeZombie();
return;}
577 Int_t StTrackPoints::DistancetoPrimitive(Int_t px, Int_t py)
589 enum {inaxis = 7,mindist=10};
590 Float_t dist = 999999;
592 Int_t puxmin = gPad->XtoAbsPixel(gPad->GetUxmin());
593 Int_t puymin = gPad->YtoAbsPixel(gPad->GetUymin());
594 Int_t puxmax = gPad->XtoAbsPixel(gPad->GetUxmax());
595 Int_t puymax = gPad->YtoAbsPixel(gPad->GetUymax());
599 if (px < puxmin - inaxis)
goto END;
600 if (py > puymin + inaxis)
goto END;
601 if (px > puxmax + inaxis)
goto END;
602 if (py < puymax - inaxis)
goto END;
604 view = gPad->GetView();
611 Int_t pointSize = fN*3;
612 view->WCtoNDC(fXYZ, xndc);
613 x0 = gPad->XtoAbsPixel(xndc[0]);
614 y0 = gPad->YtoAbsPixel(xndc[1]);
616 float dif[2],difdif,cur[2],curcur,difcur;
617 for (i=3;i<pointSize;i+=3) {
618 view->WCtoNDC(fXYZ+i, xndc);
619 x1 = gPad->XtoAbsPixel(xndc[0]);
620 y1 = gPad->YtoAbsPixel(xndc[1]);
621 dif[0] = x1-x0; dif[1]=y1-y0;
622 cur[0] = x0-px; cur[1]=y0-py;
623 difdif = (dif[0]*dif[0]+dif[1]*dif[1]);
624 difcur = (dif[0]*cur[0]+dif[1]*cur[1]);
625 curcur = cur[0]*cur[0]+cur[1]*cur[1];
626 if (difdif<mindist*mindist) {
627 if ((i+3)<pointSize)
continue;
628 dist = curcur;
break;
630 alfa = -difcur/difdif;
632 if (alfa<0.) {dist = curcur;
break;}
636 if (i+3 < pointSize)
continue;
637 dist = (px-x1)*(px-x1) + (py-y1)*(py-y1);
break;
639 dist = curcur+alfa*(2*difcur+difdif*alfa);
643 dist = TMath::Sqrt(dist);
645 if (dist <= mindist) { dist = 0; gPad->SetSelected(
this);}
659 fXYZ =
new Float_t[3];
660 fXYZ[0] = ((
StVertex*)fObj)->position().x();
661 fXYZ[1] = ((
StVertex*)fObj)->position().y();
662 fXYZ[2] = ((
StVertex*)fObj)->position().z();
670 fSize = 1; fN =1; fInnOut=innout;
671 const StTrackGeometry *geo = (fInnOut==0) ? st->geometry():st->outerGeometry();
672 fXYZ =
new Float_t[3];
673 fXYZ[0] = geo->origin().x();
674 fXYZ[1] = geo->origin().y();
675 fXYZ[2] = geo->origin().z();
688 StHitPoints::StHitPoints(
const StRefArray *ar,
const char *name,
const char *title)
694 fObj = (fSize==1) ? ar->front() : ar;
698 void StHitPoints::Init()
701 fXYZ =
new Float_t[fN*3];
704 for (
int i =0;i<fSize;i++)
707 if (fSize>1 && !hit->trackReferenceCount())
continue;
708 if (fSize>1 && !hit->usedInFit())
continue;
710 fXYZ[n*3+0] = v3.x();
711 fXYZ[n*3+1] = v3.y();
712 fXYZ[n*3+2] = v3.z();
727 void StFilterABC::SetDefs()
729 for (
int i=0;GetNams() && GetNams()[i]; i++) {GetPars()[i]=GetDefs()[i];}
740 const char **StFilterDef::GetNams()
const
742 static const char *nams[] = {
763 const float *StFilterDef::GetDefs()
const
765 static const float defs[] = {
788 Int_t StFilterDef::Accept(
StPoints3DABC *pnt,Color_t &color, Size_t&, Style_t&)
791 float x,y,z,r2xy,phid,len,pt,ps,q;
795 color = (((color-kRed)+1)%6)+kRed;
798 if (fRandomSelect < 1. && fRandomSelect < rrr.Rndm())
return 0;
802 if (fZMin >z || z > fZMax)
goto SKIP;
808 if (fRxyMin*fRxyMin > r2xy || r2xy > fRxyMax*fRxyMax)
goto SKIP;
809 phid = atan2(y,x)*(180./M_PI);
811 if (fPhiMin > phid || phid > fPhiMax)
goto SKIP;
812 to = pnt->GetObject();
814 if (!to->InheritsFrom(StTrack::Class()))
return 1;
822 if (fLenMin >len || len > fLenMax)
goto SKIP;
823 pt = trk->geometry()->momentum().perp();
825 if (fPtMin >pt || pt > fPtMax)
goto SKIP;
826 ps = trk->geometry()->momentum().pseudoRapidity();
828 if (fPsMin >ps || ps > fPsMax)
goto SKIP;
829 q = trk->geometry()->charge();
831 if (fQMin >q || q > fQMax)
goto SKIP;
833 if ( (
int(fEncodedMethod) != -1) && (trk->encodedMethod() != int(fEncodedMethod)) )
853 StMuDstFilterHelper::~StMuDstFilterHelper()
860 const char **StMuDstFilterHelper::GetNams()
const
862 static const char *nams[] = {
869 " dEdxFractionCutHigh ",
871 " dEdxFractionCutLow ",
877 const float *StMuDstFilterHelper::GetDefs()
const
879 static const float defs[] = {
894 Int_t StMuDstFilterHelper::Accept(
const StTrack*
track) {
896 float pCutHigh = fpCutHigh;
897 int nHitsCutHighP = int(fnHitsCutHighP);
900 float pCutLow = fpCutLow;
901 int nHitsCutLowP = int(fnHitsCutLowP);
902 int chargeForLowP = int(fchargeForLowP);
903 float dEdxMassCutHigh = fdEdxMassCutHigh;
904 float dEdxFractionCutHigh = fdEdxFractionCutHigh;
905 float dEdxMassCutLow = fdEdxMassCutLow;
906 float dEdxFractionCutLow = fdEdxFractionCutLow;
912 float magnitude = track->geometry()->momentum().magnitude();
913 int nPoints = track->detectorInfo()->numberOfPoints();
915 if ( magnitude > pCutHigh && nPoints >= nHitsCutHighP) iret = 1;
917 if ( magnitude > pCutLow && nPoints >= nHitsCutLowP )
920 if (chargeForLowP==0)
922 else if (track->geometry()->charge() == chargeForLowP)
927 float dedxHigh = dEdxFractionCutHigh * mBB->Sirrf(magnitude/dEdxMassCutHigh);
928 float dedxLow = dEdxFractionCutLow * mBB->Sirrf(magnitude/dEdxMassCutLow);
930 float dedxHigh = dEdxFractionCutHigh * Bichsel::Instance()->GetI70M(TMath::Log10(magnitude/dEdxMassCutHigh));
931 float dedxLow = dEdxFractionCutLow * Bichsel::Instance()->GetI70M(TMath::Log10(magnitude/dEdxMassCutLow));
936 const StSPtrVecTrackPidTraits& traits = track->pidTraits();
938 for (
unsigned int itrait = 0; itrait < traits.size(); itrait++){
940 if (traits[itrait]->detector() == kTpcId) {
943 if (dedxPidTr && dedxPidTr->method() == kTruncatedMeanId) {
945 dedx = 2 * dedxPidTr->mean();
949 if (dedx > dedxHigh && dedx > dedxLow)
952 iret = chargeOK * dedxOK;
963 to = pnt->GetObject();
965 if (!to->InheritsFrom(StTrack::Class()))
return 1;
975 fElectron = StElectron::instance();
976 fPion = StPionPlus::instance();
977 fKaon = StKaonPlus::instance();
978 fProton = StProton::instance();
984 StColorFilterHelper::~StColorFilterHelper()
985 {
delete fPidAlgorithm;}
987 const char **StColorFilterHelper::GetNams()
const
989 static const char *nams[] = {
1005 const float *StColorFilterHelper::GetDefs()
const
1007 static const float defs[] = {
1024 Int_t StColorFilterHelper::Accept(
const StTrack* track, Color_t &color, Size_t&size, Style_t&) {
1026 float sigmaElectron = fNSigmaElectron ;
1027 Color_t colorElectron = (Color_t)fNColorElectron ;
1029 float sigmaPion = fNSigmaPion ;
1030 Color_t colorPion = (Color_t)fNColorPion ;
1032 float sigmaKaon = fNSigmaKaon ;
1033 Color_t colorKaon = (Color_t)fNColorKaon ;
1035 float sigmaProton = fNSigmaProton ;
1036 Color_t colorProton = (Color_t)fNColorProton ;
1039 Color_t colorOther = (Color_t)fNColorOther ;
1043 track->pidTraits(*fPidAlgorithm);
1048 if (TMath::Abs(fPidAlgorithm->numberOfSigma(fElectron)) < sigmaElectron)
1049 { color = colorElectron; size = 2; }
1051 if (TMath::Abs(fPidAlgorithm->numberOfSigma(fKaon)) < sigmaKaon)
1052 { color = colorKaon; size = 4; }
1054 if (TMath::Abs(fPidAlgorithm->numberOfSigma(fPion)) < sigmaPion)
1055 { color = colorPion; size = 5; }
1057 if (TMath::Abs(fPidAlgorithm->numberOfSigma(fProton)) < sigmaProton)
1058 { color = colorProton; size = 3; }
1064 Int_t StColorFilterHelper::Accept(
StPoints3DABC *pnt, Color_t&color, Size_t&size, Style_t&style)
1068 to = pnt->GetObject();
1070 if (!to->InheritsFrom(StTrack::Class()))
return 1;
1072 return Accept(trk,color,size,style);
1080 StVertexHelper::StVertexHelper(
const StEvent *evt)
1081 { SetVertex(evt->primaryVertex(0));}
1083 void StVertexHelper::SetVertex(
const StVertex *vtx){fVtx = vtx;}
1084 int StVertexHelper::GetType() {
return (
int)fVtx->type();}
1085 int StVertexHelper::GetFlag() {
return fVtx->flag();};
1086 int StVertexHelper::GetNTracks() {
return fVtx->numberOfDaughters();}
1090 return fVtx->position();
1093 const StTrack *StVertexHelper::GetTrack(
int idx)
1095 if (idx==-1)
return (
const StTrack *) fVtx->parent();
1096 if (idx>= GetNTracks())
return 0;
1097 return (
const StTrack *) fVtx->daughter((UInt_t)idx);
1104 StMatrixF mxF = fVtx->covariantMatrix();
1106 for (
int i=0;i< 3;i++) {
1107 for (
int j=0;j<=i;j++) {
1108 fErrMtx[jj++] = mxF(i+1,j+1);}}
1117 trk->outerGeometry()->helix(),trk->length())
1118 , fTrk(trk), fHits(0)
1122 trk->outerGeometry()->helix(),trk->length())
1123 , fTrk(trk), fHits(0)
1126 StTrackHelper::~StTrackHelper()
1128 int StTrackHelper::GetType()
const {
return fTrk->type();}
1129 int StTrackHelper::GetFlag()
const {
return fTrk->flag();}
1130 int StTrackHelper::GetCharge()
const {
return fTrk->geometry()->charge();}
1131 const StVertex *StTrackHelper::GetParent()
const {
return fTrk->vertex();}
1132 float StTrackHelper::GetImpact()
const {
return fTrk->impactParameter();}
1133 float StTrackHelper::GetCurv()
const {
return GetTHelix(0)->GetRho() ;}
1134 const StThreeVectorF &StTrackHelper::GetFirstPoint()
const {
return fTrk->geometry()->origin();}
1135 const StThreeVectorF &StTrackHelper::GetLastPoint()
const {
return fTrk->outerGeometry()->origin();}
1136 const StThreeVectorF &StTrackHelper::GetMom()
const {
return fTrk->geometry()->momentum();}
1139 const StPtrVecHit *StTrackHelper::GetHits()
const
1141 if (fHits)
return fHits;
1144 fHits = &tdi->hits();
1148 int StTrackHelper::GetNHits()
const
1150 if (fHits)
return fHits->size();
1152 return (fHits)? fHits->size():0;
1155 const StHit *StTrackHelper::GetHit(
int idx)
const
1157 if (idx<0)
return 0;
1158 if (idx>=GetNHits())
return 0;
1159 if (!fHits)
return 0;
1160 return fHits->at(idx);
1163 int StTrackHelper::numberOfFitPoints(
int det)
const
1166 return (det)? trait.numberOfFitPoints((StDetectorId)det): trait.numberOfFitPoints();
1169 StMCTruth StTrackHelper::GetTruth(
int byNumb,
double rXYMin,
double rXYMax)
const
1172 int nHits = GetNHits();
1174 for (
int jh=0;jh<nHits;jh++) {
1175 const StHit *hit = GetHit(jh);
1176 double r = sqrt(pow(hit->position().x(),2)+pow(hit->position().y(),2));
1177 if (r<rXYMin)
continue;
1178 if (r>rXYMax)
continue;
1179 int idTruth=hit->idTruth();
1180 int wtTruth=hit->qaTruth();
1181 if (!wtTruth) wtTruth=1;
1185 nUsed++; pivo.Add(idTruth,wtTruth);
1187 if (!nUsed)
return 0;
1188 return pivo.Get(byNumb);
1196 void StHitHelper::SetHit(
const StHit *hit) {fHit = hit;}
1197 int StHitHelper::GetDetId() {
return fHit->detector();}
1198 int StHitHelper::GetFlag() {
return fHit->flag();}
1199 float StHitHelper::GetCharge() {
return fHit->charge();}
1200 int StHitHelper::IsUsed() {
return fHit->trackReferenceCount();}
1201 int StHitHelper::IsFit() {
return fHit->usedInFit();}
1202 const StThreeVectorF &StHitHelper::GetPoint() {
return fHit->position();}
1211 fNErr=0; fNTot=0; fKErr=0;
1216 StErrorHelper::~StErrorHelper()
1222 void StErrorHelper::Add(
int errn)
1230 void StErrorHelper::MakeArray()
1233 fKErr = fMap->GetSize();
1235 TExMapIter it(fMap);
1236 LongKey_t lerr,lnum;
1239 while(it.Next(lerr,lnum)) {
1240 (*fArr)[idx+ 0] = lnum;
1241 (*fArr)[idx+fKErr] = lerr;
1245 TMath::Sort(fKErr, fArr->GetArray(), fArr->GetArray()+2*fKErr);
1248 void StErrorHelper::Print(
const char* txt)
const
1253 printf(
"StEvent Error Summary:%s\n",txt);
1255 printf(
"%4d -%8d(%4d)\n",0,0,fNTot-fNErr);
1256 int *nrr=fArr->GetArray();
1259 for (
int i=0;i<fKErr;i++) {
1261 printf(
"%4d -%8d(%4d) //%s\n",i+1,krr[j],nrr[j],Say(krr[j]).Data());
1266 TString StErrorHelper::Say(
int ierr,
const char *klass)
1268 static const char *TabErr[] =
1270 "StTrack" ,
"mFlag" ,
"1",
"2",
"is Negative",
1271 "StTrack" ,
"mFlag" ,
"1",
"3",
"is Zero",
1273 "StTrack" ,
"mImpactParameter" ,
"2",
"1",
"is NaN",
1274 "StTrack" ,
"mImpactParameter" ,
"2",
"2",
"is huge",
1276 "StTrack" ,
"mLength" ,
"3",
"1",
"is NaN",
1277 "StTrack" ,
"mLength" ,
"3",
"2",
"is huge",
1278 "StTrack" ,
"mLength" ,
"3",
"3",
"is too small",
1279 "StTrack" ,
"mLength" ,
"3",
"4",
"contradicts to In/Out distance",
1280 "StTrack" ,
"mLength" ,
"3",
"5",
"helix out of Zmax",
1281 "StTrack" ,
"mLength" ,
"3",
"6",
"helix out of Rmax",
1283 "StTrack" ,
"mGeometry" ,
"4",
"2",
"iz zero",
1284 "StTrack" ,
"mGeometry" ,
"4",
"0",
"StTrackGeometry",
1286 "StTrack" ,
"mOuterGeometry" ,
"5",
"2",
"iz zero",
1287 "StTrack" ,
"mOuterGeometry" ,
"5",
"0",
"StTrackGeometry",
1289 "StTrack" ,
"mDetectorInfo" ,
"6",
"2",
"iz zero",
1290 "StTrack" ,
"mDetectorInfo" ,
"6",
"0",
"StTrackDetectorInfo",
1292 "StTrackGeometry" ,
"Helix" ,
"1",
"0",
"StPhysicalHelixD",
1293 "StTrackGeometry" ,
"Helix" ,
"1",
"2",
"out of zMax",
1294 "StTrackGeometry" ,
"Helix" ,
"1",
"3",
"out of rMax",
1296 "StTrackDetectorInfo" ,
"mFirstPoint" ,
"1",
"0",
"StThreeVectorF",
1297 "StTrackDetectorInfo" ,
"mFirstPoint" ,
"1",
"2",
"out of zMax",
1298 "StTrackDetectorInfo" ,
"mFirstPoint" ,
"1",
"3",
"out of rMax",
1300 "StTrackDetectorInfo" ,
"mLastPoint" ,
"2",
"0",
"StThreeVectorF",
1301 "StTrackDetectorInfo" ,
"mLastPoint" ,
"2",
"2",
"out of zMax",
1302 "StTrackDetectorInfo" ,
"mFLastPoint" ,
"2",
"3",
"out of rMax",
1305 "StPhysicalHelixD" ,
"mDipAngle" ,
"1",
"1",
"is NaN",
1306 "StPhysicalHelixD" ,
"mDipAngle" ,
"1",
"2",
"> Py/2",
1307 "StPhysicalHelixD" ,
"mDipAngle" ,
"1",
"3",
"== Py/2",
1309 "StPhysicalHelixD" ,
"mCurvature" ,
"2",
"1",
"is NaN",
1310 "StPhysicalHelixD" ,
"mCurvature" ,
"2",
"2",
"too big",
1311 "StPhysicalHelixD" ,
"mCurvature" ,
"2",
"3",
"is Negaive",
1313 "StPhysicalHelixD" ,
"mOrigin" ,
"3",
"0",
"StThreeVectorD",
1314 "StPhysicalHelixD" ,
"mH" ,
"4",
"2",
"!= 1 or -1",
1316 "StThreeVectorD" ,
"mX1" ,
"1",
"1",
"is NaN",
1317 "StThreeVectorD" ,
"mX1" ,
"1",
"2",
"too big",
1318 "StThreeVectorD" ,
"mX2" ,
"2",
"1",
"is NaN",
1319 "StThreeVectorD" ,
"mX2" ,
"2",
"2",
"too big",
1320 "StThreeVectorD" ,
"mX3" ,
"3",
"1",
"is NaN",
1321 "StThreeVectorD" ,
"mX3" ,
"3",
"2",
"too big",
1324 "StThreeVectorF" ,
"mX1" ,
"1",
"1",
"is NaN",
1325 "StThreeVectorF" ,
"mX1" ,
"1",
"2",
"too big",
1326 "StThreeVectorF" ,
"mX2" ,
"2",
"1",
"is NaN",
1327 "StThreeVectorF" ,
"mX2" ,
"2",
"2",
"too big",
1328 "StThreeVectorF" ,
"mX3" ,
"3",
"1",
"is NaN",
1329 "StThreeVectorF" ,
"mX3" ,
"3",
"2",
"too big",
1334 int jrr = (ierr/10)%10;
1335 for (
const char **jt=TabErr;*jt;jt+=5) {
1336 if (strcmp(klass,*jt) )
continue;
1337 if (atoi(jt[2]) != jmm)
continue;
1338 if (atoi(jt[3]) != jrr)
continue;
1340 if (jrr) { ts+=
": "; ts+=jt[4];}
1341 else { ts+=
"."; ts+=Say(ierr/100,jt[4]);}
const float * GetErrMtx()