Kalman filter vertex in Psi2s task
authormbroz <Michal.Broz@cern.ch>
Thu, 23 Jan 2014 13:59:20 +0000 (14:59 +0100)
committermbroz <Michal.Broz@cern.ch>
Thu, 23 Jan 2014 13:59:20 +0000 (14:59 +0100)
PWGUD/UPC/AddTaskUpcK0sK0s.C
PWGUD/UPC/AddTaskUpcPsi2s.C
PWGUD/UPC/AliAnalysisTaskUpcK0sK0s.cxx
PWGUD/UPC/AliAnalysisTaskUpcK0sK0s.h
PWGUD/UPC/AliAnalysisTaskUpcPsi2s.cxx
PWGUD/UPC/AliAnalysisTaskUpcPsi2s.h

index e81d52b..52de3f0 100644 (file)
@@ -27,14 +27,12 @@ AliAnalysisTaskUpcK0sK0s *AddTaskUpcK0sK0s(Bool_t runTree = kTRUE,Bool_t runHist
    // Create containers for input/output
   AliAnalysisDataContainer *cinput = mgr->GetCommonInputContainer();
   AliAnalysisDataContainer *coutput = mgr->CreateContainer("K0sTree", TTree::Class(), AliAnalysisManager::kOutputContainer,Form("%s:K0sK0s", AliAnalysisManager::GetCommonFileName()));
-  AliAnalysisDataContainer *coutput2 = mgr->CreateContainer("Counter", TH1I::Class(), AliAnalysisManager::kOutputContainer, Form("%s:K0sK0s", AliAnalysisManager::GetCommonFileName()));
-  AliAnalysisDataContainer *coutput3 = mgr->CreateContainer("ListHist", TList::Class(), AliAnalysisManager::kOutputContainer, Form("%s:K0sK0s", AliAnalysisManager::GetCommonFileName()));
+  AliAnalysisDataContainer *coutput2 = mgr->CreateContainer("K0sListHist", TList::Class(), AliAnalysisManager::kOutputContainer, Form("%s:K0sK0s", AliAnalysisManager::GetCommonFileName()));
 
   // Connect input/output
   mgr->ConnectInput(task, 0, cinput);
   mgr->ConnectOutput(task, 1, coutput);
   mgr->ConnectOutput(task, 2, coutput2);
-  mgr->ConnectOutput(task, 3, coutput3);
 
 return task;
 }
index f30932a..5c9fae0 100644 (file)
@@ -29,7 +29,7 @@ AliAnalysisTaskUpcPsi2s *AddTaskUpcPsi2s(Bool_t runTree = kTRUE,Bool_t runHist =
   AliAnalysisDataContainer *coutput = mgr->CreateContainer("JPsiTree", TTree::Class(), AliAnalysisManager::kOutputContainer,Form("%s:Psi2sCentral", AliAnalysisManager::GetCommonFileName()));
   AliAnalysisDataContainer *coutput2 = mgr->CreateContainer("Psi2sTree", TTree::Class(), AliAnalysisManager::kOutputContainer, Form("%s:Psi2sCentral", AliAnalysisManager::GetCommonFileName()));
   AliAnalysisDataContainer *coutput3 = mgr->CreateContainer("ListTrig", TList::Class(), AliAnalysisManager::kOutputContainer, Form("%s:Psi2sCentral", AliAnalysisManager::GetCommonFileName()));
-  AliAnalysisDataContainer *coutput4 = mgr->CreateContainer("ListHist", TList::Class(), AliAnalysisManager::kOutputContainer, Form("%s:Psi2sCentral", AliAnalysisManager::GetCommonFileName()));  
+  AliAnalysisDataContainer *coutput4 = mgr->CreateContainer("Psi2sListHist", TList::Class(), AliAnalysisManager::kOutputContainer, Form("%s:Psi2sCentral", AliAnalysisManager::GetCommonFileName()));  
 
   // Connect input/output
   mgr->ConnectInput(task, 0, cinput);
index 33f8586..e920db3 100644 (file)
@@ -61,7 +61,7 @@ using std::endl;
 
 //_____________________________________________________________________________
 AliAnalysisTaskUpcK0sK0s::AliAnalysisTaskUpcK0sK0s() 
-  : AliAnalysisTaskSE(),fType(0),fRunTree(kTRUE),fRunHist(kTRUE),hCounter(0),fK0sTree(0),
+  : AliAnalysisTaskSE(),fType(0),fRunTree(kTRUE),fRunHist(kTRUE),fK0sTree(0),
     fRunNum(0),fPerNum(0),fOrbNum(0),fL0inputs(0),fL1inputs(0),fVtxContrib(0),fBCrossNum(0),fNtracklets(0),
     fZDCAenergy(0),fZDCCenergy(0),fV0Adecision(0),fV0Cdecision(0),
     fDataFilnam(0),fRecoPass(0),fEvtNum(0),
@@ -77,7 +77,7 @@ AliAnalysisTaskUpcK0sK0s::AliAnalysisTaskUpcK0sK0s()
 
 //_____________________________________________________________________________
 AliAnalysisTaskUpcK0sK0s::AliAnalysisTaskUpcK0sK0s(const char *name) 
-  : AliAnalysisTaskSE(name),fType(0),fRunTree(kTRUE),fRunHist(kTRUE),hCounter(0),fK0sTree(0),
+  : AliAnalysisTaskSE(name),fType(0),fRunTree(kTRUE),fRunHist(kTRUE),fK0sTree(0),
     fRunNum(0),fPerNum(0),fOrbNum(0),fL0inputs(0),fL1inputs(0),fVtxContrib(0),fBCrossNum(0),fNtracklets(0),
     fZDCAenergy(0),fZDCCenergy(0),fV0Adecision(0),fV0Cdecision(0),
     fDataFilnam(0),fRecoPass(0),fEvtNum(0),
@@ -93,8 +93,7 @@ AliAnalysisTaskUpcK0sK0s::AliAnalysisTaskUpcK0sK0s(const char *name)
   Init();
 
   DefineOutput(1, TTree::Class());
-  DefineOutput(2, TH1I::Class());
-  DefineOutput(3, TList::Class());
+  DefineOutput(2, TList::Class());
 
 }//AliAnalysisTaskUpcK0sK0s
 
