18 using namespace dttmaxenums;
23 : rh(rh_), idWire(rh.wireId()), lr(rh.lrSide()) {
36 if (time < 0. || time > 415.) {
38 cout <<
" *** WARNING time = " <<
time << endl;
54 for (vector<DTRecHit1D>::const_iterator
hit = hits.begin();
hit != hits.end(); ++
hit) {
73 if ((*ilay) ==
nullptr) {
80 else if (lOrR == Right)
90 layersIn += (*ilay)->idWire.layer();
104 if (layersIn <= 8 || layersIn == 10) {
108 if (layersIn <= 7 || layersIn >= 9) {
112 if (layersIn == 6 || layersIn >= 8) {
125 float halfCell = 2.1;
127 unsigned t0Factor = 99;
132 cout <<
"t1, t2, t3, t4: " << t1 <<
" " << t2 <<
" " << t3 <<
" " << t4 << endl;
133 cout <<
"x1, x2, x3, x4: " << x1 <<
" " << x2 <<
" " << x3 <<
" " << x4 << endl;
137 unsigned hSubGroup = 99;
138 if (t1 == 0. || t2 == 0. || t3 == 0. || t4 == 0.)
140 else if (t1 <= 5. || t2 <= 5. || t3 <= 5. || t4 <= 5.)
142 else if (t1 <= 10. || t2 <= 10. || t3 <= 10. || t4 <= 10.)
144 else if (t1 <= 20. || t2 <= 20. || t3 <= 20. || t4 <= 20.)
146 else if (t1 <= 50. || t2 <= 50. || t3 <= 50. || t4 <= 50.)
149 if ((layersIn == 6 || layersIn == 10) && (fabs(x1 - x3) < delta)) {
153 if (type ==
"LRL" || type ==
"RLR") {
155 t = (t1 + t3) / 2. + t2;
159 t = (t3 - t1) / 2. + t2;
163 t = (t1 - t3) / 2. + t2;
170 theTMaxes[cGroup] =
new TMax(t, cGroup, type, sigma, t0Factor, hSubGroup);
172 cout <<
"tmax123 " << t <<
" " << type << endl;
174 if (layersIn == 7 || layersIn == 10) {
179 if ((
theSegType ==
"LRLR" && type ==
"LRR" && x1 > x4) || (
theSegType ==
"RLRL" && type ==
"RLL" && x1 < x4)) {
181 t = 1.5 * t2 + t1 - t4 / 2.;
183 }
else if ((type ==
"LLR" &&
theSegDir == R && (fabs(x2 - x4) < delta) && x1 < x2) ||
184 (type ==
"RRL" &&
theSegDir ==
L && (fabs(x2 - x4) < delta) && x1 > x2)) {
186 t = 1.5 * t2 - t1 + t4 / 2.;
188 }
else if ((type ==
"LLL" &&
theSegDir == R && (fabs(x2 - x4) < delta) && x1 < x2) ||
189 (type ==
"RRR" &&
theSegDir ==
L && (fabs(x2 - x4) < delta) && x1 > x2)) {
191 t = 1.5 * t2 - t1 - t4 / 2.;
193 }
else if ((type ==
"LLL" &&
theSegDir ==
L && (fabs(x2 - x4) < delta)) ||
194 (type ==
"RRR" &&
theSegDir == R && (fabs(x2 - x4) < delta))) {
196 t = -1.5 * t2 + t1 + t4 / 2.;
198 }
else if ((type ==
"LRL" &&
theSegDir ==
L && (fabs(x2 - x4) < delta)) ||
199 (type ==
"RLR" &&
theSegDir == R && (fabs(x2 - x4) < delta))) {
201 t = 1.5 * t2 + t1 + t4 / 2.;
203 }
else if ((type ==
"LRL" &&
theSegDir == R && (fabs(x1 - x4) < (halfCell + delta))) ||
204 (type ==
"RLR" &&
theSegDir ==
L && (fabs(x1 - x4) < (halfCell + delta)))) {
206 t = 3. / 4. * t2 + t1 / 2. + t4 / 4.;
209 }
else if ((type ==
"LRR" &&
theSegDir == R && x1 < x4 && (fabs(x1 - x4) < (halfCell + delta))) ||
210 (type ==
"RLL" &&
theSegDir ==
L && x1 > x4 && (fabs(x1 - x4) < (halfCell + delta)))) {
212 t = 3. / 4. * t2 + t1 / 2. - t4 / 4.;
220 theTMaxes[cGroup] =
new TMax(t, cGroup, type, sigma, t0Factor, hSubGroup);
222 cout <<
"tmax124 " << t <<
" " << t0Factor <<
" " << type << endl;
224 if (layersIn == 8 || layersIn == 10) {
229 if ((type ==
"LLR" && x1 > x4 &&
theSegType ==
"LRLR") || (type ==
"RRL" && x1 < x4 &&
theSegType ==
"RLRL")) {
231 t = 1.5 * t3 + t4 - t1 / 2.;
233 }
else if ((type ==
"LLR" && x1 < x4 && (fabs(x1 - x4) < (halfCell + delta))) ||
234 (type ==
"RRL" && x1 > x4 && (fabs(x1 - x4) < (halfCell + delta)))) {
236 t = 3. / 4. * t3 + t4 / 2. - t1 / 4.;
239 }
else if ((type ==
"LRR" &&
theSegDir == R && x1 < x4 && (fabs(x1 - x3) < delta)) ||
240 (type ==
"RLL" &&
theSegDir ==
L && x1 > x4 && (fabs(x1 - x3) < delta))) {
242 t = 1.5 * t3 - t4 + t1 / 2.;
244 }
else if ((type ==
"LRL" &&
theSegDir == R && (fabs(x1 - x3) < delta)) ||
245 (type ==
"RLR" &&
theSegDir ==
L && (fabs(x1 - x3) < delta))) {
247 t = 1.5 * t3 + t4 + t1 / 2.;
249 }
else if ((type ==
"LRL" &&
theSegDir ==
L && (fabs(x1 - x3) < (2. * halfCell + delta))) ||
250 (type ==
"RLR" &&
theSegDir == R && (fabs(x1 - x3) < (2. * halfCell + delta)))) {
252 t = 3. / 4. * t3 + t4 / 2. + t1 / 4.;
255 }
else if ((type ==
"LLL" &&
theSegDir ==
L && x1 > x4 && (fabs(x1 - x3) < delta)) ||
256 (type ==
"RRR" &&
theSegDir == R && x1 < x4 && (fabs(x1 - x3) < delta))) {
258 t = 1.5 * t3 - t4 - t1 / 2.;
260 }
else if ((type ==
"LLL" &&
theSegDir == R && (fabs(x1 - x3) < delta)) ||
261 (type ==
"RRR" &&
theSegDir ==
L && (fabs(x1 - x3) < delta))) {
263 t = -1.5 * t3 + t4 + t1 / 2.;
270 theTMaxes[cGroup] =
new TMax(t, cGroup, type, sigma, t0Factor, hSubGroup);
272 cout <<
"tmax134 " << t <<
" " << t0Factor <<
" " << type << endl;
274 if ((layersIn == 9 || layersIn == 10) && (fabs(x2 - x4) < delta)) {
279 if ((type ==
"LRL") || (type ==
"RLR")) {
281 t = (t2 + t4) / 2. + t3;
285 t = (t2 - t4) / 2. + t3;
289 t = (t4 - t2) / 2. + t3;
296 theTMaxes[cGroup] =
new TMax(t, cGroup, type, sigma, t0Factor, hSubGroup);
298 cout <<
"tmax234 " << t <<
" " << type << endl;
304 vector<const TMax*>
v;
305 if (idWire.
layer() == 1) {
309 }
else if (idWire.
layer() == 2) {
313 }
else if (idWire.
layer() == 3) {
326 vector<const TMax*>
v;
347 for (vector<TMax*>::const_iterator iTmax =
theTMaxes.begin(); iTmax !=
theTMaxes.end(); ++iTmax) {
float wirePosition(int wireNumber) const
Returns the x position in the layer of a given wire number.
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
InfoLayer(const DTRecHit1D &rh_, const DTSuperLayer &isl, GlobalVector dir, GlobalPoint pos, const DTTTrigBaseSync &sync)
Information on each of the four TMax values in a SL.
const DTLayer * layer(const DTLayerId &id) const
Return the layer corresponding to the given id.
DTCellSide
Which side of the DT cell.
LocalPoint toLocal(const GlobalPoint &gp) const
Conversion to the R.F. of the GeomDet.
int layer() const
Return the layer number.
virtual ~DTTMax()
Destructor.
std::vector< const TMax * > getTMax(const DTWireId &idWire)
constexpr std::array< uint8_t, layerIndexSize > layer
Geom::Theta< T > theta() const
const DTTopology & specificTopology() const
Cos< T >::type cos(const T &t)
float digiTime() const
Return the time (ns) of the digi used to build the rechit.
double offset(const DTLayer *layer, const DTWireId &wireId, const GlobalPoint &globalPos) const
int wire() const
Return the wire number.
InfoLayer *& getInfoLayer(int layer)
DTLayerId layerId() const
Return the corresponding LayerId.
std::vector< TMax * > theTMaxes
LocalPoint localPosition() const override
Return the 3-dimensional local position.
std::vector< InfoLayer * > theInfoLayers