1 #ifndef SimPPS_RPIXDigiAnalyzer_h
2 #define SimPPS_RPIXDigiAnalyzer_h
30 #define SELECTED_PIXEL_ROW 89
31 #define SELECTED_PIXEL_COLUMN 23
32 #define SELECTED_UNITID 2014314496
33 #define TG184 0.332655724
35 #define USE_MIDDLE_OF_PIXEL_2
37 #define CENTERY -8.475
54 void endJob()
override;
73 unsigned int cumulative_cluster_size_[3];
78 hOneHitperEvent(nullptr),
79 hOneHitperEvent2(nullptr),
80 hOneHitperEventCenter(nullptr),
81 hOneHitperEvent2Center(nullptr),
82 theRPixDetTopology_() {
83 label_ =
pset.getUntrackedParameter<
string>(
"label");
86 #ifdef USE_MIDDLE_OF_PIXEL
87 hOneHitperEvent =
file->make<TH2D>(
"OneHitperEvent",
"One Hit per Event", 30, -8.511, -8.361, 20, 1, 1.1);
88 hOneHitperEvent2 =
file->make<TH2D>(
"OneHitperEvent2",
"One Hit per Event 2", 30, -8.511, -8.361, 20, 1, 1.1);
90 hOneHitperEvent =
file->make<TH2D>(
"OneHitperEvent",
"One Hit per Event", 30, -8.55, -8.4, 20, 1, 1.1);
91 hOneHitperEvent2 =
file->make<TH2D>(
"OneHitperEvent2",
"One Hit per Event 2", 30, -8.55, -8.4, 20, 1, 1.1);
93 file->make<TH2D>(
"OneHitperEventCenter",
"One Hit per Event Center", 30, -0.075, 0.075, 20, -0.05, 0.05);
95 file->make<TH2D>(
"OneHitperEvent2Center",
"Cluster Size 2", 30, -0.075, 0.075, 20, -0.05, 0.05);
98 hAllHits =
file->make<TH2D>(
"AllHits",
"All Hits", 10, 1, 1.1, 10, -8.55, -8.4);
108 for (
int a = 0;
a < 3;
a++)
119 edm::LogInfo(
"PPSPixelDigiAnalyzer") <<
"--- Run: " <<
event.id().run() <<
" Event: " <<
event.id().event();
122 <<
" I do love Pixels ";
130 edm::LogInfo(
"PPSPixelDigiAnalyzer") <<
"\n=================== RPDA Starting SimHit access"
131 <<
" ===================";
136 double selected_pixel_lower_x;
137 double selected_pixel_lower_y;
138 double selected_pixel_upper_x;
139 double selected_pixel_upper_y;
145 selected_pixel_lower_x,
146 selected_pixel_upper_x,
147 selected_pixel_lower_y,
148 selected_pixel_upper_y);
150 double hit_inside_selected_pixel[2];
151 bool found_hit_inside_selected_pixel =
false;
156 LocalPoint midP((entryP.
x() + exitP.
x()) / 2., (entryP.
y() + exitP.
y()) / 2.);
158 #ifdef USE_MIDDLE_OF_PIXEL
159 if (entryP.
x() > selected_pixel_lower_x && entryP.
x() < selected_pixel_upper_x &&
160 entryP.
y() > (selected_pixel_lower_y + 0.115 *
TG184) && entryP.
y() < (selected_pixel_upper_y + 0.115 *
TG184)
163 if (midP.
x() > selected_pixel_lower_x && midP.
x() < selected_pixel_upper_x && midP.
y() > selected_pixel_lower_y &&
164 midP.
y() < selected_pixel_upper_y
166 if (entryP.
x() > selected_pixel_lower_x && entryP.
x() < selected_pixel_upper_x &&
167 entryP.
y() > selected_pixel_lower_y && entryP.
y() < selected_pixel_upper_y
171 hit_inside_selected_pixel[0] = entryP.
x();
172 hit_inside_selected_pixel[1] = entryP.
y();
173 found_hit_inside_selected_pixel =
true;
174 #ifdef USE_MIDDLE_OF_PIXEL_2
184 edm::LogInfo(
"PPSPixelDigiAnalyzer") << hit_inside_selected_pixel[0] <<
" " << hit_inside_selected_pixel[1];
190 if (
hit->timeOfFlight() > 0) {
192 <<
"DetId: " <<
hit->detUnitId() <<
"PID: " <<
hit->particleType() <<
" TOF: " <<
hit->timeOfFlight()
193 <<
" Proc Type: " <<
hit->processType() <<
" p: " <<
hit->pabs() <<
" x = " << entryP.
x()
194 <<
" y = " << entryP.
y() <<
" z = " << entryP.
z();
199 edm::LogInfo(
"PPSPixelDigiAnalyzer") <<
"\n=================== RPDA Starting Digi access"
200 <<
" ===================";
201 int numberOfDetUnits = 0;
206 for (; DSViter != CTPPSPixelDigis->end(); DSViter++) {
209 DetId detIdObject(DSViter->detId());
211 edm::LogInfo(
"PPSPixelDigiAnalyzer") <<
"DetId: " << DSViter->detId();
213 bool found_corresponding_digi =
false;
214 unsigned int corresponding_digi_cluster_size = 0;
221 edm::LogInfo(
"PPSPixelDigiAnalyzer") <<
"FF " << DSViter->detId();
223 edm::LogInfo(
"PPSPixelDigiAnalyzer") <<
" Digi row " << di->row() <<
", col " << di->column();
230 unsigned int rr = di->row();
231 unsigned int cc = di->column();
235 <<
" pixel boundaries x low up, y low up " << lx <<
" " << ux <<
" " << ly <<
" " << uy;
238 if (DSViter->detId() ==
SELECTED_UNITID && found_hit_inside_selected_pixel) {
241 edm::LogInfo(
"PPSPixelDigiAnalyzer") <<
" Digi row " << di->row() <<
", col " << di->column();
245 found_corresponding_digi =
true;
246 corresponding_digi_cluster_size = 1;
250 if (found_corresponding_digi) {
253 edm::LogInfo(
"PPSPixelDigiAnalyzer") <<
" Digi row " << di->row() <<
", col " << di->column();
259 corresponding_digi_cluster_size++;
260 edm::LogInfo(
"PPSPixelDigiAnalyzer") <<
" Digi row " << di->row() <<
", col " << di->column();
265 if (corresponding_digi_cluster_size > 0) {
267 <<
"corresponding_digi_cluster_size in the event: " << corresponding_digi_cluster_size;
270 if (corresponding_digi_cluster_size < 3) {
272 if (corresponding_digi_cluster_size > 1) {
285 edm::LogInfo(
"PPSPixelDigiAnalyzer") <<
"numberOfDetUnits in the event: " << numberOfDetUnits;