CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Private Attributes
DTMuonSLToSL Class Reference

#include <DTMuonSLToSL.h>

Inheritance diagram for DTMuonSLToSL:
DTMuonLocalAlignment

Public Member Functions

void calculationSLToSL ()
 
 DTMuonSLToSL (std::string, int, float, float, TFile *)
 
TMatrixD returnbSLMatrix (float, float, float)
 
TMatrixD returnCSLMatrix (float, float, float)
 
void setBranchTree ()
 
 ~DTMuonSLToSL ()
 
- Public Member Functions inherited from DTMuonLocalAlignment
 DTMuonLocalAlignment ()
 
void initNTuples (int)
 
void setBranchAddressTree ()
 
 ~DTMuonLocalAlignment ()
 

Private Attributes

float cov [3][3]
 
float dx
 
float dz
 
float phiy
 
float ptMax
 
float ptMin
 
int srC
 
int stC
 
TTree * ttreeOutput
 
int whC
 

Additional Inherited Members

- Public Attributes inherited from DTMuonLocalAlignment
float charge
 
float dxdzSl [5]
 
float dxdzSlSL1 [5]
 
float dxdzSlSL3 [5]
 
float dydzSl [5]
 
float edxdzSl [5]
 
float edxdzSlSL1 [5]
 
float edxdzSlSL3 [5]
 
float edydzSl [5]
 
float eta
 
float ex [5][14]
 
float excp [5][14]
 
float exdxdzSl [5]
 
float exdxdzSlSL1 [5]
 
float exdxdzSlSL3 [5]
 
float exSl [5]
 
float exSlSL1 [5]
 
float exSlSL3 [5]
 
float eycp [5][14]
 
float eydydzSl [5]
 
float eySl [5]
 
TFile * f
 
int la [5][14]
 
int nhits [5]
 
int nphihits [5]
 
int nseg
 
int nthetahits [5]
 
std::string ntuplePath
 
int numberOfRootFiles
 
float p
 
float phi
 
float pt
 
int sl [5][14]
 
int sr [5]
 
int st [5]
 
TChain * tali
 
int wh [5]
 
float xc [5][14]
 
float xcp [5][14]
 
float xSl [5]
 
float xSL1SL3 [5]
 
float xSL3SL1 [5]
 
float xSlSL1 [5]
 
float xSlSL3 [5]
 
float yc [5][14]
 
float ycp [5][14]
 
float ySl [5]
 
float zc [5][14]
 

Detailed Description

$Date$

Revision:
1.3
Author
Luca Scodellaro Luca..nosp@m.Scod.nosp@m.ellar.nosp@m.o@ce.nosp@m.rn.ch

Definition at line 18 of file DTMuonSLToSL.h.

Constructor & Destructor Documentation

DTMuonSLToSL::DTMuonSLToSL ( std::string  path,
int  n_files,
float  MaxPt,
float  MinPt,
TFile *  f_ 
)
DTMuonSLToSL::~DTMuonSLToSL ( )

Definition at line 19 of file DTMuonSLToSL.cc.

19 {}

Member Function Documentation

void DTMuonSLToSL::calculationSLToSL ( )

Definition at line 21 of file DTMuonSLToSL.cc.

References c, counter, cov, dx, DTMuonLocalAlignment::dxdzSlSL1, DTMuonLocalAlignment::dxdzSlSL3, dz, DTMuonLocalAlignment::f, mps_fire::i, DTMuonLocalAlignment::nhits, DTMuonLocalAlignment::nseg, phiy, DTMuonLocalAlignment::pt, ptMax, ptMin, returnbSLMatrix(), returnCSLMatrix(), alignCSCRings::s, DTMuonLocalAlignment::sr, srC, DTMuonLocalAlignment::st, relativeConstraints::station, stC, DTMuonLocalAlignment::tali, ttreeOutput, DTMuonLocalAlignment::wh, whC, DTMuonLocalAlignment::xSL1SL3, DTMuonLocalAlignment::xSL3SL1, DTMuonLocalAlignment::xSlSL1, DTMuonLocalAlignment::xSlSL3, and DTMuonLocalAlignment::zc.

Referenced by DTMuonSLToSL().

