]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/AliMUONCheck.cxx
Do not unload gAlice, it is needed until the end of the simulation run
[u/mrichter/AliRoot.git] / MUON / AliMUONCheck.cxx
1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 *                                                                        *
4 * Author: The ALICE Off-line Project.                                    *
5 * Contributors are mentioned in the code where appropriate.              *
6 *                                                                        *
7 * Permission to use, copy, modify and distribute this software and its   *
8 * documentation strictly for non-commercial purposes is hereby granted   *
9 * without fee, provided that the above copyright notice appears in all   *
10 * copies and that both the copyright notice and this permission notice   *
11 * appear in the supporting documentation. The authors make no claims     *
12 * about the suitability of this software for any purpose. It is          *
13 * provided "as is" without express or implied warranty.                  *
14 **************************************************************************/
15
16 // $Id$
17
18 #include "AliMUONCheck.h"
19
20 #include "AliLoader.h"
21 #include "AliLog.h"
22 #include "AliRunLoader.h"
23 #include "AliMUONData.h"
24 #include "AliMUONDataIterator.h"
25 #include "AliMUONDigit.h"
26
27 /// A helper class to dump data from AliRoot-generated root files.
28 /// 
29 /// Only implemented for digits so far, it is meant as a replacement
30 /// of the MUONCheck.C macro, or to be used by this macro to simplify it.
31 ///
32
33 ClassImp(AliMUONCheck)
34
35 //_____________________________________________________________________________
36 AliMUONCheck::AliMUONCheck(const char* galiceFile, 
37                            Int_t firstEvent, Int_t lastEvent) 
38 : TObject(),
39 fFileName(galiceFile),
40 fFirstEvent(firstEvent),
41 fLastEvent(lastEvent),
42 fRunLoader(0x0),
43 fData(0x0)
44 {
45   // ctor
46   
47   fRunLoader = AliRunLoader::Open(fFileName.Data(),"MUONFolder","READ");
48   if (!fRunLoader) 
49   {
50     AliError(Form("Error opening %s file \n",fFileName.Data()));
51   }  
52   else
53   {
54     AliLoader* loader = fRunLoader->GetLoader("MUONLoader");
55     if ( loader )
56     {
57       fData = new AliMUONData(loader,"MUON","MUON");
58     }
59     else
60     {
61       AliError(Form("Could get MUONLoader"));
62     }
63   }
64 }
65
66 //_____________________________________________________________________________
67 AliMUONCheck::AliMUONCheck(const AliMUONCheck& rhs) : TObject(rhs)
68 {
69   // copy ctor
70   AliFatal("Implement me if needed");
71 }
72
73 //_____________________________________________________________________________
74 AliMUONCheck& 
75 AliMUONCheck::operator=(const AliMUONCheck&)
76 {
77   // assignement operator
78   AliFatal("Implement me if needed")
79   return *this;
80 }
81
82 //_____________________________________________________________________________
83 AliMUONCheck::~AliMUONCheck()
84 {
85   // dtor
86   delete fData;
87 }
88
89 //_____________________________________________________________________________
90 void
91 AliMUONCheck::DumpDigits(Option_t* opt) const
92 {
93   // Dump the digits to screen
94   if ( !IsValid() ) return;
95   
96   Int_t nevents = fRunLoader->GetNumberOfEvents();
97   Int_t endOfLoop = fLastEvent+1;
98   
99   if ( fLastEvent == -1 ) endOfLoop = nevents;
100   
101   for ( Int_t ievent = fFirstEvent; ievent < endOfLoop; ++ievent ) 
102   {
103     fRunLoader->GetEvent(ievent);
104
105     AliMUONDataIterator it(fData,"digit",AliMUONDataIterator::kTrackingChambers);
106     AliMUONDigit* digit;
107  
108      while ( ( digit = (AliMUONDigit*)it.Next() ) )
109      {
110        digit->Print(opt);
111      }
112   } 
113 }