ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
MuonSpectrometer
MuonDetDescr
MuonDetDescrUtils
exe
MuonSectorMappingTest.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include <iostream>
6
#include <string>
7
8
#include "
MuonDetDescrUtils/MuonSectorMapping.h
"
9
#include "TFile.h"
10
#include "TTree.h"
11
12
int
main
(
int
argc,
char
* argv[]) {
13
if
(argc > 1) { std::cout << argv[0] << std::endl; }
14
Muon::MuonSectorMapping
sectorMapping;
15
16
TFile* output =
new
TFile(
"MuonSectorMapping.root"
,
"RECREATE"
);
17
TTree*
tree
=
new
TTree(
"sm"
,
"sm"
);
18
float
phi
;
19
float
width
;
20
float
rInSector;
21
float
rTest;
22
float
phiInSector;
23
float
phiTest;
24
float
phiSector;
25
float
neighbourPhi;
26
float
rNeighbour;
27
float
overlapPhi;
28
int
id;
29
int
closeToEdge;
30
int
neighbours;
31
int
neighbourId;
32
int
inside;
33
tree
->Branch(
"phi"
, &
phi
,
"phi/F"
);
34
tree
->Branch(
"width"
, &
width
,
"width/F"
);
35
tree
->Branch(
"phiInSector"
, &phiInSector,
"phiInSector/F"
);
36
tree
->Branch(
"phiTest"
, &phiTest,
"phiTest/F"
);
37
tree
->Branch(
"rInSector"
, &rInSector,
"rInSector/F"
);
38
tree
->Branch(
"rTest"
, &rTest,
"rTest/F"
);
39
tree
->Branch(
"phiSector"
, &phiSector,
"phiSector/F"
);
40
tree
->Branch(
"neighbourPhi"
, &neighbourPhi,
"neighbourPhi/F"
);
41
tree
->Branch(
"rNeighbour"
, &rNeighbour,
"rNeighbour/F"
);
42
tree
->Branch(
"overlapPhi"
, &overlapPhi,
"overlapPhi/F"
);
43
tree
->Branch(
"id"
, &
id
,
"id/I"
);
44
tree
->Branch(
"closeToEdge"
, &closeToEdge,
"closeToEdge/I"
);
45
tree
->Branch(
"neighbours"
, &neighbours,
"neighbours/I"
);
46
tree
->Branch(
"neighbourId"
, &neighbourId,
"neighbourId/I"
);
47
tree
->Branch(
"inside"
, &inside,
"inside/I"
);
48
49
float
r
= 1000.;
50
unsigned
int
nsamplings = 100000;
51
float
dphi = 2 *
M_PI
/ nsamplings;
52
for
(
unsigned
int
i = 0; i < nsamplings; ++i) {
53
phi
= -
M_PI
+ dphi * i;
54
id
= sectorMapping.
getSector
(
phi
);
55
width
= sectorMapping.
sectorWidth
(
id
);
56
phiSector = sectorMapping.
sectorPhi
(
id
);
57
phiInSector = sectorMapping.
transformPhiToSector
(
phi
,
id
);
58
phiTest = sectorMapping.
transformPhiToSector
(phiInSector,
id
,
false
);
59
rInSector = sectorMapping.
transformRToSector
(
r
,
phi
,
id
);
60
rTest = sectorMapping.
transformRToSector
(rInSector,
phi
,
id
,
false
);
61
std::vector<int> sectors;
62
sectorMapping.
getSectors
(
phi
, sectors);
63
neighbours = sectors.size();
64
neighbourId = -1;
65
for
(
auto
val : sectors) {
66
if
(val !=
id
) neighbourId = val;
67
}
68
neighbourPhi = -5;
69
overlapPhi = -5.;
70
rNeighbour = 1100;
71
if
(neighbourId > 0) {
72
neighbourPhi = sectorMapping.
sectorPhi
(neighbourId);
73
overlapPhi = sectorMapping.
sectorOverlapPhi
(
id
, neighbourId);
74
rNeighbour = sectorMapping.
transformRToNeighboringSector
(rInSector,
id
, neighbourId);
75
}
76
closeToEdge = sectorMapping.
closeToSectorBoundary
(
phi
);
77
inside = sectorMapping.
insideSector
(
id
,
phi
);
78
tree
->Fill();
79
}
80
tree
->Write();
81
output->Write();
82
output->Close();
83
return
0;
84
}
M_PI
#define M_PI
Definition
ActiveFraction.h:14
phi
Scalar phi() const
phi method
Definition
AmgMatrixBasePlugin.h:67
MuonSectorMapping.h
width
const double width
Definition
TTileTripReader.cxx:24
Muon::MuonSectorMapping
Definition
MuonSectorMapping.h:20
Muon::MuonSectorMapping::sectorOverlapPhi
double sectorOverlapPhi(int sector1, int sector2) const
returns the phi position of the overlap between the two sectors (which have to be neighboring) in rad...
Definition
MuonSectorMapping.h:120
Muon::MuonSectorMapping::transformPhiToSector
double transformPhiToSector(double phi, int sector, bool toSector=true) const
transforms a phi position from and to the sector coordinate system in radians
Definition
MuonSectorMapping.h:112
Muon::MuonSectorMapping::sectorPhi
double sectorPhi(int sector) const
returns the centeral phi position of a sector in radians
Definition
MuonSectorMapping.h:81
Muon::MuonSectorMapping::sectorWidth
double sectorWidth(int sector) const
sector width (with overlap) in radians
Definition
MuonSectorMapping.h:72
Muon::MuonSectorMapping::transformRToSector
double transformRToSector(double r, double phi, int sector, bool toSector=true) const
expresses a radial position from and to the sector coordinate frame, the phi position should always b...
Definition
MuonSectorMapping.h:140
Muon::MuonSectorMapping::getSectors
void getSectors(double phi, std::vector< int > §ors) const
returns the main sector plus neighboring if the phi position is in an overlap region
Definition
MuonSectorMapping.h:97
Muon::MuonSectorMapping::insideSector
bool insideSector(int sector, double phi) const
checks whether the phi position is consistent with sector
Definition
MuonSectorMapping.h:74
Muon::MuonSectorMapping::closeToSectorBoundary
bool closeToSectorBoundary(double phi) const
checks whether the phi position is close to a sector boundary
Definition
MuonSectorMapping.h:106
Muon::MuonSectorMapping::getSector
int getSector(double phi) const
returns the sector corresponding to the phi position
Definition
MuonSectorMapping.h:86
Muon::MuonSectorMapping::transformRToNeighboringSector
double transformRToNeighboringSector(double r, int sectorHit, int sectorTarget) const
transform a radial position from one sector frame into another
Definition
MuonSectorMapping.h:152
r
int r
Definition
globals.cxx:22
main
int main()
Definition
hello.cxx:18
tree
TChain * tree
Definition
tile_monitor.h:30
Generated on
for ATLAS Offline Software by
1.17.0