@@ -114,10 +113,6 @@ AliAnalysisTaskUpcK0sK0s::~AliAnalysisTaskUpcK0sK0s()
      delete fK0sTree;
      fK0sTree = 0x0;
   }
-  if(hCounter){
-     delete hCounter;
-     hCounter = 0x0;
-  }
   if(fListHist){
      delete fListHist;
      fListHist = 0x0;
@@ -129,7 +124,6 @@ AliAnalysisTaskUpcK0sK0s::~AliAnalysisTaskUpcK0sK0s()
 //_____________________________________________________________________________
 void AliAnalysisTaskUpcK0sK0s::UserCreateOutputObjects()
 {
-   hCounter = new TH1I("hCounter", "hCounter", 34000, 1., 34001.);
 
   //input file
   fDataFilnam = new TObjString();
@@ -178,12 +172,11 @@ void AliAnalysisTaskUpcK0sK0s::UserCreateOutputObjects()
   fHistTriggersPerRun = new TH1D("fHistTriggersPerRun", "fHistTriggersPerRun", 3000, 167000.5, 170000.5);
   fListHist->Add(fHistTriggersPerRun);
     
-  fHistK0sMass = new TH1D("fHistK0sMass","fHistK0sMass",200,0.4,0.6);
+  fHistK0sMass = new TH2D("fHistK0sMass","fHistK0sMass",20,0.45,0.55,20,0.45,0.55);
   fListHist->Add(fHistK0sMass);
   
   PostData(1, fK0sTree);
-  PostData(2, hCounter);
-  PostData(3, fListHist);
+  PostData(2, fListHist);
 
 }//UserCreateOutputObjects
 
@@ -301,14 +294,12 @@ void AliAnalysisTaskUpcK0sK0s::RunAODhist()
        //SortArray(TrackID);
        //SortArray(V0TrackID);
        //for(Int_t i=0; i<4; i++) if (TrackID[i] != V0TrackID[i]) return;
-       for(Int_t i=0; i<2; i++){
-               AliAODv0 *v0 = aod->GetV0(V0Index[i]);                          
-               fHistK0sMass->Fill(v0->MassK0Short());
-               }
+       AliAODv0 *v00 = aod->GetV0(V0Index[0]); 
+       AliAODv0 *v01 = aod->GetV0(V0Index[1]);                         
+       fHistK0sMass->Fill(v00->MassK0Short(),v01->MassK0Short());              
   }
-
   
-  PostData(3, fListHist);
+  PostData(2, fListHist);
 
 }
 
@@ -326,21 +317,11 @@ void AliAnalysisTaskUpcK0sK0s::RunAODtree()
   fEvtNum = ((TTree*) GetInputData(0))->GetTree()->GetReadEntry();
   fRunNum = aod ->GetRunNumber();
 
-  hCounter->Fill( 1 );
-
   //Trigger
   TString trigger = aod->GetFiredTriggerClasses();
   
   if( !trigger.Contains("CCUP4-B") ) return;
 
-  Bool_t isTRG = kFALSE;
-  for(Int_t i=1; i<ntrg; i++) {
-    if( fTrigger[i] ) {isTRG = kTRUE; hCounter->Fill( fRunNum - 167806 + 1 + i*2000 );}
-  }
-  if( !isTRG ) {PostData(2, hCounter); return;}
-
-  hCounter->Fill( 2 );
-
   //trigger inputs
   fL0inputs = aod->GetHeader()->GetL0TriggerInputs();
   fL1inputs = aod->GetHeader()->GetL1TriggerInputs();
@@ -428,7 +409,7 @@ void AliAnalysisTaskUpcK0sK0s::RunAODtree()
   if(nGoodV0s == 2 && nGoodTracks == 4){
        //SortArray(TrackID);
        //SortArray(V0TrackID);
-       //for{Int_t i=0; i<4; i++} if (TrackID[i] != V0TrackID[i]) {PostData(2, hCounter); return;}
+       //for{Int_t i=0; i<4; i++} if (TrackID[i] != V0TrackID[i]) return;
        for(Int_t i=0; i<2; i++){
                AliAODv0 *v0 = aod->GetV0(V0Index[i]);
                AliAODTrack *pTrack=(AliAODTrack *)v0->GetDaughter(0); //0->Positive Daughter
@@ -443,7 +424,6 @@ void AliAnalysisTaskUpcK0sK0s::RunAODtree()
   }
   
   PostData(1, fK0sTree);   
-  PostData(2, hCounter);
 
 }//RunAOD
 
