2648 map<CSCDetId, float > segment_median_map;
2649 map<CSCDetId, GlobalPoint > segment_position_map;
2659 LocalPoint localPos = (*dSiter).localPosition();
2663 globalPosition = cscchamber->
toGlobal(localPos);
2667 std::vector<CSCRecHit2D> theseRecHits = (*dSiter).specificRecHits();
2668 int nRH = (*dSiter).nRecHits();
2669 if (nRH < 4 )
continue;
2672 vector<float> non_zero;
2674 for ( vector<CSCRecHit2D>::const_iterator iRH = theseRecHits.begin(); iRH != theseRecHits.end(); iRH++) {
2675 non_zero.push_back( iRH->tpeak());
2680 sort(non_zero.begin(),non_zero.end());
2681 int middle_index = non_zero.size()/2;
2682 float average_two = (non_zero.at(middle_index-1) + non_zero.at(middle_index))/2.;
2683 if(non_zero.size()%2)
2684 average_two = non_zero.at(middle_index);
2687 segment_median_map[
id]=average_two;
2688 segment_position_map[
id]=globalPosition;
2690 double distToIP =
sqrt(globalPosition.
x()*globalPosition.
x()+globalPosition.
y()*globalPosition.
y()+globalPosition.
z()*globalPosition.
z());
2693 histos->
fillProfileByType(
id.
chamber(),average_two,
"timeChamberByType",
"Segment mean time by chamber",
id,36,0.5,36.5,-400,400.,
"TimeMonitoring");
2694 histos->
fill2DHist(distToIP,average_two,
"seg_time_vs_distToIP",
"Segment time vs. Distance to IP",80,600.,1400.,800,-400,400.,
"TimeMonitoring");
2695 histos->
fill2DHist(globalPosition.
z(),average_two,
"seg_time_vs_globZ",
"Segment time vs. z position",240,-1200,1200,800,-400.,400.,
"TimeMonitoring");
2696 histos->
fill2DHist(fabs(globalPosition.
z()),average_two,
"seg_time_vs_absglobZ",
"Segment time vs. abs(z position)",120,0.,1200.,800,-400.,400.,
"TimeMonitoring");
2701 map<CSCDetId, float >::const_iterator it_outer;
2702 map<CSCDetId, float >::const_iterator it_inner;
2703 for (it_outer = segment_median_map.begin(); it_outer != segment_median_map.end(); it_outer++){
2705 CSCDetId id_outer = it_outer->first;
2706 float t_outer = it_outer->second;
2709 for (it_inner = segment_median_map.begin(); it_inner != segment_median_map.end(); it_inner++){
2711 CSCDetId id_inner = it_inner->first;
2712 float t_inner = it_inner->second;
2727 histos->
fill1DHist(t_outer-t_inner,
"diff_opposite_endcaps",
"#Delta t [ME+]-[ME-] for chambers in same station and ring",800,-400.,400.,
"TimeMonitoring");
2728 histos->
fill1DHistByType(t_outer-t_inner,
"diff_opposite_endcaps_byType",
"#Delta t [ME+]-[ME-] for chambers in same station and ring",id_outer,800,-400.,400.,
"TimeMonitoring");
2738 vector<L1MuGMTReadoutRecord> L1Mrec = pCollection->
getRecords();
2739 vector<L1MuGMTReadoutRecord>::const_iterator igmtrr;
2740 int L1GMT_BXN = -100;
2741 bool has_CSCTrigger =
false;
2742 bool has_beamHaloTrigger =
false;
2743 for(igmtrr=L1Mrec.begin(); igmtrr!=L1Mrec.end(); igmtrr++) {
2744 std::vector<L1MuRegionalCand>::const_iterator iter1;
2745 std::vector<L1MuRegionalCand> rmc;
2748 rmc = igmtrr->getCSCCands();
2749 for(iter1=rmc.begin(); iter1!=rmc.end(); iter1++) {
2750 if ( !(*iter1).empty() ) {
2752 int kQuality = (*iter1).quality();
2753 if (kQuality == 1) has_beamHaloTrigger =
true;
2756 if (igmtrr->getBxInEvent() == 0 && icsc>0){
2758 L1GMT_BXN = igmtrr->getBxNr();
2759 has_CSCTrigger =
true;
2761 else if (igmtrr->getBxInEvent() == 0 ) {
2763 L1GMT_BXN = igmtrr->getBxNr();
2772 map<CSCDetId, int > ALCT_KeyWG_map;
2775 const CSCDetId& idALCT = (*j).first;
2778 if((*digiIt).isValid()){
2780 histos->
fill1DHist( (*digiIt).getBX(),
"ALCT_getBX",
"ALCT.getBX()",11,-0.5,10.5,
"TimeMonitoring");
2781 histos->
fill1DHist( (*digiIt).getFullBX(),
"ALCT_getFullBX",
"ALCT.getFullBX()",3601,-0.5,3600.5,
"TimeMonitoring");
2783 if (ALCT_KeyWG_map.find(idALCT.
chamberId()) == ALCT_KeyWG_map.end()){
2784 ALCT_KeyWG_map[idALCT.
chamberId()] = (*digiIt).getKeyWG();
2796 map<CSCDetId, int > CLCT_getFullBx_map;
2799 const CSCDetId& idCLCT = (*j).first;
2802 if((*digiIt).isValid()){
2804 histos->
fill1DHist( (*digiIt).getBX(),
"CLCT_getBX",
"CLCT.getBX()",11,-0.5,10.5,
"TimeMonitoring");
2805 histos->
fill1DHist( (*digiIt).getFullBX(),
"CLCT_getFullBX",
"CLCT.getFullBX()",3601,-0.5,3600.5,
"TimeMonitoring");
2807 if (CLCT_getFullBx_map.find(idCLCT.
chamberId()) == CLCT_getFullBx_map.end()){
2808 CLCT_getFullBx_map[idCLCT.
chamberId()] = (*digiIt).getFullBX();
2818 int n_correlatedlcts = 0;
2822 if((*digiIt).isValid()){
2824 histos->
fill1DHist( (*digiIt).getBX(),
"CorrelatedLCTS_getBX",
"CorrelatedLCT.getBX()",11,-0.5,10.5,
"TimeMonitoring");
2830 int nRecHits = recHits->size();
2831 int nSegments = cscSegments->size();
2832 if (has_CSCTrigger){
2833 histos->
fill1DHist(L1GMT_BXN,
"BX_L1CSCCand",
"BX of L1 CSC Cand",4001,-0.5,4000.5,
"TimeMonitoring");
2834 histos->
fill2DHist(L1GMT_BXN,n_alcts,
"n_ALCTs_v_BX_L1CSCCand",
"Number of ALCTs vs. BX of L1 CSC Cand",4001,-0.5,4000.5,51,-0.5,50.5,
"TimeMonitoring");
2835 histos->
fill2DHist(L1GMT_BXN,n_clcts,
"n_CLCTs_v_BX_L1CSCCand",
"Number of CLCTs vs. BX of L1 CSC Cand",4001,-0.5,4000.5,51,-0.5,50.5,
"TimeMonitoring");
2836 histos->
fill2DHist(L1GMT_BXN,n_correlatedlcts,
"n_CorrelatedLCTs_v_BX_L1CSCCand",
"Number of CorrelatedLCTs vs. BX of L1 CSC Cand",4001,-0.5,4000.5,51,-0.5,50.5,
"TimeMonitoring");
2837 histos->
fill2DHist(L1GMT_BXN,nRecHits,
"n_RecHits_v_BX_L1CSCCand",
"Number of RecHits vs. BX of L1 CSC Cand",4001,-0.5,4000.5,101,-0.5,100.5,
"TimeMonitoring");
2838 histos->
fill2DHist(L1GMT_BXN,nSegments,
"n_Segments_v_BX_L1CSCCand",
"Number of Segments vs. BX of L1 CSC Cand",4001,-0.5,4000.5,51,-0.5,50.5,
"TimeMonitoring");
2840 if (has_CSCTrigger && has_beamHaloTrigger){
2841 histos->
fill1DHist(L1GMT_BXN,
"BX_L1CSCCand_w_beamHalo",
"BX of L1 CSC (w beamHalo bit)",4001,-0.5,4000.5,
"TimeMonitoring");
2842 histos->
fill2DHist(L1GMT_BXN,n_alcts,
"n_ALCTs_v_BX_L1CSCCand_w_beamHalo",
"Number of ALCTs vs. BX of L1 CSC Cand (w beamHalo bit)",4001,-0.5,4000.5,51,-0.5,50.5,
"TimeMonitoring");
2843 histos->
fill2DHist(L1GMT_BXN,n_clcts,
"n_CLCTs_v_BX_L1CSCCand_w_beamHalo",
"Number of CLCTs vs. BX of L1 CSC Cand (w beamHalo bit)",4001,-0.5,4000.5,51,-0.5,50.5,
"TimeMonitoring");
2844 histos->
fill2DHist(L1GMT_BXN,n_correlatedlcts,
"n_CorrelatedLCTs_v_BX_L1CSCCand_w_beamHalo",
"Number of CorrelatedLCTs vs. BX of L1 CSC Cand (w beamHalo bit)",4001,-0.5,4000.5,51,-0.5,50.5,
"TimeMonitoring");
2845 histos->
fill2DHist(L1GMT_BXN,nRecHits,
"n_RecHits_v_BX_L1CSCCand_w_beamHalo",
"Number of RecHits vs. BX of L1 CSC Cand (w beamHalo bit)",4001,-0.5,4000.5,101,-0.5,100.5,
"TimeMonitoring");
2846 histos->
fill2DHist(L1GMT_BXN,nSegments,
"n_Segments_v_BX_L1CSCCand_w_beamHalo",
"Number of Segments vs. BX of L1 CSC Cand (w beamHalo bit)",4001,-0.5,4000.5,51,-0.5,50.5,
"TimeMonitoring");
2861 event.getByToken(
rd_token, rawdata);
2862 bool goodEvent =
false;
2866 unsigned long dccBinCheckMask = 0x06080016;
2867 unsigned int examinerMask = 0x1FEBF3F6;
2868 unsigned int errorMask = 0x0;
2877 unsigned long length = fedData.
size();
2881 std::stringstream examiner_out, examiner_err;
2886 if( examinerMask&0x40000 ) examiner->
crcCFEB(
true);
2887 if( examinerMask&0x8000 ) examiner->
crcTMB (
true);
2888 if( examinerMask&0x0400 ) examiner->
crcALCT(
true);
2889 examiner->
setMask(examinerMask);
2890 const short unsigned int *
data = (
short unsigned int *)fedData.
data();
2892 if( examiner->
check(data,
long(fedData.
size()/2)) < 0 ) {
2896 goodEvent=!(examiner->
errors()&dccBinCheckMask);
2905 const std::vector<CSCDDUEventData> & dduData = dccData.
dduData();
2910 for (
unsigned int iDDU=0; iDDU<dduData.size(); ++iDDU) {
2913 if (dduData[iDDU].trailer().errorstat()&errorMask) {
2914 LogTrace(
"CSCDCCUnpacker|CSCRawToDigi") <<
"DDU# " << iDDU <<
" has serious error - no digis unpacked! " <<
2915 std::hex << dduData[iDDU].trailer().errorstat();
2920 const std::vector<CSCEventData> & cscData = dduData[iDDU].cscData();
2921 for (
unsigned int iCSC=0; iCSC<cscData.size(); ++iCSC) {
2923 int vmecrate = cscData[iCSC].dmbHeader()->crateID();
2924 int dmb = cscData[iCSC].dmbHeader()->dmbID();
2932 if ((vmecrate>=1)&&(vmecrate<=60) && (dmb>=1)&&(dmb<=10)&&(dmb!=6)) {
2933 layer = pcrate->
detId(vmecrate, dmb,icfeb,ilayer );
2936 LogTrace (
"CSCTimingAlignment|CSCDCCUnpacker|CSCRawToDigi") <<
" detID input out of range!!! ";
2937 LogTrace (
"CSCTimingAlignment|CSCDCCUnpacker|CSCRawToDigi")
2938 <<
" skipping chamber vme= " << vmecrate <<
" dmb= " << dmb;
2943 int nalct = cscData[iCSC].dmbHeader()->nalct();
2944 bool goodALCT=
false;
2946 if (nalct&&cscData[iCSC].alctHeader()) {
2947 if (cscData[iCSC].alctHeader()->
check()){
2953 int nclct = cscData[iCSC].dmbHeader()->nclct();
2955 if (nclct&&cscData[iCSC].tmbData()) {
2956 if (cscData[iCSC].tmbHeader()->
check()){
2957 if (cscData[iCSC].clctData()->
check()) goodTMB=
true;
2961 if (goodTMB && goodALCT) {
2963 if (ALCT_KeyWG_map.find(layer) == ALCT_KeyWG_map.end()) {
2964 printf(
"no ALCT info for Chamber %d %d %d %d \n",layer.endcap(), layer.station(), layer.ring(), layer.chamber());
2967 if (CLCT_getFullBx_map.find(layer) == CLCT_getFullBx_map.end()) {
2968 printf(
"no CLCT info for Chamber %d %d %d %d \n",layer.endcap(), layer.station(), layer.ring(), layer.chamber());
2971 int ALCT0Key = ALCT_KeyWG_map.find(layer)->second;
2972 int CLCTPretrigger = CLCT_getFullBx_map.find(layer)->second;
2976 const CSCTMBHeader *tmbHead = cscData[iCSC].tmbHeader();
2987 histos->
fillProfile(ALCT0Key,tmbHead->
ALCTMatchTime(),
"prof_TMB_ALCTMatchTime_v_ALCT0KeyWG",
"prof_TMB_ALCTMatchTime_v_ALCT0KeyWG",128,-0.5,127.5,0,7,
"TimeMonitoring");
2988 histos->
fillProfileByType(ALCT0Key,tmbHead->
ALCTMatchTime(),
"prf_TMB_ALCTMatchTime_v_ALCT0KeyWG",
"prf_TMB_ALCTMatchTime_v_ALCT0KeyWG",layer.chamberId(),128,-0.5,127.5,0,7,
"TimeMonitoring");
2993 if (TMB_ALCT_rel_L1A > 3563)
2994 TMB_ALCT_rel_L1A = TMB_ALCT_rel_L1A - 3564;
2995 if (TMB_ALCT_rel_L1A < 0)
2996 TMB_ALCT_rel_L1A = TMB_ALCT_rel_L1A + 3564;
2999 histos->
fill1DHist(TMB_ALCT_rel_L1A,
"h1D_TMB_ALCT_rel_L1A",
"h1D_TMB_ALCT_rel_L1A",11,144.5,155.5,
"TimeMonitoring");
3000 histos->
fill2DHist(
chamberSerial(layer.chamberId()),TMB_ALCT_rel_L1A,
"h2D_TMB_ALCT_rel_L1A",
"h2D_TMB_ALCT_rel_L1A", 601,-0.5,600.5,11,144.5,155.5,
"TimeMonitoring");
3001 histos->
fill2DHist(
ringSerial(layer.chamberId()),TMB_ALCT_rel_L1A,
"h2D_TMB_ALCT_rel_L1A_by_ring",
"h2D_TMB_ALCT_rel_L1A_by_ring",19,-9.5,9.5,11,144.5,155.5,
"TimeMonitoring");
3002 histos->
fillProfile(
chamberSerial(layer.chamberId()),TMB_ALCT_rel_L1A,
"prof_TMB_ALCT_rel_L1A",
"prof_TMB_ALCT_rel_L1A", 601,-0.5,600.5,145,155,
"TimeMonitoring");
3003 histos->
fillProfile(
ringSerial(layer.chamberId()),TMB_ALCT_rel_L1A,
"prof_TMB_ALCT_rel_L1A_by_ring",
"prof_TMB_ALCT_rel_L1A_by_ring",19,-9.5,9.5,145,155,
"TimeMonitoring");
3005 histos->
fill2DHist (ALCT0Key,TMB_ALCT_rel_L1A,
"h2D_TMB_ALCT_rel_L1A_v_ALCT0KeyWG",
"h2D_TMB_ALCT_rel_L1A_v_ALCT0KeyWG", 128,-0.5,127.5,11,144.5,155.5,
"TimeMonitoring");
3006 histos->
fillProfile(ALCT0Key,TMB_ALCT_rel_L1A,
"prof_TMB_ALCT_rel_L1A_v_ALCT0KeyWG",
"prof_TMB_ALCT_rel_L1A_v_ALCT0KeyWG",128,-0.5,127.5,145,155,
"TimeMonitoring");
3007 histos->
fillProfileByType(ALCT0Key,TMB_ALCT_rel_L1A,
"prf_TMB_ALCT_rel_L1A_v_ALCT0KeyWG",
"prf_TMB_ALCT_rel_L1A_v_ALCT0KeyWG",layer.chamberId(),128,-0.5,127.5,145,155,
"TimeMonitoring");
3013 if (examiner!=
nullptr)
delete examiner;
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::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.
std::pair< const_iterator, const_iterator > Range
T const * product() const
edm::EDGetTokenT< FEDRawDataCollection > rd_token
void setMask(ExaminerMaskType mask)