25 vector<CSCCathodeLayerInfo> clctInfo = lctDigis(clct, clctId, compdc);
29 throw cms::Exception(
"CSCCathodeLCTAnalyzer") <<
"+++ Number of CSCCathodeLayerInfo objects, " << clctInfo.size()
41 vector<CSCCathodeLayerInfo>::iterator pcli;
42 for (pcli = clctInfo.begin(); pcli != clctInfo.end(); pcli++) {
43 digiSimHitAssociator(*pcli, allSimHits);
61 vector<CSCCathodeLayerInfo> vectInfo;
67 int clct_bx = clct.
getBX();
70 if (clct_stripType == 0)
74 char stype = (clct_stripType == 0) ?
'D' :
'H';
75 LogDebug(
"lctDigis") <<
"\nlctDigis: CLCT keystrip = " << clct_keystrip <<
" (" << stype <<
")"
76 <<
" pattern = " << clct_pattern <<
"; Id:"
77 <<
" endcap " << clctId.
endcap() <<
", station " << clctId.
station() <<
", ring "
78 << clctId.
ring() <<
", chamber " << clctId.
chamber();
82 const int key_layer = 3;
84 const CSCLayer* csclayer = geom_->layer(layerId);
85 int key_stagger = (csclayer->geometry()->stagger() + 1) / 2;
92 vector<CSCComparatorDigi> digiMap;
95 hfstripDigis[i_hstrip] = -999;
100 digiNum[i_strip] = -999;
109 digi_num += preselectDigis(clct_bx, layerId, compdc, digiMap, hfstripDigis,
time,
comp, digiNum);
118 digi_num += preselectDigis(clct_bx, layerId_me1a, compdc, digiMap, hfstripDigis,
time,
comp, digiNum);
129 digiId = hfstripDigis[
strip];
134 tempInfo.
setId(layerId);
137 LogTrace(
"lctDigis") <<
" Digi on CLCT: strip/comp/time " << digiMap[digiId];
146 vectInfo.push_back(tempInfo);
155 vector<CSCComparatorDigi>& digiMap,
165 const int fifo_tbins = 12;
166 const int hit_persist = 4;
167 const int drift_delay = 2;
170 const CSCLayer* csclayer = geom_->layer(layerId);
173 bool me1a = (layerId.
station() == 1) && (layerId.
ring() == 4);
178 LogDebug(
"lctDigis") <<
"Comparator digi: layer " << layerId.
layer() - 1
179 <<
" strip/comparator/time =" << (*digiIt);
181 if ((*digiIt).getComparator() == 0 || (*digiIt).getComparator() == 1) {
182 int bx_time = (*digiIt).getTimeBin();
183 if (bx_time >= 0 && bx_time < fifo_tbins) {
185 int latch_bx = clct_bx + drift_delay;
186 if (bx_time <= latch_bx - hit_persist || bx_time > latch_bx) {
188 LogDebug(
"lctDigis") <<
"Late comparator digi: layer " << layerId.
layer() - 1
189 <<
" strip/comparator/time =" << (*digiIt) <<
" skipping...";
195 int i_strip = (*digiIt).getStrip() - 1;
196 if (me1a && i_strip < 16) {
202 if (
time[i_strip] <= 0 ||
time[i_strip] > bx_time) {
204 int i_hfstrip = 2 * i_strip + (*digiIt).getComparator() + stagger;
205 hfstripDigis[i_hfstrip] = digi_num;
208 comp[i_strip] = (*digiIt).getComparator();
209 time[i_strip] = bx_time;
210 digiNum[i_strip] = digi_num;
213 LogDebug(
"lctDigis") <<
"digi_num = " << digi_num <<
" half-strip = " << i_hfstrip
214 <<
" strip = " << i_strip;
218 digiMap.push_back(*digiIt);
232 vector<CSCComparatorDigi> thisLayerDigis =
info.getRecDigis();
233 if (!thisLayerDigis.empty()) {
235 bool me11 = (layerId.
station() == 1) && (layerId.
ring() == 1);
238 for (edm::PSimHitContainer::const_iterator simHitIt = allSimHits->begin(); simHitIt != allSimHits->end();
242 if (hitId == layerId)
246 if (hitId == layerId_me1a)
252 ostringstream strstrm;
254 strstrm <<
"\nLayer " << layerId.
layer() <<
" has " <<
simHits.size() <<
" SimHit(s); phi value(s) = ";
258 for (vector<CSCComparatorDigi>::iterator
prd = thisLayerDigis.begin();
prd != thisLayerDigis.end();
prd++) {
259 double deltaPhiMin = 999.;
260 double bestHitPhi = 999.;
264 double digiPhi = getStripPhi(layerId,
strip - 0.5);
266 const CSCLayer* csclayer = geom_->layer(layerId);
267 for (vector<PSimHit>::iterator psh =
simHits.begin(); psh !=
simHits.end(); psh++) {
271 double hitPhi = hitGP.
phi();
273 strstrm << hitPhi <<
" ";
278 if (fabs(hitPhi - digiPhi) <
M_PI) {
282 LogDebug(
"digiSimHitAssociator") <<
"SimHit and Digi are close to edge!!!";
292 strstrm <<
"\nDigi Phi: " << digiPhi <<
", closest SimHit phi: " << bestHitPhi
295 info.addComponent(*bestHit);
298 LogTrace(
"digiSimHitAssociator") << strstrm.str();
306 double& closestEta) {
312 int nearestHS = -999;
314 bool hit_found =
false;
318 vector<CSCCathodeLayerInfo>::const_iterator pli;
319 for (pli = allLayerInfo.begin(); pli != allLayerInfo.end(); pli++) {
320 if (pli->getId().layer() == key_layer) {
321 vector<PSimHit> thisLayerHits = pli->getSimHits();
322 if (!thisLayerHits.empty()) {
325 if (thisLayerHits.size() != 1) {
327 <<
"+++ Warning: " << thisLayerHits.size() <<
" SimHits in key layer " << key_layer <<
"! +++ \n";
328 for (
unsigned i = 0;
i < thisLayerHits.size();
i++) {
329 edm::LogWarning(
"L1CSCTPEmulatorWrongValues") <<
" SimHit # " <<
i << thisLayerHits[
i] <<
"\n";
332 matchedHit = thisLayerHits[0];
333 layerId = pli->getId();
340 if (hit_found ==
false) {
341 for (pli = allLayerInfo.begin(); pli != allLayerInfo.end(); pli++) {
343 if (!(pli->getRecDigis()).
empty() && !(pli->getSimHits()).
empty()) {
345 matchedHit = (pli->getSimHits())[0];
346 layerId = pli->getId();
355 const CSCLayer* csclayer = geom_->layer(layerId);
368 int nearestStrip = static_cast<int>(
strip);
372 <<
") interval; strip = " <<
strip <<
" +++\n";
375 int comp = ((
strip - nearestStrip) < 0.5) ? 0 : 1;
376 nearestHS = 2 * nearestStrip +
comp;
379 closestPhi = thisPoint.
phi();
380 closestEta = thisPoint.
eta();
381 ostringstream strstrm;
383 strstrm <<
"Matched cathode phi: " << closestPhi;
384 if (closestPhi < 0.) {
385 closestPhi += 2. *
M_PI;
387 strstrm <<
"(" << closestPhi <<
")";
390 strstrm <<
" eta: " << closestEta <<
" on a layer " << layerId.
layer() <<
" (1-6);"
391 <<
" nearest strip: " << nearestStrip;
392 LogDebug(
"nearestHS") << strstrm.str();
408 const CSCLayer* csclayer = geom_->layer(layerId);
418 double phi = digiGP.
phi();