1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 #include "AliMUONPreprocessor.h"
20 #include "AliMUONPedestalSubprocessor.h"
21 #include "AliMUONHVSubprocessor.h"
22 #include "AliMUONGMSSubprocessor.h"
24 #include "AliMpSegmentation.h"
25 #include "AliMpDDLStore.h"
28 #include "AliShuttleInterface.h"
29 #include "Riostream.h"
30 #include "TObjArray.h"
32 //-----------------------------------------------------------------------------
33 /// \class AliMUONPreprocessor
35 /// Shuttle preprocessor for MUON subsystems (TRK and TRG)
37 /// It's simply a manager class that deals with a list of sub-tasks
38 /// (of type AliMUONVSubprocessor).
40 /// \author Laurent Aphecetche
41 //-----------------------------------------------------------------------------
44 ClassImp(AliMUONPreprocessor)
47 //_____________________________________________________________________________
48 AliMUONPreprocessor::AliMUONPreprocessor(const char* detName, AliShuttleInterface* shuttle)
49 : AliPreprocessor(detName, shuttle),
52 fSubprocessors(new TObjArray()),
58 //_____________________________________________________________________________
59 AliMUONPreprocessor::~AliMUONPreprocessor()
62 delete fSubprocessors;
65 //_____________________________________________________________________________
67 AliMUONPreprocessor::ClearSubprocessors()
69 /// Empty our subprocessor list
70 fSubprocessors->Clear();
73 fIsApplicable = kTRUE;
76 //_____________________________________________________________________________
78 AliMUONPreprocessor::Add(AliMUONVSubprocessor* sub, Bool_t processDCS)
80 /// Add a subprocessor to our list of workers
81 fSubprocessors->Add(sub);
82 if ( processDCS == kTRUE ) fProcessDCS = processDCS;
85 //_____________________________________________________________________________
87 AliMUONPreprocessor::Initialize(Int_t run, UInt_t startTime, UInt_t endTime)
89 /// Load mapping and initialize subtasks
91 // Delete previous mapping
92 delete AliMpSegmentation::Instance(false);
93 delete AliMpDDLStore::Instance(false);
95 if ( ! IsApplicable() ) {
96 Log(Form("WARNING-RunType=%s is not one I should handle.",GetRunType()));
100 // Load mapping from CDB for this run
101 AliCDBEntry* cdbEntry = GetFromOCDB("Calib", "Mapping");
104 Log("Could not get Mapping from OCDB !");
108 cdbEntry = GetFromOCDB("Calib", "DDLStore");
111 Log("Could not get DDLStore from OCDB");
117 // loop over subtasks and initialize them
118 for ( Int_t i = 0; i <= fSubprocessors->GetLast(); ++i )
120 Subprocessor(i)->Initialize(run,startTime,endTime);
123 Log(Form("Initialize was %s",( IsValid() ? "fine" : "NOT OK")));
126 //_____________________________________________________________________________
128 AliMUONPreprocessor::Process(TMap* dcsAliasMap)
130 /// loop over subtasks to make them work
134 Log("Will not run as not properly initialized");
140 Log("Nothing to do for me");
146 for ( Int_t i = 0; i <= fSubprocessors->GetLast(); ++i )
148 rv += Subprocessor(i)->Process(dcsAliasMap);
154 //_____________________________________________________________________________
156 AliMUONPreprocessor::Print(Option_t* opt) const
159 cout << "<AliMUONPreprocessor> subprocessors :" << endl;
160 for ( Int_t i=0; i <= fSubprocessors->GetLast(); ++i )
162 Subprocessor(i)->Print(opt);
166 //_____________________________________________________________________________
167 AliMUONVSubprocessor*
168 AliMUONPreprocessor::Subprocessor(Int_t i) const
170 /// return i-th subprocessor
171 if ( i >= 0 && i <= fSubprocessors->GetLast() )
173 return static_cast<AliMUONVSubprocessor*>(fSubprocessors->At(i));