Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-08-26 03:15:53

0001 #include "DataFormats/CSCDigi/interface/CSCConstants.h"
0002 #include "EventFilter/CSCRawToDigi/interface/CSCDigiToRawAccept.h"
0003 
0004 CSCDetId CSCDigiToRawAccept::chamberID(const CSCDetId& cscDetId) {
0005   CSCDetId chamberId = cscDetId.chamberId();
0006   if (chamberId.ring() == 4) {
0007     chamberId = CSCDetId(chamberId.endcap(), chamberId.station(), 1, chamberId.chamber(), 0);
0008   }
0009   return chamberId;
0010 }
0011 
0012 // older function for pretriggers BX objects
0013 bool CSCDigiToRawAccept::accept(
0014     const CSCDetId& cscId, const CSCCLCTPreTriggerCollection& lcts, int bxMin, int bxMax, int nominalBX) {
0015   if (bxMin == -999)
0016     return true;
0017   CSCDetId chamberId = chamberID(cscId);
0018   CSCCLCTPreTriggerCollection::Range lctRange = lcts.get(chamberId);
0019   bool result = false;
0020   for (CSCCLCTPreTriggerCollection::const_iterator lctItr = lctRange.first; lctItr != lctRange.second; ++lctItr) {
0021     int bx = *lctItr - nominalBX;
0022     if (bx >= bxMin && bx <= bxMax) {
0023       result = true;
0024       break;
0025     }
0026   }
0027   return result;
0028 }
0029 
0030 bool CSCDigiToRawAccept::accept(const CSCDetId& cscId,
0031                                 const CSCCLCTPreTriggerDigiCollection& lcts,
0032                                 int bxMin,
0033                                 int bxMax,
0034                                 int nominalBX,
0035                                 std::vector<bool>& preTriggerInCFEB) {
0036   if (bxMin == -999)
0037     return true;
0038 
0039   bool atLeastOnePreTrigger = false;
0040 
0041   CSCDetId chamberId = chamberID(cscId);
0042   CSCCLCTPreTriggerDigiCollection::Range lctRange = lcts.get(chamberId);
0043   for (CSCCLCTPreTriggerDigiCollection::const_iterator lctItr = lctRange.first; lctItr != lctRange.second; ++lctItr) {
0044     int bx = lctItr->getBX() - nominalBX;
0045     if (bx >= bxMin && bx <= bxMax) {
0046       atLeastOnePreTrigger = true;
0047       // save the location of all pretriggers
0048       preTriggerInCFEB[lctItr->getCFEB()] = true;
0049     }
0050   }
0051   return atLeastOnePreTrigger;
0052 }