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  phicmssw_ = 0;
49  phiBcmssw_ = 0;
50 
51  for (short i = 0; i < nprimitives_; i++) {
52  lateralComb_[i] = LEFT;
53  prim_.push_back(std::make_shared<DTPrimitive>(ptrPrimitive[i]));
54 
55  setXCoorCell(0, i);
56  setDriftDistance(0, i);
57  setXWirePos(0, i);
58  setZWirePos(0, i);
59  setTWireTDC(0, i);
60  }
61 }
62 
63 MuonPath::MuonPath(DTPrimitives &ptrPrimitive, int nprimUp, int nprimDown) {
64  if (nprimUp > 0 || nprimDown > 0)
65  nprimitives_ = NUM_LAYERS_2SL; //Instead of nprimUp + nprimDown;
66  else {
67  nprimitives_ = NUM_LAYERS;
68  }
69  nprimitivesUp_ = nprimUp;
70  nprimitivesDown_ = nprimDown;
71  rawId_ = 0;
72  quality_ = NOPATH;
73  baseChannelId_ = -1;
74  bxTimeValue_ = -1;
75  bxNumId_ = -1;
76  tanPhi_ = 0;
77  horizPos_ = 0;
78  chiSquare_ = 0;
79  phi_ = 0;
80  phiB_ = 0;
81  phicmssw_ = 0;
82  phiBcmssw_ = 0;
83 
84  for (short i = 0; i < nprimitives_; i++) {
85  lateralComb_[i] = LEFT;
86  prim_.push_back(std::make_shared<DTPrimitive>(ptrPrimitive[i]));
87 
88  setXCoorCell(0, i);
89  setDriftDistance(0, i);
90  setXWirePos(0, i);
91  setZWirePos(0, i);
92  setTWireTDC(0, i);
93  }
94 }
95 
97  setRawId(ptr->rawId());
98  setPhi(ptr->phi());
99  setPhiB(ptr->phiB());
100  setPhiCMSSW(ptr->phi_cmssw());
101  setPhiBCMSSW(ptr->phiB_cmssw());
102  setQuality(ptr->quality());
103  setBaseChannelId(ptr->baseChannelId());
104  setCellHorizontalLayout(ptr->cellLayout());
105  setNPrimitives(ptr->nprimitives());
106 
107  setLateralComb(ptr->lateralComb());
108  setBxTimeValue(ptr->bxTimeValue());
109  setTanPhi(ptr->tanPhi());
110  setHorizPos(ptr->horizPos());
111  setChiSquare(ptr->chiSquare());
112 
113  for (int i = 0; i < ptr->nprimitives(); i++) {
114  prim_.push_back(ptr->primitive(i));
115 
116  setXCoorCell(ptr->xCoorCell(i), i);
117  setDriftDistance(ptr->xDriftDistance(i), i);
118  setXWirePos(ptr->xWirePos(i), i);
119  setZWirePos(ptr->zWirePos(i), i);
120  setTWireTDC(ptr->tWireTDC(i), i);
121  }
122 }
123 
124 //------------------------------------------------------------------
125 //--- Public
126 //------------------------------------------------------------------
128  if (ptr == nullptr)
129  std::cout << "NULL 'Primitive'." << std::endl;
130  prim_[layer] = std::move(ptr);
131 }
132 
134  for (int i = 0; i < NUM_LAYERS; i++)
135  cellLayout_[i] = layout[i];
136 }
137 
139  for (int i = 0; i < NUM_LAYERS; i++)
140  cellLayout_[i] = layout[i];
141 }
142 
144  for (int i = 0; i < ptr->nprimitives(); i++) {
145  if (this->primitive(i)->isValidTime() && ptr->primitive(i)->isValidTime()) {
146  if (ptr->primitive(i)->superLayerId() != this->primitive(i)->superLayerId() ||
147 
148  ptr->primitive(i)->channelId() != this->primitive(i)->channelId() ||
149 
150  ptr->primitive(i)->tdcTimeStamp() != this->primitive(i)->tdcTimeStamp() ||
151 
152  ptr->primitive(i)->orbit() != this->primitive(i)->orbit() ||
153  (ptr->lateralComb())[i] != (this->lateralComb())[i])
154  return false;
155  } else {
156  if (!this->primitive(i)->isValidTime() && !ptr->primitive(i)->isValidTime())
157  continue;
158 
159  else
160  return false;
161  }
162  }
163 
164  return true;
165 }
166 
168  short countValidHits = 0;
169  for (int i = 0; i < this->nprimitives(); i++) {
170  // if (!this->primitive(i))
171  // continue;
172  if (this->primitive(i)->isValidTime())
173  countValidHits++;
174  }
175 
176  if (countValidHits >= 3)
177  return true;
178  return false;
179 }
180 
182  return (prim_[0]->isValidTime() && prim_[1]->isValidTime() && prim_[2]->isValidTime() && prim_[3]->isValidTime());
183 }
184 
186  bxTimeValue_ = time;
187 
188  float auxBxId = float(time) / LHC_CLK_FREQ;
189  bxNumId_ = int(auxBxId);
190  if ((auxBxId - int(auxBxId)) >= 0.5)
191  bxNumId_ = int(bxNumId_ + 1);
192 }
193 
195  for (int i = 0; i < nprimitives_; i++) {
196  if (!this->primitive(i)->isValidTime())
197  continue;
198  lateralComb_[i] = this->primitive(i)->laterality();
199  }
200 }
201 
203  for (int i = 0; i < NUM_LAYERS; i++)
204  lateralComb_[i] = latComb[i];
205 }
206 
208  for (int i = 0; i < NUM_LAYERS; i++)
209  lateralComb_[i] = latComb[i];
210 }
MuonPath::setLateralCombFromPrimitives
void setLateralCombFromPrimitives(void)
Definition: MuonPath.cc:194
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:143
protons_cff.time
time
Definition: protons_cff.py:35
makeLayoutFileForGui.layout
layout
Definition: makeLayoutFileForGui.py:67
MuonPath::setLateralComb
void setLateralComb(cmsdt::LATERAL_CASES latComb[4])
Definition: MuonPath.cc:202
cmsdt
Definition: constants.h:39
cmsdt::LATERAL_CASES
LATERAL_CASES
Definition: constants.h:45
MuonPath::primitive
DTPrimitivePtr primitive(int layer) const
Definition: MuonPath.h:45
MuonPath::setCellHorizontalLayout
void setCellHorizontalLayout(int layout[4])
Definition: MuonPath.cc:133
cmsdt::NUM_LAYERS
constexpr int NUM_LAYERS
Definition: constants.h:219
MuonPath
Definition: MuonPath.h:8
MuonPath::nprimitives
short nprimitives() const
Definition: MuonPath.h:46
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:176
funct::primitive
Primitive< F, X >::type primitive(const F &f)
Definition: Primitive.h:41
MuonPath::isAnalyzable
bool isAnalyzable()
Definition: MuonPath.cc:167
createfilelist.int
int
Definition: createfilelist.py:10
MuonPath::completeMP
bool completeMP()
Definition: MuonPath.cc:181
MuonPathPtr
std::shared_ptr< MuonPath > MuonPathPtr
Definition: MuonPath.h:127
cmsdt::NUM_LAYERS_2SL
constexpr int NUM_LAYERS_2SL
Definition: constants.h:254
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:127
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:55
MuonPath::setBxTimeValue
void setBxTimeValue(int time)
Definition: MuonPath.cc:185
DTPrimitivePtrs
std::vector< DTPrimitivePtr > DTPrimitivePtrs
Definition: DTprimitive.h:55