00001 #ifndef SiStripMonitorTrackEfficiency_H
00002 #define SiStripMonitorTrackEfficiency_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 SiStripMonitorTrackEfficiency : public edm::EDAnalyzer {
00051 public:
00052 typedef TransientTrackingRecHit::ConstRecHitPointer ConstRecHitPointer;
00053 enum RecHitType { Single=0, Matched=1, Projected=2, Null=3};
00054 explicit SiStripMonitorTrackEfficiency(const edm::ParameterSet&);
00055 ~SiStripMonitorTrackEfficiency();
00056 virtual void beginRun(const edm::Run& run, const edm::EventSetup& c);
00057 virtual void endJob(void);
00058 virtual void analyze(const edm::Event&, const edm::EventSetup&);
00059
00060 private:
00061
00062 void book();
00063 void bookModMEs(TString, uint32_t);
00064 void bookTrendMEs(TString, int32_t,uint32_t,std::string flag);
00065 void bookSubDetMEs(TString name,TString flag);
00066 MonitorElement * bookME1D(const char*, const char*);
00067 MonitorElement * bookME2D(const char*, const char*);
00068 MonitorElement * bookME3D(const char*, const char*);
00069 MonitorElement * bookMEProfile(const char*, const char*);
00070 MonitorElement * bookMETrend(const char*, const char*);
00071
00072 void AllClusters(const edm::EventSetup& es);
00073 void trackStudy(const edm::EventSetup& es);
00074
00075 bool clusterInfos(SiStripClusterInfo* cluster, const uint32_t& detid,std::string flag, LocalVector LV);
00076 void RecHitInfo(const SiStripRecHit2D* tkrecHit, LocalVector LV,reco::TrackRef track_ref, const edm::EventSetup&);
00077
00078 void fillModMEs(SiStripClusterInfo*,TString,float);
00079 void fillTrendMEs(SiStripClusterInfo*,std::string,float,std::string);
00080 void fillTrend(MonitorElement* ME,float value1);
00081 inline void fillME(MonitorElement* ME,float value1){if (ME!=0)ME->Fill(value1);}
00082 inline void fillME(MonitorElement* ME,float value1,float value2){if (ME!=0)ME->Fill(value1,value2);}
00083 inline void fillME(MonitorElement* ME,float value1,float value2,float value3){if (ME!=0)ME->Fill(value1,value2,value3);}
00084 inline void fillME(MonitorElement* ME,float value1,float value2,float value3,float value4){if (ME!=0)ME->Fill(value1,value2,value3,value4);}
00085
00086
00087
00088 private:
00089 DQMStore * dbe;
00090 edm::ParameterSet conf_;
00091 std::string histname;
00092 TString name;
00093 LocalVector LV;
00094
00095 struct ModMEs{
00096 ModMEs():
00097 nClusters(0),
00098 nClustersTrend(0),
00099 ClusterStoN(0),
00100 ClusterStoNCorr(0),
00101 ClusterStoNTrend(0),
00102 ClusterStoNCorrTrend(0),
00103 ClusterCharge(0),
00104 ClusterChargeCorr(0),
00105 ClusterChargeTrend(0),
00106 ClusterChargeCorrTrend(0),
00107 ClusterNoise(0),
00108 ClusterNoiseTrend(0),
00109 ClusterWidth(0),
00110 ClusterWidthTrend(0),
00111 ClusterPos(0),
00112 ClusterPGV(0){};
00113 MonitorElement* nClusters;
00114 MonitorElement* nClustersTrend;
00115 MonitorElement* ClusterStoN;
00116 MonitorElement* ClusterStoNCorr;
00117 MonitorElement* ClusterStoNTrend;
00118 MonitorElement* ClusterStoNCorrTrend;
00119 MonitorElement* ClusterCharge;
00120 MonitorElement* ClusterChargeCorr;
00121 MonitorElement* ClusterChargeTrend;
00122 MonitorElement* ClusterChargeCorrTrend;
00123 MonitorElement* ClusterNoise;
00124 MonitorElement* ClusterNoiseTrend;
00125 MonitorElement* ClusterWidth;
00126 MonitorElement* ClusterWidthTrend;
00127 MonitorElement* ClusterPos;
00128 MonitorElement* ClusterPGV;
00129 };
00130
00131 std::map<TString, ModMEs> ModMEsMap;
00132 std::map<TString, MonitorElement*> MEMap;
00133
00134 edm::Handle< edmNew::DetSetVector<SiStripCluster> > dsv_SiStripCluster;
00135
00136 edm::Handle<std::vector<Trajectory> > TrajectoryCollection;
00137 edm::Handle<reco::TrackCollection > trackCollection;
00138 edm::Handle<TrajTrackAssociationCollection> TItkAssociatorCollection;
00139
00140 edm::ESHandle<TrackerGeometry> tkgeom;
00141 edm::ESHandle<SiStripDetCabling> SiStripDetCabling_;
00142
00143 edm::ParameterSet Parameters;
00144 edm::InputTag Cluster_src_;
00145
00146 bool Mod_On_;
00147 bool OffHisto_On_;
00148 int off_Flag;
00149 std::vector<uint32_t> ModulesToBeExcluded_;
00150 std::vector<const SiStripCluster*> vPSiStripCluster;
00151 std::map<std::pair<std::string,int32_t>,bool> DetectedLayers;
00152 SiStripFolderOrganizer folder_organizer;
00153 bool tracksCollection_in_EventTree;
00154 bool trackAssociatorCollection_in_EventTree;
00155 int runNb, eventNb;
00156 int firstEvent;
00157 int countOn, countOff, countAll, NClus[4][3];
00158 uint32_t neighbourStripNumber;
00159 };
00160 #endif