// $Id: hrichcutpairsim.cc,v 1.5 2004-10-15 08:25:22 eberl Exp $ // Last update by Thomas Eberl: 04/07/12 18:19:21 // using namespace std; #include #include #include #include #include #include #include #include #include "hdihitmatchsim.h" #include "hhitmatchsim.h" #include "phyanadef.h" #include "hrichcutpairsim.h" #include "hrichcuto.h" #include "hkicktrack.h" #include "kickdef.h" #include "hlinearcategory.h" #include "hrichutilfunc.h" #include "richdef.h" #include "htrackinfo.h" #include "hparticle.h" #include "hrichhit.h" #include "hades.h" #include "hiterator.h" #include "hcategory.h" #include "hphysicsconstants.h" #include "hrecevent.h" #include "hlocation.h" HRichCutPairSim::HRichCutPairSim() : HRichCutPair() { } HRichCutPairSim::HRichCutPairSim(Text_t *name, Text_t *title) : HRichCutPair(name, title) { isExp=kFALSE; isSim=kFALSE; setStandardCuts(); TDatime dt; dt.Set(); TString stitle(title); stitle.Append("_"); stitle+=dt.GetDate(); stitle.Append("_"); stitle+=dt.GetTime(); SetTitle(stitle.Data()); } Bool_t HRichCutPairSim::switchTo(const char *s,Bool_t clear) { //cout<<"RichCutPairSim::switchTo: "<GetName()<<" not found"<getObject(h->getIndTrk1()); if (!t1) Error("isConvPair","HHitMatchSim object 1 not found"); t2 = (HHitMatchSim*)cat->getObject(h->getIndTrk2()); if (!t2) Error("isConvPair","HHitMatchSim object 2 not found"); } else Error("isConvPair","no category found"); if (t1) tt1 = t1->getTrackInfoObj(); if (t2) tt2 = t2->getTrackInfoObj(); if (tt1&&tt2) { for (Int_t i=0;igetConvLep(i)==1) { Int_t c1 = tt1->calcCorrCode(i); // first particle is conv for (Int_t j=0;jcalcCorrCode(j); if ( c1==4 && c2==4 && tt2->getConvLep(j)==1 && // 2nd part is conv tt2->getParId(j)+tt1->getParId(i)==5 && // is e+ e- tt1->getCreaTrkNb(i)!=-1 && tt2->getCreaTrkNb(j)!=-1 && tt1->getCreaTrkNb(i)==tt2->getCreaTrkNb(j) &&// same mother tt1->getCreaId(i) == 1 // mother is gamma ) { ret_val = kTRUE; break; } } } } } else Error("isConvPair","HTrackInfo objects not found"); return ret_val; } Bool_t HRichCutPairSim::isDalitzPair(HDiHitMatchSim* h) { Bool_t ret_val=kFALSE; HLinearCategory * cat = (HLinearCategory*) HRichUtilFunc::getCategory(catMatchHit); HHitMatchSim *t1 = 0; HHitMatchSim *t2 = 0; HTrackInfo * tt1 = 0; HTrackInfo * tt2 = 0; if (cat) { t1 = (HHitMatchSim*)cat->getObject(h->getIndTrk1()); if (!t1) Error("isConvPair","HHitMatchSim object 1 not found"); t2 = (HHitMatchSim*)cat->getObject(h->getIndTrk2()); if (!t2) Error("isConvPair","HHitMatchSim object 2 not found"); } else Error("isDalitzPair","no category found"); if (t1) tt1 = t1->getTrackInfoObj(); if (t2) tt2 = t2->getTrackInfoObj(); if (tt1&&tt2) { for (Int_t i=0;igetPi0Dalitz(i)==1) { Int_t c1 = tt1->calcCorrCode(i); // first particle is dalitz for (Int_t j=0;jcalcCorrCode(j); if ( c1==4 && c2==4 && tt2->getPi0Dalitz(j)==1 && // 2nd part is dalitz tt2->getParId(j)+tt1->getParId(i)==5 && // is e+ e- tt1->getCreaTrkNb(i)!=-1 && tt2->getCreaTrkNb(j)!=-1 && tt1->getCreaTrkNb(i)==tt2->getCreaTrkNb(j) &&// same mother tt1->getCreaId(i) == 7 // mother is pi0 ) { ret_val = kTRUE; break; } } } } } else Error("isConvPair","HTrackInfo objects not found"); return ret_val; } Bool_t HRichCutPairSim::isEtaDalitzPair(HDiHitMatchSim* h) { Bool_t ret_val=kFALSE; HLinearCategory * cat = (HLinearCategory*) HRichUtilFunc::getCategory(catMatchHit); HHitMatchSim *t1 = 0; HHitMatchSim *t2 = 0; HTrackInfo * tt1 = 0; HTrackInfo * tt2 = 0; if (cat) { t1 = (HHitMatchSim*)cat->getObject(h->getIndTrk1()); if (!t1) Error("isConvPair","HHitMatchSim object 1 not found"); t2 = (HHitMatchSim*)cat->getObject(h->getIndTrk2()); if (!t2) Error("isConvPair","HHitMatchSim object 2 not found"); } else Error("isDalitzPair","no category found"); if (t1) tt1 = t1->getTrackInfoObj(); if (t2) tt2 = t2->getTrackInfoObj(); if (tt1&&tt2) { for (Int_t i=0;igetCreaId(i) == 17) { Int_t c1 = tt1->calcCorrCode(i); // first particle is eta dalitz for (Int_t j=0;jcalcCorrCode(j); if ( c1==4 && c2==4 && tt2->getParId(j)+tt1->getParId(i)==5 && // is e+ e- tt1->getCreaTrkNb(i)!=-1 && tt2->getCreaTrkNb(j)!=-1 && tt1->getCreaTrkNb(i)==tt2->getCreaTrkNb(j) &&// same mother tt2->getCreaId(j) == 17 // mother is pi0 ) { ret_val = kTRUE; break; } } } } } else Error("isConvPair","HTrackInfo objects not found"); return ret_val; } void HRichCutPairSim::getDalitzPairTrkNb(HDiHitMatchSim* h,Int_t &a, Int_t &b) { HLinearCategory * cat = (HLinearCategory*) HRichUtilFunc::getCategory(catMatchHit); HHitMatchSim *t1 = 0; HHitMatchSim *t2 = 0; HTrackInfo * tt1 = 0; HTrackInfo * tt2 = 0; if (cat) { t1 = (HHitMatchSim*)cat->getObject(h->getIndTrk1()); if (!t1) Error("isConvPair","HHitMatchSim object 1 not found"); t2 = (HHitMatchSim*)cat->getObject(h->getIndTrk2()); if (!t2) Error("isConvPair","HHitMatchSim object 2 not found"); } else Error("isDalitzPair","no category found"); if (t1) tt1 = t1->getTrackInfoObj(); if (t2) tt2 = t2->getTrackInfoObj(); if (tt1&&tt2) { for (Int_t i=0;igetPi0Dalitz(i)==1) { Int_t c1 = tt1->calcCorrCode(i); // first particle is dalitz for (Int_t j=0;jcalcCorrCode(j); if ( c1==4 && c2==4 && tt2->getPi0Dalitz(j)==1 && // 2nd part is dalitz tt2->getParId(j)+tt1->getParId(i)==5 && // is e+ e- tt1->getCreaTrkNb(i)!=-1 && tt2->getCreaTrkNb(j)!=-1 && tt1->getCreaTrkNb(i)==tt2->getCreaTrkNb(j) &&// same mother tt1->getCreaId(i) == 7 // mother is pi0 ) { a = tt1->getTrkNb(i); b = tt2->getTrkNb(j); break; } } } } } else Error("isConvPair","HTrackInfo objects not found"); } void HRichCutPairSim::getConvPairTrkNb(HDiHitMatchSim* h,Int_t &a, Int_t &b) { HLinearCategory * cat = (HLinearCategory*) HRichUtilFunc::getCategory(catMatchHit); HHitMatchSim *t1 = 0; HHitMatchSim *t2 = 0; HTrackInfo * tt1 = 0; HTrackInfo * tt2 = 0; if (cat) { t1 = (HHitMatchSim*)cat->getObject(h->getIndTrk1()); if (!t1) Error("isConvPair","HHitMatchSim object 1 not found"); t2 = (HHitMatchSim*)cat->getObject(h->getIndTrk2()); if (!t2) Error("isConvPair","HHitMatchSim object 2 not found"); } else Error("isDalitzPair","no category found"); if (t1) tt1 = t1->getTrackInfoObj(); if (t2) tt2 = t2->getTrackInfoObj(); if (tt1&&tt2) { for (Int_t i=0;igetConvLep(i)==1) { Int_t c1 = tt1->calcCorrCode(i); // first particle is conv for (Int_t j=0;jcalcCorrCode(j); if ( c1==4 && c2==4 && tt2->getConvLep(j)==1 && // 2nd part is dalitz tt2->getParId(j)+tt1->getParId(i)==5 && // is e+ e- tt1->getCreaTrkNb(i)!=-1 && tt2->getCreaTrkNb(j)!=-1 && tt1->getCreaTrkNb(i)==tt2->getCreaTrkNb(j) &&// same mother tt1->getCreaId(i) == 1 // mother is pi0 ) { a = tt1->getTrkNb(i); b = tt2->getTrkNb(j); break; } } } } } else Error("isConvPair","HTrackInfo objects not found"); } Bool_t HRichCutPairSim::isAllCombiPair(HDiHitMatchSim* h) { HRichCutPair c("default","default"); c.switchTo("2matchedGoodRing");c.switchTo("unlike",kFALSE); c.switchTo("2fast",kFALSE); if (h) { if (!c.check((HDiHitMatch*)h)) return kFALSE; } else Error("isCombiPair","HDiHitMatch object not found"); Bool_t ret_val=kTRUE; HLinearCategory * cat = (HLinearCategory*) HRichUtilFunc::getCategory(catMatchHit); HHitMatchSim *t1 = 0; HHitMatchSim *t2 = 0; HTrackInfo * tt1 = 0; HTrackInfo * tt2 = 0; if (cat) { t1 = (HHitMatchSim*)cat->getObject(h->getIndTrk1()); if (!t1) Error("isCombiPair","HHitMatchSim object 1 not found"); t2 = (HHitMatchSim*)cat->getObject(h->getIndTrk2()); if (!t2) Error("isCombiPair","HHitMatchSim object 2 not found"); } else Error("isCombiPair","no category found"); if (t1) tt1 = t1->getTrackInfoObj(); if (t2) tt2 = t2->getTrackInfoObj(); if (tt1&&tt2) { Int_t cc1=-1; Int_t cc2=-1; for (Int_t i=0;igetTrkNb(i)!=-1 && tt1->calcCorrCode(i)==4) cc1=i; if (tt2->getTrkNb(i)!=-1 && tt2->calcCorrCode(i)==4) cc2=i; } if ( cc1 != -1 && cc2 != -1) // two fully GEANT confirmed tracks { // tt1->dumpToStdout(); // tt2->dumpToStdout(); if (tt1->getCreaTrkNb(cc1) == tt2->getCreaTrkNb(cc2) && //same parent tt1->getTrkNb(cc1) != tt2->getTrkNb(cc2) ) //diff particles { // cout<<"///////////////////////////"<dumpToStdout(); // t1->dumpToStdoutSim(); // //tt2->dumpToStdout(); // t2->dumpToStdoutSim(); // cout<<"///////////////////////////"<getPartNr()<<" "<getPartNr()<getPartNr()!=1 && tt2->getPartNr()!=1) return kFALSE; // if (h->getInvMass()<1) return kFALSE; // for (Int_t i=0;igetMatchedMT_S(i)==1 && tt2->getMatchedMT_S(j)==1) // one track is a fake kicktrack // // //{ // if( // tt1->getCreaTrkNb(i)==-1 || // tt2->getCreaTrkNb(j)==-1 // ) ret_val=kFALSE; // else // { // if(tt1->getCreaTrkNb(i)!=-1 && tt2->getCreaTrkNb(j)!=-1 && // tt1->getCreaTrkNb(i)==tt2->getCreaTrkNb(j)) // same mother // { // return kFALSE; // } // else if (tt1->getCreaTrkNb(i)!=-1 && tt2->getCreaTrkNb(j)!=-1 && // tt1->getCreaTrkNb(i)!=tt2->getCreaTrkNb(j)) // { // //h->dumpToStdoutSim(); // //tt1->dumpToStdout(); // //tt2->dumpToStdout(); // return kTRUE; // //if (tt1->getMatchedRMT_S(i)==1 && tt2->getMatchedRMT_S(j)==1) return kTRUE; // //if (tt1->getMatchedRM(i)==1 && tt2->getMatchedRM(j)==1) return kTRUE; // // if (tt1->getParId(i)>3 || tt2->getParId(j)>3) return kFALSE; // //else return kFALSE; // // // else ret_val=kFALSE;// one track is a fake kicktrack // // cout<<"&&&&&&&&&&&&&&&&&&&&&&&&&"<dumpToStdout(); // // tt2->dumpToStdout(); // // cout<<"&&&&&&&&&&&&&&&&&&&&&&&&&"<getObject(h->getIndTrk1()); if (!t1) Error("isCombiPair","HHitMatchSim object 1 not found"); t2 = (HHitMatchSim*)cat->getObject(h->getIndTrk2()); if (!t2) Error("isCombiPair","HHitMatchSim object 2 not found"); } else Error("isCombiPair","no category found"); if (t1) tt1 = t1->getTrackInfoObj(); if (t2) tt2 = t2->getTrackInfoObj(); if (tt1&&tt2) { if(h->getInvMass()<1) return kFALSE; for (Int_t i=0;igetParId(j)==2 && tt1->getParId(i)==3) || (tt2->getParId(j)==3 && tt1->getParId(i)==2) || (tt2->getParId(j)==2 && tt1->getParId(i)==2) || (tt2->getParId(j)==3 && tt1->getParId(i)==3) ) // is lepton pair { if( tt1->getCreaTrkNb(i)!=-1 && tt2->getCreaTrkNb(j)!=-1 && tt1->getCreaTrkNb(i)==tt2->getCreaTrkNb(j) // same mother ) { ret_val = kFALSE;//lepton pair with same parent, signal !, not CB break; } } else ret_val = kFALSE; // not a lepton pair, not part of CB } } } else Error("isCombiPair","HTrackInfo objects not found"); return ret_val; } Bool_t HRichCutPairSim::isFakePair(HDiHitMatchSim* h) { Bool_t ret_val=kTRUE; HLinearCategory * cat = (HLinearCategory*) HRichUtilFunc::getCategory(catMatchHit); HHitMatchSim *t1 = 0; HHitMatchSim *t2 = 0; HTrackInfo * tt1 = 0; HTrackInfo * tt2 = 0; if (cat) { t1 = (HHitMatchSim*)cat->getObject(h->getIndTrk1()); if (!t1) Error("isFakePair","HHitMatchSim object 1 not found"); t2 = (HHitMatchSim*)cat->getObject(h->getIndTrk2()); if (!t2) Error("isFakePair","HHitMatchSim object 2 not found"); } else Error("isFakePair","no category found"); if (t1) tt1 = t1->getTrackInfoObj(); if (t2) tt2 = t2->getTrackInfoObj(); if (tt1&&tt2) { for (Int_t i=0;icalcCorrCode(i); // first particle is dalitz for (Int_t j=0;jcalcCorrCode(j); if (c1==4 && c2==4) { ret_val = kFALSE; break; } } } } else Error("isFakePair","HTrackInfo objects not found"); return ret_val; } Bool_t HRichCutPairSim::isPhysCBPair(HDiHitMatchSim* h) { Bool_t ret_val=kFALSE; HLinearCategory * cat = (HLinearCategory*) HRichUtilFunc::getCategory(catMatchHit); HHitMatchSim *t1 = 0; HHitMatchSim *t2 = 0; HTrackInfo * tt1 = 0; HTrackInfo * tt2 = 0; if (cat) { t1 = (HHitMatchSim*)cat->getObject(h->getIndTrk1()); if (!t1) Error("isPhysCBPair","HHitMatchSim object 1 not found"); t2 = (HHitMatchSim*)cat->getObject(h->getIndTrk2()); if (!t2) Error("isPhysCBPair","HHitMatchSim object 2 not found"); } else Error("isPhysCBPair","no category found"); if (t1) tt1 = t1->getTrackInfoObj(); if (t2) tt2 = t2->getTrackInfoObj(); if (tt1&&tt2) { for (Int_t i=0;icalcCorrCode(i); // first particle is eta dalitz for (Int_t j=0;jcalcCorrCode(j); if ( c1==4 && c2==4 && tt2->getParId(j)+tt1->getParId(i)==5 && // is e+ e- tt1->getCreaTrkNb(i)!=-1 && tt2->getCreaTrkNb(j)!=-1 && tt1->getCreaTrkNb(i)!=tt2->getCreaTrkNb(j) // not same mother ) { ret_val = kTRUE; break; } } } } else Error("isConvPair","HTrackInfo objects not found"); return ret_val; } ClassImp(HRichCutPairSim)