]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - FMD/AliFMDPattern.cxx
Merge branch 'master' of https://git.cern.ch/reps/AliRoot
[u/mrichter/AliRoot.git] / FMD / AliFMDPattern.cxx
index a359e6445f7872c5fcf8c4c9e30762e92356b32d..22d2690de7bc382c46872286306f0c735b33d120 100644 (file)
@@ -29,7 +29,7 @@
 // Latest changes by Christian Holm Christensen
 //
 
-// #include <iostream>
+#include <iostream>
 
 // #include <TApplication.h>
 // #include <TButton.h>
 #include "AliFMDRing.h"
 // #include "AliFMDDetector.h"
 #include "AliFMDHit.h"
+#include "AliMultiplicity.h"
+#include "AliESDEvent.h"
+#include "AliESDVertex.h"
 // #include <AliLog.h>
 #include "AliFMDDebug.h" // Better debug macros
+// #include "AliPhysicsSelection.h"
 class AliFMDDetector;
 
 //____________________________________________________________________
@@ -87,7 +91,7 @@ AliFMDPattern::AliFMDPatternDetector::~AliFMDPatternDetector()
 
 //____________________________________________________________________
 void
-AliFMDPattern::AliFMDPatternDetector::DrawShape(TObjArray& a) 
+AliFMDPattern::AliFMDPatternDetector::DrawShape(const TObjArray& a) 
 {
   // Draw all shapes. 
   // 
@@ -105,12 +109,22 @@ AliFMDPattern::AliFMDPatternDetector::DrawShape(TObjArray& a)
 
 //____________________________________________________________________
 void
-AliFMDPattern::AliFMDPatternDetector::CopyShapes(TObjArray& src, 
+AliFMDPattern::AliFMDPatternDetector::CopyShapes(const TObjArray& src, 
                                                 TObjArray& dest, 
                                                 Double_t ang, 
                                                 Double_t fx, 
                                                 Double_t fy)
 {
+  // 
+  // Copy shapes
+  // 
+  // Parameters:
+  //    input  Source
+  //    own    Ours
+  //    ang    Angle 
+  //    fx     Factor x
+  //    fy     Factor y
+  //
   TIter     next(&src);
   TGraph*   g = 0;
   while ((g = static_cast<TGraph*>(next()))) { 
@@ -217,6 +231,8 @@ AliFMDPattern::AliFMDPatternDetector::End()
   // Simply resets number of points at each level to 
   // the seen number of hits at that level. 
   // Avoid deleting memory. 
+  
   TIter   next(&fGraphs);
   TGraph* g = 0;
   Int_t   i = 0;
@@ -248,10 +264,17 @@ AliFMDPattern::AliFMDPatternDetector::AddMarker(Double_t x,
   //   X,Y,Z           Coordiantes 
   //   MAX             Maximum value. 
   // 
-  /** Sigh, for some odd reason, the code-checker does not recognise
-      this a usage of the TMath namespace declaration! Idiot */
+  // Sigh, for some odd reason, the code-checker does not recognise
+  // this a usage of the TMath namespace declaration! Idiot 
+  // 
   Int_t i = TMath::Min(Int_t(fCounts.fN * s / max),  
                       Int_t(fGraphs.GetEntries()-1));
+  if (i < 0 || i >= fCounts.fN) { 
+    std::cerr << "Graph index " << i << " out of bounds [0," 
+             << fCounts.fN << ") - " 
+             << fCounts.fN << " * " << s << " / " << max << std::endl;
+    return;
+  }
   TGraph* g = static_cast<TGraph*>(fGraphs.At(i));
   if (!g) return;
   g->SetPoint(fCounts[i]++, x, y);
@@ -277,7 +300,10 @@ AliFMDPattern::AliFMDPattern(const char* gAliceFile)
     fFMD2Sum(.2, .6, "# in FMD2: "),
     fFMD3Sum(.2, .5, "# in FMD3: "),
     fLine(.15, .47, .85, .47),
-    fTotal(.2, .35, "Total:   ")
+    fTotal(.2, .35, "Total:   "), 
+    fFMD1Area(0),
+    fFMD2Area(0),
+    fFMD3Area(0)// ,fPhysicsSelection(0)
 {
   // Constructor. 
   // 
@@ -288,7 +314,7 @@ AliFMDPattern::AliFMDPattern(const char* gAliceFile)
 
   SetName("AliFMDPattern");
   SetName("2D display of FMD data");
-  
+  // fPhysicsSelection = new AliPhysicsSelection();
   // RemoveLoad(kGeometry);
   fEvent.SetBit(TLatex::kTextNDC);
   fFMD1Sum.SetBit(TLatex::kTextNDC);
@@ -321,11 +347,26 @@ AliFMDPattern::Init()
   geom->Init();
   geom->InitTransformations();
   
+  fFMD1Area = 0;
+  fFMD2Area = 0;
+  fFMD3Area = 0;
+
+  Double_t innerArea = 0;
+  Double_t outerArea = 0;
+
   Char_t rs[] = { 'I' , 'O', '\0' };
   Char_t *r   = rs;
   do {
     AliFMDRing* ring = geom->GetRing(*r);
     if (!ring) continue;
+
+    Double_t rl   = ring->GetMinR();
+    Double_t rh   = ring->GetMaxR();
+    Double_t area = rh * rh * TMath::Pi() - rl * rl * TMath::Pi();
+    if (*r == 'I') innerArea = area;
+    else           outerArea = area;
+      
+
     const TObjArray& vs = ring->GetVerticies();
     TObjArray&       gs = (*r == 'I' ? fInners   : fOuters);
     Float_t&         mr = (*r == 'I' ? fInnerMax : fOuterMax);
@@ -363,7 +404,11 @@ AliFMDPattern::Init()
       g->SetLineStyle(2);
     }
   } while (*(++r));
-    
+
+  fFMD1Area = innerArea;
+  fFMD2Area = innerArea + outerArea;
+  fFMD3Area = innerArea + outerArea;
+  
   return kTRUE;
 }
 
@@ -424,6 +469,17 @@ AliFMDPattern::Begin(Int_t event)
   fFMD1.Clear();
   fFMD2.Clear();
   fFMD3.Clear();
+  
+#if 0
+  TString triggers = fESDEvent->GetFiredTriggerClasses();
+  const AliESDVertex* vertex = fESDEvent->GetPrimaryVertexSPD();
+  Double_t vertexXYZ[3];
+  vertex->GetXYZ(vertexXYZ);
+  const AliMultiplicity* mult = fESDEvent->GetMultiplicity();
+  Int_t nTrackLets = mult->GetNumberOfTracklets();
+  std::cout<<triggers.Data()<<"  "<<fPhysicsSelection->IsCollisionCandidate(fESDEvent)<<"    "<<nTrackLets<<"   "<<vertexXYZ[0]<<"   "<<vertexXYZ[1]<<"   "<<vertexXYZ[2]<<std::endl;
+#endif   
+  
   return AliFMDInput::Begin(event);
 }
 
@@ -449,17 +505,20 @@ AliFMDPattern::AtEnd()
   
   fFMD1.End();
   fFMD1Pad->Modified();
-  fFMD1Sum.SetTitle(Form("# hits in FMD1: %5d", fFMD1.Total()));
+  fFMD1Sum.SetTitle(Form("# hits in FMD1: %5d   (%4.2f /cm^{2})", 
+                        fFMD1.Total(), fFMD1.Total()/fFMD1Area));
   total += fFMD1.Total();
 
   fFMD2.End();
   fFMD2Pad->Modified();
-  fFMD2Sum.SetTitle(Form("# hits in FMD2: %5d", fFMD2.Total()));
+  fFMD2Sum.SetTitle(Form("# hits in FMD2: %5d   (%4.2f /cm^{2})", 
+                        fFMD2.Total(), fFMD2.Total()/fFMD2Area));
   total += fFMD2.Total();
 
   fFMD3.End();
   fFMD3Pad->Modified();
-  fFMD3Sum.SetTitle(Form("# hits in FMD3: %5d", fFMD3.Total()));
+  fFMD3Sum.SetTitle(Form("# hits in FMD3: %5d   (%4.2f /cm^{2})", 
+                        fFMD3.Total(), fFMD3.Total()/fFMD3Area));
   total += fFMD3.Total();
 
   fTotal.SetTitle(Form("Total:    %5d/51200 (%3d%%)",