void CRes::SetCache(Int_t i, TComplex c) { if (i>0 && i<fnCache) { fCacheRe[i] = c.Re(); fCacheIm[i] = c.Im(); } }
TComplex TComplex::operator= (TComplex complex) { //проверка на самоприсваивание if (this == &complex) { return *this; } this->real = complex.get_re(); this->imagine = complex.get_im(); return TComplex(complex.get_re(), complex.get_im()); }
bool TProtoSerial::SerialRepeated(TComplex& v, int idx, int protoField) { CHECK_FIELD(); switch (Mode) { case ESerialMode::IN: { const auto& messageField = Refl->GetRepeatedMessage(Message, GetFieldDescr(protoField), idx); const NGroundProto::TComplex& cpx = dynamic_cast<const NGroundProto::TComplex&>(messageField); v = TComplex(cpx.real(), cpx.imag()); } break; case ESerialMode::OUT: { NPb::Message* messageField = Refl->AddMessage(&Message, GetFieldDescr(protoField)); NGroundProto::TComplex* cpx = dynamic_cast<NGroundProto::TComplex*>(messageField); cpx->set_real(v.real()); cpx->set_imag(v.imag()); } break; } return true; }
int QCumulant::process_event(){ int nEvent = tree->GetEntries(); cout<<nEvent<<endl; for(ievent=0;ievent < nEvent; ievent++){ tree->GetEntry(ievent); if(ievent%10000==0) { cout<<"QCumulant calFlag = "<< calFlag << "************* ievent= "<<ievent<<" *************"<<endl; } jevent++; int iharE=0; if(nhar==1 || nhar==2) iharE = 1.0; int icent = 0; double Qx[nsub]; double Qy[nsub]; double Qx2[nsub]; double Qy2[nsub]; double Qx3[nsub]; double Qy3[nsub]; double Qw[nsub]; double qx[npt]; double qy[npt]; double qx2[npt]; double qy2[npt]; double qw[npt]; for(int ihar=0;ihar<nhar;ihar++){ for(int isub=0;isub<nsub;isub++){ Qx[isub] = 0; Qy[isub] = 0; Qx2[isub] = 0; Qy2[isub] = 0; Qx3[isub] = 0; Qy3[isub] = 0; Qw[isub] = 0; } for(int ipt=0;ipt<npt;ipt++){ qx[ipt] = 0; qy[ipt] = 0; qx2[ipt] = 0; qy2[ipt] = 0; qw[ipt] = 0; } int n = ihar + 1 + iharE; for(int i=0;i<M;i++){ double weight = 1.; if(fabs(eta[i])>1.0 && fabs(eta[i])<2.0 && eta[i]<0){ Qx[0]+=weight*cos(n*phi[i]); Qy[0]+=weight*sin(n*phi[i]); Qx2[0]+=weight*cos(2*n*phi[i]); Qy2[0]+=weight*sin(2*n*phi[i]); Qx3[0]+=weight*cos(3*n*phi[i]); Qy3[0]+=weight*sin(3*n*phi[i]); Qw[0]+=weight; } if(fabs(eta[i])>2.0 && fabs(eta[i])<3.0 && eta[i]<0){ Qx[1] += weight*cos(n*phi[i]); Qy[1] += weight*sin(n*phi[i]); Qx2[1] += weight*cos(2*n*phi[i]); Qy2[1] += weight*sin(2*n*phi[i]); Qx3[1] += weight*cos(3*n*phi[i]); Qy3[1] += weight*sin(3*n*phi[i]); Qw[1] += weight; } if(fabs(eta[i])<2.4){ if(pt[i]<0.1||pt[i]>10.0) continue; // if(phi[i]>TMath::Pi()/2 && phi[i]<TMath::Pi()) continue; // if(phi[i]>3*TMath::Pi()/2 && phi[i]<2*TMath::Pi()) continue; Qx[2] += weight*cos(n*phi[i]); Qy[2] += weight*sin(n*phi[i]); Qx2[2] += weight*cos(2*n*phi[i]); Qy2[2] += weight*sin(2*n*phi[i]); Qx3[2] += weight*cos(3*n*phi[i]); Qy3[2] += weight*sin(3*n*phi[i]); Qw[2] += weight; for(int ipt=0;ipt<npt;ipt++){ if(pt[i]>=ptbin[ipt] && pt[i]<ptbin[ipt+1]){ qx[ipt] += weight * cos(n*phi[i]); //particle of interest qy[ipt] += weight * sin(n*phi[i]); //particle of interest qx2[ipt] += weight * cos(2*n*phi[i]); //particle of interest qy2[ipt] += weight * sin(2*n*phi[i]); //particle of interest qw[ipt] += weight; //particle of interest } } } } for(int isub=0;isub<nsub;isub++){ //-------------------Integrated Qcumulant-------------------- //Q vectors are ready TComplex Q = TComplex(Qx[isub],Qy[isub]); //Qn TComplex Qstar = TComplex(Qx[isub],-Qy[isub]); //Qn* TComplex Q2 = TComplex(Qx2[isub],Qy2[isub]); //Q2n TComplex Q2star = TComplex(Qx2[isub],-Qy2[isub]); //Q2n* TComplex Q3 = TComplex(Qx3[isub],Qy3[isub]); //Q3n double QW = Qw[isub]; if(QW<2) continue; double W1 = QW; double W2 = QW*(QW-1); double W3 = QW*(QW-1)*(QW-2); double W4 = QW*(QW-1)*(QW-2)*(QW-3); double W6 = QW*(QW-1)*(QW-2)*(QW-3)*(QW-4)*(QW-5); //---2nd order Q-cumulant---- double sqrt2Q = Q.Rho2(); //|Qn|^2 double d2 = W2>0?(sqrt2Q-QW)/(QW*(QW-1)):-9999; //<2>(n|n) //Detector non-uniform acceptance double cos1 = Q.Re()/QW; double sin1 = Q.Im()/QW; //---4st order Q-cumulant---- double sqrt4Q = Q.Rho2()*Q.Rho2(); //|Qn|^4 double sqrt2Q2 = Q2.Rho2(); //|Q2n|^2 double d4 = W4>0?(sqrt4Q+sqrt2Q2-2.*(Q2*Qstar*Qstar).Re()-4.*(QW-2)*sqrt2Q)/(QW*(QW-1)*(QW-2)*(QW-3))+2./((QW-1)*(QW-2)):-9999; //<4>(n,n|n,n) //Detector non-uniform acceptance double cos1p2 = W2>0?(Q*Q-Q2).Re()/(QW*(QW-1)):-9999; double sin1p2 = W2>0?(Q*Q-Q2).Im()/(QW*(QW-1)):-9999; double cos1m2m3 = W3>0?(Q*Qstar*Qstar-Q*Q2star-2.*(QW-1)*Qstar).Re()/(QW*(QW-1)*(QW-2)):-9999; double sin1m2m3 = W3>0?(Q*Qstar*Qstar-Q*Q2star-2.*(QW-1)*Qstar).Im()/(QW*(QW-1)*(QW-2)):-9999; //---6st order Q-cumulant---- double sqrt6Q = Q.Rho2()*Q.Rho2()*Q.Rho2(); //|Qn|^6 double sqrt2Q3 = Q3.Rho2(); //|Q3n|^2 double d6 = W6>0?(sqrt6Q+9.*sqrt2Q2*sqrt2Q-6.*(Q2*Q*Qstar*Qstar*Qstar).Re()+4.*(Q3*Qstar*Qstar*Qstar).Re()-12.*(Q3*Q2star*Qstar).Re()+18.*(QW-4)*(Q2*Qstar*Qstar).Re()+4.*sqrt2Q3)/(QW*(QW-1)*(QW-2)*(QW-3)*(QW-4)*(QW-5))-9.*(sqrt4Q+sqrt2Q2)/(QW*(QW-1)*(QW-2)*(QW-3)*(QW-5))+18.*sqrt2Q/(QW*(QW-1)*(QW-3)*(QW-4))-6./((QW-1)*(QW-2)*(QW-3)):-9999; //<6>(n,n,n|n,n,n) //----correlators------ double c2 = d2; //cn{2} double c4 = d4-2*d2*d2; //cn{4} double c6 = d6-9*d2*d4+12*d2*d2*d2; //cn{6} //---flow harmonics------ double v2,v4,v6; if(c2>=0) v2 = sqrt(c2); //vn{2} else v2 = -9999; if(c4<=0) v4 = TMath::Power(-c4,1./4); //vn{4} else v4 = -9999; if(c6>=0) v6 = TMath::Power(1./4*c6,1./6); //vn{6} else v6 = -9999; //----event histograms----- hd[icent][isub][ihar][0]->Fill(d2); hd[icent][isub][ihar][1]->Fill(d4); hd[icent][isub][ihar][2]->Fill(d6); hc[icent][isub][ihar][0]->Fill(c2); hc[icent][isub][ihar][1]->Fill(c4); hc[icent][isub][ihar][2]->Fill(c6); hv[icent][isub][ihar][0]->Fill(v2); hv[icent][isub][ihar][1]->Fill(v4); hv[icent][isub][ihar][2]->Fill(v6); hcos1[icent][isub][ihar]->Fill(cos1); hsin1[icent][isub][ihar]->Fill(sin1); hcos1p2[icent][isub][ihar]->Fill(cos1p2); hsin1p2[icent][isub][ihar]->Fill(sin1p2); hcos1m2m3[icent][isub][ihar]->Fill(cos1m2m3); hsin1m2m3[icent][isub][ihar]->Fill(sin1m2m3); hwd[icent][isub][ihar][0]->Fill(d2,W2); hwd[icent][isub][ihar][1]->Fill(d4,W4); hwd[icent][isub][ihar][2]->Fill(d6,W6); hwc[icent][isub][ihar][0]->Fill(c2,W2); hwc[icent][isub][ihar][1]->Fill(c4,W4); hwc[icent][isub][ihar][2]->Fill(c6,W6); hwv[icent][isub][ihar][0]->Fill(v2,W2); hwv[icent][isub][ihar][1]->Fill(v4,W4); hwv[icent][isub][ihar][2]->Fill(v6,W6); hwcos1[icent][isub][ihar]->Fill(cos1,W1); hwsin1[icent][isub][ihar]->Fill(sin1,W1); hwcos1p2[icent][isub][ihar]->Fill(cos1p2,W2); hwsin1p2[icent][isub][ihar]->Fill(sin1p2,W2); hwcos1m2m3[icent][isub][ihar]->Fill(cos1m2m3,W3); hwsin1m2m3[icent][isub][ihar]->Fill(sin1m2m3,W3); for(int ipt=0;ipt<npt;ipt++){ //-------------------Differential Qcumulant------------------- //q vectors are ready TComplex q = TComplex(qx[ipt],qy[ipt]); //qn TComplex qstar = TComplex(qx[ipt],-qy[ipt]); //qn* TComplex q2 = TComplex(qx2[ipt],qy2[ipt]); //q2n TComplex q2star = TComplex(qx2[ipt],-qy2[ipt]); //q2n // TComplex q3 = TComplex(qx3,qy3); //q3n double qW = qw[ipt]; if(qW<1) continue; TComplex p=0; //overlap TComplex pstar=0; //overlap TComplex p2=0; //overlap double pW=0; if(isub == 2){ p = q; pstar = qstar; p2 = q2; pW = qW; } else{ p = 0; pstar = 0; p2 = 0; pW = 0; } double w1 = qW; double w2 = qW*QW-pW; double w3 = (qW*QW-2.*pW)*(QW-1); double w4 = (qW*QW-3.*pW)*(QW-1)*(QW-2); //---2nd order Q-cumulant---- double d2pr = w2>0?((q*Qstar-pW)/(qW*QW-pW)).Re():-9999; //<2'>(n_|n__) //Detector non-uniform acceptance double cos1pr = q.Re()/qW; double sin1pr = q.Im()/qW; //---4st order Q-cumulant---- // double d4pr = ((q*Q*Qstar*Qstar-q2*Qstar*Qstar-q*Q*Q2star+q2*Q2star-2.*qW*sqrt2Q-2.*(QW-3)*q*Qstar+2.*Q*qstar+2.*qW*(QW-3))/(qW*(QW-1)*(QW-2)*(QW-3))).Re(); //<4'>(n_n__|n__n__) double d4pr = w4>0?((q*Q*Qstar*Qstar-p2*Qstar*Qstar-q*Q*Q2star+p2*Q2star-2.*pW*sqrt2Q-2.*QW*q*Qstar+7.*p*Qstar-Q*pstar+2.*q*Qstar+2.*pW*(QW-3))/((QW-1)*(QW-2)*(qW*QW-3.*pW))).Re():-9999; //<4'>(n_n__|n__n__) //Detector non-uniform acceptance double cos1p2pr = w2>0?(q*Q-p2).Re()/(qW*QW-pW):-9999; double sin1p2pr = w2>0?(q*Q-p2).Im()/(qW*QW-pW):-9999; double cos1p2m3pr = w3>0?(q*sqrt2Q-q*QW-p2*Qstar-pW*Q+2.*p).Re()/((qW*QW-2.*pW)*(QW-1)):-9999; double sin1p2m3pr = w3>0?(q*sqrt2Q-q*QW-p2*Qstar-pW*Q+2.*p).Im()/((qW*QW-2.*pW)*(QW-1)):-9999; double cos1m2m3pr = w3>0?(q*Qstar*Qstar-q*Q2star-2.*pW*Qstar+2.*pstar).Re()/((qW*QW-2.*pW)*(QW-1)):-9999; double sin1m2m3pr = w3>0?(q*Qstar*Qstar-q*Q2star-2.*pW*Qstar+2.*pstar).Im()/((qW*QW-2.*pW)*(QW-1)):-9999; //----correlators------ double c2pr = d2pr; double c4pr = d4pr-2.*d2pr*d2; //----flow harmonics------ double v2pr = c2pr/v2; double v4pr = -c4pr/v4/v4/v4; //----event histograms---------- hdpr[icent][isub][ihar][ipt][0]->Fill(d2pr); hdpr[icent][isub][ihar][ipt][1]->Fill(d4pr); hcpr[icent][isub][ihar][ipt][0]->Fill(c2pr); hcpr[icent][isub][ihar][ipt][1]->Fill(c4pr); hvpr[icent][isub][ihar][ipt][0]->Fill(v2pr); hvpr[icent][isub][ihar][ipt][1]->Fill(v4pr); hcos1pr[icent][isub][ihar][ipt]->Fill(cos1pr); hsin1pr[icent][isub][ihar][ipt]->Fill(sin1pr); hcos1p2pr[icent][isub][ihar][ipt]->Fill(cos1p2pr); hsin1p2pr[icent][isub][ihar][ipt]->Fill(sin1p2pr); hcos1p2m3pr[icent][isub][ihar][ipt]->Fill(cos1p2m3pr); hsin1p2m3pr[icent][isub][ihar][ipt]->Fill(sin1p2m3pr); hcos1m2m3pr[icent][isub][ihar][ipt]->Fill(cos1m2m3pr); hsin1m2m3pr[icent][isub][ihar][ipt]->Fill(sin1m2m3pr); hwdpr[icent][isub][ihar][ipt][0]->Fill(d2pr,w2); hwdpr[icent][isub][ihar][ipt][1]->Fill(d4pr,w4); hwcpr[icent][isub][ihar][ipt][0]->Fill(c2pr,w2); hwcpr[icent][isub][ihar][ipt][1]->Fill(c4pr,w4); hwvpr[icent][isub][ihar][ipt][0]->Fill(v2pr,w2); hwvpr[icent][isub][ihar][ipt][1]->Fill(v4pr,w4); hwcos1pr[icent][isub][ihar][ipt]->Fill(cos1pr,w1); hwsin1pr[icent][isub][ihar][ipt]->Fill(sin1pr,w1); hwcos1p2pr[icent][isub][ihar][ipt]->Fill(cos1p2pr,w2); hwsin1p2pr[icent][isub][ihar][ipt]->Fill(sin1p2pr,w2); hwcos1p2m3pr[icent][isub][ihar][ipt]->Fill(cos1p2m3pr,w3); hwsin1p2m3pr[icent][isub][ihar][ipt]->Fill(sin1p2m3pr,w3); hwcos1m2m3pr[icent][isub][ihar][ipt]->Fill(cos1m2m3pr,w3); hwsin1m2m3pr[icent][isub][ihar][ipt]->Fill(sin1m2m3pr,w3); }//ipt }//isub }//ihar }//event loop return 0; }
bool TComplex::operator !=(TComplex right) { return real != right.get_re() || imagine != right.get_im(); }
bool TComplex::operator ==(TComplex right) { return real == right.get_re() && imagine == right.get_im(); }
TComplex TComplex::operator/ (TComplex right) { /*(a1*a2 + b1*b2)/(a2**2 + b2**2)+i*(a2*b1 – a1*b2)/(a2**2 + b2**2))*/ double _real = (real * right.get_re() + imagine * right.get_im()) / (right.get_re()*right.get_re() + right.get_im()*right.get_im()); double _imagine = (imagine * right.get_re() - real * right.get_im()) / (right.get_re()*right.get_re() + right.get_im()*right.get_im()); return TComplex(_real, _imagine); }
TComplex TComplex::operator* (TComplex right) { /*(a1*a2 - b1*b2)+i*(a1*b2+ a2*b1))*/ double _real = real * right.get_re() - imagine * right.get_im(); double _imagine = real * right.get_im() + imagine * right.get_re(); return TComplex(_real, _imagine); }
TComplex TComplex::operator- (TComplex right) { return TComplex(real - right.get_re(), imagine - right.get_im()); }
TComplex TComplex::operator+ (TComplex right) { return TComplex(real + right.get_re(), imagine + right.get_im()); }