Updated definition of theta* and corrected a bug in selection of true pairs from MC
authorpulvir <pulvir@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 4 Aug 2010 13:07:57 +0000 (13:07 +0000)
committerpulvir <pulvir@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 4 Aug 2010 13:07:57 +0000 (13:07 +0000)
PWG2/PWG2resonancesLinkDef.h
PWG2/RESONANCES/AliRsnCutESD2010.cxx
PWG2/RESONANCES/AliRsnCutManager.cxx
PWG2/RESONANCES/AliRsnCutManager.h
PWG2/RESONANCES/AliRsnMother.cxx
PWG2/RESONANCES/AliRsnPair.cxx
PWG2/libPWG2resonances.pkg

index 3248077..9a43d8d 100644 (file)
@@ -43,6 +43,6 @@
 
 #pragma link C++ class AliRsnMonitorTrack+;
 #pragma link C++ class AliRsnAnalysisMonitorTask+;
-#pragma link C++ class AliRsnFitResult+;
+//#pragma link C++ class AliRsnFitResult+;
 
 #endif
index 910bc42..ebdb5b2 100644 (file)
@@ -124,17 +124,6 @@ void AliRsnCutESD2010::Initialize()
 //
 // Main constructor.
 //
-
-  // setup TPC response
-  fESDpid = new AliESDpid;
-  fESDpid->GetTPCResponse().SetBetheBlochParameters(fTPCpar[0],fTPCpar[1],fTPCpar[2],fTPCpar[3],fTPCpar[4]);
-  
-  // setup TOF maker & calibration
-  fTOFcalib = new AliTOFcalib;
-  fTOFcalib->SetCorrectTExp(fTOFcorrectTExp);
-  fTOFmaker = new AliTOFT0maker(fESDpid, fTOFcalib);
-  fTOFmaker->SetTimeResolution(fTOFresolution);
-  fLastRun = -1;
 }
 
 //_________________________________________________________________________________________________
@@ -155,12 +144,26 @@ void AliRsnCutESD2010::SetEvent(AliRsnEvent *event)
     fEvent = event;
   }
   
+  // if absent, initialize ESD pid responst
+  if (!fESDpid)
+  {
+    fESDpid = new AliESDpid;
+    fESDpid->GetTPCResponse().SetBetheBlochParameters(fTPCpar[0],fTPCpar[1],fTPCpar[2],fTPCpar[3],fTPCpar[4]);
+  }
+  
   // initialize DB to current run
   Int_t run = esd->GetRunNumber();
   if (run != fLastRun)
   {
     cout << "Run = " << run << " -- LAST = " << fLastRun << endl;
     fLastRun = run;
+    
+    // setup TOF maker & calibration
+    if (!fTOFcalib) fTOFcalib = new AliTOFcalib;
+    fTOFcalib->SetCorrectTExp(fTOFcorrectTExp);
+    if (!fTOFmaker) fTOFmaker = new AliTOFT0maker(fESDpid, fTOFcalib);
+    fTOFmaker->SetTimeResolution(fTOFresolution);
+      
     AliCDBManager *cdb = AliCDBManager::Instance();
     cdb->SetDefaultStorage("raw://");
     cdb->SetRun(run);
index be93cf8..b950120 100644 (file)
@@ -18,40 +18,40 @@ ClassImp(AliRsnCutManager)
 //_____________________________________________________________________________
 AliRsnCutManager::AliRsnCutManager() :
   TNamed("defaultName", "defaultTitle"),
+  fDaughterCutsCommon(0x0),
+  fDaughterCuts1(0x0),
+  fDaughterCuts2(0x0),
   fMotherCuts(0x0)
 {
 //
 // Constructor without arguments.
 //
-
-  Int_t i;
-  for (i = 0; i < 3; i++) fDaughterCuts[i] = 0x0;
 }
 
 //_____________________________________________________________________________
 AliRsnCutManager::AliRsnCutManager(const char *name, const char *title) :
   TNamed(name, title),
+  fDaughterCutsCommon(0x0),
+  fDaughterCuts1(0x0),
+  fDaughterCuts2(0x0),
   fMotherCuts(0x0)
 {
 //
 // Constructor with name and title.
 //
-
-  Int_t i;
-  for (i = 0; i < 3; i++) fDaughterCuts[i] = 0x0;
 }
 
 //_____________________________________________________________________________
 AliRsnCutManager::AliRsnCutManager(const AliRsnCutManager &cut) :
   TNamed(cut),
+  fDaughterCutsCommon(cut.fDaughterCutsCommon),
+  fDaughterCuts1(cut.fDaughterCuts1),
+  fDaughterCuts2(cut.fDaughterCuts2),
   fMotherCuts(cut.fMotherCuts)
 {
 //
 // Constructor with name and title.
 //
-
-  Int_t i;
-  for (i = 0; i < 3; i++) fDaughterCuts[i] = cut.fDaughterCuts[i];
 }
 
 AliRsnCutManager& AliRsnCutManager::operator=(const AliRsnCutManager &cut)
@@ -63,10 +63,10 @@ AliRsnCutManager& AliRsnCutManager::operator=(const AliRsnCutManager &cut)
   SetName(cut.GetName());
   SetTitle(cut.GetTitle());
   
-  Int_t i;
-  for (i = 0; i < 3; i++) fDaughterCuts[i] = cut.fDaughterCuts[i];
-  
-  fMotherCuts = cut.fMotherCuts;
+  fDaughterCuts2      = cut.fDaughterCuts2;
+  fDaughterCuts1      = cut.fDaughterCuts1;
+  fDaughterCutsCommon = cut.fDaughterCutsCommon;
+  fMotherCuts         = cut.fMotherCuts;
   
   return (*this);
 }
