00001
00002 #ifndef SiStripMonitorTrack_H
00003 #define SiStripMonitorTrack_H
00004
00005
00006 #include <memory>
00007 #include <fstream>
00008 #include <iostream>
00009 #include <vector>
00010 #include <string>
00011
00012
00013 #include "FWCore/Framework/interface/Frameworkfwd.h"
00014 #include "FWCore/Framework/interface/EDAnalyzer.h"
00015 #include "FWCore/Framework/interface/Event.h"
00016 #include "FWCore/Framework/interface/MakerMacros.h"
00017 #include "FWCore/Framework/interface/ESHandle.h"
00018 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00019 #include "FWCore/Utilities/interface/InputTag.h"
00020 #include "FWCore/ServiceRegistry/interface/Service.h"
00021
00022 #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h"
00023 #include "Geometry/CommonTopologies/interface/StripTopology.h"
00024 #include "Geometry/CommonDetUnit/interface/GeomDetType.h"
00025
00026 #include "DataFormats/Common/interface/Handle.h"
00027 #include "DataFormats/Common/interface/DetSetVector.h"
00028 #include "DataFormats/Common/interface/DetSetNew.h"
00029 #include "DataFormats/TrackingRecHit/interface/TrackingRecHit.h"
00030 #include "DataFormats/SiStripCluster/interface/SiStripCluster.h"
00031 #include "DataFormats/TrackReco/interface/Track.h"
00032 #include "Geometry/TrackerGeometryBuilder/interface/StripGeomDetUnit.h"
00033
00034 #include "AnalysisDataFormats/SiStripClusterInfo/interface/SiStripClusterInfo.h"
00035 #include "TrackingTools/PatternTools/interface/Trajectory.h"
00036 #include "TrackingTools/PatternTools/interface/TrajTrackAssociation.h"
00037 #include "CalibFormats/SiStripObjects/interface/SiStripDetCabling.h"
00038
00039 #include "DQM/SiStripCommon/interface/SiStripFolderOrganizer.h"
00040 #include "DQMServices/Core/interface/DQMStore.h"
00041 #include "DQMServices/Core/interface/MonitorElement.h"
00042
00043 #include "DataFormats/TrackerRecHit2D/interface/SiStripRecHit2D.h"
00044
00045
00046 #include "DQM/SiStripCommon/interface/TkHistoMap.h"
00047
00048
00049 class SiStripDCSStatus;
00050 class GenericTriggerEventFlag;
00051
00052
00053
00054
00055 class SiStripMonitorTrack : public edm::EDAnalyzer {
00056 public:
00057 typedef TransientTrackingRecHit::ConstRecHitPointer ConstRecHitPointer;
00058 enum RecHitType { Single=0, Matched=1, Projected=2, Null=3};
00059 explicit SiStripMonitorTrack(const edm::ParameterSet&);
00060 ~SiStripMonitorTrack();
00061 virtual void beginRun(const edm::Run& run, const edm::EventSetup& c);
00062 virtual void endJob(void);
00063 virtual void analyze(const edm::Event&, const edm::EventSetup&);
00064
00065 private:
00066 enum ClusterFlags {
00067 OffTrack,
00068 OnTrack
00069 };
00070
00071 void book();
00072 void bookModMEs(const uint32_t& );
00073 void bookLayerMEs(const uint32_t&, std::string&);
00074 void bookSubDetMEs(std::string& name);
00075 MonitorElement * bookME1D(const char*, const char*);
00076 MonitorElement * bookME2D(const char*, const char*);
00077 MonitorElement * bookME3D(const char*, const char*);
00078 MonitorElement * bookMEProfile(const char*, const char*);
00079 MonitorElement * bookMETrend(const char*, const char*);
00080
00081 void AllClusters(const edm::Event& ev, const edm::EventSetup& es);
00082 void trackStudy(const edm::Event& ev, const edm::EventSetup& es);
00083
00084 bool clusterInfos(SiStripClusterInfo* cluster, const uint32_t& detid,enum ClusterFlags flags, LocalVector LV);
00085 template <class T> void RecHitInfo(const T* tkrecHit, LocalVector LV,reco::TrackRef track_ref, const edm::EventSetup&);
00086
00087
00088 void fillModMEs(SiStripClusterInfo*,std::string,float);
00089 void fillMEs(SiStripClusterInfo*,uint32_t detid,float,enum ClusterFlags);
00090 inline void fillME(MonitorElement* ME,float value1){if (ME!=0)ME->Fill(value1);}
00091 inline void fillME(MonitorElement* ME,float value1,float value2){if (ME!=0)ME->Fill(value1,value2);}
00092 inline void fillME(MonitorElement* ME,float value1,float value2,float value3){if (ME!=0)ME->Fill(value1,value2,value3);}
00093 inline void fillME(MonitorElement* ME,float value1,float value2,float value3,float value4){if (ME!=0)ME->Fill(value1,value2,value3,value4);}
00094
00095 void getSubDetTag(std::string& folder_name, std::string& tag);
00096
00097
00098 private:
00099 DQMStore * dbe;
00100 edm::ParameterSet conf_;
00101 std::string histname;
00102 LocalVector LV;
00103 float iOrbitSec;
00104
00105
00106 TkHistoMap *tkhisto_StoNCorrOnTrack, *tkhisto_NumOnTrack, *tkhisto_NumOffTrack;
00107
00108
00109 struct ModMEs{
00110 MonitorElement* ClusterStoNCorr;
00111 MonitorElement* ClusterCharge;
00112 MonitorElement* ClusterChargeCorr;
00113 MonitorElement* ClusterWidth;
00114 MonitorElement* ClusterPos;
00115 MonitorElement* ClusterPGV;
00116 };
00117
00118 struct LayerMEs{
00119 MonitorElement* ClusterStoNCorrOnTrack;
00120 MonitorElement* ClusterChargeCorrOnTrack;
00121 MonitorElement* ClusterChargeOnTrack;
00122 MonitorElement* ClusterChargeOffTrack;
00123 MonitorElement* ClusterNoiseOnTrack;
00124 MonitorElement* ClusterNoiseOffTrack;
00125 MonitorElement* ClusterWidthOnTrack;
00126 MonitorElement* ClusterWidthOffTrack;
00127 MonitorElement* ClusterPosOnTrack;
00128 MonitorElement* ClusterPosOffTrack;
00129 };
00130 struct SubDetMEs{
00131 int totNClustersOnTrack;
00132 int totNClustersOffTrack;
00133 MonitorElement* nClustersOnTrack;
00134 MonitorElement* nClustersTrendOnTrack;
00135 MonitorElement* nClustersOffTrack;
00136 MonitorElement* nClustersTrendOffTrack;
00137 MonitorElement* ClusterStoNCorrOnTrack;
00138 MonitorElement* ClusterChargeOffTrack;
00139 MonitorElement* ClusterStoNOffTrack;
00140
00141 };
00142 std::map<std::string, ModMEs> ModMEsMap;
00143 std::map<std::string, LayerMEs> LayerMEsMap;
00144 std::map<std::string, SubDetMEs> SubDetMEsMap;
00145
00146 edm::ESHandle<TrackerGeometry> tkgeom;
00147 edm::ESHandle<SiStripDetCabling> SiStripDetCabling_;
00148
00149 edm::ParameterSet Parameters;
00150 edm::InputTag Cluster_src_;
00151
00152 bool Mod_On_;
00153 bool Trend_On_;
00154 bool OffHisto_On_;
00155 bool HistoFlag_On_;
00156 bool ring_flag;
00157 bool TkHistoMap_On_;
00158
00159 bool layerontrack;
00160 bool layerofftrack;
00161 bool layercharge;
00162 bool layerston;
00163 bool layerchargecorr;
00164 bool layerstoncorrontrack;
00165 bool layernoise;
00166 bool layerwidth;
00167
00168 std::string TrackProducer_;
00169 std::string TrackLabel_;
00170
00171 std::vector<uint32_t> ModulesToBeExcluded_;
00172 std::vector<const SiStripCluster*> vPSiStripCluster;
00173 bool tracksCollection_in_EventTree;
00174 bool trackAssociatorCollection_in_EventTree;
00175 bool flag_ring;
00176 int runNb, eventNb;
00177 int firstEvent;
00178
00179 bool applyClusterQuality_;
00180 double sToNLowerLimit_;
00181 double sToNUpperLimit_;
00182 double widthLowerLimit_;
00183 double widthUpperLimit_;
00184
00185 SiStripDCSStatus* dcsStatus_;
00186 GenericTriggerEventFlag* genTriggerEventFlag_;
00187 SiStripFolderOrganizer folderOrganizer_;
00188 };
00189 #endif