CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
RPixChargeShare Class Reference

#include <RPixChargeShare.h>

Public Member Functions

 RPixChargeShare (const edm::ParameterSet &params, uint32_t det_id, const PPSPixelTopology &ppt)
 
std::map< unsigned short, double > Share (const std::vector< RPixSignalPoint > &charge_map, const PPSPixelTopology &ppt)
 

Private Attributes

double chargeMap2E_ [4][60][40]
 
std::string ChargeMapFile2E_ [4]
 
uint32_t det_id_
 
int no_of_pixels_
 
const int pxlColSize_ = pxlInd.getDefaultColDetSize()
 
CTPPSPixelIndices pxlInd
 
const int pxlRowSize_ = pxlInd.getDefaultRowDetSize()
 
std::vector< double > signalCoupling_
 
int verbosity_
 
const int xBinMax_ [4] = {29, 59, 29, 59}
 
const int yBinMax_ [4] = {19, 19, 39, 39}
 

Detailed Description

Definition at line 9 of file RPixChargeShare.h.

Constructor & Destructor Documentation

◆ RPixChargeShare()

RPixChargeShare::RPixChargeShare ( const edm::ParameterSet params,
uint32_t  det_id,
const PPSPixelTopology ppt 
)

Definition at line 6 of file RPixChargeShare.cc.

7  : det_id_(det_id) {
8  verbosity_ = params.getParameter<int>("RPixVerbosity");
9  signalCoupling_.clear();
10  ChargeMapFile2E_[0] = params.getParameter<std::string>("ChargeMapFile2E");
11  ChargeMapFile2E_[1] = params.getParameter<std::string>("ChargeMapFile2E_2X");
12  ChargeMapFile2E_[2] = params.getParameter<std::string>("ChargeMapFile2E_2Y");
13  ChargeMapFile2E_[3] = params.getParameter<std::string>("ChargeMapFile2E_2X2Y");
14 
15  double coupling_constant_ = params.getParameter<double>("RPixCoupling");
16 
17  signalCoupling_.push_back(coupling_constant_);
18  signalCoupling_.push_back((1.0 - coupling_constant_) / 2);
19 
20  no_of_pixels_ = ppt.getNoPixels();
21 
22  double xMap, yMap;
23  double chargeprobcollect;
24  int xUpper[] = {75, 150, 75, 150};
25  int yUpper[] = {50, 50, 100, 100};
26  int ix, iy;
27  for (int i = 0; i < 4; i++) {
29  std::ifstream fChargeMap(filename.fullPath().c_str());
30  if (fChargeMap.is_open()) {
31  while (fChargeMap >> xMap >> yMap >> chargeprobcollect) {
32  ix = int((xMap + xUpper[i]) / 5);
33  iy = int((yMap + yUpper[i]) / 5);
34  chargeMap2E_[i][ix][iy] = chargeprobcollect;
35  }
36  fChargeMap.close();
37  } else
38  throw cms::Exception("PPS RPixChargeShare") << "Charge map file not found";
39  }
40 }

References chargeMap2E_, ChargeMapFile2E_, Exception, corrVsCorr::filename, PPSPixelTopology::getNoPixels(), mps_fire::i, createfilelist::int, no_of_pixels_, CalibrationSummaryClient_cfi::params, signalCoupling_, AlCaHLTBitMon_QueryRunRegistry::string, verbosity_, and edmStreamStallGrapher::xUpper.

Member Function Documentation

◆ Share()

std::map< unsigned short, double > RPixChargeShare::Share ( const std::vector< RPixSignalPoint > &  charge_map,
const PPSPixelTopology ppt 
)

Definition at line 42 of file RPixChargeShare.cc.

