]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/AliMUONPreprocessor.cxx
2e7fcc46bae19320807b318a6b60315f82b7fe22
[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 #include "AliMUONPedestalSubprocessor.h"
20 #include "AliMUONGMSSubprocessor.h"
21
22 #include "AliLog.h"
23
24 #include "Riostream.h"
25 #include "TObjArray.h"
26
27 /// \class AliMUONPreprocessor
28 ///
29 /// Shuttle preprocessor for MUON subsystems (TRK and TRG)
30 /// 
31 /// It's simply a manager class that deals with a list of sub-tasks 
32 /// (of type AliMUONVSubprocessor).
33 ///
34 /// \author Laurent Aphecetche
35
36 /// \cond CLASSIMP
37 ClassImp(AliMUONPreprocessor)
38 /// \endcond
39
40 const TString  AliMUONPreprocessor::fgkTrackerDetName = "MCH";
41 const TString  AliMUONPreprocessor::fgkTriggerDetName = "MTR";
42
43 //_____________________________________________________________________________
44 AliMUONPreprocessor::AliMUONPreprocessor(const TString& detName, 
45                                          AliShuttleInterface* shuttle) 
46 : AliPreprocessor(detName.Data(),shuttle), 
47 //  fSubprocessors(new TObjArray[kLast])
48   fSubprocessors(new TObjArray())
49 {
50   /// ctor. Builds the list of subtasks
51   /// Tests detector wrt to tracker or trigger to 
52   /// instantiate the correct list of subtasks, which should be : 
53   /// Tracker : 
54   /// - pedestals
55   /// - gains
56   /// - deadchannels
57   /// - gms
58   ///
59   /// Trigger : 
60   /// - masks
61   /// - lut
62   
63   if ( detName == fgkTrackerDetName ) { 
64     fSubprocessors->Add(new AliMUONPedestalSubprocessor(this));
65     fSubprocessors->Add(new AliMUONGMSSubprocessor(this));
66   }
67   else if ( detName == fgkTriggerDetName ) {
68     AliWarningStream() << "Trigger subprocessors not yet implemented." << endl;
69   }  
70   else { 
71     // Wrong detector name
72     AliErrorStream() << "Wrong detector name." << endl;
73   }  
74 }
75
76 //_____________________________________________________________________________
77 AliMUONPreprocessor::~AliMUONPreprocessor()
78 {
79   /// dtor
80   delete fSubprocessors;
81 }
82
83 //_____________________________________________________________________________
84 void
85 AliMUONPreprocessor::Initialize(Int_t run, UInt_t startTime, UInt_t endTime)
86 {
87   /// loop over subtasks and initialize them
88   for ( Int_t i = 0; i <= fSubprocessors->GetLast(); ++i )
89   {
90     Subprocessor(i)->Initialize(run,startTime,endTime);
91   }
92 }
93
94 //_____________________________________________________________________________
95 UInt_t
96 AliMUONPreprocessor::Process(TMap* dcsAliasMap)
97 {
98   /// loop over subtasks to make them work
99   UInt_t rv(0);
100   
101   for ( Int_t i = 0; i <= fSubprocessors->GetLast(); ++i )
102   {
103     rv += Subprocessor(i)->Process(dcsAliasMap);
104   }
105   return rv;
106 }
107
108 //_____________________________________________________________________________
109 void
110 AliMUONPreprocessor::Print(Option_t* opt) const
111 {
112   /// output to screen
113   cout << "<AliMUONPreprocessor> subprocessors :" << endl;
114   for ( Int_t i=0; i <= fSubprocessors->GetLast(); ++i )
115   {
116     Subprocessor(i)->Print(opt);
117   }
118 }
119
120 //_____________________________________________________________________________
121 AliMUONVSubprocessor*
122 AliMUONPreprocessor::Subprocessor(Int_t i) const
123 {
124   /// return i-th subprocessor
125   if ( i >= 0 && i <= fSubprocessors->GetLast() )
126   {
127     return static_cast<AliMUONVSubprocessor*>(fSubprocessors->At(i));
128   }
129   return 0x0;
130 }