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