43  {
44  std::map<unsigned short, double> thePixelChargeMap;
45  if (verbosity_ > 1)
46  edm::LogInfo("PPS") << "RPixChargeShare " << det_id_ << " : Clouds to be induced= " << charge_map.size();
47 
48  double cH = 0;
49 
50  for (std::vector<RPixSignalPoint>::const_iterator i = charge_map.begin(); i != charge_map.end(); ++i) {
51  double hit_pos_x, hit_pos_y;
52  // Used to avoid the abort due to hits out of detector
53  if (((*i).Position().x() + ppt.getSimXWidth() / 2.) < 0 ||
54  ((*i).Position().x() + ppt.getSimXWidth() / 2.) > ppt.getSimXWidth()) {
55  edm::LogInfo("PPS RPixChargeShare")
56  << "**** Attention ((*i).Position().x()+simX_width_/2.)<0||((*i).Position().x()+simX_width_/2.)>simX_width ";
57  edm::LogInfo("PPS RPixChargeShare") << "(*i).Position().x() = " << (*i).Position().x();
58  continue;
59  }
60  if (((*i).Position().y() + ppt.getSimYWidth() / 2.) < 0 ||
61  ((*i).Position().y() + ppt.getSimYWidth() / 2.) > ppt.getSimYWidth()) {
62  edm::LogInfo("PPS RPixChargeShare")
63  << "**** Attention ((*i).Position().y()+simY_width_/2.)<0||((*i).Position().y()+simY_width_/2.)>simY_width ";
64  edm::LogInfo("PPS RPixChargeShare") << "(*i).Position().y() = " << (*i).Position().y();
65  continue;
66  }
67 
68  PPSPixelTopology::PixelInfo relevant_pixels =
69  ppt.getPixelsInvolved((*i).Position().x(), (*i).Position().y(), (*i).Sigma(), hit_pos_x, hit_pos_y);
70  double effic = relevant_pixels.effFactor();
71  if (effic < 1.e-4)
72  continue;
73 
74  unsigned short pixel_no = ppt.pixelIndex(relevant_pixels);
75 
76  double charge_in_pixel = (*i).Charge() * effic;
77 
78  cH += charge_in_pixel;
79 
80  if (verbosity_ > 1)
81  edm::LogInfo("PPS RPixChargeShare ") << "Efficiency in detector " << det_id_ << " and pixel no " << pixel_no
82  << " : " << effic << " ch: " << charge_in_pixel << " CHtot: " << cH;
83 
84  if (signalCoupling_[0] == 0.) {
85  thePixelChargeMap[pixel_no] += charge_in_pixel;
86  } else {
87  int pixel_row = relevant_pixels.pixelRowNo();
88  int pixel_col = relevant_pixels.pixelColNo();
89  double pixel_lower_x = 0;
90  double pixel_lower_y = 0;
91  double pixel_upper_x = 0;
92  double pixel_upper_y = 0;
93  int psize = 0;
94  ppt.pixelRange(pixel_row, pixel_col, pixel_lower_x, pixel_upper_x, pixel_lower_y, pixel_upper_y);
95  double pixel_width_x = pixel_upper_x - pixel_lower_x;
96  double pixel_width_y = pixel_upper_y - pixel_lower_y;
97  double pixel_center_x = pixel_lower_x + (pixel_width_x) / 2.;
98  double pixel_center_y = pixel_lower_y + (pixel_width_y) / 2.;
99  // xbin and ybin are coordinates (um) inside the pixel as in the test beam, swapped wrt plane coordinates.
100  int xbin = int((((*i).Position().y() - pixel_center_y) + pixel_width_y / 2.) * 1.e3 / 5.);
101  int ybin = int((((*i).Position().x() - pixel_center_x) + pixel_width_x / 2.) * 1.e3 / 5.);
102  if (pixel_width_x < 0.11 && pixel_width_y < 0.151) { // pixel 100x150 um^2
103  psize = 0;
104  if (xbin > xBinMax_[psize] || ybin > yBinMax_[psize]) {
105  edm::LogError("PPS RPixChargeShare") << " Array index out of bounds";
106  continue;
107  }
108  }
109  if (pixel_width_x > 0.11 && pixel_width_y < 0.151) { // pixel 200x150 um^2
110  psize = 2;
111  if (xbin > xBinMax_[psize] || ybin > yBinMax_[psize]) {
112  edm::LogError("PPS RPixChargeShare") << " Array index out of bounds";
113  continue;
114  }
115  }
116  if (pixel_width_x < 0.11 && pixel_width_y > 0.151) { // pixel 100x300 um^2
117  psize = 1;
118  if (xbin > xBinMax_[psize] || ybin > yBinMax_[psize]) {
119  edm::LogError("PPS RPixChargeShare") << " Array index out of bounds";
120  continue;
121  }
122  }
123  if (pixel_width_x > 0.11 && pixel_width_y > 0.151) { // pixel 200x300 um^2
124  psize = 3;
125  if (xbin > xBinMax_[psize] || ybin > yBinMax_[psize]) {
126  edm::LogError("PPS RPixChargeShare") << " Array index out of bounds";
127  continue;
128  }
129  }
130  if (xbin < 0 || ybin < 0) {
131  edm::LogError("PPS RPixChargeShare") << " Negative array index xbin or ybin";
132  continue;
133  }
134  double hit2neighbour[8];
135  double collect_prob = chargeMap2E_[psize][xbin][ybin];
136  thePixelChargeMap[pixel_no] += charge_in_pixel * collect_prob;
137  unsigned short neighbour_no[8];
138  unsigned short m = 0;
139  double closer_neighbour = 0;
140  unsigned short closer_no = 0;
141  // Considering the 8 neighbours to share charge
142  for (int k = pixel_row - 1; k <= pixel_row + 1; k++) {
143  for (int l = pixel_col - 1; l <= pixel_col + 1; l++) {
144  if ((k < 0) || k > pxlRowSize_ - 1 || l < 0 || l > pxlColSize_ - 1)
145  continue;
146  if ((k == pixel_row) && (l == pixel_col))
147  continue;
148  double neighbour_pixel_lower_x = 0;
149  double neighbour_pixel_lower_y = 0;
150  double neighbour_pixel_upper_x = 0;
151  double neighbour_pixel_upper_y = 0;
152  double neighbour_pixel_center_x = 0;
153  double neighbour_pixel_center_y = 0;
154  // Check the hit approach to the neighbours
155  ppt.pixelRange(
156  k, l, neighbour_pixel_lower_x, neighbour_pixel_upper_x, neighbour_pixel_lower_y, neighbour_pixel_upper_y);
157  neighbour_pixel_center_x = neighbour_pixel_lower_x + (neighbour_pixel_upper_x - neighbour_pixel_lower_x) / 2.;
158  neighbour_pixel_center_y = neighbour_pixel_lower_y + (neighbour_pixel_upper_y - neighbour_pixel_lower_y) / 2.;
159  hit2neighbour[m] = sqrt(pow((*i).Position().x() - neighbour_pixel_center_x, 2.) +
160  pow((*i).Position().y() - neighbour_pixel_center_y, -2.));
161  neighbour_no[m] = l * pxlRowSize_ + k;
162  if (hit2neighbour[m] > closer_neighbour) {
163  closer_neighbour = hit2neighbour[m];
164  closer_no = neighbour_no[m];
165  }
166  m++;
167  }
168  }
169  double chargetransfereff = (1 - collect_prob) * signalCoupling_[0];
170  thePixelChargeMap[closer_no] += charge_in_pixel * chargetransfereff;
171  }
172  }
173 
174  return thePixelChargeMap;
175 }

