CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CSCOfflineMonitor.cc
Go to the documentation of this file.
1 /*
2  * Offline DQM module for CSC local reconstruction.
3  *
4  * Andy Kubik
5  * Northwestern University
6  */
7 
9 
10 using namespace std;
11 
13 // CONSTRUCTOR //
16  dbe(nullptr)
17 {
18 
19  param = pset;
20 
21  rd_token = consumes<FEDRawDataCollection>( pset.getParameter<edm::InputTag>("FEDRawDataCollectionTag") );
22  sd_token = consumes<CSCStripDigiCollection>( pset.getParameter<edm::InputTag>("stripDigiTag") );
23  wd_token = consumes<CSCWireDigiCollection>( pset.getParameter<edm::InputTag>("wireDigiTag") );
24  al_token = consumes<CSCALCTDigiCollection>( pset.getParameter<edm::InputTag>("alctDigiTag") );
25  cl_token = consumes<CSCCLCTDigiCollection>( pset.getParameter<edm::InputTag>("clctDigiTag") );
26  rh_token = consumes<CSCRecHit2DCollection>( pset.getParameter<edm::InputTag>("cscRecHitTag") );
27  se_token = consumes<CSCSegmentCollection>( pset.getParameter<edm::InputTag>("cscSegTag") );
28 
30 
31 }
32 
35  bookTheHists();
36 }
37 
39 
40  finalizedHistograms_ = false;
41 
42  // Occupancies
43  dbe->setCurrentFolder("CSC/CSCOfflineMonitor/Occupancy");
44  hCSCOccupancy = dbe->book1D("hCSCOccupancy","overall CSC occupancy",13,-0.5,12.5);
45  hCSCOccupancy->setBinLabel(2,"Total Events");
46  hCSCOccupancy->setBinLabel(4,"# Events with Wires");
47  hCSCOccupancy->setBinLabel(6,"# Events with Strips");
48  hCSCOccupancy->setBinLabel(8,"# Events with Wires&Strips");
49  hCSCOccupancy->setBinLabel(10,"# Events with Rechits");
50  hCSCOccupancy->setBinLabel(12,"# Events with Segments");
51  hOWiresAndCLCT = dbe->book2D("hOWiresAndCLCT","Wire and CLCT Digi Occupancy ",36,0.5,36.5,20,0.5,20.5);
52  hOWires = dbe->book2D("hOWires","Wire Digi Occupancy",36,0.5,36.5,20,0.5,20.5);
53  hOWireSerial = dbe->book1D("hOWireSerial","Wire Occupancy by Chamber Serial",601,-0.5,600.5);
54  hOWireSerial->setAxisTitle("Chamber Serial Number");
55  hOStrips = dbe->book2D("hOStrips","Strip Digi Occupancy",36,0.5,36.5,20,0.5,20.5);
56  hOStripSerial = dbe->book1D("hOStripSerial","Strip Occupancy by Chamber Serial",601,-0.5,600.5);
57  hOStripSerial->setAxisTitle("Chamber Serial Number");
58  hOStripsAndWiresAndCLCT = dbe->book2D("hOStripsAndWiresAndCLCT","Strip And Wire And CLCT Digi Occupancy",36,0.5,36.5,20,0.5,20.5);
60  hORecHits = dbe->book2D("hORecHits","RecHit Occupancy",36,0.5,36.5,20,0.5,20.5);
61  hORecHitsSerial = dbe->book1D("hORecHitSerial","RecHit Occupancy by Chamber Serial",601,-0.5,600.5);
62  hORecHitsSerial->setAxisTitle("Chamber Serial Number");
63  hOSegments = dbe->book2D("hOSegments","Segment Occupancy",36,0.5,36.5,20,0.5,20.5);
64  hOSegmentsSerial = dbe->book1D("hOSegmentSerial","Segment Occupancy by Chamber Serial",601,-0.5,600.5);
65  hOSegmentsSerial->setAxisTitle("Chamber Serial Number");
66 
67  // wire digis
68  dbe->setCurrentFolder("CSC/CSCOfflineMonitor/Digis");
69  hWirenGroupsTotal = dbe->book1D("hWirenGroupsTotal","Fired Wires per Event; # Wiregroups Fired",61,-0.5,60.5);
70  hWireTBin.push_back(dbe->book1D("hWireTBin_m42","Wire TBin Fired (ME -4/2); Time Bin (25ns)",17,-0.5,16.5));
71  hWireTBin.push_back(dbe->book1D("hWireTBin_m41","Wire TBin Fired (ME -4/1); Time Bin (25ns)",17,-0.5,16.5));
72  hWireTBin.push_back(dbe->book1D("hWireTBin_m32","Wire TBin Fired (ME -3/2); Time Bin (25ns)",17,-0.5,16.5));
73  hWireTBin.push_back(dbe->book1D("hWireTBin_m31","Wire TBin Fired (ME -3/1); Time Bin (25ns)",17,-0.5,16.5));
74  hWireTBin.push_back(dbe->book1D("hWireTBin_m22","Wire TBin Fired (ME -2/2); Time Bin (25ns)",17,-0.5,16.5));
75  hWireTBin.push_back(dbe->book1D("hWireTBin_m21","Wire TBin Fired (ME -2/1); Time Bin (25ns)",17,-0.5,16.5));
76  hWireTBin.push_back(dbe->book1D("hWireTBin_m11a","Wire TBin Fired (ME -1/1a); Time Bin (25ns)",17,-0.5,16.5));
77  hWireTBin.push_back(dbe->book1D("hWireTBin_m13","Wire TBin Fired (ME -1/3); Time Bin (25ns)",17,-0.5,16.5));
78  hWireTBin.push_back(dbe->book1D("hWireTBin_m12","Wire TBin Fired (ME -1/2); Time Bin (25ns)",17,-0.5,16.5));
79  hWireTBin.push_back(dbe->book1D("hWireTBin_m11b","Wire TBin Fired (ME -1/1b); Time Bin (25ns)",17,-0.5,16.5));
80  hWireTBin.push_back(dbe->book1D("hWireTBin_p11b","Wire TBin Fired (ME +1/1b); Time Bin (25ns)",17,-0.5,16.5));
81  hWireTBin.push_back(dbe->book1D("hWireTBin_p12","Wire TBin Fired (ME +1/2); Time Bin (25ns)",17,-0.5,16.5));
82  hWireTBin.push_back(dbe->book1D("hWireTBin_p13","Wire TBin Fired (ME +1/3); Time Bin (25ns)",17,-0.5,16.5));
83  hWireTBin.push_back(dbe->book1D("hWireTBin_p11a","Wire TBin Fired (ME +1/1a); Time Bin (25ns)",17,-0.5,16.5));
84  hWireTBin.push_back(dbe->book1D("hWireTBin_p21","Wire TBin Fired (ME +2/1); Time Bin (25ns)",17,-0.5,16.5));
85  hWireTBin.push_back(dbe->book1D("hWireTBin_p22","Wire TBin Fired (ME +2/2); Time Bin (25ns)",17,-0.5,16.5));
86  hWireTBin.push_back(dbe->book1D("hWireTBin_p31","Wire TBin Fired (ME +3/1); Time Bin (25ns)",17,-0.5,16.5));
87  hWireTBin.push_back(dbe->book1D("hWireTBin_p32","Wire TBin Fired (ME +3/2); Time Bin (25ns)",17,-0.5,16.5));
88  hWireTBin.push_back(dbe->book1D("hWireTBin_p41","Wire TBin Fired (ME +4/1); Time Bin (25ns)",17,-0.5,16.5));
89  hWireTBin.push_back(dbe->book1D("hWireTBin_p42","Wire TBin Fired (ME +4/2); Time Bin (25ns)",17,-0.5,16.5));
90  hWireNumber.push_back(dbe->book1D("hWireNumber_m42","Wiregroup Number Fired (ME -4/2); Wiregroup #",113,-0.5,112.5));
91  hWireNumber.push_back(dbe->book1D("hWireNumber_m41","Wiregroup Number Fired (ME -4/1); Wiregroup #",113,-0.5,112.5));
92  hWireNumber.push_back(dbe->book1D("hWireNumber_m32","Wiregroup Number Fired (ME -3/2); Wiregroup #",113,-0.5,112.5));
93  hWireNumber.push_back(dbe->book1D("hWireNumber_m31","Wiregroup Number Fired (ME -3/1); Wiregroup #",113,-0.5,112.5));
94  hWireNumber.push_back(dbe->book1D("hWireNumber_m22","Wiregroup Number Fired (ME -2/2); Wiregroup #",113,-0.5,112.5));
95  hWireNumber.push_back(dbe->book1D("hWireNumber_m21","Wiregroup Number Fired (ME -2/1); Wiregroup #",113,-0.5,112.5));
96  hWireNumber.push_back(dbe->book1D("hWireNumber_m11a","Wiregroup Number Fired (ME -1/1a); Wiregroup #",113,-0.5,112.5));
97  hWireNumber.push_back(dbe->book1D("hWireNumber_m13","Wiregroup Number Fired (ME -1/3); Wiregroup #",113,-0.5,112.5));
98  hWireNumber.push_back(dbe->book1D("hWireNumber_m12","Wiregroup Number Fired (ME -1/2); Wiregroup #",113,-0.5,112.5));
99  hWireNumber.push_back(dbe->book1D("hWireNumber_m11b","Wiregroup Number Fired (ME -1/1b); Wiregroup #",113,-0.5,112.5));
100  hWireNumber.push_back(dbe->book1D("hWireNumber_p11b","Wiregroup Number Fired (ME +1/1b); Wiregroup #",113,-0.5,112.5));
101  hWireNumber.push_back(dbe->book1D("hWireNumber_p12","Wiregroup Number Fired (ME +1/2); Wiregroup #",113,-0.5,112.5));
102  hWireNumber.push_back(dbe->book1D("hWireNumber_p13","Wiregroup Number Fired (ME +1/3); Wiregroup #",113,-0.5,112.5));
103  hWireNumber.push_back(dbe->book1D("hWireNumber_p11a","Wiregroup Number Fired (ME +1/1a); Wiregroup #",113,-0.5,112.5));
104  hWireNumber.push_back(dbe->book1D("hWireNumber_p21","Wiregroup Number Fired (ME +2/1); Wiregroup #",113,-0.5,112.5));
105  hWireNumber.push_back(dbe->book1D("hWireNumber_p22","Wiregroup Number Fired (ME +2/2); Wiregroup #",113,-0.5,112.5));
106  hWireNumber.push_back(dbe->book1D("hWireNumber_p31","Wiregroup Number Fired (ME +3/1); Wiregroup #",113,-0.5,112.5));
107  hWireNumber.push_back(dbe->book1D("hWireNumber_p32","Wiregroup Number Fired (ME +3/2); Wiregroup #",113,-0.5,112.5));
108  hWireNumber.push_back(dbe->book1D("hWireNumber_p41","Wiregroup Number Fired (ME +4/1); Wiregroup #",113,-0.5,112.5));
109  hWireNumber.push_back(dbe->book1D("hWireNumber_p42","Wiregroup Number Fired (ME +4/2); Wiregroup #",113,-0.5,112.5));
110 
111  // strip digis
112  hStripNFired = dbe->book1D("hStripNFired","Fired Strips per Event; # Strips Fired (above 13 ADC)",101,-0.5,100.5);
113  hStripNumber.push_back(dbe->book1D("hStripNumber_m42","Strip Number Fired (ME -4/2); Strip # Fired (above 13 ADC)",81,-0.5,80.5));
114  hStripNumber.push_back(dbe->book1D("hStripNumber_m41","Strip Number Fired (ME -4/1); Strip # Fired (above 13 ADC)",81,-0.5,80.5));
115  hStripNumber.push_back(dbe->book1D("hStripNumber_m32","Strip Number Fired (ME -3/2); Strip # Fired (above 13 ADC)",81,-0.5,80.5));
116  hStripNumber.push_back(dbe->book1D("hStripNumber_m31","Strip Number Fired (ME -3/1); Strip # Fired (above 13 ADC)",81,-0.5,80.5));
117  hStripNumber.push_back(dbe->book1D("hStripNumber_m22","Strip Number Fired (ME -2/2); Strip # Fired (above 13 ADC)",81,-0.5,80.5));
118  hStripNumber.push_back(dbe->book1D("hStripNumber_m21","Strip Number Fired (ME -2/1); Strip # Fired (above 13 ADC)",81,-0.5,80.5));
119  hStripNumber.push_back(dbe->book1D("hStripNumber_m11a","Strip Number Fired (ME -1/1a); Strip # Fired (above 13 ADC)",81,-0.5,80.5));
120  hStripNumber.push_back(dbe->book1D("hStripNumber_m13","Strip Number Fired (ME -1/3); Strip # Fired (above 13 ADC)",81,-0.5,80.5));
121  hStripNumber.push_back(dbe->book1D("hStripNumber_m12","Strip Number Fired (ME -1/2); Strip # Fired (above 13 ADC)",81,-0.5,80.5));
122  hStripNumber.push_back(dbe->book1D("hStripNumber_m11b","Strip Number Fired (ME -1/1b); Strip # Fired (above 13 ADC)",81,-0.5,80.5));
123  hStripNumber.push_back(dbe->book1D("hStripNumber_p11b","Strip Number Fired (ME +1/1b); Strip # Fired (above 13 ADC)",81,-0.5,80.5));
124  hStripNumber.push_back(dbe->book1D("hStripNumber_p12","Strip Number Fired (ME +1/2); Strip # Fired (above 13 ADC)",81,-0.5,80.5));
125  hStripNumber.push_back(dbe->book1D("hStripNumber_p13","Strip Number Fired (ME +1/3); Strip # Fired (above 13 ADC)",81,-0.5,80.5));
126  hStripNumber.push_back(dbe->book1D("hStripNumber_p11a","Strip Number Fired (ME +1/1a); Strip # Fired (above 13 ADC)",81,-0.5,80.5));
127  hStripNumber.push_back(dbe->book1D("hStripNumber_p21","Strip Number Fired (ME +2/1); Strip # Fired (above 13 ADC)",81,-0.5,80.5));
128  hStripNumber.push_back(dbe->book1D("hStripNumber_p22","Strip Number Fired (ME +2/2); Strip # Fired (above 13 ADC)",81,-0.5,80.5));
129  hStripNumber.push_back(dbe->book1D("hStripNumber_p31","Strip Number Fired (ME +3/1); Strip # Fired (above 13 ADC)",81,-0.5,80.5));
130  hStripNumber.push_back(dbe->book1D("hStripNumber_p32","Strip Number Fired (ME +3/2); Strip # Fired (above 13 ADC)",81,-0.5,80.5));
131  hStripNumber.push_back(dbe->book1D("hStripNumber_p41","Strip Number Fired (ME +4/1); Strip # Fired (above 13 ADC)",81,-0.5,80.5));
132  hStripNumber.push_back(dbe->book1D("hStripNumber_p42","Stripgroup Number Fired (ME +4/2); Strip # Fired (above 13 ADC)",81,-0.5,80.5));
133 
134  //Pedestal Noise Plots
135  dbe->setCurrentFolder("CSC/CSCOfflineMonitor/PedestalNoise");
136  hStripPed.push_back(dbe->book1D("hStripPedMEm42","Pedestal Noise Distribution Chamber ME -4/2; ADC Counts",50,-25.,25.));
137  hStripPed.push_back(dbe->book1D("hStripPedMEm41","Pedestal Noise Distribution Chamber ME -4/1; ADC Counts",50,-25.,25.));
138  hStripPed.push_back(dbe->book1D("hStripPedMEm32","Pedestal Noise Distribution Chamber ME -3/2; ADC Counts",50,-25.,25.));
139  hStripPed.push_back(dbe->book1D("hStripPedMEm31","Pedestal Noise Distribution Chamber ME -3/1; ADC Counts",50,-25.,25.));
140  hStripPed.push_back(dbe->book1D("hStripPedMEm22","Pedestal Noise Distribution Chamber ME -2/2; ADC Counts",50,-25.,25.));
141  hStripPed.push_back(dbe->book1D("hStripPedMEm21","Pedestal Noise Distribution Chamber ME -2/1; ADC Counts",50,-25.,25.));
142  hStripPed.push_back(dbe->book1D("hStripPedMEm11a","Pedestal Noise Distribution Chamber ME -1/1; ADC Counts",50,-25.,25.));
143  hStripPed.push_back(dbe->book1D("hStripPedMEm13","Pedestal Noise Distribution Chamber ME -1/3; ADC Counts",50,-25.,25.));
144  hStripPed.push_back(dbe->book1D("hStripPedMEm12","Pedestal Noise Distribution Chamber ME -1/2; ADC Counts",50,-25.,25.));
145  hStripPed.push_back(dbe->book1D("hStripPedMEm11b","Pedestal Noise Distribution Chamber ME -1/1; ADC Counts",50,-25.,25.));
146  hStripPed.push_back(dbe->book1D("hStripPedMEp11b","Pedestal Noise Distribution Chamber ME +1/1; ADC Counts",50,-25.,25.));
147  hStripPed.push_back(dbe->book1D("hStripPedMEp12","Pedestal Noise Distribution Chamber ME +1/2; ADC Counts",50,-25.,25.));
148  hStripPed.push_back(dbe->book1D("hStripPedMEp13","Pedestal Noise Distribution Chamber ME +1/3; ADC Counts",50,-25.,25.));
149  hStripPed.push_back(dbe->book1D("hStripPedMEp11a","Pedestal Noise Distribution Chamber ME +1/1; ADC Counts",50,-25.,25.));
150  hStripPed.push_back(dbe->book1D("hStripPedMEp21","Pedestal Noise Distribution Chamber ME +2/1; ADC Counts",50,-25.,25.));
151  hStripPed.push_back(dbe->book1D("hStripPedMEp22","Pedestal Noise Distribution Chamber ME +2/2; ADC Counts",50,-25.,25.));
152  hStripPed.push_back(dbe->book1D("hStripPedMEp31","Pedestal Noise Distribution Chamber ME +3/1; ADC Counts",50,-25.,25.));
153  hStripPed.push_back(dbe->book1D("hStripPedMEp32","Pedestal Noise Distribution Chamber ME +3/2; ADC Counts",50,-25.,25.));
154  hStripPed.push_back(dbe->book1D("hStripPedMEp41","Pedestal Noise Distribution Chamber ME +4/1; ADC Counts",50,-25.,25.));
155  hStripPed.push_back(dbe->book1D("hStripPedMEp42","Pedestal Noise Distribution Chamber ME +4/2; ADC Counts",50,-25.,25.));
156 
157  // recHits
158  dbe->setCurrentFolder("CSC/CSCOfflineMonitor/recHits");
159  hRHnrechits = dbe->book1D("hRHnrechits","recHits per Event (all chambers); # of RecHits",50,0,50);
160  hRHGlobal.push_back(dbe->book2D("hRHGlobalp1","recHit global X,Y station +1; Global X (cm); Global Y (cm)",100,-800.,800.,100,-800.,800.));
161  hRHGlobal.push_back(dbe->book2D("hRHGlobalp2","recHit global X,Y station +2; Global X (cm); Global Y (cm)",100,-800.,800.,100,-800.,800.));
162  hRHGlobal.push_back(dbe->book2D("hRHGlobalp3","recHit global X,Y station +3; Global X (cm); Global Y (cm)",100,-800.,800.,100,-800.,800.));
163  hRHGlobal.push_back(dbe->book2D("hRHGlobalp4","recHit global X,Y station +4; Global X (cm); Global Y (cm)",100,-800.,800.,100,-800.,800.));
164  hRHGlobal.push_back(dbe->book2D("hRHGlobalm1","recHit global X,Y station -1; Global X (cm); Global Y (cm)",100,-800.,800.,100,-800.,800.));
165  hRHGlobal.push_back(dbe->book2D("hRHGlobalm2","recHit global X,Y station -2; Global X (cm); Global Y (cm)",100,-800.,800.,100,-800.,800.));
166  hRHGlobal.push_back(dbe->book2D("hRHGlobalm3","recHit global X,Y station -3; Global X (cm); Global Y (cm)",100,-800.,800.,100,-800.,800.));
167  hRHGlobal.push_back(dbe->book2D("hRHGlobalm4","recHit global X,Y station -4; Global X (cm); Global Y (cm)",100,-800.,800.,100,-800.,800.));
168  hRHSumQ.push_back(dbe->book1D("hRHSumQm42","Sum 3x3 recHit Charge (ME -4/2); ADC counts",100,0,2000));
169  hRHSumQ.push_back(dbe->book1D("hRHSumQm41","Sum 3x3 recHit Charge (ME -4/1); ADC counts",100,0,2000));
170  hRHSumQ.push_back(dbe->book1D("hRHSumQm32","Sum 3x3 recHit Charge (ME -3/2); ADC counts",100,0,2000));
171  hRHSumQ.push_back(dbe->book1D("hRHSumQm31","Sum 3x3 recHit Charge (ME -3/1); ADC counts",100,0,2000));
172  hRHSumQ.push_back(dbe->book1D("hRHSumQm22","Sum 3x3 recHit Charge (ME -2/2); ADC counts",100,0,2000));
173  hRHSumQ.push_back(dbe->book1D("hRHSumQm21","Sum 3x3 recHit Charge (ME -2/1); ADC counts",100,0,2000));
174  hRHSumQ.push_back(dbe->book1D("hRHSumQm11a","Sum 3x3 recHit Charge (ME -1/1a); ADC counts",100,0,4000));
175  hRHSumQ.push_back(dbe->book1D("hRHSumQm13","Sum 3x3 recHit Charge (ME -1/3); ADC counts",100,0,2000));
176  hRHSumQ.push_back(dbe->book1D("hRHSumQm12","Sum 3x3 recHit Charge (ME -1/2); ADC counts",100,0,2000));
177  hRHSumQ.push_back(dbe->book1D("hRHSumQm11b","Sum 3x3 recHit Charge (ME -1/1b); ADC counts",100,0,4000));
178  hRHSumQ.push_back(dbe->book1D("hRHSumQp11b","Sum 3x3 recHit Charge (ME +1/1b); ADC counts",100,0,4000));
179  hRHSumQ.push_back(dbe->book1D("hRHSumQp12","Sum 3x3 recHit Charge (ME +1/2); ADC counts",100,0,2000));
180  hRHSumQ.push_back(dbe->book1D("hRHSumQp13","Sum 3x3 recHit Charge (ME +1/3); ADC counts",100,0,2000));
181  hRHSumQ.push_back(dbe->book1D("hRHSumQp11a","Sum 3x3 recHit Charge (ME +1/1a); ADC counts",100,0,4000));
182  hRHSumQ.push_back(dbe->book1D("hRHSumQp21","Sum 3x3 recHit Charge (ME +2/1); ADC counts",100,0,2000));
183  hRHSumQ.push_back(dbe->book1D("hRHSumQp22","Sum 3x3 recHit Charge (ME +2/2); ADC counts",100,0,2000));
184  hRHSumQ.push_back(dbe->book1D("hRHSumQp31","Sum 3x3 recHit Charge (ME +3/1); ADC counts",100,0,2000));
185  hRHSumQ.push_back(dbe->book1D("hRHSumQp32","Sum 3x3 recHit Charge (ME +3/2); ADC counts",100,0,2000));
186  hRHSumQ.push_back(dbe->book1D("hRHSumQp41","Sum 3x3 recHit Charge (ME +4/1); ADC counts",100,0,2000));
187  hRHSumQ.push_back(dbe->book1D("hRHSumQp42","Sum 3x3 recHit Charge (ME +4/2); ADC counts",100,0,2000));
188  hRHRatioQ.push_back(dbe->book1D("hRHRatioQm42","Charge Ratio (Ql+Qr)/Qt (ME -4/2); (Ql+Qr)/Qt",100,-0.1,1.1));
189  hRHRatioQ.push_back(dbe->book1D("hRHRatioQm41","Charge Ratio (Ql+Qr)/Qt (ME -4/1); (Ql+Qr)/Qt",100,-0.1,1.1));
190  hRHRatioQ.push_back(dbe->book1D("hRHRatioQm32","Charge Ratio (Ql+Qr)/Qt (ME -3/2); (Ql+Qr)/Qt",100,-0.1,1.1));
191  hRHRatioQ.push_back(dbe->book1D("hRHRatioQm31","Charge Ratio (Ql+Qr)/Qt (ME -3/1); (Ql+Qr)/Qt",100,-0.1,1.1));
192  hRHRatioQ.push_back(dbe->book1D("hRHRatioQm22","Charge Ratio (Ql+Qr)/Qt (ME -2/2); (Ql+Qr)/Qt",100,-0.1,1.1));
193  hRHRatioQ.push_back(dbe->book1D("hRHRatioQm21","Charge Ratio (Ql+Qr)/Qt (ME -2/1); (Ql+Qr)/Qt",100,-0.1,1.1));
194  hRHRatioQ.push_back(dbe->book1D("hRHRatioQm11a","Charge Ratio (Ql+Qr)/Qt (ME -1/1a); (Ql+Qr)/Qt",100,-0.1,1.1));
195  hRHRatioQ.push_back(dbe->book1D("hRHRatioQm13","Charge Ratio (Ql+Qr)/Qt (ME -1/3); (Ql+Qr)/Qt",100,-0.1,1.1));
196  hRHRatioQ.push_back(dbe->book1D("hRHRatioQm12","Charge Ratio (Ql+Qr)/Qt (ME -1/2); (Ql+Qr)/Qt",100,-0.1,1.1));
197  hRHRatioQ.push_back(dbe->book1D("hRHRatioQm11b","Charge Ratio (Ql+Qr)/Qt (ME -1/1b); (Ql+Qr)/Qt",100,-0.1,1.1));
198  hRHRatioQ.push_back(dbe->book1D("hRHRatioQp11b","Charge Ratio (Ql+Qr)/Qt (ME +1/1b); (Ql+Qr)/Qt",100,-0.1,1.1));
199  hRHRatioQ.push_back(dbe->book1D("hRHRatioQp12","Charge Ratio (Ql+Qr)/Qt (ME +1/2); (Ql+Qr)/Qt",100,-0.1,1.1));
200  hRHRatioQ.push_back(dbe->book1D("hRHRatioQp13","Charge Ratio (Ql+Qr)/Qt (ME +1/3); (Ql+Qr)/Qt",100,-0.1,1.1));
201  hRHRatioQ.push_back(dbe->book1D("hRHRatioQp11a","Charge Ratio (Ql+Qr)/Qt (ME +1/1a); (Ql+Qr)/Qt",100,-0.1,1.1));
202  hRHRatioQ.push_back(dbe->book1D("hRHRatioQp21","Charge Ratio (Ql+Qr)/Qt (ME +2/1); (Ql+Qr)/Qt",100,-0.1,1.1));
203  hRHRatioQ.push_back(dbe->book1D("hRHRatioQp22","Charge Ratio (Ql+Qr)/Qt (ME +2/2); (Ql+Qr)/Qt",100,-0.1,1.1));
204  hRHRatioQ.push_back(dbe->book1D("hRHRatioQp31","Charge Ratio (Ql+Qr)/Qt (ME +3/1); (Ql+Qr)/Qt",100,-0.1,1.1));
205  hRHRatioQ.push_back(dbe->book1D("hRHRatioQp32","Charge Ratio (Ql+Qr)/Qt (ME +3/2); (Ql+Qr)/Qt",100,-0.1,1.1));
206  hRHRatioQ.push_back(dbe->book1D("hRHRatioQp41","Charge Ratio (Ql+Qr)/Qt (ME +4/1); (Ql+Qr)/Qt",100,-0.1,1.1));
207  hRHRatioQ.push_back(dbe->book1D("hRHRatioQp42","Charge Ratio (Ql+Qr)/Qt (ME +4/2); (Ql+Qr)/Qt",100,-0.1,1.1));
208  hRHTiming.push_back(dbe->book1D("hRHTimingm42","recHit Time (ME -4/2); ns",200,-500.,500.));
209  hRHTiming.push_back(dbe->book1D("hRHTimingm41","recHit Time (ME -4/1); ns",200,-500.,500.));
210  hRHTiming.push_back(dbe->book1D("hRHTimingm32","recHit Time (ME -3/2); ns",200,-500.,500.));
211  hRHTiming.push_back(dbe->book1D("hRHTimingm31","recHit Time (ME -3/1); ns",200,-500.,500.));
212  hRHTiming.push_back(dbe->book1D("hRHTimingm22","recHit Time (ME -2/2); ns",200,-500.,500.));
213  hRHTiming.push_back(dbe->book1D("hRHTimingm21","recHit Time (ME -2/1); ns",200,-500.,500.));
214  hRHTiming.push_back(dbe->book1D("hRHTimingm11a","recHit Time (ME -1/1a); ns",200,-500.,500.));
215  hRHTiming.push_back(dbe->book1D("hRHTimingm13","recHit Time (ME -1/3); ns",200,-500.,500.));
216  hRHTiming.push_back(dbe->book1D("hRHTimingm12","recHit Time (ME -1/2); ns",200,-500.,500.));
217  hRHTiming.push_back(dbe->book1D("hRHTimingm11b","recHit Time (ME -1/1b); ns",200,-500.,500.));
218  hRHTiming.push_back(dbe->book1D("hRHTimingp11b","recHit Time (ME +1/1b); ns",200,-500.,500.));
219  hRHTiming.push_back(dbe->book1D("hRHTimingp12","recHit Time (ME +1/2); ns",200,-500.,500.));
220  hRHTiming.push_back(dbe->book1D("hRHTimingp13","recHit Time (ME +1/3); ns",200,-500.,500.));
221  hRHTiming.push_back(dbe->book1D("hRHTimingp11a","recHit Time (ME +1/1a); ns",200,-500.,500.));
222  hRHTiming.push_back(dbe->book1D("hRHTimingp21","recHit Time (ME +2/1); ns",200,-500.,500.));
223  hRHTiming.push_back(dbe->book1D("hRHTimingp22","recHit Time (ME +2/2); ns",200,-500.,500.));
224  hRHTiming.push_back(dbe->book1D("hRHTimingp31","recHit Time (ME +3/1); ns",200,-500.,500.));
225  hRHTiming.push_back(dbe->book1D("hRHTimingp32","recHit Time (ME +3/2); ns",200,-500.,500.));
226  hRHTiming.push_back(dbe->book1D("hRHTimingp41","recHit Time (ME +4/1); ns",200,-500.,500.));
227  hRHTiming.push_back(dbe->book1D("hRHTimingp42","recHit Time (ME +4/2); ns",200,-500.,500.));
228  hRHTimingAnode.push_back(dbe->book1D("hRHTimingAnodem42","Anode recHit Time (ME -4/2); ns",80,-500.,500.));
229  hRHTimingAnode.push_back(dbe->book1D("hRHTimingAnodem41","Anode recHit Time (ME -4/1); ns",80,-500.,500.));
230  hRHTimingAnode.push_back(dbe->book1D("hRHTimingAnodem32","Anode recHit Time (ME -3/2); ns",80,-500.,500.));
231  hRHTimingAnode.push_back(dbe->book1D("hRHTimingAnodem31","Anode recHit Time (ME -3/1); ns",80,-500.,500.));
232  hRHTimingAnode.push_back(dbe->book1D("hRHTimingAnodem22","Anode recHit Time (ME -2/2); ns",80,-500.,500.));
233  hRHTimingAnode.push_back(dbe->book1D("hRHTimingAnodem21","Anode recHit Time (ME -2/1); ns",80,-500.,500.));
234  hRHTimingAnode.push_back(dbe->book1D("hRHTimingAnodem11a","Anode recHit Time (ME -1/1a); ns",80,-500.,500.));
235  hRHTimingAnode.push_back(dbe->book1D("hRHTimingAnodem13","Anode recHit Time (ME -1/3); ns",80,-500.,500.));
236  hRHTimingAnode.push_back(dbe->book1D("hRHTimingAnodem12","Anode recHit Time (ME -1/2); ns",80,-500.,500.));
237  hRHTimingAnode.push_back(dbe->book1D("hRHTimingAnodem11b","Anode recHit Time (ME -1/1b); ns",80,-500.,500.));
238  hRHTimingAnode.push_back(dbe->book1D("hRHTimingAnodep11b","Anode recHit Time (ME +1/1b); ns",80,-500.,500.));
239  hRHTimingAnode.push_back(dbe->book1D("hRHTimingAnodep12","Anode recHit Time (ME +1/2); ns",80,-500.,500.));
240  hRHTimingAnode.push_back(dbe->book1D("hRHTimingAnodep13","Anode recHit Time (ME +1/3); ns",80,-500.,500.));
241  hRHTimingAnode.push_back(dbe->book1D("hRHTimingAnodep11a","Anode recHit Time (ME +1/1a); ns",80,-500.,500.));
242  hRHTimingAnode.push_back(dbe->book1D("hRHTimingAnodep21","Anode recHit Time (ME +2/1); ns",80,-500.,500.));
243  hRHTimingAnode.push_back(dbe->book1D("hRHTimingAnodep22","Anode recHit Time (ME +2/2); ns",80,-500.,500.));
244  hRHTimingAnode.push_back(dbe->book1D("hRHTimingAnodep31","Anode recHit Time (ME +3/1); ns",80,-500.,500.));
245  hRHTimingAnode.push_back(dbe->book1D("hRHTimingAnodep32","Anode recHit Time (ME +3/2); ns",80,-500.,500.));
246  hRHTimingAnode.push_back(dbe->book1D("hRHTimingAnodep41","Anode recHit Time (ME +4/1); ns",80,-500.,500.));
247  hRHTimingAnode.push_back(dbe->book1D("hRHTimingAnodep42","Anode recHit Time (ME +4/2); ns",80,-500.,500.));
248  hRHstpos.push_back(dbe->book1D("hRHstposm42","Reconstructed Position on Strip (ME -4/2); Strip Widths",120,-0.6,0.6));
249  hRHstpos.push_back(dbe->book1D("hRHstposm41","Reconstructed Position on Strip (ME -4/1); Strip Widths",120,-0.6,0.6));
250  hRHstpos.push_back(dbe->book1D("hRHstposm32","Reconstructed Position on Strip (ME -3/2); Strip Widths",120,-0.6,0.6));
251  hRHstpos.push_back(dbe->book1D("hRHstposm31","Reconstructed Position on Strip (ME -3/1); Strip Widths",120,-0.6,0.6));
252  hRHstpos.push_back(dbe->book1D("hRHstposm22","Reconstructed Position on Strip (ME -2/2); Strip Widths",120,-0.6,0.6));
253  hRHstpos.push_back(dbe->book1D("hRHstposm21","Reconstructed Position on Strip (ME -2/1); Strip Widths",120,-0.6,0.6));
254  hRHstpos.push_back(dbe->book1D("hRHstposm11a","Reconstructed Position on Strip (ME -1/1a); Strip Widths",120,-0.6,0.6));
255  hRHstpos.push_back(dbe->book1D("hRHstposm13","Reconstructed Position on Strip (ME -1/3); Strip Widths",120,-0.6,0.6));
256  hRHstpos.push_back(dbe->book1D("hRHstposm12","Reconstructed Position on Strip (ME -1/2); Strip Widths",120,-0.6,0.6));
257  hRHstpos.push_back(dbe->book1D("hRHstposm11b","Reconstructed Position on Strip (ME -1/1b); Strip Widths",120,-0.6,0.6));
258  hRHstpos.push_back(dbe->book1D("hRHstposp11b","Reconstructed Position on Strip (ME +1/1b); Strip Widths",120,-0.6,0.6));
259  hRHstpos.push_back(dbe->book1D("hRHstposp12","Reconstructed Position on Strip (ME +1/2); Strip Widths",120,-0.6,0.6));
260  hRHstpos.push_back(dbe->book1D("hRHstposp13","Reconstructed Position on Strip (ME +1/3); Strip Widths",120,-0.6,0.6));
261  hRHstpos.push_back(dbe->book1D("hRHstposp11a","Reconstructed Position on Strip (ME +1/1a); Strip Widths",120,-0.6,0.6));
262  hRHstpos.push_back(dbe->book1D("hRHstposp21","Reconstructed Position on Strip (ME +2/1); Strip Widths",120,-0.6,0.6));
263  hRHstpos.push_back(dbe->book1D("hRHstposp22","Reconstructed Position on Strip (ME +2/2); Strip Widths",120,-0.6,0.6));
264  hRHstpos.push_back(dbe->book1D("hRHstposp31","Reconstructed Position on Strip (ME +3/1); Strip Widths",120,-0.6,0.6));
265  hRHstpos.push_back(dbe->book1D("hRHstposp32","Reconstructed Position on Strip (ME +3/2); Strip Widths",120,-0.6,0.6));
266  hRHstpos.push_back(dbe->book1D("hRHstposp41","Reconstructed Position on Strip (ME +4/1); Strip Widths",120,-0.6,0.6));
267  hRHstpos.push_back(dbe->book1D("hRHstposp42","Reconstructed Position on Strip (ME +4/2); Strip Widths",120,-0.6,0.6));
268  hRHsterr.push_back(dbe->book1D("hRHsterrm42","Estimated Error on Strip Measurement (ME -4/2); Strip Widths",75,-0.01,0.24));
269  hRHsterr.push_back(dbe->book1D("hRHsterrm41","Estimated Error on Strip Measurement (ME -4/1); Strip Widths",75,-0.01,0.24));
270  hRHsterr.push_back(dbe->book1D("hRHsterrm32","Estimated Error on Strip Measurement (ME -3/2); Strip Widths",75,-0.01,0.24));
271  hRHsterr.push_back(dbe->book1D("hRHsterrm31","Estimated Error on Strip Measurement (ME -3/1); Strip Widths",75,-0.01,0.24));
272  hRHsterr.push_back(dbe->book1D("hRHsterrm22","Estimated Error on Strip Measurement (ME -2/2); Strip Widths",75,-0.01,0.24));
273  hRHsterr.push_back(dbe->book1D("hRHsterrm21","Estimated Error on Strip Measurement (ME -2/1); Strip Widths",75,-0.01,0.24));
274  hRHsterr.push_back(dbe->book1D("hRHsterrm11a","Estimated Error on Strip Measurement (ME -1/1a); Strip Widths",75,-0.01,0.24));
275  hRHsterr.push_back(dbe->book1D("hRHsterrm13","Estimated Error on Strip Measurement (ME -1/3); Strip Widths",75,-0.01,0.24));
276  hRHsterr.push_back(dbe->book1D("hRHsterrm12","Estimated Error on Strip Measurement (ME -1/2); Strip Widths",75,-0.01,0.24));
277  hRHsterr.push_back(dbe->book1D("hRHsterrm11b","Estimated Error on Strip Measurement (ME -1/1b); Strip Widths",75,-0.01,0.24));
278  hRHsterr.push_back(dbe->book1D("hRHsterrp11b","Estimated Error on Strip Measurement (ME +1/1b); Strip Widths",75,-0.01,0.24));
279  hRHsterr.push_back(dbe->book1D("hRHsterrp12","Estimated Error on Strip Measurement (ME +1/2); Strip Widths",75,-0.01,0.24));
280  hRHsterr.push_back(dbe->book1D("hRHsterrp13","Estimated Error on Strip Measurement (ME +1/3); Strip Widths",75,-0.01,0.24));
281  hRHsterr.push_back(dbe->book1D("hRHsterrp11a","Estimated Error on Strip Measurement (ME +1/1a); Strip Widths",75,-0.01,0.24));
282  hRHsterr.push_back(dbe->book1D("hRHsterrp21","Estimated Error on Strip Measurement (ME +2/1); Strip Widths",75,-0.01,0.24));
283  hRHsterr.push_back(dbe->book1D("hRHsterrp22","Estimated Error on Strip Measurement (ME +2/2); Strip Widths",75,-0.01,0.24));
284  hRHsterr.push_back(dbe->book1D("hRHsterrp31","Estimated Error on Strip Measurement (ME +3/1); Strip Widths",75,-0.01,0.24));
285  hRHsterr.push_back(dbe->book1D("hRHsterrp32","Estimated Error on Strip Measurement (ME +3/2); Strip Widths",75,-0.01,0.24));
286  hRHsterr.push_back(dbe->book1D("hRHsterrp41","Estimated Error on Strip Measurement (ME +4/1); Strip Widths",75,-0.01,0.24));
287  hRHsterr.push_back(dbe->book1D("hRHsterrp42","Estimated Error on Strip Measurement (ME +4/2); Strip Widths",75,-0.01,0.24));
288 
289 
290  // segments
291  dbe->setCurrentFolder("CSC/CSCOfflineMonitor/Segments");
292  hSnSegments = dbe->book1D("hSnSegments","Number of Segments per Event; # of Segments",11,-0.5,10.5);
293  hSnhitsAll = dbe->book1D("hSnhits","N hits on Segments; # of hits",8,-0.5,7.5);
294  hSnhits.push_back(dbe->book1D("hSnhitsm42","# of hits on Segments (ME -4/2); # of hits",8,-0.5,7.5));
295  hSnhits.push_back(dbe->book1D("hSnhitsm41","# of hits on Segments (ME -4/1); # of hits",8,-0.5,7.5));
296  hSnhits.push_back(dbe->book1D("hSnhitsm32","# of hits on Segments (ME -3/2); # of hits",8,-0.5,7.5));
297  hSnhits.push_back(dbe->book1D("hSnhitsm31","# of hits on Segments (ME -3/1); # of hits",8,-0.5,7.5));
298  hSnhits.push_back(dbe->book1D("hSnhitsm22","# of hits on Segments (ME -2/2); # of hits",8,-0.5,7.5));
299  hSnhits.push_back(dbe->book1D("hSnhitsm21","# of hits on Segments (ME -2/1); # of hits",8,-0.5,7.5));
300  hSnhits.push_back(dbe->book1D("hSnhitsm11a","# of hits on Segments (ME -1/1a); # of hits",8,-0.5,7.5));
301  hSnhits.push_back(dbe->book1D("hSnhitsm13","# of hits on Segments (ME -1/3); # of hits",8,-0.5,7.5));
302  hSnhits.push_back(dbe->book1D("hSnhitsm12","# of hits on Segments (ME -1/2); # of hits",8,-0.5,7.5));
303  hSnhits.push_back(dbe->book1D("hSnhitsm11b","# of hits on Segments (ME -1/1b); # of hits",8,-0.5,7.5));
304  hSnhits.push_back(dbe->book1D("hSnhitsp11b","# of hits on Segments (ME +1/1b); # of hits",8,-0.5,7.5));
305  hSnhits.push_back(dbe->book1D("hSnhitsp12","# of hits on Segments (ME +1/2); # of hits",8,-0.5,7.5));
306  hSnhits.push_back(dbe->book1D("hSnhitsp13","# of hits on Segments (ME +1/3); # of hits",8,-0.5,7.5));
307  hSnhits.push_back(dbe->book1D("hSnhitsp11a","# of hits on Segments (ME +1/1a); # of hits",8,-0.5,7.5));
308  hSnhits.push_back(dbe->book1D("hSnhitsp21","# of hits on Segments (ME +2/1); # of hits",8,-0.5,7.5));
309  hSnhits.push_back(dbe->book1D("hSnhitsp22","# of hits on Segments (ME +2/2); # of hits",8,-0.5,7.5));
310  hSnhits.push_back(dbe->book1D("hSnhitsp31","# of hits on Segments (ME +3/1); # of hits",8,-0.5,7.5));
311  hSnhits.push_back(dbe->book1D("hSnhitsp32","# of hits on Segments (ME +3/2); # of hits",8,-0.5,7.5));
312  hSnhits.push_back(dbe->book1D("hSnhitsp41","# of hits on Segments (ME +4/1); # of hits",8,-0.5,7.5));
313  hSnhits.push_back(dbe->book1D("hSnhitsp42","# of hits on Segments (ME +4/2); # of hits",8,-0.5,7.5));
314  hSChiSqAll = dbe->book1D("hSChiSq","Segment Normalized Chi2; Chi2/ndof",110,-0.05,10.5);
315  hSChiSq.push_back(dbe->book1D("hSChiSqm42","Segment Normalized Chi2 (ME -4/2); Chi2/ndof",110,-0.05,10.5));
316  hSChiSq.push_back(dbe->book1D("hSChiSqm41","Segment Normalized Chi2 (ME -4/1); Chi2/ndof",110,-0.05,10.5));
317  hSChiSq.push_back(dbe->book1D("hSChiSqm32","Segment Normalized Chi2 (ME -3/2); Chi2/ndof",110,-0.05,10.5));
318  hSChiSq.push_back(dbe->book1D("hSChiSqm31","Segment Normalized Chi2 (ME -3/1); Chi2/ndof",110,-0.05,10.5));
319  hSChiSq.push_back(dbe->book1D("hSChiSqm22","Segment Normalized Chi2 (ME -2/2); Chi2/ndof",110,-0.05,10.5));
320  hSChiSq.push_back(dbe->book1D("hSChiSqm21","Segment Normalized Chi2 (ME -2/1); Chi2/ndof",110,-0.05,10.5));
321  hSChiSq.push_back(dbe->book1D("hSChiSqm11a","Segment Normalized Chi2 (ME -1/1a); Chi2/ndof",110,-0.05,10.5));
322  hSChiSq.push_back(dbe->book1D("hSChiSqm13","Segment Normalized Chi2 (ME -1/3); Chi2/ndof",110,-0.05,10.5));
323  hSChiSq.push_back(dbe->book1D("hSChiSqm12","Segment Normalized Chi2 (ME -1/2); Chi2/ndof",110,-0.05,10.5));
324  hSChiSq.push_back(dbe->book1D("hSChiSqm11b","Segment Normalized Chi2 (ME -1/1b); Chi2/ndof",110,-0.05,10.5));
325  hSChiSq.push_back(dbe->book1D("hSChiSqp11b","Segment Normalized Chi2 (ME +1/1b); Chi2/ndof",110,-0.05,10.5));
326  hSChiSq.push_back(dbe->book1D("hSChiSqp12","Segment Normalized Chi2 (ME +1/2); Chi2/ndof",110,-0.05,10.5));
327  hSChiSq.push_back(dbe->book1D("hSChiSqp13","Segment Normalized Chi2 (ME +1/3); Chi2/ndof",110,-0.05,10.5));
328  hSChiSq.push_back(dbe->book1D("hSChiSqp11a","Segment Normalized Chi2 (ME +1/1a); Chi2/ndof",110,-0.05,10.5));
329  hSChiSq.push_back(dbe->book1D("hSChiSqp21","Segment Normalized Chi2 (ME +2/1); Chi2/ndof",110,-0.05,10.5));
330  hSChiSq.push_back(dbe->book1D("hSChiSqp22","Segment Normalized Chi2 (ME +2/2); Chi2/ndof",110,-0.05,10.5));
331  hSChiSq.push_back(dbe->book1D("hSChiSqp31","Segment Normalized Chi2 (ME +3/1); Chi2/ndof",110,-0.05,10.5));
332  hSChiSq.push_back(dbe->book1D("hSChiSqp32","Segment Normalized Chi2 (ME +3/2); Chi2/ndof",110,-0.05,10.5));
333  hSChiSq.push_back(dbe->book1D("hSChiSqp41","Segment Normalized Chi2 (ME +4/1); Chi2/ndof",110,-0.05,10.5));
334  hSChiSq.push_back(dbe->book1D("hSChiSqp42","Segment Normalized Chi2 (ME +4/2); Chi2/ndof",110,-0.05,10.5));
335  hSChiSqProbAll = dbe->book1D("hSChiSqProb","Segment chi2 Probability; Probability",110,-0.05,1.05);
336  hSChiSqProb.push_back(dbe->book1D("hSChiSqProbm42","Segment chi2 Probability (ME -4/2); Probability",110,-0.05,1.05));
337  hSChiSqProb.push_back(dbe->book1D("hSChiSqProbm41","Segment chi2 Probability (ME -4/1); Probability",110,-0.05,1.05));
338  hSChiSqProb.push_back(dbe->book1D("hSChiSqProbm32","Segment chi2 Probability (ME -3/2); Probability",110,-0.05,1.05));
339  hSChiSqProb.push_back(dbe->book1D("hSChiSqProbm31","Segment chi2 Probability (ME -3/1); Probability",110,-0.05,1.05));
340  hSChiSqProb.push_back(dbe->book1D("hSChiSqProbm22","Segment chi2 Probability (ME -2/2); Probability",110,-0.05,1.05));
341  hSChiSqProb.push_back(dbe->book1D("hSChiSqProbm21","Segment chi2 Probability (ME -2/1); Probability",110,-0.05,1.05));
342  hSChiSqProb.push_back(dbe->book1D("hSChiSqProbm11a","Segment chi2 Probability (ME -1/1a); Probability",110,-0.05,1.05));
343  hSChiSqProb.push_back(dbe->book1D("hSChiSqProbm13","Segment chi2 Probability (ME -1/3); Probability",110,-0.05,1.05));
344  hSChiSqProb.push_back(dbe->book1D("hSChiSqProbm12","Segment chi2 Probability (ME -1/2); Probability",110,-0.05,1.05));
345  hSChiSqProb.push_back(dbe->book1D("hSChiSqProbm11b","Segment chi2 Probability (ME -1/1b); Probability",110,-0.05,1.05));
346  hSChiSqProb.push_back(dbe->book1D("hSChiSqProbp11b","Segment chi2 Probability (ME +1/1b); Probability",110,-0.05,1.05));
347  hSChiSqProb.push_back(dbe->book1D("hSChiSqProbp12","Segment chi2 Probability (ME +1/2); Probability",110,-0.05,1.05));
348  hSChiSqProb.push_back(dbe->book1D("hSChiSqProbp13","Segment chi2 Probability (ME +1/3); Probability",110,-0.05,1.05));
349  hSChiSqProb.push_back(dbe->book1D("hSChiSqProbp11a","Segment chi2 Probability (ME +1/1a); Probability",110,-0.05,1.05));
350  hSChiSqProb.push_back(dbe->book1D("hSChiSqProbp21","Segment chi2 Probability (ME +2/1); Probability",110,-0.05,1.05));
351  hSChiSqProb.push_back(dbe->book1D("hSChiSqProbp22","Segment chi2 Probability (ME +2/2); Probability",110,-0.05,1.05));
352  hSChiSqProb.push_back(dbe->book1D("hSChiSqProbp31","Segment chi2 Probability (ME +3/1); Probability",110,-0.05,1.05));
353  hSChiSqProb.push_back(dbe->book1D("hSChiSqProbp32","Segment chi2 Probability (ME +3/2); Probability",110,-0.05,1.05));
354  hSChiSqProb.push_back(dbe->book1D("hSChiSqProbp41","Segment chi2 Probability (ME +4/1); Probability",110,-0.05,1.05));
355  hSChiSqProb.push_back(dbe->book1D("hSChiSqProbp42","Segment chi2 Probability (ME +4/2); Probability",110,-0.05,1.05));
356  hSGlobalTheta = dbe->book1D("hSGlobalTheta","Segment Direction (Global Theta); Global Theta (radians)",136,-0.1,3.3);
357  hSGlobalPhi = dbe->book1D("hSGlobalPhi","Segment Direction (Global Phi); Global Phi (radians)", 128,-3.2,3.2);
358  hSTimeCathode = dbe->book1D("hSTimeCathode", "Cathode Only Segment Time [ns]",200,-200,200);
359  hSTimeCombined = dbe->book1D("hSTimeCombined", "Segment Time (anode+cathode times) [ns]",200,-200,200);
360  hSTimeVsZ = dbe->book2D("hSTimeVsZ","Segment Time vs. Z; [ns] vs. [cm]",200,-1200,1200,200,-200,200);
361  hSTimeVsTOF = dbe->book2D("hSTimeVsTOF","Segment Time vs. Distance from IP; [ns] vs. [cm]",180,500,1400, 200,-200,200);
362  // Resolution
363  dbe->setCurrentFolder("CSC/CSCOfflineMonitor/Resolution");
364  hSResid.push_back(dbe->book1D("hSResidm42","Fitted Position on Strip - Reconstructed for Layer 3 (ME -4/2); Strip Widths",100,-0.5,0.5));
365  hSResid.push_back(dbe->book1D("hSResidm41","Fitted Position on Strip - Reconstructed for Layer 3 (ME -4/1); Strip Widths",100,-0.5,0.5));
366  hSResid.push_back(dbe->book1D("hSResidm32","Fitted Position on Strip - Reconstructed for Layer 3 (ME -3/2); Strip Widths",100,-0.5,0.5));
367  hSResid.push_back(dbe->book1D("hSResidm31","Fitted Position on Strip - Reconstructed for Layer 3 (ME -3/1); Strip Widths",100,-0.5,0.5));
368  hSResid.push_back(dbe->book1D("hSResidm22","Fitted Position on Strip - Reconstructed for Layer 3 (ME -2/2); Strip Widths",100,-0.5,0.5));
369  hSResid.push_back(dbe->book1D("hSResidm21","Fitted Position on Strip - Reconstructed for Layer 3 (ME -2/1); Strip Widths",100,-0.5,0.5));
370  hSResid.push_back(dbe->book1D("hSResidm11a","Fitted Position on Strip - Reconstructed for Layer 3 (ME -1/1a); Strip Widths",100,-0.5,0.5));
371  hSResid.push_back(dbe->book1D("hSResidm13","Fitted Position on Strip - Reconstructed for Layer 3 (ME -1/3); Strip Widths",100,-0.5,0.5));
372  hSResid.push_back(dbe->book1D("hSResidm12","Fitted Position on Strip - Reconstructed for Layer 3 (ME -1/2); Strip Widths",100,-0.5,0.5));
373  hSResid.push_back(dbe->book1D("hSResidm11b","Fitted Position on Strip - Reconstructed for Layer 3 (ME -1/1b); Strip Widths",100,-0.5,0.5));
374  hSResid.push_back(dbe->book1D("hSResidp11b","Fitted Position on Strip - Reconstructed for Layer 3 (ME +1/1b); Strip Widths",100,-0.5,0.5));
375  hSResid.push_back(dbe->book1D("hSResidp12","Fitted Position on Strip - Reconstructed for Layer 3 (ME +1/2); Strip Widths",100,-0.5,0.5));
376  hSResid.push_back(dbe->book1D("hSResidp13","Fitted Position on Strip - Reconstructed for Layer 3 (ME +1/3); Strip Widths",100,-0.5,0.5));
377  hSResid.push_back(dbe->book1D("hSResidp11a","Fitted Position on Strip - Reconstructed for Layer 3 (ME +1/1a); Strip Widths",100,-0.5,0.5));
378  hSResid.push_back(dbe->book1D("hSResidp21","Fitted Position on Strip - Reconstructed for Layer 3 (ME +2/1); Strip Widths",100,-0.5,0.5));
379  hSResid.push_back(dbe->book1D("hSResidp22","Fitted Position on Strip - Reconstructed for Layer 3 (ME +2/2); Strip Widths",100,-0.5,0.5));
380  hSResid.push_back(dbe->book1D("hSResidp31","Fitted Position on Strip - Reconstructed for Layer 3 (ME +3/1); Strip Widths",100,-0.5,0.5));
381  hSResid.push_back(dbe->book1D("hSResidp32","Fitted Position on Strip - Reconstructed for Layer 3 (ME +3/2); Strip Widths",100,-0.5,0.5));
382  hSResid.push_back(dbe->book1D("hSResidp41","Fitted Position on Strip - Reconstructed for Layer 3 (ME +4/1); Strip Widths",100,-0.5,0.5));
383  hSResid.push_back(dbe->book1D("hSResidp42","Fitted Position on Strip - Reconstructed for Layer 3 (ME +4/2); Strip Widths",100,-0.5,0.5));
384 
385  // Efficiency
386 
387  dbe->setCurrentFolder("CSC/CSCOfflineMonitor/Efficiency");
388  hSSTE = dbe->book1D("hSSTE","hSSTE",40,0.5,40.5);
389  hRHSTE = dbe->book1D("hRHSTE","hRHSTE",40,0.5,40.5);
390  hSEff = dbe->book1D("hSEff","Segment Efficiency",20,0.5,20.5);
391  hRHEff = dbe->book1D("hRHEff","recHit Efficiency",20,0.5,20.5);
392  hSSTE2 = dbe->book2D("hSSTE2","hSSTE2",36,0.5,36.5, 18, 0.5, 18.5);
393  hRHSTE2 = dbe->book2D("hRHSTE2","hRHSTE2",36,0.5,36.5, 18, 0.5, 18.5);
394  hStripSTE2 = dbe->book2D("hStripSTE2","hStripSTE2",36,0.5,36.5, 18, 0.5, 18.5);
395  hWireSTE2 = dbe->book2D("hWireSTE2","hWireSTE2",36,0.5,36.5, 18, 0.5, 18.5);
396  hEffDenominator = dbe->book2D("hEffDenominator","hEffDenominator",36,0.5,36.5, 18, 0.5, 18.5);
397  hSEff2 = dbe->book2D("hSEff2","Segment Efficiency 2D",36,0.5,36.5, 18, 0.5, 18.5);
398  hRHEff2 = dbe->book2D("hRHEff2","recHit Efficiency 2D",36,0.5,36.5, 18, 0.5, 18.5);
399  hStripReadoutEff2 = dbe->book2D("hStripReadoutEff2","strip readout ratio [(strip+clct+wires)/(clct+wires)] 2D",36,0.5,36.5, 20, 0.5, 20.5);
400  hStripReadoutEff2->setAxisTitle("Chamber #");
401  hStripEff2 = dbe->book2D("hStripEff2","strip Efficiency 2D",36,0.5,36.5, 18, 0.5, 18.5);
402  hWireEff2 = dbe->book2D("hWireEff2","wire Efficiency 2D",36,0.5,36.5, 18, 0.5, 18.5);
403  hSensitiveAreaEvt = dbe->book2D("hSensitiveAreaEvt","Events Passing Selection for Efficiency",36,0.5,36.5, 18, 0.5, 18.5);
404 
405  // BX Monitor for trigger synchronization
406  dbe->setCurrentFolder("CSC/CSCOfflineMonitor/BXMonitor");
407  hALCTgetBX = dbe->book1D("hALCTgetBX","ALCT position in ALCT-L1A match window [BX]",7,-0.5,6.5);
408  hALCTgetBXChamberMeans = dbe->book1D("hALCTgetBXChamberMeans","Chamber Mean ALCT position in ALCT-L1A match window [BX]",60,0,6);
409  hALCTgetBXSerial = dbe->book2D("hALCTgetBXSerial","ALCT position in ALCT-L1A match window [BX]",601,-0.5,600.5,7,-0.5,6.5);
410  hALCTgetBXSerial->setAxisTitle("Chamber Serial Number");
411  hALCTgetBX2DNumerator = dbe->book2D("hALCTgetBX2DNumerator","ALCT position in ALCT-L1A match window [BX] (sum)",36,0.5,36.5,20,0.5,20.5);
412  hALCTgetBX2DMeans = dbe->book2D("hALCTgetBX2DMeans","ALCT position in ALCT-L1A match window [BX]",36,0.5,36.5,20,0.5,20.5);
413  hALCTgetBX2Denominator = dbe->book2D("hALCTgetBX2Denominator","Number of ALCT Digis checked",36,0.5,36.5,20,0.5,20.5);
414  hALCTgetBX2DMeans->setAxisTitle("Chamber #");
415  hALCTgetBX2Denominator->setAxisTitle("Chamber #");
416  hALCTMatch = dbe->book1D("hALCTMatch","ALCT position in ALCT-CLCT match window [BX]",7,-0.5,6.5);
417  hALCTMatchChamberMeans = dbe->book1D("hALCTMatchChamberMeans","Chamber Mean ALCT position in ALCT-CLCT match window [BX]",60,0,6);
418  hALCTMatchSerial = dbe->book2D("hALCTMatchSerial","ALCT position in ALCT-CLCT match window [BX]",601,-0.5,600.5,7,-0.5,6.5);
419  hALCTMatchSerial->setAxisTitle("Chamber Serial Number");
420  hALCTMatch2DNumerator = dbe->book2D("hALCTMatch2DNumerator","ALCT position in ALCT-CLCT match window [BX] (sum)",36,0.5,36.5,20,0.5,20.5);
421  hALCTMatch2DMeans = dbe->book2D("hALCTMatch2DMeans","ALCT position in ALCT-CLCT match window [BX]",36,0.5,36.5,20,0.5,20.5);
422  hALCTMatch2Denominator = dbe->book2D("hALCTMatch2Denominator","Number of ALCT-CLCT matches checked",36,0.5,36.5,20,0.5,20.5);
423  hALCTMatch2DMeans->setAxisTitle("Chamber #");
424  hALCTMatch2Denominator->setAxisTitle("Chamber #");
425  hCLCTL1A = dbe->book1D("hCLCTL1A","L1A - CLCTpreTrigger at TMB [BX]",10,149.5,159.5);
426  hCLCTL1AChamberMeans = dbe->book1D("hCLCTL1AChamberMeans","Chamber Mean L1A - CLCTpreTrigger at TMB [BX]",90,150,159);
427  hCLCTL1ASerial = dbe->book2D("hCLCTL1ASerial","L1A - CLCTpreTrigger at TMB [BX]",601,-0.5,600.5,10,149.5,159.5);
428  hCLCTL1ASerial->setAxisTitle("Chamber Serial Number");
429  hCLCTL1A2DNumerator = dbe->book2D("hCLCTL1A2DNumerator","L1A - CLCTpreTrigger at TMB [BX] (sum)",36,0.5,36.5,20,0.5,20.5);
430  hCLCTL1A2DMeans = dbe->book2D("hCLCTL1A2DMeans","L1A - CLCTpreTrigger at TMB [BX]",36,0.5,36.5,20,0.5,20.5);
431  hCLCTL1A2Denominator = dbe->book2D("hCLCTL1A2Denominator","Number of TMB CLCTs checked",36,0.5,36.5,20,0.5,20.5);
432 
433 
434  // Set all Labels
460 }
461 
462 
464 
465  if (!finalizedHistograms_){
466  finalize() ;
468  }
469 
470 }
471 
473  if(nullptr == dbe) {
474  return;
475  }
476  finalize() ;
478 
479  bool saveHistos = param.getParameter<bool>("saveHistos");
480  string outputFileName = param.getParameter<string>("outputFileName");
481  if(saveHistos){
482  dbe->save(outputFileName);
483  }
484 
485 }
486 
487 
489 
490  hRHEff = dbe->get("CSC/CSCOfflineMonitor/Efficiency/hRHEff");
491  hSEff = dbe->get("CSC/CSCOfflineMonitor/Efficiency/hSEff");
492  hSEff2 = dbe->get("CSC/CSCOfflineMonitor/Efficiency/hSEff2");
493  hRHEff2 = dbe->get("CSC/CSCOfflineMonitor/Efficiency/hRHEff2");
494  hStripEff2 = dbe->get("CSC/CSCOfflineMonitor/Efficiency/hStripEff2");
495  hWireEff2 = dbe->get("CSC/CSCOfflineMonitor/Efficiency/hWireEff2");
496 
497  hOStripsAndWiresAndCLCT= dbe->get("CSC/CSCOfflineMonitor/Occupancy/hOStripsAndWiresAndCLCT");
498  hOWiresAndCLCT= dbe->get("CSC/CSCOfflineMonitor/Occupancy/hOWiresAndCLCT");
499  hStripReadoutEff2 = dbe->get("CSC/CSCOfflineMonitor/Efficiency/hStripReadoutEff2");
500 
501  hALCTgetBX2DMeans = dbe->get("CSC/CSCOfflineMonitor/BXMonitor/hALCTgetBX2DMeans");
502  hALCTMatch2DMeans = dbe->get("CSC/CSCOfflineMonitor/BXMonitor/hALCTMatch2DMeans");
503  hCLCTL1A2DMeans = dbe->get("CSC/CSCOfflineMonitor/BXMonitor/hCLCTL1A2DMeans");
504 
505  hALCTgetBXSerial = dbe->get("CSC/CSCOfflineMonitor/BXMonitor/hALCTgetBXSerial");
506  hALCTMatchSerial = dbe->get("CSC/CSCOfflineMonitor/BXMonitor/hALCTMatchSerial");
507  hCLCTL1ASerial = dbe->get("CSC/CSCOfflineMonitor/BXMonitor/hCLCTL1ASerial");
508 
509  hALCTgetBXChamberMeans = dbe->get("CSC/CSCOfflineMonitor/BXMonitor/hALCTgetBXChamberMeans");
510  hALCTMatchChamberMeans = dbe->get("CSC/CSCOfflineMonitor/BXMonitor/hALCTMatchChamberMeans");
511  hCLCTL1AChamberMeans = dbe->get("CSC/CSCOfflineMonitor/BXMonitor/hCLCTL1AChamberMeans");
512 
515  if (hSEff2) hSEff2->getTH2F()->Divide(hSSTE2->getTH2F(),\
516  hEffDenominator->getTH2F(), 1., 1.,"B");
517  if (hRHEff2) hRHEff2->getTH2F()->Divide(hRHSTE2->getTH2F(),\
518  hEffDenominator->getTH2F(), 1., 1., "B");
519  if (hStripEff2) hStripEff2->getTH2F()->Divide(hStripSTE2->getTH2F(),\
520  hEffDenominator->getTH2F(), 1., 1., "B");
521  if (hWireEff2) hWireEff2->getTH2F()->Divide(hWireSTE2->getTH2F(),\
522  hEffDenominator->getTH2F(), 1., 1., "B");
524  hOWiresAndCLCT->getTH2F(), 1., 1., "B");
525  if (hALCTMatch2DMeans){
530  }
531  if (hALCTgetBX2DMeans) {
536  }
537  if (hCLCTL1A2DMeans) {
542  }
543 
547 
548 
549 }
550 
552  MonitorElement *meMean2D,\
553  MonitorElement *hNum,\
554  MonitorElement *meDenom){
555 
556 
557  if (hNum->getNbinsY()!= meDenom->getNbinsY() || hNum->getNbinsX()!= meDenom->getNbinsX())
558  return;
559  if (meMean2D->getNbinsY()!= meDenom->getNbinsY() || meMean2D->getNbinsX()!= meDenom->getNbinsX())
560  return;
561 
562  float mean;
563  for (int biny = 0; biny < hNum->getNbinsY()+1 ; biny++){
564  for (int binx = 0; binx < hNum->getNbinsX()+1 ; binx++){
565  if ( meDenom->getBinContent(binx,biny) > 0){
566  mean = hNum->getBinContent(binx,biny)/meDenom->getBinContent(binx,biny);
567  meMean1D->Fill(mean);
568  meMean2D->setBinContent(binx,biny,mean);
569  }
570  }
571  }
572 
573  return;
574 }
575 
577 
578  TH2F* h = me->getTH2F();
579  if (! h)
580  return;
581  TH1D* hproj = h->ProjectionX("hproj");
582 
583  for (int binx = 0; binx < h->GetNbinsX()+1 ; binx++){
584  Double_t entries = hproj->GetBinContent(binx);
585  for (Int_t biny=1;biny <= h->GetNbinsY();biny++) {
586  Double_t cxy = h->GetBinContent(binx,biny);
587  if (cxy > 0 && entries>0) h->SetBinContent(binx,biny,cxy/entries);
588  }
589  }
590 
591 
592  return;
593 
594 }
595 
596 
597 
599 // Analysis //
602 
607  event.getByToken( sd_token, strips );
608  event.getByToken( wd_token, wires );
609  event.getByToken( al_token, alcts );
610  event.getByToken( cl_token, clcts );
611 
612  // Get the CSC Geometry :
614  eventSetup.get<MuonGeometryRecord>().get(cscGeom);
615 
616  // Get the RecHits collection :
618  event.getByToken( rh_token, recHits );
619 
620  // get CSC segment collection
622  event.getByToken( se_token, cscSegments );
623 
624  doOccupancies(strips,wires,recHits,cscSegments,clcts);
625  doStripDigis(strips);
626  doWireDigis(wires);
627  doRecHits(recHits,strips,cscGeom);
628  doSegments(cscSegments,cscGeom);
629  doResolution(cscSegments,cscGeom);
630  doPedestalNoise(strips);
631  doEfficiencies(wires,strips, recHits, cscSegments,cscGeom);
632  doBXMonitor(alcts, clcts, event, eventSetup);
633 }
634 
635 // ==============================================
636 //
637 // look at Occupancies
638 //
639 // ==============================================
640 
644 
645  bool clcto[2][4][4][36];
646  bool wireo[2][4][4][36];
647  bool stripo[2][4][4][36];
648  bool rechito[2][4][4][36];
649  bool segmento[2][4][4][36];
650 
651  bool hasWires = false;
652  bool hasStrips = false;
653  bool hasRecHits = false;
654  bool hasSegments = false;
655 
656  for (int e = 0; e < 2; e++){
657  for (int s = 0; s < 4; s++){
658  for (int r = 0; r < 4; r++){
659  for (int c = 0; c < 36; c++){
660  clcto[e][s][r][c] = false;
661  wireo[e][s][r][c] = false;
662  stripo[e][s][r][c] = false;
663  rechito[e][s][r][c] = false;
664  segmento[e][s][r][c] = false;
665  }
666  }
667  }
668  }
669 
670  //clcts
671  for (CSCCLCTDigiCollection::DigiRangeIterator j=clcts->begin(); j!=clcts->end(); j++) {
672  CSCDetId id = (CSCDetId)(*j).first;
673  int kEndcap = id.endcap();
674  int kRing = id.ring();
675  int kStation = id.station();
676  int kChamber = id.chamber();
677  const CSCCLCTDigiCollection::Range& range =(*j).second;
678  for (CSCCLCTDigiCollection::const_iterator digiIt = range.first; digiIt!=range.second; ++digiIt){
679  // Valid digi in the chamber (or in neighbouring chamber)
680  if((*digiIt).isValid()){
681  //Check whether this CLCT came from ME11a
682  if( kStation ==1 && kRing==1 && (*digiIt).getKeyStrip()>128)
683  kRing = 4;
684  clcto[kEndcap-1][kStation-1][kRing-1][kChamber-1] = true;
685  }
686  }
687  }
688 
689  //wires
690  for (CSCWireDigiCollection::DigiRangeIterator wi=wires->begin(); wi!=wires->end(); wi++) {
691  CSCDetId id = (CSCDetId)(*wi).first;
692  int kEndcap = id.endcap();
693  int kRing = id.ring();
694  int kStation = id.station();
695  int kChamber = id.chamber();
696  std::vector<CSCWireDigi>::const_iterator wireIt = (*wi).second.first;
697  std::vector<CSCWireDigi>::const_iterator lastWire = (*wi).second.second;
698  for( ; wireIt != lastWire; ++wireIt){
699  if (!wireo[kEndcap-1][kStation-1][kRing-1][kChamber-1]){
700  wireo[kEndcap-1][kStation-1][kRing-1][kChamber-1] = true;
701  hOWires->Fill(kChamber,typeIndex(id,2));
703  hasWires = true;
704  if( clcto[kEndcap-1][kStation-1][kRing-1][kChamber-1])
705  hOWiresAndCLCT->Fill(kChamber,typeIndex(id,2));
706  //Also check for a CLCT in ME11a if you're in ME11 already
707  if (kStation==1 && kRing==1 && clcto[kEndcap-1][kStation-1][3][kChamber-1]){
708  CSCDetId idME11a = CSCDetId(kEndcap, kStation, 4, kChamber);
709  hOWiresAndCLCT->Fill(kChamber,typeIndex(idME11a,2));
710  }
711  }
712  }//end for loop
713  }
714 
715  //strips
716  for (CSCStripDigiCollection::DigiRangeIterator si=strips->begin(); si!=strips->end(); si++) {
717  CSCDetId id = (CSCDetId)(*si).first;
718  int kEndcap = id.endcap();
719  int kRing = id.ring();
720  int kStation = id.station();
721  int kChamber = id.chamber();
722  std::vector<CSCStripDigi>::const_iterator stripIt = (*si).second.first;
723  std::vector<CSCStripDigi>::const_iterator lastStrip = (*si).second.second;
724  for( ; stripIt != lastStrip; ++stripIt) {
725  std::vector<int> myADCVals = stripIt->getADCCounts();
726  bool thisStripFired = false;
727  float thisPedestal = 0.5*(float)(myADCVals[0]+myADCVals[1]);
728  float threshold = 13.3 ;
729  float diff = 0.;
730  for (unsigned int iCount = 0; iCount < myADCVals.size(); iCount++) {
731  diff = (float)myADCVals[iCount]-thisPedestal;
732  if (diff > threshold) { thisStripFired = true; }
733  }
734  if (thisStripFired) {
735  if (!stripo[kEndcap-1][kStation-1][kRing-1][kChamber-1]){
736  stripo[kEndcap-1][kStation-1][kRing-1][kChamber-1] = true;
737  hOStrips->Fill(kChamber,typeIndex(id,2));
739  hasStrips = true;
740  if (clcto[kEndcap-1][kStation-1][kRing-1][kChamber-1]){
741  // check if there is a wire digi in this chamber too
742  // for ME 1/4 check for a wire in ME 1/1
743  if(wireo[kEndcap-1][kStation-1][kRing-1][kChamber-1] || (kRing==4 && wireo[kEndcap-1][kStation-1][0][kChamber-1]) ){
744  hOStripsAndWiresAndCLCT->Fill(kChamber,typeIndex(id,2));
745  }
746  }//end clct and wire digi check
747  }
748  }//end if (thisStripFired)
749  }
750  }
751 
752  //rechits
754  for (recIt = recHits->begin(); recIt != recHits->end(); recIt++) {
755  CSCDetId idrec = (CSCDetId)(*recIt).cscDetId();
756  int kEndcap = idrec.endcap();
757  int kRing = idrec.ring();
758  int kStation = idrec.station();
759  int kChamber = idrec.chamber();
760  if (!rechito[kEndcap-1][kStation-1][kRing-1][kChamber-1]){
761  rechito[kEndcap-1][kStation-1][kRing-1][kChamber-1] = true;
763  hORecHits->Fill(kChamber,typeIndex(idrec,2));
764  hasRecHits = true;
765  }
766  }
767 
768  //segments
769  for(CSCSegmentCollection::const_iterator segIt=cscSegments->begin(); segIt != cscSegments->end(); segIt++) {
770  CSCDetId id = (CSCDetId)(*segIt).cscDetId();
771  int kEndcap = id.endcap();
772  int kRing = id.ring();
773  int kStation = id.station();
774  int kChamber = id.chamber();
775  if (!segmento[kEndcap-1][kStation-1][kRing-1][kChamber-1]){
776  segmento[kEndcap-1][kStation-1][kRing-1][kChamber-1] = true;
778  hOSegments->Fill(kChamber,typeIndex(id,2));
779  hasSegments = true;
780  }
781  }
782 
783  //Overall CSC Occupancy
784  hCSCOccupancy->Fill(1);
785  if (hasWires) hCSCOccupancy->Fill(3);
786  if (hasStrips) hCSCOccupancy->Fill(5);
787  if (hasWires && hasStrips) hCSCOccupancy->Fill(7);
788  if (hasRecHits) hCSCOccupancy->Fill(9);
789  if (hasSegments) hCSCOccupancy->Fill(11);
790 
791 
792  }
793 
794 
795 // ==============================================
796 //
797 // look at WIRE DIGIs
798 //
799 // ==============================================
800 
802 
803  int nWireGroupsTotal = 0;
804  for (CSCWireDigiCollection::DigiRangeIterator dWDiter=wires->begin(); dWDiter!=wires->end(); dWDiter++) {
805  CSCDetId id = (CSCDetId)(*dWDiter).first;
806  std::vector<CSCWireDigi>::const_iterator wireIter = (*dWDiter).second.first;
807  std::vector<CSCWireDigi>::const_iterator lWire = (*dWDiter).second.second;
808  for( ; wireIter != lWire; ++wireIter) {
809  int myWire = wireIter->getWireGroup();
810  int myTBin = wireIter->getTimeBin();
811  nWireGroupsTotal++;
812  hWireTBin[typeIndex(id)-1]->Fill(myTBin);
813  hWireNumber[typeIndex(id)-1]->Fill(myWire);
814  }
815  } // end wire loop
816 
817  // this way you can zero suppress but still store info on # events with no digis
818  if (nWireGroupsTotal == 0) nWireGroupsTotal = -1;
819  hWirenGroupsTotal->Fill(nWireGroupsTotal);
820 
821 }
822 
823 
824 // ==============================================
825 //
826 // look at STRIP DIGIs
827 //
828 // ==============================================
829 
831 
832  int nStripsFired = 0;
833  for (CSCStripDigiCollection::DigiRangeIterator dSDiter=strips->begin(); dSDiter!=strips->end(); dSDiter++) {
834  CSCDetId id = (CSCDetId)(*dSDiter).first;
835  std::vector<CSCStripDigi>::const_iterator stripIter = (*dSDiter).second.first;
836  std::vector<CSCStripDigi>::const_iterator lStrip = (*dSDiter).second.second;
837  for( ; stripIter != lStrip; ++stripIter) {
838  int myStrip = stripIter->getStrip();
839  std::vector<int> myADCVals = stripIter->getADCCounts();
840  bool thisStripFired = false;
841  float thisPedestal = 0.5*(float)(myADCVals[0]+myADCVals[1]);
842  float threshold = 13.3 ;
843  float diff = 0.;
844  for (unsigned int iCount = 0; iCount < myADCVals.size(); iCount++) {
845  diff = (float)myADCVals[iCount]-thisPedestal;
846  if (diff > threshold) { thisStripFired = true; }
847  }
848  if (thisStripFired) {
849  nStripsFired++;
850  hStripNumber[typeIndex(id)-1]->Fill(myStrip);
851  }
852  }
853  } // end strip loop
854 
855  // this way you can zero suppress but still store info on # events with no digis
856  if (nStripsFired == 0) nStripsFired = -1;
857  hStripNFired->Fill(nStripsFired);
858  // fill n per event
859 
860 }
861 
862 
863 //=======================================================
864 //
865 // Look at the Pedestal Noise Distributions
866 //
867 //=======================================================
868 
870 
871  for (CSCStripDigiCollection::DigiRangeIterator dPNiter=strips->begin(); dPNiter!=strips->end(); dPNiter++) {
872  CSCDetId id = (CSCDetId)(*dPNiter).first;
873  int kStation = id.station();
874  int kRing = id.ring();
875  std::vector<CSCStripDigi>::const_iterator pedIt = (*dPNiter).second.first;
876  std::vector<CSCStripDigi>::const_iterator lStrip = (*dPNiter).second.second;
877  for( ; pedIt != lStrip; ++pedIt) {
878  int myStrip = pedIt->getStrip();
879  std::vector<int> myADCVals = pedIt->getADCCounts();
880  float TotalADC = getSignal(*strips, id, myStrip);
881  bool thisStripFired = false;
882  float thisPedestal = 0.5*(float)(myADCVals[0]+myADCVals[1]);
883  float thisSignal = (1./6)*(myADCVals[2]+myADCVals[3]+myADCVals[4]+myADCVals[5]+myADCVals[6]+myADCVals[7]);
884  float threshold = 13.3;
885  if(kStation == 1 && kRing == 4)
886  {
887  kRing = 1;
888  if(myStrip <= 16) myStrip += 64; // no trapping for any bizarreness
889  }
890  if (TotalADC > threshold) { thisStripFired = true;}
891  if (!thisStripFired){
892  float ADC = thisSignal - thisPedestal;
893  hStripPed[typeIndex(id)-1]->Fill(ADC);
894  }
895  }
896  }
897 
898 }
899 
900 
901 // ==============================================
902 //
903 // look at RECHITs
904 //
905 // ==============================================
906 
910 
911  // Get the RecHits collection :
912  int nRecHits = recHits->size();
913 
914  // ---------------------
915  // Loop over rechits
916  // ---------------------
917  // Build iterator for rechits and loop :
919  for (dRHIter = recHits->begin(); dRHIter != recHits->end(); dRHIter++) {
920 
921  // Find chamber with rechits in CSC
922  CSCDetId idrec = (CSCDetId)(*dRHIter).cscDetId();
923 
924  // Store rechit as a Local Point:
925  LocalPoint rhitlocal = (*dRHIter).localPosition();
926  //float xreco = rhitlocal.x();
927  //float yreco = rhitlocal.y();
928 
929  // Get the reconstucted strip position and error
930  float stpos = (*dRHIter).positionWithinStrip();
931  float sterr = (*dRHIter).errorWithinStrip();
932 
934 
935  int adcsize = dRHIter->nStrips()*dRHIter->nTimeBins();
936  float rHSumQ = 0;
937  float sumsides = 0;
938  for (unsigned int i = 0; i < dRHIter->nStrips(); i++){
939  for (unsigned int j=0; j<dRHIter->nTimeBins()-1; j++) {
940  rHSumQ+=dRHIter->adcs(i,j);
941  if ( i != 1 ) sumsides += dRHIter->adcs(i,j); // skip central strip
942  }
943  }
944 
945  float rHratioQ = sumsides/rHSumQ;
946  if (adcsize != 12) rHratioQ = -99;
947 
948  // Get the signal timing of this hit
949  float rHtime = (*dRHIter).tpeak(); //calculated from cathode SCA bins
950  float rHtimeAnode = (*dRHIter).wireTime(); // calculated from anode wire bx
951 
952  // Get pointer to the layer:
953  const CSCLayer* csclayer = cscGeom->layer( idrec );
954 
955  // Transform hit position from local chamber geometry to global CMS geom
956  GlobalPoint rhitglobal= csclayer->toGlobal(rhitlocal);
957  float grecx = rhitglobal.x();
958  float grecy = rhitglobal.y();
959 
960  // Fill some histograms
961  int sIndex = idrec.station() + ((idrec.endcap()-1) * 4);
962  int tIndex = typeIndex(idrec);
963  hRHSumQ[tIndex-1]->Fill(rHSumQ);
964  hRHRatioQ[tIndex-1]->Fill(rHratioQ);
965  hRHstpos[tIndex-1]->Fill(stpos);
966  hRHsterr[tIndex-1]->Fill(sterr);
967  hRHTiming[tIndex-1]->Fill(rHtime);
968  hRHTimingAnode[tIndex-1]->Fill(rHtimeAnode);
969  hRHGlobal[sIndex-1]->Fill(grecx,grecy);
970 
971  } //end rechit loop
972 
973  if (nRecHits == 0) nRecHits = -1;
974  hRHnrechits->Fill(nRecHits);
975 
976 }
977 
978 
979 // ==============================================
980 //
981 // look at SEGMENTs
982 //
983 // ===============================================
984 
987 
988  // get CSC segment collection
989  int nSegments = cscSegments->size();
990 
991  for(CSCSegmentCollection::const_iterator dSiter=cscSegments->begin(); dSiter != cscSegments->end(); dSiter++) {
992  CSCDetId id = (CSCDetId)(*dSiter).cscDetId();
993  float chisq = (*dSiter).chi2();
994  int nhits = (*dSiter).nRecHits();
995  int nDOF = 2*nhits-4;
996  float nChi2 = chisq/nDOF;
997  double chisqProb = ChiSquaredProbability( (double)chisq, nDOF );
998  LocalPoint localPos = (*dSiter).localPosition();
999  LocalVector segDir = (*dSiter).localDirection();
1000 
1001  // prepare to calculate segment times
1002  float timeCathode = 0; //average from cathode information alone
1003  float timeAnode = 0; //average from pruned anode information alone
1004  float timeCombined = 0; //average from cathode hits and pruned anode list
1005  std::vector<float> cathodeTimes;
1006  std::vector<float> anodeTimes;
1007  // Get the CSC recHits that contribute to this segment.
1008  std::vector<CSCRecHit2D> theseRecHits = (*dSiter).specificRecHits();
1009  for ( vector<CSCRecHit2D>::const_iterator iRH = theseRecHits.begin(); iRH != theseRecHits.end(); iRH++) {
1010  if ( !((*iRH).isValid()) ) continue; // only interested in valid hits
1011  cathodeTimes.push_back((*iRH).tpeak());
1012  anodeTimes.push_back((*iRH).wireTime());
1013  }//end rechit loop
1014 
1015  // Calculate cathode average
1016  for (unsigned int i=0; i<cathodeTimes.size(); i++)
1017  timeCathode+=cathodeTimes[i]/cathodeTimes.size();
1018 
1019  // Prune the anode list to deal with the late tail
1020  float anodeMaxDiff;
1021  bool modified = false;
1022  std::vector<float>::iterator anodeMaxHit;
1023  do {
1024  if (anodeTimes.size()==0) continue;
1025  timeAnode=0;
1026  anodeMaxDiff=0;
1027  modified=false;
1028 
1029  // Find the average
1030  for (unsigned int j=0; j<anodeTimes.size(); j++) timeAnode+=anodeTimes[j]/anodeTimes.size();
1031 
1032  // Find the maximum outlier hit
1033  for (unsigned int j=0; j<anodeTimes.size(); j++) {
1034  if (fabs(anodeTimes[j]-timeAnode)>anodeMaxDiff) {
1035  anodeMaxHit=anodeTimes.begin()+j;
1036  anodeMaxDiff=fabs(anodeTimes[j]-timeAnode);
1037  }
1038  }
1039 
1040  // Cut hit if its greater than some time away
1041  if (anodeMaxDiff>26) {
1042  modified=true;
1043  anodeTimes.erase(anodeMaxHit);
1044  }
1045  } while (modified);
1046 
1047  // Calculate combined anode and cathode time average
1048  if(cathodeTimes.size()+anodeTimes.size() >0 )
1049  timeCombined = (timeCathode*cathodeTimes.size() + timeAnode*anodeTimes.size())/(cathodeTimes.size()+anodeTimes.size());
1050 
1051  // global transformation
1052  float globX = 0.;
1053  float globY = 0.;
1054  float globZ = 0.;
1055  float globTOF = 0.;
1056  float globTheta = 0.;
1057  float globPhi = 0.;
1058  const CSCChamber* cscchamber = cscGeom->chamber(id);
1059  if (cscchamber) {
1060  GlobalPoint globalPosition = cscchamber->toGlobal(localPos);
1061  globX = globalPosition.x();
1062  globY = globalPosition.y();
1063  globZ = globalPosition.z();
1064  globTOF = sqrt(globX*globX+globY*globY+globZ*globZ);
1065  GlobalVector globalDirection = cscchamber->toGlobal(segDir);
1066  globTheta = globalDirection.theta();
1067  globPhi = globalDirection.phi();
1068  }
1069 
1070  // Fill histos
1071  int tIndex = typeIndex(id);
1072  hSnhitsAll->Fill(nhits);
1073  hSnhits[tIndex-1]->Fill(nhits);
1074  hSChiSqAll->Fill(nChi2);
1075  hSChiSq[tIndex-1]->Fill(nChi2);
1076  hSChiSqProbAll->Fill(chisqProb);
1077  hSChiSqProb[tIndex-1]->Fill(chisqProb);
1078  hSGlobalTheta->Fill(globTheta);
1079  hSGlobalPhi->Fill(globPhi);
1080  hSTimeCathode->Fill(timeCathode);
1081  hSTimeCombined->Fill(timeCombined);
1082  hSTimeVsZ->Fill(globZ, timeCombined);
1083  hSTimeVsTOF->Fill(globTOF, timeCombined);
1084 
1085  } // end segment loop
1086 
1087  if (nSegments == 0) nSegments = -1;
1088  hSnSegments->Fill(nSegments);
1089 
1090 }
1091 
1092 // ==============================================
1093 //
1094 // look at hit Resolution
1095 //
1096 // ==============================================
1098  edm::ESHandle<CSCGeometry> cscGeom){
1099 
1100  for(CSCSegmentCollection::const_iterator dSiter=cscSegments->begin(); dSiter != cscSegments->end(); dSiter++) {
1101  CSCDetId id = (CSCDetId)(*dSiter).cscDetId();
1102  //
1103  // try to get the CSC recHits that contribute to this segment.
1104  std::vector<CSCRecHit2D> theseRecHits = (*dSiter).specificRecHits();
1105  int nRH = (*dSiter).nRecHits();
1106  int jRH = 0;
1107  CLHEP::HepMatrix sp(6,1);
1108  CLHEP::HepMatrix se(6,1);
1109  for ( vector<CSCRecHit2D>::const_iterator iRH = theseRecHits.begin(); iRH != theseRecHits.end(); iRH++) {
1110  jRH++;
1111  CSCDetId idRH = (CSCDetId)(*iRH).cscDetId();
1112  //int kEndcap = idRH.endcap();
1113  int kRing = idRH.ring();
1114  int kStation = idRH.station();
1115  //int kChamber = idRH.chamber();
1116  int kLayer = idRH.layer();
1117 
1119  int centerid = iRH->nStrips()/2 + 1;
1120  int centerStrip = iRH->channels(centerid - 1);
1121 
1122  // If this segment has 6 hits, find the position of each hit on the strip in units of stripwidth and store values
1123  if (nRH == 6){
1124  float stpos = (*iRH).positionWithinStrip();
1125  se(kLayer,1) = (*iRH).errorWithinStrip();
1126  // Take into account half-strip staggering of layers (ME1/1 has no staggering)
1127  if (kStation == 1 && (kRing == 1 || kRing == 4)) sp(kLayer,1) = stpos + centerStrip;
1128  else{
1129  if (kLayer == 1 || kLayer == 3 || kLayer == 5) sp(kLayer,1) = stpos + centerStrip;
1130  if (kLayer == 2 || kLayer == 4 || kLayer == 6) sp(kLayer,1) = stpos - 0.5 + centerStrip;
1131  }
1132  }
1133 
1134  }
1135 
1136  float residual = -99;
1137  // Fit all points except layer 3, then compare expected value for layer 3 to reconstructed value
1138  if (nRH == 6){
1139  float expected = fitX(sp,se);
1140  residual = expected - sp(3,1);
1141  }
1142 
1143  hSResid[typeIndex(id)-1]->Fill(residual);
1144 
1145  } // end segment loop
1146 
1147 
1148 
1149 }
1150 
1151 
1152 //-------------------------------------------------------------------------------------
1153 // Fits a straight line to a set of 5 points with errors. Functions assumes 6 points
1154 // and removes hit in layer 3. It then returns the expected position value in layer 3
1155 // based on the fit.
1156 //-------------------------------------------------------------------------------------
1157 float CSCOfflineMonitor::fitX(const CLHEP::HepMatrix& points, const CLHEP::HepMatrix& errors){
1158 
1159  float S = 0;
1160  float Sx = 0;
1161  float Sy = 0;
1162  float Sxx = 0;
1163  float Sxy = 0;
1164  float sigma2 = 0;
1165 
1166  for (int i=1;i<7;i++){
1167  if (i != 3){
1168  sigma2 = errors(i,1)*errors(i,1);
1169  S = S + (1/sigma2);
1170  Sy = Sy + (points(i,1)/sigma2);
1171  Sx = Sx + ((i)/sigma2);
1172  Sxx = Sxx + (i*i)/sigma2;
1173  Sxy = Sxy + (((i)*points(i,1))/sigma2);
1174  }
1175  }
1176 
1177  float delta = S*Sxx - Sx*Sx;
1178  float intercept = (Sxx*Sy - Sx*Sxy)/delta;
1179  float slope = (S*Sxy - Sx*Sy)/delta;
1180 
1181  return (intercept + slope*3);
1182 
1183 }
1184 
1185 //---------------------------------------------------------------------------------------
1186 // Given a set of digis, the CSCDetId, and the central strip of your choosing, returns
1187 // the avg. Signal-Pedestal for 6 time bin x 5 strip .
1188 //
1189 // Author: P. Jindal
1190 //---------------------------------------------------------------------------------------
1191 
1193  CSCDetId idCS, int centerStrip){
1194 
1195  float SigADC[5];
1196  float TotalADC = 0;
1197  SigADC[0] = 0;
1198  SigADC[1] = 0;
1199  SigADC[2] = 0;
1200  SigADC[3] = 0;
1201  SigADC[4] = 0;
1202 
1203 
1204  // Loop over strip digis
1206 
1207  for (sIt = stripdigis.begin(); sIt != stripdigis.end(); sIt++){
1208  CSCDetId id = (CSCDetId)(*sIt).first;
1209  if (id == idCS){
1210 
1211  // First, find the Signal-Pedestal for center strip
1212  vector<CSCStripDigi>::const_iterator digiItr = (*sIt).second.first;
1213  vector<CSCStripDigi>::const_iterator last = (*sIt).second.second;
1214  for ( ; digiItr != last; ++digiItr ) {
1215  int thisStrip = digiItr->getStrip();
1216  if (thisStrip == (centerStrip)){
1217  std::vector<int> myADCVals = digiItr->getADCCounts();
1218  float thisPedestal = 0.5*(float)(myADCVals[0]+myADCVals[1]);
1219  float thisSignal = (myADCVals[2]+myADCVals[3]+myADCVals[4]+myADCVals[5]+myADCVals[6]+myADCVals[7]);
1220  SigADC[0] = thisSignal - 6*thisPedestal;
1221  }
1222  // Now,find the Signal-Pedestal for neighbouring 4 strips
1223  if (thisStrip == (centerStrip+1)){
1224  std::vector<int> myADCVals = digiItr->getADCCounts();
1225  float thisPedestal = 0.5*(float)(myADCVals[0]+myADCVals[1]);
1226  float thisSignal = (myADCVals[2]+myADCVals[3]+myADCVals[4]+myADCVals[5]+myADCVals[6]+myADCVals[7]);
1227  SigADC[1] = thisSignal - 6*thisPedestal;
1228  }
1229  if (thisStrip == (centerStrip+2)){
1230  std::vector<int> myADCVals = digiItr->getADCCounts();
1231  float thisPedestal = 0.5*(float)(myADCVals[0]+myADCVals[1]);
1232  float thisSignal = (myADCVals[2]+myADCVals[3]+myADCVals[4]+myADCVals[5]+myADCVals[6]+myADCVals[7]);
1233  SigADC[2] = thisSignal - 6*thisPedestal;
1234  }
1235  if (thisStrip == (centerStrip-1)){
1236  std::vector<int> myADCVals = digiItr->getADCCounts();
1237  float thisPedestal = 0.5*(float)(myADCVals[0]+myADCVals[1]);
1238  float thisSignal = (myADCVals[2]+myADCVals[3]+myADCVals[4]+myADCVals[5]+myADCVals[6]+myADCVals[7]);
1239  SigADC[3] = thisSignal - 6*thisPedestal;
1240  }
1241  if (thisStrip == (centerStrip-2)){
1242  std::vector<int> myADCVals = digiItr->getADCCounts();
1243  float thisPedestal = 0.5*(float)(myADCVals[0]+myADCVals[1]);
1244  float thisSignal = (myADCVals[2]+myADCVals[3]+myADCVals[4]+myADCVals[5]+myADCVals[6]+myADCVals[7]);
1245  SigADC[4] = thisSignal - 6*thisPedestal;
1246  }
1247  }
1248  TotalADC = 0.2*(SigADC[0]+SigADC[1]+SigADC[2]+SigADC[3]+SigADC[4]);
1249  }
1250  }
1251  return TotalADC;
1252 }
1253 
1254 
1255 
1256 //----------------------------------------------------------------------------
1257 // Calculate basic efficiencies for recHits and Segments
1258 // Author: S. Stoynev
1259 //----------------------------------------------------------------------------
1260 
1263  edm::ESHandle<CSCGeometry> cscGeom){
1264 
1265  bool allWires[2][4][4][36][6];
1266  bool allStrips[2][4][4][36][6];
1267  bool AllRecHits[2][4][4][36][6];
1268  bool AllSegments[2][4][4][36];
1269 
1270  //bool MultiSegments[2][4][4][36];
1271  for(int iE = 0;iE<2;iE++){
1272  for(int iS = 0;iS<4;iS++){
1273  for(int iR = 0; iR<4;iR++){
1274  for(int iC =0;iC<36;iC++){
1275  AllSegments[iE][iS][iR][iC] = false;
1276  //MultiSegments[iE][iS][iR][iC] = false;
1277  for(int iL=0;iL<6;iL++){
1278  allWires[iE][iS][iR][iC][iL] = false;
1279  allStrips[iE][iS][iR][iC][iL] = false;
1280  AllRecHits[iE][iS][iR][iC][iL] = false;
1281  }
1282  }
1283  }
1284  }
1285  }
1286 
1287 
1288  // Wires
1289  for (CSCWireDigiCollection::DigiRangeIterator dWDiter=wires->begin(); dWDiter!=wires->end(); dWDiter++) {
1290  CSCDetId idrec = (CSCDetId)(*dWDiter).first;
1291  std::vector<CSCWireDigi>::const_iterator wireIter = (*dWDiter).second.first;
1292  std::vector<CSCWireDigi>::const_iterator lWire = (*dWDiter).second.second;
1293  for( ; wireIter != lWire; ++wireIter) {
1294  allWires[idrec.endcap() -1][idrec.station() -1][idrec.ring() -1][idrec.chamber() -1][idrec.layer() -1] = true;
1295  break;
1296  }
1297  }
1298 
1299  //---- STRIPS
1300  for (CSCStripDigiCollection::DigiRangeIterator dSDiter=strips->begin(); dSDiter!=strips->end(); dSDiter++) {
1301  CSCDetId idrec = (CSCDetId)(*dSDiter).first;
1302  std::vector<CSCStripDigi>::const_iterator stripIter = (*dSDiter).second.first;
1303  std::vector<CSCStripDigi>::const_iterator lStrip = (*dSDiter).second.second;
1304  for( ; stripIter != lStrip; ++stripIter) {
1305  std::vector<int> myADCVals = stripIter->getADCCounts();
1306  bool thisStripFired = false;
1307  float thisPedestal = 0.5*(float)(myADCVals[0]+myADCVals[1]);
1308  float threshold = 13.3 ;
1309  float diff = 0.;
1310  for (unsigned int iCount = 0; iCount < myADCVals.size(); iCount++) {
1311  diff = (float)myADCVals[iCount]-thisPedestal;
1312  if (diff > threshold) {
1313  thisStripFired = true;
1314  break;
1315  }
1316  }
1317  if(thisStripFired){
1318  allStrips[idrec.endcap() -1][idrec.station() -1][idrec.ring() -1][idrec.chamber() -1][idrec.layer() -1] = true;
1319  break;
1320  }
1321  }
1322  }
1323 
1324  // Rechits
1325  for (CSCRecHit2DCollection::const_iterator recEffIt = recHits->begin(); recEffIt != recHits->end(); recEffIt++) {
1326  //CSCDetId idrec = (CSCDetId)(*recIt).cscDetId();
1327  CSCDetId idrec = (CSCDetId)(*recEffIt).cscDetId();
1328  AllRecHits[idrec.endcap() -1][idrec.station() -1][idrec.ring() -1][idrec.chamber() -1][idrec.layer() -1] = true;
1329 
1330  }
1331 
1332  std::vector <uint> seg_ME2(2,0) ;
1333  std::vector <uint> seg_ME3(2,0) ;
1334  std::vector < pair <CSCDetId, CSCSegment> > theSegments(4);
1335  // Segments
1336  for(CSCSegmentCollection::const_iterator segEffIt=cscSegments->begin(); segEffIt != cscSegments->end(); segEffIt++) {
1337  CSCDetId idseg = (CSCDetId)(*segEffIt).cscDetId();
1338  //if(AllSegments[idrec.endcap() -1][idrec.station() -1][idrec.ring() -1][idrec.chamber()]){
1339  //MultiSegments[idrec.endcap() -1][idrec.station() -1][idrec.ring() -1][idrec.chamber()] = true;
1340  //}
1341  AllSegments[idseg.endcap() -1][idseg.station() -1][idseg.ring() -1][idseg.chamber() -1] = true;
1342  // "Intrinsic" efficiency measurement relies on "good" segment extrapolation - we need the pre-selection below
1343  // station 2 "good" segment will be used for testing efficiencies in ME1 and ME3
1344  // station 3 "good" segment will be used for testing efficiencies in ME2 and ME4
1345  if(2==idseg.station() || 3==idseg.station()){
1346  uint seg_tmp ;
1347  if(2==idseg.station()){
1348  ++seg_ME2[idseg.endcap() -1];
1349  seg_tmp = seg_ME2[idseg.endcap() -1];
1350  }
1351  else{
1352  ++seg_ME3[idseg.endcap() -1];
1353  seg_tmp = seg_ME3[idseg.endcap() -1];
1354  }
1355  // is the segment good
1356  if(1== seg_tmp&& 6==(*segEffIt).nRecHits() && (*segEffIt).chi2()/(*segEffIt).degreesOfFreedom()<3.){
1357  pair <CSCDetId, CSCSegment> specSeg = make_pair( (CSCDetId)(*segEffIt).cscDetId(),*segEffIt);
1358  theSegments[2*(idseg.endcap()-1)+(idseg.station() -2)] = specSeg;
1359  }
1360  }
1361  /*
1362  if(2==idseg.station()){
1363  ++seg_ME2[idseg.endcap() -1];
1364  if(1==seg_ME2[idseg.endcap() -1] && 6==(*segEffIt).nRecHits() && (*segEffIt).chi2()/(*segEffIt).degreesOfFreedom()<3.){
1365  pair <CSCDetId, CSCSegment> specSeg = make_pair( (CSCDetId)(*segEffIt).cscDetId(),*segEffIt);
1366  theSegments[2*(idseg.endcap()-1)+(idseg.station() -2)] = specSeg;
1367  }
1368  }
1369  else if(3==idseg.station()){
1370  ++seg_ME3[idseg.endcap() -1];
1371  if(1==seg_ME3[idseg.endcap() -1] && 6==(*segEffIt).nRecHits() && (*segEffIt).chi2()/(*segEffIt).degreesOfFreedom()<3.){
1372  pair <CSCDetId, CSCSegment> specSeg = make_pair( (CSCDetId)(*segEffIt).cscDetId(),*segEffIt);
1373  theSegments[2*(idseg.endcap()-1)+(idseg.station() -2)] = specSeg;
1374  }
1375  }
1376  */
1377 
1378  }
1379  // Simple efficiency calculations
1380  for(int iE = 0;iE<2;iE++){
1381  for(int iS = 0;iS<4;iS++){
1382  for(int iR = 0; iR<4;iR++){
1383  for(int iC =0;iC<36;iC++){
1384  int NumberOfLayers = 0;
1385  for(int iL=0;iL<6;iL++){
1386  if(AllRecHits[iE][iS][iR][iC][iL]){
1387  NumberOfLayers++;
1388  }
1389  }
1390  int bin = 0;
1391  if (iS==0) bin = iR+1+(iE*10);
1392  else bin = (iS+1)*2 + (iR+1) + (iE*10);
1393  if(NumberOfLayers>1){
1394  //if(!(MultiSegments[iE][iS][iR][iC])){
1395  if(AllSegments[iE][iS][iR][iC]){
1396  //---- Efficient segment evenents
1397  hSSTE->Fill(bin);
1398  }
1399  //---- All segment events (normalization)
1400  hSSTE->Fill(20+bin);
1401  //}
1402  }
1403  if(AllSegments[iE][iS][iR][iC]){
1404  if(NumberOfLayers==6){
1405  //---- Efficient rechit events
1406  hRHSTE->Fill(bin);;
1407  }
1408  //---- All rechit events (normalization)
1409  hRHSTE->Fill(20+bin);;
1410  }
1411  }
1412  }
1413  }
1414  }
1415 
1416  // pick a segment only if there are no others in the station
1417  std::vector < pair <CSCDetId, CSCSegment> * > theSeg;
1418  if(1==seg_ME2[0]) theSeg.push_back(&theSegments[0]);
1419  if(1==seg_ME3[0]) theSeg.push_back(&theSegments[1]);
1420  if(1==seg_ME2[1]) theSeg.push_back(&theSegments[2]);
1421  if(1==seg_ME3[1]) theSeg.push_back(&theSegments[3]);
1422 
1423  // Needed for plots
1424  // at the end the chamber types will be numbered as 1 to 18
1425  // (ME-4/1, -ME3/2, -ME3/1, ..., +ME3/1, +ME3/2, ME+4/1 )
1426  std::map <std::string, float> chamberTypes;
1427  chamberTypes["ME1/a"] = 0.5;
1428  chamberTypes["ME1/b"] = 1.5;
1429  chamberTypes["ME1/2"] = 2.5;
1430  chamberTypes["ME1/3"] = 3.5;
1431  chamberTypes["ME2/1"] = 4.5;
1432  chamberTypes["ME2/2"] = 5.5;
1433  chamberTypes["ME3/1"] = 6.5;
1434  chamberTypes["ME3/2"] = 7.5;
1435  chamberTypes["ME4/1"] = 8.5;
1436 
1437  if(theSeg.size()){
1438  std::map <int , GlobalPoint> extrapolatedPoint;
1439  std::map <int , GlobalPoint>::iterator it;
1440  const std::vector<CSCChamber*> ChamberContainer = cscGeom->chambers();
1441  // Pick which chamber with which segment to test
1442  for(unsigned int nCh=0;nCh<ChamberContainer.size();nCh++){
1443  const CSCChamber *cscchamber = ChamberContainer[nCh];
1444  pair <CSCDetId, CSCSegment> * thisSegment = 0;
1445  for(uint iSeg =0;iSeg<theSeg.size();++iSeg ){
1446  if(cscchamber->id().endcap() == theSeg[iSeg]->first.endcap()){
1447  if(1==cscchamber->id().station() || 3==cscchamber->id().station() ){
1448  if(2==theSeg[iSeg]->first.station()){
1449  thisSegment = theSeg[iSeg];
1450  }
1451  }
1452  else if (2==cscchamber->id().station() || 4==cscchamber->id().station()){
1453  if(3==theSeg[iSeg]->first.station()){
1454  thisSegment = theSeg[iSeg];
1455  }
1456  }
1457  }
1458  }
1459  // this chamber is to be tested with thisSegment
1460  if(thisSegment){
1461  CSCSegment * seg = &(thisSegment->second);
1462  const CSCChamber *segChamber = cscGeom->chamber(thisSegment->first);
1463  LocalPoint localCenter(0.,0.,0);
1464  GlobalPoint cscchamberCenter = cscchamber->toGlobal(localCenter);
1465  // try to save some time (extrapolate a segment to a certain position only once)
1466  it = extrapolatedPoint.find(int(cscchamberCenter.z()));
1467  if(it==extrapolatedPoint.end()){
1468  GlobalPoint segPos = segChamber->toGlobal(seg->localPosition());
1469  GlobalVector segDir = segChamber->toGlobal(seg->localDirection());
1470  double paramaterLine = lineParametrization(segPos.z(),cscchamberCenter.z() , segDir.z());
1471  double xExtrapolated = extrapolate1D(segPos.x(),segDir.x(), paramaterLine);
1472  double yExtrapolated = extrapolate1D(segPos.y(),segDir.y(), paramaterLine);
1473  GlobalPoint globP (xExtrapolated, yExtrapolated, cscchamberCenter.z());
1474  extrapolatedPoint[int(cscchamberCenter.z())] = globP;
1475  }
1476  // Where does the extrapolated point lie in the (tested) chamber local frame? Here:
1477  LocalPoint extrapolatedPointLocal = cscchamber->toLocal(extrapolatedPoint[int(cscchamberCenter.z())]);
1478  const CSCLayer *layer_p = cscchamber->layer(1);//layer 1
1479  const CSCLayerGeometry *layerGeom = layer_p->geometry ();
1480  const std::array<const float, 4> & layerBounds = layerGeom->parameters ();
1481  float shiftFromEdge = 15.;//cm
1482  float shiftFromDeadZone = 10.;
1483  // is the extrapolated point within a sensitive region
1484  bool pass = withinSensitiveRegion(extrapolatedPointLocal, layerBounds,
1485  cscchamber->id().station(), cscchamber->id().ring(),
1486  shiftFromEdge, shiftFromDeadZone);
1487  if(pass){// the extrapolation point of the segment lies within sensitive region of that chamber
1488  // how many rechit layers are there in the chamber?
1489  // 0 - maybe the muon died or is deflected at large angle? do not use that case
1490  // 1 - could be noise...
1491  // 2 or more - this is promissing; this is our definition of a reliable signal; use it below
1492  // is other definition better?
1493  int nRHLayers = 0;
1494  for(int iL =0;iL<6;++iL){
1495  if(AllRecHits[cscchamber->id().endcap()-1]
1496  [cscchamber->id().station()-1]
1497  [cscchamber->id().ring()-1][cscchamber->id().chamber()-1][iL]){
1498  ++nRHLayers;
1499  }
1500  }
1501  //std::cout<<" nRHLayers = "<<nRHLayers<<std::endl;
1502  float verticalScale = chamberTypes[cscchamber->specs()->chamberTypeName()];
1503  if(cscchamberCenter.z()<0){
1504  verticalScale = - verticalScale;
1505  }
1506  verticalScale +=9.5;
1507  hSensitiveAreaEvt->Fill(float(cscchamber->id().chamber()),verticalScale);
1508  if(nRHLayers>1){// this chamber contains a reliable signal
1509  //chamberTypes[cscchamber->specs()->chamberTypeName()];
1510  // "intrinsic" efficiencies
1511  //std::cout<<" verticalScale = "<<verticalScale<<" chType = "<<cscchamber->specs()->chamberTypeName()<<std::endl;
1512  // this is the denominator forr all efficiencies
1513  hEffDenominator->Fill(float(cscchamber->id().chamber()),verticalScale);
1514  // Segment efficiency
1515  if(AllSegments[cscchamber->id().endcap()-1]
1516  [cscchamber->id().station()-1]
1517  [cscchamber->id().ring()-1][cscchamber->id().chamber()-1]){
1518  hSSTE2->Fill(float(cscchamber->id().chamber()),float(verticalScale));
1519  }
1520 
1521  for(int iL =0;iL<6;++iL){
1522  float weight = 1./6.;
1523  // one shold account for the weight in the efficiency...
1524  // Rechit efficiency
1525  if(AllRecHits[cscchamber->id().endcap()-1]
1526  [cscchamber->id().station()-1]
1527  [cscchamber->id().ring()-1][cscchamber->id().chamber()-1][iL]){
1528  hRHSTE2->Fill(float(cscchamber->id().chamber()),float(verticalScale),weight);
1529  }
1530  // Wire efficiency
1531  if(allWires[cscchamber->id().endcap()-1]
1532  [cscchamber->id().station()-1]
1533  [cscchamber->id().ring()-1][cscchamber->id().chamber()-1][iL]){
1534  // one shold account for the weight in the efficiency...
1535  hWireSTE2->Fill(float(cscchamber->id().chamber()),float(verticalScale),weight);
1536  }
1537  // Strip efficiency
1538  if(allStrips[cscchamber->id().endcap()-1]
1539  [cscchamber->id().station()-1]
1540  [cscchamber->id().ring()-1][cscchamber->id().chamber()-1][iL]){
1541  // one shold account for the weight in the efficiency...
1542  hStripSTE2->Fill(float(cscchamber->id().chamber()),float(verticalScale),weight);
1543  }
1544  }
1545  }
1546  }
1547  }
1548  }
1549  }
1550  //
1551 
1552 
1553 }
1554 
1555 // ==============================================
1556 //
1557 // Look at BX level trigger synchronization
1558 //
1559 // ==============================================
1560 
1562  const edm::Event & event, const edm::EventSetup& eventSetup){
1563 
1564  // Loop over ALCTDigis
1565 
1566  for (CSCALCTDigiCollection::DigiRangeIterator j=alcts->begin(); j!=alcts->end(); j++) {
1567  const CSCDetId& idALCT = (*j).first;
1568  const CSCALCTDigiCollection::Range& range =(*j).second;
1569  for (CSCALCTDigiCollection::const_iterator digiIt = range.first; digiIt!=range.second; ++digiIt){
1570  // Valid digi in the chamber (or in neighbouring chamber)
1571  if((*digiIt).isValid()){
1572  hALCTgetBX->Fill((*digiIt).getBX());
1573  hALCTgetBXSerial->Fill(chamberSerial(idALCT),(*digiIt).getBX());
1574  hALCTgetBX2DNumerator->Fill(idALCT.chamber(),typeIndex(idALCT,2),(*digiIt).getBX());
1575  hALCTgetBX2Denominator->Fill(idALCT.chamber(),typeIndex(idALCT,2));
1576  }
1577  }
1578  }// end ALCT Digi loop
1579 
1580 
1581  // Loop over raw data to get TMBHeader information
1582  // Taking code from EventFilter/CSCRawToDigis/CSCDCCUnpacker.cc
1584  eventSetup.get<CSCCrateMapRcd>().get(hcrate);
1585  const CSCCrateMap* pcrate = hcrate.product();
1586 
1587 
1588  // Try to get raw data
1590  if ( !( event.getByToken( rd_token, rawdata ) ) ){
1591  edm::LogWarning("CSCOfflineMonitor") << " FEDRawDataColelction not available";
1592  return;
1593  }
1594 
1595 
1596 
1597  bool goodEvent = false;
1598  unsigned long dccBinCheckMask = 0x06080016;
1599  unsigned int examinerMask = 0x1FEBF3F6;
1600  unsigned int errorMask = 0x0;
1601 
1602  for (int id=FEDNumbering::MINCSCFEDID;
1603  id<=FEDNumbering::MAXCSCFEDID; ++id) { // loop over DCCs
1606 
1608  const FEDRawData& fedData = rawdata->FEDData(id);
1609  unsigned long length = fedData.size();
1610 
1611  if (length>=32){
1612  CSCDCCExaminer* examiner = NULL;
1613  std::stringstream examiner_out, examiner_err;
1614  goodEvent = true;
1615  examiner = new CSCDCCExaminer();
1616  examiner->output1().redirect(examiner_out);
1617  examiner->output2().redirect(examiner_err);
1618  if( examinerMask&0x40000 ) examiner->crcCFEB(1);
1619  if( examinerMask&0x8000 ) examiner->crcTMB (1);
1620  if( examinerMask&0x0400 ) examiner->crcALCT(1);
1621  examiner->output1().show();
1622  examiner->output2().show();
1623  examiner->setMask(examinerMask);
1624  const short unsigned int *data = (short unsigned int *)fedData.data();
1625 
1626  int res = examiner->check(data,long(fedData.size()/2));
1627  if( res < 0 ) {
1628  goodEvent=false;
1629  }
1630  else {
1631  goodEvent=!(examiner->errors()&dccBinCheckMask);
1632  }
1633 
1634 
1635  if (goodEvent) {
1637 
1638  CSCDCCExaminer * ptrExaminer = examiner;
1639  CSCDCCEventData dccData((short unsigned int *) fedData.data(), ptrExaminer);
1641  const std::vector<CSCDDUEventData> & dduData = dccData.dduData();
1642 
1644  CSCDetId layer(1, 1, 1, 1, 1);
1645  for (unsigned int iDDU=0; iDDU<dduData.size(); ++iDDU) { // loop over DDUs
1648  if (dduData[iDDU].trailer().errorstat()&errorMask) {
1649  LogTrace("CSCDCCUnpacker|CSCRawToDigi") << "DDU# " << iDDU << " has serious error - no digis unpacked! " <<
1650  std::hex << dduData[iDDU].trailer().errorstat();
1651  continue; // to next iteration of DDU loop
1652  }
1653 
1655  const std::vector<CSCEventData> & cscData = dduData[iDDU].cscData();
1656 
1657 
1658  for (unsigned int iCSC=0; iCSC<cscData.size(); ++iCSC) { // loop over CSCs
1659 
1661  int vmecrate = cscData[iCSC].dmbHeader()->crateID();
1662  int dmb = cscData[iCSC].dmbHeader()->dmbID();
1663 
1664  int icfeb = 0;
1665  int ilayer = 0;
1666 
1667  if ((vmecrate>=1)&&(vmecrate<=60) && (dmb>=1)&&(dmb<=10)&&(dmb!=6)) {
1668  layer = pcrate->detId(vmecrate, dmb,icfeb,ilayer );
1669  }
1670  else{
1671  LogTrace ("CSCOfflineMonitor") << " detID input out of range!!! ";
1672  LogTrace ("CSCOfflineMonitor")
1673  << " skipping chamber vme= " << vmecrate << " dmb= " << dmb;
1674  continue; // to next iteration of iCSC loop
1675  }
1676 
1677 
1679  int nalct = cscData[iCSC].dmbHeader()->nalct();
1680  bool goodALCT=false;
1681  //if (nalct&&(cscData[iCSC].dataPresent>>6&0x1)==1) {
1682  if (nalct&&cscData[iCSC].alctHeader()) {
1683  if (cscData[iCSC].alctHeader()->check()){
1684  goodALCT=true;
1685  }
1686  }
1687 
1689  int nclct = cscData[iCSC].dmbHeader()->nclct();
1690  bool goodTMB=false;
1691  if (nclct&&cscData[iCSC].tmbData()) {
1692  if (cscData[iCSC].tmbHeader()->check()){
1693  if (cscData[iCSC].clctData()->check()) goodTMB=true;
1694  }
1695  }
1696 
1697  if (goodTMB && goodALCT) {
1698  const CSCTMBHeader *tmbHead = cscData[iCSC].tmbHeader();
1699  std::vector<CSCCLCTDigi> clcts = cscData[iCSC].tmbHeader()->CLCTDigis(layer.rawId());
1700  if (clcts.size()==0 || !(clcts[0].isValid()))
1701  continue;
1702  // Check if the CLCT was in ME11a (ring 4)
1703  if(layer.station()==1 && layer.ring() ==1 && clcts[0].getKeyStrip()>128){
1704  layer = CSCDetId(layer.endcap(),layer.station(),4, layer.chamber());
1705  }
1706  hALCTMatch->Fill(tmbHead->ALCTMatchTime());
1707  hALCTMatchSerial->Fill(chamberSerial(layer),tmbHead->ALCTMatchTime());
1708  // Only fill big 2D display if ALCTMatchTime !=6, since this bin is polluted by the CLCT only triggers
1709  // One will have to look at the serial plots to see if the are a lot of entries here
1710  if(tmbHead->ALCTMatchTime()!=6){
1711  hALCTMatch2DNumerator->Fill(layer.chamber(),typeIndex(layer,2),tmbHead->ALCTMatchTime());
1712  hALCTMatch2Denominator->Fill(layer.chamber(),typeIndex(layer,2));
1713  }
1714 
1715  int TMB_CLCTpre_rel_L1A = tmbHead->BXNCount()-clcts[0].getFullBX();
1716  if (TMB_CLCTpre_rel_L1A > 3563)
1717  TMB_CLCTpre_rel_L1A = TMB_CLCTpre_rel_L1A - 3564;
1718  if (TMB_CLCTpre_rel_L1A < 0)
1719  TMB_CLCTpre_rel_L1A = TMB_CLCTpre_rel_L1A + 3564;
1720 
1721  hCLCTL1A->Fill(TMB_CLCTpre_rel_L1A);
1722  hCLCTL1ASerial->Fill(chamberSerial(layer),TMB_CLCTpre_rel_L1A);
1723  hCLCTL1A2DNumerator->Fill(layer.chamber(),typeIndex(layer,2),TMB_CLCTpre_rel_L1A);
1724  hCLCTL1A2Denominator->Fill(layer.chamber(),typeIndex(layer,2));
1725 
1726  }// end if goodTMB and goodALCT
1727  }// end loop CSCData
1728  }// end loop DDU
1729  }// end if good event
1730  if (examiner!=NULL) delete examiner;
1731  }// end if non-zero fed data
1732  }// end DCC loop for NON-REFERENCE
1733 
1734  return;
1735 
1736 }
1737 
1738 
1739 
1740 void CSCOfflineMonitor::getEfficiency(float bin, float Norm, std::vector<float> &eff){
1741  //---- Efficiency with binomial error
1742  float Efficiency = 0.;
1743  float EffError = 0.;
1744  if(fabs(Norm)>0.000000001){
1745  Efficiency = bin/Norm;
1746  if(bin<Norm){
1747  EffError = sqrt( (1.-Efficiency)*Efficiency/Norm );
1748  }
1749  }
1750  eff[0] = Efficiency;
1751  eff[1] = EffError;
1752 }
1753 
1754 void CSCOfflineMonitor::histoEfficiency(TH1F *readHisto, MonitorElement *writeHisto){
1755  std::vector<float> eff(2);
1756  int Nbins = readHisto->GetSize()-2;//without underflows and overflows
1757  std::vector<float> bins(Nbins);
1758  std::vector<float> Efficiency(Nbins);
1759  std::vector<float> EffError(Nbins);
1760  float Num = 1;
1761  float Den = 1;
1762  for (int i=0;i<20;i++){
1763  Num = readHisto->GetBinContent(i+1);
1764  Den = readHisto->GetBinContent(i+21);
1765  getEfficiency(Num, Den, eff);
1766  Efficiency[i] = eff[0];
1767  EffError[i] = eff[1];
1768  writeHisto->setBinContent(i+1, Efficiency[i]);
1769  writeHisto->setBinError(i+1, EffError[i]);
1770  }
1771 }
1772 
1773 bool CSCOfflineMonitor::withinSensitiveRegion(LocalPoint localPos, const std::array<const float, 4> & layerBounds,
1774  int station, int ring, float shiftFromEdge, float shiftFromDeadZone){
1775 //---- check if it is in a good local region (sensitive area - geometrical and HV boundaries excluded)
1776  bool pass = false;
1777 
1778  float y_center = 0.;
1779  double yUp = layerBounds[3] + y_center;
1780  double yDown = - layerBounds[3] + y_center;
1781  double xBound1Shifted = layerBounds[0] - shiftFromEdge;//
1782  double xBound2Shifted = layerBounds[1] - shiftFromEdge;//
1783  double lineSlope = (yUp - yDown)/(xBound2Shifted-xBound1Shifted);
1784  double lineConst = yUp - lineSlope*xBound2Shifted;
1785  double yBorder = lineSlope*abs(localPos.x()) + lineConst;
1786 
1787  //bool withinChamberOnly = false;// false = "good region"; true - boundaries only
1788  std::vector <float> deadZoneCenter(6);
1789  float cutZone = shiftFromDeadZone;//cm
1790  //---- hardcoded... not good
1791  if(station>1 && station<5){
1792  if(2==ring){
1793  deadZoneCenter[0]= -162.48 ;
1794  deadZoneCenter[1] = -81.8744;
1795  deadZoneCenter[2] = -21.18165;
1796  deadZoneCenter[3] = 39.51105;
1797  deadZoneCenter[4] = 100.2939;
1798  deadZoneCenter[5] = 160.58;
1799 
1800  if(localPos.y() >yBorder &&
1801  ((localPos.y()> deadZoneCenter[0] + cutZone && localPos.y()< deadZoneCenter[1] - cutZone) ||
1802  (localPos.y()> deadZoneCenter[1] + cutZone && localPos.y()< deadZoneCenter[2] - cutZone) ||
1803  (localPos.y()> deadZoneCenter[2] + cutZone && localPos.y()< deadZoneCenter[3] - cutZone) ||
1804  (localPos.y()> deadZoneCenter[3] + cutZone && localPos.y()< deadZoneCenter[4] - cutZone) ||
1805  (localPos.y()> deadZoneCenter[4] + cutZone && localPos.y()< deadZoneCenter[5] - cutZone))){
1806  pass = true;
1807  }
1808  }
1809  else if(1==ring){
1810  if(2==station){
1811  deadZoneCenter[0]= -95.80 ;
1812  deadZoneCenter[1] = -27.47;
1813  deadZoneCenter[2] = 33.67;
1814  deadZoneCenter[3] = 90.85;
1815  }
1816  else if(3==station){
1817  deadZoneCenter[0]= -89.305 ;
1818  deadZoneCenter[1] = -39.705;
1819  deadZoneCenter[2] = 20.195;
1820  deadZoneCenter[3] = 77.395;
1821  }
1822  else if(4==station){
1823  deadZoneCenter[0]= -75.645;
1824  deadZoneCenter[1] = -26.055;
1825  deadZoneCenter[2] = 23.855;
1826  deadZoneCenter[3] = 70.575;
1827  }
1828  if(localPos.y() >yBorder &&
1829  ((localPos.y()> deadZoneCenter[0] + cutZone && localPos.y()< deadZoneCenter[1] - cutZone) ||
1830  (localPos.y()> deadZoneCenter[1] + cutZone && localPos.y()< deadZoneCenter[2] - cutZone) ||
1831  (localPos.y()> deadZoneCenter[2] + cutZone && localPos.y()< deadZoneCenter[3] - cutZone))){
1832  pass = true;
1833  }
1834  }
1835  }
1836  else if(1==station){
1837  if(3==ring){
1838  deadZoneCenter[0]= -83.155 ;
1839  deadZoneCenter[1] = -22.7401;
1840  deadZoneCenter[2] = 27.86665;
1841  deadZoneCenter[3] = 81.005;
1842  if(localPos.y() > yBorder &&
1843  ((localPos.y()> deadZoneCenter[0] + cutZone && localPos.y()< deadZoneCenter[1] - cutZone) ||
1844  (localPos.y()> deadZoneCenter[1] + cutZone && localPos.y()< deadZoneCenter[2] - cutZone) ||
1845  (localPos.y()> deadZoneCenter[2] + cutZone && localPos.y()< deadZoneCenter[3] - cutZone))){
1846  pass = true;
1847  }
1848  }
1849  else if(2==ring){
1850  deadZoneCenter[0]= -86.285 ;
1851  deadZoneCenter[1] = -32.88305;
1852  deadZoneCenter[2] = 32.867423;
1853  deadZoneCenter[3] = 88.205;
1854  if(localPos.y() > (yBorder) &&
1855  ((localPos.y()> deadZoneCenter[0] + cutZone && localPos.y()< deadZoneCenter[1] - cutZone) ||
1856  (localPos.y()> deadZoneCenter[1] + cutZone && localPos.y()< deadZoneCenter[2] - cutZone) ||
1857  (localPos.y()> deadZoneCenter[2] + cutZone && localPos.y()< deadZoneCenter[3] - cutZone))){
1858  pass = true;
1859  }
1860  }
1861  else{
1862  deadZoneCenter[0]= -81.0;
1863  deadZoneCenter[1] = 81.0;
1864  if(localPos.y() > (yBorder) &&
1865  (localPos.y()> deadZoneCenter[0] + cutZone && localPos.y()< deadZoneCenter[1] - cutZone )){
1866  pass = true;
1867  }
1868  }
1869  }
1870  return pass;
1871 }
1872 
1873 
1875 
1876  if (flag == 1){
1877  // linearlized index bases on endcap, station, and ring
1878  int index = 0;
1879  if (id.station() == 1) index = id.ring();
1880  else index = id.station()*2 + id.ring();
1881  if (id.endcap() == 1) index = index + 10;
1882  if (id.endcap() == 2) index = 11 - index;
1883  return index;
1884  }
1885 
1886  else if (flag == 2){
1887  int index = 0;
1888  if (id.station() == 1 && id.ring() != 4) index = id.ring()+1;
1889  if (id.station() == 1 && id.ring() == 4) index = 1;
1890  if (id.station() != 1) index = id.station()*2 + id.ring();
1891  if (id.endcap() == 1) index = index + 10;
1892  if (id.endcap() == 2) index = 11 - index;
1893  return index;
1894  }
1895 
1896  else return 0;
1897 
1898 }
1899 
1901  int st = id.station();
1902  int ri = id.ring();
1903  int ch = id.chamber();
1904  int ec = id.endcap();
1905  int kSerial = ch;
1906  if (st == 1 && ri == 1) kSerial = ch;
1907  if (st == 1 && ri == 2) kSerial = ch + 36;
1908  if (st == 1 && ri == 3) kSerial = ch + 72;
1909  if (st == 1 && ri == 4) kSerial = ch;
1910  if (st == 2 && ri == 1) kSerial = ch + 108;
1911  if (st == 2 && ri == 2) kSerial = ch + 126;
1912  if (st == 3 && ri == 1) kSerial = ch + 162;
1913  if (st == 3 && ri == 2) kSerial = ch + 180;
1914  if (st == 4 && ri == 1) kSerial = ch + 216;
1915  if (st == 4 && ri == 2) kSerial = ch + 234; // one day...
1916  if (ec == 2) kSerial = kSerial + 300;
1917  return kSerial;
1918 }
1919 
1921  if (me != NULL)
1922  {
1923  me->setAxisTitle("Chamber #");
1924  if (t == EXTENDED)
1925  {
1926  me->setBinLabel(1,"ME -4/2",a);
1927  me->setBinLabel(2,"ME -4/1",a);
1928  me->setBinLabel(3,"ME -3/2",a);
1929  me->setBinLabel(4,"ME -3/1",a);
1930  me->setBinLabel(5,"ME -2/2",a);
1931  me->setBinLabel(6,"ME -2/1",a);
1932  me->setBinLabel(7,"ME -1/3",a);
1933  me->setBinLabel(8,"ME -1/2",a);
1934  me->setBinLabel(9,"ME -1/1b",a);
1935  me->setBinLabel(10,"ME -1/1a",a);
1936  me->setBinLabel(11,"ME +1/1a",a);
1937  me->setBinLabel(12,"ME +1/1b",a);
1938  me->setBinLabel(13,"ME +1/2",a);
1939  me->setBinLabel(14,"ME +1/3",a);
1940  me->setBinLabel(15,"ME +2/1",a);
1941  me->setBinLabel(16,"ME +2/2",a);
1942  me->setBinLabel(17,"ME +3/1",a);
1943  me->setBinLabel(18,"ME +3/2",a);
1944  me->setBinLabel(19,"ME +4/1",a);
1945  me->setBinLabel(20,"ME +4/2",a);
1946  }
1947  else if (t == SMALL)
1948  {
1949  me->setBinLabel(1,"ME -4/1",a);
1950  me->setBinLabel(2,"ME -3/2",a);
1951  me->setBinLabel(3,"ME -3/1",a);
1952  me->setBinLabel(4,"ME -2/2",a);
1953  me->setBinLabel(5,"ME -2/1",a);
1954  me->setBinLabel(6,"ME -1/3",a);
1955  me->setBinLabel(7,"ME -1/2",a);
1956  me->setBinLabel(8,"ME -1/1b",a);
1957  me->setBinLabel(9,"ME -1/1a",a);
1958  me->setBinLabel(10,"ME +1/1a",a);
1959  me->setBinLabel(11,"ME +1/1b",a);
1960  me->setBinLabel(12,"ME +1/2",a);
1961  me->setBinLabel(13,"ME +1/3",a);
1962  me->setBinLabel(14,"ME +2/1",a);
1963  me->setBinLabel(15,"ME +2/2",a);
1964  me->setBinLabel(16,"ME +3/1",a);
1965  me->setBinLabel(17,"ME +3/2",a);
1966  me->setBinLabel(18,"ME +4/1",a);
1967  }
1968  }
1969 }
1970 
1972 
uint16_t BXNCount() const
Definition: CSCTMBHeader.h:36
MonitorElement * hEffDenominator
01/20/05 A.Tumanov
void harvestChamberMeans(MonitorElement *meMean1D, MonitorElement *meMean2D, MonitorElement *hNum, MonitorElement *meDenom)
MonitorElement * hOSegmentsSerial
dbl * delta
Definition: mlp_gen.cc:36
edm::EDGetTokenT< CSCALCTDigiCollection > al_token
int chamber() const
Definition: CSCDetId.h:70
void doPedestalNoise(edm::Handle< CSCStripDigiCollection > strips)
T getParameter(std::string const &) const
void crcCFEB(bool enable)
int i
Definition: DBlmapReader.cc:9
MonitorElement * hOWireSerial
void setBinContent(int binx, double content)
set content of bin (1-D)
MonitorElement * hSensitiveAreaEvt
MonitorElement * hOStrips
MonitorElement * hRHSTE
int chamberSerial(CSCDetId id)
MonitorElement * hWireEff2
OStream & output1(void)
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:872
MonitorElement * hORecHits
virtual const std::array< const float, 4 > parameters() const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
CSCDetId id() const
Get the (concrete) DetId.
Definition: CSCChamber.h:37
MonitorElement * hStripSTE2
void histoEfficiency(TH1F *readHisto, MonitorElement *writeHisto)
MonitorElement * hStripReadoutEff2
void doResolution(edm::Handle< CSCSegmentCollection > cscSegments, edm::ESHandle< CSCGeometry > cscGeom)
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
MonitorElement * hRHEff
static const double slope[3]
CSCDetId detId(int vme, int dmb, int cfeb, int layer=0) const
Definition: CSCCrateMap.cc:11
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:47
edm::EDGetTokenT< CSCWireDigiCollection > wd_token
#define nullptr
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
MonitorElement * hALCTMatch2DNumerator
std::vector< MonitorElement * > hRHGlobal
const std::vector< CSCDDUEventData > & dduData() const
accessor to dduData
MonitorElement * hORecHitsSerial
T y() const
Definition: PV3DBase.h:63
void setBinLabel(int bin, const std::string &label, int axis=1)
set bin label for x, y or z axis (axis=1, 2, 3 respectively)
LocalPoint toLocal(const GlobalPoint &gp) const
Conversion to the R.F. of the GeomDet.
Definition: GeomDet.h:62
#define NULL
Definition: scimark2.h:8
std::vector< MonitorElement * > hSChiSq
float getSignal(const CSCStripDigiCollection &stripdigis, CSCDetId idRH, int centerStrip)
virtual void beginRun(edm::Run const &, edm::EventSetup const &)
MonitorElement * hWirenGroupsTotal
MonitorElement * hCLCTL1ASerial
MonitorElement * hOStripSerial
void redirect(std::ostream &str)
edm::ParameterSet param
MonitorElement * hSSTE2
MonitorElement * hSSTE
std::vector< MonitorElement * > hWireNumber
MonitorElement * hALCTgetBXChamberMeans
ExaminerStatusType errors(void) const
void crcALCT(bool enable)
MonitorElement * hWireSTE2
OStream & output2(void)
int layer() const
Definition: CSCDetId.h:63
MonitorElement * hALCTMatch2DMeans
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:47
virtual void endRun(edm::Run const &, edm::EventSetup const &)
MonitorElement * hSGlobalPhi
int getNbinsY(void) const
get # of bins in Y-axis
void Fill(long long x)
std::vector< MonitorElement * > hSnhits
Geom::Theta< T > theta() const
Definition: PV3DBase.h:75
CSCOfflineMonitor(const edm::ParameterSet &pset)
MonitorElement * hOWires
std::string chamberTypeName() const
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
int endcap() const
Definition: CSCDetId.h:95
MonitorElement * hSnSegments
std::vector< MonitorElement * > hRHSumQ
MonitorElement * hOStripsAndWiresAndCLCT
void normalize(MonitorElement *me)
MonitorElement * hOSegments
edm::EDGetTokenT< FEDRawDataCollection > rd_token
std::vector< MonitorElement * > hStripPed
const CSCChamberSpecs * specs() const
Definition: CSCChamber.h:42
MonitorElement * hALCTMatchSerial
int typeIndex(CSCDetId id, int flag=1)
MonitorElement * hSnhitsAll
float fitX(const CLHEP::HepMatrix &sp, const CLHEP::HepMatrix &ep)
MonitorElement * hCLCTL1AChamberMeans
T sqrt(T t)
Definition: SSEVec.h:48
bool check(const DataFrame &df, bool capcheck, bool dvercheck)
std::vector< MonitorElement * > hRHTiming
MonitorElement * hALCTgetBX
T z() const
Definition: PV3DBase.h:64
edm::EDGetTokenT< CSCCLCTDigiCollection > cl_token
MonitorElement * hALCTMatch
void crcTMB(bool enable)
MonitorElement * hSGlobalTheta
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int j
Definition: DBlmapReader.cc:9
const CSCLayer * layer(CSCDetId id) const
Return the layer corresponding to the given id.
Definition: CSCChamber.cc:39
float ChiSquaredProbability(double chiSquared, double nrDOF)
void save(const std::string &filename, const std::string &path="", const std::string &pattern="", const std::string &rewrite="", const uint32_t run=0, SaveReferenceTag ref=SaveWithReference, int minStatus=dqm::qstatus::STATUS_OK, const std::string &fileupdate="RECREATE")
Definition: DQMStore.cc:2296
MonitorElement * hSTimeCombined
MonitorElement * hOWiresAndCLCT
void setBinError(int binx, double error)
set uncertainty on content of bin (1-D)
std::vector< MonitorElement * > hRHsterr
MonitorElement * hCLCTL1A2Denominator
MonitorElement * get(const std::string &path) const
get ME from full pathname (e.g. &quot;my/long/dir/my_histo&quot;)
Definition: DQMStore.cc:1623
MonitorElement * hALCTgetBX2Denominator
static const std::string kLayer("layer")
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
bool first
Definition: L1TdeRCT.cc:79
#define LogTrace(id)
edm::EDGetTokenT< CSCSegmentCollection > se_token
void getEfficiency(float bin, float Norm, std::vector< float > &eff)
uint16_t ALCTMatchTime() const
Definition: CSCTMBHeader.h:39
edm::EDGetTokenT< CSCStripDigiCollection > sd_token
MonitorElement * hSTimeVsZ
int ring() const
Definition: CSCDetId.h:77
void doSegments(edm::Handle< CSCSegmentCollection > cscSegments, edm::ESHandle< CSCGeometry > cscGeom)
void analyze(const edm::Event &event, const edm::EventSetup &eventSetup)
MonitorElement * hRHSTE2
MonitorElement * hALCTgetBX2DMeans
MonitorElement * hSEff2
MonitorElement * hSChiSqAll
MonitorElement * hCSCOccupancy
virtual void endJob()
MonitorElement * hCLCTL1A2DNumerator
void doWireDigis(edm::Handle< CSCWireDigiCollection > wires)
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
MonitorElement * hSEff
MonitorElement * hALCTgetBX2DNumerator
const T & get() const
Definition: EventSetup.h:55
std::vector< MonitorElement * > hStripNumber
T const * product() const
Definition: ESHandle.h:62
MonitorElement * hALCTMatch2Denominator
TH1F * getTH1F(void) const
MonitorElement * hRHEff2
MonitorElement * hALCTMatchChamberMeans
std::vector< CSCCLCTDigi >::const_iterator const_iterator
std::vector< MonitorElement * > hWireTBin
MonitorElement * hCLCTL1A
bool withinSensitiveRegion(LocalPoint localPos, const std::array< const float, 4 > &layerBounds, int station, int ring, float shiftFromEdge, float shiftFromDeadZone)
void doBXMonitor(edm::Handle< CSCALCTDigiCollection > alcts, edm::Handle< CSCCLCTDigiCollection > clcts, const edm::Event &event, const edm::EventSetup &eventSetup)
int32_t check(const uint16_t *&buffer, int32_t length)
MonitorElement * hSTimeCathode
double getBinContent(int binx) const
get content of bin (1-D)
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
if(dp >Float(M_PI)) dp-
double a
Definition: hdecay.h:121
std::vector< MonitorElement * > hRHstpos
void doStripDigis(edm::Handle< CSCStripDigiCollection > strips)
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:28
MonitorElement * hStripNFired
int getNbinsX(void) const
get # of bins in X-axis
std::vector< MonitorElement * > hSResid
int station() const
Definition: CSCDetId.h:88
edm::EDGetTokenT< CSCRecHit2DCollection > rh_token
std::pair< const_iterator, const_iterator > Range
MonitorElement * hStripEff2
MonitorElement * hALCTgetBXSerial
MonitorElement * hSTimeVsTOF
dictionary rawdata
Definition: lumiPlot.py:393
MonitorElement * hRHnrechits
int weight
Definition: histoStyle.py:50
TH2F * getTH2F(void) const
double extrapolate1D(double initPosition, double initDirection, double parameterOfTheLine)
MonitorElement * book2D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Book 2D histogram.
Definition: DQMStore.cc:1000
std::vector< MonitorElement * > hSChiSqProb
std::vector< MonitorElement * > hRHTimingAnode
double lineParametrization(double z1Position, double z2Position, double z1Direction)
void doEfficiencies(edm::Handle< CSCWireDigiCollection > wires, edm::Handle< CSCStripDigiCollection > strips, edm::Handle< CSCRecHit2DCollection > recHits, edm::Handle< CSCSegmentCollection > cscSegments, edm::ESHandle< CSCGeometry > cscGeom)
T x() const
Definition: PV3DBase.h:62
MonitorElement * hCLCTL1A2DMeans
void doOccupancies(edm::Handle< CSCStripDigiCollection > strips, edm::Handle< CSCWireDigiCollection > wires, edm::Handle< CSCRecHit2DCollection > recHits, edm::Handle< CSCSegmentCollection > cscSegments, edm::Handle< CSCCLCTDigiCollection > clcts)
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
const CSCLayerGeometry * geometry() const
Definition: CSCLayer.h:47
void setMask(ExaminerMaskType mask)
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:584
Definition: Run.h:41
MonitorElement * hSChiSqProbAll
void doRecHits(edm::Handle< CSCRecHit2DCollection > recHits, edm::Handle< CSCStripDigiCollection > strips, edm::ESHandle< CSCGeometry > cscGeom)
std::vector< MonitorElement * > hRHRatioQ
void applyCSClabels(MonitorElement *meHisto, LabelType t, AxisType a)