forked from cms-sw/cmssw
-
Notifications
You must be signed in to change notification settings - Fork 0
/
SiStripMonitorTrack.h
executable file
·240 lines (207 loc) · 9.69 KB
/
SiStripMonitorTrack.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
#ifndef SiStripMonitorTrack_H
#define SiStripMonitorTrack_H
// system include files
#include <memory>
#include <fstream>
#include <iostream>
#include <vector>
#include <string>
#include <unordered_set>
// user include files
#include "FWCore/Utilities/interface/EDGetToken.h"
#include "FWCore/Framework/interface/Frameworkfwd.h"
#include "FWCore/Framework/interface/EDAnalyzer.h"
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/MakerMacros.h"
#include "FWCore/Framework/interface/ESHandle.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/Utilities/interface/InputTag.h"
#include "FWCore/ServiceRegistry/interface/Service.h"
#include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h"
#include "Geometry/CommonTopologies/interface/StripTopology.h"
#include "Geometry/CommonDetUnit/interface/GeomDetType.h"
#include "DataFormats/Common/interface/Handle.h"
#include "DataFormats/Common/interface/DetSetVector.h"
#include "DataFormats/Common/interface/DetSetNew.h"
#include "DataFormats/TrackingRecHit/interface/TrackingRecHit.h"
#include "DataFormats/SiStripCluster/interface/SiStripCluster.h"
#include "DataFormats/TrackReco/interface/Track.h"
#include "Geometry/TrackerGeometryBuilder/interface/StripGeomDetUnit.h"
#include "AnalysisDataFormats/SiStripClusterInfo/interface/SiStripClusterInfo.h"
#include "TrackingTools/PatternTools/interface/Trajectory.h"
#include "TrackingTools/PatternTools/interface/TrajTrackAssociation.h"
#include "CalibFormats/SiStripObjects/interface/SiStripDetCabling.h"
#include "DQM/SiStripCommon/interface/SiStripFolderOrganizer.h"
#include "DQMServices/Core/interface/DQMStore.h"
#include "DQMServices/Core/interface/MonitorElement.h"
#include "DataFormats/TrackerRecHit2D/interface/SiStripRecHit2D.h"
//******** Single include for the TkMap *************
#include "DQM/SiStripCommon/interface/TkHistoMap.h"
//***************************************************
#include <DQMServices/Core/interface/DQMEDAnalyzer.h>
class SiStripDCSStatus;
class GenericTriggerEventFlag;
class TrackerTopology;
//
// class declaration
//
class SiStripMonitorTrack : public DQMEDAnalyzer {
public:
typedef TrackingRecHit::ConstRecHitPointer ConstRecHitPointer;
enum RecHitType { Single=0, Matched=1, Projected=2, Null=3};
explicit SiStripMonitorTrack(const edm::ParameterSet&);
~SiStripMonitorTrack();
void dqmBeginRun(const edm::Run& run, const edm::EventSetup& es) ;
virtual void analyze(const edm::Event&, const edm::EventSetup&);
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override;
private:
enum ClusterFlags {
OffTrack,
OnTrack
};
struct Det2MEs;
//booking
void book(DQMStore::IBooker &, const TrackerTopology* tTopo);
void bookModMEs(DQMStore::IBooker &, const uint32_t );
void bookLayerMEs(DQMStore::IBooker &, const uint32_t, std::string&);
void bookRing(DQMStore::IBooker &, const uint32_t, std::string&);
MonitorElement* handleBookMEs(DQMStore::IBooker &, std::string&, std::string&, std::string&, std::string&);
void bookRingMEs(DQMStore::IBooker &, const uint32_t, std::string&);
void bookSubDetMEs(DQMStore::IBooker &, std::string& name);
MonitorElement * bookME1D(DQMStore::IBooker & , const char*, const char*);
MonitorElement * bookME2D(DQMStore::IBooker & , const char*, const char*);
MonitorElement * bookME3D(DQMStore::IBooker & , const char*, const char*);
MonitorElement * bookMEProfile(DQMStore::IBooker & , const char*, const char*);
MonitorElement * bookMETrend(DQMStore::IBooker & , const char*);
// internal evaluation of monitorables
void AllClusters(const edm::Event& ev, const edm::EventSetup& es);
void trackStudyFromTrack(edm::Handle<reco::TrackCollection > trackCollectionHandle, const edm::EventSetup& es);
void trackStudyFromTrajectory(edm::Handle<TrajTrackAssociationCollection> TItkAssociatorCollection, const edm::EventSetup& es);
void trajectoryStudy(const edm::Ref<std::vector<Trajectory> > traj, const edm::EventSetup& es, bool track_ok);
void trackStudy(const edm::Event& ev, const edm::EventSetup& es);
bool trackFilter(const reco::Track& track);
// LocalPoint project(const GeomDet *det,const GeomDet* projdet,LocalPoint position,LocalVector trackdirection)const;
void hitStudy(const edm::EventSetup& es,
const ProjectedSiStripRecHit2D* projhit,
const SiStripMatchedRecHit2D* matchedhit,
const SiStripRecHit2D* hit2D,
const SiStripRecHit1D* hit1D,
LocalVector localMomentum,
const bool track_ok);
bool clusterInfos(SiStripClusterInfo* cluster, const uint32_t detid, enum ClusterFlags flags, bool track_ok, LocalVector LV, const Det2MEs& MEs);
template <class T> void RecHitInfo(const T* tkrecHit, LocalVector LV, const edm::EventSetup&, bool ok);
// fill monitorables
// void fillModMEs(SiStripClusterInfo* cluster,std::string name, float cos, const uint32_t detid, const LocalVector LV);
// void fillMEs(SiStripClusterInfo*,const uint32_t detid, float,enum ClusterFlags, const LocalVector LV, const Det2MEs& MEs);
inline void fillME(MonitorElement* ME,float value1){if (ME!=0)ME->Fill(value1);}
inline void fillME(MonitorElement* ME,float value1,float value2){if (ME!=0)ME->Fill(value1,value2);}
inline void fillME(MonitorElement* ME,float value1,float value2,float value3){if (ME!=0)ME->Fill(value1,value2,value3);}
inline void fillME(MonitorElement* ME,float value1,float value2,float value3,float value4){if (ME!=0)ME->Fill(value1,value2,value3,value4);}
Det2MEs findMEs(const TrackerTopology* tTopo, const uint32_t detid);
// ----------member data ---------------------------
private:
edm::ParameterSet conf_;
std::string histname;
LocalVector LV;
float iOrbitSec , iLumisection;
std::string topFolderName_;
//******* TkHistoMaps
TkHistoMap *tkhisto_StoNCorrOnTrack, *tkhisto_NumOnTrack, *tkhisto_NumOffTrack;
TkHistoMap *tkhisto_ClChPerCMfromOrigin, *tkhisto_ClChPerCMfromTrack;
TkHistoMap *tkhisto_NumMissingHits, *tkhisto_NumberInactiveHits, *tkhisto_NumberValidHits;
//******** TkHistoMaps
int numTracks;
struct ModMEs{
MonitorElement* ClusterStoNCorr;
MonitorElement* ClusterCharge;
MonitorElement* ClusterChargeCorr;
MonitorElement* ClusterWidth;
MonitorElement* ClusterPos;
MonitorElement* ClusterPGV;
MonitorElement* ClusterChargePerCMfromTrack;
MonitorElement* ClusterChargePerCMfromOrigin;
};
struct LayerMEs{
MonitorElement* ClusterStoNCorrOnTrack;
MonitorElement* ClusterChargeCorrOnTrack;
MonitorElement* ClusterChargeOnTrack;
MonitorElement* ClusterChargeOffTrack;
MonitorElement* ClusterNoiseOnTrack;
MonitorElement* ClusterNoiseOffTrack;
MonitorElement* ClusterWidthOnTrack;
MonitorElement* ClusterWidthOffTrack;
MonitorElement* ClusterPosOnTrack;
MonitorElement* ClusterPosOffTrack;
MonitorElement* ClusterChargePerCMfromTrack;
MonitorElement* ClusterChargePerCMfromOriginOnTrack;
MonitorElement* ClusterChargePerCMfromOriginOffTrack;
};
struct RingMEs{
MonitorElement* ClusterStoNCorrOnTrack;
MonitorElement* ClusterChargeCorrOnTrack;
MonitorElement* ClusterChargeOnTrack;
MonitorElement* ClusterChargeOffTrack;
MonitorElement* ClusterNoiseOnTrack;
MonitorElement* ClusterNoiseOffTrack;
MonitorElement* ClusterWidthOnTrack;
MonitorElement* ClusterWidthOffTrack;
MonitorElement* ClusterChargePerCMfromTrack;
MonitorElement* ClusterChargePerCMfromOriginOnTrack;
MonitorElement* ClusterChargePerCMfromOriginOffTrack;
};
struct SubDetMEs{
int totNClustersOnTrack;
int totNClustersOffTrack;
MonitorElement* nClustersOnTrack;
MonitorElement* nClustersTrendOnTrack;
MonitorElement* nClustersOffTrack;
MonitorElement* nClustersTrendOffTrack;
MonitorElement* ClusterStoNCorrOnTrack;
MonitorElement* ClusterChargeOnTrack;
MonitorElement* ClusterChargeOffTrack;
MonitorElement* ClusterStoNOffTrack;
MonitorElement* ClusterChargePerCMfromTrack;
MonitorElement* ClusterChargePerCMfromOriginOnTrack;
MonitorElement* ClusterChargePerCMfromOriginOffTrack;
};
std::map<std::string, ModMEs> ModMEsMap;
std::map<std::string, LayerMEs> LayerMEsMap;
std::map<std::string, RingMEs> RingMEsMap;
std::map<std::string, SubDetMEs> SubDetMEsMap;
struct Det2MEs {
struct LayerMEs *iLayer;
struct RingMEs *iRing;
struct SubDetMEs *iSubdet;
};
edm::ESHandle<TrackerGeometry> tkgeom_;
edm::ESHandle<SiStripDetCabling> SiStripDetCabling_;
edm::ParameterSet Parameters;
edm::InputTag Cluster_src_;
edm::EDGetTokenT<edmNew::DetSetVector<SiStripCluster> > clusterToken_;
edm::EDGetTokenT<reco::TrackCollection> trackToken_;
// edm::EDGetTokenT<std::vector<Trajectory> > trajectoryToken_;
edm::EDGetTokenT<TrajTrackAssociationCollection> trackTrajToken_;
bool Mod_On_;
bool Trend_On_;
bool OffHisto_On_;
bool HistoFlag_On_;
bool ring_flag;
bool TkHistoMap_On_;
bool clchCMoriginTkHmap_On_;
std::string TrackProducer_;
std::string TrackLabel_;
std::unordered_set<const SiStripCluster*> vPSiStripCluster;
bool tracksCollection_in_EventTree;
bool trackAssociatorCollection_in_EventTree;
edm::EventNumber_t eventNb;
int firstEvent;
bool applyClusterQuality_;
double sToNLowerLimit_;
double sToNUpperLimit_;
double widthLowerLimit_;
double widthUpperLimit_;
SiStripDCSStatus* dcsStatus_;
GenericTriggerEventFlag* genTriggerEventFlag_;
SiStripFolderOrganizer folderOrganizer_;
};
#endif