-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathCLUECalorimeterHit.cpp
78 lines (69 loc) · 2.81 KB
/
CLUECalorimeterHit.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/*
* Copyright (c) 2020-2024 Key4hep-Project.
*
* This file is part of Key4hep.
* See https://key4hep.github.io/key4hep-doc/ for further info.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "CLUECalorimeterHit.h"
#include <cmath>
namespace clue{
CLUECalorimeterHit::CLUECalorimeterHit(const CalorimeterHit& ch)
: CalorimeterHit(ch) {
setR();
setEta();
setPhi();
}
CLUECalorimeterHit::CLUECalorimeterHit(const CalorimeterHit& ch, const CLUECalorimeterHit::DetectorRegion detRegion, const int layer)
: CalorimeterHit(ch),
m_detectorRegion(detRegion),
m_layer(layer) {
setR();
setEta();
setPhi();
}
CLUECalorimeterHit::CLUECalorimeterHit(const CalorimeterHit& ch, const CLUECalorimeterHit::DetectorRegion detRegion, const int layer,
const CLUECalorimeterHit::Status status, const int clusterIndex, const float rho, const float delta)
: CalorimeterHit(ch),
m_detectorRegion(detRegion),
m_layer(layer),
m_status(status),
m_rho(rho),
m_delta(delta),
m_clusterIndex(clusterIndex) {
setR();
setEta();
setPhi();
}
const std::uint64_t& CLUECalorimeterHit::getLayer() const { return m_layer; }
bool CLUECalorimeterHit::inBarrel() const { return (m_detectorRegion == barrel ? true : false ) ; }
bool CLUECalorimeterHit::inEndcap() const { return (m_detectorRegion == endcap ? true : false ) ; }
bool CLUECalorimeterHit::isFollower() const { return (m_status == follower ? true : false ) ; }
bool CLUECalorimeterHit::isSeed() const { return (m_status == seed ? true : false ) ; }
bool CLUECalorimeterHit::isOutlier() const { return (m_status == outlier ? true : false ) ; }
const float& CLUECalorimeterHit::getRho() const { return m_rho; }
const float& CLUECalorimeterHit::getDelta() const { return m_delta; }
const float& CLUECalorimeterHit::getR() const { return m_r; }
const float& CLUECalorimeterHit::getEta() const { return m_eta; }
const float& CLUECalorimeterHit::getPhi() const { return m_phi; }
void CLUECalorimeterHit::setEta() {
m_eta = - 1. * log(tan(atan2(m_r, getPosition().z)/2.));
}
void CLUECalorimeterHit::setPhi() {
m_phi = atan2(getPosition().y, getPosition().x);
}
void CLUECalorimeterHit::setR() {
m_r = float(sqrt(getPosition().x*getPosition().x + getPosition().y*getPosition().y));
}
}