FairRoot/PandaRoot
Functions
create_misalignment_lmd_pixel.C File Reference

Go to the source code of this file.

Functions

int create_misalignment_lmd_pixel (double dr=0, double da=0, string filename)
 

Function Documentation

int create_misalignment_lmd_pixel ( double  dr = 0,
double  da = 0,
string  filename 
)

TEST for one sensor only!

Definition at line 1 of file create_misalignment_lmd_pixel.C.

References dx, dy, dz, i, m, and output.

1  {
2  dr*=1e-4;//mkm --> cm
3  // da*=1e-5;// 10e-5rad --> rad
4  da*=1e-3;// 10e-3rad --> rad
5  std::ofstream output;//misalignment params of each sensor
6  //output.open("/home/karavdin/pandaRoot12/macro/lmd/lumi.misalign.par");
7  output.open(filename.c_str());
8  output<<"#################################################################"<<endl;
9  output<<"# Alignment parameters for LMD"<<endl;
10  output<<"# Format:"<<endl;
11  output<<"# parameter_name:parameter_type(i-integer, d-double) parameter_value"<<endl;
12  output<<"# PndLmdAlignPar"<<endl;
13  output<<"# Description of parameters:"<<endl;
14  output<<"#################################################################"<<endl;
15  output<<"#################################################################"<<endl;
16  output<<"# Alignment parameters for Lmd pixel sensors"<<endl;
17  output<<"#################################################################"<<endl;
18  output<<"[LMDAlignPar]"<<endl;
19  output<<"num_halfs:Int_t 2"<<endl;
20  output<<"num_planes:Int_t 4"<<endl;
21  output<<"num_modules:Int_t 5"<<endl;
22  output<<"num_sensors:Int_t 5"<<endl;
23  output<<"num_sides:Int_t 2"<<endl;
24  //--------------------------------------------------------------------
25  gROOT->Macro("$VMCWORKDIR/gconfig/rootlogon.C");
26 
27  //misalignment
28  double dx[2][4][5];
29  double dy[2][4][5];
30  double dz[2][4][5];
31  double dalpha[2][4][5];
32  double dbeta[2][4][5];
33  double dgamma[2][4][5];
34 
36  TRandom1 seedgen;
37  for(Int_t j=0; j<2; ++j){
38  for(Int_t i=0; i<4; ++i){
39  for(Int_t m=0; m<5; ++m){
40  // for(Int_t m=0; m<1; ++m){
41  //TRandom3 the recommended one, since it has good random proprieties (period of about 10**6000 )and it is fast.
42  TRandom3 grand(0);//uniq seed generation
43  // int seedgrand = seedgen.Uniform(1e9);
44  // grand.SetSeed(seedgrand);
45  // if(m==0){
46  dx[j][i][m] = grand.Gaus(0,dr);
47  // seedgrand = seedgen.Uniform(1e9);
48  // grand.SetSeed(seedgrand);
49  dy[j][i][m] = grand.Gaus(0,dr);
50  // seedgrand = seedgen.Uniform(1e9);
51  // grand.SetSeed(seedgrand);
52  dz[j][i][m] = grand.Gaus(0,dr);
53  // seedgrand = seedgen.Uniform(1e7);
54  // grand.SetSeed(seedgrand);
55  dalpha[j][i][m] = grand.Gaus(0,da);
56  // seedgrand = seedgen.Uniform(1e9);
57  // grand.SetSeed(seedgrand);
58  dbeta[j][i][m] = grand.Gaus(0,da);
59  // seedgrand = seedgen.Uniform(1e9);
60  // grand.SetSeed(seedgrand);
61  dgamma[j][i][m] = grand.Gaus(0,da);
62  //if(dgamma[j][i][m]<0) dgamma[j][i][m]=-dgamma[j][i][m];
63 
64  // dalpha[j][i][m]=0;//TEST
65  // dbeta[j][i][m] =0;//TEST
66  // if(i==0) dgamma[j][i][m]=0;
67  // if(i==0) dgamma[j][i][m]=0;
68  // }
69  // if(i==0){
70  // if(i!=3){
71  // dx[j][i][m] = 0;
72  // dy[j][i][m] = 0;
73  // dz[j][i][m] = 0;
74  // dalpha[j][i][m] = 0;
75  // dbeta[j][i][m] = 0;
76  // if(i==0) dgamma[j][i][m] = 0;
77  // }
78  // // else{
79 
80  // // }
81  // cout<<" dx["<<j<<"]["<<i<<"]="<<dx[j][i]<<" ";
82  // cout<<" dy["<<j<<"]["<<i<<"]="<<dy[j][i]<<" ";
83  // cout<<" dgamma["<<j<<"]["<<i<<"]="<<dgamma[j][i]<<endl;
84  output<<"shift_x_"<<j<<"_"<<i<<"_"<<m<<":Double_t "<<dx[j][i][m]<<endl;
85  output<<"shift_y_"<<j<<"_"<<i<<"_"<<m<<":Double_t "<<dy[j][i][m]<<endl;
86  output<<"shift_z_"<<j<<"_"<<i<<"_"<<m<<":Double_t "<<dz[j][i][m]<<endl;
87  output<<"rotate_x_"<<j<<"_"<<i<<"_"<<m<<":Double_t "<<dalpha[j][i][m]<<endl;
88  output<<"rotate_y_"<<j<<"_"<<i<<"_"<<m<<":Double_t "<<dbeta[j][i][m]<<endl;
89  output<<"rotate_z_"<<j<<"_"<<i<<"_"<<m<<":Double_t "<<dgamma[j][i][m]<<endl;
90  }
91  // output<<" "<<endl;
92  }
93  }
94  output<<"#################################################################"<<endl;
95  output.close();
96  return 0;
97 }
double dy
Int_t i
Definition: run_full.C:25
__m128 m
Definition: P4_F32vec4.h:28
FairParRootFileIo * output
Definition: sim_emc_apd.C:120
double dx
const string filename