@@ -79,9 +79,9 @@ AliRsnCutManager::~AliRsnCutManager()
 // Deletes all cut definitions.
 //
 
-  Int_t i;
-  for (i = 0; i < 3; i++) delete fDaughterCuts[i];
-  
+  delete fDaughterCuts2;
+  delete fDaughterCuts1;
+  delete fDaughterCutsCommon;
   delete fMotherCuts;
 }
 
@@ -92,8 +92,8 @@ void AliRsnCutManager::SetEvent(AliRsnEvent *event)
 // Sets reference event in all cut sets
 //
 
-  Int_t i;
-  for (i = 0; i < 3; i++) if (fDaughterCuts[i]) fDaughterCuts[i]->SetEvent(event);
-  
-  if (fMotherCuts) fMotherCuts->SetEvent(event);
+  if (fDaughterCuts2     ) fDaughterCuts2      ->SetEvent(event);
+  if (fDaughterCuts1     ) fDaughterCuts1      ->SetEvent(event);
+  if (fDaughterCutsCommon) fDaughterCutsCommon ->SetEvent(event);
+  if (fMotherCuts        ) fMotherCuts         ->SetEvent(event);
 }
index 36cd541..41fa4f0 100644 (file)
@@ -29,26 +29,28 @@ class AliRsnCutManager : public TNamed
     AliRsnCutManager& operator=(const AliRsnCutManager& cut);
     ~AliRsnCutManager();
     
-    AliRsnCutSet*    GetCommonDaughterCuts() {return fDaughterCuts[2];}
-    AliRsnCutSet*    GetDaughter1Cuts() {return fDaughterCuts[0];}
-    AliRsnCutSet*    GetDaughter2Cuts() {return fDaughterCuts[1];}
+    AliRsnCutSet*    GetCommonDaughterCuts() {return fDaughterCutsCommon;}
+    AliRsnCutSet*    GetDaughter1Cuts() {return fDaughterCuts1;}
+    AliRsnCutSet*    GetDaughter2Cuts() {return fDaughterCuts2;}
     AliRsnCutSet*    GetMotherCuts() {return fMotherCuts;}
 
