65 TChain* strangeChain=0;
66 TCollection* ListofFuncs=0;
68 static const char* defaultFile =
"evMuDst.root";
69 static const char* defaultTree =
"StrangeMuDst";
70 static const char* altTree =
"MuDst";
75 if (!(gROOT->GetClass(
"TTreePlayer"))) {
76 gSystem->Load(
"libTreePlayer");
77 gSystem->Load(
"libProof");
79 if (!ListofFuncs) ListofFuncs=gROOT->GetListOfFunctions();
84 void findFormulas(
const char* c0,
const char* c1=0,
const char* c2=0) {
85 for (Int_t i=0; i<ListofFuncs->GetSize(); i++) {
86 TString ostr = ListofFuncs->At(i)->GetName();
87 if (ostr.Contains(c0,TString::kIgnoreCase)) {
88 if ((!c1) || (ostr.Contains(c1,TString::kIgnoreCase))) {
89 if ((!c2) || (ostr.Contains(c2,TString::kIgnoreCase))) {
90 cout << ostr.Data() << endl;
99 TFormula* findFormula(
const char* c0) {
100 return (TFormula*) ListofFuncs->FindObject(c0);
105 void findDefinition(
const char* c0) {
106 TFormula* f1 = findFormula(c0);
108 cout <<
"Name : " << f1->GetName() << endl;
109 if (f1->IsA() == TTreeFormula::Class())
110 cout <<
"# of Codes : " << ((TTreeFormula*) f1)->GetNcodes() << endl;
111 cout <<
"Definition : " << f1->GetTitle() << endl;
117 void formulate(
const char* name,
const char* formula) {
118 TTreeFormula* f1 = (TTreeFormula*) findFormula(name);
120 f1->SetTree(strangeTree);
122 f1 =
new TTreeFormula(name,formula,strangeTree);
123 ListofFuncs->Add(f1);
124 if (f1->GetNcodes() > max_codes) {
125 cout <<
"\nWARNING!!! The following formula uses " << f1->GetNcodes();
126 cout <<
" values,\n too many for this version of ROOT: \n";
127 cout << f1->GetName() <<
" = " << f1->GetTitle() << endl;
134 TTree* strangeFormulas(
const char* fname=0,
const char* tname=0) {
140 TString fnamestr = fname;
141 if (!(fnamestr.EndsWith(
".root"))) {
142 ifstream inlist(fname);
144 cout <<
"\nERROR!!! Cannot find list file: " << fname << endl;
150 while (! inlist.eof()) {
152 inamestr.ReplaceAll(
"::",
"/");
153 inamestr.ReplaceAll(
"//",
"/");
154 strangeFormulas(inamestr.Data(),tname);
156 cout <<
"\nERROR!!! Trouble with first file: "
157 << inamestr.Data() << endl;
168 strangeChain->Add(fname);
177 printf(
"Looking for tree with name %s\n",tname);
178 strangeChain =
new TChain(tname);
179 strangeChain->Add(fname);
180 if (strangeChain->LoadTree(0)) {
184 if (!(strcmp(tname,defaultTree)))
return strangeFormulas(fname,altTree);
187 strangeTree = (TTree*) strangeChain;
188 strangeFormulas(strangeTree);
194 TTree* strangeFormulas(TFile* fptr) {
197 strangeTree = (TTree*) fptr->Get(defaultTree);
198 if (!strangeTree) strangeTree = (TTree*) fptr->Get(altTree);
199 strangeFormulas(strangeTree);
205 Int_t strangeFormulas(TTree* tree) {
208 if (gROOT->GetVersionInt() < 22405) {
215 if (tree->GetBranch(
"EmcCollection")) {
216 tree->SetBranchStatus(
"EmcCollection.*",0);
218 if (tree->GetBranch(
"PmdCollection")) {
219 tree->SetBranchStatus(
"PmdCollection.*",0);
231 Int_t initialFormulas = ListofFuncs->GetSize();
234 f0 =
new TFormula(
"mLambda",
"1.11563");
235 f0 =
new TFormula(
"mAntiLambda",
"1.11563");
236 f0 =
new TFormula(
"mK0Short",
"0.497671");
237 f0 =
new TFormula(
"mProton",
"0.938272");
238 f0 =
new TFormula(
"mAntiProton",
"0.938272");
239 f0 =
new TFormula(
"mPiPlus",
"0.139568");
240 f0 =
new TFormula(
"mPiMinus",
"0.139568");
241 f0 =
new TFormula(
"mKaonMinus",
"0.493646");
245 printf(
"Loading event formulas...\n");
246 formulate(
"Event.run()",
"Event.mRun");
247 formulate(
"Event.event()",
"abs(Event.mEvent)");
248 formulate(
"Event.globalTracks()",
"Event.mGlobalTracks");
249 formulate(
"Event.primaryTracks()",
"Event.mPrimaryTracks");
250 formulate(
"Event.primaryNegTracks()",
"Event.mPrimaryNegTracks");
251 formulate(
"Event.primaryVertexX()",
"Event.mPrimaryVertexX");
252 formulate(
"Event.primaryVertexY()",
"Event.mPrimaryVertexY");
253 formulate(
"Event.primaryVertexZ()",
"Event.mPrimaryVertexZ");
254 formulate(
"Event.magneticField()",
"Event.mMagneticField");
255 formulate(
"Event.l0TriggerWord()",
"Event.mL0TriggerWord");
256 formulate(
"Event.unbiasedTrigger()",
"(Event.mEvent>0)");
260 if (tree->GetBranch(
"McEvent")) {
261 printf(
"Loading MC event formulas...\n");
263 formulate(
"McEvent.run()",
"McEvent.mRun");
264 formulate(
"McEvent.event()",
"McEvent.mEvent");
265 formulate(
"McEvent.globalTracks()",
"McEvent.mGlobalTracks");
266 formulate(
"McEvent.primaryTracks()",
"McEvent.mPrimaryTracks");
267 formulate(
"McEvent.primaryNegTracks()",
"McEvent.mPrimaryNegTracks");
268 formulate(
"McEvent.primaryVertexX()",
"McEvent.mPrimaryVertexX");
269 formulate(
"McEvent.primaryVertexY()",
"McEvent.mPrimaryVertexY");
270 formulate(
"McEvent.primaryVertexZ()",
"McEvent.mPrimaryVertexZ");
276 if (tree->GetBranch(
"V0")) {
277 printf(
"Loading V0 formulas...\n");
280 formulate(
"V0.decayLengthV0()",
281 "sqrt(sq(V0.mDecayVertexV0X-Event.mPrimaryVertexX[0])+sq(V0.mDecayVertexV0Y-Event.mPrimaryVertexY[0])+sq(V0.mDecayVertexV0Z-Event.mPrimaryVertexZ[0]))");
284 formulate(
"V0.decayVertexV0X()",
"V0.mDecayVertexV0X");
285 formulate(
"V0.decayVertexV0Y()",
"V0.mDecayVertexV0Y");
286 formulate(
"V0.decayVertexV0Z()",
"V0.mDecayVertexV0Z");
287 formulate(
"V0.dcaV0Daughters()",
"V0.mDcaV0Daughters");
288 formulate(
"V0.dcaV0ToPrimVertex()",
"V0.mDcaV0ToPrimVertex");
289 formulate(
"V0.dcaPosToPrimVertex()",
"V0.mDcaPosToPrimVertex");
290 formulate(
"V0.dcaNegToPrimVertex()",
"V0.mDcaNegToPrimVertex");
291 formulate(
"V0.momPosX()",
"V0.mMomPosX");
292 formulate(
"V0.momPosY()",
"V0.mMomPosY");
293 formulate(
"V0.momPosZ()",
"V0.mMomPosZ");
294 formulate(
"V0.momNegX()",
"V0.mMomNegX");
295 formulate(
"V0.momNegY()",
"V0.mMomNegY");
296 formulate(
"V0.momNegZ()",
"V0.mMomNegZ");
298 formulate(
"V0.radt2V0()",
"sq(V0.mDecayVertexV0X)+sq(V0.mDecayVertexV0Y)");
299 formulate(
"V0.radtV0()",
"sqrt(V0.radt2V0())");
300 formulate(
"V0.radV0()",
"sqrt(V0.radt2V0()+sq(V0.mDecayVertexV0Z))");
301 formulate(
"V0.phiV0()",
302 "atan2((V0.mDecayVertexV0Y-Event.mPrimaryVertexY[0]),(V0.mDecayVertexV0X-Event.mPrimaryVertexX[0]))");
303 formulate(
"V0.phi90V0()",
304 "atan2(-(V0.mDecayVertexV0X-Event.mPrimaryVertexX[0]),(V0.mDecayVertexV0Y-Event.mPrimaryVertexY[0]))");
306 formulate(
"V0.Ptot2Pos()",
307 "(sq(V0.mMomPosX)+sq(V0.mMomPosY)+sq(V0.mMomPosZ))");
308 formulate(
"V0.Ptot2Neg()",
309 "(sq(V0.mMomNegX)+sq(V0.mMomNegY)+sq(V0.mMomNegZ))");
310 formulate(
"V0.momV0X()",
"(V0.mMomPosX+V0.mMomNegX)");
311 formulate(
"V0.momV0Y()",
"(V0.mMomPosY+V0.mMomNegY)");
312 formulate(
"V0.momV0Z()",
"(V0.mMomPosZ+V0.mMomNegZ)");
313 formulate(
"V0.Pt2V0()",
"(sq(V0.momV0X())+sq(V0.momV0Y()))");
314 formulate(
"V0.Ptot2V0()",
"(V0.Pt2V0()+sq(V0.momV0Z()))");
317 formulate(
"V0.MomPosAlongV0()",
318 "(((V0.mMomPosX*V0.momV0X())+(V0.mMomPosY*V0.momV0Y())+(V0.mMomPosZ*V0.momV0Z()))/sqrt(V0.Ptot2V0()))");
319 formulate(
"V0.MomNegAlongV0()",
320 "(((V0.mMomNegX*V0.momV0X())+(V0.mMomNegY*V0.momV0Y())+(V0.mMomNegZ*V0.momV0Z()))/sqrt(V0.Ptot2V0()))");
322 formulate(
"V0.alphaV0()",
325 "1.-(2./(1.+(V0.MomPosAlongV0()/V0.MomNegAlongV0())))");
327 formulate(
"V0.ptArmV0()",
"sqrt(V0.Ptot2Pos()-sq(V0.MomPosAlongV0()))");
330 formulate(
"V0.eLambda()",
"sqrt(V0.Ptot2V0()+sq(mLambda))");
331 formulate(
"V0.eK0Short()",
"sqrt(V0.Ptot2V0()+sq(mK0Short))");
332 formulate(
"V0.ePosProton()",
"sqrt(V0.Ptot2Pos()+sq(mProton))");
333 formulate(
"V0.eNegAntiProton()",
"sqrt(V0.Ptot2Neg()+sq(mAntiProton))");
334 formulate(
"V0.ePosPion()",
"sqrt(V0.Ptot2Pos()+sq(mPiPlus))");
335 formulate(
"V0.eNegPion()",
"sqrt(V0.Ptot2Neg()+sq(mPiMinus))");
338 formulate(
"V0.massLambda()",
339 "sqrt(sq(V0.ePosProton()+V0.eNegPion())-V0.Ptot2V0())");
340 formulate(
"V0.massAntiLambda()",
341 "sqrt(sq(V0.eNegAntiProton()+V0.ePosPion())-V0.Ptot2V0())");
342 formulate(
"V0.massK0Short()",
343 "sqrt(sq(V0.ePosPion()+V0.eNegPion())-V0.Ptot2V0())");
346 formulate(
"V0.rapLambda()",
349 "0.5*log(1.+(2./((V0.eLambda()/V0.momV0Z())-1.)))");
350 formulate(
"V0.rapK0Short()",
353 "0.5*log(1.+(2./((V0.eK0Short()/V0.momV0Z())-1.)))");
356 formulate(
"V0.cTauLambda()",
357 "V0.massLambda()*V0.decayLengthV0()/sqrt(V0.Ptot2V0())");
358 formulate(
"V0.cTauK0Short()",
359 "V0.massK0Short()*V0.decayLengthV0()/sqrt(V0.Ptot2V0())");
361 formulate(
"V0.ptPos()",
"sqrt(sq(V0.mMomPosX)+sq(V0.mMomPosY))");
362 formulate(
"V0.ptotPos()",
"sqrt(V0.Ptot2Pos())");
363 formulate(
"V0.ptNeg()",
"sqrt(sq(V0.mMomNegX)+sq(V0.mMomNegY))");
364 formulate(
"V0.ptotNeg()",
"sqrt(V0.Ptot2Neg())");
365 formulate(
"V0.ptV0()",
"sqrt(V0.Pt2V0())");
366 formulate(
"V0.ptotV0()",
"sqrt(V0.Ptot2V0())");
367 formulate(
"V0.thetaV0()",
"acos(V0.momV0Z()/V0.ptotV0())");
368 formulate(
"V0.pseudoRapV0()",
"-log(tan(V0.thetaV0()/2.))");
369 formulate(
"V0.psiV0()",
"atan2(V0.momV0Y(),V0.momV0X())");
370 formulate(
"V0.psi90V0()",
"atan2(-V0.momV0X(),V0.momV0Y())");
374 if (tree->GetBranch(
"V0.mTopologyMapPos.mMap0")) {
375 for (
int k=0; k<2; k++) {
376 if (k) sprintf(track,
"Neg\0");
377 else sprintf(track,
"Pos\0");
381 for (
int l=0; l<2; l++) {
382 for (
int j=0; j<32; j++) {
384 sprintf(name,
"V0.topologyMap%s.bit(%d)\0",track,m);
385 sprintf(expr,
"(V0.mTopologyMap%s.mMap%d/(2^%d))&1\0",track,l,j);
386 formulate(name,expr);
390 sprintf(name,
"V0.topologyMap%s.data(%d)",track,l);
391 sprintf(expr,
"V0.mTopologyMap%s.mMap%d",track,l);
392 formulate(name,expr);
396 sprintf(ftpc,
"V0.topologyMap%s.ftpcFormat()",track);
397 sprintf(expr,
"V0.topologyMap%s.bit(63)",track);
398 formulate(ftpc,expr);
401 sprintf(name,
"V0.topologyMap%s.primaryVertexUsed()",track);
402 sprintf(expr,
"V0.topologyMap%s.bit(0)",track);
403 formulate(name,expr);
406 sprintf(name,
"V0.topologyMap%s.turnAroundFlag()",track);
407 sprintf(expr,
"V0.topologyMap%s.bit(62)",track);
408 formulate(name,expr);
411 for (
int j=1; j<7; j++) {
412 sprintf(name,
"V0.topologyMap%s.hasHitInSvtLayer(%d)",track,j);
413 sprintf(temp,
"V0.topologyMap%s.bit(%d)\0",track,j);
414 sprintf(expr,
"(!%s)&&(%s)\0",ftpc,temp);
415 formulate(name,expr);
418 if (j<6) tstr +=
"+";
422 sprintf(name,
"V0.topologyMap%s.numOfSvtHits()\0",track);
423 sprintf(expr,
"(!%s)*(%s)\0",ftpc,tstr.Data());
424 formulate(name,expr);
428 sprintf(name,
"V0.topologyMap%s.hasHitInSsd()",track);
429 sprintf(expr,
"V0.topologyMap%s.bit(7)",track);
430 formulate(name,expr);
432 sprintf(temp,
"(!%s)*(\0",ftpc);
436 for (
int j=0; j<45; j++) {
437 sprintf(name,
"V0.topologyMap%s.hasHitInTpcRow(%d)",track,j);
439 sprintf(temp,
"V0.topologyMap%s.bit(%d)\0",track,m);
440 sprintf(expr,
"(!%s)&&(%s)\0",ftpc,temp);
441 formulate(name,expr);
444 if (j<44) tstr +=
"+";
448 sprintf(name,
"V0.topologyMap%s.numOfTpcHits()\0",track);
450 formulate(name,tstr.Data());
454 sprintf(name,
"V0.topologyMap%s.hasHitInMwpc()",track);
455 sprintf(expr,
"V0.topologyMap%s.bit(53)",track);
456 formulate(name,expr);
459 sprintf(name,
"V0.topologyMap%s.hasHitInCtb()",track);
460 sprintf(expr,
"V0.topologyMap%s.bit(54)",track);
461 formulate(name,expr);
464 sprintf(name,
"V0.topologyMap%s.hasHitInTofPatch()",track);
465 sprintf(expr,
"V0.topologyMap%s.bit(55)",track);
466 formulate(name,expr);
469 sprintf(name,
"V0.topologyMap%s.hasHitInRich()",track);
470 sprintf(expr,
"V0.topologyMap%s.bit(56)",track);
471 formulate(name,expr);
474 sprintf(name,
"V0.topologyMap%s.hasHitInBarrelEmc()",track);
475 sprintf(expr,
"V0.topologyMap%s.bit(57)",track);
476 formulate(name,expr);
479 sprintf(name,
"V0.topologyMap%s.hasHitInEndcapEmc()",track);
480 sprintf(expr,
"V0.topologyMap%s.bit(58)",track);
481 formulate(name,expr);
485 formulate(
"V0.chi2V0()",
"V0.mChi2V0");
486 formulate(
"V0.clV0()",
"V0.mClV0");
487 formulate(
"V0.chi2Pos()",
"V0.mChi2Pos");
488 formulate(
"V0.clPos()",
"V0.mClPos");
489 formulate(
"V0.dedxPos()",
"V0.mDedxPos");
490 formulate(
"V0.numDedxPos()",
"V0.mNumDedxPos");
491 formulate(
"V0.chi2Neg()",
"V0.mChi2Neg");
492 formulate(
"V0.clNeg()",
"V0.mClNeg");
493 formulate(
"V0.dedxNeg()",
"V0.mDedxNeg");
494 formulate(
"V0.numDedxNeg()",
"V0.mNumDedxNeg");
499 if (tree->GetBranch(
"V0Mc")) {
500 printf(
"Loading V0Mc formulas...\n");
503 formulate(
"V0Mc.decayLengthV0()",
504 "sqrt(sq(V0Mc.mPositionX-McEvent.mPrimaryVertexX[0])+sq(V0Mc.mPositionY-McEvent.mPrimaryVertexY[0])+sq(V0Mc.mPositionZ-McEvent.mPrimaryVertexZ[0]))");
507 formulate(
"V0Mc.decayMode()",
"V0Mc.mDecayMode");
508 formulate(
"V0Mc.positiveCommonTpcHits()",
"V0Mc.mPositiveCommonTpcHits");
509 formulate(
"V0Mc.positiveSimTpcHits()",
"V0Mc.mPositiveSimTpcHits");
510 formulate(
"V0Mc.negativeCommonTpcHits()",
"V0Mc.mNegativeCommonTpcHits");
511 formulate(
"V0Mc.negativeSimTpcHits()",
"V0Mc.mNegativeSimTpcHits");
512 formulate(
"V0Mc.geantIdParent()",
"V0Mc.mParentGeantId");
513 formulate(
"V0Mc.geantIdPositive()",
"V0Mc.mPositiveGeantId");
514 formulate(
"V0Mc.geantIdNegative()",
"V0Mc.mNegativeGeantId");
515 formulate(
"V0Mc.parentMomentumX()",
"V0Mc.mParentMomentumX");
516 formulate(
"V0Mc.parentMomentumY()",
"V0Mc.mParentMomentumY");
517 formulate(
"V0Mc.parentMomentumZ()",
"V0Mc.mParentMomentumZ");
518 formulate(
"V0Mc.positiveMomentumX()",
"V0Mc.mPositiveMomentumX");
519 formulate(
"V0Mc.positiveMomentumY()",
"V0Mc.mPositiveMomentumY");
520 formulate(
"V0Mc.positiveMomentumZ()",
"V0Mc.mPositiveMomentumZ");
521 formulate(
"V0Mc.negativeMomentumX()",
"V0Mc.mNegativeMomentumX");
522 formulate(
"V0Mc.negativeMomentumY()",
"V0Mc.mNegativeMomentumY");
523 formulate(
"V0Mc.negativeMomentumZ()",
"V0Mc.mNegativeMomentumZ");
524 formulate(
"V0Mc.positionX()",
"V0Mc.mPositionX");
525 formulate(
"V0Mc.positionY()",
"V0Mc.mPositionY");
526 formulate(
"V0Mc.positionZ()",
"V0Mc.mPositionZ");
532 if (tree->GetBranch(
"Xi")) {
533 printf(
"Loading Xi formulas...\n");
535 f0 =
new TFormula(
"mXiMinus",
"1.32133");
536 f0 =
new TFormula(
"mOmegaMinus",
"1.67243");
540 formulate(
"Xi.decayLengthV0()",
541 "sqrt(sq(Xi.mDecayVertexV0X-Xi.mDecayVertexXiX)+sq(Xi.mDecayVertexV0Y-Xi.mDecayVertexXiY)+sq(Xi.mDecayVertexV0Z-Xi.mDecayVertexXiZ))");
545 formulate(
"Xi.decayVertexV0X()",
"Xi.mDecayVertexV0X");
546 formulate(
"Xi.decayVertexV0Y()",
"Xi.mDecayVertexV0Y");
547 formulate(
"Xi.decayVertexV0Z()",
"Xi.mDecayVertexV0Z");
548 formulate(
"Xi.dcaV0Daughters()",
"Xi.mDcaV0Daughters");
549 formulate(
"Xi.dcaV0ToPrimVertex()",
"Xi.mDcaV0ToPrimVertex");
550 formulate(
"Xi.dcaPosToPrimVertex()",
"Xi.mDcaPosToPrimVertex");
551 formulate(
"Xi.dcaNegToPrimVertex()",
"Xi.mDcaNegToPrimVertex");
552 formulate(
"Xi.momPosX()",
"Xi.mMomPosX");
553 formulate(
"Xi.momPosY()",
"Xi.mMomPosY");
554 formulate(
"Xi.momPosZ()",
"Xi.mMomPosZ");
555 formulate(
"Xi.momNegX()",
"Xi.mMomNegX");
556 formulate(
"Xi.momNegY()",
"Xi.mMomNegY");
557 formulate(
"Xi.momNegZ()",
"Xi.mMomNegZ");
559 formulate(
"Xi.radt2V0()",
"sq(Xi.mDecayVertexV0X)+sq(Xi.mDecayVertexV0Y)");
560 formulate(
"Xi.radtV0()",
"sqrt(Xi.radt2V0())");
561 formulate(
"Xi.radV0()",
"sqrt(Xi.radt2V0()+sq(Xi.mDecayVertexV0Z))");
562 formulate(
"Xi.phiV0()",
563 "atan2((Xi.mDecayVertexV0Y-Xi.mDecayVertexXiY),(Xi.mDecayVertexV0X-Xi.mDecayVertexXiX))");
566 formulate(
"Xi.Ptot2Pos()",
567 "(sq(Xi.mMomPosX)+sq(Xi.mMomPosY)+sq(Xi.mMomPosZ))");
568 formulate(
"Xi.Ptot2Neg()",
569 "(sq(Xi.mMomNegX)+sq(Xi.mMomNegY)+sq(Xi.mMomNegZ))");
570 formulate(
"Xi.momV0X()",
"(Xi.mMomPosX+Xi.mMomNegX)");
571 formulate(
"Xi.momV0Y()",
"(Xi.mMomPosY+Xi.mMomNegY)");
572 formulate(
"Xi.momV0Z()",
"(Xi.mMomPosZ+Xi.mMomNegZ)");
573 formulate(
"Xi.Pt2V0()",
"(sq(Xi.momV0X())+sq(Xi.momV0Y()))");
574 formulate(
"Xi.Ptot2V0()",
"(Xi.Pt2V0()+sq(Xi.momV0Z()))");
577 formulate(
"Xi.MomPosAlongV0()",
578 "(((Xi.mMomPosX*Xi.momV0X())+(Xi.mMomPosY*Xi.momV0Y())+(Xi.mMomPosZ*Xi.momV0Z()))/sqrt(Xi.Ptot2V0()))");
579 formulate(
"Xi.MomNegAlongV0()",
580 "(((Xi.mMomNegX*Xi.momV0X())+(Xi.mMomNegY*Xi.momV0Y())+(Xi.mMomNegZ*Xi.momV0Z()))/sqrt(Xi.Ptot2V0()))");
582 formulate(
"Xi.alphaV0()",
585 "1.-(2./(1.+(Xi.MomPosAlongV0()/Xi.MomNegAlongV0())))");
587 formulate(
"Xi.ptArmV0()",
588 "sqrt(Xi.Ptot2Pos()-sq(Xi.MomPosAlongV0()))");
591 formulate(
"Xi.eLambda()",
"sqrt(Xi.Ptot2V0()+sq(mLambda))");
592 formulate(
"Xi.eK0Short()",
"sqrt(Xi.Ptot2V0()+sq(mK0Short))");
593 formulate(
"Xi.ePosProton()",
"sqrt(Xi.Ptot2Pos()+sq(mProton))");
594 formulate(
"Xi.eNegAntiProton()",
"sqrt(Xi.Ptot2Neg()+sq(mAntiProton))");
595 formulate(
"Xi.ePosPion()",
"sqrt(Xi.Ptot2Pos()+sq(mPiPlus))");
596 formulate(
"Xi.eNegPion()",
"sqrt(Xi.Ptot2Neg()+sq(mPiMinus))");
599 formulate(
"Xi.massLambda()",
600 "sqrt(sq(Xi.ePosProton()+Xi.eNegPion())-Xi.Ptot2V0())");
601 formulate(
"Xi.massAntiLambda()",
602 "sqrt(sq(Xi.eNegAntiProton()+Xi.ePosPion())-Xi.Ptot2V0())");
603 formulate(
"Xi.massK0Short()",
604 "sqrt(sq(Xi.ePosPion()+Xi.eNegPion())-Xi.Ptot2V0())");
607 formulate(
"Xi.rapLambda()",
610 "0.5*log(1.+(2./((Xi.eLambda()/Xi.momV0Z())-1.)))");
611 formulate(
"Xi.rapK0Short()",
614 "0.5*log(1.+(2./((Xi.eK0Short()/Xi.momV0Z())-1.)))");
617 formulate(
"Xi.cTauLambda()",
618 "Xi.massLambda()*Xi.decayLengthV0()/sqrt(Xi.Ptot2V0())");
619 formulate(
"Xi.cTauK0Short()",
620 "Xi.massK0Short()*Xi.decayLengthV0()/sqrt(Xi.Ptot2V0())");
622 formulate(
"Xi.ptPos()",
"sqrt(sq(Xi.mMomPosX)+sq(Xi.mMomPosY))");
623 formulate(
"Xi.ptotPos()",
"sqrt(Xi.Ptot2Pos())");
624 formulate(
"Xi.ptNeg()",
"sqrt(sq(Xi.mMomNegX)+sq(Xi.mMomNegY))");
625 formulate(
"Xi.ptotNeg()",
"sqrt(Xi.Ptot2Neg())");
626 formulate(
"Xi.ptV0()",
"sqrt(Xi.Pt2V0())");
627 formulate(
"Xi.ptotV0()",
"sqrt(Xi.Ptot2V0())");
628 formulate(
"Xi.thetaV0()",
"acos(Xi.momV0Z()/Xi.ptotV0())");
629 formulate(
"Xi.pseudoRapV0()",
"-log(tan(Xi.thetaV0()/2.))");
630 formulate(
"Xi.psiV0()",
"atan2(Xi.momV0Y(),Xi.momV0X())");
633 formulate(
"Xi.chi2V0()",
"Xi.mChi2V0");
634 formulate(
"Xi.clV0()",
"Xi.mClV0");
635 formulate(
"Xi.chi2Pos()",
"Xi.mChi2Pos");
636 formulate(
"Xi.dedxPos()",
"Xi.mDedxPos");
637 formulate(
"Xi.numDedxPos()",
"Xi.mNumDedxPos");
638 formulate(
"Xi.clPos()",
"Xi.mClPos");
639 formulate(
"Xi.chi2Neg()",
"Xi.mChi2Neg");
640 formulate(
"Xi.clNeg()",
"Xi.mClNeg");
641 formulate(
"Xi.dedxNeg()",
"Xi.mDedxNeg");
642 formulate(
"Xi.numDedxNeg()",
"Xi.mNumDedxNeg");
648 formulate(
"Xi.decayLengthXi()",
649 "sqrt(sq(Xi.mDecayVertexXiX-Event.mPrimaryVertexX[0])+sq(Xi.mDecayVertexXiY-Event.mPrimaryVertexY[0])+sq(Xi.mDecayVertexXiZ-Event.mPrimaryVertexZ[0]))");
652 formulate(
"Xi.charge()",
"Xi.mCharge");
653 formulate(
"Xi.decayVertexXiX()",
"Xi.mDecayVertexXiX");
654 formulate(
"Xi.decayVertexXiY()",
"Xi.mDecayVertexXiY");
655 formulate(
"Xi.decayVertexXiZ()",
"Xi.mDecayVertexXiZ");
656 formulate(
"Xi.dcaXiDaughters()",
"Xi.mDcaXiDaughters");
657 formulate(
"Xi.dcaXiToPrimVertex()",
"Xi.mDcaXiToPrimVertex");
658 formulate(
"Xi.dcaBachelorToPrimVertex()",
"Xi.mDcaBachelorToPrimVertex");
659 formulate(
"Xi.momBachelorX()",
"Xi.mMomBachelorX");
660 formulate(
"Xi.momBachelorY()",
"Xi.mMomBachelorY");
661 formulate(
"Xi.momBachelorZ()",
"Xi.mMomBachelorZ");
662 formulate(
"Xi.momXiX()",
"Xi.mMomBachelorX+Xi.momV0X()");
663 formulate(
"Xi.momXiY()",
"Xi.mMomBachelorY+Xi.momV0Y()");
664 formulate(
"Xi.momXiZ()",
"Xi.mMomBachelorZ+Xi.momV0Z()");
665 formulate(
"Xi.keyBachelor()",
"Xi.mKeyBachelor");
667 formulate(
"Xi.radt2Xi()",
"sq(Xi.mDecayVertexXiX)+sq(Xi.mDecayVertexXiY)");
668 formulate(
"Xi.radtXi()",
"sqrt(Xi.radt2Xi())");
669 formulate(
"Xi.radXi()",
"sqrt(Xi.radt2Xi()+sq(Xi.mDecayVertexXiZ))");
670 formulate(
"Xi.phiXi()",
671 "atan2((Xi.mDecayVertexXiY-Event.mPrimaryVertexY[0]),(Xi.mDecayVertexXiX-Event.mPrimaryVertexX[0]))");
673 formulate(
"Xi.Ptot2Bachelor()",
674 "(sq(Xi.mMomBachelorX)+sq(Xi.mMomBachelorY)+sq(Xi.mMomBachelorZ))");
675 formulate(
"Xi.Pt2Xi()",
"(sq(Xi.momXiX())+sq(Xi.momXiY()))");
676 formulate(
"Xi.Ptot2Xi()",
"(Xi.Pt2Xi()+sq(Xi.momXiZ()))");
679 formulate(
"Xi.MomBachelorAlongXi()",
680 "(((Xi.mMomBachelorX*Xi.momXiX())+(Xi.mMomBachelorY*Xi.momXiY())+(Xi.mMomBachelorZ*Xi.momXiZ()))/sqrt(Xi.Ptot2Xi()))");
681 formulate(
"Xi.MomV0AlongXi()",
682 "(((Xi.momV0X()*Xi.momXiX())+(Xi.momV0Y()*Xi.momXiY())+(Xi.momV0Z()*Xi.momXiZ()))/sqrt(Xi.Ptot2Xi()))");
684 formulate(
"Xi.alphaXi()",
687 "Xi.mCharge*(1.-(2./(1.+(Xi.MomBachelorAlongXi()/Xi.MomV0AlongXi()))))");
689 formulate(
"Xi.ptArmXi()",
690 "sqrt(Xi.Ptot2V0()-sq(Xi.MomV0AlongXi()))");
693 formulate(
"Xi.eXi()",
"sqrt(Xi.Ptot2Xi()+sq(mXiMinus))");
694 formulate(
"Xi.eOmega()",
"sqrt(Xi.Ptot2Xi()+sq(mOmegaMinus))");
695 formulate(
"Xi.eBachelorPion()",
"sqrt(Xi.Ptot2Bachelor()+sq(mPiMinus))");
696 formulate(
"Xi.eBachelorKaon()",
"sqrt(Xi.Ptot2Bachelor()+sq(mKaonMinus))");
699 formulate(
"Xi.massXi()",
700 "sqrt(sq(Xi.eLambda()+Xi.eBachelorPion())-Xi.Ptot2Xi())");
701 formulate(
"Xi.massOmega()",
702 "sqrt(sq(Xi.eLambda()+Xi.eBachelorKaon())-Xi.Ptot2Xi())");
705 formulate(
"Xi.rapXi()",
708 "0.5*log(1.+(2./((Xi.eXi()/Xi.momXiZ())-1.)))");
709 formulate(
"Xi.rapOmega()",
712 "0.5*log(1.+(2./((Xi.eOmega()/Xi.momXiZ())-1.)))");
715 formulate(
"Xi.cTauXi()",
716 "Xi.massXi()*Xi.decayLengthXi()/sqrt(Xi.Ptot2Xi())");
717 formulate(
"Xi.cTauOmega()",
718 "Xi.massOmega()*Xi.decayLengthXi()/sqrt(Xi.Ptot2Xi())");
720 formulate(
"Xi.ptBachelor()",
721 "sqrt(sq(Xi.mMomBachelorX)+sq(Xi.mMomBachelorY))");
722 formulate(
"Xi.ptotBachelor()",
"sqrt(Xi.Ptot2Bachelor())");
723 formulate(
"Xi.ptXi()",
"sqrt(Xi.Pt2Xi())");
724 formulate(
"Xi.ptotXi()",
"sqrt(Xi.Ptot2Xi())");
725 formulate(
"Xi.thetaXi()",
"acos(Xi.momXiZ()/Xi.ptotXi())");
726 formulate(
"Xi.pseudoRapXi()",
"-log(tan(Xi.thetaXi()/2.))");
727 formulate(
"Xi.psiXi()",
"atan2(Xi.momXiY(),Xi.momXiX())");
732 if (tree->GetBranch(
"Xi.mTopologyMapBachelor.mMap0")) {
733 for (
int k=0; k<3; k++) {
734 if (k==2) sprintf(track,
"Bachelor\0");
735 else if (k==1) sprintf(track,
"Neg\0");
736 else sprintf(track,
"Pos\0");
740 for (
int l=0; l<2; l++) {
741 for (
int j=0; j<32; j++) {
743 sprintf(name,
"Xi.topologyMap%s.bit(%d)\0",track,m);
744 sprintf(expr,
"(Xi.mTopologyMap%s.mMap%d/(2^%d))&1\0",track,l,j);
745 formulate(name,expr);
749 sprintf(name,
"Xi.topologyMap%s.data(%d)",track,l);
750 sprintf(expr,
"Xi.mTopologyMap%s.mMap%d",track,l);
751 formulate(name,expr);
755 sprintf(ftpc,
"Xi.topologyMap%s.ftpcFormat()",track);
756 sprintf(expr,
"Xi.topologyMap%s.bit(63)",track);
757 formulate(ftpc,expr);
760 sprintf(name,
"Xi.topologyMap%s.primaryVertexUsed()",track);
761 sprintf(expr,
"Xi.topologyMap%s.bit(0)",track);
762 formulate(name,expr);
765 sprintf(name,
"Xi.topologyMap%s.turnAroundFlag()",track);
766 sprintf(expr,
"Xi.topologyMap%s.bit(62)",track);
767 formulate(name,expr);
770 for (
int j=1; j<7; j++) {
771 sprintf(name,
"Xi.topologyMap%s.hasHitInSvtLayer(%d)",track,j);
772 sprintf(temp,
"Xi.topologyMap%s.bit(%d)\0",track,j);
773 sprintf(expr,
"(!%s)&&(%s)\0",ftpc,temp);
774 formulate(name,expr);
777 if (j<6) tstr +=
"+";
781 sprintf(name,
"Xi.topologyMap%s.numOfSvtHits()\0",track);
782 sprintf(expr,
"(!%s)*(%s)\0",ftpc,tstr.Data());
783 formulate(name,expr);
787 sprintf(name,
"Xi.topologyMap%s.hasHitInSSD()",track);
788 sprintf(expr,
"Xi.topologyMap%s.bit(7)",track);
789 formulate(name,expr);
791 sprintf(temp,
"(!%s)*(\0",ftpc);
795 for (
int j=0; j<45; j++) {
796 sprintf(name,
"Xi.topologyMap%s.hasHitInTpcRow(%d)",track,j);
798 sprintf(temp,
"Xi.topologyMap%s.bit(%d)\0",track,m);
799 sprintf(expr,
"(!%s)&&(%s)\0",ftpc,temp);
800 formulate(name,expr);
803 if (j<44) tstr +=
"+";
807 sprintf(name,
"Xi.topologyMap%s.numOfTpcHits()\0",track);
809 formulate(name,tstr.Data());
813 sprintf(name,
"Xi.topologyMap%s.hasHitInMwpc()",track);
814 sprintf(expr,
"Xi.topologyMap%s.bit(53)",track);
815 formulate(name,expr);
818 sprintf(name,
"Xi.topologyMap%s.hasHitInCtb()",track);
819 sprintf(expr,
"Xi.topologyMap%s.bit(54)",track);
820 formulate(name,expr);
823 sprintf(name,
"Xi.topologyMap%s.hasHitInTofPatch()",track);
824 sprintf(expr,
"Xi.topologyMap%s.bit(55)",track);
825 formulate(name,expr);
828 sprintf(name,
"Xi.topologyMap%s.hasHitInRich()",track);
829 sprintf(expr,
"Xi.topologyMap%s.bit(56)",track);
830 formulate(name,expr);
833 sprintf(name,
"Xi.topologyMap%s.hasHitInBarrelEmc()",track);
834 sprintf(expr,
"Xi.topologyMap%s.bit(57)",track);
835 formulate(name,expr);
838 sprintf(name,
"Xi.topologyMap%s.hasHitInEndcapEmc()",track);
839 sprintf(expr,
"Xi.topologyMap%s.bit(58)",track);
840 formulate(name,expr);
845 formulate(
"Xi.chi2Xi()",
"Xi.mChi2Xi");
846 formulate(
"Xi.clXi()",
"Xi.mClXi");
847 formulate(
"Xi.chi2Bachelor()",
"Xi.mChi2Bachelor");
848 formulate(
"Xi.clBachelor()",
"Xi.mClBachelor");
849 formulate(
"Xi.dedxBachelor()",
"Xi.mDedxBachelor");
850 formulate(
"Xi.numDedxBachelor()",
"Xi.mNumDedxBachelor");
855 if (tree->GetBranch(
"XiMc")) {
856 printf(
"Loading XiMc formulas...\n");
859 formulate(
"XiMc.decayLengthXi()",
860 "sqrt(sq(XiMc.mPositionX-McEvent.mPrimaryVertexX[0])+sq(XiMc.mPositionY-McEvent.mPrimaryVertexY[0])+sq(XiMc.mPositionZ-McEvent.mPrimaryVertexZ[0]))");
863 formulate(
"XiMc.decayMode()",
"XiMc.mDecayMode");
864 formulate(
"XiMc.commonTpcHits()",
"XiMc.mCommonTpcHits");
865 formulate(
"XiMc.simTpcHits()",
"XiMc.mSimTpcHits");
866 formulate(
"XiMc.geantIdParent()",
"XiMc.mParentGeantId");
867 formulate(
"XiMc.geantIdDaughter()",
"XiMc.mDaughterGeantId");
868 formulate(
"XiMc.parentMomentumX()",
"XiMc.mParentMomentumX");
869 formulate(
"XiMc.parentMomentumY()",
"XiMc.mParentMomentumY");
870 formulate(
"XiMc.parentMomentumZ()",
"XiMc.mParentMomentumZ");
871 formulate(
"XiMc.daughterMomentumX()",
"XiMc.mDaughterMomentumX");
872 formulate(
"XiMc.daughterMomentumY()",
"XiMc.mDaughterMomentumY");
873 formulate(
"XiMc.daughterMomentumZ()",
"XiMc.mDaughterMomentumZ");
874 formulate(
"XiMc.positionX()",
"XiMc.mPositionX");
875 formulate(
"XiMc.positionY()",
"XiMc.mPositionY");
876 formulate(
"XiMc.positionZ()",
"XiMc.mPositionZ");
882 if (tree->GetBranch(
"Kink")) {
883 printf(
"Loading Kink formulas...\n");
888 if (tree->GetBranch(
"KinkMc")) {
889 printf(
"Loading KinkMc formulas...\n");
892 formulate(
"KinkMc.decayMode()",
"KinkMc.mDecayMode");
893 formulate(
"KinkMc.commonTpcHits()",
"KinkMc.mCommonTpcHits");
894 formulate(
"KinkMc.simTpcHits()",
"KinkMc.mSimTpcHits");
895 formulate(
"KinkMc.geantIdParent()",
"KinkMc.mParentGeantId");
896 formulate(
"KinkMc.geantIdDaughter()",
"KinkMc.mDaughterGeantId");
897 formulate(
"KinkMc.parentMomentumX()",
"KinkMc.mParentMomentumX");
898 formulate(
"KinkMc.parentMomentumY()",
"KinkMc.mParentMomentumY");
899 formulate(
"KinkMc.parentMomentumZ()",
"KinkMc.mParentMomentumZ");
900 formulate(
"KinkMc.daughterMomentumX()",
"KinkMc.mDaughterMomentumX");
901 formulate(
"KinkMc.daughterMomentumY()",
"KinkMc.mDaughterMomentumY");
902 formulate(
"KinkMc.daughterMomentumZ()",
"KinkMc.mDaughterMomentumZ");
903 formulate(
"KinkMc.positionX()",
"KinkMc.mPositionX");
904 formulate(
"KinkMc.positionY()",
"KinkMc.mPositionY");
905 formulate(
"KinkMc.positionZ()",
"KinkMc.mPositionZ");
909 Int_t finalFormulas = ListofFuncs->GetSize();
910 return (finalFormulas-initialFormulas);