CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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, DTTTrigBaseSync *sync)
 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

Date:
2013/05/23 15:28:44
Revision:
1.2
Author
Marina Giunta

Definition at line 34 of file DTTMax.h.

Member Typedef Documentation

Definition at line 37 of file DTTMax.h.

Definition at line 38 of file DTTMax.h.

Definition at line 36 of file DTTMax.h.

Constructor & Destructor Documentation

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

Constructor.

Definition at line 45 of file DTTMax.cc.

References dttmaxenums::c123, dttmaxenums::c124, dttmaxenums::c134, dttmaxenums::c234, gather_cfg::cout, debug, delta, getInfoLayer(), hT123Bad, hT123LLR, hT123LRL, hT123LRR, hT124Bad, hT124LLLL, hT124LLLR, hT124LLR, hT124LRLL, hT124LRLR, hT124LRR1gt4, hT124LRR1lt4, hT134Bad, hT134LLLL, hT134LLLR, hT134LLR1gt4, hT134LLR1lt4, hT134LRLL, hT134LRLR, hT134LRR, hT234Bad, hT234LLR, hT234LRL, hT234LRR, DTTMax::InfoLayer::idWire, dttmaxenums::L, DTLayerId::layer(), dttmaxenums::noR, dttmaxenums::notInit, dttmaxenums::R, dttmaxenums::r32, dttmaxenums::r72, dttmaxenums::r78, lumiQTWidget::t, reco::t2, theInfoLayers, theSegDir, theSegType, theTMaxes, DTTMax::InfoLayer::time, GeomDet::toLocal(), DTTMax::InfoLayer::wireX, and PV3DBase< T, PVType, FrameType >::x().

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

Destructor.

Definition at line 370 of file DTTMax.cc.

References theInfoLayers, and theTMaxes.

370  {
371  for (vector<InfoLayer*>::const_iterator ilay = theInfoLayers.begin();
372  ilay != theInfoLayers.end(); ilay++) {
373  delete (*ilay);
374  }
375 
376  for (vector<TMax*>::const_iterator iTmax = theTMaxes.begin();
377  iTmax != theTMaxes.end(); iTmax++) {
378  delete (*iTmax);
379  }
380 }
std::vector< TMax * > theTMaxes
Definition: DTTMax.h:92
std::vector< InfoLayer * > theInfoLayers
Definition: DTTMax.h:91
DTTMax::DTTMax ( )
inlineprivate

Definition at line 86 of file DTTMax.h.

86 {}; // Hide default constructor

Member Function Documentation

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

Definition at line 83 of file DTTMax.h.

References theInfoLayers.

Referenced by DTTMax().

83 {return theInfoLayers[layer-1];}
std::vector< InfoLayer * > theInfoLayers
Definition: DTTMax.h:91
vector< const DTTMax::TMax * > DTTMax::getTMax ( const DTWireId idWire)

Definition at line 327 of file DTTMax.cc.

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

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

327  {
328  vector<const TMax*> v;
329  if(idWire.layer()==1) {
330  v.push_back(getTMax(c123)); //FIXME: needs pointer
331  v.push_back(getTMax(c124));
332  v.push_back(getTMax(c134));
333  }
334  else if(idWire.layer()==2) {
335  v.push_back(getTMax(c123));
336  v.push_back(getTMax(c124));
337  v.push_back(getTMax(c234));
338  }
339  else if(idWire.layer()==3) {
340  v.push_back(getTMax(c123));
341  v.push_back(getTMax(c134));
342  v.push_back(getTMax(c234));
343  }
344  else {
345  v.push_back(getTMax(c124));
346  v.push_back(getTMax(c134));
347  v.push_back(getTMax(c234));
348  }
349  return v;
350 }
int layer() const
Return the layer number.
Definition: DTLayerId.h:55
std::vector< const TMax * > getTMax(const DTWireId &idWire)
Definition: DTTMax.cc:327
vector< const DTTMax::TMax * > DTTMax::getTMax ( const DTSuperLayerId isl)

Definition at line 354 of file DTTMax.cc.

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

354  {
355  vector<const TMax*> v;
356  // add TMax* to the vector only if it really exists
357  if(getTMax(c123)) v.push_back(getTMax(c123));
358  if(getTMax(c124)) v.push_back(getTMax(c124));
359  if(getTMax(c134)) v.push_back(getTMax(c134));
360  if(getTMax(c234)) v.push_back(getTMax(c234));
361  return v;
362 }
std::vector< const TMax * > getTMax(const DTWireId &idWire)
Definition: DTTMax.cc:327
const DTTMax::TMax * DTTMax::getTMax ( TMaxCells  cCase)

Definition at line 365 of file DTTMax.cc.

References theTMaxes.

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

Member Data Documentation

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

Definition at line 91 of file DTTMax.h.

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

SegDir DTTMax::theSegDir
private

Definition at line 93 of file DTTMax.h.

Referenced by DTTMax().

std::string DTTMax::theSegType
private

Definition at line 94 of file DTTMax.h.

Referenced by DTTMax().

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

Definition at line 92 of file DTTMax.h.

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