2650 map<CSCDetId, float > segment_median_map;
2651 map<CSCDetId, GlobalPoint > segment_position_map;
2661 LocalPoint localPos = (*dSiter).localPosition();
2663 const CSCChamber* cscchamber = cscGeom->chamber(
id);
2665 globalPosition = cscchamber->
toGlobal(localPos);
2669 std::vector<CSCRecHit2D> theseRecHits = (*dSiter).specificRecHits();
2670 int nRH = (*dSiter).nRecHits();
2671 if (nRH < 4 )
continue;
2674 vector<float> non_zero;
2676 for ( vector<CSCRecHit2D>::const_iterator iRH = theseRecHits.begin(); iRH != theseRecHits.end(); iRH++) {
2677 non_zero.push_back( iRH->tpeak());
2682 sort(non_zero.begin(),non_zero.end());
2683 int middle_index = non_zero.size()/2;
2684 float average_two = (non_zero.at(middle_index-1) + non_zero.at(middle_index))/2.;
2685 if(non_zero.size()%2)
2686 average_two = non_zero.at(middle_index);
2689 segment_median_map[id]=average_two;
2690 segment_position_map[id]=globalPosition;
2692 double distToIP =
sqrt(globalPosition.
x()*globalPosition.
x()+globalPosition.
y()*globalPosition.
y()+globalPosition.
z()*globalPosition.
z());
2695 histos->
fillProfileByType(
id.chamber(),average_two,
"timeChamberByType",
"Segment mean time by chamber",
id,36,0.5,36.5,-400,400.,
"TimeMonitoring");
2696 histos->
fill2DHist(distToIP,average_two,
"seg_time_vs_distToIP",
"Segment time vs. Distance to IP",80,600.,1400.,800,-400,400.,
"TimeMonitoring");
2697 histos->
fill2DHist(globalPosition.
z(),average_two,
"seg_time_vs_globZ",
"Segment time vs. z position",240,-1200,1200,800,-400.,400.,
"TimeMonitoring");
2698 histos->
fill2DHist(fabs(globalPosition.
z()),average_two,
"seg_time_vs_absglobZ",
"Segment time vs. abs(z position)",120,0.,1200.,800,-400.,400.,
"TimeMonitoring");
2703 map<CSCDetId, float >::const_iterator it_outer;
2704 map<CSCDetId, float >::const_iterator it_inner;
2705 for (it_outer = segment_median_map.begin(); it_outer != segment_median_map.end(); it_outer++){
2707 CSCDetId id_outer = it_outer->first;
2708 float t_outer = it_outer->second;
2711 for (it_inner = segment_median_map.begin(); it_inner != segment_median_map.end(); it_inner++){
2713 CSCDetId id_inner = it_inner->first;
2714 float t_inner = it_inner->second;
2729 histos->
fill1DHist(t_outer-t_inner,
"diff_opposite_endcaps",
"#Delta t [ME+]-[ME-] for chambers in same station and ring",800,-400.,400.,
"TimeMonitoring");
2730 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");
2740 vector<L1MuGMTReadoutRecord> L1Mrec = pCollection->getRecords();
2741 vector<L1MuGMTReadoutRecord>::const_iterator igmtrr;
2742 int L1GMT_BXN = -100;
2743 bool has_CSCTrigger =
false;
2744 bool has_beamHaloTrigger =
false;
2745 for(igmtrr=L1Mrec.begin(); igmtrr!=L1Mrec.end(); igmtrr++) {
2746 std::vector<L1MuRegionalCand>::const_iterator iter1;
2747 std::vector<L1MuRegionalCand> rmc;
2750 rmc = igmtrr->getCSCCands();
2751 for(iter1=rmc.begin(); iter1!=rmc.end(); iter1++) {
2752 if ( !(*iter1).empty() ) {
2754 int kQuality = (*iter1).quality();
2755 if (kQuality == 1) has_beamHaloTrigger =
true;
2758 if (igmtrr->getBxInEvent() == 0 && icsc>0){
2760 L1GMT_BXN = igmtrr->getBxNr();
2761 has_CSCTrigger =
true;
2763 else if (igmtrr->getBxInEvent() == 0 ) {
2765 L1GMT_BXN = igmtrr->getBxNr();
2774 map<CSCDetId, int > ALCT_KeyWG_map;
2777 const CSCDetId& idALCT = (*j).first;
2780 if((*digiIt).isValid()){
2782 histos->
fill1DHist( (*digiIt).getBX(),
"ALCT_getBX",
"ALCT.getBX()",11,-0.5,10.5,
"TimeMonitoring");
2783 histos->
fill1DHist( (*digiIt).getFullBX(),
"ALCT_getFullBX",
"ALCT.getFullBX()",3601,-0.5,3600.5,
"TimeMonitoring");
2785 if (ALCT_KeyWG_map.find(idALCT.
chamberId()) == ALCT_KeyWG_map.end()){
2786 ALCT_KeyWG_map[idALCT.
chamberId()] = (*digiIt).getKeyWG();
2798 map<CSCDetId, int > CLCT_getFullBx_map;
2801 const CSCDetId& idCLCT = (*j).first;
2804 if((*digiIt).isValid()){
2806 histos->
fill1DHist( (*digiIt).getBX(),
"CLCT_getBX",
"CLCT.getBX()",11,-0.5,10.5,
"TimeMonitoring");
2807 histos->
fill1DHist( (*digiIt).getFullBX(),
"CLCT_getFullBX",
"CLCT.getFullBX()",3601,-0.5,3600.5,
"TimeMonitoring");
2809 if (CLCT_getFullBx_map.find(idCLCT.
chamberId()) == CLCT_getFullBx_map.end()){
2810 CLCT_getFullBx_map[idCLCT.
chamberId()] = (*digiIt).getFullBX();
2820 int n_correlatedlcts = 0;
2824 if((*digiIt).isValid()){
2826 histos->
fill1DHist( (*digiIt).getBX(),
"CorrelatedLCTS_getBX",
"CorrelatedLCT.getBX()",11,-0.5,10.5,
"TimeMonitoring");
2832 int nRecHits = recHits->size();
2833 int nSegments = cscSegments->size();
2834 if (has_CSCTrigger){
2835 histos->
fill1DHist(L1GMT_BXN,
"BX_L1CSCCand",
"BX of L1 CSC Cand",4001,-0.5,4000.5,
"TimeMonitoring");
2836 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");
2837 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");
2838 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");
2839 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");
2840 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");
2842 if (has_CSCTrigger && has_beamHaloTrigger){
2843 histos->
fill1DHist(L1GMT_BXN,
"BX_L1CSCCand_w_beamHalo",
"BX of L1 CSC (w beamHalo bit)",4001,-0.5,4000.5,
"TimeMonitoring");
2844 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");
2845 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");
2846 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");
2847 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");
2848 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");
2863 event.getByToken(
rd_token, rawdata);
2864 bool goodEvent =
false;
2868 unsigned long dccBinCheckMask = 0x06080016;
2869 unsigned int examinerMask = 0x1FEBF3F6;
2870 unsigned int errorMask = 0x0;
2878 const FEDRawData& fedData = rawdata->FEDData(
id);
2879 unsigned long length = fedData.
size();
2883 std::stringstream examiner_out, examiner_err;
2890 if( examinerMask&0x40000 ) examiner->
crcCFEB(1);
2891 if( examinerMask&0x8000 ) examiner->
crcTMB (1);
2892 if( examinerMask&0x0400 ) examiner->
crcALCT(1);
2895 examiner->
setMask(examinerMask);
2896 const short unsigned int *
data = (
short unsigned int *)fedData.
data();
2898 if( examiner->
check(data,
long(fedData.
size()/2)) < 0 ) {
2902 goodEvent=!(examiner->
errors()&dccBinCheckMask);
2911 const std::vector<CSCDDUEventData> & dduData = dccData.
dduData();
2916 for (
unsigned int iDDU=0; iDDU<dduData.size(); ++iDDU) {
2919 if (dduData[iDDU].trailer().errorstat()&errorMask) {
2920 LogTrace(
"CSCDCCUnpacker|CSCRawToDigi") <<
"DDU# " << iDDU <<
" has serious error - no digis unpacked! " <<
2921 std::hex << dduData[iDDU].trailer().errorstat();
2926 const std::vector<CSCEventData> & cscData = dduData[iDDU].cscData();
2927 for (
unsigned int iCSC=0; iCSC<cscData.size(); ++iCSC) {
2929 int vmecrate = cscData[iCSC].dmbHeader()->crateID();
2930 int dmb = cscData[iCSC].dmbHeader()->dmbID();
2938 if ((vmecrate>=1)&&(vmecrate<=60) && (dmb>=1)&&(dmb<=10)&&(dmb!=6)) {
2939 layer = pcrate->
detId(vmecrate, dmb,icfeb,ilayer );
2942 LogTrace (
"CSCTimingAlignment|CSCDCCUnpacker|CSCRawToDigi") <<
" detID input out of range!!! ";
2943 LogTrace (
"CSCTimingAlignment|CSCDCCUnpacker|CSCRawToDigi")
2944 <<
" skipping chamber vme= " << vmecrate <<
" dmb= " << dmb;
2949 int nalct = cscData[iCSC].dmbHeader()->nalct();
2950 bool goodALCT=
false;
2952 if (nalct&&cscData[iCSC].alctHeader()) {
2953 if (cscData[iCSC].alctHeader()->
check()){
2959 int nclct = cscData[iCSC].dmbHeader()->nclct();
2961 if (nclct&&cscData[iCSC].tmbData()) {
2962 if (cscData[iCSC].tmbHeader()->
check()){
2963 if (cscData[iCSC].clctData()->
check()) goodTMB=
true;
2967 if (goodTMB && goodALCT) {
2969 if (ALCT_KeyWG_map.find(layer) == ALCT_KeyWG_map.end()) {
2970 printf(
"no ALCT info for Chamber %d %d %d %d \n",layer.endcap(), layer.station(), layer.ring(), layer.chamber());
2973 if (CLCT_getFullBx_map.find(layer) == CLCT_getFullBx_map.end()) {
2974 printf(
"no CLCT info for Chamber %d %d %d %d \n",layer.endcap(), layer.station(), layer.ring(), layer.chamber());
2977 int ALCT0Key = ALCT_KeyWG_map.find(layer)->second;
2978 int CLCTPretrigger = CLCT_getFullBx_map.find(layer)->second;
2982 const CSCTMBHeader *tmbHead = cscData[iCSC].tmbHeader();
2993 histos->
fillProfile(ALCT0Key,tmbHead->
ALCTMatchTime(),
"prof_TMB_ALCTMatchTime_v_ALCT0KeyWG",
"prof_TMB_ALCTMatchTime_v_ALCT0KeyWG",128,-0.5,127.5,0,7,
"TimeMonitoring");
2994 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");
2999 if (TMB_ALCT_rel_L1A > 3563)
3000 TMB_ALCT_rel_L1A = TMB_ALCT_rel_L1A - 3564;
3001 if (TMB_ALCT_rel_L1A < 0)
3002 TMB_ALCT_rel_L1A = TMB_ALCT_rel_L1A + 3564;
3005 histos->
fill1DHist(TMB_ALCT_rel_L1A,
"h1D_TMB_ALCT_rel_L1A",
"h1D_TMB_ALCT_rel_L1A",11,144.5,155.5,
"TimeMonitoring");
3006 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");
3007 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");
3008 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");
3009 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");
3011 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");
3012 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");
3013 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");
3019 if (examiner!=
NULL)
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
void redirect(std::ostream &str)
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.
bool check(const DataFrame &df, bool capcheck, bool dvercheck)
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)
T const * product() const
std::vector< CSCALCTDigi >::const_iterator const_iterator
int32_t check(const uint16_t *&buffer, int32_t length)
char data[epos_bytes_allocation]
int chamberSerial(CSCDetId id)
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
std::pair< const_iterator, const_iterator > Range
edm::EDGetTokenT< FEDRawDataCollection > rd_token
void setMask(ExaminerMaskType mask)