//#include "UserTreeAnalysis.H" // remove if copied to user working directory #include #include #include #include #include #include "MC4Vector.H" #include "HEPParticle.H" #include "TH1.h" #include "Setup.H" #include "TObjArray.h" #include "TMath.h" using namespace std; // very similar to MC_FillUserHistogram from MC-TESTER/src/Generate.cxx // it fills or defines (if missing) new TH1D histogram (root) inline void fillUserHisto(char *name,double val, double weight=1.0, double min=Setup::bin_min[0][0], double max=Setup::bin_max[0][0]){ TH1D *h=(TH1D*)(Setup::user_histograms->FindObject(name)); if(!h){ // define new histogram (if missing) h=new TH1D(name,name,Setup::nbins[0][0],min,max); if(!h) return; Setup::user_histograms->Add(h); // printf("user histogram created %s\n", name); } // fill histogram h->Fill(val,weight); } // print 3-vector. Note that 'v' is in fact 4-vector with energy= v[3] and momenta= v[0] - v[2] because // of loading with fortran libraries void print(double * v){ cout << "("< tau+ tau-, then tau+- -> rho+- nu_tau -> pi+- pi0 nu_tau. If other events are fed, code will fail (unpredictably). NOTE: variable names in the function below can be misleading!! (they were copied over from other analysis...) */ int CPtestUserTreeAnalysis(HEPParticle *mother, HEPParticleList *stableDaughters, int nparams, double *params) { // taking info from event into local variables: // ============================================= // all information is taken from list of stable dauhters // of `something'. We do not have taus, we do not know what is primary mother of each pi0. assert(mother!=0); assert(stableDaughters!=0); HEPParticleListIterator daughters(*stableDaughters); // four vectors for the pions. // We declare two copies; for convenience of function types. // Also for simultaneous use of pion 4-momenta in rho-pair frame and tau-s rest frames (optional). double pi_plus[4]={0}; double pi_minus[4]={0}; double pi0_plus[4]={0}; double pi0_minus[4]={0}; MC4Vector d_pi0_plus; MC4Vector d_pi0_minus; MC4Vector d_pi_plus; MC4Vector d_pi_minus; // variables to store the 4-vector of the rho+ rho- pair center of mass syst. double cm_px=0; double cm_py=0; double cm_pz=0; double cm_e=0; // variables to store tau+ 4-momentum double taup_px=0; double taup_py=0; double taup_pz=0; double taup_e=0; // variables to store tau- 4-momentum double taum_px=0; double taum_py=0; double taum_pz=0; double taum_e=0; // loop over all daughters and sort them by type. Copy into local variables // resconstruct tau+- and cm 4-momenta for (HEPParticle *part=daughters.first(); part!=0; part=daughters.next()){ if(part->GetPDGId()!=16&&part->GetPDGId()!=-16){ // sum decay product into rho-pair 4-vector (neutrinos are to be excluded) cm_px+=part->GetPx(); cm_py+=part->GetPy(); cm_pz+=part->GetPz(); cm_e+=part->GetE(); } MC4Vector p4=part->GetP4(); // identify decay products ad sum them to the corresponding tau+ tau- momenta switch(part->GetPDGId()){ case 211: d_pi_plus.Set(&p4); d_pi_plus.SetM(part->GetM()); taup_px+=part->GetPx(); taup_py+=part->GetPy(); taup_pz+=part->GetPz(); taup_e+=part->GetE(); break; case 16: taum_px+=part->GetPx(); taum_py+=part->GetPy(); taum_pz+=part->GetPz(); taum_e+=part->GetE(); break; case -16: taup_px+=part->GetPx(); taup_py+=part->GetPy(); taup_pz+=part->GetPz(); taup_e+=part->GetE(); break; case -211: d_pi_minus.Set(&p4); d_pi_minus.SetM(part->GetM()); taum_px+=part->GetPx(); taum_py+=part->GetPy(); taum_pz+=part->GetPz(); taum_e+=part->GetE(); break; case 111: //fill the pi0's at this moment we do not know if it belongs to tau+ or tau- if(d_pi0_minus.GetX1()==0&&d_pi0_minus.GetX2()==0&&d_pi0_minus.GetX3()==0){ d_pi0_minus.Set(&p4); d_pi0_minus.SetM(part->GetM()); } else{ d_pi0_plus.Set(&p4); d_pi0_plus.SetM(part->GetM()); } break; } } // Now check which pi0 is associated with // which pi+/-. Use the angle to decide. double costheta1 = dot_product(d_pi_plus,d_pi0_plus)/(d_pi_plus.Length()*d_pi0_plus.Length()); double costheta2 = dot_product(d_pi_minus,d_pi0_plus)/(d_pi_minus.Length()*d_pi0_plus.Length()); if(costheta10) sprintf(plotname,"acoplanarity-angle-C"); else sprintf(plotname,"acoplanarity-angle-D"); fillUserHisto(plotname,theta,WT,0,2*M_PI); delete plotname; return 0; };