]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/AliMUONRecoDisplay.cxx
Corrected index (aplhacxx6)
[u/mrichter/AliRoot.git] / MUON / AliMUONRecoDisplay.cxx
index b924c087fc924e30a100b533dac6b75ca6b5f6ab..f08fd9159ebff1a27d1f5dc51e5b55149a739a37 100644 (file)
@@ -13,9 +13,7 @@
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
 
-/*
-$Log$
-*/
+/* $Id$ */
 
 //Authors: Mihaela Gheata, Andrei Gheata 09/10/00
 //////////////////////////////////////////////////////////////////////
@@ -46,22 +44,41 @@ $Log$
 //                                                                  //
 //////////////////////////////////////////////////////////////////////
 
-#include <iostream.h>
-#include <AliRun.h>
-#include <TClonesArray.h>
-#include "AliMUONRecoEvent.h"
-#include "AliMUONRecoDisplay.h"
 #include <TROOT.h>
-#include <AliPoints.h>
+#include <TApplication.h>
+#include <TFile.h>
+#include <TPolyLine3D.h>
+#include <TParticle.h>
+#include <TTree.h>
+#include <TH1.h>
+#include <TH2.h>
+#include <TCanvas.h>
+#include <TProfile.h>
+#include <TFolder.h>
+#include <TClonesArray.h>
 #include <TSlider.h>
-#include <TView.h>
 #include <TGeometry.h>
+#include <TView.h>
+#include <Riostream.h>
+
+#include "AliRun.h"
+#include "AliDetector.h"
+#include "AliConfig.h"
+#include "AliHeader.h"
+#include "AliPoints.h"
+#include "AliMC.h"
+
+#include "AliMUONRecoDisplay.h"
+#include "AliMUONRecoEvent.h"
+#include "AliMUONRecoTrack.h"
+#include "AliMUONHit.h"
+#include "AliLog.h"
 
 ClassImp(AliMUONRecoDisplay)
 
 //-------------------------------------------------------------------
 AliMUONRecoDisplay::AliMUONRecoDisplay(Int_t nevent)
-                  :AliDisplay(750)
+  AliDisplay(750)
 {
 //************ Constructor of the reco. event display**********
    // get reconstructed event from file
@@ -83,8 +100,8 @@ AliMUONRecoDisplay::AliMUONRecoDisplay(Int_t nevent)
    
    fEvGen  = new AliMUONRecoEvent();
 
-   TFile *galice_file = (TFile*)gROOT->GetListOfFiles()->FindObject("galice.root");
-   galice_file->cd();
+   TFile *galiceFile = (TFile*)gROOT->GetListOfFiles()->FindObject("galice.root");
+   galiceFile->cd();
    if (nevent > gAlice->TreeE()->GetEntries() - 1) {
       cout << "Event number out of range !\n";
       gApplication->Terminate(0);
@@ -103,6 +120,15 @@ AliMUONRecoDisplay::AliMUONRecoDisplay(Int_t nevent)
    MapEvent(nevent);
 }
 
+//-------------------------------------------------------------------
+AliMUONRecoDisplay::AliMUONRecoDisplay(const AliMUONRecoDisplay& rhs)
+  : AliDisplay(rhs)
+{
+// Protected copy constructor
+
+  AliFatal("Not implemented.");
+}
+
 //-------------------------------------------------------------------
 AliMUONRecoDisplay::~AliMUONRecoDisplay()
 {
@@ -117,9 +143,24 @@ AliMUONRecoDisplay::~AliMUONRecoDisplay()
    }
    delete fEvGen;
 }
