CMS 3D CMS Logo

DTPattern.cc
Go to the documentation of this file.
4 
5 #include <iostream>
6 
7 //------------------------------------------------------------------
8 //--- Constructors and destructor
9 //------------------------------------------------------------------
11 
12 DTPattern::DTPattern(RefDTPatternHit seedUp, RefDTPatternHit seedDown) : seedUp_(seedUp), seedDown_(seedDown) {
13  //On creation, pattern is based on seeds, with no hits. Due to traslational simmetry we only need the superlayer indexes as well as the cell index difference
14  id_ = std::make_tuple(std::get<0>(seedUp), std::get<0>(seedDown), std::get<1>(seedUp) - std::get<1>(seedDown));
15  if (debug_)
16  LogDebug("DTPattern") << "Pattern id: " << std::get<0>(id_) << " , " << std::get<1>(id_) << " , "
17  << std::get<2>(id_);
18 }
19 
20 DTPattern::DTPattern(int SL1, int SL2, int diff) {
21  //On creation, pattern is based on seeds, with no hits. Due to traslational simmetry we only need the superlayer indexes as well as the cell index difference
22  seedUp_ = std::make_tuple(SL1, 0, 0);
23  seedDown_ = std::make_tuple(SL2, diff, 0);
24  id_ = std::make_tuple(SL1, SL2, diff);
25  if (debug_)
26  LogDebug("DTPattern") << "Pattern id: " << std::get<0>(id_) << " , " << std::get<1>(id_) << " , "
27  << std::get<2>(id_);
28 }
29 
31  //Add additional gen level hits in the gen pattern coordinates (untranslated)
32  genHits_.push_back(hit);
33  if (debug_)
34  LogDebug("DTPattern") << "Added gen hit: " << std::get<0>(hit) << " , " << std::get<1>(hit) << " , "
35  << std::get<2>(hit);
36 }
37 
38 int DTPattern::latHitIn(int slId, int chId, int allowedVariance) const {
39  //Check if a hit is inside of the pattern for a given pattern width
40  int temp = -999;
41  for (auto it = this->genHits_.begin(); it != this->genHits_.end(); ++it) {
42  if (slId == (std::get<0>(*it) - 1)) {
43  if (chId == (std::get<1>(*it) + recoseedDown_)) {
44  return std::get<2>(*it);
45  }
46  //This is equivalent to an allowed discrete width of the pattern (configured)
47  else if ((chId <= (std::get<1>(*it) + recoseedDown_ + allowedVariance)) &&
48  (chId >= (std::get<1>(*it) + recoseedDown_ - allowedVariance))) {
49  temp = -10;
50  }
51  }
52  }
53  return temp;
54 }
55 
56 std::ostream &operator<<(std::ostream &out, DTPattern const &p) {
57  //Friend for printing pattern information trough iostream
58  out << "Pattern id: " << std::get<0>(p.id()) << " , " << std::get<1>(p.id()) << " , " << std::get<2>(p.id())
59  << std::endl;
60  std::vector<RefDTPatternHit> thegenHits = p.genHits();
61  out << "Pattern hits: " << std::endl;
62 
63  for (std::vector<RefDTPatternHit>::iterator itHit = thegenHits.begin(); itHit != thegenHits.end(); itHit++) {
64  out << "[" << std::get<0>(*itHit) << " , " << std::get<1>(*itHit) << " , " << std::get<2>(*itHit) << "]";
65  }
66  return out;
67 }
68 
void addHit(RefDTPatternHit hit)
Definition: DTPattern.cc:30
std::vector< RefDTPatternHit > genHits_
Definition: DTPattern.h:53
RefDTPatternHit seedDown_
Definition: DTPattern.h:51
int diff() const
Definition: DTPattern.h:42
virtual ~DTPattern()
Definition: DTPattern.cc:69
const bool debug_
Definition: DTPattern.h:60
int latHitIn(int slId, int chId, int allowedVariance) const
Definition: DTPattern.cc:38
std::tuple< int, int, int > RefDTPatternHit
Definition: DTPattern.h:10
int recoseedDown_
Definition: DTPattern.h:59
std::ostream & operator<<(std::ostream &out, DTPattern const &p)
Definition: DTPattern.cc:56
RefDTPatternHit seedUp_
Definition: DTPattern.h:50
DTPatternIdentifier id_
Definition: DTPattern.h:56
#define LogDebug(id)