2950 map<CSCDetId, float> segment_median_map;
2951 map<CSCDetId, GlobalPoint> segment_position_map;
2961 LocalPoint localPos = (*dSiter).localPosition();
2965 globalPosition = cscchamber->
toGlobal(localPos);
2969 std::vector<CSCRecHit2D> theseRecHits = (*dSiter).specificRecHits();
2970 int nRH = (*dSiter).nRecHits();
2975 vector<float> non_zero;
2977 for (vector<CSCRecHit2D>::const_iterator iRH = theseRecHits.begin(); iRH != theseRecHits.end(); iRH++) {
2978 non_zero.push_back(iRH->tpeak());
2983 sort(non_zero.begin(), non_zero.end());
2984 int middle_index = non_zero.size() / 2;
2985 float average_two = (non_zero.at(middle_index - 1) + non_zero.at(middle_index)) / 2.;
2986 if (non_zero.size() % 2)
2987 average_two = non_zero.at(middle_index);
2990 segment_median_map[
id] = average_two;
2991 segment_position_map[
id] = globalPosition;
2993 double distToIP =
sqrt(globalPosition.
x() * globalPosition.
x() + globalPosition.
y() * globalPosition.
y() +
2994 globalPosition.
z() * globalPosition.
z());
2999 "Segment mean time",
3008 "timeChamberByType",
3009 "Segment mean time by chamber",
3019 "seg_time_vs_distToIP",
3020 "Segment time vs. Distance to IP",
3030 "seg_time_vs_globZ",
3031 "Segment time vs. z position",
3041 "seg_time_vs_absglobZ",
3042 "Segment time vs. abs(z position)",
3054 map<CSCDetId, float>::const_iterator it_outer;
3055 map<CSCDetId, float>::const_iterator it_inner;
3056 for (it_outer = segment_median_map.begin(); it_outer != segment_median_map.end(); it_outer++) {
3057 CSCDetId id_outer = it_outer->first;
3058 float t_outer = it_outer->second;
3061 for (it_inner = segment_median_map.begin(); it_inner != segment_median_map.end(); it_inner++) {
3062 CSCDetId id_inner = it_inner->first;
3063 float t_inner = it_inner->second;
3079 id_outer.
ring() == id_inner.
ring()) {
3081 "diff_opposite_endcaps",
3082 "#Delta t [ME+]-[ME-] for chambers in same station and ring",
3088 "diff_opposite_endcaps_byType",
3089 "#Delta t [ME+]-[ME-] for chambers in same station and ring",
3105 vector<L1MuGMTReadoutRecord> L1Mrec = pCollection->
getRecords();
3106 vector<L1MuGMTReadoutRecord>::const_iterator igmtrr;
3107 int L1GMT_BXN = -100;
3108 bool has_CSCTrigger =
false;
3109 bool has_beamHaloTrigger =
false;
3110 for (igmtrr = L1Mrec.begin(); igmtrr != L1Mrec.end(); igmtrr++) {
3111 std::vector<L1MuRegionalCand>::const_iterator iter1;
3112 std::vector<L1MuRegionalCand> rmc;
3115 rmc = igmtrr->getCSCCands();
3116 for (iter1 = rmc.begin(); iter1 != rmc.end(); iter1++) {
3117 if (!(*iter1).empty()) {
3119 int kQuality = (*iter1).quality();
3121 has_beamHaloTrigger =
true;
3124 if (igmtrr->getBxInEvent() == 0 && icsc > 0) {
3126 L1GMT_BXN = igmtrr->getBxNr();
3127 has_CSCTrigger =
true;
3128 }
else if (igmtrr->getBxInEvent() == 0) {
3130 L1GMT_BXN = igmtrr->getBxNr();
3139 map<CSCDetId, int> ALCT_KeyWG_map;
3142 const CSCDetId& idALCT = (*j).first;
3145 if ((*digiIt).isValid()) {
3147 histos->
fill1DHist((*digiIt).getBX(),
"ALCT_getBX",
"ALCT.getBX()", 11, -0.5, 10.5,
"TimeMonitoring");
3149 (*digiIt).getFullBX(),
"ALCT_getFullBX",
"ALCT.getFullBX()", 3601, -0.5, 3600.5,
"TimeMonitoring");
3151 if (ALCT_KeyWG_map.find(idALCT.
chamberId()) == ALCT_KeyWG_map.end()) {
3152 ALCT_KeyWG_map[idALCT.
chamberId()] = (*digiIt).getKeyWG();
3163 map<CSCDetId, int> CLCT_getFullBx_map;
3166 const CSCDetId& idCLCT = (*j).first;
3169 if ((*digiIt).isValid()) {
3171 histos->
fill1DHist((*digiIt).getBX(),
"CLCT_getBX",
"CLCT.getBX()", 11, -0.5, 10.5,
"TimeMonitoring");
3173 (*digiIt).getFullBX(),
"CLCT_getFullBX",
"CLCT.getFullBX()", 3601, -0.5, 3600.5,
"TimeMonitoring");
3175 if (CLCT_getFullBx_map.find(idCLCT.
chamberId()) == CLCT_getFullBx_map.end()) {
3176 CLCT_getFullBx_map[idCLCT.
chamberId()] = (*digiIt).getFullBX();
3186 int n_correlatedlcts = 0;
3190 if ((*digiIt).isValid()) {
3193 (*digiIt).getBX(),
"CorrelatedLCTS_getBX",
"CorrelatedLCT.getBX()", 11, -0.5, 10.5,
"TimeMonitoring");
3198 int nRecHits = recHits->size();
3199 int nSegments = cscSegments->size();
3200 if (has_CSCTrigger) {
3201 histos->
fill1DHist(L1GMT_BXN,
"BX_L1CSCCand",
"BX of L1 CSC Cand", 4001, -0.5, 4000.5,
"TimeMonitoring");
3204 "n_ALCTs_v_BX_L1CSCCand",
3205 "Number of ALCTs vs. BX of L1 CSC Cand",
3215 "n_CLCTs_v_BX_L1CSCCand",
3216 "Number of CLCTs vs. BX of L1 CSC Cand",
3226 "n_CorrelatedLCTs_v_BX_L1CSCCand",
3227 "Number of CorrelatedLCTs vs. BX of L1 CSC Cand",
3237 "n_RecHits_v_BX_L1CSCCand",
3238 "Number of RecHits vs. BX of L1 CSC Cand",
3248 "n_Segments_v_BX_L1CSCCand",
3249 "Number of Segments vs. BX of L1 CSC Cand",
3258 if (has_CSCTrigger && has_beamHaloTrigger) {
3260 L1GMT_BXN,
"BX_L1CSCCand_w_beamHalo",
"BX of L1 CSC (w beamHalo bit)", 4001, -0.5, 4000.5,
"TimeMonitoring");
3263 "n_ALCTs_v_BX_L1CSCCand_w_beamHalo",
3264 "Number of ALCTs vs. BX of L1 CSC Cand (w beamHalo bit)",
3274 "n_CLCTs_v_BX_L1CSCCand_w_beamHalo",
3275 "Number of CLCTs vs. BX of L1 CSC Cand (w beamHalo bit)",
3285 "n_CorrelatedLCTs_v_BX_L1CSCCand_w_beamHalo",
3286 "Number of CorrelatedLCTs vs. BX of L1 CSC Cand (w beamHalo bit)",
3296 "n_RecHits_v_BX_L1CSCCand_w_beamHalo",
3297 "Number of RecHits vs. BX of L1 CSC Cand (w beamHalo bit)",
3307 "n_Segments_v_BX_L1CSCCand_w_beamHalo",
3308 "Number of Segments vs. BX of L1 CSC Cand (w beamHalo bit)",
3330 event.getByToken(
rd_token, rawdata);
3331 bool goodEvent =
false;
3335 unsigned long dccBinCheckMask = 0x06080016;
3336 unsigned int examinerMask = 0x1FEBF3F6;
3337 unsigned int errorMask = 0x0;
3346 unsigned long length = fedData.
size();
3350 std::stringstream examiner_out, examiner_err;
3355 if (examinerMask & 0x40000)
3357 if (examinerMask & 0x8000)
3359 if (examinerMask & 0x0400)
3361 examiner->
setMask(examinerMask);
3362 const short unsigned int*
data = (
short unsigned int*)fedData.
data();
3364 if (examiner->
check(data,
long(fedData.
size() / 2)) < 0) {
3367 goodEvent = !(examiner->
errors() & dccBinCheckMask);
3376 const std::vector<CSCDDUEventData>& dduData = dccData.
dduData();
3381 for (
unsigned int iDDU = 0; iDDU < dduData.size(); ++iDDU) {
3384 if (dduData[iDDU].trailer().errorstat() & errorMask) {
3385 LogTrace(
"CSCDCCUnpacker|CSCRawToDigi") <<
"DDU# " << iDDU <<
" has serious error - no digis unpacked! " 3386 << std::hex << dduData[iDDU].trailer().errorstat();
3391 const std::vector<CSCEventData>& cscData = dduData[iDDU].cscData();
3392 for (
unsigned int iCSC = 0; iCSC < cscData.size(); ++iCSC) {
3394 int vmecrate = cscData[iCSC].dmbHeader()->crateID();
3395 int dmb = cscData[iCSC].dmbHeader()->dmbID();
3403 if ((vmecrate >= 1) && (vmecrate <= 60) && (dmb >= 1) && (dmb <= 10) && (dmb != 6)) {
3404 layer = pcrate->
detId(vmecrate, dmb, icfeb, ilayer);
3406 LogTrace(
"CSCTimingAlignment|CSCDCCUnpacker|CSCRawToDigi") <<
" detID input out of range!!! ";
3407 LogTrace(
"CSCTimingAlignment|CSCDCCUnpacker|CSCRawToDigi")
3408 <<
" skipping chamber vme= " << vmecrate <<
" dmb= " << dmb;
3413 int nalct = cscData[iCSC].dmbHeader()->nalct();
3414 bool goodALCT =
false;
3416 if (nalct && cscData[iCSC].alctHeader()) {
3417 if (cscData[iCSC].alctHeader()->
check()) {
3423 int nclct = cscData[iCSC].dmbHeader()->nclct();
3424 bool goodTMB =
false;
3425 if (nclct && cscData[iCSC].tmbData()) {
3426 if (cscData[iCSC].tmbHeader()->
check()) {
3427 if (cscData[iCSC].clctData()->
check())
3432 if (goodTMB && goodALCT) {
3433 if (ALCT_KeyWG_map.find(layer) == ALCT_KeyWG_map.end()) {
3434 printf(
"no ALCT info for Chamber %d %d %d %d \n",
3441 if (CLCT_getFullBx_map.find(layer) == CLCT_getFullBx_map.end()) {
3442 printf(
"no CLCT info for Chamber %d %d %d %d \n",
3449 int ALCT0Key = ALCT_KeyWG_map.find(layer)->second;
3450 int CLCTPretrigger = CLCT_getFullBx_map.find(layer)->second;
3452 const CSCTMBHeader* tmbHead = cscData[iCSC].tmbHeader();
3463 "TMB_ALCTMatchTime",
3464 "TMB_ALCTMatchTime",
3472 tmbHead->
BXNCount(),
"TMB_BXNCount",
"TMB_BXNCount", 3601, -0.5, 3600.5,
"TimeMonitoring");
3474 tmbHead->
ALCTMatchTime(),
"TMB_ALCTMatchTime",
"TMB_ALCTMatchTime", 7, -0.5, 6.5,
"TimeMonitoring");
3477 "TMB_ALCTMatchTime",
3478 "TMB_ALCTMatchTime",
3487 "prof_TMB_ALCTMatchTime",
3488 "prof_TMB_ALCTMatchTime",
3497 "prof_TMB_ALCTMatchTime_v_ALCT0KeyWG",
3498 "prof_TMB_ALCTMatchTime_v_ALCT0KeyWG",
3507 "prf_TMB_ALCTMatchTime_v_ALCT0KeyWG",
3508 "prf_TMB_ALCTMatchTime_v_ALCT0KeyWG",
3520 if (TMB_ALCT_rel_L1A > 3563)
3521 TMB_ALCT_rel_L1A = TMB_ALCT_rel_L1A - 3564;
3522 if (TMB_ALCT_rel_L1A < 0)
3523 TMB_ALCT_rel_L1A = TMB_ALCT_rel_L1A + 3564;
3527 TMB_ALCT_rel_L1A,
"h1D_TMB_ALCT_rel_L1A",
"h1D_TMB_ALCT_rel_L1A", 11, 144.5, 155.5,
"TimeMonitoring");
3530 "h2D_TMB_ALCT_rel_L1A",
3531 "h2D_TMB_ALCT_rel_L1A",
3541 "h2D_TMB_ALCT_rel_L1A_by_ring",
3542 "h2D_TMB_ALCT_rel_L1A_by_ring",
3552 "prof_TMB_ALCT_rel_L1A",
3553 "prof_TMB_ALCT_rel_L1A",
3562 "prof_TMB_ALCT_rel_L1A_by_ring",
3563 "prof_TMB_ALCT_rel_L1A_by_ring",
3573 "h2D_TMB_ALCT_rel_L1A_v_ALCT0KeyWG",
3574 "h2D_TMB_ALCT_rel_L1A_v_ALCT0KeyWG",
3584 "prof_TMB_ALCT_rel_L1A_v_ALCT0KeyWG",
3585 "prof_TMB_ALCT_rel_L1A_v_ALCT0KeyWG",
3594 "prf_TMB_ALCT_rel_L1A_v_ALCT0KeyWG",
3595 "prf_TMB_ALCT_rel_L1A_v_ALCT0KeyWG",
3608 if (examiner !=
nullptr)
void crcCFEB(bool enable)
void fillProfileByType(float x, float y, std::string name, std::string title, CSCDetId id, int binsx, float xmin, float xmax, float ymin, float ymax, std::string folder)
CSCDetId detId(int vme, int dmb, int cfeb, int layer=0) const
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Global3DPoint GlobalPoint
void fillProfile(float x, float y, std::string name, std::string title, int binsx, float xmin, float xmax, float ymin, float ymax, std::string folder)
const std::vector< CSCDDUEventData > & dduData() const
accessor to dduData
ExaminerStatusType errors(void) const
void crcALCT(bool enable)
void fill1DHist(float x, std::string name, std::string title, int bins, float xmin, float xmax, std::string folder)
size_t size() const
Lenght of the data buffer in bytes.
C::const_iterator const_iterator
constant access iterator type
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
int ringSerial(CSCDetId id)
CSCDetId chamberId() const
void fill1DHistByType(float x, std::string name, std::string title, CSCDetId id, int bins, float xmin, float xmax, std::string folder)
void fill1DHistByStation(float x, std::string name, std::string title, CSCDetId id, int bins, float xmin, float xmax, std::string folder)
void fill2DHist(float x, float y, std::string name, std::string title, int binsx, float xmin, float xmax, int binsy, float ymin, float ymax, std::string folder)
const CSCChamber * chamber(CSCDetId id) const
Return the chamber corresponding to given DetId.
std::pair< const_iterator, const_iterator > Range
std::vector< DigiType >::const_iterator const_iterator
int32_t check(const uint16_t *&buffer, int32_t length)
char data[epos_bytes_allocation]
int chamberSerial(CSCDetId id)
std::vector< L1MuGMTReadoutRecord > const & getRecords() const
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
T const * product() const
edm::EDGetTokenT< FEDRawDataCollection > rd_token
void setMask(ExaminerMaskType mask)