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