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