References chargeMap2E_, det_id_, MillePedeFileConverter_cfg::e, PPSPixelTopology::PixelInfo::effFactor(), PPSPixelTopology::getPixelsInvolved(), PPSPixelTopology::getSimXWidth(), PPSPixelTopology::getSimYWidth(), mps_fire::i, createfilelist::int, dqmdumpme::k, cmsLHEtoEOSManager::l, visualization-live-secondInstance_cfg::m, PPSPixelTopology::PixelInfo::pixelColNo(), PPSPixelTopology::pixelIndex(), PPSPixelTopology::pixelRange(), PPSPixelTopology::PixelInfo::pixelRowNo(), funct::pow(), pxlColSize_, pxlRowSize_, signalCoupling_, mathSSE::sqrt(), verbosity_, xBinMax_, and yBinMax_.

Member Data Documentation

◆ chargeMap2E_

double RPixChargeShare::chargeMap2E_[4][60][40]
private

Definition at line 25 of file RPixChargeShare.h.

Referenced by RPixChargeShare(), and Share().

◆ ChargeMapFile2E_

std::string RPixChargeShare::ChargeMapFile2E_[4]
private

Definition at line 24 of file RPixChargeShare.h.

Referenced by RPixChargeShare().

◆ det_id_

uint32_t RPixChargeShare::det_id_
private

Definition at line 15 of file RPixChargeShare.h.

Referenced by Share().

◆ no_of_pixels_

int RPixChargeShare::no_of_pixels_
private

Definition at line 20 of file RPixChargeShare.h.

Referenced by RPixChargeShare().

◆ pxlColSize_

const int RPixChargeShare::pxlColSize_ = pxlInd.getDefaultColDetSize()
private

Definition at line 19 of file RPixChargeShare.h.

Referenced by Share().

◆ pxlInd

CTPPSPixelIndices RPixChargeShare::pxlInd
private

Definition at line 17 of file RPixChargeShare.h.