+
+//-------------------------------------------------------------------
+AliMUONRecoDisplay&  
+AliMUONRecoDisplay::operator=(const AliMUONRecoDisplay& rhs)
+{
+// Protected assignement operator
+
+  if (this == &rhs) return *this;
+
+  AliFatal("Not implemented.");
+    
+  return *this;  
+}    
+          
 //-------------------------------------------------------------------
 Bool_t AliMUONRecoDisplay::Event(Int_t nevent)
 {
+// Go to event nevent
    fEvent = nevent;
    for (Int_t entry=0; entry<fTree->GetEntries(); entry++) {
       fTree->GetEntry(entry);
@@ -160,15 +201,14 @@ void AliMUONRecoDisplay::MapEvent(Int_t nevent)
    if (fEvGen) fEvGen->Clear();
    fEvGen->SetNoEvent(nevent);
    // get list of particles
-   TClonesArray *Particles = gAlice->Particles();
    // connect MUON module
-   AliDetector *MUON = gAlice->GetDetector("MUON");
-   if (!MUON) {
+   AliDetector *pMUON = gAlice->GetDetector("MUON");
+   if (!pMUON) {
       cout << "MUON module not present.\n";
       gApplication->Terminate(0);
    }
    // get the number of generated tracks
-   Int_t ntracks = (Int_t)gAlice->TreeH()->GetEntries();
+   Int_t ntracks = (Int_t)pMUON->TreeH()->GetEntries();
    // Fill the fEvGen object
    AliMUONRecoTrack *gtrack = 0;
    AliMUONHit *hit = 0;
@@ -176,19 +216,19 @@ void AliMUONRecoDisplay::MapEvent(Int_t nevent)
    Int_t ch;
    // loop all tracks
    for (Int_t track=0; track<ntracks; track++) {
-      hit = (AliMUONHit *) MUON->FirstHit(track);
+      hit = (AliMUONHit *) pMUON->FirstHit(track);
       if (!hit) continue;
-      particle = (TParticle *) Particles->UncheckedAt(hit->Track());
+      particle = gAlice->GetMCApp()->Particle(hit->Track());
       if (IsReconstructible(track) && TMath::Abs(particle->GetPdgCode())==13) {
          gtrack = fEvGen->AddEmptyTrack();
         gtrack->SetSign(TMath::Sign((Int_t)1, -particle->GetPdgCode()));
         // reset hits
         for (ch=0; ch<10; ch++) gtrack->SetHitPosition(ch,0,0,0);
         // loop all hits
-        for (AliMUONHit *muonHit=(AliMUONHit*)MUON->FirstHit(track);
+        for (AliMUONHit *muonHit=(AliMUONHit*)pMUON->FirstHit(track);
              muonHit;
-             muonHit=(AliMUONHit*)MUON->NextHit()) {
-           ch = muonHit->fChamber - 1;
+             muonHit=(AliMUONHit*)pMUON->NextHit()) {
+           ch = muonHit->Chamber() - 1;
            if (ch<0 || ch>9) continue;
            gtrack->SetHitPosition(ch, muonHit->X(),  muonHit->Y(),  muonHit->Z());
            gtrack->SetMomReconstr(particle->Px(), particle->Py(), particle->Pz());
@@ -216,10 +256,10 @@ void AliMUONRecoDisplay::XYPlot()
    kMaxRadius[6] =  kMaxRadius[7] = 260.0;
    kMaxRadius[8] =  kMaxRadius[9] = 260.0;
 
-   TH2F *xygen_found[10]; 
-   TH2F *xygen_lost[10]; 
-   TH2F *xyreco_good[10];
-   TH2F *xyreco_fake[10];
+   TH2F *xygenFound[10]; 
+   TH2F *xygenLost[10]; 
+   TH2F *xyrecoGood[10];
+   TH2F *xyrecoFake[10];
    Double_t x,y,r;
    Int_t matches[500];
    Int_t index, ch;
@@ -237,10 +277,10 @@ void AliMUONRecoDisplay::XYPlot()
    
    // Define histograms for x-y plots
    for (ch=0; ch<10; ch++) {
-      xygen_found[ch] = new TH2F("xygen_found","",50,-kMaxRadius[ch],kMaxRadius[ch],50,-kMaxRadius[ch],kMaxRadius[ch]);
-      xygen_lost[ch] = new TH2F("xygen_lost","",50,-kMaxRadius[ch],kMaxRadius[ch],50,-kMaxRadius[ch],kMaxRadius[ch]);
-      xyreco_good[ch] = new TH2F("xyreco_good","",50,-kMaxRadius[ch],kMaxRadius[ch],50,-kMaxRadius[ch],kMaxRadius[ch]);
-      xyreco_fake[ch] = new TH2F("xyreco_fake","",50,-kMaxRadius[ch],kMaxRadius[ch],50,-kMaxRadius[ch],kMaxRadius[ch]);
+      xygenFound[ch] = new TH2F("xygen_found","",50,-kMaxRadius[ch],kMaxRadius[ch],50,-kMaxRadius[ch],kMaxRadius[ch]);
+      xygenLost[ch] = new TH2F("xygen_lost","",50,-kMaxRadius[ch],kMaxRadius[ch],50,-kMaxRadius[ch],kMaxRadius[ch]);
+      xyrecoGood[ch] = new TH2F("xyreco_good","",50,-kMaxRadius[ch],kMaxRadius[ch],50,-kMaxRadius[ch],kMaxRadius[ch]);
+      xyrecoFake[ch] = new TH2F("xyreco_fake","",50,-kMaxRadius[ch],kMaxRadius[ch],50,-kMaxRadius[ch],kMaxRadius[ch]);
    }
    // find list of matching tracks
    fPrinted = kTRUE; // no need to print
@@ -263,8 +303,8 @@ void AliMUONRecoDisplay::XYPlot()
          r = TMath::Sqrt(x*x +y*y);
          if (r >= 10) {
             if (wasreconst) {
-               xygen_found[ch]->Fill(x,y);
-            } else {xygen_lost[ch]->Fill(x,y);}
+               xygenFound[ch]->Fill(x,y);
+            } else {xygenLost[ch]->Fill(x,y);}
          }
       }
    }
@@ -276,34 +316,34 @@ void AliMUONRecoDisplay::XYPlot()
          r = TMath::Sqrt(x*x +y*y);
          if (r >= 10) {
             if (matches[index] >= 0) {
-               xyreco_good[ch]->Fill(x,y);
-            } else {xyreco_fake[ch]->Fill(x,y);}
+               xyrecoGood[ch]->Fill(x,y);
+            } else {xyrecoFake[ch]->Fill(x,y);}
          }
       }
    }
    // finally plot them
    for (ch=0; ch<10; ch++) {
       canvas->cd(ch+1);   
-      xygen_found[ch]->SetMarkerColor(kBlue);
-      xygen_found[ch]->SetMarkerStyle(4);
-      xygen_found[ch]->SetMarkerSize(0.5);
-      xygen_found[ch]->SetStats(kFALSE);
-      xygen_found[ch]->Draw();
-      xygen_lost[ch]->SetMarkerColor(kCyan);
-      xygen_lost[ch]->SetMarkerStyle(4);
-      xygen_lost[ch]->SetMarkerSize(0.5);
-      xygen_lost[ch]->SetStats(kFALSE);
-      xygen_lost[ch]->Draw("SAME");
-      xyreco_good[ch]->SetMarkerColor(kGreen);
-      xyreco_good[ch]->SetMarkerStyle(20);
-      xyreco_good[ch]->SetMarkerSize(0.4);
-      xyreco_good[ch]->SetStats(kFALSE);
-      xyreco_good[ch]->Draw("SAME");
-      xyreco_fake[ch]->SetMarkerColor(kRed);
-      xyreco_fake[ch]->SetMarkerStyle(20);
-      xyreco_fake[ch]->SetMarkerSize(0.5);
-      xyreco_fake[ch]->SetStats(kFALSE);
-      xyreco_fake[ch]->Draw("SAME");
+      xygenFound[ch]->SetMarkerColor(kBlue);
+      xygenFound[ch]->SetMarkerStyle(4);
+      xygenFound[ch]->SetMarkerSize(0.5);
+      xygenFound[ch]->SetStats(kFALSE);
+      xygenFound[ch]->Draw();
+      xygenLost[ch]->SetMarkerColor(kCyan);
+      xygenLost[ch]->SetMarkerStyle(4);
+      xygenLost[ch]->SetMarkerSize(0.5);
+      xygenLost[ch]->SetStats(kFALSE);
+      xygenLost[ch]->Draw("SAME");
+      xyrecoGood[ch]->SetMarkerColor(kGreen);
+      xyrecoGood[ch]->SetMarkerStyle(20);
+      xyrecoGood[ch]->SetMarkerSize(0.4);
+      xyrecoGood[ch]->SetStats(kFALSE);
+      xyrecoGood[ch]->Draw("SAME");
+      xyrecoFake[ch]->SetMarkerColor(kRed);
+      xyrecoFake[ch]->SetMarkerStyle(20);
+      xyrecoFake[ch]->SetMarkerSize(0.5);
+      xyrecoFake[ch]->SetStats(kFALSE);
+      xyrecoFake[ch]->Draw("SAME");
    }
    canvas->SetTitle("y vs. x for simulated and reconstructed tracks");
    pad->cd();
@@ -344,8 +384,8 @@ void AliMUONRecoDisplay::RecoEfficiency(Int_t first, Int_t last)
    // loop events
    for (Int_t event=first; event<=last; event++) {
       // get the reco. & gen. events
-      TFile *galice_file = (TFile*)gROOT->GetListOfFiles()->FindObject("galice.root");
-      galice_file->cd();
+      TFile *galiceFile = (TFile*)gROOT->GetListOfFiles()->FindObject("galice.root");
+      galiceFile->cd();
       gAlice->GetEvent(event);
       MapEvent(event);
       if (fEmpty) {
@@ -396,8 +436,8 @@ void AliMUONRecoDisplay::RecoEfficiency(Int_t first, Int_t last)
 void AliMUONRecoDisplay::ShowNextEvent(Int_t delta)
 {
 // overwritten from AliDisplay in order to get also mapping of next event
-   TFile *galice_file = (TFile*)gROOT->GetListOfFiles()->FindObject("galice.root");
-   galice_file->cd();
+   TFile *galiceFile = (TFile*)gROOT->GetListOfFiles()->FindObject("galice.root");
+   galiceFile->cd();
    if (delta) {
       gAlice->Clear();
       Int_t currentEvent = gAlice->GetHeader()->GetEvent();
@@ -405,7 +445,29 @@ void AliMUONRecoDisplay::ShowNextEvent(Int_t delta)
       if (newEvent<0 || newEvent>(gAlice->TreeE()->GetEntries() - 1)) return;
       Int_t nparticles = gAlice->GetEvent(newEvent);
       cout << "Event : " << newEvent << " with " << nparticles << " particles\n";
-      if (!gAlice->TreeH()) return;
+
+/******************************************************************/
+      AliConfig* config = AliConfig::Instance();
+      TFolder* topfold = (TFolder*)config->GetTopFolder();
+      if (topfold == 0x0)
+       {
+         AliError("Can not get Alice top folder");
+         return; 
+       }
+      TString fmdfoldname(config->GetDataFolderName()+"/"+"MUON");
+      TFolder* fmdfold = (TFolder*)topfold->FindObject(fmdfoldname);
+      if (fmdfold == 0x0)
+       {
+         AliError("Can not get MUON folder");
+         return; 
+       }
+      TTree* treeH = dynamic_cast<TTree*>(fmdfold->FindObject("TreeH"));
+      if (treeH == 0x0)
+       {
+         AliError("Can not get TreeH");
+         return;
+       }
+/******************************************************************/     
       MapEvent(newEvent);
       fHighlited = -1;
    }
@@ -415,20 +477,20 @@ void AliMUONRecoDisplay::ShowNextEvent(Int_t delta)
    if (gROOT->GetListOfCanvases()->FindObject("xy")) XYPlot();
 }
 //-------------------------------------------------------------------
-Bool_t AliMUONRecoDisplay::IsReconstructible(Int_t track)
+Bool_t AliMUONRecoDisplay::IsReconstructible(Int_t track) const
 {
 // true if at least three hits in first 2 stations, 3 in last 2 stations
 // and one in station 3
    if (fEmpty) return kFALSE;
-   AliDetector *MUON = gAlice->GetDetector("MUON");
+   AliDetector *pMUON = gAlice->GetDetector("MUON");
    Bool_t chHit[10];
    Int_t ch;
    for (ch=0; ch<10; ch++) chHit[ch] = kFALSE;
    //loop hits
-   for (AliMUONHit *muonHit=(AliMUONHit*)MUON->FirstHit(track);
+   for (AliMUONHit *muonHit=(AliMUONHit*)pMUON->FirstHit(track);
         muonHit;
-       muonHit=(AliMUONHit*)MUON->NextHit()) {
-      ch = muonHit->fChamber - 1;
+       muonHit=(AliMUONHit*)pMUON->NextHit()) {
+      ch = muonHit->Chamber() - 1;
       if (ch<0 || ch>9) continue;
       chHit[ch] = kTRUE;
    }
@@ -764,5 +826,3 @@ void AliMUONRecoDisplay::PolyLineInfo(TClonesArray *line3Dlist)
       }
    }
 }
-
-