Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:30:54

0001 #include "SimTracker/Common/interface/SimHitSelectorFromDB.h"
0002 
0003 SimHitSelectorFromDB::SimHitSelectorFromDB() : theNewSimHitList(0) {}
0004 
0005 // std::vector<PSimHit>
0006 // SimHitSelectorFromDB::getSimHit(std::unique_ptr<MixCollection<PSimHit> >&
0007 // simhit,
0008 std::vector<std::pair<const PSimHit *, int>> SimHitSelectorFromDB::getSimHit(
0009     std::unique_ptr<MixCollection<PSimHit>> &simhit, std::map<uint32_t, std::vector<int>> &detId) {
0010   theNewSimHitList.clear();
0011   int counter = 0;
0012   for (MixCollection<PSimHit>::iterator it = simhit->begin(); it != simhit->end(); it++) {
0013     counter++;
0014     if (!detId.empty()) {
0015       uint32_t tkid = (*it).detUnitId();
0016       if (detId.find(tkid) != detId.end()) {
0017         //  theNewSimHitList.push_back((*it));
0018         //  std::cout << "Hit in the MAP " << counter << std::endl;
0019         theNewSimHitList.push_back(std::make_pair(&(*it), counter));
0020       }
0021     } else {
0022       //      theNewSimHitList.push_back((*it));
0023       //      std::cout << "Hit NOT in the MAP " << counter << std::endl;
0024       theNewSimHitList.push_back(std::make_pair(&(*it), counter));
0025     }
0026   }
0027   return theNewSimHitList;
0028 }