]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - FMD/AliFMDFancy.cxx
CPV alignment creation corrected
[u/mrichter/AliRoot.git] / FMD / AliFMDFancy.cxx
index e92fe246b669742ef80f2e7b14a348cd91731bea..152349c6aabc1d37666b5dcfdcaacd182924a08e 100644 (file)
 //
 // Latest changes by Christian Holm Christensen
 //
-#include "AliFMDFancy.h"       // ALIFMDDISPLAY_H
-#include "AliFMDGeometry.h"    // ALIFMDGEOMETRY_H
-#include "AliFMDParameters.h"  // ALIFMDPARAMETERS_H
-#include <AliLog.h>
-#include <TStyle.h>
+
+#include <iomanip>
+#include <iostream>
+
 #include <TApplication.h>
-#include <TButton.h>
+// #include <TButton.h>
 #include <TCanvas.h>
-#include <TView.h>
 #include <TH2F.h>
-#include <TH3F.h>
+// #include <TH3F.h>
+#include <TLatex.h>
+#include <TLine.h>
+#include <TMath.h>
+#include <TRandom.h>
+// #include <TStyle.h>
 #include <TSystem.h>
 #include <TVector2.h>
-#include "AliFMDRing.h"
+// #include <TView.h>
+
 #include "AliFMDDetector.h"
+#include "AliFMDFancy.h"       // ALIFMDDISPLAY_H
+#include "AliFMDGeometry.h"    // ALIFMDGEOMETRY_H
 #include "AliFMDHit.h"
-#include <TRandom.h>
-#include <TLatex.h>
-#include <TLine.h>
-#include <iostream>
-#include <iomanip>
+// #include "AliFMDParameters.h"       // ALIFMDPARAMETERS_H
+#include "AliFMDRing.h"
 
 //____________________________________________________________________
 ClassImp(AliFMDFancy)
@@ -65,6 +68,7 @@ AliFMDFancy::AliFMDFancy(const char* gAliceFile)
     fFMD2(2),
     fFMD3Pad(0),
     fFMD3(3),
+    fSummary(0),
     fEvent(.1, .8, "Event #"),
     fFMD1IHits(.2, .7, "# in FMD1I: "),
     fFMD2IHits(.2, .6, "# in FMD2I: "),
@@ -74,6 +78,7 @@ AliFMDFancy::AliFMDFancy(const char* gAliceFile)
     fLine(.15, .27, .85, .27),
     fTotal(.2, .15, "Total:   ")
 {
+  // CTOR 
   fEvent.SetBit(TLatex::kTextNDC);
   fFMD1IHits.SetBit(TLatex::kTextNDC);
   fFMD2IHits.SetBit(TLatex::kTextNDC);
@@ -85,9 +90,19 @@ AliFMDFancy::AliFMDFancy(const char* gAliceFile)
 }
 
 //____________________________________________________________________
-AliFMDFancy::Detector::Detector(UShort_t id)
-  : fId(id)
+AliFMDFancy::AliFancyDetector::AliFancyDetector(UShort_t id)
+  : fFrame(0),
+    fId(id), 
+    fShapes(0),
+    fNInnerHits(0), 
+    fInnerHits(0),
+    fNOuterHits(0), 
+    fOuterHits(0),
+    fMaxR(0), 
+    fMinZ(0), 
+    fMaxZ(0)
 {
+  // CTOR 
   fInnerHits.SetName(Form("FMD%dI", id));
   fInnerHits.SetMarkerStyle(1); // 20);
   fInnerHits.SetMarkerSize(.2);
@@ -99,22 +114,28 @@ AliFMDFancy::Detector::Detector(UShort_t id)
 }
 
 //____________________________________________________________________
-AliFMDFancy::Detector::~Detector()
+AliFMDFancy::AliFancyDetector::~AliFancyDetector()
 {
+  // DTOR 
   fShapes.Delete();
   if (fFrame) delete fFrame;
 }
 
 //____________________________________________________________________
 AliFMDFancy::~AliFMDFancy()
-{}
+{
+  // DTOR 
+}
 
 //____________________________________________________________________
 void
-AliFMDFancy::Detector::AddHistogram(TGraph2D& g, const char* opt)
+AliFMDFancy::AliFancyDetector::AddHistogram(TGraph2D& g, const char* opt)
 {
+  // CTOR 
   TH2* h = g.GetHistogram(opt);
   if (!h) return;
+  // Code checker doesn't think this using the TH2 interface -
+  // ridiculous. 
   h->SetBins(1, -fMaxR, fMaxR, 1, -fMaxR, fMaxR);
   h->GetZaxis()->SetRangeUser(fMinZ, fMaxZ);
 }
@@ -123,8 +144,9 @@ AliFMDFancy::Detector::AddHistogram(TGraph2D& g, const char* opt)
 
 //____________________________________________________________________
 void