-    void    SetCommonDaughterCuts(AliRsnCutSet *cuts) {fDaughterCuts[2] = cuts;}
-    void    SetDaughter1Cuts(AliRsnCutSet *cuts) {fDaughterCuts[0] = cuts;}
-    void    SetDaughter2Cuts(AliRsnCutSet *cuts) {fDaughterCuts[1] = cuts;}
+    void    SetCommonDaughterCuts(AliRsnCutSet *cuts) {fDaughterCutsCommon = cuts;}
+    void    SetDaughter1Cuts(AliRsnCutSet *cuts) {fDaughterCuts1 = cuts;}
+    void    SetDaughter2Cuts(AliRsnCutSet *cuts) {fDaughterCuts2 = cuts;}
     void    SetMotherCuts(AliRsnCutSet *cuts) {fMotherCuts = cuts;}
     void    SetEvent(AliRsnEvent *event);
     
-    Bool_t  PassCommonDaughterCuts(AliRsnDaughter *daughter) const {if (fDaughterCuts[2]) return fDaughterCuts[2]->IsSelected(daughter); return kTRUE;}
-    Bool_t  PassDaughter1Cuts(AliRsnDaughter *daughter) const {if (fDaughterCuts[0]) return fDaughterCuts[0]->IsSelected(daughter); return kTRUE;}
-    Bool_t  PassDaughter2Cuts(AliRsnDaughter *daughter) const {if (fDaughterCuts[1]) return fDaughterCuts[1]->IsSelected(daughter); return kTRUE;}
+    Bool_t  PassCommonDaughterCuts(AliRsnDaughter *daughter) const {if (fDaughterCutsCommon) return fDaughterCutsCommon->IsSelected(daughter); return kTRUE;}
+    Bool_t  PassDaughter1Cuts(AliRsnDaughter *daughter) const {if (fDaughterCuts1) return fDaughterCuts2->IsSelected(daughter); return kTRUE;}
+    Bool_t  PassDaughter2Cuts(AliRsnDaughter *daughter) const {if (fDaughterCuts2) return fDaughterCuts2->IsSelected(daughter); return kTRUE;}
     Bool_t  PassMotherCuts(AliRsnMother *mother) {if (fMotherCuts) return fMotherCuts->IsSelected(mother); return kTRUE;}
 
   private:
 
-    AliRsnCutSet  *fDaughterCuts[3]; //  single-track cuts ([0] --> only first dtr, [1] --> only second, [2] --> all)
-    AliRsnCutSet  *fMotherCuts;      //  mother cuts (on relations between daughters)
+    AliRsnCutSet  *fDaughterCutsCommon; //  single-track cuts common to both daughters
+    AliRsnCutSet  *fDaughterCuts1;      //  single-track cuts for only first daughter
+    AliRsnCutSet  *fDaughterCuts2;      //  single-track cuts for only second daughter
+    AliRsnCutSet  *fMotherCuts;         //  mother cuts (on relations between daughters)
 
     ClassDef(AliRsnCutManager, 1)  // dictionary
 };
index 1c81ad6..ba09a00 100644 (file)
@@ -10,6 +10,7 @@
 //          Alberto Pulvirenti (alberto.pulvirenti@ct.infn.it)
 //
 #include <Riostream.h>
+#include <TVector3.h>
 #include "AliRsnDaughter.h"
 #include "AliRsnPairDef.h"
 #include "AliRsnMother.h"
@@ -162,16 +163,28 @@ Double_t AliRsnMother::ThetaStar(Bool_t first, Bool_t useMC)
 
   TLorentzVector &mother   = (useMC ? fSumMC : fSum);
   TLorentzVector &daughter = (first ? fDaughter[0]->P() : fDaughter[1]->P());
-
+  
+  Double_t theta = mother.Vect().Theta();
+  Double_t phi   = mother.Vect().Phi();
   Double_t beta  = mother.Beta();
-  Double_t gamma = 1.0 / TMath::Sqrt(1.0 - beta*beta);
-  Double_t angle = daughter.Angle(mother.Vect());
-  Double_t pproj = daughter.Mag() * TMath::Cos(angle);
   
