]>
Commit | Line | Data |
---|---|---|
9fd7d50e | 1 | #if !defined(__CINT__) || defined(__MAKECINT__) |
2 | #include "TSystem.h" | |
3 | #include "TROOT.h" | |
4 | #include "TGeoManager.h" | |
5 | #include "TObjString.h" | |
6 | #include "TClonesArray.h" | |
7 | #include "TError.h" | |
8 | #include "AliGeomManager.h" | |
9 | #include "AliCDBManager.h" | |
10 | #include "AliCDBStorage.h" | |
11 | #include "AliCDBPath.h" | |
12 | #include "AliCDBEntry.h" | |
13 | #include "AliCDBId.h" | |
14 | #include "AliCDBMetaData.h" | |
15 | #include "AliMisAligner.h" | |
16 | #include "AliHMPIDMisAligner.h" | |
17 | #include <TString.h> | |
18 | #endif | |
19 | ||
20 | void MakeHMPIDAlignmentObjs(Bool_t toOCDB = kFALSE, const char* misalType="residual") | |
21 | { | |
22 | // Make alignment objects for HMPID detector | |
23 | // for the misalignment scenario passed as argument "misalType". | |
24 | //Input Args: toOCDB = kFALSE -> the results are written in a local file called HMPIDMisalignObject.root | |
25 | // kTRUE -> the results are written in local://$ALICE_ROOT/OCD | |
26 | // misalType = ideal, residual, full (see class AliHMPIDMisAligner) | |
27 | ||
28 | const char* macroname = "MakeHMPIDAlignmentObjs.C"; | |
29 | ||
30 | // Load geometry from OCDB; update geometry before loading it if we are going to load | |
31 | // the alignment objects to the OCDB | |
32 | AliCDBManager* cdb = AliCDBManager::Instance(); | |
33 | if(!cdb->IsDefaultStorageSet()) cdb->SetDefaultStorage("local://$ALICE_ROOT/OCDB"); | |
34 | cdb->SetRun(0); | |
35 | // AliCDBStorage* storage = 0; | |
36 | ||
37 | AliGeomManager::LoadGeometry(); //load geom from default OCDB storage | |
38 | ||
39 | TClonesArray* objsArray = 0; | |
40 | ||
41 | AliHMPIDMisAligner* misAlignerHMPID = new AliHMPIDMisAligner(); | |
42 | misAlignerHMPID->SetMisalType(misalType); | |
43 | objsArray = misAlignerHMPID->MakeAlObjsArray(); | |
44 | ||
45 | if(toOCDB) | |
46 | { | |
47 | AliCDBId id("HMPID/Align/Data",0,AliCDBRunRange::Infinity()); | |
48 | AliCDBMetaData *md = misAlignerHMPID->GetCDBMetaData(); | |
49 | md->SetResponsible("Domenico Di Bari"); | |
50 | md->SetAliRootVersion(gSystem->Getenv("ARVERSION")); | |
51 | cdb->Put(objsArray,id,md); | |
52 | } else { | |
53 | // save on file | |
54 | TFile file("HMPIDMisalignObject.root","RECREATE"); | |
55 | if(!file) { | |
56 | Error(macroName,"cannot open file for output\n"); | |
57 | return; | |
58 | } | |
59 | file.cd(); | |
60 | file.WriteObject(objsArray,"HMPIDAlignObjs","kSingleKey"); | |
61 | file.Close(); | |
62 | } | |
63 | ||
64 | return; | |
65 | } |