1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
16 //----------------------------------------------------------------------------
17 // Implementation of the BtoJPSItoEle class
18 // for pp and PbPb interactions
19 // Note: the two decay tracks are labelled: 0 (positive electron)
20 // 1 (negative electron)
21 // Origin: G.E. Bruno giuseppe.bruno@ba.infn.it
22 // based on Class for charm golden channel (D0->Kpi)
23 //----------------------------------------------------------------------------
25 // #include <Riostream.h> // for debugging
30 #include <TPaveLabel.h>
34 #include "AliBtoJPSItoEle.h"
36 ClassImp(AliBtoJPSItoEle)
38 //----------------------------------------------------------------------------
39 AliBtoJPSItoEle::AliBtoJPSItoEle():
52 // Default constructor
83 //----------------------------------------------------------------------------
84 AliBtoJPSItoEle::AliBtoJPSItoEle(Int_t ev,Int_t trkNum[2],
85 Double_t v1[3],Double_t v2[3],
87 Double_t mom[6],Double_t d0[2]) :
102 fTrkNum[0] = trkNum[0];
103 fTrkNum[1] = trkNum[1];
137 //----------------------------------------------------------------------------
138 AliBtoJPSItoEle::~AliBtoJPSItoEle() {}
139 //----------------------------------------------------------------------------
140 void AliBtoJPSItoEle::ApplyPID(TString pidScheme) {
141 // Applies particle identification
143 if(!pidScheme.CompareTo("TRDTPCparam") && fPdg[0]==0) {
144 printf("AliBtoJPSItoEle::ApplyPID :\n Warning: TRD-TPC parameterized PID can be used only for simulation!\n");
148 if(!pidScheme.CompareTo("TRDTPCparam")) {
149 // tagging of the positive track
150 if(TMath::Abs(fPdg[0])==11) { // electron
152 fTagNid[0] = 1.-fTagEl[0];
154 else if(TMath::Abs(fPdg[0])==211) { // pion
155 fTagEl[0] = TRDTPCCombinedPIDParametrization(PChild(0));
156 fTagNid[0] = 1.-fTagEl[0];
158 else { // all the others
162 // tagging of the negative track
163 if(TMath::Abs(fPdg[1])==11) { // electron
165 fTagNid[1] = 1.-fTagEl[1];
167 else if(TMath::Abs(fPdg[1])==211) { // pion
168 fTagEl[1] = TRDTPCCombinedPIDParametrization(PChild(1));
169 fTagNid[1] = 1.-fTagEl[1];
171 else { // all the others
177 if(!pidScheme.CompareTo("ESDCombinedPID")) {
178 fTagEl[0]=fPIDrespEl[0];
179 fTagEl[1]=fPIDrespEl[1];
180 fTagNid[0] = 1.-fTagEl[0];
181 fTagNid[1] = 1.-fTagEl[1];
185 //----------------------------------------------------------------------------
186 Double_t AliBtoJPSItoEle::ChildrenRelAngle() const {
187 // relative angle between K and pi
189 TVector3 mom0(fPx[0],fPy[0],fPz[0]);
190 TVector3 mom1(fPx[1],fPy[1],fPz[1]);
192 Double_t angle = mom0.Angle(mom1);
196 //----------------------------------------------------------------------------
197 void AliBtoJPSItoEle::ComputeWgts() {
198 // calculate the weights for PID
201 // assignement of the weights from PID
202 fWgtJPsi = fTagEl[0]*fTagEl[1]; // both assumed to be electrons
205 // if(fWgtJPsi<0.) cerr<<"AliBtoJPSItoEle::ComputeWgts() Negative weight!!!\n";
210 //----------------------------------------------------------------------------
211 void AliBtoJPSItoEle::CorrectWgt4BR(Double_t factor) {
212 // correct weights of background from charm
218 //----------------------------------------------------------------------------
219 Double_t AliBtoJPSItoEle::CosPointing() const {
220 // cosine of pointing angle in space
222 TVector3 mom(Px(),Py(),Pz());
223 TVector3 flight(fV2x-fV1x,fV2y-fV1y,fV2z-fV1z);
225 Double_t pta = mom.Angle(flight);
227 return TMath::Cos(pta);
229 //----------------------------------------------------------------------------
230 Double_t AliBtoJPSItoEle::CosPointingXY() const {
231 // cosine of pointing angle in transverse plane
233 TVector3 momXY(Px(),Py(),0.);
234 TVector3 flightXY(fV2x-fV1x,fV2y-fV1y,0.);
236 Double_t ptaXY = momXY.Angle(flightXY);
238 return TMath::Cos(ptaXY);
240 //----------------------------------------------------------------------------
241 void AliBtoJPSItoEle::CosThetaStar(Double_t &ctsJPsi) const {
242 // cosine of decay angle in the J/Psi rest frame (of the negative electron)
244 Double_t pStar = TMath::Sqrt(TMath::Power(kMJPsi*kMJPsi-2.*kMe*kMe,2.)-4.*kMe*kMe*kMe*kMe)/(2.*kMJPsi);
246 Double_t beta = P()/Energy();
247 Double_t gamma = Energy()/kMJPsi;
249 ctsJPsi = (Ql(1)/gamma-beta*TMath::Sqrt(pStar*pStar+kMe*kMe))/pStar;
250 // if(ctsJPsi > 1.) { cerr<<"AliBtoJPSItoEle::CosThetaStar: > 1 "<<ctsJPsi<<"!\n"; }
251 // if(ctsJPsi < -1.) { cerr<<"AliBtoJPSItoEle::CosThetaStar: < -1 "<<ctsJPsi<<"!\n"; }
255 //----------------------------------------------------------------------------
256 Double_t AliBtoJPSItoEle::Eta() const {
257 // pseudorapidity of the J/Psi
259 Double_t theta = TMath::Pi()/2.-TMath::ATan2(Pz(),Pt());
260 Double_t eta = -TMath::Log(TMath::Tan(theta/2.));
263 //----------------------------------------------------------------------------
264 Double_t AliBtoJPSItoEle::EtaChild(Int_t child) const {
265 // pseudorapidity of the decay tracks
267 Double_t theta = TMath::Pi()/2.-TMath::ATan2(fPz[child],PtChild(child));
268 Double_t eta = -TMath::Log(TMath::Tan(theta/2.));
271 //----------------------------------------------------------------------------
272 void AliBtoJPSItoEle::GetWgts(Double_t &WgtJPsi)
274 // returns the weights for pid
280 //----------------------------------------------------------------------------
281 Double_t AliBtoJPSItoEle::ImpPar() const {
282 // J/Psi impact parameter in the bending plane
284 Double_t k = -(fV2x-fV1x)*Px()-(fV2y-fV1y)*Py();
286 Double_t dx = fV2x-fV1x+k*Px();
287 Double_t dy = fV2y-fV1y+k*Py();
288 Double_t absDD = TMath::Sqrt(dx*dx+dy*dy);
289 TVector3 mom(Px(),Py(),Pz());
290 TVector3 flight(fV2x-fV1x,fV2y-fV1y,fV2z-fV1z);
291 TVector3 cross = mom.Cross(flight);
292 return (cross.Z()>0. ? absDD : -absDD);
294 //----------------------------------------------------------------------------
295 void AliBtoJPSItoEle::InvMass(Double_t &mJPsi) const {
296 // invariant mass as J/Psi
301 energy[1] = TMath::Sqrt(kMe*kMe+PChild(1)*PChild(1));
302 energy[0] = TMath::Sqrt(kMe*kMe+PChild(0)*PChild(0));
304 mJPsi = TMath::Sqrt((energy[0]+energy[1])*(energy[0]+energy[1])-P()*P());
309 //----------------------------------------------------------------------------
310 Double_t AliBtoJPSItoEle::Ql(Int_t child) const {
311 // longitudinal momentum of decay tracks w.r.t. to J/Psi momentum
314 TVector3 mom(fPx[child],fPy[child],fPz[child]);
315 TVector3 momJPsi(Px(),Py(),Pz());
317 qL = mom.Dot(momJPsi)/momJPsi.Mag();
321 //----------------------------------------------------------------------------
322 Double_t AliBtoJPSItoEle::Qt() const {
323 // transverse momentum of decay tracks w.r.t. to JPsi momentum
325 TVector3 mom0(fPx[0],fPy[0],fPz[0]);
326 TVector3 momJPsi(Px(),Py(),Pz());
328 return mom0.Perp(momJPsi);
330 //----------------------------------------------------------------------------
331 Bool_t AliBtoJPSItoEle::Select(const Double_t* cuts,Int_t& okB)
334 // This function compares the B candidates with a set of cuts:
336 // cuts[0] = inv. mass half width [GeV]
337 // cuts[1] = dca [micron]
338 // cuts[2] = cosThetaStar
339 // cuts[3] = pTP [GeV/c]
340 // cuts[4] = pTN [GeV/c]
341 // cuts[5] = d0P [micron] upper limit!
342 // cuts[6] = d0N [micron] upper limit!
343 // cuts[7] = d0d0 [micron^2]
344 // cuts[8] = cosThetaPoint
346 // If the candidate doesn't pass the cuts it sets the weight to 0
349 Double_t mJPsi,ctsJPsi;
352 if(PtChild(1) < cuts[3] || PtChild(0) < cuts[4]) okB = 0;
353 if(!okB) return kFALSE;
355 if(TMath::Abs(Getd0Child(1)) > cuts[5] ||
356 TMath::Abs(Getd0Child(0)) > cuts[6]) okB = 0;
357 if(!okB) return kFALSE;
359 if(GetDCA() > cuts[1]) { okB = 0; return kFALSE; }
362 if(TMath::Abs(mJPsi-kMJPsi) > cuts[0]) okB = 0;
363 if(!okB) return kFALSE;
365 CosThetaStar(ctsJPsi);
366 if(TMath::Abs(ctsJPsi) > cuts[2]) okB = 0;
367 if(!okB) return kFALSE;
369 if(ProdImpParams() > cuts[7]) { okB = 0; return kFALSE; }
371 if(CosPointing() < cuts[8]) { okB = 0; return kFALSE; }
375 //-----------------------------------------------------------------------------
376 void AliBtoJPSItoEle::SetPIDresponse(Double_t resp0[5],Double_t resp1[5]) {
377 // Set combined PID detector response probabilities
379 fPIDrespEl[0] = resp0[0];
380 fPIDrespEl[1] = resp1[0];
381 fPIDrespMu[0] = resp0[1];
382 fPIDrespMu[1] = resp1[1];
383 fPIDrespPi[0] = resp0[2];
384 fPIDrespPi[1] = resp1[2];
385 fPIDrespKa[0] = resp0[3];
386 fPIDrespKa[1] = resp1[3];
387 fPIDrespPr[0] = resp0[4];
388 fPIDrespPr[1] = resp1[4];
392 //-----------------------------------------------------------------------------
393 Double_t AliBtoJPSItoEle::GetTagEl(Int_t child) const {
394 // Get tag probabilities for electrons
396 if(child!=0 && child !=1) return -1;
398 return fTagEl[child];
400 //-----------------------------------------------------------------------------
401 void AliBtoJPSItoEle::GetPIDresponse(Double_t resp0[5],Double_t resp1[5]) const {
402 // Get combined PID detector response probabilities
404 resp0[0] = fPIDrespEl[0];
405 resp1[0] = fPIDrespEl[1];
406 resp0[1] = fPIDrespMu[0];
407 resp1[1] = fPIDrespMu[1];
408 resp0[2] = fPIDrespPi[0];
409 resp1[2] = fPIDrespPi[1];
410 resp0[3] = fPIDrespKa[0];
411 resp1[3] = fPIDrespKa[1];
412 resp0[4] = fPIDrespPr[0];
413 resp1[4] = fPIDrespPr[1];
417 //----------------------------------------------------------------------------
418 Double_t AliBtoJPSItoEle::TRDTPCCombinedPIDParametrization(Double_t p) const {
421 // a first raw parametrization of the probability to misidentify a charged pion as electron as a
422 // function of the momentum, as given by the combined TPC and TRD response.
423 // PID cuts are set such that the probability for correct electron id is 90% in each of the two
426 // first estimate based on parameterization in the B-> single electron analysis
431 value=p2+p3*(1.-exp(-TMath::Power(p/p1,4.)));
433 value/=0.01; // here remove from TPC+TRD the TRD contribution estimated to be 0.01
434 // Better estimation based on TRD test beam (as presented by Andrea at Munster)
435 // if (p<10.) value*=(1.32-0.18*p+0.076*p*p-0.0037*p*p*p)/100.;
436 // if (p>10.) value*=(0.48+0.287*p)/100.;
437 // From Silvia MASCIOCCHI (Darmstadt) at PWG3 AliceWeek October 2007
438 if (p<10.) value*=(0.44-0.06*p+0.031*p*p-0.0008*p*p*p)/100.;
439 if (p>10.) value*=(-0.67+0.28*p)/100.;
443 //----------------------------------------------------------------------------