]>
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$ | |
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" | |
04aa997f | 28 | |
29 | #include <TTimeStamp.h> | |
30 | #include <TFile.h> | |
31 | #include <TClonesArray.h> | |
968ce98e | 32 | #include <TObjString.h> |
04aa997f | 33 | #include <Riostream.h> |
34 | ||
78649106 | 35 | /// \cond CLASSIMP |
04aa997f | 36 | ClassImp(AliMUONGMSSubprocessor) |
78649106 | 37 | /// \endcond |
04aa997f | 38 | |
39 | const Int_t AliMUONGMSSubprocessor::fgkSystem = AliPreprocessor::kDAQ; | |
40 | const TString AliMUONGMSSubprocessor::fgkDataId = "GMS"; | |
41 | const TString AliMUONGMSSubprocessor::fgkMatrixArrayName = "GMSarray"; | |
42 | ||
968ce98e | 43 | //______________________________________________________________________________ |
04aa997f | 44 | AliMUONGMSSubprocessor::AliMUONGMSSubprocessor(AliMUONPreprocessor* master) |
45 | : AliMUONVSubprocessor(master, "GMS", "Upload GMS matrices to OCDB"), | |
46 | fTransformer(true) | |
47 | { | |
48 | /// Constructor | |
49 | fTransformer.ReadGeometryData("volpath.dat", "transform.dat"); | |
50 | } | |
51 | ||
968ce98e | 52 | //______________________________________________________________________________ |
04aa997f | 53 | AliMUONGMSSubprocessor::~AliMUONGMSSubprocessor() |
54 | { | |
55 | /// Destructor | |
56 | } | |
57 | ||
968ce98e | 58 | |
59 | // | |
60 | // private methods | |
61 | // | |
62 | ||
63 | ||
64 | //______________________________________________________________________________ | |
65 | UInt_t AliMUONGMSSubprocessor::ProcessFile(const TString& fileName) | |
04aa997f | 66 | { |
67 | /// Convert TGeoHMatrix to AliAlignObjMatrix and fill them into AliTestDataDCS object | |
68 | ||
f6e36ea4 | 69 | Master()->Log(Form("Processing GMS file %s", fileName.Data())); |
04aa997f | 70 | |
71 | // Open root file | |
968ce98e | 72 | TFile f(fileName.Data()); |
73 | if ( ! f.IsOpen() ) { | |
f6e36ea4 | 74 | Master()->Log(Form("Cannot open file %s",fileName.Data())); |
d489129d | 75 | return 1; |
968ce98e | 76 | } |
04aa997f | 77 | |
78 | // Get array with matrices | |
79 | TClonesArray* array = (TClonesArray*)f.Get(fgkMatrixArrayName); | |
80 | if ( ! array ) { | |
f6e36ea4 | 81 | Master()->Log(Form("TClonesArray not found in file %s",fileName.Data())); |
d489129d | 82 | return 2; |
04aa997f | 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 | |
f6e36ea4 | 93 | Master()->Log("Storing GMS"); |
04aa997f | 94 | AliCDBMetaData metaData; |
95 | metaData.SetBeamPeriod(0); | |
96 | metaData.SetResponsible(""); | |
97 | metaData.SetComment("This preprocessor fills GMS alignment objects."); | |
98 | ||
d489129d | 99 | Bool_t result = Master()->Store("SHUTTLE", "GMS", data, &metaData, 0, 0); |
04aa997f | 100 | |
101 | // Clear MisAlignArray in transformer | |
102 | fTransformer.ClearMisAlignmentData(); | |
103 | ||
d489129d | 104 | return (result!=kTRUE); |
968ce98e | 105 | } |
106 | ||
107 | // | |
108 | // public methods | |
109 | // | |
110 | ||
111 | ||
112 | //______________________________________________________________________________ | |
113 | UInt_t AliMUONGMSSubprocessor::Process(TMap* /*dcsAliasMap*/) | |
114 | { | |
5ac93e67 | 115 | /// Process GMS alignment files. |
116 | /// Return failure (0) in case procession of some file has failed | |
968ce98e | 117 | |
5ac93e67 | 118 | UInt_t result = 1; |
968ce98e | 119 | TList* sources = Master()->GetFileSources(fgkSystem, fgkDataId); |
120 | TIter next(sources); | |
121 | TObjString* o(0x0); | |
122 | while ( ( o = static_cast<TObjString*>(next()) ) ) { | |
123 | TString fileName(Master()->GetFile(fgkSystem, fgkDataId, o->GetName())); | |
5ac93e67 | 124 | result *= ProcessFile(fileName); |
968ce98e | 125 | } |
126 | delete sources; | |
127 | ||
04aa997f | 128 | return result; |
129 | } | |
130 |