Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:33:28

0001 #include <memory>
0002 #include <string>
0003 #include <iostream>
0004 #include <TMath.h>
0005 #include "Validation/RecoTrack/interface/SiStripTrackingRecHitsValid.h"
0006 
0007 #include "FWCore/Framework/interface/ESHandle.h"
0008 
0009 #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h"
0010 #include "Geometry/Records/interface/TrackerDigiGeometryRecord.h"
0011 #include "Geometry/Records/interface/TrackerTopologyRcd.h"
0012 #include "TrackingTools/Records/interface/TransientRecHitRecord.h"
0013 #include "Geometry/CommonDetUnit/interface/GluedGeomDet.h"
0014 
0015 #include "DataFormats/TrackerRecHit2D/interface/SiStripMatchedRecHit2D.h"
0016 #include "DataFormats/DetId/interface/DetId.h"
0017 #include "DataFormats/SiStripDetId/interface/StripSubdetector.h"
0018 #include "DataFormats/TrackerCommon/interface/TrackerTopology.h"
0019 
0020 #include "DataFormats/GeometryVector/interface/LocalPoint.h"
0021 #include "DataFormats/GeometryVector/interface/GlobalPoint.h"
0022 
0023 #include "RecoLocalTracker/SiStripRecHitConverter/interface/StripCPE.h"
0024 #include "DQM/SiStripCommon/interface/SiStripHistoId.h"
0025 #include "CalibTracker/Records/interface/SiStripDetCablingRcd.h"
0026 #include "DQMServices/Core/interface/DQMStore.h"
0027 #include "CalibFormats/SiStripObjects/interface/SiStripDetCabling.h"
0028 #include "DataFormats/TrackerCommon/interface/SiStripSubStructure.h"
0029 #include "DQM/SiStripCommon/interface/SiStripFolderOrganizer.h"
0030 
0031 using namespace std;
0032 using namespace edm;
0033 
0034 // ROOT
0035 #include "TROOT.h"
0036 #include "TFile.h"
0037 #include "TTree.h"
0038 #include "TBranch.h"
0039 #include "TH1.h"
0040 #include "TH2.h"
0041 class TFile;
0042 
0043 //Constructor
0044 SiStripTrackingRecHitsValid::SiStripTrackingRecHitsValid(const edm::ParameterSet &ps)
0045     : m_geomToken(esConsumes()),
0046       m_topoToken(esConsumes()),
0047       m_topoTokenBR(esConsumes<edm::Transition::BeginRun>()),
0048       m_SiStripDetCablingToken(esConsumes<edm::Transition::BeginRun>()),
0049       m_stripCPEToken(esConsumes(edm::ESInputTag("", "SimpleStripCPE"))),
0050       dbe_(edm::Service<DQMStore>().operator->()),
0051       conf_(ps),
0052       trackerHitAssociatorConfig_(ps, consumesCollector())
0053 // trajectoryInput_( ps.getParameter<edm::InputTag>("trajectoryInput") )
0054 {
0055   topFolderName_ = conf_.getParameter<std::string>("TopFolderName");
0056 
0057   runStandalone = conf_.getParameter<bool>("runStandalone");
0058 
0059   outputMEsInRootFile = conf_.getParameter<bool>("OutputMEsInRootFile");
0060 
0061   outputFileName = conf_.getParameter<std::string>("outputFile");
0062 
0063   tracksInputToken_ = consumes<std::vector<reco::Track> >(conf_.getParameter<edm::InputTag>("tracksInput"));
0064 
0065   edm::ParameterSet ParametersResolx_LF = conf_.getParameter<edm::ParameterSet>("TH1Resolx_LF");
0066   layerswitchResolx_LF = ParametersResolx_LF.getParameter<bool>("layerswitchon");
0067 
0068   edm::ParameterSet ParametersResolx_MF = conf_.getParameter<edm::ParameterSet>("TH1Resolx_MF");
0069   layerswitchResolx_MF = ParametersResolx_MF.getParameter<bool>("layerswitchon");
0070 
0071   edm::ParameterSet ParametersRes_LF = conf_.getParameter<edm::ParameterSet>("TH1Res_LF");
0072   layerswitchRes_LF = ParametersRes_LF.getParameter<bool>("layerswitchon");
0073 
0074   edm::ParameterSet ParametersRes_MF = conf_.getParameter<edm::ParameterSet>("TH1Res_MF");
0075   layerswitchRes_MF = ParametersRes_MF.getParameter<bool>("layerswitchon");
0076 
0077   edm::ParameterSet ParametersPull_LF = conf_.getParameter<edm::ParameterSet>("TH1Pull_LF");
0078   layerswitchPull_LF = ParametersPull_LF.getParameter<bool>("layerswitchon");
0079 
0080   edm::ParameterSet ParametersPull_MF = conf_.getParameter<edm::ParameterSet>("TH1Pull_MF");
0081   layerswitchPull_MF = ParametersPull_MF.getParameter<bool>("layerswitchon");
0082 
0083   edm::ParameterSet ParametersCategory = conf_.getParameter<edm::ParameterSet>("TH1Category");
0084   layerswitchCategory = ParametersCategory.getParameter<bool>("layerswitchon");
0085 
0086   edm::ParameterSet ParametersTrackwidth = conf_.getParameter<edm::ParameterSet>("TH1Trackwidth");
0087   layerswitchTrackwidth = ParametersTrackwidth.getParameter<bool>("layerswitchon");
0088 
0089   edm::ParameterSet ParametersExpectedwidth = conf_.getParameter<edm::ParameterSet>("TH1Expectedwidth");
0090   layerswitchExpectedwidth = ParametersExpectedwidth.getParameter<bool>("layerswitchon");
0091 
0092   edm::ParameterSet ParametersClusterwidth = conf_.getParameter<edm::ParameterSet>("TH1Clusterwidth");
0093   layerswitchClusterwidth = ParametersClusterwidth.getParameter<bool>("layerswitchon");
0094 
0095   edm::ParameterSet ParametersTrackanglealpha = conf_.getParameter<edm::ParameterSet>("TH1Trackanglealpha");
0096   layerswitchTrackanglealpha = ParametersTrackanglealpha.getParameter<bool>("layerswitchon");
0097 
0098   edm::ParameterSet ParametersTrackanglebeta = conf_.getParameter<edm::ParameterSet>("TH1Trackanglebeta");
0099   layerswitchTrackanglebeta = ParametersTrackanglebeta.getParameter<bool>("layerswitchon");
0100 
0101   edm::ParameterSet ParametersResolxMFTrackwidthProfile_WClus1 =
0102       conf_.getParameter<edm::ParameterSet>("TProfResolxMFTrackwidthProfile_WClus1");
0103   layerswitchResolxMFTrackwidthProfile_WClus1 =
0104       ParametersResolxMFTrackwidthProfile_WClus1.getParameter<bool>("layerswitchon");
0105 
0106   edm::ParameterSet ParametersResolxMFTrackwidthProfile_WClus2 =
0107       conf_.getParameter<edm::ParameterSet>("TProfResolxMFTrackwidthProfile_WClus2");
0108   layerswitchResolxMFTrackwidthProfile_WClus2 =
0109       ParametersResolxMFTrackwidthProfile_WClus2.getParameter<bool>("layerswitchon");
0110 
0111   edm::ParameterSet ParametersResolxMFTrackwidthProfile_WClus3 =
0112       conf_.getParameter<edm::ParameterSet>("TProfResolxMFTrackwidthProfile_WClus3");
0113   layerswitchResolxMFTrackwidthProfile_WClus3 =
0114       ParametersResolxMFTrackwidthProfile_WClus3.getParameter<bool>("layerswitchon");
0115 
0116   edm::ParameterSet ParametersResolxMFTrackwidthProfile_WClus4 =
0117       conf_.getParameter<edm::ParameterSet>("TProfResolxMFTrackwidthProfile_WClus4");
0118   layerswitchResolxMFTrackwidthProfile_WClus4 =
0119       ParametersResolxMFTrackwidthProfile_WClus4.getParameter<bool>("layerswitchon");
0120 
0121   edm::ParameterSet ParametersResMFTrackwidthProfile_WClus1 =
0122       conf_.getParameter<edm::ParameterSet>("TProfResMFTrackwidthProfile_WClus1");
0123   layerswitchResMFTrackwidthProfile_WClus1 =
0124       ParametersResMFTrackwidthProfile_WClus1.getParameter<bool>("layerswitchon");
0125 
0126   edm::ParameterSet ParametersResMFTrackwidthProfile_WClus2 =
0127       conf_.getParameter<edm::ParameterSet>("TProfResMFTrackwidthProfile_WClus2");
0128   layerswitchResMFTrackwidthProfile_WClus2 =
0129       ParametersResMFTrackwidthProfile_WClus2.getParameter<bool>("layerswitchon");
0130 
0131   edm::ParameterSet ParametersResMFTrackwidthProfile_WClus21 =
0132       conf_.getParameter<edm::ParameterSet>("TProfResMFTrackwidthProfile_WClus21");
0133   layerswitchResMFTrackwidthProfile_WClus21 =
0134       ParametersResMFTrackwidthProfile_WClus21.getParameter<bool>("layerswitchon");
0135 
0136   edm::ParameterSet ParametersResMFTrackwidthProfile_WClus22 =
0137       conf_.getParameter<edm::ParameterSet>("TProfResMFTrackwidthProfile_WClus22");
0138   layerswitchResMFTrackwidthProfile_WClus22 =
0139       ParametersResMFTrackwidthProfile_WClus22.getParameter<bool>("layerswitchon");
0140 
0141   edm::ParameterSet ParametersResMFTrackwidthProfile_WClus23 =
0142       conf_.getParameter<edm::ParameterSet>("TProfResMFTrackwidthProfile_WClus23");
0143   layerswitchResMFTrackwidthProfile_WClus23 =
0144       ParametersResMFTrackwidthProfile_WClus23.getParameter<bool>("layerswitchon");
0145 
0146   edm::ParameterSet ParametersResMFTrackwidthProfile_WClus3 =
0147       conf_.getParameter<edm::ParameterSet>("TProfResMFTrackwidthProfile_WClus3");
0148   layerswitchResMFTrackwidthProfile_WClus3 =
0149       ParametersResMFTrackwidthProfile_WClus3.getParameter<bool>("layerswitchon");
0150 
0151   edm::ParameterSet ParametersResMFTrackwidthProfile_WClus4 =
0152       conf_.getParameter<edm::ParameterSet>("TProfResMFTrackwidthProfile_WClus4");
0153   layerswitchResMFTrackwidthProfile_WClus4 =
0154       ParametersResMFTrackwidthProfile_WClus4.getParameter<bool>("layerswitchon");
0155 
0156   edm::ParameterSet ParametersResolxMFTrackwidthProfile =
0157       conf_.getParameter<edm::ParameterSet>("TProfResolxMFTrackwidthProfile");
0158   layerswitchResolxMFTrackwidthProfile = ParametersResolxMFTrackwidthProfile.getParameter<bool>("layerswitchon");
0159 
0160   edm::ParameterSet ParametersResolxMFTrackwidthProfile_Category1 =
0161       conf_.getParameter<edm::ParameterSet>("TProfResolxMFTrackwidthProfile_Category1");
0162   layerswitchResolxMFTrackwidthProfile_Category1 =
0163       ParametersResolxMFTrackwidthProfile_Category1.getParameter<bool>("layerswitchon");
0164 
0165   edm::ParameterSet ParametersResolxMFTrackwidthProfile_Category2 =
0166       conf_.getParameter<edm::ParameterSet>("TProfResolxMFTrackwidthProfile_Category2");
0167   layerswitchResolxMFTrackwidthProfile_Category2 =
0168       ParametersResolxMFTrackwidthProfile_Category2.getParameter<bool>("layerswitchon");
0169 
0170   edm::ParameterSet ParametersResolxMFTrackwidthProfile_Category3 =
0171       conf_.getParameter<edm::ParameterSet>("TProfResolxMFTrackwidthProfile_Category3");
0172   layerswitchResolxMFTrackwidthProfile_Category3 =
0173       ParametersResolxMFTrackwidthProfile_Category3.getParameter<bool>("layerswitchon");
0174 
0175   edm::ParameterSet ParametersResolxMFTrackwidthProfile_Category4 =
0176       conf_.getParameter<edm::ParameterSet>("TProfResolxMFTrackwidthProfile_Category4");
0177   layerswitchResolxMFTrackwidthProfile_Category4 =
0178       ParametersResolxMFTrackwidthProfile_Category4.getParameter<bool>("layerswitchon");
0179 
0180   edm::ParameterSet ParametersResolxMFClusterwidthProfile_Category1 =
0181       conf_.getParameter<edm::ParameterSet>("TProfResolxMFClusterwidthProfile_Category1");
0182   layerswitchResolxMFClusterwidthProfile_Category1 =
0183       ParametersResolxMFClusterwidthProfile_Category1.getParameter<bool>("layerswitchon");
0184 
0185   edm::ParameterSet ParametersResolxMFAngleProfile = conf_.getParameter<edm::ParameterSet>("TProfResolxMFAngleProfile");
0186   layerswitchResolxMFAngleProfile = ParametersResolxMFAngleProfile.getParameter<bool>("layerswitchon");
0187 
0188   edm::ParameterSet ParametersWclusRphi = conf_.getParameter<edm::ParameterSet>("TH1WclusRphi");
0189   layerswitchWclusRphi = ParametersWclusRphi.getParameter<bool>("layerswitchon");
0190 
0191   edm::ParameterSet ParametersAdcRphi = conf_.getParameter<edm::ParameterSet>("TH1AdcRphi");
0192   layerswitchAdcRphi = ParametersAdcRphi.getParameter<bool>("layerswitchon");
0193 
0194   edm::ParameterSet ParametersResolxLFRphi = conf_.getParameter<edm::ParameterSet>("TH1ResolxLFRphi");
0195   layerswitchResolxLFRphi = ParametersResolxLFRphi.getParameter<bool>("layerswitchon");
0196 
0197   edm::ParameterSet ParametersResolxMFRphi = conf_.getParameter<edm::ParameterSet>("TH1ResolxMFRphi");
0198   layerswitchResolxMFRphi = ParametersResolxMFRphi.getParameter<bool>("layerswitchon");
0199 
0200   edm::ParameterSet ParametersResolxMFRphiwclus1 = conf_.getParameter<edm::ParameterSet>("TH1ResolxMFRphiwclus1");
0201   layerswitchResolxMFRphiwclus1 = ParametersResolxMFRphiwclus1.getParameter<bool>("layerswitchon");
0202 
0203   edm::ParameterSet ParametersResolxMFRphiwclus2 = conf_.getParameter<edm::ParameterSet>("TH1ResolxMFRphiwclus2");
0204   layerswitchResolxMFRphiwclus2 = ParametersResolxMFRphiwclus2.getParameter<bool>("layerswitchon");
0205 
0206   edm::ParameterSet ParametersResolxMFRphiwclus3 = conf_.getParameter<edm::ParameterSet>("TH1ResolxMFRphiwclus3");
0207   layerswitchResolxMFRphiwclus3 = ParametersResolxMFRphiwclus3.getParameter<bool>("layerswitchon");
0208 
0209   edm::ParameterSet ParametersResolxMFRphiwclus4 = conf_.getParameter<edm::ParameterSet>("TH1ResolxMFRphiwclus4");
0210   layerswitchResolxMFRphiwclus4 = ParametersResolxMFRphiwclus4.getParameter<bool>("layerswitchon");
0211 
0212   edm::ParameterSet ParametersResLFRphi = conf_.getParameter<edm::ParameterSet>("TH1ResLFRphi");
0213   layerswitchResLFRphi = ParametersResLFRphi.getParameter<bool>("layerswitchon");
0214 
0215   edm::ParameterSet ParametersResMFRphi = conf_.getParameter<edm::ParameterSet>("TH1ResMFRphi");
0216   layerswitchResMFRphi = ParametersResMFRphi.getParameter<bool>("layerswitchon");
0217 
0218   edm::ParameterSet ParametersResMFRphiwclus1 = conf_.getParameter<edm::ParameterSet>("TH1ResMFRphiwclus1");
0219   layerswitchResMFRphiwclus1 = ParametersResMFRphiwclus1.getParameter<bool>("layerswitchon");
0220 
0221   edm::ParameterSet ParametersResMFRphiwclus2 = conf_.getParameter<edm::ParameterSet>("TH1ResMFRphiwclus2");
0222   layerswitchResMFRphiwclus2 = ParametersResMFRphiwclus2.getParameter<bool>("layerswitchon");
0223 
0224   edm::ParameterSet ParametersResMFRphiwclus3 = conf_.getParameter<edm::ParameterSet>("TH1ResMFRphiwclus3");
0225   layerswitchResMFRphiwclus3 = ParametersResMFRphiwclus3.getParameter<bool>("layerswitchon");
0226 
0227   edm::ParameterSet ParametersResMFRphiwclus4 = conf_.getParameter<edm::ParameterSet>("TH1ResMFRphiwclus4");
0228   layerswitchResMFRphiwclus4 = ParametersResMFRphiwclus4.getParameter<bool>("layerswitchon");
0229 
0230   edm::ParameterSet ParametersPullLFRphi = conf_.getParameter<edm::ParameterSet>("TH1PullLFRphi");
0231   layerswitchPullLFRphi = ParametersPullLFRphi.getParameter<bool>("layerswitchon");
0232 
0233   edm::ParameterSet ParametersPullMFRphi = conf_.getParameter<edm::ParameterSet>("TH1PullMFRphi");
0234   layerswitchPullMFRphi = ParametersPullMFRphi.getParameter<bool>("layerswitchon");
0235 
0236   edm::ParameterSet ParametersPullMFRphiwclus1 = conf_.getParameter<edm::ParameterSet>("TH1PullMFRphiwclus1");
0237   layerswitchPullMFRphiwclus1 = ParametersPullMFRphiwclus1.getParameter<bool>("layerswitchon");
0238 
0239   edm::ParameterSet ParametersPullMFRphiwclus2 = conf_.getParameter<edm::ParameterSet>("TH1PullMFRphiwclus2");
0240   layerswitchPullMFRphiwclus2 = ParametersPullMFRphiwclus2.getParameter<bool>("layerswitchon");
0241 
0242   edm::ParameterSet ParametersPullMFRphiwclus3 = conf_.getParameter<edm::ParameterSet>("TH1PullMFRphiwclus3");
0243   layerswitchPullMFRphiwclus3 = ParametersPullMFRphiwclus3.getParameter<bool>("layerswitchon");
0244 
0245   edm::ParameterSet ParametersPullMFRphiwclus4 = conf_.getParameter<edm::ParameterSet>("TH1PullMFRphiwclus4");
0246   layerswitchPullMFRphiwclus4 = ParametersPullMFRphiwclus4.getParameter<bool>("layerswitchon");
0247 
0248   edm::ParameterSet ParametersTrackangleRphi = conf_.getParameter<edm::ParameterSet>("TH1TrackangleRphi");
0249   layerswitchTrackangleRphi = ParametersTrackangleRphi.getParameter<bool>("layerswitchon");
0250 
0251   edm::ParameterSet ParametersTrackanglebetaRphi = conf_.getParameter<edm::ParameterSet>("TH1TrackanglebetaRphi");
0252   layerswitchTrackanglebetaRphi = ParametersTrackanglebetaRphi.getParameter<bool>("layerswitchon");
0253 
0254   edm::ParameterSet ParametersTrackangle2Rphi = conf_.getParameter<edm::ParameterSet>("TH1Trackangle2Rphi");
0255   layerswitchTrackangle2Rphi = ParametersTrackangle2Rphi.getParameter<bool>("layerswitchon");
0256 
0257   edm::ParameterSet ParametersPullTrackangleProfileRphi =
0258       conf_.getParameter<edm::ParameterSet>("TProfPullTrackangleProfileRphi");
0259   layerswitchPullTrackangleProfileRphi = ParametersPullTrackangleProfileRphi.getParameter<bool>("layerswitchon");
0260 
0261   edm::ParameterSet ParametersPullTrackangle2DRphi = conf_.getParameter<edm::ParameterSet>("TH1PullTrackangle2DRphi");
0262   layerswitchPullTrackangle2DRphi = ParametersPullTrackangle2DRphi.getParameter<bool>("layerswitchon");
0263 
0264   edm::ParameterSet ParametersTrackwidthRphi = conf_.getParameter<edm::ParameterSet>("TH1TrackwidthRphi");
0265   layerswitchTrackwidthRphi = ParametersTrackwidthRphi.getParameter<bool>("layerswitchon");
0266 
0267   edm::ParameterSet ParametersExpectedwidthRphi = conf_.getParameter<edm::ParameterSet>("TH1ExpectedwidthRphi");
0268   layerswitchExpectedwidthRphi = ParametersExpectedwidthRphi.getParameter<bool>("layerswitchon");
0269 
0270   edm::ParameterSet ParametersClusterwidthRphi = conf_.getParameter<edm::ParameterSet>("TH1ClusterwidthRphi");
0271   layerswitchClusterwidthRphi = ParametersClusterwidthRphi.getParameter<bool>("layerswitchon");
0272 
0273   edm::ParameterSet ParametersCategoryRphi = conf_.getParameter<edm::ParameterSet>("TH1CategoryRphi");
0274   layerswitchCategoryRphi = ParametersCategoryRphi.getParameter<bool>("layerswitchon");
0275 
0276   edm::ParameterSet ParametersPullTrackwidthProfileRphi =
0277       conf_.getParameter<edm::ParameterSet>("TProfPullTrackwidthProfileRphi");
0278   layerswitchPullTrackwidthProfileRphi = ParametersPullTrackwidthProfileRphi.getParameter<bool>("layerswitchon");
0279 
0280   edm::ParameterSet ParametersPullTrackwidthProfileRphiwclus1 =
0281       conf_.getParameter<edm::ParameterSet>("TProfPullTrackwidthProfileRphiwclus1");
0282   layerswitchPullTrackwidthProfileRphiwclus1 =
0283       ParametersPullTrackwidthProfileRphiwclus1.getParameter<bool>("layerswitchon");
0284 
0285   edm::ParameterSet ParametersPullTrackwidthProfileRphiwclus2 =
0286       conf_.getParameter<edm::ParameterSet>("TProfPullTrackwidthProfileRphiwclus2");
0287   layerswitchPullTrackwidthProfileRphiwclus2 =
0288       ParametersPullTrackwidthProfileRphiwclus2.getParameter<bool>("layerswitchon");
0289 
0290   edm::ParameterSet ParametersPullTrackwidthProfileRphiwclus3 =
0291       conf_.getParameter<edm::ParameterSet>("TProfPullTrackwidthProfileRphiwclus3");
0292   layerswitchPullTrackwidthProfileRphiwclus3 =
0293       ParametersPullTrackwidthProfileRphiwclus3.getParameter<bool>("layerswitchon");
0294 
0295   edm::ParameterSet ParametersPullTrackwidthProfileRphiwclus4 =
0296       conf_.getParameter<edm::ParameterSet>("TProfPullTrackwidthProfileRphiwclus4");
0297   layerswitchPullTrackwidthProfileRphiwclus4 =
0298       ParametersPullTrackwidthProfileRphiwclus4.getParameter<bool>("layerswitchon");
0299 
0300   edm::ParameterSet ParametersPullTrackwidthProfileCategory1Rphi =
0301       conf_.getParameter<edm::ParameterSet>("TProfPullTrackwidthProfileCategory1Rphi");
0302   layerswitchPullTrackwidthProfileCategory1Rphi =
0303       ParametersPullTrackwidthProfileCategory1Rphi.getParameter<bool>("layerswitchon");
0304 
0305   edm::ParameterSet ParametersPullTrackwidthProfileCategory2Rphi =
0306       conf_.getParameter<edm::ParameterSet>("TProfPullTrackwidthProfileCategory2Rphi");
0307   layerswitchPullTrackwidthProfileCategory2Rphi =
0308       ParametersPullTrackwidthProfileCategory2Rphi.getParameter<bool>("layerswitchon");
0309 
0310   edm::ParameterSet ParametersPullTrackwidthProfileCategory3Rphi =
0311       conf_.getParameter<edm::ParameterSet>("TProfPullTrackwidthProfileCategory3Rphi");
0312   layerswitchPullTrackwidthProfileCategory3Rphi =
0313       ParametersPullTrackwidthProfileCategory3Rphi.getParameter<bool>("layerswitchon");
0314 
0315   edm::ParameterSet ParametersPullTrackwidthProfileCategory4Rphi =
0316       conf_.getParameter<edm::ParameterSet>("TProfPullTrackwidthProfileCategory4Rphi");
0317   layerswitchPullTrackwidthProfileCategory4Rphi =
0318       ParametersPullTrackwidthProfileCategory4Rphi.getParameter<bool>("layerswitchon");
0319 
0320   edm::ParameterSet ParametersResolxMFTrackwidthProfileRphi =
0321       conf_.getParameter<edm::ParameterSet>("TProfResolxMFTrackwidthProfileRphi");
0322   layerswitchResolxMFTrackwidthProfileRphi =
0323       ParametersResolxMFTrackwidthProfileRphi.getParameter<bool>("layerswitchon");
0324 
0325   edm::ParameterSet ParametersResolxMFTrackwidthProfileWclus1Rphi =
0326       conf_.getParameter<edm::ParameterSet>("TProfResolxMFTrackwidthProfileWclus1Rphi");
0327   layerswitchResolxMFTrackwidthProfileWclus1Rphi =
0328       ParametersResolxMFTrackwidthProfileWclus1Rphi.getParameter<bool>("layerswitchon");
0329 
0330   edm::ParameterSet ParametersResolxMFTrackwidthProfileWclus2Rphi =
0331       conf_.getParameter<edm::ParameterSet>("TProfResolxMFTrackwidthProfileWclus2Rphi");
0332   layerswitchResolxMFTrackwidthProfileWclus2Rphi =
0333       ParametersResolxMFTrackwidthProfileWclus2Rphi.getParameter<bool>("layerswitchon");
0334 
0335   edm::ParameterSet ParametersResolxMFTrackwidthProfileWclus3Rphi =
0336       conf_.getParameter<edm::ParameterSet>("TProfResolxMFTrackwidthProfileWclus3Rphi");
0337   layerswitchResolxMFTrackwidthProfileWclus3Rphi =
0338       ParametersResolxMFTrackwidthProfileWclus3Rphi.getParameter<bool>("layerswitchon");
0339 
0340   edm::ParameterSet ParametersResolxMFTrackwidthProfileWclus4Rphi =
0341       conf_.getParameter<edm::ParameterSet>("TProfResolxMFTrackwidthProfileWclus4Rphi");
0342   layerswitchResolxMFTrackwidthProfileWclus4Rphi =
0343       ParametersResolxMFTrackwidthProfileWclus4Rphi.getParameter<bool>("layerswitchon");
0344 
0345   edm::ParameterSet ParametersResMFTrackwidthProfileWclus1Rphi =
0346       conf_.getParameter<edm::ParameterSet>("TProfResMFTrackwidthProfileWclus1Rphi");
0347   layerswitchResMFTrackwidthProfileWclus1Rphi =
0348       ParametersResMFTrackwidthProfileWclus1Rphi.getParameter<bool>("layerswitchon");
0349 
0350   edm::ParameterSet ParametersResMFTrackwidthProfileWclus2Rphi =
0351       conf_.getParameter<edm::ParameterSet>("TProfResMFTrackwidthProfileWclus2Rphi");
0352   layerswitchResMFTrackwidthProfileWclus2Rphi =
0353       ParametersResMFTrackwidthProfileWclus2Rphi.getParameter<bool>("layerswitchon");
0354 
0355   edm::ParameterSet ParametersResMFTrackwidthProfileWclus3Rphi =
0356       conf_.getParameter<edm::ParameterSet>("TProfResMFTrackwidthProfileWclus3Rphi");
0357   layerswitchResMFTrackwidthProfileWclus3Rphi =
0358       ParametersResMFTrackwidthProfileWclus3Rphi.getParameter<bool>("layerswitchon");
0359 
0360   edm::ParameterSet ParametersResMFTrackwidthProfileWclus4Rphi =
0361       conf_.getParameter<edm::ParameterSet>("TProfResMFTrackwidthProfileWclus4Rphi");
0362   layerswitchResMFTrackwidthProfileWclus4Rphi =
0363       ParametersResMFTrackwidthProfileWclus4Rphi.getParameter<bool>("layerswitchon");
0364 
0365   edm::ParameterSet ParametersResolxMFTrackwidthProfileCategory1Rphi =
0366       conf_.getParameter<edm::ParameterSet>("TProfResolxMFTrackwidthProfileCategory1Rphi");
0367   layerswitchResolxMFTrackwidthProfileCategory1Rphi =
0368       ParametersResolxMFTrackwidthProfileCategory1Rphi.getParameter<bool>("layerswitchon");
0369 
0370   edm::ParameterSet ParametersResolxMFTrackwidthProfileCategory2Rphi =
0371       conf_.getParameter<edm::ParameterSet>("TProfResolxMFTrackwidthProfileCategory2Rphi");
0372   layerswitchResolxMFTrackwidthProfileCategory2Rphi =
0373       ParametersResolxMFTrackwidthProfileCategory2Rphi.getParameter<bool>("layerswitchon");
0374 
0375   edm::ParameterSet ParametersResolxMFTrackwidthProfileCategory3Rphi =
0376       conf_.getParameter<edm::ParameterSet>("TProfResolxMFTrackwidthProfileCategory3Rphi");
0377   layerswitchResolxMFTrackwidthProfileCategory3Rphi =
0378       ParametersResolxMFTrackwidthProfileCategory3Rphi.getParameter<bool>("layerswitchon");
0379 
0380   edm::ParameterSet ParametersResolxMFTrackwidthProfileCategory4Rphi =
0381       conf_.getParameter<edm::ParameterSet>("TProfResolxMFTrackwidthProfileCategory4Rphi");
0382   layerswitchResolxMFTrackwidthProfileCategory4Rphi =
0383       ParametersResolxMFTrackwidthProfileCategory4Rphi.getParameter<bool>("layerswitchon");
0384 
0385   edm::ParameterSet ParametersResolxMFAngleProfileRphi =
0386       conf_.getParameter<edm::ParameterSet>("TProfResolxMFAngleProfileRphi");
0387   layerswitchResolxMFAngleProfileRphi = ParametersResolxMFAngleProfileRphi.getParameter<bool>("layerswitchon");
0388 
0389   edm::ParameterSet ParametersResolxMFClusterwidthProfileCategory1Rphi =
0390       conf_.getParameter<edm::ParameterSet>("TProfResolxMFClusterwidthProfileCategory1Rphi");
0391   layerswitchResolxMFClusterwidthProfileCategory1Rphi =
0392       ParametersResolxMFClusterwidthProfileCategory1Rphi.getParameter<bool>("layerswitchon");
0393 
0394   edm::ParameterSet ParametersrapidityResProfilewclus1 =
0395       conf_.getParameter<edm::ParameterSet>("TProfrapidityResProfilewclus1");
0396   layerswitchrapidityResProfilewclus1 = ParametersrapidityResProfilewclus1.getParameter<bool>("layerswitchon");
0397 
0398   edm::ParameterSet ParametersrapidityResProfilewclus2 =
0399       conf_.getParameter<edm::ParameterSet>("TProfrapidityResProfilewclus2");
0400   layerswitchrapidityResProfilewclus2 = ParametersrapidityResProfilewclus2.getParameter<bool>("layerswitchon");
0401 
0402   edm::ParameterSet ParametersrapidityResProfilewclus3 =
0403       conf_.getParameter<edm::ParameterSet>("TProfrapidityResProfilewclus3");
0404   layerswitchrapidityResProfilewclus3 = ParametersrapidityResProfilewclus3.getParameter<bool>("layerswitchon");
0405 
0406   edm::ParameterSet ParametersrapidityResProfilewclus4 =
0407       conf_.getParameter<edm::ParameterSet>("TProfrapidityResProfilewclus4");
0408   layerswitchrapidityResProfilewclus4 = ParametersrapidityResProfilewclus4.getParameter<bool>("layerswitchon");
0409 
0410   edm::ParameterSet ParametersWclusSas = conf_.getParameter<edm::ParameterSet>("TH1WclusSas");
0411   layerswitchWclusSas = ParametersWclusSas.getParameter<bool>("layerswitchon");
0412 
0413   edm::ParameterSet ParametersAdcSas = conf_.getParameter<edm::ParameterSet>("TH1AdcSas");
0414   layerswitchAdcSas = ParametersAdcSas.getParameter<bool>("layerswitchon");
0415 
0416   edm::ParameterSet ParametersResolxLFSas = conf_.getParameter<edm::ParameterSet>("TH1ResolxLFSas");
0417   layerswitchResolxLFSas = ParametersResolxLFSas.getParameter<bool>("layerswitchon");
0418 
0419   edm::ParameterSet ParametersResolxMFSas = conf_.getParameter<edm::ParameterSet>("TH1ResolxMFSas");
0420   layerswitchResolxMFSas = ParametersResolxMFSas.getParameter<bool>("layerswitchon");
0421 
0422   edm::ParameterSet ParametersResLFSas = conf_.getParameter<edm::ParameterSet>("TH1ResLFSas");
0423   layerswitchResLFSas = ParametersResLFSas.getParameter<bool>("layerswitchon");
0424 
0425   edm::ParameterSet ParametersResMFSas = conf_.getParameter<edm::ParameterSet>("TH1ResMFSas");
0426   layerswitchResMFSas = ParametersResMFSas.getParameter<bool>("layerswitchon");
0427 
0428   edm::ParameterSet ParametersPullLFSas = conf_.getParameter<edm::ParameterSet>("TH1PullLFSas");
0429   layerswitchPullLFSas = ParametersPullLFSas.getParameter<bool>("layerswitchon");
0430 
0431   edm::ParameterSet ParametersPullMFSas = conf_.getParameter<edm::ParameterSet>("TH1PullMFSas");
0432   layerswitchPullMFSas = ParametersPullMFSas.getParameter<bool>("layerswitchon");
0433 
0434   edm::ParameterSet ParametersTrackangleSas = conf_.getParameter<edm::ParameterSet>("TH1TrackangleSas");
0435   layerswitchTrackangleSas = ParametersTrackangleSas.getParameter<bool>("layerswitchon");
0436 
0437   edm::ParameterSet ParametersTrackanglebetaSas = conf_.getParameter<edm::ParameterSet>("TH1TrackanglebetaSas");
0438   layerswitchTrackanglebetaSas = ParametersTrackanglebetaSas.getParameter<bool>("layerswitchon");
0439 
0440   edm::ParameterSet ParametersPullTrackangleProfileSas =
0441       conf_.getParameter<edm::ParameterSet>("TProfPullTrackangleProfileSas");
0442   layerswitchPullTrackangleProfileSas = ParametersPullTrackangleProfileSas.getParameter<bool>("layerswitchon");
0443 
0444   edm::ParameterSet ParametersTrackwidthSas = conf_.getParameter<edm::ParameterSet>("TH1TrackwidthSas");
0445   layerswitchTrackwidthSas = ParametersTrackwidthSas.getParameter<bool>("layerswitchon");
0446 
0447   edm::ParameterSet ParametersExpectedwidthSas = conf_.getParameter<edm::ParameterSet>("TH1ExpectedwidthSas");
0448   layerswitchExpectedwidthSas = ParametersExpectedwidthSas.getParameter<bool>("layerswitchon");
0449 
0450   edm::ParameterSet ParametersClusterwidthSas = conf_.getParameter<edm::ParameterSet>("TH1ClusterwidthSas");
0451   layerswitchClusterwidthSas = ParametersClusterwidthSas.getParameter<bool>("layerswitchon");
0452 
0453   edm::ParameterSet ParametersCategorySas = conf_.getParameter<edm::ParameterSet>("TH1CategorySas");
0454   layerswitchCategorySas = ParametersCategorySas.getParameter<bool>("layerswitchon");
0455 
0456   edm::ParameterSet ParametersPullTrackwidthProfileSas =
0457       conf_.getParameter<edm::ParameterSet>("TProfPullTrackwidthProfileSas");
0458   layerswitchPullTrackwidthProfileSas = ParametersPullTrackwidthProfileSas.getParameter<bool>("layerswitchon");
0459 
0460   edm::ParameterSet ParametersPullTrackwidthProfileCategory1Sas =
0461       conf_.getParameter<edm::ParameterSet>("TProfPullTrackwidthProfileCategory1Sas");
0462   layerswitchPullTrackwidthProfileCategory1Sas =
0463       ParametersPullTrackwidthProfileCategory1Sas.getParameter<bool>("layerswitchon");
0464 
0465   edm::ParameterSet ParametersPullTrackwidthProfileCategory2Sas =
0466       conf_.getParameter<edm::ParameterSet>("TProfPullTrackwidthProfileCategory2Sas");
0467   layerswitchPullTrackwidthProfileCategory2Sas =
0468       ParametersPullTrackwidthProfileCategory2Sas.getParameter<bool>("layerswitchon");
0469 
0470   edm::ParameterSet ParametersPullTrackwidthProfileCategory3Sas =
0471       conf_.getParameter<edm::ParameterSet>("TProfPullTrackwidthProfileCategory3Sas");
0472   layerswitchPullTrackwidthProfileCategory3Sas =
0473       ParametersPullTrackwidthProfileCategory3Sas.getParameter<bool>("layerswitchon");
0474 
0475   edm::ParameterSet ParametersPullTrackwidthProfileCategory4Sas =
0476       conf_.getParameter<edm::ParameterSet>("TProfPullTrackwidthProfileCategory4Sas");
0477   layerswitchPullTrackwidthProfileCategory4Sas =
0478       ParametersPullTrackwidthProfileCategory4Sas.getParameter<bool>("layerswitchon");
0479 
0480   edm::ParameterSet ParametersResolxMFTrackwidthProfileSas =
0481       conf_.getParameter<edm::ParameterSet>("TProfResolxMFTrackwidthProfileSas");
0482   layerswitchResolxMFTrackwidthProfileSas = ParametersResolxMFTrackwidthProfileSas.getParameter<bool>("layerswitchon");
0483 
0484   edm::ParameterSet ParametersResolxMFTrackwidthProfileCategory1Sas =
0485       conf_.getParameter<edm::ParameterSet>("TProfResolxMFTrackwidthProfileCategory1Sas");
0486   layerswitchResolxMFTrackwidthProfileCategory1Sas =
0487       ParametersResolxMFTrackwidthProfileCategory1Sas.getParameter<bool>("layerswitchon");
0488 
0489   edm::ParameterSet ParametersResolxMFTrackwidthProfileCategory2Sas =
0490       conf_.getParameter<edm::ParameterSet>("TProfResolxMFTrackwidthProfileCategory2Sas");
0491   layerswitchResolxMFTrackwidthProfileCategory2Sas =
0492       ParametersResolxMFTrackwidthProfileCategory2Sas.getParameter<bool>("layerswitchon");
0493 
0494   edm::ParameterSet ParametersResolxMFTrackwidthProfileCategory3Sas =
0495       conf_.getParameter<edm::ParameterSet>("TProfResolxMFTrackwidthProfileCategory3Sas");
0496   layerswitchResolxMFTrackwidthProfileCategory3Sas =
0497       ParametersResolxMFTrackwidthProfileCategory3Sas.getParameter<bool>("layerswitchon");
0498 
0499   edm::ParameterSet ParametersResolxMFTrackwidthProfileCategory4Sas =
0500       conf_.getParameter<edm::ParameterSet>("TProfResolxMFTrackwidthProfileCategory4Sas");
0501   layerswitchResolxMFTrackwidthProfileCategory4Sas =
0502       ParametersResolxMFTrackwidthProfileCategory4Sas.getParameter<bool>("layerswitchon");
0503 
0504   edm::ParameterSet ParametersResolxMFAngleProfileSas =
0505       conf_.getParameter<edm::ParameterSet>("TProfResolxMFAngleProfileSas");
0506   layerswitchResolxMFAngleProfileSas = ParametersResolxMFAngleProfileSas.getParameter<bool>("layerswitchon");
0507 
0508   edm::ParameterSet ParametersResolxMFClusterwidthProfileCategory1Sas =
0509       conf_.getParameter<edm::ParameterSet>("TProfResolxMFClusterwidthProfileCategory1Sas");
0510   layerswitchResolxMFClusterwidthProfileCategory1Sas =
0511       ParametersResolxMFClusterwidthProfileCategory1Sas.getParameter<bool>("layerswitchon");
0512 
0513   edm::ParameterSet ParametersPosxMatched = conf_.getParameter<edm::ParameterSet>("TH1PosxMatched");
0514   layerswitchPosxMatched = ParametersPosxMatched.getParameter<bool>("layerswitchon");
0515 
0516   edm::ParameterSet ParametersPosyMatched = conf_.getParameter<edm::ParameterSet>("TH1PosyMatched");
0517   layerswitchPosyMatched = ParametersPosyMatched.getParameter<bool>("layerswitchon");
0518 
0519   edm::ParameterSet ParametersResolxMatched = conf_.getParameter<edm::ParameterSet>("TH1ResolxMatched");
0520   layerswitchResolxMatched = ParametersResolxMatched.getParameter<bool>("layerswitchon");
0521 
0522   edm::ParameterSet ParametersResolyMatched = conf_.getParameter<edm::ParameterSet>("TH1ResolyMatched");
0523   layerswitchResolyMatched = ParametersResolyMatched.getParameter<bool>("layerswitchon");
0524 
0525   edm::ParameterSet ParametersResxMatched = conf_.getParameter<edm::ParameterSet>("TH1ResxMatched");
0526   layerswitchResxMatched = ParametersResxMatched.getParameter<bool>("layerswitchon");
0527 
0528   edm::ParameterSet ParametersResyMatched = conf_.getParameter<edm::ParameterSet>("TH1ResyMatched");
0529   layerswitchResyMatched = ParametersResyMatched.getParameter<bool>("layerswitchon");
0530 
0531   edm::ParameterSet ParametersPullxMatched = conf_.getParameter<edm::ParameterSet>("TH1PullxMatched");
0532   layerswitchPullxMatched = ParametersPullxMatched.getParameter<bool>("layerswitchon");
0533 
0534   edm::ParameterSet ParametersPullyMatched = conf_.getParameter<edm::ParameterSet>("TH1PullyMatched");
0535   layerswitchPullyMatched = ParametersPullyMatched.getParameter<bool>("layerswitchon");
0536 }
0537 
0538 //Destructor
0539 SiStripTrackingRecHitsValid::~SiStripTrackingRecHitsValid() {}
0540 //--------------------------------------------------------------------------------------------
0541 void SiStripTrackingRecHitsValid::bookHistograms(DQMStore::IBooker &ibooker,
0542                                                  const edm::Run &run,
0543                                                  const edm::EventSetup &es) {
0544   if (watchSiStripDetCablingRcd_.check(es)) {
0545     edm::LogInfo("SiStripRecHitsValid") << "SiStripRecHitsValid::beginRun: "
0546                                         << " Creating MEs for new Cabling ";
0547 
0548     createMEs(ibooker, es);
0549   }
0550 }
0551 
0552 // Functions that gets called by framework every event
0553 void SiStripTrackingRecHitsValid::analyze(const edm::Event &e, const edm::EventSetup &es) {
0554   LogInfo("EventInfo") << " Run = " << e.id().run() << " Event = " << e.id().event();
0555   //cout  << " Run = " << e.id().run() << " Event = " << e.id().event() << endl;
0556 
0557   int isrechitrphi = 0;
0558   int isrechitsas = 0;
0559   int isrechitmatched = 0;
0560 
0561   DetId detid;
0562   uint32_t myid;
0563 
0564   TrackerHitAssociator associate(e, trackerHitAssociatorConfig_);
0565 
0566   //Retrieve tracker topology from geometry
0567   const TrackerTopology *const tTopo = &es.getData(m_topoToken);
0568   const TrackerGeometry &tracker = es.getData(m_geomToken);
0569   const auto &stripcpe = &es.getData(m_stripCPEToken);
0570 
0571   // Mangano's
0572 
0573   edm::Handle<std::vector<reco::Track> > trackCollectionHandle;
0574   e.getByToken(tracksInputToken_, trackCollectionHandle);
0575 
0576   edm::LogVerbatim("TrajectoryAnalyzer") << "trackColl->size(): " << trackCollectionHandle->size();
0577   auto const &tracks = *trackCollectionHandle;
0578   for (auto const &track : tracks) {
0579     if (track.pt() < 0.5)
0580       continue;
0581     edm::LogVerbatim("TrajectoryAnalyzer") << "this track has " << track.found() << " valid hits";
0582 
0583     auto const &trajParams = track.extra()->trajParams();
0584     assert(trajParams.size() == track.recHitsSize());
0585     auto hb = track.recHitsBegin();
0586     for (unsigned int h = 0; h < track.recHitsSize(); h++) {
0587       auto recHit = *(hb + h);
0588       if (!recHit->isValid())
0589         continue;
0590       auto ldir = trajParams[h].direction();
0591       auto gmom = recHit->surface()->toGlobal(trajParams[h].momentum());
0592       if (gmom.perp() < 0.5)
0593         continue;  // redundant...
0594       {
0595         auto thit2 = recHit;
0596         DetId detid2 = thit2->geographicalId();
0597         const SiStripMatchedRecHit2D *matchedhit = dynamic_cast<const SiStripMatchedRecHit2D *>(thit2);
0598         const SiStripRecHit2D *hit2d = dynamic_cast<const SiStripRecHit2D *>(thit2);
0599         const SiStripRecHit1D *hit1d = dynamic_cast<const SiStripRecHit1D *>(thit2);
0600 
0601         auto thit = thit2;
0602 
0603         detid = (thit)->geographicalId();
0604         myid = detid.rawId();
0605         //Here due to the fact that the SiStripHistoId::getSubdetid complains when
0606         //a subdet of 1 or 2 appears we add an if statement.
0607         if (detid.subdetId() == 1 || detid.subdetId() == 2) {
0608           continue;
0609         }
0610         SiStripHistoId hidmanager;
0611         std::string label = hidmanager.getSubdetid(myid, tTopo, true);
0612         // std::cout<< "label " << label << " and id " << detid.subdetId() << std::endl;
0613 
0614         StripSubdetector StripSubdet = (StripSubdetector)detid;
0615         //Variable to define the case we are dealing with
0616         std::string matchedmonorstereo;
0617 
0618         isrechitmatched = 0;
0619 
0620         if (matchedhit) {
0621           isrechitmatched = 1;
0622           const GluedGeomDet *gluedDet = (const GluedGeomDet *)tracker.idToDet(matchedhit->geographicalId());
0623           //Analysis
0624           rechitanalysis_matched(ldir, thit2, gluedDet, associate, stripcpe, MatchStatus::matched);
0625           // rechitmatched.push_back(rechitpro);
0626         }
0627 
0628         std::map<std::string, StereoAndMatchedMEs>::iterator iStereoAndMatchedME = StereoAndMatchedMEsMap.find(label);
0629 
0630         //Filling Histograms for Matched hits
0631 
0632         if (isrechitmatched) {
0633           if (iStereoAndMatchedME != StereoAndMatchedMEsMap.end()) {
0634             fillME(iStereoAndMatchedME->second.mePosxMatched, rechitpro.x);
0635             fillME(iStereoAndMatchedME->second.mePosyMatched, rechitpro.y);
0636             fillME(iStereoAndMatchedME->second.meResolxMatched, sqrt(rechitpro.resolxx));
0637             fillME(iStereoAndMatchedME->second.meResolyMatched, sqrt(rechitpro.resolyy));
0638             fillME(iStereoAndMatchedME->second.meResxMatched, rechitpro.resx);
0639             fillME(iStereoAndMatchedME->second.meResyMatched, rechitpro.resy);
0640             fillME(iStereoAndMatchedME->second.mePullxMatched, rechitpro.pullx);
0641             fillME(iStereoAndMatchedME->second.mePullyMatched, rechitpro.pully);
0642           }
0643         }
0644 
0645         //Reset Variables here for the current event
0646         isrechitrphi = 0;
0647         isrechitsas = 0;
0648 
0649         ///////////////////////////////////////////////////////
0650         // simple hits from matched hits
0651         ///////////////////////////////////////////////////////
0652 
0653         if (gmom.transverse() != 0) {
0654           track_rapidity = gmom.eta();
0655         } else {
0656           track_rapidity = -999.0;
0657         }
0658 
0659         if (matchedhit) {
0660           auto hm = matchedhit->monoHit();
0661           const SiStripRecHit2D *monohit = &hm;
0662           //      const GeomDetUnit * monodet=gdet->monoDet();
0663           GluedGeomDet *gdet = (GluedGeomDet *)tracker.idToDet(matchedhit->geographicalId());
0664 
0665           if (monohit) {
0666             isrechitrphi = 1;
0667 
0668             //Analysis
0669             rechitanalysis_matched(ldir, thit2, gdet, associate, stripcpe, MatchStatus::monoHit);
0670           }
0671 
0672           auto s = matchedhit->stereoHit();
0673           const SiStripRecHit2D *stereohit = &s;
0674 
0675           if (stereohit) {
0676             isrechitsas = 1;
0677 
0678             //Analysis
0679             rechitanalysis_matched(ldir, thit2, gdet, associate, stripcpe, MatchStatus::stereoHit);
0680           }
0681         }
0682 
0683         if (hit1d) {
0684           // simple hits are mono or stereo
0685           //      cout<<"simple hit"<<endl;
0686           if (StripSubdet.stereo()) {
0687             //cout<<"simple hit stereo"<<endl;
0688             isrechitsas = 1;
0689 
0690             const GeomDetUnit *det = tracker.idToDetUnit(detid2);
0691             const StripGeomDetUnit *stripdet = (const StripGeomDetUnit *)(det);
0692 
0693             //Analysis for hit1d stereo
0694             rechitanalysis(ldir, thit2, stripdet, stripcpe, associate, true);
0695           } else {
0696             isrechitrphi = 1;
0697             //      cout<<"simple hit mono"<<endl;
0698 
0699             const GeomDetUnit *det = tracker.idToDetUnit(detid2);
0700             const StripGeomDetUnit *stripdet = (const StripGeomDetUnit *)(det);
0701 
0702             //Analysis for hit1d mono
0703             rechitanalysis(ldir, thit2, stripdet, stripcpe, associate, true);
0704           }
0705         }
0706 
0707         if (hit2d) {
0708           // simple hits are mono or stereo
0709           //      cout<<"simple hit"<<endl;
0710           if (StripSubdet.stereo()) {
0711             //cout<<"simple hit stereo"<<endl;
0712             isrechitsas = 1;
0713 
0714             const GeomDetUnit *det = tracker.idToDetUnit(detid2);
0715             const StripGeomDetUnit *stripdet = (const StripGeomDetUnit *)(det);
0716 
0717             //Analysis for hit2d stereo
0718             rechitanalysis(ldir, thit2, stripdet, stripcpe, associate, false);
0719 
0720           } else {
0721             isrechitrphi = 1;
0722             //      cout<<"simple hit mono"<<endl;
0723 
0724             const GeomDetUnit *det = tracker.idToDetUnit(detid2);
0725             const StripGeomDetUnit *stripdet = (const StripGeomDetUnit *)(det);
0726 
0727             //Analysis for hit2d mono
0728             rechitanalysis(ldir, thit2, stripdet, stripcpe, associate, false);
0729           }
0730         }
0731 
0732         //------------------------------------------------------------------------------------------------------------------------------------------------------
0733 
0734         //Filling Histograms for simple hits
0735         //cout<<"isrechitrphi,isrechitsas = "<<isrechitrphi<<","<<isrechitsas<<endl;
0736 
0737         std::map<std::string, LayerMEs>::iterator iLayerME = LayerMEsMap.find(label);
0738         if (isrechitrphi) {
0739           fillME(simplehitsMEs.meCategory, rechitpro.category);
0740           fillME(simplehitsMEs.meTrackwidth, rechitpro.trackwidth);
0741           fillME(simplehitsMEs.meExpectedwidth, rechitpro.expectedwidth);
0742           fillME(simplehitsMEs.meClusterwidth, rechitpro.clusiz);
0743           fillME(simplehitsMEs.meTrackanglealpha, rechitpro.trackangle);
0744           fillME(simplehitsMEs.meTrackanglebeta, rechitpro.trackanglebeta);
0745 
0746           fillME(simplehitsMEs.meResolxMFAngleProfile, rechitpro.trackangle, sqrt(rechitpro.resolxxMF));
0747           fillME(simplehitsMEs.meResolxMFTrackwidthProfile, rechitpro.trackwidth, sqrt(rechitpro.resolxxMF));
0748 
0749           if (rechitpro.clusiz == 1) {
0750             fillME(simplehitsMEs.meResolxMFTrackwidthProfileWClus1, rechitpro.trackwidth, sqrt(rechitpro.resolxxMF));
0751             fillME(simplehitsMEs.meResMFTrackwidthProfileWClus1, rechitpro.trackwidth, fabs(rechitpro.resxMF));
0752           } else if (rechitpro.clusiz == 2) {
0753             fillME(simplehitsMEs.meResolxMFTrackwidthProfileWClus2, rechitpro.trackwidth, sqrt(rechitpro.resolxxMF));
0754             fillME(simplehitsMEs.meResMFTrackwidthProfileWClus2, rechitpro.trackwidth, fabs(rechitpro.resxMF));
0755             fillME(simplehitsMEs.meResMFTrackwidthProfileWClus21, rechitpro.trackwidth, fabs(rechitpro.resxMF));
0756             fillME(simplehitsMEs.meResMFTrackwidthProfileWClus22, rechitpro.trackwidth, fabs(rechitpro.resxMF));
0757             fillME(simplehitsMEs.meResMFTrackwidthProfileWClus23, rechitpro.trackwidth, fabs(rechitpro.resxMF));
0758           } else if (rechitpro.clusiz == 3) {
0759             fillME(simplehitsMEs.meResolxMFTrackwidthProfileWClus3, rechitpro.trackwidth, sqrt(rechitpro.resolxxMF));
0760             fillME(simplehitsMEs.meResMFTrackwidthProfileWClus3, rechitpro.trackwidth, fabs(rechitpro.resxMF));
0761           } else if (rechitpro.clusiz == 4) {
0762             fillME(simplehitsMEs.meResolxMFTrackwidthProfileWClus4, rechitpro.trackwidth, sqrt(rechitpro.resolxxMF));
0763             fillME(simplehitsMEs.meResMFTrackwidthProfileWClus4, rechitpro.trackwidth, fabs(rechitpro.resxMF));
0764           }
0765 
0766           if (rechitpro.category == 1) {
0767             fillME(simplehitsMEs.meResolxMFTrackwidthProfileCategory1, rechitpro.trackwidth, sqrt(rechitpro.resolxxMF));
0768             fillME(simplehitsMEs.meResolxMFClusterwidthProfileCategory1, rechitpro.clusiz, sqrt(rechitpro.resolxxMF));
0769           } else if (rechitpro.category == 2) {
0770             fillME(simplehitsMEs.meResolxMFTrackwidthProfileCategory2, rechitpro.trackwidth, sqrt(rechitpro.resolxxMF));
0771           } else if (rechitpro.category == 3) {
0772             fillME(simplehitsMEs.meResolxMFTrackwidthProfileCategory3, rechitpro.trackwidth, sqrt(rechitpro.resolxxMF));
0773           } else if (rechitpro.category == 4) {
0774             fillME(simplehitsMEs.meResolxMFTrackwidthProfileCategory4, rechitpro.trackwidth, sqrt(rechitpro.resolxxMF));
0775           }
0776 
0777           fillME(simplehitsMEs.meResolxMF, sqrt(rechitpro.resolxxMF));
0778           fillME(simplehitsMEs.meResolxLF, sqrt(rechitpro.resolxx));
0779           fillME(simplehitsMEs.meResMF, rechitpro.resxMF);
0780           fillME(simplehitsMEs.meResLF, rechitpro.resx);
0781           fillME(simplehitsMEs.mePullMF, rechitpro.pullxMF);
0782           fillME(simplehitsMEs.mePullLF, rechitpro.pullx);
0783 
0784           if (iLayerME != LayerMEsMap.end()) {
0785             fillME(iLayerME->second.meWclusRphi, rechitpro.clusiz);
0786             fillME(iLayerME->second.meAdcRphi, rechitpro.cluchg);
0787             fillME(iLayerME->second.meResolxLFRphi, sqrt(rechitpro.resolxx));
0788             fillME(iLayerME->second.meResolxMFRphi, sqrt(rechitpro.resolxxMF));
0789 
0790             if ((min(rechitpro.clusiz, 4) - 1) == 1) {
0791               fillME(iLayerME->second.meResolxMFRphiwclus1, sqrt(rechitpro.resolxxMF));
0792             }
0793             if ((min(rechitpro.clusiz, 4) - 1) == 2) {
0794               fillME(iLayerME->second.meResolxMFRphiwclus2, sqrt(rechitpro.resolxxMF));
0795             }
0796             if ((min(rechitpro.clusiz, 4) - 1) == 3) {
0797               fillME(iLayerME->second.meResolxMFRphiwclus3, sqrt(rechitpro.resolxxMF));
0798             }
0799             if ((min(rechitpro.clusiz, 4) - 1) == 4) {
0800               fillME(iLayerME->second.meResolxMFRphiwclus4, sqrt(rechitpro.resolxxMF));
0801             }
0802 
0803             fillME(iLayerME->second.meResLFRphi, rechitpro.resx);
0804             fillME(iLayerME->second.meResMFRphi, rechitpro.resxMF);
0805 
0806             if ((min(rechitpro.clusiz, 4) - 1) == 1) {
0807               fillME(iLayerME->second.merapidityResProfilewclus1, track_rapidity, fabs(rechitpro.resxMF));
0808             }
0809             if ((min(rechitpro.clusiz, 4) - 1) == 2) {
0810               fillME(iLayerME->second.merapidityResProfilewclus2, track_rapidity, fabs(rechitpro.resxMF));
0811             }
0812             if ((min(rechitpro.clusiz, 4) - 1) == 3) {
0813               fillME(iLayerME->second.merapidityResProfilewclus3, track_rapidity, fabs(rechitpro.resxMF));
0814             }
0815             if ((min(rechitpro.clusiz, 4) - 1) == 4) {
0816               fillME(iLayerME->second.merapidityResProfilewclus4, track_rapidity, fabs(rechitpro.resxMF));
0817             }
0818 
0819             if ((min(rechitpro.clusiz, 4) - 1) == 1) {
0820               fillME(iLayerME->second.meResMFRphiwclus1, rechitpro.resxMF);
0821             }
0822             if ((min(rechitpro.clusiz, 4) - 1) == 2) {
0823               fillME(iLayerME->second.meResMFRphiwclus2, rechitpro.resxMF);
0824             }
0825             if ((min(rechitpro.clusiz, 4) - 1) == 3) {
0826               fillME(iLayerME->second.meResMFRphiwclus3, rechitpro.resxMF);
0827             }
0828             if ((min(rechitpro.clusiz, 4) - 1) == 4) {
0829               fillME(iLayerME->second.meResMFRphiwclus4, rechitpro.resxMF);
0830             }
0831 
0832             fillME(iLayerME->second.mePullLFRphi, rechitpro.pullx);
0833             fillME(iLayerME->second.mePullMFRphi, rechitpro.pullxMF);
0834 
0835             if ((min(rechitpro.clusiz, 4) - 1) == 1) {
0836               fillME(iLayerME->second.mePullMFRphiwclus1, rechitpro.pullxMF);
0837             }
0838             if ((min(rechitpro.clusiz, 4) - 1) == 2) {
0839               fillME(iLayerME->second.mePullMFRphiwclus2, rechitpro.pullxMF);
0840             }
0841             if ((min(rechitpro.clusiz, 4) - 1) == 3) {
0842               fillME(iLayerME->second.mePullMFRphiwclus3, rechitpro.pullxMF);
0843             }
0844             if ((min(rechitpro.clusiz, 4) - 1) == 4) {
0845               fillME(iLayerME->second.mePullMFRphiwclus4, rechitpro.pullxMF);
0846             }
0847 
0848             fillME(iLayerME->second.meTrackangleRphi, rechitpro.trackangle);
0849             fillME(iLayerME->second.mePullTrackangleProfileRphi, rechitpro.trackangle, fabs(rechitpro.pullxMF));
0850 
0851             if ((min(rechitpro.clusiz, 4) - 1) == 1) {
0852               fillME(iLayerME->second.mePullTrackwidthProfileRphiwclus1, rechitpro.trackwidth, fabs(rechitpro.pullxMF));
0853             }
0854             if ((min(rechitpro.clusiz, 4) - 1) == 2) {
0855               fillME(iLayerME->second.mePullTrackwidthProfileRphiwclus2, rechitpro.trackwidth, fabs(rechitpro.pullxMF));
0856             }
0857             if ((min(rechitpro.clusiz, 4) - 1) == 3) {
0858               fillME(iLayerME->second.mePullTrackwidthProfileRphiwclus3, rechitpro.trackwidth, fabs(rechitpro.pullxMF));
0859             }
0860             if ((min(rechitpro.clusiz, 4) - 1) == 4) {
0861               fillME(iLayerME->second.mePullTrackwidthProfileRphiwclus4, rechitpro.trackwidth, fabs(rechitpro.pullxMF));
0862             }
0863 
0864             if (rechitpro.clusiz == 1) {
0865               fillME(iLayerME->second.meResolxMFTrackwidthProfileWclus1Rphi,
0866                      rechitpro.trackwidth,
0867                      sqrt(rechitpro.resolxxMF));
0868               fillME(iLayerME->second.meResMFTrackwidthProfileWclus1Rphi, rechitpro.trackwidth, fabs(rechitpro.resxMF));
0869             }
0870             if (rechitpro.clusiz == 2) {
0871               fillME(iLayerME->second.meResolxMFTrackwidthProfileWclus2Rphi,
0872                      rechitpro.trackwidth,
0873                      sqrt(rechitpro.resolxxMF));
0874               fillME(iLayerME->second.meResMFTrackwidthProfileWclus2Rphi, rechitpro.trackwidth, fabs(rechitpro.resxMF));
0875             }
0876             if (rechitpro.clusiz == 3) {
0877               fillME(iLayerME->second.meResolxMFTrackwidthProfileWclus3Rphi,
0878                      rechitpro.trackwidth,
0879                      sqrt(rechitpro.resolxxMF));
0880               fillME(iLayerME->second.meResMFTrackwidthProfileWclus3Rphi, rechitpro.trackwidth, fabs(rechitpro.resxMF));
0881             }
0882             if (rechitpro.clusiz == 4) {
0883               fillME(iLayerME->second.meResolxMFTrackwidthProfileWclus4Rphi,
0884                      rechitpro.trackwidth,
0885                      sqrt(rechitpro.resolxxMF));
0886               fillME(iLayerME->second.meResMFTrackwidthProfileWclus4Rphi, rechitpro.trackwidth, fabs(rechitpro.resxMF));
0887             }
0888 
0889             if (rechitpro.category == 1) {
0890               fillME(
0891                   iLayerME->second.mePullTrackwidthProfileCategory1Rphi, rechitpro.trackwidth, fabs(rechitpro.pullxMF));
0892               fillME(iLayerME->second.meResolxMFTrackwidthProfileCategory1Rphi,
0893                      rechitpro.trackwidth,
0894                      sqrt(rechitpro.resolxxMF));
0895               fillME(iLayerME->second.meResolxMFClusterwidthProfileCategory1Rphi,
0896                      rechitpro.clusiz,
0897                      sqrt(rechitpro.resolxxMF));
0898             } else if (rechitpro.category == 2) {
0899               fillME(
0900                   iLayerME->second.mePullTrackwidthProfileCategory2Rphi, rechitpro.trackwidth, fabs(rechitpro.pullxMF));
0901               fillME(iLayerME->second.meResolxMFTrackwidthProfileCategory2Rphi,
0902                      rechitpro.trackwidth,
0903                      sqrt(rechitpro.resolxxMF));
0904             } else if (rechitpro.category == 3) {
0905               fillME(
0906                   iLayerME->second.mePullTrackwidthProfileCategory3Rphi, rechitpro.trackwidth, fabs(rechitpro.pullxMF));
0907               fillME(iLayerME->second.meResolxMFTrackwidthProfileCategory3Rphi,
0908                      rechitpro.trackwidth,
0909                      sqrt(rechitpro.resolxxMF));
0910             } else if (rechitpro.category == 4) {
0911               fillME(
0912                   iLayerME->second.mePullTrackwidthProfileCategory4Rphi, rechitpro.trackwidth, fabs(rechitpro.pullxMF));
0913               fillME(iLayerME->second.meResolxMFTrackwidthProfileCategory4Rphi,
0914                      rechitpro.trackwidth,
0915                      sqrt(rechitpro.resolxxMF));
0916             }
0917 
0918             fillME(iLayerME->second.meTrackwidthRphi, rechitpro.trackwidth);
0919             fillME(iLayerME->second.meExpectedwidthRphi, rechitpro.expectedwidth);
0920             fillME(iLayerME->second.meClusterwidthRphi, rechitpro.clusiz);
0921             fillME(iLayerME->second.meCategoryRphi, rechitpro.category);
0922             fillME(iLayerME->second.meResolxMFTrackwidthProfileRphi, rechitpro.trackwidth, sqrt(rechitpro.resolxxMF));
0923             fillME(iLayerME->second.meResolxMFAngleProfileRphi, rechitpro.trackangle, sqrt(rechitpro.resolxxMF));
0924           }
0925         }
0926 
0927         if (isrechitsas > 0) {
0928           fillME(simplehitsMEs.meCategory, rechitpro.category);
0929           fillME(simplehitsMEs.meTrackwidth, rechitpro.trackwidth);
0930           fillME(simplehitsMEs.meExpectedwidth, rechitpro.expectedwidth);
0931           fillME(simplehitsMEs.meClusterwidth, rechitpro.clusiz);
0932           fillME(simplehitsMEs.meTrackanglealpha, rechitpro.trackangle);
0933           fillME(simplehitsMEs.meTrackanglebeta, rechitpro.trackanglebeta);
0934 
0935           fillME(simplehitsMEs.meResolxMFAngleProfile, rechitpro.trackangle, sqrt(rechitpro.resolxxMF));
0936           fillME(simplehitsMEs.meResolxMFTrackwidthProfile, rechitpro.trackwidth, sqrt(rechitpro.resolxxMF));
0937 
0938           if (rechitpro.clusiz == 1) {
0939             fillME(simplehitsMEs.meResolxMFTrackwidthProfileWClus1, rechitpro.trackwidth, sqrt(rechitpro.resolxxMF));
0940             fillME(simplehitsMEs.meResMFTrackwidthProfileWClus1, rechitpro.trackwidth, rechitpro.resxMF);
0941           } else if (rechitpro.clusiz == 2) {
0942             fillME(simplehitsMEs.meResolxMFTrackwidthProfileWClus2, rechitpro.trackwidth, sqrt(rechitpro.resolxxMF));
0943             fillME(simplehitsMEs.meResMFTrackwidthProfileWClus2, rechitpro.trackwidth, rechitpro.resxMF);
0944           } else if (rechitpro.clusiz == 3) {
0945             fillME(simplehitsMEs.meResolxMFTrackwidthProfileWClus3, rechitpro.trackwidth, sqrt(rechitpro.resolxxMF));
0946             fillME(simplehitsMEs.meResMFTrackwidthProfileWClus3, rechitpro.trackwidth, rechitpro.resxMF);
0947           } else if (rechitpro.clusiz == 4) {
0948             fillME(simplehitsMEs.meResolxMFTrackwidthProfileWClus4, rechitpro.trackwidth, sqrt(rechitpro.resolxxMF));
0949             fillME(simplehitsMEs.meResMFTrackwidthProfileWClus4, rechitpro.trackwidth, rechitpro.resxMF);
0950           }
0951           if (rechitpro.category == 1) {
0952             fillME(simplehitsMEs.meResolxMFTrackwidthProfileCategory1, rechitpro.trackwidth, sqrt(rechitpro.resolxxMF));
0953             fillME(simplehitsMEs.meResolxMFClusterwidthProfileCategory1, rechitpro.clusiz, sqrt(rechitpro.resolxxMF));
0954           } else if (rechitpro.category == 2) {
0955             fillME(simplehitsMEs.meResolxMFTrackwidthProfileCategory2, rechitpro.trackwidth, sqrt(rechitpro.resolxxMF));
0956           } else if (rechitpro.category == 3) {
0957             fillME(simplehitsMEs.meResolxMFTrackwidthProfileCategory3, rechitpro.trackwidth, sqrt(rechitpro.resolxxMF));
0958           } else if (rechitpro.category == 4) {
0959             fillME(simplehitsMEs.meResolxMFTrackwidthProfileCategory4, rechitpro.trackwidth, sqrt(rechitpro.resolxxMF));
0960           }
0961 
0962           fillME(simplehitsMEs.meResolxMF, sqrt(rechitpro.resolxxMF));
0963           fillME(simplehitsMEs.meResolxLF, sqrt(rechitpro.resolxx));
0964           fillME(simplehitsMEs.meResMF, rechitpro.resxMF);
0965           fillME(simplehitsMEs.meResLF, rechitpro.resx);
0966           fillME(simplehitsMEs.mePullMF, rechitpro.pullxMF);
0967           fillME(simplehitsMEs.mePullLF, rechitpro.pullx);
0968 
0969           if (iStereoAndMatchedME != StereoAndMatchedMEsMap.end()) {
0970             fillME(iStereoAndMatchedME->second.meWclusSas, rechitpro.clusiz);
0971             fillME(iStereoAndMatchedME->second.meAdcSas, rechitpro.cluchg);
0972             fillME(iStereoAndMatchedME->second.meResolxLFSas, sqrt(rechitpro.resolxx));
0973             fillME(iStereoAndMatchedME->second.meResLFSas, rechitpro.resx);
0974             fillME(iStereoAndMatchedME->second.mePullLFSas, rechitpro.pullx);
0975             fillME(iStereoAndMatchedME->second.meResolxMFSas, sqrt(rechitpro.resolxxMF));
0976             fillME(iStereoAndMatchedME->second.meResMFSas, rechitpro.resxMF);
0977             fillME(iStereoAndMatchedME->second.mePullMFSas, rechitpro.pullxMF);
0978             fillME(iStereoAndMatchedME->second.meTrackangleSas, rechitpro.trackangle);
0979             fillME(iStereoAndMatchedME->second.mePullTrackangleProfileSas, rechitpro.trackangle, rechitpro.pullxMF);
0980             fillME(iStereoAndMatchedME->second.mePullTrackwidthProfileSas, rechitpro.trackwidth, rechitpro.pullxMF);
0981             if (rechitpro.category == 1) {
0982               fillME(iStereoAndMatchedME->second.mePullTrackwidthProfileCategory1Sas,
0983                      rechitpro.trackwidth,
0984                      rechitpro.pullxMF);
0985               fillME(iStereoAndMatchedME->second.meResolxMFTrackwidthProfileCategory1Sas,
0986                      rechitpro.trackwidth,
0987                      sqrt(rechitpro.resolxxMF));
0988               fillME(iStereoAndMatchedME->second.meResolxMFClusterwidthProfileCategory1Sas,
0989                      rechitpro.clusiz,
0990                      sqrt(rechitpro.resolxxMF));
0991             } else if (rechitpro.category == 2) {
0992               fillME(iStereoAndMatchedME->second.mePullTrackwidthProfileCategory2Sas,
0993                      rechitpro.trackwidth,
0994                      rechitpro.pullxMF);
0995               fillME(iStereoAndMatchedME->second.meResolxMFTrackwidthProfileCategory2Sas,
0996                      rechitpro.trackwidth,
0997                      sqrt(rechitpro.resolxxMF));
0998             } else if (rechitpro.category == 3) {
0999               fillME(iStereoAndMatchedME->second.mePullTrackwidthProfileCategory3Sas,
1000                      rechitpro.trackwidth,
1001                      rechitpro.pullxMF);
1002               fillME(iStereoAndMatchedME->second.meResolxMFTrackwidthProfileCategory3Sas,
1003                      rechitpro.trackwidth,
1004                      sqrt(rechitpro.resolxxMF));
1005             } else if (rechitpro.category == 4) {
1006               fillME(iStereoAndMatchedME->second.mePullTrackwidthProfileCategory4Sas,
1007                      rechitpro.trackwidth,
1008                      rechitpro.pullxMF);
1009               fillME(iStereoAndMatchedME->second.meResolxMFTrackwidthProfileCategory4Sas,
1010                      rechitpro.trackwidth,
1011                      sqrt(rechitpro.resolxxMF));
1012             }
1013             fillME(iStereoAndMatchedME->second.meTrackwidthSas, rechitpro.trackwidth);
1014             fillME(iStereoAndMatchedME->second.meExpectedwidthSas, rechitpro.expectedwidth);
1015             fillME(iStereoAndMatchedME->second.meClusterwidthSas, rechitpro.clusiz);
1016             fillME(iStereoAndMatchedME->second.meCategorySas, rechitpro.category);
1017             fillME(iStereoAndMatchedME->second.meResolxMFTrackwidthProfileSas,
1018                    rechitpro.trackwidth,
1019                    sqrt(rechitpro.resolxxMF));
1020             fillME(iStereoAndMatchedME->second.meResolxMFAngleProfileSas, rechitpro.trackangle, rechitpro.resolxxMF);
1021           }
1022         }
1023       }
1024     }
1025   }
1026 }
1027 
1028 //needed by to do the residual for matched hits
1029 std::pair<LocalPoint, LocalVector> SiStripTrackingRecHitsValid::projectHit(const PSimHit &hit,
1030                                                                            const StripGeomDetUnit *stripDet,
1031                                                                            const BoundPlane &plane) {
1032   //  const StripGeomDetUnit* stripDet = dynamic_cast<const StripGeomDetUnit*>(hit.det());
1033   //if (stripDet == 0) throw MeasurementDetException("HitMatcher hit is not on StripGeomDetUnit");
1034 
1035   const StripTopology &topol = stripDet->specificTopology();
1036   GlobalPoint globalpos = stripDet->surface().toGlobal(hit.localPosition());
1037   LocalPoint localHit = plane.toLocal(globalpos);
1038   //track direction
1039   LocalVector locdir = hit.localDirection();
1040   //rotate track in new frame
1041 
1042   GlobalVector globaldir = stripDet->surface().toGlobal(locdir);
1043   LocalVector dir = plane.toLocal(globaldir);
1044   float scale = -localHit.z() / dir.z();
1045 
1046   LocalPoint projectedPos = localHit + scale * dir;
1047 
1048   //  std::cout << "projectedPos " << projectedPos << std::endl;
1049 
1050   float selfAngle = topol.stripAngle(topol.strip(hit.localPosition()));
1051 
1052   LocalVector stripDir(sin(selfAngle), cos(selfAngle), 0);  // vector along strip in hit frame
1053 
1054   LocalVector localStripDir(plane.toLocal(stripDet->surface().toGlobal(stripDir)));
1055 
1056   return std::pair<LocalPoint, LocalVector>(projectedPos, localStripDir);
1057 }
1058 //--------------------------------------------------------------------------------------------
1059 void SiStripTrackingRecHitsValid::rechitanalysis_matched(LocalVector ldir,
1060                                                          const TrackingRecHit *rechit,
1061                                                          const GluedGeomDet *gluedDet,
1062                                                          TrackerHitAssociator &associate,
1063                                                          const StripClusterParameterEstimator *stripcpe,
1064                                                          const MatchStatus matchedmonorstereo) {
1065   rechitpro.resx = -999999.;
1066   rechitpro.resy = -999999.;
1067   rechitpro.resxMF = -999999.;
1068   rechitpro.pullx = -999999.;
1069   rechitpro.pully = -999999.;
1070   rechitpro.pullxMF = -999999.;
1071   rechitpro.trackangle = -999999.;
1072   rechitpro.trackanglebeta = -999999.;
1073 
1074   const GeomDetUnit *monodet = gluedDet->monoDet();
1075   const GeomDetUnit *stereodet = gluedDet->stereoDet();
1076   //We initialized it to monoHit case because it complains that it may be uninitialized
1077   //and it will change value in the stereoHit case. The matched case do not use this
1078   const StripGeomDetUnit *stripdet = (const StripGeomDetUnit *)(monodet);
1079 
1080   const SiStripMatchedRecHit2D *matchedhit = dynamic_cast<const SiStripMatchedRecHit2D *>(rechit);
1081   const SiStripRecHit2D *monohit = nullptr;
1082   const SiStripRecHit2D *stereohit = nullptr;
1083   SiStripRecHit2D::ClusterRef clust;
1084 
1085   if (matchedmonorstereo == MatchStatus::monoHit) {
1086     auto hm = matchedhit->monoHit();
1087     monohit = &hm;
1088     stripdet = (const StripGeomDetUnit *)(monodet);
1089   } else if (matchedmonorstereo == MatchStatus::stereoHit) {
1090     auto s = matchedhit->stereoHit();
1091     stereohit = &s;
1092     stripdet = (const StripGeomDetUnit *)(stereodet);
1093   }
1094   //if(matchedhit) cout<<"manganomatchedhit"<<endl;
1095   //if(hit) cout<<"manganosimplehit"<<endl;
1096   //if (hit && matchedhit) cout<<"manganosimpleandmatchedhit"<<endl;
1097   const StripTopology &topol = (const StripTopology &)stripdet->topology();
1098 
1099   const LocalVector &trackdirection = ldir;
1100 
1101   GlobalVector gtrkdir = gluedDet->toGlobal(trackdirection);
1102   LocalVector monotkdir = monodet->toLocal(gtrkdir);
1103   LocalVector stereotkdir = stereodet->toLocal(gtrkdir);
1104 
1105   LocalPoint position;
1106   LocalError error;
1107   MeasurementPoint Mposition;
1108   MeasurementError Merror;
1109 
1110   if (matchedmonorstereo == MatchStatus::matched) {
1111     position = rechit->localPosition();
1112     error = rechit->localPositionError();
1113   } else if (matchedmonorstereo == MatchStatus::monoHit) {
1114     position = monohit->localPosition();
1115     error = monohit->localPositionError();
1116     Mposition = topol.measurementPosition(position);
1117     Merror = topol.measurementError(position, error);
1118     if (monotkdir.z()) {
1119       rechitpro.trackangle = atan(monotkdir.x() / monotkdir.z()) * TMath::RadToDeg();
1120       rechitpro.trackanglebeta = atan(monotkdir.y() / monotkdir.z()) * TMath::RadToDeg();
1121     }
1122     clust = monohit->cluster();
1123   } else if (matchedmonorstereo == MatchStatus::stereoHit) {
1124     position = stereohit->localPosition();
1125     error = stereohit->localPositionError();
1126     Mposition = topol.measurementPosition(position);
1127     Merror = topol.measurementError(position, error);
1128     if (stereotkdir.z()) {
1129       rechitpro.trackangle = atan(stereotkdir.x() / stereotkdir.z()) * TMath::RadToDeg();
1130       rechitpro.trackanglebeta = atan(stereotkdir.y() / stereotkdir.z()) * TMath::RadToDeg();
1131     }
1132     clust = stereohit->cluster();
1133   }
1134 
1135   LocalVector drift = stripcpe->driftDirection(stripdet);
1136   rechitpro.thickness = stripdet->surface().bounds().thickness();
1137   float pitch = topol.localPitch(position);
1138   float tanalpha = tan(rechitpro.trackangle * TMath::DegToRad());
1139   float tanalphaL = drift.x() / drift.z();
1140   rechitpro.trackwidth = fabs((rechitpro.thickness / pitch) * tanalpha - (rechitpro.thickness / pitch) * tanalphaL);
1141   float SLorentz = 0.5 * (rechitpro.thickness / pitch) * tanalphaL;
1142   int Sp = int(position.x() / pitch + SLorentz + 0.5 * rechitpro.trackwidth);
1143   int Sm = int(position.x() / pitch + SLorentz - 0.5 * rechitpro.trackwidth);
1144   rechitpro.expectedwidth = 1 + Sp - Sm;
1145 
1146   const auto &amplitudes = clust->amplitudes();
1147   rechitpro.clusiz = amplitudes.size();
1148   int totcharge = 0;
1149   for (size_t ia = 0; ia < amplitudes.size(); ++ia) {
1150     totcharge += amplitudes[ia];
1151   }
1152 
1153   rechitpro.x = position.x();
1154   rechitpro.y = position.y();
1155   rechitpro.z = position.z();
1156   rechitpro.resolxx = error.xx();
1157   rechitpro.resolxy = error.xy();
1158   rechitpro.resolyy = error.yy();
1159   rechitpro.resolxxMF = Merror.uu();
1160   rechitpro.cluchg = totcharge;
1161 
1162   if (rechitpro.clusiz > rechitpro.expectedwidth + 2) {
1163     rechitpro.category = 1;
1164   } else if (rechitpro.expectedwidth == 1) {
1165     rechitpro.category = 2;
1166   } else if (rechitpro.clusiz <= rechitpro.expectedwidth) {
1167     rechitpro.category = 3;
1168   } else {
1169     rechitpro.category = 4;
1170   }
1171 
1172   if (matchedmonorstereo == MatchStatus::matched) {
1173     matched.clear();
1174     matched = associate.associateHit(*matchedhit);
1175   } else if (matchedmonorstereo == MatchStatus::monoHit) {
1176     matched.clear();
1177     matched = associate.associateHit(*monohit);
1178   } else if (matchedmonorstereo == MatchStatus::stereoHit) {
1179     matched.clear();
1180     matched = associate.associateHit(*stereohit);
1181   }
1182 
1183   if (!matched.empty()) {
1184     float mindist = std::numeric_limits<float>::max();
1185     float dist = std::numeric_limits<float>::max();
1186     float distx = std::numeric_limits<float>::max();
1187     float disty = std::numeric_limits<float>::max();
1188 
1189     if (matchedmonorstereo == MatchStatus::matched) {
1190       const StripGeomDetUnit *partnerstripdet = static_cast<const StripGeomDetUnit *>(gluedDet->stereoDet());
1191       std::pair<LocalPoint, LocalVector> hitPair;
1192       std::pair<LocalPoint, LocalVector> closestPair;
1193       for (auto &m : matched) {
1194         //project simhit;
1195         hitPair = projectHit(m, partnerstripdet, gluedDet->surface());
1196         distx = fabs(rechitpro.x - hitPair.first.x());
1197         disty = fabs(rechitpro.y - hitPair.first.y());
1198         dist = distx * distx + disty * disty;
1199         if (dist < mindist) {
1200           mindist = dist;
1201           closestPair = hitPair;
1202         }
1203       }
1204       float closestX = closestPair.first.x();
1205       float closestY = closestPair.first.y();
1206       rechitpro.resx = rechitpro.x - closestX;
1207       rechitpro.resy = rechitpro.y - closestPair.first.y();
1208       rechitpro.pullx = ((rechit)->localPosition().x() - closestX) / sqrt(error.xx());
1209       rechitpro.pully = ((rechit)->localPosition().y() - closestY) / sqrt(error.yy());
1210     } else if (matchedmonorstereo == MatchStatus::monoHit) {
1211       PSimHit *closest = nullptr;
1212       for (auto &m : matched) {
1213         //project simhit;
1214         dist = abs((monohit)->localPosition().x() - m.localPosition().x());
1215         if (dist < mindist) {
1216           mindist = dist;
1217           closest = &m;
1218         }
1219       }
1220 
1221       if (!closest)
1222         return;
1223 
1224       float closestX = closest->localPosition().x();
1225       rechitpro.resx = rechitpro.x - closestX;
1226       rechitpro.resxMF = Mposition.x() - (topol.measurementPosition(closest->localPosition())).x();
1227       rechitpro.pullx = (rechit->localPosition().x() - closestX) / sqrt(error.xx());
1228       rechitpro.pullxMF = (rechitpro.resxMF) / sqrt(Merror.uu());
1229     } else if (matchedmonorstereo == MatchStatus::stereoHit) {
1230       PSimHit *closest = nullptr;
1231       for (auto &m : matched) {
1232         //project simhit;
1233         dist = abs((stereohit)->localPosition().x() - m.localPosition().x());
1234         if (dist < mindist) {
1235           mindist = dist;
1236           closest = &m;
1237         }
1238       }
1239 
1240       if (!closest)
1241         return;
1242 
1243       float closestX = closest->localPosition().x();
1244       rechitpro.resx = rechitpro.x - closestX;
1245       rechitpro.resxMF = Mposition.x() - (topol.measurementPosition(closest->localPosition())).x();
1246       rechitpro.pullx = (rechit->localPosition().x() - closestX) / sqrt(error.xx());
1247       rechitpro.pullxMF = (rechitpro.resxMF) / sqrt(Merror.uu());
1248     }
1249   }
1250 }
1251 //--------------------------------------------------------------------------------------------
1252 void SiStripTrackingRecHitsValid::rechitanalysis(LocalVector ldir,
1253                                                  const TrackingRecHit *rechit,
1254                                                  const StripGeomDetUnit *stripdet,
1255                                                  const StripClusterParameterEstimator *stripcpe,
1256                                                  TrackerHitAssociator &associate,
1257                                                  bool simplehit1or2D) {
1258   rechitpro.resx = -999999.;
1259   rechitpro.resy = -999999.;
1260   rechitpro.resxMF = -999999.;
1261   rechitpro.pullx = -999999.;
1262   rechitpro.pully = -999999.;
1263   rechitpro.pullxMF = -999999.;
1264 
1265   //If simplehit1or2D is true we are dealing with hit1d, false is for hit2d
1266   const SiStripRecHit2D *hit2d = dynamic_cast<const SiStripRecHit2D *>(rechit);
1267   const SiStripRecHit1D *hit1d = dynamic_cast<const SiStripRecHit1D *>(rechit);
1268 
1269   const StripTopology &topol = (const StripTopology &)stripdet->topology();
1270 
1271   LocalPoint position = rechit->localPosition();
1272   LocalError error = rechit->localPositionError();
1273   MeasurementPoint Mposition = topol.measurementPosition(position);
1274   MeasurementError Merror = topol.measurementError(position, error);
1275 
1276   const LocalVector &trackdirection = ldir;
1277   rechitpro.trackangle = std::atan(trackdirection.x() / trackdirection.z()) * TMath::RadToDeg();
1278   rechitpro.trackanglebeta = std::atan(trackdirection.y() / trackdirection.z()) * TMath::RadToDeg();
1279 
1280   LocalVector drift = stripcpe->driftDirection(stripdet);
1281   rechitpro.thickness = stripdet->surface().bounds().thickness();
1282   float pitch = topol.localPitch(position);
1283   float tanalpha = tan(rechitpro.trackangle * TMath::DegToRad());
1284   float tanalphaL = drift.x() / drift.z();
1285   rechitpro.trackwidth = fabs((rechitpro.thickness / pitch) * tanalpha - (rechitpro.thickness / pitch) * tanalphaL);
1286   float SLorentz = 0.5 * (rechitpro.thickness / pitch) * tanalphaL;
1287   int Sp = int(position.x() / pitch + SLorentz + 0.5 * rechitpro.trackwidth);
1288   int Sm = int(position.x() / pitch + SLorentz - 0.5 * rechitpro.trackwidth);
1289   rechitpro.expectedwidth = 1 + Sp - Sm;
1290 
1291   int totcharge = 0;
1292   if (simplehit1or2D) {
1293     SiStripRecHit1D::ClusterRef clust1d;
1294     clust1d = hit1d->cluster();
1295     const auto &amplitudes1d = clust1d->amplitudes();
1296     rechitpro.clusiz = amplitudes1d.size();
1297     for (size_t ia = 0; ia < amplitudes1d.size(); ++ia) {
1298       totcharge += amplitudes1d[ia];
1299     }
1300   } else {
1301     SiStripRecHit2D::ClusterRef clust2d;
1302     clust2d = hit2d->cluster();
1303     const auto &amplitudes2d = clust2d->amplitudes();
1304     rechitpro.clusiz = amplitudes2d.size();
1305     for (size_t ia = 0; ia < amplitudes2d.size(); ++ia) {
1306       totcharge += amplitudes2d[ia];
1307     }
1308   }
1309 
1310   rechitpro.x = position.x();
1311   rechitpro.y = position.y();
1312   rechitpro.z = position.z();
1313   rechitpro.resolxx = error.xx();
1314   rechitpro.resolxy = error.xy();
1315   rechitpro.resolyy = error.yy();
1316   rechitpro.resolxxMF = Merror.uu();
1317   rechitpro.cluchg = totcharge;
1318 
1319   if (rechitpro.clusiz > rechitpro.expectedwidth + 2) {
1320     rechitpro.category = 1;
1321   } else if (rechitpro.expectedwidth == 1) {
1322     rechitpro.category = 2;
1323   } else if (rechitpro.clusiz <= rechitpro.expectedwidth) {
1324     rechitpro.category = 3;
1325   } else {
1326     rechitpro.category = 4;
1327   }
1328 
1329   matched.clear();
1330   float mindist = std::numeric_limits<float>::max();
1331   float dist = std::numeric_limits<float>::max();
1332   PSimHit *closest = nullptr;
1333 
1334   if (simplehit1or2D) {
1335     matched = associate.associateHit(*hit1d);
1336     if (!matched.empty()) {
1337       for (auto &m : matched) {
1338         dist = abs((hit1d)->localPosition().x() - m.localPosition().x());
1339         if (dist < mindist) {
1340           mindist = dist;
1341           closest = &m;
1342         }
1343       }
1344 
1345       if (!closest)
1346         return;
1347 
1348       float closestX = closest->localPosition().x();
1349       rechitpro.resx = rechitpro.x - closestX;
1350       rechitpro.resxMF = Mposition.x() - (topol.measurementPosition(closest->localPosition())).x();
1351       rechitpro.pullx = (rechit->localPosition().x() - closestX) / sqrt(error.xx());
1352       rechitpro.pullxMF = (rechitpro.resxMF) / sqrt(Merror.uu());
1353     }
1354   } else {
1355     matched = associate.associateHit(*hit2d);
1356     if (!matched.empty()) {
1357       for (auto &m : matched) {
1358         dist = abs((hit2d)->localPosition().x() - m.localPosition().x());
1359         if (dist < mindist) {
1360           mindist = dist;
1361           closest = &m;
1362         }
1363       }
1364 
1365       if (!closest)
1366         return;
1367 
1368       float closestX = closest->localPosition().x();
1369       rechitpro.resx = rechitpro.x - closestX;
1370       rechitpro.resxMF = Mposition.x() - (topol.measurementPosition(closest->localPosition())).x();
1371       rechitpro.pullx = (rechit->localPosition().x() - closestX) / sqrt(error.xx());
1372       rechitpro.pullxMF = (rechitpro.resxMF) / sqrt(Merror.uu());
1373     }
1374   }
1375 }
1376 //--------------------------------------------------------------------------------------------
1377 void SiStripTrackingRecHitsValid::createMEs(DQMStore::IBooker &ibooker, const edm::EventSetup &es) {
1378   //Retrieve tracker topology from geometry
1379   const TrackerTopology *const tTopo = &es.getData(m_topoTokenBR);
1380 
1381   // take from eventSetup the SiStripDetCabling object - here will use SiStripDetControl later on
1382   const auto &SiStripDetCabling_ = &es.getData(m_SiStripDetCablingToken);
1383 
1384   // get list of active detectors from SiStripDetCabling
1385   std::vector<uint32_t> activeDets;
1386   SiStripDetCabling_->addActiveDetectorsRawIds(activeDets);
1387 
1388   SiStripFolderOrganizer folder_organizer;
1389   // folder_organizer.setSiStripFolderName(topFolderName_);
1390   std::string curfold = topFolderName_;
1391   folder_organizer.setSiStripFolderName(curfold);
1392   folder_organizer.setSiStripFolder();
1393 
1394   // std::cout << "curfold " << curfold << std::endl;
1395 
1396   createSimpleHitsMEs(ibooker);
1397 
1398   // loop over detectors and book MEs
1399   edm::LogInfo("SiStripTrackingRecHitsValid|SiStripTrackingRecHitsValid")
1400       << "nr. of activeDets:  " << activeDets.size();
1401   const std::string &tec = "TEC", tid = "TID", tob = "TOB", tib = "TIB";
1402   for (std::vector<uint32_t>::iterator detid_iterator = activeDets.begin(), detid_end = activeDets.end();
1403        detid_iterator != detid_end;
1404        ++detid_iterator) {
1405     uint32_t detid = (*detid_iterator);
1406     // remove any eventual zero elements - there should be none, but just in case
1407     if (detid == 0) {
1408       activeDets.erase(detid_iterator);
1409       continue;
1410     }
1411 
1412     // Create Layer Level MEs
1413     std::pair<std::string, int32_t> det_layer_pair = folder_organizer.GetSubDetAndLayer(detid, tTopo, true);
1414     SiStripHistoId hidmanager;
1415     std::string label = hidmanager.getSubdetid(detid, tTopo, true);
1416     // std::cout << "label " << label << endl;
1417 
1418     std::map<std::string, LayerMEs>::iterator iLayerME = LayerMEsMap.find(label);
1419     if (iLayerME == LayerMEsMap.end()) {
1420       // get detids for the layer
1421       // Keep in mind that when we are on the TID or TEC we deal with rings not wheel
1422       int32_t lnumber = det_layer_pair.second;
1423       const std::string &lname = det_layer_pair.first;
1424       std::vector<uint32_t> layerDetIds;
1425       if (lname == tec) {
1426         if (lnumber > 0) {
1427           SiStripSubStructure::getTECDetectors(activeDets, layerDetIds, tTopo, 2, 0, 0, 0, abs(lnumber), 0);
1428         } else if (lnumber < 0) {
1429           SiStripSubStructure::getTECDetectors(activeDets, layerDetIds, tTopo, 1, 0, 0, 0, abs(lnumber), 0);
1430         }
1431       } else if (lname == tid) {
1432         if (lnumber > 0) {
1433           SiStripSubStructure::getTIDDetectors(activeDets, layerDetIds, tTopo, 2, 0, abs(lnumber), 0);
1434         } else if (lnumber < 0) {
1435           SiStripSubStructure::getTIDDetectors(activeDets, layerDetIds, tTopo, 1, 0, abs(lnumber), 0);
1436         }
1437       } else if (lname == tob) {
1438         SiStripSubStructure::getTOBDetectors(activeDets, layerDetIds, tTopo, lnumber, 0, 0);
1439       } else if (lname == tib) {
1440         SiStripSubStructure::getTIBDetectors(activeDets, layerDetIds, tTopo, lnumber, 0, 0, 0);
1441       }
1442       LayerDetMap[label] = layerDetIds;
1443 
1444       // book Layer MEs
1445       folder_organizer.setLayerFolder(detid, tTopo, det_layer_pair.second, true);
1446       // std::stringstream ss;
1447       // folder_organizer.getLayerFolderName(ss, detid, tTopo, true);
1448       // std::cout << "Folder Name " << ss.str().c_str() << std::endl;
1449       // folder_organizer.setLayerFolder(detid,det_layer_pair.second,true);
1450       createLayerMEs(ibooker, label);
1451     }
1452     //Create StereoAndMatchedMEs
1453     std::map<std::string, StereoAndMatchedMEs>::iterator iStereoAndMatchedME = StereoAndMatchedMEsMap.find(label);
1454     if (iStereoAndMatchedME == StereoAndMatchedMEsMap.end()) {
1455       // get detids for the stereo and matched layer. We are going to need a bool for these layers
1456       bool isStereo = false;
1457       // Keep in mind that when we are on the TID or TEC we deal with rings not wheel
1458       std::vector<uint32_t> stereoandmatchedDetIds;
1459       int32_t stereolnumber = det_layer_pair.second;
1460       const std::string &stereolname = det_layer_pair.first;
1461       if (stereolname == tec && (tTopo->tecIsStereo(detid))) {
1462         if (stereolnumber > 0) {
1463           SiStripSubStructure::getTECDetectors(
1464               activeDets, stereoandmatchedDetIds, tTopo, 2, 0, 0, 0, abs(stereolnumber), 1);
1465           isStereo = true;
1466         } else if (stereolnumber < 0) {
1467           SiStripSubStructure::getTECDetectors(
1468               activeDets, stereoandmatchedDetIds, tTopo, 1, 0, 0, 0, abs(stereolnumber), 1);
1469           isStereo = true;
1470         }
1471       } else if (stereolname == tid && (tTopo->tidIsStereo(detid))) {
1472         if (stereolnumber > 0) {
1473           SiStripSubStructure::getTIDDetectors(activeDets, stereoandmatchedDetIds, tTopo, 2, 0, abs(stereolnumber), 1);
1474           isStereo = true;
1475         } else if (stereolnumber < 0) {
1476           SiStripSubStructure::getTIDDetectors(activeDets, stereoandmatchedDetIds, tTopo, 1, 0, abs(stereolnumber), 1);
1477           isStereo = true;
1478         }
1479       } else if (stereolname == tob && (tTopo->tobIsStereo(detid))) {
1480         SiStripSubStructure::getTOBDetectors(activeDets, stereoandmatchedDetIds, tTopo, stereolnumber, 0, 0);
1481         isStereo = true;
1482       } else if (stereolname == tib && (tTopo->tibIsStereo(detid))) {
1483         SiStripSubStructure::getTIBDetectors(activeDets, stereoandmatchedDetIds, tTopo, stereolnumber, 0, 0, 0);
1484         isStereo = true;
1485       }
1486 
1487       StereoAndMatchedDetMap[label] = stereoandmatchedDetIds;
1488 
1489       // book StereoAndMatched MEs
1490       if (isStereo) {
1491         folder_organizer.setLayerFolder(detid, tTopo, det_layer_pair.second, true);
1492         // std::stringstream ss1;
1493         // folder_organizer.getLayerFolderName(ss1, detid, tTopo, true);
1494         // std::cout << "Folder Name stereo " <<  ss1.str().c_str() << std::endl;
1495         //Create the Monitor Elements only when we have a stereo module
1496         createStereoAndMatchedMEs(ibooker, label);
1497       }
1498     }
1499 
1500   }  //end of loop over detectors
1501 }
1502 //------------------------------------------------------------------------------------------
1503 void SiStripTrackingRecHitsValid::createSimpleHitsMEs(DQMStore::IBooker &ibooker) {
1504   simplehitsMEs.meCategory = nullptr;
1505   simplehitsMEs.meTrackwidth = nullptr;
1506   simplehitsMEs.meExpectedwidth = nullptr;
1507   simplehitsMEs.meClusterwidth = nullptr;
1508   simplehitsMEs.meTrackanglealpha = nullptr;
1509   simplehitsMEs.meTrackanglebeta = nullptr;
1510   simplehitsMEs.meResolxMFTrackwidthProfile = nullptr;
1511   simplehitsMEs.meResolxMFTrackwidthProfileWClus1 = nullptr;
1512   simplehitsMEs.meResolxMFTrackwidthProfileWClus2 = nullptr;
1513   simplehitsMEs.meResolxMFTrackwidthProfileWClus3 = nullptr;
1514   simplehitsMEs.meResolxMFTrackwidthProfileWClus4 = nullptr;
1515   simplehitsMEs.meResMFTrackwidthProfileWClus1 = nullptr;
1516 
1517   simplehitsMEs.meResMFTrackwidthProfileWClus2 = nullptr;
1518   simplehitsMEs.meResMFTrackwidthProfileWClus21 = nullptr;
1519   simplehitsMEs.meResMFTrackwidthProfileWClus22 = nullptr;
1520   simplehitsMEs.meResMFTrackwidthProfileWClus23 = nullptr;
1521 
1522   simplehitsMEs.meResMFTrackwidthProfileWClus3 = nullptr;
1523   simplehitsMEs.meResMFTrackwidthProfileWClus4 = nullptr;
1524   simplehitsMEs.meResolxMFTrackwidthProfileCategory1 = nullptr;
1525   simplehitsMEs.meResolxMFTrackwidthProfileCategory2 = nullptr;
1526   simplehitsMEs.meResolxMFTrackwidthProfileCategory3 = nullptr;
1527   simplehitsMEs.meResolxMFTrackwidthProfileCategory4 = nullptr;
1528   simplehitsMEs.meResolxMFClusterwidthProfileCategory1 = nullptr;
1529   simplehitsMEs.meResolxMFAngleProfile = nullptr;
1530   simplehitsMEs.meResolxLF = nullptr;
1531   simplehitsMEs.meResLF = nullptr;
1532   simplehitsMEs.mePullLF = nullptr;
1533   simplehitsMEs.meResolxMF = nullptr;
1534   simplehitsMEs.meResMF = nullptr;
1535   simplehitsMEs.mePullMF = nullptr;
1536 
1537   if (layerswitchResolx_LF) {
1538     simplehitsMEs.meResolxLF =
1539         bookME1D(ibooker, "TH1Resolx_LF", "TH1Resolx_LF", "RecHit resol(x) coord. (local frame)");
1540     simplehitsMEs.meResolxLF->setAxisTitle("resol(x) RecHit coord. (local frame)");
1541   }
1542   if (layerswitchResolx_MF) {
1543     simplehitsMEs.meResolxMF =
1544         bookME1D(ibooker, "TH1Resolx_MF", "TH1Resolx_MF", "RecHit resol(x) coord. (measurement frame)");
1545     simplehitsMEs.meResolxMF->setAxisTitle("resol(x) RecHit coord. (measurement frame)");
1546   }
1547   if (layerswitchRes_LF) {
1548     simplehitsMEs.meResLF =
1549         bookME1D(ibooker, "TH1Res_LF", "TH1Res_LF", "Residual of the hit x coordinate (local frame)");
1550     simplehitsMEs.meResLF->setAxisTitle("Hit Res(x) (local frame)");
1551   }
1552   if (layerswitchRes_MF) {
1553     simplehitsMEs.meResMF =
1554         bookME1D(ibooker, "TH1Res_MF", "TH1Res_MF", "Residual of the hit x coordinate (measurement frame)");
1555     simplehitsMEs.meResMF->setAxisTitle("Hit Res(x) (measurement frame)");
1556   }
1557   if (layerswitchPull_LF) {
1558     simplehitsMEs.mePullLF = bookME1D(ibooker, "TH1Pull_LF", "TH1Pull_LF", "Pull distribution (local frame)");
1559     simplehitsMEs.mePullLF->setAxisTitle("Pull distribution (local frame)");
1560   }
1561   if (layerswitchPull_MF) {
1562     simplehitsMEs.mePullMF = bookME1D(ibooker, "TH1Pull_MF", "TH1Pull_MF", "Pull distribution (measurement frame)");
1563     simplehitsMEs.mePullMF->setAxisTitle("Pull distribution (measurement frame)");
1564   }
1565   if (layerswitchCategory) {
1566     simplehitsMEs.meCategory = bookME1D(ibooker, "TH1Category", "TH1Category", "Category");
1567     simplehitsMEs.meCategory->setAxisTitle("Category");
1568   }
1569   if (layerswitchTrackwidth) {
1570     simplehitsMEs.meTrackwidth = bookME1D(ibooker, "TH1Trackwidth", "TH1Trackwidth", "Track width");
1571     simplehitsMEs.meTrackwidth->setAxisTitle("Track width");
1572   }
1573   if (layerswitchExpectedwidth) {
1574     simplehitsMEs.meExpectedwidth = bookME1D(ibooker, "TH1Expectedwidth", "TH1Expectedwidth", "Expected width");
1575     simplehitsMEs.meExpectedwidth->setAxisTitle("Expected width");
1576   }
1577   if (layerswitchClusterwidth) {
1578     simplehitsMEs.meClusterwidth = bookME1D(ibooker, "TH1Clusterwidth", "TH1Clusterwidth", "Cluster width");
1579     simplehitsMEs.meClusterwidth->setAxisTitle("Cluster width");
1580   }
1581   if (layerswitchTrackanglealpha) {
1582     simplehitsMEs.meTrackanglealpha =
1583         bookME1D(ibooker, "TH1Trackanglealpha", "TH1Trackanglealpha", "Track angle alpha");
1584     simplehitsMEs.meTrackanglealpha->setAxisTitle("Track angle alpha");
1585   }
1586   if (layerswitchTrackanglebeta) {
1587     simplehitsMEs.meTrackanglebeta = bookME1D(ibooker, "TH1Trackanglebeta", "TH1Trackanglebeta", "Track angle beta");
1588     simplehitsMEs.meTrackanglebeta->setAxisTitle("Track angle beta");
1589   }
1590   if (layerswitchResolxMFTrackwidthProfile_WClus1) {
1591     simplehitsMEs.meResolxMFTrackwidthProfileWClus1 =
1592         bookMEProfile(ibooker,
1593                       "TProfResolxMFTrackwidthProfile_WClus1",
1594                       "TProfResolxMFTrackwidthProfile_WClus1",
1595                       "Profile of Resolution in MF vs track width for w=1");
1596     simplehitsMEs.meResolxMFTrackwidthProfileWClus1->setAxisTitle("Track width", 1);
1597     simplehitsMEs.meResolxMFTrackwidthProfileWClus1->setAxisTitle("Resolution (measurement frame) w=1", 2);
1598   }
1599   if (layerswitchResolxMFTrackwidthProfile_WClus2) {
1600     simplehitsMEs.meResolxMFTrackwidthProfileWClus2 =
1601         bookMEProfile(ibooker,
1602                       "TProfResolxMFTrackwidthProfile_WClus2",
1603                       "TProfResolxMFTrackwidthProfile_WClus2",
1604                       "Profile of Resolution in MF vs track width for w=2");
1605     simplehitsMEs.meResolxMFTrackwidthProfileWClus2->setAxisTitle("Track width", 1);
1606     simplehitsMEs.meResolxMFTrackwidthProfileWClus2->setAxisTitle("Resolution (measurement frame) w=2", 2);
1607   }
1608   if (layerswitchResolxMFTrackwidthProfile_WClus3) {
1609     simplehitsMEs.meResolxMFTrackwidthProfileWClus3 =
1610         bookMEProfile(ibooker,
1611                       "TProfResolxMFTrackwidthProfile_WClus3",
1612                       "TProfResolxMFTrackwidthProfile_WClus3",
1613                       "Profile of Resolution in MF vs track width for w=3");
1614     simplehitsMEs.meResolxMFTrackwidthProfileWClus3->setAxisTitle("Track width", 1);
1615     simplehitsMEs.meResolxMFTrackwidthProfileWClus3->setAxisTitle("Resolution (measurement frame) w=3", 2);
1616   }
1617   if (layerswitchResolxMFTrackwidthProfile_WClus4) {
1618     simplehitsMEs.meResolxMFTrackwidthProfileWClus4 =
1619         bookMEProfile(ibooker,
1620                       "TProfResolxMFTrackwidthProfile_WClus4",
1621                       "TProfResolxMFTrackwidthProfile_WClus4",
1622                       "Profile of Resolution in MF vs track width for w=4");
1623     simplehitsMEs.meResolxMFTrackwidthProfileWClus4->setAxisTitle("Track width", 1);
1624     simplehitsMEs.meResolxMFTrackwidthProfileWClus4->setAxisTitle("Resolution (measurement frame) w=3", 2);
1625   }
1626   if (layerswitchResMFTrackwidthProfile_WClus1) {
1627     simplehitsMEs.meResMFTrackwidthProfileWClus1 =
1628         bookMEProfile(ibooker,
1629                       "TProfResMFTrackwidthProfile_WClus1",
1630                       "TProfResMFTrackwidthProfile_WClus1",
1631                       "Profile of Residuals(x) in MF vs track width for w=1");
1632     simplehitsMEs.meResMFTrackwidthProfileWClus1->setAxisTitle("Track width", 1);
1633     simplehitsMEs.meResMFTrackwidthProfileWClus1->setAxisTitle("Residuals(x) (measurement frame) w=1", 2);
1634   }
1635   if (layerswitchResMFTrackwidthProfile_WClus2) {
1636     simplehitsMEs.meResMFTrackwidthProfileWClus2 =
1637         bookMEProfile(ibooker,
1638                       "TProfResMFTrackwidthProfile_WClus2",
1639                       "TProfResMFTrackwidthProfile_WClus2",
1640                       "Profile of Residuals(x) in MF vs track width for w=2");
1641     simplehitsMEs.meResMFTrackwidthProfileWClus2->setAxisTitle("Track width", 1);
1642     simplehitsMEs.meResMFTrackwidthProfileWClus2->setAxisTitle("Residuals(x) (measurement frame) w=2", 2);
1643   }
1644   if (layerswitchResMFTrackwidthProfile_WClus21) {
1645     simplehitsMEs.meResMFTrackwidthProfileWClus21 =
1646         bookMEProfile(ibooker,
1647                       "TProfResMFTrackwidthProfile_WClus21",
1648                       "TProfResMFTrackwidthProfile_WClus21",
1649                       "Profile of Residuals(x) in MF vs track width for w=2");
1650     simplehitsMEs.meResMFTrackwidthProfileWClus21->setAxisTitle("Track width", 1);
1651     simplehitsMEs.meResMFTrackwidthProfileWClus21->setAxisTitle("Residuals(x) (measurement frame) w=2", 2);
1652   }
1653   if (layerswitchResMFTrackwidthProfile_WClus22) {
1654     simplehitsMEs.meResMFTrackwidthProfileWClus22 =
1655         bookMEProfile(ibooker,
1656                       "TProfResMFTrackwidthProfile_WClus22",
1657                       "TProfResMFTrackwidthProfile_WClus22",
1658                       "Profile of Residuals(x) in MF vs track width for w=2");
1659     simplehitsMEs.meResMFTrackwidthProfileWClus22->setAxisTitle("Track width", 1);
1660     simplehitsMEs.meResMFTrackwidthProfileWClus22->setAxisTitle("Residuals(x) (measurement frame) w=2", 2);
1661   }
1662   if (layerswitchResMFTrackwidthProfile_WClus23) {
1663     simplehitsMEs.meResMFTrackwidthProfileWClus23 =
1664         bookMEProfile(ibooker,
1665                       "TProfResMFTrackwidthProfile_WClus23",
1666                       "TProfResMFTrackwidthProfile_WClus23",
1667                       "Profile of Residuals(x) in MF vs track width for w=2");
1668     simplehitsMEs.meResMFTrackwidthProfileWClus23->setAxisTitle("Track width", 1);
1669     simplehitsMEs.meResMFTrackwidthProfileWClus23->setAxisTitle("Residuals(x) (measurement frame) w=2", 2);
1670   }
1671   if (layerswitchResMFTrackwidthProfile_WClus3) {
1672     simplehitsMEs.meResMFTrackwidthProfileWClus3 =
1673         bookMEProfile(ibooker,
1674                       "TProfResMFTrackwidthProfile_WClus3",
1675                       "TProfResMFTrackwidthProfile_WClus3",
1676                       "Profile of Residuals(x) in MF vs track width for w=3");
1677     simplehitsMEs.meResMFTrackwidthProfileWClus3->setAxisTitle("Track width", 1);
1678     simplehitsMEs.meResMFTrackwidthProfileWClus3->setAxisTitle("Residuals(x) (measurement frame) w=3", 2);
1679   }
1680   if (layerswitchResMFTrackwidthProfile_WClus4) {
1681     simplehitsMEs.meResMFTrackwidthProfileWClus4 =
1682         bookMEProfile(ibooker,
1683                       "TProfResMFTrackwidthProfile_WClus4",
1684                       "TProfResMFTrackwidthProfile_WClus4",
1685                       "Profile of Residuals(x) in MF vs track width for w=4");
1686     simplehitsMEs.meResMFTrackwidthProfileWClus4->setAxisTitle("Track width", 1);
1687     simplehitsMEs.meResMFTrackwidthProfileWClus4->setAxisTitle("Residuals(x) (measurement frame) w=4", 2);
1688   }
1689   if (layerswitchResolxMFTrackwidthProfile) {
1690     simplehitsMEs.meResolxMFTrackwidthProfile = bookMEProfile(ibooker,
1691                                                               "TProfResolxMFTrackwidthProfile",
1692                                                               "TProfResolxMFTrackwidthProfile",
1693                                                               "Profile of Resolution in MF vs track width");
1694     simplehitsMEs.meResolxMFTrackwidthProfile->setAxisTitle("Track width", 1);
1695     simplehitsMEs.meResolxMFTrackwidthProfile->setAxisTitle("Resolution (measurement frame)", 2);
1696   }
1697   if (layerswitchResolxMFTrackwidthProfile_Category1) {
1698     simplehitsMEs.meResolxMFTrackwidthProfileCategory1 =
1699         bookMEProfile(ibooker,
1700                       "TProfResolxMFTrackwidthProfile_Category1",
1701                       "TProfResolxMFTrackwidthProfile_Category1",
1702                       "Profile of Resolution in MF vs track width (Category 1)");
1703     simplehitsMEs.meResolxMFTrackwidthProfileCategory1->setAxisTitle("Track width", 1);
1704     simplehitsMEs.meResolxMFTrackwidthProfileCategory1->setAxisTitle("Resolution (measurement frame) Category 1", 2);
1705   }
1706   if (layerswitchResolxMFTrackwidthProfile_Category2) {
1707     simplehitsMEs.meResolxMFTrackwidthProfileCategory2 =
1708         bookMEProfile(ibooker,
1709                       "TProfResolxMFTrackwidthProfile_Category2",
1710                       "TProfResolxMFTrackwidthProfile_Category2",
1711                       "Profile of Resolution in MF vs track width (Category 2)");
1712     simplehitsMEs.meResolxMFTrackwidthProfileCategory2->setAxisTitle("Track width", 1);
1713     simplehitsMEs.meResolxMFTrackwidthProfileCategory2->setAxisTitle("Resolution (measurement frame) Category 2", 2);
1714   }
1715   if (layerswitchResolxMFTrackwidthProfile_Category3) {
1716     simplehitsMEs.meResolxMFTrackwidthProfileCategory3 =
1717         bookMEProfile(ibooker,
1718                       "TProfResolxMFTrackwidthProfile_Category3",
1719                       "TProfResolxMFTrackwidthProfile_Category3",
1720                       "Profile of Resolution in MF vs track width (Category 3)");
1721     simplehitsMEs.meResolxMFTrackwidthProfileCategory3->setAxisTitle("Track width", 1);
1722     simplehitsMEs.meResolxMFTrackwidthProfileCategory3->setAxisTitle("Resolution (measurement frame) Category 3", 2);
1723   }
1724   if (layerswitchResolxMFTrackwidthProfile_Category4) {
1725     simplehitsMEs.meResolxMFTrackwidthProfileCategory4 =
1726         bookMEProfile(ibooker,
1727                       "TProfResolxMFTrackwidthProfile_Category4",
1728                       "TProfResolxMFTrackwidthProfile_Category4",
1729                       "Profile of Resolution in MF vs track width (Category 4)");
1730     simplehitsMEs.meResolxMFTrackwidthProfileCategory4->setAxisTitle("Track width", 1);
1731     simplehitsMEs.meResolxMFTrackwidthProfileCategory4->setAxisTitle("Resolution (measurement frame) Category 4", 2);
1732   }
1733   if (layerswitchResolxMFClusterwidthProfile_Category1) {
1734     simplehitsMEs.meResolxMFClusterwidthProfileCategory1 =
1735         bookMEProfile(ibooker,
1736                       "TProfResolxMFClusterwidthProfile_Category1",
1737                       "TProfResolxMFClusterwidthProfile_Category1",
1738                       "Profile of Resolution in MF vs cluster width (Category 1)");
1739     simplehitsMEs.meResolxMFClusterwidthProfileCategory1->setAxisTitle("Cluster width", 1);
1740     simplehitsMEs.meResolxMFClusterwidthProfileCategory1->setAxisTitle("Resolution (measurement frame) Category 1", 2);
1741   }
1742   if (layerswitchResolxMFAngleProfile) {
1743     simplehitsMEs.meResolxMFAngleProfile = bookMEProfile(ibooker,
1744                                                          "TProfResolxMFAngleProfile",
1745                                                          "TProfResolxMFAngleProfile",
1746                                                          "Profile of Resolution in MF vs Track angle alpha");
1747     simplehitsMEs.meResolxMFAngleProfile->setAxisTitle("Track angle alpha", 1);
1748     simplehitsMEs.meResolxMFAngleProfile->setAxisTitle("Resolution (measurement frame)", 2);
1749   }
1750 }
1751 //------------------------------------------------------------------------------------------
1752 void SiStripTrackingRecHitsValid::createLayerMEs(DQMStore::IBooker &ibooker, std::string label) {
1753   SiStripHistoId hidmanager;
1754   LayerMEs layerMEs;
1755 
1756   layerMEs.meWclusRphi = nullptr;
1757   layerMEs.meAdcRphi = nullptr;
1758   layerMEs.meResolxLFRphi = nullptr;
1759   layerMEs.meResolxMFRphi = nullptr;
1760   layerMEs.meResolxMFRphiwclus1 = nullptr;
1761   layerMEs.meResolxMFRphiwclus2 = nullptr;
1762   layerMEs.meResolxMFRphiwclus3 = nullptr;
1763   layerMEs.meResolxMFRphiwclus4 = nullptr;
1764   layerMEs.meResLFRphi = nullptr;
1765   layerMEs.meResMFRphi = nullptr;
1766   layerMEs.meResMFRphiwclus1 = nullptr;
1767   layerMEs.meResMFRphiwclus2 = nullptr;
1768   layerMEs.meResMFRphiwclus3 = nullptr;
1769   layerMEs.meResMFRphiwclus4 = nullptr;
1770   layerMEs.mePullLFRphi = nullptr;
1771   layerMEs.mePullMFRphi = nullptr;
1772   layerMEs.mePullMFRphiwclus1 = nullptr;
1773   layerMEs.mePullMFRphiwclus2 = nullptr;
1774   layerMEs.mePullMFRphiwclus3 = nullptr;
1775   layerMEs.mePullMFRphiwclus4 = nullptr;
1776   layerMEs.meTrackangleRphi = nullptr;
1777   layerMEs.meTrackanglebetaRphi = nullptr;
1778   layerMEs.meTrackangle2Rphi = nullptr;
1779   layerMEs.mePullTrackangleProfileRphi = nullptr;
1780   layerMEs.mePullTrackangle2DRphi = nullptr;
1781   layerMEs.meTrackwidthRphi = nullptr;
1782   layerMEs.meExpectedwidthRphi = nullptr;
1783   layerMEs.meClusterwidthRphi = nullptr;
1784   layerMEs.meCategoryRphi = nullptr;
1785   layerMEs.mePullTrackwidthProfileRphi = nullptr;
1786   layerMEs.mePullTrackwidthProfileRphiwclus1 = nullptr;
1787   layerMEs.mePullTrackwidthProfileRphiwclus2 = nullptr;
1788   layerMEs.mePullTrackwidthProfileRphiwclus3 = nullptr;
1789   layerMEs.mePullTrackwidthProfileRphiwclus4 = nullptr;
1790   layerMEs.mePullTrackwidthProfileCategory1Rphi = nullptr;
1791   layerMEs.mePullTrackwidthProfileCategory2Rphi = nullptr;
1792   layerMEs.mePullTrackwidthProfileCategory3Rphi = nullptr;
1793   layerMEs.mePullTrackwidthProfileCategory4Rphi = nullptr;
1794   layerMEs.meResolxMFTrackwidthProfileRphi = nullptr;
1795 
1796   layerMEs.meResolxMFTrackwidthProfileWclus1Rphi = nullptr;
1797   layerMEs.meResolxMFTrackwidthProfileWclus2Rphi = nullptr;
1798   layerMEs.meResolxMFTrackwidthProfileWclus3Rphi = nullptr;
1799   layerMEs.meResolxMFTrackwidthProfileWclus4Rphi = nullptr;
1800   layerMEs.meResMFTrackwidthProfileWclus1Rphi = nullptr;
1801   layerMEs.meResMFTrackwidthProfileWclus2Rphi = nullptr;
1802   layerMEs.meResMFTrackwidthProfileWclus3Rphi = nullptr;
1803   layerMEs.meResMFTrackwidthProfileWclus4Rphi = nullptr;
1804 
1805   layerMEs.meResolxMFTrackwidthProfileCategory1Rphi = nullptr;
1806   layerMEs.meResolxMFTrackwidthProfileCategory2Rphi = nullptr;
1807   layerMEs.meResolxMFTrackwidthProfileCategory3Rphi = nullptr;
1808   layerMEs.meResolxMFTrackwidthProfileCategory4Rphi = nullptr;
1809   layerMEs.meResolxMFClusterwidthProfileCategory1Rphi = nullptr;
1810   layerMEs.meResolxMFAngleProfileRphi = nullptr;
1811   layerMEs.merapidityResProfilewclus1 = nullptr;
1812   layerMEs.merapidityResProfilewclus2 = nullptr;
1813   layerMEs.merapidityResProfilewclus3 = nullptr;
1814   layerMEs.merapidityResProfilewclus4 = nullptr;
1815 
1816   //WclusRphi
1817   if (layerswitchWclusRphi) {
1818     layerMEs.meWclusRphi = bookME1D(ibooker,
1819                                     "TH1WclusRphi",
1820                                     hidmanager.createHistoLayer("Wclus_rphi", "layer", label, "").c_str(),
1821                                     "Cluster Width - Number of strips that belong to the RecHit cluster");
1822     layerMEs.meWclusRphi->setAxisTitle("Cluster Width [nr strips] in " + label);
1823   }
1824   //AdcRphi
1825   if (layerswitchAdcRphi) {
1826     layerMEs.meAdcRphi = bookME1D(ibooker,
1827                                   "TH1AdcRphi",
1828                                   hidmanager.createHistoLayer("Adc_rphi", "layer", label, "").c_str(),
1829                                   "RecHit Cluster Charge");
1830     layerMEs.meAdcRphi->setAxisTitle("cluster charge [ADC] in " + label);
1831   }
1832   //ResolxLFRphi
1833   if (layerswitchResolxLFRphi) {
1834     layerMEs.meResolxLFRphi = bookME1D(ibooker,
1835                                        "TH1ResolxLFRphi",
1836                                        hidmanager.createHistoLayer("Resolx_LF_rphi", "layer", label, "").c_str(),
1837                                        "RecHit resol(x) coord.");  //<resolor>~20micron
1838     layerMEs.meResolxLFRphi->setAxisTitle("resol(x) RecHit coord. (local frame) in " + label);
1839   }
1840   //ResolxMFRphi
1841   if (layerswitchResolxMFRphi) {
1842     layerMEs.meResolxMFRphi = bookME1D(ibooker,
1843                                        "TH1ResolxMFRphi",
1844                                        hidmanager.createHistoLayer("Resolx_MF_rphi", "layer", label, "").c_str(),
1845                                        "RecHit resol(x) coord.");  //<resolor>~20micron
1846     layerMEs.meResolxMFRphi->setAxisTitle("resol(x) RecHit coord. (measurement frame) in " + label);
1847   }
1848   //ResolxMFRphiwclus1
1849   if (layerswitchResolxMFRphiwclus1) {
1850     layerMEs.meResolxMFRphiwclus1 =
1851         bookME1D(ibooker,
1852                  "TH1ResolxMFRphiwclus1",
1853                  hidmanager.createHistoLayer("Resolx_MF_wclus1_rphi", "layer", label, "").c_str(),
1854                  "RecHit resol(x) coord. w=1 ");  //<resolor>~20micron
1855     layerMEs.meResolxMFRphiwclus1->setAxisTitle("resol(x) RecHit coord. (measurement frame) for w=1 in " + label);
1856   }
1857   //ResolxMFRphiwclus2
1858   if (layerswitchResolxMFRphiwclus2) {
1859     layerMEs.meResolxMFRphiwclus2 =
1860         bookME1D(ibooker,
1861                  "TH1ResolxMFRphiwclus2",
1862                  hidmanager.createHistoLayer("Resolx_MF_wclus2_rphi", "layer", label, "").c_str(),
1863                  "RecHit resol(x) coord. w=2 ");  //<resolor>~20micron
1864     layerMEs.meResolxMFRphiwclus2->setAxisTitle("resol(x) RecHit coord. (measurement frame) for w=2 in " + label);
1865   }
1866   //ResolxMFRphiwclus3
1867   if (layerswitchResolxMFRphiwclus3) {
1868     layerMEs.meResolxMFRphiwclus3 =
1869         bookME1D(ibooker,
1870                  "TH1ResolxMFRphiwclus3",
1871                  hidmanager.createHistoLayer("Resolx_MF_wclus3_rphi", "layer", label, "").c_str(),
1872                  "RecHit resol(x) coord. w=3 ");  //<resolor>~20micron
1873     layerMEs.meResolxMFRphiwclus3->setAxisTitle("resol(x) RecHit coord. (measurement frame) for w=3 in " + label);
1874   }
1875   //ResolxMFRphiwclus4
1876   if (layerswitchResolxMFRphiwclus4) {
1877     layerMEs.meResolxMFRphiwclus4 =
1878         bookME1D(ibooker,
1879                  "TH1ResolxMFRphiwclus4",
1880                  hidmanager.createHistoLayer("Resolx_MF_wclus4_rphi", "layer", label, "").c_str(),
1881                  "RecHit resol(x) coord. w=4 ");  //<resolor>~20micron
1882     layerMEs.meResolxMFRphiwclus4->setAxisTitle("resol(x) RecHit coord. (measurement frame) for w=4 in " + label);
1883   }
1884   //ResLFRphi
1885   if (layerswitchResLFRphi) {
1886     layerMEs.meResLFRphi = bookME1D(ibooker,
1887                                     "TH1ResLFRphi",
1888                                     hidmanager.createHistoLayer("Res_LF_rphi", "layer", label, "").c_str(),
1889                                     "Residual of the hit x coordinate");
1890     layerMEs.meResLFRphi->setAxisTitle("Hit Residuals(x) (local frame) in " + label);
1891   }
1892   //ResMFRphi
1893   if (layerswitchResMFRphi) {
1894     layerMEs.meResMFRphi = bookME1D(ibooker,
1895                                     "TH1ResMFRphi",
1896                                     hidmanager.createHistoLayer("Res_MF_Rphi", "layer", label, "").c_str(),
1897                                     "Residual of the hit x coordinate");
1898     layerMEs.meResMFRphi->setAxisTitle("Hit Residuals(x) (measurement frame) in " + label);
1899   }
1900   //ResMFRphiwclus1
1901   if (layerswitchResMFRphiwclus1) {
1902     layerMEs.meResMFRphiwclus1 = bookME1D(ibooker,
1903                                           "TH1ResMFRphiwclus1",
1904                                           hidmanager.createHistoLayer("Res_MF_wclus1_Rphi", "layer", label, "").c_str(),
1905                                           "Residual of the hit x coordinate w=1");
1906     layerMEs.meResMFRphiwclus1->setAxisTitle("Hit Residuals(x) (measurement frame) for w=1 in " + label);
1907   }
1908   //ResMFRphiwclus2
1909   if (layerswitchResMFRphiwclus2) {
1910     layerMEs.meResMFRphiwclus2 = bookME1D(ibooker,
1911                                           "TH1ResMFRphiwclus2",
1912                                           hidmanager.createHistoLayer("Res_MF_wclus2_Rphi", "layer", label, "").c_str(),
1913                                           "Residual of the hit x coordinate w=2");
1914     layerMEs.meResMFRphiwclus2->setAxisTitle("Hit Residuals(x) (measurement frame) for w=2 in " + label);
1915   }
1916   //ResMFRphiwclus3
1917   if (layerswitchResMFRphiwclus3) {
1918     layerMEs.meResMFRphiwclus3 = bookME1D(ibooker,
1919                                           "TH1ResMFRphiwclus3",
1920                                           hidmanager.createHistoLayer("Res_MF_wclus3_Rphi", "layer", label, "").c_str(),
1921                                           "Residual of the hit x coordinate w=3");
1922     layerMEs.meResMFRphiwclus3->setAxisTitle("Hit Residuals(x) (measurement frame) for w=3 in " + label);
1923   }
1924   //ResMFRphiwclus4
1925   if (layerswitchResMFRphiwclus4) {
1926     layerMEs.meResMFRphiwclus4 = bookME1D(ibooker,
1927                                           "TH1ResMFRphiwclus4",
1928                                           hidmanager.createHistoLayer("Res_MF_wclus4_Rphi", "layer", label, "").c_str(),
1929                                           "Residual of the hit x coordinate w=4");
1930     layerMEs.meResMFRphiwclus4->setAxisTitle("Hit Residuals(x) (measurement frame) for w=4 in " + label);
1931   }
1932   //PullLFRphi
1933   if (layerswitchPullLFRphi) {
1934     layerMEs.mePullLFRphi = bookME1D(ibooker,
1935                                      "TH1PullLFRphi",
1936                                      hidmanager.createHistoLayer("Pull_LF_rphi", "layer", label, "").c_str(),
1937                                      "Pull distribution");
1938     layerMEs.mePullLFRphi->setAxisTitle("Pull distribution (local frame) in " + label);
1939   }
1940   //PullMFRphi
1941   if (layerswitchPullMFRphi) {
1942     layerMEs.mePullMFRphi = bookME1D(ibooker,
1943                                      "TH1PullMFRphi",
1944                                      hidmanager.createHistoLayer("Pull_MF_rphi", "layer", label, "").c_str(),
1945                                      "Pull distribution");
1946     layerMEs.mePullMFRphi->setAxisTitle("Pull distribution (measurement frame) in " + label);
1947   }
1948   //PullMFRphiwclus1
1949   if (layerswitchPullMFRphiwclus1) {
1950     layerMEs.mePullMFRphiwclus1 =
1951         bookME1D(ibooker,
1952                  "TH1PullMFRphiwclus1",
1953                  hidmanager.createHistoLayer("Pull_MF_wclus1_rphi", "layer", label, "").c_str(),
1954                  "Pull distribution w=1");
1955     layerMEs.mePullMFRphiwclus1->setAxisTitle("Pull distribution (measurement frame) for w=1 in " + label);
1956   }
1957   //PullMFRphiwclus2
1958   if (layerswitchPullMFRphiwclus2) {
1959     layerMEs.mePullMFRphiwclus2 =
1960         bookME1D(ibooker,
1961                  "TH1PullMFRphiwclus2",
1962                  hidmanager.createHistoLayer("Pull_MF_wclus2_rphi", "layer", label, "").c_str(),
1963                  "Pull distribution w=2");
1964     layerMEs.mePullMFRphiwclus2->setAxisTitle("Pull distribution (measurement frame) for w=2 in " + label);
1965   }
1966   //PullMFRphiwclus3
1967   if (layerswitchPullMFRphiwclus3) {
1968     layerMEs.mePullMFRphiwclus3 =
1969         bookME1D(ibooker,
1970                  "TH1PullMFRphiwclus3",
1971                  hidmanager.createHistoLayer("Pull_MF_wclus3_rphi", "layer", label, "").c_str(),
1972                  "Pull distribution w=3");
1973     layerMEs.mePullMFRphiwclus3->setAxisTitle("Pull distribution (measurement frame) for w=3 in " + label);
1974   }
1975   //PullMFRphiwclus4
1976   if (layerswitchPullMFRphiwclus4) {
1977     layerMEs.mePullMFRphiwclus4 =
1978         bookME1D(ibooker,
1979                  "TH1PullMFRphiwclus4",
1980                  hidmanager.createHistoLayer("Pull_MF_wclus4_rphi", "layer", label, "").c_str(),
1981                  "Pull distribution w=4");
1982     layerMEs.mePullMFRphiwclus4->setAxisTitle("Pull distribution (measurement frame) for w=4 in " + label);
1983   }
1984 
1985   if (layerswitchTrackangleRphi) {
1986     layerMEs.meTrackangleRphi = bookME1D(ibooker,
1987                                          "TH1TrackangleRphi",
1988                                          hidmanager.createHistoLayer("Track_angle_Rphi", "layer", label, "").c_str(),
1989                                          "Track angle alpha");
1990     layerMEs.meTrackangleRphi->setAxisTitle("Track angle in " + label);
1991   }
1992   if (layerswitchTrackanglebetaRphi) {
1993     layerMEs.meTrackanglebetaRphi =
1994         bookME1D(ibooker,
1995                  "TH1TrackanglebetaRphi",
1996                  hidmanager.createHistoLayer("Track_angle_beta_Rphi", "layer", label, "").c_str(),
1997                  "Track angle beta");
1998     layerMEs.meTrackanglebetaRphi->setAxisTitle("" + label);
1999   }
2000   if (layerswitchTrackangle2Rphi) {
2001     layerMEs.meTrackangle2Rphi = bookME1D(ibooker,
2002                                           "TH1Trackangle2Rphi",
2003                                           hidmanager.createHistoLayer("Track_angle2_Rphi", "layer", label, "").c_str(),
2004                                           "");
2005     layerMEs.meTrackangle2Rphi->setAxisTitle("" + label);
2006   }
2007   if (layerswitchPullTrackangleProfileRphi) {
2008     layerMEs.mePullTrackangleProfileRphi =
2009         bookMEProfile(ibooker,
2010                       "TProfPullTrackangleProfileRphi",
2011                       hidmanager.createHistoLayer("Pull_Trackangle_Profile_Rphi", "layer", label, "").c_str(),
2012                       "Profile of Pull in MF vs track angle alpha");
2013     layerMEs.mePullTrackangleProfileRphi->setAxisTitle("Track angle alpha in " + label, 1);
2014     layerMEs.mePullTrackangleProfileRphi->setAxisTitle("Pull (MF) in " + label, 2);
2015   }
2016   if (layerswitchPullTrackangle2DRphi) {
2017     layerMEs.mePullTrackangle2DRphi =
2018         bookME1D(ibooker,
2019                  "TH1PullTrackangle2DRphi",
2020                  hidmanager.createHistoLayer("Pull_Trackangle_2D_Rphi", "layer", label, "").c_str(),
2021                  "");
2022     layerMEs.mePullTrackangle2DRphi->setAxisTitle("" + label);
2023   }
2024   if (layerswitchTrackwidthRphi) {
2025     layerMEs.meTrackwidthRphi = bookME1D(ibooker,
2026                                          "TH1TrackwidthRphi",
2027                                          hidmanager.createHistoLayer("Track_width_Rphi", "layer", label, "").c_str(),
2028                                          "Track width");
2029     layerMEs.meTrackwidthRphi->setAxisTitle("Track width in " + label);
2030   }
2031   if (layerswitchExpectedwidthRphi) {
2032     layerMEs.meExpectedwidthRphi =
2033         bookME1D(ibooker,
2034                  "TH1ExpectedwidthRphi",
2035                  hidmanager.createHistoLayer("Expected_width_Rphi", "layer", label, "").c_str(),
2036                  "Expected width");
2037     layerMEs.meExpectedwidthRphi->setAxisTitle("Expected width in " + label);
2038   }
2039   if (layerswitchClusterwidthRphi) {
2040     layerMEs.meClusterwidthRphi =
2041         bookME1D(ibooker,
2042                  "TH1ClusterwidthRphi",
2043                  hidmanager.createHistoLayer("Cluster_width_Rphi", "layer", label, "").c_str(),
2044                  "Cluster width");
2045     layerMEs.meClusterwidthRphi->setAxisTitle("Cluster width in " + label);
2046   }
2047   if (layerswitchCategoryRphi) {
2048     layerMEs.meCategoryRphi = bookME1D(ibooker,
2049                                        "TH1CategoryRphi",
2050                                        hidmanager.createHistoLayer("Category_Rphi", "layer", label, "").c_str(),
2051                                        "Category");
2052     layerMEs.meCategoryRphi->setAxisTitle("Category in " + label);
2053   }
2054   if (layerswitchPullTrackwidthProfileRphi) {
2055     layerMEs.mePullTrackwidthProfileRphi =
2056         bookMEProfile(ibooker,
2057                       "TProfPullTrackwidthProfileRphi",
2058                       hidmanager.createHistoLayer("Pull_Track_width_Profile_Rphi", "layer", label, "").c_str(),
2059                       "Profile of Pull in MF vs track width");
2060     layerMEs.mePullTrackwidthProfileRphi->setAxisTitle("track width in " + label, 1);
2061     layerMEs.mePullTrackwidthProfileRphi->setAxisTitle("Pull (MF) in " + label, 2);
2062   }
2063   if (layerswitchPullTrackwidthProfileRphiwclus1) {
2064     layerMEs.mePullTrackwidthProfileRphiwclus1 =
2065         bookMEProfile(ibooker,
2066                       "TProfPullTrackwidthProfileRphiwclus1",
2067                       hidmanager.createHistoLayer("Pull_Track_width_Profile_Rphi_wclus1", "layer", label, "").c_str(),
2068                       "Profile of Pull in MF vs track width for w=1");
2069     layerMEs.mePullTrackwidthProfileRphiwclus1->setAxisTitle("track width for w=1 in " + label, 1);
2070     layerMEs.mePullTrackwidthProfileRphiwclus1->setAxisTitle("Pull (MF) for w=1 in " + label, 2);
2071   }
2072   if (layerswitchPullTrackwidthProfileRphiwclus2) {
2073     layerMEs.mePullTrackwidthProfileRphiwclus2 =
2074         bookMEProfile(ibooker,
2075                       "TProfPullTrackwidthProfileRphiwclus2",
2076                       hidmanager.createHistoLayer("Pull_Track_width_Profile_Rphi_wclus2", "layer", label, "").c_str(),
2077                       "Profile of Pull in MF vs track width for w=2");
2078     layerMEs.mePullTrackwidthProfileRphiwclus2->setAxisTitle("track width for w=2 in " + label, 1);
2079     layerMEs.mePullTrackwidthProfileRphiwclus2->setAxisTitle("Pull (MF) for w=2 in " + label, 2);
2080   }
2081   if (layerswitchPullTrackwidthProfileRphiwclus3) {
2082     layerMEs.mePullTrackwidthProfileRphiwclus3 =
2083         bookMEProfile(ibooker,
2084                       "TProfPullTrackwidthProfileRphiwclus3",
2085                       hidmanager.createHistoLayer("Pull_Track_width_Profile_Rphi_wclus3", "layer", label, "").c_str(),
2086                       "Profile of Pull in MF vs track width for w=3");
2087     layerMEs.mePullTrackwidthProfileRphiwclus3->setAxisTitle("track width for w=3 in " + label, 1);
2088     layerMEs.mePullTrackwidthProfileRphiwclus3->setAxisTitle("Pull (MF) for w=3 in " + label, 2);
2089   }
2090   if (layerswitchPullTrackwidthProfileRphiwclus4) {
2091     layerMEs.mePullTrackwidthProfileRphiwclus4 =
2092         bookMEProfile(ibooker,
2093                       "TProfPullTrackwidthProfileRphiwclus4",
2094                       hidmanager.createHistoLayer("Pull_Track_width_Profile_Rphi_wclus4", "layer", label, "").c_str(),
2095                       "Profile of Pull in MF vs track width for w=4");
2096     layerMEs.mePullTrackwidthProfileRphiwclus4->setAxisTitle("track width for w=4 in " + label, 1);
2097     layerMEs.mePullTrackwidthProfileRphiwclus4->setAxisTitle("Pull (MF) for w=4 in " + label, 2);
2098   }
2099   if (layerswitchPullTrackwidthProfileCategory1Rphi) {
2100     layerMEs.mePullTrackwidthProfileCategory1Rphi = bookMEProfile(
2101         ibooker,
2102         "TProfPullTrackwidthProfileCategory1Rphi",
2103         hidmanager.createHistoLayer("Pull_Track_width_Profile_Category1_Rphi", "layer", label, "").c_str(),
2104         "Profile of Pull in MF vs track width for Category 1");
2105     layerMEs.mePullTrackwidthProfileCategory1Rphi->setAxisTitle("track width for Category 1 in " + label, 1);
2106     layerMEs.mePullTrackwidthProfileCategory1Rphi->setAxisTitle("Pull (MF) for Category 1 in " + label, 2);
2107   }
2108   if (layerswitchPullTrackwidthProfileCategory2Rphi) {
2109     layerMEs.mePullTrackwidthProfileCategory2Rphi = bookMEProfile(
2110         ibooker,
2111         "TProfPullTrackwidthProfileCategory2Rphi",
2112         hidmanager.createHistoLayer("Pull_Track_width_Profile_Category2_Rphi", "layer", label, "").c_str(),
2113         "Profile of Pull in MF vs track width for Category 2");
2114     layerMEs.mePullTrackwidthProfileCategory2Rphi->setAxisTitle("track width for Category 2 in " + label, 1);
2115     layerMEs.mePullTrackwidthProfileCategory2Rphi->setAxisTitle("Pull (MF) for Category 2 in " + label, 2);
2116   }
2117   if (layerswitchPullTrackwidthProfileCategory3Rphi) {
2118     layerMEs.mePullTrackwidthProfileCategory3Rphi = bookMEProfile(
2119         ibooker,
2120         "TProfPullTrackwidthProfileCategory3Rphi",
2121         hidmanager.createHistoLayer("Pull_Track_width_Profile_Category3_Rphi", "layer", label, "").c_str(),
2122         "Profile of Pull in MF vs track width for Category 3");
2123     layerMEs.mePullTrackwidthProfileCategory3Rphi->setAxisTitle("track width for Category 3 in " + label, 1);
2124     layerMEs.mePullTrackwidthProfileCategory3Rphi->setAxisTitle("Pull (MF) for Category 3 in " + label, 2);
2125   }
2126   if (layerswitchPullTrackwidthProfileCategory4Rphi) {
2127     layerMEs.mePullTrackwidthProfileCategory4Rphi = bookMEProfile(
2128         ibooker,
2129         "TProfPullTrackwidthProfileCategory4Rphi",
2130         hidmanager.createHistoLayer("Pull_Track_width_Profile_Category4_Rphi", "layer", label, "").c_str(),
2131         "Profile of Pull in MF vs track width for Category 4");
2132     layerMEs.mePullTrackwidthProfileCategory4Rphi->setAxisTitle("track width for Category 4 in " + label, 1);
2133     layerMEs.mePullTrackwidthProfileCategory4Rphi->setAxisTitle("Pull (MF) for Category 4 in " + label, 2);
2134   }
2135   if (layerswitchResolxMFTrackwidthProfileRphi) {
2136     layerMEs.meResolxMFTrackwidthProfileRphi =
2137         bookMEProfile(ibooker,
2138                       "TProfResolxMFTrackwidthProfileRphi",
2139                       hidmanager.createHistoLayer("ResolxMF_Track_width_Profile_Rphi", "layer", label, "").c_str(),
2140                       "Profile of Resolution in MF vs track width");
2141     layerMEs.meResolxMFTrackwidthProfileRphi->setAxisTitle("track width in " + label, 1);
2142     layerMEs.meResolxMFTrackwidthProfileRphi->setAxisTitle("Resolution in MF in " + label, 2);
2143   }
2144 
2145   if (layerswitchResolxMFTrackwidthProfileWclus1Rphi) {
2146     layerMEs.meResolxMFTrackwidthProfileWclus1Rphi = bookMEProfile(
2147         ibooker,
2148         "TProfResolxMFTrackwidthProfileWclus1Rphi",
2149         hidmanager.createHistoLayer("ResolxMF_Track_width_Profile_Wclus1_Rphi", "layer", label, "").c_str(),
2150         "Profile of Resolution in MF vs track width for w=1");
2151     layerMEs.meResolxMFTrackwidthProfileWclus1Rphi->setAxisTitle("track width for w=1 in " + label, 1);
2152     layerMEs.meResolxMFTrackwidthProfileWclus1Rphi->setAxisTitle("Resolution in MF for w=1 in " + label, 2);
2153   }
2154   if (layerswitchResolxMFTrackwidthProfileWclus2Rphi) {
2155     layerMEs.meResolxMFTrackwidthProfileWclus2Rphi = bookMEProfile(
2156         ibooker,
2157         "TProfResolxMFTrackwidthProfileWclus2Rphi",
2158         hidmanager.createHistoLayer("ResolxMF_Track_width_Profile_Wclus2_Rphi", "layer", label, "").c_str(),
2159         "Profile of Resolution in MF vs track width for w=2");
2160     layerMEs.meResolxMFTrackwidthProfileWclus2Rphi->setAxisTitle("track width for w=2 in " + label, 1);
2161     layerMEs.meResolxMFTrackwidthProfileWclus2Rphi->setAxisTitle("Resolution in MF for w=2 in " + label, 2);
2162   }
2163   if (layerswitchResolxMFTrackwidthProfileWclus3Rphi) {
2164     layerMEs.meResolxMFTrackwidthProfileWclus3Rphi = bookMEProfile(
2165         ibooker,
2166         "TProfResolxMFTrackwidthProfileWclus3Rphi",
2167         hidmanager.createHistoLayer("ResolxMF_Track_width_Profile_Wclus3_Rphi", "layer", label, "").c_str(),
2168         "Profile of Resolution in MF vs track width for w=3");
2169     layerMEs.meResolxMFTrackwidthProfileWclus3Rphi->setAxisTitle("track width for w=3 in " + label, 1);
2170     layerMEs.meResolxMFTrackwidthProfileWclus3Rphi->setAxisTitle("Resolution in MF for w=3 in " + label, 2);
2171   }
2172   if (layerswitchResolxMFTrackwidthProfileWclus4Rphi) {
2173     layerMEs.meResolxMFTrackwidthProfileWclus4Rphi = bookMEProfile(
2174         ibooker,
2175         "TProfResolxMFTrackwidthProfileWclus4Rphi",
2176         hidmanager.createHistoLayer("ResolxMF_Track_width_Profile_Wclus4_Rphi", "layer", label, "").c_str(),
2177         "Profile of Resolution in MF vs track width for w=4");
2178     layerMEs.meResolxMFTrackwidthProfileWclus4Rphi->setAxisTitle("track width for w=4 in " + label, 1);
2179     layerMEs.meResolxMFTrackwidthProfileWclus4Rphi->setAxisTitle("Resolution in MF for w=4 in " + label, 2);
2180   }
2181   if (layerswitchResMFTrackwidthProfileWclus1Rphi) {
2182     layerMEs.meResMFTrackwidthProfileWclus1Rphi =
2183         bookMEProfile(ibooker,
2184                       "TProfResMFTrackwidthProfileWclus1Rphi",
2185                       hidmanager.createHistoLayer("ResMF_Track_width_Profile_Wclus1_Rphi", "layer", label, "").c_str(),
2186                       "Profile of Residuals(x) in MF vs track width for w=1");
2187     layerMEs.meResMFTrackwidthProfileWclus1Rphi->setAxisTitle("track width for w=1 in " + label, 1);
2188     layerMEs.meResMFTrackwidthProfileWclus1Rphi->setAxisTitle("Residuals(x) in MF for w=1 in " + label, 2);
2189   }
2190   if (layerswitchResMFTrackwidthProfileWclus2Rphi) {
2191     layerMEs.meResMFTrackwidthProfileWclus2Rphi =
2192         bookMEProfile(ibooker,
2193                       "TProfResMFTrackwidthProfileWclus2Rphi",
2194                       hidmanager.createHistoLayer("ResMF_Track_width_Profile_Wclus2_Rphi", "layer", label, "").c_str(),
2195                       "Profile of Residuals(x) in MF vs track width for w=2");
2196     layerMEs.meResMFTrackwidthProfileWclus2Rphi->setAxisTitle("track width for w=2 in " + label, 1);
2197     layerMEs.meResMFTrackwidthProfileWclus2Rphi->setAxisTitle("Residuals(x) in MF for w=2 in " + label, 2);
2198   }
2199   if (layerswitchResMFTrackwidthProfileWclus3Rphi) {
2200     layerMEs.meResMFTrackwidthProfileWclus3Rphi =
2201         bookMEProfile(ibooker,
2202                       "TProfResMFTrackwidthProfileWclus3Rphi",
2203                       hidmanager.createHistoLayer("ResMF_Track_width_Profile_Wclus3_Rphi", "layer", label, "").c_str(),
2204                       "Profile of Residuals(x) in MF vs track width for w=3");
2205     layerMEs.meResMFTrackwidthProfileWclus3Rphi->setAxisTitle("track width for w=3 in " + label, 1);
2206     layerMEs.meResMFTrackwidthProfileWclus3Rphi->setAxisTitle("Residuals(x) in MF for w=3 in " + label, 2);
2207   }
2208   if (layerswitchResMFTrackwidthProfileWclus4Rphi) {
2209     layerMEs.meResMFTrackwidthProfileWclus4Rphi =
2210         bookMEProfile(ibooker,
2211                       "TProfResMFTrackwidthProfileWclus4Rphi",
2212                       hidmanager.createHistoLayer("ResMF_Track_width_Profile_Wclus4_Rphi", "layer", label, "").c_str(),
2213                       "Profile of Residuals(x) in MF vs track width for w=4");
2214     layerMEs.meResMFTrackwidthProfileWclus4Rphi->setAxisTitle("track width for w=4 in " + label, 1);
2215     layerMEs.meResMFTrackwidthProfileWclus4Rphi->setAxisTitle("Residuals(x) in MF for w=4 in " + label, 2);
2216   }
2217 
2218   if (layerswitchResolxMFTrackwidthProfileCategory1Rphi) {
2219     layerMEs.meResolxMFTrackwidthProfileCategory1Rphi = bookMEProfile(
2220         ibooker,
2221         "TProfResolxMFTrackwidthProfileCategory1Rphi",
2222         hidmanager.createHistoLayer("ResolxMF_Track_width_Profile_Category1_Rphi", "layer", label, "").c_str(),
2223         "Profile of Resolution in MF vs track width for Category 1");
2224     layerMEs.meResolxMFTrackwidthProfileCategory1Rphi->setAxisTitle("track width for Category 1 in " + label, 1);
2225     layerMEs.meResolxMFTrackwidthProfileCategory1Rphi->setAxisTitle("Resolution in MF for Category 1 in " + label, 2);
2226   }
2227   if (layerswitchResolxMFTrackwidthProfileCategory2Rphi) {
2228     layerMEs.meResolxMFTrackwidthProfileCategory2Rphi = bookMEProfile(
2229         ibooker,
2230         "TProfResolxMFTrackwidthProfileCategory2Rphi",
2231         hidmanager.createHistoLayer("ResolxMF_Track_width_Profile_Category2_Rphi", "layer", label, "").c_str(),
2232         "Profile of Resolution in MF vs track width for Category 2");
2233     layerMEs.meResolxMFTrackwidthProfileCategory2Rphi->setAxisTitle("track width for Category 2 in " + label, 1);
2234     layerMEs.meResolxMFTrackwidthProfileCategory2Rphi->setAxisTitle("Resolution in MF for Category 2 in " + label, 2);
2235   }
2236   if (layerswitchResolxMFTrackwidthProfileCategory3Rphi) {
2237     layerMEs.meResolxMFTrackwidthProfileCategory3Rphi = bookMEProfile(
2238         ibooker,
2239         "TProfResolxMFTrackwidthProfileCategory3Rphi",
2240         hidmanager.createHistoLayer("ResolxMF_Track_width_Profile_Category3_Rphi", "layer", label, "").c_str(),
2241         "Profile of Resolution in MF vs track width for Category 3");
2242     layerMEs.meResolxMFTrackwidthProfileCategory3Rphi->setAxisTitle("track width for Category 3 in " + label, 1);
2243     layerMEs.meResolxMFTrackwidthProfileCategory3Rphi->setAxisTitle("Resolution in MF for Category 3 in " + label, 2);
2244   }
2245   if (layerswitchResolxMFTrackwidthProfileCategory4Rphi) {
2246     layerMEs.meResolxMFTrackwidthProfileCategory4Rphi = bookMEProfile(
2247         ibooker,
2248         "TProfResolxMFTrackwidthProfileCategory4Rphi",
2249         hidmanager.createHistoLayer("ResolxMF_Track_width_Profile_Category3_Rphi", "layer", label, "").c_str(),
2250         "Profile of Resolution in MF vs track width for Category 4");
2251     layerMEs.meResolxMFTrackwidthProfileCategory4Rphi->setAxisTitle("track width for Category 4 in " + label, 1);
2252     layerMEs.meResolxMFTrackwidthProfileCategory4Rphi->setAxisTitle("Resolution in MF for Category 4 in " + label, 2);
2253   }
2254   if (layerswitchResolxMFClusterwidthProfileCategory1Rphi) {
2255     layerMEs.meResolxMFClusterwidthProfileCategory1Rphi = bookMEProfile(
2256         ibooker,
2257         "TProfResolxMFClusterwidthProfileCategory1Rphi",
2258         hidmanager.createHistoLayer("ResolxMF_Cluster_width_Profile_Category1_Rphi", "layer", label, "").c_str(),
2259         "Profile of Resolution in MF vs cluster width for Category 1");
2260     layerMEs.meResolxMFClusterwidthProfileCategory1Rphi->setAxisTitle("cluster width for Category 1 in " + label, 1);
2261     layerMEs.meResolxMFClusterwidthProfileCategory1Rphi->setAxisTitle("Resolution in MF for Category 1 in " + label, 2);
2262   }
2263   if (layerswitchResolxMFAngleProfileRphi) {
2264     layerMEs.meResolxMFAngleProfileRphi =
2265         bookMEProfile(ibooker,
2266                       "TProfResolxMFAngleProfileRphi",
2267                       hidmanager.createHistoLayer("ResolxMF_Angle_Profile_Rphi", "layer", label, "").c_str(),
2268                       "Profile of Resolution in MF vs track angle alpha");
2269     layerMEs.meResolxMFAngleProfileRphi->setAxisTitle("track angle alpha in " + label, 1);
2270     layerMEs.meResolxMFAngleProfileRphi->setAxisTitle("Resolution in MF in " + label, 2);
2271   }
2272   if (layerswitchrapidityResProfilewclus1) {
2273     layerMEs.merapidityResProfilewclus1 =
2274         bookMEProfile(ibooker,
2275                       "TProfrapidityResProfilewclus1",
2276                       hidmanager.createHistoLayer("rapidity_Res_Profile_wclus1", "layer", label, "").c_str(),
2277                       "Profile of rapidity vs Res for w=1");
2278     layerMEs.merapidityResProfilewclus1->setAxisTitle("Res for w=1 in " + label, 1);
2279     layerMEs.merapidityResProfilewclus1->setAxisTitle("rapidity for w=1 in " + label, 2);
2280   }
2281   if (layerswitchrapidityResProfilewclus2) {
2282     layerMEs.merapidityResProfilewclus2 =
2283         bookMEProfile(ibooker,
2284                       "TProfrapidityResProfilewclus2",
2285                       hidmanager.createHistoLayer("rapidity_Res_Profile_wclus2", "layer", label, "").c_str(),
2286                       "Profile of rapidity vs Res for w=2");
2287     layerMEs.merapidityResProfilewclus2->setAxisTitle("Res for w=2 in " + label, 1);
2288     layerMEs.merapidityResProfilewclus2->setAxisTitle("rapidity for w=2 in " + label, 2);
2289   }
2290   if (layerswitchrapidityResProfilewclus3) {
2291     layerMEs.merapidityResProfilewclus3 =
2292         bookMEProfile(ibooker,
2293                       "TProfrapidityResProfilewclus3",
2294                       hidmanager.createHistoLayer("rapidity_Res_Profile_wclus3", "layer", label, "").c_str(),
2295                       "Profile of rapidity vs Res for w=3");
2296     layerMEs.merapidityResProfilewclus3->setAxisTitle("Res for w=3 in " + label, 1);
2297     layerMEs.merapidityResProfilewclus3->setAxisTitle("rapidity for w=3 in " + label, 2);
2298   }
2299   if (layerswitchrapidityResProfilewclus4) {
2300     layerMEs.merapidityResProfilewclus4 =
2301         bookMEProfile(ibooker,
2302                       "TProfrapidityResProfilewclus4",
2303                       hidmanager.createHistoLayer("rapidity_Res_Profile_wclus4", "layer", label, "").c_str(),
2304                       "Profile of rapidity vs Res for w=4");
2305     layerMEs.merapidityResProfilewclus4->setAxisTitle("Res for w=4 in " + label, 1);
2306     layerMEs.merapidityResProfilewclus4->setAxisTitle("rapidity for w=4 in " + label, 2);
2307   }
2308 
2309   LayerMEsMap[label] = layerMEs;
2310 }
2311 //------------------------------------------------------------------------------------------
2312 void SiStripTrackingRecHitsValid::createStereoAndMatchedMEs(DQMStore::IBooker &ibooker, std::string label) {
2313   SiStripHistoId hidmanager;
2314   StereoAndMatchedMEs stereoandmatchedMEs;
2315 
2316   stereoandmatchedMEs.meWclusSas = nullptr;
2317   stereoandmatchedMEs.meAdcSas = nullptr;
2318   stereoandmatchedMEs.meResolxLFSas = nullptr;
2319   stereoandmatchedMEs.meResolxMFSas = nullptr;
2320   stereoandmatchedMEs.meResLFSas = nullptr;
2321   stereoandmatchedMEs.meResMFSas = nullptr;
2322   stereoandmatchedMEs.mePullLFSas = nullptr;
2323   stereoandmatchedMEs.mePullMFSas = nullptr;
2324   stereoandmatchedMEs.meTrackangleSas = nullptr;
2325   stereoandmatchedMEs.meTrackanglebetaSas = nullptr;
2326   stereoandmatchedMEs.mePullTrackangleProfileSas = nullptr;
2327   stereoandmatchedMEs.meTrackwidthSas = nullptr;
2328   stereoandmatchedMEs.meExpectedwidthSas = nullptr;
2329   stereoandmatchedMEs.meClusterwidthSas = nullptr;
2330   stereoandmatchedMEs.meCategorySas = nullptr;
2331   stereoandmatchedMEs.mePullTrackwidthProfileSas = nullptr;
2332   stereoandmatchedMEs.mePullTrackwidthProfileCategory1Sas = nullptr;
2333   stereoandmatchedMEs.mePullTrackwidthProfileCategory2Sas = nullptr;
2334   stereoandmatchedMEs.mePullTrackwidthProfileCategory3Sas = nullptr;
2335   stereoandmatchedMEs.mePullTrackwidthProfileCategory4Sas = nullptr;
2336   stereoandmatchedMEs.meResolxMFTrackwidthProfileSas = nullptr;
2337   stereoandmatchedMEs.meResolxMFTrackwidthProfileCategory1Sas = nullptr;
2338   stereoandmatchedMEs.meResolxMFTrackwidthProfileCategory2Sas = nullptr;
2339   stereoandmatchedMEs.meResolxMFTrackwidthProfileCategory3Sas = nullptr;
2340   stereoandmatchedMEs.meResolxMFTrackwidthProfileCategory4Sas = nullptr;
2341   stereoandmatchedMEs.meResolxMFClusterwidthProfileCategory1Sas = nullptr;
2342   stereoandmatchedMEs.meResolxMFAngleProfileSas = nullptr;
2343 
2344   stereoandmatchedMEs.mePosxMatched = nullptr;
2345   stereoandmatchedMEs.mePosyMatched = nullptr;
2346   stereoandmatchedMEs.meResolxMatched = nullptr;
2347   stereoandmatchedMEs.meResolyMatched = nullptr;
2348   stereoandmatchedMEs.meResxMatched = nullptr;
2349   stereoandmatchedMEs.meResyMatched = nullptr;
2350   stereoandmatchedMEs.mePullxMatched = nullptr;
2351   stereoandmatchedMEs.mePullyMatched = nullptr;
2352 
2353   //WclusSas
2354   if (layerswitchWclusSas) {
2355     stereoandmatchedMEs.meWclusSas = bookME1D(ibooker,
2356                                               "TH1WclusSas",
2357                                               hidmanager.createHistoLayer("Wclus_sas", "layer", label, "").c_str(),
2358                                               "Cluster Width - Number of strips that belong to the RecHit cluster");
2359     stereoandmatchedMEs.meWclusSas->setAxisTitle("Cluster Width [nr strips] (stereo) in " + label);
2360   }
2361   //AdcSas
2362   if (layerswitchAdcSas) {
2363     stereoandmatchedMEs.meAdcSas = bookME1D(ibooker,
2364                                             "TH1AdcSas",
2365                                             hidmanager.createHistoLayer("Adc_sas", "layer", label, "").c_str(),
2366                                             "RecHit Cluster Charge");
2367     stereoandmatchedMEs.meAdcSas->setAxisTitle("cluster charge [ADC] (stereo) in " + label);
2368   }
2369   //ResolxLFSas
2370   if (layerswitchResolxLFSas) {
2371     stereoandmatchedMEs.meResolxLFSas =
2372         bookME1D(ibooker,
2373                  "TH1ResolxLFSas",
2374                  hidmanager.createHistoLayer("Resolx_LF_sas", "layer", label, "").c_str(),
2375                  "RecHit resol(x) coord.");
2376     stereoandmatchedMEs.meResolxLFSas->setAxisTitle("resol(x) RecHit coord. (local frame) (stereo) in " + label);
2377   }
2378   //ResolxMFSas
2379   if (layerswitchResolxMFSas) {
2380     stereoandmatchedMEs.meResolxMFSas =
2381         bookME1D(ibooker,
2382                  "TH1ResolxMFSas",
2383                  hidmanager.createHistoLayer("Resolx_MF_sas", "layer", label, "").c_str(),
2384                  "RecHit resol(x) coord.");
2385     stereoandmatchedMEs.meResolxMFSas->setAxisTitle("resol(x) RecHit coord. (measurement frame) (stereo) in " + label);
2386   }
2387   //ResLFSas
2388   if (layerswitchResLFSas) {
2389     stereoandmatchedMEs.meResLFSas = bookME1D(ibooker,
2390                                               "TH1ResLFSas",
2391                                               hidmanager.createHistoLayer("Res_LF_sas", "layer", label, "").c_str(),
2392                                               "Residual of the hit x coordinate");
2393     stereoandmatchedMEs.meResLFSas->setAxisTitle("Hit Residuals(x) (local frame) (stereo) in " + label);
2394   }
2395   //ResMFSas
2396   if (layerswitchResMFSas) {
2397     stereoandmatchedMEs.meResMFSas = bookME1D(ibooker,
2398                                               "TH1ResMFSas",
2399                                               hidmanager.createHistoLayer("Res_MF_sas", "layer", label, "").c_str(),
2400                                               "Residual of the hit x coordinate");
2401     stereoandmatchedMEs.meResMFSas->setAxisTitle("Hit Residuals(x) (stereo) in " + label);
2402   }
2403   //PullLFSas
2404   if (layerswitchPullLFSas) {
2405     stereoandmatchedMEs.mePullLFSas = bookME1D(ibooker,
2406                                                "TH1PullLFSas",
2407                                                hidmanager.createHistoLayer("Pull_LF_sas", "layer", label, "").c_str(),
2408                                                "Pull distribution");
2409     stereoandmatchedMEs.mePullLFSas->setAxisTitle("Pull distribution (local frame) (stereo) in " + label);
2410   }
2411   //PullMFSas
2412   if (layerswitchPullMFSas) {
2413     stereoandmatchedMEs.mePullMFSas = bookME1D(ibooker,
2414                                                "TH1PullMFSas",
2415                                                hidmanager.createHistoLayer("Pull_MF_sas", "layer", label, "").c_str(),
2416                                                "Pull distribution");
2417     stereoandmatchedMEs.mePullMFSas->setAxisTitle("Pull distribution (measurement frame) (stereo) in " + label);
2418   }
2419 
2420   if (layerswitchTrackangleSas) {
2421     stereoandmatchedMEs.meTrackangleSas =
2422         bookME1D(ibooker,
2423                  "TH1TrackangleSas",
2424                  hidmanager.createHistoLayer("Track_angle_Sas", "layer", label, "").c_str(),
2425                  "Track angle");
2426     stereoandmatchedMEs.meTrackangleSas->setAxisTitle("Track angle (stereo) in " + label);
2427   }
2428   if (layerswitchTrackanglebetaSas) {
2429     stereoandmatchedMEs.meTrackanglebetaSas =
2430         bookME1D(ibooker,
2431                  "TH1TrackanglebetaSas",
2432                  hidmanager.createHistoLayer("Track_angle_beta_Sas", "layer", label, "").c_str(),
2433                  "Track angle beta");
2434     stereoandmatchedMEs.meTrackanglebetaSas->setAxisTitle("Track angle beta (stereo) in " + label);
2435   }
2436   if (layerswitchPullTrackangleProfileSas) {
2437     stereoandmatchedMEs.mePullTrackangleProfileSas =
2438         bookMEProfile(ibooker,
2439                       "TProfPullTrackangleProfileSas",
2440                       hidmanager.createHistoLayer("Pull_Track_angle_Profile_Sas", "layer", label, "").c_str(),
2441                       "Profile of Pull in MF vs track angle (stereo)");
2442     stereoandmatchedMEs.mePullTrackangleProfileSas->setAxisTitle("track angle (stereo) in " + label, 1);
2443     stereoandmatchedMEs.mePullTrackangleProfileSas->setAxisTitle("Pull in MF (stereo) in " + label, 2);
2444   }
2445   if (layerswitchTrackwidthSas) {
2446     stereoandmatchedMEs.meTrackwidthSas =
2447         bookME1D(ibooker,
2448                  "TH1TrackwidthSas",
2449                  hidmanager.createHistoLayer("Track_width_Sas", "layer", label, "").c_str(),
2450                  "Track width");
2451     stereoandmatchedMEs.meTrackwidthSas->setAxisTitle("Track width (stereo) in " + label);
2452   }
2453   if (layerswitchExpectedwidthSas) {
2454     stereoandmatchedMEs.meExpectedwidthSas =
2455         bookME1D(ibooker,
2456                  "TH1ExpectedwidthSas",
2457                  hidmanager.createHistoLayer("Expected_width_Sas", "layer", label, "").c_str(),
2458                  "Expected width");
2459     stereoandmatchedMEs.meExpectedwidthSas->setAxisTitle("Expected width (stereo) in " + label);
2460   }
2461   if (layerswitchClusterwidthSas) {
2462     stereoandmatchedMEs.meClusterwidthSas =
2463         bookME1D(ibooker,
2464                  "TH1ClusterwidthSas",
2465                  hidmanager.createHistoLayer("Cluster_width_Sas", "layer", label, "").c_str(),
2466                  "Cluster width");
2467     stereoandmatchedMEs.meClusterwidthSas->setAxisTitle("Cluster width (stereo) in " + label);
2468   }
2469   if (layerswitchCategorySas) {
2470     stereoandmatchedMEs.meCategorySas = bookME1D(
2471         ibooker, "TH1CategorySas", hidmanager.createHistoLayer("Category_Sas", "layer", label, "").c_str(), "Category");
2472     stereoandmatchedMEs.meCategorySas->setAxisTitle("Category (stereo) in " + label);
2473   }
2474   if (layerswitchPullTrackwidthProfileSas) {
2475     stereoandmatchedMEs.mePullTrackwidthProfileSas =
2476         bookMEProfile(ibooker,
2477                       "TProfPullTrackwidthProfileSas",
2478                       hidmanager.createHistoLayer("Pull_Track_width_Profile_Sas", "layer", label, "").c_str(),
2479                       "Profile of Pull in MF vs track width (stereo)");
2480     stereoandmatchedMEs.mePullTrackwidthProfileSas->setAxisTitle("track width (stereo) in " + label, 1);
2481     stereoandmatchedMEs.mePullTrackwidthProfileSas->setAxisTitle("Pull in MF (stereo) in " + label, 2);
2482   }
2483   if (layerswitchPullTrackwidthProfileCategory1Sas) {
2484     stereoandmatchedMEs.mePullTrackwidthProfileCategory1Sas =
2485         bookMEProfile(ibooker,
2486                       "TProfPullTrackwidthProfileCategory1Sas",
2487                       hidmanager.createHistoLayer("Pull_Track_width_Profile_Category1_Sas", "layer", label, "").c_str(),
2488                       "Profile of Pull in MF vs track width (Category 1) (stereo)");
2489     stereoandmatchedMEs.mePullTrackwidthProfileCategory1Sas->setAxisTitle(
2490         "track width (Category 1) (stereo) in " + label, 1);
2491     stereoandmatchedMEs.mePullTrackwidthProfileCategory1Sas->setAxisTitle(
2492         "Pull in MF (Category 1) (stereo) in " + label, 2);
2493   }
2494   if (layerswitchPullTrackwidthProfileCategory2Sas) {
2495     stereoandmatchedMEs.mePullTrackwidthProfileCategory2Sas =
2496         bookMEProfile(ibooker,
2497                       "TProfPullTrackwidthProfileCategory2Sas",
2498                       hidmanager.createHistoLayer("Pull_Track_width_Profile_Category2_Sas", "layer", label, "").c_str(),
2499                       "Profile of Pull in MF vs track width (Category 2) (stereo)");
2500     stereoandmatchedMEs.mePullTrackwidthProfileCategory2Sas->setAxisTitle(
2501         "track width (Category 2) (stereo) in " + label, 1);
2502     stereoandmatchedMEs.mePullTrackwidthProfileCategory2Sas->setAxisTitle(
2503         "Pull in MF (Category 2) (stereo) in " + label, 2);
2504   }
2505   if (layerswitchPullTrackwidthProfileCategory3Sas) {
2506     stereoandmatchedMEs.mePullTrackwidthProfileCategory3Sas =
2507         bookMEProfile(ibooker,
2508                       "TProfPullTrackwidthProfileCategory3Sas",
2509                       hidmanager.createHistoLayer("Pull_Track_width_Profile_Category3_Sas", "layer", label, "").c_str(),
2510                       "Profile of Pull in MF vs track width (Category 3) (stereo)");
2511     stereoandmatchedMEs.mePullTrackwidthProfileCategory3Sas->setAxisTitle(
2512         "track width (Category 3) (stereo) in " + label, 1);
2513     stereoandmatchedMEs.mePullTrackwidthProfileCategory3Sas->setAxisTitle(
2514         "Pull in MF (Category 3) (stereo) in " + label, 2);
2515   }
2516   if (layerswitchPullTrackwidthProfileCategory4Sas) {
2517     stereoandmatchedMEs.mePullTrackwidthProfileCategory4Sas =
2518         bookMEProfile(ibooker,
2519                       "TProfPullTrackwidthProfileCategory4Sas",
2520                       hidmanager.createHistoLayer("Pull_Track_width_Profile_Category4_Sas", "layer", label, "").c_str(),
2521                       "Profile of Pull in MF vs track width (Category 4) (stereo)");
2522     stereoandmatchedMEs.mePullTrackwidthProfileCategory4Sas->setAxisTitle(
2523         "track width (Category 4) (stereo) in " + label, 1);
2524     stereoandmatchedMEs.mePullTrackwidthProfileCategory4Sas->setAxisTitle(
2525         "Pull in MF (Category 4) (stereo) in " + label, 2);
2526   }
2527   if (layerswitchResolxMFTrackwidthProfileSas) {
2528     stereoandmatchedMEs.meResolxMFTrackwidthProfileSas =
2529         bookMEProfile(ibooker,
2530                       "TProfResolxMFTrackwidthProfileSas",
2531                       hidmanager.createHistoLayer("ResolxMF_Track_width_Profile_Sas", "layer", label, "").c_str(),
2532                       "Profile of Resolution in MF vs track width (stereo)");
2533     stereoandmatchedMEs.meResolxMFTrackwidthProfileSas->setAxisTitle("track width (stereo) in " + label, 1);
2534     stereoandmatchedMEs.meResolxMFTrackwidthProfileSas->setAxisTitle("Resolution in MF (stereo) in " + label, 2);
2535   }
2536   if (layerswitchResolxMFTrackwidthProfileCategory1Sas) {
2537     stereoandmatchedMEs.meResolxMFTrackwidthProfileCategory1Sas = bookMEProfile(
2538         ibooker,
2539         "TProfResolxMFTrackwidthProfileCategory1Sas",
2540         hidmanager.createHistoLayer("ResolxMF_Track_width_Profile_Category1_Sas", "layer", label, "").c_str(),
2541         "Profile of Resolution in MF vs track width (Category 1) (stereo)");
2542     stereoandmatchedMEs.meResolxMFTrackwidthProfileCategory1Sas->setAxisTitle(
2543         " track width (Category 1) (stereo) in " + label, 1);
2544     stereoandmatchedMEs.meResolxMFTrackwidthProfileCategory1Sas->setAxisTitle(
2545         "  Resolution in MF (Category 1) (stereo) in " + label, 2);
2546   }
2547   if (layerswitchResolxMFTrackwidthProfileCategory2Sas) {
2548     stereoandmatchedMEs.meResolxMFTrackwidthProfileCategory2Sas = bookMEProfile(
2549         ibooker,
2550         "TProfResolxMFTrackwidthProfileCategory2Sas",
2551         hidmanager.createHistoLayer("ResolxMF_Track_width_Profile_Category2_Sas", "layer", label, "").c_str(),
2552         "Profile of Resolution in MF vs track width (Category 2) (stereo)");
2553     stereoandmatchedMEs.meResolxMFTrackwidthProfileCategory2Sas->setAxisTitle(
2554         " track width (Category 2) (stereo) in " + label, 1);
2555     stereoandmatchedMEs.meResolxMFTrackwidthProfileCategory2Sas->setAxisTitle(
2556         " Resolution in MF (Category 2) (stereo) in " + label, 2);
2557   }
2558   if (layerswitchResolxMFTrackwidthProfileCategory3Sas) {
2559     stereoandmatchedMEs.meResolxMFTrackwidthProfileCategory3Sas = bookMEProfile(
2560         ibooker,
2561         "TProfResolxMFTrackwidthProfileCategory3Sas",
2562         hidmanager.createHistoLayer("ResolxMF_Track_width_Profile_Category3_Sas", "layer", label, "").c_str(),
2563         "Profile of Resolution in MF vs track width (Category 3) (stereo)");
2564     stereoandmatchedMEs.meResolxMFTrackwidthProfileCategory3Sas->setAxisTitle(
2565         " track width (Category 3) (stereo) in " + label, 1);
2566     stereoandmatchedMEs.meResolxMFTrackwidthProfileCategory3Sas->setAxisTitle(
2567         " Resolution in MF (Category 3) (stereo) in " + label, 2);
2568   }
2569   if (layerswitchResolxMFTrackwidthProfileCategory4Sas) {
2570     stereoandmatchedMEs.meResolxMFTrackwidthProfileCategory4Sas = bookMEProfile(
2571         ibooker,
2572         "TProfResolxMFTrackwidthProfileCategory4Sas",
2573         hidmanager.createHistoLayer("ResolxMF_Track_width_Profile_Category4_Sas", "layer", label, "").c_str(),
2574         "Profile of Resolution in MF vs track width (Category 4) (stereo)");
2575     stereoandmatchedMEs.meResolxMFTrackwidthProfileCategory4Sas->setAxisTitle(
2576         " track width (Category 4) (stereo) in " + label, 1);
2577     stereoandmatchedMEs.meResolxMFTrackwidthProfileCategory4Sas->setAxisTitle(
2578         " Resolution in MF (Category 4) (stereo) in " + label, 2);
2579   }
2580   if (layerswitchResolxMFClusterwidthProfileCategory1Sas) {
2581     stereoandmatchedMEs.meResolxMFClusterwidthProfileCategory1Sas = bookMEProfile(
2582         ibooker,
2583         "TProfResolxMFClusterwidthProfileCategory1Sas",
2584         hidmanager.createHistoLayer("ResolxMF_Cluster_width_Profile_Category1_Sas", "layer", label, "").c_str(),
2585         "Profile of Resolution in MF vs cluster width (Category 1) (stereo)");
2586     stereoandmatchedMEs.meResolxMFClusterwidthProfileCategory1Sas->setAxisTitle(
2587         "cluster width (Category 1) (stereo) in " + label, 1);
2588     stereoandmatchedMEs.meResolxMFClusterwidthProfileCategory1Sas->setAxisTitle(
2589         " Resolution in MF (Category 1) (stereo) in " + label, 2);
2590   }
2591   if (layerswitchResolxMFAngleProfileSas) {
2592     stereoandmatchedMEs.meResolxMFAngleProfileSas =
2593         bookMEProfile(ibooker,
2594                       "TProfResolxMFAngleProfileSas",
2595                       hidmanager.createHistoLayer("ResolxMF_Angle_Profile_Sas", "layer", label, "").c_str(),
2596                       "Profile of Resolution in MF vs track angle (stereo)");
2597     stereoandmatchedMEs.meResolxMFAngleProfileSas->setAxisTitle("track angle (stereo) in " + label, 1);
2598     stereoandmatchedMEs.meResolxMFAngleProfileSas->setAxisTitle("Resolution in MF (stereo) in " + label, 2);
2599   }
2600   //PosxMatched
2601   if (layerswitchPosxMatched) {
2602     stereoandmatchedMEs.mePosxMatched =
2603         bookME1D(ibooker,
2604                  "TH1PosxMatched",
2605                  hidmanager.createHistoLayer("Posx_matched", "layer", label, "").c_str(),
2606                  "RecHit x coord.");
2607     stereoandmatchedMEs.mePosxMatched->setAxisTitle("x coord. matched RecHit (local frame) in " + label);
2608   }
2609   //PosyMatched
2610   if (layerswitchPosyMatched) {
2611     stereoandmatchedMEs.mePosyMatched =
2612         bookME1D(ibooker,
2613                  "TH1PosyMatched",
2614                  hidmanager.createHistoLayer("Posy_matched", "layer", label, "").c_str(),
2615                  "RecHit y coord.");
2616     stereoandmatchedMEs.mePosyMatched->setAxisTitle("y coord. matched RecHit (local frame) in " + label);
2617   }
2618   //ResolxMatched
2619   if (layerswitchResolxMatched) {
2620     stereoandmatchedMEs.meResolxMatched =
2621         bookME1D(ibooker,
2622                  "TH1ResolxMatched",
2623                  hidmanager.createHistoLayer("Resolx_matched", "layer", label, "").c_str(),
2624                  "RecHit resol(x) coord.");
2625     stereoandmatchedMEs.meResolxMatched->setAxisTitle("resol(x) coord. matched RecHit (local frame) in " + label);
2626   }
2627   //ResolyMatched
2628   if (layerswitchResolyMatched) {
2629     stereoandmatchedMEs.meResolyMatched =
2630         bookME1D(ibooker,
2631                  "TH1ResolyMatched",
2632                  hidmanager.createHistoLayer("Resoly_matched", "layer", label, "").c_str(),
2633                  "RecHit resol(y) coord.");
2634     stereoandmatchedMEs.meResolyMatched->setAxisTitle("resol(y) coord. matched RecHit (local frame) in " + label);
2635   }
2636   //ResxMatched
2637   if (layerswitchResxMatched) {
2638     stereoandmatchedMEs.meResxMatched =
2639         bookME1D(ibooker,
2640                  "TH1ResxMatched",
2641                  hidmanager.createHistoLayer("Resx_matched", "layer", label, "").c_str(),
2642                  "Residual of the hit x coord.");
2643     stereoandmatchedMEs.meResxMatched->setAxisTitle("Residuals(x) in matched RecHit in " + label);
2644   }
2645   //ResyMatched
2646   if (layerswitchResyMatched) {
2647     stereoandmatchedMEs.meResyMatched =
2648         bookME1D(ibooker,
2649                  "TH1ResyMatched",
2650                  hidmanager.createHistoLayer("Resy_matched", "layer", label, "").c_str(),
2651                  "Residual of the hit x coord.");
2652     stereoandmatchedMEs.meResyMatched->setAxisTitle("Res(y) in matched RecHit in " + label);
2653   }
2654 
2655   StereoAndMatchedMEsMap[label] = stereoandmatchedMEs;
2656 }
2657 //------------------------------------------------------------------------------------------
2658 inline SiStripTrackingRecHitsValid::MonitorElement *SiStripTrackingRecHitsValid::bookME1D(DQMStore::IBooker &ibooker,
2659                                                                                           const char *ParameterSetLabel,
2660                                                                                           const char *HistoName,
2661                                                                                           const char *HistoTitle) {
2662   Parameters = conf_.getParameter<edm::ParameterSet>(ParameterSetLabel);
2663   return ibooker.book1D(HistoName,
2664                         HistoTitle,
2665                         Parameters.getParameter<int32_t>("Nbinx"),
2666                         Parameters.getParameter<double>("xmin"),
2667                         Parameters.getParameter<double>("xmax"));
2668 }
2669 //------------------------------------------------------------------------------------------
2670 inline SiStripTrackingRecHitsValid::MonitorElement *SiStripTrackingRecHitsValid::bookMEProfile(
2671     DQMStore::IBooker &ibooker, const char *ParameterSetLabel, const char *HistoName, const char *HistoTitle) {
2672   Parameters = conf_.getParameter<edm::ParameterSet>(ParameterSetLabel);
2673   //The number of channels in Y is disregarded in a profile plot.
2674   return ibooker.bookProfile(HistoName,
2675                              HistoTitle,
2676                              Parameters.getParameter<int32_t>("Nbinx"),
2677                              Parameters.getParameter<double>("xmin"),
2678                              Parameters.getParameter<double>("xmax"),
2679                              Parameters.getParameter<double>("ymin"),
2680                              Parameters.getParameter<double>("ymax"),
2681                              "");
2682 }
2683 
2684 // DEFINE_FWK_MODULE(SiStripTrackingRecHitsValid);