CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
MuonSeedsAnalyzer.cc
Go to the documentation of this file.
1 
2 /*
3  * See header file for a description of this class.
4  *
5  * $Date: 2008/03/25
6  18:37:05 $
7  * $Revision: 1.15 $
8  * \author G. Mila - INFN Torino
9  */
10 
12 
18 
22 
27 
29 
30 #include <string>
31 using namespace std;
32 using namespace edm;
33 
34 
35 
37  parameters = pSet;
38 }
39 
40 
42 
43 
45 
46  metname = "seedsAnalyzer";
47 
48  LogTrace(metname)<<"[MuonSeedsAnalyzer] Parameters initialization";
49  dbe->setCurrentFolder("Muons/MuonSeedsAnalyzer");
50 
51  seedHitBin = parameters.getParameter<int>("RecHitBin");
52  seedHitMin = parameters.getParameter<double>("RecHitMin");
53  seedHitMax = parameters.getParameter<double>("RecHitMax");
54  string histname = "NumberOfRecHitsPerSeed_";
55  NumberOfRecHitsPerSeed = dbe->book1D(histname, "Number of seed recHits", seedHitBin, seedHitMin, seedHitMax);
56 
57  PhiBin = parameters.getParameter<int>("PhiBin");
58  PhiMin = parameters.getParameter<double>("PhiMin");
59  PhiMax = parameters.getParameter<double>("PhiMax");
60  histname = "seedPhi_";
61  seedPhi = dbe->book1D(histname, "Seed #phi", PhiBin, PhiMin, PhiMax);
62  seedPhi->setAxisTitle("rad");
63 
64  EtaBin = parameters.getParameter<int>("EtaBin");
65  EtaMin = parameters.getParameter<double>("EtaMin");
66  EtaMax = parameters.getParameter<double>("EtaMax");
67  histname = "seedEta_";
68  seedEta = dbe->book1D(histname, "Seed #eta", EtaBin, EtaMin, EtaMax);
69 
70  ThetaBin = parameters.getParameter<int>("ThetaBin");
71  ThetaMin = parameters.getParameter<double>("ThetaMin");
72  ThetaMax = parameters.getParameter<double>("ThetaMax");
73  histname = "seedTheta_";
74  seedTheta = dbe->book1D(histname, "Seed #theta", ThetaBin, ThetaMin, ThetaMax);
75  seedTheta->setAxisTitle("rad");
76 
77  seedPtBin = parameters.getParameter<int>("seedPtBin");
78  seedPtMin = parameters.getParameter<double>("seedPtMin");
79  seedPtMax = parameters.getParameter<double>("seedPtMax");
80  histname = "seedPt_";
81  seedPt = dbe->book1D(histname, "Seed p_{t}", seedPtBin, seedPtMin, seedPtMax);
82  seedPt->setAxisTitle("GeV");
83 
84  seedPxyzBin = parameters.getParameter<int>("seedPxyzBin");
85  seedPxyzMin = parameters.getParameter<double>("seedPxyzMin");
86  seedPxyzMax = parameters.getParameter<double>("seedPxyzMax");
87  histname = "seedPx_";
88  seedPx = dbe->book1D(histname, "Seed p_{x}", seedPxyzBin, seedPxyzMin, seedPxyzMax);
89  seedPx->setAxisTitle("GeV");
90  histname = "seedPy_";
91  seedPy = dbe->book1D(histname, "Seed p_{y}", seedPxyzBin, seedPxyzMin, seedPxyzMax);
92  seedPy->setAxisTitle("GeV");
93  histname = "seedPz_";
94  seedPz = dbe->book1D(histname, "Seed p_{z}", seedPxyzBin, seedPxyzMin, seedPxyzMax);
95  seedPz->setAxisTitle("GeV");
96 
97  pErrBin = parameters.getParameter<int>("pErrBin");
98  pErrMin = parameters.getParameter<double>("pErrMin");
99  pErrMax = parameters.getParameter<double>("pErrMax");
100  histname = "seedPtErrOverPt_";
101  seedPtErr = dbe->book1D(histname, "Seed p_{t}Err/p_{t}", pErrBin, pErrMin, pErrMax);
102  histname = "seedPtErrOverPtVsPhi_";
103  seedPtErrVsPhi = dbe->book2D(histname, "Seed p_{t}Err/p_{t} vs #phi", PhiBin, PhiMin, PhiMax, pErrBin, pErrMin, pErrMax);
104  seedPtErrVsPhi->setAxisTitle("rad",2);
105  histname = "seedPtErrOverPtVsEta_";
106  seedPtErrVsEta = dbe->book2D(histname, "Seed p_{t}Err/p_{t} vs #eta", EtaBin, EtaMin, EtaMax, pErrBin, pErrMin, pErrMax);
107  histname = "seedPtErrOverPtVsPt_";
108  seedPtErrVsPt = dbe->book2D(histname, "Seed p_{t}Err/p_{t} vs p_{t}", seedPtBin/5, seedPtMin, seedPtMax, pErrBin, pErrMin, pErrMax);
109  seedPtErrVsPt->setAxisTitle("GeV",2);
110  histname = "seedPErrOverP_";
111  seedPErr = dbe->book1D(histname, "Seed pErr/p", pErrBin, pErrMin, pErrMax);
112  histname = "seedPErrOverPVsPhi_";
113  seedPErrVsPhi = dbe->book2D(histname, "Seed pErr/p vs #phi", PhiBin, PhiMin, PhiMax, pErrBin, pErrMin, pErrMax);
114  seedPErrVsPhi->setAxisTitle("rad",2);
115  histname = "seedPErrOverPVsEta_";
116  seedPErrVsEta = dbe->book2D(histname, "Seed pErr/p vs #eta", EtaBin, EtaMin, EtaMax, pErrBin, pErrMin, pErrMax);
117  histname = "seedPErrOverPVsPt_";
118  seedPErrVsPt = dbe->book2D(histname, "Seed pErr/p vs p_{t}", seedPtBin/5, seedPtMin, seedPtMax, pErrBin, pErrMin, pErrMax);
119  seedPErrVsPt->setAxisTitle("GeV",2);
120 
121  pxyzErrBin = parameters.getParameter<int>("pxyzErrBin");
122  pxyzErrMin = parameters.getParameter<double>("pxyzErrMin");
123  pxyzErrMax = parameters.getParameter<double>("pxyzErrMax");
124  histname = "seedPxErrOverPx_";
125  seedPxErr = dbe->book1D(histname, "Seed p_{x}Err/p_{x}", pxyzErrBin, pxyzErrMin, pxyzErrMax);
126  histname = "seedPyErrOverPy_";
127  seedPyErr = dbe->book1D(histname, "Seed p_{y}Err/p_{y}", pxyzErrBin, pxyzErrMin, pxyzErrMax);
128  histname = "seedPzErrOverPz_";
129  seedPzErr = dbe->book1D(histname, "Seed p_{z}Err/p_{z}", pxyzErrBin, pxyzErrMin, pxyzErrMax);
130 
131  phiErrBin = parameters.getParameter<int>("phiErrBin");
132  phiErrMin = parameters.getParameter<double>("phiErrMin");
133  phiErrMax = parameters.getParameter<double>("phiErrMax");
134  histname = "seedPhiErr_";
135  seedPhiErr = dbe->book1D(histname, "Seed #phi error", phiErrBin, phiErrMin, phiErrMax);
136 
137  etaErrBin = parameters.getParameter<int>("etaErrBin");
138  etaErrMin = parameters.getParameter<double>("etaErrMin");
139  etaErrMax = parameters.getParameter<double>("etaErrMax");
140  histname = "seedEtaErr_";
141  seedEtaErr = dbe->book1D(histname, "Seed #eta error", etaErrBin, etaErrMin, etaErrMax);
142 
143 }
144 
145 
147 
148  TrajectoryStateOnSurface seedTSOS = getSeedTSOS(seed);
150  double partialPterror = errors(3,3)*pow(seedTSOS.globalMomentum().x(),2) + errors(4,4)*pow(seedTSOS.globalMomentum().y(),2);
151 
152  LogTrace(metname)<<"[MuonSeedAnalyzer] Filling the histos";
153 
154  // nhits
155  LogTrace(metname)<<"Number od recHits per seed: "<<seed.nHits();
157 
158  // pt
159  LogTrace(metname)<<"seed momentum: "<<seedTSOS.globalMomentum().perp();
160  seedPt->Fill(seedTSOS.globalMomentum().perp());
161 
162  // px
163  LogTrace(metname)<<"seed px: "<<seedTSOS.globalMomentum().x();
164  seedPx->Fill(seedTSOS.globalMomentum().x());
165 
166  // py
167  LogTrace(metname)<<"seed py: "<<seedTSOS.globalMomentum().y();
168  seedPy->Fill(seedTSOS.globalMomentum().y());
169 
170  // pz
171  LogTrace(metname)<<"seed pz: "<<seedTSOS.globalMomentum().z();
172  seedPz->Fill(seedTSOS.globalMomentum().z());
173 
174  // phi
175  LogTrace(metname)<<"seed phi: "<<seedTSOS.globalMomentum().phi();
176  seedPhi->Fill(seedTSOS.globalMomentum().phi());
177 
178  // theta
179  LogTrace(metname)<<"seed theta: "<<seedTSOS.globalMomentum().theta();
180  seedTheta->Fill(seedTSOS.globalMomentum().theta());
181 
182  // eta
183  LogTrace(metname)<<"seed eta: "<<seedTSOS.globalMomentum().eta();
184  seedEta->Fill(seedTSOS.globalMomentum().eta());
185 
186  // pt err
187  LogTrace(metname)<<"seed pt error: "<<sqrt(partialPterror)/seedTSOS.globalMomentum().perp();
188  seedPtErr->Fill(sqrt(partialPterror)/seedTSOS.globalMomentum().perp());
189 
190  // ptErr/pt Vs phi
191  seedPtErrVsPhi->Fill(seedTSOS.globalMomentum().phi(),
192  sqrt(partialPterror)/seedTSOS.globalMomentum().perp());
193  // ptErr/pt Vs eta
194  seedPtErrVsEta->Fill(seedTSOS.globalMomentum().eta(),
195  sqrt(partialPterror)/seedTSOS.globalMomentum().perp());
196  // ptErr/pt Vs pt
197  seedPtErrVsPt->Fill(seedTSOS.globalMomentum().perp(),
198  sqrt(partialPterror)/seedTSOS.globalMomentum().perp());
199 
200  // px err
201  LogTrace(metname)<<"seed px error: "<<sqrt(errors(3,3))/seedTSOS.globalMomentum().x();
202  seedPxErr->Fill(sqrt(errors(3,3))/seedTSOS.globalMomentum().x());
203 
204  // py err
205  LogTrace(metname)<<"seed py error: "<<sqrt(errors(4,4))/seedTSOS.globalMomentum().y();
206  seedPyErr->Fill(sqrt(errors(4,4))/seedTSOS.globalMomentum().y());
207 
208  // pz err
209  LogTrace(metname)<<"seed pz error: "<<sqrt(errors(5,5))/seedTSOS.globalMomentum().z();
210  seedPzErr->Fill(sqrt(errors(5,5))/seedTSOS.globalMomentum().z());
211 
212  // p err
213  LogTrace(metname)<<"seed p error: "<<sqrt(partialPterror+errors(5,5)*pow(seedTSOS.globalMomentum().z(),2))/seedTSOS.globalMomentum().mag();
214  seedPErr->Fill(sqrt(partialPterror+errors(5,5)*pow(seedTSOS.globalMomentum().z(),2))/seedTSOS.globalMomentum().mag());
215 
216  // pErr/p Vs phi
217  seedPErrVsPhi->Fill(seedTSOS.globalMomentum().phi(),
218  sqrt(partialPterror+errors(5,5)*pow(seedTSOS.globalMomentum().z(),2))/seedTSOS.globalMomentum().mag());
219  // pErr/p Vs eta
220  seedPErrVsEta->Fill(seedTSOS.globalMomentum().eta(),
221  sqrt(partialPterror+errors(5,5)*pow(seedTSOS.globalMomentum().z(),2))/seedTSOS.globalMomentum().mag());
222  // pErr/p Vs pt
223  seedPErrVsPt->Fill(seedTSOS.globalMomentum().perp(),
224  sqrt(partialPterror+errors(5,5)*pow(seedTSOS.globalMomentum().z(),2))/seedTSOS.globalMomentum().mag());
225 
226  // phi err
227  LogTrace(metname)<<"seed phi error: "<<sqrt(seedTSOS.curvilinearError().matrix()(2,2));
228  seedPhiErr->Fill(sqrt(seedTSOS.curvilinearError().matrix()(2,2)));
229 
230  // eta err
231  LogTrace(metname)<<"seed eta error: "<<sqrt(seedTSOS.curvilinearError().matrix()(1,1))*abs(sin(seedTSOS.globalMomentum().theta()));
232  seedEtaErr->Fill(sqrt(seedTSOS.curvilinearError().matrix()(1,1))*abs(sin(seedTSOS.globalMomentum().theta())));
233 
234 }
235 
236 
238 
239  // Get the Trajectory State on Det (persistent version of a TSOS) from the seed
240  PTrajectoryStateOnDet pTSOD = seed.startingState();
241  // Transform it in a TrajectoryStateOnSurface
242 
243  DetId seedDetId(pTSOD.detId());
244  const GeomDet* gdet = service()->trackingGeometry()->idToDet( seedDetId );
245  TrajectoryStateOnSurface initialState = trajectoryStateTransform::transientState(pTSOD, &(gdet->surface()), &*(service())->magneticField());
246 
247  return initialState;
248 
249 }
250 
251 
T getParameter(std::string const &) const
MonitorElement * seedPx
T perp() const
Definition: PV3DBase.h:71
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:717
MonitorElement * seedPyErr
const CurvilinearTrajectoryError & curvilinearError() const
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
ROOT::Math::SMatrix< double, 6, 6, ROOT::Math::MatRepSym< double, 6 > > AlgebraicSymMatrix66
Geom::Phi< T > phi() const
Definition: PV3DBase.h:68
const CartesianTrajectoryError cartesianError() const
T y() const
Definition: PV3DBase.h:62
MonitorElement * seedEta
#define abs(x)
Definition: mlp_lapack.h:159
MuonServiceProxy * service()
TrajectoryStateOnSurface getSeedTSOS(const TrajectorySeed &seed)
Get the TrajectoryStateOnSurface.
MonitorElement * seedPErrVsEta
MonitorElement * seedPErrVsPt
MonitorElement * seedPtErrVsPt
MonitorElement * seedEtaErr
MonitorElement * seedPzErr
MonitorElement * seedPtErrVsPhi
MonitorElement * seedPErr
void beginJob(DQMStore *dbe)
Inizialize parameters for histo binning.
void Fill(long long x)
Geom::Theta< T > theta() const
Definition: PV3DBase.h:74
MonitorElement * NumberOfRecHitsPerSeed
int iEvent
Definition: GenABIO.cc:243
T mag() const
Definition: PV3DBase.h:66
T sqrt(T t)
Definition: SSEVec.h:46
T z() const
Definition: PV3DBase.h:63
unsigned int detId() const
MonitorElement * seedPtErrVsEta
#define LogTrace(id)
const AlgebraicSymMatrix66 & matrix() const
Definition: DetId.h:20
MonitorElement * seedPxErr
PTrajectoryStateOnDet const & startingState() const
edm::ParameterSet parameters
TrajectoryStateOnSurface transientState(const PTrajectoryStateOnDet &ts, const Surface *surface, const MagneticField *field)
virtual ~MuonSeedsAnalyzer()
Destructor.
MonitorElement * seedPy
MonitorElement * seedPt
MonitorElement * seedPtErr
MonitorElement * seedPz
T eta() const
Definition: PV3DBase.h:75
MuonSeedsAnalyzer(const edm::ParameterSet &, MuonServiceProxy *theService)
Constructor.
unsigned int nHits() const
const AlgebraicSymMatrix55 & matrix() const
GlobalVector globalMomentum() const
MonitorElement * seedPErrVsPhi
MonitorElement * seedPhi
void analyze(const edm::Event &, const edm::EventSetup &, const TrajectorySeed &seed)
Get the analysis.
MonitorElement * seedTheta
MonitorElement * book2D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Book 2D histogram.
Definition: DQMStore.cc:845
T x() const
Definition: PV3DBase.h:61
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:429
MonitorElement * seedPhiErr