- Removed small bug (otherwise chargeVector was not filled for normal data)
authorpchrist <pchrist@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 14 Oct 2011 11:37:38 +0000 (11:37 +0000)
committerpchrist <pchrist@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 14 Oct 2011 11:37:38 +0000 (11:37 +0000)
- Added Additional track cuts (for further systematic studies)
- Consistency between ESD and AOD analysis

PWG2/EBYE/AliAnalysisTaskBF.cxx
PWG2/EBYE/AliAnalysisTaskBF.h
PWG2/EBYE/macros/AddTaskBalanceCentralityTrain.C
PWG2/EBYE/macros/configBalanceFunctionAnalysis.C
PWG2/EBYE/macros/readBalanceFunction.C
PWG2/EBYE/macros/runBalanceFunction.C

index 98ab88c..7f99725 100755 (executable)
@@ -39,6 +39,7 @@ AliAnalysisTaskBF::AliAnalysisTaskBF(const char *name)
   fListBF(0),\r
   fListBFS(0),\r
   fHistEventStats(0),\r
+  fHistTriggerStats(0),\r
   fHistTrackStats(0),\r
   fHistVx(0),\r
   fHistVy(0),\r
@@ -63,8 +64,10 @@ AliAnalysisTaskBF::AliAnalysisTaskBF(const char *name)
   fPtMax(1.5),\r
   fEtaMin(-0.8),\r
   fEtaMax(-0.8),\r
