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 "AliCDBEntry.h"
22 #include "AliMUONGMSSubprocessor.h"
23 #include "AliMUONHVSubprocessor.h"
24 #include "AliMUONPedestalSubprocessor.h"
26 #include "AliMpDDLStore.h"
27 #include "AliMpDataMap.h"
28 #include "AliMpDataStreams.h"
29 #include "AliMpSegmentation.h"
30 #include "AliShuttleInterface.h"
31 #include "Riostream.h"
32 #include "TObjArray.h"
34 //-----------------------------------------------------------------------------
35 /// \class AliMUONPreprocessor
37 /// Shuttle preprocessor for MUON subsystems (TRK and TRG)
39 /// It's simply a manager class that deals with a list of sub-tasks
40 /// (of type AliMUONVSubprocessor).
42 /// \author Laurent Aphecetche
43 //-----------------------------------------------------------------------------
46 ClassImp(AliMUONPreprocessor)
49 //_____________________________________________________________________________
50 AliMUONPreprocessor::AliMUONPreprocessor(const char* detName, AliShuttleInterface* shuttle)
51 : AliPreprocessor(detName, shuttle),
54 fSubprocessors(new TObjArray()),
60 //_____________________________________________________________________________
61 AliMUONPreprocessor::~AliMUONPreprocessor()
64 delete fSubprocessors;
67 //_____________________________________________________________________________
69 AliMUONPreprocessor::ClearSubprocessors()
71 /// Empty our subprocessor list
72 fSubprocessors->Clear();
75 fIsApplicable = kTRUE;
78 //_____________________________________________________________________________
80 AliMUONPreprocessor::Add(AliMUONVSubprocessor* sub, Bool_t processDCS)
82 /// Add a subprocessor to our list of workers
83 fSubprocessors->Add(sub);
84 if ( processDCS == kTRUE ) fProcessDCS = processDCS;
87 //_____________________________________________________________________________
89 AliMUONPreprocessor::Initialize(Int_t run, UInt_t startTime, UInt_t endTime)
91 /// Load mapping and initialize subtasks
93 // Delete previous mapping
94 AliMpCDB::UnloadAll();
96 if ( ! IsApplicable() ) {
97 Log(Form("WARNING-RunType=%s is not one I should handle.",GetRunType()));
101 // Load mapping from CDB for this run
102 AliCDBEntry* cdbEntry = GetFromOCDB("Calib", "MappingData");
105 Log("Could not get MappingData from OCDB !");
110 AliMpDataMap* dataMap = dynamic_cast<AliMpDataMap*>(cdbEntry->GetObject());
113 Log("DataMap is not of the expected type. That is bad...");
118 AliMpDataStreams dataStreams(dataMap);
119 AliMpDDLStore::ReadData(dataStreams);
127 // loop over subtasks and initialize them
128 for ( Int_t i = 0; i <= fSubprocessors->GetLast(); ++i )
130 Bool_t ok = Subprocessor(i)->Initialize(run,startTime,endTime);
133 if (nok != fSubprocessors->GetLast()+1) fIsValid = kFALSE;
135 Log(Form("Initialize was %s",( IsValid() ? "fine" : "NOT OK")));
138 //_____________________________________________________________________________
140 AliMUONPreprocessor::Process(TMap* dcsAliasMap)
142 /// loop over subtasks to make them work
146 Log("Will not run as not properly initialized");
152 Log("Nothing to do for me");
158 for ( Int_t i = 0; i <= fSubprocessors->GetLast(); ++i )
160 rv += Subprocessor(i)->Process(dcsAliasMap);
166 //_____________________________________________________________________________
168 AliMUONPreprocessor::Print(Option_t* opt) const
171 cout << "<AliMUONPreprocessor> subprocessors :" << endl;
172 for ( Int_t i=0; i <= fSubprocessors->GetLast(); ++i )
174 Subprocessor(i)->Print(opt);
178 //_____________________________________________________________________________
179 AliMUONVSubprocessor*
180 AliMUONPreprocessor::Subprocessor(Int_t i) const
182 /// return i-th subprocessor
183 if ( i >= 0 && i <= fSubprocessors->GetLast() )
185 return static_cast<AliMUONVSubprocessor*>(fSubprocessors->At(i));