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

Author
Marina Giunta

Definition at line 32 of file DTTMax.h.

Member Typedef Documentation

Definition at line 35 of file DTTMax.h.

Definition at line 36 of file DTTMax.h.

Definition at line 34 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 43 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, edmStreamStallGrapher::t, theInfoLayers, theSegDir, theSegType, theTMaxes, DTTMax::InfoLayer::time, GeomDet::toLocal(), DTTMax::InfoLayer::wireX, and PV3DBase< T, PVType, FrameType >::x().

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

Destructor.

Definition at line 368 of file DTTMax.cc.

References theInfoLayers, and theTMaxes.

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

Definition at line 84 of file DTTMax.h.

84 {}; // Hide default constructor

Member Function Documentation

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

Definition at line 81 of file DTTMax.h.

References theInfoLayers.

Referenced by DTTMax().

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

Definition at line 325 of file DTTMax.cc.

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

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

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

Definition at line 352 of file DTTMax.cc.

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

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

Definition at line 363 of file DTTMax.cc.

References theTMaxes.

363  {
364  return theTMaxes[cCase];
365 }
std::vector< TMax * > theTMaxes
Definition: DTTMax.h:90

Member Data Documentation

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

Definition at line 89 of file DTTMax.h.

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

SegDir DTTMax::theSegDir
private

Definition at line 91 of file DTTMax.h.

Referenced by DTTMax().

std::string DTTMax::theSegType
private

Definition at line 92 of file DTTMax.h.

Referenced by DTTMax().

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

Definition at line 90 of file DTTMax.h.

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