]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Added option for vertex and small fix for Poisson
authorhdalsgaa <hdalsgaa@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 17 Jun 2011 12:43:51 +0000 (12:43 +0000)
committerhdalsgaa <hdalsgaa@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 17 Jun 2011 12:43:51 +0000 (12:43 +0000)
PWG2/FORWARD/analysis2/AliFMDDensityCalculator.cxx
PWG2/FORWARD/analysis2/AliFMDEventInspector.cxx
PWG2/FORWARD/analysis2/AliFMDEventInspector.h

index c81d395da9af0a88c34f866becc16a3b591f42f3..9d72637cea0e3feaa975244e190443b345e33398 100644 (file)
@@ -370,7 +370,9 @@ AliFMDDensityCalculator::Calculate(const AliESDFMD&        fmd,
          // Mean in region of interest 
          Double_t poissonM = (total <= 0 || empty <= 0 ? 0 : 
                               -TMath::Log(empty / total));
-
+         //Full occupancy should give high correction not zero
+         if(empty < 0.001 && total > 0 ) poissonM = -TMath::Log( 1. / total);
+         
          // Note, that given filled=total-empty, and 
          //
          //     m = -log(empty/total)
index ba3bcec334cd355c140fbfa5db36b7fa349b344d..737698cc12e9c155bc545c354e1e3a3fba55c480 100644 (file)
@@ -51,7 +51,8 @@ AliFMDEventInspector::AliFMDEventInspector()
     fCollisionSystem(kUnknown),
     fDebug(0),
     fCentAxis(0),
-    fVtxAxis(10,-10,10)
+    fVtxAxis(10,-10,10),
+    fUseFirstPhysicsVertex(true)
 {
   // 
   // Constructor 
@@ -77,7 +78,8 @@ AliFMDEventInspector::AliFMDEventInspector(const char* name)
     fCollisionSystem(kUnknown),
     fDebug(0),
     fCentAxis(0),
-    fVtxAxis(10,-10,10)
+    fVtxAxis(10,-10,10),
+    fUseFirstPhysicsVertex(true)
 {
   // 
   // Constructor 
@@ -106,7 +108,8 @@ AliFMDEventInspector::AliFMDEventInspector(const AliFMDEventInspector& o)
     fCollisionSystem(o.fCollisionSystem),
     fDebug(0),
     fCentAxis(0),
-    fVtxAxis(o.fVtxAxis)
+    fVtxAxis(o.fVtxAxis),
+    fUseFirstPhysicsVertex(o.fUseFirstPhysicsVertex)
 {
   // 
   // Copy constructor 
@@ -155,6 +158,9 @@ AliFMDEventInspector::operator=(const AliFMDEventInspector& o)
   fCollisionSystem   = o.fCollisionSystem;
   fVtxAxis.Set(o.fVtxAxis.GetNbins(), o.fVtxAxis.GetXmin(), 
               o.fVtxAxis.GetXmax());
+  
+  fUseFirstPhysicsVertex = o.fUseFirstPhysicsVertex;
+  
   if (fList) { 
     fList->SetName(GetName());
     if (fHEventsTr)    fList->Add(fHEventsTr);
@@ -687,68 +693,71 @@ AliFMDEventInspector::ReadVertex(const AliESDEvent* esd, Double_t& vz)
   //    @c true on success, @c false otherwise 
   //
   vz = 0;
-#if 1
-  // This is the code used by the 1st physics people 
-  const AliESDVertex* vertex    = esd->GetPrimaryVertex();
-  if (!vertex  || !vertex->GetStatus()) {
-    if (fDebug > 2) {
-      AliWarning(Form("No primary vertex (%p) or bad status %d", 
-                     vertex, (vertex ? vertex->GetStatus() : -1)));
-    }
-    return false;
-  }
-  const AliESDVertex* vertexSPD = esd->GetPrimaryVertexSPD();
-  if (!vertexSPD || !vertexSPD->GetStatus()) {
-    if (fDebug > 2) {
-      AliWarning(Form("No primary SPD vertex (%p) or bad status %d", 
-                     vertexSPD, (vertexSPD ? vertexSPD->GetStatus() : -1)));
+  
+  if(fUseFirstPhysicsVertex) {
+    // This is the code used by the 1st physics people 
+    const AliESDVertex* vertex    = esd->GetPrimaryVertex();
+    if (!vertex  || !vertex->GetStatus()) {
+      if (fDebug > 2) {
+       AliWarning(Form("No primary vertex (%p) or bad status %d", 
+                       vertex, (vertex ? vertex->GetStatus() : -1)));
+      }
+      return false;
     }
-    return false;
-  }
-
-  // if vertex is from SPD vertexZ, require more stringent cuts 
-  if (vertex->IsFromVertexerZ()) { 
-    if (vertex->GetDispersion() > fMaxVzErr || 
-       vertex->GetZRes() > 1.25 * fMaxVzErr) {
+    const AliESDVertex* vertexSPD = esd->GetPrimaryVertexSPD();
+    if (!vertexSPD || !vertexSPD->GetStatus()) {
       if (fDebug > 2) {
-       AliWarning(Form("Dispersion %f > %f or resolution %f > %f",
-                       vertex->GetDispersion(), fMaxVzErr,
-                       vertex->GetZRes(), 1.25 * fMaxVzErr)); 
+       AliWarning(Form("No primary SPD vertex (%p) or bad status %d", 
+                       vertexSPD, (vertexSPD ? vertexSPD->GetStatus() : -1)));
       }
       return false;
     }
-  }
-  vz = vertex->GetZ();
-  return true;
-#else 
-  // Get the vertex 
-  const AliESDVertex* vertex = esd->GetPrimaryVertexSPD();
-  if (!vertex) { 
-    if (fDebug > 2) {
-      AliWarning("No SPD vertex found in ESD"); }
-    return kFALSE;
-  }
-  
-  // Check that enough tracklets contributed 
-  if(vertex->GetNContributors() <= 0) {
-    if (fDebug > 2) {
-      AliWarning(Form("Number of contributors to vertex is %d<=0",
-                     vertex->GetNContributors())); }
-    vz = 0;
-    return kFALSE;
+    
+    // if vertex is from SPD vertexZ, require more stringent cuts 
+    if (vertex->IsFromVertexerZ()) { 
+      if (vertex->GetDispersion() > fMaxVzErr || 
+         vertex->GetZRes() > 1.25 * fMaxVzErr) {
+       if (fDebug > 2) {
+         AliWarning(Form("Dispersion %f > %f or resolution %f > %f",
+                         vertex->GetDispersion(), fMaxVzErr,
+                         vertex->GetZRes(), 1.25 * fMaxVzErr)); 
+       }
+       return false;
+      }
+    }
+    vz = vertex->GetZ();
+    return true;
   } 
-  // Check that the uncertainty isn't too large 
-  if (vertex->GetZRes() > fMaxVzErr) { 
-    if (fDebug > 2) {
-      AliWarning(Form("Uncertaintity in Z of vertex is too large %f > %f", 
+  else { //Use standard SPD vertex (perhaps preferable for Pb+Pb)
+   
+    // Get the vertex 
+    const AliESDVertex* vertex = esd->GetPrimaryVertexSPD();
+    if (!vertex) { 
+      if (fDebug > 2) {
+       AliWarning("No SPD vertex found in ESD"); }
+      return kFALSE;
+    }
+    
+    // Check that enough tracklets contributed 
+    if(vertex->GetNContributors() <= 0) {
+      if (fDebug > 2) {
+       AliWarning(Form("Number of contributors to vertex is %d<=0",
+                       vertex->GetNContributors())); }
+      vz = 0;
+      return kFALSE;
+    } 
+    // Check that the uncertainty isn't too large 
+    if (vertex->GetZRes() > fMaxVzErr) { 
+      if (fDebug > 2) {
+       AliWarning(Form("Uncertaintity in Z of vertex is too large %f > %f", 
                      vertex->GetZRes(), fMaxVzErr)); }
-    return kFALSE;
-  }
-  
-  // Get the z coordiante 
-  vz = vertex->GetZ();
-  return kTRUE;
-#endif 
+      return kFALSE;
+    }
+    
+    // Get the z coordiante 
+    vz = vertex->GetZ();
+    return kTRUE;
+  } 
 }
   
 //____________________________________________________________________
index 97302004a3782c51a5912d79148848979968931d..be3e576cf373b35fb087cf34a1b81d2b48daaf89 100644 (file)
@@ -168,6 +168,12 @@ public:
    * @param c Maximum error (in centimeters)
    */
   void SetMaxVzErr(Double_t c=0.1) { fMaxVzErr = c; }
+  /** 
+   * Use the first physics vtx code.   
+   * 
+   * @param use Use it or not 
+   */
+  void SetUseFirstPhysicsVtx(Bool_t use) {fUseFirstPhysicsVertex = use; }
   /** 
    * Set the debug level.  The higher the value the more output 
    * 
@@ -284,6 +290,7 @@ protected:
   Int_t    fDebug;        //  Debug level 
   TAxis*   fCentAxis;     // Centrality axis used in histograms
   TAxis    fVtxAxis;
+  Bool_t   fUseFirstPhysicsVertex; //Use the vtx code from p+p first physics
   ClassDef(AliFMDEventInspector,3); // Inspect the event 
 };