]> git.uio.no Git - u/mrichter/AliRoot.git/blame_incremental - MUON/AliMUONPreprocessor.cxx
Updated misalignment macros and AliITSMisalignMaker class (R. Grosso)
[u/mrichter/AliRoot.git] / MUON / AliMUONPreprocessor.cxx
... / ...
CommitLineData
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
44ClassImp(AliMUONPreprocessor)
45/// \endcond
46
47//_____________________________________________________________________________
48AliMUONPreprocessor::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//_____________________________________________________________________________
59AliMUONPreprocessor::~AliMUONPreprocessor()
60{
61 /// dtor
62 delete fSubprocessors;
63}
64
65//_____________________________________________________________________________
66void
67AliMUONPreprocessor::ClearSubprocessors()
68{
69 /// Empty our subprocessor list
70 fSubprocessors->Clear();
71 fProcessDCS = kFALSE;
72 fIsValid = kFALSE;
73 fIsApplicable = kTRUE;
74}
75
76//_____________________________________________________________________________
77void
78AliMUONPreprocessor::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//_____________________________________________________________________________
86void
87AliMUONPreprocessor::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", "Mapping");
102 if (!cdbEntry)
103 {
104 Log("Could not get Mapping from OCDB !");
105 fIsValid = kFALSE;
106 }
107
108 cdbEntry = GetFromOCDB("Calib", "DDLStore");
109 if (!cdbEntry)
110 {
111 Log("Could not get DDLStore from OCDB");
112 fIsValid = kFALSE;
113 }
114
115 if (IsValid())
116 {
117 // loop over subtasks and initialize them
118 for ( Int_t i = 0; i <= fSubprocessors->GetLast(); ++i )
119 {
120 Subprocessor(i)->Initialize(run,startTime,endTime);
121 }
122 }
123 Log(Form("Initialize was %s",( IsValid() ? "fine" : "NOT OK")));
124}
125
126//_____________________________________________________________________________
127UInt_t
128AliMUONPreprocessor::Process(TMap* dcsAliasMap)
129{
130 /// loop over subtasks to make them work
131
132 if (!IsValid())
133 {
134 Log("Will not run as not properly initialized");
135 return 99;
136 }
137
138 if (!IsApplicable())
139 {
140 Log("Nothing to do for me");
141 return 0;
142 }
143
144 UInt_t rv(0);
145
146 for ( Int_t i = 0; i <= fSubprocessors->GetLast(); ++i )
147 {
148 rv += Subprocessor(i)->Process(dcsAliasMap);
149 }
150
151 return rv;
152}
153
154//_____________________________________________________________________________
155void
156AliMUONPreprocessor::Print(Option_t* opt) const
157{
158 /// output to screen
159 cout << "<AliMUONPreprocessor> subprocessors :" << endl;
160 for ( Int_t i=0; i <= fSubprocessors->GetLast(); ++i )
161 {
162 Subprocessor(i)->Print(opt);
163 }
164}
165
166//_____________________________________________________________________________
167AliMUONVSubprocessor*
168AliMUONPreprocessor::Subprocessor(Int_t i) const
169{
170 /// return i-th subprocessor
171 if ( i >= 0 && i <= fSubprocessors->GetLast() )
172 {
173 return static_cast<AliMUONVSubprocessor*>(fSubprocessors->At(i));
174 }
175 return 0x0;
176}