◆ pxlRowSize_

const int RPixChargeShare::pxlRowSize_ = pxlInd.getDefaultRowDetSize()
private

Definition at line 18 of file RPixChargeShare.h.

Referenced by Share().

◆ signalCoupling_

std::vector<double> RPixChargeShare::signalCoupling_
private

Definition at line 16 of file RPixChargeShare.h.

Referenced by RPixChargeShare(), and Share().

◆ verbosity_

int RPixChargeShare::verbosity_
private

Definition at line 22 of file RPixChargeShare.h.

Referenced by RPixChargeShare(), and Share().

◆ xBinMax_

const int RPixChargeShare::xBinMax_[4] = {29, 59, 29, 59}
private

Definition at line 26 of file RPixChargeShare.h.

Referenced by Share().

◆ yBinMax_

const int RPixChargeShare::yBinMax_[4] = {19, 19, 39, 39}
private

Definition at line 27 of file RPixChargeShare.h.

Referenced by Share().

PPSPixelTopology::pixelIndex
unsigned short pixelIndex(PixelInfo pI) const
Definition: PPSPixelTopology.cc:25
PPSPixelTopology::getNoPixels
unsigned short getNoPixels() const
Definition: PPSPixelTopology.cc:233
PPSPixelTopology::getSimXWidth
double getSimXWidth() const
Definition: PPSPixelTopology.cc:234
PPSPixelTopology::PixelInfo
Definition: PPSPixelTopology.h:29
mps_fire.i
i
Definition: mps_fire.py:428
PPSPixelTopology::PixelInfo::pixelColNo
unsigned short pixelColNo() const
Definition: PPSPixelTopology.h:55
CalibrationSummaryClient_cfi.params
params
Definition: CalibrationSummaryClient_cfi.py:14
RPixChargeShare::ChargeMapFile2E_
std::string ChargeMapFile2E_[4]
Definition: RPixChargeShare.h:24
PPSPixelTopology::getSimYWidth
double getSimYWidth() const
Definition: PPSPixelTopology.cc:235
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
PPSPixelTopology::pixelRange
void pixelRange(unsigned int arow, unsigned int acol, double &lower_x, double &higher_x, double &lower_y, double &higher_y) const
Definition: PPSPixelTopology.cc:71
RPixChargeShare::det_id_
uint32_t det_id_
Definition: RPixChargeShare.h:15
edm::FileInPath
Definition: FileInPath.h:64
visualization-live-secondInstance_cfg.m
m
Definition: visualization-live-secondInstance_cfg.py:72
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
PPSPixelTopology::getPixelsInvolved
PixelInfo getPixelsInvolved(double x, double y, double sigma, double &hit_pos_x, double &hit_pos_y) const
Definition: PPSPixelTopology.cc:46
corrVsCorr.filename
filename
Definition: corrVsCorr.py:123
RPixChargeShare::pxlRowSize_
const int pxlRowSize_
Definition: RPixChargeShare.h:18
dqmdumpme.k
k
Definition: dqmdumpme.py:60
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
RPixChargeShare::pxlColSize_
const int pxlColSize_
Definition: RPixChargeShare.h:19
createfilelist.int
int
Definition: createfilelist.py:10
RPixChargeShare::chargeMap2E_
double chargeMap2E_[4][60][40]
Definition: RPixChargeShare.h:25
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
PPSPixelTopology::PixelInfo::pixelRowNo
unsigned short pixelRowNo() const
Definition: PPSPixelTopology.h:54
cmsLHEtoEOSManager.l
l
Definition: cmsLHEtoEOSManager.py:204
RPixChargeShare::signalCoupling_
std::vector< double > signalCoupling_
Definition: RPixChargeShare.h:16
RPixChargeShare::yBinMax_
const int yBinMax_[4]
Definition: RPixChargeShare.h:27
PPSPixelTopology::PixelInfo::effFactor
double effFactor() const
Definition: PPSPixelTopology.h:53
edmStreamStallGrapher.xUpper
xUpper
Definition: edmStreamStallGrapher.py:874
Exception
Definition: hltDiff.cc:245
RPixChargeShare::xBinMax_
const int xBinMax_[4]
Definition: RPixChargeShare.h:26
RPixChargeShare::verbosity_
int verbosity_
Definition: RPixChargeShare.h:22
funct::pow
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29
RPixChargeShare::no_of_pixels_
int no_of_pixels_
Definition: RPixChargeShare.h:20
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37