-  Double_t plstar = gamma * (pproj - beta*daughter.E());
-  Double_t ptstar = daughter.Mag() * TMath::Sin(angle);
+  Double_t betax = beta * TMath::Sin(theta) * TMath::Cos(phi);
+  Double_t betay = beta * TMath::Sin(theta) * TMath::Sin(phi);
+  Double_t betaz = beta * TMath::Cos(theta);
+  Double_t gamx  = 1.0 / TMath::Sqrt(1.0 - betax*betax);
+  Double_t gamy  = 1.0 / TMath::Sqrt(1.0 - betay*betay);
+  Double_t gamz  = 1.0 / TMath::Sqrt(1.0 - betaz*betaz);
+  
+  Double_t pstarx = gamx * (daughter.Vect().X() - betax * daughter.E());
+  Double_t pstary = gamy * (daughter.Vect().Y() - betay * daughter.E());
+  Double_t pstarz = gamz * (daughter.Vect().Z() - betaz * daughter.E());
+  
+  TVector3 dstar(pstarx, pstary, pstarz);
+  TVector3 vnorm(mother.Vect().Y() / mother.Perp(), mother.Vect().X() / mother.Perp(), 0.0);
+  
+  Double_t cosThetaStar = dstar.Dot(vnorm) / dstar.Mag();
   
-  return TMath::ATan(ptstar / plstar);
+  return cosThetaStar;
 }
 
 //_____________________________________________________________________________
index bfecb91..b67d2f9 100644 (file)
@@ -146,7 +146,31 @@ Bool_t AliRsnPair::Fill
   if (!fCutManager.PassMotherCuts(&fMother)) return kFALSE;
   
   // if required a true pair, check this here and eventually return a fail message
-  if (fOnlyTrue && !fMother.MatchesDef(fPairDef)) return kFALSE;
+  if (fOnlyTrue)
+  {
+    // are we in a MonteCarlo?
+    if (!daughter0->GetParticle() || !daughter1->GetParticle()) return kFALSE;
+    
+    // are the daughters really secondaries (in MC)?
+    Int_t m0 = daughter0->GetParticle()->GetFirstMother();
+    Int_t m1 = daughter1->GetParticle()->GetFirstMother();
+    if (m0 < 0 || m1 < 0) return kFALSE;
+    
+    // if they are, do they come from the same mother?
+    if (m0 != m1) return kFALSE;
+    
+    // if they do, is this mother the correct type?
+    if (daughter0->GetMotherPDG() != fPairDef->GetMotherPDG()) return kFALSE;
+    if (daughter1->GetMotherPDG() != fPairDef->GetMotherPDG()) return kFALSE;
+    
+    // do they match the expected decay channel (that is, are they the expected types)?
+    Int_t pdg0 = TMath::Abs(daughter0->GetParticle()->GetPdgCode());
+    Int_t pdg1 = TMath::Abs(daughter1->GetParticle()->GetPdgCode());
+    if (AliPID::ParticleCode(fPairDef->GetPID(0)) != pdg0) return kFALSE;
+    if (AliPID::ParticleCode(fPairDef->GetPID(1)) != pdg1) return kFALSE;
+    
+    // ok... if we arrive here that must really be a true pair! :-)
+  }
 
   AliDebug(AliLog::kDebug+2,"->");
   
index 1ed1996..7feab1f 100644 (file)
@@ -33,7 +33,7 @@ SRCS= RESONANCES/AliRsnDaughter.cxx \
       RESONANCES/AliRsnAnalysisPhi7TeVNoPID.cxx \
       RESONANCES/AliRsnMonitorTrack.cxx \
       RESONANCES/AliRsnAnalysisMonitorTask.cxx \
-      RESONANCES/AliRsnFitResult.cxx \
+#     RESONANCES/AliRsnFitResult.cxx \
 #     RESONANCES/AliRsnAnalysisEffSE.cxx \
 
 HDRS= $(SRCS:.cxx=.h)