bug fix in the vertex selection
authorhdalsgaa <hdalsgaa@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 24 Nov 2009 16:25:30 +0000 (16:25 +0000)
committerhdalsgaa <hdalsgaa@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 24 Nov 2009 16:25:30 +0000 (16:25 +0000)
PWG2/FORWARD/analysis/AliFMDAnaParameters.cxx
PWG2/FORWARD/analysis/AliFMDAnaParameters.h
PWG2/FORWARD/analysis/AliFMDAnalysisTaskDensity.cxx
PWG2/FORWARD/analysis/AliFMDAnalysisTaskGenerateCorrection.cxx
PWG2/FORWARD/analysis/AliFMDAnalysisTaskSharing.cxx
PWG2/FORWARD/corrections/Background/background_0_0_1_0_0_0.root
PWG2/FORWARD/corrections/SharingEfficiency/sharingefficiency_0_0_1_0_0_0.root [new file with mode: 0644]

index 9464de12576e7281c2c1f3d3b4110db4176db3b5..bd013b27f2aef4ebb24db0ce05fca2b0a35dec41 100644 (file)
@@ -553,29 +553,15 @@ Float_t AliFMDAnaParameters::GetEtaFromStrip(UShort_t det, Char_t ring, UShort_t
 
 //_____________________________________________________________________
 
-void AliFMDAnaParameters::GetVertex(AliESDEvent* esd, Double_t* vertexXYZ) 
+Bool_t AliFMDAnaParameters::GetVertex(AliESDEvent* esd, Double_t* vertexXYZ) 
 {
+  
   const AliESDVertex* vertex = 0;
-  vertex = esd->GetPrimaryVertex();
-  if(!vertex || (vertex->GetXv() < 0.0001 && vertex->GetYv() < 0.0001 && vertex->GetZv() < 0.0001))        
-    vertex = esd->GetPrimaryVertexSPD();
-  if(!vertex || (vertex->GetXv() < 0.0001 && vertex->GetYv() < 0.0001 && vertex->GetZv() < 0.0001))        
-    vertex = esd->GetPrimaryVertexTPC();
-  if(!vertex || (vertex->GetXv() < 0.0001 && vertex->GetYv() < 0.0001 && vertex->GetZv() < 0.0001))    
-    vertex = esd->GetVertex();
-  if (vertex && (vertex->GetXv() > 0.0001 || vertex->GetYv() > 0.0001 || vertex->GetZv() > 0.0010)) {
+  vertex = esd->GetPrimaryVertexSPD();
+  if(vertex)
     vertex->GetXYZ(vertexXYZ);
-    return;
-  }
-  else { //no valid vertex
-    vertexXYZ[0] = 0;
-    vertexXYZ[1] = 0;
-    vertexXYZ[2] = 0;
-    
-    return;
-  }
   
-  return;
+  return vertex->GetStatus();
   
 }
 
index cd873e87fbf3791908908b14a5d78483bb3c6c80..aacb0dfaccb3324ef22c98a852d1921cee9c023a 100644 (file)
@@ -110,7 +110,7 @@ public:
   void     SetProcessHits(Bool_t hits=kTRUE) {fProcessHits = hits;}
   Bool_t   GetProcessPrimary() const {return fProcessPrimary;} 
   Bool_t   GetProcessHits() const {return fProcessHits;}
-  void     GetVertex(AliESDEvent* esd, Double_t* vertexXYZ);
+  Bool_t   GetVertex(AliESDEvent* esd, Double_t* vertexXYZ);
   void     SetTriggerDefinition(Trigger trigger) {fTrigger = trigger;}
   Trigger  GetTriggerDefinition() const {return fTrigger;}
   Bool_t   IsEventTriggered(AliESDEvent* esd) const;
index 966f82eae29edf82c0e8690afa88a8689004be54..dae55477acfd19a2df514984e90b529c64839b0f 100644 (file)
@@ -71,10 +71,13 @@ void AliFMDAnalysisTaskDensity::CreateOutputObjects()
   
   fOutputList->Add(&fVertexString);
   
+  
+  
   TH2F* hMult = 0;
   
   Int_t nVtxbins = pars->GetNvtxBins();
   
+
   for(Int_t det =1; det<=3;det++)
     {
       Int_t nRings = (det==1 ? 1 : 2);
index 437c8b4e4010e959209bc9aa71fb6459bcccb10d..ef678e15c71c563850b5166de7e6b1f92376296a 100644 (file)
@@ -112,11 +112,18 @@ void AliFMDAnalysisTaskGenerateCorrection::UserCreateOutputObjects()
   
   TH1F* hEventsSelected  = new TH1F("EventsSelected","EventsSelected",fNvtxBins,0,fNvtxBins);
   TH1F* hEventsAll    = new TH1F("EventsAll","EventsAll",fNvtxBins,0,fNvtxBins);
+  TH1F* hEventsSelectedVtx  = new TH1F("EventsSelectedVtx","EventsSelectedVtx",fNvtxBins,0,fNvtxBins);  
+  TH1F* hEventsSelectedTrigger  = new TH1F("EventsSelectedTrigger","EventsSelectedTrigger",fNvtxBins,0,fNvtxBins);
+
+  
+  
   //  TH1F* hTriggered    = new TH1F("Triggered","Triggered",fNvtxBins,0,fNvtxBins);
   // TH1F* hTriggeredAll = new TH1F("TriggeredAll","TriggeredAll",fNvtxBins,0,fNvtxBins);
   hEventsSelected->Sumw2();
   hEventsAll->Sumw2();
   fListOfHits.Add(hEventsSelected);
+  fListOfHits.Add(hEventsSelectedVtx);
+  fListOfHits.Add(hEventsSelectedTrigger);
   fListOfPrimaries.Add(hEventsAll);
   
   // fListOfHits.Add(hTriggered);
@@ -146,7 +153,7 @@ void AliFMDAnalysisTaskGenerateCorrection::UserExec(Option_t */*option*/)
   
   AliESDEvent* esdevent = (AliESDEvent*)InputEvent();
   Double_t esdvertex[3];
-  pars->GetVertex(esdevent,esdvertex);
+  Bool_t vtxStatus =  pars->GetVertex(esdevent,esdvertex);
   
   AliMCParticle* particle = 0;
   AliStack* stack = mcevent->Stack();
@@ -169,28 +176,27 @@ void AliFMDAnalysisTaskGenerateCorrection::UserExec(Option_t */*option*/)
   Int_t    vertexBin       = (Int_t)vertexBinDouble;
   
   // Vertex determination correction
-  TH1F* hEventsSelected    = (TH1F*)fListOfHits.FindObject("EventsSelected");
-  TH1F* hEventsAll         = (TH1F*)fListOfPrimaries.FindObject("EventsAll");
+  TH1F* hEventsSelected           = (TH1F*)fListOfHits.FindObject("EventsSelected");
+  TH1F* hEventsSelectedVtx        = (TH1F*)fListOfHits.FindObject("EventsSelectedVtx");
+  TH1F* hEventsSelectedTrigger    = (TH1F*)fListOfHits.FindObject("EventsSelectedTrigger");
+  TH1F* hEventsAll                = (TH1F*)fListOfPrimaries.FindObject("EventsAll");
+  
   // TH1F* hTriggered      = (TH1F*)fListOfHits.FindObject("Triggered");
   //  TH1F* hTriggeredAll   = (TH1F*)fListOfPrimaries.FindObject("TriggeredAll");
   
   Bool_t vtxFound = kTRUE;
-  if(esdvertex[0] == 0 && esdvertex[1] == 0 && esdvertex[2] == 0)
+  if(!vtxStatus)
     vtxFound = kFALSE;
-    
-  Bool_t isTriggered = pars->IsEventTriggered(esdevent);
   
-  if(vtxFound && isTriggered) {
-    //hTriggered->Fill(vertexBin);
-    hEventsSelected->Fill(vertexBin);
-  }
+  Bool_t isTriggered = pars->IsEventTriggered(esdevent);
   
-  //if(isTriggered)
+  if(vtxFound && isTriggered) hEventsSelected->Fill(vertexBin);
   
+  if(vtxFound) hEventsSelectedVtx->Fill(vertexBin);
+  if(isTriggered) hEventsSelectedTrigger->Fill(vertexBin);
+    
   hEventsAll->Fill(vertexBin);
-  //if(vtxFound)
-  //   hTriggeredAll->Fill(vertexBin);
-  
+    
   for(Int_t i = 0 ;i<nTracks;i++) {
     particle = (AliMCParticle*) mcevent->GetTrack(i);
     
@@ -267,11 +273,14 @@ void AliFMDAnalysisTaskGenerateCorrection::GenerateCorrection() {
   //TH1F* hTriggered      = (TH1F*)fListOfHits.FindObject("Triggered");
   //TH1F* hTriggeredAll   = (TH1F*)fListOfPrimaries.FindObject("TriggeredAll");
   
-  TH1F* hEventsSelected    = (TH1F*)fListOfHits.FindObject("EventsSelected");
-  TH1F* hEventsAll         = (TH1F*)fListOfPrimaries.FindObject("EventsAll");
+  TH1F* hEventsSelected           = (TH1F*)fListOfHits.FindObject("EventsSelected");
+  TH1F* hEventsSelectedVtx        = (TH1F*)fListOfHits.FindObject("EventsSelectedVtx");
+  TH1F* hEventsSelectedTrigger    = (TH1F*)fListOfHits.FindObject("EventsSelectedTrigger");
+  TH1F* hEventsAll                = (TH1F*)fListOfPrimaries.FindObject("EventsAll");
   
   //  hEventsAll->Divide(hEventsAll,hEventsSelected,1,1,"B");
+  hEventsSelectedVtx->Divide(hEventsAll);
+  hEventsSelectedTrigger->Divide(hEventsAll);
   
   for(Int_t i = 1; i<=hEventsSelected->GetNbinsX(); i++) {
     if(hEventsSelected->GetBinContent(i) == 0 )
@@ -346,9 +355,14 @@ void AliFMDAnalysisTaskGenerateCorrection::ReadFromFile(const Char_t* filename,
   TList* listOfHits = (TList*)infile.Get("Hits");
   TList* listOfPrim = (TList*)infile.Get("Primaries");
   
-  TH1F* hEventsSelected    = (TH1F*)listOfHits->FindObject("EventsSelected");
-  TH1F* hEventsAll         = (TH1F*)listOfPrim->FindObject("EventsAll");
+  TH1F* hEventsSelected           = (TH1F*)listOfHits->FindObject("EventsSelected");
+  TH1F* hEventsSelectedVtx        = (TH1F*)listOfHits->FindObject("EventsSelectedVtx");
+  TH1F* hEventsSelectedTrigger    = (TH1F*)listOfHits->FindObject("EventsSelectedTrigger");
+  TH1F* hEventsAll                = (TH1F*)listOfPrim->FindObject("EventsAll");
+  
   fListOfHits.Add(hEventsSelected);
+  fListOfHits.Add(hEventsSelectedVtx);
+  fListOfHits.Add(hEventsSelectedTrigger);
   fListOfPrimaries.Add(hEventsAll);
   
   for(Int_t det =1; det<=3;det++)
index 209ddd9f0ce25505b026f2126b115aa5e2d7d4e0..3228a0f4ea0a383c76298efeca6e1790b717d0ba 100644 (file)
@@ -104,6 +104,10 @@ void AliFMDAnalysisTaskSharing::CreateOutputObjects()
                            hBg->GetXaxis()->GetXmax());
   hPrimary->Sumw2();
   fDiagList->Add(hPrimary);
+  TH1F* hZvtx = new TH1F("hZvtx","z vertex distribution",pars->GetNvtxBins(),-1*pars->GetVtxCutZ(),pars->GetVtxCutZ());
+  
+  fDiagList->Add(hZvtx);
+  
   TH1F* hPrimVertexBin = 0;
   TH1F* hHits = 0;
   for(Int_t i = 0; i< pars->GetNvtxBins(); i++) {
@@ -175,7 +179,7 @@ void AliFMDAnalysisTaskSharing::Exec(Option_t */*option*/)
   
   AliFMDAnaParameters* pars = AliFMDAnaParameters::Instance();
   Double_t vertex[3];
-  pars->GetVertex(fESD,vertex);
+  Bool_t vtxStatus = pars->GetVertex(fESD,vertex);
   fEsdVertex->SetXYZ(vertex);
   
   // Process primaries here to get true MC distribution
@@ -183,21 +187,24 @@ void AliFMDAnalysisTaskSharing::Exec(Option_t */*option*/)
     ProcessPrimary();
   
   Bool_t isTriggered = pars->IsEventTriggered(fESD);
+  
   if(!isTriggered) {
     fStatus = kFALSE;
     return;
    }
    else
-    fStatus = kTRUE;
+     fStatus = kTRUE;
   
-  if(vertex[0] < 0.0001 && vertex[1] < 0.0001 && vertex[2] < 0.0001) {
+  if(!vtxStatus) {
     fStatus = kFALSE;
     return;
   }
   else
     fStatus = kTRUE;
   
+  TH1F* hZvtx = (TH1F*)fDiagList->FindObject("hZvtx");
+  hZvtx->Fill(vertex[2]);
   
   const AliMultiplicity* testmult = fESD->GetMultiplicity();
   
index 244a3fbe3d78e65d525b80d7c96224e05e752589..1d429ab6b3c4ed758d4fbe234dbdb2f16bcb9ff5 100644 (file)
Binary files a/PWG2/FORWARD/corrections/Background/background_0_0_1_0_0_0.root and b/PWG2/FORWARD/corrections/Background/background_0_0_1_0_0_0.root differ
diff --git a/PWG2/FORWARD/corrections/SharingEfficiency/sharingefficiency_0_0_1_0_0_0.root b/PWG2/FORWARD/corrections/SharingEfficiency/sharingefficiency_0_0_1_0_0_0.root
new file mode 100644 (file)
index 0000000..6114ee0
Binary files /dev/null and b/PWG2/FORWARD/corrections/SharingEfficiency/sharingefficiency_0_0_1_0_0_0.root differ