CMS 3D CMS Logo

List of all members | Classes | Public Types | Public Member Functions | Private Member Functions | Private Attributes
DTTMax Class Reference

#include <DTTMax.h>

Classes

struct  InfoLayer
 
struct  TMax
 Information on each of the four TMax values in a SL. More...
 

Public Types

typedef dttmaxenums::SegDir SegDir
 
typedef dttmaxenums::SigmaFactor SigmaFactor
 
typedef dttmaxenums::TMaxCells TMaxCells
 

Public Member Functions

 DTTMax (const std::vector< DTRecHit1D > &hits, const DTSuperLayer &isl, GlobalVector dir, GlobalPoint pos, const DTTTrigBaseSync &sync, dtcalibration::Histograms &hist)
 Constructor. More...
 
InfoLayer *& getInfoLayer (int layer)
 
std::vector< const TMax * > getTMax (const DTWireId &idWire)
 
std::vector< const TMax * > getTMax (const DTSuperLayerId &isl)
 
const TMaxgetTMax (TMaxCells cCase)
 
virtual ~DTTMax ()
 Destructor. More...
 

Private Member Functions

 DTTMax ()
 

Private Attributes

bool debug
 
std::vector< InfoLayer * > theInfoLayers
 
SegDir theSegDir
 
std::string theSegType
 
std::vector< TMax * > theTMaxes
 

Detailed Description

Class to calculate the different TMax values according to the track path

Author
Marina Giunta

Definition at line 31 of file DTTMax.h.

Member Typedef Documentation

◆ SegDir

Definition at line 34 of file DTTMax.h.

◆ SigmaFactor

Definition at line 35 of file DTTMax.h.

◆ TMaxCells

Definition at line 33 of file DTTMax.h.

Constructor & Destructor Documentation

◆ DTTMax() [1/2]

DTTMax::DTTMax ( const std::vector< DTRecHit1D > &  hits,
const DTSuperLayer isl,
GlobalVector  dir,
GlobalPoint  pos,
const DTTTrigBaseSync sync,
dtcalibration::Histograms hist 
)

Constructor.

Definition at line 42 of file DTTMax.cc.

References dttmaxenums::c123, dttmaxenums::c124, dttmaxenums::c134, dttmaxenums::c234, gather_cfg::cout, debug, dumpMFGeometry_cfg::delta, DeadROC_duringRun::dir, getInfoLayer(), compareTotals::hist, hfClusterShapes_cfi::hits, DTTMax::InfoLayer::idWire, dttmaxenums::L, DTLayerId::layer(), dttmaxenums::noR, dttmaxenums::notInit, dttmaxenums::R, dttmaxenums::r32, dttmaxenums::r72, dttmaxenums::r78, submitPVValidationJobs::t, RandomServiceHelper::t1, RandomServiceHelper::t2, RandomServiceHelper::t3, theInfoLayers, theSegDir, theSegType, theTMaxes, DTTMax::InfoLayer::time, GeomDet::toLocal(), DTTMax::InfoLayer::wireX, PV3DBase< T, PVType, FrameType >::x(), testProducerWithPsetDescEmpty_cfi::x1, and testProducerWithPsetDescEmpty_cfi::x2.

