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
00067 void book();
00068 void bookModMEs(const uint32_t& );
00069 void bookLayerMEs(const uint32_t&, std::string&);
00070 void bookSubDetMEs(std::string& name);
00071 MonitorElement * bookME1D(const char*, const char*);
00072 MonitorElement * bookME2D(const char*, const char*);
00073 MonitorElement * bookME3D(const char*, const char*);
00074 MonitorElement * bookMEProfile(const char*, const char*);
00075 MonitorElement * bookMETrend(const char*, const char*);
00076
00077 void AllClusters(const edm::Event& ev, const edm::EventSetup& es);
00078 void trackStudy(const edm::Event& ev, const edm::EventSetup& es);
00079
00080 bool clusterInfos(SiStripClusterInfo* cluster, const uint32_t& detid,std::string flag, LocalVector LV);
00081 template <class T> void RecHitInfo(const T* tkrecHit, LocalVector LV,reco::TrackRef track_ref, const edm::EventSetup&);
00082
00083
00084 void fillModMEs(SiStripClusterInfo*,std::string,float);
00085 void fillMEs(SiStripClusterInfo*,uint32_t detid,float,std::string);
00086 inline void fillME(MonitorElement* ME,float value1){if (ME!=0)ME->Fill(value1);}
00087 inline void fillME(MonitorElement* ME,float value1,float value2){if (ME!=0)ME->Fill(value1,value2);}
00088 inline void fillME(MonitorElement* ME,float value1,float value2,float value3){if (ME!=0)ME->Fill(value1,value2,value3);}
00089 inline void fillME(MonitorElement* ME,float value1,float value2,float value3,float value4){if (ME!=0)ME->Fill(value1,value2,value3,value4);}
00090
00091 void getSubDetTag(std::string& folder_name, std::string& tag);
00092
00093
00094 private:
00095 DQMStore * dbe;
00096 edm::ParameterSet conf_;
00097 std::string histname;
00098 LocalVector LV;
00099 float iOrbitSec;
00100
00101
00102 TkHistoMap *tkhisto_StoNCorrOnTrack, *tkhisto_NumOnTrack, *tkhisto_NumOffTrack;
00103
00104
00105 struct ModMEs{
00106 MonitorElement* ClusterStoNCorr;
00107 MonitorElement* ClusterCharge;
00108 MonitorElement* ClusterChargeCorr;
00109 MonitorElement* ClusterWidth;
00110 MonitorElement* ClusterPos;
00111 MonitorElement* ClusterPGV;
00112 };
00113
00114 struct LayerMEs{
00115 MonitorElement* ClusterStoNCorrOnTrack;
00116 MonitorElement* ClusterChargeCorrOnTrack;
00117 MonitorElement* ClusterChargeOnTrack;
00118 MonitorElement* ClusterChargeOffTrack;
00119 MonitorElement* ClusterNoiseOnTrack;
00120 MonitorElement* ClusterNoiseOffTrack;
00121 MonitorElement* ClusterWidthOnTrack;
00122 MonitorElement* ClusterWidthOffTrack;
00123 MonitorElement* ClusterPosOnTrack;
00124 MonitorElement* ClusterPosOffTrack;
00125 };
00126 struct SubDetMEs{
00127 int totNClustersOnTrack;
00128 int totNClustersOffTrack;
00129 MonitorElement* nClustersOnTrack;
00130 MonitorElement* nClustersTrendOnTrack;
00131 MonitorElement* nClustersOffTrack;
00132 MonitorElement* nClustersTrendOffTrack;
00133 MonitorElement* ClusterStoNCorrOnTrack;
00134 MonitorElement* ClusterChargeOffTrack;
00135 MonitorElement* ClusterStoNOffTrack;
00136
00137 };
00138 std::map<std::string, ModMEs> ModMEsMap;
00139 std::map<std::string, LayerMEs> LayerMEsMap;
00140 std::map<std::string, SubDetMEs> SubDetMEsMap;
00141
00142 edm::ESHandle<TrackerGeometry> tkgeom;
00143 edm::ESHandle<SiStripDetCabling> SiStripDetCabling_;
00144
00145 edm::ParameterSet Parameters;
00146 edm::InputTag Cluster_src_;
00147
00148 bool Mod_On_;
00149 bool Trend_On_;
00150 bool OffHisto_On_;
00151 bool HistoFlag_On_;
00152 bool ring_flag;
00153 bool TkHistoMap_On_;
00154
00155 std::string TrackProducer_;
00156 std::string TrackLabel_;
00157
00158 std::vector<uint32_t> ModulesToBeExcluded_;
00159 std::vector<const SiStripCluster*> vPSiStripCluster;
00160 bool tracksCollection_in_EventTree;
00161 bool trackAssociatorCollection_in_EventTree;
00162 bool flag_ring;
00163 int runNb, eventNb;
00164 int firstEvent;
00165
00166 bool applyClusterQuality_;
00167 double sToNLowerLimit_;
00168 double sToNUpperLimit_;
00169 double widthLowerLimit_;
00170 double widthUpperLimit_;
00171
00172 SiStripDCSStatus* dcsStatus_;
00173 GenericTriggerEventFlag* genTriggerEventFlag_;
00174 };
00175 #endif