21  {
22  TMatrixD ****C13 = new TMatrixD ***[5];
23  TMatrixD ****b13 = new TMatrixD ***[5];
24  TMatrixD ****C31 = new TMatrixD ***[5];
25  TMatrixD ****b31 = new TMatrixD ***[5];
26 
27  for (int whI = -2; whI < 3; ++whI) {
28  C13[whI + 2] = new TMatrixD **[4];
29  b13[whI + 2] = new TMatrixD **[4];
30  C31[whI + 2] = new TMatrixD **[4];
31  b31[whI + 2] = new TMatrixD **[4];
32  for (int stI = 1; stI < 5; ++stI) {
33  C13[whI + 2][stI - 1] = new TMatrixD *[14];
34  b13[whI + 2][stI - 1] = new TMatrixD *[14];
35  C31[whI + 2][stI - 1] = new TMatrixD *[14];
36  b31[whI + 2][stI - 1] = new TMatrixD *[14];
37  for (int seI = 1; seI < 15; ++seI) {
38  if (seI > 12 && stI != 4)
39  continue;
40  C13[whI + 2][stI - 1][seI - 1] = new TMatrixD(3, 3);
41  b13[whI + 2][stI - 1][seI - 1] = new TMatrixD(3, 1);
42  C31[whI + 2][stI - 1][seI - 1] = new TMatrixD(3, 3);
43  b31[whI + 2][stI - 1][seI - 1] = new TMatrixD(3, 1);
44  }
45  }
46  }
47 
48  //Run over the TTree
49  Int_t nentries = (Int_t)tali->GetEntries();
50  for (Int_t i = 0; i < nentries; i++) {
51  tali->GetEntry(i);
52  //Basic cuts
53  if (pt > ptMax || pt < ptMin)
54  continue;
55 
56  bool repeatedHits = false;
57  for (int counter = 0; counter < nseg; ++counter) {
58  //Make sure there are no repeated hits
59  for (int counterHi = 0; counterHi < nhits[counter]; counterHi++) {
60  for (int counterHj = 0; counterHj < nhits[counter]; counterHj++) {
61  if (counterHi == counterHj)
62  continue;
63  if (zc[counter][counterHi] == zc[counter][counterHj]) {
64  repeatedHits = true;
65  }
66  }
67  }
68  if (repeatedHits == true)
69  continue;
70 
71  float x_13 = xSlSL3[counter];
72  float xp_13 = xSL1SL3[counter];
73  float x_31 = xSlSL1[counter];
74  float xp_31 = xSL3SL1[counter];
75  //float tanphi = dxdzSl[counter];
76  float tanphi_13 = dxdzSlSL1[counter];
77  float tanphi_31 = dxdzSlSL3[counter];
78  int wheel = wh[counter];
79  int station = st[counter];
80  int sector = sr[counter];
81 
82  if (fabs(x_13 - xp_13) < 3 && fabs(x_31 - xp_31) && fabs(tanphi_13 - tanphi_31) < 0.06) {
83  *(C13[wheel + 2][station - 1][sector - 1]) += returnCSLMatrix(x_13, xp_13, tanphi_13);
84  *(b13[wheel + 2][station - 1][sector - 1]) += returnbSLMatrix(x_13, xp_13, tanphi_13);
85 
86  *(C31[wheel + 2][station - 1][sector - 1]) += returnCSLMatrix(x_31, xp_31, tanphi_31);
87  *(b31[wheel + 2][station - 1][sector - 1]) += returnbSLMatrix(x_31, xp_31, tanphi_31);
88  }
89  }
90  }
91 
92  for (int wheel = -2; wheel < 3; ++wheel) {
93  for (int station = 1; station < 5; ++station) {
94  for (int sector = 1; sector < 15; ++sector) {
95  if (sector > 12 && station != 4)
96  continue;
97  TMatrixD solution13(3, 1);
98  TMatrixD solution31(3, 1);
99  TMatrixD C31_copy = *(C31[wheel + 2][station - 1][sector - 1]);
100  TMatrixD C13_copy = *(C13[wheel + 2][station - 1][sector - 1]);
101  TMatrixD b31_copy = *(b31[wheel + 2][station - 1][sector - 1]);
102  TMatrixD b13_copy = *(b13[wheel + 2][station - 1][sector - 1]);
103 
104  C31_copy.Invert();
105  C13_copy.Invert();
106  solution13 = C13_copy * b13_copy;
107  solution31 = C31_copy * b31_copy;
108  whC = wheel;
109  stC = station;
110  srC = sector;
111  dx = solution13(0, 0);
112  dz = solution13(1, 0);
113  phiy = solution13(2, 0);
114  for (int c = 0; c < 3; ++c) {
115  for (int s = 0; s < 3; ++s) {
116  cov[c][s] = C13_copy(c, s);
117  }
118  }
119  ttreeOutput->Fill();
120  }
121  }
122  }
123  f->Write();
124 }
const edm::EventSetup & c
TTree * ttreeOutput
Definition: DTMuonSLToSL.h:42
static std::atomic< unsigned int > counter
TMatrixD returnCSLMatrix(float, float, float)
float cov[3][3]
Definition: DTMuonSLToSL.h:37
TMatrixD returnbSLMatrix(float, float, float)
TMatrixD DTMuonSLToSL::returnbSLMatrix ( float  x,
float  xp,
float  tanphi 
)