48  : theInfoLayers(4, (InfoLayer*)nullptr), //FIXME
49  theTMaxes(4, (TMax*)nullptr) {
50  // debug parameter for verbose output
51  debug = "true";
52 
53  // Collect all information using InfoLayer
54  for (vector<DTRecHit1D>::const_iterator hit = hits.begin(); hit != hits.end(); ++hit) {
55  // cout << "Hit Pos " << (*hit).localPosition() << endl;
56 
57  InfoLayer* layInfo = new InfoLayer((*hit), isl, dir, pos, sync);
58  int ilay = layInfo->idWire.layer();
59  if (getInfoLayer(ilay) == nullptr) {
60  getInfoLayer(ilay) = layInfo;
61  } else {
62  // FIXME: in case there is > 1 hit/layer, the first is taken and the others are IGNORED.
63  delete layInfo;
64  }
65  }
66 
67  // Get the segment direction
68  theSegDir = ((isl.toLocal(dir).x() < 0) ? L : R);
69 
70  int layersIn = 0;
71  int nGoodHits = 0;
72  for (vector<InfoLayer*>::const_iterator ilay = theInfoLayers.begin(); ilay != theInfoLayers.end(); ++ilay) {
73  if ((*ilay) == nullptr) {
74  theSegType += "X";
75  continue;
76  }
77  DTEnums::DTCellSide lOrR = (*ilay)->lr;
78  if (lOrR == Left)
79  theSegType += "L";
80  else if (lOrR == Right)
81  theSegType += "R";
82  else
83  theSegType += "X";
84 
85  // layersIn : 6 = layers 1,2,3
86  // 7 = 1,2,4
87  // 8 = 1,3,4
88  // 9 = 2,3,4
89  // 10= 1,2,3,4
90  layersIn += (*ilay)->idWire.layer();
91  nGoodHits++;
92  }
93 
94  if (nGoodHits >= 3 && (theSegType != "RRRR" && theSegType != "LLLL")) {
95  float t1 = 0.;
96  float t2 = 0.;
97  float t3 = 0.;
98  float t4 = 0.;
99  float x1 = 0.;
100  float x2 = 0.;
101  float x3 = 0.;
102  float x4 = 0.;
103 
104  if (layersIn <= 8 || layersIn == 10) {
105  t1 = getInfoLayer(1)->time;
106  x1 = getInfoLayer(1)->wireX;
107  }
108  if (layersIn <= 7 || layersIn >= 9) {
109  t2 = getInfoLayer(2)->time;
110  x2 = getInfoLayer(2)->wireX;
111  }
112  if (layersIn == 6 || layersIn >= 8) {
113  t3 = getInfoLayer(3)->time;
114  x3 = getInfoLayer(3)->wireX;
115  }
116  if (layersIn >= 7) {
117  t4 = getInfoLayer(4)->time;
118  x4 = getInfoLayer(4)->wireX;
119  }
120 
121  float t = 0.;
122  TMaxCells cGroup = notInit;
123  string type;
124  SigmaFactor sigma = noR; // Return the factor relating the width of the TMax distribution and the cell resolution
125  float halfCell = 2.1; // 2.1 is the half cell length in cm
126  float delta = 0.5; // (diff. wire pos.) < delta, halfCell+delta, .....
127  unsigned t0Factor = 99; // "quantity" of Delta(t0) included in the tmax formula
128 
129  //Debug
130  if (debug) {
131  cout << "seg. type: " << theSegType << " and dir: " << theSegDir << endl;
132  cout << "t1, t2, t3, t4: " << t1 << " " << t2 << " " << t3 << " " << t4 << endl;
133  cout << "x1, x2, x3, x4: " << x1 << " " << x2 << " " << x3 << " " << x4 << endl;
134  }
135 
136  //different t0 hists (if you have at least one hit within a certain distance from the wire)
137  unsigned hSubGroup = 99; //
138  if (t1 == 0. || t2 == 0. || t3 == 0. || t4 == 0.)
139  hSubGroup = 0; //if only 3 hits
140  else if (t1 <= 5. || t2 <= 5. || t3 <= 5. || t4 <= 5.)
141  hSubGroup = 1; //if distance of one hit from wire < 275um (v_drift=55um/ns)
142  else if (t1 <= 10. || t2 <= 10. || t3 <= 10. || t4 <= 10.)
143  hSubGroup = 2;
144  else if (t1 <= 20. || t2 <= 20. || t3 <= 20. || t4 <= 20.)
145  hSubGroup = 3;
146  else if (t1 <= 50. || t2 <= 50. || t3 <= 50. || t4 <= 50.)
147  hSubGroup = 4;
148 
149  if ((layersIn == 6 || layersIn == 10) && (fabs(x1 - x3) < delta)) {
150  cGroup = c123;
151  ((type += theSegType[0]) += theSegType[1]) += theSegType[2];
152  sigma = r32;
153  if (type == "LRL" || type == "RLR") {
154  t0Factor = 2;
155  t = (t1 + t3) / 2. + t2;
156  hist.hT123LRL->Fill(t);
157  } else if ((type == "LLR" && theSegDir == R) || (type == "RRL" && theSegDir == L)) {
158  t0Factor = 1;
159  t = (t3 - t1) / 2. + t2;
160  hist.hT123LLR->Fill(t);
161  } else if ((type == "LRR" && theSegDir == R) || (type == "RLL" && theSegDir == L)) {
162  t0Factor = 1;
163  t = (t1 - t3) / 2. + t2;
164  hist.hT123LRR->Fill(t);
165  } else {
166  t = -1.;
167  sigma = noR;
168  hist.hT123Bad->Fill(t);
169  }
170  theTMaxes[cGroup] = new TMax(t, cGroup, type, sigma, t0Factor, hSubGroup);
171  if (debug)
172  cout << "tmax123 " << t << " " << type << endl;
173  }
174  if (layersIn == 7 || layersIn == 10) {
175  cGroup = c124;
176  type.clear();
177  sigma = r72;
178  ((type += theSegType[0]) += theSegType[1]) += theSegType[3];
179  if ((theSegType == "LRLR" && type == "LRR" && x1 > x4) || (theSegType == "RLRL" && type == "RLL" && x1 < x4)) {
180  t0Factor = 2;
181  t = 1.5 * t2 + t1 - t4 / 2.;
182  hist.hT124LRR1gt4->Fill(t);
183  } else if ((type == "LLR" && theSegDir == R && (fabs(x2 - x4) < delta) && x1 < x2) ||
184  (type == "RRL" && theSegDir == L && (fabs(x2 - x4) < delta) && x1 > x2)) {
185  t0Factor = 1;
186  t = 1.5 * t2 - t1 + t4 / 2.;
187  hist.hT124LLR->Fill(t);
188  } else if ((type == "LLL" && theSegDir == R && (fabs(x2 - x4) < delta) && x1 < x2) ||
189  (type == "RRR" && theSegDir == L && (fabs(x2 - x4) < delta) && x1 > x2)) {
190  t0Factor = 0;
191  t = 1.5 * t2 - t1 - t4 / 2.;
192  hist.hT124LLLR->Fill(t);
193  } else if ((type == "LLL" && theSegDir == L && (fabs(x2 - x4) < delta)) ||
194  (type == "RRR" && theSegDir == R && (fabs(x2 - x4) < delta))) {
195  t0Factor = 0;
196  t = -1.5 * t2 + t1 + t4 / 2.;
197  hist.hT124LLLL->Fill(t);
198  } else if ((type == "LRL" && theSegDir == L && (fabs(x2 - x4) < delta)) ||
199  (type == "RLR" && theSegDir == R && (fabs(x2 - x4) < delta))) {
200  t0Factor = 3;
201  t = 1.5 * t2 + t1 + t4 / 2.;
202  hist.hT124LRLL->Fill(t);
203  } else if ((type == "LRL" && theSegDir == R && (fabs(x1 - x4) < (halfCell + delta))) ||
204  (type == "RLR" && theSegDir == L && (fabs(x1 - x4) < (halfCell + delta)))) {
205  t0Factor = 99; // it's actually 1.5, but this value it's not used
206  t = 3. / 4. * t2 + t1 / 2. + t4 / 4.;
207  sigma = r78;
208  hist.hT124LRLR->Fill(t);
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)))) {
211  t0Factor = 1;
212  t = 3. / 4. * t2 + t1 / 2. - t4 / 4.;
213  sigma = r78;
214  hist.hT124LRR1lt4->Fill(t);
215  } else {
216  t = -1.;
217  sigma = noR;
218  hist.hT124Bad->Fill(t);
219  }
220  theTMaxes[cGroup] = new TMax(t, cGroup, type, sigma, t0Factor, hSubGroup);
221  if (debug)
222  cout << "tmax124 " << t << " " << t0Factor << " " << type << endl;
223  }
224  if (layersIn == 8 || layersIn == 10) {
225  cGroup = c134;
226  type.clear();
227  ((type += theSegType[0]) += theSegType[2]) += theSegType[3];
228  sigma = r72;
229  if ((type == "LLR" && x1 > x4 && theSegType == "LRLR") || (type == "RRL" && x1 < x4 && theSegType == "RLRL")) {
230  t0Factor = 2;
231  t = 1.5 * t3 + t4 - t1 / 2.;
232  hist.hT134LLR1gt4->Fill(t);
233  } else if ((type == "LLR" && x1 < x4 && (fabs(x1 - x4) < (halfCell + delta))) ||
234  (type == "RRL" && x1 > x4 && (fabs(x1 - x4) < (halfCell + delta)))) {
235  t0Factor = 1;
236  t = 3. / 4. * t3 + t4 / 2. - t1 / 4.;
237  sigma = r78;
238  hist.hT134LLR1lt4->Fill(t);
239  } else if ((type == "LRR" && theSegDir == R && x1 < x4 && (fabs(x1 - x3) < delta)) ||
240  (type == "RLL" && theSegDir == L && x1 > x4 && (fabs(x1 - x3) < delta))) {
241  t0Factor = 1;
242  t = 1.5 * t3 - t4 + t1 / 2.;
243  hist.hT134LRR->Fill(t);
244  } else if ((type == "LRL" && theSegDir == R && (fabs(x1 - x3) < delta)) ||
245  (type == "RLR" && theSegDir == L && (fabs(x1 - x3) < delta))) {
246  t0Factor = 3;
247  t = 1.5 * t3 + t4 + t1 / 2.;
248  hist.hT134LRLR->Fill(t);
249  } else if ((type == "LRL" && theSegDir == L && (fabs(x1 - x3) < (2. * halfCell + delta))) ||
250  (type == "RLR" && theSegDir == R && (fabs(x1 - x3) < (2. * halfCell + delta)))) {
251  t0Factor = 99; // it's actually 1.5, but this value it's not used
252  t = 3. / 4. * t3 + t4 / 2. + t1 / 4.;
253  sigma = r78;
254  hist.hT134LRLL->Fill(t);
255  } else if ((type == "LLL" && theSegDir == L && x1 > x4 && (fabs(x1 - x3) < delta)) ||
256  (type == "RRR" && theSegDir == R && x1 < x4 && (fabs(x1 - x3) < delta))) {
257  t0Factor = 0;
258  t = 1.5 * t3 - t4 - t1 / 2.;
259  hist.hT134LLLL->Fill(t);
260  } else if ((type == "LLL" && theSegDir == R && (fabs(x1 - x3) < delta)) ||
261  (type == "RRR" && theSegDir == L && (fabs(x1 - x3) < delta))) {
262  t0Factor = 0;
263  t = -1.5 * t3 + t4 + t1 / 2.;
264  hist.hT134LLLR->Fill(t);
265  } else {
266  t = -1;
267  sigma = noR;
268  hist.hT134Bad->Fill(t);
269  }
270  theTMaxes[cGroup] = new TMax(t, cGroup, type, sigma, t0Factor, hSubGroup);
271  if (debug)
272  cout << "tmax134 " << t << " " << t0Factor << " " << type << endl;
273  }
274  if ((layersIn == 9 || layersIn == 10) && (fabs(x2 - x4) < delta)) {
275  cGroup = c234;
276  type.clear();
277  ((type += theSegType[1]) += theSegType[2]) += theSegType[3];
278  sigma = r32;
279  if ((type == "LRL") || (type == "RLR")) {
280  t0Factor = 2;
281  t = (t2 + t4) / 2. + t3;
282  hist.hT234LRL->Fill(t);
283  } else if ((type == "LRR" && theSegDir == R) || (type == "RLL" && theSegDir == L)) {
284  t0Factor = 1;
285  t = (t2 - t4) / 2. + t3;
286  hist.hT234LRR->Fill(t);
287  } else if ((type == "LLR" && theSegDir == R) || (type == "RRL" && theSegDir == L)) {
288  t0Factor = 1;
289  t = (t4 - t2) / 2. + t3;
290  hist.hT234LLR->Fill(t);
291  } else {
292  t = -1;
293  sigma = noR;
294  hist.hT234Bad->Fill(t);
295  }
296  theTMaxes[cGroup] = new TMax(t, cGroup, type, sigma, t0Factor, hSubGroup);
297  if (debug)
298  cout << "tmax234 " << t << " " << type << endl;
299  }
300  }
301 }
SegDir theSegDir
Definition: DTTMax.h:93
LocalPoint toLocal(const GlobalPoint &gp) const
Conversion to the R.F. of the GeomDet.
Definition: GeomDet.h:58
DTCellSide
Which side of the DT cell.
Definition: DTEnums.h:15
bool debug
Definition: DTTMax.h:86
T x() const
Definition: PV3DBase.h:59
InfoLayer *& getInfoLayer(int layer)
Definition: DTTMax.h:83
std::vector< TMax * > theTMaxes
Definition: DTTMax.h:92
std::vector< InfoLayer * > theInfoLayers
Definition: DTTMax.h:91
std::string theSegType
Definition: DTTMax.h:94

