25 vector<CSCAnodeLayerInfo> alctInfo = lctDigis(alct, alctId, wiredc);
29 throw cms::Exception(
"CSCAnodeLCTAnalyzer") <<
"+++ Number of CSCAnodeLayerInfo objects, " << alctInfo.size()
41 vector<CSCAnodeLayerInfo>::iterator pali;
42 for (pali = alctInfo.begin(); pali != alctInfo.end(); pali++) {
43 digiSimHitAssociator(*pali, allSimHits);
57 vector<CSCAnodeLayerInfo> vectInfo;
64 int alct_bx = alct.
getBX();
67 int MESelection = (alctId.
station() < 3) ? 0 : 1;
70 LogDebug(
"lctDigis") <<
"\nlctDigis: ALCT keywire = " << alct_keywire <<
"; alctId:"
71 <<
" endcap " << alctId.
endcap() <<
", station " << alctId.
station() <<
", ring "
72 << alctId.
ring() <<
", chamber " << alctId.
chamber();
76 map<int, CSCWireDigi> digiMap;
85 preselectDigis(alct_bx, layerId, wiredc, digiMap);
93 preselectDigis(alct_bx, layerId_me1a, wiredc, digiMap);
105 if (digiMap.count(wire) > 0) {
106 tempInfo.
setId(layerId);
109 LogDebug(
"lctDigis") <<
" Digi on ALCT: wire group " << digiMap[wire].getWireGroup();
118 vectInfo.push_back(tempInfo);
127 map<int, CSCWireDigi>& digiMap) {
132 const int fifo_tbins = 16;
133 const int drift_delay = 2;
134 const int hit_persist = 6;
139 LogDebug(
"lctDigis") <<
"Wire digi: layer " << layerId.
layer() - 1 << (*digiIt);
140 int bx_time = (*digiIt).getTimeBin();
141 if (bx_time >= 0 && bx_time < fifo_tbins) {
143 int latch_bx = alct_bx + drift_delay;
144 if (bx_time <= latch_bx - hit_persist || bx_time > latch_bx) {
146 LogDebug(
"lctDigis") <<
"Late wire digi: layer " << layerId.
layer() - 1 <<
" " << (*digiIt) <<
" skipping...";
150 int i_wire = (*digiIt).getWireGroup() - 1;
154 if (digiMap.count(i_wire) > 0) {
155 if (digiMap[i_wire].getTimeBin() > bx_time) {
157 LogDebug(
"lctDigis") <<
" Replacing good wire digi on wire " << i_wire;
159 digiMap.erase(i_wire);
163 digiMap[i_wire] = *digiIt;
165 LogDebug(
"lctDigis") <<
" Good wire digi: wire group " << i_wire;
178 vector<CSCWireDigi> thisLayerDigis =
info.getRecDigis();
179 if (!thisLayerDigis.empty()) {
181 bool me11 = (layerId.
station() == 1) && (layerId.
ring() == 1);
184 for (edm::PSimHitContainer::const_iterator simHitIt = allSimHits->begin(); simHitIt != allSimHits->end();
188 if (hitId == layerId)
192 if (hitId == layerId_me1a)
198 ostringstream strstrm;
200 strstrm <<
"\nLayer " << layerId.
layer() <<
" has " <<
simHits.size() <<
" SimHit(s); eta value(s) = ";
204 for (vector<CSCWireDigi>::const_iterator
prd = thisLayerDigis.begin();
prd != thisLayerDigis.end();
prd++) {
205 double deltaEtaMin = 999.;
206 double bestHitEta = 999.;
209 int wiregroup =
prd->getWireGroup();
210 double digiEta = getWGEta(layerId, wiregroup - 1);
212 const CSCLayer* csclayer = geom_->layer(layerId);
213 for (vector<PSimHit>::iterator psh =
simHits.begin(); psh !=
simHits.end(); psh++) {
217 double hitEta = hitGP.
eta();
219 strstrm << hitEta <<
" ";
221 double deltaEta = fabs(hitEta - digiEta);
229 strstrm <<
"\nDigi eta: " << digiEta <<
", closest SimHit eta: " << bestHitEta
233 info.addComponent(*bestHit);
236 LogDebug(
"digiSimHitAssociator") << strstrm.str();
244 double& closestEta) {
250 int nearestWG = -999;
252 bool hit_found =
false;
255 vector<CSCAnodeLayerInfo>::const_iterator pli;
256 for (pli = allLayerInfo.begin(); pli != allLayerInfo.end(); pli++) {
259 vector<PSimHit> thisLayerHits = pli->getSimHits();
260 if (!thisLayerHits.empty()) {
263 if (thisLayerHits.size() != 1) {
267 for (
unsigned i = 0;
i < thisLayerHits.size();
i++) {
268 edm::LogWarning(
"L1CSCTPEmulatorWrongValues") <<
" SimHit # " <<
i << thisLayerHits[
i] <<
"\n";
271 matchedHit = thisLayerHits[0];
272 layerId = pli->getId();
280 for (pli = allLayerInfo.begin(); pli != allLayerInfo.end(); pli++) {
282 if (!(pli->getRecDigis()).
empty() && !(pli->getSimHits()).
empty()) {
284 vector<PSimHit> thisLayerHits = pli->getSimHits();
285 matchedHit = thisLayerHits[0];
286 layerId = pli->getId();
295 const CSCLayer* csclayer = geom_->layer(layerId);
298 nearestWG = layerGeom->
wireGroup(nearestW);
305 <<
") interval +++\n";
309 closestPhi = thisPoint.
phi();
310 closestEta = thisPoint.
eta();
311 ostringstream strstrm;
313 strstrm <<
"Matched anode phi: " << closestPhi;
314 if (closestPhi < 0.) {
315 closestPhi += 2. *
M_PI;
317 strstrm <<
" (" << closestPhi <<
")";
320 strstrm <<
" eta: " << closestEta <<
" on a layer " << layerId.
layer() <<
" (1-6);"
321 <<
" nearest wire group: " << nearestWG;
322 LogDebug(
"nearestWG") << strstrm.str();
334 edm::LogWarning(
"L1CSCTPEmulatorWrongInput") <<
"+++ Warning: wire group, " << wiregroup <<
", is not in [0-"
338 const CSCLayer* csclayer = geom_->layer(layerId);
346 double eta = digiGP.
eta();