]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/AliMUONPreprocessor.cxx
Getting rid of compiler warning
[u/mrichter/AliRoot.git] / MUON / AliMUONPreprocessor.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 "AliMUONPreprocessor.h"
19
20 #include "AliMUONPedestalSubprocessor.h"
21 #include "AliMUONHVSubprocessor.h"
22 #include "AliMUONGMSSubprocessor.h"
23
24 #include "AliMpSegmentation.h"
25 #include "AliMpDDLStore.h"
26
27 #include "AliLog.h"
28 #include "AliShuttleInterface.h"
29 #include "Riostream.h"
30 #include "TObjArray.h"
31
32 //-----------------------------------------------------------------------------
33 /// \class AliMUONPreprocessor
34 ///
35 /// Shuttle preprocessor for MUON subsystems (TRK and TRG)
36 /// 
37 /// It's simply a manager class that deals with a list of sub-tasks 
38 /// (of type AliMUONVSubprocessor).
39 ///
40 /// \author Laurent Aphecetche
41 //-----------------------------------------------------------------------------
42
43 /// \cond CLASSIMP
44 ClassImp(AliMUONPreprocessor)
45 /// \endcond
46
47 //_____________________________________________________________________________
48 AliMUONPreprocessor::AliMUONPreprocessor(const char* detName, AliShuttleInterface* shuttle)
49 : AliPreprocessor(detName, shuttle),
50   fSubprocessors(new TObjArray()),
51   fProcessDCS(kFALSE),
52   fIsValid(kFALSE)
53 {
54   /// ctor
55 }
56
57 //_____________________________________________________________________________
58 AliMUONPreprocessor::~AliMUONPreprocessor()
59 {
60   /// dtor
61   delete fSubprocessors;
62 }
63
64 //_____________________________________________________________________________
65 void
66 AliMUONPreprocessor::ClearSubprocessors()
67 {
68   /// Empty our subprocessor list
69   fSubprocessors->Clear();
70   fProcessDCS = kFALSE;
71   fIsValid = kFALSE;
72 }
73
74 //_____________________________________________________________________________
75 void
76 AliMUONPreprocessor::Add(AliMUONVSubprocessor* sub, Bool_t processDCS)
77 {
78   /// Add a subprocessor to our list of workers
79   fSubprocessors->Add(sub);
80   if ( processDCS == kTRUE ) fProcessDCS = processDCS;
81 }
82
83 //_____________________________________________________________________________
84 void
85 AliMUONPreprocessor::Initialize(Int_t run, UInt_t startTime, UInt_t endTime)
86 {
87   /// Load mapping and initialize subtasks  
88
89   // Delete previous mapping
90   delete AliMpSegmentation::Instance(false);
91   delete AliMpDDLStore::Instance(false);
92   
93   // Load mapping from CDB for this run
94   
95   AliCDBEntry* cdbEntry = GetFromOCDB("Calib", "Mapping");
96   if (!cdbEntry)
97   {
98     Log("Could not get Mapping from OCDB !");
99     fIsValid = kFALSE;
100   }
101   
102   cdbEntry = GetFromOCDB("Calib", "DDLStore");
103   if (!cdbEntry)
104   {
105     Log("Could not get DDLStore from OCDB");
106     fIsValid = kFALSE;
107   }
108
109   if (IsValid())
110   {
111     // loop over subtasks and initialize them
112     for ( Int_t i = 0; i <= fSubprocessors->GetLast(); ++i )
113     {
114       Subprocessor(i)->Initialize(run,startTime,endTime);
115     }
116   }
117
118   Log(Form("Initialize was %s",( IsValid() ? "fine" : "NOT OK")));
119 }
120
121 //_____________________________________________________________________________
122 UInt_t
123 AliMUONPreprocessor::Process(TMap* dcsAliasMap)
124 {
125   /// loop over subtasks to make them work
126   
127   if (!IsValid())
128   {
129     Log("Will not run as not properly initialized");
130     return 99;
131   }
132   
133   UInt_t rv(0);
134   
135   for ( Int_t i = 0; i <= fSubprocessors->GetLast(); ++i )
136   {
137     rv += Subprocessor(i)->Process(dcsAliasMap);
138   }
139   
140   return rv;
141 }
142
143 //_____________________________________________________________________________
144 void
145 AliMUONPreprocessor::Print(Option_t* opt) const
146 {
147   /// output to screen
148   cout << "<AliMUONPreprocessor> subprocessors :" << endl;
149   for ( Int_t i=0; i <= fSubprocessors->GetLast(); ++i )
150   {
151     Subprocessor(i)->Print(opt);
152   }
153 }
154
155 //_____________________________________________________________________________
156 AliMUONVSubprocessor*
157 AliMUONPreprocessor::Subprocessor(Int_t i) const
158 {
159   /// return i-th subprocessor
160   if ( i >= 0 && i <= fSubprocessors->GetLast() )
161   {
162     return static_cast<AliMUONVSubprocessor*>(fSubprocessors->At(i));
163   }
164   return 0x0;
165 }