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 9464de1..bd013b2 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 cd873e8..aacb0df 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 966f82e..dae5547 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 437c8b4..ef678e1 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 209ddd9..3228a0f 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 244a3fb..1d429ab 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