Fix handling of file-name text entry so that alien:/ and rfio:/ URL's can be entered...
[u/mrichter/AliRoot.git] / MUON / AliMUONPreprocessor.cxx
CommitLineData
ea199e33 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"
57e176c0 19
ea199e33 20#include "AliMUONPedestalSubprocessor.h"
57e176c0 21#include "AliMUONHVSubprocessor.h"
fee1d02b 22#include "AliMUONGMSSubprocessor.h"
23
ce8e7dbe 24#include "AliMpSegmentation.h"
25#include "AliMpDDLStore.h"
26
fee1d02b 27#include "AliLog.h"
57e176c0 28#include "AliShuttleInterface.h"
ea199e33 29#include "Riostream.h"
fee1d02b 30#include "TObjArray.h"
ea199e33 31
3d1463c8 32//-----------------------------------------------------------------------------
ea199e33 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
3d1463c8 41//-----------------------------------------------------------------------------
ea199e33 42
43/// \cond CLASSIMP
44ClassImp(AliMUONPreprocessor)
45/// \endcond
46
47//_____________________________________________________________________________
6c7a0c0f 48AliMUONPreprocessor::AliMUONPreprocessor(const char* detName, AliShuttleInterface* shuttle)
49: AliPreprocessor(detName, shuttle),
890cc210 50 fIsValid(kFALSE),
581ece00 51 fIsApplicable(kTRUE),
d489129d 52 fSubprocessors(new TObjArray()),
890cc210 53 fProcessDCS(kFALSE)
ea199e33 54{
6c7a0c0f 55 /// ctor
ea199e33 56}
57
58//_____________________________________________________________________________
59AliMUONPreprocessor::~AliMUONPreprocessor()
60{
61 /// dtor
62 delete fSubprocessors;
63}
64
65//_____________________________________________________________________________
66void
eca96915 67AliMUONPreprocessor::ClearSubprocessors()
6c7a0c0f 68{
69 /// Empty our subprocessor list
eca96915 70 fSubprocessors->Clear();
d489129d 71 fProcessDCS = kFALSE;
c41ce74d 72 fIsValid = kFALSE;
581ece00 73 fIsApplicable = kTRUE;
6c7a0c0f 74}
75
76//_____________________________________________________________________________
77void
d489129d 78AliMUONPreprocessor::Add(AliMUONVSubprocessor* sub, Bool_t processDCS)
6c7a0c0f 79{
80 /// Add a subprocessor to our list of workers
81 fSubprocessors->Add(sub);
d489129d 82 if ( processDCS == kTRUE ) fProcessDCS = processDCS;
6c7a0c0f 83}
84
85//_____________________________________________________________________________
86void
ea199e33 87AliMUONPreprocessor::Initialize(Int_t run, UInt_t startTime, UInt_t endTime)
88{
c41ce74d 89 /// Load mapping and initialize subtasks
ce8e7dbe 90
91 // Delete previous mapping
92 delete AliMpSegmentation::Instance(false);
93 delete AliMpDDLStore::Instance(false);
94
95 // Load mapping from CDB for this run
c41ce74d 96
2ab3623b 97 AliCDBEntry* cdbEntry = GetFromOCDB("Calib", "Mapping");
98 if (!cdbEntry)
c41ce74d 99 {
100 Log("Could not get Mapping from OCDB !");
101 fIsValid = kFALSE;
102 }
103
2ab3623b 104 cdbEntry = GetFromOCDB("Calib", "DDLStore");
105 if (!cdbEntry)
c41ce74d 106 {
107 Log("Could not get DDLStore from OCDB");
108 fIsValid = kFALSE;
109 }
ce8e7dbe 110
c41ce74d 111 if (IsValid())
ea199e33 112 {
c41ce74d 113 // loop over subtasks and initialize them
114 for ( Int_t i = 0; i <= fSubprocessors->GetLast(); ++i )
115 {
116 Subprocessor(i)->Initialize(run,startTime,endTime);
117 }
ea199e33 118 }
2ab3623b 119
581ece00 120 if (! IsApplicable() )
121 Log(Form("WARNING-RunType=%s is not one I should handle.",GetRunType()));
122
2ab3623b 123 Log(Form("Initialize was %s",( IsValid() ? "fine" : "NOT OK")));
ea199e33 124}
125
126//_____________________________________________________________________________
127UInt_t
128AliMUONPreprocessor::Process(TMap* dcsAliasMap)
129{
130 /// loop over subtasks to make them work
c41ce74d 131
132 if (!IsValid())
133 {
134 Log("Will not run as not properly initialized");
135 return 99;
136 }
137
581ece00 138 if (!IsApplicable())
139 {
140 Log("Nothing to do for me");
141 return 0;
142 }
143
ea199e33 144 UInt_t rv(0);
145
146 for ( Int_t i = 0; i <= fSubprocessors->GetLast(); ++i )
147 {
148 rv += Subprocessor(i)->Process(dcsAliasMap);
149 }
c41ce74d 150
ea199e33 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}