Definition at line 142 of file DTMuonSLToSL.cc.

References makeMuonMisalignmentScenario::matrix.

Referenced by calculationSLToSL().

142  {
143  TMatrixD matrix(3, 1);
144 
145  matrix(0, 0) = -(x - xp);
146  matrix(1, 0) = -(x - xp) * tanphi;
147  matrix(2, 0) = -(x - xp) * tanphi * xp;
148 
149  return matrix;
150 }
TMatrixD DTMuonSLToSL::returnCSLMatrix ( float  x,
float  xp,
float  tanphi 
)

Definition at line 126 of file DTMuonSLToSL.cc.

References makeMuonMisalignmentScenario::matrix.

Referenced by calculationSLToSL().

126  {
127  TMatrixD matrix(3, 3);
128 
129  matrix(0, 0) = 1.0;
130  matrix(1, 0) = tanphi;
131  matrix(0, 1) = tanphi;
132  matrix(1, 1) = tanphi * tanphi;
133  matrix(0, 2) = tanphi * xp;
134  matrix(2, 0) = tanphi * xp;
135  matrix(2, 2) = tanphi * tanphi * xp * xp;
136  matrix(2, 1) = tanphi * tanphi * xp;
137  matrix(1, 2) = tanphi * tanphi * xp;
138 
139  return matrix;
140 }
void DTMuonSLToSL::setBranchTree ( )

Definition at line 152 of file DTMuonSLToSL.cc.

References cov, dx, dz, phiy, srC, stC, ttreeOutput, and whC.

Referenced by DTMuonSLToSL().

152  {
153  ttreeOutput = new TTree("DTSLToSLResult", "DTSLToSLResult");
154 
155  ttreeOutput->Branch("wh", &whC, "wh/F");
156  ttreeOutput->Branch("st", &stC, "st/F");
157  ttreeOutput->Branch("sr", &srC, "sr/F");
158  ttreeOutput->Branch("dx", &dx, "dx/F");
159  ttreeOutput->Branch("dz", &dz, "dz/F");
160  ttreeOutput->Branch("phiy", &phiy, "phiy/F");
161  ttreeOutput->Branch("cov", cov, "cov[3][3]/F");
162 }
TTree * ttreeOutput
Definition: DTMuonSLToSL.h:42
float cov[3][3]
Definition: DTMuonSLToSL.h:37

Member Data Documentation

float DTMuonSLToSL::cov[3][3]
private

Definition at line 37 of file DTMuonSLToSL.h.

Referenced by calculationSLToSL(), and setBranchTree().

float DTMuonSLToSL::dx
private

Definition at line 36 of file DTMuonSLToSL.h.

Referenced by calculationSLToSL(), and setBranchTree().

float DTMuonSLToSL::dz
private
float DTMuonSLToSL::phiy
private

Definition at line 36 of file DTMuonSLToSL.h.

Referenced by calculationSLToSL(), and setBranchTree().

float DTMuonSLToSL::ptMax
private

Definition at line 40 of file DTMuonSLToSL.h.

Referenced by calculationSLToSL(), and DTMuonSLToSL().

float DTMuonSLToSL::ptMin
private

Definition at line 40 of file DTMuonSLToSL.h.

Referenced by calculationSLToSL(), and DTMuonSLToSL().

int DTMuonSLToSL::srC
private

Definition at line 35 of file DTMuonSLToSL.h.

Referenced by calculationSLToSL(), and setBranchTree().

int DTMuonSLToSL::stC
private

Definition at line 35 of file DTMuonSLToSL.h.

Referenced by calculationSLToSL(), and setBranchTree().

TTree* DTMuonSLToSL::ttreeOutput
private

Definition at line 42 of file DTMuonSLToSL.h.

Referenced by calculationSLToSL(), and setBranchTree().

int DTMuonSLToSL::whC
private

Definition at line 35 of file DTMuonSLToSL.h.

Referenced by calculationSLToSL(), and setBranchTree().