@@ -464,111 +444,6 @@ void AliAnalysisTaskUpcK0sK0s::SortArray(Double_t *dArray) {
 void AliAnalysisTaskUpcK0sK0s::RunESD()
 {
 
-  /*/input event
-  AliESDEvent *esd = (AliESDEvent*) InputEvent();
-  if(!esd) return;
-
-  //input data
-  const char *filnam = ((TTree*) GetInputData(0))->GetCurrentFile()->GetName();
-  fDataFilnam->Clear();
-  fDataFilnam->SetString(filnam);
-  fEvtNum = ((TTree*) GetInputData(0))->GetTree()->GetReadEntry();
-  fRunNum = esd->GetRunNumber();
-
-  hCounter->Fill( 1 );
-
-  //Trigger
-  TString trigger = esd->GetFiredTriggerClasses();
-  
-  fTrigger[0]   = trigger.Contains("CINT7-B");
-  fTrigger[1]   = trigger.Contains("CCUP4-B"); // CE 
-  fTrigger[2]   = trigger.Contains("CCUP4-E"); // CE 
-
-  Bool_t isTRG = kFALSE;
-  for(Int_t i=1; i<ntrg; i++) {
-    if( fTrigger[i] ) {isTRG = kTRUE; hCounter->Fill( fRunNum - 167806 + 1 + i*2000 );}
-  }
-  if( !isTRG ) {PostData(3, hCounter); return;}
-
-  hCounter->Fill( 2 );
-
-  //trigger inputs
-  fL0inputs = esd->GetHeader()->GetL0TriggerInputs();
-  fL1inputs = esd->GetHeader()->GetL1TriggerInputs();
-
-  //Event identification
-  fPerNum = esd->GetPeriodNumber();
-  fOrbNum = esd->GetOrbitNumber();
-  fBCrossNum = esd->GetBunchCrossNumber();
-
-  //primary vertex
-  AliESDVertex *fESDVertex = (AliESDVertex*) esd->GetPrimaryVertex();
-  fVtxContrib = fESDVertex->GetNContributors();
-
-  //Tracklets
-  fNtracklets = esd->GetMultiplicity()->GetNumberOfTracklets();
-
-  //VZERO, ZDC
-  AliESDVZERO *fV0data = esd->GetVZEROData();
-  AliESDZDC *fZDCdata = esd->GetESDZDC();
-  
-  fV0Adecision = fV0data->GetV0ADecision();
-  fV0Cdecision = fV0data->GetV0CDecision();
-  fZDCAenergy = fZDCdata->GetZN2TowerEnergy()[0];
-  fZDCCenergy = fZDCdata->GetZN1TowerEnergy()[0];
-  
-  Int_t nGoodTracks=0;
-  Int_t TrackIndex[5] = {-1,-1,-1,-1,-1};
-  
-  //Track loop
-  for(Int_t itr=0; itr<esd ->GetNumberOfTracks(); itr++) {
-    AliESDtrack *trk = esd->GetTrack(itr);
-    if( !trk ) continue;
-
-      if(!(trk->GetStatus() & AliESDtrack::kTPCrefit) ) continue;
-      if(!(trk->GetStatus() & AliESDtrack::kITSrefit) ) continue;
-      if(trk->GetTPCNcls() < 50)continue;
-      if(trk->GetTPCchi2()/trk->GetTPCNcls() > 4)continue;
-      Float_t dca[2] = {0.0,0.0}; AliExternalTrackParam cParam;
-      if(!trk->RelateToVertex(fESDVertex, esd->GetMagneticField(),300.,&cParam)) continue;
-      trk->GetImpactParameters(dca[0],dca[1]);
-      if(TMath::Abs(dca[1]) > 2) continue;
-      
-      TrackIndex[nGoodTracks] = itr;
-      nGoodTracks++;
-      if(nGoodTracks > 4) break;   
-  }//Track loop
-
-  if(nGoodTracks == 2){
-         for(Int_t i=0; i<2; i++){
-               AliESDtrack *trk = esd->GetTrack(TrackIndex[i]);
-               
-               AliExternalTrackParam cParam;
-               trk->RelateToVertex(fESDVertex, esd->GetMagneticField(),300.,&cParam);// to get trk->GetImpactParameters(DCAxy,DCAz);
-                               
-               new((*fJPsiESDTracks)[i]) AliESDtrack(*trk); 
-               
-               }
-  fJPsiTree ->Fill();
-  PostData(1, fJPsiTree);
-  }
-  
-  if(nGoodTracks == 4){
-         for(Int_t i=0; i<4; i++){
-               AliESDtrack *trk = esd->GetTrack(TrackIndex[i]);
-               
-               AliExternalTrackParam cParam;
-               trk->RelateToVertex(fESDVertex, esd->GetMagneticField(),300.,&cParam);// to get trk->GetImpactParameters(DCAxy,DCAz);
-
-               new((*fPsi2sESDTracks)[i]) AliESDtrack(*trk); 
-               
-               }
-  fPsi2sTree ->Fill();
-  PostData(2, fPsi2sTree);
-  }
-    
-  PostData(3, hCounter);
-/*/
 }//RunESD
 
 //_____________________________________________________________________________
index 55db3ad..be65187 100644 (file)
@@ -36,9 +36,6 @@ class AliAnalysisTaskUpcK0sK0s : public AliAnalysisTaskSE {
   Bool_t fRunTree; 
   Bool_t fRunHist;
   
-  //counter
-  TH1I *hCounter; //!
-
   //event tree
   TTree *fK0sTree;
   //tree variables
@@ -66,7 +63,7 @@ class AliAnalysisTaskUpcK0sK0s : public AliAnalysisTaskSE {
   
   TList *fListHist;
   TH1D *fHistTriggersPerRun;
-  TH1D *fHistK0sMass;
+  TH2D *fHistK0sMass;
   
   AliAnalysisTaskUpcK0sK0s(const AliAnalysisTaskUpcK0sK0s&); //not implemented
   AliAnalysisTaskUpcK0sK0s& operator =(const AliAnalysisTaskUpcK0sK0s&); //not implemented
index 3429c67..811bd65 100644 (file)
@@ -48,6 +48,8 @@
 #include "AliAODMCParticle.h"
 #include "AliMCParticle.h"
 #include "AliCentrality.h"
+#include "AliKFVertex.h"
+#include "AliExternalTrackParam.h"
 
 // my headers
 #include "AliAnalysisTaskUpcPsi2s.h"
@@ -65,8 +67,8 @@ AliAnalysisTaskUpcPsi2s::AliAnalysisTaskUpcPsi2s()
   : AliAnalysisTaskSE(),fType(0),fRunTree(kTRUE),fRunHist(kTRUE),fJPsiTree(0),fPsi2sTree(0),
     fRunNum(0),fPerNum(0),fOrbNum(0),fL0inputs(0),fL1inputs(0),
     fTOFtrig1(0), fTOFtrig2(0),
-    fVtxContrib(0),fVtxPosX(0),fVtxPosY(0),fVtxPosZ(0),fVtxErrX(0),fVtxErrY(0),fVtxErrZ(0),fVtxChi2(0),fVtxNDF(0),
-    fBCrossNum(0),fNtracklets(0),
+    fVtxContrib(0),fVtxChi2(0),fVtxNDF(0),
+    fBCrossNum(0),fNtracklets(0),fNLooseTracks(0),
     fZDCAenergy(0),fZDCCenergy(0),fV0Adecision(0),fV0Cdecision(0),
     fDataFilnam(0),fRecoPass(0),fEvtNum(0),
     fJPsiAODTracks(0),fJPsiESDTracks(0),fPsi2sAODTracks(0),fPsi2sESDTracks(0),
@@ -87,8 +89,8 @@ AliAnalysisTaskUpcPsi2s::AliAnalysisTaskUpcPsi2s(const char *name)
   : AliAnalysisTaskSE(name),fType(0),fRunTree(kTRUE),fRunHist(kTRUE),fJPsiTree(0),fPsi2sTree(0),
     fRunNum(0),fPerNum(0),fOrbNum(0),fL0inputs(0),fL1inputs(0),
     fTOFtrig1(0), fTOFtrig2(0),
-    fVtxContrib(0),fVtxPosX(0),fVtxPosY(0),fVtxPosZ(0),fVtxErrX(0),fVtxErrY(0),fVtxErrZ(0),fVtxChi2(0),fVtxNDF(0),
-    fBCrossNum(0),fNtracklets(0),
+    fVtxContrib(0),fVtxChi2(0),fVtxNDF(0),
+    fBCrossNum(0),fNtracklets(0),fNLooseTracks(0),
     fZDCAenergy(0),fZDCCenergy(0),fV0Adecision(0),fV0Cdecision(0),
     fDataFilnam(0),fRecoPass(0),fEvtNum(0),
     fJPsiAODTracks(0),fJPsiESDTracks(0),fPsi2sAODTracks(0),fPsi2sESDTracks(0),
@@ -118,6 +120,11 @@ void AliAnalysisTaskUpcPsi2s::Init()
   
   for(Int_t i=0; i<ntrg; i++) fTrigger[i] = kFALSE;
   for(Int_t i=0; i<4; i++) fTOFphi[i] = -666;
+  for(Int_t i=0; i<3; i++){
+       fVtxPos[i] = -666; 
+       fVtxErr[i] = -666;
+       fKfVtxPos[i] = -666;
+       }
 
 }//Init
 
@@ -169,21 +176,20 @@ void AliAnalysisTaskUpcPsi2s::UserCreateOutputObjects()
   fJPsiTree ->Branch("fL0inputs", &fL0inputs, "fL0inputs/i");
   fJPsiTree ->Branch("fL1inputs", &fL1inputs, "fL1inputs/i");
   fJPsiTree ->Branch("fNtracklets", &fNtracklets, "fNtracklets/s");
+  fJPsiTree ->Branch("fNLooseTracks", &fNLooseTracks, "fNLooseTracks/s");
   fJPsiTree ->Branch("fVtxContrib", &fVtxContrib, "fVtxContrib/I");
   
   fJPsiTree ->Branch("fTOFtrig1", &fTOFtrig1, "fTOFtrig1/O");
   fJPsiTree ->Branch("fTOFtrig2", &fTOFtrig2, "fTOFtrig2/O");
   fJPsiTree ->Branch("fTOFphi", &fTOFphi[0], "fTOFphi[4]/D");
   
-  fJPsiTree ->Branch("fVtxPosX", &fVtxPosX, "fVtxPosX/D");
-  fJPsiTree ->Branch("fVtxPosY", &fVtxPosY, "fVtxPosY/D");
-  fJPsiTree ->Branch("fVtxPosZ", &fVtxPosZ, "fVtxPosZ/D");
-  fJPsiTree ->Branch("fVtxErrX", &fVtxErrX, "fVtxErrX/D");
-  fJPsiTree ->Branch("fVtxErrY", &fVtxErrY, "fVtxErrY/D");
-  fJPsiTree ->Branch("fVtxErrZ", &fVtxErrZ, "fVtxErrZ/D");
+  fJPsiTree ->Branch("fVtxPos", &fVtxPos[0], "fVtxPos[3]/D");
+  fJPsiTree ->Branch("fVtxErr", &fVtxErr[0], "fVtxErr[3]/D");
   fJPsiTree ->Branch("fVtxChi2", &fVtxChi2, "fVtxChi2/D");
   fJPsiTree ->Branch("fVtxNDF", &fVtxNDF, "fVtxNDF/D");
   
+  fJPsiTree ->Branch("fKfVtxPos", &fKfVtxPos[0], "fKfVtxPos[3]/D");
+  
   fJPsiTree ->Branch("fZDCAenergy", &fZDCAenergy, "fZDCAenergy/D");
   fJPsiTree ->Branch("fZDCCenergy", &fZDCCenergy, "fZDCCenergy/D");
   fJPsiTree ->Branch("fV0Adecision", &fV0Adecision, "fV0Adecision/I");
@@ -209,21 +215,20 @@ void AliAnalysisTaskUpcPsi2s::UserCreateOutputObjects()
   fPsi2sTree ->Branch("fL0inputs", &fL0inputs, "fL0inputs/i");
   fPsi2sTree ->Branch("fL1inputs", &fL1inputs, "fL1inputs/i");
   fPsi2sTree ->Branch("fNtracklets", &fNtracklets, "fNtracklets/s");
+  fPsi2sTree ->Branch("fNLooseTracks", &fNLooseTracks, "fNLooseTracks/s");
   fPsi2sTree ->Branch("fVtxContrib", &fVtxContrib, "fVtxContrib/I");
   
   fPsi2sTree ->Branch("fTOFtrig1", &fTOFtrig1, "fTOFtrig1/O");
   fPsi2sTree ->Branch("fTOFtrig2", &fTOFtrig2, "fTOFtrig2/O");
   fPsi2sTree ->Branch("fTOFphi", &fTOFphi[0], "fTOFphi[4]/D");
   
-  fPsi2sTree ->Branch("fVtxPosX", &fVtxPosX, "fVtxPosX/D");
-  fPsi2sTree ->Branch("fVtxPosY", &fVtxPosY, "fVtxPosY/D");
-  fPsi2sTree ->Branch("fVtxPosZ", &fVtxPosZ, "fVtxPosZ/D");
-  fPsi2sTree ->Branch("fVtxErrX", &fVtxErrX, "fVtxErrX/D");
-  fPsi2sTree ->Branch("fVtxErrY", &fVtxErrY, "fVtxErrY/D");
-  fPsi2sTree ->Branch("fVtxErrZ", &fVtxErrZ, "fVtxErrZ/D");
+  fPsi2sTree ->Branch("fVtxPos", &fVtxPos[0], "fVtxPos[3]/D");
+  fPsi2sTree ->Branch("fVtxErr", &fVtxErr[0], "fVtxErr[3]/D");
   fPsi2sTree ->Branch("fVtxChi2", &fVtxChi2, "fVtxChi2/D");
   fPsi2sTree ->Branch("fVtxNDF", &fVtxNDF, "fVtxNDF/D");
   
+  fPsi2sTree ->Branch("fKfVtxPos", &fKfVtxPos[0], "fKfVtxPos[3]/D");
+  
   fPsi2sTree ->Branch("fZDCAenergy", &fZDCAenergy, "fZDCAenergy/D");
   fPsi2sTree ->Branch("fZDCCenergy", &fZDCCenergy, "fZDCCenergy/D");
   fPsi2sTree ->Branch("fV0Adecision", &fV0Adecision, "fV0Adecision/I");
@@ -421,7 +426,7 @@ void AliAnalysisTaskUpcPsi2s::RunAODhist()
   TLorentzVector vLepton[4], vPion[4], vCandidate, vDilepton;
   Short_t qLepton[4], qPion[4];
   UInt_t nLepton=0, nPion=0, nHighPt=0;
-  Double_t jRecTPCsignal[5];
+  Double_t fRecTPCsignal[5];
   Int_t mass[3]={-1,-1,-1};
   
    
@@ -456,13 +461,13 @@ void AliAnalysisTaskUpcPsi2s::RunAODhist()
                AliAODTrack *trk = aod->GetTrack(TrackIndex[i]);
                
                if(trk->Pt() > 1){   
-                       jRecTPCsignal[nLepton] = trk->GetTPCsignal();      
+                       fRecTPCsignal[nLepton] = trk->GetTPCsignal();      
                        qLepton[nLepton] = trk->Charge();
-                       if(jRecTPCsignal[nLepton] > 40 && jRecTPCsignal[nLepton] < 70){
+                       if(fRecTPCsignal[nLepton] > 40 && fRecTPCsignal[nLepton] < 70){
                                        vLepton[nLepton].SetPtEtaPhiM(trk->Pt(), trk->Eta(), trk->Phi(), muonMass);
                                        mass[nLepton] = 0;
                                        }
-                       if(jRecTPCsignal[nLepton] > 70 && jRecTPCsignal[nLepton] < 100){
+                       if(fRecTPCsignal[nLepton] > 70 && fRecTPCsignal[nLepton] < 100){
                                        vLepton[nLepton].SetPtEtaPhiM(trk->Pt(), trk->Eta(), trk->Phi(), electronMass);
                                        mass[nLepton] = 1;
                                        }
@@ -528,13 +533,13 @@ void AliAnalysisTaskUpcPsi2s::RunAODhist()
          for(Int_t i=0; i<2; i++){
                AliAODTrack *trk = aod->GetTrack(TrackIndex[i]);                
                if(trk->Pt() > 1) nHighPt++;     
-               jRecTPCsignal[nLepton] = trk->GetTPCsignal();     
+               fRecTPCsignal[nLepton] = trk->GetTPCsignal();     
                qLepton[nLepton] = trk->Charge();
-               if(jRecTPCsignal[nLepton] > 40 && jRecTPCsignal[nLepton] < 70){
+               if(fRecTPCsignal[nLepton] > 40 && fRecTPCsignal[nLepton] < 70){
                                vLepton[nLepton].SetPtEtaPhiM(trk->Pt(), trk->Eta(), trk->Phi(), muonMass);
                                mass[nLepton] = 0;
                                }
-               if(jRecTPCsignal[nLepton] > 70 && jRecTPCsignal[nLepton] < 100){
+               if(fRecTPCsignal[nLepton] > 70 && fRecTPCsignal[nLepton] < 100){
                                vLepton[nLepton].SetPtEtaPhiM(trk->Pt(), trk->Eta(), trk->Phi(), electronMass);
                                mass[nLepton] = 1;
                                }
@@ -546,7 +551,7 @@ void AliAnalysisTaskUpcPsi2s::RunAODhist()
                        fHistNeventsJPsi->Fill(7);
                        if(nHighPt > 0){
                                fHistNeventsJPsi->Fill(8);
-                               fHistTPCsignalJPsi->Fill(jRecTPCsignal[0],jRecTPCsignal[1]);
+                               fHistTPCsignalJPsi->Fill(fRecTPCsignal[0],fRecTPCsignal[1]);
                                if(nHighPt == 2) fHistNeventsJPsi->Fill(9);
                                if(mass[0] == mass[1] && mass[0] != -1) {
                                        fHistNeventsJPsi->Fill(10);
@@ -610,14 +615,14 @@ void AliAnalysisTaskUpcPsi2s::RunAODtree()
   //primary vertex
   AliAODVertex *fAODVertex = aod->GetPrimaryVertex();
   fVtxContrib = fAODVertex->GetNContributors();
-  fVtxPosX = fAODVertex->GetX();
-  fVtxPosY = fAODVertex->GetY();
-  fVtxPosZ = fAODVertex->GetZ();
+  fVtxPos[0] = fAODVertex->GetX();
+  fVtxPos[1] = fAODVertex->GetY();
+  fVtxPos[2] = fAODVertex->GetZ();
   Double_t CovMatx[6];
   fAODVertex->GetCovarianceMatrix(CovMatx); 
-  fVtxErrX = CovMatx[0];
-  fVtxErrY = CovMatx[1];
-  fVtxErrZ = CovMatx[2];
+  fVtxErr[0] = CovMatx[0];
+  fVtxErr[1] = CovMatx[1];
+  fVtxErr[2] = CovMatx[2];
   fVtxChi2 = fAODVertex->GetChi2();
   fVtxNDF = fAODVertex->GetNDF();
 
@@ -633,16 +638,29 @@ void AliAnalysisTaskUpcPsi2s::RunAODtree()
   fZDCAenergy = fZDCdata->GetZNATowerEnergy()[0];
   fZDCCenergy = fZDCdata->GetZNCTowerEnergy()[0];
   
+  fNLooseTracks = 0;
+  
+  //Track loop - loose cuts
+  for(Int_t itr=0; itr<aod ->GetNumberOfTracks(); itr++) {
+    AliAODTrack *trk = aod->GetTrack(itr);
+    if( !trk ) continue;
+
+      if(!(trk->GetStatus() & AliAODTrack::kTPCrefit) ) continue;
+      if(!(trk->GetStatus() & AliAODTrack::kITSrefit) ) continue;
+      if(trk->GetTPCNcls() < 20)continue;
+      fNLooseTracks++; 
+  }//Track loop -loose cuts
+  
   Int_t nGoodTracks=0;
   Int_t TrackIndex[5] = {-1,-1,-1,-1,-1};
   
-   //Two track loop
+  //Two track loop
   for(Int_t itr=0; itr<aod ->GetNumberOfTracks(); itr++) {
     AliAODTrack *trk = aod->GetTrack(itr);
     if( !trk ) continue;
 
-      if(!(trk->GetStatus() & AliESDtrack::kTPCrefit) ) continue;
-      if(!(trk->GetStatus() & AliESDtrack::kITSrefit) ) continue;
+      if(!(trk->GetStatus() & AliAODTrack::kTPCrefit) ) continue;
+      if(!(trk->GetStatus() & AliAODTrack::kITSrefit) ) continue;
       if(trk->GetTPCNcls() < 70)continue;
       if(trk->Chi2perNDF() > 4)continue;
       if((!trk->HasPointOnITSLayer(0))&&(!trk->HasPointOnITSLayer(1))) continue;
@@ -660,6 +678,23 @@ void AliAnalysisTaskUpcPsi2s::RunAODtree()
   }//Track loop
 
   if(nGoodTracks == 2){
+  
+         TDatabasePDG *pdgdat = TDatabasePDG::Instance();
+         TParticlePDG *partMuon = pdgdat->GetParticle( 13 );
+         Double_t muonMass = partMuon->Mass();  
+          TParticlePDG *partElectron = pdgdat->GetParticle( 11 );
+          Double_t electronMass = partElectron->Mass();  
+         TParticlePDG *partPion = pdgdat->GetParticle( 211 );
+         Double_t pionMass = partPion->Mass();
+  
+         Double_t KFcov[21];
+         Double_t KFpar[6];
+         Double_t KFmass = pionMass;
+         Double_t fRecTPCsignal;
+         AliKFParticle *KFpart[2];
+         AliKFVertex *KFvtx = new AliKFVertex();
+         KFvtx->SetField(aod->GetMagneticField()); 
+  
          for(Int_t i=0; i<2; i++){
                AliAODTrack *trk = aod->GetTrack(TrackIndex[i]);
                
@@ -671,13 +706,39 @@ void AliAnalysisTaskUpcPsi2s::RunAODtree()
                new((*fJPsiAODTracks)[i]) AliAODTrack(*trk); 
                ((AliAODTrack*)((*fJPsiAODTracks)[i]))->SetDCA(dca[0],dca[1]);//to get DCAxy trk->DCA(); to get DCAz trk->ZAtDCA();
                
+               trk->GetPosition(KFpar);
+               trk->PxPyPz(KFpar+3);
+               trk->GetCovMatrix(KFcov);
+               
+               if(trk->Pt() > 1){   
+                       fRecTPCsignal = trk->GetTPCsignal();      
+                       if(fRecTPCsignal > 40 && fRecTPCsignal < 70) KFmass = muonMass;
+                       if(fRecTPCsignal > 70 && fRecTPCsignal < 100)KFmass = electronMass;
+                       }
+               else KFmass = pionMass;
+               
+               KFpart[i] = new AliKFParticle();
+               KFpart[i]->SetField(aod->GetMagneticField());
+               KFpart[i]->AliKFParticleBase::Initialize(KFpar,KFcov,(Int_t) trk->Charge(), KFmass);
+               KFvtx->AddDaughter(*KFpart[i]); 
+               
+               
                Double_t pos[3]={0,0,0};
-               if(!trk->GetXYZAt(378,aod->GetMagneticField(),pos)) fTOFphi[i] = -666;
+               AliExternalTrackParam *parTrk = new AliExternalTrackParam();
+               parTrk->CopyFromVTrack((AliVTrack*) trk);
+               if(!parTrk->GetXYZAt(378,aod->GetMagneticField(),pos)) fTOFphi[i] = -666;
                else {
                     fTOFphi[i] =  TMath::ATan2(pos[1],pos[0])*TMath::RadToDeg();
                     if(fTOFphi[i] < 0) fTOFphi[i]+=(2*TMath::Pi()*TMath::RadToDeg());
-                    }          
+                    }
+               delete parTrk;          
                }
+  fKfVtxPos[0]= KFvtx->GetX();
+  fKfVtxPos[1]= KFvtx->GetY();
+  fKfVtxPos[2]= KFvtx->GetZ();
+  for(UInt_t i=0; i<2; i++)delete KFpart[i];
+  delete KFvtx; 
+
   fJPsiTree ->Fill();
   }
   
@@ -687,8 +748,8 @@ void AliAnalysisTaskUpcPsi2s::RunAODtree()
     AliAODTrack *trk = aod->GetTrack(itr);
     if( !trk ) continue;
 
-      if(!(trk->GetStatus() & AliESDtrack::kTPCrefit) ) continue;
-      if(!(trk->GetStatus() & AliESDtrack::kITSrefit) ) continue;
+      if(!(trk->GetStatus() & AliAODTrack::kTPCrefit) ) continue;
+      if(!(trk->GetStatus() & AliAODTrack::kITSrefit) ) continue;
       if(trk->GetTPCNcls() < 50)continue;
       if(trk->Chi2perNDF() > 4)continue;
       Double_t dca[2] = {0.0,0.0}, cov[3] = {0.0,0.0,0.0};
@@ -703,8 +764,26 @@ void AliAnalysisTaskUpcPsi2s::RunAODtree()
                                  
       if(nGoodTracks > 4) break;  
   }//Track loop
+      
     
   if(nGoodTracks == 4){
+  
+         TDatabasePDG *pdgdat = TDatabasePDG::Instance();
+         TParticlePDG *partMuon = pdgdat->GetParticle( 13 );
+         Double_t muonMass = partMuon->Mass();  
+          TParticlePDG *partElectron = pdgdat->GetParticle( 11 );
+          Double_t electronMass = partElectron->Mass();  
+         TParticlePDG *partPion = pdgdat->GetParticle( 211 );
+         Double_t pionMass = partPion->Mass();
+  
+         Double_t KFcov[21];
+         Double_t KFpar[6];
+         Double_t KFmass = pionMass;
+         Double_t fRecTPCsignal;
+         AliKFParticle *KFpart[4];
+         AliKFVertex *KFvtx = new AliKFVertex();
+         KFvtx->SetField(aod->GetMagneticField()); 
+                 
          for(Int_t i=0; i<4; i++){
                AliAODTrack *trk = aod->GetTrack(TrackIndex[i]);
                
@@ -716,13 +795,37 @@ void AliAnalysisTaskUpcPsi2s::RunAODtree()
                new((*fPsi2sAODTracks)[i]) AliAODTrack(*trk);
                ((AliAODTrack*)((*fPsi2sAODTracks)[i]))->SetDCA(dca[0],dca[1]);//to get DCAxy trk->DCA(); to get DCAz trk->ZAtDCA();
                                
+               trk->GetPosition(KFpar);
+               trk->PxPyPz(KFpar+3);
+               trk->GetCovMatrix(KFcov);
+               
+               if(trk->Pt() > 1){   
+                       fRecTPCsignal = trk->GetTPCsignal();      
+                       if(fRecTPCsignal > 40 && fRecTPCsignal < 70) KFmass = muonMass;
+                       if(fRecTPCsignal > 70 && fRecTPCsignal < 100)KFmass = electronMass;
+                       }
+               else KFmass = pionMass;
+               
+               KFpart[i] = new AliKFParticle();
+               KFpart[i]->SetField(aod->GetMagneticField());
+               KFpart[i]->AliKFParticleBase::Initialize(KFpar,KFcov,(Int_t) trk->Charge(), KFmass);
+               KFvtx->AddDaughter(*KFpart[i]); 
+                               
                Double_t pos[3]={0,0,0};
-               if(!trk->GetXYZAt(378,aod->GetMagneticField(),pos)) fTOFphi[i] = -666;
+               AliExternalTrackParam *parTrk = new AliExternalTrackParam();
+               parTrk->CopyFromVTrack((AliVTrack*) trk);
+               if(!parTrk->GetXYZAt(378,aod->GetMagneticField(),pos)) fTOFphi[i] = -666;
                else {
                     fTOFphi[i] =  TMath::ATan2(pos[1],pos[0])*TMath::RadToDeg();
                     if(fTOFphi[i] < 0) fTOFphi[i]+=(2*TMath::Pi()*TMath::RadToDeg());
-                    }          
+                    }
+               delete parTrk;          
                }
+  fKfVtxPos[0]= KFvtx->GetX();
+  fKfVtxPos[1]= KFvtx->GetY();
+  fKfVtxPos[2]= KFvtx->GetZ();
+  for(UInt_t i=0; i<4; i++)delete KFpart[i];
+  delete KFvtx; 
   fPsi2sTree ->Fill();
   }
   
@@ -827,7 +930,7 @@ void AliAnalysisTaskUpcPsi2s::RunESDhist()
   TLorentzVector vLepton[4], vPion[4], vCandidate, vDilepton;
   Short_t qLepton[4], qPion[4];
   UInt_t nLepton=0, nPion=0, nHighPt=0;
-  Double_t jRecTPCsignal[5];
+  Double_t fRecTPCsignal[5];
   Int_t mass[3]={-1,-1,-1};
 
  //Two Track loop
@@ -857,13 +960,13 @@ void AliAnalysisTaskUpcPsi2s::RunESDhist()
          for(Int_t i=0; i<2; i++){
                AliESDtrack *trk = esd->GetTrack(TrackIndex[i]);                
                if(trk->Pt() > 1) nHighPt++;     
-               jRecTPCsignal[nLepton] = trk->GetTPCsignal();     
+               fRecTPCsignal[nLepton] = trk->GetTPCsignal();     
                qLepton[nLepton] = trk->Charge();
-               if(jRecTPCsignal[nLepton] > 40 && jRecTPCsignal[nLepton] < 70){
+               if(fRecTPCsignal[nLepton] > 40 && fRecTPCsignal[nLepton] < 70){
                                vLepton[nLepton].SetPtEtaPhiM(trk->Pt(), trk->Eta(), trk->Phi(), muonMass);
                                mass[nLepton] = 0;
                                }
-               if(jRecTPCsignal[nLepton] > 70 && jRecTPCsignal[nLepton] < 100){
+               if(fRecTPCsignal[nLepton] > 70 && fRecTPCsignal[nLepton] < 100){
                                vLepton[nLepton].SetPtEtaPhiM(trk->Pt(), trk->Eta(), trk->Phi(), electronMass);
                                mass[nLepton] = 1;
                                }
@@ -875,7 +978,7 @@ void AliAnalysisTaskUpcPsi2s::RunESDhist()
                        fHistNeventsJPsi->Fill(7);
                        if(nHighPt > 0){
                                fHistNeventsJPsi->Fill(8);
-                               fHistTPCsignalJPsi->Fill(jRecTPCsignal[0],jRecTPCsignal[1]);
+                               fHistTPCsignalJPsi->Fill(fRecTPCsignal[0],fRecTPCsignal[1]);
                                if(nHighPt == 2) fHistNeventsJPsi->Fill(9);
                                if(mass[0] == mass[1] && mass[0] != -1) {
                                        fHistNeventsJPsi->Fill(10);
@@ -922,13 +1025,13 @@ void AliAnalysisTaskUpcPsi2s::RunESDhist()
                AliESDtrack *trk = esd->GetTrack(TrackIndex[i]);
                
                if(trk->Pt() > 1){   
-                       jRecTPCsignal[nLepton] = trk->GetTPCsignal();      
+                       fRecTPCsignal[nLepton] = trk->GetTPCsignal();      
                        qLepton[nLepton] = trk->Charge();
-                       if(jRecTPCsignal[nLepton] > 40 && jRecTPCsignal[nLepton] < 70){
+                       if(fRecTPCsignal[nLepton] > 40 && fRecTPCsignal[nLepton] < 70){
                                        vLepton[nLepton].SetPtEtaPhiM(trk->Pt(), trk->Eta(), trk->Phi(), muonMass);
                                        mass[nLepton] = 0;
                                        }
-                       if(jRecTPCsignal[nLepton] > 70 && jRecTPCsignal[nLepton] < 100){
+                       if(fRecTPCsignal[nLepton] > 70 && fRecTPCsignal[nLepton] < 100){
                                        vLepton[nLepton].SetPtEtaPhiM(trk->Pt(), trk->Eta(), trk->Phi(), electronMass);
                                        mass[nLepton] = 1;
                                        }
@@ -1010,14 +1113,14 @@ void AliAnalysisTaskUpcPsi2s::RunESDtree()
   //primary vertex
   AliESDVertex *fESDVertex = (AliESDVertex*) esd->GetPrimaryVertex();
   fVtxContrib = fESDVertex->GetNContributors();
-  fVtxPosX = fESDVertex->GetX();
-  fVtxPosY = fESDVertex->GetY();
-  fVtxPosZ = fESDVertex->GetZ();
+  fVtxPos[0] = fESDVertex->GetX();
+  fVtxPos[1] = fESDVertex->GetY();
+  fVtxPos[2] = fESDVertex->GetZ();
   Double_t CovMatx[6];
   fESDVertex->GetCovarianceMatrix(CovMatx); 
-  fVtxErrX = CovMatx[0];
-  fVtxErrY = CovMatx[1];
-  fVtxErrZ = CovMatx[2];
+  fVtxErr[0] = CovMatx[0];
+  fVtxErr[1] = CovMatx[1];
+  fVtxErr[2] = CovMatx[2];
   fVtxChi2 = fESDVertex->GetChi2();
   fVtxNDF = fESDVertex->GetNDF();
 
@@ -1032,6 +1135,19 @@ void AliAnalysisTaskUpcPsi2s::RunESDtree()
   fV0Cdecision = fV0data->GetV0CDecision();
   fZDCAenergy = fZDCdata->GetZN2TowerEnergy()[0];
   fZDCCenergy = fZDCdata->GetZN1TowerEnergy()[0];
+
+  fNLooseTracks = 0;
+  
+  //Track loop - loose cuts
+  for(Int_t itr=0; itr<esd ->GetNumberOfTracks(); itr++) {
+    AliESDtrack *trk = esd->GetTrack(itr);
+    if( !trk ) continue;
+
+      if(!(trk->GetStatus() & AliESDtrack::kTPCrefit) ) continue;
+      if(!(trk->GetStatus() & AliESDtrack::kITSrefit) ) continue;
+      if(trk->GetTPCNcls() < 20)continue;
+      fNLooseTracks++; 
+  }//Track loop -loose cuts
   
   Int_t nGoodTracks=0;
   Int_t TrackIndex[5] = {-1,-1,-1,-1,-1};
index 8c6762f..96217b6 100644 (file)
@@ -50,10 +50,11 @@ class AliAnalysisTaskUpcPsi2s : public AliAnalysisTaskSE {
   Bool_t fTOFtrig1, fTOFtrig2;
   Double_t fTOFphi[4];
   Int_t fVtxContrib;
-  Double_t fVtxPosX,fVtxPosY,fVtxPosZ;
-  Double_t fVtxErrX,fVtxErrY,fVtxErrZ;
+  Double_t fVtxPos[3];
+  Double_t fVtxErr[3];
   Double_t fVtxChi2,fVtxNDF;
-  UShort_t fBCrossNum, fNtracklets;
+  Double_t fKfVtxPos[3];
+  UShort_t fBCrossNum, fNtracklets, fNLooseTracks;
   //vzero, zdc
   Double_t fZDCAenergy, fZDCCenergy;
   Int_t fV0Adecision, fV0Cdecision;