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