]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TOF/MakeTOFResMisAlignment.C
Remove a run from LHC10e wo AODs; added run list for the new PbPb MC LHC11a10b_bis
[u/mrichter/AliRoot.git] / TOF / MakeTOFResMisAlignment.C
CommitLineData
4d6eaa95 1void MakeTOFResMisAlignment() {
2 //
1895a097 3 // Create TClonesArray of residual misalignment objects for TOF
4 //
4d6eaa95 5
6 const char* macroname = "MakeTOFResMisAlignment.C";
7
90dbf5fb 8 TClonesArray *array = new TClonesArray("AliAlignObjParams",2000);
1895a097 9 TClonesArray &alobj = *array;
10
6fce62af 11 // Activate CDB storage and load geometry from CDB
12 AliCDBManager* cdb = AliCDBManager::Instance();
4d6eaa95 13 if (!cdb->IsDefaultStorageSet())
14 cdb->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
6fce62af 15 cdb->SetRun(0);
4d6eaa95 16
6fce62af 17 AliCDBStorage* storage;
259b0bd4 18 TString Storage;
4d6eaa95 19
a24be56b 20 if( TString(gSystem->Getenv("TOCDB")) == TString("kTRUE") ){
259b0bd4 21 Storage = gSystem->Getenv("STORAGE");
4d6eaa95 22 if (!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) {
6fce62af 23 Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data());
24 return;
25 }
26 storage = cdb->GetStorage(Storage.Data());
4d6eaa95 27 if (!storage) {
6fce62af 28 Error(macroname,"Unable to open storage %s\n",Storage.Data());
29 return;
30 }
31 AliCDBPath path("GRP","Geometry","Data");
32 AliCDBEntry *entry = storage->Get(path.GetPath(),cdb->GetRun());
4d6eaa95 33 if (!entry)
34 Fatal(macroname,"Could not get the specified CDB entry!");
35
6fce62af 36 entry->SetOwner(0);
37 TGeoManager* geom = (TGeoManager*) entry->GetObject();
38 AliGeomManager::SetGeometry(geom);
4d6eaa95 39 } else
6fce62af 40 AliGeomManager::LoadGeometry(); //load geom from default CDB storage
1895a097 41
ae079791 42 AliGeomManager::ELayerID idTOF = AliGeomManager::kTOF;
1895a097 43 Int_t j=0;
4d6eaa95 44 Int_t nSectors=18;
45
46 //Produce objects for TOF supermodules
47 Int_t iIndex=0; //let all modules have index=0 in a layer with no LUT
48 AliGeomManager::ELayerID iLayer = AliGeomManager::kInvalidLayer;
49 UShort_t dvoluid = AliGeomManager::LayerToVolUID(iLayer,iIndex); //dummy vol id
50 Double_t smdx, smdy, smdz=0., dpsi=0., dtheta, dphi=0.;
51 for(Int_t isect=0; isect<nSectors; isect++) {
52 TString symname(Form("TOF/sm%02d",isect));
53 new(alobj[j++]) AliAlignObjParams(symname.Data(),
54 dvoluid,
55 smdx, smdy, smdz, dpsi, dtheta, dphi, kFALSE);
56 }
57
a24be56b 58 Int_t strId=-1;
59 Double_t dx=0., dy=0., dz=0., dpsi=0., dtheta=0., dphi=0.;
6ca978d7 60 //TRandom *rnd = new TRandom(4357);
6fce62af 61 Double_t sigmatr = 0.1; // sigma (in cm) for shift w.r.t. local ideal RS
1895a097 62
a24be56b 63 Int_t nstrA=15;
64 Int_t nstrB=19;
65 Int_t nstrC=19;
a24be56b 66 Int_t nStrips=nstrA+2*nstrB+2*nstrC;
67
6876838b 68 Double_t cuty=0., cutz=0., cut=3*sigmatr;
a24be56b 69 for (Int_t isect = 0; isect < nSectors; isect++) {
70 for (Int_t istr = 1; istr <= nStrips; istr++) {
6876838b 71 //dy = rnd->Gaus(0.,sigmatr);
72 //dz = rnd->Gaus(0.,sigmatr);
73 //strId++;
74
75 switch (istr) {
76 case 25:
77 case 29:
78 case 63:
79 case 67:
6ca978d7 80 cuty = sigmatr*0.6;
81 dy = AliMathBase::TruncatedGaus(0., sigmatr, cut, cuty);
82 dz = AliMathBase::TruncatedGaus(0., sigmatr, cut);
6876838b 83 strId++;
84 break;
85 /*
86 case 38:
87 cuty = sigmatr*2.5;
88 cutz = sigmatr*2.5;
6ca978d7 89 dy = AliMathBase::TruncatedGaus(0., sigmatr, cut, cuty);
90 dz = AliMathBase::TruncatedGaus(0., sigmatr, cut, cutz);
6876838b 91 strId++;
92 break;
93 case 54:
94 cuty = sigmatr*2.5;
95 cutz = sigmatr*2.5;
6ca978d7 96 dy = AliMathBase::TruncatedGaus(0., sigmatr, cut, cuty);
97 dz = AliMathBase::TruncatedGaus(0., sigmatr, cutz, cut);
6876838b 98 strId++;
99 break;
100 */
101 default:
6ca978d7 102 dy = AliMathBase::TruncatedGaus(0., sigmatr, cut);
103 dz = AliMathBase::TruncatedGaus(0., sigmatr, cut);
6876838b 104 strId++;
105 break;
106 }
107
85ce4b22 108 if ((isect==13 || isect==14 || isect==15) && (istr >= 39 && istr <= 53)) continue;
4d6eaa95 109 new(alobj[j++]) AliAlignObjParams(AliGeomManager::SymName(idTOF,strId),
110 AliGeomManager::LayerToVolUID(idTOF,strId),
111 dx, dy, dz, dpsi, dtheta, dphi, kFALSE);
a24be56b 112 }
1895a097 113 }
114
4d6eaa95 115 if( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ) {
1895a097 116 // save on file
dfe9c69d 117 const char* filename = "TOFresidualMisalignment.root";
118 TFile f(filename,"RECREATE");
119 if(!f){
120 Error(macroname,"cannot open file for output\n");
121 return;
122 }
123 Info(macroname,"Saving alignment objects to the file %s", filename);
1895a097 124 f.cd();
125 f.WriteObject(array,"TOFAlignObjs","kSingleKey");
126 f.Close();
4d6eaa95 127 } else {
1895a097 128 // save in CDB storage
1895a097 129 AliCDBMetaData* md = new AliCDBMetaData();
130 md->SetResponsible("Silvia Arcelli");
131 md->SetComment("Residual misalignment for TOF, sigmatr=1mm in the local RS");
5bd470e1 132 md->SetAliRootVersion(gSystem->Getenv("ARVERSION"));
dfe9c69d 133 AliCDBId id("TOF/Align/Data",0,AliCDBRunRange::Infinity());
1895a097 134 storage->Put(array,id,md);
135 }
136
137 array->Delete();
138
139}
140
6ca978d7 141/*
6876838b 142Double_t LocalTruncatedGaus(Double_t mean, Double_t sigma, Double_t cutatL, Double_t cutatR)
143{
144 // return number generated according to a gaussian distribution N(mean,sigma) truncated at cutat
145 //
146 Double_t value;
147 do{
148 value=gRandom->Gaus(mean,sigma);
149 }while(value-mean<-cutatL || value-mean>cutatR);
150 return value;
151}
6ca978d7 152*/