]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/AliMUONPreprocessor.cxx
Removing obsolete Mapping request
[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   fIsValid(kFALSE),
51   fIsApplicable(kTRUE),
52   fSubprocessors(new TObjArray()),
53   fProcessDCS(kFALSE)
54 {
55   /// ctor
56 }
57
58 //_____________________________________________________________________________
59 AliMUONPreprocessor::~AliMUONPreprocessor()
60 {
61   /// dtor
62   delete fSubprocessors;
63 }
64
65 //_____________________________________________________________________________
66 void
67 AliMUONPreprocessor::ClearSubprocessors()
68 {
69   /// Empty our subprocessor list
70   fSubprocessors->Clear();
71   fProcessDCS = kFALSE;
72   fIsValid = kFALSE;
73   fIsApplicable = kTRUE;
74 }
75
76 //_____________________________________________________________________________
77 void
78 AliMUONPreprocessor::Add(AliMUONVSubprocessor* sub, Bool_t processDCS)
79 {
80   /// Add a subprocessor to our list of workers
81   fSubprocessors->Add(sub);
82   if ( processDCS == kTRUE ) fProcessDCS = processDCS;
83 }
84
85 //_____________________________________________________________________________
86 void
87 AliMUONPreprocessor::Initialize(Int_t run, UInt_t startTime, UInt_t endTime)
88 {
89   /// Load mapping and initialize subtasks  
90
91   // Delete previous mapping
92   delete AliMpSegmentation::Instance(false);
93   delete AliMpDDLStore::Instance(false);
94   
95   if ( ! IsApplicable() ) {
96     Log(Form("WARNING-RunType=%s is not one I should handle.",GetRunType()));
97     return;
98   }   
99   
100   // Load mapping from CDB for this run
101   AliCDBEntry* cdbEntry = GetFromOCDB("Calib", "DDLStore");
102   if (!cdbEntry)
103   {
104     Log("Could not get DDLStore from OCDB !");
105     fIsValid = kFALSE;
106   }
107   
108   if (IsValid())
109   {
110     // loop over subtasks and initialize them
111     for ( Int_t i = 0; i <= fSubprocessors->GetLast(); ++i )
112     {
113       Subprocessor(i)->Initialize(run,startTime,endTime);
114     }
115   }
116   Log(Form("Initialize was %s",( IsValid() ? "fine" : "NOT OK")));
117 }
118
119 //_____________________________________________________________________________
120 UInt_t
121 AliMUONPreprocessor::Process(TMap* dcsAliasMap)
122 {
123   /// loop over subtasks to make them work
124   
125   if (!IsValid())
126   {
127     Log("Will not run as not properly initialized");
128     return 99;
129   }
130   
131   if (!IsApplicable())
132   {
133     Log("Nothing to do for me");
134     return 0;
135   }
136   
137   UInt_t rv(0);
138   
139   for ( Int_t i = 0; i <= fSubprocessors->GetLast(); ++i )
140   {
141     rv += Subprocessor(i)->Process(dcsAliasMap);
142   }
143   
144   return rv;
145 }
146
147 //_____________________________________________________________________________
148 void
149 AliMUONPreprocessor::Print(Option_t* opt) const
150 {
151   /// output to screen
152   cout << "<AliMUONPreprocessor> subprocessors :" << endl;
153   for ( Int_t i=0; i <= fSubprocessors->GetLast(); ++i )
154   {
155     Subprocessor(i)->Print(opt);
156   }
157 }
158
159 //_____________________________________________________________________________
160 AliMUONVSubprocessor*
161 AliMUONPreprocessor::Subprocessor(Int_t i) const
162 {
163   /// return i-th subprocessor
164   if ( i >= 0 && i <= fSubprocessors->GetLast() )
165   {
166     return static_cast<AliMUONVSubprocessor*>(fSubprocessors->At(i));
167   }
168   return 0x0;
169 }