1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 //-----------------------------------------------------------------------------
19 // Class AliMUONGMSSubprocessor
20 // -----------------------------
21 // The shuttle subprocessor for GMS data
22 // Author: Ivana Hrivnacova, IPN Orsay
24 //-----------------------------------------------------------------------------
26 #include "AliMUONGMSSubprocessor.h"
27 #include "AliMUONPreprocessor.h"
29 #include "AliCDBMetaData.h"
31 #include <TTimeStamp.h>
33 #include <TClonesArray.h>
34 #include <TObjString.h>
35 #include <Riostream.h>
38 ClassImp(AliMUONGMSSubprocessor)
41 const Int_t AliMUONGMSSubprocessor::fgkSystem = AliPreprocessor::kDCS;
42 const TString AliMUONGMSSubprocessor::fgkDataId = "GMS";
43 const TString AliMUONGMSSubprocessor::fgkMatrixArrayName = "GMSarray";
45 //______________________________________________________________________________
46 AliMUONGMSSubprocessor::AliMUONGMSSubprocessor(AliMUONPreprocessor* master)
47 : AliMUONVSubprocessor(master, "GMS", "Upload GMS matrices to OCDB"),
51 fTransformer.CreateModules();
54 //______________________________________________________________________________
55 AliMUONGMSSubprocessor::~AliMUONGMSSubprocessor()
66 //______________________________________________________________________________
67 UInt_t AliMUONGMSSubprocessor::ProcessFile(const TString& fileName)
69 /// Convert TGeoHMatrix to AliAlignObjMatrix and fill them into AliTestDataDCS object
71 Master()->Log(Form("Processing GMS file %s", fileName.Data()));
74 TFile f(fileName.Data());
76 Master()->Log(Form("Cannot open file %s",fileName.Data()));
80 // Get array with matrices
81 TClonesArray* array = (TClonesArray*)f.Get(fgkMatrixArrayName);
83 Master()->Log(Form("TClonesArray not found in file %s",fileName.Data()));
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);
92 TObject* data = const_cast< TClonesArray*>(fTransformer.GetMisAlignmentData());
94 //Now we have to store the final CDB file
95 Master()->Log("Storing GMS");
96 AliCDBMetaData metaData;
97 metaData.SetBeamPeriod(0);
98 metaData.SetResponsible("");
99 metaData.SetComment("This preprocessor fills GMS alignment objects.");
101 Bool_t result = Master()->Store("SHUTTLE", "GMS", data, &metaData, 0, 0);
103 // Clear MisAlignArray in transformer
104 fTransformer.ClearMisAlignmentData();
106 return (result!=kTRUE);
114 //______________________________________________________________________________
115 UInt_t AliMUONGMSSubprocessor::Process(TMap* /*dcsAliasMap*/)
117 /// Process GMS alignment files.
118 /// Return failure (0) in case procession of some file has failed
121 TList* sources = Master()->GetFileSources(fgkSystem, fgkDataId);
124 while ( ( o = static_cast<TObjString*>(next()) ) ) {
125 TString fileName(Master()->GetFile(fgkSystem, fgkDataId, o->GetName()));
126 result *= ProcessFile(fileName);