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.18 2009/01/26 13:28:06 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 = 12,
|
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=12;
|
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 ABSBX_START=0; // starting of hAbsBX: run#62232:797; run#63200:234; run62384:2500
|
45 |
const int NUMSEC=MAXSEC-MINSEC;
|
46 |
|
47 |
class CSCTriggerMappingFromFile;
|
48 |
|
49 |
class CSCTimingAnalyzer : public edm::EDAnalyzer
|
50 |
{
|
51 |
public:
|
52 |
|
53 |
explicit CSCTimingAnalyzer(edm::ParameterSet const& conf);
|
54 |
~CSCTimingAnalyzer();
|
55 |
|
56 |
virtual void beginJob(const edm::EventSetup&);
|
57 |
virtual void endJob();
|
58 |
virtual void analyze(edm::Event const& e, edm::EventSetup const& iSetup);
|
59 |
|
60 |
private:
|
61 |
|
62 |
void initializeHistograms();
|
63 |
void fillHistograms(edm::Handle<CSCCorrelatedLCTDigiCollection> corrlcts,
|
64 |
edm::Handle<L1CSCTrackCollection> tracks,
|
65 |
edm::Event const& e);
|
66 |
|
67 |
void timingExtract();
|
68 |
// void initializeCanvases();
|
69 |
// void fillCanvases();
|
70 |
// void printCanvases();
|
71 |
|
72 |
void deleteRootObjects();
|
73 |
void deleteHistograms();
|
74 |
void deleteCanvases();
|
75 |
int myBX(edm::Event const& event);
|
76 |
bool testBeam;
|
77 |
int TBFEDid, TBendcap, TBsector;
|
78 |
std::string mapPath;
|
79 |
CSCTriggerMappingFromFile* TFMapping;
|
80 |
int eventNumber;
|
81 |
|
82 |
/* std::string day; */
|
83 |
edm::InputTag lctProducer, trackProducer;
|
84 |
|
85 |
std::string run;
|
86 |
// std::string outFile;
|
87 |
std::string timeFile;
|
88 |
|
89 |
/// Root Objects
|
90 |
|
91 |
/// File to store the generated hisograms
|
92 |
// TFile* fAnalysis;
|
93 |
|
94 |
/// for output of const and error
|
95 |
TFile* fTimingConst;
|
96 |
|
97 |
/// for inter sector synchronization
|
98 |
TFile* fInterSector;
|
99 |
|
100 |
/// for absolute BXN synchronization
|
101 |
TFile* fAbsBXN;
|
102 |
|
103 |
/// for Orbit vs BXN
|
104 |
TFile* fOrbBXN;
|
105 |
Int_t orn, bxn, gmt_bxn;
|
106 |
TTree *orbvsbxn_tree;
|
107 |
|
108 |
// TH2F* hEndSec;
|
109 |
TH1I* hBX[NUMSEC][MAX_STATIONS][MAX_CHAMBERS];
|
110 |
TH1I* hAbsBX[NUMSEC][MAX_STATIONS][MAX_CHAMBERS];
|
111 |
TH1I* hNumTracksPerEvent;
|
112 |
TH1I* hBX0;
|
113 |
TH1F* hTimingConstDirect;
|
114 |
TH1F* hTimingConstA;
|
115 |
TH1F* hTimingConstB;
|
116 |
TH1F* hTimingComp;
|
117 |
/// Arrays of histograms that contains the strip difference between
|
118 |
/// LCTs in adjacent CSCs within the same event
|
119 |
///
|
120 |
/// MAX_CHAMBERS-2 because there are that many boundaries between CSCs to
|
121 |
/// account for in ME 234. In ME 1 there will be unused plots
|
122 |
TH1I* hBXDifference[NUMSEC][MAX_STATIONS][MAX_CHAMBERS-2];
|
123 |
|
124 |
/// BX difference between station 2 and 3
|
125 |
/// overlapping cscs in ME 2 and 3
|
126 |
TH1I* hBXDifference23Overlap[NUMSEC][MAX_CHAMBERS];
|
127 |
/// crossing cscs in ME 2 and 3
|
128 |
TH1I* hBXDifference23Cross[NUMSEC][2*MAX_CHAMBERS-4];
|
129 |
/// non overlapping cscs in ME 2 and 3
|
130 |
TH1I* hBXDifference23NonOverlap[NUMSEC][MAX_CHAMBERS-3];
|
131 |
/// require "forward" muons
|
132 |
|
133 |
/// BX difference between stations 1A and 2
|
134 |
/// ME 1A ring 1
|
135 |
TH1I* hBXDifference1AR12[NUMSEC][MAX_CHAMBERS-3];
|
136 |
/// ME 1A ring 2/3
|
137 |
TH1I* hBXDifference1AR232[NUMSEC][MAX_CHAMBERS-3];
|
138 |
|
139 |
/// BX difference between stations 1B and 2
|
140 |
/// ME 1B ring 1
|
141 |
TH1I* hBXDifference1BR12[NUMSEC][MAX_CHAMBERS-3];
|
142 |
/// ME 1B ring 2/3
|
143 |
TH1I* hBXDifference1BR232[NUMSEC][MAX_CHAMBERS-3];
|
144 |
|
145 |
/// BX difference within different rings in stations 1A
|
146 |
/// R1-R2
|
147 |
TH1I* hBXDifference1AInR1R2[NUMSEC][7];
|
148 |
/// R1-R3
|
149 |
TH1I* hBXDifference1AInR1R3[NUMSEC][7];
|
150 |
|
151 |
/// BX difference within different rings in stations 1B
|
152 |
/// R1-R2
|
153 |
TH1I* hBXDifference1BInR1R2[NUMSEC][7];
|
154 |
/// R1-R3
|
155 |
TH1I* hBXDifference1BInR1R3[NUMSEC][7];
|
156 |
|
157 |
/// BX difference within stations 1A abd 1B
|
158 |
TH1I* hBXDifference1AWith1B[NUMSEC][7];
|
159 |
|
160 |
|
161 |
/// BX difference between station 3 and 4
|
162 |
/// overlapping cscs in ME 3 and 4
|
163 |
TH1I* hBXDifference34Overlap[NUMSEC][MAX_CHAMBERS];
|
164 |
/// crossing cscs in ME 3 and 4
|
165 |
TH1I* hBXDifference34Cross[NUMSEC][4];
|
166 |
|
167 |
/// BX differences between different sectors
|
168 |
TH1I* hBXDifferenceSector[NUMSEC][11];
|
169 |
|
170 |
|
171 |
/// Canvases to display the histograms once they are filled
|
172 |
|
173 |
TCanvas* cBX[NUMSEC][MAX_STATIONS];
|
174 |
TCanvas* cNumTracksPerEvent;
|
175 |
TCanvas* cTimingConstA;
|
176 |
TCanvas* cTimingConstB;
|
177 |
TCanvas* cTimingConstDirect;
|
178 |
TCanvas* cTimingComp;
|
179 |
|
180 |
TCanvas* cBXDifference[NUMSEC][MAX_STATIONS];
|
181 |
|
182 |
/// Canvases for printing BX Difference between station 2 and 3
|
183 |
/// Overlapping cscs in stations 2 and 3
|
184 |
TCanvas* cBXDifference23Overlap[NUMSEC];
|
185 |
/// Crossing cscs in stations 2 and 3
|
186 |
TCanvas* cBXDifference23Cross[NUMSEC];
|
187 |
/// Non-overlapping cscs in stations 2 and 3
|
188 |
TCanvas* cBXDifference23NonOverlap[NUMSEC];
|
189 |
/// Canvases for printing BX differences between station 1A and 2
|
190 |
/// ME 1A ring 1
|
191 |
TCanvas* cBXDifference1AR12[NUMSEC];
|
192 |
/// ME 1A ring 2/3
|
193 |
TCanvas* cBXDifference1AR232[NUMSEC];
|
194 |
|
195 |
/// Canvases for printing BX differences between station 1B and 2
|
196 |
/// ME 1B ring 1
|
197 |
TCanvas* cBXDifference1BR12[NUMSEC];
|
198 |
/// ME 1B ring 2/3
|
199 |
TCanvas* cBXDifference1BR232[NUMSEC];
|
200 |
|
201 |
/// Canvases for printing BX differences within station 1A
|
202 |
/// R1R2
|
203 |
TCanvas* cBXDifference1AInR1R2[NUMSEC];
|
204 |
/// R1R3
|
205 |
TCanvas* cBXDifference1AInR1R3[NUMSEC];
|
206 |
|
207 |
/// Canvases for printing BX differences within station 1B
|
208 |
/// R1R2
|
209 |
TCanvas* cBXDifference1BInR1R2[NUMSEC];
|
210 |
/// R1R3
|
211 |
TCanvas* cBXDifference1BInR1R3[NUMSEC];
|
212 |
|
213 |
/// Canvases for printing BX differences of station 1A and 1B
|
214 |
TCanvas* cBXDifference1AWith1B[NUMSEC];
|
215 |
|
216 |
|
217 |
};
|
218 |
|
219 |
#endif
|