Raw2SDigits method implemented
[u/mrichter/AliRoot.git] / MUON / AliMUONGMSSubprocessor.cxx
CommitLineData
04aa997f 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// Class AliMUONGMSSubprocessor
19// -----------------------------
20// The shuttle subprocessor for GMS data
21// Author: Ivana Hrivnacova, IPN Orsay
22// 16/09/2006
23
24#include "AliMUONGMSSubprocessor.h"
25#include "AliMUONPreprocessor.h"
26
27#include "AliCDBMetaData.h"
28#include "AliLog.h"
29
30#include <TTimeStamp.h>
31#include <TFile.h>
32#include <TClonesArray.h>
968ce98e 33#include <TObjString.h>
04aa997f 34#include <Riostream.h>
35
36ClassImp(AliMUONGMSSubprocessor)
37
38const Int_t AliMUONGMSSubprocessor::fgkSystem = AliPreprocessor::kDAQ;
39const TString AliMUONGMSSubprocessor::fgkDataId = "GMS";
40const TString AliMUONGMSSubprocessor::fgkMatrixArrayName = "GMSarray";
41
968ce98e 42//______________________________________________________________________________
04aa997f 43AliMUONGMSSubprocessor::AliMUONGMSSubprocessor(AliMUONPreprocessor* master)
44 : AliMUONVSubprocessor(master, "GMS", "Upload GMS matrices to OCDB"),
45 fTransformer(true)
46{
47/// Constructor
48 fTransformer.ReadGeometryData("volpath.dat", "transform.dat");
49}
50
968ce98e 51//______________________________________________________________________________
04aa997f 52AliMUONGMSSubprocessor::~AliMUONGMSSubprocessor()
53{
54/// Destructor
55}
56
968ce98e 57
58//
59// private methods
60//
61
62
63//______________________________________________________________________________
64UInt_t AliMUONGMSSubprocessor::ProcessFile(const TString& fileName)
04aa997f 65{
66/// Convert TGeoHMatrix to AliAlignObjMatrix and fill them into AliTestDataDCS object
67
968ce98e 68 AliInfoStream() << "Processing file " << fileName << endl;
04aa997f 69
70 // Open root file
968ce98e 71 TFile f(fileName.Data());
72 if ( ! f.IsOpen() ) {
73 AliErrorStream() << "Cannot open file " << fileName << endl;
74 return 1;
75 }
04aa997f 76
77 // Get array with matrices
78 TClonesArray* array = (TClonesArray*)f.Get(fgkMatrixArrayName);
79 if ( ! array ) {
968ce98e 80 AliErrorStream() << "TClonesArray not found in file "
04aa997f 81 << fileName << endl;
82 return 1;
83 }
84
85 // Convert matrices into Alice alignment objects
86 for (Int_t i=0; i<array->GetEntriesFast(); i++ ) {
87 TGeoHMatrix* matrix = (TGeoHMatrix*)array->At(i);
88 fTransformer.AddMisAlignModule(matrix->GetUniqueID(), *matrix);
89 }
90 TObject* data = const_cast< TClonesArray*>(fTransformer.GetMisAlignmentData());
91
92 //Now we have to store the final CDB file
93 AliCDBMetaData metaData;
94 metaData.SetBeamPeriod(0);
95 metaData.SetResponsible("");
96 metaData.SetComment("This preprocessor fills GMS alignment objects.");
97
98 UInt_t result = Master()->Store("SHUTTLE", "GMS", data, &metaData, 0, 0);
99
100 // Clear MisAlignArray in transformer
101 fTransformer.ClearMisAlignmentData();
102
103 return result;
968ce98e 104}
105
106//
107// public methods
108//
109
110
111//______________________________________________________________________________
112UInt_t AliMUONGMSSubprocessor::Process(TMap* /*dcsAliasMap*/)
113{
114/// Process GMS alignment files
115
116 UInt_t result = 0;
117 TList* sources = Master()->GetFileSources(fgkSystem, fgkDataId);
118 TIter next(sources);
119 TObjString* o(0x0);
120 while ( ( o = static_cast<TObjString*>(next()) ) ) {
121 TString fileName(Master()->GetFile(fgkSystem, fgkDataId, o->GetName()));
122 result += ProcessFile(fileName);
123 }
124 delete sources;
125
126 return result;
04aa997f 127}
128