-  fDCAxyCut(2.4),\r
-  fDCAzCut(3.2){\r
+  fDCAxyCut(-1),\r
+  fDCAzCut(-1),\r
+  fTPCchi2Cut(-1),\r
+  fNClustersTPCCut(-1){\r
   // Constructor\r
 \r
   // Define input and output slots here\r
@@ -145,6 +148,9 @@ void AliAnalysisTaskBF::UserCreateOutputObjects() {
     fHistEventStats->GetXaxis()->SetBinLabel(i,gCutName[i-1].Data());\r
   fList->Add(fHistEventStats);\r
 \r
+  fHistTriggerStats = new TH1F("fHistTriggerStats","Trigger statistics;TriggerBit;N_{events}",130,0,130);\r
+  fList->Add(fHistTriggerStats);\r
+\r
   fHistTrackStats = new TH1F("fHistTrackStats","Event statistics;TriggerBit;N_{events}",130,0,130);\r
   fList->Add(fHistTrackStats);\r
 \r
@@ -214,8 +220,7 @@ void AliAnalysisTaskBF::UserCreateOutputObjects() {
   PostData(1, fList);\r
   PostData(2, fListBF);\r
   if(fRunShuffling) PostData(3, fListBFS);\r
-  \r
-  }\r
+}\r
 \r
 //________________________________________________________________________\r
 void AliAnalysisTaskBF::UserExec(Option_t *) {\r
@@ -224,10 +229,12 @@ void AliAnalysisTaskBF::UserExec(Option_t *) {
   TString gAnalysisLevel = fBalance->GetAnalysisLevel();\r
 \r
   TObjArray *array         = new TObjArray();\r
+  AliESDtrack *track_TPC   = NULL;\r
+\r
 \r
   // vector holding the charges of all tracks\r
   vector<Int_t> chargeVectorShuffle;   // this will be shuffled\r
-  vector<Int_t> chargeVector;          // to remember the original charge ( set back after shuffling )\r
+  vector<Int_t> chargeVector;          // original charge \r
   \r
   //ESD analysis\r
   if(gAnalysisLevel == "ESD") {\r
@@ -237,6 +244,9 @@ void AliAnalysisTaskBF::UserExec(Option_t *) {
       return;\r
     }\r
 \r
+    // store offline trigger bits\r
+    fHistTriggerStats->Fill(((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected());\r
+\r
     // event selection done in AliAnalysisTaskSE::Exec() --> this is not used\r
     fHistEventStats->Fill(1); //all events\r
     Bool_t isSelected = kTRUE;\r
@@ -280,36 +290,50 @@ void AliAnalysisTaskBF::UserExec(Option_t *) {
                        continue;\r
                      } \r
 \r
-                     // take only TPC only tracks (HOW IS THIS DONE IN ESDs???)\r
-                     //if(!track->IsTPCOnly()) continue;\r
-\r
+                     // take only TPC only tracks\r
+                     track_TPC   = new AliESDtrack();\r
+                     if(!track->FillTPCOnlyTrack(*track_TPC)) continue;\r
+                     \r
                      //ESD track cuts\r
                      if(fESDtrackCuts) \r
-                       if(!fESDtrackCuts->AcceptTrack(track)) continue;\r
-\r
+                       if(!fESDtrackCuts->AcceptTrack(track_TPC)) continue;\r
+                     \r
                      // fill QA histograms\r
                      Float_t b[2];\r
                      Float_t bCov[3];\r
-                     track->GetImpactParameters(b,bCov);\r
+                     track_TPC->GetImpactParameters(b,bCov);\r
                      if (bCov[0]<=0 || bCov[2]<=0) {\r
                        AliDebug(1, "Estimated b resolution lower or equal zero!");\r
                        bCov[0]=0; bCov[2]=0;\r
                      }\r
-\r
-                     fHistClus->Fill(track->GetITSclusters(0),track->GetTPCclusters(0));\r
+                     \r
+                     Int_t nClustersTPC = -1;\r
+                     nClustersTPC = track_TPC->GetTPCNclsIter1();   // TPC standalone\r
+                     //nClustersTPC = track->GetTPCclusters(0);   // global track\r
+                     Float_t chi2PerClusterTPC = -1;\r
+                     if (nClustersTPC!=0) {\r
+                       chi2PerClusterTPC = track_TPC->GetTPCchi2Iter1()/Float_t(nClustersTPC);      // TPC standalone\r
+                       //chi2PerClusterTPC = track->GetTPCchi2()/Float_t(nClustersTPC);     // global track\r
+                     }\r
+                     \r
+                     fHistClus->Fill(track_TPC->GetITSclusters(0),nClustersTPC);\r
                      fHistDCA->Fill(b[1],b[0]);\r
-                     fHistPt->Fill(track->Pt());\r
-                     fHistEta->Fill(track->Eta());\r
-                     fHistPhi->Fill(track->Phi()*TMath::RadToDeg());\r
+                     fHistChi2->Fill(chi2PerClusterTPC);\r
+                     fHistPt->Fill(track_TPC->Pt());\r
+                     fHistEta->Fill(track_TPC->Eta());\r
+                     fHistPhi->Fill(track_TPC->Phi()*TMath::RadToDeg());\r
                      \r
                      // fill BF array\r
-                     array->Add(track);\r
+                     array->Add(track_TPC);\r
 \r
+                     // fill charge vector\r
+                     chargeVector.push_back(track_TPC->Charge());\r
                      if(fRunShuffling){\r
-                       // fill charge vector\r
-                       chargeVector.push_back(track->Charge());\r
-                       chargeVectorShuffle.push_back(track->Charge());\r
+                       chargeVectorShuffle.push_back(track_TPC->Charge());\r
                      }\r
+      \r
+                     delete track_TPC;\r
+\r
                    } //track loop\r
                  }//Vz cut\r
                }//Vy cut\r
@@ -330,6 +354,11 @@ void AliAnalysisTaskBF::UserExec(Option_t *) {
       return;\r
     }\r
 \r
+    AliAODHeader *aodHeader = gAOD->GetHeader();\r
+\r
+    // store offline trigger bits\r
+    fHistTriggerStats->Fill(aodHeader->GetOfflineTrigger());\r
+\r
     // event selection done in AliAnalysisTaskSE::Exec() --> this is not used\r
     fHistEventStats->Fill(1); //all events\r
     Bool_t isSelected = kTRUE;\r
@@ -337,10 +366,8 @@ void AliAnalysisTaskBF::UserExec(Option_t *) {
       isSelected = ((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected();\r
     if(isSelected) {\r
       fHistEventStats->Fill(2); //triggered events\r
-\r
                  \r
       //Centrality stuff (centrality in AOD header)\r
-      AliAODHeader *aodHeader = gAOD->GetHeader();\r
       Float_t fCentrality     = aodHeader->GetCentralityP()->GetCentralityPercentile(fCentralityEstimator.Data());\r
       // cout<<fCentralityEstimator.Data()<<" = "<<fCentrality<<" ,  others are V0M =  "\r
       //         << aodHeader->GetCentralityP()->GetCentralityPercentile("V0M")\r
@@ -410,6 +437,15 @@ void AliAnalysisTaskBF::UserExec(Option_t *) {
                        }\r
                      }\r
 \r
+                     // Extra TPC cuts (for systematic studies [!= -1])\r
+                     if( fTPCchi2Cut != -1 && aodTrack->Chi2perNDF() > fTPCchi2Cut){\r
+                       continue;\r
+                     }\r
+                     if( fNClustersTPCCut != -1 && aodTrack->GetTPCNcls() < fNClustersTPCCut){\r
+                       continue;\r
+                     }\r
+\r
+\r
                      // fill QA histograms\r
                      fHistClus->Fill(aodTrack->GetITSNcls(),aodTrack->GetTPCNcls());\r
                      fHistDCA->Fill(DCAz,DCAxy);\r
@@ -421,9 +457,9 @@ void AliAnalysisTaskBF::UserExec(Option_t *) {
                      // fill BF array\r
                      array->Add(aodTrack);\r
 \r
+                     // fill charge vector\r
+                     chargeVector.push_back(aodTrack->Charge());\r
                      if(fRunShuffling) {\r
-                       // fill charge vector\r
-                       chargeVector.push_back(aodTrack->Charge());\r
                        chargeVectorShuffle.push_back(aodTrack->Charge());\r
                      }\r
                    } //track loop\r
@@ -459,11 +495,12 @@ void AliAnalysisTaskBF::UserExec(Option_t *) {
 \r
       array->Add(track);\r
 \r
+      // fill charge vector\r
+      chargeVector.push_back(track->Charge());\r
       if(fRunShuffling) {\r
-       // fill charge vector\r
-       chargeVector.push_back(track->Charge());\r
        chargeVectorShuffle.push_back(track->Charge());\r
       }\r
+\r
     } //track loop\r
   }//MC analysis\r
   \r
index 3c6227b..23c6be8 100755 (executable)
@@ -54,6 +54,10 @@ class AliAnalysisTaskBF : public AliAnalysisTaskSE {
     fDCAxyCut  = DCAxy;\r
     fDCAzCut = DCAz;\r
   }\r
+   void SetExtraTPCCutsAOD(Double_t maxTPCchi2, Int_t minNClustersTPC){\r
+    fTPCchi2Cut      = maxTPCchi2;\r
+    fNClustersTPCCut = minNClustersTPC;\r
+  }\r
   void SetKinematicsCutsMC(Double_t ptmin, Double_t ptmax,\r
                            Double_t etamin, Double_t etamax){\r
     fPtMin  = ptmin; fPtMax  = ptmax;\r
@@ -79,6 +83,7 @@ class AliAnalysisTaskBF : public AliAnalysisTaskSE {
   TList *fListBFS; //fList object\r
 \r
   TH1F *fHistEventStats; //event stats\r
+  TH1F *fHistTriggerStats; //trigger stats\r
   TH1F *fHistTrackStats; //Track filter bit stats\r
   TH1F *fHistVx; //x coordinate of the primary vertex\r
   TH1F *fHistVy; //y coordinate of the primary vertex\r
@@ -114,6 +119,9 @@ class AliAnalysisTaskBF : public AliAnalysisTaskSE {
   Double_t fDCAxyCut;//only used for AODs\r
   Double_t fDCAzCut;//only used for AODs\r
 \r
+  Double_t fTPCchi2Cut;//only used for AODs\r
+  Int_t fNClustersTPCCut;//only used for AODs\r
+\r
   AliAnalysisTaskBF(const AliAnalysisTaskBF&); // not implemented\r
   AliAnalysisTaskBF& operator=(const AliAnalysisTaskBF&); // not implemented\r
   \r
index 391e81b..1cb23f0 100644 (file)
@@ -3,18 +3,21 @@ const char* centralityEstimator = "V0M";
 //const char* centralityEstimator = "CL1";\r
 //const char* centralityEstimator = "TRK";\r
 //=============================================//\r
-Bool_t gRunShuffling = kFALSE;\r
+//Bool_t gRunShuffling = kFALSE;\r
+Bool_t gRunShuffling = kTRUE;\r
 //=============================================//\r
 //_________________________________________________________//\r
 AliAnalysisTaskBF *AddTaskBalanceCentralityTrain(Double_t centrMin=0.,\r
                                                 Double_t centrMax=100.,\r
                                                 Double_t vertexZ=10.,\r
-                                                Double_t DCAxy=2.4,\r
-                                                Double_t DCAz=3.2,\r
+                                                Double_t DCAxy=-1,\r
+                                                Double_t DCAz=-1,\r
                                                 Double_t ptMin=0.3,\r
                                                 Double_t ptMax=1.5,\r
                                                 Double_t etaMin=-0.8,\r
                                                 Double_t etaMax=0.8,\r
+                                                Double_t maxTPCchi2 = -1, \r
+                                                Int_t minNClustersTPC = -1,\r
                                                 TString fileNameBase="AnalysisResults") {\r
 \r
   // Creates a balance function analysis task and adds it to the analysis manager.\r
@@ -75,10 +78,12 @@ AliAnalysisTaskBF *AddTaskBalanceCentralityTrain(Double_t centrMin=0.,
   // Create the task, add it to manager and configure it.\r
   //===========================================================================\r
   AliAnalysisTaskBF *taskBF = new AliAnalysisTaskBF("TaskBF");\r
-  taskBF->SetAnalysisObject(bf,bfs);\r
+  taskBF->SetAnalysisObject(bf);\r
+  if(gRunShuffling) taskBF->SetShufflingObject(bfs);\r
+\r
   taskBF->SetCentralityPercentileRange(centrMin,centrMax);\r
   if(analysisType == "ESD") {\r
-    AliESDtrackCuts *trackCuts = GetTrackCutsObject();\r
+    AliESDtrackCuts *trackCuts = GetTrackCutsObject(ptMin,ptMax,etaMin,etaMax,maxTPCchi2,DCAxy,DCAz,minNClustersTPC);\r
     taskBF->SetAnalysisCutObject(trackCuts);\r
 \r
     // offline trigger selection (AliVEvent.h)\r
@@ -90,16 +95,23 @@ AliAnalysisTaskBF *AddTaskBalanceCentralityTrain(Double_t centrMin=0.,
     // pt and eta cut (pt_min, pt_max, eta_min, eta_max)\r
     taskBF->SetAODtrackCutBit(128);\r
     taskBF->SetKinematicsCutsAOD(ptMin,ptMax,etaMin,etaMax);\r
+\r
+    // set extra DCA cuts (-1 no extra cut)\r
     taskBF->SetExtraDCACutsAOD(DCAxy,DCAz);\r
+\r
+    // set extra TPC chi2 / nr of clusters cut\r
+    taskBF->SetExtraTPCCutsAOD(maxTPCchi2, minNClustersTPC);\r
+    \r
   }\r
 \r
   // centrality estimator (default = V0M)\r
     taskBF->SetCentralityEstimator(centralityEstimator);\r
 \r
-\r
     // vertex cut (x,y,z)\r
     taskBF->SetVertexDiamond(.3,.3,vertexZ);\r
 \r
+\r
+\r
     //bf->PrintAnalysisSettings();\r
     mgr->AddTask(taskBF);\r
 \r
index 8f42be9..14b5199 100644 (file)
@@ -29,14 +29,27 @@ AliBalance *GetBalanceFunctionObject(const char* analysisLevel = "ESD",
 }\r
 \r
 //__________________________________________________//\r
-AliESDtrackCuts *GetTrackCutsObject() {\r
+AliESDtrackCuts *GetTrackCutsObject(Double_t ptMin, Double_t ptMax, Double_t etaMin, Double_t etaMax, Double_t maxTPCchi2, Double_t maxDCAz, Double_t maxDCAxy, Int_t minNClustersTPC) {\r
+\r
   // only used for ESDs\r
   // Function to setup the AliESDtrackCuts object and return it\r
   AliESDtrackCuts *cuts = AliESDtrackCuts::GetStandardTPCOnlyTrackCuts();\r
-  cuts->SetMinNClustersTPC(70);\r
+  cuts->SetRequireTPCStandAlone(kTRUE); // TPC only cuts!  \r
+\r
+  // extra TPC cuts (Syst studies)\r
+  if(minNClustersTPC != -1)  cuts->SetMinNClustersTPC(minNClustersTPC);\r
+  else cuts->SetMinNClustersTPC(70); // standard for filter bit 128\r
   \r
-  cuts->SetPtRange(0.3,1.5);\r
-  cuts->SetEtaRange(-0.8,0.8);\r
+  if(maxTPCchi2 != -1) cuts->SetMaxChi2PerClusterTPC(maxTPCchi2);\r
+\r
+  // extra DCA cuts (Syst studies)  \r
+  if(maxDCAz!=-1 && maxDCAxy != -1){\r
+    cuts->SetMaxDCAToVertexZ(maxDCAz);\r
+    cuts->SetMaxDCAToVertexXY(maxDCAxy);\r
+  }\r
+\r
+  cuts->SetPtRange(ptMin,ptMax);\r
+  cuts->SetEtaRange(etaMin,etaMax);\r
   cuts->DefineHistograms(1);\r
   //cuts->SaveHistograms("trackCuts");\r
 \r
index 296836f..e824368 100644 (file)
@@ -249,8 +249,8 @@ void drawBF(Bool_t bHistos = kTRUE, TString inFile = "AnalysisResults.root") {
   fOut->cd();
   for(Int_t i = 0; i < iCanvas; i++){
     for(Int_t a = 0; a < 7; a++){
-      gbf[iCanvas][a]->Write();
-      gbfs[iCanvas][a]->Write();
+      if(gbf[iCanvas][a]) gbf[iCanvas][a]->Write();
+      if(gbfs[iCanvas][a]) gbfs[iCanvas][a]->Write();
     }
   }
 }
index 7c8ff88..a6a7464 100755 (executable)
@@ -155,20 +155,20 @@ void runBalanceFunction(
 \r
     //Add the BF task (all centralities)\r
     gROOT->LoadMacro("AddTaskBalanceCentralityTrain.C"); \r
-    //AliAnalysisTaskBF *task = AddTaskBalanceCentralityTrain(0,5,vZ[0],DCAxy[0],DCAz[0],ptMin[0],ptMax[0],etaMin[0],etaMax[0]);\r
+    AliAnalysisTaskBF *task = AddTaskBalanceCentralityTrain(0,100,vZ[0],DCAxy[0],DCAz[0],ptMin[0],ptMax[0],etaMin[0],etaMax[0]);\r
     \r
-    //Add the BFG task (different centralities)\r
-    for (Int_t i=binfirst; i<binlast+1; i++) {\r
-      Float_t lowCentralityBinEdge = centralityArray[i];\r
-      Float_t highCentralityBinEdge = centralityArray[i+1];\r
+    // //Add the BFG task (different centralities)\r
+    // for (Int_t i=binfirst; i<binlast+1; i++) {\r
+    //   Float_t lowCentralityBinEdge = centralityArray[i];\r
+    //   Float_t highCentralityBinEdge = centralityArray[i+1];\r
       \r
-      // For systematic studies ( A train of centrality trains )\r
-      //for(Int_t j = 0; j < 1/*numberOfSyst*/; j++){\r
-      Int_t j = 0;\r
-      Printf("\nWagon for centrality bin %i: %.0f-%.0f (systematics %d)",i,lowCentralityBinEdge,highCentralityBinEdge,j);\r
-      AddTaskBalanceCentralityTrain(lowCentralityBinEdge,highCentralityBinEdge,vZ[j],DCAxy[j],DCAz[j],ptMin[j],ptMax[j],etaMin[j],etaMax[j]);\r
-      //}\r
-    } \r
+    //   // For systematic studies ( A train of centrality trains )\r
+    //   //for(Int_t j = 0; j < 1/*numberOfSyst*/; j++){\r
+    //   Int_t j = 0;\r
+    //   Printf("\nWagon for centrality bin %i: %.0f-%.0f (systematics %d)",i,lowCentralityBinEdge,highCentralityBinEdge,j);\r
+    //   AddTaskBalanceCentralityTrain(lowCentralityBinEdge,highCentralityBinEdge,vZ[j],DCAxy[j],DCAz[j],ptMin[j],ptMax[j],etaMin[j],etaMax[j]);\r
+    //   //}\r
+    // } \r
     \r
         \r
 \r