38 vector<CSCAnodeLayerInfo> alctInfo = lctDigis(alct, alctId, wiredc);
43 <<
"+++ Number of CSCAnodeLayerInfo objects, " << alctInfo.size()
55 vector<CSCAnodeLayerInfo>::iterator pali;
56 for (pali = alctInfo.begin(); pali != alctInfo.end(); pali++) {
57 digiSimHitAssociator(*pali, allSimHits);
71 vector<CSCAnodeLayerInfo> vectInfo;
77 int alct_bx = alct.
getBX();
80 int MESelection = (alctId.
station() < 3) ? 0 : 1;
84 <<
"\nlctDigis: ALCT keywire = " << alct_keywire <<
"; alctId:" 85 <<
" endcap " << alctId.
endcap() <<
", station " << alctId.
station()
86 <<
", ring " << alctId.
ring() <<
", chamber " << alctId.
chamber();
90 map<int, CSCWireDigi> digiMap;
100 preselectDigis(alct_bx, layerId, wiredc, digiMap);
109 preselectDigis(alct_bx, layerId_me1a, wiredc, digiMap);
120 int wire = alct_keywire +
124 if (digiMap.count(wire) > 0) {
125 tempInfo.
setId(layerId);
128 <<
" Digi on ALCT: wire group " << digiMap[wire].getWireGroup();
137 vectInfo.push_back(tempInfo);
145 map<int, CSCWireDigi>& digiMap) {
150 const int fifo_tbins = 16;
151 const int drift_delay = 2;
152 const int hit_persist = 6;
156 digiIt != rwired.second; ++digiIt) {
158 <<
"Wire digi: layer " << layerId.
layer()-1 << (*digiIt);
159 int bx_time = (*digiIt).getTimeBin();
160 if (bx_time >= 0 && bx_time < fifo_tbins) {
163 int latch_bx = alct_bx + drift_delay;
164 if (bx_time <= latch_bx-hit_persist || bx_time > latch_bx) {
166 <<
"Late wire digi: layer " << layerId.
layer()-1
167 <<
" " << (*digiIt) <<
" skipping...";
171 int i_wire = (*digiIt).getWireGroup() - 1;
175 if (digiMap.count(i_wire) > 0) {
176 if (digiMap[i_wire].getTimeBin() > bx_time) {
179 <<
" Replacing good wire digi on wire " << i_wire;
181 digiMap.erase(i_wire);
185 digiMap[i_wire] = *digiIt;
187 LogDebug(
"lctDigis") <<
" Good wire digi: wire group " << i_wire;
201 vector<CSCWireDigi> thisLayerDigis = info.
getRecDigis();
202 if (!thisLayerDigis.empty()) {
204 bool me11 = (layerId.
station() == 1) && (layerId.
ring() == 1);
207 for (edm::PSimHitContainer::const_iterator simHitIt = allSimHits->begin();
208 simHitIt != allSimHits->end(); simHitIt++) {
212 if (hitId == layerId)
213 simHits.push_back(*simHitIt);
217 if (hitId == layerId_me1a)
218 simHits.push_back(*simHitIt);
222 if (!simHits.empty()) {
223 ostringstream strstrm;
225 strstrm <<
"\nLayer " << layerId.
layer()
226 <<
" has " << simHits.size() <<
" SimHit(s); eta value(s) = ";
230 for (vector<CSCWireDigi>::const_iterator prd = thisLayerDigis.begin();
231 prd != thisLayerDigis.end(); prd++) {
232 double deltaEtaMin = 999.;
233 double bestHitEta = 999.;
236 int wiregroup = prd->getWireGroup();
237 double digiEta = getWGEta(layerId, wiregroup-1);
239 const CSCLayer* csclayer = geom_->layer(layerId);
240 for (vector <PSimHit>::iterator psh = simHits.begin();
241 psh != simHits.end(); psh++) {
245 double hitEta = hitGP.
eta();
247 strstrm << hitEta <<
" ";
249 double deltaEta = fabs(hitEta - digiEta);
250 if (deltaEta < deltaEtaMin) {
257 strstrm <<
"\nDigi eta: " << digiEta
258 <<
", closest SimHit eta: " << bestHitEta
265 LogDebug(
"digiSimHitAssociator") << strstrm.str();
272 const vector<CSCAnodeLayerInfo>& allLayerInfo,
273 double& closestPhi,
double& closestEta) {
279 int nearestWG = -999;
281 bool hit_found =
false;
284 vector<CSCAnodeLayerInfo>::const_iterator pli;
285 for (pli = allLayerInfo.begin(); pli != allLayerInfo.end(); pli++) {
288 vector<PSimHit> thisLayerHits = pli->getSimHits();
289 if (thisLayerHits.size() > 0) {
292 if (thisLayerHits.size() != 1) {
294 <<
"+++ Warning: " << thisLayerHits.size()
297 for (
unsigned i = 0;
i < thisLayerHits.size();
i++) {
299 <<
" SimHit # " <<
i << thisLayerHits[
i] <<
"\n";
302 matchedHit = thisLayerHits[0];
303 layerId = pli->getId();
311 for (pli = allLayerInfo.begin(); pli != allLayerInfo.end(); pli++) {
313 if ((pli->getRecDigis()).
size() > 0 && (pli->getSimHits()).
size() > 0) {
315 vector<PSimHit> thisLayerHits = pli->getSimHits();
316 matchedHit = thisLayerHits[0];
317 layerId = pli->getId();
326 const CSCLayer* csclayer = geom_->layer(layerId);
329 nearestWG = layerGeom->
wireGroup(nearestW);
335 <<
"+++ Warning: nearest wire group, " << nearestWG
337 <<
") interval +++\n";
341 closestPhi = thisPoint.
phi();
342 closestEta = thisPoint.
eta();
343 ostringstream strstrm;
345 strstrm <<
"Matched anode phi: " << closestPhi;
346 if (closestPhi < 0.) {
347 closestPhi += 2.*
M_PI;
349 strstrm <<
" (" << closestPhi <<
")";
352 strstrm <<
" eta: " << closestEta
353 <<
" on a layer " << layerId.
layer() <<
" (1-6);" 354 <<
" nearest wire group: " << nearestWG;
355 LogDebug(
"nearestWG") << strstrm.str();
367 const int wiregroup) {
371 <<
"+++ Warning: wire group, " << wiregroup
373 <<
") interval +++\n";
376 const CSCLayer* csclayer = geom_->layer(layerId);
384 double eta = digiGP.
eta();
int nearestWire(const LocalPoint &lp) const
std::vector< TYPE > getRecDigis() const
void digiSimHitAssociator(CSCAnodeLayerInfo &info, const edm::PSimHitContainer *allSimHits)
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Geom::Phi< T > phi() const
int nearestWG(const std::vector< CSCAnodeLayerInfo > &allLayerInfo, double &closestPhi, double &closestEta)
void addComponent(const TYPE digi)
std::vector< CSCAnodeLayerInfo > getSimInfo(const CSCALCTDigi &alct, const CSCDetId &alctId, const CSCWireDigiCollection *wiredc, const edm::PSimHitContainer *allSimHits)
static const double deltaEta
int wireGroup(int wire) const
static const int pattern_envelope[CSCConstants::NUM_ALCT_PATTERNS][CSCConstants::MAX_WIRES_IN_PATTERN]
void preselectDigis(const int alct_bx, const CSCDetId &layerId, const CSCWireDigiCollection *wiredc, std::map< int, CSCWireDigi > &digiMap)
Local3DPoint localPosition() const
double getWGEta(const CSCDetId &layerId, const int wiregroup)
int getBX() const
return BX - five low bits of BXN counter tagged by the ALCT
LocalPoint localCenterOfWireGroup(int wireGroup) const
static const int pattern_mask_open[CSCConstants::NUM_ALCT_PATTERNS][CSCConstants::MAX_WIRES_IN_PATTERN]
void setId(const CSCDetId id)
void setGeometry(const CSCGeometry *geom)
int getAccelerator() const
std::vector< CSCAnodeLayerInfo > lctDigis(const CSCALCTDigi &alct, const CSCDetId &alctId, const CSCWireDigiCollection *wiredc)
std::vector< DigiType >::const_iterator const_iterator
std::pair< const_iterator, const_iterator > Range
std::vector< PSimHit > PSimHitContainer
int getKeyWG() const
return key wire group
const CSCLayerGeometry * geometry() const
int getCollisionB() const