◆ ~DTTMax()

DTTMax::~DTTMax ( )
virtual

Destructor.

Definition at line 342 of file DTTMax.cc.

References theInfoLayers, and theTMaxes.

342  {
343  for (vector<InfoLayer*>::const_iterator ilay = theInfoLayers.begin(); ilay != theInfoLayers.end(); ++ilay) {
344  delete (*ilay);
345  }
346 
347  for (vector<TMax*>::const_iterator iTmax = theTMaxes.begin(); iTmax != theTMaxes.end(); ++iTmax) {
348  delete (*iTmax);
349  }
350 }
std::vector< TMax * > theTMaxes
Definition: DTTMax.h:92
std::vector< InfoLayer * > theInfoLayers
Definition: DTTMax.h:91

◆ DTTMax() [2/2]

DTTMax::DTTMax ( )
inlineprivate

Definition at line 86 of file DTTMax.h.

86 {}; // Hide default constructor

Member Function Documentation

◆ getInfoLayer()

InfoLayer*& DTTMax::getInfoLayer ( int  layer)
inline

Definition at line 83 of file DTTMax.h.

References nano_mu_digi_cff::layer, and theInfoLayers.

Referenced by DTTMax().

83 { return theInfoLayers[layer - 1]; }
std::vector< InfoLayer * > theInfoLayers
Definition: DTTMax.h:91

