test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
GEMDigiModel.cc
Go to the documentation of this file.
3 
4 void
6 {
7  for (auto d: strips_)
8  {
9  if (d.second == -999) continue;
10 
11  // (strip, bx)
12  GEMDigi digi(d.first, d.second);
13  digis.insertDigi(GEMDetId(rollDetId), digi);
14  addLinks(d.first, d.second);
15  }
16  strips_.clear();
17 }
18 
19 void
20 GEMDigiModel::addLinks(unsigned int strip, int bx)
21 {
22  std::pair<unsigned int, int> digi(strip, bx);
23  auto channelHitItr = detectorHitMap_.equal_range(digi);
24 
25  // find the fraction contribution for each SimTrack
26  std::map<int, float> simTrackChargeMap;
27  std::map<int, EncodedEventId> eventIdMap;
28  float totalCharge(0.);
29  for(auto hitItr = channelHitItr.first; hitItr != channelHitItr.second; ++hitItr)
30  {
31  const PSimHit * hit(hitItr->second);
32  // might be zero for unit tests and such
33  if(hit == nullptr) continue;
34 
35  int simTrackId(hit->trackId());
36  //float charge = hit->getCharge();
37  const float charge(1.f);
38  auto chargeItr = simTrackChargeMap.find(simTrackId);
39  if( chargeItr == simTrackChargeMap.end() )
40  {
41  simTrackChargeMap[simTrackId] = charge;
42  eventIdMap[simTrackId] = hit->eventId();
43  }
44  else
45  {
46  chargeItr->second += charge;
47  }
48  totalCharge += charge;
49  }
50 
51  for(auto &charge: simTrackChargeMap)
52  {
53  const int simTrackId(charge.first);
54  auto link(StripDigiSimLink(strip, simTrackId, eventIdMap[simTrackId], charge.second/totalCharge));
56  }
57 }
58 
59 
void push_back(const T &t)
Definition: DetSet.h:68
tuple d
Definition: ztail.py:151
double f[11][100]
EncodedEventId eventId() const
Definition: PSimHit.h:105
void addLinks(unsigned int strip, int bx)
creates links from Digi to SimTrack
Definition: GEMDigiModel.cc:20
std::set< std::pair< int, int > > strips_
Definition: GEMDigiModel.h:62
unsigned int trackId() const
Definition: PSimHit.h:102
void fillDigis(int rollDetId, GEMDigiCollection &)
Definition: GEMDigiModel.cc:5
DetectorHitMap detectorHitMap_
Definition: GEMDigiModel.h:74
StripDigiSimLinks stripDigiSimLinks_
Definition: GEMDigiModel.h:75