ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/wangdy/TimingCSC/interface/CSCTimingAnalyzer.h
Revision: 1.10
Committed: Thu Apr 3 09:46:25 2008 UTC (17 years, 1 month ago) by wangdy
Content type: text/plain
Branch: MAIN
CVS Tags: usctest0804
Branch point for: usctest-swappedfiber
Changes since 1.9: +40 -31 lines
Log Message:
extracting inter-sector timing info;add NUMSEC to control histograms; add histogram writing options

File Contents

# Content
1 /**
2 * @file CSCTimingAnalyzer.h
3 * @author Dayong Wang
4 * @date Fri Dec 1 18:24:39 2006
5 *
6 * @brief Analyzer for extracting CSC timing const.
7 * based on B. Jackson's analyzer by Dayong Wang
8 *
9 */
10 // $Id: CSCTimingAnalyzer.h,v 1.9 2008/03/06 11:00:10 wangdy Exp $
11
12 #ifndef TimingCSC_CSCTimingAnalyzer_h
13 #define TimingCSC_CSCTimingAnalyzer_h
14
15
16 #include "DataFormats/CSCDigi/interface/CSCCorrelatedLCTDigiCollection.h"
17 #include "DataFormats/L1CSCTrackFinder/interface/L1CSCTrackCollection.h"
18
19 #include <TROOT.h>
20 #include <TFile.h>
21 #include <TCanvas.h>
22 #include <TH1I.h>
23 #include <TH1F.h>
24 #include <TString.h>
25
26 enum
27 {
28 /// MAX_STATIONS is set to 5 because the subsectors in ME 1 are handled
29 /// as a separate station
30 MAX_STATIONS = 5,
31 MAX_SECTORS = 6,
32 MAX_CHAMBERS = 9
33 };
34
35 const TString stationLabel[MAX_STATIONS] = {"1a","1b","2","3","4"};
36 const TString sectorLabel[12] = {"1","2","3","4","5","6", "7","8","9","10","11","12"};
37 const TString chamberLabel[MAX_CHAMBERS] = {"1","2","3","4","5","6","7","8","9"};
38 const TString SecOverLabel[11] = {"1b3-1a1","1b6-1a4","2S3-1","2S3-4","2S9-1","2S9-4",
39 "3S3-1","3S3-4","3S9-1","3S9-4","4S3-1"};
40 const int MINSEC=0;
41 const int MAXSEC=6;
42 const int TIMINGSEC=3; // this only works for naive estimation now
43 const int BX_START=3; // starting of hBX: 3 for MC and 0 for data
44 const int NUMSEC=MAXSEC-MINSEC;
45
46 class CSCTriggerMappingFromFile;
47
48 class CSCTimingAnalyzer : public edm::EDAnalyzer
49 {
50 public:
51
52 explicit CSCTimingAnalyzer(edm::ParameterSet const& conf);
53 ~CSCTimingAnalyzer();
54
55 virtual void beginJob(const edm::EventSetup&);
56 virtual void endJob();
57 virtual void analyze(edm::Event const& e, edm::EventSetup const& iSetup);
58
59 private:
60
61 void initializeHistograms();
62 void fillHistograms(edm::Handle<CSCCorrelatedLCTDigiCollection> corrlcts,
63 edm::Handle<L1CSCTrackCollection> tracks);
64
65 void timingExtract();
66 void initializeCanvases();
67 void fillCanvases();
68 void printCanvases();
69
70 void deleteRootObjects();
71 void deleteHistograms();
72 void deleteCanvases();
73
74 bool testBeam;
75 int TBFEDid, TBendcap, TBsector;
76 std::string mapPath;
77 CSCTriggerMappingFromFile* TFMapping;
78 int eventNumber;
79
80 /* std::string day; */
81 edm::InputTag lctProducer, trackProducer;
82
83 std::string run;
84 std::string outFile;
85 std::string timeFile;
86
87 /// Root Objects
88
89 /// File to store the generated hisograms
90 TFile* fAnalysis;
91
92 /// for output of const and error
93 TFile* fTimingConst;
94
95 /// for inter sector synchronization
96 TFile* fInterSector;
97
98 TH1I* hBX[NUMSEC][MAX_STATIONS][MAX_CHAMBERS];
99 TH1I* hNumTracksPerEvent;
100 TH1F* hTimingConstDirect;
101 TH1F* hTimingConstA;
102 TH1F* hTimingConstB;
103 TH1F* hTimingComp;
104 /// Arrays of histograms that contains the strip difference between
105 /// LCTs in adjacent CSCs within the same event
106 ///
107 /// MAX_CHAMBERS-2 because there are that many boundaries between CSCs to
108 /// account for in ME 234. In ME 1 there will be unused plots
109 TH1I* hBXDifference[NUMSEC][MAX_STATIONS][MAX_CHAMBERS-2];
110
111 /// BX difference between station 2 and 3
112 /// overlapping cscs in ME 2 and 3
113 TH1I* hBXDifference23Overlap[NUMSEC][MAX_CHAMBERS];
114 /// crossing cscs in ME 2 and 3
115 TH1I* hBXDifference23Cross[NUMSEC][2*MAX_CHAMBERS-4];
116 /// non overlapping cscs in ME 2 and 3
117 TH1I* hBXDifference23NonOverlap[NUMSEC][MAX_CHAMBERS-3];
118 /// require "forward" muons
119
120 /// BX difference between stations 1A and 2
121 /// ME 1A ring 1
122 TH1I* hBXDifference1AR12[NUMSEC][MAX_CHAMBERS-3];
123 /// ME 1A ring 2/3
124 TH1I* hBXDifference1AR232[NUMSEC][MAX_CHAMBERS-3];
125
126 /// BX difference between stations 1B and 2
127 /// ME 1B ring 1
128 TH1I* hBXDifference1BR12[NUMSEC][MAX_CHAMBERS-3];
129 /// ME 1B ring 2/3
130 TH1I* hBXDifference1BR232[NUMSEC][MAX_CHAMBERS-3];
131
132 /// BX difference within different rings in stations 1A
133 /// R1-R2
134 TH1I* hBXDifference1AInR1R2[NUMSEC][7];
135 /// R1-R3
136 TH1I* hBXDifference1AInR1R3[NUMSEC][7];
137
138 /// BX difference within different rings in stations 1B
139 /// R1-R2
140 TH1I* hBXDifference1BInR1R2[NUMSEC][7];
141 /// R1-R3
142 TH1I* hBXDifference1BInR1R3[NUMSEC][7];
143
144 /// BX difference within stations 1A abd 1B
145 TH1I* hBXDifference1AWith1B[NUMSEC][7];
146
147
148 /// BX difference between station 3 and 4
149 /// overlapping cscs in ME 3 and 4
150 TH1I* hBXDifference34Overlap[NUMSEC][MAX_CHAMBERS];
151 /// crossing cscs in ME 3 and 4
152 TH1I* hBXDifference34Cross[NUMSEC][4];
153
154 /// BX differences between different sectors
155 TH1I* hBXDifferenceSector[NUMSEC][11];
156
157
158 /// Canvases to display the histograms once they are filled
159
160 TCanvas* cBX[NUMSEC][MAX_STATIONS];
161 TCanvas* cNumTracksPerEvent;
162 TCanvas* cTimingConstA;
163 TCanvas* cTimingConstB;
164 TCanvas* cTimingConstDirect;
165 TCanvas* cTimingComp;
166
167 TCanvas* cBXDifference[NUMSEC][MAX_STATIONS];
168
169 /// Canvases for printing BX Difference between station 2 and 3
170 /// Overlapping cscs in stations 2 and 3
171 TCanvas* cBXDifference23Overlap[NUMSEC];
172 /// Crossing cscs in stations 2 and 3
173 TCanvas* cBXDifference23Cross[NUMSEC];
174 /// Non-overlapping cscs in stations 2 and 3
175 TCanvas* cBXDifference23NonOverlap[NUMSEC];
176 /// Canvases for printing BX differences between station 1A and 2
177 /// ME 1A ring 1
178 TCanvas* cBXDifference1AR12[NUMSEC];
179 /// ME 1A ring 2/3
180 TCanvas* cBXDifference1AR232[NUMSEC];
181
182 /// Canvases for printing BX differences between station 1B and 2
183 /// ME 1B ring 1
184 TCanvas* cBXDifference1BR12[NUMSEC];
185 /// ME 1B ring 2/3
186 TCanvas* cBXDifference1BR232[NUMSEC];
187
188 /// Canvases for printing BX differences within station 1A
189 /// R1R2
190 TCanvas* cBXDifference1AInR1R2[NUMSEC];
191 /// R1R3
192 TCanvas* cBXDifference1AInR1R3[NUMSEC];
193
194 /// Canvases for printing BX differences within station 1B
195 /// R1R2
196 TCanvas* cBXDifference1BInR1R2[NUMSEC];
197 /// R1R3
198 TCanvas* cBXDifference1BInR1R3[NUMSEC];
199
200 /// Canvases for printing BX differences of station 1A and 1B
201 TCanvas* cBXDifference1AWith1B[NUMSEC];
202
203
204 };
205
206 #endif