◆ getTMax() [1/3]

vector< const DTTMax::TMax * > DTTMax::getTMax ( const DTWireId idWire)

Definition at line 303 of file DTTMax.cc.

References dttmaxenums::c123, dttmaxenums::c124, dttmaxenums::c134, dttmaxenums::c234, DTLayerId::layer(), and findQualityFiles::v.

Referenced by DTVDriftCalibration::analyze(), and getTMax().

303  {
304  vector<const TMax*> v;
305  if (idWire.layer() == 1) {
306  v.push_back(getTMax(c123)); //FIXME: needs pointer
307  v.push_back(getTMax(c124));
308  v.push_back(getTMax(c134));
309  } else if (idWire.layer() == 2) {
310  v.push_back(getTMax(c123));
311  v.push_back(getTMax(c124));
312  v.push_back(getTMax(c234));
313  } else if (idWire.layer() == 3) {
314  v.push_back(getTMax(c123));
315  v.push_back(getTMax(c134));
316  v.push_back(getTMax(c234));
317  } else {
318  v.push_back(getTMax(c124));
319  v.push_back(getTMax(c134));
320  v.push_back(getTMax(c234));
321  }
322  return v;
323 }
std::vector< const TMax * > getTMax(const DTWireId &idWire)
Definition: DTTMax.cc:303
int layer() const
Return the layer number.
Definition: DTLayerId.h:42

