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