]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - STEER/AliMCQA.cxx
Make use of new method AliRawReader::GetNumberOfEvents() - goinf to the last event...
[u/mrichter/AliRoot.git] / STEER / AliMCQA.cxx
index 0f74c0a38429741439ab0586ce1b2dba8a89bae7..e8c15e3bb870814360ffd565d55fcec9619a130e 100644 (file)
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
 
-/*
-$Log$
-Revision 1.7  2002/10/14 14:57:32  hristov
-Merging the VirtualMC branch to the main development branch (HEAD)
-
-Revision 1.6.6.1  2002/10/12 21:41:00  hristov
-Remove the object from the list of browsables
-
-Revision 1.6  2001/12/05 08:31:25  hristov
-Destructor corrected, thanks to R.Brun
-
-Revision 1.5  2001/01/26 19:58:48  hristov
-Major upgrade of AliRoot code
-
-Revision 1.4  2001/01/17 10:50:50  hristov
-Corrections to destructors
-
-Revision 1.3  2000/12/18 14:16:31  alibrary
-HP compatibility fix
-
-Revision 1.2  2000/12/18 11:33:48  alibrary
-New call frequence histograms per module and volume
-
-Revision 1.1  2000/11/30 07:12:48  alibrary
-Introducing new Rndm and QA classes
-
-*/
+/* $Id$ */
 
 ///////////////////////////////////////////////////////////////////////////////
 //                                                                           //
+// Quality Assurance class                                                   //
+// Provides standard histograms for every element of the detector            //
 //                                                                           //
 ///////////////////////////////////////////////////////////////////////////////
 
 
 #include <strings.h>
 
-#include "TObjArray.h"
-#include "TH1.h"
-#include "TList.h"
-#include "TROOT.h"
-#include "TBrowser.h"
-#include "TMath.h"
-#include "TLorentzVector.h"
-#include "TDatabasePDG.h"
-#include "TMath.h"
-#include "TPad.h"
-#include "TExec.h"
-#include "TPaveLabel.h"
-#include "TCanvas.h"
-
+#include <TBrowser.h>
+#include <TCanvas.h>
+#include <TDatabasePDG.h>
+#include <TExec.h>
+#include <TH1.h>
+#include <TList.h>
+#include <TLorentzVector.h>
+#include <TMath.h>
+#include <TObjArray.h>
+#include <TPaveLabel.h>
+#include <TROOT.h>
+#include <TVirtualMC.h>
+
+#include "AliLog.h"
+#include "AliMC.h"
 #include "AliMCQA.h"
-#include "AliRun.h"
 #include "AliModule.h"
-#include "AliMC.h"
+#include "AliRun.h"
 
 ClassImp(AliMCQA)
 
@@ -173,16 +149,22 @@ AliMCQA::AliMCQA(Int_t ndets):
   //
   // Build list of volume names
   //
+  AliMC * mc = gAlice->GetMCApp();
   for(i=0;i<fNvolumes;++i) {
-    AliModule *mod = dynamic_cast<AliModule*>
-      ((*gAlice->Modules())[gAlice->DetFromMate(gMC->VolId2Mate(i+1))]);
-    (*fVolNames)[i]=new TNamed(gMC->VolName(i+1),mod->GetName());
+    Int_t mat = gMC->VolId2Mate(i+1);
+    if (mat > 0) {
+       AliModule *mod = dynamic_cast<AliModule*>
+           ((*gAlice->Modules())[mc->DetFromMate(gMC->VolId2Mate(i+1))]);
+       (*fVolNames)[i] = new TNamed(gMC->VolName(i+1),mod->GetName());
+    } else {
+       (*fVolNames)[i] = new TNamed(gMC->VolName(i+1), "Assembly");
+    }
   }
 
   fQAHist->Add(new TH1F("hMCMcalls","Monte Carlo calls per module",
                        fNdets, -0.5, fNdets-0.5));
   h = dynamic_cast<TH1F*>(dir->FindObject("hMCMcalls"));
-   h->GetListOfFunctions()->Add(new TExec("ex","gAlice->GetMCQA()->AddModuleName()"));
+  h->GetListOfFunctions()->Add(new TExec("ex","gAlice->GetMCQA()->AddModuleName()"));
 
   dir->Remove(dir->FindObject("hMCMcalls"));
   //
@@ -194,33 +176,41 @@ AliMCQA::AliMCQA(Int_t ndets):
 }
 
 //_______________________________________________________________________
-void AliMCQA::Copy(AliMCQA &) const
+void AliMCQA::Copy(TObject &) const
 {
-  Fatal("Copy ctor","Not implemented!\n");
+  AliFatal("Not implemented!");
 }
 
 //_______________________________________________________________________
-AliMCQA::~AliMCQA() {
+AliMCQA::~AliMCQA() 
+ {
+  //
+  // Destructor
+  //
   gROOT->GetListOfBrowsables()->Remove(this);
+  //if program crashes here - it probobly means that 
+  //one of added browsables was deleted and not removed previously from that list
+  //skowron
+  
   if (fQAList) {
     fQAList->Delete();
     delete fQAList;
-    fQAList=0;
+    fQAList = 0;
   }
   if (fQAHist) {
     fQAHist->Delete();
     delete fQAHist;
-    fQAHist=0;
+    fQAHist = 0;
   }
   if (fVolNames) {
     fVolNames->Delete();
     delete fVolNames;
-    fVolNames=0;
+    fVolNames = 0;
   }
   if (fModNames) {
     fModNames->Delete();
     delete fModNames;
-    fModNames=0;
+    fModNames = 0;
   }
   delete [] fDetDone;
   delete fMPaveLabel;
@@ -291,7 +281,7 @@ void AliMCQA::StepManager(Int_t id)
     static  Double_t mpim=0;
     static  Double_t mep=0;
     static  Double_t mem=0;
-    Double_t mass=0;
+    Double_t mass = 0;
     Int_t num = gMC->TrackPid();
 
     switch (num) {
@@ -316,7 +306,8 @@ void AliMCQA::StepManager(Int_t id)
       mass=mem;
       break;
     default:
-      mass =gAlice->PDGDB()->GetParticle(num)->Mass();
+       if (gAlice->PDGDB()->GetParticle(num))
+           mass = gAlice->PDGDB()->GetParticle(num)->Mass();
       break; 
     }