◆ getTMax() [2/3]

vector< const DTTMax::TMax * > DTTMax::getTMax ( const DTSuperLayerId isl)

Definition at line 325 of file DTTMax.cc.

References dttmaxenums::c123, dttmaxenums::c124, dttmaxenums::c134, dttmaxenums::c234, getTMax(), and findQualityFiles::v.

325  {
326  vector<const TMax*> v;
327  // add TMax* to the vector only if it really exists
328  if (getTMax(c123))
329  v.push_back(getTMax(c123));
330  if (getTMax(c124))
331  v.push_back(getTMax(c124));
332  if (getTMax(c134))
333  v.push_back(getTMax(c134));
334  if (getTMax(c234))
335  v.push_back(getTMax(c234));
336  return v;
337 }
std::vector< const TMax * > getTMax(const DTWireId &idWire)
Definition: DTTMax.cc:303

◆ getTMax() [3/3]

const DTTMax::TMax * DTTMax::getTMax ( TMaxCells  cCase)

Definition at line 339 of file DTTMax.cc.

References theTMaxes.

339 { return theTMaxes[cCase]; }
std::vector< TMax * > theTMaxes
Definition: DTTMax.h:92

Member Data Documentation

◆ debug

bool DTTMax::debug
private

◆ theInfoLayers

std::vector<InfoLayer*> DTTMax::theInfoLayers
private

Definition at line 91 of file DTTMax.h.

Referenced by DTTMax(), getInfoLayer(), and ~DTTMax().

◆ theSegDir

SegDir DTTMax::theSegDir
private

Definition at line 93 of file DTTMax.h.

Referenced by DTTMax().

◆ theSegType

std::string DTTMax::theSegType
private

Definition at line 94 of file DTTMax.h.

Referenced by DTTMax().

◆ theTMaxes

std::vector<TMax*> DTTMax::theTMaxes
private

Definition at line 92 of file DTTMax.h.

Referenced by DTTMax(), getTMax(), and ~DTTMax().