00001 #ifndef SiStripMonitorTrack_H
00002 #define SiStripMonitorTrack_H
00003
00004
00005 #include <memory>
00006 #include <fstream>
00007 #include <iostream>
00008 #include <vector>
00009 #include <string>
00010
00011
00012 #include "FWCore/Framework/interface/Frameworkfwd.h"
00013 #include "FWCore/Framework/interface/EDAnalyzer.h"
00014 #include "FWCore/Framework/interface/Event.h"
00015 #include "FWCore/Framework/interface/MakerMacros.h"
00016 #include "FWCore/Framework/interface/ESHandle.h"
00017 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00018 #include "FWCore/ParameterSet/interface/InputTag.h"
00019 #include "FWCore/ServiceRegistry/interface/Service.h"
00020
00021 #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h"
00022 #include "Geometry/CommonTopologies/interface/StripTopology.h"
00023 #include "Geometry/CommonDetUnit/interface/GeomDetType.h"
00024
00025 #include "DataFormats/Common/interface/Handle.h"
00026 #include "DataFormats/Common/interface/DetSetVector.h"
00027 #include "DataFormats/Common/interface/DetSetNew.h"
00028 #include "DataFormats/TrackingRecHit/interface/TrackingRecHit.h"
00029 #include "DataFormats/SiStripCluster/interface/SiStripCluster.h"
00030 #include "DataFormats/TrackReco/interface/Track.h"
00031 #include "Geometry/TrackerGeometryBuilder/interface/StripGeomDetUnit.h"
00032
00033 #include "AnalysisDataFormats/SiStripClusterInfo/interface/SiStripClusterInfo.h"
00034 #include "TrackingTools/PatternTools/interface/Trajectory.h"
00035 #include "TrackingTools/PatternTools/interface/TrajTrackAssociation.h"
00036 #include "CalibFormats/SiStripObjects/interface/SiStripDetCabling.h"
00037
00038 #include "DQM/SiStripCommon/interface/SiStripFolderOrganizer.h"
00039 #include "DQMServices/Core/interface/DQMStore.h"
00040 #include "DQMServices/Core/interface/MonitorElement.h"
00041
00042 #include "DataFormats/TrackerRecHit2D/interface/SiStripRecHit2D.h"
00043
00044 #include "TString.h"
00045
00046
00047
00048
00049
00050 class SiStripMonitorTrack : public edm::EDAnalyzer {
00051 public:
00052 typedef TransientTrackingRecHit::ConstRecHitPointer ConstRecHitPointer;
00053 enum RecHitType { Single=0, Matched=1, Projected=2, Null=3};
00054 explicit SiStripMonitorTrack(const edm::ParameterSet&);
00055 ~SiStripMonitorTrack();
00056 virtual void beginRun(const edm::Run& run, const edm::EventSetup& c);
00057
00058 virtual void endJob(void);
00059 virtual void analyze(const edm::Event&, const edm::EventSetup&);
00060
00061 private:
00062
00063 void book();
00064 void bookModMEs(TString, uint32_t);
00065 void bookTrendMEs(TString, int32_t,uint32_t,std::string flag);
00066 void bookSubDetMEs(TString name,TString flag);
00067 MonitorElement * bookME1D(const char*, const char*);
00068 MonitorElement * bookME2D(const char*, const char*);
00069 MonitorElement * bookME3D(const char*, const char*);
00070 MonitorElement * bookMEProfile(const char*, const char*);
00071 MonitorElement * bookMETrend(const char*, const char*);
00072
00073 void AllClusters(const edm::EventSetup& es);
00074 void trackStudy(const edm::EventSetup& es);
00075
00076 bool clusterInfos(SiStripClusterInfo* cluster, const uint32_t& detid,std::string flag, LocalVector LV);
00077 float SymEta( float clusterCentralCharge, float clusterLeftCharge, float clusterRightCharge);
00078 void RecHitInfo(const SiStripRecHit2D* tkrecHit, LocalVector LV,reco::TrackRef track_ref, const edm::EventSetup&);
00079
00080 void fillModMEs(SiStripClusterInfo*,TString,float);
00081 void fillCapacitiveCouplingMEs(SiStripClusterInfo*,std::string,float,std::string);
00082 void fillTrendMEs(SiStripClusterInfo*,std::string,float,std::string);
00083 void fillTrend(MonitorElement* ME,float value1);
00084 inline void fillME(MonitorElement* ME,float value1){if (ME!=0)ME->Fill(value1);}
00085 inline void fillME(MonitorElement* ME,float value1,float value2){if (ME!=0)ME->Fill(value1,value2);}
00086 inline void fillME(MonitorElement* ME,float value1,float value2,float value3){if (ME!=0)ME->Fill(value1,value2,value3);}
00087 inline void fillME(MonitorElement* ME,float value1,float value2,float value3,float value4){if (ME!=0)ME->Fill(value1,value2,value3,value4);}
00088
00089
00090
00091 private:
00092 DQMStore * dbe;
00093 edm::ParameterSet conf_;
00094 std::string histname;
00095 TString name;
00096 LocalVector LV;
00097
00098 struct ModMEs{
00099 ModMEs():
00100 ClusterStoN(0),
00101 ClusterStoNCorr(0),
00102 ClusterCharge(0),
00103 ClusterChargeCorr(0),
00104 ClusterWidth(0),
00105 ClusterPos(0),
00106 ClusterPGV(0){};
00107 MonitorElement* ClusterStoN;
00108 MonitorElement* ClusterStoNCorr;
00109 MonitorElement* ClusterCharge;
00110 MonitorElement* ClusterChargeCorr;
00111 MonitorElement* ClusterWidth;
00112 MonitorElement* ClusterPos;
00113 MonitorElement* ClusterPGV;
00114 };
00115
00116 struct LayerMEs{
00117 LayerMEs():
00118 nClusters(0),
00119 nClustersTrend(0),
00120 ClusterStoN(0),
00121 ClusterStoNCorr(0),
00122 ClusterStoNTrend(0),
00123 ClusterStoNCorrTrend(0),
00124 ClusterCharge(0),
00125 ClusterChargeCorr(0),
00126 ClusterChargeTrend(0),
00127 ClusterChargeCorrTrend(0),
00128 ClusterNoise(0),
00129 ClusterNoiseTrend(0),
00130 ClusterWidth(0),
00131 ClusterWidthTrend(0),
00132 ClusterSymmEtaCC(0),
00133 ClusterSymmEtaCCTrend(0),
00134 ClusterWidthCC(0),
00135 ClusterEstimatorCC(0),
00136 ClusterPos(0),
00137 ClusterPGV(0){};
00138 MonitorElement* nClusters;
00139 MonitorElement* nClustersTrend;
00140 MonitorElement* ClusterStoN;
00141 MonitorElement* ClusterStoNCorr;
00142 MonitorElement* ClusterStoNTrend;
00143 MonitorElement* ClusterStoNCorrTrend;
00144 MonitorElement* ClusterCharge;
00145 MonitorElement* ClusterChargeCorr;
00146 MonitorElement* ClusterChargeTrend;
00147 MonitorElement* ClusterChargeCorrTrend;
00148 MonitorElement* ClusterNoise;
00149 MonitorElement* ClusterNoiseTrend;
00150 MonitorElement* ClusterWidth;
00151 MonitorElement* ClusterWidthTrend;
00152 MonitorElement* ClusterSymmEtaCC;
00153 MonitorElement* ClusterSymmEtaCCTrend;
00154 MonitorElement* ClusterWidthCC;
00155 MonitorElement* ClusterEstimatorCC;
00156 MonitorElement* ClusterPos;
00157 MonitorElement* ClusterPGV;
00158 };
00159
00160 std::map<TString, ModMEs> ModMEsMap;
00161 std::map<TString, LayerMEs> LayerMEsMap;
00162 std::map<TString, MonitorElement*> MEMap;
00163
00164
00165 edm::Handle< edm::DetSetVector<SiStripRawDigi> > dsv_SiStripRawDigi;
00166 edm::Handle< edmNew::DetSetVector<SiStripCluster> > dsv_SiStripCluster;
00167
00168 edm::Handle<std::vector<Trajectory> > TrajectoryCollection;
00169 edm::Handle<reco::TrackCollection > trackCollection;
00170 edm::Handle<TrajTrackAssociationCollection> TItkAssociatorCollection;
00171
00172 edm::ESHandle<TrackerGeometry> tkgeom;
00173 edm::ESHandle<SiStripDetCabling> SiStripDetCabling_;
00174
00175 edm::ParameterSet Parameters;
00176 edm::InputTag Cluster_src_;
00177
00178 bool Mod_On_;
00179 bool Trend_On_;
00180 bool OffHisto_On_;
00181 bool RawDigis_On_;
00182 bool CCAnalysis_On_;
00183 bool ring_flag;
00184
00185 int off_Flag;
00186 std::vector<uint32_t> ModulesToBeExcluded_;
00187 std::vector<const SiStripCluster*> vPSiStripCluster;
00188 std::map<std::pair<std::string,int32_t>,bool> DetectedLayers;
00189 SiStripFolderOrganizer folder_organizer;
00190 bool tracksCollection_in_EventTree;
00191 bool trackAssociatorCollection_in_EventTree;
00192 bool flag_ring;
00193 int runNb, eventNb;
00194 int firstEvent;
00195 int countOn, countOff, countAll, NClus[4][3];
00196 };
00197 #endif