-AliFMDFancy::Detector::Init()
+AliFMDFancy::AliFancyDetector::Init()
 {
+  // Initialise 
   AliFMDGeometry* geom = AliFMDGeometry::Instance();
   AliFMDDetector* det  = geom->GetDetector(fId);
   if (!det) return;
@@ -205,8 +227,9 @@ AliFMDFancy::Init()
 
 //____________________________________________________________________
 void
-AliFMDFancy::Detector::Begin(Int_t /* event */)
+AliFMDFancy::AliFancyDetector::Begin(Int_t /* event */)
 {
+  // Called at the begining of an event. 
   TIter next(&fShapes);
   TGraph2D* g = 0;
   fFrame->Draw("surf fb");
@@ -216,8 +239,9 @@ AliFMDFancy::Detector::Begin(Int_t /* event */)
 
 //____________________________________________________________________
 void
-AliFMDFancy::Detector::Clear(Int_t /* event */)
+AliFMDFancy::AliFancyDetector::Clear(Int_t /* event */)
 {
+  // Clear 
   fNInnerHits = 0;
   fNOuterHits = 0;
 }
@@ -227,6 +251,7 @@ AliFMDFancy::Detector::Clear(Int_t /* event */)
 Bool_t 
 AliFMDFancy::Begin(Int_t event) 
 {
+  // Called at the begining of an event 
   if (!fCanvas) {
     const char* which[] = { "Continue", "Redisplay", 0 };
     MakeCanvas(which);
@@ -280,8 +305,9 @@ AliFMDFancy::Begin(Int_t event)
 
 //____________________________________________________________________
 void
-AliFMDFancy::Detector::End()
+AliFMDFancy::AliFancyDetector::End()
 {
+  // Called at the end of an event 
   Char_t  rs[] = { 'I', 'O', '\0' };
   Char_t* rp   = rs;
   Char_t  r;
@@ -291,6 +317,8 @@ AliFMDFancy::Detector::End()
     Int_t     m = (r == 'I' ? 512 * 10 * 2 : 256 * 20 * 2);
     if (n == 0) continue;
     for (Int_t i = n; i < g.GetN(); i++)  g.RemovePoint(i);
+    // The code checker thinks this is not using declarations from
+    // iostram and iomanip - that's just silly. 
     std::cout << g.GetName() << " has " << std::setw(4) << n << "/" 
              << std::setw(5) << m << " points" << std::endl;
     g.Draw("same fb p");
@@ -302,6 +330,7 @@ AliFMDFancy::Detector::End()
 Bool_t 
 AliFMDFancy::End() 
 {
+  // Called at the end of an event 
   AliFMDGeometry* geom = AliFMDGeometry::Instance();
   AliFMDDetector* det;
   Int_t total = 0;
@@ -338,9 +367,14 @@ AliFMDFancy::End()
   fCanvas->cd();
   fWait = kTRUE;
   while (fWait) {
-    gApplication->StartIdleing();
-    gSystem->InnerLoop();
-    gApplication->StopIdleing();
+    // Hmm - code checker doesn't believe this is using the
+    // TApplication or TSystem declaration - morron.  Thank God for
+    // optimising compilers. 
+    TApplication* a = gApplication;
+    TSystem*      s = gSystem;
+    a->StartIdleing();
+    s->InnerLoop();
+    a->StopIdleing();
   }
   return AliFMDInput::End();
 }
@@ -349,22 +383,28 @@ AliFMDFancy::End()
 Bool_t 
 AliFMDFancy::ProcessHit(AliFMDHit* hit, TParticle*) 
 {
+  // Process a hit. 
   AddMarker(hit->Detector(), hit->Ring(), hit->Sector(), hit->Strip(), 
-           hit, hit->Edep(), 0);
+           hit, hit->Edep(), 0, 20);
   return kTRUE;
 }
 //____________________________________________________________________
 void
-AliFMDFancy::Detector::AddMarker(Char_t rng, UShort_t sec, UShort_t str,
-                                Float_t, Float_t)
+AliFMDFancy::AliFancyDetector::AddMarker(Char_t rng, UShort_t sec,
+                                        UShort_t str, Float_t, Float_t)
 {
+  // Add a marker to the display 
   AliFMDGeometry*   geom = AliFMDGeometry::Instance();
   Double_t x, y, z;
   geom->Detector2XYZ(fId, rng, sec, str, x, y, z);
+  // Trick the code-checker to think that we're using the TRandom
+  // interface.  The silly code checker also thinks that TMath is a
+  // class and not a namespace - sigh!
+  TRandom* rand = gRandom;
   if (true) {
     AliFMDRing* r  = geom->GetRing(rng);
     Double_t    t  = .9 * r->GetTheta() / 2;
-    Double_t    a  = gRandom->Uniform(-t,t) * TMath::Pi() / 180;
+    Double_t    a  = rand->Uniform(-t,t) * TMath::Pi() / 180;
     Double_t    x1 = x * TMath::Cos(a) - y * TMath::Sin(a);
     Double_t    y1 = x * TMath::Sin(a) + y * TMath::Cos(a);
     x = x1;
@@ -384,7 +424,7 @@ AliFMDFancy::Detector::AddMarker(Char_t rng, UShort_t sec, UShort_t str,
 //____________________________________________________________________
 void
 AliFMDFancy::AddMarker(UShort_t det, Char_t rng, UShort_t sec, UShort_t str,
-                      TObject*, Float_t, Float_t)
+                      TObject*, Float_t, Float_t, Float_t)
 {
   // Add a marker to the display
   //