]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TPC/MakeTPCFullMisAlignment.C
Remove noisy pads - cut RMS - 2 ADC (3 ADC counts before) (Marian)
[u/mrichter/AliRoot.git] / TPC / MakeTPCFullMisAlignment.C
1 void MakeTPCFullMisAlignment(){
2   // Create TClonesArray of full misalignment objects for TPC
3   //
4   if(!gGeoManager) TGeoManager::Import("geometry.root");
5   // needed for the constructors with local coordinates not to fail
6
7   TClonesArray *array = new TClonesArray("AliAlignObjAngles",100);
8   TClonesArray &alobj = *array;
9   
10   TRandom *rnd   = new TRandom(4357);
11   AliAlignObjAngles o;
12   Int_t j = 0;
13   // RS = local
14   // sigma translation = 1mm
15   // sigma rotation = 1mrad
16   Float_t sigmatr=0.01;
17   Float_t sigmarot = 0.06;
18   for (Int_t iLayer = AliAlignObj::kTPC1; iLayer <= AliAlignObj::kTPC2; iLayer++) {
19     for (Int_t iModule = 0; iModule < AliAlignObj::LayerSize(iLayer); iModule++) {
20
21       Double_t dx = (rnd->Uniform()-0.5)*sigmatr;
22       Double_t dy = (rnd->Uniform()-0.5)*sigmatr;
23       Double_t dz = (rnd->Uniform()-0.5)*sigmatr;
24       Double_t dpsi = (rnd->Uniform()-0.5)*sigmarot;
25       Double_t dtheta = (rnd->Uniform()-0.5)*sigmarot;
26       Double_t dphi = (rnd->Uniform()-0.5)*sigmarot;
27
28       UShort_t volid = AliAlignObj::LayerToVolUID(iLayer,iModule);
29       const char *symname = AliAlignObj::SymName(volid);
30       new(alobj[j]) AliAlignObjAngles(symname, volid, dx, dy, dz, dpsi, dtheta, dphi, kFALSE);
31       j++;
32     }
33   }
34
35
36   if(!gSystem->Getenv("$TOCDB")){
37     // save on file
38     TFile f("TPCfullMisalignment.root","RECREATE");
39     if(!f) cerr<<"cannot open file for output\n";
40     f.cd();
41     f.WriteObject(array,"TPCAlignObjs","kSingleKey");
42     f.Close();
43   }else{
44     // save in CDB storage
45     const char* Storage = gSystem->Getenv("$STORAGE");
46     AliCDBManager* cdb = AliCDBManager::Instance();
47     AliCDBStorage* storage = cdb->GetStorage(Storage);
48     AliCDBMetaData* md = new AliCDBMetaData();
49     md->SetResponsible("Marian Ivanov");
50     md->SetComment("Full misalignment for TPC, sigmatr=0.01 and sigmarot=0.6 in the local RS");
51     md->SetAliRootVersion(gSystem->Getenv("$ARVERSION"));
52     AliCDBId id("TPC/Align/Data",0,9999999);
53     storage->Put(array,id,md);
54   }
55
56   array->Delete();
57
58 }
59