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 using namespace edm;
12 
13 
15 // CONSTRUCTOR //
18 
19  param = pset;
20 
21  stripDigiTag_ = pset.getParameter<edm::InputTag>("stripDigiTag");
22  wireDigiTag_ = pset.getParameter<edm::InputTag>("wireDigiTag");
23  cscRecHitTag_ = pset.getParameter<edm::InputTag>("cscRecHitTag");
24  cscSegTag_ = pset.getParameter<edm::InputTag>("cscSegTag");
25 
26 }
27 
29  dbe = Service<DQMStore>().operator->();
30 
31  // Occupancies
32  dbe->setCurrentFolder("CSC/CSCOfflineMonitor/Occupancy");
33  hCSCOccupancy = dbe->book1D("hCSCOccupancy","overall CSC occupancy",13,-0.5,12.5);
34  hCSCOccupancy->setBinLabel(2,"Total Events");
35  hCSCOccupancy->setBinLabel(4,"# Events with Wires");
36  hCSCOccupancy->setBinLabel(6,"# Events with Strips");
37  hCSCOccupancy->setBinLabel(8,"# Events with Wires&Strips");
38  hCSCOccupancy->setBinLabel(10,"# Events with Rechits");
39  hCSCOccupancy->setBinLabel(12,"# Events with Segments");
40  hOWires = dbe->book2D("hOWires","Wire Digi Occupancy",36,0.5,36.5,20,0.5,20.5);
41  hOWires->setAxisTitle("Chamber #");
42  hOWires->setBinLabel(1,"ME -4/2",2);
43  hOWires->setBinLabel(2,"ME -4/1",2);
44  hOWires->setBinLabel(3,"ME -3/2",2);
45  hOWires->setBinLabel(4,"ME -2/1",2);
46  hOWires->setBinLabel(5,"ME -2/2",2);
47  hOWires->setBinLabel(6,"ME -2/1",2);
48  hOWires->setBinLabel(7,"ME -1/3",2);
49  hOWires->setBinLabel(8,"ME -1/2",2);
50  hOWires->setBinLabel(9,"ME -1/1b",2);
51  hOWires->setBinLabel(10,"ME -1/1a",2);
52  hOWires->setBinLabel(11,"ME +1/1a",2);
53  hOWires->setBinLabel(12,"ME +1/1b",2);
54  hOWires->setBinLabel(13,"ME +1/2",2);
55  hOWires->setBinLabel(14,"ME +1/3",2);
56  hOWires->setBinLabel(15,"ME +2/1",2);
57  hOWires->setBinLabel(16,"ME +2/2",2);
58  hOWires->setBinLabel(17,"ME +3/1",2);
59  hOWires->setBinLabel(18,"ME +3/2",2);
60  hOWires->setBinLabel(19,"ME +4/1",2);
61  hOWires->setBinLabel(20,"ME +4/2",2);
62  hOWireSerial = dbe->book1D("hOWireSerial","Wire Occupancy by Chamber Serial",601,-0.5,600.5);
63  hOWireSerial->setAxisTitle("Chamber Serial Number");
64  hOStrips = dbe->book2D("hOStrips","Strip Digi Occupancy",36,0.5,36.5,20,0.5,20.5);
65  hOStrips->setAxisTitle("Chamber #");
66  hOStrips->setBinLabel(1,"ME -4/2",2);
67  hOStrips->setBinLabel(2,"ME -4/1",2);
68  hOStrips->setBinLabel(3,"ME -3/2",2);
69  hOStrips->setBinLabel(4,"ME -2/1",2);
70  hOStrips->setBinLabel(5,"ME -2/2",2);
71  hOStrips->setBinLabel(6,"ME -2/1",2);
72  hOStrips->setBinLabel(7,"ME -1/3",2);
73  hOStrips->setBinLabel(8,"ME -1/2",2);
74  hOStrips->setBinLabel(9,"ME -1/1b",2);
75  hOStrips->setBinLabel(10,"ME -1/1a",2);
76  hOStrips->setBinLabel(11,"ME +1/1a",2);
77  hOStrips->setBinLabel(12,"ME +1/1b",2);
78  hOStrips->setBinLabel(13,"ME +1/2",2);
79  hOStrips->setBinLabel(14,"ME +1/3",2);
80  hOStrips->setBinLabel(15,"ME +2/1",2);
81  hOStrips->setBinLabel(16,"ME +2/2",2);
82  hOStrips->setBinLabel(17,"ME +3/1",2);
83  hOStrips->setBinLabel(18,"ME +3/2",2);
84  hOStrips->setBinLabel(19,"ME +4/1",2);
85  hOStrips->setBinLabel(20,"ME +4/2",2);
86  hOStripSerial = dbe->book1D("hOStripSerial","Strip Occupancy by Chamber Serial",601,-0.5,600.5);
87  hOStripSerial->setAxisTitle("Chamber Serial Number");
88  hORecHits = dbe->book2D("hORecHits","RecHit Occupancy",36,0.5,36.5,20,0.5,20.5);
89  hORecHits->setAxisTitle("Chamber #");
90  hORecHits->setBinLabel(1,"ME -4/2",2);
91  hORecHits->setBinLabel(2,"ME -4/1",2);
92  hORecHits->setBinLabel(3,"ME -3/2",2);
93  hORecHits->setBinLabel(4,"ME -2/1",2);
94  hORecHits->setBinLabel(5,"ME -2/2",2);
95  hORecHits->setBinLabel(6,"ME -2/1",2);
96  hORecHits->setBinLabel(7,"ME -1/3",2);
97  hORecHits->setBinLabel(8,"ME -1/2",2);
98  hORecHits->setBinLabel(9,"ME -1/1b",2);
99  hORecHits->setBinLabel(10,"ME -1/1a",2);
100  hORecHits->setBinLabel(11,"ME +1/1a",2);
101  hORecHits->setBinLabel(12,"ME +1/1b",2);
102  hORecHits->setBinLabel(13,"ME +1/2",2);
103  hORecHits->setBinLabel(14,"ME +1/3",2);
104  hORecHits->setBinLabel(15,"ME +2/1",2);
105  hORecHits->setBinLabel(16,"ME +2/2",2);
106  hORecHits->setBinLabel(17,"ME +3/1",2);
107  hORecHits->setBinLabel(18,"ME +3/2",2);
108  hORecHits->setBinLabel(19,"ME +4/1",2);
109  hORecHits->setBinLabel(20,"ME +4/2",2);
110  hORecHitsSerial = dbe->book1D("hORecHitSerial","RecHit Occupancy by Chamber Serial",601,-0.5,600.5);
111  hORecHitsSerial->setAxisTitle("Chamber Serial Number");
112  hOSegments = dbe->book2D("hOSegments","Segment Occupancy",36,0.5,36.5,20,0.5,20.5);
113  hOSegments->setAxisTitle("Chamber #");
114  hOSegments->setBinLabel(1,"ME -4/2",2);
115  hOSegments->setBinLabel(2,"ME -4/1",2);
116  hOSegments->setBinLabel(3,"ME -3/2",2);
117  hOSegments->setBinLabel(4,"ME -2/1",2);
118  hOSegments->setBinLabel(5,"ME -2/2",2);
119  hOSegments->setBinLabel(6,"ME -2/1",2);
120  hOSegments->setBinLabel(7,"ME -1/3",2);
121  hOSegments->setBinLabel(8,"ME -1/2",2);
122  hOSegments->setBinLabel(9,"ME -1/1b",2);
123  hOSegments->setBinLabel(10,"ME -1/1a",2);
124  hOSegments->setBinLabel(11,"ME +1/1a",2);
125  hOSegments->setBinLabel(12,"ME +1/1b",2);
126  hOSegments->setBinLabel(13,"ME +1/2",2);
127  hOSegments->setBinLabel(14,"ME +1/3",2);
128  hOSegments->setBinLabel(15,"ME +2/1",2);
129  hOSegments->setBinLabel(16,"ME +2/2",2);
130  hOSegments->setBinLabel(17,"ME +3/1",2);
131  hOSegments->setBinLabel(18,"ME +3/2",2);
132  hOSegments->setBinLabel(19,"ME +4/1",2);
133  hOSegments->setBinLabel(20,"ME +4/2",2);
134  hOSegmentsSerial = dbe->book1D("hOSegmentSerial","Segment Occupancy by Chamber Serial",601,-0.5,600.5);
135  hOSegmentsSerial->setAxisTitle("Chamber Serial Number");
136 
137  // wire digis
138  dbe->setCurrentFolder("CSC/CSCOfflineMonitor/Digis");
139  hWirenGroupsTotal = dbe->book1D("hWirenGroupsTotal","Fired Wires per Event; # Wiregroups Fired",61,-0.5,60.5);
140  hWireTBin.push_back(dbe->book1D("hWireTBin_m42","Wire TBin Fired (ME -4/2); Time Bin (25ns)",17,-0.5,16.5));
141  hWireTBin.push_back(dbe->book1D("hWireTBin_m41","Wire TBin Fired (ME -4/1); Time Bin (25ns)",17,-0.5,16.5));
142  hWireTBin.push_back(dbe->book1D("hWireTBin_m32","Wire TBin Fired (ME -3/2); Time Bin (25ns)",17,-0.5,16.5));
143  hWireTBin.push_back(dbe->book1D("hWireTBin_m31","Wire TBin Fired (ME -3/1); Time Bin (25ns)",17,-0.5,16.5));
144  hWireTBin.push_back(dbe->book1D("hWireTBin_m22","Wire TBin Fired (ME -2/2); Time Bin (25ns)",17,-0.5,16.5));
145  hWireTBin.push_back(dbe->book1D("hWireTBin_m21","Wire TBin Fired (ME -2/1); Time Bin (25ns)",17,-0.5,16.5));
146  hWireTBin.push_back(dbe->book1D("hWireTBin_m11a","Wire TBin Fired (ME -1/1a); Time Bin (25ns)",17,-0.5,16.5));
147  hWireTBin.push_back(dbe->book1D("hWireTBin_m13","Wire TBin Fired (ME -1/3); Time Bin (25ns)",17,-0.5,16.5));
148  hWireTBin.push_back(dbe->book1D("hWireTBin_m12","Wire TBin Fired (ME -1/2); Time Bin (25ns)",17,-0.5,16.5));
149  hWireTBin.push_back(dbe->book1D("hWireTBin_m11b","Wire TBin Fired (ME -1/1b); Time Bin (25ns)",17,-0.5,16.5));
150  hWireTBin.push_back(dbe->book1D("hWireTBin_p11b","Wire TBin Fired (ME +1/1b); Time Bin (25ns)",17,-0.5,16.5));
151  hWireTBin.push_back(dbe->book1D("hWireTBin_p12","Wire TBin Fired (ME +1/2); Time Bin (25ns)",17,-0.5,16.5));
152  hWireTBin.push_back(dbe->book1D("hWireTBin_p13","Wire TBin Fired (ME +1/3); Time Bin (25ns)",17,-0.5,16.5));
153  hWireTBin.push_back(dbe->book1D("hWireTBin_p11a","Wire TBin Fired (ME +1/1a); Time Bin (25ns)",17,-0.5,16.5));
154  hWireTBin.push_back(dbe->book1D("hWireTBin_p21","Wire TBin Fired (ME +2/1); Time Bin (25ns)",17,-0.5,16.5));
155  hWireTBin.push_back(dbe->book1D("hWireTBin_p22","Wire TBin Fired (ME +2/2); Time Bin (25ns)",17,-0.5,16.5));
156  hWireTBin.push_back(dbe->book1D("hWireTBin_p31","Wire TBin Fired (ME +3/1); Time Bin (25ns)",17,-0.5,16.5));
157  hWireTBin.push_back(dbe->book1D("hWireTBin_p32","Wire TBin Fired (ME +3/2); Time Bin (25ns)",17,-0.5,16.5));
158  hWireTBin.push_back(dbe->book1D("hWireTBin_p41","Wire TBin Fired (ME +4/1); Time Bin (25ns)",17,-0.5,16.5));
159  hWireTBin.push_back(dbe->book1D("hWireTBin_p42","Wire TBin Fired (ME +4/2); Time Bin (25ns)",17,-0.5,16.5));
160  hWireNumber.push_back(dbe->book1D("hWireNumber_m42","Wiregroup Number Fired (ME -4/2); Wiregroup #",113,-0.5,112.5));
161  hWireNumber.push_back(dbe->book1D("hWireNumber_m41","Wiregroup Number Fired (ME -4/1); Wiregroup #",113,-0.5,112.5));
162  hWireNumber.push_back(dbe->book1D("hWireNumber_m32","Wiregroup Number Fired (ME -3/2); Wiregroup #",113,-0.5,112.5));
163  hWireNumber.push_back(dbe->book1D("hWireNumber_m31","Wiregroup Number Fired (ME -3/1); Wiregroup #",113,-0.5,112.5));
164  hWireNumber.push_back(dbe->book1D("hWireNumber_m22","Wiregroup Number Fired (ME -2/2); Wiregroup #",113,-0.5,112.5));
165  hWireNumber.push_back(dbe->book1D("hWireNumber_m21","Wiregroup Number Fired (ME -2/1); Wiregroup #",113,-0.5,112.5));
166  hWireNumber.push_back(dbe->book1D("hWireNumber_m11a","Wiregroup Number Fired (ME -1/1a); Wiregroup #",113,-0.5,112.5));
167  hWireNumber.push_back(dbe->book1D("hWireNumber_m13","Wiregroup Number Fired (ME -1/3); Wiregroup #",113,-0.5,112.5));
168  hWireNumber.push_back(dbe->book1D("hWireNumber_m12","Wiregroup Number Fired (ME -1/2); Wiregroup #",113,-0.5,112.5));
169  hWireNumber.push_back(dbe->book1D("hWireNumber_m11b","Wiregroup Number Fired (ME -1/1b); Wiregroup #",113,-0.5,112.5));
170  hWireNumber.push_back(dbe->book1D("hWireNumber_p11b","Wiregroup Number Fired (ME +1/1b); Wiregroup #",113,-0.5,112.5));
171  hWireNumber.push_back(dbe->book1D("hWireNumber_p12","Wiregroup Number Fired (ME +1/2); Wiregroup #",113,-0.5,112.5));
172  hWireNumber.push_back(dbe->book1D("hWireNumber_p13","Wiregroup Number Fired (ME +1/3); Wiregroup #",113,-0.5,112.5));
173  hWireNumber.push_back(dbe->book1D("hWireNumber_p11a","Wiregroup Number Fired (ME +1/1a); Wiregroup #",113,-0.5,112.5));
174  hWireNumber.push_back(dbe->book1D("hWireNumber_p21","Wiregroup Number Fired (ME +2/1); Wiregroup #",113,-0.5,112.5));
175  hWireNumber.push_back(dbe->book1D("hWireNumber_p22","Wiregroup Number Fired (ME +2/2); Wiregroup #",113,-0.5,112.5));
176  hWireNumber.push_back(dbe->book1D("hWireNumber_p31","Wiregroup Number Fired (ME +3/1); Wiregroup #",113,-0.5,112.5));
177  hWireNumber.push_back(dbe->book1D("hWireNumber_p32","Wiregroup Number Fired (ME +3/2); Wiregroup #",113,-0.5,112.5));
178  hWireNumber.push_back(dbe->book1D("hWireNumber_p41","Wiregroup Number Fired (ME +4/1); Wiregroup #",113,-0.5,112.5));
179  hWireNumber.push_back(dbe->book1D("hWireNumber_p42","Wiregroup Number Fired (ME +4/2); Wiregroup #",113,-0.5,112.5));
180 
181  // strip digis
182  hStripNFired = dbe->book1D("hStripNFired","Fired Strips per Event; # Strips Fired (above 13 ADC)",101,-0.5,100.5);
183  hStripNumber.push_back(dbe->book1D("hStripNumber_m42","Strip Number Fired (ME -4/2); Strip # Fired (above 13 ADC)",81,-0.5,80.5));
184  hStripNumber.push_back(dbe->book1D("hStripNumber_m41","Strip Number Fired (ME -4/1); Strip # Fired (above 13 ADC)",81,-0.5,80.5));
185  hStripNumber.push_back(dbe->book1D("hStripNumber_m32","Strip Number Fired (ME -3/2); Strip # Fired (above 13 ADC)",81,-0.5,80.5));
186  hStripNumber.push_back(dbe->book1D("hStripNumber_m31","Strip Number Fired (ME -3/1); Strip # Fired (above 13 ADC)",81,-0.5,80.5));
187  hStripNumber.push_back(dbe->book1D("hStripNumber_m22","Strip Number Fired (ME -2/2); Strip # Fired (above 13 ADC)",81,-0.5,80.5));
188  hStripNumber.push_back(dbe->book1D("hStripNumber_m21","Strip Number Fired (ME -2/1); Strip # Fired (above 13 ADC)",81,-0.5,80.5));
189  hStripNumber.push_back(dbe->book1D("hStripNumber_m11a","Strip Number Fired (ME -1/1a); Strip # Fired (above 13 ADC)",81,-0.5,80.5));
190  hStripNumber.push_back(dbe->book1D("hStripNumber_m13","Strip Number Fired (ME -1/3); Strip # Fired (above 13 ADC)",81,-0.5,80.5));
191  hStripNumber.push_back(dbe->book1D("hStripNumber_m12","Strip Number Fired (ME -1/2); Strip # Fired (above 13 ADC)",81,-0.5,80.5));
192  hStripNumber.push_back(dbe->book1D("hStripNumber_m11b","Strip Number Fired (ME -1/1b); Strip # Fired (above 13 ADC)",81,-0.5,80.5));
193  hStripNumber.push_back(dbe->book1D("hStripNumber_p11b","Strip Number Fired (ME +1/1b); Strip # Fired (above 13 ADC)",81,-0.5,80.5));
194  hStripNumber.push_back(dbe->book1D("hStripNumber_p12","Strip Number Fired (ME +1/2); Strip # Fired (above 13 ADC)",81,-0.5,80.5));
195  hStripNumber.push_back(dbe->book1D("hStripNumber_p13","Strip Number Fired (ME +1/3); Strip # Fired (above 13 ADC)",81,-0.5,80.5));
196  hStripNumber.push_back(dbe->book1D("hStripNumber_p11a","Strip Number Fired (ME +1/1a); Strip # Fired (above 13 ADC)",81,-0.5,80.5));
197  hStripNumber.push_back(dbe->book1D("hStripNumber_p21","Strip Number Fired (ME +2/1); Strip # Fired (above 13 ADC)",81,-0.5,80.5));
198  hStripNumber.push_back(dbe->book1D("hStripNumber_p22","Strip Number Fired (ME +2/2); Strip # Fired (above 13 ADC)",81,-0.5,80.5));
199  hStripNumber.push_back(dbe->book1D("hStripNumber_p31","Strip Number Fired (ME +3/1); Strip # Fired (above 13 ADC)",81,-0.5,80.5));
200  hStripNumber.push_back(dbe->book1D("hStripNumber_p32","Strip Number Fired (ME +3/2); Strip # Fired (above 13 ADC)",81,-0.5,80.5));
201  hStripNumber.push_back(dbe->book1D("hStripNumber_p41","Strip Number Fired (ME +4/1); Strip # Fired (above 13 ADC)",81,-0.5,80.5));
202  hStripNumber.push_back(dbe->book1D("hStripNumber_p42","Stripgroup Number Fired (ME +4/2); Strip # Fired (above 13 ADC)",81,-0.5,80.5));
203 
204  //Pedestal Noise Plots
205  dbe->setCurrentFolder("CSC/CSCOfflineMonitor/PedestalNoise");
206  hStripPed.push_back(dbe->book1D("hStripPedMEm42","Pedestal Noise Distribution Chamber ME -4/2; ADC Counts",50,-25.,25.));
207  hStripPed.push_back(dbe->book1D("hStripPedMEm41","Pedestal Noise Distribution Chamber ME -4/1; ADC Counts",50,-25.,25.));
208  hStripPed.push_back(dbe->book1D("hStripPedMEm32","Pedestal Noise Distribution Chamber ME -3/2; ADC Counts",50,-25.,25.));
209  hStripPed.push_back(dbe->book1D("hStripPedMEm31","Pedestal Noise Distribution Chamber ME -3/1; ADC Counts",50,-25.,25.));
210  hStripPed.push_back(dbe->book1D("hStripPedMEm22","Pedestal Noise Distribution Chamber ME -2/2; ADC Counts",50,-25.,25.));
211  hStripPed.push_back(dbe->book1D("hStripPedMEm21","Pedestal Noise Distribution Chamber ME -2/1; ADC Counts",50,-25.,25.));
212  hStripPed.push_back(dbe->book1D("hStripPedMEm11a","Pedestal Noise Distribution Chamber ME -1/1; ADC Counts",50,-25.,25.));
213  hStripPed.push_back(dbe->book1D("hStripPedMEm13","Pedestal Noise Distribution Chamber ME -1/3; ADC Counts",50,-25.,25.));
214  hStripPed.push_back(dbe->book1D("hStripPedMEm12","Pedestal Noise Distribution Chamber ME -1/2; ADC Counts",50,-25.,25.));
215  hStripPed.push_back(dbe->book1D("hStripPedMEm11b","Pedestal Noise Distribution Chamber ME -1/1; ADC Counts",50,-25.,25.));
216  hStripPed.push_back(dbe->book1D("hStripPedMEp11b","Pedestal Noise Distribution Chamber ME +1/1; ADC Counts",50,-25.,25.));
217  hStripPed.push_back(dbe->book1D("hStripPedMEp12","Pedestal Noise Distribution Chamber ME +1/2; ADC Counts",50,-25.,25.));
218  hStripPed.push_back(dbe->book1D("hStripPedMEp13","Pedestal Noise Distribution Chamber ME +1/3; ADC Counts",50,-25.,25.));
219  hStripPed.push_back(dbe->book1D("hStripPedMEp11a","Pedestal Noise Distribution Chamber ME +1/1; ADC Counts",50,-25.,25.));
220  hStripPed.push_back(dbe->book1D("hStripPedMEp21","Pedestal Noise Distribution Chamber ME +2/1; ADC Counts",50,-25.,25.));
221  hStripPed.push_back(dbe->book1D("hStripPedMEp22","Pedestal Noise Distribution Chamber ME +2/2; ADC Counts",50,-25.,25.));
222  hStripPed.push_back(dbe->book1D("hStripPedMEp31","Pedestal Noise Distribution Chamber ME +3/1; ADC Counts",50,-25.,25.));
223  hStripPed.push_back(dbe->book1D("hStripPedMEp32","Pedestal Noise Distribution Chamber ME +3/2; ADC Counts",50,-25.,25.));
224  hStripPed.push_back(dbe->book1D("hStripPedMEp41","Pedestal Noise Distribution Chamber ME +4/1; ADC Counts",50,-25.,25.));
225  hStripPed.push_back(dbe->book1D("hStripPedMEp42","Pedestal Noise Distribution Chamber ME +4/2; ADC Counts",50,-25.,25.));
226 
227  // recHits
228  dbe->setCurrentFolder("CSC/CSCOfflineMonitor/recHits");
229  hRHnrechits = dbe->book1D("hRHnrechits","recHits per Event (all chambers); # of RecHits",50,0,50);
230  hRHGlobal.push_back(dbe->book2D("hRHGlobalp1","recHit global X,Y station +1; Global X (cm); Global Y (cm)",100,-800.,800.,100,-800.,800.));
231  hRHGlobal.push_back(dbe->book2D("hRHGlobalp2","recHit global X,Y station +2; Global X (cm); Global Y (cm)",100,-800.,800.,100,-800.,800.));
232  hRHGlobal.push_back(dbe->book2D("hRHGlobalp3","recHit global X,Y station +3; Global X (cm); Global Y (cm)",100,-800.,800.,100,-800.,800.));
233  hRHGlobal.push_back(dbe->book2D("hRHGlobalp4","recHit global X,Y station +4; Global X (cm); Global Y (cm)",100,-800.,800.,100,-800.,800.));
234  hRHGlobal.push_back(dbe->book2D("hRHGlobalm1","recHit global X,Y station -1; Global X (cm); Global Y (cm)",100,-800.,800.,100,-800.,800.));
235  hRHGlobal.push_back(dbe->book2D("hRHGlobalm2","recHit global X,Y station -2; Global X (cm); Global Y (cm)",100,-800.,800.,100,-800.,800.));
236  hRHGlobal.push_back(dbe->book2D("hRHGlobalm3","recHit global X,Y station -3; Global X (cm); Global Y (cm)",100,-800.,800.,100,-800.,800.));
237  hRHGlobal.push_back(dbe->book2D("hRHGlobalm4","recHit global X,Y station -4; Global X (cm); Global Y (cm)",100,-800.,800.,100,-800.,800.));
238  hRHSumQ.push_back(dbe->book1D("hRHSumQm42","Sum 3x3 recHit Charge (ME -4/2); ADC counts",100,0,2000));
239  hRHSumQ.push_back(dbe->book1D("hRHSumQm41","Sum 3x3 recHit Charge (ME -4/1); ADC counts",100,0,2000));
240  hRHSumQ.push_back(dbe->book1D("hRHSumQm32","Sum 3x3 recHit Charge (ME -3/2); ADC counts",100,0,2000));
241  hRHSumQ.push_back(dbe->book1D("hRHSumQm31","Sum 3x3 recHit Charge (ME -3/1); ADC counts",100,0,2000));
242  hRHSumQ.push_back(dbe->book1D("hRHSumQm22","Sum 3x3 recHit Charge (ME -2/2); ADC counts",100,0,2000));
243  hRHSumQ.push_back(dbe->book1D("hRHSumQm21","Sum 3x3 recHit Charge (ME -2/1); ADC counts",100,0,2000));
244  hRHSumQ.push_back(dbe->book1D("hRHSumQm11a","Sum 3x3 recHit Charge (ME -1/1a); ADC counts",100,0,4000));
245  hRHSumQ.push_back(dbe->book1D("hRHSumQm13","Sum 3x3 recHit Charge (ME -1/3); ADC counts",100,0,2000));
246  hRHSumQ.push_back(dbe->book1D("hRHSumQm12","Sum 3x3 recHit Charge (ME -1/2); ADC counts",100,0,2000));
247  hRHSumQ.push_back(dbe->book1D("hRHSumQm11b","Sum 3x3 recHit Charge (ME -1/1b); ADC counts",100,0,4000));
248  hRHSumQ.push_back(dbe->book1D("hRHSumQp11b","Sum 3x3 recHit Charge (ME +1/1b); ADC counts",100,0,4000));
249  hRHSumQ.push_back(dbe->book1D("hRHSumQp12","Sum 3x3 recHit Charge (ME +1/2); ADC counts",100,0,2000));
250  hRHSumQ.push_back(dbe->book1D("hRHSumQp13","Sum 3x3 recHit Charge (ME +1/3); ADC counts",100,0,2000));
251  hRHSumQ.push_back(dbe->book1D("hRHSumQp11a","Sum 3x3 recHit Charge (ME +1/1a); ADC counts",100,0,4000));
252  hRHSumQ.push_back(dbe->book1D("hRHSumQp21","Sum 3x3 recHit Charge (ME +2/1); ADC counts",100,0,2000));
253  hRHSumQ.push_back(dbe->book1D("hRHSumQp22","Sum 3x3 recHit Charge (ME +2/2); ADC counts",100,0,2000));
254  hRHSumQ.push_back(dbe->book1D("hRHSumQp31","Sum 3x3 recHit Charge (ME +3/1); ADC counts",100,0,2000));
255  hRHSumQ.push_back(dbe->book1D("hRHSumQp32","Sum 3x3 recHit Charge (ME +3/2); ADC counts",100,0,2000));
256  hRHSumQ.push_back(dbe->book1D("hRHSumQp41","Sum 3x3 recHit Charge (ME +4/1); ADC counts",100,0,2000));
257  hRHSumQ.push_back(dbe->book1D("hRHSumQp42","Sum 3x3 recHit Charge (ME +4/2); ADC counts",100,0,2000));
258  hRHRatioQ.push_back(dbe->book1D("hRHRatioQm42","Charge Ratio (Ql+Qr)/Qt (ME -4/2); (Ql+Qr)/Qt",100,-0.1,1.1));
259  hRHRatioQ.push_back(dbe->book1D("hRHRatioQm41","Charge Ratio (Ql+Qr)/Qt (ME -4/1); (Ql+Qr)/Qt",100,-0.1,1.1));
260  hRHRatioQ.push_back(dbe->book1D("hRHRatioQm32","Charge Ratio (Ql+Qr)/Qt (ME -3/2); (Ql+Qr)/Qt",100,-0.1,1.1));
261  hRHRatioQ.push_back(dbe->book1D("hRHRatioQm31","Charge Ratio (Ql+Qr)/Qt (ME -3/1); (Ql+Qr)/Qt",100,-0.1,1.1));
262  hRHRatioQ.push_back(dbe->book1D("hRHRatioQm22","Charge Ratio (Ql+Qr)/Qt (ME -2/2); (Ql+Qr)/Qt",100,-0.1,1.1));
263  hRHRatioQ.push_back(dbe->book1D("hRHRatioQm21","Charge Ratio (Ql+Qr)/Qt (ME -2/1); (Ql+Qr)/Qt",100,-0.1,1.1));
264  hRHRatioQ.push_back(dbe->book1D("hRHRatioQm11a","Charge Ratio (Ql+Qr)/Qt (ME -1/1a); (Ql+Qr)/Qt",100,-0.1,1.1));
265  hRHRatioQ.push_back(dbe->book1D("hRHRatioQm13","Charge Ratio (Ql+Qr)/Qt (ME -1/3); (Ql+Qr)/Qt",100,-0.1,1.1));
266  hRHRatioQ.push_back(dbe->book1D("hRHRatioQm12","Charge Ratio (Ql+Qr)/Qt (ME -1/2); (Ql+Qr)/Qt",100,-0.1,1.1));
267  hRHRatioQ.push_back(dbe->book1D("hRHRatioQm11b","Charge Ratio (Ql+Qr)/Qt (ME -1/1b); (Ql+Qr)/Qt",100,-0.1,1.1));
268  hRHRatioQ.push_back(dbe->book1D("hRHRatioQp11b","Charge Ratio (Ql+Qr)/Qt (ME +1/1b); (Ql+Qr)/Qt",100,-0.1,1.1));
269  hRHRatioQ.push_back(dbe->book1D("hRHRatioQp12","Charge Ratio (Ql+Qr)/Qt (ME +1/2); (Ql+Qr)/Qt",100,-0.1,1.1));
270  hRHRatioQ.push_back(dbe->book1D("hRHRatioQp13","Charge Ratio (Ql+Qr)/Qt (ME +1/3); (Ql+Qr)/Qt",100,-0.1,1.1));
271  hRHRatioQ.push_back(dbe->book1D("hRHRatioQp11a","Charge Ratio (Ql+Qr)/Qt (ME +1/1a); (Ql+Qr)/Qt",100,-0.1,1.1));
272  hRHRatioQ.push_back(dbe->book1D("hRHRatioQp21","Charge Ratio (Ql+Qr)/Qt (ME +2/1); (Ql+Qr)/Qt",100,-0.1,1.1));
273  hRHRatioQ.push_back(dbe->book1D("hRHRatioQp22","Charge Ratio (Ql+Qr)/Qt (ME +2/2); (Ql+Qr)/Qt",100,-0.1,1.1));
274  hRHRatioQ.push_back(dbe->book1D("hRHRatioQp31","Charge Ratio (Ql+Qr)/Qt (ME +3/1); (Ql+Qr)/Qt",100,-0.1,1.1));
275  hRHRatioQ.push_back(dbe->book1D("hRHRatioQp32","Charge Ratio (Ql+Qr)/Qt (ME +3/2); (Ql+Qr)/Qt",100,-0.1,1.1));
276  hRHRatioQ.push_back(dbe->book1D("hRHRatioQp41","Charge Ratio (Ql+Qr)/Qt (ME +4/1); (Ql+Qr)/Qt",100,-0.1,1.1));
277  hRHRatioQ.push_back(dbe->book1D("hRHRatioQp42","Charge Ratio (Ql+Qr)/Qt (ME +4/2); (Ql+Qr)/Qt",100,-0.1,1.1));
278  hRHTiming.push_back(dbe->book1D("hRHTimingm42","recHit Time (ME -4/2); ns",200,-500.,500.));
279  hRHTiming.push_back(dbe->book1D("hRHTimingm41","recHit Time (ME -4/1); ns",200,-500.,500.));
280  hRHTiming.push_back(dbe->book1D("hRHTimingm32","recHit Time (ME -3/2); ns",200,-500.,500.));
281  hRHTiming.push_back(dbe->book1D("hRHTimingm31","recHit Time (ME -3/1); ns",200,-500.,500.));
282  hRHTiming.push_back(dbe->book1D("hRHTimingm22","recHit Time (ME -2/2); ns",200,-500.,500.));
283  hRHTiming.push_back(dbe->book1D("hRHTimingm21","recHit Time (ME -2/1); ns",200,-500.,500.));
284  hRHTiming.push_back(dbe->book1D("hRHTimingm11a","recHit Time (ME -1/1a); ns",200,-500.,500.));
285  hRHTiming.push_back(dbe->book1D("hRHTimingm13","recHit Time (ME -1/3); ns",200,-500.,500.));
286  hRHTiming.push_back(dbe->book1D("hRHTimingm12","recHit Time (ME -1/2); ns",200,-500.,500.));
287  hRHTiming.push_back(dbe->book1D("hRHTimingm11b","recHit Time (ME -1/1b); ns",200,-500.,500.));
288  hRHTiming.push_back(dbe->book1D("hRHTimingp11b","recHit Time (ME +1/1b); ns",200,-500.,500.));
289  hRHTiming.push_back(dbe->book1D("hRHTimingp12","recHit Time (ME +1/2); ns",200,-500.,500.));
290  hRHTiming.push_back(dbe->book1D("hRHTimingp13","recHit Time (ME +1/3); ns",200,-500.,500.));
291  hRHTiming.push_back(dbe->book1D("hRHTimingp11a","recHit Time (ME +1/1a); ns",200,-500.,500.));
292  hRHTiming.push_back(dbe->book1D("hRHTimingp21","recHit Time (ME +2/1); ns",200,-500.,500.));
293  hRHTiming.push_back(dbe->book1D("hRHTimingp22","recHit Time (ME +2/2); ns",200,-500.,500.));
294  hRHTiming.push_back(dbe->book1D("hRHTimingp31","recHit Time (ME +3/1); ns",200,-500.,500.));
295  hRHTiming.push_back(dbe->book1D("hRHTimingp32","recHit Time (ME +3/2); ns",200,-500.,500.));
296  hRHTiming.push_back(dbe->book1D("hRHTimingp41","recHit Time (ME +4/1); ns",200,-500.,500.));
297  hRHTiming.push_back(dbe->book1D("hRHTimingp42","recHit Time (ME +4/2); ns",200,-500.,500.));
298  hRHstpos.push_back(dbe->book1D("hRHstposm42","Reconstructed Position on Strip (ME -4/2); Strip Widths",120,-0.6,0.6));
299  hRHstpos.push_back(dbe->book1D("hRHstposm41","Reconstructed Position on Strip (ME -4/1); Strip Widths",120,-0.6,0.6));
300  hRHstpos.push_back(dbe->book1D("hRHstposm32","Reconstructed Position on Strip (ME -3/2); Strip Widths",120,-0.6,0.6));
301  hRHstpos.push_back(dbe->book1D("hRHstposm31","Reconstructed Position on Strip (ME -3/1); Strip Widths",120,-0.6,0.6));
302  hRHstpos.push_back(dbe->book1D("hRHstposm22","Reconstructed Position on Strip (ME -2/2); Strip Widths",120,-0.6,0.6));
303  hRHstpos.push_back(dbe->book1D("hRHstposm21","Reconstructed Position on Strip (ME -2/1); Strip Widths",120,-0.6,0.6));
304  hRHstpos.push_back(dbe->book1D("hRHstposm11a","Reconstructed Position on Strip (ME -1/1a); Strip Widths",120,-0.6,0.6));
305  hRHstpos.push_back(dbe->book1D("hRHstposm13","Reconstructed Position on Strip (ME -1/3); Strip Widths",120,-0.6,0.6));
306  hRHstpos.push_back(dbe->book1D("hRHstposm12","Reconstructed Position on Strip (ME -1/2); Strip Widths",120,-0.6,0.6));
307  hRHstpos.push_back(dbe->book1D("hRHstposm11b","Reconstructed Position on Strip (ME -1/1b); Strip Widths",120,-0.6,0.6));
308  hRHstpos.push_back(dbe->book1D("hRHstposp11b","Reconstructed Position on Strip (ME +1/1b); Strip Widths",120,-0.6,0.6));
309  hRHstpos.push_back(dbe->book1D("hRHstposp12","Reconstructed Position on Strip (ME +1/2); Strip Widths",120,-0.6,0.6));
310  hRHstpos.push_back(dbe->book1D("hRHstposp13","Reconstructed Position on Strip (ME +1/3); Strip Widths",120,-0.6,0.6));
311  hRHstpos.push_back(dbe->book1D("hRHstposp11a","Reconstructed Position on Strip (ME +1/1a); Strip Widths",120,-0.6,0.6));
312  hRHstpos.push_back(dbe->book1D("hRHstposp21","Reconstructed Position on Strip (ME +2/1); Strip Widths",120,-0.6,0.6));
313  hRHstpos.push_back(dbe->book1D("hRHstposp22","Reconstructed Position on Strip (ME +2/2); Strip Widths",120,-0.6,0.6));
314  hRHstpos.push_back(dbe->book1D("hRHstposp31","Reconstructed Position on Strip (ME +3/1); Strip Widths",120,-0.6,0.6));
315  hRHstpos.push_back(dbe->book1D("hRHstposp32","Reconstructed Position on Strip (ME +3/2); Strip Widths",120,-0.6,0.6));
316  hRHstpos.push_back(dbe->book1D("hRHstposp41","Reconstructed Position on Strip (ME +4/1); Strip Widths",120,-0.6,0.6));
317  hRHstpos.push_back(dbe->book1D("hRHstposp42","Reconstructed Position on Strip (ME +4/2); Strip Widths",120,-0.6,0.6));
318  hRHsterr.push_back(dbe->book1D("hRHsterrm42","Estimated Error on Strip Measurement (ME -4/2); Strip Widths",75,-0.01,0.24));
319  hRHsterr.push_back(dbe->book1D("hRHsterrm41","Estimated Error on Strip Measurement (ME -4/1); Strip Widths",75,-0.01,0.24));
320  hRHsterr.push_back(dbe->book1D("hRHsterrm32","Estimated Error on Strip Measurement (ME -3/2); Strip Widths",75,-0.01,0.24));
321  hRHsterr.push_back(dbe->book1D("hRHsterrm31","Estimated Error on Strip Measurement (ME -3/1); Strip Widths",75,-0.01,0.24));
322  hRHsterr.push_back(dbe->book1D("hRHsterrm22","Estimated Error on Strip Measurement (ME -2/2); Strip Widths",75,-0.01,0.24));
323  hRHsterr.push_back(dbe->book1D("hRHsterrm21","Estimated Error on Strip Measurement (ME -2/1); Strip Widths",75,-0.01,0.24));
324  hRHsterr.push_back(dbe->book1D("hRHsterrm11a","Estimated Error on Strip Measurement (ME -1/1a); Strip Widths",75,-0.01,0.24));
325  hRHsterr.push_back(dbe->book1D("hRHsterrm13","Estimated Error on Strip Measurement (ME -1/3); Strip Widths",75,-0.01,0.24));
326  hRHsterr.push_back(dbe->book1D("hRHsterrm12","Estimated Error on Strip Measurement (ME -1/2); Strip Widths",75,-0.01,0.24));
327  hRHsterr.push_back(dbe->book1D("hRHsterrm11b","Estimated Error on Strip Measurement (ME -1/1b); Strip Widths",75,-0.01,0.24));
328  hRHsterr.push_back(dbe->book1D("hRHsterrp11b","Estimated Error on Strip Measurement (ME +1/1b); Strip Widths",75,-0.01,0.24));
329  hRHsterr.push_back(dbe->book1D("hRHsterrp12","Estimated Error on Strip Measurement (ME +1/2); Strip Widths",75,-0.01,0.24));
330  hRHsterr.push_back(dbe->book1D("hRHsterrp13","Estimated Error on Strip Measurement (ME +1/3); Strip Widths",75,-0.01,0.24));
331  hRHsterr.push_back(dbe->book1D("hRHsterrp11a","Estimated Error on Strip Measurement (ME +1/1a); Strip Widths",75,-0.01,0.24));
332  hRHsterr.push_back(dbe->book1D("hRHsterrp21","Estimated Error on Strip Measurement (ME +2/1); Strip Widths",75,-0.01,0.24));
333  hRHsterr.push_back(dbe->book1D("hRHsterrp22","Estimated Error on Strip Measurement (ME +2/2); Strip Widths",75,-0.01,0.24));
334  hRHsterr.push_back(dbe->book1D("hRHsterrp31","Estimated Error on Strip Measurement (ME +3/1); Strip Widths",75,-0.01,0.24));
335  hRHsterr.push_back(dbe->book1D("hRHsterrp32","Estimated Error on Strip Measurement (ME +3/2); Strip Widths",75,-0.01,0.24));
336  hRHsterr.push_back(dbe->book1D("hRHsterrp41","Estimated Error on Strip Measurement (ME +4/1); Strip Widths",75,-0.01,0.24));
337  hRHsterr.push_back(dbe->book1D("hRHsterrp42","Estimated Error on Strip Measurement (ME +4/2); Strip Widths",75,-0.01,0.24));
338 
339 
340  // segments
341  dbe->setCurrentFolder("CSC/CSCOfflineMonitor/Segments");
342  hSnSegments = dbe->book1D("hSnSegments","Number of Segments per Event; # of Segments",11,-0.5,10.5);
343  hSnhitsAll = dbe->book1D("hSnhits","N hits on Segments; # of hits",8,-0.5,7.5);
344  hSnhits.push_back(dbe->book1D("hSnhitsm42","# of hits on Segments (ME -4/2); # of hits",8,-0.5,7.5));
345  hSnhits.push_back(dbe->book1D("hSnhitsm41","# of hits on Segments (ME -4/1); # of hits",8,-0.5,7.5));
346  hSnhits.push_back(dbe->book1D("hSnhitsm32","# of hits on Segments (ME -3/2); # of hits",8,-0.5,7.5));
347  hSnhits.push_back(dbe->book1D("hSnhitsm31","# of hits on Segments (ME -3/1); # of hits",8,-0.5,7.5));
348  hSnhits.push_back(dbe->book1D("hSnhitsm22","# of hits on Segments (ME -2/2); # of hits",8,-0.5,7.5));
349  hSnhits.push_back(dbe->book1D("hSnhitsm21","# of hits on Segments (ME -2/1); # of hits",8,-0.5,7.5));
350  hSnhits.push_back(dbe->book1D("hSnhitsm11a","# of hits on Segments (ME -1/1a); # of hits",8,-0.5,7.5));
351  hSnhits.push_back(dbe->book1D("hSnhitsm13","# of hits on Segments (ME -1/3); # of hits",8,-0.5,7.5));
352  hSnhits.push_back(dbe->book1D("hSnhitsm12","# of hits on Segments (ME -1/2); # of hits",8,-0.5,7.5));
353  hSnhits.push_back(dbe->book1D("hSnhitsm11b","# of hits on Segments (ME -1/1b); # of hits",8,-0.5,7.5));
354  hSnhits.push_back(dbe->book1D("hSnhitsp11b","# of hits on Segments (ME +1/1b); # of hits",8,-0.5,7.5));
355  hSnhits.push_back(dbe->book1D("hSnhitsp12","# of hits on Segments (ME +1/2); # of hits",8,-0.5,7.5));
356  hSnhits.push_back(dbe->book1D("hSnhitsp13","# of hits on Segments (ME +1/3); # of hits",8,-0.5,7.5));
357  hSnhits.push_back(dbe->book1D("hSnhitsp11a","# of hits on Segments (ME +1/1a); # of hits",8,-0.5,7.5));
358  hSnhits.push_back(dbe->book1D("hSnhitsp21","# of hits on Segments (ME +2/1); # of hits",8,-0.5,7.5));
359  hSnhits.push_back(dbe->book1D("hSnhitsp22","# of hits on Segments (ME +2/2); # of hits",8,-0.5,7.5));
360  hSnhits.push_back(dbe->book1D("hSnhitsp31","# of hits on Segments (ME +3/1); # of hits",8,-0.5,7.5));
361  hSnhits.push_back(dbe->book1D("hSnhitsp32","# of hits on Segments (ME +3/2); # of hits",8,-0.5,7.5));
362  hSnhits.push_back(dbe->book1D("hSnhitsp41","# of hits on Segments (ME +4/1); # of hits",8,-0.5,7.5));
363  hSnhits.push_back(dbe->book1D("hSnhitsp42","# of hits on Segments (ME +4/2); # of hits",8,-0.5,7.5));
364  hSChiSqAll = dbe->book1D("hSChiSq","Segment Normalized Chi2; Chi2/ndof",110,-0.05,10.5);
365  hSChiSq.push_back(dbe->book1D("hSChiSqm42","Segment Normalized Chi2 (ME -4/2); Chi2/ndof",110,-0.05,10.5));
366  hSChiSq.push_back(dbe->book1D("hSChiSqm41","Segment Normalized Chi2 (ME -4/1); Chi2/ndof",110,-0.05,10.5));
367  hSChiSq.push_back(dbe->book1D("hSChiSqm32","Segment Normalized Chi2 (ME -3/2); Chi2/ndof",110,-0.05,10.5));
368  hSChiSq.push_back(dbe->book1D("hSChiSqm31","Segment Normalized Chi2 (ME -3/1); Chi2/ndof",110,-0.05,10.5));
369  hSChiSq.push_back(dbe->book1D("hSChiSqm22","Segment Normalized Chi2 (ME -2/2); Chi2/ndof",110,-0.05,10.5));
370  hSChiSq.push_back(dbe->book1D("hSChiSqm21","Segment Normalized Chi2 (ME -2/1); Chi2/ndof",110,-0.05,10.5));
371  hSChiSq.push_back(dbe->book1D("hSChiSqm11a","Segment Normalized Chi2 (ME -1/1a); Chi2/ndof",110,-0.05,10.5));
372  hSChiSq.push_back(dbe->book1D("hSChiSqm13","Segment Normalized Chi2 (ME -1/3); Chi2/ndof",110,-0.05,10.5));
373  hSChiSq.push_back(dbe->book1D("hSChiSqm12","Segment Normalized Chi2 (ME -1/2); Chi2/ndof",110,-0.05,10.5));
374  hSChiSq.push_back(dbe->book1D("hSChiSqm11b","Segment Normalized Chi2 (ME -1/1b); Chi2/ndof",110,-0.05,10.5));
375  hSChiSq.push_back(dbe->book1D("hSChiSqp11b","Segment Normalized Chi2 (ME +1/1b); Chi2/ndof",110,-0.05,10.5));
376  hSChiSq.push_back(dbe->book1D("hSChiSqp12","Segment Normalized Chi2 (ME +1/2); Chi2/ndof",110,-0.05,10.5));
377  hSChiSq.push_back(dbe->book1D("hSChiSqp13","Segment Normalized Chi2 (ME +1/3); Chi2/ndof",110,-0.05,10.5));
378  hSChiSq.push_back(dbe->book1D("hSChiSqp11a","Segment Normalized Chi2 (ME +1/1a); Chi2/ndof",110,-0.05,10.5));
379  hSChiSq.push_back(dbe->book1D("hSChiSqp21","Segment Normalized Chi2 (ME +2/1); Chi2/ndof",110,-0.05,10.5));
380  hSChiSq.push_back(dbe->book1D("hSChiSqp22","Segment Normalized Chi2 (ME +2/2); Chi2/ndof",110,-0.05,10.5));
381  hSChiSq.push_back(dbe->book1D("hSChiSqp31","Segment Normalized Chi2 (ME +3/1); Chi2/ndof",110,-0.05,10.5));
382  hSChiSq.push_back(dbe->book1D("hSChiSqp32","Segment Normalized Chi2 (ME +3/2); Chi2/ndof",110,-0.05,10.5));
383  hSChiSq.push_back(dbe->book1D("hSChiSqp41","Segment Normalized Chi2 (ME +4/1); Chi2/ndof",110,-0.05,10.5));
384  hSChiSq.push_back(dbe->book1D("hSChiSqp42","Segment Normalized Chi2 (ME +4/2); Chi2/ndof",110,-0.05,10.5));
385  hSChiSqProbAll = dbe->book1D("hSChiSqProb","Segment chi2 Probability; Probability",110,-0.05,1.05);
386  hSChiSqProb.push_back(dbe->book1D("hSChiSqProbm42","Segment chi2 Probability (ME -4/2); Probability",110,-0.05,1.05));
387  hSChiSqProb.push_back(dbe->book1D("hSChiSqProbm41","Segment chi2 Probability (ME -4/1); Probability",110,-0.05,1.05));
388  hSChiSqProb.push_back(dbe->book1D("hSChiSqProbm32","Segment chi2 Probability (ME -3/2); Probability",110,-0.05,1.05));
389  hSChiSqProb.push_back(dbe->book1D("hSChiSqProbm31","Segment chi2 Probability (ME -3/1); Probability",110,-0.05,1.05));
390  hSChiSqProb.push_back(dbe->book1D("hSChiSqProbm22","Segment chi2 Probability (ME -2/2); Probability",110,-0.05,1.05));
391  hSChiSqProb.push_back(dbe->book1D("hSChiSqProbm21","Segment chi2 Probability (ME -2/1); Probability",110,-0.05,1.05));
392  hSChiSqProb.push_back(dbe->book1D("hSChiSqProbm11a","Segment chi2 Probability (ME -1/1a); Probability",110,-0.05,1.05));
393  hSChiSqProb.push_back(dbe->book1D("hSChiSqProbm13","Segment chi2 Probability (ME -1/3); Probability",110,-0.05,1.05));
394  hSChiSqProb.push_back(dbe->book1D("hSChiSqProbm12","Segment chi2 Probability (ME -1/2); Probability",110,-0.05,1.05));
395  hSChiSqProb.push_back(dbe->book1D("hSChiSqProbm11b","Segment chi2 Probability (ME -1/1b); Probability",110,-0.05,1.05));
396  hSChiSqProb.push_back(dbe->book1D("hSChiSqProbp11b","Segment chi2 Probability (ME +1/1b); Probability",110,-0.05,1.05));
397  hSChiSqProb.push_back(dbe->book1D("hSChiSqProbp12","Segment chi2 Probability (ME +1/2); Probability",110,-0.05,1.05));
398  hSChiSqProb.push_back(dbe->book1D("hSChiSqProbp13","Segment chi2 Probability (ME +1/3); Probability",110,-0.05,1.05));
399  hSChiSqProb.push_back(dbe->book1D("hSChiSqProbp11a","Segment chi2 Probability (ME +1/1a); Probability",110,-0.05,1.05));
400  hSChiSqProb.push_back(dbe->book1D("hSChiSqProbp21","Segment chi2 Probability (ME +2/1); Probability",110,-0.05,1.05));
401  hSChiSqProb.push_back(dbe->book1D("hSChiSqProbp22","Segment chi2 Probability (ME +2/2); Probability",110,-0.05,1.05));
402  hSChiSqProb.push_back(dbe->book1D("hSChiSqProbp31","Segment chi2 Probability (ME +3/1); Probability",110,-0.05,1.05));
403  hSChiSqProb.push_back(dbe->book1D("hSChiSqProbp32","Segment chi2 Probability (ME +3/2); Probability",110,-0.05,1.05));
404  hSChiSqProb.push_back(dbe->book1D("hSChiSqProbp41","Segment chi2 Probability (ME +4/1); Probability",110,-0.05,1.05));
405  hSChiSqProb.push_back(dbe->book1D("hSChiSqProbp42","Segment chi2 Probability (ME +4/2); Probability",110,-0.05,1.05));
406  hSGlobalTheta = dbe->book1D("hSGlobalTheta","Segment Direction (Global Theta); Global Theta (radians)",136,-0.1,3.3);
407  hSGlobalPhi = dbe->book1D("hSGlobalPhi","Segment Direction (Global Phi); Global Phi (radians)", 128,-3.2,3.2);
408 
409  // Resolution
410  dbe->setCurrentFolder("CSC/CSCOfflineMonitor/Resolution");
411  hSResid.push_back(dbe->book1D("hSResidm42","Fitted Position on Strip - Reconstructed for Layer 3 (ME -4/2); Strip Widths",100,-0.5,0.5));
412  hSResid.push_back(dbe->book1D("hSResidm41","Fitted Position on Strip - Reconstructed for Layer 3 (ME -4/1); Strip Widths",100,-0.5,0.5));
413  hSResid.push_back(dbe->book1D("hSResidm32","Fitted Position on Strip - Reconstructed for Layer 3 (ME -3/2); Strip Widths",100,-0.5,0.5));
414  hSResid.push_back(dbe->book1D("hSResidm31","Fitted Position on Strip - Reconstructed for Layer 3 (ME -3/1); Strip Widths",100,-0.5,0.5));
415  hSResid.push_back(dbe->book1D("hSResidm22","Fitted Position on Strip - Reconstructed for Layer 3 (ME -2/2); Strip Widths",100,-0.5,0.5));
416  hSResid.push_back(dbe->book1D("hSResidm21","Fitted Position on Strip - Reconstructed for Layer 3 (ME -2/1); Strip Widths",100,-0.5,0.5));
417  hSResid.push_back(dbe->book1D("hSResidm11a","Fitted Position on Strip - Reconstructed for Layer 3 (ME -1/1a); Strip Widths",100,-0.5,0.5));
418  hSResid.push_back(dbe->book1D("hSResidm13","Fitted Position on Strip - Reconstructed for Layer 3 (ME -1/3); Strip Widths",100,-0.5,0.5));
419  hSResid.push_back(dbe->book1D("hSResidm12","Fitted Position on Strip - Reconstructed for Layer 3 (ME -1/2); Strip Widths",100,-0.5,0.5));
420  hSResid.push_back(dbe->book1D("hSResidm11b","Fitted Position on Strip - Reconstructed for Layer 3 (ME -1/1b); Strip Widths",100,-0.5,0.5));
421  hSResid.push_back(dbe->book1D("hSResidp11b","Fitted Position on Strip - Reconstructed for Layer 3 (ME +1/1b); Strip Widths",100,-0.5,0.5));
422  hSResid.push_back(dbe->book1D("hSResidp12","Fitted Position on Strip - Reconstructed for Layer 3 (ME +1/2); Strip Widths",100,-0.5,0.5));
423  hSResid.push_back(dbe->book1D("hSResidp13","Fitted Position on Strip - Reconstructed for Layer 3 (ME +1/3); Strip Widths",100,-0.5,0.5));
424  hSResid.push_back(dbe->book1D("hSResidp11a","Fitted Position on Strip - Reconstructed for Layer 3 (ME +1/1a); Strip Widths",100,-0.5,0.5));
425  hSResid.push_back(dbe->book1D("hSResidp21","Fitted Position on Strip - Reconstructed for Layer 3 (ME +2/1); Strip Widths",100,-0.5,0.5));
426  hSResid.push_back(dbe->book1D("hSResidp22","Fitted Position on Strip - Reconstructed for Layer 3 (ME +2/2); Strip Widths",100,-0.5,0.5));
427  hSResid.push_back(dbe->book1D("hSResidp31","Fitted Position on Strip - Reconstructed for Layer 3 (ME +3/1); Strip Widths",100,-0.5,0.5));
428  hSResid.push_back(dbe->book1D("hSResidp32","Fitted Position on Strip - Reconstructed for Layer 3 (ME +3/2); Strip Widths",100,-0.5,0.5));
429  hSResid.push_back(dbe->book1D("hSResidp41","Fitted Position on Strip - Reconstructed for Layer 3 (ME +4/1); Strip Widths",100,-0.5,0.5));
430  hSResid.push_back(dbe->book1D("hSResidp42","Fitted Position on Strip - Reconstructed for Layer 3 (ME +4/2); Strip Widths",100,-0.5,0.5));
431 
432  // Efficiency
433  dbe->setCurrentFolder("CSC/CSCOfflineMonitor/Efficiency");
434  hSSTE = new TH1F("hSSTE","hSSTE",40,0.5,40.5);
435  hRHSTE = new TH1F("hRHSTE","hRHSTE",40,0.5,40.5);
436  hSEff = dbe->book1D("hSEff","Segment Efficiency",20,0.5,20.5);
437  hSEff->setBinLabel(1,"ME +1/1b");
438  hSEff->setBinLabel(2,"ME +1/2");
439  hSEff->setBinLabel(3,"ME +1/3");
440  hSEff->setBinLabel(4,"ME +1/1a");
441  hSEff->setBinLabel(5,"ME +2/1");
442  hSEff->setBinLabel(6,"ME +2/2");
443  hSEff->setBinLabel(7,"ME +3/1");
444  hSEff->setBinLabel(8,"ME +3/2");
445  hSEff->setBinLabel(9,"ME +4/1");
446  hSEff->setBinLabel(10,"ME +4/2");
447  hSEff->setBinLabel(11,"ME -1/1b");
448  hSEff->setBinLabel(12,"ME -1/2");
449  hSEff->setBinLabel(13,"ME -1/3");
450  hSEff->setBinLabel(14,"ME -1/1a");
451  hSEff->setBinLabel(15,"ME -2/1");
452  hSEff->setBinLabel(16,"ME -2/2");
453  hSEff->setBinLabel(17,"ME -3/1");
454  hSEff->setBinLabel(18,"ME -3/2");
455  hSEff->setBinLabel(19,"ME -4/1");
456  hSEff->setBinLabel(20,"ME -4/2");
457  hRHEff = dbe->book1D("hRHEff","recHit Efficiency",20,0.5,20.5);
458  hRHEff->setBinLabel(1,"ME +1/1b");
459  hRHEff->setBinLabel(2,"ME +1/2");
460  hRHEff->setBinLabel(3,"ME +1/3");
461  hRHEff->setBinLabel(4,"ME +1/1a");
462  hRHEff->setBinLabel(5,"ME +2/1");
463  hRHEff->setBinLabel(6,"ME +2/2");
464  hRHEff->setBinLabel(7,"ME +3/1");
465  hRHEff->setBinLabel(8,"ME +3/2");
466  hRHEff->setBinLabel(9,"ME +4/1");
467  hRHEff->setBinLabel(10,"ME +4/2");
468  hRHEff->setBinLabel(11,"ME -1/1b");
469  hRHEff->setBinLabel(12,"ME -1/2");
470  hRHEff->setBinLabel(13,"ME -1/3");
471  hRHEff->setBinLabel(14,"ME -1/1a");
472  hRHEff->setBinLabel(15,"ME -2/1");
473  hRHEff->setBinLabel(16,"ME -2/2");
474  hRHEff->setBinLabel(17,"ME -3/1");
475  hRHEff->setBinLabel(18,"ME -3/2");
476  hRHEff->setBinLabel(19,"ME -4/1");
477  hRHEff->setBinLabel(20,"ME -4/2");
478  hSSTE2 = new TH2F("hSSTE2","hSSTE2",36,0.5,36.5, 18, 0.5, 18.5);
479  hRHSTE2 = new TH2F("hRHSTE2","hRHSTE2",36,0.5,36.5, 18, 0.5, 18.5);
480  hStripSTE2 = new TH2F("hStripSTE2","hStripSTE2",36,0.5,36.5, 18, 0.5, 18.5);
481  hWireSTE2 = new TH2F("hWireSTE2","hWireSTE2",36,0.5,36.5, 18, 0.5, 18.5);
482  hEffDenominator = new TH2F("hEffDenominator","hEffDenominator",36,0.5,36.5, 18, 0.5, 18.5);
483  hSEff2 = dbe->book2D("hSEff2","Segment Efficiency 2D",36,0.5,36.5, 18, 0.5, 18.5);
484  hSEff2->setAxisTitle("Chamber #");
485  hSEff2->setBinLabel(1,"ME -4/1",2);
486  hSEff2->setBinLabel(2,"ME -3/2",2);
487  hSEff2->setBinLabel(3,"ME -2/1",2);
488  hSEff2->setBinLabel(4,"ME -2/2",2);
489  hSEff2->setBinLabel(5,"ME -2/1",2);
490  hSEff2->setBinLabel(6,"ME -1/3",2);
491  hSEff2->setBinLabel(7,"ME -1/2",2);
492  hSEff2->setBinLabel(8,"ME -1/1b",2);
493  hSEff2->setBinLabel(9,"ME -1/1a",2);
494  hSEff2->setBinLabel(10,"ME +1/1a",2);
495  hSEff2->setBinLabel(11,"ME +1/1b",2);
496  hSEff2->setBinLabel(12,"ME +1/2",2);
497  hSEff2->setBinLabel(13,"ME +1/3",2);
498  hSEff2->setBinLabel(14,"ME +2/1",2);
499  hSEff2->setBinLabel(15,"ME +2/2",2);
500  hSEff2->setBinLabel(16,"ME +3/1",2);
501  hSEff2->setBinLabel(17,"ME +3/2",2);
502  hSEff2->setBinLabel(18,"ME +4/1",2);
503  hRHEff2 = dbe->book2D("hRHEff2","recHit Efficiency 2D",36,0.5,36.5, 18, 0.5, 18.5);
504  hRHEff2->setAxisTitle("Chamber #");
505  hRHEff2->setBinLabel(1,"ME -4/1",2);
506  hRHEff2->setBinLabel(2,"ME -3/2",2);
507  hRHEff2->setBinLabel(3,"ME -2/1",2);
508  hRHEff2->setBinLabel(4,"ME -2/2",2);
509  hRHEff2->setBinLabel(5,"ME -2/1",2);
510  hRHEff2->setBinLabel(6,"ME -1/3",2);
511  hRHEff2->setBinLabel(7,"ME -1/2",2);
512  hRHEff2->setBinLabel(8,"ME -1/1b",2);
513  hRHEff2->setBinLabel(9,"ME -1/1a",2);
514  hRHEff2->setBinLabel(10,"ME +1/1a",2);
515  hRHEff2->setBinLabel(11,"ME +1/1b",2);
516  hRHEff2->setBinLabel(12,"ME +1/2",2);
517  hRHEff2->setBinLabel(13,"ME +1/3",2);
518  hRHEff2->setBinLabel(14,"ME +2/1",2);
519  hRHEff2->setBinLabel(15,"ME +2/2",2);
520  hRHEff2->setBinLabel(16,"ME +3/1",2);
521  hRHEff2->setBinLabel(17,"ME +3/2",2);
522  hRHEff2->setBinLabel(18,"ME +4/1",2);
523  hStripEff2 = dbe->book2D("hStripEff2","strip Efficiency 2D",36,0.5,36.5, 18, 0.5, 18.5);
524  hStripEff2->setAxisTitle("Chamber #");
525  hStripEff2->setBinLabel(1,"ME -4/1",2);
526  hStripEff2->setBinLabel(2,"ME -3/2",2);
527  hStripEff2->setBinLabel(3,"ME -2/1",2);
528  hStripEff2->setBinLabel(4,"ME -2/2",2);
529  hStripEff2->setBinLabel(5,"ME -2/1",2);
530  hStripEff2->setBinLabel(6,"ME -1/3",2);
531  hStripEff2->setBinLabel(7,"ME -1/2",2);
532  hStripEff2->setBinLabel(8,"ME -1/1b",2);
533  hStripEff2->setBinLabel(9,"ME -1/1a",2);
534  hStripEff2->setBinLabel(10,"ME +1/1a",2);
535  hStripEff2->setBinLabel(11,"ME +1/1b",2);
536  hStripEff2->setBinLabel(12,"ME +1/2",2);
537  hStripEff2->setBinLabel(13,"ME +1/3",2);
538  hStripEff2->setBinLabel(14,"ME +2/1",2);
539  hStripEff2->setBinLabel(15,"ME +2/2",2);
540  hStripEff2->setBinLabel(16,"ME +3/1",2);
541  hStripEff2->setBinLabel(17,"ME +3/2",2);
542  hStripEff2->setBinLabel(18,"ME +4/1",2);
543  hWireEff2 = dbe->book2D("hWireEff2","wire Efficiency 2D",36,0.5,36.5, 18, 0.5, 18.5);
544  hWireEff2->setAxisTitle("Chamber #");
545  hWireEff2->setBinLabel(1,"ME -4/1",2);
546  hWireEff2->setBinLabel(2,"ME -3/2",2);
547  hWireEff2->setBinLabel(3,"ME -2/1",2);
548  hWireEff2->setBinLabel(4,"ME -2/2",2);
549  hWireEff2->setBinLabel(5,"ME -2/1",2);
550  hWireEff2->setBinLabel(6,"ME -1/3",2);
551  hWireEff2->setBinLabel(7,"ME -1/2",2);
552  hWireEff2->setBinLabel(8,"ME -1/1b",2);
553  hWireEff2->setBinLabel(9,"ME -1/1a",2);
554  hWireEff2->setBinLabel(10,"ME +1/1a",2);
555  hWireEff2->setBinLabel(11,"ME +1/1b",2);
556  hWireEff2->setBinLabel(12,"ME +1/2",2);
557  hWireEff2->setBinLabel(13,"ME +1/3",2);
558  hWireEff2->setBinLabel(14,"ME +2/1",2);
559  hWireEff2->setBinLabel(15,"ME +2/2",2);
560  hWireEff2->setBinLabel(16,"ME +3/1",2);
561  hWireEff2->setBinLabel(17,"ME +3/2",2);
562  hWireEff2->setBinLabel(18,"ME +4/1",2);
563  hSensitiveAreaEvt = dbe->book2D("hSensitiveAreaEvt","Events Passing Selection for Efficiency",36,0.5,36.5, 18, 0.5, 18.5);
564  hSensitiveAreaEvt->setAxisTitle("Chamber #");
565  hSensitiveAreaEvt->setBinLabel(1,"ME -4/1",2);
566  hSensitiveAreaEvt->setBinLabel(2,"ME -3/2",2);
567  hSensitiveAreaEvt->setBinLabel(3,"ME -2/1",2);
568  hSensitiveAreaEvt->setBinLabel(4,"ME -2/2",2);
569  hSensitiveAreaEvt->setBinLabel(5,"ME -2/1",2);
570  hSensitiveAreaEvt->setBinLabel(6,"ME -1/3",2);
571  hSensitiveAreaEvt->setBinLabel(7,"ME -1/2",2);
572  hSensitiveAreaEvt->setBinLabel(8,"ME -1/1b",2);
573  hSensitiveAreaEvt->setBinLabel(9,"ME -1/1a",2);
574  hSensitiveAreaEvt->setBinLabel(10,"ME +1/1a",2);
575  hSensitiveAreaEvt->setBinLabel(11,"ME +1/1b",2);
576  hSensitiveAreaEvt->setBinLabel(12,"ME +1/2",2);
577  hSensitiveAreaEvt->setBinLabel(13,"ME +1/3",2);
578  hSensitiveAreaEvt->setBinLabel(14,"ME +2/1",2);
579  hSensitiveAreaEvt->setBinLabel(15,"ME +2/2",2);
580  hSensitiveAreaEvt->setBinLabel(16,"ME +3/1",2);
581  hSensitiveAreaEvt->setBinLabel(17,"ME +3/2",2);
582  hSensitiveAreaEvt->setBinLabel(18,"ME +4/1",2);
583 
584 }
585 
587 // DESTRUCTOR //
590 
591 }
592 
594 
595  hRHEff = dbe->get("CSC/CSCOfflineMonitor/Efficiency/hRHEff");
596  hSEff = dbe->get("CSC/CSCOfflineMonitor/Efficiency/hSEff");
597  hSEff2 = dbe->get("CSC/CSCOfflineMonitor/Efficiency/hSEff2");
598  hRHEff2 = dbe->get("CSC/CSCOfflineMonitor/Efficiency/hRHEff2");
599  hStripEff2 = dbe->get("CSC/CSCOfflineMonitor/Efficiency/hStripEff2");
600  hWireEff2 = dbe->get("CSC/CSCOfflineMonitor/Efficiency/hWireEff2");
601 
602  if (hRHEff) histoEfficiency(hRHSTE,hRHEff);
603  if (hSEff) histoEfficiency(hSSTE,hSEff);
604  if (hSEff2) hSEff2->getTH2F()->Divide(hSSTE2,hEffDenominator,1.,1.,"B");
605  if (hRHEff2) hRHEff2->getTH2F()->Divide(hRHSTE2,hEffDenominator,1.,1.,"B");
606  if (hStripEff2) hStripEff2->getTH2F()->Divide(hStripSTE2,hEffDenominator,1.,1.,"B");
607  if (hWireEff2) hWireEff2->getTH2F()->Divide(hWireSTE2,hEffDenominator,1.,1.,"B");
608 
609  bool saveHistos = param.getParameter<bool>("saveHistos");
610  string outputFileName = param.getParameter<string>("outputFileName");
611  if(saveHistos){
612  dbe->save(outputFileName);
613  }
614 
615 }
616 
618 // Analysis //
620 void CSCOfflineMonitor::analyze(const Event & event, const EventSetup& eventSetup){
621 
624  event.getByLabel(stripDigiTag_,strips);
625  event.getByLabel(wireDigiTag_,wires);
626 
627  // Get the CSC Geometry :
628  ESHandle<CSCGeometry> cscGeom;
629  eventSetup.get<MuonGeometryRecord>().get(cscGeom);
630 
631  // Get the RecHits collection :
633  event.getByLabel(cscRecHitTag_,recHits);
634 
635  // get CSC segment collection
637  event.getByLabel(cscSegTag_, cscSegments);
638 
639 
640  doOccupancies(strips,wires,recHits,cscSegments);
641  doStripDigis(strips);
642  doWireDigis(wires);
643  doRecHits(recHits,strips,cscGeom);
644  doSegments(cscSegments,cscGeom);
645  doResolution(cscSegments,cscGeom);
646  doPedestalNoise(strips);
647  doEfficiencies(wires,strips, recHits, cscSegments,cscGeom);
648 
649 }
650 
651 // ==============================================
652 //
653 // look at Occupancies
654 //
655 // ==============================================
656 
659 
660  bool wireo[2][4][4][36];
661  bool stripo[2][4][4][36];
662  bool rechito[2][4][4][36];
663  bool segmento[2][4][4][36];
664 
665  bool hasWires = false;
666  bool hasStrips = false;
667  bool hasRecHits = false;
668  bool hasSegments = false;
669 
670  for (int e = 0; e < 2; e++){
671  for (int s = 0; s < 4; s++){
672  for (int r = 0; r < 4; r++){
673  for (int c = 0; c < 36; c++){
674  wireo[e][s][r][c] = false;
675  stripo[e][s][r][c] = false;
676  rechito[e][s][r][c] = false;
677  segmento[e][s][r][c] = false;
678  }
679  }
680  }
681  }
682 
683  //wires
684  for (CSCWireDigiCollection::DigiRangeIterator wi=wires->begin(); wi!=wires->end(); wi++) {
685  CSCDetId id = (CSCDetId)(*wi).first;
686  int kEndcap = id.endcap();
687  int kRing = id.ring();
688  int kStation = id.station();
689  int kChamber = id.chamber();
690  std::vector<CSCWireDigi>::const_iterator wireIt = (*wi).second.first;
691  std::vector<CSCWireDigi>::const_iterator lastWire = (*wi).second.second;
692  for( ; wireIt != lastWire; ++wireIt){
693  if (!wireo[kEndcap-1][kStation-1][kRing-1][kChamber-1]){
694  wireo[kEndcap-1][kStation-1][kRing-1][kChamber-1] = true;
695  hOWires->Fill(kChamber,typeIndex(id,2));
696  hOWireSerial->Fill(chamberSerial(id));
697  hasWires = true;
698  }
699  }
700  }
701 
702  //strips
703  for (CSCStripDigiCollection::DigiRangeIterator si=strips->begin(); si!=strips->end(); si++) {
704  CSCDetId id = (CSCDetId)(*si).first;
705  int kEndcap = id.endcap();
706  int kRing = id.ring();
707  int kStation = id.station();
708  int kChamber = id.chamber();
709  std::vector<CSCStripDigi>::const_iterator stripIt = (*si).second.first;
710  std::vector<CSCStripDigi>::const_iterator lastStrip = (*si).second.second;
711  for( ; stripIt != lastStrip; ++stripIt) {
712  std::vector<int> myADCVals = stripIt->getADCCounts();
713  bool thisStripFired = false;
714  float thisPedestal = 0.5*(float)(myADCVals[0]+myADCVals[1]);
715  float threshold = 13.3 ;
716  float diff = 0.;
717  for (unsigned int iCount = 0; iCount < myADCVals.size(); iCount++) {
718  diff = (float)myADCVals[iCount]-thisPedestal;
719  if (diff > threshold) { thisStripFired = true; }
720  }
721  if (thisStripFired) {
722  if (!stripo[kEndcap-1][kStation-1][kRing-1][kChamber-1]){
723  stripo[kEndcap-1][kStation-1][kRing-1][kChamber-1] = true;
724  hOStrips->Fill(kChamber,typeIndex(id,2));
725  hOStripSerial->Fill(chamberSerial(id));
726  hasStrips = true;
727  }
728  }
729  }
730  }
731 
732  //rechits
734  for (recIt = recHits->begin(); recIt != recHits->end(); recIt++) {
735  CSCDetId idrec = (CSCDetId)(*recIt).cscDetId();
736  int kEndcap = idrec.endcap();
737  int kRing = idrec.ring();
738  int kStation = idrec.station();
739  int kChamber = idrec.chamber();
740  if (!rechito[kEndcap-1][kStation-1][kRing-1][kChamber-1]){
741  rechito[kEndcap-1][kStation-1][kRing-1][kChamber-1] = true;
742  hORecHitsSerial->Fill(chamberSerial(idrec));
743  hORecHits->Fill(kChamber,typeIndex(idrec,2));
744  hasRecHits = true;
745  }
746  }
747 
748  //segments
749  for(CSCSegmentCollection::const_iterator segIt=cscSegments->begin(); segIt != cscSegments->end(); segIt++) {
750  CSCDetId id = (CSCDetId)(*segIt).cscDetId();
751  int kEndcap = id.endcap();
752  int kRing = id.ring();
753  int kStation = id.station();
754  int kChamber = id.chamber();
755  if (!segmento[kEndcap-1][kStation-1][kRing-1][kChamber-1]){
756  segmento[kEndcap-1][kStation-1][kRing-1][kChamber-1] = true;
757  hOSegmentsSerial->Fill(chamberSerial(id));
758  hOSegments->Fill(kChamber,typeIndex(id,2));
759  hasSegments = true;
760  }
761  }
762 
763  //Overall CSC Occupancy
764  hCSCOccupancy->Fill(1);
765  if (hasWires) hCSCOccupancy->Fill(3);
766  if (hasStrips) hCSCOccupancy->Fill(5);
767  if (hasWires && hasStrips) hCSCOccupancy->Fill(7);
768  if (hasRecHits) hCSCOccupancy->Fill(9);
769  if (hasSegments) hCSCOccupancy->Fill(11);
770 
771 
772 }
773 
774 
775 // ==============================================
776 //
777 // look at WIRE DIGIs
778 //
779 // ==============================================
780 
782 
783  int nWireGroupsTotal = 0;
784  for (CSCWireDigiCollection::DigiRangeIterator dWDiter=wires->begin(); dWDiter!=wires->end(); dWDiter++) {
785  CSCDetId id = (CSCDetId)(*dWDiter).first;
786  std::vector<CSCWireDigi>::const_iterator wireIter = (*dWDiter).second.first;
787  std::vector<CSCWireDigi>::const_iterator lWire = (*dWDiter).second.second;
788  for( ; wireIter != lWire; ++wireIter) {
789  int myWire = wireIter->getWireGroup();
790  int myTBin = wireIter->getTimeBin();
791  nWireGroupsTotal++;
792  hWireTBin[typeIndex(id)-1]->Fill(myTBin);
793  hWireNumber[typeIndex(id)-1]->Fill(myWire);
794  }
795  } // end wire loop
796 
797  // this way you can zero suppress but still store info on # events with no digis
798  if (nWireGroupsTotal == 0) nWireGroupsTotal = -1;
799  hWirenGroupsTotal->Fill(nWireGroupsTotal);
800 
801 }
802 
803 
804 // ==============================================
805 //
806 // look at STRIP DIGIs
807 //
808 // ==============================================
809 
811 
812  int nStripsFired = 0;
813  for (CSCStripDigiCollection::DigiRangeIterator dSDiter=strips->begin(); dSDiter!=strips->end(); dSDiter++) {
814  CSCDetId id = (CSCDetId)(*dSDiter).first;
815  std::vector<CSCStripDigi>::const_iterator stripIter = (*dSDiter).second.first;
816  std::vector<CSCStripDigi>::const_iterator lStrip = (*dSDiter).second.second;
817  for( ; stripIter != lStrip; ++stripIter) {
818  int myStrip = stripIter->getStrip();
819  std::vector<int> myADCVals = stripIter->getADCCounts();
820  bool thisStripFired = false;
821  float thisPedestal = 0.5*(float)(myADCVals[0]+myADCVals[1]);
822  float threshold = 13.3 ;
823  float diff = 0.;
824  for (unsigned int iCount = 0; iCount < myADCVals.size(); iCount++) {
825  diff = (float)myADCVals[iCount]-thisPedestal;
826  if (diff > threshold) { thisStripFired = true; }
827  }
828  if (thisStripFired) {
829  nStripsFired++;
830  hStripNumber[typeIndex(id)-1]->Fill(myStrip);
831  }
832  }
833  } // end strip loop
834 
835  // this way you can zero suppress but still store info on # events with no digis
836  if (nStripsFired == 0) nStripsFired = -1;
837  hStripNFired->Fill(nStripsFired);
838  // fill n per event
839 
840 }
841 
842 
843 //=======================================================
844 //
845 // Look at the Pedestal Noise Distributions
846 //
847 //=======================================================
848 
850 
851  for (CSCStripDigiCollection::DigiRangeIterator dPNiter=strips->begin(); dPNiter!=strips->end(); dPNiter++) {
852  CSCDetId id = (CSCDetId)(*dPNiter).first;
853  int kStation = id.station();
854  int kRing = id.ring();
855  std::vector<CSCStripDigi>::const_iterator pedIt = (*dPNiter).second.first;
856  std::vector<CSCStripDigi>::const_iterator lStrip = (*dPNiter).second.second;
857  for( ; pedIt != lStrip; ++pedIt) {
858  int myStrip = pedIt->getStrip();
859  std::vector<int> myADCVals = pedIt->getADCCounts();
860  float TotalADC = getSignal(*strips, id, myStrip);
861  bool thisStripFired = false;
862  float thisPedestal = 0.5*(float)(myADCVals[0]+myADCVals[1]);
863  float thisSignal = (1./6)*(myADCVals[2]+myADCVals[3]+myADCVals[4]+myADCVals[5]+myADCVals[6]+myADCVals[7]);
864  float threshold = 13.3;
865  if(kStation == 1 && kRing == 4)
866  {
867  kRing = 1;
868  if(myStrip <= 16) myStrip += 64; // no trapping for any bizarreness
869  }
870  if (TotalADC > threshold) { thisStripFired = true;}
871  if (!thisStripFired){
872  float ADC = thisSignal - thisPedestal;
873  hStripPed[typeIndex(id)-1]->Fill(ADC);
874  }
875  }
876  }
877 
878 }
879 
880 
881 // ==============================================
882 //
883 // look at RECHITs
884 //
885 // ==============================================
886 
890 
891  // Get the RecHits collection :
892  int nRecHits = recHits->size();
893 
894  // ---------------------
895  // Loop over rechits
896  // ---------------------
897  // Build iterator for rechits and loop :
899  for (dRHIter = recHits->begin(); dRHIter != recHits->end(); dRHIter++) {
900 
901  // Find chamber with rechits in CSC
902  CSCDetId idrec = (CSCDetId)(*dRHIter).cscDetId();
903 
904  // Store rechit as a Local Point:
905  LocalPoint rhitlocal = (*dRHIter).localPosition();
906  //float xreco = rhitlocal.x();
907  //float yreco = rhitlocal.y();
908 
909  // Get the reconstucted strip position and error
910  float stpos = (*dRHIter).positionWithinStrip();
911  float sterr = (*dRHIter).errorWithinStrip();
912 
913  // Find the charge associated with this hit
914  CSCRecHit2D::ADCContainer adcs = (*dRHIter).adcs();
915  int adcsize = adcs.size();
916  float rHSumQ = 0;
917  float sumsides = 0;
918  for (int i = 0; i < adcsize; i++){
919  if (i != 3 && i != 7 && i != 11){
920  rHSumQ = rHSumQ + adcs[i];
921  }
922  if (adcsize == 12 && (i < 3 || i > 7) && i < 12){
923  sumsides = sumsides + adcs[i];
924  }
925  }
926  float rHratioQ = sumsides/rHSumQ;
927  if (adcsize != 12) rHratioQ = -99;
928 
929  // Get the signal timing of this hit
930  float rHtime = (*dRHIter).tpeak();
931 
932  // Get pointer to the layer:
933  const CSCLayer* csclayer = cscGeom->layer( idrec );
934 
935  // Transform hit position from local chamber geometry to global CMS geom
936  GlobalPoint rhitglobal= csclayer->toGlobal(rhitlocal);
937  float grecx = rhitglobal.x();
938  float grecy = rhitglobal.y();
939 
940  // Fill some histograms
941  int sIndex = idrec.station() + ((idrec.endcap()-1) * 4);
942  int tIndex = typeIndex(idrec);
943  hRHSumQ[tIndex-1]->Fill(rHSumQ);
944  hRHRatioQ[tIndex-1]->Fill(rHratioQ);
945  hRHstpos[tIndex-1]->Fill(stpos);
946  hRHsterr[tIndex-1]->Fill(sterr);
947  hRHTiming[tIndex-1]->Fill(rHtime);
948  hRHGlobal[sIndex-1]->Fill(grecx,grecy);
949 
950  } //end rechit loop
951 
952  if (nRecHits == 0) nRecHits = -1;
953  hRHnrechits->Fill(nRecHits);
954 
955 }
956 
957 
958 // ==============================================
959 //
960 // look at SEGMENTs
961 //
962 // ===============================================
963 
966 
967  // get CSC segment collection
968  int nSegments = cscSegments->size();
969 
970  for(CSCSegmentCollection::const_iterator dSiter=cscSegments->begin(); dSiter != cscSegments->end(); dSiter++) {
971  CSCDetId id = (CSCDetId)(*dSiter).cscDetId();
972  float chisq = (*dSiter).chi2();
973  int nhits = (*dSiter).nRecHits();
974  int nDOF = 2*nhits-4;
975  float nChi2 = chisq/nDOF;
976  double chisqProb = ChiSquaredProbability( (double)chisq, nDOF );
977  //LocalPoint localPos = (*dSiter).localPosition();
978  LocalVector segDir = (*dSiter).localDirection();
979 
980  // global transformation
981  //float globX = 0.;
982  //float globY = 0.;
983  float globTheta = 0.;
984  float globPhi = 0.;
985  const CSCChamber* cscchamber = cscGeom->chamber(id);
986  if (cscchamber) {
987  //GlobalPoint globalPosition = cscchamber->toGlobal(localPos);
988  //globX = globalPosition.x();
989  //globY = globalPosition.y();
990  GlobalVector globalDirection = cscchamber->toGlobal(segDir);
991  globTheta = globalDirection.theta();
992  globPhi = globalDirection.phi();
993  }
994 
995  // Fill histos
996  int tIndex = typeIndex(id);
997  hSnhitsAll->Fill(nhits);
998  hSnhits[tIndex-1]->Fill(nhits);
999  hSChiSqAll->Fill(nChi2);
1000  hSChiSq[tIndex-1]->Fill(nChi2);
1001  hSChiSqProbAll->Fill(chisqProb);
1002  hSChiSqProb[tIndex-1]->Fill(chisqProb);
1003  hSGlobalTheta->Fill(globTheta);
1004  hSGlobalPhi->Fill(globPhi);
1005 
1006 
1007  } // end segment loop
1008 
1009  if (nSegments == 0) nSegments = -1;
1010  hSnSegments->Fill(nSegments);
1011 
1012 }
1013 
1014 // ==============================================
1015 //
1016 // look at hit Resolution
1017 //
1018 // ==============================================
1020  edm::ESHandle<CSCGeometry> cscGeom){
1021 
1022  for(CSCSegmentCollection::const_iterator dSiter=cscSegments->begin(); dSiter != cscSegments->end(); dSiter++) {
1023  CSCDetId id = (CSCDetId)(*dSiter).cscDetId();
1024  //
1025  // try to get the CSC recHits that contribute to this segment.
1026  std::vector<CSCRecHit2D> theseRecHits = (*dSiter).specificRecHits();
1027  int nRH = (*dSiter).nRecHits();
1028  int jRH = 0;
1029  CLHEP::HepMatrix sp(6,1);
1030  CLHEP::HepMatrix se(6,1);
1031  for ( vector<CSCRecHit2D>::const_iterator iRH = theseRecHits.begin(); iRH != theseRecHits.end(); iRH++) {
1032  jRH++;
1033  CSCDetId idRH = (CSCDetId)(*iRH).cscDetId();
1034  //int kEndcap = idRH.endcap();
1035  int kRing = idRH.ring();
1036  int kStation = idRH.station();
1037  //int kChamber = idRH.chamber();
1038  int kLayer = idRH.layer();
1039 
1040  // Find the strip containing this hit
1041  CSCRecHit2D::ChannelContainer hitstrips = (*iRH).channels();
1042  int nStrips = hitstrips.size();
1043  int centerid = nStrips/2 + 1;
1044  int centerStrip = hitstrips[centerid - 1];
1045 
1046  // If this segment has 6 hits, find the position of each hit on the strip in units of stripwidth and store values
1047  if (nRH == 6){
1048  float stpos = (*iRH).positionWithinStrip();
1049  se(kLayer,1) = (*iRH).errorWithinStrip();
1050  // Take into account half-strip staggering of layers (ME1/1 has no staggering)
1051  if (kStation == 1 && (kRing == 1 || kRing == 4)) sp(kLayer,1) = stpos + centerStrip;
1052  else{
1053  if (kLayer == 1 || kLayer == 3 || kLayer == 5) sp(kLayer,1) = stpos + centerStrip;
1054  if (kLayer == 2 || kLayer == 4 || kLayer == 6) sp(kLayer,1) = stpos - 0.5 + centerStrip;
1055  }
1056  }
1057 
1058  }
1059 
1060  float residual = -99;
1061  // Fit all points except layer 3, then compare expected value for layer 3 to reconstructed value
1062  if (nRH == 6){
1063  float expected = fitX(sp,se);
1064  residual = expected - sp(3,1);
1065  }
1066 
1067  hSResid[typeIndex(id)-1]->Fill(residual);
1068 
1069  } // end segment loop
1070 
1071 
1072 
1073 }
1074 
1075 
1076 //-------------------------------------------------------------------------------------
1077 // Fits a straight line to a set of 5 points with errors. Functions assumes 6 points
1078 // and removes hit in layer 3. It then returns the expected position value in layer 3
1079 // based on the fit.
1080 //-------------------------------------------------------------------------------------
1081 float CSCOfflineMonitor::fitX(CLHEP::HepMatrix points, CLHEP::HepMatrix errors){
1082 
1083  float S = 0;
1084  float Sx = 0;
1085  float Sy = 0;
1086  float Sxx = 0;
1087  float Sxy = 0;
1088  float sigma2 = 0;
1089 
1090  for (int i=1;i<7;i++){
1091  if (i != 3){
1092  sigma2 = errors(i,1)*errors(i,1);
1093  S = S + (1/sigma2);
1094  Sy = Sy + (points(i,1)/sigma2);
1095  Sx = Sx + ((i)/sigma2);
1096  Sxx = Sxx + (i*i)/sigma2;
1097  Sxy = Sxy + (((i)*points(i,1))/sigma2);
1098  }
1099  }
1100 
1101  float delta = S*Sxx - Sx*Sx;
1102  float intercept = (Sxx*Sy - Sx*Sxy)/delta;
1103  float slope = (S*Sxy - Sx*Sy)/delta;
1104 
1105  return (intercept + slope*3);
1106 
1107 }
1108 
1109 //---------------------------------------------------------------------------------------
1110 // Given a set of digis, the CSCDetId, and the central strip of your choosing, returns
1111 // the avg. Signal-Pedestal for 6 time bin x 5 strip .
1112 //
1113 // Author: P. Jindal
1114 //---------------------------------------------------------------------------------------
1115 
1117  CSCDetId idCS, int centerStrip){
1118 
1119  float SigADC[5];
1120  float TotalADC = 0;
1121  SigADC[0] = 0;
1122  SigADC[1] = 0;
1123  SigADC[2] = 0;
1124  SigADC[3] = 0;
1125  SigADC[4] = 0;
1126 
1127 
1128  // Loop over strip digis
1130 
1131  for (sIt = stripdigis.begin(); sIt != stripdigis.end(); sIt++){
1132  CSCDetId id = (CSCDetId)(*sIt).first;
1133  if (id == idCS){
1134 
1135  // First, find the Signal-Pedestal for center strip
1136  vector<CSCStripDigi>::const_iterator digiItr = (*sIt).second.first;
1137  vector<CSCStripDigi>::const_iterator last = (*sIt).second.second;
1138  for ( ; digiItr != last; ++digiItr ) {
1139  int thisStrip = digiItr->getStrip();
1140  if (thisStrip == (centerStrip)){
1141  std::vector<int> myADCVals = digiItr->getADCCounts();
1142  float thisPedestal = 0.5*(float)(myADCVals[0]+myADCVals[1]);
1143  float thisSignal = (myADCVals[2]+myADCVals[3]+myADCVals[4]+myADCVals[5]+myADCVals[6]+myADCVals[7]);
1144  SigADC[0] = thisSignal - 6*thisPedestal;
1145  }
1146  // Now,find the Signal-Pedestal for neighbouring 4 strips
1147  if (thisStrip == (centerStrip+1)){
1148  std::vector<int> myADCVals = digiItr->getADCCounts();
1149  float thisPedestal = 0.5*(float)(myADCVals[0]+myADCVals[1]);
1150  float thisSignal = (myADCVals[2]+myADCVals[3]+myADCVals[4]+myADCVals[5]+myADCVals[6]+myADCVals[7]);
1151  SigADC[1] = thisSignal - 6*thisPedestal;
1152  }
1153  if (thisStrip == (centerStrip+2)){
1154  std::vector<int> myADCVals = digiItr->getADCCounts();
1155  float thisPedestal = 0.5*(float)(myADCVals[0]+myADCVals[1]);
1156  float thisSignal = (myADCVals[2]+myADCVals[3]+myADCVals[4]+myADCVals[5]+myADCVals[6]+myADCVals[7]);
1157  SigADC[2] = thisSignal - 6*thisPedestal;
1158  }
1159  if (thisStrip == (centerStrip-1)){
1160  std::vector<int> myADCVals = digiItr->getADCCounts();
1161  float thisPedestal = 0.5*(float)(myADCVals[0]+myADCVals[1]);
1162  float thisSignal = (myADCVals[2]+myADCVals[3]+myADCVals[4]+myADCVals[5]+myADCVals[6]+myADCVals[7]);
1163  SigADC[3] = thisSignal - 6*thisPedestal;
1164  }
1165  if (thisStrip == (centerStrip-2)){
1166  std::vector<int> myADCVals = digiItr->getADCCounts();
1167  float thisPedestal = 0.5*(float)(myADCVals[0]+myADCVals[1]);
1168  float thisSignal = (myADCVals[2]+myADCVals[3]+myADCVals[4]+myADCVals[5]+myADCVals[6]+myADCVals[7]);
1169  SigADC[4] = thisSignal - 6*thisPedestal;
1170  }
1171  }
1172  TotalADC = 0.2*(SigADC[0]+SigADC[1]+SigADC[2]+SigADC[3]+SigADC[4]);
1173  }
1174  }
1175  return TotalADC;
1176 }
1177 
1178 
1179 
1180 //----------------------------------------------------------------------------
1181 // Calculate basic efficiencies for recHits and Segments
1182 // Author: S. Stoynev
1183 //----------------------------------------------------------------------------
1184 
1187  edm::ESHandle<CSCGeometry> cscGeom){
1188 
1189  bool allWires[2][4][4][36][6];
1190  bool allStrips[2][4][4][36][6];
1191  bool AllRecHits[2][4][4][36][6];
1192  bool AllSegments[2][4][4][36];
1193 
1194  //bool MultiSegments[2][4][4][36];
1195  for(int iE = 0;iE<2;iE++){
1196  for(int iS = 0;iS<4;iS++){
1197  for(int iR = 0; iR<4;iR++){
1198  for(int iC =0;iC<36;iC++){
1199  AllSegments[iE][iS][iR][iC] = false;
1200  //MultiSegments[iE][iS][iR][iC] = false;
1201  for(int iL=0;iL<6;iL++){
1202  allWires[iE][iS][iR][iC][iL] = false;
1203  allStrips[iE][iS][iR][iC][iL] = false;
1204  AllRecHits[iE][iS][iR][iC][iL] = false;
1205  }
1206  }
1207  }
1208  }
1209  }
1210 
1211 
1212  // Wires
1213  for (CSCWireDigiCollection::DigiRangeIterator dWDiter=wires->begin(); dWDiter!=wires->end(); dWDiter++) {
1214  CSCDetId idrec = (CSCDetId)(*dWDiter).first;
1215  std::vector<CSCWireDigi>::const_iterator wireIter = (*dWDiter).second.first;
1216  std::vector<CSCWireDigi>::const_iterator lWire = (*dWDiter).second.second;
1217  for( ; wireIter != lWire; ++wireIter) {
1218  allWires[idrec.endcap() -1][idrec.station() -1][idrec.ring() -1][idrec.chamber() -1][idrec.layer() -1] = true;
1219  break;
1220  }
1221  }
1222 
1223  //---- STRIPS
1224  for (CSCStripDigiCollection::DigiRangeIterator dSDiter=strips->begin(); dSDiter!=strips->end(); dSDiter++) {
1225  CSCDetId idrec = (CSCDetId)(*dSDiter).first;
1226  std::vector<CSCStripDigi>::const_iterator stripIter = (*dSDiter).second.first;
1227  std::vector<CSCStripDigi>::const_iterator lStrip = (*dSDiter).second.second;
1228  for( ; stripIter != lStrip; ++stripIter) {
1229  std::vector<int> myADCVals = stripIter->getADCCounts();
1230  bool thisStripFired = false;
1231  float thisPedestal = 0.5*(float)(myADCVals[0]+myADCVals[1]);
1232  float threshold = 13.3 ;
1233  float diff = 0.;
1234  for (unsigned int iCount = 0; iCount < myADCVals.size(); iCount++) {
1235  diff = (float)myADCVals[iCount]-thisPedestal;
1236  if (diff > threshold) {
1237  thisStripFired = true;
1238  break;
1239  }
1240  }
1241  if(thisStripFired){
1242  allStrips[idrec.endcap() -1][idrec.station() -1][idrec.ring() -1][idrec.chamber() -1][idrec.layer() -1] = true;
1243  break;
1244  }
1245  }
1246  }
1247 
1248  // Rechits
1249  for (CSCRecHit2DCollection::const_iterator recEffIt = recHits->begin(); recEffIt != recHits->end(); recEffIt++) {
1250  //CSCDetId idrec = (CSCDetId)(*recIt).cscDetId();
1251  CSCDetId idrec = (CSCDetId)(*recEffIt).cscDetId();
1252  AllRecHits[idrec.endcap() -1][idrec.station() -1][idrec.ring() -1][idrec.chamber() -1][idrec.layer() -1] = true;
1253 
1254  }
1255 
1256  std::vector <uint> seg_ME2(2,0) ;
1257  std::vector <uint> seg_ME3(2,0) ;
1258  std::vector < pair <CSCDetId, CSCSegment> > theSegments(4);
1259  // Segments
1260  for(CSCSegmentCollection::const_iterator segEffIt=cscSegments->begin(); segEffIt != cscSegments->end(); segEffIt++) {
1261  CSCDetId idseg = (CSCDetId)(*segEffIt).cscDetId();
1262  //if(AllSegments[idrec.endcap() -1][idrec.station() -1][idrec.ring() -1][idrec.chamber()]){
1263  //MultiSegments[idrec.endcap() -1][idrec.station() -1][idrec.ring() -1][idrec.chamber()] = true;
1264  //}
1265  AllSegments[idseg.endcap() -1][idseg.station() -1][idseg.ring() -1][idseg.chamber() -1] = true;
1266  // "Intrinsic" efficiency measurement relies on "good" segment extrapolation - we need the pre-selection below
1267  // station 2 "good" segment will be used for testing efficiencies in ME1 and ME3
1268  // station 3 "good" segment will be used for testing efficiencies in ME2 and ME4
1269  if(2==idseg.station() || 3==idseg.station()){
1270  uint seg_tmp ;
1271  if(2==idseg.station()){
1272  ++seg_ME2[idseg.endcap() -1];
1273  seg_tmp = seg_ME2[idseg.endcap() -1];
1274  }
1275  else{
1276  ++seg_ME3[idseg.endcap() -1];
1277  seg_tmp = seg_ME3[idseg.endcap() -1];
1278  }
1279  // is the segment good
1280  if(1== seg_tmp&& 6==(*segEffIt).nRecHits() && (*segEffIt).chi2()/(*segEffIt).degreesOfFreedom()<3.){
1281  pair <CSCDetId, CSCSegment> specSeg = make_pair( (CSCDetId)(*segEffIt).cscDetId(),*segEffIt);
1282  theSegments[2*(idseg.endcap()-1)+(idseg.station() -2)] = specSeg;
1283  }
1284  }
1285  /*
1286  if(2==idseg.station()){
1287  ++seg_ME2[idseg.endcap() -1];
1288  if(1==seg_ME2[idseg.endcap() -1] && 6==(*segEffIt).nRecHits() && (*segEffIt).chi2()/(*segEffIt).degreesOfFreedom()<3.){
1289  pair <CSCDetId, CSCSegment> specSeg = make_pair( (CSCDetId)(*segEffIt).cscDetId(),*segEffIt);
1290  theSegments[2*(idseg.endcap()-1)+(idseg.station() -2)] = specSeg;
1291  }
1292  }
1293  else if(3==idseg.station()){
1294  ++seg_ME3[idseg.endcap() -1];
1295  if(1==seg_ME3[idseg.endcap() -1] && 6==(*segEffIt).nRecHits() && (*segEffIt).chi2()/(*segEffIt).degreesOfFreedom()<3.){
1296  pair <CSCDetId, CSCSegment> specSeg = make_pair( (CSCDetId)(*segEffIt).cscDetId(),*segEffIt);
1297  theSegments[2*(idseg.endcap()-1)+(idseg.station() -2)] = specSeg;
1298  }
1299  }
1300  */
1301 
1302  }
1303  // Simple efficiency calculations
1304  for(int iE = 0;iE<2;iE++){
1305  for(int iS = 0;iS<4;iS++){
1306  for(int iR = 0; iR<4;iR++){
1307  for(int iC =0;iC<36;iC++){
1308  int NumberOfLayers = 0;
1309  for(int iL=0;iL<6;iL++){
1310  if(AllRecHits[iE][iS][iR][iC][iL]){
1311  NumberOfLayers++;
1312  }
1313  }
1314  int bin = 0;
1315  if (iS==0) bin = iR+1+(iE*10);
1316  else bin = (iS+1)*2 + (iR+1) + (iE*10);
1317  if(NumberOfLayers>1){
1318  //if(!(MultiSegments[iE][iS][iR][iC])){
1319  if(AllSegments[iE][iS][iR][iC]){
1320  //---- Efficient segment evenents
1321  hSSTE->Fill(bin);
1322  }
1323  //---- All segment events (normalization)
1324  hSSTE->Fill(20+bin);
1325  //}
1326  }
1327  if(AllSegments[iE][iS][iR][iC]){
1328  if(NumberOfLayers==6){
1329  //---- Efficient rechit events
1330  hRHSTE->Fill(bin);;
1331  }
1332  //---- All rechit events (normalization)
1333  hRHSTE->Fill(20+bin);;
1334  }
1335  }
1336  }
1337  }
1338  }
1339 
1340  // pick a segment only if there are no others in the station
1341  std::vector < pair <CSCDetId, CSCSegment> * > theSeg;
1342  if(1==seg_ME2[0]) theSeg.push_back(&theSegments[0]);
1343  if(1==seg_ME3[0]) theSeg.push_back(&theSegments[1]);
1344  if(1==seg_ME2[1]) theSeg.push_back(&theSegments[2]);
1345  if(1==seg_ME3[1]) theSeg.push_back(&theSegments[3]);
1346 
1347  // Needed for plots
1348  // at the end the chamber types will be numbered as 1 to 18
1349  // (ME-4/1, -ME3/2, -ME3/1, ..., +ME3/1, +ME3/2, ME+4/1 )
1350  std::map <std::string, float> chamberTypes;
1351  chamberTypes["ME1/a"] = 0.5;
1352  chamberTypes["ME1/b"] = 1.5;
1353  chamberTypes["ME1/2"] = 2.5;
1354  chamberTypes["ME1/3"] = 3.5;
1355  chamberTypes["ME2/1"] = 4.5;
1356  chamberTypes["ME2/2"] = 5.5;
1357  chamberTypes["ME3/1"] = 6.5;
1358  chamberTypes["ME3/2"] = 7.5;
1359  chamberTypes["ME4/1"] = 8.5;
1360 
1361  if(theSeg.size()){
1362  std::map <int , GlobalPoint> extrapolatedPoint;
1363  std::map <int , GlobalPoint>::iterator it;
1364  const std::vector<CSCChamber*> ChamberContainer = cscGeom->chambers();
1365  // Pick which chamber with which segment to test
1366  for(unsigned int nCh=0;nCh<ChamberContainer.size();nCh++){
1367  const CSCChamber *cscchamber = ChamberContainer[nCh];
1368  pair <CSCDetId, CSCSegment> * thisSegment = 0;
1369  for(uint iSeg =0;iSeg<theSeg.size();++iSeg ){
1370  if(cscchamber->id().endcap() == theSeg[iSeg]->first.endcap()){
1371  if(1==cscchamber->id().station() || 3==cscchamber->id().station() ){
1372  if(2==theSeg[iSeg]->first.station()){
1373  thisSegment = theSeg[iSeg];
1374  }
1375  }
1376  else if (2==cscchamber->id().station() || 4==cscchamber->id().station()){
1377  if(3==theSeg[iSeg]->first.station()){
1378  thisSegment = theSeg[iSeg];
1379  }
1380  }
1381  }
1382  }
1383  // this chamber is to be tested with thisSegment
1384  if(thisSegment){
1385  CSCSegment * seg = &(thisSegment->second);
1386  const CSCChamber *segChamber = cscGeom->chamber(thisSegment->first);
1387  LocalPoint localCenter(0.,0.,0);
1388  GlobalPoint cscchamberCenter = cscchamber->toGlobal(localCenter);
1389  // try to save some time (extrapolate a segment to a certain position only once)
1390  it = extrapolatedPoint.find(int(cscchamberCenter.z()));
1391  if(it==extrapolatedPoint.end()){
1392  GlobalPoint segPos = segChamber->toGlobal(seg->localPosition());
1393  GlobalVector segDir = segChamber->toGlobal(seg->localDirection());
1394  double paramaterLine = lineParametrization(segPos.z(),cscchamberCenter.z() , segDir.z());
1395  double xExtrapolated = extrapolate1D(segPos.x(),segDir.x(), paramaterLine);
1396  double yExtrapolated = extrapolate1D(segPos.y(),segDir.y(), paramaterLine);
1397  GlobalPoint globP (xExtrapolated, yExtrapolated, cscchamberCenter.z());
1398  extrapolatedPoint[int(cscchamberCenter.z())] = globP;
1399  }
1400  // Where does the extrapolated point lie in the (tested) chamber local frame? Here:
1401  LocalPoint extrapolatedPointLocal = cscchamber->toLocal(extrapolatedPoint[int(cscchamberCenter.z())]);
1402  const CSCLayer *layer_p = cscchamber->layer(1);//layer 1
1403  const CSCLayerGeometry *layerGeom = layer_p->geometry ();
1404  const std::vector<float> layerBounds = layerGeom->parameters ();
1405  float shiftFromEdge = 15.;//cm
1406  float shiftFromDeadZone = 10.;
1407  // is the extrapolated point within a sensitive region
1408  bool pass = withinSensitiveRegion(extrapolatedPointLocal, layerBounds,
1409  cscchamber->id().station(), cscchamber->id().ring(),
1410  shiftFromEdge, shiftFromDeadZone);
1411  if(pass){// the extrapolation point of the segment lies within sensitive region of that chamber
1412  // how many rechit layers are there in the chamber?
1413  // 0 - maybe the muon died or is deflected at large angle? do not use that case
1414  // 1 - could be noise...
1415  // 2 or more - this is promissing; this is our definition of a reliable signal; use it below
1416  // is other definition better?
1417  int nRHLayers = 0;
1418  for(int iL =0;iL<6;++iL){
1419  if(AllRecHits[cscchamber->id().endcap()-1]
1420  [cscchamber->id().station()-1]
1421  [cscchamber->id().ring()-1][cscchamber->id().chamber()-1][iL]){
1422  ++nRHLayers;
1423  }
1424  }
1425  //std::cout<<" nRHLayers = "<<nRHLayers<<std::endl;
1426  float verticalScale = chamberTypes[cscchamber->specs()->chamberTypeName()];
1427  if(cscchamberCenter.z()<0){
1428  verticalScale = - verticalScale;
1429  }
1430  verticalScale +=9.5;
1431  hSensitiveAreaEvt->Fill(float(cscchamber->id().chamber()),verticalScale);
1432  if(nRHLayers>1){// this chamber contains a reliable signal
1433  //chamberTypes[cscchamber->specs()->chamberTypeName()];
1434  // "intrinsic" efficiencies
1435  //std::cout<<" verticalScale = "<<verticalScale<<" chType = "<<cscchamber->specs()->chamberTypeName()<<std::endl;
1436  // this is the denominator forr all efficiencies
1437  hEffDenominator->Fill(float(cscchamber->id().chamber()),verticalScale);
1438  // Segment efficiency
1439  if(AllSegments[cscchamber->id().endcap()-1]
1440  [cscchamber->id().station()-1]
1441  [cscchamber->id().ring()-1][cscchamber->id().chamber()-1]){
1442  hSSTE2->Fill(float(cscchamber->id().chamber()),float(verticalScale));
1443  }
1444 
1445  for(int iL =0;iL<6;++iL){
1446  float weight = 1./6.;
1447  // one shold account for the weight in the efficiency...
1448  // Rechit efficiency
1449  if(AllRecHits[cscchamber->id().endcap()-1]
1450  [cscchamber->id().station()-1]
1451  [cscchamber->id().ring()-1][cscchamber->id().chamber()-1][iL]){
1452  hRHSTE2->Fill(float(cscchamber->id().chamber()),float(verticalScale),weight);
1453  }
1454  // Wire efficiency
1455  if(allWires[cscchamber->id().endcap()-1]
1456  [cscchamber->id().station()-1]
1457  [cscchamber->id().ring()-1][cscchamber->id().chamber()-1][iL]){
1458  // one shold account for the weight in the efficiency...
1459  hWireSTE2->Fill(float(cscchamber->id().chamber()),float(verticalScale),weight);
1460  }
1461  // Strip efficiency
1462  if(allStrips[cscchamber->id().endcap()-1]
1463  [cscchamber->id().station()-1]
1464  [cscchamber->id().ring()-1][cscchamber->id().chamber()-1][iL]){
1465  // one shold account for the weight in the efficiency...
1466  hStripSTE2->Fill(float(cscchamber->id().chamber()),float(verticalScale),weight);
1467  }
1468  }
1469  }
1470  }
1471  }
1472  }
1473  }
1474  //
1475 
1476 
1477 }
1478 
1479 void CSCOfflineMonitor::getEfficiency(float bin, float Norm, std::vector<float> &eff){
1480  //---- Efficiency with binomial error
1481  float Efficiency = 0.;
1482  float EffError = 0.;
1483  if(fabs(Norm)>0.000000001){
1484  Efficiency = bin/Norm;
1485  if(bin<Norm){
1486  EffError = sqrt( (1.-Efficiency)*Efficiency/Norm );
1487  }
1488  }
1489  eff[0] = Efficiency;
1490  eff[1] = EffError;
1491 }
1492 
1493 void CSCOfflineMonitor::histoEfficiency(TH1F *readHisto, MonitorElement *writeHisto){
1494  std::vector<float> eff(2);
1495  int Nbins = readHisto->GetSize()-2;//without underflows and overflows
1496  std::vector<float> bins(Nbins);
1497  std::vector<float> Efficiency(Nbins);
1498  std::vector<float> EffError(Nbins);
1499  float Num = 1;
1500  float Den = 1;
1501  for (int i=0;i<20;i++){
1502  Num = readHisto->GetBinContent(i+1);
1503  Den = readHisto->GetBinContent(i+21);
1504  getEfficiency(Num, Den, eff);
1505  Efficiency[i] = eff[0];
1506  EffError[i] = eff[1];
1507  writeHisto->setBinContent(i+1, Efficiency[i]);
1508  writeHisto->setBinError(i+1, EffError[i]);
1509  }
1510 }
1511 
1512 bool CSCOfflineMonitor::withinSensitiveRegion(LocalPoint localPos, const std::vector<float> layerBounds,
1513  int station, int ring, float shiftFromEdge, float shiftFromDeadZone){
1514 //---- check if it is in a good local region (sensitive area - geometrical and HV boundaries excluded)
1515  bool pass = false;
1516 
1517  float y_center = 0.;
1518  double yUp = layerBounds[3] + y_center;
1519  double yDown = - layerBounds[3] + y_center;
1520  double xBound1Shifted = layerBounds[0] - shiftFromEdge;//
1521  double xBound2Shifted = layerBounds[1] - shiftFromEdge;//
1522  double lineSlope = (yUp - yDown)/(xBound2Shifted-xBound1Shifted);
1523  double lineConst = yUp - lineSlope*xBound2Shifted;
1524  double yBorder = lineSlope*abs(localPos.x()) + lineConst;
1525 
1526  //bool withinChamberOnly = false;// false = "good region"; true - boundaries only
1527  std::vector <float> deadZoneCenter(6);
1528  float cutZone = shiftFromDeadZone;//cm
1529  //---- hardcoded... not good
1530  if(station>1 && station<5){
1531  if(2==ring){
1532  deadZoneCenter[0]= -162.48 ;
1533  deadZoneCenter[1] = -81.8744;
1534  deadZoneCenter[2] = -21.18165;
1535  deadZoneCenter[3] = 39.51105;
1536  deadZoneCenter[4] = 100.2939;
1537  deadZoneCenter[5] = 160.58;
1538 
1539  if(localPos.y() >yBorder &&
1540  ((localPos.y()> deadZoneCenter[0] + cutZone && localPos.y()< deadZoneCenter[1] - cutZone) ||
1541  (localPos.y()> deadZoneCenter[1] + cutZone && localPos.y()< deadZoneCenter[2] - cutZone) ||
1542  (localPos.y()> deadZoneCenter[2] + cutZone && localPos.y()< deadZoneCenter[3] - cutZone) ||
1543  (localPos.y()> deadZoneCenter[3] + cutZone && localPos.y()< deadZoneCenter[4] - cutZone) ||
1544  (localPos.y()> deadZoneCenter[4] + cutZone && localPos.y()< deadZoneCenter[5] - cutZone))){
1545  pass = true;
1546  }
1547  }
1548  else if(1==ring){
1549  if(2==station){
1550  deadZoneCenter[0]= -95.80 ;
1551  deadZoneCenter[1] = -27.47;
1552  deadZoneCenter[2] = 33.67;
1553  deadZoneCenter[3] = 90.85;
1554  }
1555  else if(3==station){
1556  deadZoneCenter[0]= -89.305 ;
1557  deadZoneCenter[1] = -39.705;
1558  deadZoneCenter[2] = 20.195;
1559  deadZoneCenter[3] = 77.395;
1560  }
1561  else if(4==station){
1562  deadZoneCenter[0]= -75.645;
1563  deadZoneCenter[1] = -26.055;
1564  deadZoneCenter[2] = 23.855;
1565  deadZoneCenter[3] = 70.575;
1566  }
1567  if(localPos.y() >yBorder &&
1568  ((localPos.y()> deadZoneCenter[0] + cutZone && localPos.y()< deadZoneCenter[1] - cutZone) ||
1569  (localPos.y()> deadZoneCenter[1] + cutZone && localPos.y()< deadZoneCenter[2] - cutZone) ||
1570  (localPos.y()> deadZoneCenter[2] + cutZone && localPos.y()< deadZoneCenter[3] - cutZone))){
1571  pass = true;
1572  }
1573  }
1574  }
1575  else if(1==station){
1576  if(3==ring){
1577  deadZoneCenter[0]= -83.155 ;
1578  deadZoneCenter[1] = -22.7401;
1579  deadZoneCenter[2] = 27.86665;
1580  deadZoneCenter[3] = 81.005;
1581  if(localPos.y() > yBorder &&
1582  ((localPos.y()> deadZoneCenter[0] + cutZone && localPos.y()< deadZoneCenter[1] - cutZone) ||
1583  (localPos.y()> deadZoneCenter[1] + cutZone && localPos.y()< deadZoneCenter[2] - cutZone) ||
1584  (localPos.y()> deadZoneCenter[2] + cutZone && localPos.y()< deadZoneCenter[3] - cutZone))){
1585  pass = true;
1586  }
1587  }
1588  else if(2==ring){
1589  deadZoneCenter[0]= -86.285 ;
1590  deadZoneCenter[1] = -32.88305;
1591  deadZoneCenter[2] = 32.867423;
1592  deadZoneCenter[3] = 88.205;
1593  if(localPos.y() > (yBorder) &&
1594  ((localPos.y()> deadZoneCenter[0] + cutZone && localPos.y()< deadZoneCenter[1] - cutZone) ||
1595  (localPos.y()> deadZoneCenter[1] + cutZone && localPos.y()< deadZoneCenter[2] - cutZone) ||
1596  (localPos.y()> deadZoneCenter[2] + cutZone && localPos.y()< deadZoneCenter[3] - cutZone))){
1597  pass = true;
1598  }
1599  }
1600  else{
1601  deadZoneCenter[0]= -81.0;
1602  deadZoneCenter[1] = 81.0;
1603  if(localPos.y() > (yBorder) &&
1604  (localPos.y()> deadZoneCenter[0] + cutZone && localPos.y()< deadZoneCenter[1] - cutZone )){
1605  pass = true;
1606  }
1607  }
1608  }
1609  return pass;
1610 }
1611 
1612 
1614 
1615  if (flag == 1){
1616  // linearlized index bases on endcap, station, and ring
1617  int index = 0;
1618  if (id.station() == 1) index = id.ring();
1619  else index = id.station()*2 + id.ring();
1620  if (id.endcap() == 1) index = index + 10;
1621  if (id.endcap() == 2) index = 11 - index;
1622  return index;
1623  }
1624 
1625  else if (flag == 2){
1626  int index = 0;
1627  if (id.station() == 1 && id.ring() != 4) index = id.ring()+1;
1628  if (id.station() == 1 && id.ring() == 4) index = 1;
1629  if (id.station() != 1) index = id.station()*2 + id.ring();
1630  if (id.endcap() == 1) index = index + 10;
1631  if (id.endcap() == 2) index = 11 - index;
1632  return index;
1633  }
1634 
1635  else return 0;
1636 
1637 }
1638 
1640  int st = id.station();
1641  int ri = id.ring();
1642  int ch = id.chamber();
1643  int ec = id.endcap();
1644  int kSerial = ch;
1645  if (st == 1 && ri == 1) kSerial = ch;
1646  if (st == 1 && ri == 2) kSerial = ch + 36;
1647  if (st == 1 && ri == 3) kSerial = ch + 72;
1648  if (st == 1 && ri == 4) kSerial = ch;
1649  if (st == 2 && ri == 1) kSerial = ch + 108;
1650  if (st == 2 && ri == 2) kSerial = ch + 126;
1651  if (st == 3 && ri == 1) kSerial = ch + 162;
1652  if (st == 3 && ri == 2) kSerial = ch + 180;
1653  if (st == 4 && ri == 1) kSerial = ch + 216;
1654  if (st == 4 && ri == 2) kSerial = ch + 234; // one day...
1655  if (ec == 2) kSerial = kSerial + 300;
1656  return kSerial;
1657 }
1658 
1659 
1660 
1662 
dbl * delta
Definition: mlp_gen.cc:36
int chamber() const
Definition: CSCDetId.h:70
void doPedestalNoise(edm::Handle< CSCStripDigiCollection > strips)
T getParameter(std::string const &) const
int i
Definition: DBlmapReader.cc:9
void setBinContent(int binx, double content)
set content of bin (1-D)
long int flag
Definition: mlp_lapack.h:47
int chamberSerial(CSCDetId id)
CSCDetId id() const
Get the (concrete) DetId.
Definition: CSCChamber.h:37
void histoEfficiency(TH1F *readHisto, MonitorElement *writeHisto)
void doResolution(edm::Handle< CSCSegmentCollection > cscSegments, edm::ESHandle< CSCGeometry > cscGeom)
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
size_t size() const
return number of contained object
Definition: RangeMap.h:132
static const double slope[3]
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:49
Geom::Phi< T > phi() const
Definition: PV3DBase.h:63
T y() const
Definition: PV3DBase.h:57
#define abs(x)
Definition: mlp_lapack.h:159
LocalPoint toLocal(const GlobalPoint &gp) const
Conversion to the R.F. of the GeomDet.
Definition: GeomDet.h:64
float getSignal(const CSCStripDigiCollection &stripdigis, CSCDetId idRH, int centerStrip)
int layer() const
Definition: CSCDetId.h:63
Geom::Theta< T > theta() const
Definition: PV3DBase.h:69
CSCOfflineMonitor(const edm::ParameterSet &pset)
Constructor.
std::string chamberTypeName() const
int endcap() const
Definition: CSCDetId.h:95
virtual const std::vector< float > parameters() const
C::const_iterator const_iterator
constant access iterator type
Definition: RangeMap.h:45
LocalPoint localPosition() const
Definition: CSCSegment.h:39
LocalVector localDirection() const
Local direction.
Definition: CSCSegment.h:42
const CSCChamberSpecs * specs() const
Definition: CSCChamber.h:42
int typeIndex(CSCDetId id, int flag=1)
float threshold
Definition: crabWrap.py:319
T sqrt(T t)
Definition: SSEVec.h:28
T z() const
Definition: PV3DBase.h:58
const CSCLayer * layer(CSCDetId id) const
Return the layer corresponding to the given id.
Definition: CSCChamber.cc:41
float ChiSquaredProbability(double chiSquared, double nrDOF)
tuple pset
Definition: CrabTask.py:85
void setBinError(int binx, double error)
set uncertainty on content of bin (1-D)
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
void getEfficiency(float bin, float Norm, std::vector< float > &eff)
bool withinSensitiveRegion(LocalPoint localPos, const std::vector< float > layerBounds, int station, int ring, float shiftFromEdge, float shiftFromDeadZone)
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)
Perform the real analysis.
void doOccupancies(edm::Handle< CSCStripDigiCollection > strips, edm::Handle< CSCWireDigiCollection > wires, edm::Handle< CSCRecHit2DCollection > recHits, edm::Handle< CSCSegmentCollection > cscSegments)
void doWireDigis(edm::Handle< CSCWireDigiCollection > wires)
const T & get() const
Definition: EventSetup.h:55
float fitX(CLHEP::HepMatrix sp, CLHEP::HepMatrix ep)
void doStripDigis(edm::Handle< CSCStripDigiCollection > strips)
perl if(1 lt scalar(@::datatypes))
Definition: edlooper.cc:31
int station() const
Definition: CSCDetId.h:88
string s
Definition: asciidump.py:422
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:56
virtual ~CSCOfflineMonitor()
Destructor.
const CSCLayerGeometry * geometry() const
Definition: CSCLayer.h:47
void doRecHits(edm::Handle< CSCRecHit2DCollection > recHits, edm::Handle< CSCStripDigiCollection > strips, edm::ESHandle< CSCGeometry > cscGeom)
std::vector< int > ChannelContainer
Definition: CSCRecHit2D.h:22