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