CMS 3D CMS Logo

MuonPath.cc
Go to the documentation of this file.
2 
3 #include <cmath>
4 #include <iostream>
5 #include <memory>
6 
7 using namespace cmsdt;
8 
10  quality_ = NOPATH;
11  baseChannelId_ = -1;
12 
13  for (int i = 0; i < NUM_LAYERS_2SL; i++) {
14  prim_.push_back(std::make_shared<DTPrimitive>());
15  }
16 
17  nprimitives_ = NUM_LAYERS;
18  bxTimeValue_ = -1;
19  bxNumId_ = -1;
20  tanPhi_ = 0;
21  horizPos_ = 0;
22  chiSquare_ = 0;
23  for (int i = 0; i < NUM_LAYERS; i++) {
24  lateralComb_[i] = LEFT;
25  setXCoorCell(0, i);
26  setDriftDistance(0, i);
27  }
28 }
29 
30 MuonPath::MuonPath(DTPrimitivePtrs &ptrPrimitive, int nprimUp, int nprimDown) {
31  if (nprimUp > 0 && nprimDown > 0)
32  nprimitives_ = NUM_LAYERS_2SL; //Instead of nprimUp + nprimDown;
33  else {
34  nprimitives_ = NUM_LAYERS;
35  }
36  nprimitivesUp_ = nprimUp;
37  nprimitivesDown_ = nprimDown;
38  rawId_ = 0;
39  quality_ = NOPATH;
40  baseChannelId_ = -1;
41  bxTimeValue_ = -1;
42  bxNumId_ = -1;
43  tanPhi_ = 0;
44  horizPos_ = 0;
45  chiSquare_ = 0;
46  phi_ = 0;
47  phiB_ = 0;
48 
49  for (short i = 0; i < nprimitives_; i++) {
50  lateralComb_[i] = LEFT;
51  prim_.push_back(std::make_shared<DTPrimitive>(ptrPrimitive[i]));
52 
53  setXCoorCell(0, i);
54  setDriftDistance(0, i);
55  setXWirePos(0, i);
56  setZWirePos(0, i);
57  setTWireTDC(0, i);
58  }
59 }
60 
61 MuonPath::MuonPath(DTPrimitives &ptrPrimitive, int nprimUp, int nprimDown) {
62  if (nprimUp > 0 && nprimDown > 0)
63  nprimitives_ = NUM_LAYERS_2SL; //Instead of nprimUp + nprimDown;
64  else {
65  nprimitives_ = NUM_LAYERS;
66  }
67  nprimitivesUp_ = nprimUp;
68  nprimitivesDown_ = nprimDown;
69  rawId_ = 0;
70  quality_ = NOPATH;
71  baseChannelId_ = -1;
72  bxTimeValue_ = -1;
73  bxNumId_ = -1;
74  tanPhi_ = 0;
75  horizPos_ = 0;
76  chiSquare_ = 0;
77  phi_ = 0;
78  phiB_ = 0;
79 
80  for (short i = 0; i < nprimitives_; i++) {
81  lateralComb_[i] = LEFT;
82  prim_.push_back(std::make_shared<DTPrimitive>(ptrPrimitive[i]));
83 
84  setXCoorCell(0, i);
85  setDriftDistance(0, i);
86  setXWirePos(0, i);
87  setZWirePos(0, i);
88  setTWireTDC(0, i);
89  }
90 }
91 
93  setRawId(ptr->rawId());
94  setPhi(ptr->phi());
95  setPhiB(ptr->phiB());
96  setQuality(ptr->quality());
97  setBaseChannelId(ptr->baseChannelId());
98  setCellHorizontalLayout(ptr->cellLayout());
99  setNPrimitives(ptr->nprimitives());
100 
101  setLateralComb(ptr->lateralComb());
102  setBxTimeValue(ptr->bxTimeValue());
103  setTanPhi(ptr->tanPhi());
104  setHorizPos(ptr->horizPos());
105  setChiSquare(ptr->chiSquare());
106 
107  for (int i = 0; i < ptr->nprimitives(); i++) {
108  prim_.push_back(ptr->primitive(i));
109 
110  setXCoorCell(ptr->xCoorCell(i), i);
111  setDriftDistance(ptr->xDriftDistance(i), i);
112  setXWirePos(ptr->xWirePos(i), i);
113  setZWirePos(ptr->zWirePos(i), i);
114  setTWireTDC(ptr->tWireTDC(i), i);
115  }
116 }
117 
118 //------------------------------------------------------------------
119 //--- Public
120 //------------------------------------------------------------------
122  if (ptr == nullptr)
123  std::cout << "NULL 'Primitive'." << std::endl;
124  prim_[layer] = std::move(ptr);
125 }
126 
128  for (int i = 0; i < NUM_LAYERS; i++)
129  cellLayout_[i] = layout[i];
130 }
131 
133  for (int i = 0; i < NUM_LAYERS; i++)
134  cellLayout_[i] = layout[i];
135 }
136 
138  for (int i = 0; i < ptr->nprimitives(); i++) {
139  if (this->primitive(i)->isValidTime() && ptr->primitive(i)->isValidTime()) {
140  if (ptr->primitive(i)->superLayerId() != this->primitive(i)->superLayerId() ||
141 
142  ptr->primitive(i)->channelId() != this->primitive(i)->channelId() ||
143 
144  ptr->primitive(i)->tdcTimeStamp() != this->primitive(i)->tdcTimeStamp() ||
145 
146  ptr->primitive(i)->orbit() != this->primitive(i)->orbit() ||
147  (ptr->lateralComb())[i] != (this->lateralComb())[i])
148  return false;
149  } else {
150  if (!this->primitive(i)->isValidTime() && !ptr->primitive(i)->isValidTime())
151  continue;
152 
153  else
154  return false;
155  }
156  }
157 
158  return true;
159 }
160 
162  short countValidHits = 0;
163  for (int i = 0; i < this->nprimitives(); i++) {
164  // if (!this->primitive(i))
165  // continue;
166  if (this->primitive(i)->isValidTime())
167  countValidHits++;
168  }
169 
170  if (countValidHits >= 3)
171  return true;
172  return false;
173 }
174 
176  return (prim_[0]->isValidTime() && prim_[1]->isValidTime() && prim_[2]->isValidTime() && prim_[3]->isValidTime());
177 }
178 
180  bxTimeValue_ = time;
181 
182  float auxBxId = float(time) / LHC_CLK_FREQ;
183  bxNumId_ = int(auxBxId);
184  if ((auxBxId - int(auxBxId)) >= 0.5)
185  bxNumId_ = int(bxNumId_ + 1);
186 }
187 
189  for (int i = 0; i < nprimitives_; i++) {
190  if (!this->primitive(i)->isValidTime())
191  continue;
192  lateralComb_[i] = this->primitive(i)->laterality();
193  }
194 }
195 
197  for (int i = 0; i < NUM_LAYERS; i++)
198  lateralComb_[i] = latComb[i];
199 }
200 
202  for (int i = 0; i < NUM_LAYERS; i++)
203  lateralComb_[i] = latComb[i];
204 }
MuonPath::setLateralCombFromPrimitives
void setLateralCombFromPrimitives(void)
Definition: MuonPath.cc:188
mps_fire.i
i
Definition: mps_fire.py:428
dqmMemoryStats.float
float
Definition: dqmMemoryStats.py:127
cmsdt::NOPATH
Definition: constants.h:42
gather_cfg.cout
cout
Definition: gather_cfg.py:144
cmsdt::LEFT
Definition: constants.h:45
MuonPath::isEqualTo
bool isEqualTo(MuonPath *ptr)
Definition: MuonPath.cc:137
protons_cff.time
time
Definition: protons_cff.py:39
makeLayoutFileForGui.layout
layout
Definition: makeLayoutFileForGui.py:67
MuonPath::setLateralComb
void setLateralComb(cmsdt::LATERAL_CASES latComb[4])
Definition: MuonPath.cc:196
cmsdt
Definition: constants.h:39
cmsdt::LATERAL_CASES
LATERAL_CASES
Definition: constants.h:45
MuonPath::primitive
DTPrimitivePtr primitive(int layer) const
Definition: MuonPath.h:43
MuonPath::setCellHorizontalLayout
void setCellHorizontalLayout(int layout[4])
Definition: MuonPath.cc:127
cmsdt::NUM_LAYERS
constexpr int NUM_LAYERS
Definition: constants.h:213
MuonPath
Definition: MuonPath.h:8
MuonPath::nprimitives
short nprimitives() const
Definition: MuonPath.h:44
phase1PixelTopology::layer
constexpr std::array< uint8_t, layerIndexSize > layer
Definition: phase1PixelTopology.h:99
cmsdt::LHC_CLK_FREQ
constexpr int LHC_CLK_FREQ
Definition: constants.h:170
funct::primitive
Primitive< F, X >::type primitive(const F &f)
Definition: Primitive.h:41
MuonPath::isAnalyzable
bool isAnalyzable()
Definition: MuonPath.cc:161
createfilelist.int
int
Definition: createfilelist.py:10
MuonPath::completeMP
bool completeMP()
Definition: MuonPath.cc:175
MuonPathPtr
std::shared_ptr< MuonPath > MuonPathPtr
Definition: MuonPath.h:121
cmsdt::NUM_LAYERS_2SL
constexpr int NUM_LAYERS_2SL
Definition: constants.h:248
eostools.move
def move(src, dest)
Definition: eostools.py:511
DTPrimitivePtr
std::shared_ptr< DTPrimitive > DTPrimitivePtr
Definition: DTprimitive.h:54
MuonPath::setPrimitive
void setPrimitive(DTPrimitivePtr &ptr, int layer)
Definition: MuonPath.cc:121
DTPrimitives
std::vector< DTPrimitive > DTPrimitives
Definition: DTprimitive.h:53
MuonPath.h
MuonPath::MuonPath
MuonPath()
Definition: MuonPath.cc:9
MuonPath::lateralComb
const cmsdt::LATERAL_CASES * lateralComb() const
Definition: MuonPath.h:53
MuonPath::setBxTimeValue
void setBxTimeValue(int time)
Definition: MuonPath.cc:179
DTPrimitivePtrs
std::vector< DTPrimitivePtr > DTPrimitivePtrs
Definition: DTprimitive.h:55